summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Karl Ramm <kcr@mit.edu>2009-03-24 03:40:55 +0000
committerGravatar Karl Ramm <kcr@mit.edu>2009-03-24 03:40:55 +0000
commit1f49ca59077f337c6327e80833265ac32932b876 (patch)
tree1b6eeab4ebe9b032e8930a9e025587dbb4f36183
parentcf8bf8391cffc4cd35e634a8b9a3adf954260b88 (diff)
keep track of total # of incoming header fields, and cksum appropriately
-rw-r--r--h/zephyr/zephyr.h1
-rw-r--r--lib/ZCkZAut.c13
-rw-r--r--lib/ZParseNot.c1
-rw-r--r--server/kstuff.c19
4 files changed, 26 insertions, 8 deletions
diff --git a/h/zephyr/zephyr.h b/h/zephyr/zephyr.h
index 2c6a543..c2420f7 100644
--- a/h/zephyr/zephyr.h
+++ b/h/zephyr/zephyr.h
@@ -112,6 +112,7 @@ typedef struct _ZNotice_t {
char *z_other_fields[Z_MAXOTHERFIELDS];
caddr_t z_message;
int z_message_len;
+ int z_num_hdr_fields;
} ZNotice_t;
/* Subscription structure */
diff --git a/lib/ZCkZAut.c b/lib/ZCkZAut.c
index 19ec6d1..46e6472 100644
--- a/lib/ZCkZAut.c
+++ b/lib/ZCkZAut.c
@@ -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;
diff --git a/lib/ZParseNot.c b/lib/ZParseNot.c
index 97c5225..d3076c7 100644
--- a/lib/ZParseNot.c
+++ b/lib/ZParseNot.c
@@ -77,6 +77,7 @@ ZParseNotice(char *buffer,
if (ZReadAscii32(ptr, end-ptr, &temp) == ZERR_BADFIELD)
BAD_PACKET;
numfields = temp;
+ notice->z_num_hdr_fields = numfields;
ptr = next_field(ptr, end);
/*XXX 3 */
diff --git a/server/kstuff.c b/server/kstuff.c
index 5ae30d4..3a013e1 100644
--- a/server/kstuff.c
+++ b/server/kstuff.c
@@ -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;