summaryrefslogtreecommitdiff
path: root/source3/smbwrapper
diff options
context:
space:
mode:
Diffstat (limited to 'source3/smbwrapper')
-rw-r--r--source3/smbwrapper/realcalls.h43
-rw-r--r--source3/smbwrapper/shared.c2
-rw-r--r--source3/smbwrapper/smbsh.c2
-rw-r--r--source3/smbwrapper/smbw.c15
-rw-r--r--source3/smbwrapper/smbw_dir.c5
-rw-r--r--source3/smbwrapper/wrapped.c7
6 files changed, 19 insertions, 55 deletions
diff --git a/source3/smbwrapper/realcalls.h b/source3/smbwrapper/realcalls.h
index a38703ee7e..251c267337 100644
--- a/source3/smbwrapper/realcalls.h
+++ b/source3/smbwrapper/realcalls.h
@@ -58,8 +58,6 @@
#elif HAVE___OPEN64
#define real_open64(fn,flags,mode) (__open64(fn,flags,mode))
#define NO_OPEN64_ALIAS
-#else
-#error No open64() wrapper
#endif
#ifdef HAVE__FORK
@@ -68,8 +66,6 @@
#define real_fork() (__fork())
#elif SYS_fork
#define real_fork() (syscall(SYS_fork))
-#else
-#error No fork() wrapper
#endif
#ifdef HAVE__OPENDIR
@@ -78,8 +74,6 @@
#define real_opendir(fn) (syscall(SYS_opendir,(fn)))
#elif HAVE___OPENDIR
#define real_opendir(fn) (__opendir(fn))
-#else
-#error No opendir() wrapper
#endif
#ifdef HAVE__READDIR
@@ -88,8 +82,6 @@
#define real_readdir(d) (__readdir(d))
#elif SYS_readdir
#define real_readdir(d) (syscall(SYS_readdir,(d)))
-#else
-#error No readdir() wrapper
#endif
#ifdef HAVE__CLOSEDIR
@@ -98,8 +90,6 @@
#define real_closedir(d) (syscall(SYS_closedir,(d)))
#elif HAVE___CLOSEDIR
#define real_closedir(d) (__closedir(d))
-#else
-#error No closedir() wrapper
#endif
#ifdef HAVE__SEEKDIR
@@ -110,7 +100,6 @@
#define real_seekdir(d,l) (__seekdir(d,l))
#else
#define NO_SEEKDIR_WRAPPER
-#error No seekdir() wrapper
#endif
#ifdef HAVE__TELLDIR
@@ -119,8 +108,6 @@
#define real_telldir(d) (syscall(SYS_telldir,(d)))
#elif HAVE___TELLDIR
#define real_telldir(d) (__telldir(d))
-#else
-#error No telldir() wrapper
#endif
#ifdef HAVE__DUP
@@ -129,8 +116,6 @@
#define real_dup(d) (syscall(SYS_dup,(d)))
#elif HAVE___DUP
#define real_dup(d) (__dup(d))
-#else
-#error No dup() wrapper
#endif
#ifdef HAVE__DUP2
@@ -139,8 +124,6 @@
#define real_dup2(d1,d2) (syscall(SYS_dup2,(d1),(d2)))
#elif HAVE___DUP2
#define real_dup2(d1,d2) (__dup2(d1,d2))
-#else
-#error No dup2() wrapper
#endif
#ifdef HAVE__GETCWD
@@ -149,8 +132,6 @@
#define real_getcwd(b,s) ((char *)syscall(SYS_getcwd,(b),(s)))
#elif HAVE___GETCWD
#define real_getcwd(b,s) ((char *)__getcwd(b,s))
-#else
-#error No getcwd() wrapper
#endif
#ifdef HAVE__STAT
@@ -159,8 +140,6 @@
#define real_stat(fn,st) (syscall(SYS_stat,(fn),(st)))
#elif HAVE___STAT
#define real_stat(fn,st) (__stat(fn,st))
-#else
-#error No stat() wrapper
#endif
#ifdef HAVE__LSTAT
@@ -169,8 +148,6 @@
#define real_lstat(fn,st) (syscall(SYS_lstat,(fn),(st)))
#elif HAVE___LSTAT
#define real_lstat(fn,st) (__lstat(fn,st))
-#else
-#error No lstat() wrapper
#endif
#ifdef HAVE__FSTAT
@@ -179,8 +156,6 @@
#define real_fstat(fd,st) (syscall(SYS_fstat,(fd),(st)))
#elif HAVE___FSTAT
#define real_fstat(fd,st) (__fstat(fd,st))
-#else
-#error No fstat() wrapper
#endif
#if defined(HAVE_SYS_ACL_H) && defined(HAVE__ACL)
@@ -208,32 +183,24 @@
#define real_stat64(fn,st) (_stat64(fn,st))
#elif HAVE___STAT64
#define real_stat64(fn,st) (__stat64(fn,st))
-#else
-#error No stat64() wrapper
#endif
#ifdef HAVE__LSTAT64
#define real_lstat64(fn,st) (_lstat64(fn,st))
#elif HAVE___LSTAT64
#define real_lstat64(fn,st) (__lstat64(fn,st))
-#else
-#error No lstat64() wrapper
#endif
#ifdef HAVE__FSTAT64
#define real_fstat64(fd,st) (_fstat64(fd,st))
#elif HAVE___FSTAT64
#define real_fstat64(fd,st) (__fstat64(fd,st))
-#else
-#error No fstat64() wrapper
#endif
#ifdef HAVE__READDIR64
#define real_readdir64(d) (_readdir64(d))
#elif HAVE___READDIR64
#define real_readdir64(d) (__readdir64(d))
-#else
-#error No readdir64() wrapper
#endif
#ifdef HAVE__LLSEEK
@@ -242,8 +209,6 @@
#define real_llseek(fd,ofs,whence) (__llseek(fd,ofs,whence))
#elif HAVE___SYS_LLSEEK
#define real_llseek(fd,ofs,whence) (__sys_llseek(fd,ofs,whence))
-#else
-#error No llseek() wrapper
#endif
@@ -251,32 +216,24 @@
#define real_pread(fd,buf,size,ofs) (_pread(fd,buf,size,ofs))
#elif HAVE___PREAD
#define real_pread(fd,buf,size,ofs) (__pread(fd,buf,size,ofs))
-#else
-#error No pread() wrapper
#endif
#ifdef HAVE__PREAD64
#define real_pread64(fd,buf,size,ofs) (_pread64(fd,buf,size,ofs))
#elif HAVE___PREAD64
#define real_pread64(fd,buf,size,ofs) (__pread64(fd,buf,size,ofs))
-#else
-#error No pread64() wrapper
#endif
#ifdef HAVE__PWRITE
#define real_pwrite(fd,buf,size,ofs) (_pwrite(fd,buf,size,ofs))
#elif HAVE___PWRITE
#define real_pwrite(fd,buf,size,ofs) (__pwrite(fd,buf,size,ofs))
-#else
-#error No pwrite() wrapper
#endif
#ifdef HAVE__PWRITE64
#define real_pwrite64(fd,buf,size,ofs) (_pwrite64(fd,buf,size,ofs))
#elif HAVE___PWRITE64
#define real_pwrite64(fd,buf,size,ofs) (__pwrite64(fd,buf,size,ofs))
-#else
-#error No pwrite64() wrapper
#endif
diff --git a/source3/smbwrapper/shared.c b/source3/smbwrapper/shared.c
index 010c5ae19a..f7f7b8c8ea 100644
--- a/source3/smbwrapper/shared.c
+++ b/source3/smbwrapper/shared.c
@@ -37,7 +37,7 @@ void smbw_setup_shared(void)
slprintf(s,sizeof(s)-1, "%s/smbw.XXXXXX",tmpdir());
- fstrcpy(name,(char *)mktemp(s));
+ fstrcpy(name,(char *)smbd_mktemp(s));
/* note zero permissions! don't change this */
fd = sys_open(name,O_RDWR|O_CREAT|O_TRUNC|O_EXCL,0);
diff --git a/source3/smbwrapper/smbsh.c b/source3/smbwrapper/smbsh.c
index 8c9d00bd98..e11244d4fb 100644
--- a/source3/smbwrapper/smbsh.c
+++ b/source3/smbwrapper/smbsh.c
@@ -93,7 +93,7 @@ int main(int argc, char *argv[])
sys_getwd(wd);
- slprintf(line,sizeof(line)-1,"PWD_%d", getpid());
+ slprintf(line,sizeof(line)-1,"PWD_%d", (int)getpid());
smbw_setshared(line, wd);
diff --git a/source3/smbwrapper/smbw.c b/source3/smbwrapper/smbw.c
index faaa9f047b..4c246e1e40 100644
--- a/source3/smbwrapper/smbw.c
+++ b/source3/smbwrapper/smbw.c
@@ -81,7 +81,7 @@ void smbw_init(void)
lp_load(servicesf,True,False,False);
- get_myname(global_myname,NULL);
+ get_myname(global_myname);
if ((p=smbw_getshared("DEBUG"))) {
DEBUGLEVEL = atoi(p);
@@ -93,11 +93,11 @@ void smbw_init(void)
if ((p=smbw_getshared("PREFIX"))) {
slprintf(smbw_prefix,sizeof(fstring)-1, "/%s/", p);
- string_sub(smbw_prefix,"//", "/");
+ all_string_sub(smbw_prefix,"//", "/", 0);
DEBUG(2,("SMBW_PREFIX is %s\n", smbw_prefix));
}
- slprintf(line,sizeof(line)-1,"PWD_%d", getpid());
+ slprintf(line,sizeof(line)-1,"PWD_%d", (int)getpid());
p = smbw_getshared(line);
if (!p) {
@@ -320,7 +320,7 @@ char *smbw_parse_path(const char *fname, char *server, char *share, char *path)
pstrcpy(path,p);
- string_sub(path, "/", "\\");
+ all_string_sub(path, "/", "\\", 0);
ok:
DEBUG(4,("parsed path name=%s cwd=%s [%s] [%s] [%s]\n",
@@ -341,6 +341,9 @@ int smbw_path(const char *path)
char *cwd;
int len;
+ if(!path)
+ return 0;
+
/* this is needed to prevent recursion with the BSD malloc which
opens /etc/malloc.conf on the first call */
if (strncmp(path,"/etc/", 5) == 0) {
@@ -378,7 +381,7 @@ int smbw_errno(struct cli_state *c)
uint32 ecode;
int ret;
- ret = cli_error(c, &eclass, &ecode);
+ ret = cli_error(c, &eclass, &ecode, NULL);
if (ret) {
DEBUG(3,("smbw_error %d %d (0x%x) -> %d\n",
@@ -1385,7 +1388,7 @@ int smbw_fork(void)
smbw_srv_close(srv);
}
- slprintf(line,sizeof(line)-1,"PWD_%d", getpid());
+ slprintf(line,sizeof(line)-1,"PWD_%d", (int)getpid());
smbw_setshared(line,smbw_cwd);
/* unblock the parent */
diff --git a/source3/smbwrapper/smbw_dir.c b/source3/smbwrapper/smbw_dir.c
index 7c6e6db70a..0929428273 100644
--- a/source3/smbwrapper/smbw_dir.c
+++ b/source3/smbwrapper/smbw_dir.c
@@ -146,8 +146,7 @@ static void smbw_printjob_add(struct print_job_info *job)
finfo.mtime = job->t;
finfo.atime = job->t;
finfo.ctime = job->t;
- finfo.uid = (uid_t)-1;
- nametouid(job->user, &finfo.uid);
+ finfo.uid = nametouid(job->user);
finfo.mode = aRONLY;
finfo.size = job->size;
@@ -198,7 +197,7 @@ int smbw_dir_open(const char *fname)
cur_dir = dir;
slprintf(mask, sizeof(mask)-1, "%s\\*", path);
- string_sub(mask,"\\\\","\\");
+ all_string_sub(mask,"\\\\","\\",0);
if ((p=strstr(srv->server_name,"#1D"))) {
DEBUG(4,("doing NetServerEnum\n"));
diff --git a/source3/smbwrapper/wrapped.c b/source3/smbwrapper/wrapped.c
index 4703614d64..1b356e6a26 100644
--- a/source3/smbwrapper/wrapped.c
+++ b/source3/smbwrapper/wrapped.c
@@ -30,6 +30,10 @@
#include <errno.h>
#include "realcalls.h"
+#ifndef NULL
+# define NULL ((void *)0)
+#endif
+
int open(char *name, int flags, mode_t mode)
{
if (smbw_path(name)) {
@@ -687,7 +691,7 @@
static double xx[70];
void *d;
d = (void *)readdir(dir);
- if (!d) return (void *)0;
+ if (!d) return NULL;
dirent64_convert(d, xx);
return xx;
}
@@ -699,3 +703,4 @@
{
return smbw_fork();
}
+