bin/75001: hushlogin and nocheckmail attributes don't work from user's '.login_conf'

Rostislav Krasny rosti_bsd at yahoo.com
Sun Dec 12 15:40:31 PST 2004


>Number:         75001
>Category:       bin
>Synopsis:       hushlogin and nocheckmail attributes don't work from user's '.login_conf'
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Dec 12 23:40:28 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Rostislav Krasny
>Release:        5.3-RELEASE
>Organization:
>Environment:
FreeBSD saturn 5.3-RELEASE-p2 FreeBSD 5.3-RELEASE-p2 #1: Fri Dec  3 13:57:01 IST 2004     root at saturn:/usr/obj/usr/src/sys/MYKERNEL  i386
>Description:
hushlogin and nocheckmail attributes don't work from user's '.login_conf' because they are not checked there. My patch of login(1) allows these attributes to work from the user's '.login_conf' as well as from the '/etc/login.conf'.
>How-To-Repeat:
Try each of following versions of your ~/.login_conf file:

####### first version #######
me:\
        :hushlogin:
####### first version #######

####### second version #######
me:\
        :nocheckmail:
####### second version #######

And then relogin.
>Fix:
--- /usr/src/usr.bin/login/login.c      Mon Jan 26 22:04:47 2004
+++ login.c     Mon Dec 13 00:16:14 2004
@@ -171,6 +171,7 @@
        const char *tp;
        const char *shell = NULL;
        login_cap_t *lc = NULL;
+       login_cap_t *lc_user = NULL;
        pid_t pid;

        (void)signal(SIGQUIT, SIG_IGN);
@@ -354,8 +355,10 @@
         * Establish the login class.
         */
        lc = login_getpwclass(pwd);
+       lc_user = login_getuserclass(pwd);

-       quietlog = login_getcapbool(lc, "hushlogin", 0);
+       if (!(quietlog = login_getcapbool(lc_user, "hushlogin", 0)))
+               quietlog = login_getcapbool(lc, "hushlogin", 0);

        /*
         * Switching needed for NFS with root access disabled.
@@ -568,7 +571,8 @@
                else
                        motd(_PATH_MOTDFILE);

-               if (login_getcapbool(lc, "nocheckmail", 0) == 0) {
+               if (login_getcapbool(lc_user, "nocheckmail", 0) == 0 &&
+                   login_getcapbool(lc, "nocheckmail", 0) == 0) {
                        char *cx;

                        /* $MAIL may have been set by class. */

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list