From: Luke Howard Date: Mon, 27 Sep 2010 12:36:26 +0000 (+0200) Subject: more tolerant mechlist parsing X-Git-Url: http://www.project-moonshot.org/gitweb/?p=cyrus-sasl.git;a=commitdiff_plain;h=fafb4f53715f684161c8ea3fb9957d285638fda4 more tolerant mechlist parsing --- diff --git a/lib/client.c b/lib/client.c index 310977c..854d9ab 100644 --- a/lib/client.c +++ b/lib/client.c @@ -419,9 +419,18 @@ _sasl_client_order_mechs(const sasl_utils_t *utils, if (list == NULL) return SASL_NOMEM; + /* xxx confirm this with rfc 2222 + * SASL mechanism allowable characters are "AZaz-_" + * seperators can be any other characters and of any length + * even variable lengths between + * + * Apps should be encouraged to simply use space or comma space + * though + */ +#define ismechchar(c) (isalnum((c)) || (c) == '_' || (c) == '-') do { for (start = p = mechs, i = 0; *p != '\0'; p++) { - if (isspace(*p) || p[1] == '\0') { + if (!ismechchar(*p) || p[1] == '\0') { size_t len = p - start; if (p[1] == '\0') @@ -465,14 +474,6 @@ _sasl_client_order_mechs(const sasl_utils_t *utils, * SASL_INTERACT -- user interaction needed to fill in prompt_need list */ -/* xxx confirm this with rfc 2222 - * SASL mechanism allowable characters are "AZaz-_" - * seperators can be any other characters and of any length - * even variable lengths between - * - * Apps should be encouraged to simply use space or comma space - * though - */ int sasl_client_start(sasl_conn_t *conn, const char *mechlist, sasl_interact_t **prompt_need,