lib: directory_create_or_exist() does not use "uid" parameter
authorVolker Lendecke <vl@samba.org>
Sun, 27 Jul 2014 17:18:09 +0000 (19:18 +0200)
committerJeremy Allison <jra@samba.org>
Mon, 28 Jul 2014 20:04:13 +0000 (22:04 +0200)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
14 files changed:
lib/param/util.c
lib/util/samba_util.h
lib/util/util.c
source3/lib/dumpcore.c
source3/lib/eventlog/eventlog.c
source3/nmbd/nmbd.c
source3/printing/nt_printing.c
source3/printing/printing.c
source3/registry/reg_perfcount.c
source3/rpc_server/rpc_server.c
source3/smbd/server.c
source3/winbindd/winbindd.c
source4/ldap_server/ldap_server.c
source4/smbd/service_named_pipe.c

index 232e85b75c1786a7a02053b76755dd3647f7518d..faf161d4d4cca676b98b7eae64757ec5e44386f0 100644 (file)
@@ -91,7 +91,7 @@ static char *lpcfg_common_path(TALLOC_CTX* mem_ctx,
        }
        trim_string(dname,"","/");
 
-       ok = directory_create_or_exist(dname, geteuid(), 0755);
+       ok = directory_create_or_exist(dname, 0755);
        if (!ok) {
                DEBUG(1, ("Unable to create directory %s for file %s. "
                          "Error was %s\n", dname, name, strerror(errno)));
@@ -231,7 +231,7 @@ char *smbd_tmp_path(TALLOC_CTX *mem_ctx,
                return NULL;
        }
 
-       ok = directory_create_or_exist(dname, geteuid(), 0755);
+       ok = directory_create_or_exist(dname, 0755);
        if (!ok) {
                return NULL;
        }
index 251ddc26cede1f0db73934a86e7b33dbdbac3aab..2ffe028959b445c21a9ad4a89eb626c5f3df5b81 100644 (file)
@@ -649,8 +649,7 @@ _PUBLIC_ bool file_check_permissions(const char *fname,
  * @retval true if the directory already existed and has the right permissions 
  * or was successfully created.
  */
-_PUBLIC_ bool directory_create_or_exist(const char *dname, uid_t uid, 
-                              mode_t dir_perms);
+_PUBLIC_ bool directory_create_or_exist(const char *dname, mode_t dir_perms);
 
 _PUBLIC_ bool directory_create_or_exist_strict(const char *dname,
                                               uid_t uid,
index d0449e3ae890e9a905266787ebc506ecd120522d..1f75266c14662d5c21745526dc8e2b3895cf3972 100644 (file)
@@ -191,7 +191,6 @@ _PUBLIC_ bool directory_exist(const char *dname)
  * or was successfully created.
  */
 _PUBLIC_ bool directory_create_or_exist(const char *dname,
-                                       uid_t uid,
                                        mode_t dir_perms)
 {
        int ret;
@@ -254,7 +253,7 @@ _PUBLIC_ bool directory_create_or_exist_strict(const char *dname,
        bool ok;
        int rc;
 
-       ok = directory_create_or_exist(dname, uid, dir_perms);
+       ok = directory_create_or_exist(dname, dir_perms);
        if (!ok) {
                return false;
        }
index f284ea46738410cd9fef5bbd7f97a879e1a21535..487ccecc742ef14d4d7047448e9c82bbaf8acc41 100644 (file)
@@ -67,7 +67,7 @@ static char *get_default_corepath(const char *logbase, const char *progname)
                goto err_out;
        }
 
-       if (!directory_create_or_exist(tmp_corepath, uid, mode)) {
+       if (!directory_create_or_exist(tmp_corepath, mode)) {
                DEBUG(0, ("Failed to create %s for user %d with mode 0%o\n",
                          tmp_corepath, (int)uid, (int)mode));
                goto err_out;
index 0cc0240bcc29b9d855c6af37659496a81751b19b..4c6767d550d137682684af96034b8c4925096f2f 100644 (file)
@@ -373,7 +373,7 @@ ELOG_TDB *elog_open_tdb( const char *logname, bool force_clear, bool read_only )
        /* make sure that the eventlog dir exists */
 
        eventlogdir = state_path( "eventlog" );
-       ok = directory_create_or_exist(eventlogdir, geteuid(), 0755);
+       ok = directory_create_or_exist(eventlogdir, 0755);
        if (!ok) {
                return NULL;
        }
index 8c66d75082461284ee01531b695929d88cf97ef4..50b18e5ea444afd7a5a1050efb00ae6230715c30 100644 (file)
@@ -973,12 +973,12 @@ static bool open_sockets(bool isdaemon, int port)
        }
 #endif
 
-       ok = directory_create_or_exist(lp_lock_directory(), geteuid(), 0755);
+       ok = directory_create_or_exist(lp_lock_directory(), 0755);
        if (!ok) {
                exit_daemon("Failed to create directory for lock files, check 'lock directory'", errno);
        }
 
-       ok = directory_create_or_exist(lp_pid_directory(), geteuid(), 0755);
+       ok = directory_create_or_exist(lp_pid_directory(), 0755);
        if (!ok) {
                exit_daemon("Failed to create directory for pid files, check 'pid directory'", errno);
        }
index 6a5f2d744a19a8107f82dfb3233463555e205a6f..b76badf3f02053cac382df4d25291e9aae6e4da5 100644 (file)
@@ -95,7 +95,7 @@ static bool print_driver_directories_init(void)
                return false;
        }
 
-       ok = directory_create_or_exist(driver_path, sec_initial_uid(), 0755);
+       ok = directory_create_or_exist(driver_path, 0755);
        if (!ok) {
                DEBUG(1, ("Failed to create printer driver directory %s\n",
                          driver_path));
@@ -115,9 +115,7 @@ static bool print_driver_directories_init(void)
                        return false;
                }
 
-               ok = directory_create_or_exist(arch_path,
-                                              sec_initial_uid(),
-                                              0755);
+               ok = directory_create_or_exist(arch_path, 0755);
                if (!ok) {
                        DEBUG(1, ("Failed to create printer driver "
                                  "architecture directory %s\n",
index fa4a2fc741c145e9809bd85ebfad189f53bbff72..dcfd2a2dc5e471c08921a576647a9a09eebf353b 100644 (file)
@@ -203,7 +203,7 @@ bool print_backend_init(struct messaging_context *msg_ctx)
                return false;
        }
 
-       ok = directory_create_or_exist(cache_path("printing"), geteuid(), 0755);
+       ok = directory_create_or_exist(cache_path("printing"), 0755);
        if (!ok) {
                return false;
        }
index 82e5624d4703de41499563802d7d6571e966dffc..b875067721d1d880994fb451a162e2123f648527 100644 (file)
@@ -48,7 +48,7 @@ static char *counters_directory(const char *dbname)
        TALLOC_CTX *ctx = talloc_tos();
 
        path = state_path(PERFCOUNTDIR);
-       if (!directory_create_or_exist(path, geteuid(), 0755)) {
+       if (!directory_create_or_exist(path, 0755)) {
                return NULL;
        }
 
index 2ac29e1bb41c2ceb6b51e81b597cdbd9e20f4c5e..01a854ccafa207660e494477e8cd239f42365b80 100644 (file)
@@ -106,7 +106,7 @@ int create_named_pipe_socket(const char *pipe_name)
         * lp_ncalrpc_dir()/np should have 0700, we need to
         * create lp_ncalrpc_dir() first.
         */
-       if (!directory_create_or_exist(lp_ncalrpc_dir(), geteuid(), 0755)) {
+       if (!directory_create_or_exist(lp_ncalrpc_dir(), 0755)) {
                DEBUG(0, ("Failed to create pipe directory %s - %s\n",
                          lp_ncalrpc_dir(), strerror(errno)));
                goto out;
@@ -773,7 +773,7 @@ int create_dcerpc_ncalrpc_socket(const char *name)
                name = "DEFAULT";
        }
 
-       if (!directory_create_or_exist(lp_ncalrpc_dir(), geteuid(), 0755)) {
+       if (!directory_create_or_exist(lp_ncalrpc_dir(), 0755)) {
                DEBUG(0, ("Failed to create ncalrpc directory %s - %s\n",
                          lp_ncalrpc_dir(), strerror(errno)));
                return -1;
index dd1e20a420501bad668701950a85d995fd68db0a..ec9348c34c5c2ef0c912bb54646470353ec7dfd6 100644 (file)
@@ -1488,7 +1488,7 @@ extern void build_options(bool screen);
        /* This MUST be done before start_epmd() because otherwise
         * start_epmd() forks and races against dcesrv_ep_setup() to
         * call directory_create_or_exist() */
-       if (!directory_create_or_exist(lp_ncalrpc_dir(), geteuid(), 0755)) {
+       if (!directory_create_or_exist(lp_ncalrpc_dir(), 0755)) {
                DEBUG(0, ("Failed to create pipe directory %s - %s\n",
                          lp_ncalrpc_dir(), strerror(errno)));
                return -1;
index cb6164674f00be8e42b6091b822c4d1caa2e8db9..a51a172973b7e0ffd8c1ae5f184d490f2af22a88 100644 (file)
@@ -1519,14 +1519,14 @@ int main(int argc, const char **argv)
                exit(1);
        }
 
-       ok = directory_create_or_exist(lp_lock_directory(), geteuid(), 0755);
+       ok = directory_create_or_exist(lp_lock_directory(), 0755);
        if (!ok) {
                DEBUG(0, ("Failed to create directory %s for lock files - %s\n",
                          lp_lock_directory(), strerror(errno)));
                exit(1);
        }
 
-       ok = directory_create_or_exist(lp_pid_directory(), geteuid(), 0755);
+       ok = directory_create_or_exist(lp_pid_directory(), 0755);
        if (!ok) {
                DEBUG(0, ("Failed to create directory %s for pid files - %s\n",
                          lp_pid_directory(), strerror(errno)));
index d59668be939f4b80c53d6580da0e3cec414abbc7..691266cfabf0b852b7108510811c5779f1864516 100644 (file)
@@ -1007,7 +1007,7 @@ static void ldapsrv_task_init(struct task_server *task)
         * Make sure the directory for the privileged ldapi socket exists, and
         * is of the correct permissions
         */
-       if (!directory_create_or_exist(priv_dir, geteuid(), 0750)) {
+       if (!directory_create_or_exist(priv_dir, 0750)) {
                task_server_terminate(task, "Cannot create ldap "
                                      "privileged ldapi directory", true);
                return;
index 6aa984de22a26013491cffa86716de037c3653d9..f9907b261ff4d676c82ac7fdb72bdc5d22759770 100644 (file)
@@ -200,7 +200,7 @@ NTSTATUS tstream_setup_named_pipe(TALLOC_CTX *mem_ctx,
                goto fail;
        }
 
-       if (!directory_create_or_exist(lpcfg_ncalrpc_dir(lp_ctx), geteuid(), 0755)) {
+       if (!directory_create_or_exist(lpcfg_ncalrpc_dir(lp_ctx), 0755)) {
                status = map_nt_error_from_unix_common(errno);
                DEBUG(0,(__location__ ": Failed to create ncalrpc pipe directory '%s' - %s\n",
                         lpcfg_ncalrpc_dir(lp_ctx), nt_errstr(status)));