* kdb_cpw.c (add_key_pwd): For KRB5_KDB_SALTTYPE_AFS3, the salt
authorEzra Peisach <epeisach@mit.edu>
Tue, 28 Oct 1997 15:31:15 +0000 (15:31 +0000)
committerEzra Peisach <epeisach@mit.edu>
Tue, 28 Oct 1997 15:31:15 +0000 (15:31 +0000)
                key for afs_mit_string_to_key mut be null terminated.

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

src/lib/kdb/ChangeLog
src/lib/kdb/kdb_cpw.c

index 7739432191a4cc6947e733a2e104e398a43574d8..4923b70bfa076a853e77697c4afb59113eb22e9a 100644 (file)
@@ -1,3 +1,8 @@
+Tue Oct 28 10:18:10 1997  Ezra Peisach  <epeisach@mit.edu>
+
+       * kdb_cpw.c (add_key_pwd): For KRB5_KDB_SALTTYPE_AFS3, the salt
+               key for afs_mit_string_to_key mut be null terminated. 
+
 Mon Oct 13 10:18:19 1997  Ezra Peisach  <epeisach@mit.edu>
 
        * t_kdb.c (do_testing): Add krb5_free_context.
index 87caafc233ef8416a47887bb6fca0140d922fa76..ec7419e1c6f0c5a22f0e5acb3c8171d6f3236ceb 100644 (file)
@@ -392,6 +392,7 @@ add_key_pwd(context, master_eblock, ks_tuple, ks_tuple_count, passwd,
             key_salt.data.data = 0;
             break;
        case KRB5_KDB_SALTTYPE_AFS3: {
+#if 0
             krb5_data * saltdata;
             if (retval = krb5_copy_data(context, krb5_princ_realm(context,
                                        db_entry->princ), &saltdata))
@@ -400,6 +401,19 @@ add_key_pwd(context, master_eblock, ks_tuple, ks_tuple_count, passwd,
            key_salt.data = *saltdata;
            key_salt.data.length = -1; /*length actually used below...*/
            krb5_xfree(saltdata);
+#else
+           /* Why do we do this? Well, the afs_mit_string_to_key needs to
+              use strlen, and the realm is not NULL terminated.... */
+           int slen = (*krb5_princ_realm(context,db_entry->princ)).length;
+           if(!(key_salt.data.data = (char *) malloc(slen+1)))
+               return ENOMEM;
+           key_salt.data.data[slen] = 0;
+           memcpy((char *)key_salt.data.data,
+                  (char *)(*krb5_princ_realm(context,db_entry->princ)).data,
+                  slen);
+           key_salt.data.length = -1; /*length actually used below...*/
+#endif
+
        }
                break;
        default: