(parse822_phrase): Allow for dots in non-quoted personal phrase.
Showing
1 changed file
with
29 additions
and
2 deletions
... | @@ -617,6 +617,33 @@ parse822_word (const char **p, const char *e, char **word) | ... | @@ -617,6 +617,33 @@ parse822_word (const char **p, const char *e, char **word) |
617 | return EPARSE; | 617 | return EPARSE; |
618 | } | 618 | } |
619 | 619 | ||
620 | /* rfc822 says: | ||
621 | The local-part of an addr-spec in a mailbox specification | ||
622 | (i.e., the host's name for the mailbox) is understood to be | ||
623 | whatever the receiving mail protocol server allows. For exam- | ||
624 | ple, some systems do not understand mailbox references of the | ||
625 | form "P. D. Q. Bach", but others do. | ||
626 | |||
627 | This specification treats periods (".") as lexical separators. | ||
628 | Hence, their presence in local-parts which are not quoted- | ||
629 | strings, is detected. However, such occurrences carry NO | ||
630 | semantics. That is, if a local-part has periods within it, an | ||
631 | address parser will divide the local-part into several tokens, | ||
632 | but the sequence of tokens will be treated as one uninter- | ||
633 | preted unit. The sequence will be re-assembled, when the | ||
634 | address is passed outside of the system such as to a mail pro- | ||
635 | tocol service. | ||
636 | */ | ||
637 | |||
638 | int | ||
639 | parse822_word_dot (const char **p, const char *e, char **word) | ||
640 | { | ||
641 | int rc = parse822_word (p, e, word); | ||
642 | for (;rc == 0 && (*p != e) && **p == '.'; ++*p) | ||
643 | rc = str_append (word, "."); | ||
644 | return rc; | ||
645 | } | ||
646 | |||
620 | int | 647 | int |
621 | parse822_phrase (const char **p, const char *e, char **phrase) | 648 | parse822_phrase (const char **p, const char *e, char **phrase) |
622 | { | 649 | { |
... | @@ -625,14 +652,14 @@ parse822_phrase (const char **p, const char *e, char **phrase) | ... | @@ -625,14 +652,14 @@ parse822_phrase (const char **p, const char *e, char **phrase) |
625 | const char *save = *p; | 652 | const char *save = *p; |
626 | int rc; | 653 | int rc; |
627 | 654 | ||
628 | if ((rc = parse822_word (p, e, phrase))) | 655 | if ((rc = parse822_word_dot (p, e, phrase))) |
629 | return rc; | 656 | return rc; |
630 | 657 | ||
631 | /* ok, got the 1 word, now append all the others we can */ | 658 | /* ok, got the 1 word, now append all the others we can */ |
632 | { | 659 | { |
633 | char *word = 0; | 660 | char *word = 0; |
634 | 661 | ||
635 | while ((rc = parse822_word (p, e, &word)) == EOK) | 662 | while ((rc = parse822_word_dot (p, e, &word)) == EOK) |
636 | { | 663 | { |
637 | rc = str_append_char (phrase, ' '); | 664 | rc = str_append_char (phrase, ' '); |
638 | 665 | ... | ... |
-
Please register or sign in to post a comment