Skip to content

Commit c76a03f

Browse files
committed
Dynamic cipher XML
1 parent 0e868a9 commit c76a03f

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

pynuodb/session.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def __str__(self):
6666
class Session(object):
6767

6868
__AUTH_REQ = "<Authorize TargetService=\"%s\" Type=\"SRP\"/>"
69-
__SRP_REQ = "<SRPRequest ClientKey=\"%s\" Cipher=\"RC4\" Username=\"%s\"/>" #Why is this hard coded...
69+
__SRP_REQ = "<SRPRequest ClientKey=\"%s\" Cipher=\"%s\" Username=\"%s\"/>"
7070

7171
__SERVICE_REQ = "<Request Service=\"%s\"%s/>"
7272
__SERVICE_CONN = "<Connect Service=\"%s\"%s/>"
@@ -104,15 +104,14 @@ def port(self):
104104

105105
# NOTE: This routine works only for agents ... see the sql module for a
106106
# still-in-progress example of opening an authorized engine session
107-
def authorize(self, account="domain", password=None):
107+
def authorize(self, account="domain", password=None, cipher='RC4'):
108108
if not password:
109109
raise SessionException("A password is required for authorization")
110110

111111
cp = ClientPassword()
112112
key = cp.genClientKey()
113-
114113
self.send(Session.__AUTH_REQ % self.__service)
115-
response = self.__sendAndReceive(Session.__SRP_REQ % (key, account))
114+
response = self.__sendAndReceive(Session.__SRP_REQ % (key, cipher, account))
116115

117116
root = ElementTree.fromstring(response)
118117
if root.tag != "SRPResponse":

0 commit comments

Comments
 (0)