daemon-server via SSH (was Re: new rsync release needed soon?)

Wayne Davison wayned at users.sourceforge.net
Thu Aug 1 14:13:01 EST 2002


On Thu, 1 Aug 2002, Dave Dykstra wrote:
> I think the way JD did it was the compromise we agreed on: if a userid
> is specified only with userid at hostname, it should be used for both
> purposes, but if the -e command includes -l it should override the
> login userid only.

OK, that makes sense.  I'm sorry I missed that.  I've committed the code
I had ommitted that implements this.

As for your SSH_CLIENT change, it doesn't compile on my Linux system
with INET6 defined (due to the IPv6 structures having different names).
I needed to make this patch to get it to compile:

Index: clientname.c
--- clientname.c	2002/08/01 19:17:00	1.9
+++ clientname.c	2002/08/01 21:05:53
@@ -112,8 +111,13 @@
 		socklen_t sin_len = sizeof sin;
 
 		memset(&sin, 0, sin_len);
+#ifdef INET6
+		sin.sin6_family = af;
+		inet_pton(af, client_addr(fd), &sin.sin6_addr.s6_addr);
+#else
 		sin.sin_family = af;
 		inet_pton(af, client_addr(fd), &sin.sin_addr.s_addr);
+#endif
 
 		if (!lookup_name(fd, (struct sockaddr_storage *)&sin, sin_len, 
 				name_buf, sizeof name_buf, port_buf, sizeof port_buf))

As for your question of how to know when to look at the SSH_CLIENT
environment variable, I wonder if the is_a_socket() call that was in
the original patch would be enough of a distinguishing factor.  Like
this:

Index: clientname.c
--- clientname.c	2002/08/01 19:17:00	1.9
+++ clientname.c	2002/08/01 21:05:53
@@ -51,8 +51,7 @@
 
 	initialised = 1;
 
-	ssh_client = getenv("SSH_CLIENT");
-	if (ssh_client != NULL) {
+	if (!is_a_socket(fd) && (ssh_client = getenv("SSH_CLIENT")) != NULL) {
 		strlcpy(addr_buf, ssh_client, sizeof(addr_buf));
 		/* truncate SSH_CLIENT to just IP address */
 		p = strchr(addr_buf, ' ');
@@ -100,7 +99,7 @@
 	strcpy(name_buf, default_name);
 	initialised = 1;
 
-	if (getenv("SSH_CLIENT") != NULL) {
+	if (!is_a_socket(fd) && getenv("SSH_CLIENT") != NULL) {
 		/* Look up name of IP address given in $SSH_CLIENT */
 #ifdef INET6
 		int af = AF_INET6;

I'll have to look at the code in more detail to know if this works or
not.

..wayne..





More information about the rsync mailing list