mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Better detection when not working with a real keytab in ipa-rmkeytab.
Resolving the keytab isn't enough, this just creates a name. Try to create a cursor into the keytab to see if it is a valid keytab. ticket 654
This commit is contained in:
committed by
Simo Sorce
parent
1fb2ccf105
commit
a1188d95e8
@@ -147,6 +147,7 @@ main(int argc, const char **argv)
|
||||
krb5_context context;
|
||||
krb5_error_code krberr;
|
||||
krb5_keytab ktid;
|
||||
krb5_kt_cursor cursor;
|
||||
char * ktname;
|
||||
char * atrealm;
|
||||
poptContext pc;
|
||||
@@ -212,10 +213,19 @@ main(int argc, const char **argv)
|
||||
|
||||
krberr = krb5_kt_resolve(context, ktname, &ktid);
|
||||
if (krberr) {
|
||||
fprintf(stderr, _("Failed to open keytab '%s'\n"), keytab);
|
||||
fprintf(stderr, _("Failed to open keytab '%s': %s\n"), keytab,
|
||||
error_message(krberr));
|
||||
rval = 3;
|
||||
goto cleanup;
|
||||
}
|
||||
krberr = krb5_kt_start_seq_get(context, ktid, &cursor);
|
||||
if (krberr) {
|
||||
fprintf(stderr, _("Failed to open keytab '%s': %s\n"), keytab,
|
||||
error_message(krberr));
|
||||
rval = 3;
|
||||
goto cleanup;
|
||||
}
|
||||
krb5_kt_end_seq_get(context, ktid, &cursor);
|
||||
|
||||
if (principal)
|
||||
rval = remove_principal(context, ktid, principal, debug);
|
||||
|
||||
Reference in New Issue
Block a user