From: John Kohl Date: Tue, 10 Jul 1990 09:40:23 +0000 (+0000) Subject: add v4 password routines X-Git-Tag: krb5-1.0-alpha2~370 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=fe5fd343ecd2604a0a2e5149b5723d16765badc6;p=krb5.git add v4 password routines git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@1041 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/admin/edit/kdb5_ed_ct.ct b/src/admin/edit/kdb5_ed_ct.ct index cf37ecbca..466c51eef 100644 --- a/src/admin/edit/kdb5_ed_ct.ct +++ b/src/admin/edit/kdb5_ed_ct.ct @@ -24,6 +24,12 @@ request add_rnd_key, "Add new entry to Kerberos database, using a random key", request change_rnd_key, "Change key of an entry in the Kerberos database (select a new random key)", change_rnd_key, crk; +request add_v4_key, "Add new entry to Kerberos database (using V4 string-to-key)", + add_v4_key, av4k; + +request change_v4_key, "Change key of an entry in the Kerberos database (using V4 string-to-key)", + change_v4_key, cv4k; + request delete_entry, "Delete an entry from the database", delete_entry, delent, del; diff --git a/src/admin/edit/kdb5_edit.c b/src/admin/edit/kdb5_edit.c index 7cc869b00..5d2c5e688 100644 --- a/src/admin/edit/kdb5_edit.c +++ b/src/admin/edit/kdb5_edit.c @@ -50,7 +50,7 @@ struct mblock { void add_key PROTOTYPE((char * const *, const krb5_principal, const krb5_keyblock *, krb5_kvno)); void enter_rnd_key PROTOTYPE((char **, const krb5_principal, krb5_kvno)); -void enter_pwd_key PROTOTYPE((char **, const krb5_principal, krb5_kvno)); +void enter_pwd_key PROTOTYPE((char **, const krb5_principal, const krb5_principal, krb5_kvno)); int set_dbname_help PROTOTYPE((char *, char *)); @@ -244,7 +244,34 @@ char *argv[]; krb5_free_principal(newprinc); return; } - enter_pwd_key(argv, newprinc, 0); + enter_pwd_key(argv, newprinc, newprinc, 0); + krb5_free_principal(newprinc); + return; +} + +void +add_v4_key(argc, argv) +int argc; +char *argv[]; +{ + krb5_error_code retval; + krb5_principal newprinc; + + if (argc < 2) { + com_err(argv[0], 0, "Too few arguments"); + com_err(argv[0], 0, "Usage: %s principal", argv[0]); + return; + } + if (retval = krb5_parse_name(argv[1], &newprinc)) { + com_err(argv[0], retval, "while parsing '%s'", argv[1]); + return; + } + if (princ_exists(argv[0], newprinc)) { + com_err(argv[0], 0, "principal '%s' already exists", argv[1]); + krb5_free_principal(newprinc); + return; + } + enter_pwd_key(argv, newprinc, 0, 0); krb5_free_principal(newprinc); return; } @@ -704,7 +731,35 @@ char *argv[]; krb5_free_principal(newprinc); return; } - enter_pwd_key(argv, newprinc, vno); + enter_pwd_key(argv, newprinc, newprinc, vno); + krb5_free_principal(newprinc); + return; +} + +void +change_v4_key(argc, argv) +int argc; +char *argv[]; +{ + krb5_error_code retval; + krb5_principal newprinc; + krb5_kvno vno; + + if (argc < 2) { + com_err(argv[0], 0, "Too few arguments"); + com_err(argv[0], 0, "Usage: %s principal", argv[0]); + return; + } + if (retval = krb5_parse_name(argv[1], &newprinc)) { + com_err(argv[0], retval, "while parsing '%s'", argv[1]); + return; + } + if (!(vno = princ_exists(argv[0], newprinc))) { + com_err(argv[0], 0, "No principal '%s' exists!", argv[1]); + krb5_free_principal(newprinc); + return; + } + enter_pwd_key(argv, newprinc, 0, vno); krb5_free_principal(newprinc); return; } @@ -712,9 +767,11 @@ char *argv[]; void enter_pwd_key(DECLARG(char **, argv), DECLARG(const krb5_principal, princ), + DECLARG(const krb5_principal, string_princ), DECLARG(krb5_kvno, vno)) OLDDECLARG(char **, argv) OLDDECLARG(const krb5_principal, princ) +OLDDECLARG(const krb5_principal, string_princ) OLDDECLARG(krb5_kvno, vno) { krb5_error_code retval; @@ -736,7 +793,7 @@ OLDDECLARG(krb5_kvno, vno) string_to_key)(master_keyblock.keytype, &tempkey, &pwd, - princ); + string_princ); bzero(password, sizeof(password)); /* erase it */ if (retval) { com_err(argv[0], retval, "while converting password to key for '%s'", argv[1]);