]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Author: Markus Moeller <huaraz@moeller.plus.com>
authorHenrik Nordstrom <henrik@henriknordstrom.net>
Tue, 9 Feb 2010 20:04:44 +0000 (21:04 +0100)
committerHenrik Nordstrom <henrik@henriknordstrom.net>
Tue, 9 Feb 2010 20:04:44 +0000 (21:04 +0100)
squid_kerb_auth logging clarification

add ERROR, WARNING, etc to the logging messages.

helpers/negotiate_auth/kerberos/negotiate_kerberos_auth.cc

index ff5afe7997e28eff6fb3b1ccd4cf2a293e9e8fea..68f2a789749b5bb9def9eef7f67322e4bdcb8ad9 100644 (file)
@@ -120,14 +120,14 @@ gethost_name(void)
 
     rc = gethostname(hostname, sysconf(_SC_HOST_NAME_MAX));
     if (rc) {
-        fprintf(stderr, "%s| %s: error while resolving hostname '%s'\n",
+        fprintf(stderr, "%s| %s: ERROR: resolving hostname '%s' failed\n",
                 LogTime(), PROGRAM, hostname);
         return NULL;
     }
     rc = xgetaddrinfo(hostname, NULL, NULL, &hres);
     if (rc != 0) {
         fprintf(stderr,
-                "%s| %s: error while resolving hostname with getaddrinfo: %s\n",
+                "%s| %s: ERROR: resolving hostname with getaddrinfo: %s failed\n",
                 LogTime(), PROGRAM, xgai_strerror(rc));
         return NULL;
     }
@@ -141,7 +141,7 @@ gethost_name(void)
                       sizeof(hostname), NULL, 0, 0);
     if (rc != 0) {
         fprintf(stderr,
-                "%s| %s: error while resolving ip address with getnameinfo: %s\n",
+                "%s| %s: ERROR: resolving ip address with getnameinfo: %s failed\n",
                 LogTime(), PROGRAM, xgai_strerror(rc));
         xfreeaddrinfo(hres);
         return NULL;
@@ -199,11 +199,11 @@ check_gss_err(OM_uint32 major_status, OM_uint32 minor_status,
             gss_release_buffer(&min_stat, &status_string);
         }
         if (debug)
-            fprintf(stderr, "%s| %s: %s failed: %s\n", LogTime(), PROGRAM,
+            fprintf(stderr, "%s| %s: ERROR: %s failed: %s\n", LogTime(), PROGRAM,
                     function, buf);
         fprintf(stdout, "BH %s failed: %s\n", function, buf);
         if (log)
-            fprintf(stderr, "%s| %s: User not authenticated\n", LogTime(),
+            fprintf(stderr, "%s| %s: INFO: User not authenticated\n", LogTime(),
                     PROGRAM);
         return (1);
     }
@@ -267,13 +267,13 @@ main(int argc, char *const argv[])
             fprintf(stderr, "default SPN is HTTP/fqdn@DEFAULT_REALM\n");
             exit(0);
         default:
-            fprintf(stderr, "%s| %s: unknown option: -%c.\n", LogTime(),
+            fprintf(stderr, "%s| %s: WARNING: unknown option: -%c.\n", LogTime(),
                     PROGRAM, opt);
         }
     }
 
     if (debug)
-        fprintf(stderr, "%s| %s: Starting version %s\n", LogTime(), PROGRAM,
+        fprintf(stderr, "%s| %s: INFO: Starting version %s\n", LogTime(), PROGRAM,
                 SQUID_KERB_AUTH_VERSION);
     if (service_principal && strcasecmp(service_principal, "GSS_C_NO_NAME")) {
         service.value = service_principal;
@@ -282,7 +282,7 @@ main(int argc, char *const argv[])
         host_name = gethost_name();
         if (!host_name) {
             fprintf(stderr,
-                    "%s| %s: Local hostname could not be determined. Please specify the service principal\n",
+                    "%s| %s: FATAL: Local hostname could not be determined. Please specify the service principal\n",
                     LogTime(), PROGRAM);
             fprintf(stdout, "BH hostname error\n");
             exit(-1);
@@ -298,7 +298,7 @@ main(int argc, char *const argv[])
             if (ferror(stdin)) {
                 if (debug)
                     fprintf(stderr,
-                            "%s| %s: fgets() failed! dying..... errno=%d (%s)\n",
+                            "%s| %s: FATAL: fgets() failed! dying..... errno=%d (%s)\n",
                             LogTime(), PROGRAM, ferror(stdin),
                             strerror(ferror(stdin)));
 
@@ -318,7 +318,7 @@ main(int argc, char *const argv[])
         }
         if (err) {
             if (debug)
-                fprintf(stderr, "%s| %s: Oversized message\n", LogTime(),
+                fprintf(stderr, "%s| %s: ERROR: Oversized message\n", LogTime(),
                         PROGRAM);
             fprintf(stdout, "BH Oversized message\n");
             err = 0;
@@ -326,12 +326,12 @@ main(int argc, char *const argv[])
         }
 
         if (debug)
-            fprintf(stderr, "%s| %s: Got '%s' from squid (length: %d).\n",
+            fprintf(stderr, "%s| %s: DEBUG: Got '%s' from squid (length: %d).\n",
                     LogTime(), PROGRAM, buf, length);
 
         if (buf[0] == '\0') {
             if (debug)
-                fprintf(stderr, "%s| %s: Invalid request\n", LogTime(),
+                fprintf(stderr, "%s| %s: ERROR: Invalid request\n", LogTime(),
                         PROGRAM);
             fprintf(stdout, "BH Invalid request\n");
             continue;
@@ -339,7 +339,7 @@ main(int argc, char *const argv[])
 
         if (strlen(buf) < 2) {
             if (debug)
-                fprintf(stderr, "%s| %s: Invalid request [%s]\n", LogTime(),
+                fprintf(stderr, "%s| %s: ERROR: Invalid request [%s]\n", LogTime(),
                         PROGRAM, buf);
             fprintf(stdout, "BH Invalid request\n");
             continue;
@@ -382,7 +382,7 @@ main(int argc, char *const argv[])
 
         if (strncmp(buf, "YR", 2) && strncmp(buf, "KK", 2)) {
             if (debug)
-                fprintf(stderr, "%s| %s: Invalid request [%s]\n", LogTime(),
+                fprintf(stderr, "%s| %s: ERROR: Invalid request [%s]\n", LogTime(),
                         PROGRAM, buf);
             fprintf(stdout, "BH Invalid request\n");
             continue;
@@ -395,7 +395,7 @@ main(int argc, char *const argv[])
 
         if (strlen(buf) <= 3) {
             if (debug)
-                fprintf(stderr, "%s| %s: Invalid negotiate request [%s]\n",
+                fprintf(stderr, "%s| %s: ERROR: Invalid negotiate request [%s]\n",
                         LogTime(), PROGRAM, buf);
             fprintf(stdout, "BH Invalid negotiate request\n");
             continue;
@@ -403,7 +403,7 @@ main(int argc, char *const argv[])
 
         input_token.length = ska_base64_decode_len(buf + 3);
         if (debug)
-            fprintf(stderr, "%s| %s: Decode '%s' (decoded length: %d).\n",
+            fprintf(stderr, "%s| %s: DEBUG: Decode '%s' (decoded length: %d).\n",
                     LogTime(), PROGRAM, buf + 3, (int) input_token.length);
         input_token.value = xmalloc(input_token.length);
 
@@ -413,7 +413,7 @@ main(int argc, char *const argv[])
         if ((input_token.length >= sizeof ntlmProtocol + 1) &&
                 (!memcmp(input_token.value, ntlmProtocol, sizeof ntlmProtocol))) {
             if (debug)
-                fprintf(stderr, "%s| %s: received type %d NTLM token\n",
+                fprintf(stderr, "%s| %s: WARNING: received type %d NTLM token\n",
                         LogTime(), PROGRAM,
                         (int) *((unsigned char *) input_token.value +
                                 sizeof ntlmProtocol));
@@ -462,7 +462,7 @@ main(int argc, char *const argv[])
             token = (char*)xmalloc(ska_base64_encode_len(spnegoTokenLength));
             if (token == NULL) {
                 if (debug)
-                    fprintf(stderr, "%s| %s: Not enough memory\n", LogTime(),
+                    fprintf(stderr, "%s| %s: ERROR: Not enough memory\n", LogTime(),
                             PROGRAM);
                 fprintf(stdout, "BH Not enough memory\n");
                 goto cleanup;
@@ -476,7 +476,7 @@ main(int argc, char *const argv[])
                 goto cleanup;
             if (major_status & GSS_S_CONTINUE_NEEDED) {
                 if (debug)
-                    fprintf(stderr, "%s| %s: continuation needed\n", LogTime(),
+                    fprintf(stderr, "%s| %s: INFO: continuation needed\n", LogTime(),
                             PROGRAM);
                 fprintf(stdout, "TT %s\n", token);
                 goto cleanup;
@@ -492,7 +492,7 @@ main(int argc, char *const argv[])
             user = (char*)xmalloc(output_token.length + 1);
             if (user == NULL) {
                 if (debug)
-                    fprintf(stderr, "%s| %s: Not enough memory\n", LogTime(),
+                    fprintf(stderr, "%s| %s: ERROR: Not enough memory\n", LogTime(),
                             PROGRAM);
                 fprintf(stdout, "BH Not enough memory\n");
                 goto cleanup;
@@ -504,10 +504,10 @@ main(int argc, char *const argv[])
             }
             fprintf(stdout, "AF %s %s\n", token, user);
             if (debug)
-                fprintf(stderr, "%s| %s: AF %s %s\n", LogTime(), PROGRAM, token,
+                fprintf(stderr, "%s| %s: DEBUG: AF %s %s\n", LogTime(), PROGRAM, token,
                         user);
             if (log)
-                fprintf(stderr, "%s| %s: User %s authenticated\n", LogTime(),
+                fprintf(stderr, "%s| %s: INFO: User %s authenticated\n", LogTime(),
                         PROGRAM, user);
             goto cleanup;
         } else {
@@ -516,7 +516,7 @@ main(int argc, char *const argv[])
                 goto cleanup;
             if (major_status & GSS_S_CONTINUE_NEEDED) {
                 if (debug)
-                    fprintf(stderr, "%s| %s: continuation needed\n", LogTime(),
+                    fprintf(stderr, "%s| %s: INFO: continuation needed\n", LogTime(),
                             PROGRAM);
                 fprintf(stdout, "NA %s\n", token);
                 goto cleanup;
@@ -535,7 +535,7 @@ main(int argc, char *const argv[])
             user = (char*)xmalloc(output_token.length + 1);
             if (user == NULL) {
                 if (debug)
-                    fprintf(stderr, "%s| %s: Not enough memory\n", LogTime(),
+                    fprintf(stderr, "%s| %s: ERROR: Not enough memory\n", LogTime(),
                             PROGRAM);
                 fprintf(stdout, "BH Not enough memory\n");
                 goto cleanup;
@@ -547,10 +547,10 @@ main(int argc, char *const argv[])
             }
             fprintf(stdout, "AF %s %s\n", "AA==", user);
             if (debug)
-                fprintf(stderr, "%s| %s: AF %s %s\n", LogTime(), PROGRAM,
+                fprintf(stderr, "%s| %s: DEBUG: AF %s %s\n", LogTime(), PROGRAM,
                         "AA==", user);
             if (log)
-                fprintf(stderr, "%s| %s: User %s authenticated\n", LogTime(),
+                fprintf(stderr, "%s| %s: INFO: User %s authenticated\n", LogTime(),
                         PROGRAM, user);
 
         }