OpenSSH 3.4p1 on SourceMage client ssh fails

Carson Gaspar carson at taltos.org
Mon Jul 29 04:41:16 EST 2002


--On Sunday, July 28, 2002 9:47 PM +0800 Damien Mascord <tusker at tusker.org> 
wrote:

> non world writeable /dev/tty* was the issue...
>
> Thanks for the apt answer... any reason why this wasn't picked up on the
> debug or verbose??

OpenSSH suffers from being "differently instrumented", in politically 
correct terms. Library / system call failures are only logged if someone 
thought it was useful to log the error for some reason. Looking at the code:

sshconnect.c:confirm() calls readpass.c:read_passphrase() with the flags 
set to RP_ECHO. And there's the problem. The following code (from 
read_passphrase) hides the error by returning a zero-length string:

        if (readpassphrase(prompt, buf, sizeof buf, rppflags) == NULL) {
                if (flags & RP_ALLOW_EOF)
                        return NULL;
                return xstrdup("");
        }

If you want to fix it so an error is usefully logged, you should change 
confirm() from:

        for (msg = prompt;;msg = again) {
                p = read_passphrase(msg, RP_ECHO);
                if (p == NULL ||
                    (p[0] == '\0') || (p[0] == '\n') ||
                    strncasecmp(p, "no", 2) == 0)
                        ret = 0;

to something more like

        for (msg = prompt;;msg = again) {
                p = read_passphrase(msg, RP_ECHO | RP_ALLOW_EOF);
		    if (p == NULL) {
		        if (errno == ENOTTY) {
				/* Do something here */
			  }
			  /* Do something else here */
			  return 0; /* You must do this! Or bad things happen when you fall 
through! /*
		    }
                if ((p[0] == '\0') || (p[0] == '\n') ||
                    strncasecmp(p, "no", 2) == 0)
                        ret = 0;


And, completly irrelavant to your issue:

- sshpty.c has code inside an #ifdef _CRAY block that uses "/dev/tty", not 
_PATH_TTY

-- 
Carson




More information about the openssh-unix-dev mailing list