]> asedeno.scripts.mit.edu Git - 1ts-debian.git/commitdiff
r4255@bucket (orig r245): kcr | 2008-01-20 14:50:23 -0500
authorkcr <kcr@cbed1d16-5ef5-0310-b6a1-d4a37b08ba1f>
Thu, 18 Dec 2008 04:49:26 +0000 (04:49 +0000)
committerkcr <kcr@cbed1d16-5ef5-0310-b6a1-d4a37b08ba1f>
Thu, 18 Dec 2008 04:49:26 +0000 (04:49 +0000)
 factor out #if 0s and #if 1s

git-svn-id: svn://svn.1ts.org/debian/trunk@317 cbed1d16-5ef5-0310-b6a1-d4a37b08ba1f

zephyr/lib/ZCkAuth.c
zephyr/lib/ZMkAuth.c
zephyr/lib/ZReadAscii.c
zephyr/lib/ZReadZcode.c
zephyr/lib/Zinternal.c

index 040b198d828f6683f403290bf421634595d30483..418335e187fe5eb876998550823d582422e89720 100644 (file)
@@ -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
index 468bc0535968be33650de2fc7c82ecaa0bf26bb6..7ed6d61cef553a6b5dd19f4f7a2292ade864e32e 100644 (file)
@@ -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;
index ee45b9c915226ab92d36c7dc14f9f368910025f8..a0bd395d54edc6e4f96da2bc3bc0713b8a07e89a 100644 (file)
@@ -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
index 93d651d5922b7cbcb16916ce2cc81363a2353e6f..c9fc2f1d4aae6c819eac7886f8f98efcf3db2d7c 100644 (file)
@@ -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,
index 3398a4c3819f9fbbfb7e8b61ad37e14098c0b9a1..d3958b545e978d4ccecc2803b6fd995d79d86d40 100644 (file)
@@ -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);
 }