diff options
author | Damien Miller <djm@mindrot.org> | 2000-07-11 12:15:54 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2000-07-11 12:15:54 +1000 |
commit | 7a0e5dc9811b6d33aa3f0bfe26af9a1af2884c8c (patch) | |
tree | 0c2f54e48a21fb39ca45f3a44ab8800085567687 | |
parent | 99bca607dc48d9a96285cfc224cd9e883b246151 (diff) |
- (djm) Fix broken inet_ntoa check and ut_user/ut_name confusion, report
from Jim Watt <jimw@peisj.pebio.com>
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | fake-getaddrinfo.c | 2 | ||||
-rw-r--r-- | loginrec.c | 18 |
3 files changed, 12 insertions, 10 deletions
@@ -4,6 +4,8 @@ | |||
4 | - (djm) ReliantUNIX support from Udo Schweigert <ust@cert.siemens.de> | 4 | - (djm) ReliantUNIX support from Udo Schweigert <ust@cert.siemens.de> |
5 | - (djm) NeXT: dirent structures to get scp working from Ben Lindstrom | 5 | - (djm) NeXT: dirent structures to get scp working from Ben Lindstrom |
6 | <mouring@pconline.com> | 6 | <mouring@pconline.com> |
7 | - (djm) Fix broken inet_ntoa check and ut_user/ut_name confusion, report | ||
8 | from Jim Watt <jimw@peisj.pebio.com> | ||
7 | 9 | ||
8 | 20000709 | 10 | 20000709 |
9 | - (djm) Only enable PAM_TTY kludge for Linux. Problem report from | 11 | - (djm) Only enable PAM_TTY kludge for Linux. Problem report from |
diff --git a/fake-getaddrinfo.c b/fake-getaddrinfo.c index c9bc03a35..73c122ed1 100644 --- a/fake-getaddrinfo.c +++ b/fake-getaddrinfo.c | |||
@@ -87,7 +87,7 @@ int getaddrinfo(const char *hostname, const char *servname, | |||
87 | return EAI_MEMORY; | 87 | return EAI_MEMORY; |
88 | } | 88 | } |
89 | 89 | ||
90 | if (inet_aton(hostname, &in) != -1) { | 90 | if (inet_aton(hostname, &in)) { |
91 | if (NULL != (*res = malloc_ai(port, in.s_addr))) | 91 | if (NULL != (*res = malloc_ai(port, in.s_addr))) |
92 | return 0; | 92 | return 0; |
93 | else | 93 | else |
diff --git a/loginrec.c b/loginrec.c index c4e6c4aa9..8b82fa29d 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 | ||
163 | RCSID("$Id: loginrec.c,v 1.16 2000/07/09 13:26:28 djm Exp $"); | 163 | RCSID("$Id: loginrec.c,v 1.17 2000/07/11 02:15:54 djm Exp $"); |
164 | 164 | ||
165 | /** | 165 | /** |
166 | ** prototypes for helper functions in this file | 166 | ** prototypes for helper functions in this file |
@@ -606,7 +606,7 @@ construct_utmp(struct logininfo *li, | |||
606 | */ | 606 | */ |
607 | 607 | ||
608 | /* Use strncpy because we don't necessarily want null termination */ | 608 | /* Use strncpy because we don't necessarily want null termination */ |
609 | strncpy(ut->ut_user, li->username, MIN_SIZEOF(ut->ut_user, li->username)); | 609 | strncpy(ut->ut_name, li->username, MIN_SIZEOF(ut->ut_name, li->username)); |
610 | # ifdef HAVE_HOST_IN_UTMP | 610 | # ifdef HAVE_HOST_IN_UTMP |
611 | strncpy(ut->ut_host, li->hostname, MIN_SIZEOF(ut->ut_host, li->hostname)); | 611 | strncpy(ut->ut_host, li->hostname, MIN_SIZEOF(ut->ut_host, li->hostname)); |
612 | # endif | 612 | # endif |
@@ -670,7 +670,7 @@ construct_utmpx(struct logininfo *li, struct utmpx *utx) | |||
670 | */ | 670 | */ |
671 | 671 | ||
672 | /* strncpy(): Don't necessarily want null termination */ | 672 | /* strncpy(): Don't necessarily want null termination */ |
673 | strncpy(utx->ut_user, li->username, MIN_SIZEOF(utx->ut_user, li->username)); | 673 | strncpy(utx->ut_name, li->username, MIN_SIZEOF(utx->ut_name, li->username)); |
674 | # ifdef HAVE_HOST_IN_UTMPX | 674 | # ifdef HAVE_HOST_IN_UTMPX |
675 | strncpy(utx->ut_host, li->hostname, MIN_SIZEOF(utx->ut_host, li->hostname)); | 675 | strncpy(utx->ut_host, li->hostname, MIN_SIZEOF(utx->ut_host, li->hostname)); |
676 | # endif | 676 | # endif |
@@ -730,12 +730,12 @@ utmp_write_direct(struct logininfo *li, struct utmp *ut) | |||
730 | /* | 730 | /* |
731 | * Prevent luser from zero'ing out ut_host. | 731 | * Prevent luser from zero'ing out ut_host. |
732 | * If the new ut_line is empty but the old one is not | 732 | * If the new ut_line is empty but the old one is not |
733 | * and ut_line and ut_user match, preserve the old ut_line. | 733 | * and ut_line and ut_name match, preserve the old ut_line. |
734 | */ | 734 | */ |
735 | if (atomicio(read, fd, &old_ut, sizeof(old_ut)) == sizeof(old_ut) && | 735 | if (atomicio(read, fd, &old_ut, sizeof(old_ut)) == sizeof(old_ut) && |
736 | (ut->ut_host[0] == '\0') && (old_ut.ut_host[0] != '\0') && | 736 | (ut->ut_host[0] == '\0') && (old_ut.ut_host[0] != '\0') && |
737 | (strncmp(old_ut.ut_line, ut->ut_line, sizeof(ut->ut_line)) == 0) && | 737 | (strncmp(old_ut.ut_line, ut->ut_line, sizeof(ut->ut_line)) == 0) && |
738 | (strncmp(old_ut.ut_user, ut->ut_user, sizeof(ut->ut_user)) == 0)) { | 738 | (strncmp(old_ut.ut_name, ut->ut_name, sizeof(ut->ut_name)) == 0)) { |
739 | (void)memcpy(ut->ut_host, old_ut.ut_host, sizeof(ut->ut_host)); | 739 | (void)memcpy(ut->ut_host, old_ut.ut_host, sizeof(ut->ut_host)); |
740 | } | 740 | } |
741 | 741 | ||
@@ -996,8 +996,8 @@ wtmp_write_entry(struct logininfo *li) | |||
996 | static int | 996 | static int |
997 | wtmp_islogin(struct logininfo *li, struct utmp *ut) | 997 | wtmp_islogin(struct logininfo *li, struct utmp *ut) |
998 | { | 998 | { |
999 | if (strncmp(li->username, ut->ut_user, | 999 | if (strncmp(li->username, ut->ut_name, |
1000 | MIN_SIZEOF(li->username, ut->ut_user)) == 0) { | 1000 | MIN_SIZEOF(li->username, ut->ut_name)) == 0) { |
1001 | # ifdef HAVE_TYPE_IN_UTMP | 1001 | # ifdef HAVE_TYPE_IN_UTMP |
1002 | if (ut->ut_type & USER_PROCESS) | 1002 | if (ut->ut_type & USER_PROCESS) |
1003 | return 1; | 1003 | return 1; |
@@ -1151,8 +1151,8 @@ wtmpx_write_entry(struct logininfo *li) | |||
1151 | static int | 1151 | static int |
1152 | wtmpx_islogin(struct logininfo *li, struct utmpx *utx) | 1152 | wtmpx_islogin(struct logininfo *li, struct utmpx *utx) |
1153 | { | 1153 | { |
1154 | if ( strncmp(li->username, utx->ut_user, | 1154 | if ( strncmp(li->username, utx->ut_name, |
1155 | MIN_SIZEOF(li->username, utx->ut_user)) == 0 ) { | 1155 | MIN_SIZEOF(li->username, utx->ut_name)) == 0 ) { |
1156 | # ifdef HAVE_TYPE_IN_UTMPX | 1156 | # ifdef HAVE_TYPE_IN_UTMPX |
1157 | if (utx->ut_type == USER_PROCESS) | 1157 | if (utx->ut_type == USER_PROCESS) |
1158 | return 1; | 1158 | return 1; |