From 8166f3a7bc9ba7a646fc370d2aca898f0b8a4b81 Mon Sep 17 00:00:00 2001 From: Ezra Peisach Date: Tue, 10 Oct 2000 09:00:59 +0000 Subject: [PATCH] * kcmd.c (kcmd): Use krb5_set_principal_realm() instead of freeing the principals realm data and mucking with it ourselves. This way, we do not free memory allocated by the krb5 library with a possibly incorrect free, and we do not allocate memory for a krb5 structure which might be released by the krb5 library. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@12748 dc483132-0cff-0310-8789-dd5450dbe970 --- src/appl/bsd/ChangeLog | 5 +++++ src/appl/bsd/kcmd.c | 12 +++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/appl/bsd/ChangeLog b/src/appl/bsd/ChangeLog index 50bf2c24d..eb4748a72 100644 --- a/src/appl/bsd/ChangeLog +++ b/src/appl/bsd/ChangeLog @@ -1,3 +1,8 @@ +Tue Oct 10 04:59:04 2000 Ezra Peisach + + * kcmd.c (kcmd): Use krb5_set_principal_realm() instead of freeing the + principals realm data and mucking with it ourselves. + 2000-10-03 Ezra Peisach * krlogin.c (main): Declare main as int. diff --git a/src/appl/bsd/kcmd.c b/src/appl/bsd/kcmd.c index 3e401cced..568675fca 100644 --- a/src/appl/bsd/kcmd.c +++ b/src/appl/bsd/kcmd.c @@ -298,11 +298,13 @@ kcmd(sock, ahost, rport, locuser, remuser, cmd, fd2p, service, realm, } if (realm && *realm) { - free(krb5_princ_realm(bsd_context,get_cred->server)->data); - /*krb5_xfree(krb5_princ_realm(bsd_context,get_cred->server)->data);*/ - - krb5_princ_set_realm_length(bsd_context,get_cred->server,strlen(realm)); - krb5_princ_set_realm_data(bsd_context,get_cred->server,strdup(realm)); + status = krb5_set_principal_realm(bsd_context, get_cred->server, + realm); + if (status) { + fprintf(stderr, "kcmd: krb5_set_principal_realm failed %s\n", + error_message(status)); + return(-1); + } } if (fd2p == 0) { write(s, "", 1); -- 2.26.2