summaryrefslogtreecommitdiff
path: root/source3/smbd/groupname.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2000-04-16 11:17:19 +0000
committerAndrew Tridgell <tridge@samba.org>2000-04-16 11:17:19 +0000
commit8d7e498db160f9a366400fc1c55dacbcffaf4196 (patch)
tree9db7c7c562d4694b9e03af5d1e86d933e0084f6a /source3/smbd/groupname.c
parent19f946ba6fe442544ac9b0f71bcd33112fc79995 (diff)
downloadsamba-8d7e498db160f9a366400fc1c55dacbcffaf4196.tar.gz
samba-8d7e498db160f9a366400fc1c55dacbcffaf4196.tar.bz2
samba-8d7e498db160f9a366400fc1c55dacbcffaf4196.zip
converted a couple more functions to use a fd instead of a FILE*
added a new utility fn file_lines_slashcont() which is used to handle files that treat a \ followed by a newline as a blank (This used to be commit 384ecd9d66ccd31ee85000c0ca55d413d8f2cc53)
Diffstat (limited to 'source3/smbd/groupname.c')
-rw-r--r--source3/smbd/groupname.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/source3/smbd/groupname.c b/source3/smbd/groupname.c
index 4dadfaa939..fcbf5dd778 100644
--- a/source3/smbd/groupname.c
+++ b/source3/smbd/groupname.c
@@ -71,9 +71,8 @@ void load_groupname_map(void)
static BOOL initialized = False;
char *groupname_map_file = lp_groupname_map();
SMB_STRUCT_STAT st;
- FILE *fp;
- char *s;
- pstring buf;
+ char **lines;
+ int i;
groupname_map_entry *new_ep;
if(!initialized) {
@@ -102,12 +101,13 @@ void load_groupname_map(void)
* Load the file.
*/
- fp = sys_fopen(groupname_map_file,"r");
- if (!fp) {
+ lines = file_lines_load(groupname_map_file,NULL);
+ if (!lines) {
DEBUG(0,("load_groupname_map: can't open groupname map %s. Error was %s\n",
groupname_map_file, strerror(errno)));
return;
}
+ file_lines_slashcont(lines);
/*
* Throw away any previous list.
@@ -116,11 +116,12 @@ void load_groupname_map(void)
DEBUG(4,("load_groupname_map: Scanning groupname map %s\n",groupname_map_file));
- while((s=fgets_slash(buf,sizeof(buf),fp))!=NULL) {
+ for (i=0; lines[i]; i++) {
pstring unixname;
pstring windows_name;
struct group *gptr;
DOM_SID tmp_sid;
+ char *s = lines[i];
DEBUG(10,("load_groupname_map: Read line |%s|\n", s));
@@ -202,7 +203,7 @@ Error was %s.\n", unixname, strerror(errno) ));
DEBUG(10,("load_groupname_map: Added %ld entries to groupname map.\n",
ubi_slCount(&groupname_map_list)));
- fclose(fp);
+ file_lines_free(lines);
}
/***********************************************************