1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-05 06:27:37 +00:00

Fix the build with utmpx.h.

Submitted by:	ed (based on)
This commit is contained in:
Joe Marcus Clarke 2010-02-12 23:32:17 +00:00
parent 3c7eb55e28
commit 206208b780
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=249737
3 changed files with 127 additions and 4 deletions

View File

@ -1,10 +1,30 @@
--- tac_plus.h.orig Tue Dec 12 19:43:08 2006
+++ tac_plus.h Sat Jun 30 02:07:03 2007
@@ -731,6 +731,7 @@ int sendpass_fn(struct authen_data *data
--- tac_plus.h.orig 2009-07-27 20:11:53.000000000 -0400
+++ tac_plus.h 2010-02-12 18:13:49.000000000 -0500
@@ -86,6 +86,7 @@
#ifdef FREEBSD
#define CONST_SYSERRLIST
#define NO_PWAGE
+#include <sys/param.h>
#endif
#ifdef BSDI
@@ -138,7 +139,11 @@
# include <sys/syslog.h>
#endif
+#if defined(FREEBSD) && __FreeBSD_version >= 900007
+#include <utmpx.h>
+#else
#include <utmp.h>
+#endif
#include <unistd.h>
@@ -655,6 +660,7 @@ int sendpass_fn(struct authen_data *data
int enable_fn(struct authen_data *data);
int default_v0_fn(struct authen_data *data);
int skey_fn(struct authen_data *data);
+int opie_fn(struct authen_data *data);
#ifdef MAXSESS
extern void loguser(struct acct_rec *);
void loguser(struct acct_rec *);

View File

@ -0,0 +1,78 @@
--- do_acct.c.orig 2010-01-23 16:17:36.000000000 -0500
+++ do_acct.c 2010-02-12 18:19:44.000000000 -0500
@@ -202,23 +202,42 @@ do_acct_syslog(struct acct_rec *rec)
int
wtmp_entry(char *line, char *name, char *host, time_t utime)
{
+#if defined(FREEBSD) && __FreeBSD_version >= 900007
+#define HAVE_UTMPX_H 1
+ struct utmpx entry;
+ struct timeval tv;
+#else
struct utmp entry;
+#endif
+#ifndef HAVE_UTMPX_H
if (!wtmpfile) {
return(1);
}
+#endif
memset(&entry, 0, sizeof entry);
+#ifdef HAVE_UTMPX_H
+ entry.ut_type = *name != '\0' ? USER_PROCESS : DEAD_PROCESS;
+ snprintf(entry.ut_id, sizeof entry.ut_id, "%xtac", getpid());
+#endif
if (strlen(line) < sizeof entry.ut_line)
strcpy(entry.ut_line, line);
else
memcpy(entry.ut_line, line, sizeof(entry.ut_line));
+#ifdef HAVE_UTMPX_H
+ if (strlen(name) < sizeof entry.ut_user)
+ strcpy(entry.ut_user, name);
+ else
+ memcpy(entry.ut_user, name, sizeof(entry.ut_user));
+#else
if (strlen(name) < sizeof entry.ut_name)
strcpy(entry.ut_name, name);
else
memcpy(entry.ut_name, name, sizeof(entry.ut_name));
+#endif
#ifndef SOLARIS
if (strlen(host) < sizeof entry.ut_host)
@@ -226,13 +245,24 @@ wtmp_entry(char *line, char *name, char
else
memcpy(entry.ut_host, host, sizeof(entry.ut_host));
#endif
+#ifdef HAVE_UTMPX_H
+ memset(&entry.ut_tv, 0, sizeof(entry.ut_tv));
+ tv.tv_sec = utime;
+ memcpy(&entry.ut_tv, &tv, sizeof(entry.ut_tv));
+#else
entry.ut_time = utime;
+#endif
#ifdef FREEBSD
+#ifdef HAVE_UTMPX_H
+ pututxline(&entry);
+#else
wtmpfd = open(wtmpfile, O_CREAT | O_WRONLY | O_APPEND, 0644);
+#endif
#else
wtmpfd = open(wtmpfile, O_CREAT | O_WRONLY | O_APPEND | O_SYNC, 0644);
#endif
+#ifndef HAVE_UTMPX_H
if (wtmpfd < 0) {
report(LOG_ERR, "Can't open wtmp file %s -- %s",
wtmpfile, strerror(errno));
@@ -251,6 +281,7 @@ wtmp_entry(char *line, char *name, char
}
close(wtmpfd);
+#endif
if (debug & DEBUG_ACCT_FLAG) {
report(LOG_DEBUG, "wtmp: %s, %s %s %d", line, name, host, utime);

View File

@ -0,0 +1,25 @@
--- tacacs.h.orig 2010-02-12 18:13:56.000000000 -0500
+++ tacacs.h 2010-02-12 18:14:51.000000000 -0500
@@ -83,6 +83,10 @@ XXX unknown
#define MSCHAP_DIGEST_LEN 49
#endif /* MSCHAP */
+#ifdef FREEBSD
+#include <sys/param.h>
+#endif
+
#if HAVE_STRING_H
# include <string.h>
#endif
@@ -124,7 +128,11 @@ XXX unknown
# include <sys/syslog.h>
#endif
+#if defined(FREEBSD) && __FreeBSD_version >= 900007
+#include <utmpx.h>
+#else
#include <utmp.h>
+#endif
#include <unistd.h>