From libssh2-devel-bounces@cool.haxx.se Thu Dec 6 07:37:00 2018 Return-Path: Received: from www.haxx.se (mail [127.0.0.1]) by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTP id wB66aVvv030786; Thu, 6 Dec 2018 07:36:52 +0100 Received: from mail-it1-x12b.google.com (mail-it1-x12b.google.com [IPv6:2607:f8b0:4864:20:0:0:0:12b]) by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTPS id wB66aRf7030758 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 6 Dec 2018 07:36:28 +0100 Received: by mail-it1-x12b.google.com with SMTP id x19so25566780itl.1 for ; Wed, 05 Dec 2018 22:36:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=llamas-org.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=YFoKjPInHa5bvIMfgI7y1c+LgAY4nzeOjy+lkWrrDXw=; b=Ytby2Vp6QRtb6/c5ESTsBB9JMV1KUgZKLTmA5ID8qHxOKnHljauHk1AgBzwYb7UMv2 xRAA+9XL34bvDdOG4BAOsBV5qinUOcZ0hKNzW439cI3vyXb2uYX75rgsYt8O/DROyYgu 2+fq901D84K76VrXdT2aIIYhm3QR0U0q1htGM6/ZcRPmiqpmX1G5gpQ/bh112Vb0YHdl pk0qyle8IjS7HuQV/Z/s0lSyUGQIqLmQY9++sv3ma4gpNkCc0/viPGazdcKBQPCcIbxm Ya98ZLF7fiJN2vg8L9s4uQHhrrVErDWUG5irqinynj/Khrlh3xndvDNcK9F70oDM4eSH iEnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=YFoKjPInHa5bvIMfgI7y1c+LgAY4nzeOjy+lkWrrDXw=; b=XcDgzRGBru7EmPdsMjwUlNeMmH9s9tXWEXDFhnWrUZxW4OF/urqWOMOQA8m1GuRkxc NcLXwQoQqawnZiBtwcb0Kgjkra5nU8Fy5qSuPigQGVNs+wGbokh0yCVY6RIJWFGBhF0Z 2/rq/QZ0rB8fmwGbwCB3wwezCF32CHWcg8c0b+o98rAs4ztAElr819/h4lIFkMcRUBjd 7H4O+neXY4zZzycsoCdUJCQdfTqiGncpNScwVanl6yyT0G4QXHsdph1eNceyeXV8W9Ml CZgIxokYfPsAYTe68BwQKk0lvV5d1HyVByIBzsvLkVIMJeEFk/ILcdOhh6cT6GT5kVrO 0f/g== X-Gm-Message-State: AA+aEWbBSfOQPDZkzRV69cdD7R2yQ/hlynLY3sXZ/FFv0HD5x46yxDae orq2xsZZGadKqxD1nZU0JPrpfsE+4VCCCprP0Ywxdkpx X-Google-Smtp-Source: AFSGD/VjI+Z6VE/U3qxiiYz3uGoDbOoBG36TZ8o+oSNjO+XCLK5P4BxXmVhpD//803srvy0eC4SmNIX6A7AYS4Hr6sM= X-Received: by 2002:a05:660c:11c6:: with SMTP id p6mr17596452itm.75.1544078182636; Wed, 05 Dec 2018 22:36:22 -0800 (PST) MIME-Version: 1.0 From: George Nachman Date: Wed, 5 Dec 2018 22:36:10 -0800 Message-ID: Subject: Error reporting To: libssh2-devel@cool.haxx.se X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.22 Precedence: list List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: libssh2 development Content-Type: multipart/mixed; boundary="===============1146936624==" Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" --===============1146936624== Content-Type: multipart/alternative; boundary="00000000000094e24c057c54b7a6" --00000000000094e24c057c54b7a6 Content-Type: text/plain; charset="UTF-8" I've noticed that libssh2 does not expose as much detail about errors as I would like. For example, when scp'ing a file that does not exist, it reports an error of "Failed to recv file" through libssh2_session_last_error(). The real error was reported by the server, and was "scp: ~/test.txt: No such file or directory". My users are confused by the former and I would like to show them the latter. My questions are: 1. Is there a good reason not to expose the text the server sends? At least in the case of the "Failed to recv file" error it wouldn't be difficult to add it to the error string. But perhaps that buffer can't be malloced or clients expect that particular string back. Or maybe there's some security angle I'm not seeing. 2. Would you accept a patch to fix this issue? I think I'd like to see something along the lines of this: Failed to recv file. Server reported: "scp: ~/test.txt: No such file or directory". Thanks, George --00000000000094e24c057c54b7a6 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I'v= e noticed that libssh2 does not expose as much detail about errors as I wou= ld like. For example, when scp'ing a file that does not exist, it repor= ts an error of "Failed to recv file" through libssh2_session_last= _error(). The real error was reported by the server, and was "scp: ~/t= est.txt: No such file or directory". My users are confused by the form= er and I would like to show them the latter.

My questions are:

1. Is there a good reason= not to expose the text the server sends? At least in the case of the "= ;Failed to recv file" error it wouldn't be difficult to add it to = the error string. But perhaps that buffer can't be malloced or clients = expect that particular string back. Or maybe there's some security angl= e I'm not seeing.
2. Would you accept a patch to fix this iss= ue? I think I'd like to see something along the lines of this:
=C2=A0 Failed to recv file. Server reported: "scp: ~/test.txt: No su= ch file or directory".

Thanks,
= George

--00000000000094e24c057c54b7a6-- --===============1146936624== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KbGlic3NoMi1k ZXZlbCBodHRwczovL2Nvb2wuaGF4eC5zZS9jZ2ktYmluL21haWxtYW4vbGlzdGluZm8vbGlic3No Mi1kZXZlbAo= --===============1146936624==-- From libssh2-devel-bounces@cool.haxx.se Thu Dec 6 18:54:05 2018 Return-Path: Received: from www.haxx.se (mail [127.0.0.1]) by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTP id wB6HrUj9028412; Thu, 6 Dec 2018 18:53:56 +0100 Received: from mail.panic.com (mail.panic.com [38.103.165.36]) by giant.haxx.se (8.15.2/8.15.2/Debian-4) with ESMTPS id wB6HrRpt028313 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 6 Dec 2018 18:53:28 +0100 Received: from [10.0.0.227] (unknown [10.0.0.227]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.panic.com (Postfix) with ESMTPSA id 119384ED for ; Thu, 6 Dec 2018 09:53:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=panic.com; s=dkim; t=1544118802; bh=5YkctHwOwxo3ni5OHuXcF86RqkwU22WkmAdn34ymWPQ=; h=From:Subject:Date:References:To:In-Reply-To; b=kUk3jV2gXus5EDm2nvo9q8ZxKLHvFY4XefcjZQNKT8XXf40BL0SHlGfR49xflRRGG szvsMhivy4o5E/ZJ062rgr16BcZuOrCKhDbffvxv5q4YVpk/+tOBGiDIAF+MG1Gds5 L4ZMbwiTl9vOTBGCoGyKLDpKwFF123s0ab9wy3uU= From: Will Cosgrove Mime-Version: 1.0 (Mac OS X Mail 12.1 \(3445.101.1\)) Subject: Re: Error reporting Date: Thu, 6 Dec 2018 09:53:21 -0800 References: To: libssh2 development In-Reply-To: Message-Id: <2068C0A6-7403-4AF6-8EEA-A9A709544EBC@panic.com> X-Mailer: Apple Mail (2.3445.101.1) X-MIME-Autoconverted: from quoted-printable to 8bit by giant.haxx.se id wB6HrRpt028313 X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.22 Precedence: list List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: libssh2 development Content-Type: text/plain; charset="utf-8" Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id wB6HrUj9028412 Reporting the exact error sounds good to me. To my knowledge there is no reason not to report it. I would prefer if there was no additional English string formatting on the error message so it would be easier to localize for applications who want to do that. In your example simply reporting the string from the server "scp: ~/test.txt: No such file or directoryā€¯ with the correct error code seems ideal. Cheers, Will > On Dec 5, 2018, at 10:36 PM, George Nachman wrote: > > I've noticed that libssh2 does not expose as much detail about errors as I would like. For example, when scp'ing a file that does not exist, it reports an error of "Failed to recv file" through libssh2_session_last_error(). The real error was reported by the server, and was "scp: ~/test.txt: No such file or directory". My users are confused by the former and I would like to show them the latter. > > My questions are: > > 1. Is there a good reason not to expose the text the server sends? At least in the case of the "Failed to recv file" error it wouldn't be difficult to add it to the error string. But perhaps that buffer can't be malloced or clients expect that particular string back. Or maybe there's some security angle I'm not seeing. > 2. Would you accept a patch to fix this issue? I think I'd like to see something along the lines of this: > Failed to recv file. Server reported: "scp: ~/test.txt: No such file or directory". > > Thanks, > George > > _______________________________________________ > libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel _______________________________________________ libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel