aboutsummaryrefslogtreecommitdiffstats
path: root/testing/ipsec-tools/10-revert-utmpx.patch
blob: 388fa71d0b2cdf504776391963f898d7cbe92128 (plain)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
Index: src/racoon/isakmp_cfg.c
===================================================================
RCS file: /cvsroot/src/crypto/dist/ipsec-tools/src/racoon/isakmp_cfg.c,v
retrieving revision 1.24
retrieving revision 1.23
diff -u -r1.24 -r1.23
--- a/src/racoon/isakmp_cfg.c	21 Sep 2010 13:14:17 -0000	1.24
+++ b/src/racoon/isakmp_cfg.c	4 Aug 2010 09:16:58 -0000	1.23
@@ -1,4 +1,4 @@
-/*	$NetBSD: isakmp_cfg.c,v 1.24 2010/09/21 13:14:17 vanhu Exp $	*/
+/*	$NetBSD: isakmp_cfg.c,v 1.23 2010/08/04 09:16:58 vanhu Exp $	*/
 
 /* Id: isakmp_cfg.c,v 1.55 2006/08/22 18:17:17 manubsd Exp */
 
@@ -38,7 +38,7 @@
 #include <sys/socket.h>
 #include <sys/queue.h>
 
-#include <utmpx.h>
+#include <utmp.h>
 #if defined(__APPLE__) && defined(__MACH__)
 #include <util.h>
 #endif
@@ -1661,7 +1661,8 @@
 	int inout;
 {
 	int error = 0;
-	struct utmpx ut;
+	struct utmp ut;
+	char term[UT_LINESIZE];
 	char addr[NI_MAXHOST];
 	
 	if (usr == NULL || usr[0]=='\0') {
@@ -1670,33 +1671,36 @@
 		return -1;
 	}
 
-	memset(&ut, 0, sizeof ut);
-	gettimeofday((struct timeval *)&ut.ut_tv, NULL);
-	snprintf(ut.ut_id, sizeof ut.ut_id, TERMSPEC, port);
+	sprintf(term, TERMSPEC, port);
 
 	switch (inout) {
 	case ISAKMP_CFG_LOGIN:
-		ut.ut_type = USER_PROCESS;
-		strncpy(ut.ut_user, usr, sizeof ut.ut_user);
+		strncpy(ut.ut_name, usr, UT_NAMESIZE);
+		ut.ut_name[UT_NAMESIZE - 1] = '\0';
+
+		strncpy(ut.ut_line, term, UT_LINESIZE);
+		ut.ut_line[UT_LINESIZE - 1] = '\0';
 
 		GETNAMEINFO_NULL(raddr, addr);
-		strncpy(ut.ut_host, addr, sizeof ut.ut_host);
+		strncpy(ut.ut_host, addr, UT_HOSTSIZE);
+		ut.ut_host[UT_HOSTSIZE - 1] = '\0';
 
+		ut.ut_time = time(NULL);
+ 
 		plog(LLV_INFO, LOCATION, NULL,
 			"Accounting : '%s' logging on '%s' from %s.\n",
-			ut.ut_user, ut.ut_id, addr);
+			ut.ut_name, ut.ut_line, ut.ut_host);
 
-		pututxline(&ut);
+		login(&ut);
 
 		break;
 	case ISAKMP_CFG_LOGOUT:	
-		ut.ut_type = DEAD_PROCESS;
 
 		plog(LLV_INFO, LOCATION, NULL,
 			"Accounting : '%s' unlogging from '%s'.\n",
-			usr, ut.ut_id);
+			usr, term);
 
-		pututxline(&ut);
+		logout(term);
 
 		break;
 	default: