Rev 29 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 29 | Rev 40 | ||
|---|---|---|---|
| Line 19... | Line 19... | ||
| 19 | cp = strrchr(from, '@'); |
19 | cp = strrchr(from, '@'); |
| 20 | if (cp && (cp != from)) {
|
20 | if (cp && (cp != from)) {
|
| 21 | sr->env_from = strdup(from); |
21 | sr->env_from = strdup(from); |
| 22 | - sr->env_from_lp = strdup(from); /* Too long, but simple */ |
22 | - sr->env_from_lp = strdup(from); /* Too long, but simple */ |
| 23 | - sr->env_from_lp[(cp - from)] = '\0'; |
23 | - sr->env_from_lp[(cp - from)] = '\0'; |
| 24 | + *cp = '\0'; |
24 | + sr->env_from[cp - from] = '\0'; |
| 25 | + sr->env_from_lp = strdup(from); |
25 | + sr->env_from_lp = strdup(sr->env_from); |
| 26 | sr->env_from_dp = strdup(cp + 1); |
26 | sr->env_from_dp = strdup(cp + 1); |
| 27 | + *cp = '@'; |
27 | + sr->env_from[cp - from] = '@'; |
| 28 | } |
28 | } |
| 29 | else {
|
29 | else {
|
| 30 | + if (cp == from) from++; /* "@domain.example" */ |
30 | + if (cp == from) from++; /* "@domain.example" */ |
| 31 | len = sizeof("postmaster@") + strlen(from);
|
31 | len = sizeof("postmaster@") + strlen(from);
|
| 32 | sr->env_from = malloc(len + 1); /* sizeof("") == 1? */
|
32 | sr->env_from = malloc(len + 1); /* sizeof("") == 1? */
|