Revert keytype -> emctype changes.
authorEzra Peisach <epeisach@mit.edu>
Tue, 12 Sep 1995 17:24:11 +0000 (17:24 +0000)
committerEzra Peisach <epeisach@mit.edu>
Tue, 12 Sep 1995 17:24:11 +0000 (17:24 +0000)
Document the Macintosh changes to adm_conn.c (hardwired path for adm cache)

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6770 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/kadm/ChangeLog
src/lib/kadm/adm_kt_dec.c
src/lib/kadm/adm_kt_enc.c
src/lib/kadm/alt_prof.c
src/lib/kadm/keysalt.c
src/lib/kadm/str_conv.c

index 3d0afac5c7b0061b70f878d2d7fed60439f7907b..2250ec280b00fd2829c59aa1b8b7fe5f07a4d177 100644 (file)
@@ -1,3 +1,8 @@
+Tue Sep 12 13:18:42 1995  Ezra Peisach  <epeisach@kangaroo.mit.edu>
+
+       * adm_conn.c: For Macintosh hardwire cache name. Various casting
+               fixes. 
+
 Thu Sep  7 17:50:15 1995  Theodore Y. Ts'o  <tytso@dcl>
 
        * adm_conn.c (kadm_get_creds): Use KRB5_ADM_SERVICE_INSTANCE for
index 8140af2a627cd32b253a099d8e8376215456d876..7886a70da91eff4b44b82547cb981457ccccde56 100644 (file)
@@ -88,25 +88,13 @@ krb5_adm_proto_to_ktent(kcontext, ncomp, complist, ktentp)
         ((krb5_int32) ((unsigned char) v[2]) << 8) +
         ((krb5_int32) ((unsigned char) v[3])));
 
-    /* Parse the supplied key_keytype */
-    if (complist[KRB5_ADM_KT_KEY_KEYTYPE].length < sizeof(krb5_keytype)) {
+    /* Parse the supplied key_enctype */
+    if (complist[KRB5_ADM_KT_KEY_ENCTYPE].length < sizeof(krb5_enctype)) {
        kret = EINVAL;
        goto done;
     }
-    v = complist[KRB5_ADM_KT_KEY_KEYTYPE].data;
-    ktentp->key.keytype = (krb5_keytype)
-       (((krb5_int32) ((unsigned char) v[0]) << 24) +
-        ((krb5_int32) ((unsigned char) v[1]) << 16) +
-        ((krb5_int32) ((unsigned char) v[2]) << 8) +
-        ((krb5_int32) ((unsigned char) v[3])));
-
-    /* Parse the supplied key_etype */
-    if (complist[KRB5_ADM_KT_KEY_ETYPE].length < sizeof(krb5_enctype)) {
-       kret = EINVAL;
-       goto done;
-    }
-    v = complist[KRB5_ADM_KT_KEY_ETYPE].data;
-    ktentp->key.etype = (krb5_enctype)
+    v = complist[KRB5_ADM_KT_KEY_ENCTYPE].data;
+    ktentp->key.enctype = (krb5_enctype)
        (((krb5_int32) ((unsigned char) v[0]) << 24) +
         ((krb5_int32) ((unsigned char) v[1]) << 16) +
         ((krb5_int32) ((unsigned char) v[2]) << 8) +
index 0d85687b352d0435982401a29416431704fe0fb6..d7dc65af158bedd72c72c4949d7249bab4cc3ae3 100644 (file)
@@ -106,40 +106,19 @@ krb5_adm_ktent_to_proto(kcontext, ktentp, ncompp, complistp)
        }
 
        /*
-        * Fill in key_keytype.
+        * Fill in key_enctype.
         */
-       if (clist[KRB5_ADM_KT_KEY_KEYTYPE].data = 
+       if (clist[KRB5_ADM_KT_KEY_ENCTYPE].data = 
            (char *) malloc(sizeof(krb5_ui_4))) {
-           clist[KRB5_ADM_KT_KEY_KEYTYPE].length = sizeof(krb5_ui_4);
-           clist[KRB5_ADM_KT_KEY_KEYTYPE].data[0] =
-               (ktentp->key.keytype >> 24) & 0xff;
-           clist[KRB5_ADM_KT_KEY_KEYTYPE].data[1] =
-               (ktentp->key.keytype >> 16) & 0xff;
-           clist[KRB5_ADM_KT_KEY_KEYTYPE].data[2] =
-               (ktentp->key.keytype >> 8) & 0xff;
-           clist[KRB5_ADM_KT_KEY_KEYTYPE].data[3] =
-               ktentp->key.keytype & 0xff;
-           nents++;
-       }
-       else {
-           kret = ENOMEM;
-           goto done;
-       }
-
-       /*
-        * Fill in key_etype.
-        */
-       if (clist[KRB5_ADM_KT_KEY_ETYPE].data = 
-           (char *) malloc(sizeof(krb5_ui_4))) {
-           clist[KRB5_ADM_KT_KEY_ETYPE].length = sizeof(krb5_ui_4);
-           clist[KRB5_ADM_KT_KEY_ETYPE].data[0] =
-               (ktentp->key.etype >> 24) & 0xff;
-           clist[KRB5_ADM_KT_KEY_ETYPE].data[1] =
-               (ktentp->key.etype >> 16) & 0xff;
-           clist[KRB5_ADM_KT_KEY_ETYPE].data[2] =
-               (ktentp->key.etype >> 8) & 0xff;
-           clist[KRB5_ADM_KT_KEY_ETYPE].data[3] =
-               ktentp->key.etype & 0xff;
+           clist[KRB5_ADM_KT_KEY_ENCTYPE].length = sizeof(krb5_ui_4);
+           clist[KRB5_ADM_KT_KEY_ENCTYPE].data[0] =
+               (ktentp->key.enctype >> 24) & 0xff;
+           clist[KRB5_ADM_KT_KEY_ENCTYPE].data[1] =
+               (ktentp->key.enctype >> 16) & 0xff;
+           clist[KRB5_ADM_KT_KEY_ENCTYPE].data[2] =
+               (ktentp->key.enctype >> 8) & 0xff;
+           clist[KRB5_ADM_KT_KEY_ENCTYPE].data[3] =
+               ktentp->key.enctype & 0xff;
            nents++;
        }
        else {
index 10645f56a5f9d6e8643f50624e6400c5223130a1..f51be4259a53481f6472e98385ae092dfdd27225 100644 (file)
@@ -332,14 +332,6 @@ krb5_read_realm_params(kcontext, realm, kdcprofile, kdcenv, rparamp)
            
            /* Get the value for the master key type */
            hierarchy[2] = "master_key_type";
-           if (!krb5_aprof_get_string(aprofile, hierarchy, TRUE, &svalue)) {
-               if (!krb5_string_to_keytype(svalue, &rparams->realm_keytype))
-                   rparams->realm_keytype_valid = 1;
-               krb5_xfree(svalue);
-           }
-           
-           /* Get the value for the encryption type */
-           hierarchy[2] = "encryption_type";
            if (!krb5_aprof_get_string(aprofile, hierarchy, TRUE, &svalue)) {
                if (!krb5_string_to_enctype(svalue, &rparams->realm_enctype))
                    rparams->realm_enctype_valid = 1;
@@ -409,8 +401,8 @@ krb5_read_realm_params(kcontext, realm, kdcprofile, kdcenv, rparamp)
                krb5_xfree(svalue);
            }
 
-           /* Get the value for the supported keytype/salttype matrix */
-           hierarchy[2] = "supported_keytypes";
+           /* Get the value for the supported enctype/salttype matrix */
+           hierarchy[2] = "supported_enctypes";
            if (!krb5_aprof_get_string(aprofile, hierarchy, TRUE, &svalue)) {
                krb5_string_to_keysalts(svalue,
                                        ", \t", /* Tuple separators     */
index 817cb66ade68ea2264d5db9985efcbcddf753891..011a7374772ef26fe733e8c16a846d2f5edc899b 100644 (file)
@@ -36,13 +36,13 @@ static const char default_ksaltseps[]       = ":.";
  * krb5_keysalt_is_present()   - Determine if a key/salt pair is present
  *                               in a list of key/salt tuples.
  *
- *     Salttype may be negative to indicate a search for only a keytype.
+ *     Salttype may be negative to indicate a search for only a enctype.
  */
 krb5_boolean
-krb5_keysalt_is_present(ksaltlist, nksalts, keytype, salttype)
+krb5_keysalt_is_present(ksaltlist, nksalts, enctype, salttype)
     krb5_key_salt_tuple        *ksaltlist;
     krb5_int32         nksalts;
-    krb5_keytype       keytype;
+    krb5_enctype       enctype;
     krb5_int32         salttype;
 {
     krb5_boolean       foundit;
@@ -51,7 +51,7 @@ krb5_keysalt_is_present(ksaltlist, nksalts, keytype, salttype)
     foundit = 0;
     if (ksaltlist) {
        for (i=0; i<nksalts; i++) {
-           if ((ksaltlist[i].ks_keytype == keytype) &&
+           if ((ksaltlist[i].ks_enctype == enctype) &&
                ((ksaltlist[i].ks_salttype == salttype) ||
                 (salttype < 0))) {
                foundit = 1;
@@ -83,11 +83,11 @@ krb5_keysalt_iterate(ksaltlist, nksalt, ignoresalt, iterator, arg)
 
     kret = 0;
     for (i=0; i<nksalt; i++) {
-       scratch.ks_keytype = ksaltlist[i].ks_keytype;
+       scratch.ks_enctype = ksaltlist[i].ks_enctype;
        scratch.ks_salttype = (ignoresalt) ? -1 : ksaltlist[i].ks_salttype;
        if (!krb5_keysalt_is_present(ksaltlist,
                                     i,
-                                    scratch.ks_keytype,
+                                    scratch.ks_enctype,
                                     scratch.ks_salttype)) {
            if (kret = (*iterator)(&scratch, arg))
                break;
@@ -112,7 +112,7 @@ krb5_string_to_keysalts(string, tupleseps, ksaltseps, dups, ksaltp, nksaltp)
     krb5_error_code    kret;
     char               *kp, *sp, *ep;
     char               sepchar, trailchar;
-    krb5_keytype       ktype;
+    krb5_enctype       ktype;
     krb5_int32         stype;
     krb5_key_salt_tuple        *savep;
     const char         *tseplist;
@@ -140,9 +140,9 @@ krb5_string_to_keysalts(string, tupleseps, ksaltseps, dups, ksaltp, nksaltp)
        }
        /*
         * kp points to something (hopefully) of the form:
-        *      <keytype><ksseplist><salttype>
+        *      <enctype><ksseplist><salttype>
         *      or
-        *      <keytype>
+        *      <enctype>
         */
        sp = (char *) NULL;
        /* Attempt to find a separator */
@@ -152,7 +152,7 @@ krb5_string_to_keysalts(string, tupleseps, ksaltseps, dups, ksaltp, nksaltp)
             ep = strchr(kp, (int) *septmp));
 
        if (sp) {
-           /* Separate keytype from salttype */
+           /* Separate enctype from salttype */
            sepchar = *sp;
            *sp = '\0';
            sp++;
@@ -161,10 +161,10 @@ krb5_string_to_keysalts(string, tupleseps, ksaltseps, dups, ksaltp, nksaltp)
            stype = -1;
 
        /*
-        * Attempt to parse keytype and salttype.  If we parse well
+        * Attempt to parse enctype and salttype.  If we parse well
         * then make sure that it specifies a unique key/salt combo
         */
-       if (!krb5_string_to_keytype(kp, &ktype) &&
+       if (!krb5_string_to_enctype(kp, &ktype) &&
            (!sp || !krb5_string_to_salttype(sp, &stype)) &&
            (dups ||
             !krb5_keysalt_is_present(*ksaltp, *nksaltp, ktype, stype))) {
@@ -184,7 +184,7 @@ krb5_string_to_keysalts(string, tupleseps, ksaltseps, dups, ksaltp, nksaltp)
                }
 
                /* Save our values */
-               (*ksaltp)[(*nksaltp)].ks_keytype = ktype;
+               (*ksaltp)[(*nksaltp)].ks_enctype = ktype;
                (*ksaltp)[(*nksaltp)].ks_salttype = stype;
                (*nksaltp)++;
            }
index 2d91d951191214cf29f9b528cd8310584da79299..71716ad7b5a2f225e4f03adba3eaa4212a62692c 100644 (file)
@@ -31,7 +31,7 @@
  *
  * String decoding:
  * ----------------
- * krb5_string_to_keytype()    - Convert string to krb5_keytype.
+ * krb5_string_to_enctype()    - Convert string to krb5_enctype.
  * krb5_string_to_salttype()   - Convert string to salttype (krb5_int32)
  * krb5_string_to_enctype()    - Convert string to krb5_enctype.
  * krb5_string_to_cksumtype()  - Convert string to krb5_cksumtype;
@@ -41,7 +41,7 @@
  *
  * String encoding:
  * ----------------
- * krb5_keytype_to_string()    - Convert krb5_keytype to string.
+ * krb5_enctype_to_string()    - Convert krb5_enctype to string.
  * krb5_salttype_to_string()   - Convert salttype (krb5_int32) to string.
  * krb5_enctype_to_string()    - Convert krb5_enctype to string.
  * krb5_cksumtype_to_string()  - Convert krb5_cksumtype to string.
 /*
  * Local data structures.
  */
-struct keytype_lookup_entry {
-    krb5_keytype       ktt_keytype;            /* Keytype              */
+struct enctype_lookup_entry {
+    krb5_enctype       ktt_enctype;            /* Keytype              */
     const char *       ktt_specifier;          /* How to recognize it  */
     const char *       ktt_output;             /* How to spit it out   */
 };
 
 struct salttype_lookup_entry {
-    krb5_int32         stt_keytype;            /* Salt type            */
+    krb5_int32         stt_enctype;            /* Salt type            */
     const char *       stt_specifier;          /* How to recognize it  */
     const char *       stt_output;             /* How to spit it out   */
 };
 
-struct enctype_lookup_entry {
-    krb5_enctype       ett_enctype;            /* Encryption type      */
-    const char *       ett_specifier;          /* How to recognize it  */
-    const char *       ett_output;             /* How to spit it out   */
-};
-
 struct cksumtype_lookup_entry {
     krb5_cksumtype     cst_cksumtype;          /* Checksum type        */
     const char *       cst_specifier;          /* How to recognize it  */
@@ -101,11 +95,19 @@ struct deltat_match_entry {
 /*
  * Local strings
  */
+
 /* Keytype strings */
-static const char keytype_null_in[]    = "null";
-static const char keytype_des_in[]     = "des";
-static const char keytype_null_out[]   = "Null";
-static const char keytype_des_out[]    = "DES";
+static const char enctype_des_in[]             = "des";
+static const char enctype_null_in[]            = "null";
+static const char enctype_descbccrc_in[]       = "des-cbc-crc";
+static const char enctype_descbcmd4_in[]       = "des-cbc-md4";
+static const char enctype_descbcmd5_in[]       = "des-cbc-md5";
+static const char enctype_descbcraw_in[]       = "des-cbc-raw";
+static const char enctype_null_out[]           = "Null";
+static const char enctype_descbccrc_out[]      = "DES cbc mode with CRC-32";
+static const char enctype_descbcmd4_out[]      = "DES cbc mode with RSA-MD4";
+static const char enctype_descbcmd5_out[]      = "DES cbc mode with RSA-MD5";
+static const char enctype_descbcraw_out[]      = "DES cbc mode raw";
 
 /* Salttype strings */
 static const char stype_v5_in[]                = "normal";
@@ -119,18 +121,6 @@ static const char stype_norealm_out[]      = "Version 5 - No Realm";
 static const char stype_olrealm_out[]  = "Version 5 - Realm Only";
 static const char stype_special_out[]  = "Special";
 
-/* Encryption type strings */
-static const char etype_null_in[]      = "null";
-static const char etype_descbccrc_in[] = "des-cbc-crc";
-static const char etype_descbcmd4_in[] = "des-cbc-md4";
-static const char etype_descbcmd5_in[] = "des-cbc-md5";
-static const char etype_rawdescbc_in[] = "raw-des-cbc";
-static const char etype_null_out[]     = "Null";
-static const char etype_descbccrc_out[]        = "DES cbc mode with CRC-32";
-static const char etype_descbcmd4_out[]        = "DES cbc mode with RSA-MD4";
-static const char etype_descbcmd5_out[]        = "DES cbc mode with RSA-MD5";
-static const char etype_rawdescbc_out[]        = "DES cbc mode";
-
 /* Checksum type strings */
 static const char cstype_crc32_in[]    = "crc32";
 static const char cstype_md4_in[]      = "md4";
@@ -224,14 +214,18 @@ static const char dt_output_hms[] = "%d:%02d:%02d";
 /*
  * Lookup tables.
  */
-static const struct keytype_lookup_entry keytype_table[] = {
-/* krb5_keytype        input specifier         output string           */
-/*-------------        ----------------------- ------------------------*/
-{ KEYTYPE_NULL,        keytype_null_in,        keytype_null_out        },
-{ KEYTYPE_DES, keytype_des_in,         keytype_des_out         }
+static const struct enctype_lookup_entry enctype_table[] = {
+/* krb5_enctype                input specifier         output string           */
+/*-------------                ----------------------- ------------------------*/
+{ ENCTYPE_NULL,                enctype_null_in,        enctype_null_out        },
+{ ENCTYPE_DES_CBC_MD5, enctype_des_in,         enctype_descbcmd5_out   },
+{ ENCTYPE_DES_CBC_CRC, enctype_descbccrc_in,   enctype_descbccrc_out   },
+{ ENCTYPE_DES_CBC_MD4, enctype_descbcmd4_in,   enctype_descbcmd4_out   },
+{ ENCTYPE_DES_CBC_MD5, enctype_descbcmd5_in,   enctype_descbcmd5_out   },
+{ ENCTYPE_DES_CBC_RAW, enctype_descbcraw_in,   enctype_descbcraw_out   }
 };
-static const int keytype_table_nents = sizeof(keytype_table)/
-                                      sizeof(keytype_table[0]);
+static const int enctype_table_nents = sizeof(enctype_table)/
+                                      sizeof(enctype_table[0]);
 
 static const struct salttype_lookup_entry salttype_table[] = {
 /* salt type                   input specifier         output string     */
@@ -245,18 +239,6 @@ static const struct salttype_lookup_entry salttype_table[] = {
 static const int salttype_table_nents = sizeof(salttype_table)/
                                        sizeof(salttype_table[0]);
 
-static const struct enctype_lookup_entry enctype_table[] = {
-/* krb5_enctype             input specifier            output string           */
-/*------------------ ---------------------     ------------------------*/
-{ ETYPE_NULL,       etype_null_in,             etype_null_out          },
-{ ETYPE_DES_CBC_CRC, etype_descbccrc_in,       etype_descbccrc_out     },
-{ ETYPE_DES_CBC_MD4, etype_descbcmd4_in,       etype_descbcmd4_out     },
-{ ETYPE_DES_CBC_MD5, etype_descbcmd5_in,       etype_descbcmd5_out     },
-{ ETYPE_RAW_DES_CBC, etype_rawdescbc_in,       etype_rawdescbc_out     }
-};
-static const int enctype_table_nents = sizeof(enctype_table)/
-                                      sizeof(enctype_table[0]);
-
 static const struct cksumtype_lookup_entry cksumtype_table[] = {
 /* krb5_cksumtype         input specifier      output string           */
 /*----------------------- ---------------------        ------------------------*/
@@ -434,18 +416,18 @@ strptime(buf, format, tm)
  * These routines return 0 for success, EINVAL for invalid entry.
  */
 krb5_error_code
-krb5_string_to_keytype(string, keytypep)
+krb5_string_to_enctype(string, enctypep)
     char               * string;
-    krb5_keytype       * keytypep;
+    krb5_enctype       * enctypep;
 {
     int i;
     int found;
 
     found = 0;
-    for (i=0; i<keytype_table_nents; i++) {
-       if (!strcasecmp(string, keytype_table[i].ktt_specifier)) {
+    for (i=0; i<enctype_table_nents; i++) {
+       if (!strcasecmp(string, enctype_table[i].ktt_specifier)) {
            found = 1;
-           *keytypep = keytype_table[i].ktt_keytype;
+           *enctypep = enctype_table[i].ktt_enctype;
            break;
        }
     }
@@ -464,26 +446,7 @@ krb5_string_to_salttype(string, salttypep)
     for (i=0; i<salttype_table_nents; i++) {
        if (!strcasecmp(string, salttype_table[i].stt_specifier)) {
            found = 1;
-           *salttypep = salttype_table[i].stt_keytype;
-           break;
-       }
-    }
-    return((found) ? 0 : EINVAL);
-}
-
-krb5_error_code
-krb5_string_to_enctype(string, enctypep)
-    char               * string;
-    krb5_enctype       * enctypep;
-{
-    int i;
-    int found;
-
-    found = 0;
-    for (i=0; i<enctype_table_nents; i++) {
-       if (!strcasecmp(string, enctype_table[i].ett_specifier)) {
-           found = 1;
-           *enctypep = enctype_table[i].ett_enctype;
+           *salttypep = salttype_table[i].stt_enctype;
            break;
        }
     }
@@ -625,8 +588,8 @@ krb5_string_to_deltat(string, deltatp)
  * if the supplied buffer/length will not contain the output.
  */
 krb5_error_code
-krb5_keytype_to_string(keytype, buffer, buflen)
-    krb5_keytype       keytype;
+krb5_enctype_to_string(enctype, buffer, buflen)
+    krb5_enctype       enctype;
     char               * buffer;
     size_t             buflen;
 {
@@ -634,9 +597,9 @@ krb5_keytype_to_string(keytype, buffer, buflen)
     const char *out;
 
     out = (char *) NULL;
-    for (i=0; i<keytype_table_nents; i++) {
-       if (keytype ==  keytype_table[i].ktt_keytype) {
-           out = keytype_table[i].ktt_output;
+    for (i=0; i<enctype_table_nents; i++) {
+       if (enctype ==  enctype_table[i].ktt_enctype) {
+           out = enctype_table[i].ktt_output;
            break;
        }
     }
@@ -662,7 +625,7 @@ krb5_salttype_to_string(salttype, buffer, buflen)
 
     out = (char *) NULL;
     for (i=0; i<salttype_table_nents; i++) {
-       if (salttype ==  salttype_table[i].stt_keytype) {
+       if (salttype ==  salttype_table[i].stt_enctype) {
            out = salttype_table[i].stt_output;
            break;
        }
@@ -678,33 +641,6 @@ krb5_salttype_to_string(salttype, buffer, buflen)
        return(EINVAL);
 }
 
-krb5_error_code
-krb5_enctype_to_string(enctype, buffer, buflen)
-    krb5_enctype       enctype;
-    char               * buffer;
-    size_t             buflen;
-{
-    int i;
-    const char *out;
-
-    out = (char *) NULL;
-    for (i=0; i<enctype_table_nents; i++) {
-       if (enctype ==  enctype_table[i].ett_enctype) {
-           out = enctype_table[i].ett_output;
-           break;
-       }
-    }
-    if (out) {
-       if (buflen > strlen(out))
-           strcpy(buffer, out);
-       else
-           out = (char *) NULL;
-       return((out) ? 0 : ENOMEM);
-    }
-    else
-       return(EINVAL);
-}
-
 krb5_error_code
 krb5_cksumtype_to_string(cksumtype, buffer, buflen)
     krb5_cksumtype     cksumtype;