@@ -0,0 +1,118 @@
|
|||||||
|
diff --git a/include/libssh/config_parser.h b/include/libssh/config_parser.h
|
||||||
|
index a7dd42a2c8016789a2dad1c409447da11603a0f0..ca353432b8139e5be334f1b815e910ca03562c84 100644
|
||||||
|
--- a/include/libssh/config_parser.h
|
||||||
|
+++ b/include/libssh/config_parser.h
|
||||||
|
@@ -30,6 +30,8 @@
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+#include <stdbool.h>
|
||||||
|
+
|
||||||
|
char *ssh_config_get_cmd(char **str);
|
||||||
|
|
||||||
|
char *ssh_config_get_token(char **str);
|
||||||
|
@@ -49,14 +51,17 @@ int ssh_config_get_yesno(char **str, int notfound);
|
||||||
|
* be stored or NULL if we do not care about the result.
|
||||||
|
* @param[out] port Pointer to the location, where the new port will
|
||||||
|
* be stored or NULL if we do not care about the result.
|
||||||
|
+ * @param[in] ignore_port Set to true if the we should not attempt to parse
|
||||||
|
+ * port number.
|
||||||
|
*
|
||||||
|
* @returns SSH_OK if the provided string is in format of SSH URI,
|
||||||
|
* SSH_ERROR on failure
|
||||||
|
*/
|
||||||
|
int ssh_config_parse_uri(const char *tok,
|
||||||
|
- char **username,
|
||||||
|
- char **hostname,
|
||||||
|
- char **port);
|
||||||
|
+ char **username,
|
||||||
|
+ char **hostname,
|
||||||
|
+ char **port,
|
||||||
|
+ bool ignore_port);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
diff --git a/src/config.c b/src/config.c
|
||||||
|
index c5c40125ac243e4d137601d340f91bb4eba8c973..273db7c8c477dd435b8310e8b7784cb0dc578e0a 100644
|
||||||
|
--- a/src/config.c
|
||||||
|
+++ b/src/config.c
|
||||||
|
@@ -464,7 +464,7 @@ ssh_config_parse_proxy_jump(ssh_session session, const char *s, bool do_parsing)
|
||||||
|
}
|
||||||
|
if (parse_entry) {
|
||||||
|
/* We actually care only about the first item */
|
||||||
|
- rv = ssh_config_parse_uri(cp, &username, &hostname, &port);
|
||||||
|
+ rv = ssh_config_parse_uri(cp, &username, &hostname, &port, false);
|
||||||
|
/* The rest of the list needs to be passed on */
|
||||||
|
if (endp != NULL) {
|
||||||
|
next = strdup(endp + 1);
|
||||||
|
@@ -475,7 +475,7 @@ ssh_config_parse_proxy_jump(ssh_session session, const char *s, bool do_parsing)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* The rest is just sanity-checked to avoid failures later */
|
||||||
|
- rv = ssh_config_parse_uri(cp, NULL, NULL, NULL);
|
||||||
|
+ rv = ssh_config_parse_uri(cp, NULL, NULL, NULL, false);
|
||||||
|
}
|
||||||
|
if (rv != SSH_OK) {
|
||||||
|
goto out;
|
||||||
|
diff --git a/src/config_parser.c b/src/config_parser.c
|
||||||
|
index b8b94611af54f5524e16afc14f2517c3dbadfdd3..d4b2d2c3b74db7ff564ebfdfd09ec31a9ae485be 100644
|
||||||
|
--- a/src/config_parser.c
|
||||||
|
+++ b/src/config_parser.c
|
||||||
|
@@ -162,9 +162,10 @@ int ssh_config_get_yesno(char **str, int notfound)
|
||||||
|
}
|
||||||
|
|
||||||
|
int ssh_config_parse_uri(const char *tok,
|
||||||
|
- char **username,
|
||||||
|
- char **hostname,
|
||||||
|
- char **port)
|
||||||
|
+ char **username,
|
||||||
|
+ char **hostname,
|
||||||
|
+ char **port,
|
||||||
|
+ bool ignore_port)
|
||||||
|
{
|
||||||
|
char *endp = NULL;
|
||||||
|
long port_n;
|
||||||
|
@@ -210,12 +211,17 @@ int ssh_config_parse_uri(const char *tok,
|
||||||
|
if (endp == NULL) {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
- } else {
|
||||||
|
- /* Hostnames or aliases expand to the last colon or to the end */
|
||||||
|
+ } else if (!ignore_port) {
|
||||||
|
+ /* Hostnames or aliases expand to the last colon (if port is requested)
|
||||||
|
+ * or to the end */
|
||||||
|
endp = strrchr(tok, ':');
|
||||||
|
if (endp == NULL) {
|
||||||
|
endp = strchr(tok, '\0');
|
||||||
|
}
|
||||||
|
+ } else {
|
||||||
|
+ /* If no port is requested, expand to the end of line
|
||||||
|
+ * (to accommodate the IPv6 addresses) */
|
||||||
|
+ endp = strchr(tok, '\0');
|
||||||
|
}
|
||||||
|
if (tok == endp) {
|
||||||
|
/* Zero-length hostnames are not valid */
|
||||||
|
diff --git a/src/options.c b/src/options.c
|
||||||
|
index 3851145557a9ef6fd21a664e5bce7506143873c5..b3ecffe15f23e51c5217a58a28dc15256666efa6 100644
|
||||||
|
--- a/src/options.c
|
||||||
|
+++ b/src/options.c
|
||||||
|
@@ -516,17 +516,11 @@ int ssh_options_set(ssh_session session, enum ssh_options_e type,
|
||||||
|
ssh_set_error_invalid(session);
|
||||||
|
return -1;
|
||||||
|
} else {
|
||||||
|
- char *username = NULL, *hostname = NULL, *port = NULL;
|
||||||
|
- rc = ssh_config_parse_uri(value, &username, &hostname, &port);
|
||||||
|
+ char *username = NULL, *hostname = NULL;
|
||||||
|
+ rc = ssh_config_parse_uri(value, &username, &hostname, NULL, true);
|
||||||
|
if (rc != SSH_OK) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
- if (port != NULL) {
|
||||||
|
- SAFE_FREE(username);
|
||||||
|
- SAFE_FREE(hostname);
|
||||||
|
- SAFE_FREE(port);
|
||||||
|
- return -1;
|
||||||
|
- }
|
||||||
|
if (username != NULL) {
|
||||||
|
SAFE_FREE(session->opts.username);
|
||||||
|
session->opts.username = username;
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
<IsA>library</IsA>
|
<IsA>library</IsA>
|
||||||
<Summary>Full C library functions for manipulating a client-side SSH connection</Summary>
|
<Summary>Full C library functions for manipulating a client-side SSH connection</Summary>
|
||||||
<Description>libssh library was designed to be used by programmers needing a working SSH implementation by the mean of a library. The complete control of the client is made by the programmer. With libssh, you can remotely execute programs, transfer files, use a secure and transparent tunnel for your remote programs. With its Secure FTP implementation, you can play with remote files easily, without third-party programs others than libcrypto (from openssl).</Description>
|
<Description>libssh library was designed to be used by programmers needing a working SSH implementation by the mean of a library. The complete control of the client is made by the programmer. With libssh, you can remotely execute programs, transfer files, use a secure and transparent tunnel for your remote programs. With its Secure FTP implementation, you can play with remote files easily, without third-party programs others than libcrypto (from openssl).</Description>
|
||||||
<Archive sha1sum="bc6b6858c3f4d07a302d838258d98e5bae790387" type="tarxz">https://www.libssh.org/files/0.10/libssh-0.10.5.tar.xz</Archive>
|
<Archive sha1sum="e8fb3b4750db11d2483cac4b5f046e301c09b72f" type="tarxz">https://www.libssh.org/files/0.10/libssh-0.10.6.tar.xz</Archive>
|
||||||
<BuildDependencies>
|
<BuildDependencies>
|
||||||
<Dependency>openssl-devel</Dependency>
|
<Dependency>openssl-devel</Dependency>
|
||||||
<Dependency>cmocka-devel</Dependency>
|
<Dependency>cmocka-devel</Dependency>
|
||||||
@@ -23,6 +23,9 @@
|
|||||||
<Dependency>openssh</Dependency>
|
<Dependency>openssh</Dependency>
|
||||||
<!--Dependency>graphviz</Dependency-->
|
<!--Dependency>graphviz</Dependency-->
|
||||||
</BuildDependencies>
|
</BuildDependencies>
|
||||||
|
<Patches>
|
||||||
|
<Patch level="1">1a02364b5107a4125ea3cb76fcdb6beabaebf3be.diff</Patch>
|
||||||
|
</Patches>
|
||||||
</Source>
|
</Source>
|
||||||
|
|
||||||
<Package>
|
<Package>
|
||||||
@@ -61,6 +64,13 @@
|
|||||||
</Package>
|
</Package>
|
||||||
|
|
||||||
<History>
|
<History>
|
||||||
|
<Update release="11">
|
||||||
|
<Date>2024-02-11</Date>
|
||||||
|
<Version>0.10.6</Version>
|
||||||
|
<Comment>Version bump.</Comment>
|
||||||
|
<Name>Mustafa Cinasal</Name>
|
||||||
|
<Email>muscnsl@gmail.com</Email>
|
||||||
|
</Update>
|
||||||
<Update release="10">
|
<Update release="10">
|
||||||
<Date>2023-05-04</Date>
|
<Date>2023-05-04</Date>
|
||||||
<Version>0.10.5</Version>
|
<Version>0.10.5</Version>
|
||||||
|
|||||||
Reference in New Issue
Block a user