| @@ -1,81 +1,75 @@ | | | @@ -1,81 +1,75 @@ |
1 | $NetBSD: patch-ak,v 1.4 2011/11/22 09:04:49 is Exp $ | | 1 | $NetBSD: patch-ak,v 1.5 2011/11/22 09:44:18 is Exp $ |
2 | | | 2 | |
3 | --- src/in.fingerd.c.orig 1996-01-10 19:26:24.000000000 +0000 | | 3 | --- src/in.fingerd.c.orig 1999-03-29 06:05:30.000000000 +0000 |
4 | +++ src/in.fingerd.c | | 4 | +++ src/in.fingerd.c |
5 | @@ -33,9 +33,7 @@ static char *rcsid = "$Id: in.fingerd.c, | | 5 | @@ -33,9 +33,7 @@ static char *rcsid = "$Id: in.fingerd.c, |
6 | #include <sys/types.h> | | 6 | #include <sys/types.h> |
7 | #include <fcntl.h> | | 7 | #include <fcntl.h> |
8 | #include <sys/file.h> | | 8 | #include <sys/file.h> |
9 | -#ifndef X_OK | | 9 | -#ifndef X_OK |
10 | #include <unistd.h> | | 10 | #include <unistd.h> |
11 | -#endif | | 11 | -#endif |
12 | #include <sys/stat.h> | | 12 | #include <sys/stat.h> |
13 | #include <netinet/in.h> | | 13 | #include <netinet/in.h> |
14 | #include <arpa/inet.h> | | 14 | #include <arpa/inet.h> |
15 | @@ -805,12 +803,12 @@ finger_users (user, options, stream) | | 15 | @@ -811,7 +809,7 @@ finger_users (user, options, stream) |
16 | fprintf (stream, "%s (%s) seen at %s on %s", | | 16 | /* don't print trailing \n from ctime() */ |
17 | upackets[i]->real_name, upackets[i]->name, | | 17 | fprintf(stream, " seen at %s on %.24s", |
18 | strip_hostname (upackets[i]->host), | | 18 | strip_hostname (upackets[i]->host), |
19 | - ctime (&upackets[i]->idle_time)); | | 19 | - ctime (&upackets[i]->idle_time)); |
20 | + ctime32 (&upackets[i]->idle_time)); | | 20 | + ctime32 (&upackets[i]->idle_time)); |
21 | else | | 21 | |
22 | fprintf (stream, "%s seen at %s on %s", | | 22 | if (*(upackets[i]->ttyloc)) |
23 | upackets[i]->name, | | 23 | fprintf(stream, " from %s", |
24 | strip_hostname (upackets[i]->host), | | 24 | @@ -897,7 +895,6 @@ finger_clients (user, options, stream) |
25 | - ctime (&upackets[i]->idle_time)); | | | |
26 | + ctime32 (&upackets[i]->idle_time)); | | | |
27 | } | | | |
28 | else | | | |
29 | { | | | |
30 | @@ -888,7 +886,6 @@ finger_clients (user, options, stream) | | | |
31 | else | | 25 | else |
32 | { | | 26 | { |
33 | status = ""; | | 27 | status = ""; |
34 | - idle_time = ""; | | 28 | - idle_time = ""; |
35 | } | | 29 | } |
36 | | | 30 | |
37 | | | 31 | |
38 | @@ -1262,7 +1259,7 @@ show_unlogged_packet (packet, stream) | | 32 | @@ -1271,7 +1268,7 @@ show_unlogged_packet (packet, stream) |
39 | | | 33 | |
40 | /* In SunOS4 getpwnam() seems to call ctime(), so we move this call down | | 34 | /* In SunOS4 getpwnam() seems to call ctime(), so we move this call down |
41 | * here to be sure the intended result doesn't get overwritten. */ | | 35 | * here to be sure the intended result doesn't get overwritten. */ |
42 | - char *the_time = ctime(&packet->idle_time); | | 36 | - char *the_time = ctime(&packet->idle_time); |
43 | + char *the_time = ctime32(&packet->idle_time); | | 37 | + char *the_time = ctime32(&packet->idle_time); |
44 | the_time[strlen(the_time) - 1] = '\0'; /* delete newline */ | | 38 | the_time[strlen(the_time) - 1] = '\0'; /* delete newline */ |
45 | | | 39 | |
46 | if (*(packet->real_name)) | | 40 | if (*(packet->real_name)) |
47 | @@ -1406,14 +1403,7 @@ run_target_script(script, target, cd, in | | 41 | @@ -1415,14 +1412,7 @@ run_target_script(script, target, cd, in |
48 | char *arg; | | 42 | char *arg; |
49 | { | | 43 | { |
50 | int pid; | | 44 | int pid; |
51 | -#ifdef SYSV | | 45 | -#ifdef SYSV |
52 | int status; | | 46 | int status; |
53 | -#else | | 47 | -#else |
54 | -#ifndef WEXITSTATUS | | 48 | -#ifndef WEXITSTATUS |
55 | -# define WEXITSTATUS(w) ((w).w_retcode) | | 49 | -# define WEXITSTATUS(w) ((w).w_retcode) |
56 | -#endif | | 50 | -#endif |
57 | - union wait status; | | 51 | - union wait status; |
58 | -#endif | | 52 | -#endif |
59 | | | 53 | |
60 | if (access (script, X_OK) >= 0) | | 54 | if (access (script, X_OK) >= 0) |
61 | { | | 55 | { |
62 | @@ -1528,6 +1518,7 @@ maybe_user_script (entry, stream, packet | | 56 | @@ -1537,6 +1527,7 @@ maybe_user_script (entry, stream, packet |
63 | FILE *long_output; | | 57 | FILE *long_output; |
64 | int result; | | 58 | int result; |
65 | extern char *mktemp(); | | 59 | extern char *mktemp(); |
66 | + int temp_fd; | | 60 | + int temp_fd; |
67 | | | 61 | |
68 | #ifndef FINGERRC | | 62 | #ifndef FINGERRC |
69 | return (0); | | 63 | return (0); |
70 | @@ -1571,8 +1562,9 @@ maybe_user_script (entry, stream, packet | | 64 | @@ -1580,8 +1571,9 @@ maybe_user_script (entry, stream, packet |
71 | /* Collect regular long finger output in file */ | | 65 | /* Collect regular long finger output in file */ |
72 | strcpy (temp_file, TEMPFILE); | | 66 | strcpy (temp_file, TEMPFILE); |
73 | | | 67 | |
74 | - if (!mktemp (temp_file) || | | 68 | - if (!mktemp (temp_file) || |
75 | - !(long_output = fopen (temp_file, "w+"))) | | 69 | - !(long_output = fopen (temp_file, "w+"))) |
76 | + temp_fd = mkstemp (temp_file); | | 70 | + temp_fd = mkstemp (temp_file); |
77 | + if (temp_fd < 0 || | | 71 | + if (temp_fd < 0 || |
78 | + !(long_output = fdopen (temp_fd, "w+"))) | | 72 | + !(long_output = fdopen (temp_fd, "w+"))) |
79 | { | | 73 | { |
80 | file_error (WARNING, temp_file); | | 74 | file_error (WARNING, temp_file); |
81 | free (user_script); | | 75 | free (user_script); |