Tim Waugh wrote:
> In base/slp.py there is:
> 
> packet = ''.join(['\x01\x06\x00,\x00\x00en\x00\x03',
>            struct.pack('!H', xid or random.randint(1, 65535)),
>            '\x00\x00\x00\x18service:x-hpnp-discover:\x00\x00\x00\x00'])
> 
> Does this random XID need to be cryptographically secure, or will any
> number do?  Will just '1' do?
> 
> The reason I ask is that our SELinux implementation restricts access to
> the system's entropy pool.
> 
> Tim.
> */
> 
Tim,

I copied this code (well, a C version of it) from some other code that 
is used at HP or a sample that I found (don't remember which, its been a 
long time...), so I didn't question it. I believe that the spec says 
that it just needs to be a unique number during the course of a session, 
and this seemed like a fairly easy way to achieve that. I would guess 
that an integer like 0, 1, or 42 would probably work OK too.

Anyway, this code is no longer in use, so it's a pretty academic 
discussion. This was the code that was behind 'hp-probe', but that 
utility was pulled because this code (slp.py) doesn't work reliably (not 
related to this snippet). If I ever revisit hp-probe, I will certainly 
look into reworking the xid generation. In the meantime, perhaps I 
should remove slp.py out of the tarball.

Thanks,

Don




_______________________________________________
HPLIP-Devel mailing list
HPLIP-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hplip-devel

Reply via email to