[SCM] Samba Shared Repository - branch master updated -
release-4-0-0alpha7-2315-g49eccee
Volker Lendecke
vlendec at samba.org
Sun Jun 14 20:23:01 GMT 2009
The branch, master has been updated
via 49eccee209f01af043d084742bbbc9d4519eddfc (commit)
via 97ba4f6efdcdb1e4f5d43ddeadfd06c7d96213f4 (commit)
from 90535b5fad513bb44c31b91557347486c8688482 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 49eccee209f01af043d084742bbbc9d4519eddfc
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jun 14 12:58:19 2009 +0200
Remove "winbindd_request" and "winbindd_response" from winbindd_cli_state
This shrinks the memory footprint of an idle client by 5592 bytes to 60 bytes
on my 32-bit box.
commit 97ba4f6efdcdb1e4f5d43ddeadfd06c7d96213f4
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jun 14 12:41:46 2009 +0200
Make winbindd_cli_state->response a pointer instead of a struct member
Same comment as in baa6084378e530b: This is just a preparatory checkin.
Volker
-----------------------------------------------------------------------
Summary of changes:
source3/winbindd/winbindd.c | 33 ++++---
source3/winbindd/winbindd.h | 3 +-
source3/winbindd/winbindd_async.c | 28 +++---
source3/winbindd/winbindd_ccache_access.c | 10 +-
source3/winbindd/winbindd_dual.c | 35 ++++---
source3/winbindd/winbindd_group.c | 66 +++++++-------
source3/winbindd/winbindd_idmap.c | 18 ++--
source3/winbindd/winbindd_locator.c | 18 ++--
source3/winbindd/winbindd_misc.c | 68 +++++++-------
source3/winbindd/winbindd_pam.c | 147 +++++++++++++++--------------
source3/winbindd/winbindd_sid.c | 34 ++++----
source3/winbindd/winbindd_user.c | 22 +++--
source3/winbindd/winbindd_util.c | 12 +-
source3/winbindd/winbindd_wins.c | 4 +-
14 files changed, 254 insertions(+), 244 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
index 716e0ed..0a73c0e 100644
--- a/source3/winbindd/winbindd.c
+++ b/source3/winbindd/winbindd.c
@@ -531,11 +531,6 @@ 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);
-
- state->response.result = WINBINDD_PENDING;
- state->response.length = sizeof(struct winbindd_response);
-
state->mem_ctx = talloc_init("winbind request");
if (state->mem_ctx == NULL)
return;
@@ -570,6 +565,16 @@ static void process_request(struct winbindd_cli_state *state)
return;
}
+ state->response = talloc_zero(state->mem_ctx,
+ struct winbindd_response);
+ if (state->response == NULL) {
+ DEBUG(10, ("talloc failed\n"));
+ remove_client(state);
+ return;
+ }
+ state->response->result = WINBINDD_PENDING;
+ state->response->length = sizeof(struct winbindd_response);
+
for (table = dispatch_table; table->fn; table++) {
if (state->request->cmd == table->cmd) {
DEBUG(10,("process_request: request fn %s\n",
@@ -599,9 +604,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 +633,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 +670,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);
}
@@ -804,7 +809,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) {
diff --git a/source3/winbindd/winbindd.h b/source3/winbindd/winbindd.h
index 324b13e..804c0af 100644
--- a/source3/winbindd/winbindd.h
+++ b/source3/winbindd/winbindd.h
@@ -58,9 +58,8 @@ struct winbindd_cli_state {
NTSTATUS (*recv_fn)(struct tevent_req *req, TALLOC_CTX *mem_ctx,
struct winbindd_response **presp);
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; /* Respose to client */
bool getpwent_initialized; /* Has getpwent_state been
* initialized? */
bool getgrent_initialized; /* Has getgrent_state been
diff --git a/source3/winbindd/winbindd_async.c b/source3/winbindd/winbindd_async.c
index 966a3b3..56175e2 100644
--- a/source3/winbindd/winbindd_async.c
+++ b/source3/winbindd/winbindd_async.c
@@ -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;
diff --git a/source3/winbindd/winbindd_ccache_access.c b/source3/winbindd/winbindd_ccache_access.c
index 479c114..ffb20ac 100644
--- a/source3/winbindd/winbindd_ccache_access.c
+++ b/source3/winbindd/winbindd_ccache_access.c
@@ -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);
diff --git a/source3/winbindd/winbindd_dual.c b/source3/winbindd/winbindd_dual.c
index 0ed4706..92f0d60 100644
--- a/source3/winbindd/winbindd_dual.c
+++ b/source3/winbindd/winbindd_dual.c
@@ -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,
@@ -1316,6 +1316,8 @@ static bool fork_domain_child(struct winbindd_child *child)
{
int fdpair[2];
struct winbindd_cli_state state;
+ struct winbindd_request request;
+ struct winbindd_response response;
struct winbindd_domain *primary_domain = NULL;
if (child->domain) {
@@ -1333,7 +1335,8 @@ static bool fork_domain_child(struct winbindd_child *child)
ZERO_STRUCT(state);
state.pid = sys_getpid();
- state.request = &state._request;
+ state.request = &request;
+ state.response = &response;
child->pid = sys_fork();
@@ -1525,7 +1528,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 +1537,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);
}
diff --git a/source3/winbindd/winbindd_group.c b/source3/winbindd/winbindd_group.c
index 2e8905f..f78becb 100644
--- a/source3/winbindd/winbindd_group.c
+++ b/source3/winbindd/winbindd_group.c
@@ -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;
--
Samba Shared Repository
More information about the samba-cvs
mailing list