Description: <short summary of the patch>
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 it.
 .
 ettercap (1:0.8.0-3) unstable; urgency=medium
 .
   * Install /usr/bin/ettercap not /usr/sbin/ for non-root log analysis
   * Disable LUA support
Author: Barak A. Pearlmutter <bap@debian.org>

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: http://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- ettercap-0.8.0.orig/CMakeLists.txt
+++ ettercap-0.8.0/CMakeLists.txt
@@ -19,7 +19,7 @@ option(LIBRARY_BUILD "Build for libetter
 option(INSTALL_DESKTOP "Install ettercap desktop files" ON)
 
 
-SET(VALID_BUILD_TYPES Debug Release)
+SET(VALID_BUILD_TYPES Debug Release RelWithDebInfo)
 
 if(NOT CMAKE_BUILD_TYPE)
   # Default to using "Release" as our build type.
--- ettercap-0.8.0.orig/cmake/Modules/EttercapLibCheck.cmake
+++ ettercap-0.8.0/cmake/Modules/EttercapLibCheck.cmake
@@ -1,6 +1,7 @@
 ## The easy part
 
 set(EC_LIBS)
+set(EC_LIBETTERCAP_LIBS)
 set(EC_INCLUDE)
 
 set(EF_LIBS)
@@ -41,6 +42,7 @@ if(ENABLE_GTK)
 	find_library(FOUND_GTHREAD gthread-2.0)
     	if(FOUND_GTHREAD)
 		set(EC_LIBS ${EC_LIBS} ${FOUND_GTHREAD})
+		set(EC_LIBETTERCAP_LIBS ${EC_LIBETTERCAP_LIBS} ${FOUND_GTHREAD})
     	endif(FOUND_GTHREAD)
     else(OS_DARWIN)
         set(EC_LIBS ${EC_LIBS} gthread-2.0)
@@ -51,6 +53,7 @@ if(ENABLE_SSL)
     find_package(OpenSSL REQUIRED)
     set(HAVE_OPENSSL 1)
     set(EC_LIBS ${EC_LIBS} ${OPENSSL_LIBRARIES})
+    set(EC_LIBETTERCAP_LIBS ${EC_LIBETTERCAP_LIBS} ${OPENSSL_LIBRARIES})
     set(EC_INCLUDE ${EC_INCLUDE} ${OPENSSL_INCLUDE_DIR})
 else(ENABLE_SSL)
     set(HAVE_OPENSSL 0)
@@ -58,6 +61,7 @@ endif(ENABLE_SSL)
 
 find_package(ZLIB REQUIRED)
 set(EC_LIBS ${EC_LIBS} ${ZLIB_LIBRARIES})
+set(EC_LIBETTERCAP_LIBS ${EC_LIBETTERCAP_LIBS} ${ZLIB_LIBRARIES})
 set(EC_INCLUDE ${EC_INCLUDE} ${ZLIB_INCLUDE_DIRS})
 set(EL_LIBS ${EL_LIBS} ${ZLIB_LIBRARIES})
 
@@ -65,6 +69,7 @@ set(CMAKE_THREAD_PREFER_PTHREAD 1)
 find_package(Threads REQUIRED)
 if(CMAKE_USE_PTHREADS_INIT)
     set(EC_LIBS ${EC_LIBS} ${CMAKE_THREAD_LIBS_INIT})
+    set(EC_LIBETTERCAP_LIBS ${EC_LIBETTERCAP_LIBS} ${CMAKE_THREAD_LIBS_INIT})
     set(EF_LIBS ${EF_LIBS} ${CMAKE_THREAD_LIBS_INIT})
     set(EL_LIBS ${EL_LIBS} ${CMAKE_THREAD_LIBS_INIT})
 else(CMAKE_USE_PTHREADS_INIT)
@@ -84,6 +89,8 @@ if(NOT HAVE_UTF8)
     if(HAVE_ICONV)
         set(HAVE_UTF8 1)
         set(EC_LIBS ${EC_LIBS} ${HAVE_ICONV})
+# Not needed the next one?
+        set(EC_LIBETTERCAP_LIBS ${EC_LIBETTERCAP_LIBS} ${HAVE_ICONV})
         set(EL_LIBS ${EL_LIBS} ${HAVE_ICONV})
     endif(HAVE_ICONV)
 endif(NOT HAVE_UTF8)
@@ -104,6 +111,7 @@ if(ENABLE_PLUGINS)
         if(HAVE_DL)
             set(HAVE_PLUGINS 1)
             set(EC_LIBS ${EC_LIBS} ${HAVE_DL})
+            set(EC_LIBETTERCAP_LIBS ${EC_LIBETTERCAP_LIBS} ${HAVE_DL})
         endif(HAVE_DL)
     endif(HAVE_DLOPEN)
 endif(ENABLE_PLUGINS)
@@ -151,6 +159,7 @@ CHECK_FUNCTION_EXISTS(strndup HAVE_STRND
 find_library(HAVE_PCAP pcap)
 if(HAVE_PCAP)
     set(EC_LIBS ${EC_LIBS} ${HAVE_PCAP})
+    set(EC_LIBETTERCAP_LIBS ${EC_LIBETTERCAP_LIBS} ${HAVE_PCAP})
 else(HAVE_PCAP)
     message(FATAL_ERROR "libpcap not found!")
 endif(HAVE_PCAP)
@@ -190,12 +199,13 @@ endif(NOT LIBNET_FOUND)
 
 include_directories(${LIBNET_INCLUDE_DIR})
 set(EC_LIBS ${EC_LIBS} ${LIBNET_LIBRARY})
-
+set(EC_LIBETTERCAP_LIBS ${EC_LIBETTERCAP_LIBS} ${LIBNET_LIBRARY})
 # end LIBNET 
 
 find_library(HAVE_RESOLV resolv)
 if(HAVE_RESOLV)
 	set(EC_LIBS ${EC_LIBS} ${HAVE_RESOLV})
+        set(EC_LIBETTERCAP_LIBS ${EC_LIBETTERCAP_LIBS} ${HAVE_RESOLV})
 	set(HAVE_DN_EXPAND 1 CACHE PATH "Found dn_expand")
 endif(HAVE_RESOLV)
 
@@ -204,5 +214,6 @@ if(PCRE_LIBRARY)
     set(HAVE_PCRE 1)
     include_directories(${PCRE_INCLUDE_DIR})
     set(EC_LIBS ${EC_LIBS} ${PCRE_LIBRARY})
+    set(EC_LIBETTERCAP_LIBS ${EC_LIBETTERCAP_LIBS} ${PCRE_LIBRARY})
     set(EF_LIBS ${EF_LIBS} ${PCRE_LIBRARY})
 endif(PCRE_LIBRARY)
--- ettercap-0.8.0.orig/include/ef_functions.h
+++ ettercap-0.8.0/include/ef_functions.h
@@ -25,7 +25,7 @@ EF_API_EXTERN void test_filter(char *fil
 EF_API_EXTERN void print_fop(struct filter_op *fop, u_int32 eip);
 
 /* ef_syntax && ef_grammar */
-EF_API_EXTERN int yyerror(char *);                                                                         
+EF_API_EXTERN int yyerror(const char *);                                                                         
 EF_API_EXTERN int yylex(void);
 
 /* ef_tables */
--- ettercap-0.8.0.orig/src/CMakeLists.txt
+++ ettercap-0.8.0/src/CMakeLists.txt
@@ -115,9 +115,6 @@ set(EC_SRC
         protocols/ec_wifi_radiotap.c
 )
 
-if (NOT LIBRARY_BUILD)
-	set(EC_SRC ${EC_SRC} ec_interfaces.c)
-endif(NOT LIBRARY_BUILD)
 
 if(ENABLE_IPV6)
     set(EC_SRC ${EC_SRC} protocols/ec_icmp6.c protocols/ec_ip6.c mitm/ec_ip6nd_poison.c)
@@ -173,10 +170,8 @@ endif(NOT LIBRARY_BUILD)
 
 add_library(lib_ettercap SHARED ${EC_SRC})
 add_dependencies(lib_ettercap libnet)
+target_link_libraries(lib_ettercap ${EC_LIBETTERCAP_LIBS})
 
-if (NOT LIBRARY_BUILD)
-	add_executable(ettercap ec_main.c)
-endif(NOT LIBRARY_BUILD)
 
 # Only compile lua stuff if lua is enabled!
 IF(ENABLE_LUA)
@@ -194,21 +189,24 @@ IF(ENABLE_LUA)
   endif()
 endif(ENABLE_LUA)
 
-if(NOT LIBRARY_BUILD)
-	target_link_libraries(lib_ettercap ec_interfaces ${EC_LIBS})
-else(NOT LIBRARY_BUILD)
-	target_link_libraries(lib_ettercap ${EC_LIBS})
-endif(NOT LIBRARY_BUILD)
+#if(NOT LIBRARY_BUILD)
+	#target_link_libraries(lib_ettercap ec_interfaces ${EC_LIBS})
+#else(NOT LIBRARY_BUILD)
+	#target_link_libraries(lib_ettercap ${EC_LIBS})
+#endif(NOT LIBRARY_BUILD)
 
 set_target_properties(lib_ettercap PROPERTIES 
   ENABLE_EXPORTS On
   LINK_INTERFACE_LIBRARIES ""
   #  INSTALL_RPATH ${INSTALL_LIBDIR}
   OUTPUT_NAME ettercap
+  VERSION 0.0.1
+  SOVERSION 0
   )
 
 if (NOT LIBRARY_BUILD)
-	target_link_libraries(ettercap lib_ettercap)
+	add_executable(ettercap ec_interfaces.c ec_main.c)
+	target_link_libraries(ettercap ec_interfaces lib_ettercap)
 	set_target_properties(ettercap PROPERTIES 
   	INSTALL_RPATH ${INSTALL_LIBDIR}
   	)
--- ettercap-0.8.0.orig/src/ec_encryption.c
+++ ettercap-0.8.0/src/ec_encryption.c
@@ -205,14 +205,14 @@ int set_wep_key(char *string)
 
    /* sanity check */
    if (bit <= 0)
-      SEMIFATAL_ERROR("Unsupported WEP key lenght");
+      SEMIFATAL_ERROR("Unsupported WEP key length");
 
    /* the len of the secret part of the RC4 seed */
    tmp_wkey_len = bit / 8 - WEP_IV_LEN;
 
    /* sanity check */
    if (bit != 64 && bit != 128)
-	  SEMIFATAL_ERROR("Unsupported WEP key lenght");
+	  SEMIFATAL_ERROR("Unsupported WEP key length");
 
    /* get the type of the key */
    p = ec_strtok(NULL, ":", &tok);
@@ -227,7 +227,7 @@ int set_wep_key(char *string)
 	  SEMIFATAL_ERROR("Invalid parsing of the WEP key");
 
    if (type == 's') {
-      /* escape the string and check its lenght */
+      /* escape the string and check its length */
       if (strescape((char *)tmp_wkey, p) != (int)tmp_wkey_len)
     	  SEMIFATAL_ERROR("Specified WEP key length does not match the given string");
    } else if (type == 'p') {
--- ettercap-0.8.0.orig/src/interfaces/CMakeLists.txt
+++ ettercap-0.8.0/src/interfaces/CMakeLists.txt
@@ -71,6 +71,13 @@ if(ENABLE_GTK)
 endif(ENABLE_GTK)
 
 
-add_library(ec_interfaces STATIC ${EC_TEXT_SRC} ${EC_DAEMON_SRC} ${EC_WDG_SRC} ${EC_CURSES_SRC} ${EC_GTK_SRC})
+add_library(ec_interfaces STATIC ../ec_interfaces.c ${EC_TEXT_SRC} ${EC_DAEMON_SRC} ${EC_WDG_SRC} ${EC_CURSES_SRC} ${EC_GTK_SRC})
 SET_TARGET_PROPERTIES(ec_interfaces PROPERTIES COMPILE_FLAGS -fPIC)
 target_link_libraries(ec_interfaces ${EC_LIBS})
+set_target_properties(ec_interfaces PROPERTIES 
+  ENABLE_EXPORTS On
+  LINK_INTERFACE_LIBRARIES ""
+  #  INSTALL_RPATH ${INSTALL_LIBDIR}
+  OUTPUT_NAME ec_interfaces 
+  )
+
--- ettercap-0.8.0.orig/src/interfaces/curses/widgets/wdg.h
+++ ettercap-0.8.0/src/interfaces/curses/widgets/wdg.h
@@ -117,7 +117,11 @@ extern void wdg_bug(char *file, const ch
 #define KEY_RETURN   '\r'
 #define KEY_TAB      '\t'
 #define KEY_CTRL_L   12
+// CTRL() is defined in /usr/include/.../ttydefaults.h which is pulled
+// in by some long chain via /usr/include/libnet.h
+#ifndef CTRL
 #define CTRL(x)      ((x) & 0x1f)
+#endif
 #define KEY_ESC      CTRL('[')
 
 /* information about the current screen */
--- ettercap-0.8.0.orig/src/interfaces/curses/widgets/wdg_file.c
+++ ettercap-0.8.0/src/interfaces/curses/widgets/wdg_file.c
@@ -123,7 +123,7 @@ static int wdg_file_destroy(struct wdg_o
    /* dealloc the structures */
    delwin(ww->win);
    
-   /* restore the initial workind direcory */
+   /* restore the initial working directory */
    chdir(ww->initpath);
 
    WDG_SAFE_FREE(wo->extend);
--- ettercap-0.8.0.orig/src/interfaces/text/ec_text.c
+++ ettercap-0.8.0/src/interfaces/text/ec_text.c
@@ -554,18 +554,18 @@ static void text_stats(void)
    DEBUG_MSG("text_stats (queue) : %lu %lu", (unsigned long)GBL_STATS->queue_curr, (unsigned long)GBL_STATS->queue_max); 
   
    
-   fprintf(stdout, "\n Received packets    : %8lld\n", GBL_STATS->ps_recv);
-   fprintf(stdout,   " Dropped packets     : %8lld  %.2f %%\n", GBL_STATS->ps_drop,
+   fprintf(stdout, "\n Received packets    : %8llu\n", (long long unsigned int)GBL_STATS->ps_recv);
+   fprintf(stdout,   " Dropped packets     : %8llu  %.2f %%\n", (long long unsigned int)GBL_STATS->ps_drop,
          (GBL_STATS->ps_recv) ? (float)GBL_STATS->ps_drop * 100 / GBL_STATS->ps_recv : 0 );
-   fprintf(stdout,   " Forwarded           : %8lld  bytes: %8lld\n\n", GBL_STATS->ps_sent, GBL_STATS->bs_sent);
+   fprintf(stdout,   " Forwarded           : %8llu  bytes: %8llu\n\n", (long long unsigned int)GBL_STATS->ps_sent, (long long unsigned int)GBL_STATS->bs_sent);
    
    fprintf(stdout,   " Current queue len   : %lu/%lu\n", (unsigned long)GBL_STATS->queue_curr, (unsigned long)GBL_STATS->queue_max);
    fprintf(stdout,   " Sampling rate       : %d\n\n", GBL_CONF->sampling_rate);
    
-   fprintf(stdout,   " Bottom Half received packet : pck: %8lld  byte: %8lld\n", 
-         GBL_STATS->bh.pck_recv, GBL_STATS->bh.pck_size);
-   fprintf(stdout,   " Top Half received packet    : pck: %8lld  byte: %8lld\n", 
-         GBL_STATS->th.pck_recv, GBL_STATS->th.pck_size);
+   fprintf(stdout,   " Bottom Half received packet : pck: %8llu  byte: %8lld\n", 
+         (long long unsigned int)GBL_STATS->bh.pck_recv, GBL_STATS->bh.pck_size);
+   fprintf(stdout,   " Top Half received packet    : pck: %8llu  byte: %8lld\n", 
+         (long long unsigned int)GBL_STATS->th.pck_recv, GBL_STATS->th.pck_size);
    fprintf(stdout,   " Interesting packets         : %.2f %%\n\n",
          (GBL_STATS->bh.pck_recv) ? (float)GBL_STATS->th.pck_recv * 100 / GBL_STATS->bh.pck_recv : 0 );
 
--- ettercap-0.8.0.orig/src/lua/share/core/ettercap_ffi.lua
+++ ettercap-0.8.0/src/lua/share/core/ettercap_ffi.lua
@@ -135,17 +135,17 @@ struct packet_object {
        */
       size_t disp_len;
       u_char * disp_data;
-      /* for modified packet this is the delta for the lenght */
+      /* for modified packet this is the delta for the length */
       int delta;  
       size_t inject_len;      /* len of the injection */
       u_char *inject;         /* the fuffer used for injection */
 
    } DATA;
 
-   size_t fwd_len;         /* lenght of the packet to be forwarded */
+   size_t fwd_len;         /* length of the packet to be forwarded */
    u_char * fwd_packet;    /* the pointer to the buffer to be forwarded */
    
-   size_t len;             /* total lenght of the packet */
+   size_t len;             /* total length of the packet */
    u_char * packet;        /* the buffer containing the real packet */
 
    /* Trace current session for injector chain */
--- ettercap-0.8.0.orig/tests/CMakeLists.txt
+++ ettercap-0.8.0/tests/CMakeLists.txt
@@ -8,7 +8,7 @@ add_custom_target(test_verbose COMMAND $
 macro(_t NAME)
   add_executable(test_${NAME} test_${NAME}.c)
   add_dependencies(test_${NAME} bundled_check)
-  target_link_libraries(test_${NAME} lib_ettercap ${CHECK_LIBRARY})
+  target_link_libraries(test_${NAME} lib_ettercap ec_interfaces ${CHECK_LIBRARY})
   add_test(test_${NAME} ${CMAKE_CURRENT_BINARY_DIR}/test_${NAME})
 endmacro(_t NAME)
 
--- ettercap-0.8.0.orig/tests/check/CMakeLists.txt
+++ ettercap-0.8.0/tests/check/CMakeLists.txt
@@ -34,6 +34,8 @@ IF("${CMAKE_BUILD_TYPE}" STREQUAL "Debug
   SET(EXPORT_C_FLAGS "${EXPORT_C_FLAGS} ${CMAKE_C_FLAGS_DEBUG}")
 ELSEIF("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
   SET(EXPORT_C_FLAGS "${EXPORT_C_FLAGS} ${CMAKE_C_FLAGS_RELEASE}")
+ELSEIF("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
+  SET(EXPORT_C_FLAGS "${EXPORT_C_FLAGS} ${CMAKE_C_FLAGS_RELEASE}")
 ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
 
 SET(EXPORT_PREFIX ${CHECK_PREFIX})
--- ettercap-0.8.0.orig/utils/etterfilter/ef_grammar.y
+++ ettercap-0.8.0/utils/etterfilter/ef_grammar.y
@@ -412,7 +412,7 @@ struct {
  * This function is needed by bison. so it MUST exist.
  * It is the error handler.
  */
-int yyerror(char *s)  
+int yyerror(const char *s)  
 { 
    char *error;
    int i = 0;
