Minor fixes

pull/217/head
Victor Julien 12 years ago
parent 6b3ebc810d
commit 0f42f0e890

@ -1430,7 +1430,7 @@ AC_SUBST(e_localstatedir)
AC_DEFINE_UNQUOTED([CONFIG_DIR],["$e_sysconfdir"],[Our CONFIG_DIR]) AC_DEFINE_UNQUOTED([CONFIG_DIR],["$e_sysconfdir"],[Our CONFIG_DIR])
AC_SUBST(e_magic_file) AC_SUBST(e_magic_file)
AC_OUTPUT(Makefile src/Makefile qa/Makefile qa/coccinelle/Makefile rules/Makefile doc/Makefile contrib/Makefile contrib/file_processor/Makefile contrib/file_processor/Action/Makefile contrib/file_processor/Processor/Makefile suricata.yaml scripts/suricatasc/Makefile scripts/suricatasc/suricatasc) AC_OUTPUT(Makefile src/Makefile qa/Makefile qa/coccinelle/Makefile rules/Makefile doc/Makefile contrib/Makefile contrib/file_processor/Makefile contrib/file_processor/Action/Makefile contrib/file_processor/Processor/Makefile suricata.yaml scripts/Makefile scripts/suricatasc/Makefile scripts/suricatasc/suricatasc)
echo " echo "
Suricata Configuration: Suricata Configuration:

@ -580,7 +580,7 @@ TmEcode UnixManagerShutdownCommand(json_t *cmd,
SCEnter(); SCEnter();
json_object_set_new(server_msg, "message", json_string("Closing Suricata")); json_object_set_new(server_msg, "message", json_string("Closing Suricata"));
EngineStop(); EngineStop();
SCReturn(TM_ECODE_OK); SCReturnInt(TM_ECODE_OK);
} }
#if 0 #if 0
@ -630,31 +630,31 @@ TmEcode UnixManagerRegisterCommand(const char * keyword,
if (Func == NULL) { if (Func == NULL) {
SCLogError(SC_ERR_INVALID_ARGUMENT, "Null function"); SCLogError(SC_ERR_INVALID_ARGUMENT, "Null function");
SCReturn(TM_ECODE_FAILED); SCReturnInt(TM_ECODE_FAILED);
} }
if (keyword == NULL) { if (keyword == NULL) {
SCLogError(SC_ERR_INVALID_ARGUMENT, "Null keyword"); SCLogError(SC_ERR_INVALID_ARGUMENT, "Null keyword");
SCReturn(TM_ECODE_FAILED); SCReturnInt(TM_ECODE_FAILED);
} }
TAILQ_FOREACH(lcmd, &command.commands, next) { TAILQ_FOREACH(lcmd, &command.commands, next) {
if (!strcmp(keyword, lcmd->name)) { if (!strcmp(keyword, lcmd->name)) {
SCLogError(SC_ERR_INVALID_ARGUMENT, "Null keyword"); SCLogError(SC_ERR_INVALID_ARGUMENT, "Null keyword");
SCReturn(TM_ECODE_FAILED); SCReturnInt(TM_ECODE_FAILED);
} }
} }
cmd = SCMalloc(sizeof(Command)); cmd = SCMalloc(sizeof(Command));
if (unlikely(cmd == NULL)) { if (unlikely(cmd == NULL)) {
SCLogError(SC_ERR_MEM_ALLOC, "Can't alloc cmd"); SCLogError(SC_ERR_MEM_ALLOC, "Can't alloc cmd");
SCReturn(TM_ECODE_FAILED); SCReturnInt(TM_ECODE_FAILED);
} }
cmd->name = SCStrdup(keyword); cmd->name = SCStrdup(keyword);
if (unlikely(cmd->name == NULL)) { if (unlikely(cmd->name == NULL)) {
SCLogError(SC_ERR_MEM_ALLOC, "Can't alloc cmd name"); SCLogError(SC_ERR_MEM_ALLOC, "Can't alloc cmd name");
SCFree(cmd); SCFree(cmd);
SCReturn(TM_ECODE_FAILED); SCReturnInt(TM_ECODE_FAILED);
} }
cmd->Func = Func; cmd->Func = Func;
cmd->data = data; cmd->data = data;
@ -662,7 +662,7 @@ TmEcode UnixManagerRegisterCommand(const char * keyword,
/* Add it to the list */ /* Add it to the list */
TAILQ_INSERT_TAIL(&command.commands, cmd, next); TAILQ_INSERT_TAIL(&command.commands, cmd, next);
SCReturn(TM_ECODE_OK); SCReturnInt(TM_ECODE_OK);
} }
/** /**
@ -684,20 +684,20 @@ TmEcode UnixManagerRegisterBackgroundTask(
if (Func == NULL) { if (Func == NULL) {
SCLogError(SC_ERR_INVALID_ARGUMENT, "Null function"); SCLogError(SC_ERR_INVALID_ARGUMENT, "Null function");
SCReturn(TM_ECODE_FAILED); SCReturnInt(TM_ECODE_FAILED);
} }
task = SCMalloc(sizeof(Task)); task = SCMalloc(sizeof(Task));
if (unlikely(task == NULL)) { if (unlikely(task == NULL)) {
SCLogError(SC_ERR_MEM_ALLOC, "Can't alloc task"); SCLogError(SC_ERR_MEM_ALLOC, "Can't alloc task");
SCReturn(TM_ECODE_FAILED); SCReturnInt(TM_ECODE_FAILED);
} }
task->Func = Func; task->Func = Func;
task->data = data; task->data = data;
/* Add it to the list */ /* Add it to the list */
TAILQ_INSERT_TAIL(&command.tasks, task, next); TAILQ_INSERT_TAIL(&command.tasks, task, next);
SCReturn(TM_ECODE_OK); SCReturnInt(TM_ECODE_OK);
} }

@ -162,12 +162,12 @@ TmEcode LiveDeviceIfaceStat(json_t *cmd, json_t *answer, void *data)
json_t *jarg = json_object_get(cmd, "iface"); json_t *jarg = json_object_get(cmd, "iface");
if(!json_is_string(jarg)) { if(!json_is_string(jarg)) {
json_object_set_new(answer, "message", json_string("Iface is not a string")); json_object_set_new(answer, "message", json_string("Iface is not a string"));
SCReturn(TM_ECODE_FAILED); SCReturnInt(TM_ECODE_FAILED);
} }
name = json_string_value(jarg); name = json_string_value(jarg);
if (name == NULL) { if (name == NULL) {
json_object_set_new(answer, "message", json_string("Iface name is NULL")); json_object_set_new(answer, "message", json_string("Iface name is NULL"));
SCReturn(TM_ECODE_FAILED); SCReturnInt(TM_ECODE_FAILED);
} }
TAILQ_FOREACH(pd, &live_devices, next) { TAILQ_FOREACH(pd, &live_devices, next) {
@ -176,7 +176,7 @@ TmEcode LiveDeviceIfaceStat(json_t *cmd, json_t *answer, void *data)
if (jdata == NULL) { if (jdata == NULL) {
json_object_set_new(answer, "message", json_object_set_new(answer, "message",
json_string("internal error at json object creation")); json_string("internal error at json object creation"));
SCReturn(TM_ECODE_FAILED); SCReturnInt(TM_ECODE_FAILED);
} }
json_object_set_new(jdata, "pkts", json_object_set_new(jdata, "pkts",
json_integer(SC_ATOMIC_GET(pd->pkts))); json_integer(SC_ATOMIC_GET(pd->pkts)));
@ -185,11 +185,11 @@ TmEcode LiveDeviceIfaceStat(json_t *cmd, json_t *answer, void *data)
json_object_set_new(jdata, "drop", json_object_set_new(jdata, "drop",
json_integer(SC_ATOMIC_GET(pd->drop))); json_integer(SC_ATOMIC_GET(pd->drop)));
json_object_set_new(answer, "message", jdata); json_object_set_new(answer, "message", jdata);
SCReturn(TM_ECODE_OK); SCReturnInt(TM_ECODE_OK);
} }
} }
json_object_set_new(answer, "message", json_string("Iface does not exist")); json_object_set_new(answer, "message", json_string("Iface does not exist"));
SCReturn(TM_ECODE_FAILED); SCReturnInt(TM_ECODE_FAILED);
} }
TmEcode LiveDeviceIfaceList(json_t *cmd, json_t *answer, void *data) TmEcode LiveDeviceIfaceList(json_t *cmd, json_t *answer, void *data)
@ -220,6 +220,6 @@ TmEcode LiveDeviceIfaceList(json_t *cmd, json_t *answer, void *data)
json_object_set_new(jdata, "count", json_integer(i)); json_object_set_new(jdata, "count", json_integer(i));
json_object_set_new(jdata, "ifaces", jarray); json_object_set_new(jdata, "ifaces", jarray);
json_object_set_new(answer, "message", jdata); json_object_set_new(answer, "message", jdata);
SCReturn(TM_ECODE_OK); SCReturnInt(TM_ECODE_OK);
} }
#endif /* BUILD_UNIX_SOCKET */ #endif /* BUILD_UNIX_SOCKET */

Loading…
Cancel
Save