summaryrefslogtreecommitdiffstats
path: root/crypto/openssh/ssh-agent.c
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2002-06-27 22:42:11 +0000
committerdes <des@FreeBSD.org>2002-06-27 22:42:11 +0000
commit5ba29faa04960f19c0c3ff005c2b897c3094c1d6 (patch)
tree8b0c3ca50a9406d306d417f78b63f73616b80615 /crypto/openssh/ssh-agent.c
parent434f33d82438442b1dab7090fab90db4c3d02cdb (diff)
downloadFreeBSD-src-5ba29faa04960f19c0c3ff005c2b897c3094c1d6.zip
FreeBSD-src-5ba29faa04960f19c0c3ff005c2b897c3094c1d6.tar.gz
Forcibly revert to mainline.
Diffstat (limited to 'crypto/openssh/ssh-agent.c')
-rw-r--r--crypto/openssh/ssh-agent.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/crypto/openssh/ssh-agent.c b/crypto/openssh/ssh-agent.c
index 4fc0f23..c3a9077 100644
--- a/crypto/openssh/ssh-agent.c
+++ b/crypto/openssh/ssh-agent.c
@@ -34,9 +34,8 @@
*/
#include "includes.h"
-#include <sys/queue.h>
+#include "openbsd-compat/fake-queue.h"
RCSID("$OpenBSD: ssh-agent.c,v 1.95 2002/06/19 00:27:55 deraadt Exp $");
-RCSID("$FreeBSD$");
#include <openssl/evp.h>
#include <openssl/md5.h>
@@ -101,7 +100,11 @@ char socket_dir[1024];
int locked = 0;
char *lock_passwd = NULL;
+#ifdef HAVE___PROGNAME
extern char *__progname;
+#else
+char *__progname;
+#endif
static void
idtab_init(void)
@@ -926,7 +929,12 @@ main(int ac, char **av)
{
int sock, c_flag = 0, d_flag = 0, k_flag = 0, s_flag = 0, ch, nalloc;
struct sockaddr_un sunaddr;
+#ifdef HAVE_SETRLIMIT
struct rlimit rlim;
+#endif
+#ifdef HAVE_CYGWIN
+ int prev_mask;
+#endif
pid_t pid;
char *shell, *format, *pidstr, pidstrbuf[1 + 3 * sizeof pid];
char *agentsocket = NULL;
@@ -935,7 +943,15 @@ main(int ac, char **av)
SSLeay_add_all_algorithms();
+ __progname = get_progname(av[0]);
+ init_rng();
+ seed_rng();
+
+#ifdef __GNU_LIBRARY__
+ while ((ch = getopt(ac, av, "+cdksa:")) != -1) {
+#else /* __GNU_LIBRARY__ */
while ((ch = getopt(ac, av, "cdksa:")) != -1) {
+#endif /* __GNU_LIBRARY__ */
switch (ch) {
case 'c':
if (s_flag)
@@ -1025,11 +1041,19 @@ main(int ac, char **av)
memset(&sunaddr, 0, sizeof(sunaddr));
sunaddr.sun_family = AF_UNIX;
strlcpy(sunaddr.sun_path, socket_name, sizeof(sunaddr.sun_path));
- sunaddr.sun_len = SUN_LEN(&sunaddr) + 1;
- if (bind(sock, (struct sockaddr *)&sunaddr, sunaddr.sun_len) < 0) {
+#ifdef HAVE_CYGWIN
+ prev_mask = umask(0177);
+#endif
+ if (bind(sock, (struct sockaddr *) & sunaddr, sizeof(sunaddr)) < 0) {
perror("bind");
+#ifdef HAVE_CYGWIN
+ umask(prev_mask);
+#endif
cleanup_exit(1);
}
+#ifdef HAVE_CYGWIN
+ umask(prev_mask);
+#endif
if (listen(sock, 5) < 0) {
perror("listen");
cleanup_exit(1);
@@ -1086,12 +1110,14 @@ main(int ac, char **av)
close(1);
close(2);
+#ifdef HAVE_SETRLIMIT
/* deny core dumps, since memory contains unencrypted private keys */
rlim.rlim_cur = rlim.rlim_max = 0;
if (setrlimit(RLIMIT_CORE, &rlim) < 0) {
error("setrlimit RLIMIT_CORE: %s", strerror(errno));
cleanup_exit(1);
}
+#endif
skip:
fatal_add_cleanup(cleanup_socket, NULL);
OpenPOWER on IntegriCloud