[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
Mon Apr 29 16:33:04 AEST 2019


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

--- Comment #10 from guo chuang <guo.chuang at zte.com.cn> ---
 In fact, I also tried to fix it before, the patch is as follows:


 int in, out, ch, err, tmp, port = -1;
-       char *host = NULL, *user, *cp, *file2 = NULL;
+       char *host = NULL, *user, *userhost, *cp, *file2 = NULL;
        int debug_level = 0, sshver = 2;
        char *file1 = NULL, *sftp_server = NULL;
        char *ssh_program = _PATH_SSH_PROGRAM, *sftp_direct = NULL;
@@ -2496,8 +2496,24 @@
                default:
                        if (parse_user_host_path(*argv, &user, &host,
                            &file1) == -1) {
+
                                /* Treat as a plain hostname. */
-                               host = xstrdup(*argv);
+                               userhost = xstrdup(*argv);
+                               if ((host = strrchr(userhost, '@')) ==
NULL)
+                                    host = userhost;
+                                 else {
+                                    *host++ = '\0';
+                                    if (!userhost[0]) {
+                                        fprintf(stderr, "Missing
username\n");
+                                        usage();
+
+                                       }
+
+                                     //because *host++='\0',so then
userhost str include username.
+                                    user=userhost;
+
+                                }


The above patch self-test is ok  。
+
                                host = cleanhostname(host);
                        }
                        break;

-- 
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