summaryrefslogtreecommitdiff
path: root/setup_native/scripts/source
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2005-12-21 11:53:43 +0000
committerOliver Bolte <obo@openoffice.org>2005-12-21 11:53:43 +0000
commitaff5df8f52f35f6264d5adcba0d9ca57cb9e6cc4 (patch)
tree248e82ddc00695fd5ba8d14c85634f4c8d69dd0b /setup_native/scripts/source
parentfc5f97768d817d1a2ebd8f2bfe8562c52d855550 (diff)
INTEGRATION: CWS nativefixer21 (1.7.26); FILE MERGED
2005/11/15 17:06:39 cp 1.7.26.1: #i57948# prevent directories without execute rights
Diffstat (limited to 'setup_native/scripts/source')
-rw-r--r--setup_native/scripts/source/getuid.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/setup_native/scripts/source/getuid.c b/setup_native/scripts/source/getuid.c
index f62bf161a19d..926c2b809af2 100644
--- a/setup_native/scripts/source/getuid.c
+++ b/setup_native/scripts/source/getuid.c
@@ -1,6 +1,7 @@
+#include <fcntl.h>
#include <sys/types.h>
-#include <unistd.h>
#include <sys/stat.h>
+#include <unistd.h>
#include <dlfcn.h>
#ifdef _cplusplus
@@ -17,6 +18,7 @@ int lchown (const char *path, uid_t owner, gid_t group) {return 0;}
int fchown (int fildes, uid_t owner, gid_t group) {return 0;}
uid_t getuid (void) {return 0;}
+int stat(const char *path, struct stat *buf);
#ifdef __notdef__
uid_t geteuid (void) {return 0;}
gid_t getgid (void) {return 0;}
@@ -44,6 +46,31 @@ int fstat(int fildes, struct stat *buf)
return ret;
}
+/* this is to fool mkdir, don't allow to remove owner execute right from directories */
+int chmod(const char *path, mode_t mode)
+{
+ int ret = 0;
+ static int (*p_chmod) (const char *path, mode_t mode) = NULL;
+ if (p_chmod == NULL)
+ p_chmod = (int (*)(const char *path, mode_t mode))
+ dlsym (RTLD_NEXT, "chmod");
+
+ if ((mode & S_IXUSR) == 0)
+ {
+ struct stat statbuf;
+ if (stat(path, &statbuf) == 0)
+ {
+ if ((statbuf.st_mode & S_IFDIR) != 0)
+ mode = (mode | S_IXUSR);
+ }
+ }
+
+ ret = (*p_chmod)(path, mode);
+ return ret;
+}
+
+
+
/* This is to fool tar */
int fstatat64(int fildes, const char *path, struct stat64 *buf, int flag)
{