From 161d70a57ae8a17dcbc9c426bfff33c8c51318b7 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 1 Nov 2008 03:27:45 +0100 Subject: Move sys_chown() to rep_chown(). --- lib/replace/README | 1 + lib/replace/libreplace.m4 | 2 +- lib/replace/replace.c | 13 +++++++++++++ lib/replace/replace.h | 5 +++++ 4 files changed, 20 insertions(+), 1 deletion(-) (limited to 'lib/replace') diff --git a/lib/replace/README b/lib/replace/README index 2f3b37340f..a63409580c 100644 --- a/lib/replace/README +++ b/lib/replace/README @@ -46,6 +46,7 @@ mkdtemp mkstemp (a secure one!) pread pwrite +chown getpass readline (the library) inet_ntoa diff --git a/lib/replace/libreplace.m4 b/lib/replace/libreplace.m4 index 6f1543863a..c802525eed 100644 --- a/lib/replace/libreplace.m4 +++ b/lib/replace/libreplace.m4 @@ -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) +AC_CHECK_FUNCS(isatty chown) AC_HAVE_DECL(setresuid, [#include ]) AC_HAVE_DECL(setresgid, [#include ]) AC_HAVE_DECL(errno, [#include ]) diff --git a/lib/replace/replace.c b/lib/replace/replace.c index 98d799b07e..74af75ebf1 100644 --- a/lib/replace/replace.c +++ b/lib/replace/replace.c @@ -2,6 +2,7 @@ Unix SMB/CIFS implementation. replacement routines for broken systems Copyright (C) Andrew Tridgell 1992-1998 + Copyright (C) Jelmer Vernooij 2005-2008 ** NOTE! The following LGPL license applies to the replace ** library. This does NOT imply that all of Samba is released @@ -614,3 +615,15 @@ int rep_utimes(const char *filename, const struct timeval tv[2]) return utime(filename, &u); } #endif + +#ifndef HAVE_CHOWN +/** +chown isn't used much but OS/2 doesn't have it +**/ +int rep_chown(const char *fname, uid_t uid, gid_t gid) +{ + errno = ENOSYS; + return -1; +} +#endif + diff --git a/lib/replace/replace.h b/lib/replace/replace.h index a8164b642b..2518d40a65 100644 --- a/lib/replace/replace.h +++ b/lib/replace/replace.h @@ -215,6 +215,11 @@ int rep_seteuid(uid_t); int rep_setegid(gid_t); #endif +#ifndef HAVE_CHOWN +#define chown rep_chown +int rep_chown(const char *path, uid_t uid, gid_t gid); +#endif + #ifndef HAVE_SETLINEBUF #define setlinebuf rep_setlinebuf void rep_setlinebuf(FILE *); -- cgit From bbbe6ab72284c78c095babd875070aaac8c477dd Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 1 Nov 2008 03:30:47 +0100 Subject: Move sys_link to libreplace. --- lib/replace/README | 1 + lib/replace/libreplace.m4 | 2 +- lib/replace/replace.c | 8 ++++++++ lib/replace/replace.h | 5 +++++ 4 files changed, 15 insertions(+), 1 deletion(-) (limited to 'lib/replace') diff --git a/lib/replace/README b/lib/replace/README index a63409580c..8dcc100625 100644 --- a/lib/replace/README +++ b/lib/replace/README @@ -65,6 +65,7 @@ getifaddrs freeifaddrs utime utimes +link Types: bool diff --git a/lib/replace/libreplace.m4 b/lib/replace/libreplace.m4 index c802525eed..b58575d33d 100644 --- a/lib/replace/libreplace.m4 +++ b/lib/replace/libreplace.m4 @@ -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) +AC_CHECK_FUNCS(isatty chown link) AC_HAVE_DECL(setresuid, [#include ]) AC_HAVE_DECL(setresgid, [#include ]) AC_HAVE_DECL(errno, [#include ]) diff --git a/lib/replace/replace.c b/lib/replace/replace.c index 74af75ebf1..adf7932107 100644 --- a/lib/replace/replace.c +++ b/lib/replace/replace.c @@ -627,3 +627,11 @@ int rep_chown(const char *fname, uid_t uid, gid_t gid) } #endif +#ifndef HAVE_LINK +int rep_link(const char *oldpath, const char *newpath) +{ + errno = ENOSYS; + return -1; +} +#endif + diff --git a/lib/replace/replace.h b/lib/replace/replace.h index 2518d40a65..7d8bbec18f 100644 --- a/lib/replace/replace.h +++ b/lib/replace/replace.h @@ -220,6 +220,11 @@ int rep_setegid(gid_t); int rep_chown(const char *path, uid_t uid, gid_t gid); #endif +#ifndef HAVE_LINK +#define link rep_link +int rep_link(const char *oldpath, const char *newpath); +#endif + #ifndef HAVE_SETLINEBUF #define setlinebuf rep_setlinebuf void rep_setlinebuf(FILE *); -- cgit From dbda9adfaf388f62cf359ea728ae303d81df81a9 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 1 Nov 2008 03:33:39 +0100 Subject: Move sys_readlink() to libreplace. --- lib/replace/README | 1 + lib/replace/libreplace.m4 | 2 +- lib/replace/replace.c | 7 +++++++ lib/replace/replace.h | 5 +++++ 4 files changed, 14 insertions(+), 1 deletion(-) (limited to 'lib/replace') diff --git a/lib/replace/README b/lib/replace/README index 8dcc100625..ed0b866e85 100644 --- a/lib/replace/README +++ b/lib/replace/README @@ -66,6 +66,7 @@ freeifaddrs utime utimes link +readlink Types: bool diff --git a/lib/replace/libreplace.m4 b/lib/replace/libreplace.m4 index b58575d33d..64df4ec575 100644 --- a/lib/replace/libreplace.m4 +++ b/lib/replace/libreplace.m4 @@ -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) +AC_CHECK_FUNCS(isatty chown link readlink) AC_HAVE_DECL(setresuid, [#include ]) AC_HAVE_DECL(setresgid, [#include ]) AC_HAVE_DECL(errno, [#include ]) diff --git a/lib/replace/replace.c b/lib/replace/replace.c index adf7932107..00a205d472 100644 --- a/lib/replace/replace.c +++ b/lib/replace/replace.c @@ -635,3 +635,10 @@ int rep_link(const char *oldpath, const char *newpath) } #endif +#ifndef HAVE_READLINK +int rep_readlink(const char *path, char *buf, size_t bufsiz) +{ + errno = ENOSYS; + return -1; +} +#endif diff --git a/lib/replace/replace.h b/lib/replace/replace.h index 7d8bbec18f..fe01a8613e 100644 --- a/lib/replace/replace.h +++ b/lib/replace/replace.h @@ -225,6 +225,11 @@ int rep_chown(const char *path, uid_t uid, gid_t gid); int rep_link(const char *oldpath, const char *newpath); #endif +#ifndef HAVE_READLINK +#define readlink rep_readlink +int rep_readlink(const char *path, char *buf, size_t bufsize); +#endif + #ifndef HAVE_SETLINEBUF #define setlinebuf rep_setlinebuf void rep_setlinebuf(FILE *); -- cgit From e8cda43e171c1aa8f4b858228e715290d400691c Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 1 Nov 2008 03:35:58 +0100 Subject: Move sys_symlink() to libreplace. --- lib/replace/README | 1 + lib/replace/libreplace.m4 | 2 +- lib/replace/replace.c | 8 ++++++++ lib/replace/replace.h | 6 ++++++ 4 files changed, 16 insertions(+), 1 deletion(-) (limited to 'lib/replace') diff --git a/lib/replace/README b/lib/replace/README index ed0b866e85..f189e8716f 100644 --- a/lib/replace/README +++ b/lib/replace/README @@ -67,6 +67,7 @@ utime utimes link readlink +symlink Types: bool diff --git a/lib/replace/libreplace.m4 b/lib/replace/libreplace.m4 index 64df4ec575..a93a9dad45 100644 --- a/lib/replace/libreplace.m4 +++ b/lib/replace/libreplace.m4 @@ -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) +AC_CHECK_FUNCS(isatty chown link readlink symlink) AC_HAVE_DECL(setresuid, [#include ]) AC_HAVE_DECL(setresgid, [#include ]) AC_HAVE_DECL(errno, [#include ]) diff --git a/lib/replace/replace.c b/lib/replace/replace.c index 00a205d472..37705b93cd 100644 --- a/lib/replace/replace.c +++ b/lib/replace/replace.c @@ -642,3 +642,11 @@ int rep_readlink(const char *path, char *buf, size_t bufsiz) return -1; } #endif + +#ifndef HAVE_SYMLINK +int rep_symlink(const char *oldpath, const char *newpath) +{ + errno = ENOSYS; + return -1; +} +#endif diff --git a/lib/replace/replace.h b/lib/replace/replace.h index fe01a8613e..f56c5b0dc9 100644 --- a/lib/replace/replace.h +++ b/lib/replace/replace.h @@ -230,6 +230,12 @@ int rep_link(const char *oldpath, const char *newpath); int rep_readlink(const char *path, char *buf, size_t bufsize); #endif +#ifndef HAVE_SYMLINK +#define symlink rep_symlink +int rep_symlink(const char *oldpath, const char *newpath); +#endif + + #ifndef HAVE_SETLINEBUF #define setlinebuf rep_setlinebuf void rep_setlinebuf(FILE *); -- cgit From 38d67363aca81b970717c58b07e04396ae9dfd9f Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 1 Nov 2008 03:39:20 +0100 Subject: Move sys_lchown() to libreplace. --- lib/replace/README | 1 + lib/replace/libreplace.m4 | 2 +- lib/replace/replace.c | 8 ++++++++ lib/replace/replace.h | 4 ++++ 4 files changed, 14 insertions(+), 1 deletion(-) (limited to 'lib/replace') diff --git a/lib/replace/README b/lib/replace/README index f189e8716f..1005281a6b 100644 --- a/lib/replace/README +++ b/lib/replace/README @@ -47,6 +47,7 @@ mkstemp (a secure one!) pread pwrite chown +lchown getpass readline (the library) inet_ntoa diff --git a/lib/replace/libreplace.m4 b/lib/replace/libreplace.m4 index a93a9dad45..cc9be162ac 100644 --- a/lib/replace/libreplace.m4 +++ b/lib/replace/libreplace.m4 @@ -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 ]) AC_HAVE_DECL(setresgid, [#include ]) AC_HAVE_DECL(errno, [#include ]) diff --git a/lib/replace/replace.c b/lib/replace/replace.c index 37705b93cd..f4faef992a 100644 --- a/lib/replace/replace.c +++ b/lib/replace/replace.c @@ -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 diff --git a/lib/replace/replace.h b/lib/replace/replace.h index f56c5b0dc9..b81bf5c576 100644 --- a/lib/replace/replace.h +++ b/lib/replace/replace.h @@ -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 -- cgit From a6d537bb6cec25eb27cf8884ca5e3362a86818b3 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 1 Nov 2008 03:42:27 +0100 Subject: Move sys_realpath() to libreplace. --- lib/replace/README | 1 + lib/replace/libreplace.m4 | 2 +- lib/replace/replace.c | 11 +++++++++++ lib/replace/replace.h | 5 +++++ 4 files changed, 18 insertions(+), 1 deletion(-) (limited to 'lib/replace') diff --git a/lib/replace/README b/lib/replace/README index 1005281a6b..c1cb2d0270 100644 --- a/lib/replace/README +++ b/lib/replace/README @@ -69,6 +69,7 @@ utimes link readlink symlink +realpath Types: bool diff --git a/lib/replace/libreplace.m4 b/lib/replace/libreplace.m4 index cc9be162ac..c67fa66f5c 100644 --- a/lib/replace/libreplace.m4 +++ b/lib/replace/libreplace.m4 @@ -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 lchown link readlink symlink) +AC_CHECK_FUNCS(isatty chown lchown link readlink symlink realpath) AC_HAVE_DECL(setresuid, [#include ]) AC_HAVE_DECL(setresgid, [#include ]) AC_HAVE_DECL(errno, [#include ]) diff --git a/lib/replace/replace.c b/lib/replace/replace.c index f4faef992a..d757a0154e 100644 --- a/lib/replace/replace.c +++ b/lib/replace/replace.c @@ -658,3 +658,14 @@ int rep_lchown(const char *fname,uid_t uid,gid_t gid) return -1; } #endif + +#ifndef HAVE_REALPATH +char *rep_realpath(const char *path, char *resolved_path) +{ + /* As realpath is not a system call we can't return ENOSYS. */ + errno = EINVAL; + return NULL; +} +#endif + + diff --git a/lib/replace/replace.h b/lib/replace/replace.h index b81bf5c576..8d0dd57064 100644 --- a/lib/replace/replace.h +++ b/lib/replace/replace.h @@ -235,6 +235,11 @@ int rep_readlink(const char *path, char *buf, size_t bufsize); int rep_symlink(const char *oldpath, const char *newpath); #endif +#ifndef HAVE_REALPATH +#define realpath rep_realpath +char *rep_realpath(const char *path, char *resolved_path); +#endif + #ifndef HAVE_LCHOWN #define lchown rep_lchown int rep_lchown(const char *fname,uid_t uid,gid_t gid); -- cgit From 6a2caa34b24c2225dba9da011eaa5cc3eb8752be Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 1 Nov 2008 03:46:09 +0100 Subject: Remove sys_chroot() - libreplace already provides an alternative. --- lib/replace/replace.c | 2 -- lib/replace/replace.h | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'lib/replace') diff --git a/lib/replace/replace.c b/lib/replace/replace.c index d757a0154e..0683f556eb 100644 --- a/lib/replace/replace.c +++ b/lib/replace/replace.c @@ -667,5 +667,3 @@ char *rep_realpath(const char *path, char *resolved_path) return NULL; } #endif - - diff --git a/lib/replace/replace.h b/lib/replace/replace.h index 8d0dd57064..d717d6391c 100644 --- a/lib/replace/replace.h +++ b/lib/replace/replace.h @@ -220,6 +220,11 @@ int rep_setegid(gid_t); int rep_chown(const char *path, uid_t uid, gid_t gid); #endif +#ifndef HAVE_CHROOT +#define chroot rep_chroot +int rep_chroot(const char *dirname); +#endif + #ifndef HAVE_LINK #define link rep_link int rep_link(const char *oldpath, const char *newpath); -- cgit