use alternate port with SFTP

Neil Cherry ncherry at linuxha.com
Thu Mar 25 21:00:57 EDT 2010


On 03/25/2010 07:23 PM, Max Barel wrote:
> Hi,
> I eventually managed to patch the sftpdriver.c file in order to use the specified port of .sitecopyrc
> Here are the diffs:
> 
> [max 00:14 sitecopy-0.16.6]$ diff src/sftpdriver.c*
> 87,89d86
> < 	int port = sess->site->server.port;
> < 	char buf_port[16];
> < 	sprintf(buf_port, "-oPort=%d", (port != NULL ? port : 22));
> 99,101c96,98
> <     execlp(sess->sftp_cmd, sess->sftp_cmd, buf_port, sess->buf, NULL);
> <     NE_DEBUG(DEBUG_SFTP, "sftp exec: %s %s %s: %s\n",
> <              sess->sftp_cmd, buf_port, sess->buf, strerror(errno));
> ---
>>     execlp(sess->sftp_cmd, sess->sftp_cmd, sess->buf, NULL);
>>     NE_DEBUG(DEBUG_SFTP, "sftp exec: %s %s: %s\n",
>>              sess->sftp_cmd, sess->buf, strerror(errno));
> 146d142
> < 	write(sess->fd_out, "\n", 1);
> 
> The last line diff is not related to the port option but was necessary or else the main process hang on reading the socket for the prompt.

I ran into that in the 0.14.x release. Nobody seemed interested in
the fix but I did post the information. I still patch it into
the existing code. Seems most often related to Red Hat distributions.

Thanks for the information. :-)

-- 
Linux Home Automation         Neil Cherry       ncherry at linuxha.com
http://www.linuxha.com/                         Main site
http://linuxha.blogspot.com/                    My HA Blog
Author of:    	Linux Smart Homes For Dummies



More information about the sitecopy mailing list