summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Karl Ramm <kcr@mit.edu>2008-01-20 19:50:23 +0000
committerGravatar Karl Ramm <kcr@mit.edu>2008-01-20 19:50:23 +0000
commit938001f468fd4b17efa90c423720b950c7d9d05a (patch)
tree7102edaf9ccf3ff65960273199efbcf4be13f241
parent3017fb3605d59cb41c4def4ffd0b7f967f99315d (diff)
factor out #if 0s and #if 1s
-rw-r--r--lib/ZCkAuth.c24
-rw-r--r--lib/ZMkAuth.c26
-rw-r--r--lib/ZReadAscii.c15
-rw-r--r--lib/ZReadZcode.c21
-rw-r--r--lib/Zinternal.c21
5 files changed, 4 insertions, 103 deletions
diff --git a/lib/ZCkAuth.c b/lib/ZCkAuth.c
index 040b198..418335e 100644
--- a/lib/ZCkAuth.c
+++ b/lib/ZCkAuth.c
@@ -33,16 +33,12 @@ Code_t
ZCheckAuthentication(ZNotice_t *notice,
struct sockaddr_in *from)
{
-#if 0
-#if defined(HAVE_KRB4) || defined(HAVE_KRB5)
+#if defined(HAVE_KRB4) && !defined(HAVE_KRB5)
int result;
ZChecksum_t our_checksum;
C_Block *session;
-#ifdef HAVE_KRB5
- krb5_creds *creds_out;
-#else
CREDENTIALS cred;
-#endif
+
/* If the value is already known, return it. */
if (notice->z_checked_auth != ZAUTH_UNSET)
return (notice->z_checked_auth);
@@ -50,23 +46,11 @@ ZCheckAuthentication(ZNotice_t *notice,
if (!notice->z_auth)
return (ZAUTH_NO);
-#ifdef HAVE_KRB5
- result = ZGetCreds(&creds_out);
- if (result)
- return ZAUTH_NO;
- /* HOLDING: creds_out */
-
- if (creds_out->keyblock.enctype != ENCTYPE_DES_CBC_CRC)
- return (ZAUTH_NO);
- session = (C_Block *)creds_out->keyblock.contents;
-
-#else
if ((result = krb_get_cred(SERVER_SERVICE, SERVER_INSTANCE,
__Zephyr_realm, &cred)) != 0)
return (ZAUTH_NO);
session = (C_Block *)cred.session;
-#endif
#ifdef NOENCRYPTION
our_checksum = 0;
@@ -78,10 +62,6 @@ ZCheckAuthentication(ZNotice_t *notice,
#endif
/* if mismatched checksum, then the packet was corrupted */
return ((our_checksum == notice->z_checksum) ? ZAUTH_YES : ZAUTH_FAILED);
-
-#else
- return (notice->z_auth ? ZAUTH_YES : ZAUTH_NO);
-#endif
#else
ZCheckZcodeAuthentication(notice, from);
#endif
diff --git a/lib/ZMkAuth.c b/lib/ZMkAuth.c
index 468bc05..7ed6d61 100644
--- a/lib/ZMkAuth.c
+++ b/lib/ZMkAuth.c
@@ -36,10 +36,10 @@ ZMakeAuthentication(register ZNotice_t *notice,
int buffer_len,
int *len)
{
-#if 1
+#ifdef HAVE_KRB5
return ZMakeZcodeAuthentication(notice, buffer, buffer_len, len/*?XXX*/);
#else
-#if defined(HAVE_KRB4) || defined(HAVE_KRB5)
+#ifdef HAVE_KRB4
int result;
time_t now;
KTEXT_ST authent;
@@ -47,28 +47,7 @@ ZMakeAuthentication(register ZNotice_t *notice,
ZChecksum_t checksum;
CREDENTIALS cred;
C_Block *session;
-#ifdef HAVE_KRB5
- krb5_creds *creds_out;
- result = ZGetCreds(&creds_out);
- if (result)
- return result;
-
- result = krb5_524_convert_creds(Z_krb5_ctx, creds_out, &cred);
- /* krb5_free_creds(Z_krb5_ctx, creds_out);*/
- if (result)
- return result;
- /* HOLDING: creds_out */
-
- if (creds_out->keyblock.enctype != ENCTYPE_DES_CBC_CRC)
- return (KRB5_BAD_ENCTYPE);
- session = (C_Block *)creds_out->keyblock.contents;
-
- result = krb_mk_req_creds(&authent, &cred, 0);
- if (result != MK_AP_OK)
- return result + krb_err_base;
-#endif
-#ifndef HAVE_KRB5
result = krb_mk_req(&authent, SERVER_SERVICE,
SERVER_INSTANCE, __Zephyr_realm, 0);
if (result != MK_AP_OK)
@@ -79,7 +58,6 @@ ZMakeAuthentication(register ZNotice_t *notice,
return (result+krb_err_base);
session = (C_Block *)cred.session;
-#endif
notice->z_auth = 1;
notice->z_authent_len = authent.length;
diff --git a/lib/ZReadAscii.c b/lib/ZReadAscii.c
index ee45b9c..a0bd395 100644
--- a/lib/ZReadAscii.c
+++ b/lib/ZReadAscii.c
@@ -17,21 +17,6 @@ static char rcsid_ZReadAscii_c[] = "$Id$";
#include <internal.h>
#include <assert.h>
-#if 0
-static __inline__
-int
-Z_cnvt_xtoi (char c)
-{
- c -= '0';
- if (c < 10)
- return c;
- c -= 'A'-'9'-1;
- if (c < 16)
- return c;
- return -1;
-}
-#endif
-
#define Z_cnvt_xtoi(c) ((temp=(c)-'0'),(temp<10)?temp:((temp-='A'-'9'-1),(temp<16)?temp:-1))
Code_t
diff --git a/lib/ZReadZcode.c b/lib/ZReadZcode.c
index 93d651d..c9fc2f1 100644
--- a/lib/ZReadZcode.c
+++ b/lib/ZReadZcode.c
@@ -18,27 +18,6 @@ static char rcsid_ZReadZcode_c[] = "$Id$";
#include <assert.h>
-#if 0
-Code_t
-ZReadAsciiOrZcode(char *buf,
- int buflen,
- unsigned char *data,
- int datalen)
-{
- if (buf[0] == 'Z')
- return ZReadZcode(buf, buflen, data, datalen);
- else
- return ZReadAscii(buf, buflen, data, datalen);
-}
-
-Code_t
-ZReadZcode32(unsigned char *ptr,
- unsigned long *value_ptr)
-{
- abort();
-}
-#endif
-
Code_t
ZReadZcode(unsigned char *ptr,
unsigned char *field,
diff --git a/lib/Zinternal.c b/lib/Zinternal.c
index 3398a4c..d3958b5 100644
--- a/lib/Zinternal.c
+++ b/lib/Zinternal.c
@@ -937,27 +937,6 @@ Z_ZcodeFormatRawHeader(ZNotice_t *notice,
*hdr_len = ptr-buffer;
-#if 0
- {
- printf("Z_FormatRawHeader output:\n");
- for (i = 0; i < *hdr_len; i += 16) {
- int i2;
- printf("%03d:", i);
- for (i2 = i; i2 < i+16 && i2 < *hdr_len; i2++)
- printf(" %02x", buffer[i2] & 0xff);
- for (; i2 < i+16; i2++)
- printf(" ");
- printf(" ");
- for (i2 = i; i2 < i+16 && i2 < *hdr_len; i2++)
- printf("%c",
- ((buffer[i2] > 0 && buffer[i2] < 127 && isprint(buffer[i2]))
- ? buffer[i2]
- : '.'));
- printf("\n");
- }
- }
-#endif
-
return (ZERR_NONE);
}