- (djm) [ssh.c] Use separate var for address length

This commit is contained in:
Damien Miller 2004-06-15 11:14:45 +10:00
parent 5e6f4db085
commit 07b6ff12c4
2 changed files with 9 additions and 7 deletions

View File

@ -34,6 +34,7 @@
[sshd.c]
set_nonblock() instead of fnctl(...,O_NONBLOCK); "looks sane" deraadt@
- (djm) Fix Makefile.in for connection sharing changes
- (djm) [ssh.c] Use separate var for address length
20040603
- (dtucker) [auth-pam.c] Don't use pam_* namespace for sshd's PAM functions.
@ -1218,4 +1219,4 @@
- (djm) Trim deprecated options from INSTALL. Mention UsePAM
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
$Id: ChangeLog,v 1.3384 2004/06/15 00:44:40 djm Exp $
$Id: ChangeLog,v 1.3385 2004/06/15 01:14:45 djm Exp $

13
ssh.c
View File

@ -1042,13 +1042,14 @@ ssh_control_listener(void)
{
struct sockaddr_un addr;
mode_t old_umask;
int addr_len;
if (options.control_path == NULL || options.control_master != 1)
return;
memset(&addr, '\0', sizeof(addr));
addr.sun_family = AF_UNIX;
addr.sun_len = offsetof(struct sockaddr_un, sun_path) +
addr_len = offsetof(struct sockaddr_un, sun_path) +
strlen(options.control_path) + 1;
if (strlcpy(addr.sun_path, options.control_path,
@ -1059,7 +1060,7 @@ ssh_control_listener(void)
fatal("%s socket(): %s\n", __func__, strerror(errno));
old_umask = umask(0177);
if (bind(control_fd, (struct sockaddr*)&addr, addr.sun_len) == -1) {
if (bind(control_fd, (struct sockaddr*)&addr, addr_len) == -1) {
control_fd = -1;
if (errno == EINVAL)
fatal("ControlSocket %s already exists",
@ -1229,13 +1230,13 @@ static void
control_client(const char *path)
{
struct sockaddr_un addr;
int r, sock, exitval;
int r, sock, exitval, addr_len;
Buffer m;
char *cp;
memset(&addr, '\0', sizeof(addr));
addr.sun_family = AF_UNIX;
addr.sun_len = offsetof(struct sockaddr_un, sun_path) +
addr_len = offsetof(struct sockaddr_un, sun_path) +
strlen(path) + 1;
if (strlcpy(addr.sun_path, path,
@ -1245,7 +1246,7 @@ control_client(const char *path)
if ((sock = socket(PF_UNIX, SOCK_STREAM, 0)) < 0)
fatal("%s socket(): %s", __func__, strerror(errno));
if (connect(sock, (struct sockaddr*)&addr, addr.sun_len) == -1)
if (connect(sock, (struct sockaddr*)&addr, addr_len) == -1)
fatal("Couldn't connect to %s: %s", path, strerror(errno));
if ((cp = getenv("TERM")) == NULL)