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

--- Comment #10 from guo chuang <[email protected]> ---
 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.
_______________________________________________
openssh-bugs mailing list
[email protected]
https://lists.mindrot.org/mailman/listinfo/openssh-bugs

Reply via email to