diff options
| author | Teodor Zlatanov | 2013-06-17 23:35:46 +0000 |
|---|---|---|
| committer | Katsumi Yamaoka | 2013-06-17 23:35:46 +0000 |
| commit | cc52b6cc95a8257e626344e8619d2abdb86b10dc (patch) | |
| tree | 2f0eaa2f428246d91a4038e328c5eb7f428256f3 | |
| parent | 9822de7295dbb3158b3b196ba50e81dae880501d (diff) | |
| download | emacs-cc52b6cc95a8257e626344e8619d2abdb86b10dc.tar.gz emacs-cc52b6cc95a8257e626344e8619d2abdb86b10dc.zip | |
lisp/gnus/auth-source.el: When a data token is "machine", abort parsing the current line
| -rw-r--r-- | lisp/gnus/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/gnus/auth-source.el | 23 |
2 files changed, 27 insertions, 2 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index c2ce39633b5..53db82cd5b3 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2013-06-17 Teodor Zlatanov <tzz@lifelogs.com> | ||
| 2 | |||
| 3 | * auth-source.el (auth-source-current-line): New function. | ||
| 4 | (auth-source-netrc-parse-entries): When a data token is "machine", | ||
| 5 | assume we're in the wrong place and abort parsing the current line. | ||
| 6 | |||
| 1 | 2013-06-17 Lars Magne Ingebrigtsen <larsi@gnus.org> | 7 | 2013-06-17 Lars Magne Ingebrigtsen <larsi@gnus.org> |
| 2 | 8 | ||
| 3 | * eww.el (eww-tag-select): Don't render totally empty <select> forms. | 9 | * eww.el (eww-tag-select): Don't render totally empty <select> forms. |
diff --git a/lisp/gnus/auth-source.el b/lisp/gnus/auth-source.el index cce18e0c033..a58d023163f 100644 --- a/lisp/gnus/auth-source.el +++ b/lisp/gnus/auth-source.el | |||
| @@ -1055,6 +1055,13 @@ Note that the MAX parameter is used so we can exit the parse early." | |||
| 1055 | (auth-source-netrc-parse-next-interesting) | 1055 | (auth-source-netrc-parse-next-interesting) |
| 1056 | (match-string-no-properties 1))) | 1056 | (match-string-no-properties 1))) |
| 1057 | 1057 | ||
| 1058 | ;; with thanks to org-mode | ||
| 1059 | (defsubst auth-source-current-line (&optional pos) | ||
| 1060 | (save-excursion | ||
| 1061 | (and pos (goto-char pos)) | ||
| 1062 | ;; works also in narrowed buffer, because we start at 1, not point-min | ||
| 1063 | (+ (if (bolp) 1 0) (count-lines 1 (point))))) | ||
| 1064 | |||
| 1058 | (defun auth-source-netrc-parse-entries(check max) | 1065 | (defun auth-source-netrc-parse-entries(check max) |
| 1059 | "Parse up to MAX netrc entries, passed by CHECK, from the current buffer." | 1066 | "Parse up to MAX netrc entries, passed by CHECK, from the current buffer." |
| 1060 | (let ((adder (lambda(check alist all) | 1067 | (let ((adder (lambda(check alist all) |
| @@ -1071,6 +1078,8 @@ Note that the MAX parameter is used so we can exit the parse early." | |||
| 1071 | (when (and alist | 1078 | (when (and alist |
| 1072 | (or default | 1079 | (or default |
| 1073 | (equal item "machine"))) | 1080 | (equal item "machine"))) |
| 1081 | (auth-source-do-trivia | ||
| 1082 | "auth-source-netrc-parse-entries: got entry %S" alist) | ||
| 1074 | (setq all (funcall adder check alist all) | 1083 | (setq all (funcall adder check alist all) |
| 1075 | alist nil)) | 1084 | alist nil)) |
| 1076 | ;; In default entries, we don't have a next token. | 1085 | ;; In default entries, we don't have a next token. |
| @@ -1079,11 +1088,21 @@ Note that the MAX parameter is used so we can exit the parse early." | |||
| 1079 | (push (cons "machine" t) alist) | 1088 | (push (cons "machine" t) alist) |
| 1080 | ;; Not a default entry. Grab the next item. | 1089 | ;; Not a default entry. Grab the next item. |
| 1081 | (when (setq item2 (auth-source-netrc-parse-one)) | 1090 | (when (setq item2 (auth-source-netrc-parse-one)) |
| 1082 | (push (cons item item2) alist)))) | 1091 | ;; Did we get a "machine" value? |
| 1092 | (if (equal item2 "machine") | ||
| 1093 | (progn | ||
| 1094 | (gnus-error 1 | ||
| 1095 | "%s: Unexpected 'machine' token at line %d" | ||
| 1096 | "auth-source-netrc-parse-entries" | ||
| 1097 | (auth-source-current-line)) | ||
| 1098 | (forward-line 1)) | ||
| 1099 | (push (cons item item2) alist))))) | ||
| 1083 | 1100 | ||
| 1084 | ;; Clean up: if there's an entry left over, use it. | 1101 | ;; Clean up: if there's an entry left over, use it. |
| 1085 | (when alist | 1102 | (when alist |
| 1086 | (setq all (funcall adder check alist all))) | 1103 | (setq all (funcall adder check alist all)) |
| 1104 | (auth-source-do-trivia | ||
| 1105 | "auth-source-netrc-parse-entries: got2 entry %S" alist)) | ||
| 1087 | (nreverse all))) | 1106 | (nreverse all))) |
| 1088 | 1107 | ||
| 1089 | (defvar auth-source-passphrase-alist nil) | 1108 | (defvar auth-source-passphrase-alist nil) |