*BSD News Article 13406


Return to BSD News archive

Newsgroups: comp.os.386bsd.apps
Path: sserve!csadfa.cs.adfa.oz.au!wkt
From: wkt@csadfa.cs.adfa.oz.au (Warren Toomey)
Subject: Wuarchive's ftpd ported to 386bsd
Message-ID: <1993Mar26.045019.18983@sserve.cc.adfa.oz.au>
Sender: news@sserve.cc.adfa.oz.au
Organization: Australian Defence Force Academy, Canberra, Australia
Date: Fri, 26 Mar 1993 04:50:19 GMT

Here are the patches to get wuarchive's ftp daemon to work under 386bsd.
You can get the unpatched source off lots of ftp sites (including wuarchive),
under the names ftpd.wuarchive.tar.Z or ftpd.wuarchive.shar.Z

The patches are mainly to include stlib.h and not malloc.h. One large `bug'
is fixed: non-root ftp was impossible because the daemon couldn't open
up the data socket, even though it was setuid and seteuid root. It appears
that 386bsd keeps (e)uid information in the socket structures, and uses it
instead of the current (e)uid. I had to reorder a few lines to fix this.
Is this a 386bsd bug, or a bug in the ftpd, anyone?

	Warren Toomey	wkt@csadfa.cs.adfa.oz.au


#	Makefile.diff
#	access.c.diff
#	acl.c.diff
#	authenticate.c.diff
#	extensions.c.diff
#	extensions.h.diff
#	ftpcount.c.diff
#	ftpd.c.diff
#	private.c.diff
#	support/Makefile.diff
#	support/strcasestr.c.diff
#
echo x - Makefile.diff
sed 's/^X//' >Makefile.diff << 'END-of-Makefile.diff'
X*** Origsrc/Makefile	Sat Mar 20 15:20:08 1993
X--- Makefile	Sun Mar 21 20:40:03 1993
X***************
X*** 1,9 ****
X! CFLAGS=	-g -DSETPROCTITLE -DDEBUG
X  CC=cc
X  LIBC=	/lib/libc.a
X  
X! MISSINGOBJS=	getusershell.o fnmatch.o strcasestr.o strerror.o strsep.o \
X! 				getgrent.o authuser.o ftw.o
X  
X  SRCS=	ftpd.c ftpcmd.c glob.c logwtmp.c popen.c vers.c access.c extensions.c \
X  		realpath.c acl.c private.c authenticate.c
X--- 1,10 ----
X! CFLAGS=	-DSETPROCTITLE -DDEBUG -DJOLIX
X  CC=cc
X  LIBC=	/lib/libc.a
X  
X! #MISSINGOBJS=	getusershell.o fnmatch.o strcasestr.o strerror.o strsep.o \
X! #				getgrent.o authuser.o ftw.o
X! MISSINGOBJS=	strcasestr.o authuser.o ftw.o
X  
X  SRCS=	ftpd.c ftpcmd.c glob.c logwtmp.c popen.c vers.c access.c extensions.c \
X  		realpath.c acl.c private.c authenticate.c
X***************
X*** 11,18 ****
X  		realpath.o acl.o private.o authenticate.o ${MISSINGOBJS}
X  MAN=	ftpd.8
X  
X! BINDIR=		/usr/local/bin
X! ETCDIR=		/usr/local/etc
X  MANDIR=		/usr/man
X  MANEXT=		8
X  LINTFLAGS=	
X--- 12,19 ----
X  		realpath.o acl.o private.o authenticate.o ${MISSINGOBJS}
X  MAN=	ftpd.8
X  
X! BINDIR=		/local/bin
X! ETCDIR=		/local/etc
X  MANDIR=		/usr/man
X  MANEXT=		8
X  LINTFLAGS=	
END-of-Makefile.diff
echo x - access.c.diff
sed 's/^X//' >access.c.diff << 'END-of-access.c.diff'
X*** Origsrc/access.c	Sat Mar 20 15:20:09 1993
X--- access.c	Sun Mar 21 20:30:37 1993
X***************
X*** 1,6 ****
X--- 1,10 ----
X  #include <stdio.h>
X  #include <errno.h>
X+ #ifdef JOLIX
X+ #include <stdlib.h>
X+ #else
X  #include <malloc.h>
X+ #endif
X  #include <string.h>
X  #include <syslog.h>
X  #include <time.h>
END-of-access.c.diff
echo x - acl.c.diff
sed 's/^X//' >acl.c.diff << 'END-of-acl.c.diff'
X*** Origsrc/acl.c	Sat Mar 20 15:20:10 1993
X--- acl.c	Sun Mar 21 20:30:56 1993
X***************
X*** 1,6 ****
X--- 1,10 ----
X  #include <stdio.h>
X  #include <errno.h>
X+ #ifdef JOLIX
X+ #include <stdlib.h>
X+ #else
X  #include <malloc.h>
X+ #endif
X  #include <string.h>
X  #include <syslog.h>
X  #include <stdlib.h>
END-of-acl.c.diff
echo x - authenticate.c.diff
sed 's/^X//' >authenticate.c.diff << 'END-of-authenticate.c.diff'
X*** Origsrc/authenticate.c	Sat Mar 20 15:20:10 1993
X--- authenticate.c	Sun Mar 21 20:33:07 1993
X***************
X*** 1,6 ****
X--- 1,8 ----
X  #include "stdio.h"
X  #include "string.h"
X+ #ifndef JOLIX
X  #include "authuser.h"
X+ #endif
X  #include "authenticate.h"
X  
X  #define	AUTHNAMESIZE 100
END-of-authenticate.c.diff
echo x - extensions.c.diff
sed 's/^X//' >extensions.c.diff << 'END-of-extensions.c.diff'
X*** Origsrc/extensions.c	Sat Mar 20 15:20:12 1993
X--- extensions.c	Sun Mar 21 20:31:07 1993
X***************
X*** 1,6 ****
X--- 1,10 ----
X  #include <stdio.h>
X  #include <errno.h>
X+ #ifdef JOLIX
X+ #include <stdlib.h>
X+ #else
X  #include <malloc.h>
X+ #endif
X  #include <string.h>
X  #include <syslog.h>
X  #include <time.h>
END-of-extensions.c.diff
echo x - extensions.h.diff
sed 's/^X//' >extensions.h.diff << 'END-of-extensions.h.diff'
X*** Origsrc/extensions.h	Sat Mar 20 15:20:12 1993
X--- extensions.h	Sun Mar 21 20:32:17 1993
X***************
X*** 10,16 ****
X--- 10,18 ----
X  #define CWD     1
X  #define BANNER  2
X  
X+ #ifndef JOLIX
X  #define ALIGN(x)        ((x) + (sizeof(long) - (x) % sizeof(long)))
X+ #endif
X  
X  #define O_COMPRESS              (1 << 0)        /* file was compressed */
X  #define O_UNCOMPRESS            (1 << 1)        /* file was uncompressed */
END-of-extensions.h.diff
echo x - ftpcount.c.diff
sed 's/^X//' >ftpcount.c.diff << 'END-of-ftpcount.c.diff'
X*** Origsrc/ftpcount.c	Sat Mar 20 15:20:14 1993
X--- ftpcount.c	Sun Mar 21 20:31:19 1993
X***************
X*** 1,6 ****
X--- 1,10 ----
X  #include <stdio.h>
X  #include <errno.h>
X+ #ifdef JOLIX
X+ #include <stdlib.h>
X+ #else
X  #include <malloc.h>
X+ #endif
X  #include <string.h>
X  #include <syslog.h>
X  #include <time.h>
END-of-ftpcount.c.diff
echo x - ftpd.c.diff
sed 's/^X//' >ftpd.c.diff << 'END-of-ftpd.c.diff'
*** ftpd.c.orig	Tue Mar 23 09:46:19 1993
--- ftpd.c	Fri Mar 26 14:42:18 1993
***************
*** 53,58
  #include <pwd.h>
  #include <setjmp.h>
  #include <netdb.h>
  #include <malloc.h>
  #include <errno.h>
  #include <string.h>

--- 53,61 -----
  #include <pwd.h>
  #include <setjmp.h>
  #include <netdb.h>
+ #ifdef JOLIX
+ #include <stdlib.h>
+ #else
  #include <malloc.h>
  #endif
  #include <errno.h>
***************
*** 54,59
  #include <setjmp.h>
  #include <netdb.h>
  #include <malloc.h>
  #include <errno.h>
  #include <string.h>
  #include <syslog.h>

--- 57,63 -----
  #include <stdlib.h>
  #else
  #include <malloc.h>
+ #endif
  #include <errno.h>
  #include <string.h>
  #include <syslog.h>
***************
*** 944,949
  
  	if (data >= 0)
  		return (fdopen(data, mode));
  	s = socket(AF_INET, SOCK_STREAM, 0);
  	if (s < 0)
  		return (NULL);

--- 948,954 -----
  
  	if (data >= 0)
  		return (fdopen(data, mode));
+ 	(void) seteuid((uid_t)0);
  	s = socket(AF_INET, SOCK_STREAM, 0);
  	if (s < 0)
  		return (NULL);
***************
*** 947,953
  	s = socket(AF_INET, SOCK_STREAM, 0);
  	if (s < 0)
  		return (NULL);
- 	(void) seteuid((uid_t)0);
  	if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR,
  		(char *) &on, sizeof (on)) < 0)
  		goto bad;

--- 952,957 -----
  	s = socket(AF_INET, SOCK_STREAM, 0);
  	if (s < 0)
  		return (NULL);
  	if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR,
  		(char *) &on, sizeof (on)) < 0)
  		goto bad;
END-of-ftpd.c.diff
echo x - private.c.diff
sed 's/^X//' >private.c.diff << 'END-of-private.c.diff'
X*** Origsrc/private.c	Sat Mar 20 15:20:22 1993
X--- private.c	Sun Mar 21 20:31:48 1993
X***************
X*** 2,8 ****
X--- 2,12 ----
X  
X  #include <stdio.h>
X  #include <errno.h>
X+ #ifdef JOLIX
X+ #include <stdlib.h>
X+ #else
X  #include <malloc.h>
X+ #endif
X  #include <string.h>
X  #include <syslog.h>
X  #include <stdlib.h>
END-of-private.c.diff
echo x - support/Makefile.diff
sed 's/^X//' >support/Makefile.diff << 'END-of-support/Makefile.diff'
Xdiff -c Origsrc/support/Makefile support/Makefile
X*** Origsrc/support/Makefile	Sat Mar 20 15:20:27 1993
X--- support/Makefile	Sun Mar 21 20:41:05 1993
X***************
X*** 1,3 ****
X--- 1,5 ----
X+ CFLAGS= -DJOLIX
X+ 
X  all:
X  
X  clean:
END-of-support/Makefile.diff
echo x - support/strcasestr.c.diff
sed 's/^X//' >support/strcasestr.c.diff << 'END-of-support/strcasestr.c.diff'
Xdiff -c Origsrc/support/strcasestr.c support/strcasestr.c
X*** Origsrc/support/strcasestr.c	Sat Mar 20 15:20:28 1993
X--- support/strcasestr.c	Sun Mar 21 20:40:38 1993
X***************
X*** 29,34 ****
X--- 29,35 ----
X  /*
X   * Find the first occurrence of find in s.
X   */
X+ #ifndef JOLIX
X  char *
X  strstr(s, find)
X  	register char *s, *find;
X***************
X*** 48,53 ****
X--- 49,55 ----
X  	}
X  	return ((char *)s);
X  }
X+ #endif
X  
X  /*
X   * Find the first occurrence of find in s.
END-of-support/strcasestr.c.diff
exit

#! rnews 909 sserve.cc.adfa.oz.au
Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!olivea!uunet!psgrain!ee.und.ac.za!shrike.und.ac.za!usenet
From:  (Richard Stubbs)
Newsgroups: comp.os.386bsd.questions
Subject: SCSI boot disk
Summary: Scsi Boot disk
Message-ID: <1orvjj$118@shrike.und.ac.za>
Date: 25 Mar 93 09:56:03 GMT
Sender: Richard Stubbs
Reply-To: stubbs@ccen.unp.ac.za
Organization: Univ of Natal, Pmb, South Africa
Lines: 16
NNTP-Posting-Host: pc099.cc.unp.ac.za


This is probably an FAQ, but I cant seem to find the answer anywhere.

Where can I obtain a 386BSD bootdisk that has the precompiled scsi
drivers already existant on it. I have searched agate to no avail.

Do I have to bring it up with an ide and then compile the scsi
drivers?

Can someone please help me out here?

Many Thanks
Richard

Richard Stubbs              | Planet Earth is blue and
stubbs@ccen.unp.ac.za       | there is nothing I can do !