]> asedeno.scripts.mit.edu Git - 1ts-debian.git/blobdiff - zephyr/server/kstuff.c
keep track of total # of incoming header fields, and cksum appropriately
[1ts-debian.git] / zephyr / server / kstuff.c
index 1f328a6d78fa0c6d8a87e879645ff751948e2cbf..f3154aa3c1d89e074c5fe0c9bb9e3a9d1f98bb8a 100644 (file)
@@ -431,15 +431,24 @@ ZCheckRealmAuthentication(ZNotice_t *notice,
     cksum0_len  = x + strlen(x) + 1 - cksum0_base; 
     /* second part is from z_multinotice through other fields: 
      * - z_multinotice 
-     * - z_multiuid 
+     * - z_multiuid
+     * - z_sender_(sock)addr
+     * - z_charset
      * - z_other_fields[] 
      */ 
     cksum1_base = notice->z_multinotice; 
     if (notice->z_num_other_fields) 
-        x = notice->z_other_fields[notice->z_num_other_fields]; 
-    else 
-        x = cksum1_base + strlen(cksum1_base) + 1; /* multiuid */ 
-    cksum1_len  = x + strlen(x) + 1 - cksum1_base; 
+        x = notice->z_other_fields[notice->z_num_other_fields - 1]; 
+    else {
+       /* see also lib/ZCkZaut.c:ZCheckZcodeAuthentication */
+       /* 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;