first bunch of patches with mkstemp()
Matus "fantomas" Uhlar
uhlar at fantomas.sk
Sat Apr 8 13:07:14 UTC 2000
-> > Most hosts already have a function that returns a temporary FILE *, BTW
-> > (namely tmpfile). I'd be inclined to use the native implementation if
-> > it's there. I know OpenBSD's man page recommends to always use mkstemp
-> > and not rely on tmpfile due to flaws in old implementations of tmpfile,
-> > but on most modern operating systems tmpfile is equivalent in strength
-> > to mkstemp (and often even implemented by using it under the hood).
-> > And by using standard functions, we can take advantage of any security
-> > fixes to the underlying operating system.
True, but is there a possibility to force using our function if <something>?
-> > The difference between mkstemp and tmpfile, of course (besides the fact
-> > that the first returns a file descriptor and the second a FILE *), is
-> > that mkstemp leaves the file linked in so that it can be passed to
-> > other processes, while tmpfile unlinks the file and makes it truly
-> > temporary. I'm guessing that most of INN actually wants to use tmpfile,
-> > though. If there are a lot of functions that need a FILE * and need it
-> > to stick around, it may be worth writing a function that wraps mkstemp
-> > in an fdopen call.
OK, I'll look at the sources and functions and try to decide where to
tmpfile(), where to wrap mkstemp();
-> What I think would be best, then, is for INN to provide both mkstemp and
-> tmpfile implementations, with AC_REPLACE_FUNC(), for platforms that don't
-> have them, and then to convert all uses of temporary files anywhere in
-> INN to using either mkstemp or tmpfile as appropriate. If there are
-> enough places that need a FILE * and need to know the name (which I don't
-> expect), we may want to write a regular function that uses mkstemp under
-> the hood to perform that operation and factor out that common code.
--
Matus "fantomas" Uhlar, sysadmin at NEXTRA, Slovakia; IRCNET admin of *.sk
uhlar at fantomas.sk ; http://www.fantomas.sk/ ; http://www.nextra.sk/
WinError #99999: Out of error messages.
More information about the inn-workers
mailing list