diff options
author | wpaul <wpaul@FreeBSD.org> | 1995-04-21 18:04:36 +0000 |
---|---|---|
committer | wpaul <wpaul@FreeBSD.org> | 1995-04-21 18:04:36 +0000 |
commit | be813a3b68f7e9be9bfef131c96c99089a98aa39 (patch) | |
tree | e8c95e4950ed2d5368e9f49ee0ff9ef92b373dd1 /lib | |
parent | 79d93cb4f787cfc70f395d40220e021b6d8be7f2 (diff) | |
download | FreeBSD-src-be813a3b68f7e9be9bfef131c96c99089a98aa39.zip FreeBSD-src-be813a3b68f7e9be9bfef131c96c99089a98aa39.tar.gz |
small NIS binding fixes:
ypbind.c: if a client program asks ypbind for the name of the server
for a particular domain, and there isn't a binding for that domain
available yet, ypbind needs to supply a status value along with its
failure message. Set yprespbody.ypbind_error before returning from
a ypbindproc_domain request.
yplib.c: properly handle the error status messages ypbind now has the
ability to send us. Add a ypbinderr_string() function to decode the
error values.
ypwhich.c: handle ypbind errors correctly: yperr_string() can't handle
ypbind_status messages -- use ypbinderr_string instead.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/yp/yplib.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/lib/libc/yp/yplib.c b/lib/libc/yp/yplib.c index ea3728b..da23244 100644 --- a/lib/libc/yp/yplib.c +++ b/lib/libc/yp/yplib.c @@ -28,7 +28,7 @@ */ #ifndef LINT -static char *rcsid = "$Id: yplib.c,v 1.4 1995/03/24 21:21:37 wpaul Exp $"; +static char *rcsid = "$Id: yplib.c,v 1.6 1995/04/09 21:52:31 wpaul Exp $"; #endif #include <sys/param.h> @@ -168,6 +168,25 @@ int *vallen; } #endif +char * +ypbinderr_string(incode) +int incode; +{ + static char err[80]; + switch(incode) { + case 0: + return "Success"; + case 1: + return "Internal ypbind error"; + case 2: + return "Domain not bound"; + case 3: + return "System resource allocation failure"; + } + sprintf(err, "Unknown ypbind error %d\n", incode); + return err; +} + int _yp_dobind(dom, ypdb) char *dom; @@ -329,6 +348,12 @@ skipit: clnt_destroy(client); ysd->dom_vers = -1; goto again; + } else { + if (ypbr.ypbind_status != YPBIND_SUCC_VAL) { + fprintf(stderr, "yp_bind: %s\n", + ypbinderr_string(ypbr.ypbind_status)); + return YPERR_YPBIND; + } } clnt_destroy(client); |