summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortcocagne <devnull@localhost>2012-10-29 22:58:47 -0500
committertcocagne <devnull@localhost>2012-10-29 22:58:47 -0500
commit407a3c80b6c1a24a8bf9e6f2df8b0cceefe2347b (patch)
tree6e2ba21bbc5f111c5f97c052bf99b694b2472f20
parent69ae351b02e6c0176095ad81744d09226964c8b0 (diff)
Fixed data structure initialiation bug reported by kaliuga
-rw-r--r--srp/_srp.c2
-rw-r--r--srp/test_srp.py12
2 files changed, 12 insertions, 2 deletions
diff --git a/srp/_srp.c b/srp/_srp.c
index 45df613..c2341d6 100644
--- a/srp/_srp.c
+++ b/srp/_srp.c
@@ -712,6 +712,8 @@ struct SRPUser * srp_user_new( SRP_HashAlgorithm alg, SRP_NGType ng_type, const
memcpy((char *)usr->username, username, ulen);
memcpy((char *)usr->password, bytes_password, len_password);
+
+ usr->authenticated = 0;
usr->bytes_A = 0;
diff --git a/srp/test_srp.py b/srp/test_srp.py
index 37cf4c3..d33fae2 100644
--- a/srp/test_srp.py
+++ b/srp/test_srp.py
@@ -26,7 +26,6 @@ sys.path.insert(0, os.path.join('build', plat_dir) )
-
import srp
import srp._pysrp as _pysrp
import srp._ctsrp as _ctsrp
@@ -121,7 +120,16 @@ class SRPTests( unittest.TestCase ):
def test_all2(self):
self.doit( _ctsrp, _pysrp, _srp, hash_alg=srp.SHA224, ng_type=srp.NG_4096 )
-
+ def test_authenticated_on_init(self):
+ usr = _pysrp.User('test', 'test')
+ self.assertTrue(not usr.authenticated())
+
+ usr = _ctsrp.User('test', 'test')
+ self.assertTrue(not usr.authenticated())
+
+ usr = _srp.User('test', 'test')
+ self.assertTrue(not usr.authenticated())
+
#-----------------------------------------------------------------------------------
# Performance Testing