Bugzilla – Attachment 1073 Details for
Bug 910
known_hosts port numbers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch 980 for 4.3p2 with minor modifications
openssh-4.3p2-bug910-patch980.patch (text/plain), 3.95 KB, created by
Devin Nate
on 2006-02-21 14:08:25 AEDT
(
hide
)
Description:
Patch 980 for 4.3p2 with minor modifications
Filename:
MIME Type:
Creator:
Devin Nate
Created:
2006-02-21 14:08:25 AEDT
Size:
3.95 KB
patch
obsolete
>--- misc.c.orig 2006-01-31 03:49:28.000000000 -0700 >+++ misc.c 2006-02-20 16:09:56.000000000 -0700 >@@ -33,6 +33,7 @@ > #include "misc.h" > #include "log.h" > #include "xmalloc.h" >+#include "ssh.h" > > /* remove newline at end of string */ > char * >@@ -312,6 +313,28 @@ > } > > /* >+ * Returns a standardized host+port identifier string. >+ * Caller must free returned string. >+ */ >+char * >+put_host_port(const char *host, u_short port) >+{ >+ int ret; >+ char *hoststr; >+ size_t len; >+ >+ if (port == 0 || port == SSH_DEFAULT_PORT) >+ return(xstrdup(host)); >+ len = strlen(host) + sizeof(port) * 4 + 4; >+ hoststr = xmalloc(len); >+ ret = snprintf(hoststr, len, "[%s]:%d", host, (int)port); >+ if (ret == -1 || (size_t)ret >= len) >+ fatal("put_host_port: snprintf: %s", strerror(errno)); >+ debug3("put_host_port: %s", hoststr); >+ return hoststr; >+} >+ >+/* > * Search for next delimiter between hostnames/addresses and ports. > * Argument may be modified (for termination). > * Returns *cp if parsing succeeds. >--- misc.h.orig 2006-01-31 03:49:28.000000000 -0700 >+++ misc.h 2006-02-20 16:13:24.000000000 -0700 >@@ -21,6 +21,7 @@ > void set_nodelay(int); > int a2port(const char *); > int a2tun(const char *, int *); >+char *put_host_port(const char *, u_short); > char *hpdelim(char **); > char *cleanhostname(char *); > char *colon(char *); >--- sshconnect.c.orig 2005-12-13 01:29:03.000000000 -0700 >+++ sshconnect.c 2006-02-20 16:14:43.000000000 -0700 >@@ -518,12 +518,12 @@ > * is not valid. the user_hostfile will not be updated if 'readonly' is true. > */ > static int >-check_host_key(char *host, struct sockaddr *hostaddr, Key *host_key, >+check_host_key(char *hostname, struct sockaddr *hostaddr, Key *host_key, > int readonly, const char *user_hostfile, const char *system_hostfile) > { > Key *file_key; > const char *type = key_type(host_key); >- char *ip = NULL; >+ char *ip = NULL, *host = NULL; > char hostline[1000], *hostp, *fp; > HostStatus host_status; > HostStatus ip_status; >@@ -574,7 +574,7 @@ > if (getnameinfo(hostaddr, salen, ntop, sizeof(ntop), > NULL, 0, NI_NUMERICHOST) != 0) > fatal("check_host_key: getnameinfo failed"); >- ip = xstrdup(ntop); >+ ip = put_host_port(ntop, options.port); > } else { > ip = xstrdup("<no hostip for proxy command>"); > } >@@ -582,18 +582,21 @@ > * Turn off check_host_ip if the connection is to localhost, via proxy > * command or if we don't have a hostname to compare with > */ >- if (options.check_host_ip && >- (local || strcmp(host, ip) == 0 || options.proxy_command != NULL)) >+ if (options.check_host_ip && (local || >+ strcmp(hostname, ip) == 0 || options.proxy_command != NULL)) > options.check_host_ip = 0; > > /* >- * Allow the user to record the key under a different name. This is >- * useful for ssh tunneling over forwarded connections or if you run >- * multiple sshd's on different ports on the same machine. >+ * Allow the user to record the key under a different name or >+ * differentiate a non-standard port. This is useful for ssh >+ * tunneling over forwarded connections or if you run multiple >+ * sshd's on different ports on the same machine. > */ > if (options.host_key_alias != NULL) { >- host = options.host_key_alias; >+ host = xstrdup(options.host_key_alias); > debug("using hostkeyalias: %s", host); >+ } else { >+ host = put_host_port(hostname, options.port); > } > > /* >@@ -855,10 +858,12 @@ > } > > xfree(ip); >+ xfree(host); > return 0; > > fail: > xfree(ip); >+ xfree(host); > return -1; > } > >--- sshd.8.orig 2006-02-01 04:05:43.000000000 -0700 >+++ sshd.8 2006-02-20 16:09:56.000000000 -0700 >@@ -555,6 +555,13 @@ > to indicate negation: if the host name matches a negated > pattern, it is not accepted (by that line) even if it matched another > pattern on the line. >+A hostname or address may optionally be enclosed within >+.Ql \&[ >+and >+.Ql \&] >+brackets then followed by >+.Ql \&: >+and and a non-standard port number. > .Pp > Alternately, hostnames may be stored in a hashed form which hides host names > and addresses should the file's contents be disclosed.
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 910
:
716
|
717
|
719
|
912
|
913
|
914
|
920
|
946
|
954
|
980
|
1051
|
1052
|
1073
|
1131
|
1132