From 27b0d0e0d186c224631f71285e62faf66d14b35d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Fri, 16 Feb 2007 03:40:58 +0000 Subject: [PATCH] Add canonicalize flag. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@20229 ec53bebd-3082-4978-b11e-865c3cabbd6b --- kuser/kinit.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/kuser/kinit.c b/kuser/kinit.c index 1e48e101d..6f295d394 100644 --- a/kuser/kinit.c +++ b/kuser/kinit.c @@ -74,6 +74,7 @@ char *password_file = NULL; char *pk_user_id = NULL; char *pk_x509_anchors = NULL; int pk_use_enckey = 0; +static int canonicalize_flag = 0; static char *krb4_cc_name; @@ -153,6 +154,9 @@ static struct getargs args[] = { { "password-file", 0, arg_string, &password_file, "read the password from a file" }, + { "canonicalize",0, arg_flag, &canonicalize_flag, + "canonicalize client principal" }, + #ifdef PKINIT { "pk-user", 'C', arg_string, &pk_user_id, "principal's public/private/certificate identifier", @@ -512,6 +516,8 @@ get_new_tickets(krb5_context context, if (pac_flag != -1) krb5_get_init_creds_opt_set_pac_request(context, opt, pac_flag ? TRUE : FALSE); + if (canonicalize_flag) + krb5_get_init_creds_opt_set_canonicalize(context, opt, TRUE); if (pk_user_id) { ret = krb5_get_init_creds_opt_set_pkinit(context, opt, principal, @@ -774,6 +780,7 @@ main (int argc, char **argv) krb5_principal principal; int optidx = 0; krb5_deltat ticket_life = 0; + int parseflags = 0; setprogname (argv[0]); @@ -797,8 +804,11 @@ main (int argc, char **argv) argc -= optidx; argv += optidx; + if (canonicalize_flag) + parseflags |= KRB5_PRINCIPAL_PARSE_ENTERPRISE; + if (argv[0]) { - ret = krb5_parse_name (context, argv[0], &principal); + ret = krb5_parse_name_flags (context, argv[0], parseflags, &principal); if (ret) krb5_err (context, 1, ret, "krb5_parse_name"); } else {