r15053: fix portabilities issues between 32-bit winbind clients and a 64-bit winbindd...
authorGerald Carter <jerry@samba.org>
Wed, 12 Apr 2006 14:10:39 +0000 (14:10 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:16:00 +0000 (11:16 -0500)
(This used to be commit a95d11345e76948b147bbc1f29a05c978d99a47a)

22 files changed:
source3/auth/auth_winbind.c
source3/configure.in
source3/include/includes.h
source3/nsswitch/wb_client.c
source3/nsswitch/wb_common.c
source3/nsswitch/wbinfo.c
source3/nsswitch/winbind_nss_aix.c
source3/nsswitch/winbind_nss_config.h
source3/nsswitch/winbind_nss_irix.c
source3/nsswitch/winbind_nss_linux.c
source3/nsswitch/winbindd.c
source3/nsswitch/winbindd_async.c
source3/nsswitch/winbindd_cache.c
source3/nsswitch/winbindd_dual.c
source3/nsswitch/winbindd_group.c
source3/nsswitch/winbindd_misc.c
source3/nsswitch/winbindd_nss.h
source3/nsswitch/winbindd_pam.c
source3/nsswitch/winbindd_user.c
source3/nsswitch/winbindd_util.c
source3/utils/net_rpc.c
source3/utils/ntlm_auth.c

index 6e2f26a57222d8b81c3e9cb810221bc9f0ba0317..4836d62ef965c9c4625ae46192c2559da17dc63c 100644 (file)
@@ -32,7 +32,7 @@ static NTSTATUS get_info3_from_ndr(TALLOC_CTX *mem_ctx, struct winbindd_response
        size_t len = response->length - sizeof(struct winbindd_response);
        prs_struct ps;
        if (len > 0) {
-               info3_ndr = response->extra_data;
+               info3_ndr = response->extra_data.data;
                if (!prs_init(&ps, len, mem_ctx, UNMARSHALL)) {
                        return NT_STATUS_NO_MEMORY;
                }
@@ -124,7 +124,7 @@ static NTSTATUS check_winbind_security(const struct auth_context *auth_context,
 
        nt_status = NT_STATUS(response.data.auth.nt_status);
 
-       if (result == NSS_STATUS_SUCCESS && response.extra_data) {
+       if (result == NSS_STATUS_SUCCESS && response.extra_data.data) {
                if (NT_STATUS_IS_OK(nt_status)) {
                        if (NT_STATUS_IS_OK(nt_status = get_info3_from_ndr(mem_ctx, &response, &info3))) { 
                                nt_status = make_server_info_info3(mem_ctx, 
@@ -138,7 +138,7 @@ static NTSTATUS check_winbind_security(const struct auth_context *auth_context,
                nt_status = NT_STATUS_NO_LOGON_SERVERS;
        }
 
-       SAFE_FREE(response.extra_data);
+       SAFE_FREE(response.extra_data.data);
         return nt_status;
 }
 
index 386f83172a20e9c59f5720683b82c5b9f65ffdbf..2e4d8db8765e6572861b427d088b77ec20eae536 100644 (file)
@@ -914,6 +914,7 @@ AC_CHECK_HEADERS(utmp.h utmpx.h lastlog.h)
  
 AC_CHECK_SIZEOF(int,cross)
 AC_CHECK_SIZEOF(long,cross)
+AC_CHECK_SIZEOF(long long,cross)
 AC_CHECK_SIZEOF(short,cross)
 
 AC_C_CONST
index b96bd19fd83dc2b33c8813b00837259b5037ddfb..1e59f50008d271cede9712178d43dbef8ea3b392 100644 (file)
@@ -638,6 +638,19 @@ typedef int socklen_t;
 #endif
 #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
+
+
 /*
  * Types for devices, inodes and offsets.
  */
index b2db25c31bc8d50499e9fd23d7172700385c7c41..de1edf054d117e9a4cf38b3b9e049802993db1df 100644 (file)
@@ -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;
        }
 
index 91ec912b7d0fa8495564312f9def0c7a55da6007..91ebdbd58446e6b90937609af83254fa19d16fb3 100644 (file)
@@ -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;
        }
        
index 89ffa6b5b32f81ced03b78928b8d2be10ae112ff..ad5ef71523014bda4cbe7a30e5244150e0d80c49 100644 (file)
@@ -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;
 }
index 0a8bef736caec451a956e90ec8214bc6f570153e..b898e3c3af2a90012c97e0807308ba7088d7efc2 100644 (file)
@@ -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);
 
index a3243b99e302b59f5241f11df5f7eaebbd856294..fbd1bd22b3a196f98893e175308977034af8a11a 100644 (file)
@@ -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))
index 73f3b4f33a0915e75a023963da62fb86f32157fe..fd15f57940b89aa7454437d6e99bd5552d7196fe 100644 (file)
@@ -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);
index c0b8bf3a75d475a48a9c43de725e740376bfa729..78a39f2873178f6f6b71a2d848fda83a65e844df 100644 (file)
@@ -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:
index b31841627298e64394cef63e03a09fd4d5b8a95c..997991a8c62532ccfb75b3daac16b8abdef4dee3 100644 (file)
@@ -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);
index 543dc884709583d240b7d0c985b7acb5493c5afc..7f282df929d50749290048a1f1d744aaf273b97b 100644 (file)
@@ -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"));
index f96f03290daaf0ecb3d939732076eb6ea7c8eab2..69a4c8eda3bc20f958f844b955adf61276fae107 100644 (file)
@@ -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;
 }
 
index cdfa1e049320f9c7b9faf1a09e86266b531fded9..d978a6adf79deedc9f04adfe15d8501badd3f9a6 100644 (file)
@@ -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
index 547f4f2ec8032945643b47c720d6a33783686521..96308a31a7f419bbefb44b682183ce12183fe754 100644 (file)
@@ -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;
 
index b6aecae393013d25bdd1f0451f0971f97e454dec..9413a79abaa5bf7846031956a896d9f808098964 100644 (file)
@@ -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);
 }
index c5ca507bda6ed77be3edec3b6047aad85a59bbec..5d0b1efaedc234e6f4e561e082cf2d6ca8e18177 100644 (file)
@@ -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 {
index 44af66022eca18786377ae91c65fe8c1af732b33..6f077294934fb21fac02510130765e46fcd6de10 100644 (file)
@@ -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) {
index 9b0796fb67048619b1f8710dc26843390fbf7320..6179e497b787bfdcdedb64448f3c684a60cf9e18 100644 (file)
@@ -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;
        }
 
index 16fab6d7e5ce88bccd68d59fd41c69bf9e13fa63..d64345a36f3a8f127196eb2b2d5222e910d2a32a 100644 (file)
@@ -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);
 }
 
index 420bc1245e3da1229a6623c75881d903f74e4fc9..561be2a41e69ad410635706c524b752345322b71 100644 (file)
@@ -4212,7 +4212,7 @@ static BOOL get_user_sids(const char *domain, const char *user, NT_USER_TOKEN *t
        }
 
        for (i = 0; i < response.data.num_entries; i++) {
-               gid_t gid = ((gid_t *)response.extra_data)[i];
+               gid_t gid = ((gid_t *)response.extra_data.data)[i];
                DOM_SID sid;
 
                struct winbindd_request sidrequest;
@@ -4238,7 +4238,7 @@ static BOOL get_user_sids(const char *domain, const char *user, NT_USER_TOKEN *t
                add_sid_to_token(token, &sid);
        }
 
-       SAFE_FREE(response.extra_data);
+       SAFE_FREE(response.extra_data.data);
 
        return True;
 }
@@ -4274,10 +4274,10 @@ static BOOL get_user_tokens(int *num_tokens, struct user_token **user_tokens)
 
        /* 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;
        *num_tokens = 0;
 
        while(next_token(&extra_data, name, ",", sizeof(fstring))) {
@@ -4291,7 +4291,7 @@ static BOOL get_user_tokens(int *num_tokens, struct user_token **user_tokens)
                return False;
        }
 
-       extra_data = (const char *)response.extra_data;
+       extra_data = (const char *)response.extra_data.data;
        i=0;
 
        while(next_token(&extra_data, name, ",", sizeof(fstring))) {
@@ -4319,7 +4319,7 @@ static BOOL get_user_tokens(int *num_tokens, struct user_token **user_tokens)
                i+=1;
        }
        
-       SAFE_FREE(response.extra_data);
+       SAFE_FREE(response.extra_data.data);
 
        *user_tokens = result;
 
index f7e3263fe0f7774fc2a425b441eff51c93d01936..2e879cc113250dd12249acf3486c133b849c04e8 100644 (file)
@@ -380,7 +380,7 @@ NTSTATUS contact_winbind_auth_crap(const char *username,
        }
 
        if (flags & WBFLAG_PAM_UNIX_NAME) {
-               *unix_name = SMB_STRDUP((char *)response.extra_data);
+               *unix_name = SMB_STRDUP((char *)response.extra_data.data);
                if (!*unix_name) {
                        free_response(&response);
                        return NT_STATUS_NO_MEMORY;