+20050626
+ - (djm) OpenBSD CVS Sync
+ - djm@cvs.openbsd.org 2005/06/17 22:53:47
+ [ssh.c sshconnect.c]
+ Fix ControlPath's %p expanding to "0" for a default port,
+ spotted dwmw2 AT infradead.org; ok markus@
+
20050618
- (djm) OpenBSD CVS Sync
- djm@cvs.openbsd.org 2005/05/20 12:57:01;
*/
#include "includes.h"
-RCSID("$OpenBSD: ssh.c,v 1.243 2005/06/16 03:38:36 djm Exp $");
+RCSID("$OpenBSD: ssh.c,v 1.244 2005/06/17 22:53:46 djm Exp $");
#include <openssl/evp.h>
#include <openssl/err.h>
int dummy;
extern int optind, optreset;
extern char *optarg;
+ struct servent *sp;
Forward fwd;
__progname = ssh_get_progname(av[0]);
if (options.control_path != NULL)
control_client(options.control_path);
+ /* Get default port if port has not been set. */
+ if (options.port == 0) {
+ sp = getservbyname(SSH_SERVICE_NAME, "tcp");
+ options.port = sp ? ntohs(sp->s_port) : SSH_DEFAULT_PORT;
+ }
+
/* Open a connection to the remote host. */
if (ssh_connect(host, &hostaddr, options.port,
options.address_family, options.connection_attempts,
*/
#include "includes.h"
-RCSID("$OpenBSD: sshconnect.c,v 1.165 2005/06/17 02:44:33 djm Exp $");
+RCSID("$OpenBSD: sshconnect.c,v 1.166 2005/06/17 22:53:47 djm Exp $");
#include <openssl/bn.h>
int sock = -1, attempt;
char ntop[NI_MAXHOST], strport[NI_MAXSERV];
struct addrinfo hints, *ai, *aitop;
- struct servent *sp;
debug2("ssh_connect: needpriv %d", needpriv);
- /* Get default port if port has not been set. */
- if (port == 0) {
- sp = getservbyname(SSH_SERVICE_NAME, "tcp");
- if (sp)
- port = ntohs(sp->s_port);
- else
- port = SSH_DEFAULT_PORT;
- }
/* If a proxy command is given, connect using it. */
if (proxy_command != NULL)
return ssh_proxy_connect(host, port, proxy_command);