diff options
author | Eric Leblond <eric@inl.fr> | 2008-06-12 11:15:14 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2008-06-12 11:15:14 +0200 |
commit | 2ea1541ce5bd9ca035d13a5ec778c555b9cb2069 (patch) | |
tree | 24017f7fb59c5643167c71727488518aff9ca8a5 /filter/ulogd_filter_PWSNIFF.c | |
parent | 015849995f7f99f344ece11748a6e7b36ce07dd7 (diff) |
Use ULOGD_IRET_* as return for all interpreters
This patch modifies plugins to use the already defined but not used
define. This also fixes some weird behaviours in error treatment (like
not stopping after OOM).
Signed-off-by: Eric Leblond <eric@inl.fr>
Diffstat (limited to 'filter/ulogd_filter_PWSNIFF.c')
-rw-r--r-- | filter/ulogd_filter_PWSNIFF.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/filter/ulogd_filter_PWSNIFF.c b/filter/ulogd_filter_PWSNIFF.c index 2efc07d..95d92b5 100644 --- a/filter/ulogd_filter_PWSNIFF.c +++ b/filter/ulogd_filter_PWSNIFF.c @@ -70,7 +70,7 @@ static int interp_pwsniff(struct ulogd_pluginstance *pi) int len, pw_len, i, cont = 0; if (!IS_VALID(pi->input.keys[0])) - return 0; + return ULOGD_IRET_STOP; iph = (struct iphdr *) pi->input.keys[0].u.value.ptr; protoh = (u_int32_t *)iph + iph->ihl; @@ -81,7 +81,7 @@ static int interp_pwsniff(struct ulogd_pluginstance *pi) begp = pw_begp = NULL; if (iph->protocol != IPPROTO_TCP) - return 0; + return ULOGD_IRET_STOP; for (i = 0; i < ARRAY_SIZE(pwsniff_ports); i++) { @@ -91,7 +91,7 @@ static int interp_pwsniff(struct ulogd_pluginstance *pi) } } if (!cont) - return 0; + return ULOGD_IRET_STOP; DEBUGP("----> pwsniff detected, tcplen=%d, struct=%d, iphtotlen=%d, " "ihl=%d\n", tcplen, sizeof(struct tcphdr), ntohs(iph->tot_len), @@ -120,7 +120,7 @@ static int interp_pwsniff(struct ulogd_pluginstance *pi) ret[0].flags |= ULOGD_RETF_VALID; if (!ret[0].u.value.ptr) { ulogd_log(ULOGD_ERROR, "OOM (size=%u)\n", len); - return 0; + return ULOGD_IRET_ERR; } strncpy((char *) ret[0].u.value.ptr, (char *)begp, len); *((char *)ret[0].u.value.ptr + len) = '\0'; @@ -130,13 +130,13 @@ static int interp_pwsniff(struct ulogd_pluginstance *pi) ret[1].flags |= ULOGD_RETF_VALID; if (!ret[1].u.value.ptr){ ulogd_log(ULOGD_ERROR, "OOM (size=%u)\n", pw_len); - return 0; + return ULOGD_IRET_ERR; } strncpy((char *)ret[1].u.value.ptr, (char *)pw_begp, pw_len); *((char *)ret[1].u.value.ptr + pw_len) = '\0'; } - return 0; + return ULOGD_IRET_OK; } static struct ulogd_key pwsniff_inp[] = { |