Commit fa0ce32f fa0ce32f10ff996d529a883a9e5f83a59ffe4fc5 by Sergey Poznyakoff

(imap_string): Return 1 if the input is not a quoted string.

(imap_list): Ignore NIL delimiters, correctly handle
strings, not enclosed in doublequotes.
1 parent 0bc515ae
...@@ -1103,6 +1103,7 @@ imap_string (f_imap_t f_imap, char **ptr) ...@@ -1103,6 +1103,7 @@ imap_string (f_imap_t f_imap, char **ptr)
1103 break; 1103 break;
1104 default: 1104 default:
1105 /* Problem. */ 1105 /* Problem. */
1106 status = 1;
1106 break; 1107 break;
1107 } 1108 }
1108 return status; 1109 return status;
...@@ -1168,7 +1169,7 @@ imap_list (f_imap_t f_imap) ...@@ -1168,7 +1169,7 @@ imap_list (f_imap_t f_imap)
1168 } 1169 }
1169 /* Hiearchy delimeter. */ 1170 /* Hiearchy delimeter. */
1170 tok = strtok_r (NULL, " ", &sp); 1171 tok = strtok_r (NULL, " ", &sp);
1171 if (tok && strlen (tok) > 2) 1172 if (tok && strlen (tok) > 2 && strcasecmp (tok, "NIL"))
1172 lr->separator = tok[1]; 1173 lr->separator = tok[1];
1173 /* The path. */ 1174 /* The path. */
1174 tok = strtok_r (NULL, " ", &sp); 1175 tok = strtok_r (NULL, " ", &sp);
...@@ -1201,7 +1202,12 @@ imap_list (f_imap_t f_imap) ...@@ -1201,7 +1202,12 @@ imap_list (f_imap_t f_imap)
1201 stream_truncate (f_imap->string.stream, 0); 1202 stream_truncate (f_imap->string.stream, 0);
1202 f_imap->string.offset = 0; 1203 f_imap->string.offset = 0;
1203 f_imap->string.nleft = 0; 1204 f_imap->string.nleft = 0;
1204 1205 }
1206 else
1207 {
1208 lr->name = strdup (tok);
1209 if (!lr->name)
1210 status = ENOMEM;
1205 } 1211 }
1206 } 1212 }
1207 return status; 1213 return status;
......