[29912] in CVS-changelog-for-Kerberos-V5
krb5 commit: Avoid deprecated call in kdc5_hammer.c
daemon@ATHENA.MIT.EDU (Greg Hudson)
Fri Apr 14 12:14:39 2017
Date: Fri, 14 Apr 2017 12:14:35 -0400
From: Greg Hudson <ghudson@mit.edu>
Message-Id: <201704141614.v3EGEZOk024122@drugstore.mit.edu>
To: cvs-krb5@mit.edu
Reply-To: krbdev@mit.edu
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu
https://github.com/krb5/krb5/commit/46d42191187c1fadb863ad61251a3c72fe06dda0
commit 46d42191187c1fadb863ad61251a3c72fe06dda0
Author: Robbie Harwood <rharwood@redhat.com>
Date: Thu Mar 30 16:59:23 2017 -0400
Avoid deprecated call in kdc5_hammer.c
Use krb5_get_init_creds_password() instead of
krb5_get_in_tkt_with_password().
src/tests/hammer/kdc5_hammer.c | 47 ++++++++++++++++-----------------------
1 files changed, 19 insertions(+), 28 deletions(-)
diff --git a/src/tests/hammer/kdc5_hammer.c b/src/tests/hammer/kdc5_hammer.c
index 0934f33..efb4271 100644
--- a/src/tests/hammer/kdc5_hammer.c
+++ b/src/tests/hammer/kdc5_hammer.c
@@ -436,12 +436,11 @@ int get_tgt (context, p_client_str, p_client, ccache)
{
char *cache_name = NULL; /* -f option */
long lifetime = KRB5_DEFAULT_LIFE; /* -l option */
- int options = KRB5_DEFAULT_OPTIONS;
krb5_error_code code;
krb5_creds my_creds;
krb5_timestamp start;
- krb5_principal tgt_server;
float dt;
+ krb5_get_init_creds_opt *options;
if (!brief)
fprintf(stderr, "\tgetting TGT for %s\n", p_client_str);
@@ -458,22 +457,6 @@ int get_tgt (context, p_client_str, p_client, ccache)
return(-1);
}
-
- if ((code = krb5_build_principal_ext(context, &tgt_server,
- krb5_princ_realm(context, *p_client)->length,
- krb5_princ_realm(context, *p_client)->data,
- tgtname.length,
- tgtname.data,
- krb5_princ_realm(context, *p_client)->length,
- krb5_princ_realm(context, *p_client)->data,
- 0))) {
- com_err(prog, code, "when setting up tgt principal");
- return(-1);
- }
-
- my_creds.client = *p_client;
- my_creds.server = tgt_server;
-
code = krb5_cc_initialize (context, ccache, *p_client);
if (code != 0) {
com_err (prog, code, "when initializing cache %s",
@@ -481,17 +464,26 @@ int get_tgt (context, p_client_str, p_client, ccache)
return(-1);
}
- my_creds.times.starttime = 0; /* start timer when request
- gets to KDC */
- my_creds.times.endtime = start + lifetime;
- my_creds.times.renew_till = 0;
-
if (do_timer)
swatch_on();
- code = krb5_get_in_tkt_with_password(context, options, 0,
- NULL, patype, p_client_str, ccache,
- &my_creds, 0);
+ code = krb5_get_init_creds_opt_alloc(context, &options);
+ if (code != 0) {
+ com_err(prog, code, "when allocating init cred options");
+ return(-1);
+ }
+
+ krb5_get_init_creds_opt_set_tkt_life(options, lifetime);
+
+ code = krb5_get_init_creds_opt_set_out_ccache(context, options, ccache);
+ if (code != 0) {
+ com_err(prog, code, "when setting init cred output ccache");
+ return(-1);
+ }
+
+ code = krb5_get_init_creds_password(context, &my_creds, *p_client,
+ p_client_str, NULL, NULL, 0, NULL,
+ options);
if (do_timer) {
dt = swatch_eltime();
in_tkt_times.ht_cumulative += dt;
@@ -501,8 +493,7 @@ int get_tgt (context, p_client_str, p_client, ccache)
if (dt < in_tkt_times.ht_min)
in_tkt_times.ht_min = dt;
}
- my_creds.server = my_creds.client = 0;
- krb5_free_principal(context, tgt_server);
+ krb5_get_init_creds_opt_free(context, options);
krb5_free_cred_contents(context, &my_creds);
if (code != 0) {
com_err (prog, code, "while getting initial credentials");
_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5