]> asedeno.scripts.mit.edu Git - 1ts-debian.git/blobdiff - zephyr/lib/ZCkZAut.c
keep track of total # of incoming header fields, and cksum appropriately
[1ts-debian.git] / zephyr / lib / ZCkZAut.c
index 19ec6d1129be575b70d2c1341f5746d7b67199a7..46e6472dcabe07b9181001f40e25c814919a4985 100644 (file)
@@ -103,9 +103,16 @@ Code_t ZCheckZcodeAuthentication(ZNotice_t *notice,
         cksum1_base = notice->z_multinotice;
         if (notice->z_num_other_fields)
            x = notice->z_other_fields[notice->z_num_other_fields - 1];
-        else
-          x = cksum1_base + strlen(cksum1_base) + 1; /* multiuid */
-        cksum1_len  = x + strlen(x) + 1 - cksum1_base;
+        else  {
+           /* see also server/kstuff.c:ZCheckRealmAuthentication */
+           /* XXXXXXXXXXXXXXXXXXXXXXX */
+           x = cksum1_base + strlen(cksum1_base) + 1; /* multinotice */
+           if (notice->z_num_hdr_fields > 17)
+               x = x + strlen(x) + 1; /* multiuid */
+           if (notice->z_num_hdr_fields > 18)
+               x = x + strlen(x) + 1; /* sender */
+       }
+       cksum1_len  = x + strlen(x) + 1 - cksum1_base; /* charset / extra field */
 
         /* last part is the message body */
         cksum2_base = notice->z_message;