From: hno <> Date: Tue, 6 May 2003 13:55:51 +0000 (+0000) Subject: Bug 609: When msntusers.allow have a more thet 256 lines, mantauth crashes X-Git-Tag: SQUID_3_0_PRE1~209 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a7d5f733673efcbac5ec6ad419d480cd390eba74;p=thirdparty%2Fsquid.git Bug 609: When msntusers.allow have a more thet 256 lines, mantauth crashes Bug 612: msntauth crashes on kill -HUP if no allow/deny file is specified --- diff --git a/helpers/basic_auth/MSNT/usersfile.c b/helpers/basic_auth/MSNT/usersfile.c index 53d62ac0b9..90dc7598ea 100644 --- a/helpers/basic_auth/MSNT/usersfile.c +++ b/helpers/basic_auth/MSNT/usersfile.c @@ -107,9 +107,9 @@ Read_usersfile(const char *path, usersfile * uf) uf->names = calloc(uf->Alloc, sizeof(*uf->names)); } else if (uf->Inuse == uf->Alloc) { uf->Alloc = uf->Alloc << 1; - uf->names = realloc(uf->names, uf->Alloc); + uf->names = realloc(uf->names, uf->Alloc * sizeof(*uf->names)); /* zero out the newly allocated memory */ - memset(uf->names[uf->Alloc >> 1], + memset(&uf->names[uf->Alloc >> 1], '\0', (uf->Alloc >> 1) * sizeof(*uf->names)); } @@ -170,6 +170,9 @@ Check_forfilechange(usersfile * uf) /* Stat the allowed users file. If it cannot be accessed, return. */ + if (uf->path == NULL) + return; + if (stat(uf->path, &ChkBuf) < 0) { if (errno == ENOENT) { uf->LMT = 0; @@ -186,6 +189,6 @@ Check_forfilechange(usersfile * uf) /* * The file changed, so re-read it. */ - syslog(LOG_INFO, "Check_forchange: Reloading user list."); + syslog(LOG_INFO, "Check_forfilechange: Reloading user list '%s'.", uf->path); Read_usersfile(NULL, uf); }