diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/Makefile.in | 1 | ||||
-rw-r--r-- | source3/smbwrapper/mkdir.c | 31 | ||||
-rw-r--r-- | source3/smbwrapper/realcalls.h | 2 | ||||
-rw-r--r-- | source3/smbwrapper/rmdir.c | 31 | ||||
-rw-r--r-- | source3/smbwrapper/smbw.c | 87 |
5 files changed, 152 insertions, 0 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in index b7f5d3d78d..2558d8eaf3 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -200,6 +200,7 @@ SMBWRAPPER_OBJ = smbwrapper/open.o smbwrapper/stat.o \ smbwrapper/write.o smbwrapper/readlink.o smbwrapper/unlink.o \ smbwrapper/rename.o smbwrapper/utime.o smbwrapper/chown.o \ smbwrapper/chmod.o smbwrapper/lseek.o \ + smbwrapper/mkdir.o smbwrapper/rmdir.o \ $(LIBSMB_OBJ) $(PARAM_OBJ) \ $(UBIQX_OBJ) $(LIB_OBJ) diff --git a/source3/smbwrapper/mkdir.c b/source3/smbwrapper/mkdir.c new file mode 100644 index 0000000000..e28a6a59b5 --- /dev/null +++ b/source3/smbwrapper/mkdir.c @@ -0,0 +1,31 @@ +/* + Unix SMB/Netbios implementation. + Version 2.0 + SMB wrapper functions + Copyright (C) Andrew Tridgell 1998 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "wrapper.h" + + int mkdir(const char *name, mode_t mode) +{ + if (smbw_path(name)) { + return smbw_mkdir(name, mode); + } + + return real_mkdir(name, mode); +} diff --git a/source3/smbwrapper/realcalls.h b/source3/smbwrapper/realcalls.h index 898a94eeb4..f9718a1ef1 100644 --- a/source3/smbwrapper/realcalls.h +++ b/source3/smbwrapper/realcalls.h @@ -38,6 +38,8 @@ struct dirent *__libc_readdir(DIR * dir); #define real_fcntl(fd,cmd,arg) (syscall(SYS_fcntl, (fd), (cmd), (arg))) #define real_symlink(fn1, fn2) (syscall(SYS_symlink, (fn1), (fn2))) #define real_unlink(fn) (syscall(SYS_unlink, (fn))) +#define real_rmdir(fn) (syscall(SYS_rmdir, (fn))) +#define real_mkdir(fn, mode) (syscall(SYS_mkdir, (fn), (mode))) #define real_utime(fn, buf) (syscall(SYS_utime, (fn), (buf))) #define real_utimes(fn, buf) (syscall(SYS_utimes, (fn), (buf))) #define real_readlink(fn, buf, bufs) (syscall(SYS_readlink, (fn), (buf), (bufs))) diff --git a/source3/smbwrapper/rmdir.c b/source3/smbwrapper/rmdir.c new file mode 100644 index 0000000000..120b6eaf22 --- /dev/null +++ b/source3/smbwrapper/rmdir.c @@ -0,0 +1,31 @@ +/* + Unix SMB/Netbios implementation. + Version 2.0 + SMB wrapper functions + Copyright (C) Andrew Tridgell 1998 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "wrapper.h" + + int rmdir(const char *name) +{ + if (smbw_path(name)) { + return smbw_rmdir(name); + } + + return real_rmdir(name); +} diff --git a/source3/smbwrapper/smbw.c b/source3/smbwrapper/smbw.c index 3a98143260..e7030a4e37 100644 --- a/source3/smbwrapper/smbw.c +++ b/source3/smbwrapper/smbw.c @@ -1511,3 +1511,90 @@ off_t smbw_lseek(int fd, off_t offset, int whence) smbw_busy--; return file->offset; } + + +/***************************************************** +a wrapper for mkdir() +*******************************************************/ +int smbw_mkdir(const char *fname, mode_t mode) +{ + struct smbw_server *srv; + fstring server, share; + pstring path; + + DEBUG(4,("%s (%s)\n", __FUNCTION__, fname)); + + if (!fname) { + errno = EINVAL; + return -1; + } + + smbw_init(); + + smbw_busy++; + + /* work out what server they are after */ + smbw_parse_path(fname, server, share, path); + + /* get a connection to the server */ + srv = smbw_server(server, share); + if (!srv) { + /* smbw_server sets errno */ + goto failed; + } + + if (!cli_mkdir(&srv->cli, path)) { + errno = smbw_errno(&srv->cli); + goto failed; + } + + smbw_busy--; + return 0; + + failed: + smbw_busy--; + return -1; +} + +/***************************************************** +a wrapper for rmdir() +*******************************************************/ +int smbw_rmdir(const char *fname) +{ + struct smbw_server *srv; + fstring server, share; + pstring path; + + DEBUG(4,("%s (%s)\n", __FUNCTION__, fname)); + + if (!fname) { + errno = EINVAL; + return -1; + } + + smbw_init(); + + smbw_busy++; + + /* work out what server they are after */ + smbw_parse_path(fname, server, share, path); + + /* get a connection to the server */ + srv = smbw_server(server, share); + if (!srv) { + /* smbw_server sets errno */ + goto failed; + } + + if (!cli_rmdir(&srv->cli, path)) { + errno = smbw_errno(&srv->cli); + goto failed; + } + + smbw_busy--; + return 0; + + failed: + smbw_busy--; + return -1; +} |