unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#8385: 24.0.50; rcirc auto-authentication slightly broken
@ 2011-03-31  0:21 Deniz Dogan
  2011-03-31  7:03 ` Deniz Dogan
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Deniz Dogan @ 2011-03-31  0:21 UTC (permalink / raw)
  To: 8385

Currently when the user connects to an IRC server, rcirc checks if
`rcirc-auto-authenticate-flag' is non-nil and
`rcirc-authenticate-before-join' is non-nil.  If they are, a hook is
added to join the user's channels after successfully authenticating.

However, this is done regardless of whether the user has set up any
authinfo for the server being connected to, i.e., regardless of whether
any of the entries in `rcirc-authinfo' matches the server address.

`rcirc-handler-001' needs to be modified so that it first checks whether
the server matches any `rcirc-authinfo' entry before it decides to wait
with auto-joining channels until after authentication.

-- 
Deniz Dogan





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#8385: 24.0.50; rcirc auto-authentication slightly broken
  2011-03-31  0:21 bug#8385: 24.0.50; rcirc auto-authentication slightly broken Deniz Dogan
@ 2011-03-31  7:03 ` Deniz Dogan
  2011-03-31 10:13 ` Tassilo Horn
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Deniz Dogan @ 2011-03-31  7:03 UTC (permalink / raw)
  To: 8385

severity serious
thanks





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#8385: 24.0.50; rcirc auto-authentication slightly broken
  2011-03-31  0:21 bug#8385: 24.0.50; rcirc auto-authentication slightly broken Deniz Dogan
  2011-03-31  7:03 ` Deniz Dogan
@ 2011-03-31 10:13 ` Tassilo Horn
  2011-03-31 12:52 ` Deniz Dogan
       [not found] ` <mailman.2.1301567843.29790.bug-gnu-emacs@gnu.org>
  3 siblings, 0 replies; 9+ messages in thread
From: Tassilo Horn @ 2011-03-31 10:13 UTC (permalink / raw)
  To: Deniz Dogan; +Cc: 8385

[-- Attachment #1: Type: text/plain, Size: 788 bytes --]

Deniz Dogan <deniz.a.m.dogan@gmail.com> writes:

> Currently when the user connects to an IRC server, rcirc checks if
> `rcirc-auto-authenticate-flag' is non-nil and
> `rcirc-authenticate-before-join' is non-nil.  If they are, a hook is
> added to join the user's channels after successfully authenticating.
>
> However, this is done regardless of whether the user has set up any
> authinfo for the server being connected to, i.e., regardless of
> whether any of the entries in `rcirc-authinfo' matches the server
> address.
>
> `rcirc-handler-001' needs to be modified so that it first checks whether
> the server matches any `rcirc-authinfo' entry before it decides to wait
> with auto-joining channels until after authentication.

Could you please check if this patch does the trick?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: rcirc-auth.patch --]
[-- Type: text/x-patch, Size: 785 bytes --]

=== modified file 'lisp/net/rcirc.el'
--- lisp/net/rcirc.el	2011-03-22 11:51:48 +0000
+++ lisp/net/rcirc.el	2011-03-31 07:40:16 +0000
@@ -2454,7 +2454,14 @@
     (setq rcirc-nick (car args))
     (rcirc-update-prompt)
     (if rcirc-auto-authenticate-flag
-        (if rcirc-authenticate-before-join
+        (if (and rcirc-authenticate-before-join
+		 ;; We have to ensure that there's an authentication
+		 ;; entry for that server.  Else,
+		 ;; rcirc-authenticated-hook won't be triggered, and
+		 ;; autojoin won't happen at all.
+		 (dolist (s rcirc-authinfo ret)
+		   (when (string-match (car s) rcirc-server-name)
+		     (setq ret t))))
             (progn
 	      (add-hook 'rcirc-authenticated-hook 'rcirc-join-channels-post-auth t t)
               (rcirc-authenticate))


[-- Attachment #3: Type: text/plain, Size: 14 bytes --]


Bye,
Tassilo

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#8385: 24.0.50; rcirc auto-authentication slightly broken
  2011-03-31  0:21 bug#8385: 24.0.50; rcirc auto-authentication slightly broken Deniz Dogan
  2011-03-31  7:03 ` Deniz Dogan
  2011-03-31 10:13 ` Tassilo Horn
@ 2011-03-31 12:52 ` Deniz Dogan
       [not found] ` <mailman.2.1301567843.29790.bug-gnu-emacs@gnu.org>
  3 siblings, 0 replies; 9+ messages in thread
From: Deniz Dogan @ 2011-03-31 12:52 UTC (permalink / raw)
  To: 8385-done

Tassilo pu;hed a fix. Thanks.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: bug#8385: 24.0.50; rcirc auto-authentication slightly broken
       [not found] ` <mailman.2.1301567843.29790.bug-gnu-emacs@gnu.org>
@ 2011-03-31 16:06   ` Ted Zlatanov
  2011-03-31 16:55     ` Deniz Dogan
  0 siblings, 1 reply; 9+ messages in thread
From: Ted Zlatanov @ 2011-03-31 16:06 UTC (permalink / raw)
  To: bug-gnu-emacs

On Thu, 31 Mar 2011 12:13:17 +0200 Tassilo Horn <tassilo@member.fsf.org> wrote: 

TH> === modified file 'lisp/net/rcirc.el'
...
TH> +		 (dolist (s rcirc-authinfo ret)
TH> +		   (when (string-match (car s) rcirc-server-name)

Would it be useful to wire rcirc.el to use auth-source.el?

Ted


^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#8385: 24.0.50; rcirc auto-authentication slightly broken
  2011-03-31 16:06   ` Ted Zlatanov
@ 2011-03-31 16:55     ` Deniz Dogan
  2011-03-31 16:59       ` Deniz Dogan
       [not found]       ` <mailman.1.1301591269.19576.bug-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 9+ messages in thread
From: Deniz Dogan @ 2011-03-31 16:55 UTC (permalink / raw)
  To: Ted Zlatanov; +Cc: bug-gnu-emacs

2011/3/31 Ted Zlatanov <tzz@lifelogs.com>:
> On Thu, 31 Mar 2011 12:13:17 +0200 Tassilo Horn <tassilo@member.fsf.org> wrote:
>
> TH> === modified file 'lisp/net/rcirc.el'
> ...
> TH> +            (dolist (s rcirc-authinfo ret)
> TH> +              (when (string-match (car s) rcirc-server-name)
>
> Would it be useful to wire rcirc.el to use auth-source.el?
>
> Ted
>

As I understand it, we are waiting for the FSF to review Neale
Pickett's copyright assignment papers. He has written a few patches
which we want to merge, one of which adds auth-source.el
compatibility.

https://github.com/nealey/rcirc

-- 
Deniz Dogan





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#8385: 24.0.50; rcirc auto-authentication slightly broken
  2011-03-31 16:55     ` Deniz Dogan
@ 2011-03-31 16:59       ` Deniz Dogan
       [not found]       ` <mailman.1.1301591269.19576.bug-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 9+ messages in thread
From: Deniz Dogan @ 2011-03-31 16:59 UTC (permalink / raw)
  To: Ted Zlatanov; +Cc: bug-gnu-emacs

2011/3/31 Deniz Dogan <deniz.a.m.dogan@gmail.com>:
> 2011/3/31 Ted Zlatanov <tzz@lifelogs.com>:
>> On Thu, 31 Mar 2011 12:13:17 +0200 Tassilo Horn <tassilo@member.fsf.org> wrote:
>>
>> TH> === modified file 'lisp/net/rcirc.el'
>> ...
>> TH> +            (dolist (s rcirc-authinfo ret)
>> TH> +              (when (string-match (car s) rcirc-server-name)
>>
>> Would it be useful to wire rcirc.el to use auth-source.el?
>>
>> Ted
>>
>
> As I understand it, we are waiting for the FSF to review Neale
> Pickett's copyright assignment papers. He has written a few patches
> which we want to merge, one of which adds auth-source.el
> compatibility.
>
> https://github.com/nealey/rcirc
>

Actually, my bad. Neale's patches have nothing to do with
auth-source.el. I don't know much about auth-source.el but if you feel
that it's easy to wire them together, feel free to write functionality
for it!

-- 
Deniz Dogan





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: bug#8385: 24.0.50; rcirc auto-authentication slightly broken
       [not found]       ` <mailman.1.1301591269.19576.bug-gnu-emacs@gnu.org>
@ 2011-04-05 20:01         ` Ted Zlatanov
  2011-05-19 13:48           ` Ted Zlatanov
  0 siblings, 1 reply; 9+ messages in thread
From: Ted Zlatanov @ 2011-04-05 20:01 UTC (permalink / raw)
  To: bug-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1454 bytes --]

On Thu, 31 Mar 2011 18:59:12 +0200 Deniz Dogan <deniz.a.m.dogan@gmail.com> wrote: 

DD> Actually, my bad. Neale's patches have nothing to do with
DD> auth-source.el. I don't know much about auth-source.el but if you feel
DD> that it's easy to wire them together, feel free to write functionality
DD> for it!

Hmm, it looks like rcirc-authinfo is kind of orthogonal to the actual
server login parameters.  Maybe you want to add support for auth-info to
that, but I don't want to break it or change the design.  So let me know
if you want it.  You can also merge rcirc-authinfo with the line below,
e.g. an extra "bitlbee BB" parameter to provide the bitlbee auth
tokens...  Whatever makes sense.

The attached patch will make rcirc.el look at your `auth-sources', which
by default is the list "~/.authinfo.gpg" "~/.authinfo" "~/.netrc".

The file line would look like this (all except host are optional):

host H port P login NICK username "long name" password "my password" channels "one two three"

If you fail to connect, it will keep retrying with the same login info.
You probably want to fall back on prompting if that happens.

Also you can use the :create t parameter to request that the password,
port, etc. be created on a line.

Let me know if you want help implementing the connect fallback or the
token creation.  There are examples of both in lisp/gnus/nnimap.el.
It's fairly simple except for the creation prompts and default values.

Ted


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: rcirc-auth-source.patch --]
[-- Type: text/x-diff, Size: 3668 bytes --]

=== modified file 'lisp/net/rcirc.el'
*** lisp/net/rcirc.el	2011-03-31 12:19:17 +0000
--- lisp/net/rcirc.el	2011-04-05 19:54:59 +0000
***************
*** 47,52 ****
--- 47,54 ----
  (require 'time-date)
  (eval-when-compile (require 'cl))
  
+ (autoload 'auth-source-search "auth-source")
+ 
  (defgroup rcirc nil
    "Simple IRC client."
    :version "22.1"
***************
*** 420,446 ****
  				      (caar rcirc-server-alist)
  				      'rcirc-server-name-history))
  	     (server-plist (cdr (assoc-string server rcirc-server-alist)))
! 	     (port (read-string "IRC Port: "
! 				(number-to-string
! 				 (or (plist-get server-plist :port)
! 				     rcirc-default-port))
! 				'rcirc-server-port-history))
! 	     (nick (read-string "IRC Nick: "
! 				(or (plist-get server-plist :nick)
! 				    rcirc-default-nick)
! 				'rcirc-nick-name-history))
! 	     (user-name (read-string "IRC Username: "
!                                      (or (plist-get server-plist :user-name)
!                                          rcirc-default-user-name)
!                                      'rcirc-user-name-history))
! 	     (password (read-passwd "IRC Password: " nil
!                                     (plist-get server-plist :password)))
  	     (channels (split-string
! 			(read-string "IRC Channels: "
! 				     (mapconcat 'identity
! 						(plist-get server-plist
! 							   :channels)
! 						" "))
  			"[, ]+" t)))
  	(rcirc-connect server port nick user-name
  		       rcirc-default-full-name
--- 422,456 ----
  				      (caar rcirc-server-alist)
  				      'rcirc-server-name-history))
  	     (server-plist (cdr (assoc-string server rcirc-server-alist)))
!              ;; TODO: could also use :create t to create the auth tokens
!              (server-auth (nth 0 (auth-source-search :max 1 :host server)))
! 	     (port (or (plist-get server-plist :port)
!                        (read-string "IRC Port: "
!                                     (number-to-string
!                                      (or (plist-get server-plist :port)
!                                          rcirc-default-port))
!                                     'rcirc-server-port-history)))
! 	     (nick (or (plist-get server-plist :login)
!                        (read-string "IRC Nick: "
!                                     (or (plist-get server-plist :nick)
!                                         rcirc-default-nick)
!                                     'rcirc-nick-name-history)))
! 	     (user-name (or (plist-get server-plist :username)
!                             (read-string "IRC Username: "
!                                          (or (plist-get server-plist :user-name)
!                                              rcirc-default-user-name)
!                                          'rcirc-user-name-history)))
! 	     (password (or (and (functionp (plist-get server-plist :secret))
!                                 (funcall (plist-get server-plist :secret)))
!                            (read-passwd "IRC Password: " nil
!                                         (plist-get server-plist :password))))
  	     (channels (split-string
!                         (or (plist-get server-plist :channels)
!                             (read-string "IRC Channels: "
!                                          (mapconcat 'identity
!                                                     (plist-get server-plist
!                                                                :channels)
!                                                     " ")))
  			"[, ]+" t)))
  	(rcirc-connect server port nick user-name
  		       rcirc-default-full-name


^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#8385: 24.0.50; rcirc auto-authentication slightly broken
  2011-04-05 20:01         ` Ted Zlatanov
@ 2011-05-19 13:48           ` Ted Zlatanov
  0 siblings, 0 replies; 9+ messages in thread
From: Ted Zlatanov @ 2011-05-19 13:48 UTC (permalink / raw)
  To: bug-gnu-emacs

On Tue, 05 Apr 2011 15:01:02 -0500 Ted Zlatanov <tzz@lifelogs.com> wrote: 

TZ> The attached patch will make rcirc.el look at your `auth-sources', which
TZ> by default is the list "~/.authinfo.gpg" "~/.authinfo" "~/.netrc".

Could I get an opinion on this?  I'd like to add it but don't use rcirc
myself so I can't test it or verify it's convenient.

Thanks
Ted






^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-05-19 13:48 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-31  0:21 bug#8385: 24.0.50; rcirc auto-authentication slightly broken Deniz Dogan
2011-03-31  7:03 ` Deniz Dogan
2011-03-31 10:13 ` Tassilo Horn
2011-03-31 12:52 ` Deniz Dogan
     [not found] ` <mailman.2.1301567843.29790.bug-gnu-emacs@gnu.org>
2011-03-31 16:06   ` Ted Zlatanov
2011-03-31 16:55     ` Deniz Dogan
2011-03-31 16:59       ` Deniz Dogan
     [not found]       ` <mailman.1.1301591269.19576.bug-gnu-emacs@gnu.org>
2011-04-05 20:01         ` Ted Zlatanov
2011-05-19 13:48           ` Ted Zlatanov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).