Rev 24 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
24 | magnus | 1 | #!/bin/sh /usr/share/dpatch/dpatch-run |
2 | ## 42_empty_sender.dpatch by Magnus Holmgren <magnus@kibibyte.se> |
||
9 | magnus | 3 | ## |
4 | ## DP: If SPF_request_set_env_from() is called with from set to the empty |
||
24 | magnus | 5 | ## DP: string (i.e. a DSN), use the HELO identity. Also fix incorrect |
6 | ## DP: handling when the local part is empty (but the "@" is present). |
||
9 | magnus | 7 | |
8 | @DPATCH@ |
||
9 | diff -urNad trunk~/src/libspf2/spf_request.c trunk/src/libspf2/spf_request.c |
||
10 | --- trunk~/src/libspf2/spf_request.c 2005-02-22 03:38:57.000000000 +0100 |
||
11 | +++ trunk/src/libspf2/spf_request.c 2007-07-30 21:58:48.000000000 +0200 |
||
12 | @@ -142,14 +142,19 @@ |
||
13 | SPF_FREE(sr->env_from_lp); |
||
14 | SPF_FREE(sr->env_from_dp); |
||
15 | |||
16 | + if (*from == '\0' && sr->helo_dom != NULL) { |
||
17 | + from = sr->helo_dom; |
||
18 | + } |
||
19 | cp = strrchr(from, '@'); |
||
20 | if (cp && (cp != from)) { |
||
21 | sr->env_from = strdup(from); |
||
22 | - sr->env_from_lp = strdup(from); /* Too long, but simple */ |
||
23 | - sr->env_from_lp[(cp - from)] = '\0'; |
||
24 | + *cp = '\0'; |
||
25 | + sr->env_from_lp = strdup(from); |
||
26 | sr->env_from_dp = strdup(cp + 1); |
||
27 | + *cp = '@'; |
||
28 | } |
||
29 | else { |
||
30 | + if (cp == from) from++; /* "@domain.example" */ |
||
31 | len = sizeof("postmaster@") + strlen(from); |
||
32 | sr->env_from = malloc(len + 1); /* sizeof("") == 1? */ |
||
33 | sprintf(sr->env_from, "postmaster@%s", from); |