summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-05-03 22:59:24 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-05-03 22:59:24 +0000
commit3524d697374a37d39e971d96c33080c307304820 (patch)
tree0aa3c1cae184d546bbdc1776e51fe59f2d0b65f2
parent834417afa544d3521f9dbb17335d777c3a8a0b31 (diff)
- (bal) Avoid socket file security issues in ssh-agent for Cygwin.
Patch by Egor Duda <deo@logos-m.ru>
-rw-r--r--ChangeLog4
-rw-r--r--ssh-agent.c12
2 files changed, 15 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 0b530a4c5..46729c616 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,8 @@
10 [servconf.c] 10 [servconf.c]
11 remove "\n" from fatal() 11 remove "\n" from fatal()
12 - (bal) Updated Cygwin README by Corinna Vinschen <vinschen@redhat.com> 12 - (bal) Updated Cygwin README by Corinna Vinschen <vinschen@redhat.com>
13 - (bal) Avoid socket file security issues in ssh-agent for Cygwin.
14 Patch by Egor Duda <deo@logos-m.ru>
13 15
1420010503 1620010503
15 - OpenBSD CVS Sync 17 - OpenBSD CVS Sync
@@ -5321,4 +5323,4 @@
5321 - Wrote replacements for strlcpy and mkdtemp 5323 - Wrote replacements for strlcpy and mkdtemp
5322 - Released 1.0pre1 5324 - Released 1.0pre1
5323 5325
5324$Id: ChangeLog,v 1.1194 2001/05/03 22:45:21 mouring Exp $ 5326$Id: ChangeLog,v 1.1195 2001/05/03 22:59:24 mouring Exp $
diff --git a/ssh-agent.c b/ssh-agent.c
index e8362ded0..07dafaa57 100644
--- a/ssh-agent.c
+++ b/ssh-agent.c
@@ -714,6 +714,9 @@ main(int ac, char **av)
714#ifdef HAVE_SETRLIMIT 714#ifdef HAVE_SETRLIMIT
715 struct rlimit rlim; 715 struct rlimit rlim;
716#endif 716#endif
717#ifdef HAVE_CYGWIN
718 int prev_mask;
719#endif
717 pid_t pid; 720 pid_t pid;
718 char *shell, *format, *pidstr, pidstrbuf[1 + 3 * sizeof pid]; 721 char *shell, *format, *pidstr, pidstrbuf[1 + 3 * sizeof pid];
719 extern int optind; 722 extern int optind;
@@ -805,10 +808,19 @@ main(int ac, char **av)
805 memset(&sunaddr, 0, sizeof(sunaddr)); 808 memset(&sunaddr, 0, sizeof(sunaddr));
806 sunaddr.sun_family = AF_UNIX; 809 sunaddr.sun_family = AF_UNIX;
807 strlcpy(sunaddr.sun_path, socket_name, sizeof(sunaddr.sun_path)); 810 strlcpy(sunaddr.sun_path, socket_name, sizeof(sunaddr.sun_path));
811#ifdef HAVE_CYGWIN
812 prev_mask = umask(0177);
813#endif
808 if (bind(sock, (struct sockaddr *) & sunaddr, sizeof(sunaddr)) < 0) { 814 if (bind(sock, (struct sockaddr *) & sunaddr, sizeof(sunaddr)) < 0) {
809 perror("bind"); 815 perror("bind");
816#ifdef HAVE_CYGWIN
817 umask(prev_mask);
818#endif
810 cleanup_exit(1); 819 cleanup_exit(1);
811 } 820 }
821#ifdef HAVE_CYGWIN
822 umask(prev_mask);
823#endif
812 if (listen(sock, 5) < 0) { 824 if (listen(sock, 5) < 0) {
813 perror("listen"); 825 perror("listen");
814 cleanup_exit(1); 826 cleanup_exit(1);