Commit 62ec9eff 62ec9eff1a5b226e85d824bc15d73bde75c5b8dd by Sergey Poznyakoff

(imap4d_append0): Skip leading whitespace.

1 parent da88ef54
...@@ -26,14 +26,14 @@ imap4d_append (struct imap4d_command *command, char *arg) ...@@ -26,14 +26,14 @@ imap4d_append (struct imap4d_command *command, char *arg)
26 int flags = 0; 26 int flags = 0;
27 mailbox_t dest_mbox = NULL; 27 mailbox_t dest_mbox = NULL;
28 int status; 28 int status;
29 29
30 mboxname = util_getword (arg, &sp); 30 mboxname = util_getword (arg, &sp);
31 if (!mboxname) 31 if (!mboxname)
32 return util_finish (command, RESP_BAD, "Too few arguments"); 32 return util_finish (command, RESP_BAD, "Too few arguments");
33 33
34 if (*sp == '(' && util_parse_attributes (sp+1, &sp, &flags)) 34 if (*sp == '(' && util_parse_attributes (sp+1, &sp, &flags))
35 return util_finish (command, RESP_BAD, "Missing closing parenthesis"); 35 return util_finish (command, RESP_BAD, "Missing closing parenthesis");
36 36
37 mboxname = namespace_getfullpath (mboxname, "/"); 37 mboxname = namespace_getfullpath (mboxname, "/");
38 if (!mboxname) 38 if (!mboxname)
39 return util_finish (command, RESP_NO, "Couldn't open mailbox"); 39 return util_finish (command, RESP_NO, "Couldn't open mailbox");
...@@ -69,7 +69,7 @@ imap4d_append0 (mailbox_t mbox, int flags, char *text) ...@@ -69,7 +69,7 @@ imap4d_append0 (mailbox_t mbox, int flags, char *text)
69 struct tm *tm; 69 struct tm *tm;
70 time_t t; 70 time_t t;
71 char date[80]; 71 char date[80];
72 72
73 if (mailbox_create (&tmp, "/dev/null")) 73 if (mailbox_create (&tmp, "/dev/null"))
74 return 1; 74 return 1;
75 if (mailbox_open (tmp, MU_STREAM_READ) != 0) 75 if (mailbox_open (tmp, MU_STREAM_READ) != 0)
...@@ -82,6 +82,9 @@ imap4d_append0 (mailbox_t mbox, int flags, char *text) ...@@ -82,6 +82,9 @@ imap4d_append0 (mailbox_t mbox, int flags, char *text)
82 return 1; 82 return 1;
83 } 83 }
84 84
85 while (*text && isspace (*text))
86 text++;
87
85 /* If a date_time is specified, the internal date SHOULD be set in the 88 /* If a date_time is specified, the internal date SHOULD be set in the
86 resulting message; otherwise, the internal date of the resulting 89 resulting message; otherwise, the internal date of the resulting
87 message is set to the current date and time by default. */ 90 message is set to the current date and time by default. */
...@@ -126,4 +129,3 @@ imap4d_append0 (mailbox_t mbox, int flags, char *text) ...@@ -126,4 +129,3 @@ imap4d_append0 (mailbox_t mbox, int flags, char *text)
126 return rc; 129 return rc;
127 } 130 }
128 131
129
......