#263 Temporary filenames in amavis-milter

open
Lars Hecking
None
5
2002-10-16
2002-10-16
Anonymous
No

Submitter: Anne Bennett <anne@alcor.concordia.ca>
Version: snapshot-20020531

(1)
At line 198 in the original amavis-milter.c, you have:

stt = strchr(dirname, '-') + 1;

I suspect you meant:

stt = strrchr(dirname, '-') + 1;
^
to strip after the *last* dash, not the *first* one.

Using that method to generate temporary directory
names,
I was getting /blah/blah/amavis-NNNNNNNN, instead of
/blah/blah/amavis-milter-NNNNNNNN, as expected from
the TEMPLATE. I suspect that if there had been a dash
in the runtime directory path, something rather
unexpected
would have happened. The fix is in the patch below.

(2)
We found that mktemp did not give good results on our
very busy AlphaServer (running Tru64Unix): we kept
getting conflicting filenames. However, just setting
HAVE_MKTEMP to 0, and therefore using lrand48() to
generate a unique number, was not good either, since,
it
seems, the pseudo-random number generator had not been
seeded. We ended up using "tempnam". I append a patch
to amavis-milter.c which uses tempnam() if HAVE_TEMPNAM
is defined; I don't know how to change "configure" to
set
HAVE_TEMPNAM when appropriate.

--
Anne

Discussion

  • patch to amavis-milter.c for better temp dir creation in some cases

     
    Attachments
    TMP
  • Lars Hecking
    Lars Hecking
    2002-10-16

    Logged In: YES
    user_id=28904

    (1) well spotted!

    (2) hhm. need to look at this in detail.

     
  • Lars Hecking
    Lars Hecking
    2002-10-16

    • assigned_to: nobody --> lhecking