summaryrefslogtreecommitdiff
path: root/ssh-agent.c
diff options
context:
space:
mode:
authormouring <mouring>2001-05-03 22:59:24 +0000
committermouring <mouring>2001-05-03 22:59:24 +0000
commit5c6e609cadaefc46c3df736461457661a35dd9b0 (patch)
tree6a7bd5c5a8a2a3d1e47da4759ffa62ee0383ee97 /ssh-agent.c
parentab564b35504b74601766869d7e82077d2ea12953 (diff)
downloadopenssh-5c6e609cadaefc46c3df736461457661a35dd9b0.tar.gz
- (bal) Avoid socket file security issues in ssh-agent for Cygwin.
Patch by Egor Duda <deo@logos-m.ru>
Diffstat (limited to 'ssh-agent.c')
-rw-r--r--ssh-agent.c12
1 files changed, 12 insertions, 0 deletions
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);