--- a/libpurple/protocols/zephyr/ZCkAuth.c Sun Nov 22 01:44:50 2020 -0600
+++ b/libpurple/protocols/zephyr/ZCkAuth.c Mon Nov 23 01:41:50 2020 -0600
@@ -16,7 +16,6 @@
If it doesn't look authentic, return 0
When not using Kerberos, return true if the notice claims to be authentic.
- Only used by clients; the server uses its own routine.
ZCheckAuthentication(ZNotice_t *notice, struct sockaddr_in *from)
--- a/libpurple/protocols/zephyr/ZInit.c Sun Nov 22 01:44:50 2020 -0600
+++ b/libpurple/protocols/zephyr/ZInit.c Mon Nov 23 01:41:50 2020 -0600
@@ -62,39 +62,38 @@
(void) memcpy((char *)&__HM_addr.sin_addr, addr, 4);
/* Initialize the input queue */
- /* if the application is a server, there might not be a zhm. The
- code will fall back to something which might not be "right",
- but this is is ok, since none of the servers call krb_rd_req. */
+ /* If there is no zhm, the code will fall back to something which might + * not be "right", but this is is ok, since none of the servers call - servaddr.s_addr = INADDR_NONE;
- if (! __Zephyr_server) {
- if ((code = ZOpenPort(NULL)) != ZERR_NONE)
+ servaddr.s_addr = INADDR_NONE; + if ((code = ZOpenPort(NULL)) != ZERR_NONE) { - if ((code = ZhmStat(NULL, ¬ice)) != ZERR_NONE)
+ if ((code = ZhmStat(NULL, ¬ice)) != ZERR_NONE) {
- /* the first field, which is NUL-terminated, is the server name.
- If this code ever support a multiplexing zhm, this will have to
- be made smarter, and probably per-message */
+ /* the first field, which is NUL-terminated, is the server name. + If this code ever support a multiplexing zhm, this will have to + be made smarter, and probably per-message */ #ifdef ZEPHYR_USES_KERBEROS
- krealm = krb_realmofhost(notice.z_message);
+ krealm = krb_realmofhost(notice.z_message); - hostent = gethostbyname(notice.z_message);
- if (hostent && hostent->h_addrtype == AF_INET)
- memcpy(&servaddr, hostent->h_addr, sizeof(servaddr));
+ hostent = gethostbyname(notice.z_message); + if (hostent && hostent->h_addrtype == AF_INET) { + memcpy(&servaddr, hostent->h_addr, sizeof(servaddr));
#ifdef ZEPHYR_USES_KERBEROS
--- a/libpurple/protocols/zephyr/ZNewLocU.c Sun Nov 22 01:44:50 2020 -0600
+++ b/libpurple/protocols/zephyr/ZNewLocU.c Mon Nov 23 01:41:50 2020 -0600
@@ -1,5 +1,5 @@
/* This file is part of the Project Athena Zephyr Notification System.
- * It contains source for the ZNewLocateUser function.
+ * It contains source for the ZLocateUser function. * Created by: Robert French
--- a/libpurple/protocols/zephyr/ZOpenPort.c Sun Nov 22 01:44:50 2020 -0600
+++ b/libpurple/protocols/zephyr/ZOpenPort.c Mon Nov 23 01:41:50 2020 -0600
@@ -65,7 +65,6 @@
__Zephyr_port = bindin.sin_port;
--- a/libpurple/protocols/zephyr/ZParseNot.c Sun Nov 22 01:44:50 2020 -0600
+++ b/libpurple/protocols/zephyr/ZParseNot.c Mon Nov 23 01:41:50 2020 -0600
@@ -10,6 +10,8 @@
/* Assume that strlen is efficient on this machine... */
#define next_field(ptr) ptr += strlen (ptr) + 1
@@ -93,9 +95,7 @@
ptr += sizeof(ZVERSIONHDR) - 1;
- Z_debug ("ZParseNotice: null version string");
+ purple_debug_error("zephyr", "ZParseNotice: null version string"); @@ -111,23 +111,13 @@
numfields -= 2; /* numfields, version, and checksum */
- Z_debug ("ZParseNotice: bad packet from %s/%d (line %d)",
- inet_ntoa (notice->z_uid.zuid_addr.s_addr),
- notice->z_port, lineno);
+ purple_debug_error("zephyr", "ZParseNotice: bad packet from %s/%d (line %d)", inet_ntoa (notice->z_uid.zuid_addr.s_addr), notice->z_port, lineno); - /* We won't use lineno anywhere else, so let's silence a warning. */
- Z_debug ("ZParseNotice: bad packet from %s/%d",
- inet_ntoa (notice->z_uid.zuid_addr.s_addr),
+ purple_debug_error("zephyr", "ZParseNotice: bad packet from %s/%d", inet_ntoa (notice->z_uid.zuid_addr.s_addr), notice->z_port); --- a/libpurple/protocols/zephyr/Zinternal.c Sun Nov 22 01:44:50 2020 -0600
+++ b/libpurple/protocols/zephyr/Zinternal.c Mon Nov 23 01:41:50 2020 -0600
@@ -18,7 +18,6 @@
struct in_addr __My_addr;
@@ -26,8 +25,6 @@
struct _Z_InputQ *__Q_Head, *__Q_Tail;
struct sockaddr_in __HM_addr;
struct sockaddr_in __HM_addr_real;
ZLocations_t *__locate_list;
@@ -41,11 +38,6 @@
char __Zephyr_realm[REALM_SZ];
-void (*__Z_debug_print)(const char *fmt, va_list args, void *closure);
-void *__Z_debug_print_closure;
static int Z_AddField(char **ptr, const char *field, char *end);
static int find_or_insert_uid(ZUnique_Id_t *uid, ZNotice_Kind_t kind);
@@ -254,40 +246,38 @@
- if ((retval = ZParseNotice(packet, packet_len, ¬ice)) != ZERR_NONE)
+ if ((retval = ZParseNotice(packet, packet_len, ¬ice)) != ZERR_NONE) {
- * If we're not a server and the notice is of an appropriate kind,
- * send back a CLIENTACK to whoever sent it to say we got it.
- if (!__Zephyr_server) {
+ /* If the notice is of an appropriate kind, send back a CLIENTACK to + * whoever sent it to say we got it. */ if (notice.z_kind != HMACK && notice.z_kind != SERVACK &&
- notice.z_kind != SERVNAK && notice.z_kind != CLIENTACK) {
+ notice.z_kind != SERVNAK && notice.z_kind != CLIENTACK) {
- tmpnotice.z_kind = CLIENTACK;
- tmpnotice.z_message_len = 0;
- if ((retval = ZFormatSmallRawNotice(&tmpnotice, pkt, &len))
- if ((retval = ZSendPacket(pkt, len, 0)) != ZERR_NONE)
+ tmpnotice.z_kind = CLIENTACK; + tmpnotice.z_message_len = 0; + if ((retval = ZFormatSmallRawNotice(&tmpnotice, pkt, &len)) != ZERR_NONE) { + if ((retval = ZSendPacket(pkt, len, 0)) != ZERR_NONE) { - if (find_or_insert_uid(¬ice.z_uid, notice.z_kind))
+ if (find_or_insert_uid(¬ice.z_uid, notice.z_kind)) { /* Check authentication on the notice. */
notice.z_checked_auth = ZCheckAuthentication(¬ice, &from);
* Parse apart the z_multinotice field - if the field is blank for
@@ -311,11 +301,8 @@
if (partof > Z_MAXNOTICESIZE)
- * If we aren't a server and we can find a notice in the queue
- * with the same multiuid field, insert the current fragment as
+ /* If we can find a notice in the queue with the same multiuid field, + * insert the current fragment as appropriate. */ @@ -328,17 +315,16 @@
(XXX we assume here that they all carry the same information
regarding failure/success)
- if (!__Zephyr_server &&
- !ZCompareUID(¬ice.z_multiuid, ¬ice.z_uid))
+ if (!ZCompareUID(¬ice.z_multiuid, ¬ice.z_uid)) { /* they're not the same... throw away this packet. */
/* fall thru & process it */
/* for HMACK types, we assume no packet loss (local loopback
connections). The other types can be fragmented and MUST
run through this code. */
- if (!__Zephyr_server && (qptr = Z_SearchQueue(¬ice.z_multiuid,
+ if ((qptr = Z_SearchQueue(¬ice.z_multiuid, notice.z_kind)) != NULL) { * If this is the first fragment, and we haven't already
* gotten a first fragment, grab the header from it.
@@ -354,12 +340,11 @@
- * We'll have to create a new entry...make sure the queue isn't
- * going to get too big.
- if (__Q_Size+(__Zephyr_server ? notice.z_message_len : partof) > Z_MAXQUEUESIZE)
+ /* We'll have to create a new entry...make sure the queue isn't going + if (__Q_Size + partof > Z_MAXQUEUESIZE) { * This is a notice we haven't heard of, so create a new queue
@@ -387,14 +372,10 @@
qptr->kind = notice.z_kind;
qptr->auth = notice.z_checked_auth;
- * If this is the first part of the notice, we take the header
- * from it. We only take it if this is the first fragment so that
- * the Unique ID's will be predictable.
- * If a Zephyr Server, we always take the header.
- if (__Zephyr_server || part == 0) {
+ /* If this is the first part of the notice, we take the header from it. We + * only take it if this is the first fragment so that the Unique ID's will qptr->header_len = packet_len-notice.z_message_len;
qptr->header = (char *) malloc((unsigned) qptr->header_len);
@@ -402,12 +383,9 @@
(void) memcpy(qptr->header, packet, qptr->header_len);
- * If this is not a fragmented notice, then don't bother with a
- * If we are a Zephyr server, all notices are treated as complete.
- if (__Zephyr_server || (part == 0 && notice.z_message_len == partof)) {
+ /* If this is not a fragmented notice, then don't bother with a hole + if (part == 0 && notice.z_message_len == partof) { qptr->holelist = (struct _Z_Hole *) 0;
@@ -848,8 +826,7 @@
- waitforack = ((notice->z_kind == UNACKED || notice->z_kind == ACKED)
+ waitforack = (notice->z_kind == UNACKED || notice->z_kind == ACKED); @@ -894,69 +871,3 @@
return(ZSendPacket(buf, len, wait));
-/* For debugging printing */
-const char *const ZNoticeKinds[] = {
- "UNSAFE", "UNACKED", "ACKED", "HMACK", "HMCTL", "SERVACK", "SERVNAK",
-void Z_debug (const char *format, ...)
- va_start (pvar, format);
- (*__Z_debug_print) (format, pvar, __Z_debug_print_closure);
-Z_debug_stderr(const char *format, va_list args, void *closure)
- vfprintf (stderr, format, args);
- return __Q_CompleteLength;
-ZSetDebug(void (*proc)(const char *, va_list, void *), char *arg)
- __Z_debug_print = proc;
- __Z_debug_print_closure = arg;
--- a/libpurple/protocols/zephyr/internal.h Sun Nov 22 01:44:50 2020 -0600
+++ b/libpurple/protocols/zephyr/internal.h Mon Nov 23 01:41:50 2020 -0600
@@ -46,7 +46,6 @@
#define HM_SVC_FALLBACK htons((unsigned short) 2104)
#define HM_SRV_SVC_FALLBACK htons((unsigned short) 2105)
-#define ZAUTH_CKSUM_FAILED (-2) /* Used only by server. */
#define ZAUTH_UNSET (-3) /* Internal to client library. */
#define Z_MAXFRAGS 500 /* Max number of packet fragments */
#define Z_MAXNOTICESIZE 400000 /* Max size of incoming notice */
@@ -81,10 +80,6 @@
extern struct _Z_InputQ *__Q_Head, *__Q_Tail;
-extern int __Zephyr_open; /* 0 if FD opened, 1 otherwise */
-extern int __HM_set; /* 0 if dest addr set, 1 otherwise */
-extern int __Zephyr_server; /* 0 if normal client, 1 if server or zhm */
extern ZLocations_t *__locate_list;
extern int __locate_next;
--- a/libpurple/protocols/zephyr/zephyr_internal.h Sun Nov 22 01:44:50 2020 -0600
+++ b/libpurple/protocols/zephyr/zephyr_internal.h Mon Nov 23 01:41:50 2020 -0600
@@ -67,7 +67,6 @@
UNSAFE, UNACKED, ACKED, HMACK, HMCTL, SERVACK, SERVNAK, CLIENTACK, STAT
-extern const char *ZNoticeKinds[9];
@@ -129,12 +128,6 @@
-void (*__Z_debug_print)(const char *fmt, va_list args, void *closure);
-void *__Z_debug_print_closure;
int ZCompareUIDPred(ZNotice_t *, void *);
int ZCompareMultiUIDPred(ZNotice_t *, void *);
@@ -167,8 +160,6 @@
Code_t ZhmStat(struct in_addr *, ZNotice_t *);
Code_t ZInitialize(void);
-Code_t ZSetServerState(int);
Code_t ZFormatSmallRawNotice(ZNotice_t *, ZPacket_t, int *);
int ZCompareUID(ZUnique_Id_t *, ZUnique_Id_t *);
Code_t ZMakeAscii(char *, int, unsigned char *, int);
@@ -205,12 +196,6 @@
Code_t ZCancelSubscriptions(unsigned int port);
Code_t ZReceiveNotice(ZNotice_t *notice, struct sockaddr_in *from);
-void Z_debug(const char *, ...);
-#define ZNewLocateUser ZLocateUser
/* Macros to retrieve Zephyr library values. */
@@ -222,15 +207,6 @@
#define ZGetDestAddr() __HM_addr
#define ZGetRealm() __Zephyr_realm
-void ZSetDebug(void (*)(const char *, va_list, void *), void *);
-#define ZSetDebug(proc,closure) (__Z_debug_print=(proc), \
- __Z_debug_print_closure=(closure), \
-#define ZSetDebug(proc,closure)
/* Maximum queue length */