Compare commits

...
19 Commits
Author SHA1 Message Date
Damien Miller 7b63b0f66e - Doc cleanup 2000-05-20 15:41:26 +10:00
Damien Miller fda78d9bd0 - HPUX and Configure fixes from Lutz Jaenicke
<[email protected]>
 - Use mkinstalldirs script to make directories instead of non-portable
   "install -d". Suggested by Lutz Jaenicke <[email protected]>
2000-05-20 15:33:44 +10:00
Damien Miller 7d6656c128 cleanup diffs 2000-05-20 15:22:36 +10:00
Damien Miller dfc83f42eb - SunOS 4.x support from Todd C. Miller <[email protected]> 2000-05-20 15:02:59 +10:00
Damien Miller ad1bc5f986 - Don't touch utmp if USE_UTMPX defined 2000-05-20 14:53:09 +10:00
Damien Miller d999ae26b7 - Xauth fix from Markus Friedl <[email protected]> 2000-05-20 12:49:31 +10:00
Damien Miller ef7df54073 - Include Andre Lucas' fixprogs script. Forgot to "cvs add" it yesterday
- OpenBSD CVS updates:
  - [email protected]
    [sshconnect.c]
    copy only ai_addrlen bytes; [email protected]
    [auth.c]
    accept an empty shell in authentication; bug reported by
    [email protected]
    [serverloop.c]
    we don't have stderr for interactive terminal sessions (fcntl errors)
2000-05-19 00:03:23 +10:00
Damien Miller 912d9752c2 Doh - forgot to import fixprogs 2000-05-18 23:12:50 +10:00
Damien Miller cce494a4c8 prepare for p1 release 2000-05-17 23:36:56 +10:00
Damien Miller 3b512e18dc - Detect OpenSSL seperatly from RSA
- Better test for RSA (more compatible with RSAref). Based on work by
   Ed Eden <[email protected]>
2000-05-17 23:29:18 +10:00
Damien Miller c4be7ce669 - RSAless operation patch from [email protected] 2000-05-17 23:02:03 +10:00
Damien Miller 615f939ebb - Several patches from SAKAI Kiyotaka <[email protected]>
- INSTALL typo and URL fix
  - Makefile fix
  - Solaris fixes
 - Checking for ssize_t and memmove. Based on patch from SAKAI Kiyotaka
   <[email protected]>
2000-05-17 22:53:33 +10:00
Damien Miller dcb6ecd1b3 - OpenBSD CVS update:
- [email protected]
    [ssh.c]
    fix usage()
    [ssh2.h]
    draft-ietf-secsh-architecture-05.txt
    [ssh.1]
    document ssh -T -N (ssh2 only)
    [channels.c serverloop.c ssh.h sshconnect.c sshd.c aux.c]
    enable nonblocking IO for sshd w/ proto 1, too; split out common code
    [aux.c]
    missing include
2000-05-17 22:34:22 +10:00
Damien Miller 0e65eed58a - Fix HAVE_PAM_GETENVLIST setting from Simon Wilkinson <[email protected]> 2000-05-17 22:16:05 +10:00
Damien Miller f3c6cf1383 - Avoid WCOREDUMP complation errors for systems that lack it
- Avoid SIGCHLD warnings from entropy commands
2000-05-17 22:08:29 +10:00
Damien Miller d2c208a2d3 - Applied Tom Bertelson's <[email protected]> AIX authentication fix 2000-05-17 22:00:02 +10:00
Damien Miller 8d1fd57a97 - Fix from Andre Lucas <[email protected]>
- Fixes command line printing segfaults (spotter: Bladt Norbert)
  - Fixes erroneous printing of debug messages to syslog
  - Fixes utmp for MacOS X (spotter: Aristedes Maniatis)
  - Gives useful error message if PRNG initialisation fails
  - Reduced ssh startup delay
  - Measures cumulative command time rather than the time between reads
	 after select()
  - 'fixprogs' perl script to eliminate non-working entropy commands, and
	 optionally run 'ent' to measure command entropy
2000-05-17 21:34:07 +10:00
Damien Miller 95fe91bd84 - Fix for non-recognised DSA keys from Arkadiusz Miskiewicz
<[email protected]>
2000-05-13 12:31:22 +10:00
Damien Miller accfeb3afe - Fix for prng_seed permissions checking from Lutz Jaenicke
<[email protected]>
2000-05-11 19:10:58 +10:00
32 changed files with 626 additions and 186 deletions

No files matched your search

+6
View File
@@ -20,6 +20,7 @@ David Agraz <[email protected]> - Build fixes
David Del Piero <[email protected]> - bug fixes
David Hesprich <[email protected]> - Configure fixes
David Rankin <[email protected]> - libwrap, AIX, NetBSD fixes
Ed Eden <[email protected]> - configure fixes
Gary E. Miller <[email protected]> - SCO support
Ged Lodder <[email protected]> - HPUX fixes and enhancements
Gert Doering <[email protected]> - bug and portability fixes
@@ -33,7 +34,9 @@ Jim Knoble <[email protected]> - Many patches
jonchen (email unknown) - the original author of PAM support of SSH
Juergen Keil <[email protected]> - scp bugfixing
Kees Cook <[email protected]> - scp fixes
Kevin O'Connor <[email protected]> - RSAless operation
Kiyokazu SUTO <[email protected]> - Bugfixes
Lutz Jaenicke <[email protected]> - Bugfixes
Marc G. Fournier <[email protected]> - Solaris patches
Matt Richards <[email protected]> - AIX patches
Nalin Dahyabhai <[email protected]> - PAM environment patch
@@ -41,7 +44,10 @@ Niels Kristian Bech Jensen <[email protected]> - Assorted patches
Peter Kocks <[email protected]> - Makefile fixes
Phil Hands <[email protected]> - Debian scripts, assorted patches
Phil Karn <[email protected]> - Autoconf fix
SAKAI Kiyotaka <[email protected]> - Multiple bugfixes
Simon Wilkinson <[email protected]> - PAM fixes
Thomas Neumann <[email protected]> - Shadow passwords
Tom Bertelson's <[email protected]> - AIX auth fixes
Tor-Ake Fransson <[email protected]> - AIX support
Tudor Bosman <[email protected]> - MD5 password support
+70
View File
@@ -1,3 +1,73 @@
20000520
- Xauth fix from Markus Friedl <[email protected]>
- Don't touch utmp if USE_UTMPX defined
- SunOS 4.x support from Todd C. Miller <[email protected]>
- SIGCHLD fix for AIX and HPUX from Tom Bertelson <[email protected]>
- HPUX and Configure fixes from Lutz Jaenicke
<[email protected]>
- Use mkinstalldirs script to make directories instead of non-portable
"install -d". Suggested by Lutz Jaenicke <[email protected]>
- Doc cleanup
20000518
- Include Andre Lucas' fixprogs script. Forgot to "cvs add" it yesterday
- OpenBSD CVS updates:
- [email protected]
[sshconnect.c]
copy only ai_addrlen bytes; [email protected]
[auth.c]
accept an empty shell in authentication; bug reported by
[email protected]
[serverloop.c]
we don't have stderr for interactive terminal sessions (fcntl errors)
20000517
- Fix from Andre Lucas <[email protected]>
- Fixes command line printing segfaults (spotter: Bladt Norbert)
- Fixes erroneous printing of debug messages to syslog
- Fixes utmp for MacOS X (spotter: Aristedes Maniatis)
- Gives useful error message if PRNG initialisation fails
- Reduced ssh startup delay
- Measures cumulative command time rather than the time between reads
after select()
- 'fixprogs' perl script to eliminate non-working entropy commands, and
optionally run 'ent' to measure command entropy
- Applied Tom Bertelson's <[email protected]> AIX authentication fix
- Avoid WCOREDUMP complation errors for systems that lack it
- Avoid SIGCHLD warnings from entropy commands
- Fix HAVE_PAM_GETENVLIST setting from Simon Wilkinson <[email protected]>
- OpenBSD CVS update:
- [email protected]
[ssh.c]
fix usage()
[ssh2.h]
draft-ietf-secsh-architecture-05.txt
[ssh.1]
document ssh -T -N (ssh2 only)
[channels.c serverloop.c ssh.h sshconnect.c sshd.c aux.c]
enable nonblocking IO for sshd w/ proto 1, too; split out common code
[aux.c]
missing include
- Several patches from SAKAI Kiyotaka <[email protected]>
- INSTALL typo and URL fix
- Makefile fix
- Solaris fixes
- Checking for ssize_t and memmove. Based on patch from SAKAI Kiyotaka
<[email protected]>
- RSAless operation patch from [email protected]
- Detect OpenSSL seperatly from RSA
- Better test for RSA (more compatible with RSAref). Based on work by
Ed Eden <[email protected]>
20000513
- Fix for non-recognised DSA keys from Arkadiusz Miskiewicz
<[email protected]>
20000511
- Fix for prng_seed permissions checking from Lutz Jaenicke
<[email protected]>
- "make host-key" fix for Irix
20000509
- OpenBSD CVS update
- [email protected]
+5 -6
View File
@@ -4,13 +4,12 @@
You will need working installations of Zlib and OpenSSL.
Zlib:
http://www.cdrom.com/pub/infozip/zlib/
http://www.freesoftware.com/pub/infozip/zlib/
OpenSSL 0.9.5a or greater:
http://www.openssl.org/
RPMs of OpenSSL are available in the support/ directory of the OpenSSH
mirror site. OpenSSH requires OpenSSL version 0.9.5 or later.
RPMs of OpenSSL are available at http://violet.ibs.com.au/openssh/files/support
OpenSSH can utilise Pluggable Authentication Modules (PAM) if your system
supports it. PAM is standard on Redhat and Debian Linux and on Solaris.
@@ -90,7 +89,7 @@ need a working installation of GNOME, including the development
headers, for this to work.
--with-random=/some/file allows you to specify an alternate source of
random numbers (the default is /dev/urandom). Unless you are absolutly
random numbers (the default is /dev/urandom). Unless you are absolutely
sure of what you are doing, it is best to leave this alone.
--with-egd-pool=/some/file allows you to enable Entropy Gathering
@@ -152,7 +151,7 @@ are installed.
real (AF_INET) IPv4 addresses. Works around some quirks on Linux.
If you need to pass special options to the compiler or linker, you
can specify these as enviornment variables before running ./configure.
can specify these as environment variables before running ./configure.
For example:
CFLAGS="-O -m486" LFLAGS="-s" LIBS="-lrubbish" LD="/usr/foo/ld" ./configure
@@ -186,5 +185,5 @@ for sshd, ssh and ssh-agent.
If you experience problems compiling, installing or running OpenSSH.
Please refer to the "reporting bugs" section of the webpage at
http://violet.ibs.com.au/openssh/
http://www.openssh.com/
+15 -13
View File
@@ -27,13 +27,14 @@ AR=@AR@
RANLIB=@RANLIB@
INSTALL=@INSTALL@
PERL=@PERL@
ENT=@ENT@
LDFLAGS=-L. @LDFLAGS@
INSTALL_SSH_PRNG_CMDS=@INSTALL_SSH_PRNG_CMDS@
TARGETS=ssh sshd ssh-add ssh-keygen ssh-agent scp $(EXTRA_TARGETS)
LIBSSH_OBJS=atomicio.o authfd.o authfile.o bufaux.o buffer.o canohost.o channels.o cipher.o compat.o compress.o crc32.o deattack.o dispatch.o dsa.o fingerprint.o hmac.o hostfile.o key.o kex.o log.o match.o mpaux.o nchan.o packet.o radix.o entropy.o readpass.o rsa.o tildexpand.o ttymodes.o uidswap.o uuencode.o xmalloc.o
LIBSSH_OBJS=atomicio.o authfd.o authfile.o aux.o bufaux.o buffer.o canohost.o channels.o cipher.o compat.o compress.o crc32.o deattack.o dispatch.o dsa.o fingerprint.o hmac.o hostfile.o key.o kex.o log.o match.o mpaux.o nchan.o packet.o radix.o entropy.o readpass.o rsa.o tildexpand.o ttymodes.o uidswap.o uuencode.o xmalloc.o
LIBOPENBSD_COMPAT_OBJS=bsd-base64.o bsd-bindresvport.o bsd-daemon.o bsd-misc.o bsd-mktemp.o bsd-rresvport.o bsd-setenv.o bsd-snprintf.o bsd-strlcat.o bsd-strlcpy.o fake-getaddrinfo.o fake-getnameinfo.o
@@ -89,11 +90,11 @@ $(MANPAGES) $(CONFIGFILES)::
$(FIXPATHSCMD) $(srcdir)/$@
clean:
rm -f *.o *.a $(TARGETS) config.status config.cache config.log
rm -f *.out ssh_prng_cmds core
rm -f *.o *.a $(TARGETS) config.cache config.log
rm -f *.out core
distclean: clean
rm -f Makefile config.h core *~
rm -f Makefile config.h config.status ssh_prng_cmds *~
mrproper: distclean
@@ -108,11 +109,11 @@ catman-do:
done
install: manpages $(TARGETS)
$(INSTALL) -d $(DESTDIR)$(bindir)
$(INSTALL) -d $(DESTDIR)$(sbindir)
$(INSTALL) -d $(DESTDIR)$(mandir)
$(INSTALL) -d $(DESTDIR)$(mandir)/$(mansubdir)1
$(INSTALL) -d $(DESTDIR)$(mandir)/$(mansubdir)8
./mkinstalldirs $(DESTDIR)$(bindir)
./mkinstalldirs $(DESTDIR)$(sbindir)
./mkinstalldirs $(DESTDIR)$(mandir)
./mkinstalldirs $(DESTDIR)$(mandir)/$(mansubdir)1
./mkinstalldirs $(DESTDIR)$(mandir)/$(mansubdir)8
$(INSTALL) -m 4755 -s ssh $(DESTDIR)$(bindir)/ssh
$(INSTALL) -s scp $(DESTDIR)$(bindir)/scp
$(INSTALL) -s ssh-add $(DESTDIR)$(bindir)/ssh-add
@@ -131,17 +132,18 @@ install: manpages $(TARGETS)
ln -s ssh.1 $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1
if [ ! -f $(DESTDIR)$(sysconfdir)/ssh_config -a ! -f $(DESTDIR)$(sysconfdir)/sshd_config ]; then \
$(INSTALL) -d $(DESTDIR)$(sysconfdir); \
./mkinstalldirs $(DESTDIR)$(sysconfdir); \
$(INSTALL) -m 644 ssh_config.out $(DESTDIR)$(sysconfdir)/ssh_config; \
$(INSTALL) -m 644 sshd_config.out $(DESTDIR)$(sysconfdir)/sshd_config; \
fi
if [ -f ssh_prng_cmds -a ! -z "$(INSTALL_SSH_PRNG_CMDS)" ]; then \
$(INSTALL) -m 644 ssh_prng_cmds $(DESTDIR)$(sysconfdir)/ssh_prng_cmds; \
$(PERL) fixprogs ssh_prng_cmds $(ENT); \
$(INSTALL) -m 644 ssh_prng_cmds.out $(DESTDIR)$(sysconfdir)/ssh_prng_cmds; \
fi
host-key: ssh-keygen
./ssh-keygen -b 1024 -f $(sysconfdir)/ssh_host_key -N ''
./ssh-keygen -d -f $(sysconfdir)/ssh_host_dsa_key -N ''
./ssh-keygen -b 1024 -f $(sysconfdir)/ssh_host_key -N ""
./ssh-keygen -d -f $(sysconfdir)/ssh_host_dsa_key -N ""
uninstallall: uninstall
-rm -f $(DESTDIR)$(sysconfdir)/ssh_config
+1 -2
View File
@@ -34,8 +34,7 @@ all logins, not just when using password authentication.
OpenSSH depends on Zlib[2], OpenSSL[3] and optionally PAM[4].
There is now several mailing lists for this port of OpenSSH. Please
refer to http://violet.ibs.com.au/openssh/list.html for details on how
to join.
refer to http://www.openssh.com/list.html for details on how to join.
Please send bug reports and patches to the mailing list
[email protected]. The list is currently open to posting by
+6 -1
View File
@@ -9,7 +9,7 @@
/* Define if you want to disable PAM support */
#undef DISABLE_PAM
/* Define if you want to disable AIX4's authenticate function */
/* Define if you want to enable AIX4's authenticate function */
#undef WITH_AIXAUTHENTICATE
/* Define if you want to disable lastlog support */
@@ -50,6 +50,7 @@
#undef HAVE_SYSLEN_IN_UTMPX
#undef HAVE_PID_IN_UTMP
#undef HAVE_TYPE_IN_UTMP
#undef HAVE_TYPE_IN_UTMPX
#undef HAVE_TV_IN_UTMP
#undef HAVE_ID_IN_UTMP
@@ -101,6 +102,9 @@
/* Define if you want have trusted HPUX */
#undef HAVE_HPUX_TRUSTED_SYSTEM_PW
/* Define if you have getpwanam(3) [SunOS 4.x] */
#undef HAVE_GETPWANAM
/* Defined if in_systm.h needs to be included with netinet/ip.h (HPUX - <sigh/>) */
#undef NEED_IN_SYSTM_H
@@ -117,6 +121,7 @@
#undef HAVE_UINTXX_T
#undef HAVE_SOCKLEN_T
#undef HAVE_SIZE_T
#undef HAVE_SSIZE_T
#undef HAVE_STRUCT_SOCKADDR_STORAGE
#undef HAVE_STRUCT_ADDRINFO
#undef HAVE_STRUCT_IN6_ADDR
+19 -1
View File
@@ -11,7 +11,7 @@
#ifndef USE_PAM
RCSID("$Id: auth-passwd.c,v 1.19 2000/04/29 14:47:29 damien Exp $");
RCSID("$Id: auth-passwd.c,v 1.20 2000/05/20 05:03:00 damien Exp $");
#include "packet.h"
#include "ssh.h"
@@ -28,6 +28,11 @@ RCSID("$Id: auth-passwd.c,v 1.19 2000/04/29 14:47:29 damien Exp $");
#ifdef HAVE_SHADOW_H
# include <shadow.h>
#endif
#ifdef HAVE_GETPWANAM
# include <sys/label.h>
# include <sys/audit.h>
# include <pwdadj.h>
#endif
#if defined(HAVE_MD5_PASSWORDS) && !defined(HAVE_MD5_CRYPT)
# include "md5crypt.h"
#endif /* defined(HAVE_MD5_PASSWORDS) && !defined(HAVE_MD5_CRYPT) */
@@ -46,6 +51,9 @@ auth_password(struct passwd * pw, const char *password)
#ifdef HAVE_SHADOW_H
struct spwd *spw;
#endif
#ifdef HAVE_GETPWANAM
struct passwd_adjunct *spw;
#endif
#ifdef WITH_AIXAUTHENTICATE
char *authmsg;
char *loginmsg;
@@ -99,6 +107,16 @@ auth_password(struct passwd * pw, const char *password)
pw_password = spw->sp_pwdp;
}
#endif /* defined(HAVE_SHADOW_H) && !defined(DISABLE_SHADOW) */
#if defined(HAVE_GETPWANAM) && !defined(DISABLE_SHADOW)
if (issecure() && (spw = getpwanam(pw->pw_name)) != NULL)
{
/* Check for users with no password. */
if (strcmp(password, "") == 0 && strcmp(spw->pwa_passwd, "") == 0)
return 1;
pw_password = spw->pwa_passwd;
}
#endif /* defined(HAVE_GETPWANAM) && !defined(DISABLE_SHADOW) */
if (pw_password[0] != '\0')
salt = pw_password;
+25 -3
View File
@@ -5,7 +5,7 @@
*/
#include "includes.h"
RCSID("$OpenBSD: auth.c,v 1.6 2000/04/26 21:28:31 markus Exp $");
RCSID("$OpenBSD: auth.c,v 1.7 2000/05/17 21:37:24 deraadt Exp $");
#include "xmalloc.h"
#include "rsa.h"
@@ -19,6 +19,9 @@ RCSID("$OpenBSD: auth.c,v 1.6 2000/04/26 21:28:31 markus Exp $");
#include "compat.h"
#include "channels.h"
#include "match.h"
#ifdef HAVE_LOGIN_H
#include <login.h>
#endif
#include "bufaux.h"
#include "ssh2.h"
@@ -45,6 +48,7 @@ allowed_user(struct passwd * pw)
{
struct stat st;
struct group *grp;
char *shell;
int i;
#ifdef WITH_AIXAUTHENTICATE
char *loginmsg;
@@ -54,8 +58,14 @@ allowed_user(struct passwd * pw)
if (!pw)
return 0;
/*
* Get the shell from the password data. An empty shell field is
* legal, and means /bin/sh.
*/
shell = (pw->pw_shell[0] == '\0') ? _PATH_BSHELL : pw->pw_shell;
/* deny if shell does not exists or is not executable */
if (stat(pw->pw_shell, &st) != 0)
if (stat(shell, &st) != 0)
return 0;
if (!((st.st_mode & S_IFREG) && (st.st_mode & (S_IXOTH|S_IXUSR|S_IXGRP))))
return 0;
@@ -111,8 +121,20 @@ allowed_user(struct passwd * pw)
}
#ifdef WITH_AIXAUTHENTICATE
if (loginrestrictions(pw->pw_name,S_LOGIN,NULL,&loginmsg) != 0)
if (loginrestrictions(pw->pw_name,S_RLOGIN,NULL,&loginmsg) != 0) {
if (loginmsg && *loginmsg) {
/* Remove embedded newlines (if any) */
char *p;
for (p = loginmsg; *p; p++)
if (*p == '\n')
*p = ' ';
/* Remove trailing newline */
*--p = '\0';
log("Login restricted for %s: %.100s",
pw->pw_name, loginmsg);
}
return 0;
}
#endif /* WITH_AIXAUTHENTICATE */
/* We found no reason not to let this user try to log on... */
+10 -6
View File
@@ -66,9 +66,7 @@ do_fake_authloop1(char *user)
get_remote_port());
#ifdef WITH_AIXAUTHENTICATE
if (strncmp(get_authname(type),"password",
strlen(get_authname(type))) == 0)
loginfailed(pw->pw_name,get_canonical_hostname(),"ssh");
loginfailed(user,get_canonical_hostname(),"ssh");
#endif /* WITH_AIXAUTHENTICATE */
/* Indicate that authentication is needed. */
@@ -408,8 +406,12 @@ do_authloop(struct passwd * pw)
client_user = NULL;
}
if (attempt > AUTH_FAIL_MAX)
if (attempt > AUTH_FAIL_MAX) {
#ifdef WITH_AIXAUTHENTICATE
loginfailed(pw->pw_name,get_canonical_hostname(),"ssh");
#endif /* WITH_AIXAUTHENTICATE */
packet_disconnect(AUTH_FAIL_MSG, pw->pw_name);
}
/* Send a message indicating that the authentication attempt failed. */
packet_start(SSH_SMSG_FAILURE);
@@ -430,7 +432,7 @@ do_authentication()
unsigned int ulen;
char *user;
#ifdef WITH_AIXAUTHENTICATE
char *loginmsg;
extern char *aixloginmsg;
#endif /* WITH_AIXAUTHENTICATE */
/* Get the name of the user that we wish to log in as. */
@@ -501,7 +503,9 @@ do_authentication()
/* The user has been authenticated and accepted. */
#ifdef WITH_AIXAUTHENTICATE
loginsuccess(user,get_canonical_hostname(),"ssh",&loginmsg);
/* We don't have a pty yet, so just label the line as "ssh" */
if (loginsuccess(user,get_canonical_hostname(),"ssh",&aixloginmsg) < 0)
aixloginmsg = NULL;
#endif /* WITH_AIXAUTHENTICATE */
packet_start(SSH_SMSG_SUCCESS);
packet_send();
+15 -3
View File
@@ -154,9 +154,9 @@ input_userauth_request(int type, int plen)
int authenticated = 0;
char *raw, *user, *service, *method, *authmsg = NULL;
struct passwd *pw;
if (++attempt == AUTH_FAIL_MAX)
packet_disconnect("too many failed userauth_requests");
#ifdef WITH_AIXAUTHENTICATE
extern char *aixloginmsg;
#endif /* WITH_AIXAUTHENTICATE */
raw = packet_get_raw(&rlen);
if (plen != rlen)
@@ -164,6 +164,12 @@ input_userauth_request(int type, int plen)
user = packet_get_string(&len);
service = packet_get_string(&len);
method = packet_get_string(&len);
if (++attempt == AUTH_FAIL_MAX) {
#ifdef WITH_AIXAUTHENTICATE
loginfailed(user,get_canonical_hostname(),"ssh");
#endif /* WITH_AIXAUTHENTICATE */
packet_disconnect("too many failed userauth_requests");
}
debug("userauth-request for user %s service %s method %s", user, service, method);
/* XXX we only allow the ssh-connection service */
@@ -211,6 +217,12 @@ input_userauth_request(int type, int plen)
/* XXX todo: check if multiple auth methods are needed */
if (authenticated == 1) {
#ifdef WITH_AIXAUTHENTICATE
/* We don't have a pty yet, so just label the line as "ssh" */
if (loginsuccess(user,get_canonical_hostname(),"ssh",
&aixloginmsg) < 0)
aixloginmsg = NULL;
#endif /* WITH_AIXAUTHENTICATE */
/* turn off userauth */
dispatch_set(SSH2_MSG_USERAUTH_REQUEST, &protocol_error);
packet_start(SSH2_MSG_USERAUTH_SUCCESS);
+36
View File
@@ -0,0 +1,36 @@
#include "includes.h"
RCSID("$OpenBSD: aux.c,v 1.2 2000/05/17 09:47:59 markus Exp $");
#include "ssh.h"
char *
chop(char *s)
{
char *t = s;
while (*t) {
if(*t == '\n' || *t == '\r') {
*t = '\0';
return s;
}
t++;
}
return s;
}
void
set_nonblock(int fd)
{
int val;
val = fcntl(fd, F_GETFL, 0);
if (val < 0) {
error("fcntl(%d, F_GETFL, 0): %s", fd, strerror(errno));
return;
}
if (val & O_NONBLOCK)
return;
debug("fd %d setting O_NONBLOCK", fd);
val |= O_NONBLOCK;
if (fcntl(fd, F_SETFL, val) == -1)
error("fcntl(%d, F_SETFL, O_NONBLOCK): %s", fd, strerror(errno));
}
+22
View File
@@ -60,6 +60,7 @@ static char *rcsid = "$OpenBSD: login.c,v 1.5 1998/07/13 02:11:12 millert Exp $"
#include <stdio.h>
#include <string.h>
#ifdef USER_PROCESS
/*
* find first matching slot in utmp, or "-1" for none
*
@@ -73,6 +74,7 @@ struct utmp * utp;
int t = 0;
struct utmp * u;
#if defined(HAVE_TYPE_IN_UTMP) || defined(HAVE_TYPE_IN_UTMPX)
setutent();
while((u = getutent()) != NULL) {
@@ -91,8 +93,16 @@ struct utmp * utp;
}
endutent();
#endif
return(-1);
}
#else
int find_tty_slot( utp )
struct utmp * utp;
{
return(ttyslot());
}
#endif
#if defined(HAVE_UTMPX_H) && defined(USE_UTMPX)
void
@@ -121,15 +131,26 @@ login(utp)
*/
tty = find_tty_slot(utp);
#ifdef USE_UTMPX
fd = open(_PATH_UTMPX, O_RDWR|O_CREAT, 0644);
if (fd == -1) {
log("Couldn't open %s: %s", _PATH_UTMPX, strerror(errno));
#else /* USE_UTMPX */
fd = open(_PATH_UTMP, O_RDWR|O_CREAT, 0644);
if (fd == -1) {
log("Couldn't open %s: %s", _PATH_UTMP, strerror(errno));
#endif /* USE_UTMPX */
} else {
/* If no tty was found... */
if (tty == -1) {
/* ... append it to utmp on login */
#if defined(HAVE_TYPE_IN_UTMP) || defined(HAVE_TYPE_IN_UTMPX)
if (utp->ut_type == USER_PROCESS) {
#ifdef USE_UTMPX
if ((fd = open(_PATH_UTMPX, O_WRONLY|O_APPEND, 0)) >= 0) {
#else /* USE_UTMPX */
if ((fd = open(_PATH_UTMP, O_WRONLY|O_APPEND, 0)) >= 0) {
#endif /* USE_UTMPX */
(void)write(fd, utp, sizeof(struct utmp));
(void)close(fd);
}
@@ -138,6 +159,7 @@ login(utp)
/* Between login and logout */
log("No tty slot found at logout");
}
#endif
} else {
/* Otherwise, tty was found - update at its location */
#if defined(HAVE_HOST_IN_UTMP)
+1 -18
View File
@@ -17,7 +17,7 @@
*/
#include "includes.h"
RCSID("$Id: channels.c,v 1.30 2000/05/09 01:02:59 damien Exp $");
RCSID("$Id: channels.c,v 1.31 2000/05/17 12:34:23 damien Exp $");
#include "ssh.h"
#include "packet.h"
@@ -147,23 +147,6 @@ channel_lookup(int id)
return c;
}
void
set_nonblock(int fd)
{
int val;
val = fcntl(fd, F_GETFL, 0);
if (val < 0) {
error("fcntl(%d, F_GETFL, 0): %s", fd, strerror(errno));
return;
}
if (val & O_NONBLOCK)
return;
debug("fd %d setting O_NONBLOCK", fd);
val |= O_NONBLOCK;
if (fcntl(fd, F_SETFL, val) == -1)
error("fcntl(%d, F_SETFL, O_NONBLOCK): %s", fd, strerror(errno));
}
/*
* Register filedescriptors for a channel, used when allocating a channel or
* when the channel consumer/producer is ready, e.g. shell exec'd
+85 -36
View File
@@ -11,6 +11,8 @@ AC_PROG_INSTALL
AC_CHECK_PROG(AR, ar, ar)
AC_PATH_PROG(PERL, perl)
AC_SUBST(PERL)
AC_PATH_PROG(ENT, ent)
AC_SUBST(ENT)
if test -z "$LD" ; then
LD=$CC
@@ -32,15 +34,14 @@ case "$host" in
if test "$LD" != "gcc" -a -z "$blibpath"; then
blibpath="/usr/lib:/lib:/usr/local/lib"
fi
AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)])
AC_DEFINE(BROKEN_GETADDRINFO)
;;
*-*-hpux10*)
if test -z "$GCC"; then
CFLAGS="$CFLAGS -Aa"
CFLAGS="$CFLAGS -Ae"
fi
CFLAGS="$CFLAGS -D_HPUX_SOURCE"
CFLAGS="$CFLAGS -I/usr/local/include"
LDFLAGS="$LDFLAGS -L/usr/local/lib"
AC_DEFINE(IPADDR_IN_DISPLAY)
AC_DEFINE(USE_UTMPX)
AC_MSG_CHECKING(for HPUX trusted system password database)
@@ -61,8 +62,6 @@ case "$host" in
CFLAGS="$CFLAGS -Ae"
fi
CFLAGS="$CFLAGS -D_HPUX_SOURCE"
CFLAGS="$CFLAGS -I/usr/local/include"
LDFLAGS="$LDFLAGS -L/usr/local/lib"
AC_DEFINE(IPADDR_IN_DISPLAY)
AC_DEFINE(USE_UTMPX)
AC_MSG_CHECKING(for HPUX trusted system password database)
@@ -107,6 +106,10 @@ case "$host" in
need_dash_r=1
AC_DEFINE(USE_UTMPX)
;;
*-*-sunos4*)
CFLAGS="$CFLAGS -DSUNOS4"
AC_CHECK_FUNCS(getpwanam)
;;
*-*-sysv*)
CFLAGS="$CFLAGS -I/usr/local/include"
LDFLAGS="$LDFLAGS -L/usr/local/lib"
@@ -132,7 +135,7 @@ fi
AC_CHECK_HEADERS(bstring.h endian.h lastlog.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/stropts.h sys/sysmacros.h sys/time.h sys/ttcompat.h stddef.h util.h utmp.h utmpx.h)
# Checks for library functions.
AC_CHECK_FUNCS(arc4random b64_ntop bindresvport_af clock freeaddrinfo gai_strerror getaddrinfo getnameinfo getrusage innetgr md5_crypt mkdtemp openpty rresvport_af setenv seteuid setlogin setproctitle setreuid snprintf strlcat strlcpy updwtmpx vsnprintf vhangup _getpty __b64_ntop)
AC_CHECK_FUNCS(arc4random b64_ntop bcopy bindresvport_af clock freeaddrinfo gai_strerror getaddrinfo getnameinfo getrusage innetgr md5_crypt memmove mkdtemp openpty rresvport_af setenv seteuid setlogin setproctitle setreuid snprintf strlcat strlcpy updwtmpx vsnprintf vhangup _getpty __b64_ntop)
AC_CHECK_FUNC(login,
[AC_DEFINE(HAVE_LOGIN)],
@@ -162,7 +165,7 @@ if test -z "$no_pam" -a "x$ac_cv_header_security_pam_appl_h" = "xyes" ; then
AC_CHECK_LIB(dl, dlopen, , )
LIBS="$LIBS -lpam"
AC_CHECK_FUNC(pam_getenvlist)
AC_CHECK_FUNCS(pam_getenvlist)
# Check PAM strerror arguments (old PAM)
AC_MSG_CHECKING([whether pam_strerror takes only one argument])
@@ -209,37 +212,27 @@ AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
LDFLAGS="$saved_LDFLAGS"
fi
for WANTS_RSAREF in "" 1 ; do
if test -z "$WANTS_RSAREF" ; then
LIBS="$saved_LIBS -lcrypto"
else
LIBS="$saved_LIBS -lcrypto -lRSAglue -lrsaref"
fi
LIBS="$saved_LIBS -lcrypto"
AC_TRY_RUN(
[
# Basic test to check for compatible version and correct linking
# *does not* test for RSA - that comes later.
AC_TRY_RUN(
[
#include <string.h>
#include <openssl/rand.h>
#include <openssl/rsa.h>
#include <openssl/bn.h>
#include <openssl/sha.h>
int main(void)
{
RSA *key; char a[2048],b[2048];;
memset(a, 0, sizeof(a));memset(b, 0, sizeof(b));
char a[2048];
memset(a, 0, sizeof(a));
RAND_add(a, sizeof(a), sizeof(a));
key=RSA_generate_key(32,3,NULL,NULL);
if (key==NULL) return(1);
return(-1==RSA_private_decrypt(RSA_size(key),a,b,key,RSA_NO_PADDING));
return(RAND_status() <= 0);
}
],
[
found_crypto=1
break;
], []
)
done
],
[
found_crypto=1
break;
], []
)
if test ! -z "$found_crypto" ; then
break;
@@ -269,12 +262,53 @@ if test ! -z "$ac_cv_openssldir" -a ! "x$ac_cv_openssldir" = "x(system)" ; then
blibpath="$blibpath:$ssldir:$ssldir/lib"
fi
fi
if test -z "$WANTS_RSAREF" ; then
LIBS="$saved_LIBS -lcrypto"
else
LIBS="$saved_LIBS -lcrypto -lRSAglue -lrsaref"
fi
LIBS="$saved_LIBS -lcrypto"
# Now test RSA support
saved_LIBS="$LIBS"
AC_MSG_CHECKING([for RSA support])
for WANTS_RSAREF in "" 1 ; do
if test -z "$WANTS_RSAREF" ; then
LIBS="$saved_LIBS"
else
LIBS="$saved_LIBS -lRSAglue -lrsaref"
fi
AC_TRY_RUN([
#include <string.h>
#include <openssl/rand.h>
#include <openssl/rsa.h>
#include <openssl/bn.h>
#include <openssl/sha.h>
int main(void)
{
int num; RSA *key; static unsigned char p_in[] = "blahblah";
unsigned char c[256], p[256];
memset(c, 0, sizeof(c)); RAND_add(c, sizeof(c), sizeof(c));
if ((key=RSA_generate_key(512, 3, NULL, NULL))==NULL) return(1);
num = RSA_public_encrypt(sizeof(p_in) - 1, p_in, c, key, RSA_PKCS1_PADDING);
return(-1 == RSA_private_decrypt(num, c, p, key, RSA_PKCS1_PADDING));
}
],
[
rsa_works=1
break;
], [])
done
if test ! -z "$no_rsa" ; then
AC_MSG_RESULT(disabled)
else
if test -z "$rsa_works" ; then
AC_MSG_WARN([*** No RSA support found *** ])
else
if test -z "$WANTS_RSAREF" ; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(using RSAref)
LIBS="$saved_LIBS -lcrypto -lRSAglue -lrsaref"
fi
fi
fi
# Checks for data types
AC_CHECK_SIZEOF(char, 1)
@@ -378,6 +412,20 @@ if test "x$ac_cv_have_size_t" = "xyes" ; then
AC_DEFINE(HAVE_SIZE_T)
fi
AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
AC_TRY_COMPILE(
[
#include <sys/types.h>
],
[ ssize_t foo; foo = 1235; ],
[ ac_cv_have_ssize_t="yes" ],
[ ac_cv_have_ssize_t="no" ]
)
])
if test "x$ac_cv_have_ssize_t" = "xyes" ; then
AC_DEFINE(HAVE_SSIZE_T)
fi
AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
AC_TRY_COMPILE(
@@ -446,6 +494,7 @@ OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
+1 -1
View File
@@ -1,5 +1,5 @@
# Version of OpenSSH
%define oversion 2.1.0
%define oversion 2.1.0p2
# Version of ssh-askpass
%define aversion 1.0
+1 -1
View File
@@ -1,6 +1,6 @@
Summary: OpenSSH, a free Secure Shell (SSH) implementation
Name: openssh
Version: 2.1.0
Version: 2.1.0p2
URL: http://www.openssh.com/
Release: 1
Source0: openssh-%{version}.tar.gz
+13
View File
@@ -150,6 +150,11 @@ typedef unsigned int size_t;
# define HAVE_SIZE_T
#endif /* HAVE_SIZE_T */
#ifndef HAVE_SSIZE_T
typedef int ssize_t;
# define HAVE_SSIZE_T
#endif /* HAVE_SSIZE_T */
#if !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE___SS_FAMILY_IN_SS)
# define ss_family __ss_family
#endif /* !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE_SA_FAMILY_IN_SS) */
@@ -216,6 +221,10 @@ typedef unsigned int size_t;
# define _PATH_DEVNULL "/dev/null"
#endif
#ifndef MAIL_DIRECTORY
# define MAIL_DIRECTORY "/var/spool/mail"
#endif
#ifndef MAILDIR
# define MAILDIR MAIL_DIRECTORY
#endif
@@ -280,4 +289,8 @@ typedef unsigned int size_t;
# undef HAVE_GETADDRINFO
#endif /* defined(BROKEN_GETADDRINFO) && defined(HAVE_GETADDRINFO) */
#if !defined(HAVE_MEMMOVE) && defined(HAVE_BCOPY)
# define memmove(s1, s2, n) bcopy((s2), (s1), (n))
#endif /* !defined(HAVE_MEMMOVE) && defined(HAVE_BCOPY) */
#endif /* _DEFINES_H */
+67 -22
View File
@@ -35,7 +35,7 @@
#include <openssl/rand.h>
#include <openssl/sha.h>
RCSID("$Id: entropy.c,v 1.8 2000/05/01 23:56:41 damien Exp $");
RCSID("$Id: entropy.c,v 1.11 2000/05/17 12:08:30 damien Exp $");
#ifdef EGD_SOCKET
#ifndef offsetof
@@ -133,6 +133,8 @@ typedef struct
char *path;
/* argv to pass to executable */
char *args[5];
/* full command string (debug) */
char *cmdstring;
} entropy_source_t;
double stir_from_system(void);
@@ -211,8 +213,8 @@ stir_from_programs(void)
/* FIXME: turn this off later */
#if 1
debug("Got %0.2f bytes of entropy from %s", entropy_estimate,
entropy_sources[c].path);
debug("Got %0.2f bytes of entropy from '%s'", entropy_estimate,
entropy_sources[c].cmdstring);
#endif
total_entropy_estimate += entropy_estimate;
@@ -225,9 +227,8 @@ stir_from_programs(void)
} else {
/* FIXME: turn this off later */
#if 1
debug("Command '%s %s %s' disabled (badness %d)",
entropy_sources[c].path, entropy_sources[c].args[1],
entropy_sources[c].args[2], entropy_sources[c].badness);
debug("Command '%s' disabled (badness %d)",
entropy_sources[c].cmdstring, entropy_sources[c].badness);
#endif
if (entropy_sources[c].badness > 0)
@@ -286,6 +287,17 @@ stir_rusage(int who, double entropy_estimate)
#endif /* _HAVE_GETRUSAGE */
}
static
int
_get_timeval_msec_difference(struct timeval *t1, struct timeval *t2) {
int secdiff, usecdiff;
secdiff = t2->tv_sec - t1->tv_sec;
usecdiff = (secdiff*1000000) + (t2->tv_usec - t1->tv_usec);
return (int)(usecdiff / 1000);
}
double
hash_output_from_command(entropy_source_t *src, char *hash)
{
@@ -293,9 +305,11 @@ hash_output_from_command(entropy_source_t *src, char *hash)
int p[2];
fd_set rdset;
int cmd_eof = 0, error_abort = 0;
struct timeval tv_start, tv_current;
int msec_elapsed = 0;
pid_t pid;
int status;
char buf[2048];
char buf[16384];
int bytes_read;
int total_bytes_read;
SHA_CTX sha;
@@ -309,6 +323,8 @@ hash_output_from_command(entropy_source_t *src, char *hash)
if (pipe(p) == -1)
fatal("Couldn't open pipe: %s", strerror(errno));
(void)gettimeofday(&tv_start, NULL); /* record start time */
switch (pid = fork()) {
case -1: /* Error */
close(p[0]);
@@ -324,8 +340,8 @@ hash_output_from_command(entropy_source_t *src, char *hash)
close(devnull);
execv(src->path, (char**)(src->args));
debug("(child) Couldn't exec '%s %s %s': %s", src->path,
src->args[1], src->args[2], strerror(errno));
debug("(child) Couldn't exec '%s': %s", src->cmdstring,
strerror(errno));
src->badness = src->sticky_badness = 128;
_exit(-1);
default: /* Parent */
@@ -343,13 +359,24 @@ hash_output_from_command(entropy_source_t *src, char *hash)
while (!error_abort && !cmd_eof) {
int ret;
struct timeval tv;
int msec_remaining;
(void) gettimeofday(&tv_current, 0);
msec_elapsed = _get_timeval_msec_difference(
&tv_start, &tv_current);
if (msec_elapsed >= entropy_timeout_current) {
error_abort=1;
continue;
}
msec_remaining = entropy_timeout_current - msec_elapsed;
FD_ZERO(&rdset);
FD_SET(p[0], &rdset);
tv.tv_sec = entropy_timeout_current / 1000;
tv.tv_usec = (entropy_timeout_current % 1000) * 1000;
tv.tv_sec = msec_remaining / 1000;
tv.tv_usec = (msec_remaining % 1000) * 1000;
ret = select(p[0]+1, &rdset, NULL, NULL, &tv);
switch (ret) {
case 0:
/* timer expired */
@@ -363,17 +390,19 @@ hash_output_from_command(entropy_source_t *src, char *hash)
error_abort = 1;
break;
}
SHA1_Update(&sha, buf, bytes_read);
total_bytes_read += bytes_read;
RAND_add(&bytes_read, sizeof(&bytes_read), 0.0);
cmd_eof = bytes_read ? 0 : 1;
if (bytes_read) {
SHA1_Update(&sha, buf, bytes_read);
total_bytes_read += bytes_read;
RAND_add(&bytes_read, sizeof(&bytes_read), 0.0);
} else
cmd_eof = 1;
break;
case -1:
default:
error("Command '%s %s': select() failed: %s", src->path, src->args[1],
strerror(errno));
debug("Command '%s': select() failed: %s", src->cmdstring,
strerror(errno));
error_abort = 1;
break;
} /* switch ret */
@@ -384,11 +413,12 @@ hash_output_from_command(entropy_source_t *src, char *hash)
SHA1_Final(hash, &sha);
close(p[0]);
debug("Time elapsed: %d msec", msec_elapsed);
if (waitpid(pid, &status, 0) == -1) {
error("Couldn't wait for child '%s %s' completion: %s", src->path,
src->args[1], strerror(errno));
/* return(-1); */ /* FIXME: (ATL) this doesn't feel right */
debug("Couldn't wait for child '%s' completion: %s", src->cmdstring,
strerror(errno));
return(0.0);
}
@@ -398,7 +428,7 @@ hash_output_from_command(entropy_source_t *src, char *hash)
/* closing p[0] on timeout causes the entropy command to
* SIGPIPE. Take whatever output we got, and mark this command
* as slow */
debug("Command %s %s timed out", src->path, src->args[1]);
debug("Command '%s' timed out", src->cmdstring);
src->sticky_badness *= 2;
src->badness = src->sticky_badness;
return(total_bytes_read);
@@ -444,7 +474,7 @@ prng_check_seedfile(char *filename) {
fatal("PRNG seedfile %.100s is not a regular file", filename);
/* mode 0600, owned by root or the current user? */
if (((st.st_mode & 0177) != 0) || !(st.st_uid == geteuid()))
if (((st.st_mode & 0177) != 0) || !(st.st_uid == getuid()))
fatal("PRNG seedfile %.100s must be mode 0600, owned by uid %d",
filename, getuid());
@@ -615,6 +645,10 @@ prng_read_commands(char *cmdfilename)
continue;
}
/* save the command for debug messages */
entcmd[cur_cmd].cmdstring = (char*) xmalloc(strlen(cmd)+1);
strncpy(entcmd[cur_cmd].cmdstring, cmd, strlen(cmd)+1);
/* split the command args */
cp = strtok(cmd, WHITESPACE);
arg = 0; argv = NULL;
@@ -701,18 +735,29 @@ prng_seed_cleanup(void *junk)
void
seed_rng(void)
{
void *old_sigchld_handler;
if (!prng_commands_loaded) {
if (!prng_read_commands(SSH_PRNG_COMMAND_FILE))
fatal("PRNG initialisation failed -- exiting.");
prng_commands_loaded = 1;
}
/* Make sure some other sigchld handler doesn't reap our entropy */
/* commands */
old_sigchld_handler = signal(SIGCHLD, SIG_DFL);
debug("Seeding random number generator.");
debug("OpenSSL random status is now %i\n", RAND_status());
debug("%i bytes from system calls", (int)stir_from_system());
debug("%i bytes from programs", (int)stir_from_programs());
debug("OpenSSL random status is now %i\n", RAND_status());
signal(SIGCHLD, old_sigchld_handler);
if (!RAND_status())
fatal("Couldn't initialise builtin random number generator -- exiting.");
if (!prng_seed_loaded)
{
prng_seed_loaded = 1;
Executable
+72
View File
@@ -0,0 +1,72 @@
#!/usr/bin/perl
#
# fixprogs - run through the list of entropy commands and
# score out the losers
#
$entscale = 50; # divisor for optional entropy measurement
sub usage {
return("Usage: $0 <command file>\n");
}
if (($#ARGV == -1) || ($#ARGV>1)) {
die(&usage);
}
# 'undocumented' option - run ent (in second param) on the output
if ($#ARGV==1) {
$entcmd=$ARGV[1]
} else {
$entcmd = ""
};
$infilename = $ARGV[0];
if (!open(IN, "<".$infilename)) {
die("Couldn't open input file");
}
$outfilename=$infilename.".out";
if (!open(OUT, ">$outfilename")) {
die("Couldn't open output file $outfilename");
}
@infile=<IN>;
select(OUT); $|=1; select(STDOUT);
foreach (@infile) {
if (/^\s*\#/ || /^\s*$/) {
print OUT;
next;
}
($cmd, $path, $est) = /^\"([^\"]+)\"\s+([\w\/_-]+)\s+([\d\.\-]+)/o;
@args = split(/ /, $cmd);
if (! ($pid = fork())) {
# child
close STDIN; close STDOUT; close STDERR;
open STDIN, "</dev/null";
open STDOUT, ">/dev/null";
open STDERR, ">/dev/null";
exec $path @args;
exit 1; # shouldn't be here
}
# parent
waitpid ($pid, 0); $ret=$? >> 8;
if ($ret != 0) {
$path = "undef";
} else {
if ($entcmd ne "") {
# now try to run ent on the command
$mostargs=join(" ", splice(@args,1));
print "Evaluating '$path $mostargs'\n";
@ent = qx{$path $mostargs | $entcmd -b -t};
@ent = grep(/^1,/, @ent);
($null, $null, $rate) = split(/,/, $ent[0]);
$est = $rate / $entscale; # scale the estimate back
}
}
print OUT "\"$cmd\" $path $est\n";
}
close(IN);
+16 -6
View File
@@ -18,7 +18,7 @@
*/
#include "includes.h"
RCSID("$Id: login.c,v 1.25 2000/05/01 12:53:53 damien Exp $");
RCSID("$Id: login.c,v 1.27 2000/05/17 12:00:03 damien Exp $");
#if defined(HAVE_UTMPX_H) && defined(USE_UTMPX)
# include <utmpx.h>
@@ -53,6 +53,10 @@ unsigned long
get_last_login_time(uid_t uid, const char *logname,
char *buf, unsigned int bufsize)
{
#if defined(WITH_AIXAUTHENTICATE)
/* This is done in do_authentication */
return (unsigned long) 0;
#else
#if defined(_PATH_LASTLOG) && !defined(DISABLE_LASTLOG)
struct lastlog ll;
char *lastlog;
@@ -87,6 +91,7 @@ get_last_login_time(uid_t uid, const char *logname,
return ll.ll_time;
#else /* defined(_PATH_LASTLOG) && !defined(DISABLE_LASTLOG) */
# ifdef HAVE_TYPE_IN_UTMP
/* Look in wtmp for the last login */
struct utmp wt;
char *wt_file = _PATH_WTMP;
@@ -111,14 +116,14 @@ get_last_login_time(uid_t uid, const char *logname,
if ( wt.ut_type == USER_PROCESS) {
if ( !strncmp(logname, wt.ut_user, 8) ) {
t = (unsigned long) wt.ut_time;
#ifdef HAVE_HOST_IN_UTMP
# ifdef HAVE_HOST_IN_UTMP
if (bufsize > sizeof(wt.ut_host) + 1)
bufsize = sizeof(wt.ut_host) + 1;
strncpy(buf, wt.ut_host, bufsize - 1);
buf[bufsize - 1] = 0;
#else /* HAVE_HOST_IN_UTMP */
# else /* HAVE_HOST_IN_UTMP */
buf[0] = 0;
#endif /* HAVE_HOST_IN_UTMP */
# endif /* HAVE_HOST_IN_UTMP */
}
}
@@ -127,7 +132,11 @@ get_last_login_time(uid_t uid, const char *logname,
} while (t == 0);
return t;
# else
return 0;
# endif /* HAVE_TYPE_IN_UTMP */
#endif /* defined(_PATH_LASTLOG) && !defined(DISABLE_LASTLOG) */
#endif /* defined(WITH_AIXAUTHENTICATE) */
}
/*
@@ -242,7 +251,8 @@ record_login(pid_t pid, const char *ttyname, const char *user, uid_t uid,
login(&u);
#endif /* defined(HAVE_UTMPX_H) && defined(USE_UTMPX) */
#if defined(_PATH_LASTLOG) && !defined(DISABLE_LASTLOG)
#if defined(_PATH_LASTLOG) && !defined(DISABLE_LASTLOG) && !defined(WITH_AIXAUTHENTICATE)
/* AIX does this in do_authentication */
lastlog = _PATH_LASTLOG;
/* Update lastlog unless actually recording a logout. */
@@ -272,7 +282,7 @@ record_login(pid_t pid, const char *ttyname, const char *user, uid_t uid,
close(fd);
}
}
#endif /* defined(_PATH_LASTLOG) && !defined(DISABLE_LASTLOG) */
#endif /* defined(_PATH_LASTLOG) && !defined(DISABLE_LASTLOG) && !defined(WITH_AIXAUTHENTICATE) */
}
/* Records that the user has logged out. */
Executable
+40
View File
@@ -0,0 +1,40 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
# Author: Noah Friedman <[email protected]>
# Created: 1993-05-16
# Public domain
# $Id: mkinstalldirs,v 1.1 2000/05/20 05:33:45 damien Exp $
errstatus=0
for file
do
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
shift
pathcomp=
for d
do
pathcomp="$pathcomp$d"
case "$pathcomp" in
-* ) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
fi
fi
pathcomp="$pathcomp/"
done
done
exit $errstatus
# mkinstalldirs ends here
+5 -1
View File
@@ -17,7 +17,7 @@
*/
#include "includes.h"
RCSID("$Id: packet.c,v 1.22 2000/05/07 02:03:17 damien Exp $");
RCSID("$Id: packet.c,v 1.23 2000/05/17 12:53:35 damien Exp $");
#include "xmalloc.h"
#include "buffer.h"
@@ -1237,10 +1237,12 @@ packet_set_interactive(int interactive, int keepalives)
* Set IP options for an interactive connection. Use
* IPTOS_LOWDELAY and TCP_NODELAY.
*/
#ifdef IP_TOS
int lowdelay = IPTOS_LOWDELAY;
if (setsockopt(connection_in, IPPROTO_IP, IP_TOS, (void *) &lowdelay,
sizeof(lowdelay)) < 0)
error("setsockopt IPTOS_LOWDELAY: %.100s", strerror(errno));
#endif
if (setsockopt(connection_in, IPPROTO_TCP, TCP_NODELAY, (void *) &on,
sizeof(on)) < 0)
error("setsockopt TCP_NODELAY: %.100s", strerror(errno));
@@ -1249,10 +1251,12 @@ packet_set_interactive(int interactive, int keepalives)
* Set IP options for a non-interactive connection. Use
* IPTOS_THROUGHPUT.
*/
#ifdef IP_TOS
int throughput = IPTOS_THROUGHPUT;
if (setsockopt(connection_in, IPPROTO_IP, IP_TOS, (void *) &throughput,
sizeof(throughput)) < 0)
error("setsockopt IPTOS_THROUGHPUT: %.100s", strerror(errno));
#endif
}
}
+4 -2
View File
@@ -45,7 +45,7 @@
*/
#include "includes.h"
RCSID("$Id: scp.c,v 1.22 2000/05/07 02:03:17 damien Exp $");
RCSID("$Id: scp.c,v 1.23 2000/05/17 12:53:35 damien Exp $");
#include "ssh.h"
#include "xmalloc.h"
@@ -1008,7 +1008,7 @@ run_err(const char *fmt,...)
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: scp.c,v 1.22 2000/05/07 02:03:17 damien Exp $
* $Id: scp.c,v 1.23 2000/05/17 12:53:35 damien Exp $
*/
char *
@@ -1235,7 +1235,9 @@ progressmeter(int flag)
struct sigaction sa;
sa.sa_handler = updateprogressmeter;
sigemptyset(&sa.sa_mask);
#ifdef SA_RESTART
sa.sa_flags = SA_RESTART;
#endif
sigaction(SIGALRM, &sa, NULL);
alarmtimer(1);
} else if (flag == 1) {
+29 -19
View File
@@ -85,7 +85,6 @@ sigchld_handler2(int sig)
int save_errno = errno;
debug("Received SIGCHLD.");
child_terminated = 1;
signal(SIGCHLD, sigchld_handler2);
errno = save_errno;
}
@@ -259,20 +258,15 @@ process_input(fd_set * readset)
if (len == 0) {
verbose("Connection closed by remote host.");
fatal_cleanup();
} else if (len < 0) {
if (errno != EINTR && errno != EAGAIN) {
verbose("Read error from remote host: %.100s", strerror(errno));
fatal_cleanup();
}
} else {
/* Buffer any received data. */
packet_process_incoming(buf, len);
}
/*
* There is a kernel bug on Solaris that causes select to
* sometimes wake up even though there is no data available.
*/
if (len < 0 && errno == EAGAIN)
len = 0;
if (len < 0) {
verbose("Read error from remote host: %.100s", strerror(errno));
fatal_cleanup();
}
/* Buffer any received data. */
packet_process_incoming(buf, len);
}
if (compat20)
return;
@@ -280,9 +274,11 @@ process_input(fd_set * readset)
/* Read and buffer any available stdout data from the program. */
if (!fdout_eof && FD_ISSET(fdout, readset)) {
len = read(fdout, buf, sizeof(buf));
if (len <= 0)
if (len < 0 && (errno == EINTR || errno == EAGAIN)) {
/* do nothing */
} else if (len <= 0) {
fdout_eof = 1;
else {
} else {
buffer_append(&stdout_buffer, buf, len);
fdout_bytes += len;
}
@@ -290,10 +286,13 @@ process_input(fd_set * readset)
/* Read and buffer any available stderr data from the program. */
if (!fderr_eof && FD_ISSET(fderr, readset)) {
len = read(fderr, buf, sizeof(buf));
if (len <= 0)
if (len < 0 && (errno == EINTR || errno == EAGAIN)) {
/* do nothing */
} else if (len <= 0) {
fderr_eof = 1;
else
} else {
buffer_append(&stderr_buffer, buf, len);
}
}
}
@@ -309,7 +308,9 @@ process_output(fd_set * writeset)
if (!compat20 && fdin != -1 && FD_ISSET(fdin, writeset)) {
len = write(fdin, buffer_ptr(&stdin_buffer),
buffer_len(&stdin_buffer));
if (len <= 0) {
if (len < 0 && (errno == EINTR || errno == EAGAIN)) {
/* do nothing */
} else if (len <= 0) {
#ifdef USE_PIPES
close(fdin);
#else
@@ -396,6 +397,14 @@ server_loop(pid_t pid, int fdin_arg, int fdout_arg, int fderr_arg)
fdin = fdin_arg;
fdout = fdout_arg;
fderr = fderr_arg;
/* nonblocking IO */
set_nonblock(fdin);
set_nonblock(fdout);
/* we don't have stderr for interactive terminal sessions, see below */
if (fderr != -1)
set_nonblock(fderr);
connection_in = packet_get_connection_in();
connection_out = packet_get_connection_out();
@@ -640,6 +649,7 @@ server_loop2(void)
while ((pid = waitpid(-1, &status, WNOHANG)) > 0)
session_close_by_pid(pid, status);
child_terminated = 0;
signal(SIGCHLD, sigchld_handler2);
}
channel_after_select(&readset, &writeset);
process_input(&readset);
+27 -3
View File
@@ -83,6 +83,10 @@ static char *xauthfile;
/* data */
#define MAX_SESSIONS 10
Session sessions[MAX_SESSIONS];
#ifdef WITH_AIXAUTHENTICATE
/* AIX's lastlogin message, set in auth1.c */
char *aixloginmsg;
#endif /* WITH_AIXAUTHENTICATE */
/* Flags set in auth-rsa from authorized_keys flags. These are set in auth-rsa.c. */
int no_port_forwarding_flag = 0;
@@ -631,6 +635,15 @@ do_exec_pty(Session *s, const char *command, struct passwd * pw)
fclose(f);
}
}
#if defined(WITH_AIXAUTHENTICATE)
/*
* AIX handles the lastlog info differently. Display it here.
*/
if (command == NULL && aixloginmsg && *aixloginmsg &&
!quiet_login && !options.use_login) {
printf("%s\n", aixloginmsg);
}
#endif
/* Do common processing for the child, such as execing the command. */
do_child(command, pw, s->term, s->display, s->auth_proto, s->auth_data, s->tty);
/* NOTREACHED */
@@ -1022,13 +1035,20 @@ do_child(const char *command, struct passwd * pw, const char *term,
else {
/* Add authority data to .Xauthority if appropriate. */
if (auth_proto != NULL && auth_data != NULL) {
if (debug_flag)
char *screen = strchr(display, ':');
if (debug_flag) {
fprintf(stderr, "Running %.100s add %.100s %.100s %.100s\n",
XAUTH_PATH, display, auth_proto, auth_data);
XAUTH_PATH, display, auth_proto, auth_data);
if (screen != NULL)
fprintf(stderr, "Adding %.*s/unix%s %s %s\n",
screen-display, display, screen, auth_proto, auth_data);
}
f = popen(XAUTH_PATH " -q -", "w");
if (f) {
fprintf(f, "add %s %s %s\n", display, auth_proto, auth_data);
if (screen != NULL)
fprintf(f, "add %.*s/unix%s %s %s\n",
screen-display, display, screen, auth_proto, auth_data);
pclose(f);
} else
fprintf(stderr, "Could not run %s -q -\n", XAUTH_PATH);
@@ -1460,7 +1480,11 @@ session_exit_message(Session *s, int status)
channel_request_start(s->chanid,
"exit-signal", 0);
packet_put_int(WTERMSIG(status));
#ifdef WCOREDUMP
packet_put_char(WCOREDUMP(status));
#else /* WCOREDUMP */
packet_put_char(0);
#endif /* WCOREDUMP */
packet_put_cstring("");
packet_put_cstring("");
packet_send();
+1
View File
@@ -507,6 +507,7 @@ main(int ac, char **av)
struct sockaddr_un sunaddr;
pid_t pid;
char *shell, *format, *pidstr, pidstrbuf[1 + 3 * sizeof pid];
extern int optind;
/* check if RSA support exists */
if (rsa_alive() == 0) {
+8 -2
View File
@@ -9,7 +9,7 @@
.\"
.\" Created: Sat Apr 22 21:55:14 1995 ylo
.\"
.\" $Id: ssh.1,v 1.25 2000/05/09 01:03:02 damien Exp $
.\" $Id: ssh.1,v 1.26 2000/05/17 12:34:24 damien Exp $
.\"
.Dd September 25, 1999
.Dt SSH 1
@@ -24,7 +24,7 @@
.Op Ar command
.Pp
.Nm ssh
.Op Fl afgknqtvxCPX246
.Op Fl afgknqtvxCNPTX246
.Op Fl c Ar cipher_spec
.Op Fl e Ar escape_char
.Op Fl i Ar identity_file
@@ -416,6 +416,10 @@ program will be put in the background.
needs to ask for a password or passphrase; see also the
.Fl f
option.)
.It Fl N
Do not execute a remote command.
This is usefull if you just want to forward ports
(protocol version 2 only).
.It Fl o Ar option
Can be used to give options in the format used in the config file.
This is useful for specifying options for which there is no separate
@@ -442,6 +446,8 @@ Force pseudo-tty allocation.
This can be used to execute arbitrary
screen-based programs on a remote machine, which can be very useful,
e.g., when implementing menu services.
.It Fl T
Disable pseudo-tty allocation (protocol version 2 only).
.It Fl v
Verbose mode.
Causes
+3 -2
View File
@@ -11,7 +11,7 @@
*/
#include "includes.h"
RCSID("$Id: ssh.c,v 1.30 2000/05/09 01:03:02 damien Exp $");
RCSID("$Id: ssh.c,v 1.32 2000/05/20 05:22:37 damien Exp $");
#include <openssl/evp.h>
#include <openssl/dsa.h>
@@ -120,6 +120,7 @@ usage()
#ifdef AFS
fprintf(stderr, " -k Disable Kerberos ticket and AFS token forwarding.\n");
#endif /* AFS */
fprintf(stderr, " -X Enable X11 connection forwarding.\n");
fprintf(stderr, " -x Disable X11 connection forwarding.\n");
fprintf(stderr, " -i file Identity for RSA authentication (default: ~/.ssh/identity).\n");
fprintf(stderr, " -t Tty; allocate a tty even if command is given.\n");
@@ -434,7 +435,7 @@ main(int ac, char **av)
buffer_init(&command);
OpenSSL_add_all_algorithms();
/*
* Save the command to execute on the remote host in a buffer. There
* is no limit on the length of the command, except by the maximum
+7 -1
View File
@@ -13,7 +13,7 @@
*
*/
/* RCSID("$Id: ssh.h,v 1.39 2000/05/09 01:03:02 damien Exp $"); */
/* RCSID("$Id: ssh.h,v 1.40 2000/05/17 12:34:24 damien Exp $"); */
#ifndef SSH_H
#define SSH_H
@@ -486,6 +486,12 @@ void fatal_remove_cleanup(void (*proc) (void *context), void *context);
*/
char *tilde_expand_filename(const char *filename, uid_t my_uid);
/* remove newline at end of string */
char *chop(char *s);
/* set filedescriptor to non-blocking */
void set_nonblock(int fd);
/*
* Performs the interactive session. This handles data transmission between
* the client and the program. Note that the notion of stdin, stdout, and
+7 -1
View File
@@ -1,5 +1,5 @@
/*
* draft-ietf-secsh-architecture-04.txt
* draft-ietf-secsh-architecture-05.txt
*
* Transport layer protocol:
*
@@ -28,6 +28,7 @@
*
* 192-255 Local extensions
*/
/* RCSID("$OpenBSD: ssh2.h,v 1.3 2000/05/15 07:03:12 markus Exp $"); */
/* transport layer: generic */
@@ -88,6 +89,7 @@
#define SSH2_DISCONNECT_PROTOCOL_ERROR 2
#define SSH2_DISCONNECT_KEY_EXCHANGE_FAILED 3
#define SSH2_DISCONNECT_HOST_AUTHENTICATION_FAILED 4
#define SSH2_DISCONNECT_RESERVED 4
#define SSH2_DISCONNECT_MAC_ERROR 5
#define SSH2_DISCONNECT_COMPRESSION_ERROR 6
#define SSH2_DISCONNECT_SERVICE_NOT_AVAILABLE 7
@@ -95,6 +97,10 @@
#define SSH2_DISCONNECT_HOST_KEY_NOT_VERIFIABLE 9
#define SSH2_DISCONNECT_CONNECTION_LOST 10
#define SSH2_DISCONNECT_BY_APPLICATION 11
#define SSH2_DISCONNECT_TOO_MANY_CONNECTIONS 12
#define SSH2_DISCONNECT_AUTH_CANCELLED_BY_USER 13
#define SSH2_DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE 14
#define SSH2_DISCONNECT_ILLEGAL_USER_NAME 15
/* misc */
+2 -17
View File
@@ -8,7 +8,7 @@
*/
#include "includes.h"
RCSID("$OpenBSD: sshconnect.c,v 1.72 2000/05/04 09:50:22 markus Exp $");
RCSID("$OpenBSD: sshconnect.c,v 1.74 2000/05/17 16:57:02 markus Exp $");
#include <openssl/bn.h>
#include <openssl/dsa.h>
@@ -255,7 +255,7 @@ ssh_connect(const char *host, struct sockaddr_storage * hostaddr,
temporarily_use_uid(original_real_uid);
if (connect(sock, ai->ai_addr, ai->ai_addrlen) >= 0) {
/* Successful connection. */
memcpy(hostaddr, ai->ai_addr, sizeof(*(ai->ai_addr)));
memcpy(hostaddr, ai->ai_addr, ai->ai_addrlen);
restore_uid();
break;
} else {
@@ -301,21 +301,6 @@ ssh_connect(const char *host, struct sockaddr_storage * hostaddr,
return 1;
}
char *
chop(char *s)
{
char *t = s;
while (*t) {
if(*t == '\n' || *t == '\r') {
*t = '\0';
return s;
}
t++;
}
return s;
}
/*
* Waits for the server identification string, and sends our own
* identification string.
+7 -19
View File
@@ -14,7 +14,7 @@
*/
#include "includes.h"
RCSID("$OpenBSD: sshd.c,v 1.115 2000/05/03 10:21:49 markus Exp $");
RCSID("$OpenBSD: sshd.c,v 1.117 2000/05/18 13:27:36 djm Exp $");
#include "xmalloc.h"
#include "rsa.h"
@@ -262,21 +262,6 @@ key_regeneration_alarm(int sig)
errno = save_errno;
}
char *
chop(char *s)
{
char *t = s;
while (*t) {
if(*t == '\n' || *t == '\r') {
*t = '\0';
return s;
}
t++;
}
return s;
}
void
sshd_exchange_identification(int sock_in, int sock_out)
{
@@ -404,9 +389,12 @@ void
destroy_sensitive_data(void)
{
/* Destroy the private and public keys. They will no longer be needed. */
RSA_free(public_key);
RSA_free(sensitive_data.private_key);
RSA_free(sensitive_data.host_key);
if (public_key)
RSA_free(public_key);
if (sensitive_data.private_key)
RSA_free(sensitive_data.private_key);
if (sensitive_data.host_key)
RSA_free(sensitive_data.host_key);
if (sensitive_data.dsa_host_key != NULL)
key_free(sensitive_data.dsa_host_key);
}