GNU bug report logs - #18842
24.4; gnus not handling passwords with double quotes in .authinfo

Previous Next

Packages: emacs, gnus;

Reported by: David SpÄngberg <david <at> tunna.org>

Date: Sun, 26 Oct 2014 14:14:02 UTC

Severity: normal

Tags: notabug

Found in version 24.4

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: David SpÄngberg <david <at> tunna.org>
To: 18842 <at> debbugs.gnu.org
Subject: bug#18842: 24.4; gnus not handling passwords with double quotes in .authinfo
Date: Sun, 26 Oct 2014 12:54:29 +0100
Hi

After a recent update of emacs gnus fails to connect to a mail server
with login information listed in one of the "~/.authinfo" or
"~/.authinfo.gpg" files. The password in the file is quoted and contains
an escaped double quote. Something like this:

  machine example.org login testuser password "test\"password" port 12345

gnus fails with the following messages displayed in the *messages* buffer:

  auth-source-netrc-parse-entries: Unexpected 'machine' token at line 2
  nnimap (example) open error: 'NO (AUTHENTICATIONFAILED) Authentication failed.'.  Continue? (y or n) n

The problem seems to be a faulty regexp in
`auth-source-netrc-parse-one'. The following code run from a clean emacs
24.4 session shows the problem:

  (require 'auth-source)

  ;; The following should return "test\"password" but instead returns
  ;; "test\\"
  (with-temp-buffer
    (insert "\"test\\\"password\"\n")
    (goto-char (point-min))
    (auth-source-netrc-parse-one))

The faulty regexp in `auth-source-netrc-parse-one' I am referring to is
the following:

  ...
  (looking-at "\"\\([^\"]*\\)\"")
  ...

My current workaround is to redefine `auth-source-netrc-parse-one' in my
init file like this:

  (defun auth-source-netrc-parse-one ()
    "Read one thing from the current buffer."
    (auth-source-netrc-parse-next-interesting)
    (unless (eobp)
      (let ((matched
             (if (= (following-char) ?\")
                 (read (current-buffer))
               (buffer-substring
                (point) (progn (skip-chars-forward "^\t\n ")
                               (point))))))
        (auth-source-netrc-parse-next-interesting)
        matched)))

This definition is based on some code in `netrc-parse' from
"net/netrc.el" (maybe it is possible to use this function in gnus
instead?).

Best regards,

David


In GNU Emacs 24.4.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.14.3)
 of 2014-10-21 on bitzer.hoetzel.info
Windowing system distributor `The X.Org Foundation', version 11.0.11601000
Configured using:
 `configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --with-x-toolkit=gtk3 --with-xft
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong
 --param=ssp-buffer-size=4' CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro'

Important settings:
  value of $LC_MESSAGES: C
  value of $LANG: en_US.utf8
  locale-coding-system: utf-8-unix

Major mode: Emacs-Lisp

Minor modes in effect:
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
C-e C-x C-e C-n C-n C-M-x M-x r e p o r t <tab> <return>
G N U <backspace> <backspace> <backspace> g n u s SPC
n o t SPC h a n d l i n g SPC d o u b l e SPC q u o
t e s SPC i n SPC q u o t e d SPC p a s s w o r d SPC
s t r i n g e s <backspace> <backspace> s C-a C-e <return>
C-n C-n C-n C-n C-n C-n C-l C-n C-l C-n C-l C-n C-l
C-p C-p C-p C-p C-p C-p C-p C-p C-l C-p C-l C-p C-l
C-p C-l C-n C-n C-n C-n C-n C-n C-n C-n C-l C-x k y e
s <return> C-g C-g C-x k <return> y e s <return> M-x
M-p <return>

Recent messages:
Checking 70 files in /usr/share/emacs/24.4/lisp/erc...
Checking 48 files in /usr/share/emacs/24.4/lisp/emulation...
Checking 151 files in /usr/share/emacs/24.4/lisp/emacs-lisp...
Checking 24 files in /usr/share/emacs/24.4/lisp/cedet...
Checking 57 files in /usr/share/emacs/24.4/lisp/calendar...
Checking 87 files in /usr/share/emacs/24.4/lisp/calc...
Checking 95 files in /usr/share/emacs/24.4/lisp/obsolete...
Checking for load-path shadows...done
byte-code: Beginning of buffer [3 times]
Auto-saving...done
Quit [2 times]

Load-path shadows:
None found.

Features:
(help-mode pp shadow sort mail-extr emacsbug message format-spec rfc822
mml easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mail-utils auth-source eieio byte-opt bytecomp byte-compile cconv
eieio-core gnus-util mm-util help-fns mail-prsvr password-cache
time-date tooltip electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment lisp-mode prog-mode register page menu-bar
rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax
facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak
czech european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer nadvice loaddefs button
faces cus-face macroexp files text-properties overlay sha1 md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process dbusbind gfilenotify dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty emacs)

Memory information:
((conses 16 82211 11023)
 (symbols 48 18873 0)
 (miscs 40 46 233)
 (strings 32 12611 4005)
 (string-bytes 1 356631)
 (vectors 16 11040)
 (vector-slots 8 403091 11662)
 (floats 8 69 402)
 (intervals 56 283 24)
 (buffers 960 14)
 (heap 1024 51340 1029))




This bug report was last modified 10 years and 207 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.