From: Greg Hudson Date: Tue, 18 May 2010 16:17:15 +0000 (+0000) Subject: Improve the error message from kadmin when hostname resolution fails X-Git-Tag: krb5-1.9-beta1~227 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=491a660dfab0748f7468564c44c24bea839eb3be;p=krb5.git Improve the error message from kadmin when hostname resolution fails for the admin server. (The extended message won't be displayed by kadmin currently; that's a separate issue.) git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@24054 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/kadm5/alt_prof.c b/src/lib/kadm5/alt_prof.c index e3e6d4955..c8dc307c1 100644 --- a/src/lib/kadm5/alt_prof.c +++ b/src/lib/kadm5/alt_prof.c @@ -875,7 +875,11 @@ kadm5_get_admin_service_name(krb5_context ctx, hp = gethostbyname(params_out.admin_server); if (hp == NULL) { - ret = errno; + ret = KADM5_CANT_RESOLVE; + krb5_set_error_message(ctx, ret, + "Cannot resolve address of admin server \"%s\" " + "for realm \"%s\"", params_out.admin_server, + realm_in); goto err_params; } if (strlen(hp->h_name) + sizeof("kadmin/") > maxlen) { diff --git a/src/lib/kadm5/clnt/client_init.c b/src/lib/kadm5/clnt/client_init.c index 03e0a9c55..85d982c20 100644 --- a/src/lib/kadm5/clnt/client_init.c +++ b/src/lib/kadm5/clnt/client_init.c @@ -452,10 +452,8 @@ kadm5_get_init_creds(kadm5_server_handle_t handle, code = kadm5_get_admin_service_name(handle->context, handle->params.realm, svcname, sizeof(svcname)); - if (code) { - code = KADM5_MISSING_KRB5_CONF_PARAMS; + if (code) goto error; - } } else { strncpy(svcname, svcname_in, sizeof(svcname)); svcname[sizeof(svcname)-1] = '\0'; diff --git a/src/lib/kadm5/kadm_err.et b/src/lib/kadm5/kadm_err.et index da18a74eb..a6086b111 100644 --- a/src/lib/kadm5/kadm_err.et +++ b/src/lib/kadm5/kadm_err.et @@ -60,4 +60,5 @@ error_code KADM5_SETV4KEY_INVAL_ENCTYPE, "Invalid enctype for setv4key" error_code KADM5_SETKEY3_ETYPE_MISMATCH, "Mismatched enctypes for setkey3" error_code KADM5_MISSING_KRB5_CONF_PARAMS, "Missing parameters in krb5.conf required for kadmin client" error_code KADM5_XDR_FAILURE, "XDR encoding error" +error_code KADM5_CANT_RESOLVE, "Cannot resolve network address for admin server in requested realm" end