pwrap: Use a more unique name for pamdir
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Mon, 19 Feb 2018 20:23:23 +0000 (21:23 +0100)
committerAndreas Schneider <asn@samba.org>
Thu, 22 Feb 2018 15:03:53 +0000 (16:03 +0100)
commit6bea1e19edf520985776787c3ba3fcea3ca89faa
treecd624f2374f708bc4869bb8f559039adbdb5077a
parent5c36d4284918a3fcc1c58f29f01ca64c65a66fa7
pwrap: Use a more unique name for pamdir

Parallel builds fail quite predictable when using libpam_wrapper.
It seems that the temporary directory used are created sequentially
and that caused issues like:

PWRAP_ERROR(8157) - pwrap_load_lib_handle: Failed to dlopen library: /tmp/pam.0/lib/libpam.so.0: cannot open shared object file: No such file or directory

When a directory was cleaned up, incorrectly. I have not pin-pointed
the race condition, but this patch starts from a random letter (using
the PID of the process) in the temporary directory name, providing
better assurances of uniqueness.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
src/pam_wrapper.c