]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/auth/ntlm/SSPI/ntlm_sspi_auth.cc
Source Format Enforcement (#763)
[thirdparty/squid.git] / src / auth / ntlm / SSPI / ntlm_sspi_auth.cc
index 1275f3b1789934de3eb7b9f85a27260ae1122d01..7eec39d9da2600d8295923c74efb8846d8e155bf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1996-2016 The Squid Software Foundation and contributors
+ * Copyright (C) 1996-2021 The Squid Software Foundation and contributors
  *
  * Squid software is distributed under GPLv2+ license and includes
  * contributions from numerous individuals and organizations.
@@ -73,7 +73,7 @@
 
 #include "squid.h"
 #include "base64.h"
-#include "helpers/defines.h"
+#include "helper/protocol_defines.h"
 #include "ntlmauth/ntlmauth.h"
 #include "ntlmauth/support_bits.cci"
 #include "sspwin32.h"
@@ -248,7 +248,7 @@ char * GetDomainName(void)
                 debug("LsaQueryInformationPolicy Error: %ld\n", status);
             } else  {
 
-                /* Get name in useable format */
+                /* Get name in usable format */
                 DomainName = AllocStrFromLSAStr(ppdiDomainInfo->Name);
 
                 /*
@@ -399,7 +399,7 @@ process_options(int argc, char *argv[])
             break;
         case 'h':
             usage();
-            exit(0);
+            exit(EXIT_SUCCESS);
         case '?':
             opt = optopt;
         /* fall thru to default */
@@ -410,7 +410,7 @@ process_options(int argc, char *argv[])
         }
     }
     if (had_error)
-        exit(1);
+        exit(EXIT_FAILURE);
 }
 
 static bool
@@ -418,7 +418,7 @@ token_decode(size_t *decodedLen, uint8_t decoded[], const char *buf)
 {
     struct base64_decode_ctx ctx;
     base64_decode_init(&ctx);
-    if (!base64_decode_update(&ctx, decodedLen, decoded, strlen(buf), reinterpret_cast<const uint8_t*>(buf)) ||
+    if (!base64_decode_update(&ctx, decodedLen, decoded, strlen(buf), buf) ||
             !base64_decode_final(&ctx)) {
         SEND_BH("message=\"base64 decode failed\"");
         fprintf(stderr, "ERROR: base64 decoding failed for: '%s'\n", buf);
@@ -460,7 +460,7 @@ manage_request()
         char *c = static_cast<char*>(memchr(buf, '\n', sizeof(buf)));
         if (c) {
             if (oversized) {
-                helperfail("messge=\"illegal request received\"");
+                helperfail("message=\"illegal request received\"");
                 fprintf(stderr, "Illegal request received: '%s'\n", buf);
                 return 1;
             }
@@ -641,7 +641,7 @@ main(int argc, char *argv[])
 
     if (LoadSecurityDll(SSP_NTLM, NTLM_PACKAGE_NAME) == NULL) {
         fprintf(stderr, "FATAL, can't initialize SSPI, exiting.\n");
-        exit(1);
+        exit(EXIT_FAILURE);
     }
     debug("SSPI initialized OK\n");
 
@@ -654,6 +654,6 @@ main(int argc, char *argv[])
     while (manage_request()) {
         /* everything is done within manage_request */
     }
-    exit(0);
+    return EXIT_SUCCESS;
 }