From d9aeddd23c505912764e5263c4f117b84987e58f Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Mon, 2 Jun 2003 03:01:23 +0000 Subject: [PATCH] * citserver.c: added another trace message to is_public_client(). Uncensored has crashed twice in this function, for no apparent reason. * internet_addressing.c: don't attempt to look up the specified Internet address in a Citadel directory, if the supplied address has no hostname portion. (Fixes a crash in the calendar service when alias() attempts to look up potentially nonexistent attendees during event validation) --- citadel/ChangeLog | 9 +++++++++ citadel/citserver.c | 13 ++++++++----- citadel/internet_addressing.c | 9 +++++++++ 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/citadel/ChangeLog b/citadel/ChangeLog index 9bfe0cae8..d533073fa 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,12 @@ $Log$ + Revision 606.6 2003/06/02 03:01:22 ajc + * citserver.c: added another trace message to is_public_client(). Uncensored + has crashed twice in this function, for no apparent reason. + * internet_addressing.c: don't attempt to look up the specified Internet + address in a Citadel directory, if the supplied address has no hostname + portion. (Fixes a crash in the calendar service when alias() attempts to + look up potentially nonexistent attendees during event validation) + Revision 606.5 2003/05/28 03:08:38 ajc * msgbase.c: validate_recipients() now rejects Internet addresses in domains belonging to the local system or an attached Citadel network, @@ -4734,3 +4742,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import + diff --git a/citadel/citserver.c b/citadel/citserver.c index 567468e12..2694739fd 100644 --- a/citadel/citserver.c +++ b/citadel/citserver.c @@ -404,25 +404,28 @@ static int hostnames_match(const char *realname, const char *testname) { } /* - * check a hostname against the public_clients file + * Check a hostname against the public_clients file. This determines + * whether the client is allowed to change the hostname for this session + * (for example, to show the location of the user rather than the location + * of the client). */ int is_public_client(char *where) { char buf[SIZ]; FILE *fp; - lprintf(9, "Checking whether %s is a public client\n", where); - + lprintf(9, "Checking whether %s is a local client\n", where); if (hostnames_match(where, "localhost")) return(1); if (hostnames_match(where, config.c_fqdn)) return(1); - fp = fopen("public_clients","r"); + lprintf(9, "Checking whether %s is a public client\n", where); + fp = fopen("public_clients", "r"); if (fp == NULL) return(0); while (fgets(buf, sizeof buf, fp)!=NULL) { while (isspace((buf[strlen(buf)-1]))) buf[strlen(buf)-1] = 0; - if (hostnames_match(where,buf)) { + if (hostnames_match(where, buf)) { fclose(fp); return(1); } diff --git a/citadel/internet_addressing.c b/citadel/internet_addressing.c index ca45a4b09..c6837c38e 100644 --- a/citadel/internet_addressing.c +++ b/citadel/internet_addressing.c @@ -73,6 +73,8 @@ int CtdlHostAlias(char *fqdn) { char buf[SIZ]; char host[SIZ], type[SIZ]; + if (fqdn == NULL) return(hostalias_nomatch); + if (strlen(fqdn) == 0) return(hostalias_nomatch); if (!strcasecmp(fqdn, config.c_fqdn)) return(hostalias_localhost); if (!strcasecmp(fqdn, config.c_nodename)) return(hostalias_localhost); if (inetcfg == NULL) return(hostalias_nomatch); @@ -629,6 +631,13 @@ int CtdlDirectoryLookup(char *target, char *internet_addr) { struct cdbdata *cdbrec; char key[SIZ]; + /* Dump it in there unchanged, just for kicks */ + strcpy(target, internet_addr); + + /* Only do lookups for addresses with hostnames in them */ + if (num_tokens(internet_addr, '@') != 2) return(-1); + + /* Only do lookups for domains in the directory */ if (IsDirectory(internet_addr) == 0) return(-1); directory_key(key, internet_addr); -- 2.30.2