diff options
| author | Tom Yu <tlyu@mit.edu> | 2000-02-19 01:57:07 +0000 |
|---|---|---|
| committer | Tom Yu <tlyu@mit.edu> | 2000-02-19 01:57:07 +0000 |
| commit | 1360badc25b0ed0b701381f02ef613eb45baa6ad (patch) | |
| tree | fd0a0c928848b8ad72c70f98704fab72eb47e1ae /src/kadmin/cli/keytab.c | |
| parent | f6aba826e738111a3d2e07cd2fc92cf8b0cf51bd (diff) | |
| download | krb5-1360badc25b0ed0b701381f02ef613eb45baa6ad.tar.gz krb5-1360badc25b0ed0b701381f02ef613eb45baa6ad.tar.xz krb5-1360badc25b0ed0b701381f02ef613eb45baa6ad.zip | |
* keytab.c (add_usage): Update usage message.
(kadmin_keytab_add): Update to deal with explicit keysalt lists.
(add_principal): Update to deal with explicit keysalt lists.
* kadmin.c (kadmin_cpw): Add support for new api.
(kadmin_parse_princ_args): Add support for new api, particularly
-keepold to keep old keys around and -e to explicitly specify
key-salt tuples.
(kadmin_addprinc_usage): Update usage accordingly.
(kadmin_addprinc): Add support for new api.
(kadmin_modprinc): Update to call new parse_princ_args reasonably.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@12056 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/kadmin/cli/keytab.c')
| -rw-r--r-- | src/kadmin/cli/keytab.c | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/src/kadmin/cli/keytab.c b/src/kadmin/cli/keytab.c index 8a474b92c..832628e02 100644 --- a/src/kadmin/cli/keytab.c +++ b/src/kadmin/cli/keytab.c @@ -44,6 +44,8 @@ static char *rcsid = "$Header$"; #include <kadm5/admin.h> static int add_principal(void *handle, char *keytab_str, krb5_keytab keytab, + int keepold, + int n_ks_tuple, krb5_key_salt_tuple *ks_tuple, char *princ_str); static int remove_principal(char *keytab_str, krb5_keytab keytab, char *princ_str, char *kvno_str); @@ -57,7 +59,7 @@ static int quiet; void add_usage() { - fprintf(stderr, "Usage: ktadd [-k[eytab] keytab] [-q] [principal | -glob princ-exp] [...]\n"); + fprintf(stderr, "Usage: ktadd [-k[eytab] keytab] [-q] [-e keysaltlist] [principal | -glob princ-exp] [...]\n"); } void rem_usage() @@ -119,6 +121,9 @@ void kadmin_keytab_add(int argc, char **argv) krb5_keytab keytab = 0; char *princ_str, *keytab_str = NULL, **princs; int code, num, i; + krb5_error_code retval; + int keepold = 0, n_ks_tuple = 0; + krb5_key_salt_tuple *ks_tuple = NULL; argc--; argv++; quiet = 0; @@ -132,6 +137,20 @@ void kadmin_keytab_add(int argc, char **argv) keytab_str = *argv; } else if (strcmp(*argv, "-q") == 0) { quiet++; + } else if (strcmp(*argv, "-e") == 0) { + argc--; + if (argc < 1) { + add_usage(); + return; + } + retval = krb5_string_to_keysalts(*++argv, ", \t", ":.-", 0, + &ks_tuple, &n_ks_tuple); + if (retval) { + com_err("ktadd", retval, "while parsing keysalts %s", + *argv); + + return; + } } else break; argc--; argv++; @@ -161,10 +180,13 @@ void kadmin_keytab_add(int argc, char **argv) for (i = 0; i < num; i++) (void) add_principal(handle, keytab_str, keytab, + keepold, n_ks_tuple, ks_tuple, princs[i]); kadm5_free_name_list(handle, princs, num); } else - (void) add_principal(handle, keytab_str, keytab, *argv); + (void) add_principal(handle, keytab_str, keytab, + keepold, n_ks_tuple, ks_tuple, + *argv); argv++; } @@ -215,6 +237,8 @@ void kadmin_keytab_remove(int argc, char **argv) } int add_principal(void *handle, char *keytab_str, krb5_keytab keytab, + int keepold, int n_ks_tuple, + krb5_key_salt_tuple *ks_tuple, char *princ_str) { kadm5_principal_ent_rec princ_rec; @@ -236,7 +260,13 @@ int add_principal(void *handle, char *keytab_str, krb5_keytab keytab, goto cleanup; } - code = kadm5_randkey_principal(handle, princ, &keys, &nkeys); + if (keepold || ks_tuple != NULL) { + code = kadm5_randkey_principal_3(handle, princ, + keepold, n_ks_tuple, ks_tuple, + &keys, &nkeys); + } else { + code = kadm5_randkey_principal(handle, princ, &keys, &nkeys); + } if (code != 0) { if (code == KADM5_UNK_PRINC) { fprintf(stderr, "%s: Principal %s does not exist.\n", |
