[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 11:52:32 AEST 2019


https://bugzilla.mindrot.org/show_bug.cgi?id=2999

--- Comment #15 from guo chuang <guo.chuang at zte.com.cn> ---
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) {

-- 
You are receiving this mail because:
You are watching someone on the CC list of the bug.
You are watching the assignee of the bug.


More information about the openssh-bugs mailing list