/[glsr]/trunk/harmonious/_sessionutils.py
Gentoo

Diff of /trunk/harmonious/_sessionutils.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 25 Revision 26
116 116
117def _gen_hash(sid): 117def _gen_hash(sid):
118 118
119 return hmac.new(harm.config.server['SecretKey'], sid, sha).hexdigest()[:10] 119 return hmac.new(harm.config.server['SecretKey'], sid, sha).hexdigest()[:10]
120 120
121def _gen_sid(client_addr): 121def _gen_sid(client_addr, host):
122 122
123 ran = Random() 123 ran = Random()
124 124
125 return sha.new(str(time() * ran.randint(0, 10000000000000000000000000)) + \ 125 return sha.new(str(time() * ran.randint(0, 10000000000000000000000000)) + \
126 str(client_addr)).hexdigest()[:10] 126 str(client_addr) + str(host)).hexdigest()[:10]
127 127
128 # TODO: Just using the client IP addr isn't great. 128 # TODO: Just using the client IP addr isn't great.
129 129
130def gen_session_id(client_addr): 130def gen_session_id(client_addr, host):
131 131
132 sid = _gen_sid(client_addr) 132 sid = _gen_sid(client_addr, host)
133 133
134 return sid + _gen_hash(sid) 134 return sid + _gen_hash(sid)

Legend:
Removed from v.25  
changed lines
  Added in v.26

  ViewVC Help
Powered by ViewVC 1.1.20