Code

frontend: Let the parser not accept other grammars in default mode.
[sysdb.git] / src / frontend / connection.c
index 4ba12dcdd568cf0449c45de60b3984607e5ce17d..fdbb26fe60518a0b1834d4c809a3f27915f54d74 100644 (file)
@@ -206,7 +206,7 @@ sdb_conn_get_ctx(void)
  * Send a log message originating from the current thread to the client.
  */
 static int
-connection_log(int __attribute__((unused)) prio, const char *msg,
+connection_log(int prio, const char *msg,
                sdb_object_t __attribute__((unused)) *user_data)
 {
        sdb_conn_t *conn;
@@ -217,6 +217,10 @@ connection_log(int __attribute__((unused)) prio, const char *msg,
        if ((! conn) || (! conn->username))
                return 0;
 
+       /* XXX: make the log-level configurable by the client at runtime */
+       if (prio >= SDB_LOG_DEBUG)
+               return 0;
+
        /* TODO: Use CONNECTION_LOG_<prio>? */
        if (sdb_connection_send(conn, CONNECTION_LOG,
                                (uint32_t)strlen(msg), msg) < 0)
@@ -297,8 +301,10 @@ command_handle(sdb_conn_t *conn)
                                        node = SDB_CONN_NODE(sdb_llist_get(parsetree, 0));
                        }
 
-                       if (node)
+                       if (node) {
                                status = sdb_fe_exec(conn, node);
+                               sdb_object_deref(SDB_OBJ(node));
+                       }
 
                        sdb_llist_destroy(parsetree);
                        break;