diff options
author | Colin Watson <cjwatson@debian.org> | 2010-01-24 22:46:54 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2010-01-24 22:46:54 +0000 |
commit | 59247ecde39f2d826a94ab07f6095ca1f6644e88 (patch) | |
tree | 5910d4a840352aafbf67e8a39fa63936e5529b26 /ssh.c | |
parent | 07d905b406c4ab64ea2f10a22f4f8f0d595269f6 (diff) | |
parent | 964476f91b66c475d5b8fa1e8b28d39a97a1b56e (diff) |
* New upstream release.
* Update to GSSAPI patch from
http://www.sxw.org.uk/computing/patches/openssh-5.3p1-gsskex-all-20100124.patch.
Diffstat (limited to 'ssh.c')
-rw-r--r-- | ssh.c | 21 |
1 files changed, 12 insertions, 9 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh.c,v 1.324 2009/02/12 03:00:56 djm Exp $ */ | 1 | /* $OpenBSD: ssh.c,v 1.326 2009/07/02 02:11:47 dtucker Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -48,6 +48,7 @@ | |||
48 | #endif | 48 | #endif |
49 | #include <sys/resource.h> | 49 | #include <sys/resource.h> |
50 | #include <sys/ioctl.h> | 50 | #include <sys/ioctl.h> |
51 | #include <sys/param.h> | ||
51 | #include <sys/socket.h> | 52 | #include <sys/socket.h> |
52 | 53 | ||
53 | #include <ctype.h> | 54 | #include <ctype.h> |
@@ -203,8 +204,8 @@ void muxserver_listen(void); | |||
203 | int | 204 | int |
204 | main(int ac, char **av) | 205 | main(int ac, char **av) |
205 | { | 206 | { |
206 | int i, opt, exit_status, use_syslog; | 207 | int i, r, opt, exit_status, use_syslog; |
207 | char *p, *cp, *line, buf[256]; | 208 | char *p, *cp, *line, *argv0, buf[MAXPATHLEN]; |
208 | struct stat st; | 209 | struct stat st; |
209 | struct passwd *pw; | 210 | struct passwd *pw; |
210 | int dummy, timeout_ms; | 211 | int dummy, timeout_ms; |
@@ -270,6 +271,7 @@ main(int ac, char **av) | |||
270 | /* Parse command-line arguments. */ | 271 | /* Parse command-line arguments. */ |
271 | host = NULL; | 272 | host = NULL; |
272 | use_syslog = 0; | 273 | use_syslog = 0; |
274 | argv0 = av[0]; | ||
273 | 275 | ||
274 | again: | 276 | again: |
275 | while ((opt = getopt(ac, av, "1246ab:c:e:fgi:kl:m:no:p:qstvx" | 277 | while ((opt = getopt(ac, av, "1246ab:c:e:fgi:kl:m:no:p:qstvx" |
@@ -605,7 +607,7 @@ main(int ac, char **av) | |||
605 | * Initialize "log" output. Since we are the client all output | 607 | * Initialize "log" output. Since we are the client all output |
606 | * actually goes to stderr. | 608 | * actually goes to stderr. |
607 | */ | 609 | */ |
608 | log_init(av[0], | 610 | log_init(argv0, |
609 | options.log_level == -1 ? SYSLOG_LEVEL_INFO : options.log_level, | 611 | options.log_level == -1 ? SYSLOG_LEVEL_INFO : options.log_level, |
610 | SYSLOG_FACILITY_USER, !use_syslog); | 612 | SYSLOG_FACILITY_USER, !use_syslog); |
611 | 613 | ||
@@ -618,9 +620,10 @@ main(int ac, char **av) | |||
618 | fatal("Can't open user config file %.100s: " | 620 | fatal("Can't open user config file %.100s: " |
619 | "%.100s", config, strerror(errno)); | 621 | "%.100s", config, strerror(errno)); |
620 | } else { | 622 | } else { |
621 | snprintf(buf, sizeof buf, "%.100s/%.100s", pw->pw_dir, | 623 | r = snprintf(buf, sizeof buf, "%s/%s", pw->pw_dir, |
622 | _PATH_SSH_USER_CONFFILE); | 624 | _PATH_SSH_USER_CONFFILE); |
623 | (void)read_config_file(buf, host, &options, 1); | 625 | if (r > 0 && (size_t)r < sizeof(buf)) |
626 | (void)read_config_file(buf, host, &options, 1); | ||
624 | 627 | ||
625 | /* Read systemwide configuration file after use config. */ | 628 | /* Read systemwide configuration file after use config. */ |
626 | (void)read_config_file(_PATH_HOST_CONFIG_FILE, host, | 629 | (void)read_config_file(_PATH_HOST_CONFIG_FILE, host, |
@@ -633,7 +636,7 @@ main(int ac, char **av) | |||
633 | channel_set_af(options.address_family); | 636 | channel_set_af(options.address_family); |
634 | 637 | ||
635 | /* reinit */ | 638 | /* reinit */ |
636 | log_init(av[0], options.log_level, SYSLOG_FACILITY_USER, !use_syslog); | 639 | log_init(argv0, options.log_level, SYSLOG_FACILITY_USER, !use_syslog); |
637 | 640 | ||
638 | seed_rng(); | 641 | seed_rng(); |
639 | 642 | ||
@@ -771,9 +774,9 @@ main(int ac, char **av) | |||
771 | * Now that we are back to our own permissions, create ~/.ssh | 774 | * Now that we are back to our own permissions, create ~/.ssh |
772 | * directory if it doesn't already exist. | 775 | * directory if it doesn't already exist. |
773 | */ | 776 | */ |
774 | snprintf(buf, sizeof buf, "%.100s%s%.100s", pw->pw_dir, | 777 | r = snprintf(buf, sizeof buf, "%s%s%s", pw->pw_dir, |
775 | strcmp(pw->pw_dir, "/") ? "/" : "", _PATH_SSH_USER_DIR); | 778 | strcmp(pw->pw_dir, "/") ? "/" : "", _PATH_SSH_USER_DIR); |
776 | if (stat(buf, &st) < 0) | 779 | if (r > 0 && (size_t)r < sizeof(buf) && stat(buf, &st) < 0) |
777 | if (mkdir(buf, 0700) < 0) | 780 | if (mkdir(buf, 0700) < 0) |
778 | error("Could not create directory '%.200s'.", buf); | 781 | error("Could not create directory '%.200s'.", buf); |
779 | 782 | ||