From 3ea6a5cfc0416c565b0146c186597175db3ec122 Mon Sep 17 00:00:00 2001 From: Tom Yu Date: Mon, 21 Jul 2008 16:08:05 +0000 Subject: [PATCH] pull up r20531 from trunk r20531@cathode-dark-space: tlyu | 2008-07-16 19:01:54 -0400 ticket: 6028 target_version: 1.6.4 tags: pullup Apply patch from Mark Phalan to initialize progname before use. ticket: 6028 status: resolved version_fixed: 1.6.4 git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-6@20548 dc483132-0cff-0310-8789-dd5450dbe970 --- src/kadmin/dbutil/kdb5_util.c | 10 ++++++---- src/plugins/kdb/ldap/ldap_util/kdb5_ldap_util.c | 7 +++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/kadmin/dbutil/kdb5_util.c b/src/kadmin/dbutil/kdb5_util.c index 1807d1ad0..ff52e4c42 100644 --- a/src/kadmin/dbutil/kdb5_util.c +++ b/src/kadmin/dbutil/kdb5_util.c @@ -186,16 +186,18 @@ int main(argc, argv) set_com_err_hook(extended_com_err_fn); + /* + * Ensure that "progname" is set before calling com_err. + */ + progname = (strrchr(argv[0], '/') ? + strrchr(argv[0], '/') + 1 : argv[0]); + retval = kadm5_init_krb5_context(&util_context); if (retval) { com_err (progname, retval, "while initializing Kerberos code"); exit(1); } -/* initialize_adb_error_table(); */ - - progname = (strrchr(argv[0], '/') ? strrchr(argv[0], '/')+1 : argv[0]); - cmd_argv = (char **) malloc(sizeof(char *)*argc); if (cmd_argv == NULL) { com_err(progname, ENOMEM, "while creating sub-command arguments"); diff --git a/src/plugins/kdb/ldap/ldap_util/kdb5_ldap_util.c b/src/plugins/kdb/ldap/ldap_util/kdb5_ldap_util.c index 9fcc7b79d..d7a05a3d8 100644 --- a/src/plugins/kdb/ldap/ldap_util/kdb5_ldap_util.c +++ b/src/plugins/kdb/ldap/ldap_util/kdb5_ldap_util.c @@ -303,6 +303,11 @@ int main(argc, argv) krb5_boolean realm_name_required = TRUE; krb5_boolean print_help_message = FALSE; + /* + * Ensure that "progname" is set before calling com_err. + */ + progname = (strrchr(argv[0], '/') ? strrchr(argv[0], '/')+1 : argv[0]); + retval = krb5_init_context(&util_context); set_com_err_hook(extended_com_err_fn); if (retval) { @@ -311,8 +316,6 @@ int main(argc, argv) goto cleanup; } - progname = (strrchr(argv[0], '/') ? strrchr(argv[0], '/')+1 : argv[0]); - cmd_argv = (char **) malloc(sizeof(char *)*argc); if (cmd_argv == NULL) { com_err(progname, ENOMEM, "while creating sub-command arguments"); -- 2.26.2