From: Tom Yu Date: Wed, 16 Jul 2008 23:01:54 +0000 (+0000) Subject: Apply patch from Mark Phalan to initialize progname before use X-Git-Tag: krb5-1.7-alpha1~592 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f452cb9821e2ee9034fc83b5ec98347fab647488;p=krb5.git Apply patch from Mark Phalan to initialize progname before use ticket: 6028 target_version: 1.6.4 tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20531 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/kadmin/dbutil/kdb5_util.c b/src/kadmin/dbutil/kdb5_util.c index 1b2aa60c5..7da89c8f5 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 34a2fc808..e2776b985 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");