diff options
author | Colin Watson <cjwatson@debian.org> | 2009-12-29 21:34:25 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2009-12-29 21:34:25 +0000 |
commit | fa585019a79ebcb4e0202b1c33f87ff1c5c9ce1c (patch) | |
tree | 28fc9a13eaab935e4de055b561b333d67387a934 /sshconnect.c | |
parent | 04942aa41fa94ec6f2c3ce1d348f600f31bb7c78 (diff) | |
parent | 3e2e0ac10674d77618c4c7339e18b83ced247492 (diff) |
import openssh-4.3p2-gsskex-20060223.patch
Diffstat (limited to 'sshconnect.c')
-rw-r--r-- | sshconnect.c | 43 |
1 files changed, 39 insertions, 4 deletions
diff --git a/sshconnect.c b/sshconnect.c index ba7b9b71e..64ffec240 100644 --- a/sshconnect.c +++ b/sshconnect.c | |||
@@ -13,7 +13,7 @@ | |||
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include "includes.h" | 15 | #include "includes.h" |
16 | RCSID("$OpenBSD: sshconnect.c,v 1.168 2005/07/17 07:17:55 djm Exp $"); | 16 | RCSID("$OpenBSD: sshconnect.c,v 1.171 2005/12/06 22:38:27 reyk Exp $"); |
17 | 17 | ||
18 | #include <openssl/bn.h> | 18 | #include <openssl/bn.h> |
19 | 19 | ||
@@ -31,13 +31,12 @@ RCSID("$OpenBSD: sshconnect.c,v 1.168 2005/07/17 07:17:55 djm Exp $"); | |||
31 | #include "readconf.h" | 31 | #include "readconf.h" |
32 | #include "atomicio.h" | 32 | #include "atomicio.h" |
33 | #include "misc.h" | 33 | #include "misc.h" |
34 | |||
35 | #include "dns.h" | 34 | #include "dns.h" |
36 | 35 | ||
37 | char *client_version_string = NULL; | 36 | char *client_version_string = NULL; |
38 | char *server_version_string = NULL; | 37 | char *server_version_string = NULL; |
39 | 38 | ||
40 | int matching_host_key_dns = 0; | 39 | static int matching_host_key_dns = 0; |
41 | 40 | ||
42 | /* import */ | 41 | /* import */ |
43 | extern Options options; | 42 | extern Options options; |
@@ -604,7 +603,7 @@ check_host_key(char *host, struct sockaddr *hostaddr, Key *host_key, | |||
604 | file_key = key_new(host_key->type); | 603 | file_key = key_new(host_key->type); |
605 | 604 | ||
606 | /* | 605 | /* |
607 | * Check if the host key is present in the user\'s list of known | 606 | * Check if the host key is present in the user's list of known |
608 | * hosts or in the systemwide list. | 607 | * hosts or in the systemwide list. |
609 | */ | 608 | */ |
610 | host_file = user_hostfile; | 609 | host_file = user_hostfile; |
@@ -1035,3 +1034,39 @@ warn_changed_key(Key *host_key) | |||
1035 | 1034 | ||
1036 | xfree(fp); | 1035 | xfree(fp); |
1037 | } | 1036 | } |
1037 | |||
1038 | /* | ||
1039 | * Execute a local command | ||
1040 | */ | ||
1041 | int | ||
1042 | ssh_local_cmd(const char *args) | ||
1043 | { | ||
1044 | char *shell; | ||
1045 | pid_t pid; | ||
1046 | int status; | ||
1047 | |||
1048 | if (!options.permit_local_command || | ||
1049 | args == NULL || !*args) | ||
1050 | return (1); | ||
1051 | |||
1052 | if ((shell = getenv("SHELL")) == NULL) | ||
1053 | shell = _PATH_BSHELL; | ||
1054 | |||
1055 | pid = fork(); | ||
1056 | if (pid == 0) { | ||
1057 | debug3("Executing %s -c \"%s\"", shell, args); | ||
1058 | execl(shell, shell, "-c", args, (char *)NULL); | ||
1059 | error("Couldn't execute %s -c \"%s\": %s", | ||
1060 | shell, args, strerror(errno)); | ||
1061 | _exit(1); | ||
1062 | } else if (pid == -1) | ||
1063 | fatal("fork failed: %.100s", strerror(errno)); | ||
1064 | while (waitpid(pid, &status, 0) == -1) | ||
1065 | if (errno != EINTR) | ||
1066 | fatal("Couldn't wait for child: %s", strerror(errno)); | ||
1067 | |||
1068 | if (!WIFEXITED(status)) | ||
1069 | return (1); | ||
1070 | |||
1071 | return (WEXITSTATUS(status)); | ||
1072 | } | ||