From 1cd7e3cff5b316fbb983b226cf19e18b1440d39e Mon Sep 17 00:00:00 2001 From: Ben Kaduk Date: Fri, 12 Jul 2013 12:53:46 -0400 Subject: [PATCH] Use the string form of key types in asetkey Check for rxkad-k5 keys in the six-argument form and warn they are unsupported. Do sanity-checking on the type. (cherry-picked from fe73ac62fbda1d4e563ef03114813f148c7d321e) Change-Id: I59fc1702dc1b201340dc033adeb8aa57251feee6 --- src/aklog/asetkey.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/aklog/asetkey.c b/src/aklog/asetkey.c index 4e01a351cd..7cbcba5bdf 100644 --- a/src/aklog/asetkey.c +++ b/src/aklog/asetkey.c @@ -197,10 +197,24 @@ addKey(struct afsconf_dir *dir, int argc, char **argv) { kvno = atoi(argv[3]); if (type == afsconf_rxkad) { typedKey = keyFromCommandLine(afsconf_rxkad, kvno, 0, argv[5], 8); + } else if (type == afsconf_rxkad_krb5){ + fprintf(stderr, "Raw keys for afsconf_rxkad_krb5 are unsupported"); + exit(1); + } else { + fprintf(stderr, "Unknown key type %s\n", argv[2]); + exit(1); } break; case 7: - typedKey = keyFromKeytab(atoi(argv[3]), atoi(argv[2]), atoi(argv[4]), argv[5], argv[6]); + type = stringToType(argv[2]); + kvno = atoi(argv[3]); + if (type == afsconf_rxkad || type == afsconf_rxkad_krb5) { + typedKey = keyFromKeytab(kvno, type, atoi(argv[4]), argv[5], + argv[6]); + } else { + fprintf(stderr, "Unknown key type %s\n", argv[2]); + exit(1); + } break; default: fprintf(stderr, "%s add: usage is '%s add "