aboutsummaryrefslogtreecommitdiff
path: root/libssh
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cynapses.org>2010-08-10 11:10:26 +0200
committerAndreas Schneider <asn@cynapses.org>2010-08-10 11:10:26 +0200
commit77475bdd552bc7f85c4656ee5a707da27c5c0c04 (patch)
tree3bb326c60fc719b0756f06a366513a2d9511412e /libssh
parent0c70e80d47185d5d22477332cf34a5e63885a7bb (diff)
downloadlibssh-77475bdd552bc7f85c4656ee5a707da27c5c0c04.tar.gz
libssh-77475bdd552bc7f85c4656ee5a707da27c5c0c04.tar.xz
libssh-77475bdd552bc7f85c4656ee5a707da27c5c0c04.zip
misc: Added %p for port to ssh_path_expand_escape().
Diffstat (limited to 'libssh')
-rw-r--r--libssh/misc.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libssh/misc.c b/libssh/misc.c
index 42900bd0..fbeecf06 100644
--- a/libssh/misc.c
+++ b/libssh/misc.c
@@ -644,6 +644,14 @@ char *ssh_path_expand_escape(ssh_session session, const char *s) {
case 'r':
x = strdup(session->username);
break;
+ case 'p':
+ if (session->port < 65536) {
+ char tmp[6];
+
+ snprintf(tmp, sizeof(tmp), "%u", session->port);
+ x = strdup(tmp);
+ }
+ break;
default:
ssh_set_error(session, SSH_FATAL,
"Wrong escape sequence detected");