mirror of
https://github.com/samba-team/samba.git
synced 2025-09-18 09:44:19 +03:00
Since AB has been changing the winbind interface it's time to add the "mock
swedish" test to client calls. This is putting a length field at the
start of a request so we can disconnect clients talking with an out of date
libnss_winbind.so rather than deadlock them.
Misc cleanups:
- made some int values uint32
- moved WINBIND_INTERFACE_VERSION to start of cmd list
(This used to be commit a4af65b9b9
)
This commit is contained in:
@@ -58,6 +58,8 @@ void init_request(struct winbindd_request *request, int request_type)
|
|||||||
static char *domain_env;
|
static char *domain_env;
|
||||||
static BOOL initialised;
|
static BOOL initialised;
|
||||||
|
|
||||||
|
request->length = sizeof(struct winbindd_request);
|
||||||
|
|
||||||
request->cmd = (enum winbindd_cmd)request_type;
|
request->cmd = (enum winbindd_cmd)request_type;
|
||||||
request->pid = getpid();
|
request->pid = getpid();
|
||||||
request->domain[0] = '\0';
|
request->domain[0] = '\0';
|
||||||
|
@@ -463,12 +463,14 @@ static void client_read(struct winbindd_cli_state *state)
|
|||||||
/* Read data */
|
/* Read data */
|
||||||
|
|
||||||
do {
|
do {
|
||||||
n = read(state->sock, state->read_buf_len + (char *)&state->request,
|
|
||||||
sizeof(state->request) - state->read_buf_len);
|
n = read(state->sock, state->read_buf_len +
|
||||||
|
(char *)&state->request,
|
||||||
|
sizeof(state->request) - state->read_buf_len);
|
||||||
|
|
||||||
} while (n == -1 && errno == EINTR);
|
} while (n == -1 && errno == EINTR);
|
||||||
|
|
||||||
DEBUG(10,("client_read: read %d bytes. Need %d more for a full request.\n", n,
|
DEBUG(10,("client_read: read %d bytes. Need %d more for a full request.\n", n, sizeof(state->request) - n - state->read_buf_len ));
|
||||||
sizeof(state->request) - n - state->read_buf_len ));
|
|
||||||
|
|
||||||
/* Read failed, kill client */
|
/* Read failed, kill client */
|
||||||
|
|
||||||
@@ -664,8 +666,6 @@ static void process_loop(int accept_sock)
|
|||||||
|
|
||||||
client_read(state);
|
client_read(state);
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* JRA - currently there's no length field in the request... */
|
|
||||||
/*
|
/*
|
||||||
* If we have the start of a
|
* If we have the start of a
|
||||||
* packet, then check the
|
* packet, then check the
|
||||||
@@ -674,19 +674,14 @@ static void process_loop(int accept_sock)
|
|||||||
* Mock Swedish.
|
* Mock Swedish.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (state->read_buf_len >= sizeof(int)
|
if (state->read_buf_len >= sizeof(uint32)
|
||||||
&& *(int *) state->buf != sizeof(state->request)) {
|
&& *(uint32 *) &state->request != sizeof(state->request)) {
|
||||||
|
|
||||||
struct winbindd_cli_state *rem_state = state;
|
|
||||||
|
|
||||||
DEBUG(0,("process_loop: Invalid request size (%d) send, should be (%d)\n",
|
DEBUG(0,("process_loop: Invalid request size (%d) send, should be (%d)\n",
|
||||||
*(int *) rem_state->buf, sizeof(rem_state->request) ));
|
*(uint32 *) &state->request, sizeof(state->request)));
|
||||||
|
|
||||||
state = state_next;
|
remove_client(state);
|
||||||
remove_client(rem_state);
|
break;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* A request packet might be
|
/* A request packet might be
|
||||||
complete */
|
complete */
|
||||||
|
@@ -35,13 +35,16 @@
|
|||||||
#define WINBINDD_DOMAIN_ENV "WINBINDD_DOMAIN" /* Environment variables */
|
#define WINBINDD_DOMAIN_ENV "WINBINDD_DOMAIN" /* Environment variables */
|
||||||
#define WINBINDD_DONT_ENV "_NO_WINBINDD"
|
#define WINBINDD_DONT_ENV "_NO_WINBINDD"
|
||||||
|
|
||||||
|
/* Update this when you change the interface. */
|
||||||
|
|
||||||
|
#define WINBIND_INTERFACE_VERSION 2
|
||||||
|
|
||||||
/* Socket commands */
|
/* Socket commands */
|
||||||
|
|
||||||
/* Update this when you change the interface. */
|
|
||||||
#define WINBIND_INTERFACE_VERSION 1
|
|
||||||
|
|
||||||
enum winbindd_cmd {
|
enum winbindd_cmd {
|
||||||
|
|
||||||
|
WINBINDD_INTERFACE_VERSION, /* Always a well known value */
|
||||||
|
|
||||||
/* Get users and groups */
|
/* Get users and groups */
|
||||||
|
|
||||||
WINBINDD_GETPWNAM,
|
WINBINDD_GETPWNAM,
|
||||||
@@ -88,7 +91,6 @@ enum winbindd_cmd {
|
|||||||
WINBINDD_CHECK_MACHACC, /* Check machine account pw works */
|
WINBINDD_CHECK_MACHACC, /* Check machine account pw works */
|
||||||
WINBINDD_PING, /* Just tell me winbind is running */
|
WINBINDD_PING, /* Just tell me winbind is running */
|
||||||
WINBINDD_INFO, /* Various bit of info. Currently just tidbits */
|
WINBINDD_INFO, /* Various bit of info. Currently just tidbits */
|
||||||
WINBINDD_INTERFACE_VERSION, /* *TRY* to keep this in the same place... */
|
|
||||||
|
|
||||||
/* Placeholder for end of cmd list */
|
/* Placeholder for end of cmd list */
|
||||||
|
|
||||||
@@ -98,6 +100,7 @@ enum winbindd_cmd {
|
|||||||
/* Winbind request structure */
|
/* Winbind request structure */
|
||||||
|
|
||||||
struct winbindd_request {
|
struct winbindd_request {
|
||||||
|
uint32 length;
|
||||||
enum winbindd_cmd cmd; /* Winbindd command to execute */
|
enum winbindd_cmd cmd; /* Winbindd command to execute */
|
||||||
pid_t pid; /* pid of calling process */
|
pid_t pid; /* pid of calling process */
|
||||||
|
|
||||||
@@ -144,7 +147,7 @@ struct winbindd_response {
|
|||||||
|
|
||||||
/* Header information */
|
/* Header information */
|
||||||
|
|
||||||
int length; /* Length of response */
|
uint32 length; /* Length of response */
|
||||||
enum winbindd_result result; /* Result code */
|
enum winbindd_result result; /* Result code */
|
||||||
|
|
||||||
/* Fixed length return data */
|
/* Fixed length return data */
|
||||||
|
Reference in New Issue
Block a user