[Bug 2999] Sftp login failed by sftp user@[ip] in openssh 7.9
bugzilla-daemon at bugzilla.mindrot.org
bugzilla-daemon at bugzilla.mindrot.org
Tue Apr 30 12:32:38 AEST 2019
https://bugzilla.mindrot.org/show_bug.cgi?id=2999
--- Comment #16 from guo chuang <guo.chuang at zte.com.cn> ---
(In reply to Darren Tucker from comment #14)
> (In reply to guo chuang from comment #13)
> [...]
> > 1. I tried this patch and the problem still exists.
>
> Did you run the newly patched binary?
>
> > Have you ever tested before?
>
> Yes, built against -current. Just retested it with 7.9p1 and it
> also seems to work for me:
>
> $ ./sftp root@[127.0.0.1]
> ssh: Could not resolve hostname [127.0.0.1]: Name or service not
> known
> Connection closed.
> Connection closed
> $ patch -p0 <~/tmp/sftp-host-squarebracket.patch
> patching file sftp.c
> $ make
> [...]
> $ ./sftp root@[127.0.0.1]
> Connected to 127.0.0.1.
>
> Do you have a different test case?
1. First of all, please help me to confirm that the patch I am joining
is correct. The patch is as follows:
diff -aruN openssh-7.9p1-org/sftp.c openssh-7.9p1/sftp.c
--- openssh-7.9p1-org/sftp.c 2019-04-29 14:35:19.097608142 +0800
+++ openssh-7.9p1/sftp.c 2019-04-29 14:57:42.013557705 +0800
@@ -2495,11 +2495,16 @@
break;
default:
if (parse_user_host_path(*argv, &user, &host,
- &file1) == -1) {
- /* Treat as a plain hostname. */
- host = xstrdup(*argv);
- host = cleanhostname(host);
- }
+ &file1) == 0)
+ break;
+
+ if (parse_user_host_path(*argv, &user,
&host,NULL)
+ == 0)
+ break;
+
+ /* Treat as a plain hostname. */
+ host = xstrdup(*argv);
+ host = cleanhostname(host);
break;
}
file2 = *(argv + 1);
2.If the above patch does not have a join problem, the binary I used
should be correct. Because I used gdb to debug the sftp code, the patch
code has been reflected in the new binary. The specific debugging
information is as follows:
(gdb) list 2497
2492 case 0:
2493 if (tmp != -1)
2494 port = tmp;
2495 break;
2496 default:
2497 if (parse_user_host_path(*argv, &user,
&host,
2498 &file1) == 0)
2499 break;
2500
2501 if (parse_user_host_path(*argv, &user,
&host,NULL)
(gdb) list 2500
2495 break;
2496 default:
2497 if (parse_user_host_path(*argv, &user,
&host,
2498 &file1) == 0)
2499 break;
2500
2501 if (parse_user_host_path(*argv, &user,
&host,NULL)
2502 == 0)
2503 break;
2504
(gdb) n
2506 host = xstrdup(*argv);
(gdb) n
2507 host = cleanhostname(host);
(gdb) n
2512 if (!*host) {
(gdb) n
2510 file2 = *(argv + 1);
(gdb) n
2512 if (!*host) {
3. my test case is as follows:
sftp root@[127.0.0.1]
--
You are receiving this mail because:
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.
More information about the openssh-bugs
mailing list