diff options
author | Volker Lendecke <vlendec@samba.org> | 2006-07-15 17:55:01 +0000 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2007-10-17 13:38:44 +0200 |
commit | e405187b0daf53c32a3defd7f582ca94e214e859 (patch) | |
tree | 0262ccb95090e33de8db8ccaa9563e4a615e74fe /source3/rpc_server | |
parent | ba7a979e5374da422b0657161289e344dc23afa1 (diff) | |
download | samba-e405187b0daf53c32a3defd7f582ca94e214e859.tar.gz samba-e405187b0daf53c32a3defd7f582ca94e214e859.tar.bz2 samba-e405187b0daf53c32a3defd7f582ca94e214e859.zip |
r17064: lsa_GetUserName needs to return the name for S-1-5-7 on an anonymous login.
Found that because I want to play around with setsharesecurity, for this I
need the "whoami" call figuring out the SID of the currently connected user.
Not activating this test yet until the build farm has picked up the new samba4
revision.
Volker
(cherry picked from commit 5cfe482841b77208b68376f9e2b8a4a62271f7c9)
(This used to be commit 15935bad1d756d3896f0687108e60ca10a35a936)
Diffstat (limited to 'source3/rpc_server')
-rw-r--r-- | source3/rpc_server/srv_lsa_nt.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/source3/rpc_server/srv_lsa_nt.c b/source3/rpc_server/srv_lsa_nt.c index c513d8489c..ea2bc0fa7b 100644 --- a/source3/rpc_server/srv_lsa_nt.c +++ b/source3/rpc_server/srv_lsa_nt.c @@ -1545,14 +1545,26 @@ NTSTATUS _lsa_enum_accounts(pipes_struct *p, LSA_Q_ENUM_ACCOUNTS *q_u, LSA_R_ENU NTSTATUS _lsa_unk_get_connuser(pipes_struct *p, LSA_Q_UNK_GET_CONNUSER *q_u, LSA_R_UNK_GET_CONNUSER *r_u) { - fstring username, domname; + const char *username, *domname; user_struct *vuser = get_valid_user_struct(p->vuid); if (vuser == NULL) return NT_STATUS_CANT_ACCESS_DOMAIN_INFO; - - fstrcpy(username, vuser->user.smb_name); - fstrcpy(domname, vuser->user.domain); + + if (vuser->guest) { + /* + * I'm 99% sure this is not the right place to do this, + * global_sid_Anonymous should probably be put into the token + * instead of the guest id -- vl + */ + if (!lookup_sid(p->mem_ctx, &global_sid_Anonymous, + &domname, &username, NULL)) { + return NT_STATUS_NO_MEMORY; + } + } else { + username = vuser->user.smb_name; + domname = vuser->user.domain; + } r_u->ptr_user_name = 1; init_unistr2(&r_u->uni2_user_name, username, UNI_STR_TERMINATE); |