NetBSD-Bugs archive

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

lib/46111: yplib will hang forever if no server can be found



>Number:         46111
>Category:       lib
>Synopsis:       yplib will hang forever if no server can be found
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Feb 28 16:20:01 +0000 2012
>Originator:     Wolfgang Stukenbrock
>Release:        NetBSD 5.1
>Organization:
Dr. Nagler & Company GmbH
>Environment:
        
        
System: NetBSD test-s0 4.0 NetBSD 4.0 (NSW-WS) #0: Tue Aug 17 17:28:09 CEST 
2010 wgstuken@test-s0:/usr/src/sys/arch/amd64/compile/NSW-WS amd64
Architecture: x86_64
Machine: amd64
>Description:
        The original yplib.c from Sun has a bug that it will hang forever
        in some situations, if no yp-server can be found.
        In some other situation YPERR_YPBIND is returned.
        This is very ugly if an application may be instructed to get some
        information from a random domain, because this may lockup the
        application.
        The following patch will return after the "normal" retry processing,
        if no yp-server can be found to avoid this hangup.
        The patch will still block forever, if a yp-server has been found
        before but currently no yp-server can be reached for the desired
        domain anymore.
        This preserves the current behaviour for applications that need it if
        a server has been reached before, but allows to request data from
        not-reachable domains without blocking forever.
>How-To-Repeat:
        Setup yp and try "ypcat -d yomething passwd". It will hang forever.
>Fix:
        The following fix should be applied to /usr/src/lib/libc/yp/yplib.c
        to add this fix.
--- yplib.c     2011/12/27 12:04:10     1.1
+++ yplib.c     2011/12/27 12:05:32
@@ -220,6 +220,11 @@
                    "YP server for domain %s not responding, still trying\n",
                                    dom);
                        }
+                       else if (new == 1 && ++nerrs == _yplib_nerrs) {
+// first connect to domain on network fails - do not loop forever here ...
+                         free(ysd);
+                         return YPERR_YPBIND;
+                       }
                        clnt_destroy(client);
                        ysd->dom_vers = -1;
                        goto again;

>Unformatted:
        
        


Home | Main Index | Thread Index | Old Index