diff options
author | Greg Hudson <ghudson@mit.edu> | 2010-11-01 15:19:00 +0000 |
---|---|---|
committer | Greg Hudson <ghudson@mit.edu> | 2010-11-01 15:19:00 +0000 |
commit | 7143f3daeaebca9839771ee36bf7b4ee1d11a3ac (patch) | |
tree | 62273c9b21b81b0f44340d4e450f03f5816f81df | |
parent | 5abcb10f99de5c732e63679286fa49f1f5766205 (diff) | |
download | krb5-7143f3daeaebca9839771ee36bf7b4ee1d11a3ac.zip krb5-7143f3daeaebca9839771ee36bf7b4ee1d11a3ac.tar.gz krb5-7143f3daeaebca9839771ee36bf7b4ee1d11a3ac.tar.bz2 |
krb5_get_error_message cannot return NULL, and returns "Success" on
error code 0. Simplify some overly paranoid code accordingly.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@24489 dc483132-0cff-0310-8789-dd5450dbe970
-rw-r--r-- | src/kadmin/dbutil/dump.c | 28 | ||||
-rw-r--r-- | src/kdc/kdc_authdata.c | 20 | ||||
-rw-r--r-- | src/kdc/kdc_preauth.c | 10 | ||||
-rw-r--r-- | src/lib/kadm5/srv/kadm5_hook.c | 6 | ||||
-rw-r--r-- | src/lib/krb5/krb/fast.c | 8 | ||||
-rw-r--r-- | src/lib/krb5/os/trace.c | 3 |
6 files changed, 22 insertions, 53 deletions
diff --git a/src/kadmin/dbutil/dump.c b/src/kadmin/dbutil/dump.c index caff137..0e1b609 100644 --- a/src/kadmin/dbutil/dump.c +++ b/src/kadmin/dbutil/dump.c @@ -2514,18 +2514,8 @@ load_db(argc, argv) if((kret = krb5_db_create(kcontext, db5util_db_args))) { const char *emsg = krb5_get_error_message(kcontext, kret); - /* - * See if something (like DAL KDB plugin) has set a specific error - * message and use that otherwise use default. - */ - - if (emsg != NULL) { - fprintf(stderr, "%s: %s\n", progname, emsg); - krb5_free_error_message (kcontext, emsg); - } else { - fprintf(stderr, dbcreaterr_fmt, - progname, dbname, error_message(kret)); - } + fprintf(stderr, "%s: %s\n", progname, emsg); + krb5_free_error_message (kcontext, emsg); exit_status++; if (dumpfile) fclose(f); return; @@ -2538,18 +2528,8 @@ load_db(argc, argv) if ((kret = krb5_db_open(kcontext, db5util_db_args, KRB5_KDB_OPEN_RW | KRB5_KDB_SRV_TYPE_ADMIN))) { const char *emsg = krb5_get_error_message(kcontext, kret); - /* - * See if something (like DAL KDB plugin) has set a specific - * error message and use that otherwise use default. - */ - - if (emsg != NULL) { - fprintf(stderr, "%s: %s\n", progname, emsg); - krb5_free_error_message (kcontext, emsg); - } else { - fprintf(stderr, dbinit_err_fmt, - progname, error_message(kret)); - } + fprintf(stderr, "%s: %s\n", progname, emsg); + krb5_free_error_message (kcontext, emsg); exit_status++; goto error; } diff --git a/src/kdc/kdc_authdata.c b/src/kdc/kdc_authdata.c index a4f81a6..5861e70 100644 --- a/src/kdc/kdc_authdata.c +++ b/src/kdc/kdc_authdata.c @@ -291,12 +291,10 @@ load_authdata_plugins(krb5_context context) ((initerr = (*server_init_proc)(context, &pctx)) != 0)) { const char *emsg; emsg = krb5_get_error_message(context, initerr); - if (emsg) { - krb5_klog_syslog(LOG_ERR, - "authdata %s failed to initialize: %s", - ftable->name, emsg); - krb5_free_error_message(context, emsg); - } + krb5_klog_syslog(LOG_ERR, + "authdata %s failed to initialize: %s", + ftable->name, emsg); + krb5_free_error_message(context, emsg); memset(&authdata_systems[k], 0, sizeof(authdata_systems[k])); continue; @@ -329,12 +327,10 @@ load_authdata_plugins(krb5_context context) ((initerr = (*server_init_proc)(context, &pctx)) != 0)) { const char *emsg; emsg = krb5_get_error_message(context, initerr); - if (emsg) { - krb5_klog_syslog(LOG_ERR, - "authdata %s failed to initialize: %s", - ftable->name, emsg); - krb5_free_error_message(context, emsg); - } + krb5_klog_syslog(LOG_ERR, + "authdata %s failed to initialize: %s", + ftable->name, emsg); + krb5_free_error_message(context, emsg); memset(&authdata_systems[k], 0, sizeof(authdata_systems[k])); continue; diff --git a/src/kdc/kdc_preauth.c b/src/kdc/kdc_preauth.c index 52fb51a..3971555 100644 --- a/src/kdc/kdc_preauth.c +++ b/src/kdc/kdc_preauth.c @@ -471,12 +471,10 @@ load_preauth_plugins(krb5_context context) if (initerr) { const char *emsg; emsg = krb5_get_error_message(context, initerr); - if (emsg) { - krb5_klog_syslog(LOG_ERR, - "preauth %s failed to initialize: %s", - ftable->name, emsg); - krb5_free_error_message(context, emsg); - } + krb5_klog_syslog(LOG_ERR, + "preauth %s failed to initialize: %s", + ftable->name, emsg); + krb5_free_error_message(context, emsg); memset(&preauth_systems[k], 0, sizeof(preauth_systems[k])); diff --git a/src/lib/kadm5/srv/kadm5_hook.c b/src/lib/kadm5/srv/kadm5_hook.c index 386715d..73016c8 100644 --- a/src/lib/kadm5/srv/kadm5_hook.c +++ b/src/lib/kadm5/srv/kadm5_hook.c @@ -117,10 +117,8 @@ log_failure(krb5_context context, { const char *e = krb5_get_error_message(context, ret); - if (e) { - krb5_klog_syslog(LOG_ERR, "kadm5_hook %s failed postcommit %s: %s", - name, function, e); - } + krb5_klog_syslog(LOG_ERR, "kadm5_hook %s failed postcommit %s: %s", + name, function, e); krb5_free_error_message(context, e); } diff --git a/src/lib/krb5/krb/fast.c b/src/lib/krb5/krb/fast.c index 50321cc..cc9f899 100644 --- a/src/lib/krb5/krb/fast.c +++ b/src/lib/krb5/krb/fast.c @@ -182,11 +182,9 @@ krb5int_fast_as_armor(krb5_context context, if (retval != 0) { const char * errmsg; errmsg = krb5_get_error_message(context, retval); - if (errmsg) { - krb5_set_error_message(context, retval, - "%s constructing AP-REQ armor", errmsg); - krb5_free_error_message(context, errmsg); - } + krb5_set_error_message(context, retval, + "%s constructing AP-REQ armor", errmsg); + krb5_free_error_message(context, errmsg); } } if (ccache) diff --git a/src/lib/krb5/os/trace.c b/src/lib/krb5/os/trace.c index 3f31ea9..30942cd 100644 --- a/src/lib/krb5/os/trace.c +++ b/src/lib/krb5/os/trace.c @@ -179,8 +179,7 @@ trace_format(krb5_context context, const char *fmt, va_list ap) } else if (strcmp(tmpbuf, "kerr") == 0) { kerr = va_arg(ap, krb5_error_code); p = krb5_get_error_message(context, kerr); - krb5int_buf_add_fmt(&buf, "%ld/%s", (long) kerr, - (kerr == 0) ? "success" : p); + krb5int_buf_add_fmt(&buf, "%ld/%s", (long) kerr, p); krb5_free_error_message(context, p); } else if (strcmp(tmpbuf, "keyblock") == 0) { keyblock = va_arg(ap, const krb5_keyblock *); |