Fix full name support, thanks zandbelt (#1578)
[openwrt/svn-archive/archive.git] / net / mini_sendmail / patches / 200-fullname.patch
1 --- mini_sendmail-1.3.5.org/mini_sendmail.c 2003-11-17 03:03:35.000000000 +0100
2 +++ mini_sendmail-1.3.5/mini_sendmail.c 2007-04-08 19:46:42.000000000 +0200
3 @@ -539,6 +539,7 @@
4 }
5
6 /* Strip off any angle brackets. */
7 +/*
8 while ( len > 0 && *recipient == '<' )
9 {
10 ++recipient;
11 @@ -548,6 +549,23 @@
12 --len;
13
14 (void) snprintf( buf, sizeof(buf), "RCPT TO:<%.*s>", len, recipient );
15 +*/
16 + if (len > 0 && recipient[len-1] == '>' )
17 + {
18 + /* "<name@domain>" or: "Full Name <name@domain>" */
19 + while (len > 0 && *recipient != '<' )
20 + {
21 + ++recipient;
22 + --len;
23 + }
24 + (void) snprintf( buf, sizeof(buf), "RCPT TO:%.*s", len, recipient );
25 + }
26 + else
27 + {
28 + /* name@domain */
29 + (void) snprintf( buf, sizeof(buf), "RCPT TO:<%.*s>", len, recipient );
30 + }
31 +
32 send_command( buf );
33 status = read_response();
34 if ( status != 250 && status != 251 )