param: disable print notify backchannel by default
[mat/samba.git] / nsswitch / wb_common.c
index dcfc8a5156886e63cacd1b103f466ebc7e34833a..c56a76f82612b1017853b2734261636e67cadf94 100644 (file)
@@ -22,6 +22,8 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+#define UID_WRAPPER_NOT_REPLACE
+
 #include "replace.h"
 #include "system/select.h"
 #include "winbind_client.h"
@@ -369,13 +371,14 @@ static int winbind_open_pipe_sock(int recursing, int need_priv)
 static int winbind_write_sock(void *buffer, int count, int recursing,
                              int need_priv)
 {
-       int result, nwritten;
+       int fd, result, nwritten;
 
        /* Open connection to winbind daemon */
 
  restart:
 
-       if (winbind_open_pipe_sock(recursing, need_priv) == -1) {
+       fd = winbind_open_pipe_sock(recursing, need_priv);
+       if (fd == -1) {
                errno = ENOENT;
                return -1;
        }
@@ -391,7 +394,7 @@ static int winbind_write_sock(void *buffer, int count, int recursing,
                /* Catch pipe close on other end by checking if a read()
                   call would not block by calling poll(). */
 
-               pfd.fd = winbindd_fd;
+               pfd.fd = fd;
                pfd.events = POLLIN|POLLHUP;
 
                ret = poll(&pfd, 1, 0);
@@ -412,8 +415,7 @@ static int winbind_write_sock(void *buffer, int count, int recursing,
 
                /* Do the write */
 
-               result = write(winbindd_fd,
-                              (char *)buffer + nwritten,
+               result = write(fd, (char *)buffer + nwritten,
                               count - nwritten);
 
                if ((result == -1) || (result == 0)) {
@@ -434,10 +436,12 @@ static int winbind_write_sock(void *buffer, int count, int recursing,
 
 static int winbind_read_sock(void *buffer, int count)
 {
+       int fd;
        int nread = 0;
        int total_time = 0;
 
-       if (winbindd_fd == -1) {
+       fd = winbind_open_pipe_sock(false, false);
+       if (fd == -1) {
                return -1;
        }
 
@@ -449,7 +453,7 @@ static int winbind_read_sock(void *buffer, int count)
                /* Catch pipe close on other end by checking if a read()
                   call would not block by calling poll(). */
 
-               pfd.fd = winbindd_fd;
+               pfd.fd = fd;
                pfd.events = POLLIN|POLLHUP;
 
                /* Wait for 5 seconds for a reply. May need to parameterise this... */
@@ -475,7 +479,7 @@ static int winbind_read_sock(void *buffer, int count)
 
                        /* Do the Read */
 
-                       int result = read(winbindd_fd, (char *)buffer + nread,
+                       int result = read(fd, (char *)buffer + nread,
                              count - nread);
 
                        if ((result == -1) || (result == 0)) {