Got ready to implement Martin's idea, but request doesn't have a length
authorJeremy Allison <jra@samba.org>
Wed, 14 Nov 2001 20:02:02 +0000 (20:02 +0000)
committerJeremy Allison <jra@samba.org>
Wed, 14 Nov 2001 20:02:02 +0000 (20:02 +0000)
field.... well, now at least the code is there when it does :-).
Jeremy.
(This used to be commit 22e323ca47325482b6ae527070509ed9c6cbccee)

source3/nsswitch/winbindd.c
source3/nsswitch/winbindd_nss.h

index b37fdb1a4f086abf2e55cd029b62d1cacf94f3e0..fb3309ec33e55f354095fc0d60e4628a41581d00 100644 (file)
@@ -602,7 +602,7 @@ static void process_loop(int accept_sock)
             
                        /* Process activity on client connections */
             
-                       for (state = client_list; state; state = state->next) {
+                       for (state = client_list; state; ) {
                 
                                /* Data available for reading */
                 
@@ -613,17 +613,29 @@ static void process_loop(int accept_sock)
                                        client_read(state);
 
 #if 0
-                                       /* If we have the start of a
+                                       /* JRA - currently there's no length field in the request... */
+                                       /* 
+                                        * If we have the start of a
                                         * packet, then check the
                                         * length field to make sure
                                         * the client's not talking
-                                        * Mock Swedish. */
+                                        * Mock Swedish.
+                                        */
+
                                        if (state->read_buf_len >= sizeof(int)
                                            && *(int *) state->buf != sizeof(state->request)) {
-                                               BORK_BORK_BORK();
+
+                                               struct winbindd_cli_state *rem_state = state;
+
+                                               DEBUG(0,("process_loop: Invalid request size (%d) send, should be (%d)\n",
+                                                               *(int *) rem_state->buf, sizeof(rem_state->request) ));
+
+                                               state = state_next;
+                                               remove_client(rem_state);
+                                               continue;
                                        }
 #endif
-                    
+
                                        /* A request packet might be 
                                           complete */
                     
@@ -631,6 +643,8 @@ static void process_loop(int accept_sock)
                                            sizeof(state->request)) {
                                                process_packet(state);
                                        }
+
+                                       state = state->next;
                                }
                 
                                /* Data available for writing */
index 20667b0a9bd273ce3eec07f5f345b611ff11b4ed..a99e3b3e1ff9c62002724b7713f27af1fc3540fe 100644 (file)
@@ -59,13 +59,13 @@ enum winbindd_cmd {
        /* PAM authenticate and password change */
 
        WINBINDD_PAM_AUTH,
-        WINBINDD_PAM_AUTH_CRAP,
+       WINBINDD_PAM_AUTH_CRAP,
        WINBINDD_PAM_CHAUTHTOK,
 
        /* List various things */
 
-        WINBINDD_LIST_USERS,         /* List w/o rid->id mapping */
-        WINBINDD_LIST_GROUPS,        /* Ditto */
+       WINBINDD_LIST_USERS,         /* List w/o rid->id mapping */
+       WINBINDD_LIST_GROUPS,        /* Ditto */
        WINBINDD_LIST_TRUSTDOM,
 
        /* SID conversion */
@@ -73,7 +73,7 @@ enum winbindd_cmd {
        WINBINDD_LOOKUPSID,
        WINBINDD_LOOKUPNAME,
 
-       /* S*RS functions */
+       /* Lookup functions */
 
        WINBINDD_SID_TO_UID,       
        WINBINDD_SID_TO_GID,
@@ -121,7 +121,7 @@ struct winbindd_request {
                fstring name;        /* lookupname */
                uint32 num_entries;  /* getpwent, getgrent */
        } data;
-        fstring domain;      /* {set,get,end}{pw,gr}ent() */
+       fstring domain;      /* {set,get,end}{pw,gr}ent() */
 };
 
 /* Response values */