mirror of
https://github.com/samba-team/samba.git
synced 2025-07-31 20:22:15 +03:00
Move sys_lchown() to libreplace.
This commit is contained in:
@ -47,6 +47,7 @@ mkstemp (a secure one!)
|
||||
pread
|
||||
pwrite
|
||||
chown
|
||||
lchown
|
||||
getpass
|
||||
readline (the library)
|
||||
inet_ntoa
|
||||
|
@ -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(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>])
|
||||
|
@ -650,3 +650,11 @@ int rep_symlink(const char *oldpath, const char *newpath)
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_LCHOWN
|
||||
int rep_lchown(const char *fname,uid_t uid,gid_t gid)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
@ -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
|
||||
|
||||
#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
|
||||
|
@ -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);
|
||||
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);
|
||||
|
@ -580,25 +580,6 @@ char *sys_getwd(char *s)
|
||||
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
|
||||
********************************************************************/
|
||||
|
@ -621,7 +621,7 @@ static int vfswrap_lchown(vfs_handle_struct *handle, const char *path, uid_t uid
|
||||
int result;
|
||||
|
||||
START_PROFILE(syscall_lchown);
|
||||
result = sys_lchown(path, uid, gid);
|
||||
result = lchown(path, uid, gid);
|
||||
END_PROFILE(syscall_lchown);
|
||||
return result;
|
||||
}
|
||||
|
@ -399,7 +399,7 @@ static int atalk_lchown(struct vfs_handle_struct *handle, const char *path, uid_
|
||||
goto exit_lchown;
|
||||
}
|
||||
|
||||
sys_lchown(adbl_path, uid, gid);
|
||||
lchown(adbl_path, uid, gid);
|
||||
|
||||
exit_lchown:
|
||||
talloc_destroy(ctx);
|
||||
|
Reference in New Issue
Block a user