diff options
author | Jim Rees <rees@cvs.openbsd.org> | 1997-04-08 22:40:53 +0000 |
---|---|---|
committer | Jim Rees <rees@cvs.openbsd.org> | 1997-04-08 22:40:53 +0000 |
commit | 8baf42e558e88226895e5eae3ef88f9467ab0444 (patch) | |
tree | f3c2cadfbc7752f3394d9a32ae75984420d9d7fc /kerberosIV/ksrvutil | |
parent | 950038e6d03ed9b5d67d01dc8b961c4b27502451 (diff) |
add '-a' flag for afs string-to-key.
Diffstat (limited to 'kerberosIV/ksrvutil')
-rw-r--r-- | kerberosIV/ksrvutil/ksrvutil.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/kerberosIV/ksrvutil/ksrvutil.c b/kerberosIV/ksrvutil/ksrvutil.c index cf03e2ccfd1..9001477f4fb 100644 --- a/kerberosIV/ksrvutil/ksrvutil.c +++ b/kerberosIV/ksrvutil/ksrvutil.c @@ -1,4 +1,4 @@ -/* $Id: ksrvutil.c,v 1.3 1996/09/16 18:49:03 millert Exp $ */ +/* $Id: ksrvutil.c,v 1.4 1997/04/08 22:40:52 rees Exp $ */ /*- * Copyright (C) 1989 by the Massachusetts Institute of Technology @@ -257,9 +257,10 @@ get_svc_new_key(unsigned char *new_key, char *sname, char *sinst, char *srealm, } static void -get_key_from_password(des_cblock (*key)) +get_key_from_password(des_cblock (*key), int afskey, char *srealm) { char password[MAX_KPW_LEN]; /* storage for the password */ + char cell[REALM_SZ], *p; if (read_long_pw_string(password, sizeof(password)-1, "Password: ", 1)) leave("Error reading password.", 1); @@ -268,7 +269,14 @@ get_key_from_password(des_cblock (*key)) (void) bzero((char *) key, sizeof(des_cblock)); key[0] = (unsigned char) 1; #else /* NOENCRYPTION */ - (void) des_string_to_key(password, key); + if (afskey) { + strcpy(cell, srealm); + for (p = cell; *p; p++) + if (isupper(*p)) + *p = tolower(*p); + afs_string_to_key(password, cell, key); + } else + (void) des_string_to_key(password, key); #endif /* NOENCRYPTION */ (void) bzero((char *)password, sizeof(password)); } @@ -276,12 +284,13 @@ get_key_from_password(des_cblock (*key)) static void usage(void) { - (void) fprintf(stderr, "Usage: ksrvutil [-f keyfile] [-i] [-k] "); + (void) fprintf(stderr, "Usage: ksrvutil [-f keyfile] [-i] [-k] [-a] "); (void) fprintf(stderr, "{list | change | add | get}\n"); (void) fprintf(stderr, " -i causes the program to ask for "); (void) fprintf(stderr, "confirmation before changing keys.\n"); (void) fprintf(stderr, " -k causes the key to printed for list or "); (void) fprintf(stderr, "change.\n"); + (void) fprintf(stderr, " -a uses the AFS string-to-key.\n"); exit(1); } @@ -310,6 +319,7 @@ main(int argc, char **argv) int add = FALSE; int get = FALSE; int key = FALSE; /* do we show keys? */ + int afskey = FALSE; /* do we use AFS string-to-key? */ int arg_entered = FALSE; int change_this_key = FALSE; char databuf[BUFSIZ]; @@ -378,6 +388,8 @@ main(int argc, char **argv) else (void) strcpy(keyfile, argv[i]); } + else if (strcmp(argv[i], "-a") == 0) + afskey++; else usage(); } @@ -550,7 +562,7 @@ main(int argc, char **argv) print_name(sname, sinst, srealm); (void) printf("; version %d\n", key_vno); } while (!yn("Is this correct?")); - get_key_from_password(&new_key); + get_key_from_password(&new_key, afskey, srealm); if (key) { (void) printf("Key: "); print_key(new_key); |