diff options
author | Volker Lendecke <vlendec@samba.org> | 2005-11-26 18:20:58 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:05:35 -0500 |
commit | 5cc200ae5509d73176cdcbf0180bf450077d512a (patch) | |
tree | 7af51e56a92b7854993f2f77d3f1258e890f6f54 /source3/auth/auth_rhosts.c | |
parent | 3088a85c62e1475747496199d18137ee89f914a5 (diff) | |
download | samba-5cc200ae5509d73176cdcbf0180bf450077d512a.tar.gz samba-5cc200ae5509d73176cdcbf0180bf450077d512a.tar.bz2 samba-5cc200ae5509d73176cdcbf0180bf450077d512a.zip |
r11916: auth_get_sam_account is only used in auth_rhosts.c -- move it there
(This used to be commit 8e5bea3f84c61ea312278cbbb70542664be7bd14)
Diffstat (limited to 'source3/auth/auth_rhosts.c')
-rw-r--r-- | source3/auth/auth_rhosts.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/source3/auth/auth_rhosts.c b/source3/auth/auth_rhosts.c index b295df9328..b561e3d42b 100644 --- a/source3/auth/auth_rhosts.c +++ b/source3/auth/auth_rhosts.c @@ -24,6 +24,36 @@ #define DBGC_CLASS DBGC_AUTH /**************************************************************************** + Create a SAM_ACCOUNT - either by looking in the pdb, or by faking it up from + unix info. +****************************************************************************/ + +static NTSTATUS auth_get_sam_account(const char *user, SAM_ACCOUNT **account) +{ + BOOL pdb_ret; + NTSTATUS nt_status; + if (!NT_STATUS_IS_OK(nt_status = pdb_init_sam(account))) { + return nt_status; + } + + become_root(); + pdb_ret = pdb_getsampwnam(*account, user); + unbecome_root(); + + if (!pdb_ret) { + + struct passwd *pass = Get_Pwnam(user); + if (!pass) + return NT_STATUS_NO_SUCH_USER; + + if (!NT_STATUS_IS_OK(nt_status = pdb_fill_sam_pw(*account, pass))) { + return nt_status; + } + } + return NT_STATUS_OK; +} + +/**************************************************************************** Read the a hosts.equiv or .rhosts file and check if it allows this user from this machine. ****************************************************************************/ |