mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
Make winbindd_cli_state->response a pointer instead of a struct member
Same comment as in baa6084378
: This is just a preparatory checkin.
Volker
This commit is contained in:
parent
90535b5fad
commit
97ba4f6efd
@ -531,10 +531,10 @@ static void process_request(struct winbindd_cli_state *state)
|
||||
struct winbindd_dispatch_table *table = dispatch_table;
|
||||
struct winbindd_async_dispatch_table *atable;
|
||||
|
||||
ZERO_STRUCT(state->response);
|
||||
ZERO_STRUCTP(state->response);
|
||||
|
||||
state->response.result = WINBINDD_PENDING;
|
||||
state->response.length = sizeof(struct winbindd_response);
|
||||
state->response->result = WINBINDD_PENDING;
|
||||
state->response->length = sizeof(struct winbindd_response);
|
||||
|
||||
state->mem_ctx = talloc_init("winbind request");
|
||||
if (state->mem_ctx == NULL)
|
||||
@ -599,9 +599,9 @@ static void wb_request_done(struct tevent_req *req)
|
||||
DEBUG(10, ("returning %s\n", nt_errstr(status)));
|
||||
request_error(state);
|
||||
}
|
||||
state->response = *response;
|
||||
state->response.result = WINBINDD_PENDING;
|
||||
state->response.length = sizeof(struct winbindd_response);
|
||||
state->response = response;
|
||||
state->response->result = WINBINDD_PENDING;
|
||||
state->response->length = sizeof(struct winbindd_response);
|
||||
request_ok(state);
|
||||
}
|
||||
|
||||
@ -628,7 +628,7 @@ static void request_finished(struct winbindd_cli_state *state)
|
||||
|
||||
req = wb_resp_write_send(state, winbind_event_context(),
|
||||
state->out_queue, state->sock,
|
||||
&state->response);
|
||||
state->response);
|
||||
if (req == NULL) {
|
||||
remove_client(state);
|
||||
return;
|
||||
@ -665,15 +665,15 @@ static void winbind_client_response_written(struct tevent_req *req)
|
||||
|
||||
void request_error(struct winbindd_cli_state *state)
|
||||
{
|
||||
SMB_ASSERT(state->response.result == WINBINDD_PENDING);
|
||||
state->response.result = WINBINDD_ERROR;
|
||||
SMB_ASSERT(state->response->result == WINBINDD_PENDING);
|
||||
state->response->result = WINBINDD_ERROR;
|
||||
request_finished(state);
|
||||
}
|
||||
|
||||
void request_ok(struct winbindd_cli_state *state)
|
||||
{
|
||||
SMB_ASSERT(state->response.result == WINBINDD_PENDING);
|
||||
state->response.result = WINBINDD_OK;
|
||||
SMB_ASSERT(state->response->result == WINBINDD_PENDING);
|
||||
state->response->result = WINBINDD_OK;
|
||||
request_finished(state);
|
||||
}
|
||||
|
||||
@ -709,6 +709,7 @@ static void new_connection(int listen_sock, bool privileged)
|
||||
}
|
||||
|
||||
state->sock = sock;
|
||||
state->response = &state->_response;
|
||||
|
||||
state->out_queue = tevent_queue_create(state, "winbind client reply");
|
||||
if (state->out_queue == NULL) {
|
||||
@ -804,7 +805,7 @@ static bool remove_idle_client(void)
|
||||
int nidle = 0;
|
||||
|
||||
for (state = winbindd_client_list(); state; state = state->next) {
|
||||
if (state->response.result != WINBINDD_PENDING &&
|
||||
if (state->response->result != WINBINDD_PENDING &&
|
||||
!state->getpwent_state && !state->getgrent_state) {
|
||||
nidle++;
|
||||
if (!last_access || state->last_access < last_access) {
|
||||
|
@ -60,7 +60,8 @@ struct winbindd_cli_state {
|
||||
struct winbindd_request *request; /* Request from client */
|
||||
struct winbindd_request _request;
|
||||
struct tevent_queue *out_queue;
|
||||
struct winbindd_response response; /* Respose to client */
|
||||
struct winbindd_response *response;
|
||||
struct winbindd_response _response; /* Respose to client */
|
||||
bool getpwent_initialized; /* Has getpwent_state been
|
||||
* initialized? */
|
||||
bool getgrent_initialized; /* Has getgrent_state been
|
||||
|
@ -255,9 +255,9 @@ enum winbindd_result winbindd_dual_lookupsid(struct winbindd_domain *domain,
|
||||
return WINBINDD_ERROR;
|
||||
}
|
||||
|
||||
fstrcpy(state->response.data.name.dom_name, dom_name);
|
||||
fstrcpy(state->response.data.name.name, name);
|
||||
state->response.data.name.type = type;
|
||||
fstrcpy(state->response->data.name.dom_name, dom_name);
|
||||
fstrcpy(state->response->data.name.name, name);
|
||||
state->response->data.name.type = type;
|
||||
|
||||
TALLOC_FREE(dom_name);
|
||||
TALLOC_FREE(name);
|
||||
@ -447,8 +447,8 @@ enum winbindd_result winbindd_dual_lookupname(struct winbindd_domain *domain,
|
||||
return WINBINDD_ERROR;
|
||||
}
|
||||
|
||||
sid_to_fstring(state->response.data.sid.sid, &sid);
|
||||
state->response.data.sid.type = type;
|
||||
sid_to_fstring(state->response->data.sid.sid, &sid);
|
||||
state->response->data.sid.type = type;
|
||||
|
||||
return WINBINDD_OK;
|
||||
}
|
||||
@ -501,7 +501,7 @@ enum winbindd_result winbindd_dual_list_users(struct winbindd_domain *domain,
|
||||
uint32_t extra_data_len = 0, i;
|
||||
|
||||
/* Must copy domain into response first for debugging in parent */
|
||||
fstrcpy(state->response.data.name.dom_name, domain->name);
|
||||
fstrcpy(state->response->data.name.dom_name, domain->name);
|
||||
|
||||
/* Query user info */
|
||||
methods = domain->methods;
|
||||
@ -545,8 +545,8 @@ enum winbindd_result winbindd_dual_list_users(struct winbindd_domain *domain,
|
||||
if (extra_data) {
|
||||
/* remove trailing ',' */
|
||||
extra_data[extra_data_len - 1] = '\0';
|
||||
state->response.extra_data.data = extra_data;
|
||||
state->response.length += extra_data_len;
|
||||
state->response->extra_data.data = extra_data;
|
||||
state->response->length += extra_data_len;
|
||||
}
|
||||
|
||||
return WINBINDD_OK;
|
||||
@ -562,7 +562,7 @@ enum winbindd_result winbindd_dual_list_groups(struct winbindd_domain *domain,
|
||||
ZERO_STRUCT(groups);
|
||||
|
||||
/* Must copy domain into response first for debugging in parent */
|
||||
fstrcpy(state->response.data.name.dom_name, domain->name);
|
||||
fstrcpy(state->response->data.name.dom_name, domain->name);
|
||||
fstrcpy(groups.domain_name, domain->name);
|
||||
|
||||
/* Get list of sam groups */
|
||||
@ -603,8 +603,8 @@ enum winbindd_result winbindd_dual_list_groups(struct winbindd_domain *domain,
|
||||
if (extra_data) {
|
||||
/* remove trailing ',' */
|
||||
extra_data[extra_data_len - 1] = '\0';
|
||||
state->response.extra_data.data = extra_data;
|
||||
state->response.length += extra_data_len;
|
||||
state->response->extra_data.data = extra_data;
|
||||
state->response->length += extra_data_len;
|
||||
}
|
||||
|
||||
return WINBINDD_OK;
|
||||
@ -734,11 +734,11 @@ enum winbindd_result winbindd_dual_lookuprids(struct winbindd_domain *domain,
|
||||
"%d %s\n", types[i], names[i]);
|
||||
}
|
||||
|
||||
fstrcpy(state->response.data.domain_name, domain_name);
|
||||
fstrcpy(state->response->data.domain_name, domain_name);
|
||||
|
||||
if (result != NULL) {
|
||||
state->response.extra_data.data = result;
|
||||
state->response.length += len+1;
|
||||
state->response->extra_data.data = result;
|
||||
state->response->length += len+1;
|
||||
}
|
||||
|
||||
return WINBINDD_OK;
|
||||
|
@ -246,7 +246,7 @@ enum winbindd_result winbindd_dual_ccache_ntlm_auth(struct winbindd_domain *doma
|
||||
if (initial_blob_len == 0 && challenge_blob_len == 0) {
|
||||
/* this is just a probe to see if credentials are available. */
|
||||
result = NT_STATUS_OK;
|
||||
state->response.data.ccache_ntlm_auth.auth_blob_len = 0;
|
||||
state->response->data.ccache_ntlm_auth.auth_blob_len = 0;
|
||||
goto process_result;
|
||||
}
|
||||
|
||||
@ -269,14 +269,14 @@ enum winbindd_result winbindd_dual_ccache_ntlm_auth(struct winbindd_domain *doma
|
||||
goto process_result;
|
||||
}
|
||||
|
||||
state->response.extra_data.data = talloc_memdup(
|
||||
state->response->extra_data.data = talloc_memdup(
|
||||
state->mem_ctx, auth.data, auth.length);
|
||||
if (!state->response.extra_data.data) {
|
||||
if (!state->response->extra_data.data) {
|
||||
result = NT_STATUS_NO_MEMORY;
|
||||
goto process_result;
|
||||
}
|
||||
state->response.length += auth.length;
|
||||
state->response.data.ccache_ntlm_auth.auth_blob_len = auth.length;
|
||||
state->response->length += auth.length;
|
||||
state->response->data.ccache_ntlm_auth.auth_blob_len = auth.length;
|
||||
|
||||
data_blob_free(&auth);
|
||||
|
||||
|
@ -516,13 +516,13 @@ static void recvfrom_child(void *private_data_data, bool success)
|
||||
{
|
||||
struct winbindd_cli_state *state =
|
||||
talloc_get_type_abort(private_data_data, struct winbindd_cli_state);
|
||||
enum winbindd_result result = state->response.result;
|
||||
enum winbindd_result result = state->response->result;
|
||||
|
||||
/* This is an optimization: The child has written directly to the
|
||||
* response buffer. The request itself is still in pending state,
|
||||
* state that in the result code. */
|
||||
|
||||
state->response.result = WINBINDD_PENDING;
|
||||
state->response->result = WINBINDD_PENDING;
|
||||
|
||||
if ((!success) || (result != WINBINDD_OK)) {
|
||||
request_error(state);
|
||||
@ -536,14 +536,14 @@ void sendto_child(struct winbindd_cli_state *state,
|
||||
struct winbindd_child *child)
|
||||
{
|
||||
async_request(state->mem_ctx, child, state->request,
|
||||
&state->response, recvfrom_child, state);
|
||||
state->response, recvfrom_child, state);
|
||||
}
|
||||
|
||||
void sendto_domain(struct winbindd_cli_state *state,
|
||||
struct winbindd_domain *domain)
|
||||
{
|
||||
async_domain_request(state->mem_ctx, domain,
|
||||
state->request, &state->response,
|
||||
state->request, state->response,
|
||||
recvfrom_child, state);
|
||||
}
|
||||
|
||||
@ -556,8 +556,8 @@ static void child_process_request(struct winbindd_child *child,
|
||||
/* Free response data - we may be interrupted and receive another
|
||||
command before being able to send this data off. */
|
||||
|
||||
state->response.result = WINBINDD_ERROR;
|
||||
state->response.length = sizeof(struct winbindd_response);
|
||||
state->response->result = WINBINDD_ERROR;
|
||||
state->response->length = sizeof(struct winbindd_response);
|
||||
|
||||
/* as all requests in the child are sync, we can use talloc_tos() */
|
||||
state->mem_ctx = talloc_tos();
|
||||
@ -568,14 +568,14 @@ static void child_process_request(struct winbindd_child *child,
|
||||
if (state->request->cmd == table->struct_cmd) {
|
||||
DEBUG(10,("child_process_request: request fn %s\n",
|
||||
table->name));
|
||||
state->response.result = table->struct_fn(domain, state);
|
||||
state->response->result = table->struct_fn(domain, state);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG(1 ,("child_process_request: unknown request fn number %d\n",
|
||||
(int)state->request->cmd));
|
||||
state->response.result = WINBINDD_ERROR;
|
||||
state->response->result = WINBINDD_ERROR;
|
||||
}
|
||||
|
||||
void setup_child(struct winbindd_child *child,
|
||||
@ -1334,6 +1334,7 @@ static bool fork_domain_child(struct winbindd_child *child)
|
||||
ZERO_STRUCT(state);
|
||||
state.pid = sys_getpid();
|
||||
state.request = &state._request;
|
||||
state.response = &state._response;
|
||||
|
||||
child->pid = sys_fork();
|
||||
|
||||
@ -1525,7 +1526,7 @@ static bool fork_domain_child(struct winbindd_child *child)
|
||||
|
||||
DEBUG(4,("child daemon request %d\n", (int)state.request->cmd));
|
||||
|
||||
ZERO_STRUCT(state.response);
|
||||
ZERO_STRUCTP(state.response);
|
||||
state.request->null_term = '\0';
|
||||
child_process_request(child, &state);
|
||||
|
||||
@ -1534,22 +1535,22 @@ static bool fork_domain_child(struct winbindd_child *child)
|
||||
|
||||
SAFE_FREE(state.request->extra_data.data);
|
||||
|
||||
iov[0].iov_base = (void *)&state.response;
|
||||
iov[0].iov_base = (void *)state.response;
|
||||
iov[0].iov_len = sizeof(struct winbindd_response);
|
||||
iov_count = 1;
|
||||
|
||||
if (state.response.length > sizeof(struct winbindd_response)) {
|
||||
if (state.response->length > sizeof(struct winbindd_response)) {
|
||||
iov[1].iov_base =
|
||||
(void *)state.response.extra_data.data;
|
||||
iov[1].iov_len = state.response.length-iov[0].iov_len;
|
||||
(void *)state.response->extra_data.data;
|
||||
iov[1].iov_len = state.response->length-iov[0].iov_len;
|
||||
iov_count = 2;
|
||||
}
|
||||
|
||||
DEBUG(10, ("Writing %d bytes to parent\n",
|
||||
(int)state.response.length));
|
||||
(int)state.response->length));
|
||||
|
||||
if (write_data_iov(state.sock, iov, iov_count) !=
|
||||
state.response.length) {
|
||||
state.response->length) {
|
||||
DEBUG(0, ("Could not write result\n"));
|
||||
exit(1);
|
||||
}
|
||||
|
@ -888,7 +888,7 @@ static void getgrsid_sid2gid_recv(void *private_data, bool success, gid_t gid)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!fill_grent(s->state->mem_ctx, &s->state->response.data.gr,
|
||||
if (!fill_grent(s->state->mem_ctx, &s->state->response->data.gr,
|
||||
dom_name, group_name, gid) ||
|
||||
!fill_grent_mem(domain, s->state, &s->group_sid, s->group_type,
|
||||
&num_gr_mem, &gr_mem, &gr_mem_len))
|
||||
@ -897,16 +897,16 @@ static void getgrsid_sid2gid_recv(void *private_data, bool success, gid_t gid)
|
||||
return;
|
||||
}
|
||||
|
||||
s->state->response.data.gr.num_gr_mem = (uint32)num_gr_mem;
|
||||
s->state->response->data.gr.num_gr_mem = (uint32)num_gr_mem;
|
||||
|
||||
/* Group membership lives at start of extra data */
|
||||
|
||||
s->state->response.data.gr.gr_mem_ofs = 0;
|
||||
s->state->response->data.gr.gr_mem_ofs = 0;
|
||||
|
||||
s->state->response.length += gr_mem_len;
|
||||
s->state->response.extra_data.data = talloc_memdup(
|
||||
s->state->response->length += gr_mem_len;
|
||||
s->state->response->extra_data.data = talloc_memdup(
|
||||
s->state->mem_ctx, gr_mem, gr_mem_len);
|
||||
if (s->state->response.extra_data.data == NULL) {
|
||||
if (s->state->response->extra_data.data == NULL) {
|
||||
request_error(s->state);
|
||||
return;
|
||||
}
|
||||
@ -1308,9 +1308,9 @@ void winbindd_getgrent(struct winbindd_cli_state *state)
|
||||
request_error(state);
|
||||
return;
|
||||
}
|
||||
state->response.extra_data.data = group_list;
|
||||
state->response->extra_data.data = group_list;
|
||||
|
||||
state->response.data.num_entries = 0;
|
||||
state->response->data.num_entries = 0;
|
||||
|
||||
if (!state->getgrent_initialized)
|
||||
winbindd_setgrent_internal(state);
|
||||
@ -1481,12 +1481,12 @@ void winbindd_getgrent(struct winbindd_cli_state *state)
|
||||
if (result) {
|
||||
|
||||
DEBUG(10, ("adding group num_entries = %d\n",
|
||||
state->response.data.num_entries));
|
||||
state->response->data.num_entries));
|
||||
|
||||
group_list_ndx++;
|
||||
state->response.data.num_entries++;
|
||||
state->response->data.num_entries++;
|
||||
|
||||
state->response.length +=
|
||||
state->response->length +=
|
||||
sizeof(struct winbindd_gr);
|
||||
|
||||
} else {
|
||||
@ -1500,11 +1500,11 @@ void winbindd_getgrent(struct winbindd_cli_state *state)
|
||||
if (group_list_ndx == 0)
|
||||
goto done;
|
||||
|
||||
state->response.extra_data.data = talloc_realloc_size(
|
||||
state->mem_ctx, state->response.extra_data.data,
|
||||
state->response->extra_data.data = talloc_realloc_size(
|
||||
state->mem_ctx, state->response->extra_data.data,
|
||||
group_list_ndx * sizeof(struct winbindd_gr) + gr_mem_list_len);
|
||||
|
||||
if (!state->response.extra_data.data) {
|
||||
if (!state->response->extra_data.data) {
|
||||
DEBUG(0, ("out of memory\n"));
|
||||
group_list_ndx = 0;
|
||||
SAFE_FREE(gr_mem_list);
|
||||
@ -1512,11 +1512,11 @@ void winbindd_getgrent(struct winbindd_cli_state *state)
|
||||
return;
|
||||
}
|
||||
|
||||
memcpy(&((char *)state->response.extra_data.data)
|
||||
memcpy(&((char *)state->response->extra_data.data)
|
||||
[group_list_ndx * sizeof(struct winbindd_gr)],
|
||||
gr_mem_list, gr_mem_list_len);
|
||||
|
||||
state->response.length += gr_mem_list_len;
|
||||
state->response->length += gr_mem_list_len;
|
||||
|
||||
DEBUG(10, ("returning %d groups, length = %d\n",
|
||||
group_list_ndx, gr_mem_list_len));
|
||||
@ -1724,10 +1724,10 @@ static void getgroups_sid2gid_recv(void *private_data, bool success, gid_t gid)
|
||||
return;
|
||||
}
|
||||
|
||||
s->state->response.data.num_entries = s->num_token_gids;
|
||||
s->state->response->data.num_entries = s->num_token_gids;
|
||||
if (s->num_token_gids) {
|
||||
s->state->response.extra_data.data = s->token_gids;
|
||||
s->state->response.length += s->num_token_gids * sizeof(gid_t);
|
||||
s->state->response->extra_data.data = s->token_gids;
|
||||
s->state->response->length += s->num_token_gids * sizeof(gid_t);
|
||||
}
|
||||
request_ok(s->state);
|
||||
}
|
||||
@ -1809,9 +1809,9 @@ static void getusersids_recv(void *private_data, bool success, DOM_SID *sids,
|
||||
}
|
||||
|
||||
/* Send data back to client */
|
||||
state->response.data.num_entries = num_sids;
|
||||
state->response.extra_data.data = ret;
|
||||
state->response.length += ret_size;
|
||||
state->response->data.num_entries = num_sids;
|
||||
state->response->extra_data.data = ret;
|
||||
state->response->length += ret_size;
|
||||
request_ok(state);
|
||||
}
|
||||
|
||||
@ -1868,8 +1868,8 @@ enum winbindd_result winbindd_dual_getuserdomgroups(struct winbindd_domain *doma
|
||||
return WINBINDD_ERROR;
|
||||
|
||||
if (num_groups == 0) {
|
||||
state->response.data.num_entries = 0;
|
||||
state->response.extra_data.data = NULL;
|
||||
state->response->data.num_entries = 0;
|
||||
state->response->extra_data.data = NULL;
|
||||
return WINBINDD_OK;
|
||||
}
|
||||
|
||||
@ -1880,9 +1880,9 @@ enum winbindd_result winbindd_dual_getuserdomgroups(struct winbindd_domain *doma
|
||||
return WINBINDD_ERROR;
|
||||
}
|
||||
|
||||
state->response.extra_data.data = sidstring;
|
||||
state->response.length += len+1;
|
||||
state->response.data.num_entries = num_groups;
|
||||
state->response->extra_data.data = sidstring;
|
||||
state->response->length += len+1;
|
||||
state->response->data.num_entries = num_groups;
|
||||
|
||||
return WINBINDD_OK;
|
||||
}
|
||||
@ -1979,18 +1979,18 @@ enum winbindd_result winbindd_dual_getsidaliases(struct winbindd_domain *domain,
|
||||
|
||||
if (!print_sidlist(state->mem_ctx, sids, num_sids, &sidstr, &len)) {
|
||||
DEBUG(0, ("Could not print_sidlist\n"));
|
||||
state->response.extra_data.data = NULL;
|
||||
state->response->extra_data.data = NULL;
|
||||
return WINBINDD_ERROR;
|
||||
}
|
||||
|
||||
state->response.extra_data.data = NULL;
|
||||
state->response->extra_data.data = NULL;
|
||||
|
||||
if (sidstr) {
|
||||
state->response.extra_data.data = sidstr;
|
||||
state->response->extra_data.data = sidstr;
|
||||
DEBUG(10, ("aliases_list: %s\n",
|
||||
(char *)state->response.extra_data.data));
|
||||
state->response.length += len+1;
|
||||
state->response.data.num_entries = num_sids;
|
||||
(char *)state->response->extra_data.data));
|
||||
state->response->length += len+1;
|
||||
state->response->data.num_entries = num_sids;
|
||||
}
|
||||
|
||||
return WINBINDD_OK;
|
||||
|
@ -299,11 +299,11 @@ enum winbindd_result winbindd_dual_sid2uid(struct winbindd_domain *domain,
|
||||
}
|
||||
|
||||
result = idmap_sid_to_uid(state->request->domain_name, &sid,
|
||||
&state->response.data.uid);
|
||||
&state->response->data.uid);
|
||||
|
||||
DEBUG(10, ("winbindd_dual_sid2uid: 0x%08x - %s - %u\n",
|
||||
NT_STATUS_V(result), sid_string_dbg(&sid),
|
||||
(unsigned int)state->response.data.uid));
|
||||
(unsigned int)state->response->data.uid));
|
||||
|
||||
return NT_STATUS_IS_OK(result) ? WINBINDD_OK : WINBINDD_ERROR;
|
||||
}
|
||||
@ -372,11 +372,11 @@ enum winbindd_result winbindd_dual_sid2gid(struct winbindd_domain *domain,
|
||||
/* Find gid for this sid and return it, possibly ask the slow remote idmap */
|
||||
|
||||
result = idmap_sid_to_gid(state->request->domain_name, &sid,
|
||||
&state->response.data.gid);
|
||||
&state->response->data.gid);
|
||||
|
||||
DEBUG(10, ("winbindd_dual_sid2gid: 0x%08x - %s - %u\n",
|
||||
NT_STATUS_V(result), sid_string_dbg(&sid),
|
||||
(unsigned int)state->response.data.gid));
|
||||
(unsigned int)state->response->data.gid));
|
||||
|
||||
return NT_STATUS_IS_OK(result) ? WINBINDD_OK : WINBINDD_ERROR;
|
||||
}
|
||||
@ -444,8 +444,8 @@ enum winbindd_result winbindd_dual_uid2sid(struct winbindd_domain *domain,
|
||||
state->request->data.uid);
|
||||
|
||||
if (NT_STATUS_IS_OK(result)) {
|
||||
sid_to_fstring(state->response.data.sid.sid, &sid);
|
||||
state->response.data.sid.type = SID_NAME_USER;
|
||||
sid_to_fstring(state->response->data.sid.sid, &sid);
|
||||
state->response->data.sid.type = SID_NAME_USER;
|
||||
return WINBINDD_OK;
|
||||
}
|
||||
|
||||
@ -512,11 +512,11 @@ enum winbindd_result winbindd_dual_gid2sid(struct winbindd_domain *domain,
|
||||
state->request->data.gid);
|
||||
|
||||
if (NT_STATUS_IS_OK(result)) {
|
||||
sid_to_fstring(state->response.data.sid.sid, &sid);
|
||||
sid_to_fstring(state->response->data.sid.sid, &sid);
|
||||
DEBUG(10, ("[%5lu]: retrieved sid: %s\n",
|
||||
(unsigned long)state->pid,
|
||||
state->response.data.sid.sid));
|
||||
state->response.data.sid.type = SID_NAME_DOM_GRP;
|
||||
state->response->data.sid.sid));
|
||||
state->response->data.sid.type = SID_NAME_DOM_GRP;
|
||||
return WINBINDD_OK;
|
||||
}
|
||||
|
||||
|
@ -142,15 +142,15 @@ static enum winbindd_result dual_dsgetdcname(struct winbindd_domain *domain,
|
||||
return WINBINDD_ERROR;
|
||||
}
|
||||
|
||||
fstrcpy(state->response.data.dsgetdcname.dc_unc, info->dc_unc);
|
||||
fstrcpy(state->response.data.dsgetdcname.dc_address, info->dc_address);
|
||||
state->response.data.dsgetdcname.dc_address_type = info->dc_address_type;
|
||||
fstrcpy(state->response.data.dsgetdcname.domain_guid, guid_str);
|
||||
fstrcpy(state->response.data.dsgetdcname.domain_name, info->domain_name);
|
||||
fstrcpy(state->response.data.dsgetdcname.forest_name, info->forest_name);
|
||||
state->response.data.dsgetdcname.dc_flags = info->dc_flags;
|
||||
fstrcpy(state->response.data.dsgetdcname.dc_site_name, info->dc_site_name);
|
||||
fstrcpy(state->response.data.dsgetdcname.client_site_name, info->client_site_name);
|
||||
fstrcpy(state->response->data.dsgetdcname.dc_unc, info->dc_unc);
|
||||
fstrcpy(state->response->data.dsgetdcname.dc_address, info->dc_address);
|
||||
state->response->data.dsgetdcname.dc_address_type = info->dc_address_type;
|
||||
fstrcpy(state->response->data.dsgetdcname.domain_guid, guid_str);
|
||||
fstrcpy(state->response->data.dsgetdcname.domain_name, info->domain_name);
|
||||
fstrcpy(state->response->data.dsgetdcname.forest_name, info->forest_name);
|
||||
state->response->data.dsgetdcname.dc_flags = info->dc_flags;
|
||||
fstrcpy(state->response->data.dsgetdcname.dc_site_name, info->dc_site_name);
|
||||
fstrcpy(state->response->data.dsgetdcname.client_site_name, info->client_site_name);
|
||||
|
||||
return WINBINDD_OK;
|
||||
}
|
||||
|
@ -86,10 +86,10 @@ enum winbindd_result winbindd_dual_check_machine_acct(struct winbindd_domain *do
|
||||
"good" : "bad"));
|
||||
|
||||
done:
|
||||
set_auth_errors(&state->response, result);
|
||||
set_auth_errors(state->response, result);
|
||||
|
||||
DEBUG(NT_STATUS_IS_OK(result) ? 5 : 2, ("Checking the trust account password returned %s\n",
|
||||
state->response.data.auth.nt_status_string));
|
||||
state->response->data.auth.nt_status_string));
|
||||
|
||||
return NT_STATUS_IS_OK(result) ? WINBINDD_OK : WINBINDD_ERROR;
|
||||
}
|
||||
@ -209,8 +209,8 @@ static void listent_recv(void *private_data, bool success, fstring dom_name,
|
||||
|
||||
/* Return list of all users/groups to the client */
|
||||
if (state->extra_data) {
|
||||
state->cli_state->response.extra_data.data = state->extra_data;
|
||||
state->cli_state->response.length += state->extra_data_len;
|
||||
state->cli_state->response->extra_data.data = state->extra_data;
|
||||
state->cli_state->response->length += state->extra_data_len;
|
||||
}
|
||||
|
||||
request_ok(state->cli_state);
|
||||
@ -333,8 +333,8 @@ void winbindd_list_trusted_domains(struct winbindd_cli_state *state)
|
||||
}
|
||||
|
||||
if (extra_data_len > 0) {
|
||||
state->response.extra_data.data = extra_data;
|
||||
state->response.length += extra_data_len+1;
|
||||
state->response->extra_data.data = extra_data;
|
||||
state->response->length += extra_data_len+1;
|
||||
}
|
||||
|
||||
request_ok(state);
|
||||
@ -407,8 +407,8 @@ enum winbindd_result winbindd_dual_list_trusted_domains(struct winbindd_domain *
|
||||
}
|
||||
|
||||
if (extra_data_len > 0) {
|
||||
state->response.extra_data.data = extra_data;
|
||||
state->response.length += extra_data_len+1;
|
||||
state->response->extra_data.data = extra_data;
|
||||
state->response->length += extra_data_len+1;
|
||||
}
|
||||
|
||||
return WINBINDD_OK;
|
||||
@ -426,7 +426,7 @@ void winbindd_getdcname(struct winbindd_cli_state *state)
|
||||
|
||||
domain = find_domain_from_name_noinit(state->request->domain_name);
|
||||
if (domain && domain->internal) {
|
||||
fstrcpy(state->response.data.dc_name, global_myname());
|
||||
fstrcpy(state->response->data.dc_name, global_myname());
|
||||
request_ok(state);
|
||||
return;
|
||||
}
|
||||
@ -502,7 +502,7 @@ enum winbindd_result winbindd_dual_getdcname(struct winbindd_domain *domain,
|
||||
p+=1;
|
||||
}
|
||||
|
||||
fstrcpy(state->response.data.dc_name, p);
|
||||
fstrcpy(state->response->data.dc_name, p);
|
||||
return WINBINDD_OK;
|
||||
}
|
||||
|
||||
@ -602,10 +602,10 @@ static void sequence_recv(void *private_data, bool success)
|
||||
|
||||
if (state->domain == NULL) {
|
||||
struct winbindd_cli_state *cli_state = state->cli_state;
|
||||
cli_state->response.length =
|
||||
sizeof(cli_state->response) +
|
||||
cli_state->response->length =
|
||||
sizeof(struct winbindd_response) +
|
||||
strlen(state->extra_data) + 1;
|
||||
cli_state->response.extra_data.data = state->extra_data;
|
||||
cli_state->response->extra_data.data = state->extra_data;
|
||||
request_ok(cli_state);
|
||||
return;
|
||||
}
|
||||
@ -630,7 +630,7 @@ enum winbindd_result winbindd_dual_show_sequence(struct winbindd_domain *domain,
|
||||
|
||||
domain->methods->sequence_number(domain, &domain->sequence_number);
|
||||
|
||||
state->response.data.sequence_number =
|
||||
state->response->data.sequence_number =
|
||||
domain->sequence_number;
|
||||
|
||||
return WINBINDD_OK;
|
||||
@ -663,17 +663,17 @@ void winbindd_domain_info(struct winbindd_cli_state *cli)
|
||||
}
|
||||
|
||||
if (domain->initialized) {
|
||||
fstrcpy(cli->response.data.domain_info.name,
|
||||
fstrcpy(cli->response->data.domain_info.name,
|
||||
domain->name);
|
||||
fstrcpy(cli->response.data.domain_info.alt_name,
|
||||
fstrcpy(cli->response->data.domain_info.alt_name,
|
||||
domain->alt_name);
|
||||
sid_to_fstring(cli->response.data.domain_info.sid,
|
||||
sid_to_fstring(cli->response->data.domain_info.sid,
|
||||
&domain->sid);
|
||||
cli->response.data.domain_info.native_mode =
|
||||
cli->response->data.domain_info.native_mode =
|
||||
domain->native_mode;
|
||||
cli->response.data.domain_info.active_directory =
|
||||
cli->response->data.domain_info.active_directory =
|
||||
domain->active_directory;
|
||||
cli->response.data.domain_info.primary =
|
||||
cli->response->data.domain_info.primary =
|
||||
domain->primary;
|
||||
request_ok(cli);
|
||||
return;
|
||||
@ -724,18 +724,18 @@ static void domain_info_done(struct tevent_req *req)
|
||||
return;
|
||||
}
|
||||
|
||||
fstrcpy(state->cli->response.data.domain_info.name,
|
||||
fstrcpy(state->cli->response->data.domain_info.name,
|
||||
state->domain->name);
|
||||
fstrcpy(state->cli->response.data.domain_info.alt_name,
|
||||
fstrcpy(state->cli->response->data.domain_info.alt_name,
|
||||
state->domain->alt_name);
|
||||
sid_to_fstring(state->cli->response.data.domain_info.sid,
|
||||
sid_to_fstring(state->cli->response->data.domain_info.sid,
|
||||
&state->domain->sid);
|
||||
|
||||
state->cli->response.data.domain_info.native_mode =
|
||||
state->cli->response->data.domain_info.native_mode =
|
||||
state->domain->native_mode;
|
||||
state->cli->response.data.domain_info.active_directory =
|
||||
state->cli->response->data.domain_info.active_directory =
|
||||
state->domain->active_directory;
|
||||
state->cli->response.data.domain_info.primary =
|
||||
state->cli->response->data.domain_info.primary =
|
||||
state->domain->primary;
|
||||
|
||||
request_ok(state->cli);
|
||||
@ -754,8 +754,8 @@ void winbindd_info(struct winbindd_cli_state *state)
|
||||
|
||||
DEBUG(3, ("[%5lu]: request misc info\n", (unsigned long)state->pid));
|
||||
|
||||
state->response.data.info.winbind_separator = *lp_winbind_separator();
|
||||
fstrcpy(state->response.data.info.samba_version, samba_version_string());
|
||||
state->response->data.info.winbind_separator = *lp_winbind_separator();
|
||||
fstrcpy(state->response->data.info.samba_version, samba_version_string());
|
||||
request_ok(state);
|
||||
}
|
||||
|
||||
@ -766,7 +766,7 @@ void winbindd_interface_version(struct winbindd_cli_state *state)
|
||||
DEBUG(3, ("[%5lu]: request interface version\n",
|
||||
(unsigned long)state->pid));
|
||||
|
||||
state->response.data.interface_version = WINBIND_INTERFACE_VERSION;
|
||||
state->response->data.interface_version = WINBIND_INTERFACE_VERSION;
|
||||
request_ok(state);
|
||||
}
|
||||
|
||||
@ -776,7 +776,7 @@ void winbindd_domain_name(struct winbindd_cli_state *state)
|
||||
{
|
||||
DEBUG(3, ("[%5lu]: request domain name\n", (unsigned long)state->pid));
|
||||
|
||||
fstrcpy(state->response.data.domain_name, lp_workgroup());
|
||||
fstrcpy(state->response->data.domain_name, lp_workgroup());
|
||||
request_ok(state);
|
||||
}
|
||||
|
||||
@ -787,7 +787,7 @@ void winbindd_netbios_name(struct winbindd_cli_state *state)
|
||||
DEBUG(3, ("[%5lu]: request netbios name\n",
|
||||
(unsigned long)state->pid));
|
||||
|
||||
fstrcpy(state->response.data.netbios_name, global_myname());
|
||||
fstrcpy(state->response->data.netbios_name, global_myname());
|
||||
request_ok(state);
|
||||
}
|
||||
|
||||
@ -800,12 +800,12 @@ void winbindd_priv_pipe_dir(struct winbindd_cli_state *state)
|
||||
(unsigned long)state->pid));
|
||||
|
||||
priv_dir = get_winbind_priv_pipe_dir();
|
||||
state->response.extra_data.data = talloc_move(state->mem_ctx,
|
||||
state->response->extra_data.data = talloc_move(state->mem_ctx,
|
||||
&priv_dir);
|
||||
|
||||
/* must add one to length to copy the 0 for string termination */
|
||||
state->response.length +=
|
||||
strlen((char *)state->response.extra_data.data) + 1;
|
||||
state->response->length +=
|
||||
strlen((char *)state->response->extra_data.data) + 1;
|
||||
|
||||
request_ok(state);
|
||||
}
|
||||
|
@ -37,48 +37,48 @@ static NTSTATUS append_info3_as_txt(TALLOC_CTX *mem_ctx,
|
||||
char *ex;
|
||||
uint32_t i;
|
||||
|
||||
state->response.data.auth.info3.logon_time =
|
||||
state->response->data.auth.info3.logon_time =
|
||||
nt_time_to_unix(info3->base.last_logon);
|
||||
state->response.data.auth.info3.logoff_time =
|
||||
state->response->data.auth.info3.logoff_time =
|
||||
nt_time_to_unix(info3->base.last_logoff);
|
||||
state->response.data.auth.info3.kickoff_time =
|
||||
state->response->data.auth.info3.kickoff_time =
|
||||
nt_time_to_unix(info3->base.acct_expiry);
|
||||
state->response.data.auth.info3.pass_last_set_time =
|
||||
state->response->data.auth.info3.pass_last_set_time =
|
||||
nt_time_to_unix(info3->base.last_password_change);
|
||||
state->response.data.auth.info3.pass_can_change_time =
|
||||
state->response->data.auth.info3.pass_can_change_time =
|
||||
nt_time_to_unix(info3->base.allow_password_change);
|
||||
state->response.data.auth.info3.pass_must_change_time =
|
||||
state->response->data.auth.info3.pass_must_change_time =
|
||||
nt_time_to_unix(info3->base.force_password_change);
|
||||
|
||||
state->response.data.auth.info3.logon_count = info3->base.logon_count;
|
||||
state->response.data.auth.info3.bad_pw_count = info3->base.bad_password_count;
|
||||
state->response->data.auth.info3.logon_count = info3->base.logon_count;
|
||||
state->response->data.auth.info3.bad_pw_count = info3->base.bad_password_count;
|
||||
|
||||
state->response.data.auth.info3.user_rid = info3->base.rid;
|
||||
state->response.data.auth.info3.group_rid = info3->base.primary_gid;
|
||||
sid_to_fstring(state->response.data.auth.info3.dom_sid, info3->base.domain_sid);
|
||||
state->response->data.auth.info3.user_rid = info3->base.rid;
|
||||
state->response->data.auth.info3.group_rid = info3->base.primary_gid;
|
||||
sid_to_fstring(state->response->data.auth.info3.dom_sid, info3->base.domain_sid);
|
||||
|
||||
state->response.data.auth.info3.num_groups = info3->base.groups.count;
|
||||
state->response.data.auth.info3.user_flgs = info3->base.user_flags;
|
||||
state->response->data.auth.info3.num_groups = info3->base.groups.count;
|
||||
state->response->data.auth.info3.user_flgs = info3->base.user_flags;
|
||||
|
||||
state->response.data.auth.info3.acct_flags = info3->base.acct_flags;
|
||||
state->response.data.auth.info3.num_other_sids = info3->sidcount;
|
||||
state->response->data.auth.info3.acct_flags = info3->base.acct_flags;
|
||||
state->response->data.auth.info3.num_other_sids = info3->sidcount;
|
||||
|
||||
fstrcpy(state->response.data.auth.info3.user_name,
|
||||
fstrcpy(state->response->data.auth.info3.user_name,
|
||||
info3->base.account_name.string);
|
||||
fstrcpy(state->response.data.auth.info3.full_name,
|
||||
fstrcpy(state->response->data.auth.info3.full_name,
|
||||
info3->base.full_name.string);
|
||||
fstrcpy(state->response.data.auth.info3.logon_script,
|
||||
fstrcpy(state->response->data.auth.info3.logon_script,
|
||||
info3->base.logon_script.string);
|
||||
fstrcpy(state->response.data.auth.info3.profile_path,
|
||||
fstrcpy(state->response->data.auth.info3.profile_path,
|
||||
info3->base.profile_path.string);
|
||||
fstrcpy(state->response.data.auth.info3.home_dir,
|
||||
fstrcpy(state->response->data.auth.info3.home_dir,
|
||||
info3->base.home_directory.string);
|
||||
fstrcpy(state->response.data.auth.info3.dir_drive,
|
||||
fstrcpy(state->response->data.auth.info3.dir_drive,
|
||||
info3->base.home_drive.string);
|
||||
|
||||
fstrcpy(state->response.data.auth.info3.logon_srv,
|
||||
fstrcpy(state->response->data.auth.info3.logon_srv,
|
||||
info3->base.logon_server.string);
|
||||
fstrcpy(state->response.data.auth.info3.logon_dom,
|
||||
fstrcpy(state->response->data.auth.info3.logon_dom,
|
||||
info3->base.domain.string);
|
||||
|
||||
ex = talloc_strdup(state->mem_ctx, "");
|
||||
@ -105,8 +105,8 @@ static NTSTATUS append_info3_as_txt(TALLOC_CTX *mem_ctx,
|
||||
talloc_free(sid);
|
||||
}
|
||||
|
||||
state->response.extra_data.data = ex;
|
||||
state->response.length += talloc_get_size(ex);
|
||||
state->response->extra_data.data = ex;
|
||||
state->response->length += talloc_get_size(ex);
|
||||
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
@ -125,8 +125,8 @@ static NTSTATUS append_info3_as_ndr(TALLOC_CTX *mem_ctx,
|
||||
return ndr_map_error2ntstatus(ndr_err);
|
||||
}
|
||||
|
||||
state->response.extra_data.data = blob.data;
|
||||
state->response.length += blob.length;
|
||||
state->response->extra_data.data = blob.data;
|
||||
state->response->length += blob.length;
|
||||
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
@ -156,11 +156,11 @@ static NTSTATUS append_unix_username(TALLOC_CTX *mem_ctx,
|
||||
nt_username = name_user;
|
||||
}
|
||||
|
||||
fill_domain_username(state->response.data.auth.unix_username,
|
||||
fill_domain_username(state->response->data.auth.unix_username,
|
||||
nt_domain, nt_username, true);
|
||||
|
||||
DEBUG(5,("Setting unix username to [%s]\n",
|
||||
state->response.data.auth.unix_username));
|
||||
state->response->data.auth.unix_username));
|
||||
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
@ -220,12 +220,13 @@ static NTSTATUS append_afs_token(TALLOC_CTX *mem_ctx,
|
||||
if (token == NULL) {
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
state->response.extra_data.data = talloc_strdup(state->mem_ctx, token);
|
||||
if (state->response.extra_data.data == NULL) {
|
||||
state->response->extra_data.data = talloc_strdup(state->mem_ctx,
|
||||
token);
|
||||
if (state->response->extra_data.data == NULL) {
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
state->response.length +=
|
||||
strlen((const char *)state->response.extra_data.data)+1;
|
||||
state->response->length +=
|
||||
strlen((const char *)state->response->extra_data.data)+1;
|
||||
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
@ -399,7 +400,7 @@ static NTSTATUS fillup_password_policy(struct winbindd_domain *domain,
|
||||
return status;
|
||||
}
|
||||
|
||||
fill_in_password_policy(&state->response, &password_policy);
|
||||
fill_in_password_policy(state->response, &password_policy);
|
||||
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
@ -501,7 +502,7 @@ static void setup_return_cc_name(struct winbindd_cli_state *state, const char *c
|
||||
{
|
||||
const char *type = state->request->data.auth.krb5_cc_type;
|
||||
|
||||
state->response.data.auth.krb5ccname[0] = '\0';
|
||||
state->response->data.auth.krb5ccname[0] = '\0';
|
||||
|
||||
if (type[0] == '\0') {
|
||||
return;
|
||||
@ -514,7 +515,7 @@ static void setup_return_cc_name(struct winbindd_cli_state *state, const char *c
|
||||
return;
|
||||
}
|
||||
|
||||
fstrcpy(state->response.data.auth.krb5ccname, cc);
|
||||
fstrcpy(state->response->data.auth.krb5ccname, cc);
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -734,16 +735,16 @@ static NTSTATUS append_data(struct winbindd_cli_state *state,
|
||||
uint32_t flags = state->request->flags;
|
||||
|
||||
if (flags & WBFLAG_PAM_USER_SESSION_KEY) {
|
||||
memcpy(state->response.data.auth.user_session_key,
|
||||
memcpy(state->response->data.auth.user_session_key,
|
||||
info3->base.key.key,
|
||||
sizeof(state->response.data.auth.user_session_key)
|
||||
sizeof(state->response->data.auth.user_session_key)
|
||||
/* 16 */);
|
||||
}
|
||||
|
||||
if (flags & WBFLAG_PAM_LMKEY) {
|
||||
memcpy(state->response.data.auth.first_8_lm_hash,
|
||||
memcpy(state->response->data.auth.first_8_lm_hash,
|
||||
info3->base.LMSessKey.key,
|
||||
sizeof(state->response.data.auth.first_8_lm_hash)
|
||||
sizeof(state->response->data.auth.first_8_lm_hash)
|
||||
/* 8 */);
|
||||
}
|
||||
|
||||
@ -844,12 +845,12 @@ void winbindd_pam_auth(struct winbindd_cli_state *state)
|
||||
sendto_domain(state, domain);
|
||||
return;
|
||||
done:
|
||||
set_auth_errors(&state->response, result);
|
||||
set_auth_errors(state->response, result);
|
||||
DEBUG(5, ("Plain text authentication for %s returned %s "
|
||||
"(PAM: %d)\n",
|
||||
state->request->data.auth.user,
|
||||
state->response.data.auth.nt_status_string,
|
||||
state->response.data.auth.pam_error));
|
||||
state->response->data.auth.nt_status_string,
|
||||
state->response->data.auth.pam_error));
|
||||
request_error(state);
|
||||
}
|
||||
|
||||
@ -1702,12 +1703,12 @@ done:
|
||||
result = NT_STATUS_NO_LOGON_SERVERS;
|
||||
}
|
||||
|
||||
set_auth_errors(&state->response, result);
|
||||
set_auth_errors(state->response, result);
|
||||
|
||||
DEBUG(NT_STATUS_IS_OK(result) ? 5 : 2, ("Plain-text authentication for user %s returned %s (PAM: %d)\n",
|
||||
state->request->data.auth.user,
|
||||
state->response.data.auth.nt_status_string,
|
||||
state->response.data.auth.pam_error));
|
||||
state->response->data.auth.nt_status_string,
|
||||
state->response->data.auth.pam_error));
|
||||
|
||||
return NT_STATUS_IS_OK(result) ? WINBINDD_OK : WINBINDD_ERROR;
|
||||
}
|
||||
@ -1742,7 +1743,7 @@ void winbindd_pam_auth_crap(struct winbindd_cli_state *state)
|
||||
" Ensure permissions on %s "
|
||||
"are set correctly.",
|
||||
get_winbind_priv_pipe_dir());
|
||||
fstrcpy(state->response.data.auth.error_string, error_string);
|
||||
fstrcpy(state->response->data.auth.error_string, error_string);
|
||||
result = NT_STATUS_ACCESS_DENIED;
|
||||
goto done;
|
||||
}
|
||||
@ -1775,12 +1776,12 @@ void winbindd_pam_auth_crap(struct winbindd_cli_state *state)
|
||||
result = NT_STATUS_NO_SUCH_USER;
|
||||
|
||||
done:
|
||||
set_auth_errors(&state->response, result);
|
||||
set_auth_errors(state->response, result);
|
||||
DEBUG(5, ("CRAP authentication for %s\\%s returned %s (PAM: %d)\n",
|
||||
state->request->data.auth_crap.domain,
|
||||
state->request->data.auth_crap.user,
|
||||
state->response.data.auth.nt_status_string,
|
||||
state->response.data.auth.pam_error));
|
||||
state->response->data.auth.nt_status_string,
|
||||
state->response->data.auth.pam_error));
|
||||
request_error(state);
|
||||
return;
|
||||
}
|
||||
@ -1979,14 +1980,14 @@ done:
|
||||
result = nt_status_squash(result);
|
||||
}
|
||||
|
||||
set_auth_errors(&state->response, result);
|
||||
set_auth_errors(state->response, result);
|
||||
|
||||
DEBUG(NT_STATUS_IS_OK(result) ? 5 : 2,
|
||||
("NTLM CRAP authentication for user [%s]\\[%s] returned %s (PAM: %d)\n",
|
||||
name_domain,
|
||||
name_user,
|
||||
state->response.data.auth.nt_status_string,
|
||||
state->response.data.auth.pam_error));
|
||||
state->response->data.auth.nt_status_string,
|
||||
state->response->data.auth.pam_error));
|
||||
|
||||
return NT_STATUS_IS_OK(result) ? WINBINDD_OK : WINBINDD_ERROR;
|
||||
}
|
||||
@ -2022,19 +2023,19 @@ void winbindd_pam_chauthtok(struct winbindd_cli_state *state)
|
||||
we have already copied it (if necessary), this is ok. */
|
||||
|
||||
if (!canonicalize_username(state->request->data.chauthtok.user, domain, user)) {
|
||||
set_auth_errors(&state->response, NT_STATUS_NO_SUCH_USER);
|
||||
set_auth_errors(state->response, NT_STATUS_NO_SUCH_USER);
|
||||
DEBUG(5, ("winbindd_pam_chauthtok: canonicalize_username %s failed with %s"
|
||||
"(PAM: %d)\n",
|
||||
state->request->data.auth.user,
|
||||
state->response.data.auth.nt_status_string,
|
||||
state->response.data.auth.pam_error));
|
||||
state->response->data.auth.nt_status_string,
|
||||
state->response->data.auth.pam_error));
|
||||
request_error(state);
|
||||
return;
|
||||
}
|
||||
|
||||
contact_domain = find_domain_from_name(domain);
|
||||
if (!contact_domain) {
|
||||
set_auth_errors(&state->response, NT_STATUS_NO_SUCH_USER);
|
||||
set_auth_errors(state->response, NT_STATUS_NO_SUCH_USER);
|
||||
DEBUG(3, ("Cannot change password for [%s] -> [%s]\\[%s] as %s is not a trusted domain\n",
|
||||
state->request->data.chauthtok.user, domain, user, domain));
|
||||
request_error(state);
|
||||
@ -2070,7 +2071,7 @@ enum winbindd_result winbindd_dual_pam_chauthtok(struct winbindd_domain *contact
|
||||
newpass = state->request->data.chauthtok.newpass;
|
||||
|
||||
/* Initialize reject reason */
|
||||
state->response.data.auth.reject_reason = Undefined;
|
||||
state->response->data.auth.reject_reason = Undefined;
|
||||
|
||||
/* Get sam handle */
|
||||
|
||||
@ -2092,9 +2093,9 @@ enum winbindd_result winbindd_dual_pam_chauthtok(struct winbindd_domain *contact
|
||||
|
||||
if (NT_STATUS_EQUAL(result, NT_STATUS_PASSWORD_RESTRICTION) ) {
|
||||
|
||||
fill_in_password_policy(&state->response, info);
|
||||
fill_in_password_policy(state->response, info);
|
||||
|
||||
state->response.data.auth.reject_reason =
|
||||
state->response->data.auth.reject_reason =
|
||||
reject->reason;
|
||||
|
||||
got_info = true;
|
||||
@ -2187,14 +2188,14 @@ done:
|
||||
|
||||
process_result:
|
||||
|
||||
set_auth_errors(&state->response, result);
|
||||
set_auth_errors(state->response, result);
|
||||
|
||||
DEBUG(NT_STATUS_IS_OK(result) ? 5 : 2,
|
||||
("Password change for user [%s]\\[%s] returned %s (PAM: %d)\n",
|
||||
domain,
|
||||
user,
|
||||
state->response.data.auth.nt_status_string,
|
||||
state->response.data.auth.pam_error));
|
||||
state->response->data.auth.nt_status_string,
|
||||
state->response->data.auth.pam_error));
|
||||
|
||||
return NT_STATUS_IS_OK(result) ? WINBINDD_OK : WINBINDD_ERROR;
|
||||
}
|
||||
@ -2254,12 +2255,12 @@ void winbindd_pam_logoff(struct winbindd_cli_state *state)
|
||||
return;
|
||||
|
||||
failed:
|
||||
set_auth_errors(&state->response, NT_STATUS_NO_SUCH_USER);
|
||||
set_auth_errors(state->response, NT_STATUS_NO_SUCH_USER);
|
||||
DEBUG(5, ("Pam Logoff for %s returned %s "
|
||||
"(PAM: %d)\n",
|
||||
state->request->data.logoff.user,
|
||||
state->response.data.auth.nt_status_string,
|
||||
state->response.data.auth.pam_error));
|
||||
state->response->data.auth.nt_status_string,
|
||||
state->response->data.auth.pam_error));
|
||||
request_error(state);
|
||||
return;
|
||||
}
|
||||
@ -2320,7 +2321,7 @@ process_result:
|
||||
|
||||
winbindd_delete_memory_creds(state->request->data.logoff.user);
|
||||
|
||||
set_auth_errors(&state->response, result);
|
||||
set_auth_errors(state->response, result);
|
||||
|
||||
return NT_STATUS_IS_OK(result) ? WINBINDD_OK : WINBINDD_ERROR;
|
||||
}
|
||||
@ -2359,12 +2360,12 @@ void winbindd_pam_chng_pswd_auth_crap(struct winbindd_cli_state *state)
|
||||
return;
|
||||
}
|
||||
|
||||
set_auth_errors(&state->response, NT_STATUS_NO_SUCH_USER);
|
||||
set_auth_errors(state->response, NT_STATUS_NO_SUCH_USER);
|
||||
DEBUG(5, ("CRAP change password for %s\\%s returned %s (PAM: %d)\n",
|
||||
state->request->data.chng_pswd_auth_crap.domain,
|
||||
state->request->data.chng_pswd_auth_crap.user,
|
||||
state->response.data.auth.nt_status_string,
|
||||
state->response.data.auth.pam_error));
|
||||
state->response->data.auth.nt_status_string,
|
||||
state->response->data.auth.pam_error));
|
||||
request_error(state);
|
||||
return;
|
||||
}
|
||||
@ -2467,13 +2468,13 @@ enum winbindd_result winbindd_dual_pam_chng_pswd_auth_crap(struct winbindd_domai
|
||||
|
||||
done:
|
||||
|
||||
set_auth_errors(&state->response, result);
|
||||
set_auth_errors(state->response, result);
|
||||
|
||||
DEBUG(NT_STATUS_IS_OK(result) ? 5 : 2,
|
||||
("Password change for user [%s]\\[%s] returned %s (PAM: %d)\n",
|
||||
domain, user,
|
||||
state->response.data.auth.nt_status_string,
|
||||
state->response.data.auth.pam_error));
|
||||
state->response->data.auth.nt_status_string,
|
||||
state->response->data.auth.pam_error));
|
||||
|
||||
return NT_STATUS_IS_OK(result) ? WINBINDD_OK : WINBINDD_ERROR;
|
||||
}
|
||||
|
@ -63,9 +63,9 @@ static void lookupsid_recv(void *private_data, bool success,
|
||||
return;
|
||||
}
|
||||
|
||||
fstrcpy(state->response.data.name.dom_name, dom_name);
|
||||
fstrcpy(state->response.data.name.name, name);
|
||||
state->response.data.name.type = type;
|
||||
fstrcpy(state->response->data.name.dom_name, dom_name);
|
||||
fstrcpy(state->response->data.name.name, name);
|
||||
state->response->data.name.type = type;
|
||||
request_ok(state);
|
||||
}
|
||||
|
||||
@ -118,8 +118,8 @@ static void lookupname_recv(void *private_data, bool success,
|
||||
return;
|
||||
}
|
||||
|
||||
sid_to_fstring(state->response.data.sid.sid, sid);
|
||||
state->response.data.sid.type = type;
|
||||
sid_to_fstring(state->response->data.sid.sid, sid);
|
||||
state->response->data.sid.type = type;
|
||||
request_ok(state);
|
||||
return;
|
||||
}
|
||||
@ -170,7 +170,7 @@ static void sid2uid_recv(void *private_data, bool success, uid_t uid)
|
||||
return;
|
||||
}
|
||||
|
||||
state->response.data.uid = uid;
|
||||
state->response->data.uid = uid;
|
||||
request_ok(state);
|
||||
}
|
||||
|
||||
@ -248,7 +248,7 @@ void winbindd_sid_to_uid(struct winbindd_cli_state *state)
|
||||
return;
|
||||
}
|
||||
DEBUG(10, ("Returning positive cache entry\n"));
|
||||
state->response.data.uid = uid;
|
||||
state->response->data.uid = uid;
|
||||
request_ok(state);
|
||||
return;
|
||||
}
|
||||
@ -279,7 +279,7 @@ static void sid2gid_recv(void *private_data, bool success, gid_t gid)
|
||||
return;
|
||||
}
|
||||
|
||||
state->response.data.gid = gid;
|
||||
state->response->data.gid = gid;
|
||||
request_ok(state);
|
||||
}
|
||||
|
||||
@ -360,7 +360,7 @@ void winbindd_sid_to_gid(struct winbindd_cli_state *state)
|
||||
return;
|
||||
}
|
||||
DEBUG(10, ("Returning positive cache entry\n"));
|
||||
state->response.data.gid = gid;
|
||||
state->response->data.gid = gid;
|
||||
request_ok(state);
|
||||
return;
|
||||
}
|
||||
@ -509,8 +509,8 @@ static void uid2sid_recv(void *private_data, bool success, const char *sidstr)
|
||||
(unsigned long)(state->request->data.uid), sidstr));
|
||||
|
||||
idmap_cache_set_sid2uid(&sid, state->request->data.uid);
|
||||
fstrcpy(state->response.data.sid.sid, sidstr);
|
||||
state->response.data.sid.type = SID_NAME_USER;
|
||||
fstrcpy(state->response->data.sid.sid, sidstr);
|
||||
state->response->data.sid.type = SID_NAME_USER;
|
||||
request_ok(state);
|
||||
return;
|
||||
}
|
||||
@ -538,7 +538,7 @@ void winbindd_uid_to_sid(struct winbindd_cli_state *state)
|
||||
return;
|
||||
}
|
||||
DEBUG(10, ("Returning positive cache entry\n"));
|
||||
sid_to_fstring(state->response.data.sid.sid, &sid);
|
||||
sid_to_fstring(state->response->data.sid.sid, &sid);
|
||||
request_ok(state);
|
||||
return;
|
||||
}
|
||||
@ -566,8 +566,8 @@ static void gid2sid_recv(void *private_data, bool success, const char *sidstr)
|
||||
(unsigned long)(state->request->data.gid), sidstr));
|
||||
|
||||
idmap_cache_set_sid2gid(&sid, state->request->data.gid);
|
||||
fstrcpy(state->response.data.sid.sid, sidstr);
|
||||
state->response.data.sid.type = SID_NAME_DOM_GRP;
|
||||
fstrcpy(state->response->data.sid.sid, sidstr);
|
||||
state->response->data.sid.type = SID_NAME_DOM_GRP;
|
||||
request_ok(state);
|
||||
return;
|
||||
}
|
||||
@ -596,7 +596,7 @@ void winbindd_gid_to_sid(struct winbindd_cli_state *state)
|
||||
return;
|
||||
}
|
||||
DEBUG(10, ("Returning positive cache entry\n"));
|
||||
sid_to_fstring(state->response.data.sid.sid, &sid);
|
||||
sid_to_fstring(state->response->data.sid.sid, &sid);
|
||||
request_ok(state);
|
||||
return;
|
||||
}
|
||||
@ -626,7 +626,7 @@ enum winbindd_result winbindd_dual_allocate_uid(struct winbindd_domain *domain,
|
||||
if (!NT_STATUS_IS_OK(idmap_allocate_uid(&xid))) {
|
||||
return WINBINDD_ERROR;
|
||||
}
|
||||
state->response.data.uid = xid.id;
|
||||
state->response->data.uid = xid.id;
|
||||
return WINBINDD_OK;
|
||||
}
|
||||
|
||||
@ -650,6 +650,6 @@ enum winbindd_result winbindd_dual_allocate_gid(struct winbindd_domain *domain,
|
||||
if (!NT_STATUS_IS_OK(idmap_allocate_gid(&xid))) {
|
||||
return WINBINDD_ERROR;
|
||||
}
|
||||
state->response.data.gid = xid.id;
|
||||
state->response->data.gid = xid.id;
|
||||
return WINBINDD_OK;
|
||||
}
|
||||
|
@ -178,13 +178,15 @@ enum winbindd_result winbindd_dual_userinfo(struct winbindd_domain *domain,
|
||||
return WINBINDD_ERROR;
|
||||
}
|
||||
|
||||
fstrcpy(state->response.data.user_info.acct_name, user_info.acct_name);
|
||||
fstrcpy(state->response.data.user_info.full_name, user_info.full_name);
|
||||
fstrcpy(state->response.data.user_info.homedir, user_info.homedir);
|
||||
fstrcpy(state->response.data.user_info.shell, user_info.shell);
|
||||
state->response.data.user_info.primary_gid = user_info.primary_gid;
|
||||
fstrcpy(state->response->data.user_info.acct_name,
|
||||
user_info.acct_name);
|
||||
fstrcpy(state->response->data.user_info.full_name,
|
||||
user_info.full_name);
|
||||
fstrcpy(state->response->data.user_info.homedir, user_info.homedir);
|
||||
fstrcpy(state->response->data.user_info.shell, user_info.shell);
|
||||
state->response->data.user_info.primary_gid = user_info.primary_gid;
|
||||
if (!sid_peek_check_rid(&domain->sid, &user_info.group_sid,
|
||||
&state->response.data.user_info.group_rid)) {
|
||||
&state->response->data.user_info.group_rid)) {
|
||||
DEBUG(1, ("Could not extract group rid out of %s\n",
|
||||
sid_string_dbg(&sid)));
|
||||
return WINBINDD_ERROR;
|
||||
@ -371,7 +373,7 @@ static void getpwsid_sid2gid_recv(void *private_data, bool success, gid_t gid)
|
||||
s->gid = gid;
|
||||
}
|
||||
|
||||
pw = &s->state->response.data.pw;
|
||||
pw = &s->state->response->data.pw;
|
||||
pw->pw_uid = s->uid;
|
||||
pw->pw_gid = s->gid;
|
||||
|
||||
@ -785,7 +787,7 @@ void winbindd_getpwent(struct winbindd_cli_state *state)
|
||||
request_error(state);
|
||||
return;
|
||||
}
|
||||
state->response.extra_data.data = user_list;
|
||||
state->response->extra_data.data = user_list;
|
||||
|
||||
if (!state->getpwent_initialized)
|
||||
winbindd_setpwent_internal(state);
|
||||
@ -846,8 +848,8 @@ void winbindd_getpwent(struct winbindd_cli_state *state)
|
||||
if (result) {
|
||||
|
||||
user_list_ndx++;
|
||||
state->response.data.num_entries++;
|
||||
state->response.length += sizeof(struct winbindd_pw);
|
||||
state->response->data.num_entries++;
|
||||
state->response->length += sizeof(struct winbindd_pw);
|
||||
|
||||
} else
|
||||
DEBUG(1, ("could not lookup domain user %s\n",
|
||||
|
@ -581,15 +581,15 @@ enum winbindd_result winbindd_dual_init_connection(struct winbindd_domain *domai
|
||||
"online = %d\n", domain->name, (int)domain->online ));
|
||||
}
|
||||
|
||||
fstrcpy(state->response.data.domain_info.name, domain->name);
|
||||
fstrcpy(state->response.data.domain_info.alt_name, domain->alt_name);
|
||||
sid_to_fstring(state->response.data.domain_info.sid, &domain->sid);
|
||||
fstrcpy(state->response->data.domain_info.name, domain->name);
|
||||
fstrcpy(state->response->data.domain_info.alt_name, domain->alt_name);
|
||||
sid_to_fstring(state->response->data.domain_info.sid, &domain->sid);
|
||||
|
||||
state->response.data.domain_info.native_mode
|
||||
state->response->data.domain_info.native_mode
|
||||
= domain->native_mode;
|
||||
state->response.data.domain_info.active_directory
|
||||
state->response->data.domain_info.active_directory
|
||||
= domain->active_directory;
|
||||
state->response.data.domain_info.primary
|
||||
state->response->data.domain_info.primary
|
||||
= domain->primary;
|
||||
|
||||
return WINBINDD_OK;
|
||||
|
@ -185,7 +185,7 @@ void winbindd_wins_byip(struct winbindd_cli_state *state)
|
||||
response[strlen(response)-1] = '\n';
|
||||
SAFE_FREE(status);
|
||||
}
|
||||
fstrcpy(state->response.data.winsresp,response);
|
||||
fstrcpy(state->response->data.winsresp,response);
|
||||
request_ok(state);
|
||||
}
|
||||
|
||||
@ -241,7 +241,7 @@ void winbindd_wins_byname(struct winbindd_cli_state *state)
|
||||
return;
|
||||
}
|
||||
|
||||
fstrcpy(state->response.data.winsresp,response);
|
||||
fstrcpy(state->response->data.winsresp,response);
|
||||
|
||||
request_ok(state);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user