V4 srvtab extraction did not do proper principal translation
authorRichard Basch <probe@mit.edu>
Thu, 11 Apr 1996 00:39:27 +0000 (00:39 +0000)
committerRichard Basch <probe@mit.edu>
Thu, 11 Apr 1996 00:39:27 +0000 (00:39 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7788 dc483132-0cff-0310-8789-dd5450dbe970

src/admin/edit/ChangeLog
src/admin/edit/kdb5_edit.c

index 584601cf16c58dd4b3db276f17edf521992f1d27..cf400c16149f4332c50c077bbfa9d86e19a2209c 100644 (file)
@@ -1,3 +1,8 @@
+Wed Apr 10 19:17:58 1996  Richard Basch  <basch@lehman.com>
+
+       * kdb5_edit.c (extract_v4_srvtab): Translate the principal name to
+       the common V4 name.
+
 Tue Mar 19 18:00:58 1996  Richard Basch  <basch@lehman.com>
 
        * kdb5_edit.c (extract_v4_srvtab): do not test to make sure we
index 4c0a380b65629b08c81a0fa636cd0a5f6187ffb4..7aa0f63ad094ebe0f7dd1ca9459ae49314d9ee2e 100644 (file)
@@ -783,6 +783,9 @@ void extract_v4_srvtab(argc, argv)
     int nentries;
     krb5_boolean more;
     krb5_keyblock      key;
+    char v4_name[65];
+    char v4_inst[65];
+    char v4_realm[65];
 
     if (argc < 3) {
        com_err(argv[0], 0, "Too few arguments");
@@ -861,23 +864,32 @@ void extract_v4_srvtab(argc, argv)
            exit_status++;
            goto cleanmost;
        }
-    if (krb5_dbe_find_enctype(edit_context,
-                             &dbentry,
-                              ENCTYPE_DES_CBC_CRC,
-                              KRB5_KDB_SALTTYPE_V4,
-                              -1,
-                              &pkey) &&
-       (retval = krb5_dbe_find_enctype(edit_context,
-                             &dbentry,
-                              ENCTYPE_DES_CBC_CRC,
-                              -1,
-                              -1,
-                             &pkey))) {
-       com_err(argv[0], retval, "while retrieving %s", pname);
+
+       retval = krb5_524_conv_principal(edit_context, princ,
+                                       v4_name, v4_inst, v4_realm);
+       if (retval) {
+           com_err(argv[0], retval, "while translating principal");
            exit_status++;
            goto cleanmost;
        }
 
+       if (krb5_dbe_find_enctype(edit_context,
+                                 &dbentry,
+                                 ENCTYPE_DES_CBC_CRC,
+                                 KRB5_KDB_SALTTYPE_V4,
+                                 -1,
+                                 &pkey) &&
+           (retval = krb5_dbe_find_enctype(edit_context,
+                                           &dbentry,
+                                           ENCTYPE_DES_CBC_CRC,
+                                           -1,
+                                           -1,
+                                           &pkey)))
+       {
+           com_err(argv[0], retval, "while retrieving %s", pname);
+           exit_status++;
+           goto cleanmost;
+       }
        
        if ((retval = krb5_dbekd_decrypt_key_data(edit_context,
                                                  &master_encblock,
@@ -887,9 +899,11 @@ void extract_v4_srvtab(argc, argv)
            exit_status++;
            goto cleanall;
        }
-       fwrite(argv[i], strlen(argv[i]) + 1, 1, fout); /* p.name */
-       fwrite(argv[1], strlen(argv[1]) + 1, 1, fout); /* p.instance */
-       fwrite(cur_realm, strlen(cur_realm) + 1, 1, fout); /* p.realm */
+
+       fwrite(v4_name, strlen(v4_name) + 1, 1, fout);  /* p.name */
+       fwrite(v4_inst, strlen(v4_inst) + 1, 1, fout);  /* p.instance */
+       fwrite(v4_realm, strlen(v4_realm) + 1, 1, fout); /* p.realm */
+
         kvno = (unsigned char) dbentry.key_data[0].key_data_kvno;
         fwrite((char *)&kvno, sizeof(kvno), 1, fout);
        fwrite((char *)key.contents, 8, 1, fout);