summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d488849)
raw | patch | inline | side by side (parent: d488849)
author | Sebastian Harl <sh@tokkee.org> | |
Sat, 2 Aug 2014 18:20:16 +0000 (20:20 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Sat, 2 Aug 2014 18:20:16 +0000 (20:20 +0200) |
Now that the code is no longer internal-only, we'll have to be a bit careful
about what the users passes in.
about what the users passes in.
src/frontend/query.c | patch | blob | history |
diff --git a/src/frontend/query.c b/src/frontend/query.c
index 585222d25a56fbe971b57c6655df9a7f5e5b9565..50f0fed6bb4997856e8692e2a994ab185ee94734 100644 (file)
--- a/src/frontend/query.c
+++ b/src/frontend/query.c
sdb_conn_node_t *node = NULL;
int status = 0;
+ if ((! conn) || (conn->cmd != CONNECTION_QUERY))
+ return -1;
+
parsetree = sdb_fe_parse(sdb_strbuf_string(conn->buf),
(int)conn->cmd_len);
if (! parsetree) {
sdb_fe_fetch(sdb_conn_t *conn)
{
char hostname[conn->cmd_len + 1];
+ if ((! conn) || (conn->cmd != CONNECTION_FETCH))
+ return -1;
strncpy(hostname, sdb_strbuf_string(conn->buf), conn->cmd_len);
hostname[sizeof(hostname) - 1] = '\0';
return sdb_fe_exec_fetch(conn, hostname, /* filter = */ NULL);
int
sdb_fe_list(sdb_conn_t *conn)
{
+ if ((! conn) || (conn->cmd != CONNECTION_LIST))
+ return -1;
return sdb_fe_exec_list(conn, /* filter = */ NULL);
} /* sdb_fe_list */
sdb_store_matcher_t *m;
int status;
+ if ((! conn) || (conn->cmd != CONNECTION_LOOKUP))
+ return -1;
+
m = sdb_fe_parse_matcher(sdb_strbuf_string(conn->buf),
(int)conn->cmd_len);
if (! m) {