Commit 5ec806bb authored by Niels Möller's avatar Niels Möller
Browse files

* src/lsh.c, src/lshd.c, src/lsh_proxy.c: Improved default

behaviour if no --port argument is given.

Rev: src/lsh.c:1.104
Rev: src/lsh_proxy.c:1.10
Rev: src/lshd.c:1.86
parent 053deeea
......@@ -167,7 +167,10 @@ make_options(struct alist *algorithms,
self->not = 0;
self->remote = NULL;
self->user = getenv("LOGNAME");
self->port = "ssh";
/* Default behaviour is to lookup the "ssh" service, and fall back
* to port 22 if that fails. */
self->port = NULL;
self->sloppy = 0;
self->capture = NULL;
......@@ -912,7 +915,10 @@ main_argp_parser(int key, char *arg, struct argp_state *state)
case ARGP_KEY_ARG:
if (!state->arg_num)
{
self->remote = make_address_info_c(arg, self->port);
if (self->port)
self->remote = make_address_info_c(arg, self->port, 0);
else
self->remote = make_address_info_c(arg, "ssh", 22);
if (!self->remote)
argp_error(state, "Invalid port or service '%s'.", self->port);
......
......@@ -158,7 +158,10 @@ make_lsh_proxy_options(struct io_backend *backend,
self->backend = backend;
self->style = SEXP_TRANSPORT;
self->interface = NULL;
self->port = "ssh";
/* Default behaviour is to lookup the "ssh" service, and fall back
* to port 22 if that fails. */
self->port = NULL;
/* FIXME: this should perhaps use sysconfdir */
self->hostkey = "/etc/lsh_host_key";
self->local = NULL;
......@@ -299,7 +302,11 @@ main_argp_parser(int key, char *arg, struct argp_state *state)
break;
case ARGP_KEY_END:
self->local = make_address_info_c(self->interface, self->port);
if (self->port)
self->local = make_address_info_c(arg, self->port, 0);
else
self->local = make_address_info_c(arg, "ssh", 22);
if (!self->local)
argp_error(state, "Invalid interface, port or service, %s:%s'.",
self->interface ? self->interface : "ANY",
......@@ -437,6 +444,7 @@ do_proxy_destination(struct command *s,
COMMAND_RETURN(c, closure->options->destination);
else
{
/* FIXME: Why not use client_addr->peer? /nisse*/
struct sockaddr_in sa;
int salen = sizeof(sa);
......@@ -455,7 +463,6 @@ do_proxy_destination(struct command *s,
EXCEPTION_RAISE(e, ex);
}
}
}
......
......@@ -165,7 +165,11 @@ make_lshd_options(struct io_backend *backend,
ATOM_DSA, make_dsa_algorithm(random), -1);
self->style = SEXP_TRANSPORT;
self->interface = NULL;
self->port = "ssh";
/* Default behaviour is to lookup the "ssh" service, and fall back
* to port 22 if that fails. */
self->port = NULL;
/* FIXME: this should perhaps use sysconfdir */
self->hostkey = "/etc/lsh_host_key";
self->local = NULL;
......@@ -309,8 +313,11 @@ main_argp_parser(int key, char *arg, struct argp_state *state)
break;
case ARGP_KEY_END:
self->local = make_address_info_c(self->interface, self->port);
if (self->port)
self->local = make_address_info_c(arg, self->port, 0);
else
self->local = make_address_info_c(arg, "ssh", 22);
if (!self->local)
argp_error(state, "Invalid interface, port or service, %s:%s'.",
self->interface ? self->interface : "ANY",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment