- djm@cvs.openbsd.org 2004/06/20 17:36:59
[ssh.c] filter passed env vars at slave in connection sharing case; ok markus@
This commit is contained in:
parent
f7ba8f67b7
commit
365433f883
|
@ -1,3 +1,9 @@
|
||||||
|
20040622
|
||||||
|
- (dtucker) OpenBSD CVS Sync
|
||||||
|
- djm@cvs.openbsd.org 2004/06/20 17:36:59
|
||||||
|
[ssh.c]
|
||||||
|
filter passed env vars at slave in connection sharing case; ok markus@
|
||||||
|
|
||||||
20040620
|
20040620
|
||||||
- (tim) [configure.ac Makefile.in] Only change TEST_SHELL on broken platforms.
|
- (tim) [configure.ac Makefile.in] Only change TEST_SHELL on broken platforms.
|
||||||
|
|
||||||
|
@ -1319,4 +1325,4 @@
|
||||||
- (djm) Trim deprecated options from INSTALL. Mention UsePAM
|
- (djm) Trim deprecated options from INSTALL. Mention UsePAM
|
||||||
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
|
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.3417 2004/06/20 17:37:32 tim Exp $
|
$Id: ChangeLog,v 1.3418 2004/06/22 02:29:23 dtucker Exp $
|
||||||
|
|
44
ssh.c
44
ssh.c
|
@ -40,7 +40,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: ssh.c,v 1.219 2004/06/18 10:55:43 markus Exp $");
|
RCSID("$OpenBSD: ssh.c,v 1.220 2004/06/20 17:36:59 djm Exp $");
|
||||||
|
|
||||||
#include <openssl/evp.h>
|
#include <openssl/evp.h>
|
||||||
#include <openssl/err.h>
|
#include <openssl/err.h>
|
||||||
|
@ -1227,11 +1227,30 @@ control_client_sigrelay(int signo)
|
||||||
kill(control_server_pid, signo);
|
kill(control_server_pid, signo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
env_permitted(char *env)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
char name[1024], *cp;
|
||||||
|
|
||||||
|
strlcpy(name, env, sizeof(name));
|
||||||
|
if ((cp = strchr(name, '=')) == NULL)
|
||||||
|
return (0);
|
||||||
|
|
||||||
|
*cp = '\0';
|
||||||
|
|
||||||
|
for (i = 0; i < options.num_send_env; i++)
|
||||||
|
if (match_pattern(name, options.send_env[i]))
|
||||||
|
return (1);
|
||||||
|
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
control_client(const char *path)
|
control_client(const char *path)
|
||||||
{
|
{
|
||||||
struct sockaddr_un addr;
|
struct sockaddr_un addr;
|
||||||
int i, r, sock, exitval, addr_len;
|
int i, r, sock, exitval, num_env, addr_len;
|
||||||
Buffer m;
|
Buffer m;
|
||||||
char *cp;
|
char *cp;
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
|
@ -1274,12 +1293,21 @@ control_client(const char *path)
|
||||||
buffer_append(&command, "\0", 1);
|
buffer_append(&command, "\0", 1);
|
||||||
buffer_put_cstring(&m, buffer_ptr(&command));
|
buffer_put_cstring(&m, buffer_ptr(&command));
|
||||||
|
|
||||||
/* Pass environment */
|
if (options.num_send_env == 0 || environ == NULL) {
|
||||||
for (i = 0; environ != NULL && environ[i] != NULL; i++)
|
buffer_put_int(&m, 0);
|
||||||
;
|
} else {
|
||||||
buffer_put_int(&m, i);
|
/* Pass environment */
|
||||||
for (i = 0; environ != NULL && environ[i] != NULL; i++)
|
num_env = 0;
|
||||||
buffer_put_cstring(&m, environ[i]);
|
for (i = 0; environ[i] != NULL; i++)
|
||||||
|
if (env_permitted(environ[i]))
|
||||||
|
num_env++; /* Count */
|
||||||
|
|
||||||
|
buffer_put_int(&m, num_env);
|
||||||
|
|
||||||
|
for (i = 0; environ[i] != NULL && num_env >= 0; i++, num_env--)
|
||||||
|
if (env_permitted(environ[i]))
|
||||||
|
buffer_put_cstring(&m, environ[i]);
|
||||||
|
}
|
||||||
|
|
||||||
if (ssh_msg_send(sock, /* version */0, &m) == -1)
|
if (ssh_msg_send(sock, /* version */0, &m) == -1)
|
||||||
fatal("%s: msg_send", __func__);
|
fatal("%s: msg_send", __func__);
|
||||||
|
|
Loading…
Reference in New Issue