From e728148dff0baabd858d60eb2d60ea719ebdc2fe Mon Sep 17 00:00:00 2001 From: "Robert S. French" Date: Tue, 23 Jun 1987 12:57:13 +0000 Subject: KRB format --- lib/ZParseNot.c | 104 ++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 64 insertions(+), 40 deletions(-) (limited to 'lib/ZParseNot.c') diff --git a/lib/ZParseNot.c b/lib/ZParseNot.c index a870e72..89346f3 100644 --- a/lib/ZParseNot.c +++ b/lib/ZParseNot.c @@ -16,39 +16,53 @@ #include -Code_t ZParseNotice(buffer,len,notice,auth) +Code_t ZParseNotice(buffer,len,notice,auth,from) ZPacket_t buffer; int len; ZNotice_t *notice; int *auth; + struct sockaddr_in *from; { - char *ptr; + char *ptr,*cksum; + int result; unsigned int temp[3]; - + AUTH_DAT dat; + KTEXT_ST authent; + Key_schedule sess_sched; + ZChecksum_t our_checksum; + CREDENTIALS cred; + ptr = buffer; - if (Z_ReadField(&ptr,temp,1)) + if (ZReadAscii(ptr,temp,sizeof(int)) == ZERR_BADFIELD) return (ZERR_BADPKT); + ptr += strlen(ptr)+1; if (*temp != ZVERSION) return (ZERR_VERS); - if (Z_ReadField(&ptr,temp,1)) + if (ZReadAscii(ptr,temp,sizeof(int)) == ZERR_BADFIELD) return (ZERR_BADPKT); notice->z_kind = (ZNotice_Kind_t)*temp; - - if (Z_ReadField(&ptr,temp,1)) + ptr += strlen(ptr)+1; + + if (ZReadAscii(ptr,temp,sizeof(ZUnique_Id_t)) == ZERR_BADFIELD) return (ZERR_BADPKT); - notice->z_port = (short)*temp; + bcopy(temp,¬ice->z_uid,sizeof(ZUnique_Id_t)); + ptr += strlen(ptr)+1; - if (Z_ReadField(&ptr,temp,2)) + if (ZReadAscii(ptr,temp,sizeof(u_short)) == ZERR_BADFIELD) return (ZERR_BADPKT); - bcopy(temp,notice->z_checksum,sizeof(ZChecksum_t)); - - if (Z_ReadField(&ptr,temp,3)) + notice->z_port = (u_short)*temp; + ptr += strlen(ptr)+1; + + if (ZReadAscii(ptr,temp,sizeof(int)) == ZERR_BADFIELD) return (ZERR_BADPKT); - bcopy(temp,¬ice->z_uid,sizeof(ZUnique_Id_t)); + notice->z_auth = *temp; + ptr += strlen(ptr)+1; + notice->z_ascii_authent = ptr; + ptr += strlen(ptr)+1; notice->z_class = ptr; ptr += strlen(ptr)+1; notice->z_class_inst = ptr; @@ -60,37 +74,47 @@ Code_t ZParseNotice(buffer,len,notice,auth) notice->z_recipient = ptr; ptr += strlen(ptr)+1; + cksum = ptr; + + if (ZReadAscii(ptr,¬ice->z_checksum,sizeof(ZChecksum_t)) + == ZERR_BADFIELD) + return (ZERR_BADPKT); + ptr += strlen(ptr)+1; + notice->z_message = (caddr_t) ptr; notice->z_message_len = len-(ptr-buffer); - *auth = 0; - - return (ZERR_NONE); -} + if (!auth) + return (ZERR_NONE); + if (!notice->z_auth) { + *auth = 0; + return (ZERR_NONE); + } + + if (__Zephyr_server) { + if (ZReadAscii(notice->z_ascii_authent,&authent, + notice->z_authent_len) == ZERR_BADFIELD) { + *auth = 0; + return (ZERR_NONE); + } + result = rd_ap_req(&authent,SERVER_SERVICE, + SERVER_INSTANCE,from->sin_addr.s_addr, + dat,SERVER_SRVTAB); + *auth = (result == RD_AP_OK); + return (ZERR_NONE); + } -int Z_ReadField(ptr,temp,num) - char **ptr; - int *temp; - int num; -{ - int i; - char *space; + if (result = get_credentials(SERVER_SERVICE,SERVER_INSTANCE, + __Zephyr_realm,&cred)) + return (result+krb_err_base); - for (i=0;iz_checksum); + + return (ZERR_NONE); } -- cgit v1.2.3