From: Marko Kreen Date: Thu, 9 Sep 2010 11:10:31 +0000 (+0000) Subject: Fix the quoting fix. X-Git-Tag: pgbouncer_1_4_rc3~50 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dcf37ccde5ae6780d629121912e76e9e8f49fbd9;p=pgbouncer Fix the quoting fix. If we treat "" as special, we need to know whether we are in quoted string or not. Otherwise empty field ("") throws the parser off. --- diff --git a/src/loader.c b/src/loader.c index 0960d0f..0f8ce67 100644 --- a/src/loader.c +++ b/src/loader.c @@ -391,12 +391,12 @@ void parse_database(char *name, char *connstr) */ /* find next " in string, skipping escaped ones */ -static char *find_quote(char *p) +static char *find_quote(char *p, bool start) { loop: while (*p && *p != '"') p++; - if (p[0] == '"' && p[1] == '"') { + if (p[0] == '"' && p[1] == '"' && !start) { p += 2; goto loop; } @@ -502,7 +502,7 @@ bool load_auth_file(const char *fn) break; } user = ++p; - p = find_quote(p); + p = find_quote(p, false); if (*p != '"') { log_error("broken auth file"); break; @@ -514,13 +514,13 @@ bool load_auth_file(const char *fn) *p++ = 0; /* tag username end */ /* get password */ - p = find_quote(p); + p = find_quote(p, true); if (*p != '"') { log_error("broken auth file"); break; } password = ++p; - p = find_quote(p); + p = find_quote(p, false); if (*p != '"') { log_error("broken auth file"); break;