Merge remote-tracking branch '3.3/master'
uuid: Introduce a new function to generate uuids.

The new function, available in "uuid.h" and libsyslog-ng-crypto, can
be used to generate UUID strings. It will either use a custom
implementation, when OpenSSL is available, or libuuid, if it's present
but OpenSSL is not.

If neither is present, it falls back to a dumb counter.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
tfuuid: New template function to generate UUIDs.

This patch adds a new template function: $(uuid), which can be used to
generate Universally Unique IDentifiers.

The use case for this is to add an UUID to each message as soon as
they're received, so that they can be identified later, accross
destinations. This allows me to pre-generate an ID for messages going
into mongodb, and send those messages to a different destination too,
with the same ID included.

Use it like this:

rewrite r_add_uuid { set("$(uuid)" value("uuid")); };
log { source(s_network); rewrite(r_add_uuid);
      destination(d_mongo); destination(d_program); };

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
value-pairs: Do not require --rekey in the command-line parser.

The --rekey in the commandline parser is not needed, the various
transformation functions can work just fine without it, and do the
setup themselves, if so need be.

This patch gets rid of --rekey.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
afsmtp: New destination driver, to send mails via SMTP

This introduces the afsmtp destination driver, updated to the latest
3.4 conventions, and with all the threading bugs that were also
present in afmongodb too, fixed.

The driver itself uses libESMTP to send mail, and has the following
config syntax:

destination d_smtp {
 smtp(
  host("localhost") port(25)
  subject("ALERT! IMPORTANT EVENT FROM ${HOST}")
  header("X-Severity", "${SEVERITY}")
  from("no-reply@${HOST}.dummy")
  to("syslog-alerts@my.example.domain")
  bcc("big-brother@my.example.domain")
  cc("it@my.example.domain")
  reply-to("admin@my.example.domain")
 );
};

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
preparations for 3.4alpha1
cfg-tree: fixed segfault triggered by empty source/destination object

When a source/destination object is empty a segfault happened during
the compilation of configuration (for sources) or at the first message (for
destinations). This was fixed by handling such cases.

Reported-By: Peter Czanik <czp@balabit.hu>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
unix-dgram: fixed crash in file permission parsing code

A line to set last_file_perm_options was missed in the unix-dgram variant
of afsocket, which caused the last_file_perm_options variable to be
initialized to NULL, causing a segfault later on.

Reported-By: Peter Czanik <peter.czanik@balabit.hu>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
value-pairs: fixed double free in case of an argument parsing failure

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
cfg-tree: handle template compilation errors properly

In case a template was specified directly at a destination, its syntax errors
were not properly reported while the configuration was being parsed. This
patch fixes that.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>