From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: smtpmail and ~/.authinfo Date: Tue, 27 Sep 2011 08:55:45 -0400 Message-ID: References: <83ippsqsz8.fsf@gnu.org> <83hb5ay1rs.fsf@gnu.org> <87litc7qen.fsf@lifelogs.com> <87pqio69lr.fsf@lifelogs.com> <87vcsf1537.fsf@lifelogs.com> <8739fj13vb.fsf@lifelogs.com> <83ty7yg09z.fsf@gnu.org> <871uv2uv6j.fsf@lifelogs.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1317128179 29610 80.91.229.12 (27 Sep 2011 12:56:19 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 27 Sep 2011 12:56:19 +0000 (UTC) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Sep 27 14:56:15 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1R8XCo-0001ez-FP for ged-emacs-devel@m.gmane.org; Tue, 27 Sep 2011 14:56:14 +0200 Original-Received: from localhost ([::1]:57019 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R8XCm-0001nf-FA for ged-emacs-devel@m.gmane.org; Tue, 27 Sep 2011 08:56:12 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:36795) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R8XCe-0001nK-C5 for emacs-devel@gnu.org; Tue, 27 Sep 2011 08:56:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R8XCa-0008FQ-C2 for emacs-devel@gnu.org; Tue, 27 Sep 2011 08:56:04 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.183]:5252 helo=ironport2-out.pppoe.ca) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R8XCT-0008Di-1V; Tue, 27 Sep 2011 08:55:53 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAJjGgU5FpZLc/2dsb2JhbABBp3h5gVMBAQVWIxALMAQSFBgNJMBchAGDCgSgX4RD X-IronPort-AV: E=Sophos;i="4.68,449,1312171200"; d="scan'208";a="138738033" Original-Received: from 69-165-146-220.dsl.teksavvy.com (HELO ceviche.home) ([69.165.146.220]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 27 Sep 2011 08:55:51 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id 788B0660B6; Tue, 27 Sep 2011 08:55:45 -0400 (EDT) In-Reply-To: (Eli Zaretskii's message of "Tue, 27 Sep 2011 07:31:23 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.183 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:144404 Archived-At: Here's my take on it: .authinfo contains various things and is used in different ways, and there isn't a single answer that covers all cases: - each kind of field (hostname, username, password) may require a different encoding/decoding. - when reading a password from the file, it should be read using raw-text (i.e. as a "unibyte string"). In other words, the password should not be decoded into chars but left as a sequence of bytes that will be sent as-is to whoever needs it. - when a password is typed by the user it'll be a sequence of chars, so we'll have to convert it into a sequence of bytes. The best coding system to use for that purpose is probably going to be locale-coding-system. That sequence of bytes is then send to whoever needs it and saved as-is (using raw-text) into the .authinfo file. - i.e. authinfo should be read as a unibyte file. - i.e. when reading other fields than passwords, we'll have to explicitly decode them using the coding system we want to use for those fields. - similarly, we'll have to encode those other fields manually when writing them into .authinfo. Of course, another option is to just read&write authinfo without thinking about it, so Emacs will usually pick locale-coding-system for it and it'll work just fine in 99.9% of the cases. Stefan