masqmail-0.2

annotate tests/localhost-stdin/test @ 72:ad034b57f3b2

fixed Debian bug 536060 (log files are closed after SIGHUP receival) Explanation: When run in daemon mode, first the log files are opened. They get assigned to the file descriptors 3 and 4 usually. Then std{in,out,err} are closed. When SIGHUP comes in, all open files are closes and masqmail reexecutes itself. The new masqmail instance opens the log files at fd 0 and 1 now, but std{in,out,err} are closed afterwards, thus the log files are closed. The fix is to close the log files before std{in,out,err} are closed, in case the log files have higher fds. After std{in,out,err} were closed, the log files get opened again, now. See also: http://bugs.debian.org/536060
author meillo@marmaro.de
date Wed, 16 Jun 2010 10:32:20 +0200
parents 49ca781e1503
children
rev   line source
meillo@64 1 #!/bin/sh
meillo@0 2
meillo@64 3 # path to the masqmail executable
meillo@63 4 mm_bin=../../src/masqmail
meillo@0 5
meillo@64 6
meillo@63 7 hfrom="\"Fritz Meier\" <`logname`@localhost>"
meillo@0 8 hto=$hfrom
meillo@63 9 to=`logname`@localhost
meillo@64 10 hsubject="Masqmail test: localhost-stdin"
meillo@0 11
meillo@64 12
meillo@0 13 # Testing with rcpt on cmd line
meillo@0 14 # (dot does end)
meillo@0 15 #
meillo@0 16 # the command to be run:
meillo@0 17 cmd="$mm_bin -C ./test.conf $to"
meillo@0 18
meillo@0 19 $cmd <<EOF
meillo@0 20 From: $hfrom
meillo@0 21 To: $hto
meillo@0 22 Subject: $hsubject
meillo@0 23
meillo@0 24 Hallo Fritz!
meillo@0 25 ..
meillo@0 26 there is a dot above (Yes, one and not two).
meillo@0 27
meillo@0 28 command was: $cmd
meillo@0 29
meillo@0 30 Fritz
meillo@0 31 .
meillo@0 32
meillo@0 33 EOF
meillo@0 34
meillo@64 35
meillo@0 36 # Testing with rcpt on cmd line with -oi option
meillo@0 37 # (dot does not end)
meillo@0 38 #
meillo@0 39 # the command to be run:
meillo@0 40 cmd="$mm_bin -C ./test.conf -oi $to"
meillo@0 41
meillo@0 42 $cmd <<EOF
meillo@0 43 From: $hfrom
meillo@0 44 To: $hto
meillo@0 45 Subject: $hsubject
meillo@0 46
meillo@0 47 Hallo Fritz!
meillo@0 48 .
meillo@0 49 there is a dot above.
meillo@0 50
meillo@0 51 command was: $cmd
meillo@0 52
meillo@0 53 Fritz
meillo@0 54
meillo@0 55 EOF
meillo@0 56
meillo@64 57
meillo@0 58 # Testing with rcpt read from headers (-t option)
meillo@0 59 # (dot does end)
meillo@0 60 #
meillo@0 61 # the command to be run:
meillo@0 62 cmd="$mm_bin -C ./test.conf -t"
meillo@0 63
meillo@0 64 $cmd <<EOF
meillo@0 65 From: $hfrom
meillo@0 66 To: $hto
meillo@0 67 Subject: $hsubject
meillo@0 68
meillo@0 69 Hallo Fritz!
meillo@0 70 ..
meillo@0 71 there is a dot above.
meillo@0 72
meillo@0 73 command was: $cmd
meillo@0 74
meillo@0 75 Fritz
meillo@0 76 .
meillo@0 77
meillo@0 78 EOF