[SCM] Samba Shared Repository - branch v3-0-test updated - release-3-0-31-11-g5410ad4

Gerald Carter jerry at samba.org
Wed Aug 20 18:17:40 GMT 2008


The branch, v3-0-test has been updated
       via  5410ad4f4eb0162806778833362a68804d69196e (commit)
      from  6acd5c086b0019f54749a67756975b3c0ba35ac0 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-0-test


- Log -----------------------------------------------------------------
commit 5410ad4f4eb0162806778833362a68804d69196e
Author: Gerald (Jerry) Carter <jerry at samba.org>
Date:   Wed Aug 20 13:00:40 2008 -0500

    nss_winbind: When returning NSS_UNAVAIL, squash errno to ENOENT
    
    According to the GNU libc nss guide, we should always set
    errno to ENOENT when returning NSS_UNAVAIL.
    
    http://www.gnu.org/software/libtool/manual/libc/NSS-Modules-Interface.html#NSS-Modules-Interface
    
    At least the MQ Series message queing service that runs
    on WebSphere will fail if you return any other errno in this case.
    (cherry picked from commit ee26664602445fa7798e2061f6bcbef0756d6528)

-----------------------------------------------------------------------

Summary of changes:
 source/nsswitch/wb_common.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/nsswitch/wb_common.c b/source/nsswitch/wb_common.c
index 563c386..bae54f2 100644
--- a/source/nsswitch/wb_common.c
+++ b/source/nsswitch/wb_common.c
@@ -182,11 +182,13 @@ static int winbind_named_pipe_sock(const char *dir)
 	/* Check permissions on unix socket directory */
 	
 	if (lstat(dir, &st) == -1) {
+		errno = ENOENT;
 		return -1;
 	}
 	
 	if (!S_ISDIR(st.st_mode) || 
 	    (st.st_uid != 0 && st.st_uid != geteuid())) {
+		errno = ENOENT;
 		return -1;
 	}
 	
@@ -210,6 +212,7 @@ static int winbind_named_pipe_sock(const char *dir)
 	   the winbindd daemon is not running. */
 
 	if (lstat(path, &st) == -1) {
+		errno = ENOENT;
 		return -1;
 	}
 	
@@ -217,6 +220,7 @@ static int winbind_named_pipe_sock(const char *dir)
 	
 	if (!S_ISSOCK(st.st_mode) || 
 	    (st.st_uid != 0 && st.st_uid != geteuid())) {
+		errno = ENOENT;
 		return -1;
 	}
 	
@@ -363,6 +367,7 @@ int write_sock(void *buffer, int count, int recursing, int need_priv)
  restart:
 	
 	if (winbind_open_pipe_sock(recursing, need_priv) == -1) {
+		errno = ENOENT;
 		return -1;
 	}
 	
@@ -570,12 +575,18 @@ NSS_STATUS winbindd_send_request(int req_type, int need_priv,
 	
 	if (write_sock(request, sizeof(*request),
 		       request->flags & WBFLAG_RECURSE, need_priv) == -1) {
+		/* Set ENOENT for consistency.  Required by some apps */
+		errno = ENOENT;
+		
 		return NSS_STATUS_UNAVAIL;
 	}
 
 	if ((request->extra_len != 0) &&
 	    (write_sock(request->extra_data.data, request->extra_len,
 			request->flags & WBFLAG_RECURSE, need_priv) == -1)) {
+		/* Set ENOENT for consistency.  Required by some apps */
+		errno = ENOENT;
+
 		return NSS_STATUS_UNAVAIL;
 	}
 	
@@ -599,6 +610,9 @@ NSS_STATUS winbindd_get_response(struct winbindd_response *response)
 
 	/* Wait for reply */
 	if (read_reply(response) == -1) {
+		/* Set ENOENT for consistency.  Required by some apps */
+		errno = ENOENT;
+
 		return NSS_STATUS_UNAVAIL;
 	}
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list