Andrew Smart wrote:
> Hi folks,
> 
> I'm stumbling over an error which is is probably a bug... I'm new in pylons
> so I might be wrong... 
> 
> Module: paste.auth.auth_tkt, function encode_ip_timestamp:
>    def encode_ip_timestamp(ip, timestamp):
>        ip_chars = ''.join(unicode(map(chr, map(int, ip.split('.')))))
>        t = int(timestamp)
>        ts = ((t & 0xff000000) >> 24,
>              (t & 0xff0000) >> 16,
>              (t & 0xff00) >> 8,
>              t & 0xff)
>        ts_chars = ''.join(map(chr, ts))
>        return ip_chars + ts_chars
> 
> What happens when one part of the IP adress is above 127? 
> => the chr() function correctly converts it to a string, but chr() returns
> the string with the ascii codec
> => if the string is later on used (e.g. with md5.new()) and converted to
> unicode implicitly the conversion fails.
> 
> So, the following works:
>>> unicode(auth_tkt.encode_ip_timestamp("127.0.0.1", 4711))
> 
> The following fails:
>>> unicode(auth_tkt.encode_ip_timestamp("127.235.0.1", 4711))

Why would it get converted to unicode?  I thought the 
encode_ip_timestamp stuff was only used for the md5 hash.

-- 
Ian Bicking : [EMAIL PROTECTED] : http://blog.ianbicking.org
             : Write code, do good : http://topp.openplans.org/careers

_______________________________________________
Paste-users mailing list
[email protected]
http://webwareforpython.org/cgi-bin/mailman/listinfo/paste-users

Reply via email to