summaryrefslogtreecommitdiff
path: root/source3/nsswitch
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2006-04-12 14:10:39 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:16:00 -0500
commit8c9eb7631eecbe3f9bda30aff4b5d97d5e2a8737 (patch)
treecac69887b74af6bc9330a279919555fe52db53b7 /source3/nsswitch
parent7a5ff0885d08f9e32dc9939e5fd676a987b881d9 (diff)
downloadsamba-8c9eb7631eecbe3f9bda30aff4b5d97d5e2a8737.tar.gz
samba-8c9eb7631eecbe3f9bda30aff4b5d97d5e2a8737.tar.bz2
samba-8c9eb7631eecbe3f9bda30aff4b5d97d5e2a8737.zip
r15053: fix portabilities issues between 32-bit winbind clients and a 64-bit winbindd server
(This used to be commit a95d11345e76948b147bbc1f29a05c978d99a47a)
Diffstat (limited to 'source3/nsswitch')
-rw-r--r--source3/nsswitch/wb_client.c2
-rw-r--r--source3/nsswitch/wb_common.c14
-rw-r--r--source3/nsswitch/wbinfo.c40
-rw-r--r--source3/nsswitch/winbind_nss_aix.c14
-rw-r--r--source3/nsswitch/winbind_nss_config.h13
-rw-r--r--source3/nsswitch/winbind_nss_irix.c12
-rw-r--r--source3/nsswitch/winbind_nss_linux.c18
-rw-r--r--source3/nsswitch/winbindd.c22
-rw-r--r--source3/nsswitch/winbindd_async.c18
-rw-r--r--source3/nsswitch/winbindd_cache.c6
-rw-r--r--source3/nsswitch/winbindd_dual.c16
-rw-r--r--source3/nsswitch/winbindd_group.c28
-rw-r--r--source3/nsswitch/winbindd_misc.c10
-rw-r--r--source3/nsswitch/winbindd_nss.h20
-rw-r--r--source3/nsswitch/winbindd_pam.c20
-rw-r--r--source3/nsswitch/winbindd_user.c8
-rw-r--r--source3/nsswitch/winbindd_util.c4
17 files changed, 144 insertions, 121 deletions
diff --git a/source3/nsswitch/wb_client.c b/source3/nsswitch/wb_client.c
index b2db25c31b..de1edf054d 100644
--- a/source3/nsswitch/wb_client.c
+++ b/source3/nsswitch/wb_client.c
@@ -320,7 +320,7 @@ static int wb_getgroups(const char *user, gid_t **groups)
/* Return group list. Don't forget to free the group list
when finished. */
- *groups = (gid_t *)response.extra_data;
+ *groups = (gid_t *)response.extra_data.data;
return response.data.num_entries;
}
diff --git a/source3/nsswitch/wb_common.c b/source3/nsswitch/wb_common.c
index 91ec912b7d..91ebdbd584 100644
--- a/source3/nsswitch/wb_common.c
+++ b/source3/nsswitch/wb_common.c
@@ -37,7 +37,7 @@ void free_response(struct winbindd_response *response)
/* Free any allocated extra_data */
if (response)
- SAFE_FREE(response->extra_data);
+ SAFE_FREE(response->extra_data.data);
}
/* Initialise a request structure */
@@ -324,13 +324,13 @@ static int winbind_open_pipe_sock(int recursing)
request.flags = WBFLAG_RECURSE;
if (winbindd_request_response(WINBINDD_PRIV_PIPE_DIR, &request, &response) == NSS_STATUS_SUCCESS) {
int fd;
- if ((fd = winbind_named_pipe_sock(response.extra_data)) != -1) {
+ if ((fd = winbind_named_pipe_sock(response.extra_data.data)) != -1) {
close(winbindd_fd);
winbindd_fd = fd;
}
}
- SAFE_FREE(response.extra_data);
+ SAFE_FREE(response.extra_data.data);
return winbindd_fd;
#else
@@ -492,7 +492,7 @@ int read_reply(struct winbindd_response *response)
the server. This has no meaning in the client's address space
so we clear it out. */
- response->extra_data = NULL;
+ response->extra_data.data = NULL;
/* Read variable length response */
@@ -502,11 +502,11 @@ int read_reply(struct winbindd_response *response)
/* Mallocate memory for extra data */
- if (!(response->extra_data = malloc(extra_data_len))) {
+ if (!(response->extra_data.data = malloc(extra_data_len))) {
return -1;
}
- if ((result2 = read_sock(response->extra_data, extra_data_len))
+ if ((result2 = read_sock(response->extra_data.data, extra_data_len))
== -1) {
free_response(response);
return -1;
@@ -550,7 +550,7 @@ NSS_STATUS winbindd_send_request(int req_type, struct winbindd_request *request)
}
if ((request->extra_len != 0) &&
- (write_sock(request->extra_data, request->extra_len, request->flags & WBFLAG_RECURSE) == -1)) {
+ (write_sock(request->extra_data.data, request->extra_len, request->flags & WBFLAG_RECURSE) == -1)) {
return NSS_STATUS_UNAVAIL;
}
diff --git a/source3/nsswitch/wbinfo.c b/source3/nsswitch/wbinfo.c
index 89ffa6b5b3..ad5ef71523 100644
--- a/source3/nsswitch/wbinfo.c
+++ b/source3/nsswitch/wbinfo.c
@@ -141,9 +141,9 @@ static BOOL wbinfo_get_usergroups(char *user)
return False;
for (i = 0; i < response.data.num_entries; i++)
- d_printf("%d\n", (int)((gid_t *)response.extra_data)[i]);
+ d_printf("%d\n", (int)((gid_t *)response.extra_data.data)[i]);
- SAFE_FREE(response.extra_data);
+ SAFE_FREE(response.extra_data.data);
return True;
}
@@ -169,13 +169,13 @@ static BOOL wbinfo_get_usersids(char *user_sid)
if (result != NSS_STATUS_SUCCESS)
return False;
- s = response.extra_data;
+ s = response.extra_data.data;
for (i = 0; i < response.data.num_entries; i++) {
d_printf("%s\n", s);
s += strlen(s) + 1;
}
- SAFE_FREE(response.extra_data);
+ SAFE_FREE(response.extra_data.data);
return True;
}
@@ -199,9 +199,9 @@ static BOOL wbinfo_get_userdomgroups(const char *user_sid)
return False;
if (response.data.num_entries != 0)
- printf("%s", (char *)response.extra_data);
+ printf("%s", (char *)response.extra_data.data);
- SAFE_FREE(response.extra_data);
+ SAFE_FREE(response.extra_data.data);
return True;
}
@@ -278,8 +278,8 @@ static BOOL wbinfo_list_domains(BOOL list_all_domains)
/* Display response */
- if (response.extra_data) {
- const char *extra_data = (char *)response.extra_data;
+ if (response.extra_data.data) {
+ const char *extra_data = (char *)response.extra_data.data;
fstring name;
char *p;
@@ -294,7 +294,7 @@ static BOOL wbinfo_list_domains(BOOL list_all_domains)
d_printf("%s\n", name);
}
- SAFE_FREE(response.extra_data);
+ SAFE_FREE(response.extra_data.data);
}
return True;
@@ -321,10 +321,10 @@ static BOOL wbinfo_show_sequence(const char *domain)
/* Display response */
- if (response.extra_data) {
- char *extra_data = (char *)response.extra_data;
+ if (response.extra_data.data) {
+ char *extra_data = (char *)response.extra_data.data;
d_printf("%s", extra_data);
- SAFE_FREE(response.extra_data);
+ SAFE_FREE(response.extra_data.data);
}
return True;
@@ -836,12 +836,12 @@ static BOOL wbinfo_klog(char *username)
if (result != NSS_STATUS_SUCCESS)
return False;
- if (response.extra_data == NULL) {
+ if (response.extra_data.data == NULL) {
d_fprintf(stderr, "Did not get token data\n");
return False;
}
- if (!afs_settoken_str((char *)response.extra_data)) {
+ if (!afs_settoken_str((char *)response.extra_data.data)) {
d_fprintf(stderr, "Could not set token\n");
return False;
}
@@ -878,15 +878,15 @@ static BOOL print_domain_users(const char *domain)
/* Look through extra data */
- if (!response.extra_data)
+ if (!response.extra_data.data)
return False;
- extra_data = (const char *)response.extra_data;
+ extra_data = (const char *)response.extra_data.data;
while(next_token(&extra_data, name, ",", sizeof(fstring)))
d_printf("%s\n", name);
- SAFE_FREE(response.extra_data);
+ SAFE_FREE(response.extra_data.data);
return True;
}
@@ -916,15 +916,15 @@ static BOOL print_domain_groups(const char *domain)
/* Look through extra data */
- if (!response.extra_data)
+ if (!response.extra_data.data)
return False;
- extra_data = (const char *)response.extra_data;
+ extra_data = (const char *)response.extra_data.data;
while(next_token(&extra_data, name, ",", sizeof(fstring)))
d_printf("%s\n", name);
- SAFE_FREE(response.extra_data);
+ SAFE_FREE(response.extra_data.data);
return True;
}
diff --git a/source3/nsswitch/winbind_nss_aix.c b/source3/nsswitch/winbind_nss_aix.c
index 0a8bef736c..b898e3c3af 100644
--- a/source3/nsswitch/winbind_nss_aix.c
+++ b/source3/nsswitch/winbind_nss_aix.c
@@ -284,7 +284,7 @@ static struct group *wb_aix_getgrgid(gid_t gid)
HANDLE_ERRORS(ret);
- grp = fill_grent(&response.data.gr, response.extra_data);
+ grp = fill_grent(&response.data.gr, response.extra_data.data);
free_response(&response);
@@ -314,7 +314,7 @@ static struct group *wb_aix_getgrnam(const char *name)
HANDLE_ERRORS(ret);
- grp = fill_grent(&response.data.gr, response.extra_data);
+ grp = fill_grent(&response.data.gr, response.extra_data.data);
free_response(&response);
@@ -371,7 +371,7 @@ static char *wb_aix_getgrset(char *user)
HANDLE_ERRORS(ret);
num_gids = response.data.num_entries;
- gid_list = (gid_t *)response.extra_data;
+ gid_list = (gid_t *)response.extra_data.data;
/* allocate a space large enough to contruct the string */
tmpbuf = malloc(num_gids*12);
@@ -477,7 +477,7 @@ static int wb_aix_lsuser(char *attributes[], attrval_t results[], int size)
return -1;
}
- len = strlen(response.extra_data);
+ len = strlen(response.extra_data.data);
s = malloc(len+2);
if (!s) {
@@ -486,7 +486,7 @@ static int wb_aix_lsuser(char *attributes[], attrval_t results[], int size)
return -1;
}
- memcpy(s, response.extra_data, len+1);
+ memcpy(s, response.extra_data.data, len+1);
replace_commas(s);
@@ -525,7 +525,7 @@ static int wb_aix_lsgroup(char *attributes[], attrval_t results[], int size)
return -1;
}
- len = strlen(response.extra_data);
+ len = strlen(response.extra_data.data);
s = malloc(len+2);
if (!s) {
@@ -534,7 +534,7 @@ static int wb_aix_lsgroup(char *attributes[], attrval_t results[], int size)
return -1;
}
- memcpy(s, response.extra_data, len+1);
+ memcpy(s, response.extra_data.data, len+1);
replace_commas(s);
diff --git a/source3/nsswitch/winbind_nss_config.h b/source3/nsswitch/winbind_nss_config.h
index a3243b99e3..fbd1bd22b3 100644
--- a/source3/nsswitch/winbind_nss_config.h
+++ b/source3/nsswitch/winbind_nss_config.h
@@ -119,6 +119,19 @@ typedef int BOOL;
#define uint8 unsigned char
#endif
+/*
+ * check for 8 byte long long
+ */
+
+#if !defined(uint64)
+#if (SIZEOF_LONG == 8)
+#define uint64 unsigned long
+#elif (SIZEOF_LONG_LONG == 8)
+#define uint64 unsigned long long
+#endif /* don't lie. If we don't have it, then don't use it */
+#endif
+
+
/* zero a structure */
#ifndef ZERO_STRUCT
#define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x))
diff --git a/source3/nsswitch/winbind_nss_irix.c b/source3/nsswitch/winbind_nss_irix.c
index 73f3b4f33a..fd15f57940 100644
--- a/source3/nsswitch/winbind_nss_irix.c
+++ b/source3/nsswitch/winbind_nss_irix.c
@@ -216,8 +216,8 @@ winbind_callback(nsd_file_t **rqp, int fd)
break;
case WINBINDD_GETGRNAM:
case WINBINDD_GETGRGID:
- if (gr->num_gr_mem && response.extra_data)
- members = response.extra_data;
+ if (gr->num_gr_mem && response.extra_data.data)
+ members = response.extra_data.data;
else
members = "";
snprintf(result,maxlen,"%s:%s:%d:%s\n",
@@ -234,13 +234,13 @@ winbind_callback(nsd_file_t **rqp, int fd)
"callback (winbind) - %d GETGRENT responses\n",
response.data.num_entries);
if (response.data.num_entries) {
- gr = (struct winbindd_gr *)response.extra_data;
+ gr = (struct winbindd_gr *)response.extra_data.data;
if (! gr ) {
- nsd_logprintf(NSD_LOG_MIN, " no extra_data\n");
+ nsd_logprintf(NSD_LOG_MIN, " no extra_data.data\n");
free_response(&response);
return NSD_ERROR;
}
- members = (char *)response.extra_data +
+ members = (char *)response.extra_data.data +
(response.data.num_entries * sizeof(struct winbindd_gr));
for (i = 0; i < response.data.num_entries; i++) {
snprintf(result,maxlen,"%s:%s:%d:%s\n",
@@ -262,7 +262,7 @@ winbind_callback(nsd_file_t **rqp, int fd)
"callback (winbind) - %d GETPWENT responses\n",
response.data.num_entries);
if (response.data.num_entries) {
- pw = (struct winbindd_pw *)response.extra_data;
+ pw = (struct winbindd_pw *)response.extra_data.data;
if (! pw ) {
nsd_logprintf(NSD_LOG_MIN, " no extra_data\n");
free_response(&response);
diff --git a/source3/nsswitch/winbind_nss_linux.c b/source3/nsswitch/winbind_nss_linux.c
index c0b8bf3a75..78a39f2873 100644
--- a/source3/nsswitch/winbind_nss_linux.c
+++ b/source3/nsswitch/winbind_nss_linux.c
@@ -370,7 +370,7 @@ _nss_winbind_getpwent_r(struct passwd *result, char *buffer,
return_result:
- pw_cache = getpwent_response.extra_data;
+ pw_cache = getpwent_response.extra_data.data;
/* Check data is valid */
@@ -613,7 +613,7 @@ winbind_getgrent(enum winbindd_cmd cmd,
return_result:
- gr_cache = getgrent_response.extra_data;
+ gr_cache = getgrent_response.extra_data.data;
/* Check data is valid */
@@ -629,7 +629,7 @@ winbind_getgrent(enum winbindd_cmd cmd,
num_gr_cache * sizeof(struct winbindd_gr);
ret = fill_grent(result, &gr_cache[ndx_gr_cache],
- ((char *)getgrent_response.extra_data)+mem_ofs,
+ ((char *)getgrent_response.extra_data.data)+mem_ofs,
&buffer, &buflen);
/* Out of memory - try again */
@@ -704,7 +704,7 @@ _nss_winbind_getgrnam_r(const char *name,
if (ret == NSS_STATUS_SUCCESS) {
ret = fill_grent(result, &response.data.gr,
- response.extra_data,
+ response.extra_data.data,
&buffer, &buflen);
if (ret == NSS_STATUS_TRYAGAIN) {
@@ -719,7 +719,7 @@ _nss_winbind_getgrnam_r(const char *name,
/* We've been called again */
ret = fill_grent(result, &response.data.gr,
- response.extra_data, &buffer, &buflen);
+ response.extra_data.data, &buffer, &buflen);
if (ret == NSS_STATUS_TRYAGAIN) {
keep_response = True;
@@ -767,7 +767,7 @@ _nss_winbind_getgrgid_r(gid_t gid,
if (ret == NSS_STATUS_SUCCESS) {
ret = fill_grent(result, &response.data.gr,
- response.extra_data,
+ response.extra_data.data,
&buffer, &buflen);
if (ret == NSS_STATUS_TRYAGAIN) {
@@ -782,7 +782,7 @@ _nss_winbind_getgrgid_r(gid_t gid,
/* We've been called again */
ret = fill_grent(result, &response.data.gr,
- response.extra_data, &buffer, &buflen);
+ response.extra_data.data, &buffer, &buflen);
if (ret == NSS_STATUS_TRYAGAIN) {
keep_response = True;
@@ -825,7 +825,7 @@ _nss_winbind_initgroups_dyn(char *user, gid_t group, long int *start,
if (ret == NSS_STATUS_SUCCESS) {
int num_gids = response.data.num_entries;
- gid_t *gid_list = (gid_t *)response.extra_data;
+ gid_t *gid_list = (gid_t *)response.extra_data.data;
/* Copy group list to client */
@@ -911,7 +911,7 @@ _nss_winbind_getusersids(const char *user_sid, char **group_sids,
*num_groups = response.data.num_entries;
*group_sids = buffer;
- memcpy(buffer, response.extra_data, response.length - sizeof(response));
+ memcpy(buffer, response.extra_data.data, response.length - sizeof(response));
errno = *errnop = 0;
done:
diff --git a/source3/nsswitch/winbindd.c b/source3/nsswitch/winbindd.c
index b318416272..997991a8c6 100644
--- a/source3/nsswitch/winbindd.c
+++ b/source3/nsswitch/winbindd.c
@@ -265,7 +265,7 @@ static void process_request(struct winbindd_cli_state *state)
/* Free response data - we may be interrupted and receive another
command before being able to send this data off. */
- SAFE_FREE(state->response.extra_data);
+ SAFE_FREE(state->response.extra_data.data);
ZERO_STRUCT(state->response);
@@ -435,8 +435,8 @@ static void response_extra_sent(void *private_data, BOOL success)
return;
}
- SAFE_FREE(state->request.extra_data);
- SAFE_FREE(state->response.extra_data);
+ SAFE_FREE(state->request.extra_data.data);
+ SAFE_FREE(state->response.extra_data.data);
setup_async_read(&state->fd_event, &state->request, sizeof(uint32),
request_len_recv, state);
@@ -463,7 +463,7 @@ static void response_main_sent(void *private_data, BOOL success)
return;
}
- setup_async_write(&state->fd_event, state->response.extra_data,
+ setup_async_write(&state->fd_event, state->response.extra_data.data,
state->response.length - sizeof(state->response),
response_extra_sent, state);
}
@@ -532,7 +532,7 @@ static void request_main_recv(void *private_data, BOOL success)
}
if (state->request.extra_len == 0) {
- state->request.extra_data = NULL;
+ state->request.extra_data.data = NULL;
request_recv(state, True);
return;
}
@@ -541,24 +541,24 @@ static void request_main_recv(void *private_data, BOOL success)
(state->request.extra_len > WINBINDD_MAX_EXTRA_DATA)) {
DEBUG(3, ("Got request with %d bytes extra data on "
"unprivileged socket\n", (int)state->request.extra_len));
- state->request.extra_data = NULL;
+ state->request.extra_data.data = NULL;
state->finished = True;
return;
}
- state->request.extra_data =
+ state->request.extra_data.data =
SMB_MALLOC_ARRAY(char, state->request.extra_len + 1);
- if (state->request.extra_data == NULL) {
+ if (state->request.extra_data.data == NULL) {
DEBUG(0, ("malloc failed\n"));
state->finished = True;
return;
}
/* Ensure null termination */
- state->request.extra_data[state->request.extra_len] = '\0';
+ state->request.extra_data.data[state->request.extra_len] = '\0';
- setup_async_read(&state->fd_event, state->request.extra_data,
+ setup_async_read(&state->fd_event, state->request.extra_data.data,
state->request.extra_len, request_recv, state);
}
@@ -640,7 +640,7 @@ static void remove_client(struct winbindd_cli_state *state)
/* We may have some extra data that was not freed if the
client was killed unexpectedly */
- SAFE_FREE(state->response.extra_data);
+ SAFE_FREE(state->response.extra_data.data);
if (state->mem_ctx != NULL) {
talloc_destroy(state->mem_ctx);
diff --git a/source3/nsswitch/winbindd_async.c b/source3/nsswitch/winbindd_async.c
index 543dc88470..7f282df929 100644
--- a/source3/nsswitch/winbindd_async.c
+++ b/source3/nsswitch/winbindd_async.c
@@ -833,7 +833,7 @@ static void getsidaliases_recv(TALLOC_CTX *mem_ctx, BOOL success,
return;
}
- aliases_str = response->extra_data;
+ aliases_str = response->extra_data.data;
if (aliases_str == NULL) {
DEBUG(10, ("getsidaliases return 0 SIDs\n"));
@@ -847,7 +847,7 @@ static void getsidaliases_recv(TALLOC_CTX *mem_ctx, BOOL success,
return;
}
- SAFE_FREE(response->extra_data);
+ SAFE_FREE(response->extra_data.data);
cont(private_data, True, sids, num_sids);
}
@@ -878,7 +878,7 @@ void winbindd_getsidaliases_async(struct winbindd_domain *domain,
ZERO_STRUCT(request);
request.cmd = WINBINDD_DUAL_GETSIDALIASES;
request.extra_len = len;
- request.extra_data = sidstr;
+ request.extra_data.data = sidstr;
do_async_domain(mem_ctx, domain, &request, getsidaliases_recv,
cont, private_data);
@@ -898,7 +898,7 @@ enum winbindd_result winbindd_dual_getsidaliases(struct winbindd_domain *domain,
DEBUG(3, ("[%5lu]: getsidaliases\n", (unsigned long)state->pid));
- sidstr = state->request.extra_data;
+ sidstr = state->request.extra_data.data;
if (sidstr == NULL)
sidstr = talloc_strdup(state->mem_ctx, "\n"); /* No SID */
@@ -938,14 +938,14 @@ enum winbindd_result winbindd_dual_getsidaliases(struct winbindd_domain *domain,
}
if (!print_sidlist(NULL, sids, num_sids,
- (char **)&state->response.extra_data, &len)) {
+ (char **)&state->response.extra_data.data, &len)) {
DEBUG(0, ("Could not print_sidlist\n"));
return WINBINDD_ERROR;
}
- if (state->response.extra_data != NULL) {
+ if (state->response.extra_data.data != NULL) {
DEBUG(10, ("aliases_list: %s\n",
- (char *)state->response.extra_data));
+ (char *)state->response.extra_data.data));
state->response.length += len+1;
}
@@ -1026,7 +1026,7 @@ static void gettoken_recvdomgroups(TALLOC_CTX *mem_ctx, BOOL success,
return;
}
- sids_str = response->extra_data;
+ sids_str = response->extra_data.data;
if (sids_str == NULL) {
/* This could be normal if we are dealing with a
@@ -1052,7 +1052,7 @@ static void gettoken_recvdomgroups(TALLOC_CTX *mem_ctx, BOOL success,
return;
}
- SAFE_FREE(response->extra_data);
+ SAFE_FREE(response->extra_data.data);
if (state->alias_domain == NULL) {
DEBUG(10, ("Don't expand domain local groups\n"));
diff --git a/source3/nsswitch/winbindd_cache.c b/source3/nsswitch/winbindd_cache.c
index f96f03290d..69a4c8eda3 100644
--- a/source3/nsswitch/winbindd_cache.c
+++ b/source3/nsswitch/winbindd_cache.c
@@ -1921,7 +1921,7 @@ void cache_store_response(pid_t pid, struct winbindd_response *response)
fstr_sprintf(key_str, "DE/%d", pid);
if (tdb_store(wcache->tdb, string_tdb_data(key_str),
- make_tdb_data(response->extra_data,
+ make_tdb_data(response->extra_data.data,
response->length - sizeof(*response)),
TDB_REPLACE) == 0)
return;
@@ -1958,7 +1958,7 @@ BOOL cache_retrieve_response(pid_t pid, struct winbindd_response * response)
SAFE_FREE(data.dptr);
if (response->length == sizeof(*response)) {
- response->extra_data = NULL;
+ response->extra_data.data = NULL;
return True;
}
@@ -1983,7 +1983,7 @@ BOOL cache_retrieve_response(pid_t pid, struct winbindd_response * response)
dump_data(11, data.dptr, data.dsize);
- response->extra_data = data.dptr;
+ response->extra_data.data = data.dptr;
return True;
}
diff --git a/source3/nsswitch/winbindd_dual.c b/source3/nsswitch/winbindd_dual.c
index cdfa1e0493..d978a6adf7 100644
--- a/source3/nsswitch/winbindd_dual.c
+++ b/source3/nsswitch/winbindd_dual.c
@@ -52,25 +52,25 @@ static void child_read_request(struct winbindd_cli_state *state)
}
if (state->request.extra_len == 0) {
- state->request.extra_data = NULL;
+ state->request.extra_data.data = NULL;
return;
}
DEBUG(10, ("Need to read %d extra bytes\n", (int)state->request.extra_len));
- state->request.extra_data =
+ state->request.extra_data.data =
SMB_MALLOC_ARRAY(char, state->request.extra_len + 1);
- if (state->request.extra_data == NULL) {
+ if (state->request.extra_data.data == NULL) {
DEBUG(0, ("malloc failed\n"));
state->finished = True;
return;
}
/* Ensure null termination */
- state->request.extra_data[state->request.extra_len] = '\0';
+ state->request.extra_data.data[state->request.extra_len] = '\0';
- len = read_data(state->sock, state->request.extra_data,
+ len = read_data(state->sock, state->request.extra_data.data,
state->request.extra_len);
if (len != state->request.extra_len) {
@@ -153,7 +153,7 @@ static void async_main_request_sent(void *private_data, BOOL success)
return;
}
- setup_async_write(&state->child->event, state->request->extra_data,
+ setup_async_write(&state->child->event, state->request->extra_data.data,
state->request->extra_len,
async_request_sent, state);
}
@@ -728,11 +728,11 @@ static BOOL fork_domain_child(struct winbindd_child *child)
state.request.null_term = '\0';
child_process_request(child->domain, &state);
- SAFE_FREE(state.request.extra_data);
+ SAFE_FREE(state.request.extra_data.data);
cache_store_response(sys_getpid(), &state.response);
- SAFE_FREE(state.response.extra_data);
+ SAFE_FREE(state.response.extra_data.data);
/* We just send the result code back, the result
* structure needs to be fetched via the
diff --git a/source3/nsswitch/winbindd_group.c b/source3/nsswitch/winbindd_group.c
index 547f4f2ec8..96308a31a7 100644
--- a/source3/nsswitch/winbindd_group.c
+++ b/source3/nsswitch/winbindd_group.c
@@ -322,7 +322,7 @@ void winbindd_getgrnam(struct winbindd_cli_state *state)
state->response.data.gr.gr_mem_ofs = 0;
state->response.length += gr_mem_len;
- state->response.extra_data = gr_mem;
+ state->response.extra_data.data = gr_mem;
request_ok(state);
}
@@ -416,7 +416,7 @@ void winbindd_getgrgid(struct winbindd_cli_state *state)
state->response.data.gr.gr_mem_ofs = 0;
state->response.length += gr_mem_len;
- state->response.extra_data = gr_mem;
+ state->response.extra_data.data = gr_mem;
request_ok(state);
}
@@ -635,17 +635,17 @@ void winbindd_getgrent(struct winbindd_cli_state *state)
num_groups = MIN(MAX_GETGRENT_GROUPS, state->request.data.num_entries);
- if ((state->response.extra_data = SMB_MALLOC_ARRAY(struct winbindd_gr, num_groups)) == NULL) {
+ if ((state->response.extra_data.data = SMB_MALLOC_ARRAY(struct winbindd_gr, num_groups)) == NULL) {
request_error(state);
return;
}
- memset(state->response.extra_data, '\0',
+ memset(state->response.extra_data.data, '\0',
num_groups * sizeof(struct winbindd_gr) );
state->response.data.num_entries = 0;
- group_list = (struct winbindd_gr *)state->response.extra_data;
+ group_list = (struct winbindd_gr *)state->response.extra_data.data;
if (!state->getgrent_initialized)
winbindd_setgrent_internal(state);
@@ -826,11 +826,11 @@ void winbindd_getgrent(struct winbindd_cli_state *state)
if (group_list_ndx == 0)
goto done;
- state->response.extra_data = SMB_REALLOC(
- state->response.extra_data,
+ state->response.extra_data.data = SMB_REALLOC(
+ state->response.extra_data.data,
group_list_ndx * sizeof(struct winbindd_gr) + gr_mem_list_len);
- if (!state->response.extra_data) {
+ if (!state->response.extra_data.data) {
DEBUG(0, ("out of memory\n"));
group_list_ndx = 0;
SAFE_FREE(gr_mem_list);
@@ -838,7 +838,7 @@ void winbindd_getgrent(struct winbindd_cli_state *state)
return;
}
- memcpy(&((char *)state->response.extra_data)
+ memcpy(&((char *)state->response.extra_data.data)
[group_list_ndx * sizeof(struct winbindd_gr)],
gr_mem_list, gr_mem_list_len);
@@ -934,7 +934,7 @@ void winbindd_list_groups(struct winbindd_cli_state *state)
/* Assign extra_data fields in response structure */
if (extra_data) {
extra_data[extra_data_len - 1] = '\0';
- state->response.extra_data = extra_data;
+ state->response.extra_data.data = extra_data;
state->response.length += extra_data_len;
}
@@ -1098,7 +1098,7 @@ static void getgroups_sid2gid_recv(void *private_data, BOOL success, gid_t gid)
}
s->state->response.data.num_entries = s->num_token_gids;
- s->state->response.extra_data = s->token_gids;
+ s->state->response.extra_data.data = s->token_gids;
s->state->response.length += s->num_token_gids * sizeof(gid_t);
request_ok(s->state);
}
@@ -1178,7 +1178,7 @@ 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 = ret;
+ state->response.extra_data.data = ret;
state->response.length += ret_size;
request_ok(state);
}
@@ -1237,7 +1237,7 @@ enum winbindd_result winbindd_dual_getuserdomgroups(struct winbindd_domain *doma
if (num_groups == 0) {
state->response.data.num_entries = 0;
- state->response.extra_data = NULL;
+ state->response.extra_data.data = NULL;
return WINBINDD_OK;
}
@@ -1246,7 +1246,7 @@ enum winbindd_result winbindd_dual_getuserdomgroups(struct winbindd_domain *doma
return WINBINDD_ERROR;
}
- state->response.extra_data = sidstring;
+ state->response.extra_data.data = sidstring;
state->response.length += len+1;
state->response.data.num_entries = num_groups;
diff --git a/source3/nsswitch/winbindd_misc.c b/source3/nsswitch/winbindd_misc.c
index b6aecae393..9413a79aba 100644
--- a/source3/nsswitch/winbindd_misc.c
+++ b/source3/nsswitch/winbindd_misc.c
@@ -161,7 +161,7 @@ enum winbindd_result winbindd_dual_list_trusted_domains(struct winbindd_domain *
extra_data_len = strlen(extra_data);
if (extra_data_len > 0) {
- state->response.extra_data = SMB_STRDUP(extra_data);
+ state->response.extra_data.data = SMB_STRDUP(extra_data);
state->response.length += extra_data_len+1;
}
@@ -319,7 +319,7 @@ static void sequence_recv(void *private_data, BOOL success)
cli_state->response.length =
sizeof(cli_state->response) +
strlen(state->extra_data) + 1;
- cli_state->response.extra_data =
+ cli_state->response.extra_data.data =
SMB_STRDUP(state->extra_data);
request_ok(cli_state);
return;
@@ -503,8 +503,8 @@ void winbindd_priv_pipe_dir(struct winbindd_cli_state *state)
DEBUG(3, ("[%5lu]: request location of privileged pipe\n",
(unsigned long)state->pid));
- state->response.extra_data = SMB_STRDUP(get_winbind_priv_pipe_dir());
- if (!state->response.extra_data) {
+ state->response.extra_data.data = SMB_STRDUP(get_winbind_priv_pipe_dir());
+ if (!state->response.extra_data.data) {
DEBUG(0, ("malloc failed\n"));
request_error(state);
return;
@@ -512,7 +512,7 @@ void winbindd_priv_pipe_dir(struct winbindd_cli_state *state)
/* must add one to length to copy the 0 for string termination */
state->response.length +=
- strlen((char *)state->response.extra_data) + 1;
+ strlen((char *)state->response.extra_data.data) + 1;
request_ok(state);
}
diff --git a/source3/nsswitch/winbindd_nss.h b/source3/nsswitch/winbindd_nss.h
index c5ca507bda..5d0b1efaed 100644
--- a/source3/nsswitch/winbindd_nss.h
+++ b/source3/nsswitch/winbindd_nss.h
@@ -155,8 +155,8 @@ typedef struct winbindd_gr {
fstring gr_name;
fstring gr_passwd;
gid_t gr_gid;
- size_t num_gr_mem;
- size_t gr_mem_ofs; /* offset to group membership */
+ uint32 num_gr_mem;
+ uint32 gr_mem_ofs; /* offset to group membership */
char **gr_mem;
} WINBINDD_GR;
@@ -257,8 +257,13 @@ struct winbindd_request {
} dual_idmapset;
BOOL list_all_domains;
} data;
- char *extra_data;
- size_t extra_len;
+ union {
+#if defined(uint64)
+ uint64 z;
+#endif
+ char *data;
+ } extra_data;
+ uint32 extra_len;
char null_term;
};
@@ -376,7 +381,12 @@ struct winbindd_response {
/* Variable length return data */
- void *extra_data; /* getgrnam, getgrgid, getgrent */
+ union {
+#if defined(uint64)
+ uint64 z;
+#endif
+ void *data;
+ } extra_data;
};
struct WINBINDD_CCACHE_ENTRY {
diff --git a/source3/nsswitch/winbindd_pam.c b/source3/nsswitch/winbindd_pam.c
index 44af66022e..6f07729493 100644
--- a/source3/nsswitch/winbindd_pam.c
+++ b/source3/nsswitch/winbindd_pam.c
@@ -97,13 +97,13 @@ static NTSTATUS append_info3_as_ndr(TALLOC_CTX *mem_ctx,
}
size = prs_data_size(&ps);
- state->response.extra_data = SMB_MALLOC(size);
- if (!state->response.extra_data) {
+ state->response.extra_data.data = SMB_MALLOC(size);
+ if (!state->response.extra_data.data) {
prs_mem_free(&ps);
return NT_STATUS_NO_MEMORY;
}
- memset( state->response.extra_data, '\0', size );
- prs_copy_all_data_out(state->response.extra_data, &ps);
+ memset( state->response.extra_data.data, '\0', size );
+ prs_copy_all_data_out(state->response.extra_data.data, &ps);
state->response.length += size;
prs_mem_free(&ps);
return NT_STATUS_OK;
@@ -1311,12 +1311,12 @@ done:
cell += 1;
/* Append an AFS token string */
- state->response.extra_data =
+ state->response.extra_data.data =
afs_createtoken_str(afsname, cell);
- if (state->response.extra_data != NULL)
+ if (state->response.extra_data.data != NULL)
state->response.length +=
- strlen(state->response.extra_data)+1;
+ strlen(state->response.extra_data.data)+1;
no_token:
TALLOC_FREE(afsname);
@@ -1560,12 +1560,12 @@ enum winbindd_result winbindd_dual_pam_auth_crap(struct winbindd_domain *domain,
DEBUG(5, ("Setting unix username to [%s]\n", username_out));
- state->response.extra_data = SMB_STRDUP(username_out);
- if (!state->response.extra_data) {
+ state->response.extra_data.data = SMB_STRDUP(username_out);
+ if (!state->response.extra_data.data) {
result = NT_STATUS_NO_MEMORY;
goto done;
}
- state->response.length += strlen(state->response.extra_data)+1;
+ state->response.length += strlen(state->response.extra_data.data)+1;
}
if (state->request.flags & WBFLAG_PAM_USER_SESSION_KEY) {
diff --git a/source3/nsswitch/winbindd_user.c b/source3/nsswitch/winbindd_user.c
index 9b0796fb67..6179e497b7 100644
--- a/source3/nsswitch/winbindd_user.c
+++ b/source3/nsswitch/winbindd_user.c
@@ -632,15 +632,15 @@ void winbindd_getpwent(struct winbindd_cli_state *state)
num_users = MIN(MAX_GETPWENT_USERS, state->request.data.num_entries);
- if ((state->response.extra_data = SMB_MALLOC_ARRAY(struct winbindd_pw, num_users)) == NULL) {
+ if ((state->response.extra_data.data = SMB_MALLOC_ARRAY(struct winbindd_pw, num_users)) == NULL) {
request_error(state);
return;
}
- memset(state->response.extra_data, 0, num_users *
+ memset(state->response.extra_data.data, 0, num_users *
sizeof(struct winbindd_pw));
- user_list = (struct winbindd_pw *)state->response.extra_data;
+ user_list = (struct winbindd_pw *)state->response.extra_data.data;
if (!state->getpwent_initialized)
winbindd_setpwent_internal(state);
@@ -795,7 +795,7 @@ void winbindd_list_users(struct winbindd_cli_state *state)
if (extra_data) {
extra_data[extra_data_len - 1] = '\0';
- state->response.extra_data = extra_data;
+ state->response.extra_data.data = extra_data;
state->response.length += extra_data_len;
}
diff --git a/source3/nsswitch/winbindd_util.c b/source3/nsswitch/winbindd_util.c
index 16fab6d7e5..d64345a36f 100644
--- a/source3/nsswitch/winbindd_util.c
+++ b/source3/nsswitch/winbindd_util.c
@@ -236,7 +236,7 @@ static void trustdom_recv(void *private_data, BOOL success)
return;
}
- p = response->extra_data;
+ p = response->extra_data.data;
while ((p != NULL) && (*p != '\0')) {
char *q, *sidstr, *alt_name;
@@ -288,7 +288,7 @@ static void trustdom_recv(void *private_data, BOOL success)
p += 1;
}
- SAFE_FREE(response->extra_data);
+ SAFE_FREE(response->extra_data.data);
talloc_destroy(state->mem_ctx);
}