Use argument as principal if passed an argument. Bug report from
Douglas E. Engert git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@19920 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997 - 2004 Kungliga Tekniska H<>gskolan
|
* Copyright (c) 1997 - 2005, 2007 Kungliga Tekniska H<>gskolan
|
||||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
@@ -62,6 +62,7 @@ main(int argc, char **argv)
|
|||||||
krb5_preauthtype pre_auth_types[] = {KRB5_PADATA_ENC_TIMESTAMP};
|
krb5_preauthtype pre_auth_types[] = {KRB5_PADATA_ENC_TIMESTAMP};
|
||||||
krb5_get_init_creds_opt *get_options;
|
krb5_get_init_creds_opt *get_options;
|
||||||
krb5_verify_init_creds_opt verify_options;
|
krb5_verify_init_creds_opt verify_options;
|
||||||
|
krb5_principal principal = NULL;
|
||||||
int optidx = 0;
|
int optidx = 0;
|
||||||
|
|
||||||
setprogname (argv[0]);
|
setprogname (argv[0]);
|
||||||
@@ -76,6 +77,9 @@ main(int argc, char **argv)
|
|||||||
print_version(NULL);
|
print_version(NULL);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
argc -= optidx;
|
||||||
|
argv += optidx;
|
||||||
|
|
||||||
ret = krb5_init_context(&context);
|
ret = krb5_init_context(&context);
|
||||||
if (ret)
|
if (ret)
|
||||||
@@ -91,9 +95,15 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
krb5_verify_init_creds_opt_init (&verify_options);
|
krb5_verify_init_creds_opt_init (&verify_options);
|
||||||
|
|
||||||
|
if (argc) {
|
||||||
|
ret = krb5_parse_name(context, argv[0], &principal);
|
||||||
|
if (ret)
|
||||||
|
krb5_err(context, 1, ret, "krb5_parse_name: %s", argv[0]);
|
||||||
|
}
|
||||||
|
|
||||||
ret = krb5_get_init_creds_password (context,
|
ret = krb5_get_init_creds_password (context,
|
||||||
&cred,
|
&cred,
|
||||||
NULL,
|
principal,
|
||||||
NULL,
|
NULL,
|
||||||
krb5_prompter_posix,
|
krb5_prompter_posix,
|
||||||
NULL,
|
NULL,
|
||||||
|
Reference in New Issue
Block a user