Proposal with patch: Make socket directory host dependent

Werner Koch wk at gnupg.org
Wed Dec 20 15:32:17 CET 2017


On Wed, 20 Dec 2017 12:48, rainer.perske at uni-muenster.de said:

> I do not understand yet how the figures 13 + 1 + 20 are calculated. 

char prefix[13 + 1 + 20 + 6 + 1];

/var/run/user -> 13
/             -> 1
UID           -> 20 (for a 64 bit unsigned integer)
/gnupg        -> 6
nul           -> 1

and indeed I did not add 6 extra bytes for the leading "/gnupg".
However, it is not a problem:  A 32 bit user id (e.g. 2147483647) does
only need 10 bytes and thus there is enough space for the extra string.
If the ID would really grow to a larger 64 bit value, this will not
work anymore and the explict check will let it return an error.

Although I tested this I obviously did not noticed that we will end up
with a socket directory

  /run/gnupg/user/gnupg/

The second gnupg would not be needed.  The question is whether to remove
it or to keep it for code simplicity.  I will fix the size of the
prefix, though.


Salam-Shalom,

   Werner

-- 
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 227 bytes
Desc: not available
URL: <https://lists.gnupg.org/pipermail/gnupg-devel/attachments/20171220/3b2c982f/attachment.sig>


More information about the Gnupg-devel mailing list