smbd: username map file handling xfile->stdio
authorVolker Lendecke <vl@samba.org>
Tue, 22 Nov 2016 00:38:16 +0000 (01:38 +0100)
committerVolker Lendecke <vl@samba.org>
Sun, 11 Dec 2016 10:17:23 +0000 (11:17 +0100)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/auth/user_util.c

index f3cf499f58388cdc35bb7e118e3804c81da09b0a..1ddb73873077ce16c019caf222465b7d6d0f132b 100644 (file)
@@ -22,7 +22,6 @@
 #include "includes.h"
 #include "system/filesys.h"
 #include "auth.h"
-#include "lib/util/xfile.h"
 
 /*******************************************************************
  Map a username from a dos name to a unix name by looking in the username
@@ -268,7 +267,7 @@ bool user_in_list(TALLOC_CTX *ctx, const char *user, const char * const *list)
 
 bool map_username(TALLOC_CTX *ctx, const char *user_in, char **p_user_out)
 {
-       XFILE *f;
+       FILE *f;
        char *mapfile = lp_username_map(talloc_tos());
        char *s;
        char buf[512];
@@ -354,7 +353,7 @@ bool map_username(TALLOC_CTX *ctx, const char *user_in, char **p_user_out)
        if (!*mapfile)
                return False;
 
-       f = x_fopen(mapfile,O_RDONLY, 0);
+       f = fopen(mapfile, "r");
        if (!f) {
                DEBUG(0,("can't open username map %s. Error %s\n",mapfile, strerror(errno) ));
                return False;
@@ -362,7 +361,7 @@ bool map_username(TALLOC_CTX *ctx, const char *user_in, char **p_user_out)
 
        DEBUG(4,("Scanning username map %s\n",mapfile));
 
-       while((s=x_fgets_slash(buf,sizeof(buf),f))!=NULL) {
+       while((s=fgets_slash(NULL,buf,sizeof(buf),f))!=NULL) {
                char *unixname = s;
                char *dosname = strchr_m(unixname,'=');
                char **dosuserlist;
@@ -410,13 +409,13 @@ bool map_username(TALLOC_CTX *ctx, const char *user_in, char **p_user_out)
                        *p_user_out = talloc_strdup(ctx, unixname);
                        if (!*p_user_out) {
                                TALLOC_FREE(dosuserlist);
-                               x_fclose(f);
+                               fclose(f);
                                return false;
                        }
 
                        if ( return_if_mapped ) {
                                TALLOC_FREE(dosuserlist);
-                               x_fclose(f);
+                               fclose(f);
                                return True;
                        }
                }
@@ -424,7 +423,7 @@ bool map_username(TALLOC_CTX *ctx, const char *user_in, char **p_user_out)
                TALLOC_FREE(dosuserlist);
        }
 
-       x_fclose(f);
+       fclose(f);
 
        /*
         * If we didn't successfully map a user in the loop above,