summaryrefslogtreecommitdiffstats
path: root/crypto/openssh/ssh.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/openssh/ssh.c')
-rw-r--r--crypto/openssh/ssh.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/crypto/openssh/ssh.c b/crypto/openssh/ssh.c
index f59dc44..24ee541 100644
--- a/crypto/openssh/ssh.c
+++ b/crypto/openssh/ssh.c
@@ -73,11 +73,19 @@ RCSID("$OpenBSD: ssh.c,v 1.179 2002/06/12 01:09:52 markus Exp $");
#include "scard.h"
#endif
+#ifdef HAVE___PROGNAME
extern char *__progname;
+#else
+char *__progname;
+#endif
/* Flag indicating whether IPv4 or IPv6. This can be set on the command line.
Default value is AF_UNSPEC means both IPv4 and IPv6. */
+#ifdef IPV4_DEFAULT
+int IPv4or6 = AF_INET;
+#else
int IPv4or6 = AF_UNSPEC;
+#endif
/* Flag indicating whether debug mode is on. This can be set on the command line. */
int debug_flag = 0;
@@ -212,6 +220,9 @@ main(int ac, char **av)
extern int optind, optreset;
extern char *optarg;
+ __progname = get_progname(av[0]);
+ init_rng();
+
/*
* Save the original real uid. It will be needed later (uid-swapping
* may clobber the real uid).
@@ -219,6 +230,7 @@ main(int ac, char **av)
original_real_uid = getuid();
original_effective_uid = geteuid();
+#ifdef HAVE_SETRLIMIT
/* If we are installed setuid root be careful to not drop core. */
if (original_real_uid != original_effective_uid) {
struct rlimit rlim;
@@ -226,6 +238,7 @@ main(int ac, char **av)
if (setrlimit(RLIMIT_CORE, &rlim) < 0)
fatal("setrlimit failed: %.100s", strerror(errno));
}
+#endif
/* Get user data. */
pw = getpwuid(original_real_uid);
if (!pw) {
@@ -579,6 +592,8 @@ again:
/* reinit */
log_init(av[0], options.log_level, SYSLOG_FACILITY_USER, 1);
+ seed_rng();
+
if (options.user == NULL)
options.user = xstrdup(pw->pw_name);
@@ -586,7 +601,12 @@ again:
host = options.hostname;
/* Disable rhosts authentication if not running as root. */
+#ifdef HAVE_CYGWIN
+ /* Ignore uid if running under Windows */
+ if (!options.use_privileged_port) {
+#else
if (original_effective_uid != 0 || !options.use_privileged_port) {
+#endif
debug("Rhosts Authentication disabled, "
"originating port will not be trusted.");
options.rhosts_authentication = 0;
@@ -595,7 +615,11 @@ again:
if (ssh_connect(host, &hostaddr, options.port, IPv4or6,
options.connection_attempts,
+#ifdef HAVE_CYGWIN
+ options.use_privileged_port,
+#else
original_effective_uid == 0 && options.use_privileged_port,
+#endif
options.proxy_command) != 0)
exit(1);
OpenPOWER on IntegriCloud