summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard Basch <probe@mit.edu>1996-02-09 00:52:44 +0000
committerRichard Basch <probe@mit.edu>1996-02-09 00:52:44 +0000
commitf79a78e7d1273c7a8ed20e04cb038b8c26d346d3 (patch)
tree674106d000141f92209521bf3034447e8e2db80d /src
parentb345adf741381a01adc07c63013c0fe36866a16b (diff)
downloadkrb5-f79a78e7d1273c7a8ed20e04cb038b8c26d346d3.tar.gz
krb5-f79a78e7d1273c7a8ed20e04cb038b8c26d346d3.tar.xz
krb5-f79a78e7d1273c7a8ed20e04cb038b8c26d346d3.zip
* kinit.c
Only initialize the credentials cache if credentials were obtained. This means you won't blow away the old cache if an incorrect password was entered, and it also allows for the os_context time offset to be set properly in the credentials cache. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7463 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src')
-rw-r--r--src/clients/kinit/kinit.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/clients/kinit/kinit.c b/src/clients/kinit/kinit.c
index 234fd0b88..1e3a802b6 100644
--- a/src/clients/kinit/kinit.c
+++ b/src/clients/kinit/kinit.c
@@ -70,6 +70,8 @@ main(argc, argv)
krb5_principal server;
krb5_creds my_creds;
krb5_timestamp now;
+ krb5_address *null_addr = (krb5_address *)0;
+ krb5_address **addrs = (krb5_address **)0;
int use_keytab = 0; /* -k option */
krb5_keytab keytab = NULL;
struct passwd *pw = 0;
@@ -214,13 +216,6 @@ main(argc, argv)
exit(1);
}
- code = krb5_cc_initialize (kcontext, ccache, me);
- if (code != 0) {
- com_err (argv[0], code, "when initializing cache %s",
- cache_name?cache_name:"");
- exit(1);
- }
-
memset((char *)&my_creds, 0, sizeof(my_creds));
my_creds.client = me;
@@ -266,14 +261,14 @@ main(argc, argv)
exit(1);
}
- code = krb5_get_in_tkt_with_password(kcontext, options, 0,
- NULL, preauth, password, ccache,
+ code = krb5_get_in_tkt_with_password(kcontext, options, addrs,
+ NULL, preauth, password, 0,
&my_creds, 0);
memset(password, 0, sizeof(password));
#ifndef NO_KEYTAB
} else {
- code = krb5_get_in_tkt_with_keytab(kcontext, options, 0,
- NULL, preauth, keytab, ccache,
+ code = krb5_get_in_tkt_with_keytab(kcontext, options, addrs,
+ NULL, preauth, keytab, 0,
&my_creds, 0);
#endif
}
@@ -287,5 +282,19 @@ main(argc, argv)
com_err (argv[0], code, "while getting initial credentials");
exit(1);
}
+
+ code = krb5_cc_initialize (kcontext, ccache, me);
+ if (code != 0) {
+ com_err (argv[0], code, "when initializing cache %s",
+ cache_name?cache_name:"");
+ exit(1);
+ }
+
+ code = krb5_cc_store_cred(kcontext, ccache, &my_creds);
+ if (code) {
+ com_err (argv[0], code, "while storing credentials");
+ exit(1);
+ }
+
exit(0);
}