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
|
$NetBSD: patch-ak,v 1.6 2011/11/22 15:07:04 is Exp $
- use standard includes
- 64-bit time_t fixes
- remove union wait
- replace mktemp() by mkstemp()
--- src/in.fingerd.c.orig 1999-03-29 06:05:30.000000000 +0000
+++ src/in.fingerd.c
@@ -33,9 +33,7 @@ static char *rcsid = "$Id: in.fingerd.c,
#include <sys/types.h>
#include <fcntl.h>
#include <sys/file.h>
-#ifndef X_OK
#include <unistd.h>
-#endif
#include <sys/stat.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -811,7 +809,7 @@ finger_users (user, options, stream)
/* don't print trailing \n from ctime() */
fprintf(stream, " seen at %s on %.24s",
strip_hostname (upackets[i]->host),
- ctime (&upackets[i]->idle_time));
+ ctime32 (&upackets[i]->idle_time));
if (*(upackets[i]->ttyloc))
fprintf(stream, " from %s",
@@ -897,7 +895,6 @@ finger_clients (user, options, stream)
else
{
status = "";
- idle_time = "";
}
@@ -1271,7 +1268,7 @@ show_unlogged_packet (packet, stream)
/* In SunOS4 getpwnam() seems to call ctime(), so we move this call down
* here to be sure the intended result doesn't get overwritten. */
- char *the_time = ctime(&packet->idle_time);
+ char *the_time = ctime32(&packet->idle_time);
the_time[strlen(the_time) - 1] = '\0'; /* delete newline */
if (*(packet->real_name))
@@ -1415,14 +1412,7 @@ run_target_script(script, target, cd, in
char *arg;
{
int pid;
-#ifdef SYSV
int status;
-#else
-#ifndef WEXITSTATUS
-# define WEXITSTATUS(w) ((w).w_retcode)
-#endif
- union wait status;
-#endif
if (access (script, X_OK) >= 0)
{
@@ -1537,6 +1527,7 @@ maybe_user_script (entry, stream, packet
FILE *long_output;
int result;
extern char *mktemp();
+ int temp_fd;
#ifndef FINGERRC
return (0);
@@ -1580,8 +1571,9 @@ maybe_user_script (entry, stream, packet
/* Collect regular long finger output in file */
strcpy (temp_file, TEMPFILE);
- if (!mktemp (temp_file) ||
- !(long_output = fopen (temp_file, "w+")))
+ temp_fd = mkstemp (temp_file);
+ if (temp_fd < 0 ||
+ !(long_output = fdopen (temp_fd, "w+")))
{
file_error (WARNING, temp_file);
free (user_script);
|