summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/ZCkAuth.c8
-rw-r--r--lib/ZCkIfNot.c14
-rw-r--r--lib/ZIfNotice.c14
-rw-r--r--lib/ZLocateU.c3
-rw-r--r--lib/ZLocations.c17
-rw-r--r--lib/ZParseNot.c7
-rw-r--r--lib/ZPeekIfNot.c12
-rw-r--r--lib/ZPeekNot.c5
-rw-r--r--lib/ZRecvNot.c5
-rw-r--r--lib/ZRetSubs.c2
-rw-r--r--lib/ZSendPkt.c10
-rw-r--r--lib/ZSubs.c4
-rw-r--r--lib/Zinternal.c289
13 files changed, 181 insertions, 209 deletions
diff --git a/lib/ZCkAuth.c b/lib/ZCkAuth.c
index 9549ab0..e376df3 100644
--- a/lib/ZCkAuth.c
+++ b/lib/ZCkAuth.c
@@ -57,12 +57,12 @@ int ZCheckAuthentication(notice,buffer,from)
if (result = get_credentials(SERVER_SERVICE,SERVER_INSTANCE,
__Zephyr_realm,&cred))
- return (result+krb_err_base);
+ return (0);
our_checksum = (ZChecksum_t)quad_cksum(buffer,NULL,
- notice->z_recipient+
- strlen(notice->z_recipient)+1-
- buffer,0,cred.session);
+ notice->z_default_format+
+ strlen(notice->z_default_format)+1-buffer,
+ 0,cred.session);
return (our_checksum == notice->z_checksum);
}
diff --git a/lib/ZCkIfNot.c b/lib/ZCkIfNot.c
index e445bb2..e584fed 100644
--- a/lib/ZCkIfNot.c
+++ b/lib/ZCkIfNot.c
@@ -20,16 +20,16 @@ static char rcsid_ZCheckIfNotice_c[] = "$Header$";
#include <zephyr/zephyr_internal.h>
-Code_t ZCheckIfNotice(buffer,buffer_len,notice,auth,predicate,args)
+Code_t ZCheckIfNotice(buffer,buffer_len,notice,from,predicate,args)
ZPacket_t buffer;
int buffer_len;
ZNotice_t *notice;
- int *auth;
+ struct sockaddr_in *from;
int (*predicate)();
char *args;
{
ZNotice_t tmpnotice;
- int qcount,retval,tmpauth;
+ int qcount,retval;
struct _Z_InputQ *qptr;
if ((retval = Z_ReadEnqueue()) != ZERR_NONE)
@@ -40,17 +40,17 @@ Code_t ZCheckIfNotice(buffer,buffer_len,notice,auth,predicate,args)
for (;qcount;qcount--) {
if ((retval = ZParseNotice(qptr->packet,qptr->packet_len,
- &tmpnotice,auth?&tmpauth:0,
- &qptr->from))
+ &tmpnotice))
!= ZERR_NONE)
return (retval);
if ((predicate)(&tmpnotice,args)) {
if (qptr->packet_len > buffer_len)
return (ZERR_PKTLEN);
bcopy(qptr->packet,buffer,qptr->packet_len);
+ if (from)
+ *from = qptr->from;
if ((retval = ZParseNotice(buffer,qptr->packet_len,
- notice,auth,
- &qptr->from))
+ notice))
!= ZERR_NONE)
return (retval);
return (Z_RemQueue(qptr));
diff --git a/lib/ZIfNotice.c b/lib/ZIfNotice.c
index 8db08fc..ef3cdc5 100644
--- a/lib/ZIfNotice.c
+++ b/lib/ZIfNotice.c
@@ -20,16 +20,16 @@ static char rcsid_ZIfNotice_c[] = "$Header$";
#include <zephyr/zephyr_internal.h>
-Code_t ZIfNotice(buffer,buffer_len,notice,auth,predicate,args)
+Code_t ZIfNotice(buffer,buffer_len,notice,from,predicate,args)
ZPacket_t buffer;
int buffer_len;
ZNotice_t *notice;
- int *auth;
+ struct sockaddr_in *from;
int (*predicate)();
char *args;
{
ZNotice_t tmpnotice;
- int qcount,retval,tmpauth;
+ int qcount,retval;
struct _Z_InputQ *qptr;
if (__Q_Length)
@@ -45,16 +45,16 @@ Code_t ZIfNotice(buffer,buffer_len,notice,auth,predicate,args)
for (;;qcount--) {
if ((retval = ZParseNotice(qptr->packet,qptr->packet_len,
- &tmpnotice,auth?&tmpauth:0,
- &qptr->from)) != ZERR_NONE)
+ &tmpnotice)) != ZERR_NONE)
return (retval);
if ((predicate)(&tmpnotice,args)) {
if (qptr->packet_len > buffer_len)
return (ZERR_PKTLEN);
bcopy(qptr->packet,buffer,qptr->packet_len);
+ if (from)
+ *from = qptr->from;
if ((retval = ZParseNotice(buffer,qptr->packet_len,
- notice,auth,
- &qptr->from))
+ notice))
!= ZERR_NONE)
return (retval);
return (Z_RemQueue(qptr));
diff --git a/lib/ZLocateU.c b/lib/ZLocateU.c
index 23202cb..ea5b567 100644
--- a/lib/ZLocateU.c
+++ b/lib/ZLocateU.c
@@ -43,12 +43,13 @@ Code_t ZLocateUser(user,nlocs)
notice.z_opcode = LOCATE_LOCATE;
notice.z_sender = 0;
notice.z_recipient = "";
+ notice.z_default_format = "";
notice.z_message_len = 0;
if ((retval = ZSendNotice(&notice,ZNOAUTH)) != ZERR_NONE)
return (retval);
- if ((retval = Z_NoAuthIfNotice(buffer,sizeof buffer,&retnotice,
+ if ((retval = ZIfNotice(buffer,sizeof buffer,&retnotice,NULL,
ZCompareUIDPred,(char *)&notice.z_uid)) !=
ZERR_NONE)
return (retval);
diff --git a/lib/ZLocations.c b/lib/ZLocations.c
index 51378cb..09ad1fd 100644
--- a/lib/ZLocations.c
+++ b/lib/ZLocations.c
@@ -42,28 +42,31 @@ Code_t ZSetLocation()
}
return (Z_SendLocation(LOGIN_CLASS,quiet?LOGIN_QUIET_LOGIN:
- LOGIN_USER_LOGIN,ZAUTH));
+ LOGIN_USER_LOGIN,ZAUTH,
+ "$sender logged in to $1 on $3 at $2"));
}
Code_t ZUnsetLocation()
{
- return (Z_SendLocation(LOGIN_CLASS,LOGIN_USER_LOGOUT,ZNOAUTH));
+ return (Z_SendLocation(LOGIN_CLASS,LOGIN_USER_LOGOUT,ZNOAUTH,
+ "$sender logged out of $1 on $3 at $2"));
}
Code_t ZHideLocation()
{
- return (Z_SendLocation(LOCATE_CLASS,LOCATE_HIDE,ZAUTH));
+ return (Z_SendLocation(LOCATE_CLASS,LOCATE_HIDE,ZAUTH,(char *)0));
}
Code_t ZUnhideLocation()
{
- return (Z_SendLocation(LOCATE_CLASS,LOCATE_UNHIDE,ZAUTH));
+ return (Z_SendLocation(LOCATE_CLASS,LOCATE_UNHIDE,ZAUTH,(char *)0));
}
-Z_SendLocation(class,opcode,auth)
+Z_SendLocation(class,opcode,auth,format)
char *class;
char *opcode;
int (*auth)();
+ char *format;
{
char *ttyname(),*ctime();
@@ -81,6 +84,7 @@ Z_SendLocation(class,opcode,auth)
notice.z_opcode = opcode;
notice.z_sender = 0;
notice.z_recipient = "";
+ notice.z_default_format = format;
if (gethostname(host,MAXHOSTNAMELEN) < 0)
return (errno);
@@ -107,7 +111,8 @@ Z_SendLocation(class,opcode,auth)
if ((retval = ZSendList(&notice,bptr,3,auth)) != ZERR_NONE)
return (retval);
- if ((retval = ZIfNotice(buffer,sizeof buffer,&retnotice,(int *)0,
+ if ((retval = ZIfNotice(buffer,sizeof buffer,&retnotice,
+ (struct sockaddr_in *)0,
ZCompareUIDPred,(char *)&notice.z_uid)) !=
ZERR_NONE)
return (retval);
diff --git a/lib/ZParseNot.c b/lib/ZParseNot.c
index 6aeebc9..25610b4 100644
--- a/lib/ZParseNot.c
+++ b/lib/ZParseNot.c
@@ -20,15 +20,12 @@ static char rcsid_ZParseNotice_c[] = "$Header$";
#include <zephyr/zephyr_internal.h>
-Code_t ZParseNotice(buffer,len,notice,auth,from)
+Code_t ZParseNotice(buffer,len,notice)
ZPacket_t buffer;
int len;
ZNotice_t *notice;
- int *auth;
- struct sockaddr_in *from;
{
extern int ZCheckAuthentication();
- return (Z_InternalParseNotice(buffer,len,notice,auth,from,
- ZCheckAuthentication));
+ return (Z_InternalParseNotice(buffer,len,notice));
}
diff --git a/lib/ZPeekIfNot.c b/lib/ZPeekIfNot.c
index 012b50c..b376002 100644
--- a/lib/ZPeekIfNot.c
+++ b/lib/ZPeekIfNot.c
@@ -20,16 +20,16 @@ static char rcsid_ZPeekIfNotice_c[] = "$Header$";
#include <zephyr/zephyr_internal.h>
-Code_t ZPeekIfNotice(buffer,buffer_len,notice,auth,predicate,args)
+Code_t ZPeekIfNotice(buffer,buffer_len,notice,from,predicate,args)
ZPacket_t buffer;
int buffer_len;
ZNotice_t *notice;
- int *auth;
+ struct sockaddr_in *from;
int (*predicate)();
char *args;
{
ZNotice_t tmpnotice;
- int qcount,retval,tmpauth;
+ int qcount,retval;
struct _Z_InputQ *qptr;
if (__Q_Length)
@@ -45,15 +45,17 @@ Code_t ZPeekIfNotice(buffer,buffer_len,notice,auth,predicate,args)
for (;;qcount--) {
if ((retval = ZParseNotice(qptr->packet,qptr->packet_len,
- &tmpnotice,&tmpauth,&qptr->from))
+ &tmpnotice))
!= ZERR_NONE)
return (retval);
if ((predicate)(&tmpnotice,args)) {
if (qptr->packet_len > buffer_len)
return (ZERR_PKTLEN);
bcopy(qptr->packet,buffer,qptr->packet_len);
+ if (from)
+ *from = qptr->from;
if ((retval = ZParseNotice(buffer,qptr->packet_len,
- notice,auth,&qptr->from))
+ notice))
!= ZERR_NONE)
return (retval);
return (ZERR_NONE);
diff --git a/lib/ZPeekNot.c b/lib/ZPeekNot.c
index d1674b6..c2debad 100644
--- a/lib/ZPeekNot.c
+++ b/lib/ZPeekNot.c
@@ -20,11 +20,10 @@ static char rcsid_ZPeekNotice_c[] = "$Header$";
#include <zephyr/zephyr_internal.h>
-Code_t ZPeekNotice(buffer,buffer_len,notice,auth,from)
+Code_t ZPeekNotice(buffer,buffer_len,notice,from)
ZPacket_t buffer;
int buffer_len;
ZNotice_t *notice;
- int *auth;
struct sockaddr_in *from;
{
int len;
@@ -34,5 +33,5 @@ Code_t ZPeekNotice(buffer,buffer_len,notice,auth,from)
ZERR_NONE)
return (retval);
- return (ZParseNotice(buffer,len,notice,auth,from));
+ return (ZParseNotice(buffer,len,notice));
}
diff --git a/lib/ZRecvNot.c b/lib/ZRecvNot.c
index 8594515..d12a0f7 100644
--- a/lib/ZRecvNot.c
+++ b/lib/ZRecvNot.c
@@ -20,11 +20,10 @@ static char rcsid_ZReceiveNotice_c[] = "$Header$";
#include <zephyr/zephyr_internal.h>
-Code_t ZReceiveNotice(buffer,buffer_len,notice,auth,from)
+Code_t ZReceiveNotice(buffer,buffer_len,notice,from)
ZPacket_t buffer;
int buffer_len;
ZNotice_t *notice;
- int *auth;
struct sockaddr_in *from;
{
int len;
@@ -34,5 +33,5 @@ Code_t ZReceiveNotice(buffer,buffer_len,notice,auth,from)
ZERR_NONE)
return (retval);
- return (ZParseNotice(buffer,len,notice,auth,from));
+ return (ZParseNotice(buffer,len,notice));
}
diff --git a/lib/ZRetSubs.c b/lib/ZRetSubs.c
index 35fe1c4..e29000a 100644
--- a/lib/ZRetSubs.c
+++ b/lib/ZRetSubs.c
@@ -48,7 +48,7 @@ Code_t ZRetrieveSubscriptions(port,nsubs)
if ((retval = ZSendNotice(&notice,ZAUTH)) != ZERR_NONE)
return (retval);
- if ((retval = Z_NoAuthIfNotice(buffer,sizeof buffer,&retnotice,
+ if ((retval = ZIfNotice(buffer,sizeof buffer,&retnotice,NULL,
ZCompareUIDPred,(char *)&notice.z_uid)) !=
ZERR_NONE)
return (retval);
diff --git a/lib/ZSendPkt.c b/lib/ZSendPkt.c
index b916a05..5458a5a 100644
--- a/lib/ZSendPkt.c
+++ b/lib/ZSendPkt.c
@@ -40,9 +40,7 @@ Code_t ZSendPacket(packet,len)
if ((retval = ZOpenPort((u_short *)0)) != ZERR_NONE)
return (retval);
- if ((retval = Z_InternalParseNotice(packet,len,&notice,(int *)0,
- (struct sockaddr_in *)0,(int (*)())0))
- != ZERR_NONE)
+ if ((retval = ZParseNotice(packet,len,&notice)) != ZERR_NONE)
return (retval);
dest = ZGetDestAddr();
@@ -61,9 +59,9 @@ Code_t ZSendPacket(packet,len)
for (i=0;i<HM_TIMEOUT*2;i++) {
if (select(0,&t1,&t2,&t3,&tv) < 0)
return (errno);
- retval = Z_NoAuthCheckIfNotice(ackpack,sizeof ackpack,&notice,
- ZCompareUIDPred,
- (char *)&notice.z_uid);
+ retval = ZCheckIfNotice(ackpack,sizeof ackpack,&notice,
+ NULL,ZCompareUIDPred,
+ (char *)&notice.z_uid);
if (retval == ZERR_NONE)
return (ZERR_NONE);
if (retval != ZERR_NONOTICE)
diff --git a/lib/ZSubs.c b/lib/ZSubs.c
index c3861e2..aa24137 100644
--- a/lib/ZSubs.c
+++ b/lib/ZSubs.c
@@ -66,6 +66,7 @@ Z_Subscriptions(sublist,nitems,port,opcode)
notice.z_opcode = opcode;
notice.z_sender = 0;
notice.z_recipient = "";
+ notice.z_default_format = "";
notice.z_message_len = 0;
for (i=0;i<nitems;i++) {
@@ -85,7 +86,8 @@ Z_Subscriptions(sublist,nitems,port,opcode)
if (retval != ZERR_NONE)
return (retval);
- if ((retval = ZIfNotice(buffer,sizeof buffer,&retnotice,(int *)0,
+ if ((retval = ZIfNotice(buffer,sizeof buffer,&retnotice,
+ (struct sockaddr_in *)0,
ZCompareUIDPred,(char *)&notice.z_uid)) !=
ZERR_NONE)
return (retval);
diff --git a/lib/Zinternal.c b/lib/Zinternal.c
index beb4507..c593892 100644
--- a/lib/Zinternal.c
+++ b/lib/Zinternal.c
@@ -125,9 +125,8 @@ Z_ReadWait()
}
if (!__Zephyr_server &&
- Z_InternalParseNotice(newqueue->packet, newqueue->packet_len,
- &notice,(int *)0,(struct sockaddr_in *)0,
- (int (*)())0) == ZERR_NONE) {
+ ZParseNotice(newqueue->packet, newqueue->packet_len,
+ &notice) == ZERR_NONE) {
if (notice.z_kind != HMACK && notice.z_kind != SERVACK &&
notice.z_kind != SERVNAK) {
notice.z_kind = CLIENTACK;
@@ -198,7 +197,7 @@ Z_FormatRawHeader(notice,buffer,buffer_len,len)
int *len;
{
unsigned int temp;
- char newrecip[BUFSIZ];
+ char newrecip[BUFSIZ],version[BUFSIZ];
char *ptr,*end;
if (!notice->z_class)
@@ -213,15 +212,25 @@ Z_FormatRawHeader(notice,buffer,buffer_len,len)
if (!notice->z_recipient)
notice->z_recipient = "";
+ if (!notice->z_default_format)
+ notice->z_default_format = "";
+
ptr = buffer;
end = buffer+buffer_len;
- temp = htonl(ZVERSION);
+ sprintf(version,"%s%d.%d",ZVERSIONHDR,ZVERSIONMAJOR,ZVERSIONMINOR);
+ if (buffer_len < strlen(version)+1)
+ return (ZERR_PKTLEN);
+
+ strcpy(ptr,version);
+ ptr += strlen(ptr)+1;
+
+ temp = htonl(ZNUMFIELDS);
if (ZMakeAscii(ptr,end-ptr,(unsigned char *)&temp,
sizeof(int)) == ZERR_FIELDLEN)
return (ZERR_PKTLEN);
ptr += strlen(ptr)+1;
-
+
temp = htonl((int)notice->z_kind);
if (ZMakeAscii(ptr,end-ptr,(unsigned char *)&temp,
sizeof(int)) == ZERR_FIELDLEN)
@@ -269,7 +278,9 @@ Z_FormatRawHeader(notice,buffer,buffer_len,len)
if (Z_AddField(&ptr,newrecip,end))
return (ZERR_PKTLEN);
}
-
+ if (Z_AddField(&ptr,notice->z_default_format,end))
+ return (ZERR_PKTLEN);
+
temp = htonl(notice->z_checksum);
if (ZMakeAscii(ptr,end-ptr,(unsigned char *)&temp,
sizeof(ZChecksum_t)) == ZERR_FIELDLEN)
@@ -324,187 +335,145 @@ Z_RemQueue(qptr)
return (ZERR_NONE);
}
-Code_t Z_InternalParseNotice(buffer,len,notice,auth,from,auth_routine)
+Code_t Z_InternalParseNotice(buffer,len,notice)
ZPacket_t buffer;
int len;
ZNotice_t *notice;
- int *auth;
- struct sockaddr_in *from;
- int (*auth_routine)();
{
char *ptr,*end;
+ int maj,numfields,i;
unsigned int temp[3];
+
+ bzero(notice,sizeof(ZNotice_t));
ptr = buffer;
end = buffer+len;
- if (ZReadAscii(ptr,end-ptr,(unsigned char *)temp,sizeof(int)) == ZERR_BADFIELD)
- return (ZERR_BADPKT);
- ptr += strlen(ptr)+1;
-
- if (ntohl(*temp) != ZVERSION)
+ notice->z_version = ptr;
+ if (strncmp(ptr,ZVERSIONHDR,strlen(ZVERSIONHDR)))
+ return (ZERR_VERS);
+ ptr += strlen(ZVERSIONHDR);
+ maj = atoi(ptr);
+ if (maj != ZVERSIONMAJOR)
return (ZERR_VERS);
-
- if (ZReadAscii(ptr,end-ptr,(unsigned char *)temp,sizeof(int)) == ZERR_BADFIELD)
- return (ZERR_BADPKT);
- notice->z_kind = (ZNotice_Kind_t)ntohl((ZNotice_Kind_t)*temp);
- ptr += strlen(ptr)+1;
-
- if (ZReadAscii(ptr,end-ptr,(unsigned char *)temp,sizeof(ZUnique_Id_t)) ==
- ZERR_BADFIELD)
- return (ZERR_BADPKT);
- bcopy((char *)temp,(char *)&notice->z_uid,sizeof(ZUnique_Id_t));
- ptr += strlen(ptr)+1;
- notice->z_time.tv_sec = ntohl(notice->z_uid.tv.tv_sec);
- notice->z_time.tv_usec = ntohl(notice->z_uid.tv.tv_usec);
-
- if (ZReadAscii(ptr,end-ptr,(unsigned char *)temp,sizeof(u_short)) ==
- ZERR_BADFIELD)
- return (ZERR_BADPKT);
- notice->z_port = *((u_short *)temp);
- ptr += strlen(ptr)+1;
-
- if (ZReadAscii(ptr,end-ptr,(unsigned char *)temp,sizeof(int)) == ZERR_BADFIELD)
- return (ZERR_BADPKT);
- notice->z_auth = *temp;
ptr += strlen(ptr)+1;
if (ZReadAscii(ptr,end-ptr,(unsigned char *)temp,sizeof(int)) == ZERR_BADFIELD)
return (ZERR_BADPKT);
- notice->z_authent_len = ntohl(*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;
- ptr += strlen(ptr)+1;
- notice->z_opcode = ptr;
- ptr += strlen(ptr)+1;
- notice->z_sender = ptr;
- ptr += strlen(ptr)+1;
- notice->z_recipient = ptr;
+ numfields = ntohl(*temp);
ptr += strlen(ptr)+1;
- if (ZReadAscii(ptr,end-ptr,(unsigned char *)temp,
- sizeof(ZChecksum_t))
- == ZERR_BADFIELD)
- return (ZERR_BADPKT);
- notice->z_checksum = ntohl(*temp);
- ptr += strlen(ptr)+1;
+ numfields -= 2;
+ if (numfields < 0)
+ numfields = 0;
+
+ if (numfields) {
+ if (ZReadAscii(ptr,end-ptr,(unsigned char *)temp,
+ sizeof(int)) == ZERR_BADFIELD)
+ return (ZERR_BADPKT);
+ notice->z_kind = (ZNotice_Kind_t)ntohl((ZNotice_Kind_t)*temp);
+ numfields--;
+ ptr += strlen(ptr)+1;
+ }
- notice->z_message = (caddr_t) ptr;
- notice->z_message_len = len-(ptr-buffer);
+ if (numfields) {
+ if (ZReadAscii(ptr,end-ptr,(unsigned char *)temp,
+ sizeof(ZUnique_Id_t)) ==
+ ZERR_BADFIELD)
+ return (ZERR_BADPKT);
+ bcopy((char *)temp,(char *)&notice->z_uid,sizeof(ZUnique_Id_t));
+ notice->z_time.tv_sec = ntohl(notice->z_uid.tv.tv_sec);
+ notice->z_time.tv_usec = ntohl(notice->z_uid.tv.tv_usec);
+ numfields--;
+ ptr += strlen(ptr)+1;
+ }
- if (!auth)
- return (ZERR_NONE);
- if (!from || !auth_routine) {
- *auth = 0;
- return (ZERR_NONE);
+ if (numfields) {
+ if (ZReadAscii(ptr,end-ptr,(unsigned char *)temp,
+ sizeof(u_short)) ==
+ ZERR_BADFIELD)
+ return (ZERR_BADPKT);
+ notice->z_port = *((u_short *)temp);
+ numfields--;
+ ptr += strlen(ptr)+1;
}
-
- *auth = (auth_routine)(notice,buffer,from);
- return (ZERR_NONE);
-}
-/* XXX The following two routines are a TEMPORARY kludge */
+ if (numfields) {
+ if (ZReadAscii(ptr,end-ptr,(unsigned char *)temp,
+ sizeof(int)) == ZERR_BADFIELD)
+ return (ZERR_BADPKT);
+ notice->z_auth = *temp;
+ numfields--;
+ ptr += strlen(ptr)+1;
+ }
-Z_NoAuthIfNotice(buffer,buffer_len,notice,predicate,args)
- ZPacket_t buffer;
- int buffer_len;
- ZNotice_t *notice;
- int (*predicate)();
- char *args;
-{
- ZNotice_t tmpnotice;
- int qcount,retval;
- struct _Z_InputQ *qptr;
+ if (numfields) {
+ if (ZReadAscii(ptr,end-ptr,(unsigned char *)temp,
+ sizeof(int)) == ZERR_BADFIELD)
+ return (ZERR_BADPKT);
+ notice->z_authent_len = ntohl(*temp);
+ numfields--;
+ ptr += strlen(ptr)+1;
+ }
- if (__Q_Length)
- retval = Z_ReadEnqueue();
- else
- retval = Z_ReadWait();
-
- if (retval != ZERR_NONE)
- return (retval);
+ if (numfields) {
+ notice->z_ascii_authent = ptr;
+ numfields--;
+ ptr += strlen(ptr)+1;
+ }
+
+ if (numfields) {
+ notice->z_class = ptr;
+ numfields--;
+ ptr += strlen(ptr)+1;
+ }
- qptr = __Q_Head;
- qcount = __Q_Length;
-
- for (;;qcount--) {
- if ((retval = Z_InternalParseNotice(qptr->packet,
- qptr->packet_len,
- &tmpnotice,(int *)0,
- (struct sockaddr_in *)0,
- (int (*)())0))
- != ZERR_NONE)
- return (retval);
- if ((predicate)(&tmpnotice,args)) {
- if (qptr->packet_len > buffer_len)
- return (ZERR_PKTLEN);
- bcopy(qptr->packet,buffer,qptr->packet_len);
- if ((retval = Z_InternalParseNotice(buffer,
- qptr->packet_len,
- notice,(int *)0,
- (struct sockaddr_in *)0,
- (int (*)())0))
- != ZERR_NONE)
- return (retval);
- return (Z_RemQueue(qptr));
- }
- /* Grunch! */
- if (qcount == 1) {
- if ((retval = Z_ReadWait()) != ZERR_NONE)
- return (retval);
- qcount++;
- qptr = __Q_Tail;
- }
- else
- qptr = qptr->next;
+ if (numfields) {
+ notice->z_class_inst = ptr;
+ numfields--;
+ ptr += strlen(ptr)+1;
}
-}
-Code_t Z_NoAuthCheckIfNotice(buffer,buffer_len,notice,predicate,args)
- ZPacket_t buffer;
- int buffer_len;
- ZNotice_t *notice;
- int (*predicate)();
- char *args;
-{
- ZNotice_t tmpnotice;
- int qcount,retval;
- struct _Z_InputQ *qptr;
+ if (numfields) {
+ notice->z_opcode = ptr;
+ numfields--;
+ ptr += strlen(ptr)+1;
+ }
- if ((retval = Z_ReadEnqueue()) != ZERR_NONE)
- return (retval);
-
- qptr = __Q_Head;
- qcount = __Q_Length;
+ if (numfields) {
+ notice->z_sender = ptr;
+ numfields--;
+ ptr += strlen(ptr)+1;
+ }
+
+ if (numfields) {
+ notice->z_recipient = ptr;
+ numfields--;
+ ptr += strlen(ptr)+1;
+ }
+
+ if (numfields) {
+ notice->z_default_format = ptr;
+ numfields--;
+ ptr += strlen(ptr)+1;
+ }
- for (;qcount;qcount--) {
- if ((retval = Z_InternalParseNotice(qptr->packet,
- qptr->packet_len,
- &tmpnotice,(int *)0,
- (struct sockaddr_in *)0,
- (int (*)())0))
- != ZERR_NONE)
- return (retval);
- if ((predicate)(&tmpnotice,args)) {
- if (qptr->packet_len > buffer_len)
- return (ZERR_PKTLEN);
- bcopy(qptr->packet,buffer,qptr->packet_len);
- if ((retval = Z_InternalParseNotice(buffer,
- qptr->packet_len,
- notice,(int *)0,
- (struct sockaddr_in *)0,
- (int (*)())0))
- != ZERR_NONE)
- return (retval);
- return (Z_RemQueue(qptr));
- }
- qptr = qptr->next;
+ if (numfields) {
+ if (ZReadAscii(ptr,end-ptr,(unsigned char *)temp,
+ sizeof(ZChecksum_t))
+ == ZERR_BADFIELD)
+ return (ZERR_BADPKT);
+ notice->z_checksum = ntohl(*temp);
+ numfields--;
+ ptr += strlen(ptr)+1;
}
- return (ZERR_NONOTICE);
+ for (i=0;i<numfields;i++)
+ ptr += strlen(ptr)+1;
+
+ notice->z_message = (caddr_t) ptr;
+ notice->z_message_len = len-(ptr-buffer);
+
+ return (ZERR_NONE);
}
+