summaryrefslogtreecommitdiff
path: root/source3/smbwrapper
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1998-10-04 15:54:04 +0000
committerAndrew Tridgell <tridge@samba.org>1998-10-04 15:54:04 +0000
commite34e25d907ee92063fd2466a1634b961e292cc0f (patch)
treee47bb2ab6755df1e37082c6166d03f3183ec9195 /source3/smbwrapper
parent767784550642439ccc86f96f3894490774448f10 (diff)
downloadsamba-e34e25d907ee92063fd2466a1634b961e292cc0f.tar.gz
samba-e34e25d907ee92063fd2466a1634b961e292cc0f.tar.bz2
samba-e34e25d907ee92063fd2466a1634b961e292cc0f.zip
more solaris 2.5 fixups. It now seems to be working pretty well.
(This used to be commit c4e450817886b40474cebdfc50c0c16fb4646baf)
Diffstat (limited to 'source3/smbwrapper')
-rw-r--r--source3/smbwrapper/realcalls.h24
-rwxr-xr-xsource3/smbwrapper/smbsh1
-rw-r--r--source3/smbwrapper/wrapped.c82
-rw-r--r--source3/smbwrapper/wrapper.h5
4 files changed, 99 insertions, 13 deletions
diff --git a/source3/smbwrapper/realcalls.h b/source3/smbwrapper/realcalls.h
index 13a73ae354..2267d21a73 100644
--- a/source3/smbwrapper/realcalls.h
+++ b/source3/smbwrapper/realcalls.h
@@ -64,7 +64,7 @@
#elif HAVE___SEEKDIR
#define real_seekdir(d) (__seekdir(d,l))
#else
-#define NO_SEEKDIR
+#define NO_SEEKDIR_WRAPPER
#endif
#ifdef HAVE__TELLDIR
@@ -74,7 +74,7 @@
#elif HAVE___TELLDIR
#define real_telldir(d) (__telldir(d))
#else
-#define NO_TELLDIR
+#define NO_TELLDIR_WRAPPER
#endif
#ifdef HAVE__DUP
@@ -125,6 +125,26 @@
#define real_fstat(fd,st) (__fstat(fd,st))
#endif
+#ifdef HAVE__ACL
+#define real_acl(fn,cmd,n,buf) (_acl(fn,cmd,n,buf))
+#elif SYS_acl
+#define real_acl(fn,cmd,n,buf) (syscall(SYS_acl,(fn),(cmd),(n),(buf)))
+#elif HAVE___ACL
+#define real_acl(fn,cmd,n,buf) (__acl(fn,cmd,n,buf))
+#else
+#define NO_ACL_WRAPPER
+#endif
+
+#ifdef HAVE__FACL
+#define real_facl(fd,cmd,n,buf) (_facl(fd,cmd,n,buf))
+#elif SYS_facl
+#define real_facl(fd,cmd,n,buf) (syscall(SYS_facl,(fd),(cmd),(n),(buf)))
+#elif HAVE___FACL
+#define real_facl(fd,cmd,n,buf) (__facl(fd,cmd,n,buf))
+#else
+#define NO_FACL_WRAPPER
+#endif
+
#define real_readlink(fn,buf,len) (syscall(SYS_readlink, (fn), (buf), (len)))
#define real_rename(fn1, fn2) (syscall(SYS_rename, (fn1), (fn2)))
diff --git a/source3/smbwrapper/smbsh b/source3/smbwrapper/smbsh
index 47c21f8cbe..2c83b454dd 100755
--- a/source3/smbwrapper/smbsh
+++ b/source3/smbwrapper/smbsh
@@ -27,6 +27,7 @@ fi
LD_PRELOAD=$LIBDIR/smbwrapper.so
export LD_PRELOAD
+PWD=`pwd`
export PWD
PS1='smbsh$ '
export PS1
diff --git a/source3/smbwrapper/wrapped.c b/source3/smbwrapper/wrapped.c
index d8a6a6fdac..8aa3768638 100644
--- a/source3/smbwrapper/wrapped.c
+++ b/source3/smbwrapper/wrapped.c
@@ -22,7 +22,9 @@
#include "wrapper.h"
-#ifdef linux
+#ifdef HAVE__OPEN
+__asm__(".globl _open; _open = open");
+#elif HAVE___OPEN
__asm__(".globl __open; __open = open");
#endif
@@ -36,8 +38,10 @@ __asm__(".globl __open; __open = open");
}
-#ifdef linux
+#ifdef HAVE___CHDIR
__asm__(".globl __chdir; __chdir = chdir");
+#elif HAVE__CHDIR
+__asm__(".globl _chdir; _chdir = chdir");
#endif
int chdir(const char *name)
@@ -47,8 +51,10 @@ __asm__(".globl __chdir; __chdir = chdir");
-#ifdef linux
+#ifdef HAVE___CLOSE
__asm__(".globl __close; __close = close");
+#elif HAVE__CLOSE
+__asm__(".globl _close; _close = close");
#endif
ssize_t close(int fd)
@@ -61,8 +67,10 @@ __asm__(".globl __close; __close = close");
}
-#ifdef linux
+#ifdef HAVE___FCHDIR
__asm__(".globl __fchdir; __fchdir = fchdir");
+#elif HAVE__FCHDIR
+__asm__(".globl _fchdir; _fchdir = fchdir");
#endif
int fchdir(int fd)
@@ -75,8 +83,10 @@ __asm__(".globl __fchdir; __fchdir = fchdir");
}
-#ifdef linux
+#ifdef HAVE___FCNTL
__asm__(".globl __fcntl; __fcntl = fcntl");
+#elif HAVE__FCNTL
+__asm__(".globl _fcntl; _fcntl = fcntl");
#endif
int fcntl(int fd, int cmd, long arg)
@@ -90,8 +100,10 @@ __asm__(".globl __fcntl; __fcntl = fcntl");
-#ifdef linux
+#ifdef HAVE___GETDENTS
__asm__(".globl __getdents; __getdents = getdents");
+#elif HAVE__GETDENTS
+__asm__(".globl _getdents; _getdents = getdents");
#endif
int getdents(int fd, struct dirent *dirp, unsigned int count)
@@ -104,8 +116,10 @@ __asm__(".globl __getdents; __getdents = getdents");
}
-#ifdef linux
+#ifdef HAVE___LSEEK
__asm__(".globl __lseek; __lseek = lseek");
+#elif HAVE__LSEEK
+__asm__(".globl _lseek; _lseek = lseek");
#endif
ssize_t lseek(int fd, off_t offset, int whence)
@@ -119,8 +133,10 @@ __asm__(".globl __lseek; __lseek = lseek");
-#ifdef linux
+#ifdef HAVE___READ
__asm__(".globl __read; __read = read");
+#elif HAVE__READ
+__asm__(".globl _read; _read = read");
#endif
ssize_t read(int fd, void *buf, size_t count)
@@ -133,8 +149,10 @@ __asm__(".globl __read; __read = read");
}
-#ifdef linux
+#ifdef HAVE___WRITE
__asm__(".globl __write; __write = write");
+#elif HAVE__WRITE
+__asm__(".globl _write; _write = write");
#endif
ssize_t write(int fd, void *buf, size_t count)
@@ -545,7 +563,7 @@ __asm__(".globl __write; __write = write");
return real_closedir(dir);
}
-#ifndef NO_TELLDIR
+#ifndef NO_TELLDIR_WRAPPER
off_t telldir(DIR *dir)
{
if (smbw_dirp(dir)) {
@@ -556,7 +574,7 @@ __asm__(".globl __write; __write = write");
}
#endif
-#ifndef NO_SEEKDIR
+#ifndef NO_SEEKDIR_WRAPPER
void seekdir(DIR *dir, off_t offset)
{
if (smbw_dirp(dir)) {
@@ -567,3 +585,45 @@ __asm__(".globl __write; __write = write");
real_seekdir(dir, offset);
}
#endif
+
+
+#ifndef NO_ACL_WRAPPER
+ int acl(const char *pathp, int cmd, int nentries, aclent_t *aclbufp)
+{
+ if (smbw_path(pathp)) {
+ switch (cmd) {
+ case GETACL:
+ case GETACLCNT:
+ return 0;
+ default:
+ errno = ENOSYS;
+ return -1;
+ }
+ }
+
+ real_acl(pathp, cmd, nentries, aclbufp);
+}
+#endif
+
+#ifndef NO_FACL_WRAPPER
+ int facl(int fd, int cmd, int nentries, aclent_t *aclbufp)
+{
+ if (smbw_fd(fd)) {
+ switch (cmd) {
+ case GETACL:
+ case GETACLCNT:
+ return 0;
+ default:
+ errno = ENOSYS;
+ return -1;
+ }
+ }
+
+ real_facl(fd, cmd, nentries, aclbufp);
+}
+#endif
+
+ int creat(const char *path, mode_t mode)
+{
+ return open(path, O_WRONLY | O_CREAT | O_TRUNC, mode);
+}
diff --git a/source3/smbwrapper/wrapper.h b/source3/smbwrapper/wrapper.h
index b80a029dff..95f68d7ef9 100644
--- a/source3/smbwrapper/wrapper.h
+++ b/source3/smbwrapper/wrapper.h
@@ -27,9 +27,14 @@
#include <sys/syscall.h>
#endif
+#ifdef HAVE_SYS_ACL_H
+#include <sys/acl.h>
+#endif
+
#include <stdio.h>
#include <dirent.h>
#include <errno.h>
+#include <sys/fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>