summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--auth.c7
-rw-r--r--configure.ac3
-rw-r--r--defines.h4
-rw-r--r--openbsd-compat/port-uw.c35
-rw-r--r--openbsd-compat/port-uw.h4
-rw-r--r--openbsd-compat/xcrypt.c9
-rw-r--r--session.c4
8 files changed, 51 insertions, 23 deletions
diff --git a/ChangeLog b/ChangeLog
index 139934ca1..8f3ffeda0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,4 @@
120050830 120050831
2 - (djm) OpenBSD CVS Sync 2 - (djm) OpenBSD CVS Sync
3 - djm@cvs.openbsd.org 2005/08/30 22:08:05 3 - djm@cvs.openbsd.org 2005/08/30 22:08:05
4 [gss-serv.c sshconnect2.c] 4 [gss-serv.c sshconnect2.c]
@@ -11,6 +11,10 @@
11 [version.h] 11 [version.h]
12 4.2 12 4.2
13 - (dtucker) [README] Update release note URL to 4.2 13 - (dtucker) [README] Update release note URL to 4.2
14 - (tim) [configure.ac auth.c defines.h session.c openbsd-compat/port-uw.c
15 openbsd-compat/port-uw.h openbsd-compat/xcrypt.c] libiaf cleanup. Disable
16 libiaf bits for OpenServer6. Free memory allocated by ia_get_logpwd().
17 Feedback and OK dtucker@
14 18
1520050830 1920050830
16 - (tim) [configure.ac] Back out last change. It needs to be done differently. 20 - (tim) [configure.ac] Back out last change. It needs to be done differently.
@@ -2982,4 +2986,4 @@
2982 - (djm) Trim deprecated options from INSTALL. Mention UsePAM 2986 - (djm) Trim deprecated options from INSTALL. Mention UsePAM
2983 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu 2987 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
2984 2988
2985$Id: ChangeLog,v 1.3885 2005/08/31 14:05:56 dtucker Exp $ 2989$Id: ChangeLog,v 1.3886 2005/08/31 16:59:49 tim Exp $
diff --git a/auth.c b/auth.c
index d62d8ff22..2dc5c2be6 100644
--- a/auth.c
+++ b/auth.c
@@ -97,11 +97,11 @@ allowed_user(struct passwd * pw)
97 /* grab passwd field for locked account check */ 97 /* grab passwd field for locked account check */
98#ifdef USE_SHADOW 98#ifdef USE_SHADOW
99 if (spw != NULL) 99 if (spw != NULL)
100#ifdef HAVE_LIBIAF 100#if defined(HAVE_LIBIAF) && !defined(BROKEN_LIBIAF)
101 passwd = get_iaf_password(pw); 101 passwd = get_iaf_password(pw);
102#else 102#else
103 passwd = spw->sp_pwdp; 103 passwd = spw->sp_pwdp;
104#endif /* HAVE_LIBIAF */ 104#endif /* HAVE_LIBIAF && !BROKEN_LIBIAF */
105#else 105#else
106 passwd = pw->pw_passwd; 106 passwd = pw->pw_passwd;
107#endif 107#endif
@@ -123,6 +123,9 @@ allowed_user(struct passwd * pw)
123 if (strstr(passwd, LOCKED_PASSWD_SUBSTR)) 123 if (strstr(passwd, LOCKED_PASSWD_SUBSTR))
124 locked = 1; 124 locked = 1;
125#endif 125#endif
126#if defined(HAVE_LIBIAF) && !defined(BROKEN_LIBIAF)
127 free(passwd);
128#endif /* HAVE_LIBIAF && !BROKEN_LIBIAF */
126 if (locked) { 129 if (locked) {
127 logit("User %.100s not allowed because account is locked", 130 logit("User %.100s not allowed because account is locked",
128 pw->pw_name); 131 pw->pw_name);
diff --git a/configure.ac b/configure.ac
index 2834c5802..1e4df2e33 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
1# $Id: configure.ac,v 1.291 2005/08/30 14:12:02 tim Exp $ 1# $Id: configure.ac,v 1.292 2005/08/31 16:59:49 tim Exp $
2# 2#
3# Copyright (c) 1999-2004 Damien Miller 3# Copyright (c) 1999-2004 Damien Miller
4# 4#
@@ -456,6 +456,7 @@ mips-sony-bsd|mips-sony-newsos4)
456 case "$host" in 456 case "$host" in
457 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x 457 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
458 TEST_SHELL=/u95/bin/sh 458 TEST_SHELL=/u95/bin/sh
459 AC_DEFINE(BROKEN_LIBIAF, 1, [ia_uinfo routines not supported by OS yet])
459 ;; 460 ;;
460 esac 461 esac
461 ;; 462 ;;
diff --git a/defines.h b/defines.h
index 8d3617d06..408b988b5 100644
--- a/defines.h
+++ b/defines.h
@@ -25,7 +25,7 @@
25#ifndef _DEFINES_H 25#ifndef _DEFINES_H
26#define _DEFINES_H 26#define _DEFINES_H
27 27
28/* $Id: defines.h,v 1.126 2005/08/26 20:15:20 tim Exp $ */ 28/* $Id: defines.h,v 1.127 2005/08/31 16:59:49 tim Exp $ */
29 29
30 30
31/* Constants */ 31/* Constants */
@@ -688,7 +688,7 @@ struct winsize {
688# define CUSTOM_SYS_AUTH_PASSWD 1 688# define CUSTOM_SYS_AUTH_PASSWD 1
689#endif 689#endif
690 690
691#ifdef UNIXWARE_LONG_PASSWORDS 691#if defined(HAVE_LIBIAF) && !defined(BROKEN_LIBIAF)
692# define CUSTOM_SYS_AUTH_PASSWD 1 692# define CUSTOM_SYS_AUTH_PASSWD 1
693#endif 693#endif
694 694
diff --git a/openbsd-compat/port-uw.c b/openbsd-compat/port-uw.c
index cbc3f686b..d881ff028 100644
--- a/openbsd-compat/port-uw.c
+++ b/openbsd-compat/port-uw.c
@@ -25,7 +25,7 @@
25 25
26#include "includes.h" 26#include "includes.h"
27 27
28#ifdef UNIXWARE_LONG_PASSWORDS 28#if defined(HAVE_LIBIAF) && !defined(BROKEN_LIBIAF)
29#ifdef HAVE_CRYPT_H 29#ifdef HAVE_CRYPT_H
30#include <crypt.h> 30#include <crypt.h>
31#endif 31#endif
@@ -44,6 +44,7 @@ sys_auth_passwd(Authctxt *authctxt, const char *password)
44 struct passwd *pw = authctxt->pw; 44 struct passwd *pw = authctxt->pw;
45 char *encrypted_password; 45 char *encrypted_password;
46 char *salt; 46 char *salt;
47 int result;
47 48
48 /* Just use the supplied fake password if authctxt is invalid */ 49 /* Just use the supplied fake password if authctxt is invalid */
49 char *pw_password = authctxt->valid ? shadow_pw(pw) : pw->pw_passwd; 50 char *pw_password = authctxt->valid ? shadow_pw(pw) : pw->pw_passwd;
@@ -52,13 +53,27 @@ sys_auth_passwd(Authctxt *authctxt, const char *password)
52 if (strcmp(pw_password, "") == 0 && strcmp(password, "") == 0) 53 if (strcmp(pw_password, "") == 0 && strcmp(password, "") == 0)
53 return (1); 54 return (1);
54 55
56 /* Encrypt the candidate password using the proper salt. */
55 salt = (pw_password[0] && pw_password[1]) ? pw_password : "xx"; 57 salt = (pw_password[0] && pw_password[1]) ? pw_password : "xx";
56 if (nischeck(pw->pw_name)) 58#ifdef UNIXWARE_LONG_PASSWORDS
57 return(strcmp(crypt(password, salt), pw_password) == 0); 59 if (!nischeck(pw->pw_name))
60 encrypted_password = bigcrypt(password, salt);
58 else 61 else
59 return(strcmp(bigcrypt(password, salt), pw_password) == 0); 62#endif /* UNIXWARE_LONG_PASSWORDS */
63 encrypted_password = xcrypt(password, salt);
64
65 /*
66 * Authentication is accepted if the encrypted passwords
67 * are identical.
68 */
69 result = (strcmp(encrypted_password, pw_password) == 0);
70
71 if (authctxt->valid)
72 free(pw_password);
73 return(result);
60} 74}
61 75
76#ifdef UNIXWARE_LONG_PASSWORDS
62int 77int
63nischeck(char *namep) 78nischeck(char *namep)
64{ 79{
@@ -94,7 +109,11 @@ nischeck(char *namep)
94 109
95#endif /* UNIXWARE_LONG_PASSWORDS */ 110#endif /* UNIXWARE_LONG_PASSWORDS */
96 111
97#ifdef HAVE_LIBIAF 112/*
113 NOTE: ia_get_logpwd() allocates memory for arg 2
114 functions that call shadow_pw() will need to free
115 */
116
98char * 117char *
99get_iaf_password(struct passwd *pw) 118get_iaf_password(struct passwd *pw)
100{ 119{
@@ -104,12 +123,12 @@ get_iaf_password(struct passwd *pw)
104 if (!ia_openinfo(pw->pw_name,&uinfo)) { 123 if (!ia_openinfo(pw->pw_name,&uinfo)) {
105 ia_get_logpwd(uinfo, &pw_password); 124 ia_get_logpwd(uinfo, &pw_password);
106 if (pw_password == NULL) 125 if (pw_password == NULL)
107 fatal("Unable to get the shadow passwd"); 126 fatal("ia_get_logpwd: Unable to get the shadow passwd");
108 ia_closeinfo(uinfo); 127 ia_closeinfo(uinfo);
109 return pw_password; 128 return pw_password;
110 } 129 }
111 else 130 else
112 fatal("Unable to open the shadow passwd file"); 131 fatal("ia_openinfo: Unable to open the shadow passwd file");
113} 132}
114#endif /* HAVE_LIBIAF */ 133#endif /* HAVE_LIBIAF && !BROKEN_LIBIAF */
115 134
diff --git a/openbsd-compat/port-uw.h b/openbsd-compat/port-uw.h
index f16bb5e5c..3589b2e44 100644
--- a/openbsd-compat/port-uw.h
+++ b/openbsd-compat/port-uw.h
@@ -24,7 +24,7 @@
24 24
25#include "includes.h" 25#include "includes.h"
26 26
27#ifdef HAVE_LIBIAF 27#if defined(HAVE_LIBIAF) && !defined(BROKEN_LIBIAF)
28char * get_iaf_password(struct passwd *pw); 28char * get_iaf_password(struct passwd *pw);
29#endif /* HAVE_LIBIAF */ 29#endif
30 30
diff --git a/openbsd-compat/xcrypt.c b/openbsd-compat/xcrypt.c
index 453203270..9afa0b9f2 100644
--- a/openbsd-compat/xcrypt.c
+++ b/openbsd-compat/xcrypt.c
@@ -91,12 +91,13 @@ shadow_pw(struct passwd *pw)
91 struct spwd *spw = getspnam(pw->pw_name); 91 struct spwd *spw = getspnam(pw->pw_name);
92 92
93 if (spw != NULL) 93 if (spw != NULL)
94#ifdef HAVE_LIBIAF
95 pw_password = get_iaf_password(pw);
96#else
97 pw_password = spw->sp_pwdp; 94 pw_password = spw->sp_pwdp;
98#endif /* HAVE_LIBIAF */
99# endif 95# endif
96
97#if defined(HAVE_LIBIAF) && !defined(BROKEN_LIBIAF)
98 return(get_iaf_password(pw));
99#endif
100
100# if defined(HAVE_GETPWANAM) && !defined(DISABLE_SHADOW) 101# if defined(HAVE_GETPWANAM) && !defined(DISABLE_SHADOW)
101 struct passwd_adjunct *spw; 102 struct passwd_adjunct *spw;
102 if (issecure() && (spw = getpwanam(pw->pw_name)) != NULL) 103 if (issecure() && (spw = getpwanam(pw->pw_name)) != NULL)
diff --git a/session.c b/session.c
index 98bd3121c..db8722f47 100644
--- a/session.c
+++ b/session.c
@@ -1334,11 +1334,11 @@ do_setusercontext(struct passwd *pw)
1334# ifdef _AIX 1334# ifdef _AIX
1335 aix_usrinfo(pw); 1335 aix_usrinfo(pw);
1336# endif /* _AIX */ 1336# endif /* _AIX */
1337# ifdef HAVE_LIBIAF 1337#if defined(HAVE_LIBIAF) && !defined(BROKEN_LIBIAF)
1338 if (set_id(pw->pw_name) != 0) { 1338 if (set_id(pw->pw_name) != 0) {
1339 exit(1); 1339 exit(1);
1340 } 1340 }
1341# endif 1341#endif /* HAVE_LIBIAF && !BROKEN_LIBIAF */
1342 /* Permanently switch to the desired uid. */ 1342 /* Permanently switch to the desired uid. */
1343 permanently_set_uid(pw); 1343 permanently_set_uid(pw);
1344#endif 1344#endif