diff options
-rw-r--r-- | h/internal.h | 1 | ||||
-rw-r--r-- | server/dispatch.c | 17 |
2 files changed, 17 insertions, 1 deletions
diff --git a/h/internal.h b/h/internal.h index 433a9b4..8544d3a 100644 --- a/h/internal.h +++ b/h/internal.h @@ -26,6 +26,7 @@ #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 */ diff --git a/server/dispatch.c b/server/dispatch.c index 493fcd4..f762926 100644 --- a/server/dispatch.c +++ b/server/dispatch.c @@ -257,7 +257,20 @@ dispatch(notice, auth, who, from_server) char dbg_buf[BUFSIZ]; #endif - authflag = (auth == ZAUTH_YES); + /* Set "authflag" to 1 or 0 for handler functions. Treat + * ZAUTH_CKSUM_FAILED as authentic except for sendit(), which is + * handled below. */ + switch (auth) { + case ZAUTH_YES: + case ZAUTH_CKSUM_FAILED: + authflag = 1; + break; + case ZAUTH_FAILED: + case ZAUTH_NO: + default: + authflag = 0; + break; + } if ((int) notice->z_kind < (int) UNSAFE || (int) notice->z_kind > (int) CLIENTACK) { @@ -311,6 +324,8 @@ dispatch(notice, auth, who, from_server) admin_notices.val++; status = server_adispatch(notice, authflag, who, me_server); } else { + if (auth == ZAUTH_CKSUM_FAILED) + authflag = 0; if (!realm_bound_for_realm(ZGetRealm(), notice->z_recipient)) { cp = strchr(notice->z_recipient, '@'); if (!cp || |