svn commit: samba r21935 - in branches: SAMBA_3_0/source/auth SAMBA_3_0/source/nsswitch SAMBA_3_0_25/source/auth SAMBA_3_0_25/source/nsswitch

vlendec at samba.org vlendec at samba.org
Thu Mar 22 18:36:12 GMT 2007


Author: vlendec
Date: 2007-03-22 18:36:09 +0000 (Thu, 22 Mar 2007)
New Revision: 21935

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=21935

Log:
Revert obviously not sufficiently tested code -- sorry for the pain. I am afraid I was basically off the net for the day
Modified:
   branches/SAMBA_3_0/source/auth/auth_winbind.c
   branches/SAMBA_3_0/source/nsswitch/wb_common.c
   branches/SAMBA_3_0/source/nsswitch/winbind_client.h
   branches/SAMBA_3_0/source/nsswitch/winbind_nss_irix.c
   branches/SAMBA_3_0_25/source/auth/auth_winbind.c
   branches/SAMBA_3_0_25/source/nsswitch/wb_common.c
   branches/SAMBA_3_0_25/source/nsswitch/winbind_client.h
   branches/SAMBA_3_0_25/source/nsswitch/winbind_nss_irix.c


Changeset:
Modified: branches/SAMBA_3_0/source/auth/auth_winbind.c
===================================================================
--- branches/SAMBA_3_0/source/auth/auth_winbind.c	2007-03-22 18:16:36 UTC (rev 21934)
+++ branches/SAMBA_3_0/source/auth/auth_winbind.c	2007-03-22 18:36:09 UTC (rev 21935)
@@ -108,8 +108,7 @@
 
 	/* we are contacting the privileged pipe */
 	become_root();
-	result = winbindd_priv_request_response(WINBINDD_PAM_AUTH_CRAP,
-						&request, &response);
+	result = winbindd_request_response(WINBINDD_PAM_AUTH_CRAP, &request, &response);
 	unbecome_root();
 
 	if ( result == NSS_STATUS_UNAVAIL )  {

Modified: branches/SAMBA_3_0/source/nsswitch/wb_common.c
===================================================================
--- branches/SAMBA_3_0/source/nsswitch/wb_common.c	2007-03-22 18:16:36 UTC (rev 21934)
+++ branches/SAMBA_3_0/source/nsswitch/wb_common.c	2007-03-22 18:36:09 UTC (rev 21935)
@@ -33,7 +33,6 @@
 /* Global variables.  These are effectively the client state information */
 
 int winbindd_fd = -1;           /* fd for winbindd socket */
-static int is_privileged = 0;
 
 /* Free a response structure */
 
@@ -288,7 +287,7 @@
 
 /* Connect to winbindd socket */
 
-static int winbind_open_pipe_sock(int recursing, int need_priv)
+static int winbind_open_pipe_sock(int recursing)
 {
 #ifdef HAVE_UNIXSOCKET
 	static pid_t our_pid;
@@ -301,10 +300,6 @@
 		close_sock();
 		our_pid = getpid();
 	}
-
-	if ((need_priv != 0) && (is_privileged == 0)) {
-		close_sock();
-	}
 	
 	if (winbindd_fd != -1) {
 		return winbindd_fd;
@@ -318,8 +313,6 @@
 		return -1;
 	}
 
-	is_privileged = 0;
-
 	/* version-check the socket */
 
 	request.flags = WBFLAG_RECURSE;
@@ -336,14 +329,9 @@
 		if ((fd = winbind_named_pipe_sock((char *)response.extra_data.data)) != -1) {
 			close(winbindd_fd);
 			winbindd_fd = fd;
-			is_privileged = 1;
 		}
 	}
 
-	if ((need_priv != 0) && (is_privileged == 0)) {
-		return -1;
-	}
-
 	SAFE_FREE(response.extra_data.data);
 
 	return winbindd_fd;
@@ -354,7 +342,7 @@
 
 /* Write data to winbindd socket */
 
-int write_sock(void *buffer, int count, int recursing, int need_priv)
+int write_sock(void *buffer, int count, int recursing)
 {
 	int result, nwritten;
 	
@@ -362,7 +350,7 @@
 	
  restart:
 	
-	if (winbind_open_pipe_sock(recursing, need_priv) == -1) {
+	if (winbind_open_pipe_sock(recursing) == -1) {
 		return -1;
 	}
 	
@@ -548,8 +536,7 @@
  * send simple types of requests 
  */
 
-NSS_STATUS winbindd_send_request(int req_type, int need_priv,
-				 struct winbindd_request *request)
+NSS_STATUS winbindd_send_request(int req_type, struct winbindd_request *request)
 {
 	struct winbindd_request lrequest;
 
@@ -568,14 +555,12 @@
 
 	init_request(request, req_type);
 	
-	if (write_sock(request, sizeof(*request),
-		       request->flags & WBFLAG_RECURSE, need_priv) == -1) {
+	if (write_sock(request, sizeof(*request), request->flags & WBFLAG_RECURSE) == -1) {
 		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)) {
+	    (write_sock(request->extra_data.data, request->extra_len, request->flags & WBFLAG_RECURSE) == -1)) {
 		return NSS_STATUS_UNAVAIL;
 	}
 	
@@ -625,7 +610,7 @@
 	int count = 0;
 
 	while ((status == NSS_STATUS_UNAVAIL) && (count < 10)) {
-		status = winbindd_send_request(req_type, 0, request);
+		status = winbindd_send_request(req_type, request);
 		if (status != NSS_STATUS_SUCCESS) 
 			return(status);
 		status = winbindd_get_response(response);
@@ -635,24 +620,6 @@
 	return status;
 }
 
-NSS_STATUS winbindd_priv_request_response(int req_type, 
-					  struct winbindd_request *request,
-					  struct winbindd_response *response)
-{
-	NSS_STATUS status = NSS_STATUS_UNAVAIL;
-	int count = 0;
-
-	while ((status == NSS_STATUS_UNAVAIL) && (count < 10)) {
-		status = winbindd_send_request(req_type, 1, request);
-		if (status != NSS_STATUS_SUCCESS) 
-			return(status);
-		status = winbindd_get_response(response);
-		count += 1;
-	}
-
-	return status;
-}
-
 /*************************************************************************
  A couple of simple functions to disable winbindd lookups and re-
  enable them

Modified: branches/SAMBA_3_0/source/nsswitch/winbind_client.h
===================================================================
--- branches/SAMBA_3_0/source/nsswitch/winbind_client.h	2007-03-22 18:16:36 UTC (rev 21934)
+++ branches/SAMBA_3_0/source/nsswitch/winbind_client.h	2007-03-22 18:36:09 UTC (rev 21935)
@@ -2,16 +2,13 @@
 #include "winbindd_nss.h"
 
 void init_request(struct winbindd_request *req,int rq_type);
-NSS_STATUS winbindd_send_request(int req_type, int need_priv,
+NSS_STATUS winbindd_send_request(int req_type,
 				 struct winbindd_request *request);
 NSS_STATUS winbindd_get_response(struct winbindd_response *response);
 NSS_STATUS winbindd_request_response(int req_type, 
 			    struct winbindd_request *request,
 			    struct winbindd_response *response);
-NSS_STATUS winbindd_priv_request_response(int req_type, 
-					  struct winbindd_request *request,
-					  struct winbindd_response *response);
-int write_sock(void *buffer, int count, int recursing, int need_priv);
+int write_sock(void *buffer, int count, int recursing);
 int read_reply(struct winbindd_response *response);
 void close_sock(void);
 void free_response(struct winbindd_response *response);

Modified: branches/SAMBA_3_0/source/nsswitch/winbind_nss_irix.c
===================================================================
--- branches/SAMBA_3_0/source/nsswitch/winbind_nss_irix.c	2007-03-22 18:16:36 UTC (rev 21934)
+++ branches/SAMBA_3_0/source/nsswitch/winbind_nss_irix.c	2007-03-22 18:36:09 UTC (rev 21935)
@@ -454,7 +454,7 @@
 	nsd_logprintf(NSD_LOG_MIN,
 		"send_next_request (winbind) %d, timeout = %d sec\n",
 			rq->f_cmd_data, timeout);
-	status = winbindd_send_request((int)rq->f_cmd_data,request,0);
+	status = winbindd_send_request((int)rq->f_cmd_data,request);
 	SAFE_FREE(request);
 
 	if (status != NSS_STATUS_SUCCESS) {

Modified: branches/SAMBA_3_0_25/source/auth/auth_winbind.c
===================================================================
--- branches/SAMBA_3_0_25/source/auth/auth_winbind.c	2007-03-22 18:16:36 UTC (rev 21934)
+++ branches/SAMBA_3_0_25/source/auth/auth_winbind.c	2007-03-22 18:36:09 UTC (rev 21935)
@@ -108,8 +108,7 @@
 
 	/* we are contacting the privileged pipe */
 	become_root();
-	result = winbindd_priv_request_response(WINBINDD_PAM_AUTH_CRAP,
-						&request, &response);
+	result = winbindd_request_response(WINBINDD_PAM_AUTH_CRAP, &request, &response);
 	unbecome_root();
 
 	if ( result == NSS_STATUS_UNAVAIL )  {

Modified: branches/SAMBA_3_0_25/source/nsswitch/wb_common.c
===================================================================
--- branches/SAMBA_3_0_25/source/nsswitch/wb_common.c	2007-03-22 18:16:36 UTC (rev 21934)
+++ branches/SAMBA_3_0_25/source/nsswitch/wb_common.c	2007-03-22 18:36:09 UTC (rev 21935)
@@ -33,7 +33,6 @@
 /* Global variables.  These are effectively the client state information */
 
 int winbindd_fd = -1;           /* fd for winbindd socket */
-static int is_privileged = 0;
 
 /* Free a response structure */
 
@@ -288,7 +287,7 @@
 
 /* Connect to winbindd socket */
 
-static int winbind_open_pipe_sock(int recursing, int need_priv)
+static int winbind_open_pipe_sock(int recursing)
 {
 #ifdef HAVE_UNIXSOCKET
 	static pid_t our_pid;
@@ -301,10 +300,6 @@
 		close_sock();
 		our_pid = getpid();
 	}
-
-	if ((need_priv != 0) && (is_privileged == 0)) {
-		close_sock();
-	}
 	
 	if (winbindd_fd != -1) {
 		return winbindd_fd;
@@ -318,8 +313,6 @@
 		return -1;
 	}
 
-	is_privileged = 0;
-
 	/* version-check the socket */
 
 	request.flags = WBFLAG_RECURSE;
@@ -336,14 +329,9 @@
 		if ((fd = winbind_named_pipe_sock((char *)response.extra_data.data)) != -1) {
 			close(winbindd_fd);
 			winbindd_fd = fd;
-			is_privileged = 1;
 		}
 	}
 
-	if ((need_priv != 0) && (is_privileged == 0)) {
-		return -1;
-	}
-
 	SAFE_FREE(response.extra_data.data);
 
 	return winbindd_fd;
@@ -354,7 +342,7 @@
 
 /* Write data to winbindd socket */
 
-int write_sock(void *buffer, int count, int recursing, int need_priv)
+int write_sock(void *buffer, int count, int recursing)
 {
 	int result, nwritten;
 	
@@ -362,7 +350,7 @@
 	
  restart:
 	
-	if (winbind_open_pipe_sock(recursing, need_priv) == -1) {
+	if (winbind_open_pipe_sock(recursing) == -1) {
 		return -1;
 	}
 	
@@ -548,8 +536,7 @@
  * send simple types of requests 
  */
 
-NSS_STATUS winbindd_send_request(int req_type, int need_priv,
-				 struct winbindd_request *request)
+NSS_STATUS winbindd_send_request(int req_type, struct winbindd_request *request)
 {
 	struct winbindd_request lrequest;
 
@@ -568,14 +555,12 @@
 
 	init_request(request, req_type);
 	
-	if (write_sock(request, sizeof(*request),
-		       request->flags & WBFLAG_RECURSE, need_priv) == -1) {
+	if (write_sock(request, sizeof(*request), request->flags & WBFLAG_RECURSE) == -1) {
 		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)) {
+	    (write_sock(request->extra_data.data, request->extra_len, request->flags & WBFLAG_RECURSE) == -1)) {
 		return NSS_STATUS_UNAVAIL;
 	}
 	
@@ -625,7 +610,7 @@
 	int count = 0;
 
 	while ((status == NSS_STATUS_UNAVAIL) && (count < 10)) {
-		status = winbindd_send_request(req_type, 0, request);
+		status = winbindd_send_request(req_type, request);
 		if (status != NSS_STATUS_SUCCESS) 
 			return(status);
 		status = winbindd_get_response(response);
@@ -635,24 +620,6 @@
 	return status;
 }
 
-NSS_STATUS winbindd_priv_request_response(int req_type, 
-					  struct winbindd_request *request,
-					  struct winbindd_response *response)
-{
-	NSS_STATUS status = NSS_STATUS_UNAVAIL;
-	int count = 0;
-
-	while ((status == NSS_STATUS_UNAVAIL) && (count < 10)) {
-		status = winbindd_send_request(req_type, 1, request);
-		if (status != NSS_STATUS_SUCCESS) 
-			return(status);
-		status = winbindd_get_response(response);
-		count += 1;
-	}
-
-	return status;
-}
-
 /*************************************************************************
  A couple of simple functions to disable winbindd lookups and re-
  enable them

Modified: branches/SAMBA_3_0_25/source/nsswitch/winbind_client.h
===================================================================
--- branches/SAMBA_3_0_25/source/nsswitch/winbind_client.h	2007-03-22 18:16:36 UTC (rev 21934)
+++ branches/SAMBA_3_0_25/source/nsswitch/winbind_client.h	2007-03-22 18:36:09 UTC (rev 21935)
@@ -2,16 +2,13 @@
 #include "winbindd_nss.h"
 
 void init_request(struct winbindd_request *req,int rq_type);
-NSS_STATUS winbindd_send_request(int req_type, int need_priv,
+NSS_STATUS winbindd_send_request(int req_type,
 				 struct winbindd_request *request);
 NSS_STATUS winbindd_get_response(struct winbindd_response *response);
 NSS_STATUS winbindd_request_response(int req_type, 
 			    struct winbindd_request *request,
 			    struct winbindd_response *response);
-NSS_STATUS winbindd_priv_request_response(int req_type, 
-					  struct winbindd_request *request,
-					  struct winbindd_response *response);
-int write_sock(void *buffer, int count, int recursing, int need_priv);
+int write_sock(void *buffer, int count, int recursing);
 int read_reply(struct winbindd_response *response);
 void close_sock(void);
 void free_response(struct winbindd_response *response);

Modified: branches/SAMBA_3_0_25/source/nsswitch/winbind_nss_irix.c
===================================================================
--- branches/SAMBA_3_0_25/source/nsswitch/winbind_nss_irix.c	2007-03-22 18:16:36 UTC (rev 21934)
+++ branches/SAMBA_3_0_25/source/nsswitch/winbind_nss_irix.c	2007-03-22 18:36:09 UTC (rev 21935)
@@ -454,7 +454,7 @@
 	nsd_logprintf(NSD_LOG_MIN,
 		"send_next_request (winbind) %d, timeout = %d sec\n",
 			rq->f_cmd_data, timeout);
-	status = winbindd_send_request((int)rq->f_cmd_data,request,0);
+	status = winbindd_send_request((int)rq->f_cmd_data,request);
 	SAFE_FREE(request);
 
 	if (status != NSS_STATUS_SUCCESS) {



More information about the samba-cvs mailing list