changeset 544859c64f78 in /home/hg/repos/python-nbxmpp
details:http://hg.gajim.org/python-nbxmpp?cmd=changeset;node=544859c64f78
description: Add possibility to restrict authentication mechanisms used during login.
Fixes #20
diffstat:
nbxmpp/auth_nb.py | 36 +++++++++++++++++++++++++++++-------
nbxmpp/client_nb.py | 19 ++++++++++++++++---
2 files changed, 45 insertions(+), 10 deletions(-)
diffs (144 lines):
diff -r c79cbe36a94e -r 544859c64f78 nbxmpp/auth_nb.py
--- a/nbxmpp/auth_nb.py Wed Feb 26 11:22:41 2014 +0100
+++ b/nbxmpp/auth_nb.py Sat Mar 01 20:53:52 2014 +0100
@@ -91,25 +91,35 @@
"""Helper function. Used for SCRAM-SHA-1, SCRAM-SHA-1-PLUS authentication"""
return dict(s.split('=', 1) for s in chatter.split(','))
+SASL_AUTHENTICATION_MECHANISMS = \
+ set(['ANONYMOUS', 'EXTERNAL', 'GSSAPI', 'SCRAM-SHA-1-PLUS', 'SCRAM-SHA-1',
+ 'DIGEST-MD5', 'PLAIN', 'X-MESSENGER-OAUTH2'])
+
class SASL(PlugIn):
"""
Implements SASL authentication. Can be plugged into NonBlockingClient
to start authentication
"""
- def __init__(self, username, password, on_sasl, channel_binding):
+ def __init__(self, username, password, on_sasl, channel_binding,
+ auth_mechs):
"""
:param username: XMPP username
:param password: XMPP password
:param on_sasl: Callback, will be called after each SASL auth-step.
:param channel_binding: TLS channel binding data, None if the
binding data is not available
+ :param auth_mechs: Set of valid authentication mechanisms.
+ Possible entries are:
+ 'ANONYMOUS', 'EXTERNAL', 'GSSAPI', 'SCRAM-SHA-1-PLUS',
+ 'SCRAM-SHA-1', 'DIGEST-MD5', 'PLAIN', 'X-MESSENGER-OAUTH2'
"""
PlugIn.__init__(self)
self.username = username
self.password = password
self.on_sasl = on_sasl
self.channel_binding = channel_binding
+ self.enabled_auth_mechs = auth_mechs
self.realm = None
def plugin(self, owner):
@@ -146,7 +156,7 @@
Start authentication. Result can be obtained via "SASL.startsasl"
attribute and will be either SASL_SUCCESS or SASL_FAILURE
- Note that successfull auth will take at least two Dispatcher.Process()
+ Note that successful auth will take at least two Dispatcher.Process()
calls.
"""
if self.startsasl:
@@ -169,10 +179,22 @@
self.startsasl='not-supported'
log.info('SASL not supported by server')
return
- self.mecs = []
- for mec in feats.getTag('mechanisms', namespace=NS_SASL).getTags(
- 'mechanism'):
- self.mecs.append(mec.getData())
+
+ self.mecs = set(
+ mec.getData()
+ for mec
+ in feats.getTag('mechanisms', namespace=NS_SASL).getTags('mechanism')
+ ) & self.enabled_auth_mechs
+
+ # Password based authentication mechanism ordered by strength.
+ # If the server supports a mechanism disable all weaker mechanisms.
+ password_auth_mechs_strength = ('SCRAM-SHA-1-PLUS', 'SCRAM-SHA-1',
+ 'DIGEST-MD5', 'PLAIN', 'X-MESSENGER-OAUTH2')
+ for i in range(0, len(password_auth_mechs_strength)):
+ if password_auth_mechs_strength[i] in self.mecs:
+ for m in password_auth_mechs_strength[i + 1:]:
+ self.mecs.discard(m)
+ break
self._owner.RegisterHandler('challenge', self.SASLHandler,
xmlns=NS_SASL)
@@ -508,7 +530,7 @@
class NonBlockingNonSASL(PlugIn):
"""
- Implements old Non-SASL (JEP-0078) authentication used in jabberd1.4 and
+ Implements old Non-SASL (XEP-0078) authentication used in jabberd1.4 and
transport authentication
"""
diff -r c79cbe36a94e -r 544859c64f78 nbxmpp/client_nb.py
--- a/nbxmpp/client_nb.py Wed Feb 26 11:22:41 2014 +0100
+++ b/nbxmpp/client_nb.py Sat Mar 01 20:53:52 2014 +0100
@@ -23,6 +23,7 @@
import socket
import transports_nb, dispatcher_nb, auth_nb, roster_nb, protocol, bosh
from protocol import NS_TLS
+from nbxmpp.auth_nb import SASL_AUTHENTICATION_MECHANISMS
import logging
log = logging.getLogger('nbxmpp.client_nb')
@@ -472,7 +473,8 @@
### follows code for authentication, resource bind, session and roster download
###############################################################################
- def auth(self, user, password, resource='', sasl=True, on_auth=None):
+ def auth(self, user, password, resource='', sasl=True, on_auth=None,
+ auth_mechs=None):
"""
Authenticate connnection and bind resource. If resource is not provided
random one or library name used
@@ -483,6 +485,11 @@
:param sasl: Boolean indicating if SASL shall be used. (default: True)
:param on_auth: Callback, called after auth. On auth failure, argument
is None.
+ :param auth_mechs: Set of valid authentification mechanisms. If None all
+ authentification mechanisms will be allowed. Possible entries are:
+ 'ANONYMOUS', 'EXTERNAL', 'GSSAPI', 'SCRAM-SHA-1-PLUS',
+ 'SCRAM-SHA-1', 'DIGEST-MD5', 'PLAIN', 'X-MESSENGER-OAUTH2',
+ 'XEP-0078'
"""
self._User, self._Password = user, password
self._Resource, self._sasl = resource, sasl
@@ -494,6 +501,10 @@
assert (self._channel_binding != None)
except NotImplementedError:
pass
+ if auth_mechs == None:
+ self._auth_mechs = SASL_AUTHENTICATION_MECHANISMS | set(['XEP-0078'])
+ else:
+ self._auth_mechs = auth_mechs
self.on_auth = on_auth
self._on_doc_attrs()
return
@@ -525,10 +536,12 @@
"""
if self._sasl:
auth_nb.SASL.get_instance(self._User, self._Password,
- self._on_start_sasl, self._channel_binding).PlugIn(self)
+ self._on_start_sasl, self._channel_binding,
+ self._auth_mechs).PlugIn(self)
if not hasattr(self, 'SASL'):
return
- if not self._sasl or self.SASL.startsasl == 'not-supported':
+ if ('XEP-0078' in self._auth_mechs
+ and (not self._sasl or self.SASL.startsasl == 'not-supported')):
if not self._Resource:
self._Resource = 'xmpppy'
auth_nb.NonBlockingNonSASL.get_instance(self._User, self._Password,
changeset 07bd6ab3f68f in /home/hg/repos/gajim-website
author: Yann Leboulanger <asterix(a)lagaule.org>
details:http://hg.gajim.org/gajim-website?cmd=changeset;node=07bd6ab3f68f
description: [Davide Pizzetti] updated website italian translation
diffstat:
locale/it_IT/LC_MESSAGES/msg.po | 524 ++++++++++++++++++---------------------
1 files changed, 243 insertions(+), 281 deletions(-)
diffs (truncated from 1106 to 300 lines):
diff -r 8ce70abb34ad -r 07bd6ab3f68f locale/it_IT/LC_MESSAGES/msg.po
--- a/locale/it_IT/LC_MESSAGES/msg.po Wed Jan 01 13:39:31 2014 +0100
+++ b/locale/it_IT/LC_MESSAGES/msg.po Thu Feb 27 09:32:27 2014 +0100
@@ -1,14 +1,14 @@
# Italian translations for PACKAGE package.
-# Copyright (C) 2007 THE PACKAGE'S COPYRIGHT HOLDER
+# Copyright (C) 2007-2014 THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as Gajim's website.
-# Daniel Coppi<neoex.dc(a)gmail.com>, 2007.
-#
+# Daniel Coppi <neoex.dc(a)gmail.com>, 2007.
+# Davide Pizzetti <erpizzo(a)alice.it>, 2014
msgid ""
msgstr ""
"Project-Id-Version: gajim website\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2013-08-29 20:03+0200\n"
-"PO-Revision-Date: 2007-09-23 00:39+0100\n"
+"POT-Creation-Date: 2014-02-27 09:31+0100\n"
+"PO-Revision-Date: 2014-02-25 15:52+0100\n"
"Last-Translator: neoex <neoex.dc(a)gmail.com>\n"
"Language-Team: Italian\n"
"Language: \n"
@@ -16,10 +16,11 @@
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Generator: Poedit 1.5.4\n"
#: Design.php:85
msgid "Home"
-msgstr "Home"
+msgstr "Pagina iniziale"
#: Design.php:86
msgid "Screenshots"
@@ -86,9 +87,8 @@
msgstr "Zenwalk"
#: Design.php:105
-#, fuzzy
msgid "AgiliaLinux"
-msgstr "Archlinux"
+msgstr "AgiliaLinux"
#: Design.php:106
msgid "FreeBSD"
@@ -108,7 +108,7 @@
#: Design.php:110
msgid "Mercurial"
-msgstr ""
+msgstr "Mercurial"
#: Design.php:111
msgid "Daily snapshots"
@@ -160,7 +160,7 @@
#: dev.php:17
msgid " Mailing List"
-msgstr " Mailing List"
+msgstr " Mailing list"
#: dev.php:19
msgid " You may also want to subscribe to our mailing list (low-traffic): "
@@ -174,7 +174,7 @@
#: dev.php:20
msgid " List archives are available "
-msgstr " Sono disponibili gli archivi della lista "
+msgstr " Sono disponibili gli archivi dell'elenco"
#: dev.php:20 docs.php:39 docs.php:45 downloads.php:24 downloads.php:38
#: downloads.php:161 downloads.php:163 downloads.php:173 downloads.php:211
@@ -187,9 +187,8 @@
msgstr " Repository"
#: dev.php:27
-#, fuzzy
msgid "To checkout hg do"
-msgstr "Per eseguire il checkout svn esegui"
+msgstr "Per copiare il repository nel tuo sistema esegui"
#: dev.php:29
msgid " You can also"
@@ -229,7 +228,7 @@
#: dev.php:44
msgid " Submitting a translation: see"
-msgstr " Inviando una traduzione: vedi"
+msgstr " Inviare una traduzione: vedi"
#: dev.php:44
msgid "DevTranslate page"
@@ -245,7 +244,7 @@
#: dev.php:50
msgid " Donating: "
-msgstr ""
+msgstr " Donare:"
#: dev.php:62
msgid " Translations status"
@@ -262,11 +261,11 @@
#: dev.php:96 dev.php:99
#, c-format
msgid "%s (%s)"
-msgstr ""
+msgstr "%s (%s)"
#: dev.php:103
msgid " We also want to thank"
-msgstr " Vogliamo anche ringraziare"
+msgstr " Vogliamo ringraziare anche"
#: dev.php:103
msgid "these people"
@@ -277,56 +276,51 @@
msgstr " Installazione\n"
#: docs.php:17
-#, fuzzy
msgid " Tarball and Mercurial\n"
-msgstr " Tarball e Subversion\n"
+msgstr " Tarball e Mercurial\n"
#: docs.php:19
msgid "download"
msgstr "pagina"
#: docs.php:20
-#, fuzzy, c-format
+#, c-format
msgid " To get one of these versions, go to the %s page.\n"
-msgstr " Per ottenere una di queste versioni, vai alla"
+msgstr " Per ottenere una di queste versioni, vai alla pagina %s.\n"
#: docs.php:22 downloads.php:176
msgid " Under GNU/Linux\n"
msgstr " Sotto GNU/Linux\n"
#: docs.php:24
-#, fuzzy
msgid " To run this version, you have to install some packages. \n"
-msgstr ""
-" Per eseguire questa versione, devi installare alcuni pacchetti: "
-"python2.3 python2.3-gtk2 e python2.3-glade2.\n"
+msgstr " Per eseguire questa versione, devi installare alcuni pacchetti.\n"
#: docs.php:25
msgid "README file"
-msgstr ""
+msgstr "File README"
#: docs.php:26
-#, fuzzy, c-format
+#, c-format
msgid " See %s.\n"
-msgstr " Subversion\n"
+msgstr " Vedi %s\n"
#: docs.php:29
msgid " Under Microsoft Windows\n"
msgstr " Sotto Microsoft Windows\n"
#: docs.php:31
-#, fuzzy
msgid "this page"
-msgstr "pagine del wiki"
+msgstr "questa pagina"
#: docs.php:32
#, c-format
msgid "See %s to install development version under windows."
-msgstr ""
+msgstr "Vedi %s per installare la versione di sviluppo sotto Windows."
#: docs.php:39
msgid " Please read"
-msgstr " Per favore leggi"
+msgstr " Per favore, leggi"
#: docs.php:43
msgid " Structure\n"
@@ -337,24 +331,26 @@
msgstr " Puoi capire come funziona Gajim"
#: docs.php:48
-#, fuzzy, c-format
+#, c-format
msgid ""
" Gajim uses a fork of the %s library to do the interface with Jabber "
"network.\n"
-msgstr "libreria per interfacciarsi con la rete Jabber.\n"
+msgstr ""
+" Gajim usa un fork della libreria %s per interfacciarsi alla rete "
+"Jabber.\n"
#: downloads.php:10
msgid " Latest version of Gajim is"
-msgstr " L'ultima versione di Gajim è la"
+msgstr " La versione più recente di Gajim è la versione"
#: downloads.php:11
-#, fuzzy, c-format
+#, c-format
msgid " A %s version is in test"
-msgstr " L'ultima versione di Gajim è la"
+msgstr " Una versione %s è in prova"
#: downloads.php:13
msgid "If your distribution doesn't have the latest version "
-msgstr "Se la tua distribuzione non ha l'ultima versione "
+msgstr "Se la tua distribuzione non ha la versione più recente "
#: downloads.php:14
msgid "or the "
@@ -373,16 +369,16 @@
msgstr " Se usi Debian unstable esegui"
#: downloads.php:23
-#, fuzzy, c-format
+#, c-format
msgid " The Debian package of %s is "
-msgstr " La versione tarball di Gajim è "
+msgstr " Il pacchetto della versione %s per Debian è"
#: downloads.php:25
-#, fuzzy
msgid ""
" A daily package from mercurial is also built. To use it, remove gajim"
msgstr ""
-" Viene generato un pacchetto giornaliero da svn. Per usarlo, rimuovi gajim"
+" Viene generato un pacchetto giornaliero da Mercurial. Per usarlo, "
+"rimuovi Gajim"
#: downloads.php:25
msgid "add this line to your"
@@ -401,27 +397,25 @@
"gnome-dev-keyring dallo stesso repository. Basta che esegui"
#: downloads.php:38
-#, fuzzy
msgid " You can get the Slackware package of Gajim"
-msgstr " Puoi scaricare l'installer autopackage "
+msgstr " Puoi ottenere il pacchetto di Gajim per Slackware"
#: downloads.php:46
msgid " If you use Ubuntu universe repository do"
msgstr " Se usi il repository universe di Ubuntu esegui"
#: downloads.php:48
-#, fuzzy
msgid " If you want newer version of Gajim, you can also use"
-msgstr " L'ultima versione di Gajim è la"
+msgstr " Se vuoi usare una versione più recente di Gajim, puoi anche usare"
#: downloads.php:48
msgid "this PPA"
-msgstr ""
+msgstr "questo PPA"
#: downloads.php:56 downloads.php:63 downloads.php:70 downloads.php:92
#: downloads.php:100 downloads.php:108 downloads.php:116
msgid " Just"
-msgstr " Basta"
+msgstr " Basta eseguire"
#: downloads.php:60
msgid " Gentoo\n"
@@ -437,24 +431,23 @@
#: downloads.php:77
msgid " One click install for openSuSE"
-msgstr ""
+msgstr " Installazione con un click per openSuSE"
#: downloads.php:78
msgid " For other versions, "
-msgstr ""
+msgstr " Per altre versioni,"
#: downloads.php:78
msgid "get it here"
-msgstr ""
+msgstr "ottienile qui"
#: downloads.php:82
msgid " PLD\n"
msgstr " PLD\n"
#: downloads.php:85
-#, fuzzy
msgid " Just "
-msgstr " Basta"
+msgstr " Basta eseguire"
#: downloads.php:89
msgid " SourceMage\n"
@@ -474,7 +467,7 @@
changeset 9954a0178fe8 in /home/hg/repos/python-nbxmpp
details:http://hg.gajim.org/python-nbxmpp?cmd=changeset;node=9954a0178fe8
description: Fix typos
diffstat:
nbxmpp/client_nb.py | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diffs (52 lines):
diff -r 3a7acfa0b346 -r 9954a0178fe8 nbxmpp/client_nb.py
--- a/nbxmpp/client_nb.py Wed Feb 19 10:30:13 2014 +0100
+++ b/nbxmpp/client_nb.py Tue Feb 25 10:38:31 2014 +0100
@@ -17,7 +17,7 @@
# $Id: client.py,v 1.52 2006/01/02 19:40:55 normanr Exp $
"""
-Client class establishs connection to XMPP Server and handles authentication
+Client class establishes connection to XMPP Server and handles authentication
"""
import socket
@@ -32,7 +32,7 @@
"""
Client class is XMPP connection mountpoint. Objects for authentication,
network communication, roster, xml parsing ... are plugged to client object.
- Client implements the abstract behavior - mostly negotioation and callbacks
+ Client implements the abstract behavior - mostly negotiation and callbacks
handling, whereas underlying modules take care of feature-specific logic
"""
@@ -154,10 +154,10 @@
Open XMPP connection (open XML streams in both directions)
:param on_connect: called after stream is successfully opened
- :param on_connect_failure: called when error occures during connection
+ :param on_connect_failure: called when error occurs during connection
:param hostname: hostname of XMPP server from SRV request
:param port: port number of XMPP server
- :param on_proxy_failure: called if error occurres during TCP connection
+ :param on_proxy_failure: called if error occurs during TCP connection
to proxy server or during proxy connecting process
:param proxy: dictionary with proxy data. It should contain at least
values for keys 'host' and 'port' - connection details for proxy
@@ -426,7 +426,7 @@
def _tls_negotiation_handler(self, con=None, tag=None):
"""
- Take care of TLS negotioation with <starttls>
+ Take care of TLS negotiation with <starttls>
"""
log.info('-------------tls_negotiaton_handler() >> tag: %s' % tag)
if not con and not tag:
@@ -450,7 +450,7 @@
# because <starttls> negotiation with BOSH is forbidden
self.Connection.tls_init(
on_succ = lambda: self._xmpp_connect(socket_type='tls'),
- on_fail = lambda: self.disconnect('error while etabilishing TLS'))
+ on_fail = lambda: self.disconnect('error while establishing TLS'))
def _on_connect(self):
"""