From nobody@FreeBSD.org  Tue Jan 26 02:16:40 2010
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BA798106568B
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 26 Jan 2010 02:16:40 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 9E68D8FC2D
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 26 Jan 2010 02:16:40 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o0Q2GeYU082660
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 26 Jan 2010 02:16:40 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id o0Q2GeEh082659;
	Tue, 26 Jan 2010 02:16:40 GMT
	(envelope-from nobody)
Message-Id: <201001260216.o0Q2GeEh082659@www.freebsd.org>
Date: Tue, 26 Jan 2010 02:16:40 GMT
From: Rob Farmer <rfarmer@predatorlabs.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [PATCH] sysutils/msyslogd utmp.h --> utmpx.h
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         143239
>Category:       ports
>Synopsis:       [PATCH] sysutils/msyslogd utmp.h --> utmpx.h
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    wen
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jan 26 02:20:05 UTC 2010
>Closed-Date:    Fri Feb 12 17:21:49 UTC 2010
>Last-Modified:  Fri Feb 12 17:30:08 UTC 2010
>Originator:     Rob Farmer
>Release:        9.0-CURRENT
>Organization:
>Environment:
FreeBSD pentium4.predatorlabs.net 9.0-CURRENT FreeBSD 9.0-CURRENT #0 r202659: Tue Jan 19 16:02:39 PST 2010     rfarmer@pentium4.predatorlabs.net:/obj/usr/src/sys/PENTIUM4  i386
>Description:
Convert from utmp.h to utmpx.h
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

diff -ruN msyslog.old/Makefile msyslog/Makefile
--- msyslog.old/Makefile	2010-01-25 16:34:25.000000000 -0800
+++ msyslog/Makefile	2010-01-25 16:43:04.000000000 -0800
@@ -30,6 +30,10 @@
 
 .include <bsd.port.pre.mk>
 
+.if ${OSVERSION} > 900006
+EXTRA_PATCHES=	${PATCHDIR}/utmpx-src-modules-om_classic.c
+.endif
+
 .if defined(WITH_MYSQL)
 USE_MYSQL=	yes
 MAN8+=	om_mysql.8
diff -ruN msyslog.old/files/utmpx-src-modules-om_classic.c msyslog/files/utmpx-src-modules-om_classic.c
--- msyslog.old/files/utmpx-src-modules-om_classic.c	1969-12-31 16:00:00.000000000 -0800
+++ msyslog/files/utmpx-src-modules-om_classic.c	2010-01-25 16:41:52.000000000 -0800
@@ -0,0 +1,70 @@
+--- src/modules/om_classic.c.orig	2010-01-25 16:36:53.000000000 -0800
++++ src/modules/om_classic.c	2010-01-25 16:40:31.000000000 -0800
+@@ -66,7 +66,7 @@
+ #include <string.h>
+ #include <syslog.h>
+ #include <unistd.h>
+-#include <utmp.h>
++#include <utmpx.h>
+ #include <netdb.h>
+ /* if _PATH_UTMP isn't defined, define it here... */
+ #ifndef _PATH_UTMP
+@@ -100,7 +100,7 @@
+ struct om_classic_ctx {
+ 	int	fd;
+ 	union {
+-		char    f_uname[MAXUNAMES][UT_NAMESIZE+1];
++		char    f_uname[MAXUNAMES][MAXLOGNAME+2];
+ 		struct {
+ 			char    f_hname[MAXHOSTNAMELEN];
+ 			struct sockaddr		f_addr;
+@@ -396,9 +396,9 @@
+ 		for (i = 0; i < MAXUNAMES && *p; i++) {
+ 			for (q = p; *q && *q != ','; )
+ 				q++;
+-			(void)strncpy(c->f_un.f_uname[i], p, UT_NAMESIZE);
+-			if ((q - p) > UT_NAMESIZE)
+-				c->f_un.f_uname[i][UT_NAMESIZE] = '\0';
++			(void)strncpy(c->f_un.f_uname[i], p, MAXLOGNAME+1);
++			if ((q - p) > MAXLOGNAME+1)
++				c->f_un.f_uname[i][MAXLOGNAME+1] = '\0';
+ 			else
+ 				c->f_un.f_uname[i][q - p] = '\0';
+ 			while (*q == ',' || *q == ' ')
+@@ -456,24 +456,19 @@
+ {
+ 	static int reenter;			/* avoid calling ourselves */
+ 	FILE *uf;
+-	struct utmp ut;
++	struct utmpx ut;
+ 	int i;
+ 	char *p;
+ 	char line[sizeof(ut.ut_line) + 1];
+ 
+ 	if (reenter++)
+ 		return;
+-	if ( (uf = fopen(_PATH_UTMP, "r")) == NULL) {
+-		dprintf(MSYSLOG_SERIOUS, "om_classic: error opening "
+-		    "%s\n", _PATH_UTMP);
+-		reenter = 0;
+-		return;
+-	}
++
+ 	/* NOSTRICT */
+ 	while (fread(&ut, sizeof(ut), 1, uf) == 1) {
+ 
+ #ifndef __linux__
+-		if (ut.ut_name[0] == '\0')
++		if (ut.ut_user[0] == '\0')
+ #else
+ 		if ((ut.ut_type != USER_PROCESS && ut.ut_type != LOGIN_PROCESS) ||
+ 		    ut.ut_line[0] == ':' /* linux logs users that are not logged in (?!) */)
+@@ -494,7 +489,7 @@
+ 		for (i = 0; i < MAXUNAMES; i++) {
+ 			if (!c->f_un.f_uname[i][0])
+ 				break;
+-			if (!strncmp(c->f_un.f_uname[i], ut.ut_name,
++			if (!strncmp(c->f_un.f_uname[i], ut.ut_user,
+ 			    UT_NAMESIZE)) {
+ 				if ((p = ttymsg(iov, 6, line, TTYMSGTIME))
+ 								!= NULL) {


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->wen 
Responsible-Changed-By: wen 
Responsible-Changed-When: Tue Jan 26 03:03:14 UTC 2010 
Responsible-Changed-Why:  
I'll take it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=143239 
State-Changed-From-To: open->closed 
State-Changed-By: miwi 
State-Changed-When: Fri Feb 12 17:21:48 UTC 2010 
State-Changed-Why:  
Committed. Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=143239 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/143239: commit references a PR
Date: Fri, 12 Feb 2010 17:21:48 +0000 (UTC)

 miwi        2010-02-12 17:21:40 UTC
 
   FreeBSD ports repository
 
   Modified files:
     sysutils/msyslog     Makefile 
   Added files:
     sysutils/msyslog/files utmpx-src-modules-om_classic.c 
   Log:
   - Fix build on HEAD
   
   PR:             143239
   Submitted by:   Rob Farmer <rfarmer@predatorlabs.net>
   
   Revision  Changes    Path
   1.31      +4 -0      ports/sysutils/msyslog/Makefile
   1.1       +70 -0     ports/sysutils/msyslog/files/utmpx-src-modules-om_classic.c (new)
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
