Skip to content

Commit

Permalink
Fix writing empty strings.
Browse files Browse the repository at this point in the history
Also move version to 0.2 and move out of the Bro namespace.
  • Loading branch information
0xxon committed Jan 27, 2017
1 parent 62529f3 commit 5c858b4
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1
0.2
6 changes: 3 additions & 3 deletions src/Plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
#include "PostgresWriter.h"
#include "PostgresReader.h"

namespace plugin { namespace Bro_PostgreSQL { Plugin plugin; } }
namespace plugin { namespace Johanna_PostgreSQL { Plugin plugin; } }

using namespace plugin::Bro_PostgreSQL;
using namespace plugin::Johanna_PostgreSQL;

plugin::Configuration Plugin::Configure()
{
Expand All @@ -16,6 +16,6 @@ plugin::Configuration Plugin::Configure()
config.name = "Bro::PostgreSQL";
config.description = "PostgreSQL log writer and input reader";
config.version.major = 0;
config.version.minor = 1;
config.version.minor = 2;
return config;
}
2 changes: 1 addition & 1 deletion src/Plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <plugin/Plugin.h>

namespace plugin {
namespace Bro_PostgreSQL {
namespace Johanna_PostgreSQL {

class Plugin : public ::plugin::Plugin
{
Expand Down
3 changes: 0 additions & 3 deletions src/PostgresWriter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,6 @@ std::tuple<bool, string, int> PostgreSQL::CreateParams(const Value* val)
case TYPE_STRING:
case TYPE_FILE:
case TYPE_FUNC:
if ( ! val->val.string_val.length || val->val.string_val.length == 0 )
return std::make_tuple(false, string(), 0);

retval = string(val->val.string_val.data, val->val.string_val.length);
break;

Expand Down
12 changes: 6 additions & 6 deletions tests/Baseline/postgres.write-basic/ssh.out
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
id|b|i|e|c|p|sn|a|d|t|iv|s|sc|ss|se|vc|ve|f
1|t|-42|SSH::LOG|21|123|10.0.0.0/24|1.2.3.4|3.14|1485448463.53086|100|hurz|{2,4,1,3}|{BB,AA,CC}||{10,20,30}||SSHTest::foo
id|b|i|e|c|p|sn|a|d|t|iv|s|sc|ss|se|vc|ve|f|vo|so
1|t|-42|SSH::LOG|21|123|10.0.0.0/24|1.2.3.4|3.14|1485543658.08752|100|hurz|{2,4,1,3}|{BB,AA,CC}||{10,20,30}||SSHTest::foo
{
if (0 < SSHTest::i)
return (Foo);
else
return (Bar);

}
2|t|-42|SSH::LOG|21|123|10.0.0.0/24|1.2.3.4|3.14|1485448463.53086|100|hurz|{2,4,1,3}|{"{\"\"\\hello","a b
cd~e","\\\"\\{}","{{{{{}'","\""}||{10,20,30}||SSHTest::foo
}||
2|t|-42|SSH::LOG|21|123|10.0.0.0/24|1.2.3.4|3.14|1485543658.08752|100|hurz|{2,4,1,3}|{"{\"\"\\hello","a b
cd~e","\\\"\\{}","{{{{{}'","","\""}||{10,20,30}||SSHTest::foo
{
if (0 < SSHTest::i)
return (Foo);
else
return (Bar);

}
}||
(2 rows)
Expand Down
4 changes: 3 additions & 1 deletion tests/postgres/write-basic.bro
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ export {
vc: vector of count;
ve: vector of string;
f: function(i: count) : string;
vo: vector of string &optional;
so: string &optional;
} &log;
}

Expand Down Expand Up @@ -88,7 +90,7 @@ event bro_init()
$iv=100secs,
$s="hurz",
$sc=set(1,2,3,4),
$ss=set("\\\"\\{}", "\"", "{{{{{}'", "{\"\"\\hello", "a\tb\nc\rd\x01\x02\x03\x7Ee"),
$ss=set("", "\\\"\\{}", "\"", "{{{{{}'", "{\"\"\\hello", "a\tb\nc\rd\x01\x02\x03\x7Ee"),
$se=empty_set,
$vc=vector(10, 20, 30),
$ve=empty_vector,
Expand Down

0 comments on commit 5c858b4

Please sign in to comment.