summaryrefslogtreecommitdiff
path: root/source3/rpc_server/srv_samr.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2000-04-16 09:42:09 +0000
committerAndrew Tridgell <tridge@samba.org>2000-04-16 09:42:09 +0000
commit83170b36c5511b000e36ad0d3a1d9b73a73d2046 (patch)
tree24f753897f803f13a4b4b0f9f00a271d81b719b4 /source3/rpc_server/srv_samr.c
parent6684245bcea5a3b7fc0492f173dbbd0f53f5835e (diff)
downloadsamba-83170b36c5511b000e36ad0d3a1d9b73a73d2046.tar.gz
samba-83170b36c5511b000e36ad0d3a1d9b73a73d2046.tar.bz2
samba-83170b36c5511b000e36ad0d3a1d9b73a73d2046.zip
got rid of FILE* in the unix name mapping code
(This used to be commit 92f85cef8b4c283374edb726ff0b4999a2000b2a)
Diffstat (limited to 'source3/rpc_server/srv_samr.c')
-rw-r--r--source3/rpc_server/srv_samr.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/source3/rpc_server/srv_samr.c b/source3/rpc_server/srv_samr.c
index 88a7f54efa..08bba0eef4 100644
--- a/source3/rpc_server/srv_samr.c
+++ b/source3/rpc_server/srv_samr.c
@@ -116,24 +116,24 @@ static BOOL get_sampwd_entries(SAM_USER_INFO_21 *pw_buf,
static char *unmap_unixname(char *unix_user_name, int name_idx)
{
- FILE *f;
char *mapfile = lp_username_map();
char *s;
- pstring buf;
+ char **lines;
static pstring tok;
+ int i;
if (!*unix_user_name) return NULL;
if (!*mapfile) return NULL;
- f = sys_fopen(mapfile,"r");
- if (!f) {
+ lines = file_lines_load(mapfile, NULL);
+ if (!lines) {
DEBUG(0,("unmap_unixname: can't open username map %s\n", mapfile));
return NULL;
}
DEBUG(5,("unmap_unixname: scanning username map %s, index: %d\n", mapfile, name_idx));
- while((s=fgets_slash(buf,sizeof(buf),f))!=NULL) {
+ for (i=0; lines[i]; i++) {
char *unixname = s;
char *dosname = strchr(unixname,'=');
@@ -169,16 +169,16 @@ static char *unmap_unixname(char *unix_user_name, int name_idx)
if (name_idx >= 0) {
DEBUG(0,("unmap_unixname: index too high - not that many DOS names\n"));
- fclose(f);
+ file_lines_free(lines);
return NULL;
} else {
- fclose(f);
+ file_lines_free(lines);
return tok;
}
}
DEBUG(0,("unmap_unixname: Couldn't find the UNIX user name\n"));
- fclose(f);
+ file_lines_free(lines);
return NULL;
}