This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: 1.3.12-2: weird problem with /etc/passwd and sshd


Corinna Vinschen <corinna-cygwin@cygwin.com> writes:

> On Thu, Jul 25, 2002 at 08:00:46PM -0400, Len Giambrone wrote:
> > 
> > More info:
> > 
> > The problem doesn't exist in 1.3.10-1
> > The problem does exist in 1.3.11-3
> > The problem does exist in cygwin1-20020725
> 
> It would be interesting to learn what your actual problem is...
> 
> Corinna

Corinna, this was in regard to the mail I sent earlier describing the problem.
Any insight you might have would be greatly appreciated. Did you see the
previous mail?  Here's the text of the mail repeated for convenience.  I also
submitted cygcheck -r -v -s as an attachment; let me know if you need that as
well.

                        -Len

----Begin forward---

Win2k Server, Service Pack 2.
OpenSSH 3.4p1-4.

I setup sshd running as a service:

$ cygrunsrv -I sshd -p /usr/sbin/sshd.exe -a "-D -e"

and everything is happy.

Now, I create a user "foobar"

$ net user foobar foo /add

And add it to /etc/passwd

$ mkpasswd -l | grep foobar >> /etc/passwd

Now when I try to ssh in the client tells me :

$ ssh root@172.24.8.41 -v
...
debug1: Entering interactive session.
debug3: Trying to reverse map address 172.24.8.23.
Connection to 172.24.8.41 closed.
debug1: Transferred: stdin 0, stdout 53, stderr 35 bytes in 4.5 seconds
debug1: Bytes per second: stdin 0.0, stdout 11.7, stderr 7.7
debug1: Exit status -1

And the Server tells me:
...
debug1: Entering interactive session.
debug1: fd 3 setting O_NONBLOCK
debug1: fd 5 setting O_NONBLOCK
debug1: fd 7 setting O_NONBLOCK
debug1: fd 8 setting O_NONBLOCK
debug1: server_init_dispatch_13
debug1: server_init_dispatch_15
debug1: Received SIGCHLD.
Read error from remote host: Cannot send after transport endpoint shutdown
debug1: Calling cleanup 0x415dc8(0x449ab4)
debug1: session_pty_cleanup: session 0 release /dev/tty2
debug1: Calling cleanup 0x41c9c4(0x0)

I've run sshd through gdb and found the child that sshd forks to handle the
session calls this code in uidswap.c

void
permanently_set_uid(struct passwd *pw)
{
        if (temporarily_use_uid_effective)
                fatal("permanently_set_uid: temporarily_use_uid effective");
        if (setgid(pw->pw_gid) < 0)
                fatal("setgid %u: %.100s", (u_int)pw->pw_gid, strerror(errno));
        if (setuid(pw->pw_uid) < 0)
                fatal("setuid %u: %.100s", (u_int)pw->pw_uid, strerror(errno));
}

For some strange reason, The setuid call is failing.

If I now remove "foobar" from /etc/passwd, everything works again.

I have not been able to reproduce this by running the server from the command
line, only when it's running as a service.

Anyone have a clue as to what might be going on here?

                        -Len

----End forward---

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]