From nobody  Sun Jun 15 12:36:50 1997
Received: (from nobody@localhost)
          by hub.freebsd.org (8.8.5/8.8.5) id MAA22342;
          Sun, 15 Jun 1997 12:36:50 -0700 (PDT)
Message-Id: <199706151936.MAA22342@hub.freebsd.org>
Date: Sun, 15 Jun 1997 12:36:50 -0700 (PDT)
From: roman@rpd.univ.kiev.ua
To: freebsd-gnats-submit@freebsd.org
Subject: Hang login session if using ttys.deny (or host.deny) capabilities in /etc/login.conf
X-Send-Pr-Version: www-1.0

>Number:         3878
>Category:       bin
>Synopsis:       Hang login session if using ttys.deny (or host.deny) capabilities in /etc/login.conf
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jun 15 12:40:01 PDT 1997
>Closed-Date:    Tue Jun 17 09:39:41 EST 1997
>Last-Modified:  Tue Jun 17 09:42:41 EST 1997
>Originator:     Roman D. Sinyuk
>Release:        2.2.2-RELEASE
>Organization:
Kiev University
>Environment:
FreeBSD boy.rpd.univ.kiev.ua 2.2.2-RELEASE FreeBSD 2.2.2-RELEASE #0: Wed Jun  4 20:01:23 EEST 1997     roman@boy.rpd.univ.kiev.ua:/usr/src/sys/compile/BOY  i386

>Description:
This problem is result infinite looping in one function libutil.
Other small problem is in man login.conf, in this manual instead ttys.deny,
ttys.allow refering to tty.deny, tty.allow.
>How-To-Repeat:
if /etc/login.conf contain ttys.deny for some userclass and if you 
trying login as user belong to userclass from other than ttys.deny
terminal, then login session is hang. For example:

$cat /etc/login.conf
userclass1:\
	 :ttys.deny=ttyd2:

cat /etc/master.passwd
user1:encrypt_passwd:1103:20:userclass1:0:0::/home/user1:/usr/local/bin/bash

If you try to login as user1 from ttyd1 - then login process is hang.
>Fix:
For fix this problem I made some change in function login_strinlist ()
from libutil. 

Original function:

int
login_strinlist(char **list, char const *str, int flags)
{
    int rc = 0;

    if (str != NULL && *str != '\0') {
        int     i = 0;

        while (rc == 0 && list[i] != NULL)
            rc = fnmatch(list[i], str, flags) == 0;
    }
    return rc;
} 

To fix problem replace this function on:
int
login_strinlist(char **list, char const *str, int flags)
{
    int rc = 0;

    if (str != NULL && *str != '\0') {
        int     i = 0;

        while (rc == 0 && list[i] != NULL)
            rc = fnmatch(list[i++], str, flags) == 0;
    }
    return rc;
}

After recompile libutil, login work fine.
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: davidn 
State-Changed-When: Tue Jun 17 09:39:41 EST 1997 
State-Changed-Why:  
Fix applied: 
/home/ncvs/src/lib/libutil/login_ok.c,v  <--  login_ok.c  
new revision: 1.5; previous revision: 1.4                 
/home/ncvs/src/lib/libutil/login_ok.c,v  <--  login_ok.c 
new revision: 1.4.2.1; previous revision: 1.4            
>Unformatted:
