int ForEachMatchingIndirectHost ( ARRAY8Ptr clientAddress, CARD16 connectionType, ChooserFunc function, char *closure) { int haveLocalhost = 0; DisplayEntry *d; char *clientName = NULL; for (d = database; d; d = d->next) { switch (d->type) { case DISPLAY_ALIAS: case DISPLAY_LISTEN: continue; case DISPLAY_PATTERN: if (!clientName) clientName = NetworkAddressToHostname (connectionType, clientAddress); if (!patternMatch (clientName, d->entry.displayPattern)) continue; break; case DISPLAY_ADDRESS: if (d->entry.displayAddress.connectionType != connectionType || !XdmcpARRAY8Equal (&d->entry.displayAddress.clientAddress, clientAddress)) { continue; } break; } if (!d->hosts) continue; if (d->notAllowed) break; if (d->chooser) { ARRAY8Ptr choice; choice = IndirectChoice (clientAddress, connectionType); if (!choice || XdmcpARRAY8Equal (getLocalAddress(), choice)) haveLocalhost = 1; else (*function) (connectionType, choice, closure); } else if (scanHostlist (d->hosts, clientAddress, connectionType, function, closure, 0, FALSE)) { haveLocalhost = 1; } break; } free (clientName); return haveLocalhost; }
int UseChooser ( ARRAY8Ptr clientAddress, CARD16 connectionType) { DisplayEntry *d; char *clientName = NULL; for (d = database; d; d = d->next) { switch (d->type) { case DISPLAY_ALIAS: continue; case DISPLAY_PATTERN: if (!clientName) clientName = NetworkAddressToHostname (connectionType, clientAddress); if (!patternMatch (clientName, d->entry.displayPattern)) continue; break; case DISPLAY_ADDRESS: if (d->entry.displayAddress.connectionType != connectionType || !XdmcpARRAY8Equal (&d->entry.displayAddress.clientAddress, clientAddress)) { continue; } break; } if (!d->hosts) continue; if (d->notAllowed) break; if (d->chooser && !IndirectChoice (clientAddress, connectionType)) { if (clientName) free (clientName); return 1; } break; } if (clientName) free (clientName); return 0; }