No need to multiply with 1024LL as we already cast to int64_t
When we have a valid BSR also use it.

When scanning volumes and we have a valid BSR we should really use it
for scanning SOS_LABEL and EOS_LABEL parsing and if they don't pass the
BSR filter they should be ignored.
Sync md5 and sha1 code to what others use.

We have stuff that could make some distributions scream that things might be
not fully opensource so we sync here to what other projects use e.g. a
fully public domain version of sha1 and md5. When things are compiled
using OpenSSL we even fall back to their implementation of md5 and don't
compile an own version at all. The rest of the code was changed to use
the new context names and the small change in the function names.
Refactor message printing.

- Drop fixed size arrays of 5000 bytes (arbitrary length)
- Code all message printing using POOL_MEM where it makes sense.
- Reindented wrongly indented functions.
- Don't use the new stuff using POOL_MEM from:
  - src/lib/mem_pool.c
  - src/lib/smartalloc.c
  - src/lib/lockmgr.c
Drop the duplicate hash table implementation.

Findlib has a hash table implementation for keeping hardlinked files
its cleaner to use the htable class we already have in the generic
library. So this patch adds support for binary keys in the htable class
so we can store there the combined inode/device key. We now also use the
hash_malloc of the htable class which allocates memory from a big memory
block so it should also scale a bit better.
Make consecutive tape reads more like writing to tape

No rewinding between each job! but if we need the same tape and
the device has the always open flag set the header cannot really change
so rereading it has little value. The Storage daemon should just
reposition the tape and start reading.

Fixes #322: Make consecutive tape reads more like writing to tape

Signed-off-by: Marco van Wieringen <marco.van.wieringen@bareos.com>
Enhance read device selection to respect media_type

When looking for a device to mount a volume that is to be read bareos
goes for the device the volume was last mounted in. If the original
device is blocked but there are other devices that can be used those
will not be selected and the job will fail.

Fixes #326: Enhance read device selection to respect media_type

Signed-off-by: Marco van Wieringen <marco.van.wieringen@bareos.com>
Update AUTHORS.
Fix use of uninitialized jcr member in DCR constructor.
Fix windows build.
Use local MD5 on Windows.
Compile MD5 as C and not C++ symbols.
Revert "Compile MD5 as C and not C++ symbols."

This reverts commit 3f5943ef25d5d373848213c81cc319f3d66ff984.
Proper fix for using fallback MD5 support.

If we don't use the openssl MD5 support on windows we need to fallback
to using a C++ version so we don't have a name clash with the normal md5
routines available. So if we use our public domain version of MD5 we
always compile it as C++ code from now on.
Make the mediatype selection configurable.

Add an extra config option "device reserve by mediatype" which controls
if we try to reserve a certain non autochanger device by the mediatype
it has configured.

Some people configure different different devices with the same media
type. Although this will lead to all kind of problems lets make the new
device reserve by mediatype something you have to explictly enable as
probably very little people need this very specific reservation type.
adapted copyright information for SHA and MD5

The SHA and MD5 have been replaced by public domain versions.

Signed-off-by: Marco van Wieringen <marco.van.wieringen@bareos.com>
Like with MD5 only use SHA1 implementation as fallback.

Like what we have done with MD5 the SHA1 implementation included is only
used on platforms where we cannot (or do not want) to use the openssl
SHA1 implementation. We include the right include file via the sha1.h
header. We also no longer build the test sha1sum program as the new SHA1
has no test program buildin anymore.
Add some safeguards.

Add some safeguards against running a Native Backup Job on NDMP client
or storage.

Fixes #329: Add some safeguards against running a Native Backup Job on
            NDMP client or storage.
Don't save filehist for NDMP backup when requested.

Some NDMP implementations send their FILEHIST information in an out of
order way which we currently don't handle fully correct so allow the user
to set a config option to allow not to save the FILEHIST only count the
files and directories saved.
Fix typo.