Skip to content

Commit 44b7a9b

Browse files
author
Michael Farb
committed
fixed json parsing of key nodes for 3+ users
1 parent a3661b4 commit 44b7a9b

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

safeslinger-demo/python/app.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ handlers:
3232
- url: /cron/cleanup
3333
script: cleanup.py
3434

35+
- url: /favicon\.ico
36+
static_files: static/images/favicon.ico
37+
upload: static/images/favicon\.ico
38+
3539
- url: /.*
3640
script: main.py
3741
secure: always

safeslinger-demo/python/assignUser.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ def post(self):
9797
else:
9898
commit = data[4:]
9999
logging.debug("in commitment '%s'" % commit)
100+
logging.debug("in commitment len '%s'" % commit.__sizeof__())
100101

101102
# client version check
102103
if client < INT_VERCLIENT:

safeslinger-demo/python/syncKeyNodes.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -99,23 +99,23 @@ def post(self):
9999

100100
expectedsize = 4 + 4
101101

102-
postKeyNodes = False
103-
if size > expectedsize:
104-
if self.isJson:
102+
postSelf = False
103+
if self.isJson:
104+
if 'keynode_b64' in data_dict:
105105
usridpost = int(data_dict['usridpost'], 10)
106-
else:
107-
usridpost = (struct.unpack("!i", data[8:12]))[0]
108-
logging.debug("in usridpost %i" % usridpost)
109-
110-
if self.isJson:
111106
key_node = base64.decodestring(data_dict['keynode_b64'])
112-
else:
107+
postSelf = True
108+
else:
109+
if size > expectedsize:
110+
usridpost = (struct.unpack("!i", data[8:12]))[0]
113111
sizeData = (struct.unpack("!i", data[12:16]))[0]
114112
logging.debug("in sizeData %i" % sizeData)
115113
key_node = (struct.unpack(str(sizeData) + "s", data[16:16 + sizeData]))[0]
114+
postSelf = True
115+
if postSelf:
116+
logging.debug("in usridpost %i" % usridpost)
116117
logging.debug("in key_node '%s'" % key_node)
117-
postKeyNodes = True
118-
118+
119119
# client version check
120120
if client < INT_VERCLIENT:
121121
self.resp_simple(0, ('Client version mismatch; %s required. Download latest client release first.' % STR_VERCLIENT))
@@ -131,7 +131,7 @@ def post(self):
131131
mem = query.get()
132132

133133
# verify...
134-
if postKeyNodes:
134+
if postSelf:
135135
query = member.Member.all()
136136
query.filter('usr_id =', usridpost)
137137
num = query.count()

0 commit comments

Comments
 (0)