summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2005-01-22 11:26:13 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:55:08 -0500
commit6e5accde90d9f078fbb3d1b0f11c45cfe391e4ad (patch)
treee2752c91d91e9eca44f3cfa0456283ddab5f0824 /source3/rpc_server
parente3971524d2030075165a150daf0e3aa91414d567 (diff)
downloadsamba-6e5accde90d9f078fbb3d1b0f11c45cfe391e4ad.tar.gz
samba-6e5accde90d9f078fbb3d1b0f11c45cfe391e4ad.tar.bz2
samba-6e5accde90d9f078fbb3d1b0f11c45cfe391e4ad.zip
r4931: Add get_user_info_7 in SAMR. This just gives out the username. (In
preparation of adding the ability of renaming users via setuserinfo level 7). Guenther (This used to be commit 6f34ed6c203fa11182640da97581075612d26c0e)
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/srv_samr_nt.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c
index 8ee59210eb..612e69a813 100644
--- a/source3/rpc_server/srv_samr_nt.c
+++ b/source3/rpc_server/srv_samr_nt.c
@@ -1699,6 +1699,40 @@ NTSTATUS _samr_open_user(pipes_struct *p, SAMR_Q_OPEN_USER *q_u, SAMR_R_OPEN_USE
}
/*************************************************************************
+ get_user_info_7. Safe. Only gives out account_name.
+ *************************************************************************/
+
+static NTSTATUS get_user_info_7(TALLOC_CTX *mem_ctx, SAM_USER_INFO_7 *id7, DOM_SID *user_sid)
+{
+ SAM_ACCOUNT *smbpass=NULL;
+ BOOL ret;
+ NTSTATUS nt_status;
+
+ nt_status = pdb_init_sam_talloc(mem_ctx, &smbpass);
+
+ if (!NT_STATUS_IS_OK(nt_status)) {
+ return nt_status;
+ }
+
+ become_root();
+ ret = pdb_getsampwsid(smbpass, user_sid);
+ unbecome_root();
+
+ if (ret==False) {
+ DEBUG(4,("User %s not found\n", sid_string_static(user_sid)));
+ return NT_STATUS_NO_SUCH_USER;
+ }
+
+ DEBUG(3,("User:[%s]\n", pdb_get_username(smbpass) ));
+
+ ZERO_STRUCTP(id7);
+ init_sam_user_info7(id7, pdb_get_username(smbpass) );
+
+ pdb_free_sam(&smbpass);
+
+ return NT_STATUS_OK;
+}
+/*************************************************************************
get_user_info_10. Safe. Only gives out acb bits.
*************************************************************************/
@@ -1889,6 +1923,14 @@ NTSTATUS _samr_query_userinfo(pipes_struct *p, SAMR_Q_QUERY_USERINFO *q_u, SAMR_
ctr->switch_value = q_u->switch_value;
switch (q_u->switch_value) {
+ case 0x07:
+ ctr->info.id7 = TALLOC_ZERO_P(p->mem_ctx, SAM_USER_INFO_7);
+ if (ctr->info.id7 == NULL)
+ return NT_STATUS_NO_MEMORY;
+
+ if (!NT_STATUS_IS_OK(r_u->status = get_user_info_7(p->mem_ctx, ctr->info.id7, &info->sid)))
+ return r_u->status;
+ break;
case 0x10:
ctr->info.id10 = TALLOC_ZERO_P(p->mem_ctx, SAM_USER_INFO_10);
if (ctr->info.id10 == NULL)