Commit 690a422b authored by Niels Möller's avatar Niels Möller
Browse files

(make_gateway_address): Take a plain

NUL-termianted string to identify the target.

Rev: src/gateway.c:1.9
Rev: src/gateway.h:1.3
parent 5de0a4af
...@@ -79,18 +79,19 @@ check_string(const uint8_t *s) ...@@ -79,18 +79,19 @@ check_string(const uint8_t *s)
} }
struct local_info * struct local_info *
make_gateway_address(char *local_user, char *remote_user, make_gateway_address(const char *local_user, const char *remote_user,
struct address_info *target) const char *target)
{ {
char *tmp = getenv(ENV_TMPDIR); char *tmp = getenv(ENV_TMPDIR);
unsigned length = strlen(target);
if (!tmp) if (!tmp)
tmp = "/tmp"; tmp = "/tmp";
if (check_string(local_user) if (check_string(local_user)
&& check_string(remote_user) && check_string(remote_user)
&& check_string_l(target->ip->length, target->ip->data)) && check_string_l(length, target))
return make_local_info(ssh_format("%lz/x-lsh-%lz", tmp, local_user), return make_local_info(ssh_format("%lz/x-lsh-%lz", tmp, local_user),
ssh_format("%lS:%lz", target->ip, remote_user)); ssh_format("%lz:%lz", target, remote_user));
else else
return NULL; return NULL;
} }
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
/* Formats the address of the local gateway socket. */ /* Formats the address of the local gateway socket. */
struct local_info * struct local_info *
make_gateway_address(char *local_user, char *remote_user, make_gateway_address(const char *local_user, const char *remote_user,
struct address_info *target); const char *target);
#endif /* GATEWAY_H_INCLUDED */ #endif /* GATEWAY_H_INCLUDED */
Supports Markdown
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