]> git.ipfire.org Git - pakfire.git/commitdiff
Use sane directory/file permissions throughout
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 17 Jul 2022 18:56:46 +0000 (18:56 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 17 Jul 2022 18:56:46 +0000 (18:56 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/build.c
src/libpakfire/key.c
src/libpakfire/mount.c
src/libpakfire/packager.c
src/libpakfire/pakfire.c
src/libpakfire/util.c

index 230d2c0dd01cb7c23796bdd1e41d0a8a21ec986a..480a7faa600b94aa7936aade0c4dc54db3ec2941 100644 (file)
@@ -838,7 +838,7 @@ static int pakfire_build_enable_repos(struct pakfire* pakfire) {
        const char* path = pakfire_repo_get_path(repo);
 
        // Make sure the source directory exists
-       r = pakfire_mkdir(path, 0);
+       r = pakfire_mkdir(path, 0700);
        if (r && errno != EEXIST) {
                ERROR(pakfire, "Could not create repository directory %s: %m\n", path);
                goto ERROR;
index 07b6dbaf5d48e235b59816d6c079c83280fd67eb..cb81057b6502d0f6e9aa6d4e3aaf56fa17d75c34 100644 (file)
@@ -381,7 +381,7 @@ static int pakfire_key_write_to_keystore(struct pakfire_key* key) {
                return r;
 
        // Create parent directory
-       r = pakfire_mkparentdir(path, 0);
+       r = pakfire_mkparentdir(path, 0700);
        if (r)
                return r;
 
index 2e2d31c61b9367775c829714b7baf3e3133043a0..6627eab6e43cebfa9692d0eb03a342b60e62fcf9 100644 (file)
@@ -350,7 +350,7 @@ static int pakfire_mount_interpreter(struct pakfire* pakfire) {
                return r;
 
        // Create directory
-       r = pakfire_mkparentdir(target, 0);
+       r = pakfire_mkparentdir(target, 0755);
        if (r)
                return r;
 
@@ -381,7 +381,7 @@ int pakfire_mount_all(struct pakfire* pakfire) {
                        return r;
 
                // Create target
-               pakfire_mkdir(target, 0);
+               pakfire_mkdir(target, 0755);
 
 RETRY:
                // Perform mount()
@@ -389,7 +389,7 @@ RETRY:
                if (r) {
                        // If the target directory does not exist, we will create it
                        if (errno == ENOENT) {
-                               r = pakfire_mkdir(target, S_IRUSR|S_IWUSR|S_IXUSR);
+                               r = pakfire_mkdir(target, 0755);
                                if (r) {
                                        ERROR(pakfire, "Could not create %s\n", target);
                                        return r;
@@ -455,7 +455,7 @@ PAKFIRE_EXPORT int pakfire_bind(struct pakfire* pakfire, const char* src, const
        // Make sure the mountpoint exists
        switch (st.st_mode & S_IFMT) {
                case S_IFDIR:
-                       r = pakfire_mkdir(mountpoint, 0);
+                       r = pakfire_mkdir(mountpoint, st.st_mode);
                        if (r && errno != EEXIST)
                                return r;
                        break;
@@ -463,7 +463,7 @@ PAKFIRE_EXPORT int pakfire_bind(struct pakfire* pakfire, const char* src, const
                case S_IFREG:
                case S_IFLNK:
                        // Make parent directory
-                       r = pakfire_mkparentdir(mountpoint, 0);
+                       r = pakfire_mkparentdir(mountpoint, 0755);
                        if (r)
                                return r;
 
index cf7e0168b4eddc7e9a5eaae3f414c15b9e9c1497..02434f59e2d2836233d799b385841227d6a7f0de 100644 (file)
@@ -782,7 +782,7 @@ int pakfire_packager_finish_to_directory(struct pakfire_packager* packager,
                goto ERROR;
 
        // Create the parent directory
-       r = pakfire_mkparentdir(path, 0);
+       r = pakfire_mkparentdir(path, 0755);
        if (r)
                goto ERROR;
 
index da24e4fd064624f21abfefc96f1e4d2d1447f136..f1a94c3599a60578a053e3613766f49fb93db762 100644 (file)
@@ -739,7 +739,7 @@ PAKFIRE_EXPORT int pakfire_create(struct pakfire** pakfire, const char* path,
        }
 
        // Make sure that our private directory exists
-       r = pakfire_mkdir(private_dir, 0);
+       r = pakfire_mkdir(private_dir, 0755);
        if (r && errno != EEXIST) {
                ERROR(p, "Could not create private directory %s: %m\n", private_dir);
                goto ERROR;
@@ -819,7 +819,7 @@ int pakfire_acquire_lock(struct pakfire* pakfire) {
        DEBUG(pakfire, "Acquire lock...\n");
 
        // Ensure the parent directory exists
-       pakfire_mkparentdir(pakfire->lock_path, 0);
+       pakfire_mkparentdir(pakfire->lock_path, 0755);
 
        // Open the lock file
        pakfire->lock = fopen(pakfire->lock_path, "w");
@@ -1893,7 +1893,7 @@ int pakfire_build_setup(struct pakfire* pakfire) {
                        return r;
 
                // Ensure path exists
-               r = pakfire_mkdir(path, 0);
+               r = pakfire_mkdir(path, 0755);
                if (r && errno != EEXIST) {
                        ERROR(pakfire, "Could not create ccache directory %s: %m\n", path);
                        return r;
index 8df135d1a38196179a04630ea244b5e3268c7f36..7bcc0d3e511f930f8a4a771ffcb9e355f013c917 100644 (file)
@@ -961,7 +961,7 @@ int pakfire_mkdir(const char* path, mode_t mode) {
 }
 
 FILE* pakfire_mktemp(char* path) {
-       int r = pakfire_mkparentdir(path, 0);
+       int r = pakfire_mkparentdir(path, 755);
        if (r)
                return NULL;
 
@@ -975,7 +975,7 @@ FILE* pakfire_mktemp(char* path) {
 }
 
 char* pakfire_mkdtemp(char* path) {
-       int r = pakfire_mkparentdir(path, 0);
+       int r = pakfire_mkparentdir(path, 755);
        if (r)
                return NULL;