[SCM] The rsync repository. - branch master updated

Rsync CVS commit messages rsync-cvs at lists.samba.org
Sun Apr 17 22:57:40 UTC 2016


The branch, master has been updated
       via  9a12959 Support only splitting users/groups on commas. Fixes bug 11817.
       via  070c810 Tweak non-fatal output when man pages cannot be created.
      from  71ec460 Fix use of obsolete compile macro. Fixes bug 11813.

https://git.samba.org/?p=rsync.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 9a12959ab6017a859fe8cd90ae2043b62a85b306
Author: Wayne Davison <wayned at samba.org>
Date:   Sun Apr 17 15:53:11 2016 -0700

    Support only splitting users/groups on commas.
    Fixes bug 11817.

commit 070c810e2da9fff8adf906e0e7c0f3aa0967a1fa
Author: Wayne Davison <wayned at samba.org>
Date:   Sun Apr 17 11:43:46 2016 -0700

    Tweak non-fatal output when man pages cannot be created.

-----------------------------------------------------------------------

Summary of changes:
 Makefile.in    |  4 ++--
 clientserver.c |  4 ++--
 rsyncd.conf.yo | 19 +++++++++++++------
 util.c         | 35 +++++++++++++++++++++++++++++++++++
 4 files changed, 52 insertions(+), 10 deletions(-)


Changeset truncated at 500 lines:

diff --git a/Makefile.in b/Makefile.in
index 151247d..5656688 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -215,8 +215,8 @@ proto.h-tstamp: $(srcdir)/*.c $(srcdir)/lib/compat.c config.h
 man: rsync.1 rsyncd.conf.5 man-copy
 
 man-copy:
-	@-if test -f rsync.1; then :; else echo 'Copying srcdir rsync.1'; cp -p $(srcdir)/rsync.1 .; fi
-	@-if test -f rsyncd.conf.5; then :; else echo 'Copying srcdir rsyncd.conf.5'; cp -p $(srcdir)/rsyncd.conf.5 .; fi
+	@if test -f rsync.1; then :; elif test -f $(srcdir)/rsync.1; then echo 'Copying srcdir rsync.1'; cp -p $(srcdir)/rsync.1 .; else echo "NOTE: rsync.1 cannot be created."; fi
+	@if test -f rsyncd.conf.5; then :; elif test -f $(srcdir)/rsyncd.conf.5; then echo 'Copying srcdir rsyncd.conf.5'; cp -p $(srcdir)/rsyncd.conf.5 .; else echo "NOTE: rsyncd.conf.5 cannot be created."; fi
 
 rsync.1: rsync.yo
 	yodl2man -o rsync.1 $(srcdir)/rsync.yo
diff --git a/clientserver.c b/clientserver.c
index 27f8cd3..91aee27 100644
--- a/clientserver.c
+++ b/clientserver.c
@@ -592,7 +592,7 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
 	} else
 		set_uid = 0;
 
-	p = *lp_gid(i) ? strtok(lp_gid(i), ", ") : NULL;
+	p = *lp_gid(i) ? conf_strtok(lp_gid(i)) : NULL;
 	if (p) {
 		/* The "*" gid must be the first item in the list. */
 		if (strcmp(p, "*") == 0) {
@@ -609,7 +609,7 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
 #endif
 		} else if (add_a_group(f_out, p) < 0)
 			return -1;
-		while ((p = strtok(NULL, ", ")) != NULL) {
+		while ((p = conf_strtok(NULL)) != NULL) {
 #if defined HAVE_INITGROUPS && !defined HAVE_GETGROUPLIST
 			if (pw) {
 				rprintf(FLOG, "This rsync cannot add groups after \"*\".\n");
diff --git a/rsyncd.conf.yo b/rsyncd.conf.yo
index 5c78b0a..1813354 100644
--- a/rsyncd.conf.yo
+++ b/rsyncd.conf.yo
@@ -492,6 +492,13 @@ group "guest").  Any other user who is in group "rsync" will get read-only
 access.  Finally, users susan, joe, and sam get the ro/rw setting of the
 module, but only if the user didn't match an earlier group-matching rule.
 
+If you need to specify a user or group name with a space in it, start your list
+with a comma to indicate that the list should only be split on commas (though
+leading and trailing whitespace will also be removed, and empty entries are
+just ignored).  For example:
+
+verb(  auth users = , joe:deny, @Some Group:deny, admin:rw, @RO Group:ro )
+
 See the description of the secrets file for how you can have per-user passwords
 as well as per-group passwords.  It also explains how a user can authenticate
 using their user password or (when applicable) a group password, depending on
@@ -534,9 +541,9 @@ than the one that the rsync daemon is running under.  If "strict modes" is
 false, the check is not performed.  The default is true.  This parameter
 was added to accommodate rsync running on the Windows operating system.
 
-dit(bf(hosts allow)) This parameter allows you to specify a
-list of patterns that are matched against a connecting clients
-hostname and IP address. If none of the patterns match then the
+dit(bf(hosts allow)) This parameter allows you to specify a list of comma-
+and/or whitespace-separated patterns that are matched against a connecting
+client's hostname and IP address.  If none of the patterns match, then the
 connection is rejected.
 
 Each pattern can be in one of five forms:
@@ -580,9 +587,9 @@ connect.
 
 The default is no "hosts allow" parameter, which means all hosts can connect.
 
-dit(bf(hosts deny)) This parameter allows you to specify a
-list of patterns that are matched against a connecting clients
-hostname and IP address. If the pattern matches then the connection is
+dit(bf(hosts deny)) This parameter allows you to specify a list of comma-
+and/or whitespace-separated patterns that are matched against a connecting
+clients hostname and IP address. If the pattern matches then the connection is
 rejected. See the "hosts allow" parameter for more information.
 
 The default is no "hosts deny" parameter, which means all hosts can connect.
diff --git a/util.c b/util.c
index 2a3e5ba..ca38f3e 100644
--- a/util.c
+++ b/util.c
@@ -800,6 +800,41 @@ void strlower(char *s)
 	}
 }
 
+/**
+ * Split a string into tokens based (usually) on whitespace & commas.  If the
+ * string starts with a comma (after skipping any leading whitespace), then
+ * splitting is done only on commas. No empty tokens are ever returned. */
+char *conf_strtok(char *str)
+{
+	static int commas_only = 0;
+
+	if (str) {
+		while (isSpace(str)) str++;
+		if (*str == ',') {
+			commas_only = 1;
+			str++;
+		} else
+			commas_only = 0;
+	}
+
+	while (commas_only) {
+		char *end, *tok = strtok(str, ",");
+		if (!tok)
+			return NULL;
+		/* Trim just leading and trailing whitespace. */
+		while (isSpace(tok))
+			tok++;
+		end = tok + strlen(tok);
+		while (end > tok && isSpace(end-1))
+			*--end = '\0';
+		if (*tok)
+			return tok;
+		str = NULL;
+	}
+
+	return strtok(str, " ,\t\r\n");
+}
+
 /* Join strings p1 & p2 into "dest" with a guaranteed '/' between them.  (If
  * p1 ends with a '/', no extra '/' is inserted.)  Returns the length of both
  * strings + 1 (if '/' was inserted), regardless of whether the null-terminated


-- 
The rsync repository.



More information about the rsync-cvs mailing list