diff options
author | Ben Lindstrom <mouring@eviladmin.org> | 2001-05-03 23:00:39 +0000 |
---|---|---|
committer | Ben Lindstrom <mouring@eviladmin.org> | 2001-05-03 23:00:39 +0000 |
commit | 1792f887914143addbaaf1c4dc35dcd8db6faafb (patch) | |
tree | cf127c2f947f2b78595bc98de881072d2437aba8 | |
parent | 64f6dd837339549fe2ca02d98f8a2424cedd9c7b (diff) | |
download | openssh-git-1792f887914143addbaaf1c4dc35dcd8db6faafb.tar.gz |
- (bal) Avoid socket file security issues in ssh-agent for Cygwin.
Patch by Egor Duda <deo@logos-m.ru>
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | ssh-agent.c | 12 |
2 files changed, 15 insertions, 1 deletions
@@ -1,5 +1,7 @@ 20010504 - (bal) Updated Cygwin README by Corinna Vinschen <vinschen@redhat.com> + - (bal) Avoid socket file security issues in ssh-agent for Cygwin. + Patch by Egor Duda <deo@logos-m.ru> 20010430 - (djm) Add .cvsignore files, suggested by Wayne Davison <wayne@blorf.net> @@ -5280,4 +5282,4 @@ - Wrote replacements for strlcpy and mkdtemp - Released 1.0pre1 -$Id: ChangeLog,v 1.1179.2.7 2001/05/03 22:48:03 mouring Exp $ +$Id: ChangeLog,v 1.1179.2.8 2001/05/03 23:00:39 mouring Exp $ diff --git a/ssh-agent.c b/ssh-agent.c index e8362ded..07dafaa5 100644 --- a/ssh-agent.c +++ b/ssh-agent.c @@ -714,6 +714,9 @@ main(int ac, char **av) #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]; extern int optind; @@ -805,10 +808,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)); +#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); |