Only check runscript dir when we are really executing the script.
sd: Avoid segfault in is_vol_in_autochanger().

If the sd config file contains a Device section for a device not
listed in the Autochanger config section, is_vol_in_autochanger()
might be called with vol->dev->device->changer_res being NULL.
However, the function dereferences this pointer unconditionally,
which results in a segfault.

This patch adds the necessary check and returns false in this case,
avoiding the crash.

Signed-off-by: Marco van Wieringen <marco.van.wieringen@bareos.com>
Added some quotes

- Added quotes to make_catalog_backup.pl script
  (Thanks to Günter Gratzer)
- Added quotes in message when Allowed Job Command blocks.

Signed-off-by: Marco van Wieringen <marco.van.wieringen@bareos.com>
Refactor windows version detection code.

Added Windows 8 and Windows Server 2012 and use a switch on major and
minor number instead of a set of ifs.
Fixed single-drive mount problem
Fix windows bpipe plugin.
Restore of encrypted data fails when not all files are created.

We should check if a file is actually extracted when checking
if we encounter an unexpected STREAM_ENCRYPTED_SESSION_DATA.
The rctx.cs is setup by a call to crypto_session_decode()
and that session lingers until its teared down by
close_previous_stream() but that only occurs when the next
file is actually extracted. So if we extract one encrypted
file and not the one after that the rctx.cs will not be cleared
until we hit the next extracted file or the end of the restore.
So we should only handle the session at all when we extract
the file as otherwise it makes absolutely no sense to even
consider the encrypted session data stream at all as we will
be skipping the file extract anyway and skip all encrypted data
blocks.

Fixes #192: Restore of PKI encrypted data fails if some of the files
            should not be replaced
Trace file to c:/ if working_directory is empty

When the working directory is empty, we now write the
trace file to c:/ instead of ./

When running as service, the workingdirectory seems to empty ,so
that the trace file is written to C:/windows/system32

This has different implications and makes it difficult to watch the
trace file.

Signed-off-by: Marco van Wieringen <marco.van.wieringen@bareos.com>
Retry autochanger query for slots

In essence this is a bug in the firmware but it seems there are quite
some libraries which seem to be affected. We now retry the query one
more time when we get a zero slots returned.

Fixes #174: "status slots" says "0 slots" the first time after tapes
            were removed. Rerunning "status slots" then is correct.
Drop syslog.target from systemd service definitions.

Newer systemd versions implement a internal binary journalling system
which replaces syslog so the syslog.target is no longer available in
newer versions of systemd. So we dropped the dependency on it and hope
that our other dependencies make sure the syslogging is available.

Fixes #203: systemctl start bareos-fd.service fails on Fedora 19