[krbdev.mit.edu #5257] error on gethostbyname is tested on errno instead of h_errno
Norbert Thiebaud via RT
rt-comment at krbdev.mit.edu
Tue Jan 2 14:07:56 EST 2007
The symptom is that kdb5_util create -s terminate without error (just oddly
indicating that gethostbyname was sucessfull, which would not normally alarm a user)
but none of the 'default' principals, like kadmin/admin or kadim/chagepw are
created....
this is usually detected, either if one do a control listprincs just after
creation, or more likely when one try to create a keytab for these
administrative principals.
This can be quite frustrating, and an error message would be a nice things to do.
since herror() is marked (obsolete) on my man pages, I did not use it and merely
printed the error value.
Norbert Thiebaud
norbert at infotelcorp.com
diff -ur krb5-1.4.3/src/kadmin/dbutil/kadm5_create.c
krb5-1.4.3-gethostbyname/src/kadmin/dbutil/kadm5_create.c
--- krb5-1.4.3/src/kadmin/dbutil/kadm5_create.c 2004-06-16 05:11:54.000000000 +0200
+++ krb5-1.4.3-gethostbyname/src/kadmin/dbutil/kadm5_create.c 2007-01-01
11:31:15.000000000 +0100
@@ -184,8 +184,8 @@
}
hp = gethostbyname(localname);
if (hp == NULL) {
- ret = errno;
- perror("gethostbyname");
+ ret = h_errno;
+ fprintf(stderr, "gethostbyname error: %i\n", ret);
goto clean_and_exit;
}
sprintf(service_name, "kadmin/%s", hp->h_name);
More information about the krb5-bugs
mailing list