diff -urN --exclude po --exclude Makefile --exclude .deps shadow-20000902/libmisc/log.c shadow-20000902.new/libmisc/log.c
--- shadow-20000902/libmisc/log.c	Thu Apr 16 19:57:44 1998
+++ shadow-20000902.new/libmisc/log.c	Sat Apr 13 02:00:34 2002
@@ -90,7 +90,7 @@
 
 	time(&newlog.ll_time);
 	strncpy(newlog.ll_line, line, sizeof newlog.ll_line);
-#if HAVE_LL_HOST
+#if defined(HAVE_LL_HOST)
 	strncpy(newlog.ll_host, host, sizeof newlog.ll_host);
 #endif
 	if (lseek(fd, offset, SEEK_SET) == offset)
diff -urN --exclude po --exclude Makefile --exclude .deps shadow-20000902/libmisc/login_desrpc.c shadow-20000902.new/libmisc/login_desrpc.c
--- shadow-20000902/libmisc/login_desrpc.c	Mon Jun  7 16:40:44 1999
+++ shadow-20000902.new/libmisc/login_desrpc.c	Sat Apr 13 02:11:43 2002
@@ -38,12 +38,14 @@
 #include <rpc/rpc.h>
 #include <rpc/key_prot.h>
 
+#if !defined (__FreeBSD__) && !defined (__NetBSD__) && !defined (__OpenBSD__)
 #if !(defined __GLIBC__ && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 0)))
 /* these don't seem to be in any header file (libc-5.4.33) */
 /* but will be in glibc 2.1 <rpc/auth.h> and <rpc/auth_des.h> */
 extern int getnetname(char *);
 extern int getsecretkey(const char *, char *, const char *);
 extern int key_setsecret(const char *);
+#endif
 #endif
 
 int
diff -urN --exclude po --exclude Makefile --exclude .deps shadow-20000902/libmisc/utmp.c shadow-20000902.new/libmisc/utmp.c
--- shadow-20000902/libmisc/utmp.c	Mon Jun  7 16:40:44 1999
+++ shadow-20000902.new/libmisc/utmp.c	Sat Apr 13 02:11:43 2002
@@ -54,7 +54,9 @@
 extern	void	endutent();
 extern	time_t	time();
 extern	char	*ttyname();
+#if !defined (__FreeBSD__) && !defined (__NetBSD__)
 extern	long	lseek();
+#endif
 
 #define	NO_UTENT \
 	"No utmp entry.  You must exec \"login\" from the lowest level \"sh\""
@@ -124,16 +126,18 @@
 checkutmp(int picky)
 {
 	char *line;
-	struct utmp *ut;
 #if HAVE_UTMPX_H
 	struct utmpx *utx;
+#else
+	struct utmp *ut;
 #endif
 	pid_t pid = getpid();
 
 #if HAVE_UTMPX_H
 	setutxent();
-#endif
+#else
 	setutent();
+#endif
 
 	if (picky) {
 #if HAVE_UTMPX_H
@@ -143,23 +147,24 @@
 
 		if (utx)
 			utxent = *utx;
-#endif
+#else
 		while ((ut = getutent()))
 			if (ut->ut_pid == pid)
 				break;
-
 		if (ut)
 			utent = *ut;
+#endif
 
 #if HAVE_UTMPX_H
 		endutxent();
-#endif
+#else
 		endutent();
 
 		if (!ut) {
  			puts(NO_UTENT);
 			exit(1);
 		}
+#endif
 #ifndef	UNIXPC
 
 		/*
@@ -169,7 +174,11 @@
 		 * and needs help ...
 		 */
 
+#if HAVE_UTMPX_H
+		if (utxent.ut_line[0] == '\0')
+#else
 		if (utent.ut_line[0] == '\0')
+#endif
 #endif	/* !UNIXPC */
 		{
 			if (!(line = ttyname(0))) {
@@ -178,9 +187,10 @@
 			}
 			if (strncmp(line, "/dev/", 5) == 0)
 				line += 5;
-			strncpy(utent.ut_line, line, sizeof utent.ut_line);
 #if HAVE_UTMPX_H
 			strncpy(utxent.ut_line, line, sizeof utxent.ut_line);
+#else
+			strncpy(utent.ut_line, line, sizeof utent.ut_line);
 #endif
 		}
 	} else {
@@ -191,6 +201,16 @@
 		if (strncmp(line, "/dev/", 5) == 0)
 			line += 5;
 
+#if HAVE_UTMPX_H
+		strncpy(utxent.ut_line, line, sizeof utxent.ut_line);
+		if ((utx = getutxline(&utxent)))
+			strncpy(utxent.ut_id, utx->ut_id, sizeof utxent.ut_id);
+
+		strcpy(utxent.ut_user, "LOGIN");
+		utxent.ut_pid = getpid();
+		utxent.ut_type = LOGIN_PROCESS;
+		gettimeofday((struct timeval *) &utxent.ut_tv, NULL);
+#else
  		strncpy (utent.ut_line, line, sizeof utent.ut_line);
 		if ((ut = getutline(&utent)))
  			strncpy(utent.ut_id, ut->ut_id, sizeof ut->ut_id);
@@ -199,16 +219,6 @@
 		utent.ut_pid = getpid();
 		utent.ut_type = LOGIN_PROCESS;
 		time(&utent.ut_time);
-#if HAVE_UTMPX_H
-		strncpy(utxent.ut_line, line, sizeof utxent.ut_line);
-		if ((utx = getutxline(&utxent)))
-			strncpy(utxent.ut_id, utx->ut_id, sizeof utxent.ut_id);
-
-		strcpy(utxent.ut_user, "LOGIN");
-		utxent.ut_pid = utent.ut_pid;
-		utxent.ut_type = utent.ut_type;
-		gettimeofday((struct timeval *) &utxent.ut_tv, NULL);
-		utent.ut_time = utxent.ut_tv.tv_sec;
 #endif
 	}
 }
@@ -302,7 +312,6 @@
 void
 setutmp(const char *name, const char *line, const char *host)
 {
-	struct	utmp	*utmp, utline;
 	struct	utmpx	*utmpx, utxline;
 	pid_t	pid = getpid ();
 	int	found_utmpx = 0, found_utmp = 0;
@@ -321,7 +330,6 @@
 	 */
 
 	setutxent ();
-	setutent ();
 
 	while (utmpx = getutxent ()) {
 		if (utmpx->ut_pid == pid) {
@@ -329,12 +337,6 @@
 			break;
 		}
 	}
-	while (utmp = getutent ()) {
-		if (utmp->ut_pid == pid) {
-			found_utmp = 1;
-			break;
-		}
-	}
 
 	/*
 	 * If the entry matching `pid' cannot be found, create a new
@@ -353,19 +355,6 @@
 			utxline.ut_line[sizeof utxline.ut_line - 5] = '\0';
 		}
 	}
-	if (! found_utmp) {
-		memset ((void *) &utline, 0, sizeof utline);
-		strncpy (utline.ut_line, utxline.ut_line,
-			sizeof utline.ut_line);
-		utline.ut_pid = utxline.ut_pid;
-	} else {
-		utline = *utmp;
-		if (strncmp (utline.ut_line, "/dev/", 5) == 0) {
-			memmove (utline.ut_line, utline.ut_line + 5,
-				sizeof utline.ut_line - 5);
-			utline.ut_line[sizeof utline.ut_line - 5] = '\0';
-		}
-	}
 
 	/*
 	 * Fill in the fields in the utmpx entry and write it out.  Do
@@ -374,23 +363,18 @@
 	 */
 
 	strncpy (utxline.ut_user, name, sizeof utxline.ut_user);
-	strncpy (utline.ut_user, name, sizeof utline.ut_user);
 
-	utline.ut_type = utxline.ut_type = USER_PROCESS;
+	utxline.ut_type = USER_PROCESS;
 
 	gettimeofday(&utxline.ut_tv, NULL);
-	utline.ut_time = utxline.ut_tv.tv_sec;
 
 	strncpy(utxline.ut_host, host ? host : "", sizeof utxline.ut_host);
 
 	pututxline (&utxline);
-	pututline (&utline);
 
 	updwtmpx(_WTMP_FILE "x", &utxline);
-	updwtmp(_WTMP_FILE, &utline);
 
 	utxent = utxline;
-	utent = utline;
 }
 
 #else /* !SVR4 */
diff -urN shadow-20000902/src/logoutd.c shadow-20000902-messy/src/logoutd.c
--- shadow-20000902/src/logoutd.c	Sat Apr 13 02:28:16 2002
+++ shadow-20000902-messy/src/logoutd.c	Fri Feb 15 16:28:30 2002
@@ -275,7 +275,7 @@
 			if ((tty_fd = open (tty_name, O_RDONLY|O_NDELAY)) == -1)
 				continue;
 
-			vhangup (tty_fd);
+	/*		vhangup (tty_fd); */
 			close (tty_fd);
 #endif  /* BSD || SUN || SUN4 */
 
--- shadow-20000902/src/Makefile.in	Sat Apr 13 03:15:41 2002
+++ shadow-20000902.new/src/Makefile.in	Sat Apr 13 03:17:32 2002
@@ -165,12 +165,12 @@
 shlibs = #../lib/libshadow.la
 # With glibc2, almost all programs need libcrypt for some reason,
 # even those that don't actually use crypt().
-LDADD = ${shlibs} ../libmisc/libmisc.a ../lib/libshadow.a @INTLLIBS@ @LIBCRYPT@ @LIBTCFS@ @LIBSKEY@ @LIBMD@
+LDADD = ${shlibs} ../libmisc/libmisc.a ../lib/libshadow.a @INTLLIBS@ @LIBCRYPT@ @LIBTCFS@ @LIBSKEY@ @LIBMD@ -lintl -lshadow -lutmp
 INCLUDES = -I${top_srcdir}/lib -I$(top_srcdir)/libmisc
 
 chfn_LDADD = ${LDADD} @LIBPAM@
 chsh_LDADD = ${LDADD} @LIBPAM@
-login_LDADD = ${LDADD} @LIBPAM@
+login_LDADD = ${LDADD} @LIBPAM@ -lrpcsvc
 passwd_LDADD = ${LDADD} @LIBCRACK@ @LIBPAM@
 su_LDADD = ${LDADD} @LIBPAM@
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
--- shadow-20000902/lib/commonio.c	Sat Apr 13 05:13:20 2002
+++ shadow-20000902.new/lib/commonio.c	Sat Apr 13 05:15:03 2002
@@ -629,6 +629,10 @@
 		goto fail;
 
 	nscd_need_reload = 1;
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+	if(spsync()==-1)
+		goto fail;
+#endif
 
 success:
 	free_linked_list(db);
