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