View | Details | Raw Unified | Return to bug 1569
Collapse All | Expand All

(-)canohost.c (-2 / +16 lines)
Lines 27-32 Link Here
27
#include <stdlib.h>
27
#include <stdlib.h>
28
#include <string.h>
28
#include <string.h>
29
#include <stdarg.h>
29
#include <stdarg.h>
30
#include <unistd.h>
30
31
31
#include "xmalloc.h"
32
#include "xmalloc.h"
32
#include "packet.h"
33
#include "packet.h"
Lines 299-307 Link Here
299
}
300
}
300
301
301
char *
302
char *
302
get_local_name(int sock)
303
get_local_name(int fd)
303
{
304
{
304
	return get_socket_address(sock, 0, NI_NAMEREQD);
305
	char *host, myname[NI_MAXHOST];
306
307
	/* Assume we were passwd a socket */
308
	if ((host = get_socket_address(fd, 0, NI_NAMEREQD)) != NULL)
309
		return host;
310
311
	/* Handle the case where we were passed a pipe */
312
	if (gethostname(myname, sizeof(myname)) == -1) {
313
		verbose("get_local_name: gethostname: %s", strerror(errno));
314
	} else {
315
		host = xstrdup(myname);
316
	}
317
318
	return host;
305
}
319
}
306
320
307
/*
321
/*
(-)ssh-keysign.c (-1 / +1 lines)
Lines 222-228 Link Here
222
	if ((fd == STDIN_FILENO) || (fd == STDOUT_FILENO))
222
	if ((fd == STDIN_FILENO) || (fd == STDOUT_FILENO))
223
		fatal("bad fd");
223
		fatal("bad fd");
224
	if ((host = get_local_name(fd)) == NULL)
224
	if ((host = get_local_name(fd)) == NULL)
225
		fatal("cannot get sockname for fd");
225
		fatal("cannot get local name for fd");
226
226
227
	data = buffer_get_string(&b, &dlen);
227
	data = buffer_get_string(&b, &dlen);
228
	if (valid_request(pw, host, &key, data, dlen) < 0)
228
	if (valid_request(pw, host, &key, data, dlen) < 0)
(-)sshconnect2.c (-12 / +3 lines)
Lines 1488-1494 Link Here
1488
	debug2("ssh_keysign called");
1488
	debug2("ssh_keysign called");
1489
1489
1490
	if (stat(_PATH_SSH_KEY_SIGN, &st) < 0) {
1490
	if (stat(_PATH_SSH_KEY_SIGN, &st) < 0) {
1491
		error("ssh_keysign: no installed: %s", strerror(errno));
1491
		error("ssh_keysign: not installed: %s", strerror(errno));
1492
		return -1;
1492
		return -1;
1493
	}
1493
	}
1494
	if (fflush(stdout) != 0)
1494
	if (fflush(stdout) != 0)
Lines 1558-1564 Link Here
1558
	Sensitive *sensitive = authctxt->sensitive;
1558
	Sensitive *sensitive = authctxt->sensitive;
1559
	Buffer b;
1559
	Buffer b;
1560
	u_char *signature, *blob;
1560
	u_char *signature, *blob;
1561
	char *chost, *pkalg, *p, myname[NI_MAXHOST];
1561
	char *chost, *pkalg, *p;
1562
	const char *service;
1562
	const char *service;
1563
	u_int blen, slen;
1563
	u_int blen, slen;
1564
	int ok, i, len, found = 0;
1564
	int ok, i, len, found = 0;
Lines 1582-1597 Link Here
1582
		return 0;
1582
		return 0;
1583
	}
1583
	}
1584
	/* figure out a name for the client host */
1584
	/* figure out a name for the client host */
1585
	p = NULL;
1585
	p = get_local_name(packet_get_connection_in());
1586
	if (packet_connection_is_on_socket())
1587
		p = get_local_name(packet_get_connection_in());
1588
	if (p == NULL) {
1589
		if (gethostname(myname, sizeof(myname)) == -1) {
1590
			verbose("userauth_hostbased: gethostname: %s", 
1591
			    strerror(errno));
1592
		} else
1593
			p = xstrdup(myname);
1594
	}
1595
	if (p == NULL) {
1586
	if (p == NULL) {
1596
		error("userauth_hostbased: cannot get local ipaddr/name");
1587
		error("userauth_hostbased: cannot get local ipaddr/name");
1597
		key_free(private);
1588
		key_free(private);

Return to bug 1569