Lines 3-8
Link Here
|
3 |
*/ |
3 |
*/ |
4 |
|
4 |
|
5 |
#define RHOST_UNKNOWN_NAME "" /* perhaps "[from.where?]" */ |
5 |
#define RHOST_UNKNOWN_NAME "" /* perhaps "[from.where?]" */ |
|
|
6 |
|
7 |
#define DEVICE_FILE_PREFIX "/dev/" |
8 |
|
6 |
#define WTMP_LOCK_TIMEOUT 3 /* in seconds */ |
9 |
#define WTMP_LOCK_TIMEOUT 3 /* in seconds */ |
7 |
|
10 |
|
8 |
#include <fcntl.h> |
11 |
#include <fcntl.h> |
Lines 47-52
Link Here
|
47 |
while ((u_tmp_p = getutent()) != NULL) |
50 |
while ((u_tmp_p = getutent()) != NULL) |
48 |
if ((u_tmp_p->ut_type == INIT_PROCESS || |
51 |
if ((u_tmp_p->ut_type == INIT_PROCESS || |
49 |
u_tmp_p->ut_type == LOGIN_PROCESS || |
52 |
u_tmp_p->ut_type == LOGIN_PROCESS || |
|
|
53 |
u_tmp_p->ut_type == DEAD_PROCESS || |
50 |
u_tmp_p->ut_type == USER_PROCESS) && |
54 |
u_tmp_p->ut_type == USER_PROCESS) && |
51 |
!strncmp(u_tmp_p->ut_line, ut_line, UT_LINESIZE)) { |
55 |
!strncmp(u_tmp_p->ut_line, ut_line, UT_LINESIZE)) { |
52 |
if (!strncmp(u_tmp_p->ut_id, ut_id, UT_IDSIZE)) |
56 |
if (!strncmp(u_tmp_p->ut_id, ut_id, UT_IDSIZE)) |
Lines 81-98
Link Here
|
81 |
if ( *terminal == '/' ) { /* now deal with filenames */ |
85 |
if ( *terminal == '/' ) { /* now deal with filenames */ |
82 |
int o1, o2; |
86 |
int o1, o2; |
83 |
|
87 |
|
84 |
o1 = strncmp("/dev/", terminal, 5) ? 0 : 5; |
88 |
o1 = strncmp(DEVICE_FILE_PREFIX, terminal, 5) ? 0 : 5; |
85 |
if (!strncmp("/dev/tty", terminal, 8)) { |
89 |
if (!strncmp("/dev/tty", terminal, 8)) { |
86 |
o2 = 8; |
90 |
o2 = 8; |
87 |
} else { |
91 |
} else { |
88 |
if (!strncmp("/dev/pts/", terminal, 9)) |
92 |
o2 = strlen(terminal) - sizeof(UT_IDSIZE); |
89 |
o1 = 8; /* include the slash */ |
|
|
90 |
o2 = strlen(terminal + o1) - UT_IDSIZE; |
91 |
if (o2 < 0) |
93 |
if (o2 < 0) |
92 |
o2 = 0; |
94 |
o2 = 0; |
93 |
o2 += o1; |
|
|
94 |
if (o1 > 5) |
95 |
o1 = 5; |
96 |
} |
95 |
} |
97 |
|
96 |
|
98 |
strncpy(ut_line, terminal + o1, UT_LINESIZE); |
97 |
strncpy(ut_line, terminal + o1, UT_LINESIZE); |