summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--acconfig.h8
-rw-r--r--configure.in4
-rw-r--r--loginrec.c23
-rw-r--r--loginrec.h5
-rw-r--r--session.c38
-rw-r--r--sshlogin.c14
-rw-r--r--sshlogin.h9
8 files changed, 100 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index ce6b6b631..04e41fff2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,8 @@
11 - mouring@cvs.openbsd.org 2001/05/08 19:45:25 11 - mouring@cvs.openbsd.org 2001/05/08 19:45:25
12 [misc.c misc.h scp.c sftp.c] 12 [misc.c misc.h scp.c sftp.c]
13 Use addargs() in sftp plus some clean up of addargs(). OK Markus 13 Use addargs() in sftp plus some clean up of addargs(). OK Markus
14 - (bal) UseLogin patch for Solaris/UNICOS. Patch by Wayne Davison
15 <wayne@blorf.net>
14 16
1520010508 1720010508
16 - (bal) Fixed configure test for USE_SIA. 18 - (bal) Fixed configure test for USE_SIA.
@@ -5371,4 +5373,4 @@
5371 - Wrote replacements for strlcpy and mkdtemp 5373 - Wrote replacements for strlcpy and mkdtemp
5372 - Released 1.0pre1 5374 - Released 1.0pre1
5373 5375
5374$Id: ChangeLog,v 1.1208 2001/05/08 20:27:25 mouring Exp $ 5376$Id: ChangeLog,v 1.1209 2001/05/08 20:33:05 mouring Exp $
diff --git a/acconfig.h b/acconfig.h
index b4cfe0401..e909f4797 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -1,4 +1,4 @@
1/* $Id: acconfig.h,v 1.110 2001/04/05 17:15:08 stevesk Exp $ */ 1/* $Id: acconfig.h,v 1.111 2001/05/08 20:33:06 mouring Exp $ */
2 2
3#ifndef _CONFIG_H 3#ifndef _CONFIG_H
4#define _CONFIG_H 4#define _CONFIG_H
@@ -154,6 +154,12 @@
154/* Define if you don't want to use wtmpx */ 154/* Define if you don't want to use wtmpx */
155#undef DISABLE_WTMPX 155#undef DISABLE_WTMPX
156 156
157/* Some systems need a utmpx entry for /bin/login to work */
158#undef LOGIN_NEEDS_UTMPX
159
160/* Some versions of /bin/login need the TERM supplied on the commandline */
161#undef LOGIN_NEEDS_TERM
162
157/* Define if you want to specify the path to your lastlog file */ 163/* Define if you want to specify the path to your lastlog file */
158#undef CONF_LASTLOG_FILE 164#undef CONF_LASTLOG_FILE
159 165
diff --git a/configure.in b/configure.in
index e0e45ee8e..4b1362a90 100644
--- a/configure.in
+++ b/configure.in
@@ -1,4 +1,4 @@
1# $Id: configure.in,v 1.283 2001/05/07 12:54:26 mouring Exp $ 1# $Id: configure.in,v 1.284 2001/05/08 20:33:06 mouring Exp $
2 2
3AC_INIT(ssh.c) 3AC_INIT(ssh.c)
4 4
@@ -153,6 +153,8 @@ mips-sony-bsd|mips-sony-newsos4)
153 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib" 153 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
154 need_dash_r=1 154 need_dash_r=1
155 AC_DEFINE(PAM_SUN_CODEBASE) 155 AC_DEFINE(PAM_SUN_CODEBASE)
156 AC_DEFINE(LOGIN_NEEDS_UTMPX)
157 AC_DEFINE(LOGIN_NEEDS_TERM)
156 # hardwire lastlog location (can't detect it on some versions) 158 # hardwire lastlog location (can't detect it on some versions)
157 conf_lastlog_location="/var/adm/lastlog" 159 conf_lastlog_location="/var/adm/lastlog"
158 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x) 160 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
diff --git a/loginrec.c b/loginrec.c
index c703663ae..e121ce354 100644
--- a/loginrec.c
+++ b/loginrec.c
@@ -163,7 +163,7 @@
163#include "log.h" 163#include "log.h"
164#include "atomicio.h" 164#include "atomicio.h"
165 165
166RCSID("$Id: loginrec.c,v 1.32 2001/02/22 21:23:21 stevesk Exp $"); 166RCSID("$Id: loginrec.c,v 1.33 2001/05/08 20:33:06 mouring Exp $");
167 167
168#ifdef HAVE_UTIL_H 168#ifdef HAVE_UTIL_H
169# include <util.h> 169# include <util.h>
@@ -443,6 +443,27 @@ login_write (struct logininfo *li)
443 return 0; 443 return 0;
444} 444}
445 445
446#ifdef LOGIN_NEEDS_UTMPX
447int
448login_utmp_only(struct logininfo *li)
449{
450 li->type = LTYPE_LOGIN;
451# ifdef USE_UTMP
452 utmp_write_entry(li);
453# endif
454# ifdef USE_WTMP
455 wtmp_write_entry(li);
456# endif
457# ifdef USE_UTMPX
458 utmpx_write_entry(li);
459# endif
460# ifdef USE_WTMPX
461 wtmpx_write_entry(li);
462# endif
463 return 0;
464}
465#endif
466
446/** 467/**
447 ** getlast_entry: Call low-level functions to retrieve the last login 468 ** getlast_entry: Call low-level functions to retrieve the last login
448 ** time. 469 ** time.
diff --git a/loginrec.h b/loginrec.h
index ecb430d50..732e21e11 100644
--- a/loginrec.h
+++ b/loginrec.h
@@ -40,7 +40,7 @@
40#include <netinet/in.h> 40#include <netinet/in.h>
41#include <sys/socket.h> 41#include <sys/socket.h>
42 42
43/* RCSID("$Id: loginrec.h,v 1.5 2001/02/05 12:42:18 stevesk Exp $"); */ 43/* RCSID("$Id: loginrec.h,v 1.6 2001/05/08 20:33:06 mouring Exp $"); */
44 44
45/** 45/**
46 ** you should use the login_* calls to work around platform dependencies 46 ** you should use the login_* calls to work around platform dependencies
@@ -110,6 +110,9 @@ void login_set_current_time(struct logininfo *li);
110/* record the entry */ 110/* record the entry */
111int login_login (struct logininfo *li); 111int login_login (struct logininfo *li);
112int login_logout(struct logininfo *li); 112int login_logout(struct logininfo *li);
113#ifdef LOGIN_NEEDS_UTMPX
114int login_utmp_only(struct logininfo *li);
115#endif
113 116
114/** End of public functions */ 117/** End of public functions */
115 118
diff --git a/session.c b/session.c
index 440b517be..62026c670 100644
--- a/session.c
+++ b/session.c
@@ -127,6 +127,9 @@ void session_proctitle(Session *s);
127void do_exec_pty(Session *s, const char *command); 127void do_exec_pty(Session *s, const char *command);
128void do_exec_no_pty(Session *s, const char *command); 128void do_exec_no_pty(Session *s, const char *command);
129void do_login(Session *s, const char *command); 129void do_login(Session *s, const char *command);
130#ifdef LOGIN_NEEDS_UTMPX
131void do_pre_login(Session *s);
132#endif
130void do_child(Session *s, const char *command); 133void do_child(Session *s, const char *command);
131void do_motd(void); 134void do_motd(void);
132int check_quietlogin(Session *s, const char *command); 135int check_quietlogin(Session *s, const char *command);
@@ -644,6 +647,10 @@ do_exec_pty(Session *s, const char *command)
644#ifndef HAVE_OSF_SIA 647#ifndef HAVE_OSF_SIA
645 if (!(options.use_login && command == NULL)) 648 if (!(options.use_login && command == NULL))
646 do_login(s, command); 649 do_login(s, command);
650# ifdef LOGIN_NEEDS_UTMPX
651 else
652 do_pre_login(s);
653# endif
647#endif 654#endif
648 655
649 /* Do common processing for the child, such as execing the command. */ 656 /* Do common processing for the child, such as execing the command. */
@@ -687,6 +694,34 @@ do_exec_pty(Session *s, const char *command)
687 } 694 }
688} 695}
689 696
697#ifdef LOGIN_NEEDS_UTMPX
698void
699do_pre_login(Session *s)
700{
701 socklen_t fromlen;
702 struct sockaddr_storage from;
703 pid_t pid = getpid();
704
705 /*
706 * Get IP address of client. If the connection is not a socket, let
707 * the address be 0.0.0.0.
708 */
709 memset(&from, 0, sizeof(from));
710 if (packet_connection_is_on_socket()) {
711 fromlen = sizeof(from);
712 if (getpeername(packet_get_connection_in(),
713 (struct sockaddr *) & from, &fromlen) < 0) {
714 debug("getpeername: %.100s", strerror(errno));
715 fatal_cleanup();
716 }
717 }
718
719 record_utmp_only(pid, s->tty, s->pw->pw_name,
720 get_remote_name_or_ip(utmp_len, options.reverse_mapping_check),
721 (struct sockaddr *)&from);
722}
723#endif
724
690/* administrative, login(1)-like work */ 725/* administrative, login(1)-like work */
691void 726void
692do_login(Session *s, const char *command) 727do_login(Session *s, const char *command)
@@ -1511,6 +1546,9 @@ do_child(Session *s, const char *command)
1511 /* Launch login(1). */ 1546 /* Launch login(1). */
1512 1547
1513 execl(LOGIN_PROGRAM, "login", "-h", hostname, 1548 execl(LOGIN_PROGRAM, "login", "-h", hostname,
1549#ifdef LOGIN_NEEDS_TERM
1550 s->term? s->term : "unknown",
1551#endif
1514 "-p", "-f", "--", pw->pw_name, NULL); 1552 "-p", "-f", "--", pw->pw_name, NULL);
1515 1553
1516 /* Login couldn't be executed, die. */ 1554 /* Login couldn't be executed, die. */
diff --git a/sshlogin.c b/sshlogin.c
index 1d9c031c4..b7558b9e9 100644
--- a/sshlogin.c
+++ b/sshlogin.c
@@ -77,6 +77,20 @@ record_login(pid_t pid, const char *ttyname, const char *user, uid_t uid,
77 login_free_entry(li); 77 login_free_entry(li);
78} 78}
79 79
80#ifdef LOGIN_NEEDS_UTMPX
81void
82record_utmp_only(pid_t pid, const char *ttyname, const char *user,
83 const char *host, struct sockaddr * addr)
84{
85 struct logininfo *li;
86
87 li = login_alloc_entry(pid, user, host, ttyname);
88 login_set_addr(li, addr, sizeof(struct sockaddr));
89 login_utmp_only(li);
90 login_free_entry(li);
91}
92#endif
93
80/* Records that the user has logged out. */ 94/* Records that the user has logged out. */
81 95
82void 96void
diff --git a/sshlogin.h b/sshlogin.h
index 7285bc23e..f0d500ee3 100644
--- a/sshlogin.h
+++ b/sshlogin.h
@@ -31,6 +31,15 @@ void
31record_login(pid_t pid, const char *ttyname, const char *user, uid_t uid, 31record_login(pid_t pid, const char *ttyname, const char *user, uid_t uid,
32 const char *host, struct sockaddr *addr); 32 const char *host, struct sockaddr *addr);
33 33
34#ifdef LOGIN_NEEDS_UTMPX
35/*
36 * Record just the utmp info for /bin/login.
37 */
38void
39record_utmp_only(pid_t pid, const char *ttyname, const char *user,
40 const char *host, struct sockaddr * addr);
41#endif
42
34/* 43/*
35 * Records that the user has logged out. This does many thigs normally done 44 * Records that the user has logged out. This does many thigs normally done
36 * by login(1) or init. 45 * by login(1) or init.