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

Dave Dykstra dwd at bell-labs.com
Thu Aug 1 15:01:02 EST 2002


On Thu, Aug 01, 2002 at 02:08:36PM -0700, Wayne Davison wrote:
> 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))


Ok, I put that in.  I now tested it on Linux and unfortunately it doesn't
properly look up the names unless I configure --disable-ipv6.  I'm out of
time for today, however, I'll try to look at it tomorrow morning (unless
somebody else figures it out in the meantime).  Perhaps it needs to 
distinguish between whether or not the IP address is actually an IPv6
address, which I presume is the difference between having 3 dots in the
string or more.



> 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.


I tried it; it doesn't work on Solaris.

- Dave




More information about the rsync mailing list