summaryrefslogtreecommitdiff
path: root/ftp/proftpd/files/patch-src-wtmp.c
blob: 639332a410a8140f1f01086870577af8b094afb3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
--- src/wtmp.c.orig	2009-02-18 19:24:50.000000000 +0100
+++ src/wtmp.c	2010-05-13 16:18:54.711790750 +0200
@@ -37,7 +37,9 @@
   int res = 0;
 
 #if ((defined(SVR4) || defined(__SVR4)) || \
-    (defined(__NetBSD__) && defined(HAVE_UTMPX_H))) && \
+    ((defined(__NetBSD__) || \
+     (defined(__FreeBSD_version) && __FreeBSD_version >= 900007)) && \
+      defined(HAVE_UTMPX_H))) && \
     !(defined(LINUX) || defined(__hpux) || defined (_AIX))
   /* This "auxilliary" utmp doesn't exist under linux. */
 
@@ -51,8 +53,17 @@
 
   static int fdx = -1;
 
-#if !defined(WTMPX_FILE) && defined(_PATH_WTMPX)
-# define WTMPX_FILE _PATH_WTMPX
+#if !defined(WTMPX_FILE)
+# if defined(_PATH_WTMPX)
+#   define WTMPX_FILE _PATH_WTMPX
+# elif defined(_PATH_UTMPX)
+#   define WTMPX_FILE _PATH_UTMPX
+# else
+/* This path works for FreeBSD; not sure what to do for other platforms which
+ * don't define _PATH_WTMPX or _PATH_UTMPX.
+ */
+#   define WTMPX_FILE "/var/log/utx.log"
+# endif
 #endif
 
   if (fdx < 0 &&
@@ -80,7 +91,8 @@
 #if defined(__NetBSD__) && defined(HAVE_UTMPX_H)
     memcpy(&utx.ut_ss, pr_netaddr_get_inaddr(ip), sizeof(utx.ut_ss));
     gettimeofday(&utx.ut_tv, NULL);
-
+#elif defined(__FreeBSD_version) && __FreeBSD_version >= 900007 && defined(HAVE_UTMPX_H)
+    gettimeofday(&utx.ut_tv, NULL);
 #else /* SVR4 */
     utx.ut_syslen = strlen(utx.ut_host)+1;
 
@@ -113,7 +125,9 @@
   }
 
 #else /* Non-SVR4 systems */
+#if !defined(__FreeBSD_version) || __FreeBSD_version < 900007 || !defined(HAVE_UTMPX_H)
   struct utmp ut;
+#endif
   static int fd = -1;
 
   if (fd < 0 &&