]> granicus.if.org Git - pgbouncer/commitdiff
sanity check before trying to set parameters
authorMarko Kreen <markokr@gmail.com>
Thu, 18 Oct 2007 12:19:11 +0000 (12:19 +0000)
committerMarko Kreen <markokr@gmail.com>
Thu, 18 Oct 2007 12:19:11 +0000 (12:19 +0000)
src/varcache.c

index 7ba2175fb34d61a707d28ff90b7fb15541f3aee8..acf6001996a85ae87268faf30808bf829f1e7392 100644 (file)
@@ -106,10 +106,19 @@ static int apply_var(PktBuf *pkt, const char *key,
        if (strcasecmp(cval, sval) == 0)
                return 0;
 
+       /* sanity check */
+       if (!*cval || !*sval) {
+               /* parameters that can change should be always set */
+               log_warning("Parameter unset: key='%s' client='%s' server='%s'",
+                           key, cval, sval);
+               return 0;
+       }
+
        /* the string may have been taken from startup pkt */
        if (!quote_literal(qbuf, sizeof(qbuf), cval, std_quote))
                return 0;
 
+       /* add SET statement to packet */
        len = snprintf(buf, sizeof(buf), "SET %s=%s;", key, qbuf);
        if (len < sizeof(buf)) {
                pktbuf_put_bytes(pkt, buf, len);