Rev 9 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9 | Rev 24 | ||
---|---|---|---|
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 Holmgren <magnus@kibibyte.se> |
3 | ## |
3 | ## |
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 |
4 | ## 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 |
5 | ## DP: string (i.e. a DSN), use the HELO identity. Also fix incorrect |
7 | ## DP: the local part is empty (but the "@" is present). |
6 | ## DP: handling when the local part is empty (but the "@" is present). |
8 | 7 | ||
9 | @DPATCH@ |
8 | @DPATCH@ |
10 | diff -urNad trunk~/src/libspf2/spf_request.c trunk/src/libspf2/spf_request.c |
9 | 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 |
10 | --- 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 |
11 | +++ trunk/src/libspf2/spf_request.c 2007-07-30 21:58:48.000000000 +0200 |
13 | @@ -142,14 +142,19 @@ |
12 | @@ -142,14 +142,19 @@ |
14 | SPF_FREE(sr->env_from_lp); |
13 | SPF_FREE(sr->env_from_lp); |
15 | SPF_FREE(sr->env_from_dp); |
14 | SPF_FREE(sr->env_from_dp); |
16 | 15 | ||
17 | + if (*from == '\0' && sr->helo_dom != NULL) { |
16 | + if (*from == '\0' && sr->helo_dom != NULL) { |
18 | + from = sr->helo_dom; |
17 | + from = sr->helo_dom; |
19 | + } |
18 | + } |
20 | cp = strrchr(from, '@'); |
19 | cp = strrchr(from, '@'); |
21 | if (cp && (cp != from)) { |
20 | if (cp && (cp != from)) { |
22 | sr->env_from = strdup(from); |
21 | sr->env_from = strdup(from); |
23 | - sr->env_from_lp = strdup(from); /* Too long, but simple */ |
22 | - sr->env_from_lp = strdup(from); /* Too long, but simple */ |
24 | - sr->env_from_lp[(cp - from)] = '\0'; |
23 | - sr->env_from_lp[(cp - from)] = '\0'; |
25 | + *cp = '\0'; |
24 | + *cp = '\0'; |
26 | + sr->env_from_lp = strdup(from); |
25 | + sr->env_from_lp = strdup(from); |
27 | sr->env_from_dp = strdup(cp + 1); |
26 | sr->env_from_dp = strdup(cp + 1); |
28 | + *cp = '@'; |
27 | + *cp = '@'; |
29 | } |
28 | } |
30 | else { |
29 | else { |
31 | + if (cp == from) from++; /* "@domain.example" */ |
30 | + if (cp == from) from++; /* "@domain.example" */ |
32 | len = sizeof("postmaster@") + strlen(from); |
31 | len = sizeof("postmaster@") + strlen(from); |
33 | sr->env_from = malloc(len + 1); /* sizeof("") == 1? */ |
32 | sr->env_from = malloc(len + 1); /* sizeof("") == 1? */ |
34 | sprintf(sr->env_from, "postmaster@%s", from); |
33 | sprintf(sr->env_from, "postmaster@%s", from); |