Implement --principal.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@22848 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -67,12 +67,10 @@ usage (int ret)
|
|||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
const krb5_cc_ops *ops;
|
|
||||||
krb5_context context;
|
krb5_context context;
|
||||||
krb5_error_code ret;
|
krb5_error_code ret;
|
||||||
krb5_ccache id;
|
krb5_ccache id;
|
||||||
int optidx = 0;
|
int optidx = 0;
|
||||||
char *str;
|
|
||||||
|
|
||||||
setprogname (argv[0]);
|
setprogname (argv[0]);
|
||||||
|
|
||||||
@@ -99,8 +97,26 @@ main (int argc, char **argv)
|
|||||||
if (argc != 0)
|
if (argc != 0)
|
||||||
usage (1);
|
usage (1);
|
||||||
|
|
||||||
if (cache == NULL)
|
if (cache && principal)
|
||||||
krb5_errx(context, 1, "No cache name given");
|
krb5_errx(context, 1, "Both --cache and --principal given, choose one");
|
||||||
|
|
||||||
|
if (principal) {
|
||||||
|
krb5_principal p;
|
||||||
|
|
||||||
|
ret = krb5_parse_name(context, principal, &p);
|
||||||
|
if (ret)
|
||||||
|
krb5_err (context, 1, ret, "krb5_parse_name: %s", principal);
|
||||||
|
|
||||||
|
ret = krb5_cc_cache_match(context, p, type, &id);
|
||||||
|
if (ret)
|
||||||
|
krb5_err (context, 1, ret,
|
||||||
|
"Did not find principal: %s", principal);
|
||||||
|
|
||||||
|
krb5_free_principal(context, p);
|
||||||
|
|
||||||
|
} else if (cache) {
|
||||||
|
const krb5_cc_ops *ops;
|
||||||
|
char *str;
|
||||||
|
|
||||||
ops = krb5_cc_get_prefix_ops(context, type);
|
ops = krb5_cc_get_prefix_ops(context, type);
|
||||||
if (ops == NULL)
|
if (ops == NULL)
|
||||||
@@ -115,6 +131,8 @@ main (int argc, char **argv)
|
|||||||
krb5_err (context, 1, ret, "krb5_cc_resolve: %s", str);
|
krb5_err (context, 1, ret, "krb5_cc_resolve: %s", str);
|
||||||
|
|
||||||
free(str);
|
free(str);
|
||||||
|
} else
|
||||||
|
usage(1);
|
||||||
|
|
||||||
ret = krb5_cc_switch(context, id);
|
ret = krb5_cc_switch(context, id);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
Reference in New Issue
Block a user