Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src PR/46111: Wolfgang Stukenbrock: Add yp_setbindtries(3) so th...



details:   https://anonhg.NetBSD.org/src/rev/43dd8ef49505
branches:  trunk
changeset: 777734:43dd8ef49505
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Mar 02 17:27:48 2012 +0000

description:
PR/46111: Wolfgang Stukenbrock: Add yp_setbindtries(3) so that yp operations
don't hang forever if requested.

diffstat:

 distrib/sets/lists/comp/mi   |   5 ++++-
 include/rpcsvc/ypclnt.h      |   3 ++-
 lib/libc/include/namespace.h |   3 ++-
 lib/libc/yp/Makefile.inc     |   5 +++--
 lib/libc/yp/yp_first.c       |  15 +++++++++------
 lib/libc/yp/yp_maplist.c     |  10 ++++++----
 lib/libc/yp/yp_master.c      |  10 ++++++----
 lib/libc/yp/yp_match.c       |  10 +++++++---
 lib/libc/yp/yp_order.c       |  10 ++++++----
 lib/libc/yp/ypclnt.3         |  18 ++++++++++++++++--
 lib/libc/yp/yplib.c          |  23 ++++++++++++++++++++---
 usr.bin/ypcat/ypcat.1        |  10 ++++++++--
 usr.bin/ypcat/ypcat.c        |  27 ++++++++++++++++++++-------
 usr.bin/ypmatch/ypmatch.1    |  10 ++++++++--
 usr.bin/ypmatch/ypmatch.c    |  27 ++++++++++++++++++++-------
 15 files changed, 137 insertions(+), 49 deletions(-)

diffs (truncated from 659 to 300 lines):

diff -r 74524316144a -r 43dd8ef49505 distrib/sets/lists/comp/mi
--- a/distrib/sets/lists/comp/mi        Fri Mar 02 16:56:32 2012 +0000
+++ b/distrib/sets/lists/comp/mi        Fri Mar 02 17:27:48 2012 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: mi,v 1.1743 2012/02/29 20:07:52 tron Exp $
+#      $NetBSD: mi,v 1.1744 2012/03/02 17:27:48 christos Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -9463,6 +9463,7 @@
 ./usr/share/man/cat3/ypclnt.0                  comp-c-catman           yp,.cat
 ./usr/share/man/cat3/yperr_string.0            comp-c-catman           yp,.cat
 ./usr/share/man/cat3/ypprot_err.0              comp-c-catman           yp,.cat
+./usr/share/man/cat3/yp_setbindtries.0         comp-c-catman           yp,.cat
 ./usr/share/man/cat3/zlib.0                    comp-c-catman           .cat
 ./usr/share/man/cat5/config.0                  comp-util-catman        .cat
 ./usr/share/man/cat5/config.samples.0          comp-util-catman        .cat
@@ -15679,6 +15680,7 @@
 ./usr/share/man/html3/ypclnt.html              comp-c-htmlman          yp,html
 ./usr/share/man/html3/yperr_string.html                comp-c-htmlman          yp,html
 ./usr/share/man/html3/ypprot_err.html          comp-c-htmlman          yp,html
+./usr/share/man/html3/yp_setbindtries.html     comp-c-htmlman          yp,html
 ./usr/share/man/html3/zlib.html                        comp-c-htmlman          html
 ./usr/share/man/html5/config.html              comp-util-htmlman       html
 ./usr/share/man/html5/config.samples.html      comp-util-htmlman       html
@@ -21971,6 +21973,7 @@
 ./usr/share/man/man3/ypclnt.3                  comp-c-man              yp,.man
 ./usr/share/man/man3/yperr_string.3            comp-c-man              yp,.man
 ./usr/share/man/man3/ypprot_err.3              comp-c-man              yp,.man
+./usr/share/man/man3/yp_setbindtries.3         comp-c-man              yp,.man
 ./usr/share/man/man3/zlib.3                    comp-c-man              .man
 ./usr/share/man/man5/config.5                  comp-util-man           .man
 ./usr/share/man/man5/config.samples.5          comp-util-man           .man
diff -r 74524316144a -r 43dd8ef49505 include/rpcsvc/ypclnt.h
--- a/include/rpcsvc/ypclnt.h   Fri Mar 02 16:56:32 2012 +0000
+++ b/include/rpcsvc/ypclnt.h   Fri Mar 02 17:27:48 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ypclnt.h,v 1.13 2005/02/03 04:39:33 perry Exp $        */
+/*     $NetBSD: ypclnt.h,v 1.14 2012/03/02 17:27:48 christos Exp $     */
 
 /*
  * Copyright (c) 1992, 1993 Theo de Raadt <deraadt%fsa.ca@localhost>
@@ -80,6 +80,7 @@
 int    yp_all          (const char *, const char *, struct ypall_callback *);
 char * yperr_string    (int);
 int    ypprot_err      (unsigned int);
+int    yp_setbindtries (int);
 __END_DECLS
 
 #endif /* _RPCSVC_YPCLNT_H_ */
diff -r 74524316144a -r 43dd8ef49505 lib/libc/include/namespace.h
--- a/lib/libc/include/namespace.h      Fri Mar 02 16:56:32 2012 +0000
+++ b/lib/libc/include/namespace.h      Fri Mar 02 17:27:48 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: namespace.h,v 1.150 2012/02/15 15:49:46 joerg Exp $    */
+/*     $NetBSD: namespace.h,v 1.151 2012/03/02 17:27:49 christos Exp $ */
 
 /*-
  * Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
@@ -801,6 +801,7 @@
 #define yp_unbind              _yp_unbind
 #define yperr_string           _yperr_string
 #define ypprot_err             _ypprot_err
+#define yp_setbindtries                _yp_setbindtries
 #define dlopen                 __dlopen
 #define dlclose                        __dlclose
 #define dlsym                  __dlsym
diff -r 74524316144a -r 43dd8ef49505 lib/libc/yp/Makefile.inc
--- a/lib/libc/yp/Makefile.inc  Fri Mar 02 16:56:32 2012 +0000
+++ b/lib/libc/yp/Makefile.inc  Fri Mar 02 17:27:48 2012 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.inc,v 1.14 1999/02/24 15:05:21 drochner Exp $
+#      $NetBSD: Makefile.inc,v 1.15 2012/03/02 17:27:49 christos Exp $
 
 # yp sources
 .PATH: ${ARCHDIR}/yp ${.CURDIR}/yp
@@ -10,4 +10,5 @@
 MLINKS+=ypclnt.3 yp_all.3 ypclnt.3 yp_bind.3 ypclnt.3 yp_first.3 \
        ypclnt.3 yp_get_default_domain.3 ypclnt.3 yp_master.3 \
        ypclnt.3 yp_match.3 ypclnt.3 yp_next.3 ypclnt.3 yp_order.3 \
-       ypclnt.3 yp_unbind.3 ypclnt.3 yperr_string.3 ypclnt.3 ypprot_err.3
+       ypclnt.3 yp_unbind.3 ypclnt.3 yperr_string.3 ypclnt.3 ypprot_err.3 \
+       ypclnt.3 yp_setbindtries.3
diff -r 74524316144a -r 43dd8ef49505 lib/libc/yp/yp_first.c
--- a/lib/libc/yp/yp_first.c    Fri Mar 02 16:56:32 2012 +0000
+++ b/lib/libc/yp/yp_first.c    Fri Mar 02 17:27:48 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: yp_first.c,v 1.14 2003/12/10 12:06:25 agc Exp $         */
+/*     $NetBSD: yp_first.c,v 1.15 2012/03/02 17:27:49 christos Exp $    */
 
 /*
  * Copyright (c) 1992, 1993 Theo de Raadt <deraadt%fsa.ca@localhost>
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: yp_first.c,v 1.14 2003/12/10 12:06:25 agc Exp $");
+__RCSID("$NetBSD: yp_first.c,v 1.15 2012/03/02 17:27:49 christos Exp $");
 #endif
 
 #include "namespace.h"
@@ -41,6 +41,7 @@
 
 extern struct timeval _yplib_timeout;
 extern int _yplib_nerrs;
+extern int _yplib_bindtries;
 
 #ifdef __weak_alias
 __weak_alias(yp_first,_yp_first)
@@ -84,10 +85,11 @@
            (xdrproc_t)xdr_ypreq_nokey,
            &yprnk, (xdrproc_t)xdr_ypresp_key_val, &yprkv, _yplib_timeout);
        if (r != RPC_SUCCESS) {
-               if (++nerrs == _yplib_nerrs) {
+               if (_yplib_bindtries <= 0 && ++nerrs == _yplib_nerrs) {
                        clnt_perror(ysd->dom_client, "yp_first: clnt_call");
                        nerrs = 0;
-               }
+               } else if (_yplib_bindtries > 0 && ++nerrs == _yplib_bindtries)
+                       return YPERR_YPSERV;
                ysd->dom_vers = -1;
                goto again;
        }
@@ -167,10 +169,11 @@
            (xdrproc_t)xdr_ypreq_key,
            &yprk, (xdrproc_t)xdr_ypresp_key_val, &yprkv, _yplib_timeout);
        if (r != RPC_SUCCESS) {
-               if (++nerrs == _yplib_nerrs) {
+               if (_yplib_bindtries <= 0 && ++nerrs == _yplib_nerrs) {
                        clnt_perror(ysd->dom_client, "yp_next: clnt_call");
                        nerrs = 0;
-               }
+               } else if (_yplib_bindtries > 0 && ++nerrs == _yplib_bindtries)
+                       return YPERR_YPSERV;
                ysd->dom_vers = -1;
                goto again;
        }
diff -r 74524316144a -r 43dd8ef49505 lib/libc/yp/yp_maplist.c
--- a/lib/libc/yp/yp_maplist.c  Fri Mar 02 16:56:32 2012 +0000
+++ b/lib/libc/yp/yp_maplist.c  Fri Mar 02 17:27:48 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: yp_maplist.c,v 1.11 2003/12/10 12:06:25 agc Exp $       */
+/*     $NetBSD: yp_maplist.c,v 1.12 2012/03/02 17:27:49 christos Exp $  */
 
 /*
  * Copyright (c) 1992, 1993 Theo de Raadt <deraadt%fsa.ca@localhost>
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: yp_maplist.c,v 1.11 2003/12/10 12:06:25 agc Exp $");
+__RCSID("$NetBSD: yp_maplist.c,v 1.12 2012/03/02 17:27:49 christos Exp $");
 #endif
 
 #include "namespace.h"
@@ -40,6 +40,7 @@
 
 extern struct timeval _yplib_timeout;
 extern int _yplib_nerrs;
+extern int _yplib_bindtries;
 
 #ifdef __weak_alias
 __weak_alias(yp_maplist,_yp_maplist)
@@ -68,10 +69,11 @@
                   (xdrproc_t)xdr_ypdomain_wrap_string, &indomain,
                   (xdrproc_t)xdr_ypresp_maplist, &ypml, _yplib_timeout);
        if (r != RPC_SUCCESS) {
-               if (++nerrs == _yplib_nerrs) {
+               if (_yplib_bindtries <= 0 && ++nerrs == _yplib_nerrs) {
                        clnt_perror(ysd->dom_client, "yp_maplist: clnt_call");
                        nerrs = 0;
-               }
+               } else if (_yplib_bindtries > 0 && ++nerrs == _yplib_bindtries)
+                       return YPERR_YPSERV;
                ysd->dom_vers = -1;
                goto again;
        }
diff -r 74524316144a -r 43dd8ef49505 lib/libc/yp/yp_master.c
--- a/lib/libc/yp/yp_master.c   Fri Mar 02 16:56:32 2012 +0000
+++ b/lib/libc/yp/yp_master.c   Fri Mar 02 17:27:48 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: yp_master.c,v 1.13 2003/12/10 12:06:25 agc Exp $        */
+/*     $NetBSD: yp_master.c,v 1.14 2012/03/02 17:27:49 christos Exp $   */
 
 /*
  * Copyright (c) 1992, 1993 Theo de Raadt <deraadt%fsa.ca@localhost>
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: yp_master.c,v 1.13 2003/12/10 12:06:25 agc Exp $");
+__RCSID("$NetBSD: yp_master.c,v 1.14 2012/03/02 17:27:49 christos Exp $");
 #endif
 
 #include "namespace.h"
@@ -41,6 +41,7 @@
 
 extern struct timeval _yplib_timeout;
 extern int _yplib_nerrs;
+extern int _yplib_bindtries;
 
 #ifdef __weak_alias
 __weak_alias(yp_master,_yp_master)
@@ -80,10 +81,11 @@
                      (xdrproc_t)xdr_ypreq_nokey, &yprnk,
                      (xdrproc_t)xdr_ypresp_master, &yprm, _yplib_timeout);
        if (r != RPC_SUCCESS) {
-               if (++nerrs == _yplib_nerrs) {
+               if (_yplib_bindtries <= 0 && ++nerrs == _yplib_nerrs) {
                        clnt_perror(ysd->dom_client, "yp_master: clnt_call");
                        nerrs = 0;
-               }
+               } else if (_yplib_bindtries > 0 && ++nerrs == _yplib_bindtries)
+                       return YPERR_YPSERV;
                ysd->dom_vers = -1;
                goto again;
        }
diff -r 74524316144a -r 43dd8ef49505 lib/libc/yp/yp_match.c
--- a/lib/libc/yp/yp_match.c    Fri Mar 02 16:56:32 2012 +0000
+++ b/lib/libc/yp/yp_match.c    Fri Mar 02 17:27:48 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: yp_match.c,v 1.17 2005/11/29 03:12:01 christos Exp $    */
+/*     $NetBSD: yp_match.c,v 1.18 2012/03/02 17:27:49 christos Exp $    */
 
 /*
  * Copyright (c) 1992, 1993 Theo de Raadt <deraadt%fsa.ca@localhost>
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: yp_match.c,v 1.17 2005/11/29 03:12:01 christos Exp $");
+__RCSID("$NetBSD: yp_match.c,v 1.18 2012/03/02 17:27:49 christos Exp $");
 #endif
 
 #include "namespace.h"
@@ -47,6 +47,7 @@
 
 extern struct timeval _yplib_timeout;
 extern int _yplib_nerrs;
+extern int _yplib_bindtries;
 extern char _yp_domain[];
 
 #ifdef __weak_alias
@@ -229,10 +230,13 @@
                      (xdrproc_t)xdr_ypresp_val, &yprv, 
                      _yplib_timeout);
        if (r != RPC_SUCCESS) {
-               if (++nerrs == _yplib_nerrs) {
+               if (_yplib_bindtries <= 0 && ++nerrs == _yplib_nerrs) {
                        clnt_perror(ysd->dom_client, "yp_match: clnt_call");
                        nerrs = 0;
                }
+               else if (_yplib_bindtries > 0 && ++nerrs == _yplib_bindtries) {
+                       return YPERR_YPSERV;
+               }
                ysd->dom_vers = -1;
                goto again;
        }
diff -r 74524316144a -r 43dd8ef49505 lib/libc/yp/yp_order.c
--- a/lib/libc/yp/yp_order.c    Fri Mar 02 16:56:32 2012 +0000
+++ b/lib/libc/yp/yp_order.c    Fri Mar 02 17:27:48 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: yp_order.c,v 1.12 2003/12/10 12:06:25 agc Exp $         */
+/*     $NetBSD: yp_order.c,v 1.13 2012/03/02 17:27:49 christos Exp $    */
 
 /*
  * Copyright (c) 1992, 1993 Theo de Raadt <deraadt%fsa.ca@localhost>
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: yp_order.c,v 1.12 2003/12/10 12:06:25 agc Exp $");
+__RCSID("$NetBSD: yp_order.c,v 1.13 2012/03/02 17:27:49 christos Exp $");
 #endif
 
 #include "namespace.h"
@@ -40,6 +40,7 @@
 
 extern struct timeval _yplib_timeout;
 extern int _yplib_nerrs;
+extern int _yplib_bindtries;
 
 #ifdef __weak_alias
 __weak_alias(yp_order,_yp_order)
@@ -78,10 +79,11 @@
                      (xdrproc_t)xdr_ypresp_order, &ypro, 
                      _yplib_timeout);
        if (r != RPC_SUCCESS) {
-               if (++nerrs == _yplib_nerrs) {
+               if (_yplib_bindtries <= 0 && ++nerrs == _yplib_nerrs) {
                        clnt_perror(ysd->dom_client, "yp_order: clnt_call");
                        nerrs = 0;
-               }
+               } else if (_yplib_bindtries > 0 && ++nerrs == _yplib_bindtries)
+                       return YPERR_YPSERV;
                if (r == RPC_PROCUNAVAIL) {
                        /* Case of NIS+ server in NIS compat mode */
                        r = YPERR_YPERR;
diff -r 74524316144a -r 43dd8ef49505 lib/libc/yp/ypclnt.3
--- a/lib/libc/yp/ypclnt.3      Fri Mar 02 16:56:32 2012 +0000



Home | Main Index | Thread Index | Old Index