Project

General

Profile

Support #70 » 0002-Renaming-errors-with-naming-conventions.patch

Avoid repeating error or invalid if we already know that's an error with SC_ERR_ prefix. - Pablo Rincon, 02/06/2010 12:40 PM

View differences:

src/alert-unified-alert.c
int AlertUnifiedAlertRotateFile(ThreadVars *t, AlertUnifiedAlertThread *aun) {
if (AlertUnifiedAlertCloseFile(t,aun) < 0) {
SCLogError(SC_ERR_UNIFIED_ALERT_GENERIC_ERROR,
SCLogError(SC_ERR_UNIFIED_ALERT_GENERIC,
"Error: AlertUnifiedAlertCloseFile failed");
return -1;
}
if (AlertUnifiedAlertOpenFileCtx(aun->file_ctx,aun->file_ctx->prefix) < 0) {
SCLogError(SC_ERR_UNIFIED_ALERT_GENERIC_ERROR,
SCLogError(SC_ERR_UNIFIED_ALERT_GENERIC,
"Error: AlertUnifiedLogOpenFileCtx, open new log file failed");
return -1;
}
if (AlertUnifiedAlertWriteFileHeader(t, aun) < 0) {
SCLogError(SC_ERR_UNIFIED_ALERT_GENERIC_ERROR, "Error: "
SCLogError(SC_ERR_UNIFIED_ALERT_GENERIC, "Error: "
"AlertUnifiedLogAppendFile, write unified header failed");
return -1;
}
......
/** Write Unified header */
int ret = AlertUnifiedAlertWriteFileHeader(t, aun);
if (ret != 0) {
SCLogError(SC_ERR_UNIFIED_ALERT_GENERIC_ERROR,
SCLogError(SC_ERR_UNIFIED_ALERT_GENERIC,
"Error: AlertUnifiedLogWriteFileHeader failed");
free(aun);
return TM_ECODE_FAILED;
......
LogFileCtx *file_ctx = LogFileNewCtx();
if (file_ctx == NULL) {
SCLogError(SC_ERR_UNIFIED_ALERT_GENERIC_ERROR,
SCLogError(SC_ERR_UNIFIED_ALERT_GENERIC,
"AlertUnifiedAlertInitCtx: Couldn't create new file_ctx");
return NULL;
}
src/alert-unified2-alert.c
int Unified2AlertRotateFile(ThreadVars *t, Unified2AlertThread *aun) {
if (Unified2AlertCloseFile(t,aun) < 0) {
SCLogError(SC_ERR_UNIFIED2_ALERT_GENERIC_ERROR,
SCLogError(SC_ERR_UNIFIED2_ALERT_GENERIC,
"Error: Unified2AlertCloseFile failed");
return -1;
}
if (Unified2AlertOpenFileCtx(aun->file_ctx,aun->file_ctx->prefix) < 0) {
SCLogError(SC_ERR_UNIFIED2_ALERT_GENERIC_ERROR,
SCLogError(SC_ERR_UNIFIED2_ALERT_GENERIC,
"Error: Unified2AlertOpenFileCtx, open new log file failed");
return -1;
}
......
if(file_ctx == NULL)
{
SCLogError(SC_ERR_UNIFIED2_ALERT_GENERIC_ERROR, "Unified2AlertInitCtx: "
SCLogError(SC_ERR_UNIFIED2_ALERT_GENERIC, "Unified2AlertInitCtx: "
"Couldn't create new file_ctx");
return NULL;
}
......
goto error;
if (strcmp(filename, lf->filename) == 0) {
SCLogError(SC_ERR_UNIFIED2_ALERT_GENERIC_ERROR,
SCLogError(SC_ERR_UNIFIED2_ALERT_GENERIC,
"filename \"%s\" == \"%s\": ", filename, lf->filename);
goto error;
}
src/app-layer-htp.c
if(r == STREAM_STATE_ERROR)
{
if (hstate->connp->last_error != NULL) {
SCLogError(SC_ERR_ALPARSER_ERR, "Error in parsing HTTP client request: "
SCLogError(SC_ERR_ALPARSER, "Error in parsing HTTP client request: "
"[%"PRId32"] [%s] [%"PRId32"] %s", hstate->connp->last_error->level,
hstate->connp->last_error->file, hstate->connp->last_error->line,
hstate->connp->last_error->msg);
} else {
SCLogError(SC_ERR_ALPARSER_ERR, "Error in parsing HTTP client request");
SCLogError(SC_ERR_ALPARSER, "Error in parsing HTTP client request");
}
hstate->flags |= HTP_FLAG_STATE_ERROR;
hstate->flags &= ~HTP_FLAG_STATE_DATA;
......
if (r == STREAM_STATE_ERROR)
{
if (hstate->connp->last_error != NULL) {
SCLogError(SC_ERR_ALPARSER_ERR, "Error in parsing HTTP server response: "
SCLogError(SC_ERR_ALPARSER, "Error in parsing HTTP server response: "
"[%"PRId32"] [%s] [%"PRId32"] %s", hstate->connp->last_error->level,
hstate->connp->last_error->file, hstate->connp->last_error->line,
hstate->connp->last_error->msg);
} else {
SCLogError(SC_ERR_ALPARSER_ERR, "Error in parsing HTTP server response");
SCLogError(SC_ERR_ALPARSER, "Error in parsing HTTP server response");
}
hstate->flags = HTP_FLAG_STATE_ERROR;
ret = -1;
src/app-layer-parser.c
if (pstate->store_len == 0) {
int r = AlpStoreField(output, field_idx, input, size, /* static mem */0);
if (r == -1) {
SCLogError(SC_ERR_ALPARSER_ERR, "Failed to store field value");
SCLogError(SC_ERR_ALPARSER, "Failed to store field value");
SCReturnInt(-1);
}
(*offset) += size;
......
int r = AlpStoreField(output, field_idx, pstate->store,
pstate->store_len, /* alloc mem */1);
if (r == -1) {
SCLogError(SC_ERR_ALPARSER_ERR, "Failed to store field value");
SCLogError(SC_ERR_ALPARSER, "Failed to store field value");
SCReturnInt(-1);
}
......
int r = AlpStoreField(output, field_idx, input, input_len, 0);
if (r == -1) {
SCLogError(SC_ERR_ALPARSER_ERR, "Failed to store field value");
SCLogError(SC_ERR_ALPARSER, "Failed to store field value");
SCReturnInt(-1);
}
......
int r = AlpStoreField(output, field_idx, pstate->store, pstate->store_len, 1);
if (r == -1) {
SCLogError(SC_ERR_ALPARSER_ERR, "Failed to store field value");
SCLogError(SC_ERR_ALPARSER, "Failed to store field value");
SCReturnInt(-1);
}
......
int r = AlpStoreField(output, field_idx, input, len, 0);
if (r == -1) {
SCLogError(SC_ERR_ALPARSER_ERR, "Failed to store field value");
SCLogError(SC_ERR_ALPARSER, "Failed to store field value");
SCReturnInt(-1);
}
(*offset) += (len + delim_len);
......
int r = AlpStoreField(output, field_idx, pstate->store,
pstate->store_len, 1);
if (r == -1) {
SCLogError(SC_ERR_ALPARSER_ERR, "Failed to store field value");
SCLogError(SC_ERR_ALPARSER, "Failed to store field value");
SCReturnInt(-1);
}
pstate->store = NULL;
......
int r = AlpStoreField(output, field_idx,
pstate->store, len, 1);
if (r == -1) {
SCLogError(SC_ERR_ALPARSER_ERR, "Failed to store "
SCLogError(SC_ERR_ALPARSER, "Failed to store "
"field value");
SCReturnInt(-1);
}
......
uint32_t len = ptr - pstate->store;
int r = AlpStoreField(output, field_idx, pstate->store, len, 1);
if (r == -1) {
SCLogError(SC_ERR_ALPARSER_ERR, "Failed to store field value");
SCLogError(SC_ERR_ALPARSER, "Failed to store field value");
SCReturnInt(-1);
}
pstate->store = NULL;
......
inet_ntop(AF_INET, (const void*)&f->dst.addr_data32[0], dst,
sizeof (dst));
SCLogError(SC_ERR_ALPARSER_ERR, "Error occured in parsing \"%s\" app layer "
SCLogError(SC_ERR_ALPARSER, "Error occured in parsing \"%s\" app layer "
"protocol, using network protocol %"PRIu8", source IP "
"address %s, destination IP address %s, src port %"PRIu16" and "
"dst port %"PRIu16"", al_proto_table[ssn->alproto].name,
......
inet_ntop(AF_INET6, (const void*)&f->dst.addr_data32, dst6,
sizeof (dst6));
SCLogError(SC_ERR_ALPARSER_ERR, "Error occured in parsing \"%s\" app layer "
SCLogError(SC_ERR_ALPARSER, "Error occured in parsing \"%s\" app layer "
"protocol, using network protocol %"PRIu8", source IPv6 "
"address %s, destination IPv6 address %s, src port %"PRIu16" and "
"dst port %"PRIu16"", al_proto_table[ssn->alproto].name,
src/app-layer-tls.c
pstate->parse_field = 0;
SCReturnInt(0);
} else if (r == -1) {
SCLogError(SC_ERR_ALPARSER_ERR, "AlpParseFieldBySize failed, "
SCLogError(SC_ERR_ALPARSER, "AlpParseFieldBySize failed, "
"r %d", r);
SCReturnInt(-1);
}
......
pstate->parse_field = 1;
SCReturnInt(0);
} else if (r == -1) {
SCLogError(SC_ERR_ALPARSER_ERR, "AlpParseFieldBySize failed, "
SCLogError(SC_ERR_ALPARSER, "AlpParseFieldBySize failed, "
"r %d", r);
SCReturnInt(-1);
}
......
pstate->parse_field = 2;
SCReturnInt(0);
} else if (r == -1) {
SCLogError(SC_ERR_ALPARSER_ERR, "AlpParseFieldBySize failed, "
SCLogError(SC_ERR_ALPARSER, "AlpParseFieldBySize failed, "
"r %d", r);
SCReturnInt(-1);
}
......
pstate->parse_field = 0;
SCReturnInt(0);
} else if (r == -1) {
SCLogError(SC_ERR_ALPARSER_ERR, "AlpParseFieldBySize failed, "
SCLogError(SC_ERR_ALPARSER, "AlpParseFieldBySize failed, "
"r %d", r);
SCReturnInt(-1);
}
......
pstate->parse_field = 1;
SCReturnInt(0);
} else if (r == -1) {
SCLogError(SC_ERR_ALPARSER_ERR, "AlpParseFieldBySize failed, "
SCLogError(SC_ERR_ALPARSER, "AlpParseFieldBySize failed, "
"r %d", r);
SCReturnInt(-1);
}
......
pstate->parse_field = 2;
SCReturnInt(0);
} else if (r == -1) {
SCLogError(SC_ERR_ALPARSER_ERR, "AlpParseFieldBySize failed, "
SCLogError(SC_ERR_ALPARSER, "AlpParseFieldBySize failed, "
"r %d", r);
SCReturnInt(-1);
}
src/counters.c
if (snprintf(log_filename, PATH_MAX, "%s/%s", log_dir,
SC_PERF_DEFAULT_LOG_FILENAME) < 0) {
SCLogError(SC_ERR_SPRINTF_ERROR, "Sprintf Error");
SCLogError(SC_ERR_SPRINTF, "Sprintf Error");
free(log_filename);
return NULL;
}
......
/* init the lock used by SCPerfClubTMInst */
if (SCMutexInit(&sc_perf_op_ctx->pctmi_lock, NULL) != 0) {
SCLogError(SC_ERR_INITIALIZATION_ERROR, "error initializing pctmi mutex");
SCLogError(SC_ERR_INITIALIZATION, "error initializing pctmi mutex");
exit(EXIT_FAILURE);
}
......
tv_wakeup = TmThreadCreateMgmtThread("SCPerfWakeupThread",
SCPerfWakeupThread, 1);
if (tv_wakeup == NULL) {
SCLogError(SC_ERR_THREAD_CREATE_ERROR, "TmThreadCreateMgmtThread "
SCLogError(SC_ERR_THREAD_CREATE, "TmThreadCreateMgmtThread "
"failed");
exit(EXIT_FAILURE);
}
if (TmThreadSpawn(tv_wakeup) != 0) {
SCLogError(SC_ERR_THREAD_SPAWN_FAILED, "TmThreadSpawn failed for "
SCLogError(SC_ERR_THREAD_SPAWN, "TmThreadSpawn failed for "
"SCPerfWakeupThread");
exit(EXIT_FAILURE);
}
......
tv_mgmt = TmThreadCreateMgmtThread("SCPerfMgmtThread",
SCPerfMgmtThread, 1);
if (tv_mgmt == NULL) {
SCLogError(SC_ERR_THREAD_CREATE_ERROR,
SCLogError(SC_ERR_THREAD_CREATE,
"TmThreadCreateMgmtThread failed");
exit(EXIT_FAILURE);
}
if (TmThreadSpawn(tv_mgmt) != 0) {
SCLogError(SC_ERR_THREAD_SPAWN_FAILED, "TmThreadSpawn failed for "
SCLogError(SC_ERR_THREAD_SPAWN, "TmThreadSpawn failed for "
"SCPerfWakeupThread");
exit(EXIT_FAILURE);
}
src/defrag.c
else {
int pkt_end = fragmentable_offset + frag->offset + frag->data_len;
if (pkt_end > (int)sizeof(rp->pkt)) {
SCLogWarning(SC_ERR_REASSEMBLY_FAILED, "Failed re-assemble fragmented packet, exceeds size of packet buffer.");
SCLogWarning(SC_ERR_REASSEMBLY, "Failed re-assemble fragmented packet, exceeds size of packet buffer.");
goto remove_tracker;
}
memcpy(rp->pkt + fragmentable_offset + frag->offset + frag->ltrim,
src/detect-bytetest.c
parse_regex = pcre_compile(PARSE_REGEX, opts, &eb, &eo, NULL);
if(parse_regex == NULL)
{
SCLogError(SC_ERR_PCRE_COMPILE_FAILED, "pcre compile of \"%s\" failed at "
SCLogError(SC_ERR_PCRE_COMPILE, "pcre compile of \"%s\" failed at "
"offset %" PRId32 ": %s", PARSE_REGEX, eo, eb);
goto error;
}
......
parse_regex_study = pcre_study(parse_regex, 0, &eb);
if(eb != NULL)
{
SCLogError(SC_ERR_PCRE_STUDY_FAILED, "pcre study failed: %s", eb);
SCLogError(SC_ERR_PCRE_STUDY, "pcre study failed: %s", eb);
goto error;
}
return;
......
ret = pcre_exec(parse_regex, parse_regex_study, optstr,
strlen(optstr), 0, 0, ov, MAX_SUBSTRINGS);
if (ret < 6 || ret > 10) {
SCLogError(SC_ERR_PCRE_PARSE_FAILED, "parse error, ret %" PRId32
SCLogError(SC_ERR_PCRE_PARSE, "parse error, ret %" PRId32
", string %s", ret, optstr);
goto error;
}
......
res = pcre_get_substring((char *)optstr, ov, MAX_SUBSTRINGS,
i + 1, &str_ptr);
if (res < 0) {
SCLogError(SC_ERR_PCRE_GET_SUBSTRING_FAILED, "pcre_get_substring failed "
SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre_get_substring failed "
"for arg %d", i + 1);
goto error;
}
src/detect-dce-iface.c
/* retrieve the iface uuid string. iface uuid is a compulsion in the keyword */
res = pcre_get_substring(arg, ov, MAX_SUBSTRINGS, 1, &pcre_sub_str);
if (res < 0) {
SCLogError(SC_ERR_PCRE_GET_SUBSTRING_FAILED, "pcre_get_substring failed");
SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre_get_substring failed");
goto error;
}
......
* validations of the version number, wrt. the operator */
res = pcre_get_substring(arg, ov, MAX_SUBSTRINGS, 3, &pcre_sub_str);
if (res < 0) {
SCLogError(SC_ERR_PCRE_GET_SUBSTRING_FAILED, "pcre_get_substring failed");
SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre_get_substring failed");
goto error;
}
......
/* now let us handle the operator supplied with the version number */
res = pcre_get_substring(arg, ov, MAX_SUBSTRINGS, 2, &pcre_sub_str);
if (res < 0) {
SCLogError(SC_ERR_PCRE_GET_SUBSTRING_FAILED, "pcre_get_substring failed");
SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre_get_substring failed");
goto error;
}
src/detect-dce-opnum.c
res = pcre_get_substring(arg, ov, MAX_SUBSTRINGS, 0, &pcre_sub_str);
if (res < 0) {
SCLogError(SC_ERR_PCRE_GET_SUBSTRING_FAILED, "pcre_get_substring failed");
SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre_get_substring failed");
goto error;
}
src/detect-dsize.c
parse_regex = pcre_compile(PARSE_REGEX, opts, &eb, &eo, NULL);
if(parse_regex == NULL)
{
SCLogError(SC_ERR_PCRE_COMPILE_FAILED,"pcre compile of \"%s\" failed at offset %" PRId32 ": %s", PARSE_REGEX, eo, eb);
SCLogError(SC_ERR_PCRE_COMPILE,"pcre compile of \"%s\" failed at offset %" PRId32 ": %s", PARSE_REGEX, eo, eb);
goto error;
}
parse_regex_study = pcre_study(parse_regex, 0, &eb);
if(eb != NULL)
{
SCLogError(SC_ERR_PCRE_STUDY_FAILED,"pcre study failed: %s", eb);
SCLogError(SC_ERR_PCRE_STUDY,"pcre study failed: %s", eb);
goto error;
}
return;
......
ret = pcre_exec(parse_regex, parse_regex_study, rawstr, strlen(rawstr), 0, 0, ov, MAX_SUBSTRINGS);
if (ret < 3 || ret > 5) {
SCLogError(SC_ERR_PCRE_MATCH_FAILED,"Parse error %s", rawstr);
SCLogError(SC_ERR_PCRE_MATCH,"Parse error %s", rawstr);
goto error;
}
......
res = pcre_get_substring((char *)rawstr, ov, MAX_SUBSTRINGS, 1, &str_ptr);
if (res < 0) {
SCLogError(SC_ERR_PCRE_GET_SUBSTRING_FAILED,"pcre_get_substring failed");
SCLogError(SC_ERR_PCRE_GET_SUBSTRING,"pcre_get_substring failed");
goto error;
}
mode = (char *)str_ptr;
......
res = pcre_get_substring((char *)rawstr, ov, MAX_SUBSTRINGS, 2, &str_ptr);
if (res < 0) {
SCLogError(SC_ERR_PCRE_GET_SUBSTRING_FAILED,"pcre_get_substring failed");
SCLogError(SC_ERR_PCRE_GET_SUBSTRING,"pcre_get_substring failed");
goto error;
}
value1 = (char *)str_ptr;
......
res = pcre_get_substring((char *)rawstr, ov, MAX_SUBSTRINGS, 3, &str_ptr);
if (res < 0) {
SCLogError(SC_ERR_PCRE_GET_SUBSTRING_FAILED,"pcre_get_substring failed");
SCLogError(SC_ERR_PCRE_GET_SUBSTRING,"pcre_get_substring failed");
goto error;
}
range = (char *)str_ptr;
......
res = pcre_get_substring((char *)rawstr, ov, MAX_SUBSTRINGS, 4, &str_ptr);
if (res < 0) {
SCLogError(SC_ERR_PCRE_GET_SUBSTRING_FAILED,"pcre_get_substring failed");
SCLogError(SC_ERR_PCRE_GET_SUBSTRING,"pcre_get_substring failed");
goto error;
}
value2 = (char *)str_ptr;
src/detect-engine-address.c
/* parse the address */
ad = DetectAddressParseSingle(s);
if (ad == NULL) {
SCLogError(SC_ERR_ADDRESS_ENGINE_GENERIC_ERROR,
SCLogError(SC_ERR_ADDRESS_ENGINE_GENERIC,
"DetectAddressParse error \"%s\"", s);
goto error;
}
......
return 0;
error:
SCLogError(SC_ERR_ADDRESS_ENGINE_GENERIC_ERROR, "DetectAddressSetup error");
SCLogError(SC_ERR_ADDRESS_ENGINE_GENERIC, "DetectAddressSetup error");
/* XXX cleanup */
return -1;
}
src/detect-engine-port.c
return 0;
error:
SCLogError(SC_ERR_PORT_PARSE_INSERT_STRING_ERR,"DetectPortParseInsertString error");
SCLogError(SC_ERR_PORT_PARSE_INSERT_STRING,"DetectPortParseInsertString error");
if (ad != NULL)
DetectPortCleanupList(ad);
if (ad_any != NULL)
src/detect-icmp-id.c
ret = pcre_exec(parse_regex, parse_regex_study, icmpidstr, strlen(icmpidstr), 0, 0, ov, MAX_SUBSTRINGS);
if (ret < 1 || ret > 4) {
SCLogError(SC_ERR_PCRE_MATCH_FAILED, "Parse error %s", icmpidstr);
SCLogError(SC_ERR_PCRE_MATCH, "Parse error %s", icmpidstr);
goto error;
}
......
for (i = 1; i < ret; i++) {
res = pcre_get_substring((char *)icmpidstr, ov, MAX_SUBSTRINGS, i, &str_ptr);
if (res < 0) {
SCLogError(SC_ERR_PCRE_GET_SUBSTRING_FAILED, "pcre_get_substring failed");
SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre_get_substring failed");
goto error;
}
substr[i-1] = (char *)str_ptr;
src/detect-icmp-seq.c
parse_regex = pcre_compile(PARSE_REGEX, opts, &eb, &eo, NULL);
if (parse_regex == NULL) {
SCLogError(SC_ERR_PCRE_COMPILE_FAILED,"pcre compile of \"%s\" failed at offset %" PRId32 ": %s", PARSE_REGEX, eo, eb);
SCLogError(SC_ERR_PCRE_COMPILE,"pcre compile of \"%s\" failed at offset %" PRId32 ": %s", PARSE_REGEX, eo, eb);
goto error;
}
parse_regex_study = pcre_study(parse_regex, 0, &eb);
if (eb != NULL) {
SCLogError(SC_ERR_PCRE_STUDY_FAILED,"pcre study failed: %s", eb);
SCLogError(SC_ERR_PCRE_STUDY,"pcre study failed: %s", eb);
goto error;
}
return;
......
ret = pcre_exec(parse_regex, parse_regex_study, icmpseqstr, strlen(icmpseqstr), 0, 0, ov, MAX_SUBSTRINGS);
if (ret < 1 || ret > 4) {
SCLogError(SC_ERR_PCRE_MATCH_FAILED,"Parse error %s", icmpseqstr);
SCLogError(SC_ERR_PCRE_MATCH,"Parse error %s", icmpseqstr);
goto error;
}
for (i = 1; i < ret; i++) {
res = pcre_get_substring((char *)icmpseqstr, ov, MAX_SUBSTRINGS, i, &str_ptr);
if (res < 0) {
SCLogError(SC_ERR_PCRE_GET_SUBSTRING_FAILED,"pcre_get_substring failed");
SCLogError(SC_ERR_PCRE_GET_SUBSTRING,"pcre_get_substring failed");
goto error;
}
substr[i-1] = (char *)str_ptr;
src/detect-icode.c
parse_regex = pcre_compile(PARSE_REGEX, opts, &eb, &eo, NULL);
if(parse_regex == NULL)
{
SCLogError(SC_ERR_PCRE_COMPILE_FAILED, "pcre compile of \"%s\" failed at offset %" PRId32 ": %s", PARSE_REGEX, eo, eb);
SCLogError(SC_ERR_PCRE_COMPILE, "pcre compile of \"%s\" failed at offset %" PRId32 ": %s", PARSE_REGEX, eo, eb);
goto error;
}
parse_regex_study = pcre_study(parse_regex, 0, &eb);
if(eb != NULL)
{
SCLogError(SC_ERR_PCRE_COMPILE_FAILED, "pcre study failed: %s", eb);
SCLogError(SC_ERR_PCRE_COMPILE, "pcre study failed: %s", eb);
goto error;
}
return;
......
ret = pcre_exec(parse_regex, parse_regex_study, icodestr, strlen(icodestr), 0, 0, ov, MAX_SUBSTRINGS);
if (ret < 1 || ret > 4) {
SCLogError(SC_ERR_PCRE_MATCH_FAILED, "DetectICodeParse: parse error");
SCLogError(SC_ERR_PCRE_MATCH, "DetectICodeParse: parse error");
goto error;
}
......
for (i = 1; i < ret; i++) {
res = pcre_get_substring((char *)icodestr, ov, MAX_SUBSTRINGS, i, &str_ptr);
if (res < 0) {
SCLogError(SC_ERR_PCRE_GET_SUBSTRING_FAILED, "DetectICodeParse: pcre_get_substring failed");
SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "DetectICodeParse: pcre_get_substring failed");
goto error;
}
args[i-1] = (char *)str_ptr;
src/detect-itype.c
parse_regex = pcre_compile(PARSE_REGEX, opts, &eb, &eo, NULL);
if(parse_regex == NULL)
{
SCLogError(SC_ERR_PCRE_COMPILE_FAILED, "pcre compile of \"%s\" failed at offset %" PRId32 ": %s", PARSE_REGEX, eo, eb);
SCLogError(SC_ERR_PCRE_COMPILE, "pcre compile of \"%s\" failed at offset %" PRId32 ": %s", PARSE_REGEX, eo, eb);
goto error;
}
parse_regex_study = pcre_study(parse_regex, 0, &eb);
if(eb != NULL)
{
SCLogError(SC_ERR_PCRE_COMPILE_FAILED, "pcre study failed: %s", eb);
SCLogError(SC_ERR_PCRE_COMPILE, "pcre study failed: %s", eb);
goto error;
}
return;
......
ret = pcre_exec(parse_regex, parse_regex_study, itypestr, strlen(itypestr), 0, 0, ov, MAX_SUBSTRINGS);
if (ret < 1 || ret > 4) {
SCLogError(SC_ERR_PCRE_MATCH_FAILED, "DetectITypeParse: parse error");
SCLogError(SC_ERR_PCRE_MATCH, "DetectITypeParse: parse error");
goto error;
}
......
for (i = 1; i < ret; i++) {
res = pcre_get_substring((char *)itypestr, ov, MAX_SUBSTRINGS, i, &str_ptr);
if (res < 0) {
SCLogError(SC_ERR_PCRE_GET_SUBSTRING_FAILED, "DetectITypeParse: pcre_get_substring failed");
SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "DetectITypeParse: pcre_get_substring failed");
goto error;
}
args[i-1] = (char *)str_ptr;
src/detect-urilen.c
ret = pcre_exec(parse_regex, parse_regex_study, urilenstr, strlen(urilenstr),
0, 0, ov, MAX_SUBSTRINGS);
if (ret < 3 || ret > 5) {
SCLogError(SC_ERR_PCRE_PARSE_FAILED, "parse error, ret %" PRId32 "", ret);
SCLogError(SC_ERR_PCRE_PARSE, "parse error, ret %" PRId32 "", ret);
goto error;
}
const char *str_ptr;
res = pcre_get_substring((char *)urilenstr, ov, MAX_SUBSTRINGS, 1, &str_ptr);
if (res < 0) {
SCLogError(SC_ERR_PCRE_GET_SUBSTRING_FAILED, "pcre_get_substring failed");
SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre_get_substring failed");
goto error;
}
arg1 = (char *) str_ptr;
......
res = pcre_get_substring((char *)urilenstr, ov, MAX_SUBSTRINGS, 2, &str_ptr);
if (res < 0) {
SCLogError(SC_ERR_PCRE_GET_SUBSTRING_FAILED, "pcre_get_substring failed");
SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre_get_substring failed");
goto error;
}
arg2 = (char *) str_ptr;
......
res = pcre_get_substring((char *)urilenstr, ov, MAX_SUBSTRINGS, 3, &str_ptr);
if (res < 0) {
SCLogError(SC_ERR_PCRE_GET_SUBSTRING_FAILED, "pcre_get_substring failed");
SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre_get_substring failed");
goto error;
}
arg3 = (char *) str_ptr;
......
res = pcre_get_substring((char *)urilenstr, ov, MAX_SUBSTRINGS, 4, &str_ptr);
if (res < 0) {
SCLogError(SC_ERR_PCRE_GET_SUBSTRING_FAILED, "pcre_get_substring failed");
SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre_get_substring failed");
goto error;
}
arg4 = (char *) str_ptr;
src/log-httplog.c
if(file_ctx == NULL)
{
SCLogError(SC_ERR_HTTP_LOG_GENERIC_ERROR, "LogHttpLogInitCtx: Couldn't "
SCLogError(SC_ERR_HTTP_LOG_GENERIC, "LogHttpLogInitCtx: Couldn't "
"create new file_ctx");
return NULL;
}
src/stream-tcp-reassemble.c
return_seg = TRUE;
goto end;
} else if (ret_value == -1) {
SCLogError(SC_ERR_REASSEMBLY_FAILED,
SCLogError(SC_ERR_REASSEMBLY,
"HandleSegmentStartsBeforeListSegment failed");
ret_value = -1;
return_seg = TRUE;
......
return_seg = TRUE;
goto end;
} else if (ret_value == -1) {
SCLogError(SC_ERR_REASSEMBLY_FAILED,
SCLogError(SC_ERR_REASSEMBLY,
"HandleSegmentStartsAtSameListSegment failed");
ret_value = -1;
return_seg = TRUE;
......
return_seg = TRUE;
goto end;
} else if (ret_value == -1) {
SCLogError(SC_ERR_REASSEMBLY_FAILED,
SCLogError(SC_ERR_REASSEMBLY,
"HandleSegmentStartsAfterListSegment failed");
ret_value = -1;
return_seg = TRUE;
......
seg->prev = NULL;
if (ReassembleInsertSegment(stream, seg, p) != 0) {
SCLogError(SC_ERR_REASSEMBLY_FAILED, "ReassembleInsertSegment failed");
SCLogError(SC_ERR_REASSEMBLY, "ReassembleInsertSegment failed");
return -1;
}
......
/* handle ack received */
if (StreamTcpReassembleHandleSegmentUpdateACK(ra_ctx, ssn, opposing_stream, p) != 0)
{
SCLogError(SC_ERR_REASSEMBLY_FAILED,
SCLogError(SC_ERR_REASSEMBLY,
"StreamTcpReassembleHandleSegmentUpdateACK error");
SCReturnInt(-1);
}
if (p->payload_len > 0) {
if (StreamTcpReassembleHandleSegmentHandleData(ssn, stream, p) != 0) {
SCLogError(SC_ERR_REASSEMBLY_FAILED,
SCLogError(SC_ERR_REASSEMBLY,
"StreamTcpReassembleHandleSegmentHandleData error");
SCReturnInt(-1);
}
src/stream-tcp.c
StreamTcpSessionPoolAlloc, NULL,
StreamTcpSessionPoolFree);
if (ssn_pool == NULL) {
SCLogError(SC_ERR_POOL_INIT_FAILED, "ssn_pool is not initialized");
SCLogError(SC_ERR_POOL_INIT, "ssn_pool is not initialized");
exit(EXIT_FAILURE);
}
src/suricata.c
/* Wait till all the threads have been initialized */
if (TmThreadWaitOnThreadInit() == TM_ECODE_FAILED) {
SCLogError(SC_ERR_INITIALIZATION_ERROR, "Engine initialization failed, "
SCLogError(SC_ERR_INITIALIZATION, "Engine initialization failed, "
"aborting...");
exit(EXIT_FAILURE);
}
src/tm-threads.c
inline int TmThreadsCheckFlag(ThreadVars *tv, uint8_t flag) {
int r;
if (SCSpinLock(&tv->flags_spinlock) != 0) {
SCLogError(SC_ERR_SPINLOCK_ERROR,"spin lock errno=%d",errno);
SCLogError(SC_ERR_SPINLOCK,"spin lock errno=%d",errno);
return 0;
}
......
inline void TmThreadsSetFlag(ThreadVars *tv, uint8_t flag) {
if (SCSpinLock(&tv->flags_spinlock) != 0) {
SCLogError(SC_ERR_SPINLOCK_ERROR,"spin lock errno=%d",errno);
SCLogError(SC_ERR_SPINLOCK,"spin lock errno=%d",errno);
return;
}
......
inline void TmThreadsUnsetFlag(ThreadVars *tv, uint8_t flag) {
if (SCSpinLock(&tv->flags_spinlock) != 0) {
SCLogError(SC_ERR_SPINLOCK_ERROR,"spin lock errno=%d",errno);
SCLogError(SC_ERR_SPINLOCK,"spin lock errno=%d",errno);
return;
}
src/util-classification-config.c
SCClassConfClasstypeHashCompareFunc,
SCClassConfClasstypeHashFree);
if (de_ctx->class_conf_ht == NULL) {
SCLogError(SC_ERR_HASH_TABLE_INIT_FAILED, "Error initializing the hash "
SCLogError(SC_ERR_HASH_TABLE_INIT, "Error initializing the hash "
"table");
return -1;
}
......
if (fd == NULL) {
filename = SCClassConfGetConfFilename();
if ( (fd = fopen(filename, "r")) == NULL) {
SCLogError(SC_ERR_FOPEN_ERROR, "Error opening file: \"%s\": %s", filename, strerror(errno));
SCLogError(SC_ERR_FOPEN, "Error opening file: \"%s\": %s", filename, strerror(errno));
goto error;
}
}
src/util-debug.c
if (sc_log_fg_filters_present == 1) {
if (SCLogMatchFGFilterWL(file, function, line) != 1)
return SC_ERR_LOG_FG_FILTER_MATCH_FAILED;
return SC_ERR_LOG_FG_FILTER_MATCH;
if (SCLogMatchFGFilterBL(file, function, line) != 1)
return SC_ERR_LOG_FG_FILTER_MATCH_FAILED;
return SC_ERR_LOG_FG_FILTER_MATCH;
}
if (sc_log_fd_filters_present == 1 && SCLogMatchFDFilter(function) != 1)
return SC_ERR_LOG_FG_FILTER_MATCH_FAILED;
return SC_ERR_LOG_FG_FILTER_MATCH;
while ( (temp_fmt = index(temp_fmt, SC_LOG_FMT_PREFIX)) ) {
if ((temp - *msg) > SC_LOG_MAX_LOG_MSG_LEN) {
......
return SC_OK;
error:
return SC_ERR_SPRINTF_ERROR;
return SC_ERR_SPRINTF;
}
/**
src/util-error.c
switch (err) {
CASE_CODE (SC_OK);
CASE_CODE (SC_ERR_MEM_ALLOC);
CASE_CODE (SC_ERR_PCRE_MATCH_FAILED);
CASE_CODE (SC_ERR_PCRE_GET_SUBSTRING_FAILED);
CASE_CODE (SC_ERR_PCRE_COMPILE_FAILED);
CASE_CODE (SC_ERR_PCRE_STUDY_FAILED);
CASE_CODE (SC_ERR_PCRE_PARSE_FAILED);
CASE_CODE (SC_ERR_PCRE_MATCH);
CASE_CODE (SC_ERR_PCRE_GET_SUBSTRING);
CASE_CODE (SC_ERR_PCRE_COMPILE);
CASE_CODE (SC_ERR_PCRE_STUDY);
CASE_CODE (SC_ERR_PCRE_PARSE);
CASE_CODE (SC_ERR_LOG_MODULE_NOT_INIT);
CASE_CODE (SC_ERR_LOG_FG_FILTER_MATCH_FAILED);
CASE_CODE (SC_ERR_LOG_FG_FILTER_MATCH);
CASE_CODE (SC_ERR_INVALID_SIGNATURE);
CASE_CODE (SC_ERR_OPENING_FILE);
CASE_CODE (SC_ERR_OPENING_RULE_FILE);
......
CASE_CODE (SC_ERR_NO_RULES_LOADED);
CASE_CODE (SC_ERR_COUNTER_EXCEEDED);
CASE_CODE (SC_ERR_INVALID_CHECKSUM);
CASE_CODE (SC_ERR_SPRINTF_ERROR);
CASE_CODE (SC_ERR_SPRINTF);
CASE_CODE (SC_ERR_INVALID_ARGUMENT);
CASE_CODE (SC_ERR_SPINLOCK_ERROR);
CASE_CODE (SC_ERR_SPINLOCK);
CASE_CODE (SC_ERR_INVALID_ENUM_MAP);
CASE_CODE (SC_ERR_INVALID_IP_NETBLOCK);
CASE_CODE (SC_ERR_INVALID_IPV4_ADDR);
......
CASE_CODE (SC_ERR_COMPLETE_PORT_SPACE_NEGATED);
CASE_CODE (SC_ERR_NO_PORTS_LEFT_AFTER_MERGE);
CASE_CODE (SC_ERR_NEGATED_VALUE_IN_PORT_RANGE);
CASE_CODE (SC_ERR_PORT_PARSE_INSERT_STRING_ERR);
CASE_CODE (SC_ERR_PORT_PARSE_INSERT_STRING);
CASE_CODE (SC_ERR_UNREACHABLE_CODE_REACHED);
CASE_CODE (SC_ERR_INVALID_NUMERIC_VALUE);
CASE_CODE (SC_ERR_NUMERIC_VALUE_ERANGE);
CASE_CODE (SC_ERR_INVALID_NUM_BYTES);
CASE_CODE (SC_ERR_ARG_LEN_LONG);
CASE_CODE (SC_ERR_ALPARSER_ERR);
CASE_CODE (SC_ERR_ALPARSER);
CASE_CODE (SC_ERR_POOL_EMPTY);
CASE_CODE (SC_ERR_REASSEMBLY_FAILED);
CASE_CODE (SC_ERR_POOL_INIT_FAILED);
CASE_CODE (SC_ERR_REASSEMBLY);
CASE_CODE (SC_ERR_POOL_INIT);
CASE_CODE (SC_ERR_UNIMPLEMENTED);
CASE_CODE (SC_ERR_FAST_LOG_GENERIC_ERROR);
CASE_CODE (SC_ERR_DEBUG_LOG_GENERIC_ERROR);
CASE_CODE (SC_ERR_UNIFIED_LOG_GENERIC_ERROR);
CASE_CODE (SC_ERR_HTTP_LOG_GENERIC_ERROR);
CASE_CODE (SC_ERR_UNIFIED_ALERT_GENERIC_ERROR);
CASE_CODE (SC_ERR_UNIFIED2_ALERT_GENERIC_ERROR);
CASE_CODE (SC_ERR_FAST_LOG_GENERIC);
CASE_CODE (SC_ERR_DEBUG_LOG_GENERIC);
CASE_CODE (SC_ERR_UNIFIED_LOG_GENERIC);
CASE_CODE (SC_ERR_HTTP_LOG_GENERIC);
CASE_CODE (SC_ERR_UNIFIED_ALERT_GENERIC);
CASE_CODE (SC_ERR_UNIFIED2_ALERT_GENERIC);
CASE_CODE (SC_ERR_FWRITE);
CASE_CODE (SC_ERR_FOPEN);
CASE_CODE (SC_ERR_THRESHOLD_HASH_ADD);
......
CASE_CODE (SC_ERR_DEPTH_MISSING_CONTENT);
CASE_CODE (SC_ERR_OFFSET_MISSING_CONTENT);
CASE_CODE (SC_ERR_NO_URICONTENT_NEGATION);
CASE_CODE (SC_ERR_FOPEN_ERROR);
CASE_CODE (SC_ERR_LOGDIR_CONFIG);
CASE_CODE (SC_ERR_LOGDIR_CMDLINE);
CASE_CODE (SC_ERR_MISSING_QUOTE);
src/util-error.h
typedef enum {
SC_OK,
SC_ERR_MEM_ALLOC,
SC_ERR_PCRE_MATCH_FAILED,
SC_ERR_PCRE_GET_SUBSTRING_FAILED,
SC_ERR_PCRE_COMPILE_FAILED,
SC_ERR_PCRE_STUDY_FAILED,
SC_ERR_PCRE_PARSE_FAILED,
SC_ERR_PCRE_MATCH,
SC_ERR_PCRE_GET_SUBSTRING,
SC_ERR_PCRE_COMPILE,
SC_ERR_PCRE_STUDY,
SC_ERR_PCRE_PARSE,
SC_ERR_LOG_MODULE_NOT_INIT,
SC_ERR_LOG_FG_FILTER_MATCH_FAILED,
SC_ERR_LOG_FG_FILTER_MATCH,
SC_ERR_COUNTER_EXCEEDED,
SC_ERR_INVALID_CHECKSUM,
SC_ERR_SPRINTF_ERROR,
SC_ERR_SPRINTF,
SC_ERR_INVALID_ARGUMENT,
SC_ERR_SPINLOCK_ERROR,
SC_ERR_SPINLOCK,
SC_ERR_INVALID_ENUM_MAP,
SC_ERR_INVALID_IP_NETBLOCK,
SC_ERR_INVALID_IPV4_ADDR,
......
SC_ERR_NO_RULES,
SC_ERR_NO_RULES_LOADED,
SC_ERR_FOPEN,
SC_ERR_INITIALIZATION_ERROR,
SC_ERR_THREAD_SPAWN_FAILED,
SC_ERR_INITIALIZATION,
SC_ERR_THREAD_SPAWN,
SC_ERR_SYSCALL,
SC_ERR_SYSCONF,
SC_ERR_INVALID_ARGUMENTS,
SC_ERR_THREAD_CREATE_ERROR,
SC_ERR_THREAD_CREATE,
SC_ERR_PERF_STATS_NOT_INIT,
SC_ERR_COMPLETE_PORT_SPACE_NEGATED,
SC_ERR_NO_PORTS_LEFT_AFTER_MERGE,
SC_ERR_NEGATED_VALUE_IN_PORT_RANGE,
SC_ERR_PORT_PARSE_INSERT_STRING_ERR,
SC_ERR_PORT_PARSE_INSERT_STRING,
SC_ERR_UNREACHABLE_CODE_REACHED,
SC_ERR_ALPARSER_ERR,
SC_ERR_ALPARSER,
SC_ERR_INVALID_NUMERIC_VALUE,
SC_ERR_NUMERIC_VALUE_ERANGE,
SC_ERR_INVALID_NUM_BYTES,
SC_ERR_ARG_LEN_LONG,
SC_ERR_POOL_EMPTY,
SC_ERR_REASSEMBLY_FAILED,
SC_ERR_POOL_INIT_FAILED,
SC_ERR_REASSEMBLY,
SC_ERR_POOL_INIT,
SC_ERR_NFQ_OPEN,
SC_ERR_NFQ_BIND,
SC_ERR_NFQ_UNBIND,
......
SC_ERR_NFQ_THREAD_INIT,
SC_ERR_DAEMON,
SC_ERR_UNIMPLEMENTED,
SC_ERR_ADDRESS_ENGINE_GENERIC_ERROR,
SC_ERR_FAST_LOG_GENERIC_ERROR,
SC_ERR_DEBUG_LOG_GENERIC_ERROR,
SC_ERR_UNIFIED_LOG_GENERIC_ERROR,
SC_ERR_HTTP_LOG_GENERIC_ERROR,
SC_ERR_UNIFIED_ALERT_GENERIC_ERROR,
SC_ERR_UNIFIED2_ALERT_GENERIC_ERROR,
SC_ERR_ADDRESS_ENGINE_GENERIC,
SC_ERR_FAST_LOG_GENERIC,
SC_ERR_DEBUG_LOG_GENERIC,
SC_ERR_UNIFIED_LOG_GENERIC,
SC_ERR_HTTP_LOG_GENERIC,
SC_ERR_UNIFIED_ALERT_GENERIC,
SC_ERR_UNIFIED2_ALERT_GENERIC,
SC_ERR_FWRITE,
SC_ERR_THRESHOLD_HASH_ADD,
SC_ERR_UNDEFINED_VAR,
......
SC_ERR_OFFSET_MISSING_CONTENT,
SC_ERR_DEPTH_MISSING_CONTENT,
SC_ERR_NO_URICONTENT_NEGATION,
SC_ERR_FOPEN_ERROR,
SC_ERR_HASH_TABLE_INIT_FAILED,
SC_ERR_STAT_ERROR,
SC_ERR_HASH_TABLE_INIT,
SC_ERR_STAT,
SC_ERR_LOGDIR_CONFIG,
SC_ERR_LOGDIR_CMDLINE,
SC_ERR_RADIX_TREE_GENERIC_ERROR,
SC_ERR_RADIX_TREE_GENERIC,
SC_ERR_MISSING_QUOTE,
SC_ERR_MUTEX,
SC_ERR_REPUTATION_INVALID_OPERATION,
src/util-radix-tree.c
if ( (prefix = SCRadixCreatePrefix(key_stream, key_bitlen, user,
netmask)) == NULL) {
SCLogError(SC_ERR_RADIX_TREE_GENERIC_ERROR, "Error creating prefix");
SCLogError(SC_ERR_RADIX_TREE_GENERIC, "Error creating prefix");
return NULL;
}
(2-2/2)