Subject: wu-ftpd 2.4.2 Beta 11 and S/Key seg vees

From: Greg Owen {gowen} <[email-masked]>
Date: Fri, 3 May 1996 11:45:59 PDT

Hello,

	I'm trying to compile wu-ftpd 2.4.2b11 with S/Key support and 
I've been unable to get a working version.  AltaVista had only this 
list as something to do with wu-ftpd and skey, and I was unable to find
any archive of it on the listserver, so I'm going to barge right in and
ask away.  Please forgive me if this has been covered before.  I'm using
gcc-2.7.2 under Solaris 2.5, for what its worth.

	My questions in summary are as follows:
	1) Is anyone successfully using beta 11 with skey?
	2) If so, where did you get your skey from?
	3) Are the issues with skey that aren't particularly discussed
in the files of the beta 11 distribution?

	Now, in detail, is the story of the difficulties I'm having.

	I'm using the wu-ftpd beta 11 from ftp.academ.com, and I'm 
using the S/Key from Wietse Venema's logdaemon-5.1 package.  The first
problems I hit are in the compile stage, with src/ftpd.c.  It includes
skey.h twice, as such:

First, around line 238:
#ifdef SKEY                     /* H* add-on.  Not as elegant as Wietse's */
#include "skey.h"               /* logdaemon package, but does the job.   */
struct skey skey_blk;
char chbuff[80];
#endif

Secondly, around line 331:
#ifdef SKEY
#include <skey.h>
int     pwok = 0;
#endif

This second include won't work with the include file copied to src 
(as the instructions in FIXES-2.4-HOBBIT say to do); if you add -L.
to LFLAGS in the src/Makefile, then you have multiple definitions,
so I just commented out the second #include.

	After this was done, it would compile, but would die with
a segmentation violation right after the user entered the password.
Using gdb, I found the problem was the following line, around line
1300 of ftpd.c, in function pass:

        strcpy (xpasswd, "wrongo:spazmoid");  /* disable regular passwds */

	Now, xpasswd starts out as a char *, and is being pointed to the
string ":" by an earlier line:

        xpasswd = skey_crypt(passwd, salt, pw, pwok);
		/* In my execution, skey_crypt is doing 'return ":";' */

	So, it seems to me, ftpd.c shouldn't be trying to strcpy to 
a pointer which points a string literal; under gcc at least, it causes
a segmentation fault.  Also, even if the memory for ":" was malloc'ed,
":" would be too small to hold "wrongo:spazmoid", and it would overwrite
array bounds with undefined results.

	So, by hook or by crook, skey support seems somewhat damned here.
I played with things by replacing the strycpy lines with an equivalent
strdup, and then stepped through, and I'm still not authenticating -- 
the two passwords are very clearly not matching, so I'm getting "login
incorrect," but that's a problem for another day.

	In what may be a related tidbit, the FIXES-2.4.2-BETA-2 
files says the following:
> See FIXES-2.4-HOBBIT for details. Note that there is now SKEY support
> in this release and server that ONLY work for ANONYMOUS ftp can now be
> built. Check the config.h file in the root directory for information
> on this.
	I'm not really sure how to parse the second sentence -- is it
saying s/key support is only for anonymous users?  And if so, does this
still hold at beta 11?

	In general, I'm confused, and would appreciate any help I can
get.

	Thanks in advance,
	gowen -- Greg Owen -- [email-masked]