summaryrefslogtreecommitdiff
path: root/source4/libnet/libnet_user.c
diff options
context:
space:
mode:
authorRafal Szczesniak <mimir@samba.org>2006-08-07 20:29:18 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:15:26 -0500
commit84f8d208eff81ed055bd82542bc6bd753659a4c1 (patch)
tree030597c4f7b44457f57c4c37888faa19fa20ee9a /source4/libnet/libnet_user.c
parent9ea3b567e461a7f99ac6bff2dd61380482451ebf (diff)
downloadsamba-84f8d208eff81ed055bd82542bc6bd753659a4c1.tar.gz
samba-84f8d208eff81ed055bd82542bc6bd753659a4c1.tar.bz2
samba-84f8d208eff81ed055bd82542bc6bd753659a4c1.zip
r17448: Define macros to set fields in api function modifying user account.
rafal (This used to be commit 8d9330c490470127f192949efa9201225136edb1)
Diffstat (limited to 'source4/libnet/libnet_user.c')
-rw-r--r--source4/libnet/libnet_user.c53
1 files changed, 25 insertions, 28 deletions
diff --git a/source4/libnet/libnet_user.c b/source4/libnet/libnet_user.c
index d30dc48dd5..947fc3dcb3 100644
--- a/source4/libnet/libnet_user.c
+++ b/source4/libnet/libnet_user.c
@@ -543,41 +543,38 @@ static NTSTATUS set_user_changes(TALLOC_CTX *mem_ctx, struct usermod_change *mod
user = &info->out.info.info21;
mod->fields = 0; /* reset flag field before setting individual flags */
- /*
- * account name change
- */
- if (r->in.account_name != NULL &&
- !strequal_w(user->account_name.string, r->in.account_name)) {
+ /* account name change */
+ SET_FIELD_LSA_STRING(r->in, user, mod, account_name, USERMOD_FIELD_ACCOUNT_NAME);
- mod->account_name = talloc_strdup(mem_ctx, r->in.account_name);
- if (mod->account_name == NULL) return NT_STATUS_NO_MEMORY;
+ /* full name change */
+ SET_FIELD_LSA_STRING(r->in, user, mod, full_name, USERMOD_FIELD_FULL_NAME);
- mod->fields |= USERMOD_FIELD_ACCOUNT_NAME;
- }
+ /* description change */
+ SET_FIELD_LSA_STRING(r->in, user, mod, comment, USERMOD_FIELD_DESCRIPTION);
- /*
- * full name change
- */
- if (r->in.full_name != NULL &&
- !strequal_w(user->full_name.string, r->in.full_name)) {
-
- mod->full_name = talloc_strdup(mem_ctx, r->in.full_name);
- if (mod->full_name == NULL) return NT_STATUS_NO_MEMORY;
+ /* comment change */
+ SET_FIELD_LSA_STRING(r->in, user, mod, comment, USERMOD_FIELD_COMMENT);
- mod->fields |= USERMOD_FIELD_FULL_NAME;
- }
+ /* home directory change */
+ SET_FIELD_LSA_STRING(r->in, user, mod, home_directory, USERMOD_FIELD_HOME_DIRECTORY);
- /*
- * description change
- */
- if (r->in.description != NULL &&
- !strequal_w(user->description.string, r->in.description)) {
+ /* home drive change */
+ SET_FIELD_LSA_STRING(r->in, user, mod, home_drive, USERMOD_FIELD_HOME_DRIVE);
- mod->description = talloc_strdup(mem_ctx, r->in.description);
- if (mod->description == NULL) return NT_STATUS_NO_MEMORY;
+ /* logon script change */
+ SET_FIELD_LSA_STRING(r->in, user, mod, logon_script, USERMOD_FIELD_LOGON_SCRIPT);
- mod->fields |= USERMOD_FIELD_DESCRIPTION;
- }
+ /* profile path change */
+ SET_FIELD_LSA_STRING(r->in, user, mod, profile_path, USERMOD_FIELD_PROFILE_PATH);
+
+ /* allow password change time */
+ SET_FIELD_NTTIME(r->in, user, mod, allow_password_change, USERMOD_FIELD_ALLOW_PASS_CHG);
+
+ /* force password change time */
+ SET_FIELD_NTTIME(r->in, user, mod, force_password_change, USERMOD_FIELD_FORCE_PASS_CHG);
+
+ /* account expiry change */
+ SET_FIELD_NTTIME(r->in, user, mod, acct_expiry, USERMOD_FIELD_ACCT_EXPIRY);
return NT_STATUS_OK;
}