summaryrefslogtreecommitdiffstats
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-05-07 21:45:51 +0200
committerGünther Deschner <gd@samba.org>2009-05-08 00:41:40 +0200
commitf05d888d7ab910b3ed39e4d36eeb52cb86bd990e (patch)
treef054a9ecc9d6319d3eb14df78c53d223a07b018c /source3/rpc_server
parentf93f713898f2208fda51f24121b060ee09f5fe3a (diff)
downloadsamba-f05d888d7ab910b3ed39e4d36eeb52cb86bd990e.tar.gz
samba-f05d888d7ab910b3ed39e4d36eeb52cb86bd990e.tar.xz
samba-f05d888d7ab910b3ed39e4d36eeb52cb86bd990e.zip
s3-samr: let set_user_info_16 and 20 follow the same pattern as all other levels.
Guenther
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/srv_samr_nt.c46
-rw-r--r--source3/rpc_server/srv_samr_util.c21
2 files changed, 38 insertions, 29 deletions
diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c
index c3d9dafc4b7..e0ba51c68ac 100644
--- a/source3/rpc_server/srv_samr_nt.c
+++ b/source3/rpc_server/srv_samr_nt.c
@@ -3877,24 +3877,18 @@ static NTSTATUS set_user_info_14(TALLOC_CTX *mem_ctx,
set_user_info_16
********************************************************************/
-static bool set_user_info_16(struct samr_UserInfo16 *id16,
- struct samu *pwd)
+static NTSTATUS set_user_info_16(TALLOC_CTX *mem_ctx,
+ struct samr_UserInfo16 *id16,
+ struct samu *pwd)
{
if (id16 == NULL) {
- DEBUG(5, ("set_user_info_16: NULL id16\n"));
- return False;
+ DEBUG(5,("set_user_info_16: NULL id16\n"));
+ return NT_STATUS_ACCESS_DENIED;
}
- /* FIX ME: check if the value is really changed --metze */
- if (!pdb_set_acct_ctrl(pwd, id16->acct_flags, PDB_CHANGED)) {
- return False;
- }
+ copy_id16_to_sam_passwd(pwd, id16);
- if(!NT_STATUS_IS_OK(pdb_update_sam_account(pwd))) {
- return False;
- }
-
- return True;
+ return pdb_update_sam_account(pwd);
}
/*******************************************************************
@@ -3976,22 +3970,18 @@ static NTSTATUS set_user_info_18(struct samr_UserInfo18 *id18,
set_user_info_20
********************************************************************/
-static bool set_user_info_20(struct samr_UserInfo20 *id20,
- struct samu *pwd)
+static NTSTATUS set_user_info_20(TALLOC_CTX *mem_ctx,
+ struct samr_UserInfo20 *id20,
+ struct samu *pwd)
{
if (id20 == NULL) {
- DEBUG(5, ("set_user_info_20: NULL id20\n"));
- return False;
+ DEBUG(5,("set_user_info_20: NULL id20\n"));
+ return NT_STATUS_ACCESS_DENIED;
}
copy_id20_to_sam_passwd(pwd, id20);
- /* write the change out */
- if(!NT_STATUS_IS_OK(pdb_update_sam_account(pwd))) {
- return False;
- }
-
- return True;
+ return pdb_update_sam_account(pwd);
}
/*******************************************************************
@@ -4542,9 +4532,8 @@ NTSTATUS _samr_SetUserInfo(pipes_struct *p,
break;
case 16:
- if (!set_user_info_16(&info->info16, pwd)) {
- status = NT_STATUS_ACCESS_DENIED;
- }
+ status = set_user_info_16(p->mem_ctx,
+ &info->info16, pwd);
break;
case 17:
@@ -4561,9 +4550,8 @@ NTSTATUS _samr_SetUserInfo(pipes_struct *p,
break;
case 20:
- if (!set_user_info_20(&info->info20, pwd)) {
- status = NT_STATUS_ACCESS_DENIED;
- }
+ status = set_user_info_20(p->mem_ctx,
+ &info->info20, pwd);
break;
case 21:
diff --git a/source3/rpc_server/srv_samr_util.c b/source3/rpc_server/srv_samr_util.c
index 5dad3bdc70b..8f136b12165 100644
--- a/source3/rpc_server/srv_samr_util.c
+++ b/source3/rpc_server/srv_samr_util.c
@@ -233,6 +233,27 @@ void copy_id14_to_sam_passwd(struct samu *to,
}
/*************************************************************
+ Copies a struct samr_UserInfo16 to a struct samu
+**************************************************************/
+
+void copy_id16_to_sam_passwd(struct samu *to,
+ struct samr_UserInfo16 *from)
+{
+ struct samr_UserInfo21 i;
+
+ if (from == NULL || to == NULL) {
+ return;
+ }
+
+ ZERO_STRUCT(i);
+
+ i.fields_present = SAMR_FIELD_ACCT_FLAGS;
+ i.acct_flags = from->acct_flags;
+
+ copy_id21_to_sam_passwd("INFO_16", to, &i);
+}
+
+/*************************************************************
Copies a struct samr_UserInfo17 to a struct samu
**************************************************************/