]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Author: Markus <huaraz@moeller.plus.com>
authorAmos Jeffries <amosjeffries@squid-cache.org>
Wed, 13 Aug 2008 06:04:16 +0000 (00:04 -0600)
committerAmos Jeffries <amosjeffries@squid-cache.org>
Wed, 13 Aug 2008 06:04:16 +0000 (00:04 -0600)
Bug 2426: Increase buffer in authenticateNegotiateStart / squid_kerb_auth

helpers/negotiate_auth/squid_kerb_auth/squid_kerb_auth.c
src/auth/negotiate/auth_negotiate.cc

index 08acc269ee70799a3063eead5886fed65ba634a8..cad7e6f1a161f383fbf74f656b83bd1c880a7ae2 100644 (file)
 #include "spnegohelp.h"
 #endif
 
+// AYJ: must match the definition in src/auth/negotiate/auth_negotiate.cc
+#define MAX_AUTHTOKEN_LEN      32768
+
+// AYJ: match define in include/rfc2181.h
 #ifndef HOST_NAME_MAX
 #define HOST_NAME_MAX 256
 #endif
@@ -172,11 +176,9 @@ int check_gss_err(OM_uint32 major_status, OM_uint32 minor_status, const char* fu
   return(0);
 }
 
-
-
 int main(int argc, char * const argv[])
 {
-  char buf[6400];
+  char buf[MAX_AUTHTOKEN_LEN];
   char *c;
   int length=0;
   static int err=0;
index 9f7ceaccdcf34bce3136faef9e66dec73f268f73..a9d2c793841ab7b1e24359b1bcfbeb90ab182bd7 100644 (file)
 #include "negotiateScheme.h"
 #include "wordlist.h"
 
+/**
+ * Maximum length (buffer size) for token strings.
+ */
+// AYJ: must match re-definition in helpers/negotiate_auth/squid_kerb_auth/squid_kerb_auth.c
+#define MAX_AUTHTOKEN_LEN   32768
+
 static void
 authenticateNegotiateReleaseServer(AuthUserRequest * auth_user_request);
 
@@ -547,7 +553,7 @@ void
 AuthNegotiateUserRequest::module_start(RH * handler, void *data)
 {
     authenticateStateData *r = NULL;
-    static char buf[8192];
+    static char buf[MAX_AUTHTOKEN_LEN];
     negotiate_user_t *negotiate_user;
     auth_user_t *auth_user = user();
 
@@ -573,9 +579,9 @@ AuthNegotiateUserRequest::module_start(RH * handler, void *data)
     AUTHUSERREQUESTLOCK(r->auth_user_request, "r");
 
     if (auth_state == AUTHENTICATE_STATE_INITIAL) {
-        snprintf(buf, 8192, "YR %s\n", client_blob); //CHECKME: can ever client_blob be 0 here?
+        snprintf(buf, MAX_AUTHTOKEN_LEN, "YR %s\n", client_blob); //CHECKME: can ever client_blob be 0 here?
     } else {
-        snprintf(buf, 8192, "KK %s\n", client_blob);
+        snprintf(buf, MAX_AUTHTOKEN_LEN, "KK %s\n", client_blob);
     }
 
     waiting = 1;