Fixup fromcvs/togit conversion
[minix-pkgsrc.git] / security / openssh / patches / patch-loginrec.c
blob0b317bb32c3c72f0bd40e4c9e324695aaa87938d
1 $NetBSD$
3 Interix support and related fixes
5 --- loginrec.c.orig 2013-02-22 22:12:24.000000000 +0000
6 +++ loginrec.c
7 @@ -429,8 +429,8 @@ login_set_addr(struct logininfo *li, con
8 int
9 login_write(struct logininfo *li)
11 -#ifndef HAVE_CYGWIN
12 - if (geteuid() != 0) {
13 +#if !defined(HAVE_CYGWIN) && !defined(HAVE_INTERIX)
14 + if (geteuid() != ROOTUID) {
15 logit("Attempt to write login records by non-root user (aborting)");
16 return (1);
18 @@ -438,7 +438,7 @@ login_write(struct logininfo *li)
20 /* set the timestamp */
21 login_set_current_time(li);
22 -#ifdef USE_LOGIN
23 +#if defined(USE_LOGIN) && (HAVE_UTMP_H)
24 syslogin_write_entry(li);
25 #endif
26 #ifdef USE_LASTLOG
27 @@ -622,7 +622,7 @@ line_abbrevname(char *dst, const char *s
28 ** into account.
29 **/
31 -#if defined(USE_UTMP) || defined (USE_WTMP) || defined (USE_LOGIN)
32 +#if defined(USE_UTMP) || defined (USE_WTMP) || (defined (USE_LOGIN) && defined (HAVE_UTMP_H))
34 /* build the utmp structure */
35 void
36 @@ -759,10 +759,6 @@ construct_utmpx(struct logininfo *li, st
37 set_utmpx_time(li, utx);
38 utx->ut_pid = li->pid;
40 - /* strncpy(): Don't necessarily want null termination */
41 - strncpy(utx->ut_user, li->username,
42 - MIN_SIZEOF(utx->ut_user, li->username));
44 if (li->type == LTYPE_LOGOUT)
45 return;
47 @@ -771,6 +767,8 @@ construct_utmpx(struct logininfo *li, st
48 * for logouts.
51 + /* strncpy(): Don't necessarily want null termination */
52 + strncpy(utx->ut_name, li->username, MIN_SIZEOF(utx->ut_name, li->username));
53 # ifdef HAVE_HOST_IN_UTMPX
54 strncpy(utx->ut_host, li->hostname,
55 MIN_SIZEOF(utx->ut_host, li->hostname));
56 @@ -1406,7 +1404,7 @@ wtmpx_get_entry(struct logininfo *li)
57 ** Low-level libutil login() functions
58 **/
60 -#ifdef USE_LOGIN
61 +#if defined(USE_LOGIN) && defined(HAVE_UTMP_H)
62 static int
63 syslogin_perform_login(struct logininfo *li)