bin/84041: [PATCH] fix for wall(1) error message

Andre Albsmeier Andre.Albsmeier at siemens.com
Mon Jul 25 08:10:24 GMT 2005


>Number:         84041
>Category:       bin
>Synopsis:       [PATCH] fix for wall(1) error message
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jul 25 08:10:22 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Andre Albsmeier
>Release:        FreeBSD 5.4-STABLE i386
>Organization:
>Environment:

FreeBSD 5.4-STABLE #2: Tue Jul 12 13:55:14 CEST 2005
Xorg installed

>Description:

When a user is logged in via xdm, pam_lastlog updates
utmp with an entry where ut_line reads ":0". If wall(1)
is now used it emits an error message:

wall: /dev/:0: No such file or directory

>How-To-Repeat:

Login via xdm. su to root and do "echo bla | wall".

>Fix:

Let wall.c check the ut_line entry (as it is done in
ttystat() of usr.bin/w/w.c):

--- usr.bin/wall/wall.c.ORI	Sun Jul 24 08:20:41 2005
+++ usr.bin/wall/wall.c	Sun Jul 24 09:13:49 2005
@@ -138,8 +138,13 @@
 	iov.iov_len = mbufsize;
 	/* NOSTRICT */
 	while (fread((char *)&utmp, sizeof(utmp), 1, fp) == 1) {
+		static struct stat sb;
+		char ttybuf[MAXPATHLEN];
 		if (!utmp.ut_name[0])
 			continue;
+		snprintf(ttybuf, sizeof(ttybuf), "%s%.*s", _PATH_DEV, UT_LINESIZE, utmp.ut_line);
+		if (stat(ttybuf, &sb) != 0)
+			continue;		/* corrupted record */
 		if (grouplist) {
 			ingroup = 0;
 			strlcpy(username, utmp.ut_name, sizeof(utmp.ut_name));


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


More information about the freebsd-bugs mailing list