diff options
author | Colin Watson <cjwatson@debian.org> | 2006-05-12 08:53:37 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2006-05-12 08:53:37 +0000 |
commit | 2ee73b36b9a35daeaa4b065046882dc1f5f551b6 (patch) | |
tree | f64a4ace625514e94759878c0b94ab0a79805bbd /sshconnect.c | |
parent | 3c190ec8e469477ea65fbf4cc83062c65c281434 (diff) | |
parent | 3e2e0ac10674d77618c4c7339e18b83ced247492 (diff) |
Merge 4.3p2 to the trunk.
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 10eaac35d..8a63ef22b 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; |
@@ -647,7 +646,7 @@ check_host_key(char *host, struct sockaddr *hostaddr, Key *host_key, | |||
647 | file_key = key_new(host_key->type); | 646 | file_key = key_new(host_key->type); |
648 | 647 | ||
649 | /* | 648 | /* |
650 | * Check if the host key is present in the user\'s list of known | 649 | * Check if the host key is present in the user's list of known |
651 | * hosts or in the systemwide list. | 650 | * hosts or in the systemwide list. |
652 | */ | 651 | */ |
653 | host_file = user_hostfile; | 652 | host_file = user_hostfile; |
@@ -1078,3 +1077,39 @@ warn_changed_key(Key *host_key) | |||
1078 | 1077 | ||
1079 | xfree(fp); | 1078 | xfree(fp); |
1080 | } | 1079 | } |
1080 | |||
1081 | /* | ||
1082 | * Execute a local command | ||
1083 | */ | ||
1084 | int | ||
1085 | ssh_local_cmd(const char *args) | ||
1086 | { | ||
1087 | char *shell; | ||
1088 | pid_t pid; | ||
1089 | int status; | ||
1090 | |||
1091 | if (!options.permit_local_command || | ||
1092 | args == NULL || !*args) | ||
1093 | return (1); | ||
1094 | |||
1095 | if ((shell = getenv("SHELL")) == NULL) | ||
1096 | shell = _PATH_BSHELL; | ||
1097 | |||
1098 | pid = fork(); | ||
1099 | if (pid == 0) { | ||
1100 | debug3("Executing %s -c \"%s\"", shell, args); | ||
1101 | execl(shell, shell, "-c", args, (char *)NULL); | ||
1102 | error("Couldn't execute %s -c \"%s\": %s", | ||
1103 | shell, args, strerror(errno)); | ||
1104 | _exit(1); | ||
1105 | } else if (pid == -1) | ||
1106 | fatal("fork failed: %.100s", strerror(errno)); | ||
1107 | while (waitpid(pid, &status, 0) == -1) | ||
1108 | if (errno != EINTR) | ||
1109 | fatal("Couldn't wait for child: %s", strerror(errno)); | ||
1110 | |||
1111 | if (!WIFEXITED(status)) | ||
1112 | return (1); | ||
1113 | |||
1114 | return (WEXITSTATUS(status)); | ||
1115 | } | ||