From 83170b36c5511b000e36ad0d3a1d9b73a73d2046 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 16 Apr 2000 09:42:09 +0000 Subject: got rid of FILE* in the unix name mapping code (This used to be commit 92f85cef8b4c283374edb726ff0b4999a2000b2a) --- source3/rpc_server/srv_samr.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/srv_samr.c b/source3/rpc_server/srv_samr.c index 88a7f54efa5..08bba0eef44 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; } -- cgit