summaryrefslogtreecommitdiff
path: root/server/dispatch.c
diff options
context:
space:
mode:
authorGravatar John Kohl <jtkohl@mit.edu>1988-06-17 13:11:27 +0000
committerGravatar John Kohl <jtkohl@mit.edu>1988-06-17 13:11:27 +0000
commita5c3a2d52d3d7b9aaca2bb3002b1ee29f367bd67 (patch)
tree6074ba23d243f33b9ae5993512ef31cc07cadf18 /server/dispatch.c
parent3c27a27f80d398a238499acca9b5f9813dcb5653 (diff)
always malloc a packet, use ZFormatSmallRawNotice instead
of ZFormatRawNotice; be sure to null out multinotice field
Diffstat (limited to 'server/dispatch.c')
-rw-r--r--server/dispatch.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/server/dispatch.c b/server/dispatch.c
index 17f2da3..dc3dfb7 100644
--- a/server/dispatch.c
+++ b/server/dispatch.c
@@ -398,16 +398,16 @@ ZClient_t *client;
zdbug((LOG_DEBUG,"xmit"));
+ if (!(noticepack = (caddr_t) xmalloc(sizeof(ZPacket_t)))) {
+ syslog(LOG_ERR, "xmit malloc");
+ return; /* DON'T put on nack list */
+ }
+
if (auth && client) { /*
we are distributing authentic and
we have a pointer to auth info
*/
#ifdef KERBEROS
- if (!(noticepack = (caddr_t) xmalloc(sizeof(ZPacket_t)))) {
- syslog(LOG_ERR, "xmit malloc");
- return; /* DON'T put on nack list */
- }
- packlen = sizeof(ZPacket_t);
if ((retval = ZFormatAuthenticNotice(notice,
noticepack,
@@ -422,12 +422,13 @@ ZClient_t *client;
}
#else /* !KERBEROS */
notice->z_auth = 1;
- if ((retval = ZFormatRawNotice(notice,
- &noticepack,
- &packlen))
+ if ((retval = ZFormatSmallRawNotice(notice,
+ noticepack,
+ &packlen))
!= ZERR_NONE) {
syslog(LOG_ERR, "xmit auth/raw format: %s",
error_message(retval));
+ xfree(noticepack);
return;
}
#endif /* KERBEROS */
@@ -435,11 +436,12 @@ ZClient_t *client;
notice->z_auth = 0;
notice->z_authent_len = 0;
notice->z_ascii_authent = (char *)"";
- if ((retval = ZFormatRawNotice(notice,
- &noticepack,
- &packlen)) != ZERR_NONE) {
+ if ((retval = ZFormatSmallRawNotice(notice,
+ noticepack,
+ &packlen)) != ZERR_NONE) {
syslog(LOG_ERR, "xmit format: %s",
error_message(retval));
+ xfree(noticepack);
return; /* DON'T put on nack list */
}
}
@@ -597,14 +599,16 @@ ZSentType sent;
break;
}
+ acknotice.z_multinotice = "";
+
/* leave room for the trailing null */
acknotice.z_message_len = strlen(acknotice.z_message) + 1;
packlen = sizeof(ackpack);
if ((retval = ZFormatSmallRawNotice(&acknotice,
- ackpack,
- &packlen)) != ZERR_NONE) {
+ ackpack,
+ &packlen)) != ZERR_NONE) {
syslog(LOG_ERR, "clt_ack format: %s",error_message(retval));
return;
}