diff options
| author | manuel <manuel@mausz.at> | 2013-02-04 02:43:52 +0100 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2013-02-04 02:43:52 +0100 |
| commit | 86d5a6ec30ceea44e9459394d2e6403642cdd158 (patch) | |
| tree | 888d8fc9fdc2978bf60056ac95b0fa3271b86745 /sendmail.c | |
| parent | 6633e04e6ec23399fb2e2ecec3d1b34a7aa758d0 (diff) | |
| download | qmail-86d5a6ec30ceea44e9459394d2e6403642cdd158.tar.gz qmail-86d5a6ec30ceea44e9459394d2e6403642cdd158.tar.bz2 qmail-86d5a6ec30ceea44e9459394d2e6403642cdd158.zip | |
[PATCH] make the qmail 'sendmail' binary behave like sendmail's for -f
sendmail-flagf
Diffstat (limited to 'sendmail.c')
| -rw-r--r-- | sendmail.c | 33 |
1 files changed, 33 insertions, 0 deletions
| @@ -45,6 +45,38 @@ void mailq() | |||
| 45 | _exit(111); | 45 | _exit(111); |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | void do_sender(s) | ||
| 49 | const char *s; | ||
| 50 | { | ||
| 51 | char *x; | ||
| 52 | int n; | ||
| 53 | int a; | ||
| 54 | int i; | ||
| 55 | |||
| 56 | env_unset("QMAILNAME"); | ||
| 57 | env_unset("MAILNAME"); | ||
| 58 | env_unset("NAME"); | ||
| 59 | env_unset("QMAILHOST"); | ||
| 60 | env_unset("MAILHOST"); | ||
| 61 | |||
| 62 | n = str_len(s); | ||
| 63 | a = str_rchr(s, '@'); | ||
| 64 | if (a == n) | ||
| 65 | { | ||
| 66 | env_put2("QMAILUSER", s); | ||
| 67 | return; | ||
| 68 | } | ||
| 69 | env_put2("QMAILHOST", s + a + 1); | ||
| 70 | |||
| 71 | x = (char *) alloc((a + 1) * sizeof(char)); | ||
| 72 | if (!x) nomem(); | ||
| 73 | for (i = 0; i < a; i++) | ||
| 74 | x[i] = s[i]; | ||
| 75 | x[i] = 0; | ||
| 76 | env_put2("QMAILUSER", x); | ||
| 77 | alloc_free(x); | ||
| 78 | } | ||
| 79 | |||
| 48 | int flagh; | 80 | int flagh; |
| 49 | char *sender; | 81 | char *sender; |
| 50 | 82 | ||
| @@ -118,6 +150,7 @@ char **argv; | |||
| 118 | if (sender) { | 150 | if (sender) { |
| 119 | *arg++ = "-f"; | 151 | *arg++ = "-f"; |
| 120 | *arg++ = sender; | 152 | *arg++ = sender; |
| 153 | do_sender(sender); | ||
| 121 | } | 154 | } |
| 122 | *arg++ = "--"; | 155 | *arg++ = "--"; |
| 123 | for (i = 0;i < argc;++i) *arg++ = argv[i]; | 156 | for (i = 0;i < argc;++i) *arg++ = argv[i]; |
