From: Gerald Carter Date: Fri, 6 Apr 2007 18:52:30 +0000 (+0000) Subject: r22104: BUG 4439: Fix the object picket on x64 WIndopws XP/2003. X-Git-Tag: samba-4.0.0alpha6~801^2~6189 X-Git-Url: http://git.samba.org/?p=samba.git;a=commitdiff_plain;h=a1e72969d571d6b12f4cfa8c6dc16d7d982daa51 r22104: BUG 4439: Fix the object picket on x64 WIndopws XP/2003. Enable the DsRoleGetPrimaryDomainInfo() server code. Tested by Win2000/XP/2003/Vista (x86) and WinXP (x64) (This used to be commit eab9ca7e7d8d7dc3e705720f8bc5dff5c8ec5f5f) --- diff --git a/source3/include/rpc_ds.h b/source3/include/rpc_ds.h index bfe5179490c..4ca49871f6d 100644 --- a/source3/include/rpc_ds.h +++ b/source3/include/rpc_ds.h @@ -44,6 +44,7 @@ /* machine role */ +#define DSROLE_DOMAIN_MEMBER_WKS 1 #define DSROLE_STANDALONE_SRV 2 #define DSROLE_DOMAIN_MEMBER_SRV 3 #define DSROLE_BDC 4 @@ -60,18 +61,13 @@ typedef struct { uint16 machine_role; - uint16 unknown; /* 0x6173 -- maybe just alignment? */ - - uint32 flags; - + uint32 flags; uint32 netbios_ptr; uint32 dnsname_ptr; uint32 forestname_ptr; - struct GUID domain_guid; - + struct GUID domain_guid; UNISTR2 netbios_domain; - UNISTR2 dns_domain; /* our dns domain */ UNISTR2 forest_domain; /* root domain of the forest to which we belong */ } DSROLE_PRIMARY_DOMAIN_INFO_BASIC; diff --git a/source3/rpc_parse/parse_ds.c b/source3/rpc_parse/parse_ds.c index c6131452226..61300f8a8d4 100644 --- a/source3/rpc_parse/parse_ds.c +++ b/source3/rpc_parse/parse_ds.c @@ -37,7 +37,7 @@ static BOOL ds_io_dominfobasic(const char *desc, DSROLE_PRIMARY_DOMAIN_INFO_BASI if ( !prs_uint16("machine_role", ps, depth, &p->machine_role) ) return False; - if ( !prs_uint16("unknown", ps, depth, &p->unknown) ) + if ( !prs_align(ps) ) return False; if ( !prs_uint32("flags", ps, depth, &p->flags) ) diff --git a/source3/rpc_server/srv_lsa_ds.c b/source3/rpc_server/srv_lsa_ds.c index 1e75175c2cd..db741a1b64a 100644 --- a/source3/rpc_server/srv_lsa_ds.c +++ b/source3/rpc_server/srv_lsa_ds.c @@ -25,9 +25,7 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_SRV -#if 0 /* disabled */ /******************************************************************* - api_reg_open_entry ********************************************************************/ static BOOL api_dsrole_get_primary_dominfo(pipes_struct *p) @@ -41,18 +39,17 @@ static BOOL api_dsrole_get_primary_dominfo(pipes_struct *p) ZERO_STRUCT(r_u); /* grab the request */ - if ( !ds_io_q_getprimdominfo("", data, 0, &q_u) ) + if ( !ds_io_q_getprimdominfo("", &q_u, data, 0) ) return False; /* construct reply. */ r_u.status = _dsrole_get_primary_dominfo( p, &q_u, &r_u ); - if ( !ds_io_r_getprimdominfo("", rdata, 0, &r_u) ) + if ( !ds_io_r_getprimdominfo("", &r_u, rdata, 0) ) return False; return True; } -#endif /******************************************************************* stub functions for unimplemented RPC @@ -70,12 +67,8 @@ static BOOL api_dsrole_stub( pipes_struct *p ) array of \PIPE\lsass (new windows 2000 UUID) operations ********************************************************************/ static struct api_struct api_lsa_ds_cmds[] = { - { "DS_NOP", DS_NOP, api_dsrole_stub } - -#if 0 /* disabled due to breakage with viewing domain users and groups - on a Samba PDC from win2k clients --jerry CIFS 2003 */ + { "DS_NOP", DS_NOP, api_dsrole_stub }, { "DS_GETPRIMDOMINFO", DS_GETPRIMDOMINFO, api_dsrole_get_primary_dominfo } -#endif }; diff --git a/source3/rpc_server/srv_lsa_ds_nt.c b/source3/rpc_server/srv_lsa_ds_nt.c index b410af8dedf..844a20eed42 100644 --- a/source3/rpc_server/srv_lsa_ds_nt.c +++ b/source3/rpc_server/srv_lsa_ds_nt.c @@ -46,49 +46,54 @@ static NTSTATUS fill_dsrole_dominfo_basic(TALLOC_CTX *ctx, DSROLE_PRIMARY_DOMAIN return NT_STATUS_NO_MEMORY; } - get_mydnsdomname(dnsdomain); - strlower_m(dnsdomain); - switch ( lp_server_role() ) { case ROLE_STANDALONE: basic->machine_role = DSROLE_STANDALONE_SRV; + basic->netbios_ptr = 1; + netbios_domain = get_global_sam_name(); break; case ROLE_DOMAIN_MEMBER: + basic->netbios_ptr = 1; + netbios_domain = lp_workgroup(); basic->machine_role = DSROLE_DOMAIN_MEMBER_SRV; break; case ROLE_DOMAIN_BDC: + basic->netbios_ptr = 1; + netbios_domain = get_global_sam_name(); basic->machine_role = DSROLE_BDC; - basic->flags = DSROLE_PRIMARY_DS_RUNNING|DSROLE_PRIMARY_DS_MIXED_MODE; - if ( secrets_fetch_domain_guid( lp_workgroup(), &basic->domain_guid ) ) - basic->flags |= DSROLE_PRIMARY_DOMAIN_GUID_PRESENT; break; case ROLE_DOMAIN_PDC: + basic->netbios_ptr = 1; + netbios_domain = get_global_sam_name(); basic->machine_role = DSROLE_PDC; - basic->flags = DSROLE_PRIMARY_DS_RUNNING|DSROLE_PRIMARY_DS_MIXED_MODE; - if ( secrets_fetch_domain_guid( lp_workgroup(), &basic->domain_guid ) ) - basic->flags |= DSROLE_PRIMARY_DOMAIN_GUID_PRESENT; break; } - basic->unknown = 0x6173; /* seen on the wire; maybe padding */ - /* always set netbios name */ - basic->netbios_ptr = 1; - netbios_domain = get_global_sam_name(); - init_unistr2( &basic->netbios_domain, netbios_domain, UNI_FLAGS_NONE); + init_unistr2( &basic->netbios_domain, netbios_domain, UNI_STR_TERMINATE); - basic->dnsname_ptr = 1; - init_unistr2( &basic->dns_domain, dnsdomain, UNI_FLAGS_NONE); - basic->forestname_ptr = 1; - init_unistr2( &basic->forest_domain, dnsdomain, UNI_FLAGS_NONE); - + if ( secrets_fetch_domain_guid( lp_workgroup(), &basic->domain_guid ) ) + basic->flags |= DSROLE_PRIMARY_DOMAIN_GUID_PRESENT; /* fill in some additional fields if we are a member of an AD domain */ - if ( lp_security() == SEC_ADS ) { - /* TODO */ - ;; + if ( lp_security() == SEC_ADS ) { + fstrcpy( dnsdomain, lp_realm() ); + strlower_m( dnsdomain ); + + basic->dnsname_ptr = 1; + init_unistr2( &basic->dns_domain, dnsdomain, UNI_STR_TERMINATE); + basic->forestname_ptr = 1; + init_unistr2( &basic->forest_domain, dnsdomain, UNI_STR_TERMINATE); + } else { + get_mydnsdomname(dnsdomain); + strlower_m(dnsdomain); + + basic->dnsname_ptr = 1; + init_unistr2( &basic->dns_domain, dnsdomain, UNI_FLAGS_NONE); + basic->forestname_ptr = 1; + init_unistr2( &basic->forest_domain, dnsdomain, UNI_FLAGS_NONE); } *info = basic;