diff options
author | Andrew Tridgell <tridge@samba.org> | 1998-10-04 06:44:20 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 1998-10-04 06:44:20 +0000 |
commit | af4a13b37a1dbf7df8b246abc4f816f48d71c007 (patch) | |
tree | 1a5b064648ff0d2965a362007b3b11f30bd6246e | |
parent | f3db9286f98a8d5ab2310fca73e89f0f2732704e (diff) | |
download | samba-af4a13b37a1dbf7df8b246abc4f816f48d71c007.tar.gz samba-af4a13b37a1dbf7df8b246abc4f816f48d71c007.tar.xz samba-af4a13b37a1dbf7df8b246abc4f816f48d71c007.zip |
refuse symlinks to or from a smb path
(This used to be commit 83e93d2a4493546cb481f5c8187c64207b5901d1)
-rw-r--r-- | source3/smbwrapper/realcalls.h | 1 | ||||
-rw-r--r-- | source3/smbwrapper/smbw.c | 4 | ||||
-rw-r--r-- | source3/smbwrapper/wrapped.c | 14 |
3 files changed, 17 insertions, 2 deletions
diff --git a/source3/smbwrapper/realcalls.h b/source3/smbwrapper/realcalls.h index a234332b615..786e8966416 100644 --- a/source3/smbwrapper/realcalls.h +++ b/source3/smbwrapper/realcalls.h @@ -51,6 +51,7 @@ #define real_readlink(fn,buf,len) (syscall(SYS_readlink, (fn), (buf), (len))) #define real_rename(fn1, fn2) (syscall(SYS_rename, (fn1), (fn2))) +#define real_symlink(fn1, fn2) (syscall(SYS_symlink, (fn1), (fn2))) #define real_stat(fn, buf ) (syscall(SYS_stat, (fn), (buf))) #define real_fstat(fd, buf ) (syscall(SYS_fstat, (fd), (buf))) #define real_read(fd, buf, count ) (syscall(SYS_read, (fd), (buf), (count))) diff --git a/source3/smbwrapper/smbw.c b/source3/smbwrapper/smbw.c index e933fc36361..39c3eec90c1 100644 --- a/source3/smbwrapper/smbw.c +++ b/source3/smbwrapper/smbw.c @@ -319,8 +319,8 @@ int smbw_errno(struct cli_state *c) ret = cli_error(c, &eclass, &ecode); if (ret) { - DEBUG(3,("smbw_error %d %d (0x%x)\n", - (int)eclass, (int)ecode, (int)ecode)); + DEBUG(3,("smbw_error %d %d (0x%x) -> %d\n", + (int)eclass, (int)ecode, (int)ecode, ret)); } return ret; } diff --git a/source3/smbwrapper/wrapped.c b/source3/smbwrapper/wrapped.c index 30676ca3d0f..13bd449db3a 100644 --- a/source3/smbwrapper/wrapped.c +++ b/source3/smbwrapper/wrapped.c @@ -495,3 +495,17 @@ __asm__(".globl __write; __write = write"); return real_rmdir(name); } + + int symlink(const char *topath,const char *frompath) +{ + int p1, p2; + p1 = smbw_path(topath); + p2 = smbw_path(frompath); + if (p1 || p2) { + /* can't handle symlinks */ + errno = EPERM; + return -1; + } + + return real_symlink(topath, frompath); +} |