sshd 3.9p1 under Reliant Unix 5.45: getpeername: Operation not supported on transport endpoint

Robert Dahlem Robert.Dahlem at gmx.net
Tue Aug 31 05:29:03 EST 2004


On Sun, 29 Aug 2004 15:53:25 +1000, Darren Tucker wrote:

>>>It looks like your dup() is indeed broken. It should be too hard to 
>>>have a replacement function (or #define) to transparently cope with 
>>>this.

>> Host: mips-sni-sysv4

>> Would you accept a patch like
>> 	#define dup(fd) fcntl(fd, F_DUPFD, 0)
>> for this platform?

>I think that would be OK.  Does the attached patch work?

It's quite embarrassing but I have to confess that this doesn't work 
too. Looks like I did my "successful" test with -r.
Sorry for the confusion. :-(


Some further investigations and (kind of desparate) experiments: I 
cannot do neither getpeername() nor getsockname() on the dup()ed socket 
as long as sock_in gets a value of 3.

This (original code) doesn't work:
	sock_in = sock_out = dup(STDIN_FILENO); /* 3 */

This doesn't work too:
	sock_in = sock_out = dup(STDIN_FILENO);
	close(sock_in);
	sock_in = sock_out = dup(STDIN_FILENO); /* 3 */

This doesn't work too:
	sock_in = sock_out = fcntl(STDIN_FILENO, F_DUPFD, 0); /* 3 */

This works:
	sock_in = sock_out = fcntl(STDIN_FILENO, F_DUPFD, 4); /* 4 */

This works too:
	sock_in = sock_out = dup(STDIN_FILENO);
	sock_in = sock_out = dup(STDIN_FILENO); /* 4 */

This works too:
	sock_in = sock_out = dup(STDIN_FILENO);
	sock_in = sock_out = dup(sock_in); /* 4 */

To summarise: Reliant Unix 5.45 dislikes the situation when the result 
of dup() is 3. Perhaps someone here on the list has a helpful pointer 
what to research next.

Regards,
        Robert








More information about the openssh-unix-dev mailing list