Index: auth_flatfile.c =================================================================== RCS file: /home/chris/vcvs/repos/tpop3d/auth_flatfile.c,v retrieving revision 1.2 diff -u -r1.2 auth_flatfile.c --- auth_flatfile.c 17 Feb 2003 23:18:32 -0000 1.2 +++ auth_flatfile.c 23 Feb 2004 16:56:50 -0000 @@ -79,14 +79,15 @@ return ret; } -/* read_user_passwd LOCALPART DOMAIN - * Read the password hash from the proper flat file for the given LOCALPART and +/* read_user_passwd USER DOMAIN + * Read the password hash from the proper flat file for the given USER and * DOMAIN. Returns the password or NULL if not found. The files are structured * with colon-separated fields, where the first field is the local-part and the * second field to the password hash. Any subsequent fields are ignored. */ -static char *read_user_passwd(const char *local_part, const char *domain) { +static char *read_user_passwd(const char *username, const char *domain) { FILE *fp = NULL; char *filename = NULL; + char *result = NULL; struct sverr err; static char *buf, *pwhash; static size_t buflen; @@ -143,12 +144,14 @@ *pwhash++ = 0; /* Check username. */ - if (strcmp(user, local_part) != 0) + if (strcmp(user, username) != 0) continue; if ((end = strchr(pwhash, ':'))) *end = 0; + result = pwhash; + break; } @@ -159,7 +162,7 @@ if (filename) xfree(filename); - return pwhash; + return result; } /* auth_flatfile_new_user_pass: @@ -173,7 +176,7 @@ who = username_string(user, local_part, domain); - pwhash = read_user_passwd(local_part, domain); + pwhash = read_user_passwd(user, domain); if (pwhash) { if (check_password(who, pwhash, pass, "{crypt}")) a = authcontext_new(virtual_uid, virtual_gid, NULL, NULL, NULL);