mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-06 18:29:50 +09:00
misc: Allow %% to escape a single % in paths.
For example "%d/config%%1" is expanded to "~/.ssh/config%1".
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 3737e5f0e7)
This commit is contained in:
committed by
Jakub Jelen
parent
9ffaa12012
commit
93113ccfb9
@@ -1127,6 +1127,7 @@ char *ssh_path_expand_escape(ssh_session session, const char *s) {
|
||||
|
||||
for (i = 0; *p != '\0'; p++) {
|
||||
if (*p != '%') {
|
||||
escape:
|
||||
buf[i] = *p;
|
||||
i++;
|
||||
if (i >= MAX_BUF_SIZE) {
|
||||
@@ -1143,6 +1144,8 @@ char *ssh_path_expand_escape(ssh_session session, const char *s) {
|
||||
}
|
||||
|
||||
switch (*p) {
|
||||
case '%':
|
||||
goto escape;
|
||||
case 'd':
|
||||
x = strdup(session->opts.sshdir);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user