Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Zookeeper >> mail # user >> Python C binding or C API has password byte mishandling bug

Copy link to this message
Re: Python C binding or C API has password byte mishandling bug
On Aug 22, 2012, at 4:38 PM, Ben Bangert <[EMAIL PROTECTED]> wrote:

> I tweaked the C layer to output this after connection:
>                    LOG_INFO(("Password is: %02x", zh->client_id.passwd));
> Granted, I should probably use a better print modifier, I'm a C newb unfortunately. This is what I see in my logs during the problem:
> ZooKeeper: INFO: check_events@1747: session establishment complete on server [], sessionId=0x139507b99fe00c6, negotiated timeout=10000
> ZooKeeper: INFO: check_events@1748: Password is: 2502978
> kazoo.testing: DEBUG: Password is:

For a possibly more helpful message, I changed it to:
LOG_INFO(("Password is: %#llx", zh->client_id.passwd));

Here's a failure with that:
ZooKeeper: INFO: check_events@1749: Password is: 0x101883698
kazoo.testing: DEBUG: Password is: c46b53ec5b9290, length: 7

Here we can see that the C layer got a password (not sure on C encoding if thats 16 bytes or not), and the Python one was 7 characters (prolly 6 chars, it seems to count one extra). So something is quite wrong here, and of course supplying the wrong password gets a session expired issue.

If someone that knows C better can translate that password back to the raw bytes, perhaps it'd be a good test case somewhere to see that the bytes aren't mucked up someone on the way to Python.