r1025: Rename (across the samr and netlogon pipes, so far)
authorAndrew Bartlett <abartlet@samba.org>
Sat, 5 Jun 2004 03:22:10 +0000 (03:22 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:56:30 +0000 (12:56 -0500)
pwd -> password
passwd -> password

username -> account_name

Also work on consistant structure feild names between these two pipes,
and fix up some callers to use samr_Password for the netlogon
credential code.

Andrew Bartlett
(This used to be commit 4e35418c2776f7b79be5b358ffd077754685d1ac)

source4/auth/auth_sam.c
source4/librpc/idl/netlogon.idl
source4/librpc/idl/samr.idl
source4/librpc/rpc/dcerpc_schannel.c
source4/rpc_server/netlogon/dcerpc_netlogon.c
source4/rpc_server/samr/dcesrv_samr.c
source4/rpc_server/samr/samdb.c
source4/rpc_server/samr/samr_password.c
source4/torture/rpc/netlogon.c
source4/torture/rpc/samr.c

index 5d6e0b22f6460f146a552dc497c690d8cb170dc4..13b289c412f98c08527700302c64752f53919929 100644 (file)
@@ -280,8 +280,9 @@ static NTSTATUS check_sam_security(const struct auth_context *auth_context,
        }
 
        acct_expiry = samdb_result_nttime(msgs[0], "accountExpires", 0);
-       must_change_time = samdb_result_force_pwd_change(sam_ctx, mem_ctx, 
-                                                        domain_dn, msgs[0], "pwdLastSet");
+       must_change_time = samdb_result_force_password_change(sam_ctx, mem_ctx, 
+                                                             domain_dn, msgs[0], 
+                                                             "pwdLastSet");
        last_set_time = samdb_result_nttime(msgs[0], "pwdLastSet", 0);
 
        workstation_list = samdb_result_string(msgs[0], "userWorkstations", NULL);
index 64d9afeac3f8c1227a91296e3111d3a8b00fd975..35a10d86022a8b463a9ca573cf554f951fb405e4 100644 (file)
@@ -40,7 +40,7 @@ interface netlogon
 
        WERROR netr_LogonUasLogon(
                [in]   unistr *server_name,
-               [in]   unistr username,
+               [in]   unistr account_name,
                [in]   unistr workstation,
                [out]  netr_UasInfo *info
                );
@@ -56,7 +56,7 @@ interface netlogon
 
        WERROR netr_LogonUasLogoff(
                [in] unistr *server_name,
-               [in] unistr username,
+               [in] unistr account_name,
                [in] unistr workstation,
                [out] netr_UasLogoffInfo info
                );
@@ -97,7 +97,7 @@ interface netlogon
                uint32      parameter_control;
                uint32      logon_id_low;
                uint32      logon_id_high;
-               netr_String username;
+               netr_String account_name;
                netr_String workstation;
        } netr_IdentityInfo;
 
@@ -149,19 +149,19 @@ interface netlogon
                NTTIME logon_time;
                NTTIME logoff_time;
                NTTIME kickoff_time;
-               NTTIME passwd_last_set;
-               NTTIME passwd_can_change;
-               NTTIME passwd_must_change;
+               NTTIME password_last_set;
+               NTTIME password_can_change;
+               NTTIME password_must_change;
                netr_String account_name;
                netr_String full_name;
                netr_String logon_script;
                netr_String profile_path;
-               netr_String home_dir;
+               netr_String home_directory;
                netr_String home_drive;
                uint16 logon_count;
-               uint16 bad_passwd_count;
-               uint32 userid;
-               uint32 primary_group;
+               uint16 bad_password_count;
+               uint32 rid;
+               uint32 primary_gid;
                uint32 group_count;
                [size_is(group_count)] netr_GroupMembership *groupids;
                uint32 user_flags;
@@ -183,19 +183,19 @@ interface netlogon
                NTTIME logon_time;
                NTTIME logoff_time;
                NTTIME kickoff_time;
-               NTTIME passwd_last_set;
-               NTTIME passwd_can_change;
-               NTTIME passwd_must_change;
+               NTTIME password_last_set;
+               NTTIME password_can_change;
+               NTTIME password_must_change;
                netr_String account_name;
                netr_String full_name;
                netr_String logon_script;
                netr_String profile_path;
-               netr_String home_dir;
+               netr_String home_directory;
                netr_String home_drive;
                uint16 logon_count;
-               uint16 bad_passwd_count;
-               uint32 userid;
-               uint32 primary_group;
+               uint16 bad_password_count;
+               uint32 rid;
+               uint32 primary_gid;
                uint32 group_count;
                [size_is(group_count)] netr_GroupMembership *groupids;
                uint32 user_flags;
@@ -280,7 +280,7 @@ interface netlogon
 
        NTSTATUS netr_ServerAuthenticate(
                [in]         unistr *server_name,
-               [in]         unistr username,
+               [in]         unistr account_name,
                [in]         uint16 secure_channel_type,
                [in]         unistr computer_name,
                [in,out,ref] netr_Credential *credentials
@@ -292,7 +292,7 @@ interface netlogon
 
        NTSTATUS netr_ServerPasswordSet(
                [in]  unistr *server_name,
-               [in]  unistr username,
+               [in]  unistr account_name,
                [in]  uint16 secure_channel_type,
                [in]  unistr computer_name,
                [in]  netr_Authenticator credential,
@@ -305,7 +305,7 @@ interface netlogon
        /* Function 0x07 */
 
        typedef struct {
-               unistr *username;
+               unistr *account_name;
                netr_String unknown1;
                netr_String unknown2;
                netr_String unknown3;
@@ -366,10 +366,10 @@ interface netlogon
                netr_String DomainName;
                netr_String OEMInfo;
                NTTIME forcedlogoff;
-               uint16 minpasswdlen;
-               uint16 passwdhistorylen;
-               uint64 pwd_must_change_time;
-               uint64 pwd_can_change_time;
+               uint16 min_password_len;
+               uint16 password_history_len;
+               uint64 password_must_change_time;
+               uint64 password_can_change_time;
                uint64 sequence_num;
                NTTIME domain_create_time;
                uint32 SecurityInformation;
@@ -801,7 +801,7 @@ interface netlogon
 
        NTSTATUS netr_ServerAuthenticate2(
                [in]         unistr *server_name,
-               [in]         unistr username,
+               [in]         unistr account_name,
                [in]         uint16 secure_channel_type,
                [in]         unistr computer_name,
                [in,out,ref] netr_Credential *credentials,
@@ -884,7 +884,7 @@ interface netlogon
        /* Function 0x1a */
        NTSTATUS netr_ServerAuthenticate3(
                [in]         unistr *server_name,
-               [in]         unistr username,
+               [in]         unistr account_name,
                [in]         uint16 secure_channel_type,
                [in]         unistr computer_name,
                [in,out,ref] netr_Credential *credentials,
index 8d0a6c058427e3ce26c7926e5f005293bcb0c930..886c51b51f89acebca9f5df02e35c14fa6eb13dc 100644 (file)
        } samr_Role;
 
        typedef struct {
-               uint16 min_pwd_len;
+               uint16 min_password_len;
                uint16 password_history;
                uint32 password_properties;
                /* yes, these are signed. They are in negative 100ns */
        /* Function    0x0c     */
        NTSTATUS samr_CreateUser(
                [in,ref]      policy_handle *handle,
-               [in,ref]      samr_Name *username,
+               [in,ref]      samr_Name *account_name,
                [in]          uint32 access_mask,
                [out,ref]     policy_handle *acct_handle,
                [out,ref]     uint32 *rid
        /************************/
        /* Function    0x24     */
        typedef struct {
-               samr_Name username;
+               samr_Name account_name;
                samr_Name full_name;
                uint32 primary_gid;
                samr_Name description;
        } samr_UserInfo2;
 
        typedef struct {
-               samr_Name username;
+               samr_Name account_name;
                samr_Name full_name;
                uint32 rid;
                uint32 primary_gid;
                samr_Name home_directory;
                samr_Name home_drive;
                samr_Name logon_script;
-               samr_Name profile;
+               samr_Name profile_path;
                samr_Name workstations;
                NTTIME last_logon;
                NTTIME last_logoff;
-               NTTIME last_pwd_change;
-               NTTIME allow_pwd_change;
-               NTTIME force_pwd_change;
+               NTTIME last_password_change;
+               NTTIME allow_password_change;
+               NTTIME force_password_change;
                samr_LogonHours logon_hours;
-               uint16 bad_pwd_count;
+               uint16 bad_password_count;
                uint16 num_logons;
                uint32 acct_flags;
        } samr_UserInfo3;
        } samr_UserInfo4;
 
        typedef struct {
-               samr_Name username;
+               samr_Name account_name;
                samr_Name full_name;
                uint32 rid;
                uint32 primary_gid;
                samr_Name home_directory;
                samr_Name home_drive;
                samr_Name logon_script;
-               samr_Name profile;
+               samr_Name profile_path;
                samr_Name description;
                samr_Name workstations;
                NTTIME last_logon;
                NTTIME last_logoff;
                samr_LogonHours logon_hours;
-               uint16 bad_pwd_count;
+               uint16 bad_password_count;
                uint16 num_logons;
-               NTTIME last_pwd_change;
+               NTTIME last_password_change;
                NTTIME acct_expiry;
                uint32 acct_flags;
        } samr_UserInfo5;
 
        typedef struct {
-               samr_Name username;
+               samr_Name account_name;
                samr_Name full_name;
        } samr_UserInfo6;
 
        typedef struct {
-               samr_Name username;
+               samr_Name account_name;
        } samr_UserInfo7;
 
        typedef struct {
        } samr_UserInfo11;
 
        typedef struct {
-               samr_Name profile;
+               samr_Name profile_path;
        } samr_UserInfo12;
 
        typedef struct {
        const int SAMR_FIELD_DESCRIPTION  = 0x00000010;
        const int SAMR_FIELD_COMMENT      = 0x00000020;
        const int SAMR_FIELD_LOGON_SCRIPT = 0x00000100;
-       const int SAMR_FIELD_PROFILE      = 0x00000200;
+       const int SAMR_FIELD_PROFILE_PATH = 0x00000200;
        const int SAMR_FIELD_WORKSTATION  = 0x00000400;
        const int SAMR_FIELD_LOGON_HOURS  = 0x00002000;
        const int SAMR_FIELD_CALLBACK     = 0x00200000;
        typedef struct {
                NTTIME last_logon;
                NTTIME last_logoff;
-               NTTIME last_pwd_change;
+               NTTIME last_password_change;
                NTTIME acct_expiry;
-               NTTIME allow_pwd_change;
-               NTTIME force_pwd_change;
-               samr_Name username;
+               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;
+               samr_Name profile_path;
                samr_Name description;
                samr_Name workstations;
                samr_Name comment;
                uint32 acct_flags;
                uint32 fields_present;
                samr_LogonHours logon_hours;
-               uint16 bad_pwd_count;
+               uint16 bad_password_count;
                uint16 num_logons;
                uint16 country_code;
                uint16 code_page;
-               uint8  nt_pwd_set;
-               uint8  lm_pwd_set;
+               uint8  nt_password_set;
+               uint8  lm_password_set;
                uint8  expired_flag;
                uint8  unknown4;
        } samr_UserInfo21;
        const uint32 DOMAIN_REFUSE_PASSWORD_CHANGE   = 0x00000020;
 
        typedef struct {
-               uint16 min_pwd_len;
+               uint16 min_password_len;
                uint32 password_properties;
        } samr_PwInfo;
 
        /* Function    0x32     */
        NTSTATUS samr_CreateUser2(
                [in,ref]      policy_handle *handle,
-               [in,ref]      samr_Name *username,
+               [in,ref]      samr_Name *account_name,
                [in]          uint32 acct_flags,
                [in]          uint32 access_mask,
                [out,ref]     policy_handle *acct_handle,
index b4dbfbb5a5d805607ff91cf341db887a25165ace..ebfcdf7ff34ac03dc4f6d4d2816aa075b3bdf4b9 100644 (file)
@@ -128,7 +128,7 @@ NTSTATUS dcerpc_schannel_key(struct dcerpc_pipe *p,
                          negotiate_flags);
 
        a.in.server_name = r.in.server_name;
-       a.in.username = talloc_asprintf(p->mem_ctx, "%s$", workstation);
+       a.in.account_name = talloc_asprintf(p->mem_ctx, "%s$", workstation);
        a.in.secure_channel_type = chan_type;
        a.in.computer_name = workstation;
        a.in.negotiate_flags = &negotiate_flags;
index ea76be44f5668342b056e9785705c451934e2741..e159123c87309a98dabadfff5dcc3c4b3d4802b3 100644 (file)
@@ -56,16 +56,6 @@ static void netlogon_unbind(struct dcesrv_connection *conn, const struct dcesrv_
 #define DCESRV_INTERFACE_NETLOGON_BIND netlogon_bind
 #define DCESRV_INTERFACE_NETLOGON_UNBIND netlogon_unbind
 
-/* 
-  netr_ServerReqChallenge 
-
-       NTSTATUS netr_ServerReqChallenge(
-               [in]         unistr *server_name,
-               [in]         unistr computer_name,
-               [in,out,ref] netr_Credential *credentials
-               );
-
-*/
 static NTSTATUS netr_ServerReqChallenge(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
                                        struct netr_ServerReqChallenge *r)
 {
@@ -113,32 +103,12 @@ static NTSTATUS netr_ServerReqChallenge(struct dcesrv_call_state *dce_call, TALL
        return NT_STATUS_OK;
 }
 
-
-/* 
-  netr_ServerAuthenticate 
-
-        secure channel types:
-       const int SEC_CHAN_WKSTA   = 2;
-       const int SEC_CHAN_DOMAIN  = 4;
-       const int SEC_CHAN_BDC     = 6;
-
-       NTSTATUS netr_ServerAuthenticate3(
-               [in]         unistr *server_name,
-               [in]         unistr username,
-               [in]         uint16 secure_channel_type,
-               [in]         unistr computer_name,
-               [in,out,ref] netr_Credential *credentials
-               [in,out,ref] uint32 *negotiate_flags,
-               [out,ref]    uint32 *rid
-               );
-*/
 static NTSTATUS netr_ServerAuthenticate3(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
                                         struct netr_ServerAuthenticate3 *r)
 {
        struct server_pipe_state *pipe_state = dce_call->conn->private;
        void *sam_ctx;
-       uint8_t *mach_pwd;
+       struct samr_Password *mach_pwd;
        uint16_t acct_flags;
        int num_records;
        struct ldb_message **msgs;
@@ -162,17 +132,17 @@ static NTSTATUS netr_ServerAuthenticate3(struct dcesrv_call_state *dce_call, TAL
        /* pull the user attributes */
        num_records = samdb_search(sam_ctx, mem_ctx, NULL, &msgs, attrs,
                                   "(&(sAMAccountName=%s)(objectclass=user))", 
-                                  r->in.username);
+                                  r->in.account_name);
 
        if (num_records == 0) {
                DEBUG(3,("Couldn't find user [%s] in samdb.\n", 
-                        r->in.username));
+                        r->in.account_name));
                samdb_close(sam_ctx);
                return NT_STATUS_NO_SUCH_USER;
        }
 
        if (num_records > 1) {
-               DEBUG(1,("Found %d records matching user [%s]\n", num_records, r->in.username));
+               DEBUG(1,("Found %d records matching user [%s]\n", num_records, r->in.account_name));
                samdb_close(sam_ctx);
                return NT_STATUS_INTERNAL_DB_CORRUPTION;
        }
@@ -181,7 +151,7 @@ static NTSTATUS netr_ServerAuthenticate3(struct dcesrv_call_state *dce_call, TAL
                                             "userAccountControl");
 
        if (acct_flags & ACB_DISABLED) {
-               DEBUG(1, ("Account [%s] is disabled\n", r->in.username));
+               DEBUG(1, ("Account [%s] is disabled\n", r->in.account_name));
                return NT_STATUS_ACCESS_DENIED;
        }
 
@@ -242,7 +212,7 @@ static NTSTATUS netr_ServerAuthenticate3(struct dcesrv_call_state *dce_call, TAL
                talloc_free(pipe_state->mem_ctx, pipe_state->account_name);
        }
 
-       pipe_state->account_name = talloc_strdup(pipe_state->mem_ctx, r->in.username);
+       pipe_state->account_name = talloc_strdup(pipe_state->mem_ctx, r->in.account_name);
        
        if (pipe_state->computer_name) {
                /* We don't want a memory leak on this long-lived talloc context */
@@ -265,7 +235,7 @@ static NTSTATUS netr_ServerAuthenticate(struct dcesrv_call_state *dce_call, TALL
        uint32 negotiate_flags, rid;
 
        r3.in.server_name = r->in.server_name;
-       r3.in.username = r->in.username;
+       r3.in.account_name = r->in.account_name;
        r3.in.secure_channel_type = r->in.secure_channel_type;
        r3.in.computer_name = r->in.computer_name;
        r3.in.credentials = r->in.credentials;
@@ -284,7 +254,7 @@ static NTSTATUS netr_ServerAuthenticate2(struct dcesrv_call_state *dce_call, TAL
        uint32 rid;
 
        r3.in.server_name = r->in.server_name;
-       r3.in.username = r->in.username;
+       r3.in.account_name = r->in.account_name;
        r3.in.secure_channel_type = r->in.secure_channel_type;
        r3.in.computer_name = r->in.computer_name;
        r3.in.credentials = r->in.credentials;
@@ -309,20 +279,7 @@ static BOOL netr_creds_server_step_check(struct server_pipe_state *pipe_state,
                                       return_authenticator);
 }
 
-/* 
- netr_ServerPasswordSet 
-
-       NTSTATUS netr_ServerPasswordSet(
-               [in]  unistr *server_name,
-               [in]  unistr username,
-               [in]  uint16 secure_channel_type,
-               [in]  unistr computer_name,
-               [in]  netr_Authenticator credential,
-               [in]  netr_Password new_password,
-               [out] netr_Authenticator return_authenticator
-               );
 
-*/
 static NTSTATUS netr_ServerPasswordSet(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
                                       struct netr_ServerPasswordSet *r)
 {
index eb9f58cfb42647575eb98709bce86ba997bbfd1b..3b590baa6e991307ef4dba13df7c70700d6ff90b 100644 (file)
@@ -622,7 +622,7 @@ static NTSTATUS samr_CreateUser2(struct dcesrv_call_state *dce_call, TALLOC_CTX
        const char *name;
        struct ldb_message msg;
        uint32_t rid;
-       const char *username, *sidstr;
+       const char *account_name, *sidstr;
        time_t now = time(NULL);
        TALLOC_CTX *mem_ctx2;
        struct dcesrv_handle *u_handle;
@@ -638,16 +638,16 @@ static NTSTATUS samr_CreateUser2(struct dcesrv_call_state *dce_call, TALLOC_CTX
 
        d_state = h->data;
 
-       username = r->in.username->name;
+       account_name = r->in.account_name->name;
 
-       if (username == NULL) {
+       if (account_name == NULL) {
                return NT_STATUS_INVALID_PARAMETER;
        }
 
        /* check if the user already exists */
        name = samdb_search_string(d_state->sam_ctx, mem_ctx, NULL, 
                                   "sAMAccountName", 
-                                  "(&(sAMAccountName=%s)(objectclass=user))", username);
+                                  "(&(sAMAccountName=%s)(objectclass=user))", account_name);
        if (name != NULL) {
                return NT_STATUS_USER_EXISTS;
        }
@@ -720,13 +720,13 @@ static NTSTATUS samr_CreateUser2(struct dcesrv_call_state *dce_call, TALLOC_CTX
        }
 
        /* add core elements to the ldb_message for the user */
-       msg.dn = talloc_asprintf(mem_ctx, "CN=%s,CN=%s,%s", username, container, d_state->domain_dn);
+       msg.dn = talloc_asprintf(mem_ctx, "CN=%s,CN=%s,%s", account_name, container, d_state->domain_dn);
        if (!msg.dn) {
                return NT_STATUS_NO_MEMORY;             
        }
-       samdb_msg_add_string(d_state->sam_ctx, mem_ctx, &msg, "name", username);
-       samdb_msg_add_string(d_state->sam_ctx, mem_ctx, &msg, "cn", username);
-       samdb_msg_add_string(d_state->sam_ctx, mem_ctx, &msg, "sAMAccountName", username);
+       samdb_msg_add_string(d_state->sam_ctx, mem_ctx, &msg, "name", account_name);
+       samdb_msg_add_string(d_state->sam_ctx, mem_ctx, &msg, "cn", account_name);
+       samdb_msg_add_string(d_state->sam_ctx, mem_ctx, &msg, "sAMAccountName", account_name);
        samdb_msg_add_string(d_state->sam_ctx, mem_ctx, &msg, "objectClass", "user");
        if (additional_class) {
                samdb_msg_add_string(d_state->sam_ctx, mem_ctx, &msg, "objectClass", additional_class);
@@ -743,7 +743,7 @@ static NTSTATUS samr_CreateUser2(struct dcesrv_call_state *dce_call, TALLOC_CTX
        }
 
        /* create user state and new policy handle */
-       mem_ctx2 = talloc_init("CreateUser(%s)", username);
+       mem_ctx2 = talloc_init("CreateUser(%s)", account_name);
        if (!mem_ctx2) {
                return NT_STATUS_NO_MEMORY;
        }
@@ -758,7 +758,7 @@ static NTSTATUS samr_CreateUser2(struct dcesrv_call_state *dce_call, TALLOC_CTX
        a_state->domain_state = d_state;
        a_state->account_dn = talloc_steal(mem_ctx, mem_ctx2, msg.dn);
        a_state->account_sid = talloc_strdup(mem_ctx2, sidstr);
-       a_state->account_name = talloc_strdup(mem_ctx2, username);
+       a_state->account_name = talloc_strdup(mem_ctx2, account_name);
        if (!a_state->account_name || !a_state->account_sid) {
                return NT_STATUS_NO_MEMORY;
        }
@@ -795,7 +795,7 @@ static NTSTATUS samr_CreateUser(struct dcesrv_call_state *dce_call, TALLOC_CTX *
 
        /* a simple wrapper around samr_CreateUser2 works nicely */
        r2.in.handle = r->in.handle;
-       r2.in.username = r->in.username;
+       r2.in.account_name = r->in.account_name;
        r2.in.acct_flags = ACB_NORMAL;
        r2.in.access_mask = r->in.access_mask;
        r2.out.acct_handle = r->out.acct_handle;
@@ -1109,10 +1109,10 @@ static NTSTATUS samr_OpenGroup(struct dcesrv_call_state *dce_call, TALLOC_CTX *m
 #define QUERY_NTTIME(msg, field, attr) \
        r->out.info->field = samdb_result_nttime(msg, attr, 0);
 #define QUERY_APASSC(msg, field, attr) \
-       r->out.info->field = samdb_result_allow_pwd_change(a_state->sam_ctx, mem_ctx, \
+       r->out.info->field = samdb_result_allow_password_change(a_state->sam_ctx, mem_ctx, \
                                                           a_state->domain_state->domain_dn, msg, attr);
 #define QUERY_FPASSC(msg, field, attr) \
-       r->out.info->field = samdb_result_force_pwd_change(a_state->sam_ctx, mem_ctx, \
+       r->out.info->field = samdb_result_force_password_change(a_state->sam_ctx, mem_ctx, \
                                                           a_state->domain_state->domain_dn, msg, attr);
 #define QUERY_LHOURS(msg, field, attr) \
        r->out.info->field = samdb_result_logon_hours(mem_ctx, msg, attr);
@@ -1401,7 +1401,7 @@ static NTSTATUS samr_OpenUser(struct dcesrv_call_state *dce_call, TALLOC_CTX *me
        struct samr_domain_state *d_state;
        struct samr_account_state *a_state;
        struct dcesrv_handle *h;
-       const char *username, *sidstr;
+       const char *account_name, *sidstr;
        TALLOC_CTX *mem_ctx2;
        struct ldb_message **msgs;
        struct dcesrv_handle *u_handle;
@@ -1433,8 +1433,8 @@ static NTSTATUS samr_OpenUser(struct dcesrv_call_state *dce_call, TALLOC_CTX *me
                return NT_STATUS_INTERNAL_DB_CORRUPTION;
        }
 
-       username = samdb_result_string(msgs[0], "sAMAccountName", NULL);
-       if (username == NULL) {
+       account_name = samdb_result_string(msgs[0], "sAMAccountName", NULL);
+       if (account_name == NULL) {
                DEBUG(1,("sAMAccountName field missing for sid %s\n", sidstr));
                return NT_STATUS_INTERNAL_DB_CORRUPTION;
        }
@@ -1455,7 +1455,7 @@ static NTSTATUS samr_OpenUser(struct dcesrv_call_state *dce_call, TALLOC_CTX *me
        a_state->domain_state = d_state;
        a_state->account_dn = talloc_steal(mem_ctx, mem_ctx2, msgs[0]->dn);
        a_state->account_sid = talloc_strdup(mem_ctx2, sidstr);
-       a_state->account_name = talloc_strdup(mem_ctx2, username);
+       a_state->account_name = talloc_strdup(mem_ctx2, account_name);
        if (!a_state->account_name || !a_state->account_sid) {
                return NT_STATUS_NO_MEMORY;
        }
@@ -1541,7 +1541,7 @@ 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.username.name,    "sAMAccountName");
+               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");
@@ -1555,22 +1555,22 @@ static NTSTATUS samr_QueryUserInfo(struct dcesrv_call_state *dce_call, TALLOC_CT
                break;
 
        case 3:
-               QUERY_STRING(msg, info3.username.name,       "sAMAccountName");
+               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.name,        "profilePath");
+               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_pwd_change,     "pwdLastSet");
-               QUERY_APASSC(msg, info3.allow_pwd_change,    "pwdLastSet");
-               QUERY_FPASSC(msg, info3.force_pwd_change,    "pwdLastSet");
+               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_pwd_count,       "badPwdCount");
+               QUERY_UINT  (msg, info3.bad_password_count,  "badPwdCount");
                QUERY_UINT  (msg, info3.num_logons,          "logonCount");
                QUERY_AFLAGS(msg, info3.acct_flags,          "userAccountControl");
                break;
@@ -1580,33 +1580,33 @@ static NTSTATUS samr_QueryUserInfo(struct dcesrv_call_state *dce_call, TALLOC_CT
                break;
 
        case 5:
-               QUERY_STRING(msg, info5.username.name,       "sAMAccountName");
+               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.name,        "profilePath");
+               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_pwd_count,       "badPwdCount");
+               QUERY_UINT  (msg, info5.bad_password_count,  "badPwdCount");
                QUERY_UINT  (msg, info5.num_logons,          "logonCount");
-               QUERY_NTTIME(msg, info5.last_pwd_change,     "pwdLastSet");
+               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.username.name,       "sAMAccountName");
+               QUERY_STRING(msg, info6.account_name.name,   "sAMAccountName");
                QUERY_STRING(msg, info6.full_name.name,      "displayName");
                break;
 
        case 7:
-               QUERY_STRING(msg, info7.username.name,       "sAMAccountName");
+               QUERY_STRING(msg, info7.account_name.name,   "sAMAccountName");
                break;
 
        case 8:
@@ -1652,11 +1652,11 @@ static NTSTATUS samr_QueryUserInfo(struct dcesrv_call_state *dce_call, TALLOC_CT
        case 21:
                QUERY_NTTIME(msg, info21.last_logon,          "lastLogon");
                QUERY_NTTIME(msg, info21.last_logoff,         "lastLogoff");
-               QUERY_NTTIME(msg, info21.last_pwd_change,     "pwdLastSet");
+               QUERY_NTTIME(msg, info21.last_password_change,     "pwdLastSet");
                QUERY_NTTIME(msg, info21.acct_expiry,         "accountExpires");
-               QUERY_APASSC(msg, info21.allow_pwd_change,    "pwdLastSet");
-               QUERY_FPASSC(msg, info21.force_pwd_change,    "pwdLastSet");
-               QUERY_STRING(msg, info21.username.name,       "sAMAccountName");
+               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");
@@ -1671,7 +1671,7 @@ static NTSTATUS samr_QueryUserInfo(struct dcesrv_call_state *dce_call, TALLOC_CT
                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_pwd_count,       "badPwdCount");
+               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");
@@ -1958,7 +1958,7 @@ static NTSTATUS samr_GetUserPwInfo(struct dcesrv_call_state *dce_call, TALLOC_CT
 
        a_state = h->data;
 
-       r->out.info.min_pwd_len = samdb_search_uint(a_state->sam_ctx, mem_ctx, 0, NULL, "minPwdLength", 
+       r->out.info.min_password_len = samdb_search_uint(a_state->sam_ctx, mem_ctx, 0, NULL, "minPwdLength", 
                                                    "dn=%s", a_state->domain_state->domain_dn);
        r->out.info.password_properties = samdb_search_uint(a_state->sam_ctx, mem_ctx, 0, NULL, "pwdProperties", 
                                                            "dn=%s", a_state->account_dn);
@@ -2095,7 +2095,7 @@ static NTSTATUS samr_GetDomPwInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX
                return NT_STATUS_INTERNAL_DB_CORRUPTION;
        }
 
-       r->out.info.min_pwd_len         = samdb_result_uint(msgs[0], "minPwdLength", 0);
+       r->out.info.min_password_len         = samdb_result_uint(msgs[0], "minPwdLength", 0);
        r->out.info.password_properties = samdb_result_uint(msgs[0], "pwdProperties", 1);
 
        samdb_search_free(sam_ctx, mem_ctx, msgs);
index 872ec82894dc66dd059f93d55b63202b4667903b..c188e917a78862fa3844a284f28538e018e3f2dc 100644 (file)
@@ -427,11 +427,13 @@ uint64_t samdb_result_uint64(struct ldb_message *msg, const char *attr, uint64_t
 
 
 /*
-  construct the allow_pwd_change field from the PwdLastSet attribute and the 
+  construct the allow_password_change field from the PwdLastSet attribute and the 
   domain password settings
 */
-NTTIME samdb_result_allow_pwd_change(void *ctx, TALLOC_CTX *mem_ctx, 
-                                    const char *domain_dn, struct ldb_message *msg, const char *attr)
+NTTIME samdb_result_allow_password_change(void *ctx, TALLOC_CTX *mem_ctx, 
+                                         const char *domain_dn, 
+                                         struct ldb_message *msg, 
+                                         const char *attr)
 {
        uint64_t attr_time = samdb_result_uint64(msg, attr, 0);
        int64_t minPwdAge;
@@ -440,7 +442,8 @@ NTTIME samdb_result_allow_pwd_change(void *ctx, TALLOC_CTX *mem_ctx,
                return 0;
        }
 
-       minPwdAge = samdb_search_int64(ctx, mem_ctx, 0, NULL, "minPwdAge", "dn=%s", domain_dn);
+       minPwdAge = samdb_search_int64(ctx, mem_ctx, 0, NULL, 
+                                      "minPwdAge", "dn=%s", domain_dn);
 
        /* yes, this is a -= not a += as minPwdAge is stored as the negative
           of the number of 100-nano-seconds */
@@ -450,11 +453,13 @@ NTTIME samdb_result_allow_pwd_change(void *ctx, TALLOC_CTX *mem_ctx,
 }
 
 /*
-  construct the force_pwd_change field from the PwdLastSet attribute and the 
+  construct the force_password_change field from the PwdLastSet attribute and the 
   domain password settings
 */
-NTTIME samdb_result_force_pwd_change(void *ctx, TALLOC_CTX *mem_ctx, 
-                                    const char *domain_dn, struct ldb_message *msg, const char *attr)
+NTTIME samdb_result_force_password_change(void *ctx, TALLOC_CTX *mem_ctx, 
+                                         const char *domain_dn, 
+                                         struct ldb_message *msg, 
+                                         const char *attr)
 {
        uint64_t attr_time = samdb_result_uint64(msg, attr, 0);
        int64_t maxPwdAge;
index b1dc4a7f6b2254c7dfffb15466b37d6c50036bb4..95e783f072285bddf728aba1e6c9b0b8a80b2e7d 100644 (file)
@@ -381,7 +381,7 @@ failed:
                return status;
        }
 
-       dominfo->min_pwd_len         = samdb_result_uint (res[0], "minPwdLength", 0);
+       dominfo->min_password_len    = samdb_result_uint (res[0], "minPwdLength", 0);
        dominfo->password_properties = samdb_result_uint (res[0], "pwdProperties", 0);
        dominfo->password_history    = samdb_result_uint (res[0], "pwdHistoryLength", 0);
        dominfo->max_password_age    = samdb_result_int64(res[0], "maxPwdAge", 0);
index 902910d17984ea4b98ea3d132949acd63a3d6e13..3ee7afa57545e74dc515c7f115d11c9cd1d66bae 100644 (file)
@@ -103,7 +103,7 @@ static BOOL join_domain_bdc(TALLOC_CTX *mem_ctx)
 again:
        name.name = talloc_asprintf(mem_ctx, "%s$", TEST_MACHINE_NAME);
        r.in.handle = &domain_handle;
-       r.in.username = &name;
+       r.in.account_name = &name;
        r.in.acct_flags = ACB_SVRTRUST;
        r.in.access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED;
        r.out.acct_handle = &join.acct_handle;
@@ -126,7 +126,7 @@ again:
 
        status = dcerpc_samr_GetUserPwInfo(join.p, mem_ctx, &pwp);
        if (NT_STATUS_IS_OK(status)) {
-               policy_min_pw_len = pwp.out.info.min_pwd_len;
+               policy_min_pw_len = pwp.out.info.min_password_len;
        }
 
        join.machine_password = generate_random_str(mem_ctx, MAX(8, policy_min_pw_len));
@@ -198,7 +198,7 @@ static BOOL test_LogonUasLogon(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
        struct netr_LogonUasLogon r;
 
        r.in.server_name = NULL;
-       r.in.username = lp_parm_string(-1, "torture", "username");
+       r.in.account_name = lp_parm_string(-1, "torture", "username");
        r.in.workstation = TEST_MACHINE_NAME;
 
        printf("Testing LogonUasLogon\n");
@@ -219,7 +219,7 @@ static BOOL test_LogonUasLogoff(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
        struct netr_LogonUasLogoff r;
 
        r.in.server_name = NULL;
-       r.in.username = lp_parm_string(-1, "torture", "username");
+       r.in.account_name = lp_parm_string(-1, "torture", "username");
        r.in.workstation = TEST_MACHINE_NAME;
 
        printf("Testing LogonUasLogoff\n");
@@ -242,7 +242,7 @@ static BOOL test_SetupCredentials(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        struct netr_ServerAuthenticate a;
        struct netr_Credential credentials1, credentials2, credentials3;
        const char *plain_pass;
-       uint8_t mach_pwd[16];
+       struct samr_Password mach_password;
 
        printf("Testing ServerReqChallenge\n");
 
@@ -265,16 +265,16 @@ static BOOL test_SetupCredentials(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
                return False;
        }
 
-       E_md4hash(plain_pass, mach_pwd);
+       E_md4hash(plain_pass, mach_password.hash);
 
        a.in.server_name = NULL;
-       a.in.username = talloc_asprintf(mem_ctx, "%s$", TEST_MACHINE_NAME);
+       a.in.account_name = talloc_asprintf(mem_ctx, "%s$", TEST_MACHINE_NAME);
        a.in.secure_channel_type = SEC_CHAN_BDC;
        a.in.computer_name = TEST_MACHINE_NAME;
        a.in.credentials = &credentials3;
        a.out.credentials = &credentials3;
 
-       creds_client_init(creds, &credentials1, &credentials2, mach_pwd, &credentials3, 
+       creds_client_init(creds, &credentials1, &credentials2, &mach_password, &credentials3, 
                          NETLOGON_NEG_AUTH2_FLAGS);
 
        printf("Testing ServerAuthenticate\n");
@@ -302,7 +302,7 @@ static BOOL test_SetupCredentials2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        struct netr_ServerAuthenticate2 a;
        struct netr_Credential credentials1, credentials2, credentials3;
        const char *plain_pass;
-       uint8_t mach_pwd[16];
+       struct samr_Password mach_password;
 
        printf("Testing ServerReqChallenge\n");
 
@@ -325,10 +325,10 @@ static BOOL test_SetupCredentials2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
                return False;
        }
 
-       E_md4hash(plain_pass, mach_pwd);
+       E_md4hash(plain_pass, mach_password.hash);
 
        a.in.server_name = NULL;
-       a.in.username = talloc_asprintf(mem_ctx, "%s$", TEST_MACHINE_NAME);
+       a.in.account_name = talloc_asprintf(mem_ctx, "%s$", TEST_MACHINE_NAME);
        a.in.secure_channel_type = SEC_CHAN_BDC;
        a.in.computer_name = TEST_MACHINE_NAME;
        a.in.negotiate_flags = &negotiate_flags;
@@ -336,7 +336,7 @@ static BOOL test_SetupCredentials2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        a.in.credentials = &credentials3;
        a.out.credentials = &credentials3;
 
-       creds_client_init(creds, &credentials1, &credentials2, mach_pwd, &credentials3, 
+       creds_client_init(creds, &credentials1, &credentials2, &mach_password, &credentials3, 
                          negotiate_flags);
 
        printf("Testing ServerAuthenticate2\n");
@@ -367,7 +367,7 @@ static BOOL test_SetupCredentials3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        struct netr_ServerAuthenticate3 a;
        struct netr_Credential credentials1, credentials2, credentials3;
        const char *plain_pass;
-       uint8_t mach_pwd[16];
+       struct samr_Password mach_password;
        uint32 rid;
 
        printf("Testing ServerReqChallenge\n");
@@ -391,10 +391,10 @@ static BOOL test_SetupCredentials3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
                return False;
        }
 
-       E_md4hash(plain_pass, mach_pwd);
+       E_md4hash(plain_pass, mach_password.hash);
 
        a.in.server_name = NULL;
-       a.in.username = talloc_asprintf(mem_ctx, "%s$", TEST_MACHINE_NAME);
+       a.in.account_name = talloc_asprintf(mem_ctx, "%s$", TEST_MACHINE_NAME);
        a.in.secure_channel_type = SEC_CHAN_BDC;
        a.in.computer_name = TEST_MACHINE_NAME;
        a.in.negotiate_flags = &negotiate_flags;
@@ -403,7 +403,7 @@ static BOOL test_SetupCredentials3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        a.out.negotiate_flags = &negotiate_flags;
        a.out.rid = &rid;
 
-       creds_client_init(creds, &credentials1, &credentials2, mach_pwd, &credentials3,
+       creds_client_init(creds, &credentials1, &credentials2, &mach_password, &credentials3,
                          negotiate_flags);
 
        printf("Testing ServerAuthenticate3\n");
@@ -434,7 +434,7 @@ enum ntlm_break {
 
 struct samlogon_state {
        TALLOC_CTX *mem_ctx;
-       const char *username;
+       const char *account_name;
        const char *password;
        struct dcerpc_pipe *p;
        struct netr_LogonSamLogon r;
@@ -473,7 +473,7 @@ static NTSTATUS check_samlogon(struct samlogon_state *samlogon_state,
                ninfo.logon_info.parameter_control = 0;
                ninfo.logon_info.logon_id_low = 0;
                ninfo.logon_info.logon_id_high = 0;
-               ninfo.logon_info.username.string = samlogon_state->username;
+               ninfo.logon_info.account_name.string = samlogon_state->account_name;
                ninfo.logon_info.workstation.string = TEST_MACHINE_NAME;
                
                memcpy(ninfo.challenge, chall->data, 8);
@@ -827,7 +827,7 @@ static BOOL test_lmv2_ntlmv2_broken(struct samlogon_state *samlogon_state, enum
        ZERO_STRUCT(user_session_key);
        
        /* TODO - test with various domain cases, and without domain */
-       if (!SMBNTLMv2encrypt(samlogon_state->username, lp_workgroup(), 
+       if (!SMBNTLMv2encrypt(samlogon_state->account_name, lp_workgroup(), 
                              samlogon_state->password, &samlogon_state->chall,
                              &names_blob,
                              &lmv2_response, &ntlmv2_response, 
@@ -1051,7 +1051,7 @@ static BOOL test_SamLogon(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
        struct samlogon_state samlogon_state;
        
        samlogon_state.mem_ctx = mem_ctx;
-       samlogon_state.username = lp_parm_string(-1, "torture", "username");
+       samlogon_state.account_name = lp_parm_string(-1, "torture", "username");
        samlogon_state.password = lp_parm_string(-1, "torture", "password");
        samlogon_state.p = p;
 
@@ -1114,7 +1114,7 @@ static BOOL test_SetPassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
        }
 
        r.in.server_name = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p));
-       r.in.username = talloc_asprintf(mem_ctx, "%s$", TEST_MACHINE_NAME);
+       r.in.account_name = talloc_asprintf(mem_ctx, "%s$", TEST_MACHINE_NAME);
        r.in.secure_channel_type = SEC_CHAN_BDC;
        r.in.computer_name = TEST_MACHINE_NAME;
 
index 311ed23dbe96785f755852df4a5c988a375a7076..fea03e86179e591fbf092c982ec14046a933deb4 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "includes.h"
 
-#define TEST_USERNAME "samrtorturetest"
+#define TEST_ACCOUNT_NAME "samrtorturetest"
 #define TEST_ALIASNAME "samrtorturetestalias"
 #define TEST_GROUPNAME "samrtorturetestgroup"
 #define TEST_MACHINENAME "samrtorturetestmach$"
@@ -281,11 +281,11 @@ static BOOL test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        TEST_USERINFO_NAME(21, logon_script, 21, logon_script, "xx21-21 logon_script", 
                           SAMR_FIELD_LOGON_SCRIPT);
 
-       TEST_USERINFO_NAME(12, profile,  3, profile, "xx12-3 profile", 0);
-       TEST_USERINFO_NAME(12, profile,  5, profile, "xx12-5 profile", 0);
-       TEST_USERINFO_NAME(12, profile, 21, profile, "xx12-21 profile", 0);
-       TEST_USERINFO_NAME(21, profile, 21, profile, "xx21-21 profile", 
-                          SAMR_FIELD_PROFILE);
+       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", 
+                          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);
@@ -741,7 +741,7 @@ static BOOL test_ChangePasswordUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        uint8_t old_nt_hash[16], new_nt_hash[16];
        uint8_t old_lm_hash[16], new_lm_hash[16];
 
-       status = test_OpenUser_byname(p, mem_ctx, handle, TEST_USERNAME, &user_handle);
+       status = test_OpenUser_byname(p, mem_ctx, handle, TEST_ACCOUNT_NAME, &user_handle);
        if (!NT_STATUS_IS_OK(status)) {
                return False;
        }
@@ -804,7 +804,7 @@ static BOOL test_OemChangePasswordUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_c
        printf("Testing OemChangePasswordUser2\n");
 
        server.name = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p));
-       account.name = TEST_USERNAME;
+       account.name = TEST_ACCOUNT_NAME;
 
        E_deshash(oldpass, old_lm_hash);
        E_deshash(newpass, new_lm_hash);
@@ -847,7 +847,7 @@ static BOOL test_ChangePasswordUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        printf("Testing ChangePasswordUser2\n");
 
        server.name = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p));
-       init_samr_Name(&account, TEST_USERNAME);
+       init_samr_Name(&account, TEST_ACCOUNT_NAME);
 
        E_md4hash(oldpass, old_nt_hash);
        E_md4hash(newpass, new_nt_hash);
@@ -900,7 +900,7 @@ 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_USERNAME);
+       init_samr_Name(&account, TEST_ACCOUNT_NAME);
 
        E_md4hash(oldpass, old_nt_hash);
        E_md4hash(newpass, new_nt_hash);
@@ -1354,26 +1354,26 @@ static BOOL test_CreateUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        struct samr_Name name;
        BOOL ret = True;
 
-       init_samr_Name(&name, TEST_USERNAME);
+       init_samr_Name(&name, TEST_ACCOUNT_NAME);
 
        r.in.handle = domain_handle;
-       r.in.username = &name;
+       r.in.account_name = &name;
        r.in.access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED;
        r.out.acct_handle = user_handle;
        r.out.rid = &rid;
 
-       printf("Testing CreateUser(%s)\n", r.in.username->name);
+       printf("Testing CreateUser(%s)\n", r.in.account_name->name);
 
        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.username->name);
+               printf("Server refused create of '%s'\n", r.in.account_name->name);
                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.username->name)) {
+               if (!test_DeleteUser_byname(p, mem_ctx, domain_handle, r.in.account_name->name)) {
                        return False;
                }
                status = dcerpc_samr_CreateUser(p, mem_ctx, &r);
@@ -1474,9 +1474,9 @@ static BOOL test_CreateUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
                const char *account_name;
                NTSTATUS nt_status;
        } account_types[] = {
-               { ACB_NORMAL, TEST_USERNAME, NT_STATUS_OK },
-               { ACB_NORMAL | ACB_DISABLED, TEST_USERNAME, NT_STATUS_INVALID_PARAMETER },
-               { ACB_NORMAL | ACB_PWNOEXP, TEST_USERNAME, NT_STATUS_INVALID_PARAMETER },
+               { ACB_NORMAL, TEST_ACCOUNT_NAME, NT_STATUS_OK },
+               { ACB_NORMAL | ACB_DISABLED, TEST_ACCOUNT_NAME, NT_STATUS_INVALID_PARAMETER },
+               { ACB_NORMAL | ACB_PWNOEXP, TEST_ACCOUNT_NAME, NT_STATUS_INVALID_PARAMETER },
                { ACB_WSTRUST, TEST_MACHINENAME, NT_STATUS_OK },
                { ACB_WSTRUST | ACB_DISABLED, TEST_MACHINENAME, NT_STATUS_INVALID_PARAMETER },
                { ACB_WSTRUST | ACB_PWNOEXP, TEST_MACHINENAME, NT_STATUS_INVALID_PARAMETER },
@@ -1486,8 +1486,8 @@ static BOOL test_CreateUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
                { ACB_DOMTRUST, TEST_DOMAINNAME, NT_STATUS_OK },
                { ACB_DOMTRUST | ACB_DISABLED, TEST_DOMAINNAME, NT_STATUS_INVALID_PARAMETER },
                { ACB_DOMTRUST | ACB_PWNOEXP, TEST_DOMAINNAME, NT_STATUS_INVALID_PARAMETER },
-               { 0, TEST_USERNAME, NT_STATUS_INVALID_PARAMETER },
-               { ACB_DISABLED, TEST_USERNAME, NT_STATUS_INVALID_PARAMETER },
+               { 0, TEST_ACCOUNT_NAME, NT_STATUS_INVALID_PARAMETER },
+               { ACB_DISABLED, TEST_ACCOUNT_NAME, NT_STATUS_INVALID_PARAMETER },
                { 0, NULL, NT_STATUS_INVALID_PARAMETER }
        };
 
@@ -1498,23 +1498,23 @@ static BOOL test_CreateUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
                init_samr_Name(&name, account_types[i].account_name);
 
                r.in.handle = handle;
-               r.in.username = &name;
+               r.in.account_name = &name;
                r.in.acct_flags = acct_flags;
                r.in.access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED;
                r.out.acct_handle = &acct_handle;
                r.out.access_granted = &access_granted;
                r.out.rid = &rid;
                
-               printf("Testing CreateUser2(%s)\n", r.in.username->name);
+               printf("Testing CreateUser2(%s)\n", r.in.account_name->name);
                
                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.username->name);
+                       printf("Server refused create of '%s'\n", r.in.account_name->name);
                        continue;
 
                } else if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) {
-                       if (!test_DeleteUser_byname(p, mem_ctx, handle, r.in.username->name)) {
+                       if (!test_DeleteUser_byname(p, mem_ctx, handle, r.in.account_name->name)) {
                                return False;
                        }
                        status = dcerpc_samr_CreateUser2(p, mem_ctx, &r);
@@ -2008,7 +2008,7 @@ static BOOL test_GetDisplayEnumerationIndex(struct dcerpc_pipe *p, TALLOC_CTX *m
 
                r.in.handle = handle;
                r.in.level = levels[i];
-               init_samr_Name(&r.in.name, TEST_USERNAME);
+               init_samr_Name(&r.in.name, TEST_ACCOUNT_NAME);
 
                status = dcerpc_samr_GetDisplayEnumerationIndex(p, mem_ctx, &r);
 
@@ -2049,7 +2049,7 @@ static BOOL test_GetDisplayEnumerationIndex2(struct dcerpc_pipe *p, TALLOC_CTX *
 
                r.in.handle = handle;
                r.in.level = levels[i];
-               init_samr_Name(&r.in.name, TEST_USERNAME);
+               init_samr_Name(&r.in.name, TEST_ACCOUNT_NAME);
 
                status = dcerpc_samr_GetDisplayEnumerationIndex2(p, mem_ctx, &r);
                if (ok_lvl[i] && 
@@ -2469,7 +2469,7 @@ static BOOL test_AddGroupMember(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        BOOL ret = True;
        uint32_t rid;
 
-       status = test_LookupName(p, mem_ctx, domain_handle, TEST_USERNAME, &rid);
+       status = test_LookupName(p, mem_ctx, domain_handle, TEST_ACCOUNT_NAME, &rid);
        if (!NT_STATUS_IS_OK(status)) {
                return False;
        }