Move sys_lchown() to libreplace.
authorJelmer Vernooij <jelmer@samba.org>
Sat, 1 Nov 2008 02:39:20 +0000 (03:39 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Sat, 1 Nov 2008 02:39:20 +0000 (03:39 +0100)
lib/replace/README
lib/replace/libreplace.m4
lib/replace/replace.c
lib/replace/replace.h
source3/include/proto.h
source3/lib/system.c
source3/modules/vfs_default.c
source3/modules/vfs_netatalk.c

index f189e8716f8603eb49834058f4670182a7f8369b..1005281a6b71b7dd019d4d0c78990e1044d49501 100644 (file)
@@ -47,6 +47,7 @@ mkstemp (a secure one!)
 pread
 pwrite
 chown
 pread
 pwrite
 chown
+lchown
 getpass
 readline (the library)
 inet_ntoa
 getpass
 readline (the library)
 inet_ntoa
index a93a9dad4529ac1ce05d5e68c1dd908229ceb1ae..cc9be162acd179b288a6b1ec082d7b7c0d2a1234 100644 (file)
@@ -108,7 +108,7 @@ AC_CHECK_FUNCS(seteuid setresuid setegid setresgid chroot bzero strerror)
 AC_CHECK_FUNCS(vsyslog setlinebuf mktime ftruncate chsize rename)
 AC_CHECK_FUNCS(waitpid strlcpy strlcat initgroups memmove strdup)
 AC_CHECK_FUNCS(pread pwrite strndup strcasestr strtok_r mkdtemp)
 AC_CHECK_FUNCS(vsyslog setlinebuf mktime ftruncate chsize rename)
 AC_CHECK_FUNCS(waitpid strlcpy strlcat initgroups memmove strdup)
 AC_CHECK_FUNCS(pread pwrite strndup strcasestr strtok_r mkdtemp)
-AC_CHECK_FUNCS(isatty chown link readlink symlink)
+AC_CHECK_FUNCS(isatty chown lchown link readlink symlink)
 AC_HAVE_DECL(setresuid, [#include <unistd.h>])
 AC_HAVE_DECL(setresgid, [#include <unistd.h>])
 AC_HAVE_DECL(errno, [#include <errno.h>])
 AC_HAVE_DECL(setresuid, [#include <unistd.h>])
 AC_HAVE_DECL(setresgid, [#include <unistd.h>])
 AC_HAVE_DECL(errno, [#include <errno.h>])
index 37705b93cd6efafda26e216a2735c3369f9dec8f..f4faef992aecd68dd7be9fa18fbbce806a6a08af 100644 (file)
@@ -650,3 +650,11 @@ int rep_symlink(const char *oldpath, const char *newpath)
        return -1;
 }
 #endif
        return -1;
 }
 #endif
+
+#ifndef HAVE_LCHOWN
+int rep_lchown(const char *fname,uid_t uid,gid_t gid)
+{
+       errno = ENOSYS;
+       return -1;
+}
+#endif
index f56c5b0dc92f579d784e9aed1368d0a8384193be..b81bf5c576cfda08b56bbcb5ee46b161808c254c 100644 (file)
@@ -235,6 +235,10 @@ int rep_readlink(const char *path, char *buf, size_t bufsize);
 int rep_symlink(const char *oldpath, const char *newpath);
 #endif
 
 int rep_symlink(const char *oldpath, const char *newpath);
 #endif
 
+#ifndef HAVE_LCHOWN
+#define lchown rep_lchown
+int rep_lchown(const char *fname,uid_t uid,gid_t gid);
+#endif
 
 #ifndef HAVE_SETLINEBUF
 #define setlinebuf rep_setlinebuf
 
 #ifndef HAVE_SETLINEBUF
 #define setlinebuf rep_setlinebuf
index 7e6f608896d0527416043719206da0a1270443fc..5104910e993f8e44daa60db23c5c3c0bb2073f90 100644 (file)
@@ -1003,7 +1003,6 @@ int sys_mknod(const char *path, mode_t mode, SMB_DEV_T dev);
 char *sys_realpath(const char *path, char *resolved_path);
 int sys_waitpid(pid_t pid,int *status,int options);
 char *sys_getwd(char *s);
 char *sys_realpath(const char *path, char *resolved_path);
 int sys_waitpid(pid_t pid,int *status,int options);
 char *sys_getwd(char *s);
-int sys_lchown(const char *fname,uid_t uid,gid_t gid);
 int sys_chroot(const char *dname);
 void set_effective_capability(enum smbd_capability capability);
 void drop_effective_capability(enum smbd_capability capability);
 int sys_chroot(const char *dname);
 void set_effective_capability(enum smbd_capability capability);
 void drop_effective_capability(enum smbd_capability capability);
index e2ed11d450b090519dc14fdc5f9e101a9206a5d0..27722fcab2c2b3dc9570e18295012914cbace830 100644 (file)
@@ -580,25 +580,6 @@ char *sys_getwd(char *s)
        return wd;
 }
 
        return wd;
 }
 
-/*******************************************************************
- Wrapper for lchown.
-********************************************************************/
-
-int sys_lchown(const char *fname,uid_t uid,gid_t gid)
-{
-#ifndef HAVE_LCHOWN
-       static int done;
-       if (!done) {
-               DEBUG(1,("WARNING: no lchown!\n"));
-               done=1;
-       }
-       errno = ENOSYS;
-       return -1;
-#else
-       return(lchown(fname,uid,gid));
-#endif
-}
-
 /*******************************************************************
 os/2 also doesn't have chroot
 ********************************************************************/
 /*******************************************************************
 os/2 also doesn't have chroot
 ********************************************************************/
index 37b0fc392b5f94f02f69be363a413c0675503a82..13c2770208cabef63898cf577eabf487768bbe56 100644 (file)
@@ -621,7 +621,7 @@ static int vfswrap_lchown(vfs_handle_struct *handle, const char *path, uid_t uid
        int result;
 
        START_PROFILE(syscall_lchown);
        int result;
 
        START_PROFILE(syscall_lchown);
-       result = sys_lchown(path, uid, gid);
+       result = lchown(path, uid, gid);
        END_PROFILE(syscall_lchown);
        return result;
 }
        END_PROFILE(syscall_lchown);
        return result;
 }
index 2cc4a6c4ba9020f414ece77d8dc3149e19ad845c..ca7085ca18a5e65aed0255f797a53ebe36456318 100644 (file)
@@ -399,7 +399,7 @@ static int atalk_lchown(struct vfs_handle_struct *handle, const char *path, uid_
                goto exit_lchown;
        }
 
                goto exit_lchown;
        }
 
-       sys_lchown(adbl_path, uid, gid);
+       lchown(adbl_path, uid, gid);
 
 exit_lchown:   
        talloc_destroy(ctx);
 
 exit_lchown:   
        talloc_destroy(ctx);