From 5d97ab9df86af7004572f227f47bd74a0830833d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 14 Nov 2001 20:02:02 +0000 Subject: Got ready to implement Martin's idea, but request doesn't have a length field.... well, now at least the code is there when it does :-). Jeremy. (This used to be commit 22e323ca47325482b6ae527070509ed9c6cbccee) --- source3/nsswitch/winbindd.c | 24 +++++++++++++++++++----- source3/nsswitch/winbindd_nss.h | 10 +++++----- 2 files changed, 24 insertions(+), 10 deletions(-) (limited to 'source3/nsswitch') diff --git a/source3/nsswitch/winbindd.c b/source3/nsswitch/winbindd.c index b37fdb1a4f..fb3309ec33 100644 --- a/source3/nsswitch/winbindd.c +++ b/source3/nsswitch/winbindd.c @@ -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 */ diff --git a/source3/nsswitch/winbindd_nss.h b/source3/nsswitch/winbindd_nss.h index 20667b0a9b..a99e3b3e1f 100644 --- a/source3/nsswitch/winbindd_nss.h +++ b/source3/nsswitch/winbindd_nss.h @@ -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 */ -- cgit