Joseph Gay | 1 Feb 09:45
Picon

[PATCH 2/2] response handlers needed for SASL PLAIN authentication


---
 erc-sasl.el |   67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 67 insertions(+), 0 deletions(-)
 create mode 100644 erc-sasl.el

diff --git a/erc-sasl.el b/erc-sasl.el
new file mode 100644
index 0000000..002be15
--- /dev/null
+++ b/erc-sasl.el
@@ -0,0 +1,67 @@
+;; erc-sasl.el -- handle SASL PLAIN authentication
+
+;; Copyright (C) 2001, 2002, 2003, 2004, 2006,
+;;   2007, 2008, 2009 Free Software Foundation, Inc.
+
+;; Author: Joseph Gay <joseph.gay <at> psy.ai>
+;; Keywords: comm
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
(Continue reading)

Joseph Gay | 1 Feb 09:56
Picon

[PATCH 1/2] modifying erc-login to conditionally send appropriate CAP request for SASL

Hello. What precedes is a set of response handlers to implement SASL
PLAIN authentication. If there's a way around the small modification to
erc-login, it's likely preferable.

If this is useful / acceptable, I can request papers to fill out for
contributing or contribute by whatever method is most appropriate.
---
 erc.el |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/erc.el b/erc.el
index 6e37f36..83caa43 100644
--- a/erc.el
+++ b/erc.el
@@ -5634,6 +5634,8 @@ user input."
   (if erc-session-password
       (erc-server-send (format "PASS %s" erc-session-password))
     (message "Logging in without password"))
+  (when (and (boundp 'erc-sasl-use-sasl) erc-sasl-use-sasl)
+    (erc-server-send "CAP REQ :sasl"))
   (erc-server-send (format "NICK %s" (erc-current-nick)))
   (erc-server-send
    (format "USER %s %s %s :%s"
--

-- 
1.7.2.5
Michael Olson | 1 Feb 18:23
Picon
Picon

Re: [PATCH 2/2] response handlers needed for SASL PLAIN authentication

Seems OK.  A few things:


 - Adjust copyright notice to:

Copyright (C) 2012 Free Software Foundation, Inc. 

 - I think we have some standard boilerplate line which goes at the end of all files, might want to look into that.

 - Send the patch to the emacs-devel list as well, and Cc me, since that version is considered canonical at the moment.  It's more than 12 lines, so you'll need to tell them that a copyright assignment is necessary.  Luckily, this can now be scanned instead of snail-mailed to the FSF; they should give you details.

On Wed, Feb 1, 2012 at 12:45 AM, Joseph Gay <gilleylen <at> gmail.com> wrote:

---
 erc-sasl.el |   67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 67 insertions(+), 0 deletions(-)
 create mode 100644 erc-sasl.el

diff --git a/erc-sasl.el b/erc-sasl.el
new file mode 100644
index 0000000..002be15
--- /dev/null
+++ b/erc-sasl.el
<at> <at> -0,0 +1,67 <at> <at>
+;; erc-sasl.el -- handle SASL PLAIN authentication
+
+;; Copyright (C) 2001, 2002, 2003, 2004, 2006,
+;;   2007, 2008, 2009 Free Software Foundation, Inc.
+
+;; Author: Joseph Gay <joseph.gay <at> psy.ai>
+;; Keywords: comm
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; This file implements SASL PLAIN authentication
+;; To activate:
+;;
+;; (require 'erc-sasl)
+;;
+;; To disable:
+;; (setq erc-sasl-use-sasl nil)
+;;
+;; NOTE: requires passing a password initially to (erc) and variants
+
+;;; Code:
+
+(defvar erc-sasl-use-sasl t
+  "Set to nil to disable SASL auth")
+
+(define-erc-response-handler (CAP)
+  "Client capability framework is used to request SASL auth, need
+  to wait for ACK to begin" nil
+  (let ((msg (erc-response.contents parsed)))
+    (when (string-match " *sasl" msg)
+      (erc-server-send "AUTHENTICATE PLAIN")
+      ;; now wait for AUTHENTICATE +
+      )))
+
+(define-erc-response-handler (AUTHENTICATE)
+  "Handling empty server response indicating ready to receive authentication." nil
+  (if erc-session-password
+      (let ((msg (erc-response.contents parsed)))
+        (when (string= "+" msg)
+          ;; plain auth
+          (erc-server-send (format "AUTHENTICATE %s"
+                                   (base64-encode-string
+                                    (concat "\0" (erc-current-nick) "\0" erc-session-password) t)))))
+    (progn
+      (erc-display-messaged parsed 'error (if erc-server-connected 'active proc)
+                            "You must set a password in order to use SASL authentication.")
+      ;; aborting SASL auth
+      (erc-server-send (erc-server-send "AUTHENTICATE *")))))
+
+(define-erc-response-handler (903)
+  "Handling a successful SASL authentication." nil
+  (erc-server-send "CAP END"))
--
1.7.2.5



_______________________________________________
Erc-discuss mailing list
Erc-discuss <at> gnu.org
https://lists.gnu.org/mailman/listinfo/erc-discuss



--
Michael Olson  |  http://mwolson.org/
_______________________________________________
Erc-discuss mailing list
Erc-discuss <at> gnu.org
https://lists.gnu.org/mailman/listinfo/erc-discuss
Joseph Gay | 2 Feb 20:13
Picon

Re: [PATCH 2/2] response handlers needed for SASL PLAIN authentication

I've made another revision this morning. Users may not want SASL enabled
for every server, so I changed the conditional in erc-login to call a
new predicate erc-sasl-use-sasl-p, which looks for a match to
erc-session-server in a new var erc-sasl-server-regexp-list. The list is
empty by default, and the commentary now indicates that it should be
populated with desired regexp(s). I suppose I shouldn't bother
re-submitting patch files until I can assign copyright.
Picon
Picon

Re: [PATCH 2/2] response handlers needed for SASL PLAIN authentication

On Thu, Feb 02 2012 20:13 (@1328210004), Joseph Gay wrote:

---8<---[snipped 5 lines]---8<---
> populated with desired regexp(s). I suppose I shouldn't bother
> re-submitting patch files until I can assign copyright.

Which can take some time...plus with the current feature-freeze it'll
take some until your changes actually get applied (no clue while there's
no -dev or -experimental branch for the time until the release. patches
must be piling up…).

Do you keep your stuff somewhere publicly accessible? I've been waiting
to access freenode from my TOR server for some time, I'd like to pull :)
And I don't think there's any harm informing the list that a new version
is available.

--

-- 
Philipp Haselwarter

_______________________________________________
Erc-discuss mailing list
Erc-discuss <at> gnu.org
https://lists.gnu.org/mailman/listinfo/erc-discuss
Joseph Gay | 3 Feb 09:25
Picon

Re: [PATCH 2/2] response handlers needed for SASL PLAIN authentication

Philipp Haselwarter <philipp.haselwarter <at> gmx.de> writes:

> Which can take some time...plus with the current feature-freeze it'll
> take some until your changes actually get applied (no clue while there's
> no -dev or -experimental branch for the time until the release. patches
> must be piling up…).
This is a good point.

> Do you keep your stuff somewhere publicly accessible? I've been waiting
> to access freenode from my TOR server for some time, I'd like to pull :)
> And I don't think there's any harm informing the list that a new version
> is available.
I've pushed my branch: https://github.com/joseph-gay/erc-sasl
If I should have forked emacsmirror/erc instead, let me know.

_______________________________________________
Erc-discuss mailing list
Erc-discuss <at> gnu.org
https://lists.gnu.org/mailman/listinfo/erc-discuss
Jim Meyering | 3 Feb 10:00

Re: [PATCH 2/2] response handlers needed for SASL PLAIN authentication

Philipp Haselwarter wrote:
> On Thu, Feb 02 2012 20:13 (@1328210004), Joseph Gay wrote:
>
> ---8<---[snipped 5 lines]---8<---
>> populated with desired regexp(s). I suppose I shouldn't bother
>> re-submitting patch files until I can assign copyright.
>
> Which can take some time...plus with the current feature-freeze it'll

If you're in the US, it may be very quick, with the FSF's new
all-electronic submission process.
Jim Meyering | 3 Feb 15:10

getting new-window/query indication in "ERC messages to you" window?

Hello,

Thank you for tending ERC.
I am a happy user, with one niggling request:

Is there a way to make it so when someone does the equivalent
of "/q <my_nick>" (which creates a new window for me), that I also
get some sort of notification in my "ERC messages to you" window?

I've had a few queries like that that I've missed, because while
I take care to keep the "ERC messages to you" window visible,
there may be many other sub-windows that are hidden.

Jim
Teemu Likonen | 10 Feb 15:20
Picon
Picon
Favicon

Make server response timestamp format customizable (patch)

ERC displays various server response messages with timestamps. The
timestamp formats that are hard-coded to ERC code have some unnecessary
variation. Also, it's sometimes even unclear what is the day component
and what is the month component (due to YY/MM or MM/YY differences).

I suggest making those server response timestamp formats customizable
and having the default value in international "%Y-%m-%d %T" format (as
parsed by `format-time-string' function).

This message includes a patch that fully implements this (I believe).

I have also filed this to Emacs bug tracking system:
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10779

_______________________________________________
Erc-discuss mailing list
Erc-discuss <at> gnu.org
https://lists.gnu.org/mailman/listinfo/erc-discuss
Michael Olson | 10 Feb 16:45
Picon
Picon

Re: Make server response timestamp format customizable (patch)

The patch looks good to me.

On Fri, Feb 10, 2012 at 6:20 AM, Teemu Likonen <tlikonen <at> iki.fi> wrote:
ERC displays various server response messages with timestamps. The
timestamp formats that are hard-coded to ERC code have some unnecessary
variation. Also, it's sometimes even unclear what is the day component
and what is the month component (due to YY/MM or MM/YY differences).

I suggest making those server response timestamp formats customizable
and having the default value in international "%Y-%m-%d %T" format (as
parsed by `format-time-string' function).

This message includes a patch that fully implements this (I believe).

I have also filed this to Emacs bug tracking system:
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10779


_______________________________________________
Erc-discuss mailing list
Erc-discuss <at> gnu.org
https://lists.gnu.org/mailman/listinfo/erc-discuss




--
Michael Olson  |  http://mwolson.org/
_______________________________________________
Erc-discuss mailing list
Erc-discuss <at> gnu.org
https://lists.gnu.org/mailman/listinfo/erc-discuss

Gmane