Improve the error message from kadmin when hostname resolution fails
authorGreg Hudson <ghudson@mit.edu>
Tue, 18 May 2010 16:17:15 +0000 (16:17 +0000)
committerGreg Hudson <ghudson@mit.edu>
Tue, 18 May 2010 16:17:15 +0000 (16:17 +0000)
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

src/lib/kadm5/alt_prof.c
src/lib/kadm5/clnt/client_init.c
src/lib/kadm5/kadm_err.et

index e3e6d49559205b3458fb95261844d593c738868e..c8dc307c1953219b64ee4c0e15c4b16f0eb6007d 100644 (file)
@@ -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) {
index 03e0a9c552a258802943ac06ceb48ca626f8954c..85d982c20849a6789f6d1e8080325931b6446dca 100644 (file)
@@ -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';
index da18a74eb5f6894c373fd049aaf4d8df7e5064c9..a6086b1119b763f6ac69774c57f4b39aeb9821c0 100644 (file)
@@ -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