]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 609: When msntusers.allow have a more thet 256 lines, mantauth crashes
authorhno <>
Tue, 6 May 2003 13:55:51 +0000 (13:55 +0000)
committerhno <>
Tue, 6 May 2003 13:55:51 +0000 (13:55 +0000)
Bug 612: msntauth crashes on kill -HUP if no allow/deny file is specified

helpers/basic_auth/MSNT/usersfile.c

index 53d62ac0b91ae6ef95e4ff3e3616c424b7938052..90dc7598ea5c23fb7b8e87d80c9b73f2db197c8f 100644 (file)
@@ -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);
 }