summaryrefslogtreecommitdiff
path: root/source3/rpc_server/srv_samr.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1998-04-14 00:41:59 +0000
committerJeremy Allison <jra@samba.org>1998-04-14 00:41:59 +0000
commit2a53d6f7077de596265a3e73e79827392054142c (patch)
tree9e3553f5c3210b814b14501fb2f6e6cd4a2c129b /source3/rpc_server/srv_samr.c
parent49ce0cab3c3ec31e08be9afb7872b8bb03371810 (diff)
downloadsamba-2a53d6f7077de596265a3e73e79827392054142c.tar.gz
samba-2a53d6f7077de596265a3e73e79827392054142c.tar.bz2
samba-2a53d6f7077de596265a3e73e79827392054142c.zip
Modified interfaces to getting smb password entries from
get_smbpwd_entry (now an internal function to smbpass.c) to a more UNIX-like : getsmbpwnam() - get entry by name. getsmbpwuid() - get entry by uid. Changed the type returned by the smbpasswd enumeration functions to be a void * so that people don't come to depend on it being a FILE *. These abstractions should make it much easier to replace the smbpasswd file with a better backend in future. Other files changed are to match the above changes. Jeremy. (This used to be commit 1161cfb7f2b0d5a6d3e2b524a14a6f325ce70efb)
Diffstat (limited to 'source3/rpc_server/srv_samr.c')
-rw-r--r--source3/rpc_server/srv_samr.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/source3/rpc_server/srv_samr.c b/source3/rpc_server/srv_samr.c
index 02c8cb0ffe..162d9c45d0 100644
--- a/source3/rpc_server/srv_samr.c
+++ b/source3/rpc_server/srv_samr.c
@@ -43,7 +43,7 @@ static BOOL get_smbpwd_entries(SAM_USER_INFO_21 *pw_buf,
int max_num_entries,
uint16 acb_mask)
{
- FILE *fp = NULL;
+ void *vp = NULL;
struct smb_passwd *pwd = NULL;
(*num_entries) = 0;
@@ -51,14 +51,14 @@ static BOOL get_smbpwd_entries(SAM_USER_INFO_21 *pw_buf,
if (pw_buf == NULL) return False;
- fp = startsmbpwent(False);
- if (!fp)
+ vp = startsmbpwent(False);
+ if (!vp)
{
DEBUG(0, ("get_smbpwd_entries: Unable to open SMB password file.\n"));
return False;
}
- while (((pwd = getsmbpwent(fp)) != NULL) && (*num_entries) < max_num_entries)
+ while (((pwd = getsmbpwent(vp)) != NULL) && (*num_entries) < max_num_entries)
{
int user_name_len = strlen(pwd->smb_name);
make_unistr2(&(pw_buf[(*num_entries)].uni_user_name), pwd->smb_name, user_name_len);
@@ -91,7 +91,7 @@ static BOOL get_smbpwd_entries(SAM_USER_INFO_21 *pw_buf,
(*total_entries)++;
}
- endsmbpwent(fp);
+ endsmbpwent(vp);
return (*num_entries) > 0;
}
@@ -806,7 +806,7 @@ static void samr_reply_open_user(SAMR_Q_OPEN_USER *q_u,
}
become_root(True);
- smb_pass = get_smbpwd_entry(NULL, q_u->user_rid);
+ smb_pass = getsmbpwuid(q_u->user_rid);
unbecome_root(True);
/* check that the RID exists in our domain. */
@@ -877,7 +877,7 @@ static BOOL get_user_info_21(SAM_USER_INFO_21 *id21, uint32 rid)
struct smb_passwd *smb_pass;
become_root(True);
- smb_pass = get_smbpwd_entry(NULL, rid);
+ smb_pass = getsmbpwuid(rid);
unbecome_root(True);
if (smb_pass == NULL)
@@ -1095,7 +1095,7 @@ static void samr_reply_query_usergroups(SAMR_Q_QUERY_USERGROUPS *q_u,
if (status == 0x0)
{
become_root(True);
- smb_pass = get_smbpwd_entry(NULL, rid);
+ smb_pass = getsmbpwuid(rid);
unbecome_root(True);
if (smb_pass == NULL)
@@ -1191,7 +1191,7 @@ static void api_samr_unknown_32( int uid, prs_struct *data, prs_struct *rdata)
q_u.uni_mach_acct.uni_str_len));
become_root(True);
- smb_pass = get_smbpwd_entry(mach_acct, 0);
+ smb_pass = getsmbpwnam(mach_acct);
unbecome_root(True);
if (smb_pass != NULL)