use config file settings to configure database

Let the database configuration scripts get the configuration parameter from the director config file.
Now, the scripts try to get there values in following order:
  1. environment variable (db_name, db_user, db_password)
  2. director config file
  3. fallback value (from configure)

Signed-off-by: Marco van Wieringen <marco.van.wieringen@bareos.com>
bareos-config get_database_param: use dbcheck

modified get_database_param to use bareos-dbcheck to get database parameter
instead of directly accessing the Bareos Director config file.
Because bareos-dbcheck uses the Bareos config parser this prevents problems with different formating.

Signed-off-by: Marco van Wieringen <marco.van.wieringen@bareos.com>
get_database_param: return default value

return the default value, if calling bareos-dhcheck fails.

Signed-off-by: Marco van Wieringen <marco.van.wieringen@bareos.com>
remove mysql user bareos@%

and tries to avoid problems with make_bareos_tables when called multiple times

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

Restore original author of parts of the code and show that its part of
a refactoring of the code.
Update AUTHORS.
Rewrite config engine to use integer types.

Instead of using function pointers for storing the config parser function
to call use integer types which are translated at runtime to the correct
function to call. This should work around hardening being performed on
shared libraries on some Linux platforms. On those platforms the actual
comparing of the function pointers fail, using integers for the different
data types makes it also possible to use an elegant switch to jump to the
correct parsing function instead of using an endless set of ifs needed when
comparing memory addresses of functions.

An extra side effect of not using function pointers is that the store functions
don't need to be global so the parse_conf.c in the shared library only exports
10 instead of 32 symbols and also the daemon specific store function can be
local only functions. The only thing needed is a callback to a dispatch function
in the daemon when it has no standard config items which are not of a generic
type (e.g. not bool, integer etc but things like protocol etc.) which leads to a
very small extra payload which is probably not even measurable.
Remove MAXSTRING variable

Fix long standing TODO to remove the MAXSTRING definition.
Use POOLMEM and POOL_MEM to replace the fixed sized buffers.

Fixes #164: Remove MAXSTRING variable
Implemented print of configuration
Move jobdefs before jobs in parser.

That way we het a config that first has the JobDefs and then
the Jobs which makes it easier to read for us mortals.
Only print when some items have a non zero setting.
Use an item formatter to do the right indention level.

From now on we use an indention function which we pass the wanted
indention level so we no longer have to embed the right number of spaces
in the output string. The options of a fileset should now be printed
with the right indention level.
Don't use me global variable in debug mode.
Promote the BRSRES::print_config() method.

Lets make BRSRES::print_config() a generic method that is in the shared
library and can be used by each daemon for printing the generic types
support by libbareoscfg and allow specific printing via an additional
callback that is initialized on init of the CONFIG class.
Transplant some code from parse_conf.c to res.c
Bring config engine to 2014 and don't polute namespace.

Implement a TODO from June 2008 and get ride of a slack of global
variables used by the config engine. The code seems to be have been
refactored in 2008 to access most configfile parsing via the CONFIG
class and it already has most of the needed structures which also were
kept as global variables. From now on the config engine is accessed via
the CONFIG class and only res_all is left as global variable. As a side
effect the config CLASS is now available as my_config and is a global
variable.

Global variable introduced:

- CLASS CONFIG *my_config (Global configuration)

Global variables removed:

- res_all_size
- r_first
- r_last
- resources
- res_head

It should be possible also to get ride of res_all but that needs some
more testing. And is currently not very high on my urgency map.
Bump copyright on changed files.
Suppress printing of non existing resource types.

Only print a resource type if one ore more exist when using show all.
Don't print config keyword aliases.

Some config keywords are an alias for an other when dumping the config
we should not print these entries as otherwise we get the same config
keyword set multiple times.
Optimize checking of required and default values.

When printing the configuration we now first check if we need to print
the value by checking if its a required value or matches the default
setting in the config table. By moving it before the big switch we can
eliminate quite some duplicate code and always use the right type of
value in the union with result types.