Revert "s3:winbindd Split helper functions to allow s3compat to call them"
authorAndrew Bartlett <abartlet@samba.org>
Fri, 14 May 2010 03:11:48 +0000 (13:11 +1000)
committerStefan Metzmacher <metze@samba.org>
Mon, 31 May 2010 19:36:55 +0000 (21:36 +0200)
I'm experimenting with a different entry point

This reverts commit f5c0f90da5f5372ca6b7a72daa8d073a2444a068.

source3/winbindd/winbindd.c
source3/winbindd/winbindd_proto.h

index 1c87a14ef67ecd0c2f75ceed7438e6eb18fff71c..5e041fb57bd465d2ee7ae7d23858ad8bf30c9dde 100644 (file)
@@ -763,23 +763,40 @@ void request_ok(struct winbindd_cli_state *state)
 
 /* Process a new connection by adding it to the client connection list */
 
-void winbindd_accepted_new_connection(int accepted_sock, bool privileged)
+static void new_connection(int listen_sock, bool privileged)
 {
+       struct sockaddr_un sunaddr;
        struct winbindd_cli_state *state;
        struct tevent_req *req;
+       socklen_t len;
+       int sock;
+
+       /* Accept connection */
+
+       len = sizeof(sunaddr);
+
+       do {
+               sock = accept(listen_sock, (struct sockaddr *)(void *)&sunaddr,
+                             &len);
+       } while (sock == -1 && errno == EINTR);
+
+       if (sock == -1)
+               return;
+
+       DEBUG(6,("accepted socket %d\n", sock));
 
        /* Create new connection structure */
 
        if ((state = TALLOC_ZERO_P(NULL, struct winbindd_cli_state)) == NULL) {
-               close(accepted_sock);
+               close(sock);
                return;
        }
 
-       state->sock = accepted_sock;
+       state->sock = sock;
 
        state->out_queue = tevent_queue_create(state, "winbind client reply");
        if (state->out_queue == NULL) {
-               close(accepted_sock);
+               close(sock);
                TALLOC_FREE(state);
                return;
        }
@@ -792,40 +809,16 @@ void winbindd_accepted_new_connection(int accepted_sock, bool privileged)
                               WINBINDD_MAX_EXTRA_DATA);
        if (req == NULL) {
                TALLOC_FREE(state);
-               close(accepted_sock);
+               close(sock);
                return;
        }
        tevent_req_set_callback(req, winbind_client_request_read, state);
 
        /* Add to connection list */
 
-       /* Once the client is added here, we can be sure something will close it eventually */
        winbindd_add_client(state);
 }
 
-static void new_connection(int listen_sock, bool privileged)
-{
-       struct sockaddr_un sunaddr;
-       socklen_t len;
-       int sock;
-
-       /* Accept connection */
-
-       len = sizeof(sunaddr);
-
-       do {
-               sock = accept(listen_sock, (struct sockaddr *)(void *)&sunaddr,
-                             &len);
-       } while (sock == -1 && errno == EINTR);
-
-       if (sock == -1)
-               return;
-
-       DEBUG(6,("accepted socket %d\n", sock));
-
-       winbindd_accepted_new_connection(sock, privileged);
-}
-
 static void winbind_client_request_read(struct tevent_req *req)
 {
        struct winbindd_cli_state *state = tevent_req_callback_data(
index 8ebbb2a842ccc7a0cb5c6c4ec6844a819cbddd58..1b086734bce7823e1c09e16fc84a163f63cc3871 100644 (file)
@@ -44,7 +44,6 @@ void debug_unix_user_token(int dbg_class, int dbg_lev, uid_t uid, gid_t gid,
 struct event_context *winbind_event_context(void);
 
 /* The following definitions come from winbindd/winbindd.c  */
-void winbindd_accepted_new_connection(int accepted_sock, bool privileged);
 struct messaging_context *winbind_messaging_context(void);
 void request_error(struct winbindd_cli_state *state);
 void request_ok(struct winbindd_cli_state *state);