>Number: 5383
>Category: general
>Synopsis: tmpnam(NULL) doesn't work when -lpthread in link.
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: apache
>State: open
>Class: sw-bug
>Submitter-Id: apache
>Arrival-Date: Mon Nov 29 00:20:02 PST 1999
>Last-Modified:
>Originator: [EMAIL PROTECTED]
>Organization:
apache
>Release: 1.3.9
>Environment:
HP-UX sirion B.11.00 A 9000/782 2005651274 two-user license
HP C/ANSI C Compiler B.11.01.06
>Description:
Htpasswd, htdigest and mod_auth_digest use tmpnam(NULL), which won't
work in HP-UX 11 if -lpthread is in link.
I got the following from HP's tech support:
"This is covered by the man page for tpmnam().
$ man tmpnam
....
tmpnam() Always generates a file name using the path-prefix
.....
in that array and returns s. For multi-thread
applications, if s is a NULL pointer, the
operation is not performed and a NULL pointer is
returned.
ie for multi-threaded applications you need to supply the address of
the buffer tmpnam should use."
>How-To-Repeat:
I built apache with:
CC=cc CFLAGS="-g +e" \
./configure --prefix=/usr/local/apache_1.3.9 \
--enable-module=rewrite
make
Now try to run htpasswd in src/support:
$ ./htpasswd -c test test
New password: ....
Re-type new password: ....
./htpasswd: unable to create temporary file
fopen: No such file or directory
>Fix:
Either remove -lpthread from LIBS in src/Configure (that's what I did
as I couldn't figure out any reason to use -lpthread in link phase)
or if it is needed to link with -lpthread provide a pointer
(to array of at leas L_tmpnam bytes) to tmpnam call.
>Audit-Trail:
>Unformatted:
[In order for any reply to be added to the PR database, you need]
[to include <[EMAIL PROTECTED]> in the Cc line and make sure the]
[subject line starts with the report component and number, with ]
[or without any 'Re:' prefixes (such as "general/1098:" or ]
["Re: general/1098:"). If the subject doesn't match this ]
[pattern, your message will be misfiled and ignored. The ]
["apbugs" address is not added to the Cc line of messages from ]
[the database automatically because of the potential for mail ]
[loops. If you do not include this Cc, your reply may be ig- ]
[nored unless you are responding to an explicit request from a ]
[developer. Reply only with text; DO NOT SEND ATTACHMENTS! ]