This is the mail archive of the 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: New package: suite3270-3.2.20-1

On Sat, Nov 15, 2003 at 12:15:16PM -0800, Peter A. Castro wrote:
> On Sat, 1 Nov 2003, Corinna Vinschen wrote:
> > Btw., I tried a test of the binary c3270.exe.  From the man page I
> > got the impression, the emulator should be able to connect to any
> > telnet server.  I don't have a OS/390 machine handy so I used the
> > telnet server on Cygwin to connect to.  But it fails.  It connects
> > and it shows a login prompt.  Then the password is requested by login(1),
> > the same as running a standard telnet session.  But for some reason
> > I'm always getting a "Login incorrect" message.  When connecting with
> > a normal telnet client, I can login, so I don't quite understand how
> > this is supposed to work.  Any hint?
> This appears to be a CR/LF issue on the telnet server side of things.  A
> trace shows that on the client side, a Return sends only a CR (the
> default key code for a Return).  But, for whatever reason, the telnet
> daemon is sending a CR+LF to the login program's input stream, so it sees
> "userid^M" instead of "userid", which, obviously won't work.  Same goes
> for the password.

It doesn't seem to be a CRLF/LF translation problem.  First of all, the
inetutils utilities are linked against /usr/lib/textmode.o which results
in using textmode for all open descriptors, which haven't been explicitely
opened in binmode.  All pty related descriptors are not opened with
O_BINARY.  That means, telnet should filter out the CRs from all CRLFs.
For the sake of testing I changed telnetd to using all binary mode.
It didn't change anything.

Finally I added a debug output to login.exe, to look what arives at login.
The output is written using binmode explicitely, like this:

  FILE *fp = fopen ("/var/log/login.log", "ab");
  if (fp)
    fprintf (fp, "Logon attempt: <%s>, pwd <%s>\n", username, pp);
  fclose (fp);

The first line is what arrives at login when telnetting in using a telnet
client on Linux (please ignore the file offsets, I had to extract the info
from a file full of log):

  $ cat /var/log/login.log
  Logon attempt: <corinna>, pwd <mypasswd>
  $ od -c /var/log/login.log
  0000272   L   o   g   o   n       a   t   t   e   m   p   t   :       <
  0000312   c   o   r   i   n   n   a   >   ,       p   w   d       <   m
  0000332   y   p   a   s   s   w   d   >  \n

Next, the log from trying to login using telnetd as from the current
package (using textmode).  I tried three times, the first and second
using the "Enter" key, the third using Ctrl-J:

  $ cat /var/log/login.log
  Logon attempt: <corinna>, pwd <>
  Logon attempt: <>, pwd <>
  Logon attempt: <>, pwd <mypasswd>
  $ od -c /var/log/login.log
  0000135   L   o   g   o   n       a   t   t   e   m   p   t   :       <
  0000155   c   o   r   i   n   n   a   >   ,       p   w   d       <   >
  0000175  \n   L   o   g   o   n       a   t   t   e   m   p   t   :    
  0000215   <   >   ,       p   w   d       <   >  \n   L   o   g   o   n
  0000235       a   t   t   e   m   p   t   :       <   >   ,       p   w
  0000255   d       <   m   y   p   a   s   s   w   d   >  \n   

See what happens?  No CR or LF in the name and in the password but...
1. The user name is ok when getting it from the command line (the first
   call to login by telnetd is done like this: `login -f name'.
2. In the second an third attempt, the user name is read from stdin by
   login directly.  The username is never transmitted at all, regardless
   of using Enter or Ctrl-J.
3. The password is read from stdin by login in all three cases.  For some
   reason the password goes through correctly when using Ctrl-J but not
   when using Enter.

I also created a log with the telnetd which is using explicit binmode.
The log is *exactly* the same as with the above standard telnetd so I
don't repeat it here.  As you noted, when using Ctrl-J on the first
time I enter the username, it works.  But as soon as login takes over,
no chance anymore since the username never arrives at login. 
Unfortunately I don't see how that can be the fault of telnetd or login?!?


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                      
Red Hat, Inc.

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