ports/net/mpd[45] broken with utmpx.h change

Andrey V. Elsukov bu7cher at yandex.ru
Tue Feb 16 06:09:04 UTC 2010


On 16.02.2010 4:51, Bernd Walter wrote:
> I don't know how difficult it is to fix, but for many of us mpd is
> important to have network connection.

You can try this patch. I don't know why Alexander did't commit it.

-- 
WBR, Andrey V. Elsukov
-------------- next part --------------
--- src/auth.c	2009-12-22 12:02:46.000000000 +0300
+++ src/auth.c	2010-01-18 15:01:25.918302237 +0300
@@ -1387,6 +1387,30 @@
  * Account with system
  */
 
+#if __FreeBSD_version >= 900007
+static int
+AuthSystemAcct(AuthData auth)
+{
+	struct utmpx	ut;
+
+	memset(&ut, 0, sizeof(ut));
+	snprintf(ut.ut_id, sizeof(ut.ut_id), "%xmpd", auth->info.linkID);
+
+	if (auth->acct_type == AUTH_ACCT_START) {
+		ut.ut_type = USER_PROCESS;
+		strlcpy(ut.ut_host, auth->params.peeraddr, sizeof(ut.ut_host));
+		strlcpy(ut.ut_user, auth->params.authname, sizeof(ut.ut_user));
+		gettimeofday(&ut.ut_tv, NULL);
+		Log(LG_AUTH, ("[%s] ACCT: wtmp %s %s %s login", auth->info.lnkname, ut.ut_line,
+			ut.ut_user, ut.ut_host));
+	} else if (auth->acct_type == AUTH_ACCT_STOP) {
+		ut.ut_type = DEAD_PROCESS;
+		Log(LG_AUTH, ("[%s] ACCT: wtmp %s logout", auth->info.lnkname, ut.ut_line));
+	}
+	pututxline(&ut);
+	return (0);
+}
+#else
 static int
 AuthSystemAcct(AuthData auth)
 {
@@ -1412,6 +1436,7 @@
 	}
 	return (0);
 }
+#endif /* __FreeBSD_version >= 900007 */
 #endif /* USE_SYSTEM */
 
 #ifdef USE_PAM
--- src/auth.h	2009-12-22 12:02:46.000000000 +0300
+++ src/auth.h	2010-01-18 14:44:22.471540149 +0300
@@ -23,7 +23,11 @@
 #ifdef USE_OPIE
 #include <opie.h>
 #endif
+#if __FreeBSD_version >= 900007
+#include <utmpx.h>
+#else
 #include <utmp.h>
+#endif
   
 /*
  * DEFINITIONS
@@ -303,8 +307,10 @@
   extern const char	*AuthMPPEPolicyname(int policy);
   extern const char	*AuthMPPETypesname(int types, char *buf, size_t len);
 
+#if defined(USE_NG_BPF) || defined(USE_IPFW)
   extern void		ACLCopy(struct acl *src, struct acl **dst);
   extern void		ACLDestroy(struct acl *acl);
+#endif
   extern void		authparamsInit(struct authparams *ap);
   extern void		authparamsCopy(struct authparams *src, struct authparams *dst);
   extern void		authparamsMove(struct authparams *src, struct authparams *dst);


More information about the freebsd-current mailing list