diff options
author | Andrew Bartlett <abartlet@samba.org> | 2004-11-13 13:45:41 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:05:47 -0500 |
commit | 50916c8f2fd3e1c8e56b74bbed95d72f328637bc (patch) | |
tree | 34c110d378367a45fe05ed5682f3a6eeecaa52d8 /source4 | |
parent | d309966e3191405f5a17555c394b4a1934fbfcab (diff) | |
download | samba-50916c8f2fd3e1c8e56b74bbed95d72f328637bc.tar.gz samba-50916c8f2fd3e1c8e56b74bbed95d72f328637bc.tar.bz2 samba-50916c8f2fd3e1c8e56b74bbed95d72f328637bc.zip |
r3724: Rename a number of structures, for better consistance between SAMR and
NETLOGON.
In particular, rename samr_Name to samr_String - given that many
strings in this pipe are not 'names', the previous was just confusing.
(I look forward to PIDL turning these into simple char * some day...).
Also export out a few changes from testjoin.c to allow for how I have
written the new RPC-SAMSYNC test.
Andrew Bartlett
(This used to be commit 9cd666bcfb1fc752a4717010a7c4f05131dc728e)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/gtk/common/select.c | 2 | ||||
-rw-r--r-- | source4/gtk/tools/gwsam.c | 2 | ||||
-rw-r--r-- | source4/libnet/libnet_passwd.c | 18 | ||||
-rw-r--r-- | source4/librpc/idl/netlogon.idl | 22 | ||||
-rw-r--r-- | source4/librpc/idl/samr.idl | 190 | ||||
-rw-r--r-- | source4/rpc_server/samr/dcesrv_samr.c | 300 | ||||
-rw-r--r-- | source4/rpc_server/samr/samr_password.c | 4 | ||||
-rw-r--r-- | source4/torture/rpc/samr.c | 228 | ||||
-rw-r--r-- | source4/torture/rpc/schannel.c | 6 | ||||
-rw-r--r-- | source4/torture/rpc/testjoin.c | 17 |
10 files changed, 397 insertions, 392 deletions
diff --git a/source4/gtk/common/select.c b/source4/gtk/common/select.c index d5d0d6cac4..46a9140831 100644 --- a/source4/gtk/common/select.c +++ b/source4/gtk/common/select.c @@ -158,7 +158,7 @@ GtkWidget *gtk_select_domain_dialog_new (struct dcerpc_pipe *sam_pipe) for (i=0;i<r.out.sam->count;i++) { GtkTreeIter iter; gtk_list_store_append(d->store_domains, &iter); - gtk_list_store_set (d->store_domains, &iter, 0, r.out.sam->entries[i].name.name, -1); + gtk_list_store_set (d->store_domains, &iter, 0, r.out.sam->entries[i].name.string, -1); } } diff --git a/source4/gtk/tools/gwsam.c b/source4/gtk/tools/gwsam.c index 75029a5d77..2f8e247fff 100644 --- a/source4/gtk/tools/gwsam.c +++ b/source4/gtk/tools/gwsam.c @@ -68,7 +68,7 @@ void update_userlist(void) } for (i=0;i<r.out.sam->count;i++) { - printf("Found: %s\n", r.out.sam->entries[i].name.name); + printf("Found: %s\n", r.out.sam->entries[i].name.string); /* FIXME: Query user info */ // if (!test_OpenUser(sam_pipe, mem_ctx, &sam_handle, r.out.sam->entries[i].idx)) { diff --git a/source4/libnet/libnet_passwd.c b/source4/libnet/libnet_passwd.c index c20a7733a3..60d538369b 100644 --- a/source4/libnet/libnet_passwd.c +++ b/source4/libnet/libnet_passwd.c @@ -43,7 +43,7 @@ static NTSTATUS libnet_ChangePassword_samr(struct libnet_context *ctx, TALLOC_CT struct samr_OemChangePasswordUser2 oe2; struct samr_ChangePasswordUser2 pw2; struct samr_ChangePasswordUser3 pw3; - struct samr_Name server, account; + struct samr_String server, account; struct samr_AsciiName a_server, a_account; struct samr_CryptPassword nt_pass, lm_pass; struct samr_Password nt_verifier, lm_verifier; @@ -67,8 +67,8 @@ static NTSTATUS libnet_ChangePassword_samr(struct libnet_context *ctx, TALLOC_CT } /* prepare password change for account */ - server.name = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(c.pdc.out.dcerpc_pipe)); - account.name = r->samr.in.account_name; + server.string = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(c.pdc.out.dcerpc_pipe)); + account.string = r->samr.in.account_name; E_md4hash(r->samr.in.oldpassword, old_nt_hash); E_md4hash(r->samr.in.newpassword, new_nt_hash); @@ -163,8 +163,8 @@ ChangePasswordUser2: OemChangePasswordUser2: /* prepare samr_OemChangePasswordUser2 */ - a_server.name = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(c.pdc.out.dcerpc_pipe)); - a_account.name = r->samr.in.account_name; + a_server.string = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(c.pdc.out.dcerpc_pipe)); + a_account.string = r->samr.in.account_name; encode_pw_buffer(lm_pass.data, r->samr.in.newpassword, STR_ASCII); arcfour_crypt(lm_pass.data, old_lm_hash, 516); @@ -308,7 +308,7 @@ static NTSTATUS libnet_SetPassword_samr(struct libnet_context *ctx, TALLOC_CTX * struct samr_Connect sc; struct policy_handle p_handle; struct samr_LookupDomain ld; - struct samr_Name d_name; + struct samr_String d_name; struct samr_OpenDomain od; struct policy_handle d_handle; struct samr_LookupNames ln; @@ -362,7 +362,7 @@ static NTSTATUS libnet_SetPassword_samr(struct libnet_context *ctx, TALLOC_CTX * } /* prepare samr_LookupDomain */ - d_name.name = r->samr.in.domain_name; + d_name.string = r->samr.in.domain_name; ld.in.connect_handle = &p_handle; ld.in.domain = &d_name; @@ -412,12 +412,12 @@ static NTSTATUS libnet_SetPassword_samr(struct libnet_context *ctx, TALLOC_CTX * /* prepare samr_LookupNames */ ln.in.domain_handle = &d_handle; ln.in.num_names = 1; - ln.in.names = talloc_array_p(mem_ctx, struct samr_Name, 1); + ln.in.names = talloc_array_p(mem_ctx, struct samr_String, 1); if (!ln.in.names) { r->samr.out.error_string = "Out of Memory"; return NT_STATUS_NO_MEMORY; } - ln.in.names[0].name = r->samr.in.account_name; + ln.in.names[0].string = r->samr.in.account_name; /* 5. do a samr_LookupNames to get the users rid */ status = dcerpc_samr_LookupNames(c.pdc.out.dcerpc_pipe, mem_ctx, &ln); diff --git a/source4/librpc/idl/netlogon.idl b/source4/librpc/idl/netlogon.idl index 37c6949fad..4735d3f725 100644 --- a/source4/librpc/idl/netlogon.idl +++ b/source4/librpc/idl/netlogon.idl @@ -329,15 +329,15 @@ interface netlogon uint32 DataLength; /* netr_USER_KEYS encrypted with the session key */ - [size_is(DataLength)] uint8 *SensitiveData; + [size_is(DataLength)][flag(NDR_PAHEX)] uint8 *SensitiveData; } netr_USER_PRIVATE_INFO; typedef struct { netr_String account_name; netr_String full_name; uint32 rid; - uint32 primary_group; - netr_String home_dir; + uint32 primary_gid; + netr_String home_directory; netr_String home_drive; netr_String logon_script; netr_String description; @@ -345,20 +345,20 @@ interface netlogon NTTIME last_logon; NTTIME last_logoff; samr_LogonHours logon_hours; - uint16 bad_pw_count; + uint16 bad_password_count; uint16 logon_count; NTTIME last_password_change; NTTIME acct_expiry; uint32 acct_flags; samr_Password lmpassword; samr_Password ntpassword; - bool8 ntpassword_present; - bool8 lmpassword_present; + bool8 nt_password_present; + bool8 lm_password_present; bool8 password_expired; - netr_String UserComment; - netr_String Parameters; - uint16 CountryCode; - uint16 CodePage; + netr_String comment; + netr_String parameters; + uint16 country_code; + uint16 code_page; netr_USER_PRIVATE_INFO user_private_info; uint32 SecurityInformation; sec_desc_buf sdbuf; @@ -471,7 +471,7 @@ interface netlogon bool8 auditingmode; uint32 maxauditeventcount; [size_is(maxauditeventcount+1)] uint32 *eventauditoptions; - netr_String primarydomainname; + netr_String primary_domain_name; dom_sid2 *sid; netr_QUOTA_LIMITS quota_limits; uint64 sequence_num; diff --git a/source4/librpc/idl/samr.idl b/source4/librpc/idl/samr.idl index df33066a12..efd812ba0d 100644 --- a/source4/librpc/idl/samr.idl +++ b/source4/librpc/idl/samr.idl @@ -81,14 +81,14 @@ /******************/ /* Function: 0x05 */ typedef struct { - [value(2*strlen_m(r->name))] uint16 name_len; - [value(r->name_len)] uint16 name_size; - unistr_noterm *name; - } samr_Name; + [value(2*strlen_m(r->string))] uint16 length; + [value(r->length)] uint16 size; + unistr_noterm *string; + } samr_String; NTSTATUS samr_LookupDomain ( [in,ref] policy_handle *connect_handle, - [in,ref] samr_Name *domain, + [in,ref] samr_String *domain, [out] dom_sid2 *sid ); @@ -98,7 +98,7 @@ typedef struct { uint32 idx; - samr_Name name; + samr_String name; } samr_SamEntry; typedef struct { @@ -138,9 +138,9 @@ typedef struct { uint64 force_logoff_time; - samr_Name comment; - samr_Name domain; /* domain name */ - samr_Name primary; /* PDC name if this is a BDC */ + samr_String comment; + samr_String domain; /* domain name */ + samr_String primary; /* PDC name if this is a BDC */ uint64 sequence_num; uint32 unknown2; uint32 role; @@ -158,15 +158,15 @@ /* I'm not entirely sure this is a comment. win2003 allows it to be set, and it seems harmless (like a comment) but I haven't seen it show up anywhere */ - samr_Name comment; + samr_String comment; } samr_DomInfo4; typedef struct { - samr_Name domain; + samr_String domain; } samr_DomInfo5; typedef struct { - samr_Name primary; + samr_String primary; } samr_DomInfo6; typedef struct { @@ -240,7 +240,7 @@ /* Function 0x0a */ NTSTATUS samr_CreateDomainGroup( [in,ref] policy_handle *domain_handle, - [in,ref] samr_Name *name, + [in,ref] samr_String *name, [in] uint32 access_mask, [out,ref] policy_handle *group_handle, [out,ref] uint32 *rid @@ -261,7 +261,7 @@ /* Function 0x0c */ NTSTATUS samr_CreateUser( [in,ref] policy_handle *domain_handle, - [in,ref] samr_Name *account_name, + [in,ref] samr_String *account_name, [in] uint32 access_mask, [out,ref] policy_handle *user_handle, [out,ref] uint32 *rid @@ -289,7 +289,7 @@ /* Function 0x0e */ NTSTATUS samr_CreateDomAlias( [in,ref] policy_handle *domain_handle, - [in,ref] samr_Name *aliasname, + [in,ref] samr_String *aliasname, [in] uint32 access_mask, [out,ref] policy_handle *alias_handle, [out,ref] uint32 *rid @@ -337,7 +337,7 @@ NTSTATUS samr_LookupNames( [in,ref] policy_handle *domain_handle, [in,range(0,1000)] uint32 num_names, - [in,ref,size_is(1000),length_is(num_names)] samr_Name *names, + [in,ref,size_is(1000),length_is(num_names)] samr_String *names, [out] samr_Ids rids, [out] samr_Ids types ); @@ -348,14 +348,14 @@ typedef struct { uint32 count; - [size_is(count)] samr_Name *names; - } samr_Names; + [size_is(count)] samr_String *names; + } samr_Strings; NTSTATUS samr_LookupRids( [in,ref] policy_handle *domain_handle, [in,range(0,1000)] uint32 num_rids, [in,ref,size_is(1000),length_is(num_rids)] uint32 *rids, - [out] samr_Names names, + [out] samr_Strings names, [out] samr_Ids types ); @@ -373,10 +373,10 @@ /* Function 0x14 */ typedef struct { - samr_Name name; + samr_String name; uint32 unknown; uint32 num_members; - samr_Name description; + samr_String description; } samr_GroupInfoAll; typedef struct { @@ -384,7 +384,7 @@ } samr_GroupInfoX; typedef struct { - samr_Name description; + samr_String description; } samr_GroupInfoDesciption; typedef enum { @@ -397,9 +397,9 @@ typedef union { [case(GroupInfoAll)] samr_GroupInfoAll all; - [case(GroupInfoName)] samr_Name name; + [case(GroupInfoName)] samr_String name; [case(GroupInfoX)] samr_GroupInfoX unknown; - [case(GroupInfoDescription)] samr_Name description; + [case(GroupInfoDescription)] samr_String description; [case(GroupInfoAll2)] samr_GroupInfoAll all2; } samr_GroupInfo; @@ -483,15 +483,15 @@ /* Function 0x1c */ typedef struct { - samr_Name name; + samr_String name; uint32 num_members; - samr_Name description; + samr_String description; } samr_AliasInfoAll; typedef union { [case(1)] samr_AliasInfoAll all; - [case(2)] samr_Name name; - [case(3)] samr_Name description; + [case(2)] samr_String name; + [case(3)] samr_String description; } samr_AliasInfo; NTSTATUS samr_QueryAliasInfo( @@ -553,16 +553,16 @@ /************************/ /* Function 0x24 */ typedef struct { - samr_Name account_name; - samr_Name full_name; + samr_String account_name; + samr_String full_name; uint32 primary_gid; - samr_Name description; - samr_Name comment; + samr_String description; + samr_String comment; } samr_UserInfo1; typedef struct { - samr_Name comment; - samr_Name unknown; /* settable, but doesn't stick. probably obsolete */ + samr_String comment; + samr_String unknown; /* settable, but doesn't stick. probably obsolete */ uint16 country_code; uint16 code_page; } samr_UserInfo2; @@ -574,15 +574,15 @@ } samr_LogonHours; typedef struct { - samr_Name account_name; - samr_Name full_name; + samr_String account_name; + samr_String full_name; uint32 rid; uint32 primary_gid; - samr_Name home_directory; - samr_Name home_drive; - samr_Name logon_script; - samr_Name profile_path; - samr_Name workstations; + samr_String home_directory; + samr_String home_drive; + samr_String logon_script; + samr_String profile_path; + samr_String workstations; NTTIME last_logon; NTTIME last_logoff; NTTIME last_password_change; @@ -590,7 +590,7 @@ NTTIME force_password_change; samr_LogonHours logon_hours; uint16 bad_password_count; - uint16 num_logons; + uint16 logon_count; uint32 acct_flags; } samr_UserInfo3; @@ -599,37 +599,37 @@ } samr_UserInfo4; typedef struct { - samr_Name account_name; - samr_Name full_name; + samr_String account_name; + samr_String full_name; uint32 rid; uint32 primary_gid; - samr_Name home_directory; - samr_Name home_drive; - samr_Name logon_script; - samr_Name profile_path; - samr_Name description; - samr_Name workstations; + samr_String home_directory; + samr_String home_drive; + samr_String logon_script; + samr_String profile_path; + samr_String description; + samr_String workstations; NTTIME last_logon; NTTIME last_logoff; samr_LogonHours logon_hours; uint16 bad_password_count; - uint16 num_logons; + uint16 logon_count; NTTIME last_password_change; NTTIME acct_expiry; uint32 acct_flags; } samr_UserInfo5; typedef struct { - samr_Name account_name; - samr_Name full_name; + samr_String account_name; + samr_String full_name; } samr_UserInfo6; typedef struct { - samr_Name account_name; + samr_String account_name; } samr_UserInfo7; typedef struct { - samr_Name full_name; + samr_String full_name; } samr_UserInfo8; typedef struct { @@ -637,24 +637,24 @@ } samr_UserInfo9; typedef struct { - samr_Name home_directory; - samr_Name home_drive; + samr_String home_directory; + samr_String home_drive; } samr_UserInfo10; typedef struct { - samr_Name logon_script; + samr_String logon_script; } samr_UserInfo11; typedef struct { - samr_Name profile_path; + samr_String profile_path; } samr_UserInfo12; typedef struct { - samr_Name description; + samr_String description; } samr_UserInfo13; typedef struct { - samr_Name workstations; + samr_String workstations; } samr_UserInfo14; typedef struct { @@ -666,7 +666,7 @@ } samr_UserInfo17; typedef struct { - samr_Name callback; + samr_String parameters; } samr_UserInfo20; /* this defines the bits used for fields_present in info21 */ @@ -678,7 +678,7 @@ const int SAMR_FIELD_WORKSTATION = 0x00000400; const int SAMR_FIELD_LOGON_HOURS = 0x00002000; const int SAMR_FIELD_ACCT_FLAGS = 0x00100000; - const int SAMR_FIELD_CALLBACK = 0x00200000; + const int SAMR_FIELD_PARAMETERS = 0x00200000; const int SAMR_FIELD_COUNTRY_CODE = 0x00400000; const int SAMR_FIELD_CODE_PAGE = 0x00800000; const int SAMR_FIELD_PASSWORD = 0x01000000; /* either of these */ @@ -691,19 +691,19 @@ NTTIME acct_expiry; NTTIME allow_password_change; NTTIME force_password_change; - samr_Name account_name; - samr_Name full_name; - samr_Name home_directory; - samr_Name home_drive; - samr_Name logon_script; - samr_Name profile_path; - samr_Name description; - samr_Name workstations; - samr_Name comment; - samr_Name callback; - samr_Name unknown1; - samr_Name unknown2; - samr_Name unknown3; + samr_String account_name; + samr_String full_name; + samr_String home_directory; + samr_String home_drive; + samr_String logon_script; + samr_String profile_path; + samr_String description; + samr_String workstations; + samr_String comment; + samr_String parameters; + samr_String unknown1; + samr_String unknown2; + samr_String unknown3; uint32 buf_count; [size_is(buf_count)] uint8 *buffer; uint32 rid; @@ -712,12 +712,12 @@ uint32 fields_present; samr_LogonHours logon_hours; uint16 bad_password_count; - uint16 num_logons; + uint16 logon_count; uint16 country_code; uint16 code_page; uint8 nt_password_set; uint8 lm_password_set; - uint8 expired_flag; + uint8 password_expired; uint8 unknown4; } samr_UserInfo21; @@ -835,9 +835,9 @@ uint32 idx; uint32 rid; uint32 acct_flags; - samr_Name account_name; - samr_Name full_name; - samr_Name description; + samr_String account_name; + samr_String full_name; + samr_String description; } samr_DispEntryGeneral; typedef struct { @@ -849,8 +849,8 @@ uint32 idx; uint32 rid; uint32 acct_flags; - samr_Name account_name; - samr_Name description; + samr_String account_name; + samr_String description; } samr_DispEntryFull; typedef struct { @@ -859,9 +859,9 @@ } samr_DispInfoFull; typedef struct { - [value(strlen_m(r->name))] uint16 name_len; - [value(strlen_m(r->name))] uint16 name_size; - ascstr_noterm *name; + [value(strlen_m(r->string))] uint16 length; + [value(strlen_m(r->string))] uint16 size; + ascstr_noterm *string; } samr_AsciiName; typedef struct { @@ -909,7 +909,7 @@ NTSTATUS samr_GetDisplayEnumerationIndex( [in,ref] policy_handle *domain_handle, [in] uint16 level, - [in] samr_Name name, + [in] samr_String name, [out] uint32 idx ); @@ -1014,7 +1014,7 @@ NTSTATUS samr_GetDisplayEnumerationIndex2( [in,ref] policy_handle *domain_handle, [in] uint16 level, - [in] samr_Name name, + [in] samr_String name, [out] uint32 idx ); @@ -1023,7 +1023,7 @@ /* Function 0x32 */ NTSTATUS samr_CreateUser2( [in,ref] policy_handle *domain_handle, - [in,ref] samr_Name *account_name, + [in,ref] samr_String *account_name, [in] uint32 acct_flags, [in] uint32 access_mask, [out,ref] policy_handle *user_handle, @@ -1076,8 +1076,8 @@ /************************/ /* Function 0x37 */ NTSTATUS samr_ChangePasswordUser2( - [in] samr_Name *server, - [in,ref] samr_Name *account, + [in] samr_String *server, + [in,ref] samr_String *account, [in] samr_CryptPassword *nt_password, [in] samr_Password *nt_verifier, [in] bool8 lm_change, @@ -1088,7 +1088,7 @@ /************************/ /* Function 0x38 */ NTSTATUS samr_GetDomPwInfo( - [in] samr_Name *name, + [in] samr_String *name, [out] samr_PwInfo info ); @@ -1163,8 +1163,8 @@ } samr_ChangeReject; NTSTATUS samr_ChangePasswordUser3( - [in] samr_Name *server, - [in,ref] samr_Name *account, + [in] samr_String *server, + [in,ref] samr_String *account, [in] samr_CryptPassword *nt_password, [in] samr_Password *nt_verifier, [in] bool8 lm_change, @@ -1214,7 +1214,7 @@ */ NTSTATUS samr_SetDsrmPassword( - [in] samr_Name *name, + [in] samr_String *name, [in] uint32 unknown, [in] samr_Password *hash ); diff --git a/source4/rpc_server/samr/dcesrv_samr.c b/source4/rpc_server/samr/dcesrv_samr.c index 76b0d7b2ad..4ed5948b6a 100644 --- a/source4/rpc_server/samr/dcesrv_samr.c +++ b/source4/rpc_server/samr/dcesrv_samr.c @@ -90,7 +90,7 @@ static NTSTATUS samr_Close(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_c DCESRV_PULL_HANDLE(h, r->in.handle, DCESRV_HANDLE_ANY); - /* this causes the callback samr_XXX_destroy() to be called by + /* this causes the parameters samr_XXX_destroy() to be called by the handle destroy code which destroys the state associated with the handle */ dcesrv_handle_destroy(dce_call->conn, h); @@ -169,14 +169,14 @@ static NTSTATUS samr_LookupDomain(struct dcesrv_call_state *dce_call, TALLOC_CTX c_state = h->data; - if (r->in.domain->name == NULL) { + if (r->in.domain->string == NULL) { return NT_STATUS_INVALID_PARAMETER; } sidstr = samdb_search_string(c_state->sam_ctx, mem_ctx, NULL, "objectSid", "(&(name=%s)(objectclass=domain))", - r->in.domain->name); + r->in.domain->string); if (sidstr == NULL) { return NT_STATUS_NO_SUCH_DOMAIN; } @@ -184,7 +184,7 @@ static NTSTATUS samr_LookupDomain(struct dcesrv_call_state *dce_call, TALLOC_CTX sid = dom_sid_parse_talloc(mem_ctx, sidstr); if (sid == NULL) { DEBUG(0,("samdb: Invalid sid '%s' for domain %s\n", - sidstr, r->in.domain->name)); + sidstr, r->in.domain->string)); return NT_STATUS_INTERNAL_DB_CORRUPTION; } @@ -248,7 +248,7 @@ static NTSTATUS samr_EnumDomains(struct dcesrv_call_state *dce_call, TALLOC_CTX for (i=0;i<count-start_i;i++) { array->entries[i].idx = start_i + i; - array->entries[i].name.name = domains[start_i+i]; + array->entries[i].name.string = domains[start_i+i]; } r->out.sam = array; @@ -349,10 +349,10 @@ static NTSTATUS samr_info_DomInfo2(struct samr_domain_state *state, TALLOC_CTX * /* where is this supposed to come from? is it settable? */ info->force_logoff_time = 0x8000000000000000LL; - info->comment.name = samdb_result_string(res[0], "comment", NULL); - info->domain.name = samdb_result_string(res[0], "name", NULL); + info->comment.string = samdb_result_string(res[0], "comment", NULL); + info->domain.string = samdb_result_string(res[0], "name", NULL); - info->primary.name = lp_netbios_name(); + info->primary.string = lp_netbios_name(); info->sequence_num = 0; info->role = ROLE_DOMAIN_PDC; info->num_users = samdb_search_count(state->sam_ctx, mem_ctx, NULL, "(objectClass=user)"); @@ -431,7 +431,7 @@ static NTSTATUS samr_CreateDomainGroup(struct dcesrv_call_state *dce_call, TALLO d_state = h->data; - groupname = r->in.name->name; + groupname = r->in.name->string; if (groupname == NULL) { return NT_STATUS_INVALID_PARAMETER; @@ -567,7 +567,7 @@ static NTSTATUS samr_CreateUser2(struct dcesrv_call_state *dce_call, TALLOC_CTX d_state = h->data; - account_name = r->in.account_name->name; + account_name = r->in.account_name->string; if (account_name == NULL) { return NT_STATUS_INVALID_PARAMETER; @@ -776,7 +776,7 @@ static NTSTATUS samr_EnumDomainUsers(struct dcesrv_call_state *dce_call, TALLOC_ } for (i=0;i<count;i++) { entries[i].idx = samdb_result_rid_from_sid(mem_ctx, res[i], "objectSid", 0); - entries[i].name.name = samdb_result_string(res[i], "sAMAccountName", ""); + entries[i].name.string = samdb_result_string(res[i], "sAMAccountName", ""); } /* sort the results by rid */ @@ -887,7 +887,7 @@ static NTSTATUS samr_LookupNames(struct dcesrv_call_state *dce_call, TALLOC_CTX r->out.types.ids[i] = SID_NAME_UNKNOWN; count = samdb_search(d_state->sam_ctx, mem_ctx, d_state->domain_dn, &res, attrs, - "sAMAccountName=%s", r->in.names[i].name); + "sAMAccountName=%s", r->in.names[i].string); if (count != 1) { status = STATUS_SOME_UNMAPPED; continue; @@ -1097,19 +1097,19 @@ static NTSTATUS samr_QueryGroupInfo(struct dcesrv_call_state *dce_call, TALLOC_C /* Fill in the level */ switch (r->in.level) { case GroupInfoAll: - QUERY_STRING(msg, all.name.name, "sAMAccountName"); + QUERY_STRING(msg, all.name.string, "sAMAccountName"); r->out.info->all.unknown = 7; /* Do like w2k3 */ QUERY_UINT (msg, all.num_members, "numMembers") - QUERY_STRING(msg, all.description.name, "description"); + QUERY_STRING(msg, all.description.string, "description"); break; case GroupInfoName: - QUERY_STRING(msg, name.name, "sAMAccountName"); + QUERY_STRING(msg, name.string, "sAMAccountName"); break; case GroupInfoX: r->out.info->unknown.unknown = 7; break; case GroupInfoDescription: - QUERY_STRING(msg, description.name, "description"); + QUERY_STRING(msg, description.string, "description"); break; default: r->out.info = NULL; @@ -1143,12 +1143,12 @@ static NTSTATUS samr_SetGroupInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX switch (r->in.level) { case GroupInfoDescription: - SET_STRING(msg, description.name, "description"); + SET_STRING(msg, description.string, "description"); break; case GroupInfoName: /* On W2k3 this does not change the name, it changes the * sAMAccountName attribute */ - SET_STRING(msg, name.name, "sAMAccountName"); + SET_STRING(msg, name.string, "sAMAccountName"); break; case GroupInfoX: /* This does not do anything obviously visible in W2k3 LDAP */ @@ -1443,140 +1443,140 @@ static NTSTATUS samr_QueryUserInfo(struct dcesrv_call_state *dce_call, TALLOC_CT /* fill in the reply */ switch (r->in.level) { case 1: - QUERY_STRING(msg, info1.account_name.name,"sAMAccountName"); - QUERY_STRING(msg, info1.full_name.name, "displayName"); - QUERY_UINT (msg, info1.primary_gid, "primaryGroupID"); - QUERY_STRING(msg, info1.description.name, "description"); - QUERY_STRING(msg, info1.comment.name, "comment"); + QUERY_STRING(msg, info1.account_name.string, "sAMAccountName"); + QUERY_STRING(msg, info1.full_name.string, "displayName"); + QUERY_UINT (msg, info1.primary_gid, "primaryGroupID"); + QUERY_STRING(msg, info1.description.string, "description"); + QUERY_STRING(msg, info1.comment.string, "comment"); break; case 2: - QUERY_STRING(msg, info2.comment.name, "comment"); - QUERY_UINT (msg, info2.country_code, "countryCode"); - QUERY_UINT (msg, info2.code_page, "codePage"); + QUERY_STRING(msg, info2.comment.string, "comment"); + QUERY_UINT (msg, info2.country_code, "countryCode"); + QUERY_UINT (msg, info2.code_page, "codePage"); break; case 3: - QUERY_STRING(msg, info3.account_name.name, "sAMAccountName"); - QUERY_STRING(msg, info3.full_name.name, "displayName"); - QUERY_RID (msg, info3.rid, "objectSid"); - QUERY_UINT (msg, info3.primary_gid, "primaryGroupID"); - QUERY_STRING(msg, info3.home_directory.name, "homeDirectory"); - QUERY_STRING(msg, info3.home_drive.name, "homeDrive"); - QUERY_STRING(msg, info3.logon_script.name, "scriptPath"); - QUERY_STRING(msg, info3.profile_path.name, "profilePath"); - QUERY_STRING(msg, info3.workstations.name, "userWorkstations"); - QUERY_NTTIME(msg, info3.last_logon, "lastLogon"); - QUERY_NTTIME(msg, info3.last_logoff, "lastLogoff"); - QUERY_NTTIME(msg, info3.last_password_change,"pwdLastSet"); - QUERY_APASSC(msg, info3.allow_password_change,"pwdLastSet"); - QUERY_FPASSC(msg, info3.force_password_change,"pwdLastSet"); - QUERY_LHOURS(msg, info3.logon_hours, "logonHours"); - QUERY_UINT (msg, info3.bad_password_count, "badPwdCount"); - QUERY_UINT (msg, info3.num_logons, "logonCount"); - QUERY_AFLAGS(msg, info3.acct_flags, "userAccountControl"); + QUERY_STRING(msg, info3.account_name.string, "sAMAccountName"); + QUERY_STRING(msg, info3.full_name.string, "displayName"); + QUERY_RID (msg, info3.rid, "objectSid"); + QUERY_UINT (msg, info3.primary_gid, "primaryGroupID"); + QUERY_STRING(msg, info3.home_directory.string, "homeDirectory"); + QUERY_STRING(msg, info3.home_drive.string, "homeDrive"); + QUERY_STRING(msg, info3.logon_script.string, "scriptPath"); + QUERY_STRING(msg, info3.profile_path.string, "profilePath"); + QUERY_STRING(msg, info3.workstations.string, "userWorkstations"); + QUERY_NTTIME(msg, info3.last_logon, "lastLogon"); + QUERY_NTTIME(msg, info3.last_logoff, "lastLogoff"); + QUERY_NTTIME(msg, info3.last_password_change, "pwdLastSet"); + QUERY_APASSC(msg, info3.allow_password_change, "pwdLastSet"); + QUERY_FPASSC(msg, info3.force_password_change, "pwdLastSet"); + QUERY_LHOURS(msg, info3.logon_hours, "logonHours"); + QUERY_UINT (msg, info3.bad_password_count, "badPwdCount"); + QUERY_UINT (msg, info3.logon_count, "logonCount"); + QUERY_AFLAGS(msg, info3.acct_flags, "userAccountControl"); break; case 4: - QUERY_LHOURS(msg, info4.logon_hours, "logonHours"); + QUERY_LHOURS(msg, info4.logon_hours, "logonHours"); break; case 5: - QUERY_STRING(msg, info5.account_name.name, "sAMAccountName"); - QUERY_STRING(msg, info5.full_name.name, "displayName"); - QUERY_RID (msg, info5.rid, "objectSid"); - QUERY_UINT (msg, info5.primary_gid, "primaryGroupID"); - QUERY_STRING(msg, info5.home_directory.name, "homeDirectory"); - QUERY_STRING(msg, info5.home_drive.name, "homeDrive"); - QUERY_STRING(msg, info5.logon_script.name, "scriptPath"); - QUERY_STRING(msg, info5.profile_path.name, "profilePath"); - QUERY_STRING(msg, info5.description.name, "description"); - QUERY_STRING(msg, info5.workstations.name, "userWorkstations"); - QUERY_NTTIME(msg, info5.last_logon, "lastLogon"); - QUERY_NTTIME(msg, info5.last_logoff, "lastLogoff"); - QUERY_LHOURS(msg, info5.logon_hours, "logonHours"); - QUERY_UINT (msg, info5.bad_password_count, "badPwdCount"); - QUERY_UINT (msg, info5.num_logons, "logonCount"); - QUERY_NTTIME(msg, info5.last_password_change,"pwdLastSet"); - QUERY_NTTIME(msg, info5.acct_expiry, "accountExpires"); - QUERY_AFLAGS(msg, info5.acct_flags, "userAccountControl"); + QUERY_STRING(msg, info5.account_name.string, "sAMAccountName"); + QUERY_STRING(msg, info5.full_name.string, "displayName"); + QUERY_RID (msg, info5.rid, "objectSid"); + QUERY_UINT (msg, info5.primary_gid, "primaryGroupID"); + QUERY_STRING(msg, info5.home_directory.string, "homeDirectory"); + QUERY_STRING(msg, info5.home_drive.string, "homeDrive"); + QUERY_STRING(msg, info5.logon_script.string, "scriptPath"); + QUERY_STRING(msg, info5.profile_path.string, "profilePath"); + QUERY_STRING(msg, info5.description.string, "description"); + QUERY_STRING(msg, info5.workstations.string, "userWorkstations"); + QUERY_NTTIME(msg, info5.last_logon, "lastLogon"); + QUERY_NTTIME(msg, info5.last_logoff, "lastLogoff"); + QUERY_LHOURS(msg, info5.logon_hours, "logonHours"); + QUERY_UINT (msg, info5.bad_password_count, "badPwdCount"); + QUERY_UINT (msg, info5.logon_count, "logonCount"); + QUERY_NTTIME(msg, info5.last_password_change, "pwdLastSet"); + QUERY_NTTIME(msg, info5.acct_expiry, "accountExpires"); + QUERY_AFLAGS(msg, info5.acct_flags, "userAccountControl"); break; case 6: - QUERY_STRING(msg, info6.account_name.name, "sAMAccountName"); - QUERY_STRING(msg, info6.full_name.name, "displayName"); + QUERY_STRING(msg, info6.account_name.string, "sAMAccountName"); + QUERY_STRING(msg, info6.full_name.string, "displayName"); break; case 7: - QUERY_STRING(msg, info7.account_name.name, "sAMAccountName"); + QUERY_STRING(msg, info7.account_name.string, "sAMAccountName"); break; case 8: - QUERY_STRING(msg, info8.full_name.name, "displayName"); + QUERY_STRING(msg, info8.full_name.string, "displayName"); break; case 9: - QUERY_UINT (msg, info9.primary_gid, "primaryGroupID"); + QUERY_UINT (msg, info9.primary_gid, "primaryGroupID"); break; case 10: - QUERY_STRING(msg, info10.home_directory.name, "homeDirectory"); - QUERY_STRING(msg, info10.home_drive.name, "homeDrive"); + QUERY_STRING(msg, info10.home_directory.string,"homeDirectory"); + QUERY_STRING(msg, info10.home_drive.string, "homeDrive"); break; case 11: - QUERY_STRING(msg, info11.logon_script.name, "scriptPath"); + QUERY_STRING(msg, info11.logon_script.string, "scriptPath"); break; case 12: - QUERY_STRING(msg, info12.profile_path.name, "profilePath"); + QUERY_STRING(msg, info12.profile_path.string, "profilePath"); break; case 13: - QUERY_STRING(msg, info13.description.name, "description"); + QUERY_STRING(msg, info13.description.string, "description"); break; case 14: - QUERY_STRING(msg, info14.workstations.name, "userWorkstations"); + QUERY_STRING(msg, info14.workstations.string, "userWorkstations"); break; case 16: - QUERY_AFLAGS(msg, info16.acct_flags, "userAccountControl"); + QUERY_AFLAGS(msg, info16.acct_flags, "userAccountControl"); break; case 17: - QUERY_NTTIME(msg, info17.acct_expiry, "accountExpires"); + QUERY_NTTIME(msg, info17.acct_expiry, "accountExpires"); case 20: - QUERY_STRING(msg, info20.callback.name, "userParameters"); + QUERY_STRING(msg, info20.parameters.string, "userParameters"); break; case 21: - QUERY_NTTIME(msg, info21.last_logon, "lastLogon"); - QUERY_NTTIME(msg, info21.last_logoff, "lastLogoff"); - QUERY_NTTIME(msg, info21.last_password_change, "pwdLastSet"); - QUERY_NTTIME(msg, info21.acct_expiry, "accountExpires"); + QUERY_NTTIME(msg, info21.last_logon, "lastLogon"); + QUERY_NTTIME(msg, info21.last_logoff, "lastLogoff"); + QUERY_NTTIME(msg, info21.last_password_change, "pwdLastSet"); + QUERY_NTTIME(msg, info21.acct_expiry, "accountExpires"); QUERY_APASSC(msg, info21.allow_password_change,"pwdLastSet"); QUERY_FPASSC(msg, info21.force_password_change,"pwdLastSet"); - QUERY_STRING(msg, info21.account_name.name, "sAMAccountName"); - QUERY_STRING(msg, info21.full_name.name, "displayName"); - QUERY_STRING(msg, info21.home_directory.name, "homeDirectory"); - QUERY_STRING(msg, info21.home_drive.name, "homeDrive"); - QUERY_STRING(msg, info21.logon_script.name, "scriptPath"); - QUERY_STRING(msg, info21.profile_path.name, "profilePath"); - QUERY_STRING(msg, info21.description.name, "description"); - QUERY_STRING(msg, info21.workstations.name, "userWorkstations"); - QUERY_STRING(msg, info21.comment.name, "comment"); - QUERY_STRING(msg, info21.callback.name, "userParameters"); - QUERY_RID (msg, info21.rid, "objectSid"); - QUERY_UINT (msg, info21.primary_gid, "primaryGroupID"); - QUERY_AFLAGS(msg, info21.acct_flags, "userAccountControl"); + QUERY_STRING(msg, info21.account_name.string, "sAMAccountName"); + QUERY_STRING(msg, info21.full_name.string, "displayName"); + QUERY_STRING(msg, info21.home_directory.string,"homeDirectory"); + QUERY_STRING(msg, info21.home_drive.string, "homeDrive"); + QUERY_STRING(msg, info21.logon_script.string, "scriptPath"); + QUERY_STRING(msg, info21.profile_path.string, "profilePath"); + QUERY_STRING(msg, info21.description.string, "description"); + QUERY_STRING(msg, info21.workstations.string, "userWorkstations"); + QUERY_STRING(msg, info21.comment.string, "comment"); + QUERY_STRING(msg, info21.parameters.string, "userParameters"); + QUERY_RID (msg, info21.rid, "objectSid"); + QUERY_UINT (msg, info21.primary_gid, "primaryGroupID"); + QUERY_AFLAGS(msg, info21.acct_flags, "userAccountControl"); r->out.info->info21.fields_present = 0x00FFFFFF; - QUERY_LHOURS(msg, info21.logon_hours, "logonHours"); - QUERY_UINT (msg, info21.bad_password_count, "badPwdCount"); - QUERY_UINT (msg, info21.num_logons, "logonCount"); - QUERY_UINT (msg, info21.country_code, "countryCode"); - QUERY_UINT (msg, info21.code_page, "codePage"); + QUERY_LHOURS(msg, info21.logon_hours, "logonHours"); + QUERY_UINT (msg, info21.bad_password_count, "badPwdCount"); + QUERY_UINT (msg, info21.logon_count, "logonCount"); + QUERY_UINT (msg, info21.country_code, "countryCode"); + QUERY_UINT (msg, info21.code_page, "codePage"); break; @@ -1613,80 +1613,80 @@ static NTSTATUS samr_SetUserInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX switch (r->in.level) { case 2: - SET_STRING(msg, info2.comment.name, "comment"); - SET_UINT (msg, info2.country_code, "countryCode"); - SET_UINT (msg, info2.code_page, "codePage"); + SET_STRING(msg, info2.comment.string, "comment"); + SET_UINT (msg, info2.country_code, "countryCode"); + SET_UINT (msg, info2.code_page, "codePage"); break; case 4: - SET_LHOURS(msg, info4.logon_hours, "logonHours"); + SET_LHOURS(msg, info4.logon_hours, "logonHours"); break; case 6: - SET_STRING(msg, info6.full_name.name, "displayName"); + SET_STRING(msg, info6.full_name.string, "displayName"); break; case 8: - SET_STRING(msg, info8.full_name.name, "displayName"); + SET_STRING(msg, info8.full_name.string, "displayName"); break; case 9: - SET_UINT(msg, info9.primary_gid, "primaryGroupID"); + SET_UINT(msg, info9.primary_gid, "primaryGroupID"); break; case 10: - SET_STRING(msg, info10.home_directory.name, "homeDirectory"); - SET_STRING(msg, info10.home_drive.name, "homeDrive"); + SET_STRING(msg, info10.home_directory.string, "homeDirectory"); + SET_STRING(msg, info10.home_drive.string, "homeDrive"); break; case 11: - SET_STRING(msg, info11.logon_script.name, "scriptPath"); + SET_STRING(msg, info11.logon_script.string, "scriptPath"); break; case 12: - SET_STRING(msg, info12.profile_path.name, "profilePath"); + SET_STRING(msg, info12.profile_path.string, "profilePath"); break; case 13: - SET_STRING(msg, info13.description.name, "description"); + SET_STRING(msg, info13.description.string, "description"); break; case 14: - SET_STRING(msg, info14.workstations.name, "userWorkstations"); + SET_STRING(msg, info14.workstations.string, "userWorkstations"); break; case 16: - SET_AFLAGS(msg, info16.acct_flags, "userAccountControl"); + SET_AFLAGS(msg, info16.acct_flags, "userAccountControl"); break; case 20: - SET_STRING(msg, info20.callback.name, "userParameters"); + SET_STRING(msg, info20.parameters.string, "userParameters"); break; case 21: #define IFSET(bit) if (bit & r->in.info->info21.fields_present) IFSET(SAMR_FIELD_NAME) - SET_STRING(msg, info21.full_name.name, "displayName"); + SET_STRING(msg, info21.full_name.string, "displayName"); IFSET(SAMR_FIELD_DESCRIPTION) - SET_STRING(msg, info21.description.name, "description"); + SET_STRING(msg, info21.description.string, "description"); IFSET(SAMR_FIELD_COMMENT) - SET_STRING(msg, info21.comment.name, "comment"); + SET_STRING(msg, info21.comment.string, "comment"); IFSET(SAMR_FIELD_LOGON_SCRIPT) - SET_STRING(msg, info21.logon_script.name, "scriptPath"); + SET_STRING(msg, info21.logon_script.string, "scriptPath"); IFSET(SAMR_FIELD_PROFILE_PATH) - SET_STRING(msg, info21.profile_path.name, "profilePath"); + SET_STRING(msg, info21.profile_path.string, "profilePath"); IFSET(SAMR_FIELD_WORKSTATION) - SET_STRING(msg, info21.workstations.name, "userWorkstations"); + SET_STRING(msg, info21.workstations.string, "userWorkstations"); IFSET(SAMR_FIELD_LOGON_HOURS) - SET_LHOURS(msg, info21.logon_hours, "logonHours"); + SET_LHOURS(msg, info21.logon_hours, "logonHours"); IFSET(SAMR_FIELD_ACCT_FLAGS) - SET_AFLAGS(msg, info21.acct_flags, "userAccountControl"); - IFSET(SAMR_FIELD_CALLBACK) - SET_STRING(msg, info21.callback.name, "userParameters"); + SET_AFLAGS(msg, info21.acct_flags, "userAccountControl"); + IFSET(SAMR_FIELD_PARAMETERS) + SET_STRING(msg, info21.parameters.string, "userParameters"); IFSET(SAMR_FIELD_COUNTRY_CODE) - SET_UINT (msg, info21.country_code, "countryCode"); + SET_UINT (msg, info21.country_code, "countryCode"); IFSET(SAMR_FIELD_CODE_PAGE) - SET_UINT (msg, info21.code_page, "codePage"); + SET_UINT (msg, info21.code_page, "codePage"); /* Any reason the rest of these can't be set? */ @@ -1696,27 +1696,27 @@ static NTSTATUS samr_SetUserInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX case 23: #define IFSET(bit) if (bit & r->in.info->info23.info.fields_present) IFSET(SAMR_FIELD_NAME) - SET_STRING(msg, info23.info.full_name.name, "displayName"); + SET_STRING(msg, info23.info.full_name.string, "displayName"); IFSET(SAMR_FIELD_DESCRIPTION) - SET_STRING(msg, info23.info.description.name, "description"); + SET_STRING(msg, info23.info.description.string, "description"); IFSET(SAMR_FIELD_COMMENT) - SET_STRING(msg, info23.info.comment.name, "comment"); + SET_STRING(msg, info23.info.comment.string, "comment"); IFSET(SAMR_FIELD_LOGON_SCRIPT) - SET_STRING(msg, info23.info.logon_script.name, "scriptPath"); + SET_STRING(msg, info23.info.logon_script.string, "scriptPath"); IFSET(SAMR_FIELD_PROFILE_PATH) - SET_STRING(msg, info23.info.profile_path.name, "profilePath"); + SET_STRING(msg, info23.info.profile_path.string, "profilePath"); IFSET(SAMR_FIELD_WORKSTATION) - SET_STRING(msg, info23.info.workstations.name, "userWorkstations"); + SET_STRING(msg, info23.info.workstations.string, "userWorkstations"); IFSET(SAMR_FIELD_LOGON_HOURS) - SET_LHOURS(msg, info23.info.logon_hours, "logonHours"); + SET_LHOURS(msg, info23.info.logon_hours, "logonHours"); IFSET(SAMR_FIELD_ACCT_FLAGS) - SET_AFLAGS(msg, info23.info.acct_flags, "userAccountControl"); - IFSET(SAMR_FIELD_CALLBACK) - SET_STRING(msg, info23.info.callback.name, "userParameters"); + SET_AFLAGS(msg, info23.info.acct_flags, "userAccountControl"); + IFSET(SAMR_FIELD_PARAMETERS) + SET_STRING(msg, info23.info.parameters.string, "userParameters"); IFSET(SAMR_FIELD_COUNTRY_CODE) - SET_UINT (msg, info23.info.country_code, "countryCode"); + SET_UINT (msg, info23.info.country_code, "countryCode"); IFSET(SAMR_FIELD_CODE_PAGE) - SET_UINT (msg, info23.info.code_page, "codePage"); + SET_UINT (msg, info23.info.code_page, "codePage"); IFSET(SAMR_FIELD_PASSWORD) { status = samr_set_password(dce_call, a_state->sam_ctx, @@ -1748,27 +1748,27 @@ static NTSTATUS samr_SetUserInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX case 25: #define IFSET(bit) if (bit & r->in.info->info25.info.fields_present) IFSET(SAMR_FIELD_NAME) - SET_STRING(msg, info25.info.full_name.name, "displayName"); + SET_STRING(msg, info25.info.full_name.string, "displayName"); IFSET(SAMR_FIELD_DESCRIPTION) - SET_STRING(msg, info25.info.description.name, "description"); + SET_STRING(msg, info25.info.description.string, "description"); IFSET(SAMR_FIELD_COMMENT) - SET_STRING(msg, info25.info.comment.name, "comment"); + SET_STRING(msg, info25.info.comment.string, "comment"); IFSET(SAMR_FIELD_LOGON_SCRIPT) - SET_STRING(msg, info25.info.logon_script.name, "scriptPath"); + SET_STRING(msg, info25.info.logon_script.string, "scriptPath"); IFSET(SAMR_FIELD_PROFILE_PATH) - SET_STRING(msg, info25.info.profile_path.name, "profilePath"); + SET_STRING(msg, info25.info.profile_path.string, "profilePath"); IFSET(SAMR_FIELD_WORKSTATION) - SET_STRING(msg, info25.info.workstations.name, "userWorkstations"); + SET_STRING(msg, info25.info.workstations.string, "userWorkstations"); IFSET(SAMR_FIELD_LOGON_HOURS) - SET_LHOURS(msg, info25.info.logon_hours, "logonHours"); + SET_LHOURS(msg, info25.info.logon_hours, "logonHours"); IFSET(SAMR_FIELD_ACCT_FLAGS) - SET_AFLAGS(msg, info25.info.acct_flags, "userAccountControl"); - IFSET(SAMR_FIELD_CALLBACK) - SET_STRING(msg, info25.info.callback.name, "userParameters"); + SET_AFLAGS(msg, info25.info.acct_flags, "userAccountControl"); + IFSET(SAMR_FIELD_PARAMETERS) + SET_STRING(msg, info25.info.parameters.string, "userParameters"); IFSET(SAMR_FIELD_COUNTRY_CODE) - SET_UINT (msg, info25.info.country_code, "countryCode"); + SET_UINT (msg, info25.info.country_code, "countryCode"); IFSET(SAMR_FIELD_CODE_PAGE) - SET_UINT (msg, info25.info.code_page, "codePage"); + SET_UINT (msg, info25.info.code_page, "codePage"); IFSET(SAMR_FIELD_PASSWORD) { status = samr_set_password_ex(dce_call, a_state->sam_ctx, diff --git a/source4/rpc_server/samr/samr_password.c b/source4/rpc_server/samr/samr_password.c index 7f2eb5d1a1..c45bababa6 100644 --- a/source4/rpc_server/samr/samr_password.c +++ b/source4/rpc_server/samr/samr_password.c @@ -160,7 +160,7 @@ NTSTATUS samr_OemChangePasswordUser2(struct dcesrv_call_state *dce_call, TALLOC_ ret = samdb_search(sam_ctx, mem_ctx, NULL, &res, attrs, "(&(sAMAccountName=%s)(objectclass=user))", - r->in.account->name); + r->in.account->string); if (ret != 1) { return NT_STATUS_NO_SUCH_USER; } @@ -270,7 +270,7 @@ NTSTATUS samr_ChangePasswordUser3(struct dcesrv_call_state *dce_call, ret = samdb_search(sam_ctx, mem_ctx, NULL, &res, attrs, "(&(sAMAccountName=%s)(objectclass=user))", - r->in.account->name); + r->in.account->string); if (ret != 1) { status = NT_STATUS_NO_SUCH_USER; goto failed; diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c index db2a6180a8..987754790b 100644 --- a/source4/torture/rpc/samr.c +++ b/source4/torture/rpc/samr.c @@ -41,13 +41,13 @@ static BOOL test_QueryUserInfo2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, static BOOL test_QueryAliasInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle); -static void init_samr_Name(struct samr_Name *name, const char *s) +static void init_samr_String(struct samr_String *string, const char *s) { - name->name = s; + string->string = s; } -static BOOL test_Close(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, - struct policy_handle *handle) +BOOL test_samr_handle_Close(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, + struct policy_handle *handle) { NTSTATUS status; struct samr_Close r; @@ -93,7 +93,7 @@ static BOOL test_SetDsrmPassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, { NTSTATUS status; struct samr_SetDsrmPassword r; - struct samr_Name name; + struct samr_String string; struct samr_Password hash; if (lp_parm_int(-1, "torture", "dangerous") != 1) { @@ -103,9 +103,9 @@ static BOOL test_SetDsrmPassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, E_md4hash("TeSTDSRM123", hash.hash); - init_samr_Name(&name, "Administrator"); + init_samr_String(&string, "Administrator"); - r.in.name = &name; + r.in.name = &string; r.in.unknown = 0; r.in.hash = &hash; @@ -213,7 +213,7 @@ static BOOL test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, break; \ } -#define TEST_USERINFO_NAME(lvl1, field1, lvl2, field2, value, fpval) do { \ +#define TEST_USERINFO_STRING(lvl1, field1, lvl2, field2, value, fpval) do { \ printf("field test %d/%s vs %d/%s\n", lvl1, #field1, lvl2, #field2); \ q.in.level = lvl1; \ TESTCALL(QueryUserInfo, q) \ @@ -224,17 +224,17 @@ static BOOL test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, ZERO_STRUCT(u.info21); \ u.info21.fields_present = fpval; \ } \ - init_samr_Name(&u.info ## lvl1.field1, value); \ + init_samr_String(&u.info ## lvl1.field1, value); \ TESTCALL(SetUserInfo, s) \ TESTCALL(SetUserInfo2, s2) \ - init_samr_Name(&u.info ## lvl1.field1, ""); \ + init_samr_String(&u.info ## lvl1.field1, ""); \ TESTCALL(QueryUserInfo, q); \ u = *q.out.info; \ - STRING_EQUAL(u.info ## lvl1.field1.name, value, field1); \ + STRING_EQUAL(u.info ## lvl1.field1.string, value, field1); \ q.in.level = lvl2; \ TESTCALL(QueryUserInfo, q) \ u = *q.out.info; \ - STRING_EQUAL(u.info ## lvl2.field2.name, value, field2); \ + STRING_EQUAL(u.info ## lvl2.field2.string, value, field2); \ } while (0) #define TEST_USERINFO_INT_EXP(lvl1, field1, lvl2, field2, value, exp_value, fpval) do { \ @@ -273,48 +273,48 @@ static BOOL test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, q0.in.level = 12; do { TESTCALL(QueryUserInfo, q0) } while (0); - TEST_USERINFO_NAME(2, comment, 1, comment, "xx2-1 comment", 0); - TEST_USERINFO_NAME(2, comment, 21, comment, "xx2-21 comment", 0); - TEST_USERINFO_NAME(21, comment, 21, comment, "xx21-21 comment", + TEST_USERINFO_STRING(2, comment, 1, comment, "xx2-1 comment", 0); + TEST_USERINFO_STRING(2, comment, 21, comment, "xx2-21 comment", 0); + TEST_USERINFO_STRING(21, comment, 21, comment, "xx21-21 comment", SAMR_FIELD_COMMENT); - TEST_USERINFO_NAME(6, full_name, 1, full_name, "xx6-1 full_name", 0); - TEST_USERINFO_NAME(6, full_name, 3, full_name, "xx6-3 full_name", 0); - TEST_USERINFO_NAME(6, full_name, 5, full_name, "xx6-5 full_name", 0); - TEST_USERINFO_NAME(6, full_name, 6, full_name, "xx6-6 full_name", 0); - TEST_USERINFO_NAME(6, full_name, 8, full_name, "xx6-8 full_name", 0); - TEST_USERINFO_NAME(6, full_name, 21, full_name, "xx6-21 full_name", 0); - TEST_USERINFO_NAME(8, full_name, 21, full_name, "xx8-21 full_name", 0); - TEST_USERINFO_NAME(21, full_name, 21, full_name, "xx21-21 full_name", + TEST_USERINFO_STRING(6, full_name, 1, full_name, "xx6-1 full_name", 0); + TEST_USERINFO_STRING(6, full_name, 3, full_name, "xx6-3 full_name", 0); + TEST_USERINFO_STRING(6, full_name, 5, full_name, "xx6-5 full_name", 0); + TEST_USERINFO_STRING(6, full_name, 6, full_name, "xx6-6 full_name", 0); + TEST_USERINFO_STRING(6, full_name, 8, full_name, "xx6-8 full_name", 0); + TEST_USERINFO_STRING(6, full_name, 21, full_name, "xx6-21 full_name", 0); + TEST_USERINFO_STRING(8, full_name, 21, full_name, "xx8-21 full_name", 0); + TEST_USERINFO_STRING(21, full_name, 21, full_name, "xx21-21 full_name", SAMR_FIELD_NAME); - TEST_USERINFO_NAME(11, logon_script, 3, logon_script, "xx11-3 logon_script", 0); - TEST_USERINFO_NAME(11, logon_script, 5, logon_script, "xx11-5 logon_script", 0); - TEST_USERINFO_NAME(11, logon_script, 21, logon_script, "xx11-21 logon_script", 0); - TEST_USERINFO_NAME(21, logon_script, 21, logon_script, "xx21-21 logon_script", + TEST_USERINFO_STRING(11, logon_script, 3, logon_script, "xx11-3 logon_script", 0); + TEST_USERINFO_STRING(11, logon_script, 5, logon_script, "xx11-5 logon_script", 0); + TEST_USERINFO_STRING(11, logon_script, 21, logon_script, "xx11-21 logon_script", 0); + TEST_USERINFO_STRING(21, logon_script, 21, logon_script, "xx21-21 logon_script", SAMR_FIELD_LOGON_SCRIPT); - TEST_USERINFO_NAME(12, profile_path, 3, profile_path, "xx12-3 profile_path", 0); - TEST_USERINFO_NAME(12, profile_path, 5, profile_path, "xx12-5 profile_path", 0); - TEST_USERINFO_NAME(12, profile_path, 21, profile_path, "xx12-21 profile_path", 0); - TEST_USERINFO_NAME(21, profile_path, 21, profile_path, "xx21-21 profile_path", + TEST_USERINFO_STRING(12, profile_path, 3, profile_path, "xx12-3 profile_path", 0); + TEST_USERINFO_STRING(12, profile_path, 5, profile_path, "xx12-5 profile_path", 0); + TEST_USERINFO_STRING(12, profile_path, 21, profile_path, "xx12-21 profile_path", 0); + TEST_USERINFO_STRING(21, profile_path, 21, profile_path, "xx21-21 profile_path", SAMR_FIELD_PROFILE_PATH); - TEST_USERINFO_NAME(13, description, 1, description, "xx13-1 description", 0); - TEST_USERINFO_NAME(13, description, 5, description, "xx13-5 description", 0); - TEST_USERINFO_NAME(13, description, 21, description, "xx13-21 description", 0); - TEST_USERINFO_NAME(21, description, 21, description, "xx21-21 description", + TEST_USERINFO_STRING(13, description, 1, description, "xx13-1 description", 0); + TEST_USERINFO_STRING(13, description, 5, description, "xx13-5 description", 0); + TEST_USERINFO_STRING(13, description, 21, description, "xx13-21 description", 0); + TEST_USERINFO_STRING(21, description, 21, description, "xx21-21 description", SAMR_FIELD_DESCRIPTION); - TEST_USERINFO_NAME(14, workstations, 3, workstations, "14workstation3", 0); - TEST_USERINFO_NAME(14, workstations, 5, workstations, "14workstation4", 0); - TEST_USERINFO_NAME(14, workstations, 21, workstations, "14workstation21", 0); - TEST_USERINFO_NAME(21, workstations, 21, workstations, "21workstation21", + TEST_USERINFO_STRING(14, workstations, 3, workstations, "14workstation3", 0); + TEST_USERINFO_STRING(14, workstations, 5, workstations, "14workstation4", 0); + TEST_USERINFO_STRING(14, workstations, 21, workstations, "14workstation21", 0); + TEST_USERINFO_STRING(21, workstations, 21, workstations, "21workstation21", SAMR_FIELD_WORKSTATION); - TEST_USERINFO_NAME(20, callback, 21, callback, "xx20-21 callback", 0); - TEST_USERINFO_NAME(21, callback, 21, callback, "xx21-21 callback", - SAMR_FIELD_CALLBACK); + TEST_USERINFO_STRING(20, parameters, 21, parameters, "xx20-21 parameters", 0); + TEST_USERINFO_STRING(21, parameters, 21, parameters, "xx21-21 parameters", + SAMR_FIELD_PARAMETERS); TEST_USERINFO_INT(2, country_code, 21, country_code, __LINE__, 0); TEST_USERINFO_INT(21, country_code, 21, country_code, __LINE__, @@ -630,8 +630,8 @@ static BOOL test_SetAliasInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, r.in.alias_handle = handle; r.in.level = levels[i]; switch (r.in.level) { - case 2 : init_samr_Name(&r.in.info.name,TEST_ALIASNAME); break; - case 3 : init_samr_Name(&r.in.info.description, + case 2 : init_samr_String(&r.in.info.name,TEST_ALIASNAME); break; + case 3 : init_samr_String(&r.in.info.description, "Test Description, should test I18N as well"); break; } @@ -678,14 +678,14 @@ static BOOL test_GetGroupsForUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } static BOOL test_GetDomPwInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, - struct samr_Name *domain_name) + struct samr_String *domain_name) { NTSTATUS status; struct samr_GetDomPwInfo r; BOOL ret = True; r.in.name = domain_name; - printf("Testing GetDomPwInfo with name %s\n", r.in.name->name); + printf("Testing GetDomPwInfo with name %s\n", r.in.name->string); status = dcerpc_samr_GetDomPwInfo(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { @@ -693,8 +693,8 @@ static BOOL test_GetDomPwInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, ret = False; } - r.in.name->name = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p)); - printf("Testing GetDomPwInfo with name %s\n", r.in.name->name); + r.in.name->string = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p)); + printf("Testing GetDomPwInfo with name %s\n", r.in.name->string); status = dcerpc_samr_GetDomPwInfo(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { @@ -702,8 +702,8 @@ static BOOL test_GetDomPwInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, ret = False; } - r.in.name->name = "\\\\__NONAME__"; - printf("Testing GetDomPwInfo with name %s\n", r.in.name->name); + r.in.name->string = "\\\\__NONAME__"; + printf("Testing GetDomPwInfo with name %s\n", r.in.name->string); status = dcerpc_samr_GetDomPwInfo(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { @@ -711,8 +711,8 @@ static BOOL test_GetDomPwInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, ret = False; } - r.in.name->name = "\\\\Builtin"; - printf("Testing GetDomPwInfo with name %s\n", r.in.name->name); + r.in.name->string = "\\\\Builtin"; + printf("Testing GetDomPwInfo with name %s\n", r.in.name->string); status = dcerpc_samr_GetDomPwInfo(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { @@ -750,9 +750,9 @@ static NTSTATUS test_LookupName(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, { NTSTATUS status; struct samr_LookupNames n; - struct samr_Name sname[2]; + struct samr_String sname[2]; - init_samr_Name(&sname[0], name); + init_samr_String(&sname[0], name); n.in.domain_handle = domain_handle; n.in.num_names = 1; @@ -764,7 +764,7 @@ static NTSTATUS test_LookupName(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, return status; } - init_samr_Name(&sname[1], "xxNONAMExx"); + init_samr_String(&sname[1], "xxNONAMExx"); n.in.num_names = 2; status = dcerpc_samr_LookupNames(p, mem_ctx, &n); if (!NT_STATUS_EQUAL(status, STATUS_SOME_UNMAPPED)) { @@ -772,7 +772,7 @@ static NTSTATUS test_LookupName(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, return status; } - init_samr_Name(&sname[1], "xxNONAMExx"); + init_samr_String(&sname[1], "xxNONAMExx"); n.in.num_names = 0; status = dcerpc_samr_LookupNames(p, mem_ctx, &n); if (!NT_STATUS_IS_OK(status)) { @@ -861,7 +861,7 @@ static BOOL test_ChangePasswordNT3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, ret = False; } - if (!test_Close(p, mem_ctx, &user_handle)) { + if (!test_samr_handle_Close(p, mem_ctx, &user_handle)) { ret = False; } @@ -931,7 +931,7 @@ static BOOL test_ChangePasswordUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, *password = newpass; } - if (!test_Close(p, mem_ctx, &user_handle)) { + if (!test_samr_handle_Close(p, mem_ctx, &user_handle)) { ret = False; } @@ -955,8 +955,8 @@ static BOOL test_OemChangePasswordUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_c struct samr_GetDomPwInfo dom_pw_info; int policy_min_pw_len = 0; - struct samr_Name domain_name; - domain_name.name = ""; + struct samr_String domain_name; + domain_name.string = ""; dom_pw_info.in.name = &domain_name; printf("Testing OemChangePasswordUser2\n"); @@ -968,8 +968,8 @@ static BOOL test_OemChangePasswordUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_c newpass = samr_rand_pass(mem_ctx, policy_min_pw_len); - server.name = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p)); - account.name = TEST_ACCOUNT_NAME; + server.string = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p)); + account.string = TEST_ACCOUNT_NAME; E_deshash(oldpass, old_lm_hash); E_deshash(newpass, new_lm_hash); @@ -1001,7 +1001,7 @@ static BOOL test_ChangePasswordUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, NTSTATUS status; struct samr_ChangePasswordUser2 r; BOOL ret = True; - struct samr_Name server, account; + struct samr_String server, account; struct samr_CryptPassword nt_pass, lm_pass; struct samr_Password nt_verifier, lm_verifier; char *oldpass = *password; @@ -1012,8 +1012,8 @@ static BOOL test_ChangePasswordUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct samr_GetDomPwInfo dom_pw_info; int policy_min_pw_len = 0; - struct samr_Name domain_name; - domain_name.name = ""; + struct samr_String domain_name; + domain_name.string = ""; dom_pw_info.in.name = &domain_name; printf("Testing ChangePasswordUser2\n"); @@ -1025,8 +1025,8 @@ static BOOL test_ChangePasswordUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, newpass = samr_rand_pass(mem_ctx, policy_min_pw_len); - server.name = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p)); - init_samr_Name(&account, TEST_ACCOUNT_NAME); + server.string = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p)); + init_samr_String(&account, TEST_ACCOUNT_NAME); E_md4hash(oldpass, old_nt_hash); E_md4hash(newpass, new_nt_hash); @@ -1070,7 +1070,7 @@ static BOOL test_ChangePasswordUser3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, NTSTATUS status; struct samr_ChangePasswordUser3 r; BOOL ret = True; - struct samr_Name server, account; + struct samr_String server, account; struct samr_CryptPassword nt_pass, lm_pass; struct samr_Password nt_verifier, lm_verifier; char *oldpass = *password; @@ -1080,8 +1080,8 @@ static BOOL test_ChangePasswordUser3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("Testing ChangePasswordUser3\n"); - server.name = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p)); - init_samr_Name(&account, TEST_ACCOUNT_NAME); + server.string = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p)); + init_samr_String(&account, TEST_ACCOUNT_NAME); E_md4hash(oldpass, old_nt_hash); E_md4hash(newpass, new_nt_hash); @@ -1462,28 +1462,28 @@ static BOOL test_CreateAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, { NTSTATUS status; struct samr_CreateDomAlias r; - struct samr_Name name; + struct samr_String name; uint32_t rid; BOOL ret = True; - init_samr_Name(&name, TEST_ALIASNAME); + init_samr_String(&name, TEST_ALIASNAME); r.in.domain_handle = domain_handle; r.in.aliasname = &name; r.in.access_mask = SEC_RIGHT_MAXIMUM_ALLOWED; r.out.alias_handle = alias_handle; r.out.rid = &rid; - printf("Testing CreateAlias (%s)\n", r.in.aliasname->name); + printf("Testing CreateAlias (%s)\n", r.in.aliasname->string); status = dcerpc_samr_CreateDomAlias(p, mem_ctx, &r); if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) { - printf("Server refused create of '%s'\n", r.in.aliasname->name); + printf("Server refused create of '%s'\n", r.in.aliasname->string); return True; } if (NT_STATUS_EQUAL(status, NT_STATUS_ALIAS_EXISTS)) { - if (!test_DeleteAlias_byname(p, mem_ctx, domain_handle, r.in.aliasname->name)) { + if (!test_DeleteAlias_byname(p, mem_ctx, domain_handle, r.in.aliasname->string)) { return False; } status = dcerpc_samr_CreateDomAlias(p, mem_ctx, &r); @@ -1554,10 +1554,10 @@ static BOOL test_CreateUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, /* This call creates a 'normal' account - check that it really does */ const uint32_t acct_flags = ACB_NORMAL; - struct samr_Name name; + struct samr_String name; BOOL ret = True; - init_samr_Name(&name, TEST_ACCOUNT_NAME); + init_samr_String(&name, TEST_ACCOUNT_NAME); r.in.domain_handle = domain_handle; r.in.account_name = &name; @@ -1565,18 +1565,18 @@ static BOOL test_CreateUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, r.out.user_handle = user_handle; r.out.rid = &rid; - printf("Testing CreateUser(%s)\n", r.in.account_name->name); + printf("Testing CreateUser(%s)\n", r.in.account_name->string); status = dcerpc_samr_CreateUser(p, mem_ctx, &r); if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) { - printf("Server refused create of '%s'\n", r.in.account_name->name); + printf("Server refused create of '%s'\n", r.in.account_name->string); ZERO_STRUCTP(user_handle); return True; } if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) { - if (!test_DeleteUser_byname(p, mem_ctx, domain_handle, r.in.account_name->name)) { + if (!test_DeleteUser_byname(p, mem_ctx, domain_handle, r.in.account_name->string)) { return False; } status = dcerpc_samr_CreateUser(p, mem_ctx, &r); @@ -1675,7 +1675,7 @@ static BOOL test_CreateUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct samr_DeleteUser d; struct policy_handle user_handle; uint32_t rid; - struct samr_Name name; + struct samr_String name; BOOL ret = True; int i; @@ -1705,7 +1705,7 @@ static BOOL test_CreateUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, uint32_t acct_flags = account_types[i].acct_flags; uint32_t access_granted; - init_samr_Name(&name, account_types[i].account_name); + init_samr_String(&name, account_types[i].account_name); r.in.domain_handle = handle; r.in.account_name = &name; @@ -1715,16 +1715,16 @@ static BOOL test_CreateUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, r.out.access_granted = &access_granted; r.out.rid = &rid; - printf("Testing CreateUser2(%s, 0x%x)\n", r.in.account_name->name, acct_flags); + printf("Testing CreateUser2(%s, 0x%x)\n", r.in.account_name->string, acct_flags); status = dcerpc_samr_CreateUser2(p, mem_ctx, &r); if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) { - printf("Server refused create of '%s'\n", r.in.account_name->name); + printf("Server refused create of '%s'\n", r.in.account_name->string); continue; } else if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) { - if (!test_DeleteUser_byname(p, mem_ctx, handle, r.in.account_name->name)) { + if (!test_DeleteUser_byname(p, mem_ctx, handle, r.in.account_name->string)) { return False; } status = dcerpc_samr_CreateUser2(p, mem_ctx, &r); @@ -1883,12 +1883,12 @@ static BOOL test_SetGroupInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, the name is still reserved, so creating the old name fails, but deleting by the old name also fails */ if (s.in.level == 2) { - init_samr_Name(&s.in.info->name, "NewName"); + init_samr_String(&s.in.info->string, "NewName"); } #endif if (s.in.level == 4) { - init_samr_Name(&s.in.info->description, "test description"); + init_samr_String(&s.in.info->description, "test description"); } status = dcerpc_samr_SetGroupInfo(p, mem_ctx, &s); @@ -2007,7 +2007,7 @@ static BOOL test_OpenUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, ret = False; } - if (!test_Close(p, mem_ctx, &user_handle)) { + if (!test_samr_handle_Close(p, mem_ctx, &user_handle)) { ret = False; } @@ -2047,7 +2047,7 @@ static BOOL test_OpenGroup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, ret = False; } - if (!test_Close(p, mem_ctx, &group_handle)) { + if (!test_samr_handle_Close(p, mem_ctx, &group_handle)) { ret = False; } @@ -2087,7 +2087,7 @@ static BOOL test_OpenAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, ret = False; } - if (!test_Close(p, mem_ctx, &alias_handle)) { + if (!test_samr_handle_Close(p, mem_ctx, &alias_handle)) { ret = False; } @@ -2136,7 +2136,7 @@ static BOOL test_EnumDomainUsers(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("Testing LookupNames\n"); n.in.domain_handle = handle; n.in.num_names = r.out.sam->count; - n.in.names = talloc(mem_ctx, r.out.sam->count * sizeof(struct samr_Name)); + n.in.names = talloc(mem_ctx, r.out.sam->count * sizeof(struct samr_String)); for (i=0;i<r.out.sam->count;i++) { n.in.names[i] = r.out.sam->entries[i].name; } @@ -2292,7 +2292,7 @@ static BOOL test_GetDisplayEnumerationIndex(struct dcerpc_pipe *p, TALLOC_CTX *m r.in.domain_handle = handle; r.in.level = levels[i]; - init_samr_Name(&r.in.name, TEST_ACCOUNT_NAME); + init_samr_String(&r.in.name, TEST_ACCOUNT_NAME); status = dcerpc_samr_GetDisplayEnumerationIndex(p, mem_ctx, &r); @@ -2304,7 +2304,7 @@ static BOOL test_GetDisplayEnumerationIndex(struct dcerpc_pipe *p, TALLOC_CTX *m ret = False; } - init_samr_Name(&r.in.name, "zzzzzzzz"); + init_samr_String(&r.in.name, "zzzzzzzz"); status = dcerpc_samr_GetDisplayEnumerationIndex(p, mem_ctx, &r); @@ -2333,7 +2333,7 @@ static BOOL test_GetDisplayEnumerationIndex2(struct dcerpc_pipe *p, TALLOC_CTX * r.in.domain_handle = handle; r.in.level = levels[i]; - init_samr_Name(&r.in.name, TEST_ACCOUNT_NAME); + init_samr_String(&r.in.name, TEST_ACCOUNT_NAME); status = dcerpc_samr_GetDisplayEnumerationIndex2(p, mem_ctx, &r); if (ok_lvl[i] && @@ -2344,7 +2344,7 @@ static BOOL test_GetDisplayEnumerationIndex2(struct dcerpc_pipe *p, TALLOC_CTX * ret = False; } - init_samr_Name(&r.in.name, "zzzzzzzz"); + init_samr_String(&r.in.name, "zzzzzzzz"); status = dcerpc_samr_GetDisplayEnumerationIndex2(p, mem_ctx, &r); if (ok_lvl[i] && !NT_STATUS_EQUAL(NT_STATUS_NO_MORE_ENTRIES, status)) { @@ -2564,7 +2564,7 @@ static BOOL test_GroupList(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, for (i=0; i<q1.out.sam->count; i++) { add_string_to_array(mem_ctx, - q1.out.sam->entries[i].name.name, + q1.out.sam->entries[i].name.string, &names, &num_names); } } @@ -2594,7 +2594,7 @@ static BOOL test_GroupList(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, for (i=0; i<q2.out.info.info5.count; i++) { int j; - const char *name = q2.out.info.info5.entries[i].account_name.name; + const char *name = q2.out.info.info5.entries[i].account_name.string; BOOL found = False; for (j=0; j<num_names; j++) { if (names[j] == NULL) @@ -2803,10 +2803,10 @@ static BOOL test_CreateDomainGroup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, NTSTATUS status; struct samr_CreateDomainGroup r; uint32_t rid; - struct samr_Name name; + struct samr_String name; BOOL ret = True; - init_samr_Name(&name, TEST_GROUPNAME); + init_samr_String(&name, TEST_GROUPNAME); r.in.domain_handle = domain_handle; r.in.name = &name; @@ -2814,19 +2814,19 @@ static BOOL test_CreateDomainGroup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, r.out.group_handle = group_handle; r.out.rid = &rid; - printf("Testing CreateDomainGroup(%s)\n", r.in.name->name); + printf("Testing CreateDomainGroup(%s)\n", r.in.name->string); status = dcerpc_samr_CreateDomainGroup(p, mem_ctx, &r); if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) { - printf("Server refused create of '%s'\n", r.in.name->name); + printf("Server refused create of '%s'\n", r.in.name->string); ZERO_STRUCTP(group_handle); return True; } if (NT_STATUS_EQUAL(status, NT_STATUS_GROUP_EXISTS) || NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) { - if (!test_DeleteGroup_byname(p, mem_ctx, domain_handle, r.in.name->name)) { + if (!test_DeleteGroup_byname(p, mem_ctx, domain_handle, r.in.name->string)) { return False; } status = dcerpc_samr_CreateDomainGroup(p, mem_ctx, &r); @@ -2906,7 +2906,7 @@ static BOOL test_OpenDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, /* run the domain tests with the main handle closed - this tests the servers reference counting */ - ret &= test_Close(p, mem_ctx, handle); + ret &= test_samr_handle_Close(p, mem_ctx, handle); ret &= test_QuerySecurity(p, mem_ctx, &domain_handle); ret &= test_RemoveMemberFromForeignDomain(p, mem_ctx, &domain_handle); @@ -2945,7 +2945,7 @@ static BOOL test_OpenDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, ret = False; } - ret &= test_Close(p, mem_ctx, &domain_handle); + ret &= test_samr_handle_Close(p, mem_ctx, &domain_handle); /* reconnect the main handle */ ret &= test_Connect(p, mem_ctx, handle); @@ -2954,19 +2954,19 @@ static BOOL test_OpenDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } static BOOL test_LookupDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, - struct policy_handle *handle, struct samr_Name *domain) + struct policy_handle *handle, struct samr_String *domain) { NTSTATUS status; struct samr_LookupDomain r; - struct samr_Name n2; + struct samr_String n2; BOOL ret = True; - printf("Testing LookupDomain(%s)\n", domain->name); + printf("Testing LookupDomain(%s)\n", domain->string); /* check for correct error codes */ r.in.connect_handle = handle; r.in.domain = &n2; - n2.name = NULL; + n2.string = NULL; status = dcerpc_samr_LookupDomain(p, mem_ctx, &r); if (!NT_STATUS_EQUAL(NT_STATUS_INVALID_PARAMETER, status)) { @@ -2974,7 +2974,7 @@ static BOOL test_LookupDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, ret = False; } - n2.name = "xxNODOMAINxx"; + n2.string = "xxNODOMAINxx"; status = dcerpc_samr_LookupDomain(p, mem_ctx, &r); if (!NT_STATUS_EQUAL(NT_STATUS_NO_SUCH_DOMAIN, status)) { @@ -3084,7 +3084,7 @@ static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, ret = False; } else { if (got_handle) { - test_Close(p, mem_ctx, handle); + test_samr_handle_Close(p, mem_ctx, handle); } got_handle = True; *handle = h; @@ -3103,7 +3103,7 @@ static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, ret = False; } else { if (got_handle) { - test_Close(p, mem_ctx, handle); + test_samr_handle_Close(p, mem_ctx, handle); } got_handle = True; *handle = h; @@ -3122,7 +3122,7 @@ static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, ret = False; } else { if (got_handle) { - test_Close(p, mem_ctx, handle); + test_samr_handle_Close(p, mem_ctx, handle); } got_handle = True; *handle = h; @@ -3146,7 +3146,7 @@ static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, ret = False; } else { if (got_handle) { - test_Close(p, mem_ctx, handle); + test_samr_handle_Close(p, mem_ctx, handle); } got_handle = True; *handle = h; @@ -3194,7 +3194,7 @@ BOOL torture_rpc_samr(void) ret = False; } - if (!test_Close(p, mem_ctx, &handle)) { + if (!test_samr_handle_Close(p, mem_ctx, &handle)) { ret = False; } diff --git a/source4/torture/rpc/schannel.c b/source4/torture/rpc/schannel.c index 7a9786fa2d..75fbe709b5 100644 --- a/source4/torture/rpc/schannel.c +++ b/source4/torture/rpc/schannel.c @@ -34,12 +34,12 @@ static BOOL test_samr_ops(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) NTSTATUS status; struct samr_GetDomPwInfo r; int i; - struct samr_Name name; + struct samr_String name; - name.name = lp_workgroup(); + name.string = lp_workgroup(); r.in.name = &name; - printf("Testing GetDomPwInfo with name %s\n", r.in.name->name); + printf("Testing GetDomPwInfo with name %s\n", r.in.name->string); /* do several ops to test credential chaining */ for (i=0;i<5;i++) { diff --git a/source4/torture/rpc/testjoin.c b/source4/torture/rpc/testjoin.c index 55f508941d..1815bb9ddb 100644 --- a/source4/torture/rpc/testjoin.c +++ b/source4/torture/rpc/testjoin.c @@ -43,10 +43,10 @@ static NTSTATUS DeleteUser_byname(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle user_handle; uint32_t rid; struct samr_LookupNames n; - struct samr_Name sname; + struct samr_String sname; struct samr_OpenUser r; - sname.name = name; + sname.string = name; n.in.domain_handle = handle; n.in.num_names = 1; @@ -103,7 +103,7 @@ struct test_join *torture_join_domain(const char *machine_name, uint32_t access_granted; uint32_t rid; DATA_BLOB session_key; - struct samr_Name name; + struct samr_String name; int policy_min_pw_len = 0; struct test_join *join; @@ -140,7 +140,7 @@ struct test_join *torture_join_domain(const char *machine_name, printf("Opening domain %s\n", domain); - name.name = domain; + name.string = domain; l.in.connect_handle = &handle; l.in.domain = &name; @@ -164,7 +164,7 @@ struct test_join *torture_join_domain(const char *machine_name, printf("Creating machine account %s\n", machine_name); again: - name.name = talloc_asprintf(join, "%s$", machine_name); + name.string = talloc_asprintf(join, "%s$", machine_name); r.in.domain_handle = &domain_handle; r.in.account_name = &name; r.in.acct_flags = acct_flags; @@ -176,7 +176,7 @@ again: status = dcerpc_samr_CreateUser2(join->p, join, &r); if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) { - status = DeleteUser_byname(join->p, join, &domain_handle, name.name); + status = DeleteUser_byname(join->p, join, &domain_handle, name.string); if (NT_STATUS_IS_OK(status)) { goto again; } @@ -238,6 +238,7 @@ again: if (machine_password) { *machine_password = join->machine_password; } + return join; failed: @@ -245,6 +246,10 @@ failed: return NULL; } +struct dcerpc_pipe *torture_join_samr_pipe(struct test_join *join) +{ + return join->p; +} /* leave the domain, deleting the machine acct |