]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #943 in SNORT/snort3 from tweax to master
authorRuss Combs (rucombs) <rucombs@cisco.com>
Mon, 3 Jul 2017 21:22:39 +0000 (17:22 -0400)
committerRuss Combs (rucombs) <rucombs@cisco.com>
Mon, 3 Jul 2017 21:22:39 +0000 (17:22 -0400)
Squashed commit of the following:

commit 07b8138db8dad5fad3153345e1049fa8119e433e
Author: Russ Combs <rucombs@cisco.com>
Date:   Mon Jul 3 14:58:07 2017 -0400

    doc: boast about json

commit e51ede6c6448d24484bc410346c33a681376f057
Author: Russ Combs <rucombs@cisco.com>
Date:   Mon Jul 3 14:57:25 2017 -0400

    cppcheck: remove cruft

commit 9af73dd88bbbcbab10395c3ddfefae557adf507b
Author: Russ Combs <rucombs@cisco.com>
Date:   Mon Jul 3 14:54:13 2017 -0400

    cppcheck: fix warnings

47 files changed:
doc/differences.txt
src/detection/tag.cc
src/detection/tag.h
src/file_api/file_capture.cc
src/file_api/file_capture.h
src/file_api/file_flows.cc
src/file_api/file_flows.h
src/file_api/file_identifier.cc
src/file_api/file_identifier.h
src/file_api/file_lib.cc
src/file_api/file_lib.h
src/filters/detection_filter.cc
src/filters/detection_filter.h
src/filters/rate_filter.cc
src/filters/rate_filter.h
src/filters/sfthd.cc
src/filters/sfthreshold.cc
src/filters/sfthreshold.h
src/hash/sfxhash.cc
src/hash/sfxhash.h
src/log/messages.cc
src/log/messages.h
src/mime/file_mime_config.cc
src/mime/file_mime_config.h
src/parser/parse_ports.cc
src/parser/parser.h
src/parser/vars.cc
src/parser/vars.h
src/service_inspectors/dce_rpc/dce_list.cc
src/service_inspectors/dce_rpc/dce_list.h
src/service_inspectors/ftp_telnet/ft_main.cc
src/service_inspectors/ftp_telnet/ft_main.h
src/service_inspectors/sip/sip_utils.cc
src/service_inspectors/sip/sip_utils.h
src/stream/stream.cc
src/stream/stream.h
src/stream/tcp/tcp_session.cc
src/stream/tcp/tcp_stream_config.cc
src/stream/tcp/tcp_stream_config.h
src/utils/kmap.cc
src/utils/kmap.h
src/utils/sflsq.cc
src/utils/sflsq.h
src/utils/sfmemcap.cc
src/utils/sfmemcap.h
src/utils/util_jsnorm.cc
src/utils/util_jsnorm.h

index e5a605f788217c84864966e8fef8e306a08a9cc8..9f732b6cf72c8f576888c581243ecf388d7785e2 100644 (file)
@@ -13,7 +13,7 @@ Snort 3 differs from Snort 2 in the following ways:
 Some things Snort++ can do today that Snort can not do:
 
 * regex fast patterns, not just literals
-* FlatBuffers perf monitor logs
+* FlatBuffers and JSON perf monitor logs
 * LuaJIT scriptable rule options and loggers
 * pub/sub inspection events (currently used by sip and http to appid)
 * JIT buffer stuffers (notably with new http_inspect)
index 0bfe1848bd097ca1a53c49abc20b51f3b7b752a7..3c6dfda3543a8adf8af77f7f0dc8cc0bcb7d70d2 100644 (file)
@@ -243,14 +243,6 @@ static int TagFreeHostNodeFunc(void*, void* data)
     return 0;
 }
 
-/**Reset all data structures and free all memory.
- */
-void TagCacheReset()
-{
-    sfxhash_make_empty(ssn_tag_cache_ptr);
-    sfxhash_make_empty(host_tag_cache_ptr);
-}
-
 /**
  * swap the sips and dips, dp's and sp's
  *
index 8c6b0f0ba4c0022741cec028889d9c0532ebcea9..40037cc55faf6405e7028e2709ce57d75b6cd94a 100644 (file)
@@ -58,7 +58,6 @@ void InitTag();
 void CleanupTag();
 int CheckTagList(Packet*, Event&, void**);
 void SetTags(Packet*, const OptTreeNode*, uint16_t);
-void TagCacheReset();
 
-#endif /* TAG_H */
+#endif
 
index d0708634b5c298d0f5aba7a87bf4e32dc2f1bdf4..ec70481737aed927a5224797e064155795620efe 100644 (file)
@@ -434,12 +434,6 @@ FileCaptureBlock* FileCapture::get_file_data(uint8_t** buff, int* size)
     return (current_block);
 }
 
-// Get the file size captured in the file buffer
-uint64_t FileCapture::get_capture_size() const
-{
-    return capture_size;
-}
-
 /*
  * writing file data to the disk.
  *
index 62105657768cd8a0f168c9688ebf641b62fb78c6..9c3540c15135158d1501f8dddde17cc7b0f8549b 100644 (file)
@@ -74,10 +74,6 @@ public:
     //   nullptr: end of file or fail to get file
     FileCaptureBlock* get_file_data(uint8_t** buff, int* size);
 
-    // Get the file size captured in the file buffer
-    // Returns:  the size of file in bytes
-    uint64_t get_capture_size() const;
-
     // Store files on local disk
     void store_file();
 
index 7db2b0bc078d9874468c3555f5bf357a72356cf6..5024ade1d1d3a933391d7c61410842e9e0c0055f 100644 (file)
@@ -56,13 +56,6 @@ FileFlows* FileFlows::get_file_flows(Flow* flow)
     return fd;
 }
 
-void FileFlows::save_to_pending_context()
-{
-    if (pending_context != main_context)
-        delete(pending_context);
-    pending_context = main_context;
-}
-
 void FileFlows::set_current_file_context(FileContext* ctx)
 {
     current_context = ctx;
index beb4202bcc5a016b13fe4b283dd2a71a3916d62c..9e8ff5109caa8d4eebb6b6345b595236c5781839 100644 (file)
@@ -73,7 +73,6 @@ public:
     static unsigned flow_id;
 
 private:
-    void save_to_pending_context();
     void init_file_context(FileDirection, FileContext*);
     FileContext* find_main_file_context(FilePosition, FileDirection, size_t id = 0);
     FileContext* main_context = nullptr;
index dc8c8d20e9ba5329699e865a25732ca9e7f63de0..7ade9109343d16cb14d86663f2fb52eb9534dafe 100644 (file)
@@ -138,16 +138,6 @@ IdentifierNode* FileIdentifier::clone_node(IdentifierNode* start)
     return node;
 }
 
-void FileIdentifier::verify_magic_offset(FileMagicData* parent, FileMagicData* current)
-{
-    if ((parent) && (parent->content.size() + parent->offset > current->offset))
-    {
-        ParseError("magic content at offset %u overlaps with offset %u.",
-            parent->offset, current->offset);
-        return;
-    }
-}
-
 IdentifierNode* FileIdentifier::create_trie_from_magic(FileMagicRule& rule, uint32_t type_id)
 {
     IdentifierNode* current;
index 6846b7a7741ce402879e62a9c1a7664cde2c5088..dda13044cf52d25d8e5807e5df3b84ce75fed65f 100644 (file)
@@ -95,7 +95,6 @@ private:
     void* calloc_mem(size_t size);
     void set_node_state_shared(IdentifierNode* start);
     IdentifierNode* clone_node(IdentifierNode* start);
-    void verify_magic_offset(FileMagicData* parent, FileMagicData* current);
     bool update_next(IdentifierNode* start, IdentifierNode** next_ptr, IdentifierNode* append);
     IdentifierNode* create_trie_from_magic(FileMagicRule& rule, uint32_t type_id);
     void update_trie(IdentifierNode* start, IdentifierNode* append);
index 3512b078c7fc939c4b1b633272d95c1a292f88a6..cbfc80089395b616cb56313999ed4378e51bdafd 100644 (file)
@@ -137,11 +137,6 @@ FileDirection FileInfo::get_file_direction() const
     return direction;
 }
 
-void FileInfo::set_file_sig_sha256(uint8_t* signature)
-{
-    sha256 = signature;
-}
-
 uint8_t* FileInfo::get_file_sig_sha256() const
 {
     return (sha256);
index 1fcac22fe4702fdd8bf41d8707d6b060dcb209b2..25ab059e5c6231074ba7aacb78a5bbdaef3b805f 100644 (file)
@@ -56,7 +56,6 @@ public:
     uint64_t get_file_size() const;
     void set_file_direction(FileDirection dir);
     FileDirection get_file_direction() const;
-    void set_file_sig_sha256(uint8_t* signature);
     uint8_t* get_file_sig_sha256() const;
     std::string sha_to_string(const uint8_t* sha256);
     void set_file_id(size_t index);
index 38796b73c45b3bd00eaa213b6f71b35ff8e17e09..2484024603f41650f2b40cc208ebdc57b2cd9ec0 100644 (file)
@@ -66,15 +66,6 @@ int detection_filter_test(
         sip, dip, curtime);
 }
 
-/* empty out active entries */
-void detection_filter_reset_active()
-{
-    if (detection_filter_hash == NULL)
-        return;
-
-    sfxhash_make_empty(detection_filter_hash);
-}
-
 THD_NODE* detection_filter_create(DetectionFilterConfig* df_config, THDX_STRUCT* thdx)
 {
     if (df_config == NULL)
index 2a202e9c2132c38cd0277327ab4ba6a2d3d301a1..0407e50947cd8585767ee824298f0b35217a6754 100644 (file)
@@ -45,7 +45,6 @@ void detection_filter_init(DetectionFilterConfig*);
 void detection_filter_term();
 
 void detection_filter_print_config(DetectionFilterConfig*);
-void detection_filter_reset_active();
 
 int detection_filter_test(void*, const SfIp* sip, const SfIp* dip, long curtime);
 struct THD_NODE* detection_filter_create(DetectionFilterConfig*, struct THDX_STRUCT*);
index c3c356e8e4a0446e6bfc523c07e8a2c17687a81b..1f45482693d271daa18ed70ac309a00a2ac50155 100644 (file)
@@ -149,12 +149,6 @@ int RateFilter_Test(
         p->pkth->ts.tv_sec, SFRF_COUNT_INCREMENT);
 }
 
-/* empty out active entries */
-void RateFilter_ResetActive()
-{
-    SFRF_Flush();
-}
-
 void RateFilter_PrintConfig(RateFilterConfig*)
 {
     // FIXIT-L print from module
index 817db97d629f08f5c0223d1646d8a11088ea23c8..821ac6327fbcb45faa59c68ea425d79333f3338b 100644 (file)
@@ -39,7 +39,6 @@ int RateFilter_Create(SnortConfig* sc, RateFilterConfig*, tSFRFConfigNode*);
 void RateFilter_PrintConfig(RateFilterConfig*);
 
 int RateFilter_Test(const OptTreeNode*, Packet*);
-void RateFilter_ResetActive();
 
 #endif
 
index 6915949a803af5138ec73529fbec530e2209fdbb..98ce8bed59ad079d390308ef38f379b563f7c102 100644 (file)
@@ -867,7 +867,7 @@ int sfthd_test_local(
 #ifdef THD_DEBUG
     char buf[24];
     printf("THD_DEBUG: Key THD_NODE IP=%s,",
-        printIP((unsigned)sfthd_node->ip_address), buf, sizeof(buf) );
+        printIP((unsigned)sfthd_node->ip_address, buf, sizeof(buf)) );
     printf(" MASK=%s\n", printIP((unsigned)sfthd_node->ip_mask, buf, sizeof(buf)) );
     printf("THD_DEBUG:        PKT  SIP=%s\n", printIP((unsigned)sip, buf, sizeof(buf)) );
     printf("THD_DEBUG:        PKT  DIP=%s\n", printIP((unsigned)dip, buf, sizeof(buf)) );
index 208efc09a133a3791b472b295e832b7fa8ae04eb..7e6520d28d62eb056e2482148be18925043cc074 100644 (file)
@@ -342,16 +342,3 @@ void sfthreshold_reset()
     thd_checked = 0;
 }
 
-/* empty out active entries */
-void sfthreshold_reset_active()
-{
-    if (thd_runtime == NULL)
-        return;
-
-    if (thd_runtime->ip_nodes != NULL)
-        sfxhash_make_empty(thd_runtime->ip_nodes);
-
-    if (thd_runtime->ip_gnodes != NULL)
-        sfxhash_make_empty(thd_runtime->ip_gnodes);
-}
-
index e7d432c690a076cdec46eef8f74bfe761a2e1849..061a101bc85d97bb841d6a16ab7bf727621611a8 100644 (file)
@@ -37,7 +37,6 @@ void sfthreshold_reset();
 int sfthreshold_create(struct SnortConfig*, ThresholdConfig*, THDX_STRUCT*);
 int sfthreshold_test(unsigned int, unsigned int, const SfIp*, const SfIp*, long curtime);
 void print_thresholding(ThresholdConfig*, unsigned shutdown);
-void sfthreshold_reset_active();
 void sfthreshold_free();
 
 #endif
index ff0391d97b9844165d4eb646146e9f31ed087a74..46bae24d080af5648b136f70e016a8b3d0bd66ee 100644 (file)
@@ -114,19 +114,6 @@ static inline void s_free(SFXHASH* t, void* p)
     sfmemcap_free(&t->mc, p);
 }
 
-/*
- *   User access to the memory management, do they need it ? WaitAndSee
- */
-void* sfxhash_alloc(SFXHASH* t, unsigned nbytes)
-{
-    return s_alloc(t, nbytes);
-}
-
-void sfxhash_free(SFXHASH* t, void* p)
-{
-    s_free(t, p);
-}
-
 static int sfxhash_nearest_powerof2(int nrows)
 {
     nrows -= 1;
@@ -137,12 +124,6 @@ static int sfxhash_nearest_powerof2(int nrows)
     return nrows;
 }
 
-int sfxhash_calcrows(int num)
-{
-    return sfxhash_nearest_powerof2(num);
-//  return sf_nearest_prime( nrows );
-}
-
 /*
  * Create a new hash table
  *
@@ -249,18 +230,6 @@ void sfxhash_set_max_nodes(SFXHASH* h, int max_nodes)
     }
 }
 
-/*!
- *  Set Splay mode : Splays nodes to front of list on each access
- *
- * t SFXHASH table pointer
- * n boolean flag toggles splaying of hash nodes
- *
- */
-void sfxhash_splaymode(SFXHASH* t, int n)
-{
-    t->splay = n;
-}
-
 /*!
  *  Free all nodes in the free list
  *
@@ -837,23 +806,6 @@ SFXHASH_NODE* sfxhash_ghead(SFXHASH* t)
     return nullptr;
 }
 
-/**
- * Walk the global list
- *
- * n current node
- *
- * return the next node in the list or nullptr when at the end
- */
-SFXHASH_NODE* sfxhash_gnext(SFXHASH_NODE* n)
-{
-    if (n)
-    {
-        return n->gnext;
-    }
-
-    return nullptr;
-}
-
 /**
  * Walk the global list
  *
@@ -925,74 +877,6 @@ void* sfxhash_lru(SFXHASH* t)
     return nullptr;
 }
 
-/*!
- * Return the most recently used node from the global list
- *
- * t SFXHASH table pointer
- *
- * return SFXHASH_NODE*   valid pointer to a node
- * retval 0       node not found
- *
- */
-SFXHASH_NODE* sfxhash_mru_node(SFXHASH* t)
-{
-    SFXHASH_NODE* hnode = sfxhash_ghead(t);
-    if ( hnode )
-        return hnode;
-
-    return nullptr;
-}
-
-/*!
- * Return the least recently used node from the global list
- *
- * t SFXHASH table pointer
- *
- * return SFXHASH_NODE*   valid pointer to a node
- * retval 0       node not found
- *
- */
-SFXHASH_NODE* sfxhash_lru_node(SFXHASH* t)
-{
-    SFXHASH_NODE* hnode = t->gtail;
-    if ( hnode )
-        return hnode;
-
-    return nullptr;
-}
-
-/*!
- * Get some hash table statistics. NOT FOR REAL TIME USE.
- *
- *
- * t SFXHASH table pointer
- * param filled how many
- *
- * return max depth of the table
- *
- */
-unsigned sfxhash_maxdepth(SFXHASH* t)
-{
-    unsigned max_depth = 0;
-
-    SFXHASH_NODE* hnode;
-
-    for ( unsigned i = 0; i < t->nrows; i++ )
-    {
-        unsigned cur_depth = 0;
-
-        for (hnode = t->table[i]; hnode != nullptr; hnode = hnode->next)
-        {
-            cur_depth++;
-        }
-
-        if (cur_depth > max_depth)
-            max_depth = cur_depth;
-    }
-
-    return max_depth;
-}
-
 /*
  *  Unlink and free the node
  */
@@ -1152,16 +1036,6 @@ int sfxhash_set_keyops(SFXHASH* h,
     return -1;
 }
 
-int sfxhash_add_return_data_ptr(SFXHASH* t, const void* key, void** data)
-{
-    if ( !t->datasize )
-        return SFXHASH_ERR;
-
-    *data = nullptr;
-
-    return sfxhash_add_ex(t, key, nullptr, data);
-}
-
 /*
  * -----------------------------------------------------------------------------------------
  *   Test Driver for Hashing
index ca10fc53d8632eb96e1f9de169a22c3bf16e2119..1fb1a29498c4b08181e1a90ff899b33a711fefc5 100644 (file)
@@ -90,7 +90,6 @@ struct SFXHASH
     SFXHASH_FREE_FCN usrfree;
 };
 
-SO_PUBLIC int sfxhash_calcrows(int num);
 SO_PUBLIC SFXHASH* sfxhash_new(int nrows, int keysize, int datasize, unsigned long memcap,
     int anr_flag,
     SFXHASH_FREE_FCN anrfunc,
@@ -136,8 +135,6 @@ inline unsigned sfxhash_overhead_blocks(SFXHASH* t)
 
 SO_PUBLIC void* sfxhash_mru(SFXHASH* t);
 SO_PUBLIC void* sfxhash_lru(SFXHASH* t);
-SO_PUBLIC SFXHASH_NODE* sfxhash_mru_node(SFXHASH* t);
-SO_PUBLIC SFXHASH_NODE* sfxhash_lru_node(SFXHASH* t);
 SO_PUBLIC void* sfxhash_find(SFXHASH* h, void* key);
 SO_PUBLIC SFXHASH_NODE* sfxhash_find_node(SFXHASH* t, const void* key);
 
@@ -145,24 +142,16 @@ SO_PUBLIC SFXHASH_NODE* sfxhash_findfirst(SFXHASH* h);
 SO_PUBLIC SFXHASH_NODE* sfxhash_findnext(SFXHASH* h);
 
 SO_PUBLIC SFXHASH_NODE* sfxhash_ghead(SFXHASH* h);
-SO_PUBLIC SFXHASH_NODE* sfxhash_gnext(SFXHASH_NODE* n);
 SO_PUBLIC void sfxhash_gmovetofront(SFXHASH* t, SFXHASH_NODE* hnode);
 
-SO_PUBLIC void sfxhash_splaymode(SFXHASH* h, int mode);
-
-SO_PUBLIC void* sfxhash_alloc(SFXHASH* t, unsigned nbytes);
-SO_PUBLIC void sfxhash_free(SFXHASH* t, void* p);
 SO_PUBLIC int sfxhash_free_node(SFXHASH* t, SFXHASH_NODE* node);
 
-SO_PUBLIC unsigned sfxhash_maxdepth(SFXHASH* t);
-
 SO_PUBLIC int sfxhash_set_keyops(SFXHASH* h,
     unsigned (* hash_fcn)(SFHASHFCN* p, unsigned char* d, int n),
     int (* keycmp_fcn)(const void* s1, const void* s2, size_t n));
 
 SO_PUBLIC SFXHASH_NODE* sfxhash_gfindfirst(SFXHASH* t);
 SO_PUBLIC SFXHASH_NODE* sfxhash_gfindnext(SFXHASH* t);
-SO_PUBLIC int sfxhash_add_return_data_ptr(SFXHASH* t, const void* key, void** data);
 
 #endif
 
index 25f8ba3b5a49ec3d32cc460bbd7b108269550a9c..531693bf582074bfd11378c0d474fbda25fca967 100644 (file)
@@ -355,82 +355,6 @@ NORETURN void FatalError(const char* format,...)
     }
 }
 
-void PrintPacketData(const uint8_t* data, const uint32_t len)
-{
-    uint32_t i, j;
-    uint32_t total_len = 0;
-    uint8_t hex_buf[16];
-    uint8_t char_buf[16];
-    const char* length_chars =
-        "       0  1  2  3  4  5  6  7   8  9 10 11 12 13 14 15\n"
-        "------------------------------------------------------\n";
-
-    LogMessage("%s", length_chars);
-
-    for (i = 0; i <= len; i++)
-    {
-        if ((i%16 == 0) && (i != 0))
-        {
-            LogMessage("%04x  ", total_len);
-            total_len += 16;
-
-            for (j = 0; j < 16; j++)
-            {
-                LogMessage("%02x ", hex_buf[j]);
-                if (j == 7)
-                    LogMessage(" ");
-            }
-
-            LogMessage(" ");
-
-            for (j = 0; j < 16; j++)
-            {
-                LogMessage("%c", char_buf[j]);
-                if (j == 7)
-                    LogMessage(" ");
-            }
-
-            LogMessage("\n");
-        }
-
-        if (i == len)
-            break;
-
-        hex_buf[i%16] = data[i];
-
-        if (isprint((int)data[i]))
-            char_buf[i%16] = data[i];
-        else
-            char_buf[i%16] = '.';
-    }
-
-    if ((i-total_len) > 0)
-    {
-        LogMessage("%04x  ", total_len);
-
-        for (j = 0; j < i-total_len; j++)
-        {
-            LogMessage("%02x ", hex_buf[j]);
-            if (j == 7)
-                LogMessage(" ");
-        }
-
-        if (j < 8)
-            LogMessage(" ");
-        LogMessage("%*s", (16-j)*3, "");
-        LogMessage(" ");
-
-        for (j = 0; j < i-total_len; j++)
-        {
-            LogMessage("%c", char_buf[j]);
-            if (j == 7)
-                LogMessage(" ");
-        }
-    }
-
-    LogMessage("\n");
-}
-
 void log_safec_error(const char* msg, void*, int e)
 {
     static THREAD_LOCAL unsigned safec_errors = 0;
index c04088f628d9ba43c97ab5ab791f039c1bc8d194..2dd381faf89f2c4d5d2fdb6e0b692fe182bfe485 100644 (file)
@@ -86,8 +86,6 @@ private:
 // FIXIT-M do not call FatalError() during runtime
 SO_PUBLIC NORETURN void FatalError(const char*, ...) __attribute__((format (printf, 1, 2)));
 
-SO_PUBLIC void PrintPacketData(const uint8_t*, const uint32_t);
-
 void log_safec_error(const char*, void*, int);
 
 class Dumper
index 3ead1c0d3ca5d7b1112d359e291f64fa2e42f9fa..d123bdfe4cee676d7aab78b6b47840002176bb7f 100644 (file)
@@ -39,16 +39,6 @@ bool DecodeConfig::is_ignore_data()
     return ignore_data;
 }
 
-void DecodeConfig::set_max_mime_mem(int max)
-{
-    max_mime_mem = max;
-}
-
-int DecodeConfig::get_max_mime_mem()
-{
-    return max_mime_mem;
-}
-
 void DecodeConfig::set_b64_depth(int depth)
 {
     b64_depth = depth;
index 6ab5ddeabcb6f65ce3a1dfc77dcc083f7f13a9d3..8544a1695136698ac1c06579bdb81dda2a7271be 100644 (file)
 #include "main/snort_types.h"
 
 /*These are temporary values*/
-#define DEFAULT_MAX_MIME_MEM          838860
 #define DEFAULT_MIME_MEMCAP           838860
 #define DEFAULT_DEPTH                 1464
 #define MAX_LOG_MEMCAP                104857600
 #define MIN_LOG_MEMCAP                3276
-#define MAX_MIME_MEM                  104857600
 #define MIN_MIME_MEM                  3276
 #define MAX_DEPTH                     65535
 #define MIN_DEPTH                     -1
@@ -40,16 +38,19 @@ class SO_PUBLIC DecodeConfig
 public:
     void set_ignore_data(bool);
     bool is_ignore_data();
-    void set_max_mime_mem(int);
-    int get_max_mime_mem();
+
     void set_b64_depth(int);
     int get_b64_depth();
+
     void set_qp_depth(int);
     int get_qp_depth();
+
     void set_bitenc_depth(int);
     int get_bitenc_depth();
+
     void set_uu_depth(int);
     int get_uu_depth();
+
     int64_t get_file_depth();
     bool is_decoding_enabled();
     void sync_all_depths();
@@ -58,7 +59,6 @@ public:
 
 private:
     bool ignore_data = false;
-    int max_mime_mem = DEFAULT_MAX_MIME_MEM;
     int b64_depth  = DEFAULT_DEPTH;
     int qp_depth = DEFAULT_DEPTH;
     int bitenc_depth = DEFAULT_DEPTH;
index b136942c293b924ca287ee53b9a748d753f6a2c7..58e86f9b2a7933a9c434c496909fdd379d9330e8 100644 (file)
@@ -102,60 +102,6 @@ static int POPPeekChar(POParser* pop)
     return 0;
 }
 
-#ifdef XXXX
-/* copy a simple alpha string */
-static void POPeekString(POParser* p, char* s, int smax)
-{
-    int c;
-    int cnt = 0;
-    int k = p->slen;
-
-    smax--;
-
-    s[0] = 0;
-
-    while ( k > 0  && cnt < smax )
-    {
-        c = p->s[ cnt ];
-
-        if ( c ==  0     )
-            break;
-        if ( !isalpha(c) )
-            break;
-
-        s[ cnt++ ] = c;
-        s[ cnt   ] = 0;
-        k--;
-    }
-}
-
-static void POGetString(POParser* p, char* s, int smax)
-{
-    int c;
-    int cnt = 0;
-
-    smax--;
-
-    s[0] = 0;
-
-    while ( p->slen > 0  && cnt < smax )
-    {
-        c = p->s[ 0 ];
-
-        if ( c ==  0     )
-            break;
-        if ( !isalpha(c) )
-            break;
-
-        s[ cnt++ ] = c;
-        s[ cnt   ] = 0;
-        p->slen--;
-        p->s++;
-    }
-}
-
-#endif
-
 /*
    Skip whitespace : ' ', '\t', '\n'
 */
index 2699ed80e1b1e81a5bacec474fa14efcdb0ef180..a450ec25e90308d40b9cbd0591a3d58feb5073d9 100644 (file)
@@ -42,7 +42,6 @@ void ParseRules(SnortConfig*);
 void OrderRuleLists(SnortConfig*, const char*);
 void PrintRuleOrder(RuleListNode*);
 
-const char* VarGet(SnortConfig*, const char*);
 char* ProcessFileOption(SnortConfig*, const char*);
 void SetRuleStates(SnortConfig*);
 
index fd1124ed7fdd665ec76bbb98504328a490c9e683..50b46c3bb76aab7ff42bc989a2680b0ca071fcdc 100644 (file)
@@ -678,51 +678,6 @@ const char* VarSearch(SnortConfig* sc, const char* name)
     return NULL;
 }
 
-/****************************************************************************
- *
- * Function: VarGet(SnortConfig *, char *)
- *
- * Purpose: get the contents of a variable
- *
- * Arguments: name => the name of the variable
- *
- * Returns: char * to contents of variable or ParseErrors on an
- *          undefined variable name
- *
- ***************************************************************************/
-const char* VarGet(SnortConfig*, const char* name)
-{
-    IpsPolicy* dp = get_ips_policy();
-    VarEntry* var_table = dp->var_table;
-    vartable_t* ip_vartable = dp->ip_vartable;
-    sfip_var_t* var;
-
-// XXX-IPv6 This function should never be used if IP6 support is enabled!
-// In fact it won't presently even work for IP variables since the raw ASCII
-// value is never stored, and is never meant to be used.
-
-    if ((var = sfvt_lookup_var(ip_vartable, name)) == NULL)
-    {
-        /* Do the old style lookup since it wasn't found in
-         * the variable table */
-        if (var_table != NULL)
-        {
-            VarEntry* p = var_table;
-            do
-            {
-                if (strcasecmp(p->name, name) == 0)
-                    return p->value;
-                p = p->next;
-            }
-            while (p != var_table);
-        }
-
-        ParseError("undefined variable name: %s.", name);
-    }
-
-    return name;
-}
-
 /****************************************************************************
  *
  * Function: ExpandVars()
index 20918bd93d3b04dcd5f9576602f575f24af1dbe6..bd8b15b1fb91c744e73e472e0c5cebf5ac265028 100644 (file)
@@ -78,12 +78,8 @@ enum VarType
 int VarIsIpAddr(vartable_t* ip_vartable, const char* value);
 int VarIsIpList(vartable_t* ip_vartable, const char* value);
 void DisallowCrossTableDuplicateVars(SnortConfig*, const char* name, VarType var_type);
-const char* VarGet(SnortConfig*, const char* name);
-/*
- * Same as VarGet - but this does not Fatal out if a var is not found
- */
-const char* VarSearch(SnortConfig*, const char* name);
 
+const char* VarSearch(SnortConfig*, const char* name);
 const char* ExpandVars(SnortConfig*, const char* string);
 
 #endif
index 2636b95f617bf5c36b0c22cc828ee117b96eaf7a..0f9e4dd02c20fb79868076e808c4fa0659599a99 100644 (file)
@@ -1021,207 +1021,3 @@ void* DCE2_QueueLast(DCE2_Queue* queue)
     return nullptr;
 }
 
-/********************************************************************
- * Function: DCE2_CStackNew()
- *
- * Creates and initializes a new static sized stack object.  The
- * static stack uses a fixed size array and uses indexes to
- * indicate the start and end of the stack.  This type of
- * stack can become full since it is a fixed size.  Used for
- * performance reasons since new nodes do not need to be
- * allocated on the fly.
- *
- * Arguments:
- *  int
- *      The size that should be allocated for the static
- *      stack storage.
- *  DCE2_CStackDataFree
- *      An optional free function for the data inserted into
- *      the stack.  If NULL is passed in, the user will be
- *      responsible for freeing data left in the stack.
- *
- * Returns:
- *  DCE2_CStack *
- *      Pointer to a new stack object.
- *
- ********************************************************************/
-DCE2_CStack* DCE2_CStackNew(int size, DCE2_CStackDataFree df)
-{
-    DCE2_CStack* cstack;
-
-    if (size <= 0)
-        return nullptr;
-
-    cstack = (DCE2_CStack*)snort_calloc(sizeof(DCE2_CStack));
-    cstack->data_free = df;
-    cstack->stack = (void**)snort_calloc(size, sizeof(void*));
-
-    cstack->size = size;
-    cstack->tail_idx = DCE2_SENTINEL;
-    cstack->cur_idx = DCE2_SENTINEL;
-
-    return cstack;
-}
-
-/********************************************************************
- * Function: DCE2_CStackPush()
- *
- * Inserts data into the static stack.
- *
- * Arguments:
- *  DCE2_CStack *
- *      A pointer to the stack object.
- *  void *
- *      Pointer to the data to insert into the stack.
- *
- * Returns:
- *  DCE2_Ret
- *      DCE2_RET__ERROR if the stack is full or the stack object
- *          passed in is NULL.
- *      DCE2_RET__SUCCESS if the data is successfully added to
- *          the stack.
- *
- ********************************************************************/
-DCE2_Ret DCE2_CStackPush(DCE2_CStack* cstack, void* data)
-{
-    if (cstack == nullptr)
-        return DCE2_RET__ERROR;
-
-    if (cstack->num_nodes == (uint32_t)cstack->size)
-        return DCE2_RET__ERROR;
-
-    if (cstack->tail_idx == DCE2_SENTINEL)
-        cstack->tail_idx = 0;
-    else
-        cstack->tail_idx++;
-
-    cstack->stack[cstack->tail_idx] = data;
-    cstack->num_nodes++;
-
-    return DCE2_RET__SUCCESS;
-}
-
-/********************************************************************
- * Function: DCE2_CStackPop()
- *
- * Removes and returns the data in the last node in the stack.
- * Note that the user will have to free the data returned.  The
- * data free function only applies to data that is in the stack
- * when it is emptied or destroyed.
- *
- * Arguments:
- *  DCE2_CStack *
- *      A pointer to the stack object.
- *
- * Returns:
- *  void *
- *      The data in the last node in the stack.
- *      NULL if there are no items in the stack or the stack object
- *          passed in is NULL.
- *
- ********************************************************************/
-void* DCE2_CStackPop(DCE2_CStack* cstack)
-{
-    void* data;
-
-    if (cstack == nullptr)
-        return nullptr;
-
-    if (cstack->num_nodes == 0)
-        return nullptr;
-
-    data = cstack->stack[cstack->tail_idx];
-    cstack->stack[cstack->tail_idx] = nullptr;
-
-    if (cstack->tail_idx == 0)
-        cstack->tail_idx = DCE2_SENTINEL;
-    else
-        cstack->tail_idx--;
-
-    cstack->num_nodes--;
-
-    return data;
-}
-
-/********************************************************************
- * Function: DCE2_CStackTop()
- *
- * Returns the data on top of the stack.  Does not remove the data
- * from the stack.
- *
- * Arguments:
- *  DCE2_CStack *
- *      A pointer to the stack object.
- *
- * Returns:
- *  void *
- *      The data on top of the stack.
- *      NULL if there are no items in the stack or the stack object
- *          passed in is NULL.
- *
- ********************************************************************/
-void* DCE2_CStackTop(DCE2_CStack* cstack)
-{
-    if (cstack == nullptr)
-        return nullptr;
-
-    if (cstack->num_nodes == 0)
-        return nullptr;
-
-    return cstack->stack[cstack->tail_idx];
-}
-
-/********************************************************************
- * Function: DCE2_CStackEmpty()
- *
- * Removes all of the nodes in a stack.  Does not delete the stack
- * object itself or the storage array.  Calls data free function
- * for data if it is not NULL.
- *
- * Arguments:
- *  DCE2_CStack *
- *      A pointer to the stack object.
- *
- * Returns: None
- *
- ********************************************************************/
-void DCE2_CStackEmpty(DCE2_CStack* cstack)
-{
-    if (cstack == nullptr)
-        return;
-
-    while (!DCE2_CStackIsEmpty(cstack))
-    {
-        void* data = DCE2_CStackPop(cstack);
-
-        if ((data != nullptr) && (cstack->data_free != nullptr))
-            cstack->data_free(data);
-    }
-
-    cstack->num_nodes = 0;
-    cstack->tail_idx = DCE2_SENTINEL;
-    cstack->cur_idx = DCE2_SENTINEL;
-}
-
-/********************************************************************
- * Function: DCE2_CStackDestroy()
- *
- * Destroys the stack object and all of the data associated with it.
- *
- * Arguments:
- *  DCE2_CStack *
- *      A pointer to the stack object.
- *
- * Returns: None
- *
- ********************************************************************/
-void DCE2_CStackDestroy(DCE2_CStack* cstack)
-{
-    if (cstack == nullptr)
-        return;
-
-    DCE2_CStackEmpty(cstack);
-    snort_free((void*)cstack->stack);
-    snort_free((void*)cstack);
-}
-
index af81d20806ea2eb2287ae3da475412a287ebb663..e8512437136d963e016fac7fafdaa8106aef4c94 100644 (file)
@@ -102,18 +102,6 @@ struct DCE2_Queue
     DCE2_QueueNode* prev;
 };
 
-typedef DCE2_ListDataFree DCE2_CStackDataFree;
-
-struct DCE2_CStack
-{
-    uint32_t num_nodes;
-    DCE2_CStackDataFree data_free;
-    int size;
-    void** stack;
-    int tail_idx;
-    int cur_idx;
-};
-
 /********************************************************************
  * Public function prototypes
  ********************************************************************/
@@ -141,14 +129,6 @@ void DCE2_QueueDestroy(DCE2_Queue*);
 void DCE2_QueueRemoveCurrent(DCE2_Queue*);
 void* DCE2_QueueLast(DCE2_Queue*);
 
-DCE2_CStack* DCE2_CStackNew(int, DCE2_CStackDataFree);
-DCE2_Ret DCE2_CStackPush(DCE2_CStack*, void*);
-void* DCE2_CStackPop(DCE2_CStack*);
-void* DCE2_CStackTop(DCE2_CStack*);
-static inline int DCE2_CStackIsEmpty(DCE2_CStack*);
-void DCE2_CStackEmpty(DCE2_CStack*);
-void DCE2_CStackDestroy(DCE2_CStack*);
-
 /********************************************************************
  * Function: DCE2_ListIsEmpty()
  *
@@ -191,21 +171,5 @@ inline bool DCE2_QueueIsEmpty(DCE2_Queue* queue)
     return 0;
 }
 
-/********************************************************************
- * Function: DCE2_CStackIsEmpty()
- *
- * Determines whether or not the stack has any items in it
- * currently.
- *
- ********************************************************************/
-static inline int DCE2_CStackIsEmpty(DCE2_CStack* cstack)
-{
-    if (cstack == nullptr)
-        return 1;
-    if (cstack->num_nodes == 0)
-        return 1;
-    return 0;
-}
-
 #endif
 
index 843217b0a26140788edf84dfa37d320d6007b3a4..9f71615fbe5beeafc9bcca9ca5668fa5dceecd60 100644 (file)
@@ -92,16 +92,6 @@ void CleanupFTPBounceTo(void* ftpBounce)
     snort_free(FTPBounce);
 }
 
-void CleanupFTPClientConf(void* clientConf)
-{
-    FTP_CLIENT_PROTO_CONF* ClientConf = (FTP_CLIENT_PROTO_CONF*)clientConf;
-    if (ClientConf == NULL)
-        return;
-
-    /* Iterate through each bounce_lookup for this client */
-    ftp_bounce_lookup_cleanup(&ClientConf->bounce_lookup);
-}
-
 /*
  * Function: CheckFTPCmdOptions(FTP_SERVER_PROTO_CONF *serverConf)
  *
index 26bee1bf0cc92857fc7fbee75388d704aae4dde2..93429d1de923b52ab35883742fccf65c52b86cb7 100644 (file)
@@ -46,7 +46,6 @@ void do_detection(Packet*);
 
 void CleanupFTPServerConf(void* serverConf);
 void CleanupFTPCMDConf(void* ftpCmd);
-void CleanupFTPClientConf(void* clientConf);
 void CleanupFTPBounceTo(void* ftpBounce);
 
 int CheckFTPServerConfigs(SnortConfig*, FTP_SERVER_PROTO_CONF*);
index f9ab4f6bf1f5a84f3bae53a7aeddf9d51485f164..d6688f65acc470353345f5384b9b5d8ac2baf59c 100644 (file)
 
 #include "hash/sfhashfcn.h"
 
-/********************************************************************
- * Function: SIP_IsEmptyStr()
- *
- * Checks if string is NULL, empty or just spaces.
- * String must be 0 terminated.
- *
- * Arguments:
- *  char * - string to check
- *
- * Returns:
- *  1  if string is NULL, empty or just spaces
- *  0  otherwise
- *
- ********************************************************************/
-int SIP_IsEmptyStr(char* str)
-{
-    char* end;
-
-    if (str == NULL)
-        return 1;
-
-    end = str + strlen(str);
-
-    while ((str < end) && isspace((int)*str))
-        str++;
-
-    if (str == end)
-        return 1;
-
-    return 0;
-}
-
 /*
  * Trim spaces non-destructively on both sides of string : '', \t, \n, \r
  * If string is empty return 0, otherwise 1
index 9b3e9501a3d2fd986cb7634e167f9160eb02f1ea..89201927d25a4a9bde39273f3ab077a0bf8646cb 100644 (file)
@@ -26,7 +26,6 @@
 
 #include "sip_config.h"
 
-int SIP_IsEmptyStr(char*);
 int SIP_TrimSP(const char*, const char*, char**, char**);
 SIPMethodNode* SIP_FindMethod(SIPMethodlist, const char* method, unsigned int);
 uint32_t strToHash(const char*, int);
index 004d7ea309008545da3d09bc81e3638da4651851..c264621e9436adb7b35c3a644108adcbc07dd6a7 100644 (file)
@@ -504,13 +504,6 @@ StreamSplitter* Stream::get_splitter(Flow* flow, bool to_server)
     return ss;
 }
 
-bool Stream::is_paf_active(Flow* flow, bool to_server)
-{
-    assert(flow && flow->session);
-    StreamSplitter* ss = flow->session->get_splitter(to_server);
-    return ss && ss->is_paf();
-}
-
 //-------------------------------------------------------------------------
 // extra data foo
 //-------------------------------------------------------------------------
index 1ff8f103d2c8578aba9a5603df558c6be7dd5692..44bc5e99ca993693b84a83f2d19808292cb69b43 100644 (file)
@@ -164,7 +164,6 @@ public:
 
     static void set_splitter(Flow*, bool toServer, class StreamSplitter* = nullptr);
     static StreamSplitter* get_splitter(Flow*, bool toServer);
-    static bool is_paf_active(Flow*, bool toServer);
 
     // Turn off inspection for potential session. Adds session identifiers to a hash table.
     // TCP only.
index 901b82dc53f559bd95e1ca86bc8a15b045f31759..af5417e2c1487ecc211d7ec89906c48187c2150b 100644 (file)
@@ -97,8 +97,8 @@ void TcpSession::restart(Packet* p)
 {
     // sanity check since this is called externally
     assert(p->ptrs.tcph);
+    assert(p->flow == flow);
 
-    assert(!p or p->flow == flow);
     DetectionEngine::onload(flow);
     TcpStreamTracker* talker, * listener;
 
index 3b99529791d58b61134b023ca8b73bde12134653..9b8bf8f79c51a3a56c76b1345bcd9570c077841a 100644 (file)
@@ -77,12 +77,3 @@ void TcpStreamConfig::show_config(TcpStreamConfig* config)
         LogMessage("    Require 3-Way Handshake: after %d seconds\n", config->hs_timeout);
 }
 
-//-------------------------------------------------------------------------
-// attribute table foo
-//-------------------------------------------------------------------------
-
-int TcpStreamConfig::verify_config(SnortConfig*)
-{
-    return 0;
-}
-
index c73f5db9c9bfb00b558188d8dc63473051853a5c..ee9cb6d4d27ec41476ae1068e46d4cf439c6f10f 100644 (file)
@@ -58,7 +58,6 @@ public:
         return false;
     }
 
-    int verify_config(SnortConfig*);
     void show_config();
     static void show_config(TcpStreamConfig*);
 
index 9764f36051a8f4a8acddc94fecac6ec3097af214..b4c51ea569be0149a0f5403ac6a31813404f3c65 100644 (file)
@@ -384,21 +384,6 @@ void* KMapFind(KMAP* ks, void* key, int n)
     return NULL;
 }
 
-/*
-*
-*/
-KEYNODE* KMapFindFirstKey(KMAP* km)
-{
-    km->keynext = km->keylist;
-
-    if (!km->keynext)
-    {
-        return NULL;
-    }
-
-    return km->keynext;
-}
-
 /*
 *
 */
@@ -414,22 +399,6 @@ void* KMapFindFirst(KMAP* km)
     return km->keynext->userdata;
 }
 
-/*
-*
-*/
-KEYNODE* KMapFindNextKey(KMAP* km)
-{
-    if ( !km->keynext )
-        return 0;
-
-    km->keynext = km->keynext->next;
-
-    if ( !km->keynext )
-        return 0;
-
-    return km->keynext;
-}
-
 /*
 *
 */
index 30273499a9efc5f64a40262369ca11b184addee7..303e26dde7ea70d1dc28bae45641972ff493b17d 100644 (file)
@@ -84,8 +84,5 @@ SO_PUBLIC void* KMapFind(KMAP* km, void* key, int ksize);
 SO_PUBLIC void* KMapFindFirst(KMAP* km);
 SO_PUBLIC void* KMapFindNext(KMAP* km);
 
-SO_PUBLIC KEYNODE* KMapFindFirstKey(KMAP* km);
-SO_PUBLIC KEYNODE* KMapFindNextKey(KMAP* km);
-
 #endif
 
index c212efdaf65f45daf59951875359ed9eaf755ea4..a2cd7d857bece2950f37d47d695b2b36a560fb64 100644 (file)
@@ -367,8 +367,3 @@ void sflist_free(SF_LIST* s)
     s_free(s);
 }
 
-void sfqueue_free(SF_QUEUE* s)
-{
-    sflist_free (s);
-}
-
index 5be2a7b73f1d4052d99928e2f3081f180b3e02ed..dfd40b9d4b08dd93550530fdc62a8037d915aab7 100644 (file)
@@ -96,7 +96,6 @@ SF_QUEUE* sfqueue_new();
 void sfqueue_add(SF_QUEUE*, NODE_DATA);
 NODE_DATA sfqueue_remove(SF_QUEUE*);
 int sfqueue_count(SF_QUEUE*);
-void sfqueue_free(SF_QUEUE*);
 void sfqueue_free_all(SF_QUEUE*, void (* free)(void*) );
 
 #endif
index 5940bc40b47d1dcf75293c73e88d083da84cf705..0410ea7ee3e3a27fc718029bc79c69ba91e964c9 100644 (file)
@@ -47,25 +47,6 @@ void sfmemcap_init(MEMCAP* mc, unsigned long nbytes)
     mc->nblocks= 0;
 }
 
-/*
-*   Create and Init a MEMCAP -  use free to release it
-*/
-MEMCAP* sfmemcap_new(unsigned nbytes)
-{
-    MEMCAP* mc = (MEMCAP*)snort_calloc(sizeof(MEMCAP));
-    sfmemcap_init(mc, nbytes);
-    return mc;
-}
-
-/*
-*  Release the memcap structure
-*/
-void sfmemcap_delete(MEMCAP* p)
-{
-    if (p)
-        snort_free(p);
-}
-
 /*
 *  Allocate some memory
 */
@@ -123,37 +104,3 @@ void sfmemcap_showmem(MEMCAP* mc)
     fprintf(stderr, " nblocks= %d blocks\n",mc->nblocks);
 }
 
-/*
-*  String Dup Some memory.
-*/
-char* sfmemcap_SnortStrdup(MEMCAP* mc, const char* str)
-{
-    int data_size = strlen(str) + 1;
-    char* data = (char*)sfmemcap_alloc(mc, data_size);
-
-    if (data == NULL)
-    {
-        return 0;
-    }
-
-    SnortStrncpy(data, str, data_size);
-
-    return data;
-}
-
-/*
-*  Dup Some memory.
-*/
-void* sfmemcap_dupmem(MEMCAP* mc, void* src, unsigned long n)
-{
-    void* data = (char*)sfmemcap_alloc(mc, n);
-    if (data == NULL)
-    {
-        return 0;
-    }
-
-    memcpy(data, src, n);
-
-    return data;
-}
-
index e9a3a1138e8c28419bd34d422c66abc8d808cf0e..354cfe1b069f6941ecc1a4268a983ec3cce55669 100644 (file)
@@ -31,13 +31,9 @@ struct MEMCAP
 
 // FIXIT-L could be refactored as a class but should be deleted
 void sfmemcap_init(MEMCAP* mc, unsigned long nbytes);
-MEMCAP* sfmemcap_new(unsigned nbytes);
-void sfmemcap_delete(MEMCAP* mc);
 void* sfmemcap_alloc(MEMCAP* mc, unsigned long nbytes);
 void sfmemcap_showmem(MEMCAP* mc);
 void sfmemcap_free(MEMCAP* mc, void* memory);
-char* sfmemcap_SnortStrdup(MEMCAP* mc, const char* str);
-void* sfmemcap_dupmem(MEMCAP* mc, void* src, unsigned long n);
 
 #endif
 
index 65cba1e12f4aff994597890ea26f6e851b7ca392..2a0e38cd9357be41b5168c9043620b64af04fba6 100644 (file)
@@ -444,8 +444,6 @@ static const JSNorm javascript_norm[] =
 
 static void UnescapeDecode(char*, uint16_t, char**, char**, uint16_t*, JSState*, uint8_t*);
 
-void InitJSNormLookupTable() {}
-
 static inline int outBounds(const char* start, const char* end, char* ptr)
 {
     if ((ptr >= start) && (ptr < end))
@@ -1319,7 +1317,6 @@ int main(int argc, char *argv[])
     js.allowed_levels = 1;
     js.alerts = 0;
 
-    InitJSNormLookupTable();
     ret = JSNormalizeDecode(input, bytes_read, output, sizeof(output),&ptr, &bytes_copied, &js, NULL);
     if( ret == RET_OK)
     {
index 04ef87c0e07f42e29f43fd7faa2d49a77b9bbdeb..5976d01a1f4f7fcfa16922f994abb9faaf0c259a 100644 (file)
@@ -40,8 +40,6 @@ typedef struct
 
 void keep_jsnorm_lib();  // FIXIT-L eliminate; required to keep symbols for dyn plugins
 
-SO_PUBLIC void InitJSNormLookupTable();
-
 SO_PUBLIC int JSNormalizeDecode(
     char*, uint16_t, char*, uint16_t destlen, char**, int*, JSState*, uint8_t*);