add pkinit support
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@13094 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
		| @@ -62,6 +62,9 @@ int do_afslog		= -1; | |||||||
| int get_v4_tgt		= -1; | int get_v4_tgt		= -1; | ||||||
| int convert_524		= 0; | int convert_524		= 0; | ||||||
| int fcache_version; | int fcache_version; | ||||||
|  | char *pk_cert_file	= NULL; | ||||||
|  | char *pk_key_file	= NULL; | ||||||
|  | char *pk_ca_dir		= NULL; | ||||||
|  |  | ||||||
| static char *krb4_cc_name; | static char *krb4_cc_name; | ||||||
|  |  | ||||||
| @@ -137,7 +140,16 @@ static struct getargs args[] = { | |||||||
|  |  | ||||||
|     { "request-pac",	0,   arg_flag,	&pac_flag, |     { "request-pac",	0,   arg_flag,	&pac_flag, | ||||||
|       "request a Windows PAC" }, |       "request a Windows PAC" }, | ||||||
|  | #ifdef PKINIT | ||||||
|  |     {  "certificate",  'C',  arg_string, &pk_cert_file, | ||||||
|  |        "principal's public key certificate", "filename"}, | ||||||
|         |         | ||||||
|  |     {  "private-key",  'K',  arg_string, &pk_key_file, | ||||||
|  |        "principal's private key", "filename" }, | ||||||
|  |  | ||||||
|  |     {  "ca-dir",       'D',  arg_string, &pk_ca_dir, | ||||||
|  |        "directory with CA certificates", "directory" }, | ||||||
|  | #endif | ||||||
|     { "version", 	0,   arg_flag, &version_flag }, |     { "version", 	0,   arg_flag, &version_flag }, | ||||||
|     { "help",		0,   arg_flag, &help_flag } |     { "help",		0,   arg_flag, &help_flag } | ||||||
| }; | }; | ||||||
| @@ -436,6 +448,15 @@ get_new_tickets(krb5_context context, | |||||||
|     if (pac_flag != -1) |     if (pac_flag != -1) | ||||||
| 	krb5_get_init_creds_opt_set_paq_request(context, opt,  | 	krb5_get_init_creds_opt_set_paq_request(context, opt,  | ||||||
| 						pac_flag ? TRUE : FALSE); | 						pac_flag ? TRUE : FALSE); | ||||||
|  |     if (pk_cert_file || pk_key_file || pk_ca_dir) { | ||||||
|  | 	ret = krb5_get_init_creds_opt_set_pkinit(context, opt, | ||||||
|  | 						 pk_cert_file, | ||||||
|  | 						 pk_key_file, | ||||||
|  | 						 pk_ca_dir, | ||||||
|  | 						 NULL); | ||||||
|  | 	if (ret) | ||||||
|  | 	    krb5_err(context, 1, ret, "set_pkinit"); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     if (!addrs_flag) { |     if (!addrs_flag) { | ||||||
| 	no_addrs.len = 0; | 	no_addrs.len = 0; | ||||||
| @@ -498,6 +519,16 @@ get_new_tickets(krb5_context context, | |||||||
| 					  server, | 					  server, | ||||||
| 					  opt); | 					  opt); | ||||||
| 	krb5_kt_close(context, kt); | 	krb5_kt_close(context, kt); | ||||||
|  |     } else if (pk_key_file) { | ||||||
|  | 	ret = krb5_get_init_creds_password (context, | ||||||
|  | 					    &cred, | ||||||
|  | 					    principal, | ||||||
|  | 					    NULL, | ||||||
|  | 					    krb5_prompter_posix, | ||||||
|  | 					    NULL, | ||||||
|  | 					    start_time, | ||||||
|  | 					    server, | ||||||
|  | 					    opt); | ||||||
|     } else { |     } else { | ||||||
| 	char *p, *prompt; | 	char *p, *prompt; | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Love Hörnquist Åstrand
					Love Hörnquist Åstrand