]> www.infradead.org Git - users/dwmw2/openconnect.git/commit
Clean up dodgy query-string building in gpst.c
authorDaniel Lenski <dlenski@gmail.com>
Tue, 9 Jan 2018 08:01:17 +0000 (00:01 -0800)
committerDavid Woodhouse <dwmw2@infradead.org>
Tue, 27 Feb 2018 15:28:32 +0000 (16:28 +0100)
commit625165cf0b1669ed2135bdd010f7dbe973d6f815
treecb09f44366c4895e4cbcd52b5862cf3c9aa5c0d8
parent11fb585a320cbeb527e3e36c7b8594a216a1dc9e
Clean up dodgy query-string building in gpst.c

This function helps a lot:

    static int filter_opts(struct oc_text_buf *buf, const char *query, const char *incexc, int include)

It takes a URL query string and a comma-separated list of fields to include
or exclude, and copies fields into the buffer, e.g.

    /* include=1: copy only the named fields into the buffer */
    filter_opts(buf, vpninfo->cookie, "user,authcookie", 1);

    /* include=0: copy all fields except the named ones into the buffer */
    filter_opts(buf, vpninfo->cookie, "authcookie,junk", 0);

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
gpst.c