$NetBSD: patch-la,v 1.2 2000/10/19 02:02:58 hubertf Exp $

--- userfile.c.orig	Wed May 12 13:19:29 1999
+++ userfile.c
@@ -180,7 +180,7 @@
 #endif
 
 
-#if defined (__FreeBSD__) && defined(HAVE_LOGIN_CAP_H)
+#if (defined (__FreeBSD__) || defined(__NetBSD__)) && defined(HAVE_LOGIN_CAP_H)
 #include <login_cap.h>
 #endif
 
@@ -644,9 +644,13 @@
   /* Child.  We will start serving request. */
   if (uid != geteuid() || uid != getuid())
     {
-#if defined (__FreeBSD__) && defined(HAVE_LOGIN_CAP_H)
+#if (defined (__FreeBSD__) || defined(__NetBSD__)) && defined(HAVE_LOGIN_CAP_H) && defined(LOGIN_SETENV)
       struct passwd * pw = getpwuid(uid);
+#if defined(__NetBSD__)
+      login_cap_t * lc = login_getpwclass(pw);
+#else
       login_cap_t * lc = login_getuserclass(pw);
+#endif
       if (setusercontext(lc, pw, uid,
                          LOGIN_SETALL & ~(LOGIN_SETLOGIN | LOGIN_SETPATH |
                                           LOGIN_SETENV)) < 0)
