[Bro-Dev] [JIRA] (BIT-1367) Type clashing problem when records with default values are used in sets.

Johanna Amann (JIRA) jira at bro-tracker.atlassian.net
Fri Apr 3 08:47:00 PDT 2015

Johanna Amann created BIT-1367:

             Summary: Type clashing problem when records with default values are used in sets.
                 Key: BIT-1367
                 URL: https://bro-tracker.atlassian.net/browse/BIT-1367
             Project: Bro Issue Tracker
          Issue Type: Problem
          Components: Bro
    Affects Versions: git/master
            Reporter: Johanna Amann
             Fix For: 2.4

topic/johanna/sft-port is a branch that contains a slight modification to the sftp log-rotator, adding the possibility to select the server port with a default value of 20.

After adding this small change, the Bro type system is no longer able to figure out that it can coerce the record in cases that previously worked. The default evocation of the sftp log-rotator using:

Log::add_filter(Conn::LOG, [$name="test", $path="testconn", $writer=Log::WRITER_ASCII,
  $interv=1hr, $postprocessor=Log::sftp_postprocessor]);
  Log::sftp_destinations[Log::WRITER_ASCII,"testconn"] = set([$user="testuser",$host="testhost",$path="testpath"]);

or similar leads to

type clash in assignment (Log::sftp_destinations[Log::WRITER_ASCII, testconn] = set([$user=testuser, $host=testhost, $path=testpath]))

Directly specifying the type of the record works, but would break all other scripts that are using the sftp log rotator currently.

Working example:

Log::add_filter(Conn::LOG, [$name="test", $path="testconn", $writer=Log::WRITER_ASCII,
  $interv=1hr, $postprocessor=Log::sftp_postprocessor]);
  Log::sftp_destinations[Log::WRITER_ASCII,"testconn"] = set(Log::SFTPDestination($user="testuser",$host="testhost",$path="testpath"));

Once this is fixed, topic/johanna/sft-port can be merged.

This message was sent by Atlassian JIRA

More information about the bro-dev mailing list