Index: login_class.c
===================================================================
RCS file: /spare/freebsd/ncvs/src/lib/libutil/login_class.c,v
retrieving revision 1.19
diff -u -r1.19 login_class.c
--- login_class.c	28 Jun 2002 14:45:30 -0000	1.19
+++ login_class.c	22 Oct 2002 16:38:16 -0000
@@ -40,6 +40,7 @@
 #include <login_cap.h>
 #include <paths.h>
 #include <sys/rtprio.h>
+#include <sys/mac.h>
 
 
 static struct login_res {
@@ -317,6 +318,7 @@
 #ifndef __NETBSD_SYSCALLS
     struct rtprio rtp;
 #endif
+    int error;
 
     if (lc == NULL) {
 	if (pwd != NULL && (lc = login_getpwclass(pwd)) != NULL)
@@ -371,6 +373,31 @@
 		   (u_long)pwd->pw_gid);
 	    login_close(llc);
 	    return -1;
+	}
+    }
+
+    /* Set up the user's MAC label. */
+    if ((flags & LOGIN_SETMAC) && mac_is_present(NULL) == 1) {
+	const char *label_string;
+	mac_t label;
+
+	label_string = login_getcapstr(lc, "label", NULL, NULL);
+	if (label_string != NULL) {
+	    if (mac_from_text(&label, label_string) == -1) {
+		syslog(LOG_ERR, "mac_from_text('%s') for %s: %m",
+		    pwd->pw_name, label_string);
+		    return -1;
+	    }
+	    if (mac_set_proc(label) == -1)
+		error = errno;
+	    else
+		error = 0;
+	    mac_free(label);
+	    if (error != 0) {
+		syslog(LOG_ERR, "mac_set_proc('%s') for %s: %s",
+		    label_string, pwd->pw_name, strerror(error));
+		return -1;
+	    }
 	}
     }
 
