summaryrefslogtreecommitdiff
path: root/lib/ZFmtAuth.c
diff options
context:
space:
mode:
authorGravatar Karl Ramm <kcr@1ts.org>2009-07-26 21:25:27 +0000
committerGravatar Karl Ramm <kcr@1ts.org>2009-07-26 21:25:27 +0000
commita5cd467f1bf72245e01d33972a6d8c007894fdc1 (patch)
tree4edbc963af5eafa3f183895e700140fd1b6bcded /lib/ZFmtAuth.c
parent9a2edd44e85ce256d5402c9ba9146c28f8c48f1b (diff)
Remove the chock wedging things into DES mode and hopefully redo the keyusage stuff
such that it actually works.
Diffstat (limited to 'lib/ZFmtAuth.c')
-rw-r--r--lib/ZFmtAuth.c59
1 files changed, 30 insertions, 29 deletions
diff --git a/lib/ZFmtAuth.c b/lib/ZFmtAuth.c
index 92fb3c6..50e4073 100644
--- a/lib/ZFmtAuth.c
+++ b/lib/ZFmtAuth.c
@@ -7,7 +7,7 @@
*
* Copyright (c) 1987,1988 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
- * "mit-copyright.h".
+ * "mit-copyright.h".
*/
#ifndef lint
@@ -76,14 +76,14 @@ ZFormatAuthenticNoticeV5(ZNotice_t *notice,
int key_len;
char *cksum_start, *cstart, *cend;
int cksum_len;
-
+
key_len = Z_keylen(keyblock);
retval = Z_ExtractEncCksum(keyblock, &enctype, &cksumtype);
if (retval)
- return (ZAUTH_FAILED);
+ return (ZAUTH_FAILED);
#ifdef HAVE_KRB4
- if (key_len == 8 && (enctype == ENCTYPE_DES_CBC_CRC ||
+ if (key_len == 8 && (enctype == ENCTYPE_DES_CBC_CRC ||
enctype == ENCTYPE_DES_CBC_MD4 ||
enctype == ENCTYPE_DES_CBC_MD5)) {
C_Block tmp;
@@ -92,38 +92,39 @@ ZFormatAuthenticNoticeV5(ZNotice_t *notice,
tmp);
}
#endif
-
+
newnotice = *notice;
newnotice.z_auth = 1;
newnotice.z_authent_len = 0;
newnotice.z_ascii_authent = "";
if ((retval = Z_NewFormatRawHeader(&newnotice, buffer, buffer_len,
- &hdrlen,
- &cksum_start, &cksum_len, &cstart,
+ &hdrlen,
+ &cksum_start, &cksum_len, &cstart,
&cend)) != ZERR_NONE)
return (retval);
-
- retval = Z_InsertZcodeChecksum(keyblock, &newnotice, buffer,
- cksum_start, cksum_len, cstart, cend,
- buffer_len, &hdr_adj);
- if (retval)
- return retval;
-
- hdrlen += hdr_adj;
-
- ptr = buffer+hdrlen;
-
- if (newnotice.z_message_len+hdrlen > buffer_len)
- return (ZERR_PKTLEN);
-
- (void) memcpy(ptr, newnotice.z_message, newnotice.z_message_len);
-
- *len = hdrlen+newnotice.z_message_len;
-
- if (*len > Z_MAXPKTLEN)
- return (ZERR_PKTLEN);
-
- return (ZERR_NONE);
+
+ /* we know this is only called by the server */
+ retval = Z_InsertZcodeChecksum(keyblock, &newnotice, buffer,
+ cksum_start, cksum_len, cstart, cend,
+ buffer_len, &hdr_adj, 1);
+ if (retval)
+ return retval;
+
+ hdrlen += hdr_adj;
+
+ ptr = buffer+hdrlen;
+
+ if (newnotice.z_message_len+hdrlen > buffer_len)
+ return (ZERR_PKTLEN);
+
+ (void) memcpy(ptr, newnotice.z_message, newnotice.z_message_len);
+
+ *len = hdrlen+newnotice.z_message_len;
+
+ if (*len > Z_MAXPKTLEN)
+ return (ZERR_PKTLEN);
+
+ return (ZERR_NONE);
}
#endif