[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: ldapsearch binary attributes, temp files



mkstemp(3) should be used instead of mktemp(3) as the latter
has a race condition which could be exploited.

The ud should not be using tmpfile(3) as the code requires
knowledge of the tmp filename.


At 04:56 PM 2001-12-17, Howard Chu wrote:
>Something broke recently in the configuration of what function is used to
>generate temp file names. I vaguely recall a discussion here a while back on
>the subject, but trawling through my memory and the mailing list archive
>didn't turn up anything useful.
>
>The current ldapsearch.c uses mkstemp to create the pathname of the temp
>files it uses to store binary attributes. In liblutil there is a stub for
>mkstemp that simply returns -1, surrounded by #ifndef HAVE_MKSTEMP. There is
>no test for mkstemp in configure, and no HAVE_MKSTEMP macro in
>portable.h.in, so we are getting this bogus definition of mkstemp compiled
>and linked.
>
>It's not too clear what we really want here, as there are at least 5
>variations of mktemp/tmpnam/tmpfile etc. to choose from on common Unix
>platforms. I note that clients/mail500 and maildap both use tmpfile() in
>their main.c while clients/ud/edit.c and clients/tools/ldapsearch.c both use
>mkstemp (and both are broken now). The old code in ldapsearch.c used mktemp
>in rev 1.104, and was changed to mkstemp in 1.105 on June 28. Anyone recall
>the reason for this change?
>
>  -- Howard Chu
>  Chief Architect, Symas Corp.       Director, Highland Sun
>  http://www.symas.com               http://highlandsun.com/hyc
>  Symas: Premier OpenSource Development and Support