[FIX] smac.py's handle_read is naughty,
was Re: [ZODB-Dev] Problem with large transactions combined with
authentication mode
Christian Robottom Reis
kiko at async.com.br
Thu Dec 18 22:12:31 EST 2003
On Thu, Dec 18, 2003 at 11:30:23AM -0500, Jeremy Hylton wrote:
> On Thu, 2003-12-18 at 07:36, Christian Robottom Reis wrote:
> > I can apply this if you like; just let me know if/which trunk/branches.
>
> Yes. Can you check it in to the trunk and the Zope-2_7-branch? If you
> could also backport your smac fix and comments, that would be great.
Done. Is this branch what's going to become the next 3.2.X release?
I have a question about the smac fix, though. I had initialized
__has_mac to 0, and in your update, you used True. I was confused by
this, but went with your change on the branch anyway. Was this
intentional?
> Also, if it's not an insane amount of work, it would be good to have
> some minimal test that zeopasswd.py works as a script.
I've attached here what I would call a "bare minimal" test. It's not
lovely, and I had to add a slight change to the script to allow
specifying a Database since that's required for testing auth_plaintext;
however it actually caught a bug while running it so it seems to serve
some purpose.
Let me know if you'd like it checked in (I'll probably be able to do it
tomorrow) to branch and trunk.
Index: zeopasswd.py
===================================================================
RCS file: /cvs-repository/ZODB3/ZEO/zeopasswd.py,v
retrieving revision 1.2.6.3
diff -u -p -r1.2.6.3 zeopasswd.py
--- zeopasswd.py 19 Dec 2003 02:59:54 -0000 1.2.6.3
+++ zeopasswd.py 19 Dec 2003 03:11:42 -0000
@@ -101,7 +101,7 @@ def options(args):
return auth_protocol, auth_db, auth_realm, delete, username, password
-def main(args=None):
+def main(args=None, dbclass=None):
p, auth_db, auth_realm, delete, username, password = options(args)
if p is None:
usage("Error: configuration does not specify auth protocol")
@@ -109,6 +109,9 @@ def main(args=None):
from ZEO.auth.auth_digest import DigestDatabase as Database
elif p == "srp":
from ZEO.auth.auth_srp import SRPDatabase as Database
+ elif dbclass:
+ # dbclass is used for testing tests.auth_plaintext, see testAuth.py
+ Database = dbclass
else:
raise ValueError, "Unknown database type %r" % p
if auth_db is None:
Index: tests/testAuth.py
===================================================================
RCS file: /cvs-repository/ZODB3/ZEO/tests/testAuth.py,v
retrieving revision 1.3.6.3
diff -u -p -r1.3.6.3 testAuth.py
--- tests/testAuth.py 19 Sep 2003 20:45:49 -0000 1.3.6.3
+++ tests/testAuth.py 19 Dec 2003 03:11:43 -0000
@@ -21,6 +21,7 @@ import unittest
import zLOG
from ThreadedAsync import LoopCallback
+from ZEO import zeopasswd
from ZEO.ClientStorage import ClientStorage
from ZEO.Exceptions import ClientDisconnected
from ZEO.StorageServer import StorageServer
@@ -44,8 +45,19 @@ class AuthTest(CommonSetupTearDown):
self.pwdb = self.dbclass(self.pwfile)
self.pwdb.add_user("foo", "bar")
self.pwdb.save()
+ self._checkZEOpasswd()
self.__super_setUp()
+ def _checkZEOpasswd(self):
+ args = ["-f", self.pwfile, "-p", self.protocol]
+ if self.protocol == "plaintext":
+ from ZEO.auth.base import Database
+ zeopasswd.main(args + ["-d", "foo"], Database)
+ zeopasswd.main(args + ["foo", "bar"], Database)
+ else:
+ zeopasswd.main(args + ["-d", "foo"])
+ zeopasswd.main(args + ["foo", "bar"])
+
def tearDown(self):
self.__super_tearDown()
os.remove(self.pwfile)
Take care,
--
Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 261 2331
More information about the ZODB-Dev
mailing list