Fossil SCM
Allow + signs in email addresses. Added a comment to link to a source giving the true limit on legal characters in email addresses, which are currently far less restrictive than our newly-expanded limits.
Commit
1bfd790352f944f131805e938251c5477b9202801be54a08f81fdeecb11f6f49
Parent
4c7edd4cfd252ec…
1 file changed
+6
-2
+6
-2
| --- src/email.c | ||
| +++ src/email.c | ||
| @@ -1153,21 +1153,25 @@ | ||
| 1153 | 1153 | *pzErr = 0; |
| 1154 | 1154 | |
| 1155 | 1155 | /* Check the validity of the email address. |
| 1156 | 1156 | ** |
| 1157 | 1157 | ** (1) Exactly one '@' character. |
| 1158 | - ** (2) No other characters besides [a-zA-Z0-9._-] | |
| 1158 | + ** (2) No other characters besides [a-zA-Z0-9._+-] | |
| 1159 | + ** | |
| 1160 | + ** The local part is currently more restrictive than RFC 5322 allows: | |
| 1161 | + ** https://stackoverflow.com/a/2049510/142454 We will expand this as | |
| 1162 | + ** necessary. | |
| 1159 | 1163 | */ |
| 1160 | 1164 | zEAddr = P("e"); |
| 1161 | 1165 | if( zEAddr==0 ) return 0; |
| 1162 | 1166 | for(i=j=n=0; (c = zEAddr[i])!=0; i++){ |
| 1163 | 1167 | if( c=='@' ){ |
| 1164 | 1168 | n = i; |
| 1165 | 1169 | j++; |
| 1166 | 1170 | continue; |
| 1167 | 1171 | } |
| 1168 | - if( !fossil_isalnum(c) && c!='.' && c!='_' && c!='-' ){ | |
| 1172 | + if( !fossil_isalnum(c) && c!='.' && c!='_' && c!='-' && c!='+' ){ | |
| 1169 | 1173 | *peErr = 1; |
| 1170 | 1174 | *pzErr = mprintf("illegal character in email address: 0x%x '%c'", |
| 1171 | 1175 | c, c); |
| 1172 | 1176 | return 0; |
| 1173 | 1177 | } |
| 1174 | 1178 |
| --- src/email.c | |
| +++ src/email.c | |
| @@ -1153,21 +1153,25 @@ | |
| 1153 | *pzErr = 0; |
| 1154 | |
| 1155 | /* Check the validity of the email address. |
| 1156 | ** |
| 1157 | ** (1) Exactly one '@' character. |
| 1158 | ** (2) No other characters besides [a-zA-Z0-9._-] |
| 1159 | */ |
| 1160 | zEAddr = P("e"); |
| 1161 | if( zEAddr==0 ) return 0; |
| 1162 | for(i=j=n=0; (c = zEAddr[i])!=0; i++){ |
| 1163 | if( c=='@' ){ |
| 1164 | n = i; |
| 1165 | j++; |
| 1166 | continue; |
| 1167 | } |
| 1168 | if( !fossil_isalnum(c) && c!='.' && c!='_' && c!='-' ){ |
| 1169 | *peErr = 1; |
| 1170 | *pzErr = mprintf("illegal character in email address: 0x%x '%c'", |
| 1171 | c, c); |
| 1172 | return 0; |
| 1173 | } |
| 1174 |
| --- src/email.c | |
| +++ src/email.c | |
| @@ -1153,21 +1153,25 @@ | |
| 1153 | *pzErr = 0; |
| 1154 | |
| 1155 | /* Check the validity of the email address. |
| 1156 | ** |
| 1157 | ** (1) Exactly one '@' character. |
| 1158 | ** (2) No other characters besides [a-zA-Z0-9._+-] |
| 1159 | ** |
| 1160 | ** The local part is currently more restrictive than RFC 5322 allows: |
| 1161 | ** https://stackoverflow.com/a/2049510/142454 We will expand this as |
| 1162 | ** necessary. |
| 1163 | */ |
| 1164 | zEAddr = P("e"); |
| 1165 | if( zEAddr==0 ) return 0; |
| 1166 | for(i=j=n=0; (c = zEAddr[i])!=0; i++){ |
| 1167 | if( c=='@' ){ |
| 1168 | n = i; |
| 1169 | j++; |
| 1170 | continue; |
| 1171 | } |
| 1172 | if( !fossil_isalnum(c) && c!='.' && c!='_' && c!='-' && c!='+' ){ |
| 1173 | *peErr = 1; |
| 1174 | *pzErr = mprintf("illegal character in email address: 0x%x '%c'", |
| 1175 | c, c); |
| 1176 | return 0; |
| 1177 | } |
| 1178 |