summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2000-08-15 10:01:22 +1000
committerDamien Miller <djm@mindrot.org>2000-08-15 10:01:22 +1000
commit348c9b7a9564986000743fe379de21ae6f73f7d4 (patch)
treec12f2adbd94e7298b0cc26d5891ddea58c59ce61
parentef7ed5eadf75a06fd9d9cd9868cd5f4072ae9e56 (diff)
- (djm) More SunOS 4.1.x fixes from Nate Itkin <nitkin@europa.com>
-rw-r--r--CREDITS1
-rw-r--r--ChangeLog3
-rw-r--r--configure.in4
-rw-r--r--includes.h3
-rw-r--r--loginrec.c40
-rw-r--r--session.c5
6 files changed, 43 insertions, 13 deletions
diff --git a/CREDITS b/CREDITS
index 59ffd5531..67f694bcd 100644
--- a/CREDITS
+++ b/CREDITS
@@ -49,6 +49,7 @@ Marc G. Fournier <marc.fournier@acadiau.ca> - Solaris patches
49Matt Richards <v2matt@btv.ibm.com> - AIX patches 49Matt Richards <v2matt@btv.ibm.com> - AIX patches
50Michael Stone <mstone@cs.loyola.edu> - Irix enhancements 50Michael Stone <mstone@cs.loyola.edu> - Irix enhancements
51Nalin Dahyabhai <nalin.dahyabhai@pobox.com> - PAM environment patch 51Nalin Dahyabhai <nalin.dahyabhai@pobox.com> - PAM environment patch
52Nate Itkin <nitkin@europa.com> - SunOS 4.1.x fixes
52Niels Kristian Bech Jensen <nkbj@image.dk> - Assorted patches 53Niels Kristian Bech Jensen <nkbj@image.dk> - Assorted patches
53Peter Kocks <peter.kocks@baygate.com> - Makefile fixes 54Peter Kocks <peter.kocks@baygate.com> - Makefile fixes
54Phil Hands <phil@hands.com> - Debian scripts, assorted patches 55Phil Hands <phil@hands.com> - Debian scripts, assorted patches
diff --git a/ChangeLog b/ChangeLog
index f6e8746c8..de8ddf38e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
120000815
2 - (djm) More SunOS 4.1.x fixes from Nate Itkin <nitkin@europa.com>
3
120000813 420000813
2 - (djm) Add $(srcdir) to includes when compiling (for VPATH). Report from 5 - (djm) Add $(srcdir) to includes when compiling (for VPATH). Report from
3 Fabrice bacchella <fabrice.bacchella@marchfirst.fr> 6 Fabrice bacchella <fabrice.bacchella@marchfirst.fr>
diff --git a/configure.in b/configure.in
index c74f65b91..0c9e4fc66 100644
--- a/configure.in
+++ b/configure.in
@@ -221,10 +221,10 @@ if test -z "$no_libnsl" ; then
221fi 221fi
222 222
223# Checks for header files. 223# Checks for header files.
224AC_CHECK_HEADERS(bstring.h endian.h floatingpoint.h lastlog.h limits.h login.h maillock.h netdb.h netgroup.h netinet/in_systm.h paths.h poll.h pty.h shadow.h security/pam_appl.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h sys/poll.h sys/select.h sys/stat.h sys/stropts.h sys/sysmacros.h sys/time.h sys/ttcompat.h stddef.h time.h usersec.h util.h utmp.h utmpx.h) 224AC_CHECK_HEADERS(bstring.h endian.h floatingpoint.h lastlog.h limits.h login.h maillock.h netdb.h netgroup.h netinet/in_systm.h paths.h poll.h pty.h shadow.h security/pam_appl.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h sys/poll.h sys/select.h sys/stat.h sys/stropts.h sys/sysmacros.h sys/time.h sys/ttcompat.h stddef.h time.h ttyent.h usersec.h util.h utmp.h utmpx.h)
225 225
226# Checks for library functions. 226# Checks for library functions.
227AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_af clock freeaddrinfo gai_strerror getaddrinfo getnameinfo getrusage inet_aton innetgr md5_crypt memmove mkdtemp on_exit openpty rresvport_af setenv seteuid setlogin setproctitle setreuid sigaction sigvec snprintf strerror strlcat strlcpy strsep vsnprintf vhangup _getpty __b64_ntop) 227AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_af clock freeaddrinfo gai_strerror getaddrinfo getnameinfo getrusage getttyent inet_aton innetgr md5_crypt memmove mkdtemp on_exit openpty rresvport_af setenv seteuid setlogin setproctitle setreuid sigaction sigvec snprintf strerror strlcat strlcpy strsep vsnprintf vhangup _getpty __b64_ntop)
228dnl checks for time functions 228dnl checks for time functions
229AC_CHECK_FUNCS(gettimeofday time) 229AC_CHECK_FUNCS(gettimeofday time)
230dnl checks for libutil functions 230dnl checks for libutil functions
diff --git a/includes.h b/includes.h
index 2f3a56ec6..13042fd21 100644
--- a/includes.h
+++ b/includes.h
@@ -70,6 +70,9 @@ static /**/const char *const rcsid[] = { (char *)rcsid, "\100(#)" msg }
70#ifdef HAVE_SYS_BSDTTY_H 70#ifdef HAVE_SYS_BSDTTY_H
71# include <sys/bsdtty.h> 71# include <sys/bsdtty.h>
72#endif 72#endif
73#ifdef HAVE_TTYENT_H
74# include <ttyent.h>
75#endif
73#ifdef USE_PAM 76#ifdef USE_PAM
74# include <security/pam_appl.h> 77# include <security/pam_appl.h>
75#endif 78#endif
diff --git a/loginrec.c b/loginrec.c
index e7542c92a..798e966f0 100644
--- a/loginrec.c
+++ b/loginrec.c
@@ -160,7 +160,7 @@
160#include "xmalloc.h" 160#include "xmalloc.h"
161#include "loginrec.h" 161#include "loginrec.h"
162 162
163RCSID("$Id: loginrec.c,v 1.18 2000/08/09 06:34:28 djm Exp $"); 163RCSID("$Id: loginrec.c,v 1.19 2000/08/15 00:01:22 djm Exp $");
164 164
165/** 165/**
166 ** prototypes for helper functions in this file 166 ** prototypes for helper functions in this file
@@ -273,7 +273,7 @@ login_get_lastlog(struct logininfo *li, const int uid)
273{ 273{
274 struct passwd *pw; 274 struct passwd *pw;
275 275
276 memset(li, '\0', sizeof(struct logininfo)); 276 memset(li, '\0', sizeof(*li));
277 li->uid = uid; 277 li->uid = uid;
278 278
279 /* 279 /*
@@ -311,7 +311,7 @@ logininfo *login_alloc_entry(int pid, const char *username,
311{ 311{
312 struct logininfo *newli; 312 struct logininfo *newli;
313 313
314 newli = (struct logininfo *) xmalloc (sizeof(struct logininfo)); 314 newli = (struct logininfo *) xmalloc (sizeof(*newli));
315 (void)login_init_entry(newli, pid, username, hostname, line); 315 (void)login_init_entry(newli, pid, username, hostname, line);
316 return newli; 316 return newli;
317} 317}
@@ -339,7 +339,7 @@ login_init_entry(struct logininfo *li, int pid, const char *username,
339{ 339{
340 struct passwd *pw; 340 struct passwd *pw;
341 341
342 memset(li, 0, sizeof(struct logininfo)); 342 memset(li, 0, sizeof(*li));
343 343
344 li->pid = pid; 344 li->pid = pid;
345 345
@@ -569,7 +569,7 @@ void
569construct_utmp(struct logininfo *li, 569construct_utmp(struct logininfo *li,
570 struct utmp *ut) 570 struct utmp *ut)
571{ 571{
572 memset(ut, '\0', sizeof(struct utmp)); 572 memset(ut, '\0', sizeof(*ut));
573 573
574 /* First fill out fields used for both logins and logouts */ 574 /* First fill out fields used for both logins and logouts */
575 575
@@ -643,7 +643,7 @@ set_utmpx_time(struct logininfo *li, struct utmpx *utx)
643void 643void
644construct_utmpx(struct logininfo *li, struct utmpx *utx) 644construct_utmpx(struct logininfo *li, struct utmpx *utx)
645{ 645{
646 memset(utx, '\0', sizeof(struct utmpx)); 646 memset(utx, '\0', sizeof(*utx));
647# ifdef HAVE_ID_IN_UTMPX 647# ifdef HAVE_ID_IN_UTMPX
648 line_abbrevname(utx->ut_id, li->line, sizeof(utx->ut_id)); 648 line_abbrevname(utx->ut_id, li->line, sizeof(utx->ut_id));
649# endif 649# endif
@@ -723,8 +723,30 @@ utmp_write_direct(struct logininfo *li, struct utmp *ut)
723 int tty; 723 int tty;
724 724
725 /* FIXME: (ATL) ttyslot() needs local implementation */ 725 /* FIXME: (ATL) ttyslot() needs local implementation */
726
727#if defined(SUNOS4) && defined(HAVE_GETTTYENT)
728 register struct ttyent *ty;
729
730 tty=0;
731
732 setttyent();
733 while ((struct ttyent *)0 != (ty = getttyent())) {
734 tty++;
735 if (!strncmp(ty->ty_name, ut->ut_line, sizeof(ut->ut_line)))
736 break;
737 }
738 endttyent();
739
740 if((struct ttyent *)0 == ty) {
741 log("utmp_write_entry: tty not found");
742 return(1);
743 }
744#else /* FIXME */
745
726 tty = ttyslot(); /* seems only to work for /dev/ttyp? style names */ 746 tty = ttyslot(); /* seems only to work for /dev/ttyp? style names */
727 747
748#endif /* SUNOS4 && HAVE_GETTTYENT */
749
728 if (tty > 0 && (fd = open(UTMP_FILE, O_RDWR|O_CREAT, 0644)) >= 0) { 750 if (tty > 0 && (fd = open(UTMP_FILE, O_RDWR|O_CREAT, 0644)) >= 0) {
729 (void)lseek(fd, (off_t)(tty * sizeof(struct utmp)), SEEK_SET); 751 (void)lseek(fd, (off_t)(tty * sizeof(struct utmp)), SEEK_SET);
730 /* 752 /*
@@ -1031,7 +1053,7 @@ wtmp_get_entry(struct logininfo *li)
1031 } 1053 }
1032 1054
1033 /* Seek to the start of the last struct utmp */ 1055 /* Seek to the start of the last struct utmp */
1034 if (lseek(fd, (off_t)(0-sizeof(struct utmp)), SEEK_END) == -1) { 1056 if (lseek(fd, (off_t)(0 - sizeof(struct utmp)), SEEK_END) == -1) {
1035 /* Looks like we've got a fresh wtmp file */ 1057 /* Looks like we've got a fresh wtmp file */
1036 close(fd); 1058 close(fd);
1037 return 0; 1059 return 0;
@@ -1238,7 +1260,7 @@ syslogin_perform_login(struct logininfo *li)
1238{ 1260{
1239 struct utmp *ut; 1261 struct utmp *ut;
1240 1262
1241 if (! (ut = (struct utmp *)malloc(sizeof(struct utmp)))) { 1263 if (! (ut = (struct utmp *)malloc(sizeof(*ut)))) {
1242 log("syslogin_perform_login: couldn't malloc()"); 1264 log("syslogin_perform_login: couldn't malloc()");
1243 return 0; 1265 return 0;
1244 } 1266 }
@@ -1301,7 +1323,7 @@ static void
1301lastlog_construct(struct logininfo *li, struct lastlog *last) 1323lastlog_construct(struct logininfo *li, struct lastlog *last)
1302{ 1324{
1303 /* clear the structure */ 1325 /* clear the structure */
1304 memset(last, '\0', sizeof(struct lastlog)); 1326 memset(last, '\0', sizeof(*last));
1305 1327
1306 (void)line_stripname(last->ll_line, li->line, sizeof(last->ll_line)); 1328 (void)line_stripname(last->ll_line, li->line, sizeof(last->ll_line));
1307 strlcpy(last->ll_host, li->hostname, 1329 strlcpy(last->ll_host, li->hostname,
diff --git a/session.c b/session.c
index 388d96bb2..47787e778 100644
--- a/session.c
+++ b/session.c
@@ -601,8 +601,9 @@ do_exec_pty(Session *s, const char *command, struct passwd * pw)
601 } 601 }
602 } 602 }
603 /* Record that there was a login on that terminal. */ 603 /* Record that there was a login on that terminal. */
604 record_login(pid, s->tty, pw->pw_name, pw->pw_uid, hostname, 604 if (!options.use_login || command != NULL)
605 (struct sockaddr *)&from); 605 record_login(pid, s->tty, pw->pw_name, pw->pw_uid,
606 hostname, (struct sockaddr *)&from);
606 607
607 /* Check if .hushlogin exists. */ 608 /* Check if .hushlogin exists. */
608 snprintf(line, sizeof line, "%.200s/.hushlogin", pw->pw_dir); 609 snprintf(line, sizeof line, "%.200s/.hushlogin", pw->pw_dir);