kinit: Add --cache-default-for flag (fix check-cc)

This commit is contained in:
Nicolas Williams
2020-03-12 11:46:47 -05:00
parent 64d5f86ec3
commit 7dae771eef
3 changed files with 14 additions and 4 deletions

View File

@@ -56,6 +56,7 @@ int validate_flag = 0;
int version_flag = 0;
int help_flag = 0;
int addrs_flag = -1;
int default_for_flag = 0;
struct getarg_strings extra_addresses;
int anonymous_flag = 0;
char *lifetime = NULL;
@@ -108,6 +109,9 @@ static struct getargs args[] = {
{ "cache", 'c', arg_string, &cred_cache,
NP_("credentials cache", ""), "cachename" },
{ "cache-default-for" , 0, arg_flag, &default_for_flag,
NP_("name cache after client principal", ""), NULL },
{ "forwardable", 'F', arg_negative_flag, &forwardable_flag,
NP_("get tickets not forwardable", ""), NULL },
@@ -1475,9 +1479,11 @@ main(int argc, char **argv)
krb5_principal_get_realm(context, principal),
"afslog", TRUE, &do_afslog);
if (cred_cache)
if (cred_cache) {
ret = krb5_cc_resolve(context, cred_cache, &ccache);
else {
} else if (default_for_flag) {
ret = krb5_cc_default_for(context, principal, &ccache);
} else {
if (argc > 1) {
char s[1024];
ret = krb5_cc_new_unique(context, NULL, NULL, &ccache);