[SCM] The rsync repository. - branch master updated
Rsync CVS commit messages
rsync-cvs at lists.samba.org
Mon Jul 6 07:07:08 UTC 2020
The branch, master has been updated
via 59cb358f More TANDEM changes
from bb16db17 Send the uid/gid 0 name since not all systems use 0 for root.
https://git.samba.org/?p=rsync.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 59cb358fda0e5281bcd89f23cc24bc54bb517567
Author: Wayne Davison <wayne at opencoder.net>
Date: Mon Jul 6 00:00:36 2020 -0700
More TANDEM changes
- Handle a non-0 root uid.
- Handle alternate major/minor/MAKEDEV funcs.
- Other misc compatibility tweaks.
-----------------------------------------------------------------------
Summary of changes:
authenticate.c | 4 ++--
clientserver.c | 6 +++---
main.c | 4 ++--
popt/system.h | 4 ++++
rsync.h | 16 ++++++++++++++++
testsuite/chown.test | 13 +++++++------
testsuite/daemon.test | 8 ++++----
testsuite/devices.test | 13 +++++++------
testsuite/rsync.fns | 38 ++++++++++++++++++++++++++++++--------
9 files changed, 75 insertions(+), 31 deletions(-)
Changeset truncated at 500 lines:
diff --git a/authenticate.c b/authenticate.c
index 8fd6ff69..4306d167 100644
--- a/authenticate.c
+++ b/authenticate.c
@@ -119,7 +119,7 @@ static const char *check_secret(int module, const char *user, const char *group,
if ((st.st_mode & 06) != 0) {
rprintf(FLOG, "secrets file must not be other-accessible (see strict modes option)\n");
ok = 0;
- } else if (MY_UID() == 0 && st.st_uid != 0) {
+ } else if (MY_UID() == ROOT_UID && st.st_uid != ROOT_UID) {
rprintf(FLOG, "secrets file must be owned by root when running as root (see strict modes)\n");
ok = 0;
}
@@ -196,7 +196,7 @@ static const char *getpassf(const char *filename)
rprintf(FERROR, "ERROR: password file must not be other-accessible\n");
exit_cleanup(RERR_SYNTAX);
}
- if (MY_UID() == 0 && st.st_uid != 0) {
+ if (MY_UID() == ROOT_UID && st.st_uid != ROOT_UID) {
rprintf(FERROR, "ERROR: password file must be owned by root when running as root\n");
exit_cleanup(RERR_SYNTAX);
}
diff --git a/clientserver.c b/clientserver.c
index 831c3eab..372f9ab3 100644
--- a/clientserver.c
+++ b/clientserver.c
@@ -704,7 +704,7 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
logfile_format_has_o_or_i = 1;
uid = MY_UID();
- am_root = (uid == 0);
+ am_root = (uid == ROOT_UID);
p = *lp_uid(module_id) ? lp_uid(module_id) : am_root ? NOBODY_USER : NULL;
if (p) {
@@ -959,7 +959,7 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
}
our_uid = MY_UID();
- am_root = (our_uid == 0);
+ am_root = (our_uid == ROOT_UID);
}
if (lp_temp_dir(module_id) && *lp_temp_dir(module_id)) {
@@ -1213,7 +1213,7 @@ int start_daemon(int f_in, int f_out)
return -1;
}
our_uid = MY_UID();
- am_root = (our_uid == 0);
+ am_root = (our_uid == ROOT_UID);
}
addr = client_addr(f_in);
diff --git a/main.c b/main.c
index c832d575..ad30c86f 100644
--- a/main.c
+++ b/main.c
@@ -299,7 +299,7 @@ static void become_copy_as_user()
our_uid = MY_UID();
our_gid = MY_GID();
- am_root = (our_uid == 0);
+ am_root = (our_uid == ROOT_UID);
if (gname)
gname[-1] = ':';
@@ -1667,7 +1667,7 @@ int main(int argc,char *argv[])
starttime = time(NULL);
our_uid = MY_UID();
our_gid = MY_GID();
- am_root = our_uid == 0;
+ am_root = our_uid == ROOT_UID;
memset(&stats, 0, sizeof(stats));
diff --git a/popt/system.h b/popt/system.h
index 50cecaf5..25c22dae 100644
--- a/popt/system.h
+++ b/popt/system.h
@@ -11,6 +11,10 @@ extern __const __int32_t *__ctype_toupper;
/*@=declundef@*/
#endif
+#ifdef __TANDEM
+# include <floss.h(floss_execvp,floss_read)>
+#endif
+
#include <ctype.h>
#include <errno.h>
diff --git a/rsync.h b/rsync.h
index 5983c906..957f3d32 100644
--- a/rsync.h
+++ b/rsync.h
@@ -473,7 +473,23 @@ enum delret {
#ifdef MAKEDEV_TAKES_3_ARGS
#define MAKEDEV(devmajor,devminor) makedev(0,devmajor,devminor)
#else
+#ifndef __TANDEM
#define MAKEDEV(devmajor,devminor) makedev(devmajor,devminor)
+#else
+# include <sys/stat.h>
+# define major DEV_TO_MAJOR
+# define minor DEV_TO_MINOR
+# define MAKEDEV MAJORMINOR_TO_DEV
+#endif
+#endif
+
+#ifdef __TANDEM
+# include <floss.h(floss_read,floss_write,floss_fork,floss_execvp)>
+# include <floss.h(floss_getpwuid,floss_select,floss_seteuid)>
+# define S_IEXEC S_IXUSR
+# define ROOT_UID 65535
+#else
+# define ROOT_UID 0
#endif
#ifdef HAVE_COMPAT_H
diff --git a/testsuite/chown.test b/testsuite/chown.test
index aa4958d8..1464c65a 100644
--- a/testsuite/chown.test
+++ b/testsuite/chown.test
@@ -48,15 +48,16 @@ EOF
;;
*)
RSYNC="$RSYNC --super"
- case `get_testuid` in
- '') ;; # If "id" failed, try to continue...
- 0) ;;
- *) if [ -e "$FAKEROOT_PATH" ]; then
+ my_uid=`get_testuid`
+ root_uid=`get_rootuid`
+ if test x"$my_uid" = x; then
+ : # If "id" failed, try to continue...
+ elif test x"$my_uid" != x"$root_uid"; then
+ if [ -e "$FAKEROOT_PATH" ]; then
echo "Let's try re-running the script under fakeroot..."
exec "$FAKEROOT_PATH" "$SHELL_PATH" "$0"
fi
- ;;
- esac
+ fi
;;
esac
diff --git a/testsuite/daemon.test b/testsuite/daemon.test
index a736ee83..836ce33b 100644
--- a/testsuite/daemon.test
+++ b/testsuite/daemon.test
@@ -41,14 +41,14 @@ cd "$scratchdir"
ln -s test-rsyncd.conf rsyncd.conf
+my_uid=`get_testuid`
+root_uid=`get_rootuid`
confopt=''
-case `get_testuid` in
-0)
+if test x"$my_uid" = x"$root_uid"; then
# Root needs to specify the config file, or it uses /etc/rsyncd.conf.
echo "Forcing --config=$conf"
confopt=" --config=$conf"
- ;;
-esac
+fi
# These have a space-padded 15-char name, then a tab, then a comment.
sed 's/NOCOMMENT//' <<EOT >"$chkfile"
diff --git a/testsuite/devices.test b/testsuite/devices.test
index 0af0428b..908898c2 100644
--- a/testsuite/devices.test
+++ b/testsuite/devices.test
@@ -67,16 +67,17 @@ EOF
esac
;;
*)
- case `get_testuid` in
- '') ;; # If "id" failed, try to continue...
- 0) ;;
- *) if [ -e "$FAKEROOT_PATH" ]; then
+ my_uid=`get_testuid`
+ root_uid=`get_rootuid`
+ if test x"$my_uid" = x; then
+ : # If "id" failed, try to continue...
+ elif test x"$my_uid" != x"$root_uid"; then
+ if [ -e "$FAKEROOT_PATH" ]; then
echo "Let's try re-running the script under fakeroot..."
exec "$FAKEROOT_PATH" "$SHELL_PATH" $RUNSHFLAGS "$0"
fi
test_skipped "Rsync needs root/fakeroot for device tests"
- ;;
- esac
+ fi
;;
esac
diff --git a/testsuite/rsync.fns b/testsuite/rsync.fns
index 58701fd7..023a8e19 100644
--- a/testsuite/rsync.fns
+++ b/testsuite/rsync.fns
@@ -102,7 +102,27 @@ rsync_ls_lR() {
}
get_testuid() {
- id 2>/dev/null | sed 's/^[^0-9]*\([0-9][0-9]*\).*/\1/'
+ uid=`id -u 2>/dev/null`
+ case "$uid" in
+ [0-9]*) echo "$uid" ;;
+ *) id 2>/dev/null | sed 's/^[^0-9]*\([0-9][0-9]*\).*/\1/' ;;
+ esac
+}
+
+get_rootuid() {
+ uid=`id -u root 2>/dev/null`
+ case "$uid" in
+ [0-9]*) echo "$uid" ;;
+ *) echo 0 ;;
+ esac
+}
+
+get_rootgid() {
+ gid=`id -g root 2>/dev/null`
+ case "$gid" in
+ [0-9]*) echo "$gid" ;;
+ *) echo 0 ;;
+ esac
}
check_perms() {
@@ -278,16 +298,18 @@ build_rsyncd_conf() {
logfile="$scratchdir/rsyncd.log"
hostname=`uname -n`
- uid_setting='uid = 0'
- gid_setting='gid = 0'
- case `get_testuid` in
- 0) ;;
- *)
+ my_uid=`get_testuid`
+ root_uid=`get_rootuid`
+ root_gid=`get_rootgid`
+
+ uid_setting="uid = $root_uid"
+ gid_setting="gid = $root_gid"
+
+ if test x"$my_uid" != x"$root_uid"; then
# Non-root cannot specify uid & gid settings
uid_setting="#$uid_setting"
gid_setting="#$gid_setting"
- ;;
- esac
+ fi
cat >"$conf" <<EOF
# rsyncd configuration file autogenerated by $0
--
The rsync repository.
More information about the rsync-cvs
mailing list