diff options
author | Gerald Carter <jerry@samba.org> | 2006-07-18 20:19:55 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:38:13 -0500 |
commit | 97c665db90dc957e377f50092d7d8a6f63f5f2c0 (patch) | |
tree | 65a83a3b8ea55ccad1363a80bd2a4e356faf6aba | |
parent | ccee54b60504f5aefbd5857e121932895a5e33a4 (diff) | |
download | samba-97c665db90dc957e377f50092d7d8a6f63f5f2c0.tar.gz samba-97c665db90dc957e377f50092d7d8a6f63f5f2c0.tar.bz2 samba-97c665db90dc957e377f50092d7d8a6f63f5f2c0.zip |
r17123: Fix 32bit/64bit portability issues again.
NO NOT change the winbindd response or request structures
*unless* you test a 32bit wbinfo against a 64bit winbindd.
The structure sizes MUST be the same on 32bit and 64 bit
platforms.
The way to test is to build a 64bit version of Winbind as normal.
Then build a 32bit version using gcc -m32. Now install the 64bit and
32bit versions of libnss_winbindd.so and launch the 64bit winbindd.
Make sure that the responses from both 32bit and 64bit versions
of wbinfo match.
If you don't understand the previous paragraph you don't need to
be changing nsswitch/winbindd_nss.h
(This used to be commit bc03141429273703c540d6120b0c5ca4d0949266)
-rw-r--r-- | source3/nsswitch/winbindd_nss.h | 76 |
1 files changed, 54 insertions, 22 deletions
diff --git a/source3/nsswitch/winbindd_nss.h b/source3/nsswitch/winbindd_nss.h index a7c0c9f99c..c4217220cc 100644 --- a/source3/nsswitch/winbindd_nss.h +++ b/source3/nsswitch/winbindd_nss.h @@ -4,6 +4,7 @@ Winbind daemon for ntdom nss module Copyright (C) Tim Potter 2000 + Copyright (C) Gerald Carter 2006 You are free to use this interface definition in any way you see fit, including without restriction, using this header in your own @@ -36,6 +37,17 @@ #define WINBIND_INTERFACE_VERSION 16 +/* Have to deal with time_t being 4 or 8 bytes due to structure alignment. + On a 64bit Linux box, we have to support a constant structure size + between /lib/libnss_winbind.so.2 and /li64/libnss_winbind.so.2. + The easiest way to do this is to always use 8byte values for time_t. */ + +#if defined(uint64) +# define SMB_TIME_T uint64 +#else +# define SMB_TIME_t time_t +#endif + /* Socket commands */ enum winbindd_cmd { @@ -186,6 +198,14 @@ typedef struct winbindd_gr { /* Winbind request structure */ +/******************************************************************************* + * This structure MUST be the same size in the 32bit and 64bit builds + * for compatibility between /lib64/libnss_winbind.so and /lib/libnss_winbind.so + * + * DO NOT CHANGE THIS STRUCTURE WITHOUT TESTING THE 32BIT NSS LIB AGAINST + * A 64BIT WINBINDD --jerry + ******************************************************************************/ + struct winbindd_request { uint32 length; enum winbindd_cmd cmd; /* Winbindd command to execute */ @@ -215,9 +235,9 @@ struct winbindd_request { fstring user; fstring domain; fstring lm_resp; - uint16 lm_resp_len; + uint32 lm_resp_len; fstring nt_resp; - uint16 nt_resp_len; + uint32 nt_resp_len; fstring workstation; fstring require_membership_of_sid; } auth_crap; @@ -269,11 +289,15 @@ struct winbindd_request { fstring sid; } dual_idmapset; BOOL list_all_domains; + + /* padding -- needed to fix alignment between 32bit and 64bit libs. + The size if the sizeof the union without the padding aligned on + an 8 byte boundary. --jerry */ + + char padding[1560]; } data; union { -#if defined(uint64) - uint64 z; -#endif + SMB_TIME_T padding; char *data; } extra_data; uint32 extra_len; @@ -290,6 +314,14 @@ enum winbindd_result { /* Winbind response structure */ +/******************************************************************************* + * This structure MUST be the same size in the 32bit and 64bit builds + * for compatibility between /lib64/libnss_winbind.so and /lib/libnss_winbind.so + * + * DO NOT CHANGE THIS STRUCTURE WITHOUT TESTING THE 32BIT NSS LIB AGAINST + * A 64BIT WINBINDD --jerry + ******************************************************************************/ + struct winbindd_response { /* Header information */ @@ -340,30 +372,32 @@ struct winbindd_response { char user_session_key[16]; char first_8_lm_hash[8]; fstring krb5ccname; + uint32 reject_reason; + uint32 padding; struct policy_settings { - uint16 min_length_password; - uint16 password_history; + uint32 min_length_password; + uint32 password_history; uint32 password_properties; - time_t expire; - time_t min_passwordage; + uint32 padding; + SMB_TIME_T expire; + SMB_TIME_T min_passwordage; } policy; - uint32 reject_reason; struct info3_text { - time_t logon_time; - time_t logoff_time; - time_t kickoff_time; - time_t pass_last_set_time; - time_t pass_can_change_time; - time_t pass_must_change_time; - uint16 logon_count; - uint16 bad_pw_count; + SMB_TIME_T logon_time; + SMB_TIME_T logoff_time; + SMB_TIME_T kickoff_time; + SMB_TIME_T pass_last_set_time; + SMB_TIME_T pass_can_change_time; + SMB_TIME_T pass_must_change_time; + uint32 logon_count; + uint32 bad_pw_count; uint32 user_rid; uint32 group_rid; - fstring dom_sid; uint32 num_groups; uint32 user_flgs; uint32 acct_flags; uint32 num_other_sids; + fstring dom_sid; fstring user_name; fstring full_name; fstring logon_script; @@ -395,9 +429,7 @@ struct winbindd_response { /* Variable length return data */ union { -#if defined(uint64) - uint64 z; -#endif + SMB_TIME_T padding; void *data; } extra_data; }; |