about summary refs log tree commit diff
path: root/nis
diff options
context:
space:
mode:
Diffstat (limited to 'nis')
-rw-r--r--nis/nis_call.c3
-rw-r--r--nis/nis_mkdir.c24
-rw-r--r--nis/nis_rmdir.c22
-rw-r--r--nis/rpcsvc/yp_prot.h20
4 files changed, 30 insertions, 39 deletions
diff --git a/nis/nis_call.c b/nis/nis_call.c
index fd777f5948..06f63ee52e 100644
--- a/nis/nis_call.c
+++ b/nis/nis_call.c
@@ -289,7 +289,7 @@ __do_niscall2 (const nis_server *server, u_int server_len, u_long prog,
     server_len = 1;
 
   if ((dbp = __bind_create (server, server_len, flags)) == NULL)
-    return NIS_UNAVAIL;
+    return NIS_NAMEUNREACHABLE;
   while (__bind_connect (dbp) != NIS_SUCCESS)
     {
       if (__bind_next (dbp) != NIS_SUCCESS)
@@ -351,6 +351,7 @@ __do_niscall2 (const nis_server *server, u_int server_len, u_long prog,
 		    break; /* No more servers to search in */
 		  goto again;
 		}
+	      break;
 	    case NIS_FINDDIRECTORY:
 	      if ((((fd_result *)resp)->status == NIS_NOTFOUND) ||
 		  (((fd_result *)resp)->status == NIS_NOSUCHNAME) ||
diff --git a/nis/nis_mkdir.c b/nis/nis_mkdir.c
index b762e93f27..ab693d7da1 100644
--- a/nis/nis_mkdir.c
+++ b/nis/nis_mkdir.c
@@ -24,23 +24,19 @@
 nis_error
 nis_mkdir (const_nis_name dir, const nis_server *server)
 {
-  nis_error res;
+  nis_error res, res2;
 
   if (server == NULL)
-    {
-      if (__do_niscall (dir, NIS_MKDIR, (xdrproc_t) xdr_nis_name,
-			(caddr_t) &dir, (xdrproc_t) xdr_nis_error,
-			(caddr_t) &res, 0, NULL) != RPC_SUCCESS)
-	return NIS_RPCERROR;
-    }
-  else
-    {
-      if (__do_niscall2 (server, 1, NIS_MKDIR,
-			 (xdrproc_t) xdr_nis_name,
+    res2 = __do_niscall (dir, NIS_MKDIR, (xdrproc_t) xdr_nis_name,
 			 (caddr_t) &dir, (xdrproc_t) xdr_nis_error,
-			 (caddr_t) &res, 0, NULL) != RPC_SUCCESS)
-	return NIS_RPCERROR;
-    }
+			 (caddr_t) &res, 0, NULL);
+  else
+    res2 = __do_niscall2 (server, 1, NIS_MKDIR,
+			  (xdrproc_t) xdr_nis_name,
+			  (caddr_t) &dir, (xdrproc_t) xdr_nis_error,
+			  (caddr_t) &res, 0, NULL);
+  if (res2 != NIS_SUCCESS)
+    return res2;
 
   return res;
 }
diff --git a/nis/nis_rmdir.c b/nis/nis_rmdir.c
index adf5924ada..ff84ed81e2 100644
--- a/nis/nis_rmdir.c
+++ b/nis/nis_rmdir.c
@@ -24,23 +24,17 @@
 nis_error
 nis_rmdir (const_nis_name dir, const nis_server *server)
 {
-  nis_error res;
+  nis_error res, res2;
 
   if (server == NULL)
-    {
-      if (__do_niscall (dir, NIS_RMDIR, (xdrproc_t) xdr_nis_name,
+    return NIS_SYSTEMERROR;
+
+  res2 = __do_niscall2 (server, 1, NIS_RMDIR,
+			(xdrproc_t) xdr_nis_name,
 			(caddr_t) &dir, (xdrproc_t) xdr_nis_error,
-			(caddr_t) &res, 0, NULL) != RPC_SUCCESS)
-	return NIS_RPCERROR;
-    }
-  else
-    {
-      if (__do_niscall2 (server, 1, NIS_RMDIR,
-			 (xdrproc_t) xdr_nis_name,
-			 (caddr_t) &dir, (xdrproc_t) xdr_nis_error,
-			 (caddr_t) &res, 0, NULL) != RPC_SUCCESS)
-	return NIS_RPCERROR;
-    }
+			(caddr_t) &res, 0, NULL);
+  if (res2 != NIS_SUCCESS)
+    return res2;
 
   return res;
 }
diff --git a/nis/rpcsvc/yp_prot.h b/nis/rpcsvc/yp_prot.h
index 42bc54c59d..82f93b49ed 100644
--- a/nis/rpcsvc/yp_prot.h
+++ b/nis/rpcsvc/yp_prot.h
@@ -12,6 +12,8 @@
 #include <rpc/rpc.h>
 #include <rpcsvc/ypclnt.h>
 
+__BEGIN_DECLS
+
 /*
  * The following procedures are supported by the protocol:
  *
@@ -72,12 +74,12 @@
 typedef struct {
   u_int keydat_len;
   char *keydat_val;
-} keydat;
+} keydat_t;
 
 typedef struct {
   u_int valdat_len;
   char *valdat_val;
-} valdat;
+} valdat_t;
 
 struct ypmap_parms {
   char *domain;			/* Null string means not available */
@@ -93,7 +95,7 @@ struct ypmap_parms {
 struct ypreq_key {
   const char *domain;
   const char *map;
-  keydat keydat;
+  keydat_t keydat;
 };
 
 struct ypreq_nokey {
@@ -149,7 +151,7 @@ typedef enum ypstat ypstat;
 
 struct ypresp_val {
   ypstat status;
-  valdat valdat;
+  valdat_t valdat;
 };
 
 struct ypresp_key_val {
@@ -160,11 +162,11 @@ struct ypresp_key_val {
      implementation somehow must change the order internally.  We
      don't want to follow this bad example since the user should be
      able to use rpcgen on this file.  */
-  keydat keydat;
-  valdat valdat;
+  keydat_t keydat;
+  valdat_t valdat;
 #else
-  valdat valdat;
-  keydat keydat;
+  valdat_t valdat;
+  keydat_t keydat;
 #endif
 };
 
@@ -340,8 +342,6 @@ struct ypresp_all {
   } ypresp_all_u;
 };
 
-__BEGIN_DECLS
-
 extern bool_t xdr_ypreq_key __P ((XDR *__xdrs, struct ypreq_key * __objp));
 extern bool_t xdr_ypreq_nokey __P ((XDR *__xdrs, struct ypreq_nokey * __objp));
 extern bool_t xdr_ypreq_xfr __P ((XDR *__xdrs, struct ypreq_xfr * __objp));