Upgrade all filed plugins to use fd_common.h
Cleanup plugins now we use fd_common.h
Only have bpipe-fd.c once and use it for UNIX and Windows.
Tweak plugin entry points layout.
Fix Makefile.in for new plugin layout.
Fix backup summary.

Always lookup the media record of the last used volume after calling
db_get_job_volume_names() so we always print the right info and not
lookup the media record based on the current content of jcr->VolumeName
which works only for normal backups but not for virtual fulls as there
it will have the name of the last volume that was read for creating the
virtual full. Looking at the migration code it also does a lookup
of the last volume name returned by db_get_job_volume_names() there.

Fixes #211: Wrong data/output/calculation in log of "Last Volume Bytes"
            and "Volume Session Time" when doing Virtual Full Backups
Remove no-op assign.

While writing the sd-sd replication we introduced two assignments
which are in essense no-ops (e.g. assigning a value to a variable
where the source is itself.) The optimizer probably filters it but
for the readability lets remove them.
sample sql queries

provide sample sql queries, that can be used by the bconsole query command.

Fixes #83: Bareos packages do not contain query.sql

Signed-off-by: Marco van Wieringen <marco.van.wieringen@bareos.com>
Check if DISTNAME subdir has a Makefile

When trying to install platform specific scripts make sure the
platform specific DISTNAME subdir has a Makefile (which also
checks if the dir even exists.) This should help for platforms
like altlinux where we set the DISTNAME but for which we don't
have any platform specific scripts.
Add some defensive coding.
Fix restore handling of NDMP when using wrong storage.

For a NDMP restore its needed that the storage passed into the restore
job is a storage definition with paired NDMP storage. When this is not
the case the pstore pointer will remain NULL and we crash in the
build_ndmp_job() function. Now we check if we have paired storage
and also changed the cleanup somewhat so we don't try to close the
bootstrap file etc when we didn't open it (which also lead to a
segmentation fault.)
windows config files admin-only access

Windows configuration files were accessible by
normal users until now.

Now we use the NSIS AccessControl Plugin
(http://nsis.sourceforge.net/AccessControl_plug-in)
to limit the access to the Administrator only.

This also means that if you want to edit the
config file, this has to happen as administrator.

Fixes #208: Look into possibility to limit access rights on %APPDATA%/Bareos to administrators only.

Signed-off-by: Marco van Wieringen <marco.van.wieringen@bareos.com>
Tweak layout.

Reformated comments and use bstrcasecmp.
Use modern autoconf idioms.

Autoconf 2.59 says that AC_OUTPUT with arguments is obsolete
Rewrite to use AC_CONFIG_FILES.
Rebuild configure.
Bump version date.
Filed doesn't respond to first connection after start.

The setup of the thread specific key is flawed. In essence
its setup twice (once via the init_msgs() call and once
via the pthread_once call in jcr.c). This new code fixes
that by:

- Setup thread specific data key only once.
- Use pthread_key_create_once_np when available.
  This is a non portable but cleaner implementation of
  both a pthread_once() and a pthread_key_create().
- For Windows use a workaround around pthread_once() as that
  seems to hang for unknown reason. Now we use a boolean
  protected by an mutex to make sure the setup is only done once.

Fixes #210: Filed doesn't respond to first connection after start.
Always use CoInitializeEx with multithread option.