Commit bdc795b8 authored by 's avatar

Fixed cooking function to work with unmodified libnids (v1.21). Also added the...

Fixed cooking function to work with unmodified libnids (v1.21). Also added the appropriate checks in configure.ac.



git-svn-id: file:///home/svn/mapi/trunk@947 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent 44c44a43
......@@ -457,6 +457,84 @@ AS_HELP_STRING([--with-libdag=DIR], [Manual libdag path configuration, in case t
AC_SUBST(DAGINC)
AC_SUBST(DAGLIB)
#
# libnids >= 1.21 (only for --enable-extraflib)
#
echo " -----------LIBNIDS -------------------------------"
AC_ARG_WITH(libnids_includes,
AS_HELP_STRING([--with-libnids-includes=DIR], [Search for libnids headers in DIR. Effective only if --enable-extraflib has been previously specified]),
[with_libnids_includes="$withval"],[with_libnids_includes=no])
AC_ARG_WITH(libnids_libraries,
AS_HELP_STRING([--with-libnids-libraries=DIR], [Search for libnids library in DIR. Effective only if --enable-extraflib has been previously specified]),
[with_libnids_libraries="$withval"],[with_libnids_libraries=no])
#If any of the above libnids options has been specified,
#check that --enable-extraflib has been specified too
if test x$extraflib != xtrue; then
if test "$with_libnids_includes" != "no"; then
AC_MSG_ERROR(Please use --with-libnids-includes only in conjunction with --with-extraflib. You don't need to configure libnids if you are not going to use it)
fi
if test "$with_libnids_libraries" != "no"; then
AC_MSG_ERROR(Please use --with-libnids-libraries only in conjunction with --with-extraflib. You don't need configure libnids if you are not going to use it)
fi
fi
if test x$extraflib = xtrue; then
echo " with extraflib, looking for nids... "
save_CPPFLAGS=$CPPFLAGS
save_LDFLAGS=$LDFLAGS
save_LIBS=$LIBS
if test "$with_libnids_includes" != "no"; then
NIDSINC="-I${with_libnids_includes}"
CPPFLAGS="${CPPFLAGS} ${NIDSINC}"
fi
if test "$with_libnids_libraries" != "no"; then
NIDSLIB="-L${with_libnids_libraries} "
fi
NIDSLIB="${NIDSLIB} -lnids"
LDFLAGS="${LDFLAGS} ${NIDSLIB}"
echo ${LDFLAGS}
echo ${CPPFLAGS}
# Verify that we have the headers
NIDS_H=""
AC_CHECK_HEADER(nids.h,, NIDS_H="no")
if test "$NIDS_H" = "no"; then
echo " ERROR! Libnids header not found, go get it "
exit 1
fi
# Verify that we have the library
#if test -f "${with_libnids_libraries}/libnids.a"; then
# echo "libnids.a exists"
#else
# echo "libnids.a does not exist"
#fi
NIDS_L=""
AC_CHECK_LIB(nids, nids_pcap_handler, ,NIDS_L="no")
if test "$NIDS_L" = "no"; then
echo " ERROR! Libnids library not found or < 1.21 , go get it"
exit 1
fi
CPPFLAGS=$save_CPPFLAGS
LDFLAGS=$save_LDFLAGS
LIBS=$save_LIBS
AC_SUBST(NIDSINC)
AC_SUBST(NIDSLIB)
fi
echo " ----------------------END LIBNIDS---------------------------------"
#end of libnids ...
#
# libpcre (only for --enable-extraflib) - based on Snort's configure.in
#
......@@ -648,7 +726,6 @@ AC_CONFIG_FILES([
src/anonflib/Makefile
src/dagflib/Makefile
src/extraflib/Makefile
src/extraflib/libnids/Makefile
doc/Makefile
etc/Makefile
etc/mapi.conf
......
SUBDIRS = libnids
AM_CPPFLAGS = -I$(srcdir)/.. -I$(srcdir)/../lib -I$(srcdir)/../common -I$(srcdir)/../drivers @PCAPINC@ @PCREINC@ -D_GNU_SOURCE -D_THREAD_SAFE
#SUBDIRS = libnids
AM_CPPFLAGS = -I$(srcdir)/.. -I$(srcdir)/../lib -I$(srcdir)/../common -I$(srcdir)/../drivers @PCAPINC@ @NIDSINC@ @PCREINC@ -D_GNU_SOURCE -D_THREAD_SAFE
# install extraflib into $(prefix)/share/mapi/
libdir = $(pkgdatadir)
......@@ -7,10 +7,10 @@ libdir = $(pkgdatadir)
lib_LTLIBRARIES = extraflib.la
extraflib_la_LDFLAGS = -module
extraflib_la_LIBADD = \
libnids/libnids.la \
../common/libflist.la \
../common/libfhelp.la \
../common/libmapiipc.la @PCAPLIB@ @PCRELIB@ -lm
../common/libmapiipc.la @PCAPLIB@ @PCRELIB@ -lm \
@NIDSLIB@
extraflib_la_SOURCES = \
cooking.c cooking.h \
extraflib.c \
......
This diff is collapsed.
......@@ -4,24 +4,22 @@
#include "mapidlib.h"
#include "protocols.h"
#include "libnids/nids.h"
typedef unsigned char byte;
struct cooking_data
{
// cooking args
int threshold;
int timeout;
int ret_once;
enum cooking_direction collect;
// int id;
nids_instance_t *ni;
/* DEL
mapid_pkthdr_t *mod_pkt_head;
unsigned char *mod_pkt;
unsigned int mod_pkt_size;
*/
unsigned char *server_mod_pkt;
mapid_pkthdr_t server_mod_pkt_head;
flist_t *client_headers;
......@@ -36,6 +34,7 @@ struct cooking_data
int server_ready;
char keep_headers;
//shared (uncook)
char uncook_ready;
void *decoded_packet;
char cooked;
......
......@@ -67,7 +67,7 @@ DOT;
}
DOT;
if(mapi_apply_function(fd,"COOKING",100000,10)<0){
if(mapi_apply_function(fd,"COOKING",100000,10,0,BOTH_SIDE)<0){
fprintf(stderr, "Could not apply COOKING to flow %d\n", fd);
mapi_read_error(&err_no, error);
fprintf(stderr,"Erorcode :%d description: %s \n" ,err_no, error);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment