[pkg-bacula-commits] [bacula] 01/01: Imported upstream version 7.2.0

Carsten Leonhardt leo at moszumanska.debian.org
Wed Nov 11 09:59:11 UTC 2015


This is an automated email from the git hooks/post-receive script.

leo pushed a commit to branch upstream
in repository bacula.

commit 64dd308d55683501ee81d80af6e2aa6941fd7ad7
Author: Carsten Leonhardt <leo at debian.org>
Date:   Wed Nov 11 10:51:57 2015 +0100

    Imported upstream version 7.2.0
    
    Changes from upstream:
    src/lib/sha1.{h,c}: (#658326) remove, DFSG-nonfree, RFC 3174
---
 .gitignore                                         |  217 +-
 ChangeLog                                          |  328 +-
 LICENSE                                            |   67 +-
 LICENSE-FAQ                                        |   22 +-
 LICENSE-FOSS                                       |  319 ++
 Makefile.in                                        |   71 +-
 ReleaseNotes                                       |  404 +-
 autoconf/Make.common.in                            |   31 +-
 autoconf/acconfig.h                                |    6 +-
 autoconf/bacula-macros/db.m4                       |   11 +-
 autoconf/bacula-macros/db.m4.old                   | 1295 -------
 autoconf/bacula-macros/os.m4                       |    3 +
 autoconf/config.h.in                               |   41 +-
 autoconf/configure.in                              |  222 +-
 autoconf/mkinstalldirs                             |   32 +-
 commits                                            |    2 -
 configure                                          |  824 ++--
 examples/conf/kernsconfig                          |   34 +-
 examples/nagios/check_bacula/Makefile.in           |    4 +-
 examples/nagios/check_bacula/check_bacula.c        |    2 +-
 get_authors                                        |    2 -
 manpages/Makefile.in                               |    2 +
 manpages/bacula-dir.8                              |    7 +-
 manpages/bacula-fd.8                               |    7 +-
 manpages/bacula-sd.8                               |    5 +
 manpages/bacula-tray-monitor.1                     |    2 +
 manpages/bacula.8                                  |   11 +-
 manpages/bat.1                                     |    2 +
 manpages/bconsole.8                                |    6 +-
 manpages/bcopy.8                                   |   10 +-
 manpages/bextract.8                                |    6 +-
 manpages/bls.8                                     |    8 +-
 manpages/bpluginfo.8                               |   13 +-
 manpages/bregex.8                                  |    9 +-
 manpages/bscan.8                                   |   13 +-
 manpages/bsmtp.1                                   |   13 +-
 manpages/btape.8                                   |    8 +-
 manpages/btraceback.8                              |    7 +-
 manpages/bwild.8                                   |    1 +
 manpages/dbcheck.8                                 |    2 +
 platforms/Makefile.in                              |    3 +
 platforms/aix/Makefile.in                          |    3 +
 platforms/alpha/Makefile.in                        |    3 +
 platforms/alpha/bacula-fd.in                       |    7 +-
 platforms/bsdi/Makefile.in                         |    3 +
 platforms/bsdi/bacula-dir.in                       |    5 +-
 platforms/bsdi/bacula-fd.in                        |    7 +-
 platforms/bsdi/bacula-sd.in                        |    7 +-
 platforms/contrib-rpm/build_rpm.sh                 |   29 +-
 platforms/contrib-rpm/rpm_wizard.sh                |    5 +-
 platforms/contrib-rpm/rpmkey.spec                  |    5 +-
 platforms/darwin/Makefile.in                       |    3 +
 platforms/debian/Makefile.in                       |    3 +
 platforms/debian/bacula-dir.in                     |    5 +
 platforms/debian/bacula-fd.in                      |    5 +
 platforms/debian/bacula-sd.in                      |    5 +
 platforms/freebsd/Makefile.in                      |    3 +
 platforms/freebsd/bacula-dir.in                    |    6 +-
 platforms/freebsd/bacula-fd.in                     |    7 +-
 platforms/freebsd/bacula-sd.in                     |    7 +-
 platforms/gentoo/Makefile.in                       |    5 +-
 platforms/gentoo/bacula-dir.in                     |    3 +
 platforms/gentoo/bacula-fd.in                      |    3 +
 platforms/gentoo/bacula-sd.in                      |    3 +
 platforms/gentoo/bacula.ebuild                     |  736 ++--
 platforms/hurd/Makefile.in                         |    3 +
 platforms/hurd/bacula-dir.in                       |    5 +
 platforms/hurd/bacula-fd.in                        |    5 +
 platforms/hurd/bacula-sd.in                        |    5 +
 platforms/irix/Makefile.in                         |    3 +
 platforms/irix/bacula-dir.in                       |    6 +-
 platforms/irix/bacula-fd.in                        |    7 +-
 platforms/irix/bacula-sd.in                        |    7 +-
 platforms/mandrake/Makefile.in                     |    3 +
 platforms/mandrake/bacula-dir.in                   |    6 +-
 platforms/mandrake/bacula-fd.in                    |    7 +-
 platforms/mandrake/bacula-sd.in                    |    7 +-
 platforms/mandrake/bacula.spec.bluca.in            |    2 +-
 platforms/openbsd/Makefile.in                      |    3 +
 platforms/openbsd/bacula-dir.in                    |    6 +-
 platforms/openbsd/bacula-fd.in                     |    7 +-
 platforms/openbsd/bacula-sd.in                     |    7 +-
 platforms/osx/Makefile.in                          |   30 +-
 platforms/osx/README                               |    6 +-
 platforms/redhat/Makefile.in                       |    3 +
 platforms/redhat/bacula-dir.in                     |   20 +-
 platforms/redhat/bacula-fd.in                      |   19 +-
 platforms/redhat/bacula-sd.in                      |   22 +-
 platforms/rpms/redhat/bacula-bat.spec.in           |   15 +-
 platforms/rpms/redhat/bacula-client-static.spec.in |  286 ++
 platforms/rpms/redhat/bacula-docs.spec.in          |    1 -
 platforms/rpms/redhat/bacula-mtx.spec.in           |    9 +-
 platforms/rpms/redhat/bacula.spec.in               |    2 -
 platforms/rpms/suse/bacula-bat.spec.in             |   13 +-
 platforms/rpms/suse/bacula-docs.spec.in            |    5 +-
 platforms/rpms/suse/bacula-mtx.spec.in             |    9 +-
 platforms/rpms/suse/bacula.spec.in                 |    5 +-
 platforms/slackware/Makefile.in                    |    3 +
 platforms/slackware/functions.bacula.in            |  115 +-
 platforms/slackware/rc.bacula-dir.in               |   70 +-
 platforms/slackware/rc.bacula-fd.in                |   70 +-
 platforms/slackware/rc.bacula-sd.in                |   71 +-
 platforms/solaris/Makefile.in                      |   70 +-
 platforms/solaris/bacula-dir.in                    |   29 +-
 platforms/solaris/bacula-fd.in                     |   29 +-
 platforms/solaris/bacula-sd.in                     |   29 +-
 platforms/solaris/copyright                        |   34 +-
 platforms/suse/Makefile.in                         |    3 +
 platforms/suse/bacula-dir.in                       |   14 +-
 platforms/suse/bacula-fd.in                        |   15 +-
 platforms/suse/bacula-sd.in                        |   13 +-
 platforms/suse/bacula.in                           |    3 +
 platforms/systemd/Makefile.in                      |  116 +-
 platforms/systemd/bacula-dir.service.in            |   44 +-
 platforms/systemd/bacula-fd.service.in             |   32 +-
 platforms/systemd/bacula-sd.service.in             |   32 +-
 platforms/systemd/bacula.conf.in                   |    2 -
 platforms/ubuntu/Makefile.in                       |    3 +
 platforms/ubuntu/bacula-dir.in                     |    5 +
 platforms/ubuntu/bacula-fd.in                      |    5 +
 platforms/ubuntu/bacula-sd.in                      |    5 +
 platforms/unknown/Makefile.in                      |    3 +
 po/POTFILES.in                                     |   12 +-
 po/bacula.pot                                      |  207 +-
 po/de.po                                           | 1950 ++++++----
 po/es.po                                           | 3932 +++++++++++++-------
 po/es_AR.po                                        | 1695 ++++++++-
 po/fi.po                                           | 1664 ++++++++-
 po/fr.po                                           | 2629 +++++++++----
 po/it.po                                           | 1653 +++++++-
 po/nl.po                                           | 1250 +++++--
 po/pl.po                                           | 1342 ++++++-
 po/sv.po                                           |  212 +-
 po/uk.po                                           | 1442 ++++---
 release/README                                     |    4 +
 release/ReleaseProcedure.txt                       |    4 +
 release/check_packages                             |   25 +
 release/clean                                      |    5 +-
 release/config                                     |    8 +-
 release/git2changelog.pl                           |    3 +
 release/makeall                                    |    4 +-
 release/makebacularel                              |    5 +-
 release/makedocsonly                               |    3 +
 release/makedocsrel                                |    2 +
 release/makemanualsrel                             |   64 +
 release/makerescuerel                              |   81 -
 release/pushtags                                   |    3 +
 release/sign                                       |    4 +
 release/upload                                     |   38 +
 scripts/Makefile.in                                |    8 +-
 scripts/bacula-ctl-dir.in                          |  123 +-
 scripts/bacula-ctl-fd.in                           |  118 +-
 scripts/bacula-ctl-sd.in                           |  118 +-
 scripts/bacula-tray-monitor.desktop.in             |   10 +
 scripts/bacula.in                                  |   20 +-
 scripts/bconsole.in                                |   19 +
 scripts/breload                                    |   43 -
 scripts/breload.in                                 |   63 +
 scripts/btraceback.dbx                             |    9 +-
 scripts/btraceback.gdb                             |    5 +-
 scripts/btraceback.in                              |   20 +-
 scripts/btraceback.mdb                             |    4 +
 scripts/defaultconfig                              |    3 +
 scripts/devel_bacula.in                            |    3 +
 scripts/disk-changer.in                            |  283 +-
 scripts/dvd-handler.in                             |  358 +-
 scripts/dvd-simulator.in                           |  298 +-
 scripts/freespace                                  |   34 +
 scripts/logrotate.in                               |    4 +
 scripts/logwatch/Makefile.in                       |    5 +
 scripts/logwatch/bacula                            |    5 +-
 scripts/manual_prune.pl                            |  251 ++
 scripts/mtx-changer.conf                           |   33 +
 scripts/mtx-changer.in                             |  130 +-
 src/Makefile.in                                    |    7 +-
 src/baconfig.h                                     |  223 +-
 src/bacula.h                                       |   33 +-
 src/bc_types.h                                     |   14 +-
 src/c                                              |   14 +-
 src/c.scr                                          |    8 +
 src/cats/Makefile.in                               |   47 +-
 src/cats/bdb.h                                     |  250 ++
 src/cats/bdb_mysql.h                               |   47 +-
 src/cats/bdb_postgresql.h                          |   53 +-
 src/cats/bdb_priv.h                                |   75 -
 src/cats/bdb_sqlite.h                              |   47 +-
 src/cats/bvfs.c                                    |  358 +-
 src/cats/bvfs.h                                    |   34 +-
 src/cats/cats.c                                    |  268 +-
 src/cats/cats.h                                    |  314 +-
 src/cats/cats_dummy.c                              |   29 -
 src/cats/cats_null.c                               |   35 +
 src/cats/create_bacula_database.in                 |   31 +-
 src/cats/create_mysql_database.in                  |   18 +-
 src/cats/create_postgresql_database.in             |   20 +-
 src/cats/create_sqlite3_database.in                |   22 +-
 src/cats/create_sqlite3_database.in.patch          |    4 +-
 src/cats/delete_catalog_backup.in                  |   28 +-
 src/cats/drop_bacula_database.in                   |   22 +-
 src/cats/drop_bacula_tables.in                     |   31 +-
 src/cats/drop_mysql_database.in                    |   18 +-
 src/cats/drop_mysql_tables.in                      |   19 +-
 src/cats/drop_postgresql_database.in               |   18 +-
 src/cats/drop_postgresql_tables.in                 |   19 +-
 src/cats/drop_sqlite3_database.in                  |   18 +-
 src/cats/drop_sqlite3_tables.in                    |   18 +-
 src/cats/grant_bacula_privileges.in                |   31 +-
 src/cats/grant_mysql_privileges.in                 |   16 +-
 src/cats/grant_postgresql_privileges.in            |   21 +-
 src/cats/grant_sqlite3_privileges.in               |   18 +-
 src/cats/install-default-backend.in                |   16 +-
 src/cats/make_bacula_tables.in                     |   31 +-
 src/cats/make_catalog_backup.in                    |   16 +-
 src/cats/make_catalog_backup.in.patch              |   13 +
 src/cats/make_catalog_backup.pl.in                 |  140 +-
 src/cats/make_mysql_tables.in                      |   65 +-
 src/cats/make_postgresql_tables.in                 |   69 +-
 src/cats/make_sqlite3_tables.in                    |   54 +-
 src/cats/make_sqlite3_tables.in.patch              |   12 -
 src/cats/mysql.c                                   | 1407 +++----
 src/cats/mysql.in                                  |   18 +-
 src/cats/postgresql.c                              | 1512 ++++----
 src/cats/postgresql.in                             |   18 +-
 src/cats/protos.h                                  |  340 +-
 src/cats/sql.c                                     | 1531 ++++----
 src/cats/sql_cmds.c                                |  325 +-
 src/cats/sql_cmds.h                                |   25 +-
 src/cats/sql_create.c                              |  867 ++---
 src/cats/sql_delete.c                              |  130 +-
 src/cats/sql_find.c                                |  214 +-
 src/cats/sql_get.c                                 |  986 +++--
 src/cats/sql_glue.c                                |  200 -
 src/cats/sql_glue.h                                |   63 -
 src/cats/sql_list.c                                |  490 ++-
 src/cats/sql_update.c                              |  277 +-
 src/cats/sqlite.c                                  | 1457 ++++----
 src/cats/sqlite.in                                 |   18 +-
 src/cats/update_bacula_tables.in                   |   31 +-
 src/cats/update_mysql_tables.in                    |  151 +-
 src/cats/update_postgresql_tables.in               |  147 +-
 src/cats/update_sqlite3_tables.in                  |   98 +-
 src/cats/update_sqlite3_tables.in.patch            |    7 +-
 src/ch.h                                           |   12 +-
 src/console/Makefile.in                            |    8 +-
 src/console/authenticate.c                         |   20 +-
 src/console/bconsole.conf.in                       |    3 +
 src/console/conio.c                                |   27 +-
 src/console/conio.h                                |   12 +-
 src/console/console.c                              |   51 +-
 src/console/console_conf.c                         |   78 +-
 src/console/console_conf.h                         |   13 +-
 src/console/func.h                                 |   19 +
 src/count-lines                                    |    9 +
 src/dird/Makefile.in                               |   14 +-
 src/dird/admin.c                                   |   12 +-
 src/dird/authenticate.c                            |   29 +-
 src/dird/autoprune.c                               |   16 +-
 src/dird/backup.c                                  |  106 +-
 src/dird/bsr.c                                     |   28 +-
 src/dird/bsr.h                                     |   14 +-
 src/dird/catreq.c                                  |  100 +-
 src/dird/dir_plugins.c                             |   50 +-
 src/dird/dir_plugins.h                             |   12 +-
 src/dird/dird.c                                    |  333 +-
 src/dird/dird.h                                    |   13 +-
 src/dird/dird_conf.c                               |  608 +--
 src/dird/dird_conf.h                               |  113 +-
 src/dird/expand.c                                  |   12 +-
 src/dird/fd_cmds.c                                 |  113 +-
 src/dird/getmsg.c                                  |   22 +-
 src/dird/inc_conf.c                                |  407 +-
 src/dird/job.c                                     |  274 +-
 src/dird/jobq.c                                    |   77 +-
 src/dird/jobq.h                                    |   13 +-
 src/dird/mac.c                                     |   58 +-
 src/dird/mac_sql.c                                 |   14 +-
 src/dird/mountreq.c                                |   12 +-
 src/dird/msgchan.c                                 |   26 +-
 src/dird/newvol.c                                  |   12 +-
 src/dird/next_vol.c                                |   14 +-
 src/dird/protos.h                                  |   38 +-
 src/dird/query.sql                                 |    4 +-
 src/dird/recycle.c                                 |   12 +-
 src/dird/restore.c                                 |   45 +-
 src/dird/run_conf.c                                |   39 +-
 src/dird/scheduler.c                               |   22 +-
 src/dird/snapshot.c                                |  765 ++++
 src/dird/ua.h                                      |   20 +-
 src/dird/ua_acl.c                                  |   12 +-
 src/dird/ua_cmds.c                                 |  325 +-
 src/dird/ua_dotcmds.c                              |  261 +-
 src/dird/ua_input.c                                |   12 +-
 src/dird/ua_label.c                                |   32 +-
 src/dird/ua_output.c                               |  127 +-
 src/dird/ua_prune.c                                |   42 +-
 src/dird/ua_purge.c                                |   39 +-
 src/dird/ua_query.c                                |   12 +-
 src/dird/ua_restore.c                              |  142 +-
 src/dird/ua_run.c                                  |  147 +-
 src/dird/ua_select.c                               |  139 +-
 src/dird/ua_server.c                               |   12 +-
 src/dird/ua_status.c                               |  134 +-
 src/dird/ua_tree.c                                 |   16 +-
 src/dird/ua_update.c                               |   22 +-
 src/dird/vbackup.c                                 |   16 +-
 src/dird/verify.c                                  |   35 +-
 src/filed/Makefile.in                              |   49 +-
 src/filed/accurate.c                               |   74 +-
 src/filed/acl.c                                    | 1298 +++----
 src/filed/acl.h                                    |   93 +-
 src/filed/authenticate.c                           |  130 +-
 src/filed/backup.c                                 | 1329 +++----
 src/filed/backup.h                                 |   80 +
 src/filed/bacula-fd.conf.in                        |    4 +
 src/filed/crypto.c                                 |  322 ++
 src/filed/estimate.c                               |   12 +-
 src/filed/fd_plugins.c                             |   98 +-
 src/filed/fd_plugins.h                             |   21 +-
 src/filed/fd_snapshot.c                            | 1901 ++++++++++
 src/filed/fd_snapshot.h                            |   68 +
 src/filed/filed.c                                  |   82 +-
 src/filed/filed.h                                  |   82 +-
 src/filed/filed_conf.c                             |  149 +-
 src/filed/filed_conf.h                             |   13 +-
 src/filed/heartbeat.c                              |   12 +-
 src/filed/hello.c                                  |  214 ++
 src/filed/job.c                                    |  299 +-
 src/filed/protos.h                                 |   41 +-
 src/filed/restore.c                                | 1063 +++---
 src/filed/restore.h                                |   15 +-
 src/filed/status.c                                 |  181 +-
 src/filed/verify.c                                 |   62 +-
 src/filed/verify_vol.c                             |   64 +-
 src/filed/xattr.c                                  | 1696 ++++-----
 src/filed/xattr.h                                  |   51 +-
 src/fileopts.h                                     |   16 +-
 src/filetypes.h                                    |   14 +-
 src/findlib/Makefile.in                            |   14 +-
 src/findlib/{file_attrs.c => attribs.c}            |  105 +-
 src/findlib/bfile.c                                |  285 +-
 src/findlib/bfile.h                                |   29 +-
 src/findlib/{file_create.c => create_file.c}       |   89 +-
 src/findlib/drivetype.c                            |   12 +-
 src/findlib/enable_priv.c                          |   44 +
 src/findlib/find.c                                 |   46 +-
 src/findlib/find.h                                 |   38 +-
 src/findlib/find_one.c                             |   37 +-
 src/findlib/fstype.c                               |  405 +-
 src/findlib/match.c                                |   26 +-
 src/findlib/{makepath.c => mkpath.c}               |   85 +-
 src/findlib/priv.c                                 |   47 -
 src/findlib/protos.h                               |   20 +-
 src/findlib/savecwd.c                              |  121 +
 src/findlib/savecwd.h                              |   43 +
 src/host.h.in                                      |   14 +-
 src/jcr.h                                          |   76 +-
 src/lib/Makefile.in                                |   53 +-
 src/lib/address_conf.c                             |   35 +-
 src/lib/address_conf.h                             |   12 +-
 src/lib/alist.c                                    |   12 +-
 src/lib/alist.h                                    |   12 +-
 src/lib/attr.c                                     |   14 +-
 src/lib/attr.h                                     |   12 +-
 src/lib/base64.c                                   |   14 +-
 src/lib/base64.h                                   |   24 +-
 src/lib/berrno.c                                   |   18 +-
 src/lib/berrno.h                                   |   15 +-
 src/lib/bget_msg.c                                 |   82 +-
 src/lib/bget_msg.h                                 |  111 +
 src/lib/binflate.c                                 |   14 +-
 src/lib/bits.h                                     |   12 +-
 src/lib/bnet.c                                     |  155 +-
 src/lib/bnet_server.c                              |   53 +-
 src/lib/bpipe.c                                    |   25 +-
 src/lib/bpipe.h                                    |   14 +-
 src/lib/breg.c                                     |   40 +-
 src/lib/breg.h                                     |   25 +-
 src/lib/bregex.c                                   |   14 +-
 src/lib/bregex.h                                   |   12 +-
 src/lib/bsnprintf.c                                |   12 +-
 src/lib/bsock.c                                    |  205 +-
 src/lib/bsock.h                                    |   27 +-
 src/lib/bsys.c                                     |  225 +-
 src/lib/btime.c                                    |   12 +-
 src/lib/btime.h                                    |   12 +-
 src/lib/btimers.c                                  |   12 +-
 src/lib/btimers.h                                  |   12 +-
 src/lib/cram-md5.c                                 |   17 +-
 src/lib/crc32.c                                    |   37 +-
 src/lib/crypto.c                                   |   90 +-
 src/lib/crypto.h                                   |   12 +-
 src/lib/daemon.c                                   |   44 +-
 src/lib/devlock.c                                  |   36 +-
 src/lib/devlock.h                                  |   12 +-
 src/lib/dlist.c                                    |   12 +-
 src/lib/dlist.h                                    |   13 +-
 src/lib/edit.c                                     |   32 +-
 src/lib/guid_to_name.c                             |   12 +-
 src/lib/guid_to_name.h                             |   13 +-
 src/lib/hmac.c                                     |   14 +-
 src/lib/htable.c                                   |  348 +-
 src/lib/htable.h                                   |   84 +-
 src/lib/ini.c                                      |  201 +-
 src/lib/ini.h                                      |   55 +-
 src/lib/jcr.c                                      |   87 +-
 src/lib/lex.c                                      |  100 +-
 src/lib/lex.h                                      |   12 +-
 src/lib/lib.h                                      |   13 +-
 src/lib/lockmgr.c                                  |   80 +-
 src/lib/lockmgr.h                                  |   52 +-
 src/lib/md5.c                                      |   14 +-
 src/lib/md5.h                                      |   24 +-
 src/lib/mem_pool.c                                 |   13 +-
 src/lib/mem_pool.h                                 |   12 +-
 src/lib/message.c                                  |  223 +-
 src/lib/message.h                                  |   26 +-
 src/lib/mntent_cache.c                             |  484 ---
 src/lib/mntent_cache.h                             |   53 -
 src/lib/mutex_list.h                               |   12 +-
 src/lib/openssl.c                                  |   98 +-
 src/lib/openssl.h                                  |   14 +-
 src/lib/parse_conf.c                               |  144 +-
 src/lib/parse_conf.h                               |   19 +-
 src/lib/plugins.c                                  |   30 +-
 src/lib/plugins.h                                  |   14 +-
 src/lib/priv.c                                     |   12 +-
 src/lib/protos.h                                   |   42 +-
 src/lib/queue.c                                    |   33 +-
 src/lib/queue.h                                    |   21 +-
 src/lib/rblist.c                                   |   14 +-
 src/lib/rblist.h                                   |   17 +-
 src/lib/res.c                                      |   12 +-
 src/lib/runscript.c                                |   12 +-
 src/lib/runscript.h                                |   15 +-
 src/lib/rwlock.c                                   |   45 +-
 src/lib/rwlock.h                                   |   17 +-
 src/lib/scan.c                                     |   73 +-
 src/lib/sellist.c                                  |   12 +-
 src/lib/sellist.h                                  |   12 +-
 src/lib/serial.c                                   |   45 +-
 src/lib/serial.h                                   |   23 +-
 src/lib/signal.c                                   |   24 +-
 src/lib/smartall.c                                 |   28 +-
 src/lib/smartall.h                                 |   12 +-
 src/lib/status.h                                   |   20 +-
 src/lib/tls.c                                      |   57 +-
 src/lib/tls.h                                      |   14 +-
 src/lib/tree.c                                     |   14 +-
 src/lib/tree.h                                     |   12 +-
 src/lib/util.c                                     |  131 +-
 src/lib/var.c                                      |   17 +-
 src/lib/var.h                                      |   15 -
 src/lib/waitq.h                                    |   34 +-
 src/lib/watchdog.c                                 |   12 +-
 src/lib/watchdog.h                                 |   12 +-
 src/lib/workq.c                                    |   12 +-
 src/lib/workq.h                                    |   14 +-
 src/plugins/Makefile                               |    3 +
 src/plugins/dir/Makefile.in                        |    6 +-
 src/plugins/dir/example-plugin-dir.c               |   20 +-
 src/plugins/fd/Makefile.in                         |    3 +
 src/plugins/fd/bpipe-fd.c                          |  115 +-
 src/plugins/fd/example-plugin-fd.c                 |   27 +-
 src/plugins/fd/fd_common.h                         |  182 +-
 src/plugins/fd/test-deltaseq-fd.c                  |   63 +-
 src/plugins/fd/test-plugin-fd.c                    |   50 +-
 src/plugins/sd/Makefile.in                         |   17 +-
 src/plugins/sd/example-plugin-sd.c                 |   41 +-
 src/plugins/sd/main.c                              |   30 +-
 src/qt-console/README                              |   10 +-
 src/qt-console/bat.h                               |   12 +-
 src/qt-console/bat.pro.in                          |   10 +-
 src/qt-console/bat.pro.mingw32.in                  |   17 +-
 .../{bat.pro.mingw32.in => bat.pro.mingw64}        |   27 +-
 .../{bat.pro.mingw32.in => bat.pro.mingw64.in}     |   21 +-
 src/qt-console/bat_conf.cpp                        |   37 +-
 src/qt-console/bat_conf.h                          |   14 +-
 src/qt-console/bcomm/dircomm.cpp                   |   55 +-
 src/qt-console/bcomm/dircomm.h                     |   20 +-
 src/qt-console/bcomm/dircomm_auth.cpp              |   24 +-
 src/qt-console/clients/clients.cpp                 |   38 +-
 src/qt-console/clients/clients.h                   |   16 +-
 src/qt-console/console/console.cpp                 |   70 +-
 src/qt-console/console/console.h                   |   20 +-
 src/qt-console/fileset/fileset.cpp                 |   36 +-
 src/qt-console/fileset/fileset.h                   |   16 +-
 src/qt-console/help/help.cpp                       |   16 +-
 src/qt-console/help/help.h                         |   18 +-
 src/qt-console/job/job.cpp                         |  143 +-
 src/qt-console/job/job.h                           |   16 +-
 src/qt-console/job/job.ui                          |   29 +
 src/qt-console/jobgraphs/jobplot.cpp               |   38 +-
 src/qt-console/jobgraphs/jobplot.h                 |   18 +-
 src/qt-console/joblist/joblist.cpp                 |   30 +-
 src/qt-console/joblist/joblist.h                   |   18 +-
 src/qt-console/joblog/joblog.cpp                   |  128 +-
 src/qt-console/joblog/joblog.h                     |   16 +-
 src/qt-console/jobs/jobs.cpp                       |   34 +-
 src/qt-console/jobs/jobs.h                         |   16 +-
 src/qt-console/label/label.cpp                     |   18 +-
 src/qt-console/label/label.h                       |   16 +-
 src/qt-console/main.cpp                            |   29 +-
 src/qt-console/mainwin.cpp                         |   65 +-
 src/qt-console/mainwin.h                           |   22 +-
 src/qt-console/make-win32                          |   91 +-
 src/qt-console/mediaedit/mediaedit.cpp             |   28 +-
 src/qt-console/mediaedit/mediaedit.h               |   16 +-
 src/qt-console/mediainfo/mediainfo.cpp             |   32 +-
 src/qt-console/mediainfo/mediainfo.h               |   15 +-
 src/qt-console/mediainfo/mediainfo.ui              |    2 +-
 src/qt-console/medialist/medialist.cpp             |   64 +-
 src/qt-console/medialist/medialist.h               |   14 +-
 src/qt-console/medialist/mediaview.cpp             |   94 +-
 src/qt-console/medialist/mediaview.h               |   14 +-
 src/qt-console/mount/mount.cpp                     |   18 +-
 src/qt-console/mount/mount.h                       |   16 +-
 src/qt-console/pages.cpp                           |   56 +-
 src/qt-console/pages.h                             |   17 +-
 src/qt-console/relabel/relabel.cpp                 |   18 +-
 src/qt-console/relabel/relabel.h                   |   16 +-
 src/qt-console/restore/brestore.cpp                |   50 +-
 src/qt-console/restore/brestore.ui                 |    2 +-
 src/qt-console/restore/prerestore.cpp              |   24 +-
 src/qt-console/restore/restore.cpp                 |   42 +-
 src/qt-console/restore/restore.h                   |   30 +-
 src/qt-console/restore/restoretree.cpp             |   62 +-
 src/qt-console/restore/restoretree.h               |   18 +-
 src/qt-console/run/estimate.cpp                    |   20 +-
 src/qt-console/run/prune.cpp                       |   16 +-
 src/qt-console/run/run.cpp                         |   26 +-
 src/qt-console/run/run.h                           |   22 +-
 src/qt-console/run/runcmd.cpp                      |   32 +-
 src/qt-console/select/select.cpp                   |   16 +-
 src/qt-console/select/select.h                     |   16 +-
 src/qt-console/select/textinput.cpp                |   18 +-
 src/qt-console/select/textinput.h                  |   16 +-
 src/qt-console/status/clientstat.cpp               |   14 +-
 src/qt-console/status/clientstat.h                 |   16 +-
 src/qt-console/status/dirstat.cpp                  |   20 +-
 src/qt-console/status/dirstat.h                    |   16 +-
 src/qt-console/status/storstat.cpp                 |   22 +-
 src/qt-console/status/storstat.h                   |   16 +-
 src/qt-console/storage/content.cpp                 |   54 +-
 src/qt-console/storage/content.h                   |   14 +-
 src/qt-console/storage/storage.cpp                 |   50 +-
 src/qt-console/storage/storage.h                   |   16 +-
 src/qt-console/tray-monitor/authenticate.cpp       |   22 +-
 src/qt-console/tray-monitor/tray-monitor.cpp       |   18 +-
 src/qt-console/tray-monitor/tray-monitor.h         |   14 +-
 src/qt-console/tray-monitor/tray-monitor.pro.in    |    2 +-
 ...-monitor.pro.in => tray-monitor.pro.mingw32.in} |   19 +-
 ...-monitor.pro.in => tray-monitor.pro.mingw64.in} |   21 +-
 src/qt-console/tray-monitor/tray-ui.h              |   29 +-
 src/qt-console/tray-monitor/tray_conf.cpp          |   12 +-
 src/qt-console/tray-monitor/tray_conf.h            |   12 +-
 src/qt-console/ts/bat_de.ts                        | 3797 ++++++++++++++-----
 src/qt-console/ts/bat_fr.ts                        |  742 ++--
 src/qt-console/util/comboutil.cpp                  |   60 +-
 src/qt-console/util/comboutil.h                    |   16 +-
 src/qt-console/util/fmtwidgetitem.cpp              |   54 +-
 src/qt-console/util/fmtwidgetitem.h                |   28 +-
 src/qt-console/win32/qmake.conf                    |   20 +-
 src/qt-console/win32/qplatformdefs.h               |  104 +-
 src/stored/Makefile.in                             |    4 +
 src/stored/acquire.c                               |   31 +-
 src/stored/ansi_label.c                            |   12 +-
 src/stored/append.c                                |   94 +-
 src/stored/askdir.c                                |  226 +-
 src/stored/authenticate.c                          |  167 +-
 src/stored/autochanger.c                           |   12 +-
 src/stored/bacula-sd.conf.in                       |    6 +
 src/stored/bcopy.c                                 |   31 +-
 src/stored/bextract.c                              |  115 +-
 src/stored/block.c                                 |  129 +-
 src/stored/block.h                                 |   20 +-
 src/stored/block_util.c                            |   14 +-
 src/stored/bls.c                                   |   49 +-
 src/stored/bscan.c                                 |  154 +-
 src/stored/bsr.h                                   |   16 +-
 src/stored/btape.c                                 |   22 +-
 src/stored/butil.c                                 |   21 +-
 src/stored/dev.c                                   |  382 +-
 src/stored/dev.h                                   |   97 +-
 src/stored/device.c                                |  129 +-
 src/stored/dircmd.c                                |  183 +-
 src/stored/ebcdic.c                                |   20 +-
 src/stored/fd_cmds.c                               |   33 +-
 src/stored/file_dev.c                              |  158 +-
 src/stored/file_dev.h                              |   15 +-
 src/stored/hello.c                                 |  319 ++
 src/stored/job.c                                   |  126 +-
 src/stored/label.c                                 |   89 +-
 src/stored/lock.c                                  |   19 +-
 src/stored/lock.h                                  |   12 +-
 src/stored/match_bsr.c                             |   14 +-
 src/stored/mount.c                                 |   66 +-
 src/stored/os.c                                    |   12 +-
 src/stored/parse_bsr.c                             |   32 +-
 src/stored/protos.h                                |   42 +-
 src/stored/read.c                                  |   76 +-
 src/stored/read_records.c                          |   16 +-
 src/stored/record.c                                |  695 ----
 src/stored/record.h                                |   12 +-
 src/stored/record_read.c                           |   19 +-
 src/stored/record_util.c                           |   12 +-
 src/stored/record_write.c                          |   15 +-
 src/stored/reserve.c                               |   20 +-
 src/stored/reserve.h                               |   12 +-
 src/stored/scan.c                                  |   12 +-
 src/stored/sd_plugins.c                            |   71 +-
 src/stored/sd_plugins.h                            |   20 +-
 src/stored/spool.c                                 |   62 +-
 src/stored/status.c                                |  469 ++-
 src/stored/stored.c                                |  104 +-
 src/stored/stored.conf.in                          |    3 +
 src/stored/stored.h                                |   12 +-
 src/stored/stored_conf.c                           |  272 +-
 src/stored/stored_conf.h                           |   17 +-
 src/stored/tape_dev.c                              |   49 +-
 src/stored/tape_dev.h                              |   19 +-
 src/stored/vbackup.c                               |   60 +-
 src/stored/vol_mgr.c                               |   27 +-
 src/stored/vol_mgr.h                               |   12 +-
 src/stored/vtape_dev.c                             |   16 +-
 src/stored/vtape_dev.h                             |   18 +-
 src/stored/wait.c                                  |   12 +-
 src/streams.h                                      |  127 +-
 src/tools/Makefile.in                              |   44 +-
 src/tools/assert_macro.h                           |  154 -
 src/tools/bbatch.c                                 |   57 +-
 src/tools/bpluginfo.c                              |  625 ----
 src/tools/bregex.c                                 |   26 +-
 src/tools/bregtest.c                               |   18 +-
 src/tools/bsmtp.c                                  |  183 +-
 src/tools/bsnapshot.c                              | 1977 ++++++++++
 src/tools/bvfs_test.c                              |   35 +-
 src/tools/bwild.c                                  |   26 +-
 src/tools/cats_test.c                              |   71 +-
 src/tools/dbcheck.c                                |   37 +-
 src/tools/drivetype.c                              |   27 +-
 src/tools/fstype.c                                 |  133 +-
 src/tools/ing_test.c                               |  327 --
 src/tools/testfind.c                               |   23 +-
 src/tools/testls.c                                 |   14 +-
 src/tools/timelimit.c                              |   16 +-
 src/version.h                                      |   57 +-
 technotes                                          | 3282 ----------------
 {src/cats => updatedb}/update_bacula_tables.in     |   31 +-
 updatedb/update_bdb_tables_8_to_9                  |    9 -
 updatedb/update_mysql_tables.in                    |  149 +
 updatedb/update_mysql_tables_10_to_11.in           |    7 +-
 updatedb/update_mysql_tables_11_to_12.in           |    9 +-
 ...12_to_14.in => update_mysql_tables_12_to_13.in} |   23 +-
 updatedb/update_mysql_tables_13_to_14.in           |   37 +
 updatedb/update_mysql_tables_9_to_10.in            |    3 +
 updatedb/update_postgresql_tables.in               |  150 +
 updatedb/update_postgresql_tables_10_to_11.in      |    3 +
 updatedb/update_postgresql_tables_11_to_12.in      |    3 +
 ..._14.in => update_postgresql_tables_12_to_13.in} |   23 +-
 updatedb/update_postgresql_tables_13_to_14.in      |   38 +
 updatedb/update_postgresql_tables_9_to_10.in       |    3 +
 updatedb/update_sqlite3_tables.in                  |  112 +
 updatedb/update_sqlite3_tables_10_to_11.in         |    7 +-
 updatedb/update_sqlite3_tables_11_to_12.in         |    3 +
 updatedb/update_sqlite3_tables_12_to_14.in         |   52 -
 updatedb/update_sqlite3_tables_9_to_10.in          |    3 +
 updatedb/update_sqlite_tables_10_to_11.in          |    6 +-
 updatedb/update_sqlite_tables_9_to_10.in           |    4 +
 668 files changed, 49658 insertions(+), 31508 deletions(-)

diff --git a/.gitignore b/.gitignore
index 682e5dc..447e49c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,7 +6,7 @@
 # *.[oa]
 # *~
 
-#
+# 
 *.la
 *.a
 *.o
@@ -26,6 +26,7 @@ console.log
 console.sum
 diff
 fd
+update
 gconsole
 kernsconfig
 kernsconfignodb
@@ -93,7 +94,6 @@ oldtxt
 kerns-bs-config
 libtool
 config.status.lineno
-win32
 
 # autoconf/
 autoconf/autom4te.cache
@@ -172,8 +172,8 @@ po/*.gmo
 
 # scripts/
 scripts/bs_alert
-scripts/bsg_persist
 scripts/breload
+scripts/bsg_persist
 scripts/make_catalog_backup.pl
 scripts/bacula_config
 scripts/wxconsole.console_apps
@@ -313,10 +313,10 @@ src/console/static-bconsole
 src/console/.libs
 
 # src/dird/
-src/dird/bdirjson
 src/dird/1
 src/dird/2
 src/dird/3
+src/dird/bdirjson
 src/dird/Makefile
 src/dird/bacula-dir
 src/dird/bacula-dir.conf
@@ -329,10 +329,10 @@ src/dird/filelist.exc
 src/dird/.libs
 
 # src/filed/
-src/filed/bfdjson
 src/filed/Makefile
 src/filed/bacula-fd
 src/filed/bacula-fd.conf
+src/filed/bfdjson
 src/filed/btraceback
 src/filed/btraceback.gdb
 src/filed/host.h
@@ -382,7 +382,7 @@ src/lib/libbaccfg.a
 src/lib/libbacpy.a
 
 # src/plugins/dir/
-src/plugins/dir/*.o
+src/plugins/dir/*.o   
 src/plugins/dir/*.so
 src/plugins/dir/main
 src/plugins/dir/Makefile
@@ -412,6 +412,8 @@ src/qt-console/mult-inheritance
 src/qt-console/print-func
 src/qt-console/qrc_main.cpp
 src/qt-console/moc_*.cpp
+src/qt-console/moc64
+src/qt-console/ui64
 src/qt-console/v
 src/qt-console/ui
 src/qt-console/Makefile
@@ -431,6 +433,9 @@ src/qt-console/debug
 src/qt-console/release
 src/qt-console/Makefile.Debug
 src/qt-console/Makefile.Release
+src/qt-console/Makefile.mingw64
+src/qt-console/Makefile.mingw64.Debug
+src/qt-console/Makefile.mingw64.Release
 src/qt-console/object_script.bat.Debug
 src/qt-console/object_script.bat.Release
 src/qt-console/pkg-conf
@@ -440,18 +445,6 @@ src/qt-console/Makefile.mingw32
 src/qt-console/Makefile.mingw32.Debug
 src/qt-console/Makefile.mingw32.Release
 src/qt-console/bat.pro.mingw32
-src/qt-console/Makefile.mingw64
-src/qt-console/Makefile.mingw64.Debug
-src/qt-console/Makefile.mingw64.Release
-src/qt-console/moc64/
-src/qt-console/tray-monitor/Makefile.mingw64
-src/qt-console/tray-monitor/Makefile.mingw64.Debug
-src/qt-console/tray-monitor/Makefile.mingw64.Release
-src/qt-console/tray-monitor/moc32/
-src/qt-console/tray-monitor/moc64/
-src/qt-console/tray-monitor/ui32/
-src/qt-console/tray-monitor/ui64/
-src/qt-console/ui64/
 
 # src/qt-console/clients/
 src/qt-console/clients/.*.swp
@@ -498,19 +491,27 @@ src/qt-console/testprogs/putz/moc
 src/qt-console/tray-monitor/Makefile.mingw32
 src/qt-console/tray-monitor/Makefile.mingw32.Debug
 src/qt-console/tray-monitor/Makefile.mingw32.Release
+src/qt-console/tray-monitor/Makefile.mingw64
+src/qt-console/tray-monitor/Makefile.mingw64.Debug
+src/qt-console/tray-monitor/Makefile.mingw64.Release
 src/qt-console/tray-monitor/debug/
 src/qt-console/tray-monitor/release/
 src/qt-console/tray-monitor/moc/
 src/qt-console/tray-monitor/tray-monitor.conf
 src/qt-console/tray-monitor/tray-monitor.pro
 src/qt-console/tray-monitor/ui/
+src/qt-console/tray-monitor/ui32/
+src/qt-console/tray-monitor/ui64/
+src/qt-console/tray-monitor/moc32/
+src/qt-console/tray-monitor/moc64/
+src/qt-console/tray-monitor/tray-monitor.pro.mingw32
+src/qt-console/tray-monitor/tray-monitor.pro.mingw64
 
 # src/qt-console/ts/
 src/qt-console/ts/bat_fr.qm
 src/qt-console/ts/bat_de.qm
 
 # src/stored/
-src/stored/bsdjson
 src/stored/1
 src/stored/2
 src/stored/Makefile
@@ -521,6 +522,7 @@ src/stored/bls
 src/stored/bscan
 src/stored/btape
 src/stored/bcopy
+src/stored/bsdjson
 src/stored/btraceback
 src/stored/btraceback.gdb
 src/stored/file1Job1.bsr
@@ -539,10 +541,15 @@ src/stored/mount-simulator
 src/stored/mounted
 src/stored/slots
 src/stored/unmount-simulator
+src/stored/test-dedup
 src/stored/.libs
+src/stored/obj32
+src/stored/obj64
 
 # src/tools/
-src/tools/find_bad_jobmedia.pl
+src/tools/bsnapshot
+src/tools/bpluginfo
+src/tools/timelimit
 src/tools/ing_test
 src/tools/bregex
 src/tools/bwild
@@ -561,8 +568,6 @@ src/tools/bregtest
 src/tools/grow
 src/tools/.libs
 src/tools/bvfs_test
-src/tools/bpluginfo
-src/tools/timelimit
 
 # src/tray-monitor/
 src/tray-monitor/tray-monitor.conf
@@ -592,7 +597,6 @@ src/win32/debug
 src/win32/release32
 src/win32/release64
 src/win32/dll
-src/win32/build.log
 
 # src/win32
 src/win32*.user
@@ -690,6 +694,7 @@ src/win32/scripts/obj64
 src/win32/stored/*.d
 src/win32/stored/*.res
 src/win32/stored/obj32
+src/win32/stored/obj64
 
 # src/win32/stored/bcopy/
 src/win32/stored/bcopy/*.user
@@ -800,15 +805,6 @@ src/wx-console/bwx-console.conf
 src/wx-console/.libs
 
 # updatedb/
-updatedb/update_mysql_tables_1014_to_1015
-updatedb/update_mysql_tables_1015_to_1016
-updatedb/update_mysql_tables_12_to_13
-updatedb/update_mysql_tables_13_to_14
-updatedb/update_mysql_tables_14_to_1014
-updatedb/update_postgresql_tables_1014_to_1015
-updatedb/update_postgresql_tables_12_to_13
-updatedb/update_postgresql_tables_13_to_14
-updatedb/update_postgresql_tables_14_to_1014
 updatedb/update_mysql_tables_12_to_14
 updatedb/update_postgresql_tables_12_to_14
 updatedb/update_sqlite3_tables_12_to_14
@@ -823,6 +819,20 @@ updatedb/update_mysql_tables_9_to_10
 updatedb/update_postgresql_tables_9_to_10
 updatedb/update_sqlite3_tables_9_to_10
 updatedb/update_sqlite_tables_9_to_10
+updatedb/update_mysql_tables_1014_to_1015
+updatedb/update_mysql_tables_12_to_13
+updatedb/update_mysql_tables_13_to_14
+updatedb/update_mysql_tables_14_to_1014
+updatedb/update_mysql_tables_1015_to_1016
+updatedb/update_mysql_tables_1016_to_1017
+updatedb/update_postgresql_tables_1014_to_1015
+updatedb/update_postgresql_tables_12_to_13
+updatedb/update_postgresql_tables_13_to_14
+updatedb/update_postgresql_tables_14_to_1014
+updatedb/update_postgresql_tables_1015_to_1016
+updatedb/update_postgresql_tables_1016_to_1017
+updatedb/update_sqlite3_tables_1015_to_1016
+
 
 # /docs/
 /docs/manual-fr-base
@@ -1164,6 +1174,7 @@ updatedb/update_sqlite_tables_9_to_10
 /gui/bimagemgr/bacula-bimagemgr.spec
 
 # /regress/
+/regress/testtime.out
 /regress/kerns.config
 /regress/1
 /regress/config
@@ -1182,6 +1193,8 @@ updatedb/update_sqlite_tables_9_to_10
 /regress/DartConfiguration.tcl
 /regress/DartTestfile.txt
 /regress/Testing
+/regress/rtest.out
+/regress/testtime.out
 
 # /regress/scripts/
 /regress/scripts/multi-client-bacula-dir.conf
@@ -1261,146 +1274,6 @@ updatedb/update_sqlite_tables_9_to_10
 /regress/tests/1
 /regress/tests/2
 
-# /rescue/
-/rescue/autom4te.cache
-/rescue/config.log
-/rescue/config.status
-/rescue/Makefile
-/rescue/config.out
-/rescue/autoconf/config.log
-/rescue/kernsconfig
-/rescue/diff
-/rescue/mkcdrec
-/rescue/mkCDrec_*
-
-# /rescue/autoconf/
-/rescue/autoconf/config.log
-/rescue/autoconf/Make.common
-/rescue/autoconf/config.h.in
-
-# /rescue/freebsd/
-/rescue/freebsd/Makefile
-/rescue/freebsd/diskinfo
-/rescue/freebsd/format.hda
-/rescue/freebsd/mount_drives
-/rescue/freebsd/partition.hda
-/rescue/freebsd/sfdisk
-/rescue/freebsd/start_network
-/rescue/freebsd/1
-/rescue/freebsd/bacula-fd
-/rescue/freebsd/bacula-fd.conf
-
-# /rescue/knoppix/
-/rescue/knoppix/Makefile
-/rescue/knoppix/diskinfo
-/rescue/knoppix/format.hda
-/rescue/knoppix/mount_drives
-/rescue/knoppix/partition.hda
-/rescue/knoppix/sfdisk
-/rescue/knoppix/start_network
-/rescue/knoppix/1
-/rescue/knoppix/bacula-fd
-/rescue/knoppix/bacula-fd.conf
-
-# /rescue/knoppix/cdrom/
-/rescue/knoppix/cdrom/Makefile
-
-# /rescue/knoppix/cdrom
-/rescue/knoppix/cdromMakefile
-
-# /rescue/linux/
-/rescue/linux/Makefile
-/rescue/linux/diskinfo
-/rescue/linux/format.hda
-/rescue/linux/mount_drives
-/rescue/linux/partition.hda
-/rescue/linux/sfdisk
-/rescue/linux/start_network
-/rescue/linux/1
-/rescue/linux/bacula-fd
-/rescue/linux/bacula-fd.conf
-
-# /rescue/linux/cdrom/
-/rescue/linux/cdrom/bootcd.iso
-/rescue/linux/cdrom/Makefile
-/rescue/linux/cdrom/cdtree
-
-# /rescue/linux/cdrom
-/rescue/linux/cdromformat.hda
-/rescue/linux/cdromformat.hdb
-/rescue/linux/cdromformat.sda
-/rescue/linux/cdromformat.sdb
-/rescue/linux/cdromstart_network
-/rescue/linux/cdrompartition.hda
-/rescue/linux/cdrompartition.hdb
-/rescue/linux/cdrommount_drives
-/rescue/linux/cdrometc.gz
-/rescue/linux/cdromdiskinfo
-/rescue/linux/cdromMakefile
-/rescue/linux/cdromcreate-lv
-/rescue/linux/cdromcreate-pv
-/rescue/linux/cdromcreate-vg
-
-# /rescue/linux/cdrombin/
-/rescue/linux/cdrombin/bacula-fd
-
-# /rescue/linux/cdrom/cdtree/
-/rescue/linux/cdrom/cdtree/root.tar.gz
-/rescue/linux/cdrom/cdtree/boot
-/rescue/linux/cdrom/cdtree/bacula-timmy
-/rescue/linux/cdrom/cdtree/bacula-rufus
-/rescue/linux/cdrom/cdtree/bacula-polymatou
-/rescue/linux/cdrom/cdtree/bacula-matou
-/rescue/linux/cdrom/cdtree/bacula-omally
-
-# /rescue/linux/cdrom/cdtree/boot/
-/rescue/linux/cdrom/cdtree/boot/map
-
-# /rescue/linux/cdrom/cdtree/boot/isolinux/
-/rescue/linux/cdrom/cdtree/boot/isolinux/boot.msg
-/rescue/linux/cdrom/cdtree/boot/isolinux/map
-/rescue/linux/cdrom/cdtree/boot/isolinux/initrd.img
-/rescue/linux/cdrom/cdtree/boot/isolinux/isolinux.cfg
-/rescue/linux/cdrom/cdtree/boot/isolinux/vmlinuz
-
-# /rescue/linux/cdrom/roottree/
-/rescue/linux/cdrom/roottree/var
-/rescue/linux/cdrom/roottree/tmp
-/rescue/linux/cdrom/roottree/sbin
-/rescue/linux/cdrom/roottree/proc
-/rescue/linux/cdrom/roottree/mnt
-/rescue/linux/cdrom/roottree/lib
-/rescue/linux/cdrom/roottree/initrd
-/rescue/linux/cdrom/roottree/dev
-/rescue/linux/cdrom/roottree/cdrom
-/rescue/linux/cdrom/roottree/bacula-rufus
-
-# /rescue/linux/cdrom/roottree/etc/
-/rescue/linux/cdrom/roottree/etc/init.d
-/rescue/linux/cdrom/roottree/etc/terminfo
-/rescue/linux/cdrom/roottree/etc/ssh
-/rescue/linux/cdrom/roottree/etc/shadow
-/rescue/linux/cdrom/roottree/etc/security
-/rescue/linux/cdrom/roottree/etc/passwd
-/rescue/linux/cdrom/roottree/etc/pam.d
-/rescue/linux/cdrom/roottree/etc/ld.so.cache
-/rescue/linux/cdrom/roottree/etc/gshadow
-/rescue/linux/cdrom/roottree/etc/group
-/rescue/linux/cdrom/roottree/etc/protocols
-/rescue/linux/cdrom/roottree/etc/services
-/rescue/linux/cdrom/roottree/etc/syslog.conf
-
-# /rescue/solaris/
-/rescue/solaris/Makefile
-/rescue/solaris/diskinfo
-/rescue/solaris/format.hda
-/rescue/solaris/mount_drives
-/rescue/solaris/partition.hda
-/rescue/solaris/sfdisk
-/rescue/solaris/start_network
-/rescue/solaris/1
-/rescue/solaris/bacula-fd
-/rescue/solaris/bacula-fd.conf
 platforms/osx/build
 platforms/osx/dl
 platforms/osx/products
diff --git a/ChangeLog b/ChangeLog
index 6d79a28..6ffaa2f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,330 @@
-              Changelog on version 7.0.5
+              Changelog on version 7.2.0
+
+
+Release Version 7.2.0
+
+
+
+12Aug15
+ - Put back missing close_msg(NULL) to flush daemon messages at job end
+ - Add LICENSE-FOSS and update LICENSE for baculum
+ - Backport from Bacula Enterprise
+
+29Jul15
+ - Put back old pruning
+ - Fix max vol size test accidently deleted
+ - Remove gigaslam and grow on uninstall -- from bug report
+ - Revert to Branch-8.3 fd_snapshot.c
+ - Pull more recent changes from Branch-8.2
+ - Fix bvfs_lsdir pattern parameter setting
+ - Remove CheckList nolonger used
+ - Revert "Use db_lock()/unlock() around JobMedia creation transaction"
+ - Fix #1099 about director crash with rescheduled jobs
+ - Fix #1209 about bat segfault when clicking on Media
+ - Qmsg(M_FATAL) set jcr->JobStatus to JS_FatalError immediately
+ - snapshot: Abort the job by default if a snapshot creation fails
+ - Revert to old SD-FD close session protocol
+ - Remove drive reservation if no Jobs running
+ - Remove filename patch
+ - snapshot: Try to detect LVM when the filesystem is ext3 or XFS
+ - Fix bad debug message in mac_sql.c
+ - Fix restore-multi-session test by incrementing found files only on next 
+   file
+ - Add -T description in man pages
+ - Correct incorrect Fatal error message text in bsock
+ - mysql: Add support for multiple instances binary backup in the same fileset
+ - Fix compilation with new debug hook
+ - mysql: Avoid warning with abort_on_job plugin option
+ - Fix compilation after patch "prune volume yes"
+ - Do not print message about retention when using "prune volume yes" command
+ - Fix #536 about Copy/Migration/VF that should not use Client "Maximum Concurrent 
+   Jobs"
+ - Fix potential segfault with unused ConfigFile objects
+ - Fix #1108 Enhance setdebug help command and console completion
+ - Add more JCR variables in lockdump procedure
+ - Fix error in update_postgresql_tables.in caused by bad search and replace
+ - Fix #1127 about the repositioning enhancement during restore
+ - Correct try_reposition() return code after a seek()
+ - Add position information in the block structure
+ - Fix a number of acl and xattr bugs + give more understandable variable 
+   names
+ - Make btraceback.dbx and .gdb use new sql engine name
+ - Revert most of patch ef57e6c4 and replace with old cats code
+ - Revert useless parts of patch 08d8e2d29
+ - Revert patch d7f71d2c94a and rewrite it using simpler public domain example
+ - Fix batch mode detection for SQLite3
+ - Revert d9aa76fa and simplify
+ - Revert patch 30388e447fa3 + fix bug #1948
+ - Use a more appropriate name for the acl context
+ - Use class pointer rather than jcr in src/lib/jcr.c
+ - Revert patch f294b276
+ - Change B_DB to BDB to correspond to naming convention
+ - Add -T option in bacula-sd to use trace file
+ - Force use of newer TLS protocols
+ - Avoid problem with db_get_job_record() when SchedTime or RealEndTime is 
+   NULL
+ - Update our regexec() to support NULL argument
+ - Add function to copy a file in bsys.c
+ - Fix bug 2141 fork before TLS initialization
+ - Update LICENSE-FOSS
+ - Change license on src/lib/crc32.c as agreed with the author, Joakim Tjernlund
+ - Update po
+ - More license updates
+ - Fix compilation
+ - Add read_control command between Plugin/FD and Storage Daemon
+ - Add .bvfs_get_jobs and .bvfs_get_bootstrap functions
+ - Fix compilation for Solaris9
+ - Fix Makefile.in tabs
+ - Update Windows .def files
+ - More copyright notices
+ - Fix Windows plugin licenses
+ - Change license copyright for updatedb and qt-console/tray-monitor
+ - Change copyright for logwatch
+ - Update more copyrights
+ - Update copyrights in pebuilder
+ - Update plugin licenses
+ - Add copyrights + license to platforms
+ - Update copyrights in po
+ - More license clarifications
+ - One more copyright in src/cats
+ - Update src/cats .in file copyrights
+ - Compute Job "Compression Ratio" using SDJobBytes instead of JobBytes
+ - Get correct attributions for bsmtp.c
+ - Switch from LGPLv3 for scripts to BSD 2-Clause
+ - Fix segfault on dot commands used in RunScript::Console directive
+ - Fix patch c0f0e6c01c7 to optimize retries only for autochangers
+ - Fix #876 about SD reads too far with complex bootstrap
+ - Correct unmount test in dev.c
+ - Add debug JobId in next-vol-test script
+ - Fix patch c59e5da29 to not orphan buffers
+ - Fix bad implementation of enable/disable job,client,schedules + implement 
+   enable/disable storage devices
+ - Implement enable/disable schedule and client
+ - Optimize Volume protocol when Volume not InChanger
+ - Do not trash existing record during label of new volume
+ - During accurate restore unstrip as soon as possible
+ - Better handline of no storage device found
+ - Fix #1075 The replace=never flag was not properly handled when combined with 
+   database= option in mysql/postgresql plugin
+ - display timestamp in X_msg() in one single pass to avoid double flush()
+ - Update copyrights in scripts directory
+ - Fix bug #1083 RT14512
+ - configure.in: new HAVE_FCNTL_LOCK detect fcntl() locking capability
+ - Fix #1008 about status storage that displays "Writing" and "Reading" information 
+   for the same DCR
+ - Add new %E job code to use non fatal job errors in scripts
+ - Revert to old htable, but add 64 bit hash
+ - Fix possible race condition in smartalloc
+ - Refactor + optimize fstype.c + revert mntent_cache.c/h
+ - snap: Fix small initialization problem with LVM backend
+ - Fix compilation warning in bextract
+ - lock the pid file using fcntl(F_SETLK)
+ - bat: Fix segfault in client view when the Uname field is empty
+ - bat: Fix #1047 about segfaults in Client, Media and Pool view
+ - Revert patch 62ab7eb5 for filed/backup.c
+ - Revert patch 62ab7eb5 for filed/verify.c
+ - Refactor mount/unmount to use class calls
+ - Add return status to DEVICE:close and report error at end of Job
+ - Fix seg fault
+ - fix a Dmsg in match_bsr.c:match_volume()
+ - Fix #861 about bad help command on status schedule
+ - Add new cats header file
+ - Refactor DB engine to be class based
+ - Remove regression cancel_test from do_all
+ - Fix invalid .mod command in BAT during restore (bugfix #858)
+ - Use B_ISXDIGIT() in rangescanner
+ - Handle hex numbers in str_to_uint64()
+ - Fix prune-migration-test -- wait in wrong place
+ - fix MA 987 cannot copy/migrate jobs with a Level=VF in the job resource
+ - Fix basejob error caused by patch on bug #965
+ - Allow to list restore jobs in llist jobid= command
+ - Fix #940 about segfault in bat when doing an "update slots"
+ - Fix #983 about segfault on win32 filedaemon when using bat to monitor the 
+   status
+ - Fix #969 about a segfault while doing a cancel of a copy job
+ - Fill errmsg after an error with FETCH query in db_big_sql_query()
+ - Fix #965 about an empty error message after a problem when sending accurate 
+   file list
+ - Fix #972 about segfault in show command used with multiple resources
+ - Work bsnapshot for SLES12 and fix issue with ZFS
+ - Fix small memory leak in cancel command with ujobid and job parameters
+ - Ensure that client resource is not freed during setbandwidth command
+ - fix errors in the use of a Mmsg()
+ - Use a specific mutex for auth instead of jcr->mutex
+ - update po
+ - Add missing call to free_jcr() in previous patch
+ - Lock the jcr when using sd_calls_client_bsock variable
+ - Ensure that only one thread can use the auth code in the Storage
+ - Fix #951 about SDCallsClient not used during restore jobs
+ - snapshot: Get the creation date from the zfs list snapshot command
+ - snapshot: Fix small issue with Name parameter in list snapshot
+ - Fix bsnapshot to return status=0 on error
+ - fix a mempool error at SD shutdown
+ - snapshot: Call support() only if the device is in the fileset
+ - snapshot: Avoid double / in path and files when volume is /
+ - Fix segfault with Console runscript introduced by "Stop ua commands if comm 
+   line drops"
+ - handle ctrl-C and SIGTERM the same way in SD
+ - Startup scripts return proper exitcode for service restart action
+ - Implement tables configuration
+ - Add ReadBytes to FD status output
+ - Accept 0/1 for @BOOL@ type in ConfigFile module
+ - Set cmd_plugin only in pluginCreateFile if not SKIP/ERROR/CORE
+ - Fix #13680 about systemd message "unknown lvalue"
+ - Stop ua commands if comm line drops
+ - Fix weird compilation problem on rhel5
+ - Display TLS information in status client/storage
+25Feb15
+ - Fix rpms where unix user were not properly defined
+ - update extrajs package in debs/rpm package
+ - Fix segfault with new filesetcmd
+ - snapshot: Reset JobId in Snapshot table when deleting a job
+ - snapshot: Add ability to list snapshots from the FD
+ - snapshot: Add a confirmation message when pruning snapshots
+ - Add RunScript AfterSnapshot event
+ - Fix #431 About upon upgrade, RPMs resets group membership
+ - snapshot: Display bsnapshot error message if possible
+ - Fix jobmedia-bug3
+ - Set error code in return from run regress script
+ - snapshot: More work on LVM backend and on list/sync commands
+ - snapshot: Add EnableSnapshot directive in fileset
+ - snapshot: Add errmsg and status to SNAPSHOT_DBR
+ - snapshot: Send SnapshotRetention parameter to the Client and work on the 
+   prune command
+ - Add bacula-snapshot.spec
+ - Add disabled=yes/no in bsnapshot.conf
+ - Fix #875 about bvfs repeats the same output many times
+ - Revert "Storing the result in a local variable from sql_num_fields saves us a 
+   lot of callbacks."
+ - Remove passing args to cats driver class initialization
+ - Simplify cats by eliminating the B_DB_PRIV class
+ - Convert more db funcs to class calls
+ - Add Snapshot Engine to bacula core
+ - Change more db calls into class calls
+ - Add files missed in last commit
+ - Convert db_lock/unlock to be called via class
+ - Fix small memory leak
+ - Remove more vestages of Ingres
+ - Fix #843 about "show storage" option missing in the help command output
+ - Use bzip2 for sles dependency
+ - Avoid warning with uninitialized variables
+ - update "help status"
+ - Revert "Small fix to Eric great patch for readline commandcompletion so it 
+   also compiles on non gcc compilers."
+ - Separate out definitions into new header
+ - Remove bad restore.h
+ - Revert "Move restore struct defintions to seperate include file. Small change 
+   to acl.h and xattr.h to use define inline with other header files."
+ - Revert "Fix MediaView::getSelection"
+ - Bat: ensure sufficient rows to display drives in storage display
+ - new MmsgDx() macro that combine Mmsg(errmsg, fmt, ...) and Dmsg in once
+ - add a ASEERTD() for DEVELOPPER
+ - Fix wrong KiB value
+ - Revert "Fix bug #1934 Wrong values at media list in BAT"
+ - Change bplugin_list to b_plugin_list which is more appropriate
+ - Remove Ingres related unused files
+ - Simplify rwlock coding
+ - Make subroutine names clearer
+ - Back out useless patches
+ - Put back old code prior to excessive edits
+ - Remove over complicated acl/xattr code
+ - Add license to files without any
+ - Fix #805 about nextpool command line argument not properly used
+ - Remove recursion from free_bsr() and free_bsr_item() to handle very large 
+   BSR
+ - Avoid segfault in connect_to_file_daemon() when jcr->client is NULL
+ - #776 Volume created in the catalog but not on disk and #464 SD can't read an 
+   existing volume
+ - Add schedule to show command tab completion
+ - Make global my_name hold 127 chars
+ - Mark file volumes that are not accessible in Error in mount_next_vol
+ - Fix #743 about bat permission conflict on /opt/bacula/etc
+ - Add copyright to Makefiles
+ - change in lockmgr.c to avoid the report of a memory leak in testls
+ - lib: integrate SHA2 into bacula
+ - Fix #747 about restore problem failing on "Unexpected cryptographic session 
+   data stream
+ - Revert previous copyright accidentally changed
+ - Fix btape fill command by removing some debug code in empty_block()
+ - Add Accurate Fileset option "M" to compare ctime/mtime with the save_time 
+   like with normal Incremental
+ - Add index on Job(JobTDate) to mysql catalog
+ - Fix bad check on bopen_rsrc return status. bug #2106
+ - Do not stop the storage daemon startup if the File device is not yet accessible
+ - Fix double free in btape
+ - Fix failed mount request in btape fill test
+ - Avoid ASSERT() when using btape with vtape driver
+ - Possible fix for NULL client bug #2105
+ - Fix compilation of Nagios check_bacula
+ - Add test for restict c99 in autoconf
+ - Allow to use device= option in release/mount/unmount command
+ - Fix #699 about duplicated job name when starting two jobs at the same time
+ - Fix #701 about status schedule missing from tab completion and correct job 
+   filter
+ - remove autoconf/configre
+ - Fix #346 Add ipv6 support for Solaris
+ - Fix #692 about compatibility issue with community FD
+ - Fix new match_bsr patch
+ - Fix #588 Improve SD bsr read performance
+ - Fix ownership bug in html-manuals package
+ - Add EFS in the client status flag list
+ - Implement Win EFS Support
+ - Fix QT windows build for 32bit
+ - Add SLES113 to spec files
+ - Add @encode and sp_decode functions for plugins
+ - Fix tls-duplicate-job seg fault + harden pthread_kill() code
+ - Update plugin version to ensure 8.0 will not load 6.6 plugins
+ - Add JobBytes and ReadBytes to llist jobid= output
+ - Rewrite store_drivetype and store_fstype to allow a comma separated list of 
+   items
+ - Fix #633 about JobDefs MaximumBandwidth Job inheritance
+ - Fix possible editing truncation due to 32 bit calculations
+ - Remove non-portable -ne in echo
+ - update po
+ - Add Makefile for mssql-fd plugin
+ - Improve error message of open_bpipe() on win32
+ - Add jobid= parameter in .status dir running command
+ - Add worker states
+ - Pull latest worker files from development branch
+ - Add comment about incorrect scripting
+ - Put Dsm_check() on reasonable debug level
+ - Remove auto-generated tray-monitor.pro.mingwxx file
+ - Display message about MaximumBlockSize default value only if a value was 
+   specified
+ - fix solaris : replace be64toh() by unserial_uint64()
+ - update SD <-> SD capabilities exchange
+ - Handle RestoreObjects with Copy/Migration jobs
+ - Add free list to worker class
+ - Fix bad caps with SDcallsClient + debug + fix seg fault on connection error
+ - Implement blowup=nn for FD and hangup+blowup for SD
+ - Correct bat copyright
+ - Change sizeof expressions to be more standard
+ - Remove regress trap that causes sd-sd-test to fail
+ - Dmsg was not handling tag anymore
+ - Fix for SD seg fault while swapping volumes
+ - Make bextract able to handle dedup streams
+ - Remove unused file
+ - Make sure mount_next_read_volume() will cancel the current job
+ - Forbid llist command in runscript
+ - Fix #295 about query file message
+ - Add no_mount_request to DCR
+ - Update Windows .def file
+ - Add spec file for redhat/suse html manual package
+ - Fix bug #2091 bad vtape device definitions
+ - Fix bug #2089 compiler warning
+ - Make sure level is tag free when printing debug message
+ - fix tags in Dmsg
+ - Regenerated configure script
+ - Remove spaces at the end of lines in Bat file
+ - Revert bat.pro.in file
+ - Fix recursive echo bug #2088
+ - Add new fifo class flist.h/c
+ - Allow to create temp DEVICE from DEVRES
+ - For bat always use g++
+ - Make selection by Volume Name or MediaId a bit clearer
+ - Optimize Dmsg() with tags by keeping current tags into a separate variable
+ - Make message more understandable
+
 
 Release version 7.0.5
 
diff --git a/LICENSE b/LICENSE
index ae5618b..83b6ff1 100644
--- a/LICENSE
+++ b/LICENSE
@@ -24,17 +24,23 @@ General Public License are as follows:
      a source code file, it must be preserved when source code is conveyed
      and/or propagated:
 
-       Copyright (C) 20xx-2014 Free Software Foundation Europe e.V.
+   Bacula(R) - The Network Backup Solution
 
-       The main author of Bacula is Kern Sibbald, with contributions from many
-       others, a complete list can be found in the file AUTHORS.
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2000-2015 Free Software Foundation Europe e.V.
 
-       You may use this file and others of this release according to the
-       license defined in the LICENSE file, which includes the Affero General
-       Public License, v3.0 ("AGPLv3") and some additional permissions and
-       terms pursuant to its AGPLv3 Section 7.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
-       Bacula® is a registered trademark of Kern Sibbald.
+   You may use this file and others of this release according to the
+   license defined in the LICENSE file, which includes the Affero General
+   Public License, v3.0 ("AGPLv3") and some additional permissions and
+   terms pursuant to its AGPLv3 Section 7.
+
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 
 Additional Permissions on the work licensed herein, pursuant to Section 7 of
 AGPLv3 are as follows:
@@ -53,6 +59,51 @@ AGPLv3 are as follows:
    the AGPLv3 in all respects for all of the code used other than for the
    Microsoft VSS code.
 
+Copyrights of certain "script" files such as headers, shell script, Makefiles,
+etc ... were never explicitly defined. In almost all cases, they have
+been copyrighted with a BSD 2-Clause copyright to make them easier. However,
+as is the case of all BSD type copyrights you must keep the copyright in
+place and on any binary only released the copyright notice must also be
+released with the binaries.  An example of such a copyright is:
+
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+
+It is equivalent to the full BSD copyright of:
+
+=====
+Copyright (C) 2000-2015 Kern Sibbald
+License: BSD 2-Clause; see file LICENSE-FOSS
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1.  Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+
+2.  Redistributions in binary form must reproduce the above copyright notice,
+this list of conditions and the following disclaimer in the documentation
+and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+====
+
+Note: the exact form of the copyright (dates, name) might vary, but
+the intent is the same, namely that the full BSD 2-Clause coypright 
+applies.  The file LICENSE-FOSS has a few more details.
+
+
 ######################################################################
 The entire AGPL is below, in the manuals distributed with the Bacula
 documentation and can also be found online on the GNU web site at
diff --git a/LICENSE-FAQ b/LICENSE-FAQ
index f9026b2..a5e2583 100644
--- a/LICENSE-FAQ
+++ b/LICENSE-FAQ
@@ -1,3 +1,11 @@
+       
+                Bacula License FAQ
+
+Note: This file is not the Bacula Community (bacula.org) license,
+which you will find in the LICENSE file. This is a FAQ about the
+the Bacula AGPLv3 and the other third-party licenses used in certain
+source code files of the Bacula software.
+
 
              Affero General Public License
 History:
@@ -5,7 +13,10 @@ The original Bacula code was Copyright Kern Sibbald and John Walker.
 After November 2004, it became Copyright Kern Sibbald, and finally,
 the copyright was transferred to the Free Software Foundation Europe
 on 15 November 2006. The license was changed from GPLv2 to AGPLv3
-on 24 July 2010.
+on 24 July 2010. The copyright Fiduciary License Agreement signed 
+with Kern Sibbald and the FSFE 15 November 2006 was terminated as
+of 3 March 2015.  Code subsequent to 3 March 2015 is 
+Copyright, Kern Sibbald.
 
 Trademark:
 The name Bacula is a registered trademark of Kern Sibbald.
@@ -68,6 +79,13 @@ GPLv2 or later license:
    *      The Regents of the University of California.  All rights reserved.
 
 Permissive licenses:
+ Most Makefile.in, *.in, and script files are copyright BSD 2-Clause as noted
+ in each individual file.
+
+ src/lib/crc32.c
+   Copyright (C) 2010-2015 Joakim Tjernlund
+   Under BSD 2-Clause
+
  src/lib/var.c/h
    **  OSSP var - Variable Expansion
    **  Copyright (c) 2001-2002 Ralf S. Engelschall <rse at engelschall.com>
@@ -97,7 +115,7 @@ that contains cryptographic software written by Eric Young
 (eay at cryptsoft.com) and also software written by Tim Hudson
 (tjh at cryptsoft.com).
 
-There are parts of Bacula that are licensed under the LGPL so
+There are parts of Bacula that are licensed under the BSD 2-Clause so
 that those files may be used in proprietary code to interface with
 Bacula.
 
diff --git a/LICENSE-FOSS b/LICENSE-FOSS
new file mode 100644
index 0000000..1e22e24
--- /dev/null
+++ b/LICENSE-FOSS
@@ -0,0 +1,319 @@
+       
+              FOSS Licenses used in Bacula
+
+Note: This file corresponds to the Bacula Community (bacula.org) license.
+
+Trademark:
+The name Bacula is a registered trademark of Kern Sibbald.
+
+"Fair use" of the trademark is permitted following standard customs
+that any prominent use (e.g.  cover of a book) or the first use of
+the name Bacula will include a trademark symbol.  If you fork the
+Bacula project and make any significant changes to the functionality
+of Bacula, to avoid confusion between your fork and Bacula, you must
+give your fork another name.  You are not required to remove all
+references to Bacula in the source code or "fair uses" in the
+documentation.
+
+===================================
+
+What follows is information from the authors of the code:
+
+License:
+To the best of our knowledge, all code used in Bacula, which is
+copyrighted by a third party, has licenses that are compatible.
+
+
+Intellectual Property rights:
+Recipient understands that although each Contributor to Bacula grants
+the licenses to its Contributions set forth herein, no assurances are
+provided by any Contributor that the Program does not infringe the
+patent or other intellectual property rights of any other entity.
+Each Contributor disclaims any liability to Recipient for claims
+brought by any other entity based on infringement of intellectual
+property rights or otherwise.  As a condition to exercising the rights
+and licenses granted hereunder, each Recipient hereby assumes sole
+responsibility to secure any other intellectual property rights
+needed, if any.  For example, if a third party patent license is
+required to allow Recipient to distribute the Program, it is
+Recipient's responsibility to acquire that license before distributing
+the Program.
+
+Copyrights:
+Each Contributor to Bacula represents that to its knowledge it has
+sufficient copyright rights in its Contribution, if any, to grant
+the copyright license set forth in the LICENSE file..
+
+Notices:
+The Bacula community version uses a certain number of files that have
+FOSS (Free or Open Software) licenses.  Many of these files come from and are
+identical to the Bacula community code.  Most 3rd party FOSS licenses require
+no notification so they are not included here. 
+
+However, the Bacula Community binary releases consist of 
+files, with few source files (mostly scripts), and some of the FOSS licenses
+such such as the BSD (Berkeley Software Development) require publication of
+the copyright notices if the code is released in binary format.  For example
+certain copyright notifications are simplifed such as:
+
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+
+This license corresponds to the following:
+
+=====
+Copyright (C) 2000-2015 Kern Sibbald
+License: BSD 2-Clause; see file LICENSE-FOSS
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1.  Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+
+2.  Redistributions in binary form must reproduce the above copyright notice,
+this list of conditions and the following disclaimer in the documentation
+and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+====
+
+The release of binaires mentioned above is covered in point 2 (above) of 
+license.  This file contains a list of all such licenses.
+
+Database scripts (src/cats):
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+
+Translations (po):
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+
+# Copyright (C) 2010 Inteos Sp. z o.o.
+# Copyright (C) 2010-2014 Kern Sibbald <kern at sibbald.com>
+# License: BSD 2-Clause
+
+# Copyright (C) 2005-2006 Free Software Foundation Europe e.V.
+# License: BSD 2-Clause
+
+Manpages:
+This man page document is released under the BSD 2-Clause license.
+
+Update datbase (updatedb):
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+
+Scripts (scripts):
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+
+Platforms (platforms):
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+
+Libraries (src/lib):
+fnmatch.c/h
+/*
+ * Copyright (c) 1989, 1993, 1994
+ *      The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Guido van Rossum.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+sha2.c/h
+/*
+ * FIPS 180-2 SHA-224/256/384/512 implementation
+ * Last update: 02/02/2007
+ * Issue date:  04/30/2005
+ *
+ * Copyright (C) 2005, 2007 Olivier Gay <olivier.gay at a3.epfl.ch>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+bmtio.h
+/*-
+ * Copyright (c) 1982, 1986, 1993
+ *      The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *      @(#)mtio.h      8.1 (Berkeley) 6/2/93
+ * $FreeBSD: stable/7/sys/sys/mtio.h 139825 2005-01-07 02:29:27Z imp $
+ */
+
+bregex.c/h
+ *
+ * Author: Tatu Ylonen <ylo at ngs.fi>
+ *
+ * Copyright (c) 1991 Tatu Ylonen, Espoo, Finland
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies.
+ * This software is provided "as is" without express or implied
+ * warranty.
+
+var.c/h
+**  OSSP var - Variable Expansion
+**  Copyright (c) 2001-2002 Ralf S. Engelschall <rse at engelschall.com>
+**  Copyright (c) 2001-2002 The OSSP Project (http://www.ossp.org/)
+**  Copyright (c) 2001-2002 Cable & Wireless Deutschland (http://www.cw.com/de/)
+**
+**  This file is part of OSSP var, a variable expansion
+**  library which can be found at http://www.ossp.org/pkg/lib/var/.
+**
+**  Permission to use, copy, modify, and distribute this software for
+**  any purpose with or without fee is hereby granted, provided that
+**  the above copyright notice and this permission notice appear in all
+**  copies.
+**
+
+lz4.c lz4_encoder.h lz4.h
+======
+/*
+   LZ4 - Fast LZ compression algorithm
+   Copyright (C) 2011-2013, Yann Collet.
+   BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are
+   met:
+
+       * Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+       * Redistributions in binary form must reproduce the above
+   copyright notice, this list of conditions and the following disclaimer
+   in the documentation and/or other materials provided with the
+   distribution.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+   You can contact the author at :
+   - LZ4 homepage : http://fastcompression.blogspot.com/p/lz4.html
+   - LZ4 source repository : http://code.google.com/p/lz4/
+*/
+===
+
+crc32.c
+=====
+/*
+   Bacula® - The Network Backup Solution
+
+   Copyright (c) 2010-2015, Joakim Tjernlund
+   All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are
+   met:
+
+   1.  Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+
+   2.  Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+   IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+   TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+   PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+   TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+====
diff --git a/Makefile.in b/Makefile.in
index 89da091..64db60f 100755
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,6 +1,9 @@
-# 
+#
 # Master Makefile
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 @MCOMMON@
 
 working_dir=@working_dir@
@@ -10,8 +13,8 @@ dir_user=@dir_user@
 srcdir =	@srcdir@
 VPATH = 	@srcdir@
 .PATH:		@srcdir@
-topdir = .
-thisdir = .
+topdir = @BUILD_DIR@
+thisdir = @BUILD_DIR@
 
 
 first_rule: all
@@ -32,8 +35,8 @@ DIST_CFG = autoconf/aclocal.m4 autoconf/configure.in \
 	autoconf/config.h.in  autoconf/acconfig.h  autoconf/Make.common.in \
 	autoconf/install-sh autoconf/mkinstalldirs
 
-doc_files = VERIFYING technotes ChangeLog README ReleaseNotes LICENSE \
-	    INSTALL
+doc_files = VERIFYING ChangeLog README ReleaseNotes LICENSE \
+	    LICENSE-FAQ LICENSE-FOSS INSTALL
 
 MKDIR = $(srcdir)/autoconf/mkinstalldirs
 LIBTOOL_DEPS = @LIBTOOL_DEPS@
@@ -51,11 +54,12 @@ depend:
 	@for I in ${all_subdirs}; \
 	  do (cd $$I; echo "==>Entering directory `pwd`"; $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1); done
 	
-bacula-fd: Makefile	   
+bacula-fd: Makefile	
 	@for I in ${fd_subdirs}; \
 	  do (cd $$I; echo "==>Entering directory `pwd`"; \
-	      $(MAKE) DESTDIR=$(DESTDIR) all || (echo ""; echo ""; echo "   ====== Error in `pwd` ======"; \
-			    echo ""; echo ""; false ) || false) || exit 1; \
+	      $(MAKE) DESTDIR=$(DESTDIR) all || \
+	      (echo ""; echo ""; echo "   ====== Error in `pwd` ======"; \
+	       echo ""; echo ""; false ) || false) || exit 1; \
 	done
 
 #-------------------------------------------------------------------------
@@ -103,15 +107,19 @@ installdirs:
 	$(MKDIR) $(DESTDIR)$(scriptdir)
 	$(MKDIR) $(DESTDIR)$(docdir)
 	$(MKDIR) $(DESTDIR)$(archivedir)
+	$(MKDIR) $(DESTDIR)$(bsrdir)
+	$(MKDIR) $(DESTDIR)${logdir}
 	-if test ! -d $(DESTDIR)$(working_dir) ; then \
 	   $(MKDIR) $(DESTDIR)$(working_dir); \
 	   chmod 770 $(DESTDIR)$(working_dir); \
 	fi
 	-if test "x$(dir_user)" != "x" ; then \
 	   chown $(dir_user) $(DESTDIR)$(working_dir); \
+	   chown $(dir_user) $(DESTDIR)$(logdir); \
 	fi
 	-if test "x$(dir_group)" != "x" ; then \
 	   chgrp $(dir_group) $(DESTDIR)$(working_dir); \
+	   chgrp $(dir_group) $(DESTDIR)$(logdir); \
 	fi
 
 install: installdirs
@@ -122,16 +130,16 @@ uninstall:
 	@for I in $(all_subdirs); do (cd $$I && $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1); done
 
 install-autostart:
-	(cd platforms && $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1) 
+	(cd platforms && $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1)
 
 install-autostart-dir:
-	(cd platforms && $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1) 
+	(cd platforms && $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1)
 
 install-autostart-fd:
-	(cd platforms && $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1) 
+	(cd platforms && $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1)
 
 install-autostart-sd:
-	(cd platforms && $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1) 
+	(cd platforms && $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1)
 
 uninstall-autostart:
 	(cd platforms && $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1)
@@ -152,21 +160,18 @@ Makefile: Makefile.in
 Makefiles:
 	$(SHELL) config.status
 	(cd scripts; \
-	 chmod 755 startmysql stopmysql bacula startit stopit btraceback; \
-	 chmod 755 mtx-changer bconsole gconsole devel_bacula; \
-	 chmod 755 dvd-handler)
-
+	 chmod 755 startmysql stopmysql bacula startit stopit btraceback \
+	    mtx-changer bconsole gconsole devel_bacula dvd-handler)
 	(cd src/cats; \
-	 chmod 755 create_bacula_database update_bacula_tables make_bacula_tables; \
-	 chmod 755 grant_bacula_privileges drop_bacula_tables drop_bacula_database; \
-	 chmod 755 make_catalog_backup delete_catalog_backup)
-
+	 chmod 755 create_bacula_database update_bacula_tables \
+	   make_bacula_tables grant_bacula_privileges drop_bacula_tables \
+	   drop_bacula_database make_catalog_backup delete_catalog_backup)
 	@for I in @DB_BACKENDS@ ; do \
 	  (cd src/cats; \
-	   chmod 755 create_$${I}_database update_$${I}_tables make_$${I}_tables; \
-	   chmod 755 grant_$${I}_privileges drop_$${I}_tables drop_$${I}_database); \
+	   chmod 755 create_$${I}_database update_$${I}_tables \
+	      make_$${I}_tables grant_$${I}_privileges drop_$${I}_tables \
+	      drop_$${I}_database); \
 	  done
-
 	(cd src/qt-console; \
 	 chmod 755 install_conf_file build-depkgs-qt-console)
 
@@ -190,7 +195,7 @@ distclean:
 	@$(RMF) bacula fd Makefile startmysql stopmysql startit stopit btraceback
 	@$(RMF) bconsole gconsole
 	@$(RMF) *~ 1 2 3 core core.* config.guess console.log console.sum
-	@$(RMF) working/* kerns-* 
+	@$(RMF) working/* kerns-*
 	@$(RMF) -rf txt diff src/python src/testprogs
 	@$(RMF) libtool
 
@@ -217,22 +222,4 @@ distcopy:
 
 distrib: configure autoconf/config.h.in distdirs distcopy
 
-test:
-
-
-tar.gz:  ../$(VERNAME).tar.gz
-../$(VERNAME).tar.gz:
-	(cd ..; tar cvf - $(VERNAME) | gzip -f9 > $(VERNAME).tar.gz)
-
-tar.Z: ../$(VERNAME).tar.Z
-../$(VERNAME).tar.Z:
-	(cd ..; tar cvf - $(VERNAME) | compress > $(VERNAME).tar.Z)
-
-tar.bz2: ../$(VERNAME).tar.bz2
-../$(VERNAME).tar.bz2:
-	(cd ..; tar cvf - $(VERNAME) | bzip2 -f9 > $(VERNAME).tar.bz2)
-
-uuencode: tar.gz
-	uuencode ../$(VERNAME).tar.gz $(VERNAME).tar.gz > ../$(VERNAME).tgz.uu
-
 # ------------------------------------------------------------------------
diff --git a/ReleaseNotes b/ReleaseNotes
index 20ca3dc..3e03d15 100644
--- a/ReleaseNotes
+++ b/ReleaseNotes
@@ -1,5 +1,406 @@
 
-               Release Notes for Bacula 7.0.5
+               Release Notes for Bacula 7.2.0
+
+Release version 7.2.0
+
+Bacula code: Total files = 733 Total lines = 303,426
+The diff between Bacula 7.0.6 and Bacula 7.2.0 is 254,442
+which represents very large change, for the most part 
+contributed to the Bacula project by Bacula Systems SA.
+
+This is a major new release with many new features and a
+number of changes. Please take care to test this code carefully
+before putting it into production.  Although the new features
+have been tested, they have not run in a production environment.
+
+============== !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ===================
+New Catalog format in version 7.2.0 and greater
+-----------------------------------------------
+This release of Bacula uses a new catalog format.  We provide a script
+(update_bacula_tables in bacula/src/cats and in bacula/updatedb) that
+will update from Bacula 3.x, 5.2, or 7.0 to version 7.2.0 format.
+The database upgrade is fast and simply.  As always we strongly 
+recommand that you make a dump of your database prior to doing the
+upgrade.
+
+NOTE: The upgrade will work only for PostgreSQL and MySQL. Upgrading is
+not (yet) supported for SQLite3.
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+
+For packagers, if you change options, naming, and the way 
+we link our shared object files, as at least one of you does,
+you are creating a situation where the user may not be able
+to run multiple versions of Bacula on the same machine, which
+is often very useful, and in addition, you create a configuration
+that the project cannot properly support.
+
+Please note that the documentation has significantly changed.
+You will need additional packages to build it such as inkscape.
+Please see the README and README.pct files in the docs directory.
+The packages come with pre-build English pdf and html files,
+which are located in the docs/docs/manuals/en/pdf-and-html directory.
+
+Packagers: please note that the Bacula LICENSE has changed, it is still
+AGPLv3 and still open source. A new requirement has been added which
+requires other projects using the source to keep the acreditations.
+
+Packagers: please note that the docs license has changed. It is now 
+licensed: Creative Commons Attribution-ShareAlike 4.0 International
+This is a common open source license.
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+Compatibility:
+--------------
+As always, both the Community Director and Storage daemon(s) must be upgraded
+at the same time.  Any File daemon running on the same machine as a Director
+or Storage daemon must be of the same version.
+
+Older File Daemons should be compatible with the 7.2.0 Director and Storage
+daemons.  There should be no need to upgrade older File Daemons. However,
+this has not been fully tested yet.  Since we expect some problems, please 
+test before putting it into production.
+
+New Features:
+Please see the New Features chapter of the manual for documentation on
+the new features.  The new features are currently only in the New Features
+chapter and have not yet been integrated into the main chapters of the
+manual.  Also, since there were so many new features, it is possible that
+a few that previously existed in version 7.0.x are documented a second
+time in the 7.2.0 new features section.
+
+More detailed changes:
+
+12Aug15
+ - Put back missing close_msg(NULL) to flush daemon messages at job end
+ - Add LICENSE-FOSS and update LICENSE for baculum
+ - Backport from Bacula Enterprise
+29Jul15
+ - Fix max vol size test accidently deleted
+ - Remove gigaslam and grow on uninstall -- from bug report
+ - Revert to Branch-8.3 fd_snapshot.c
+ - Pull more recent changes from Branch-8.2
+ - Fix bvfs_lsdir pattern parameter setting
+ - Remove CheckList nolonger used
+ - Revert "Use db_lock()/unlock() around JobMedia creation transaction"
+ - Fix #1099 about director crash with rescheduled jobs
+ - Fix #1209 about bat segfault when clicking on Media
+ - Qmsg(M_FATAL) set jcr->JobStatus to JS_FatalError immediately
+ - snapshot: Abort the job by default if a snapshot creation fails
+ - Revert to old SD-FD close session protocol
+ - Remove drive reservation if no Jobs running
+ - Remove filename patch
+ - snapshot: Try to detect LVM when the filesystem is ext3 or XFS
+ - Fix bad debug message in mac_sql.c
+ - Fix restore-multi-session test by incrementing found files only on next 
+   file
+ - Add -T description in man pages
+ - Correct incorrect Fatal error message text in bsock
+ - mysql: Add support for multiple instances binary backup in the same fileset
+ - Fix compilation with new debug hook
+ - mysql: Avoid warning with abort_on_job plugin option
+ - Fix compilation after patch "prune volume yes"
+ - Do not print message about retention when using "prune volume yes" command
+ - Fix #536 about Copy/Migration/VF that should not use Client "Maximum Concurrent 
+   Jobs"
+ - Fix potential segfault with unused ConfigFile objects
+ - Fix #1108 Enhance setdebug help command and console completion
+ - Add more JCR variables in lockdump procedure
+ - Fix error in update_postgresql_tables.in caused by bad search and replace
+ - Fix #1127 about the repositioning enhancement during restore
+ - Correct try_reposition() return code after a seek()
+ - Add position information in the block structure
+ - Fix a number of acl and xattr bugs + give more understandable variable 
+   names
+ - Make btraceback.dbx and .gdb use new sql engine name
+ - Revert most of patch ef57e6c4 and replace with old cats code
+ - Revert useless parts of patch 08d8e2d29
+ - Revert patch d7f71d2c94a and rewrite it using simpler public domain example
+ - Fix batch mode detection for SQLite3
+ - Revert d9aa76fa and simplify
+ - Revert patch 30388e447fa3 + fix bug #1948
+ - Use a more appropriate name for the acl context
+ - Use class pointer rather than jcr in src/lib/jcr.c
+ - Revert patch f294b276
+ - Change B_DB to BDB to correspond to naming convention
+ - Add -T option in bacula-sd to use trace file
+ - Force use of newer TLS protocols
+ - Avoid problem with db_get_job_record() when SchedTime or RealEndTime is 
+   NULL
+ - Update our regexec() to support NULL argument
+ - Add function to copy a file in bsys.c
+ - Fix bug 2141 fork before TLS initialization
+ - Update LICENSE-FOSS
+ - Change license on src/lib/crc32.c as agreed with the author, Joakim Tjernlund
+ - Update po
+ - More license updates
+ - Fix compilation
+ - Add read_control command between Plugin/FD and Storage Daemon
+ - Add .bvfs_get_jobs and .bvfs_get_bootstrap functions
+ - Fix compilation for Solaris9
+ - Fix Makefile.in tabs
+ - Update Windows .def files
+ - More copyright notices
+ - Fix Windows plugin licenses
+ - Change license copyright for updatedb and qt-console/tray-monitor
+ - Change copyright for logwatch
+ - Update more copyrights
+ - Update copyrights in pebuilder
+ - Update plugin licenses
+ - Add copyrights + license to platforms
+ - Update copyrights in po
+ - More license clarifications
+ - One more copyright in src/cats
+ - Update src/cats .in file copyrights
+ - Compute Job "Compression Ratio" using SDJobBytes instead of JobBytes
+ - Get correct attributions for bsmtp.c
+ - Switch from LGPLv3 for scripts to BSD 2-Clause
+ - Fix segfault on dot commands used in RunScript::Console directive
+ - Fix patch c0f0e6c01c7 to optimize retries only for autochangers
+ - Fix #876 about SD reads too far with complex bootstrap
+ - Correct unmount test in dev.c
+ - Add debug JobId in next-vol-test script
+ - Fix patch c59e5da29 to not orphan buffers
+ - Fix bad implementation of enable/disable job,client,schedules + implement 
+   enable/disable storage devices
+ - Implement enable/disable schedule and client
+ - Optimize Volume protocol when Volume not InChanger
+ - Do not trash existing record during label of new volume
+ - During accurate restore unstrip as soon as possible
+ - Better handline of no storage device found
+ - Fix #1075 The replace=never flag was not properly handled when combined with 
+   database= option in mysql/postgresql plugin
+ - display timestamp in X_msg() in one single pass to avoid double flush()
+ - Update copyrights in scripts directory
+ - Fix bug #1083 RT14512
+ - configure.in: new HAVE_FCNTL_LOCK detect fcntl() locking capability
+ - Fix #1008 about status storage that displays "Writing" and "Reading" information 
+   for the same DCR
+ - Add new %E job code to use non fatal job errors in scripts
+ - Revert to old htable, but add 64 bit hash
+ - Fix possible race condition in smartalloc
+ - Refactor + optimize fstype.c + revert mntent_cache.c/h
+ - snap: Fix small initialization problem with LVM backend
+ - Fix compilation warning in bextract
+ - lock the pid file using fcntl(F_SETLK)
+ - bat: Fix segfault in client view when the Uname field is empty
+ - bat: Fix #1047 about segfaults in Client, Media and Pool view
+ - Revert patch 62ab7eb5 for filed/backup.c
+ - Revert patch 62ab7eb5 for filed/verify.c
+ - Refactor mount/unmount to use class calls
+ - Add return status to DEVICE:close and report error at end of Job
+ - Fix seg fault
+ - fix a Dmsg in match_bsr.c:match_volume()
+ - Fix #861 about bad help command on status schedule
+ - Add new cats header file
+ - Refactor DB engine to be class based
+ - Remove regression cancel_test from do_all
+ - Fix invalid .mod command in BAT during restore (bugfix #858)
+ - Use B_ISXDIGIT() in rangescanner
+ - Handle hex numbers in str_to_uint64()
+ - Fix prune-migration-test -- wait in wrong place
+ - fix MA 987 cannot copy/migrate jobs with a Level=VF in the job resource
+ - Fix basejob error caused by patch on bug #965
+ - Allow to list restore jobs in llist jobid= command
+ - Fix #940 about segfault in bat when doing an "update slots"
+ - Fix #983 about segfault on win32 filedaemon when using bat to monitor the 
+   status
+ - Fix #969 about a segfault while doing a cancel of a copy job
+ - Fill errmsg after an error with FETCH query in db_big_sql_query()
+ - Fix #965 about an empty error message after a problem when sending accurate 
+   file list
+ - Fix #972 about segfault in show command used with multiple resources
+ - Work bsnapshot for SLES12 and fix issue with ZFS
+ - Fix small memory leak in cancel command with ujobid and job parameters
+ - Ensure that client resource is not freed during setbandwidth command
+ - fix errors in the use of a Mmsg()
+ - Use a specific mutex for auth instead of jcr->mutex
+ - update po
+ - Add missing call to free_jcr() in previous patch
+ - Lock the jcr when using sd_calls_client_bsock variable
+ - Ensure that only one thread can use the auth code in the Storage
+ - Fix #951 about SDCallsClient not used during restore jobs
+ - snapshot: Get the creation date from the zfs list snapshot command
+ - snapshot: Fix small issue with Name parameter in list snapshot
+ - Fix bsnapshot to return status=0 on error
+ - fix a mempool error at SD shutdown
+ - snapshot: Call support() only if the device is in the fileset
+ - snapshot: Avoid double / in path and files when volume is /
+ - Fix segfault with Console runscript introduced by "Stop ua commands if comm 
+   line drops"
+ - handle ctrl-C and SIGTERM the same way in SD
+ - Startup scripts return proper exitcode for service restart action
+ - Implement tables configuration
+ - Add ReadBytes to FD status output
+ - Accept 0/1 for @BOOL@ type in ConfigFile module
+ - Set cmd_plugin only in pluginCreateFile if not SKIP/ERROR/CORE
+ - Fix #13680 about systemd message "unknown lvalue"
+ - Stop ua commands if comm line drops
+ - Fix weird compilation problem on rhel5
+ - Display TLS information in status client/storage
+ - Fix rpms where unix user were not properly defined
+ - update extrajs package in debs/rpm package
+ - Fix segfault with new filesetcmd
+ - snapshot: Reset JobId in Snapshot table when deleting a job
+ - snapshot: Add ability to list snapshots from the FD
+ - snapshot: Add a confirmation message when pruning snapshots
+ - Add RunScript AfterSnapshot event
+ - Fix #431 About upon upgrade, RPMs resets group membership
+ - snapshot: Display bsnapshot error message if possible
+ - Fix jobmedia-bug3
+ - Set error code in return from run regress script
+ - snapshot: More work on LVM backend and on list/sync commands
+ - snapshot: Add EnableSnapshot directive in fileset
+ - snapshot: Add errmsg and status to SNAPSHOT_DBR
+ - snapshot: Send SnapshotRetention parameter to the Client and work on the 
+   prune command
+ - Add bacula-snapshot.spec
+ - Add disabled=yes/no in bsnapshot.conf
+ - Fix #875 about bvfs repeats the same output many times
+ - Revert "Storing the result in a local variable from sql_num_fields saves us a 
+   lot of callbacks."
+ - Remove passing args to cats driver class initialization
+ - Simplify cats by eliminating the B_DB_PRIV class
+ - Convert more db funcs to class calls
+ - Add Snapshot Engine to bacula core
+ - Change more db calls into class calls
+ - Add files missed in last commit
+ - Convert db_lock/unlock to be called via class
+ - Fix small memory leak
+ - Remove more vestages of Ingres
+ - Fix #843 about "show storage" option missing in the help command output
+ - Use bzip2 for sles dependency
+ - Avoid warning with uninitialized variables
+ - update "help status"
+ - Revert "Small fix to Eric great patch for readline commandcompletion so it 
+   also compiles on non gcc compilers."
+ - Separate out definitions into new header
+ - Remove bad restore.h
+ - Revert "Move restore struct defintions to seperate include file. Small change 
+   to acl.h and xattr.h to use define inline with other header files."
+ - Revert "Fix MediaView::getSelection"
+ - Bat: ensure sufficient rows to display drives in storage display
+ - new MmsgDx() macro that combine Mmsg(errmsg, fmt, ...) and Dmsg in once
+ - add a ASEERTD() for DEVELOPPER
+ - Fix wrong KiB value
+ - Revert "Fix bug #1934 Wrong values at media list in BAT"
+ - Change bplugin_list to b_plugin_list which is more appropriate
+ - Remove Ingres related unused files
+ - Simplify rwlock coding
+ - Make subroutine names clearer
+ - Back out useless patches
+ - Put back old code prior to excessive edits
+ - Remove over complicated acl/xattr code
+ - Add license to files without any
+ - Fix #805 about nextpool command line argument not properly used
+ - Remove recursion from free_bsr() and free_bsr_item() to handle very large 
+   BSR
+ - Avoid segfault in connect_to_file_daemon() when jcr->client is NULL
+ - #776 Volume created in the catalog but not on disk and #464 SD can't read an 
+   existing volume
+ - Add schedule to show command tab completion
+ - Make global my_name hold 127 chars
+ - Mark file volumes that are not accessible in Error in mount_next_vol
+ - Fix #743 about bat permission conflict on /opt/bacula/etc
+ - Add copyright to Makefiles
+ - change in lockmgr.c to avoid the report of a memory leak in testls
+ - lib: integrate SHA2 into bacula
+ - Fix #747 about restore problem failing on "Unexpected cryptographic session 
+   data stream
+ - Revert previous copyright accidentally changed
+ - Fix btape fill command by removing some debug code in empty_block()
+ - Add Accurate Fileset option "M" to compare ctime/mtime with the save_time 
+   like with normal Incremental
+ - Add index on Job(JobTDate) to mysql catalog
+ - Fix bad check on bopen_rsrc return status. bug #2106
+ - Do not stop the storage daemon startup if the File device is not yet accessible
+ - Fix double free in btape
+ - Fix failed mount request in btape fill test
+ - Avoid ASSERT() when using btape with vtape driver
+ - Possible fix for NULL client bug #2105
+ - Fix compilation of Nagios check_bacula
+ - Add test for restict c99 in autoconf
+ - Allow to use device= option in release/mount/unmount command
+ - Fix #699 about duplicated job name when starting two jobs at the same time
+ - Fix #701 about status schedule missing from tab completion and correct job 
+   filter
+ - remove autoconf/configre
+ - Fix #346 Add ipv6 support for Solaris
+ - Fix #692 about compatibility issue with community FD
+ - Fix new match_bsr patch
+ - Fix #588 Improve SD bsr read performance
+ - Fix ownership bug in html-manuals package
+ - Add EFS in the client status flag list
+ - Implement Win EFS Support
+ - Fix QT windows build for 32bit
+ - Add SLES113 to spec files
+ - Add @encode and sp_decode functions for plugins
+ - Fix tls-duplicate-job seg fault + harden pthread_kill() code
+ - Update plugin version to ensure 8.0 will not load 6.6 plugins
+ - Add JobBytes and ReadBytes to llist jobid= output
+ - Rewrite store_drivetype and store_fstype to allow a comma separated list of 
+   items
+ - Fix #633 about JobDefs MaximumBandwidth Job inheritance
+ - Fix possible editing truncation due to 32 bit calculations
+ - Remove non-portable -ne in echo
+ - update po
+ - Add Makefile for mssql-fd plugin
+ - Improve error message of open_bpipe() on win32
+ - Add jobid= parameter in .status dir running command
+ - Add worker states
+ - Pull latest worker files from development branch
+ - Add comment about incorrect scripting
+ - Put Dsm_check() on reasonable debug level
+ - Remove auto-generated tray-monitor.pro.mingwxx file
+ - Display message about MaximumBlockSize default value only if a value was 
+   specified
+ - fix solaris : replace be64toh() by unserial_uint64()
+ - update SD <-> SD capabilities exchange
+ - Handle RestoreObjects with Copy/Migration jobs
+ - Add free list to worker class
+ - Fix bad caps with SDcallsClient + debug + fix seg fault on connection error
+ - Implement blowup=nn for FD and hangup+blowup for SD
+ - Correct bat copyright
+ - Change sizeof expressions to be more standard
+ - Remove regress trap that causes sd-sd-test to fail
+ - Dmsg was not handling tag anymore
+ - Fix for SD seg fault while swapping volumes
+ - Make bextract able to handle dedup streams
+ - Remove unused file
+ - Make sure mount_next_read_volume() will cancel the current job
+ - Forbid llist command in runscript
+ - Fix #295 about query file message
+ - Add no_mount_request to DCR
+ - Update Windows .def file
+ - Add spec file for redhat/suse html manual package
+ - Fix bug #2091 bad vtape device definitions
+ - Fix bug #2089 compiler warning
+ - Make sure level is tag free when printing debug message
+ - fix tags in Dmsg
+ - Regenerated configure script
+ - Remove spaces at the end of lines in Bat file
+ - Revert bat.pro.in file
+ - Fix recursive echo bug #2088
+ - Add new fifo class flist.h/c
+ - Allow to create temp DEVICE from DEVRES
+ - For bat always use g++
+ - Make selection by Volume Name or MediaId a bit clearer
+ - Optimize Dmsg() with tags by keeping current tags into a separate variable
+ - Make message more understandable
+
+
+=========================================================================
+
+Bugs fixed in this version:
+1099 1209 536 1108 1127 876 1075 1083 1008 1047 861 858 965 940
+983 969 965 972 951 13680 431 875 843 1934 805 776 743
+
+
+
+
+
+
+================= Old 7.0.x Release ====================================
 
 Release version 7.0.5
 This is an important bug fix release to version 7.0.4.  Since it fixes several
@@ -273,3 +674,4 @@ Detailed changes:
  - Improve SQL failure reporting
  - First cut backport BEE to community
  - Add copyright to mtx-changer.in
+
diff --git a/autoconf/Make.common.in b/autoconf/Make.common.in
index 7d91340..cd57f07 100644
--- a/autoconf/Make.common.in
+++ b/autoconf/Make.common.in
@@ -1,21 +1,10 @@
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # This file is pulled in by all the Unix Bacula Makefiles
 #   so it has all the "common" definitions
 #
-#  Bacula® - The Network Backup Solution
-#
-#  Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
-#
-#  The main author of Bacula is Kern Sibbald, with contributions from many
-#  others, a complete list can be found in the file AUTHORS.
-#
-#  You may use this file and others of this release according to the
-#  license defined in the LICENSE file, which includes the Affero General
-#  Public License, v3.0 ("AGPLv3") and some additional permissions and
-#  terms pursuant to its AGPLv3 Section 7.
-#
-#  Bacula® is a registered trademark of Kern Sibbald.
-#
 
 DATE="@DATE@"
 LSMDATE=@LSMDATE@
@@ -45,6 +34,7 @@ includedir = @includedir@
 sysconfdir = @sysconfdir@
 plugindir = @plugindir@
 scriptdir = @scriptdir@
+logdir = @logdir@
 archivedir = @archivedir@
 mandir = @mandir@
 manext = 8
@@ -61,7 +51,7 @@ RMF = $(RM) -f
 CP = @CP@
 SED = @SED@
 AWK = @AWK@
-ECHO = ${ECHO:-/bin/echo}
+ECHO = /bin/echo
 CMP = @CMP@
 TBL = @TBL@
 AR = @AR@
@@ -71,10 +61,11 @@ MKDIR = @BUILD_DIR@/autoconf/mkinstalldirs
 INSTALL = @INSTALL@
 # add the -s to the following in PRODUCTION mode
 INSTALL_PROGRAM = $(INSTALL) -m @SBINPERM@
+INSTALL_PROGRAM_ALL = $(INSTALL) -m 755
 INSTALL_LIB = $(INSTALL) -m 755
 INSTALL_DATA = $(INSTALL) -m 644
 INSTALL_SCRIPT = $(INSTALL) -m @SBINPERM@
-INSTALL_CONFIG = $(INSTALL) -m 640
+INSTALL_CONFIG = $(INSTALL) -m 660
 
 #
 # Libtool specific settings
@@ -96,7 +87,6 @@ CFLAGS = @CFLAGS@ @OPENSSL_INC@
 CPPFLAGS = @CPPFLAGS@ @OPENSSL_INC@
 LDFLAGS = @LDFLAGS@
 TTOOL_LDFLAGS = @TTOOL_LDFLAGS@
-#DEFS = @DEFS@ @LOCAL_DEFS@
 LIBS = @LIBS@
 WRAPLIBS = @WRAPLIBS@
 DINCLUDE = @DINCLUDE@
@@ -104,16 +94,9 @@ DLIB = @DLIB@
 OPENSSL_LIBS = @OPENSSL_LIBS@
 DLLIBS = @LIBADD_DLOPEN@
 
-
 # Windows (cygwin) flags 
 WCFLAGS = @WCFLAGS@
 WLDFLAGS = @WLDFLAGS@
 
-# X Include directory
-#XINC = @X_CFLAGS@ @XPM_CFLAGS@
-
-# extra libraries needed by X on some systems, X library location
-#XLIB = @X_LIBS@ @XPM_LIBS@ -lX11 @X_EXTRA_LIBS@
-
 # End of common section of the Makefile
 #-------------------------------------------------------------------------
diff --git a/autoconf/acconfig.h b/autoconf/acconfig.h
index 4c5f8dd..3a694a0 100644
--- a/autoconf/acconfig.h
+++ b/autoconf/acconfig.h
@@ -1,6 +1,11 @@
 /* ------------------------------------------------------------------------- */
 /* --                     CONFIGURE SPECIFIED FEATURES                    -- */
 /* ------------------------------------------------------------------------- */
+
+/*
+ * Copyright (C) 2000-2015 Kern Sibbald
+ * License: BSD 2-Clause; see file LICENSE-FOSS
+ */
    
 /* Define if you want to use MySQL as Catalog database */
 #undef USE_MYSQL_DB
@@ -150,7 +155,6 @@
 #undef llu
 
 #undef HAVE_READLINE 
-#undef HAVE_PYTHON
 
 #undef HAVE_GMP
 
diff --git a/autoconf/bacula-macros/db.m4 b/autoconf/bacula-macros/db.m4
index 1afdee3..a9a3291 100644
--- a/autoconf/bacula-macros/db.m4
+++ b/autoconf/bacula-macros/db.m4
@@ -1,3 +1,7 @@
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 AC_DEFUN([BA_CHECK_DBI_DB],
 [
 AC_MSG_CHECKING(for DBI support)
@@ -348,10 +352,11 @@ AC_HELP_STRING([--with-mysql@<:@=DIR@:>@], [Include MySQL support. DIR is the My
 #                 MYSQL_LIBDIR=`${MYSQL_CONFIG} --variable=pkglibdir`
 #                 MYSQL_INCDIR=`${MYSQL_CONFIG} --variable=pkgincludedir`
 #              else
-#                 MYSQL_LIBDIR=`${MYSQL_CONFIG} --libs | sed -e 's/.*-L//' -e 's/ .*//'`
+#                 MYSQL_LIBDIR=`${MYSQL_CONFIG} --libs_r | sed -e 's/.*-L//' -e 's/ .*//'`
 #                 MYSQL_INCDIR=`${MYSQL_CONFIG} --include | sed -e 's/-I//'`
 #              fi
-#           elif test -f /usr/local/mysql/include/mysql/mysql.h; then
+#           fi
+#           if [ "x${MYSQL_LIB}" = x -o "x${MYSQL_INCDIR}" = x ]; then
            if test -f /usr/local/mysql/include/mysql/mysql.h; then
               MYSQL_INCDIR=/usr/local/mysql/include/mysql
               if test -f /usr/local/mysql/lib64/mysql/libmysqlclient_r.a \
@@ -803,7 +808,7 @@ AC_HELP_STRING([--with-sqlite3@<:@=DIR@:>@], [Include SQLite3 support. DIR is th
      if test "x$support_batch_insert" = "xyes"; then
          dnl For sqlite checking
          saved_LDFLAGS="${LDFLAGS}"
-         LDFLAGS="${saved_LDFLAGS} -L$SQLITE_LIBDIR"
+         LDFLAGS="${saved_LDFLAGS} -lpthread -L$SQLITE_LIBDIR"
 
          AC_CHECK_LIB(sqlite3, sqlite3_threadsafe, AC_DEFINE(HAVE_SQLITE3_THREADSAFE, 1, [Set if have sqlite3_threadsafe]))
          if test "x$ac_cv_lib_sqlite3_sqlite3_threadsafe" = "xyes"; then
diff --git a/autoconf/bacula-macros/db.m4.old b/autoconf/bacula-macros/db.m4.old
deleted file mode 100644
index 1eea077..0000000
--- a/autoconf/bacula-macros/db.m4.old
+++ /dev/null
@@ -1,1295 +0,0 @@
-AC_DEFUN([BA_CHECK_DBI_DB],
-[
-db_found=no
-AC_MSG_CHECKING(for DBI support)
-AC_ARG_WITH(dbi,
-AC_HELP_STRING([--with-dbi@<:@=DIR@:>@], [Include DBI support. DIR is the DBD base install directory, default is to search through a number of common places for the DBI files.]),
-[
-  if test "$withval" != "no"; then
-     if test "$withval" = "yes"; then
-        if test -f /usr/local/include/dbi/dbi.h; then
-           DBI_INCDIR=/usr/local/dbi/include
-           if test -d /usr/local/lib64; then
-              DBI_LIBDIR=/usr/local/lib64
-           else
-              DBI_LIBDIR=/usr/local/lib
-           fi
-           DBI_BINDIR=/usr/local/bin
-        elif test -f /usr/include/dbi/dbi.h; then
-           DBI_INCDIR=/usr/include
-           if test -d /usr/lib64; then
-              DBI_LIBDIR=/usr/lib64
-           else
-              DBI_LIBDIR=/usr/lib
-           fi
-           DBI_BINDIR=/usr/bin      
-        elif test -f $prefix/include/dbi/dbi.h; then
-           DBI_INCDIR=$prefix/include
-           if test -d $prefix/lib64; then
-              DBI_LIBDIR=$prefix/lib64
-           else
-              DBI_LIBDIR=$prefix/lib
-           fi
-           DBI_BINDIR=$prefix/bin      
-        else
-           AC_MSG_RESULT(no)
-           AC_MSG_ERROR(Unable to find dbi.h in standard locations)
-        fi
-        if test -d /usr/local/lib/dbd; then
-           DRIVERDIR=/usr/local/lib/dbd
-           if test -d /usr/local/lib64/dbd; then
-              DRIVERDIR=/usr/local/lib64/dbd
-           else
-              DRIVERDIR=/usr/local/lib/dbd
-           fi
-        elif test -d /usr/lib/dbd; then
-           DRIVERDIR=/usr/lib/dbd
-           if test -d /usr/lib64/dbd; then
-              DRIVERDIR=/usr/lib64/dbd
-           else
-              DRIVERDIR=/usr/lib/dbd
-           fi
-        elif test -d $prefix/lib/dbd; then
-           if test -d $prefix/lib64/dbd; then
-              DRIVERDIR=$prefix/lib64/dbd
-           else
-              DRIVERDIR=$prefix/lib/dbd
-           fi
-        elif test -d /usr/local/lib64/dbd; then
-           DRIVERDIR=/usr/local/lib64/dbd
-        elif test -d /usr/lib64/dbd; then
-           DRIVERDIR=/usr/lib64/dbd
-        elif test -d $prefix/lib64/dbd; then
-           DRIVERDIR=$prefix/lib64/dbd
-        else
-           AC_MSG_RESULT(no)
-           AC_MSG_ERROR(Unable to find DBD drivers in standard locations)
-        fi
-     else
-        if test -f $withval/dbi.h; then
-           DBI_INCDIR=$withval
-           DBI_LIBDIR=$withval
-           DBI_BINDIR=$withval
-        elif test -f $withval/include/dbi/dbi.h; then
-           DBI_INCDIR=$withval/include
-           if test -d $withval/lib64; then
-              DBI_LIBDIR=$withval/lib64
-           else
-              DBI_LIBDIR=$withval/lib
-           fi
-           DBI_BINDIR=$withval/bin
-        else
-           AC_MSG_RESULT(no)
-           AC_MSG_ERROR(Invalid DBI directory $withval - unable to find dbi.h under $withval)
-        fi
-        if test -d $withval/dbd; then
-           DRIVERDIR=$withval/dbd
-        elif test -d $withval/lib/; then
-           if test -d $withval/lib64/dbd; then
-              DRIVERDIR=$withval/lib64/dbd
-           else
-              DRIVERDIR=$withval/lib/dbd
-           fi
-        elif test -d $withval/lib64/dbd; then
-           DRIVERDIR=$withval/lib64/dbd
-        else
-           AC_MSG_RESULT(no)
-           AC_MSG_ERROR(Invalid DBD driver directory $withval - unable to find DBD drivers under $withval)
-        fi
-     fi
-     SQL_INCLUDE=-I$DBI_INCDIR
-     SQL_LFLAGS="-L$DBI_LIBDIR -ldbi"
-     SQL_BINDIR=$DBI_BINDIR
-     SQL_LIB=$DBI_LIBDIR/libdbi.a
-     DBI_DBD_DRIVERDIR="-D DBI_DRIVER_DIR=\\\"$DRIVERDIR\\\""
-
-     AC_DEFINE(HAVE_DBI, 1, [Set if you have the DBI driver])
-     AC_MSG_RESULT(yes)
-     db_found=yes
-     support_dbi=yes
-     db_type=DBI
-     DB_TYPE=dbi
-     uncomment_dbi=" "
-
-  else
-     AC_MSG_RESULT(no)
-  fi
-],[
-  AC_MSG_RESULT(no)
-])
-AC_SUBST(SQL_LFLAGS)
-AC_SUBST(SQL_INCLUDE)
-AC_SUBST(SQL_BINDIR)
-AC_SUBST(DBI_DBD_DRIVERDIR)  
-AC_SUBST(uncomment_dbi)
-
-])
-
-AC_DEFUN([BA_CHECK_DBI_DRIVER],
-[
-db_found=no
-db_prog=no
-AC_MSG_CHECKING(for DBI drivers support)
-AC_ARG_WITH(dbi-driver,
-AC_HELP_STRING([--with-dbi-driver@<:@=DRIVER@:>@], [Suport for DBI driver. DRIVER is the one DBI driver like Mysql, Postgresql, others. Default is to not configure any driver.]),
-[
-  if test "$withval" != "no"; then
-     case $withval in
-        "mysql")
-           db_prog="mysql"
-           if test -f /usr/local/mysql/bin/mysql; then
-              SQL_BINDIR=/usr/local/mysql/bin
-              if test -f /usr/local/mysql/lib64/mysql/libmysqlclient_r.a \
-                 -o -f /usr/local/mysql/lib64/mysql/libmysqlclient_r.so; then
-                 SQL_LIBDIR=/usr/local/mysql/lib64/mysql
-              else
-                 SQL_LIBDIR=/usr/local/mysql/lib/mysql
-              fi
-           elif test -f /usr/bin/mysql; then
-              SQL_BINDIR=/usr/bin
-              if test -f /usr/lib64/mysql/libmysqlclient_r.a \
-                  -o -f /usr/lib64/mysql/libmysqlclient_r.so; then  
-                  SQL_LIBDIR=/usr/lib64/mysql
-              elif test -f /usr/lib/mysql/libmysqlclient_r.a \
-                  -o -f /usr/lib/mysql/libmysqlclient_r.so; then
-                  SQL_LIBDIR=/usr/lib/mysql
-              else
-                  SQL_LIBDIR=/usr/lib
-              fi
-           elif test -f /usr/local/bin/mysql; then
-              SQL_BINDIR=/usr/local/bin
-              if test -f /usr/local/lib64/mysql/libmysqlclient_r.a \
-                  -o -f /usr/local/lib64/mysql/libmysqlclient_r.so; then  
-                  SQL_LIBDIR=/usr/local/lib64/mysql
-              elif test -f /usr/local/lib/mysql/libmysqlclient_r.a \
-                  -o -f /usr/local/lib/mysql/libmysqlclient_r.so; then
-                  SQL_LIBDIR=/usr/local/lib/mysql
-              else
-                  SQL_LIBDIR=/usr/local/lib
-              fi
-           elif test -f $withval/bin/mysql; then
-              SQL_BINDIR=$withval/bin
-              if test -f $withval/lib64/mysql/libmysqlclient_r.a \
-                  -o -f $withval/lib64/mysql/libmysqlclient_r.so; then
-                  SQL_LIBDIR=$withval/lib64/mysql
-              elif test -f $withval/lib64/libmysqlclient_r.a \
-                  -o -f $withval/lib64/libmysqlclient_r.so; then
-                  SQL_LIBDIR=$withval/lib64
-              elif test -f $withval/lib/libmysqlclient_r.a \
-                  -o -f $withval/lib/libmysqlclient_r.so; then
-                  SQL_LIBDIR=$withval/lib/
-              else
-                  SQL_LIBDIR=$withval/lib/mysql
-              fi
-           else
-              AC_MSG_RESULT(no)
-              AC_MSG_ERROR(Unable to find mysql in standard locations)
-           fi
-           if test -f $SQL_LIBDIR/libmysqlclient_r.so; then
-              DB_PROG_LIB=$SQL_LIBDIR/libmysqlclient_r.so
-           else
-              DB_PROG_LIB=$SQL_LIBDIR/libmysqlclient_r.a
-           fi
-        ;;
-        "postgresql")
-           db_prog="postgresql"
-           PG_CONFIG=`which pg_config`
-           if test -n "$PG_CONFIG"; then
-              SQL_BINDIR=`"$PG_CONFIG" --bindir`
-              SQL_LIBDIR=`"$PG_CONFIG" --libdir`
-           elif test -f /usr/local/bin/psql; then
-              SQL_BINDIR=/usr/local/bin
-              if test -d /usr/local/lib64; then
-                 SQL_LIBDIR=/usr/local/lib64
-              else
-                 SQL_LIBDIR=/usr/local/lib
-              fi
-           elif test -f /usr/bin/psql; then
-              SQL_BINDIR=/usr/local/bin
-              if test -d /usr/lib64/postgresql; then
-                 SQL_LIBDIR=/usr/lib64/postgresql
-              elif test -d /usr/lib/postgresql; then
-                 SQL_LIBDIR=/usr/lib/postgresql
-              elif test -d /usr/lib64; then
-                 SQL_LIBDIR=/usr/lib64
-              else
-                 SQL_LIBDIR=/usr/lib
-              fi
-           elif test -f $withval/bin/psql; then
-              SQL_BINDIR=$withval/bin
-              if test -d $withval/lib64; then
-                 SQL_LIBDIR=$withval/lib64
-              else
-                 SQL_LIBDIR=$withval/lib
-              fi
-           else
-              AC_MSG_RESULT(no)
-              AC_MSG_ERROR(Unable to find psql in standard locations)
-           fi
-           if test -f $SQL_LIBDIR/libpq.so; then
-              DB_PROG_LIB=$SQL_LIBDIR/libpq.so
-           else
-              DB_PROG_LIB=$SQL_LIBDIR/libpq.a
-           fi
-        ;;
-        "sqlite")
-           db_prog="sqlite"
-           if test -f /usr/local/bin/sqlite; then
-              SQL_BINDIR=/usr/local/bin
-              if test -d /usr/local/lib64; then
-                 SQL_LIBDIR=/usr/local/lib64
-              else
-                 SQL_LIBDIR=/usr/local/lib
-              fi
-           elif test -f /usr/bin/sqlite; then
-              SQL_BINDIR=/usr/bin
-              if test -d /usr/lib64; then
-                 SQL_LIBDIR=/usr/lib64
-              else
-                 SQL_LIBDIR=/usr/lib
-              fi                 
-           elif test -f $withval/bin/sqlite; then
-              SQL_BINDIR=$withval/bin
-              if test -d $withval/lib64; then
-                 SQL_LIBDIR=$withval/lib64
-              else
-                 SQL_LIBDIR=$withval/lib
-              fi                 
-           else
-              AC_MSG_RESULT(no)
-              AC_MSG_ERROR(Unable to find sqlite in standard locations)
-           fi
-           if test -f $SQL_LIBDIR/libsqlite.so; then
-              DB_PROG_LIB=$SQL_LIBDIR/libsqlite.so
-           else
-              DB_PROG_LIB=$SQL_LIBDIR/libsqlite.a
-           fi
-        ;;
-        "sqlite3")
-           db_prog="sqlite3"
-           if test -f /usr/local/bin/sqlite3; then
-              SQL_BINDIR=/usr/local/bin
-              if test -d /usr/local/lib64; then
-                 SQL_LIBDIR=/usr/local/lib64
-              else
-                 SQL_LIBDIR=/usr/local/lib
-              fi
-           elif test -f /usr/bin/sqlite3; then
-              SQL_BINDIR=/usr/bin
-              if test -d /usr/lib64; then
-                 SQL_LIBDIR=/usr/lib64
-              else
-                 SQL_LIBDIR=/usr/lib
-              fi                 
-           elif test -f $withval/bin/sqlite3; then
-              SQL_BINDIR=$withval/bin
-              if test -d $withval/lib64; then
-                 SQL_LIBDIR=$withval/lib64
-              else
-                 SQL_LIBDIR=$withval/lib
-              fi                 
-           else
-              AC_MSG_RESULT(no)
-              AC_MSG_ERROR(Unable to find sqlite in standard locations)
-           fi
-           if test -f $SQL_LIBDIR/libsqlite3.so; then
-              DB_PROG_LIB=$SQL_LIBDIR/libsqlite3.so
-           else
-              DB_PROG_LIB=$SQL_LIBDIR/libsqlite3.a
-           fi
-        ;;                
-        *)
-           AC_MSG_RESULT(no)
-           AC_MSG_ERROR(Unable to set DBI driver. $withval is not supported)
-        ;;
-     esac
-
-     AC_MSG_RESULT(yes)
-     DB_PROG=$db_prog
-  else
-     AC_MSG_RESULT(no)
-  fi
-],[
-  AC_MSG_RESULT(no)
-])
-AC_SUBST(SQL_BINDIR)
-AC_SUBST(DB_PROG)
-AC_SUBST(DB_PROG_LIB)
-
-])
-
-
-AC_DEFUN([BA_CHECK_MYSQL_DB],
-[
-db_found=no
-AC_MSG_CHECKING(for MySQL support)
-AC_ARG_WITH(mysql,
-AC_HELP_STRING([--with-mysql@<:@=DIR@:>@], [Include MySQL support. DIR is the MySQL base install directory, default is to search through a number of common places for the MySQL files.]),
-[
-  if test "$withval" != "no"; then
-        if test "$withval" = "yes"; then
-           if test -f /usr/local/mysql/include/mysql/mysql.h; then
-                   MYSQL_INCDIR=/usr/local/mysql/include/mysql
-                   if test -f /usr/local/mysql/lib64/mysql/libmysqlclient_r.a \
-                        -o -f /usr/local/mysql/lib64/mysql/libmysqlclient_r.so; then
-                           MYSQL_LIBDIR=/usr/local/mysql/lib64/mysql
-                   else
-                           MYSQL_LIBDIR=/usr/local/mysql/lib/mysql
-                   fi
-                   MYSQL_BINDIR=/usr/local/mysql/bin
-           elif test -f /usr/include/mysql/mysql.h; then
-                   MYSQL_INCDIR=/usr/include/mysql
-                   if test -f /usr/lib64/mysql/libmysqlclient_r.a \
-                        -o -f /usr/lib64/mysql/libmysqlclient_r.so; then  
-                           MYSQL_LIBDIR=/usr/lib64/mysql
-                   elif test -f /usr/lib64/libmysqlclient_r.a \
-                        -o -f /usr/lib64/libmysqlclient_r.so; then
-                           MYSQL_LIBDIR=/usr/lib64
-                   elif test -f /usr/lib/mysql/libmysqlclient_r.a \
-                          -o -f /usr/lib/mysql/libmysqlclient_r.so; then
-                           MYSQL_LIBDIR=/usr/lib/mysql
-                   else
-                           MYSQL_LIBDIR=/usr/lib
-                   fi
-                   MYSQL_BINDIR=/usr/bin
-           elif test -f /usr/include/mysql.h; then
-                   MYSQL_INCDIR=/usr/include
-                   if test -f /usr/lib64/libmysqlclient_r.a \
-                        -o -f /usr/lib64/libmysqlclient_r.so; then
-                           MYSQL_LIBDIR=/usr/lib64
-                   else
-                           MYSQL_LIBDIR=/usr/lib
-                   fi
-                   MYSQL_BINDIR=/usr/bin
-           elif test -f /usr/local/include/mysql/mysql.h; then
-                   MYSQL_INCDIR=/usr/local/include/mysql
-                   if test -f /usr/local/lib64/mysql/libmysqlclient_r.a \
-                        -o -f /usr/local/lib64/mysql/libmysqlclient_r.so; then
-                           MYSQL_LIBDIR=/usr/local/lib64/mysql
-                   else
-                           MYSQL_LIBDIR=/usr/local/lib/mysql
-                   fi
-                   MYSQL_BINDIR=/usr/local/bin
-           elif test -f /usr/local/include/mysql.h; then
-                   MYSQL_INCDIR=/usr/local/include
-                   if test -f /usr/local/lib64/libmysqlclient_r.a \
-                        -o -f /usr/local/lib64/libmysqlclient_r.so; then
-                           MYSQL_LIBDIR=/usr/local/lib64
-                   else
-                           MYSQL_LIBDIR=/usr/local/lib
-                   fi
-                   MYSQL_BINDIR=/usr/local/bin
-           else
-              AC_MSG_RESULT(no)
-              AC_MSG_ERROR(Unable to find mysql.h in standard locations)
-           fi
-        else
-           if test -f $withval/include/mysql/mysql.h; then
-              MYSQL_INCDIR=$withval/include/mysql
-              if test -f $withval/lib64/mysql/libmysqlclient_r.a \
-                   -o -f $withval/lib64/mysql/libmysqlclient_r.so; then
-                 MYSQL_LIBDIR=$withval/lib64/mysql
-              elif test -f $withval/lib64/libmysqlclient_r.a \
-                   -o -f $withval/lib64/libmysqlclient_r.so; then
-                 MYSQL_LIBDIR=$withval/lib64
-              elif test -f $withval/lib/libmysqlclient_r.a \
-                   -o -f $withval/lib/libmysqlclient_r.so; then
-                 MYSQL_LIBDIR=$withval/lib
-              else
-                 MYSQL_LIBDIR=$withval/lib/mysql
-              fi
-              MYSQL_BINDIR=$withval/bin
-           elif test -f $withval/include/mysql.h; then
-              MYSQL_INCDIR=$withval/include
-              if test -f $withval/lib64/libmysqlclient_r.a \
-                   -o -f $withval/lib64/libmysqlclient_r.so; then
-                 MYSQL_LIBDIR=$withval/lib64
-              else
-                 MYSQL_LIBDIR=$withval/lib
-              fi
-              MYSQL_BINDIR=$withval/bin
-           else
-              AC_MSG_RESULT(no)
-              AC_MSG_ERROR(Invalid MySQL directory $withval - unable to find mysql.h under $withval)
-           fi
-        fi
-    SQL_INCLUDE=-I$MYSQL_INCDIR
-    if test -f $MYSQL_LIBDIR/libmysqlclient_r.a \
-         -o -f $MYSQL_LIBDIR/libmysqlclient_r.so; then
-       SQL_LFLAGS="-L$MYSQL_LIBDIR -lmysqlclient_r -lz"
-       AC_DEFINE(HAVE_THREAD_SAFE_MYSQL)
-    fi
-    SQL_BINDIR=$MYSQL_BINDIR
-    SQL_LIB=$MYSQL_LIBDIR/libmysqlclient_r.a
-
-    AC_DEFINE(HAVE_MYSQL, 1, [Set if you have an MySQL Database])
-    AC_MSG_RESULT(yes)
-    db_found=yes
-    support_mysql=yes
-    db_type=MySQL
-    DB_TYPE=mysql
-
-  else
-        AC_MSG_RESULT(no)
-  fi
-]
-)
-
-AC_ARG_WITH(embedded-mysql,
-AC_HELP_STRING([--with-embedded-mysql@<:@=DIR@:>@], [Include MySQL support. DIR is the MySQL base install directory, default is to search through a number of common places for the MySQL files.]),
-[
-  if test "$withval" != "no"; then
-        if test "$withval" = "yes"; then
-                if test -f /usr/local/mysql/include/mysql/mysql.h; then
-                        MYSQL_INCDIR=/usr/local/mysql/include/mysql
-                        if test -d /usr/local/mysql/lib64/mysql; then
-                                MYSQL_LIBDIR=/usr/local/mysql/lib64/mysql
-                        else
-                                MYSQL_LIBDIR=/usr/local/mysql/lib/mysql
-                        fi
-                        MYSQL_BINDIR=/usr/local/mysql/bin
-                elif test -f /usr/include/mysql/mysql.h; then
-                        MYSQL_INCDIR=/usr/include/mysql
-                        if test -d /usr/lib64/mysql; then
-                                MYSQL_LIBDIR=/usr/lib64/mysql
-                        else
-                                MYSQL_LIBDIR=/usr/lib/mysql
-                        fi
-                        MYSQL_BINDIR=/usr/bin
-                elif test -f /usr/include/mysql.h; then
-                        MYSQL_INCDIR=/usr/include
-                        if test -d /usr/lib64; then
-                                MYSQL_LIBDIR=/usr/lib64
-                        else
-                                MYSQL_LIBDIR=/usr/lib
-                        fi
-                        MYSQL_BINDIR=/usr/bin
-                elif test -f /usr/local/include/mysql/mysql.h; then
-                        MYSQL_INCDIR=/usr/local/include/mysql
-                        if test -d /usr/local/lib64/mysql; then
-                                MYSQL_LIBDIR=/usr/local/lib64/mysql
-                        else
-                                MYSQL_LIBDIR=/usr/local/lib/mysql
-                        fi
-                        MYSQL_BINDIR=/usr/local/bin
-                elif test -f /usr/local/include/mysql.h; then
-                        MYSQL_INCDIR=/usr/local/include
-                        if test -d /usr/local/lib64; then
-                                MYSQL_LIBDIR=/usr/local/lib64
-                        else
-                                MYSQL_LIBDIR=/usr/local/lib
-                        fi
-                        MYSQL_BINDIR=/usr/local/bin
-                else
-                   AC_MSG_RESULT(no)
-                   AC_MSG_ERROR(Unable to find mysql.h in standard locations)
-                fi
-        else
-                if test -f $withval/include/mysql/mysql.h; then
-                        MYSQL_INCDIR=$withval/include/mysql
-                        if test -d $withval/lib64/mysql; then
-                                MYSQL_LIBDIR=$withval/lib64/mysql
-                        else
-                                MYSQL_LIBDIR=$withval/lib/mysql
-                        fi
-                        MYSQL_BINDIR=$withval/bin
-                elif test -f $withval/include/mysql.h; then
-                        MYSQL_INCDIR=$withval/include
-                        if test -d $withval/lib64; then
-                                MYSQL_LIBDIR=$withval/lib64
-                        else
-                                MYSQL_LIBDIR=$withval/lib
-                        fi
-                        MYSQL_BINDIR=$withval/bin
-                else
-                   AC_MSG_RESULT(no)
-                   AC_MSG_ERROR(Invalid MySQL directory $withval - unable to find mysql.h under $withval)
-                fi
-        fi
-    SQL_INCLUDE=-I$MYSQL_INCDIR
-    SQL_LFLAGS="-L$MYSQL_LIBDIR -lmysqld -lz -lm -lcrypt"
-    SQL_BINDIR=$MYSQL_BINDIR
-    SQL_LIB=$MYSQL_LIBDIR/libmysqld.a
-
-    AC_DEFINE(HAVE_MYSQL)
-    AC_DEFINE(HAVE_EMBEDDED_MYSQL)
-    AC_MSG_RESULT(yes)
-    db_found=yes
-    support_mysql=yes
-    db_type=MySQL
-    DB_TYPE=mysql
-
-  else
-        AC_MSG_RESULT(no)
-  fi
-]
-)
-
-
-AC_SUBST(SQL_LFLAGS)
-AC_SUBST(SQL_INCLUDE)
-AC_SUBST(SQL_BINDIR)
-  
-])
-
-
-AC_DEFUN([BA_CHECK_INGRES_DB],
-[
-db_found=no
-AC_MSG_CHECKING(for Ingres support)
-AC_ARG_WITH(ingres,
-AC_HELP_STRING([--with-ingres@<:@=DIR@:>@], [Include Ingres support. DIR is the Ingres base install directory, default is to search through a number of common places for the Ingres files.]),
-[
-  if test "$withval" != "no"; then
-     if test "$withval" = "yes"; then
-        if test -f ${II_SYSTEM}/files/eqdefc.h; then
-           INGRES_INCDIR=${II_SYSTEM}/files
-           INGRES_LIBDIR=${II_SYSTEM}/lib
-           INGRES_BINDIR=${II_SYSTEM}/bin
-        elif test -f ${II_SYSTEM}/ingres/files/eqdefc.h; then
-           INGRES_INCDIR=${II_SYSTEM}/ingres/files
-           INGRES_LIBDIR=${II_SYSTEM}/ingres/lib
-           INGRES_BINDIR=${II_SYSTEM}/ingres/bin      
-        else
-           AC_MSG_RESULT(no)
-           AC_MSG_ERROR(Unable to find eqdefc.h in standard locations)
-        fi
-     else
-        if test -f $withval/files/eqdefc.h; then
-           INGRES_INCDIR=$withval/files
-           INGRES_LIBDIR=$withval/lib
-           INGRES_BINDIR=$withval/bin
-        else
-           AC_MSG_RESULT(no)
-           AC_MSG_ERROR(Invalid Ingres directory $withval - unable to find Ingres headers under $withval)
-        fi
-     fi
-     SQL_INCLUDE=-I$INGRES_INCDIR
-     SQL_LFLAGS="-L$INGRES_LIBDIR -lq.1 -lcompat.1 -lframe.1"
-     SQL_BINDIR=$INGRES_BINDIR
-     SQL_LIB=$INGRES_LIBDIR/libingres.a
-     AC_DEFINE(HAVE_INGRES, 1, [Set if have Ingres Database])
-     AC_MSG_RESULT(yes)
-     db_found=yes
-     support_ingres=yes
-     db_type=Ingres
-     DB_TYPE=ingres
-
-  else
-     AC_MSG_RESULT(no)
-  fi
-],[
-  AC_MSG_RESULT(no)
-])
-
-AC_SUBST(SQL_LFLAGS)
-AC_SUBST(SQL_INCLUDE)
-AC_SUBST(SQL_BINDIR)
-])
-
-AC_DEFUN([BA_CHECK_SQLITE3_DB],
-[
-db_found=no
-AC_MSG_CHECKING(for SQLite3 support)
-AC_ARG_WITH(sqlite3,
-AC_HELP_STRING([--with-sqlite3@<:@=DIR@:>@], [Include SQLite3 support. DIR is the SQLite3 base install directory, default is to search through a number of common places for the SQLite3 files.]),
-[
-  if test "$withval" != "no"; then
-     if test "$withval" = "yes"; then
-        if test -f /usr/local/include/sqlite3.h; then
-           SQLITE_INCDIR=/usr/local/include
-           if test -d /usr/local/lib64; then
-              SQLITE_LIBDIR=/usr/local/lib64
-           else
-              SQLITE_LIBDIR=/usr/local/lib
-           fi
-           SQLITE_BINDIR=/usr/local/bin
-        elif test -f /usr/include/sqlite3.h; then
-           SQLITE_INCDIR=/usr/include
-           if test -d /usr/lib64; then
-              SQLITE_LIBDIR=/usr/lib64
-           else
-              SQLITE_LIBDIR=/usr/lib
-           fi
-           SQLITE_BINDIR=/usr/bin      
-        elif test -f $prefix/include/sqlite3.h; then
-           SQLITE_INCDIR=$prefix/include
-           if test -d $prefix/lib64; then
-              SQLITE_LIBDIR=$prefix/lib64
-           else
-              SQLITE_LIBDIR=$prefix/lib
-           fi
-           SQLITE_BINDIR=$prefix/bin      
-        else
-           AC_MSG_RESULT(no)
-           AC_MSG_ERROR(Unable to find sqlite3.h in standard locations)
-        fi
-     else
-        if test -f $withval/sqlite3.h; then
-           SQLITE_INCDIR=$withval
-           SQLITE_LIBDIR=$withval
-           SQLITE_BINDIR=$withval
-        elif test -f $withval/include/sqlite3.h; then
-           SQLITE_INCDIR=$withval/include
-           if test -d $withval/lib64; then
-              SQLITE_LIBDIR=$withval/lib64
-           else
-              SQLITE_LIBDIR=$withval/lib
-           fi
-           SQLITE_BINDIR=$withval/bin
-        else
-           AC_MSG_RESULT(no)
-           AC_MSG_ERROR(Invalid SQLite3 directory $withval - unable to find sqlite3.h under $withval)
-        fi
-     fi
-     SQL_INCLUDE=-I$SQLITE_INCDIR
-     SQL_LFLAGS="-L$SQLITE_LIBDIR -lsqlite3"
-     SQL_BINDIR=$SQLITE_BINDIR
-     SQL_LIB=$SQLITE_LIBDIR/libsqlite3.a
-
-     AC_DEFINE(HAVE_SQLITE3)
-     AC_MSG_RESULT(yes)
-     db_found=yes
-     support_sqlite3=yes
-     db_type=SQLite3
-     DB_TYPE=sqlite3
-
-  else
-     AC_MSG_RESULT(no)
-  fi
-],[
-  AC_MSG_RESULT(no)
-])
-AC_SUBST(SQL_LFLAGS)
-AC_SUBST(SQL_INCLUDE)
-AC_SUBST(SQL_BINDIR)
-  
-])
-
-
-AC_DEFUN([BA_CHECK_POSTGRESQL_DB],
-[
-db_found=no
-AC_MSG_CHECKING(for PostgreSQL support)
-AC_ARG_WITH(postgresql,
-AC_HELP_STRING([--with-postgresql@<:@=DIR@:>@], [Include PostgreSQL support. DIR is the PostgreSQL base install directory, @<:@default=/usr/local/pgsql@:>@]),
-[
-  if test "$withval" != "no"; then
-      if test "$db_found" = "yes"; then
-          AC_MSG_RESULT(error)
-          AC_MSG_ERROR("You can configure for only one database.");
-      fi
-      if test "$withval" = "yes"; then
-          PG_CONFIG=`which pg_config`
-          if test -n "$PG_CONFIG";then
-              POSTGRESQL_INCDIR=`"$PG_CONFIG" --includedir`
-              POSTGRESQL_LIBDIR=`"$PG_CONFIG" --libdir`
-              POSTGRESQL_BINDIR=`"$PG_CONFIG" --bindir`
-          elif test -f /usr/local/include/libpq-fe.h; then
-              POSTGRESQL_INCDIR=/usr/local/include
-              if test -d /usr/local/lib64; then
-                 POSTGRESQL_LIBDIR=/usr/local/lib64
-              else
-                 POSTGRESQL_LIBDIR=/usr/local/lib
-              fi
-              POSTGRESQL_BINDIR=/usr/local/bin
-          elif test -f /usr/include/libpq-fe.h; then
-              POSTGRESQL_INCDIR=/usr/include
-              if test -d /usr/lib64; then
-                 POSTGRESQL_LIBDIR=/usr/lib64
-              else
-                 POSTGRESQL_LIBDIR=/usr/lib
-              fi
-              POSTGRESQL_BINDIR=/usr/bin
-          elif test -f /usr/include/pgsql/libpq-fe.h; then
-              POSTGRESQL_INCDIR=/usr/include/pgsql
-              if test -d /usr/lib64/pgsql; then
-                 POSTGRESQL_LIBDIR=/usr/lib64/pgsql
-              else
-                 POSTGRESQL_LIBDIR=/usr/lib/pgsql
-              fi
-              POSTGRESQL_BINDIR=/usr/bin
-          elif test -f /usr/include/postgresql/libpq-fe.h; then
-              POSTGRESQL_INCDIR=/usr/include/postgresql
-              if test -d /usr/lib64/postgresql; then
-                 POSTGRESQL_LIBDIR=/usr/lib64/postgresql
-              else
-                 POSTGRESQL_LIBDIR=/usr/lib/postgresql
-              fi
-              POSTGRESQL_BINDIR=/usr/bin
-          else
-              AC_MSG_RESULT(no)
-              AC_MSG_ERROR(Unable to find libpq-fe.h in standard locations)
-          fi
-      elif test -f $withval/include/libpq-fe.h; then
-          POSTGRESQL_INCDIR=$withval/include
-          POSTGRESQL_LIBDIR=$withval/lib
-          POSTGRESQL_BINDIR=$withval/bin
-      elif test -f $withval/include/postgresql/libpq-fe.h; then
-          POSTGRESQL_INCDIR=$withval/include/postgresql
-     if test -d $withval/lib64; then
-         POSTGRESQL_LIBDIR=$withval/lib64
-     else
-         POSTGRESQL_LIBDIR=$withval/lib
-     fi
-          POSTGRESQL_BINDIR=$withval/bin
-      else
-          AC_MSG_RESULT(no)
-          AC_MSG_ERROR(Invalid PostgreSQL directory $withval - unable to find libpq-fe.h under $withval)
-      fi
-      AC_DEFINE(HAVE_POSTGRESQL)
-      AC_MSG_RESULT(yes)
-      POSTGRESQL_LFLAGS="-L$POSTGRESQL_LIBDIR -lpq"
-      AC_CHECK_FUNC(crypt, , AC_CHECK_LIB(crypt, crypt, [POSTGRESQL_LFLAGS="$POSTGRESQL_LFLAGS -lcrypt"]))
-      SQL_INCLUDE=-I$POSTGRESQL_INCDIR
-      SQL_LFLAGS=$POSTGRESQL_LFLAGS
-      SQL_BINDIR=$POSTGRESQL_BINDIR
-      SQL_LIB=$POSTGRESQL_LIBDIR/libpq.a
-
-      db_found=yes
-      support_postgresql=yes
-      db_type=PostgreSQL
-      DB_TYPE=postgresql
-  else
-      AC_MSG_RESULT(no)
-  fi
-],[
-  AC_MSG_RESULT(no)
-])
-AC_SUBST(SQL_LFLAGS)
-AC_SUBST(SQL_INCLUDE)
-AC_SUBST(SQL_BINDIR)
-
-])
-
-
-
-AC_DEFUN([BA_CHECK_SQL_DB], 
-[AC_MSG_CHECKING(Checking for various databases)
-dnl# --------------------------------------------------------------------------
-dnl# CHECKING FOR VARIOUS DATABASES (thanks to UdmSearch team)
-dnl# --------------------------------------------------------------------------
-dnl Check for some DBMS backend
-dnl NOTE: we can use only one backend at a time
-db_found=no
-DB_TYPE=none
-
-if test x$support_mysql = xyes; then
-   cats=cats
-fi
-
-AC_MSG_CHECKING(for Berkeley DB support)
-AC_ARG_WITH(berkeleydb,
-AC_HELP_STRING([--with-berkeleydb@<:@=DIR@:>@], [Include Berkeley DB support. DIR is the Berkeley DB base install directory, default is to search through a number of common places for the DB files.]),
-[
-  if test "$withval" != "no"; then
-        if test "$withval" = "yes"; then
-                if test -f /usr/include/db.h; then
-                        BERKELEYDB_INCDIR=/usr/include
-                        if test -d /usr/lib64; then
-                                BERKELEYDB_LIBDIR=/usr/lib64
-                        else
-                                BERKELEYDB_LIBDIR=/usr/lib
-                        fi
-                else
-                AC_MSG_RESULT(no)
-                AC_MSG_ERROR(Invalid Berkeley DB directory - unable to find db.h)
-                fi
-        else
-                if test -f $withval/include/db.h; then
-                        BERKELEYDB_INCDIR=$withval/include
-                        if test -d $withval/lib64; then
-                                BERKELEYDB_LIBDIR=$withval/lib64
-                        else
-                                BERKELEYDB_LIBDIR=$withval/lib
-                        fi
-                else
-                AC_MSG_RESULT(no)
-                AC_MSG_ERROR(Invalid Berkeley DB directory - unable to find db.h under $withval)
-                fi
-        fi
-    SQL_INCLUDE=-I$BERKELEYDB_INCDIR
-    SQL_LFLAGS="-L$BERKELEYDB_LIBDIR -ldb"
-
-    AC_DEFINE(HAVE_BERKELEY_DB)
-    AC_MSG_RESULT(yes)
-    have_db=yes
-    support_mysql=yes
-    DB_TYPE=BerkelyDB
-
-  else
-        AC_MSG_RESULT(no)
-  fi
-],[
-  AC_MSG_RESULT(no)
-])
-AC_SUBST(SQL_LFLAGS)
-AC_SUBST(SQL_INCLUDE)
-
-if test x$support_berkleydb = xyes; then
-   cats=cats
-fi
-
-
-
-
-AC_MSG_CHECKING(for mSQL support)
-AC_ARG_WITH(msql,
-AC_HELP_STRING([--with-msql@<:@=DIR@:>@], [Include mSQL support. DIR is the mSQL base install directory @<:@default=/usr/local/Hughes@:>@]),
-[
-  if test "$withval" != "no"; then
-    if test "$have_db" = "yes"; then
-        AC_MSG_RESULT(error)
-        AC_MSG_ERROR("You can configure for only one database.");
-    fi
-
-    if test "$withval" = "yes"; then
-        MSQL_INCDIR=/usr/local/Hughes/include
-        if test -d /usr/local/Hughes/lib64; then
-            MSQL_LIBDIR=/usr/local/Hughes/lib64
-        else
-            MSQL_LIBDIR=/usr/local/Hughes/lib
-        fi
-    else
-        MSQL_INCDIR=$withval/include
-        if test -d $withval/lib64; then
-            MSQL_LIBDIR=$withval/lib64
-        else
-            MSQL_LIBDIR=$withval/lib
-        fi
-    fi
-    MSQL_INCLUDE=-I$MSQL_INCDIR
-    MSQL_LFLAGS="-L$MSQL_LIBDIR -lmsql"
-
-    AC_DEFINE(HAVE_MSQL)
-    AC_MSG_RESULT(yes)
-    have_db=yes
-  else
-        AC_MSG_RESULT(no)
-  fi
-],[
-  AC_MSG_RESULT(no)
-])
-AC_SUBST(MSQL_LFLAGS)
-AC_SUBST(MSQL_INCLUDE)
-
-
-AC_MSG_CHECKING(for iODBC support)
-AC_ARG_WITH(iodbc,
-AC_HELP_STRING([--with-iodbc@<:@=DIR@:>], [Include iODBC support. DIR is the iODBC base install directory @<:@default=/usr/local@:>@]),
-[
-        if test "$withval" != "no"; then
-            if test "$have_db" = "yes"; then
-                AC_MSG_RESULT(error)
-                AC_MSG_ERROR("You can configure for only one database.");
-            fi
-        fi
-        
-        if test "$withval" = "yes"; then
-                withval=/usr/local
-        fi
-
-        if test "$withval" != "no"; then
-                if test -f $withval/include/isql.h; then
-                        IODBC_INCDIR=$withval/include
-                        if test -d $withval/lib64; then
-                                IODBC_LIBDIR=$withval/lib64
-                        else
-                                IODBC_LIBDIR=$withval/lib
-                        fi
-                else
-                        AC_MSG_RESULT(no)
-                        AC_MSG_ERROR(Invalid iODBC directory - unable to find isql.h)
-                fi
-                IODBC_LFLAGS="-L$IODBC_LIBDIR -liodbc"
-                IODBC_INCLUDE=-I$IODBC_INCDIR
-                AC_DEFINE(HAVE_IODBC)
-                AC_MSG_RESULT(yes)
-                have_db=yes
-        fi
-],[
-        AC_MSG_RESULT(no)
-])
-AC_SUBST(IODBC_LFLAGS)
-AC_SUBST(IODBC_INCLUDE)
-
-
-AC_MSG_CHECKING(for unixODBC support)
-AC_ARG_WITH(unixODBC,
-AC_HELP_STRING([--with-unixODBC@<:@=DIR@:>], [Include unixODBC support. DIR is the unixODBC base install directory @<:@default=/usr/local@:>@]),
-[
-        if test "$withval" != "no"; then
-            if test "$have_db" = "yes"; then
-                AC_MSG_RESULT(error)
-                AC_MSG_ERROR("You can configure for only one database.");
-            fi
-        fi
-        
-        if test "$withval" = "yes"; then
-                withval=/usr/local
-        fi
-
-        if test "$withval" != "no"; then
-                if test -f $withval/include/sql.h; then
-                        UNIXODBC_INCDIR=$withval/include
-                        if test -d $withval/lib64; then
-                                UNIXODBC_LIBDIR=$withval/lib64
-                        else
-                                UNIXODBC_LIBDIR=$withval/lib
-                        fi
-                else
-                        AC_MSG_RESULT(no)
-                        AC_MSG_ERROR(Invalid unixODBC directory - unable to find sql.h)
-                fi
-                UNIXODBC_LFLAGS="-L$UNIXODBC_LIBDIR -lodbc"
-                UNIXODBC_INCLUDE=-I$UNIXODBC_INCDIR
-                AC_DEFINE(HAVE_UNIXODBC)
-                AC_MSG_RESULT(yes)
-                have_db=yes
-        fi
-],[
-        AC_MSG_RESULT(no)
-])
-AC_SUBST(UNIXODBC_LFLAGS)
-AC_SUBST(UNIXODBC_INCLUDE)
-
-
-AC_MSG_CHECKING(for Solid support)
-AC_ARG_WITH(solid,
-AC_HELP_STRING([--with-solid@<:@=DIR@:>], [Include Solid support. DIR is the Solid base install directory @<:@default=/usr/local@:>@]),
-[
-        if test "$withval" != "no"; then
-            if test "$have_db" = "yes"; then
-                AC_MSG_RESULT(error)
-                AC_MSG_ERROR("You can configure for only one database.");
-            fi
-        fi
-
-        if test "$withval" = "yes"; then
-                withval=/usr/local
-        fi
-
-        if test "$withval" != "no"; then
-                if test -f $withval/include/cli0cli.h; then
-                        SOLID_INCDIR=$withval/include
-                        if test -d $withval/lib64; then
-                                SOLID_LIBDIR=$withval/lib64
-                        else
-                                SOLID_LIBDIR=$withval/lib
-                        fi
-                else
-                        AC_MSG_RESULT(no)
-                        AC_MSG_ERROR(Invalid Solid directory - unable to find cli0cli.h)
-                fi
-                SOLID_LFLAGS="-L$SOLID_LIBDIR -lsolcli"
-                SOLID_INCLUDE="-I$SOLID_INCDIR"
-                AC_DEFINE(HAVE_SOLID)
-                AC_MSG_RESULT(yes)
-                have_db=yes
-        fi
-],[
-        AC_MSG_RESULT(no)
-])
-AC_SUBST(SOLID_LFLAGS)
-AC_SUBST(SOLID_INCLUDE)
-
-AC_MSG_CHECKING(for OpenLink ODBC support)
-AC_ARG_WITH(openlink,
-AC_HELP_STRING([--with-openlink@<:@=DIR@:>], [Include OpenLink ODBC support. DIR is the base OpenLink ODBC install directory]),
-[
-  if test "$withval" != "no"; then
-        if test "$withval" = "yes"; then
-
-                if test "$have_db" = "yes"; then
-                        AC_MSG_RESULT(error)
-                        AC_MSG_ERROR("You can configure for only one database.");
-                fi
-
-                if test -f /usr/local/virtuoso-ent/odbcsdk/include/isql.h; then
-                        VIRT_INCDIR=/usr/local/virtuoso-ent/odbcsdk/include/
-                        if test -d /usr/local/virtuoso-ent/odbcsdk/lib64/; then
-                                VIRT_LIBDIR=/usr/local/virtuoso-ent/odbcsdk/lib64/
-                        else
-                                VIRT_LIBDIR=/usr/local/virtuoso-ent/odbcsdk/lib/
-                        fi
-                elif test -f /usr/local/virtuoso-lite/odbcsdk/include/isql.h; then
-                        VIRT_INCDIR=/usr/local/virtuoso-lite/odbcsdk/include/
-                        if test -d /usr/local/virtuoso-lite/odbcsdk/lib64/; then
-                                VIRT_LIBDIR=/usr/local/virtuoso-lite/odbcsdk/lib64/
-                        else
-                                VIRT_LIBDIR=/usr/local/virtuoso-lite/odbcsdk/lib/
-                        fi
-                elif test -f /usr/local/virtuoso/odbcsdk/include/isql.h; then
-                        VIRT_INCDIR=/usr/local/virtuoso/odbcsdk/include/
-                        if test -d /usr/local/virtuoso/odbcsdk/lib64/; then
-                                VIRT_LIBDIR=/usr/local/virtuoso/odbcsdk/lib64/
-                        else
-                                VIRT_LIBDIR=/usr/local/virtuoso/odbcsdk/lib/
-                        fi
-                else
-                AC_MSG_RESULT(no)
-                AC_MSG_ERROR(Invalid OpenLink ODBC directory - unable to find isql.h)
-                fi
-        else
-                if test -f $withval/odbcsdk/include/isql.h; then
-                        VIRT_INCDIR=$withval/odbcsdk/include/
-                        if test -d $withval/odbcsdk/lib64/; then
-                                VIRT_LIBDIR=$withval/odbcsdk/lib64/
-                        else
-                                VIRT_LIBDIR=$withval/odbcsdk/lib/
-                        fi
-                elif test -f $withval/include/isql.h; then
-                        VIRT_INCDIR=$withval/include/
-                        if test -d $withval/lib64/; then
-                                VIRT_LIBDIR=$withval/lib64/
-                        else
-                                VIRT_LIBDIR=$withval/lib/
-                        fi
-                else
-                AC_MSG_RESULT(no)
-                AC_MSG_ERROR(Invalid OpenLink ODBC directory - unable to find isql.h under $withval)
-                fi
-        fi
-    VIRT_INCLUDE=-I$VIRT_INCDIR
-    VIRT_LFLAGS="-L$VIRT_LIBDIR -liodbc"
-
-    AC_DEFINE(HAVE_VIRT)
-    AC_MSG_RESULT(yes)
-    have_db=yes
-
-  else
-        AC_MSG_RESULT(no)
-  fi
-],[
-  AC_MSG_RESULT(no)
-])
-AC_SUBST(VIRT_LFLAGS)
-AC_SUBST(VIRT_INCLUDE)
-
-
-AC_MSG_CHECKING(for EasySoft ODBC support)
-AC_ARG_WITH(easysoft,
-AC_HELP_STRING([--with-easysoft@<:@=DIR@:>], [Include EasySoft ODBC support. DIR is the base EasySoft ODBC install directory]),
-[
-  if test "$withval" != "no"; then
-        if test "$withval" = "yes"; then
-
-                if test "$have_db" = "yes"; then
-                        AC_MSG_RESULT(error)
-                        AC_MSG_ERROR("You can configure for only one database.");
-                fi
-
-                if test -f /usr/local/easysoft/oob/client/include/sql.h; then
-                        EASYSOFT_INCDIR=/usr/local/easysoft/oob/client/include/
-                        if test -d /usr/local/easysoft/oob/client/lib64/; then
-                                EASYSOFT_LFLAGS="-L/usr/local/easysoft/oob/client/lib64/ -L/usr/local/easysoft/lib64"
-                        else
-                                EASYSOFT_LFLAGS="-L/usr/local/easysoft/oob/client/lib/ -L/usr/local/easysoft/lib"
-                        fi
-                else
-                AC_MSG_RESULT(no)
-                AC_MSG_ERROR(Invalid EasySoft ODBC directory - unable to find sql.h)
-                fi
-        else
-                if test -f $withval/easysoft/oob/client/include/sql.h; then
-                        EASYSOFT_INCDIR=$withval/easysoft/oob/client/include/
-                        if test -d $withval/easysoft/oob/client/lib64/; then
-                                EASYSOFT_LFLAGS="-L$withval/easysoft/oob/client/lib64/ -L$withval/easysoft/lib64"
-                        else
-                                EASYSOFT_LFLAGS="-L$withval/easysoft/oob/client/lib/ -L$withval/easysoft/lib"
-                        fi
-                else
-                AC_MSG_RESULT(no)
-                AC_MSG_ERROR(Invalid EasySoft ODBC directory - unable to find sql.h under $withval)
-                fi
-        fi
-    EASYSOFT_INCLUDE=-I$EASYSOFT_INCDIR
-    EASYSOFT_LFLAGS="$EASYSOFT_LFLAGS -lesoobclient -lesrpc -lsupport -lextra"
-
-    AC_DEFINE(HAVE_EASYSOFT)
-    AC_MSG_RESULT(yes)
-    have_db=yes
-
-  else
-        AC_MSG_RESULT(no)
-  fi
-],[
-  AC_MSG_RESULT(no)
-])
-AC_SUBST(EASYSOFT_LFLAGS)
-AC_SUBST(EASYSOFT_INCLUDE)
-
-
-
-AC_MSG_CHECKING(for InterBase support)
-AC_ARG_WITH(ibase,
-AC_HELP_STRING([--with-ibase@<:@=DIR@:>@], [Include InterBase support. DIR is the InterBase install directory @<:@default=/usr/interbase@:>@]),
-[
-        if test "$withval" != "no"; then
-            if test "$have_db" = "yes"; then
-                AC_MSG_RESULT(error)
-                AC_MSG_ERROR("You can configure for only one database.");
-            fi
-        fi
-        
-        if test "$withval" = "yes"; then
-                withval=/usr/interbase
-        fi
-
-        if test "$withval" != "no"; then
-                if test -f $withval/include/ibase.h; then
-                        IBASE_INCDIR=$withval/include
-                        if test -d $withval/lib64; then
-                                IBASE_LIBDIR=$withval/lib64
-                        else
-                                IBASE_LIBDIR=$withval/lib
-                        fi
-                else
-                        AC_MSG_RESULT(no)
-                        AC_MSG_ERROR(Invalid InterBase directory - unable to find ibase.h)
-                fi
-                IBASE_LFLAGS="-L$IBASE_LIBDIR -lgds"
-                IBASE_INCLUDE=-I$IBASE_INCDIR
-                AC_DEFINE(HAVE_IBASE)
-                AC_MSG_RESULT(yes)
-                have_db=yes
-        fi
-],[
-        AC_MSG_RESULT(no)
-])
-AC_SUBST(IBASE_LFLAGS)
-AC_SUBST(IBASE_INCLUDE)
-
-AC_MSG_CHECKING(for Oracle8 support)
-AC_ARG_WITH(oracle8,
-AC_HELP_STRING([--with-oracle8@<:@=DIR@:>@], [Include Oracle8 support. DIR is the Oracle home directory @<:@default=$ORACLE_HOME or /oracle8/app/oracle/product/8.0.5@:>@]),
-[
-        if test "$withval" != "no"; then
-            if test "$have_db" = "yes"; then
-                AC_MSG_RESULT(error)
-                AC_MSG_ERROR("You can configure for only one database.");
-            fi
-        fi
-
-        if test "$withval" = "yes"; then
-                withval="$ORACLE_HOME"
-                if test "$withval" = ""; then
-                        withval=/oracle8/app/oracle/product/8.0.5
-                fi
-        fi
-
-        if test "$withval" != "no"; then
-                if test -f $withval/rdbms/demo/oci.h; then
-                        ORACLE8_INCDIR1=$withval/rdbms/demo/
-                        ORACLE8_INCDIR2=$withval/rdbms/public/:
-                        ORACLE8_INCDIR3=$withval/network/public/
-                        ORACLE8_INCDIR4=$withval/plsql/public/
-                        if test -d $withval/lib64; then
-                                ORACLE8_LIBDIR1=$withval/lib64
-                        else
-                                ORACLE8_LIBDIR1=$withval/lib
-                        fi
-                        if test -d $withval/rdbms/lib64; then
-                               ORACLE8_LIBDIR2=$withval/rdbms/lib64
-                        else
-                                ORACLE8_LIBDIR2=$withval/rdbms/lib
-                        fi
-                else
-                        AC_MSG_RESULT(no)
-                        AC_MSG_ERROR(Invalid ORACLE directory - unable to find oci.h)
-                fi
-                if test -f $withval/lib64/libclntsh.so; then
-                        ORACLE8_LFLAGS="-L$ORACLE8_LIBDIR1 -L$ORACLE8_LIBDIR2 $withval/lib64/libclntsh.so -lmm -lepc -lclient -lvsn -lcommon -lgeneric -lcore4 -lnlsrtl3 -lnsl -lm -ldl -lnetv2 -lnttcp -lnetwork -lncr -lsql"
-                else
-                        ORACLE8_LFLAGS="-L$ORACLE8_LIBDIR1 -L$ORACLE8_LIBDIR2 $withval/lib/libclntsh.so -lmm -lepc -lclient -lvsn -lcommon -lgeneric -lcore4 -lnlsrtl3 -lnsl -lm -ldl -lnetv2 -lnttcp -lnetwork -lncr -lsql"
-                fi
-                ORACLE8_INCLUDE="-I$ORACLE8_INCDIR1 -I$ORACLE8_INCDIR2 -I$ORACLE8_INCDIR3 -I$ORACLE8_INCDIR4"
-                AC_DEFINE(HAVE_ORACLE8)
-                AC_MSG_RESULT(yes)
-                have_db=yes
-        fi
-],[
-        AC_MSG_RESULT(no)
-])
-AC_SUBST(ORACLE8_LFLAGS)
-AC_SUBST(ORACLE8_INCLUDE)
-
-
-AC_MSG_CHECKING(for Oracle7 support)
-AC_ARG_WITH(oracle7,
-AC_HELP_STRING([--with-oracle7@<:@=DIR@:>@], [Include Oracle 7.3 support. DIR is the Oracle home directory @<:@default=$ORACLE_HOME@:>@]),
-[
-        if test "$withval" != "no"; then
-            if test "$have_db" = "yes"; then
-                AC_MSG_RESULT(error)
-                AC_MSG_ERROR("You can configure for only one database.");
-            fi
-        fi
-
-        if test "$withval" = "yes"; then
-                withval="$ORACLE_HOME"
-        fi
-
-        if test "$withval" != "no"; then
-                if test -f $withval/rdbms/demo/ocidfn.h; then
-                        ORACLE7_INCDIR=$withval/rdbms/demo/
-                        if test -d $withval/lib64; then
-                                ORACLE7_LIBDIR1=$withval/lib64
-                        else
-                                ORACLE7_LIBDIR1=$withval/lib
-                        fi
-                        if test -d $withval/rdbms/lib64; then
-                                ORACLE7_LIBDIR2=$withval/rdbms/lib64
-                        else
-                                ORACLE7_LIBDIR2=$withval/rdbms/lib
-                        fi
-                else
-                        AC_MSG_RESULT(no)
-                        AC_MSG_ERROR(Invalid ORACLE directory - unable to find ocidfn.h)
-                fi
-
-        ORACLEINST_TOP=$withval
-        if test -f "$ORACLEINST_TOP/rdbms/lib/sysliblist"
-        then
-          ORA_SYSLIB="`cat $ORACLEINST_TOP/rdbms/lib/sysliblist`"
-        elif test -f "$ORACLEINST_TOP/rdbms/lib64/sysliblist"
-        then
-          ORA_SYSLIB="`cat $ORACLEINST_TOP/rdbms/lib64/sysliblist`"
-        elif test -f "$ORACLEINST_TOP/lib/sysliblist"
-            then
-          ORA_SYSLIB="`cat $ORACLEINST_TOP/lib/sysliblist`"
-        elif test -f "$ORACLEINST_TOP/lib64/sysliblist"
-            then
-          ORA_SYSLIB="`cat $ORACLEINST_TOP/lib64/sysliblist`"
-        else
-          ORA_SYSLIB="-lm"
-        fi
-          
-                ORACLE7_LFLAGS="-L$ORACLE7_LIBDIR1 -L$ORACLE7_LIBDIR2 \
-            -lclient -lsqlnet -lncr -lsqlnet -lclient -lcommon \
-            -lgeneric -lsqlnet -lncr -lsqlnet -lclient -lcommon -lgeneric \
-            -lepc -lnlsrtl3 -lc3v6 -lcore3 -lnlsrtl3 -lcore3 -lnlsrtl3 \
-            $ORA_SYSLIB -lcore3 $ORA_SYSLIB"
-                ORACLE7_INCLUDE="-I$ORACLE7_INCDIR "
-                AC_DEFINE(HAVE_ORACLE7)
-                AC_MSG_RESULT(yes)
-                have_db=yes
-        fi
-],[
-        AC_MSG_RESULT(no)
-])
-AC_SUBST(ORACLE7_LFLAGS)
-AC_SUBST(ORACLE7_INCLUDE)
-])
-  
-
-AC_DEFUN([AM_CONDITIONAL],
-[AC_SUBST($1_TRUE)
-AC_SUBST($1_FALSE)
-if $2; then
-  $1_TRUE=
-  $1_FALSE='#'
-else
-  $1_TRUE='#'
-  $1_FALSE=
-fi])
diff --git a/autoconf/bacula-macros/os.m4 b/autoconf/bacula-macros/os.m4
index 1af4f90..eb249a6 100644
--- a/autoconf/bacula-macros/os.m4
+++ b/autoconf/bacula-macros/os.m4
@@ -1,5 +1,8 @@
 dnl Check type of signal routines (posix, 4.2bsd, 4.1bsd or v7)
 
+dln Author:  Nicolas Boichat
+dnl License: BSD 2-Clause; see file LICENSE-FOSS
+
 AC_DEFUN([SIGNAL_CHECK],
  [AC_REQUIRE([AC_TYPE_SIGNAL])
   AC_MSG_CHECKING(for type of signal functions)
diff --git a/autoconf/config.h.in b/autoconf/config.h.in
index 33b04f1..5cc08b8 100644
--- a/autoconf/config.h.in
+++ b/autoconf/config.h.in
@@ -2,6 +2,11 @@
 /* ------------------------------------------------------------------------- */
 /* --                     CONFIGURE SPECIFIED FEATURES                    -- */
 /* ------------------------------------------------------------------------- */
+
+/*
+ * Copyright (C) 2000-2015 Kern Sibbald
+ * License: BSD 2-Clause; see file LICENSE-FOSS
+ */
    
 /* Define if you want to use MySQL as Catalog database */
 #undef USE_MYSQL_DB
@@ -150,7 +155,6 @@
 #undef llu
 
 #undef HAVE_READLINE 
-#undef HAVE_PYTHON
 
 #undef HAVE_GMP
 
@@ -273,6 +277,9 @@
 /* Set if Bacula bat Qt4 GUI support enabled */
 #undef HAVE_BAT
 
+/* Define to 1 if you have the `be64toh' function. */
+#undef HAVE_BE64TOH
+
 /* Big Endian */
 #undef HAVE_BIG_ENDIAN
 
@@ -398,6 +405,9 @@
 /* Define to 1 if you have the <fcntl.h> header file. */
 #undef HAVE_FCNTL_H
 
+/* Set if fcntl supports file locking */
+#undef HAVE_FCNTL_LOCK
+
 /* Define to 1 if you have the `fdatasync' function. */
 #undef HAVE_FDATASYNC
 
@@ -488,6 +498,9 @@
 /* Define to 1 if you have the <grp.h> header file. */
 #undef HAVE_GRP_H
 
+/* Define to 1 if you have the `htobe64' function. */
+#undef HAVE_HTOBE64
+
 /* Define to 1 if you have the `iconv()' function. */
 #undef HAVE_ICONV
 
@@ -669,6 +682,9 @@
 /* Define to 1 if you have the `posix_fadvise' function. */
 #undef HAVE_POSIX_FADVISE
 
+/* Define to 1 if you have the `posix_fallocate' function. */
+#undef HAVE_POSIX_FALLOCATE
+
 /* Define if your printf() function supports format strings with positions. */
 #undef HAVE_POSIX_PRINTF
 
@@ -1022,6 +1038,9 @@
    <sysmacros.h>. */
 #undef MAJOR_IN_SYSMACROS
 
+/* Whether to have in6addr_any support */
+#undef NEED_IN6ADDR_ANY
+
 /* Define to 1 if your C compiler doesn't accept -c and -o together. */
 #undef NO_MINUS_C_MINUS_O
 
@@ -1100,6 +1119,9 @@
 /* Set if DB batch insert code enabled */
 #undef USE_BATCH_FILE_INSERT
 
+/* Set if you want Lock Manager enabled */
+#undef USE_LOCKMGR
+
 /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
    significant byte first (like Motorola and SPARC, unlike Intel). */
 #if defined AC_APPLE_UNIVERSAL_BUILD
@@ -1124,9 +1146,6 @@
 /* Define for large files, on AIX-style hosts. */
 #undef _LARGE_FILES
 
-/* Set if you want Lock Manager enabled */
-#undef _USE_LOCKMGR
-
 /* Define to empty if `const' does not conform to ANSI C. */
 #undef const
 
@@ -1171,6 +1190,20 @@
    doesn't define it. */
 #undef ptrdiff_t
 
+/* Define to the equivalent of the C99 'restrict' keyword, or to
+   nothing if this is not supported.  Do not define if restrict is
+   supported directly.  */
+#undef restrict
+/* Work around a bug in Sun C++: it does not support _Restrict or
+   __restrict__, even though the corresponding Sun C compiler ends up with
+   "#define restrict _Restrict" or "#define restrict __restrict__" in the
+   previous line.  Perhaps some future version of Sun C++ will work with
+   restrict; if so, hopefully it defines __RESTRICT like Sun C does.  */
+#if defined __SUNPRO_CC && !defined __RESTRICT
+# define _Restrict
+# define __restrict__
+#endif
+
 /* Define to empty if the C compiler doesn't support this keyword. */
 #undef signed
 
diff --git a/autoconf/configure.in b/autoconf/configure.in
index 47d45de..db86e4d 100644
--- a/autoconf/configure.in
+++ b/autoconf/configure.in
@@ -2,6 +2,9 @@ dnl
 dnl
 dnl Process this file with autoconf to produce a configure script.
 dnl
+dnl Copyright (C) 2000-2015 Kern Sibbald
+dnl License: BSD 2-Clause; see file LICENSE-FOSS
+dnl
 dnl require a recent autoconf
 AC_PREREQ(2.61)
 AC_INIT([bacula], m4_esyscmd([sed -n -e 's/^#define VERSION.*"\(.*\)"$/\1/p' ../src/version.h src/version.h 2> /dev/null | tr -d '\n']))
@@ -49,6 +52,7 @@ dnl src/lib
 dnl can be overwritten by specific values from version.h
 LIBBAC_LT_RELEASE=`sed -n -e 's/^#.*LIBBAC_LT_RELEASE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
 LIBBACCFG_LT_RELEASE=`sed -n -e 's/^#.*LIBBACCFG_LT_RELEASE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
+LIBBACPY_LT_RELEASE=`sed -n -e 's/^#.*LIBBACPY_LT_RELEASE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
 
 LIBBAC_LT_RELEASE=${LIBBAC_LT_RELEASE:-$VERSION}
 LIBBACCFG_LT_RELEASE=${LIBBACCFG_LT_RELEASE:-$VERSION}
@@ -75,6 +79,10 @@ LIBBACFIND_LT_RELEASE=${LIBBACFIND_LT_RELEASE:-$VERSION}
 
 AC_SUBST(LIBBACFIND_LT_RELEASE)dnl
 
+
+dnl PFILES are platform or plugin specific files
+PFILES="platforms/Makefile"
+
 echo "configuring for ${BACULA} $VERSION ($DATE)"
 
 
@@ -126,7 +134,6 @@ AC_PATH_PROG(DVDRWFORMAT, dvd+rw-format, dvd+rw-format)
 AC_PATH_PROG(PKGCONFIG, pkg-config, pkg-config)
 AC_PATH_PROG(QMAKE, qmake, none)
 AC_PATH_PROG(GMAKE, gmake, none)
-AC_PATH_PROG(CDRECORD, cdrecord, cdrecord)
 AC_PATH_PROG(PIDOF, pidof, pidof)
 AC_PROG_AWK
 # Some AWK programs fail, so test it and warn the user
@@ -466,7 +473,6 @@ AC_SUBST(QWT_LDFLAGS)
 AC_SUBST(QWT_LIB)
 AC_SUBST(QWT)
 
-
 dnl -------------------------------------------
 dnl smartalloc (default off)
 dnl -------------------------------------------
@@ -496,7 +502,7 @@ AC_ARG_ENABLE(lockmgr,
 )
 
 if test x$support_lockmgr = xyes; then
-   AC_DEFINE(_USE_LOCKMGR, 1, [Set if you want Lock Manager enabled])
+   AC_DEFINE(USE_LOCKMGR, 1, [Set if you want Lock Manager enabled])
 fi
 
 
@@ -641,13 +647,10 @@ AC_ARG_ENABLE(build-dird,
        fi
    ]
 )
-if test x$build_dird = xyes; then
-   DIRD_DIR="src/dird"
-   DIR_TOOLS="DIRTOOLS"
-else
-   DIRD_DIR=""
-   DIR_TOOLS="NODIRTOOLS"
-fi
+
+DIRD_DIR="src/dird"
+DIR_TOOLS="DIRTOOLS"
+
 AC_SUBST(DIRD_DIR)
 AC_SUBST(DIR_TOOLS)
 
@@ -700,12 +703,27 @@ AC_ARG_ENABLE(ipv6,
 if test x$support_ipv6 = xyes; then
     AC_TRY_LINK([ #include <sys/types.h>
 #include <sys/socket.h>
-#include <netinet/in.h>], [struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0;],
+#include <netinet/in.h>], [struct in6_addr t=in6addr_any; t.s6_addr[0] = 0;],
+      [support_in6addr_any=yes], [support_in6addr_any=no])
+
+   if test x$support_in6addr_any = xno ; then
+       in6addr_any="const struct in6_addr in6addr_any"
+   else 
+       in6addr_any="1"
+   fi
+
+   AC_TRY_LINK([ #include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>], [$in6addr_any; struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0;],
       [support_ipv6=yes], [support_ipv6=no])
 fi
 
 if test x$support_ipv6 = xyes; then
    AC_DEFINE(HAVE_IPV6,1,[Whether to enable IPv6 support])
+
+   if test x$support_in6addr_any = xno ; then
+      AC_DEFINE(NEED_IN6ADDR_ANY,1,[Whether to have in6addr_any support])
+   fi
 fi
 
 TERM_LIB=""
@@ -832,6 +850,7 @@ AC_HEADER_DIRENT
 AC_CHECK_FUNCS(strcasecmp select setenv putenv tcgetattr)
 AC_CHECK_FUNCS(lstat lchown lchmod futimes fchmod fchown)
 AC_CHECK_FUNCS(nanosleep nl_langinfo)
+AC_CHECK_FUNCS(be64toh htobe64)
 AC_CHECK_HEADERS(varargs.h)
 
 dnl End of readline/conio stuff
@@ -904,7 +923,6 @@ AC_ARG_WITH(tcp-wrappers,
    ]
 )
 
-
 dnl -----------------------------------------------------------
 dnl Check whether OpenSSL is available
 dnl -----------------------------------------------------------
@@ -1154,6 +1172,10 @@ AC_SUBST(plugindir)
 dnl ------------------------------------------
 dnl Where to send dump email
 dnl ------------------------------------------
+
+dnl ------------------------------------------
+dnl Where to send dump email
+dnl ------------------------------------------
 dump_email=root at localhost
 AC_ARG_WITH(dump-email,
    AC_HELP_STRING([--with-dump-email=EMAIL], [dump email address]),
@@ -1877,6 +1899,7 @@ AC_STRUCT_ST_BLOCKS
 AC_STRUCT_ST_RDEV
 AC_STRUCT_TM
 AC_C_CONST
+AC_C_RESTRICT
 
 AC_CHECK_SIZEOF(char, 1)
 AC_CHECK_SIZEOF(short int, 2)
@@ -2157,6 +2180,13 @@ AC_CHECK_DECL(
     [#include <fcntl.h>]
 )
 
+AC_CHECK_DECL(
+    F_SETLK,
+    AC_DEFINE(HAVE_FCNTL_LOCK, 1, [Set if fcntl supports file locking]),
+    ,
+    [#include <fcntl.h>]
+)
+
 AC_CHECK_FUNC(closefrom, [AC_DEFINE(HAVE_CLOSEFROM, 1, [Define to 1 if you have the 'closefrom' function.])])
 AC_CHECK_FUNCS(getpagesize, [AC_DEFINE(HAVE_GETPAGESIZE, 1, [Set if have getpagesize])])
 AC_CHECK_FUNCS(malloc_trim, [AC_DEFINE(HAVE_MALLOC_TRIM, 1, [Set if have malloc_trim])])
@@ -2164,6 +2194,7 @@ AC_CHECK_FUNCS(malloc_trim, [AC_DEFINE(HAVE_MALLOC_TRIM, 1, [Set if have malloc_
 AC_CHECK_FUNCS(fchdir, [AC_DEFINE(HAVE_FCHDIR)])
 AC_CHECK_FUNCS(strtoll, [AC_DEFINE(HAVE_STRTOLL)])
 AC_CHECK_FUNCS(posix_fadvise)
+AC_CHECK_FUNCS(posix_fallocate)
 AC_CHECK_FUNCS(fdatasync)
 
 AC_CHECK_FUNCS(chflags)
@@ -2890,9 +2921,8 @@ dnl
 dnl Finally we set appropriate distribution specific
 dnl  variables and defaults
 dnl
-dnl PFILES are platform specific files
-PFILES="platforms/Makefile"
 PSCMD="ps -e"
+WIN32=
 MACOSX=
 COMPRESS_MANPAGES=yes
 
@@ -2900,10 +2930,9 @@ case "$DISTNAME" in
 aix)
    DISTVER=`uname -r`
    PSCMD="ps -e -o pid,comm"
-   PFILES="${PFILES} \
-      platforms/aix/Makefile"
-   TAPEDRIVE="/dev/rmt0.1"
-  ;;	
+   PFILES="${PFILES} platforms/aix/Makefile"
+   TAPEDRIVE="/dev/rmt0.1" 
+  ;;	 
 alpha)
    DISTVER=`uname -r`
    PTHREAD_LIB="-lpthread -lexc"
@@ -2931,6 +2960,13 @@ bsdi)
        platforms/bsdi/bacula-dir"
    largefile_support="yes"
   ;;
+cygwin)
+   DISTVER=`uname -a |awk '{print $3}'`
+   TAPEDRIVE="/dev/nrst0"
+   WIN32=win32
+   WCFLAGS="-mwindows"
+   WLDFLAGS="-mwindows"
+  ;;
 darwin)
    DISTVER=`uname -r`
    TAPEDRIVE="/dev/nst0"
@@ -3177,7 +3213,6 @@ AC_ARG_WITH(systemd,
 
 	   PFILES="${PFILES} \
 		   platforms/systemd/Makefile \
-		   platforms/systemd/bacula.conf \
 		   platforms/systemd/bacula-dir.service \
 		   platforms/systemd/bacula-fd.service \
 		   platforms/systemd/bacula-sd.service"
@@ -3203,6 +3238,7 @@ AC_DEFINE_UNQUOTED(lld, "$lld")
 AC_DEFINE_UNQUOTED(llu, "$llu")
 AC_SUBST(TAPEDRIVE)
 AC_SUBST(PSCMD)
+AC_SUBST(WIN32)
 AC_SUBST(MACOSX)
 AC_SUBST(DISTNAME)
 AC_SUBST(DISTVER)
@@ -3226,6 +3262,7 @@ if test "x${subsysdir}" = "x${sbindir}" ; then
    exit 1
 fi
 
+
 AC_OUTPUT([autoconf/Make.common \
 	   Makefile \
 	   manpages/Makefile \
@@ -3255,7 +3292,10 @@ AC_OUTPUT([autoconf/Make.common \
 	   src/qt-console/bat.conf \
 	   src/qt-console/bat.pro \
 	   src/qt-console/bat.pro.mingw32 \
+	   src/qt-console/bat.pro.mingw64 \
 	   src/qt-console/install_conf_file \
+	   src/qt-console/tray-monitor/tray-monitor.pro.mingw32 \
+	   src/qt-console/tray-monitor/tray-monitor.pro.mingw64 \
 	   src/dird/Makefile \
 	   src/dird/bacula-dir.conf \
 	   src/lib/Makefile \
@@ -3300,6 +3340,9 @@ AC_OUTPUT([autoconf/Make.common \
 	   src/plugins/sd/Makefile \
 	   src/plugins/dir/Makefile \
 	   po/Makefile.in \
+	   updatedb/update_mysql_tables \
+	   updatedb/update_sqlite3_tables \
+	   updatedb/update_postgresql_tables \
 	   updatedb/update_mysql_tables_9_to_10 \
 	   updatedb/update_sqlite3_tables_9_to_10 \
 	   updatedb/update_postgresql_tables_9_to_10 \
@@ -3309,9 +3352,10 @@ AC_OUTPUT([autoconf/Make.common \
 	   updatedb/update_mysql_tables_11_to_12 \
 	   updatedb/update_sqlite3_tables_11_to_12 \
 	   updatedb/update_postgresql_tables_11_to_12 \
-	   updatedb/update_mysql_tables_12_to_14 \
-	   updatedb/update_sqlite3_tables_12_to_14 \
-	   updatedb/update_postgresql_tables_12_to_14 \
+	   updatedb/update_mysql_tables_12_to_13 \
+	   updatedb/update_postgresql_tables_12_to_13 \
+	   updatedb/update_mysql_tables_13_to_14 \
+	   updatedb/update_postgresql_tables_13_to_14 \
 	   examples/nagios/check_bacula/Makefile \
 	   platforms/rpms/redhat/bacula.spec \
 	   platforms/rpms/redhat/bacula-bat.spec \
@@ -3355,7 +3399,7 @@ chmod 755 install_conf_file build-depkgs-qt-console
 cd ${BUILD_DIR}
 
 cd scripts
-chmod 755 bacula btraceback mtx-changer storage-ctl bsg_persist
+chmod 755 bacula btraceback mtx-changer
 chmod 755 dvd-handler dvd-simulator
 chmod 755 bconsole disk-changer devel_bacula logrotate
 cd ..
@@ -3381,10 +3425,6 @@ chmod 755 $c/grant_sqlite3_privileges  $c/drop_sqlite3_tables	 $c/drop_sqlite3_d
 chmod 755 $c/create_postgresql_database  $c/update_postgresql_tables $c/make_postgresql_tables
 chmod 755 $c/grant_postgresql_privileges $c/drop_postgresql_tables   $c/drop_postgresql_database
 
-#chmod 755 $c/create_ingres_database  $c/update_ingres_tables $c/make_ingres_tables
-#chmod 755 $c/grant_ingres_privileges $c/drop_ingres_tables   $c/drop_ingres_database
-
-
 chmod 755 $c/make_catalog_backup $c/delete_catalog_backup  $c/make_catalog_backup.pl
 chmod 755 $c/sqlite
 chmod 755 $c/mysql
@@ -3420,70 +3460,70 @@ ${MAKE:-make} clean
 echo "
 Configuration on `date`:
 
-   Host:		    ${host}${post_host} -- ${DISTNAME} ${DISTVER}
-   Bacula version:	    ${BACULA} ${VERSION} (${DATE})
-   Source code location:    ${srcdir}
-   Install binaries:	    ${sbindir}
-   Install libraries:	    ${libdir}
-   Install config files:    ${sysconfdir}
-   Scripts directory:	    ${scriptdir}
-   Archive directory:	    ${archivedir}
-   Working directory:	    ${working_dir}
-   PID directory:	    ${piddir}
-   Subsys directory:	    ${subsysdir}
-   Man directory:	    ${mandir}
-   Data directory:	    ${datarootdir}
-   Plugin directory:	    ${plugindir}
-   C Compiler:		    ${CC} ${CCVERSION}
-   C++ Compiler:	    ${CXX} ${CXXVERSION}
-   Compiler flags:	    ${WCFLAGS} ${CFLAGS}
-   Linker flags:	    ${WLDFLAGS} ${LDFLAGS}
-   Libraries:		    ${LIBS}
-   Statically Linked Tools: ${support_static_tools}
-   Statically Linked FD:    ${support_static_fd}
-   Statically Linked SD:    ${support_static_sd}
-   Statically Linked DIR:   ${support_static_dir}
-   Statically Linked CONS:  ${support_static_cons}
-   Database backends:	    ${db_backends}
-   Database port:	    ${db_port}
-   Database name:	    ${db_name}
-   Database user:	    ${db_user}
-
-   Job Output Email:	    ${job_email}
-   Traceback Email:	    ${dump_email}
-   SMTP Host Address:	    ${smtp_host}
-
-   Director Port:	    ${dir_port}
-   File daemon Port:	    ${fd_port}
-   Storage daemon Port:     ${sd_port}
-
-   Director User:	    ${dir_user}
-   Director Group:	    ${dir_group}
-   Storage Daemon User:     ${sd_user}
-   Storage DaemonGroup:     ${sd_group}
-   File Daemon User:	    ${fd_user}
-   File Daemon Group:	    ${fd_group}
-
-   Large file support:	    $largefile_support
-   Bacula conio support:    ${got_conio} ${CONS_LIBS}
-   readline support:	    ${got_readline} ${PRTREADLINE_SRC}
-   TCP Wrappers support:    ${TCPW_MSG} ${WRAPLIBS}
-   TLS support: 	    ${support_tls}
-   Encryption support:	    ${support_crypto}
-   ZLIB support:	    ${have_zlib}
-   LZO support: 	    ${have_lzo}
-   enable-smartalloc:	    ${support_smartalloc}
-   enable-lockmgr:	    ${support_lockmgr}
-   bat support: 	    ${support_bat}
-   client-only: 	    ${build_client_only}
-   build-dird:		    ${build_dird}
-   build-stored:	    ${build_stored}
-   Plugin support:	    ${have_plugins}
-   AFS support: 	    ${have_afs}
-   ACL support: 	    ${have_acl}
-   XATTR support:	    ${have_xattr}
-   systemd support:	    ${support_systemd} ${SYSTEMD_UNITDIR}
-   Batch insert enabled:    ${batch_insert_db_backends}
+   Host:		     ${host}${post_host} -- ${DISTNAME} ${DISTVER}
+   Bacula version:	     ${BACULA} ${VERSION} (${DATE})
+   Source code location:     ${srcdir}
+   Install binaries:	     ${sbindir}
+   Install libraries:	     ${libdir}
+   Install config files:     ${sysconfdir}
+   Scripts directory:	     ${scriptdir}
+   Archive directory:	     ${archivedir}
+   Working directory:	     ${working_dir}
+   PID directory:	     ${piddir}
+   Subsys directory:	     ${subsysdir}
+   Man directory:	     ${mandir}
+   Data directory:	     ${datarootdir}
+   Plugin directory:	     ${plugindir}
+   C Compiler:		     ${CC} ${CCVERSION}
+   C++ Compiler:	     ${CXX} ${CXXVERSION}
+   Compiler flags:	     ${WCFLAGS} ${CFLAGS}
+   Linker flags:	     ${WLDFLAGS} ${LDFLAGS}
+   Libraries:		     ${LIBS}
+   Statically Linked Tools:  ${support_static_tools}
+   Statically Linked FD:     ${support_static_fd}
+   Statically Linked SD:     ${support_static_sd}
+   Statically Linked DIR:    ${support_static_dir}
+   Statically Linked CONS:   ${support_static_cons}
+   Database backends:	     ${db_backends}
+   Database port:	     ${db_port}
+   Database name:	     ${db_name}
+   Database user:	     ${db_user}
+
+   Job Output Email:	     ${job_email}
+   Traceback Email:	     ${dump_email}
+   SMTP Host Address:	     ${smtp_host}
+
+   Director Port:	     ${dir_port}
+   File daemon Port:	     ${fd_port}
+   Storage daemon Port:      ${sd_port}
+
+   Director User:	     ${dir_user}
+   Director Group:	     ${dir_group}
+   Storage Daemon User:      ${sd_user}
+   Storage DaemonGroup:      ${sd_group}
+   File Daemon User:	     ${fd_user}
+   File Daemon Group:	     ${fd_group}
+
+   Large file support:	     $largefile_support
+   Bacula conio support:     ${got_conio} ${CONS_LIBS}
+   readline support:	     ${got_readline} ${PRTREADLINE_SRC}
+   TCP Wrappers support:     ${TCPW_MSG} ${WRAPLIBS}
+   TLS support: 	     ${support_tls}
+   Encryption support:	     ${support_crypto}
+   ZLIB support:	     ${have_zlib}
+   LZO support: 	     ${have_lzo}
+   enable-smartalloc:	     ${support_smartalloc}
+   enable-lockmgr:	     ${support_lockmgr}
+   bat support: 	     ${support_bat}
+   client-only: 	     ${build_client_only}
+   build-dird:		     ${build_dird}
+   build-stored:	     ${build_stored}
+   Plugin support:	     ${have_plugins}
+   AFS support: 	     ${have_afs}
+   ACL support: 	     ${have_acl}
+   XATTR support:	     ${have_xattr}
+   systemd support:	     ${support_systemd} ${SYSTEMD_UNITDIR}
+   Batch insert enabled:     ${batch_insert_db_backends}
 
   " > config.out
 
diff --git a/autoconf/mkinstalldirs b/autoconf/mkinstalldirs
index 6fbe5e1..4191a45 100755
--- a/autoconf/mkinstalldirs
+++ b/autoconf/mkinstalldirs
@@ -1,7 +1,7 @@
 #! /bin/sh
 # mkinstalldirs --- make directory hierarchy
 
-scriptversion=2004-02-15.20
+scriptversion=2009-04-28.21; # UTC
 
 # Original author: Noah Friedman <friedman at prep.ai.mit.edu>
 # Created: 1993-05-16
@@ -11,8 +11,11 @@ scriptversion=2004-02-15.20
 # bugs to <bug-automake at gnu.org> or send patches to
 # <automake-patches at gnu.org>.
 
+nl='
+'
+IFS=" ""	$nl"
 errstatus=0
-dirmode=""
+dirmode=
 
 usage="\
 Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
@@ -27,7 +30,7 @@ while test $# -gt 0 ; do
   case $1 in
     -h | --help | --h*)         # -h for help
       echo "$usage"
-      exit 0
+      exit $?
       ;;
     -m)                         # -m PERM arg
       shift
@@ -37,7 +40,7 @@ while test $# -gt 0 ; do
       ;;
     --version)
       echo "$0 $scriptversion"
-      exit 0
+      exit $?
       ;;
     --)                         # stop option processing
       shift
@@ -103,13 +106,21 @@ esac
 
 for file
 do
-  set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+  case $file in
+    /*) pathcomp=/ ;;
+    *)  pathcomp= ;;
+  esac
+  oIFS=$IFS
+  IFS=/
+  set fnord $file
   shift
+  IFS=$oIFS
 
-  pathcomp=
   for d
   do
-    pathcomp="$pathcomp$d"
+    test "x$d" = x && continue
+
+    pathcomp=$pathcomp$d
     case $pathcomp in
       -*) pathcomp=./$pathcomp ;;
     esac
@@ -124,7 +135,7 @@ do
       else
 	if test ! -z "$dirmode"; then
 	  echo "chmod $dirmode $pathcomp"
-	  lasterr=""
+	  lasterr=
 	  chmod "$dirmode" "$pathcomp" || lasterr=$?
 
 	  if test ! -z "$lasterr"; then
@@ -134,7 +145,7 @@ do
       fi
     fi
 
-    pathcomp="$pathcomp/"
+    pathcomp=$pathcomp/
   done
 done
 
@@ -146,5 +157,6 @@ exit $errstatus
 # eval: (add-hook 'write-file-hooks 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
 # End:
diff --git a/commits b/commits
deleted file mode 100755
index 12076fa..0000000
--- a/commits
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-git log --pretty=oneline Release-5.0.3..Branch-5.2 | wc -l
diff --git a/configure b/configure
index 3a80aab..ba59ba1 100755
--- a/configure
+++ b/configure
@@ -1,11 +1,9 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for bacula 7.0.2.
+# Generated by GNU Autoconf 2.69 for bacula 7.1.0.
 #
 #
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
-# Foundation, Inc.
+# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
 #
 #
 # This configure script is free software; the Free Software Foundation
@@ -134,6 +132,31 @@ export LANGUAGE
 # CDPATH.
 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
 
+# Use a proper internal environment variable to ensure we don't fall
+  # into an infinite loop, continuously re-executing ourselves.
+  if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
+    _as_can_reexec=no; export _as_can_reexec;
+    # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+  *v*x* | *x*v* ) as_opts=-vx ;;
+  *v* ) as_opts=-v ;;
+  *x* ) as_opts=-x ;;
+  * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+as_fn_exit 255
+  fi
+  # We don't want this to propagate to other subprocesses.
+          { _as_can_reexec=; unset _as_can_reexec;}
 if test "x$CONFIG_SHELL" = x; then
   as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
   emulate sh
@@ -167,7 +190,8 @@ if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
 else
   exitcode=1; echo positional parameters were not saved.
 fi
-test x\$exitcode = x0 || exit 1"
+test x\$exitcode = x0 || exit 1
+test -x / || exit 1"
   as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
   as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
   eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
@@ -220,21 +244,25 @@ IFS=$as_save_IFS
 
 
       if test "x$CONFIG_SHELL" != x; then :
-  # We cannot yet assume a decent shell, so we have to provide a
-	# neutralization value for shells without unset; and this also
-	# works around shells that cannot unset nonexistent variables.
-	# Preserve -v and -x to the replacement shell.
-	BASH_ENV=/dev/null
-	ENV=/dev/null
-	(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
-	export CONFIG_SHELL
-	case $- in # ((((
-	  *v*x* | *x*v* ) as_opts=-vx ;;
-	  *v* ) as_opts=-v ;;
-	  *x* ) as_opts=-x ;;
-	  * ) as_opts= ;;
-	esac
-	exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
+  export CONFIG_SHELL
+             # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+  *v*x* | *x*v* ) as_opts=-vx ;;
+  *v* ) as_opts=-v ;;
+  *x* ) as_opts=-x ;;
+  * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
 fi
 
     if test x$as_have_required = xno; then :
@@ -336,6 +364,14 @@ $as_echo X"$as_dir" |
 
 
 } # as_fn_mkdir_p
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+  test -f "$1" && test -x "$1"
+} # as_fn_executable_p
 # as_fn_append VAR VALUE
 # ----------------------
 # Append the text in VALUE to the end of the definition contained in VAR. Take
@@ -457,6 +493,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits
   chmod +x "$as_me.lineno" ||
     { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
 
+  # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
+  # already done that, so ensure we don't try to do so again and fall
+  # in an infinite loop.  This has already happened in practice.
+  _as_can_reexec=no; export _as_can_reexec
   # Don't try to exec as it changes $[0], causing all sort of problems
   # (the dirname of $[0] is not the place where we might find the
   # original and so on.  Autoconf is especially sensitive to this).
@@ -491,16 +531,16 @@ if (echo >conf$$.file) 2>/dev/null; then
     # ... but there are two gotchas:
     # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
     # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-    # In both cases, we have to default to `cp -p'.
+    # In both cases, we have to default to `cp -pR'.
     ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-      as_ln_s='cp -p'
+      as_ln_s='cp -pR'
   elif ln conf$$.file conf$$ 2>/dev/null; then
     as_ln_s=ln
   else
-    as_ln_s='cp -p'
+    as_ln_s='cp -pR'
   fi
 else
-  as_ln_s='cp -p'
+  as_ln_s='cp -pR'
 fi
 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
 rmdir conf$$.dir 2>/dev/null
@@ -512,28 +552,8 @@ else
   as_mkdir_p=false
 fi
 
-if test -x / >/dev/null 2>&1; then
-  as_test_x='test -x'
-else
-  if ls -dL / >/dev/null 2>&1; then
-    as_ls_L_option=L
-  else
-    as_ls_L_option=
-  fi
-  as_test_x='
-    eval sh -c '\''
-      if test -d "$1"; then
-	test -d "$1/.";
-      else
-	case $1 in #(
-	-*)set "./$1";;
-	esac;
-	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
-	???[sx]*):;;*)false;;esac;fi
-    '\'' sh
-  '
-fi
-as_executable_p=$as_test_x
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
 
 # Sed expression to map a string onto a valid CPP name.
 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -567,8 +587,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='bacula'
 PACKAGE_TARNAME='bacula'
-PACKAGE_VERSION='7.0.2'
-PACKAGE_STRING='bacula 7.0.2'
+PACKAGE_VERSION='7.1.0'
+PACKAGE_STRING='bacula 7.1.0'
 PACKAGE_BUGREPORT=''
 PACKAGE_URL=''
 
@@ -615,6 +635,7 @@ COMPRESS_MANPAGES
 DISTVER
 DISTNAME
 MACOSX
+WIN32
 PSCMD
 TAPEDRIVE
 SYSTEMD_UNITDIR
@@ -816,7 +837,6 @@ MAKE_SHELL
 ARFLAGS
 AWK
 PIDOF
-CDRECORD
 GMAKE
 QMAKE
 PKGCONFIG
@@ -1457,8 +1477,6 @@ target=$target_alias
 if test "x$host_alias" != x; then
   if test "x$build_alias" = x; then
     cross_compiling=maybe
-    $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
-    If a cross compiler is detected then cross compile mode will be used" >&2
   elif test "x$build_alias" != "x$host_alias"; then
     cross_compiling=yes
   fi
@@ -1544,7 +1562,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures bacula 7.0.2 to adapt to many kinds of systems.
+\`configure' configures bacula 7.1.0 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1613,7 +1631,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of bacula 7.0.2:";;
+     short | recursive ) echo "Configuration of bacula 7.1.0:";;
    esac
   cat <<\_ACEOF
 
@@ -1808,10 +1826,10 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-bacula configure 7.0.2
-generated by GNU Autoconf 2.68
+bacula configure 7.1.0
+generated by GNU Autoconf 2.69
 
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
 _ACEOF
@@ -1962,7 +1980,7 @@ $as_echo "$ac_try_echo"; } >&5
 	 test ! -s conftest.err
        } && test -s conftest$ac_exeext && {
 	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
+	 test -x conftest$ac_exeext
        }; then :
   ac_retval=0
 else
@@ -2185,7 +2203,7 @@ $as_echo "$ac_try_echo"; } >&5
 	 test ! -s conftest.err
        } && test -s conftest$ac_exeext && {
 	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
+	 test -x conftest$ac_exeext
        }; then :
   ac_retval=0
 else
@@ -2408,7 +2426,8 @@ int
 main ()
 {
 static int test_array [1 - 2 * !(($2) >= 0)];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
 
   ;
   return 0;
@@ -2424,7 +2443,8 @@ int
 main ()
 {
 static int test_array [1 - 2 * !(($2) <= $ac_mid)];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
 
   ;
   return 0;
@@ -2450,7 +2470,8 @@ int
 main ()
 {
 static int test_array [1 - 2 * !(($2) < 0)];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
 
   ;
   return 0;
@@ -2466,7 +2487,8 @@ int
 main ()
 {
 static int test_array [1 - 2 * !(($2) >= $ac_mid)];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
 
   ;
   return 0;
@@ -2500,7 +2522,8 @@ int
 main ()
 {
 static int test_array [1 - 2 * !(($2) <= $ac_mid)];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
 
   ;
   return 0;
@@ -2738,8 +2761,8 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by bacula $as_me 7.0.2, which was
-generated by GNU Autoconf 2.68.  Invocation command line was
+It was created by bacula $as_me 7.1.0, which was
+generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
 
@@ -3149,7 +3172,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_TRUEPRG="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3195,7 +3218,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_FALSEPRG="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3239,6 +3262,7 @@ BQT_VERSION=`sed -n -e 's/^#define BQT_VERSION.*"\(.*\)"$/\1/p' ${srcdir}/src/ve
 
 LIBBAC_LT_RELEASE=`sed -n -e 's/^#.*LIBBAC_LT_RELEASE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
 LIBBACCFG_LT_RELEASE=`sed -n -e 's/^#.*LIBBACCFG_LT_RELEASE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
+LIBBACPY_LT_RELEASE=`sed -n -e 's/^#.*LIBBACPY_LT_RELEASE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
 
 LIBBAC_LT_RELEASE=${LIBBAC_LT_RELEASE:-$VERSION}
 LIBBACCFG_LT_RELEASE=${LIBBACCFG_LT_RELEASE:-$VERSION}
@@ -3256,6 +3280,9 @@ LIBBACFIND_LT_RELEASE=`sed -n -e 's/^#.*LIBBACFIND_LT_RELEASE.*"\(.*\)"$/\1/p' $
 LIBBACFIND_LT_RELEASE=${LIBBACFIND_LT_RELEASE:-$VERSION}
 
 
+
+PFILES="platforms/Makefile"
+
 echo "configuring for ${BACULA} $VERSION ($DATE)"
 
 
@@ -3282,7 +3309,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="${ac_tool_prefix}gcc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3322,7 +3349,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_CC="gcc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3375,7 +3402,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="${ac_tool_prefix}cc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3416,7 +3443,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
        ac_prog_rejected=yes
        continue
@@ -3474,7 +3501,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3518,7 +3545,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_CC="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3964,8 +3991,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <stdarg.h>
 #include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+struct stat;
 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
 struct buf { int x; };
 FILE * (*rcsopen) (struct buf *, struct stat *, int);
@@ -4078,7 +4104,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4122,7 +4148,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_CXX="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4572,7 +4598,7 @@ do
     for ac_prog in grep ggrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+      as_fn_executable_p "$ac_path_GREP" || continue
 # Check for GNU ac_path_GREP and select it if it is found.
   # Check for GNU $ac_path_GREP
 case `"$ac_path_GREP" --version 2>&1` in
@@ -4638,7 +4664,7 @@ do
     for ac_prog in egrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+      as_fn_executable_p "$ac_path_EGREP" || continue
 # Check for GNU ac_path_EGREP and select it if it is found.
   # Check for GNU $ac_path_EGREP
 case `"$ac_path_EGREP" --version 2>&1` in
@@ -4753,7 +4779,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_CXX="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4817,7 +4843,7 @@ case $as_dir/ in #((
     # by default.
     for ac_prog in ginstall scoinst install; do
       for ac_exec_ext in '' $ac_executable_extensions; do
-	if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+	if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
 	  if test $ac_prog = install &&
 	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
 	    # AIX install.  It has an incompatible calling convention.
@@ -4891,7 +4917,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_MV="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4932,7 +4958,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_REMOVE="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4973,7 +4999,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_CP="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5014,7 +5040,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_SED="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5055,7 +5081,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_ECHO="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5096,7 +5122,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_CMP="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5137,7 +5163,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_TBL="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5178,7 +5204,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_AR="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5219,7 +5245,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_OPENSSL="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5260,7 +5286,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_MTX="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5301,7 +5327,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_DD="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5342,7 +5368,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_MKISOFS="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5383,7 +5409,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5424,7 +5450,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_GROWISOFS="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5465,7 +5491,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_DVDRWMEDIAINFO="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5506,7 +5532,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_DVDRWFORMAT="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5547,7 +5573,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5588,7 +5614,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_QMAKE="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5629,7 +5655,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_GMAKE="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5652,47 +5678,6 @@ $as_echo "no" >&6; }
 fi
 
 
-# Extract the first word of "cdrecord", so it can be a program name with args.
-set dummy cdrecord; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_CDRECORD+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $CDRECORD in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_CDRECORD="$CDRECORD" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_CDRECORD="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  test -z "$ac_cv_path_CDRECORD" && ac_cv_path_CDRECORD="cdrecord"
-  ;;
-esac
-fi
-CDRECORD=$ac_cv_path_CDRECORD
-if test -n "$CDRECORD"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CDRECORD" >&5
-$as_echo "$CDRECORD" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
 # Extract the first word of "pidof", so it can be a program name with args.
 set dummy pidof; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -5711,7 +5696,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_PIDOF="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5752,7 +5737,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_AWK="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5806,7 +5791,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_AWK="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6040,7 +6025,7 @@ do
     for ac_prog in sed gsed; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
+      as_fn_executable_p "$ac_path_SED" || continue
 # Check for GNU ac_path_SED and select it if it is found.
   # Check for GNU $ac_path_SED
 case `"$ac_path_SED" --version 2>&1` in
@@ -6119,7 +6104,7 @@ do
     for ac_prog in fgrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue
+      as_fn_executable_p "$ac_path_FGREP" || continue
 # Check for GNU ac_path_FGREP and select it if it is found.
   # Check for GNU $ac_path_FGREP
 case `"$ac_path_FGREP" --version 2>&1` in
@@ -6375,7 +6360,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6419,7 +6404,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6844,7 +6829,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6884,7 +6869,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_OBJDUMP="objdump"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7186,7 +7171,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7226,7 +7211,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_DLLTOOL="dlltool"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7329,7 +7314,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_AR="$ac_tool_prefix$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7373,7 +7358,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_AR="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7498,7 +7483,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_STRIP="${ac_tool_prefix}strip"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7538,7 +7523,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_STRIP="strip"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7597,7 +7582,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7637,7 +7622,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_RANLIB="ranlib"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -8299,7 +8284,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -8339,7 +8324,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_MANIFEST_TOOL="mt"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -8419,7 +8404,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -8459,7 +8444,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -8511,7 +8496,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -8551,7 +8536,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_NMEDIT="nmedit"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -8603,7 +8588,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -8643,7 +8628,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_LIPO="lipo"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -8695,7 +8680,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -8735,7 +8720,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_OTOOL="otool"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -8787,7 +8772,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -8827,7 +8812,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_OTOOL64="otool64"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -17322,7 +17307,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -18966,7 +18951,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_MSGFMT="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -19049,7 +19034,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -19089,7 +19074,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_RANLIB="ranlib"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -19178,11 +19163,11 @@ else
 int
 main ()
 {
-/* FIXME: Include the comments suggested by Paul. */
+
 #ifndef __cplusplus
-  /* Ultrix mips cc rejects this.  */
+  /* Ultrix mips cc rejects this sort of thing.  */
   typedef int charset[2];
-  const charset cs;
+  const charset cs = { 0, 0 };
   /* SunOS 4.1.1 cc rejects this.  */
   char const *const *pcpcc;
   char **ppc;
@@ -19199,8 +19184,9 @@ main ()
   ++pcpcc;
   ppc = (char**) pcpcc;
   pcpcc = (char const *const *) ppc;
-  { /* SCO 3.2v4 cc rejects this.  */
-    char *t;
+  { /* SCO 3.2v4 cc rejects this sort of thing.  */
+    char tx;
+    char *t = &tx;
     char const *s = 0 ? (char *) 0 : (char const *) 0;
 
     *t++ = 0;
@@ -19216,10 +19202,10 @@ main ()
     iptr p = 0;
     ++p;
   }
-  { /* AIX XL C 1.02.0.0 rejects this saying
+  { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying
        "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
-    struct s { int j; const int *ap[3]; };
-    struct s *b; b->j = 5;
+    struct s { int j; const int *ap[3]; } bx;
+    struct s *b = &bx; b->j = 5;
   }
   { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
     const int foo = 10;
@@ -19812,23 +19798,20 @@ else
 /* end confdefs.h.  */
 $ac_includes_default
 int
-find_stack_direction ()
+find_stack_direction (int *addr, int depth)
 {
-  static char *addr = 0;
-  auto char dummy;
-  if (addr == 0)
-    {
-      addr = &dummy;
-      return find_stack_direction ();
-    }
-  else
-    return (&dummy > addr) ? 1 : -1;
+  int dir, dummy = 0;
+  if (! addr)
+    addr = &dummy;
+  *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1;
+  dir = depth ? find_stack_direction (addr, depth - 1) : 0;
+  return dir + dummy;
 }
 
 int
-main ()
+main (int argc, char **argv)
 {
-  return find_stack_direction () < 0;
+  return find_stack_direction (0, argc + !argv + 20) < 0;
 }
 _ACEOF
 if ac_fn_c_try_run "$LINENO"; then :
@@ -20936,7 +20919,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_INTLBISON="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -21815,7 +21798,6 @@ no_qwt=no
 
 
 
-
 # Check whether --enable-smartalloc was given.
 if test "${enable_smartalloc+set}" = set; then :
   enableval=$enable_smartalloc;
@@ -21846,7 +21828,7 @@ fi
 
 if test x$support_lockmgr = xyes; then
 
-$as_echo "#define _USE_LOCKMGR 1" >>confdefs.h
+$as_echo "#define USE_LOCKMGR 1" >>confdefs.h
 
 fi
 
@@ -21985,13 +21967,10 @@ if test "${enable_build_dird+set}" = set; then :
 
 fi
 
-if test x$build_dird = xyes; then
-   DIRD_DIR="src/dird"
-   DIR_TOOLS="DIRTOOLS"
-else
-   DIRD_DIR=""
-   DIR_TOOLS="NODIRTOOLS"
-fi
+
+DIRD_DIR="src/dird"
+DIR_TOOLS="DIRTOOLS"
+
 
 
 
@@ -22045,7 +22024,34 @@ if test x$support_ipv6 = xyes; then
 int
 main ()
 {
-struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0;
+struct in6_addr t=in6addr_any; t.s6_addr[0] = 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  support_in6addr_any=yes
+else
+  support_in6addr_any=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
+   if test x$support_in6addr_any = xno ; then
+       in6addr_any="const struct in6_addr in6addr_any"
+   else
+       in6addr_any="1"
+   fi
+
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+ #include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+int
+main ()
+{
+$in6addr_any; struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0;
   ;
   return 0;
 }
@@ -22063,6 +22069,12 @@ if test x$support_ipv6 = xyes; then
 
 $as_echo "#define HAVE_IPV6 1" >>confdefs.h
 
+
+   if test x$support_in6addr_any = xno ; then
+
+$as_echo "#define NEED_IN6ADDR_ANY 1" >>confdefs.h
+
+   fi
 fi
 
 TERM_LIB=""
@@ -22628,6 +22640,18 @@ _ACEOF
 fi
 done
 
+for ac_func in be64toh htobe64
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
 for ac_header in varargs.h
 do :
   ac_fn_c_check_header_mongrel "$LINENO" "varargs.h" "ac_cv_header_varargs_h" "$ac_includes_default"
@@ -22935,7 +22959,6 @@ rm -f core conftest.err conftest.$ac_objext \
 fi
 
 
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenSSL" >&5
 $as_echo_n "checking for OpenSSL... " >&6; }
 
@@ -23331,6 +23354,7 @@ fi
 
 
 
+
 dump_email=root at localhost
 
 # Check whether --with-dump-email was given.
@@ -24051,10 +24075,11 @@ if test "${with_mysql+set}" = set; then :
 #                 MYSQL_LIBDIR=`${MYSQL_CONFIG} --variable=pkglibdir`
 #                 MYSQL_INCDIR=`${MYSQL_CONFIG} --variable=pkgincludedir`
 #              else
-#                 MYSQL_LIBDIR=`${MYSQL_CONFIG} --libs | sed -e 's/.*-L//' -e 's/ .*//'`
+#                 MYSQL_LIBDIR=`${MYSQL_CONFIG} --libs_r | sed -e 's/.*-L//' -e 's/ .*//'`
 #                 MYSQL_INCDIR=`${MYSQL_CONFIG} --include | sed -e 's/-I//'`
 #              fi
-#           elif test -f /usr/local/mysql/include/mysql/mysql.h; then
+#           fi
+#           if [ "x${MYSQL_LIB}" = x -o "x${MYSQL_INCDIR}" = x ]; then
            if test -f /usr/local/mysql/include/mysql/mysql.h; then
               MYSQL_INCDIR=/usr/local/mysql/include/mysql
               if test -f /usr/local/mysql/lib64/mysql/libmysqlclient_r.a \
@@ -24139,6 +24164,39 @@ $as_echo "no" >&6; }
                  MYSQL_LIBDIR=$withval/lib
               fi
               MYSQL_BINDIR=$withval/bin
+           elif test -f $withval/mysql.h; then
+                            MYSQL_INCDIR=$withval
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Got with-mysql variable $MYSQL_INCDIR checking MySQL version" >&5
+$as_echo "$as_me: Got with-mysql variable $MYSQL_INCDIR checking MySQL version" >&6;}
+              case $MYSQL_INCDIR in
+                 *mysql55*)
+                     { $as_echo "$as_me:${as_lineno-$LINENO}: Assuming MacPorts MySQL 5.5 variant installed" >&5
+$as_echo "$as_me: Assuming MacPorts MySQL 5.5 variant installed" >&6;}
+                                          if test -f $prefix/lib/mysql55/mysql/libmysqlclient_r.a \
+                          -o -f $prefix/lib/mysql55/mysql/libmysqlclient_r.so; then
+                        { $as_echo "$as_me:${as_lineno-$LINENO}: Found MySQL 5.5 library in $prefix/lib/mysql55/mysql" >&5
+$as_echo "$as_me: Found MySQL 5.5 library in $prefix/lib/mysql55/mysql" >&6;}
+                        MYSQL_LIBDIR=$prefix/lib/mysql55/mysql
+                     fi
+                     MYSQL_BINDIR=$prefix/lib/mysql55/bin
+                 ;;
+                 *mysql51*)
+                     { $as_echo "$as_me:${as_lineno-$LINENO}: Assuming MacPorts MySQL 5.1 variant installed" >&5
+$as_echo "$as_me: Assuming MacPorts MySQL 5.1 variant installed" >&6;}
+                                          if test -f $prefix/lib/mysql51/mysql/libmysqlclient_r.a \
+                          -o -f $prefix/lib/mysql51/mysql/libmysqlclient_r.so; then
+                        { $as_echo "$as_me:${as_lineno-$LINENO}: Found MySQL 5.1 library in $prefix/lib/mysql55/mysql" >&5
+$as_echo "$as_me: Found MySQL 5.1 library in $prefix/lib/mysql55/mysql" >&6;}
+                        MYSQL_LIBDIR=$prefix/lib/mysql51/mysql
+                     fi
+                     MYSQL_BINDIR=$prefix/lib/mysql51/bin
+                 ;;
+              esac
+              if test -z "${MYSQL_LIBDIR}" ; then
+                 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+                 as_fn_error $? "MySQL $withval - unable to find MySQL libraries" "$LINENO" 5
+              fi
            else
               { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
@@ -24514,7 +24572,7 @@ $as_echo "yes" >&6; }
 
                     if test "x$support_batch_insert" = "xyes"; then
                   saved_LDFLAGS="${LDFLAGS}"
-         LDFLAGS="${saved_LDFLAGS} -L$SQLITE_LIBDIR"
+         LDFLAGS="${saved_LDFLAGS} -lpthread -L$SQLITE_LIBDIR"
 
          { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sqlite3_threadsafe in -lsqlite3" >&5
 $as_echo_n "checking for sqlite3_threadsafe in -lsqlite3... " >&6; }
@@ -24687,7 +24745,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_GETCONF="${ac_tool_prefix}getconf"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -24727,7 +24785,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_GETCONF="getconf"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -26455,11 +26513,11 @@ else
 int
 main ()
 {
-/* FIXME: Include the comments suggested by Paul. */
+
 #ifndef __cplusplus
-  /* Ultrix mips cc rejects this.  */
+  /* Ultrix mips cc rejects this sort of thing.  */
   typedef int charset[2];
-  const charset cs;
+  const charset cs = { 0, 0 };
   /* SunOS 4.1.1 cc rejects this.  */
   char const *const *pcpcc;
   char **ppc;
@@ -26476,8 +26534,9 @@ main ()
   ++pcpcc;
   ppc = (char**) pcpcc;
   pcpcc = (char const *const *) ppc;
-  { /* SCO 3.2v4 cc rejects this.  */
-    char *t;
+  { /* SCO 3.2v4 cc rejects this sort of thing.  */
+    char tx;
+    char *t = &tx;
     char const *s = 0 ? (char *) 0 : (char const *) 0;
 
     *t++ = 0;
@@ -26493,10 +26552,10 @@ main ()
     iptr p = 0;
     ++p;
   }
-  { /* AIX XL C 1.02.0.0 rejects this saying
+  { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying
        "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
-    struct s { int j; const int *ap[3]; };
-    struct s *b; b->j = 5;
+    struct s { int j; const int *ap[3]; } bx;
+    struct s *b = &bx; b->j = 5;
   }
   { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
     const int foo = 10;
@@ -27096,7 +27155,8 @@ int
 main ()
 {
 static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($ac_type))];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
 
   ;
   return 0;
@@ -27132,7 +27192,8 @@ int
 main ()
 {
 static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($ac_type))];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
 
   ;
   return 0;
@@ -27297,11 +27358,11 @@ else
 int
 main ()
 {
-/* FIXME: Include the comments suggested by Paul. */
+
 #ifndef __cplusplus
-  /* Ultrix mips cc rejects this.  */
+  /* Ultrix mips cc rejects this sort of thing.  */
   typedef int charset[2];
-  const charset cs;
+  const charset cs = { 0, 0 };
   /* SunOS 4.1.1 cc rejects this.  */
   char const *const *pcpcc;
   char **ppc;
@@ -27318,8 +27379,9 @@ main ()
   ++pcpcc;
   ppc = (char**) pcpcc;
   pcpcc = (char const *const *) ppc;
-  { /* SCO 3.2v4 cc rejects this.  */
-    char *t;
+  { /* SCO 3.2v4 cc rejects this sort of thing.  */
+    char tx;
+    char *t = &tx;
     char const *s = 0 ? (char *) 0 : (char const *) 0;
 
     *t++ = 0;
@@ -27335,10 +27397,10 @@ main ()
     iptr p = 0;
     ++p;
   }
-  { /* AIX XL C 1.02.0.0 rejects this saying
+  { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying
        "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
-    struct s { int j; const int *ap[3]; };
-    struct s *b; b->j = 5;
+    struct s { int j; const int *ap[3]; } bx;
+    struct s *b = &bx; b->j = 5;
   }
   { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
     const int foo = 10;
@@ -27366,6 +27428,52 @@ $as_echo "#define const /**/" >>confdefs.h
 
 fi
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5
+$as_echo_n "checking for C/C++ restrict keyword... " >&6; }
+if ${ac_cv_c_restrict+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_c_restrict=no
+   # The order here caters to the fact that C++ does not require restrict.
+   for ac_kw in __restrict __restrict__ _Restrict restrict; do
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+typedef int * int_ptr;
+	int foo (int_ptr $ac_kw ip) {
+	return ip[0];
+       }
+int
+main ()
+{
+int s[1];
+	int * $ac_kw t = s;
+	t[0] = 0;
+	return foo(t)
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_c_restrict=$ac_kw
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+     test "$ac_cv_c_restrict" != no && break
+   done
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_restrict" >&5
+$as_echo "$ac_cv_c_restrict" >&6; }
+
+ case $ac_cv_c_restrict in
+   restrict) ;;
+   no) $as_echo "#define restrict /**/" >>confdefs.h
+ ;;
+   *)  cat >>confdefs.h <<_ACEOF
+#define restrict $ac_cv_c_restrict
+_ACEOF
+ ;;
+ esac
+
 
 # The cast to long int works around a bug in the HP C Compiler
 # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
@@ -28123,6 +28231,16 @@ $as_echo "#define HAVE_FCNTL_F_CLOSEM 1" >>confdefs.h
 fi
 
 
+ac_fn_c_check_decl "$LINENO" "F_SETLK" "ac_cv_have_decl_F_SETLK" "#include <fcntl.h>
+
+"
+if test "x$ac_cv_have_decl_F_SETLK" = xyes; then :
+
+$as_echo "#define HAVE_FCNTL_LOCK 1" >>confdefs.h
+
+fi
+
+
 ac_fn_c_check_func "$LINENO" "closefrom" "ac_cv_func_closefrom"
 if test "x$ac_cv_func_closefrom" = xyes; then :
 
@@ -28192,6 +28310,17 @@ _ACEOF
 fi
 done
 
+for ac_func in posix_fallocate
+do :
+  ac_fn_c_check_func "$LINENO" "posix_fallocate" "ac_cv_func_posix_fallocate"
+if test "x$ac_cv_func_posix_fallocate" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_POSIX_FALLOCATE 1
+_ACEOF
+
+fi
+done
+
 for ac_func in fdatasync
 do :
   ac_fn_c_check_func "$LINENO" "fdatasync" "ac_cv_func_fdatasync"
@@ -28777,23 +28906,20 @@ else
 /* end confdefs.h.  */
 $ac_includes_default
 int
-find_stack_direction ()
+find_stack_direction (int *addr, int depth)
 {
-  static char *addr = 0;
-  auto char dummy;
-  if (addr == 0)
-    {
-      addr = &dummy;
-      return find_stack_direction ();
-    }
-  else
-    return (&dummy > addr) ? 1 : -1;
+  int dir, dummy = 0;
+  if (! addr)
+    addr = &dummy;
+  *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1;
+  dir = depth ? find_stack_direction (addr, depth - 1) : 0;
+  return dir + dummy;
 }
 
 int
-main ()
+main (int argc, char **argv)
 {
-  return find_stack_direction () < 0;
+  return find_stack_direction (0, argc + !argv + 20) < 0;
 }
 _ACEOF
 if ac_fn_c_try_run "$LINENO"; then :
@@ -30397,8 +30523,8 @@ llu="llu"
 WCFLAGS=
 WLDFLAGS=
 
-PFILES="platforms/Makefile"
 PSCMD="ps -e"
+WIN32=
 MACOSX=
 COMPRESS_MANPAGES=yes
 
@@ -30406,8 +30532,7 @@ case "$DISTNAME" in
 aix)
    DISTVER=`uname -r`
    PSCMD="ps -e -o pid,comm"
-   PFILES="${PFILES} \
-      platforms/aix/Makefile"
+   PFILES="${PFILES} platforms/aix/Makefile"
    TAPEDRIVE="/dev/rmt0.1"
   ;;
 alpha)
@@ -30437,6 +30562,13 @@ bsdi)
        platforms/bsdi/bacula-dir"
    largefile_support="yes"
   ;;
+cygwin)
+   DISTVER=`uname -a |awk '{print $3}'`
+   TAPEDRIVE="/dev/nrst0"
+   WIN32=win32
+   WCFLAGS="-mwindows"
+   WLDFLAGS="-mwindows"
+  ;;
 darwin)
    DISTVER=`uname -r`
    TAPEDRIVE="/dev/nst0"
@@ -30686,7 +30818,6 @@ if test "${with_systemd+set}" = set; then :
 
 	   PFILES="${PFILES} \
 		   platforms/systemd/Makefile \
-		   platforms/systemd/bacula.conf \
 		   platforms/systemd/bacula-dir.service \
 		   platforms/systemd/bacula-fd.service \
 		   platforms/systemd/bacula-sd.service"
@@ -30732,6 +30863,7 @@ _ACEOF
 
 
 
+
 MCOMMON=./autoconf/Make.common
 
 
@@ -30748,7 +30880,8 @@ if test "x${subsysdir}" = "x${sbindir}" ; then
    exit 1
 fi
 
-ac_config_files="$ac_config_files autoconf/Make.common Makefile manpages/Makefile scripts/btraceback scripts/bconsole scripts/bacula scripts/bacula-ctl-dir scripts/bacula-ctl-fd scripts/bacula-ctl-sd scripts/devel_bacula scripts/Makefile scripts/logrotate scripts/mtx-changer scripts/disk-changer scripts/dvd-handler scripts/dvd-simulator scripts/logwatch/Makefile scripts/logwatch/logfile.bacula.conf scripts/bat.desktop scripts/bat.desktop.xsu scripts/bat.desktop.consolehelper scripts/bat. [...]
+
+ac_config_files="$ac_config_files autoconf/Make.common Makefile manpages/Makefile scripts/btraceback scripts/bconsole scripts/bacula scripts/bacula-ctl-dir scripts/bacula-ctl-fd scripts/bacula-ctl-sd scripts/devel_bacula scripts/Makefile scripts/logrotate scripts/mtx-changer scripts/disk-changer scripts/dvd-handler scripts/dvd-simulator scripts/logwatch/Makefile scripts/logwatch/logfile.bacula.conf scripts/bat.desktop scripts/bat.desktop.xsu scripts/bat.desktop.consolehelper scripts/bat. [...]
 
 ac_config_commands="$ac_config_commands default"
 
@@ -31160,16 +31293,16 @@ if (echo >conf$$.file) 2>/dev/null; then
     # ... but there are two gotchas:
     # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
     # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-    # In both cases, we have to default to `cp -p'.
+    # In both cases, we have to default to `cp -pR'.
     ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-      as_ln_s='cp -p'
+      as_ln_s='cp -pR'
   elif ln conf$$.file conf$$ 2>/dev/null; then
     as_ln_s=ln
   else
-    as_ln_s='cp -p'
+    as_ln_s='cp -pR'
   fi
 else
-  as_ln_s='cp -p'
+  as_ln_s='cp -pR'
 fi
 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
 rmdir conf$$.dir 2>/dev/null
@@ -31229,28 +31362,16 @@ else
   as_mkdir_p=false
 fi
 
-if test -x / >/dev/null 2>&1; then
-  as_test_x='test -x'
-else
-  if ls -dL / >/dev/null 2>&1; then
-    as_ls_L_option=L
-  else
-    as_ls_L_option=
-  fi
-  as_test_x='
-    eval sh -c '\''
-      if test -d "$1"; then
-	test -d "$1/.";
-      else
-	case $1 in #(
-	-*)set "./$1";;
-	esac;
-	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
-	???[sx]*):;;*)false;;esac;fi
-    '\'' sh
-  '
-fi
-as_executable_p=$as_test_x
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+  test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
 
 # Sed expression to map a string onto a valid CPP name.
 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -31271,8 +31392,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by bacula $as_me 7.0.2, which was
-generated by GNU Autoconf 2.68.  Invocation command line was
+This file was extended by bacula $as_me 7.1.0, which was
+generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -31337,11 +31458,11 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-bacula config.status 7.0.2
-configured by $0, generated by GNU Autoconf 2.68,
+bacula config.status 7.1.0
+configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
 This config.status script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it."
 
@@ -31431,7 +31552,7 @@ fi
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 if \$ac_cs_recheck; then
-  set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+  set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
   shift
   \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
   CONFIG_SHELL='$SHELL'
@@ -31878,7 +31999,10 @@ do
     "src/qt-console/bat.conf") CONFIG_FILES="$CONFIG_FILES src/qt-console/bat.conf" ;;
     "src/qt-console/bat.pro") CONFIG_FILES="$CONFIG_FILES src/qt-console/bat.pro" ;;
     "src/qt-console/bat.pro.mingw32") CONFIG_FILES="$CONFIG_FILES src/qt-console/bat.pro.mingw32" ;;
+    "src/qt-console/bat.pro.mingw64") CONFIG_FILES="$CONFIG_FILES src/qt-console/bat.pro.mingw64" ;;
     "src/qt-console/install_conf_file") CONFIG_FILES="$CONFIG_FILES src/qt-console/install_conf_file" ;;
+    "src/qt-console/tray-monitor/tray-monitor.pro.mingw32") CONFIG_FILES="$CONFIG_FILES src/qt-console/tray-monitor/tray-monitor.pro.mingw32" ;;
+    "src/qt-console/tray-monitor/tray-monitor.pro.mingw64") CONFIG_FILES="$CONFIG_FILES src/qt-console/tray-monitor/tray-monitor.pro.mingw64" ;;
     "src/dird/Makefile") CONFIG_FILES="$CONFIG_FILES src/dird/Makefile" ;;
     "src/dird/bacula-dir.conf") CONFIG_FILES="$CONFIG_FILES src/dird/bacula-dir.conf" ;;
     "src/lib/Makefile") CONFIG_FILES="$CONFIG_FILES src/lib/Makefile" ;;
@@ -31923,6 +32047,9 @@ do
     "src/plugins/sd/Makefile") CONFIG_FILES="$CONFIG_FILES src/plugins/sd/Makefile" ;;
     "src/plugins/dir/Makefile") CONFIG_FILES="$CONFIG_FILES src/plugins/dir/Makefile" ;;
     "po/Makefile.in") CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;;
+    "updatedb/update_mysql_tables") CONFIG_FILES="$CONFIG_FILES updatedb/update_mysql_tables" ;;
+    "updatedb/update_sqlite3_tables") CONFIG_FILES="$CONFIG_FILES updatedb/update_sqlite3_tables" ;;
+    "updatedb/update_postgresql_tables") CONFIG_FILES="$CONFIG_FILES updatedb/update_postgresql_tables" ;;
     "updatedb/update_mysql_tables_9_to_10") CONFIG_FILES="$CONFIG_FILES updatedb/update_mysql_tables_9_to_10" ;;
     "updatedb/update_sqlite3_tables_9_to_10") CONFIG_FILES="$CONFIG_FILES updatedb/update_sqlite3_tables_9_to_10" ;;
     "updatedb/update_postgresql_tables_9_to_10") CONFIG_FILES="$CONFIG_FILES updatedb/update_postgresql_tables_9_to_10" ;;
@@ -31932,9 +32059,10 @@ do
     "updatedb/update_mysql_tables_11_to_12") CONFIG_FILES="$CONFIG_FILES updatedb/update_mysql_tables_11_to_12" ;;
     "updatedb/update_sqlite3_tables_11_to_12") CONFIG_FILES="$CONFIG_FILES updatedb/update_sqlite3_tables_11_to_12" ;;
     "updatedb/update_postgresql_tables_11_to_12") CONFIG_FILES="$CONFIG_FILES updatedb/update_postgresql_tables_11_to_12" ;;
-    "updatedb/update_mysql_tables_12_to_14") CONFIG_FILES="$CONFIG_FILES updatedb/update_mysql_tables_12_to_14" ;;
-    "updatedb/update_sqlite3_tables_12_to_14") CONFIG_FILES="$CONFIG_FILES updatedb/update_sqlite3_tables_12_to_14" ;;
-    "updatedb/update_postgresql_tables_12_to_14") CONFIG_FILES="$CONFIG_FILES updatedb/update_postgresql_tables_12_to_14" ;;
+    "updatedb/update_mysql_tables_12_to_13") CONFIG_FILES="$CONFIG_FILES updatedb/update_mysql_tables_12_to_13" ;;
+    "updatedb/update_postgresql_tables_12_to_13") CONFIG_FILES="$CONFIG_FILES updatedb/update_postgresql_tables_12_to_13" ;;
+    "updatedb/update_mysql_tables_13_to_14") CONFIG_FILES="$CONFIG_FILES updatedb/update_mysql_tables_13_to_14" ;;
+    "updatedb/update_postgresql_tables_13_to_14") CONFIG_FILES="$CONFIG_FILES updatedb/update_postgresql_tables_13_to_14" ;;
     "examples/nagios/check_bacula/Makefile") CONFIG_FILES="$CONFIG_FILES examples/nagios/check_bacula/Makefile" ;;
     "platforms/rpms/redhat/bacula.spec") CONFIG_FILES="$CONFIG_FILES platforms/rpms/redhat/bacula.spec" ;;
     "platforms/rpms/redhat/bacula-bat.spec") CONFIG_FILES="$CONFIG_FILES platforms/rpms/redhat/bacula-bat.spec" ;;
@@ -33516,7 +33644,7 @@ chmod 755 install_conf_file build-depkgs-qt-console
 cd ${BUILD_DIR}
 
 cd scripts
-chmod 755 bacula btraceback mtx-changer storage-ctl bsg_persist
+chmod 755 bacula btraceback mtx-changer
 chmod 755 dvd-handler dvd-simulator
 chmod 755 bconsole disk-changer devel_bacula logrotate
 cd ..
@@ -33542,10 +33670,6 @@ chmod 755 $c/grant_sqlite3_privileges  $c/drop_sqlite3_tables	 $c/drop_sqlite3_d
 chmod 755 $c/create_postgresql_database  $c/update_postgresql_tables $c/make_postgresql_tables
 chmod 755 $c/grant_postgresql_privileges $c/drop_postgresql_tables   $c/drop_postgresql_database
 
-#chmod 755 $c/create_ingres_database  $c/update_ingres_tables $c/make_ingres_tables
-#chmod 755 $c/grant_ingres_privileges $c/drop_ingres_tables   $c/drop_ingres_database
-
-
 chmod 755 $c/make_catalog_backup $c/delete_catalog_backup  $c/make_catalog_backup.pl
 chmod 755 $c/sqlite
 chmod 755 $c/mysql
@@ -33576,70 +33700,70 @@ ${MAKE:-make} clean
 echo "
 Configuration on `date`:
 
-   Host:		    ${host}${post_host} -- ${DISTNAME} ${DISTVER}
-   Bacula version:	    ${BACULA} ${VERSION} (${DATE})
-   Source code location:    ${srcdir}
-   Install binaries:	    ${sbindir}
-   Install libraries:	    ${libdir}
-   Install config files:    ${sysconfdir}
-   Scripts directory:	    ${scriptdir}
-   Archive directory:	    ${archivedir}
-   Working directory:	    ${working_dir}
-   PID directory:	    ${piddir}
-   Subsys directory:	    ${subsysdir}
-   Man directory:	    ${mandir}
-   Data directory:	    ${datarootdir}
-   Plugin directory:	    ${plugindir}
-   C Compiler:		    ${CC} ${CCVERSION}
-   C++ Compiler:	    ${CXX} ${CXXVERSION}
-   Compiler flags:	    ${WCFLAGS} ${CFLAGS}
-   Linker flags:	    ${WLDFLAGS} ${LDFLAGS}
-   Libraries:		    ${LIBS}
-   Statically Linked Tools: ${support_static_tools}
-   Statically Linked FD:    ${support_static_fd}
-   Statically Linked SD:    ${support_static_sd}
-   Statically Linked DIR:   ${support_static_dir}
-   Statically Linked CONS:  ${support_static_cons}
-   Database backends:	    ${db_backends}
-   Database port:	    ${db_port}
-   Database name:	    ${db_name}
-   Database user:	    ${db_user}
-
-   Job Output Email:	    ${job_email}
-   Traceback Email:	    ${dump_email}
-   SMTP Host Address:	    ${smtp_host}
-
-   Director Port:	    ${dir_port}
-   File daemon Port:	    ${fd_port}
-   Storage daemon Port:     ${sd_port}
-
-   Director User:	    ${dir_user}
-   Director Group:	    ${dir_group}
-   Storage Daemon User:     ${sd_user}
-   Storage DaemonGroup:     ${sd_group}
-   File Daemon User:	    ${fd_user}
-   File Daemon Group:	    ${fd_group}
-
-   Large file support:	    $largefile_support
-   Bacula conio support:    ${got_conio} ${CONS_LIBS}
-   readline support:	    ${got_readline} ${PRTREADLINE_SRC}
-   TCP Wrappers support:    ${TCPW_MSG} ${WRAPLIBS}
-   TLS support: 	    ${support_tls}
-   Encryption support:	    ${support_crypto}
-   ZLIB support:	    ${have_zlib}
-   LZO support: 	    ${have_lzo}
-   enable-smartalloc:	    ${support_smartalloc}
-   enable-lockmgr:	    ${support_lockmgr}
-   bat support: 	    ${support_bat}
-   client-only: 	    ${build_client_only}
-   build-dird:		    ${build_dird}
-   build-stored:	    ${build_stored}
-   Plugin support:	    ${have_plugins}
-   AFS support: 	    ${have_afs}
-   ACL support: 	    ${have_acl}
-   XATTR support:	    ${have_xattr}
-   systemd support:	    ${support_systemd} ${SYSTEMD_UNITDIR}
-   Batch insert enabled:    ${batch_insert_db_backends}
+   Host:		     ${host}${post_host} -- ${DISTNAME} ${DISTVER}
+   Bacula version:	     ${BACULA} ${VERSION} (${DATE})
+   Source code location:     ${srcdir}
+   Install binaries:	     ${sbindir}
+   Install libraries:	     ${libdir}
+   Install config files:     ${sysconfdir}
+   Scripts directory:	     ${scriptdir}
+   Archive directory:	     ${archivedir}
+   Working directory:	     ${working_dir}
+   PID directory:	     ${piddir}
+   Subsys directory:	     ${subsysdir}
+   Man directory:	     ${mandir}
+   Data directory:	     ${datarootdir}
+   Plugin directory:	     ${plugindir}
+   C Compiler:		     ${CC} ${CCVERSION}
+   C++ Compiler:	     ${CXX} ${CXXVERSION}
+   Compiler flags:	     ${WCFLAGS} ${CFLAGS}
+   Linker flags:	     ${WLDFLAGS} ${LDFLAGS}
+   Libraries:		     ${LIBS}
+   Statically Linked Tools:  ${support_static_tools}
+   Statically Linked FD:     ${support_static_fd}
+   Statically Linked SD:     ${support_static_sd}
+   Statically Linked DIR:    ${support_static_dir}
+   Statically Linked CONS:   ${support_static_cons}
+   Database backends:	     ${db_backends}
+   Database port:	     ${db_port}
+   Database name:	     ${db_name}
+   Database user:	     ${db_user}
+
+   Job Output Email:	     ${job_email}
+   Traceback Email:	     ${dump_email}
+   SMTP Host Address:	     ${smtp_host}
+
+   Director Port:	     ${dir_port}
+   File daemon Port:	     ${fd_port}
+   Storage daemon Port:      ${sd_port}
+
+   Director User:	     ${dir_user}
+   Director Group:	     ${dir_group}
+   Storage Daemon User:      ${sd_user}
+   Storage DaemonGroup:      ${sd_group}
+   File Daemon User:	     ${fd_user}
+   File Daemon Group:	     ${fd_group}
+
+   Large file support:	     $largefile_support
+   Bacula conio support:     ${got_conio} ${CONS_LIBS}
+   readline support:	     ${got_readline} ${PRTREADLINE_SRC}
+   TCP Wrappers support:     ${TCPW_MSG} ${WRAPLIBS}
+   TLS support: 	     ${support_tls}
+   Encryption support:	     ${support_crypto}
+   ZLIB support:	     ${have_zlib}
+   LZO support: 	     ${have_lzo}
+   enable-smartalloc:	     ${support_smartalloc}
+   enable-lockmgr:	     ${support_lockmgr}
+   bat support: 	     ${support_bat}
+   client-only: 	     ${build_client_only}
+   build-dird:		     ${build_dird}
+   build-stored:	     ${build_stored}
+   Plugin support:	     ${have_plugins}
+   AFS support: 	     ${have_afs}
+   ACL support: 	     ${have_acl}
+   XATTR support:	     ${have_xattr}
+   systemd support:	     ${support_systemd} ${SYSTEMD_UNITDIR}
+   Batch insert enabled:     ${batch_insert_db_backends}
 
   " > config.out
 
diff --git a/examples/conf/kernsconfig b/examples/conf/kernsconfig
index 62eca38..4aff6af 100755
--- a/examples/conf/kernsconfig
+++ b/examples/conf/kernsconfig
@@ -1,16 +1,30 @@
 #!/bin/sh
+# This is Kern's configure script for Bacula
 #
-# This is Kern's configure script for a test Bacula
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #
-CFLAGS="-g -O2 -Wall" ./configure \
-    --sbindir=$HOME/bacula/bin \
-    --sysconfdir=$HOME/bacula/bin \
-    --with-pid-dir=$HOME/bacula/bin/working \
-    --with-subsys-dir=$HOME/bacula/bin/working \
+
+PREFIX=/opt/bacula
+CFLAGS="-g -O2 -Wall" \
+  ./configure \
+    --sbindir=${PREFIX}/bin \
+    --sysconfdir=${PREFIX}/etc \
+    --docdir=${PREFIX}/html \
+    --htmldir=${PREFIX}/html \
+    --with-working-dir=${PREFIX}/working \
+    --with-pid-dir=${PREFIX}/working \
+    --with-scriptdir=${PREFIX}/scripts \
+    --with-plugindir=${PREFIX}/plugins \
+    --libdir=${PREFIX}/lib \
     --enable-smartalloc \
-    --with-mysql=$HOME/mysql \
-    --with-working-dir=$HOME/bacula/working \
-    --with-dump-email=$USER \
-    --with-job-email=$USER
+    --disable-conio \
+    --enable-readline \
+    --enable-bat \
+    --with-mysql \
+    --with-dump-email=localhost \
+    --with-job-email=localhost \
+    --with-smtp-host=localhost \
+    --with-baseport=9101
 
 exit 0
diff --git a/examples/nagios/check_bacula/Makefile.in b/examples/nagios/check_bacula/Makefile.in
index 5c22e2a..7cdc7a3 100644
--- a/examples/nagios/check_bacula/Makefile.in
+++ b/examples/nagios/check_bacula/Makefile.in
@@ -1,5 +1,7 @@
 #
-#  Version $Id: Makefile.in,v 1.4 2004/09/25 10:19:59 nboichat Exp $
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 #
 @MCOMMON@
 
diff --git a/examples/nagios/check_bacula/check_bacula.c b/examples/nagios/check_bacula/check_bacula.c
index 1546da7..db0e22d 100644
--- a/examples/nagios/check_bacula/check_bacula.c
+++ b/examples/nagios/check_bacula/check_bacula.c
@@ -345,7 +345,7 @@ int docmd(monitoritem* item, const char* command, char *answer) {
             item->D_sock->signal(BNET_HB_RESPONSE);
          }
          else {
-                sprintf(answer, "BACULA WARNING - Unexpected signal received : %s ", bnet_sig_to_ascii(item->D_sock));
+                sprintf(answer, "BACULA WARNING - Unexpected signal received : %s ", bnet_sig_to_ascii(item->D_sock->msglen));
          }
       }
       else { /* BNET_HARDEOF || BNET_ERROR */
diff --git a/get_authors b/get_authors
deleted file mode 100755
index df3f70c..0000000
--- a/get_authors
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-git log --format='%aN' Release-5.0.3..Branch-5.2| sort -u
diff --git a/manpages/Makefile.in b/manpages/Makefile.in
index 929a97f..e4d107a 100644
--- a/manpages/Makefile.in
+++ b/manpages/Makefile.in
@@ -1,4 +1,6 @@
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #
 @MCOMMON@
 
diff --git a/manpages/bacula-dir.8 b/manpages/bacula-dir.8
index e3664b6..1fdc89b 100644
--- a/manpages/bacula-dir.8
+++ b/manpages/bacula-dir.8
@@ -18,7 +18,7 @@ This manual page documents briefly the
 command.
 .br
 Bacula's Director Daemon acts as the controller of the
-network backup system: it is responsible for scheduling and
+network backup system: it is responsible for scheduling and 
 coordinating backups across the network.
 .SH OPTIONS
 .TP
@@ -31,6 +31,9 @@ Set debug level to \fInn\fP.
 .BI \-dt
 Print timestamp in debug output.
 .TP
+.BI \-T
+Send debug messages to the trace file.
+.TP
 .BI \-f
 Run in foreground (for debugging).
 .TP
@@ -94,3 +97,5 @@ and this will allow the console to connect to the director.
 This manual page was written by Jose Luis Tallon
 .nh
 <jltallon at adv\-solutions.net>.
+.SH COPYRIGHT
+This man page document is released under the BSD 2-Clause license.
diff --git a/manpages/bacula-fd.8 b/manpages/bacula-fd.8
index 6a4d7fb..4f2c584 100644
--- a/manpages/bacula-fd.8
+++ b/manpages/bacula-fd.8
@@ -21,7 +21,7 @@ Bacula's File Daemon acts as the interface between the Bacula
 network backup system and the filesystems to be backed up: it is
 responsible for reading/writing/verifying the files to be
 backup'd/verified/restored. Network transfer can optionally be
-compressed.
+compressed. 
 .SH OPTIONS
 .TP
 .BI \-c\   file
@@ -33,6 +33,9 @@ Set debug level to \fInn\fP.
 .BI \-dt
 Print timestamp in debug output.
 .TP
+.BI \-T
+Send debug messages to the trace file.
+.TP
 .BI \-f
 Run in foreground (for debugging).
 .TP
@@ -65,3 +68,5 @@ Show version and usage of program.
 .br
 .SH AUTHOR
 This manual page was written by Jose Luis Tallon <jltallon at adv\-solutions.net>.
+.SH COPYRIGHT
+This man page document is released under the BSD 2-Clause license.
diff --git a/manpages/bacula-sd.8 b/manpages/bacula-sd.8
index aed27a3..56ee778 100644
--- a/manpages/bacula-sd.8
+++ b/manpages/bacula-sd.8
@@ -31,6 +31,9 @@ Set debug level to \fInn\fP.
 .BI \-dt
 Print timestamp in debug output.
 .TP
+.BI \-T
+Send debug messages to the trace file.
+.TP
 .BI \-f
 Run in foreground (for debugging).
 .TP
@@ -65,3 +68,5 @@ Show version and usage of program.
 This manual page was written by Jose Luis Tallon
 .nh
 <jltallon at adv\-solutions.net>.
+.SH COPYRIGHT
+This man page document is released under the BSD 2-Clause license.
diff --git a/manpages/bacula-tray-monitor.1 b/manpages/bacula-tray-monitor.1
index 39a2869..a07cb59 100644
--- a/manpages/bacula-tray-monitor.1
+++ b/manpages/bacula-tray-monitor.1
@@ -42,3 +42,5 @@ Show version and usage of program.
 This manual page was written by Jose Luis Tallon
 .nh
 <jltallon at adv\-solutions.net>.
+.SH COPYRIGHT
+This man page document is released under the BSD 2-Clause license.
diff --git a/manpages/bacula.8 b/manpages/bacula.8
index fd05604..3066f02 100644
--- a/manpages/bacula.8
+++ b/manpages/bacula.8
@@ -6,7 +6,7 @@
 .\" TP hanging label
 .TH Bacula 8 "The Network Backup Solution"
 .SH NAME
-Bacula \- The Network Backup Solution
+Bacula \- The Network Backup Solution            
 .SH SYNOPSIS
 .B bacula-dir \- Director
 .br
@@ -16,8 +16,6 @@ Bacula \- The Network Backup Solution
 .br
 .B bconsole \- Console to control Bacula
 .br
-.B wx-console \- GUI Console
-.br
 .SH DESCRIPTION
 .LP
 Bacula is a set of computer programs that permits you (or the
@@ -63,7 +61,7 @@ in some of the documentation, the File daemon is referred to as
 the Client (for example in Bacula's configuration file).  In
 addition to Unix/Linux File daemons, there is a Windows File
 daemon (normally distributed in binary format).  The Windows File
-daemon runs on all currently known Windows versions (2K, 2003,  XP,
+daemon runs on all currently known Windows versions (2K, 2003,  XP, 
 and Vista).
 
 .LP
@@ -91,7 +89,7 @@ and SQLite3, one of which must be chosen when building Bacula.
 .SH OPTIONS
 See the HTML/PDF documentation at:
 .br
- <http://www.bacula.org>
+ <http://www.bacula.org>          
 .br
 for details of the command line options.
 
@@ -121,5 +119,4 @@ their time and energy to this project -- thanks. See the AUTHORS
 file in the main Bacula source directory.
 
 .SH COPYRIGHT
-Bacula is distributed under a modified AGPL version 3.0, as described in the
-file LICENSE included with the source distribution.
+This man page document is released under the BSD 2-Clause license.
diff --git a/manpages/bat.1 b/manpages/bat.1
index f94d032..87eefb8 100644
--- a/manpages/bat.1
+++ b/manpages/bat.1
@@ -42,3 +42,5 @@ Show version and usage of program.
 .br
 .SH AUTHOR
 This manual page was written by Kern Sibbald.
+.SH COPYRIGHT
+This man page document is released under the BSD 2-Clause license.
diff --git a/manpages/bconsole.8 b/manpages/bconsole.8
index b536783..7bce096 100644
--- a/manpages/bconsole.8
+++ b/manpages/bconsole.8
@@ -2,7 +2,7 @@
 .\" First parameter, NAME, should be all caps
 .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
 .\" other parameters are allowed: see man(7), man(1)
-.TH CONSOLE 8 "4 December 2009" "Kern Sibbald" "Network backup, recovery and verification"
+.TH BCONSOLE 8 "4 December 2009" "Kern Sibbald" "Network backup, recovery and verification"
 .\" Please adjust this date whenever revising the manpage.
 .\"
 .SH NAME
@@ -54,5 +54,7 @@ Show version and usage of program.
 .br
 .SH AUTHOR
 This manual page was written by Jose Luis Tallon
-.nh
+.nh 
 <jltallon at adv\-solutions.net>.
+.SH COPYRIGHT
+This man page document is released under the BSD 2-Clause license.
diff --git a/manpages/bcopy.8 b/manpages/bcopy.8
index df8e456..c6aebfe 100644
--- a/manpages/bcopy.8
+++ b/manpages/bcopy.8
@@ -8,9 +8,9 @@
 .SH NAME
  bcopy \- Bacula's 'Copy from tape'
 .SH SYNOPSIS
-.B bcopy
+.B bcopy 
 .RI [ options ]
-.I input-archive
+.I input-archive 
 .I output-archive
 .br
 .SH DESCRIPTION
@@ -19,7 +19,7 @@ This manual page documents briefly the
 command.
 .PP
 .\" TeX users may be more comfortable with the \fB<whatever>\fP and
-.\" \fI<whatever>\fP escape sequences to invoke bold face and italics,
+.\" \fI<whatever>\fP escape sequences to invoke bold face and italics, 
 .\" respectively.
 .SH OPTIONS
 A summary of options is included below.
@@ -59,5 +59,7 @@ Set verbose mode.
 .br
 .SH AUTHOR
 This manual page was written by Jose Luis Tallon
-.nh
+.nh 
 <jltallon at adv\-solutions.net>.
+.SH COPYRIGHT
+This man page document is released under the BSD 2-Clause license.
diff --git a/manpages/bextract.8 b/manpages/bextract.8
index ee7b9aa..f5aff66 100644
--- a/manpages/bextract.8
+++ b/manpages/bextract.8
@@ -19,7 +19,7 @@ This manual page documents briefly the
 command.
 .PP
 .\" TeX users may be more comfortable with the \fB<whatever>\fP and
-.\" \fI<whatever>\fP escape sequences to invoke bold face and italics,
+.\" \fI<whatever>\fP escape sequences to invoke bold face and italics, 
 .\" respectively.
 .SH OPTIONS
 A summary of options is included below.
@@ -59,5 +59,7 @@ Specify volume names.
 .br
 .SH AUTHOR
 This manual page was written by Jose Luis Tallon
-.nh
+.nh 
 <jltallon at adv\-solutions.net>.
+.SH COPYRIGHT
+This man page document is released under the BSD 2-Clause license.
diff --git a/manpages/bls.8 b/manpages/bls.8
index f413f82..41d695b 100644
--- a/manpages/bls.8
+++ b/manpages/bls.8
@@ -28,7 +28,7 @@ This manual page documents briefly the
 command.
 .PP
 .\" TeX users may be more comfortable with the \fB<whatever>\fP and
-.\" \fI<whatever>\fP escape sequences to invoke bold face and italics,
+.\" \fI<whatever>\fP escape sequences to invoke bold face and italics, 
 .\" respectively.
 .SH OPTIONS
 A summary of options is included below.
@@ -59,7 +59,7 @@ List jobs.
 .TP
 .BI \-k
 List blocks.
-.TP
+.TP 
 .I (no \-j or \-k option)
 List saved files
 .TP
@@ -80,5 +80,7 @@ Set verbose mode.
 .br
 .SH AUTHOR
 This manual page was written by Jose Luis Tallon
-.nh
+.nh 
 <jltallon at adv\-solutions.net>.
+.SH COPYRIGHT
+This man page document is released under the BSD 2-Clause license.
diff --git a/manpages/bpluginfo.8 b/manpages/bpluginfo.8
index fbf6b37..bc6e313 100644
--- a/manpages/bpluginfo.8
+++ b/manpages/bpluginfo.8
@@ -17,7 +17,7 @@ bpluginfo \- Bacula Plugin information utility
 The main purpose of
 .B bpluginfo
 is to display different information about Bacula plugin. You can use it to
-check a plugin name, author, license and short description. You can use
+check a plugin name, author, license and short description. You can use 
 '-f' option to display API implemented by the plugin. Some plugins may require
 additional '-a' option for validating a Bacula Daemons API. In most cases it
 is not required.
@@ -35,17 +35,17 @@ A summary of options is included below.
 Show usage of the program.
 .TP
 .BI \-v
-Verbose information printing all available data from the plugin, including
+Verbose information printing all available data from the plugin, including 
 plugin header and implemented API.
 .TP
 .BI \-i
 Display short information from plugin header only. This is a default option.
-Option incompatible with
+Option incompatible with 
 .B -f
 option.
 .TP
 .BI \-f
-Display information about implemented API functions.
+Display information about implemented API functions. 
 .TP
 .BI \-a\ <api>
 You can supply the plugin initialization function with a particular Bacula
@@ -68,14 +68,14 @@ This is an example of bplufinfo usage with verbose option (-v) and default plugi
 .RS
 .nf
 
-\fB$ bpluginfo -v bpipe-fd.so
+\fB$ bpluginfo -v bpipe-fd.so 
 
 Plugin type:            File Daemon plugin
 Plugin magic:           *FDPluginData*
 Plugin version:         1
 Plugin release date:    January 2008
 Plugin author:          Kern Sibbald
-Plugin license:         Bacula AGPLv3
+Plugin license:         Bacula or Bacula Enterprise
 Plugin description:     Bacula Pipe File Daemon Plugin
 Plugin API version:     6
 
@@ -118,3 +118,4 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 .BR bacula-sd,
 .BR bacula-fd,
 .BR "Bacula Plugins API"
+This man page document is released under the BSD 2-Clause license.
diff --git a/manpages/bregex.8 b/manpages/bregex.8
index 6004d8d..b2314e0 100644
--- a/manpages/bregex.8
+++ b/manpages/bregex.8
@@ -30,7 +30,7 @@ command.
 This program can be useful for testing regex expressions to be applied against a list of filenames.
 .PP
 .\" TeX users may be more comfortable with the \fB<whatever>\fP and
-.\" \fI<whatever>\fP escape sequences to invoke bold face and italics,
+.\" \fI<whatever>\fP escape sequences to invoke bold face and italics, 
 .\" respectively.
 .SH OPTIONS
 A summary of options is included below.
@@ -45,9 +45,9 @@ Set debug level to \fInn\fP.
 Print timestamp in debug output
 .TP
 .BI \-f\ <data\-file>
-The data-file is a filename that contains lines of data to be matched (or not) against one or more patterns. When the program is run, it will prompt you for a regular expression pattern, then apply it one line at a time against the data in the file. Each line that matches will be printed preceded by its line number. You will then be prompted again for another pattern.
+The data-file is a filename that contains lines of data to be matched (or not) against one or more patterns. When the program is run, it will prompt you for a regular expression pattern, then apply it one line at a time against the data in the file. Each line that matches will be printed preceded by its line number. You will then be prompted again for another pattern. 
 .TP
-.BI \-n
+.BI \-n 
 Print lines that do not match
 .TP
 .BI \-l
@@ -57,5 +57,6 @@ Suppress lines numbers.
 .br
 .SH AUTHOR
 This manual page was written by Bruno Friedmann
-.nh
+.nh 
 <bruno at ioda\-net.ch>.
+This man page document is released under the BSD 2-Clause license.
diff --git a/manpages/bscan.8 b/manpages/bscan.8
index fe7520a..cdd1d24 100644
--- a/manpages/bscan.8
+++ b/manpages/bscan.8
@@ -18,21 +18,21 @@ The purpose of bscan is to read (scan) a Bacula Volume and to recreate
 or update the database contents with the information found on the Volume.
 This is done in a non-destructive way. This permits restoring database
 entries that have been lost by pruning, purging, deleting, or a database
-corruption problem.
-
+corruption problem.        
+ 
 .LP
 Normally, it should not be necessary to run the bscan command because
 the database is self maintaining, and most corrupted databases can be
 repaired by the tools provided by the database vendors.
 In addition, if you have maintained bootstrap files during backups, you
-should be able to recover all your data from the bootstrap file
+should be able to recover all your data from the bootstrap file    
 without needed an up to date catalog.
 
 .B bscan
 command.
 .PP
 .\" TeX users may be more comfortable with the \fB<whatever>\fP and
-.\" \fI<whatever>\fP escape sequences to invoke bold face and italics,
+.\" \fI<whatever>\fP escape sequences to invoke bold face and italics, 
 .\" respectively.
 .SH OPTIONS
 A summary of options is included below.
@@ -99,7 +99,8 @@ Specify working directory (default from conf file)
 .br
 .SH AUTHOR
 This manual page was written by Jose Luis Tallon
-.nh
+.nh 
 <jltallon at adv\-solutions.net>,
 for the Debian GNU/Linux system (but may be used by others).
-
+.SH COPYRIGHT
+This man page document is released under the BSD 2-Clause license.
diff --git a/manpages/bsmtp.1 b/manpages/bsmtp.1
index c1cc83d..4d3801a 100644
--- a/manpages/bsmtp.1
+++ b/manpages/bsmtp.1
@@ -2,7 +2,7 @@
 .\" First parameter, NAME, should be all caps
 .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
 .\" other parameters are allowed: see man(7), man(1)
-.TH BSMTP 1 "3 July 2012" "Kern Sibbald" "Network backup, recovery and verification"
+.TH BSMTP 1 "6 December 2009" "Kern Sibbald" "Network backup, recovery and verification"
 .\" Please adjust this date whenever revising the manpage.
 .\"
 .SH NAME
@@ -23,18 +23,9 @@ operator.
 
 .SH OPTIONS
 .TP
-.B \-4
-Forces bsmtp to use IPv4 addresses only.
-.TP
-.B \-6
-Forces bsmtp to use IPv6 addresses only.
-.TP
 .B \-8
 Encode the mail in UTF-8.
 .TP
-.B \-a
-Use any ip protocol for address resolution.
-.TP
 .B \-c
 Set the \fBCc:\fR header.
 .TP
@@ -125,3 +116,5 @@ This manual page was written by Jose Luis Tallon
 <lbc at members.fsf.org>.
 .SH SEE ALSO
 .BR "bacula-dir" "(8) "
+.SH COPYRIGHT
+This man page document is released under the BSD 2-Clause license.
diff --git a/manpages/btape.8 b/manpages/btape.8
index 2188ce2..6ea914e 100644
--- a/manpages/btape.8
+++ b/manpages/btape.8
@@ -18,7 +18,7 @@ This manual page documents briefly the
 command.
 .PP
 .\" TeX users may be more comfortable with the \fB<whatever>\fP and
-.\" \fI<whatever>\fP escape sequences to invoke bold face and italics,
+.\" \fI<whatever>\fP escape sequences to invoke bold face and italics, 
 .\" respectively.
 .SH OPTIONS
 A summary of options is included below.
@@ -54,7 +54,7 @@ backspace file
 .TP
 .B bsr
 backspace record
-.TP
+.TP 
 .B cap
 list device capabilities
 .TP
@@ -136,5 +136,7 @@ quick fill command
 .br
 .SH AUTHOR
 This manual page was written by Jose Luis Tallon
-.nh
+.nh 
 <jltallon at adv\-solutions.net>.
+.SH COPYRIGHT
+This man page document is released under the BSD 2-Clause license.
diff --git a/manpages/btraceback.8 b/manpages/btraceback.8
index dc8de3c..c17b287 100644
--- a/manpages/btraceback.8
+++ b/manpages/btraceback.8
@@ -9,8 +9,8 @@
  btraceback \- wrapper script around gdb and bsmtp
 
 .SH SYNOPSIS
-.B btraceback
-.I /path/to/binary
+.B btraceback 
+.I /path/to/binary 
 .I pid
 
 .SH DESCRIPTION
@@ -61,8 +61,9 @@ the GDB command batch used to output a stack trace
 .RE
 
 .SH AUTHOR
-This manual page was written by Lucas B. Cohen
+This manual page was written by Lucas B. Cohen 
 .nh
 <lbc at members.fsf.org>
 .SH SEE ALSO
 .BR "bsmtp" "(1) "
+This man page document is released under the BSD 2-Clause license.
diff --git a/manpages/bwild.8 b/manpages/bwild.8
index c4dfbc7..aa097f9 100644
--- a/manpages/bwild.8
+++ b/manpages/bwild.8
@@ -64,3 +64,4 @@ use case insensitive match.
 This manual page was written by Bruno Friedmann
 .nh
 <bruno at ioda\-net.ch>.
+This man page document is released under the BSD 2-Clause license.
diff --git a/manpages/dbcheck.8 b/manpages/dbcheck.8
index a92ab86..691c3dc 100644
--- a/manpages/dbcheck.8
+++ b/manpages/dbcheck.8
@@ -200,3 +200,5 @@ waste their time running dbcheck too often.
 This manual page was written by Jose Luis Tallon
 .nh
 <jltallon at adv\-solutions.net>.
+.SH COPYRIGHT
+This man page document is released under the BSD 2-Clause license.
diff --git a/platforms/Makefile.in b/platforms/Makefile.in
index fedcde3..afdb9c8 100644
--- a/platforms/Makefile.in
+++ b/platforms/Makefile.in
@@ -1,4 +1,7 @@
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # This is the makefile template for the platform directory
 # which contains general platform installation.
 #
diff --git a/platforms/aix/Makefile.in b/platforms/aix/Makefile.in
index 3dbee96..6566383 100644
--- a/platforms/aix/Makefile.in
+++ b/platforms/aix/Makefile.in
@@ -4,6 +4,9 @@
 #
 #  1 March 2003 -- Kern Sibbald
 #
+# Copyright (C) 2003-2015, Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 #  for Bacula release @VERSION@ (@DATE@) -- @DISTNAME@
 #
 
diff --git a/platforms/alpha/Makefile.in b/platforms/alpha/Makefile.in
index 038615b..3e2d9c5 100644
--- a/platforms/alpha/Makefile.in
+++ b/platforms/alpha/Makefile.in
@@ -1,4 +1,7 @@
 # 
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # This file is used as the template to create the
 # Makefile for the Tru64 specific installation.
 #
diff --git a/platforms/alpha/bacula-fd.in b/platforms/alpha/bacula-fd.in
index 74a12c0..b162cb4 100644
--- a/platforms/alpha/bacula-fd.in
+++ b/platforms/alpha/bacula-fd.in
@@ -1,5 +1,8 @@
 #!/bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula       This shell script takes care of starting and stopping
 #	       the bacula File daemon.
 #
@@ -9,6 +12,7 @@
 #  for Bacula release @VERSION@ (@DATE@) -- @DISTNAME@ 
 #
 
+RETVAL=0
 case "$1" in
     start)
        echo "Starting the Bacula File daemon: "
@@ -30,10 +34,11 @@ case "$1" in
        $0 stop
        sleep 5
        $0 start
+       RETVAL=$?
        ;;
     *)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
        ;;
 esac
-exit 0
+exit $RETVAL
diff --git a/platforms/bsdi/Makefile.in b/platforms/bsdi/Makefile.in
index 5a84037..d228a8b 100644
--- a/platforms/bsdi/Makefile.in
+++ b/platforms/bsdi/Makefile.in
@@ -1,3 +1,6 @@
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 # 
 # This file is used as the template to create the
 # Makefile for the Solaris specific installation.
diff --git a/platforms/bsdi/bacula-dir.in b/platforms/bsdi/bacula-dir.in
index af7b0c5..342a063 100755
--- a/platforms/bsdi/bacula-dir.in
+++ b/platforms/bsdi/bacula-dir.in
@@ -1,4 +1,6 @@
 #! /bin/sh
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #
 # bacula       This shell script takes care of starting and stopping
 #	       the bacula Director daemon
@@ -29,10 +31,11 @@ case "$1" in
        $0 stop
        sleep 5
        $0 start
+       RETVAL=$?
        ;;
     *)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
        ;;
 esac
-exit 0
+exit $RETVAL
diff --git a/platforms/bsdi/bacula-fd.in b/platforms/bsdi/bacula-fd.in
index 2c41b34..e98f7ad 100755
--- a/platforms/bsdi/bacula-fd.in
+++ b/platforms/bsdi/bacula-fd.in
@@ -1,5 +1,8 @@
 #! /bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula       This shell script takes care of starting and stopping
 #	       the bacula File daemon.
 #
@@ -9,6 +12,7 @@
 #  For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@
 #
 
+RETVAL=0
 case "$1" in
     start)
        echo "Starting the Bacula File daemon: "
@@ -28,10 +32,11 @@ case "$1" in
        $0 stop
        sleep 5
        $0 start
+       RETVAL=$?
        ;;
     *)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
        ;;
 esac
-exit 0
+exit $RETVAL
diff --git a/platforms/bsdi/bacula-sd.in b/platforms/bsdi/bacula-sd.in
index 9f4e6f0..7aafe60 100755
--- a/platforms/bsdi/bacula-sd.in
+++ b/platforms/bsdi/bacula-sd.in
@@ -1,5 +1,8 @@
 #! /bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula       This shell script takes care of starting and stopping
 #	       the bacula Storage daemon.
 #
@@ -9,6 +12,7 @@
 #  For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@
 #
 
+RETVAL=0
 case "$1" in
     start)
        echo "Starting the Bacula Storage daemon: "
@@ -28,10 +32,11 @@ case "$1" in
        $0 stop
        sleep 5
        $0 start
+       RETVAL=$?
        ;;
     *)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
        ;;
 esac
-exit 0
+exit $RETVAL
diff --git a/platforms/contrib-rpm/build_rpm.sh b/platforms/contrib-rpm/build_rpm.sh
index 67d82dc..07f4efe 100755
--- a/platforms/contrib-rpm/build_rpm.sh
+++ b/platforms/contrib-rpm/build_rpm.sh
@@ -3,9 +3,10 @@
 # shell script to build bacula rpm release
 # copy this script into a working directory with the src rpm to build and execute
 # 19 Aug 2006 D. Scott Barninger
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 
-# Copyright (C) 2006 Free Software Foundation Europe e.V.
-# licensed under GPL-v2
 
 # signing rpms
 # Make sure you have a .rpmmacros file in your home directory containing the following:
@@ -115,10 +116,10 @@ rpmbuild --rebuild --define "build_${PLATFORM} 1" \
 rm -rf ${RPMBUILD}/*
 
 if [ "$BUILDBAT" = "1" ]; then
-	echo Building Bat package for "$PLATFORM"...
-	sleep 2
-	rpmbuild --rebuild ${SRPM2}
-	rm -rf ${RPMBUILD}/*
+        echo Building Bat package for "$PLATFORM"...
+        sleep 2
+        rpmbuild --rebuild ${SRPM2}
+        rm -rf ${RPMBUILD}/*
 fi
 
 echo Building Docs package for "$PLATFORM"...
@@ -127,10 +128,10 @@ rpmbuild --rebuild ${SRPM3}
 rm -rf ${RPMBUILD}/*
 
 if [ "$BUILDMTX" = "1" ]; then
-	echo Building mtx package for "$PLATFORM"...
-	sleep 2
-	rpmbuild --rebuild ${SRPM4}
-	rm -rf ${RPMBUILD}/*
+        echo Building mtx package for "$PLATFORM"...
+        sleep 2
+        rpmbuild --rebuild ${SRPM4}
+        rm -rf ${RPMBUILD}/*
 fi
 
 # delete the updatedb package and any debuginfo packages built
@@ -153,8 +154,8 @@ mv -f ${RPMDIR}/bacula-sqlite-${VERSION}-${RELEASE}.${ARCH}.rpm \
 ./bacula-sqlite-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
 
 if [ "$BUILDMTX" = "1" ]; then
-	mv -f ${RPMDIR}/bacula-mtx-${VERSION}-${RELEASE}.${ARCH}.rpm \
-	./bacula-mtx-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
+        mv -f ${RPMDIR}/bacula-mtx-${VERSION}-${RELEASE}.${ARCH}.rpm \
+        ./bacula-mtx-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
 fi
 
 mv -f ${RPMDIR}/bacula-client-${VERSION}-${RELEASE}.${ARCH}.rpm \
@@ -164,8 +165,8 @@ mv -f ${RPMDIR}/bacula-libs-${VERSION}-${RELEASE}.${ARCH}.rpm \
 ./bacula-libs-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
 
 if [ "$BUILDBAT" = "1" ]; then
-	mv -f ${RPMDIR}/bacula-bat-${VERSION}-${RELEASE}.${ARCH}.rpm \
-	./bacula-bat-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
+        mv -f ${RPMDIR}/bacula-bat-${VERSION}-${RELEASE}.${ARCH}.rpm \
+        ./bacula-bat-${VERSION}-${RELEASE}.${FILENAME}.${ARCH}.rpm
 fi
 
 mv -f ${RPMDIR2}/bacula-docs-${VERSION}-${RELEASE}.noarch.rpm .
diff --git a/platforms/contrib-rpm/rpm_wizard.sh b/platforms/contrib-rpm/rpm_wizard.sh
index 89857dc..0ff3628 100755
--- a/platforms/contrib-rpm/rpm_wizard.sh
+++ b/platforms/contrib-rpm/rpm_wizard.sh
@@ -3,9 +3,10 @@
 # shell script wizard to build bacula rpm using gnome dialogs
 # requires zenity to be installed
 # 30 Jul 2006 D. Scott Barninger
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 
-# Copyright (C) 2006 Free Software Foundation Europe e.V.
-# licensed under GPL-v2
 
 # usage ./rpm_wizard.sh
 
diff --git a/platforms/contrib-rpm/rpmkey.spec b/platforms/contrib-rpm/rpmkey.spec
index 81183a1..662e8e3 100644
--- a/platforms/contrib-rpm/rpmkey.spec
+++ b/platforms/contrib-rpm/rpmkey.spec
@@ -1,6 +1,7 @@
 # rpm public key package
-# Copyright (C) 2006 Free Software Foundation Europe e.V.
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #
 
 # replace the string yournam with your name
@@ -14,7 +15,7 @@ Summary: The %{pubkeyname} rpm public key
 Name: rpmkey-%{pubkeyname}
 Version: 0.1
 Release: 1
-License: GPL v2
+License: BSD 2-Clause; see file LICENSE-FOSS
 Group: System/Packages
 Source0: %{pubkeyname}.asc
 BuildArch: noarch
diff --git a/platforms/darwin/Makefile.in b/platforms/darwin/Makefile.in
index c6fde3e..b11f51e 100644
--- a/platforms/darwin/Makefile.in
+++ b/platforms/darwin/Makefile.in
@@ -1,4 +1,7 @@
 # 
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # This file is used as the template to create the
 # Makefile for the Darwin specific installation.
 #
diff --git a/platforms/debian/Makefile.in b/platforms/debian/Makefile.in
index aa77f36..7f0aa2d 100644
--- a/platforms/debian/Makefile.in
+++ b/platforms/debian/Makefile.in
@@ -1,3 +1,6 @@
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 # 
 # This file is used as the template to create the
 # Makefile for the Debian/Ubuntu/Kubuntu specific installation.
diff --git a/platforms/debian/bacula-dir.in b/platforms/debian/bacula-dir.in
index 73253dc..a6715e7 100644
--- a/platforms/debian/bacula-dir.in
+++ b/platforms/debian/bacula-dir.in
@@ -1,5 +1,8 @@
 #! /bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula  This shell script takes care of starting and stopping
 #	  the bacula Director daemon on Debian/Ubuntu/Kubuntu 
 #	  systems. 
@@ -48,6 +51,7 @@ if [ "x${BUSER}" != "x" ]; then
    fi
 fi
 
+RETVAL=0
 case "$1" in
    start)
       echo -n "Starting ${DESC}: "
@@ -65,6 +69,7 @@ case "$1" in
       $0 stop
       sleep 5
       $0 start
+      RETVAL=$?
       ;;
    *)
       echo "Usage: /etc/init.d/${NAME} {start|stop|restart|force-reload}" >&2
diff --git a/platforms/debian/bacula-fd.in b/platforms/debian/bacula-fd.in
index 181625c..86568cb 100644
--- a/platforms/debian/bacula-fd.in
+++ b/platforms/debian/bacula-fd.in
@@ -1,5 +1,8 @@
 #! /bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+# 
 # bacula  This shell script takes care of starting and stopping
 #	  the bacula Director daemon on Debian/Ubuntu/Kubuntu 
 #	  systems. 
@@ -48,6 +51,7 @@ if [ "x${BUSER}" != "x" ]; then
    fi
 fi
 
+RETVAL=0
 case "$1" in
    start)
       echo -n "Starting ${DESC}: "
@@ -65,6 +69,7 @@ case "$1" in
       $0 stop
       sleep 5
       $0 start
+      RETVAL=$?
       ;;
    *)
       echo "Usage: /etc/init.d/${NAME} {start|stop|restart|force-reload}" >&2
diff --git a/platforms/debian/bacula-sd.in b/platforms/debian/bacula-sd.in
index 1753304..13b726e 100644
--- a/platforms/debian/bacula-sd.in
+++ b/platforms/debian/bacula-sd.in
@@ -1,5 +1,8 @@
 #! /bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+# 
 # bacula  This shell script takes care of starting and stopping
 #	  the bacula Director daemon on Debian/Ubuntu/Kubuntu 
 #	  systems. 
@@ -48,6 +51,7 @@ if [ "x${BUSER}" != "x" ]; then
    fi
 fi
 
+RETVAL=0
 case "$1" in
    start)
       echo -n "Starting ${DESC}: "
@@ -65,6 +69,7 @@ case "$1" in
       $0 stop
       sleep 5
       $0 start
+      RETVAL=$?
       ;;
    *)
       echo "Usage: /etc/init.d/${NAME} {start|stop|restart|force-reload}" >&2
diff --git a/platforms/freebsd/Makefile.in b/platforms/freebsd/Makefile.in
index b97f62c..9aab694 100644
--- a/platforms/freebsd/Makefile.in
+++ b/platforms/freebsd/Makefile.in
@@ -1,3 +1,6 @@
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 # 
 # This file is used as the template to create the
 # Makefile for the Solaris specific installation.
diff --git a/platforms/freebsd/bacula-dir.in b/platforms/freebsd/bacula-dir.in
index af7b0c5..78dde03 100755
--- a/platforms/freebsd/bacula-dir.in
+++ b/platforms/freebsd/bacula-dir.in
@@ -1,5 +1,8 @@
 #! /bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula       This shell script takes care of starting and stopping
 #	       the bacula Director daemon
 #
@@ -29,10 +32,11 @@ case "$1" in
        $0 stop
        sleep 5
        $0 start
+       RETVAL=$?
        ;;
     *)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
        ;;
 esac
-exit 0
+exit $RETVAL
diff --git a/platforms/freebsd/bacula-fd.in b/platforms/freebsd/bacula-fd.in
index 2c41b34..e98f7ad 100755
--- a/platforms/freebsd/bacula-fd.in
+++ b/platforms/freebsd/bacula-fd.in
@@ -1,5 +1,8 @@
 #! /bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula       This shell script takes care of starting and stopping
 #	       the bacula File daemon.
 #
@@ -9,6 +12,7 @@
 #  For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@
 #
 
+RETVAL=0
 case "$1" in
     start)
        echo "Starting the Bacula File daemon: "
@@ -28,10 +32,11 @@ case "$1" in
        $0 stop
        sleep 5
        $0 start
+       RETVAL=$?
        ;;
     *)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
        ;;
 esac
-exit 0
+exit $RETVAL
diff --git a/platforms/freebsd/bacula-sd.in b/platforms/freebsd/bacula-sd.in
index 9f4e6f0..7aafe60 100755
--- a/platforms/freebsd/bacula-sd.in
+++ b/platforms/freebsd/bacula-sd.in
@@ -1,5 +1,8 @@
 #! /bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula       This shell script takes care of starting and stopping
 #	       the bacula Storage daemon.
 #
@@ -9,6 +12,7 @@
 #  For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@
 #
 
+RETVAL=0
 case "$1" in
     start)
        echo "Starting the Bacula Storage daemon: "
@@ -28,10 +32,11 @@ case "$1" in
        $0 stop
        sleep 5
        $0 start
+       RETVAL=$?
        ;;
     *)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
        ;;
 esac
-exit 0
+exit $RETVAL
diff --git a/platforms/gentoo/Makefile.in b/platforms/gentoo/Makefile.in
index 4c7c9b0..ee90620 100644
--- a/platforms/gentoo/Makefile.in
+++ b/platforms/gentoo/Makefile.in
@@ -1,4 +1,7 @@
-# 
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # This file is used as the template to create the
 # Makefile for the Gentoo specific installation.
 #
diff --git a/platforms/gentoo/bacula-dir.in b/platforms/gentoo/bacula-dir.in
index a4cbca7..391cbf6 100755
--- a/platforms/gentoo/bacula-dir.in
+++ b/platforms/gentoo/bacula-dir.in
@@ -1,5 +1,8 @@
 #!/sbin/runscript
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula       This shell script takes care of starting and stopping
 #	       the bacula Director daemon for the Gentoo release
 #
diff --git a/platforms/gentoo/bacula-fd.in b/platforms/gentoo/bacula-fd.in
index 98e5efe..fdf1555 100755
--- a/platforms/gentoo/bacula-fd.in
+++ b/platforms/gentoo/bacula-fd.in
@@ -1,5 +1,8 @@
 #!/sbin/runscript
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula       This shell script takes care of starting and stopping
 #	       the bacula File daemon for the Gentoo release.
 #
diff --git a/platforms/gentoo/bacula-sd.in b/platforms/gentoo/bacula-sd.in
index 26c6f74..020047d 100755
--- a/platforms/gentoo/bacula-sd.in
+++ b/platforms/gentoo/bacula-sd.in
@@ -1,5 +1,8 @@
 #!/sbin/runscript
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula       This shell script takes care of starting and stopping
 #	       the bacula Storage daemon for the Gentoo release.
 #
diff --git a/platforms/gentoo/bacula.ebuild b/platforms/gentoo/bacula.ebuild
index b87c624..f80e4d8 100644
--- a/platforms/gentoo/bacula.ebuild
+++ b/platforms/gentoo/bacula.ebuild
@@ -1,5 +1,7 @@
 # Copyright 2004 D. Scott Barninger
-# Distributed under the terms of the GNU General Public License v2
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 #
 # Modified from bacula-1.34.5.ebuild for 1.36.0 release
 # 24 Oct 2004 D. Scott Barninger <barninger at fairfieldcomputers dot com>
@@ -37,7 +39,7 @@ DESCRIPTION="featureful client/server network backup suite"
 HOMEPAGE="http://www.bacula.org/"
 SRC_URI="mirror://sourceforge/bacula/${P}.tar.gz"
 
-LICENSE="GPL-2"
+LICENSE="BSD 2-Clause"
 SLOT="0"
 KEYWORDS="x86 ~ppc ~sparc ~amd64"
 IUSE="readline tcpd gnome mysql sqlite X static postgres wxwindows bacula-clientonly bacula-split"
@@ -48,379 +50,379 @@ inherit eutils
 # mysql is the recommended choice ...
 # may need sys-libs/libtermcap-compat but try without first
 DEPEND=">=sys-libs/zlib-1.1.4
-	readline? ( >=sys-libs/readline-4.1 )
-	tcpd? ( >=sys-apps/tcp-wrappers-7.6 )
-	gnome? ( gnome-base/libgnome )
-	gnome? ( app-admin/gnomesu )
-	!bacula-clientonly? (
-		sqlite? ( =dev-db/sqlite-2* )
-		mysql? ( >=dev-db/mysql-3.23 )
-		postgres? ( >=dev-db/postgresql-7.4.0 )
-		sys-apps/mtx
-	)
-	X? ( virtual/x11 )
-	wxwindows? ( >=x11-libs/wxGTK-2.4.2 )
-	virtual/mta
-	dev-libs/gmp
-	app-text/tetex
-	dev-tex/latex2html"
+        readline? ( >=sys-libs/readline-4.1 )
+        tcpd? ( >=sys-apps/tcp-wrappers-7.6 )
+        gnome? ( gnome-base/libgnome )
+        gnome? ( app-admin/gnomesu )
+        !bacula-clientonly? (
+                sqlite? ( =dev-db/sqlite-2* )
+                mysql? ( >=dev-db/mysql-3.23 )
+                postgres? ( >=dev-db/postgresql-7.4.0 )
+                sys-apps/mtx
+        )
+        X? ( virtual/x11 )
+        wxwindows? ( >=x11-libs/wxGTK-2.4.2 )
+        virtual/mta
+        dev-libs/gmp
+        app-text/tetex
+        dev-tex/latex2html"
 RDEPEND="${DEPEND}
-	!bacula-clientonly? (
-		sys-apps/mtx
-		app-arch/mt-st
-	)"
+        !bacula-clientonly? (
+                sys-apps/mtx
+                app-arch/mt-st
+        )"
 
 src_compile() {
 
-	# this resolves bug #181
-	epatch ${FILESDIR}/1.36.2-cdrecord-configure.patch
-
-	local myconf=""
-
-	myconf="
-		`use_enable readline`
-		`use_enable gnome`
-		`use_enable tcpd tcp-wrappers`
-		`use_enable X x`"
-
-	# define this to skip building the other daemons ...
-	if use bacula-clientonly
-	then
-		myconf="${myconf} --enable-client-only"
-	fi
-
-	# select database support
-	if ! use bacula-clientonly
-	then
-		# mysql is the recomended choice ...
-		if use mysql
-		then
-			myconf="${myconf} --with-mysql=/usr"
-		elif use postgres
-		then
-			myconf="${myconf} --with-postgresql=/usr"
-		elif use sqlite
-		then
-			myconf="${myconf} --with-sqlite=/usr"
-		elif  use sqlite && use mysql
-		then
-			myconf="${myconf/--with-sqlite/}"
-		fi
-	fi
-
-	if use wxwindows
-	then
-	   myconf="${myconf} --enable-wx-console"
-	fi
-
-	if use readline
-	then
-	   myconf="${myconf} --enable-readline"
-	fi
-
-	if use gnome
-	then
-	myconf="${myconf} --enable-tray-monitor"
-	fi
-
-	./configure \
-		--enable-smartalloc \
-		--prefix=/usr \
-		--mandir=/usr/share/man \
-		--with-pid-dir=/var/run \
-		--sysconfdir=/etc/bacula \
-		--infodir=/usr/share/info \
-		--with-subsys-dir=/var/lock/subsys \
-		--with-working-dir=/var/bacula \
-		--with-scriptdir=/etc/bacula \
-		--with-dir-user=root \
-		--with-dir-group=bacula \
-		--with-sd-user=root \
-		--with-sd-group=bacula \
-		--with-fd-user=root \
-		--with-fd-group=bacula \
-		--host=${CHOST} ${myconf} || die "bad ./configure"
-
-	emake || die "compile problem"
-
-	# for the rescue package regardless of use static
-	cd ${S}/src/filed
-	make static-bacula-fd
-	cd ${S}
-
-	# make the docs
-	cd ${S}/doc/latex
-	make
-	cd ${S}
-
-	if use static
-	then
-		cd ${S}/src/console
-		make static-console
-		cd ${S}/src/dird
-		make static-bacula-dir
-		if use gnome
-		then
-		  cd ${S}/src/gnome-console
-		  make static-gnome-console
-		fi
-		if use wxwindows
-		then
-		  cd ${S}/src/wx-console
-		  make static-wx-console
-		fi
-		cd ${S}/src/stored
-		make static-bacula-sd
-	fi
+        # this resolves bug #181
+        epatch ${FILESDIR}/1.36.2-cdrecord-configure.patch
+
+        local myconf=""
+
+        myconf="
+                `use_enable readline`
+                `use_enable gnome`
+                `use_enable tcpd tcp-wrappers`
+                `use_enable X x`"
+
+        # define this to skip building the other daemons ...
+        if use bacula-clientonly
+        then
+                myconf="${myconf} --enable-client-only"
+        fi
+
+        # select database support
+        if ! use bacula-clientonly
+        then
+                # mysql is the recomended choice ...
+                if use mysql
+                then
+                        myconf="${myconf} --with-mysql=/usr"
+                elif use postgres
+                then
+                        myconf="${myconf} --with-postgresql=/usr"
+                elif use sqlite
+                then
+                        myconf="${myconf} --with-sqlite=/usr"
+                elif  use sqlite && use mysql
+                then
+                        myconf="${myconf/--with-sqlite/}"
+                fi
+        fi
+
+        if use wxwindows
+        then
+           myconf="${myconf} --enable-wx-console"
+        fi
+
+        if use readline
+        then
+           myconf="${myconf} --enable-readline"
+        fi
+
+        if use gnome
+        then
+        myconf="${myconf} --enable-tray-monitor"
+        fi
+
+        ./configure \
+                --enable-smartalloc \
+                --prefix=/usr \
+                --mandir=/usr/share/man \
+                --with-pid-dir=/var/run \
+                --sysconfdir=/etc/bacula \
+                --infodir=/usr/share/info \
+                --with-subsys-dir=/var/lock/subsys \
+                --with-working-dir=/var/bacula \
+                --with-scriptdir=/etc/bacula \
+                --with-dir-user=root \
+                --with-dir-group=bacula \
+                --with-sd-user=root \
+                --with-sd-group=bacula \
+                --with-fd-user=root \
+                --with-fd-group=bacula \
+                --host=${CHOST} ${myconf} || die "bad ./configure"
+
+        emake || die "compile problem"
+
+        # for the rescue package regardless of use static
+        cd ${S}/src/filed
+        make static-bacula-fd
+        cd ${S}
+
+        # make the docs
+        cd ${S}/doc/latex
+        make
+        cd ${S}
+
+        if use static
+        then
+                cd ${S}/src/console
+                make static-console
+                cd ${S}/src/dird
+                make static-bacula-dir
+                if use gnome
+                then
+                  cd ${S}/src/gnome-console
+                  make static-gnome-console
+                fi
+                if use wxwindows
+                then
+                  cd ${S}/src/wx-console
+                  make static-wx-console
+                fi
+                cd ${S}/src/stored
+                make static-bacula-sd
+        fi
 }
 
 src_install() {
-	make DESTDIR=${D} install || die
-
-	if use static
-	then
-		cd ${S}/src/filed
-		cp static-bacula-fd ${D}/usr/sbin/bacula-fd
-		cd ${S}/src/console
-		cp static-console ${D}/usr/sbin/console
-		cd ${S}/src/dird
-		cp static-bacula-dir ${D}/usr/sbin/bacula-dir
-		if use gnome
-		then
-			cd ${S}/src/gnome-console
-			cp static-gnome-console ${D}/usr/sbin/gnome-console
-		fi
-		if use wxwindows
-		then
-			cd ${S}/src/wx-console
-			cp static-wx-console ${D}/usr/sbin/wx-console
-		fi
-		cd ${S}/src/stored
-		cp static-bacula-sd ${D}/usr/sbin/bacula-sd
-	fi
-
-	# the menu stuff
-	if use gnome
-	then
-	mkdir -p ${D}/usr/share/pixmaps
-	mkdir -p ${D}/usr/share/applications
-	cp ${S}/scripts/bacula.png ${D}/usr/share/pixmaps/bacula.png
-	cp ${S}/scripts/bacula.desktop.gnome2.xsu ${D}/usr/share/applications/bacula.desktop
-	cp ${S}/src/tray-monitor/generic.xpm ${D}/usr/share/pixmaps/bacula-tray-monitor.xpm
-	cp ${S}/scripts/bacula-tray-monitor.desktop \
-		${D}/usr/share/applications/bacula-tray-monitor.desktop
-	chmod 755 ${D}/usr/sbin/bacula-tray-monitor
-	chmod 644 ${D}/etc/bacula/tray-monitor.conf
-	fi
-
-	if ! use bacula-clientonly
-	then
-		# the database update scripts
-		mkdir -p ${D}/etc/bacula/updatedb
-		cp ${S}/updatedb/* ${D}/etc/bacula/updatedb/
-		chmod 754 ${D}/etc/bacula/updatedb/*
-
-		# the logrotate configuration
-		mkdir -p ${D}/etc/logrotate.d
-		cp ${S}/scripts/logrotate ${D}/etc/logrotate.d/bacula
-		chmod 644 ${D}/etc/logrotate.d/bacula
-
-		# the logwatch scripts
-		mkdir -p ${D}/etc/log.d/conf/logfiles
-		mkdir -p ${D}/etc/log.d/conf/services
-		mkdir -p ${D}/etc/log.d/scripts/services
-		cp ${S}/scripts/logwatch/bacula ${D}/etc/log.d/scripts/services/bacula
-		cp ${S}/scripts/logwatch/logfile.bacula.conf ${D}/etc/log.d/conf/logfiles/bacula.conf
-		cp ${S}/scripts/logwatch/services.bacula.conf ${D}/etc/log.d/conf/services/bacula.conf
-		chmod 755 ${D}/etc/log.d/scripts/services/bacula
-		chmod 644 ${D}/etc/log.d/conf/logfiles/bacula.conf
-		chmod 644 ${D}/etc/log.d/conf/services/bacula.conf
-
-	fi
-
-	# the cdrom rescue package
-	mkdir -p ${D}/etc/bacula/rescue/cdrom
-	cp -R ${S}/rescue/linux/cdrom/* ${D}/etc/bacula/rescue/cdrom/
-	mkdir ${D}/etc/bacula/rescue/cdrom/bin
-	cp ${S}/src/filed/static-bacula-fd ${D}/etc/bacula/rescue/cdrom/bin/bacula-fd
-	chmod 754 ${D}/etc/bacula/rescue/cdrom/bin/bacula-fd
-
-	# documentation
-	for a in ${S}/{ChangeLog,README,ReleaseNotes,kernstodo,LICENSE,doc/latex/bacula.pdf}
-	do
-		dodoc $a
-	done
-
-	dohtml -r ${S}/doc/latex/bacula
-	
-	# clean up permissions left broken by install
-	chmod o-r ${D}/etc/bacula/query.sql
-
-	# remove the working dir so we can add it postinst with group
-	rmdir ${D}/var/bacula
-
-	# init scripts
-	exeinto /etc/init.d
-	if use bacula-clientonly
-	then
-		newexe ${S}/platforms/gentoo/bacula-fd bacula-fd
-	else
-		if use bacula-split
-		then
-			newexe ${S}/platforms/gentoo/bacula-fd bacula-fd
-			newexe ${S}/platforms/gentoo/bacula-sd bacula-sd
-			newexe ${S}/platforms/gentoo/bacula-dir bacula-dir
-		else
-			newexe ${S}/platforms/gentoo/bacula-init bacula
-		fi
-	fi
+        make DESTDIR=${D} install || die
+
+        if use static
+        then
+                cd ${S}/src/filed
+                cp static-bacula-fd ${D}/usr/sbin/bacula-fd
+                cd ${S}/src/console
+                cp static-console ${D}/usr/sbin/console
+                cd ${S}/src/dird
+                cp static-bacula-dir ${D}/usr/sbin/bacula-dir
+                if use gnome
+                then
+                        cd ${S}/src/gnome-console
+                        cp static-gnome-console ${D}/usr/sbin/gnome-console
+                fi
+                if use wxwindows
+                then
+                        cd ${S}/src/wx-console
+                        cp static-wx-console ${D}/usr/sbin/wx-console
+                fi
+                cd ${S}/src/stored
+                cp static-bacula-sd ${D}/usr/sbin/bacula-sd
+        fi
+
+        # the menu stuff
+        if use gnome
+        then
+        mkdir -p ${D}/usr/share/pixmaps
+        mkdir -p ${D}/usr/share/applications
+        cp ${S}/scripts/bacula.png ${D}/usr/share/pixmaps/bacula.png
+        cp ${S}/scripts/bacula.desktop.gnome2.xsu ${D}/usr/share/applications/bacula.desktop
+        cp ${S}/src/tray-monitor/generic.xpm ${D}/usr/share/pixmaps/bacula-tray-monitor.xpm
+        cp ${S}/scripts/bacula-tray-monitor.desktop \
+                ${D}/usr/share/applications/bacula-tray-monitor.desktop
+        chmod 755 ${D}/usr/sbin/bacula-tray-monitor
+        chmod 644 ${D}/etc/bacula/tray-monitor.conf
+        fi
+
+        if ! use bacula-clientonly
+        then
+                # the database update scripts
+                mkdir -p ${D}/etc/bacula/updatedb
+                cp ${S}/updatedb/* ${D}/etc/bacula/updatedb/
+                chmod 754 ${D}/etc/bacula/updatedb/*
+
+                # the logrotate configuration
+                mkdir -p ${D}/etc/logrotate.d
+                cp ${S}/scripts/logrotate ${D}/etc/logrotate.d/bacula
+                chmod 644 ${D}/etc/logrotate.d/bacula
+
+                # the logwatch scripts
+                mkdir -p ${D}/etc/log.d/conf/logfiles
+                mkdir -p ${D}/etc/log.d/conf/services
+                mkdir -p ${D}/etc/log.d/scripts/services
+                cp ${S}/scripts/logwatch/bacula ${D}/etc/log.d/scripts/services/bacula
+                cp ${S}/scripts/logwatch/logfile.bacula.conf ${D}/etc/log.d/conf/logfiles/bacula.conf
+                cp ${S}/scripts/logwatch/services.bacula.conf ${D}/etc/log.d/conf/services/bacula.conf
+                chmod 755 ${D}/etc/log.d/scripts/services/bacula
+                chmod 644 ${D}/etc/log.d/conf/logfiles/bacula.conf
+                chmod 644 ${D}/etc/log.d/conf/services/bacula.conf
+
+        fi
+
+        # the cdrom rescue package
+        mkdir -p ${D}/etc/bacula/rescue/cdrom
+        cp -R ${S}/rescue/linux/cdrom/* ${D}/etc/bacula/rescue/cdrom/
+        mkdir ${D}/etc/bacula/rescue/cdrom/bin
+        cp ${S}/src/filed/static-bacula-fd ${D}/etc/bacula/rescue/cdrom/bin/bacula-fd
+        chmod 754 ${D}/etc/bacula/rescue/cdrom/bin/bacula-fd
+
+        # documentation
+        for a in ${S}/{ChangeLog,README,ReleaseNotes,kernstodo,LICENSE,doc/latex/bacula.pdf}
+        do
+                dodoc $a
+        done
+
+        dohtml -r ${S}/doc/latex/bacula
+        
+        # clean up permissions left broken by install
+        chmod o-r ${D}/etc/bacula/query.sql
+
+        # remove the working dir so we can add it postinst with group
+        rmdir ${D}/var/bacula
+
+        # init scripts
+        exeinto /etc/init.d
+        if use bacula-clientonly
+        then
+                newexe ${S}/platforms/gentoo/bacula-fd bacula-fd
+        else
+                if use bacula-split
+                then
+                        newexe ${S}/platforms/gentoo/bacula-fd bacula-fd
+                        newexe ${S}/platforms/gentoo/bacula-sd bacula-sd
+                        newexe ${S}/platforms/gentoo/bacula-dir bacula-dir
+                else
+                        newexe ${S}/platforms/gentoo/bacula-init bacula
+                fi
+        fi
 }
 
 pkg_postinst() {
-	# create the daemon group
-	HAVE_BACULA=`cat /etc/group | grep bacula 2>/dev/null`
-	if [ -z $HAVE_BACULA ]; then
-	enewgroup bacula
-	einfo
-	einfo "The group bacula has been created. Any users you add to"
-	einfo "this group have access to files created by the daemons."
-	fi
-
-	# the working directory
-	install -m0750 -o root -g bacula -d ${ROOT}/var/bacula
-
-	# link installed bacula-fd.conf into rescue directory
-	#ln -s /etc/bacula/bacula-fd.conf /etc/bacula/rescue/cdrom/bacula-fd.conf
-	# no longer necessary after 1.36.2
-
-	einfo
-	einfo "The CDRom rescue disk package has been installed into the"
-	einfo "/etc/bacula/rescue/cdrom/ directory. Please examine the manual"
-	einfo "for information on creating a rescue CD. CDR device detection"
-	einfo "during build has been disabled to prevent sandbox violations."
-	einfo "You need to examine /etc/bacula/rescue/cdrom/Makefile and adjust"
-	einfo "the device information for your CD recorder."
-	einfo
-
-	if ! use bacula-clientonly; then
-	einfo
-	einfo "Please note either/or nature of database USE flags for"
-	einfo "Bacula.  If mysql is set, it will be used, else postgres"
-	einfo "else finally SQLite.  If you wish to have multiple DBs on"
-	einfo "one system, you may wish to unset auxillary DBs for this"
-	einfo "build."
-	einfo
-
-	if use mysql
-	then
-	# test for an existing database
-	# note: this ASSUMES no password has been set for bacula database
-	DB_VER=`mysql 2>/dev/null bacula -e 'select * from Version;'|tail -n 1`
-		if [ -z "$DB_VER" ]; then
-		einfo "This appears to be a new install and you plan to use mysql"
-		einfo "for your catalog database. You should now create it by doing"
-		einfo "these commands:"
-		einfo " sh /etc/bacula/grant_mysql_privileges"
-		einfo " sh /etc/bacula/create_mysql_database"
-		einfo " sh /etc/bacula/make_mysql_tables"
-		elif [ "$DB_VER" -lt "8" ]; then
-		elinfo "This release requires an upgrade to your bacula database"
-		einfo "as the database format has changed.  Please read the"
-		einfo "manual chapter for how to upgrade your database!!!"
-		einfo
-		einfo "Backup your database with the command:"
-		einfo " mysqldump -f --opt bacula | bzip2 > /var/bacula/bacula_backup.sql.bz"
-		einfo
-		einfo "Then update your database using the scripts found in"
-		einfo "/etc/bacula/updatedb/ from your current version $DB_VER to"
-		einfo "version 8. Note that scripts must be run in order from your"
-		einfo "version to the current version."
-		fi
-	fi
-
-	if use postgres
-	then
-	# test for an existing database
-	# note: this ASSUMES no password has been set for bacula database
-	DB_VER=`echo 'select * from Version;' | psql bacula 2>/dev/null | tail -3 | head -1`
-		if [ -z "$DB_VER" ]; then
-		einfo "This appears to be a new install and you plan to use postgresql"
-		einfo "for your catalog database. You should now create it by doing"
-		einfo "these commands:"
-		einfo " sh /etc/bacula/create_postgresql_database"
-		einfo " sh /etc/bacula/make_postgresql_tables"
-		einfo " sh /etc/bacula/grant_postgresql_privileges"
-		elif [ "$DB_VER" -lt "8" ]; then
-		elinfo "This release requires an upgrade to your bacula database"
-		einfo "as the database format has changed.  Please read the"
-		einfo "manual chapter for how to upgrade your database!!!"
-		einfo
-		einfo "Backup your database with the command:"
-		einfo " pg_dump bacula | bzip2 > /var/bacula/bacula_backup.sql.bz2"
-		einfo
-		einfo "Then update your database using the scripts found in"
-		einfo "/etc/bacula/updatedb/ from your current version $DB_VER to"
-		einfo "version 8. Note that scripts must be run in order from your"
-		einfo "version to the current version."
-		fi
-	fi
-
-	if use sqlite
-	then
-	# test for an existing database
-	# note: this ASSUMES no password has been set for bacula database
-	DB_VER=`echo "select * from Version;" | sqlite 2>/dev/null /var/bacula/bacula.db | tail -n 1`
-		if [ -z "$DB_VER" ]; then
-		einfo "This appears to be a new install and you plan to use sqlite"
-		einfo "for your catalog database. You should now create it by doing"
-		einfo "these commands:"
-		einfo " sh /etc/bacula/grant_sqlite_privileges"
-		einfo " sh /etc/bacula/create_sqlite_database"
-		einfo " sh /etc/bacula/make_sqlite_tables"
-		elif [ "$DB_VER" -lt "8" ]; then
-		elinfo "This release requires an upgrade to your bacula database"
-		einfo "as the database format has changed.  Please read the"
-		einfo "manual chapter for how to upgrade your database!!!"
-		einfo
-		einfo "Backup your database with the command:"
-		einfo " echo .dump | sqlite /var/bacula/bacula.db | bzip2 > \\"
-		einfo "   /var/bacula/bacula_backup.sql.bz2"
-		einfo
-		einfo "Then update your database using the scripts found in"
-		einfo "/etc/bacula/updatedb/ from your current version $DB_VER to"
-		einfo "version 8. Note that scripts must be run in order from your"
-		einfo "version to the current version."
-		fi
-	fi
-	fi
-
-	einfo
-	einfo "Review your configuration files in /etc/bacula and"
-	einfo "start the daemons:"
-	if use bacula-clientonly; then
-		einfo " /etc/init.d/bacula-fd start"
-	else
-		if use bacula-split; then
-		einfo " /etc/init.d/bacula-sd start"
-		einfo " /etc/init.d/bacula-dir start"
-		einfo " /etc/init.d/bacula-fd start"
-		einfo " or /etc/bacula/bacula will start all three."
-		else
-		einfo " /etc/init.d/bacula start"
-		fi
-	fi
-	einfo
-	einfo "You may also wish to:"
-	if use bacula-clientonly; then
-		einfo " rc-update add bacula-fd default"
-	else
-		if use bacula-split; then
-			einfo " rc-update add bacula-sd default"
-			einfo " rc-update add bacula-dir default"
-			einfo " rc-update add bacula-fd default"
-		else
-			einfo " rc-update add bacula default"
-		fi
-	fi
-	einfo
+        # create the daemon group
+        HAVE_BACULA=`cat /etc/group | grep bacula 2>/dev/null`
+        if [ -z $HAVE_BACULA ]; then
+        enewgroup bacula
+        einfo
+        einfo "The group bacula has been created. Any users you add to"
+        einfo "this group have access to files created by the daemons."
+        fi
+
+        # the working directory
+        install -m0750 -o root -g bacula -d ${ROOT}/var/bacula
+
+        # link installed bacula-fd.conf into rescue directory
+        #ln -s /etc/bacula/bacula-fd.conf /etc/bacula/rescue/cdrom/bacula-fd.conf
+        # no longer necessary after 1.36.2
+
+        einfo
+        einfo "The CDRom rescue disk package has been installed into the"
+        einfo "/etc/bacula/rescue/cdrom/ directory. Please examine the manual"
+        einfo "for information on creating a rescue CD. CDR device detection"
+        einfo "during build has been disabled to prevent sandbox violations."
+        einfo "You need to examine /etc/bacula/rescue/cdrom/Makefile and adjust"
+        einfo "the device information for your CD recorder."
+        einfo
+
+        if ! use bacula-clientonly; then
+        einfo
+        einfo "Please note either/or nature of database USE flags for"
+        einfo "Bacula.  If mysql is set, it will be used, else postgres"
+        einfo "else finally SQLite.  If you wish to have multiple DBs on"
+        einfo "one system, you may wish to unset auxillary DBs for this"
+        einfo "build."
+        einfo
+
+        if use mysql
+        then
+        # test for an existing database
+        # note: this ASSUMES no password has been set for bacula database
+        DB_VER=`mysql 2>/dev/null bacula -e 'select * from Version;'|tail -n 1`
+                if [ -z "$DB_VER" ]; then
+                einfo "This appears to be a new install and you plan to use mysql"
+                einfo "for your catalog database. You should now create it by doing"
+                einfo "these commands:"
+                einfo " sh /etc/bacula/grant_mysql_privileges"
+                einfo " sh /etc/bacula/create_mysql_database"
+                einfo " sh /etc/bacula/make_mysql_tables"
+                elif [ "$DB_VER" -lt "8" ]; then
+                elinfo "This release requires an upgrade to your bacula database"
+                einfo "as the database format has changed.  Please read the"
+                einfo "manual chapter for how to upgrade your database!!!"
+                einfo
+                einfo "Backup your database with the command:"
+                einfo " mysqldump -f --opt bacula | bzip2 > /var/bacula/bacula_backup.sql.bz"
+                einfo
+                einfo "Then update your database using the scripts found in"
+                einfo "/etc/bacula/updatedb/ from your current version $DB_VER to"
+                einfo "version 8. Note that scripts must be run in order from your"
+                einfo "version to the current version."
+                fi
+        fi
+
+        if use postgres
+        then
+        # test for an existing database
+        # note: this ASSUMES no password has been set for bacula database
+        DB_VER=`echo 'select * from Version;' | psql bacula 2>/dev/null | tail -3 | head -1`
+                if [ -z "$DB_VER" ]; then
+                einfo "This appears to be a new install and you plan to use postgresql"
+                einfo "for your catalog database. You should now create it by doing"
+                einfo "these commands:"
+                einfo " sh /etc/bacula/create_postgresql_database"
+                einfo " sh /etc/bacula/make_postgresql_tables"
+                einfo " sh /etc/bacula/grant_postgresql_privileges"
+                elif [ "$DB_VER" -lt "8" ]; then
+                elinfo "This release requires an upgrade to your bacula database"
+                einfo "as the database format has changed.  Please read the"
+                einfo "manual chapter for how to upgrade your database!!!"
+                einfo
+                einfo "Backup your database with the command:"
+                einfo " pg_dump bacula | bzip2 > /var/bacula/bacula_backup.sql.bz2"
+                einfo
+                einfo "Then update your database using the scripts found in"
+                einfo "/etc/bacula/updatedb/ from your current version $DB_VER to"
+                einfo "version 8. Note that scripts must be run in order from your"
+                einfo "version to the current version."
+                fi
+        fi
+
+        if use sqlite
+        then
+        # test for an existing database
+        # note: this ASSUMES no password has been set for bacula database
+        DB_VER=`echo "select * from Version;" | sqlite 2>/dev/null /var/bacula/bacula.db | tail -n 1`
+                if [ -z "$DB_VER" ]; then
+                einfo "This appears to be a new install and you plan to use sqlite"
+                einfo "for your catalog database. You should now create it by doing"
+                einfo "these commands:"
+                einfo " sh /etc/bacula/grant_sqlite_privileges"
+                einfo " sh /etc/bacula/create_sqlite_database"
+                einfo " sh /etc/bacula/make_sqlite_tables"
+                elif [ "$DB_VER" -lt "8" ]; then
+                elinfo "This release requires an upgrade to your bacula database"
+                einfo "as the database format has changed.  Please read the"
+                einfo "manual chapter for how to upgrade your database!!!"
+                einfo
+                einfo "Backup your database with the command:"
+                einfo " echo .dump | sqlite /var/bacula/bacula.db | bzip2 > \\"
+                einfo "   /var/bacula/bacula_backup.sql.bz2"
+                einfo
+                einfo "Then update your database using the scripts found in"
+                einfo "/etc/bacula/updatedb/ from your current version $DB_VER to"
+                einfo "version 8. Note that scripts must be run in order from your"
+                einfo "version to the current version."
+                fi
+        fi
+        fi
+
+        einfo
+        einfo "Review your configuration files in /etc/bacula and"
+        einfo "start the daemons:"
+        if use bacula-clientonly; then
+                einfo " /etc/init.d/bacula-fd start"
+        else
+                if use bacula-split; then
+                einfo " /etc/init.d/bacula-sd start"
+                einfo " /etc/init.d/bacula-dir start"
+                einfo " /etc/init.d/bacula-fd start"
+                einfo " or /etc/bacula/bacula will start all three."
+                else
+                einfo " /etc/init.d/bacula start"
+                fi
+        fi
+        einfo
+        einfo "You may also wish to:"
+        if use bacula-clientonly; then
+                einfo " rc-update add bacula-fd default"
+        else
+                if use bacula-split; then
+                        einfo " rc-update add bacula-sd default"
+                        einfo " rc-update add bacula-dir default"
+                        einfo " rc-update add bacula-fd default"
+                else
+                        einfo " rc-update add bacula default"
+                fi
+        fi
+        einfo
 }
diff --git a/platforms/hurd/Makefile.in b/platforms/hurd/Makefile.in
index c8f392e..9f27248 100644
--- a/platforms/hurd/Makefile.in
+++ b/platforms/hurd/Makefile.in
@@ -1,4 +1,7 @@
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # This file is used as the template to create the
 # Makefile for the Debian GNU Hurd specific installation.
 #
diff --git a/platforms/hurd/bacula-dir.in b/platforms/hurd/bacula-dir.in
index 88c13a3..8c4535a 100644
--- a/platforms/hurd/bacula-dir.in
+++ b/platforms/hurd/bacula-dir.in
@@ -1,5 +1,8 @@
 #! /bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula  This shell script takes care of starting and stopping
 #	  the bacula Director daemon on Debian GNU Hurd systems.
 #
@@ -47,6 +50,7 @@ if [ "x${BUSER}" != "x" ]; then
    fi
 fi
 
+RETVAL=0
 case "$1" in
    start)
       echo -n "Starting ${DESC}: "
@@ -64,6 +68,7 @@ case "$1" in
       $0 stop
       sleep 5
       $0 start
+      RETVAL=$?
       ;;
    *)
       echo "Usage: /etc/init.d/${NAME} {start|stop|restart|force-reload}" >&2
diff --git a/platforms/hurd/bacula-fd.in b/platforms/hurd/bacula-fd.in
index 270950a..b2578c5 100644
--- a/platforms/hurd/bacula-fd.in
+++ b/platforms/hurd/bacula-fd.in
@@ -1,5 +1,8 @@
 #! /bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula  This shell script takes care of starting and stopping
 #	  the bacula Director daemon on Debian GNU Hurd systems.
 #
@@ -47,6 +50,7 @@ if [ "x${BUSER}" != "x" ]; then
    fi
 fi
 
+RETVAL=0
 case "$1" in
    start)
       echo -n "Starting ${DESC}: "
@@ -64,6 +68,7 @@ case "$1" in
       $0 stop
       sleep 5
       $0 start
+      RETVAL=$?
       ;;
    *)
       echo "Usage: /etc/init.d/${NAME} {start|stop|restart|force-reload}" >&2
diff --git a/platforms/hurd/bacula-sd.in b/platforms/hurd/bacula-sd.in
index ff1ad29..2892078 100644
--- a/platforms/hurd/bacula-sd.in
+++ b/platforms/hurd/bacula-sd.in
@@ -1,5 +1,8 @@
 #! /bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula  This shell script takes care of starting and stopping
 #	  the bacula Director daemon on Debian GNU Hurd systems.
 #
@@ -47,6 +50,7 @@ if [ "x${BUSER}" != "x" ]; then
    fi
 fi
 
+RETVAL=0
 case "$1" in
    start)
       echo -n "Starting ${DESC}: "
@@ -64,6 +68,7 @@ case "$1" in
       $0 stop
       sleep 5
       $0 start
+      RETVAL=$?
       ;;
    *)
       echo "Usage: /etc/init.d/${NAME} {start|stop|restart|force-reload}" >&2
diff --git a/platforms/irix/Makefile.in b/platforms/irix/Makefile.in
index 88b188b..ac0250d 100644
--- a/platforms/irix/Makefile.in
+++ b/platforms/irix/Makefile.in
@@ -1,3 +1,6 @@
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 # 
 # This file is used as the template to create the
 # Makefile for the Solaris specific installation.
diff --git a/platforms/irix/bacula-dir.in b/platforms/irix/bacula-dir.in
index af7b0c5..78dde03 100755
--- a/platforms/irix/bacula-dir.in
+++ b/platforms/irix/bacula-dir.in
@@ -1,5 +1,8 @@
 #! /bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula       This shell script takes care of starting and stopping
 #	       the bacula Director daemon
 #
@@ -29,10 +32,11 @@ case "$1" in
        $0 stop
        sleep 5
        $0 start
+       RETVAL=$?
        ;;
     *)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
        ;;
 esac
-exit 0
+exit $RETVAL
diff --git a/platforms/irix/bacula-fd.in b/platforms/irix/bacula-fd.in
index 671eb4b..678d4af 100755
--- a/platforms/irix/bacula-fd.in
+++ b/platforms/irix/bacula-fd.in
@@ -1,5 +1,8 @@
 #! /bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula       This shell script takes care of starting and stopping
 #	       the bacula File daemon.
 #
@@ -9,6 +12,7 @@
 #  For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@
 #
 
+RETVAL=0
 case "$1" in
     'start')
        echo "Starting the Bacula File daemon: "
@@ -30,10 +34,11 @@ case "$1" in
        $0 stop
        sleep 5
        $0 start
+       RETVAL=$?
        ;;
     *)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
        ;;
 esac
-exit 0
+exit $RETVAL
diff --git a/platforms/irix/bacula-sd.in b/platforms/irix/bacula-sd.in
index 9f4e6f0..7aafe60 100755
--- a/platforms/irix/bacula-sd.in
+++ b/platforms/irix/bacula-sd.in
@@ -1,5 +1,8 @@
 #! /bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula       This shell script takes care of starting and stopping
 #	       the bacula Storage daemon.
 #
@@ -9,6 +12,7 @@
 #  For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@
 #
 
+RETVAL=0
 case "$1" in
     start)
        echo "Starting the Bacula Storage daemon: "
@@ -28,10 +32,11 @@ case "$1" in
        $0 stop
        sleep 5
        $0 start
+       RETVAL=$?
        ;;
     *)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
        ;;
 esac
-exit 0
+exit $RETVAL
diff --git a/platforms/mandrake/Makefile.in b/platforms/mandrake/Makefile.in
index 1d43bbb..7a80062 100644
--- a/platforms/mandrake/Makefile.in
+++ b/platforms/mandrake/Makefile.in
@@ -1,3 +1,6 @@
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 # 
 # This file is used as the template to create the
 # Makefile for the Mandrake specific installation.
diff --git a/platforms/mandrake/bacula-dir.in b/platforms/mandrake/bacula-dir.in
index 4312446..e1f7bdb 100755
--- a/platforms/mandrake/bacula-dir.in
+++ b/platforms/mandrake/bacula-dir.in
@@ -1,5 +1,8 @@
 #! /bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula       This shell script takes care of starting and stopping
 #	       the bacula Director daemon
 #
@@ -32,6 +35,7 @@ case "$1" in
        $0 stop
        sleep 5
        $0 start
+       RETVAL=$?
        ;;
     status)
        status @sbindir@/bacula-dir
@@ -41,4 +45,4 @@ case "$1" in
        exit 1
        ;;
 esac
-exit 0
+exit $RETVAL
diff --git a/platforms/mandrake/bacula-fd.in b/platforms/mandrake/bacula-fd.in
index c447fb1..2b7ff01 100755
--- a/platforms/mandrake/bacula-fd.in
+++ b/platforms/mandrake/bacula-fd.in
@@ -1,5 +1,8 @@
 #! /bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula       This shell script takes care of starting and stopping
 #	       the bacula File daemon.
 #
@@ -12,6 +15,7 @@
 # Source function library
 . /etc/rc.d/init.d/functions
 
+RETVAL=0
 case "$1" in
     start)
        echo -n "Starting the Bacula File daemon: "
@@ -31,6 +35,7 @@ case "$1" in
        $0 stop
        sleep 5
        $0 start
+       RETVAL=$?
        ;;
     status)
        status @sbindir@/bacula-fd
@@ -40,4 +45,4 @@ case "$1" in
        exit 1
        ;;
 esac
-exit 0
+exit $RETVAL
diff --git a/platforms/mandrake/bacula-sd.in b/platforms/mandrake/bacula-sd.in
index f0144dd..61de07b 100755
--- a/platforms/mandrake/bacula-sd.in
+++ b/platforms/mandrake/bacula-sd.in
@@ -1,5 +1,8 @@
 #! /bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula       This shell script takes care of starting and stopping
 #	       the bacula Storage daemon.
 #
@@ -12,6 +15,7 @@
 # Source function library
 . /etc/rc.d/init.d/functions
 
+RETVAL=0
 case "$1" in
     start)
        echo -n "Starting the Bacula Storage daemon: "
@@ -31,6 +35,7 @@ case "$1" in
        $0 stop
        sleep 5
        $0 start
+       RETVAL=$?
        ;;
     status)
        status @sbindir@/bacula-sd
@@ -40,4 +45,4 @@ case "$1" in
        exit 1
        ;;
 esac
-exit 0
+exit $RETVAL
diff --git a/platforms/mandrake/bacula.spec.bluca.in b/platforms/mandrake/bacula.spec.bluca.in
index 8f596c2..01ac131 100644
--- a/platforms/mandrake/bacula.spec.bluca.in
+++ b/platforms/mandrake/bacula.spec.bluca.in
@@ -20,7 +20,7 @@ Name: %{name}
 Version: %{version}
 Release: %{release}
 Group: Archiving/Backup
-License: GPL
+License: BSD 2-Clause; see file LICENSE-FOSS
 Source: http://www.prdownloads.sourceforge.net/bacula/%{name}-%{version}.tar.bz2
 Source1: %{name}-icons.tar.bz2
 BuildRoot: %{_tmppath}/%{name}-root
diff --git a/platforms/openbsd/Makefile.in b/platforms/openbsd/Makefile.in
index 5a84037..d228a8b 100644
--- a/platforms/openbsd/Makefile.in
+++ b/platforms/openbsd/Makefile.in
@@ -1,3 +1,6 @@
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 # 
 # This file is used as the template to create the
 # Makefile for the Solaris specific installation.
diff --git a/platforms/openbsd/bacula-dir.in b/platforms/openbsd/bacula-dir.in
index af7b0c5..78dde03 100755
--- a/platforms/openbsd/bacula-dir.in
+++ b/platforms/openbsd/bacula-dir.in
@@ -1,5 +1,8 @@
 #! /bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula       This shell script takes care of starting and stopping
 #	       the bacula Director daemon
 #
@@ -29,10 +32,11 @@ case "$1" in
        $0 stop
        sleep 5
        $0 start
+       RETVAL=$?
        ;;
     *)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
        ;;
 esac
-exit 0
+exit $RETVAL
diff --git a/platforms/openbsd/bacula-fd.in b/platforms/openbsd/bacula-fd.in
index 2c41b34..e98f7ad 100755
--- a/platforms/openbsd/bacula-fd.in
+++ b/platforms/openbsd/bacula-fd.in
@@ -1,5 +1,8 @@
 #! /bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula       This shell script takes care of starting and stopping
 #	       the bacula File daemon.
 #
@@ -9,6 +12,7 @@
 #  For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@
 #
 
+RETVAL=0
 case "$1" in
     start)
        echo "Starting the Bacula File daemon: "
@@ -28,10 +32,11 @@ case "$1" in
        $0 stop
        sleep 5
        $0 start
+       RETVAL=$?
        ;;
     *)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
        ;;
 esac
-exit 0
+exit $RETVAL
diff --git a/platforms/openbsd/bacula-sd.in b/platforms/openbsd/bacula-sd.in
index 9f4e6f0..7aafe60 100755
--- a/platforms/openbsd/bacula-sd.in
+++ b/platforms/openbsd/bacula-sd.in
@@ -1,5 +1,8 @@
 #! /bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula       This shell script takes care of starting and stopping
 #	       the bacula Storage daemon.
 #
@@ -9,6 +12,7 @@
 #  For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@
 #
 
+RETVAL=0
 case "$1" in
     start)
        echo "Starting the Bacula Storage daemon: "
@@ -28,10 +32,11 @@ case "$1" in
        $0 stop
        sleep 5
        $0 start
+       RETVAL=$?
        ;;
     *)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
        ;;
 esac
-exit 0
+exit $RETVAL
diff --git a/platforms/osx/Makefile.in b/platforms/osx/Makefile.in
index b0de11f..f62e031 100644
--- a/platforms/osx/Makefile.in
+++ b/platforms/osx/Makefile.in
@@ -1,4 +1,7 @@
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # This is the makefile template for the platform directory
 # which contains general platform installation.
 #
@@ -39,8 +42,8 @@ BACULA_FD_CONF:=/Library/Preferences/bacula/bacula-fd.conf
 BACULA_WORKING_DIR:=/private/var/bacula/working
 BACULA_PMDOC:=${WORKING_DIR}/installer.pmdoc
 
-# Detect whether we sit inside the bacula source tree. In this case we won't
-# download the tar from sourceforge but instead work with what its there
+# Detect whether we sit inside the Bacula source tree. In this case we won't
+# download the tar from sourceforge but instead work with what is there
 # already
 CURSUB:=$(CURDIR:%/platforms/osx=%)
 ifneq ($(CURDIR),$(CURSUB))
@@ -58,12 +61,18 @@ PACKAGE_RESOURCES:=ReadMe.html postflight preupgrade
 PACKAGE_XRESOURCES:=postflight preupgrade
 
 # Flags for the toolchain
-CONFIGFLAGS:=--enable-client-only --prefix=${BACULA_PREFIX} \
-    --with-dir-password=@DIR_PW@ --with-fd-password=@FD_PW@ \
-    --with-sd-password=@SD_PW@ --with-mon-dir-password=@MON_DIR_PW@ \
-    --with-mon-fd-password=@MON_FD_PW@ --with-mon-sd-password=@MON_SD_PW@ \
-    --with-basename=@BASENAME@ --with-hostname=@HOSTNAME@ \
-    --with-working-dir=${BACULA_WORKING_DIR}
+CONFIGFLAGS:= \
+  --enable-client-only \
+  --prefix=${BACULA_PREFIX} \
+  --with-dir-password=@DIR_PW@ \
+  --with-fd-password=@FD_PW@ \
+  --with-sd-password=@SD_PW@ \
+  --with-mon-dir-password=@MON_DIR_PW@ \
+  --with-mon-fd-password=@MON_FD_PW@ \
+  --with-mon-sd-password=@MON_SD_PW@ \
+  --with-basename=@BASENAME@ \
+  --with-hostname=@HOSTNAME@ \
+  --with-working-dir=${BACULA_WORKING_DIR}
 CPPFLAGS:=-isysroot ${MACOSX_SDK_SYSROOT} ${MACOSX_VERSION_FLAGS}
 CFLAGS:=-O -g ${ARCHFLAGS}
 CXXFLAGS:=${CFLAGS}
@@ -134,8 +143,8 @@ ${BACULA_DESTDIR}: ${BACULA_SOURCE}
 	done
 
 	mkdir -p "${BACULA_DESTDIR}${BACULA_PREFIX}/Library/LaunchDaemons"
-	sed ${INFILE_SUBST} files/org.bacula.bacula-fd.plist.in \
-		> "${BACULA_DESTDIR}${BACULA_PREFIX}/Library/LaunchDaemons/org.bacula.bacula-fd.plist"
+	sed ${INFILE_SUBST} files/com.baculasystems.bacula-fd.plist.in \
+		> "${BACULA_DESTDIR}${BACULA_PREFIX}/Library/LaunchDaemons/com.baculasystems.bacula-fd.plist"
 
 ${BACULA_SOURCE}: ${BACULA_TAR}
 	mkdir -p "${WORKING_DIR}"
@@ -152,4 +161,3 @@ distclean: clean
 .PHONY: clean
 clean:
 	rm -rf "${BUILD_DIR}" "${PACKAGE_DIR}" "${PACKAGE_DMG}"
-
diff --git a/platforms/osx/README b/platforms/osx/README
index 44813d1..4b1391d 100644
--- a/platforms/osx/README
+++ b/platforms/osx/README
@@ -2,10 +2,10 @@ Bacula file daemon package builder for Mac OS X
 ===============================================
 
 This package build script lets you download, compile and package the bacula
-file daemon easily with a single command line. Beside the bacula file daemon
+file daemon easily with a single command line. In addition to the Bacula file daemon
 the resulting installer package contains a short ReadMe file with instructions
 on how to install and use the software. Also a basic launchd property list is
-included along with preugrade and postflight installer scripts to stop and
+included along with preupgrade and postflight installer scripts to stop and
 restart the daemon while upgrading. To ensure the security of the users the
 passwords in the configuration files are generated during a first time
 installation and file permissions are checked and corrected on upgrades.
@@ -14,7 +14,7 @@ Requirements:
 * Mac OS X 10.5 or later (building/packaging), 10.4 or later (deployment)
 * Mac OS X developer tools installed
 
-Example (compile and create package from within bacula source tree):
+Example (compile and create package from within Bacula source tree):
 $ ./configure --enable-client-only
 $ make -C platforms/osx
 
diff --git a/platforms/redhat/Makefile.in b/platforms/redhat/Makefile.in
index 0c2d5e6..2cd8f1d 100644
--- a/platforms/redhat/Makefile.in
+++ b/platforms/redhat/Makefile.in
@@ -1,3 +1,6 @@
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 # 
 # This file is used as the template to create the
 # Makefile for the RedHat specific installation.
diff --git a/platforms/redhat/bacula-dir.in b/platforms/redhat/bacula-dir.in
index 0603856..a36d4a4 100755
--- a/platforms/redhat/bacula-dir.in
+++ b/platforms/redhat/bacula-dir.in
@@ -1,5 +1,8 @@
 #! /bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula       This shell script takes care of starting and stopping
 #	       the bacula Director daemon
 #
@@ -12,6 +15,8 @@
 # Source function library
 . /etc/rc.d/init.d/functions
 
+DAEMON_OPTIONS=''
+DAEMON_USER='yes'
 DIR_USER=@dir_user@
 DIR_GROUP=@dir_group@
 DIR_OPTIONS=''
@@ -22,7 +27,7 @@ if [ -d "/lib/tls" -a $OS = "Linux" -a `uname -r | cut -c1-3` = "2.4" ] ; then
      export LD_ASSUME_KERNEL=2.4.19
 fi
 
-# pull in any user defined DIR_DIR_OPTIONS, DIR_USER, or DIR_GROUP
+# pull in any user defined DIR_DIR_OPTIONS, DIR_USER, DIR_GROUP or DAEMON_USER
 [ -f /etc/sysconfig/bacula ] && . /etc/sysconfig/bacula
 
 #
@@ -41,8 +46,18 @@ case "$1" in
        if [ "${DIR_GROUP}" != '' ]; then
 	  DIR_OPTIONS="${DIR_OPTIONS} -g ${DIR_GROUP}"
        fi
+
+       if [ "${DAEMON_USER}" != '' -a "${DIR_USER}" != '' ]; then
+	  DIR_OPTIONS=""
+	  if [ "${DIR_GROUP}" != '' ]; then
+	     chown ${DIR_USER}:${DIR_GROUP} @working_dir@/bacula-dir* 2> /dev/null
+	  else 
+	     chown ${DIR_USER} @working_dir@/bacula-dir* 2> /dev/null
+	  fi
+	  DAEMON_OPTIONS="--user ${DIR_USER}"
+       fi
        echo -n "Starting Bacula Director services: "
-       daemon @sbindir@/bacula-dir $2 ${DIR_OPTIONS} -c @sysconfdir@/bacula-dir.conf
+       daemon $DAEMON_OPTIONS @sbindir@/bacula-dir $2 ${DIR_OPTIONS} -c @sysconfdir@/bacula-dir.conf
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch @subsysdir@/bacula-dir
@@ -58,6 +73,7 @@ case "$1" in
        $0 stop
        sleep 5
        $0 start
+       RETVAL=$?
        ;;
     status)
        status @sbindir@/bacula-dir
diff --git a/platforms/redhat/bacula-fd.in b/platforms/redhat/bacula-fd.in
index ba94453..72a897a 100755
--- a/platforms/redhat/bacula-fd.in
+++ b/platforms/redhat/bacula-fd.in
@@ -1,5 +1,8 @@
 #! /bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula       This shell script takes care of starting and stopping
 #	       the bacula File daemon.
 #
@@ -12,6 +15,8 @@
 # Source function library
 . /etc/rc.d/init.d/functions
 
+DAEMON_OPTIONS=''
+DAEMON_USER='yes'
 FD_USER=@fd_user@
 FD_GROUP=@fd_group@
 FD_OPTIONS=''
@@ -41,8 +46,19 @@ case "$1" in
        if [ "${FD_GROUP}" != '' ]; then
 	  FD_OPTIONS="${FD_OPTIONS} -g ${FD_GROUP}"
        fi
+
+       if [ "${DAEMON_USER}" != '' -a "${FD_USER}" != '' ]; then
+	  FD_OPTIONS=""
+	  if [ "${FD_GROUP}" != '' ]; then
+	     chown ${FD_USER}:${FD_GROUP} @working_dir@/bacula-fd* 2> /dev/null
+	  else 
+	     chown ${FD_USER} @working_dir@/bacula-fd* 2> /dev/null
+	  fi
+	  DAEMON_OPTIONS="--user ${FD_USER}"
+       fi
+
        echo -n "Starting Bacula File services: "
-       daemon @sbindir@/bacula-fd $2 ${FD_OPTIONS} -c @sysconfdir@/bacula-fd.conf
+       daemon ${DAEMON_OPTIONS} @sbindir@/bacula-fd $2 ${FD_OPTIONS} -c @sysconfdir@/bacula-fd.conf
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch @subsysdir@/bacula-fd
@@ -58,6 +74,7 @@ case "$1" in
        $0 stop
        sleep 5
        $0 start
+       RETVAL=$?
        ;;
     status)
        status @sbindir@/bacula-fd
diff --git a/platforms/redhat/bacula-sd.in b/platforms/redhat/bacula-sd.in
index ab5d873..d8c3440 100755
--- a/platforms/redhat/bacula-sd.in
+++ b/platforms/redhat/bacula-sd.in
@@ -1,5 +1,8 @@
 #! /bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula       This shell script takes care of starting and stopping
 #	       the bacula Storage daemon.
 #
@@ -12,6 +15,8 @@
 # Source function library
 . /etc/rc.d/init.d/functions
 
+DAEMON_OPTIONS=''
+DAEMON_USER=yes
 SD_USER=@sd_user@
 SD_GROUP=@sd_group@
 SD_OPTIONS=''
@@ -22,7 +27,7 @@ if [ -d "/lib/tls" -a $OS = "Linux" -a `uname -r | cut -c1-3` = "2.4" ] ; then
      export LD_ASSUME_KERNEL=2.4.19
 fi
 
-# pull in any user defined SD_OPTIONS, SD_USER, or SD_GROUP
+# pull in any user defined SD_OPTIONS, SD_USER, SD_GROUP or DAEMON_USER
 [ -f /etc/sysconfig/bacula ] && . /etc/sysconfig/bacula
 
 #
@@ -41,9 +46,19 @@ case "$1" in
        if [ "${SD_GROUP}" != '' ]; then
 	  SD_OPTIONS="${SD_OPTIONS} -g ${SD_GROUP}"
        fi
-										      
+
+       if [ "${DAEMON_USER}" != '' -a "${SD_USER}" != '' ]; then
+	  SD_OPTIONS=""
+	  if [ "${SD_GROUP}" != '' ]; then
+	     chown ${SD_USER}:${SD_GROUP} @working_dir@/bacula-sd* 2> /dev/null
+	  else 
+	     chown ${SD_USER} @working_dir@/bacula-sd* 2> /dev/null
+	  fi
+	  DAEMON_OPTIONS="--user ${SD_USER}"
+       fi
+
        echo -n "Starting Bacula Storage services: "
-       daemon @sbindir@/bacula-sd $2 ${SD_OPTIONS} -c @sysconfdir@/bacula-sd.conf
+       daemon $DAEMON_OPTIONS @sbindir@/bacula-sd $2 ${SD_OPTIONS} -c @sysconfdir@/bacula-sd.conf
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch @subsysdir@/bacula-sd
@@ -59,6 +74,7 @@ case "$1" in
        $0 stop
        sleep 5
        $0 start
+       RETVAL=$?
        ;;
     status)
        status @sbindir@/bacula-sd
diff --git a/platforms/rpms/redhat/bacula-bat.spec.in b/platforms/rpms/redhat/bacula-bat.spec.in
index ecfcb73..8c81a6e 100644
--- a/platforms/rpms/redhat/bacula-bat.spec.in
+++ b/platforms/rpms/redhat/bacula-bat.spec.in
@@ -1,7 +1,9 @@
 #
 # Bacula RPM spec file
 #
-# Copyright (C) 2000-2014 Bacula Systems SA
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #
 
 # Platform Build Configuration
@@ -11,7 +13,6 @@
 %define _version           @VERSION@
 %define depkgs_qt_version  @DEPKGS_QT_VERSION@
 %define product            bacula
-%define base_package_name %{product}
 
 # Don't strip binaries
 %define __os_install_post %{nil}
@@ -102,6 +103,8 @@ exit 1
 %define sqlite 0
 %{?build_sqlite:%define sqlite 1}
 
+%define base_package_name bacula
+
 Summary: Bacula - The Network Backup Solution
 Name: %{base_package_name}-bat
 Version: %{_version}
@@ -143,14 +146,13 @@ BuildRequires: freetype-devel
 %define depkgs_qt ../depkgs-qt
 
 # define the basic package description
-%define blurb Bacula - The Leading Open Source Backup Solution.
+%define blurb Bacula - The Network Backup Solution.
 %define blurb2 Bacula is a set of computer programs that permit you (or the system
 %define blurb3 administrator) to manage backup, recovery, and verification of computer
 %define blurb4 data across a network of computers of different kinds. In technical terms,
 %define blurb5 it is a network client/server based backup program. Bacula is relatively
 %define blurb6 easy to use and efficient, while offering many advanced storage management
 %define blurb7 features that make it easy to find and recover lost or damaged files.
-%define blurb8 Bacula source code has been released under the AGPL version 3 license.
 
 %define group_file /etc/group
 %define groupadd /usr/sbin/groupadd
@@ -167,13 +169,12 @@ Group: System Environment/Daemons
 %{blurb5}
 %{blurb6}
 %{blurb7}
-%{blurb8}
 
 This is the Bacula Administration Tool (bat) graphical user interface package.
 It is an add-on to the client or server packages.
 
 # Don't strip symbols
-%define debug_package %{nil}
+%define debug_package %{nil} 
 
 # Must explicitly enable debug pkg on SuSE
 # but not in opensuse_bs
@@ -285,7 +286,7 @@ ln -sf consolehelper $RPM_BUILD_ROOT/usr/bin/bat
 %files
 %defattr(-,root,root)
 %attr(-, root, %{daemon_group}) %{_sbindir}/bat
-%attr(-, root, %{daemon_group}) %dir %{sysconf_dir}
+%attr(770, root, %{daemon_group}) %dir %{sysconf_dir}
 %attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bat.conf
 %attr(-, root, %{daemon_group}) %{docs_dir}/*.html
 %attr(-, root, %{daemon_group}) %{docs_dir}/*.png
diff --git a/platforms/rpms/redhat/bacula-client-static.spec.in b/platforms/rpms/redhat/bacula-client-static.spec.in
new file mode 100644
index 0000000..d3bff82
--- /dev/null
+++ b/platforms/rpms/redhat/bacula-client-static.spec.in
@@ -0,0 +1,286 @@
+# Bacula RPM spec file
+#
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+
+# Platform Build Configuration
+# TODO: merge all plugins into one spec file
+
+# basic defines for every build
+%define _release           @RELEASE@
+%define _version           @VERSION@
+%define product            bacula
+%define _packager Kern Sibbald <kern at sibbald.com>
+%define depkgs_version @DEPKGS_VERSION@
+
+# Don't strip binaries
+%define __os_install_post %{nil}
+%define __debug_install_post %{nil}
+%define debug_package %{nil}
+
+%define single_dir 1
+%{?single_dir_install:%define single_dir 1}
+
+# Installation Directory locations                                                                                            
+%if %{single_dir}
+# Installation Directory locations
+%define _prefix        /opt/bacula
+%define _sbindir       /opt/bacula/sbin
+%define _bindir        /opt/bacula/bin
+%define _subsysdir     /opt/bacula/working
+%define sqlite_bindir  /opt/bacula/sqlite
+%define _mandir        /usr/share/man
+%define _man_bacula    /opt/bacula/share/man/
+%define sysconf_dir    /opt/bacula/etc
+%define scripts_dir    /opt/bacula/scripts
+%define working_dir    /opt/bacula/working
+%define pid_dir        /opt/bacula/working
+%define plugin_dir     /opt/bacula/plugins
+%define lib_dir        /opt/bacula/lib
+%define script_dir     /opt/bacula/scripts
+%define doc_dir        /opt/bacula/share/doc
+%define var_dir        /opt/bacula/var
+%else
+%define _prefix        /usr
+%define _sbindir       %_prefix/sbin
+%define _bindir        %_prefix/bin
+%define _subsysdir     /var/lock/subsys
+%define sqlite_bindir %_libdir/bacula/sqlite
+%define _mandir        %_prefix/share/man
+%define sysconf_dir    /etc/bacula
+%define script_dir     %_libdir/bacula
+%define working_dir    /var/lib/bacula
+%define pid_dir        /var/run
+%define plugin_dir     %_libdir/bacula/plugins
+%define lib_dir        %_libdir/bacula/lib
+%endif
+
+#--------------------------------------------------------------------------
+# it should not be necessary to change anything below here for a release
+# except for patch macros in the setup section
+#--------------------------------------------------------------------------
+
+%define file_daemon_user        root
+%define daemon_group            bacula
+
+%define base_package_name bacula
+
+%{?contrib_packager:%define _packager %{contrib_packager}}
+
+Summary: Bacula - The Network Backup Solution
+Name: %{base_package_name}-client-static
+Version: %{_version}
+Release: %{_release}
+Group: System Environment/Daemons
+License: AGPLv3
+BuildRoot: %{_tmppath}/%{name}-root
+URL: http://www.baculasystems.com/
+Vendor: Bacula Project
+Packager: %{_packager}
+Prefix: %{_prefix}
+Distribution: Bacula Static Client
+Source0: https://www.baculasystems.com/dl/download/bacula-%{_version}.tar.gz
+
+%description
+%{blurb} This is Bacula static FD package.
+
+# define the basic package description
+%define blurb Bacula static FD - The Network Backup Solution.
+%define blurb2 Bacula static FD staticly linked FD
+
+BuildRequires: gcc, gcc-c++, make, autoconf
+BuildRequires: glibc, glibc-devel
+BuildRequires: ncurses-devel, perl, readline-devel
+BuildRequires: libstdc++-devel, zlib-devel
+BuildRequires: libacl-devel
+BuildRequires: pkgconfig
+
+Provides: bacula-fd
+Conflicts: bacula-client
+
+Summary: Bacula static fd package - The Network Backup Solution
+Group: System Environment/Daemons
+
+%prep
+%setup -T -D -n bacula-%{_version} -b 0
+
+%build
+
+cd ../bacula-%{_version}
+./configure \
+        --prefix=%{_prefix} \
+        --sbindir=%{_sbindir} \
+        --sysconfdir=%{sysconf_dir} \
+        --with-scriptdir=%{scripts_dir} \
+        --with-working-dir=%{working_dir} \
+        --with-plugindir=%{plugin_dir} \
+        --with-pid-dir=%{pid_dir} \
+        --with-subsys-dir=%{_subsysdir} \
+        --enable-smartalloc \
+        --disable-bat \
+        --enable-client-only \
+        --with-basename="XXX_HOSTNAME_XXX" \
+        --with-hostname="XXX_HOSTNAME_XXX" \
+        --with-fd-password="XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX" \
+        --with-mon-fd-password="XXX_REPLACE_WITH_CLIENT_MONITOR_PASSWORD_XXX" \
+        --enable-static-fd=yes \
+        --enable-static-tools=yes \
+        --enable-static-cons=yes \
+        --without-openssl \
+        --disable-libtool
+make -j3
+
+%install
+
+cwd=${PWD}
+[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
+mkdir -p $RPM_BUILD_ROOT/etc/init.d
+mkdir -p $RPM_BUILD_ROOT%{_sbindir}
+mkdir -p $RPM_BUILD_ROOT%{_bindir}
+mkdir -p $RPM_BUILD_ROOT%{plugin_dir}
+mkdir -p $RPM_BUILD_ROOT%{sysconf_dir}
+mkdir -p $RPM_BUILD_ROOT%{working_dir}
+mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d/bacula
+
+cp -p platforms/redhat/bacula-fd $RPM_BUILD_ROOT/etc/init.d/static-bacula-fd
+chmod 0754 $RPM_BUILD_ROOT/etc/init.d/*
+
+make DESTDIR=$RPM_BUILD_ROOT install
+
+# fix me - building enable-client-only installs files not included in bacula-client package
+# Program docs not installed on client
+
+cp $RPM_BUILD_ROOT%{sysconf_dir}/bacula-fd.conf $RPM_BUILD_ROOT%{sysconf_dir}/static-bacula-fd.conf
+
+rm -f $RPM_BUILD_ROOT%{_sbindir}/bconsole
+rm -f $RPM_BUILD_ROOT%{_sbindir}/bbconsjson
+rm -f $RPM_BUILD_ROOT%{_sbindir}/btraceback
+rm -f $RPM_BUILD_ROOT%{sysconf_dir}/mtx-changer.conf.new
+rm -f $RPM_BUILD_ROOT%{sysconf_dir}/btraceback.mdb
+rm -f $RPM_BUILD_ROOT%{sysconf_dir}/dvd-handler.old
+rm -f $RPM_BUILD_ROOT%{sysconf_dir}/storage-ctl.conf.new
+rm -f $RPM_BUILD_ROOT%{sysconf_dir}/disk-changer.old
+rm -f $RPM_BUILD_ROOT%{sysconf_dir}/bacula-ctl-sd
+rm -f $RPM_BUILD_ROOT%{sysconf_dir}/bconsole
+rm -f $RPM_BUILD_ROOT%{sysconf_dir}/btraceback.gdb
+rm -f $RPM_BUILD_ROOT%{sysconf_dir}/disk-changer
+rm -f $RPM_BUILD_ROOT%{sysconf_dir}/dvd-handler
+rm -f $RPM_BUILD_ROOT%{sysconf_dir}/storage-ctl
+rm -f $RPM_BUILD_ROOT%{sysconf_dir}/mtx-changer
+rm -f $RPM_BUILD_ROOT%{sysconf_dir}/mtx-changer.conf
+rm -f $RPM_BUILD_ROOT%{sysconf_dir}/bacula-ctl-dir
+rm -f $RPM_BUILD_ROOT%{sysconf_dir}/bconsole.conf.new
+rm -f $RPM_BUILD_ROOT%{sysconf_dir}/storage-ctl.conf
+rm -f $RPM_BUILD_ROOT%{sysconf_dir}/btraceback.dbx
+rm -f $RPM_BUILD_ROOT%{sysconf_dir}/bacula-fd.conf
+rm -f $RPM_BUILD_ROOT%{_bindir}/bfdjson
+rm -f $RPM_BUILD_ROOT%{_bindir}/bacula
+rm -f $RPM_BUILD_ROOT%{_sbindir}/bacula
+rm -f $RPM_BUILD_ROOT%{_sbindir}/bacula-fd
+rm -f $RPM_BUILD_ROOT%{_sbindir}/bfdjson
+rm -f $RPM_BUILD_ROOT%{_man_bacula}/man1/bacula-tray-monitor.1.gz
+rm -f $RPM_BUILD_ROOT%{_man_bacula}/man1/bat.1.gz
+rm -f $RPM_BUILD_ROOT%{_man_bacula}/man1/bsmtp.1.gz
+rm -f $RPM_BUILD_ROOT%{_man_bacula}/man8/bacula-dir.8.gz
+rm -f $RPM_BUILD_ROOT%{_man_bacula}/man8/bacula-sd.8.gz
+rm -f $RPM_BUILD_ROOT%{_man_bacula}/man8/bacula.8.gz
+rm -f $RPM_BUILD_ROOT%{_man_bacula}/man8/bcopy.8.gz
+rm -f $RPM_BUILD_ROOT%{_man_bacula}/man8/bextract.8.gz
+rm -f $RPM_BUILD_ROOT%{_man_bacula}/man8/bls.8.gz
+rm -f $RPM_BUILD_ROOT%{_man_bacula}/man8/bregex.8.gz
+rm -f $RPM_BUILD_ROOT%{_man_bacula}/man8/bscan.8.gz
+rm -f $RPM_BUILD_ROOT%{_man_bacula}/man8/btape.8.gz
+rm -f $RPM_BUILD_ROOT%{_man_bacula}/man8/btraceback.8.gz
+rm -f $RPM_BUILD_ROOT%{_man_bacula}/man8/bwild.8.gz
+rm -f $RPM_BUILD_ROOT%{_man_bacula}/man8/dbcheck.8.gz
+rm -f $RPM_BUILD_ROOT%{_man_bacula}/man1/bacula-bwxconsole.1.gz
+rm -f $RPM_BUILD_ROOT%{script_dir}/bacula
+rm -f $RPM_BUILD_ROOT%{script_dir}/bacula-ctl-dir
+rm -f $RPM_BUILD_ROOT%{script_dir}/bacula-ctl-sd
+rm -f $RPM_BUILD_ROOT%{script_dir}/bacula_config
+rm -f $RPM_BUILD_ROOT%{script_dir}/bconsole
+rm -f $RPM_BUILD_ROOT%{script_dir}/breload
+rm -f $RPM_BUILD_ROOT%{script_dir}/btraceback.dbx
+rm -f $RPM_BUILD_ROOT%{script_dir}/btraceback.gdb
+rm -f $RPM_BUILD_ROOT%{script_dir}/btraceback.mdb
+rm -f $RPM_BUILD_ROOT%{script_dir}/disk-changer
+rm -f $RPM_BUILD_ROOT%{script_dir}/dvd-handler
+rm -f $RPM_BUILD_ROOT%{script_dir}/manual_prune.pl
+rm -f $RPM_BUILD_ROOT%{script_dir}/mtx-changer
+rm -f $RPM_BUILD_ROOT%{script_dir}/mtx-changer.conf
+rm -f $RPM_BUILD_ROOT%{script_dir}/storage-ctl
+rm -f $RPM_BUILD_ROOT%{script_dir}/storage-ctl.conf
+rm -f $RPM_BUILD_ROOT%{doc_dir}/bacula/ChangeLog
+rm -f $RPM_BUILD_ROOT%{doc_dir}/bacula/INSTALL
+rm -f $RPM_BUILD_ROOT%{doc_dir}/bacula/LICENSE
+rm -f $RPM_BUILD_ROOT%{doc_dir}/bacula/README
+rm -f $RPM_BUILD_ROOT%{doc_dir}/bacula/ReleaseNotes
+rm -f $RPM_BUILD_ROOT%{doc_dir}/bacula/VERIFYING
+rm -f $RPM_BUILD_ROOT%/opt/bacula/share/man/man1/bacula-bwxconsole.1.gz
+
+%files
+%defattr(-,root,root)
+
+%attr(-, root, %{daemon_group}) %dir %{script_dir}
+%attr(-, root, %{daemon_group}) %dir %{sysconf_dir}
+%attr(-, root, %{daemon_group}) %dir %{working_dir}
+%attr(-, root, %{daemon_group}) %{script_dir}/bacula-ctl-fd
+%attr(-, root, %{daemon_group}) %dir %{plugin_dir}
+%attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/static-bacula-fd.conf
+%attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bconsole.conf
+%attr(-, root, %{daemon_group}) %{_sbindir}/static-bconsole
+%attr(-, root, %{daemon_group}) %{_sbindir}/static-bacula-fd
+
+%attr(-, root, %{daemon_group}) /etc/init.d/static-bacula-fd
+%attr(-, root, %{daemon_group}) %dir /etc/logrotate.d/bacula
+%attr(-, root, %{daemon_group}) %{_man_bacula}/man8/bconsole.8.gz
+%attr(-, root, %{daemon_group}) %{_man_bacula}/man8/bacula-fd.8.gz
+
+%post
+# add our link
+
+if [ "$1" -ge 1 ] ; then
+   /sbin/chkconfig --add static-bacula-fd
+fi
+
+if [ -d %{sysconf_dir} ]; then
+   cd %{sysconf_dir}
+   if [ ! -f .rpm.sed ]; then
+       (umask 0177
+        echo "# This file is used to ensure that all passwords will" > .rpm.sed
+        echo "# match between configuration files"                  >> .rpm.sed
+       )
+       for string in XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX XXX_REPLACE_WITH_DIRECTOR_MONITOR_PASSWORD_XXX XXX_REPLACE_WITH_CLIENT_MONITOR_PASSWORD_XXX XXX_REPLACE_WITH_STORAGE_MONITOR_PAS\
+SWORD_XXX; do
+           pass=`openssl rand -base64 33`
+           echo "s@${string}@${pass}@g" >> .rpm.sed
+       done
+   fi
+   host=`hostname -s`
+   echo "s at XXX_HOSTNAME_XXX@${host}@g" >> .rpm.sed
+   for file in *.conf; do
+      sed -f .rpm.sed $file > $file.new
+      sed "s at XXX_HOSTNAME_XXX@${host}@g" $file.new > $file
+      rm -f $file.new
+   done
+   rm .rpm.sed
+   cd /tmp
+   cat /etc/init.d/static-bacula-fd | sed s at bacula-fd@static-bacula-fd at g > .rpm.sed
+   cp .rpm.sed /etc/init.d/static-bacula-fd
+   chmod 755 /etc/init.d/static-bacula-fd
+   rm .rpm.sed   
+   cd %{sysconf_dir}
+fi
+
+%preun
+# delete our link
+if [ $1 = 0 ]; then
+   /sbin/chkconfig --del static-bacula-fd
+fi
+
+%clean
+[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
+
+%changelog
diff --git a/platforms/rpms/redhat/bacula-docs.spec.in b/platforms/rpms/redhat/bacula-docs.spec.in
index 2c24b06..afe2682 100644
--- a/platforms/rpms/redhat/bacula-docs.spec.in
+++ b/platforms/rpms/redhat/bacula-docs.spec.in
@@ -1,7 +1,6 @@
 #
 # Bacula RPM spec file
 #
-# Copyright (C) 2000-2014 Bacula Systems SA
 
 # Platform Build Configuration
 
diff --git a/platforms/rpms/redhat/bacula-mtx.spec.in b/platforms/rpms/redhat/bacula-mtx.spec.in
index eee1c7b..b53067c 100644
--- a/platforms/rpms/redhat/bacula-mtx.spec.in
+++ b/platforms/rpms/redhat/bacula-mtx.spec.in
@@ -1,7 +1,10 @@
 #
 # Bacula RPM spec file
 #
-# Copyright (C) 2000-2014 Bacula Systems SA
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 
 # Platform Build Configuration
 
@@ -58,14 +61,13 @@ Distribution: Bacula Bat
 Source: http://www.prdownloads.sourceforge.net/bacula/depkgs-%{depkgs_version}.tar.gz
 
 # define the basic package description
-%define blurb Bacula - The Leading Open Source Backup Solution.
+%define blurb Bacula - The Network Backup Solution.
 %define blurb2 Bacula is a set of computer programs that permit you (or the system
 %define blurb3 administrator) to manage backup, recovery, and verification of computer
 %define blurb4 data across a network of computers of different kinds. In technical terms,
 %define blurb5 it is a network client/server based backup program. Bacula is relatively
 %define blurb6 easy to use and efficient, while offering many advanced storage management
 %define blurb7 features that make it easy to find and recover lost or damaged files.
-%define blurb8 Bacula source code has been released under the AGPL version 3 license.
 
 Summary: Bacula - The Network Backup Solution
 Group: System Environment/Daemons
@@ -79,7 +81,6 @@ Group: System Environment/Daemons
 %{blurb5}
 %{blurb6}
 %{blurb7}
-%{blurb8}
 
 This is Bacula's version of mtx tape utilities for Linux distributions that
 do not provide their own mtx package
diff --git a/platforms/rpms/redhat/bacula.spec.in b/platforms/rpms/redhat/bacula.spec.in
index b9a1697..8f59a8f 100644
--- a/platforms/rpms/redhat/bacula.spec.in
+++ b/platforms/rpms/redhat/bacula.spec.in
@@ -1,7 +1,5 @@
 # Bacula RPM spec file
 #
-# Copyright (C) 2000-2014 Bacula Systems SA
-#
 
 # Platform Build Configuration
 
diff --git a/platforms/rpms/suse/bacula-bat.spec.in b/platforms/rpms/suse/bacula-bat.spec.in
index 62a3dae..33d5308 100644
--- a/platforms/rpms/suse/bacula-bat.spec.in
+++ b/platforms/rpms/suse/bacula-bat.spec.in
@@ -1,7 +1,10 @@
 #
 # Bacula RPM spec file
 #
-# Copyright (C) 2000-2014 Bacula Systems SA
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 
 # Platform Build Configuration
 
@@ -147,14 +150,13 @@ BuildRequires: freetype-devel
 %define depkgs_qt ../depkgs-qt
 
 # define the basic package description
-%define blurb Bacula - The Leading Open Source Backup Solution.
+%define blurb Bacula - The Network Backup Solution.
 %define blurb2 Bacula is a set of computer programs that permit you (or the system
 %define blurb3 administrator) to manage backup, recovery, and verification of computer
 %define blurb4 data across a network of computers of different kinds. In technical terms,
 %define blurb5 it is a network client/server based backup program. Bacula is relatively
 %define blurb6 easy to use and efficient, while offering many advanced storage management
 %define blurb7 features that make it easy to find and recover lost or damaged files.
-%define blurb8 Bacula source code has been released under the AGPL version 3 license.
 
 %define group_file /etc/group
 %define groupadd /usr/sbin/groupadd
@@ -171,13 +173,12 @@ Group: System Environment/Daemons
 %{blurb5}
 %{blurb6}
 %{blurb7}
-%{blurb8}
 
 This is the Bacula Administration Tool (bat) graphical user interface package.
 It is an add-on to the client or server packages.
 
 # Don't strip symbols
-%define debug_package %{nil}
+%define debug_package %{nil} 
 
 # Must explicitly enable debug pkg on SuSE
 # but not in opensuse_bs
@@ -289,7 +290,7 @@ ln -sf consolehelper $RPM_BUILD_ROOT/usr/bin/bat
 %files
 %defattr(-,root,root)
 %attr(-, root, %{daemon_group}) %{_sbindir}/bat
-%attr(-, root, %{daemon_group}) %dir %{sysconf_dir}
+%attr(770, root, %{daemon_group}) %dir %{sysconf_dir}
 %attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bat.conf
 %attr(-, root, %{daemon_group}) %{docs_dir}/*.html
 %attr(-, root, %{daemon_group}) %{docs_dir}/*.png
diff --git a/platforms/rpms/suse/bacula-docs.spec.in b/platforms/rpms/suse/bacula-docs.spec.in
index 2c24b06..605b9ce 100644
--- a/platforms/rpms/suse/bacula-docs.spec.in
+++ b/platforms/rpms/suse/bacula-docs.spec.in
@@ -1,7 +1,10 @@
 #
 # Bacula RPM spec file
 #
-# Copyright (C) 2000-2014 Bacula Systems SA
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 
 # Platform Build Configuration
 
diff --git a/platforms/rpms/suse/bacula-mtx.spec.in b/platforms/rpms/suse/bacula-mtx.spec.in
index eee1c7b..b53067c 100644
--- a/platforms/rpms/suse/bacula-mtx.spec.in
+++ b/platforms/rpms/suse/bacula-mtx.spec.in
@@ -1,7 +1,10 @@
 #
 # Bacula RPM spec file
 #
-# Copyright (C) 2000-2014 Bacula Systems SA
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 
 # Platform Build Configuration
 
@@ -58,14 +61,13 @@ Distribution: Bacula Bat
 Source: http://www.prdownloads.sourceforge.net/bacula/depkgs-%{depkgs_version}.tar.gz
 
 # define the basic package description
-%define blurb Bacula - The Leading Open Source Backup Solution.
+%define blurb Bacula - The Network Backup Solution.
 %define blurb2 Bacula is a set of computer programs that permit you (or the system
 %define blurb3 administrator) to manage backup, recovery, and verification of computer
 %define blurb4 data across a network of computers of different kinds. In technical terms,
 %define blurb5 it is a network client/server based backup program. Bacula is relatively
 %define blurb6 easy to use and efficient, while offering many advanced storage management
 %define blurb7 features that make it easy to find and recover lost or damaged files.
-%define blurb8 Bacula source code has been released under the AGPL version 3 license.
 
 Summary: Bacula - The Network Backup Solution
 Group: System Environment/Daemons
@@ -79,7 +81,6 @@ Group: System Environment/Daemons
 %{blurb5}
 %{blurb6}
 %{blurb7}
-%{blurb8}
 
 This is Bacula's version of mtx tape utilities for Linux distributions that
 do not provide their own mtx package
diff --git a/platforms/rpms/suse/bacula.spec.in b/platforms/rpms/suse/bacula.spec.in
index 792f760..1739c5f 100644
--- a/platforms/rpms/suse/bacula.spec.in
+++ b/platforms/rpms/suse/bacula.spec.in
@@ -1,6 +1,9 @@
 # Bacula RPM spec file
 #
-# Copyright (C) 2000-2014 Bacula Systems SA
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 
 # Platform Build Configuration
 
diff --git a/platforms/slackware/Makefile.in b/platforms/slackware/Makefile.in
index ecdee1b..908aa54 100644
--- a/platforms/slackware/Makefile.in
+++ b/platforms/slackware/Makefile.in
@@ -1,3 +1,6 @@
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 # 
 # This file is used as the template to create the
 # Makefile for the Slackware specific installation.
diff --git a/platforms/slackware/functions.bacula.in b/platforms/slackware/functions.bacula.in
index f9ef20b..dc95608 100644
--- a/platforms/slackware/functions.bacula.in
+++ b/platforms/slackware/functions.bacula.in
@@ -1,7 +1,10 @@
 #! /bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula       This shell script takes care of starting and stopping
-#	       the bacula daemons.
+#              the bacula daemons.
 #
 #   This is pretty much watered down version of the RedHat script
 #   that works on Solaris as well as Linux, but it won't work everywhere.
@@ -40,17 +43,17 @@ killproc() {
     RC=0
     # Test syntax.
     if [ $# = 0 ]; then
-	echo "Usage: killproc {program} [signal]"
-	return 1
+        echo "Usage: killproc {program} [signal]"
+        return 1
     fi
 
     notset=0
     # check for third arg to be kill level
     if [ "$3" != "" ] ; then
-	killlevel=$3
+        killlevel=$3
     else
-	notset=1
-	killlevel="-9"
+        notset=1
+        killlevel="-9"
     fi
 
     # Get base program name
@@ -61,39 +64,39 @@ killproc() {
 
     # Kill it.
     if [ "$pid" != "" ] ; then
-	if [ "$notset" = "1" ] ; then
-	    if ps -p $pid>/dev/null 2>&1; then
-		# TERM first, then KILL if not dead
-		kill -TERM $pid 2>/dev/null
-		sleep 1
-		if ps -p $pid >/dev/null 2>&1 ; then
-		    sleep 1
-		    if ps -p $pid >/dev/null 2>&1 ; then
-			sleep 3
-			if ps -p $pid >/dev/null 2>&1 ; then
-			    kill -KILL $pid 2>/dev/null
-			fi
-		    fi
-		fi
-	     fi
-	     ps -p $pid >/dev/null 2>&1
-	     RC=$?
-	     [ $RC -eq 0 ] && failure "$base shutdown" || success "$base shutdown"
-	#    RC=$((! $RC))
-	# use specified level only
-	else
-	    if ps -p $pid >/dev/null 2>&1; then
-		kill $killlevel $pid 2>/dev/null
-		RC=$?
-		[ $RC -eq 0 ] && success "$base $killlevel" || failure "$base $killlevel"
-	    fi
-	fi
+        if [ "$notset" = "1" ] ; then
+            if ps -p $pid>/dev/null 2>&1; then
+                # TERM first, then KILL if not dead
+                kill -TERM $pid 2>/dev/null
+                sleep 1
+                if ps -p $pid >/dev/null 2>&1 ; then
+                    sleep 1
+                    if ps -p $pid >/dev/null 2>&1 ; then
+                        sleep 3
+                        if ps -p $pid >/dev/null 2>&1 ; then
+                            kill -KILL $pid 2>/dev/null
+                        fi
+                    fi
+                fi
+             fi
+             ps -p $pid >/dev/null 2>&1
+             RC=$?
+             [ $RC -eq 0 ] && failure "$base shutdown" || success "$base shutdown"
+        #    RC=$((! $RC))
+        # use specified level only
+        else
+            if ps -p $pid >/dev/null 2>&1; then
+                kill $killlevel $pid 2>/dev/null
+                RC=$?
+                [ $RC -eq 0 ] && success "$base $killlevel" || failure "$base $killlevel"
+            fi
+        fi
     else
-	failure "$base shutdown"
+        failure "$base shutdown"
     fi
     # Remove pid file if any.
     if [ "$notset" = "1" ]; then
-	rm -f ${PIDDIR}/$base.$2.pid
+        rm -f ${PIDDIR}/$base.$2.pid
     fi
     return $RC
 }
@@ -103,8 +106,8 @@ pidofproc() {
     pid=""
     # Test syntax.
     if [ $# = 0 ] ; then
-	echo "Usage: pidofproc {program}"
-	return 1
+        echo "Usage: pidofproc {program}"
+        return 1
     fi
 
     # Get base program name
@@ -112,11 +115,11 @@ pidofproc() {
 
     # First try PID file
     if [ -f ${PIDDIR}/$base.$2.pid ] ; then
-	pid=`head -1 ${PIDDIR}/$base.$2.pid`
-	if [ "$pid" != "" ] ; then
-	    echo $pid
-	    return 0
-	fi
+        pid=`head -1 ${PIDDIR}/$base.$2.pid`
+        if [ "$pid" != "" ] ; then
+            echo $pid
+            return 0
+        fi
     fi
 
     # Next try "pidof"
@@ -136,8 +139,8 @@ pidofproc() {
 status() {
     # Test syntax.
     if [ $# = 0 ] ; then
-	echo "Usage: status {program}"
-	return 1
+        echo "Usage: status {program}"
+        return 1
     fi
 
     # Get base program name
@@ -152,27 +155,27 @@ status() {
        return 0
    else
        pid=`${PSCMD} | awk 'BEGIN { prog=ARGV[1]; ARGC=1 } 
-	     { if ((prog == $2) || (("(" prog ")") == $2) ||
-		  (("[" prog "]") == $2) ||
-		  ((prog ":") == $2)) { print $1 ; exit 0 } }' $1`
+             { if ((prog == $2) || (("(" prog ")") == $2) ||
+                  (("[" prog "]") == $2) ||
+                  ((prog ":") == $2)) { print $1 ; exit 0 } }' $1`
        if [ "$pid" != "" ] ; then
-	   echo "$base (pid $pid) is running..."
-	   return 0
+           echo "$base (pid $pid) is running..."
+           return 0
        fi
    fi
 
     # Next try the PID files
     if [ -f ${PIDDIR}/$base.$2.pid ] ; then
-	pid=`head -1 ${PIDDIR}/$base.$2.pid`
-	if [ "$pid" != "" ] ; then
-	    echo "$base not running, but pid file exists"
-	    return 1
-	fi
+        pid=`head -1 ${PIDDIR}/$base.$2.pid`
+        if [ "$pid" != "" ] ; then
+            echo "$base not running, but pid file exists"
+            return 1
+        fi
     fi
     # See if the subsys lock exists
     if [ -f ${SUBSYSDIR}/$base ] ; then
-	echo "$base not running, but subsys locked"
-	return 2
+        echo "$base not running, but subsys locked"
+        return 2
     fi
     echo "$base is stopped"
     return 3
diff --git a/platforms/slackware/rc.bacula-dir.in b/platforms/slackware/rc.bacula-dir.in
index 3a613a9..8c9745b 100644
--- a/platforms/slackware/rc.bacula-dir.in
+++ b/platforms/slackware/rc.bacula-dir.in
@@ -1,7 +1,10 @@
 #! /bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula       This shell script takes care of starting and stopping
-#	       the bacula Director daemon
+#              the bacula Director daemon
 #
 # chkconfig: 2345 92 99
 # description: The Leading Open Source Backup Solution.
@@ -12,42 +15,47 @@
 # Source function library
 . /etc/rc.d/functions.bacula
 
+RETVAL=0
 case "$1" in
     start)
-	[ -x ${BACDIRBIN}/bacula-dir ] && { 
-	    sleep 2
-	    echo -n "Starting the Director daemon: "
-	    OPTIONS=''
-	    if [ "${DIR_USER}" != '' ]; then
-	       OPTIONS="${OPTIONS} -u ${DIR_USER}"
-	    fi
+        [ -x ${BACDIRBIN}/bacula-dir ] && { 
+            sleep 2
+            echo -n "Starting the Director daemon: "
+            OPTIONS=''
+            if [ "${DIR_USER}" != '' ]; then
+               OPTIONS="${OPTIONS} -u ${DIR_USER}"
+            fi
 
-	    if [ "${DIR_GROUP}" != '' ]; then
-	       OPTIONS="${OPTIONS} -g ${DIR_GROUP}"
-	    fi
+            if [ "${DIR_GROUP}" != '' ]; then
+               OPTIONS="${OPTIONS} -g ${DIR_GROUP}"
+            fi
 
-	    ${BACDIRBIN}/bacula-dir $2 ${OPTIONS} -v -c ${BACDIRCFG}/bacula-dir.conf
-	    echo Done.
-	}
-	;;
+            ${BACDIRBIN}/bacula-dir $2 ${OPTIONS} -v -c ${BACDIRCFG}/bacula-dir.conf
+            RETVAL=$?
+            echo Done.
+        }
+        ;;
     stop)
-	[ -x ${BACDIRBIN}/bacula-dir ] && {
-	    echo -n "Stopping the Director daemon: "
-	    killproc ${BACDIRBIN}/bacula-dir ${DIR_PORT}
-	    echo Done.
-	}
-	;;
+        [ -x ${BACDIRBIN}/bacula-dir ] && {
+            echo -n "Stopping the Director daemon: "
+            killproc ${BACDIRBIN}/bacula-dir ${DIR_PORT}
+            RETVAL=$?
+            echo Done.
+        }
+        ;;
     restart)
-	$0 stop
-	sleep 5
-	$0 start
-	;;
+        $0 stop
+        sleep 5
+        $0 start
+        RETVAL=$?
+        ;;
     status)
-	[ -x ${BACDIRBIN}/bacula-dir ] && status ${BACDIRBIN}/bacula-dir ${DIR_PORT}
-	;;
+        [ -x ${BACDIRBIN}/bacula-dir ] && status ${BACDIRBIN}/bacula-dir ${DIR_PORT}
+        RETVAL=$?
+        ;;
     *)
-	echo "Usage: $0 {start|stop|restart|status}"
-	exit 1
-	;;
+        echo "Usage: $0 {start|stop|restart|status}"
+        exit 1
+        ;;
 esac
-exit 0
+exit $RETVAL
diff --git a/platforms/slackware/rc.bacula-fd.in b/platforms/slackware/rc.bacula-fd.in
index 99a3c2d..b5f0b67 100644
--- a/platforms/slackware/rc.bacula-fd.in
+++ b/platforms/slackware/rc.bacula-fd.in
@@ -1,7 +1,10 @@
 #! /bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula       This shell script takes care of starting and stopping
-#	       the bacula File daemon.
+#              the bacula File daemon.
 #
 # chkconfig: 2345 91 99
 # description: The Leading Open Source Backup Solution.
@@ -12,42 +15,47 @@
 # Source function library
 . /etc/rc.d/functions.bacula
 
+RETVAL=0
 case "$1" in
     start)
-	[ -x ${BACFDBIN}/bacula-fd ] && { 
-	    sleep 2
-	    echo -n "Starting the File daemon: "
-	    OPTIONS=''
-	    if [ "${FD_USER}" != '' ]; then
-	       OPTIONS="${OPTIONS} -u ${FD_USER}"
-	    fi
+        [ -x ${BACFDBIN}/bacula-fd ] && { 
+            sleep 2
+            echo -n "Starting the File daemon: "
+            OPTIONS=''
+            if [ "${FD_USER}" != '' ]; then
+               OPTIONS="${OPTIONS} -u ${FD_USER}"
+            fi
 
-	    if [ "${FD_GROUP}" != '' ]; then
-	       OPTIONS="${OPTIONS} -g ${FD_GROUP}"
-	    fi
+            if [ "${FD_GROUP}" != '' ]; then
+               OPTIONS="${OPTIONS} -g ${FD_GROUP}"
+            fi
 
-	    ${BACFDBIN}/bacula-fd $2 ${OPTIONS} -v -c ${BACFDCFG}/bacula-fd.conf
-	    echo Done.
-	}
-	;;
+            ${BACFDBIN}/bacula-fd $2 ${OPTIONS} -v -c ${BACFDCFG}/bacula-fd.conf
+            RETVAL=$?
+            echo Done.
+        }
+        ;;
     stop)
-	[ -x ${BACFDBIN}/bacula-fd ] && {
-	    echo -n "Stopping the File daemon: "
-	    killproc ${BACFDBIN}/bacula-fd ${FD_PORT}
-	    echo Done.
-	}
-	;;
+        [ -x ${BACFDBIN}/bacula-fd ] && {
+            echo -n "Stopping the File daemon: "
+            killproc ${BACFDBIN}/bacula-fd ${FD_PORT}
+            RETVAL=$?
+            echo Done.
+        }
+        ;;
     restart)
-	$0 stop
-	sleep 5
-	$0 start
-	;;
+        $0 stop
+        sleep 5
+        $0 start
+        RETVAL=$?
+        ;;
     status)
-	[ -x ${BACFDBIN}/bacula-fd ] && status ${BACFDBIN}/bacula-fd ${FD_PORT}
-	;;
+        [ -x ${BACFDBIN}/bacula-fd ] && status ${BACFDBIN}/bacula-fd ${FD_PORT}
+        RETVAL=$?
+        ;;
     *)
-	echo "Usage: $0 {start|stop|restart|status}"
-	exit 1
-	;;
+        echo "Usage: $0 {start|stop|restart|status}"
+        exit 1
+        ;;
 esac
-exit 0
+exit $RETVAL
diff --git a/platforms/slackware/rc.bacula-sd.in b/platforms/slackware/rc.bacula-sd.in
index 9c77a6a..ff7a687 100644
--- a/platforms/slackware/rc.bacula-sd.in
+++ b/platforms/slackware/rc.bacula-sd.in
@@ -1,7 +1,10 @@
 #! /bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula       This shell script takes care of starting and stopping
-#	       the bacula Storage daemon.
+#              the bacula Storage daemon.
 #
 # chkconfig: 2345 90 99
 # description: The Leading Open Source Backup Solution.
@@ -12,43 +15,47 @@
 # Source function library
 . /etc/rc.d/functions.bacula
 
+RETVAL=0
 case "$1" in
     start)
-	[ -x ${BACSDBIN}/bacula-sd ] && { 
-	    sleep 2
-	    echo -n "Starting the Storage daemon: "
-	    OPTIONS=''
-	    if [ "${SD_USER}" != '' ]; then
-	       OPTIONS="${OPTIONS} -u ${SD_USER}"
-	    fi
+        [ -x ${BACSDBIN}/bacula-sd ] && { 
+            sleep 2
+            echo -n "Starting the Storage daemon: "
+            OPTIONS=''
+            if [ "${SD_USER}" != '' ]; then
+               OPTIONS="${OPTIONS} -u ${SD_USER}"
+            fi
 
-	    if [ "${SD_GROUP}" != '' ]; then
-	       OPTIONS="${OPTIONS} -g ${SD_GROUP}"
-	    fi
+            if [ "${SD_GROUP}" != '' ]; then
+               OPTIONS="${OPTIONS} -g ${SD_GROUP}"
+            fi
 
-	    ${BACSDBIN}/bacula-sd $2 ${OPTIONS} -v -c ${BACSDCFG}/bacula-sd.conf
-	    echo Done.
-	}
-	;;
+            ${BACSDBIN}/bacula-sd $2 ${OPTIONS} -v -c ${BACSDCFG}/bacula-sd.conf
+            RETVAL=$?
+            echo Done.
+        }
+        ;;
     stop)
-	[ -x ${BACSDBIN}/bacula-sd ] && {
-	    echo -n "Stopping the Storage daemon: "
-	    killproc ${BACSDBIN}/bacula-sd ${SD_PORT}
-	    echo Done.
-	}
-	;;
+        [ -x ${BACSDBIN}/bacula-sd ] && {
+            echo -n "Stopping the Storage daemon: "
+            killproc ${BACSDBIN}/bacula-sd ${SD_PORT}
+            RETVAL=$?
+            echo Done.
+        }
+        ;;
     restart)
-	$0 stop
-	sleep 5
-	$0 start
-	;;
+        $0 stop
+        sleep 5
+        $0 start
+        RETVAL=$?
+        ;;
     status)
-	[ -x ${BACSDBIN}/bacula-sd ] && status ${BACSDBIN}/bacula-sd ${SD_PORT}
-	;;
+        [ -x ${BACSDBIN}/bacula-sd ] && status ${BACSDBIN}/bacula-sd ${SD_PORT}
+        RETVAL=$?
+        ;;
     *)
-	echo "Usage: $0 {start|stop|restart|status}"
-	exit 1
-	;;
+        echo "Usage: $0 {start|stop|restart|status}"
+        exit 1
+        ;;
 esac
-exit 0
-
+exit $RETVAL
diff --git a/platforms/solaris/Makefile.in b/platforms/solaris/Makefile.in
index 4347e47..fae0ff0 100644
--- a/platforms/solaris/Makefile.in
+++ b/platforms/solaris/Makefile.in
@@ -1,3 +1,6 @@
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 # 
 # This file is used as the template to create the
 # Makefile for the Solaris specific installation.
@@ -12,7 +15,6 @@
 
 INSTALL = @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DIR = $(INSTALL) -d -m 755
 
 nothing:
 
@@ -20,28 +22,62 @@ install: install-autostart
 
 install-autostart: install-autostart-fd install-autostart-sd install-autostart-dir
 
-install-autostart-%:
-	@rm -f $(DESTDIR)/etc/rc0.d/K20bacula-$*
-	@rm -f $(DESTDIR)/etc/rc1.d/S99bacula-$*
-	@rm -f $(DESTDIR)/etc/rc2.d/S99bacula-$*
-	@$(INSTALL_DIR) $(DESTDIR)/etc/init.d
-	@$(INSTALL_DIR) $(DESTDIR)/etc/rc0.d $(DESTDIR)/etc/rc1.d \
-		$(DESTDIR)/etc/rc2.d
-	@$(INSTALL_PROGRAM) -m 744 bacula-$* $(DESTDIR)/etc/init.d/bacula-$*
+	
+install-autostart-fd:
+	@rm -f /etc/rc0.d/K20bacula-fd
+	@rm -f /etc/rc1.d/S99bacula-fd
+	@rm -f /etc/rc2.d/S99bacula-fd
+	@$(INSTALL_PROGRAM) -m 744 bacula-fd /etc/init.d/bacula-fd
+	# set symlinks for script at startup and shutdown
+	@ln -f -s /etc/init.d/bacula-fd /etc/rc0.d/K20bacula-fd
+	@ln -f -s /etc/init.d/bacula-fd /etc/rc1.d/S99bacula-fd
+	@ln -f -s /etc/init.d/bacula-fd /etc/rc2.d/S99bacula-fd
+
+
+install-autostart-sd:
+	@rm -f /etc/rc0.d/K20bacula-sd
+	@rm -f /etc/rc1.d/S99bacula-sd
+	@rm -f /etc/rc2.d/S99bacula-sd
+	@$(INSTALL_PROGRAM) -m 744 bacula-sd /etc/init.d/bacula-sd
 	# set symlinks for script at startup and shutdown
-	@ln -f -s /etc/init.d/bacula-$* $(DESTDIR)/etc/rc0.d/K20bacula-$*
-	@ln -f -s /etc/init.d/bacula-$* $(DESTDIR)/etc/rc1.d/S99bacula-$*
-	@ln -f -s /etc/init.d/bacula-$* $(DESTDIR)/etc/rc2.d/S99bacula-$*
+	@ln -f -s /etc/init.d/bacula-sd /etc/rc0.d/K20bacula-sd
+	@ln -f -s /etc/init.d/bacula-sd /etc/rc1.d/S99bacula-sd
+	@ln -f -s /etc/init.d/bacula-sd /etc/rc2.d/S99bacula-sd
+
+
+install-autostart-dir:
+	@rm -f /etc/rc0.d/K20bacula-dir
+	@rm -f /etc/rc1.d/S99bacula-dir
+	@rm -f /etc/rc2.d/S99bacula-dir
+	@$(INSTALL_PROGRAM) -m 744 bacula-dir /etc/init.d/bacula-dir
+	# set symlinks for script at startup and shutdown
+	@ln -f -s /etc/init.d/bacula-dir /etc/rc0.d/K20bacula-dir
+	@ln -f -s /etc/init.d/bacula-dir /etc/rc1.d/S99bacula-dir
+	@ln -f -s /etc/init.d/bacula-dir /etc/rc2.d/S99bacula-dir
+
 
 uninstall: uninstall-autostart
 
 uninstall-autostart: uninstall-autostart-fd uninstall-autostart-sd uninstall-autostart-dir
 
-uninstall-autostart-%:
-	@rm -f $(DESTDIR)/etc/rc0.d/K20bacula-$*
-	@rm -f $(DESTDIR)/etc/rc1.d/S99bacula-$*
-	@rm -f $(DESTDIR)/etc/rc2.d/S99bacula-$*
-	@rm -f $(DESTDIR)/etc/init.d/bacula-$*
+uninstall-autostart-fd:
+	@rm -f /etc/rc0.d/K20bacula-fd
+	@rm -f /etc/rc1.d/S99bacula-fd
+	@rm -f /etc/rc2.d/S99bacula-fd
+	@rm -f /etc/init.d/bacula-fd
+
+
+uninstall-autostart-sd:
+	@rm -f /etc/rc0.d/K20bacula-sd
+	@rm -f /etc/rc1.d/S99bacula-sd
+	@rm -f /etc/rc2.d/S99bacula-sd
+	@rm -f /etc/init.d/bacula-sd
+
+uninstall-autostart-dir:
+	@rm -f /etc/rc0.d/K20bacula-dir
+	@rm -f /etc/rc1.d/S99bacula-dir
+	@rm -f /etc/rc2.d/S99bacula-dir
+	@rm -f /etc/init.d/bacula-dir
 
 clean:
 	@rm -f 1 2 3
diff --git a/platforms/solaris/bacula-dir.in b/platforms/solaris/bacula-dir.in
index 84df47e..bc78e59 100755
--- a/platforms/solaris/bacula-dir.in
+++ b/platforms/solaris/bacula-dir.in
@@ -1,5 +1,8 @@
 #!/bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula       This shell script takes care of starting and stopping
 #	       the bacula Director daemon
 #
@@ -15,12 +18,12 @@ DIR_OPTIONS=''
 case "$1" in
     start)
        if [ ! -z "${DIR_USER}" ]; then
-          [ -z "${DIR_OPTIONS}" ] && DIR_OPTIONS="-u ${DIR_USER}" || \
-                                     DIR_OPTIONS="${DIR_OPTIONS} -u ${DIR_USER}"
+	  [ -z "${DIR_OPTIONS}" ] && DIR_OPTIONS="-u ${DIR_USER}" || \
+				     DIR_OPTIONS="${DIR_OPTIONS} -u ${DIR_USER}"
        fi
        if [ ! -z "${DIR_GROUP}" ]; then
-          [ -z "${DIR_OPTIONS}" ] && DIR_OPTIONS="-g ${DIR_GROUP}" || \
-                                     DIR_OPTIONS="${DIR_OPTIONS} -g ${DIR_GROUP}"
+	  [ -z "${DIR_OPTIONS}" ] && DIR_OPTIONS="-g ${DIR_GROUP}" || \
+				     DIR_OPTIONS="${DIR_OPTIONS} -g ${DIR_GROUP}"
        fi
 
        echo "Starting the Bacula Director: "
@@ -29,16 +32,16 @@ case "$1" in
     stop)
        echo "Stopping the Director daemon: "
        if [ -x /usr/bin/zonename ]; then
-          case `/usr/bin/zonename` in
-             global)
-                pkill -z global -x bacula-dir
-                ;;
-             *)
-                pkill -x bacula-dir
-                ;;
-          esac
+	  case `/usr/bin/zonename` in
+	     global)
+		pkill -z global -x bacula-dir
+		;;
+	     *)
+		pkill -x bacula-dir
+		;;
+	  esac
        else
-          pkill -x bacula-dir
+	  pkill -x bacula-dir
        fi
        ;;
     restart)
diff --git a/platforms/solaris/bacula-fd.in b/platforms/solaris/bacula-fd.in
index a9eb204..36fb431 100755
--- a/platforms/solaris/bacula-fd.in
+++ b/platforms/solaris/bacula-fd.in
@@ -1,5 +1,8 @@
 #!/bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula       This shell script takes care of starting and stopping
 #	       the bacula File daemon.
 #
@@ -15,12 +18,12 @@ FD_OPTIONS=''
 case "$1" in
     start)
        if [ ! -z "${DIR_USER}" ]; then
-          [ -z "${DIR_OPTIONS}" ] && DIR_OPTIONS="-u ${DIR_USER}" || \
-                                     DIR_OPTIONS="${DIR_OPTIONS} -u ${DIR_USER}"
+	  [ -z "${DIR_OPTIONS}" ] && DIR_OPTIONS="-u ${DIR_USER}" || \
+				     DIR_OPTIONS="${DIR_OPTIONS} -u ${DIR_USER}"
        fi
        if [ ! -z "${DIR_GROUP}" ]; then
-          [ -z "${DIR_OPTIONS}" ] && DIR_OPTIONS="-g ${DIR_GROUP}" || \
-                                     DIR_OPTIONS="${DIR_OPTIONS} -g ${DIR_GROUP}"
+	  [ -z "${DIR_OPTIONS}" ] && DIR_OPTIONS="-g ${DIR_GROUP}" || \
+				     DIR_OPTIONS="${DIR_OPTIONS} -g ${DIR_GROUP}"
        fi
 
        echo "Starting the Bacula File daemon: "
@@ -29,16 +32,16 @@ case "$1" in
     stop)
        echo "Stopping the Bacula File daemon: "
        if [ -x /usr/bin/zonename ]; then
-          case `/usr/bin/zonename` in
-             global)
-                pkill -z global -x bacula-fd
-                ;;
-             *)
-                pkill -x bacula-fd
-                ;;
-          esac
+	  case `/usr/bin/zonename` in
+	     global)
+		pkill -z global -x bacula-fd
+		;;
+	     *)
+		pkill -x bacula-fd
+		;;
+	  esac
        else
-          pkill -x bacula-fd
+	  pkill -x bacula-fd
        fi
        ;;
     restart)
diff --git a/platforms/solaris/bacula-sd.in b/platforms/solaris/bacula-sd.in
index 752579e..9ffff5c 100755
--- a/platforms/solaris/bacula-sd.in
+++ b/platforms/solaris/bacula-sd.in
@@ -1,5 +1,8 @@
 #!/bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula       This shell script takes care of starting and stopping
 #	       the bacula Storage daemon.
 #
@@ -15,12 +18,12 @@ SD_OPTIONS=''
 case "$1" in
     start)
        if [ ! -z "${DIR_USER}" ]; then
-          [ -z "${DIR_OPTIONS}" ] && DIR_OPTIONS="-u ${DIR_USER}" || \
-                                     DIR_OPTIONS="${DIR_OPTIONS} -u ${DIR_USER}"
+	  [ -z "${DIR_OPTIONS}" ] && DIR_OPTIONS="-u ${DIR_USER}" || \
+				     DIR_OPTIONS="${DIR_OPTIONS} -u ${DIR_USER}"
        fi
        if [ ! -z "${DIR_GROUP}" ]; then
-          [ -z "${DIR_OPTIONS}" ] && DIR_OPTIONS="-g ${DIR_GROUP}" || \
-                                     DIR_OPTIONS="${DIR_OPTIONS} -g ${DIR_GROUP}"
+	  [ -z "${DIR_OPTIONS}" ] && DIR_OPTIONS="-g ${DIR_GROUP}" || \
+				     DIR_OPTIONS="${DIR_OPTIONS} -g ${DIR_GROUP}"
        fi
 
        echo "Starting the Bacula Storage daemon: "
@@ -29,16 +32,16 @@ case "$1" in
     stop)
        echo "Stopping the Bacula Storage daemon: "
        if [ -x /usr/bin/zonename ]; then
-          case `/usr/bin/zonename` in
-             global)
-                pkill -z global -x bacula-sd
-                ;;
-             *)
-                pkill -x bacula-sd
-                ;;
-          esac
+	  case `/usr/bin/zonename` in
+	     global)
+		pkill -z global -x bacula-sd
+		;;
+	     *)
+		pkill -x bacula-sd
+		;;
+	  esac
        else
-          pkill -x bacula-sd
+	  pkill -x bacula-sd
        fi
        ;;
     restart)
diff --git a/platforms/solaris/copyright b/platforms/solaris/copyright
index 1660acf..ee235b2 100644
--- a/platforms/solaris/copyright
+++ b/platforms/solaris/copyright
@@ -1,28 +1,18 @@
 
-   Bacula - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2000-2006 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from
-   many others, a complete list can be found in the file AUTHORS.
-   This program is Free Software; you can redistribute it and/or
-   modify it under the terms of version two of the GNU General Public
-   License as published by the Free Software Foundation, a copy of which
-   is in the LICENSE file
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-   02110-1301, USA.
-
-   Bacula is a registered trademark of John Walker.
-   The licensor of Bacula is the Free Software Foundation Europe
-   (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 ZC<rich,
-   Switzerland, email:ftf at fsfeurope.org.
+   You may use this file and others of this release according to the
+   license defined in the LICENSE file, which includes the Affero General
+   Public License, v3.0 ("AGPLv3") and some additional permissions and
+   terms pursuant to its AGPLv3 Section 7.
 
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
 
+   Bacula(R) is a registered trademark of Kern Sibbald.
diff --git a/platforms/suse/Makefile.in b/platforms/suse/Makefile.in
index f4bbc67..cb782dd 100644
--- a/platforms/suse/Makefile.in
+++ b/platforms/suse/Makefile.in
@@ -1,3 +1,6 @@
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 # 
 # This file is used as the template to create the
 # Makefile for the SuSe specific installation.
diff --git a/platforms/suse/bacula-dir.in b/platforms/suse/bacula-dir.in
index fc995cb..16e9edd 100755
--- a/platforms/suse/bacula-dir.in
+++ b/platforms/suse/bacula-dir.in
@@ -1,5 +1,8 @@
 #! /bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula       This shell script takes care of starting and stopping
 #	       the bacula Director daemon
 #
@@ -7,17 +10,15 @@
 # description: The Leading Open Source Backup Solution.
 #
 #  For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@
-# Copyright (C) 2011 Free Software Foundation Europe e.V.
 # Modified to work on SuSE 1/31/2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
 # Added rc.status functions 3/13/2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
 # Added LSB init info 10/14/2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
-# Added $remote_fs, add bacula specific daemon user & group Bruno Friedmann <bruno at ioda-net.ch>
 #
 ### BEGIN INIT INFO
 # Provides:			bacula-dir
-# Required-Start:	$local_fs $remote_fs $network
-# Required-Stop:	$local_fs $remote_fs $network
-# Default-Start:	3 5
+# Required-Start:		$local_fs $network @DEFAULT_DB_TYPE@
+# Required-Stop:		$local_fs $network @DEFAULT_DB_TYPE@
+# Default-Start:		3 5
 # Default-Stop: 	0 1 2 6
 # Short-Description:	bacula director
 # Description:			Bacula network backup system director daemon
@@ -31,7 +32,7 @@ RETVAL=0
 case "$1" in
     start)
        echo -n "Starting the Bacula Director: "
-       /sbin/startproc @sbindir@/bacula-dir $2 -u @dir_user@ -g @dir_group@ -c @sysconfdir@/bacula-dir.conf
+       /sbin/startproc @sbindir@/bacula-dir $2 -c @sysconfdir@/bacula-dir.conf
        RETVAL=$?
        rc_status -v
        echo
@@ -49,6 +50,7 @@ case "$1" in
        $0 stop
        sleep 5
        $0 start
+       RETVAL=$?
        ;;
     status)
        /sbin/checkproc @sbindir@/bacula-dir
diff --git a/platforms/suse/bacula-fd.in b/platforms/suse/bacula-fd.in
index e8618dd..b1c770f 100755
--- a/platforms/suse/bacula-fd.in
+++ b/platforms/suse/bacula-fd.in
@@ -1,5 +1,8 @@
 #! /bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula       This shell script takes care of starting and stopping
 #	       the bacula File daemon.
 #
@@ -7,17 +10,15 @@
 # description: The Leading Open Source Backup Solution.
 #
 #  For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@
-# Copyright (C) 2011 Free Software Foundation Europe e.V.
 # Modified to work on SuSE 1/31/2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
 # Added rc.status functions 3/13/2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
 # Added LSB init info 10/14/2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
-# Added $remote_fs, add bacula specific daemon user & group Bruno Friedmann <bruno at ioda-net.ch>
 #
 ### BEGIN INIT INFO
 # Provides:			bacula-fd
-# Required-Start:	$local_fs $remote_fs $network
-# Required-Stop:	$local_fs $remote_fs $network
-# Default-Start:	3 5
+# Required-Start:		$local_fs $network
+# Required-Stop:		$local_fs $network
+# Default-Start:		3 5
 # Default-Stop: 	0 1 2 6
 # Short-Description:	bacula file daemon
 # Description:			Bacula network backup system file daemon
@@ -27,10 +28,11 @@
 # this gives us funtion rc_status -v to tell us if we succeed or fail
 . /etc/rc.status
 
+RETVAL=0
 case "$1" in
     start)
        echo -n "Starting the Bacula File daemon: "
-       /sbin/startproc @sbindir@/bacula-fd $2 -u @fd_user@  -g @fd_group@  -c @sysconfdir@/bacula-fd.conf
+       /sbin/startproc @sbindir@/bacula-fd $2 -c @sysconfdir@/bacula-fd.conf
        RETVAL=$?
        rc_status -v
        echo
@@ -48,6 +50,7 @@ case "$1" in
        $0 stop
        sleep 5
        $0 start
+       RETVAL=$?
        ;;
     status)
        /sbin/checkproc @sbindir@/bacula-fd
diff --git a/platforms/suse/bacula-sd.in b/platforms/suse/bacula-sd.in
index 7a61784..0444ff4 100755
--- a/platforms/suse/bacula-sd.in
+++ b/platforms/suse/bacula-sd.in
@@ -1,5 +1,8 @@
 #! /bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula       This shell script takes care of starting and stopping
 #	       the bacula Storage daemon.
 #
@@ -7,16 +10,14 @@
 # description: The Leading Open Source Backup Solution.
 #
 #  For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@
-# Copyright (C) 2011 Free Software Foundation Europe e.V.
 # Modified to work on SuSE 1/31/2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
 # Added rc.status functions 3/13/2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
 # Added LSB init info 10/14/2004 D. Scott Barninger <barninger at fairfieldcomputers.com>
-# Added $remote_fs, add bacula specific daemon user & group Bruno Friedmann <bruno at ioda-net.ch>
 #
 ### BEGIN INIT INFO
 # Provides:			bacula-sd
-# Required-Start:		$local_fs $remote_fs $network
-# Required-Stop:		$local_fs $remote_fs $network
+# Required-Start:		$local_fs $network
+# Required-Stop:		$local_fs $network
 # Default-Start:		3 5
 # Default-Stop: 	0 1 2 6
 # Short-Description:	bacula storage daemon
@@ -27,10 +28,11 @@
 # this gives us funtion rc_status -v to tell us if we succeed or fail
 . /etc/rc.status
 
+RETVAL=0
 case "$1" in
     start)
        echo -n "Starting the Bacula Storage daemon: "
-       /sbin/startproc @sbindir@/bacula-sd $2 -u @sd_user@ -g @sd_group@ -c @sysconfdir@/bacula-sd.conf
+       /sbin/startproc @sbindir@/bacula-sd $2 -c @sysconfdir@/bacula-sd.conf
        RETVAL=$?
        rc_status -v
        echo
@@ -48,6 +50,7 @@ case "$1" in
        $0 stop
        sleep 5
        $0 start
+       RETVAL=$?
        ;;
     status)
        /sbin/checkproc @sbindir@/bacula-sd
diff --git a/platforms/suse/bacula.in b/platforms/suse/bacula.in
index 6907794..2bd9685 100644
--- a/platforms/suse/bacula.in
+++ b/platforms/suse/bacula.in
@@ -1,5 +1,8 @@
 #! /bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula       This shell script takes care of starting and stopping
 #	       the bacula daemons.
 #
diff --git a/platforms/systemd/Makefile.in b/platforms/systemd/Makefile.in
index c3da39c..37c257d 100644
--- a/platforms/systemd/Makefile.in
+++ b/platforms/systemd/Makefile.in
@@ -1,4 +1,7 @@
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # This file is used as the template to create the
 # Makefile for the systemd specific installation.
 #
@@ -17,52 +20,56 @@ nothing:
 
 install: install-dir install-conf install-autostart
 
-install-dir: $(DESTDIR)/$(SYSTEMD_UNITDIR)
-	mkdir -p $(DESTDIR)/$(SYSTEMD_UNITDIR) $(DESTDIR)/$(SYSTEMD_TMPFILES)
+install-dir:
+        mkdir -p $(DESTDIR)/$(SYSTEMD_UNITDIR) $(DESTDIR)/$(SYSTEMD_TMPFILES)
 
 install-conf:
-	@$(INSTALL_PROGRAM) -m 644 bacula.conf $(DESTDIR)/$(SYSTEMD_TMPFILES)/bacula.conf
+        @$(INSTALL_PROGRAM) -m 644 bacula.conf $(DESTDIR)/$(SYSTEMD_TMPFILES)/bacula.conf
 
 install-autostart: install-autostart-fd install-autostart-sd install-autostart-dir
 
+install-service:
+        @$(INSTALL_PROGRAM) -m 644 bacula-fd.service $(DESTDIR)/$(SYSTEMD_UNITDIR)
+        @$(INSTALL_PROGRAM) -m 644 bacula-dir.service $(DESTDIR)/$(SYSTEMD_UNITDIR)
+        @$(INSTALL_PROGRAM) -m 644 bacula-sd.service $(DESTDIR)/$(SYSTEMD_UNITDIR)
 
 install-autostart-fd:
-	@if test x$(DESTDIR) = x -a  -f $(SYSTEMD_UNITDIR)/bacula-fd.service; then \
-	   /bin/systemctl stop bacula-fd.service; \
-	   /bin/systemctl disable bacula-fd.service; \
-	fi
-	@$(INSTALL_PROGRAM) -m 644 bacula-fd.service $(DESTDIR)/$(SYSTEMD_UNITDIR)/bacula-fd.service
-	# set symlinks for script at startup and shutdown
-	@if test x$(DESTDIR) = x ; then \
-	   /bin/systemctl enable bacula-fd.service; \
-	   /bin/systemctl start bacula-fd.service; \
-	fi
+        @if test x$(DESTDIR) = x -a  -f $(SYSTEMD_UNITDIR)/bacula-fd.service; then \
+           /bin/systemctl stop bacula-fd.service; \
+           /bin/systemctl disable bacula-fd.service; \
+        fi
+        @$(INSTALL_PROGRAM) -m 644 bacula-fd.service $(DESTDIR)/$(SYSTEMD_UNITDIR)/bacula-fd.service
+        # set symlinks for script at startup and shutdown
+        @if test x$(DESTDIR) = x ; then \
+           /bin/systemctl enable bacula-fd.service; \
+           /bin/systemctl start bacula-fd.service; \
+        fi
 
 
 install-autostart-sd:
-	@if test x$(DESTDIR) = x -a  -f $(SYSTEMD_UNITDIR)/bacula-sd.service; then \
-	   /bin/systemctl stop bacula-sd.service; \
-	   /bin/systemctl disable bacula-sd.service; \
-	fi
-	@$(INSTALL_PROGRAM) -m 644 bacula-sd.service $(DESTDIR)/$(SYSTEMD_UNITDIR)/bacula-sd.service
-	# set symlinks for script at startup and shutdown
-	@if test x$(DESTDIR) = x ; then \
-	   /bin/systemctl enable bacula-sd.service; \
-	   /bin/systemctl start bacula-sd.service; \
-	fi
+        @if test x$(DESTDIR) = x -a  -f $(SYSTEMD_UNITDIR)/bacula-sd.service; then \
+           /bin/systemctl stop bacula-sd.service; \
+           /bin/systemctl disable bacula-sd.service; \
+        fi
+        @$(INSTALL_PROGRAM) -m 644 bacula-sd.service $(DESTDIR)/$(SYSTEMD_UNITDIR)/bacula-sd.service
+        # set symlinks for script at startup and shutdown
+        @if test x$(DESTDIR) = x ; then \
+           /bin/systemctl enable bacula-sd.service; \
+           /bin/systemctl start bacula-sd.service; \
+        fi
 
 
 install-autostart-dir:
-	@if test x$(DESTDIR) = x -a  -f $(SYSTEMD_UNITDIR)/bacula-dir.service; then \
-	   /bin/systemctl stop bacula-dir.service; \
-	   /bin/systemctl disable bacula-dir.service; \
-	fi
-	@$(INSTALL_PROGRAM) -m 644 bacula-dir.service $(DESTDIR)/$(SYSTEMD_UNITDIR)/bacula-dir.service
-	# set symlinks for script at startup and shutdown
-	@if test x$(DESTDIR) = x ; then \
-	   /bin/systemctl enable bacula-dir.service; \
-	   /bin/systemctl start bacula-dir.service; \
-	fi
+        @if test x$(DESTDIR) = x -a  -f $(SYSTEMD_UNITDIR)/bacula-dir.service; then \
+           /bin/systemctl stop bacula-dir.service; \
+           /bin/systemctl disable bacula-dir.service; \
+        fi
+        @$(INSTALL_PROGRAM) -m 644 bacula-dir.service $(DESTDIR)/$(SYSTEMD_UNITDIR)/bacula-dir.service
+        # set symlinks for script at startup and shutdown
+        @if test x$(DESTDIR) = x ; then \
+           /bin/systemctl enable bacula-dir.service; \
+           /bin/systemctl start bacula-dir.service; \
+        fi
 
 
 uninstall: uninstall-autostart uninstall-conf
@@ -70,38 +77,37 @@ uninstall: uninstall-autostart uninstall-conf
 uninstall-autostart: uninstall-autostart-fd uninstall-autostart-sd uninstall-autostart-dir
 
 uninstall-autostart-fd:
-	@if test x$(DESTDIR) = x -a  -f $(SYSTEMD_UNITDIR)/bacula-fd.service; then \
-	   /bin/systemctl stop bacula-fd.service; \
-	   /bin/systemctl disable bacula-fd.service; \
-	fi
-	@rm -f	$(DESTDIR)$(SYSTEMD_UNITDIR)/bacula-fd.service
+        @if test x$(DESTDIR) = x -a  -f $(SYSTEMD_UNITDIR)/bacula-fd.service; then \
+           /bin/systemctl stop bacula-fd.service; \
+           /bin/systemctl disable bacula-fd.service; \
+        fi
+        @rm -f  $(DESTDIR)$(SYSTEMD_UNITDIR)/bacula-fd.service
 
 
 uninstall-autostart-sd:
-	@if test x$(DESTDIR) = x -a  -f $(SYSTEMD_UNITDIR)/bacula-sd.service; then \
-	   /bin/systemctl stop bacula-fd.service; \
-	   /bin/systemctl disable bacula-fd.service; \
-	fi
-	@rm -f	$(DESTDIR)$(SYSTEMD_UNITDIR)/bacula-sd.service
+        @if test x$(DESTDIR) = x -a  -f $(SYSTEMD_UNITDIR)/bacula-sd.service; then \
+           /bin/systemctl stop bacula-fd.service; \
+           /bin/systemctl disable bacula-fd.service; \
+        fi
+        @rm -f  $(DESTDIR)$(SYSTEMD_UNITDIR)/bacula-sd.service
 
 uninstall-autostart-dir:
-	@if test x$(DESTDIR) = x -a  -f $(SYSTEMD)/bacula-dir.service; then \
-	   /bin/systemctl stop bacula-dir.service; \
-	   /bin/systemctl disable bacula-dir.service; \
-	fi
-	@rm -f	$(DESTDIR)$(SYSTEMD_UNITDIR)/bacula-dir.service
+        @if test x$(DESTDIR) = x -a  -f $(SYSTEMD)/bacula-dir.service; then \
+           /bin/systemctl stop bacula-dir.service; \
+           /bin/systemctl disable bacula-dir.service; \
+        fi
+        @rm -f  $(DESTDIR)$(SYSTEMD_UNITDIR)/bacula-dir.service
 
 uninstall-conf:
-	@rm -f	$(DESTDIR)/$(SYSTEMD_TMPFILES)/bacula.conf
+        @rm -f  $(DESTDIR)/$(SYSTEMD_TMPFILES)/bacula.conf
 
 clean:
-	@rm -f 1 2 3
+        @rm -f 1 2 3
 
 distclean: clean
-	@rm -f Makefile bacula-*.spec bacula.*.spec bacula.spec
-	@rm -f bacula.conf bacula-sd.service bacula-fd.service bacula-dir.service
+        @rm -f Makefile bacula-*.spec bacula.*.spec bacula.spec
+        @rm -f bacula.conf bacula-sd.service bacula-fd.service bacula-dir.service
 
 devclean: clean
-	@rm -f Makefile bacula-*.spec bacula.*.spec bacula.spec
-	@rm -f bacula.conf bacula-sd.service bacula-fd.service bacula-dir.service
-
+        @rm -f Makefile bacula-*.spec bacula.*.spec bacula.spec
+        @rm -f bacula.conf bacula-sd.service bacula-fd.service bacula-dir.service
diff --git a/platforms/systemd/bacula-dir.service.in b/platforms/systemd/bacula-dir.service.in
index 9a82532..28995ad 100644
--- a/platforms/systemd/bacula-dir.service.in
+++ b/platforms/systemd/bacula-dir.service.in
@@ -1,39 +1,35 @@
-# This file is part of package Bacula Director Daemon
+# Systemd Bacula service file
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+# /lib/systemd/system/bacula-dir.service
 #
-# Copyright (c) 2011 Free Software Foundation Europe e.V.
-# Bacula Community
-# Author: Bruno Friedmann
 # Description:
-#    Used to start the bacula director daemon service (bacula-dir)
-#     will be installed as /lib/systemd/system/bacula-dir.service
-#    enable : systemctl enable bacula-dir.service
-#	 start : systemctl start bacula-dir.service
+#    Used to start/stop/reload the bacula director daemon service (bacula-dir)
+#
+#    enable : systemctl enable bacula-dir
+#    start : systemctl start bacula-dir
 #
-# Bacula Director Daemon service
 #
+
+# From http://www.freedesktop.org/software/systemd/man/systemd.unit.html
 [Unit]
 Description=Bacula Director Daemon service
-Alias=bacula-dir
-Requires=var-run.mount nss-lookup.target network.target remote-fs.target syslog.target time-sync.target
-After=var-run.mount nss-lookup.target network.target remote-fs.target syslog.target time-sync.target
-# Dependency about the database
-# We let administrators decide if they need it (if local db instance)
-# Wants=@DEFAULT_DB_TYPE at .service
-# Check if working dir exist and is a directory
-ConditionPathIsDirectory=@working_dir@
-# Before=
-# Conflicts=
+Requires=network.target
+After=network.target
+RequiresMountsFor=@working_dir@ @sysconfdir@ @sbindir@ @piddir@
 
+# From http://www.freedesktop.org/software/systemd/man/systemd.service.html
 [Service]
 Type=forking
 User=@dir_user@
 Group=@dir_group@
-PIDFile=@piddir@/bacula-dir. at dir_port@.pid
-# EnvironmentFile=-/etc/sysconfig/bacula-dir
-StandardOutput=syslog
 ExecStart=@sbindir@/bacula-dir -c @sysconfdir@/bacula-dir.conf
-# This daemon should be able to reload the conf file
-#ExecReload=/sbin/killproc -p @piddir@/bacula-dir.pid -HUP @sbindir@/bacula-dir
+PIDFile=@piddir@/bacula-dir. at dir_port@.pid
+ExecReload=@sbindir@/bacula-dir -t -c @sysconfdir@/bacula-dir.conf
+ExecReload=/bin/kill -HUP $MAINPID
+StandardError=syslog
 
 [Install]
 WantedBy=multi-user.target
diff --git a/platforms/systemd/bacula-fd.service.in b/platforms/systemd/bacula-fd.service.in
index 3efb256..456ea1d 100644
--- a/platforms/systemd/bacula-fd.service.in
+++ b/platforms/systemd/bacula-fd.service.in
@@ -1,31 +1,33 @@
-# This file is part of package Bacula File Daemon
+# Systemd Bacula service file
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+# /lib/systemd/system/bacula-fd.service
 #
-# Copyright (c) 2011 Free Software Foundation Europe e.V.
-# Bacula Community
-# Author: Bruno Friedmann
 # Description:
 #    Used to start the bacula file daemon service (bacula-fd)
-#    will be installed as /lib/systemd/system/bacula-fd.service
-#    enable : systemctl enable bacula-fd.service
-#	 start : systemctl start bacula-fd.service
 #
-# Bacula File Daemon service
+#    enable : systemctl enable bacula-fd
+#    start : systemctl start bacula-fd
+#
 #
+
+# from http://www.freedesktop.org/software/systemd/man/systemd.unit.html
 [Unit]
 Description=Bacula File Daemon service
-Requires=var-run.mount nss-lookup.target network.target remote-fs.target syslog.target time-sync.target
-After=var-run.mount nss-lookup.target network.target remote-fs.target syslog.target time-sync.target
-# Wants=
-# Before=
-# Conflicts=
+Requires=network.target
+After=network.target
+RequiresMountsFor=@working_dir@ @sysconfdir@ @sbindir@ @piddir@
 
+# from http://www.freedesktop.org/software/systemd/man/systemd.service.html
 [Service]
 Type=forking
 User=@fd_user@
 Group=@fd_group@
-PIDFile=@piddir@/bacula-fd. at fd_port@.pid
-StandardOutput=syslog
 ExecStart=@sbindir@/bacula-fd -c @sysconfdir@/bacula-fd.conf
+PIDFile=@piddir@/bacula-fd. at fd_port@.pid
+StandardError=syslog
 
 [Install]
 WantedBy=multi-user.target
diff --git a/platforms/systemd/bacula-sd.service.in b/platforms/systemd/bacula-sd.service.in
index 2d4dc1a..9663f74 100644
--- a/platforms/systemd/bacula-sd.service.in
+++ b/platforms/systemd/bacula-sd.service.in
@@ -1,32 +1,32 @@
-# This file is part of package Bacula Storage Daemon
+# Systemd Bacula service file
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+# /lib/systemd/system/bacula-sd.service
 #
-# Copyright (c) 2011 Free Software Foundation Europe e.V.
-# for Bacula Community
-# Author: Bruno Friedmann
 # Description:
 #    Used to start the bacula storage daemon service (bacula-sd)
-#    will be installed as /lib/systemd/system/bacula-sd.service
-#    enable : systemctl enable bacula-sd.service
-#    start : systemctl start bacula-sd.service
+#    enable : systemctl enable bacula-sd
+#    start : systemctl start bacula-sd
 #
-# Bacula Storage Daemon service
 #
+
+# from http://www.freedesktop.org/software/systemd/man/systemd.unit.html
 [Unit]
 Description=Bacula Storage Daemon service
-Requires=var-run.mount nss-lookup.target network.target remote-fs.target syslog.target time-sync.target
-After=var-run.mount nss-lookup.target network.target remote-fs.target syslog.target time-sync.target
-# Wants=
-# Before=
-# Conflicts=
+Requires=network.target
+After=network.target
+RequiresMountsFor=@working_dir@ @sysconfdir@ @sbindir@ @piddir@
 
+# from http://www.freedesktop.org/software/systemd/man/systemd.service.html
 [Service]
 Type=forking
 User=@sd_user@
 Group=@sd_group@
-PIDFile=@piddir@/bacula-sd. at sd_port@.pid
-# EnvironmentFile=-/etc/sysconfig/bacula-sd
-StandardOutput=syslog
 ExecStart=@sbindir@/bacula-sd -c @sysconfdir@/bacula-sd.conf
+PIDFile=@piddir@/bacula-sd. at sd_port@.pid
+StandardError=syslog
 
 [Install]
 WantedBy=multi-user.target
diff --git a/platforms/systemd/bacula.conf.in b/platforms/systemd/bacula.conf.in
deleted file mode 100644
index 8a8b4a6..0000000
--- a/platforms/systemd/bacula.conf.in
+++ /dev/null
@@ -1,2 +0,0 @@
-# See tmpfiles.d(5) for details
-d @piddir@ 2775 bacula bacula -
diff --git a/platforms/ubuntu/Makefile.in b/platforms/ubuntu/Makefile.in
index aa77f36..7f0aa2d 100644
--- a/platforms/ubuntu/Makefile.in
+++ b/platforms/ubuntu/Makefile.in
@@ -1,3 +1,6 @@
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 # 
 # This file is used as the template to create the
 # Makefile for the Debian/Ubuntu/Kubuntu specific installation.
diff --git a/platforms/ubuntu/bacula-dir.in b/platforms/ubuntu/bacula-dir.in
index c7d9964..798d49e 100644
--- a/platforms/ubuntu/bacula-dir.in
+++ b/platforms/ubuntu/bacula-dir.in
@@ -1,5 +1,8 @@
 #! /bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula  This shell script takes care of starting and stopping
 #	  the bacula Director daemon on Debian/Ubuntu/Kubuntu 
 #	  systems. 
@@ -56,6 +59,7 @@ if [ "x${BUSER}" != "x" ]; then
    fi
 fi
 
+RETVAL=0
 case "$1" in
    start)
       echo -n "Starting ${DESC}: "
@@ -73,6 +77,7 @@ case "$1" in
       $0 stop
       sleep 5
       $0 start
+      RETVAL=$?
       ;;
    *)
       echo "Usage: /etc/init.d/${NAME} {start|stop|restart|force-reload}" >&2
diff --git a/platforms/ubuntu/bacula-fd.in b/platforms/ubuntu/bacula-fd.in
index 9fb7aff..ebdb4bf 100644
--- a/platforms/ubuntu/bacula-fd.in
+++ b/platforms/ubuntu/bacula-fd.in
@@ -1,5 +1,8 @@
 #! /bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula  This shell script takes care of starting and stopping
 #	  the bacula Director daemon on Debian/Ubuntu/Kubuntu 
 #	  systems. 
@@ -56,6 +59,7 @@ if [ "x${BUSER}" != "x" ]; then
    fi
 fi
 
+RETVAL=0
 case "$1" in
    start)
       echo -n "Starting ${DESC}: "
@@ -73,6 +77,7 @@ case "$1" in
       $0 stop
       sleep 5
       $0 start
+      RETVAL=$?
       ;;
    *)
       echo "Usage: /etc/init.d/${NAME} {start|stop|restart|force-reload}" >&2
diff --git a/platforms/ubuntu/bacula-sd.in b/platforms/ubuntu/bacula-sd.in
index e778ea9..16763b7 100644
--- a/platforms/ubuntu/bacula-sd.in
+++ b/platforms/ubuntu/bacula-sd.in
@@ -1,5 +1,8 @@
 #! /bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula  This shell script takes care of starting and stopping
 #	  the bacula Director daemon on Debian/Ubuntu/Kubuntu 
 #	  systems. 
@@ -56,6 +59,7 @@ if [ "x${BUSER}" != "x" ]; then
    fi
 fi
 
+RETVAL=0
 case "$1" in
    start)
       echo -n "Starting ${DESC}: "
@@ -73,6 +77,7 @@ case "$1" in
       $0 stop
       sleep 5
       $0 start
+      RETVAL=$?
       ;;
    *)
       echo "Usage: /etc/init.d/${NAME} {start|stop|restart|force-reload}" >&2
diff --git a/platforms/unknown/Makefile.in b/platforms/unknown/Makefile.in
index 124b381..519527b 100644
--- a/platforms/unknown/Makefile.in
+++ b/platforms/unknown/Makefile.in
@@ -1,3 +1,6 @@
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 # 
 # This file is used as the template to create the
 # Makefile for the unknown specific installation.
diff --git a/po/POTFILES.in b/po/POTFILES.in
index b5e4e33..acb359e 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -2,19 +2,17 @@
 # To generate this file, type 'make gen-potfiles'
 autoconf/acconfig.h
 autoconf/confdefs.h
-examples/nagios/check_bacula/check_bacula.h
 src/baconfig.h
 src/bacula.h
 src/bc_types.h
+src/cats/bdb.h
 src/cats/bdb_mysql.h
 src/cats/bdb_postgresql.h
-src/cats/bdb_priv.h
 src/cats/bdb_sqlite.h
 src/cats/bvfs.h
 src/cats/cats.h
 src/cats/protos.h
 src/cats/sql_cmds.h
-src/cats/sql_glue.h
 src/ch.h
 src/console/conio.h
 src/console/console_conf.h
@@ -27,7 +25,9 @@ src/dird/jobq.h
 src/dird/protos.h
 src/dird/ua.h
 src/filed/acl.h
+src/filed/backup.h
 src/filed/fd_plugins.h
+src/filed/fd_snapshot.h
 src/filed/filed.h
 src/filed/filed_conf.h
 src/filed/protos.h
@@ -38,12 +38,14 @@ src/filetypes.h
 src/findlib/bfile.h
 src/findlib/find.h
 src/findlib/protos.h
+src/findlib/savecwd.h
 src/jcr.h
 src/lib/address_conf.h
 src/lib/alist.h
 src/lib/attr.h
 src/lib/base64.h
 src/lib/berrno.h
+src/lib/bget_msg.h
 src/lib/bits.h
 src/lib/bmtio.h
 src/lib/bpipe.h
@@ -65,7 +67,6 @@ src/lib/lockmgr.h
 src/lib/md5.h
 src/lib/mem_pool.h
 src/lib/message.h
-src/lib/mntent_cache.h
 src/lib/mutex_list.h
 src/lib/openssl.h
 src/lib/parse_conf.h
@@ -88,6 +89,7 @@ src/lib/waitq.h
 src/lib/watchdog.h
 src/lib/workq.h
 src/plugins/fd/fd_common.h
+src/plugins/sd/sd_common.h
 src/qt-console/bat.h
 src/qt-console/bat_conf.cpp
 src/qt-console/bat_conf.h
@@ -175,6 +177,7 @@ src/qt-console/util/comboutil.h
 src/qt-console/util/fmtwidgetitem.cpp
 src/qt-console/util/fmtwidgetitem.h
 src/qt-console/win32/qplatformdefs.h
+src/stored/bitarray.h
 src/stored/block.h
 src/stored/bsr.h
 src/stored/dev.h
@@ -190,5 +193,4 @@ src/stored/tape_dev.h
 src/stored/vol_mgr.h
 src/stored/vtape_dev.h
 src/streams.h
-src/tools/assert_macro.h
 src/version.h
diff --git a/po/bacula.pot b/po/bacula.pot
index faf9132..d023595 100644
--- a/po/bacula.pot
+++ b/po/bacula.pot
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: bacula-devel at lists.sourceforge.net\n"
-"POT-Creation-Date: 2014-07-29 18:18+0200\n"
+"POT-Creation-Date: 2015-08-09 15:05+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -17,232 +17,237 @@ msgstr ""
 "Content-Type: text/plain; charset=CHARSET\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-#: src/baconfig.h:60 src/baconfig.h:61 src/baconfig.h:66 src/baconfig.h:67
+#: src/baconfig.h:64 src/baconfig.h:65 src/baconfig.h:70 src/baconfig.h:71
+#: src/baconfig.h:82 src/baconfig.h:83
 #, c-format
 msgid "Failed ASSERT: %s\n"
 msgstr ""
 
-#: src/baconfig.h:76
+#: src/baconfig.h:91
 msgid "*None*"
 msgstr ""
 
-#: src/lib/status.h:73
+#: src/lib/status.h:78
 msgid ""
 "\n"
 "Terminated Jobs:\n"
 msgstr ""
 
-#: src/lib/status.h:80
+#: src/lib/status.h:85
 msgid " JobId  Level    Files      Bytes   Status   Finished        Name \n"
 msgstr ""
 
-#: src/lib/status.h:82
+#: src/lib/status.h:87
 msgid "===================================================================\n"
 msgstr ""
 
-#: src/lib/status.h:102
+#: src/lib/status.h:107
 msgid "Created"
 msgstr ""
 
-#: src/lib/status.h:106
+#: src/lib/status.h:111
 msgid "Error"
 msgstr ""
 
-#: src/lib/status.h:109
+#: src/lib/status.h:114
 msgid "Diffs"
 msgstr ""
 
-#: src/lib/status.h:112
+#: src/lib/status.h:117
 msgid "Cancel"
 msgstr ""
 
-#: src/lib/status.h:115
+#: src/lib/status.h:120
 msgid "OK"
 msgstr ""
 
-#: src/lib/status.h:118
+#: src/lib/status.h:123
 msgid "OK -- with warnings"
 msgstr ""
 
-#: src/lib/status.h:122
+#: src/lib/status.h:126
+msgid "Incomplete"
+msgstr ""
+
+#: src/lib/status.h:129
 msgid "Other"
 msgstr ""
 
-#: src/lib/status.h:134
+#: src/lib/status.h:141
 #, c-format
 msgid "%6d\t%-6s\t%8s\t%10s\t%-7s\t%-8s\t%s\n"
 msgstr ""
 
-#: src/lib/status.h:142
+#: src/lib/status.h:149
 #, c-format
 msgid "%6d  %-6s %8s %10s  %-7s  %-8s %s\n"
 msgstr ""
 
-#: src/lib/status.h:171 src/lib/status.h:182 src/lib/status.h:196
-#: src/lib/status.h:200 src/lib/status.h:204
+#: src/lib/status.h:178 src/lib/status.h:189 src/lib/status.h:203
+#: src/lib/status.h:207 src/lib/status.h:211
 msgid "Bacula "
 msgstr ""
 
-#: src/qt-console/bat_conf.cpp:130
+#: src/qt-console/bat_conf.cpp:133
 #, c-format
 msgid "No record for %d %s\n"
 msgstr ""
 
-#: src/qt-console/bat_conf.cpp:139
+#: src/qt-console/bat_conf.cpp:142
 #, c-format
 msgid "Director: name=%s address=%s DIRport=%d\n"
 msgstr ""
 
-#: src/qt-console/bat_conf.cpp:143
+#: src/qt-console/bat_conf.cpp:146
 #, c-format
 msgid "Console: name=%s\n"
 msgstr ""
 
-#: src/qt-console/bat_conf.cpp:146
-#: src/qt-console/tray-monitor/tray_conf.cpp:183
+#: src/qt-console/bat_conf.cpp:149
+#: src/qt-console/tray-monitor/tray_conf.cpp:187
 #, c-format
 msgid "ConsoleFont: name=%s font face=%s\n"
 msgstr ""
 
-#: src/qt-console/bat_conf.cpp:150 src/qt-console/bat_conf.cpp:231
-#: src/qt-console/bat_conf.cpp:279 src/qt-console/bat_conf.cpp:309
+#: src/qt-console/bat_conf.cpp:153 src/qt-console/bat_conf.cpp:234
+#: src/qt-console/bat_conf.cpp:284 src/qt-console/bat_conf.cpp:314
 #, c-format
 msgid "Unknown resource type %d\n"
 msgstr ""
 
-#: src/qt-console/bat_conf.cpp:257
-#: src/qt-console/tray-monitor/tray_conf.cpp:276
+#: src/qt-console/bat_conf.cpp:262
+#: src/qt-console/tray-monitor/tray_conf.cpp:280
 #, c-format
 msgid "%s item is required in %s resource, but not found.\n"
 msgstr ""
 
-#: src/qt-console/bat_conf.cpp:326
-#: src/qt-console/tray-monitor/tray_conf.cpp:360
+#: src/qt-console/bat_conf.cpp:331
+#: src/qt-console/tray-monitor/tray_conf.cpp:364
 #, c-format
 msgid "Attempt to define second %s resource named \"%s\" is not permitted.\n"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:85
+#: src/qt-console/bcomm/dircomm.cpp:89
 #, c-format
 msgid "Already connected\"%s\".\n"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:96
-#: src/qt-console/tray-monitor/tray-monitor.cpp:347
+#: src/qt-console/bcomm/dircomm.cpp:100
+#: src/qt-console/tray-monitor/tray-monitor.cpp:353
 #, c-format
 msgid "Connecting to Director %s:%d"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:98
+#: src/qt-console/bcomm/dircomm.cpp:102
 #, c-format
 msgid ""
 "Connecting to Director %s:%d\n"
 "\n"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:150
+#: src/qt-console/bcomm/dircomm.cpp:154
 #, c-format
 msgid "Failed to initialize TLS context for Console \"%s\".\n"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:173
+#: src/qt-console/bcomm/dircomm.cpp:177
 #, c-format
 msgid "Failed to initialize TLS context for Director \"%s\".\n"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:195
-#: src/qt-console/tray-monitor/tray-monitor.cpp:352
+#: src/qt-console/bcomm/dircomm.cpp:199
+#: src/qt-console/tray-monitor/tray-monitor.cpp:358
 msgid "Director daemon"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:233
+#: src/qt-console/bcomm/dircomm.cpp:237
 msgid "Initializing ..."
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:249 src/qt-console/console/console.cpp:130
+#: src/qt-console/bcomm/dircomm.cpp:253 src/qt-console/console/console.cpp:134
 msgid "Connected"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:373
+#: src/qt-console/bcomm/dircomm.cpp:377
 msgid "Command completed ..."
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:380 src/qt-console/console/console.cpp:367
+#: src/qt-console/bcomm/dircomm.cpp:384 src/qt-console/console/console.cpp:371
 msgid "Processing command ..."
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:387
+#: src/qt-console/bcomm/dircomm.cpp:391
 msgid "At main prompt waiting for input ..."
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:394 src/qt-console/bcomm/dircomm.cpp:407
+#: src/qt-console/bcomm/dircomm.cpp:398 src/qt-console/bcomm/dircomm.cpp:408
 msgid "At prompt waiting for input ..."
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:415
+#: src/qt-console/bcomm/dircomm.cpp:416
 msgid "Command failed."
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:487
+#: src/qt-console/bcomm/dircomm.cpp:488
 msgid "Director disconnected."
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:107
+#: src/qt-console/bcomm/dircomm_auth.cpp:111
 #, c-format
 msgid "Director authorization problem at \"%s:%d\"\n"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:114
+#: src/qt-console/bcomm/dircomm_auth.cpp:118
 #, c-format
 msgid ""
 "Authorization problem: Remote server at \"%s:%d\" did not advertise required "
 "TLS support.\n"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:122
+#: src/qt-console/bcomm/dircomm_auth.cpp:126
 #, c-format
 msgid ""
 "Authorization problem with Director at \"%s:%d\": Remote server requires "
 "TLS.\n"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:133
+#: src/qt-console/bcomm/dircomm_auth.cpp:137
 #, c-format
 msgid "TLS negotiation failed with Director at \"%s:%d\"\n"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:145
+#: src/qt-console/bcomm/dircomm_auth.cpp:149
 #, c-format
 msgid ""
 "Bad response to Hello command: ERR=%s\n"
 "The Director at \"%s:%d\" is probably not running.\n"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:154
+#: src/qt-console/bcomm/dircomm_auth.cpp:158
 #, c-format
 msgid "Director at \"%s:%d\" rejected Hello command\n"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:169
+#: src/qt-console/bcomm/dircomm_auth.cpp:173
 #, c-format
 msgid ""
 "Authorization problem with Director at \"%s:%d\"\n"
 "Most likely the passwords do not agree.\n"
 "If you are using TLS, there may have been a certificate validation error "
 "during the TLS handshake.\n"
-"Please see "
+"For help, please see "
 msgstr ""
 
-#: src/qt-console/main.cpp:154
+#: src/qt-console/main.cpp:159
 msgid "Cryptography library initialization failed.\n"
 msgstr ""
 
-#: src/qt-console/main.cpp:158
+#: src/qt-console/main.cpp:163
 #, c-format
 msgid "Please correct configuration file: %s\n"
 msgstr ""
 
-#: src/qt-console/main.cpp:180
+#: src/qt-console/main.cpp:187
 #, c-format
 msgid ""
 "\n"
@@ -257,88 +262,88 @@ msgid ""
 "\n"
 msgstr ""
 
-#: src/qt-console/main.cpp:213 src/qt-console/main.cpp:243
+#: src/qt-console/main.cpp:220 src/qt-console/main.cpp:250
 msgid "TLS required but not configured in Bacula.\n"
 msgstr ""
 
-#: src/qt-console/main.cpp:221
+#: src/qt-console/main.cpp:228
 #, c-format
 msgid ""
 "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined for "
 "Director \"%s\" in %s. At least one CA certificate store is required.\n"
 msgstr ""
 
-#: src/qt-console/main.cpp:230
+#: src/qt-console/main.cpp:237
 #, c-format
 msgid ""
 "No Director resource defined in %s\n"
 "Without that I don't how to speak to the Director :-(\n"
 msgstr ""
 
-#: src/qt-console/main.cpp:251
+#: src/qt-console/main.cpp:258
 #, c-format
 msgid ""
 "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined for "
 "Console \"%s\" in %s.\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:75
+#: src/qt-console/tray-monitor/authenticate.cpp:79
 msgid ""
 "Director authorization problem.\n"
 "Most likely the passwords do not agree.\n"
-"Please see "
+"For help, please see "
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:84
+#: src/qt-console/tray-monitor/authenticate.cpp:88
 #, c-format
 msgid "Bad response to Hello command: ERR=%s\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:91
+#: src/qt-console/tray-monitor/authenticate.cpp:95
 msgid "Director rejected Hello command\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:119
+#: src/qt-console/tray-monitor/authenticate.cpp:123
 #, c-format
 msgid "Error sending Hello to Storage daemon. ERR=%s\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:125
+#: src/qt-console/tray-monitor/authenticate.cpp:129
 msgid ""
 "Director and Storage daemon passwords or names not the same.\n"
-"Please see "
+"For help, please see "
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:132
+#: src/qt-console/tray-monitor/authenticate.cpp:136
 #, c-format
 msgid "bdird<stored: bad response to Hello command: ERR=%s\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:139
+#: src/qt-console/tray-monitor/authenticate.cpp:143
 msgid "Storage daemon rejected Hello command\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:165
+#: src/qt-console/tray-monitor/authenticate.cpp:169
 #, c-format
 msgid "Error sending Hello to File daemon. ERR=%s\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:171
+#: src/qt-console/tray-monitor/authenticate.cpp:175
 msgid ""
 "Director and File daemon passwords or names not the same.\n"
-"Please see "
+"For help, please see "
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:178
+#: src/qt-console/tray-monitor/authenticate.cpp:182
 #, c-format
 msgid "Bad response from File daemon to Hello command: ERR=%s\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:185
+#: src/qt-console/tray-monitor/authenticate.cpp:189
 msgid "File daemon rejected Hello command\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:55
+#: src/qt-console/tray-monitor/tray-monitor.cpp:59
 #, c-format
 msgid ""
 "\n"
@@ -353,14 +358,14 @@ msgid ""
 "\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:204
+#: src/qt-console/tray-monitor/tray-monitor.cpp:210
 #, c-format
 msgid ""
 "Error: %d Monitor resources defined in %s. You must define one and only one "
 "Monitor resource.\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:236
+#: src/qt-console/tray-monitor/tray-monitor.cpp:242
 #, c-format
 msgid ""
 "No Client, Storage or Director resource defined in %s\n"
@@ -368,7 +373,7 @@ msgid ""
 "Daemon :-(\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:251
+#: src/qt-console/tray-monitor/tray-monitor.cpp:257
 #, c-format
 msgid ""
 "Invalid refresh interval defined in %s\n"
@@ -376,106 +381,106 @@ msgid ""
 "minutes (read value: %d).\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:319
+#: src/qt-console/tray-monitor/tray-monitor.cpp:325
 #, c-format
 msgid "Error, currentitem is not a Client or a Storage..\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:357
+#: src/qt-console/tray-monitor/tray-monitor.cpp:363
 #, c-format
 msgid "Connecting to Client %s:%d"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:362
+#: src/qt-console/tray-monitor/tray-monitor.cpp:368
 msgid "File daemon"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:367
+#: src/qt-console/tray-monitor/tray-monitor.cpp:373
 #, c-format
 msgid "Connecting to Storage %s:%d"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:372
+#: src/qt-console/tray-monitor/tray-monitor.cpp:378
 msgid "Storage daemon"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:376
-#: src/qt-console/tray-monitor/tray-monitor.cpp:406
+#: src/qt-console/tray-monitor/tray-monitor.cpp:382
+#: src/qt-console/tray-monitor/tray-monitor.cpp:412
 #, c-format
 msgid "Error, currentitem is not a Client, a Storage or a Director..\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:381
+#: src/qt-console/tray-monitor/tray-monitor.cpp:387
 msgid "Cannot connect to daemon."
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:390
+#: src/qt-console/tray-monitor/tray-monitor.cpp:396
 #, c-format
 msgid "Authentication error : %s"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:397
+#: src/qt-console/tray-monitor/tray-monitor.cpp:403
 msgid "Opened connection with Director daemon."
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:400
+#: src/qt-console/tray-monitor/tray-monitor.cpp:406
 msgid "Opened connection with File daemon."
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:403
+#: src/qt-console/tray-monitor/tray-monitor.cpp:409
 msgid "Opened connection with Storage daemon."
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:454
+#: src/qt-console/tray-monitor/tray-monitor.cpp:460
 msgid "Error : BNET_HARDEOF or BNET_ERROR"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:463
+#: src/qt-console/tray-monitor/tray-monitor.cpp:469
 msgid "Error : Connection closed."
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:156
+#: src/qt-console/tray-monitor/tray_conf.cpp:160
 #, c-format
 msgid "No %s resource defined\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:165
+#: src/qt-console/tray-monitor/tray_conf.cpp:169
 #, c-format
 msgid "Monitor: name=%s FDtimeout=%s SDtimeout=%s\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:171
+#: src/qt-console/tray-monitor/tray_conf.cpp:175
 #, c-format
 msgid "Director: name=%s address=%s FDport=%d\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:175
+#: src/qt-console/tray-monitor/tray_conf.cpp:179
 #, c-format
 msgid "Client: name=%s address=%s FDport=%d\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:179
+#: src/qt-console/tray-monitor/tray_conf.cpp:183
 #, c-format
 msgid "Storage: name=%s address=%s SDport=%d\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:187
+#: src/qt-console/tray-monitor/tray_conf.cpp:191
 #, c-format
 msgid "Unknown resource type %d in dump_resource.\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:245
+#: src/qt-console/tray-monitor/tray_conf.cpp:249
 #, c-format
 msgid "Unknown resource type %d in free_resource.\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:282
+#: src/qt-console/tray-monitor/tray_conf.cpp:286
 #, c-format
 msgid "Too many items in %s resource\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:302
-#: src/qt-console/tray-monitor/tray_conf.cpp:340
+#: src/qt-console/tray-monitor/tray_conf.cpp:306
+#: src/qt-console/tray-monitor/tray_conf.cpp:344
 #, c-format
 msgid "Unknown resource type %d in save_resource.\n"
 msgstr ""
diff --git a/po/de.po b/po/de.po
index 10a06e9..734d0d4 100644
--- a/po/de.po
+++ b/po/de.po
@@ -1,201 +1,206 @@
 #
 # German translations for Bacula package
-# Copyright (C) 2005-2014 Free Software Foundation Europe e.V.
-# This file is distributed under the same license as the Bacula package.
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #
 msgid ""
 msgstr ""
 "Project-Id-Version: de\n"
 "Report-Msgid-Bugs-To: bacula-devel at lists.sourceforge.net\n"
-"POT-Creation-Date: 2014-07-29 18:18+0200\n"
-"PO-Revision-Date: 2005-04-15 14:11+01200\n"
+"POT-Creation-Date: 2015-08-09 15:05+0200\n"
+"PO-Revision-Date: 2007-06-25 20:38+0200\n"
 "Last-Translator: Kern Sibbald <kern at sibbald.com>\n"
-"Language-Team: German bacula-devel\n"
+"Language-Team: \n"
 "Language: German\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=ISO-8859-1\n"
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=2; plural=(n != 1);\n"
 
-#: src/baconfig.h:60 src/baconfig.h:61 src/baconfig.h:66 src/baconfig.h:67
+#: src/baconfig.h:64 src/baconfig.h:65 src/baconfig.h:70 src/baconfig.h:71
+#: src/baconfig.h:82 src/baconfig.h:83
 #, c-format
 msgid "Failed ASSERT: %s\n"
 msgstr ""
 
-#: src/baconfig.h:76
+#: src/baconfig.h:91
 msgid "*None*"
 msgstr ""
 
-#: src/lib/status.h:73
+#: src/lib/status.h:78
 msgid ""
 "\n"
 "Terminated Jobs:\n"
 msgstr ""
 
-#: src/lib/status.h:80
+#: src/lib/status.h:85
 msgid " JobId  Level    Files      Bytes   Status   Finished        Name \n"
 msgstr ""
 
-#: src/lib/status.h:82
+#: src/lib/status.h:87
 msgid "===================================================================\n"
 msgstr ""
 
-#: src/lib/status.h:102
+#: src/lib/status.h:107
 msgid "Created"
 msgstr ""
 
-#: src/lib/status.h:106
+#: src/lib/status.h:111
 msgid "Error"
 msgstr ""
 
-#: src/lib/status.h:109
+#: src/lib/status.h:114
 msgid "Diffs"
 msgstr ""
 
-#: src/lib/status.h:112
+#: src/lib/status.h:117
 msgid "Cancel"
 msgstr ""
 
-#: src/lib/status.h:115
+#: src/lib/status.h:120
 msgid "OK"
 msgstr ""
 
-#: src/lib/status.h:118
+#: src/lib/status.h:123
 #, fuzzy
 msgid "OK -- with warnings"
 msgstr "%s OK -- mit Warnungen"
 
-#: src/lib/status.h:122
+#: src/lib/status.h:126
+msgid "Incomplete"
+msgstr ""
+
+#: src/lib/status.h:129
 msgid "Other"
 msgstr ""
 
-#: src/lib/status.h:134
+#: src/lib/status.h:141
 #, c-format
 msgid "%6d\t%-6s\t%8s\t%10s\t%-7s\t%-8s\t%s\n"
 msgstr ""
 
-#: src/lib/status.h:142
+#: src/lib/status.h:149
 #, c-format
 msgid "%6d  %-6s %8s %10s  %-7s  %-8s %s\n"
 msgstr ""
 
-#: src/lib/status.h:171 src/lib/status.h:182 src/lib/status.h:196
-#: src/lib/status.h:200 src/lib/status.h:204
+#: src/lib/status.h:178 src/lib/status.h:189 src/lib/status.h:203
+#: src/lib/status.h:207 src/lib/status.h:211
 msgid "Bacula "
 msgstr "Bacula "
 
-#: src/qt-console/bat_conf.cpp:130
+#: src/qt-console/bat_conf.cpp:133
 #, c-format
 msgid "No record for %d %s\n"
 msgstr ""
 
-#: src/qt-console/bat_conf.cpp:139
+#: src/qt-console/bat_conf.cpp:142
 #, c-format
 msgid "Director: name=%s address=%s DIRport=%d\n"
 msgstr ""
 
-#: src/qt-console/bat_conf.cpp:143
+#: src/qt-console/bat_conf.cpp:146
 #, c-format
 msgid "Console: name=%s\n"
 msgstr ""
 
-#: src/qt-console/bat_conf.cpp:146
-#: src/qt-console/tray-monitor/tray_conf.cpp:183
+#: src/qt-console/bat_conf.cpp:149
+#: src/qt-console/tray-monitor/tray_conf.cpp:187
 #, c-format
 msgid "ConsoleFont: name=%s font face=%s\n"
 msgstr ""
 
-#: src/qt-console/bat_conf.cpp:150 src/qt-console/bat_conf.cpp:231
-#: src/qt-console/bat_conf.cpp:279 src/qt-console/bat_conf.cpp:309
+#: src/qt-console/bat_conf.cpp:153 src/qt-console/bat_conf.cpp:234
+#: src/qt-console/bat_conf.cpp:284 src/qt-console/bat_conf.cpp:314
 #, c-format
 msgid "Unknown resource type %d\n"
 msgstr ""
 
-#: src/qt-console/bat_conf.cpp:257
-#: src/qt-console/tray-monitor/tray_conf.cpp:276
+#: src/qt-console/bat_conf.cpp:262
+#: src/qt-console/tray-monitor/tray_conf.cpp:280
 #, c-format
 msgid "%s item is required in %s resource, but not found.\n"
 msgstr "%s item wird in %s resource ben�tigt, wurde aber nicht gefunden.\n"
 
-#: src/qt-console/bat_conf.cpp:326
-#: src/qt-console/tray-monitor/tray_conf.cpp:360
+#: src/qt-console/bat_conf.cpp:331
+#: src/qt-console/tray-monitor/tray_conf.cpp:364
 #, c-format
 msgid "Attempt to define second %s resource named \"%s\" is not permitted.\n"
 msgstr ""
 "Der Versuch der Definition einer zweiten  %s resource mit dem Namen \"%s\" "
 "ist nicht erlaubt.\n"
 
-#: src/qt-console/bcomm/dircomm.cpp:85
+#: src/qt-console/bcomm/dircomm.cpp:89
 #, c-format
 msgid "Already connected\"%s\".\n"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:96
-#: src/qt-console/tray-monitor/tray-monitor.cpp:347
+#: src/qt-console/bcomm/dircomm.cpp:100
+#: src/qt-console/tray-monitor/tray-monitor.cpp:353
 #, c-format
 msgid "Connecting to Director %s:%d"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:98
+#: src/qt-console/bcomm/dircomm.cpp:102
 #, c-format
 msgid ""
 "Connecting to Director %s:%d\n"
 "\n"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:150
+#: src/qt-console/bcomm/dircomm.cpp:154
 #, c-format
 msgid "Failed to initialize TLS context for Console \"%s\".\n"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:173
+#: src/qt-console/bcomm/dircomm.cpp:177
 #, c-format
 msgid "Failed to initialize TLS context for Director \"%s\".\n"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:195
-#: src/qt-console/tray-monitor/tray-monitor.cpp:352
+#: src/qt-console/bcomm/dircomm.cpp:199
+#: src/qt-console/tray-monitor/tray-monitor.cpp:358
 msgid "Director daemon"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:233
+#: src/qt-console/bcomm/dircomm.cpp:237
 msgid "Initializing ..."
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:249 src/qt-console/console/console.cpp:130
+#: src/qt-console/bcomm/dircomm.cpp:253 src/qt-console/console/console.cpp:134
 msgid "Connected"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:373
+#: src/qt-console/bcomm/dircomm.cpp:377
 msgid "Command completed ..."
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:380 src/qt-console/console/console.cpp:367
+#: src/qt-console/bcomm/dircomm.cpp:384 src/qt-console/console/console.cpp:371
 msgid "Processing command ..."
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:387
+#: src/qt-console/bcomm/dircomm.cpp:391
 msgid "At main prompt waiting for input ..."
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:394 src/qt-console/bcomm/dircomm.cpp:407
+#: src/qt-console/bcomm/dircomm.cpp:398 src/qt-console/bcomm/dircomm.cpp:408
 msgid "At prompt waiting for input ..."
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:415
+#: src/qt-console/bcomm/dircomm.cpp:416
 msgid "Command failed."
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:487
+#: src/qt-console/bcomm/dircomm.cpp:488
 msgid "Director disconnected."
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:107
+#: src/qt-console/bcomm/dircomm_auth.cpp:111
 #, fuzzy, c-format
 msgid "Director authorization problem at \"%s:%d\"\n"
 msgstr "Authorisationsproblem: FD an \"%s:%d\" erfordert TLS.\n"
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:114
+#: src/qt-console/bcomm/dircomm_auth.cpp:118
 #, fuzzy, c-format
 msgid ""
 "Authorization problem: Remote server at \"%s:%d\" did not advertise required "
@@ -204,38 +209,38 @@ msgstr ""
 "Authorisationsproblem: Entfernter Server hat ben�tigte TLS Unterst�tzung "
 "nicht angeboten.\n"
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:122
+#: src/qt-console/bcomm/dircomm_auth.cpp:126
 #, fuzzy, c-format
 msgid ""
 "Authorization problem with Director at \"%s:%d\": Remote server requires "
 "TLS.\n"
 msgstr "Authorisationsproblem: Enfernter Server erfordert TLS.\n"
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:133
+#: src/qt-console/bcomm/dircomm_auth.cpp:137
 #, fuzzy, c-format
 msgid "TLS negotiation failed with Director at \"%s:%d\"\n"
 msgstr "TLS Aushandlung fehlgeschlagen mit SD an \"%s:%d\"\n"
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:145
+#: src/qt-console/bcomm/dircomm_auth.cpp:149
 #, c-format
 msgid ""
 "Bad response to Hello command: ERR=%s\n"
 "The Director at \"%s:%d\" is probably not running.\n"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:154
+#: src/qt-console/bcomm/dircomm_auth.cpp:158
 #, fuzzy, c-format
 msgid "Director at \"%s:%d\" rejected Hello command\n"
 msgstr "File daemon auf \"%s:%d\" hat Hello Kommando abgelehnt\n"
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:169
+#: src/qt-console/bcomm/dircomm_auth.cpp:173
 #, fuzzy, c-format
 msgid ""
 "Authorization problem with Director at \"%s:%d\"\n"
 "Most likely the passwords do not agree.\n"
 "If you are using TLS, there may have been a certificate validation error "
 "during the TLS handshake.\n"
-"Please see "
+"For help, please see "
 msgstr ""
 "Kann mit  File daemon on \"%s:%d\" nicht authentisieren. M�gliche Ursachen:\n"
 "Passworte oder Namen nicht gleich oder\n"
@@ -244,16 +249,16 @@ msgstr ""
 "F�r Hilfe bitte unter http://www.bacula.org/rel-manual/faq."
 "html#AuthorizationErrors nachsehen.\n"
 
-#: src/qt-console/main.cpp:154
+#: src/qt-console/main.cpp:159
 msgid "Cryptography library initialization failed.\n"
 msgstr "Initialisierung der Verschl�sselungsbibliothek fehlgeschlagen.\n"
 
-#: src/qt-console/main.cpp:158
+#: src/qt-console/main.cpp:163
 #, c-format
 msgid "Please correct configuration file: %s\n"
 msgstr "Bitte die Konfigurationsdatei korrigieren: %s\n"
 
-#: src/qt-console/main.cpp:180
+#: src/qt-console/main.cpp:187
 #, fuzzy, c-format
 msgid ""
 "\n"
@@ -283,90 +288,97 @@ msgstr ""
 "       -?          diese Meldung ausgeben.\n"
 "\n"
 
-#: src/qt-console/main.cpp:213 src/qt-console/main.cpp:243
+#: src/qt-console/main.cpp:220 src/qt-console/main.cpp:250
 msgid "TLS required but not configured in Bacula.\n"
 msgstr "TLS ben�tigt aber nicht konfiguriert in Bacula.\n"
 
-#: src/qt-console/main.cpp:221
+#: src/qt-console/main.cpp:228
 #, c-format
 msgid ""
 "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined for "
 "Director \"%s\" in %s. At least one CA certificate store is required.\n"
 msgstr ""
 
-#: src/qt-console/main.cpp:230
+#: src/qt-console/main.cpp:237
 #, c-format
 msgid ""
 "No Director resource defined in %s\n"
 "Without that I don't how to speak to the Director :-(\n"
 msgstr ""
 
-#: src/qt-console/main.cpp:251
+#: src/qt-console/main.cpp:258
 #, c-format
 msgid ""
 "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined for "
 "Console \"%s\" in %s.\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:75
+#: src/qt-console/tray-monitor/authenticate.cpp:79
+#, fuzzy
 msgid ""
 "Director authorization problem.\n"
 "Most likely the passwords do not agree.\n"
-"Please see "
+"For help, please see "
 msgstr ""
+"Kann mit  File daemon on \"%s:%d\" nicht authentisieren. M�gliche Ursachen:\n"
+"Passworte oder Namen nicht gleich oder\n"
+"Maximum Concurrent Jobs �berschritten auf dem FD oder\n"
+"FD Netzwerk durcheinander (Daemon neustarten).\n"
+"F�r Hilfe bitte unter http://www.bacula.org/rel-manual/faq."
+"html#AuthorizationErrors nachsehen.\n"
 
-#: src/qt-console/tray-monitor/authenticate.cpp:84
+#: src/qt-console/tray-monitor/authenticate.cpp:88
 #, c-format
 msgid "Bad response to Hello command: ERR=%s\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:91
+#: src/qt-console/tray-monitor/authenticate.cpp:95
 msgid "Director rejected Hello command\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:119
+#: src/qt-console/tray-monitor/authenticate.cpp:123
 #, c-format
 msgid "Error sending Hello to Storage daemon. ERR=%s\n"
 msgstr "Fehler beim senden von \"Hello\" an Storage daemon. ERR=%s\n"
 
-#: src/qt-console/tray-monitor/authenticate.cpp:125
+#: src/qt-console/tray-monitor/authenticate.cpp:129
 #, fuzzy
 msgid ""
 "Director and Storage daemon passwords or names not the same.\n"
-"Please see "
+"For help, please see "
 msgstr "Director und Storage daemon Passworte or Namen nicht gleich.\n"
 
-#: src/qt-console/tray-monitor/authenticate.cpp:132
+#: src/qt-console/tray-monitor/authenticate.cpp:136
 #, c-format
 msgid "bdird<stored: bad response to Hello command: ERR=%s\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:139
+#: src/qt-console/tray-monitor/authenticate.cpp:143
 msgid "Storage daemon rejected Hello command\n"
 msgstr "Storage daemon hat Hello Kommando abgewiesen.\n"
 
-#: src/qt-console/tray-monitor/authenticate.cpp:165
+#: src/qt-console/tray-monitor/authenticate.cpp:169
 #, c-format
 msgid "Error sending Hello to File daemon. ERR=%s\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:171
+#: src/qt-console/tray-monitor/authenticate.cpp:175
 #, fuzzy
 msgid ""
 "Director and File daemon passwords or names not the same.\n"
-"Please see "
+"For help, please see "
 msgstr "Director und File daemon Passworte oder Namen sind nicht gleich.\n"
 
-#: src/qt-console/tray-monitor/authenticate.cpp:178
+#: src/qt-console/tray-monitor/authenticate.cpp:182
 #, c-format
 msgid "Bad response from File daemon to Hello command: ERR=%s\n"
 msgstr "Fehlerhafte Antwort von  File daemon auf Hello Kommando: ERR=%s\n"
 
-#: src/qt-console/tray-monitor/authenticate.cpp:185
+#: src/qt-console/tray-monitor/authenticate.cpp:189
 msgid "File daemon rejected Hello command\n"
 msgstr "File daemon hat Hello Kommando abgelehnt\n"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:55
+#: src/qt-console/tray-monitor/tray-monitor.cpp:59
 #, fuzzy, c-format
 msgid ""
 "\n"
@@ -396,14 +408,14 @@ msgstr ""
 "       -?          diese Meldung ausgeben.\n"
 "\n"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:204
+#: src/qt-console/tray-monitor/tray-monitor.cpp:210
 #, c-format
 msgid ""
 "Error: %d Monitor resources defined in %s. You must define one and only one "
 "Monitor resource.\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:236
+#: src/qt-console/tray-monitor/tray-monitor.cpp:242
 #, fuzzy, c-format
 msgid ""
 "No Client, Storage or Director resource defined in %s\n"
@@ -413,7 +425,7 @@ msgstr ""
 "Keine Director resource definiert in %s\n"
 "Ohne dies weiss ich nicht wer ich bin :-(\n"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:251
+#: src/qt-console/tray-monitor/tray-monitor.cpp:257
 #, c-format
 msgid ""
 "Invalid refresh interval defined in %s\n"
@@ -421,106 +433,106 @@ msgid ""
 "minutes (read value: %d).\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:319
+#: src/qt-console/tray-monitor/tray-monitor.cpp:325
 #, c-format
 msgid "Error, currentitem is not a Client or a Storage..\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:357
+#: src/qt-console/tray-monitor/tray-monitor.cpp:363
 #, c-format
 msgid "Connecting to Client %s:%d"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:362
+#: src/qt-console/tray-monitor/tray-monitor.cpp:368
 msgid "File daemon"
 msgstr "File daemon"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:367
-#, c-format
+#: src/qt-console/tray-monitor/tray-monitor.cpp:373
+#, fuzzy, c-format
 msgid "Connecting to Storage %s:%d"
-msgstr ""
+msgstr "Storage daemon"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:372
+#: src/qt-console/tray-monitor/tray-monitor.cpp:378
 msgid "Storage daemon"
 msgstr "Storage daemon"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:376
-#: src/qt-console/tray-monitor/tray-monitor.cpp:406
+#: src/qt-console/tray-monitor/tray-monitor.cpp:382
+#: src/qt-console/tray-monitor/tray-monitor.cpp:412
 #, c-format
 msgid "Error, currentitem is not a Client, a Storage or a Director..\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:381
+#: src/qt-console/tray-monitor/tray-monitor.cpp:387
 msgid "Cannot connect to daemon."
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:390
+#: src/qt-console/tray-monitor/tray-monitor.cpp:396
 #, c-format
 msgid "Authentication error : %s"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:397
+#: src/qt-console/tray-monitor/tray-monitor.cpp:403
 msgid "Opened connection with Director daemon."
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:400
+#: src/qt-console/tray-monitor/tray-monitor.cpp:406
 msgid "Opened connection with File daemon."
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:403
+#: src/qt-console/tray-monitor/tray-monitor.cpp:409
 msgid "Opened connection with Storage daemon."
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:454
+#: src/qt-console/tray-monitor/tray-monitor.cpp:460
 msgid "Error : BNET_HARDEOF or BNET_ERROR"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:463
+#: src/qt-console/tray-monitor/tray-monitor.cpp:469
 msgid "Error : Connection closed."
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:156
+#: src/qt-console/tray-monitor/tray_conf.cpp:160
 #, c-format
 msgid "No %s resource defined\n"
 msgstr "Keine %s resource definiert\n"
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:165
+#: src/qt-console/tray-monitor/tray_conf.cpp:169
 #, c-format
 msgid "Monitor: name=%s FDtimeout=%s SDtimeout=%s\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:171
+#: src/qt-console/tray-monitor/tray_conf.cpp:175
 #, c-format
 msgid "Director: name=%s address=%s FDport=%d\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:175
+#: src/qt-console/tray-monitor/tray_conf.cpp:179
 #, c-format
 msgid "Client: name=%s address=%s FDport=%d\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:179
+#: src/qt-console/tray-monitor/tray_conf.cpp:183
 #, c-format
 msgid "Storage: name=%s address=%s SDport=%d\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:187
+#: src/qt-console/tray-monitor/tray_conf.cpp:191
 #, c-format
 msgid "Unknown resource type %d in dump_resource.\n"
 msgstr "Unbekannter resource type %d in dump_resource.\n"
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:245
+#: src/qt-console/tray-monitor/tray_conf.cpp:249
 #, c-format
 msgid "Unknown resource type %d in free_resource.\n"
 msgstr "Unbekannter resource type %d in free_resource.\n"
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:282
+#: src/qt-console/tray-monitor/tray_conf.cpp:286
 #, c-format
 msgid "Too many items in %s resource\n"
 msgstr "zu viele items in %s resource\n"
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:302
-#: src/qt-console/tray-monitor/tray_conf.cpp:340
+#: src/qt-console/tray-monitor/tray_conf.cpp:306
+#: src/qt-console/tray-monitor/tray_conf.cpp:344
 #, c-format
 msgid "Unknown resource type %d in save_resource.\n"
 msgstr "Unbekannter resource type %d in save_resource.\n"
@@ -528,6 +540,9 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgid "Query failed: %s: ERR=%s\n"
 #~ msgstr "Abfrage gescheitert: %s: ERR=%s\n"
 
+#~ msgid "A user name for MySQL must be supplied.\n"
+#~ msgstr "Ein Benutzername f�r MySQL muss angegeben werden.\n"
+
 #~ msgid "Unable to initialize DB lock. ERR=%s\n"
 #~ msgstr "Kann DB lock nicht initialisieren. ERR=%s\n"
 
@@ -546,8 +561,8 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgid "Attribute create error. %s"
 #~ msgstr "Attribute create error. %s"
 
-#~ msgid "A user name for MySQL must be supplied.\n"
-#~ msgstr "Ein Benutzername f�r MySQL muss angegeben werden.\n"
+#~ msgid "A user name for PostgreSQL must be supplied.\n"
+#~ msgstr "Ein Benutzername f�r PostgreSQL muss angegeben werden.\n"
 
 #~ msgid "error fetching row: %s\n"
 #~ msgstr "Fehler beim holen von Zeile: %s\n"
@@ -563,6 +578,10 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ "Der Datenbankserver l�uft m�glicherweise nicht oder das Passwort ist "
 #~ "nicht korrekt.\n"
 
+#, fuzzy
+#~ msgid "Fetch failed: ERR=%s\n"
+#~ msgstr "pthread_create: ERR=%s\n"
+
 #~ msgid "error fetching currval: %s\n"
 #~ msgstr "Fehler beim Holen des aktuellen Wertes: %s\n"
 
@@ -578,9 +597,6 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgid "error copying in batch mode: %s"
 #~ msgstr "Fehler beim holen von Zeile: %s\n"
 
-#~ msgid "A user name for PostgreSQL must be supplied.\n"
-#~ msgstr "Ein Benutzername f�r PostgreSQL muss angegeben werden.\n"
-
 #~ msgid ""
 #~ "query %s failed:\n"
 #~ "%s\n"
@@ -702,15 +718,6 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgid "Create db File record %s failed. ERR=%s"
 #~ msgstr "Erzeugung des db File Eintrags %s fehlgeschlagen. ERR=%s"
 
-#~ msgid "More than one Filename! %s for file: %s\n"
-#~ msgstr "Mehr als ein Dateiname! %s f�r Datei: %s\n"
-
-#~ msgid "Error fetching row for file=%s: ERR=%s\n"
-#~ msgstr "Fehler beim Holen der Zeile f�r Datei=%s: ERR=%s\n"
-
-#~ msgid "Create db Filename record %s failed. ERR=%s\n"
-#~ msgstr "Erzeugung des db Filename Eintrags %s fehlgeschlagen. ERR=%s\n"
-
 #~ msgid "Attempt to put non-attributes into catalog. Stream=%d\n"
 #~ msgstr "Versuche \"non-attributes\" in catalog einzuf�gen. Stream=%d\n"
 
@@ -768,28 +775,16 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "Fehler beim holen der Zeile: %s\n"
 
 #, fuzzy
-#~ msgid "get_file_record want 1 got rows=%d PathId=%s FilenameId=%s\n"
+#~ msgid "get_file_record want 1 got rows=%d PathId=%s Filename=%s\n"
 #~ msgstr "get_file_record erwartet 1 erhalten rows=%d\n"
 
-#~ msgid "File record for PathId=%s FilenameId=%s not found.\n"
+#, fuzzy
+#~ msgid "File record for PathId=%s Filename=%s not found.\n"
 #~ msgstr "File Eintrag f�r PathId=%s FilenameId=%s nicht gefunden.\n"
 
 #~ msgid "File record not found in Catalog.\n"
 #~ msgstr "File Eintrag nicht im Catalog gefunden.\n"
 
-#~ msgid "More than one Filename!: %s for file: %s\n"
-#~ msgstr "Mehr als einen Dateinamen gefunden! : %s f�r Datei: %s\n"
-
-#, fuzzy
-#~ msgid "Get DB Filename record %s found bad record: %d\n"
-#~ msgstr "Get DB Filename record %s hat fehlerhaften Eintrag gefunden: %d\n"
-
-#~ msgid "Filename record: %s not found.\n"
-#~ msgstr "Filename record: %s nicht gefunden.\n"
-
-#~ msgid "Filename record: %s not found in Catalog.\n"
-#~ msgstr "Filename record: %s nicht in Catalog gefunden.\n"
-
 #~ msgid "Get DB path record %s found bad record: %s\n"
 #~ msgstr "Get DB path record %s fehlerhaften Eintrag gefunden: %s\n"
 
@@ -817,12 +812,25 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgid "Client id select failed: ERR=%s\n"
 #~ msgstr "Client id select fehlgeschlagen: ERR=%s\n"
 
-#~ msgid "More than one Pool!: %s\n"
+#, fuzzy
+#~ msgid "More than one Pool! Num=%s\n"
 #~ msgstr "Mehr als ein Pool!: %s\n"
 
 #~ msgid "Pool record not found in Catalog.\n"
 #~ msgstr "Pool Eintrag in Catalog nicht gefunden.\n"
 
+#, fuzzy
+#~ msgid "Error got %s RestoreObjects but expected only one!\n"
+#~ msgstr "Fehler erhalten %s FileSets aber nur einen erwartet!\n"
+
+#, fuzzy
+#~ msgid "RestoreObject record \"%d\" not found.\n"
+#~ msgstr "FileSet Eintrag \"%s\" nicht gefunden\n"
+
+#, fuzzy
+#~ msgid "RestoreObject record not found in Catalog.\n"
+#~ msgstr "FileSet Eintrag in Catalog nicht gefunden.\n"
+
 #~ msgid "More than one Client!: %s\n"
 #~ msgstr "Mehr als ein Client!: %s\n"
 
@@ -857,18 +865,33 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgid "More than one Volume!: %s\n"
 #~ msgstr "Mehr als ein Volume!: %s\n"
 
-#~ msgid "Media record MediaId=%s not found.\n"
+#, fuzzy
+#~ msgid "Media record with MediaId=%s not found.\n"
 #~ msgstr "Media Eintrag MediaId=%s nicht gefunden.\n"
 
-#~ msgid "Media record for Volume \"%s\" not found.\n"
+#, fuzzy
+#~ msgid "Media record for Volume name \"%s\" not found.\n"
 #~ msgstr "Media Eintrag f�r Volume \"%s\" nicht gefunden.\n"
 
 #~ msgid "Media record for MediaId=%u not found in Catalog.\n"
 #~ msgstr "Media Eintrag f�r MediaId=%u in Catalog nicht gefunden.\n"
 
-#~ msgid "Media record for Vol=%s not found in Catalog.\n"
+#, fuzzy
+#~ msgid "Media record for Volume Name \"%s\" not found in Catalog.\n"
 #~ msgstr "Media Eintrag f�r Vol=%s in Catalog nicht gefunden.\n"
 
+#, fuzzy
+#~ msgid "More than one Snapshot!: %s\n"
+#~ msgstr "Mehr als ein Client!: %s\n"
+
+#, fuzzy
+#~ msgid "Snapshot record with SnapshotId=%s not found.\n"
+#~ msgstr "Media Eintrag MediaId=%s nicht gefunden.\n"
+
+#, fuzzy
+#~ msgid "Snapshot record for Snapshot name \"%s\" not found.\n"
+#~ msgstr "Media Eintrag f�r Volume \"%s\" nicht gefunden.\n"
+
 #~ msgid "Query failed: %s\n"
 #~ msgstr "Abfrage fehlgeschlagen: %s\n"
 
@@ -897,7 +920,7 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ "Most likely the passwords do not agree.\n"
 #~ "If you are using TLS, there may have been a certificate validation error "
 #~ "during the TLS handshake.\n"
-#~ "Please see "
+#~ "For help, please see "
 #~ msgstr ""
 #~ "Kann mit  File daemon on \"%s:%d\" nicht authentisieren. M�gliche "
 #~ "Ursachen:\n"
@@ -908,6 +931,10 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ "html#AuthorizationErrors nachsehen.\n"
 
 #, fuzzy
+#~ msgid "Please use valid -l argument: %s\n"
+#~ msgstr "FileSet: name=%s\n"
+
+#, fuzzy
 #~ msgid "Can't find %s in Director list\n"
 #~ msgstr "Kann Director resource %s nicht finden\n"
 
@@ -915,6 +942,10 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgid "Cannot popen(\"%s\", \"r\"): ERR=%s\n"
 #~ msgstr "Kann Ausdruck\"%s\"nicht aufl�sen: ERR=%s\n"
 
+#, fuzzy
+#~ msgid "@exec error: ERR=%s\n"
+#~ msgstr "Attribute create error. %s"
+
 #~ msgid "Start Admin JobId %d, Job=%s\n"
 #~ msgstr "Starte Admin JobId %d, Job=%s\n"
 
@@ -944,7 +975,7 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ "Passwords or names not the same or\n"
 #~ "Maximum Concurrent Jobs exceeded on the SD or\n"
 #~ "SD networking messed up (restart daemon).\n"
-#~ "Please see "
+#~ "For help, please see: "
 #~ msgstr ""
 #~ "Director kann sich nicht an Storage daemon an \"%s:%d\" authentisieren. "
 #~ "M�gliche Ursachen:\n"
@@ -982,7 +1013,7 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ "Passwords or names not the same or\n"
 #~ "Maximum Concurrent Jobs exceeded on the FD or\n"
 #~ "FD networking messed up (restart daemon).\n"
-#~ "Please see "
+#~ "For help, please see: "
 #~ msgstr ""
 #~ "Kann mit  File daemon on \"%s:%d\" nicht authentisieren. M�gliche "
 #~ "Ursachen:\n"
@@ -1041,7 +1072,7 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "Kann Konsole \"%s\" an %s:%s:%d nicht authentisieren.\n"
 
 #, fuzzy
-#~ msgid "1000 OK: %d %s Version: %s (%s)\n"
+#~ msgid "1000 OK: %d %s %sVersion: %s (%s)\n"
 #~ msgstr "1000 OK: %s Version: %s (%s)\n"
 
 #~ msgid ""
@@ -1065,6 +1096,10 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgid "Cannot find previous jobids.\n"
 #~ msgstr "Kann Job resource %s nicht finden\n"
 
+#, fuzzy
+#~ msgid "Restart Incomplete Backup JobId %s, Job=%s\n"
+#~ msgstr "Start Sicherung JobId %s, Job=%s\n"
+
 #~ msgid "Start Backup JobId %s, Job=%s\n"
 #~ msgstr "Start Sicherung JobId %s, Job=%s\n"
 
@@ -1123,7 +1158,8 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ "  SD Bytes Written:       %s (%sB)\n"
 #~ "  Rate:                   %.1f KB/s\n"
 #~ "  Software Compression:   %s\n"
-#~ "%s  VSS:                    %s\n"
+#~ "  Comm Line Compression:  %s\n"
+#~ "%s  Snapshot/VSS:           %s\n"
 #~ "  Encryption:             %s\n"
 #~ "  Accurate:               %s\n"
 #~ "  Volume name(s):         %s\n"
@@ -1182,6 +1218,116 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ "Konnte  WriteBootstrap nicht �ffnen. Datei:\n"
 #~ "%s: ERR=%s\n"
 
+#, fuzzy
+#~ msgid ""
+#~ "\n"
+#~ "%sVersion: %s (%s)\n"
+#~ "\n"
+#~ "Usage: bdirjson [-f -s] [-c config_file] [-d debug_level] [config_file]\n"
+#~ "       -r <res>    get resource type <res>\n"
+#~ "       -n <name>   get resource <name>\n"
+#~ "       -l <dirs>   get only directives matching dirs (use with -r)\n"
+#~ "       -D          get only data\n"
+#~ "       -R          do not apply JobDefs to Job\n"
+#~ "       -c <file>   set configuration file to file\n"
+#~ "       -d <nn>     set debug level to <nn>\n"
+#~ "       -dt         print timestamp in debug output\n"
+#~ "       -t          test - read configuration and exit\n"
+#~ "       -s          output in show text format\n"
+#~ "       -v          verbose user messages\n"
+#~ "       -?          print this message.\n"
+#~ "\n"
+#~ msgstr ""
+#~ "\n"
+#~ "Version: %s (%s)\n"
+#~ "\n"
+#~ "Usage: dird [-f -s] [-c config_file] [-d debug_level] [config_file]\n"
+#~ "       -c <file>   setze Konfigurationsdatei auf Datei\n"
+#~ "       -dnn        setze debug level auf nn\n"
+#~ "       -f          starte im Vordergrund (f�r debugging Zwecke)\n"
+#~ "       -g          groupid\n"
+#~ "       -r <job>    starte <job> jetzt\n"
+#~ "       -s          no signals\n"
+#~ "       -t          test - Konfiguration Lesen und beenden\n"
+#~ "       -u          userid\n"
+#~ "       -v          ausf�hrliche Benutzer Meldungen\n"
+#~ "       -?          diese Meldung ausgeben.\n"
+#~ "\n"
+
+#~ msgid ""
+#~ "No Director resource defined in %s\n"
+#~ "Without that I don't know who I am :-(\n"
+#~ msgstr ""
+#~ "Keine Director resource definiert in %s\n"
+#~ "Ohne dies weiss ich nicht wer ich bin :-(\n"
+
+#~ msgid "No Messages resource defined in %s\n"
+#~ msgstr "Keine Messages resource definiert in %s\n"
+
+#~ msgid "Only one Director resource permitted in %s\n"
+#~ msgstr "Nur eine Director resource erlaubt in %s\n"
+
+#~ msgid "\"TLS Certificate\" file not defined for Director \"%s\" in %s.\n"
+#~ msgstr ""
+#~ "\"TLS Certificate\" Datei nicht f�r Director definiert \"%s\" in %s.\n"
+
+#~ msgid "\"TLS Key\" file not defined for Director \"%s\" in %s.\n"
+#~ msgstr "\"TLS Key\" Datei nicht f�r Director definiert \"%s\" in %s.\n"
+
+#~ msgid ""
+#~ "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined "
+#~ "for Director \"%s\" in %s. At least one CA certificate store is required "
+#~ "when using \"TLS Verify Peer\".\n"
+#~ msgstr ""
+#~ "Weder \"TLS CA Certificate\"  noch \"TLS CA Certificate Dir\" sind f�r "
+#~ "Director \"%s\" in %s definert. Mindestens ein CA certificate store wird "
+#~ "ben�tigt wenn \"TLS Verify Peer\" eingesetzt wird.\n"
+
+#~ msgid "\"TLS Certificate\" file not defined for Console \"%s\" in %s.\n"
+#~ msgstr ""
+#~ "\"TLS Certificate\" Datei nicht definiert f�r Console \"%s\" in %s.\n"
+
+#~ msgid "\"TLS Key\" file not defined for Console \"%s\" in %s.\n"
+#~ msgstr "\"TLS Key\" Datei nicht definiert f�r Console \"%s\" in %s.\n"
+
+#~ msgid ""
+#~ "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined "
+#~ "for Console \"%s\" in %s. At least one CA certificate store is required "
+#~ "when using \"TLS Verify Peer\".\n"
+#~ msgstr ""
+#~ "Weder \"TLS CA Certificate\" noch \"TLS CA Certificate Dir\" sind "
+#~ "definiert f�rConsole \"%s\" in %s. Mindestens ein CA certificate store "
+#~ "wird ben�tigt beiEinsatz von \"TLS Verify Peer\".\n"
+
+#~ msgid "Failed to initialize TLS context for File daemon \"%s\" in %s.\n"
+#~ msgstr ""
+#~ "Konnte TLS context f�r File daemon \"%s\" in %s nicht initialisieren.\n"
+
+#~ msgid ""
+#~ "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined "
+#~ "for File daemon \"%s\" in %s.\n"
+#~ msgstr ""
+#~ "Weder \"TLS CA Certificate\" noch \"TLS CA Certificate Dir\" sind "
+#~ "definiert f�r File daemon \"%s\" in %s.\n"
+
+#~ msgid "No Job records defined in %s\n"
+#~ msgstr "Keine Job records definiert in %s\n"
+
+#~ msgid "Hey something is wrong. p=0x%lu\n"
+#~ msgstr "Hey etwas l�uft schief. p=0x%lu\n"
+
+#~ msgid ""
+#~ "\"%s\" directive in Job \"%s\" resource is required, but not found.\n"
+#~ msgstr ""
+#~ "\"%s\" Directive in Job \"%s\" resource wird ben�tigt, wurde aber nicht "
+#~ "gefunden.\n"
+
+#~ msgid "Too many items in Job resource\n"
+#~ msgstr "zu viele items in Job resource\n"
+
+#~ msgid "No storage specified in Job \"%s\" nor in Pool.\n"
+#~ msgstr "Weder storage noch Pool in Job \"%s\" definiert.\n"
+
 #~ msgid "Unable to get Job record. ERR=%s\n"
 #~ msgstr "Konnte Job Eintrag nicht holen. ERR=%s\n"
 
@@ -1200,9 +1346,6 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgid "Error writing bsr file.\n"
 #~ msgstr "Fehler beim schreiben der bsr Datei.\n"
 
-#~ msgid "Bootstrap records written to %s\n"
-#~ msgstr "Bootstrap Eintr�ge geschrieben nach %s\n"
-
 #, fuzzy
 #~ msgid ""
 #~ "The Job will require the following (*=>InChanger):\n"
@@ -1309,22 +1452,23 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #, fuzzy
 #~ msgid ""
 #~ "\n"
-#~ "Version: %s (%s)\n"
+#~ "%sVersion: %s (%s)\n"
 #~ "\n"
 #~ "Usage: bacula-dir [-f -s] [-c config_file] [-d debug_level] "
 #~ "[config_file]\n"
-#~ "       -c <file>   set configuration file to file\n"
-#~ "       -d <nn>     set debug level to <nn>\n"
-#~ "       -dt         print timestamp in debug output\n"
-#~ "       -f          run in foreground (for debugging)\n"
-#~ "       -g          groupid\n"
-#~ "       -m          print kaboom output (for debugging)\n"
-#~ "       -r <job>    run <job> now\n"
-#~ "       -s          no signals\n"
-#~ "       -t          test - read configuration and exit\n"
-#~ "       -u          userid\n"
-#~ "       -v          verbose user messages\n"
-#~ "       -?          print this message.\n"
+#~ "     -c <file>        set configuration file to file\n"
+#~ "     -d <nn>[,<tags>] set debug level to <nn>, debug tags to <tags>\n"
+#~ "     -dt              print timestamp in debug output\n"
+#~ "     -T               set trace on\n"
+#~ "     -f               run in foreground (for debugging)\n"
+#~ "     -g               groupid\n"
+#~ "     -m               print kaboom output (for debugging)\n"
+#~ "     -r <job>         run <job> now\n"
+#~ "     -s               no signals\n"
+#~ "     -t               test - read configuration and exit\n"
+#~ "     -u               userid\n"
+#~ "     -v               verbose user messages\n"
+#~ "     -?               print this message.\n"
 #~ "\n"
 #~ msgstr ""
 #~ "\n"
@@ -1343,6 +1487,10 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ "       -?          diese Meldung ausgeben.\n"
 #~ "\n"
 
+#, fuzzy
+#~ msgid "Already doing a reload request, request ignored.\n"
+#~ msgstr "zu viele offene reload Anforderungen, Anforderung ignoriert.\n"
+
 #~ msgid "Too many open reload requests. Request ignored.\n"
 #~ msgstr "zu viele offene reload Anforderungen, Anforderung ignoriert.\n"
 
@@ -1352,87 +1500,24 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgid "Resetting previous configuration.\n"
 #~ msgstr "Vorherige Konfiguration zur�ckgesetzt.\n"
 
-#~ msgid ""
-#~ "No Director resource defined in %s\n"
-#~ "Without that I don't know who I am :-(\n"
+#~ msgid "Failed to initialize TLS context for Director \"%s\" in %s.\n"
 #~ msgstr ""
-#~ "Keine Director resource definiert in %s\n"
-#~ "Ohne dies weiss ich nicht wer ich bin :-(\n"
-
-#~ msgid "No Messages resource defined in %s\n"
-#~ msgstr "Keine Messages resource definiert in %s\n"
+#~ "Konnte TLS context f�r Director nicht initialisieren \"%s\" in %s.\n"
 
-#~ msgid "Only one Director resource permitted in %s\n"
-#~ msgstr "Nur eine Director resource erlaubt in %s\n"
+#~ msgid "Could not open Catalog \"%s\", database \"%s\".\n"
+#~ msgstr "Konnte Catalog \"%s\", database \"%s\" nicht �ffnen.\n"
 
-#~ msgid "\"TLS Certificate\" file not defined for Director \"%s\" in %s.\n"
-#~ msgstr ""
-#~ "\"TLS Certificate\" Datei nicht f�r Director definiert \"%s\" in %s.\n"
+#, fuzzy
+#~ msgid "Could not create storage record for %s\n"
+#~ msgstr "Kann Storage resource %s nicht finden\n"
 
-#~ msgid "\"TLS Key\" file not defined for Director \"%s\" in %s.\n"
-#~ msgstr "\"TLS Key\" Datei nicht f�r Director definiert \"%s\" in %s.\n"
+#, fuzzy
+#~ msgid "Could not update storage record for %s\n"
+#~ msgstr "Kann Storage resource %s nicht finden\n"
 
 #~ msgid ""
 #~ "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined "
-#~ "for Director \"%s\" in %s. At least one CA certificate store is required "
-#~ "when using \"TLS Verify Peer\".\n"
-#~ msgstr ""
-#~ "Weder \"TLS CA Certificate\"  noch \"TLS CA Certificate Dir\" sind f�r "
-#~ "Director \"%s\" in %s definert. Mindestens ein CA certificate store wird "
-#~ "ben�tigt wenn \"TLS Verify Peer\" eingesetzt wird.\n"
-
-#~ msgid "Failed to initialize TLS context for Director \"%s\" in %s.\n"
-#~ msgstr ""
-#~ "Konnte TLS context f�r Director nicht initialisieren \"%s\" in %s.\n"
-
-#~ msgid "No Job records defined in %s\n"
-#~ msgstr "Keine Job records definiert in %s\n"
-
-#~ msgid "Hey something is wrong. p=0x%lu\n"
-#~ msgstr "Hey etwas l�uft schief. p=0x%lu\n"
-
-#~ msgid ""
-#~ "\"%s\" directive in Job \"%s\" resource is required, but not found.\n"
-#~ msgstr ""
-#~ "\"%s\" Directive in Job \"%s\" resource wird ben�tigt, wurde aber nicht "
-#~ "gefunden.\n"
-
-#~ msgid "Too many items in Job resource\n"
-#~ msgstr "zu viele items in Job resource\n"
-
-#~ msgid "No storage specified in Job \"%s\" nor in Pool.\n"
-#~ msgstr "Weder storage noch Pool in Job \"%s\" definiert.\n"
-
-#~ msgid "\"TLS Certificate\" file not defined for Console \"%s\" in %s.\n"
-#~ msgstr ""
-#~ "\"TLS Certificate\" Datei nicht definiert f�r Console \"%s\" in %s.\n"
-
-#~ msgid "\"TLS Key\" file not defined for Console \"%s\" in %s.\n"
-#~ msgstr "\"TLS Key\" Datei nicht definiert f�r Console \"%s\" in %s.\n"
-
-#~ msgid ""
-#~ "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined "
-#~ "for Console \"%s\" in %s. At least one CA certificate store is required "
-#~ "when using \"TLS Verify Peer\".\n"
-#~ msgstr ""
-#~ "Weder \"TLS CA Certificate\" noch \"TLS CA Certificate Dir\" sind "
-#~ "definiert f�rConsole \"%s\" in %s. Mindestens ein CA certificate store "
-#~ "wird ben�tigt beiEinsatz von \"TLS Verify Peer\".\n"
-
-#~ msgid "Failed to initialize TLS context for File daemon \"%s\" in %s.\n"
-#~ msgstr ""
-#~ "Konnte TLS context f�r File daemon \"%s\" in %s nicht initialisieren.\n"
-
-#~ msgid ""
-#~ "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined "
-#~ "for File daemon \"%s\" in %s.\n"
-#~ msgstr ""
-#~ "Weder \"TLS CA Certificate\" noch \"TLS CA Certificate Dir\" sind "
-#~ "definiert f�r File daemon \"%s\" in %s.\n"
-
-#~ msgid ""
-#~ "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined "
-#~ "for Storage \"%s\" in %s.\n"
+#~ "for Storage \"%s\" in %s.\n"
 #~ msgstr ""
 #~ "Weder \"TLS CA Certificate\" noch \"TLS CA Certificate Dir\" sind "
 #~ "definiert f�rStorage \"%s\" in %s.\n"
@@ -1440,17 +1525,6 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgid "Failed to initialize TLS context for Storage \"%s\" in %s.\n"
 #~ msgstr "Konnte TLS context f�r Storage \"%s\" in %s nicht initialisieren.\n"
 
-#~ msgid "Could not open Catalog \"%s\", database \"%s\".\n"
-#~ msgstr "Konnte Catalog \"%s\", database \"%s\" nicht �ffnen.\n"
-
-#, fuzzy
-#~ msgid "Could not create storage record for %s\n"
-#~ msgstr "Kann Storage resource %s nicht finden\n"
-
-#, fuzzy
-#~ msgid "Could not update storage record for %s\n"
-#~ msgstr "Kann Storage resource %s nicht finden\n"
-
 #~ msgid "Could not compile regex pattern \"%s\" ERR=%s\n"
 #~ msgstr "Konnte regex pattern \"%s\" nicht kompilieren ERR=%s\n"
 
@@ -1472,7 +1546,8 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgid "Counter: name=%s min=%d max=%d\n"
 #~ msgstr "Counter: name=%s min=%d max=%d\n"
 
-#~ msgid "Client: name=%s address=%s FDport=%d MaxJobs=%u\n"
+#, fuzzy
+#~ msgid "Client: Name=%s Enabled=%d Address=%s FDport=%d MaxJobs=%u\n"
 #~ msgstr "Client: name=%s address=%s FDport=%d MaxJobs=%u\n"
 
 #~ msgid "      JobRetention=%s FileRetention=%s AutoPrune=%d\n"
@@ -1489,14 +1564,23 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ "autochgr=%d\n"
 #~ "      poolid=%s volname=%s MediaType=%s\n"
 
+#, fuzzy
 #~ msgid ""
-#~ "Storage: name=%s address=%s SDport=%d MaxJobs=%u\n"
-#~ "      DeviceName=%s MediaType=%s StorageId=%s\n"
+#~ "%s: name=%s address=%s SDport=%d MaxJobs=%u\n"
+#~ "      DeviceName=%s MediaType=%s StorageId=%s Autochanger=%d\n"
 #~ msgstr ""
 #~ "Storage: name=%s address=%s SDport=%d MaxJobs=%u\n"
 #~ "      DeviceName=%s MediaType=%s StorageId=%s\n"
 
 #, fuzzy
+#~ msgid "   Parent --> "
+#~ msgstr "     --> "
+
+#, fuzzy
+#~ msgid "   Shared --> "
+#~ msgstr "     --> "
+
+#, fuzzy
 #~ msgid ""
 #~ "Catalog: name=%s address=%s DBport=%d db_name=%s\n"
 #~ "      db_driver=%s db_user=%s MutliDBConn=%d\n"
@@ -1599,7 +1683,8 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgid "FileSet: name=%s\n"
 #~ msgstr "FileSet: name=%s\n"
 
-#~ msgid "Schedule: name=%s\n"
+#, fuzzy
+#~ msgid "Schedule: Name=%s Enabled=%d\n"
 #~ msgstr "Schedule: name=%s\n"
 
 #~ msgid "  --> Run Level=%s\n"
@@ -1637,6 +1722,9 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgid "     --> "
 #~ msgstr "     --> "
 
+#~ msgid "Schedule: name=%s\n"
+#~ msgstr "Schedule: name=%s\n"
+
 #~ msgid "Pool: name=%s PoolType=%s\n"
 #~ msgstr "Pool: name=%s PoolType=%s\n"
 
@@ -1716,17 +1804,21 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgid "Cannot find Schedule resource %s\n"
 #~ msgstr "Kann Schedule resource %s nicht finden\n"
 
-#~ msgid "Name item is required in %s resource, but not found.\n"
-#~ msgstr ""
-#~ "Name item wird ben�tigt in %s resource, wurde aber nicht gefunden.\n"
-
-#~ msgid "Inserting %s res: %s index=%d pass=%d\n"
-#~ msgstr "Inserting %s res: %s index=%d pass=%d\n"
-
 #, fuzzy
 #~ msgid "Expected one of: %s, got: %s"
 #~ msgstr "Erwartet: %s, erhalten: %s"
 
+#, fuzzy
+#~ msgid "Could not find Storage Resource %s referenced on line %d : %s\n"
+#~ msgstr ""
+#~ "Konnte config Resource %s , referenziert in Zeile %d : %s nicht finden\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "Attempt to redefine Storage resource \"%s\" referenced on line %d : %s\n"
+#~ msgstr ""
+#~ "Konnte config Resource %s , referenziert in Zeile %d : %s nicht finden\n"
+
 #~ msgid "Expected a Migration Job Type keyword, got: %s"
 #~ msgstr " Migration Job Type  Schl�sselwort erwartet, erhalten: %s"
 
@@ -1836,6 +1928,10 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgid "RestoreObject failed.\n"
 #~ msgstr "Wiederherstellung l�uft..."
 
+#, fuzzy
+#~ msgid "ComponentInfo failed.\n"
+#~ msgstr "Job Einrichtung Fehlgeschlagen.\n"
+
 #~ msgid ""
 #~ "<filed: bad attributes, expected 3 fields got %d\n"
 #~ "msglen=%d msg=%s\n"
@@ -1880,12 +1976,6 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgid "Expected a wild-card string, got: %s\n"
 #~ msgstr "wild-card Ausdruck erwartet, erhalten: %s\n"
 
-#~ msgid "Expected an fstype string, got: %s\n"
-#~ msgstr "fstype Ausdruck erwartet, erhalten: %s\n"
-
-#~ msgid "Expected an drivetype string, got: %s\n"
-#~ msgstr "drivetype Ausdruck erwartet, erhalten: %s\n"
-
 #, fuzzy
 #~ msgid "Backslash found. Use forward slashes or quote the string.: %s\n"
 #~ msgstr ""
@@ -1937,6 +2027,10 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "Verbindung zu Storage daemon fehlgeschlagen.\n"
 
 #, fuzzy
+#~ msgid "Client resource \"%s\" does not exist.\n"
+#~ msgstr "Pool Ressource \"%s\" nicht gefunden.\n"
+
+#, fuzzy
 #~ msgid "canceled"
 #~ msgstr "%s Abgebrochen"
 
@@ -1955,7 +2049,7 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "\"Max run time\" �berschritten, Job abgebrochen.\n"
 
 #, fuzzy
-#~ msgid "Pool \"%s\" not in database. ERR=%s"
+#~ msgid "Cannot create pool \"%s\" in database. ERR=%s"
 #~ msgstr "Pool %s nicht in der Datenbank. %s"
 
 #, fuzzy
@@ -1967,22 +2061,15 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "von \"Run pool\" �berschrieben"
 
 #, fuzzy
-#~ msgid "Storage from Run NextPool override"
-#~ msgstr "Storage aus der \"NextPool\" Ressource des Pools."
-
-#, fuzzy
 #~ msgid "Job's NextPool resource"
 #~ msgstr "\"NextPool\"  Ressource des Job Pools"
 
-#, fuzzy
-#~ msgid "Storage from Job's NextPool resource"
-#~ msgstr "Storage aus der \"NextPool\" Ressource des Pools."
-
 #~ msgid "Job Pool's NextPool resource"
 #~ msgstr "\"NextPool\"  Ressource des Job Pools"
 
-#~ msgid "Storage from Pool's NextPool resource"
-#~ msgstr "Storage aus der \"NextPool\" Ressource des Pools."
+#, fuzzy
+#~ msgid "Pool's NextPool resource"
+#~ msgstr "\"NextPool\"  Ressource des Job Pools"
 
 #, fuzzy
 #~ msgid "Run Pool override"
@@ -1992,6 +2079,10 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgid "Run FullPool override"
 #~ msgstr "von \"Run FullPool\" �berschrieben"
 
+#, fuzzy
+#~ msgid "No Client specified.\n"
+#~ msgstr "Kein storage angegeben.\n"
+
 #~ msgid "Could not create Client record. ERR=%s\n"
 #~ msgstr "Konnte Client Eintrag nicht anlegen. ERR=%s\n"
 
@@ -2416,6 +2507,30 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ "\n"
 
 #, fuzzy
+#~ msgid "Bad response from SD to %s command. Wanted %s, got %s len=%ld\n"
+#~ msgstr "Schlechte Antwort auf %s Kommando: erwartet %s, erhalten %s\n"
+
+#, fuzzy
+#~ msgid "Snapshot not found\n"
+#~ msgstr "FileSet MD5 Pr�fsumme nicht gefunden.\n"
+
+#, fuzzy
+#~ msgid "Client resource not found\n"
+#~ msgstr "Pool Ressource \"%s\" nicht gefunden.\n"
+
+#, fuzzy
+#~ msgid "Snapshot \"%s\" on Client %s\n"
+#~ msgstr "Mehr als ein Client!: %s\n"
+
+#, fuzzy
+#~ msgid "No snapshot found\n"
+#~ msgstr "FileSet Eintrag \"%s\" nicht gefunden\n"
+
+#, fuzzy
+#~ msgid "Unable to get Snapshot record.\n"
+#~ msgstr "Konnte Job Eintrag nicht holen. ERR=%s\n"
+
+#, fuzzy
 #~ msgid "Create DB Pool from resource"
 #~ msgstr "Pool Ressource"
 
@@ -2436,6 +2551,14 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "Konnte Migrationsjob nicht starten.\n"
 
 #, fuzzy
+#~ msgid "Restart a job"
+#~ msgstr "Konnte Migrationsjob nicht starten.\n"
+
+#, fuzzy
+#~ msgid "Resume a job"
+#~ msgstr "Konnte Migrationsjob nicht starten.\n"
+
+#, fuzzy
 #~ msgid "Stop a job"
 #~ msgstr "Konnte Migrationsjob nicht starten.\n"
 
@@ -2444,6 +2567,14 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "Job Ressource"
 
 #, fuzzy
+#~ msgid "Client \"%s\" %sabled\n"
+#~ msgstr "Pool Ressource \"%s\" nicht gefunden.\n"
+
+#, fuzzy
+#~ msgid "Schedule \"%s\" %sabled\n"
+#~ msgstr "Schedule: name=%s\n"
+
+#, fuzzy
 #~ msgid "Fileset \"%s\" not found.\n"
 #~ msgstr "FileSet Eintrag \"%s\" nicht gefunden\n"
 
@@ -2464,6 +2595,22 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "  --> Run=%s\n"
 
 #, fuzzy
+#~ msgid "List Media failed: ERR=%s\n"
+#~ msgstr "Media id select fehlgeschlagen: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Invalid keyword found: %s\n"
+#~ msgstr "Ung�ltige JobId gefunden.\n"
+
+#, fuzzy
+#~ msgid "path name missing.\n"
+#~ msgstr "FileSet: name=%s\n"
+
+#, fuzzy
+#~ msgid "Failed to send command to Client.\n"
+#~ msgstr "Verbindung zu File daemon fehlgeschlagen.\n"
+
+#, fuzzy
 #~ msgid "Unable to get Job record for Job=%s\n"
 #~ msgstr "Konnte Job Eintrag nicht holen. ERR=%s\n"
 
@@ -2473,7 +2620,7 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 
 #, fuzzy
 #~ msgid "Unable to get Client record for Client=%s\n"
-#~ msgstr "Konnte Media record f�r Volume %s nicht holen: ERR=%s\n"
+#~ msgstr "Konnte Job Eintrag nicht holen. ERR=%s\n"
 
 #, fuzzy
 #~ msgid "Unable to get last Job record for Client=%s\n"
@@ -2492,10 +2639,6 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "Media id select fehlgeschlagen: ERR=%s\n"
 
 #, fuzzy
-#~ msgid "List Media failed: ERR=%s\n"
-#~ msgstr "Media id select fehlgeschlagen: ERR=%s\n"
-
-#, fuzzy
 #~ msgid "List Location failed: ERR=%s\n"
 #~ msgstr "Client id select fehlgeschlagen: ERR=%s\n"
 
@@ -2516,8 +2659,12 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "ist nicht aktiviert"
 
 #, fuzzy
-#~ msgid "disabled"
-#~ msgstr "ist nicht aktiviert"
+#~ msgid "Invalid jobid argument\n"
+#~ msgstr "Ung�ltige JobId gefunden.\n"
+
+#, fuzzy
+#~ msgid "Unknown ObjectType %s\n"
+#~ msgstr "unbekannt"
 
 #, fuzzy
 #~ msgid "Could not find Pool for Job %s\n"
@@ -2546,9 +2693,12 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "Kann Konsole \"%s\" an %s:%s:%d nicht authentisieren.\n"
 
 #, fuzzy
-#~ msgid "No Volumes found to perform %s action.\n"
+#~ msgid "No Volumes found to perform \"truncate\" command.\n"
 #~ msgstr "Keine Volumes zum Wiederherstellen gefunden.\n"
 
+#~ msgid "Bootstrap records written to %s\n"
+#~ msgstr "Bootstrap Eintr�ge geschrieben nach %s\n"
+
 #~ msgid ""
 #~ "\n"
 #~ "First you select one or more JobIds that contain files\n"
@@ -2569,6 +2719,18 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "Regex �bersetzungsfehler. ERR=%s\n"
 
 #, fuzzy
+#~ msgid "Unable to create component file %s. ERR=%s\n"
+#~ msgstr "Konnte bootstrap Datei %s nicht erzeugen. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to fdopen component file %s. ERR=%s\n"
+#~ msgstr "Kann Datenbank=%s.nicht �ffen. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Error writing component file.\n"
+#~ msgstr "Fehler beim schreiben der bsr Datei.\n"
+
+#, fuzzy
 #~ msgid "FileSet argument: %s\n"
 #~ msgstr "FileSet: name=%s\n"
 
@@ -2578,7 +2740,7 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 
 #, fuzzy
 #~ msgid "No authorization. NextPool \"%s\".\n"
-#~ msgstr "Keine \"Storage\" Spezifikation in \"Next Pool\" \"%s\" gefunden.\n"
+#~ msgstr "Storage daemon"
 
 #, fuzzy
 #~ msgid "Restore Client \"%s\" not found.\n"
@@ -2597,6 +2759,18 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "Konnte job record f�r JobId %s zum migrieren nicht holen. ERR=%s"
 
 #, fuzzy
+#~ msgid "Plugin Restore Options\n"
+#~ msgstr "  --> Run=%s\n"
+
+#, fuzzy
+#~ msgid "Plugins to configure:\n"
+#~ msgstr "Pool Ressource \"%s\" nicht gefunden.\n"
+
+#, fuzzy
+#~ msgid "Can't configure %32s\n"
+#~ msgstr "Kann inkludierte Datei nicht �ffnen: %s. ERR=%s\n"
+
+#, fuzzy
 #~ msgid "Restore Client"
 #~ msgstr "Wiederherstellung l�uft..."
 
@@ -2609,10 +2783,6 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "File daemon"
 
 #, fuzzy
-#~ msgid "Storage from NextPool override"
-#~ msgstr "Storage aus der \"NextPool\" Ressource des Pools."
-
-#, fuzzy
 #~ msgid "%s -> %s\n"
 #~ msgstr "  --> Run=%s\n"
 
@@ -2621,6 +2791,10 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "Konnte job record f�r JobId %s zum migrieren nicht holen. ERR=%s"
 
 #, fuzzy
+#~ msgid "User specified"
+#~ msgstr "Kein storage angegeben.\n"
+
+#, fuzzy
 #~ msgid "Where:      %s\n"
 #~ msgstr "      opcmd=%s\n"
 
@@ -2673,24 +2847,72 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "Kein storage angegeben.\n"
 
 #, fuzzy
+#~ msgid "The disabled Job resources are:\n"
+#~ msgstr "Kann Job resource %s nicht finden\n"
+
+#, fuzzy
+#~ msgid "The enabled Job resources are:\n"
+#~ msgstr "Kann Job resource %s nicht finden\n"
+
+#, fuzzy
+#~ msgid "Select Client resource"
+#~ msgstr "Pool Ressource"
+
+#, fuzzy
+#~ msgid "The defined Schedule resources are:\n"
+#~ msgstr "Kann Schedule resource %s nicht finden\n"
+
+#, fuzzy
+#~ msgid "Schedule"
+#~ msgstr "Schedule: name=%s\n"
+
+#, fuzzy
+#~ msgid "Select Schedule resource"
+#~ msgstr "Kann Schedule resource %s nicht finden\n"
+
+#, fuzzy
+#~ msgid "No value given for \"jobid\".\n"
+#~ msgstr "Keine volumes f�r JobId=%d gefunden\n"
+
+#, fuzzy
+#~ msgid "No value given for \"job\".\n"
+#~ msgstr "Keine volumes f�r JobId=%d gefunden\n"
+
+#, fuzzy
+#~ msgid "No value given for \"ujobid\".\n"
+#~ msgstr "Keine volumes f�r JobId=%d gefunden\n"
+
+#, fuzzy
 #~ msgid "Select Job(s):\n"
 #~ msgstr "ist nicht aktiviert"
 
 #, fuzzy
+#~ msgid "%s %sVersion: %s (%s) %s %s %s\n"
+#~ msgstr "1000 OK: %s Version: %s (%s)\n"
+
+#, fuzzy
 #~ msgid "No authorization for Storage \"%s\"\n"
 #~ msgstr "Storage daemon"
 
 #, fuzzy
+#~ msgid "Console connected %sat %s\n"
+#~ msgstr "Console: name=%s SSL=%d\n"
+
+#, fuzzy
 #~ msgid "has terminated with warnings"
 #~ msgstr "%s OK -- mit Warnungen"
 
 #, fuzzy
+#~ msgid "has terminated in incomplete state"
+#~ msgstr "%s OK -- mit Warnungen"
+
+#, fuzzy
 #~ msgid "is waiting on Storage \"%s\""
 #~ msgstr "Storage daemon"
 
 #, fuzzy
 #~ msgid "is waiting for its start time (%s)"
-#~ msgstr "Job %s wartet %d Sekunden auf die geplante Startzeit.\n"
+#~ msgstr "Storage daemon"
 
 #, fuzzy
 #~ msgid "is waiting for a Shared Storage device"
@@ -2705,6 +2927,18 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "Verbindung zu Storage daemon fehlgeschlagen.\n"
 
 #, fuzzy
+#~ msgid "%6d  %-4s %-3s %10s %10s %-17s %s\n"
+#~ msgstr "1000 OK: %s Version: %s (%s)\n"
+
+#, fuzzy
+#~ msgid "Invalid command \"%s\".  Enter \"done\" to exit.\n"
+#~ msgstr "unbekannt"
+
+#, fuzzy
+#~ msgid "Snapshot parameters"
+#~ msgstr "unbekannt"
+
+#, fuzzy
 #~ msgid "Error updating media record ActionOnPurge: ERR=%s"
 #~ msgstr "Fehler beim Aktualisieren des Client Eintrags. ERR=%s\n"
 
@@ -2924,12 +3158,6 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "Socket Fehler auf %s Kommando: ERR=%s\n"
 
 #, fuzzy
-#~ msgid ""
-#~ "Trying to restore POSIX acl on file \"%s\" on filesystem without aclent "
-#~ "acl support\n"
-#~ msgstr "Catalog Fehler beim Aktualisieren von volume \"%s\". ERR=%s"
-
-#, fuzzy
 #~ msgid "acl_fromtext error on file \"%s\": ERR=%s\n"
 #~ msgstr "Socket Fehler auf %s Kommando: ERR=%s\n"
 
@@ -2950,10 +3178,6 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "Kann Datenbank=%s.nicht �ffen. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Connection from unknown Director %s at %s rejected.\n"
-#~ msgstr "unbekannt"
-
-#, fuzzy
 #~ msgid "     Could not access \"%s\": ERR=%s\n"
 #~ msgstr "Konnte counter %s: nicht aktualisieren: ERR=%s\n"
 
@@ -2974,16 +3198,53 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "Kann Ausdruck\"%s\"nicht aufl�sen: ERR=%s\n"
 
 #, fuzzy
+#~ msgid "Too many errors. JobErrors=%d.\n"
+#~ msgstr "zu viele items in Job resource\n"
+
+#, fuzzy
+#~ msgid "Network send error to SD. Data=%s ERR=%s\n"
+#~ msgstr "Netzwerkfehler mit FD bei %s: ERR=%s\n"
+
+#, fuzzy
 #~ msgid "     Cannot open resource fork for \"%s\": ERR=%s.\n"
 #~ msgstr "Kann Ausdruck\"%s\"nicht aufl�sen: ERR=%s\n"
 
 #, fuzzy
-#~ msgid "An error occurred while adding signer the stream.\n"
-#~ msgstr "Fehler beim schreiben der bsr Datei.\n"
+#~ msgid ""
+#~ "\n"
+#~ "%sVersion: %s (%s)\n"
+#~ "\n"
+#~ "Usage: bfdjson [-c config_file] [-d debug_level]\n"
+#~ "        -r <res>    get resource type <res>\n"
+#~ "        -n <name>   get resource <name>\n"
+#~ "        -l <dirs>   get only directives matching dirs (use with -r)\n"
+#~ "        -D          get only data\n"
+#~ "        -c <file>   use <file> as configuration file\n"
+#~ "        -d <nn>     set debug level to <nn>\n"
+#~ "        -dt         print a timestamp in debug output\n"
+#~ "        -t          test configuration file and exit\n"
+#~ "        -v          verbose user messages\n"
+#~ "        -?          print this message.\n"
+#~ "\n"
+#~ msgstr ""
+#~ "\n"
+#~ "Version: %s (%s)\n"
+#~ "\n"
+#~ "Usage: bacula-fd [-f -s] [-c config_datei] [-d debug_level]\n"
+#~ "        -c <Datei>   benutze <Datei> als Konfigurationsdatei\n"
+#~ "        -dnn        setze debug level auf nn\n"
+#~ "        -f          starte in Vordergrund (f�r debugging)\n"
+#~ "        -g          groupid\n"
+#~ "        -s          no signals (f�r debugging)\n"
+#~ "        -t          Konfigurationsdatei testen und beenden\n"
+#~ "        -u          userid\n"
+#~ "        -v          Ausf�hrliche Benutzermeldungen\n"
+#~ "        -?          diese Meldung ausgeben.\n"
+#~ "\n"
 
 #, fuzzy
-#~ msgid "Too many errors. JobErrors=%d.\n"
-#~ msgstr "zu viele items in Job resource\n"
+#~ msgid "An error occurred while adding signer the stream.\n"
+#~ msgstr "Fehler beim holen von Zeile: %s\n"
 
 #, fuzzy
 #~ msgid "Plugin save packet not found.\n"
@@ -2994,6 +3255,54 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "Pool Ressource \"%s\" nicht gefunden.\n"
 
 #, fuzzy
+#~ msgid "Error while creating command string %s.\n"
+#~ msgstr "Fehler beim schreiben der bsr Datei.\n"
+
+#, fuzzy
+#~ msgid "Error while executing \"%s\" %s. %s %s\n"
+#~ msgstr "Fehler beim schreiben der bsr Datei.\n"
+
+#, fuzzy
+#~ msgid "Unable to create snapshot record. ERR=%s\n"
+#~ msgstr "Konnte Job Eintrag nicht holen. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to create snapshot record, got %s\n"
+#~ msgstr "Konnte Job Eintrag nicht holen. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to delete snapshot record. ERR=%s\n"
+#~ msgstr "Konnte Job Eintrag nicht holen. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to delete snapshot record, got %s\n"
+#~ msgstr "Konnte Job Eintrag nicht holen. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to get snapshot record. ERR=%s\n"
+#~ msgstr "Konnte Job Eintrag nicht holen. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to get snapshot record, got %s\n"
+#~ msgstr "Konnte Job Eintrag nicht holen. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to parse command output\n"
+#~ msgstr "Verbindung zu File daemon fehlgeschlagen.\n"
+
+#, fuzzy
+#~ msgid "   Unable to delete snapshot of %s ERR=%s\n"
+#~ msgstr "Konnte bootstrap Datei %s nicht erzeugen. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "   Create Snapshot for %s\n"
+#~ msgstr "Erzeugung des DB Storage Eintrags %s fehlgeschlagen. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "   Unable to create snapshot of %s ERR=%s\n"
+#~ msgstr "Konnte bootstrap Datei %s nicht erzeugen. ERR=%s\n"
+
+#, fuzzy
 #~ msgid ""
 #~ "\n"
 #~ "%sVersion: %s (%s)\n"
@@ -3038,6 +3347,10 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "Job Type Schl�sselwort erwartet, erhalten: %s"
 
 #, fuzzy
+#~ msgid "Connection from unknown Director %s at %s rejected.\n"
+#~ msgstr "unbekannt"
+
+#, fuzzy
 #~ msgid "SD connect failed: Bad Hello command\n"
 #~ msgstr "Job nicht gefunden: %s\n"
 
@@ -3046,12 +3359,16 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "Job nicht gefunden: %s\n"
 
 #, fuzzy
-#~ msgid "2001 Job \"%s\" marked to be %s.\n"
-#~ msgstr "JobId %s, Job %s zum Abbruch markiert.\n"
+#~ msgid "SD \"%s\" tried to connect two times.\n"
+#~ msgstr "Verbindung zu File daemon fehlgeschlagen.\n"
 
 #, fuzzy
-#~ msgid "2991 Bad setbandwidth command: %s\n"
-#~ msgstr "Storage daemon hat \"Job command\": %s abgelehnt\n"
+#~ msgid "Recv caps from SD failed. ERR=%s\n"
+#~ msgstr "pthread_create: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "2001 Job \"%s\" marked to be %s.\n"
+#~ msgstr "JobId %s, Job %s zum Abbruch markiert.\n"
 
 #, fuzzy
 #~ msgid "Bad RestoreObject command: %s\n"
@@ -3062,11 +3379,24 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "Verbindung zu Storage daemon fehlgeschlagen.\n"
 
 #, fuzzy
+#~ msgid "Generate VSS snapshots. Driver=\"%s\"\n"
+#~ msgstr "Erzeugung des DB Storage Eintrags %s fehlgeschlagen. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "VSS CreateSnapshots failed. ERR=%s\n"
+#~ msgstr "Erzeugung des DB Storage Eintrags %s fehlgeschlagen. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "VSS was not initialized properly. ERR=%s\n"
+#~ msgstr "Kann DB lock nicht initialisieren. ERR=%s\n"
+
+#, fuzzy
 #~ msgid "Bad status %d %c returned from Storage Daemon.\n"
 #~ msgstr "FD hat keinen Jobstatus zur�ckgegeben.\n"
 
 #, fuzzy
-#~ msgid "Bad response from SD to %s command. Wanted %s, got %s\n"
+#~ msgid ""
+#~ "Bad response from SD to %s command. Wanted %s, got len=%ld msg=\"%s\"\n"
 #~ msgstr "Schlechte Antwort auf %s Kommando: erwartet %s, erhalten %s\n"
 
 #, fuzzy
@@ -3086,6 +3416,12 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "FileSet MD5 Pr�fsumme nicht gefunden.\n"
 
 #, fuzzy
+#~ msgid ""
+#~ "An error=%d occurred while decoding encrypted session data stream: ERR="
+#~ "%s\n"
+#~ msgstr "Fehler beim holen von Zeile: %s\n"
+
+#, fuzzy
 #~ msgid "Cannot open resource fork for %s.\n"
 #~ msgstr "Kann Ausdruck\"%s\"nicht aufl�sen: ERR=%s\n"
 
@@ -3102,13 +3438,25 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "Catalog Fehler beim Aktualisieren von volume \"%s\". ERR=%s"
 
 #, fuzzy
+#~ msgid "Write write error on %s: ERR=%s\n"
+#~ msgstr "Catalog Fehler beim Aktualisieren von volume \"%s\". ERR=%s"
+
+#, fuzzy
+#~ msgid "%s %sVersion: %s (%s) %s %s %s %s\n"
+#~ msgstr "1000 OK: %s Version: %s (%s)\n"
+
+#, fuzzy
+#~ msgid "Director connected %sat: %s\n"
+#~ msgstr "Verbindung zu File daemon fehlgeschlagen.\n"
+
+#, fuzzy
 #~ msgid "    %s%s %s Job started: %s\n"
 #~ msgstr "Clone JobId %d gestartet.\n"
 
 #, fuzzy
 #~ msgid ""
 #~ "    Files=%s Bytes=%s AveBytes/sec=%s LastBytes/sec=%s Errors=%d\n"
-#~ "    Bwlimit=%s\n"
+#~ "    Bwlimit=%s ReadBytes=%s\n"
 #~ msgstr "      MigTime=%s MigHiBytes=%s MigLoBytes=%s\n"
 
 #, fuzzy
@@ -3116,6 +3464,10 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "FileSet: name=%s\n"
 
 #, fuzzy
+#~ msgid "WriteEncryptedFileRaw failure: ERR=%s\n"
+#~ msgstr "Media id select fehlgeschlagen: ERR=%s\n"
+
+#, fuzzy
 #~ msgid "llistea error on file \"%s\": ERR=%s\n"
 #~ msgstr "Socket Fehler auf %s Kommando: ERR=%s\n"
 
@@ -3300,6 +3652,18 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "Kann  bootstrap Datei nicht �ffnen: %s: ERR=%s\n"
 
 #, fuzzy
+#~ msgid "Cannot open current directory: ERR=%s\n"
+#~ msgstr "Kann inkludierte Datei nicht �ffnen: %s. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Cannot get current directory: ERR=%s\n"
+#~ msgstr "kann Variable operate nicht setzen: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Cannot reset current directory: ERR=%s\n"
+#~ msgstr "kann Variable operate nicht setzen: ERR=%s\n"
+
+#, fuzzy
 #~ msgid "Cannot resolve service(%s)"
 #~ msgstr "Kann Console resource %s nicht finden\n"
 
@@ -3382,7 +3746,11 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "Socket Fehler auf %s Kommando: ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Could not init bsock mutex. ERR=%s\n"
+#~ msgid "Could not init bsock read mutex. ERR=%s\n"
+#~ msgstr "Konnte job queue nicht initialiseren: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Could not init bsock write mutex. ERR=%s\n"
 #~ msgstr "Konnte job queue nicht initialiseren: ERR=%s\n"
 
 #, fuzzy
@@ -3412,10 +3780,60 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "Regex �bersetzungsfehler. ERR=%s\n"
 
 #, fuzzy
+#~ msgid "Director authorization error at \"%s:%d\"\n"
+#~ msgstr "Authorisationsproblem: FD an \"%s:%d\" erfordert TLS.\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "Authorization error: Remote server at \"%s:%d\" did not advertise "
+#~ "required TLS support.\n"
+#~ msgstr ""
+#~ "Authorisationsproblem: Entfernter Server hat ben�tigte TLS Unterst�tzung "
+#~ "nicht angeboten.\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "Authorization error with Director at \"%s:%d\": Remote server requires "
+#~ "TLS.\n"
+#~ msgstr "Authorisationsproblem: Enfernter Server erfordert TLS.\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "Authorization error with Director at \"%s:%d\"\n"
+#~ "Most likely the passwords do not agree.\n"
+#~ "If you are using TLS, there may have been a certificate validation error "
+#~ "during the TLS handshake.\n"
+#~ "For help, please see: "
+#~ msgstr ""
+#~ "Kann mit  File daemon on \"%s:%d\" nicht authentisieren. M�gliche "
+#~ "Ursachen:\n"
+#~ "Passworte oder Namen nicht gleich oder\n"
+#~ "Maximum Concurrent Jobs �berschritten auf dem FD oder\n"
+#~ "FD Netzwerk durcheinander (Daemon neustarten).\n"
+#~ "F�r Hilfe bitte unter http://www.bacula.org/rel-manual/faq."
+#~ "html#AuthorizationErrors nachsehen.\n"
+
+#, fuzzy
 #~ msgid "safe_unlink could not compile regex pattern \"%s\" ERR=%s\n"
 #~ msgstr "Konnte regex pattern \"%s\" nicht kompilieren ERR=%s\n"
 
 #, fuzzy
+#~ msgid "Cannot open %s file. %s ERR=%s\n"
+#~ msgstr "Kann  bootstrap Datei nicht �ffnen: %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Could not open %s file. %s ERR=%s\n"
+#~ msgstr "Kann  bootstrap Datei nicht �ffnen: %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Cannot lock %s file. %s ERR=%s\n"
+#~ msgstr "Kann  bootstrap Datei nicht �ffnen: %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Cannot not open %s file. %s ERR=%s\n"
+#~ msgstr "Kann  bootstrap Datei nicht �ffnen: %s: ERR=%s\n"
+
+#, fuzzy
 #~ msgid "No signers found for crypto verify.\n"
 #~ msgstr "Keine %ss zum Migrieren gefunden.\n"
 
@@ -3440,6 +3858,10 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "Kann inkludierte Datei nicht �ffnen: %s. ERR=%s\n"
 
 #, fuzzy
+#~ msgid "Cannot open lex\n"
+#~ msgstr "Kann inkludierte Datei nicht �ffnen: %s. ERR=%s\n"
+
+#, fuzzy
 #~ msgid "Restoring"
 #~ msgstr "Wiederherstellung l�uft..."
 
@@ -3496,6 +3918,10 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "Catalog Fehler beim Aktualisieren von volume \"%s\". ERR=%s"
 
 #, fuzzy
+#~ msgid "Inserted res: %s index=%d\n"
+#~ msgstr "Inserting %s res: %s index=%d pass=%d\n"
+
+#, fuzzy
 #~ msgid "expected a speed number, got: %s"
 #~ msgstr "Dateiname erwartet, erhalten: %s"
 
@@ -3528,10 +3954,6 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "Media id select fehlgeschlagen: ERR=%s\n"
 
 #, fuzzy
-#~ msgid "User cancel requested.\n"
-#~ msgstr "%s Abgebrochen"
-
-#, fuzzy
 #~ msgid "Completed with warnings"
 #~ msgstr "%s OK -- mit Warnungen"
 
@@ -3576,99 +3998,255 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "unbekannt"
 
 #, fuzzy
-#~ msgid "No volumes specified for reading. Job %s canceled.\n"
-#~ msgstr "Weder storage noch Pool in Job \"%s\" definiert.\n"
+#~ msgid "Can't use replace=ifnewer with Delta plugin on %s\n"
+#~ msgstr "Cannot unescape string: ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Read open %s device %s Volume \"%s\" failed: ERR=%s\n"
-#~ msgstr "Erzeugung von db Device Eintrag %s fehlgeschlagen: ERR=%s\n"
+#~ msgid "Can't use replace=ifolder with Delta plugin on %s\n"
+#~ msgstr "Cannot unescape string: ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Could not ready %s device %s for append.\n"
-#~ msgstr "Konnte FileSet \"%s\" Eintrag nicht erzeugen. ERR=%s\n"
+#~ msgid "Can't run command %s. ERR=%s\n"
+#~ msgstr "Kann Programm: %s nicht starten. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Error reading data header from FD. n=%d msglen=%d ERR=%s\n"
-#~ msgstr "Fehler beim Lesen der catalog DB Steuerdatei. ERR=%s\n"
+#~ msgid "Can't create working directory %s. ERR=%s\n"
+#~ msgstr "Kann inkludierte Datei nicht �ffnen: %s. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Network error reading from FD. ERR=%s\n"
-#~ msgstr "Netzwerkfehler mit FD bei %s: ERR=%s\n"
+#~ msgid "Can't delete working directory %s. ERR=%s\n"
+#~ msgstr "Kann inkludierte Datei nicht �ffnen: %s. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Error writing end session label. ERR=%s\n"
-#~ msgstr "Fehler beim Aktualisieren der DB Media Datei. ERR=%s\n"
+#~ msgid "Unknown parameter for %s. Expecting block or file\n"
+#~ msgstr "unbekannt"
 
 #, fuzzy
-#~ msgid ""
-#~ "Connection from unknown Director %s at %s rejected.\n"
-#~ "Please see "
+#~ msgid "Unknown parameter %s.\n"
 #~ msgstr "unbekannt"
 
 #, fuzzy
-#~ msgid "TLS negotiation failed with DIR at \"%s:%d\"\n"
-#~ msgstr "TLS Aushandlung fehlgeschlagen mit SD an \"%s:%d\"\n"
+#~ msgid "Unable to access guest volume\n"
+#~ msgstr "Kann Konsole \"%s\" an %s:%s:%d nicht authentisieren.\n"
 
 #, fuzzy
-#~ msgid "TLS negotiation failed with FD at \"%s:%d\"\n"
-#~ msgstr "TLS Aushandlung fehlgeschlagen mit FD an \"%s:%d\".\n"
+#~ msgid "Unable to create temporary file %s. ERR=%s\n"
+#~ msgstr "Konnte bootstrap Datei %s nicht erzeugen. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Lock failure on autochanger. ERR=%s\n"
-#~ msgstr "pthread_cond_wait: ERR=%s\n"
+#~ msgid "Can't use mode=%s in MySQL plugin\n"
+#~ msgstr "Cannot unescape string: ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Unlock failure on autochanger. ERR=%s\n"
-#~ msgstr "pthread_cond_wait: ERR=%s\n"
+#~ msgid "Unable to fdopen file %s. ERR=%s\n"
+#~ msgstr "Kann Datenbank=%s.nicht �ffen. ERR=%s\n"
 
 #, fuzzy
-#~ msgid ""
-#~ "\n"
-#~ "Version: %s (%s)\n"
-#~ "\n"
-#~ "Usage: bcopy [-d debug_level] <input-archive> <output-archive>\n"
-#~ "       -b bootstrap      specify a bootstrap file\n"
-#~ "       -c <file>         specify a Storage configuration file\n"
-#~ "       -d <nn>           set debug level to <nn>\n"
-#~ "       -dt               print timestamp in debug output\n"
-#~ "       -i                specify input Volume names (separated by |)\n"
-#~ "       -o                specify output Volume names (separated by |)\n"
-#~ "       -p                proceed inspite of errors\n"
-#~ "       -v                verbose\n"
-#~ "       -w <dir>          specify working directory (default /tmp)\n"
-#~ "       -?                print this message\n"
-#~ "\n"
-#~ msgstr ""
-#~ "\n"
-#~ "Version: %s (%s)\n"
-#~ "\n"
-#~ "Usage: dird [-f -s] [-c config_file] [-d debug_level] [config_file]\n"
-#~ "       -c <file>   setze Konfigurationsdatei auf Datei\n"
-#~ "       -dnn        setze debug level auf nn\n"
-#~ "       -f          starte im Vordergrund (f�r debugging Zwecke)\n"
-#~ "       -g          groupid\n"
-#~ "       -r <job>    starte <job> jetzt\n"
-#~ "       -s          no signals\n"
-#~ "       -t          test - Konfiguration Lesen und beenden\n"
-#~ "       -u          userid\n"
-#~ "       -v          ausf�hrliche Benutzer Meldungen\n"
-#~ "       -?          diese Meldung ausgeben.\n"
-#~ "\n"
+#~ msgid "  Dumping database \"%s\"\n"
+#~ msgstr "Konnte Datenbank \"%s\" nicht �ffen.\n"
 
 #, fuzzy
-#~ msgid ""
-#~ "\n"
-#~ "Version: %s (%s)\n"
-#~ "\n"
-#~ "Usage: bextract <options> <bacula-archive-device-name> <directory-to-"
-#~ "store-files>\n"
+#~ msgid "Unable to detect the MySQL data_directory on this system.\n"
+#~ msgstr "Kann Catalog DB Steuerdatei nicht �ffnen %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to determine the last binlog %s\n"
+#~ msgstr "Konnte Job Eintrag nicht holen. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Can't get server configuration.\n"
+#~ msgstr "Vorherige Konfiguration zur�ckgesetzt.\n"
+
+#, fuzzy
+#~ msgid "Unable to get the BINLOG list.\n"
+#~ msgstr "Konnte Job Eintrag nicht holen. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to determine the last LSN for %s (Previous job is %s)\n"
+#~ msgstr "Konnte Job Eintrag nicht holen. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to detect datadir from MySQL\n"
+#~ msgstr "Kann Catalog DB Steuerdatei nicht �ffnen %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to get last LSN from the backup\n"
+#~ msgstr "Konnte Job Eintrag nicht holen. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Restoring target database \"%s\"\n"
+#~ msgstr "Konnte Datenbank \"%s\" nicht �ffen.\n"
+
+#, fuzzy
+#~ msgid "Creating target database \"%s\"\n"
+#~ msgstr "Konnte Datenbank \"%s\" nicht �ffen.\n"
+
+#, fuzzy
+#~ msgid "Database \"%s\" already exists. Skipping creation.\n"
+#~ msgstr "Datenbank %s existiert nicht, bitte erzeugen.\n"
+
+#, fuzzy
+#~ msgid "Unable to parse or to use plugin options, %s\n"
+#~ msgstr "Konnte Job Eintrag nicht holen. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Can't use mode=%s in postgresql plugin\n"
+#~ msgstr "Cannot unescape string: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Can't use service=%s in postgresql plugin ERR=%s\n"
+#~ msgstr "Cannot unescape string: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Can't get cluster configuration.\n"
+#~ msgstr "Vorherige Konfiguration zur�ckgesetzt.\n"
+
+#, fuzzy
+#~ msgid "Can't determine the last WAL file\n"
+#~ msgstr "Konnte Job Eintrag nicht holen. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Can't determine WAL directory\n"
+#~ msgstr "Kann inkludierte Datei nicht �ffnen: %s. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Can't open WAL directory %s. ERR=%s\n"
+#~ msgstr "Kann inkludierte Datei nicht �ffnen: %s. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to detect the PostgreSQL data_directory on this system.\n"
+#~ msgstr "Kann Catalog DB Steuerdatei nicht �ffnen %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to find data_directory=%s on this system. ERR=%s\n"
+#~ msgstr "Kann Catalog DB Steuerdatei nicht �ffnen %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to start the PITR backup on this system.\n"
+#~ msgstr "Kann Catalog DB Steuerdatei nicht �ffnen %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to determine the first WAL file on this system.\n"
+#~ msgstr "Kann Catalog DB Steuerdatei nicht �ffnen %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to analyse tablespaces %s on this system. ERR=%s\n"
+#~ msgstr "Kann Catalog DB Steuerdatei nicht �ffnen %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to analyse data_directory %s on this system. ERR=%s\n"
+#~ msgstr "Kann Catalog DB Steuerdatei nicht �ffnen %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Can't create the %s file for recovery. ERR=%s\n"
+#~ msgstr "Konnte FileSet \"%s\" Eintrag nicht erzeugen. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "3612 JobId=%u waiting because device %s is reserved by: %s.\n"
+#~ msgstr "unbekannt"
+
+#, fuzzy
+#~ msgid "No volumes specified for reading. Job %s canceled.\n"
+#~ msgstr "Weder storage noch Pool in Job \"%s\" definiert.\n"
+
+#, fuzzy
+#~ msgid "Read open %s device %s Volume \"%s\" failed: ERR=%s\n"
+#~ msgstr "Erzeugung von db Device Eintrag %s fehlgeschlagen: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Could not ready %s device %s for append.\n"
+#~ msgstr "Konnte FileSet \"%s\" Eintrag nicht erzeugen. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Error closing device %s. ERR=%s.\n"
+#~ msgstr "Socket Fehler auf %s Kommando: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Error reading data header from FD. n=%d msglen=%d ERR=%s\n"
+#~ msgstr "Fehler beim Lesen der catalog DB Steuerdatei. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Network error reading from FD. ERR=%s\n"
+#~ msgstr "Netzwerkfehler mit FD bei %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "DDE commit failed. ERR=%s\n"
+#~ msgstr "pthread_create: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Error writing end session label. ERR=%s\n"
+#~ msgstr "Fehler beim Aktualisieren der DB Media Datei. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Set ok=FALSE after write_final_block_to_device.\n"
+#~ msgstr "Fehler beim schreiben der bsr Datei.\n"
+
+#, fuzzy
+#~ msgid "TLS negotiation failed with DIR at \"%s:%d\"\n"
+#~ msgstr "TLS Aushandlung fehlgeschlagen mit SD an \"%s:%d\"\n"
+
+#, fuzzy
+#~ msgid "TLS negotiation failed with FD at \"%s:%d\"\n"
+#~ msgstr "TLS Aushandlung fehlgeschlagen mit FD an \"%s:%d\".\n"
+
+#, fuzzy
+#~ msgid "Lock failure on autochanger. ERR=%s\n"
+#~ msgstr "pthread_cond_wait: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unlock failure on autochanger. ERR=%s\n"
+#~ msgstr "pthread_cond_wait: ERR=%s\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "\n"
+#~ "%sVersion: %s (%s)\n"
+#~ "\n"
+#~ "Usage: bcopy [-d debug_level] <input-archive> <output-archive>\n"
+#~ "       -b bootstrap      specify a bootstrap file\n"
+#~ "       -c <file>         specify a Storage configuration file\n"
+#~ "       -d <nn>           set debug level to <nn>\n"
+#~ "       -dt               print timestamp in debug output\n"
+#~ "       -i                specify input Volume names (separated by |)\n"
+#~ "       -o                specify output Volume names (separated by |)\n"
+#~ "       -p                proceed inspite of errors\n"
+#~ "       -v                verbose\n"
+#~ "       -w <dir>          specify working directory (default /tmp)\n"
+#~ "       -?                print this message\n"
+#~ "\n"
+#~ msgstr ""
+#~ "\n"
+#~ "Version: %s (%s)\n"
+#~ "\n"
+#~ "Usage: dird [-f -s] [-c config_file] [-d debug_level] [config_file]\n"
+#~ "       -c <file>   setze Konfigurationsdatei auf Datei\n"
+#~ "       -dnn        setze debug level auf nn\n"
+#~ "       -f          starte im Vordergrund (f�r debugging Zwecke)\n"
+#~ "       -g          groupid\n"
+#~ "       -r <job>    starte <job> jetzt\n"
+#~ "       -s          no signals\n"
+#~ "       -t          test - Konfiguration Lesen und beenden\n"
+#~ "       -u          userid\n"
+#~ "       -v          ausf�hrliche Benutzer Meldungen\n"
+#~ "       -?          diese Meldung ausgeben.\n"
+#~ "\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "\n"
+#~ "%sVersion: %s (%s)\n"
+#~ "\n"
+#~ "Usage: bextract <options> <bacula-archive-device-name> <directory-to-"
+#~ "store-files>\n"
 #~ "       -b <file>       specify a bootstrap file\n"
 #~ "       -c <file>       specify a Storage configuration file\n"
 #~ "       -d <nn>         set debug level to <nn>\n"
 #~ "       -dt             print timestamp in debug output\n"
+#~ "       -T              send debug traces to trace file\n"
 #~ "       -e <file>       exclude list\n"
 #~ "       -i <file>       include list\n"
 #~ "       -p              proceed inspite of I/O errors\n"
+#~ "       -t              read data from volume, do not write anything\n"
 #~ "       -v              verbose\n"
 #~ "       -V <volumes>    specify Volume names (separated by |)\n"
 #~ "       -?              print this message\n"
@@ -3694,8 +4272,16 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "Regex �bersetzungsfehler. ERR=%s\n"
 
 #, fuzzy
+#~ msgid "Error writing final JobMedia record to catalog.\n"
+#~ msgstr "Fehler beim schreiben der bsr Datei.\n"
+
+#, fuzzy
 #~ msgid "Job failed or canceled.\n"
-#~ msgstr "JobId %s, Job %s zum Abbruch markiert.\n"
+#~ msgstr "%s Abgebrochen"
+
+#, fuzzy
+#~ msgid "The Volume=%s on device=%s appears to be unlabeled.\n"
+#~ msgstr "Neues Volume \"%s\" in catalog erzeugt.\n"
 
 #, fuzzy
 #~ msgid ""
@@ -3710,7 +4296,7 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #, fuzzy
 #~ msgid ""
 #~ "\n"
-#~ "Version: %s (%s)\n"
+#~ "%sVersion: %s (%s)\n"
 #~ "\n"
 #~ "Usage: bls [options] <device-name>\n"
 #~ "       -b <file>       specify a bootstrap file\n"
@@ -3726,6 +4312,7 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ "       -p              proceed inspite of errors\n"
 #~ "       -v              be verbose\n"
 #~ "       -V              specify Volume names (separated by |)\n"
+#~ "       -E              Check records to detect errors\n"
 #~ "       -?              print this message\n"
 #~ "\n"
 #~ msgstr ""
@@ -3746,10 +4333,87 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ "\n"
 
 #, fuzzy
+#~ msgid ""
+#~ "\n"
+#~ "%sVersion: %s (%s)\n"
+#~ "\n"
+#~ "Usage: bscan [ options ] <bacula-archive>\n"
+#~ "       -b bootstrap      specify a bootstrap file\n"
+#~ "       -c <file>         specify configuration file\n"
+#~ "       -d <nn>           set debug level to <nn>\n"
+#~ "       -dt               print timestamp in debug output\n"
+#~ "       -m                update media info in database\n"
+#~ "       -D <driver name>  specify the driver database name (default NULL)\n"
+#~ "       -n <name>         specify the database name (default bacula)\n"
+#~ "       -u <user>         specify database user name (default bacula)\n"
+#~ "       -P <password>     specify database password (default none)\n"
+#~ "       -h <host>         specify database host (default NULL)\n"
+#~ "       -t <port>         specify database port (default 0)\n"
+#~ "       -p                proceed inspite of I/O errors\n"
+#~ "       -r                list records\n"
+#~ "       -s                synchronize or store in database\n"
+#~ "       -S                show scan progress periodically\n"
+#~ "       -v                verbose\n"
+#~ "       -V <Volumes>      specify Volume names (separated by |)\n"
+#~ "       -w <dir>          specify working directory (default from conf "
+#~ "file)\n"
+#~ "       -?                print this message\n"
+#~ "\n"
+#~ msgstr ""
+#~ "\n"
+#~ "Version: %s (%s)\n"
+#~ "\n"
+#~ "Usage: dird [-f -s] [-c config_file] [-d debug_level] [config_file]\n"
+#~ "       -c <file>   setze Konfigurationsdatei auf Datei\n"
+#~ "       -dnn        setze debug level auf nn\n"
+#~ "       -f          starte im Vordergrund (f�r debugging Zwecke)\n"
+#~ "       -g          groupid\n"
+#~ "       -r <job>    starte <job> jetzt\n"
+#~ "       -s          no signals\n"
+#~ "       -t          test - Konfiguration Lesen und beenden\n"
+#~ "       -u          userid\n"
+#~ "       -v          ausf�hrliche Benutzer Meldungen\n"
+#~ "       -?          diese Meldung ausgeben.\n"
+#~ "\n"
+
+#, fuzzy
 #~ msgid "Could not get Client record. ERR=%s\n"
 #~ msgstr "Konnte Client Eintrag nicht anlegen. ERR=%s\n"
 
 #, fuzzy
+#~ msgid ""
+#~ "\n"
+#~ "%sVersion: %s (%s)\n"
+#~ "\n"
+#~ "Usage: bsdjson [options] [-c config_file] [config_file]\n"
+#~ "        -r <res>    get resource type <res>\n"
+#~ "        -n <name>   get resource <name>\n"
+#~ "        -l <dirs>   get only directives matching dirs (use with -r)\n"
+#~ "        -D          get only data\n"
+#~ "        -c <file>   use <file> as configuration file\n"
+#~ "        -d <nn>     set debug level to <nn>\n"
+#~ "        -dt         print timestamp in debug output\n"
+#~ "        -t          test - read config and exit\n"
+#~ "        -v          verbose user messages\n"
+#~ "        -?          print this message.\n"
+#~ "\n"
+#~ msgstr ""
+#~ "\n"
+#~ "Version: %s (%s)\n"
+#~ "\n"
+#~ "Usage: bacula-fd [-f -s] [-c config_datei] [-d debug_level]\n"
+#~ "        -c <Datei>   benutze <Datei> als Konfigurationsdatei\n"
+#~ "        -dnn        setze debug level auf nn\n"
+#~ "        -f          starte in Vordergrund (f�r debugging)\n"
+#~ "        -g          groupid\n"
+#~ "        -s          no signals (f�r debugging)\n"
+#~ "        -t          Konfigurationsdatei testen und beenden\n"
+#~ "        -u          userid\n"
+#~ "        -v          Ausf�hrliche Benutzermeldungen\n"
+#~ "        -?          diese Meldung ausgeben.\n"
+#~ "\n"
+
+#, fuzzy
 #~ msgid "Volume type error: ERR=%s\n"
 #~ msgstr "Attribute create error. %s"
 
@@ -3776,7 +4440,7 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #, fuzzy
 #~ msgid ""
 #~ "\n"
-#~ "Version: %s (%s)\n"
+#~ "%sVersion: %s (%s)\n"
 #~ "\n"
 #~ "Usage: btape <options> <device_name>\n"
 #~ "       -b <file>   specify bootstrap file\n"
@@ -3806,6 +4470,34 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ "\n"
 
 #, fuzzy
+#~ msgid "Cannot create DedupDirectory: %s"
+#~ msgstr "kann Variable operate nicht setzen: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Cannot create DedupIndexDirectory: %s"
+#~ msgstr "kann Variable operate nicht setzen: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Cannot create recovery directory: %s"
+#~ msgstr "kann Variable operate nicht setzen: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Cannot delete temporary recovery directory: %s"
+#~ msgstr "kann Variable operate nicht setzen: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Socket error or stop during rehydration. ERR=%d\n"
+#~ msgstr "Socket Fehler auf %s Kommando: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unexpected message from FD, n=%d msglen=%d msg=%s\n"
+#~ msgstr "Fehler beim Lesen der catalog DB Steuerdatei. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Error sending chunk request to client\n"
+#~ msgstr "Fehler beim senden von \"Hello\" an Storage daemon. ERR=%s\n"
+
+#, fuzzy
 #~ msgid ""
 #~ "%s is an unknown device type. Must be tape or directory\n"
 #~ " or have RequiresMount=yes for DVD. st_mode=%x\n"
@@ -3824,6 +4516,10 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "Kann DB lock nicht initialisieren. ERR=%s\n"
 
 #, fuzzy
+#~ msgid "Unable to init adata mutex: ERR=%s\n"
+#~ msgstr "Kann DB lock nicht initialisieren. ERR=%s\n"
+
+#, fuzzy
 #~ msgid "Unable to init volcat mutex: ERR=%s\n"
 #~ msgstr "Kann DB lock nicht initialisieren. ERR=%s\n"
 
@@ -3872,7 +4568,15 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "unbekannt"
 
 #, fuzzy
-#~ msgid "3002 Device \"%s\" unmounted.\n"
+#~ msgid "3002 Device \"%s\" enabled.\n"
+#~ msgstr "Pool Ressource \"%s\" nicht gefunden.\n"
+
+#, fuzzy
+#~ msgid "3002 Device \"%s\" disabled.\n"
+#~ msgstr "Pool Ressource \"%s\" nicht gefunden.\n"
+
+#, fuzzy
+#~ msgid "3002 Device \"%s\" unmounted.\n"
 #~ msgstr "Pool Ressource \"%s\" nicht gefunden.\n"
 
 #, fuzzy
@@ -3916,10 +4620,18 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "Job nicht gefunden: %s\n"
 
 #, fuzzy
+#~ msgid "Cannot open session, received bad parameters.\n"
+#~ msgstr "Kann Ausdruck\"%s\"nicht aufl�sen: ERR=%s\n"
+
+#, fuzzy
 #~ msgid "Could not open(%s,%s,0640): ERR=%s\n"
 #~ msgstr "Kann  bootstrap Datei nicht �ffnen: %s: ERR=%s\n"
 
 #, fuzzy
+#~ msgid "Could not open aligned volume: %s, ERR=%s\n"
+#~ msgstr "Kann  bootstrap Datei nicht �ffnen: %s: ERR=%s\n"
+
+#, fuzzy
 #~ msgid "Unable to stat device %s. ERR=%s\n"
 #~ msgstr "Konnte bootstrap Datei %s nicht erzeugen. ERR=%s\n"
 
@@ -3928,18 +4640,51 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "Kann  bootstrap Datei nicht �ffnen: %s: ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Recv request to Client failed. ERR=%s\n"
-#~ msgstr "Wiederherstellung l�uft..."
+#~ msgid ""
+#~ "Connection from unknown Director %s at %s rejected.\n"
+#~ "Please see "
+#~ msgstr "unbekannt"
 
 #, fuzzy
-#~ msgid "FD connect failed: Job name not found: %s\n"
+#~ msgid "Invalid Hello from %s. Len=%d\n"
+#~ msgstr "UA Hello von %s:%s:%d ist ung�ltig. Len=%d\n"
+
+#, fuzzy
+#~ msgid "Client connect failed: Job name not found: %s\n"
 #~ msgstr "Job nicht gefunden: %s\n"
 
 #, fuzzy
+#~ msgid "Recv request to Client failed. ERR=%s\n"
+#~ msgstr "Erzeugung des DB Client Eintrags %s fehlgeschlagen. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Send caps to Client failed. ERR=%s\n"
+#~ msgstr "Erzeugung des DB Client Eintrags %s fehlgeschlagen. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Recv caps from Client failed. ERR=%s\n"
+#~ msgstr "Erzeugung des DB Client Eintrags %s fehlgeschlagen. ERR=%s\n"
+
+#, fuzzy
 #~ msgid "Couldn't rewind %s device %s: ERR=%s\n"
 #~ msgstr "Kann  bootstrap Datei nicht �ffnen: %s: ERR=%s\n"
 
 #, fuzzy
+#~ msgid ""
+#~ "Got Aligned or File type Volume %s on Dedup device %s. Wanted File.\n"
+#~ msgstr "Neues Volume \"%s\" in catalog erzeugt.\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "Got Aligned or Dedup type Volume %s on File device %s. Wanted File.\n"
+#~ msgstr "Neues Volume \"%s\" in catalog erzeugt.\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "Got File or Dedup type Volume %s on Aligned device %s. Wanted Aligned.\n"
+#~ msgstr "Neues Volume \"%s\" in catalog erzeugt.\n"
+
+#, fuzzy
 #~ msgid "Could not reserve volume %s on %s device %s\n"
 #~ msgstr "Konnte FileSet \"%s\" Eintrag nicht erzeugen. ERR=%s\n"
 
@@ -3980,7 +4725,7 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "Konnte bootstrap Datei %s nicht erzeugen. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Volume \"%s\" not on %s device %s.\n"
+#~ msgid "Volume \"%s\" not loaded on %s device %s.\n"
 #~ msgstr "1997 Volume \"%s\" Nicht in Catalog.\n"
 
 #, fuzzy
@@ -4004,6 +4749,14 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "Regex �bersetzungsfehler. ERR=%s\n"
 
 #, fuzzy
+#~ msgid "Error sending header to Client. ERR=%s\n"
+#~ msgstr "Fehler beim senden von \"Hello\" an Storage daemon. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Error sending data to Client. ERR=%s\n"
+#~ msgstr "Fehler beim senden von \"Hello\" an Storage daemon. ERR=%s\n"
+
+#, fuzzy
 #~ msgid "unknown: %d"
 #~ msgstr "unbekannt"
 
@@ -4016,6 +4769,20 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "unbekannt"
 
 #, fuzzy
+#~ msgid ""
+#~ "3602 JobId=%u %s device %s is busy (already reading/writing). read=%d, "
+#~ "writers=%d reserved=%d\n"
+#~ msgstr "unbekannt"
+
+#, fuzzy
+#~ msgid "3609 JobId=%u Max concurrent jobs=%d exceeded on %s device %s.\n"
+#~ msgstr "JobId %s, Job %s zum Abbruch markiert.\n"
+
+#, fuzzy
+#~ msgid "3611 JobId=%u Volume max jobs=%d exceeded on %s device %s.\n"
+#~ msgstr "JobId %s, Job %s zum Abbruch markiert.\n"
+
+#, fuzzy
 #~ msgid "3911 JobId=%u failed reserve %s device %s.\n"
 #~ msgstr "JobId %s, Job %s zum Abbruch markiert.\n"
 
@@ -4024,23 +4791,31 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "<filed: Netzwerkfehler beim Holen der Attribute. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "*unknown*"
-#~ msgstr "unbekannt"
+#~ msgid "Truncate on attributes file failed: ERR=%s\n"
+#~ msgstr "Abfrage gescheitert: %s: ERR=%s\n"
 
 #, fuzzy
 #~ msgid ""
 #~ "\n"
-#~ "Device %s is not open.\n"
+#~ "Device \"%s\" is not open or does not exist.\n"
+#~ msgstr "unbekannt"
+
+#, fuzzy
+#~ msgid "*unknown*"
 #~ msgstr "unbekannt"
 
 #, fuzzy
 #~ msgid ""
 #~ "\n"
-#~ "Device \"%s\" is not open or does not exist.\n"
+#~ "Device %s: %s is not open.\n"
 #~ msgstr "unbekannt"
 
 #, fuzzy
-#~ msgid "Attached JobsIds: "
+#~ msgid "    Available Space=%sB\n"
+#~ msgstr "FileSet: name=%s\n"
+
+#, fuzzy
+#~ msgid "Attached JobIds: "
 #~ msgstr "ist nicht aktiviert"
 
 #, fuzzy
@@ -4048,27 +4823,23 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "      MigTime=%s MigHiBytes=%s MigLoBytes=%s\n"
 
 #, fuzzy
-#~ msgid "3900 Unknown arg in .status command: %s\n"
-#~ msgstr "unbekannt"
-
-#, fuzzy
 #~ msgid ""
 #~ "\n"
-#~ "Version: %s (%s)\n"
+#~ "%sVersion: %s (%s)\n"
 #~ "\n"
 #~ "Usage: bacula-sd [options] [-c config_file] [config_file]\n"
-#~ "        -c <file>   use <file> as configuration file\n"
-#~ "        -d <nn>     set debug level to <nn>\n"
-#~ "        -dt         print timestamp in debug output\n"
-#~ "        -f          run in foreground (for debugging)\n"
-#~ "        -g <group>  set groupid to group\n"
-#~ "        -m          print kaboom output (for debugging)\n"
-#~ "        -p          proceed despite I/O errors\n"
-#~ "        -s          no signals (for debugging)\n"
-#~ "        -t          test - read config and exit\n"
-#~ "        -u <user>   userid to <user>\n"
-#~ "        -v          verbose user messages\n"
-#~ "        -?          print this message.\n"
+#~ "     -c <file>         use <file> as configuration file\n"
+#~ "     -d <nn>[,<tags>]  set debug level to <nn>, debug tags to <tags>\n"
+#~ "     -dt               print timestamp in debug output\n"
+#~ "     -f                run in foreground (for debugging)\n"
+#~ "     -g <group>        set groupid to group\n"
+#~ "     -m                print kaboom output (for debugging)\n"
+#~ "     -p                proceed despite I/O errors\n"
+#~ "     -s                no signals (for debugging)\n"
+#~ "     -t                test - read config and exit\n"
+#~ "     -u <user>         userid to <user>\n"
+#~ "     -v                verbose user messages\n"
+#~ "     -?                print this message.\n"
 #~ "\n"
 #~ msgstr ""
 #~ "\n"
@@ -4087,6 +4858,10 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ "\n"
 
 #, fuzzy
+#~ msgid "Unable to stat ControlDevice %s: ERR=%s\n"
+#~ msgstr "Konnte bootstrap Datei %s nicht erzeugen. ERR=%s\n"
+
+#, fuzzy
 #~ msgid "Warning: unknown resource type %d\n"
 #~ msgstr "unbekannt"
 
@@ -4188,81 +4963,72 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "unbekannt"
 
 #, fuzzy
-#~ msgid "Invalid jobid argument\n"
-#~ msgstr "Ung�ltige JobId gefunden.\n"
+#~ msgid "%s: unknown file system type\n"
+#~ msgstr "unbekannt"
 
 #, fuzzy
-#~ msgid "Unknown ObjectType %s\n"
-#~ msgstr "Unbekannter \"Migration Selection Type\".\n"
+#~ msgid ""
+#~ "\n"
+#~ "\n"
+#~ "Bacula ERROR: "
+#~ msgstr "Bacula "
 
 #, fuzzy
-#~ msgid "Cannot open current directory: ERR=%s\n"
-#~ msgstr "Kann inkludierte Datei nicht �ffnen: %s. ERR=%s\n"
+#~ msgid "Unable to resolve parent path for %ls\n"
+#~ msgstr "Konnte Job Eintrag nicht holen. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Cannot get current directory: ERR=%s\n"
-#~ msgstr "kann Variable operate nicht setzen: ERR=%s\n"
+#~ msgid "Unable to parse user supplied restore configuration\n"
+#~ msgstr "Konnte Job Eintrag nicht holen. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Cannot reset current directory: ERR=%s\n"
-#~ msgstr "kann Variable operate nicht setzen: ERR=%s\n"
+#~ msgid "Registry service not found: Bacula service not started"
+#~ msgstr "Pool Ressource \"%s\" nicht gefunden.\n"
 
 #, fuzzy
-#~ msgid "CreateSGenerate VSS snapshots failed. ERR=%s\n"
-#~ msgstr "Erzeugung des db Path Eintrags %s fehlgeschlagen. ERR=%s\n"
+#~ msgid "Registry service entry point not found"
+#~ msgstr "Pool Ressource \"%s\" nicht gefunden.\n"
 
 #, fuzzy
-#~ msgid "VSS was not initialized properly. ERR=%s\n"
-#~ msgstr "Kann DB lock nicht initialisieren. ERR=%s\n"
+#~ msgid "Unable to install the service"
+#~ msgstr "Konnte bootstrap Datei %s nicht erzeugen. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Disable a job"
-#~ msgstr "ist nicht aktiviert"
+#~ msgid "Service command length too long"
+#~ msgstr "Job nicht gefunden: %s\n"
 
 #, fuzzy
-#~ msgid "Illegal JobId %s ignored\n"
-#~ msgstr "Clone JobId %d gestartet.\n"
+#~ msgid "Could not delete Registry key for "
+#~ msgstr "Kann Storage resource %s nicht finden\n"
 
-#~ msgid "1992 Update Media error. VolFiles=%u, CatFiles=%u\n"
-#~ msgstr "1992 Update Media Fehler. VolFiles=%u, CatFiles=%u\n"
+#, fuzzy
+#~ msgid "Could not lock database"
+#~ msgstr "Konnte Datenbank \"%s\" nicht �ffen.\n"
+
+#~ msgid "Expected an fstype string, got: %s\n"
+#~ msgstr "fstype Ausdruck erwartet, erhalten: %s\n"
+
+#~ msgid "Expected an drivetype string, got: %s\n"
+#~ msgstr "drivetype Ausdruck erwartet, erhalten: %s\n"
 
 #, fuzzy
-#~ msgid ""
-#~ "Written by Nicolas Boichat (2004)\n"
-#~ "\n"
-#~ "Version: %s (%s) %s %s %s\n"
-#~ "\n"
-#~ "Usage: tray-monitor [-c config_file] [-d debug_level]\n"
-#~ "       -c <file>     set configuration file to file\n"
-#~ "       -d <nn>       set debug level to <nn>\n"
-#~ "       -dt           print timestamp in debug output\n"
-#~ "       -t            test - read configuration and exit\n"
-#~ "       -?            print this message.\n"
-#~ "\n"
-#~ msgstr ""
-#~ "\n"
-#~ "Version: %s (%s)\n"
-#~ "\n"
-#~ "Usage: dird [-f -s] [-c config_file] [-d debug_level] [config_file]\n"
-#~ "       -c <file>   setze Konfigurationsdatei auf Datei\n"
-#~ "       -dnn        setze debug level auf nn\n"
-#~ "       -f          starte im Vordergrund (f�r debugging Zwecke)\n"
-#~ "       -g          groupid\n"
-#~ "       -r <job>    starte <job> jetzt\n"
-#~ "       -s          no signals\n"
-#~ "       -t          test - Konfiguration Lesen und beenden\n"
-#~ "       -u          userid\n"
-#~ "       -v          ausf�hrliche Benutzer Meldungen\n"
-#~ "       -?          diese Meldung ausgeben.\n"
-#~ "\n"
+#~ msgid "Storage from Run NextPool override"
+#~ msgstr "Storage aus der \"NextPool\" Ressource des Pools."
 
 #, fuzzy
-#~ msgid "Append data error.\n"
-#~ msgstr "unbekannt"
+#~ msgid "Storage from Job's NextPool resource"
+#~ msgstr "Storage aus der \"NextPool\" Ressource des Pools."
+
+#~ msgid "Storage from Pool's NextPool resource"
+#~ msgstr "Storage aus der \"NextPool\" Ressource des Pools."
 
 #, fuzzy
-#~ msgid "Truncate on attributes file failed: ERR=%s\n"
-#~ msgstr "Abfrage gescheitert: %s: ERR=%s\n"
+#~ msgid "Storage from NextPool override"
+#~ msgstr "Storage aus der \"NextPool\" Ressource des Pools."
+
+#, fuzzy
+#~ msgid "FD connect failed: Job name not found: %s\n"
+#~ msgstr "Job nicht gefunden: %s\n"
 
 #, fuzzy
 #~ msgid ""
@@ -4303,236 +5069,138 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgstr "Ein Benutzername f�r MySQL muss angegeben werden.\n"
 
 #, fuzzy
-#~ msgid "    Files=%s Bytes=%s Bytes/sec=%s Errors=%d\n"
-#~ msgstr "      MigTime=%s MigHiBytes=%s MigLoBytes=%s\n"
-
-#, fuzzy
-#~ msgid ""
-#~ "\n"
-#~ "\n"
-#~ "Bacula ERROR: "
-#~ msgstr "Bacula "
-
-#, fuzzy
-#~ msgid "Registry service entry point not found"
-#~ msgstr "Pool Ressource \"%s\" nicht gefunden.\n"
-
-#, fuzzy
-#~ msgid "Close without saving"
-#~ msgstr "%s OK -- mit Warnungen"
-
-#, fuzzy
-#~ msgid "Unable to write to %s\n"
-#~ msgstr "Kann DB lock nicht initialisieren. ERR=%s\n"
-
-#, fuzzy
-#~ msgid "Error while saving"
-#~ msgstr "Fehler beim schreiben der bsr Datei.\n"
-
-#, fuzzy
-#~ msgid "Enter restore mode"
-#~ msgstr "Job Ressource"
-
-#, fuzzy
-#~ msgid "Cancel restore"
-#~ msgstr "Job Ressource"
-
-#, fuzzy
-#~ msgid "Filename"
-#~ msgstr "FileSet: name=%s\n"
+#~ msgid "Illegal JobId %s ignored\n"
+#~ msgstr "Clone JobId %d gestartet.\n"
 
-#, fuzzy
-#~ msgid "RestoreFiles"
+#~ msgid "Restoring..."
 #~ msgstr "Wiederherstellung l�uft..."
 
 #, fuzzy
-#~ msgid "Error while starting restore: "
-#~ msgstr "Fehler beim schreiben der bsr Datei.\n"
-
-#, fuzzy
-#~ msgid " files selected to be restored."
-#~ msgstr "Keine Volumes zum Wiederherstellen gefunden.\n"
+#~ msgid "# Bacula bwx-console Configuration File\n"
+#~ msgstr "Bitte die Konfigurationsdatei korrigieren: %s\n"
 
-#, fuzzy
-#~ msgid "Restore failed : no file selected.\n"
+#~ msgid "More than one Filename! %s for file: %s\n"
 #~ msgstr "Mehr als ein Dateiname! %s f�r Datei: %s\n"
 
-#, fuzzy
-#~ msgid "Restore failed : no file selected."
-#~ msgstr "Mehr als ein Dateiname! %s f�r Datei: %s\n"
+#~ msgid "Error fetching row for file=%s: ERR=%s\n"
+#~ msgstr "Fehler beim Holen der Zeile f�r Datei=%s: ERR=%s\n"
 
-#, fuzzy
-#~ msgid "Restoring, please wait..."
-#~ msgstr "Wiederherstellung l�uft..."
+#~ msgid "Create db Filename record %s failed. ERR=%s\n"
+#~ msgstr "Erzeugung des db Filename Eintrags %s fehlgeschlagen. ERR=%s\n"
 
-#, fuzzy
-#~ msgid "Job failed."
-#~ msgstr "%s Abgebrochen"
+#~ msgid "More than one Filename!: %s for file: %s\n"
+#~ msgstr "Mehr als einen Dateinamen gefunden! : %s f�r Datei: %s\n"
 
 #, fuzzy
-#~ msgid "Failed to retrieve jobid.\n"
-#~ msgstr "Verbindung zu File daemon fehlgeschlagen.\n"
+#~ msgid "Get DB Filename record %s found bad record: %d\n"
+#~ msgstr "Get DB Filename record %s hat fehlerhaften Eintrag gefunden: %d\n"
 
-#, fuzzy
-#~ msgid "Restore job reported a non-fatal error."
-#~ msgstr "Attribute create error. %s"
+#~ msgid "Filename record: %s not found.\n"
+#~ msgstr "Filename record: %s nicht gefunden.\n"
 
-#, fuzzy
-#~ msgid "Restore job reported a fatal error."
-#~ msgstr "Attribute create error. %s"
+#~ msgid "Filename record: %s not found in Catalog.\n"
+#~ msgstr "Filename record: %s nicht in Catalog gefunden.\n"
 
-#, fuzzy
-#~ msgid "Restore job is waiting on File daemon."
-#~ msgstr "File daemon"
+#~ msgid "1992 Update Media error. VolFiles=%u, CatFiles=%u\n"
+#~ msgstr "1992 Update Media Fehler. VolFiles=%u, CatFiles=%u\n"
 
 #, fuzzy
-#~ msgid "Restore job is waiting for storage resource."
-#~ msgstr "Storage daemon"
+#~ msgid "Unable to read %s. ERR=%s\n"
+#~ msgstr "Konnte bootstrap Datei %s nicht erzeugen. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Failed to find the selected storage."
-#~ msgstr "Verbindung zu Storage daemon fehlgeschlagen.\n"
+#~ msgid "Unable to get the Full job for %s\n"
+#~ msgstr "Konnte Job Eintrag nicht holen. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Run Restore job"
-#~ msgstr "Konnte Migrationsjob nicht starten.\n"
+#~ msgid "Unable to write to %s to save full job name. ERR=%s\n"
+#~ msgstr "Konnte bootstrap Datei %s nicht erzeugen. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Restore cancelled."
-#~ msgstr "%s Abgebrochen"
+#~ msgid "Unable to %s exitcode=%d\n"
+#~ msgstr "Konnte bootstrap Datei %s nicht erzeugen. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "No results to list."
-#~ msgstr "Keine Ergebnisse zu \"list\" Kommando.\n"
+#~ msgid "Unable to save last controlfile into file %s. ERR=%s\n"
+#~ msgstr "Konnte bootstrap Datei %s nicht erzeugen. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "No backup found for this client."
-#~ msgstr "Kein Job gefunden f�r: %s.\n"
+#~ msgid "Unable to create  %s "
+#~ msgstr "Kann Konsole \"%s\" an %s:%s:%d nicht authentisieren.\n"
 
 #, fuzzy
-#~ msgid "Query failed"
-#~ msgstr "Abfrage fehlgeschlagen: %s\n"
+#~ msgid "Unable to save last SCN into file %s. ERR=%s\n"
+#~ msgstr "Konnte bootstrap Datei %s nicht erzeugen. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Bootstrap:"
-#~ msgstr "  --> Bootstrap=%s\n"
+#~ msgid "Cannot find last control file ret=%d\n"
+#~ msgstr "Kann Console resource %s nicht finden\n"
 
 #, fuzzy
-#~ msgid "FileSet:"
-#~ msgstr "FileSet: name=%s\n"
+#~ msgid "Can't open /etc/oratab. ERR=%s\n"
+#~ msgstr "Kann inkludierte Datei nicht �ffnen: %s. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Storage:"
-#~ msgstr "Storage daemon"
-
-#~ msgid "Restoring..."
-#~ msgstr "Wiederherstellung l�uft..."
+#~ msgid "Unable to list schema for %s. exitcode=%d\n"
+#~ msgstr "Konnte bootstrap Datei %s nicht erzeugen. ERR=%s\n"
 
 #, fuzzy
-#~ msgid ""
-#~ "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined "
-#~ "for Director \"%s\" in config file.\n"
-#~ "At least one CA certificate store is required.\n"
-#~ msgstr ""
-#~ "Weder \"TLS CA Certificate\"  noch \"TLS CA Certificate Dir\" sind f�r "
-#~ "Director \"%s\" in %s definert. Mindestens ein CA certificate store wird "
-#~ "ben�tigt wenn \"TLS Verify Peer\" eingesetzt wird.\n"
+#~ msgid "Can't open %s. ERR=%s\n"
+#~ msgstr "Kann Ausdruck\"%s\"nicht aufl�sen: ERR=%s\n"
 
 #, fuzzy
-#~ msgid ""
-#~ "No Director resource defined in config file.\n"
-#~ "Without that I don't how to speak to the Director :-(\n"
-#~ msgstr ""
-#~ "Keine Director resource definiert in %s\n"
-#~ "Ohne dies weiss ich nicht wer ich bin :-(\n"
+#~ msgid "Error occured while selecting instance.\n"
+#~ msgstr "Fehler beim schreiben der bsr Datei.\n"
 
 #, fuzzy
-#~ msgid ""
-#~ "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined "
-#~ "for Console \"%s\" in config file.\n"
-#~ msgstr ""
-#~ "Weder \"TLS CA Certificate\" noch \"TLS CA Certificate Dir\" sind "
-#~ "definiert f�rStorage \"%s\" in %s.\n"
+#~ msgid "Unable to open %s to save RMAN output. ERR=%s\n"
+#~ msgstr "Konnte Job Eintrag nicht holen. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Error while initializing windows sockets...\n"
+#~ msgid "Error occured while dumping tempfiles ERR=%s\n"
 #~ msgstr "Fehler beim schreiben der bsr Datei.\n"
 
 #, fuzzy
-#~ msgid "Error while initializing library."
+#~ msgid "Error occured while dumping logfiles ERR=%s\n"
 #~ msgstr "Fehler beim schreiben der bsr Datei.\n"
 
 #, fuzzy
-#~ msgid "Cryptographic library initialization failed.\n"
-#~ msgstr "Initialisierung der Verschl�sselungsbibliothek fehlgeschlagen.\n"
-
-#, fuzzy
-#~ msgid "Please correct configuration file.\n"
-#~ msgstr "Bitte die Konfigurationsdatei korrigieren: %s\n"
-
-#, fuzzy
-#~ msgid "Error : Library not initialized\n"
-#~ msgstr "Initialisierung der Verschl�sselungsbibliothek fehlgeschlagen.\n"
+#~ msgid ""
+#~ "Unable to copy schema \"%s\" to \"%s\" ret=%d\n"
+#~ "%s\n"
+#~ msgstr "Konnte Job Eintrag nicht holen. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Error : No configuration file loaded\n"
-#~ msgstr "Bitte die Konfigurationsdatei korrigieren: %s\n"
+#~ msgid "Disable a job"
+#~ msgstr "ist nicht aktiviert"
 
 #, fuzzy
-#~ msgid "Connecting...\n"
-#~ msgstr "Wiederherstellung l�uft..."
+#~ msgid "Failed to initialize database backend\n"
+#~ msgstr "Konnte Datenbank \"%s\" nicht �ffen.\n"
 
 #, fuzzy
-#~ msgid "Error : No director defined in config file.\n"
-#~ msgstr "Keine Job records definiert in %s\n"
+#~ msgid "disabled"
+#~ msgstr "ist nicht aktiviert"
 
-#, fuzzy
-#~ msgid "Failed to connect to the director\n"
-#~ msgstr "Verbindung zu File daemon fehlgeschlagen.\n"
+#~ msgid "Name item is required in %s resource, but not found.\n"
+#~ msgstr ""
+#~ "Name item wird ben�tigt in %s resource, wurde aber nicht gefunden.\n"
 
 #, fuzzy
-#~ msgid "Unknown command."
+#~ msgid "    Drive %d status unknown.\n"
 #~ msgstr "unbekannt"
 
 #, fuzzy
-#~ msgid "Change of configuration file"
-#~ msgstr "Bitte die Konfigurationsdatei korrigieren: %s\n"
-
-#, fuzzy
-#~ msgid "Change your default configuration file"
-#~ msgstr "Bitte die Konfigurationsdatei korrigieren: %s\n"
-
-#, fuzzy
-#~ msgid "Edit your configuration file"
-#~ msgstr "Bitte die Konfigurationsdatei korrigieren: %s\n"
-
-#, fuzzy
-#~ msgid "Unable to read configuration file"
-#~ msgstr "Bitte die Konfigurationsdatei korrigieren: %s\n"
-
-#, fuzzy
-#~ msgid "Please choose a configuration file to use"
-#~ msgstr "Bitte die Konfigurationsdatei korrigieren: %s\n"
-
-#, fuzzy
-#~ msgid "Using this configuration file: %s\n"
-#~ msgstr "Bitte die Konfigurationsdatei korrigieren: %s\n"
-
-#, fuzzy
-#~ msgid "Please choose your default configuration file"
-#~ msgstr "Bitte die Konfigurationsdatei korrigieren: %s\n"
-
-#, fuzzy
-#~ msgid "Use this configuration file as default?"
-#~ msgstr "Bitte die Konfigurationsdatei korrigieren: %s\n"
+#~ msgid "Append data error.\n"
+#~ msgstr "unbekannt"
 
 #, fuzzy
-#~ msgid "Configuration file"
-#~ msgstr "Bitte die Konfigurationsdatei korrigieren: %s\n"
+#~ msgid "A dbi driver for DBI must be supplied.\n"
+#~ msgstr "Ein Benutzername f�r MySQL muss angegeben werden.\n"
 
 #, fuzzy
-#~ msgid "    Drive %d status unknown.\n"
-#~ msgstr "unbekannt"
+#~ msgid "Max sched run time exceeded. Job canceled.\n"
+#~ msgstr "\"Max run time\" �berschritten, Job abgebrochen.\n"
 
 #, fuzzy
 #~ msgid ""
@@ -4548,14 +5216,6 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ "html#SECTION003760000000000000000 for help.\n"
 #~ msgstr "unbekannthttp://www.bacula.org/rel-manual/faq.html"
 
-#, fuzzy
-#~ msgid "A dbi driver for DBI must be supplied.\n"
-#~ msgstr "Ein Benutzername f�r MySQL muss angegeben werden.\n"
-
-#, fuzzy
-#~ msgid "Max sched run time exceeded. Job canceled.\n"
-#~ msgstr "\"Max run time\" �berschritten, Job abgebrochen.\n"
-
 #~ msgid "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"
 #~ msgstr "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"
 
@@ -4603,6 +5263,36 @@ msgstr "Unbekannter resource type %d in save_resource.\n"
 #~ msgid "No Catalog resource defined for client %s\n"
 #~ msgstr "Keine Messages resource definiert in %s\n"
 
+#, fuzzy
+#~ msgid ""
+#~ "\n"
+#~ "Version: %s (%s) %s %s %s\n"
+#~ "\n"
+#~ "Usage: bgnome-console [-s] [-c config_file] [-d debug_level] "
+#~ "[config_file]\n"
+#~ "       -c <file>   set configuration file to file\n"
+#~ "       -dnn        set debug level to nn\n"
+#~ "       -s          no signals\n"
+#~ "       -t          test - read configuration and exit\n"
+#~ "       -?          print this message.\n"
+#~ "\n"
+#~ msgstr ""
+#~ "\n"
+#~ "Version: %s (%s)\n"
+#~ "\n"
+#~ "Usage: dird [-f -s] [-c config_file] [-d debug_level] [config_file]\n"
+#~ "       -c <file>   setze Konfigurationsdatei auf Datei\n"
+#~ "       -dnn        setze debug level auf nn\n"
+#~ "       -f          starte im Vordergrund (f�r debugging Zwecke)\n"
+#~ "       -g          groupid\n"
+#~ "       -r <job>    starte <job> jetzt\n"
+#~ "       -s          no signals\n"
+#~ "       -t          test - Konfiguration Lesen und beenden\n"
+#~ "       -u          userid\n"
+#~ "       -v          ausf�hrliche Benutzer Meldungen\n"
+#~ "       -?          diese Meldung ausgeben.\n"
+#~ "\n"
+
 #~ msgid "pthread_mutex_lock: ERR=%s\n"
 #~ msgstr "pthread_mutex_lock: ERR=%s\n"
 
diff --git a/po/es.po b/po/es.po
index 0208037..24dae7f 100644
--- a/po/es.po
+++ b/po/es.po
@@ -1,18 +1,17 @@
 # Spanish translations for branch package
 # Traducciones al español para el paquete branch.
-# Copyright (C) 2006-2014 Free Software Foundation Europe e.V.
-# This file is distributed under the same license as the branch package.
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #
-#  <kern at sibbald.com>, 2006-2014
 msgid ""
 msgstr ""
 "Project-Id-Version: Bacula 3.0.2\n"
 "Report-Msgid-Bugs-To: bacula-devel at lists.sourceforge.net\n"
-"POT-Creation-Date: 2014-07-29 18:18+0200\n"
+"POT-Creation-Date: 2015-08-09 15:05+0200\n"
 "PO-Revision-Date: 2009-12-01 16:04-0300\n"
 "Last-Translator: Victor Hugo dos Santos <listas.vhs at gmail.com>\n"
 "Language-Team: Bacula Spanish Team <bacula-users-es at lists.sourceforge.net>\n"
-"Language: \n"
+"Language: Spanish\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=utf-8\n"
 "Content-Transfer-Encoding: 8bit\n"
@@ -20,16 +19,17 @@ msgstr ""
 "X-Poedit-Language: Spanish\n"
 "X-Poedit-SourceCharset: utf-8\n"
 
-#: src/baconfig.h:60 src/baconfig.h:61 src/baconfig.h:66 src/baconfig.h:67
+#: src/baconfig.h:64 src/baconfig.h:65 src/baconfig.h:70 src/baconfig.h:71
+#: src/baconfig.h:82 src/baconfig.h:83
 #, c-format
 msgid "Failed ASSERT: %s\n"
 msgstr "Fallo ASSERT: %s\n"
 
-#: src/baconfig.h:76
+#: src/baconfig.h:91
 msgid "*None*"
 msgstr "*Ninguno*"
 
-#: src/lib/status.h:73
+#: src/lib/status.h:78
 msgid ""
 "\n"
 "Terminated Jobs:\n"
@@ -37,109 +37,113 @@ msgstr ""
 "\n"
 "Jobs No Terminados:\n"
 
-#: src/lib/status.h:80
+#: src/lib/status.h:85
 msgid " JobId  Level    Files      Bytes   Status   Finished        Name \n"
 msgstr "JobId Nivel Archivos Bytes Estado Finalizado Nombre \n"
 
-#: src/lib/status.h:82
+#: src/lib/status.h:87
 msgid "===================================================================\n"
 msgstr "===================================================================\n"
 
-#: src/lib/status.h:102
+#: src/lib/status.h:107
 msgid "Created"
 msgstr "Creado"
 
-#: src/lib/status.h:106
+#: src/lib/status.h:111
 msgid "Error"
 msgstr "Error"
 
-#: src/lib/status.h:109
+#: src/lib/status.h:114
 msgid "Diffs"
 msgstr "Diferencias"
 
-#: src/lib/status.h:112
+#: src/lib/status.h:117
 msgid "Cancel"
 msgstr "Cancelar"
 
-#: src/lib/status.h:115
+#: src/lib/status.h:120
 msgid "OK"
 msgstr "OK"
 
-#: src/lib/status.h:118
+#: src/lib/status.h:123
 msgid "OK -- with warnings"
 msgstr "OK - con advertencias"
 
-#: src/lib/status.h:122
+#: src/lib/status.h:126
+msgid "Incomplete"
+msgstr ""
+
+#: src/lib/status.h:129
 msgid "Other"
 msgstr "Otros"
 
-#: src/lib/status.h:134
+#: src/lib/status.h:141
 #, c-format
 msgid "%6d\t%-6s\t%8s\t%10s\t%-7s\t%-8s\t%s\n"
 msgstr "%6d\t%-6s\t%8s\t%10s\t%-7s\t%-8s\t%s\n"
 
-#: src/lib/status.h:142
+#: src/lib/status.h:149
 #, c-format
 msgid "%6d  %-6s %8s %10s  %-7s  %-8s %s\n"
 msgstr "%6d %-6s %8s %10s %-7s %-8s %s\n"
 
-#: src/lib/status.h:171 src/lib/status.h:182 src/lib/status.h:196
-#: src/lib/status.h:200 src/lib/status.h:204
+#: src/lib/status.h:178 src/lib/status.h:189 src/lib/status.h:203
+#: src/lib/status.h:207 src/lib/status.h:211
 msgid "Bacula "
 msgstr "Bacula"
 
-#: src/qt-console/bat_conf.cpp:130
+#: src/qt-console/bat_conf.cpp:133
 #, c-format
 msgid "No record for %d %s\n"
 msgstr "Ningún registro para %d %s\n"
 
-#: src/qt-console/bat_conf.cpp:139
+#: src/qt-console/bat_conf.cpp:142
 #, c-format
 msgid "Director: name=%s address=%s DIRport=%d\n"
 msgstr "Director: nombre=%s dirección=%s DIRport=%d\n"
 
-#: src/qt-console/bat_conf.cpp:143
+#: src/qt-console/bat_conf.cpp:146
 #, c-format
 msgid "Console: name=%s\n"
 msgstr "Console: nombre=%s\n"
 
-#: src/qt-console/bat_conf.cpp:146
-#: src/qt-console/tray-monitor/tray_conf.cpp:183
+#: src/qt-console/bat_conf.cpp:149
+#: src/qt-console/tray-monitor/tray_conf.cpp:187
 #, c-format
 msgid "ConsoleFont: name=%s font face=%s\n"
 msgstr "ConsoleFont: nombre=%s font face=%s\n"
 
-#: src/qt-console/bat_conf.cpp:150 src/qt-console/bat_conf.cpp:231
-#: src/qt-console/bat_conf.cpp:279 src/qt-console/bat_conf.cpp:309
+#: src/qt-console/bat_conf.cpp:153 src/qt-console/bat_conf.cpp:234
+#: src/qt-console/bat_conf.cpp:284 src/qt-console/bat_conf.cpp:314
 #, c-format
 msgid "Unknown resource type %d\n"
 msgstr "Tipo de recurso desconocido %d\n"
 
-#: src/qt-console/bat_conf.cpp:257
-#: src/qt-console/tray-monitor/tray_conf.cpp:276
+#: src/qt-console/bat_conf.cpp:262
+#: src/qt-console/tray-monitor/tray_conf.cpp:280
 #, c-format
 msgid "%s item is required in %s resource, but not found.\n"
 msgstr "Ítem %s es necesario en recurso %s, pero no se encuentra.\n"
 
-#: src/qt-console/bat_conf.cpp:326
-#: src/qt-console/tray-monitor/tray_conf.cpp:360
+#: src/qt-console/bat_conf.cpp:331
+#: src/qt-console/tray-monitor/tray_conf.cpp:364
 #, c-format
 msgid "Attempt to define second %s resource named \"%s\" is not permitted.\n"
 msgstr ""
 "Segundo intento de definir recurso %s llamado \"%s\" no está permitido.\n"
 
-#: src/qt-console/bcomm/dircomm.cpp:85
+#: src/qt-console/bcomm/dircomm.cpp:89
 #, c-format
 msgid "Already connected\"%s\".\n"
 msgstr "Ya conectado\"%s\".\n"
 
-#: src/qt-console/bcomm/dircomm.cpp:96
-#: src/qt-console/tray-monitor/tray-monitor.cpp:347
+#: src/qt-console/bcomm/dircomm.cpp:100
+#: src/qt-console/tray-monitor/tray-monitor.cpp:353
 #, c-format
 msgid "Connecting to Director %s:%d"
 msgstr "Conectando con Director %s:%d"
 
-#: src/qt-console/bcomm/dircomm.cpp:98
+#: src/qt-console/bcomm/dircomm.cpp:102
 #, c-format
 msgid ""
 "Connecting to Director %s:%d\n"
@@ -148,59 +152,59 @@ msgstr ""
 "Conectando con Director %s:%d\n"
 "\n"
 
-#: src/qt-console/bcomm/dircomm.cpp:150
+#: src/qt-console/bcomm/dircomm.cpp:154
 #, c-format
 msgid "Failed to initialize TLS context for Console \"%s\".\n"
 msgstr "Fallo al inicializar el contexto TLS para la consola \"%s\".\n"
 
-#: src/qt-console/bcomm/dircomm.cpp:173
+#: src/qt-console/bcomm/dircomm.cpp:177
 #, c-format
 msgid "Failed to initialize TLS context for Director \"%s\".\n"
 msgstr "Fallo al inicializar el contexto TLS para el Director \"%s\".\n"
 
-#: src/qt-console/bcomm/dircomm.cpp:195
-#: src/qt-console/tray-monitor/tray-monitor.cpp:352
+#: src/qt-console/bcomm/dircomm.cpp:199
+#: src/qt-console/tray-monitor/tray-monitor.cpp:358
 msgid "Director daemon"
 msgstr "Servicio Director"
 
-#: src/qt-console/bcomm/dircomm.cpp:233
+#: src/qt-console/bcomm/dircomm.cpp:237
 msgid "Initializing ..."
 msgstr "Inicializando ..."
 
-#: src/qt-console/bcomm/dircomm.cpp:249 src/qt-console/console/console.cpp:130
+#: src/qt-console/bcomm/dircomm.cpp:253 src/qt-console/console/console.cpp:134
 msgid "Connected"
 msgstr "Conectado"
 
-#: src/qt-console/bcomm/dircomm.cpp:373
+#: src/qt-console/bcomm/dircomm.cpp:377
 msgid "Command completed ..."
 msgstr "Comando completado ..."
 
-#: src/qt-console/bcomm/dircomm.cpp:380 src/qt-console/console/console.cpp:367
+#: src/qt-console/bcomm/dircomm.cpp:384 src/qt-console/console/console.cpp:371
 msgid "Processing command ..."
 msgstr "Procesando comando ..."
 
-#: src/qt-console/bcomm/dircomm.cpp:387
+#: src/qt-console/bcomm/dircomm.cpp:391
 msgid "At main prompt waiting for input ..."
 msgstr "En prompt principal esperando por una entrada..."
 
-#: src/qt-console/bcomm/dircomm.cpp:394 src/qt-console/bcomm/dircomm.cpp:407
+#: src/qt-console/bcomm/dircomm.cpp:398 src/qt-console/bcomm/dircomm.cpp:408
 msgid "At prompt waiting for input ..."
 msgstr "En prompt esperando por una entrada..."
 
-#: src/qt-console/bcomm/dircomm.cpp:415
+#: src/qt-console/bcomm/dircomm.cpp:416
 msgid "Command failed."
 msgstr "Comando fallido."
 
-#: src/qt-console/bcomm/dircomm.cpp:487
+#: src/qt-console/bcomm/dircomm.cpp:488
 msgid "Director disconnected."
 msgstr "Director desconectado."
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:107
+#: src/qt-console/bcomm/dircomm_auth.cpp:111
 #, c-format
 msgid "Director authorization problem at \"%s:%d\"\n"
 msgstr "Problema de autorización de Director en \"%s:%d\"\n"
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:114
+#: src/qt-console/bcomm/dircomm_auth.cpp:118
 #, c-format
 msgid ""
 "Authorization problem: Remote server at \"%s:%d\" did not advertise required "
@@ -209,7 +213,7 @@ msgstr ""
 "Problema de autorización: El servidor remoto en \"%s:%d\" no anuncio soporte "
 "TLS  requiere.\n"
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:122
+#: src/qt-console/bcomm/dircomm_auth.cpp:126
 #, c-format
 msgid ""
 "Authorization problem with Director at \"%s:%d\": Remote server requires "
@@ -218,12 +222,12 @@ msgstr ""
 "Problema de autorización con el Director en \"%s:%d\": El servidor remoto "
 "requiere TLS.\n"
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:133
+#: src/qt-console/bcomm/dircomm_auth.cpp:137
 #, c-format
 msgid "TLS negotiation failed with Director at \"%s:%d\"\n"
 msgstr "Fallo negociación TLS no con el Director en \"%s:%d\"\n"
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:145
+#: src/qt-console/bcomm/dircomm_auth.cpp:149
 #, c-format
 msgid ""
 "Bad response to Hello command: ERR=%s\n"
@@ -232,19 +236,19 @@ msgstr ""
 "Mala respuesta al comando Hello: ERR=%s\n"
 "El director en \"%s:%d\" probablemente no esta corriendo.\n"
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:154
+#: src/qt-console/bcomm/dircomm_auth.cpp:158
 #, c-format
 msgid "Director at \"%s:%d\" rejected Hello command\n"
 msgstr "Director en \"%s:%d\" rechazó comando Hello\n"
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:169
+#: src/qt-console/bcomm/dircomm_auth.cpp:173
 #, fuzzy, c-format
 msgid ""
 "Authorization problem with Director at \"%s:%d\"\n"
 "Most likely the passwords do not agree.\n"
 "If you are using TLS, there may have been a certificate validation error "
 "during the TLS handshake.\n"
-"Please see "
+"For help, please see "
 msgstr ""
 "Problema de autorización con el Director en \"%s:%d\"\n"
 "Lo mas probable es que las contraseñas no están de acuerdo.\n"
@@ -253,17 +257,17 @@ msgstr ""
 " Por favor vea http://www.bacula.org/en/rel-manual/"
 "Bacula_Freque_Asked_Questi.html#SECTION003760000000000000000 para ayuda.\n"
 
-#: src/qt-console/main.cpp:154
+#: src/qt-console/main.cpp:159
 msgid "Cryptography library initialization failed.\n"
 msgstr "Inicialización de la librería de criptografía ha fallado.\n"
 
-#: src/qt-console/main.cpp:158
+#: src/qt-console/main.cpp:163
 #, c-format
 msgid "Please correct configuration file: %s\n"
 msgstr "Por favor, corrija el archivo de configuración: %s\n"
 
-#: src/qt-console/main.cpp:180
-#, c-format
+#: src/qt-console/main.cpp:187
+#, fuzzy, c-format
 msgid ""
 "\n"
 "Version: %s (%s) %s %s %s\n"
@@ -288,11 +292,11 @@ msgstr ""
 " -? imprimir este mensaje.\n"
 "\n"
 
-#: src/qt-console/main.cpp:213 src/qt-console/main.cpp:243
+#: src/qt-console/main.cpp:220 src/qt-console/main.cpp:250
 msgid "TLS required but not configured in Bacula.\n"
 msgstr "Se requiere TLS pero no está configurado en Bacula.\n"
 
-#: src/qt-console/main.cpp:221
+#: src/qt-console/main.cpp:228
 #, c-format
 msgid ""
 "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined for "
@@ -302,7 +306,7 @@ msgstr ""
 "definidos para Director \"%s\" en %s. Por lo menos un almacén de "
 "Certificados CA es necesario.\n"
 
-#: src/qt-console/main.cpp:230
+#: src/qt-console/main.cpp:237
 #, c-format
 msgid ""
 "No Director resource defined in %s\n"
@@ -311,7 +315,7 @@ msgstr ""
 "Recurso Director no definido en %s\n"
 "Sin eso no sé cómo hablar con el Director :-(\n"
 
-#: src/qt-console/main.cpp:251
+#: src/qt-console/main.cpp:258
 #, c-format
 msgid ""
 "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined for "
@@ -320,70 +324,70 @@ msgstr ""
 "Ni \"Certificado TLS CA\" o \"Directorio de Certificado TLS CA\" están "
 "definidos para Console \"%s\" en %s.\n"
 
-#: src/qt-console/tray-monitor/authenticate.cpp:75
+#: src/qt-console/tray-monitor/authenticate.cpp:79
 #, fuzzy
 msgid ""
 "Director authorization problem.\n"
 "Most likely the passwords do not agree.\n"
-"Please see "
+"For help, please see "
 msgstr ""
 "Director problema de autorización.\n"
 "Lo mas probable es que las contraseñas no están de acuerdo.\n"
 "Por favor vea http://www.bacula.org/en/rel-manual/Bacula_Freque_Asked_Questi."
 "html#SECTION003760000000000000000 para ayuda.\n"
 
-#: src/qt-console/tray-monitor/authenticate.cpp:84
+#: src/qt-console/tray-monitor/authenticate.cpp:88
 #, c-format
 msgid "Bad response to Hello command: ERR=%s\n"
 msgstr "mala respuesta al comando Hello: ERR=%s\n"
 
-#: src/qt-console/tray-monitor/authenticate.cpp:91
+#: src/qt-console/tray-monitor/authenticate.cpp:95
 msgid "Director rejected Hello command\n"
 msgstr "Director rechazo comando Hello\n"
 
-#: src/qt-console/tray-monitor/authenticate.cpp:119
+#: src/qt-console/tray-monitor/authenticate.cpp:123
 #, c-format
 msgid "Error sending Hello to Storage daemon. ERR=%s\n"
 msgstr "Error enviando Hello al servicio de Almacenamiento. ERR=%s\n"
 
-#: src/qt-console/tray-monitor/authenticate.cpp:125
+#: src/qt-console/tray-monitor/authenticate.cpp:129
 #, fuzzy
 msgid ""
 "Director and Storage daemon passwords or names not the same.\n"
-"Please see "
+"For help, please see "
 msgstr "Nombres o contraseñas en el Director o Storage no son las mismas.\n"
 
-#: src/qt-console/tray-monitor/authenticate.cpp:132
+#: src/qt-console/tray-monitor/authenticate.cpp:136
 #, c-format
 msgid "bdird<stored: bad response to Hello command: ERR=%s\n"
 msgstr "bdird<stored:mala respuesta al comando Hello: ERR=%s\n"
 
-#: src/qt-console/tray-monitor/authenticate.cpp:139
+#: src/qt-console/tray-monitor/authenticate.cpp:143
 msgid "Storage daemon rejected Hello command\n"
 msgstr "Storage servicio rechazo el comando Hello\n"
 
-#: src/qt-console/tray-monitor/authenticate.cpp:165
+#: src/qt-console/tray-monitor/authenticate.cpp:169
 #, c-format
 msgid "Error sending Hello to File daemon. ERR=%s\n"
 msgstr "Error al enviar Hello para el demonio File. ERR=%s\n"
 
-#: src/qt-console/tray-monitor/authenticate.cpp:171
+#: src/qt-console/tray-monitor/authenticate.cpp:175
 #, fuzzy
 msgid ""
 "Director and File daemon passwords or names not the same.\n"
-"Please see "
+"For help, please see "
 msgstr "Contraseñas del demonio Director y File no son los mismos.\n"
 
-#: src/qt-console/tray-monitor/authenticate.cpp:178
+#: src/qt-console/tray-monitor/authenticate.cpp:182
 #, c-format
 msgid "Bad response from File daemon to Hello command: ERR=%s\n"
 msgstr "Mala respuesta desde el demonio File para el comando Hello: ERR=%s\n"
 
-#: src/qt-console/tray-monitor/authenticate.cpp:185
+#: src/qt-console/tray-monitor/authenticate.cpp:189
 msgid "File daemon rejected Hello command\n"
 msgstr "El demonio File rechazó el comando Hello\n"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:55
+#: src/qt-console/tray-monitor/tray-monitor.cpp:59
 #, fuzzy, c-format
 msgid ""
 "\n"
@@ -409,7 +413,7 @@ msgstr ""
 " -? imprimir este mensaje.\n"
 "\n"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:204
+#: src/qt-console/tray-monitor/tray-monitor.cpp:210
 #, c-format
 msgid ""
 "Error: %d Monitor resources defined in %s. You must define one and only one "
@@ -418,7 +422,7 @@ msgstr ""
 "Error: %d Monitor de recursos definidos en %s. Usted debe definir un único "
 "monitor de recursos.\n"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:236
+#: src/qt-console/tray-monitor/tray-monitor.cpp:242
 #, c-format
 msgid ""
 "No Client, Storage or Director resource defined in %s\n"
@@ -429,7 +433,7 @@ msgstr ""
 "Sin esto, Yo no se como obtener el estado de los demonios File, Storage o "
 "Director :-(\n"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:251
+#: src/qt-console/tray-monitor/tray-monitor.cpp:257
 #, c-format
 msgid ""
 "Invalid refresh interval defined in %s\n"
@@ -440,106 +444,106 @@ msgstr ""
 "Este valor debe ser mayor o igual a 1 segundo y menor o igual a 10 minutos "
 "(leer el valor:% d).\n"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:319
+#: src/qt-console/tray-monitor/tray-monitor.cpp:325
 #, c-format
 msgid "Error, currentitem is not a Client or a Storage..\n"
 msgstr "Error, CurrentItem no es un Cliente o un Storage ...\n"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:357
+#: src/qt-console/tray-monitor/tray-monitor.cpp:363
 #, c-format
 msgid "Connecting to Client %s:%d"
 msgstr "Conectando con Cliente %s:%d"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:362
+#: src/qt-console/tray-monitor/tray-monitor.cpp:368
 msgid "File daemon"
 msgstr "demonio File"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:367
+#: src/qt-console/tray-monitor/tray-monitor.cpp:373
 #, c-format
 msgid "Connecting to Storage %s:%d"
 msgstr "Conectando con Storage %s:%d"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:372
+#: src/qt-console/tray-monitor/tray-monitor.cpp:378
 msgid "Storage daemon"
 msgstr "Demonio Storage"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:376
-#: src/qt-console/tray-monitor/tray-monitor.cpp:406
+#: src/qt-console/tray-monitor/tray-monitor.cpp:382
+#: src/qt-console/tray-monitor/tray-monitor.cpp:412
 #, c-format
 msgid "Error, currentitem is not a Client, a Storage or a Director..\n"
 msgstr "Error, currentitem no es un cliente, un Storage o un Director..\n"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:381
+#: src/qt-console/tray-monitor/tray-monitor.cpp:387
 msgid "Cannot connect to daemon."
 msgstr "No se puede conectar al demonio"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:390
+#: src/qt-console/tray-monitor/tray-monitor.cpp:396
 #, c-format
 msgid "Authentication error : %s"
 msgstr "Error de autenticación : %s"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:397
+#: src/qt-console/tray-monitor/tray-monitor.cpp:403
 msgid "Opened connection with Director daemon."
 msgstr "Conexión abierta con demonio Director."
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:400
+#: src/qt-console/tray-monitor/tray-monitor.cpp:406
 msgid "Opened connection with File daemon."
 msgstr "Conexión abierta con demonio File."
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:403
+#: src/qt-console/tray-monitor/tray-monitor.cpp:409
 msgid "Opened connection with Storage daemon."
 msgstr "Conexión abierta con demonio Storage."
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:454
+#: src/qt-console/tray-monitor/tray-monitor.cpp:460
 msgid "Error : BNET_HARDEOF or BNET_ERROR"
 msgstr "Error: BNET_HARDEOF o BNET_ERROR"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:463
+#: src/qt-console/tray-monitor/tray-monitor.cpp:469
 msgid "Error : Connection closed."
 msgstr "Error : Conexión cerrada."
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:156
+#: src/qt-console/tray-monitor/tray_conf.cpp:160
 #, c-format
 msgid "No %s resource defined\n"
 msgstr "Recurso %s no definido\n"
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:165
+#: src/qt-console/tray-monitor/tray_conf.cpp:169
 #, c-format
 msgid "Monitor: name=%s FDtimeout=%s SDtimeout=%s\n"
 msgstr "Monitor: nombre=%s FDtimeout=%s SDtimeout=%s\n"
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:171
+#: src/qt-console/tray-monitor/tray_conf.cpp:175
 #, c-format
 msgid "Director: name=%s address=%s FDport=%d\n"
 msgstr "Director: nombre=%s dirección=%s FDport=%d\n"
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:175
+#: src/qt-console/tray-monitor/tray_conf.cpp:179
 #, c-format
 msgid "Client: name=%s address=%s FDport=%d\n"
 msgstr "Cliente: nombre=%s dirección=%s FDport=%d\n"
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:179
+#: src/qt-console/tray-monitor/tray_conf.cpp:183
 #, c-format
 msgid "Storage: name=%s address=%s SDport=%d\n"
 msgstr "Storage: nombre=%s dirección=%s SDport=%d\n"
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:187
+#: src/qt-console/tray-monitor/tray_conf.cpp:191
 #, c-format
 msgid "Unknown resource type %d in dump_resource.\n"
 msgstr "Tipo de recurso desconocido %d en dump_resource.\n"
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:245
+#: src/qt-console/tray-monitor/tray_conf.cpp:249
 #, c-format
 msgid "Unknown resource type %d in free_resource.\n"
 msgstr "Tipo de recurso desconocido %d en free_resource.\n"
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:282
+#: src/qt-console/tray-monitor/tray_conf.cpp:286
 #, c-format
 msgid "Too many items in %s resource\n"
 msgstr "Demasiados ítem en recurso %s\n"
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:302
-#: src/qt-console/tray-monitor/tray_conf.cpp:340
+#: src/qt-console/tray-monitor/tray_conf.cpp:306
+#: src/qt-console/tray-monitor/tray_conf.cpp:344
 #, c-format
 msgid "Unknown resource type %d in save_resource.\n"
 msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
@@ -547,6 +551,9 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Query failed: %s: ERR=%s\n"
 #~ msgstr "Consulta fallida: %s: ERR=%s\n"
 
+#~ msgid "A user name for MySQL must be supplied.\n"
+#~ msgstr "Un nombre de usuario para MySQL debe de ser suministrado.\n"
+
 #~ msgid "Unable to initialize DB lock. ERR=%s\n"
 #~ msgstr "No se puede inicializar el bloqueo de la BD. ERR=%s\n"
 
@@ -562,8 +569,8 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Attribute create error. %s"
 #~ msgstr "error al crear Atributo.%s"
 
-#~ msgid "A user name for MySQL must be supplied.\n"
-#~ msgstr "Un nombre de usuario para MySQL debe de ser suministrado.\n"
+#~ msgid "A user name for PostgreSQL must be supplied.\n"
+#~ msgstr "Un nombre de usuario para PostgreSQL debe de ser suministrado.\n"
 
 #~ msgid "error fetching row: %s\n"
 #~ msgstr "error al obtener la fila:%s\n"
@@ -594,6 +601,10 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "PQunescapeByteaConn returned NULL.\n"
 #~ msgstr "PQescapeStringConn devuelto no-cero.\n"
 
+#, fuzzy
+#~ msgid "Fetch failed: ERR=%s\n"
+#~ msgstr "prctl fallido: ERR=%s\n"
+
 #~ msgid "error fetching currval: %s\n"
 #~ msgstr "error al obtener el valor: %s\n"
 
@@ -606,9 +617,6 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "error copying in batch mode: %s"
 #~ msgstr "Error copiando en modo batch: %s"
 
-#~ msgid "A user name for PostgreSQL must be supplied.\n"
-#~ msgstr "Un nombre de usuario para PostgreSQL debe de ser suministrado.\n"
-
 #~ msgid ""
 #~ "query %s failed:\n"
 #~ "%s\n"
@@ -728,15 +736,6 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Create db File record %s failed. ERR=%s"
 #~ msgstr "Creación del registro File db %s fallido. ERR=%s"
 
-#~ msgid "More than one Filename! %s for file: %s\n"
-#~ msgstr "Mas de un nombre de Archivo! %s para el archivo: %s\n"
-
-#~ msgid "Error fetching row for file=%s: ERR=%s\n"
-#~ msgstr "Error al obtener fila para el archivo=%s: ERR=%s\n"
-
-#~ msgid "Create db Filename record %s failed. ERR=%s\n"
-#~ msgstr "Creación del registro Filename db %s fallido. ERR=%s\n"
-
 #~ msgid "Attempt to put non-attributes into catalog. Stream=%d\n"
 #~ msgstr "Intento de poner non-atributos en el catálogo. Stream=%d\n"
 
@@ -795,27 +794,16 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgstr "Error obteniendo fila: %s\n"
 
 #, fuzzy
-#~ msgid "get_file_record want 1 got rows=%d PathId=%s FilenameId=%s\n"
+#~ msgid "get_file_record want 1 got rows=%d PathId=%s Filename=%s\n"
 #~ msgstr "get_file_record falta 1 obtuvo filas=%d\n"
 
-#~ msgid "File record for PathId=%s FilenameId=%s not found.\n"
+#, fuzzy
+#~ msgid "File record for PathId=%s Filename=%s not found.\n"
 #~ msgstr "Registro File para PathID=%s FilenameID=%s no encontrado.\n"
 
 #~ msgid "File record not found in Catalog.\n"
 #~ msgstr "Registro File no se encuentra en Catalogo.\n"
 
-#~ msgid "More than one Filename!: %s for file: %s\n"
-#~ msgstr "Más de un Filename!: %s en archivo: %s\n"
-
-#~ msgid "Get DB Filename record %s found bad record: %d\n"
-#~ msgstr "Obtener registro BD Filename %s encuentro registro malo: %d\n"
-
-#~ msgid "Filename record: %s not found.\n"
-#~ msgstr "Registro Filename: %s no encontrado.\n"
-
-#~ msgid "Filename record: %s not found in Catalog.\n"
-#~ msgstr "Registro Filename: %s no encontrado en Catalogo.\n"
-
 #~ msgid "Get DB path record %s found bad record: %s\n"
 #~ msgstr "Obtener registro ruta %s de BD encontró malo registro: %s\n"
 
@@ -843,12 +831,25 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Client id select failed: ERR=%s\n"
 #~ msgstr "Fallo al seleccionar ID del Cliente: ERR=%s\n"
 
-#~ msgid "More than one Pool!: %s\n"
+#, fuzzy
+#~ msgid "More than one Pool! Num=%s\n"
 #~ msgstr "Mas de un Poll!: %s\n"
 
 #~ msgid "Pool record not found in Catalog.\n"
 #~ msgstr "Registro del Pool no encontrado en Catalogo.\n"
 
+#, fuzzy
+#~ msgid "Error got %s RestoreObjects but expected only one!\n"
+#~ msgstr "Error al obtener %s FileSets pero se esperaba sólo uno!\n"
+
+#, fuzzy
+#~ msgid "RestoreObject record \"%d\" not found.\n"
+#~ msgstr "Registro FileSet \"%s\" no encontrado.\n"
+
+#, fuzzy
+#~ msgid "RestoreObject record not found in Catalog.\n"
+#~ msgstr "Registro FileSet no encontrado en Catalogo.\n"
+
 #~ msgid "More than one Client!: %s\n"
 #~ msgstr "Mas de un Cliente!: %s\n"
 
@@ -882,18 +883,33 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "More than one Volume!: %s\n"
 #~ msgstr "Mas de un Volumen!: %s\n"
 
-#~ msgid "Media record MediaId=%s not found.\n"
+#, fuzzy
+#~ msgid "Media record with MediaId=%s not found.\n"
 #~ msgstr "Registro Media MediaID=%s no encontrado.\n"
 
-#~ msgid "Media record for Volume \"%s\" not found.\n"
+#, fuzzy
+#~ msgid "Media record for Volume name \"%s\" not found.\n"
 #~ msgstr "Registro Media para Volumen \"%s\" no encontrado.\n"
 
 #~ msgid "Media record for MediaId=%u not found in Catalog.\n"
 #~ msgstr "Registro Media para MediaId=%u no encontrado en el Catalogo.\n"
 
-#~ msgid "Media record for Vol=%s not found in Catalog.\n"
+#, fuzzy
+#~ msgid "Media record for Volume Name \"%s\" not found in Catalog.\n"
 #~ msgstr "Registro Media para Volumen=%s no encontrado en el Catalogo.\n"
 
+#, fuzzy
+#~ msgid "More than one Snapshot!: %s\n"
+#~ msgstr "Mas de un Cliente!: %s\n"
+
+#, fuzzy
+#~ msgid "Snapshot record with SnapshotId=%s not found.\n"
+#~ msgstr "Registro Media MediaID=%s no encontrado.\n"
+
+#, fuzzy
+#~ msgid "Snapshot record for Snapshot name \"%s\" not found.\n"
+#~ msgstr "Registro Media para Volumen \"%s\" no encontrado.\n"
+
 #~ msgid "Query failed: %s\n"
 #~ msgstr "Consulta fallida: %s\n"
 
@@ -931,7 +947,7 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ "Most likely the passwords do not agree.\n"
 #~ "If you are using TLS, there may have been a certificate validation error "
 #~ "during the TLS handshake.\n"
-#~ "Please see "
+#~ "For help, please see "
 #~ msgstr ""
 #~ "Problema de Autorización de Director.\n"
 #~ "El más probable es que las contraseñas no están de acuerdo.\n"
@@ -940,13 +956,18 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ "Por favor, consulte http://www.bacula.org/en/rel-manual/"
 #~ "Bacula_Freque_Asked_Questi.html#SECTION003760000000000000000 para ayuda.\n"
 
+#, fuzzy
 #~ msgid ""
 #~ "\n"
-#~ "Version: "
+#~ "%sVersion: "
 #~ msgstr ""
 #~ "\n"
 #~ "Versión: "
 
+#, fuzzy
+#~ msgid "Please use valid -l argument: %s\n"
+#~ msgstr "FileSet: nombre=%s\n"
+
 #~ msgid "input from file"
 #~ msgstr "entrada desde archivo"
 
@@ -971,12 +992,20 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "echo command string"
 #~ msgstr "cadena de comando echo"
 
+#, fuzzy
+#~ msgid "encode command string"
+#~ msgstr "cadena de comando echo"
+
 #~ msgid "execute an external command"
 #~ msgstr "ejecutar un comando externo"
 
 #~ msgid "exit = quit"
 #~ msgstr "exit = salir"
 
+#, fuzzy
+#~ msgid "send a file to the director"
+#~ msgstr "Reconectar al director"
+
 #~ msgid "zed_keys = use zed keys instead of bash keys"
 #~ msgstr "zed_keys = usar las teclas zed en lugar de teclas bash"
 
@@ -1042,8 +1071,9 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Cannot popen(\"%s\", \"r\"): ERR=%s\n"
 #~ msgstr "No puede popen(\"%s\", \"r\"): ERR=%s\n"
 
-#~ msgid "Autochanger error: ERR=%s\n"
-#~ msgstr "Auto-cambiador error: ERR=%s\n"
+#, fuzzy
+#~ msgid "@exec error: ERR=%s\n"
+#~ msgstr "Seek error: ERR=%s\n"
 
 #~ msgid "Console: name=%s rcfile=%s histfile=%s\n"
 #~ msgstr "Console: nombre=%s rcfile=%s histfile=%s\n"
@@ -1077,7 +1107,7 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ "Passwords or names not the same or\n"
 #~ "Maximum Concurrent Jobs exceeded on the SD or\n"
 #~ "SD networking messed up (restart daemon).\n"
-#~ "Please see "
+#~ "For help, please see: "
 #~ msgstr ""
 #~ "Director no se puede autenticar con el demonio Storage en \"%s:%d\". "
 #~ "Posibles causas:\n"
@@ -1108,7 +1138,7 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ "Passwords or names not the same or\n"
 #~ "Maximum Concurrent Jobs exceeded on the FD or\n"
 #~ "FD networking messed up (restart daemon).\n"
-#~ "Please see "
+#~ "For help, please see: "
 #~ msgstr ""
 #~ "No se puede autenticar con el demonio File en \"%s:%d\". Posibles "
 #~ "causas:\n"
@@ -1162,7 +1192,7 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgstr "No se puede autenticar la consola \"%s\" en %s:%s:%d.\n"
 
 #, fuzzy
-#~ msgid "1000 OK: %d %s Version: %s (%s)\n"
+#~ msgid "1000 OK: %d %s %sVersion: %s (%s)\n"
 #~ msgstr "1000 OK: %s Versión: %s(%s)\n"
 
 #~ msgid ""
@@ -1189,6 +1219,10 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Sending Accurate information to the FD.\n"
 #~ msgstr "Enviando información precisa.\n"
 
+#, fuzzy
+#~ msgid "Restart Incomplete Backup JobId %s, Job=%s\n"
+#~ msgstr "Iniciar Respaldo JobId %s, Job=%s\n"
+
 #~ msgid "Start Backup JobId %s, Job=%s\n"
 #~ msgstr "Iniciar Respaldo JobId %s, Job=%s\n"
 
@@ -1242,7 +1276,8 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ "  SD Bytes Written:       %s (%sB)\n"
 #~ "  Rate:                   %.1f KB/s\n"
 #~ "  Software Compression:   %s\n"
-#~ "%s  VSS:                    %s\n"
+#~ "  Comm Line Compression:  %s\n"
+#~ "%s  Snapshot/VSS:           %s\n"
 #~ "  Encryption:             %s\n"
 #~ "  Accurate:               %s\n"
 #~ "  Volume name(s):         %s\n"
@@ -1310,6 +1345,118 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ "No se pudo abrir el archivo WriteBootstrap:\n"
 #~ "%s: ERR=%s\n"
 
+#, fuzzy
+#~ msgid ""
+#~ "\n"
+#~ "%sVersion: %s (%s)\n"
+#~ "\n"
+#~ "Usage: bdirjson [-f -s] [-c config_file] [-d debug_level] [config_file]\n"
+#~ "       -r <res>    get resource type <res>\n"
+#~ "       -n <name>   get resource <name>\n"
+#~ "       -l <dirs>   get only directives matching dirs (use with -r)\n"
+#~ "       -D          get only data\n"
+#~ "       -R          do not apply JobDefs to Job\n"
+#~ "       -c <file>   set configuration file to file\n"
+#~ "       -d <nn>     set debug level to <nn>\n"
+#~ "       -dt         print timestamp in debug output\n"
+#~ "       -t          test - read configuration and exit\n"
+#~ "       -s          output in show text format\n"
+#~ "       -v          verbose user messages\n"
+#~ "       -?          print this message.\n"
+#~ "\n"
+#~ msgstr ""
+#~ "\n"
+#~ "Versión: %s (%s)\n"
+#~ "\n"
+#~ "Utilice: dird [-f -s] [-c archivo_configuración] [-d nivel_depuración] "
+#~ "[archivo_configuración]\n"
+#~ " -c <archivo> establecer archivo de configuración para archivo \n"
+#~ " -d <nn> establecer el nivel de depuración para <nn>\n"
+#~ " -dt imprimir timestamp en salida de depuración\n"
+#~ " -f ejecutar en primer plano (para depuración)\n"
+#~ " -g groupid\n"
+#~ " -m imprimir salida kaboom para depuración)\n"
+#~ " -r <job> ejecutar <job> ahora\n"
+#~ " -s sin señales\n"
+#~ " -t prueba - leer la configuración y salir\n"
+#~ " -u userid\n"
+#~ " -v mensajes de usuario detallados\n"
+#~ " -? imprimir este mensaje.\n"
+#~ "\n"
+
+#~ msgid ""
+#~ "No Director resource defined in %s\n"
+#~ "Without that I don't know who I am :-(\n"
+#~ msgstr ""
+#~ "Recurso Director no definido en %s\n"
+#~ "Sin eso no sé quién soy :-(\n"
+
+#~ msgid "No Messages resource defined in %s\n"
+#~ msgstr "Recursos de Mensajes no definidos en %s\n"
+
+#~ msgid "Only one Director resource permitted in %s\n"
+#~ msgstr "Sólo un recurso Director permitido en %s\n"
+
+#~ msgid "\"TLS Certificate\" file not defined for Director \"%s\" in %s.\n"
+#~ msgstr ""
+#~ "\"Certificado TLS\" archivo no definido para director \"%s\" en %s.\n"
+
+#~ msgid "\"TLS Key\" file not defined for Director \"%s\" in %s.\n"
+#~ msgstr "\"Clave TLS\" archivo no definido para director \"%s\" en %s.\n"
+
+#~ msgid ""
+#~ "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined "
+#~ "for Director \"%s\" in %s. At least one CA certificate store is required "
+#~ "when using \"TLS Verify Peer\".\n"
+#~ msgstr ""
+#~ "Ninguno \"TLS CA Certificate\" o \"TLS CA Certificate Dir\" esta definido "
+#~ "para Director \"%s\" en %s. Al menos un almacén de certificado CA es "
+#~ "requerido cuando se utiliza \"TLS Verify Peer\".\n"
+
+#~ msgid "\"TLS Certificate\" file not defined for Console \"%s\" in %s.\n"
+#~ msgstr ""
+#~ "Archivo de \"Certificado TLS\" no definido para Console \"%s\" en %s.\n"
+
+#~ msgid "\"TLS Key\" file not defined for Console \"%s\" in %s.\n"
+#~ msgstr "Archivo de \"Llave TLS\" no definido para Console \"%s\" en %s.\n"
+
+#~ msgid ""
+#~ "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined "
+#~ "for Console \"%s\" in %s. At least one CA certificate store is required "
+#~ "when using \"TLS Verify Peer\".\n"
+#~ msgstr ""
+#~ "Ninguno \"TLS CA Certificate\" o \"TLS CA Certificate Dir\" esta definido "
+#~ "para Console \"%s\" en %s. Al menos un almacén de certificado CA es "
+#~ "requerido cuando se utiliza \"TLS Verify Peer\".\n"
+
+#~ msgid "Failed to initialize TLS context for File daemon \"%s\" in %s.\n"
+#~ msgstr "Fallo al inicializar contexto TLS para demonio File \"%s\" en %s.\n"
+
+#~ msgid ""
+#~ "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined "
+#~ "for File daemon \"%s\" in %s.\n"
+#~ msgstr ""
+#~ "Ninguno \"TLS CA Certificate\" o \"TLS CA Certificate Dir\" esta definido "
+#~ "para demonio File \"%s\" en %s.\n"
+
+#~ msgid "No Job records defined in %s\n"
+#~ msgstr "Registros de Job no definidos en %s\n"
+
+#~ msgid "Hey something is wrong. p=0x%lu\n"
+#~ msgstr "Oye, algo está mal. p=0x%lu\n"
+
+#~ msgid ""
+#~ "\"%s\" directive in Job \"%s\" resource is required, but not found.\n"
+#~ msgstr ""
+#~ "Directiva \"%s\" en recurso Job \"%s\" es requerida, pero no se "
+#~ "encuentra.\n"
+
+#~ msgid "Too many items in Job resource\n"
+#~ msgstr "Demasiados elementos en el recurso Job\n"
+
+#~ msgid "No storage specified in Job \"%s\" nor in Pool.\n"
+#~ msgstr "Ningún storage especificada en Job \"%s\" ni en Pool.\n"
+
 #~ msgid "Unable to get Job record. ERR=%s\n"
 #~ msgstr "No se pudo obtener registro de Job. ERR=%s\n"
 
@@ -1326,9 +1473,6 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Error writing bsr file.\n"
 #~ msgstr "Error escribiendo archivo bsr.\n"
 
-#~ msgid "Bootstrap records written to %s\n"
-#~ msgstr "Registros Bootstrap escritos para %s\n"
-
 #, fuzzy
 #~ msgid ""
 #~ "The Job will require the following (*=>InChanger):\n"
@@ -1460,22 +1604,23 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #, fuzzy
 #~ msgid ""
 #~ "\n"
-#~ "Version: %s (%s)\n"
+#~ "%sVersion: %s (%s)\n"
 #~ "\n"
 #~ "Usage: bacula-dir [-f -s] [-c config_file] [-d debug_level] "
 #~ "[config_file]\n"
-#~ "       -c <file>   set configuration file to file\n"
-#~ "       -d <nn>     set debug level to <nn>\n"
-#~ "       -dt         print timestamp in debug output\n"
-#~ "       -f          run in foreground (for debugging)\n"
-#~ "       -g          groupid\n"
-#~ "       -m          print kaboom output (for debugging)\n"
-#~ "       -r <job>    run <job> now\n"
-#~ "       -s          no signals\n"
-#~ "       -t          test - read configuration and exit\n"
-#~ "       -u          userid\n"
-#~ "       -v          verbose user messages\n"
-#~ "       -?          print this message.\n"
+#~ "     -c <file>        set configuration file to file\n"
+#~ "     -d <nn>[,<tags>] set debug level to <nn>, debug tags to <tags>\n"
+#~ "     -dt              print timestamp in debug output\n"
+#~ "     -T               set trace on\n"
+#~ "     -f               run in foreground (for debugging)\n"
+#~ "     -g               groupid\n"
+#~ "     -m               print kaboom output (for debugging)\n"
+#~ "     -r <job>         run <job> now\n"
+#~ "     -s               no signals\n"
+#~ "     -t               test - read configuration and exit\n"
+#~ "     -u               userid\n"
+#~ "     -v               verbose user messages\n"
+#~ "     -?               print this message.\n"
 #~ "\n"
 #~ msgstr ""
 #~ "\n"
@@ -1497,6 +1642,10 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ " -? imprimir este mensaje.\n"
 #~ "\n"
 
+#, fuzzy
+#~ msgid "Already doing a reload request, request ignored.\n"
+#~ msgstr "Demasiadas solicitudes de recarga abiertas. Solicitud ignorada.\n"
+
 #~ msgid "Too many open reload requests. Request ignored.\n"
 #~ msgstr "Demasiadas solicitudes de recarga abiertas. Solicitud ignorada.\n"
 
@@ -1506,106 +1655,33 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Resetting previous configuration.\n"
 #~ msgstr "Restablecimiento de la configuración anterior.\n"
 
-#~ msgid ""
-#~ "No Director resource defined in %s\n"
-#~ "Without that I don't know who I am :-(\n"
-#~ msgstr ""
-#~ "Recurso Director no definido en %s\n"
-#~ "Sin eso no sé quién soy :-(\n"
+#~ msgid "Failed to initialize TLS context for Director \"%s\" in %s.\n"
+#~ msgstr "Fallo al inicializar contexto TLS para Director \"%s\" en %s.\n"
 
-#~ msgid "No Messages resource defined in %s\n"
-#~ msgstr "Recursos de Mensajes no definidos en %s\n"
+#~ msgid "Could not open Catalog \"%s\", database \"%s\".\n"
+#~ msgstr "No se pudo abrir Catálogo \"%s\", base de datos \"%s\".\n"
 
-#~ msgid "Only one Director resource permitted in %s\n"
-#~ msgstr "Sólo un recurso Director permitido en %s\n"
+#~ msgid "%s"
+#~ msgstr "%s"
 
-#~ msgid "\"TLS Certificate\" file not defined for Director \"%s\" in %s.\n"
-#~ msgstr ""
-#~ "\"Certificado TLS\" archivo no definido para director \"%s\" en %s.\n"
+#, fuzzy
+#~ msgid "Could not create storage record for %s\n"
+#~ msgstr "No es posible crear el registro Pool. ERR=%s\n"
 
-#~ msgid "\"TLS Key\" file not defined for Director \"%s\" in %s.\n"
-#~ msgstr "\"Clave TLS\" archivo no definido para director \"%s\" en %s.\n"
+#, fuzzy
+#~ msgid "Could not update storage record for %s\n"
+#~ msgstr "No se pudo actualizar el registro de trabajo. ERR=%s\n"
 
 #~ msgid ""
 #~ "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined "
-#~ "for Director \"%s\" in %s. At least one CA certificate store is required "
-#~ "when using \"TLS Verify Peer\".\n"
+#~ "for Storage \"%s\" in %s.\n"
 #~ msgstr ""
 #~ "Ninguno \"TLS CA Certificate\" o \"TLS CA Certificate Dir\" esta definido "
-#~ "para Director \"%s\" en %s. Al menos un almacén de certificado CA es "
-#~ "requerido cuando se utiliza \"TLS Verify Peer\".\n"
-
-#~ msgid "Failed to initialize TLS context for Director \"%s\" in %s.\n"
-#~ msgstr "Fallo al inicializar contexto TLS para Director \"%s\" en %s.\n"
-
-#~ msgid "No Job records defined in %s\n"
-#~ msgstr "Registros de Job no definidos en %s\n"
-
-#~ msgid "Hey something is wrong. p=0x%lu\n"
-#~ msgstr "Oye, algo está mal. p=0x%lu\n"
-
-#~ msgid ""
-#~ "\"%s\" directive in Job \"%s\" resource is required, but not found.\n"
-#~ msgstr ""
-#~ "Directiva \"%s\" en recurso Job \"%s\" es requerida, pero no se "
-#~ "encuentra.\n"
-
-#~ msgid "Too many items in Job resource\n"
-#~ msgstr "Demasiados elementos en el recurso Job\n"
-
-#~ msgid "No storage specified in Job \"%s\" nor in Pool.\n"
-#~ msgstr "Ningún storage especificada en Job \"%s\" ni en Pool.\n"
-
-#~ msgid "\"TLS Certificate\" file not defined for Console \"%s\" in %s.\n"
-#~ msgstr ""
-#~ "Archivo de \"Certificado TLS\" no definido para Console \"%s\" en %s.\n"
-
-#~ msgid "\"TLS Key\" file not defined for Console \"%s\" in %s.\n"
-#~ msgstr "Archivo de \"Llave TLS\" no definido para Console \"%s\" en %s.\n"
-
-#~ msgid ""
-#~ "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined "
-#~ "for Console \"%s\" in %s. At least one CA certificate store is required "
-#~ "when using \"TLS Verify Peer\".\n"
-#~ msgstr ""
-#~ "Ninguno \"TLS CA Certificate\" o \"TLS CA Certificate Dir\" esta definido "
-#~ "para Console \"%s\" en %s. Al menos un almacén de certificado CA es "
-#~ "requerido cuando se utiliza \"TLS Verify Peer\".\n"
-
-#~ msgid "Failed to initialize TLS context for File daemon \"%s\" in %s.\n"
-#~ msgstr "Fallo al inicializar contexto TLS para demonio File \"%s\" en %s.\n"
-
-#~ msgid ""
-#~ "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined "
-#~ "for File daemon \"%s\" in %s.\n"
-#~ msgstr ""
-#~ "Ninguno \"TLS CA Certificate\" o \"TLS CA Certificate Dir\" esta definido "
-#~ "para demonio File \"%s\" en %s.\n"
-
-#~ msgid ""
-#~ "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined "
-#~ "for Storage \"%s\" in %s.\n"
-#~ msgstr ""
-#~ "Ninguno \"TLS CA Certificate\" o \"TLS CA Certificate Dir\" esta definido "
-#~ "para Storage \"%s\" en %s.\n"
+#~ "para Storage \"%s\" en %s.\n"
 
 #~ msgid "Failed to initialize TLS context for Storage \"%s\" in %s.\n"
 #~ msgstr "Fallo al inicializar contexto TLS para Storage \"%s\" en %s.\n"
 
-#~ msgid "Could not open Catalog \"%s\", database \"%s\".\n"
-#~ msgstr "No se pudo abrir Catálogo \"%s\", base de datos \"%s\".\n"
-
-#~ msgid "%s"
-#~ msgstr "%s"
-
-#, fuzzy
-#~ msgid "Could not create storage record for %s\n"
-#~ msgstr "No es posible crear el registro Pool. ERR=%s\n"
-
-#, fuzzy
-#~ msgid "Could not update storage record for %s\n"
-#~ msgstr "No se pudo actualizar el registro de trabajo. ERR=%s\n"
-
 #~ msgid "Could not compile regex pattern \"%s\" ERR=%s\n"
 #~ msgstr "No se ha podido compilar patrón regex  \"%s\" ERR=%s\n"
 
@@ -1627,7 +1703,8 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Counter: name=%s min=%d max=%d\n"
 #~ msgstr "Counter: nombre=%s mínimo=%d máximo=%d\n"
 
-#~ msgid "Client: name=%s address=%s FDport=%d MaxJobs=%u\n"
+#, fuzzy
+#~ msgid "Client: Name=%s Enabled=%d Address=%s FDport=%d MaxJobs=%u\n"
 #~ msgstr "Cliente: nombre=%s dirección=%s FDport=%d MaxJobs=%u\n"
 
 #~ msgid "      JobRetention=%s FileRetention=%s AutoPrune=%d\n"
@@ -1644,13 +1721,22 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ "autochgr=%d\n"
 #~ " poolid=%s volname=%s MediaType=%s\n"
 
+#, fuzzy
 #~ msgid ""
-#~ "Storage: name=%s address=%s SDport=%d MaxJobs=%u\n"
-#~ "      DeviceName=%s MediaType=%s StorageId=%s\n"
+#~ "%s: name=%s address=%s SDport=%d MaxJobs=%u\n"
+#~ "      DeviceName=%s MediaType=%s StorageId=%s Autochanger=%d\n"
 #~ msgstr ""
 #~ "Storage: nombre=%s dirección=%s SDport=%d MaxJobs=%u\n"
 #~ " DeviceName=%s MediaType=%s StorageId=%s\n"
 
+#, fuzzy
+#~ msgid "   Parent --> "
+#~ msgstr "--> "
+
+#, fuzzy
+#~ msgid "   Shared --> "
+#~ msgstr "--> "
+
 #~ msgid ""
 #~ "Catalog: name=%s address=%s DBport=%d db_name=%s\n"
 #~ "      db_driver=%s db_user=%s MutliDBConn=%d\n"
@@ -1736,6 +1822,14 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "  --> RunWhen=%u\n"
 #~ msgstr "--> EjecutarCuando=%u\n"
 
+#, fuzzy
+#~ msgid "  --> IncrementalBackup"
+#~ msgstr "Incremental"
+
+#, fuzzy
+#~ msgid "  --> DifferentialBackup"
+#~ msgstr "Diferencial"
+
 #~ msgid "  --> Run=%s\n"
 #~ msgstr "--> Ejecutar=%s\n"
 
@@ -1745,7 +1839,8 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "FileSet: name=%s\n"
 #~ msgstr "FileSet: nombre=%s\n"
 
-#~ msgid "Schedule: name=%s\n"
+#, fuzzy
+#~ msgid "Schedule: Name=%s Enabled=%d\n"
 #~ msgstr "Schedule: nombre=%s\n"
 
 #~ msgid "  --> Run Level=%s\n"
@@ -1783,6 +1878,9 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "     --> "
 #~ msgstr "--> "
 
+#~ msgid "Schedule: name=%s\n"
+#~ msgstr "Schedule: nombre=%s\n"
+
 #~ msgid "Pool: name=%s PoolType=%s\n"
 #~ msgstr "Pool: nombre=%s PoolType=%s\n"
 
@@ -1856,15 +1954,21 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Cannot find Schedule resource %s\n"
 #~ msgstr "No se puede encontrar el recurso Schedule %s\n"
 
-#~ msgid "Name item is required in %s resource, but not found.\n"
-#~ msgstr "Nombre del ítem se requiere en recurso %s, pero no se encuentra.\n"
-
-#~ msgid "Inserting %s res: %s index=%d pass=%d\n"
-#~ msgstr "Insertando %s res: %s index=%d pass=%d\n"
-
 #~ msgid "Expected one of: %s, got: %s"
 #~ msgstr "Esperaba uno de: %s, obtuvo: %s"
 
+#, fuzzy
+#~ msgid "Could not find Storage Resource %s referenced on line %d : %s\n"
+#~ msgstr ""
+#~ "No se pudo encontrar Recursos de configuración %s  referenciado en la "
+#~ "línea %d: %s\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "Attempt to redefine Storage resource \"%s\" referenced on line %d : %s\n"
+#~ msgstr ""
+#~ "Intento de redefinir recurso \"%s\" referenciado en la línea %d: %s\n"
+
 #~ msgid "Expected a Migration Job Type keyword, got: %s"
 #~ msgstr "Espera una palabra clave Tipo Job de Migración, obtuvo: %s"
 
@@ -1975,6 +2079,10 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "RestoreObject failed.\n"
 #~ msgstr "Restaurar Archivos"
 
+#, fuzzy
+#~ msgid "ComponentInfo failed.\n"
+#~ msgstr "Comando fallido."
+
 #~ msgid ""
 #~ "<filed: bad attributes, expected 3 fields got %d\n"
 #~ "msglen=%d msg=%s\n"
@@ -2018,15 +2126,9 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Expected a wild-card string, got: %s\n"
 #~ msgstr "Esperada una cadena comodín, obtuvo: %s\n"
 
-#~ msgid "Expected an fstype string, got: %s\n"
-#~ msgstr "Se esperaba una cadena fstype, se obtuvo: %s\n"
-
 #~ msgid "ExcludeDirContaining directive not permitted in Exclude.\n"
 #~ msgstr "Directiva ExcludeDirContaining no permitida en Excluir(Exclude).\n"
 
-#~ msgid "Expected an drivetype string, got: %s\n"
-#~ msgstr "Se esperaba una cadena drivetype, se obtuvo: %s\n"
-
 #~ msgid "Backslash found. Use forward slashes or quote the string.: %s\n"
 #~ msgstr ""
 #~ "Barra invertida encontrada. Utilice barras inclinadas o cite la cadena.: "
@@ -2085,6 +2187,10 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgstr "Error al conectar con demonio Storage.\n"
 
 #, fuzzy
+#~ msgid "Client resource \"%s\" does not exist.\n"
+#~ msgstr "Error: Recurso Cliente %s no existe.\n"
+
+#, fuzzy
 #~ msgid "canceled"
 #~ msgstr "Cancelado"
 
@@ -2102,7 +2208,8 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Max run sched time exceeded. Job canceled.\n"
 #~ msgstr "Máximo tiempo de ejecución excedido. Job cancelado.\n"
 
-#~ msgid "Pool \"%s\" not in database. ERR=%s"
+#, fuzzy
+#~ msgid "Cannot create pool \"%s\" in database. ERR=%s"
 #~ msgstr "Poll \"%s\" no en base de datos. ERR=%s"
 
 #~ msgid "Created database record for Pool \"%s\".\n"
@@ -2119,22 +2226,15 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgstr "Anular Ejecutar Pool"
 
 #, fuzzy
-#~ msgid "Storage from Run NextPool override"
-#~ msgstr "Storage desde recurso Pool's NextPool "
-
-#, fuzzy
 #~ msgid "Job's NextPool resource"
 #~ msgstr "Recurso Job Pool's NextPool "
 
-#, fuzzy
-#~ msgid "Storage from Job's NextPool resource"
-#~ msgstr "Storage desde recurso Pool's NextPool "
-
 #~ msgid "Job Pool's NextPool resource"
 #~ msgstr "Recurso Job Pool's NextPool "
 
-#~ msgid "Storage from Pool's NextPool resource"
-#~ msgstr "Storage desde recurso Pool's NextPool "
+#, fuzzy
+#~ msgid "Pool's NextPool resource"
+#~ msgstr "Recurso Job Pool's NextPool "
 
 #, fuzzy
 #~ msgid "Run Pool override"
@@ -2158,6 +2258,10 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Job DiffPool override"
 #~ msgstr "Anular Job DiffPool"
 
+#, fuzzy
+#~ msgid "No Client specified.\n"
+#~ msgstr "Cliente especificado dos veces.\n"
+
 #~ msgid "Could not create Client record. ERR=%s\n"
 #~ msgstr "No es posible crear el registro de clientes. ERR=%s\n"
 
@@ -2733,6 +2837,108 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Run queue"
 #~ msgstr "Ejecutar cola"
 
+#~ msgid "Comm error with SD. bad response to %s. ERR=%s\n"
+#~ msgstr "Error de comunicación con SD. Mala respuesta a %s. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Bad response from SD to %s command. Wanted %s, got %s len=%ld\n"
+#~ msgstr "Mala respuesta al comando %s. Esperaba %s, obtuvo %s\n"
+
+#, fuzzy
+#~ msgid "Snapshot not found\n"
+#~ msgstr "Firmante no encontrado"
+
+#, fuzzy
+#~ msgid "Client resource not found\n"
+#~ msgstr "Ningún recurso Cliente encontrado!\n"
+
+#~ msgid "Connecting to Client %s at %s:%d\n"
+#~ msgstr "Conectando al Cliente %s en %s:%d\n"
+
+#~ msgid "Failed to connect to Client.\n"
+#~ msgstr "Fallo al conectar con el cliente.\n"
+
+#, fuzzy
+#~ msgid "Snapshot \"%s\" deleted from client %s\n"
+#~ msgstr "Antiguo volumen \"%s\" borrado del catalogo.\n"
+
+#, fuzzy
+#~ msgid "Snapshot \"%s\" deleted from catalog\n"
+#~ msgstr "Antiguo volumen \"%s\" borrado del catalogo.\n"
+
+#, fuzzy
+#~ msgid "Snapshot \"%s\" on Client %s\n"
+#~ msgstr "Mas de un Cliente!: %s\n"
+
+#, fuzzy
+#~ msgid "No snapshot found\n"
+#~ msgstr "Job %s no encontrado\n"
+
+#, fuzzy
+#~ msgid "Snapshot choice: \n"
+#~ msgstr "Actualizar selección:\n"
+
+#, fuzzy
+#~ msgid "List snapshots in Catalog"
+#~ msgstr "Listar objetos del catálogo"
+
+#, fuzzy
+#~ msgid "List snapshots on Client"
+#~ msgstr "esta esperando por Client"
+
+#~ msgid "Done"
+#~ msgstr "Hecho"
+
+#~ msgid "Selection terminated.\n"
+#~ msgstr "Selección terminada.\n"
+
+#, fuzzy
+#~ msgid "Enter a SnapshotId: "
+#~ msgstr "Introduzca nueva Ranura:"
+
+#, fuzzy
+#~ msgid "Unable to get Snapshot record.\n"
+#~ msgstr "No se pudo obtener registro de Job. ERR=%s\n"
+
+#~ msgid "Invalid retention period specified: %s\n"
+#~ msgstr "Periodo de retención especificado no valido: %s\n"
+
+#~ msgid "New retention period is: %s\n"
+#~ msgstr "Nuevo periodo de retención es: %s\n"
+
+#, fuzzy
+#~ msgid "New Comment is: %s\n"
+#~ msgstr "Nuevo Pool es: %s\n"
+
+#~ msgid "Parameters to modify:\n"
+#~ msgstr "Parámetros para modificar:\n"
+
+#, fuzzy
+#~ msgid "Snapshot Retention Period"
+#~ msgstr "Periodo de Retención del Volumen"
+
+#~ msgid "Select parameter to modify"
+#~ msgstr "Seleccione los parámetros para modificar"
+
+#, fuzzy
+#~ msgid "Updating Snapshot \"%s\" on \"%s\"\n"
+#~ msgstr "Actualizando Volumen \"%s\"\n"
+
+#~ msgid "Current retention period is: %s\n"
+#~ msgstr "Actual periodo de retención es: %s\n"
+
+#, fuzzy
+#~ msgid "Enter Snapshot Retention period: "
+#~ msgstr "Introduzca el nuevo periodo de retención:"
+
+#, fuzzy
+#~ msgid "Current comment is: %s\n"
+#~ msgstr "Pool actual es: %s\n"
+
+#, fuzzy
+#~ msgid "Enter Snapshot comment: "
+#~ msgstr "Introduzca lista de comandos SQL:"
+
 #~ msgid "Add media to a pool"
 #~ msgstr "Añadir medios a un pool"
 
@@ -2805,6 +3011,14 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Run a job"
 #~ msgstr "Ejecutar un Job"
 
+#, fuzzy
+#~ msgid "Restart a job"
+#~ msgstr "Ejecutando Job de restauración"
+
+#, fuzzy
+#~ msgid "Resume a job"
+#~ msgstr "Ejecutar un Job"
+
 #~ msgid "Report status"
 #~ msgstr "Informe de estado"
 
@@ -2941,12 +3155,6 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Pool %s created.\n"
 #~ msgstr "Pool %s creado.\n"
 
-#~ msgid "Connecting to Client %s at %s:%d\n"
-#~ msgstr "Conectando al Cliente %s en %s:%d\n"
-
-#~ msgid "Failed to connect to Client.\n"
-#~ msgstr "Fallo al conectar con el cliente.\n"
-
 #, fuzzy
 #~ msgid "Failed to set bandwidth limit to Client.\n"
 #~ msgstr "Fallo al conectar con el cliente.\n"
@@ -2970,12 +3178,17 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Client \"%s\" address set to %s\n"
 #~ msgstr "Cliente \"%s\" dirección configurada para %s\n"
 
-#~ msgid "Job \"%s\" not found.\n"
-#~ msgstr "Job \"%s\" no encontrado.\n"
-
 #~ msgid "Job \"%s\" %sabled\n"
 #~ msgstr "Job \"%s\" %sabled\n"
 
+#, fuzzy
+#~ msgid "Client \"%s\" %sabled\n"
+#~ msgstr "Job \"%s\" %sabled\n"
+
+#, fuzzy
+#~ msgid "Schedule \"%s\" %sabled\n"
+#~ msgstr "Job \"%s\" %sabled\n"
+
 #~ msgid "Connecting to Storage daemon %s at %s:%d\n"
 #~ msgstr "Conectando al demonio Storage %s en %s:%d\n"
 
@@ -2985,6 +3198,10 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Enter new debug level: "
 #~ msgstr "Introduzca el nuevo nivel de depuración:"
 
+#, fuzzy
+#~ msgid "Incorrect tags found on command line %s\n"
+#~ msgstr "No se puede usar comando %s en un runscript"
+
 #~ msgid "Available daemons are: \n"
 #~ msgstr "Demonios disponible son: \n"
 
@@ -3010,6 +3227,9 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Client name missing.\n"
 #~ msgstr "Falta el nombre del cliente.\n"
 
+#~ msgid "Job \"%s\" not found.\n"
+#~ msgstr "Job \"%s\" no encontrado.\n"
+
 #~ msgid "No authorization for Job \"%s\"\n"
 #~ msgstr "No autorización para Job \"%s\"\n"
 
@@ -3089,6 +3309,10 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Are you sure you want to delete Pool \"%s\"? (yes/no): "
 #~ msgstr "¿Esta usted seguro de que desea eliminar el Pool \"%s\"? (si/no):"
 
+#, fuzzy
+#~ msgid "Invalid device name. %s"
+#~ msgstr "Opción replace no valida: %s\n"
+
 #~ msgid "Using Catalog name=%s DB=%s\n"
 #~ msgstr "Utilizando Catalogo nombre=%s BD=%s\n"
 
@@ -3155,24 +3379,47 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Using Catalog \"%s\"\n"
 #~ msgstr "Usando Catalogo \"%s\"\n"
 
-#~ msgid ": is an invalid command.\n"
-#~ msgstr ": es un comando inválido.\n"
+#~ msgid "List Media failed: ERR=%s\n"
+#~ msgstr "Fallo al listar Media: ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Unable to get Job record for Job=%s\n"
-#~ msgstr "No se puede obtener el registro Job para JobId=%s: ERR=%s\n"
+#~ msgid "Command line"
+#~ msgstr "línea de comandos"
 
 #, fuzzy
-#~ msgid "Unable to get last Job record for Job=%s\n"
-#~ msgstr "No se puede obtener el registro Job para JobId=%s: ERR=%s\n"
+#~ msgid "Invalid keyword found: %s\n"
+#~ msgstr "Palabra clave inválida: %s\n"
 
 #, fuzzy
-#~ msgid "Unable to get Client record for Client=%s\n"
-#~ msgstr "Creado registro Cliente para Cliente: %s\n"
+#~ msgid "Display data files usage"
+#~ msgstr "Mostrar mensajes pendientes"
 
-#, fuzzy
-#~ msgid "Unable to get last Job record for Client=%s\n"
-#~ msgstr "No se pudo obtener registro de Job. ERR=%s\n"
+#~ msgid ": is an invalid command.\n"
+#~ msgstr ": es un comando inválido.\n"
+
+#, fuzzy
+#~ msgid "path name missing.\n"
+#~ msgstr "Falta el nombre del Job.\n"
+
+#, fuzzy
+#~ msgid "Failed to send command to Client.\n"
+#~ msgstr "Fallo al conectar con el cliente.\n"
+
+#, fuzzy
+#~ msgid "Unable to get Job record for Job=%s\n"
+#~ msgstr "No se puede obtener el registro Job para JobId=%s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to get last Job record for Job=%s\n"
+#~ msgstr "No se puede obtener el registro Job para JobId=%s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to get Client record for Client=%s\n"
+#~ msgstr "Creado registro Cliente para Cliente: %s\n"
+
+#, fuzzy
+#~ msgid "Unable to get last Job record for Client=%s\n"
+#~ msgstr "No se puede obtener el registro Job para JobId=%s: ERR=%s\n"
 
 #~ msgid "Unable to get Job record for JobId=%s: ERR=%s\n"
 #~ msgstr "No se puede obtener el registro Job para JobId=%s: ERR=%s\n"
@@ -3203,9 +3450,6 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "List MediaType failed: ERR=%s\n"
 #~ msgstr "Fallo al listar MediaType: ERR=%s\n"
 
-#~ msgid "List Media failed: ERR=%s\n"
-#~ msgstr "Fallo al listar Media: ERR=%s\n"
-
 #~ msgid "List Location failed: ERR=%s\n"
 #~ msgstr "Fallo al listar Ubicación: ERR=%s\n"
 
@@ -3361,7 +3605,8 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Invalid Slot number: %s\n"
 #~ msgstr "Número de Ranura no válido:%s\n"
 
-#~ msgid "Invalid Volume name: %s\n"
+#, fuzzy
+#~ msgid "Invalid Volume name: %s. Volume skipped.\n"
 #~ msgstr "Nombre de Volumen no válido:%s\n"
 
 #~ msgid "Device \"%s\" has %d slots.\n"
@@ -3394,9 +3639,6 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "No disabled Jobs.\n"
 #~ msgstr "Ningún Jobs Deshabilitado.\n"
 
-#~ msgid "disabled"
-#~ msgstr "deshabilitado"
-
 #~ msgid "Keywords for the show command are:\n"
 #~ msgstr "Palabras clave para el comando show son:\n"
 
@@ -3409,6 +3651,14 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Hey! DB is NULL\n"
 #~ msgstr "Hey! BD esta VACÍA\n"
 
+#, fuzzy
+#~ msgid "Invalid jobid argument\n"
+#~ msgstr "argumento invalido"
+
+#, fuzzy
+#~ msgid "Unknown ObjectType %s\n"
+#~ msgstr "Tipo de base de datos desconocido: %s\n"
+
 #~ msgid "Jobid %d used %d Volume(s): %s\n"
 #~ msgstr "Jobid %d usado %d Volumen(s): %s\n"
 
@@ -3562,7 +3812,7 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgstr "No se puede truncar el dispositivo %s. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "No Volumes found to perform %s action.\n"
+#~ msgid "No Volumes found to perform \"truncate\" command.\n"
 #~ msgstr "No encontraron volúmenes para etiquetar, o sin códigos de barras.\n"
 
 #~ msgid "Unable move recycled Volume in full Pool \"%s\" MaxVols=%d\n"
@@ -3634,6 +3884,9 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "No files selected to be restored.\n"
 #~ msgstr "No hay archivos seleccionados para ser restaurado.\n"
 
+#~ msgid "Bootstrap records written to %s\n"
+#~ msgstr "Registros Bootstrap escritos para %s\n"
+
 #~ msgid ""
 #~ "\n"
 #~ "1 file selected to be restored.\n"
@@ -3861,6 +4114,18 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Regex compile error: %s\n"
 #~ msgstr "Error de compilación Regex: %s\n"
 
+#, fuzzy
+#~ msgid "Unable to create component file %s. ERR=%s\n"
+#~ msgstr "No se puede crear el archivo bootstrap %s. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to fdopen component file %s. ERR=%s\n"
+#~ msgstr "No se puede abrir el archivo \"%s\": ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Error writing component file.\n"
+#~ msgstr "Error escribiendo archivo bsr.\n"
+
 #~ msgid ""
 #~ "\n"
 #~ "Building directory tree for JobId(s) %s ...  "
@@ -4026,7 +4291,7 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 
 #, fuzzy
 #~ msgid "Could not get job record for selected JobId=%d. ERR=%s"
-#~ msgstr "No se ha podido obtener el registro Job para Job anterior. ERR=%s"
+#~ msgstr "No se pudo obtener el registro Job para JobId %s para %s. ERR=%s"
 
 #~ msgid "You have the following choices:\n"
 #~ msgstr "Usted tiene las siguientes opciones:\n"
@@ -4035,11 +4300,36 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Select termination code: "
 #~ msgstr "Código de Terminación del Job: %d"
 
+#, fuzzy
+#~ msgid "Unable to use current plugin configuration, discarding it."
+#~ msgstr "No es posible leer el archivo de configuración"
+
+#, fuzzy
+#~ msgid "Plugin Restore Options\n"
+#~ msgstr "Opciones de Plug-in"
+
+#, fuzzy
+#~ msgid "Use above plugin configuration? (yes/mod/no): "
+#~ msgstr "¿Continuar? (sí/mod/no):"
+
 #~ msgid "mod"
 #~ msgstr "mod"
 
-#~ msgid "Parameters to modify:\n"
-#~ msgstr "Parámetros para modificar:\n"
+#, fuzzy
+#~ msgid "Please enter a value for %s: "
+#~ msgstr "Por favor, introduzca un JobId para restaurar:"
+
+#, fuzzy
+#~ msgid "Plugins to configure:\n"
+#~ msgstr "Plugin=%s no encontrado.\n"
+
+#, fuzzy
+#~ msgid "Select plugin to configure"
+#~ msgstr "TLS permitido, pero no configurado.\n"
+
+#, fuzzy
+#~ msgid "Can't configure %32s\n"
+#~ msgstr "No se puede continuar.\n"
 
 #~ msgid "Level"
 #~ msgstr "Level"
@@ -4081,9 +4371,6 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Plugin Options"
 #~ msgstr "Opciones de Plug-in"
 
-#~ msgid "Select parameter to modify"
-#~ msgstr "Seleccione los parámetros para modificar"
-
 #~ msgid ""
 #~ "Please enter desired start time as YYYY-MM-DD HH:MM:SS (return for now): "
 #~ msgstr ""
@@ -4106,10 +4393,6 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgstr "Advertencia no puede abrir %s: ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Command input"
-#~ msgstr "línea de comandos"
-
-#, fuzzy
 #~ msgid "Please enter the full path prefix for restore (/ for none): "
 #~ msgstr ""
 #~ "Por favor, introduzca el prefijo de ruta para restaurar (/ para ninguno):"
@@ -4126,16 +4409,19 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ "Usted debe configurar el archivo bootstrap a NULL para poder especificar "
 #~ "un jobId.\n"
 
+#~ msgid "Please Plugin Options string: "
+#~ msgstr "Por favor, cadena de Opciones de Plugin:"
+
+#, fuzzy
+#~ msgid "Command input"
+#~ msgstr "línea de comandos"
+
 #~ msgid "User input"
 #~ msgstr "Entrada del usuario"
 
 #~ msgid "Invalid replace option: %s\n"
 #~ msgstr "Opción replace no valida: %s\n"
 
-#, fuzzy
-#~ msgid "Storage from NextPool override"
-#~ msgstr "Storage desde recurso Pool's NextPool "
-
 #~ msgid "strip_prefix=%s add_prefix=%s add_suffix=%s\n"
 #~ msgstr "strip_prefix=%s add_prefix=%s add_suffix=%s\n"
 
@@ -4262,6 +4548,7 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ "%sStorage:  %s (From %s)\n"
 #~ "When:     %s\n"
 #~ "Priority: %d\n"
+#~ "%s%s%s"
 #~ msgstr ""
 #~ "Ejecutar %s job\n"
 #~ "Nombre del Job: %s\n"
@@ -4308,6 +4595,9 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgstr "Por favor, introduzca un JobId para restaurar:"
 
 #, fuzzy
+#~ msgid "User specified"
+#~ msgstr "tiempo de espera especificado"
+
 #~ msgid ""
 #~ "Run Restore job\n"
 #~ "JobName:         %s\n"
@@ -4321,6 +4611,7 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ "When:            %s\n"
 #~ "Catalog:         %s\n"
 #~ "Priority:        %d\n"
+#~ "Plugin Options:  %s\n"
 #~ msgstr ""
 #~ "Ejecutar Job de Restauración\n"
 #~ "Nombre del Job: %s\n"
@@ -4336,7 +4627,6 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ "Prioridad: %d\n"
 #~ "Opciones de Plugin: %s\n"
 
-#, fuzzy
 #~ msgid ""
 #~ "Run Restore job\n"
 #~ "JobName:         %s\n"
@@ -4350,6 +4640,7 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ "When:            %s\n"
 #~ "Catalog:         %s\n"
 #~ "Priority:        %d\n"
+#~ "Plugin Options:  %s\n"
 #~ msgstr ""
 #~ "Ejecutar Job de Restauración\n"
 #~ "Nombre del Job: %s\n"
@@ -4380,7 +4671,6 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Where:      %s\n"
 #~ msgstr "Donde: %s\n"
 
-#, fuzzy
 #~ msgid ""
 #~ "Replace:         %s\n"
 #~ "Client:          %s\n"
@@ -4389,6 +4679,7 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ "When:            %s\n"
 #~ "Catalog:         %s\n"
 #~ "Priority:        %d\n"
+#~ "Plugin Options:  %s\n"
 #~ msgstr ""
 #~ "Remplazar: %s\n"
 #~ "Cliente: %s\n"
@@ -4526,6 +4817,10 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "The current %s retention period is: %s\n"
 #~ msgstr "El período actual %s de retención es: %s\n"
 
+#, fuzzy
+#~ msgid "Continue? (yes/no): "
+#~ msgstr "¿Continuar? (sí/mod/no):"
+
 #~ msgid "Continue? (yes/mod/no): "
 #~ msgstr "¿Continuar? (sí/mod/no):"
 
@@ -4556,12 +4851,20 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Select Catalog resource"
 #~ msgstr "Seleccione recurso Catalogo"
 
-#~ msgid "The defined Job resources are:\n"
+#, fuzzy
+#~ msgid "The disabled Job resources are:\n"
+#~ msgstr "Los recursos Job definidos son:\n"
+
+#, fuzzy
+#~ msgid "The enabled Job resources are:\n"
 #~ msgstr "Los recursos Job definidos son:\n"
 
 #~ msgid "Select Job resource"
 #~ msgstr "Seleccione recurso Job"
 
+#~ msgid "The defined Job resources are:\n"
+#~ msgstr "Los recursos Job definidos son:\n"
+
 #, fuzzy
 #~ msgid "Error: Restore Job resource \"%s\" does not exist.\n"
 #~ msgstr "Error: recurso Pool \"%s\" no existe.\n"
@@ -4575,12 +4878,30 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "The defined Client resources are:\n"
 #~ msgstr "Los recursos Clientes definidos son:\n"
 
+#, fuzzy
+#~ msgid "Select Client resource"
+#~ msgstr "Seleccionar recurso FileSet"
+
 #~ msgid "Select Client (File daemon) resource"
 #~ msgstr "Seleccione recurso Cliente (File Daemon)"
 
 #~ msgid "Error: Client resource %s does not exist.\n"
 #~ msgstr "Error: Recurso Cliente %s no existe.\n"
 
+#, fuzzy
+#~ msgid "The defined Schedule resources are:\n"
+#~ msgstr "Los recursos Clientes definidos son:\n"
+
+#, fuzzy
+#~ msgid "Schedule"
+#~ msgstr ""
+#~ "\n"
+#~ "Scheduled Jobs:\n"
+
+#, fuzzy
+#~ msgid "Select Schedule resource"
+#~ msgstr "Seleccione recurso Pool"
+
 #~ msgid "Could not find Client %s: ERR=%s"
 #~ msgstr "No se pudo encontrar el Cliente %s: ERR=%s"
 
@@ -4616,8 +4937,9 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "No access to Pool \"%s\"\n"
 #~ msgstr "No tienen acceso al Pool \"%s\"\n"
 
-#~ msgid "Enter *MediaId or Volume name: "
-#~ msgstr "Introduzca MediaId o nombre del Volumen:"
+#, fuzzy
+#~ msgid "Enter a Volume name or *MediaId: "
+#~ msgstr "Introduzca nombre de Volumen:"
 
 #~ msgid "The defined Pool resources are:\n"
 #~ msgstr "Los recursos Pool definidos son:\n"
@@ -4696,11 +5018,15 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgstr "Ninguno de sus trabajos se está ejecutando.\n"
 
 #, fuzzy
+#~ msgid "No value given for \"jobid\".\n"
+#~ msgstr "Volúmenes no encontrados para JobId=%d\n"
+
+#, fuzzy
 #~ msgid "Unauthorized command from this console for JobId=%d.\n"
 #~ msgstr "Comando no autorizado desde esta consola.\n"
 
 #, fuzzy
-#~ msgid "Warning Job JobId=%d is not running. Continuing anyway...\n"
+#~ msgid "Warning Job JobId=%d is not running.\n"
 #~ msgstr ""
 #~ "Advertencia Job %s no está¡ en ejecución. Continuar de todos modos ...\n"
 
@@ -4708,9 +5034,25 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Confirm %s of %d Job%s (yes/no): "
 #~ msgstr "Confirmar cancelar(si/no): "
 
-#~ msgid "Warning Job %s is not running. Continuing anyway ...\n"
-#~ msgstr ""
-#~ "Advertencia Job %s no está¡ en ejecución. Continuar de todos modos ...\n"
+#, fuzzy
+#~ msgid "No value given for \"job\".\n"
+#~ msgstr "Volúmenes no encontrados para JobId=%d\n"
+
+#, fuzzy
+#~ msgid "Unauthorized command from this console for job=%s.\n"
+#~ msgstr "Comando no autorizado desde esta consola.\n"
+
+#, fuzzy
+#~ msgid "Warning Job %s is not running.\n"
+#~ msgstr "JobId %s no está en ejecución.\n"
+
+#, fuzzy
+#~ msgid "No value given for \"ujobid\".\n"
+#~ msgstr "Volúmenes no encontrados para JobId=%d\n"
+
+#, fuzzy
+#~ msgid "Unauthorized command from this console for ujobid=%s.\n"
+#~ msgstr "Comando no autorizado desde esta consola.\n"
 
 #, fuzzy
 #~ msgid "Select Job(s):\n"
@@ -4735,11 +5077,16 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Select daemon type for status"
 #~ msgstr "Seleccione el tipo de demonio para estado"
 
-#~ msgid "%s Version: %s (%s) %s %s %s\n"
+#, fuzzy
+#~ msgid "%s %sVersion: %s (%s) %s %s %s\n"
 #~ msgstr "%s Versión: %s (%s) %s %s %s\n"
 
 #, fuzzy
-#~ msgid "Daemon started %s. Jobs: run=%d, running=%d mode=%d,%d\n"
+#~ msgid "Daemon started %s, conf reloaded %s\n"
+#~ msgstr "Demonio iniciado %s, 1 Job ejecutando desde el inicio.\n"
+
+#, fuzzy
+#~ msgid " Jobs: run=%d, running=%d mode=%d,%d\n"
 #~ msgstr "Demonio iniciado %s, %d Job ejecutando desde el inicio.\n"
 
 #~ msgid " Heap: heap=%s smbytes=%s max_bytes=%s bufs=%s max_bufs=%s\n"
@@ -4800,7 +5147,8 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "%-14s %-8s %3d  %-18s %-18s %s\n"
 #~ msgstr "%-14s %-8s %3d %-18s %-18s %s\n"
 
-#~ msgid "Ignoring invalid value for days. Max is 500.\n"
+#, fuzzy
+#~ msgid "Ignoring invalid value for days. Max is 3000.\n"
 #~ msgstr "Ignorando valores inválidos para el día. Máximo es de 500.\n"
 
 #, fuzzy
@@ -4814,6 +5162,9 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "No Scheduled Jobs.\n"
 #~ msgstr "No hay Jobs Programados.\n"
 
+#~ msgid "Ignoring invalid value for days. Max is 500.\n"
+#~ msgstr "Ignorando valores inválidos para el día. Máximo es de 500.\n"
+
 #~ msgid ""
 #~ "\n"
 #~ "Running Jobs:\n"
@@ -4821,7 +5172,8 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ "\n"
 #~ "Jobs Ejecutando:\n"
 
-#~ msgid "Console connected at %s\n"
+#, fuzzy
+#~ msgid "Console connected %sat %s\n"
 #~ msgstr "Consola conectada en %s\n"
 
 #~ msgid ""
@@ -4853,6 +5205,10 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "has terminated with warnings"
 #~ msgstr "ha terminado con advertencias"
 
+#, fuzzy
+#~ msgid "has terminated in incomplete state"
+#~ msgstr "ha terminado con advertencias"
+
 #~ msgid "has erred"
 #~ msgstr "ha errado"
 
@@ -5037,7 +5393,8 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "cwd is: %s\n"
 #~ msgstr "cwd es: %s\n"
 
-#~ msgid "Invalid command \"%s\". Enter \"done\" to exit.\n"
+#, fuzzy
+#~ msgid "Invalid command \"%s\".  Enter \"done\" to exit.\n"
 #~ msgstr "Invalido comando \"%s\". Introduzca \"done\" para salir.\n"
 
 #~ msgid "No files marked.\n"
@@ -5118,6 +5475,10 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Long term statistics"
 #~ msgstr "Estadísticas a largo plazo"
 
+#, fuzzy
+#~ msgid "Snapshot parameters"
+#~ msgstr "Parámetros del Volumen"
+
 #~ msgid "item"
 #~ msgstr "í­tem"
 
@@ -5130,12 +5491,6 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "New Volume status is: %s\n"
 #~ msgstr "Nuevo estado del Volumen es: %s\n"
 
-#~ msgid "Invalid retention period specified: %s\n"
-#~ msgstr "Periodo de retención especificado no valido: %s\n"
-
-#~ msgid "New retention period is: %s\n"
-#~ msgstr "Nuevo periodo de retención es: %s\n"
-
 #~ msgid "Invalid use duration specified: %s\n"
 #~ msgstr "Duración de uso especificado no válido: %s\n"
 
@@ -5254,9 +5609,6 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Action On Purge"
 #~ msgstr "Action On Purge"
 
-#~ msgid "Done"
-#~ msgstr "Hecho"
-
 #~ msgid "Updating Volume \"%s\"\n"
 #~ msgstr "Actualizando Volumen \"%s\"\n"
 
@@ -5269,9 +5621,6 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Choose new Volume Status"
 #~ msgstr "Seleccione el nuevo estado del Volumen"
 
-#~ msgid "Current retention period is: %s\n"
-#~ msgstr "Actual periodo de retención es: %s\n"
-
 #~ msgid "Enter Volume Retention period: "
 #~ msgstr "Introduzca periodo de Retención del Volumen:"
 
@@ -5368,9 +5717,6 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Enter new ActionOnPurge (one of: Truncate, None): "
 #~ msgstr "Introduzca nuevo ActionOnPurge (uno de: Truncar, Ninguno):"
 
-#~ msgid "Selection terminated.\n"
-#~ msgstr "Selección terminada.\n"
-
 #~ msgid "Updating %i job(s).\n"
 #~ msgstr "Actualizando %i job(s).\n"
 
@@ -5822,15 +6168,6 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgstr ""
 #~ "No puede restaurar ACL de %s - incompatible flujo acl encontrado - %d\n"
 
-#~ msgid "I only authenticate directors, not %d\n"
-#~ msgstr "Yo sólo autentifico directores, no %d\n"
-
-#~ msgid "Bad Hello command from Director at %s: %s\n"
-#~ msgstr "Malo comando Hello desde Director en %s: %s\n"
-
-#~ msgid "Connection from unknown Director %s at %s rejected.\n"
-#~ msgstr "Conexión desde Director %s desconocido  en %s rechazada.\n"
-
 #~ msgid "Incorrect password given by Director at %s.\n"
 #~ msgstr "Contraseña incorrecta dada por el Director en %s.\n"
 
@@ -5841,24 +6178,16 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ "Problema de autorización: El servidor remoto no anunció suporte TLS "
 #~ "requerido.\n"
 
-#~ msgid "Unable to authenticate Director\n"
-#~ msgstr "No se puede autentificar el Director\n"
-
 #~ msgid "Cannot set buffer size FD->SD.\n"
 #~ msgstr "No puede establecer el tamaño del búfer FD-> SD.\n"
 
-#~ msgid "Encountered %ld acl errors while doing backup\n"
+#, fuzzy
+#~ msgid "Had %ld acl errors while doing backup\n"
 #~ msgstr "Detectado %ld errores de acl al hacer copia de seguridad\n"
 
-#~ msgid "Encountered %ld xattr errors while doing backup\n"
-#~ msgstr "Detectado %ld errores de xattr al hacer copia de seguridad\n"
-
 #, fuzzy
-#~ msgid "Unsupported cipher on this system.\n"
-#~ msgstr "Tipo de cifrado especificados no soportado\n"
-
-#~ msgid "An error occurred while encrypting the stream.\n"
-#~ msgstr "A ocurrido un error al cifrar el stream.\n"
+#~ msgid "Had %ld xattr errors while doing backup\n"
+#~ msgstr "Detectado %ld errores de xattr al hacer copia de seguridad\n"
 
 #~ msgid "     Recursion turned off. Will not descend from %s into %s\n"
 #~ msgstr "Recursión desactivado. No descenderá de %s dentro de %s\n"
@@ -5900,37 +6229,39 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "     Unknown file type %d; not saved: %s\n"
 #~ msgstr "     Tipo de archivo %d desconocido; no ha sido guardado: %s\n"
 
-#~ msgid "%s signature digest initialization failed\n"
-#~ msgstr "Fallo la inicialización de la firma digest %s\n"
-
 #~ msgid "     Cannot open \"%s\": ERR=%s.\n"
 #~ msgstr "No se puede abrir \"%s\": ERR=%s.\n"
 
-#~ msgid "     Cannot open resource fork for \"%s\": ERR=%s.\n"
-#~ msgstr "No se puede abrir recurso fork para \"%s\": ERR=%s.\n"
+#, fuzzy
+#~ msgid "Windows Encrypted data not supported on this OS.\n"
+#~ msgstr "flujo %s no suportado en este Cliente.\n"
 
-#~ msgid "Failed to allocate memory for crypto signature.\n"
-#~ msgstr "No se pudo asignar memoria para la firma de cifrado.\n"
+#~ msgid "Read error on file %s. ERR=%s\n"
+#~ msgstr "Error de lectura en el archivo %s. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "An error occurred while adding signer the stream.\n"
-#~ msgstr "Se produjo un error al firmar el stream.\n"
+#~ msgid "Too many errors. JobErrors=%d.\n"
+#~ msgstr "Demasiados errores.\n"
 
-#~ msgid "An error occurred while signing the stream.\n"
-#~ msgstr "Se produjo un error al firmar el stream.\n"
+#~ msgid "Encryption padding error\n"
+#~ msgstr "Error de relleno de cifrado\n"
 
-#~ msgid "An error occurred finalizing signing the stream.\n"
-#~ msgstr "Se produjo un error concluir la firma del stream.\n"
+#~ msgid "Encryption error\n"
+#~ msgstr "Error de cifrado\n"
 
-#~ msgid "Compression deflateParams error: %d\n"
-#~ msgstr "Error de compresión DeflateParams: %d\n"
+#~ msgid "Invalid file flags, no supported data stream type.\n"
+#~ msgstr ""
+#~ "Invalidas banderas de archivo, tipo de flujo de datos no soportado.\n"
 
 #, fuzzy
-#~ msgid "Encrypting sparse or offset data not supported.\n"
-#~ msgstr "Cifrado de datos dispersos no soportado.\n"
+#~ msgid "Network send error to SD. Data=%s ERR=%s\n"
+#~ msgstr "Error de red al enviar para SD. ERR=%s\n"
 
-#~ msgid "Failed to initialize encryption context.\n"
-#~ msgstr "Fallo al inicializar el contexto de cifrado.\n"
+#~ msgid "Compression deflateParams error: %d\n"
+#~ msgstr "Error de compresión DeflateParams: %d\n"
+
+#~ msgid "     Cannot open resource fork for \"%s\": ERR=%s.\n"
+#~ msgstr "No se puede abrir recurso fork para \"%s\": ERR=%s.\n"
 
 #~ msgid "Compression deflate error: %d\n"
 #~ msgstr "Error de compresión Deflate: %d\n"
@@ -5942,27 +6273,104 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Compression LZO error: %d\n"
 #~ msgstr "Error de compresión Deflate: %d\n"
 
-#~ msgid "Encryption error\n"
-#~ msgstr "Error de cifrado\n"
-
-#~ msgid "Read error on file %s. ERR=%s\n"
-#~ msgstr "Error de lectura en el archivo %s. ERR=%s\n"
-
-#, fuzzy
-#~ msgid "Too many errors. JobErrors=%d.\n"
-#~ msgstr "Demasiados errores.\n"
-
-#~ msgid "Encryption padding error\n"
-#~ msgstr "Error de relleno de cifrado\n"
-
-#~ msgid "Invalid file flags, no supported data stream type.\n"
-#~ msgstr ""
-#~ "Invalidas banderas de archivo, tipo de flujo de datos no soportado.\n"
-
 #~ msgid "VSS Writer (BackupComplete): %s\n"
 #~ msgstr "VSS Writer (BackupComplete): %s\n"
 
 #, fuzzy
+#~ msgid ""
+#~ "\n"
+#~ "%sVersion: %s (%s)\n"
+#~ "\n"
+#~ "Usage: bfdjson [-c config_file] [-d debug_level]\n"
+#~ "        -r <res>    get resource type <res>\n"
+#~ "        -n <name>   get resource <name>\n"
+#~ "        -l <dirs>   get only directives matching dirs (use with -r)\n"
+#~ "        -D          get only data\n"
+#~ "        -c <file>   use <file> as configuration file\n"
+#~ "        -d <nn>     set debug level to <nn>\n"
+#~ "        -dt         print a timestamp in debug output\n"
+#~ "        -t          test configuration file and exit\n"
+#~ "        -v          verbose user messages\n"
+#~ "        -?          print this message.\n"
+#~ "\n"
+#~ msgstr ""
+#~ "\n"
+#~ "Version: %s (%s)\n"
+#~ "\n"
+#~ "Utilice: bacula-fd [-f -s] [-c archivo_de_configuración] [-d "
+#~ "nivel_depuración]\n"
+#~ " -c <archivo> establecer archivo de configuración para archivo \n"
+#~ " -d <nn> establecer el nivel de depuración para <nn>\n"
+#~ " -dt imprimir timestamp en salida de depuración\n"
+#~ " -f ejecutar en primer plano (para depuración)\n"
+#~ " -g groupid\n"
+#~ " -k keep readall capabilities\n"
+#~ " -m imprimir salida kaboom para depuración)\n"
+#~ " -s sin señales(para depuración)\n"
+#~ " -t prueba - leer la configuración y salir\n"
+#~ " -u userid\n"
+#~ " -v mensajes de usuario detallados\n"
+#~ " -? imprimir este mensaje.\n"
+#~ "\n"
+
+#~ msgid ""
+#~ "No File daemon resource defined in %s\n"
+#~ "Without that I don't know who I am :-(\n"
+#~ msgstr ""
+#~ "Ninguno recurso File Daemon definido en %s\n"
+#~ "Sin eso yo no sé quién soy :-(\n"
+
+#~ msgid "Only one Client resource permitted in %s\n"
+#~ msgstr "Sólo un recurso de cliente permitido en %s\n"
+
+#~ msgid ""
+#~ "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined "
+#~ "for File daemon in %s.\n"
+#~ msgstr ""
+#~ "Ninguno \"Certificado TLS de CA\" o \"Directorio de Certificado TLS de CA"
+#~ "\" están definidos para el demonio File en %s.\n"
+
+#~ msgid ""
+#~ "\"PKI Key Pair\" must be defined for File daemon \"%s\" in %s if either "
+#~ "\"PKI Sign\" or \"PKI Encrypt\" are enabled.\n"
+#~ msgstr ""
+#~ "\"Par de Claves PKI\" debe estar definido para el demonio File \"%s\" en "
+#~ "%s, si uno o otro \"Firma PKI\" o \"Cifrar PKI\" están habilitados.\n"
+
+#~ msgid "No Director resource defined in %s\n"
+#~ msgstr "Recurso Director no definido en %s\n"
+
+#, fuzzy
+#~ msgid "Encrypting sparse or offset data not supported.\n"
+#~ msgstr "Cifrado de datos dispersos no soportado.\n"
+
+#~ msgid "Failed to initialize encryption context.\n"
+#~ msgstr "Fallo al inicializar el contexto de cifrado.\n"
+
+#~ msgid "%s signature digest initialization failed\n"
+#~ msgstr "Fallo la inicialización de la firma digest %s\n"
+
+#, fuzzy
+#~ msgid "Unsupported cipher on this system.\n"
+#~ msgstr "Tipo de cifrado especificados no soportado\n"
+
+#~ msgid "An error occurred while encrypting the stream.\n"
+#~ msgstr "A ocurrido un error al cifrar el stream.\n"
+
+#~ msgid "Failed to allocate memory for crypto signature.\n"
+#~ msgstr "No se pudo asignar memoria para la firma de cifrado.\n"
+
+#, fuzzy
+#~ msgid "An error occurred while adding signer the stream.\n"
+#~ msgstr "Se produjo un error al firmar el stream.\n"
+
+#~ msgid "An error occurred while signing the stream.\n"
+#~ msgstr "Se produjo un error al firmar el stream.\n"
+
+#~ msgid "An error occurred finalizing signing the stream.\n"
+#~ msgstr "Se produjo un error concluir la firma del stream.\n"
+
+#, fuzzy
 #~ msgid "Command plugin \"%s\": no type in startBackupFile packet.\n"
 #~ msgstr "Comando plugin \"%s\" regresó malo paquete startBackupFile.\n"
 
@@ -5994,6 +6402,56 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgstr "Comando plugin \"%s\" regresó malo paquete startBackupFile.\n"
 
 #, fuzzy
+#~ msgid "Error while creating command string %s.\n"
+#~ msgstr ""
+#~ "Error al analizar los argumentos de línea de comandos, usando valores por "
+#~ "defecto.\n"
+
+#, fuzzy
+#~ msgid "Error while executing \"%s\" %s. %s %s\n"
+#~ msgstr "A ocurrido un error al cifrar el stream.\n"
+
+#, fuzzy
+#~ msgid "Unable to create snapshot record. ERR=%s\n"
+#~ msgstr "No se puede crear hilo. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to create snapshot record, got %s\n"
+#~ msgstr "No se puede obtener el registro Job para JobId=%s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to delete snapshot record. ERR=%s\n"
+#~ msgstr "No se pudo obtener registro de Job. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to delete snapshot record, got %s\n"
+#~ msgstr "No se puede obtener el registro Job para JobId=%s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to get snapshot record. ERR=%s\n"
+#~ msgstr "No se pudo obtener registro de Job. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to get snapshot record, got %s\n"
+#~ msgstr "No se puede obtener el registro Job para JobId=%s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to parse command output\n"
+#~ msgstr "Fallo al conectar con el cliente.\n"
+
+#, fuzzy
+#~ msgid "   Unable to delete snapshot of %s ERR=%s\n"
+#~ msgstr "No se puede escribir última en %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "   Create Snapshot for %s\n"
+#~ msgstr "Fallo al generar VSS snapshots.\n"
+
+#, fuzzy
+#~ msgid "   Unable to create snapshot of %s ERR=%s\n"
+#~ msgstr "No se puede escribir última en %s: ERR=%s\n"
+
+#, fuzzy
 #~ msgid ""
 #~ "\n"
 #~ "%sVersion: %s (%s)\n"
@@ -6036,37 +6494,13 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "-k option has no meaning without -u option.\n"
 #~ msgstr "la opción -k no tiene sentido sin la opción -u.\n"
 
-#~ msgid ""
-#~ "No File daemon resource defined in %s\n"
-#~ "Without that I don't know who I am :-(\n"
-#~ msgstr ""
-#~ "Ninguno recurso File Daemon definido en %s\n"
-#~ "Sin eso yo no sé quién soy :-(\n"
-
-#~ msgid "Only one Client resource permitted in %s\n"
-#~ msgstr "Sólo un recurso de cliente permitido en %s\n"
-
 #, fuzzy
 #~ msgid "Disable Command \"%s\" not found.\n"
 #~ msgstr "Registro FileSet \"%s\" no encontrado.\n"
 
-#~ msgid ""
-#~ "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined "
-#~ "for File daemon in %s.\n"
-#~ msgstr ""
-#~ "Ninguno \"Certificado TLS de CA\" o \"Directorio de Certificado TLS de CA"
-#~ "\" están definidos para el demonio File en %s.\n"
-
 #~ msgid "PKI encryption/signing enabled but not compiled into Bacula.\n"
 #~ msgstr "Cifrado o Firma PKI habilitado, pero no compilado en Bacula.\n"
 
-#~ msgid ""
-#~ "\"PKI Key Pair\" must be defined for File daemon \"%s\" in %s if either "
-#~ "\"PKI Sign\" or \"PKI Encrypt\" are enabled.\n"
-#~ msgstr ""
-#~ "\"Par de Claves PKI\" debe estar definido para el demonio File \"%s\" en "
-#~ "%s, si uno o otro \"Firma PKI\" o \"Cifrar PKI\" están habilitados.\n"
-
 #~ msgid "Failed to allocate a new keypair object.\n"
 #~ msgstr "No se ha podido asignar un nuevo objeto keypair.\n"
 
@@ -6097,16 +6531,18 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ "Fallo al cargar certificado de llave maestro desde el archivo %s para "
 #~ "File Daemon \"%s\" en %s.\n"
 
-#~ msgid "No Director resource defined in %s\n"
-#~ msgstr "Recurso Director no definido en %s\n"
-
 #, fuzzy
 #~ msgid "Expected a Cipher Type keyword, got: %s"
 #~ msgstr "Esperaba una palabra clave Tipo Device, obtuvo: %s"
 
-#, fuzzy
-#~ msgid "Command: \"%s\" is disabled.\n"
-#~ msgstr "Job \"%s\" %sabled\n"
+#~ msgid "Bad Hello command from Director at %s. Len=%d.\n"
+#~ msgstr "Malo comando Hello desde Director en %s. Len=%d\n"
+
+#~ msgid "Bad Hello command from Director at %s: %s\n"
+#~ msgstr "Malo comando Hello desde Director en %s: %s\n"
+
+#~ msgid "Connection from unknown Director %s at %s rejected.\n"
+#~ msgstr "Conexión desde Director %s desconocido  en %s rechazada.\n"
 
 #, fuzzy
 #~ msgid "SD connect failed: Bad Hello command\n"
@@ -6117,6 +6553,26 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgstr "Fallo al conectar a FD: Nombre del Job no encontrado: %s\n"
 
 #, fuzzy
+#~ msgid "SD \"%s\" tried to connect two times.\n"
+#~ msgstr "Fallo al conectar con el cliente.\n"
+
+#, fuzzy
+#~ msgid "Recv caps from SD failed. ERR=%s\n"
+#~ msgstr "cap_from_text fallido: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Bad caps from SD: %s.\n"
+#~ msgstr "Malo comando Hello desde Director en %s: %s\n"
+
+#, fuzzy
+#~ msgid "Bad caps from SD: %s\n"
+#~ msgstr "Mal estado desde BSF. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Command: \"%s\" is disabled.\n"
+#~ msgstr "Job \"%s\" %sabled\n"
+
+#, fuzzy
 #~ msgid "Bad command from %s. Len=%d.\n"
 #~ msgstr "Malo comando Hello desde Director en %s. Len=%d\n"
 
@@ -6234,6 +6690,28 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Bad response from stored to open command\n"
 #~ msgstr "Mala respuesta desde almacén para comando abrir\n"
 
+#, fuzzy
+#~ msgid "Generate VSS snapshots. Driver=\"%s\"\n"
+#~ msgstr ""
+#~ "Generar instantáneas(snapshots) VSS. Driver=\"%s\", Drive(s)=\"%s\"\n"
+
+#, fuzzy
+#~ msgid "VSS CreateSnapshots failed. ERR=%s\n"
+#~ msgstr "Fallo al generar VSS snapshots.\n"
+
+#~ msgid "VSS Writer (PrepareForBackup): %s\n"
+#~ msgstr "VSS Writer (PrepareForBackup): %s\n"
+
+#~ msgid "No drive letters found for generating VSS snapshots.\n"
+#~ msgstr ""
+#~ "No encuentra las letras de unidad para la generación de "
+#~ "instantáneas(snapshots) VSS.\n"
+
+#, fuzzy
+#~ msgid "VSS was not initialized properly. ERR=%s\n"
+#~ msgstr ""
+#~ "VSS no se inicializo correctamente. Suporte VSS está desactivado. ERR=%s\n"
+
 #~ msgid "Append Close with SD failed.\n"
 #~ msgstr "Añadir Cierre con SD fallido.\n"
 
@@ -6253,6 +6731,14 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Bad where regexp. where=%s\n"
 #~ msgstr "Mala regexp where. where=%s\n"
 
+#~ msgid "VSS was not initialized properly. VSS support is disabled. ERR=%s\n"
+#~ msgstr ""
+#~ "VSS no se inicializo correctamente. Suporte VSS está desactivado. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "VSS Writer (RestoreComplete): %s\n"
+#~ msgstr "VSS Writer (BackupComplete): %s\n"
+
 #~ msgid "Improper calling sequence.\n"
 #~ msgstr "Secuencia de llamada impropia.\n"
 
@@ -6262,11 +6748,9 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Bad response from stored to read open command\n"
 #~ msgstr "Mala respuesta desde storage para comando leer abir\n"
 
-#~ msgid "Comm error with SD. bad response to %s. ERR=%s\n"
-#~ msgstr "Error de comunicación con SD. Mala respuesta a %s. ERR=%s\n"
-
 #, fuzzy
-#~ msgid "Bad response from SD to %s command. Wanted %s, got %s\n"
+#~ msgid ""
+#~ "Bad response from SD to %s command. Wanted %s, got len=%ld msg=\"%s\"\n"
 #~ msgstr "Mala respuesta al comando %s. Esperaba %s, obtuvo %s\n"
 
 #~ msgid ""
@@ -6435,6 +6919,19 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Write error in Win32 Block Decomposition on %s: %s\n"
 #~ msgstr "Error de escritura en Bloque de Descomposición Win32 en %s: %s\n"
 
+#, fuzzy
+#~ msgid "Write write error on %s: ERR=%s\n"
+#~ msgstr "Error de escritura en %s: %s\n"
+
+#, fuzzy
+#~ msgid "Wrong write size error at %lld block=%d wanted=%d wrote=%d\n"
+#~ msgstr "Error de escritura en Bloque de Descomposición Win32 en %s: %s\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "Write write error at %lld block=%d write_len=%d lerror=%d on %s: ERR=%s\n"
+#~ msgstr "Error de escritura en Bloque de Descomposición Win32 en %s: %s\n"
+
 #~ msgid "Decryption error\n"
 #~ msgstr "Error de descifrado\n"
 
@@ -6447,17 +6944,9 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Decryption error. buf_len=%d decrypt_len=%d on file %s\n"
 #~ msgstr "Error de descifrado. buf_len=%d decrypt_len=%d en el archivo %s\n"
 
-#~ msgid "Open File Manager paused\n"
-#~ msgstr "Administrador Open File pausado\n"
-
-#~ msgid "FAILED to pause Open File Manager\n"
-#~ msgstr "Fallo al pausar Administrador Open File\n"
-
-#~ msgid "Running as '%s'. Privmask=%#08x\n"
-#~ msgstr "Ejecutando como '%s'. Privmask=%#08x\n"
-
-#~ msgid "Failed to retrieve current UserName\n"
-#~ msgstr "Fallo al recuperar UserName actual\n"
+#, fuzzy
+#~ msgid "%s %sVersion: %s (%s) %s %s %s %s\n"
+#~ msgstr "%s Versión: %s (%s) %s %s %s %s\n"
 
 #, fuzzy
 #~ msgid "Daemon started %s. Jobs: run=%d running=%d.\n"
@@ -6469,7 +6958,8 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ "s\n"
 #~ msgstr "Sizeof: boffset_t=%d size_t=%d debug=%d trace=%d\n"
 
-#~ msgid "Director connected at: %s\n"
+#, fuzzy
+#~ msgid "Director connected %sat: %s\n"
 #~ msgstr "Director conectado en: %s\n"
 
 #~ msgid "JobId %d Job %s is running.\n"
@@ -6482,7 +6972,7 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #, fuzzy
 #~ msgid ""
 #~ "    Files=%s Bytes=%s AveBytes/sec=%s LastBytes/sec=%s Errors=%d\n"
-#~ "    Bwlimit=%s\n"
+#~ "    Bwlimit=%s ReadBytes=%s\n"
 #~ msgstr "Archivos=%s Bytes=%s Bytes/sec=%s Errores=%d\n"
 
 #, fuzzy
@@ -6498,10 +6988,6 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "====\n"
 #~ msgstr "====\n"
 
-#, fuzzy
-#~ msgid " SDSocket=closed\n"
-#~ msgstr "SDSocket cerrado.\n"
-
 #~ msgid "Bad .status command: %s\n"
 #~ msgstr "Comando .status malo: %s\n"
 
@@ -6557,6 +7043,10 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Error scanning record header: %s\n"
 #~ msgstr "Error escaneando registro de cabecera: %s\n"
 
+#, fuzzy
+#~ msgid "WriteEncryptedFileRaw failure: ERR=%s\n"
+#~ msgstr "Fallo al listar Media: ERR=%s\n"
+
 #~ msgid "Illegal xattr stream, no XATTR_MAGIC on file \"%s\"\n"
 #~ msgstr "Flujo xattr ilegal, no hay XATTR_MAGIC en el archivo \"%s\"\n"
 
@@ -6743,17 +7233,41 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ "No se puede restaurar los atributos extendidos de %s - incompatible flujo "
 #~ "xattr encontrado - %d\n"
 
-#~ msgid "Unix attributes"
-#~ msgstr "Atributos Unix"
+#~ msgid "Unable to set file owner %s: ERR=%s\n"
+#~ msgstr "No se pudo establecer propietario del archivo %s: ERR=%s\n"
 
-#~ msgid "File data"
-#~ msgstr "Archivo de datos"
+#~ msgid "Unable to set file modes %s: ERR=%s\n"
+#~ msgstr "No se pudo establecer modos del archivo %s: ERR=%s\n"
 
-#~ msgid "MD5 digest"
-#~ msgstr "Sumario MD5"
+#~ msgid "Unable to set file times %s: ERR=%s\n"
+#~ msgstr "No se pudo establecer tiempos del archivo %s: ERR=%s\n"
 
-#~ msgid "GZIP data"
-#~ msgstr "GZIP datos"
+#~ msgid ""
+#~ "File size of restored file %s not correct. Original %s, restored %s.\n"
+#~ msgstr ""
+#~ "Tamaño del archivo %s restaurado no es correcto. Original %s, restaurado "
+#~ "%s.\n"
+
+#~ msgid "Unable to set file flags %s: ERR=%s\n"
+#~ msgstr "No es posible establecer banderas  en archivo %s: ERR=%s\n"
+
+#~ msgid "Error in %s file %s: ERR=%s\n"
+#~ msgstr "Error en %s archivo %s: ERR=%s\n"
+
+#~ msgid "Error in %s: ERR=%s\n"
+#~ msgstr "Error en %s: ERR=%s\n"
+
+#~ msgid "Unix attributes"
+#~ msgstr "Atributos Unix"
+
+#~ msgid "File data"
+#~ msgstr "Archivo de datos"
+
+#~ msgid "MD5 digest"
+#~ msgstr "Sumario MD5"
+
+#~ msgid "GZIP data"
+#~ msgstr "GZIP datos"
 
 #, fuzzy
 #~ msgid "Compressed data"
@@ -6846,130 +7360,128 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Restore Object"
 #~ msgstr "Restauración OK"
 
-#~ msgid "AIX Specific ACL attribs"
+#, fuzzy
+#~ msgid "AIX ACL attribs"
 #~ msgstr "Atributos ACL específicos de AIX"
 
-#~ msgid "Darwin Specific ACL attribs"
+#, fuzzy
+#~ msgid "Darwin ACL attribs"
 #~ msgstr "Atributos ACL específicos de Darwin"
 
-#~ msgid "FreeBSD Specific Default ACL attribs"
+#, fuzzy
+#~ msgid "FreeBSD Default ACL attribs"
 #~ msgstr "Atributos ACL por defecto específicos de FreeBSD"
 
-#~ msgid "FreeBSD Specific Access ACL attribs"
+#, fuzzy
+#~ msgid "FreeBSD Access ACL attribs"
 #~ msgstr "Atributos ACL de acceso específicos de FreeBSD"
 
-#~ msgid "HPUX Specific ACL attribs"
+#, fuzzy
+#~ msgid "HPUX ACL attribs"
 #~ msgstr "Atributos ACL específicos de HPUX"
 
-#~ msgid "Irix Specific Default ACL attribs"
+#, fuzzy
+#~ msgid "Irix Default ACL attribs"
 #~ msgstr "Atributos ACL por defecto específicos de Irix"
 
-#~ msgid "Irix Specific Access ACL attribs"
+#, fuzzy
+#~ msgid "Irix Access ACL attribs"
 #~ msgstr "Atributos ACL de acceso específicos de Irix"
 
-#~ msgid "Linux Specific Default ACL attribs"
+#, fuzzy
+#~ msgid "Linux Default ACL attribs"
 #~ msgstr "Atributos ACL por defecto específicos de Linux"
 
-#~ msgid "Linux Specific Access ACL attribs"
+#, fuzzy
+#~ msgid "Linux Access ACL attribs"
 #~ msgstr "Atributos ACL de acceso específicos de Linux"
 
 #, fuzzy
-#~ msgid "TRU64 Specific Default ACL attribs"
+#~ msgid "TRU64 Default ACL attribs"
 #~ msgstr "Atributos ACL por defecto específicos de Irix"
 
 #, fuzzy
-#~ msgid "TRU64 Specific Access ACL attribs"
+#~ msgid "TRU64 Access ACL attribs"
 #~ msgstr "Atributos ACL de acceso específicos de Irix"
 
 #, fuzzy
-#~ msgid "Solaris Specific POSIX ACL attribs"
+#~ msgid "Solaris POSIX ACL attribs"
 #~ msgstr "Atributos ACL específicos de Solaris"
 
 #, fuzzy
-#~ msgid "Solaris Specific NFSv4/ZFS ACL attribs"
+#~ msgid "Solaris NFSv4/ZFS ACL attribs"
 #~ msgstr "Atributos ACL específicos de Solaris"
 
 #, fuzzy
-#~ msgid "AFS Specific ACL attribs"
+#~ msgid "AFS ACL attribs"
 #~ msgstr "Atributos ACL específicos de AIX"
 
 #, fuzzy
-#~ msgid "AIX Specific POSIX ACL attribs"
+#~ msgid "AIX POSIX ACL attribs"
 #~ msgstr "Atributos ACL específicos de AIX"
 
 #, fuzzy
-#~ msgid "AIX Specific NFSv4 ACL attribs"
+#~ msgid "AIX NFSv4 ACL attribs"
 #~ msgstr "Atributos ACL específicos de AIX"
 
 #, fuzzy
-#~ msgid "FreeBSD Specific NFSv4/ZFS ACL attribs"
+#~ msgid "FreeBSD NFSv4/ZFS ACL attribs"
 #~ msgstr "Atributos ACL de acceso específicos de FreeBSD"
 
 #, fuzzy
-#~ msgid "GNU Hurd Specific Default ACL attribs"
+#~ msgid "GNU Hurd Default ACL attribs"
 #~ msgstr "Atributos ACL por defecto específicos de Irix"
 
 #, fuzzy
-#~ msgid "GNU Hurd Specific Access ACL attribs"
+#~ msgid "GNU Hurd Access ACL attribs"
 #~ msgstr "Atributos ACL de acceso específicos de Irix"
 
 #, fuzzy
-#~ msgid "GNU Hurd Specific Extended attribs"
+#~ msgid "GNU Hurd Extended attribs"
 #~ msgstr "Atributos Extendidos Específicos de Linux"
 
 #, fuzzy
-#~ msgid "IRIX Specific Extended attribs"
+#~ msgid "IRIX Extended attribs"
 #~ msgstr "Atributos Extendidos Específicos de Linux"
 
 #, fuzzy
-#~ msgid "TRU64 Specific Extended attribs"
+#~ msgid "TRU64 Extended attribs"
 #~ msgstr "Atributos Extendidos Específicos de Linux"
 
 #, fuzzy
-#~ msgid "AIX Specific Extended attribs"
-#~ msgstr "Atributos Extendidos Específicos de Linux"
+#~ msgid "AIX Extended attribs"
+#~ msgstr "Atributos extendidos"
 
-#~ msgid "OpenBSD Specific Extended attribs"
+#, fuzzy
+#~ msgid "OpenBSD Extended attribs"
 #~ msgstr "Atributos Extendidos específicos de OpenBSD"
 
-#~ msgid "Solaris Specific Extensible attribs or System Extended attribs"
+#, fuzzy
+#~ msgid "Solaris Extensible attribs or System Extended attribs"
 #~ msgstr ""
 #~ "Atributos extensible específicos de Solaris o atributos de Sistema de "
 #~ "Extensión"
 
-#~ msgid "Solaris Specific Extended attribs"
+#, fuzzy
+#~ msgid "Solaris Extended attribs"
 #~ msgstr "Atributos Extendidos Específicos de Solaris"
 
-#~ msgid "Darwin Specific Extended attribs"
+#, fuzzy
+#~ msgid "Darwin Extended attribs"
 #~ msgstr "Atributos Extendidos Específicos de Darwin"
 
-#~ msgid "FreeBSD Specific Extended attribs"
+#, fuzzy
+#~ msgid "FreeBSD Extended attribs"
 #~ msgstr "Atributos Extendidos Específicos de FreeBSD"
 
-#~ msgid "Linux Specific Extended attribs"
+#, fuzzy
+#~ msgid "Linux Extended attribs"
 #~ msgstr "Atributos Extendidos Específicos de Linux"
 
-#~ msgid "NetBSD Specific Extended attribs"
+#, fuzzy
+#~ msgid "NetBSD Extended attribs"
 #~ msgstr "Atributos Extendidos Específicos de NetBSD"
 
-#~ msgid "Unable to set file modes %s: ERR=%s\n"
-#~ msgstr "No se pudo establecer modos del archivo %s: ERR=%s\n"
-
-#~ msgid "Unable to set file owner %s: ERR=%s\n"
-#~ msgstr "No se pudo establecer propietario del archivo %s: ERR=%s\n"
-
-#~ msgid "Unable to set file times %s: ERR=%s\n"
-#~ msgstr "No se pudo establecer tiempos del archivo %s: ERR=%s\n"
-
-#~ msgid ""
-#~ "File size of restored file %s not correct. Original %s, restored %s.\n"
-#~ msgstr ""
-#~ "Tamaño del archivo %s restaurado no es correcto. Original %s, restaurado "
-#~ "%s.\n"
-
-#~ msgid "Unable to set file flags %s: ERR=%s\n"
-#~ msgstr "No es posible establecer banderas  en archivo %s: ERR=%s\n"
-
 #~ msgid "File skipped. Not newer: %s\n"
 #~ msgstr "Archivo omitido. No más reciente: %s\n"
 
@@ -7017,6 +7529,9 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Zero length filename: %s\n"
 #~ msgstr "Nombre de archivo con longitud cero: %s\n"
 
+#~ msgid "AdjustTokenPrivileges set "
+#~ msgstr "Establecer AdjustTokenPrivileges "
+
 #, fuzzy
 #~ msgid "Plugin: \"%s\" not found.\n"
 #~ msgstr "Plugin=%s no encontrado.\n"
@@ -7064,6 +7579,15 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Too many subdirectories. Some permissions not reset.\n"
 #~ msgstr "Demasiados subdirectorios. Algunos permisos no se restablece.\n"
 
+#~ msgid "Cannot open current directory: ERR=%s\n"
+#~ msgstr "No se puede abrir el directorio actual: ERR=%s\n"
+
+#~ msgid "Cannot get current directory: ERR=%s\n"
+#~ msgstr "No se puede obtener el directorio actual: ERR=%s\n"
+
+#~ msgid "Cannot reset current directory: ERR=%s\n"
+#~ msgstr "No se puede restablecer el directorio actual: ERR=%s\n"
+
 #~ msgid "Only ipv4 and ipv6 are supported (%d)\n"
 #~ msgstr "Solo ipv4 y ipv6 estan soportado (%d)\n"
 
@@ -7072,7 +7596,7 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 
 #, fuzzy
 #~ msgid "You tried to assign a ipv6 address to an ipv4(%d)\n"
-#~ msgstr "Se trató de asignar una dirección IPv6 a IPv4(%d)\n"
+#~ msgstr "Se trató de asignar una dirección IPv4 a IPv6(%d)\n"
 
 #, fuzzy
 #~ msgid "You tried to assign an ipv4 address to an ipv6(%d)\n"
@@ -7296,7 +7820,6 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Unable to connect to %s on %s:%d. ERR=%s\n"
 #~ msgstr "No se puede conectar a %s en %s:%d. ERR=%s\n"
 
-#, fuzzy
 #~ msgid "gethostbyname() for host \"%s\" failed: ERR=%s\n"
 #~ msgstr "fallo gethostbyname() para la maquina \"%s\": ERR=%s\n"
 
@@ -7310,7 +7833,12 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Cannot set TCP_KEEPIDLE on socket: %s\n"
 #~ msgstr "No se puede establecer SO_KEEPIDLE en el socket: %s\n"
 
-#~ msgid "Could not init bsock mutex. ERR=%s\n"
+#, fuzzy
+#~ msgid "Could not init bsock read mutex. ERR=%s\n"
+#~ msgstr "No se pudo iniciar bsock mutex. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Could not init bsock write mutex. ERR=%s\n"
 #~ msgstr "No se pudo iniciar bsock mutex. ERR=%s\n"
 
 #, fuzzy
@@ -7357,6 +7885,49 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgstr "error F_SETFL fcntl. ERR=%s\n"
 
 #, fuzzy
+#~ msgid "Director authorization error at \"%s:%d\"\n"
+#~ msgstr "Problema de autorización de Director en \"%s:%d\"\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "Authorization error: Remote server at \"%s:%d\" did not advertise "
+#~ "required TLS support.\n"
+#~ msgstr ""
+#~ "Problema de autorización: El servidor remoto en \"%s:%d\" no anuncio "
+#~ "soporte TLS  requiere.\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "Authorization error with Director at \"%s:%d\": Remote server requires "
+#~ "TLS.\n"
+#~ msgstr ""
+#~ "Problema de autorización con el Director en \"%s:%d\": El servidor remoto "
+#~ "requiere TLS.\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "Bad errmsg to Hello command: ERR=%s\n"
+#~ "The Director at \"%s:%d\" may not be running.\n"
+#~ msgstr ""
+#~ "Mala respuesta al comando Hello: ERR=%s\n"
+#~ "El director en \"%s:%d\" probablemente no esta corriendo.\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "Authorization error with Director at \"%s:%d\"\n"
+#~ "Most likely the passwords do not agree.\n"
+#~ "If you are using TLS, there may have been a certificate validation error "
+#~ "during the TLS handshake.\n"
+#~ "For help, please see: "
+#~ msgstr ""
+#~ "Problema de autorización con el Director en \"%s:%d\"\n"
+#~ "Lo mas probable es que las contraseñas no están de acuerdo.\n"
+#~ "Si está usando TLS, puede haber habido un error de validación de "
+#~ "certificados durante la negociación TLS.\n"
+#~ " Por favor vea http://www.bacula.org/en/rel-manual/"
+#~ "Bacula_Freque_Asked_Questi.html#SECTION003760000000000000000 para ayuda.\n"
+
+#, fuzzy
 #~ msgid "safe_unlink could not compile regex pattern \"%s\" ERR=%s\n"
 #~ msgstr "No se ha podido compilar patrón regex  \"%s\" ERR=%s\n"
 
@@ -7372,7 +7943,8 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Memset for %d bytes at %s:%d\n"
 #~ msgstr "Memset para %d bytes en %s:%d\n"
 
-#~ msgid "Cannot open pid file. %s ERR=%s\n"
+#, fuzzy
+#~ msgid "Cannot open %s file. %s ERR=%s\n"
 #~ msgstr "No se puede abrir el archivo pid. %s ERR=%s\n"
 
 #~ msgid ""
@@ -7382,9 +7954,18 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ "%s ya está en ejecución. pid=%d\n"
 #~ "Compruebe el archivo %s\n"
 
-#~ msgid "Could not open pid file. %s ERR=%s\n"
+#, fuzzy
+#~ msgid "Could not open %s file. %s ERR=%s\n"
 #~ msgstr "No se pudo abrir el archivo pid. %s ERR=%s\n"
 
+#, fuzzy
+#~ msgid "Cannot lock %s file. %s ERR=%s\n"
+#~ msgstr "No se puede abrir el archivo pid. %s ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Cannot not open %s file. %s ERR=%s\n"
+#~ msgstr "No se puede abrir el archivo pid. %s ERR=%s\n"
+
 #~ msgid "Could not create state file. %s ERR=%s\n"
 #~ msgstr "No es posible crear el archivo de estado. %s ERR=%s\n"
 
@@ -7476,15 +8057,6 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "OpenSSL cipher context key/IV initialization failed"
 #~ msgstr "Fallido inicialización de contexto OpenSSL de cifrado de clave/IV "
 
-#~ msgid "Unable to init OpenSSL threading: ERR=%s\n"
-#~ msgstr "No se puede inicializar hilo OpenSSL: ERR=%s\n"
-
-#~ msgid "Failed to seed OpenSSL PRNG\n"
-#~ msgstr "Fallo al seed OpenSSL PRNG\n"
-
-#~ msgid "Failed to save OpenSSL PRNG\n"
-#~ msgstr "Fallo al guardar OpenSSL PRNG\n"
-
 #~ msgid "Unsupported digest type=%d specified\n"
 #~ msgstr "Incompatible resume tipo=%d especificado\n"
 
@@ -7585,6 +8157,10 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Cannot open config file %s: %s\n"
 #~ msgstr "No se pudo abrir archivo de configuración \"%s\": %s\n"
 
+#, fuzzy
+#~ msgid "Cannot open lex\n"
+#~ msgstr "No se pudo abrir %s\n"
+
 #~ msgid "Backup"
 #~ msgstr "Backup"
 
@@ -7663,9 +8239,6 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "NULL jcr.\n"
 #~ msgstr "NULL jcr.\n"
 
-#~ msgid "JCR use_count=%d JobId=%d\n"
-#~ msgstr "JCR use_count=%d JobId=%d\n"
-
 #~ msgid "pthread_setspecific failed: ERR=%s\n"
 #~ msgstr "fallo pthread_setspecific: ERR=%s\n"
 
@@ -7890,24 +8463,8 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgstr "%s JobId %u: Violación de seguridad: "
 
 #, fuzzy
-#~ msgid "Debug lock information"
-#~ msgstr "Enviando información precisa.\n"
-
-#, fuzzy
-#~ msgid "Debug volume information"
-#~ msgstr "Enviando información precisa.\n"
-
-#, fuzzy
-#~ msgid "Debug scheduler information"
-#~ msgstr "Enviando información precisa.\n"
-
-#, fuzzy
-#~ msgid "Debug protocol information"
-#~ msgstr "Enviando información precisa.\n"
-
-#, fuzzy
 #~ msgid "Debug all information"
-#~ msgstr "Enviando información precisa.\n"
+#~ msgstr "Instrucción ilegal"
 
 #~ msgid "Unable to init mutex: ERR=%s\n"
 #~ msgstr "No se puede iniciar mutex: ERR=%s\n"
@@ -7915,9 +8472,22 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Unable to destroy mutex: ERR=%s\n"
 #~ msgstr "No se puede destruir mutex: ERR=%s\n"
 
+#~ msgid "Unable to init OpenSSL threading: ERR=%s\n"
+#~ msgstr "No se puede inicializar hilo OpenSSL: ERR=%s\n"
+
+#~ msgid "Failed to seed OpenSSL PRNG\n"
+#~ msgstr "Fallo al seed OpenSSL PRNG\n"
+
+#~ msgid "Failed to save OpenSSL PRNG\n"
+#~ msgstr "Fallo al guardar OpenSSL PRNG\n"
+
 #~ msgid "***UNKNOWN***"
 #~ msgstr "***DESCONOCIDO***"
 
+#, fuzzy
+#~ msgid "Inserted res: %s index=%d\n"
+#~ msgstr "Insertando %s res: %s index=%d pass=%d\n"
+
 #~ msgid "expected an =, got: %s"
 #~ msgstr "esperaba un =, obtuvo: %s"
 
@@ -8057,6 +8627,30 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Could not set specified userid: %s\n"
 #~ msgstr "No se pudo establecer userid especificado: %s\n"
 
+#~ msgid "Could not initialize Python\n"
+#~ msgstr "No se pudo inicializar Python\n"
+
+#~ msgid "Could not Run Python string %s\n"
+#~ msgstr "No se pudo ejecutar Python cadena %s\n"
+
+#~ msgid "Could not initialize Python Job type.\n"
+#~ msgstr "No se pudo inicializar Job tipo Python.\n"
+
+#~ msgid "Could not import Python script %s/%s. Python disabled.\n"
+#~ msgstr "No se puede importar script Python %s/%s. Python deshabilitado.\n"
+
+#~ msgid "Could not create Python Job Object.\n"
+#~ msgstr "No es posible crear objeto Job Python.\n"
+
+#~ msgid "Python function \"%s\" not found.\n"
+#~ msgstr "Python función \"%s\" no encontrada.\n"
+
+#~ msgid "Unknown Python daemon event %s\n"
+#~ msgstr "Demonio Python evento %s desconocido\n"
+
+#~ msgid "Unable to initialize the Python lock. ERR=%s\n"
+#~ msgstr "No se puede inicializar el bloqueo de Python. ERR=%s\n"
+
 #~ msgid "rwl_writelock failure at %s:%d:  ERR=%s\n"
 #~ msgstr "Fallo rwl_writelock en %s:%d: ERR=%s\n"
 
@@ -8093,14 +8687,6 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Selection items must be be greater than zero.\n"
 #~ msgstr "Los valores deben ser ser mayor que cero.\n"
 
-#, fuzzy
-#~ msgid "Selection item too large.\n"
-#~ msgstr "Ranura demasiado grande.\n"
-
-#, fuzzy
-#~ msgid "No input string given.\n"
-#~ msgstr "Especificación de archivo no dado.\n"
-
 #~ msgid "Invalid signal number"
 #~ msgstr "Número de la señal no válida"
 
@@ -8256,7 +8842,8 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Attempt to free NULL called from %s:%d\n"
 #~ msgstr "Intento para liberar NULL llamado desde %s:%d\n"
 
-#~ msgid "double free from %s:%d\n"
+#, fuzzy
+#~ msgid "in-use bit not set: double free from %s:%d\n"
 #~ msgstr "doble libre desde %s:%d\n"
 
 #~ msgid "qp->qnext->qprev != qp called from %s:%d\n"
@@ -8377,6 +8964,10 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Blocked"
 #~ msgstr "Bloqueado"
 
+#, fuzzy
+#~ msgid "Incomplete job"
+#~ msgstr "Job insertado"
+
 #~ msgid "Non-fatal error"
 #~ msgstr "No Fatal Error"
 
@@ -8714,68 +9305,260 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "rwl_writeunlock failure. ERR=%s\n"
 #~ msgstr "rwl_writeunlock failure. ERR=%s\n"
 
-#~ msgid "Acquire read: num_writers=%d not zero. Job %d canceled.\n"
-#~ msgstr "Adquirir leer: num_writers=%d no es cero. Empleo %d cancelado.\n"
+#, fuzzy
+#~ msgid "Can't use replace=ifnewer with Delta plugin on %s\n"
+#~ msgstr "No se puede unescapar cadena: ERR=%s\n"
 
-#~ msgid "No volumes specified for reading. Job %s canceled.\n"
-#~ msgstr "No se especifica el volumen de lectura. Job %s cancelado.\n"
+#, fuzzy
+#~ msgid "Can't use replace=ifolder with Delta plugin on %s\n"
+#~ msgstr "No se puede unescapar cadena: ERR=%s\n"
 
-#~ msgid "Logic error: no next volume to read. Numvol=%d Curvol=%d\n"
-#~ msgstr ""
-#~ "Error logico: no hay prójimo volumen para leer. Numvol=%d Curvol=%d\n"
+#, fuzzy
+#~ msgid "Can't run command %s. ERR=%s\n"
+#~ msgstr "No se puede ejecutar el programa: %s. ERR=%s\n"
 
 #, fuzzy
-#~ msgid ""
-#~ "Changing read device. Want Media Type=\"%s\" have=\"%s\"\n"
-#~ "  %s device=%s\n"
-#~ msgstr ""
-#~ "Cambiando dispositivo de lectura. Media Type=\"%s\" tiene=\"%s\"\n"
-#~ " dispositivo=%s\n"
+#~ msgid "Can't create working directory %s. ERR=%s\n"
+#~ msgstr "No se puede crear directorio %s: ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Media Type change.  New read %s device %s chosen.\n"
-#~ msgstr "Cambio Media Type. Nuevo dispositivo de lectura %s elegido.\n"
+#~ msgid "Can't delete working directory %s. ERR=%s\n"
+#~ msgstr "No se puede crear directorio %s: ERR=%s\n"
 
-#~ msgid "No suitable device found to read Volume \"%s\"\n"
-#~ msgstr "No encuentra dispositivo adecuado para leer Volumen \"%s\"\n"
+#, fuzzy
+#~ msgid "Unknown parameter or missing argument for %s.\n"
+#~ msgstr "Estado del Analizador %d desconocido\n"
 
-#~ msgid "Job %s canceled.\n"
-#~ msgstr "Job %s cancelado.\n"
+#, fuzzy
+#~ msgid "Unknown parameter for %s. Expecting block or file\n"
+#~ msgstr "Estado del Analizador %d desconocido\n"
 
 #, fuzzy
-#~ msgid "Read open %s device %s Volume \"%s\" failed: ERR=%s\n"
-#~ msgstr "Fallo al leer dispositivo %s abierto, Volumen \"%s\": ERR=%s\n"
+#~ msgid "Unknown parameter %s.\n"
+#~ msgstr "Estado del Analizador %d desconocido\n"
 
 #, fuzzy
-#~ msgid "Too many errors trying to mount %s device %s for reading.\n"
-#~ msgstr ""
-#~ "Demasiados errores tratando de montar el dispositivo %s para la lectura.\n"
+#~ msgid "Can't analyse plugin command line\n"
+#~ msgstr "No se puede usar comando %s en un runscript"
 
 #, fuzzy
-#~ msgid "Ready to read from volume \"%s\" on %s device %s.\n"
-#~ msgstr "Listo para leer desde volumen \"%s\" en el dispositivo %s.\n"
+#~ msgid "Unable to access guest volume\n"
+#~ msgstr "No se puede truncar el dispositivo %s. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Could not ready %s device %s for append.\n"
-#~ msgstr "Dispositivo %s puede no está listo para anexar.\n"
+#~ msgid "Unable to create temporary file %s. ERR=%s\n"
+#~ msgstr "No se puede crear el archivo bootstrap %s. ERR=%s\n"
 
-#~ msgid "Could not create JobMedia record for Volume=\"%s\" Job=%s\n"
-#~ msgstr ""
-#~ "No es posible crear el registro JobMedia para Volumen=\"%s\" Job=%s\n"
+#, fuzzy
+#~ msgid "Can't use mode=%s in MySQL plugin\n"
+#~ msgstr "No se puede unescapar cadena: ERR=%s\n"
 
-#~ msgid "Alert: %s"
-#~ msgstr "Alerta: %s"
+#, fuzzy
+#~ msgid "Unable to fdopen file %s. ERR=%s\n"
+#~ msgstr "No se puede abrir el archivo \"%s\": ERR=%s\n"
 
-#~ msgid "3997 Bad alert command: %s: ERR=%s.\n"
-#~ msgstr "3997 Malo comando alerta: %s: ERR=%s.\n"
+#, fuzzy
+#~ msgid "  Dumping database \"%s\"\n"
+#~ msgstr "No se puede abrir la base de datos \"%s\".\n"
 
-#~ msgid "Read error on device %s in ANSI label. ERR=%s\n"
-#~ msgstr "Error de lectura en el dispositivo %s en la etiqueta ANSI. ERR=%s\n"
+#, fuzzy
+#~ msgid "Unable to detect the MySQL data_directory on this system.\n"
+#~ msgstr "No se puede mknode xattr %s en el archivo \"%s\": ERR=%s\n"
 
-#~ msgid "Insane! End of tape while reading ANSI label.\n"
-#~ msgstr "Insano! Fin de la cinta mientras leía la etiqueta ANSI.\n"
+#, fuzzy
+#~ msgid "Unable to determine the last binlog %s\n"
+#~ msgstr "No se puede escribir en %s\n"
 
-#~ msgid "No VOL1 label while reading ANSI/IBM label.\n"
+#, fuzzy
+#~ msgid "Can't get server configuration.\n"
+#~ msgstr "Cambio del archivo de configuración"
+
+#, fuzzy
+#~ msgid "Unable to get the BINLOG list.\n"
+#~ msgstr "No se puede crear hilo. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to determine the last LSN for %s (Previous job is %s)\n"
+#~ msgstr "No se puede escribir en %s\n"
+
+#, fuzzy
+#~ msgid "Unable to detect datadir from MySQL\n"
+#~ msgstr "No se puede crear hilo. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to get last LSN from the backup\n"
+#~ msgstr "No se puede obtener el registro Job para JobId=%s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "The current LSN is %s\n"
+#~ msgstr "Pool actual es: %s\n"
+
+#, fuzzy
+#~ msgid "Restoring target database \"%s\"\n"
+#~ msgstr "No se puede abrir la base de datos \"%s\".\n"
+
+#, fuzzy
+#~ msgid "Creating target database \"%s\"\n"
+#~ msgstr "No se puede abrir la base de datos \"%s\".\n"
+
+#, fuzzy
+#~ msgid "Database \"%s\" already exists. Skipping creation.\n"
+#~ msgstr "No existe base de datos %s, por favor crearla.\n"
+
+#, fuzzy
+#~ msgid "Unable to parse or to use plugin options, %s\n"
+#~ msgstr "No se puede abrir xattr %s en \"%s\": ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unknown parameter or bad argument for %s.\n"
+#~ msgstr "Estado del Analizador %d desconocido\n"
+
+#, fuzzy
+#~ msgid "Can't use mode=%s in postgresql plugin\n"
+#~ msgstr "No se puede unescapar cadena: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Can't use service=%s in postgresql plugin ERR=%s\n"
+#~ msgstr "No se puede unescapar cadena: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Can't get cluster configuration.\n"
+#~ msgstr "Cambio del archivo de configuración"
+
+#, fuzzy
+#~ msgid "Can't determine the last WAL file\n"
+#~ msgstr "No se puede escribir en %s\n"
+
+#, fuzzy
+#~ msgid "Can't determine WAL directory\n"
+#~ msgstr "No se puede crear directorio %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Can't open WAL directory %s. ERR=%s\n"
+#~ msgstr "No se puede crear directorio %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to detect the PostgreSQL data_directory on this system.\n"
+#~ msgstr "No se puede mknode xattr %s en el archivo \"%s\": ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to find data_directory=%s on this system. ERR=%s\n"
+#~ msgstr "No se puede mknode xattr %s en el archivo \"%s\": ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to start the PITR backup on this system.\n"
+#~ msgstr "No se puede mknode xattr %s en el archivo \"%s\": ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to determine the first WAL file on this system.\n"
+#~ msgstr "No se puede mknode xattr %s en el archivo \"%s\": ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to analyse tablespaces %s on this system. ERR=%s\n"
+#~ msgstr "No se puede abrir espacio xattr %s en el archivo \"%s\": ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to analyse data_directory %s on this system. ERR=%s\n"
+#~ msgstr "No se puede abrir xattr %s en el archivo \"%s\": ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Can't create the %s file for recovery. ERR=%s\n"
+#~ msgstr "No es posible crear registro media. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "3612 JobId=%u waiting because device %s is reserved by: %s.\n"
+#~ msgstr ""
+#~ "3605 JobId=%u requiere la unidad disponible, pero el dispositivo %s está "
+#~ "ocupado.\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "3998 Bad return from storage \"%s\" command: ERR=%s.\n"
+#~ "Results=%s\n"
+#~ msgstr ""
+#~ "3991 Malo comando auto-cambiador comando \"cargar? unidad %d\": ERR=%s\n"
+#~ "Resultados=%s\n"
+
+#~ msgid "Acquire read: num_writers=%d not zero. Job %d canceled.\n"
+#~ msgstr "Adquirir leer: num_writers=%d no es cero. Empleo %d cancelado.\n"
+
+#~ msgid "No volumes specified for reading. Job %s canceled.\n"
+#~ msgstr "No se especifica el volumen de lectura. Job %s cancelado.\n"
+
+#~ msgid "Logic error: no next volume to read. Numvol=%d Curvol=%d\n"
+#~ msgstr ""
+#~ "Error logico: no hay prójimo volumen para leer. Numvol=%d Curvol=%d\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "Changing read device. Want Media Type=\"%s\" have=\"%s\"\n"
+#~ "  %s device=%s\n"
+#~ msgstr ""
+#~ "Cambiando dispositivo de lectura. Media Type=\"%s\" tiene=\"%s\"\n"
+#~ " dispositivo=%s\n"
+
+#, fuzzy
+#~ msgid "Media Type change.  New read %s device %s chosen.\n"
+#~ msgstr "Cambio Media Type. Nuevo dispositivo de lectura %s elegido.\n"
+
+#~ msgid "No suitable device found to read Volume \"%s\"\n"
+#~ msgstr "No encuentra dispositivo adecuado para leer Volumen \"%s\"\n"
+
+#~ msgid "Job %s canceled.\n"
+#~ msgstr "Job %s cancelado.\n"
+
+#, fuzzy
+#~ msgid "Read open %s device %s Volume \"%s\" failed: ERR=%s\n"
+#~ msgstr "Fallo al leer dispositivo %s abierto, Volumen \"%s\": ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Too many errors trying to mount %s device %s for reading.\n"
+#~ msgstr ""
+#~ "Demasiados errores tratando de montar el dispositivo %s para la lectura.\n"
+
+#, fuzzy
+#~ msgid "Ready to read from volume \"%s\" on %s device %s.\n"
+#~ msgstr "Listo para leer desde volumen \"%s\" en el dispositivo %s.\n"
+
+#, fuzzy
+#~ msgid "Could not ready %s device %s for append.\n"
+#~ msgstr "Dispositivo %s puede no está listo para anexar.\n"
+
+#~ msgid "Could not create JobMedia record for Volume=\"%s\" Job=%s\n"
+#~ msgstr ""
+#~ "No es posible crear el registro JobMedia para Volumen=\"%s\" Job=%s\n"
+
+#~ msgid "Alert: %s"
+#~ msgstr "Alerta: %s"
+
+#~ msgid "3997 Bad alert command: %s: ERR=%s.\n"
+#~ msgstr "3997 Malo comando alerta: %s: ERR=%s.\n"
+
+#~ msgid "Could not initialize %s\n"
+#~ msgstr "No se puede iniciar %s\n"
+
+#, fuzzy
+#~ msgid "Error closing device %s. ERR=%s.\n"
+#~ msgstr "Error leyendo archivo %s: ERR=%s\n"
+
+#~ msgid "No FreeSpace command defined.\n"
+#~ msgstr "Comando FreeSpace no definido.\n"
+
+#~ msgid "Cannot run free space command. Results=%s ERR=%s\n"
+#~ msgstr ""
+#~ "No se puede ejecutar comando de espacio libre. Resultados=%s ERR=%s\n"
+
+#~ msgid "Sanity check failed. maxlen=%d datalen=%d. Block discarded.\n"
+#~ msgstr ""
+#~ "Chequeo de Sanidad fracasado. maxlen=%d datalen=%d. Bloque descartado.\n"
+
+#~ msgid "Read error on device %s in ANSI label. ERR=%s\n"
+#~ msgstr "Error de lectura en el dispositivo %s en la etiqueta ANSI. ERR=%s\n"
+
+#~ msgid "Insane! End of tape while reading ANSI label.\n"
+#~ msgstr "Insano! Fin de la cinta mientras leía la etiqueta ANSI.\n"
+
+#~ msgid "No VOL1 label while reading ANSI/IBM label.\n"
 #~ msgstr "Ninguna etiqueta VOL1 al leer etiqueta ANSI/IBM.\n"
 
 #~ msgid "Wanted ANSI Volume \"%s\" got \"%s\"\n"
@@ -8847,8 +9630,9 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Network error reading from FD. ERR=%s\n"
 #~ msgstr "Error al leer la red desde FD. ERR=%s\n"
 
-#~ msgid "Error writing end session label. ERR=%s\n"
-#~ msgstr "Error escribiendo etiqueta de fin de sesión. ERR=%s\n"
+#, fuzzy
+#~ msgid "DDE commit failed. ERR=%s\n"
+#~ msgstr "prctl fallido: ERR=%s\n"
 
 #~ msgid "Fatal append error on device %s: ERR=%s\n"
 #~ msgstr "Error Fatal añadiendo en el dispositivo %s: ERR=%s\n"
@@ -8856,6 +9640,13 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Set ok=FALSE after write_block_to_device.\n"
 #~ msgstr "Set ok=FALSE después de write_block_to_device.\n"
 
+#~ msgid "Error writing end session label. ERR=%s\n"
+#~ msgstr "Error escribiendo etiqueta de fin de sesión. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Set ok=FALSE after write_final_block_to_device.\n"
+#~ msgstr "Set ok=FALSE después de write_block_to_device.\n"
+
 #, fuzzy
 #~ msgid "Elapsed time=%02d:%02d:%02d, Transfer rate=%s Bytes/second\n"
 #~ msgstr ""
@@ -8943,22 +9734,10 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "pthread error in mount_volume\n"
 #~ msgstr "pthread error en mount_volume\n"
 
-#~ msgid "I only authenticate Directors, not %d\n"
-#~ msgstr "Solo autentico Directores, no %d\n"
-
-#~ msgid "Bad Hello command from Director at %s. Len=%d.\n"
-#~ msgstr "Malo comando Hello desde Director en %s. Len=%d\n"
-
-#, fuzzy
-#~ msgid ""
-#~ "Connection from unknown Director %s at %s rejected.\n"
-#~ "Please see "
-#~ msgstr "Conexión desde Director %s desconocido  en %s rechazada.\n"
-
 #, fuzzy
 #~ msgid ""
 #~ "Incorrect password given by Director.\n"
-#~ "Please see "
+#~ "For help, please see: "
 #~ msgstr "Contraseña incorrecta dada por el Director en %s.\n"
 
 #~ msgid "TLS negotiation failed with DIR at \"%s:%d\"\n"
@@ -9068,9 +9847,13 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "3996 Open bpipe failed.\n"
 #~ msgstr "3996 Fallo al abrir bpipe.\n"
 
+#~ msgid "Autochanger error: ERR=%s\n"
+#~ msgstr "Auto-cambiador error: ERR=%s\n"
+
+#, fuzzy
 #~ msgid ""
 #~ "\n"
-#~ "Version: %s (%s)\n"
+#~ "%sVersion: %s (%s)\n"
 #~ "\n"
 #~ "Usage: bcopy [-d debug_level] <input-archive> <output-archive>\n"
 #~ "       -b bootstrap      specify a bootstrap file\n"
@@ -9162,9 +9945,10 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ "Monte Volumen \"%s\" en el dispositivo %s y presione ENTER cuando esté "
 #~ "preparado:"
 
+#, fuzzy
 #~ msgid ""
 #~ "\n"
-#~ "Version: %s (%s)\n"
+#~ "%sVersion: %s (%s)\n"
 #~ "\n"
 #~ "Usage: bextract <options> <bacula-archive-device-name> <directory-to-"
 #~ "store-files>\n"
@@ -9172,9 +9956,11 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ "       -c <file>       specify a Storage configuration file\n"
 #~ "       -d <nn>         set debug level to <nn>\n"
 #~ "       -dt             print timestamp in debug output\n"
+#~ "       -T              send debug traces to trace file\n"
 #~ "       -e <file>       exclude list\n"
 #~ "       -i <file>       include list\n"
 #~ "       -p              proceed inspite of I/O errors\n"
+#~ "       -t              read data from volume, do not write anything\n"
 #~ "       -v              verbose\n"
 #~ "       -V <volumes>    specify Volume names (separated by |)\n"
 #~ "       -?              print this message\n"
@@ -9221,16 +10007,20 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "%u files restored.\n"
 #~ msgstr "%u archivos restaurados.\n"
 
+#, fuzzy
+#~ msgid "Found %s error%s\n"
+#~ msgstr "Encontrados %d para: %s\n"
+
 #~ msgid "Write error on %s: %s\n"
 #~ msgstr "Error de escritura en %s: %s\n"
 
+#~ msgid "Cannot continue.\n"
+#~ msgstr "No se puede continuar.\n"
+
 #~ msgid "Logic error output file should be open but is not.\n"
 #~ msgstr ""
 #~ "Error lógico, archivo de salida debería estar abierto, pero no esta.\n"
 
-#~ msgid "Cannot continue.\n"
-#~ msgstr "No se puede continuar.\n"
-
 #~ msgid "%s was deleted.\n"
 #~ msgstr "%s se ha eliminado.\n"
 
@@ -9248,6 +10038,10 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgstr "Obtener Nombre de Programa o Secuencia de Datos. Ignorado.\n"
 
 #, fuzzy
+#~ msgid "Error writing final JobMedia record to catalog.\n"
+#~ msgstr "Error al escribir registro al bloque.\n"
+
+#, fuzzy
 #~ msgid "Cannot write block. Device at EOM. dev=%s\n"
 #~ msgstr "No se pudo escribir bloque. Dispositivo en EOM.\n"
 
@@ -9268,6 +10062,14 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Write error at %u:%u on device %s. ERR=%s.\n"
 #~ msgstr "Error de escritura en %u:%u en el dispositivo %s. ERR=%s.\n"
 
+#, fuzzy
+#~ msgid ""
+#~ "Out of freespace caused End of Volume \"%s\" at %u:%u on device %s. Write "
+#~ "of %u bytes got %d.\n"
+#~ msgstr ""
+#~ "Fin de Volumen \"%s\" en %u:%u en el dispositivo %s. Escribió %u bytes "
+#~ "obtuvo %d.\n"
+
 #~ msgid ""
 #~ "End of Volume \"%s\" at %u:%u on device %s. Write of %u bytes got %d.\n"
 #~ msgstr ""
@@ -9292,13 +10094,20 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Block buffer size looping problem on device %s\n"
 #~ msgstr "Problema de tamaño de búfer del bloque en el dispositivo %s\n"
 
+#~ msgid "Unable to open device part=%d %s: ERR=%s\n"
+#~ msgstr "No se puede abrir el dispositivo parte =%d %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "The Volume=%s on device=%s appears to be unlabeled.\n"
+#~ msgstr "Volumen en %s tiene una malo tipo de etiqueta Bacula: %x\n"
+
 #~ msgid "Read error on fd=%d at file:blk %u:%u on device %s. ERR=%s.\n"
 #~ msgstr ""
 #~ "Error de lectura en fd=%d desde archivo:blk %u:%u en el dispositivo %s. "
 #~ "ERR=%s.\n"
 
 #, fuzzy
-#~ msgid "Read zero bytes Vol=%s at %lld on device %s.\n"
+#~ msgid "Read zero %sbytes Vol=%s at %lld on device %s.\n"
 #~ msgstr "Leer cero bytes en %u:%u en el dispositivo %s.\n"
 
 #~ msgid ""
@@ -9325,7 +10134,7 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 
 #, fuzzy
 #~ msgid ""
-#~ "Dump block %s %p: size=%d BlkNum=%d\n"
+#~ "Dump block %s %p: adata=%d size=%d BlkNum=%d\n"
 #~ "               Hdrcksum=%x cksum=%x\n"
 #~ msgstr ""
 #~ "Volcado de bloque %s %x: tamaño=%d BlkNum=%d\n"
@@ -9338,6 +10147,14 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "%d block read errors not printed.\n"
 #~ msgstr "%d errores de lectura de bloques no impresos.\n"
 
+#, fuzzy
+#~ msgid ""
+#~ "Volume data error at %lld!\n"
+#~ "Adata block checksum mismatch in block=%u len=%d: calc=%x blk=%x\n"
+#~ msgstr ""
+#~ "Error de datos de Volumen en %u:%u!\n"
+#~ "Bloque checksum desajustado en bloque=%u len=%d: calc=%x blk=%x\n"
+
 #~ msgid ""
 #~ "Volume data error at %u:%u! Wanted ID: \"%s\", got \"%s\". Buffer "
 #~ "discarded.\n"
@@ -9408,8 +10225,33 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgstr "Error al obtener Volumen información: %s"
 
 #~ msgid ""
+#~ "Error while writing, current part number is less than the total number of "
+#~ "parts (%d/%d, device=%s)\n"
+#~ msgstr ""
+#~ "Error al escribir, número de parte actual es menor que el número total de "
+#~ "partes (%d/%d, dispositivo=%s)\n"
+
+#~ msgid "Unable to open device next part %s: ERR=%s\n"
+#~ msgstr "No se puede abrir próxima parte %s del dispositivo: ERR=%s\n"
+
+#~ msgid ""
+#~ "End of Volume \"%s\" at %u:%u on device %s (part_size=%s, free_space=%s, "
+#~ "free_space_errno=%d, errmsg=%s).\n"
+#~ msgstr ""
+#~ "Fin de Volumen \"%s\" en %u:%u en el dispositivo %s (part_size=%s, "
+#~ "free_space=%s, free_space_errno=%d, errmsg=%s).\n"
+
+#~ msgid ""
+#~ "End of Volume \"%s\" at %u:%u on device %s (part_size=%s, free_space=%s, "
+#~ "free_space_errno=%d).\n"
+#~ msgstr ""
+#~ "Fin de Volumen \"%s\" en %u:%u en el dispositivo %s (part_size=%s, "
+#~ "free_space=%s, free_space_errno=%d).\n"
+
+#, fuzzy
+#~ msgid ""
 #~ "\n"
-#~ "Version: %s (%s)\n"
+#~ "%sVersion: %s (%s)\n"
 #~ "\n"
 #~ "Usage: bls [options] <device-name>\n"
 #~ "       -b <file>       specify a bootstrap file\n"
@@ -9425,6 +10267,7 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ "       -p              proceed inspite of errors\n"
 #~ "       -v              be verbose\n"
 #~ "       -V              specify Volume names (separated by |)\n"
+#~ "       -E              Check records to detect errors\n"
 #~ "       -?              print this message\n"
 #~ "\n"
 #~ msgstr ""
@@ -9490,9 +10333,10 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "End of object"
 #~ msgstr "Fin de la Cinta"
 
+#, fuzzy
 #~ msgid ""
 #~ "\n"
-#~ "Version: %s (%s)\n"
+#~ "%sVersion: %s (%s)\n"
 #~ "\n"
 #~ "Usage: bscan [ options ] <bacula-archive>\n"
 #~ "       -b bootstrap      specify a bootstrap file\n"
@@ -9553,9 +10397,6 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "First Volume Size = %s\n"
 #~ msgstr "Tamaño Primero Volumen = %s\n"
 
-#~ msgid "Could not init Bacula database\n"
-#~ msgstr "No se pudo iniciar base de datos de Bacula\n"
-
 #~ msgid "Using Database: %s, User: %s\n"
 #~ msgstr "Usando Base de Datos: %s, Usuario: %s\n"
 
@@ -9765,10 +10606,78 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Updated MD5/SHA1 record\n"
 #~ msgstr "Actualizado registro MD5/SHA1\n"
 
+#, fuzzy
+#~ msgid ""
+#~ "\n"
+#~ "%sVersion: %s (%s)\n"
+#~ "\n"
+#~ "Usage: bsdjson [options] [-c config_file] [config_file]\n"
+#~ "        -r <res>    get resource type <res>\n"
+#~ "        -n <name>   get resource <name>\n"
+#~ "        -l <dirs>   get only directives matching dirs (use with -r)\n"
+#~ "        -D          get only data\n"
+#~ "        -c <file>   use <file> as configuration file\n"
+#~ "        -d <nn>     set debug level to <nn>\n"
+#~ "        -dt         print timestamp in debug output\n"
+#~ "        -t          test - read config and exit\n"
+#~ "        -v          verbose user messages\n"
+#~ "        -?          print this message.\n"
+#~ "\n"
+#~ msgstr ""
+#~ "\n"
+#~ "Versión: %s (%s)\n"
+#~ "\n"
+#~ "Utilice: stored [opciones] [-c archivo_configuración] "
+#~ "[archivo_configuración]\n"
+#~ " -c <archivo> usar <archivo> como archivo de configuración\n"
+#~ " -d <nn> establecer el nivel de depuración para <nn>\n"
+#~ " -dt imprimir timestamp en salida de depuración\n"
+#~ " -f ejecutar en primer plano (para depuración)\n"
+#~ " -g <grupo> establecer groupid para grupo\n"
+#~ " -m imprimir salida kaboom para depuración)\n"
+#~ " -p continuar a pesar de errores de E/S\n"
+#~ " -s sin señales (para depuración)\n"
+#~ " -t prueba - leer la configuración y salir\n"
+#~ " -u <usuario> establecer userid para <usuario>\n"
+#~ " -v mensajes de usuario detallados\n"
+#~ " -? imprimir este mensaje.\n"
+#~ "\n"
+
+#~ msgid "No Storage resource defined in %s. Cannot continue.\n"
+#~ msgstr "Recurso Storage no definido en %s. No se puede continuar.\n"
+
+#~ msgid "Only one Storage resource permitted in %s\n"
+#~ msgstr "Sólo un recurso Storage permitido en %s\n"
+
+#~ msgid "No Director resource defined in %s. Cannot continue.\n"
+#~ msgstr "Recurso Director no definido en %s. No se puede continuar.\n"
+
+#~ msgid "No Device resource defined in %s. Cannot continue.\n"
+#~ msgstr "Recurso Device no definido en %s. No se puede continuar.\n"
+
+#~ msgid "No Messages resource defined in %s. Cannot continue.\n"
+#~ msgstr "Recurso Mensajes no definido en %s. No se puede continuar.\n"
+
+#~ msgid "\"TLS Certificate\" file not defined for Storage \"%s\" in %s.\n"
+#~ msgstr ""
+#~ "Archivo \"TLS Certificate\" no definido para Storage \"%s\" en %s.\n"
+
+#~ msgid "\"TLS Key\" file not defined for Storage \"%s\" in %s.\n"
+#~ msgstr "Archivo \"TLS Key\" no definido para Storage \"%s\" en %s.\n"
+
+#~ msgid ""
+#~ "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined "
+#~ "for Storage \"%s\" in %s. At least one CA certificate store is required "
+#~ "when using \"TLS Verify Peer\".\n"
+#~ msgstr ""
+#~ "Ni \"Certificado TLS CA \" o \"Directorio del Certificado TLS CA\" están "
+#~ "definidos para el Storage \"%s\" en %s. Por lo menos un almacén de "
+#~ "Certificados CA es necesario cuando se utiliza \"Verificar TLS Peer\".\n"
+
 #~ msgid "Tape block size (%d) not multiple of system size (%d)\n"
 #~ msgstr ""
-#~ "Tamaño de bloque de cinta (%d) no es múltiplo del tamaño de sistema "
-#~ "(% d)\n"
+#~ "Tamaño de bloque de cinta (%d) no es múltiplo del tamaño de sistema (% "
+#~ "d)\n"
 
 #~ msgid "Tape block size (%d) is not a power of 2\n"
 #~ msgstr "Tamaño de bloque de cinta (%d) no es una potencia de 2\n"
@@ -11026,9 +11935,10 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Interactive commands:\n"
 #~ msgstr "Comandos interactivos:\n"
 
+#, fuzzy
 #~ msgid ""
 #~ "\n"
-#~ "Version: %s (%s)\n"
+#~ "%sVersion: %s (%s)\n"
 #~ "\n"
 #~ "Usage: btape <options> <device_name>\n"
 #~ "       -b <file>   specify bootstrap file\n"
@@ -11089,9 +11999,6 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "cont,"
 #~ msgstr "cont,"
 
-#~ msgid "No Storage resource defined in %s. Cannot continue.\n"
-#~ msgstr "Recurso Storage no definido en %s. No se puede continuar.\n"
-
 #~ msgid "Volume name or names is too long. Please use a .bsr file.\n"
 #~ msgstr ""
 #~ "Nombre de Volumen o nombres es demasiado largo. Por favor, use un "
@@ -11134,6 +12041,46 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Unexpected Tape is Off-line\n"
 #~ msgstr "Inesperado Cinta esta off-line\n"
 
+#, fuzzy
+#~ msgid "Dedupengine status:\n"
+#~ msgstr "Estado del Dispositivo:\n"
+
+#, fuzzy
+#~ msgid "Initializing DDE."
+#~ msgstr "Inicializando ..."
+
+#, fuzzy
+#~ msgid "Cannot create DedupDirectory: %s"
+#~ msgstr "No se puede crear directorio %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Cannot create DedupIndexDirectory: %s"
+#~ msgstr "No se puede crear directorio %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Cannot create recovery directory: %s"
+#~ msgstr "No se puede crear directorio %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Cannot delete temporary recovery directory: %s"
+#~ msgstr "No se puede restablecer el directorio actual: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Socket error or stop during rehydration. ERR=%d\n"
+#~ msgstr "Error de Socket en comando %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unexpected message from FD, n=%d msglen=%d msg=%s\n"
+#~ msgstr "Error al leer datos de cabecera de FD. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Ignore unknown inter-daemon command: %ld\n"
+#~ msgstr "Código de ítem desconocido: %d\n"
+
+#, fuzzy
+#~ msgid "Error sending chunk request to client\n"
+#~ msgstr "Error escribiendo encabezado para archivo de cola. ERR=%s\n"
+
 #~ msgid "Unable to stat device %s: ERR=%s\n"
 #~ msgstr "No se puede stat dispositivo %s: ERR=%s\n"
 
@@ -11144,6 +12091,15 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ "%s es un tipo de dispositivo desconocido. Debe ser cinta o directorio\n"
 #~ " o tener RequiresMount=yes para DVD. st_mode=%x\n"
 
+#, fuzzy
+#~ msgid "Deduplication device not properly configured.\n"
+#~ msgstr ""
+#~ "Dispositivos de lectura y escritura no se han iniciado correctamente.\n"
+
+#, fuzzy
+#~ msgid "Using default block size %u on dedup device %s\n"
+#~ msgstr "Mínimo tamaño de bloque > máximo en el dispositivo %s\n"
+
 #~ msgid "Unable to stat mount point %s: ERR=%s\n"
 #~ msgstr "No se puede stat punto de montaje %s: ERR=%s\n"
 
@@ -11189,6 +12145,10 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgstr "No se puede iniciar mutex: ERR=%s\n"
 
 #, fuzzy
+#~ msgid "Unable to init adata mutex: ERR=%s\n"
+#~ msgstr "No se puede iniciar mutex: ERR=%s\n"
+
+#, fuzzy
 #~ msgid "Unable to init volcat mutex: ERR=%s\n"
 #~ msgstr "No se puede iniciar mutex: ERR=%s\n"
 
@@ -11234,8 +12194,8 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Connection request from %s failed.\n"
 #~ msgstr "Fallo solicitud de conexión desde %s.\n"
 
-#~ msgid "Invalid connection from %s. Len=%d\n"
-#~ msgstr "Inválida conexión desde %s. Len=%d\n"
+#~ msgid "Unable to authenticate Director\n"
+#~ msgstr "No se puede autentificar el Director\n"
 
 #, fuzzy
 #~ msgid "Bad client command: %s"
@@ -11252,6 +12212,10 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "3991 Bad setdebug command: %s\n"
 #~ msgstr "3991 Malo comando setdebug: %s\n"
 
+#, fuzzy
+#~ msgid "3000 Deduplication vacuum marked to be canceled.\n"
+#~ msgstr "3000 Job %s marcados para ser cancelados.\n"
+
 #~ msgid "3903 Error scanning cancel command.\n"
 #~ msgstr "3903 Error escaneando comando cancel.\n"
 
@@ -11381,6 +12345,22 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgstr "3909 Error escaneando comando mount: %s\n"
 
 #, fuzzy
+#~ msgid "3002 Device \"%s\" enabled.\n"
+#~ msgstr "3022 Dispositivo %s liberado.\n"
+
+#, fuzzy
+#~ msgid "3907 Error scanning \"enable\" command: %s\n"
+#~ msgstr "3903 Error escaneando comando cancel: %s\n"
+
+#, fuzzy
+#~ msgid "3002 Device \"%s\" disabled.\n"
+#~ msgstr "3002 Dispositivo %s está montado.\n"
+
+#, fuzzy
+#~ msgid "3907 Error scanning \"disable\" command: %s\n"
+#~ msgstr "3903 Error escaneando comando cancel: %s\n"
+
+#, fuzzy
 #~ msgid "3002 Device \"%s\" unmounted.\n"
 #~ msgstr "3002 Dispositivo %s desmontado.\n"
 
@@ -11440,7 +12420,7 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgstr "3995 Dispositivo %s no es un auto-cargador.\n"
 
 #, fuzzy
-#~ msgid "3908 Error scanning autochanger drives/list/slots command: %s\n"
+#~ msgid "3909 Error scanning autochanger drives/list/slots command: %s\n"
 #~ msgstr ""
 #~ "3908 Error comando scanning auto-cambiador drives/list/ranuras: %s\n"
 
@@ -11487,6 +12467,40 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgstr "3937 Dispositivo %s está ocupado con %d escritura(s).\n"
 
 #, fuzzy
+#~ msgid ""
+#~ "3999 Device \"%s\" requested by DIR could not be locked for shared "
+#~ "storage.\n"
+#~ msgstr ""
+#~ "\n"
+#~ "Dispositivo \"%s\" solicitado por el DIR no se pudo abrir o no existe.\n"
+
+#~ msgid "Error writing part %d to the DVD: ERR=%s\n"
+#~ msgstr "Error escribiendo parte %d en el DVD: ERR=%s\n"
+
+#~ msgid "Error while writing current part to the DVD: %s"
+#~ msgstr "Error al escribir parte actual al DVD: %s"
+
+#~ msgid "Part %d (%lld bytes) written to DVD.\n"
+#~ msgstr "Parte %d (%lld bytes) escrito al DVD.\n"
+
+#~ msgid "Remaining free space %s on %s\n"
+#~ msgstr "Espacio libre restante %s en %s\n"
+
+#~ msgid "Next Volume part already exists on DVD. Cannot continue: %s\n"
+#~ msgstr ""
+#~ "Siguiente parte del volumen ya existe en DVD. No se puede continuar: %s\n"
+
+#~ msgid ""
+#~ "Error writing. Current part less than total number of parts (%d/%d, "
+#~ "device=%s)\n"
+#~ msgstr ""
+#~ "Error al escribir. Parte actual menor que número total de partes (%d/%d, "
+#~ "dispositivo=%s)\n"
+
+#~ msgid "Unable to write last on %s: ERR=%s\n"
+#~ msgstr "No se puede escribir última en %s: ERR=%s\n"
+
+#, fuzzy
 #~ msgid "Command error with FD, hanging up. ERR=%s\n"
 #~ msgstr "Error de comando con FD, colgando. %s\n"
 
@@ -11508,8 +12522,13 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Attempt to read on non-open session.\n"
 #~ msgstr "Intento de leer sesión no abierta.\n"
 
-#~ msgid "Attempt to open read on non-open session.\n"
-#~ msgstr "Intento de abrir leer sesión no abierta.\n"
+#, fuzzy
+#~ msgid "Attempt to open an already open session.\n"
+#~ msgstr "Intento de abrir sesión ya abierta.\n"
+
+#, fuzzy
+#~ msgid "Cannot open session, received bad parameters.\n"
+#~ msgstr "No se puede abrir recursos fork para %s.\n"
 
 #~ msgid "Bad call to reposition. Device not open\n"
 #~ msgstr "Mala llamada a reposición. El dispositivo no abre\n"
@@ -11523,6 +12542,10 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Could not open(%s,%s,0640): ERR=%s\n"
 #~ msgstr "No se pudo abrir %s: ERR=%s\n"
 
+#, fuzzy
+#~ msgid "Could not open aligned volume: %s, ERR=%s\n"
+#~ msgstr "No se pudo abrir archivo incluir: %s, ERR=%s\n"
+
 #~ msgid "Unable to truncate device %s. ERR=%s\n"
 #~ msgstr "No se puede truncar el dispositivo %s. ERR=%s\n"
 
@@ -11539,25 +12562,52 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgstr "Dispositivo %s no puede ser %smounted. ERR=%s\n"
 
 #, fuzzy
+#~ msgid ""
+#~ "Connection from unknown Director %s at %s rejected.\n"
+#~ "Please see "
+#~ msgstr "Conexión desde Director %s desconocido  en %s rechazada.\n"
+
+#~ msgid "Invalid connection from %s. Len=%d\n"
+#~ msgstr "Inválida conexión desde %s. Len=%d\n"
+
+#, fuzzy
+#~ msgid "Invalid Hello from %s. Len=%d\n"
+#~ msgstr "Inválida conexión desde %s. Len=%d\n"
+
+#, fuzzy
+#~ msgid "Client connect failed: Job name not found: %s\n"
+#~ msgstr "Fallo al conectar a FD: Nombre del Job no encontrado: %s\n"
+
+#~ msgid "Unable to authenticate File daemon\n"
+#~ msgstr "No se puede autenticar demonio File\n"
+
+#, fuzzy
 #~ msgid "Client socket not open. Could not connect to Client.\n"
 #~ msgstr "Fallo al conectar con el cliente.\n"
 
 #, fuzzy
 #~ msgid "Recv request to Client failed. ERR=%s\n"
-#~ msgstr "Fallo solicitud de conexión desde %s.\n"
+#~ msgstr "Fallo al abrir dispositivo. ERR=%s\n"
 
 #, fuzzy
 #~ msgid "Bad Hello from Client: %s.\n"
 #~ msgstr "Malo comando Hello desde Director en %s: %s\n"
 
-#~ msgid "Unable to authenticate File daemon\n"
-#~ msgstr "No se puede autenticar demonio File\n"
+#, fuzzy
+#~ msgid "Send caps to Client failed. ERR=%s\n"
+#~ msgstr "Fallo al abrir dispositivo. ERR=%s\n"
 
-#~ msgid "FD connect failed: Job name not found: %s\n"
-#~ msgstr "Fallo al conectar a FD: Nombre del Job no encontrado: %s\n"
+#, fuzzy
+#~ msgid "Recv caps from Client failed. ERR=%s\n"
+#~ msgstr "Fallo al abrir dispositivo. ERR=%s\n"
 
-#~ msgid "Hey!!!! JobId %u Job %s already authenticated.\n"
-#~ msgstr "Hey!!!! JobId %u Job %s ya autenticada.\n"
+#, fuzzy
+#~ msgid "Recv bad caps from Client: %s.\n"
+#~ msgstr "Malo comando Hello desde Director en %s: %s\n"
+
+#, fuzzy
+#~ msgid "Recv bad caps from Client %s\n"
+#~ msgstr "Malo comando Hello desde Director en %s: %s\n"
 
 #~ msgid "In free_jcr(), but still attached to device!!!!\n"
 #~ msgstr "En free_jcr(), pero todavía conectado al dispositivo!!!!\n"
@@ -11601,6 +12651,22 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgstr "Volumen en %s tiene una malo tipo de etiqueta Bacula: %x\n"
 
 #, fuzzy
+#~ msgid ""
+#~ "Got Aligned or File type Volume %s on Dedup device %s. Wanted File.\n"
+#~ msgstr "Etiquetada nuevo Volumen \"%s\" en el dispositivo %s.\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "Got Aligned or Dedup type Volume %s on File device %s. Wanted File.\n"
+#~ msgstr "Etiquetada nuevo Volumen \"%s\" en el dispositivo %s.\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "Got File or Dedup type Volume %s on Aligned device %s. Wanted Aligned.\n"
+#~ msgstr ""
+#~ "Escribió etiqueta de volumen  \"%s\" pre-etiquetada en el dispositivo %s\n"
+
+#, fuzzy
 #~ msgid "Could not reserve volume %s on %s device %s\n"
 #~ msgstr "No es posible reservar volumen %s en %s\n"
 
@@ -11653,9 +12719,11 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Unknown %d"
 #~ msgstr "Desconocido %d"
 
+#, fuzzy
 #~ msgid ""
 #~ "\n"
 #~ "Volume Label:\n"
+#~ "Adata             : %d\n"
 #~ "Id                : %sVerNo             : %d\n"
 #~ "VolName           : %s\n"
 #~ "PrevVolName       : %s\n"
@@ -11795,7 +12863,7 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ "No se puede posicionar al final los datos en el dispositivo %s: ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Volume \"%s\" not on %s device %s.\n"
+#~ msgid "Volume \"%s\" not loaded on %s device %s.\n"
 #~ msgstr "Volumen \"%s\" no en dispositivo %s.\n"
 
 #~ msgid ""
@@ -11840,13 +12908,27 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ "Bacula no puede escribir en el Volumen de cinta \"%s\" porque:\n"
 #~ "El número de archivos de desfasa! Volumen=%u Catalogo=%u\n"
 
+#, fuzzy
+#~ msgid ""
+#~ "Ready to append to end of Volumes \"%s\" ameta size=%s adata size=%s\n"
+#~ msgstr "Listo para anexar al final del Volumen \"%s\" parte=%d tamaño=%s\n"
+
 #~ msgid "Ready to append to end of Volume \"%s\" size=%s\n"
 #~ msgstr "Listo para anexar al final del volumen \"%s\" tamaño=%s\n"
 
 #, fuzzy
 #~ msgid ""
 #~ "For Volume \"%s\":\n"
-#~ "   The sizes do not match! Volume=%s Catalog=%s\n"
+#~ "   The sizes do not match! Metadata Volume=%s Catalog=%s\n"
+#~ "   Correcting Catalog\n"
+#~ msgstr ""
+#~ "Bacula no puedo escribir en el volumen DVD \"%s\" porque: Los tamaños no "
+#~ "coinciden! Volumen=%s Catálogo=%s\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "For aligned Volume \"%s\":\n"
+#~ "   Aligned sizes do not match! Aligned Volume=%s Catalog=%s\n"
 #~ "   Correcting Catalog\n"
 #~ msgstr ""
 #~ "Bacula no puedo escribir en el volumen DVD \"%s\" porque: Los tamaños no "
@@ -12019,12 +13101,20 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid ">filed: Error Hdr=%s\n"
 #~ msgstr ">filed: Error Hdr=%s\n"
 
-#~ msgid "Error sending to File daemon. ERR=%s\n"
-#~ msgstr "Error enviando para demonio File. ERR=%s\n"
+#, fuzzy
+#~ msgid "Error sending header to Client. ERR=%s\n"
+#~ msgstr "Error escribiendo encabezado para archivo de cola. ERR=%s\n"
 
 #~ msgid "Error sending to FD. ERR=%s\n"
 #~ msgstr "Error enviando para FD. ERR=%s\n"
 
+#, fuzzy
+#~ msgid "Error sending data to Client. ERR=%s\n"
+#~ msgstr "Error enviando para FD. ERR=%s\n"
+
+#~ msgid "Error sending to File daemon. ERR=%s\n"
+#~ msgstr "Error enviando para demonio File. ERR=%s\n"
+
 #~ msgid "End of Volume at file %u on device %s, Volume \"%s\"\n"
 #~ msgstr "Fin del Volumen en archivo %u en dispositivo %s, Volumen \"%s\"\n"
 
@@ -12050,13 +13140,6 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "unknown: %d"
 #~ msgstr "desconocido: %d"
 
-#~ msgid "Damaged buffer\n"
-#~ msgstr "Buffer dañado\n"
-
-#~ msgid "Sanity check failed. maxlen=%d datalen=%d. Block discarded.\n"
-#~ msgstr ""
-#~ "Chequeo de Sanidad fracasado. maxlen=%d datalen=%d. Bloque descartado.\n"
-
 #~ msgid "Unable to initialize reservation lock. ERR=%s\n"
 #~ msgstr "No se puede inicializar bloqueo de reserva. ERR=%s\n"
 
@@ -12072,13 +13155,21 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Failed command: %s\n"
 #~ msgstr "Comando fallido: %s\n"
 
-#~ msgid "3926 Could not get dcr for device: %s\n"
-#~ msgstr "3926 No se pudo obtener dcr para el dispositivo: %s\n"
-
 #, fuzzy
-#~ msgid "3603 JobId=%u %s device %s is busy reading.\n"
-#~ msgstr "3603 JobId=%u dispositivo %s está ocupado leyendo.\n"
-
+#~ msgid ""
+#~ "\n"
+#~ "     Device \"%s\" requested by DIR is disabled.\n"
+#~ msgstr ""
+#~ "\n"
+#~ "Dispositivo \"%s\" solicitado por el DIR no se pudo abrir o no existe.\n"
+
+#~ msgid "3926 Could not get dcr for device: %s\n"
+#~ msgstr "3926 No se pudo obtener dcr para el dispositivo: %s\n"
+
+#, fuzzy
+#~ msgid "3603 JobId=%u %s device %s is busy reading.\n"
+#~ msgstr "3603 JobId=%u dispositivo %s está ocupado leyendo.\n"
+
 #, fuzzy
 #~ msgid "3604 JobId=%u %s device %s is BLOCKED due to user unmount.\n"
 #~ msgstr ""
@@ -12104,6 +13195,12 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ "3609 JobId=%u Máximo trabajos simultáneos superado en la unidad %s.\n"
 
 #, fuzzy
+#~ msgid ""
+#~ "3610 JobId=%u Aligned volume max bytes does not allow concurrency on "
+#~ "drive %s.\n"
+#~ msgstr "3610 JobId=%u máximo volumen jobs excedido en la unidad %s.\n"
+
+#, fuzzy
 #~ msgid "3611 JobId=%u Volume max jobs=%d exceeded on %s device %s.\n"
 #~ msgstr "3610 JobId=%u máximo volumen jobs excedido en la unidad %s.\n"
 
@@ -12258,6 +13355,10 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Fseek on attributes file failed: ERR=%s\n"
 #~ msgstr "Fallo fseek en los atributos de archivo: ERR=%s\n"
 
+#, fuzzy
+#~ msgid "Truncate on attributes file failed: ERR=%s\n"
+#~ msgstr "Fallo fseek en los atributos de archivo: ERR=%s\n"
+
 #~ msgid "Sending spooled attrs to the Director. Despooling %s bytes ...\n"
 #~ msgstr "Enviando attrs encolados al Director. Desencolando %s bytes ...\n"
 
@@ -12267,20 +13368,20 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Used Volume status:\n"
 #~ msgstr "Estado de Volumen Usados:\n"
 
+#, fuzzy
+#~ msgid "3900 missing args in .status command: %s\n"
+#~ msgstr "Comando .status malo: %s\n"
+
+#, fuzzy
 #~ msgid ""
 #~ "\n"
-#~ "Device status:\n"
-#~ msgstr ""
-#~ "\n"
-#~ "Estado del dispositivo:\n"
-
-#~ msgid "Autochanger \"%s\" with devices:\n"
-#~ msgstr "Auto-cambiador \"%s\" con los dispositivos:\n"
+#~ "Device \"%s\" is not open or does not exist.\n"
+#~ msgstr "Dispositivo \"%s\" no está abierto o no existe.\n"
 
 #, fuzzy
 #~ msgid ""
 #~ "\n"
-#~ "Device %s is %s:\n"
+#~ "Device %s is %s %s:\n"
 #~ "    Volume:      %s\n"
 #~ "    Pool:        %s\n"
 #~ "    Media type:  %s\n"
@@ -12301,7 +13402,7 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #, fuzzy
 #~ msgid ""
 #~ "\n"
-#~ "Device %s open but no Bacula volume is currently mounted.\n"
+#~ "Device %s: %s open but no Bacula volume is currently mounted.\n"
 #~ msgstr "Dispositivo %s abierto, pero volumen actual montado no es Bacula.\n"
 
 #~ msgid "    Total Bytes=%s Blocks=%s Bytes/block=%s\n"
@@ -12316,14 +13417,22 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #, fuzzy
 #~ msgid ""
 #~ "\n"
-#~ "Device %s is not open.\n"
+#~ "Device %s: %s is not open.\n"
 #~ msgstr "Dispositivo %s no está abierto.\n"
 
 #, fuzzy
+#~ msgid "    Available Space=%sB\n"
+#~ msgstr "Archivos examinados=%s\n"
+
+#~ msgid "Autochanger \"%s\" with devices:\n"
+#~ msgstr "Auto-cambiador \"%s\" con los dispositivos:\n"
+
 #~ msgid ""
 #~ "\n"
-#~ "Device \"%s\" is not open or does not exist.\n"
-#~ msgstr "Dispositivo \"%s\" no está abierto o no existe.\n"
+#~ "Device status:\n"
+#~ msgstr ""
+#~ "\n"
+#~ "Estado del dispositivo:\n"
 
 #, fuzzy
 #~ msgid "Daemon started %s. Jobs: run=%d, running=%d.\n"
@@ -12336,6 +13445,14 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ "Ninguna estructura del DISPOSITIVO.\n"
 #~ "\n"
 
+#, fuzzy
+#~ msgid "    Device is BLOCKED by another SD=%s\n"
+#~ msgstr "Dispositivo está BLOQUEADO. Usuario desmontado.\n"
+
+#, fuzzy
+#~ msgid "    Device is disabled. User command.\n"
+#~ msgstr "Dispositivo está BLOQUEADO. Usuario desmontado.\n"
+
 #~ msgid "    Device is BLOCKED. User unmounted.\n"
 #~ msgstr "Dispositivo está BLOQUEADO. Usuario desmontado.\n"
 
@@ -12382,13 +13499,13 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgstr "Estado del dispositivo:\n"
 
 #, fuzzy
-#~ msgid "  num_writers=%d reserves=%d block=%d\n"
+#~ msgid "  num_writers=%d reserves=%d block=%d enabled=%d\n"
 #~ msgstr ""
 #~ "num_writers=%d reservado=%d bloque=%d\n"
 #~ "\n"
 
 #, fuzzy
-#~ msgid "Attached JobsIds: "
+#~ msgid "Attached JobIds: "
 #~ msgstr ""
 #~ "\n"
 #~ "Scheduled Jobs:\n"
@@ -12427,7 +13544,7 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 
 #, fuzzy
 #~ msgid "    Files=%s Bytes=%s AveBytes/sec=%s LastBytes/sec=%s\n"
-#~ msgstr "Archivos=%s Bytes=%s Bytes/sec=%s Errores=%d\n"
+#~ msgstr "Archivos=%s Bytes=%s Bytes/sec=%s\n"
 
 #~ msgid "    FDReadSeqNo=%s in_msg=%u out_msg=%d fd=%d\n"
 #~ msgstr " FDReadSeqNo=%s in_msg=%u out_msg=%d fd=%d\n"
@@ -12450,39 +13567,24 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "3900 Unknown arg in .status command: %s\n"
 #~ msgstr "Comando .status malo: %s\n"
 
-#~ msgid "Bacula Storage: Idle"
-#~ msgstr "Bacula Storage: Libre"
-
-#~ msgid "Bacula Storage: Running"
-#~ msgstr "Bacula Storage: Ejecutando"
-
-#~ msgid "Bacula Storage: Last Job Canceled"
-#~ msgstr "Bacula Storage: Último Job Cancelado"
-
-#~ msgid "Bacula Storage: Last Job Failed"
-#~ msgstr "Bacula Storage: Último Job Fallido"
-
-#~ msgid "Bacula Storage: Last Job had Warnings"
-#~ msgstr "Bacula Storage: Último Job con Advertencias"
-
 #, fuzzy
 #~ msgid ""
 #~ "\n"
-#~ "Version: %s (%s)\n"
+#~ "%sVersion: %s (%s)\n"
 #~ "\n"
 #~ "Usage: bacula-sd [options] [-c config_file] [config_file]\n"
-#~ "        -c <file>   use <file> as configuration file\n"
-#~ "        -d <nn>     set debug level to <nn>\n"
-#~ "        -dt         print timestamp in debug output\n"
-#~ "        -f          run in foreground (for debugging)\n"
-#~ "        -g <group>  set groupid to group\n"
-#~ "        -m          print kaboom output (for debugging)\n"
-#~ "        -p          proceed despite I/O errors\n"
-#~ "        -s          no signals (for debugging)\n"
-#~ "        -t          test - read config and exit\n"
-#~ "        -u <user>   userid to <user>\n"
-#~ "        -v          verbose user messages\n"
-#~ "        -?          print this message.\n"
+#~ "     -c <file>         use <file> as configuration file\n"
+#~ "     -d <nn>[,<tags>]  set debug level to <nn>, debug tags to <tags>\n"
+#~ "     -dt               print timestamp in debug output\n"
+#~ "     -f                run in foreground (for debugging)\n"
+#~ "     -g <group>        set groupid to group\n"
+#~ "     -m                print kaboom output (for debugging)\n"
+#~ "     -p                proceed despite I/O errors\n"
+#~ "     -s                no signals (for debugging)\n"
+#~ "     -t                test - read config and exit\n"
+#~ "     -u <user>         userid to <user>\n"
+#~ "     -v                verbose user messages\n"
+#~ "     -?                print this message.\n"
 #~ "\n"
 #~ msgstr ""
 #~ "\n"
@@ -12510,36 +13612,9 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Unable to create thread. ERR=%s\n"
 #~ msgstr "No se puede crear hilo. ERR=%s\n"
 
-#~ msgid "Only one Storage resource permitted in %s\n"
-#~ msgstr "Sólo un recurso Storage permitido en %s\n"
-
-#~ msgid "No Director resource defined in %s. Cannot continue.\n"
-#~ msgstr "Recurso Director no definido en %s. No se puede continuar.\n"
-
-#~ msgid "No Device resource defined in %s. Cannot continue.\n"
-#~ msgstr "Recurso Device no definido en %s. No se puede continuar.\n"
-
-#~ msgid "No Messages resource defined in %s. Cannot continue.\n"
-#~ msgstr "Recurso Mensajes no definido en %s. No se puede continuar.\n"
-
-#~ msgid "\"TLS Certificate\" file not defined for Storage \"%s\" in %s.\n"
-#~ msgstr ""
-#~ "Archivo \"TLS Certificate\" no definido para Storage \"%s\" en %s.\n"
-
-#~ msgid "\"TLS Key\" file not defined for Storage \"%s\" in %s.\n"
-#~ msgstr "Archivo \"TLS Key\" no definido para Storage \"%s\" en %s.\n"
-
-#~ msgid ""
-#~ "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined "
-#~ "for Storage \"%s\" in %s. At least one CA certificate store is required "
-#~ "when using \"TLS Verify Peer\".\n"
-#~ msgstr ""
-#~ "Ni \"Certificado TLS CA \" o \"Directorio del Certificado TLS CA\" están "
-#~ "definidos para el Storage \"%s\" en %s. Por lo menos un almacén de "
-#~ "Certificados CA es necesario cuando se utiliza \"Verificar TLS Peer\".\n"
-
-#~ msgid "Could not initialize %s\n"
-#~ msgstr "No se puede iniciar %s\n"
+#, fuzzy
+#~ msgid "Unable to stat ControlDevice %s: ERR=%s\n"
+#~ msgstr "No se puede stat dispositivo %s: ERR=%s\n"
 
 #~ msgid "Could not open device %s\n"
 #~ msgstr "No se pudo abrir el dispositivo %s\n"
@@ -12578,12 +13653,6 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Unable to init lock: ERR=%s\n"
 #~ msgstr "No se puede iniciar mutex: ERR=%s\n"
 
-#~ msgid ""
-#~ "Attempt to define second \"%s\" resource named \"%s\" is not permitted.\n"
-#~ msgstr ""
-#~ "Intento para definir secundo recurso \"%s\" denominado \"%s\" no está "
-#~ "permitido.\n"
-
 #~ msgid "No tape loaded or drive offline on %s.\n"
 #~ msgstr "Ninguna cinta cargada o unidad offline en %s.\n"
 
@@ -12694,7 +13763,7 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #, fuzzy
 #~ msgid ""
 #~ "\n"
-#~ "Version: %s (%s)\n"
+#~ "%sVersion: %s (%s)\n"
 #~ "Example : bbatch -w /path/to/workdir -h localhost -f dat1 -f dat -f datx\n"
 #~ " will start 3 thread and load dat1, dat and datx in your catalog\n"
 #~ "See bbatch.c to generate datafile\n"
@@ -12739,6 +13808,9 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ " -? imprime esta mensaje\n"
 #~ "\n"
 
+#~ msgid "Could not init Bacula database\n"
+#~ msgstr "No se pudo iniciar base de datos de Bacula\n"
+
 #~ msgid "Error opening datafile %s\n"
 #~ msgstr "Error abriendo archivo de datos %s\n"
 
@@ -12832,9 +13904,20 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Fatal dup error: ERR=%s\n"
 #~ msgstr "Fatal error dup: ERR=%s\n"
 
+#, fuzzy
 #~ msgid ""
+#~ "ERROR %s\n"
 #~ "\n"
-#~ "Version: %s (%s)\n"
+#~ msgstr "<ERROR>\n"
+
+#, fuzzy
+#~ msgid "Unable to open -p argument for reading"
+#~ msgstr "No se puede abrir el archivo de parámetros de DH"
+
+#, fuzzy
+#~ msgid ""
+#~ "\n"
+#~ "%sVersion: %s (%s)\n"
 #~ "       -d <nn>           set debug level to <nn>\n"
 #~ "       -dt               print timestamp in debug output\n"
 #~ "       -n <name>         specify the database name (default bacula)\n"
@@ -12876,7 +13959,7 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #, fuzzy
 #~ msgid ""
 #~ "\n"
-#~ "Version: %s (%s)\n"
+#~ "%sVersion: %s (%s)\n"
 #~ "       -d <nn>           set debug level to <nn>\n"
 #~ "       -dt               print timestamp in debug output\n"
 #~ "       -n <name>         specify the database name (default bacula)\n"
@@ -12971,25 +14054,23 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Please select the function you want to perform.\n"
 #~ msgstr "Por favor seleccione la función que desea realizar.\n"
 
+#, fuzzy
 #~ msgid ""
 #~ "\n"
 #~ "     1) Toggle modify database flag\n"
 #~ "     2) Toggle verbose flag\n"
-#~ "     3) Repair bad Filename records\n"
-#~ "     4) Repair bad Path records\n"
-#~ "     5) Eliminate duplicate Filename records\n"
-#~ "     6) Eliminate duplicate Path records\n"
-#~ "     7) Eliminate orphaned Jobmedia records\n"
-#~ "     8) Eliminate orphaned File records\n"
-#~ "     9) Eliminate orphaned Path records\n"
-#~ "    10) Eliminate orphaned Filename records\n"
-#~ "    11) Eliminate orphaned FileSet records\n"
-#~ "    12) Eliminate orphaned Client records\n"
-#~ "    13) Eliminate orphaned Job records\n"
-#~ "    14) Eliminate all Admin records\n"
-#~ "    15) Eliminate all Restore records\n"
-#~ "    16) All (3-15)\n"
-#~ "    17) Quit\n"
+#~ "     3) Repair bad Path records\n"
+#~ "     4) Eliminate duplicate Path records\n"
+#~ "     5) Eliminate orphaned Jobmedia records\n"
+#~ "     6) Eliminate orphaned File records\n"
+#~ "     7) Eliminate orphaned Path records\n"
+#~ "     8) Eliminate orphaned FileSet records\n"
+#~ "     9) Eliminate orphaned Client records\n"
+#~ "    10) Eliminate orphaned Job records\n"
+#~ "    11) Eliminate all Admin records\n"
+#~ "    12) Eliminate all Restore records\n"
+#~ "    13) All (3-12)\n"
+#~ "    14) Quit\n"
 #~ msgstr ""
 #~ "\n"
 #~ " 1) Activar bandera modificar base de datos\n"
@@ -13010,25 +14091,23 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ " 16) Todos (3-15)\n"
 #~ " 17) Salir\n"
 
+#, fuzzy
 #~ msgid ""
 #~ "\n"
 #~ "     1) Toggle modify database flag\n"
 #~ "     2) Toggle verbose flag\n"
-#~ "     3) Check for bad Filename records\n"
-#~ "     4) Check for bad Path records\n"
-#~ "     5) Check for duplicate Filename records\n"
-#~ "     6) Check for duplicate Path records\n"
-#~ "     7) Check for orphaned Jobmedia records\n"
-#~ "     8) Check for orphaned File records\n"
-#~ "     9) Check for orphaned Path records\n"
-#~ "    10) Check for orphaned Filename records\n"
-#~ "    11) Check for orphaned FileSet records\n"
-#~ "    12) Check for orphaned Client records\n"
-#~ "    13) Check for orphaned Job records\n"
-#~ "    14) Check for all Admin records\n"
-#~ "    15) Check for all Restore records\n"
-#~ "    16) All (3-15)\n"
-#~ "    17) Quit\n"
+#~ "     3) Check for bad Path records\n"
+#~ "     4) Check for duplicate Path records\n"
+#~ "     5) Check for orphaned Jobmedia records\n"
+#~ "     6) Check for orphaned File records\n"
+#~ "     7) Check for orphaned Path records\n"
+#~ "     8) Check for orphaned FileSet records\n"
+#~ "     9) Check for orphaned Client records\n"
+#~ "    10) Check for orphaned Job records\n"
+#~ "    11) Check for all Admin records\n"
+#~ "    12) Check for all Restore records\n"
+#~ "    13) All (3-12)\n"
+#~ "    14) Quit\n"
 #~ msgstr ""
 #~ "\n"
 #~ " 1) Activar bandera modificar base de datos\n"
@@ -13076,18 +14155,6 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Deleting: %s\n"
 #~ msgstr "Eliminando: %s\n"
 
-#~ msgid "Checking for duplicate Filename entries.\n"
-#~ msgstr "Comprobando entradas Nombre de Archivo(Filename) duplicadas.\n"
-
-#~ msgid "Found %d duplicate Filename records.\n"
-#~ msgstr "Encontrados %d registros Nombre de Archivo(Filename) duplicados.\n"
-
-#~ msgid "Print the list? (yes/no): "
-#~ msgstr "Imprimir la lista? (sí/no):"
-
-#~ msgid "Found %d for: %s\n"
-#~ msgstr "Encontrados %d para: %s\n"
-
 #~ msgid "Checking for duplicate Path entries.\n"
 #~ msgstr "Comprobando entradas Path duplicadas.\n"
 
@@ -13097,6 +14164,9 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Print them? (yes/no): "
 #~ msgstr "Imprimirlos? (sí/no):"
 
+#~ msgid "Found %d for: %s\n"
+#~ msgstr "Encontrados %d para: %s\n"
+
 #~ msgid "Checking for orphaned JobMedia entries.\n"
 #~ msgstr "Comprobando entradas JobMedia huérfanas.\n"
 
@@ -13130,17 +14200,6 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Deleting %d orphaned Path records.\n"
 #~ msgstr "Eliminando %d registros huérfanos de Ruta.\n"
 
-#~ msgid "Checking for orphaned Filename entries. This may take some time!\n"
-#~ msgstr ""
-#~ "Comprobando de entradas de Nombre de Archivo huérfanos. Esto puede tomar "
-#~ "algún tiempo!\n"
-
-#~ msgid "Found %d orphaned Filename records.\n"
-#~ msgstr "Se han encontrado %d registros de Nombre de Archivos huérfanos.\n"
-
-#~ msgid "Deleting %d orphaned Filename records.\n"
-#~ msgstr "Eliminando %d registros de Nombre de Archivos huérfanos.\n"
-
 #~ msgid "Checking for orphaned FileSet entries. This takes some time!\n"
 #~ msgstr ""
 #~ "Comprobando de entradas FileSet huérfanos. Esto puede tomar algún "
@@ -13197,21 +14256,15 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Deleting %d Restore Job records.\n"
 #~ msgstr "Eliminando %d registros de Job de Restauración.\n"
 
-#~ msgid "Checking for Filenames with a trailing slash\n"
-#~ msgstr "Comprobando Nombres de Archivo con una barra diagonal\n"
-
-#~ msgid "Found %d bad Filename records.\n"
-#~ msgstr "Se han encontrado %d malos registros de Nombre de Archivo.\n"
-
-#~ msgid "Reparing %d bad Filename records.\n"
-#~ msgstr "Reparando %d malos registros de Nombre de Archivo.\n"
-
 #~ msgid "Checking for Paths without a trailing slash\n"
 #~ msgstr "Comprobando Rutas sin una barra diagonal\n"
 
 #~ msgid "Found %d bad Path records.\n"
 #~ msgstr "Se han encontrado %d malos registros de Rutas.\n"
 
+#~ msgid "Reparing %d bad Filename records.\n"
+#~ msgstr "Reparando %d malos registros de Nombre de Archivo.\n"
+
 #~ msgid ""
 #~ "Ok. Index over the %s column already exists and dbcheck will work "
 #~ "faster.\n"
@@ -13265,28 +14318,35 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "%s: unknown\n"
 #~ msgstr "%s: desconocido\n"
 
+#, fuzzy
 #~ msgid ""
 #~ "\n"
 #~ "Usage: fstype [-v] path ...\n"
 #~ "\n"
-#~ "       Print the file system type a given file/directory is on.\n"
+#~ "       Print the file system type for each file/directory argument "
+#~ "given.\n"
 #~ "       The following options are supported:\n"
 #~ "\n"
-#~ "       -v     print both path and file system type.\n"
+#~ "       -l     print all file system types in mtab.\n"
+#~ "       -m     print full entries in mtab.\n"
+#~ "       -v     print both path and file system type of each argument.\n"
 #~ "       -?     print this message.\n"
 #~ "\n"
 #~ msgstr ""
 #~ "\n"
-#~ "Utilice: fstype [-v] ruta ...\n"
+#~ "Utilice: drivetype [-v] ruta ...\n"
 #~ "\n"
-#~ " Imprime el tipo de sistema de archivo de un determinado archivo/"
-#~ "directorio.\n"
-#~ "Las siguientes opciones son compatibles:\n"
+#~ " Imprime el tipo de unidad dado a archivo/directorio esta activada.\n"
+#~ " Las siguientes opciones están soportados:\n"
 #~ "\n"
-#~ " -v imprimir tanto tipo de rutas y sistema de archivos.\n"
-#~ " -? imprimir este mensaje.\n"
+#~ " -v imprime ambos tipos de rutas y archivo de sistemas.\n"
+#~ " -? imprime esta mensaje.\n"
 #~ "\n"
 
+#, fuzzy
+#~ msgid "%s: unknown file system type\n"
+#~ msgstr "Tipo de archivo desconocido %d: %s\n"
+
 #~ msgid ""
 #~ "\n"
 #~ "Usage: testfind [-d debug_level] [-] [pattern1 ...]\n"
@@ -13431,153 +14491,234 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ "Saltar: Cambio de sistema de archivos prohibido. No entró al directorio. "
 #~ "%s\n"
 
+#~ msgid ""
+#~ "\n"
+#~ "\n"
+#~ "Bacula ERROR: "
+#~ msgstr ""
+#~ "\n"
+#~ "\n"
+#~ "Bacula ERROR: "
+
 #, fuzzy
-#~ msgid "Invalid jobid argument\n"
-#~ msgstr "argumento invalido"
+#~ msgid "Unable to resolve parent path for %ls\n"
+#~ msgstr "No se pudo obtener registro de Job. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Unknown ObjectType %s\n"
-#~ msgstr "Tipo de base de datos desconocido: %s\n"
+#~ msgid "Unable to parse user supplied restore configuration\n"
+#~ msgstr "No es posible leer el archivo de configuración"
 
-#~ msgid "No FreeSpace command defined.\n"
-#~ msgstr "Comando FreeSpace no definido.\n"
+#~ msgid "Bad Command Line Option"
+#~ msgstr "Mala Opción de Línea de Comandos"
 
-#~ msgid "Cannot run free space command. Results=%s ERR=%s\n"
-#~ msgstr ""
-#~ "No se puede ejecutar comando de espacio libre. Resultados=%s ERR=%s\n"
+#~ msgid "RegisterServiceCtlHandler failed"
+#~ msgstr "RegisterServiceCtlHandler fallido"
 
-#~ msgid "Error writing part %d to the DVD: ERR=%s\n"
-#~ msgstr "Error escribiendo parte %d en el DVD: ERR=%s\n"
+#~ msgid "Failure contacting the Service Handler"
+#~ msgstr "Error al contactar con el Manejador de Servicio"
 
-#~ msgid "Error while writing current part to the DVD: %s"
-#~ msgstr "Error al escribir parte actual al DVD: %s"
+#~ msgid "Service start report failed"
+#~ msgstr "Fallo en inicio de Servicio de Reporte"
 
-#~ msgid "Part %d (%lld bytes) written to DVD.\n"
-#~ msgstr "Parte %d (%lld bytes) escrito al DVD.\n"
+#~ msgid "StartServiceCtrlDispatcher failed."
+#~ msgstr "StartServiceCtrlDispatcher fallido."
 
-#~ msgid "Remaining free space %s on %s\n"
-#~ msgstr "Espacio libre restante %s en %s\n"
+#~ msgid "KERNEL32.DLL not found: Bacula service not started"
+#~ msgstr "KERNEL32.DLL no encontrado: Servicio Bacula no iniciado"
 
-#~ msgid "Next Volume part already exists on DVD. Cannot continue: %s\n"
+#~ msgid "Registry service not found: Bacula service not started"
+#~ msgstr "Servicio Registry no encontrado: Servicio Bacula no iniciado"
+
+#~ msgid "Registry service entry point not found"
+#~ msgstr "Registro de servicio no se encuentra punto de entrada"
+
+#~ msgid "Report Service failure"
+#~ msgstr "Reporte de Servicio fallido"
+
+#~ msgid "Unable to install the service"
+#~ msgstr "No se puede instalar el servicio"
+
+#~ msgid "Service command length too long"
+#~ msgstr "Longitud de comandos de servicio demasiado largo"
+
+#~ msgid "Service command length too long. Service not registered."
 #~ msgstr ""
-#~ "Siguiente parte del volumen ya existe en DVD. No se puede continuar: %s\n"
+#~ "Longitud de comandos de servicio demasiado largo. Servicio no registrado."
 
 #~ msgid ""
-#~ "Error writing. Current part less than total number of parts (%d/%d, "
-#~ "device=%s)\n"
+#~ "The Service Control Manager could not be contacted - the service was not "
+#~ "installed"
 #~ msgstr ""
-#~ "Error al escribir. Parte actual menor que número total de partes (%d/%d, "
-#~ "dispositivo=%s)\n"
+#~ "El Manejador de Control de Servicios no puede ser contactado - el "
+#~ "servicio no fue instalado"
 
-#~ msgid "Unable to write last on %s: ERR=%s\n"
-#~ msgstr "No se puede escribir última en %s: ERR=%s\n"
+#~ msgid "The Bacula service: "
+#~ msgstr "El servicio Bacula:"
 
-#, fuzzy
 #~ msgid ""
-#~ "Out of freespace caused End of Volume \"%s\" at %u:%u on device %s. Write "
-#~ "of %u bytes got %d.\n"
+#~ "Provides file backup and restore services. Bacula -- the network backup "
+#~ "solution."
 #~ msgstr ""
-#~ "Fin de Volumen \"%s\" en %u:%u en el dispositivo %s. Escribió %u bytes "
-#~ "obtuvo %d.\n"
+#~ "Proporciona servicios de copia de seguridad y restauración. Bacula - la "
+#~ "solución de copia de seguridad de red."
+
+#~ msgid "Cannot write System Registry for "
+#~ msgstr "No se puede escribir Registro de Sistema para"
 
 #~ msgid ""
-#~ "Error while writing, current part number is less than the total number of "
-#~ "parts (%d/%d, device=%s)\n"
+#~ "The System Registry could not be updated - the Bacula service was not "
+#~ "installed"
 #~ msgstr ""
-#~ "Error al escribir, número de parte actual es menor que el número total de "
-#~ "partes (%d/%d, dispositivo=%s)\n"
+#~ "El Registro del Sistema no ha podido ser actualizado - el servicio Bacula "
+#~ "no se ha instalado"
 
-#~ msgid "Unable to open device next part %s: ERR=%s\n"
-#~ msgstr "No se puede abrir próxima parte %s del dispositivo: ERR=%s\n"
+#~ msgid "Cannot add Bacula key to System Registry"
+#~ msgstr "No se puede agregar clave Bacula al Registro del Sistema"
+
+#~ msgid "The "
+#~ msgstr "El"
+
+#, fuzzy
+#~ msgid "An existing Bacula service: "
+#~ msgstr "Un servicio Bacula existente:"
 
 #~ msgid ""
-#~ "End of Volume \"%s\" at %u:%u on device %s (part_size=%s, free_space=%s, "
-#~ "free_space_errno=%d, errmsg=%s).\n"
+#~ "The service Manager could not be contacted - the Bacula service was not "
+#~ "removed"
 #~ msgstr ""
-#~ "Fin de Volumen \"%s\" en %u:%u en el dispositivo %s (part_size=%s, "
-#~ "free_space=%s, free_space_errno=%d, errmsg=%s).\n"
+#~ "El Administrador de Servicio no puedo ser contactado - El Servicio Bacula "
+#~ "no se elimino"
 
 #~ msgid ""
-#~ "End of Volume \"%s\" at %u:%u on device %s (part_size=%s, free_space=%s, "
-#~ "free_space_errno=%d).\n"
+#~ "Could not find registry entry.\n"
+#~ "Service probably not registerd - the Bacula service was not removed"
 #~ msgstr ""
-#~ "Fin de Volumen \"%s\" en %u:%u en el dispositivo %s (part_size=%s, "
-#~ "free_space=%s, free_space_errno=%d).\n"
+#~ "No se pudo encontrar la entrada del Registro.\n"
+#~ "Servicio probablemente no Registrado - el servicio de Bacula no se ha "
+#~ "quitado"
 
-#~ msgid "Could not initialize Python\n"
-#~ msgstr "No se pudo inicializar Python\n"
+#~ msgid "Could not delete Registry key for "
+#~ msgstr "No se pudo borrar la clave del Registro para"
 
-#~ msgid "Could not Run Python string %s\n"
-#~ msgstr "No se pudo ejecutar Python cadena %s\n"
+#~ msgid "Bacula could not be contacted, probably not running"
+#~ msgstr "Bacula no pudo ser contactado, probablemente no se está ejecutando"
 
-#~ msgid "Could not initialize Python Job type.\n"
-#~ msgstr "No se pudo inicializar Job tipo Python.\n"
+#~ msgid "The Bacula service has been removed"
+#~ msgstr "El servicio Bacula se ha eliminado"
 
-#~ msgid "Could not import Python script %s/%s. Python disabled.\n"
-#~ msgstr "No se puede importar script Python %s/%s. Python deshabilitado.\n"
+#~ msgid "SetServiceStatus failed"
+#~ msgstr "SetServiceStatus fallido"
 
-#~ msgid "Could not create Python Job Object.\n"
-#~ msgstr "No es posible crear objeto Job Python.\n"
+#~ msgid ""
+#~ "\n"
+#~ "\n"
+#~ "%s error: %ld at %s:%d"
+#~ msgstr ""
+#~ "\n"
+#~ "\n"
+#~ "%s error: %ld en %s:%d"
 
-#~ msgid "Python function \"%s\" not found.\n"
-#~ msgstr "Python función \"%s\" no encontrada.\n"
+#~ msgid "Locked by: %s, duration: %ld seconds\n"
+#~ msgstr "Bloqueado por: %s, duración: %ld segundos\n"
 
-#~ msgid "Unknown Python daemon event %s\n"
-#~ msgstr "Demonio Python evento %s desconocido\n"
+#~ msgid "No longer locked\n"
+#~ msgstr "Ya no está bloqueado\n"
 
-#~ msgid "Unable to initialize the Python lock. ERR=%s\n"
-#~ msgstr "No se puede inicializar el bloqueo de Python. ERR=%s\n"
+#~ msgid "Could not lock database"
+#~ msgstr "No se pudo bloquear la base de datos"
 
-#~ msgid "Cannot open current directory: ERR=%s\n"
-#~ msgstr "No se puede abrir el directorio actual: ERR=%s\n"
+#~ msgid ""
+#~ "\n"
+#~ "Usage: fstype [-v] path ...\n"
+#~ "\n"
+#~ "       Print the file system type a given file/directory is on.\n"
+#~ "       The following options are supported:\n"
+#~ "\n"
+#~ "       -v     print both path and file system type.\n"
+#~ "       -?     print this message.\n"
+#~ "\n"
+#~ msgstr ""
+#~ "\n"
+#~ "Utilice: fstype [-v] ruta ...\n"
+#~ "\n"
+#~ " Imprime el tipo de sistema de archivo de un determinado archivo/"
+#~ "directorio.\n"
+#~ "Las siguientes opciones son compatibles:\n"
+#~ "\n"
+#~ " -v imprimir tanto tipo de rutas y sistema de archivos.\n"
+#~ " -? imprimir este mensaje.\n"
+#~ "\n"
 
-#~ msgid "Cannot get current directory: ERR=%s\n"
-#~ msgstr "No se puede obtener el directorio actual: ERR=%s\n"
+#~ msgid "Open File Manager paused\n"
+#~ msgstr "Administrador Open File pausado\n"
 
-#~ msgid "Cannot reset current directory: ERR=%s\n"
-#~ msgstr "No se puede restablecer el directorio actual: ERR=%s\n"
+#~ msgid "FAILED to pause Open File Manager\n"
+#~ msgstr "Fallo al pausar Administrador Open File\n"
 
-#~ msgid "Error in %s file %s: ERR=%s\n"
-#~ msgstr "Error en %s archivo %s: ERR=%s\n"
+#~ msgid "Running as '%s'. Privmask=%#08x\n"
+#~ msgstr "Ejecutando como '%s'. Privmask=%#08x\n"
 
-#~ msgid "Error in %s: ERR=%s\n"
-#~ msgstr "Error en %s: ERR=%s\n"
+#~ msgid "Failed to retrieve current UserName\n"
+#~ msgstr "Fallo al recuperar UserName actual\n"
 
-#~ msgid "AdjustTokenPrivileges set "
-#~ msgstr "Establecer AdjustTokenPrivileges "
+#, fuzzy
+#~ msgid "AIX Specific Extended attribs"
+#~ msgstr "Atributos Extendidos Específicos de Linux"
 
-#~ msgid "Generate VSS snapshots. Driver=\"%s\", Drive(s)=\"%s\"\n"
-#~ msgstr ""
-#~ "Generar instantáneas(snapshots) VSS. Driver=\"%s\", Drive(s)=\"%s\"\n"
+#~ msgid "Attempt to open read on non-open session.\n"
+#~ msgstr "Intento de abrir leer sesión no abierta.\n"
+
+#~ msgid "Expected an fstype string, got: %s\n"
+#~ msgstr "Se esperaba una cadena fstype, se obtuvo: %s\n"
+
+#~ msgid "Expected an drivetype string, got: %s\n"
+#~ msgstr "Se esperaba una cadena drivetype, se obtuvo: %s\n"
 
 #, fuzzy
-#~ msgid "CreateSGenerate VSS snapshots failed. ERR=%s\n"
-#~ msgstr "Fallo al generar VSS snapshots.\n"
+#~ msgid "Storage from Run NextPool override"
+#~ msgstr "Storage desde recurso Pool's NextPool "
 
 #, fuzzy
-#~ msgid "Generate VSS snapshot of drive \"%c:\\\" failed.\n"
-#~ msgstr "Fallo al generar VSS snapshots.\n"
+#~ msgid "Storage from Job's NextPool resource"
+#~ msgstr "Storage desde recurso Pool's NextPool "
 
-#~ msgid "VSS Writer (PrepareForBackup): %s\n"
-#~ msgstr "VSS Writer (PrepareForBackup): %s\n"
+#~ msgid "Storage from Pool's NextPool resource"
+#~ msgstr "Storage desde recurso Pool's NextPool "
 
-#~ msgid "No drive letters found for generating VSS snapshots.\n"
+#, fuzzy
+#~ msgid "Storage from NextPool override"
+#~ msgstr "Storage desde recurso Pool's NextPool "
+
+#~ msgid "Enter *MediaId or Volume name: "
+#~ msgstr "Introduzca MediaId o nombre del Volumen:"
+
+#~ msgid "Warning Job %s is not running. Continuing anyway ...\n"
 #~ msgstr ""
-#~ "No encuentra las letras de unidad para la generación de "
-#~ "instantáneas(snapshots) VSS.\n"
+#~ "Advertencia Job %s no está¡ en ejecución. Continuar de todos modos ...\n"
+
+#~ msgid "I only authenticate directors, not %d\n"
+#~ msgstr "Yo sólo autentifico directores, no %d\n"
 
 #, fuzzy
-#~ msgid "VSS was not initialized properly. ERR=%s\n"
-#~ msgstr ""
-#~ "VSS no se inicializo correctamente. Suporte VSS está desactivado. ERR=%s\n"
+#~ msgid "Generate VSS snapshot of drive \"%c:\\\" failed.\n"
+#~ msgstr "Fallo al generar VSS snapshots.\n"
 
-#~ msgid "VSS was not initialized properly. VSS support is disabled. ERR=%s\n"
-#~ msgstr ""
-#~ "VSS no se inicializo correctamente. Suporte VSS está desactivado. ERR=%s\n"
+#, fuzzy
+#~ msgid "Selection item too large.\n"
+#~ msgstr "Ranura demasiado grande.\n"
 
 #, fuzzy
-#~ msgid "VSS Writer (RestoreComplete): %s\n"
-#~ msgstr "VSS Writer (BackupComplete): %s\n"
+#~ msgid "No input string given.\n"
+#~ msgstr "Especificación de archivo no dado.\n"
+
+#~ msgid "I only authenticate Directors, not %d\n"
+#~ msgstr "Solo autentico Directores, no %d\n"
+
+#~ msgid "FD connect failed: Job name not found: %s\n"
+#~ msgstr "Fallo al conectar a FD: Nombre del Job no encontrado: %s\n"
+
+#~ msgid "Hey!!!! JobId %u Job %s already authenticated.\n"
+#~ msgstr "Hey!!!! JobId %u Job %s ya autenticada.\n"
 
 #~ msgid "Job pointer not found."
 #~ msgstr "No se encuentra el puntero del Job."
@@ -13588,70 +14729,20 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Cannot delete attribute %s"
 #~ msgstr "No se puedo eliminar atributo %s"
 
-#~ msgid "Cannot find attribute %s"
-#~ msgstr "No se puedo encontrar atributo %s"
-
 #~ msgid "Read-only attribute"
 #~ msgstr "Atributo Solo-Lectura"
 
-#, fuzzy
-#~ msgid "JobId %s is not running. Use Job name to %s inactive jobs.\n"
-#~ msgstr ""
-#~ "JobId %s no está en ejecución. Utilice el nombre del Job para cancelar "
-#~ "jobs inactivo.\n"
-
-#~ msgid ""
-#~ "Cancel: %s\n"
-#~ "\n"
-#~ "%s"
-#~ msgstr ""
-#~ "Cancelar: %s\n"
-#~ "\n"
-#~ "%s"
-
-#~ msgid "Confirm cancel?"
-#~ msgstr "Confirmar cancelar?"
-
-#~ msgid "Disable a job"
-#~ msgstr "Deshabilitar un job"
-
-#~ msgid "Enable a job"
-#~ msgstr "Habilitar un job"
-
-#~ msgid "Python control commands"
-#~ msgstr "Comandos de control de Python"
-
-#~ msgid "Python interpreter restarted.\n"
-#~ msgstr "Interprete Python reiniciado.\n"
-
-#, fuzzy
-#~ msgid "Illegal JobId %s ignored\n"
-#~ msgstr "Clonar JobId %d iniciado.\n"
-
-#~ msgid "Please Plugin Options string: "
-#~ msgstr "Por favor, cadena de Opciones de Plugin:"
-
-#~ msgid "%6d %-6s  %-20s %s\n"
-#~ msgstr "%6d %-6s %-20s %s\n"
-
-#, fuzzy
-#~ msgid "               %-30s\n"
-#~ msgstr "Job : %s\n"
-
-#~ msgid "Pool record not found."
-#~ msgstr "Registro Pool no encontrado"
-
-#~ msgid "Priority must be 1-100"
-#~ msgstr "Prioridad debe ser 1-100"
+#~ msgid "Cannot find attribute %s"
+#~ msgstr "No se puedo encontrar atributo %s"
 
-#~ msgid "Job Level can be set only during JobInit"
-#~ msgstr "Nivel de Job sólo se puede ajustar durante JobInit"
+#~ msgid "Error in ParseTuple\n"
+#~ msgstr "Error en ParseTuple\n"
 
-#~ msgid "Bad JobLevel string"
-#~ msgstr "Mala cadena JobLevel"
+#~ msgid "Parse tuple error in job_write\n"
+#~ msgstr "Error de análisis de tupla en job_write\n"
 
-#~ msgid "1992 Update Media error. VolFiles=%u, CatFiles=%u\n"
-#~ msgstr "1992 Error de actualización de Media. VolFiles=%u, CatFiles=%u\n"
+#~ msgid "Error in Python method %s\n"
+#~ msgstr "Error en el método Python %s\n"
 
 #~ msgid ""
 #~ "Written by Nicolas Boichat (2004)\n"
@@ -13748,6 +14839,9 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "No current job."
 #~ msgstr "Ningún trabajo actual."
 
+#~ msgid "No last job."
+#~ msgstr "Ningún ultimo trabajo."
+
 #~ msgid "Job status: Created"
 #~ msgstr "Estado del trabajo: Creado"
 
@@ -13811,99 +14905,39 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Job status: Unknown(%c)"
 #~ msgstr "Estado del job: Desconocido (%c)"
 
-#~ msgid "Bad scan : '%s' %d\n"
-#~ msgstr "Mala análisis: '%s' %d\n"
-
-#~ msgid "Connecting to Client %s:%d\n"
-#~ msgstr "Conectando con Cliente %s:%d\n"
-
-#~ msgid "Connecting to Storage %s:%d\n"
-#~ msgstr "Conectando con Storage %s:%d\n"
-
-#~ msgid "Cannot connect to daemon.\n"
-#~ msgstr "No se puede conectar al demonio.\n"
-
-#~ msgid "Opened connection with Director daemon.\n"
-#~ msgstr "Conexión abierta con demonio Director.\n"
-
-#~ msgid "Opened connection with File daemon.\n"
-#~ msgstr "Conexión abierta con demonio File.\n"
-
-#~ msgid "Opened connection with Storage daemon.\n"
-#~ msgstr "Conexión abierta con demonio Storage.\n"
-
-#, fuzzy
-#~ msgid "<< Error: BNET_SUB_PROMPT signal received. >>\n"
-#~ msgstr "<< Error: BNET_PROMPT señal recibida. >>\n"
-
-#~ msgid "<< Heartbeat signal received, answered. >>\n"
-#~ msgstr "<< Heartbeat señal recibida, respondió. >>\n"
-
-#~ msgid "<< Unexpected signal received : %s >>\n"
-#~ msgstr "<< Inesperada señal recibida: %s >>\n"
-
-#~ msgid "<ERROR>\n"
-#~ msgstr "<ERROR>\n"
-
-#~ msgid "<STOP>\n"
-#~ msgstr "<PARE>\n"
-
-#~ msgid "End of physical tape.\n"
-#~ msgstr "Fin de la cinta física.\n"
-
-#~ msgid "Init Catalog"
-#~ msgstr "Catálogo de inicio"
-
-#~ msgid "Volume to Catalog"
-#~ msgstr "Volumen para Catalogo"
-
-#~ msgid "Disk to Catalog"
-#~ msgstr "Disco para Catalogo"
-
-#~ msgid "Data"
-#~ msgstr "Datos"
-
-#~ msgid "part"
-#~ msgstr "parte"
-
-#~ msgid "file"
-#~ msgstr "archivo"
+#~ msgid "Bad scan : '%s' %d\n"
+#~ msgstr "Mala análisis: '%s' %d\n"
 
-#~ msgid "End of %s %u on device %s, Volume \"%s\"\n"
-#~ msgstr "Fin de %s %u en dispositivo %s, Volumen \"%s\"\n"
+#~ msgid "Connecting to Client %s:%d\n"
+#~ msgstr "Conectando con Cliente %s:%d\n"
 
-#~ msgid "Want to append, but device %s is busy reading.\n"
-#~ msgstr "Esperando anexar, pero el dispositivo %s está ocupado leyendo.\n"
+#~ msgid "Connecting to Storage %s:%d\n"
+#~ msgstr "Conectando con Storage %s:%d\n"
 
-#~ msgid "Append data error.\n"
-#~ msgstr "Error al añadir datos.\n"
+#~ msgid "Cannot connect to daemon.\n"
+#~ msgstr "No se puede conectar al demonio.\n"
 
-#~ msgid "Error in ParseTuple\n"
-#~ msgstr "Error en ParseTuple\n"
+#~ msgid "Opened connection with Director daemon.\n"
+#~ msgstr "Conexión abierta con demonio Director.\n"
 
-#~ msgid "Parse tuple error in job_write\n"
-#~ msgstr "Error de análisis de tupla en job_write\n"
+#~ msgid "Opened connection with File daemon.\n"
+#~ msgstr "Conexión abierta con demonio File.\n"
 
-#~ msgid "Error in Python method %s\n"
-#~ msgstr "Error en el método Python %s\n"
+#~ msgid "Opened connection with Storage daemon.\n"
+#~ msgstr "Conexión abierta con demonio Storage.\n"
 
 #, fuzzy
-#~ msgid "Truncate on attributes file failed: ERR=%s\n"
-#~ msgstr "Fallo fseek en los atributos de archivo: ERR=%s\n"
+#~ msgid "<< Error: BNET_SUB_PROMPT signal received. >>\n"
+#~ msgstr "<< Error: BNET_PROMPT señal recibida. >>\n"
 
-#~ msgid "Could not open: %s, ERR=%s\n"
-#~ msgstr "No se pudo abrir: %s, ERR=%s\n"
+#~ msgid "<< Heartbeat signal received, answered. >>\n"
+#~ msgstr "<< Heartbeat señal recibida, respondió. >>\n"
 
-#~ msgid ""
-#~ "Error writing final part to DVD. This Volume may not be readable.\n"
-#~ "%s"
-#~ msgstr ""
-#~ "Error al escribir la parte final a DVD. Este volumen puede no ser "
-#~ "legible.\n"
-#~ "%s"
+#~ msgid "<< Unexpected signal received : %s >>\n"
+#~ msgstr "<< Inesperada señal recibida: %s >>\n"
 
-#~ msgid "Unable to open device part=%d %s: ERR=%s\n"
-#~ msgstr "No se puede abrir el dispositivo parte =%d %s: ERR=%s\n"
+#~ msgid "<STOP>\n"
+#~ msgstr "<PARE>\n"
 
 #, fuzzy
 #~ msgid "Failed to allocate space for query filter.\n"
@@ -13926,6 +14960,9 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "A user name for Ingres must be supplied.\n"
 #~ msgstr "Un nombre de usuario para DBI debe ser suministrado.\n"
 
+#~ msgid "Unknown database type: %s\n"
+#~ msgstr "Tipo de base de datos desconocido: %s\n"
+
 #~ msgid ""
 #~ "Unable to locate the DBD drivers to DBI interface in: \n"
 #~ "db_driverdir=%s. It is probaly not found any drivers\n"
@@ -13955,172 +14992,99 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "A user name for DBI must be supplied.\n"
 #~ msgstr "Un nombre de usuario para DBI debe ser suministrado.\n"
 
-#~ msgid "Bad response to Hello command: ERR="
-#~ msgstr "mala respuesta al comando Hello: ERR ="
-
-#~ msgid "    Files=%s Bytes=%s Bytes/sec=%s Errors=%d\n"
-#~ msgstr "Archivos=%s Bytes=%s Bytes/sec=%s Errores=%d\n"
-
-#~ msgid "Bacula Client: Idle"
-#~ msgstr "Bacula Cliente: Inactivo"
-
-#~ msgid "Bacula Client: Running"
-#~ msgstr "Bacula Cliente: Funcionando"
-
-#~ msgid "Bacula Client: Last Job Canceled"
-#~ msgstr "Bacula Cliente: Ultimo Job Cancelado"
-
-#~ msgid "Bacula Client: Last Job Failed"
-#~ msgstr "Bacula Cliente: Ultimo Job Fallido"
-
-#~ msgid "Bacula Client: Last Job had Warnings"
-#~ msgstr "Bacula Cliente: Ultimo Job con Advertencias"
-
-#~ msgid "Failed to authenticate Storage daemon.\n"
-#~ msgstr "Fallo al autenticar demonio Storage.\n"
-
-#~ msgid ""
-#~ "\n"
-#~ "\n"
-#~ "Bacula ERROR: "
-#~ msgstr ""
-#~ "\n"
-#~ "\n"
-#~ "Bacula ERROR: "
-
-#~ msgid "RegisterServiceCtlHandler failed"
-#~ msgstr "RegisterServiceCtlHandler fallido"
-
-#~ msgid "Failure contacting the Service Handler"
-#~ msgstr "Error al contactar con el Manejador de Servicio"
-
-#~ msgid "Service start report failed"
-#~ msgstr "Fallo en inicio de Servicio de Reporte"
-
-#~ msgid "StartServiceCtrlDispatcher failed."
-#~ msgstr "StartServiceCtrlDispatcher fallido."
-
-#~ msgid "KERNEL32.DLL not found: Bacula service not started"
-#~ msgstr "KERNEL32.DLL no encontrado: Servicio Bacula no iniciado"
-
-#~ msgid "Registry service not found: Bacula service not started"
-#~ msgstr "Servicio Registry no encontrado: Servicio Bacula no iniciado"
+#, fuzzy
+#~ msgid "Read zero bytes Vol=%s at %u:%u on device %s.\n"
+#~ msgstr "Leer cero bytes en %u:%u en el dispositivo %s.\n"
 
-#~ msgid "Registry service entry point not found"
-#~ msgstr "Registro de servicio no se encuentra punto de entrada"
+#~ msgid "Init Catalog"
+#~ msgstr "Catálogo de inicio"
 
-#~ msgid "Report Service failure"
-#~ msgstr "Reporte de Servicio fallido"
+#~ msgid "Volume to Catalog"
+#~ msgstr "Volumen para Catalogo"
 
-#~ msgid "Unable to install the service"
-#~ msgstr "No se puede instalar el servicio"
+#~ msgid "Disk to Catalog"
+#~ msgstr "Disco para Catalogo"
 
-#~ msgid "Service command length too long"
-#~ msgstr "Longitud de comandos de servicio demasiado largo"
+#~ msgid "Data"
+#~ msgstr "Datos"
 
-#~ msgid "Service command length too long. Service not registered."
-#~ msgstr ""
-#~ "Longitud de comandos de servicio demasiado largo. Servicio no registrado."
+#~ msgid "Bacula Storage: Idle"
+#~ msgstr "Bacula Storage: Libre"
 
-#~ msgid ""
-#~ "The Service Control Manager could not be contacted - the service was not "
-#~ "installed"
-#~ msgstr ""
-#~ "El Manejador de Control de Servicios no puede ser contactado - el "
-#~ "servicio no fue instalado"
+#~ msgid "Bacula Storage: Running"
+#~ msgstr "Bacula Storage: Ejecutando"
 
-#~ msgid "The Bacula service: "
-#~ msgstr "El servicio Bacula:"
+#~ msgid "Bacula Storage: Last Job Canceled"
+#~ msgstr "Bacula Storage: Último Job Cancelado"
 
-#~ msgid ""
-#~ "Provides file backup and restore services. Bacula -- the network backup "
-#~ "solution."
-#~ msgstr ""
-#~ "Proporciona servicios de copia de seguridad y restauración. Bacula - la "
-#~ "solución de copia de seguridad de red."
+#~ msgid "Bacula Storage: Last Job Failed"
+#~ msgstr "Bacula Storage: Último Job Fallido"
 
-#~ msgid "Cannot write System Registry for "
-#~ msgstr "No se puede escribir Registro de Sistema para"
+#~ msgid "Bacula Storage: Last Job had Warnings"
+#~ msgstr "Bacula Storage: Último Job con Advertencias"
 
-#~ msgid ""
-#~ "The System Registry could not be updated - the Bacula service was not "
-#~ "installed"
-#~ msgstr ""
-#~ "El Registro del Sistema no ha podido ser actualizado - el servicio Bacula "
-#~ "no se ha instalado"
+#~ msgid "JCR use_count=%d JobId=%d\n"
+#~ msgstr "JCR use_count=%d JobId=%d\n"
 
-#~ msgid "Cannot add Bacula key to System Registry"
-#~ msgstr "No se puede agregar clave Bacula al Registro del Sistema"
+#~ msgid "It was tried to assign a ipv6 address to a ipv4(%d)\n"
+#~ msgstr "Se trató de asignar una dirección IPv6 a IPv4(%d)\n"
 
-#~ msgid "The "
-#~ msgstr "El"
+#~ msgid "Bad response to Hello command: ERR="
+#~ msgstr "mala respuesta al comando Hello: ERR ="
 
 #, fuzzy
-#~ msgid "An existing Bacula service: "
-#~ msgstr "Un servicio Bacula existente:"
-
-#~ msgid ""
-#~ "The service Manager could not be contacted - the Bacula service was not "
-#~ "removed"
+#~ msgid "JobId %s is not running. Use Job name to %s inactive jobs.\n"
 #~ msgstr ""
-#~ "El Administrador de Servicio no puedo ser contactado - El Servicio Bacula "
-#~ "no se elimino"
+#~ "JobId %s no está en ejecución. Utilice el nombre del Job para cancelar "
+#~ "jobs inactivo.\n"
 
-#~ msgid ""
-#~ "Could not find registry entry.\n"
-#~ "Service probably not registerd - the Bacula service was not removed"
-#~ msgstr ""
-#~ "No se pudo encontrar la entrada del Registro.\n"
-#~ "Servicio probablemente no Registrado - el servicio de Bacula no se ha "
-#~ "quitado"
+#, fuzzy
+#~ msgid "Confirm %s (yes/no): "
+#~ msgstr "Confirmar cancelar(si/no): "
 
-#~ msgid "Could not delete Registry key for "
-#~ msgstr "No se pudo borrar la clave del Registro para"
+#~ msgid "Pool record not found."
+#~ msgstr "Registro Pool no encontrado"
 
-#~ msgid "Bacula could not be contacted, probably not running"
-#~ msgstr "Bacula no pudo ser contactado, probablemente no se está ejecutando"
+#~ msgid "Priority must be 1-100"
+#~ msgstr "Prioridad debe ser 1-100"
 
-#~ msgid "The Bacula service has been removed"
-#~ msgstr "El servicio Bacula se ha eliminado"
+#~ msgid "Job Level can be set only during JobInit"
+#~ msgstr "Nivel de Job sólo se puede ajustar durante JobInit"
 
-#~ msgid "SetServiceStatus failed"
-#~ msgstr "SetServiceStatus fallido"
+#~ msgid "Bad JobLevel string"
+#~ msgstr "Mala cadena JobLevel"
 
-#~ msgid ""
-#~ "\n"
-#~ "\n"
-#~ "%s error: %ld at %s:%d"
-#~ msgstr ""
-#~ "\n"
-#~ "\n"
-#~ "%s error: %ld en %s:%d"
+#~ msgid "Python control commands"
+#~ msgstr "Comandos de control de Python"
 
-#~ msgid "Locked by: %s, duration: %ld seconds\n"
-#~ msgstr "Bloqueado por: %s, duración: %ld segundos\n"
+#~ msgid "Python interpreter restarted.\n"
+#~ msgstr "Interprete Python reiniciado.\n"
 
-#~ msgid "No longer locked\n"
-#~ msgstr "Ya no está bloqueado\n"
+#, fuzzy
+#~ msgid "Illegal JobId %s ignored\n"
+#~ msgstr "Clonar JobId %d iniciado.\n"
 
-#~ msgid "Could not lock database"
-#~ msgstr "No se pudo bloquear la base de datos"
+#~ msgid "Failed to authenticate Storage daemon.\n"
+#~ msgstr "Fallo al autenticar demonio Storage.\n"
 
-#~ msgid "Bad Command Line Option"
-#~ msgstr "Mala Opción de Línea de Comandos"
+#, fuzzy
+#~ msgid " SDSocket=closed\n"
+#~ msgstr "SDSocket cerrado.\n"
 
-#~ msgid "Config file editor"
-#~ msgstr "Editor de archivos de configuración"
+#~ msgid "Bacula Client: Idle"
+#~ msgstr "Bacula Cliente: Inactivo"
 
-#~ msgid "Save and close"
-#~ msgstr "Guardar y cerrar"
+#~ msgid "Bacula Client: Running"
+#~ msgstr "Bacula Cliente: Funcionando"
 
-#~ msgid "Close without saving"
-#~ msgstr "Cerrar sin guardar"
+#~ msgid "Bacula Client: Last Job Canceled"
+#~ msgstr "Bacula Cliente: Ultimo Job Cancelado"
 
-#~ msgid "Unable to write to %s\n"
-#~ msgstr "No se puede escribir en %s\n"
+#~ msgid "Bacula Client: Last Job Failed"
+#~ msgstr "Bacula Cliente: Ultimo Job Fallido"
 
-#~ msgid "Error while saving"
-#~ msgstr "Error al guardar"
+#~ msgid "Bacula Client: Last Job had Warnings"
+#~ msgstr "Bacula Cliente: Ultimo Job con Advertencias"
 
 #~ msgid "Enter restore mode"
 #~ msgstr "Introduzca el modo de restauración"
@@ -14231,6 +15195,9 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Unexpected question has been received.\n"
 #~ msgstr "Pregunta inesperada ha sido recibida.\n"
 
+#~ msgid "bwx-console: unexpected restore question."
+#~ msgstr "bwx-console: inesperada consulta de restauración."
+
 #~ msgid " files selected to be restored."
 #~ msgstr "archivos seleccionados para ser restaurado."
 
@@ -14269,6 +15236,19 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Failed to retrieve jobid.\n"
 #~ msgstr "No se ha podido recuperar jobId.\n"
 
+#~ msgid ""
+#~ "Restore is scheduled to run. bwx-console will not wait for its "
+#~ "completion.\n"
+#~ msgstr ""
+#~ "Restaurar está programado para ejecutarse. bwx-consola no esperara a su "
+#~ "conclusión.\n"
+
+#~ msgid ""
+#~ "Restore is scheduled to run. bwx-console will not wait for its completion."
+#~ msgstr ""
+#~ "Restaurar está programado para ejecutarse. bwx-consola no esperara a su "
+#~ "conclusión."
+
 #~ msgid "Restore job created, but not yet running."
 #~ msgstr "Job de restauración creado, pero aún no se ejecuta."
 
@@ -14330,6 +15310,20 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ "Job de restauración está esperando por jobs de mayor prioridad para "
 #~ "finalizar."
 
+#~ msgid ""
+#~ "The restore job has not been started within one minute, bwx-console will "
+#~ "not wait for its completion anymore.\n"
+#~ msgstr ""
+#~ "El Job de restauración no se ha iniciado en el plazo de un minuto, bwx-"
+#~ "console no va a esperar para su realización más.\n"
+
+#~ msgid ""
+#~ "The restore job has not been started within one minute, bwx-console will "
+#~ "not wait for its completion anymore."
+#~ msgstr ""
+#~ "El Job de restauración no se ha iniciado en el plazo de un minuto, bwx-"
+#~ "console no va a esperar para su realización más."
+
 #~ msgid "Restore done successfully.\n"
 #~ msgstr "Restauración finalizada con suceso.\n"
 
@@ -14410,6 +15404,202 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Restoring..."
 #~ msgstr "Restaurando..."
 
+#~ msgid "Type your command below:"
+#~ msgstr "Escriba su comando a continuación:"
+
+#~ msgid "Unknown command."
+#~ msgstr "Comando desconocido."
+
+#~ msgid "Possible completions: "
+#~ msgstr "Posibles complementos:"
+
+#~ msgid "&About...\tF1"
+#~ msgstr "&Acerca de...\tF1"
+
+#~ msgid "Show about dialog"
+#~ msgstr "Mostrar diálogo Acerca de"
+
+#~ msgid "Connect"
+#~ msgstr "Conectar"
+
+#~ msgid "Connect to the director"
+#~ msgstr "Conectar con director"
+
+#~ msgid "Disconnect"
+#~ msgstr "Desconectar"
+
+#~ msgid "Disconnect of the director"
+#~ msgstr "Desconectar del director"
+
+#~ msgid "Change of configuration file"
+#~ msgstr "Cambio del archivo de configuración"
+
+#~ msgid "Change your default configuration file"
+#~ msgstr "Cambiar el archivo de configuración predeterminado"
+
+#~ msgid "Edit your configuration file"
+#~ msgstr "Edite su archivo de configuración"
+
+#~ msgid "E&xit\tAlt-X"
+#~ msgstr "E&xit\tAlt-X"
+
+#~ msgid "Quit this program"
+#~ msgstr "Salga de este programa"
+
+#~ msgid "&File"
+#~ msgstr "&Archivo"
+
+#~ msgid "&Help"
+#~ msgstr "&Ayuda"
+
+#~ msgid "Welcome to bacula bwx-console %s (%s)!\n"
+#~ msgstr "Bienvenido a bacula bwx-console %s (%s)!\n"
+
+#~ msgid ""
+#~ "Warning : Unicode is disabled because you are using wxWidgets for GTK+ "
+#~ "1.2.\n"
+#~ msgstr ""
+#~ "Advertencia: Unicode está deshabilitado porque está utilizando wxWidgets "
+#~ "para GTK+ 1.2.\n"
+
+#~ msgid ""
+#~ "Warning : There is a problem with wxWidgets for GTK+ 2.0 without Unicode "
+#~ "support when handling non-ASCII filenames: Every non-ASCII character in "
+#~ "such filenames will be replaced by an interrogation mark.\n"
+#~ "If this behaviour disturbs you, please build bwx-console against a "
+#~ "Unicode version of wxWidgets for GTK+ 2.0.\n"
+#~ "---\n"
+#~ msgstr ""
+#~ "Advertencia: Hay un problema con wxWidgets para GTK+ 2.0 sin el soporte "
+#~ "Unicode al manejar nombres de archivos no-ASCII: Cada carácter no-ASCII "
+#~ "en nombres de archivos será sustituido por un signo de interrogación.\n"
+#~ "Si este comportamiento te molesta, por favor construya bwx-consola para "
+#~ "una versión Unicode de wxWidgets para GTK+ 2.0.\n"
+#~ "---\n"
+
+#~ msgid "Send"
+#~ msgstr "Enviar"
+
+#~ msgid "Usage: bwx-console [-c configfile] [-w tmp]\n"
+#~ msgstr "Utilice: bwx-console [-c archivo_configuración] [-w tmp]\n"
+
+#~ msgid ""
+#~ "It seems that it is the first time you run bwx-console.\n"
+#~ "This file (%s) has been choosen as default configuration file.\n"
+#~ "Do you want to edit it? (if you click No you will have to select another "
+#~ "file)"
+#~ msgstr ""
+#~ "Parece que es la primera vez que ejecute bwx-consola.\n"
+#~ "Este archivo (%s) ha sido elegido como el archivo de configuración por "
+#~ "defecto.\n"
+#~ "¿Desea editar lo? (si hace clic en NO usted tendrá que seleccionar otro "
+#~ "archivo)"
+
+#~ msgid "First run"
+#~ msgstr "Primera ejecución"
+
+#~ msgid ""
+#~ "Unable to read %s\n"
+#~ "Error: %s\n"
+#~ "Do you want to choose another one? (Press no to edit this file)"
+#~ msgstr ""
+#~ "No se puede leer %s\n"
+#~ "Error: %s\n"
+#~ " ¿Deseas seleccionar otro? (Presione no para editar este archivo)"
+
+#~ msgid "Please choose a configuration file to use"
+#~ msgstr "Por favor, elija un archivo de configuración para usar"
+
+#~ msgid ""
+#~ "This configuration file has been successfully read, use it as default?"
+#~ msgstr ""
+#~ "Este archivo de configuración se ha leído correctamente, utilizar el por "
+#~ "defecto?"
+
+#~ msgid "Configuration file read successfully"
+#~ msgstr "Archivo de configuración leído correctamente"
+
+#~ msgid "Using this configuration file: %s\n"
+#~ msgstr "Usando este fichero de configuración: %s\n"
+
+#~ msgid "Connecting to the director..."
+#~ msgstr "Conectando con director..."
+
+#~ msgid "Failed to unregister a data parser !"
+#~ msgstr "Fallo al anular el registro del analizador de datos!"
+
+#~ msgid "Quitting.\n"
+#~ msgstr "Saliendo.\n"
+
+#~ msgid ""
+#~ "Welcome to Bacula bwx-console.\n"
+#~ "Written by Nicolas Boichat <nicolas at boichat.ch>\n"
+#~ "Copyright (C), 2005-2007 Free Software Foundation Europe, e.V.\n"
+#~ msgstr ""
+#~ "Bienvenido a Bacula bwx-console.\n"
+#~ "Escrito por Nicolas Boichat <nicolas at boichat.ch>\n"
+#~ "Copyright (C), 2005-2007 Free Software Foundation Europe, e.V.\n"
+
+#~ msgid "About Bacula bwx-console"
+#~ msgstr "Acerca de Bacula bwx-console"
+
+#~ msgid "Please choose your default configuration file"
+#~ msgstr "Por favor, seleccione su archivo de configuración por defecto"
+
+#~ msgid "Use this configuration file as default?"
+#~ msgstr "Utilizar este archivo de configuración por defecto?"
+
+#~ msgid "Configuration file"
+#~ msgstr "Archivo de configuración"
+
+#~ msgid "Console thread terminated."
+#~ msgstr "Hilo de Consola terminado."
+
+#~ msgid "Connection to the director lost. Quit program?"
+#~ msgstr "Conexión perdida con el director. Salir del programa?"
+
+#~ msgid "Connection lost"
+#~ msgstr "Conexión perdida"
+
+#~ msgid "Connected to the director."
+#~ msgstr "Conectado al director."
+
+#~ msgid "Reconnect"
+#~ msgstr "Reconectar"
+
+#~ msgid "Reconnect to the director"
+#~ msgstr "Reconectar al director"
+
+#~ msgid "Disconnected of the director."
+#~ msgstr "Desconectado al director."
+
+#~ msgid "bwx-console: unexpected director's question."
+#~ msgstr "bwx-console: inesperada consulta del director."
+
+#~ msgid "Config file editor"
+#~ msgstr "Editor de archivos de configuración"
+
+#~ msgid "# Bacula bwx-console Configuration File\n"
+#~ msgstr "# Bacula bwx-console Archivo de Configuración\n"
+
+#~ msgid "Save and close"
+#~ msgstr "Guardar y cerrar"
+
+#~ msgid "Close without saving"
+#~ msgstr "Cerrar sin guardar"
+
+#~ msgid "Unable to write to %s\n"
+#~ msgstr "No se puede escribir en %s\n"
+
+#~ msgid "Error while saving"
+#~ msgstr "Error al guardar"
+
+#~ msgid "Bacula bwx-console"
+#~ msgstr "Bacula bwx-console"
+
+#~ msgid "Apply"
+#~ msgstr "Aplicar"
+
 #~ msgid ""
 #~ "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined "
 #~ "for Director \"%s\" in config file.\n"
@@ -14484,182 +15674,234 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ msgid "Connection terminated\n"
 #~ msgstr "Conexión terminada\n"
 
-#~ msgid "Apply"
-#~ msgstr "Aplicar"
+#~ msgid "%6d %-6s  %-20s %s\n"
+#~ msgstr "%6d %-6s %-20s %s\n"
 
-#~ msgid "Type your command below:"
-#~ msgstr "Escriba su comando a continuación:"
+#, fuzzy
+#~ msgid "               %-30s\n"
+#~ msgstr "Job : %s\n"
 
-#~ msgid "Unknown command."
-#~ msgstr "Comando desconocido."
+#~ msgid "More than one Filename! %s for file: %s\n"
+#~ msgstr "Mas de un nombre de Archivo! %s para el archivo: %s\n"
 
-#~ msgid "Possible completions: "
-#~ msgstr "Posibles complementos:"
+#~ msgid "Error fetching row for file=%s: ERR=%s\n"
+#~ msgstr "Error al obtener fila para el archivo=%s: ERR=%s\n"
 
-#~ msgid "&About...\tF1"
-#~ msgstr "&Acerca de...\tF1"
+#~ msgid "Create db Filename record %s failed. ERR=%s\n"
+#~ msgstr "Creación del registro Filename db %s fallido. ERR=%s\n"
 
-#~ msgid "Show about dialog"
-#~ msgstr "Mostrar diálogo Acerca de"
+#~ msgid "More than one Filename!: %s for file: %s\n"
+#~ msgstr "Más de un Filename!: %s en archivo: %s\n"
 
-#~ msgid "Connect"
-#~ msgstr "Conectar"
+#~ msgid "Get DB Filename record %s found bad record: %d\n"
+#~ msgstr "Obtener registro BD Filename %s encuentro registro malo: %d\n"
 
-#~ msgid "Connect to the director"
-#~ msgstr "Conectar con director"
+#~ msgid "Filename record: %s not found.\n"
+#~ msgstr "Registro Filename: %s no encontrado.\n"
 
-#~ msgid "Disconnect"
-#~ msgstr "Desconectar"
+#~ msgid "Filename record: %s not found in Catalog.\n"
+#~ msgstr "Registro Filename: %s no encontrado en Catalogo.\n"
 
-#~ msgid "Disconnect of the director"
-#~ msgstr "Desconectar del director"
+#~ msgid "Checking for duplicate Filename entries.\n"
+#~ msgstr "Comprobando entradas Nombre de Archivo(Filename) duplicadas.\n"
 
-#~ msgid "Change of configuration file"
-#~ msgstr "Cambio del archivo de configuración"
+#~ msgid "Found %d duplicate Filename records.\n"
+#~ msgstr "Encontrados %d registros Nombre de Archivo(Filename) duplicados.\n"
 
-#~ msgid "Change your default configuration file"
-#~ msgstr "Cambiar el archivo de configuración predeterminado"
+#~ msgid "Print the list? (yes/no): "
+#~ msgstr "Imprimir la lista? (sí/no):"
 
-#~ msgid "Edit your configuration file"
-#~ msgstr "Edite su archivo de configuración"
+#~ msgid "Checking for orphaned Filename entries. This may take some time!\n"
+#~ msgstr ""
+#~ "Comprobando de entradas de Nombre de Archivo huérfanos. Esto puede tomar "
+#~ "algún tiempo!\n"
 
-#~ msgid "E&xit\tAlt-X"
-#~ msgstr "E&xit\tAlt-X"
+#~ msgid "Found %d orphaned Filename records.\n"
+#~ msgstr "Se han encontrado %d registros de Nombre de Archivos huérfanos.\n"
 
-#~ msgid "Quit this program"
-#~ msgstr "Salga de este programa"
+#~ msgid "Deleting %d orphaned Filename records.\n"
+#~ msgstr "Eliminando %d registros de Nombre de Archivos huérfanos.\n"
 
-#~ msgid "&File"
-#~ msgstr "&Archivo"
+#~ msgid "Checking for Filenames with a trailing slash\n"
+#~ msgstr "Comprobando Nombres de Archivo con una barra diagonal\n"
 
-#~ msgid "&Help"
-#~ msgstr "&Ayuda"
+#~ msgid "Found %d bad Filename records.\n"
+#~ msgstr "Se han encontrado %d malos registros de Nombre de Archivo.\n"
 
-#~ msgid "Send"
-#~ msgstr "Enviar"
+#~ msgid "1992 Update Media error. VolFiles=%u, CatFiles=%u\n"
+#~ msgstr "1992 Error de actualización de Media. VolFiles=%u, CatFiles=%u\n"
+
+#~ msgid "Could not open: %s, ERR=%s\n"
+#~ msgstr "No se pudo abrir: %s, ERR=%s\n"
+
+#~ msgid ""
+#~ "Error writing final part to DVD. This Volume may not be readable.\n"
+#~ "%s"
+#~ msgstr ""
+#~ "Error al escribir la parte final a DVD. Este volumen puede no ser "
+#~ "legible.\n"
+#~ "%s"
+
+#, fuzzy
+#~ msgid "%s blocks of %lld changed during backup to %lld.\n"
+#~ msgstr "%s tamaño cambiado durante la copia de seguridad.\n"
+
+#, fuzzy
+#~ msgid "Unable to read %s. ERR=%s\n"
+#~ msgstr "No se pudo escribir EOF. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to write to %s. ERR=%s\n"
+#~ msgstr "No se puede escribir última en %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to get the Full job for %s\n"
+#~ msgstr "No se pudo obtener registro de Job. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to write to %s to save full job name. ERR=%s\n"
+#~ msgstr "No se puede escribir última en %s: ERR=%s\n"
 
-#~ msgid "Error while parsing command line arguments, using defaults.\n"
-#~ msgstr ""
-#~ "Error al analizar los argumentos de línea de comandos, usando valores por "
-#~ "defecto.\n"
+#, fuzzy
+#~ msgid "Unable to %s exitcode=%d\n"
+#~ msgstr "No se puede stat dispositivo %s: ERR=%s\n"
 
-#~ msgid "First run"
-#~ msgstr "Primera ejecución"
+#, fuzzy
+#~ msgid "Unable to save last controlfile into file %s. ERR=%s\n"
+#~ msgstr "No se puede crear el archivo bootstrap %s. ERR=%s\n"
 
-#~ msgid ""
-#~ "Unable to read %s\n"
-#~ "Error: %s\n"
-#~ "Do you want to choose another one? (Press no to edit this file)"
-#~ msgstr ""
-#~ "No se puede leer %s\n"
-#~ "Error: %s\n"
-#~ " ¿Deseas seleccionar otro? (Presione no para editar este archivo)"
+#, fuzzy
+#~ msgid "Unable to create  %s "
+#~ msgstr "No se puede escribir en %s\n"
 
-#~ msgid "Unable to read configuration file"
-#~ msgstr "No es posible leer el archivo de configuración"
+#, fuzzy
+#~ msgid "Unable to save last SCN into file %s. ERR=%s\n"
+#~ msgstr "No se puede crear el archivo bootstrap %s. ERR=%s\n"
 
-#~ msgid "Please choose a configuration file to use"
-#~ msgstr "Por favor, elija un archivo de configuración para usar"
+#, fuzzy
+#~ msgid "Cannot find last control file ret=%d\n"
+#~ msgstr "No se puedo encontrar atributo %s"
 
-#~ msgid ""
-#~ "This configuration file has been successfully read, use it as default?"
-#~ msgstr ""
-#~ "Este archivo de configuración se ha leído correctamente, utilizar el por "
-#~ "defecto?"
+#, fuzzy
+#~ msgid "Can't open /etc/oratab. ERR=%s\n"
+#~ msgstr "No se puede abrir el archivo %s para entrada. ERR=%s\n"
 
-#~ msgid "Configuration file read successfully"
-#~ msgstr "Archivo de configuración leído correctamente"
+#, fuzzy
+#~ msgid "Unable to list schema for %s. exitcode=%d\n"
+#~ msgstr "No se puede instalar el servicio"
 
-#~ msgid "Using this configuration file: %s\n"
-#~ msgstr "Usando este fichero de configuración: %s\n"
+#, fuzzy
+#~ msgid "Can't open %s. ERR=%s\n"
+#~ msgstr "No se puede abrir el archivo %s: ERR=%s\n"
 
-#~ msgid "Connecting to the director..."
-#~ msgstr "Conectando con director..."
+#, fuzzy
+#~ msgid "Error occured while selecting instance.\n"
+#~ msgstr "A ocurrido un error al cifrar el stream.\n"
 
-#~ msgid "Failed to unregister a data parser !"
-#~ msgstr "Fallo al anular el registro del analizador de datos!"
+#, fuzzy
+#~ msgid "Job Level not supported.\n"
+#~ msgstr "JobLevel aún no se han implementado\n"
 
-#~ msgid "Quitting.\n"
-#~ msgstr "Saliendo.\n"
+#, fuzzy
+#~ msgid "Calling RMAN for %s\n"
+#~ msgstr "Llamando: %s %s %s %s\n"
 
-#~ msgid "Please choose your default configuration file"
-#~ msgstr "Por favor, seleccione su archivo de configuración por defecto"
+#, fuzzy
+#~ msgid "Unable to open %s to save RMAN output. ERR=%s\n"
+#~ msgstr "No se puede abrir archivo %s: ERR=%s\n"
 
-#~ msgid "Use this configuration file as default?"
-#~ msgstr "Utilizar este archivo de configuración por defecto?"
+#, fuzzy
+#~ msgid "Error occured while dumping users list ERR=%s\n"
+#~ msgstr "Error leyendo archivo %s: ERR=%s\n"
 
-#~ msgid "Configuration file"
-#~ msgstr "Archivo de configuración"
+#, fuzzy
+#~ msgid "Error occured while dumping datafiles ERR=%s\n"
+#~ msgstr "Error leyendo archivo %s: ERR=%s\n"
 
-#~ msgid "Console thread terminated."
-#~ msgstr "Hilo de Consola terminado."
+#, fuzzy
+#~ msgid "Error occured while dumping tempfiles ERR=%s\n"
+#~ msgstr "Error leyendo archivo %s: ERR=%s\n"
 
-#~ msgid "Connection to the director lost. Quit program?"
-#~ msgstr "Conexión perdida con el director. Salir del programa?"
+#, fuzzy
+#~ msgid "Error occured while dumping logfiles ERR=%s\n"
+#~ msgstr "Error leyendo archivo %s: ERR=%s\n"
 
-#~ msgid "Connection lost"
-#~ msgstr "Conexión perdida"
+#, fuzzy
+#~ msgid "Error occured while dumping tables definition ERR=%s\n"
+#~ msgstr "Error enviando para demonio File. ERR=%s\n"
 
-#~ msgid "Connected to the director."
-#~ msgstr "Conectado al director."
+#, fuzzy
+#~ msgid "Can't create pipe to discuss with Oracle. ERR=%s\n"
+#~ msgstr "No se puede crear directorio %s: ERR=%s\n"
 
-#~ msgid "Reconnect"
-#~ msgstr "Reconectar"
+#, fuzzy
+#~ msgid ""
+#~ "Unable to copy schema \"%s\" to \"%s\" ret=%d\n"
+#~ "%s\n"
+#~ msgstr "No se puede abrir xattr %s en \"%s\": ERR=%s\n"
 
-#~ msgid "Reconnect to the director"
-#~ msgstr "Reconectar al director"
+#~ msgid "Disable a job"
+#~ msgstr "Deshabilitar un job"
 
-#~ msgid "Disconnected of the director."
-#~ msgstr "Desconectado al director."
+#~ msgid "Enable a job"
+#~ msgstr "Habilitar un job"
 
-#~ msgid "Using Device \"%s\"\n"
-#~ msgstr "Usando Dispositivo \"%s\"\n"
+#, fuzzy
+#~ msgid "Failed to initialize database backend\n"
+#~ msgstr "Fallo al inicializar el contexto de cifrado.\n"
 
-#~ msgid ""
-#~ "====\n"
-#~ "\n"
-#~ msgstr ""
-#~ "====\n"
-#~ "\n"
+#~ msgid "disabled"
+#~ msgstr "deshabilitado"
+
+#~ msgid "Name item is required in %s resource, but not found.\n"
+#~ msgstr "Nombre del ítem se requiere en recurso %s, pero no se encuentra.\n"
 
 #~ msgid "    Drive %d status unknown.\n"
 #~ msgstr "Unidad %d estado desconocido.\n"
 
-#~ msgid "    Files=%s Bytes=%s Bytes/sec=%s\n"
-#~ msgstr "Archivos=%s Bytes=%s Bytes/sec=%s\n"
-
-#~ msgid "3900 Bad .status command, missing argument.\n"
-#~ msgstr "3900 Malo comando .status, falta argumentos.\n"
-
-#~ msgid "3900 Bad .status command, wrong argument.\n"
-#~ msgstr "3900 Malo comando .status, argumentos incorrectos.\n"
+#~ msgid "Want to append, but device %s is busy reading.\n"
+#~ msgstr "Esperando anexar, pero el dispositivo %s está ocupado leyendo.\n"
 
-#~ msgid "Device switch. New device %s chosen.\n"
-#~ msgstr "Cambiar Dispositivo. Seleccione nuevo dispositivo %s.\n"
+#~ msgid "Append data error.\n"
+#~ msgstr "Error al añadir datos.\n"
 
 #~ msgid ""
-#~ "Media Type not the same for all devices in changer %s. Cannot continue.\n"
-#~ msgstr ""
-#~ "Tipo de Media no es el mismo para todos los dispositivos en el cambiador "
-#~ "%s. No se puede continuar.\n"
-
-#~ msgid "Network buffer size %d not multiple of tape block size.\n"
+#~ "Attempt to define second \"%s\" resource named \"%s\" is not permitted.\n"
 #~ msgstr ""
-#~ "Tamaño del buffer de red %d no múltiplo del tamaño de bloque de cinta.\n"
+#~ "Intento para definir secundo recurso \"%s\" denominado \"%s\" no está "
+#~ "permitido.\n"
 
 #, fuzzy
 #~ msgid "Attempt to set StorageId to zero.\n"
 #~ msgstr "Intento de abrir sesión ya abierta.\n"
 
+#~ msgid "Using Device \"%s\"\n"
+#~ msgstr "Usando Dispositivo \"%s\"\n"
+
+#~ msgid "Device switch. New device %s chosen.\n"
+#~ msgstr "Cambiar Dispositivo. Seleccione nuevo dispositivo %s.\n"
+
+#~ msgid "End of physical tape.\n"
+#~ msgstr "Fin de la cinta física.\n"
+
+#~ msgid "part"
+#~ msgstr "parte"
+
+#~ msgid "file"
+#~ msgstr "archivo"
+
+#~ msgid "End of %s %u on device %s, Volume \"%s\"\n"
+#~ msgstr "Fin de %s %u en dispositivo %s, Volumen \"%s\"\n"
+
 #~ msgid "open_next_part can't unlink existing part %s, ERR=%s\n"
 #~ msgstr "open_next_part no se puede desvincular parte %s existente, ERR=%s\n"
 
-#~ msgid "Plugin load %s failed: ERR=%s\n"
-#~ msgstr "Fallo carga de Plugin %s: ERR=%s\n"
+#~ msgid "Damaged buffer\n"
+#~ msgstr "Buffer dañado\n"
 
-#, fuzzy
-#~ msgid "VSS Writer (PreRestore): %s\n"
-#~ msgstr "VSS Writer (PrepareForBackup): %s\n"
+#~ msgid "Network buffer size %d not multiple of tape block size.\n"
+#~ msgstr ""
+#~ "Tamaño del buffer de red %d no múltiplo del tamaño de bloque de cinta.\n"
 
 #~ msgid ""
 #~ "Authorization key rejected by Storage daemon.\n"
@@ -14670,6 +15912,24 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ "Por favor, consulte http://www.bacula.org/en/rel-manual/"
 #~ "Bacula_Freque_Asked_Questi.html#SECTION003760000000000000000 para ayuda.\n"
 
+#~ msgid "Record header file index %ld not equal record index %ld\n"
+#~ msgstr ""
+#~ "Archivo de registro de encabezado de índice %ld no es igual índice de "
+#~ "registro %ld\n"
+
+#~ msgid ""
+#~ "Generate VSS snapshot of drive \"%c:\\\" failed. VSS support is disabled "
+#~ "on this drive.\n"
+#~ msgstr ""
+#~ "Fallo al generar instantáneas(snapshots) VSS de la unidad \"%c:\\\". "
+#~ "Suporte VSS está deshabilitado en esta unidad.\n"
+
+#~ msgid "Malformed plugin command. Name not terminated by colon: %s\n"
+#~ msgstr "Comando plugin incorrecto. Nombre no terminado por dos puntos: %s\n"
+
+#~ msgid "Daemon started %s, %d Job%s run since started.\n"
+#~ msgstr "Demonio iniciado %s, %d Job%s ejecutados desde el inicio.\n"
+
 #~ msgid ""
 #~ "Director and Storage daemon passwords or names not the same.\n"
 #~ "Please see http://www.bacula.org/en/rel-manual/Bacula_Freque_Asked_Questi."
@@ -14689,9 +15949,40 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ " Por favor vea http://www.bacula.org/en/rel-manual/"
 #~ "Bacula_Freque_Asked_Questi.html#SECTION003760000000000000000 para ayuda.\n"
 
+#~ msgid "A dbi driver for DBI must be supplied.\n"
+#~ msgstr "Un driver dbi para DBI debe ser suministrado.\n"
+
 #~ msgid "Buffer overrun called from %s:%d\n"
 #~ msgstr "Desbordamiento de Buffer llamado desde  %s:%d\n"
 
+#~ msgid "%s buffer:  %s %6u bytes buf=%p allocated at %s:%d\n"
+#~ msgstr "%s buffer: %s %6u bytes buf=%p alocado en %s:%d\n"
+
+#~ msgid "Plugin load %s failed: ERR=%s\n"
+#~ msgstr "Fallo carga de Plugin %s: ERR=%s\n"
+
+#~ msgid ""
+#~ "Cancel: %s\n"
+#~ "\n"
+#~ "%s"
+#~ msgstr ""
+#~ "Cancelar: %s\n"
+#~ "\n"
+#~ "%s"
+
+#~ msgid "Confirm cancel?"
+#~ msgstr "Confirmar cancelar?"
+
+#~ msgid "Max sched run time exceeded. Job canceled.\n"
+#~ msgstr ""
+#~ "tiempo de ejecución máximo programado se ha superado. Job cancelado\n"
+
+#~ msgid "OSF1 Specific Default ACL attribs"
+#~ msgstr "Atributos ACL por defecto específicos de OSF1"
+
+#~ msgid "OSF1 Specific Access ACL attribs"
+#~ msgstr "Atributos ACL de acceso específicos de OSF1"
+
 #~ msgid ""
 #~ "Connection from unknown Director %s at %s rejected.\n"
 #~ "Please see http://www.bacula.org/en/rel-manual/Bacula_Freque_Asked_Questi."
@@ -14719,48 +16010,27 @@ msgstr "Tipo de recurso desconocido %d en  save_resource.\n"
 #~ "Por favor, consulte http://www.bacula.org/en/rel-manual/"
 #~ "Bacula_Freque_Asked_Questi.html#SECTION003760000000000000000 para ayuda.\n"
 
-#~ msgid "Record header file index %ld not equal record index %ld\n"
-#~ msgstr ""
-#~ "Archivo de registro de encabezado de índice %ld no es igual índice de "
-#~ "registro %ld\n"
-
 #~ msgid ""
-#~ "Generate VSS snapshot of drive \"%c:\\\" failed. VSS support is disabled "
-#~ "on this drive.\n"
+#~ "Media Type not the same for all devices in changer %s. Cannot continue.\n"
 #~ msgstr ""
-#~ "Fallo al generar instantáneas(snapshots) VSS de la unidad \"%c:\\\". "
-#~ "Suporte VSS está deshabilitado en esta unidad.\n"
-
-#~ msgid "Malformed plugin command. Name not terminated by colon: %s\n"
-#~ msgstr "Comando plugin incorrecto. Nombre no terminado por dos puntos: %s\n"
-
-#~ msgid "Daemon started %s, %d Job%s run since started.\n"
-#~ msgstr "Demonio iniciado %s, %d Job%s ejecutados desde el inicio.\n"
-
-#~ msgid "A dbi driver for DBI must be supplied.\n"
-#~ msgstr "Un driver dbi para DBI debe ser suministrado.\n"
-
-#~ msgid "%s buffer:  %s %6u bytes buf=%p allocated at %s:%d\n"
-#~ msgstr "%s buffer: %s %6u bytes buf=%p alocado en %s:%d\n"
+#~ "Tipo de Media no es el mismo para todos los dispositivos en el cambiador "
+#~ "%s. No se puede continuar.\n"
 
-#~ msgid "Daemon started %s, 1 Job run since started.\n"
-#~ msgstr "Demonio iniciado %s, 1 Job ejecutando desde el inicio.\n"
+#~ msgid "3905 Bizarre wait state %d\n"
+#~ msgstr "3905 Extraño estado de espera %d\n"
 
-#~ msgid "Max sched run time exceeded. Job canceled.\n"
+#~ msgid ""
+#~ "====\n"
+#~ "\n"
 #~ msgstr ""
-#~ "tiempo de ejecución máximo programado se ha superado. Job cancelado\n"
-
-#~ msgid "OSF1 Specific Default ACL attribs"
-#~ msgstr "Atributos ACL por defecto específicos de OSF1"
-
-#~ msgid "OSF1 Specific Access ACL attribs"
-#~ msgstr "Atributos ACL de acceso específicos de OSF1"
+#~ "====\n"
+#~ "\n"
 
-#~ msgid "3000 Job %s marked to be canceled.\n"
-#~ msgstr "3000 Job %s marcados para ser cancelados.\n"
+#~ msgid "3900 Bad .status command, missing argument.\n"
+#~ msgstr "3900 Malo comando .status, falta argumentos.\n"
 
-#~ msgid "3905 Bizarre wait state %d\n"
-#~ msgstr "3905 Extraño estado de espera %d\n"
+#~ msgid "3900 Bad .status command, wrong argument.\n"
+#~ msgstr "3900 Malo comando .status, argumentos incorrectos.\n"
 
 #~ msgid ""
 #~ "Write part command must be defined for a device which requires mount.\n"
diff --git a/po/es_AR.po b/po/es_AR.po
index efd60b2..a83038d 100644
--- a/po/es_AR.po
+++ b/po/es_AR.po
@@ -1,8 +1,7 @@
 # Spanish translations for branch package
 # Traducciones al espa�ol para el paquete branch.
-# Copyright (C) 2006-2014 Free Software Foundation Europe e.V.
-# This file is distributed under the same license as the branch package.
-#  <kern at sibbald.com>, 2006.
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #
 msgid ""
 msgstr ""
@@ -557,7 +556,7 @@ msgstr ""
 #: src/console/authenticate.c:100 src/dird/authenticate.c:106
 #: src/dird/authenticate.c:206 src/filed/authenticate.c:119
 #: src/filed/authenticate.c:215 src/stored/authenticate.c:128
-#: src/stored/authenticate.c:232
+#: src/stored/authenticate.c:232 src/wx-console/authenticate.c:106
 msgid ""
 "Authorization problem: Remote server did not advertise required TLS "
 "support.\n"
@@ -566,24 +565,26 @@ msgstr ""
 #: src/console/authenticate.c:107 src/dird/authenticate.c:113
 #: src/dird/authenticate.c:213 src/filed/authenticate.c:127
 #: src/filed/authenticate.c:223 src/stored/authenticate.c:136
-#: src/stored/authenticate.c:240
+#: src/stored/authenticate.c:240 src/wx-console/authenticate.c:112
 msgid "Authorization problem: Remote server requires TLS.\n"
 msgstr ""
 
-#: src/console/authenticate.c:117
+#: src/console/authenticate.c:117 src/wx-console/authenticate.c:121
 msgid "TLS negotiation failed\n"
 msgstr ""
 
-#: src/console/authenticate.c:129
+#: src/console/authenticate.c:129 src/gnome2-console/authenticate.c:85
+#: src/tray-monitor/authenticate.c:87
 #, c-format
 msgid "Bad response to Hello command: ERR=%s\n"
 msgstr ""
 
-#: src/console/authenticate.c:136
+#: src/console/authenticate.c:136 src/gnome2-console/authenticate.c:95
+#: src/tray-monitor/authenticate.c:94 src/wx-console/authenticate.c:136
 msgid "Director rejected Hello command\n"
 msgstr ""
 
-#: src/console/authenticate.c:146
+#: src/console/authenticate.c:146 src/wx-console/authenticate.c:146
 msgid ""
 "Director authorization problem.\n"
 "Most likely the passwords do not agree.\n"
@@ -596,7 +597,7 @@ msgstr ""
 #: src/console/console.c:102
 #, c-format
 msgid ""
-"Copyright (C) 2000-2005 Kern Sibbald\n"
+"Copyright (C) 2000-2015 Kern Sibbald
 "\n"
 "Version: "
 msgstr ""
@@ -661,11 +662,12 @@ msgid ": is an illegal command\n"
 msgstr ""
 
 #: src/console/console.c:400 src/filed/filed.c:183
+#: src/gnome2-console/console.c:271
 msgid "TLS library initialization failed.\n"
 msgstr ""
 
 #: src/console/console.c:404 src/dird/dird.c:200 src/dird/dird.c:410
-#: src/dird/dird.c:413 src/filed/filed.c:188
+#: src/dird/dird.c:413 src/filed/filed.c:188 src/gnome2-console/console.c:275
 #: src/stored/stored.c:193
 #, c-format
 msgid "Please correct configuration file: %s\n"
@@ -689,17 +691,19 @@ msgstr ""
 msgid "You must enter a number between 1 and %d\n"
 msgstr ""
 
-#: src/console/console.c:455
+#: src/console/console.c:455 src/tray-monitor/tray-monitor.c:858
 #, c-format
 msgid "Connecting to Director %s:%d\n"
 msgstr ""
 
-#: src/console/console.c:471
+#: src/console/console.c:471 src/gnome2-console/console.c:504
+#: src/wx-console/console_thread.cpp:370
 #, c-format
 msgid "Failed to initialize TLS context for Console \"%s\".\n"
 msgstr ""
 
-#: src/console/console.c:492
+#: src/console/console.c:492 src/gnome2-console/console.c:526
+#: src/wx-console/console_thread.cpp:391
 #, c-format
 msgid "Failed to initialize TLS context for Director \"%s\".\n"
 msgstr ""
@@ -711,25 +715,27 @@ msgstr ""
 #: src/console/console.c:582 src/console/console.c:611 src/dird/dird.c:496
 #: src/dird/dird.c:711 src/dird/dird.c:777 src/dird/dird.c:829
 #: src/filed/filed.c:302 src/filed/filed.c:348
-#: src/stored/stored.c:309
+#: src/gnome2-console/console.c:140 src/gnome2-console/console.c:169
+#: src/stored/stored.c:309 src/wx-console/console_thread.cpp:94
+#: src/wx-console/console_thread.cpp:120
 msgid "TLS required but not configured in Bacula.\n"
 msgstr ""
 
-#: src/console/console.c:589
+#: src/console/console.c:589 src/gnome2-console/console.c:147
 #, c-format
 msgid ""
 "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined for "
 "Director \"%s\" in %s. At least one CA certificate store is required.\n"
 msgstr ""
 
-#: src/console/console.c:598
+#: src/console/console.c:598 src/gnome2-console/console.c:156
 #, c-format
 msgid ""
 "No Director resource defined in %s\n"
 "Without that I don't how to speak to the Director :-(\n"
 msgstr ""
 
-#: src/console/console.c:618
+#: src/console/console.c:618 src/gnome2-console/console.c:176
 #, c-format
 msgid ""
 "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined for "
@@ -758,17 +764,19 @@ msgstr ""
 msgid "Cannot open file %s for output. ERR=%s\n"
 msgstr ""
 
-#: src/console/console_conf.c:123
+#: src/console/console_conf.c:123 src/gnome2-console/console_conf.c:122
+#: src/wx-console/console_conf.c:128
 #, c-format
 msgid "No record for %d %s\n"
 msgstr ""
 
-#: src/console/console_conf.c:132
+#: src/console/console_conf.c:132 src/wx-console/console_conf.c:137
 #, c-format
 msgid "Console: name=%s rcfile=%s histfile=%s\n"
 msgstr ""
 
-#: src/console/console_conf.c:136
+#: src/console/console_conf.c:136 src/gnome2-console/console_conf.c:131
+#: src/wx-console/console_conf.c:141
 #, c-format
 msgid "Director: name=%s address=%s DIRport=%d\n"
 msgstr ""
@@ -776,20 +784,27 @@ msgstr ""
 #: src/console/console_conf.c:140 src/console/console_conf.c:216
 #: src/console/console_conf.c:261 src/console/console_conf.c:288
 #: src/filed/filed_conf.c:268 src/filed/filed_conf.c:327
-#: src/filed/filed_conf.c:357 src/stored/stored_conf.c:510
+#: src/filed/filed_conf.c:357 src/gnome2-console/console_conf.c:142
+#: src/gnome2-console/console_conf.c:220 src/gnome2-console/console_conf.c:268
+#: src/gnome2-console/console_conf.c:298 src/stored/stored_conf.c:510
 #: src/stored/stored_conf.c:598 src/stored/stored_conf.c:633
+#: src/wx-console/console_conf.c:145 src/wx-console/console_conf.c:220
+#: src/wx-console/console_conf.c:265 src/wx-console/console_conf.c:292
 #, c-format
 msgid "Unknown resource type %d\n"
 msgstr ""
 
 #: src/console/console_conf.c:242 src/dird/dird_conf.c:1112
 #: src/dird/dird_conf.c:1127 src/filed/filed_conf.c:296
+#: src/gnome2-console/console_conf.c:246 src/tray-monitor/tray_conf.c:262
+#: src/wx-console/console_conf.c:246
 #, c-format
 msgid "%s item is required in %s resource, but not found.\n"
 msgstr ""
 
 #: src/console/console_conf.c:304 src/dird/dird_conf.c:1299
-#: src/filed/filed_conf.c:374
+#: src/filed/filed_conf.c:374 src/gnome2-console/console_conf.c:314
+#: src/tray-monitor/tray_conf.c:341 src/wx-console/console_conf.c:308
 #, c-format
 msgid "Attempt to define second %s resource named \"%s\" is not permitted.\n"
 msgstr ""
@@ -839,6 +854,7 @@ msgid ""
 msgstr ""
 
 #: src/dird/authenticate.c:67 src/dird/authenticate.c:68
+#: src/tray-monitor/authenticate.c:121
 #, c-format
 msgid "Error sending Hello to Storage daemon. ERR=%s\n"
 msgstr ""
@@ -864,16 +880,17 @@ msgstr ""
 msgid "TLS negotiation failed.\n"
 msgstr ""
 
-#: src/dird/authenticate.c:132
+#: src/dird/authenticate.c:132 src/tray-monitor/authenticate.c:134
 #, c-format
 msgid "bdird<stored: bad response to Hello command: ERR=%s\n"
 msgstr ""
 
 #: src/dird/authenticate.c:139 src/dird/authenticate.c:140
+#: src/tray-monitor/authenticate.c:141
 msgid "Storage daemon rejected Hello command\n"
 msgstr ""
 
-#: src/dird/authenticate.c:167
+#: src/dird/authenticate.c:167 src/tray-monitor/authenticate.c:166
 #, c-format
 msgid "Error sending Hello to File daemon. ERR=%s\n"
 msgstr ""
@@ -893,11 +910,13 @@ msgid ""
 msgstr ""
 
 #: src/dird/authenticate.c:232 src/dird/authenticate.c:234
+#: src/tray-monitor/authenticate.c:179
 #, c-format
 msgid "Bad response from File daemon to Hello command: ERR=%s\n"
 msgstr ""
 
 #: src/dird/authenticate.c:241 src/dird/authenticate.c:242
+#: src/tray-monitor/authenticate.c:186
 msgid "File daemon rejected Hello command\n"
 msgstr ""
 
@@ -1185,7 +1204,7 @@ msgstr ""
 #: src/dird/dird.c:71
 #, c-format
 msgid ""
-"Copyright (C) 2000-2005 Kern Sibbald.\n"
+"Copyright (C) 2000-2015 Kern Sibbald
 "\n"
 "Version: %s (%s)\n"
 "\n"
@@ -1331,7 +1350,7 @@ msgid ""
 "File daemon \"%s\" in %s.\n"
 msgstr ""
 
-#: src/dird/dird_conf.c:443
+#: src/dird/dird_conf.c:443 src/tray-monitor/tray_conf.c:152
 #, c-format
 msgid "No %s resource defined\n"
 msgstr ""
@@ -1551,17 +1570,18 @@ msgstr ""
 msgid "      opcmd=%s\n"
 msgstr ""
 
-#: src/dird/dird_conf.c:786
+#: src/dird/dird_conf.c:786 src/tray-monitor/tray_conf.c:179
 #, c-format
 msgid "Unknown resource type %d in dump_resource.\n"
 msgstr ""
 
-#: src/dird/dird_conf.c:1080
+#: src/dird/dird_conf.c:1080 src/tray-monitor/tray_conf.c:232
 #, c-format
 msgid "Unknown resource type %d in free_resource.\n"
 msgstr ""
 
 #: src/dird/dird_conf.c:1118 src/lib/parse_conf.c:211
+#: src/tray-monitor/tray_conf.c:268
 #, c-format
 msgid "Too many items in %s resource\n"
 msgstr ""
@@ -1602,12 +1622,12 @@ msgstr ""
 msgid "Cannot find Schedule resource %s\n"
 msgstr ""
 
-#: src/dird/dird_conf.c:1217
+#: src/dird/dird_conf.c:1217 src/tray-monitor/tray_conf.c:287
 #, c-format
 msgid "Unknown resource type %d in save_resource.\n"
 msgstr ""
 
-#: src/dird/dird_conf.c:1277
+#: src/dird/dird_conf.c:1277 src/tray-monitor/tray_conf.c:322
 #, c-format
 msgid "Unknown resource type %d in save_resrouce.\n"
 msgstr ""
@@ -1672,7 +1692,7 @@ msgstr ""
 msgid "Cannot destroy var context: ERR=%s\n"
 msgstr ""
 
-#: src/dird/fd_cmds.c:73
+#: src/dird/fd_cmds.c:73 src/tray-monitor/tray-monitor.c:867
 msgid "File daemon"
 msgstr ""
 
@@ -2047,6 +2067,7 @@ msgid ""
 msgstr ""
 
 #: src/dird/msgchan.c:78 src/filed/job.c:1129
+#: src/tray-monitor/tray-monitor.c:874
 msgid "Storage daemon"
 msgstr ""
 
@@ -3388,7 +3409,7 @@ msgid "Enter a list of directories to restore for found JobIds"
 msgstr ""
 
 #: src/dird/ua_restore.c:297 src/dird/ua_status.c:713 src/filed/status.c:251
-#: src/stored/status.c:412
+#: src/stored/status.c:412 src/wx-console/wxbconfigpanel.cpp:191
 msgid "Cancel"
 msgstr ""
 
@@ -3895,23 +3916,53 @@ msgid "Level"
 msgstr ""
 
 #: src/dird/ua_run.c:642 src/dird/ua_select.c:152
+#: src/wx-console/wxbrestorepanel.cpp:321
+#: src/wx-console/wxbrestorepanel.cpp:337
+#: src/wx-console/wxbrestorepanel.cpp:458
+#: src/wx-console/wxbrestorepanel.cpp:459
+#: src/wx-console/wxbrestorepanel.cpp:469
+#: src/wx-console/wxbrestorepanel.cpp:470
+#: src/wx-console/wxbrestorepanel.cpp:1133
+#: src/wx-console/wxbrestorepanel.cpp:1794
+#: src/wx-console/wxbrestorepanel.cpp:1865
 msgid "Storage"
 msgstr ""
 
 #: src/dird/ua_run.c:645 src/dird/ua_select.c:282 src/dird/ua_select.c:391
+#: src/wx-console/wxbrestorepanel.cpp:318
+#: src/wx-console/wxbrestorepanel.cpp:336
+#: src/wx-console/wxbrestorepanel.cpp:410
+#: src/wx-console/wxbrestorepanel.cpp:411
+#: src/wx-console/wxbrestorepanel.cpp:421
+#: src/wx-console/wxbrestorepanel.cpp:422
+#: src/wx-console/wxbrestorepanel.cpp:669
+#: src/wx-console/wxbrestorepanel.cpp:1103
+#: src/wx-console/wxbrestorepanel.cpp:1190
+#: src/wx-console/wxbrestorepanel.cpp:1787
+#: src/wx-console/wxbrestorepanel.cpp:1789
+#: src/wx-console/wxbrestorepanel.cpp:1863
+#: src/wx-console/wxbrestorepanel.cpp:1918
 msgid "Client"
 msgstr ""
 
-#: src/dird/ua_run.c:646
+#: src/dird/ua_run.c:646 src/wx-console/wxbrestorepanel.cpp:338
+#: src/wx-console/wxbrestorepanel.cpp:823
+#: src/wx-console/wxbrestorepanel.cpp:1867
 msgid "When"
 msgstr ""
 
-#: src/dird/ua_run.c:647
+#: src/dird/ua_run.c:647 src/wx-console/wxbrestorepanel.cpp:339
+#: src/wx-console/wxbrestorepanel.cpp:1096
+#: src/wx-console/wxbrestorepanel.cpp:1869
 msgid "Priority"
 msgstr ""
 
 #: src/dird/ua_run.c:650 src/dird/ua_select.c:476 src/dird/ua_select.c:566
 #: src/dird/ua_update.c:400 src/dird/ua_update.c:475
+#: src/wx-console/wxbrestorepanel.cpp:320
+#: src/wx-console/wxbrestorepanel.cpp:506
+#: src/wx-console/wxbrestorepanel.cpp:516
+#: src/wx-console/wxbrestorepanel.cpp:1783
 msgid "Pool"
 msgstr ""
 
@@ -3919,15 +3970,24 @@ msgstr ""
 msgid "Verify Job"
 msgstr ""
 
-#: src/dird/ua_run.c:655
+#: src/dird/ua_run.c:655 src/wx-console/wxbrestorepanel.cpp:331
+#: src/wx-console/wxbrestorepanel.cpp:1848
 msgid "Bootstrap"
 msgstr ""
 
-#: src/dird/ua_run.c:656
+#: src/dird/ua_run.c:656 src/wx-console/wxbrestorepanel.cpp:332
+#: src/wx-console/wxbrestorepanel.cpp:1072
+#: src/wx-console/wxbrestorepanel.cpp:1850
 msgid "Where"
 msgstr ""
 
-#: src/dird/ua_run.c:657
+#: src/dird/ua_run.c:657 src/wx-console/wxbrestorepanel.cpp:334
+#: src/wx-console/wxbrestorepanel.cpp:1080
+#: src/wx-console/wxbrestorepanel.cpp:1854
+#: src/wx-console/wxbrestorepanel.cpp:1855
+#: src/wx-console/wxbrestorepanel.cpp:1856
+#: src/wx-console/wxbrestorepanel.cpp:1857
+#: src/wx-console/wxbrestorepanel.cpp:1858
 msgid "Replace"
 msgstr ""
 
@@ -4512,6 +4572,7 @@ msgstr ""
 
 #: src/dird/ua_status.c:716 src/filed/status.c:254 src/lib/util.c:187
 #: src/lib/util.c:254 src/stored/btape.c:1158 src/stored/status.c:415
+#: src/wx-console/wxbconfigpanel.cpp:180
 msgid "OK"
 msgstr ""
 
@@ -5382,7 +5443,7 @@ msgstr ""
 #: src/filed/filed.c:62
 #, c-format
 msgid ""
-"Copyright (C) 2000-2005 Kern Sibbald\n"
+"Copyright (C) 2000-2015 Kern Sibbald
 "\n"
 "Version: %s (%s)\n"
 "\n"
@@ -6191,10 +6252,370 @@ msgstr ""
 msgid "Cannot return to saved working directory: %s\n"
 msgstr ""
 
-#: src/lib/util.c:292
+#: src/gnome2-console/authenticate.c:74
+#, c-format
+msgid "%s: Director authorization problem.\n"
+msgstr ""
+
+#: src/gnome2-console/authenticate.c:75
+msgid "Director authorization problem.\n"
+msgstr ""
+
+#: src/gnome2-console/authenticate.c:77
+msgid ""
+"Please see http://www.bacula.org/rel-manual/faq.html#AuthorizationErrors for "
+"help.\n"
+msgstr ""
+
+#: src/gnome2-console/authenticate.c:87
+#, c-format
+msgid "%s: Bad response to Hello command: ERR=%s\n"
+msgstr ""
+
+#: src/gnome2-console/authenticate.c:89
+msgid "The Director is probably not running.\n"
+msgstr ""
+
+#: src/gnome2-console/console.c:88
+#, c-format
+msgid ""
+"Copyright (C) 2000-2015 Kern Sibbald
+"\n"
+"Version: %s (%s) %s %s %s\n"
+"\n"
+"Usage: gnome-console [-s] [-c config_file] [-d debug_level] [config_file]\n"
+"       -c <file>   set configuration file to file\n"
+"       -dnn        set debug level to nn\n"
+"       -s          no signals\n"
+"       -t          test - read configuration and exit\n"
+"       -?          print this message.\n"
+"\n"
+msgstr ""
+
+#: src/gnome2-console/console.c:219
+#, c-format
+msgid "Pthread cond init error = %s\n"
+msgstr ""
+
+#: src/gnome2-console/console.c:357
+msgid " Not Connected"
+msgstr ""
+
+#: src/gnome2-console/console.c:478
+#, c-format
+msgid " Connecting to Director %s:%d"
+msgstr ""
+
+#: src/gnome2-console/console.c:479
+#, c-format
+msgid ""
+"Connecting to Director %s:%d\n"
+"\n"
+msgstr ""
+
+#: src/gnome2-console/console.c:494 src/wx-console/console_thread.cpp:360
+#, c-format
+msgid "Passphrase for Console \"%s\" TLS private key: "
+msgstr ""
+
+#: src/gnome2-console/console.c:516 src/wx-console/console_thread.cpp:381
+#, c-format
+msgid "Passphrase for Director \"%s\" TLS private key: "
+msgstr ""
+
+#: src/gnome2-console/console.c:535 src/tray-monitor/tray-monitor.c:860
+#: src/wx-console/console_thread.cpp:399
+msgid "Director daemon"
+msgstr ""
+
+#: src/gnome2-console/console.c:547
+msgid " Initializing ..."
+msgstr ""
+
+#: src/gnome2-console/console.c:583
+msgid " Connected"
+msgstr ""
+
+#: src/gnome2-console/console.c:591
+msgid " Processing command ..."
+msgstr ""
+
+#: src/gnome2-console/console.c:626
+msgid " At prompt waiting for input ..."
+msgstr ""
+
+#: src/gnome2-console/console.c:746
+msgid " Ready"
+msgstr ""
+
+#: src/gnome2-console/console_conf.c:135
+#, c-format
+msgid "Console: name=%s\n"
+msgstr ""
+
+#: src/gnome2-console/console_conf.c:138
+#, c-format
+msgid "ConsoleFont: name=%s font face=%s\n"
+msgstr ""
+
+#: src/gnome2-console/interface.c:32
+msgid "_Connect"
+msgstr ""
+
+#: src/gnome2-console/interface.c:33 src/gnome2-console/interface.c:232
+msgid "Connect to Director"
+msgstr ""
+
+#: src/gnome2-console/interface.c:39
+msgid "_Disconnect"
+msgstr ""
+
+#: src/gnome2-console/interface.c:40
+msgid "Disconnect from Director"
+msgstr ""
+
+#: src/gnome2-console/interface.c:93
+msgid "_Display Messages"
+msgstr ""
+
+#: src/gnome2-console/interface.c:129
+msgid "_File"
+msgstr ""
+
+#: src/gnome2-console/interface.c:136
+msgid "_Edit"
+msgstr ""
+
+#: src/gnome2-console/interface.c:143
+msgid "_View"
+msgstr ""
+
+#: src/gnome2-console/interface.c:144 src/gnome2-console/interface.c:252
+msgid "Display Messages"
+msgstr ""
+
+#: src/gnome2-console/interface.c:150
+msgid "_Settings"
+msgstr ""
+
+#: src/gnome2-console/interface.c:157
+msgid "_Help"
+msgstr ""
+
+#: src/gnome2-console/interface.c:197
+msgid "Bacula Console"
+msgstr ""
+
+#: src/gnome2-console/interface.c:231 src/wx-console/wxbmainframe.cpp:229
+#: src/wx-console/wxbmainframe.cpp:597
+msgid "Connect"
+msgstr ""
+
+#: src/gnome2-console/interface.c:241
+msgid "Run"
+msgstr ""
+
+#: src/gnome2-console/interface.c:242 src/gnome2-console/interface.c:677
+#: src/gnome2-console/interface.c:690
+msgid "Run a Job"
+msgstr ""
+
+#: src/gnome2-console/interface.c:251
+msgid "Msgs"
+msgstr ""
+
+#: src/gnome2-console/interface.c:261 src/lib/util.c:292
+#: src/wx-console/wxbrestorepanel.cpp:384
+#: src/wx-console/wxbrestorepanel.cpp:1949
 msgid "Restore"
 msgstr ""
 
+#: src/gnome2-console/interface.c:271
+msgid "Label"
+msgstr ""
+
+#: src/gnome2-console/interface.c:299
+msgid " Command: "
+msgstr ""
+
+#: src/gnome2-console/interface.c:307
+msgid "Enter Commands Here"
+msgstr ""
+
+#: src/gnome2-console/interface.c:318
+msgid " Status: "
+msgstr ""
+
+#: src/gnome2-console/interface.c:326
+msgid "  "
+msgstr ""
+
+#: src/gnome2-console/interface.c:422
+msgid "About Bacula Console"
+msgstr ""
+
+#: src/gnome2-console/interface.c:436
+msgid "Bacula Console\n"
+msgstr ""
+
+#: src/gnome2-console/interface.c:444
+msgid "Copyright (c) 2000 - 2004, Kern Sibbald and John Walker"
+msgstr ""
+
+#: src/gnome2-console/interface.c:450
+msgid "Authors: Kern Sibbald and John Walker"
+msgstr ""
+
+#: src/gnome2-console/interface.c:456
+msgid "The Leading Open Source Backup Solution."
+msgstr ""
+
+#: src/gnome2-console/interface.c:521 src/gnome2-console/interface.c:536
+msgid "Select Director"
+msgstr ""
+
+#: src/gnome2-console/interface.c:708 src/gnome2-console/interface.c:1616
+msgid "Job:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:728
+msgid "   Type:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:757 src/gnome2-console/interface.c:1644
+#: src/wx-console/wxbrestorepanel.cpp:1862
+msgid "Client:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:787 src/gnome2-console/interface.c:1672
+msgid "FileSet: "
+msgstr ""
+
+#: src/gnome2-console/interface.c:813 src/wx-console/wxbrestorepanel.cpp:1868
+msgid "Priority:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:836
+msgid "Level:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:866 src/gnome2-console/interface.c:1418
+#: src/gnome2-console/interface.c:1700
+msgid "Pool:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:895 src/gnome2-console/interface.c:1393
+#: src/gnome2-console/interface.c:1728 src/wx-console/wxbrestorepanel.cpp:1864
+msgid "Storage:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:924
+msgid "Messages:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:952
+msgid "Where: "
+msgstr ""
+
+#: src/gnome2-console/interface.c:970 src/wx-console/wxbrestorepanel.cpp:1866
+msgid "When:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:988 src/wx-console/wxbrestorepanel.cpp:1847
+msgid "Bootstrap:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:1108
+msgid "_New"
+msgstr ""
+
+#: src/gnome2-console/interface.c:1177
+msgid "Restore File Selection"
+msgstr ""
+
+#: src/gnome2-console/interface.c:1226
+msgid "Current dir:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:1252
+msgid "Files Selected: "
+msgstr ""
+
+#: src/gnome2-console/interface.c:1373 src/gnome2-console/interface.c:1383
+msgid "Label a Volume"
+msgstr ""
+
+#: src/gnome2-console/interface.c:1444
+msgid "Volume Name:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:1459
+msgid "Slot:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:1585
+msgid "Restore Files Dialog"
+msgstr ""
+
+#: src/gnome2-console/interface.c:1599
+msgid "Restore Files"
+msgstr ""
+
+#: src/gnome2-console/interface.c:1756
+msgid "Before:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:1799
+msgid "Select Files"
+msgstr ""
+
+#: src/gnome2-console/interface.c:1883
+msgid "Progress"
+msgstr ""
+
+#: src/gnome2-console/restore.c:121
+msgid "Mark"
+msgstr ""
+
+#: src/gnome2-console/restore.c:121
+msgid "File"
+msgstr ""
+
+#: src/gnome2-console/restore.c:121
+msgid "Mode"
+msgstr ""
+
+#: src/gnome2-console/restore.c:121 src/wx-console/wxbrestorepanel.cpp:288
+msgid "User"
+msgstr ""
+
+#: src/gnome2-console/restore.c:121 src/wx-console/wxbrestorepanel.cpp:292
+msgid "Group"
+msgstr ""
+
+#: src/gnome2-console/restore.c:121 src/wx-console/wxbrestorepanel.cpp:276
+msgid "Size"
+msgstr ""
+
+#: src/gnome2-console/restore.c:121 src/wx-console/wxbrestorepanel.cpp:280
+msgid "Date"
+msgstr ""
+
+#: src/gnome2-console/support.c:41
+#, c-format
+msgid "Widget not found: %s"
+msgstr ""
+
+#: src/gnome2-console/support.c:60 src/gnome2-console/support.c:85
+#, c-format
+msgid "Couldn't find pixmap file: %s"
+msgstr ""
+
+#: src/gnome2-console/support.c:92
+#, c-format
+msgid "Failed to load pixbuf file: %s: %s\n"
+msgstr ""
+
 #: src/lib/tls.c:105
 #, c-format
 msgid ""
@@ -6848,6 +7269,20 @@ msgid ""
 "Watchdog sending kill after %d secs to thread stalled reading Director.\n"
 msgstr ""
 
+#: src/lib/lex.c:79 src/wx-console/console_thread.cpp:186
+#, c-format
+msgid "Problem probably begins at line %d.\n"
+msgstr ""
+
+#: src/lib/lex.c:84 src/wx-console/console_thread.cpp:191
+#, c-format
+msgid ""
+"Config error: %s\n"
+"            : line %d, col %d of file %s\n"
+"%s\n"
+"%s"
+msgstr ""
+
 #: src/lib/lex.c:88
 #, c-format
 msgid "Config error: %s\n"
@@ -8417,7 +8852,7 @@ msgstr ""
 #: src/stored/bcopy.c:58
 #, c-format
 msgid ""
-"Copyright (C) 2002-2005 Kern Sibbald.\n"
+"Copyright (C) 2000-2015 Kern Sibbald
 "\n"
 "Version: %s (%s)\n"
 "\n"
@@ -8488,7 +8923,7 @@ msgstr ""
 #: src/stored/bextract.c:70
 #, c-format
 msgid ""
-"Copyright (C) 2000-2005 Kern Sibbald.\n"
+"Copyright (C) 2000-2015 Kern Sibbald
 "\n"
 "Version: %s (%s)\n"
 "\n"
@@ -8735,7 +9170,7 @@ msgstr ""
 #: src/stored/bls.c:68
 #, c-format
 msgid ""
-"Copyright (C) 2000-2005 Kern Sibbald.\n"
+"Copyright (C) 2000-2015 Kern Sibbald
 "\n"
 "Version: %s (%s)\n"
 "\n"
@@ -8831,7 +9266,7 @@ msgstr ""
 #: src/stored/bscan.c:109
 #, c-format
 msgid ""
-"Copyright (C) 2001-2005 Kern Sibbald.\n"
+"Copyright (C) 2000-2015 Kern Sibbald
 "\n"
 "Version: %s (%s)\n"
 "\n"
@@ -10448,7 +10883,7 @@ msgstr ""
 #: src/stored/btape.c:2596
 #, c-format
 msgid ""
-"Copyright (C) 2000-2005 Kern Sibbald.\n"
+"Copyright (C) 2000-2015 Kern Sibbald
 "\n"
 "Version: %s (%s)\n"
 "\n"
@@ -12054,7 +12489,7 @@ msgstr ""
 #: src/stored/stored.c:65
 #, c-format
 msgid ""
-"Copyright (C) 2000-2005 Kern Sibbald.\n"
+"Copyright (C) 2000-2015 Kern Sibbald
 "\n"
 "Version: %s (%s)\n"
 "\n"
@@ -12760,83 +13195,458 @@ msgstr ""
 msgid "Skip: File system change prohibited. Directory not entered. %s\n"
 msgstr ""
 
-#: src/baconfig.h:55
-#, c-format
-msgid "Failed ASSERT: %s\n"
+#: src/tray-monitor/authenticate.c:78
+msgid ""
+"Director authorization problem.\n"
+"Most likely the passwords do not agree.\n"
+"Please see http://www.bacula.org/rel-manual/faq.html#AuthorizationErrors "
+"for help.\n"
 msgstr ""
 
-#: src/baconfig.h:62
-msgid "*None*"
+#: src/tray-monitor/authenticate.c:127
+msgid ""
+"Director and Storage daemon passwords or names not the same.\n"
+"Please see http://www.bacula.org/rel-manual/faq.html#AuthorizationErrors "
+"for help.\n"
 msgstr ""
 
-#: src/filed/win32/winmain.cpp:228 src/filed/win32/winmain.cpp:236
-msgid "Bacula Usage"
+#: src/tray-monitor/authenticate.c:172
+msgid ""
+"Director and File daemon passwords or names not the same.\n"
+"Please see http://www.bacula.org/rel-manual/faq.html#AuthorizationErrors "
+"for help.\n"
 msgstr ""
 
-#: src/filed/win32/winmain.cpp:233
-msgid "Bad Command Line Options"
+#: src/tray-monitor/tray-monitor.c:102
+#, c-format
+msgid ""
+"Copyright (C) 2000-2015 Kern Sibbald
+"Written by Nicolas Boichat (2004)\n"
+"\n"
+"Version: %s (%s) %s %s %s\n"
+"\n"
+"Usage: tray-monitor [-c config_file] [-d debug_level]\n"
+"       -c <file>     set configuration file to file\n"
+"       -dnn          set debug level to nn\n"
+"       -t            test - read configuration and exit\n"
+"       -?            print this message.\n"
+"\n"
 msgstr ""
 
-#: src/filed/win32/winmain.cpp:326
-msgid "Another instance of Bacula is already running"
+#: src/tray-monitor/tray-monitor.c:251
+#, c-format
+msgid ""
+"Error: %d Monitor resource defined in %s. You must define one and only one "
+"Monitor resource.\n"
 msgstr ""
 
-#: src/filed/win32/winservice.cpp:131 src/filed/win32/winservice.cpp:145
-msgid "No existing instance of Bacula could be contacted"
+#: src/tray-monitor/tray-monitor.c:282
+#, c-format
+msgid ""
+"No Client, Storage nor Director resource defined in %s\n"
+"Without that I don't how to get status from the File, Storage or Director "
+"Daemon :-(\n"
 msgstr ""
 
-#: src/filed/win32/winservice.cpp:218
-msgid "KERNEL32.DLL not found: Bacula service not started"
+#: src/tray-monitor/tray-monitor.c:304
+#, c-format
+msgid ""
+"Invalid refresh interval defined in %s\n"
+"This value must be greater or equal to 1 second and less or equal to 10 "
+"minutes (read value: %d).\n"
 msgstr ""
 
-#: src/filed/win32/winservice.cpp:228
-msgid "Registry service not found: Bacula service not started"
+#: src/tray-monitor/tray-monitor.c:319
+msgid "Open status window..."
 msgstr ""
 
-#: src/filed/win32/winservice.cpp:230
-msgid "Registry service not found"
+#: src/tray-monitor/tray-monitor.c:325
+msgid "Exit"
 msgstr ""
 
-#: src/filed/win32/winservice.cpp:260
-msgid "StartServiceCtrlDispatcher failed."
+#: src/tray-monitor/tray-monitor.c:337
+msgid "Bacula tray monitor"
 msgstr ""
 
-#: src/filed/win32/winservice.cpp:278
-msgid "RegisterServiceCtlHandler failed"
+#: src/tray-monitor/tray-monitor.c:362
+msgid " (DIR)"
 msgstr ""
 
-#: src/filed/win32/winservice.cpp:279
-msgid "Contact Register Service Handler failure"
+#: src/tray-monitor/tray-monitor.c:366
+msgid " (FD)"
 msgstr ""
 
-#: src/filed/win32/winservice.cpp:295
-msgid "ReportStatus STOPPED failed 1"
+#: src/tray-monitor/tray-monitor.c:370
+msgid " (SD)"
 msgstr ""
 
-#: src/filed/win32/winservice.cpp:318
-msgid "Report Service failure"
+#: src/tray-monitor/tray-monitor.c:383
+msgid "Unknown status."
 msgstr ""
 
-#: src/filed/win32/winservice.cpp:355
-msgid "Unable to install Bacula service"
+#: src/tray-monitor/tray-monitor.c:424
+msgid "Refresh interval in seconds: "
 msgstr ""
 
-#: src/filed/win32/winservice.cpp:373
-msgid "Service command length too long"
+#: src/tray-monitor/tray-monitor.c:432
+msgid "Refresh now"
 msgstr ""
 
-#: src/filed/win32/winservice.cpp:374
-msgid "Service command length too long. Service not registered."
+#: src/tray-monitor/tray-monitor.c:436
+msgid "About"
 msgstr ""
 
-#: src/filed/win32/winservice.cpp:389
-msgid "Cannot write System Registry"
+#: src/tray-monitor/tray-monitor.c:440
+msgid "Close"
 msgstr ""
 
-#: src/filed/win32/winservice.cpp:390
-msgid ""
-"The System Registry could not be updated - the Bacula service was not "
-"installed"
+#: src/tray-monitor/tray-monitor.c:460
+#, c-format
+msgid "Disconnecting from Director %s:%d\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:463
+#, c-format
+msgid "Disconnecting from Client %s:%d\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:466
+#, c-format
+msgid "Disconnecting from Storage %s:%d\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:502 src/tray-monitor/tray-monitor.c:512
+msgid "Bacula Tray Monitor"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:503 src/tray-monitor/tray-monitor.c:513
+msgid ""
+"Copyright (C) 2000-2015 Kern Sibbald
+"Written by Nicolas Boichat\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:505 src/tray-monitor/tray-monitor.c:515
+msgid "Version:"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:583
+#, c-format
+msgid "Error, currentitem is not a Client or a Storage..\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:656
+#, c-format
+msgid ""
+"Current job: %s\n"
+"Last job: %s"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:668
+#, c-format
+msgid " (%d errors)"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:671
+#, c-format
+msgid " (%d error)"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:708
+msgid "No current job."
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:711
+msgid "No last job."
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:719
+msgid "Job status: Created"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:724
+msgid "Job status: Running"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:728
+msgid "Job status: Blocked"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:733
+msgid "Job status: Terminated"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:738
+msgid "Job status: Terminated in error"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:744
+msgid "Job status: Error"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:748
+msgid "Job status: Fatal error"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:753
+msgid "Job status: Verify differences"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:758
+msgid "Job status: Canceled"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:763
+msgid "Job status: Waiting on File daemon"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:768
+msgid "Job status: Waiting on the Storage daemon"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:773
+msgid "Job status: Waiting for new media"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:778
+msgid "Job status: Waiting for Mount"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:783
+msgid "Job status: Waiting for storage resource"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:788
+msgid "Job status: Waiting for job resource"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:793
+msgid "Job status: Waiting for Client resource"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:798
+msgid "Job status: Waiting for maximum jobs"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:803
+msgid "Job status: Waiting for start time"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:808
+msgid "Job status: Waiting for higher priority jobs to finish"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:813
+#, c-format
+msgid "Unknown job status %c."
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:814
+#, c-format
+msgid "Job status: Unknown(%c)"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:821
+#, c-format
+msgid "Bad scan : '%s' %d\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:859
+#, c-format
+msgid "Connecting to Director %s:%d"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:865
+#, c-format
+msgid "Connecting to Client %s:%d\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:866
+#, c-format
+msgid "Connecting to Client %s:%d"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:872
+#, c-format
+msgid "Connecting to Storage %s:%d\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:873
+#, c-format
+msgid "Connecting to Storage %s:%d"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:878 src/tray-monitor/tray-monitor.c:916
+#, c-format
+msgid "Error, currentitem is not a Client, a Storage or a Director..\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:884
+msgid "Cannot connect to daemon.\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:885
+msgid "Cannot connect to daemon."
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:897
+#, c-format
+msgid "Authentication error : %s"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:904
+msgid "Opened connection with Director daemon.\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:905
+msgid "Opened connection with Director daemon."
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:908
+msgid "Opened connection with File daemon.\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:909
+msgid "Opened connection with File daemon."
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:912
+msgid "Opened connection with Storage daemon.\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:913
+msgid "Opened connection with Storage daemon."
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:948
+msgid "<< Error: BNET_PROMPT signal received. >>\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:953 src/wx-console/console_thread.cpp:465
+msgid "<< Heartbeat signal received, answered. >>\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:957
+#, c-format
+msgid "<< Unexpected signal received : %s >>\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:962
+msgid "<ERROR>\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:966
+msgid "Error : BNET_HARDEOF or BNET_ERROR"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:972
+msgid "<STOP>\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:976
+msgid "Error : Connection closed."
+msgstr ""
+
+#: src/tray-monitor/tray_conf.c:161
+#, c-format
+msgid "Monitor: name=%s FDtimeout=%s SDtimeout=%s\n"
+msgstr ""
+
+#: src/tray-monitor/tray_conf.c:167
+#, c-format
+msgid "Director: name=%s address=%s FDport=%d\n"
+msgstr ""
+
+#: src/tray-monitor/tray_conf.c:171
+#, c-format
+msgid "Client: name=%s address=%s FDport=%d\n"
+msgstr ""
+
+#: src/tray-monitor/tray_conf.c:175
+#, c-format
+msgid "Storage: name=%s address=%s SDport=%d\n"
+msgstr ""
+
+#: src/wx-console/authenticate.c:129
+msgid "Bad response to Hello command: ERR="
+msgstr ""
+
+#: src/baconfig.h:55
+#, c-format
+msgid "Failed ASSERT: %s\n"
+msgstr ""
+
+#: src/baconfig.h:62
+msgid "*None*"
+msgstr ""
+
+#: src/filed/win32/winmain.cpp:228 src/filed/win32/winmain.cpp:236
+msgid "Bacula Usage"
+msgstr ""
+
+#: src/filed/win32/winmain.cpp:233
+msgid "Bad Command Line Options"
+msgstr ""
+
+#: src/filed/win32/winmain.cpp:326
+msgid "Another instance of Bacula is already running"
+msgstr ""
+
+#: src/filed/win32/winservice.cpp:131 src/filed/win32/winservice.cpp:145
+msgid "No existing instance of Bacula could be contacted"
+msgstr ""
+
+#: src/filed/win32/winservice.cpp:218
+msgid "KERNEL32.DLL not found: Bacula service not started"
+msgstr ""
+
+#: src/filed/win32/winservice.cpp:228
+msgid "Registry service not found: Bacula service not started"
+msgstr ""
+
+#: src/filed/win32/winservice.cpp:230
+msgid "Registry service not found"
+msgstr ""
+
+#: src/filed/win32/winservice.cpp:260
+msgid "StartServiceCtrlDispatcher failed."
+msgstr ""
+
+#: src/filed/win32/winservice.cpp:278
+msgid "RegisterServiceCtlHandler failed"
+msgstr ""
+
+#: src/filed/win32/winservice.cpp:279
+msgid "Contact Register Service Handler failure"
+msgstr ""
+
+#: src/filed/win32/winservice.cpp:295
+msgid "ReportStatus STOPPED failed 1"
+msgstr ""
+
+#: src/filed/win32/winservice.cpp:318
+msgid "Report Service failure"
+msgstr ""
+
+#: src/filed/win32/winservice.cpp:355
+msgid "Unable to install Bacula service"
+msgstr ""
+
+#: src/filed/win32/winservice.cpp:373
+msgid "Service command length too long"
+msgstr ""
+
+#: src/filed/win32/winservice.cpp:374
+msgid "Service command length too long. Service not registered."
+msgstr ""
+
+#: src/filed/win32/winservice.cpp:389
+msgid "Cannot write System Registry"
+msgstr ""
+
+#: src/filed/win32/winservice.cpp:390
+msgid ""
+"The System Registry could not be updated - the Bacula service was not "
+"installed"
 msgstr ""
 
 #: src/filed/win32/winservice.cpp:397
@@ -12941,3 +13751,714 @@ msgstr ""
 #: src/filed/win32/winservice.cpp:740
 msgid "Could not lock database"
 msgstr ""
+
+#: src/wx-console/console_thread.cpp:101
+#, c-format
+msgid ""
+"Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined for "
+"Director \"%s\" in config file.\n"
+"At least one CA certificate store is required.\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:108
+msgid ""
+"No Director resource defined in config file.\n"
+"Without that I don't how to speak to the Director :-(\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:127
+#, c-format
+msgid ""
+"Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined for "
+"Console \"%s\" in config file.\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:148
+msgid "Error while initializing windows sockets...\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:163
+msgid "Error while cleaning up windows sockets...\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:201
+msgid "Error while initializing library."
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:227
+msgid "Cryptographic library initialization failed.\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:231
+msgid "Please correct configuration file.\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:273
+msgid "Error : Library not initialized\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:284
+msgid "Error : No configuration file loaded\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:294
+msgid "Connecting...\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:310
+msgid "Error : No director defined in config file.\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:322
+msgid "Multiple directors found in your config file.\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:331
+#, c-format
+msgid "Please choose a director (1-%d): "
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:403
+msgid "Failed to connect to the director\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:413
+msgid "Connected\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:470
+msgid "<< Unexpected signal received : "
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:490
+msgid "Connection terminated\n"
+msgstr ""
+
+#: src/wx-console/main.cpp:101
+msgid "Bacula wx-console"
+msgstr ""
+
+#: src/wx-console/main.cpp:106 src/wx-console/wxbmainframe.cpp:248
+#, c-format
+msgid "Welcome to bacula wx-console %s (%s)!\n"
+msgstr ""
+
+#: src/wx-console/wxbconfigfileeditor.cpp:44
+msgid "Config file editor"
+msgstr ""
+
+#: src/wx-console/wxbconfigfileeditor.cpp:54
+msgid "# Bacula wx-console Configuration File\n"
+msgstr ""
+
+#: src/wx-console/wxbconfigfileeditor.cpp:90
+msgid "Save and close"
+msgstr ""
+
+#: src/wx-console/wxbconfigfileeditor.cpp:91
+msgid "Close without saving"
+msgstr ""
+
+#: src/wx-console/wxbconfigfileeditor.cpp:118
+#, c-format
+msgid "Unable to write to %s\n"
+msgstr ""
+
+#: src/wx-console/wxbconfigfileeditor.cpp:119
+msgid "Error while saving"
+msgstr ""
+
+#: src/wx-console/wxbconfigpanel.cpp:184
+msgid "Apply"
+msgstr ""
+
+#: src/wx-console/wxbhistorytextctrl.cpp:61
+#: src/wx-console/wxbhistorytextctrl.cpp:132
+#: src/wx-console/wxbmainframe.cpp:272
+msgid "Type your command below:"
+msgstr ""
+
+#: src/wx-console/wxbhistorytextctrl.cpp:96
+msgid "Unknown command."
+msgstr ""
+
+#: src/wx-console/wxbhistorytextctrl.cpp:105
+msgid "Possible completions: "
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:227
+msgid "&About...\tF1"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:227
+msgid "Show about dialog"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:229 src/wx-console/wxbmainframe.cpp:598
+msgid "Connect to the director"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:230
+msgid "Disconnect"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:230
+msgid "Disconnect of the director"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:232
+msgid "Change of configuration file"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:232
+msgid "Change your default configuration file"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:233
+msgid "Edit your configuration file"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:235
+msgid "E&xit\tAlt-X"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:235
+msgid "Quit this program"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:239
+msgid "&File"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:240
+msgid "&Help"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:257
+msgid "Console"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:264
+msgid ""
+"Warning : Unicode is disabled because you are using wxWidgets for GTK+ 1.2.\n"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:268
+msgid ""
+"Warning : There is a problem with wxWidgets for GTK+ 2.0 without Unicode "
+"support when handling non-ASCII filenames: Every non-ASCII character in such "
+"filenames will be replaced by an interrogation mark.\n"
+"If this behaviour disturbs you, please build wx-console against a Unicode "
+"version of wxWidgets for GTK+ 2.0.\n"
+"---\n"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:279
+msgid "Send"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:356 src/wx-console/wxbmainframe.cpp:368
+msgid "Error while parsing command line arguments, using defaults.\n"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:357 src/wx-console/wxbmainframe.cpp:369
+msgid "Usage: wx-console [-c configfile] [-w tmp]\n"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:397
+#, c-format
+msgid ""
+"It seems that it is the first time you run wx-console.\n"
+"This file (%s) has been choosen as default configuration file.\n"
+"Do you want to edit it? (if you click No you will have to select another "
+"file)"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:399
+msgid "First run"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:416
+#, c-format
+msgid ""
+"Unable to read %s\n"
+"Error: %s\n"
+"Do you want to choose another one? (Press no to edit this file)"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:418
+msgid "Unable to read configuration file"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:430
+msgid "Please choose a configuration file to use"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:443
+msgid "This configuration file has been successfully read, use it as default?"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:444
+msgid "Configuration file read successfully"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:454
+#, c-format
+msgid "Using this configuration file: %s\n"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:459
+msgid "Connecting to the director..."
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:474
+msgid "Failed to unregister a data parser !"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:482
+msgid "Quitting.\n"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:497
+msgid ""
+"Welcome to Bacula wx-console.\n"
+"Written by Nicolas Boichat <nicolas at boichat.ch>\n"
+"(C) 2005 Kern Sibbald\n"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:499
+msgid "About Bacula wx-console"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:505
+msgid "Please choose your default configuration file"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:509
+msgid "Use this configuration file as default?"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:510
+msgid "Configuration file"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:581
+msgid "Console thread terminated."
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:589
+msgid "Connection to the director lost. Quit program?"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:590
+msgid "Connection lost"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:606
+msgid "Connected to the director."
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:629
+msgid "Reconnect"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:630
+msgid "Reconnect to the director"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:644
+msgid "Disconnected of the director."
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:663 src/wx-console/wxbrestorepanel.cpp:689
+msgid "Unexpected question has been received.\n"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:686 src/wx-console/wxbmainframe.cpp:703
+msgid "wx-console: unexpected director's question."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:216
+#: src/wx-console/wxbrestorepanel.cpp:1895
+#: src/wx-console/wxbrestorepanel.cpp:1924
+msgid "Enter restore mode"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:219
+msgid "Cancel restore"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:245
+#: src/wx-console/wxbrestorepanel.cpp:299
+msgid "Add"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:247
+#: src/wx-console/wxbrestorepanel.cpp:301
+msgid "Remove"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:249
+#: src/wx-console/wxbrestorepanel.cpp:303
+msgid "Refresh"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:268
+msgid "M"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:272
+msgid "Filename"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:284
+msgid "Perm."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:317
+#: src/wx-console/wxbrestorepanel.cpp:330
+#: src/wx-console/wxbrestorepanel.cpp:482
+#: src/wx-console/wxbrestorepanel.cpp:492
+#: src/wx-console/wxbrestorepanel.cpp:495
+#: src/wx-console/wxbrestorepanel.cpp:1760
+#: src/wx-console/wxbrestorepanel.cpp:1846
+msgid "Job Name"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:319
+#: src/wx-console/wxbrestorepanel.cpp:335
+#: src/wx-console/wxbrestorepanel.cpp:434
+#: src/wx-console/wxbrestorepanel.cpp:435
+#: src/wx-console/wxbrestorepanel.cpp:445
+#: src/wx-console/wxbrestorepanel.cpp:446
+#: src/wx-console/wxbrestorepanel.cpp:1118
+#: src/wx-console/wxbrestorepanel.cpp:1191
+#: src/wx-console/wxbrestorepanel.cpp:1798
+#: src/wx-console/wxbrestorepanel.cpp:1800
+#: src/wx-console/wxbrestorepanel.cpp:1861
+msgid "Fileset"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:322
+#: src/wx-console/wxbrestorepanel.cpp:1185
+#: src/wx-console/wxbrestorepanel.cpp:1201
+#: src/wx-console/wxbrestorepanel.cpp:1203
+#: src/wx-console/wxbrestorepanel.cpp:1211
+#: src/wx-console/wxbrestorepanel.cpp:1213
+#: src/wx-console/wxbrestorepanel.cpp:1232
+#: src/wx-console/wxbrestorepanel.cpp:1239
+#: src/wx-console/wxbrestorepanel.cpp:1788
+#: src/wx-console/wxbrestorepanel.cpp:1799
+#: src/wx-console/wxbrestorepanel.cpp:1919
+msgid "Before"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:324
+msgid "Please configure parameters concerning files to restore :"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:333
+#: src/wx-console/wxbrestorepanel.cpp:1854
+msgid "always"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:333
+msgid "if newer"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:333
+msgid "if older"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:333
+#: src/wx-console/wxbrestorepanel.cpp:1857
+msgid "never"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:341
+msgid "Please configure parameters concerning files restoration :"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:406
+msgid "Getting parameters list."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:414
+msgid "Error : no clients returned by the director."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:438
+msgid "Error : no filesets returned by the director."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:462
+msgid "Error : no storage returned by the director."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:485
+#: src/wx-console/wxbrestorepanel.cpp:509
+msgid "Error : no jobs returned by the director."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:495
+msgid "RestoreFiles"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:530
+msgid "Please configure your restore parameters."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:541
+msgid "Building restore tree..."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:584
+msgid "Error while starting restore: "
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:674
+msgid ""
+"Right click on a file or on a directory, or double-click on its mark to add "
+"it to the restore list."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:711
+#: src/wx-console/wxbrestorepanel.cpp:733
+msgid "wx-console: unexpected restore question."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:744
+msgid " files selected to be restored."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:749
+msgid " file selected to be restored."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:756
+#, c-format
+msgid "Please configure your restore (%ld files selected to be restored)..."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:766
+msgid "Restore failed : no file selected.\n"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:767
+msgid "Restore failed : no file selected."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:777
+msgid "Restoring, please wait..."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:790
+msgid "Job started. JobId="
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:792
+msgid "Restore started, jobid="
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:796
+msgid "Job failed."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:797
+msgid "Restore failed, please look at messages.\n"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:798
+msgid "Restore failed, please look at messages in console."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:804
+#: src/wx-console/wxbrestorepanel.cpp:805
+msgid "Failed to retrieve jobid.\n"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:831
+msgid ""
+"Restore is scheduled in more than two minutes, wx-console will not wait for "
+"its completion.\n"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:832
+msgid ""
+"Restore is scheduled in more than two minutes, wx-console will not wait for "
+"its completion."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:858
+msgid "Restore job created, but not yet running."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:863
+#, c-format
+msgid "Restore job running, please wait (%ld of %ld files restored)..."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:867
+msgid "Restore job terminated successfully."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:868
+msgid "Restore job terminated successfully.\n"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:873
+msgid "Restore job terminated in error, see messages in console."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:874
+msgid "Restore job terminated in error, see messages.\n"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:879
+msgid "Restore job reported a non-fatal error."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:883
+msgid "Restore job reported a fatal error."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:888
+msgid "Restore job cancelled by user."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:889
+msgid "Restore job cancelled by user.\n"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:894
+msgid "Restore job is waiting on File daemon."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:898
+msgid "Restore job is waiting for new media."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:902
+msgid "Restore job is waiting for storage resource."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:906
+msgid "Restore job is waiting for job resource."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:910
+msgid "Restore job is waiting for Client resource."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:914
+msgid "Restore job is waiting for maximum jobs."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:918
+msgid "Restore job is waiting for start time."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:922
+msgid "Restore job is waiting for higher priority jobs to finish."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:971
+msgid ""
+"The restore job has not been started within one minute, wx-console will not "
+"wait for its completion anymore.\n"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:972
+msgid ""
+"The restore job has not been started within one minute, wx-console will not "
+"wait for its completion anymore."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:982
+msgid "Restore done successfully.\n"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:983
+msgid "Restore done successfully."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1054
+msgid "Applying restore configuration changes..."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1105
+msgid "Failed to find the selected client."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1120
+msgid "Failed to find the selected fileset."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1135
+msgid "Failed to find the selected storage."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1152
+#: src/wx-console/wxbrestorepanel.cpp:1835
+msgid "Run Restore job"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1168
+msgid "Restore configuration changes were applied."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1177
+msgid "Restore cancelled.\n"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1178
+msgid "Restore cancelled."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1200
+msgid "No results to list."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1202
+msgid "No backup found for this client."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1209
+msgid "ERROR"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1210
+msgid "Query failed"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1212
+msgid "Cannot get previous backups list, see console."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1845
+msgid "JobName:"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1849
+msgid "Where:"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1852
+msgid "Replace:"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1855
+msgid "ifnewer"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1856
+msgid "ifolder"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1860
+msgid "FileSet:"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1976
+msgid "Restoring..."
+msgstr ""
diff --git a/po/fi.po b/po/fi.po
index 7d7589d..15ad48a 100644
--- a/po/fi.po
+++ b/po/fi.po
@@ -1,7 +1,6 @@
 # Finnish translations for branch package.
-# Copyright (C) 2007-2014 Kern Sibbald
-# This file is distributed under the same license as the branch package.
-# Kern Sibbald <kern at sibbald.com>, 2007.
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #
 msgid ""
 msgstr ""
@@ -609,6 +608,7 @@ msgid ""
 msgstr ""
 
 #: src/dird/authenticate.c:80 src/dird/authenticate.c:81
+#: src/tray-monitor/authenticate.c:132
 #, c-format
 msgid "Error sending Hello to Storage daemon. ERR=%s\n"
 msgstr ""
@@ -631,7 +631,7 @@ msgstr ""
 
 #: src/dird/authenticate.c:120 src/console/authenticate.c:114
 #: src/filed/authenticate.c:251 src/stored/authenticate.c:131
-#: src/stored/authenticate.c:232
+#: src/stored/authenticate.c:232 src/wx-console/authenticate.c:127
 msgid ""
 "Authorization problem: Remote server did not advertise required TLS "
 "support.\n"
@@ -640,6 +640,7 @@ msgstr ""
 #: src/dird/authenticate.c:127 src/console/authenticate.c:121
 #: src/filed/authenticate.c:147 src/filed/authenticate.c:259
 #: src/stored/authenticate.c:139 src/stored/authenticate.c:240
+#: src/wx-console/authenticate.c:133
 msgid "Authorization problem: Remote server requires TLS.\n"
 msgstr ""
 
@@ -653,7 +654,7 @@ msgstr ""
 msgid "bdird<stored: \"%s:%s\" bad response to Hello command: ERR=%s\n"
 msgstr ""
 
-#: src/dird/authenticate.c:152
+#: src/dird/authenticate.c:152 src/tray-monitor/authenticate.c:152
 msgid "Storage daemon rejected Hello command\n"
 msgstr ""
 
@@ -698,7 +699,7 @@ msgstr ""
 msgid "TLS negotiation failed with FD at \"%s:%d\".\n"
 msgstr ""
 
-#: src/dird/authenticate.c:250
+#: src/dird/authenticate.c:250 src/tray-monitor/authenticate.c:191
 #, c-format
 msgid "Bad response from File daemon to Hello command: ERR=%s\n"
 msgstr ""
@@ -708,7 +709,7 @@ msgstr ""
 msgid "Bad response from File daemon at \"%s:%d\" to Hello command: ERR=%s\n"
 msgstr ""
 
-#: src/dird/authenticate.c:259
+#: src/dird/authenticate.c:259 src/tray-monitor/authenticate.c:198
 msgid "File daemon rejected Hello command\n"
 msgstr ""
 
@@ -1035,13 +1036,13 @@ msgid ""
 msgstr ""
 
 #: src/dird/dird.c:224 src/console/console.c:426 src/filed/filed.c:182
-#: src/stored/stored.c:210
+#: src/gnome2-console/console.c:286 src/stored/stored.c:210
 msgid "Cryptography library initialization failed.\n"
 msgstr ""
 
 #: src/dird/dird.c:228 src/dird/dird.c:234 src/dird/dird.c:474
 #: src/dird/dird.c:477 src/console/console.c:430 src/filed/filed.c:187
-#: src/stored/stored.c:214
+#: src/gnome2-console/console.c:290 src/stored/stored.c:214
 #, c-format
 msgid "Please correct configuration file: %s\n"
 msgstr ""
@@ -1078,7 +1079,9 @@ msgstr ""
 #: src/dird/dird.c:563 src/dird/dird.c:764 src/dird/dird.c:816
 #: src/dird/dird.c:920 src/console/console.c:657 src/console/console.c:686
 #: src/filed/filed.c:288 src/filed/filed.c:446
-#: src/stored/stored.c:332
+#: src/gnome2-console/console.c:153 src/gnome2-console/console.c:182
+#: src/stored/stored.c:332 src/wx-console/console_thread.cpp:114
+#: src/wx-console/console_thread.cpp:140
 msgid "TLS required but not configured in Bacula.\n"
 msgstr ""
 
@@ -1181,7 +1184,7 @@ msgstr ""
 msgid "Failed to initialize TLS context for Storage \"%s\" in %s.\n"
 msgstr ""
 
-#: src/dird/dird_conf.c:508
+#: src/dird/dird_conf.c:508 src/tray-monitor/tray_conf.c:168
 #, c-format
 msgid "No %s resource defined\n"
 msgstr ""
@@ -1455,24 +1458,26 @@ msgstr ""
 msgid "      opcmd=%s\n"
 msgstr ""
 
-#: src/dird/dird_conf.c:893
+#: src/dird/dird_conf.c:893 src/tray-monitor/tray_conf.c:199
 #, c-format
 msgid "Unknown resource type %d in dump_resource.\n"
 msgstr ""
 
-#: src/dird/dird_conf.c:1199
+#: src/dird/dird_conf.c:1199 src/tray-monitor/tray_conf.c:257
 #, c-format
 msgid "Unknown resource type %d in free_resource.\n"
 msgstr ""
 
 #: src/dird/dird_conf.c:1231 src/dird/dird_conf.c:1246
 #: src/dird/dird_conf.c:1842 src/console/console_conf.c:257
-#: src/filed/filed_conf.c:347
+#: src/filed/filed_conf.c:347 src/gnome2-console/console_conf.c:258
+#: src/tray-monitor/tray_conf.c:288 src/wx-console/console_conf.c:265
 #, c-format
 msgid "%s item is required in %s resource, but not found.\n"
 msgstr ""
 
 #: src/dird/dird_conf.c:1237 src/lib/parse_conf.c:234
+#: src/tray-monitor/tray_conf.c:294
 #, c-format
 msgid "Too many items in %s resource\n"
 msgstr ""
@@ -1519,6 +1524,7 @@ msgid "Cannot find Schedule resource %s\n"
 msgstr ""
 
 #: src/dird/dird_conf.c:1383 src/dird/dird_conf.c:1443
+#: src/tray-monitor/tray_conf.c:314 src/tray-monitor/tray_conf.c:352
 #, c-format
 msgid "Unknown resource type %d in save_resource.\n"
 msgstr ""
@@ -1529,7 +1535,8 @@ msgid "Name item is required in %s resource, but not found.\n"
 msgstr ""
 
 #: src/dird/dird_conf.c:1466 src/console/console_conf.c:320
-#: src/filed/filed_conf.c:432
+#: src/filed/filed_conf.c:432 src/gnome2-console/console_conf.c:327
+#: src/tray-monitor/tray_conf.c:372 src/wx-console/console_conf.c:328
 #, c-format
 msgid "Attempt to define second %s resource named \"%s\" is not permitted.\n"
 msgstr ""
@@ -1626,7 +1633,7 @@ msgstr ""
 msgid "Cannot destroy var context: ERR=%s\n"
 msgstr ""
 
-#: src/dird/fd_cmds.c:94
+#: src/dird/fd_cmds.c:94 src/tray-monitor/tray-monitor.c:914
 msgid "File daemon"
 msgstr ""
 
@@ -2221,6 +2228,7 @@ msgid "Storage from Pool's NextPool resource"
 msgstr ""
 
 #: src/dird/msgchan.c:106 src/filed/job.c:1301
+#: src/tray-monitor/tray-monitor.c:921
 msgid "Storage daemon"
 msgstr ""
 
@@ -2955,12 +2963,33 @@ msgid "Director"
 msgstr ""
 
 #: src/dird/ua_cmds.c:998 src/dird/ua_dotcmds.c:284 src/dird/ua_run.c:265
-#: src/dird/ua_select.c:168
+#: src/dird/ua_select.c:168 src/wx-console/wxbrestorepanel.cpp:339
+#: src/wx-console/wxbrestorepanel.cpp:355
+#: src/wx-console/wxbrestorepanel.cpp:479
+#: src/wx-console/wxbrestorepanel.cpp:480
+#: src/wx-console/wxbrestorepanel.cpp:490
+#: src/wx-console/wxbrestorepanel.cpp:491
+#: src/wx-console/wxbrestorepanel.cpp:1154
+#: src/wx-console/wxbrestorepanel.cpp:1818
+#: src/wx-console/wxbrestorepanel.cpp:1889
 msgid "Storage"
 msgstr ""
 
 #: src/dird/ua_cmds.c:999 src/dird/ua_dotcmds.c:285 src/dird/ua_run.c:271
 #: src/dird/ua_select.c:311 src/dird/ua_select.c:420
+#: src/wx-console/wxbrestorepanel.cpp:336
+#: src/wx-console/wxbrestorepanel.cpp:354
+#: src/wx-console/wxbrestorepanel.cpp:431
+#: src/wx-console/wxbrestorepanel.cpp:432
+#: src/wx-console/wxbrestorepanel.cpp:442
+#: src/wx-console/wxbrestorepanel.cpp:443
+#: src/wx-console/wxbrestorepanel.cpp:690
+#: src/wx-console/wxbrestorepanel.cpp:1124
+#: src/wx-console/wxbrestorepanel.cpp:1211
+#: src/wx-console/wxbrestorepanel.cpp:1811
+#: src/wx-console/wxbrestorepanel.cpp:1813
+#: src/wx-console/wxbrestorepanel.cpp:1887
+#: src/wx-console/wxbrestorepanel.cpp:1943
 msgid "Client"
 msgstr ""
 
@@ -3674,7 +3703,7 @@ msgid "Enter a list of directories to restore for found JobIds"
 msgstr ""
 
 #: src/dird/ua_restore.c:418 src/dird/ua_status.c:760 src/filed/status.c:256
-#: src/stored/status.c:521
+#: src/stored/status.c:521 src/wx-console/wxbconfigpanel.cpp:212
 msgid "Cancel"
 msgstr ""
 
@@ -3968,16 +3997,23 @@ msgstr ""
 msgid "Restore Client"
 msgstr ""
 
-#: src/dird/ua_run.c:273
+#: src/dird/ua_run.c:273 src/wx-console/wxbrestorepanel.cpp:356
+#: src/wx-console/wxbrestorepanel.cpp:844
+#: src/wx-console/wxbrestorepanel.cpp:1891
 msgid "When"
 msgstr ""
 
-#: src/dird/ua_run.c:274
+#: src/dird/ua_run.c:274 src/wx-console/wxbrestorepanel.cpp:357
+#: src/wx-console/wxbrestorepanel.cpp:1117
+#: src/wx-console/wxbrestorepanel.cpp:1894
 msgid "Priority"
 msgstr ""
 
 #: src/dird/ua_run.c:278 src/dird/ua_select.c:506 src/dird/ua_select.c:596
-#: src/dird/ua_update.c:529
+#: src/dird/ua_update.c:529 src/wx-console/wxbrestorepanel.cpp:338
+#: src/wx-console/wxbrestorepanel.cpp:527
+#: src/wx-console/wxbrestorepanel.cpp:537
+#: src/wx-console/wxbrestorepanel.cpp:1807
 msgid "Pool"
 msgstr ""
 
@@ -3985,11 +4021,14 @@ msgstr ""
 msgid "Verify Job"
 msgstr ""
 
-#: src/dird/ua_run.c:283
+#: src/dird/ua_run.c:283 src/wx-console/wxbrestorepanel.cpp:349
+#: src/wx-console/wxbrestorepanel.cpp:1872
 msgid "Bootstrap"
 msgstr ""
 
-#: src/dird/ua_run.c:284
+#: src/dird/ua_run.c:284 src/wx-console/wxbrestorepanel.cpp:350
+#: src/wx-console/wxbrestorepanel.cpp:1093
+#: src/wx-console/wxbrestorepanel.cpp:1874
 msgid "Where"
 msgstr ""
 
@@ -3997,7 +4036,13 @@ msgstr ""
 msgid "File Relocation"
 msgstr ""
 
-#: src/dird/ua_run.c:286
+#: src/dird/ua_run.c:286 src/wx-console/wxbrestorepanel.cpp:352
+#: src/wx-console/wxbrestorepanel.cpp:1101
+#: src/wx-console/wxbrestorepanel.cpp:1878
+#: src/wx-console/wxbrestorepanel.cpp:1879
+#: src/wx-console/wxbrestorepanel.cpp:1880
+#: src/wx-console/wxbrestorepanel.cpp:1881
+#: src/wx-console/wxbrestorepanel.cpp:1882
 msgid "Replace"
 msgstr ""
 
@@ -4974,6 +5019,7 @@ msgstr ""
 
 #: src/dird/ua_status.c:763 src/filed/status.c:259 src/lib/util.c:188
 #: src/lib/util.c:255 src/stored/btape.c:1189 src/stored/status.c:524
+#: src/wx-console/wxbconfigpanel.cpp:201
 msgid "OK"
 msgstr ""
 
@@ -5742,20 +5788,22 @@ msgstr ""
 msgid "File: %s\n"
 msgstr ""
 
-#: src/console/authenticate.c:131
+#: src/console/authenticate.c:131 src/wx-console/authenticate.c:142
 msgid "TLS negotiation failed\n"
 msgstr ""
 
-#: src/console/authenticate.c:143
+#: src/console/authenticate.c:143 src/gnome2-console/authenticate.c:98
+#: src/tray-monitor/authenticate.c:97
 #, c-format
 msgid "Bad response to Hello command: ERR=%s\n"
 msgstr ""
 
-#: src/console/authenticate.c:150
+#: src/console/authenticate.c:150 src/gnome2-console/authenticate.c:108
+#: src/tray-monitor/authenticate.c:104 src/wx-console/authenticate.c:157
 msgid "Director rejected Hello command\n"
 msgstr ""
 
-#: src/console/authenticate.c:160
+#: src/console/authenticate.c:160 src/wx-console/authenticate.c:167
 msgid ""
 "Director authorization problem.\n"
 "Most likely the passwords do not agree.\n"
@@ -5846,17 +5894,19 @@ msgstr ""
 msgid "You must enter a number between 1 and %d\n"
 msgstr ""
 
-#: src/console/console.c:521
+#: src/console/console.c:521 src/tray-monitor/tray-monitor.c:905
 #, c-format
 msgid "Connecting to Director %s:%d\n"
 msgstr ""
 
-#: src/console/console.c:538
+#: src/console/console.c:538 src/gnome2-console/console.c:526
+#: src/wx-console/console_thread.cpp:391
 #, c-format
 msgid "Failed to initialize TLS context for Console \"%s\".\n"
 msgstr ""
 
-#: src/console/console.c:558
+#: src/console/console.c:558 src/gnome2-console/console.c:548
+#: src/wx-console/console_thread.cpp:412
 #, c-format
 msgid "Failed to initialize TLS context for Director \"%s\".\n"
 msgstr ""
@@ -5865,21 +5915,21 @@ msgstr ""
 msgid "Enter a period to cancel a command.\n"
 msgstr ""
 
-#: src/console/console.c:664
+#: src/console/console.c:664 src/gnome2-console/console.c:160
 #, c-format
 msgid ""
 "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined for "
 "Director \"%s\" in %s. At least one CA certificate store is required.\n"
 msgstr ""
 
-#: src/console/console.c:673
+#: src/console/console.c:673 src/gnome2-console/console.c:169
 #, c-format
 msgid ""
 "No Director resource defined in %s\n"
 "Without that I don't how to speak to the Director :-(\n"
 msgstr ""
 
-#: src/console/console.c:693
+#: src/console/console.c:693 src/gnome2-console/console.c:189
 #, c-format
 msgid ""
 "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined for "
@@ -5922,17 +5972,19 @@ msgstr ""
 msgid "Autochanger error: ERR=%s\n"
 msgstr ""
 
-#: src/console/console_conf.c:138
+#: src/console/console_conf.c:138 src/gnome2-console/console_conf.c:134
+#: src/wx-console/console_conf.c:147
 #, c-format
 msgid "No record for %d %s\n"
 msgstr ""
 
-#: src/console/console_conf.c:147
+#: src/console/console_conf.c:147 src/wx-console/console_conf.c:156
 #, c-format
 msgid "Console: name=%s rcfile=%s histfile=%s\n"
 msgstr ""
 
-#: src/console/console_conf.c:151
+#: src/console/console_conf.c:151 src/gnome2-console/console_conf.c:143
+#: src/wx-console/console_conf.c:160
 #, c-format
 msgid "Director: name=%s address=%s DIRport=%d\n"
 msgstr ""
@@ -5940,8 +5992,12 @@ msgstr ""
 #: src/console/console_conf.c:155 src/console/console_conf.c:231
 #: src/console/console_conf.c:276 src/console/console_conf.c:303
 #: src/filed/filed_conf.c:319 src/filed/filed_conf.c:384
-#: src/filed/filed_conf.c:414 src/stored/stored_conf.c:528
+#: src/filed/filed_conf.c:414 src/gnome2-console/console_conf.c:154
+#: src/gnome2-console/console_conf.c:232 src/gnome2-console/console_conf.c:280
+#: src/gnome2-console/console_conf.c:310 src/stored/stored_conf.c:528
 #: src/stored/stored_conf.c:616 src/stored/stored_conf.c:651
+#: src/wx-console/console_conf.c:164 src/wx-console/console_conf.c:239
+#: src/wx-console/console_conf.c:284 src/wx-console/console_conf.c:311
 #, c-format
 msgid "Unknown resource type %d\n"
 msgstr ""
@@ -7232,6 +7288,345 @@ msgstr ""
 msgid "Cannot return to saved working directory: %s\n"
 msgstr ""
 
+#: src/gnome2-console/authenticate.c:87
+#, c-format
+msgid "%s: Director authorization problem.\n"
+msgstr ""
+
+#: src/gnome2-console/authenticate.c:88
+msgid "Director authorization problem.\n"
+msgstr ""
+
+#: src/gnome2-console/authenticate.c:90
+msgid ""
+"Please see http://www.bacula.org/rel-manual/faq.html#AuthorizationErrors for "
+"help.\n"
+msgstr ""
+
+#: src/gnome2-console/authenticate.c:100
+#, c-format
+msgid "%s: Bad response to Hello command: ERR=%s\n"
+msgstr ""
+
+#: src/gnome2-console/authenticate.c:102
+msgid "The Director is probably not running.\n"
+msgstr ""
+
+#: src/gnome2-console/console.c:102
+#, c-format
+msgid ""
+"\n"
+"Version: %s (%s) %s %s %s\n"
+"\n"
+"Usage: bgnome-console [-s] [-c config_file] [-d debug_level] [config_file]\n"
+"       -c <file>   set configuration file to file\n"
+"       -dnn        set debug level to nn\n"
+"       -s          no signals\n"
+"       -t          test - read configuration and exit\n"
+"       -?          print this message.\n"
+"\n"
+msgstr ""
+
+#: src/gnome2-console/console.c:234
+#, c-format
+msgid "Pthread cond init error = %s\n"
+msgstr ""
+
+#: src/gnome2-console/console.c:379
+msgid " Not Connected"
+msgstr ""
+
+#: src/gnome2-console/console.c:500
+#, c-format
+msgid " Connecting to Director %s:%d"
+msgstr ""
+
+#: src/gnome2-console/console.c:501
+#, c-format
+msgid ""
+"Connecting to Director %s:%d\n"
+"\n"
+msgstr ""
+
+#: src/gnome2-console/console.c:516 src/wx-console/console_thread.cpp:381
+#, c-format
+msgid "Passphrase for Console \"%s\" TLS private key: "
+msgstr ""
+
+#: src/gnome2-console/console.c:538 src/wx-console/console_thread.cpp:402
+#, c-format
+msgid "Passphrase for Director \"%s\" TLS private key: "
+msgstr ""
+
+#: src/gnome2-console/console.c:557 src/tray-monitor/tray-monitor.c:907
+#: src/wx-console/console_thread.cpp:420
+msgid "Director daemon"
+msgstr ""
+
+#: src/gnome2-console/console.c:569
+msgid " Initializing ..."
+msgstr ""
+
+#: src/gnome2-console/console.c:605
+msgid " Connected"
+msgstr ""
+
+#: src/gnome2-console/console.c:613
+msgid " Processing command ..."
+msgstr ""
+
+#: src/gnome2-console/console.c:648
+msgid " At prompt waiting for input ..."
+msgstr ""
+
+#: src/gnome2-console/console.c:768
+msgid " Ready"
+msgstr ""
+
+#: src/gnome2-console/console_conf.c:147
+#, c-format
+msgid "Console: name=%s\n"
+msgstr ""
+
+#: src/gnome2-console/console_conf.c:150 src/tray-monitor/tray_conf.c:195
+#, c-format
+msgid "ConsoleFont: name=%s font face=%s\n"
+msgstr ""
+
+#: src/gnome2-console/interface.c:202
+msgid "Bacula Console"
+msgstr ""
+
+#: src/gnome2-console/interface.c:235 src/wx-console/wxbmainframe.cpp:248
+#: src/wx-console/wxbmainframe.cpp:619
+msgid "Connect"
+msgstr ""
+
+#: src/gnome2-console/interface.c:238
+msgid "Connect to Director"
+msgstr ""
+
+#: src/gnome2-console/interface.c:242
+msgid "Run"
+msgstr ""
+
+#: src/gnome2-console/interface.c:245 src/gnome2-console/interface.c:682
+#: src/gnome2-console/interface.c:696
+msgid "Run a Job"
+msgstr ""
+
+#: src/gnome2-console/interface.c:249
+msgid "Dir Status"
+msgstr ""
+
+#: src/gnome2-console/interface.c:255 src/lib/util.c:293
+#: src/wx-console/wxbrestorepanel.cpp:404
+#: src/wx-console/wxbrestorepanel.cpp:1974
+msgid "Restore"
+msgstr ""
+
+#: src/gnome2-console/interface.c:261
+msgid "Label"
+msgstr ""
+
+#: src/gnome2-console/interface.c:267
+msgid "Msgs"
+msgstr ""
+
+#: src/gnome2-console/interface.c:270
+msgid "Display Messages"
+msgstr ""
+
+#: src/gnome2-console/interface.c:294
+msgid " Command: "
+msgstr ""
+
+#: src/gnome2-console/interface.c:303
+msgid "Enter Commands Here"
+msgstr ""
+
+#: src/gnome2-console/interface.c:314
+msgid " Status: "
+msgstr ""
+
+#: src/gnome2-console/interface.c:323 src/gnome2-console/interface.c:1709
+msgid "  "
+msgstr ""
+
+#: src/gnome2-console/interface.c:424
+msgid "About Bacula Console"
+msgstr ""
+
+#: src/gnome2-console/interface.c:439
+msgid "Bacula Console\n"
+msgstr ""
+
+#: src/gnome2-console/interface.c:448
+msgid "Copyright (c) 2000 - 2004, Kern Sibbald and John Walker"
+msgstr ""
+
+#: src/gnome2-console/interface.c:453
+msgid "Authors: Kern Sibbald and John Walker"
+msgstr ""
+
+#: src/gnome2-console/interface.c:458
+msgid "The Leading Open Source Backup Solution."
+msgstr ""
+
+#: src/gnome2-console/interface.c:523 src/gnome2-console/interface.c:540
+msgid "Select Director"
+msgstr ""
+
+#: src/gnome2-console/interface.c:570
+msgid "         "
+msgstr ""
+
+#: src/gnome2-console/interface.c:715 src/gnome2-console/interface.c:1631
+msgid "Job:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:736
+msgid "   Type:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:756 src/gnome2-console/interface.c:785
+#: src/gnome2-console/interface.c:1284 src/gnome2-console/interface.c:1680
+msgid " "
+msgstr ""
+
+#: src/gnome2-console/interface.c:765 src/gnome2-console/interface.c:1660
+#: src/wx-console/wxbrestorepanel.cpp:1886
+msgid "Client:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:795 src/gnome2-console/interface.c:1689
+msgid "FileSet: "
+msgstr ""
+
+#: src/gnome2-console/interface.c:820 src/wx-console/wxbrestorepanel.cpp:1893
+msgid "Priority:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:836
+msgid "Level:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:857
+msgid "             "
+msgstr ""
+
+#: src/gnome2-console/interface.c:867 src/gnome2-console/interface.c:1433
+#: src/gnome2-console/interface.c:1718
+msgid "Pool:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:888 src/gnome2-console/interface.c:919
+#: src/gnome2-console/interface.c:949 src/gnome2-console/interface.c:969
+#: src/gnome2-console/interface.c:989 src/gnome2-console/interface.c:1009
+#: src/gnome2-console/interface.c:1014 src/gnome2-console/interface.c:1483
+#: src/gnome2-console/interface.c:1739 src/gnome2-console/interface.c:1769
+#: src/gnome2-console/interface.c:1788 src/gnome2-console/interface.c:1793
+msgid "   "
+msgstr ""
+
+#: src/gnome2-console/interface.c:898 src/gnome2-console/interface.c:1407
+#: src/gnome2-console/interface.c:1748 src/wx-console/wxbrestorepanel.cpp:1888
+msgid "Storage:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:929
+msgid "Messages:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:959
+msgid "Where: "
+msgstr ""
+
+#: src/gnome2-console/interface.c:979 src/wx-console/wxbrestorepanel.cpp:1890
+msgid "When:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:999 src/wx-console/wxbrestorepanel.cpp:1871
+msgid "Bootstrap:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:1194
+msgid "Restore File Selection"
+msgstr ""
+
+#: src/gnome2-console/interface.c:1238
+msgid "Current dir:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:1265
+msgid "Files Selected: "
+msgstr ""
+
+#: src/gnome2-console/interface.c:1385 src/gnome2-console/interface.c:1396
+msgid "Label a Volume"
+msgstr ""
+
+#: src/gnome2-console/interface.c:1458
+msgid "Volume Name:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:1472
+msgid "Slot:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:1598
+msgid "Restore Files Dialog"
+msgstr ""
+
+#: src/gnome2-console/interface.c:1613
+msgid "Restore Files"
+msgstr ""
+
+#: src/gnome2-console/interface.c:1778
+msgid "Before:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:1824
+msgid "Select Files"
+msgstr ""
+
+#: src/gnome2-console/interface.c:1907
+msgid "Progress"
+msgstr ""
+
+#: src/gnome2-console/restore.c:149
+msgid "Mark"
+msgstr ""
+
+#: src/gnome2-console/restore.c:149
+msgid "File"
+msgstr ""
+
+#: src/gnome2-console/restore.c:149
+msgid "Mode"
+msgstr ""
+
+#: src/gnome2-console/restore.c:149 src/wx-console/wxbrestorepanel.cpp:306
+msgid "User"
+msgstr ""
+
+#: src/gnome2-console/restore.c:149 src/wx-console/wxbrestorepanel.cpp:310
+msgid "Group"
+msgstr ""
+
+#: src/gnome2-console/restore.c:149 src/wx-console/wxbrestorepanel.cpp:294
+msgid "Size"
+msgstr ""
+
+#: src/gnome2-console/restore.c:149 src/wx-console/wxbrestorepanel.cpp:298
+msgid "Date"
+msgstr ""
+
+#: src/gnome2-console/support.c:60 src/gnome2-console/support.c:85
+#, c-format
+msgid "Couldn't find pixmap file: %s"
+msgstr ""
+
 #: src/lib/address_conf.c:63
 #, c-format
 msgid "Only ipv4 and ipv6 are supported (%d)\n"
@@ -7844,6 +8239,20 @@ msgid ""
 "Watchdog sending kill after %d secs to thread stalled reading Director.\n"
 msgstr ""
 
+#: src/lib/lex.c:93 src/wx-console/console_thread.cpp:208
+#, c-format
+msgid "Problem probably begins at line %d.\n"
+msgstr ""
+
+#: src/lib/lex.c:98 src/wx-console/console_thread.cpp:213
+#, c-format
+msgid ""
+"Config error: %s\n"
+"            : line %d, col %d of file %s\n"
+"%s\n"
+"%s"
+msgstr ""
+
 #: src/lib/lex.c:102
 #, c-format
 msgid "Config error: %s\n"
@@ -8819,7 +9228,7 @@ msgstr ""
 msgid "Copy"
 msgstr ""
 
-#: src/lib/util.c:305
+#: src/lib/util.c:305 src/wx-console/wxbmainframe.cpp:276
 msgid "Console"
 msgstr ""
 
@@ -14130,81 +14539,463 @@ msgstr ""
 msgid "Skip: File system change prohibited. Directory not entered. %s\n"
 msgstr ""
 
-#: src/baconfig.h:72
+#: src/tray-monitor/authenticate.c:88
+msgid ""
+"Director authorization problem.\n"
+"Most likely the passwords do not agree.\n"
+"Please see http://www.bacula.org/rel-manual/faq.html#AuthorizationErrors for "
+"help.\n"
+msgstr ""
+
+#: src/tray-monitor/authenticate.c:138
+msgid ""
+"Director and Storage daemon passwords or names not the same.\n"
+"Please see http://www.bacula.org/rel-manual/faq.html#AuthorizationErrors for "
+"help.\n"
+msgstr ""
+
+#: src/tray-monitor/authenticate.c:145
 #, c-format
-msgid "Failed ASSERT: %s\n"
+msgid "bdird<stored: bad response to Hello command: ERR=%s\n"
 msgstr ""
 
-#: src/baconfig.h:79
-msgid "*None*"
+#: src/tray-monitor/authenticate.c:178
+#, c-format
+msgid "Error sending Hello to File daemon. ERR=%s\n"
 msgstr ""
 
-#: src/win32/dird/winmain.cpp:193 src/win32/dird/winmain.cpp:200
-#: src/win32/filed/winmain.cpp:224 src/win32/filed/winmain.cpp:231
-#: src/win32/stored/baculasd/winmain.cpp:225
-#: src/win32/stored/baculasd/winmain.cpp:232
-msgid "Bacula Usage"
+#: src/tray-monitor/authenticate.c:184
+msgid ""
+"Director and File daemon passwords or names not the same.\n"
+"Please see http://www.bacula.org/rel-manual/faq.html#AuthorizationErrors for "
+"help.\n"
 msgstr ""
 
-#: src/win32/dird/winmain.cpp:197 src/win32/filed/winmain.cpp:228
-#: src/win32/stored/baculasd/winmain.cpp:229
-msgid "Bad Command Line Options"
+#: src/tray-monitor/tray-monitor.c:113
+#, c-format
+msgid ""
+"Written by Nicolas Boichat (2004)\n"
+"\n"
+"Version: %s (%s) %s %s %s\n"
+"\n"
+"Usage: tray-monitor [-c config_file] [-d debug_level]\n"
+"       -c <file>     set configuration file to file\n"
+"       -dnn          set debug level to nn\n"
+"       -t            test - read configuration and exit\n"
+"       -?            print this message.\n"
+"\n"
 msgstr ""
 
-#: src/win32/dird/winservice.cpp:119 src/win32/filed/winservice.cpp:238
-#: src/win32/stored/baculasd/winservice.cpp:169
-msgid "StartServiceCtrlDispatcher failed."
+#: src/tray-monitor/tray-monitor.c:262
+#, c-format
+msgid ""
+"Error: %d Monitor resources defined in %s. You must define one and only one "
+"Monitor resource.\n"
 msgstr ""
 
-#: src/win32/dird/winservice.cpp:135 src/win32/filed/winservice.cpp:256
-#: src/win32/stored/baculasd/winservice.cpp:185
-msgid "RegisterServiceCtlHandler failed"
+#: src/tray-monitor/tray-monitor.c:293
+#, c-format
+msgid ""
+"No Client, Storage or Director resource defined in %s\n"
+"Without that I don't how to get status from the File, Storage or Director "
+"Daemon :-(\n"
 msgstr ""
 
-#: src/win32/dird/winservice.cpp:136 src/win32/filed/winservice.cpp:257
-#: src/win32/stored/baculasd/winservice.cpp:186
-msgid "Contact Register Service Handler failure"
+#: src/tray-monitor/tray-monitor.c:315
+#, c-format
+msgid ""
+"Invalid refresh interval defined in %s\n"
+"This value must be greater or equal to 1 second and less or equal to 10 "
+"minutes (read value: %d).\n"
 msgstr ""
 
-#: src/win32/dird/winservice.cpp:152 src/win32/filed/winservice.cpp:273
-#: src/win32/stored/baculasd/winservice.cpp:202
-msgid "ReportStatus STOPPED failed 1"
+#: src/tray-monitor/tray-monitor.c:330
+msgid "Open status window..."
 msgstr ""
 
-#: src/win32/dird/winservice.cpp:175 src/win32/filed/winservice.cpp:296
-#: src/win32/stored/baculasd/winservice.cpp:225
-msgid "Report Service failure"
+#: src/tray-monitor/tray-monitor.c:336
+msgid "Exit"
 msgstr ""
 
-#: src/win32/dird/winservice.cpp:211
-msgid "Unable to install Bacula Director service"
+#: src/tray-monitor/tray-monitor.c:348
+msgid "Bacula tray monitor"
 msgstr ""
 
-#: src/win32/dird/winservice.cpp:219 src/win32/filed/winservice.cpp:340
-#: src/win32/stored/baculasd/winservice.cpp:269
-msgid "Service command length too long"
+#: src/tray-monitor/tray-monitor.c:373
+msgid " (DIR)"
 msgstr ""
 
-#: src/win32/dird/winservice.cpp:220 src/win32/filed/winservice.cpp:341
-#: src/win32/stored/baculasd/winservice.cpp:270
-msgid "Service command length too long. Service not registered."
+#: src/tray-monitor/tray-monitor.c:377
+msgid " (FD)"
 msgstr ""
 
-#: src/win32/dird/winservice.cpp:233
-msgid ""
-"The Service Control Manager could not be contacted - the Bacula Director "
-"service was not installed"
+#: src/tray-monitor/tray-monitor.c:381
+msgid " (SD)"
 msgstr ""
 
-#: src/win32/dird/winservice.cpp:258
-msgid "The Bacula Director service could not be installed"
+#: src/tray-monitor/tray-monitor.c:394
+msgid "Unknown status."
 msgstr ""
 
-#: src/win32/dird/winservice.cpp:264
-msgid "Provides director services. Bacula -- the network backup solution."
+#: src/tray-monitor/tray-monitor.c:464
+msgid "Refresh interval in seconds: "
 msgstr ""
 
-#: src/win32/dird/winservice.cpp:272
+#: src/tray-monitor/tray-monitor.c:472
+msgid "Refresh now"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:476
+msgid "About"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:480
+msgid "Close"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:500
+#, c-format
+msgid "Disconnecting from Director %s:%d\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:503
+#, c-format
+msgid "Disconnecting from Client %s:%d\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:506
+#, c-format
+msgid "Disconnecting from Storage %s:%d\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:543 src/tray-monitor/tray-monitor.c:554
+msgid "Bacula Tray Monitor"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:545 src/tray-monitor/tray-monitor.c:556
+msgid "Written by Nicolas Boichat\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:546 src/tray-monitor/tray-monitor.c:557
+msgid "Version"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:625
+#, c-format
+msgid "Error, currentitem is not a Client or a Storage..\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:699
+#, c-format
+msgid ""
+"Current job: %s\n"
+"Last job: %s"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:711
+#, c-format
+msgid " (%d errors)"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:714
+#, c-format
+msgid " (%d error)"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:752
+msgid "No current job."
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:755
+msgid "No last job."
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:763
+msgid "Job status: Created"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:768
+msgid "Job status: Running"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:772
+msgid "Job status: Blocked"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:777
+msgid "Job status: Terminated"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:782
+msgid "Job status: Terminated in error"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:788
+msgid "Job status: Error"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:792
+msgid "Job status: Fatal error"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:797
+msgid "Job status: Verify differences"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:802
+msgid "Job status: Canceled"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:807
+msgid "Job status: Waiting on File daemon"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:812
+msgid "Job status: Waiting on the Storage daemon"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:817
+msgid "Job status: Waiting for new media"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:822
+msgid "Job status: Waiting for Mount"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:827
+msgid "Job status: Waiting for storage resource"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:832
+msgid "Job status: Waiting for job resource"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:837
+msgid "Job status: Waiting for Client resource"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:842
+msgid "Job status: Waiting for maximum jobs"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:847
+msgid "Job status: Waiting for start time"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:852
+msgid "Job status: Waiting for higher priority jobs to finish"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:857
+#, c-format
+msgid "Unknown job status %c."
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:858
+#, c-format
+msgid "Job status: Unknown(%c)"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:865
+#, c-format
+msgid "Bad scan : '%s' %d\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:906
+#, c-format
+msgid "Connecting to Director %s:%d"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:912
+#, c-format
+msgid "Connecting to Client %s:%d\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:913
+#, c-format
+msgid "Connecting to Client %s:%d"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:919
+#, c-format
+msgid "Connecting to Storage %s:%d\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:920
+#, c-format
+msgid "Connecting to Storage %s:%d"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:925 src/tray-monitor/tray-monitor.c:963
+#, c-format
+msgid "Error, currentitem is not a Client, a Storage or a Director..\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:931
+msgid "Cannot connect to daemon.\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:932
+msgid "Cannot connect to daemon."
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:944
+#, c-format
+msgid "Authentication error : %s"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:951
+msgid "Opened connection with Director daemon.\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:952
+msgid "Opened connection with Director daemon."
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:955
+msgid "Opened connection with File daemon.\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:956
+msgid "Opened connection with File daemon."
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:959
+msgid "Opened connection with Storage daemon.\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:960
+msgid "Opened connection with Storage daemon."
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:997
+msgid "<< Error: BNET_PROMPT signal received. >>\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:1002 src/wx-console/console_thread.cpp:486
+msgid "<< Heartbeat signal received, answered. >>\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:1006
+#, c-format
+msgid "<< Unexpected signal received : %s >>\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:1011
+msgid "<ERROR>\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:1015
+msgid "Error : BNET_HARDEOF or BNET_ERROR"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:1021
+msgid "<STOP>\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:1025
+msgid "Error : Connection closed."
+msgstr ""
+
+#: src/tray-monitor/tray_conf.c:177
+#, c-format
+msgid "Monitor: name=%s FDtimeout=%s SDtimeout=%s\n"
+msgstr ""
+
+#: src/tray-monitor/tray_conf.c:183
+#, c-format
+msgid "Director: name=%s address=%s FDport=%d\n"
+msgstr ""
+
+#: src/tray-monitor/tray_conf.c:187
+#, c-format
+msgid "Client: name=%s address=%s FDport=%d\n"
+msgstr ""
+
+#: src/tray-monitor/tray_conf.c:191
+#, c-format
+msgid "Storage: name=%s address=%s SDport=%d\n"
+msgstr ""
+
+#: src/wx-console/authenticate.c:150
+msgid "Bad response to Hello command: ERR="
+msgstr ""
+
+#: src/baconfig.h:72
+#, c-format
+msgid "Failed ASSERT: %s\n"
+msgstr ""
+
+#: src/baconfig.h:79
+msgid "*None*"
+msgstr ""
+
+#: src/win32/dird/winmain.cpp:193 src/win32/dird/winmain.cpp:200
+#: src/win32/filed/winmain.cpp:224 src/win32/filed/winmain.cpp:231
+#: src/win32/stored/baculasd/winmain.cpp:225
+#: src/win32/stored/baculasd/winmain.cpp:232
+msgid "Bacula Usage"
+msgstr ""
+
+#: src/win32/dird/winmain.cpp:197 src/win32/filed/winmain.cpp:228
+#: src/win32/stored/baculasd/winmain.cpp:229
+msgid "Bad Command Line Options"
+msgstr ""
+
+#: src/win32/dird/winservice.cpp:119 src/win32/filed/winservice.cpp:238
+#: src/win32/stored/baculasd/winservice.cpp:169
+msgid "StartServiceCtrlDispatcher failed."
+msgstr ""
+
+#: src/win32/dird/winservice.cpp:135 src/win32/filed/winservice.cpp:256
+#: src/win32/stored/baculasd/winservice.cpp:185
+msgid "RegisterServiceCtlHandler failed"
+msgstr ""
+
+#: src/win32/dird/winservice.cpp:136 src/win32/filed/winservice.cpp:257
+#: src/win32/stored/baculasd/winservice.cpp:186
+msgid "Contact Register Service Handler failure"
+msgstr ""
+
+#: src/win32/dird/winservice.cpp:152 src/win32/filed/winservice.cpp:273
+#: src/win32/stored/baculasd/winservice.cpp:202
+msgid "ReportStatus STOPPED failed 1"
+msgstr ""
+
+#: src/win32/dird/winservice.cpp:175 src/win32/filed/winservice.cpp:296
+#: src/win32/stored/baculasd/winservice.cpp:225
+msgid "Report Service failure"
+msgstr ""
+
+#: src/win32/dird/winservice.cpp:211
+msgid "Unable to install Bacula Director service"
+msgstr ""
+
+#: src/win32/dird/winservice.cpp:219 src/win32/filed/winservice.cpp:340
+#: src/win32/stored/baculasd/winservice.cpp:269
+msgid "Service command length too long"
+msgstr ""
+
+#: src/win32/dird/winservice.cpp:220 src/win32/filed/winservice.cpp:341
+#: src/win32/stored/baculasd/winservice.cpp:270
+msgid "Service command length too long. Service not registered."
+msgstr ""
+
+#: src/win32/dird/winservice.cpp:233
+msgid ""
+"The Service Control Manager could not be contacted - the Bacula Director "
+"service was not installed"
+msgstr ""
+
+#: src/win32/dird/winservice.cpp:258
+msgid "The Bacula Director service could not be installed"
+msgstr ""
+
+#: src/win32/dird/winservice.cpp:264
+msgid "Provides director services. Bacula -- the network backup solution."
+msgstr ""
+
+#: src/win32/dird/winservice.cpp:272
 msgid ""
 "The Bacula Director service was successfully installed.\n"
 "The service may be started from the Control Panel and will\n"
@@ -14429,3 +15220,710 @@ msgstr ""
 msgid ""
 "The SCM could not be contacted - the Bacula Storage service was not removed"
 msgstr ""
+
+#: src/wx-console/console_thread.cpp:121
+#, c-format
+msgid ""
+"Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined for "
+"Director \"%s\" in config file.\n"
+"At least one CA certificate store is required.\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:128
+msgid ""
+"No Director resource defined in config file.\n"
+"Without that I don't how to speak to the Director :-(\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:147
+#, c-format
+msgid ""
+"Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined for "
+"Console \"%s\" in config file.\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:169
+msgid "Error while initializing windows sockets...\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:185
+msgid "Error while cleaning up windows sockets...\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:224
+msgid "Error while initializing library."
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:248
+msgid "Cryptographic library initialization failed.\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:252
+msgid "Please correct configuration file.\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:294
+msgid "Error : Library not initialized\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:305
+msgid "Error : No configuration file loaded\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:315
+msgid "Connecting...\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:331
+msgid "Error : No director defined in config file.\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:343
+msgid "Multiple directors found in your config file.\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:352
+#, c-format
+msgid "Please choose a director (1-%d): "
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:424
+msgid "Failed to connect to the director\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:434
+msgid "Connected\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:491
+msgid "<< Unexpected signal received : "
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:511
+msgid "Connection terminated\n"
+msgstr ""
+
+#: src/wx-console/main.cpp:119
+msgid "Bacula bwx-console"
+msgstr ""
+
+#: src/wx-console/main.cpp:124 src/wx-console/wxbmainframe.cpp:267
+#, c-format
+msgid "Welcome to bacula bwx-console %s (%s)!\n"
+msgstr ""
+
+#: src/wx-console/wxbconfigfileeditor.cpp:65
+msgid "Config file editor"
+msgstr ""
+
+#: src/wx-console/wxbconfigfileeditor.cpp:75
+msgid "# Bacula bwx-console Configuration File\n"
+msgstr ""
+
+#: src/wx-console/wxbconfigfileeditor.cpp:111
+msgid "Save and close"
+msgstr ""
+
+#: src/wx-console/wxbconfigfileeditor.cpp:112
+msgid "Close without saving"
+msgstr ""
+
+#: src/wx-console/wxbconfigfileeditor.cpp:139
+#, c-format
+msgid "Unable to write to %s\n"
+msgstr ""
+
+#: src/wx-console/wxbconfigfileeditor.cpp:140
+msgid "Error while saving"
+msgstr ""
+
+#: src/wx-console/wxbconfigpanel.cpp:205
+msgid "Apply"
+msgstr ""
+
+#: src/wx-console/wxbhistorytextctrl.cpp:82
+#: src/wx-console/wxbhistorytextctrl.cpp:153
+#: src/wx-console/wxbmainframe.cpp:291
+msgid "Type your command below:"
+msgstr ""
+
+#: src/wx-console/wxbhistorytextctrl.cpp:117
+msgid "Unknown command."
+msgstr ""
+
+#: src/wx-console/wxbhistorytextctrl.cpp:126
+msgid "Possible completions: "
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:246
+msgid "&About...\tF1"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:246
+msgid "Show about dialog"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:248 src/wx-console/wxbmainframe.cpp:620
+msgid "Connect to the director"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:249
+msgid "Disconnect"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:249
+msgid "Disconnect of the director"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:251
+msgid "Change of configuration file"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:251
+msgid "Change your default configuration file"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:252
+msgid "Edit your configuration file"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:254
+msgid "E&xit\tAlt-X"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:254
+msgid "Quit this program"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:258
+msgid "&File"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:259
+msgid "&Help"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:283
+msgid ""
+"Warning : Unicode is disabled because you are using wxWidgets for GTK+ 1.2.\n"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:287
+msgid ""
+"Warning : There is a problem with wxWidgets for GTK+ 2.0 without Unicode "
+"support when handling non-ASCII filenames: Every non-ASCII character in such "
+"filenames will be replaced by an interrogation mark.\n"
+"If this behaviour disturbs you, please build bwx-console against a Unicode "
+"version of wxWidgets for GTK+ 2.0.\n"
+"---\n"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:298
+msgid "Send"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:375 src/wx-console/wxbmainframe.cpp:387
+msgid "Error while parsing command line arguments, using defaults.\n"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:376 src/wx-console/wxbmainframe.cpp:388
+msgid "Usage: bwx-console [-c configfile] [-w tmp]\n"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:417
+#, c-format
+msgid ""
+"It seems that it is the first time you run bwx-console.\n"
+"This file (%s) has been choosen as default configuration file.\n"
+"Do you want to edit it? (if you click No you will have to select another "
+"file)"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:419
+msgid "First run"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:436
+#, c-format
+msgid ""
+"Unable to read %s\n"
+"Error: %s\n"
+"Do you want to choose another one? (Press no to edit this file)"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:438
+msgid "Unable to read configuration file"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:450
+msgid "Please choose a configuration file to use"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:463
+msgid "This configuration file has been successfully read, use it as default?"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:464
+msgid "Configuration file read successfully"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:474
+#, c-format
+msgid "Using this configuration file: %s\n"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:479
+msgid "Connecting to the director..."
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:494
+msgid "Failed to unregister a data parser !"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:502
+msgid "Quitting.\n"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:517
+msgid ""
+"Welcome to Bacula bwx-console.\n"
+"Written by Nicolas Boichat <nicolas at boichat.ch>\n"
+"Copyright (C), 2005-2007 Free Software Foundation Europe, e.V.\n"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:521
+msgid "About Bacula bwx-console"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:527
+msgid "Please choose your default configuration file"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:531
+msgid "Use this configuration file as default?"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:532
+msgid "Configuration file"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:603
+msgid "Console thread terminated."
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:611
+msgid "Connection to the director lost. Quit program?"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:612
+msgid "Connection lost"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:628
+msgid "Connected to the director."
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:651
+msgid "Reconnect"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:652
+msgid "Reconnect to the director"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:666
+msgid "Disconnected of the director."
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:685 src/wx-console/wxbrestorepanel.cpp:710
+msgid "Unexpected question has been received.\n"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:708 src/wx-console/wxbmainframe.cpp:725
+msgid "bwx-console: unexpected director's question."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:234
+#: src/wx-console/wxbrestorepanel.cpp:1920
+#: src/wx-console/wxbrestorepanel.cpp:1949
+msgid "Enter restore mode"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:237
+msgid "Cancel restore"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:263
+#: src/wx-console/wxbrestorepanel.cpp:317
+msgid "Add"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:265
+#: src/wx-console/wxbrestorepanel.cpp:319
+msgid "Remove"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:267
+#: src/wx-console/wxbrestorepanel.cpp:321
+msgid "Refresh"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:286
+msgid "M"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:290
+msgid "Filename"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:302
+msgid "Perm."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:335
+#: src/wx-console/wxbrestorepanel.cpp:348
+#: src/wx-console/wxbrestorepanel.cpp:503
+#: src/wx-console/wxbrestorepanel.cpp:513
+#: src/wx-console/wxbrestorepanel.cpp:516
+#: src/wx-console/wxbrestorepanel.cpp:1784
+#: src/wx-console/wxbrestorepanel.cpp:1870
+msgid "Job Name"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:337
+#: src/wx-console/wxbrestorepanel.cpp:353
+#: src/wx-console/wxbrestorepanel.cpp:455
+#: src/wx-console/wxbrestorepanel.cpp:456
+#: src/wx-console/wxbrestorepanel.cpp:466
+#: src/wx-console/wxbrestorepanel.cpp:467
+#: src/wx-console/wxbrestorepanel.cpp:1139
+#: src/wx-console/wxbrestorepanel.cpp:1212
+#: src/wx-console/wxbrestorepanel.cpp:1822
+#: src/wx-console/wxbrestorepanel.cpp:1824
+#: src/wx-console/wxbrestorepanel.cpp:1885
+msgid "Fileset"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:340
+#: src/wx-console/wxbrestorepanel.cpp:1206
+#: src/wx-console/wxbrestorepanel.cpp:1222
+#: src/wx-console/wxbrestorepanel.cpp:1224
+#: src/wx-console/wxbrestorepanel.cpp:1232
+#: src/wx-console/wxbrestorepanel.cpp:1234
+#: src/wx-console/wxbrestorepanel.cpp:1253
+#: src/wx-console/wxbrestorepanel.cpp:1260
+#: src/wx-console/wxbrestorepanel.cpp:1812
+#: src/wx-console/wxbrestorepanel.cpp:1823
+#: src/wx-console/wxbrestorepanel.cpp:1944
+msgid "Before"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:342
+msgid "Please configure parameters concerning files to restore :"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:351
+#: src/wx-console/wxbrestorepanel.cpp:1878
+msgid "always"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:351
+msgid "if newer"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:351
+msgid "if older"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:351
+#: src/wx-console/wxbrestorepanel.cpp:1881
+msgid "never"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:359
+msgid "Please configure parameters concerning files restoration :"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:427
+msgid "Getting parameters list."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:435
+msgid "Error : no clients returned by the director."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:459
+msgid "Error : no filesets returned by the director."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:483
+msgid "Error : no storage returned by the director."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:506
+#: src/wx-console/wxbrestorepanel.cpp:530
+msgid "Error : no jobs returned by the director."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:516
+msgid "RestoreFiles"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:551
+msgid "Please configure your restore parameters."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:562
+msgid "Building restore tree..."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:605
+msgid "Error while starting restore: "
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:695
+msgid ""
+"Right click on a file or on a directory, or double-click on its mark to add "
+"it to the restore list."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:732
+#: src/wx-console/wxbrestorepanel.cpp:754
+msgid "bwx-console: unexpected restore question."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:765
+msgid " files selected to be restored."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:770
+msgid " file selected to be restored."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:777
+#, c-format
+msgid "Please configure your restore (%ld files selected to be restored)..."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:787
+msgid "Restore failed : no file selected.\n"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:788
+msgid "Restore failed : no file selected."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:798
+msgid "Restoring, please wait..."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:811
+msgid "Job queued. JobId="
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:813
+msgid "Restore queued, jobid="
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:817
+msgid "Job failed."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:818
+msgid "Restore failed, please look at messages.\n"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:819
+msgid "Restore failed, please look at messages in console."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:825
+#: src/wx-console/wxbrestorepanel.cpp:826
+msgid "Failed to retrieve jobid.\n"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:852
+msgid ""
+"Restore is scheduled in more than two minutes, bwx-console will not wait for "
+"its completion.\n"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:853
+msgid ""
+"Restore is scheduled in more than two minutes, bwx-console will not wait for "
+"its completion."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:879
+msgid "Restore job created, but not yet running."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:884
+#, c-format
+msgid "Restore job running, please wait (%ld of %ld files restored)..."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:888
+msgid "Restore job terminated successfully."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:889
+msgid "Restore job terminated successfully.\n"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:894
+msgid "Restore job terminated in error, see messages in console."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:895
+msgid "Restore job terminated in error, see messages.\n"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:900
+msgid "Restore job reported a non-fatal error."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:904
+msgid "Restore job reported a fatal error."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:909
+msgid "Restore job cancelled by user."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:910
+msgid "Restore job cancelled by user.\n"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:915
+msgid "Restore job is waiting on File daemon."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:919
+msgid "Restore job is waiting for new media."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:923
+msgid "Restore job is waiting for storage resource."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:927
+msgid "Restore job is waiting for job resource."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:931
+msgid "Restore job is waiting for Client resource."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:935
+msgid "Restore job is waiting for maximum jobs."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:939
+msgid "Restore job is waiting for start time."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:943
+msgid "Restore job is waiting for higher priority jobs to finish."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:992
+msgid ""
+"The restore job has not been started within one minute, bwx-console will not "
+"wait for its completion anymore.\n"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:993
+msgid ""
+"The restore job has not been started within one minute, bwx-console will not "
+"wait for its completion anymore."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1003
+msgid "Restore done successfully.\n"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1004
+msgid "Restore done successfully."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1075
+msgid "Applying restore configuration changes..."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1126
+msgid "Failed to find the selected client."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1141
+msgid "Failed to find the selected fileset."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1156
+msgid "Failed to find the selected storage."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1173
+#: src/wx-console/wxbrestorepanel.cpp:1859
+msgid "Run Restore job"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1189
+msgid "Restore configuration changes were applied."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1198
+msgid "Restore cancelled.\n"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1199
+msgid "Restore cancelled."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1221
+msgid "No results to list."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1223
+msgid "No backup found for this client."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1230
+msgid "ERROR"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1231
+msgid "Query failed"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1233
+msgid "Cannot get previous backups list, see console."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1869
+msgid "JobName:"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1873
+msgid "Where:"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1876
+msgid "Replace:"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1879
+msgid "ifnewer"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1880
+msgid "ifolder"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1884
+msgid "FileSet:"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:2001
+msgid "Restoring..."
+msgstr ""
diff --git a/po/fr.po b/po/fr.po
index 7c655e6..9552027 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -1,13 +1,14 @@
 # French translations for Bacula package
 # Traduction anglaise du package Bacula.
-# Copyright (C) 2005-2014 Free Software Foundation Europe e.V.
+# Copyright (C) 2000-2015 Kern Sibbald
 # Nicolas Boichat <nicolas at boichat.ch>, 2005.
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: Bacula 5.2\n"
+"Project-Id-Version: Bacula 1.38\n"
 "Report-Msgid-Bugs-To: bacula-devel at lists.sourceforge.net\n"
-"POT-Creation-Date: 2014-07-29 18:18+0200\n"
+"POT-Creation-Date: 2015-08-09 15:05+0200\n"
 "PO-Revision-Date: 2009-10-18 14:04+0000\n"
 "Last-Translator: Eric Bollengier <eric at eb.homelinux.org>\n"
 "Language-Team: French <bacula-devel-fr at lists.sourceforge.net>\n"
@@ -17,16 +18,17 @@ msgstr ""
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=2; plural=(n > 1);\n"
 
-#: src/baconfig.h:60 src/baconfig.h:61 src/baconfig.h:66 src/baconfig.h:67
+#: src/baconfig.h:64 src/baconfig.h:65 src/baconfig.h:70 src/baconfig.h:71
+#: src/baconfig.h:82 src/baconfig.h:83
 #, c-format
 msgid "Failed ASSERT: %s\n"
 msgstr ""
 
-#: src/baconfig.h:76
+#: src/baconfig.h:91
 msgid "*None*"
 msgstr ""
 
-#: src/lib/status.h:73
+#: src/lib/status.h:78
 msgid ""
 "\n"
 "Terminated Jobs:\n"
@@ -34,210 +36,214 @@ msgstr ""
 "\n"
 "Job terminés :\n"
 
-#: src/lib/status.h:80
+#: src/lib/status.h:85
 msgid " JobId  Level    Files      Bytes   Status   Finished        Name \n"
 msgstr " JobId  Type     Fichiers   Octets   Statut  Terminé         Nom\n"
 
-#: src/lib/status.h:82
+#: src/lib/status.h:87
 msgid "===================================================================\n"
 msgstr "===================================================================\n"
 
-#: src/lib/status.h:102
+#: src/lib/status.h:107
 msgid "Created"
 msgstr "Crée"
 
-#: src/lib/status.h:106
+#: src/lib/status.h:111
 msgid "Error"
 msgstr "Erreur"
 
-#: src/lib/status.h:109
+#: src/lib/status.h:114
 msgid "Diffs"
 msgstr ""
 
-#: src/lib/status.h:112
+#: src/lib/status.h:117
 msgid "Cancel"
 msgstr "Annulé"
 
-#: src/lib/status.h:115
+#: src/lib/status.h:120
 msgid "OK"
 msgstr "OK"
 
-#: src/lib/status.h:118
+#: src/lib/status.h:123
 msgid "OK -- with warnings"
 msgstr "OK -- avec des avertissements"
 
-#: src/lib/status.h:122
+#: src/lib/status.h:126
+msgid "Incomplete"
+msgstr ""
+
+#: src/lib/status.h:129
 msgid "Other"
 msgstr "Autre"
 
-#: src/lib/status.h:134
+#: src/lib/status.h:141
 #, fuzzy, c-format
 msgid "%6d\t%-6s\t%8s\t%10s\t%-7s\t%-8s\t%s\n"
 msgstr "%6d  %-6s %8s %10s %-7s  %-8s %s\n"
 
-#: src/lib/status.h:142
+#: src/lib/status.h:149
 #, c-format
 msgid "%6d  %-6s %8s %10s  %-7s  %-8s %s\n"
 msgstr "%6d  %-6s %8s %10s %-7s  %-8s %s\n"
 
-#: src/lib/status.h:171 src/lib/status.h:182 src/lib/status.h:196
-#: src/lib/status.h:200 src/lib/status.h:204
+#: src/lib/status.h:178 src/lib/status.h:189 src/lib/status.h:203
+#: src/lib/status.h:207 src/lib/status.h:211
 msgid "Bacula "
 msgstr "Bacula "
 
-#: src/qt-console/bat_conf.cpp:130
+#: src/qt-console/bat_conf.cpp:133
 #, c-format
 msgid "No record for %d %s\n"
 msgstr ""
 
-#: src/qt-console/bat_conf.cpp:139
+#: src/qt-console/bat_conf.cpp:142
 #, c-format
 msgid "Director: name=%s address=%s DIRport=%d\n"
 msgstr ""
 
-#: src/qt-console/bat_conf.cpp:143
+#: src/qt-console/bat_conf.cpp:146
 #, fuzzy, c-format
 msgid "Console: name=%s\n"
 msgstr "Console connecté à %s\n"
 
-#: src/qt-console/bat_conf.cpp:146
-#: src/qt-console/tray-monitor/tray_conf.cpp:183
+#: src/qt-console/bat_conf.cpp:149
+#: src/qt-console/tray-monitor/tray_conf.cpp:187
 #, c-format
 msgid "ConsoleFont: name=%s font face=%s\n"
 msgstr ""
 
-#: src/qt-console/bat_conf.cpp:150 src/qt-console/bat_conf.cpp:231
-#: src/qt-console/bat_conf.cpp:279 src/qt-console/bat_conf.cpp:309
+#: src/qt-console/bat_conf.cpp:153 src/qt-console/bat_conf.cpp:234
+#: src/qt-console/bat_conf.cpp:284 src/qt-console/bat_conf.cpp:314
 #, c-format
 msgid "Unknown resource type %d\n"
 msgstr ""
 
-#: src/qt-console/bat_conf.cpp:257
-#: src/qt-console/tray-monitor/tray_conf.cpp:276
+#: src/qt-console/bat_conf.cpp:262
+#: src/qt-console/tray-monitor/tray_conf.cpp:280
 #, c-format
 msgid "%s item is required in %s resource, but not found.\n"
 msgstr ""
 
-#: src/qt-console/bat_conf.cpp:326
-#: src/qt-console/tray-monitor/tray_conf.cpp:360
+#: src/qt-console/bat_conf.cpp:331
+#: src/qt-console/tray-monitor/tray_conf.cpp:364
 #, c-format
 msgid "Attempt to define second %s resource named \"%s\" is not permitted.\n"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:85
+#: src/qt-console/bcomm/dircomm.cpp:89
 #, fuzzy, c-format
 msgid "Already connected\"%s\".\n"
 msgstr "Console connecté à %s\n"
 
-#: src/qt-console/bcomm/dircomm.cpp:96
-#: src/qt-console/tray-monitor/tray-monitor.cpp:347
+#: src/qt-console/bcomm/dircomm.cpp:100
+#: src/qt-console/tray-monitor/tray-monitor.cpp:353
 #, fuzzy, c-format
 msgid "Connecting to Director %s:%d"
 msgstr "Connexion au Director %s:%d\n"
 
-#: src/qt-console/bcomm/dircomm.cpp:98
+#: src/qt-console/bcomm/dircomm.cpp:102
 #, fuzzy, c-format
 msgid ""
 "Connecting to Director %s:%d\n"
 "\n"
 msgstr "Connexion au Director %s:%d\n"
 
-#: src/qt-console/bcomm/dircomm.cpp:150
+#: src/qt-console/bcomm/dircomm.cpp:154
 #, c-format
 msgid "Failed to initialize TLS context for Console \"%s\".\n"
 msgstr "Impossible d'initialiser le contexte TLS pour la Console \"%s\".\n"
 
-#: src/qt-console/bcomm/dircomm.cpp:173
+#: src/qt-console/bcomm/dircomm.cpp:177
 #, c-format
 msgid "Failed to initialize TLS context for Director \"%s\".\n"
 msgstr "Impossible d'initialiser le contexte TLS pour le Director \"%s\".\n"
 
-#: src/qt-console/bcomm/dircomm.cpp:195
-#: src/qt-console/tray-monitor/tray-monitor.cpp:352
+#: src/qt-console/bcomm/dircomm.cpp:199
+#: src/qt-console/tray-monitor/tray-monitor.cpp:358
 #, fuzzy
 msgid "Director daemon"
 msgstr "Director"
 
-#: src/qt-console/bcomm/dircomm.cpp:233
+#: src/qt-console/bcomm/dircomm.cpp:237
 msgid "Initializing ..."
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:249 src/qt-console/console/console.cpp:130
+#: src/qt-console/bcomm/dircomm.cpp:253 src/qt-console/console/console.cpp:134
 #, fuzzy
 msgid "Connected"
 msgstr "Connexion...\n"
 
-#: src/qt-console/bcomm/dircomm.cpp:373
+#: src/qt-console/bcomm/dircomm.cpp:377
 #, fuzzy
 msgid "Command completed ..."
 msgstr "Commande annulée.\n"
 
-#: src/qt-console/bcomm/dircomm.cpp:380 src/qt-console/console/console.cpp:367
+#: src/qt-console/bcomm/dircomm.cpp:384 src/qt-console/console/console.cpp:371
 msgid "Processing command ..."
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:387
+#: src/qt-console/bcomm/dircomm.cpp:391
 msgid "At main prompt waiting for input ..."
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:394 src/qt-console/bcomm/dircomm.cpp:407
+#: src/qt-console/bcomm/dircomm.cpp:398 src/qt-console/bcomm/dircomm.cpp:408
 msgid "At prompt waiting for input ..."
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:415
+#: src/qt-console/bcomm/dircomm.cpp:416
 #, fuzzy
 msgid "Command failed."
 msgstr "Commande annulée.\n"
 
-#: src/qt-console/bcomm/dircomm.cpp:487
+#: src/qt-console/bcomm/dircomm.cpp:488
 #, fuzzy
 msgid "Director disconnected."
 msgstr "Connexion du director le %s\n"
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:107
+#: src/qt-console/bcomm/dircomm_auth.cpp:111
 #, fuzzy, c-format
 msgid "Director authorization problem at \"%s:%d\"\n"
 msgstr "Pas d'enregistrement trouvé en base pour : %s\n"
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:114
+#: src/qt-console/bcomm/dircomm_auth.cpp:118
 #, c-format
 msgid ""
 "Authorization problem: Remote server at \"%s:%d\" did not advertise required "
 "TLS support.\n"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:122
+#: src/qt-console/bcomm/dircomm_auth.cpp:126
 #, c-format
 msgid ""
 "Authorization problem with Director at \"%s:%d\": Remote server requires "
 "TLS.\n"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:133
+#: src/qt-console/bcomm/dircomm_auth.cpp:137
 #, fuzzy, c-format
 msgid "TLS negotiation failed with Director at \"%s:%d\"\n"
-msgstr "Négociation TLS échouée avec le SD « %s:%d ».\n"
+msgstr "Négociation TLS échouée avec le SD \"%s:%d\".\n"
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:145
+#: src/qt-console/bcomm/dircomm_auth.cpp:149
 #, fuzzy, c-format
 msgid ""
 "Bad response to Hello command: ERR=%s\n"
 "The Director at \"%s:%d\" is probably not running.\n"
 msgstr "Mauvaise réponse à la commande Hello : ERR=%s\n"
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:154
+#: src/qt-console/bcomm/dircomm_auth.cpp:158
 #, fuzzy, c-format
 msgid "Director at \"%s:%d\" rejected Hello command\n"
-msgstr "Le File Daemon  « %s:%d » a rejeté la commande Hello\n"
+msgstr "Le File Daemon  \"%s:%d\" a rejeté la commande Hello\n"
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:169
+#: src/qt-console/bcomm/dircomm_auth.cpp:173
 #, fuzzy, c-format
 msgid ""
 "Authorization problem with Director at \"%s:%d\"\n"
 "Most likely the passwords do not agree.\n"
 "If you are using TLS, there may have been a certificate validation error "
 "during the TLS handshake.\n"
-"Please see "
+"For help, please see "
 msgstr ""
 "Problème d'authentification avec le director.\n"
 "Le plus souvent, les mots de pass ne correspondent pas.\n"
@@ -247,16 +253,16 @@ msgstr ""
 "Vous trouverez de l'aide sur\n"
 "http://www.bacula.org/rel-manual/faq.html#AuthorizationErrors\n"
 
-#: src/qt-console/main.cpp:154
+#: src/qt-console/main.cpp:159
 msgid "Cryptography library initialization failed.\n"
 msgstr ""
 
-#: src/qt-console/main.cpp:158
+#: src/qt-console/main.cpp:163
 #, c-format
 msgid "Please correct configuration file: %s\n"
 msgstr "Merci de corriger le fichier de configuration : %s\n"
 
-#: src/qt-console/main.cpp:180
+#: src/qt-console/main.cpp:187
 #, fuzzy, c-format
 msgid ""
 "\n"
@@ -279,18 +285,18 @@ msgstr ""
 "       -t          test - lecture de la configuration et sortie\n"
 "\n"
 
-#: src/qt-console/main.cpp:213 src/qt-console/main.cpp:243
+#: src/qt-console/main.cpp:220 src/qt-console/main.cpp:250
 msgid "TLS required but not configured in Bacula.\n"
 msgstr ""
 
-#: src/qt-console/main.cpp:221
+#: src/qt-console/main.cpp:228
 #, c-format
 msgid ""
 "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined for "
 "Director \"%s\" in %s. At least one CA certificate store is required.\n"
 msgstr ""
 
-#: src/qt-console/main.cpp:230
+#: src/qt-console/main.cpp:237
 #, c-format
 msgid ""
 "No Director resource defined in %s\n"
@@ -299,80 +305,80 @@ msgstr ""
 "Pas de director défini pour %s\n"
 "Sans cette définition, il n'est pas possible de se connecter à celui-ci.\n"
 
-#: src/qt-console/main.cpp:251
+#: src/qt-console/main.cpp:258
 #, c-format
 msgid ""
 "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined for "
 "Console \"%s\" in %s.\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:75
+#: src/qt-console/tray-monitor/authenticate.cpp:79
 #, fuzzy
 msgid ""
 "Director authorization problem.\n"
 "Most likely the passwords do not agree.\n"
-"Please see "
+"For help, please see "
 msgstr ""
 "Problème d'authentification avec le director.\n"
 "Le plus souvent, les mots de pass ne correspondent pas.\n"
 "Vous trouverez de l'aide sur\n"
 "http://www.bacula.org/rel-manual/faq.html#AuthorizationErrors\n"
 
-#: src/qt-console/tray-monitor/authenticate.cpp:84
+#: src/qt-console/tray-monitor/authenticate.cpp:88
 #, c-format
 msgid "Bad response to Hello command: ERR=%s\n"
 msgstr "Mauvaise réponse à la commande Hello : ERR=%s\n"
 
-#: src/qt-console/tray-monitor/authenticate.cpp:91
+#: src/qt-console/tray-monitor/authenticate.cpp:95
 msgid "Director rejected Hello command\n"
 msgstr "Le director a rejeté la commande Hello\n"
 
-#: src/qt-console/tray-monitor/authenticate.cpp:119
+#: src/qt-console/tray-monitor/authenticate.cpp:123
 #, c-format
 msgid "Error sending Hello to Storage daemon. ERR=%s\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:125
+#: src/qt-console/tray-monitor/authenticate.cpp:129
 #, fuzzy
 msgid ""
 "Director and Storage daemon passwords or names not the same.\n"
-"Please see "
+"For help, please see "
 msgstr ""
 "Le mot de passe ou le nom du Director et du Client ne sont pas identiques.\n"
 
-#: src/qt-console/tray-monitor/authenticate.cpp:132
+#: src/qt-console/tray-monitor/authenticate.cpp:136
 #, fuzzy, c-format
 msgid "bdird<stored: bad response to Hello command: ERR=%s\n"
 msgstr ""
-"bdird<stored: « %s:%s » Mauvaise réponse à la commande Hello : ERR=%s\n"
+"bdird<stored: \"%s:%s\" Mauvaise réponse à la commande Hello : ERR=%s\n"
 
-#: src/qt-console/tray-monitor/authenticate.cpp:139
+#: src/qt-console/tray-monitor/authenticate.cpp:143
 msgid "Storage daemon rejected Hello command\n"
 msgstr "Le storage a rejeté la commande Hello\n"
 
-#: src/qt-console/tray-monitor/authenticate.cpp:165
+#: src/qt-console/tray-monitor/authenticate.cpp:169
 #, fuzzy, c-format
 msgid "Error sending Hello to File daemon. ERR=%s\n"
 msgstr "Erreur pendant lors de la récupération du pool. ERR=%s\n"
 
-#: src/qt-console/tray-monitor/authenticate.cpp:171
+#: src/qt-console/tray-monitor/authenticate.cpp:175
 #, fuzzy
 msgid ""
 "Director and File daemon passwords or names not the same.\n"
-"Please see "
+"For help, please see "
 msgstr ""
 "Le mot de passe ou le nom du Director et du Client ne sont pas identiques.\n"
 
-#: src/qt-console/tray-monitor/authenticate.cpp:178
+#: src/qt-console/tray-monitor/authenticate.cpp:182
 #, c-format
 msgid "Bad response from File daemon to Hello command: ERR=%s\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:185
+#: src/qt-console/tray-monitor/authenticate.cpp:189
 msgid "File daemon rejected Hello command\n"
 msgstr "Le Client a rejeté la commande Hello\\n\n"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:55
+#: src/qt-console/tray-monitor/tray-monitor.cpp:59
 #, fuzzy, c-format
 msgid ""
 "\n"
@@ -395,14 +401,14 @@ msgstr ""
 "       -t          test - lecture de la configuration et sortie\n"
 "\n"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:204
+#: src/qt-console/tray-monitor/tray-monitor.cpp:210
 #, c-format
 msgid ""
 "Error: %d Monitor resources defined in %s. You must define one and only one "
 "Monitor resource.\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:236
+#: src/qt-console/tray-monitor/tray-monitor.cpp:242
 #, fuzzy, c-format
 msgid ""
 "No Client, Storage or Director resource defined in %s\n"
@@ -412,7 +418,7 @@ msgstr ""
 "Pas de director défini pour %s\n"
 "Sans cette définition, il n'est pas possible de se connecter à celui-ci.\n"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:251
+#: src/qt-console/tray-monitor/tray-monitor.cpp:257
 #, c-format
 msgid ""
 "Invalid refresh interval defined in %s\n"
@@ -420,115 +426,118 @@ msgid ""
 "minutes (read value: %d).\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:319
+#: src/qt-console/tray-monitor/tray-monitor.cpp:325
 #, c-format
 msgid "Error, currentitem is not a Client or a Storage..\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:357
+#: src/qt-console/tray-monitor/tray-monitor.cpp:363
 #, fuzzy, c-format
 msgid "Connecting to Client %s:%d"
 msgstr "Connexion au client %s (%s:%d)\n"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:362
+#: src/qt-console/tray-monitor/tray-monitor.cpp:368
 msgid "File daemon"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:367
+#: src/qt-console/tray-monitor/tray-monitor.cpp:373
 #, fuzzy, c-format
 msgid "Connecting to Storage %s:%d"
 msgstr "Connexion au Director %s:%d\n"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:372
+#: src/qt-console/tray-monitor/tray-monitor.cpp:378
 msgid "Storage daemon"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:376
-#: src/qt-console/tray-monitor/tray-monitor.cpp:406
+#: src/qt-console/tray-monitor/tray-monitor.cpp:382
+#: src/qt-console/tray-monitor/tray-monitor.cpp:412
 #, c-format
 msgid "Error, currentitem is not a Client, a Storage or a Director..\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:381
+#: src/qt-console/tray-monitor/tray-monitor.cpp:387
 #, fuzzy
 msgid "Cannot connect to daemon."
 msgstr "Impossible de se connecter au démon Storage\n"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:390
+#: src/qt-console/tray-monitor/tray-monitor.cpp:396
 #, fuzzy, c-format
 msgid "Authentication error : %s"
 msgstr "Erreur sur l'autochangeur : ERR=%s\n"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:397
+#: src/qt-console/tray-monitor/tray-monitor.cpp:403
 #, fuzzy
 msgid "Opened connection with Director daemon."
 msgstr "Impossible de se connecter au Storage daemon.\n"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:400
+#: src/qt-console/tray-monitor/tray-monitor.cpp:406
 #, fuzzy
 msgid "Opened connection with File daemon."
 msgstr "Impossible de se connecter au client.\n"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:403
+#: src/qt-console/tray-monitor/tray-monitor.cpp:409
 #, fuzzy
 msgid "Opened connection with Storage daemon."
 msgstr "Impossible de se connecter au Storage daemon.\n"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:454
+#: src/qt-console/tray-monitor/tray-monitor.cpp:460
 msgid "Error : BNET_HARDEOF or BNET_ERROR"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:463
+#: src/qt-console/tray-monitor/tray-monitor.cpp:469
 #, fuzzy
 msgid "Error : Connection closed."
 msgstr "Connexion...\n"
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:156
+#: src/qt-console/tray-monitor/tray_conf.cpp:160
 #, c-format
 msgid "No %s resource defined\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:165
+#: src/qt-console/tray-monitor/tray_conf.cpp:169
 #, c-format
 msgid "Monitor: name=%s FDtimeout=%s SDtimeout=%s\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:171
+#: src/qt-console/tray-monitor/tray_conf.cpp:175
 #, c-format
 msgid "Director: name=%s address=%s FDport=%d\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:175
+#: src/qt-console/tray-monitor/tray_conf.cpp:179
 #, fuzzy, c-format
 msgid "Client: name=%s address=%s FDport=%d\n"
 msgstr "Client \"%s\" adresse positionné à %s\n"
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:179
+#: src/qt-console/tray-monitor/tray_conf.cpp:183
 #, c-format
 msgid "Storage: name=%s address=%s SDport=%d\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:187
+#: src/qt-console/tray-monitor/tray_conf.cpp:191
 #, c-format
 msgid "Unknown resource type %d in dump_resource.\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:245
+#: src/qt-console/tray-monitor/tray_conf.cpp:249
 #, c-format
 msgid "Unknown resource type %d in free_resource.\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:282
+#: src/qt-console/tray-monitor/tray_conf.cpp:286
 #, c-format
 msgid "Too many items in %s resource\n"
 msgstr "Trop d'élément dans la ressource %s\n"
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:302
-#: src/qt-console/tray-monitor/tray_conf.cpp:340
+#: src/qt-console/tray-monitor/tray_conf.cpp:306
+#: src/qt-console/tray-monitor/tray_conf.cpp:344
 #, c-format
 msgid "Unknown resource type %d in save_resource.\n"
 msgstr ""
 
+#~ msgid "A user name for MySQL must be supplied.\n"
+#~ msgstr "Un nom d'utilisateur MySQL doit être fourni.\n"
+
 #~ msgid "Unable to initialize DB lock. ERR=%s\n"
 #~ msgstr "Impossible d'initialiser le verrou sur la base. ERR=%s\n"
 
@@ -542,8 +551,8 @@ msgstr ""
 #~ "Base=%s Utilisateur=%s\n"
 #~ "Le serveur n'est pas démarré ou bien votre password est invalide.\n"
 
-#~ msgid "A user name for MySQL must be supplied.\n"
-#~ msgstr "Un nom d'utilisateur MySQL doit être fourni.\n"
+#~ msgid "A user name for PostgreSQL must be supplied.\n"
+#~ msgstr "Un nom d'utilisateur PostgreSQL doit être fourni.\n"
 
 #, fuzzy
 #~ msgid ""
@@ -556,6 +565,10 @@ msgstr ""
 #~ "Le serveur n'est pas démarré ou bien votre password est invalide.\n"
 
 #, fuzzy
+#~ msgid "Fetch failed: ERR=%s\n"
+#~ msgstr "Erreur sur l'ouverture du périphérique. ERR=%s\n"
+
+#, fuzzy
 #~ msgid "error starting batch mode: %s"
 #~ msgstr "erreur en terminant le mode batch: %s\n"
 
@@ -567,9 +580,6 @@ msgstr ""
 #~ msgid "error copying in batch mode: %s"
 #~ msgstr "erreur en terminant le mode batch: %s\n"
 
-#~ msgid "A user name for PostgreSQL must be supplied.\n"
-#~ msgstr "Un nom d'utilisateur PostgreSQL doit être fourni.\n"
-
 #~ msgid "No results to list.\n"
 #~ msgstr "Liste vide.\n"
 
@@ -614,9 +624,33 @@ msgstr ""
 #~ msgstr "Pas de volume trouvé en base pour l'objet %d.\n"
 
 #, fuzzy
+#~ msgid "RestoreObject record \"%d\" not found.\n"
+#~ msgstr "le client \"%s\" est introuvable.\n"
+
+#, fuzzy
 #~ msgid "query dbids failed: ERR=%s\n"
 #~ msgstr "fopen %s en erreur : ERR=%s\n"
 
+#, fuzzy
+#~ msgid "Media record with MediaId=%s not found.\n"
+#~ msgstr "%s ressource %s introuvable.\n"
+
+#, fuzzy
+#~ msgid "Media record for Volume name \"%s\" not found.\n"
+#~ msgstr "Le nouveau volume \"%s\" existe déjà en base.\n"
+
+#, fuzzy
+#~ msgid "Media record for Volume Name \"%s\" not found in Catalog.\n"
+#~ msgstr "Le nouveau volume \"%s\" existe déjà en base.\n"
+
+#, fuzzy
+#~ msgid "Snapshot record with SnapshotId=%s not found.\n"
+#~ msgstr "%s ressource %s introuvable.\n"
+
+#, fuzzy
+#~ msgid "Snapshot record for Snapshot name \"%s\" not found.\n"
+#~ msgstr "Le nouveau volume \"%s\" existe déjà en base.\n"
+
 #~ msgid "Query failed: %s\n"
 #~ msgstr "Erreur sur la requête : %s\n"
 
@@ -629,7 +663,7 @@ msgstr ""
 #~ "Most likely the passwords do not agree.\n"
 #~ "If you are using TLS, there may have been a certificate validation error "
 #~ "during the TLS handshake.\n"
-#~ "Please see "
+#~ "For help, please see "
 #~ msgstr ""
 #~ "Problème d'authentification avec le director.\n"
 #~ "Le plus souvent, les mots de pass ne correspondent pas.\n"
@@ -639,28 +673,41 @@ msgstr ""
 #~ "Vous trouverez de l'aide sur\n"
 #~ "http://www.bacula.org/rel-manual/faq.html#AuthorizationErrors\n"
 
+#, fuzzy
 #~ msgid ""
 #~ "\n"
-#~ "Version: "
+#~ "%sVersion: "
 #~ msgstr ""
 #~ "\n"
 #~ "Version : "
 
+#, fuzzy
+#~ msgid "Please use valid -l argument: %s\n"
+#~ msgstr "FileSet"
+
 #~ msgid "quit"
 #~ msgstr "quit"
 
 #~ msgid "print current time"
 #~ msgstr "affiche la date courante"
 
+#, fuzzy
+#~ msgid "encode command string"
+#~ msgstr "Erreur sur la commande : %s\n"
+
 #~ msgid "exit = quit"
 #~ msgstr "exit = quit"
 
+#, fuzzy
+#~ msgid "send a file to the director"
+#~ msgstr "Impossible de se connecter au Director\n"
+
 #~ msgid ": is an invalid command\n"
 #~ msgstr "%s : est une commande invalide.\n"
 
 #, fuzzy
 #~ msgid "Illegal separator character.\n"
-#~ msgstr "Caractère illégal « %c » dans le nom.\n"
+#~ msgstr "Caractère illégal \"%c\" dans le nom.\n"
 
 #, fuzzy
 #~ msgid "Command logic problem\n"
@@ -697,15 +744,16 @@ msgstr ""
 
 #~ msgid "Too many arguments. Enclose command in double quotes.\n"
 #~ msgstr ""
-#~ "Trop d'arguments sur la commande. Essayez d'utiliser des « \" » autour "
+#~ "Trop d'arguments sur la commande. Essayez d'utiliser des \"\"\" autour "
 #~ "des commandes\n"
 
 #, fuzzy
 #~ msgid "Cannot popen(\"%s\", \"r\"): ERR=%s\n"
 #~ msgstr "Impossible d'ouvrir le fichier %s : ERR=%s\n"
 
-#~ msgid "Autochanger error: ERR=%s\n"
-#~ msgstr "Erreur sur l'autochangeur : ERR=%s\n"
+#, fuzzy
+#~ msgid "@exec error: ERR=%s\n"
+#~ msgstr "erreur de fermeture : ERR=%s\n"
 
 #, fuzzy
 #~ msgid "Error getting Job record for Job report: ERR=%s"
@@ -727,7 +775,7 @@ msgstr ""
 #~ "Passwords or names not the same or\n"
 #~ "Maximum Concurrent Jobs exceeded on the SD or\n"
 #~ "SD networking messed up (restart daemon).\n"
-#~ "Please see "
+#~ "For help, please see: "
 #~ msgstr ""
 #~ "Le Director a rencontré un problème d'authentification avec le Storage "
 #~ "Daemon \"%s:%d\".\n"
@@ -740,15 +788,15 @@ msgstr ""
 
 #, fuzzy
 #~ msgid "TLS negotiation failed with SD at \"%s:%d\"\n"
-#~ msgstr "Négociation TLS échouée avec le SD « %s:%d ».\n"
+#~ msgstr "Négociation TLS échouée avec le SD \"%s:%d\".\n"
 
 #~ msgid "bdird<stored: \"%s:%s\" bad response to Hello command: ERR=%s\n"
 #~ msgstr ""
-#~ "bdird<stored: « %s:%s » Mauvaise réponse à la commande Hello : ERR=%s\n"
+#~ "bdird<stored: \"%s:%s\" Mauvaise réponse à la commande Hello : ERR=%s\n"
 
 #, fuzzy
 #~ msgid "Storage daemon at \"%s:%d\" rejected Hello command\n"
-#~ msgstr "Le Storage daemon « %s:%d » a rejeté la commande Hello\n"
+#~ msgstr "Le Storage daemon \"%s:%d\" a rejeté la commande Hello\n"
 
 #, fuzzy
 #~ msgid "Error sending Hello to File daemon at \"%s:%d\". ERR=%s\n"
@@ -765,9 +813,9 @@ msgstr ""
 #~ "Passwords or names not the same or\n"
 #~ "Maximum Concurrent Jobs exceeded on the FD or\n"
 #~ "FD networking messed up (restart daemon).\n"
-#~ "Please see "
+#~ "For help, please see: "
 #~ msgstr ""
-#~ "Impossible de s'authentifier avec le File Daemon  « %s:%d ».\n"
+#~ "Impossible de s'authentifier avec le File Daemon  \"%s:%d\".\n"
 #~ "Les causes possibles sont :\n"
 #~ "- Les mots de pass ne correspondent pas ;\n"
 #~ "- Le nombre maximum de job concurrent est atteint sur le FD ;\n"
@@ -777,20 +825,20 @@ msgstr ""
 
 #, fuzzy
 #~ msgid "TLS negotiation failed with FD at \"%s:%d\".\n"
-#~ msgstr "Négociation TLS échouée avec le FD  « %s:%d ».\n"
+#~ msgstr "Négociation TLS échouée avec le FD  \"%s:%d\".\n"
 
 #, fuzzy
 #~ msgid ""
 #~ "Bad response from File daemon at \"%s:%d\" to Hello command: ERR=%s\n"
 #~ msgstr ""
-#~ "Mauvaise réponse du File Daemon  « %s:%d » à la commande Hello : ERR=%s\n"
+#~ "Mauvaise réponse du File Daemon  \"%s:%d\" à la commande Hello : ERR=%s\n"
 
 #, fuzzy
 #~ msgid "File daemon at \"%s:%d\" rejected Hello command\n"
-#~ msgstr "Le File Daemon  « %s:%d » a rejeté la commande Hello\n"
+#~ msgstr "Le File Daemon  \"%s:%d\" a rejeté la commande Hello\n"
 
 #, fuzzy
-#~ msgid "1000 OK: %d %s Version: %s (%s)\n"
+#~ msgid "1000 OK: %d %s %sVersion: %s (%s)\n"
 #~ msgstr "1000 OK: %s Version: %s (%s)\n"
 
 #~ msgid ""
@@ -814,6 +862,10 @@ msgstr ""
 #~ msgid "Cannot find previous jobids.\n"
 #~ msgstr "Impossible de trouver la ressource Job \"%s\"\n"
 
+#, fuzzy
+#~ msgid "Restart Incomplete Backup JobId %s, Job=%s\n"
+#~ msgstr "Démarrage du backup JobId %s, Job=%s\n"
+
 #~ msgid "Start Backup JobId %s, Job=%s\n"
 #~ msgstr "Démarrage du backup JobId %s, Job=%s\n"
 
@@ -863,7 +915,8 @@ msgstr ""
 #~ "  SD Bytes Written:       %s (%sB)\n"
 #~ "  Rate:                   %.1f KB/s\n"
 #~ "  Software Compression:   %s\n"
-#~ "%s  VSS:                    %s\n"
+#~ "  Comm Line Compression:  %s\n"
+#~ "%s  Snapshot/VSS:           %s\n"
 #~ "  Encryption:             %s\n"
 #~ "  Accurate:               %s\n"
 #~ "  Volume name(s):         %s\n"
@@ -925,6 +978,46 @@ msgstr ""
 #~ "Impossible d'ouvrir le fichier bootstrap (WriteBootstrap) :\n"
 #~ "%s : ERR=%s\n"
 
+#, fuzzy
+#~ msgid ""
+#~ "\n"
+#~ "%sVersion: %s (%s)\n"
+#~ "\n"
+#~ "Usage: bdirjson [-f -s] [-c config_file] [-d debug_level] [config_file]\n"
+#~ "       -r <res>    get resource type <res>\n"
+#~ "       -n <name>   get resource <name>\n"
+#~ "       -l <dirs>   get only directives matching dirs (use with -r)\n"
+#~ "       -D          get only data\n"
+#~ "       -R          do not apply JobDefs to Job\n"
+#~ "       -c <file>   set configuration file to file\n"
+#~ "       -d <nn>     set debug level to <nn>\n"
+#~ "       -dt         print timestamp in debug output\n"
+#~ "       -t          test - read configuration and exit\n"
+#~ "       -s          output in show text format\n"
+#~ "       -v          verbose user messages\n"
+#~ "       -?          print this message.\n"
+#~ "\n"
+#~ msgstr ""
+#~ "\n"
+#~ "Version : %s (%s)\n"
+#~ "\n"
+#~ "Usage : dird [-f -s] [-c config_file] [-d debug_level] [config_file]\n"
+#~ "      -c <fich>      utilise fich comme fichier de configuration\n"
+#~ "      -d <nn>        positionne le niveau de debug à nn\n"
+#~ "      -dt            affiche un timestamp devant chaque ligne de debug\n"
+#~ "      -f             reste en avant-plan (pour debugger)\n"
+#~ "      -g             groupid\n"
+#~ "      -r <job>       lance <job> maintenant\n"
+#~ "      -s             pas de signaux\n"
+#~ "      -t             test - lit seulement le fichier de configuration\n"
+#~ "      -u             userid\n"
+#~ "      -v             affiche les messages utilisateurs\n"
+#~ "      -?             affiche ce message.\n"
+#~ "\n"
+
+#~ msgid "No storage specified in Job \"%s\" nor in Pool.\n"
+#~ msgstr "Pas de Storage spécifié dans le job \"%s\" ni dans le Pool.\n"
+
 #~ msgid "Unable to create bootstrap file %s. ERR=%s\n"
 #~ msgstr "Impossible de créer le fichier bootstrap %s. ERR=%s\n"
 
@@ -937,9 +1030,6 @@ msgstr ""
 #~ msgid "Error writing bsr file.\n"
 #~ msgstr "Erreur pendant l'écriture du fichier bsr.\n"
 
-#~ msgid "Bootstrap records written to %s\n"
-#~ msgstr "Fichier bootstrap écrit sur %s\n"
-
 #, fuzzy
 #~ msgid ""
 #~ "The Job will require the following (*=>InChanger):\n"
@@ -1010,22 +1100,23 @@ msgstr ""
 #, fuzzy
 #~ msgid ""
 #~ "\n"
-#~ "Version: %s (%s)\n"
+#~ "%sVersion: %s (%s)\n"
 #~ "\n"
 #~ "Usage: bacula-dir [-f -s] [-c config_file] [-d debug_level] "
 #~ "[config_file]\n"
-#~ "       -c <file>   set configuration file to file\n"
-#~ "       -d <nn>     set debug level to <nn>\n"
-#~ "       -dt         print timestamp in debug output\n"
-#~ "       -f          run in foreground (for debugging)\n"
-#~ "       -g          groupid\n"
-#~ "       -m          print kaboom output (for debugging)\n"
-#~ "       -r <job>    run <job> now\n"
-#~ "       -s          no signals\n"
-#~ "       -t          test - read configuration and exit\n"
-#~ "       -u          userid\n"
-#~ "       -v          verbose user messages\n"
-#~ "       -?          print this message.\n"
+#~ "     -c <file>        set configuration file to file\n"
+#~ "     -d <nn>[,<tags>] set debug level to <nn>, debug tags to <tags>\n"
+#~ "     -dt              print timestamp in debug output\n"
+#~ "     -T               set trace on\n"
+#~ "     -f               run in foreground (for debugging)\n"
+#~ "     -g               groupid\n"
+#~ "     -m               print kaboom output (for debugging)\n"
+#~ "     -r <job>         run <job> now\n"
+#~ "     -s               no signals\n"
+#~ "     -t               test - read configuration and exit\n"
+#~ "     -u               userid\n"
+#~ "     -v               verbose user messages\n"
+#~ "     -?               print this message.\n"
 #~ "\n"
 #~ msgstr ""
 #~ "\n"
@@ -1048,9 +1139,6 @@ msgstr ""
 #~ msgid "Resetting previous configuration.\n"
 #~ msgstr "Retour à la dernière configuration.\n"
 
-#~ msgid "No storage specified in Job \"%s\" nor in Pool.\n"
-#~ msgstr "Pas de Storage spécifié dans le job \"%s\" ni dans le Pool.\n"
-
 #~ msgid "Could not open Catalog \"%s\", database \"%s\".\n"
 #~ msgstr ""
 #~ "Impossible d'ouvrir le catalogue \"%s\", sur la base de données \"%s\".\n"
@@ -1070,6 +1158,10 @@ msgstr ""
 #~ msgid "Could not compile regex pattern \"%s\" ERR=%s\n"
 #~ msgstr "Impossible d'ouvrir %s : ERR=%s\n"
 
+#, fuzzy
+#~ msgid "Client: Name=%s Enabled=%d Address=%s FDport=%d MaxJobs=%u\n"
+#~ msgstr "Client \"%s\" adresse positionné à %s\n"
+
 #~ msgid "Job"
 #~ msgstr "Job"
 
@@ -1119,6 +1211,14 @@ msgstr ""
 #~ msgstr "  --> RunWhen=%u\n"
 
 #, fuzzy
+#~ msgid "  --> IncrementalBackup"
+#~ msgstr "Incrémental"
+
+#, fuzzy
+#~ msgid "  --> DifferentialBackup"
+#~ msgstr "Différentiel"
+
+#, fuzzy
 #~ msgid "      MaxRunSchedTime=%u\n"
 #~ msgstr "  --> MaxRunTime=%u\n"
 
@@ -1162,6 +1262,15 @@ msgstr ""
 #~ msgid "Expected one of: %s, got: %s"
 #~ msgstr "Attendait %s, a pas : %s"
 
+#, fuzzy
+#~ msgid "Could not find Storage Resource %s referenced on line %d : %s\n"
+#~ msgstr "Impossible de trouver la ressource \"%s\" utilisée ligne %d : %s\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "Attempt to redefine Storage resource \"%s\" referenced on line %d : %s\n"
+#~ msgstr "Impossible de trouver la ressource \"%s\" utilisée ligne %d : %s\n"
+
 #~ msgid "Expected a Migration Job Type keyword, got: %s"
 #~ msgstr "Attendait un type de Job de Migration, eu : %s"
 
@@ -1225,6 +1334,10 @@ msgstr ""
 #~ msgid "RestoreObject failed.\n"
 #~ msgstr "restauration de fichier"
 
+#, fuzzy
+#~ msgid "ComponentInfo failed.\n"
+#~ msgstr "Commande annulée.\n"
+
 #~ msgid "bget_dirmsg: unknown bnet signal %d\n"
 #~ msgstr "bget_dirmsg : signal bnet inconnu %d\n"
 
@@ -1244,9 +1357,6 @@ msgstr ""
 #~ msgid "Expected a FileSet option keyword, got:%s:"
 #~ msgstr "Attendait une option de FileSet, eu : %s:"
 
-#~ msgid "Expected an drivetype string, got: %s\n"
-#~ msgstr "Attendait un type de lecteur, pas : %s\n"
-
 #~ msgid "Expected a filename, got: %s"
 #~ msgstr "Attendait un nom de fichier, eu : %s"
 
@@ -1280,6 +1390,10 @@ msgstr ""
 #~ msgstr "Impossible de se connecter au Storage daemon.\n"
 
 #, fuzzy
+#~ msgid "Client resource \"%s\" does not exist.\n"
+#~ msgstr "Erreur : le client %s n'est pas définie.\n"
+
+#, fuzzy
 #~ msgid "canceled"
 #~ msgstr "Annulé"
 
@@ -1298,7 +1412,7 @@ msgstr ""
 #~ msgstr "Temps d'exécution maximum atteind. Abandon du job.\n"
 
 #, fuzzy
-#~ msgid "Pool \"%s\" not in database. ERR=%s"
+#~ msgid "Cannot create pool \"%s\" in database. ERR=%s"
 #~ msgstr "Pool %s introuvable en base. %s"
 
 #, fuzzy
@@ -1306,28 +1420,24 @@ msgstr ""
 #~ msgstr "Pas d'enregistrement trouvé en base pour : %s\n"
 
 #, fuzzy
-#~ msgid "Storage from Run NextPool override"
-#~ msgstr "Sélectionnez le Pool"
-
-#, fuzzy
 #~ msgid "Job's NextPool resource"
 #~ msgstr "Sélectionnez le Pool"
 
 #, fuzzy
-#~ msgid "Storage from Job's NextPool resource"
+#~ msgid "Job Pool's NextPool resource"
 #~ msgstr "Sélectionnez le Pool"
 
 #, fuzzy
-#~ msgid "Job Pool's NextPool resource"
+#~ msgid "Pool's NextPool resource"
 #~ msgstr "Sélectionnez le Pool"
 
 #, fuzzy
-#~ msgid "Storage from Pool's NextPool resource"
-#~ msgstr "Sélectionnez le Pool"
+#~ msgid "No Client specified.\n"
+#~ msgstr "Le client est déjà spécifié.\n"
 
 #, fuzzy
 #~ msgid "Client resource"
-#~ msgstr "Pas de ressource « Restore Job » trouvée !\n"
+#~ msgstr "Pas de ressource \"Restore Job\" trouvée !\n"
 
 #~ msgid "No storage specified.\n"
 #~ msgstr "Pas de storage sélectionné.\n"
@@ -1599,7 +1709,7 @@ msgstr ""
 #~ msgstr "Impossible de déplacer un Volume du Scratch. ERR=%s\n"
 
 #~ msgid "Using Volume \"%s\" from 'Scratch' pool.\n"
-#~ msgstr "Utilisation du Volume \"%s\" du pool « Scratch ».\n"
+#~ msgstr "Utilisation du Volume \"%s\" du pool \"Scratch\".\n"
 
 #~ msgid "Recycled volume \"%s\"\n"
 #~ msgstr "Volume recyclé \"%s\"\n"
@@ -1676,6 +1786,105 @@ msgstr ""
 #~ msgstr "Job %s non trouvé\n"
 
 #, fuzzy
+#~ msgid "Bad response from SD to %s command. Wanted %s, got %s len=%ld\n"
+#~ msgstr "Mauvaise réponse à la commande %s : voulait %s, pas %s\n"
+
+#, fuzzy
+#~ msgid "Snapshot not found\n"
+#~ msgstr "Le Storage \"%s\" est introuvable.\n"
+
+#, fuzzy
+#~ msgid "Client resource not found\n"
+#~ msgstr "Pas de ressource \"Restore Job\" trouvée !\n"
+
+#~ msgid "Connecting to Client %s at %s:%d\n"
+#~ msgstr "Connexion au client %s (%s:%d)\n"
+
+#~ msgid "Failed to connect to Client.\n"
+#~ msgstr "Impossible de se connecter au Client.\n"
+
+#, fuzzy
+#~ msgid "Snapshot \"%s\" deleted from client %s\n"
+#~ msgstr "L'ancien volume \"%s\" a été supprimé du catalogue.\n"
+
+#, fuzzy
+#~ msgid "Snapshot \"%s\" deleted from catalog\n"
+#~ msgstr "L'ancien volume \"%s\" a été supprimé du catalogue.\n"
+
+#, fuzzy
+#~ msgid "Snapshot \"%s\" on Client %s\n"
+#~ msgstr "est en attente du client %s"
+
+#, fuzzy
+#~ msgid "No snapshot found\n"
+#~ msgstr "Job %s non trouvé\n"
+
+#, fuzzy
+#~ msgid "Snapshot choice: \n"
+#~ msgstr "Elément à mettre à jour :\n"
+
+#, fuzzy
+#~ msgid "List snapshots in Catalog"
+#~ msgstr "purge les enregistrements du catalogue"
+
+#, fuzzy
+#~ msgid "List snapshots on Client"
+#~ msgstr "est en attente du client %s"
+
+#~ msgid "Done"
+#~ msgstr "Fin"
+
+#~ msgid "Selection terminated.\n"
+#~ msgstr "Sélection terminée.\n"
+
+#, fuzzy
+#~ msgid "Enter a SnapshotId: "
+#~ msgstr "Saisissez le nouveau slot : "
+
+#, fuzzy
+#~ msgid "Unable to get Snapshot record.\n"
+#~ msgstr "Impossible de récupérer le Job du JobId=%s : ERR=%s\n"
+
+#~ msgid "Invalid retention period specified: %s\n"
+#~ msgstr "Période de rétention invalide : %s\n"
+
+#~ msgid "New retention period is: %s\n"
+#~ msgstr "La nouvelle période de rétention est : %s\n"
+
+#, fuzzy
+#~ msgid "New Comment is: %s\n"
+#~ msgstr "Le nouveau pool est : %s\n"
+
+#~ msgid "Parameters to modify:\n"
+#~ msgstr "Paramètre à modifier :\n"
+
+#, fuzzy
+#~ msgid "Snapshot Retention Period"
+#~ msgstr "Période de rétention d'un volume"
+
+#~ msgid "Select parameter to modify"
+#~ msgstr "Sélectionnez le paramètre à modifier"
+
+#, fuzzy
+#~ msgid "Updating Snapshot \"%s\" on \"%s\"\n"
+#~ msgstr "Mise à jour du Volume \"%s\"\n"
+
+#~ msgid "Current retention period is: %s\n"
+#~ msgstr "La période de rétention actuelle est : %s\n"
+
+#, fuzzy
+#~ msgid "Enter Snapshot Retention period: "
+#~ msgstr "Saisissez une nouvelle période de rétention : "
+
+#, fuzzy
+#~ msgid "Current comment is: %s\n"
+#~ msgstr "Le pool courant est : %s\n"
+
+#, fuzzy
+#~ msgid "Enter Snapshot comment: "
+#~ msgstr "Exécuter une requête SQL : "
+
+#, fuzzy
 #~ msgid "Add media to a pool"
 #~ msgstr "ajouter un média dans un pool"
 
@@ -1762,6 +1971,14 @@ msgstr ""
 #~ msgstr "Job en cours :\n"
 
 #, fuzzy
+#~ msgid "Restart a job"
+#~ msgstr "Sélectionnez le Job de restauration"
+
+#, fuzzy
+#~ msgid "Resume a job"
+#~ msgstr "Job en cours :\n"
+
+#, fuzzy
 #~ msgid "Report status"
 #~ msgstr "Statut :\n"
 
@@ -1868,12 +2085,6 @@ msgstr ""
 #~ msgid "Pool %s created.\n"
 #~ msgstr "Pool %s créé.\n"
 
-#~ msgid "Connecting to Client %s at %s:%d\n"
-#~ msgstr "Connexion au client %s (%s:%d)\n"
-
-#~ msgid "Failed to connect to Client.\n"
-#~ msgstr "Impossible de se connecter au Client.\n"
-
 #, fuzzy
 #~ msgid "Failed to set bandwidth limit to Client.\n"
 #~ msgstr "Impossible de se connecter au Client.\n"
@@ -1897,8 +2108,9 @@ msgstr ""
 #~ msgid "Client \"%s\" address set to %s\n"
 #~ msgstr "Client \"%s\" adresse positionné à %s\n"
 
-#~ msgid "Job \"%s\" not found.\n"
-#~ msgstr "Job \"%s\" non trouvé.\n"
+#, fuzzy
+#~ msgid "Client \"%s\" %sabled\n"
+#~ msgstr "le client \"%s\" est introuvable.\n"
 
 #~ msgid "Connecting to Storage daemon %s at %s:%d\n"
 #~ msgstr "Connexion au Storage Daemon %s (%s:%d)\n"
@@ -1928,6 +2140,9 @@ msgstr ""
 #~ msgid "No authorization for Client \"%s\"\n"
 #~ msgstr "Pas d'enregistrement trouvé en base pour : %s\n"
 
+#~ msgid "Job \"%s\" not found.\n"
+#~ msgstr "Job \"%s\" non trouvé.\n"
+
 #, fuzzy
 #~ msgid "Fileset \"%s\" not found.\n"
 #~ msgstr "Le FileSet \"%s\" est introuvable.\n"
@@ -1974,7 +2189,7 @@ msgstr ""
 
 #, fuzzy
 #~ msgid "Are you sure you want to delete %d JobIds ? (yes/no): "
-#~ msgstr "Êtes vous certain de vouloir supprimer ce Pool ? (oui/non) : "
+#~ msgstr "Êtes vous certain de vouloir supprimer ce Pool ? (oui/non) : "
 
 #~ msgid "Enter JobId to delete: "
 #~ msgstr "Saisissez le JobId à supprimer : "
@@ -1996,11 +2211,15 @@ msgstr ""
 
 #, fuzzy
 #~ msgid "Are you sure you want to delete Volume \"%s\"? (yes/no): "
-#~ msgstr "Êtes vous certain de vouloir supprimer ce Volume ? (oui/non) : "
+#~ msgstr "Êtes vous certain de vouloir supprimer ce Volume ? (oui/non) : "
 
 #, fuzzy
 #~ msgid "Are you sure you want to delete Pool \"%s\"? (yes/no): "
-#~ msgstr "Êtes vous certain de vouloir supprimer ce Pool ? (oui/non) : "
+#~ msgstr "Êtes vous certain de vouloir supprimer ce Pool ? (oui/non) : "
+
+#, fuzzy
+#~ msgid "Invalid device name. %s"
+#~ msgstr "Option d'écrasement (Replace) invalide : %s\n"
 
 #~ msgid "Using Catalog name=%s DB=%s\n"
 #~ msgstr "Utilisation du Catalogue name=%s DB=%s\n"
@@ -2044,10 +2263,34 @@ msgstr ""
 #~ msgid "Using Catalog \"%s\"\n"
 #~ msgstr "Utilisation du Catalogue \"%s\"\n"
 
+#, fuzzy
+#~ msgid "List Media failed: ERR=%s\n"
+#~ msgstr "fopen %s en erreur : ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Command line"
+#~ msgstr "Erreur sur la commande : %s\n"
+
+#, fuzzy
+#~ msgid "Invalid keyword found: %s\n"
+#~ msgstr "Argument invalide : %s\n"
+
+#, fuzzy
+#~ msgid "Display data files usage"
+#~ msgstr "Message de Bacula"
+
+#, fuzzy
+#~ msgid "Select action to perform on Dedup Engine"
+#~ msgstr "Sélectionnez le composant a tuer"
+
 #~ msgid ": is an invalid command.\n"
 #~ msgstr ": est une commande invalide.\n"
 
 #, fuzzy
+#~ msgid "Failed to send command to Client.\n"
+#~ msgstr "Impossible de se connecter au Client.\n"
+
+#, fuzzy
 #~ msgid "Unable to get Job record for Job=%s\n"
 #~ msgstr "Impossible de récupérer le Job du JobId=%s : ERR=%s\n"
 
@@ -2057,9 +2300,7 @@ msgstr ""
 
 #, fuzzy
 #~ msgid "Unable to get Client record for Client=%s\n"
-#~ msgstr ""
-#~ "Impossible de récupérer les informations du Media pour le Volume %s : ERR="
-#~ "%s\n"
+#~ msgstr "Impossible de récupérer le Job du JobId=%s : ERR=%s\n"
 
 #, fuzzy
 #~ msgid "Unable to get last Job record for Client=%s\n"
@@ -2084,10 +2325,6 @@ msgstr ""
 #~ msgstr "fopen %s en erreur : ERR=%s\n"
 
 #, fuzzy
-#~ msgid "List Media failed: ERR=%s\n"
-#~ msgstr "fopen %s en erreur : ERR=%s\n"
-
-#, fuzzy
 #~ msgid "List Location failed: ERR=%s\n"
 #~ msgstr "Erreur sur l'ouverture du périphérique. ERR=%s\n"
 
@@ -2106,7 +2343,7 @@ msgstr ""
 
 #, fuzzy
 #~ msgid "Illegal character \"%c\" in a comment.\n"
-#~ msgstr "Caractère illégal « %c » dans le nom.\n"
+#~ msgstr "Caractère illégal \"%c\" dans le nom.\n"
 
 #, fuzzy
 #~ msgid "Comment too long.\n"
@@ -2204,7 +2441,7 @@ msgstr ""
 #~ msgstr "Le nombre maximum de volume (%d) pour ce pool est atteint.\n"
 
 #~ msgid "Illegal character \"%c\" in a volume name.\n"
-#~ msgstr "Caractères « %c » interdits dans le nom d'un volume.\n"
+#~ msgstr "Caractères \"%c\" interdits dans le nom d'un volume.\n"
 
 #~ msgid "Sending relabel command from \"%s\" to \"%s\" ...\n"
 #~ msgstr "Envoie de la commande pour re-labéliser de \"%s\" à \"%s\"...\n"
@@ -2221,7 +2458,8 @@ msgstr ""
 #~ msgid "Invalid Slot number: %s\n"
 #~ msgstr "Numéro de slot invalide : %s\n"
 
-#~ msgid "Invalid Volume name: %s\n"
+#, fuzzy
+#~ msgid "Invalid Volume name: %s. Volume skipped.\n"
 #~ msgstr "Nom de Volume invalide : %s\n"
 
 #~ msgid "Device \"%s\" has %d slots.\n"
@@ -2245,16 +2483,20 @@ msgstr ""
 #~ msgid "No disabled Jobs.\n"
 #~ msgstr "Pas de job programmé.\n"
 
-#, fuzzy
-#~ msgid "disabled"
-#~ msgstr "est bloqué"
-
 #~ msgid "%s resource %s not found.\n"
 #~ msgstr "%s ressource %s introuvable.\n"
 
 #~ msgid "Resource %s not found\n"
 #~ msgstr "Ressource %s introuvable\n"
 
+#, fuzzy
+#~ msgid "Invalid jobid argument\n"
+#~ msgstr "argument invalide"
+
+#, fuzzy
+#~ msgid "Unknown ObjectType %s\n"
+#~ msgstr "Mot clef inconnu : %s\n"
+
 #~ msgid "Jobid %d used %d Volume(s): %s\n"
 #~ msgstr "JobId %d a utilisé %d volume(s) : %s\n"
 
@@ -2400,7 +2642,7 @@ msgstr ""
 #~ msgstr "Impossible d'écrire le marqueur EOF. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "No Volumes found to perform %s action.\n"
+#~ msgid "No Volumes found to perform \"truncate\" command.\n"
 #~ msgstr "Pas de volume à labéliser ou pas de codebar.\n"
 
 #~ msgid "Unable move recycled Volume in full Pool \"%s\" MaxVols=%d\n"
@@ -2440,6 +2682,9 @@ msgstr ""
 #~ msgid "No files selected to be restored.\n"
 #~ msgstr "Aucun fichier sélectionné pour la restauration.\n"
 
+#~ msgid "Bootstrap records written to %s\n"
+#~ msgstr "Fichier bootstrap écrit sur %s\n"
+
 #~ msgid ""
 #~ "\n"
 #~ "1 file selected to be restored.\n"
@@ -2459,7 +2704,7 @@ msgstr ""
 
 #, fuzzy
 #~ msgid "No Client resource found!\n"
-#~ msgstr "Pas de ressource « Restore Job » trouvée !\n"
+#~ msgstr "Pas de ressource \"Restore Job\" trouvée !\n"
 
 #, fuzzy
 #~ msgid "The restore will use the following job(s) as Base\n"
@@ -2469,7 +2714,7 @@ msgstr ""
 #~ msgstr "Afficher les 20 derniers jobs lancés"
 
 #~ msgid "List Jobs where a given File is saved"
-#~ msgstr "Afficher les jobs où un fichier donné a été sauvegardé"
+#~ msgstr "Afficher les jobs où un fichier donné a été sauvegardé"
 
 #~ msgid "Enter list of comma separated JobIds to select"
 #~ msgstr "Saisir une liste de JobIds à sélectionner (ex : 12,4,3)"
@@ -2618,6 +2863,18 @@ msgstr ""
 #~ msgstr "erreur sockopt : %s\n"
 
 #, fuzzy
+#~ msgid "Unable to create component file %s. ERR=%s\n"
+#~ msgstr "Impossible de créer le fichier bootstrap %s. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to fdopen component file %s. ERR=%s\n"
+#~ msgstr "3910 Impossible d'ouvrir le device %s : ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Error writing component file.\n"
+#~ msgstr "Erreur pendant l'écriture du fichier bsr.\n"
+
+#, fuzzy
 #~ msgid ""
 #~ "\n"
 #~ "Building directory tree for JobId(s) %s ...  "
@@ -2753,11 +3010,36 @@ msgstr ""
 #~ msgid "Select termination code: "
 #~ msgstr "Sélection terminée.\n"
 
+#, fuzzy
+#~ msgid "Unable to use current plugin configuration, discarding it."
+#~ msgstr "Impossible de lire le certificat à partir du fichier"
+
+#, fuzzy
+#~ msgid "Plugin Restore Options\n"
+#~ msgstr "Sélectionnez le Job de restauration"
+
+#, fuzzy
+#~ msgid "Use above plugin configuration? (yes/mod/no): "
+#~ msgstr "Continuer ? (oui/mod/non) : "
+
 #~ msgid "mod"
 #~ msgstr "mod"
 
-#~ msgid "Parameters to modify:\n"
-#~ msgstr "Paramètre à modifier :\n"
+#, fuzzy
+#~ msgid "Please enter a value for %s: "
+#~ msgstr "Saisissez le JobId pour la restauration : "
+
+#, fuzzy
+#~ msgid "Plugins to configure:\n"
+#~ msgstr "Plugin=%s non trouvé.\n"
+
+#, fuzzy
+#~ msgid "Select plugin to configure"
+#~ msgstr "TLS actif mais non configuré.\n"
+
+#, fuzzy
+#~ msgid "Can't configure %32s\n"
+#~ msgstr "Impossible d'ouvrir le fichier de configuration \"%s\" : %s\n"
 
 #~ msgid "Level"
 #~ msgstr "Type"
@@ -2789,14 +3071,11 @@ msgstr ""
 #~ msgstr "Destination"
 
 #~ msgid "Replace"
-#~ msgstr "Écrasement"
+#~ msgstr "Ecrasement"
 
 #~ msgid "JobId"
 #~ msgstr "JobId"
 
-#~ msgid "Select parameter to modify"
-#~ msgstr "Sélectionnez le paramètre à modifier"
-
 #~ msgid ""
 #~ "Please enter desired start time as YYYY-MM-DD HH:MM:SS (return for now): "
 #~ msgstr ""
@@ -2816,15 +3095,11 @@ msgstr ""
 #~ msgstr "Impossible d'ouvrir %s : ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Command input"
-#~ msgstr "Erreur sur la commande : %s\n"
-
-#, fuzzy
 #~ msgid "Please enter the full path prefix for restore (/ for none): "
 #~ msgstr "Saisissez le chemin (prefix) pour la restauration (/ pour aucun) : "
 
 #~ msgid "Replace:\n"
-#~ msgstr "Écrasement :\n"
+#~ msgstr "Ecrasement :\n"
 
 #~ msgid "Select replace option"
 #~ msgstr "Saisissez l'option d'écrasement"
@@ -2835,12 +3110,16 @@ msgstr ""
 #~ "Vous ne devez pas spécifié de fichier bootstrap pour pouvoir utiliser un "
 #~ "JobId.\n"
 
-#~ msgid "Invalid replace option: %s\n"
-#~ msgstr "Option d'écrasement (Replace) invalide : %s\n"
+#, fuzzy
+#~ msgid "Please Plugin Options string: "
+#~ msgstr "Saisissez le début du chemin (prefix) à enlever : "
 
 #, fuzzy
-#~ msgid "Storage from NextPool override"
-#~ msgstr "Sélectionnez le Pool"
+#~ msgid "Command input"
+#~ msgstr "Erreur sur la commande : %s\n"
+
+#~ msgid "Invalid replace option: %s\n"
+#~ msgstr "Option d'écrasement (Replace) invalide : %s\n"
 
 #, fuzzy
 #~ msgid "Please enter the path prefix to strip: "
@@ -2922,6 +3201,7 @@ msgstr ""
 #~ "%sStorage:  %s (From %s)\n"
 #~ "When:     %s\n"
 #~ "Priority: %d\n"
+#~ "%s%s%s"
 #~ msgstr ""
 #~ "Lancement du job %s\n"
 #~ "JobName  : %s\n"
@@ -2967,6 +3247,10 @@ msgstr ""
 #~ msgstr "Saisissez le JobId pour la restauration : "
 
 #, fuzzy
+#~ msgid "User specified"
+#~ msgstr "Pas de storage sélectionné.\n"
+
+#, fuzzy
 #~ msgid ""
 #~ "Run Restore job\n"
 #~ "JobName:         %s\n"
@@ -2980,12 +3264,13 @@ msgstr ""
 #~ "When:            %s\n"
 #~ "Catalog:         %s\n"
 #~ "Priority:        %d\n"
+#~ "Plugin Options:  %s\n"
 #~ msgstr ""
 #~ "Lancement de la restauration\n"
 #~ "JobName :         %s\n"
 #~ "Bootstrap :       %s\n"
 #~ "RegexWhere :      %s\n"
-#~ "Écrasement :      %s\n"
+#~ "Ecrasement :      %s\n"
 #~ "FileSet :         %s\n"
 #~ "Backup Client :   %s\n"
 #~ "Restore Client :  %s\n"
@@ -2994,7 +3279,6 @@ msgstr ""
 #~ "Catalogue :       %s\n"
 #~ "Priorité :        %d\n"
 
-#, fuzzy
 #~ msgid ""
 #~ "Run Restore job\n"
 #~ "JobName:         %s\n"
@@ -3008,12 +3292,13 @@ msgstr ""
 #~ "When:            %s\n"
 #~ "Catalog:         %s\n"
 #~ "Priority:        %d\n"
+#~ "Plugin Options:  %s\n"
 #~ msgstr ""
 #~ "Lancement de la restauration\n"
 #~ "JobName :        %s\n"
 #~ "Bootstrap :      %s\n"
 #~ "Déplacement :    %s\n"
-#~ "Écrasement :     %s\n"
+#~ "Ecrasement :     %s\n"
 #~ "FileSet :        %s\n"
 #~ "Backup Client :  %s\n"
 #~ "Restore Client : %s\n"
@@ -3035,7 +3320,6 @@ msgstr ""
 #~ msgid "Where:      %s\n"
 #~ msgstr "Where :     %s\n"
 
-#, fuzzy
 #~ msgid ""
 #~ "Replace:         %s\n"
 #~ "Client:          %s\n"
@@ -3044,8 +3328,9 @@ msgstr ""
 #~ "When:            %s\n"
 #~ "Catalog:         %s\n"
 #~ "Priority:        %d\n"
+#~ "Plugin Options:  %s\n"
 #~ msgstr ""
-#~ "Écrasement :      %s\n"
+#~ "Ecrasement :      %s\n"
 #~ "Client :          %s\n"
 #~ "Storage :         %s\n"
 #~ "JobId :           %s\n"
@@ -3174,6 +3459,10 @@ msgstr ""
 #~ msgid "The current %s retention period is: %s\n"
 #~ msgstr "La période de rétention courante %s est : %s\n"
 
+#, fuzzy
+#~ msgid "Continue? (yes/no): "
+#~ msgstr "Continuer ? (oui/mod/non) : "
+
 #~ msgid "Continue? (yes/mod/no): "
 #~ msgstr "Continuer ? (oui/mod/non) : "
 
@@ -3198,12 +3487,20 @@ msgstr ""
 #~ msgid "Select Catalog resource"
 #~ msgstr "Sélectionnez le Catalogue"
 
-#~ msgid "The defined Job resources are:\n"
+#, fuzzy
+#~ msgid "The disabled Job resources are:\n"
+#~ msgstr "Les Job définis sont :\n"
+
+#, fuzzy
+#~ msgid "The enabled Job resources are:\n"
 #~ msgstr "Les Job définis sont :\n"
 
 #~ msgid "Select Job resource"
 #~ msgstr "Sélectionnez le Job"
 
+#~ msgid "The defined Job resources are:\n"
+#~ msgstr "Les Job définis sont :\n"
+
 #, fuzzy
 #~ msgid "Error: Restore Job resource \"%s\" does not exist.\n"
 #~ msgstr "Erreur : le Pool \"%s\" n'existe pas.\n"
@@ -3217,12 +3514,30 @@ msgstr ""
 #~ msgid "The defined Client resources are:\n"
 #~ msgstr "Les clients définis sont :\n"
 
+#, fuzzy
+#~ msgid "Select Client resource"
+#~ msgstr "Sélectionnez le FileSet"
+
 #~ msgid "Select Client (File daemon) resource"
 #~ msgstr "Sélectionnez le client (File daemon)"
 
 #~ msgid "Error: Client resource %s does not exist.\n"
 #~ msgstr "Erreur : le client %s n'est pas définie.\n"
 
+#, fuzzy
+#~ msgid "The defined Schedule resources are:\n"
+#~ msgstr "Les clients définis sont :\n"
+
+#, fuzzy
+#~ msgid "Schedule"
+#~ msgstr ""
+#~ "\n"
+#~ "Jobs planifiés :\n"
+
+#, fuzzy
+#~ msgid "Select Schedule resource"
+#~ msgstr "Sélectionnez le Pool"
+
 #~ msgid "Could not find Client %s: ERR=%s"
 #~ msgstr "Impossible de trouver le client %s : ERR=%s"
 
@@ -3248,7 +3563,7 @@ msgstr ""
 
 #~ msgid "No pools defined. Use the \"create\" command to create one.\n"
 #~ msgstr ""
-#~ "Pas de Pool défini. Utilisez la commande « create » pour en créer un.\n"
+#~ "Pas de Pool défini. Utilisez la commande \"create\" pour en créer un.\n"
 
 #~ msgid "Defined Pools:\n"
 #~ msgstr "Pools définis :\n"
@@ -3260,8 +3575,8 @@ msgstr ""
 #~ msgstr "Pas d'accès au Pool \"%s\"\n"
 
 #, fuzzy
-#~ msgid "Enter *MediaId or Volume name: "
-#~ msgstr "Saisissez le MediaId ou le nom du Volume : "
+#~ msgid "Enter a Volume name or *MediaId: "
+#~ msgstr "Entrez le nom du Volume : "
 
 #~ msgid "The defined Pool resources are:\n"
 #~ msgstr "Les Pools définis sont :\n"
@@ -3328,15 +3643,24 @@ msgstr ""
 #~ msgstr "Commande interdite depuis cette console.\n"
 
 #, fuzzy
-#~ msgid "Warning Job JobId=%d is not running. Continuing anyway...\n"
+#~ msgid "Warning Job JobId=%d is not running.\n"
 #~ msgstr "Attention le Job %s n'est pas en cours. Continuons quand même...\n"
 
 #, fuzzy
 #~ msgid "Confirm %s of %d Job%s (yes/no): "
 #~ msgstr "Confirmez l'annulation (oui/non) : "
 
-#~ msgid "Warning Job %s is not running. Continuing anyway ...\n"
-#~ msgstr "Attention le Job %s n'est pas en cours. Continuons quand même...\n"
+#, fuzzy
+#~ msgid "Unauthorized command from this console for job=%s.\n"
+#~ msgstr "Commande interdite depuis cette console.\n"
+
+#, fuzzy
+#~ msgid "Warning Job %s is not running.\n"
+#~ msgstr "JobId %s n'est pas en cours.\n"
+
+#, fuzzy
+#~ msgid "Unauthorized command from this console for ujobid=%s.\n"
+#~ msgstr "Commande interdite depuis cette console.\n"
 
 #, fuzzy
 #~ msgid "Select Job(s):\n"
@@ -3358,11 +3682,16 @@ msgstr ""
 #~ msgid "Select daemon type for status"
 #~ msgstr "Saisissez le composant à afficher"
 
-#~ msgid "%s Version: %s (%s) %s %s %s\n"
+#, fuzzy
+#~ msgid "%s %sVersion: %s (%s) %s %s %s\n"
 #~ msgstr "%s Version : %s (%s) %s %s %s\n"
 
 #, fuzzy
-#~ msgid "Daemon started %s. Jobs: run=%d, running=%d mode=%d,%d\n"
+#~ msgid "Daemon started %s, conf reloaded %s\n"
+#~ msgstr "Démon démarré depuis %s, 1 job lancé depuis cette date.\n"
+
+#, fuzzy
+#~ msgid " Jobs: run=%d, running=%d mode=%d,%d\n"
 #~ msgstr "Démon démarré depuis %s, %d jobs lancés depuis cette date.\n"
 
 #, fuzzy
@@ -3436,7 +3765,8 @@ msgstr ""
 #~ "\n"
 #~ "Job en cours :\n"
 
-#~ msgid "Console connected at %s\n"
+#, fuzzy
+#~ msgid "Console connected %sat %s\n"
 #~ msgstr "Console connecté à %s\n"
 
 #~ msgid ""
@@ -3469,6 +3799,10 @@ msgstr ""
 #~ msgid "has terminated with warnings"
 #~ msgstr "Job terminés :\n"
 
+#, fuzzy
+#~ msgid "has terminated in incomplete state"
+#~ msgstr "Job terminés :\n"
+
 #~ msgid "has errors"
 #~ msgstr "est en erreur"
 
@@ -3571,7 +3905,7 @@ msgstr ""
 #~ msgstr "estime la taille de la restauration"
 
 #~ msgid "same as done command"
-#~ msgstr "synonyme de la commande  « done »"
+#~ msgstr "synonyme de la commande  \"done\""
 
 #~ msgid "find files, wildcards allowed"
 #~ msgstr "recherche des fichiers, les jokers (*) fonctionnent"
@@ -3629,16 +3963,16 @@ msgstr ""
 #~ "(mark)\n"
 #~ "et supprimez (unmark) les fichiers à restaurer. Aucun fichier n'est "
 #~ "sélectionné\n"
-#~ "par défaut sauf si vous avez utilisé l'option « all » dans la commande.\n"
-#~ "Terminez votre saisie par « done »\n"
+#~ "par défaut sauf si vous avez utilisé l'option \"all\" dans la commande.\n"
+#~ "Terminez votre saisie par \"done\"\n"
 #~ "\n"
 
 #~ msgid "cwd is: %s\n"
 #~ msgstr "Le répertoire courant est : %s\n"
 
 #, fuzzy
-#~ msgid "Invalid command \"%s\". Enter \"done\" to exit.\n"
-#~ msgstr "Commande invalide. Tapez « done » pour quitter.\n"
+#~ msgid "Invalid command \"%s\".  Enter \"done\" to exit.\n"
+#~ msgstr "Commande invalide. Tapez \"done\" pour quitter.\n"
 
 #~ msgid "No files marked.\n"
 #~ msgstr "Aucun fichier sélectionné.\n"
@@ -3678,8 +4012,8 @@ msgstr ""
 
 #~ msgid "Too few or too many arguments. Try using double quotes.\n"
 #~ msgstr ""
-#~ "Trop ou pas assez d'arguments sur la commande. Essayez d'utiliser des « "
-#~ "\" »\n"
+#~ "Trop ou pas assez d'arguments sur la commande. Essayez d'utiliser des "
+#~ "\"\"\"\n"
 
 #~ msgid "No files unmarked.\n"
 #~ msgstr "Pas de fichier dé-sélectionné.\n"
@@ -3700,7 +4034,7 @@ msgstr ""
 #~ msgstr "%d répertoires dé-sélectionnés.\n"
 
 #~ msgid "Update choice:\n"
-#~ msgstr "Élément à mettre à jour :\n"
+#~ msgstr "Elément à mettre à jour :\n"
 
 #~ msgid "Volume parameters"
 #~ msgstr "Paramètres d'un volume"
@@ -3715,6 +4049,10 @@ msgstr ""
 #~ msgid "Long term statistics"
 #~ msgstr "Spooling des données...\n"
 
+#, fuzzy
+#~ msgid "Snapshot parameters"
+#~ msgstr "Paramètres d'un volume"
+
 #~ msgid "item"
 #~ msgstr "item"
 
@@ -3724,12 +4062,6 @@ msgstr ""
 #~ msgid "New Volume status is: %s\n"
 #~ msgstr "Le statut du volume est : %s\n"
 
-#~ msgid "Invalid retention period specified: %s\n"
-#~ msgstr "Période de rétention invalide : %s\n"
-
-#~ msgid "New retention period is: %s\n"
-#~ msgstr "La nouvelle période de rétention est : %s\n"
-
 #~ msgid "Invalid use duration specified: %s\n"
 #~ msgstr "Durée d'utilisation invalide : %s\n"
 
@@ -3797,9 +4129,6 @@ msgstr ""
 #~ msgid "RecyclePool"
 #~ msgstr "RecyclePool"
 
-#~ msgid "Done"
-#~ msgstr "Fin"
-
 #~ msgid "Updating Volume \"%s\"\n"
 #~ msgstr "Mise à jour du Volume \"%s\"\n"
 
@@ -3812,9 +4141,6 @@ msgstr ""
 #~ msgid "Choose new Volume Status"
 #~ msgstr "Saisissez le nouveau statut du volume (Volume Status)"
 
-#~ msgid "Current retention period is: %s\n"
-#~ msgstr "La période de rétention actuelle est : %s\n"
-
 #~ msgid "Enter Volume Retention period: "
 #~ msgstr "Saisissez la période de rétention du volume : "
 
@@ -3909,9 +4235,6 @@ msgstr ""
 #~ msgid "Current ActionOnPurge is: %s\n"
 #~ msgstr "La valeur actuelle est : %s\n"
 
-#~ msgid "Selection terminated.\n"
-#~ msgstr "Sélection terminée.\n"
-
 #~ msgid "db_update_pool_record returned %d. ERR=%s\n"
 #~ msgstr "db_update_pool_record a retourné %d. ERR=%s\n"
 
@@ -4012,7 +4335,7 @@ msgstr ""
 #~ "Please run a Verify with Level=InitCatalog before\n"
 #~ "running the current Job.\n"
 #~ msgstr ""
-#~ "Impossible de trouvé JobId d'un précédent Job « InitCatalog.\n"
+#~ "Impossible de trouvé JobId d'un précédent Job \"InitCatalog.\n"
 #~ "Il faut lancer un Job Verify avec l'option Level=InitCatalog avant\n"
 #~ "de lancer le Job courant.\n"
 
@@ -4214,12 +4537,6 @@ msgstr ""
 #~ msgstr "Impossible d'ouvrir le fichier %s : ERR=%s\n"
 
 #, fuzzy
-#~ msgid ""
-#~ "Trying to restore POSIX acl on file \"%s\" on filesystem without aclent "
-#~ "acl support\n"
-#~ msgstr "Impossible d'ouvrir le fichier %s : ERR=%s\n"
-
-#, fuzzy
 #~ msgid "acl_fromtext error on file \"%s\": ERR=%s\n"
 #~ msgstr "Impossible d'ouvrir le fichier %s : ERR=%s\n"
 
@@ -4251,17 +4568,16 @@ msgstr ""
 #~ msgid "Unable to stat file \"%s\": ERR=%s\n"
 #~ msgstr "3910 Impossible d'ouvrir le device %s : ERR=%s\n"
 
-#~ msgid "Connection from unknown Director %s at %s rejected.\n"
-#~ msgstr ""
-#~ "Connexion d'un Director inconnu %s à %s rejeté.\n"
-#~ "\n"
-
 #~ msgid "Incorrect password given by Director at %s.\n"
 #~ msgstr "Password incorrect donné par le Director à %s.\n"
 
 #, fuzzy
-#~ msgid "Unsupported cipher on this system.\n"
-#~ msgstr "Le cipher spécifié est non supporté\n"
+#~ msgid "Had %ld acl errors while doing backup\n"
+#~ msgstr "Saisir la liste des fichiers à restaurer"
+
+#, fuzzy
+#~ msgid "Had %ld xattr errors while doing backup\n"
+#~ msgstr "Saisir la liste des fichiers à restaurer"
 
 #~ msgid "     Could not access \"%s\": ERR=%s\n"
 #~ msgstr "     Impossible d'acceder à \"%s\" : ERR=%s\n"
@@ -4282,51 +4598,33 @@ msgstr ""
 #~ msgstr "     Impossible d'ouvrir \"%s\" : ERR=%s.\n"
 
 #, fuzzy
-#~ msgid "     Cannot open resource fork for \"%s\": ERR=%s.\n"
-#~ msgstr "Impossible d'ouvrir le fichier %s : ERR=%s\n"
-
-#, fuzzy
-#~ msgid "Failed to allocate memory for crypto signature.\n"
-#~ msgstr "Impossible de se connecter au Director\n"
-
-#, fuzzy
-#~ msgid "An error occurred while adding signer the stream.\n"
-#~ msgstr "Entrez le nombre de départ : "
+#~ msgid "Network send error to SD. Data=%s ERR=%s\n"
+#~ msgstr "Erreur dans l'exécution de la commande : %s. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Failed to initialize encryption context.\n"
-#~ msgstr "Impossible d'initialiser le contexte TLS pour la Console \"%s\".\n"
+#~ msgid "     Cannot open resource fork for \"%s\": ERR=%s.\n"
+#~ msgstr "Impossible d'ouvrir le fichier %s : ERR=%s\n"
 
 #, fuzzy
 #~ msgid "Compression LZO error: %d\n"
 #~ msgstr "Erreur de décompression. ERR=%d\n"
 
 #, fuzzy
-#~ msgid "Plugin save packet not found.\n"
-#~ msgstr "le client \"%s\" est introuvable.\n"
-
-#~ msgid "Plugin=%s not found.\n"
-#~ msgstr "Plugin=%s non trouvé.\n"
-
-#, fuzzy
 #~ msgid ""
 #~ "\n"
 #~ "%sVersion: %s (%s)\n"
 #~ "\n"
-#~ "Usage: bacula-fd [-f -s] [-c config_file] [-d debug_level]\n"
-#~ "     -c <file>        use <file> as configuration file\n"
-#~ "     -d <n>[,<tags>]  set debug level to <nn>, debug tags to <tags>\n"
-#~ "     -dt              print a timestamp in debug output\n"
-#~ "     -f               run in foreground (for debugging)\n"
-#~ "     -g               groupid\n"
-#~ "     -k               keep readall capabilities\n"
-#~ "     -m               print kaboom output (for debugging)\n"
-#~ "     -s               no signals (for debugging)\n"
-#~ "     -t               test configuration file and exit\n"
-#~ "     -T               set trace on\n"
-#~ "     -u               userid\n"
-#~ "     -v               verbose user messages\n"
-#~ "     -?               print this message.\n"
+#~ "Usage: bfdjson [-c config_file] [-d debug_level]\n"
+#~ "        -r <res>    get resource type <res>\n"
+#~ "        -n <name>   get resource <name>\n"
+#~ "        -l <dirs>   get only directives matching dirs (use with -r)\n"
+#~ "        -D          get only data\n"
+#~ "        -c <file>   use <file> as configuration file\n"
+#~ "        -d <nn>     set debug level to <nn>\n"
+#~ "        -dt         print a timestamp in debug output\n"
+#~ "        -t          test configuration file and exit\n"
+#~ "        -v          verbose user messages\n"
+#~ "        -?          print this message.\n"
 #~ "\n"
 #~ msgstr ""
 #~ "\n"
@@ -4346,38 +4644,175 @@ msgstr ""
 #~ "\n"
 
 #, fuzzy
-#~ msgid "Disable Command \"%s\" not found.\n"
-#~ msgstr "le client \"%s\" est introuvable.\n"
+#~ msgid "Failed to initialize encryption context.\n"
+#~ msgstr "Impossible d'initialiser le contexte TLS pour la Console \"%s\".\n"
 
 #, fuzzy
-#~ msgid "Failed to allocate a new keypair object.\n"
-#~ msgstr "Impossible de se connecter au Director\n"
+#~ msgid "Unsupported cipher on this system.\n"
+#~ msgstr "Le cipher spécifié est non supporté\n"
 
 #, fuzzy
-#~ msgid "Expected a Cipher Type keyword, got: %s"
-#~ msgstr "Attendait le mot clef FileSet, eu : %s"
+#~ msgid "Failed to allocate memory for crypto signature.\n"
+#~ msgstr "Impossible de se connecter au Director\n"
 
 #, fuzzy
-#~ msgid "Command: \"%s\" is disabled.\n"
-#~ msgstr "Commande annulée.\n"
+#~ msgid "An error occurred while adding signer the stream.\n"
+#~ msgstr "Impossible d'ouvrir le fichier de données %s.\n"
 
 #, fuzzy
-#~ msgid "SD connect failed: Bad Hello command\n"
-#~ msgstr "Le director a rejeté la commande Hello\n"
+#~ msgid "Plugin save packet not found.\n"
+#~ msgstr "le client \"%s\" est introuvable.\n"
 
-#, fuzzy
-#~ msgid "SD connect failed: Job name not found: %s\n"
-#~ msgstr "Job non trouvé : %s\n"
+#~ msgid "Plugin=%s not found.\n"
+#~ msgstr "Plugin=%s non trouvé.\n"
 
 #, fuzzy
-#~ msgid "Bad command from %s. Len=%d.\n"
-#~ msgstr "Connexion invalide. Len=%d\n"
+#~ msgid "Error while creating command string %s.\n"
+#~ msgstr "Erreur pendant l'initialisation du contexte SSL"
 
-#~ msgid "2902 Error scanning cancel command.\n"
-#~ msgstr "2902 Erreur dans le décodage de la commande d'annulation.\n"
+#, fuzzy
+#~ msgid "Error while executing \"%s\" %s. %s %s\n"
+#~ msgstr "Entrez le nombre de départ : "
 
-#~ msgid "2901 Job %s not found.\n"
-#~ msgstr "2901 Le job %s est introuvable.\n"
+#, fuzzy
+#~ msgid "Unable to create snapshot record. ERR=%s\n"
+#~ msgstr "Impossible de récupérer le Pool depuis le catalogue : ERR=%s"
+
+#, fuzzy
+#~ msgid "Unable to create snapshot record, got %s\n"
+#~ msgstr "Impossible de récupérer le Job du JobId=%s : ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to delete snapshot record. ERR=%s\n"
+#~ msgstr "Impossible de récupérer le Pool depuis le catalogue : ERR=%s"
+
+#, fuzzy
+#~ msgid "Unable to delete snapshot record, got %s\n"
+#~ msgstr "Impossible de récupérer le Job du JobId=%s : ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to get snapshot record. ERR=%s\n"
+#~ msgstr "Impossible de récupérer le Pool depuis le catalogue : ERR=%s"
+
+#, fuzzy
+#~ msgid "Unable to get snapshot record, got %s\n"
+#~ msgstr "Impossible de récupérer le Job du JobId=%s : ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to parse command output\n"
+#~ msgstr "Impossible de se connecter au Client.\n"
+
+#, fuzzy
+#~ msgid "   Unable to delete snapshot of %s ERR=%s\n"
+#~ msgstr "Impossible de se connecter à %s sur %s:%d. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "   Create Snapshot for %s\n"
+#~ msgstr "Erreur durant la création des snapshots VSS.\n"
+
+#, fuzzy
+#~ msgid "   Unable to create snapshot of %s ERR=%s\n"
+#~ msgstr "Impossible de se connecter à %s sur %s:%d. ERR=%s\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "\n"
+#~ "%sVersion: %s (%s)\n"
+#~ "\n"
+#~ "Usage: bacula-fd [-f -s] [-c config_file] [-d debug_level]\n"
+#~ "     -c <file>        use <file> as configuration file\n"
+#~ "     -d <n>[,<tags>]  set debug level to <nn>, debug tags to <tags>\n"
+#~ "     -dt              print a timestamp in debug output\n"
+#~ "     -f               run in foreground (for debugging)\n"
+#~ "     -g               groupid\n"
+#~ "     -k               keep readall capabilities\n"
+#~ "     -m               print kaboom output (for debugging)\n"
+#~ "     -s               no signals (for debugging)\n"
+#~ "     -t               test configuration file and exit\n"
+#~ "     -T               set trace on\n"
+#~ "     -u               userid\n"
+#~ "     -v               verbose user messages\n"
+#~ "     -?               print this message.\n"
+#~ "\n"
+#~ msgstr ""
+#~ "\n"
+#~ "Version : %s (%s)\n"
+#~ "\n"
+#~ "Usage : bacula-fd [-f -s] [-c config_file] [-d debug_level]\n"
+#~ "      -c <fich>      utilise fich comme fichier de configuration\n"
+#~ "      -d <nn>        positionne le niveau de debug à nn\n"
+#~ "      -dt            affiche un timestamp sur chaque ligne de debug\n"
+#~ "      -f             reste en avant-plan (pour debugger)\n"
+#~ "      -g             groupid\n"
+#~ "      -s             pas de signaux\n"
+#~ "      -t             test - lit seulement le fichier de configuration\n"
+#~ "      -u             userid\n"
+#~ "      -v             affiche les messages utilisateurs\n"
+#~ "      -?             affiche ce message.\n"
+#~ "\n"
+
+#, fuzzy
+#~ msgid "Disable Command \"%s\" not found.\n"
+#~ msgstr "le client \"%s\" est introuvable.\n"
+
+#, fuzzy
+#~ msgid "Failed to allocate a new keypair object.\n"
+#~ msgstr "Impossible de se connecter au Director\n"
+
+#, fuzzy
+#~ msgid "Expected a Cipher Type keyword, got: %s"
+#~ msgstr "Attendait le mot clef FileSet, eu : %s"
+
+#, fuzzy
+#~ msgid "Bad Hello command from Director at %s. Len=%d.\n"
+#~ msgstr "Connexion invalide. Len=%d\n"
+
+#, fuzzy
+#~ msgid "Bad Hello command from Director at %s: %s\n"
+#~ msgstr "Début de purge des jobs du client \"%s\"\n"
+
+#~ msgid "Connection from unknown Director %s at %s rejected.\n"
+#~ msgstr ""
+#~ "Connexion d'un Director inconnu %s à %s rejeté.\n"
+#~ "\n"
+
+#, fuzzy
+#~ msgid "SD connect failed: Bad Hello command\n"
+#~ msgstr "Le director a rejeté la commande Hello\n"
+
+#, fuzzy
+#~ msgid "SD connect failed: Job name not found: %s\n"
+#~ msgstr "Job non trouvé : %s\n"
+
+#, fuzzy
+#~ msgid "SD \"%s\" tried to connect two times.\n"
+#~ msgstr "Impossible de se connecter au Client.\n"
+
+#, fuzzy
+#~ msgid "Recv caps from SD failed. ERR=%s\n"
+#~ msgstr "fopen %s en erreur : ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Bad caps from SD: %s.\n"
+#~ msgstr "Début de purge des jobs du client \"%s\"\n"
+
+#, fuzzy
+#~ msgid "Bad caps from SD: %s\n"
+#~ msgstr "Début de purge des jobs du client \"%s\"\n"
+
+#, fuzzy
+#~ msgid "Command: \"%s\" is disabled.\n"
+#~ msgstr "Commande annulée.\n"
+
+#, fuzzy
+#~ msgid "Bad command from %s. Len=%d.\n"
+#~ msgstr "Connexion invalide. Len=%d\n"
+
+#~ msgid "2902 Error scanning cancel command.\n"
+#~ msgstr "2902 Erreur dans le décodage de la commande d'annulation.\n"
+
+#~ msgid "2901 Job %s not found.\n"
+#~ msgstr "2901 Le job %s est introuvable.\n"
 
 #, fuzzy
 #~ msgid "2001 Job \"%s\" marked to be %s.\n"
@@ -4422,11 +4857,24 @@ msgstr ""
 #~ msgstr "Impossible de se connecter au démon Storage\n"
 
 #, fuzzy
+#~ msgid "Generate VSS snapshots. Driver=\"%s\"\n"
+#~ msgstr "Création des snapshot VSS. Driver=\"%s\", Lecteur(s)=\"%s\"\n"
+
+#, fuzzy
+#~ msgid "VSS CreateSnapshots failed. ERR=%s\n"
+#~ msgstr "Erreur durant la création des snapshots VSS.\n"
+
+#, fuzzy
+#~ msgid "VSS was not initialized properly. ERR=%s\n"
+#~ msgstr "Impossible d'initialiser le verrou sur la base. ERR=%s\n"
+
+#, fuzzy
 #~ msgid "Bad status %d %c returned from Storage Daemon.\n"
 #~ msgstr "Impossible de récupérer le statut du Job depuis le FD.\n"
 
 #, fuzzy
-#~ msgid "Bad response from SD to %s command. Wanted %s, got %s\n"
+#~ msgid ""
+#~ "Bad response from SD to %s command. Wanted %s, got len=%ld msg=\"%s\"\n"
 #~ msgstr "Mauvaise réponse à la commande %s : voulait %s, pas %s\n"
 
 #, fuzzy
@@ -4457,6 +4905,12 @@ msgstr ""
 #~ msgstr "contentEncryptionAlgorithm non supporté : %d\n"
 
 #, fuzzy
+#~ msgid ""
+#~ "An error=%d occurred while decoding encrypted session data stream: ERR="
+#~ "%s\n"
+#~ msgstr "Impossible d'ouvrir le fichier de données %s.\n"
+
+#, fuzzy
 #~ msgid "Cannot open resource fork for %s.\n"
 #~ msgstr "Impossible d'ouvrir le fichier %s : ERR=%s\n"
 
@@ -4485,10 +4939,28 @@ msgstr ""
 #~ msgstr "Erreur de décompression. ERR=%d\n"
 
 #, fuzzy
+#~ msgid "Write write error on %s: ERR=%s\n"
+#~ msgstr "erreur de déplacement (lseek) sur %s : ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Wrong write size error at %lld block=%d wanted=%d wrote=%d\n"
+#~ msgstr "Erreur d'écriture à %u:%u sur le device %s. ERR=%s\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "Write write error at %lld block=%d write_len=%d lerror=%d on %s: ERR=%s\n"
+#~ msgstr "Erreur d'écriture à %u:%u sur le device %s. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "%s %sVersion: %s (%s) %s %s %s %s\n"
+#~ msgstr "%s Version : %s (%s) %s %s %s\n"
+
+#, fuzzy
 #~ msgid "Daemon started %s. Jobs: run=%d running=%d.\n"
 #~ msgstr "Démon démarré depuis %s, %d jobs lancés depuis cette date.\n"
 
-#~ msgid "Director connected at: %s\n"
+#, fuzzy
+#~ msgid "Director connected %sat: %s\n"
 #~ msgstr "Connexion du director le %s\n"
 
 #, fuzzy
@@ -4498,13 +4970,17 @@ msgstr ""
 #, fuzzy
 #~ msgid ""
 #~ "    Files=%s Bytes=%s AveBytes/sec=%s LastBytes/sec=%s Errors=%d\n"
-#~ "    Bwlimit=%s\n"
+#~ "    Bwlimit=%s ReadBytes=%s\n"
 #~ msgstr "    Fichiers=%s Octets=%s Octets/sec=%s Erreurs=%d\n"
 
 #~ msgid "====\n"
 #~ msgstr "====\n"
 
 #, fuzzy
+#~ msgid "WriteEncryptedFileRaw failure: ERR=%s\n"
+#~ msgstr "fopen %s en erreur : ERR=%s\n"
+
+#, fuzzy
 #~ msgid "llistea error on file \"%s\": ERR=%s\n"
 #~ msgstr "Impossible d'ouvrir le fichier %s : ERR=%s\n"
 
@@ -4714,6 +5190,18 @@ msgstr ""
 #~ msgid "%c: is not a valid drive.\n"
 #~ msgstr "%s : est une commande invalide.\n"
 
+#, fuzzy
+#~ msgid "Cannot open current directory: ERR=%s\n"
+#~ msgstr "Impossible d'ouvrir le fichier inclus : %s. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Cannot get current directory: ERR=%s\n"
+#~ msgstr "change le répertoire courant"
+
+#, fuzzy
+#~ msgid "Cannot reset current directory: ERR=%s\n"
+#~ msgstr "change le répertoire courant"
+
 #~ msgid "Only ipv4 and ipv6 are supported (%d)\n"
 #~ msgstr "Seulement l'ipv4 et l'ipv6 sont supportés (%d)\n"
 
@@ -4738,15 +5226,15 @@ msgstr ""
 
 #, fuzzy
 #~ msgid "Expected a string but got: %s"
-#~ msgstr "Attendait une chaîne, pas : %s"
+#~ msgstr "Attendait une chaîne, pas : %s"
 
 #, fuzzy
 #~ msgid "Expected a string [ip|ipv4|ipv6] but got: %s"
-#~ msgstr "Attentait la chaîne [ip|ipv4|ipv6], pas : %s"
+#~ msgstr "Attentait la chaîne [ip|ipv4|ipv6], pas : %s"
 
 #, fuzzy
 #~ msgid "Expected a string [ip|ipv4] but got: %s"
-#~ msgstr "Attendait la chaîne [ip|ipv4], pas : %s"
+#~ msgstr "Attendait la chaîne [ip|ipv4], pas : %s"
 
 #, fuzzy
 #~ msgid "Expected an equal = but got: %s"
@@ -4771,7 +5259,7 @@ msgstr ""
 
 #, fuzzy
 #~ msgid "Expected a number or a string but got: %s"
-#~ msgstr "Attendait un nombre ou une chaîne, pas : %s"
+#~ msgstr "Attendait un nombre ou une chaîne, pas : %s"
 
 #, fuzzy
 #~ msgid "Expected an IP number or a hostname but got: %s"
@@ -4799,7 +5287,7 @@ msgstr ""
 #~ msgstr "impossible d'ajouter le port (%s) à (%s)"
 
 #~ msgid "Expected a port number or string, got: %s"
-#~ msgstr "Attendait un numéro de port ou une chaîne, pas : %s"
+#~ msgstr "Attendait un numéro de port ou une chaîne, pas : %s"
 
 #~ msgid "Error scanning attributes: %s\n"
 #~ msgstr "Erreur pendant la lecture des attributs : %s\n"
@@ -4896,7 +5384,11 @@ msgstr ""
 #~ msgstr "Impossible de positionner SO_KEEPALIVE sur la socket : %s\n"
 
 #, fuzzy
-#~ msgid "Could not init bsock mutex. ERR=%s\n"
+#~ msgid "Could not init bsock read mutex. ERR=%s\n"
+#~ msgstr "Impossible d'initialiser la queue cliente : ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Could not init bsock write mutex. ERR=%s\n"
 #~ msgstr "Impossible d'initialiser la queue cliente : ERR=%s\n"
 
 #, fuzzy
@@ -4933,6 +5425,32 @@ msgstr ""
 #~ msgstr "erreur de fermeture : ERR=%s\n"
 
 #, fuzzy
+#~ msgid "Director authorization error at \"%s:%d\"\n"
+#~ msgstr "Pas d'enregistrement trouvé en base pour : %s\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "Bad errmsg to Hello command: ERR=%s\n"
+#~ "The Director at \"%s:%d\" may not be running.\n"
+#~ msgstr "Mauvaise réponse à la commande Hello : ERR=%s\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "Authorization error with Director at \"%s:%d\"\n"
+#~ "Most likely the passwords do not agree.\n"
+#~ "If you are using TLS, there may have been a certificate validation error "
+#~ "during the TLS handshake.\n"
+#~ "For help, please see: "
+#~ msgstr ""
+#~ "Problème d'authentification avec le director.\n"
+#~ "Le plus souvent, les mots de pass ne correspondent pas.\n"
+#~ "Si vous utilisez TLS, il peut y avoir une erreur de validation du "
+#~ "certificat\n"
+#~ "pendant l'initialisation de la connexion TLS.\n"
+#~ "Vous trouverez de l'aide sur\n"
+#~ "http://www.bacula.org/rel-manual/faq.html#AuthorizationErrors\n"
+
+#, fuzzy
 #~ msgid "safe_unlink could not compile regex pattern \"%s\" ERR=%s\n"
 #~ msgstr "Impossible d'ouvrir %s : ERR=%s\n"
 
@@ -4945,12 +5463,22 @@ msgstr ""
 #~ msgid "Bad errno"
 #~ msgstr "Mauvais errno"
 
-#~ msgid "Cannot open pid file. %s ERR=%s\n"
+#, fuzzy
+#~ msgid "Cannot open %s file. %s ERR=%s\n"
 #~ msgstr "Impossible d'ouvrir le fichier contenant le pid. %s ERR=%s\n"
 
-#~ msgid "Could not open pid file. %s ERR=%s\n"
+#, fuzzy
+#~ msgid "Could not open %s file. %s ERR=%s\n"
 #~ msgstr "Impossible d'ouvrir le fichier pid. %s ERR=%s\n"
 
+#, fuzzy
+#~ msgid "Cannot lock %s file. %s ERR=%s\n"
+#~ msgstr "Impossible d'ouvrir le fichier contenant le pid. %s ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Cannot not open %s file. %s ERR=%s\n"
+#~ msgstr "Impossible d'ouvrir le fichier contenant le pid. %s ERR=%s\n"
+
 #~ msgid "Could not create state file. %s ERR=%s\n"
 #~ msgstr "Impossible de créer le fichier d'état. %s ERR=%s\n"
 
@@ -5014,12 +5542,6 @@ msgstr ""
 #~ msgid "OpenSSL cipher context initialization failed"
 #~ msgstr "Initialisation du contexte clef/IV du cipher OpenSSL à échoué"
 
-#~ msgid "Unable to init OpenSSL threading: ERR=%s\n"
-#~ msgstr "Impossible d'initialiser le thread OpenSSL : ERR=%s\n"
-
-#~ msgid "Failed to save OpenSSL PRNG\n"
-#~ msgstr "Impossible de sauvegarder le PRNG OpenSSL\n"
-
 #, fuzzy
 #~ msgid "Unsupported digest type=%d specified\n"
 #~ msgstr "Le cipher spécifié est non supporté\n"
@@ -5058,7 +5580,7 @@ msgstr ""
 #~ msgstr "Impossible de forker pour passer en mode démon : %s\n"
 
 #~ msgid "Illegal character \"%c\" in name.\n"
-#~ msgstr "Caractère illégal « %c » dans le nom.\n"
+#~ msgstr "Caractère illégal \"%c\" dans le nom.\n"
 
 #~ msgid "Name too long.\n"
 #~ msgstr "Nom trop long.\n"
@@ -5078,6 +5600,10 @@ msgstr ""
 #~ msgid "Cannot open config file %s: %s\n"
 #~ msgstr "Impossible d'ouvrir le fichier de configuration \"%s\" : %s\n"
 
+#, fuzzy
+#~ msgid "Cannot open lex\n"
+#~ msgstr "Impossible d'ouvrir le fichier %s : ERR=%s\n"
+
 #~ msgid "Backup"
 #~ msgstr "Backup"
 
@@ -5158,9 +5684,6 @@ msgstr ""
 #~ msgid "NULL jcr.\n"
 #~ msgstr "NULL jcr.\n"
 
-#~ msgid "JCR use_count=%d JobId=%d\n"
-#~ msgstr "JCR use_count=%d JobId=%d\n"
-
 #, fuzzy
 #~ msgid "pthread_setspecific failed: ERR=%s\n"
 #~ msgstr "Erreur sur l'ouverture du périphérique. ERR=%s\n"
@@ -5186,7 +5709,7 @@ msgstr ""
 #~ "du Director.\n"
 
 #~ msgid "Problem probably begins at line %d.\n"
-#~ msgstr "Le problème commence sûrement au début de la ligne %d.\n"
+#~ msgstr "Le problème commence sûrement au début de la ligne %d.\n"
 
 #~ msgid ""
 #~ "Config error: %s\n"
@@ -5254,7 +5777,7 @@ msgstr ""
 #~ msgstr "la longueur du nom %s (%d) est trop grande, le max est %d\n"
 
 #~ msgid "expected a string, got %s: %s"
-#~ msgstr "attendait une chaîne, pas %s : %s"
+#~ msgstr "attendait une chaîne, pas %s : %s"
 
 #, fuzzy
 #~ msgid "Mutex lock failure. ERR=%s\n"
@@ -5336,6 +5859,12 @@ msgstr ""
 #~ msgid "Unable to destroy mutex: ERR=%s\n"
 #~ msgstr "Impossible de détruire le mutex : ERR=%s\n"
 
+#~ msgid "Unable to init OpenSSL threading: ERR=%s\n"
+#~ msgstr "Impossible d'initialiser le thread OpenSSL : ERR=%s\n"
+
+#~ msgid "Failed to save OpenSSL PRNG\n"
+#~ msgstr "Impossible de sauvegarder le PRNG OpenSSL\n"
+
 #~ msgid "expected an =, got: %s"
 #~ msgstr "attendait un =, eu : %s"
 
@@ -5431,6 +5960,16 @@ msgstr ""
 #~ msgid "cap_set_proc failed: ERR=%s\n"
 #~ msgstr "Erreur sur l'ouverture du périphérique. ERR=%s\n"
 
+#~ msgid "Could not initialize Python\n"
+#~ msgstr "Impossible d'initialiser le Python\n"
+
+#~ msgid "Could not Run Python string %s\n"
+#~ msgstr "Impossible de lancer la commande Python %s\n"
+
+#, fuzzy
+#~ msgid "Unable to initialize the Python lock. ERR=%s\n"
+#~ msgstr "Impossible d'initialiser le verrou sur la base. ERR=%s\n"
+
 #~ msgid "rwl_writelock failure at %s:%d:  ERR=%s\n"
 #~ msgstr "rwl_writelock en échec sur %s:%d : ERR=%s\n"
 
@@ -5463,10 +6002,6 @@ msgstr ""
 #~ msgid "Selection items must be be greater than zero.\n"
 #~ msgstr "Les valeurs doivent être supérieurs à zéro.\n"
 
-#, fuzzy
-#~ msgid "Selection item too large.\n"
-#~ msgstr "Slot trop grand.\n"
-
 #~ msgid "Bacula interrupted by signal %d: %s\n"
 #~ msgstr "Bacula a reçu le signal %d : %s\n"
 
@@ -5565,6 +6100,10 @@ msgstr ""
 #~ msgid "Blocked"
 #~ msgstr "Bloqué"
 
+#, fuzzy
+#~ msgid "Incomplete job"
+#~ msgstr "valeur octal incomplète"
+
 #~ msgid "Non-fatal error"
 #~ msgstr "Erreur non fatale"
 
@@ -5704,32 +6243,181 @@ msgstr ""
 #~ msgid "unknown error"
 #~ msgstr "erreur inconnue"
 
-#~ msgid "No volumes specified for reading. Job %s canceled.\n"
-#~ msgstr "Pas de volume spécifié pour la lecture. Abandon du job %s.\n"
+#, fuzzy
+#~ msgid "Can't run command %s. ERR=%s\n"
+#~ msgstr "Impossible de lancer la commande : %s. ERR=%s\n"
 
 #, fuzzy
-#~ msgid ""
-#~ "Changing read device. Want Media Type=\"%s\" have=\"%s\"\n"
-#~ "  %s device=%s\n"
-#~ msgstr ""
-#~ "Changement du Device de lecture. Want Media Type=\"%s\" have=\"%s\"\n"
-#~ "  device=%s\n"
+#~ msgid "Can't create working directory %s. ERR=%s\n"
+#~ msgstr "Impossible d'ouvrir le fichier inclus : %s. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Job %s canceled.\n"
-#~ msgstr "Le job %s est annulé.\n"
+#~ msgid "Can't delete working directory %s. ERR=%s\n"
+#~ msgstr "Impossible d'ouvrir le fichier inclus : %s. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Read open %s device %s Volume \"%s\" failed: ERR=%s\n"
-#~ msgstr "Impossible de supprimer le volume \"%s\". ERR=%s"
+#~ msgid "Unknown parameter or missing argument for %s.\n"
+#~ msgstr "Mot clef inconnu : %s\n"
 
 #, fuzzy
-#~ msgid "Ready to read from volume \"%s\" on %s device %s.\n"
-#~ msgstr "Prêt à lire les données du volume \"%s\" depuis le device %s.\n"
+#~ msgid "Unknown parameter for %s. Expecting block or file\n"
+#~ msgstr "Mot clef inconnu : %s\n"
 
 #, fuzzy
-#~ msgid "Could not ready %s device %s for append.\n"
-#~ msgstr "Impossible d'ouvrir le device %s\n"
+#~ msgid "Unknown parameter %s.\n"
+#~ msgstr "Mot clef inconnu : %s\n"
+
+#, fuzzy
+#~ msgid "Unable to access guest volume\n"
+#~ msgstr "Impossible d'écrire le marqueur EOF. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to create temporary file %s. ERR=%s\n"
+#~ msgstr "Impossible de créer le fichier bootstrap %s. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to fdopen file %s. ERR=%s\n"
+#~ msgstr "3910 Impossible d'ouvrir le device %s : ERR=%s\n"
+
+#, fuzzy
+#~ msgid "  Dumping database \"%s\"\n"
+#~ msgstr "Impossible d'ouvrir la base de données \"%s\".\n"
+
+#, fuzzy
+#~ msgid "Unable to detect the MySQL data_directory on this system.\n"
+#~ msgstr "Impossible de créer le fichier bootstrap %s. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to determine the last binlog %s\n"
+#~ msgstr "Impossible d'écrire le marqueur EOF. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Can't get server configuration.\n"
+#~ msgstr "La création de la signature a échouée"
+
+#, fuzzy
+#~ msgid "Unable to get the BINLOG list.\n"
+#~ msgstr "Impossible de se connecter au Client.\n"
+
+#, fuzzy
+#~ msgid "Unable to determine the last LSN for %s (Previous job is %s)\n"
+#~ msgstr "Impossible d'écrire le marqueur EOF. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to detect datadir from MySQL\n"
+#~ msgstr "Impossible de se connecter au Client.\n"
+
+#, fuzzy
+#~ msgid "Unable to get last LSN from the backup\n"
+#~ msgstr "Impossible de récupérer le Job du JobId=%s : ERR=%s\n"
+
+#, fuzzy
+#~ msgid "The current LSN is %s\n"
+#~ msgstr "Le pool courant est : %s\n"
+
+#, fuzzy
+#~ msgid "Restoring target database \"%s\"\n"
+#~ msgstr "Impossible d'ouvrir la base de données \"%s\".\n"
+
+#, fuzzy
+#~ msgid "Creating target database \"%s\"\n"
+#~ msgstr "Impossible d'ouvrir la base de données \"%s\".\n"
+
+#, fuzzy
+#~ msgid "Database \"%s\" already exists. Skipping creation.\n"
+#~ msgstr "Impossible de créer le volume \"%s\" car il existe déjà.\n"
+
+#, fuzzy
+#~ msgid "Unable to parse or to use plugin options, %s\n"
+#~ msgstr "Impossible de se connecter à %s sur %s:%d. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unknown parameter or bad argument for %s.\n"
+#~ msgstr "Mot clef inconnu : %s\n"
+
+#, fuzzy
+#~ msgid "Can't get cluster configuration.\n"
+#~ msgstr "La création de la signature a échouée"
+
+#, fuzzy
+#~ msgid "Can't determine the last WAL file\n"
+#~ msgstr "Impossible d'écrire le marqueur EOF. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Can't determine WAL directory\n"
+#~ msgstr "Impossible d'ouvrir le fichier inclus : %s. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Can't open WAL directory %s. ERR=%s\n"
+#~ msgstr "Impossible d'ouvrir le fichier inclus : %s. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to detect the PostgreSQL data_directory on this system.\n"
+#~ msgstr "Impossible de créer le fichier bootstrap %s. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to find data_directory=%s on this system. ERR=%s\n"
+#~ msgstr "Impossible de créer le fichier bootstrap %s. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to start the PITR backup on this system.\n"
+#~ msgstr "Impossible de créer le fichier bootstrap %s. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to determine the first WAL file on this system.\n"
+#~ msgstr "Impossible de créer le fichier bootstrap %s. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to analyse tablespaces %s on this system. ERR=%s\n"
+#~ msgstr "Impossible de créer le fichier bootstrap %s. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to analyse data_directory %s on this system. ERR=%s\n"
+#~ msgstr "Impossible de créer le fichier bootstrap %s. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Can't create the %s file for recovery. ERR=%s\n"
+#~ msgstr "Impossible de créer le fichier d'état : %s ERR=%s\n"
+
+#, fuzzy
+#~ msgid "3612 JobId=%u waiting because device %s is reserved by: %s.\n"
+#~ msgstr ""
+#~ "3605 JobId=%u voulait libérer le lecteur, mais le device %s est occupé.\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "3998 Bad return from storage \"%s\" command: ERR=%s.\n"
+#~ "Results=%s\n"
+#~ msgstr ""
+#~ "3991 Erreur sur l'autochangeur \"loaded drive %d\" : ERR=%s.\n"
+#~ "Resultat=%s\n"
+
+#~ msgid "No volumes specified for reading. Job %s canceled.\n"
+#~ msgstr "Pas de volume spécifié pour la lecture. Abandon du job %s.\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "Changing read device. Want Media Type=\"%s\" have=\"%s\"\n"
+#~ "  %s device=%s\n"
+#~ msgstr ""
+#~ "Changement du Device de lecture. Want Media Type=\"%s\" have=\"%s\"\n"
+#~ "  device=%s\n"
+
+#, fuzzy
+#~ msgid "Job %s canceled.\n"
+#~ msgstr "Le job %s est annulé.\n"
+
+#, fuzzy
+#~ msgid "Read open %s device %s Volume \"%s\" failed: ERR=%s\n"
+#~ msgstr "Impossible de supprimer le volume \"%s\". ERR=%s"
+
+#, fuzzy
+#~ msgid "Ready to read from volume \"%s\" on %s device %s.\n"
+#~ msgstr "Prêt à lire les données du volume \"%s\" depuis le device %s.\n"
+
+#, fuzzy
+#~ msgid "Could not ready %s device %s for append.\n"
+#~ msgstr "Impossible d'ouvrir le device %s\n"
 
 #~ msgid "Could not create JobMedia record for Volume=\"%s\" Job=%s\n"
 #~ msgstr "Impossible de créer un JobMedia en base pour le Volume=%s Job=%s\n"
@@ -5737,9 +6425,20 @@ msgstr ""
 #~ msgid "Alert: %s"
 #~ msgstr "Alert: %s"
 
+#~ msgid "Could not initialize %s\n"
+#~ msgstr "Impossible d'initialiser %s\n"
+
+#, fuzzy
+#~ msgid "Error closing device %s. ERR=%s.\n"
+#~ msgstr "Erreur de lecture de %s:%s:%d : ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Cannot run free space command. Results=%s ERR=%s\n"
+#~ msgstr "Impossible de lancer la commande : %s. ERR=%s\n"
+
 #, fuzzy
 #~ msgid "Could not write ANSI VOL1 label. Wanted size=%d got=%d ERR=%s\n"
-#~ msgstr "Impossible de créer le fichier d'état : %s ERR=%s\n"
+#~ msgstr "Impossible de créer le fichier d'état. %s ERR=%s\n"
 
 #~ msgid "Write session label failed. ERR=%s\n"
 #~ msgstr "Impossible d'écrire le label de session. ERR=%s\n"
@@ -5754,11 +6453,19 @@ msgstr ""
 #~ msgstr "Erreur dans l'exécution de la commande : %s. ERR=%s\n"
 
 #, fuzzy
+#~ msgid "DDE commit failed. ERR=%s\n"
+#~ msgstr "Erreur sur l'ouverture du périphérique. ERR=%s\n"
+
+#, fuzzy
 #~ msgid "Error writing end session label. ERR=%s\n"
 #~ msgstr ""
 #~ "Erreur pendant l'écriture des données vers le fichier de spool. ERR=%s\n"
 
 #, fuzzy
+#~ msgid "Set ok=FALSE after write_final_block_to_device.\n"
+#~ msgstr "Erreur pendant l'écriture du fichier bsr.\n"
+
+#, fuzzy
 #~ msgid "Elapsed time=%02d:%02d:%02d, Transfer rate=%s Bytes/second\n"
 #~ msgstr ""
 #~ "Temps d'écriture du job = %02d:%02d:%02d, Taux de transfert = %s o/s\n"
@@ -5780,7 +6487,7 @@ msgstr ""
 #~ "    Media type:   %s\n"
 #~ msgstr ""
 #~ "Le Job %s est en attente. Bacula n'a pas pu trouver de media disponible.\n"
-#~ "Merci de créer un nouveau volume via la commande « label » pour :\n"
+#~ "Merci de créer un nouveau volume via la commande \"label\" pour :\n"
 #~ "    Storage :       %s\n"
 #~ "    Type du Media : %s\n"
 #~ "    Pool :          %s\n"
@@ -5799,7 +6506,7 @@ msgstr ""
 #~ "    Media type:   %s\n"
 #~ msgstr ""
 #~ "Le Job %s est en attente. Bacula n'a pas pu trouver de media disponible.\n"
-#~ "Merci de créer un nouveau volume via la commande « label » pour :\n"
+#~ "Merci de créer un nouveau volume via la commande \"label\" pour :\n"
 #~ "    Storage :       %s\n"
 #~ "    Type du Media : %s\n"
 #~ "    Pool :          %s\n"
@@ -5813,32 +6520,24 @@ msgstr ""
 #~ "    Media type:   %s\n"
 #~ msgstr ""
 #~ "Le Job %s est en attente. Bacula n'a pas pu trouver de media disponible.\n"
-#~ "Merci de créer un nouveau volume via la commande « label » pour :\n"
+#~ "Merci de créer un nouveau volume via la commande \"label\" pour :\n"
 #~ "    Storage :       %s\n"
 #~ "    Type du Media : %s\n"
 #~ "    Pool :          %s\n"
 
 #, fuzzy
 #~ msgid ""
-#~ "Connection from unknown Director %s at %s rejected.\n"
-#~ "Please see "
-#~ msgstr ""
-#~ "Connexion d'un Director inconnu %s à %s rejeté.\n"
-#~ "\n"
-
-#, fuzzy
-#~ msgid ""
 #~ "Incorrect password given by Director.\n"
-#~ "Please see "
+#~ "For help, please see: "
 #~ msgstr "Password incorrect donné par le Director à %s.\n"
 
 #, fuzzy
 #~ msgid "TLS negotiation failed with DIR at \"%s:%d\"\n"
-#~ msgstr "Négociation TLS échouée avec le SD « %s:%d ».\n"
+#~ msgstr "Négociation TLS échouée avec le SD \"%s:%d\".\n"
 
 #, fuzzy
 #~ msgid "TLS negotiation failed with FD at \"%s:%d\"\n"
-#~ msgstr "Négociation TLS échouée avec le FD  « %s:%d ».\n"
+#~ msgstr "Négociation TLS échouée avec le FD  \"%s:%d\".\n"
 
 #, fuzzy
 #~ msgid "No slot defined in catalog (slot=%d) for Volume \"%s\" on %s.\n"
@@ -5846,32 +6545,32 @@ msgstr ""
 
 #~ msgid "3304 Issuing autochanger \"load slot %d, drive %d\" command.\n"
 #~ msgstr ""
-#~ "3304 Envoi de la commande « load slot %d, drive %d » à l'autochangeur.\n"
+#~ "3304 Envoi de la commande \"load slot %d, drive %d\" à l'autochangeur.\n"
 
 #~ msgid "3305 Autochanger \"load slot %d, drive %d\", status is OK.\n"
-#~ msgstr "3305 Autochangeur « load slot %d, drive %d », le résultat est OK.\n"
+#~ msgstr "3305 Autochangeur \"load slot %d, drive %d\", le résultat est OK.\n"
 
 #~ msgid ""
 #~ "3992 Bad autochanger \"load slot %d, drive %d\": ERR=%s.\n"
 #~ "Results=%s\n"
 #~ msgstr ""
-#~ "3992 Erreur sur l'autochangeur « load slot %d, drive %d » : ERR=%s.\n"
+#~ "3992 Erreur sur l'autochangeur \"load slot %d, drive %d\" : ERR=%s.\n"
 #~ "Resultat=%s\n"
 
 #~ msgid "3301 Issuing autochanger \"loaded? drive %d\" command.\n"
-#~ msgstr "3301 Envoi de la commande « loaded? drive %d » à l'autochangeur.\n"
+#~ msgstr "3301 Envoi de la commande \"loaded? drive %d\" à l'autochangeur.\n"
 
 #~ msgid "3302 Autochanger \"loaded? drive %d\", result is Slot %d.\n"
-#~ msgstr "3302 Autochangeur « loaded drive %d », le resultat est Slot %d.\n"
+#~ msgstr "3302 Autochangeur \"loaded drive %d\", le resultat est Slot %d.\n"
 
 #~ msgid "3302 Autochanger \"loaded? drive %d\", result: nothing loaded.\n"
-#~ msgstr "3302 Autochangeur « loaded drive %d », résultat : lecteur vide.\n"
+#~ msgstr "3302 Autochangeur \"loaded drive %d\", résultat : lecteur vide.\n"
 
 #~ msgid ""
 #~ "3991 Bad autochanger \"loaded? drive %d\" command: ERR=%s.\n"
 #~ "Results=%s\n"
 #~ msgstr ""
-#~ "3991 Erreur sur l'autochangeur « loaded drive %d » : ERR=%s.\n"
+#~ "3991 Erreur sur l'autochangeur \"loaded drive %d\" : ERR=%s.\n"
 #~ "Resultat=%s\n"
 
 #, fuzzy
@@ -5884,13 +6583,13 @@ msgstr ""
 
 #~ msgid "3307 Issuing autochanger \"unload slot %d, drive %d\" command.\n"
 #~ msgstr ""
-#~ "3307 Envoi de la commande « unload slot %d, drive %d » à l'autochangeur.\n"
+#~ "3307 Envoi de la commande \"unload slot %d, drive %d\" à l'autochangeur.\n"
 
 #~ msgid ""
 #~ "3995 Bad autochanger \"unload slot %d, drive %d\": ERR=%s\n"
 #~ "Results=%s\n"
 #~ msgstr ""
-#~ "3995 Erreur sur l'autochangeur « unload slot %d, drive %d » : ERR=%s.\n"
+#~ "3995 Erreur sur l'autochangeur \"unload slot %d, drive %d\" : ERR=%s.\n"
 #~ "Resultat=%s\n"
 
 #, fuzzy
@@ -5900,7 +6599,7 @@ msgstr ""
 #, fuzzy
 #~ msgid "3997 Bad autochanger \"unload slot %d, drive %d\": ERR=%s.\n"
 #~ msgstr ""
-#~ "3995 Erreur sur l'autochangeur « unload slot %d, drive %d » : ERR=%s.\n"
+#~ "3995 Erreur sur l'autochangeur \"unload slot %d, drive %d\" : ERR=%s.\n"
 
 #~ msgid "3993 Device %s not an autochanger device.\n"
 #~ msgstr "3993 Le Device %s n'est pas un autochangeur.\n"
@@ -5908,10 +6607,13 @@ msgstr ""
 #~ msgid "3306 Issuing autochanger \"%s\" command.\n"
 #~ msgstr "3306 Envoi de la commande \"%s\" à l'autochangeur.\n"
 
+#~ msgid "Autochanger error: ERR=%s\n"
+#~ msgstr "Erreur sur l'autochangeur : ERR=%s\n"
+
 #, fuzzy
 #~ msgid ""
 #~ "\n"
-#~ "Version: %s (%s)\n"
+#~ "%sVersion: %s (%s)\n"
 #~ "\n"
 #~ "Usage: bcopy [-d debug_level] <input-archive> <output-archive>\n"
 #~ "       -b bootstrap      specify a bootstrap file\n"
@@ -5945,7 +6647,7 @@ msgstr ""
 #, fuzzy
 #~ msgid ""
 #~ "\n"
-#~ "Version: %s (%s)\n"
+#~ "%sVersion: %s (%s)\n"
 #~ "\n"
 #~ "Usage: bextract <options> <bacula-archive-device-name> <directory-to-"
 #~ "store-files>\n"
@@ -5953,16 +6655,17 @@ msgstr ""
 #~ "       -c <file>       specify a Storage configuration file\n"
 #~ "       -d <nn>         set debug level to <nn>\n"
 #~ "       -dt             print timestamp in debug output\n"
+#~ "       -T              send debug traces to trace file\n"
 #~ "       -e <file>       exclude list\n"
 #~ "       -i <file>       include list\n"
 #~ "       -p              proceed inspite of I/O errors\n"
+#~ "       -t              read data from volume, do not write anything\n"
 #~ "       -v              verbose\n"
 #~ "       -V <volumes>    specify Volume names (separated by |)\n"
 #~ "       -?              print this message\n"
 #~ "\n"
 #~ msgstr ""
-#~ "Copyright (C) 2000-2005 Kern Sibbald.\n"
-#~ "\n"
+#~ "Copyright (C) 2000-2015 Kern Sibbald\n"
 #~ "Version : %s (%s)\n"
 #~ "\n"
 #~ "Usage : dird [-f -s] [-c config_file] [-d debug_level] [config_file]\n"
@@ -5985,6 +6688,10 @@ msgstr ""
 #~ msgstr "%u fichiers restaurés.\n"
 
 #, fuzzy
+#~ msgid "Found %s error%s\n"
+#~ msgstr "Erreur de config : %s\n"
+
+#, fuzzy
 #~ msgid "%s was deleted.\n"
 #~ msgstr "Pas de job sélectionné.\n"
 
@@ -5996,6 +6703,10 @@ msgstr ""
 #~ msgstr "Erreur de décompression. ERR=%d\n"
 
 #, fuzzy
+#~ msgid "Error writing final JobMedia record to catalog.\n"
+#~ msgstr "Erreur pendant l'écriture du fichier bsr.\n"
+
+#, fuzzy
 #~ msgid "Cannot write block. Device at EOM. dev=%s\n"
 #~ msgstr "Impossible d'écrire un bloc. Le Device est au bout EOM.\n"
 
@@ -6005,6 +6716,14 @@ msgstr ""
 #~ msgid "Write error at %u:%u on device %s. ERR=%s.\n"
 #~ msgstr "Erreur d'écriture à %u:%u sur le device %s. ERR=%s\n"
 
+#, fuzzy
+#~ msgid ""
+#~ "Out of freespace caused End of Volume \"%s\" at %u:%u on device %s. Write "
+#~ "of %u bytes got %d.\n"
+#~ msgstr ""
+#~ "Fin du volume \"%s\" à %u:%u sur le device %s. Ecriture de %u octets, eu "
+#~ "%d.\n"
+
 #~ msgid ""
 #~ "End of Volume \"%s\" at %u:%u on device %s. Write of %u bytes got %d.\n"
 #~ msgstr ""
@@ -6016,7 +6735,15 @@ msgstr ""
 #~ msgstr "Le job %d est annulé.\n"
 
 #, fuzzy
-#~ msgid "Read zero bytes Vol=%s at %lld on device %s.\n"
+#~ msgid "Unable to open device part=%d %s: ERR=%s\n"
+#~ msgstr "3910 Impossible d'ouvrir le device %s : ERR=%s\n"
+
+#, fuzzy
+#~ msgid "The Volume=%s on device=%s appears to be unlabeled.\n"
+#~ msgstr "Le volume sur %s possède un mauvais label Bacula : %x\n"
+
+#, fuzzy
+#~ msgid "Read zero %sbytes Vol=%s at %lld on device %s.\n"
 #~ msgstr "Prêt à lire les données du volume \"%s\" depuis le device %s.\n"
 
 #, fuzzy
@@ -6040,7 +6767,7 @@ msgstr ""
 #, fuzzy
 #~ msgid ""
 #~ "\n"
-#~ "Version: %s (%s)\n"
+#~ "%sVersion: %s (%s)\n"
 #~ "\n"
 #~ "Usage: bls [options] <device-name>\n"
 #~ "       -b <file>       specify a bootstrap file\n"
@@ -6056,11 +6783,11 @@ msgstr ""
 #~ "       -p              proceed inspite of errors\n"
 #~ "       -v              be verbose\n"
 #~ "       -V              specify Volume names (separated by |)\n"
+#~ "       -E              Check records to detect errors\n"
 #~ "       -?              print this message\n"
 #~ "\n"
 #~ msgstr ""
-#~ "Copyright (C) 2000-2005 Kern Sibbald.\n"
-#~ "\n"
+#~ "Copyright (C) 2000-2015 Kern Sibbald\n"
 #~ "Version : %s (%s)\n"
 #~ "\n"
 #~ "Usage : dird [-f -s] [-c config_file] [-d debug_level] [config_file]\n"
@@ -6082,7 +6809,7 @@ msgstr ""
 #, fuzzy
 #~ msgid ""
 #~ "\n"
-#~ "Version: %s (%s)\n"
+#~ "%sVersion: %s (%s)\n"
 #~ "\n"
 #~ "Usage: bscan [ options ] <bacula-archive>\n"
 #~ "       -b bootstrap      specify a bootstrap file\n"
@@ -6107,8 +6834,7 @@ msgstr ""
 #~ "       -?                print this message\n"
 #~ "\n"
 #~ msgstr ""
-#~ "Copyright (C) 2000-2005 Kern Sibbald.\n"
-#~ "\n"
+#~ "Copyright (C) 2000-2015 Kern Sibbald\n"
 #~ "Version : %s (%s)\n"
 #~ "\n"
 #~ "Usage : dird [-f -s] [-c config_file] [-d debug_level] [config_file]\n"
@@ -6132,6 +6858,41 @@ msgstr ""
 #~ msgid "Could not get Client record. ERR=%s\n"
 #~ msgstr "Impossible d'initialiser la queue cliente : ERR=%s\n"
 
+#, fuzzy
+#~ msgid ""
+#~ "\n"
+#~ "%sVersion: %s (%s)\n"
+#~ "\n"
+#~ "Usage: bsdjson [options] [-c config_file] [config_file]\n"
+#~ "        -r <res>    get resource type <res>\n"
+#~ "        -n <name>   get resource <name>\n"
+#~ "        -l <dirs>   get only directives matching dirs (use with -r)\n"
+#~ "        -D          get only data\n"
+#~ "        -c <file>   use <file> as configuration file\n"
+#~ "        -d <nn>     set debug level to <nn>\n"
+#~ "        -dt         print timestamp in debug output\n"
+#~ "        -t          test - read config and exit\n"
+#~ "        -v          verbose user messages\n"
+#~ "        -?          print this message.\n"
+#~ "\n"
+#~ msgstr ""
+#~ "\n"
+#~ "Version : %s (%s)\n"
+#~ "\n"
+#~ "Usage : stored [options] [-c config_file] [config_file]\n"
+#~ "      -c <fich>      utilise fich comme fichier de configuration\n"
+#~ "      -dnn           positionne le niveau de debug à nn\n"
+#~ "      -dt            affiche un timestamp devant chaque ligne de debug\n"
+#~ "      -f             reste en avant-plan (pour debugger)\n"
+#~ "      -g             groupid\n"
+#~ "      -p             continue même en cas d'erreurs E/S\n"
+#~ "      -s             pas de signaux\n"
+#~ "      -t             test - lit seulement le fichier de configuration\n"
+#~ "      -u             userid\n"
+#~ "      -v             affiche les messages utilisateurs\n"
+#~ "      -?             affiche ce message.\n"
+#~ "\n"
+
 #~ msgid "Enter Volume Name: "
 #~ msgstr "Saisissez un nom de Volume : "
 
@@ -6232,7 +6993,7 @@ msgstr ""
 #~ msgstr "Sélection du test multiple.\n"
 
 #~ msgid "Wrote Start of Session label.\n"
-#~ msgstr "Écriture du label de début de session.\n"
+#~ msgstr "Ecriture du label de début de session.\n"
 
 #, fuzzy
 #~ msgid "Flush block failed.\n"
@@ -6240,7 +7001,7 @@ msgstr ""
 
 #, fuzzy
 #~ msgid "Wrote block=%u, file,blk=%u,%u VolBytes=%s rate=%sB/s\n"
-#~ msgstr "Écriture blk_block=%u, dev_blk_num=%u VolBytes=%s rate=%.1f KB/s\n"
+#~ msgstr "Ecriture blk_block=%u, dev_blk_num=%u VolBytes=%s rate=%.1f KB/s\n"
 
 #~ msgid "%s Flush block, write EOF\n"
 #~ msgstr "Flush de %s blocs, écriture de EOF\n"
@@ -6254,10 +7015,10 @@ msgstr ""
 #~ msgstr "Le job %s est annulé.\n"
 
 #~ msgid "Wrote End of Session label.\n"
-#~ msgstr "Écriture du label de fin de session.\n"
+#~ msgstr "Ecriture du label de fin de session.\n"
 
 #~ msgid "Wrote state file last_block_num1=%d last_block_num2=%d\n"
-#~ msgstr "Écriture du fichier d'état last_block_num1=%d last_block_num2=%d\n"
+#~ msgstr "Ecriture du fichier d'état last_block_num1=%d last_block_num2=%d\n"
 
 #~ msgid "Could not create state file: %s ERR=%s\n"
 #~ msgstr "Impossible de créer le fichier d'état : %s ERR=%s\n"
@@ -6277,10 +7038,10 @@ msgstr ""
 #~ msgstr ""
 #~ "\n"
 #~ "Impossible de trouver le fichier d'état : %s ERR=%s\n"
-#~ "Vous devez relancer la commande « fill ».\n"
+#~ "Vous devez relancer la commande \"fill\".\n"
 
 #~ msgid "Mount first tape. Press enter when ready: "
-#~ msgstr "Chargez la première bande et appuyez sur « Entrée » : "
+#~ msgstr "Chargez la première bande et appuyez sur \"Entrée\" : "
 
 #~ msgid "Rewinding.\n"
 #~ msgstr "Rembobinage.\n"
@@ -6298,7 +7059,7 @@ msgstr ""
 #~ msgstr "Lecture du bloc %u.\n"
 
 #~ msgid "Mount second tape. Press enter when ready: "
-#~ msgstr "Chargez une deuxième bande et appuyez sur « Entrée » : "
+#~ msgstr "Chargez une deuxième bande et appuyez sur \"Entrée\" : "
 
 #~ msgid "Reposition from %u:%u to 0:1\n"
 #~ msgstr "Re-positionnement de %u:%u à 0:1\n"
@@ -6349,7 +7110,7 @@ msgstr ""
 #, fuzzy
 #~ msgid ""
 #~ "\n"
-#~ "Version: %s (%s)\n"
+#~ "%sVersion: %s (%s)\n"
 #~ "\n"
 #~ "Usage: btape <options> <device_name>\n"
 #~ "       -b <file>   specify bootstrap file\n"
@@ -6377,7 +7138,42 @@ msgstr ""
 
 #, fuzzy
 #~ msgid "Read block=%u, VolBytes=%s rate=%sB/s\n"
-#~ msgstr "Écriture blk_block=%u, dev_blk_num=%u VolBytes=%s rate=%.1f KB/s\n"
+#~ msgstr "Ecriture blk_block=%u, dev_blk_num=%u VolBytes=%s rate=%.1f KB/s\n"
+
+#, fuzzy
+#~ msgid "Dedupengine status:\n"
+#~ msgstr ""
+#~ "\n"
+#~ "Statut du Device :\n"
+
+#, fuzzy
+#~ msgid "Cannot create DedupDirectory: %s"
+#~ msgstr "change le répertoire courant"
+
+#, fuzzy
+#~ msgid "Cannot create DedupIndexDirectory: %s"
+#~ msgstr "change le répertoire courant"
+
+#, fuzzy
+#~ msgid "Cannot create recovery directory: %s"
+#~ msgstr "change le répertoire courant"
+
+#, fuzzy
+#~ msgid "Cannot delete temporary recovery directory: %s"
+#~ msgstr "change le répertoire courant"
+
+#, fuzzy
+#~ msgid "Socket error or stop during rehydration. ERR=%d\n"
+#~ msgstr "Erreur de socket sur la commande %s : ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unexpected message from FD, n=%d msglen=%d msg=%s\n"
+#~ msgstr ""
+#~ "Erreur pendant l'écriture des données vers le fichier de spool. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Error sending chunk request to client\n"
+#~ msgstr "Erreur pendant lors de la récupération du pool. ERR=%s\n"
 
 #~ msgid "Block size %u on device %s is too large, using default %u\n"
 #~ msgstr ""
@@ -6403,6 +7199,10 @@ msgstr ""
 #~ msgstr "Impossible d'initialiser le muxtex : ERR=%s\n"
 
 #, fuzzy
+#~ msgid "Unable to init adata mutex: ERR=%s\n"
+#~ msgstr "Impossible d'initialiser le muxtex : ERR=%s\n"
+
+#, fuzzy
 #~ msgid "Unable to init volcat mutex: ERR=%s\n"
 #~ msgstr "Impossible d'initialiser le muxtex : ERR=%s\n"
 
@@ -6424,10 +7224,6 @@ msgstr ""
 #~ msgstr "Demande de connexion échouée.\n"
 
 #, fuzzy
-#~ msgid "Invalid connection from %s. Len=%d\n"
-#~ msgstr "Connexion invalide. Len=%d\n"
-
-#, fuzzy
 #~ msgid "Bad client command: %s"
 #~ msgstr "Erreur dans la commande RunScript : %s\n"
 
@@ -6439,6 +7235,10 @@ msgstr ""
 #~ msgid "Failed to connect to Client daemon: %s:%d\n"
 #~ msgstr "Impossible de se connecter au client.\n"
 
+#, fuzzy
+#~ msgid "3000 Deduplication vacuum marked to be canceled.\n"
+#~ msgstr "3000 Job %s marqué pour être annulé.\n"
+
 #~ msgid "3904 Job %s not found.\n"
 #~ msgstr "3904 Job %s non trouvé.\n"
 
@@ -6539,16 +7339,32 @@ msgstr ""
 #~ msgstr "3909 Erreur pendant la lecture de la commande de montage : %s\n"
 
 #, fuzzy
-#~ msgid "3002 Device \"%s\" unmounted.\n"
-#~ msgstr "3002 Le device %s est démonté.\n"
+#~ msgid "3002 Device \"%s\" enabled.\n"
+#~ msgstr "3022 Le device %s est libéré.\n"
 
 #, fuzzy
-#~ msgid "3901 Device \"%s\" is already unmounted.\n"
-#~ msgstr "3901 Le device %s est déjà démonté.\n"
+#~ msgid "3907 Error scanning \"enable\" command: %s\n"
+#~ msgstr "3909 Erreur pendant la lecture de la commande de montage : %s\n"
 
 #, fuzzy
-#~ msgid "3001 Device \"%s\" unmounted.\n"
-#~ msgstr "3001 Le device %s est démonté.\n"
+#~ msgid "3002 Device \"%s\" disabled.\n"
+#~ msgstr "3002 Le device %s est monté.\n"
+
+#, fuzzy
+#~ msgid "3907 Error scanning \"disable\" command: %s\n"
+#~ msgstr "3909 Erreur pendant la lecture de la commande de montage : %s\n"
+
+#, fuzzy
+#~ msgid "3002 Device \"%s\" unmounted.\n"
+#~ msgstr "3002 Le device %s est démonté.\n"
+
+#, fuzzy
+#~ msgid "3901 Device \"%s\" is already unmounted.\n"
+#~ msgstr "3901 Le device %s est déjà démonté.\n"
+
+#, fuzzy
+#~ msgid "3001 Device \"%s\" unmounted.\n"
+#~ msgstr "3001 Le device %s est démonté.\n"
 
 #, fuzzy
 #~ msgid "3902 Device \"%s\" is busy in acquire.\n"
@@ -6590,7 +7406,7 @@ msgstr ""
 #~ msgstr "3995 Le Device %s n'est pas un autochangeur.\n"
 
 #, fuzzy
-#~ msgid "3908 Error scanning autochanger drives/list/slots command: %s\n"
+#~ msgid "3909 Error scanning autochanger drives/list/slots command: %s\n"
 #~ msgstr "3909 Erreur pendant la lecture de la commande de montage : %s\n"
 
 #~ msgid "3001 Volume=%s Slot=%d\n"
@@ -6598,14 +7414,14 @@ msgstr ""
 
 #, fuzzy
 #~ msgid "3931 Device \"%s\" is BLOCKED. user unmounted.\n"
-#~ msgstr "3931 Device %s est BLOQUÉ, démonté par l'utilisateur.\n"
+#~ msgstr "3931 Device %s est BLOQUE, démonté par l'utilisateur.\n"
 
 #, fuzzy
 #~ msgid ""
 #~ "3932 Device \"%s\" is BLOCKED. user unmounted during wait for media/"
 #~ "mount.\n"
 #~ msgstr ""
-#~ "3932 Device %s est BLOQUÉ, démonté par l'utilisateur alors que bacula "
+#~ "3932 Device %s est BLOQUE, démonté par l'utilisateur alors que bacula "
 #~ "était en attente d'un média.\n"
 
 #, fuzzy
@@ -6633,14 +7449,30 @@ msgstr ""
 #~ msgstr "3937 Device %s est occupé avec %d flux en écriture.\n"
 
 #, fuzzy
+#~ msgid "Error writing part %d to the DVD: ERR=%s\n"
+#~ msgstr "Erreur dans l'exécution de la commande : %s. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to write last on %s: ERR=%s\n"
+#~ msgstr "Impossible de se connecter à %s sur %s:%d. ERR=%s\n"
+
+#, fuzzy
 #~ msgid "FD command not found: %s\n"
 #~ msgstr "Job non trouvé : %s\n"
 
 #, fuzzy
+#~ msgid "Cannot open session, received bad parameters.\n"
+#~ msgstr "Impossible d'ouvrir le fichier %s : ERR=%s\n"
+
+#, fuzzy
 #~ msgid "Could not open(%s,%s,0640): ERR=%s\n"
 #~ msgstr "Impossible d'ouvrir %s : ERR=%s\n"
 
 #, fuzzy
+#~ msgid "Could not open aligned volume: %s, ERR=%s\n"
+#~ msgstr "Impossible d'ouvrir le fichier pid. %s ERR=%s\n"
+
+#, fuzzy
 #~ msgid "Unable to stat device %s. ERR=%s\n"
 #~ msgstr "3910 Impossible d'ouvrir le device %s : ERR=%s\n"
 
@@ -6652,20 +7484,52 @@ msgstr ""
 #~ msgstr "Le Device %s ne peut pas être %smounted. ERR=%s\n"
 
 #, fuzzy
+#~ msgid ""
+#~ "Connection from unknown Director %s at %s rejected.\n"
+#~ "Please see "
+#~ msgstr ""
+#~ "Connexion d'un Director inconnu %s à %s rejeté.\n"
+#~ "\n"
+
+#, fuzzy
+#~ msgid "Invalid connection from %s. Len=%d\n"
+#~ msgstr "Connexion invalide. Len=%d\n"
+
+#, fuzzy
+#~ msgid "Invalid Hello from %s. Len=%d\n"
+#~ msgstr "Connexion invalide. Len=%d\n"
+
+#, fuzzy
+#~ msgid "Client connect failed: Job name not found: %s\n"
+#~ msgstr "Job non trouvé : %s\n"
+
+#, fuzzy
 #~ msgid "Client socket not open. Could not connect to Client.\n"
 #~ msgstr "Impossible de se connecter au Client.\n"
 
 #, fuzzy
 #~ msgid "Recv request to Client failed. ERR=%s\n"
-#~ msgstr "Demande de connexion échouée.\n"
+#~ msgstr "Erreur sur l'ouverture du périphérique. ERR=%s\n"
 
 #, fuzzy
 #~ msgid "Bad Hello from Client: %s.\n"
 #~ msgstr "Début de purge des jobs du client \"%s\"\n"
 
 #, fuzzy
-#~ msgid "FD connect failed: Job name not found: %s\n"
-#~ msgstr "Job non trouvé : %s\n"
+#~ msgid "Send caps to Client failed. ERR=%s\n"
+#~ msgstr "Erreur sur l'ouverture du périphérique. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Recv caps from Client failed. ERR=%s\n"
+#~ msgstr "Erreur sur l'ouverture du périphérique. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Recv bad caps from Client: %s.\n"
+#~ msgstr "Début de purge des jobs du client \"%s\"\n"
+
+#, fuzzy
+#~ msgid "Recv bad caps from Client %s\n"
+#~ msgstr "Début de purge des jobs du client \"%s\"\n"
 
 #, fuzzy
 #~ msgid "Couldn't rewind %s device %s: ERR=%s\n"
@@ -6683,6 +7547,22 @@ msgstr ""
 #~ msgstr "Le volume sur %s possède un mauvais label Bacula : %x\n"
 
 #, fuzzy
+#~ msgid ""
+#~ "Got Aligned or File type Volume %s on Dedup device %s. Wanted File.\n"
+#~ msgstr "Le nouveau volume \"%s\" a été labélisé sur le device %s.\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "Got Aligned or Dedup type Volume %s on File device %s. Wanted File.\n"
+#~ msgstr "Le nouveau volume \"%s\" a été labélisé sur le device %s.\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "Got File or Dedup type Volume %s on Aligned device %s. Wanted Aligned.\n"
+#~ msgstr ""
+#~ "Ecriture du label sur le Volume pré-labélisé \"%s\" sur le lecteur %s\n"
+
+#, fuzzy
 #~ msgid "Could not reserve volume %s on %s device %s\n"
 #~ msgstr "Impossible de trouver le prochain volume pour le Job %s.\n"
 
@@ -6720,7 +7600,7 @@ msgstr ""
 #, fuzzy
 #~ msgid "Wrote label to prelabeled Volume \"%s\" on %s device %s\n"
 #~ msgstr ""
-#~ "Écriture du label sur le Volume pré-labélisé \"%s\" sur le lecteur %s\n"
+#~ "Ecriture du label sur le Volume pré-labélisé \"%s\" sur le lecteur %s\n"
 
 #, fuzzy
 #~ msgid "Bad Volume session label request=%d\n"
@@ -6755,7 +7635,7 @@ msgstr ""
 #~ "Impossible de se positionner à la fin du média sur le device %s : ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Volume \"%s\" not on %s device %s.\n"
+#~ msgid "Volume \"%s\" not loaded on %s device %s.\n"
 #~ msgstr "Le volume \"%s\" n'est pas dans le device %s.\n"
 
 #~ msgid ""
@@ -6805,6 +7685,13 @@ msgstr ""
 #~ "car le nombre de fichiers ne correspond pas. Volume=%u Catalogue=%u\n"
 
 #, fuzzy
+#~ msgid ""
+#~ "Ready to append to end of Volumes \"%s\" ameta size=%s adata size=%s\n"
+#~ msgstr ""
+#~ "Prêt à ajouter des données à la fin du volume \"%s\" part=%d size=%s\n"
+#~ "\n"
+
+#, fuzzy
 #~ msgid "Ready to append to end of Volume \"%s\" size=%s\n"
 #~ msgstr ""
 #~ "Prêt à ajouter des données à la fin du volume \"%s\" part=%d size=%s\n"
@@ -6813,7 +7700,16 @@ msgstr ""
 #, fuzzy
 #~ msgid ""
 #~ "For Volume \"%s\":\n"
-#~ "   The sizes do not match! Volume=%s Catalog=%s\n"
+#~ "   The sizes do not match! Metadata Volume=%s Catalog=%s\n"
+#~ "   Correcting Catalog\n"
+#~ msgstr ""
+#~ "Impossible d'écrire sur le volume \"%s\" car :\n"
+#~ "Les tailles ne correspondent pas. Volume=%s Catalogue=%s\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "For aligned Volume \"%s\":\n"
+#~ "   Aligned sizes do not match! Aligned Volume=%s Catalog=%s\n"
 #~ "   Correcting Catalog\n"
 #~ msgstr ""
 #~ "Impossible d'écrire sur le volume \"%s\" car :\n"
@@ -6862,6 +7758,15 @@ msgstr ""
 #~ msgid "REGEX '%s' compile error. ERR=%s\n"
 #~ msgstr "erreur de fermeture : ERR=%s\n"
 
+#, fuzzy
+#~ msgid "Error sending header to Client. ERR=%s\n"
+#~ msgstr "Erreur pendant lors de la récupération du pool. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Error sending data to Client. ERR=%s\n"
+#~ msgstr ""
+#~ "Erreur pendant l'écriture des données vers le fichier de spool. ERR=%s\n"
+
 #~ msgid "End of Volume at file %u on device %s, Volume \"%s\"\n"
 #~ msgstr "Fin de Volume au fichier %u sur le Device %s, Volume \"%s\"\n"
 
@@ -6888,6 +7793,12 @@ msgstr ""
 #~ msgstr "Erreur sur la commande : %s\n"
 
 #, fuzzy
+#~ msgid ""
+#~ "\n"
+#~ "     Device \"%s\" requested by DIR is disabled.\n"
+#~ msgstr "3934 Device %s est en cours d'initialisation.\n"
+
+#, fuzzy
 #~ msgid "3603 JobId=%u %s device %s is busy reading.\n"
 #~ msgstr "3603 JobId=%u device %s est occupé en lecture.\n"
 
@@ -6900,7 +7811,7 @@ msgstr ""
 #, fuzzy
 #~ msgid "3601 JobId=%u %s device %s is BLOCKED due to user unmount.\n"
 #~ msgstr ""
-#~ "3601 JobId=%u device %s est BLOQUÉ car il a été demonté par "
+#~ "3601 JobId=%u device %s est BLOQUE car il a été demonté par "
 #~ "l'utilisateur.\n"
 
 #, fuzzy
@@ -6916,6 +7827,14 @@ msgstr ""
 #~ "drive %s.\n"
 
 #, fuzzy
+#~ msgid ""
+#~ "3610 JobId=%u Aligned volume max bytes does not allow concurrency on "
+#~ "drive %s.\n"
+#~ msgstr ""
+#~ "3607 JobId=%u voulait Vol=\"%s\", c'est le Vol=\"%s\" qui est dans le "
+#~ "drive %s.\n"
+
+#, fuzzy
 #~ msgid "3611 JobId=%u Volume max jobs=%d exceeded on %s device %s.\n"
 #~ msgstr ""
 #~ "3607 JobId=%u voulait Vol=\"%s\", c'est le Vol=\"%s\" qui est dans le "
@@ -6969,7 +7888,7 @@ msgstr ""
 
 #~ msgid "Writing spooled data to Volume. Despooling %s bytes ...\n"
 #~ msgstr ""
-#~ "Écriture des données spoolées sur le Volume. Transfert de %s octets...\n"
+#~ "Ecriture des données spoolées sur le Volume. Transfert de %s octets...\n"
 
 #, fuzzy
 #~ msgid ""
@@ -6998,6 +7917,11 @@ msgstr ""
 #~ msgstr ""
 #~ "Erreur pendant l'écriture des données vers le fichier de spool. ERR=%s\n"
 
+# Impossible d'ouvrir le fichier de spool des attributs : ERR=%s
+#, fuzzy
+#~ msgid "Truncate on attributes file failed: ERR=%s\n"
+#~ msgstr "Impossible d'ouvrir le fichier de spool des attributs %s : ERR=%s\n"
+
 #~ msgid "Sending spooled attrs to the Director. Despooling %s bytes ...\n"
 #~ msgstr ""
 #~ "Transfert des attributs spoolés au Director. Transfert de %s octets...\n"
@@ -7009,20 +7933,20 @@ msgstr ""
 #~ msgid "Used Volume status:\n"
 #~ msgstr "Volume en cours d'utilisation :\n"
 
+#, fuzzy
+#~ msgid "3900 missing args in .status command: %s\n"
+#~ msgstr "3909 Erreur pendant la lecture de la commande de montage : %s\n"
+
+#, fuzzy
 #~ msgid ""
 #~ "\n"
-#~ "Device status:\n"
-#~ msgstr ""
-#~ "\n"
-#~ "Statut du Device :\n"
-
-#~ msgid "Autochanger \"%s\" with devices:\n"
-#~ msgstr "Autochangeur \"%s\" avec les Devices :\n"
+#~ "Device \"%s\" is not open or does not exist.\n"
+#~ msgstr "Le Device \"%s\" n'est pas ouvert ou il n'existe pas.\n"
 
 #, fuzzy
 #~ msgid ""
 #~ "\n"
-#~ "Device %s is %s:\n"
+#~ "Device %s is %s %s:\n"
 #~ "    Volume:      %s\n"
 #~ "    Pool:        %s\n"
 #~ "    Media type:  %s\n"
@@ -7043,7 +7967,7 @@ msgstr ""
 #, fuzzy
 #~ msgid ""
 #~ "\n"
-#~ "Device %s open but no Bacula volume is currently mounted.\n"
+#~ "Device %s: %s open but no Bacula volume is currently mounted.\n"
 #~ msgstr ""
 #~ "Le Device %s est ouvert, mais il n'y a pas de Volume Bacula monté.\n"
 
@@ -7059,25 +7983,41 @@ msgstr ""
 #, fuzzy
 #~ msgid ""
 #~ "\n"
-#~ "Device %s is not open.\n"
+#~ "Device %s: %s is not open.\n"
 #~ msgstr "Le Device %s n'est pas ouvert.\n"
 
 #, fuzzy
+#~ msgid "    Available Space=%sB\n"
+#~ msgstr "Requêtes disponibles :\n"
+
+#~ msgid "Autochanger \"%s\" with devices:\n"
+#~ msgstr "Autochangeur \"%s\" avec les Devices :\n"
+
 #~ msgid ""
 #~ "\n"
-#~ "Device \"%s\" is not open or does not exist.\n"
-#~ msgstr "Le Device \"%s\" n'est pas ouvert ou il n'existe pas.\n"
+#~ "Device status:\n"
+#~ msgstr ""
+#~ "\n"
+#~ "Statut du Device :\n"
 
 #, fuzzy
 #~ msgid "Daemon started %s. Jobs: run=%d, running=%d.\n"
 #~ msgstr "Démon démarré depuis %s, %d jobs lancés depuis cette date.\n"
 
+#, fuzzy
+#~ msgid "    Device is BLOCKED by another SD=%s\n"
+#~ msgstr "    Le Device est BLOQUE. Démonté par l'utilisateur.\n"
+
+#, fuzzy
+#~ msgid "    Device is disabled. User command.\n"
+#~ msgstr "    Le Device est BLOQUE. Démonté par l'utilisateur.\n"
+
 #~ msgid "    Device is BLOCKED. User unmounted.\n"
-#~ msgstr "    Le Device est BLOQUÉ. Démonté par l'utilisateur.\n"
+#~ msgstr "    Le Device est BLOQUE. Démonté par l'utilisateur.\n"
 
 #~ msgid "    Device is BLOCKED. User unmounted during wait for media/mount.\n"
 #~ msgstr ""
-#~ "    Le Device est BLOQUÉ. Démonté par l'utilisateur à cause d'un "
+#~ "    Le Device est BLOQUE. Démonté par l'utilisateur à cause d'un "
 #~ "chargement de média.\n"
 
 #~ msgid ""
@@ -7085,7 +8025,7 @@ msgstr ""
 #~ "       Pool:        %s\n"
 #~ "       Media type:  %s\n"
 #~ msgstr ""
-#~ "    Le Device est BLOQUÉ en attente du montage du volume \"%s\",\n"
+#~ "    Le Device est BLOQUE en attente du montage du volume \"%s\",\n"
 #~ "        Pool :       %s\n"
 #~ "        Media type : %s\n"
 
@@ -7094,12 +8034,12 @@ msgstr ""
 #~ "       Pool:        %s\n"
 #~ "       Media type:  %s\n"
 #~ msgstr ""
-#~ "    Le Device est BLOQUÉ en attente de création d'un volume :\n"
+#~ "    Le Device est BLOQUE en attente de création d'un volume :\n"
 #~ "        Pool :       %s\n"
 #~ "        Media type : %s\n"
 
 #~ msgid "    Device is BLOCKED waiting for media.\n"
-#~ msgstr "    Le Device est BLOQUÉ en attente d'un média.\n"
+#~ msgstr "    Le Device est BLOQUE en attente d'un média.\n"
 
 #~ msgid "    Device is being initialized.\n"
 #~ msgstr "    Le Device est en cours d'initialisation.\n"
@@ -7115,7 +8055,7 @@ msgstr ""
 #~ msgstr "    Le lecteur %d n'est pas chargé.\n"
 
 #, fuzzy
-#~ msgid "Attached JobsIds: "
+#~ msgid "Attached JobIds: "
 #~ msgstr ""
 #~ "\n"
 #~ "Jobs planifiés :\n"
@@ -7151,7 +8091,7 @@ msgstr ""
 
 #, fuzzy
 #~ msgid "    Files=%s Bytes=%s AveBytes/sec=%s LastBytes/sec=%s\n"
-#~ msgstr "    Fichiers=%s Octets=%s Octets/sec=%s Erreurs=%d\n"
+#~ msgstr "    Fichiers=%s Octets=%s Octets/sec=%s\n"
 
 #~ msgid ""
 #~ "\n"
@@ -7166,41 +8106,26 @@ msgstr ""
 
 #, fuzzy
 #~ msgid "3900 Unknown arg in .status command: %s\n"
-#~ msgstr "Erreur inconnue."
-
-#~ msgid "Bacula Storage: Idle"
-#~ msgstr "Bacula Storage : En attente"
-
-#~ msgid "Bacula Storage: Running"
-#~ msgstr "Bacula Storage : En cours"
-
-#~ msgid "Bacula Storage: Last Job Canceled"
-#~ msgstr "Bacula Storage : Dernier Job annulé"
-
-#~ msgid "Bacula Storage: Last Job Failed"
-#~ msgstr "Bacula Storage : Dernier Job en erreur"
-
-#~ msgid "Bacula Storage: Last Job had Warnings"
-#~ msgstr "Bacula Storage : Le dernier Job avait des erreurs"
+#~ msgstr "3909 Erreur pendant la lecture de la commande de montage : %s\n"
 
 #, fuzzy
 #~ msgid ""
 #~ "\n"
-#~ "Version: %s (%s)\n"
+#~ "%sVersion: %s (%s)\n"
 #~ "\n"
 #~ "Usage: bacula-sd [options] [-c config_file] [config_file]\n"
-#~ "        -c <file>   use <file> as configuration file\n"
-#~ "        -d <nn>     set debug level to <nn>\n"
-#~ "        -dt         print timestamp in debug output\n"
-#~ "        -f          run in foreground (for debugging)\n"
-#~ "        -g <group>  set groupid to group\n"
-#~ "        -m          print kaboom output (for debugging)\n"
-#~ "        -p          proceed despite I/O errors\n"
-#~ "        -s          no signals (for debugging)\n"
-#~ "        -t          test - read config and exit\n"
-#~ "        -u <user>   userid to <user>\n"
-#~ "        -v          verbose user messages\n"
-#~ "        -?          print this message.\n"
+#~ "     -c <file>         use <file> as configuration file\n"
+#~ "     -d <nn>[,<tags>]  set debug level to <nn>, debug tags to <tags>\n"
+#~ "     -dt               print timestamp in debug output\n"
+#~ "     -f                run in foreground (for debugging)\n"
+#~ "     -g <group>        set groupid to group\n"
+#~ "     -m                print kaboom output (for debugging)\n"
+#~ "     -p                proceed despite I/O errors\n"
+#~ "     -s                no signals (for debugging)\n"
+#~ "     -t                test - read config and exit\n"
+#~ "     -u <user>         userid to <user>\n"
+#~ "     -v                verbose user messages\n"
+#~ "     -?                print this message.\n"
 #~ "\n"
 #~ msgstr ""
 #~ "\n"
@@ -7220,8 +8145,9 @@ msgstr ""
 #~ "      -?             affiche ce message.\n"
 #~ "\n"
 
-#~ msgid "Could not initialize %s\n"
-#~ msgstr "Impossible d'initialiser %s\n"
+#, fuzzy
+#~ msgid "Unable to stat ControlDevice %s: ERR=%s\n"
+#~ msgstr "3910 Impossible d'ouvrir le device %s : ERR=%s\n"
 
 #~ msgid "Could not open device %s\n"
 #~ msgstr "Impossible d'ouvrir le device %s\n"
@@ -7279,7 +8205,7 @@ msgstr ""
 #, fuzzy
 #~ msgid ""
 #~ "\n"
-#~ "Version: %s (%s)\n"
+#~ "%sVersion: %s (%s)\n"
 #~ "Example : bbatch -w /path/to/workdir -h localhost -f dat1 -f dat -f datx\n"
 #~ " will start 3 thread and load dat1, dat and datx in your catalog\n"
 #~ "See bbatch.c to generate datafile\n"
@@ -7300,8 +8226,7 @@ msgstr ""
 #~ "       -?                print this message\n"
 #~ "\n"
 #~ msgstr ""
-#~ "Copyright (C) 2000-2005 Kern Sibbald.\n"
-#~ "\n"
+#~ "Copyright (C) 2000-2015 Kern Sibbald\n"
 #~ "Version : %s (%s)\n"
 #~ "\n"
 #~ "Usage : dird [-f -s] [-c config_file] [-d debug_level] [config_file]\n"
@@ -7383,8 +8308,18 @@ msgstr ""
 
 #, fuzzy
 #~ msgid ""
+#~ "ERROR %s\n"
+#~ "\n"
+#~ msgstr "%s : ERREUR : "
+
+#, fuzzy
+#~ msgid "Unable to open -p argument for reading"
+#~ msgstr "Impossible d'ouvrir le fichier de paramètre DH"
+
+#, fuzzy
+#~ msgid ""
 #~ "\n"
-#~ "Version: %s (%s)\n"
+#~ "%sVersion: %s (%s)\n"
 #~ "       -d <nn>           set debug level to <nn>\n"
 #~ "       -dt               print timestamp in debug output\n"
 #~ "       -n <name>         specify the database name (default bacula)\n"
@@ -7401,8 +8336,7 @@ msgstr ""
 #~ "       -?                print this message\n"
 #~ "\n"
 #~ msgstr ""
-#~ "Copyright (C) 2000-2005 Kern Sibbald.\n"
-#~ "\n"
+#~ "Copyright (C) 2000-2015 Kern Sibbald\n"
 #~ "Version : %s (%s)\n"
 #~ "\n"
 #~ "Usage : dird [-f -s] [-c config_file] [-d debug_level] [config_file]\n"
@@ -7421,7 +8355,7 @@ msgstr ""
 #, fuzzy
 #~ msgid ""
 #~ "\n"
-#~ "Version: %s (%s)\n"
+#~ "%sVersion: %s (%s)\n"
 #~ "       -d <nn>           set debug level to <nn>\n"
 #~ "       -dt               print timestamp in debug output\n"
 #~ "       -n <name>         specify the database name (default bacula)\n"
@@ -7437,8 +8371,7 @@ msgstr ""
 #~ "       -?                print this message\n"
 #~ "\n"
 #~ msgstr ""
-#~ "Copyright (C) 2000-2005 Kern Sibbald.\n"
-#~ "\n"
+#~ "Copyright (C) 2000-2015 Kern Sibbald\n"
 #~ "Version : %s (%s)\n"
 #~ "\n"
 #~ "Usage : dird [-f -s] [-c config_file] [-d debug_level] [config_file]\n"
@@ -7463,105 +8396,136 @@ msgstr ""
 #~ msgstr "Continuez ? (oui/non) : "
 
 #, fuzzy
-#~ msgid "Invalid jobid argument\n"
-#~ msgstr "argument invalide"
+#~ msgid ""
+#~ "\n"
+#~ "\n"
+#~ "Bacula ERROR: "
+#~ msgstr "Bacula "
 
 #, fuzzy
-#~ msgid "Unknown ObjectType %s\n"
-#~ msgstr "Mot clef inconnu : %s\n"
+#~ msgid "Unable to resolve parent path for %ls\n"
+#~ msgstr "Impossible de mettre à jour les informations du Volume : ERR=%s"
 
 #, fuzzy
-#~ msgid "Cannot run free space command. Results=%s ERR=%s\n"
-#~ msgstr "Impossible de lancer la commande : %s. ERR=%s\n"
+#~ msgid "Unable to parse user supplied restore configuration\n"
+#~ msgstr "Impossible de lire le certificat à partir du fichier"
 
 #, fuzzy
-#~ msgid "Error writing part %d to the DVD: ERR=%s\n"
-#~ msgstr "Erreur dans l'exécution de la commande : %s. ERR=%s\n"
+#~ msgid "Failure contacting the Service Handler"
+#~ msgstr "Impossible de décrypter la clef de session"
 
 #, fuzzy
-#~ msgid "Unable to write last on %s: ERR=%s\n"
-#~ msgstr "Impossible de se connecter à %s sur %s:%d. ERR=%s\n"
+#~ msgid "KERNEL32.DLL not found: Bacula service not started"
+#~ msgstr "Ressource %s introuvable\n"
 
 #, fuzzy
-#~ msgid ""
-#~ "Out of freespace caused End of Volume \"%s\" at %u:%u on device %s. Write "
-#~ "of %u bytes got %d.\n"
-#~ msgstr ""
-#~ "Fin du volume \"%s\" à %u:%u sur le device %s. Ecriture de %u octets, eu "
-#~ "%d.\n"
-
-#~ msgid "Could not initialize Python\n"
-#~ msgstr "Impossible d'initialiser le Python\n"
-
-#~ msgid "Could not Run Python string %s\n"
-#~ msgstr "Impossible de lancer la commande Python %s\n"
+#~ msgid "Registry service not found: Bacula service not started"
+#~ msgstr "Ressource %s introuvable\n"
 
 #, fuzzy
-#~ msgid "Unable to initialize the Python lock. ERR=%s\n"
-#~ msgstr "Impossible d'initialiser le verrou sur la base. ERR=%s\n"
+#~ msgid "Registry service entry point not found"
+#~ msgstr "Ressource %s introuvable\n"
 
 #, fuzzy
-#~ msgid "Cannot open current directory: ERR=%s\n"
-#~ msgstr "Impossible d'ouvrir le fichier inclus : %s. ERR=%s\n"
+#~ msgid "Unable to install the service"
+#~ msgstr "Impossible d'écrire le marqueur EOF. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Cannot get current directory: ERR=%s\n"
-#~ msgstr "change le répertoire courant"
+#~ msgid "Service command length too long"
+#~ msgstr "Nom trop long.\n"
 
 #, fuzzy
-#~ msgid "Cannot reset current directory: ERR=%s\n"
-#~ msgstr "change le répertoire courant"
+#~ msgid ""
+#~ "The Service Control Manager could not be contacted - the service was not "
+#~ "installed"
+#~ msgstr "Ressource %s introuvable\n"
 
-#~ msgid "Generate VSS snapshots. Driver=\"%s\", Drive(s)=\"%s\"\n"
-#~ msgstr "Création des snapshot VSS. Driver=\"%s\", Lecteur(s)=\"%s\"\n"
+#, fuzzy
+#~ msgid "The Bacula service: "
+#~ msgstr "Bacula Storage : Dernier Job annulé"
 
 #, fuzzy
-#~ msgid "CreateSGenerate VSS snapshots failed. ERR=%s\n"
-#~ msgstr "Erreur durant la création des snapshots VSS.\n"
+#~ msgid "Cannot write System Registry for "
+#~ msgstr "Impossible de détruire la mémoire partagée : %s\n"
 
 #, fuzzy
-#~ msgid "Generate VSS snapshot of drive \"%c:\\\" failed.\n"
-#~ msgstr "Erreur durant la création des snapshots VSS.\n"
+#~ msgid ""
+#~ "The System Registry could not be updated - the Bacula service was not "
+#~ "installed"
+#~ msgstr "Ressource %s introuvable\n"
 
 #, fuzzy
-#~ msgid "VSS was not initialized properly. ERR=%s\n"
-#~ msgstr "Impossible d'initialiser le verrou sur la base. ERR=%s\n"
+#~ msgid "Cannot add Bacula key to System Registry"
+#~ msgstr "Impossible de détruire la mémoire partagée : %s\n"
 
-#~ msgid "Attribute %s not found."
-#~ msgstr "Attribut %s non trouvé."
+#, fuzzy
+#~ msgid "An existing Bacula service: "
+#~ msgstr "Bacula Storage : Dernier Job annulé"
 
 #, fuzzy
-#~ msgid "JobId %s is not running. Use Job name to %s inactive jobs.\n"
-#~ msgstr ""
-#~ "JobId %s n'est pas en cours. Utilisez le nom du Job pour annuler un job "
-#~ "inactif.\n"
+#~ msgid ""
+#~ "The service Manager could not be contacted - the Bacula service was not "
+#~ "removed"
+#~ msgstr "Ressource %s introuvable\n"
 
 #, fuzzy
 #~ msgid ""
-#~ "Cancel: %s\n"
-#~ "\n"
-#~ "%s"
-#~ msgstr ""
-#~ "Annule : %s\n"
-#~ "\n"
-#~ "%s"
+#~ "Could not find registry entry.\n"
+#~ "Service probably not registerd - the Bacula service was not removed"
+#~ msgstr "Ressource %s introuvable\n"
 
-#~ msgid "Confirm cancel?"
-#~ msgstr "Confirmez l'annulation : "
+#, fuzzy
+#~ msgid "Could not delete Registry key for "
+#~ msgstr "Impossible de détruire la mémoire partagée : %s\n"
 
 #, fuzzy
-#~ msgid "Disable a job"
-#~ msgstr "est bloqué"
+#~ msgid "The Bacula service has been removed"
+#~ msgstr "Ressource %s introuvable\n"
 
 #, fuzzy
-#~ msgid "Please Plugin Options string: "
-#~ msgstr "Saisissez le début du chemin (prefix) à enlever : "
+#~ msgid "Could not lock database"
+#~ msgstr "Impossible d'ouvrir la base de données \"%s\".\n"
 
-#~ msgid "%6d %-6s  %-20s %s\n"
-#~ msgstr "%6d %-6s  %-20s %s\n"
+#~ msgid "Expected an drivetype string, got: %s\n"
+#~ msgstr "Attendait un type de lecteur, pas : %s\n"
 
-#~ msgid "Priority must be 1-100"
-#~ msgstr "La priorité doit être comprise entre 1 et 100"
+#, fuzzy
+#~ msgid "Storage from Run NextPool override"
+#~ msgstr "Sélectionnez le Pool"
+
+#, fuzzy
+#~ msgid "Storage from Job's NextPool resource"
+#~ msgstr "Sélectionnez le Pool"
+
+#, fuzzy
+#~ msgid "Storage from Pool's NextPool resource"
+#~ msgstr "Sélectionnez le Pool"
+
+#, fuzzy
+#~ msgid "Storage from NextPool override"
+#~ msgstr "Sélectionnez le Pool"
+
+#, fuzzy
+#~ msgid "Enter *MediaId or Volume name: "
+#~ msgstr "Saisissez le MediaId ou le nom du Volume : "
+
+#~ msgid "Warning Job %s is not running. Continuing anyway ...\n"
+#~ msgstr "Attention le Job %s n'est pas en cours. Continuons quand même...\n"
+
+#, fuzzy
+#~ msgid "Generate VSS snapshot of drive \"%c:\\\" failed.\n"
+#~ msgstr "Erreur durant la création des snapshots VSS.\n"
+
+#, fuzzy
+#~ msgid "Selection item too large.\n"
+#~ msgstr "Slot trop grand.\n"
+
+#, fuzzy
+#~ msgid "FD connect failed: Job name not found: %s\n"
+#~ msgstr "Job non trouvé : %s\n"
+
+#~ msgid "Attribute %s not found."
+#~ msgstr "Attribut %s non trouvé."
 
 #, fuzzy
 #~ msgid ""
@@ -7665,7 +8629,7 @@ msgstr ""
 
 #, fuzzy
 #~ msgid "Job status: Waiting for new media"
-#~ msgstr "    Le Device est BLOQUÉ en attente d'un média.\n"
+#~ msgstr "    Le Device est BLOQUE en attente d'un média.\n"
 
 #, fuzzy
 #~ msgid "Job status: Waiting for Mount"
@@ -7720,26 +8684,6 @@ msgstr ""
 #~ msgstr "Impossible de se connecter au Storage daemon.\n"
 
 #, fuzzy
-#~ msgid "<ERROR>\n"
-#~ msgstr "%s : ERREUR : "
-
-#~ msgid "End of %s %u on device %s, Volume \"%s\"\n"
-#~ msgstr "Fin de %s %u sur le device %s, Volume \"%s\"\n"
-
-#, fuzzy
-#~ msgid "Append data error.\n"
-#~ msgstr "Erreur non fatale"
-
-# Impossible d'ouvrir le fichier de spool des attributs : ERR=%s
-#, fuzzy
-#~ msgid "Truncate on attributes file failed: ERR=%s\n"
-#~ msgstr "Impossible d'ouvrir le fichier de spool des attributs %s : ERR=%s\n"
-
-#, fuzzy
-#~ msgid "Unable to open device part=%d %s: ERR=%s\n"
-#~ msgstr "3910 Impossible d'ouvrir le device %s : ERR=%s\n"
-
-#, fuzzy
 #~ msgid "Failed to allocate space for query filter.\n"
 #~ msgstr "Impossible de se connecter au Director\n"
 
@@ -7762,6 +8706,10 @@ msgstr ""
 #~ msgstr "Un nom d'utilisateur MySQL doit être fourni.\n"
 
 #, fuzzy
+#~ msgid "Unknown database type: %s\n"
+#~ msgstr "Mot clef inconnu : %s\n"
+
+#, fuzzy
 #~ msgid ""
 #~ "Unable to connect to DBI interface. Type=%s Database=%s User=%s\n"
 #~ "Possible causes: SQL server not running; password incorrect; "
@@ -7788,102 +8736,43 @@ msgstr ""
 #~ msgstr "Un nom d'utilisateur MySQL doit être fourni.\n"
 
 #, fuzzy
-#~ msgid "Bad response to Hello command: ERR="
-#~ msgstr "Mauvaise réponse à la commande Hello : ERR=%s\n"
-
-#~ msgid "    Files=%s Bytes=%s Bytes/sec=%s Errors=%d\n"
-#~ msgstr "    Fichiers=%s Octets=%s Octets/sec=%s Erreurs=%d\n"
-
-#, fuzzy
-#~ msgid ""
-#~ "\n"
-#~ "\n"
-#~ "Bacula ERROR: "
-#~ msgstr "Bacula "
-
-#, fuzzy
-#~ msgid "Failure contacting the Service Handler"
-#~ msgstr "Impossible de décrypter la clef de session"
-
-#, fuzzy
-#~ msgid "KERNEL32.DLL not found: Bacula service not started"
-#~ msgstr "Ressource %s introuvable\n"
-
-#, fuzzy
-#~ msgid "Registry service not found: Bacula service not started"
-#~ msgstr "Ressource %s introuvable\n"
-
-#, fuzzy
-#~ msgid "Registry service entry point not found"
-#~ msgstr "Ressource %s introuvable\n"
-
-#, fuzzy
-#~ msgid "Unable to install the service"
-#~ msgstr "Impossible d'écrire le marqueur EOF. ERR=%s\n"
-
-#, fuzzy
-#~ msgid ""
-#~ "The Service Control Manager could not be contacted - the service was not "
-#~ "installed"
-#~ msgstr "Ressource %s introuvable\n"
-
-#, fuzzy
-#~ msgid "The Bacula service: "
-#~ msgstr "Bacula Storage : Dernier Job annulé"
+#~ msgid "Read zero bytes Vol=%s at %u:%u on device %s.\n"
+#~ msgstr "Prêt à lire les données du volume \"%s\" depuis le device %s.\n"
 
-#, fuzzy
-#~ msgid "Cannot write System Registry for "
-#~ msgstr "Impossible de détruire la mémoire partagée : %s\n"
+#~ msgid "Bacula Storage: Idle"
+#~ msgstr "Bacula Storage : En attente"
 
-#, fuzzy
-#~ msgid ""
-#~ "The System Registry could not be updated - the Bacula service was not "
-#~ "installed"
-#~ msgstr "Ressource %s introuvable\n"
+#~ msgid "Bacula Storage: Running"
+#~ msgstr "Bacula Storage : En cours"
 
-#, fuzzy
-#~ msgid "An existing Bacula service: "
+#~ msgid "Bacula Storage: Last Job Canceled"
 #~ msgstr "Bacula Storage : Dernier Job annulé"
 
-#, fuzzy
-#~ msgid ""
-#~ "The service Manager could not be contacted - the Bacula service was not "
-#~ "removed"
-#~ msgstr "Ressource %s introuvable\n"
-
-#, fuzzy
-#~ msgid ""
-#~ "Could not find registry entry.\n"
-#~ "Service probably not registerd - the Bacula service was not removed"
-#~ msgstr "Ressource %s introuvable\n"
-
-#, fuzzy
-#~ msgid "Could not delete Registry key for "
-#~ msgstr "Impossible de détruire la mémoire partagée : %s\n"
+#~ msgid "Bacula Storage: Last Job Failed"
+#~ msgstr "Bacula Storage : Dernier Job en erreur"
 
-#, fuzzy
-#~ msgid "The Bacula service has been removed"
-#~ msgstr "Ressource %s introuvable\n"
+#~ msgid "Bacula Storage: Last Job had Warnings"
+#~ msgstr "Bacula Storage : Le dernier Job avait des erreurs"
 
-#, fuzzy
-#~ msgid "Could not lock database"
-#~ msgstr "Impossible d'ouvrir la base de données \"%s\".\n"
+#~ msgid "JCR use_count=%d JobId=%d\n"
+#~ msgstr "JCR use_count=%d JobId=%d\n"
 
 #, fuzzy
-#~ msgid "Config file editor"
-#~ msgstr "La création de la signature a échouée"
+#~ msgid "Bad response to Hello command: ERR="
+#~ msgstr "Mauvaise réponse à la commande Hello : ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Close without saving"
-#~ msgstr "Terminé avec des avertissements"
+#~ msgid "JobId %s is not running. Use Job name to %s inactive jobs.\n"
+#~ msgstr ""
+#~ "JobId %s n'est pas en cours. Utilisez le nom du Job pour annuler un job "
+#~ "inactif.\n"
 
 #, fuzzy
-#~ msgid "Unable to write to %s\n"
-#~ msgstr "Impossible d'écrire le marqueur EOF. ERR=%s\n"
+#~ msgid "Confirm %s (yes/no): "
+#~ msgstr "Confirmez l'annulation (oui/non) : "
 
-#, fuzzy
-#~ msgid "Error while saving"
-#~ msgstr "Entrez le nombre de départ : "
+#~ msgid "Priority must be 1-100"
+#~ msgstr "La priorité doit être comprise entre 1 et 100"
 
 #, fuzzy
 #~ msgid "Enter restore mode"
@@ -7930,26 +8819,14 @@ msgstr ""
 #~ msgstr "Type"
 
 #, fuzzy
-#~ msgid "if older"
-#~ msgstr "FileSet"
-
-#, fuzzy
 #~ msgid "never"
 #~ msgstr "Type"
 
 #, fuzzy
-#~ msgid "Please configure parameters concerning files restoration :"
-#~ msgstr "Aucun fichier sélectionné pour la restauration.\n"
-
-#, fuzzy
 #~ msgid "Error : no clients returned by the director."
 #~ msgstr "Impossible de se connecter au Director\n"
 
 #, fuzzy
-#~ msgid "Error : no filesets returned by the director."
-#~ msgstr "Impossible de se connecter au Director\n"
-
-#, fuzzy
 #~ msgid "Error : no storage returned by the director."
 #~ msgstr "Impossible de se connecter au Director\n"
 
@@ -8020,10 +8897,6 @@ msgstr ""
 #~ msgstr "Job échoué.\n"
 
 #, fuzzy
-#~ msgid "Restore failed, please look at messages.\n"
-#~ msgstr "Impossible de créer le fichier bootstrap %s : ERR=%s\n"
-
-#, fuzzy
 #~ msgid "Failed to retrieve jobid.\n"
 #~ msgstr "Impossible de se connecter au Client.\n"
 
@@ -8044,16 +8917,8 @@ msgstr ""
 #~ msgstr "Restauration non effectuée.\n"
 
 #, fuzzy
-#~ msgid "Restore job terminated in error, see messages in console."
-#~ msgstr "    Le Device est BLOQUÉ en attente d'un média.\n"
-
-#, fuzzy
 #~ msgid "Restore job terminated in error, see messages.\n"
-#~ msgstr "    Le Device est BLOQUÉ en attente d'un média.\n"
-
-#, fuzzy
-#~ msgid "Restore job reported a non-fatal error."
-#~ msgstr "Restauration annulée"
+#~ msgstr "    Le Device est BLOQUE en attente d'un média.\n"
 
 #, fuzzy
 #~ msgid "Restore job reported a fatal error."
@@ -8073,7 +8938,7 @@ msgstr ""
 
 #, fuzzy
 #~ msgid "Restore job is waiting for new media."
-#~ msgstr "    Le Device est BLOQUÉ en attente d'un média.\n"
+#~ msgstr "    Le Device est BLOQUE en attente d'un média.\n"
 
 #, fuzzy
 #~ msgid "Restore job is waiting for storage resource."
@@ -8108,10 +8973,6 @@ msgstr ""
 #~ msgstr "Restauration non effectuée.\n"
 
 #, fuzzy
-#~ msgid "Applying restore configuration changes..."
-#~ msgstr "Merci de corriger le fichier de configuration : %s\n"
-
-#, fuzzy
 #~ msgid "Failed to find the selected client."
 #~ msgstr "Impossible de se connecter au Client.\n"
 
@@ -8144,56 +9005,175 @@ msgstr ""
 #~ msgstr "%s : ERREUR : "
 
 #, fuzzy
-#~ msgid "Query failed"
-#~ msgstr "Erreur sur la requête : %s\n"
+#~ msgid "Query failed"
+#~ msgstr "Erreur sur la requête : %s\n"
+
+#, fuzzy
+#~ msgid "JobName:"
+#~ msgstr "Job échoué.\n"
+
+#, fuzzy
+#~ msgid "Bootstrap:"
+#~ msgstr "Bootstrap"
+
+#, fuzzy
+#~ msgid "Where:"
+#~ msgstr "Destination"
+
+#, fuzzy
+#~ msgid "Replace:"
+#~ msgstr "Ecrasement :\n"
+
+#, fuzzy
+#~ msgid "ifnewer"
+#~ msgstr "Type"
+
+#, fuzzy
+#~ msgid "FileSet:"
+#~ msgstr "FileSet"
+
+#, fuzzy
+#~ msgid "Client:"
+#~ msgstr "Client"
+
+#, fuzzy
+#~ msgid "Storage:"
+#~ msgstr "Stockage"
+
+#, fuzzy
+#~ msgid "When:"
+#~ msgstr "Quand"
+
+#, fuzzy
+#~ msgid "Priority:"
+#~ msgstr "Priorité"
+
+#, fuzzy
+#~ msgid "Restoring..."
+#~ msgstr "string"
+
+#~ msgid "Type your command below:"
+#~ msgstr "Saisissez votre commande ci-dessous : "
+
+#, fuzzy
+#~ msgid "Unknown command."
+#~ msgstr "Erreur inconnue."
+
+#, fuzzy
+#~ msgid "Possible completions: "
+#~ msgstr "Les valeurs possibles sont :\n"
+
+#, fuzzy
+#~ msgid "Connect"
+#~ msgstr "Connexion...\n"
+
+#, fuzzy
+#~ msgid "Connect to the director"
+#~ msgstr "Impossible de se connecter au Director\n"
+
+#, fuzzy
+#~ msgid "Disconnect"
+#~ msgstr "Connexion...\n"
+
+#, fuzzy
+#~ msgid "Disconnect of the director"
+#~ msgstr "Impossible de se connecter au Director\n"
+
+#, fuzzy
+#~ msgid "Change of configuration file"
+#~ msgstr "La création de la signature a échouée"
+
+#, fuzzy
+#~ msgid "Change your default configuration file"
+#~ msgstr "Impossible de lire le certificat à partir du fichier"
+
+#, fuzzy
+#~ msgid "Edit your configuration file"
+#~ msgstr "La création de la signature a échouée"
+
+#, fuzzy
+#~ msgid "&File"
+#~ msgstr "FileSet"
+
+#, fuzzy
+#~ msgid "First run"
+#~ msgstr "est en cours"
+
+#, fuzzy
+#~ msgid "Please choose a configuration file to use"
+#~ msgstr "Merci de corriger le fichier de configuration : %s\n"
+
+#, fuzzy
+#~ msgid "Configuration file read successfully"
+#~ msgstr "La création de la signature a échouée"
+
+#, fuzzy
+#~ msgid "Using this configuration file: %s\n"
+#~ msgstr "Merci de corriger le fichier de configuration : %s\n"
+
+#, fuzzy
+#~ msgid "Connecting to the director..."
+#~ msgstr "Connexion au Director %s:%d\n"
+
+#, fuzzy
+#~ msgid "Please choose your default configuration file"
+#~ msgstr "Merci de corriger le fichier de configuration : %s\n"
+
+#, fuzzy
+#~ msgid "Use this configuration file as default?"
+#~ msgstr "Merci de corriger le fichier de configuration : %s\n"
+
+#, fuzzy
+#~ msgid "Configuration file"
+#~ msgstr "La création de la signature a échouée"
 
 #, fuzzy
-#~ msgid "JobName:"
-#~ msgstr "Job échoué.\n"
+#~ msgid "Console thread terminated."
+#~ msgstr "est terminé"
 
 #, fuzzy
-#~ msgid "Bootstrap:"
-#~ msgstr "Bootstrap"
+#~ msgid "Connection to the director lost. Quit program?"
+#~ msgstr "Connexion au Director %s:%d\n"
 
 #, fuzzy
-#~ msgid "Where:"
-#~ msgstr "Destination"
+#~ msgid "Connection lost"
+#~ msgstr "Connexion...\n"
 
 #, fuzzy
-#~ msgid "Replace:"
-#~ msgstr "Écrasement :\n"
+#~ msgid "Connected to the director."
+#~ msgstr "Impossible de se connecter au Director\n"
 
 #, fuzzy
-#~ msgid "ifnewer"
-#~ msgstr "Type"
+#~ msgid "Reconnect"
+#~ msgstr "Connexion...\n"
 
 #, fuzzy
-#~ msgid "ifolder"
-#~ msgstr "FileSet"
+#~ msgid "Reconnect to the director"
+#~ msgstr "Impossible de se connecter au Director\n"
 
 #, fuzzy
-#~ msgid "FileSet:"
-#~ msgstr "FileSet"
+#~ msgid "Disconnected of the director."
+#~ msgstr "Impossible de se connecter au Director\n"
 
 #, fuzzy
-#~ msgid "Client:"
-#~ msgstr "Client"
+#~ msgid "Config file editor"
+#~ msgstr "La création de la signature a échouée"
 
 #, fuzzy
-#~ msgid "Storage:"
-#~ msgstr "Stockage"
+#~ msgid "# Bacula bwx-console Configuration File\n"
+#~ msgstr "Merci de corriger le fichier de configuration : %s\n"
 
 #, fuzzy
-#~ msgid "When:"
-#~ msgstr "Quand"
+#~ msgid "Unable to write to %s\n"
+#~ msgstr "Impossible d'écrire le marqueur EOF. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Priority:"
-#~ msgstr "Priorité"
+#~ msgid "Error while saving"
+#~ msgstr "Entrez le nombre de départ : "
 
 #, fuzzy
-#~ msgid "Restoring..."
-#~ msgstr "string"
+#~ msgid "Bacula bwx-console"
+#~ msgstr "Message de Bacula"
 
 #, fuzzy
 #~ msgid ""
@@ -8208,10 +9188,6 @@ msgstr ""
 #~ msgstr "Erreur pendant l'initialisation du contexte SSL"
 
 #, fuzzy
-#~ msgid "Error while cleaning up windows sockets...\n"
-#~ msgstr "Erreur pendant l'initialisation du contexte SSL"
-
-#, fuzzy
 #~ msgid "Error while initializing library."
 #~ msgstr "Erreur pendant l'initialisation du contexte SSL"
 
@@ -8234,10 +9210,6 @@ msgstr ""
 #~ msgid "Connecting...\n"
 #~ msgstr "Connexion...\n"
 
-#, fuzzy
-#~ msgid "Please choose a director (1-%d): "
-#~ msgstr "Aucun fichier sélectionné pour la restauration.\n"
-
 #~ msgid "Failed to connect to the director\n"
 #~ msgstr "Impossible de se connecter au Director\n"
 
@@ -8249,143 +9221,123 @@ msgstr ""
 #~ msgid "Connection terminated\n"
 #~ msgstr "Sélection terminée.\n"
 
-#~ msgid "Type your command below:"
-#~ msgstr "Saisissez votre commande ci-dessous : "
-
-#, fuzzy
-#~ msgid "Unknown command."
-#~ msgstr "Erreur inconnue."
-
-#, fuzzy
-#~ msgid "Possible completions: "
-#~ msgstr "Les valeurs possibles sont :\n"
-
-#, fuzzy
-#~ msgid "Connect"
-#~ msgstr "Connexion...\n"
-
-#, fuzzy
-#~ msgid "Connect to the director"
-#~ msgstr "Impossible de se connecter au Director\n"
-
-#, fuzzy
-#~ msgid "Disconnect"
-#~ msgstr "Connexion...\n"
+#~ msgid "%6d %-6s  %-20s %s\n"
+#~ msgstr "%6d %-6s  %-20s %s\n"
 
 #, fuzzy
-#~ msgid "Disconnect of the director"
-#~ msgstr "Impossible de se connecter au Director\n"
+#~ msgid "Unable to read %s. ERR=%s\n"
+#~ msgstr "Impossible d'écrire le marqueur EOF. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Change of configuration file"
-#~ msgstr "La création de la signature a échouée"
+#~ msgid "Unable to write to %s. ERR=%s\n"
+#~ msgstr "Impossible de se connecter à %s sur %s:%d. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Change your default configuration file"
-#~ msgstr "Impossible de lire le certificat à partir du fichier"
+#~ msgid "Unable to get the Full job for %s\n"
+#~ msgstr "Impossible d'écrire le marqueur EOF. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Edit your configuration file"
-#~ msgstr "La création de la signature a échouée"
+#~ msgid "Unable to write to %s to save full job name. ERR=%s\n"
+#~ msgstr "Impossible de se connecter à %s sur %s:%d. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "&File"
-#~ msgstr "FileSet"
+#~ msgid "Unable to %s exitcode=%d\n"
+#~ msgstr "3910 Impossible d'ouvrir le device %s : ERR=%s\n"
 
 #, fuzzy
-#~ msgid "First run"
-#~ msgstr "est en cours"
+#~ msgid "Unable to save last controlfile into file %s. ERR=%s\n"
+#~ msgstr "Impossible de créer le fichier bootstrap %s. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Unable to read configuration file"
-#~ msgstr "Impossible de lire le certificat à partir du fichier"
+#~ msgid "Unable to create  %s "
+#~ msgstr "Impossible d'écrire le marqueur EOF. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Please choose a configuration file to use"
-#~ msgstr "Merci de corriger le fichier de configuration : %s\n"
+#~ msgid "Unable to save last SCN into file %s. ERR=%s\n"
+#~ msgstr "Impossible de créer le fichier bootstrap %s. ERR=%s\n"
 
 #, fuzzy
-#~ msgid ""
-#~ "This configuration file has been successfully read, use it as default?"
-#~ msgstr "Merci de corriger le fichier de configuration : %s\n"
+#~ msgid "Cannot find last control file ret=%d\n"
+#~ msgstr "Impossible de trouver la ressource Console \"%s\"\n"
 
 #, fuzzy
-#~ msgid "Configuration file read successfully"
-#~ msgstr "La création de la signature a échouée"
+#~ msgid "Can't open /etc/oratab. ERR=%s\n"
+#~ msgstr "Impossible d'ouvrir le fichier %s pour lecture. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Using this configuration file: %s\n"
-#~ msgstr "Merci de corriger le fichier de configuration : %s\n"
+#~ msgid "Unable to list schema for %s. exitcode=%d\n"
+#~ msgstr "Impossible d'écrire le marqueur EOF. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Connecting to the director..."
-#~ msgstr "Connexion au Director %s:%d\n"
+#~ msgid "Can't open %s. ERR=%s\n"
+#~ msgstr "Impossible d'ouvrir le fichier %s : ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Please choose your default configuration file"
-#~ msgstr "Merci de corriger le fichier de configuration : %s\n"
+#~ msgid "Error occured while selecting instance.\n"
+#~ msgstr "Entrez le nombre de départ : "
 
 #, fuzzy
-#~ msgid "Use this configuration file as default?"
-#~ msgstr "Merci de corriger le fichier de configuration : %s\n"
+#~ msgid "Job Level not supported.\n"
+#~ msgstr "Job %s non trouvé.\n"
 
 #, fuzzy
-#~ msgid "Configuration file"
-#~ msgstr "La création de la signature a échouée"
+#~ msgid "Calling RMAN for %s\n"
+#~ msgstr "Exécution : %s %s %s\n"
 
 #, fuzzy
-#~ msgid "Console thread terminated."
-#~ msgstr "est terminé"
+#~ msgid "Unable to open %s to save RMAN output. ERR=%s\n"
+#~ msgstr "Impossible de se connecter à %s sur %s:%d. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Connection to the director lost. Quit program?"
-#~ msgstr "Connexion au Director %s:%d\n"
+#~ msgid "Error occured while dumping tempfiles ERR=%s\n"
+#~ msgstr "Entrez le nombre de départ : "
 
 #, fuzzy
-#~ msgid "Connection lost"
-#~ msgstr "Connexion...\n"
+#~ msgid "Error occured while dumping logfiles ERR=%s\n"
+#~ msgstr "Une erreur est survenue à la ligne %d de  \"%s\"\n"
 
 #, fuzzy
-#~ msgid "Connected to the director."
-#~ msgstr "Impossible de se connecter au Director\n"
+#~ msgid ""
+#~ "Unable to copy schema \"%s\" to \"%s\" ret=%d\n"
+#~ "%s\n"
+#~ msgstr "Impossible de se connecter à %s sur %s:%d. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Reconnect"
-#~ msgstr "Connexion...\n"
+#~ msgid "Disable a job"
+#~ msgstr "est bloqué"
 
 #, fuzzy
-#~ msgid "Reconnect to the director"
-#~ msgstr "Impossible de se connecter au Director\n"
+#~ msgid "Failed to initialize database backend\n"
+#~ msgstr "Impossible d'initialiser le contexte TLS pour la Console \"%s\".\n"
 
 #, fuzzy
-#~ msgid "Disconnected of the director."
-#~ msgstr "Impossible de se connecter au Director\n"
-
-#~ msgid ""
-#~ "====\n"
-#~ "\n"
-#~ msgstr ""
-#~ "====\n"
-#~ "\n"
+#~ msgid "disabled"
+#~ msgstr "est bloqué"
 
 #~ msgid "    Drive %d status unknown.\n"
 #~ msgstr "    Le statut du lecteur %d est inconnu.\n"
 
-#~ msgid "    Files=%s Bytes=%s Bytes/sec=%s\n"
-#~ msgstr "    Fichiers=%s Octets=%s Octets/sec=%s\n"
+#, fuzzy
+#~ msgid "Append data error.\n"
+#~ msgstr "Erreur non fatale"
+
+#~ msgid "End of %s %u on device %s, Volume \"%s\"\n"
+#~ msgstr "Fin de %s %u sur le device %s, Volume \"%s\"\n"
 
 #~ msgid "Network buffer size %d not multiple of tape block size.\n"
 #~ msgstr ""
 #~ "La taille du buffer réseau %d n'est pas un multiple de la taille de bloc "
 #~ "du lecteur.\n"
 
-#, fuzzy
-#~ msgid "Plugin load %s failed: ERR=%s\n"
-#~ msgstr "fopen %s en erreur : ERR=%s\n"
+#~ msgid ""
+#~ "Generate VSS snapshot of drive \"%c:\\\" failed. VSS support is disabled "
+#~ "on this drive.\n"
+#~ msgstr ""
+#~ "Erreur lors de la création du snapshot VSS du lecteur \"%c:\\\\\". Le VSS "
+#~ "est désactivé sur ce lecteur.\n"
 
-#, fuzzy
-#~ msgid "VSS Writer (PreRestore): %s\n"
-#~ msgstr "Démarrage du Job de restauration %s\n"
+#~ msgid "Daemon started %s, %d Job%s run since started.\n"
+#~ msgstr "Démon démarré le %s, %d job%s lancés depuis.\n"
 
 #, fuzzy
 #~ msgid ""
@@ -8410,6 +9362,32 @@ msgstr ""
 #~ "http://www.bacula.org/rel-manual/faq.html#AuthorizationErrors\n"
 
 #, fuzzy
+#~ msgid "A dbi driver for DBI must be supplied.\n"
+#~ msgstr "Un nom d'utilisateur MySQL doit être fourni.\n"
+
+#, fuzzy
+#~ msgid "Plugin load %s failed: ERR=%s\n"
+#~ msgstr "fopen %s en erreur : ERR=%s\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "Cancel: %s\n"
+#~ "\n"
+#~ "%s"
+#~ msgstr ""
+#~ "Annule : %s\n"
+#~ "\n"
+#~ "%s"
+
+#~ msgid "Confirm cancel?"
+#~ msgstr "Confirmez l'annulation : "
+
+#~ msgid "Max sched run time exceeded. Job canceled.\n"
+#~ msgstr ""
+#~ "Temps d'exécution maximum depuis la planification atteind. Abandon du "
+#~ "job.\n"
+
+#, fuzzy
 #~ msgid ""
 #~ "Incorrect authorization key from File daemon at %s rejected.\n"
 #~ "Please see http://www.bacula.org/en/rel-manual/Bacula_Freque_Asked_Questi."
@@ -8421,29 +9399,11 @@ msgstr ""
 #~ "http://www.bacula.org/rel-manual/faq.html#AuthorizationErrors\n"
 
 #~ msgid ""
-#~ "Generate VSS snapshot of drive \"%c:\\\" failed. VSS support is disabled "
-#~ "on this drive.\n"
-#~ msgstr ""
-#~ "Erreur lors de la création du snapshot VSS du lecteur « %c:\\\\ ». Le VSS "
-#~ "est désactivé sur ce lecteur.\n"
-
-#~ msgid "Daemon started %s, %d Job%s run since started.\n"
-#~ msgstr "Démon démarré le %s, %d job%s lancés depuis.\n"
-
-#, fuzzy
-#~ msgid "A dbi driver for DBI must be supplied.\n"
-#~ msgstr "Un nom d'utilisateur MySQL doit être fourni.\n"
-
-#~ msgid "Daemon started %s, 1 Job run since started.\n"
-#~ msgstr "Démon démarré depuis %s, 1 job lancé depuis cette date.\n"
-
-#~ msgid "Max sched run time exceeded. Job canceled.\n"
+#~ "====\n"
+#~ "\n"
 #~ msgstr ""
-#~ "Temps d'exécution maximum depuis la planification atteind. Abandon du "
-#~ "job.\n"
-
-#~ msgid "3000 Job %s marked to be canceled.\n"
-#~ msgstr "3000 Job %s marqué pour être annulé.\n"
+#~ "====\n"
+#~ "\n"
 
 #, fuzzy
 #~ msgid "Could not open DVD device %s. No Volume name given.\n"
@@ -8461,7 +9421,7 @@ msgstr ""
 #~ msgstr "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"
 
 #~ msgid "WARNING!!!! The Internal Database is NOT OPERATIONAL!\n"
-#~ msgstr "ATTENTION !!!! La base interne n'est pas OPÉRATIONNELLE !\n"
+#~ msgstr "ATTENTION !!!! La base interne n'est pas OPERATIONNELLE !\n"
 
 #~ msgid "You should use SQLite, PostgreSQL, or MySQL\n"
 #~ msgstr "Vous devez utiliser SQLite, PostgreSQL, ou MySQL\n"
@@ -8530,6 +9490,10 @@ msgstr ""
 #~ msgstr "Pas d'enregistrement trouvé en base pour : %s\n"
 
 #, fuzzy
+#~ msgid "Folder"
+#~ msgstr "FileSet"
+
+#, fuzzy
 #~ msgid "1 file (%s)"
 #~ msgstr "Nouveau Fichier : %s\n"
 
@@ -8622,8 +9586,7 @@ msgstr ""
 #, fuzzy
 #~ msgid "Copyright (c) 2000 - 2004, Kern Sibbald and John Walker"
 #~ msgstr ""
-#~ "Copyright (C) 2000-2005 Kern Sibbald\n"
-#~ "\n"
+#~ "Copyright (C) 2000-2015 Kern Sibbald\n"
 #~ "Version : "
 
 #, fuzzy
@@ -8689,6 +9652,29 @@ msgstr ""
 #~ msgstr "Saisissez le type"
 
 #, fuzzy
+#~ msgid ""
+#~ "\n"
+#~ "Version: %s (%s) %s %s %s\n"
+#~ "\n"
+#~ "Usage: bgnome-console [-s] [-c config_file] [-d debug_level] "
+#~ "[config_file]\n"
+#~ "       -c <file>   set configuration file to file\n"
+#~ "       -dnn        set debug level to nn\n"
+#~ "       -s          no signals\n"
+#~ "       -t          test - read configuration and exit\n"
+#~ "       -?          print this message.\n"
+#~ "\n"
+#~ msgstr ""
+#~ ") %s %s %s\n"
+#~ "\n"
+#~ "Usage : bconsole [-s] [-c config_file] [-d niveau_debug]\n"
+#~ "       -c <file>   set configuration file to file\n"
+#~ "       -dnn        set debug level to nn\n"
+#~ "       -s          no signals\n"
+#~ "       -t          test - lecture de la configuration et sortie\n"
+#~ "\n"
+
+#, fuzzy
 #~ msgid "Pthread cond init error = %s\n"
 #~ msgstr "Erreur pendant l'écriture des attributs dans le spool. ERR=%s\n"
 
@@ -8809,7 +9795,7 @@ msgstr ""
 #~ "JobName     : %s\n"
 #~ "Bootstrap   : %s\n"
 #~ "Destination : %s\n"
-#~ "Écrasement  : %s\n"
+#~ "Ecrasement  : %s\n"
 #~ "Client      : %s\n"
 #~ "Storage     : %s\n"
 #~ "JobId       : %s\n"
@@ -8904,10 +9890,6 @@ msgstr ""
 #~ msgid "Bacula Usage"
 #~ msgstr "Message de Bacula"
 
-#, fuzzy
-#~ msgid "Unable to get Volume record: ERR=%s"
-#~ msgstr "Impossible de mettre à jour les informations du Volume : ERR=%s"
-
 #~ msgid "Unable to update Volume record: ERR=%s"
 #~ msgstr "Impossible de mettre à jour les informations du Volume : ERR=%s"
 
@@ -8930,9 +9912,6 @@ msgstr ""
 #~ "Merci de monter le Volume \"%s\" sur le Storage Device \"%s\" pour le Job "
 #~ "%s\n"
 
-#~ msgid "Job %s not found.\n"
-#~ msgstr "Job %s non trouvé.\n"
-
 #~ msgid "%s Version: %s (%s)\n"
 #~ msgstr "%s Version : %s (%s)\n"
 
@@ -8973,7 +9952,7 @@ msgstr ""
 #~ "JobName     : %s\n"
 #~ "Bootstrap   : %s\n"
 #~ "Destination : %s\n"
-#~ "Écrasement  : %s\n"
+#~ "Ecrasement  : %s\n"
 #~ "FileSet     : %s\n"
 #~ "Client      : %s\n"
 #~ "Storage     : %s\n"
@@ -9016,8 +9995,7 @@ msgstr ""
 #~ "       -?          print this message.\n"
 #~ "\n"
 #~ msgstr ""
-#~ "Copyright (C) 2000-2005 Kern Sibbald.\n"
-#~ "\n"
+#~ "Copyright (C) 2000-2015 Kern Sibbald\n"
 #~ "Version : %s (%s)\n"
 #~ "\n"
 #~ "Usage : dird [-f -s] [-c config_file] [-d debug_level] [config_file]\n"
@@ -9037,12 +10015,9 @@ msgstr ""
 #~ msgstr "Impossible d'écrire au bloc %u.\n"
 
 #, fuzzy
-#~ msgid ""
-#~ "Copyright (C) 2004-2006 Kern Sibbald\n"
-#~ "Written by Nicolas Boichat\n"
+#~ msgid "Copyright (C) 2000-2015 Kern SibbaldWritten by Nicolas Boichat\n"
 #~ msgstr ""
-#~ "Copyright (C) 2000-2005 Kern Sibbald\n"
-#~ "\n"
+#~ "Copyright (C) 2000-2015 Kern Sibbald\n"
 #~ "Version : "
 
 #~ msgid "Using default Catalog name=%s DB=%s\n"
diff --git a/po/it.po b/po/it.po
index 4350b55..41ed2b2 100644
--- a/po/it.po
+++ b/po/it.po
@@ -1,11 +1,12 @@
 # Italian translations for Bacula package
 # Traduzioni italiane per il pacchetto Bacula..
-# Copyright (C) 2005-2014 Free Software Foundation Europe e.V.
+# Copyright 2000-2015, Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #  <fparacchini at alteanet.it>, 2005.
-#
+# License: BSD 2-Clause; see file LICENSE-FOSS
 msgid ""
 msgstr ""
-"Project-Id-Version: Bacula 5.28\n"
+"Project-Id-Version: Bacula 1.38\n"
 "Report-Msgid-Bugs-To: bacula-devel at lists.sourceforge.net\n"
 "POT-Creation-Date: 2007-08-10 23:23+0200\n"
 "PO-Revision-Date: 2005-08-08 17:50+0200\n"
@@ -609,6 +610,7 @@ msgid ""
 msgstr ""
 
 #: src/dird/authenticate.c:80 src/dird/authenticate.c:81
+#: src/tray-monitor/authenticate.c:132
 #, c-format
 msgid "Error sending Hello to Storage daemon. ERR=%s\n"
 msgstr ""
@@ -631,7 +633,7 @@ msgstr ""
 
 #: src/dird/authenticate.c:120 src/console/authenticate.c:114
 #: src/filed/authenticate.c:251 src/stored/authenticate.c:131
-#: src/stored/authenticate.c:232
+#: src/stored/authenticate.c:232 src/wx-console/authenticate.c:127
 msgid ""
 "Authorization problem: Remote server did not advertise required TLS "
 "support.\n"
@@ -640,6 +642,7 @@ msgstr ""
 #: src/dird/authenticate.c:127 src/console/authenticate.c:121
 #: src/filed/authenticate.c:147 src/filed/authenticate.c:259
 #: src/stored/authenticate.c:139 src/stored/authenticate.c:240
+#: src/wx-console/authenticate.c:133
 msgid "Authorization problem: Remote server requires TLS.\n"
 msgstr ""
 
@@ -653,7 +656,7 @@ msgstr ""
 msgid "bdird<stored: \"%s:%s\" bad response to Hello command: ERR=%s\n"
 msgstr ""
 
-#: src/dird/authenticate.c:152
+#: src/dird/authenticate.c:152 src/tray-monitor/authenticate.c:152
 msgid "Storage daemon rejected Hello command\n"
 msgstr ""
 
@@ -698,7 +701,7 @@ msgstr ""
 msgid "TLS negotiation failed with FD at \"%s:%d\".\n"
 msgstr ""
 
-#: src/dird/authenticate.c:250
+#: src/dird/authenticate.c:250 src/tray-monitor/authenticate.c:191
 #, c-format
 msgid "Bad response from File daemon to Hello command: ERR=%s\n"
 msgstr ""
@@ -708,7 +711,7 @@ msgstr ""
 msgid "Bad response from File daemon at \"%s:%d\" to Hello command: ERR=%s\n"
 msgstr ""
 
-#: src/dird/authenticate.c:259
+#: src/dird/authenticate.c:259 src/tray-monitor/authenticate.c:198
 msgid "File daemon rejected Hello command\n"
 msgstr ""
 
@@ -1035,13 +1038,13 @@ msgid ""
 msgstr ""
 
 #: src/dird/dird.c:224 src/console/console.c:426 src/filed/filed.c:182
-#: src/stored/stored.c:210
+#: src/gnome2-console/console.c:286 src/stored/stored.c:210
 msgid "Cryptography library initialization failed.\n"
 msgstr ""
 
 #: src/dird/dird.c:228 src/dird/dird.c:234 src/dird/dird.c:474
 #: src/dird/dird.c:477 src/console/console.c:430 src/filed/filed.c:187
-#: src/stored/stored.c:214
+#: src/gnome2-console/console.c:290 src/stored/stored.c:214
 #, c-format
 msgid "Please correct configuration file: %s\n"
 msgstr ""
@@ -1078,7 +1081,9 @@ msgstr ""
 #: src/dird/dird.c:563 src/dird/dird.c:764 src/dird/dird.c:816
 #: src/dird/dird.c:920 src/console/console.c:657 src/console/console.c:686
 #: src/filed/filed.c:288 src/filed/filed.c:446
-#: src/stored/stored.c:332
+#: src/gnome2-console/console.c:153 src/gnome2-console/console.c:182
+#: src/stored/stored.c:332 src/wx-console/console_thread.cpp:114
+#: src/wx-console/console_thread.cpp:140
 msgid "TLS required but not configured in Bacula.\n"
 msgstr ""
 
@@ -1181,7 +1186,7 @@ msgstr ""
 msgid "Failed to initialize TLS context for Storage \"%s\" in %s.\n"
 msgstr ""
 
-#: src/dird/dird_conf.c:508
+#: src/dird/dird_conf.c:508 src/tray-monitor/tray_conf.c:168
 #, c-format
 msgid "No %s resource defined\n"
 msgstr ""
@@ -1455,24 +1460,26 @@ msgstr ""
 msgid "      opcmd=%s\n"
 msgstr ""
 
-#: src/dird/dird_conf.c:893
+#: src/dird/dird_conf.c:893 src/tray-monitor/tray_conf.c:199
 #, c-format
 msgid "Unknown resource type %d in dump_resource.\n"
 msgstr ""
 
-#: src/dird/dird_conf.c:1199
+#: src/dird/dird_conf.c:1199 src/tray-monitor/tray_conf.c:257
 #, c-format
 msgid "Unknown resource type %d in free_resource.\n"
 msgstr ""
 
 #: src/dird/dird_conf.c:1231 src/dird/dird_conf.c:1246
 #: src/dird/dird_conf.c:1842 src/console/console_conf.c:257
-#: src/filed/filed_conf.c:347
+#: src/filed/filed_conf.c:347 src/gnome2-console/console_conf.c:258
+#: src/tray-monitor/tray_conf.c:288 src/wx-console/console_conf.c:265
 #, c-format
 msgid "%s item is required in %s resource, but not found.\n"
 msgstr ""
 
 #: src/dird/dird_conf.c:1237 src/lib/parse_conf.c:234
+#: src/tray-monitor/tray_conf.c:294
 #, c-format
 msgid "Too many items in %s resource\n"
 msgstr ""
@@ -1519,6 +1526,7 @@ msgid "Cannot find Schedule resource %s\n"
 msgstr ""
 
 #: src/dird/dird_conf.c:1383 src/dird/dird_conf.c:1443
+#: src/tray-monitor/tray_conf.c:314 src/tray-monitor/tray_conf.c:352
 #, c-format
 msgid "Unknown resource type %d in save_resource.\n"
 msgstr ""
@@ -1529,7 +1537,8 @@ msgid "Name item is required in %s resource, but not found.\n"
 msgstr ""
 
 #: src/dird/dird_conf.c:1466 src/console/console_conf.c:320
-#: src/filed/filed_conf.c:432
+#: src/filed/filed_conf.c:432 src/gnome2-console/console_conf.c:327
+#: src/tray-monitor/tray_conf.c:372 src/wx-console/console_conf.c:328
 #, c-format
 msgid "Attempt to define second %s resource named \"%s\" is not permitted.\n"
 msgstr ""
@@ -1626,7 +1635,7 @@ msgstr ""
 msgid "Cannot destroy var context: ERR=%s\n"
 msgstr ""
 
-#: src/dird/fd_cmds.c:94
+#: src/dird/fd_cmds.c:94 src/tray-monitor/tray-monitor.c:914
 msgid "File daemon"
 msgstr ""
 
@@ -2221,6 +2230,7 @@ msgid "Storage from Pool's NextPool resource"
 msgstr ""
 
 #: src/dird/msgchan.c:106 src/filed/job.c:1301
+#: src/tray-monitor/tray-monitor.c:921
 msgid "Storage daemon"
 msgstr ""
 
@@ -2955,12 +2965,33 @@ msgid "Director"
 msgstr ""
 
 #: src/dird/ua_cmds.c:998 src/dird/ua_dotcmds.c:284 src/dird/ua_run.c:265
-#: src/dird/ua_select.c:168
+#: src/dird/ua_select.c:168 src/wx-console/wxbrestorepanel.cpp:339
+#: src/wx-console/wxbrestorepanel.cpp:355
+#: src/wx-console/wxbrestorepanel.cpp:479
+#: src/wx-console/wxbrestorepanel.cpp:480
+#: src/wx-console/wxbrestorepanel.cpp:490
+#: src/wx-console/wxbrestorepanel.cpp:491
+#: src/wx-console/wxbrestorepanel.cpp:1154
+#: src/wx-console/wxbrestorepanel.cpp:1818
+#: src/wx-console/wxbrestorepanel.cpp:1889
 msgid "Storage"
 msgstr ""
 
 #: src/dird/ua_cmds.c:999 src/dird/ua_dotcmds.c:285 src/dird/ua_run.c:271
 #: src/dird/ua_select.c:311 src/dird/ua_select.c:420
+#: src/wx-console/wxbrestorepanel.cpp:336
+#: src/wx-console/wxbrestorepanel.cpp:354
+#: src/wx-console/wxbrestorepanel.cpp:431
+#: src/wx-console/wxbrestorepanel.cpp:432
+#: src/wx-console/wxbrestorepanel.cpp:442
+#: src/wx-console/wxbrestorepanel.cpp:443
+#: src/wx-console/wxbrestorepanel.cpp:690
+#: src/wx-console/wxbrestorepanel.cpp:1124
+#: src/wx-console/wxbrestorepanel.cpp:1211
+#: src/wx-console/wxbrestorepanel.cpp:1811
+#: src/wx-console/wxbrestorepanel.cpp:1813
+#: src/wx-console/wxbrestorepanel.cpp:1887
+#: src/wx-console/wxbrestorepanel.cpp:1943
 msgid "Client"
 msgstr ""
 
@@ -3674,7 +3705,7 @@ msgid "Enter a list of directories to restore for found JobIds"
 msgstr ""
 
 #: src/dird/ua_restore.c:418 src/dird/ua_status.c:760 src/filed/status.c:256
-#: src/stored/status.c:521
+#: src/stored/status.c:521 src/wx-console/wxbconfigpanel.cpp:212
 msgid "Cancel"
 msgstr ""
 
@@ -3968,16 +3999,23 @@ msgstr ""
 msgid "Restore Client"
 msgstr ""
 
-#: src/dird/ua_run.c:273
+#: src/dird/ua_run.c:273 src/wx-console/wxbrestorepanel.cpp:356
+#: src/wx-console/wxbrestorepanel.cpp:844
+#: src/wx-console/wxbrestorepanel.cpp:1891
 msgid "When"
 msgstr ""
 
-#: src/dird/ua_run.c:274
+#: src/dird/ua_run.c:274 src/wx-console/wxbrestorepanel.cpp:357
+#: src/wx-console/wxbrestorepanel.cpp:1117
+#: src/wx-console/wxbrestorepanel.cpp:1894
 msgid "Priority"
 msgstr ""
 
 #: src/dird/ua_run.c:278 src/dird/ua_select.c:506 src/dird/ua_select.c:596
-#: src/dird/ua_update.c:529
+#: src/dird/ua_update.c:529 src/wx-console/wxbrestorepanel.cpp:338
+#: src/wx-console/wxbrestorepanel.cpp:527
+#: src/wx-console/wxbrestorepanel.cpp:537
+#: src/wx-console/wxbrestorepanel.cpp:1807
 msgid "Pool"
 msgstr ""
 
@@ -3985,11 +4023,14 @@ msgstr ""
 msgid "Verify Job"
 msgstr ""
 
-#: src/dird/ua_run.c:283
+#: src/dird/ua_run.c:283 src/wx-console/wxbrestorepanel.cpp:349
+#: src/wx-console/wxbrestorepanel.cpp:1872
 msgid "Bootstrap"
 msgstr ""
 
-#: src/dird/ua_run.c:284
+#: src/dird/ua_run.c:284 src/wx-console/wxbrestorepanel.cpp:350
+#: src/wx-console/wxbrestorepanel.cpp:1093
+#: src/wx-console/wxbrestorepanel.cpp:1874
 msgid "Where"
 msgstr ""
 
@@ -3997,7 +4038,13 @@ msgstr ""
 msgid "File Relocation"
 msgstr ""
 
-#: src/dird/ua_run.c:286
+#: src/dird/ua_run.c:286 src/wx-console/wxbrestorepanel.cpp:352
+#: src/wx-console/wxbrestorepanel.cpp:1101
+#: src/wx-console/wxbrestorepanel.cpp:1878
+#: src/wx-console/wxbrestorepanel.cpp:1879
+#: src/wx-console/wxbrestorepanel.cpp:1880
+#: src/wx-console/wxbrestorepanel.cpp:1881
+#: src/wx-console/wxbrestorepanel.cpp:1882
 msgid "Replace"
 msgstr ""
 
@@ -4974,6 +5021,7 @@ msgstr ""
 
 #: src/dird/ua_status.c:763 src/filed/status.c:259 src/lib/util.c:188
 #: src/lib/util.c:255 src/stored/btape.c:1189 src/stored/status.c:524
+#: src/wx-console/wxbconfigpanel.cpp:201
 msgid "OK"
 msgstr ""
 
@@ -5742,20 +5790,22 @@ msgstr ""
 msgid "File: %s\n"
 msgstr ""
 
-#: src/console/authenticate.c:131
+#: src/console/authenticate.c:131 src/wx-console/authenticate.c:142
 msgid "TLS negotiation failed\n"
 msgstr ""
 
-#: src/console/authenticate.c:143
+#: src/console/authenticate.c:143 src/gnome2-console/authenticate.c:98
+#: src/tray-monitor/authenticate.c:97
 #, c-format
 msgid "Bad response to Hello command: ERR=%s\n"
 msgstr ""
 
-#: src/console/authenticate.c:150
+#: src/console/authenticate.c:150 src/gnome2-console/authenticate.c:108
+#: src/tray-monitor/authenticate.c:104 src/wx-console/authenticate.c:157
 msgid "Director rejected Hello command\n"
 msgstr ""
 
-#: src/console/authenticate.c:160
+#: src/console/authenticate.c:160 src/wx-console/authenticate.c:167
 msgid ""
 "Director authorization problem.\n"
 "Most likely the passwords do not agree.\n"
@@ -5846,15 +5896,48 @@ msgstr ""
 msgid "You must enter a number between 1 and %d\n"
 msgstr ""
 
-#: src/console/console.c:521
+#: src/console/console.c:521 src/tray-monitor/tray-monitor.c:905
 #, c-format
 msgid "Connecting to Director %s:%d\n"
 msgstr ""
 
+#: src/console/console.c:538 src/gnome2-console/console.c:526
+#: src/wx-console/console_thread.cpp:391
+#, c-format
+msgid "Failed to initialize TLS context for Console \"%s\".\n"
+msgstr ""
+
+#: src/console/console.c:558 src/gnome2-console/console.c:548
+#: src/wx-console/console_thread.cpp:412
+#, c-format
+msgid "Failed to initialize TLS context for Director \"%s\".\n"
+msgstr ""
+
 #: src/console/console.c:588
 msgid "Enter a period to cancel a command.\n"
 msgstr ""
 
+#: src/console/console.c:664 src/gnome2-console/console.c:160
+#, c-format
+msgid ""
+"Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined for "
+"Director \"%s\" in %s. At least one CA certificate store is required.\n"
+msgstr ""
+
+#: src/console/console.c:673 src/gnome2-console/console.c:169
+#, c-format
+msgid ""
+"No Director resource defined in %s\n"
+"Without that I don't how to speak to the Director :-(\n"
+msgstr ""
+
+#: src/console/console.c:693 src/gnome2-console/console.c:189
+#, c-format
+msgid ""
+"Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined for "
+"Console \"%s\" in %s.\n"
+msgstr ""
+
 #: src/console/console.c:849
 msgid "Too many arguments on input command.\n"
 msgstr ""
@@ -5891,21 +5974,32 @@ msgstr ""
 msgid "Autochanger error: ERR=%s\n"
 msgstr ""
 
-#: src/console/console_conf.c:138
+#: src/console/console_conf.c:138 src/gnome2-console/console_conf.c:134
+#: src/wx-console/console_conf.c:147
 #, c-format
 msgid "No record for %d %s\n"
 msgstr ""
 
-#: src/console/console_conf.c:147
+#: src/console/console_conf.c:147 src/wx-console/console_conf.c:156
 #, c-format
 msgid "Console: name=%s rcfile=%s histfile=%s\n"
 msgstr ""
 
+#: src/console/console_conf.c:151 src/gnome2-console/console_conf.c:143
+#: src/wx-console/console_conf.c:160
+#, c-format
+msgid "Director: name=%s address=%s DIRport=%d\n"
+msgstr ""
+
 #: src/console/console_conf.c:155 src/console/console_conf.c:231
 #: src/console/console_conf.c:276 src/console/console_conf.c:303
 #: src/filed/filed_conf.c:319 src/filed/filed_conf.c:384
-#: src/filed/filed_conf.c:414 src/stored/stored_conf.c:528
+#: src/filed/filed_conf.c:414 src/gnome2-console/console_conf.c:154
+#: src/gnome2-console/console_conf.c:232 src/gnome2-console/console_conf.c:280
+#: src/gnome2-console/console_conf.c:310 src/stored/stored_conf.c:528
 #: src/stored/stored_conf.c:616 src/stored/stored_conf.c:651
+#: src/wx-console/console_conf.c:164 src/wx-console/console_conf.c:239
+#: src/wx-console/console_conf.c:284 src/wx-console/console_conf.c:311
 #, c-format
 msgid "Unknown resource type %d\n"
 msgstr ""
@@ -7196,10 +7290,345 @@ msgstr ""
 msgid "Cannot return to saved working directory: %s\n"
 msgstr ""
 
-#: src/lib/util.c:293
+#: src/gnome2-console/authenticate.c:87
+#, c-format
+msgid "%s: Director authorization problem.\n"
+msgstr ""
+
+#: src/gnome2-console/authenticate.c:88
+msgid "Director authorization problem.\n"
+msgstr ""
+
+#: src/gnome2-console/authenticate.c:90
+msgid ""
+"Please see http://www.bacula.org/rel-manual/faq.html#AuthorizationErrors for "
+"help.\n"
+msgstr ""
+
+#: src/gnome2-console/authenticate.c:100
+#, c-format
+msgid "%s: Bad response to Hello command: ERR=%s\n"
+msgstr ""
+
+#: src/gnome2-console/authenticate.c:102
+msgid "The Director is probably not running.\n"
+msgstr ""
+
+#: src/gnome2-console/console.c:102
+#, c-format
+msgid ""
+"\n"
+"Version: %s (%s) %s %s %s\n"
+"\n"
+"Usage: bgnome-console [-s] [-c config_file] [-d debug_level] [config_file]\n"
+"       -c <file>   set configuration file to file\n"
+"       -dnn        set debug level to nn\n"
+"       -s          no signals\n"
+"       -t          test - read configuration and exit\n"
+"       -?          print this message.\n"
+"\n"
+msgstr ""
+
+#: src/gnome2-console/console.c:234
+#, c-format
+msgid "Pthread cond init error = %s\n"
+msgstr ""
+
+#: src/gnome2-console/console.c:379
+msgid " Not Connected"
+msgstr ""
+
+#: src/gnome2-console/console.c:500
+#, c-format
+msgid " Connecting to Director %s:%d"
+msgstr ""
+
+#: src/gnome2-console/console.c:501
+#, c-format
+msgid ""
+"Connecting to Director %s:%d\n"
+"\n"
+msgstr ""
+
+#: src/gnome2-console/console.c:516 src/wx-console/console_thread.cpp:381
+#, c-format
+msgid "Passphrase for Console \"%s\" TLS private key: "
+msgstr ""
+
+#: src/gnome2-console/console.c:538 src/wx-console/console_thread.cpp:402
+#, c-format
+msgid "Passphrase for Director \"%s\" TLS private key: "
+msgstr ""
+
+#: src/gnome2-console/console.c:557 src/tray-monitor/tray-monitor.c:907
+#: src/wx-console/console_thread.cpp:420
+msgid "Director daemon"
+msgstr ""
+
+#: src/gnome2-console/console.c:569
+msgid " Initializing ..."
+msgstr ""
+
+#: src/gnome2-console/console.c:605
+msgid " Connected"
+msgstr ""
+
+#: src/gnome2-console/console.c:613
+msgid " Processing command ..."
+msgstr ""
+
+#: src/gnome2-console/console.c:648
+msgid " At prompt waiting for input ..."
+msgstr ""
+
+#: src/gnome2-console/console.c:768
+msgid " Ready"
+msgstr ""
+
+#: src/gnome2-console/console_conf.c:147
+#, c-format
+msgid "Console: name=%s\n"
+msgstr ""
+
+#: src/gnome2-console/console_conf.c:150 src/tray-monitor/tray_conf.c:195
+#, c-format
+msgid "ConsoleFont: name=%s font face=%s\n"
+msgstr ""
+
+#: src/gnome2-console/interface.c:202
+msgid "Bacula Console"
+msgstr ""
+
+#: src/gnome2-console/interface.c:235 src/wx-console/wxbmainframe.cpp:248
+#: src/wx-console/wxbmainframe.cpp:619
+msgid "Connect"
+msgstr ""
+
+#: src/gnome2-console/interface.c:238
+msgid "Connect to Director"
+msgstr ""
+
+#: src/gnome2-console/interface.c:242
+msgid "Run"
+msgstr ""
+
+#: src/gnome2-console/interface.c:245 src/gnome2-console/interface.c:682
+#: src/gnome2-console/interface.c:696
+msgid "Run a Job"
+msgstr ""
+
+#: src/gnome2-console/interface.c:249
+msgid "Dir Status"
+msgstr ""
+
+#: src/gnome2-console/interface.c:255 src/lib/util.c:293
+#: src/wx-console/wxbrestorepanel.cpp:404
+#: src/wx-console/wxbrestorepanel.cpp:1974
 msgid "Restore"
 msgstr ""
 
+#: src/gnome2-console/interface.c:261
+msgid "Label"
+msgstr ""
+
+#: src/gnome2-console/interface.c:267
+msgid "Msgs"
+msgstr ""
+
+#: src/gnome2-console/interface.c:270
+msgid "Display Messages"
+msgstr ""
+
+#: src/gnome2-console/interface.c:294
+msgid " Command: "
+msgstr ""
+
+#: src/gnome2-console/interface.c:303
+msgid "Enter Commands Here"
+msgstr ""
+
+#: src/gnome2-console/interface.c:314
+msgid " Status: "
+msgstr ""
+
+#: src/gnome2-console/interface.c:323 src/gnome2-console/interface.c:1709
+msgid "  "
+msgstr ""
+
+#: src/gnome2-console/interface.c:424
+msgid "About Bacula Console"
+msgstr ""
+
+#: src/gnome2-console/interface.c:439
+msgid "Bacula Console\n"
+msgstr ""
+
+#: src/gnome2-console/interface.c:448
+msgid "Copyright (c) 2000 - 2004, Kern Sibbald and John Walker"
+msgstr ""
+
+#: src/gnome2-console/interface.c:453
+msgid "Authors: Kern Sibbald and John Walker"
+msgstr ""
+
+#: src/gnome2-console/interface.c:458
+msgid "The Leading Open Source Backup Solution."
+msgstr ""
+
+#: src/gnome2-console/interface.c:523 src/gnome2-console/interface.c:540
+msgid "Select Director"
+msgstr ""
+
+#: src/gnome2-console/interface.c:570
+msgid "         "
+msgstr ""
+
+#: src/gnome2-console/interface.c:715 src/gnome2-console/interface.c:1631
+msgid "Job:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:736
+msgid "   Type:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:756 src/gnome2-console/interface.c:785
+#: src/gnome2-console/interface.c:1284 src/gnome2-console/interface.c:1680
+msgid " "
+msgstr ""
+
+#: src/gnome2-console/interface.c:765 src/gnome2-console/interface.c:1660
+#: src/wx-console/wxbrestorepanel.cpp:1886
+msgid "Client:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:795 src/gnome2-console/interface.c:1689
+msgid "FileSet: "
+msgstr ""
+
+#: src/gnome2-console/interface.c:820 src/wx-console/wxbrestorepanel.cpp:1893
+msgid "Priority:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:836
+msgid "Level:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:857
+msgid "             "
+msgstr ""
+
+#: src/gnome2-console/interface.c:867 src/gnome2-console/interface.c:1433
+#: src/gnome2-console/interface.c:1718
+msgid "Pool:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:888 src/gnome2-console/interface.c:919
+#: src/gnome2-console/interface.c:949 src/gnome2-console/interface.c:969
+#: src/gnome2-console/interface.c:989 src/gnome2-console/interface.c:1009
+#: src/gnome2-console/interface.c:1014 src/gnome2-console/interface.c:1483
+#: src/gnome2-console/interface.c:1739 src/gnome2-console/interface.c:1769
+#: src/gnome2-console/interface.c:1788 src/gnome2-console/interface.c:1793
+msgid "   "
+msgstr ""
+
+#: src/gnome2-console/interface.c:898 src/gnome2-console/interface.c:1407
+#: src/gnome2-console/interface.c:1748 src/wx-console/wxbrestorepanel.cpp:1888
+msgid "Storage:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:929
+msgid "Messages:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:959
+msgid "Where: "
+msgstr ""
+
+#: src/gnome2-console/interface.c:979 src/wx-console/wxbrestorepanel.cpp:1890
+msgid "When:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:999 src/wx-console/wxbrestorepanel.cpp:1871
+msgid "Bootstrap:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:1194
+msgid "Restore File Selection"
+msgstr ""
+
+#: src/gnome2-console/interface.c:1238
+msgid "Current dir:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:1265
+msgid "Files Selected: "
+msgstr ""
+
+#: src/gnome2-console/interface.c:1385 src/gnome2-console/interface.c:1396
+msgid "Label a Volume"
+msgstr ""
+
+#: src/gnome2-console/interface.c:1458
+msgid "Volume Name:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:1472
+msgid "Slot:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:1598
+msgid "Restore Files Dialog"
+msgstr ""
+
+#: src/gnome2-console/interface.c:1613
+msgid "Restore Files"
+msgstr ""
+
+#: src/gnome2-console/interface.c:1778
+msgid "Before:"
+msgstr ""
+
+#: src/gnome2-console/interface.c:1824
+msgid "Select Files"
+msgstr ""
+
+#: src/gnome2-console/interface.c:1907
+msgid "Progress"
+msgstr ""
+
+#: src/gnome2-console/restore.c:149
+msgid "Mark"
+msgstr ""
+
+#: src/gnome2-console/restore.c:149
+msgid "File"
+msgstr ""
+
+#: src/gnome2-console/restore.c:149
+msgid "Mode"
+msgstr ""
+
+#: src/gnome2-console/restore.c:149 src/wx-console/wxbrestorepanel.cpp:306
+msgid "User"
+msgstr ""
+
+#: src/gnome2-console/restore.c:149 src/wx-console/wxbrestorepanel.cpp:310
+msgid "Group"
+msgstr ""
+
+#: src/gnome2-console/restore.c:149 src/wx-console/wxbrestorepanel.cpp:294
+msgid "Size"
+msgstr ""
+
+#: src/gnome2-console/restore.c:149 src/wx-console/wxbrestorepanel.cpp:298
+msgid "Date"
+msgstr ""
+
+#: src/gnome2-console/support.c:60 src/gnome2-console/support.c:85
+#, c-format
+msgid "Couldn't find pixmap file: %s"
+msgstr ""
+
 #: src/lib/address_conf.c:63
 #, c-format
 msgid "Only ipv4 and ipv6 are supported (%d)\n"
@@ -7812,11 +8241,20 @@ msgid ""
 "Watchdog sending kill after %d secs to thread stalled reading Director.\n"
 msgstr ""
 
-#: src/lib/lex.c:93
+#: src/lib/lex.c:93 src/wx-console/console_thread.cpp:208
 #, c-format
 msgid "Problem probably begins at line %d.\n"
 msgstr ""
 
+#: src/lib/lex.c:98 src/wx-console/console_thread.cpp:213
+#, c-format
+msgid ""
+"Config error: %s\n"
+"            : line %d, col %d of file %s\n"
+"%s\n"
+"%s"
+msgstr ""
+
 #: src/lib/lex.c:102
 #, c-format
 msgid "Config error: %s\n"
@@ -8792,7 +9230,7 @@ msgstr ""
 msgid "Copy"
 msgstr ""
 
-#: src/lib/util.c:305
+#: src/lib/util.c:305 src/wx-console/wxbmainframe.cpp:276
 msgid "Console"
 msgstr ""
 
@@ -14103,50 +14541,432 @@ msgstr ""
 msgid "Skip: File system change prohibited. Directory not entered. %s\n"
 msgstr ""
 
-#: src/baconfig.h:72
-#, c-format
-msgid "Failed ASSERT: %s\n"
+#: src/tray-monitor/authenticate.c:88
+msgid ""
+"Director authorization problem.\n"
+"Most likely the passwords do not agree.\n"
+"Please see http://www.bacula.org/rel-manual/faq.html#AuthorizationErrors for "
+"help.\n"
 msgstr ""
 
-#: src/baconfig.h:79
-msgid "*None*"
+#: src/tray-monitor/authenticate.c:138
+msgid ""
+"Director and Storage daemon passwords or names not the same.\n"
+"Please see http://www.bacula.org/rel-manual/faq.html#AuthorizationErrors for "
+"help.\n"
 msgstr ""
 
-#: src/win32/dird/winmain.cpp:193 src/win32/dird/winmain.cpp:200
-#: src/win32/filed/winmain.cpp:224 src/win32/filed/winmain.cpp:231
-#: src/win32/stored/baculasd/winmain.cpp:225
-#: src/win32/stored/baculasd/winmain.cpp:232
-msgid "Bacula Usage"
+#: src/tray-monitor/authenticate.c:145
+#, c-format
+msgid "bdird<stored: bad response to Hello command: ERR=%s\n"
 msgstr ""
 
-#: src/win32/dird/winmain.cpp:197 src/win32/filed/winmain.cpp:228
-#: src/win32/stored/baculasd/winmain.cpp:229
-msgid "Bad Command Line Options"
+#: src/tray-monitor/authenticate.c:178
+#, c-format
+msgid "Error sending Hello to File daemon. ERR=%s\n"
 msgstr ""
 
-#: src/win32/dird/winservice.cpp:119 src/win32/filed/winservice.cpp:238
-#: src/win32/stored/baculasd/winservice.cpp:169
-msgid "StartServiceCtrlDispatcher failed."
+#: src/tray-monitor/authenticate.c:184
+msgid ""
+"Director and File daemon passwords or names not the same.\n"
+"Please see http://www.bacula.org/rel-manual/faq.html#AuthorizationErrors for "
+"help.\n"
 msgstr ""
 
-#: src/win32/dird/winservice.cpp:135 src/win32/filed/winservice.cpp:256
-#: src/win32/stored/baculasd/winservice.cpp:185
-msgid "RegisterServiceCtlHandler failed"
+#: src/tray-monitor/tray-monitor.c:113
+#, c-format
+msgid ""
+"Written by Nicolas Boichat (2004)\n"
+"\n"
+"Version: %s (%s) %s %s %s\n"
+"\n"
+"Usage: tray-monitor [-c config_file] [-d debug_level]\n"
+"       -c <file>     set configuration file to file\n"
+"       -dnn          set debug level to nn\n"
+"       -t            test - read configuration and exit\n"
+"       -?            print this message.\n"
+"\n"
 msgstr ""
 
-#: src/win32/dird/winservice.cpp:136 src/win32/filed/winservice.cpp:257
-#: src/win32/stored/baculasd/winservice.cpp:186
-msgid "Contact Register Service Handler failure"
+#: src/tray-monitor/tray-monitor.c:262
+#, c-format
+msgid ""
+"Error: %d Monitor resources defined in %s. You must define one and only one "
+"Monitor resource.\n"
 msgstr ""
 
-#: src/win32/dird/winservice.cpp:152 src/win32/filed/winservice.cpp:273
-#: src/win32/stored/baculasd/winservice.cpp:202
-msgid "ReportStatus STOPPED failed 1"
+#: src/tray-monitor/tray-monitor.c:293
+#, c-format
+msgid ""
+"No Client, Storage or Director resource defined in %s\n"
+"Without that I don't how to get status from the File, Storage or Director "
+"Daemon :-(\n"
 msgstr ""
 
-#: src/win32/dird/winservice.cpp:175 src/win32/filed/winservice.cpp:296
-#: src/win32/stored/baculasd/winservice.cpp:225
-msgid "Report Service failure"
+#: src/tray-monitor/tray-monitor.c:315
+#, c-format
+msgid ""
+"Invalid refresh interval defined in %s\n"
+"This value must be greater or equal to 1 second and less or equal to 10 "
+"minutes (read value: %d).\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:330
+msgid "Open status window..."
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:336
+msgid "Exit"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:348
+msgid "Bacula tray monitor"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:373
+msgid " (DIR)"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:377
+msgid " (FD)"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:381
+msgid " (SD)"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:394
+msgid "Unknown status."
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:464
+msgid "Refresh interval in seconds: "
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:472
+msgid "Refresh now"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:476
+msgid "About"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:480
+msgid "Close"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:500
+#, c-format
+msgid "Disconnecting from Director %s:%d\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:503
+#, c-format
+msgid "Disconnecting from Client %s:%d\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:506
+#, c-format
+msgid "Disconnecting from Storage %s:%d\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:543 src/tray-monitor/tray-monitor.c:554
+msgid "Bacula Tray Monitor"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:545 src/tray-monitor/tray-monitor.c:556
+msgid "Written by Nicolas Boichat\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:546 src/tray-monitor/tray-monitor.c:557
+msgid "Version"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:625
+#, c-format
+msgid "Error, currentitem is not a Client or a Storage..\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:699
+#, c-format
+msgid ""
+"Current job: %s\n"
+"Last job: %s"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:711
+#, c-format
+msgid " (%d errors)"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:714
+#, c-format
+msgid " (%d error)"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:752
+msgid "No current job."
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:755
+msgid "No last job."
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:763
+msgid "Job status: Created"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:768
+msgid "Job status: Running"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:772
+msgid "Job status: Blocked"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:777
+msgid "Job status: Terminated"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:782
+msgid "Job status: Terminated in error"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:788
+msgid "Job status: Error"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:792
+msgid "Job status: Fatal error"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:797
+msgid "Job status: Verify differences"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:802
+msgid "Job status: Canceled"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:807
+msgid "Job status: Waiting on File daemon"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:812
+msgid "Job status: Waiting on the Storage daemon"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:817
+msgid "Job status: Waiting for new media"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:822
+msgid "Job status: Waiting for Mount"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:827
+msgid "Job status: Waiting for storage resource"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:832
+msgid "Job status: Waiting for job resource"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:837
+msgid "Job status: Waiting for Client resource"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:842
+msgid "Job status: Waiting for maximum jobs"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:847
+msgid "Job status: Waiting for start time"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:852
+msgid "Job status: Waiting for higher priority jobs to finish"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:857
+#, c-format
+msgid "Unknown job status %c."
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:858
+#, c-format
+msgid "Job status: Unknown(%c)"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:865
+#, c-format
+msgid "Bad scan : '%s' %d\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:906
+#, c-format
+msgid "Connecting to Director %s:%d"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:912
+#, c-format
+msgid "Connecting to Client %s:%d\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:913
+#, c-format
+msgid "Connecting to Client %s:%d"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:919
+#, c-format
+msgid "Connecting to Storage %s:%d\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:920
+#, c-format
+msgid "Connecting to Storage %s:%d"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:925 src/tray-monitor/tray-monitor.c:963
+#, c-format
+msgid "Error, currentitem is not a Client, a Storage or a Director..\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:931
+msgid "Cannot connect to daemon.\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:932
+msgid "Cannot connect to daemon."
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:944
+#, c-format
+msgid "Authentication error : %s"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:951
+msgid "Opened connection with Director daemon.\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:952
+msgid "Opened connection with Director daemon."
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:955
+msgid "Opened connection with File daemon.\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:956
+msgid "Opened connection with File daemon."
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:959
+msgid "Opened connection with Storage daemon.\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:960
+msgid "Opened connection with Storage daemon."
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:997
+msgid "<< Error: BNET_PROMPT signal received. >>\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:1002 src/wx-console/console_thread.cpp:486
+msgid "<< Heartbeat signal received, answered. >>\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:1006
+#, c-format
+msgid "<< Unexpected signal received : %s >>\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:1011
+msgid "<ERROR>\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:1015
+msgid "Error : BNET_HARDEOF or BNET_ERROR"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:1021
+msgid "<STOP>\n"
+msgstr ""
+
+#: src/tray-monitor/tray-monitor.c:1025
+msgid "Error : Connection closed."
+msgstr ""
+
+#: src/tray-monitor/tray_conf.c:177
+#, c-format
+msgid "Monitor: name=%s FDtimeout=%s SDtimeout=%s\n"
+msgstr ""
+
+#: src/tray-monitor/tray_conf.c:183
+#, c-format
+msgid "Director: name=%s address=%s FDport=%d\n"
+msgstr ""
+
+#: src/tray-monitor/tray_conf.c:187
+#, c-format
+msgid "Client: name=%s address=%s FDport=%d\n"
+msgstr ""
+
+#: src/tray-monitor/tray_conf.c:191
+#, c-format
+msgid "Storage: name=%s address=%s SDport=%d\n"
+msgstr ""
+
+#: src/wx-console/authenticate.c:150
+msgid "Bad response to Hello command: ERR="
+msgstr ""
+
+#: src/baconfig.h:72
+#, c-format
+msgid "Failed ASSERT: %s\n"
+msgstr ""
+
+#: src/baconfig.h:79
+msgid "*None*"
+msgstr ""
+
+#: src/win32/dird/winmain.cpp:193 src/win32/dird/winmain.cpp:200
+#: src/win32/filed/winmain.cpp:224 src/win32/filed/winmain.cpp:231
+#: src/win32/stored/baculasd/winmain.cpp:225
+#: src/win32/stored/baculasd/winmain.cpp:232
+msgid "Bacula Usage"
+msgstr ""
+
+#: src/win32/dird/winmain.cpp:197 src/win32/filed/winmain.cpp:228
+#: src/win32/stored/baculasd/winmain.cpp:229
+msgid "Bad Command Line Options"
+msgstr ""
+
+#: src/win32/dird/winservice.cpp:119 src/win32/filed/winservice.cpp:238
+#: src/win32/stored/baculasd/winservice.cpp:169
+msgid "StartServiceCtrlDispatcher failed."
+msgstr ""
+
+#: src/win32/dird/winservice.cpp:135 src/win32/filed/winservice.cpp:256
+#: src/win32/stored/baculasd/winservice.cpp:185
+msgid "RegisterServiceCtlHandler failed"
+msgstr ""
+
+#: src/win32/dird/winservice.cpp:136 src/win32/filed/winservice.cpp:257
+#: src/win32/stored/baculasd/winservice.cpp:186
+msgid "Contact Register Service Handler failure"
+msgstr ""
+
+#: src/win32/dird/winservice.cpp:152 src/win32/filed/winservice.cpp:273
+#: src/win32/stored/baculasd/winservice.cpp:202
+msgid "ReportStatus STOPPED failed 1"
+msgstr ""
+
+#: src/win32/dird/winservice.cpp:175 src/win32/filed/winservice.cpp:296
+#: src/win32/stored/baculasd/winservice.cpp:225
+msgid "Report Service failure"
 msgstr ""
 
 #: src/win32/dird/winservice.cpp:211
@@ -14402,3 +15222,710 @@ msgstr ""
 msgid ""
 "The SCM could not be contacted - the Bacula Storage service was not removed"
 msgstr ""
+
+#: src/wx-console/console_thread.cpp:121
+#, c-format
+msgid ""
+"Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined for "
+"Director \"%s\" in config file.\n"
+"At least one CA certificate store is required.\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:128
+msgid ""
+"No Director resource defined in config file.\n"
+"Without that I don't how to speak to the Director :-(\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:147
+#, c-format
+msgid ""
+"Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined for "
+"Console \"%s\" in config file.\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:169
+msgid "Error while initializing windows sockets...\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:185
+msgid "Error while cleaning up windows sockets...\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:224
+msgid "Error while initializing library."
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:248
+msgid "Cryptographic library initialization failed.\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:252
+msgid "Please correct configuration file.\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:294
+msgid "Error : Library not initialized\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:305
+msgid "Error : No configuration file loaded\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:315
+msgid "Connecting...\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:331
+msgid "Error : No director defined in config file.\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:343
+msgid "Multiple directors found in your config file.\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:352
+#, c-format
+msgid "Please choose a director (1-%d): "
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:424
+msgid "Failed to connect to the director\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:434
+msgid "Connected\n"
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:491
+msgid "<< Unexpected signal received : "
+msgstr ""
+
+#: src/wx-console/console_thread.cpp:511
+msgid "Connection terminated\n"
+msgstr ""
+
+#: src/wx-console/main.cpp:119
+msgid "Bacula bwx-console"
+msgstr ""
+
+#: src/wx-console/main.cpp:124 src/wx-console/wxbmainframe.cpp:267
+#, c-format
+msgid "Welcome to bacula bwx-console %s (%s)!\n"
+msgstr ""
+
+#: src/wx-console/wxbconfigfileeditor.cpp:65
+msgid "Config file editor"
+msgstr ""
+
+#: src/wx-console/wxbconfigfileeditor.cpp:75
+msgid "# Bacula bwx-console Configuration File\n"
+msgstr ""
+
+#: src/wx-console/wxbconfigfileeditor.cpp:111
+msgid "Save and close"
+msgstr ""
+
+#: src/wx-console/wxbconfigfileeditor.cpp:112
+msgid "Close without saving"
+msgstr ""
+
+#: src/wx-console/wxbconfigfileeditor.cpp:139
+#, c-format
+msgid "Unable to write to %s\n"
+msgstr ""
+
+#: src/wx-console/wxbconfigfileeditor.cpp:140
+msgid "Error while saving"
+msgstr ""
+
+#: src/wx-console/wxbconfigpanel.cpp:205
+msgid "Apply"
+msgstr ""
+
+#: src/wx-console/wxbhistorytextctrl.cpp:82
+#: src/wx-console/wxbhistorytextctrl.cpp:153
+#: src/wx-console/wxbmainframe.cpp:291
+msgid "Type your command below:"
+msgstr ""
+
+#: src/wx-console/wxbhistorytextctrl.cpp:117
+msgid "Unknown command."
+msgstr ""
+
+#: src/wx-console/wxbhistorytextctrl.cpp:126
+msgid "Possible completions: "
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:246
+msgid "&About...\tF1"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:246
+msgid "Show about dialog"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:248 src/wx-console/wxbmainframe.cpp:620
+msgid "Connect to the director"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:249
+msgid "Disconnect"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:249
+msgid "Disconnect of the director"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:251
+msgid "Change of configuration file"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:251
+msgid "Change your default configuration file"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:252
+msgid "Edit your configuration file"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:254
+msgid "E&xit\tAlt-X"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:254
+msgid "Quit this program"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:258
+msgid "&File"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:259
+msgid "&Help"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:283
+msgid ""
+"Warning : Unicode is disabled because you are using wxWidgets for GTK+ 1.2.\n"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:287
+msgid ""
+"Warning : There is a problem with wxWidgets for GTK+ 2.0 without Unicode "
+"support when handling non-ASCII filenames: Every non-ASCII character in such "
+"filenames will be replaced by an interrogation mark.\n"
+"If this behaviour disturbs you, please build bwx-console against a Unicode "
+"version of wxWidgets for GTK+ 2.0.\n"
+"---\n"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:298
+msgid "Send"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:375 src/wx-console/wxbmainframe.cpp:387
+msgid "Error while parsing command line arguments, using defaults.\n"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:376 src/wx-console/wxbmainframe.cpp:388
+msgid "Usage: bwx-console [-c configfile] [-w tmp]\n"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:417
+#, c-format
+msgid ""
+"It seems that it is the first time you run bwx-console.\n"
+"This file (%s) has been choosen as default configuration file.\n"
+"Do you want to edit it? (if you click No you will have to select another "
+"file)"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:419
+msgid "First run"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:436
+#, c-format
+msgid ""
+"Unable to read %s\n"
+"Error: %s\n"
+"Do you want to choose another one? (Press no to edit this file)"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:438
+msgid "Unable to read configuration file"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:450
+msgid "Please choose a configuration file to use"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:463
+msgid "This configuration file has been successfully read, use it as default?"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:464
+msgid "Configuration file read successfully"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:474
+#, c-format
+msgid "Using this configuration file: %s\n"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:479
+msgid "Connecting to the director..."
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:494
+msgid "Failed to unregister a data parser !"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:502
+msgid "Quitting.\n"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:517
+msgid ""
+"Welcome to Bacula bwx-console.\n"
+"Written by Nicolas Boichat <nicolas at boichat.ch>\n"
+"Copyright (C), 2005-2007 Free Software Foundation Europe, e.V.\n"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:521
+msgid "About Bacula bwx-console"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:527
+msgid "Please choose your default configuration file"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:531
+msgid "Use this configuration file as default?"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:532
+msgid "Configuration file"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:603
+msgid "Console thread terminated."
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:611
+msgid "Connection to the director lost. Quit program?"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:612
+msgid "Connection lost"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:628
+msgid "Connected to the director."
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:651
+msgid "Reconnect"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:652
+msgid "Reconnect to the director"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:666
+msgid "Disconnected of the director."
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:685 src/wx-console/wxbrestorepanel.cpp:710
+msgid "Unexpected question has been received.\n"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:708 src/wx-console/wxbmainframe.cpp:725
+msgid "bwx-console: unexpected director's question."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:234
+#: src/wx-console/wxbrestorepanel.cpp:1920
+#: src/wx-console/wxbrestorepanel.cpp:1949
+msgid "Enter restore mode"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:237
+msgid "Cancel restore"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:263
+#: src/wx-console/wxbrestorepanel.cpp:317
+msgid "Add"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:265
+#: src/wx-console/wxbrestorepanel.cpp:319
+msgid "Remove"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:267
+#: src/wx-console/wxbrestorepanel.cpp:321
+msgid "Refresh"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:286
+msgid "M"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:290
+msgid "Filename"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:302
+msgid "Perm."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:335
+#: src/wx-console/wxbrestorepanel.cpp:348
+#: src/wx-console/wxbrestorepanel.cpp:503
+#: src/wx-console/wxbrestorepanel.cpp:513
+#: src/wx-console/wxbrestorepanel.cpp:516
+#: src/wx-console/wxbrestorepanel.cpp:1784
+#: src/wx-console/wxbrestorepanel.cpp:1870
+msgid "Job Name"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:337
+#: src/wx-console/wxbrestorepanel.cpp:353
+#: src/wx-console/wxbrestorepanel.cpp:455
+#: src/wx-console/wxbrestorepanel.cpp:456
+#: src/wx-console/wxbrestorepanel.cpp:466
+#: src/wx-console/wxbrestorepanel.cpp:467
+#: src/wx-console/wxbrestorepanel.cpp:1139
+#: src/wx-console/wxbrestorepanel.cpp:1212
+#: src/wx-console/wxbrestorepanel.cpp:1822
+#: src/wx-console/wxbrestorepanel.cpp:1824
+#: src/wx-console/wxbrestorepanel.cpp:1885
+msgid "Fileset"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:340
+#: src/wx-console/wxbrestorepanel.cpp:1206
+#: src/wx-console/wxbrestorepanel.cpp:1222
+#: src/wx-console/wxbrestorepanel.cpp:1224
+#: src/wx-console/wxbrestorepanel.cpp:1232
+#: src/wx-console/wxbrestorepanel.cpp:1234
+#: src/wx-console/wxbrestorepanel.cpp:1253
+#: src/wx-console/wxbrestorepanel.cpp:1260
+#: src/wx-console/wxbrestorepanel.cpp:1812
+#: src/wx-console/wxbrestorepanel.cpp:1823
+#: src/wx-console/wxbrestorepanel.cpp:1944
+msgid "Before"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:342
+msgid "Please configure parameters concerning files to restore :"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:351
+#: src/wx-console/wxbrestorepanel.cpp:1878
+msgid "always"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:351
+msgid "if newer"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:351
+msgid "if older"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:351
+#: src/wx-console/wxbrestorepanel.cpp:1881
+msgid "never"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:359
+msgid "Please configure parameters concerning files restoration :"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:427
+msgid "Getting parameters list."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:435
+msgid "Error : no clients returned by the director."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:459
+msgid "Error : no filesets returned by the director."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:483
+msgid "Error : no storage returned by the director."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:506
+#: src/wx-console/wxbrestorepanel.cpp:530
+msgid "Error : no jobs returned by the director."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:516
+msgid "RestoreFiles"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:551
+msgid "Please configure your restore parameters."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:562
+msgid "Building restore tree..."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:605
+msgid "Error while starting restore: "
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:695
+msgid ""
+"Right click on a file or on a directory, or double-click on its mark to add "
+"it to the restore list."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:732
+#: src/wx-console/wxbrestorepanel.cpp:754
+msgid "bwx-console: unexpected restore question."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:765
+msgid " files selected to be restored."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:770
+msgid " file selected to be restored."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:777
+#, c-format
+msgid "Please configure your restore (%ld files selected to be restored)..."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:787
+msgid "Restore failed : no file selected.\n"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:788
+msgid "Restore failed : no file selected."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:798
+msgid "Restoring, please wait..."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:811
+msgid "Job queued. JobId="
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:813
+msgid "Restore queued, jobid="
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:817
+msgid "Job failed."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:818
+msgid "Restore failed, please look at messages.\n"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:819
+msgid "Restore failed, please look at messages in console."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:825
+#: src/wx-console/wxbrestorepanel.cpp:826
+msgid "Failed to retrieve jobid.\n"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:852
+msgid ""
+"Restore is scheduled in more than two minutes, bwx-console will not wait for "
+"its completion.\n"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:853
+msgid ""
+"Restore is scheduled in more than two minutes, bwx-console will not wait for "
+"its completion."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:879
+msgid "Restore job created, but not yet running."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:884
+#, c-format
+msgid "Restore job running, please wait (%ld of %ld files restored)..."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:888
+msgid "Restore job terminated successfully."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:889
+msgid "Restore job terminated successfully.\n"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:894
+msgid "Restore job terminated in error, see messages in console."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:895
+msgid "Restore job terminated in error, see messages.\n"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:900
+msgid "Restore job reported a non-fatal error."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:904
+msgid "Restore job reported a fatal error."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:909
+msgid "Restore job cancelled by user."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:910
+msgid "Restore job cancelled by user.\n"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:915
+msgid "Restore job is waiting on File daemon."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:919
+msgid "Restore job is waiting for new media."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:923
+msgid "Restore job is waiting for storage resource."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:927
+msgid "Restore job is waiting for job resource."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:931
+msgid "Restore job is waiting for Client resource."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:935
+msgid "Restore job is waiting for maximum jobs."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:939
+msgid "Restore job is waiting for start time."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:943
+msgid "Restore job is waiting for higher priority jobs to finish."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:992
+msgid ""
+"The restore job has not been started within one minute, bwx-console will not "
+"wait for its completion anymore.\n"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:993
+msgid ""
+"The restore job has not been started within one minute, bwx-console will not "
+"wait for its completion anymore."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1003
+msgid "Restore done successfully.\n"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1004
+msgid "Restore done successfully."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1075
+msgid "Applying restore configuration changes..."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1126
+msgid "Failed to find the selected client."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1141
+msgid "Failed to find the selected fileset."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1156
+msgid "Failed to find the selected storage."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1173
+#: src/wx-console/wxbrestorepanel.cpp:1859
+msgid "Run Restore job"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1189
+msgid "Restore configuration changes were applied."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1198
+msgid "Restore cancelled.\n"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1199
+msgid "Restore cancelled."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1221
+msgid "No results to list."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1223
+msgid "No backup found for this client."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1230
+msgid "ERROR"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1231
+msgid "Query failed"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1233
+msgid "Cannot get previous backups list, see console."
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1869
+msgid "JobName:"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1873
+msgid "Where:"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1876
+msgid "Replace:"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1879
+msgid "ifnewer"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1880
+msgid "ifolder"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:1884
+msgid "FileSet:"
+msgstr ""
+
+#: src/wx-console/wxbrestorepanel.cpp:2001
+msgid "Restoring..."
+msgstr ""
diff --git a/po/nl.po b/po/nl.po
index ed26301..191c524 100644
--- a/po/nl.po
+++ b/po/nl.po
@@ -1,13 +1,13 @@
 # Dutch translation of Bacula
-# Copyright (C) 2012-2014 Kern Sibbald
-# This file is distributed under the same license as the PACKAGE package.
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 # W. van den Akker <wvdakker at wilsoft.nl>, 2012
 #
 msgid ""
 msgstr ""
 "Project-Id-Version: Bacula 5.2.7\n"
 "Report-Msgid-Bugs-To: bacula-devel at lists.sourceforge.net\n"
-"POT-Creation-Date: 2014-07-29 18:18+0200\n"
+"POT-Creation-Date: 2015-08-09 15:05+0200\n"
 "PO-Revision-Date: 2012-05-05 11:52+0100\n"
 "Last-Translator: W. van den Akker <wvdakker at wilsoft.nl>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -16,123 +16,128 @@ msgstr ""
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-#: src/baconfig.h:60 src/baconfig.h:61 src/baconfig.h:66 src/baconfig.h:67
+#: src/baconfig.h:64 src/baconfig.h:65 src/baconfig.h:70 src/baconfig.h:71
+#: src/baconfig.h:82 src/baconfig.h:83
 #, c-format
 msgid "Failed ASSERT: %s\n"
 msgstr ""
 
-#: src/baconfig.h:76
+#: src/baconfig.h:91
 msgid "*None*"
 msgstr "*Geen*"
 
-#: src/lib/status.h:73
+#: src/lib/status.h:78
 msgid ""
 "\n"
 "Terminated Jobs:\n"
 msgstr ""
 
-#: src/lib/status.h:80
+#: src/lib/status.h:85
 msgid " JobId  Level    Files      Bytes   Status   Finished        Name \n"
 msgstr ""
 
-#: src/lib/status.h:82
+#: src/lib/status.h:87
 msgid "===================================================================\n"
 msgstr ""
 
-#: src/lib/status.h:102
+#: src/lib/status.h:107
 msgid "Created"
 msgstr ""
 
-#: src/lib/status.h:106
+#: src/lib/status.h:111
 msgid "Error"
 msgstr ""
 
-#: src/lib/status.h:109
+#: src/lib/status.h:114
 msgid "Diffs"
 msgstr ""
 
-#: src/lib/status.h:112
+#: src/lib/status.h:117
 msgid "Cancel"
 msgstr ""
 
-#: src/lib/status.h:115
+#: src/lib/status.h:120
 msgid "OK"
 msgstr ""
 
-#: src/lib/status.h:118
+#: src/lib/status.h:123
 msgid "OK -- with warnings"
 msgstr ""
 
-#: src/lib/status.h:122
+#: src/lib/status.h:126
+msgid "Incomplete"
+msgstr ""
+
+#: src/lib/status.h:129
 msgid "Other"
 msgstr ""
 
-#: src/lib/status.h:134
+#: src/lib/status.h:141
 #, c-format
 msgid "%6d\t%-6s\t%8s\t%10s\t%-7s\t%-8s\t%s\n"
 msgstr ""
 
-#: src/lib/status.h:142
+#: src/lib/status.h:149
 #, c-format
 msgid "%6d  %-6s %8s %10s  %-7s  %-8s %s\n"
 msgstr ""
 
-#: src/lib/status.h:171 src/lib/status.h:182 src/lib/status.h:196
-#: src/lib/status.h:200 src/lib/status.h:204
+#: src/lib/status.h:178 src/lib/status.h:189 src/lib/status.h:203
+#: src/lib/status.h:207 src/lib/status.h:211
 msgid "Bacula "
 msgstr ""
 
-#: src/qt-console/bat_conf.cpp:130
+#: src/qt-console/bat_conf.cpp:133
 #, c-format
 msgid "No record for %d %s\n"
 msgstr ""
 
-#: src/qt-console/bat_conf.cpp:139
+#: src/qt-console/bat_conf.cpp:142
 #, c-format
 msgid "Director: name=%s address=%s DIRport=%d\n"
 msgstr ""
 
-#: src/qt-console/bat_conf.cpp:143
+#: src/qt-console/bat_conf.cpp:146
 #, c-format
 msgid "Console: name=%s\n"
 msgstr "Console: naam=%s\n"
 
-#: src/qt-console/bat_conf.cpp:146
-#: src/qt-console/tray-monitor/tray_conf.cpp:183
+#: src/qt-console/bat_conf.cpp:149
+#: src/qt-console/tray-monitor/tray_conf.cpp:187
 #, c-format
 msgid "ConsoleFont: name=%s font face=%s\n"
 msgstr ""
 
-#: src/qt-console/bat_conf.cpp:150 src/qt-console/bat_conf.cpp:231
-#: src/qt-console/bat_conf.cpp:279 src/qt-console/bat_conf.cpp:309
+#: src/qt-console/bat_conf.cpp:153 src/qt-console/bat_conf.cpp:234
+#: src/qt-console/bat_conf.cpp:284 src/qt-console/bat_conf.cpp:314
 #, c-format
 msgid "Unknown resource type %d\n"
 msgstr ""
 
-#: src/qt-console/bat_conf.cpp:257
-#: src/qt-console/tray-monitor/tray_conf.cpp:276
+#: src/qt-console/bat_conf.cpp:262
+#: src/qt-console/tray-monitor/tray_conf.cpp:280
 #, c-format
 msgid "%s item is required in %s resource, but not found.\n"
 msgstr ""
 
-#: src/qt-console/bat_conf.cpp:326
-#: src/qt-console/tray-monitor/tray_conf.cpp:360
+#: src/qt-console/bat_conf.cpp:331
+#: src/qt-console/tray-monitor/tray_conf.cpp:364
 #, c-format
 msgid "Attempt to define second %s resource named \"%s\" is not permitted.\n"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:85
+#: src/qt-console/bcomm/dircomm.cpp:89
 #, c-format
 msgid "Already connected\"%s\".\n"
 msgstr "Al verbonden\"%s\".\n"
 
-#: src/qt-console/bcomm/dircomm.cpp:96
-#: src/qt-console/tray-monitor/tray-monitor.cpp:347
+#: src/qt-console/bcomm/dircomm.cpp:100
+#: src/qt-console/tray-monitor/tray-monitor.cpp:353
 #, c-format
 msgid "Connecting to Director %s:%d"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:98
+#: src/qt-console/bcomm/dircomm.cpp:102
 #, c-format
 msgid ""
 "Connecting to Director %s:%d\n"
@@ -141,110 +146,110 @@ msgstr ""
 "Verbinden met Director %s:%d\n"
 "\n"
 
-#: src/qt-console/bcomm/dircomm.cpp:150
+#: src/qt-console/bcomm/dircomm.cpp:154
 #, c-format
 msgid "Failed to initialize TLS context for Console \"%s\".\n"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:173
+#: src/qt-console/bcomm/dircomm.cpp:177
 #, c-format
 msgid "Failed to initialize TLS context for Director \"%s\".\n"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:195
-#: src/qt-console/tray-monitor/tray-monitor.cpp:352
+#: src/qt-console/bcomm/dircomm.cpp:199
+#: src/qt-console/tray-monitor/tray-monitor.cpp:358
 msgid "Director daemon"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:233
+#: src/qt-console/bcomm/dircomm.cpp:237
 msgid "Initializing ..."
 msgstr "Initialiseren ..."
 
-#: src/qt-console/bcomm/dircomm.cpp:249 src/qt-console/console/console.cpp:130
+#: src/qt-console/bcomm/dircomm.cpp:253 src/qt-console/console/console.cpp:134
 msgid "Connected"
 msgstr "Verbonden"
 
-#: src/qt-console/bcomm/dircomm.cpp:373
+#: src/qt-console/bcomm/dircomm.cpp:377
 msgid "Command completed ..."
 msgstr "Opdracht gereed ..."
 
-#: src/qt-console/bcomm/dircomm.cpp:380 src/qt-console/console/console.cpp:367
+#: src/qt-console/bcomm/dircomm.cpp:384 src/qt-console/console/console.cpp:371
 msgid "Processing command ..."
 msgstr "Opdracht aan het uitvoeren ..."
 
-#: src/qt-console/bcomm/dircomm.cpp:387
+#: src/qt-console/bcomm/dircomm.cpp:391
 msgid "At main prompt waiting for input ..."
 msgstr "Wacht op invoer op opdrachtregel in hoofdscherm ..."
 
-#: src/qt-console/bcomm/dircomm.cpp:394 src/qt-console/bcomm/dircomm.cpp:407
+#: src/qt-console/bcomm/dircomm.cpp:398 src/qt-console/bcomm/dircomm.cpp:408
 msgid "At prompt waiting for input ..."
 msgstr "Wacht op invoer op opdrachtregel ..."
 
-#: src/qt-console/bcomm/dircomm.cpp:415
+#: src/qt-console/bcomm/dircomm.cpp:416
 msgid "Command failed."
 msgstr "Opdracht mislukt."
 
-#: src/qt-console/bcomm/dircomm.cpp:487
+#: src/qt-console/bcomm/dircomm.cpp:488
 msgid "Director disconnected."
 msgstr "Director niet verbonden."
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:107
+#: src/qt-console/bcomm/dircomm_auth.cpp:111
 #, c-format
 msgid "Director authorization problem at \"%s:%d\"\n"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:114
+#: src/qt-console/bcomm/dircomm_auth.cpp:118
 #, c-format
 msgid ""
 "Authorization problem: Remote server at \"%s:%d\" did not advertise required "
 "TLS support.\n"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:122
+#: src/qt-console/bcomm/dircomm_auth.cpp:126
 #, c-format
 msgid ""
 "Authorization problem with Director at \"%s:%d\": Remote server requires "
 "TLS.\n"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:133
+#: src/qt-console/bcomm/dircomm_auth.cpp:137
 #, c-format
 msgid "TLS negotiation failed with Director at \"%s:%d\"\n"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:145
+#: src/qt-console/bcomm/dircomm_auth.cpp:149
 #, c-format
 msgid ""
 "Bad response to Hello command: ERR=%s\n"
 "The Director at \"%s:%d\" is probably not running.\n"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:154
+#: src/qt-console/bcomm/dircomm_auth.cpp:158
 #, c-format
 msgid "Director at \"%s:%d\" rejected Hello command\n"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:169
+#: src/qt-console/bcomm/dircomm_auth.cpp:173
 #, c-format
 msgid ""
 "Authorization problem with Director at \"%s:%d\"\n"
 "Most likely the passwords do not agree.\n"
 "If you are using TLS, there may have been a certificate validation error "
 "during the TLS handshake.\n"
-"Please see "
+"For help, please see "
 msgstr ""
 
-#: src/qt-console/main.cpp:154
+#: src/qt-console/main.cpp:159
 msgid "Cryptography library initialization failed.\n"
 msgstr ""
 
-#: src/qt-console/main.cpp:158
+#: src/qt-console/main.cpp:163
 #, c-format
 msgid "Please correct configuration file: %s\n"
 msgstr ""
 
-#: src/qt-console/main.cpp:180
-#, c-format
+#: src/qt-console/main.cpp:187
+#, fuzzy, c-format
 msgid ""
 "\n"
 "Version: %s (%s) %s %s %s\n"
@@ -269,89 +274,89 @@ msgstr ""
 "       -?            geef deze melding.\n"
 "\n"
 
-#: src/qt-console/main.cpp:213 src/qt-console/main.cpp:243
+#: src/qt-console/main.cpp:220 src/qt-console/main.cpp:250
 msgid "TLS required but not configured in Bacula.\n"
 msgstr ""
 
-#: src/qt-console/main.cpp:221
+#: src/qt-console/main.cpp:228
 #, c-format
 msgid ""
 "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined for "
 "Director \"%s\" in %s. At least one CA certificate store is required.\n"
 msgstr ""
 
-#: src/qt-console/main.cpp:230
+#: src/qt-console/main.cpp:237
 #, c-format
 msgid ""
 "No Director resource defined in %s\n"
 "Without that I don't how to speak to the Director :-(\n"
 msgstr ""
 
-#: src/qt-console/main.cpp:251
+#: src/qt-console/main.cpp:258
 #, c-format
 msgid ""
 "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined for "
 "Console \"%s\" in %s.\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:75
+#: src/qt-console/tray-monitor/authenticate.cpp:79
 msgid ""
 "Director authorization problem.\n"
 "Most likely the passwords do not agree.\n"
-"Please see "
+"For help, please see "
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:84
+#: src/qt-console/tray-monitor/authenticate.cpp:88
 #, c-format
 msgid "Bad response to Hello command: ERR=%s\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:91
+#: src/qt-console/tray-monitor/authenticate.cpp:95
 msgid "Director rejected Hello command\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:119
+#: src/qt-console/tray-monitor/authenticate.cpp:123
 #, c-format
 msgid "Error sending Hello to Storage daemon. ERR=%s\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:125
+#: src/qt-console/tray-monitor/authenticate.cpp:129
 msgid ""
 "Director and Storage daemon passwords or names not the same.\n"
-"Please see "
+"For help, please see "
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:132
+#: src/qt-console/tray-monitor/authenticate.cpp:136
 #, c-format
 msgid "bdird<stored: bad response to Hello command: ERR=%s\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:139
+#: src/qt-console/tray-monitor/authenticate.cpp:143
 msgid "Storage daemon rejected Hello command\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:165
+#: src/qt-console/tray-monitor/authenticate.cpp:169
 #, c-format
 msgid "Error sending Hello to File daemon. ERR=%s\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:171
+#: src/qt-console/tray-monitor/authenticate.cpp:175
 msgid ""
 "Director and File daemon passwords or names not the same.\n"
-"Please see "
+"For help, please see "
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:178
+#: src/qt-console/tray-monitor/authenticate.cpp:182
 #, c-format
 msgid "Bad response from File daemon to Hello command: ERR=%s\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:185
+#: src/qt-console/tray-monitor/authenticate.cpp:189
 msgid "File daemon rejected Hello command\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:55
-#, c-format
+#: src/qt-console/tray-monitor/tray-monitor.cpp:59
+#, fuzzy, c-format
 msgid ""
 "\n"
 "Version: %s (%s) %s %s %s\n"
@@ -375,14 +380,14 @@ msgstr ""
 "       -?            geef deze melding.\n"
 "\n"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:204
+#: src/qt-console/tray-monitor/tray-monitor.cpp:210
 #, c-format
 msgid ""
 "Error: %d Monitor resources defined in %s. You must define one and only one "
 "Monitor resource.\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:236
+#: src/qt-console/tray-monitor/tray-monitor.cpp:242
 #, c-format
 msgid ""
 "No Client, Storage or Director resource defined in %s\n"
@@ -390,7 +395,7 @@ msgid ""
 "Daemon :-(\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:251
+#: src/qt-console/tray-monitor/tray-monitor.cpp:257
 #, c-format
 msgid ""
 "Invalid refresh interval defined in %s\n"
@@ -398,106 +403,106 @@ msgid ""
 "minutes (read value: %d).\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:319
+#: src/qt-console/tray-monitor/tray-monitor.cpp:325
 #, c-format
 msgid "Error, currentitem is not a Client or a Storage..\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:357
+#: src/qt-console/tray-monitor/tray-monitor.cpp:363
 #, c-format
 msgid "Connecting to Client %s:%d"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:362
+#: src/qt-console/tray-monitor/tray-monitor.cpp:368
 msgid "File daemon"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:367
+#: src/qt-console/tray-monitor/tray-monitor.cpp:373
 #, c-format
 msgid "Connecting to Storage %s:%d"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:372
+#: src/qt-console/tray-monitor/tray-monitor.cpp:378
 msgid "Storage daemon"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:376
-#: src/qt-console/tray-monitor/tray-monitor.cpp:406
+#: src/qt-console/tray-monitor/tray-monitor.cpp:382
+#: src/qt-console/tray-monitor/tray-monitor.cpp:412
 #, c-format
 msgid "Error, currentitem is not a Client, a Storage or a Director..\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:381
+#: src/qt-console/tray-monitor/tray-monitor.cpp:387
 msgid "Cannot connect to daemon."
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:390
+#: src/qt-console/tray-monitor/tray-monitor.cpp:396
 #, c-format
 msgid "Authentication error : %s"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:397
+#: src/qt-console/tray-monitor/tray-monitor.cpp:403
 msgid "Opened connection with Director daemon."
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:400
+#: src/qt-console/tray-monitor/tray-monitor.cpp:406
 msgid "Opened connection with File daemon."
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:403
+#: src/qt-console/tray-monitor/tray-monitor.cpp:409
 msgid "Opened connection with Storage daemon."
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:454
+#: src/qt-console/tray-monitor/tray-monitor.cpp:460
 msgid "Error : BNET_HARDEOF or BNET_ERROR"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:463
+#: src/qt-console/tray-monitor/tray-monitor.cpp:469
 msgid "Error : Connection closed."
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:156
+#: src/qt-console/tray-monitor/tray_conf.cpp:160
 #, c-format
 msgid "No %s resource defined\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:165
+#: src/qt-console/tray-monitor/tray_conf.cpp:169
 #, c-format
 msgid "Monitor: name=%s FDtimeout=%s SDtimeout=%s\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:171
+#: src/qt-console/tray-monitor/tray_conf.cpp:175
 #, c-format
 msgid "Director: name=%s address=%s FDport=%d\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:175
+#: src/qt-console/tray-monitor/tray_conf.cpp:179
 #, c-format
 msgid "Client: name=%s address=%s FDport=%d\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:179
+#: src/qt-console/tray-monitor/tray_conf.cpp:183
 #, c-format
 msgid "Storage: name=%s address=%s SDport=%d\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:187
+#: src/qt-console/tray-monitor/tray_conf.cpp:191
 #, c-format
 msgid "Unknown resource type %d in dump_resource.\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:245
+#: src/qt-console/tray-monitor/tray_conf.cpp:249
 #, c-format
 msgid "Unknown resource type %d in free_resource.\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:282
+#: src/qt-console/tray-monitor/tray_conf.cpp:286
 #, c-format
 msgid "Too many items in %s resource\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:302
-#: src/qt-console/tray-monitor/tray_conf.cpp:340
+#: src/qt-console/tray-monitor/tray_conf.cpp:306
+#: src/qt-console/tray-monitor/tray_conf.cpp:344
 #, c-format
 msgid "Unknown resource type %d in save_resource.\n"
 msgstr ""
@@ -514,9 +519,33 @@ msgstr ""
 #~ "Versie: "
 
 #, fuzzy
+#~ msgid "Fetch failed: ERR=%s\n"
+#~ msgstr "Lees fout op bestand %s. FOUT=%s\n"
+
+#, fuzzy
 #~ msgid "Could not init database batch connection\n"
 #~ msgstr "Data parser kon niet geregistreerd worden!"
 
+#, fuzzy
+#~ msgid "RestoreObject record \"%d\" not found.\n"
+#~ msgstr "Job \"%s\" niet gevonden.\n"
+
+#, fuzzy
+#~ msgid "Media record for Volume name \"%s\" not found.\n"
+#~ msgstr "Job \"%s\" niet gevonden.\n"
+
+#, fuzzy
+#~ msgid "Snapshot record for Snapshot name \"%s\" not found.\n"
+#~ msgstr "Job \"%s\" niet gevonden.\n"
+
+#, fuzzy
+#~ msgid "send a file to the director"
+#~ msgstr "Verbinding naar director opnieuw opzetten"
+
+#, fuzzy
+#~ msgid "@exec error: ERR=%s\n"
+#~ msgstr "Lees fout op bestand %s. FOUT=%s\n"
+
 #~ msgid "*** Admin Error ***"
 #~ msgstr "*** Admin Fout ***"
 
@@ -532,6 +561,37 @@ msgstr ""
 #~ msgid "Backup Canceled"
 #~ msgstr "Backup geannuleerd"
 
+#, fuzzy
+#~ msgid ""
+#~ "\n"
+#~ "%sVersion: %s (%s)\n"
+#~ "\n"
+#~ "Usage: bdirjson [-f -s] [-c config_file] [-d debug_level] [config_file]\n"
+#~ "       -r <res>    get resource type <res>\n"
+#~ "       -n <name>   get resource <name>\n"
+#~ "       -l <dirs>   get only directives matching dirs (use with -r)\n"
+#~ "       -D          get only data\n"
+#~ "       -R          do not apply JobDefs to Job\n"
+#~ "       -c <file>   set configuration file to file\n"
+#~ "       -d <nn>     set debug level to <nn>\n"
+#~ "       -dt         print timestamp in debug output\n"
+#~ "       -t          test - read configuration and exit\n"
+#~ "       -s          output in show text format\n"
+#~ "       -v          verbose user messages\n"
+#~ "       -?          print this message.\n"
+#~ "\n"
+#~ msgstr ""
+#~ "\n"
+#~ "Versie: %s (%s) %s %s %s\n"
+#~ "\n"
+#~ "Specificatie: tray-monitor [-c configuratiebestand] [-d debug_level]\n"
+#~ "       -c <file>     gebruik configuratiebestand\n"
+#~ "       -d <nn>       instellen debug level op <nn>\n"
+#~ "       -dt           weergeven tijd in debug output\n"
+#~ "       -t            test - lees configuratie en stop\n"
+#~ "       -?            geef deze melding.\n"
+#~ "\n"
+
 #~ msgid "Error writing bsr file.\n"
 #~ msgstr "Fout bij schrijven van bsr bestand.\n"
 
@@ -549,22 +609,23 @@ msgstr ""
 #, fuzzy
 #~ msgid ""
 #~ "\n"
-#~ "Version: %s (%s)\n"
+#~ "%sVersion: %s (%s)\n"
 #~ "\n"
 #~ "Usage: bacula-dir [-f -s] [-c config_file] [-d debug_level] "
 #~ "[config_file]\n"
-#~ "       -c <file>   set configuration file to file\n"
-#~ "       -d <nn>     set debug level to <nn>\n"
-#~ "       -dt         print timestamp in debug output\n"
-#~ "       -f          run in foreground (for debugging)\n"
-#~ "       -g          groupid\n"
-#~ "       -m          print kaboom output (for debugging)\n"
-#~ "       -r <job>    run <job> now\n"
-#~ "       -s          no signals\n"
-#~ "       -t          test - read configuration and exit\n"
-#~ "       -u          userid\n"
-#~ "       -v          verbose user messages\n"
-#~ "       -?          print this message.\n"
+#~ "     -c <file>        set configuration file to file\n"
+#~ "     -d <nn>[,<tags>] set debug level to <nn>, debug tags to <tags>\n"
+#~ "     -dt              print timestamp in debug output\n"
+#~ "     -T               set trace on\n"
+#~ "     -f               run in foreground (for debugging)\n"
+#~ "     -g               groupid\n"
+#~ "     -m               print kaboom output (for debugging)\n"
+#~ "     -r <job>         run <job> now\n"
+#~ "     -s               no signals\n"
+#~ "     -t               test - read configuration and exit\n"
+#~ "     -u               userid\n"
+#~ "     -v               verbose user messages\n"
+#~ "     -?               print this message.\n"
 #~ "\n"
 #~ msgstr ""
 #~ "\n"
@@ -581,6 +642,10 @@ msgstr ""
 #~ msgid "Job"
 #~ msgstr "Job"
 
+#, fuzzy
+#~ msgid "ComponentInfo failed.\n"
+#~ msgstr "Opdracht mislukt."
+
 #~ msgid "Unable to init job cond variable: ERR=%s\n"
 #~ msgstr "Kan job cond variabele niet initialiseren: ERR=%s\n"
 
@@ -589,15 +654,23 @@ msgstr ""
 #~ msgstr "Kan de geselecteerde opslag niet vinden."
 
 #, fuzzy
+#~ msgid "Client resource \"%s\" does not exist.\n"
+#~ msgstr "Fout: Client %s bestaat niet.\n"
+
+#, fuzzy
 #~ msgid "canceled"
 #~ msgstr "Backup geannuleerd"
 
 #, fuzzy
+#~ msgid "Cannot create pool \"%s\" in database. ERR=%s"
+#~ msgstr "Lees fout op bestand %s. FOUT=%s\n"
+
+#, fuzzy
 #~ msgid "Job's NextPool resource"
 #~ msgstr "Selecteer Pool"
 
 #, fuzzy
-#~ msgid "Storage from Job's NextPool resource"
+#~ msgid "Pool's NextPool resource"
 #~ msgstr "Selecteer Pool"
 
 #~ msgid "Job %s waiting %d seconds for scheduled start time.\n"
@@ -637,15 +710,56 @@ msgstr ""
 #~ msgstr "Teveel mislukte pogingen. Aanmaken volume naam gestopt.\n"
 
 #, fuzzy
-#~ msgid "Stop a job"
+#~ msgid "Snapshot not found\n"
+#~ msgstr "Job \"%s\" niet gevonden.\n"
+
+#, fuzzy
+#~ msgid "Client resource not found\n"
+#~ msgstr "Fout: Client %s bestaat niet.\n"
+
+#, fuzzy
+#~ msgid "No snapshot found\n"
+#~ msgstr "Job \"%s\" niet gevonden.\n"
+
+#, fuzzy
+#~ msgid "List snapshots in Catalog"
+#~ msgstr "Bestand niet in catalog: %s\n"
+
+#, fuzzy
+#~ msgid "Unable to get Snapshot record.\n"
+#~ msgstr "Kan job cond variabele niet initialiseren: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "New Comment is: %s\n"
+#~ msgstr "Nieuw bestand: %s\n"
+
+#, fuzzy
+#~ msgid "Snapshot Retention Period"
+#~ msgstr "Geef nieuwe retention periode:"
+
+#, fuzzy
+#~ msgid "Enter Snapshot Retention period: "
+#~ msgstr "Geef nieuwe retention periode:"
+
+#, fuzzy
+#~ msgid "Current comment is: %s\n"
+#~ msgstr "De huidige %s retention periode: %s\n"
+
+#, fuzzy
+#~ msgid "Restart a job"
+#~ msgstr "Uitvoeren herstel opdracht"
+
+#, fuzzy
+#~ msgid "Resume a job"
 #~ msgstr "Uitvoeren herstel opdracht"
 
 #, fuzzy
 #~ msgid "Failed to set bandwidth limit to Client.\n"
 #~ msgstr "Kan de geselecteerde client niet vinden."
 
-#~ msgid "Job \"%s\" not found.\n"
-#~ msgstr "Job \"%s\" niet gevonden.\n"
+#, fuzzy
+#~ msgid "Client \"%s\" %sabled\n"
+#~ msgstr "Opdracht mislukt."
 
 #~ msgid "Storage"
 #~ msgstr "Opslag"
@@ -653,10 +767,25 @@ msgstr ""
 #~ msgid "Client"
 #~ msgstr "Client"
 
+#~ msgid "Job \"%s\" not found.\n"
+#~ msgstr "Job \"%s\" niet gevonden.\n"
+
 #~ msgid "Could not find a Catalog resource\n"
 #~ msgstr "Kan Catalog medium niet vinden\n"
 
 #, fuzzy
+#~ msgid "Command line"
+#~ msgstr "Onjuiste opdrachtregel optie"
+
+#, fuzzy
+#~ msgid "Invalid keyword found: %s\n"
+#~ msgstr "Onjuiste periode.\n"
+
+#, fuzzy
+#~ msgid "Failed to send command to Client.\n"
+#~ msgstr "Kan de geselecteerde client niet vinden."
+
+#, fuzzy
 #~ msgid "Unable to get Job record for Job=%s\n"
 #~ msgstr "Kan job cond variabele niet initialiseren: ERR=%s\n"
 
@@ -672,6 +801,22 @@ msgstr ""
 #~ msgid "Unable to get last Job record for Client=%s\n"
 #~ msgstr "Kan job cond variabele niet initialiseren: ERR=%s\n"
 
+#, fuzzy
+#~ msgid "No Volumes found to perform \"truncate\" command.\n"
+#~ msgstr "Geen Volumes gevonden om terug te zetten.\n"
+
+#, fuzzy
+#~ msgid "Unable to create component file %s. ERR=%s\n"
+#~ msgstr "Lees fout op bestand %s. FOUT=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to fdopen component file %s. ERR=%s\n"
+#~ msgstr "Kan job cond variabele niet initialiseren: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Error writing component file.\n"
+#~ msgstr "Fout bij schrijven van bsr bestand.\n"
+
 #~ msgid "The defined FileSet resources are:\n"
 #~ msgstr "De gedefinieerde Fileset media zijn:\n"
 
@@ -693,6 +838,18 @@ msgstr ""
 #~ msgid "You have the following choices:\n"
 #~ msgstr "U heeft de volgende keuzes:\n"
 
+#, fuzzy
+#~ msgid "Unable to use current plugin configuration, discarding it."
+#~ msgstr "Kan configuratiebestand niet lezen"
+
+#, fuzzy
+#~ msgid "Plugin Restore Options\n"
+#~ msgstr "Uitvoeren herstel opdracht"
+
+#, fuzzy
+#~ msgid "Use above plugin configuration? (yes/mod/no): "
+#~ msgstr "Doorgaan? (ja, wijz, nee):"
+
 #~ msgid "Pool"
 #~ msgstr "Pool"
 
@@ -707,6 +864,10 @@ msgstr ""
 #~ msgid "The current %s retention period is: %s\n"
 #~ msgstr "De huidige %s retention periode: %s\n"
 
+#, fuzzy
+#~ msgid "Continue? (yes/no): "
+#~ msgstr "Doorgaan? (ja, wijz, nee):"
+
 #~ msgid "Continue? (yes/mod/no): "
 #~ msgstr "Doorgaan? (ja, wijz, nee):"
 
@@ -734,24 +895,44 @@ msgstr ""
 #~ msgid "Select Catalog resource"
 #~ msgstr "Selecteer Catalog media"
 
-#~ msgid "The defined Job resources are:\n"
+#, fuzzy
+#~ msgid "The disabled Job resources are:\n"
+#~ msgstr "De gedefinieerde job resources zijn:\n"
+
+#, fuzzy
+#~ msgid "The enabled Job resources are:\n"
 #~ msgstr "De gedefinieerde job resources zijn:\n"
 
 #~ msgid "Select Job resource"
 #~ msgstr "Selecteer Job media:"
 
+#~ msgid "The defined Job resources are:\n"
+#~ msgstr "De gedefinieerde job resources zijn:\n"
+
 #~ msgid "Select Restore Job"
 #~ msgstr "Selecteer Job om terug te zetten"
 
 #~ msgid "The defined Client resources are:\n"
 #~ msgstr "De gedefinieerde Clients zijn:\n"
 
+#, fuzzy
+#~ msgid "Select Client resource"
+#~ msgstr "Selecteer FileSet bron"
+
 #~ msgid "Select Client (File daemon) resource"
 #~ msgstr "Selecteer een Client (File daemon)"
 
 #~ msgid "Error: Client resource %s does not exist.\n"
 #~ msgstr "Fout: Client %s bestaat niet.\n"
 
+#, fuzzy
+#~ msgid "The defined Schedule resources are:\n"
+#~ msgstr "De gedefinieerde Clients zijn:\n"
+
+#, fuzzy
+#~ msgid "Select Schedule resource"
+#~ msgstr "Selecteer Pool"
+
 #~ msgid "Could not find Client %s: ERR=%s"
 #~ msgstr "Kan Client niet vinden %s: ERR=%s"
 
@@ -773,7 +954,8 @@ msgstr ""
 #~ msgid "No access to Pool \"%s\"\n"
 #~ msgstr "Geen toegang tot Pool \"%s\"\n"
 
-#~ msgid "Enter *MediaId or Volume name: "
+#, fuzzy
+#~ msgid "Enter a Volume name or *MediaId: "
 #~ msgstr "Voer *MediaId of Volume naam in:"
 
 #~ msgid "Select Pool resource"
@@ -813,10 +995,18 @@ msgstr ""
 #~ msgstr "Geen van uw opdrachten zijn in uitvoering.\n"
 
 #, fuzzy
+#~ msgid "Warning Job JobId=%d is not running.\n"
+#~ msgstr "JobID %s is niet in uitvoering.\n"
+
+#, fuzzy
 #~ msgid "Confirm %s of %d Job%s (yes/no): "
 #~ msgstr "Bevestig annulering (yes/no)"
 
 #, fuzzy
+#~ msgid "Warning Job %s is not running.\n"
+#~ msgstr "JobID %s is niet in uitvoering.\n"
+
+#, fuzzy
 #~ msgid "Select Job(s):\n"
 #~ msgstr "Selecteer Job:\n"
 
@@ -828,6 +1018,10 @@ msgstr ""
 #~ msgstr "U heeft berichten.\n"
 
 #, fuzzy
+#~ msgid "Console connected %sat %s\n"
+#~ msgstr "Al verbonden\"%s\".\n"
+
+#, fuzzy
 #~ msgid "is waiting for its start time (%s)"
 #~ msgstr "Job %s wacht %d seconde voor de start tijd.\n"
 
@@ -881,17 +1075,96 @@ msgstr ""
 #~ msgid "pioctl VIOCSETAL error on file \"%s\": ERR=%s\n"
 #~ msgstr "Lees fout op bestand %s. FOUT=%s\n"
 
-#~ msgid "Compression LZO error: %d\n"
-#~ msgstr "Compressie LZO fout: %d\n"
+#~ msgid "Read error on file %s. ERR=%s\n"
+#~ msgstr "Lees fout op bestand %s. FOUT=%s\n"
+
+#~ msgid "Too many errors. JobErrors=%d.\n"
+#~ msgstr "Te veel fouten. OpdrachtFouten=%d.\n"
 
 #~ msgid "Encryption error\n"
 #~ msgstr "Fout in versleuteling \n"
 
-#~ msgid "Read error on file %s. ERR=%s\n"
+#, fuzzy
+#~ msgid "Network send error to SD. Data=%s ERR=%s\n"
 #~ msgstr "Lees fout op bestand %s. FOUT=%s\n"
 
-#~ msgid "Too many errors. JobErrors=%d.\n"
-#~ msgstr "Te veel fouten. OpdrachtFouten=%d.\n"
+#~ msgid "Compression LZO error: %d\n"
+#~ msgstr "Compressie LZO fout: %d\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "\n"
+#~ "%sVersion: %s (%s)\n"
+#~ "\n"
+#~ "Usage: bfdjson [-c config_file] [-d debug_level]\n"
+#~ "        -r <res>    get resource type <res>\n"
+#~ "        -n <name>   get resource <name>\n"
+#~ "        -l <dirs>   get only directives matching dirs (use with -r)\n"
+#~ "        -D          get only data\n"
+#~ "        -c <file>   use <file> as configuration file\n"
+#~ "        -d <nn>     set debug level to <nn>\n"
+#~ "        -dt         print a timestamp in debug output\n"
+#~ "        -t          test configuration file and exit\n"
+#~ "        -v          verbose user messages\n"
+#~ "        -?          print this message.\n"
+#~ "\n"
+#~ msgstr ""
+#~ "\n"
+#~ "Versie: %s (%s) %s %s %s\n"
+#~ "\n"
+#~ "Specificatie: tray-monitor [-c configuratiebestand] [-d debug_level]\n"
+#~ "       -c <file>     gebruik configuratiebestand\n"
+#~ "       -d <nn>       instellen debug level op <nn>\n"
+#~ "       -dt           weergeven tijd in debug output\n"
+#~ "       -t            test - lees configuratie en stop\n"
+#~ "       -?            geef deze melding.\n"
+#~ "\n"
+
+#, fuzzy
+#~ msgid "Error while creating command string %s.\n"
+#~ msgstr ""
+#~ "Fout bij verwerken van opdrachtregel variabelen, maak nu gebruik van "
+#~ "standaard instelling.\n"
+
+#, fuzzy
+#~ msgid "Unable to create snapshot record. ERR=%s\n"
+#~ msgstr "Lees fout op bestand %s. FOUT=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to create snapshot record, got %s\n"
+#~ msgstr "Kan job cond variabele niet initialiseren: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to delete snapshot record. ERR=%s\n"
+#~ msgstr "Kan job cond variabele niet initialiseren: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to delete snapshot record, got %s\n"
+#~ msgstr "Kan job cond variabele niet initialiseren: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to get snapshot record. ERR=%s\n"
+#~ msgstr "Kan job cond variabele niet initialiseren: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to get snapshot record, got %s\n"
+#~ msgstr "Kan job cond variabele niet initialiseren: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to parse command output\n"
+#~ msgstr "Kan de geselecteerde client niet vinden."
+
+#, fuzzy
+#~ msgid "   Unable to delete snapshot of %s ERR=%s\n"
+#~ msgstr "Lees fout op bestand %s. FOUT=%s\n"
+
+#, fuzzy
+#~ msgid "   Create Snapshot for %s\n"
+#~ msgstr "Lees fout op bestand %s. FOUT=%s\n"
+
+#, fuzzy
+#~ msgid "   Unable to create snapshot of %s ERR=%s\n"
+#~ msgstr "Lees fout op bestand %s. FOUT=%s\n"
 
 #, fuzzy
 #~ msgid ""
@@ -930,12 +1203,26 @@ msgstr ""
 #~ msgstr "Job \"%s\" niet gevonden.\n"
 
 #, fuzzy
-#~ msgid "Command: \"%s\" is disabled.\n"
-#~ msgstr "Opdracht mislukt."
+#~ msgid "Connection from unknown Director %s at %s rejected.\n"
+#~ msgstr ""
+#~ "Verbinden met Director %s:%d\n"
+#~ "\n"
 
 #, fuzzy
-#~ msgid "Failed connect from Storage daemon. SD bsock=NULL.\n"
-#~ msgstr "Kan de geselecteerde opslag niet vinden."
+#~ msgid "SD \"%s\" tried to connect two times.\n"
+#~ msgstr "Verbinden met de director mislukt\n"
+
+#, fuzzy
+#~ msgid "Recv caps from SD failed. ERR=%s\n"
+#~ msgstr "Lees fout op bestand %s. FOUT=%s\n"
+
+#, fuzzy
+#~ msgid "Command: \"%s\" is disabled.\n"
+#~ msgstr "Opdracht mislukt."
+
+#, fuzzy
+#~ msgid "VSS CreateSnapshots failed. ERR=%s\n"
+#~ msgstr "Lees fout op bestand %s. FOUT=%s\n"
 
 #~ msgid "LZO init failed\n"
 #~ msgstr "Initialiseren LZO mislukt\n"
@@ -959,6 +1246,14 @@ msgstr ""
 #~ msgstr "Zlib versie fout"
 
 #, fuzzy
+#~ msgid "Write write error on %s: ERR=%s\n"
+#~ msgstr "Lees fout op bestand %s. FOUT=%s\n"
+
+#, fuzzy
+#~ msgid "Director connected %sat: %s\n"
+#~ msgstr "Director niet verbonden."
+
+#, fuzzy
 #~ msgid "Restore Object"
 #~ msgstr "Uitvoeren herstel opdracht"
 
@@ -967,22 +1262,323 @@ msgstr ""
 #~ msgstr "Geen Volumes gevonden om terug te zetten.\n"
 
 #, fuzzy
+#~ msgid "Could not init bsock read mutex. ERR=%s\n"
+#~ msgstr "Kan job cond variabele niet initialiseren: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Could not init bsock write mutex. ERR=%s\n"
+#~ msgstr "Kan job cond variabele niet initialiseren: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Director authorization error at \"%s:%d\"\n"
+#~ msgstr "Geen toegang tot Pool \"%s\"\n"
+
+#, fuzzy
+#~ msgid "Cannot open %s file. %s ERR=%s\n"
+#~ msgstr "Kan job cond variabele niet initialiseren: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Could not open %s file. %s ERR=%s\n"
+#~ msgstr "Kan Client niet vinden %s: ERR=%s"
+
+#, fuzzy
+#~ msgid "Cannot lock %s file. %s ERR=%s\n"
+#~ msgstr "Kan job cond variabele niet initialiseren: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Cannot not open %s file. %s ERR=%s\n"
+#~ msgstr "Kan job cond variabele niet initialiseren: ERR=%s\n"
+
+#, fuzzy
 #~ msgid "User cancel requested.\n"
-#~ msgstr "Terugzetten geannuleerd."
+#~ msgstr "Terugzetten geannuleerd.\n"
 
 #, fuzzy
-#~ msgid "Selection item too large.\n"
-#~ msgstr "Selecteer Pool"
+#~ msgid "Can't run command %s. ERR=%s\n"
+#~ msgstr "Lees fout op bestand %s. FOUT=%s\n"
+
+#, fuzzy
+#~ msgid "Can't create working directory %s. ERR=%s\n"
+#~ msgstr "Lees fout op bestand %s. FOUT=%s\n"
+
+#, fuzzy
+#~ msgid "Can't delete working directory %s. ERR=%s\n"
+#~ msgstr "Lees fout op bestand %s. FOUT=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to create temporary file %s. ERR=%s\n"
+#~ msgstr "Lees fout op bestand %s. FOUT=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to fdopen file %s. ERR=%s\n"
+#~ msgstr "Kan job cond variabele niet initialiseren: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to detect the MySQL data_directory on this system.\n"
+#~ msgstr "Kan job cond variabele niet initialiseren: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to determine the last binlog %s\n"
+#~ msgstr "Kan de geselecteerde client niet vinden."
+
+#, fuzzy
+#~ msgid "Can't get server configuration.\n"
+#~ msgstr "Wijziging van configuratiebestand"
+
+#, fuzzy
+#~ msgid "Unable to get the BINLOG list.\n"
+#~ msgstr "Kan de geselecteerde client niet vinden."
+
+#, fuzzy
+#~ msgid "Unable to determine the last LSN for %s (Previous job is %s)\n"
+#~ msgstr "Kan de geselecteerde client niet vinden."
+
+#, fuzzy
+#~ msgid "Unable to detect datadir from MySQL\n"
+#~ msgstr "Kan de geselecteerde client niet vinden."
+
+#, fuzzy
+#~ msgid "Unable to get last LSN from the backup\n"
+#~ msgstr "Kan job cond variabele niet initialiseren: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "The current LSN is %s\n"
+#~ msgstr "De huidige %s retention periode: %s\n"
+
+#, fuzzy
+#~ msgid "Database \"%s\" already exists. Skipping creation.\n"
+#~ msgstr ""
+#~ "Geprobeerd om \"%s\" aan te maken, maar deze bestaat al. Probeer "
+#~ "opnieuw.\n"
+
+#, fuzzy
+#~ msgid "Unable to parse or to use plugin options, %s\n"
+#~ msgstr "Kan job cond variabele niet initialiseren: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Can't get cluster configuration.\n"
+#~ msgstr "Wijziging van configuratiebestand"
+
+#, fuzzy
+#~ msgid "Can't determine the last WAL file\n"
+#~ msgstr "Kan de geselecteerde client niet vinden."
+
+#, fuzzy
+#~ msgid "Can't open WAL directory %s. ERR=%s\n"
+#~ msgstr "Lees fout op bestand %s. FOUT=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to detect the PostgreSQL data_directory on this system.\n"
+#~ msgstr "Kan job cond variabele niet initialiseren: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to find data_directory=%s on this system. ERR=%s\n"
+#~ msgstr "Kan job cond variabele niet initialiseren: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to start the PITR backup on this system.\n"
+#~ msgstr "Kan job cond variabele niet initialiseren: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to determine the first WAL file on this system.\n"
+#~ msgstr "Kan job cond variabele niet initialiseren: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to analyse tablespaces %s on this system. ERR=%s\n"
+#~ msgstr "Lees fout op bestand %s. FOUT=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to analyse data_directory %s on this system. ERR=%s\n"
+#~ msgstr "Lees fout op bestand %s. FOUT=%s\n"
+
+#, fuzzy
+#~ msgid "Can't create the %s file for recovery. ERR=%s\n"
+#~ msgstr "Lees fout op bestand %s. FOUT=%s\n"
+
+#, fuzzy
+#~ msgid "Error closing device %s. ERR=%s.\n"
+#~ msgstr "Lees fout op bestand %s. FOUT=%s\n"
+
+#, fuzzy
+#~ msgid "DDE commit failed. ERR=%s\n"
+#~ msgstr "Lees fout op bestand %s. FOUT=%s\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "\n"
+#~ "%sVersion: %s (%s)\n"
+#~ "\n"
+#~ "Usage: bcopy [-d debug_level] <input-archive> <output-archive>\n"
+#~ "       -b bootstrap      specify a bootstrap file\n"
+#~ "       -c <file>         specify a Storage configuration file\n"
+#~ "       -d <nn>           set debug level to <nn>\n"
+#~ "       -dt               print timestamp in debug output\n"
+#~ "       -i                specify input Volume names (separated by |)\n"
+#~ "       -o                specify output Volume names (separated by |)\n"
+#~ "       -p                proceed inspite of errors\n"
+#~ "       -v                verbose\n"
+#~ "       -w <dir>          specify working directory (default /tmp)\n"
+#~ "       -?                print this message\n"
+#~ "\n"
+#~ msgstr ""
+#~ "\n"
+#~ "Versie: %s (%s) %s %s %s\n"
+#~ "\n"
+#~ "Specificatie: tray-monitor [-c configuratiebestand] [-d debug_level]\n"
+#~ "       -c <file>     gebruik configuratiebestand\n"
+#~ "       -d <nn>       instellen debug level op <nn>\n"
+#~ "       -dt           weergeven tijd in debug output\n"
+#~ "       -t            test - lees configuratie en stop\n"
+#~ "       -?            geef deze melding.\n"
+#~ "\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "\n"
+#~ "%sVersion: %s (%s)\n"
+#~ "\n"
+#~ "Usage: bextract <options> <bacula-archive-device-name> <directory-to-"
+#~ "store-files>\n"
+#~ "       -b <file>       specify a bootstrap file\n"
+#~ "       -c <file>       specify a Storage configuration file\n"
+#~ "       -d <nn>         set debug level to <nn>\n"
+#~ "       -dt             print timestamp in debug output\n"
+#~ "       -T              send debug traces to trace file\n"
+#~ "       -e <file>       exclude list\n"
+#~ "       -i <file>       include list\n"
+#~ "       -p              proceed inspite of I/O errors\n"
+#~ "       -t              read data from volume, do not write anything\n"
+#~ "       -v              verbose\n"
+#~ "       -V <volumes>    specify Volume names (separated by |)\n"
+#~ "       -?              print this message\n"
+#~ "\n"
+#~ msgstr ""
+#~ "\n"
+#~ "Versie: %s (%s) %s %s %s\n"
+#~ "\n"
+#~ "Specificatie: tray-monitor [-c configuratiebestand] [-d debug_level]\n"
+#~ "       -c <file>     gebruik configuratiebestand\n"
+#~ "       -d <nn>       instellen debug level op <nn>\n"
+#~ "       -dt           weergeven tijd in debug output\n"
+#~ "       -t            test - lees configuratie en stop\n"
+#~ "       -?            geef deze melding.\n"
+#~ "\n"
 
 #, fuzzy
 #~ msgid "Job failed or canceled.\n"
 #~ msgstr "Terugzetten geannuleerd.\n"
 
 #, fuzzy
+#~ msgid "The Volume=%s on device=%s appears to be unlabeled.\n"
+#~ msgstr "Nieuw volume \"%s\" aangemaakt in catalogus.\n"
+
+#, fuzzy
 #~ msgid "Error sending Volume info to Director.\n"
 #~ msgstr "Geen Volumes gevonden om terug te zetten.\n"
 
 #, fuzzy
+#~ msgid ""
+#~ "\n"
+#~ "%sVersion: %s (%s)\n"
+#~ "\n"
+#~ "Usage: bls [options] <device-name>\n"
+#~ "       -b <file>       specify a bootstrap file\n"
+#~ "       -c <file>       specify a Storage configuration file\n"
+#~ "       -d <nn>         set debug level to <nn>\n"
+#~ "       -dt             print timestamp in debug output\n"
+#~ "       -e <file>       exclude list\n"
+#~ "       -i <file>       include list\n"
+#~ "       -j              list jobs\n"
+#~ "       -k              list blocks\n"
+#~ "    (no j or k option) list saved files\n"
+#~ "       -L              dump label\n"
+#~ "       -p              proceed inspite of errors\n"
+#~ "       -v              be verbose\n"
+#~ "       -V              specify Volume names (separated by |)\n"
+#~ "       -E              Check records to detect errors\n"
+#~ "       -?              print this message\n"
+#~ "\n"
+#~ msgstr ""
+#~ "\n"
+#~ "Versie: %s (%s) %s %s %s\n"
+#~ "\n"
+#~ "Specificatie: tray-monitor [-c configuratiebestand] [-d debug_level]\n"
+#~ "       -c <file>     gebruik configuratiebestand\n"
+#~ "       -d <nn>       instellen debug level op <nn>\n"
+#~ "       -dt           weergeven tijd in debug output\n"
+#~ "       -t            test - lees configuratie en stop\n"
+#~ "       -?            geef deze melding.\n"
+#~ "\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "\n"
+#~ "%sVersion: %s (%s)\n"
+#~ "\n"
+#~ "Usage: bsdjson [options] [-c config_file] [config_file]\n"
+#~ "        -r <res>    get resource type <res>\n"
+#~ "        -n <name>   get resource <name>\n"
+#~ "        -l <dirs>   get only directives matching dirs (use with -r)\n"
+#~ "        -D          get only data\n"
+#~ "        -c <file>   use <file> as configuration file\n"
+#~ "        -d <nn>     set debug level to <nn>\n"
+#~ "        -dt         print timestamp in debug output\n"
+#~ "        -t          test - read config and exit\n"
+#~ "        -v          verbose user messages\n"
+#~ "        -?          print this message.\n"
+#~ "\n"
+#~ msgstr ""
+#~ "\n"
+#~ "Versie: %s (%s) %s %s %s\n"
+#~ "\n"
+#~ "Specificatie: tray-monitor [-c configuratiebestand] [-d debug_level]\n"
+#~ "       -c <file>     gebruik configuratiebestand\n"
+#~ "       -d <nn>       instellen debug level op <nn>\n"
+#~ "       -dt           weergeven tijd in debug output\n"
+#~ "       -t            test - lees configuratie en stop\n"
+#~ "       -?            geef deze melding.\n"
+#~ "\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "\n"
+#~ "%sVersion: %s (%s)\n"
+#~ "\n"
+#~ "Usage: btape <options> <device_name>\n"
+#~ "       -b <file>   specify bootstrap file\n"
+#~ "       -c <file>   set configuration file to file\n"
+#~ "       -d <nn>     set debug level to <nn>\n"
+#~ "       -dt         print timestamp in debug output\n"
+#~ "       -p          proceed inspite of I/O errors\n"
+#~ "       -s          turn off signals\n"
+#~ "       -v          be verbose\n"
+#~ "       -?          print this message.\n"
+#~ "\n"
+#~ msgstr ""
+#~ "\n"
+#~ "Versie: %s (%s) %s %s %s\n"
+#~ "\n"
+#~ "Specificatie: tray-monitor [-c configuratiebestand] [-d debug_level]\n"
+#~ "       -c <file>     gebruik configuratiebestand\n"
+#~ "       -d <nn>       instellen debug level op <nn>\n"
+#~ "       -dt           weergeven tijd in debug output\n"
+#~ "       -t            test - lees configuratie en stop\n"
+#~ "       -?            geef deze melding.\n"
+#~ "\n"
+
+#, fuzzy
+#~ msgid "Initializing DDE."
+#~ msgstr "Initialiseren ..."
+
+#, fuzzy
+#~ msgid "Cannot create recovery directory: %s"
+#~ msgstr "Lees fout op bestand %s. FOUT=%s\n"
+
+#, fuzzy
+#~ msgid "Error sending chunk request to client\n"
+#~ msgstr "Geen Volumes gevonden om terug te zetten.\n"
+
+#, fuzzy
 #~ msgid "Unable to init spool mutex: ERR=%s\n"
 #~ msgstr "Kan job cond variabele niet initialiseren: ERR=%s\n"
 
@@ -995,6 +1591,10 @@ msgstr ""
 #~ msgstr "Kan job cond variabele niet initialiseren: ERR=%s\n"
 
 #, fuzzy
+#~ msgid "Unable to init adata mutex: ERR=%s\n"
+#~ msgstr "Kan job cond variabele niet initialiseren: ERR=%s\n"
+
+#, fuzzy
 #~ msgid "Unable to init volcat mutex: ERR=%s\n"
 #~ msgstr "Kan job cond variabele niet initialiseren: ERR=%s\n"
 
@@ -1015,14 +1615,45 @@ msgstr ""
 #~ msgstr "Kan Client niet vinden %s: ERR=%s"
 
 #, fuzzy
+#~ msgid "Could not open aligned volume: %s, ERR=%s\n"
+#~ msgstr "Kan Client niet vinden %s: ERR=%s"
+
+#, fuzzy
 #~ msgid "Recv request to Client failed. ERR=%s\n"
 #~ msgstr "Lees fout op bestand %s. FOUT=%s\n"
 
 #, fuzzy
+#~ msgid "Send caps to Client failed. ERR=%s\n"
+#~ msgstr "Lees fout op bestand %s. FOUT=%s\n"
+
+#, fuzzy
+#~ msgid "Recv caps from Client failed. ERR=%s\n"
+#~ msgstr "Lees fout op bestand %s. FOUT=%s\n"
+
+#, fuzzy
 #~ msgid "Couldn't rewind %s device %s: ERR=%s\n"
 #~ msgstr "Kan Client niet vinden %s: ERR=%s"
 
 #, fuzzy
+#~ msgid ""
+#~ "Got Aligned or File type Volume %s on Dedup device %s. Wanted File.\n"
+#~ msgstr "Nieuw volume \"%s\" aangemaakt in catalogus.\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "Got Aligned or Dedup type Volume %s on File device %s. Wanted File.\n"
+#~ msgstr "Nieuw volume \"%s\" aangemaakt in catalogus.\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "Got File or Dedup type Volume %s on Aligned device %s. Wanted Aligned.\n"
+#~ msgstr "Nieuw volume \"%s\" aangemaakt in catalogus.\n"
+
+#, fuzzy
+#~ msgid "Could not reserve volume %s on %s device %s\n"
+#~ msgstr "Kan Client niet vinden %s: ERR=%s"
+
+#, fuzzy
 #~ msgid "Rewind error on %s device %s: ERR=%s\n"
 #~ msgstr "Lees fout op bestand %s. FOUT=%s\n"
 
@@ -1032,14 +1663,14 @@ msgstr ""
 
 #, fuzzy
 #~ msgid "Unable to write %s device %s: ERR=%s\n"
-#~ msgstr "Kan job cond variabele niet initialiseren: ERR=%s\n"
+#~ msgstr "Lees fout op bestand %s. FOUT=%s\n"
 
 #, fuzzy
 #~ msgid "Unable to position to end of data on %s device %s: ERR=%s\n"
 #~ msgstr "Kan job cond variabele niet initialiseren: ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Volume \"%s\" not on %s device %s.\n"
+#~ msgid "Volume \"%s\" not loaded on %s device %s.\n"
 #~ msgstr "Job \"%s\" niet gevonden.\n"
 
 #, fuzzy
@@ -1047,20 +1678,57 @@ msgstr ""
 #~ msgstr "Nieuw volume \"%s\" aangemaakt in catalogus.\n"
 
 #, fuzzy
-#~ msgid "Failed to connect to mailhost %s\n"
-#~ msgstr "Verbinden met de director mislukt\n"
+#~ msgid "Error sending header to Client. ERR=%s\n"
+#~ msgstr "Geen Volumes gevonden om terug te zetten.\n"
 
+#, fuzzy
+#~ msgid "Error sending data to Client. ERR=%s\n"
+#~ msgstr "Geen Volumes gevonden om terug te zetten.\n"
+
+#, fuzzy
 #~ msgid ""
-#~ "Cancel: %s\n"
 #~ "\n"
-#~ "%s"
+#~ "%sVersion: %s (%s)\n"
+#~ "\n"
+#~ "Usage: bacula-sd [options] [-c config_file] [config_file]\n"
+#~ "     -c <file>         use <file> as configuration file\n"
+#~ "     -d <nn>[,<tags>]  set debug level to <nn>, debug tags to <tags>\n"
+#~ "     -dt               print timestamp in debug output\n"
+#~ "     -f                run in foreground (for debugging)\n"
+#~ "     -g <group>        set groupid to group\n"
+#~ "     -m                print kaboom output (for debugging)\n"
+#~ "     -p                proceed despite I/O errors\n"
+#~ "     -s                no signals (for debugging)\n"
+#~ "     -t                test - read config and exit\n"
+#~ "     -u <user>         userid to <user>\n"
+#~ "     -v                verbose user messages\n"
+#~ "     -?                print this message.\n"
+#~ "\n"
 #~ msgstr ""
-#~ "Anuleer: %s\n"
 #~ "\n"
-#~ "%s"
+#~ "Versie: %s (%s) %s %s %s\n"
+#~ "\n"
+#~ "Specificatie: tray-monitor [-c configuratiebestand] [-d debug_level]\n"
+#~ "       -c <file>     gebruik configuratiebestand\n"
+#~ "       -d <nn>       instellen debug level op <nn>\n"
+#~ "       -dt           weergeven tijd in debug output\n"
+#~ "       -t            test - lees configuratie en stop\n"
+#~ "       -?            geef deze melding.\n"
+#~ "\n"
 
-#~ msgid "Confirm cancel?"
-#~ msgstr "Bevestig annulering?"
+#, fuzzy
+#~ msgid "Unable to stat ControlDevice %s: ERR=%s\n"
+#~ msgstr "Kan job cond variabele niet initialiseren: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Failed to connect to mailhost %s\n"
+#~ msgstr "Verbinden met de director mislukt\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "ERROR %s\n"
+#~ "\n"
+#~ msgstr "FOUT"
 
 #~ msgid ""
 #~ "\n"
@@ -1071,9 +1739,24 @@ msgstr ""
 #~ "\n"
 #~ "Bacula FOUT: "
 
+#, fuzzy
+#~ msgid "Unable to resolve parent path for %ls\n"
+#~ msgstr "Kan de geselecteerde client niet vinden."
+
+#, fuzzy
+#~ msgid "Unable to parse user supplied restore configuration\n"
+#~ msgstr "Kan configuratiebestand niet lezen"
+
+#~ msgid "Bad Command Line Option"
+#~ msgstr "Onjuiste opdrachtregel optie"
+
 #~ msgid "KERNEL32.DLL not found: Bacula service not started"
 #~ msgstr "KERNEL32.DLL niet gevonden. Bacula service niet gestart"
 
+#, fuzzy
+#~ msgid "Registry service not found: Bacula service not started"
+#~ msgstr "KERNEL32.DLL niet gevonden. Bacula service niet gestart"
+
 #~ msgid "Unable to install the service"
 #~ msgstr "Kan de service niet installeren"
 
@@ -1086,6 +1769,10 @@ msgstr ""
 #~ msgid "The Bacula service: "
 #~ msgstr "De Bacula service:"
 
+#, fuzzy
+#~ msgid "Cannot write System Registry for "
+#~ msgstr "Kan Bacula sleutel niet aan Systeem Register toevoegen"
+
 #~ msgid "Cannot add Bacula key to System Registry"
 #~ msgstr "Kan Bacula sleutel niet aan Systeem Register toevoegen"
 
@@ -1111,19 +1798,16 @@ msgstr ""
 #~ "%s fout: %ld op %s:%d"
 
 #, fuzzy
-#~ msgid "Config file editor"
-#~ msgstr "Configuratiebestand"
-
-#~ msgid "Save and close"
-#~ msgstr "Opslaan en afsluiten"
+#~ msgid "Storage from Job's NextPool resource"
+#~ msgstr "Selecteer Pool"
 
 #, fuzzy
-#~ msgid "Unable to write to %s\n"
-#~ msgstr "Kan de service niet installeren"
+#~ msgid "Selection item too large.\n"
+#~ msgstr "Selecteer Pool"
 
 #, fuzzy
-#~ msgid "Enter restore mode"
-#~ msgstr "Terugzetten afbreken"
+#~ msgid "Confirm %s (yes/no): "
+#~ msgstr "Bevestig annulering (yes/no)"
 
 #~ msgid "Cancel restore"
 #~ msgstr "Terugzetten afbreken"
@@ -1161,10 +1845,6 @@ msgstr ""
 #~ msgid "Job Name"
 #~ msgstr "Naam opdracht:"
 
-#, fuzzy
-#~ msgid "Fileset"
-#~ msgstr "Bestandsnaam"
-
 #~ msgid "Please configure parameters concerning files to restore :"
 #~ msgstr "Configureer parameters voor het terugzetten van bestanden aub :"
 
@@ -1180,97 +1860,24 @@ msgstr ""
 #~ msgid "never"
 #~ msgstr "nooit"
 
-#, fuzzy
-#~ msgid "Please configure parameters concerning files restoration :"
-#~ msgstr "Configureer parameters voor het terugzetten van bestanden aub :"
-
-#, fuzzy
-#~ msgid "Error : no clients returned by the director."
-#~ msgstr "Verbonden met de director."
-
-#, fuzzy
-#~ msgid "Error : no storage returned by the director."
-#~ msgstr "Verbonden met de director."
-
-#, fuzzy
-#~ msgid "Error : no jobs returned by the director."
-#~ msgstr "Verbonden met de director."
-
-#, fuzzy
-#~ msgid "RestoreFiles"
-#~ msgstr "Terugzetten geannuleerd."
-
-#, fuzzy
-#~ msgid "Please select a client."
-#~ msgstr "Kan de geselecteerde client niet vinden."
-
-#, fuzzy
-#~ msgid "Please select a restore date."
-#~ msgstr "Kiest u een director (1-%d): "
-
-#, fuzzy
-#~ msgid "Unexpected question has been received.\n"
-#~ msgstr "<< Onverwacht signaal ontvangen : "
-
-#, fuzzy
-#~ msgid " files selected to be restored."
-#~ msgstr "Geen Volumes gevonden om terug te zetten.\n"
-
-#, fuzzy
-#~ msgid " file selected to be restored."
-#~ msgstr "Selecteer Job media:"
-
-#, fuzzy
-#~ msgid "Please configure your restore (%ld files selected to be restored)..."
-#~ msgstr "Configureer parameters voor het terugzetten van bestanden aub :"
-
-#, fuzzy
-#~ msgid "Restore failed : no file selected.\n"
-#~ msgstr "Kan de geselecteerde client niet vinden."
-
-#, fuzzy
-#~ msgid "Restore failed : no file selected."
-#~ msgstr "Kan de geselecteerde client niet vinden."
-
-#, fuzzy
-#~ msgid "Restoring, please wait..."
-#~ msgstr "Terugzetten..."
-
 #~ msgid "Job failed."
 #~ msgstr "Job mislukt."
 
-#, fuzzy
-#~ msgid "Restore job terminated successfully."
-#~ msgstr "Terugzetten succesvol."
-
-#, fuzzy
-#~ msgid "Restore job terminated successfully.\n"
-#~ msgstr "Terugzetten succesvol.\n"
-
-#, fuzzy
-#~ msgid "Restore job cancelled by user."
-#~ msgstr "Terugzetten geannuleerd."
-
-#, fuzzy
-#~ msgid "Restore job cancelled by user.\n"
-#~ msgstr "Terugzetten geannuleerd."
-
 #~ msgid "Restore done successfully.\n"
 #~ msgstr "Terugzetten succesvol.\n"
 
 #~ msgid "Restore done successfully."
 #~ msgstr "Terugzetten succesvol."
 
-#, fuzzy
-#~ msgid "Applying restore configuration changes..."
-#~ msgstr "Corrigeer configuratie bestand aub.\n"
-
 #~ msgid "Failed to find the selected client."
 #~ msgstr "Kan de geselecteerde client niet vinden."
 
 #~ msgid "Failed to find the selected fileset."
 #~ msgstr "Kan de geselecteerde fileset niet vinden."
 
+#~ msgid "Run Restore job"
+#~ msgstr "Uitvoeren herstel opdracht"
+
 #~ msgid "Restore cancelled."
 #~ msgstr "Terugzetten geannuleerd."
 
@@ -1280,77 +1887,15 @@ msgstr ""
 #~ msgid "No backup found for this client."
 #~ msgstr "Geen backup gevonden voor deze client."
 
-#~ msgid "ERROR"
-#~ msgstr "FOUT"
-
-#, fuzzy
-#~ msgid "Query failed"
-#~ msgstr "Job mislukt."
-
 #~ msgid "Cannot get previous backups list, see console."
 #~ msgstr "Kan vorige backuplijst niet ophalen, zie console."
 
 #~ msgid "JobName:"
 #~ msgstr "JobNaam:"
 
-#, fuzzy
-#~ msgid "ifnewer"
-#~ msgstr "indien nieuwer"
-
-#, fuzzy
-#~ msgid "ifolder"
-#~ msgstr "indien ouder"
-
-#, fuzzy
-#~ msgid "FileSet:"
-#~ msgstr "Bestandsnaam"
-
-#, fuzzy
-#~ msgid "Client:"
-#~ msgstr "Client"
-
-#, fuzzy
-#~ msgid "Storage:"
-#~ msgstr "Opslag"
-
 #~ msgid "Restoring..."
 #~ msgstr "Terugzetten..."
 
-#~ msgid "Please correct configuration file.\n"
-#~ msgstr "Corrigeer configuratie bestand aub.\n"
-
-#, fuzzy
-#~ msgid "Error : No configuration file loaded\n"
-#~ msgstr "Wijzigen configuratiebestand"
-
-#~ msgid "Connecting...\n"
-#~ msgstr "Verbinding maken ...\n"
-
-#~ msgid "Error : No director defined in config file.\n"
-#~ msgstr "Fout : Geen director gevonden in uw configuratie.\n"
-
-#~ msgid "Multiple directors found in your config file.\n"
-#~ msgstr "Meerdere directors gevonden in uw configuratiebestand.\n"
-
-#~ msgid "Please choose a director (1-%d): "
-#~ msgstr "Kiest u een director (1-%d): "
-
-#, fuzzy
-#~ msgid "Failed to connect to the director\n"
-#~ msgstr "Verbinding naar director opnieuw opzetten"
-
-#~ msgid "Connected\n"
-#~ msgstr "Verbonden\n"
-
-#~ msgid "<< Unexpected signal received : "
-#~ msgstr "<< Onverwacht signaal ontvangen : "
-
-#~ msgid "Connection terminated\n"
-#~ msgstr "Verbinding verbroken\n"
-
-#~ msgid "Apply"
-#~ msgstr "Toepassen"
-
 #~ msgid "Type your command below:"
 #~ msgstr "Voer uw opdracht hieronder in:"
 
@@ -1396,13 +1941,32 @@ msgstr ""
 #~ msgid "&Help"
 #~ msgstr "&Help"
 
+#~ msgid "Welcome to bacula bwx-console %s (%s)!\n"
+#~ msgstr "Welkom bij het bacula bwx-console %s (%s)!\n"
+
+#~ msgid ""
+#~ "Warning : Unicode is disabled because you are using wxWidgets for GTK+ "
+#~ "1.2.\n"
+#~ msgstr ""
+#~ "Waarschuwing : Unicode is niet actief omdat u wxWidgets for GTK+ 1.2 "
+#~ "gebruikt.\n"
+
 #~ msgid "Send"
 #~ msgstr "Versturen"
 
-#~ msgid "Error while parsing command line arguments, using defaults.\n"
+#~ msgid "Usage: bwx-console [-c configfile] [-w tmp]\n"
+#~ msgstr "Specificatie: bwx-console [-c configuratiebestand] [-w tmp]\n"
+
+#~ msgid ""
+#~ "It seems that it is the first time you run bwx-console.\n"
+#~ "This file (%s) has been choosen as default configuration file.\n"
+#~ "Do you want to edit it? (if you click No you will have to select another "
+#~ "file)"
 #~ msgstr ""
-#~ "Fout bij verwerken van opdrachtregel variabelen, maak nu gebruik van "
-#~ "standaard instelling.\n"
+#~ "Waarschijnlijk gebruikt u bwx-console voor de eerste keer.\n"
+#~ "Dit bestand (%s) is ingesteld als uw standaard configuratiebestand.\n"
+#~ "Wilt u dit wijzigen? (Als u Nee selecteert dan moet u een ander bestand "
+#~ "selecteren)"
 
 #~ msgid "First run"
 #~ msgstr "Eerste run"
@@ -1416,9 +1980,6 @@ msgstr ""
 #~ " niet lezenFout: %s\n"
 #~ "Wilt u een andere kiezen? (Toets nee om het bestand te wijzigen)"
 
-#~ msgid "Unable to read configuration file"
-#~ msgstr "Kan configuratiebestand niet lezen"
-
 #~ msgid "Please choose a configuration file to use"
 #~ msgstr "Kies een configuratiebestand om te gebruiken"
 
@@ -1441,6 +2002,18 @@ msgstr ""
 #~ msgid "Quitting.\n"
 #~ msgstr "Bezig met afsluiten.\n"
 
+#~ msgid ""
+#~ "Welcome to Bacula bwx-console.\n"
+#~ "Written by Nicolas Boichat <nicolas at boichat.ch>\n"
+#~ "Copyright (C), 2005-2007 Free Software Foundation Europe, e.V.\n"
+#~ msgstr ""
+#~ "Welkom bij Bacula bwx-console.\n"
+#~ "Geschreven door Nicolas Boichat <nicolas at boichat.ch>\n"
+#~ "Copyright (C), 2005-2007 Free Software Foundation Europe, e.V.\n"
+
+#~ msgid "About Bacula bwx-console"
+#~ msgstr "Over Bacula bwx-console"
+
 #~ msgid "Please choose your default configuration file"
 #~ msgstr "Kies aub uw standaard configuratiebestand"
 
@@ -1471,18 +2044,75 @@ msgstr ""
 #~ msgid "Disconnected of the director."
 #~ msgstr "Verbinding verbroken met director"
 
+#~ msgid "bwx-console: unexpected director's question."
+#~ msgstr "bwx-console: onverwachte director's opdracht"
+
+#~ msgid "Save and close"
+#~ msgstr "Opslaan en afsluiten"
+
+#~ msgid "Apply"
+#~ msgstr "Toepassen"
+
+#~ msgid "Please correct configuration file.\n"
+#~ msgstr "Corrigeer configuratie bestand aub.\n"
+
+#~ msgid "Connecting...\n"
+#~ msgstr "Verbinding maken ...\n"
+
+#~ msgid "Error : No director defined in config file.\n"
+#~ msgstr "Fout : Geen director gevonden in uw configuratie.\n"
+
+#~ msgid "Multiple directors found in your config file.\n"
+#~ msgstr "Meerdere directors gevonden in uw configuratiebestand.\n"
+
+#~ msgid "Please choose a director (1-%d): "
+#~ msgstr "Kiest u een director (1-%d): "
+
+#~ msgid "Connected\n"
+#~ msgstr "Verbonden\n"
+
+#~ msgid "<< Unexpected signal received : "
+#~ msgstr "<< Onverwacht signaal ontvangen : "
+
+#~ msgid "Connection terminated\n"
+#~ msgstr "Verbinding verbroken\n"
+
 #, fuzzy
-#~ msgid "Unable to create component file %s. ERR=%s\n"
+#~ msgid "Unable to read %s. ERR=%s\n"
 #~ msgstr "Lees fout op bestand %s. FOUT=%s\n"
 
 #, fuzzy
-#~ msgid "Unable to fdopen component file %s. ERR=%s\n"
-#~ msgstr "Kan job cond variabele niet initialiseren: ERR=%s\n"
+#~ msgid "Unable to write to %s to save full job name. ERR=%s\n"
+#~ msgstr "Lees fout op bestand %s. FOUT=%s\n"
 
 #, fuzzy
-#~ msgid "Error writing component file.\n"
-#~ msgstr "Fout bij schrijven van bsr bestand.\n"
+#~ msgid "Unable to save last controlfile into file %s. ERR=%s\n"
+#~ msgstr "Lees fout op bestand %s. FOUT=%s\n"
 
 #, fuzzy
-#~ msgid "ComponentInfo failed.\n"
-#~ msgstr "Opdracht mislukt."
+#~ msgid "Unable to create  %s "
+#~ msgstr "Lees fout op bestand %s. FOUT=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to save last SCN into file %s. ERR=%s\n"
+#~ msgstr "Lees fout op bestand %s. FOUT=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to list schema for %s. exitcode=%d\n"
+#~ msgstr "Kan de service niet installeren"
+
+#, fuzzy
+#~ msgid "Unable to open %s to save RMAN output. ERR=%s\n"
+#~ msgstr "Kan job cond variabele niet initialiseren: ERR=%s\n"
+
+#~ msgid ""
+#~ "Cancel: %s\n"
+#~ "\n"
+#~ "%s"
+#~ msgstr ""
+#~ "Anuleer: %s\n"
+#~ "\n"
+#~ "%s"
+
+#~ msgid "Confirm cancel?"
+#~ msgstr "Bevestig annulering?"
diff --git a/po/pl.po b/po/pl.po
index 9031b7e..1d22335 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -1,7 +1,9 @@
 # bacula translations
 # Copyright (C) 2010 Inteos Sp. z o.o.
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # Translated by Inteos Translation Team: pl at inteos.pl
-# This file is distributed under the same license as the bacula package.
 #
 msgid ""
 msgstr ""
@@ -15,7 +17,7 @@ msgstr ""
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-#: src/dird/authenticate.c:127
+#: src/wx-console/authenticate.c:127 src/dird/authenticate.c:127
 #: src/console/authenticate.c:125
 msgid ""
 "Authorization problem: Remote server did not advertise required TLS "
@@ -24,22 +26,27 @@ msgstr ""
 "Problem autoryzacji: Zdalny serwer nie zadeklarował wymaganego wsparcia dla "
 "TLS.\n"
 
-#: src/filed/authenticate.c:159
+#: src/wx-console/authenticate.c:133 src/filed/authenticate.c:159
 #: src/filed/authenticate.c:278 src/dird/authenticate.c:134
 #: src/console/authenticate.c:132 src/stored/authenticate.c:147
 #: src/stored/authenticate.c:258
 msgid "Authorization problem: Remote server requires TLS.\n"
 msgstr "Problem autoryzacji: Zdalny serwer wymaga TLS.\n"
 
-#: src/console/authenticate.c:141
+#: src/wx-console/authenticate.c:142 src/console/authenticate.c:141
 msgid "TLS negotiation failed\n"
 msgstr "Negocjacja TLS nie powiodła się\n"
 
+#: src/wx-console/authenticate.c:150
+msgid "Bad response to Hello command: ERR="
+msgstr "Zła odpowiedź na komend Hello: ERR="
+
+#: src/wx-console/authenticate.c:157 src/tray-monitor/authenticate.c:104
 #: src/console/authenticate.c:162
 msgid "Director rejected Hello command\n"
 msgstr "Director odrzucił komendę Hello\n"
 
-#: src/console/authenticate.c:172
+#: src/wx-console/authenticate.c:167 src/console/authenticate.c:172
 msgid ""
 "Director authorization problem.\n"
 "Most likely the passwords do not agree.\n"
@@ -55,23 +62,25 @@ msgstr ""
 "Zobacz http://www.bacula.org/en/rel-manual/Bacula_Freque_Asked_Questi."
 "html#SECTION003760000000000000000 w celu uzyskania pomocy.\n"
 
-#: src/console/console_conf.c:140
+#: src/wx-console/console_conf.c:147 src/console/console_conf.c:140
 #: src/qt-console/bat_conf.cpp:141
 #, c-format
 msgid "No record for %d %s\n"
 msgstr "Brak rekordu dla %d %s\n"
 
-#: src/console/console_conf.c:149
+#: src/wx-console/console_conf.c:156 src/console/console_conf.c:149
 #, c-format
 msgid "Console: name=%s rcfile=%s histfile=%s\n"
 msgstr "Konsola: nazwa=%s plikrc=%s plikhist=%s\n"
 
-#: src/console/console_conf.c:153
+#: src/wx-console/console_conf.c:160 src/console/console_conf.c:153
 #: src/qt-console/bat_conf.cpp:150
 #, c-format
 msgid "Director: name=%s address=%s DIRport=%d\n"
 msgstr "Director: nazwa=%s adres=%s DIRport=%d\n"
 
+#: src/wx-console/console_conf.c:164 src/wx-console/console_conf.c:239
+#: src/wx-console/console_conf.c:284 src/wx-console/console_conf.c:311
 #: src/filed/filed_conf.c:333 src/filed/filed_conf.c:398
 #: src/filed/filed_conf.c:428 src/console/console_conf.c:157
 #: src/console/console_conf.c:233 src/console/console_conf.c:278
@@ -83,16 +92,16 @@ msgstr "Director: nazwa=%s adres=%s DIRport=%d\n"
 msgid "Unknown resource type %d\n"
 msgstr "Nieznany rodzaj zasobu %d\n"
 
-#: src/filed/filed_conf.c:361
-#: src/dird/dird_conf.c:1371
+#: src/wx-console/console_conf.c:265 src/filed/filed_conf.c:361
+#: src/tray-monitor/tray_conf.c:288 src/dird/dird_conf.c:1371
 #: src/dird/dird_conf.c:1386 src/console/console_conf.c:259
 #: src/qt-console/bat_conf.cpp:265
 #, c-format
 msgid "%s item is required in %s resource, but not found.\n"
 msgstr "Element %s jest wymagany w zasobie %s, lecz nie został znaleziony.\n"
 
-#: src/filed/filed_conf.c:446
-#: src/dird/dird_conf.c:1609
+#: src/wx-console/console_conf.c:328 src/filed/filed_conf.c:446
+#: src/tray-monitor/tray_conf.c:372 src/dird/dird_conf.c:1609
 #: src/console/console_conf.c:322 src/qt-console/bat_conf.cpp:334
 #, c-format
 msgid "Attempt to define second %s resource named \"%s\" is not permitted.\n"
@@ -1077,7 +1086,7 @@ msgstr "Za komenda session: %s"
 msgid "Bad storage command: %s"
 msgstr "Za komenda storage: %s"
 
-#: src/filed/job.c:1479
+#: src/filed/job.c:1479 src/tray-monitor/tray-monitor.c:952
 #: src/dird/msgchan.c:106
 msgid "Storage daemon"
 msgstr "Demon Skadowania"
@@ -1363,12 +1372,13 @@ msgid "Diffs"
 msgstr "Rnice"
 
 #: src/filed/status.c:296 src/dird/ua_status.c:868 src/dird/ua_restore.c:430
-#: src/stored/status.c:547
+#: src/stored/status.c:547 src/wx-console/wxbconfigpanel.cpp:220
 msgid "Cancel"
 msgstr "Anulowane"
 
 #: src/filed/status.c:299 src/lib/util.c:189 src/lib/util.c:321
 #: src/dird/ua_status.c:871 src/stored/btape.c:1514 src/stored/status.c:550
+#: src/wx-console/wxbconfigpanel.cpp:209
 msgid "OK"
 msgstr "OK"
 
@@ -1631,8 +1641,8 @@ msgstr "Brak definicji zasobu Messages w %s\n"
 #: src/filed/filed.c:355 src/filed/filed.c:514 src/dird/dird.c:625
 #: src/dird/dird.c:831 src/dird/dird.c:886 src/dird/dird.c:1044
 #: src/console/console.c:1291 src/console/console.c:1321
-#: src/stored/stored.c:381
-#: src/qt-console/main.cpp:212
+#: src/stored/stored.c:381 src/wx-console/console_thread.cpp:118
+#: src/wx-console/console_thread.cpp:144 src/qt-console/main.cpp:212
 #: src/qt-console/main.cpp:242
 msgid "TLS required but not configured in Bacula.\n"
 msgstr "Wymagane TLS lecz nie zostao skonfigurowane w Baculi.\n"
@@ -1735,67 +1745,488 @@ msgstr ""
 msgid "Failed to initialize TLS context for Director \"%s\" in %s.\n"
 msgstr "Nieudana inicjalizacja kontekstu TLS dla Dyrektora \"%s\" w %s.\n"
 
-#: src/dird/dird_conf.c:558
+#: src/tray-monitor/tray_conf.c:168 src/dird/dird_conf.c:558
 #, c-format
 msgid "No %s resource defined\n"
 msgstr "Nie zdefiniowano zasobu %s\n"
 
-#: src/qt-console/bat_conf.cpp:157
+#: src/tray-monitor/tray_conf.c:177
+#, c-format
+msgid "Monitor: name=%s FDtimeout=%s SDtimeout=%s\n"
+msgstr "Monitor: nazwa=%s FDtimeout=%s SDtimeout=%s\n"
+
+#: src/tray-monitor/tray_conf.c:183
+#, c-format
+msgid "Director: name=%s address=%s FDport=%d\n"
+msgstr "Dyrektor: nazwa=%s adres=%s FDport=%d\n"
+
+#: src/tray-monitor/tray_conf.c:187
+#, c-format
+msgid "Client: name=%s address=%s FDport=%d\n"
+msgstr "Klient: nazwa=%s adres=%s FDport=%d\n"
+
+#: src/tray-monitor/tray_conf.c:191
+#, c-format
+msgid "Storage: name=%s address=%s SDport=%d\n"
+msgstr "Storage: nazwa=%s adres=%s SDport=%d\n"
+
+#: src/tray-monitor/tray_conf.c:195 src/qt-console/bat_conf.cpp:157
 #, c-format
 msgid "ConsoleFont: name=%s font face=%s\n"
 msgstr "ConsoleFont: nazwa=%s krj czcionki=%s\n"
 
-#: src/dird/dird_conf.c:1008
+#: src/tray-monitor/tray_conf.c:199 src/dird/dird_conf.c:1008
 #, c-format
 msgid "Unknown resource type %d in dump_resource.\n"
 msgstr "Nieznany typ zasobu %d w dump_resource.\n"
 
-#: src/dird/dird_conf.c:1339
+#: src/tray-monitor/tray_conf.c:257 src/dird/dird_conf.c:1339
 #, c-format
 msgid "Unknown resource type %d in free_resource.\n"
 msgstr "Nieznany typ zasobu %d w free_resource.\n"
 
-#: src/lib/parse_conf.c:224
+#: src/tray-monitor/tray_conf.c:294 src/lib/parse_conf.c:224
 #: src/dird/dird_conf.c:1377
 #, c-format
 msgid "Too many items in %s resource\n"
 msgstr "Zbyt duo elementw w zasobie %s\n"
 
+#: src/tray-monitor/tray_conf.c:314 src/tray-monitor/tray_conf.c:352
 #: src/dird/dird_conf.c:1526 src/dird/dird_conf.c:1586
 #, c-format
 msgid "Unknown resource type %d in save_resource.\n"
 msgstr "Nieznany typ zasobu %d w save_resource.\n"
 
-#: src/console/authenticate.c:155
+#: src/tray-monitor/authenticate.c:88
+msgid ""
+"Director authorization problem.\n"
+"Most likely the passwords do not agree.\n"
+"Please see http://www.bacula.org/en/rel-manual/Bacula_Freque_Asked_Questi."
+"html#SECTION003760000000000000000 for help.\n"
+msgstr ""
+"Problem autoryzacji Dyrektora.\n"
+"Najprawdopodobniej nie zgadzaj się hasa.\n"
+"Proszę zobacz http://www.bacula.org/en/rel-manual/Bacula_Freque_Asked_Questi."
+"html#SECTION003760000000000000000 dla uzyskania pomocy.\n"
+
+#: src/tray-monitor/authenticate.c:97 src/console/authenticate.c:155
 #, c-format
 msgid "Bad response to Hello command: ERR=%s\n"
 msgstr "Za odpowiedź na komend Hello: ERR=%s\n"
 
-#: src/dird/authenticate.c:83
+#: src/tray-monitor/authenticate.c:132 src/dird/authenticate.c:83
 #: src/dird/authenticate.c:84
 #, c-format
 msgid "Error sending Hello to Storage daemon. ERR=%s\n"
 msgstr "Błąd w wysyaniu Hello do demona Przechowywania. ERR=%s\n"
 
-#: src/dird/authenticate.c:266
+#: src/tray-monitor/authenticate.c:138
+msgid ""
+"Director and Storage daemon passwords or names not the same.\n"
+"Please see http://www.bacula.org/en/rel-manual/Bacula_Freque_Asked_Questi."
+"html#SECTION003760000000000000000 for help.\n"
+msgstr ""
+"Hasła demonów Dyrektora i Przechowywania nie s takie same.\n"
+"Proszę zobacz http://www.bacula.org/en/rel-manual/Bacula_Freque_Asked_Questi."
+"html#SECTION003760000000000000000 dla uzyskania pomocy.\n"
+
+#: src/tray-monitor/authenticate.c:145
+msgid "bdird<stored: bad response to Hello command: ERR=%s\n"
+msgstr "bdird<stored: zła odpowiedź na komendę Hello: ERR=%s\n"
+
+#: src/tray-monitor/authenticate.c:152 src/dird/authenticate.c:162
+msgid "Storage daemon rejected Hello command\n"
+msgstr "Demon Przechowywania odrzuci komend Hello\n"
+
+#: src/tray-monitor/authenticate.c:178
+#, c-format
+msgid "Error sending Hello to File daemon. ERR=%s\n"
+msgstr "Błąd w wysyaniu Hello do demona Plików. ERR=%s\n"
+
+#: src/tray-monitor/authenticate.c:184
+msgid ""
+"Director and File daemon passwords or names not the same.\n"
+"Please see http://www.bacula.org/en/rel-manual/Bacula_Freque_Asked_Questi."
+"html#SECTION003760000000000000000 for help.\n"
+msgstr ""
+"Hasła demonów Dyrektora i Plików nie s takie same.\n"
+"Proszę zobacz http://www.bacula.org/en/rel-manual/Bacula_Freque_Asked_Questi."
+"html#SECTION003760000000000000000 dla uzyskania pomocy.\n"
+
+#: src/tray-monitor/authenticate.c:191 src/dird/authenticate.c:266
 #, c-format
 msgid "Bad response from File daemon to Hello command: ERR=%s\n"
 msgstr "Za odpowiedź z demona Plików na komend Hello: ERR=%s\n"
 
-#: src/dird/authenticate.c:277
+#: src/tray-monitor/authenticate.c:198 src/dird/authenticate.c:277
 msgid "File daemon rejected Hello command\n"
 msgstr "Demona Plików odrzuci komend Hello\n"
 
-#: src/console/console.c:1138
+#: src/tray-monitor/tray-monitor.c:114
+msgid ""
+"Written by Nicolas Boichat (2004)\n"
+"\n"
+"Version: %s (%s) %s %s %s\n"
+"\n"
+"Usage: tray-monitor [-c config_file] [-d debug_level]\n"
+"       -c <file>     set configuration file to file\n"
+"       -d <nn>       set debug level to <nn>\n"
+"       -dt           print timestamp in debug output\n"
+"       -t            test - read configuration and exit\n"
+"       -?            print this message.\n"
+"\n"
+msgstr ""
+"Napisany przez Nicolas Boichat (2004)\n"
+"\n"
+"Wersja: %s (%s) %s %s %s\n"
+"\n"
+"Użycie: tray-monitor [-c config_file] [-d debug_level]\n"
+"       -c <file>     ustaw plik konfiguracyjny na <file>\n"
+"       -d <nn>       ustaw poziom debugowania na <nn>\n"
+"       -dt           wyświetla znaczniki czasowe w debugingu\n"
+"       -t            test - odczytuje konfigurację i kończy działanie\n"
+"       -?            wyświetla ten komunikat.\n"
+"\n"
+
+#: src/tray-monitor/tray-monitor.c:270
+#, c-format
+msgid ""
+"Error: %d Monitor resources defined in %s. You must define one and only one "
+"Monitor resource.\n"
+msgstr ""
+"Bd: zdefiniowano %d zasoby Monitor w %s. Musisz zdefiniowa wycznie jeden i "
+"tylko jeden zasób Monitora.\n"
+
+#: src/tray-monitor/tray-monitor.c:301
+#, c-format
+msgid ""
+"No Client, Storage or Director resource defined in %s\n"
+"Without that I don't how to get status from the File, Storage or Director "
+"Daemon :-(\n"
+msgstr ""
+"Brak definicji zasobu Klienta, Przechowywania lub Dyrektora w %s\n"
+"Bez tego nie wiem jak mam otrzyma status z demonów Plików, Przechowywania i "
+"Dyrektora. :-(\n"
+
+#: src/tray-monitor/tray-monitor.c:323
+#, c-format
+msgid ""
+"Invalid refresh interval defined in %s\n"
+"This value must be greater or equal to 1 second and less or equal to 10 "
+"minutes (read value: %d).\n"
+msgstr ""
+"Niepoprawny interwa czasu zdefiniowany w %s\n"
+"Warto ta musi by wiksza lub rwna 1 sekundzie i mniejsza lub rwna 10 minutom "
+"(odczytana warto: %d).\n"
+
+#: src/tray-monitor/tray-monitor.c:330
+msgid "Bacula daemon status monitor"
+msgstr "Monitor statusu demona Bacula"
+
+#: src/tray-monitor/tray-monitor.c:339
+msgid "Open status window..."
+msgstr "Otwrz okno statusu..."
+
+#: src/tray-monitor/tray-monitor.c:345
+msgid "Exit"
+msgstr "Wyjcie"
+
+# Tray to tacka - nie do końca mi to pasuje: "Tackowy Monitor Baculi"
+#: src/tray-monitor/tray-monitor.c:357
+msgid "Bacula tray monitor"
+msgstr "Tackowy monitor Baculi"
+
+#: src/tray-monitor/tray-monitor.c:382
+msgid " (DIR)"
+msgstr " (DIR)"
+
+#: src/tray-monitor/tray-monitor.c:386
+msgid " (FD)"
+msgstr " (FD)"
+
+#: src/tray-monitor/tray-monitor.c:390
+msgid " (SD)"
+msgstr " (SD)"
+
+#: src/tray-monitor/tray-monitor.c:403
+msgid "Unknown status."
+msgstr "Nieznany status."
+
+#: src/tray-monitor/tray-monitor.c:477
+msgid "Refresh interval in seconds: "
+msgstr "Interwa odwierzania w sekundach: "
+
+#: src/tray-monitor/tray-monitor.c:485
+msgid "Refresh now"
+msgstr "Odwierz teraz"
+
+#: src/tray-monitor/tray-monitor.c:489
+msgid "About"
+msgstr "O Programie"
+
+#: src/tray-monitor/tray-monitor.c:493
+msgid "Close"
+msgstr "Zamknij"
+
+#: src/tray-monitor/tray-monitor.c:513
+#, c-format
+msgid "Disconnecting from Director %s:%d\n"
+msgstr "Rozłączanie od Dyrektora %s:%d\n"
+
+#: src/tray-monitor/tray-monitor.c:516
+#, c-format
+msgid "Disconnecting from Client %s:%d\n"
+msgstr "Rozłączanie od Klienta %s:%d\n"
+
+#: src/tray-monitor/tray-monitor.c:519
+#, c-format
+msgid "Disconnecting from Storage %s:%d\n"
+msgstr "Rozłączanie od Storage %s:%d\n"
+
+#: src/tray-monitor/tray-monitor.c:560 src/tray-monitor/tray-monitor.c:571
+msgid "Bacula Tray Monitor"
+msgstr "Monitor programu Bacula"
+
+#: src/tray-monitor/tray-monitor.c:562 src/tray-monitor/tray-monitor.c:573
+msgid "Written by Nicolas Boichat\n"
+msgstr "Napisany przez Nicolas Boichat\n"
+
+#: src/tray-monitor/tray-monitor.c:563 src/tray-monitor/tray-monitor.c:574
+msgid "Version"
+msgstr "Wersja"
+
+#: src/tray-monitor/tray-monitor.c:656
+#, c-format
+msgid "Error, currentitem is not a Client or a Storage..\n"
+msgstr "Bd, currentitem nie jest ani Klientem ani Storage...\n"
+
+#: src/tray-monitor/tray-monitor.c:730
+#, c-format
+msgid ""
+"Current job: %s\n"
+"Last job: %s"
+msgstr ""
+"Aktualne zadanie: %s\n"
+"Ostatnie zadanie: %s"
+
+#: src/tray-monitor/tray-monitor.c:742
+#, c-format
+msgid " (%d errors)"
+msgstr " (%d bdw)"
+
+#: src/tray-monitor/tray-monitor.c:745
+#, c-format
+msgid " (%d error)"
+msgstr " (%d bd)"
+
+#: src/tray-monitor/tray-monitor.c:783
+msgid "No current job."
+msgstr "Brak aktualnego zadania."
+
+#: src/tray-monitor/tray-monitor.c:786
+msgid "No last job."
+msgstr "Brak ostatniego zadania."
+
+#: src/tray-monitor/tray-monitor.c:794
+msgid "Job status: Created"
+msgstr "Status zadania: Stworzone"
+
+#: src/tray-monitor/tray-monitor.c:799
+msgid "Job status: Running"
+msgstr "Status zadania: Uruchomione"
+
+#: src/tray-monitor/tray-monitor.c:803
+msgid "Job status: Blocked"
+msgstr "Status zadania: Zablokowane"
+
+#: src/tray-monitor/tray-monitor.c:808
+msgid "Job status: Terminated"
+msgstr "Status zadania: Zakoczone"
+
+#: src/tray-monitor/tray-monitor.c:813
+msgid "Job status: Terminated in error"
+msgstr "Status zadania: Zakoczone przez bd"
+
+#: src/tray-monitor/tray-monitor.c:819
+msgid "Job status: Error"
+msgstr "Status zadania: Bd"
+
+#: src/tray-monitor/tray-monitor.c:823
+msgid "Job status: Fatal error"
+msgstr "Status zadania: Błąd krytyczny"
+
+#: src/tray-monitor/tray-monitor.c:828
+msgid "Job status: Verify differences"
+msgstr "Status zadania: Rnice przy weryfikacji"
+
+#: src/tray-monitor/tray-monitor.c:833
+msgid "Job status: Canceled"
+msgstr "Status zadania: Anulowane"
+
+#: src/tray-monitor/tray-monitor.c:838
+msgid "Job status: Waiting on File daemon"
+msgstr "Status zadania: Oczekiwanie na demon Plików"
+
+#: src/tray-monitor/tray-monitor.c:843
+msgid "Job status: Waiting on the Storage daemon"
+msgstr "Status zadania: Oczekiwanie na demon Przechowywania"
+
+#: src/tray-monitor/tray-monitor.c:848
+msgid "Job status: Waiting for new media"
+msgstr "Status zadania: Oczekiwanie na nowe media"
+
+#: src/tray-monitor/tray-monitor.c:853
+msgid "Job status: Waiting for Mount"
+msgstr "Status zadania: Oczekiwanie na Zamontowanie"
+
+#: src/tray-monitor/tray-monitor.c:858
+msgid "Job status: Waiting for storage resource"
+msgstr "Status zadania: Oczekiwanie na zasoby przechowywania"
+
+#: src/tray-monitor/tray-monitor.c:863
+msgid "Job status: Waiting for job resource"
+msgstr "Status zadania: Oczekiwanie na zasoby zadania"
+
+#: src/tray-monitor/tray-monitor.c:868
+msgid "Job status: Waiting for Client resource"
+msgstr "Status zadania: Oczekiwanie na zasoby Klienta"
+
+#: src/tray-monitor/tray-monitor.c:873
+msgid "Job status: Waiting for maximum jobs"
+msgstr "Status zadania: Oczekiwanie ze wzgldu na maksymaln ilo zada"
+
+#: src/tray-monitor/tray-monitor.c:878
+msgid "Job status: Waiting for start time"
+msgstr "Status zadania: Oczekiwanie na czas uruchomienia"
+
+#: src/tray-monitor/tray-monitor.c:883
+msgid "Job status: Waiting for higher priority jobs to finish"
+msgstr "Status zadania: Oczekiwanie na zakoczenie zadań o wyszym priorytecie"
+
+#: src/tray-monitor/tray-monitor.c:888
+#, c-format
+msgid "Unknown job status %c."
+msgstr "Nieznany status zadania %c."
+
+#: src/tray-monitor/tray-monitor.c:889
+#, c-format
+msgid "Job status: Unknown(%c)"
+msgstr "Status zadania: Nieznany(%c)"
+
+#: src/tray-monitor/tray-monitor.c:896
+#, c-format
+msgid "Bad scan : '%s' %d\n"
+msgstr "Ze skanowanie : '%s' %d\n"
+
+#: src/tray-monitor/tray-monitor.c:936 src/console/console.c:1138
 #, c-format
 msgid "Connecting to Director %s:%d\n"
 msgstr "Podłączenie do Dyrektora %s:%d\n"
 
-#: src/qt-console/bcomm/dircomm.cpp:102
+#: src/tray-monitor/tray-monitor.c:937 src/qt-console/bcomm/dircomm.cpp:102
 #, c-format
 msgid "Connecting to Director %s:%d"
 msgstr "Podłączenie do Dyrektora %s:%d"
 
+#: src/tray-monitor/tray-monitor.c:938 src/wx-console/console_thread.cpp:428
+#: src/qt-console/bcomm/dircomm.cpp:170
+msgid "Director daemon"
+msgstr "Demon Dyrektora"
+
+#: src/tray-monitor/tray-monitor.c:943
+#, c-format
+msgid "Connecting to Client %s:%d\n"
+msgstr "Podłączenie do Klienta %s:%d\n"
+
+#: src/tray-monitor/tray-monitor.c:944
+#, c-format
+msgid "Connecting to Client %s:%d"
+msgstr "Podłączenie do Klienta %s:%d"
+
+#: src/tray-monitor/tray-monitor.c:945
+msgid "File daemon"
+msgstr "Demon Plików"
+
+#: src/tray-monitor/tray-monitor.c:950
+#, c-format
+msgid "Connecting to Storage %s:%d\n"
+msgstr "Podłączenie do Storage %s:%d\n"
+
+#: src/tray-monitor/tray-monitor.c:951
+#, c-format
+msgid "Connecting to Storage %s:%d"
+msgstr "Podłączenie do Storage %s:%d"
+
+#: src/tray-monitor/tray-monitor.c:956 src/tray-monitor/tray-monitor.c:994
+#, c-format
+msgid "Error, currentitem is not a Client, a Storage or a Director..\n"
+msgstr "Błąd currentitem nie jest Klientem, Storage ani Dyrektorem..\n"
+
+#: src/tray-monitor/tray-monitor.c:962
+msgid "Cannot connect to daemon.\n"
+msgstr "Nie można połączyć się do demona.\n"
+
+#: src/tray-monitor/tray-monitor.c:963
+msgid "Cannot connect to daemon."
+msgstr "Nie można połączyć się do demona."
+
+#: src/tray-monitor/tray-monitor.c:975
+#, c-format
+msgid "Authentication error : %s"
+msgstr "Bad autentykacji : %s"
+
+#: src/tray-monitor/tray-monitor.c:982
+msgid "Opened connection with Director daemon.\n"
+msgstr "Otwarte poczenie z demonem Dyrektora.\n"
+
+#: src/tray-monitor/tray-monitor.c:983
+msgid "Opened connection with Director daemon."
+msgstr "Otwarte poczenie z demonem Dyrektora."
+
+#: src/tray-monitor/tray-monitor.c:986
+msgid "Opened connection with File daemon.\n"
+msgstr "Otwarte poczenie z demonem plikw.\n"
+
+#: src/tray-monitor/tray-monitor.c:987
+msgid "Opened connection with File daemon."
+msgstr "Otwarte poczenie z demonem plikw."
+
+#: src/tray-monitor/tray-monitor.c:990
+msgid "Opened connection with Storage daemon.\n"
+msgstr "Otwarte poczenie z demonem Przechowywania.\n"
+
+#: src/tray-monitor/tray-monitor.c:991
+msgid "Opened connection with Storage daemon."
+msgstr "Otwarte poczenie z demonem Przechowywania."
+
+#: src/tray-monitor/tray-monitor.c:1028
+msgid "<< Error: BNET_PROMPT signal received. >>\n"
+msgstr "<< Błąd: otrzymano sygnał BNET_PROMPT. >>\n"
+
+#: src/tray-monitor/tray-monitor.c:1033 src/wx-console/console_thread.cpp:494
+msgid "<< Heartbeat signal received, answered. >>\n"
+msgstr "<< Otrzymano sygnał Heartbeat, odpowiedziano. >>\n"
+
+#: src/tray-monitor/tray-monitor.c:1037
+msgid "<< Unexpected signal received : %s >>\n"
+msgstr "<< Otrzymano nieoczekiwany sygnał : %s >>\n"
+
+#: src/tray-monitor/tray-monitor.c:1042
+msgid "<ERROR>\n"
+msgstr "<BŁĄD>\n"
+
+#: src/tray-monitor/tray-monitor.c:1046
+msgid "Error : BNET_HARDEOF or BNET_ERROR"
+msgstr "Błąd : BNET_HARDEOF lub BNET_ERROR"
+
+#: src/tray-monitor/tray-monitor.c:1052
+msgid "<STOP>\n"
+msgstr "<STOP>\n"
+
+#: src/tray-monitor/tray-monitor.c:1056
+msgid "Error : Connection closed."
+msgstr "Błąd : Połączenie zamknięte."
+
 #: src/cats/mysql.c:81
 msgid "A user name for MySQL must be supplied.\n"
 msgstr "Nazwa użytkownika dla MySQL powinna by dostarczona.\n"
@@ -3372,12 +3803,12 @@ msgstr "Nie można stworzyć pliku stanu. %s ERR=%s\n"
 msgid "Write final hdr error: ERR=%s\n"
 msgstr "Błąd zapisu . ERR=%s\n"
 
-#: src/lib/lex.c:93
+#: src/lib/lex.c:93 src/wx-console/console_thread.cpp:212
 #, c-format
 msgid "Problem probably begins at line %d.\n"
 msgstr "Problem najprawdopodobniej zaczyna się od linii %d.\n"
 
-#: src/lib/lex.c:98
+#: src/lib/lex.c:98 src/wx-console/console_thread.cpp:217
 msgid ""
 "Config error: %s\n"
 "            : line %d, col %d of file %s\n"
@@ -4577,12 +5008,13 @@ msgstr ""
 msgid "Verify"
 msgstr "Weryfikacja OK"
 
-#: src/lib/util.c:365
+#: src/lib/util.c:365 src/wx-console/wxbrestorepanel.cpp:404
+#: src/wx-console/wxbrestorepanel.cpp:2000
 #, fuzzy
 msgid "Restore"
 msgstr "Odtwarzanie Anulowane"
 
-#: src/lib/util.c:368
+#: src/lib/util.c:368 src/wx-console/wxbmainframe.cpp:276
 #, fuzzy
 msgid "Console"
 msgstr "Zamknij"
@@ -5190,7 +5622,16 @@ msgid "Level"
 msgstr "nigdy"
 
 #: src/dird/ua_run.c:210 src/dird/ua_select.c:167 src/dird/ua_cmds.c:1095
-#: src/dird/ua_dotcmds.c:478
+#: src/dird/ua_dotcmds.c:478 src/wx-console/wxbrestorepanel.cpp:339
+#: src/wx-console/wxbrestorepanel.cpp:355
+#: src/wx-console/wxbrestorepanel.cpp:479
+#: src/wx-console/wxbrestorepanel.cpp:480
+#: src/wx-console/wxbrestorepanel.cpp:490
+#: src/wx-console/wxbrestorepanel.cpp:491
+#: src/wx-console/wxbrestorepanel.cpp:1173
+#: src/wx-console/wxbrestorepanel.cpp:1176
+#: src/wx-console/wxbrestorepanel.cpp:1845
+#: src/wx-console/wxbrestorepanel.cpp:1916
 #, fuzzy
 msgid "Storage"
 msgstr "Demon Skadowania"
@@ -5213,22 +5654,43 @@ msgstr "Odtwarzanie Anulowane"
 
 #: src/dird/ua_run.c:216 src/dird/ua_select.c:337 src/dird/ua_select.c:446
 #: src/dird/ua_cmds.c:1096 src/dird/ua_dotcmds.c:479
+#: src/wx-console/wxbrestorepanel.cpp:336
+#: src/wx-console/wxbrestorepanel.cpp:354
+#: src/wx-console/wxbrestorepanel.cpp:431
+#: src/wx-console/wxbrestorepanel.cpp:432
+#: src/wx-console/wxbrestorepanel.cpp:442
+#: src/wx-console/wxbrestorepanel.cpp:443
+#: src/wx-console/wxbrestorepanel.cpp:700
+#: src/wx-console/wxbrestorepanel.cpp:1133
+#: src/wx-console/wxbrestorepanel.cpp:1136
+#: src/wx-console/wxbrestorepanel.cpp:1238
+#: src/wx-console/wxbrestorepanel.cpp:1838
+#: src/wx-console/wxbrestorepanel.cpp:1840
+#: src/wx-console/wxbrestorepanel.cpp:1914
+#: src/wx-console/wxbrestorepanel.cpp:1970
 #, fuzzy
 msgid "Client"
 msgstr "Klient:"
 
-#: src/dird/ua_run.c:218
+#: src/dird/ua_run.c:218 src/wx-console/wxbrestorepanel.cpp:356
+#: src/wx-console/wxbrestorepanel.cpp:854
+#: src/wx-console/wxbrestorepanel.cpp:1918
 #, fuzzy
 msgid "When"
 msgstr "Kiedy:"
 
-#: src/dird/ua_run.c:219
+#: src/dird/ua_run.c:219 src/wx-console/wxbrestorepanel.cpp:357
+#: src/wx-console/wxbrestorepanel.cpp:1128
+#: src/wx-console/wxbrestorepanel.cpp:1921
 #, fuzzy
 msgid "Priority"
 msgstr "Priorytet:"
 
 #: src/dird/ua_run.c:224 src/dird/ua_update.c:616 src/dird/ua_select.c:535
-#: src/dird/ua_select.c:633
+#: src/dird/ua_select.c:633 src/wx-console/wxbrestorepanel.cpp:338
+#: src/wx-console/wxbrestorepanel.cpp:527
+#: src/wx-console/wxbrestorepanel.cpp:537
+#: src/wx-console/wxbrestorepanel.cpp:1834
 msgid "Pool"
 msgstr ""
 
@@ -5237,12 +5699,15 @@ msgstr ""
 msgid "Verify Job"
 msgstr "Weryfikacja OK"
 
-#: src/dird/ua_run.c:229
+#: src/dird/ua_run.c:229 src/wx-console/wxbrestorepanel.cpp:349
+#: src/wx-console/wxbrestorepanel.cpp:1899
 #, fuzzy
 msgid "Bootstrap"
 msgstr "Bootstrap:"
 
-#: src/dird/ua_run.c:230
+#: src/dird/ua_run.c:230 src/wx-console/wxbrestorepanel.cpp:350
+#: src/wx-console/wxbrestorepanel.cpp:1104
+#: src/wx-console/wxbrestorepanel.cpp:1901
 #, fuzzy
 msgid "Where"
 msgstr "Gdzie:"
@@ -5252,7 +5717,13 @@ msgstr "Gdzie:"
 msgid "File Relocation"
 msgstr "Demon Plików"
 
-#: src/dird/ua_run.c:232
+#: src/dird/ua_run.c:232 src/wx-console/wxbrestorepanel.cpp:352
+#: src/wx-console/wxbrestorepanel.cpp:1112
+#: src/wx-console/wxbrestorepanel.cpp:1905
+#: src/wx-console/wxbrestorepanel.cpp:1906
+#: src/wx-console/wxbrestorepanel.cpp:1907
+#: src/wx-console/wxbrestorepanel.cpp:1908
+#: src/wx-console/wxbrestorepanel.cpp:1909
 #, fuzzy
 msgid "Replace"
 msgstr "Zamiana:"
@@ -10993,13 +11464,13 @@ msgstr "%s nie jest liczbą. Musisz wybrać liczbę między 1 a %d\n"
 msgid "You must enter a number between 1 and %d\n"
 msgstr "Musisz wybrać liczbę między 1 a %d\n"
 
-#: src/console/console.c:1155
+#: src/console/console.c:1155 src/wx-console/console_thread.cpp:399
 #: src/qt-console/bcomm/dircomm.cpp:130
 #, fuzzy, c-format
 msgid "Failed to initialize TLS context for Console \"%s\".\n"
 msgstr "Nieudana inicjalizacja kontekstu TLS dla Dyrektora \"%s\" w %s.\n"
 
-#: src/console/console.c:1175
+#: src/console/console.c:1175 src/wx-console/console_thread.cpp:420
 #: src/qt-console/bcomm/dircomm.cpp:152
 #, fuzzy, c-format
 msgid "Failed to initialize TLS context for Director \"%s\".\n"
@@ -17047,6 +17518,797 @@ msgstr ""
 "\n"
 "BŁĄD Bacula: "
 
+#: src/wx-console/wxbmainframe.cpp:246
+msgid "&About...\tF1"
+msgstr "&About...\tF1"
+
+#: src/wx-console/wxbmainframe.cpp:246
+msgid "Show about dialog"
+msgstr "Pokaż dialog o"
+
+#: src/wx-console/wxbmainframe.cpp:248 src/wx-console/wxbmainframe.cpp:619
+msgid "Connect"
+msgstr "Połącz"
+
+#: src/wx-console/wxbmainframe.cpp:248 src/wx-console/wxbmainframe.cpp:620
+msgid "Connect to the director"
+msgstr "Połącz do Dyrektora"
+
+#: src/wx-console/wxbmainframe.cpp:249
+msgid "Disconnect"
+msgstr "Rozłącz"
+
+#: src/wx-console/wxbmainframe.cpp:249
+msgid "Disconnect of the director"
+msgstr "Rozłączanie dyrektora"
+
+#: src/wx-console/wxbmainframe.cpp:251
+msgid "Change of configuration file"
+msgstr "Zmiana pliku konfiguracyjnego"
+
+#: src/wx-console/wxbmainframe.cpp:251
+msgid "Change your default configuration file"
+msgstr "Zmień swój domyślny plik konfiguracyjny"
+
+#: src/wx-console/wxbmainframe.cpp:252
+msgid "Edit your configuration file"
+msgstr "Wyedytuj swój plik konfiguracyjny"
+
+#: src/wx-console/wxbmainframe.cpp:254
+msgid "E&xit\tAlt-X"
+msgstr "&Wyjście\tAlt-X"
+
+#: src/wx-console/wxbmainframe.cpp:254
+msgid "Quit this program"
+msgstr "Zamknij ten program"
+
+#: src/wx-console/wxbmainframe.cpp:258
+msgid "&File"
+msgstr "&Pliki"
+
+#: src/wx-console/wxbmainframe.cpp:259
+msgid "&Help"
+msgstr "&Pomoc"
+
+#: src/wx-console/wxbmainframe.cpp:267 src/wx-console/main.cpp:124
+#, c-format
+msgid "Welcome to bacula bwx-console %s (%s)!\n"
+msgstr "Witamy w konsoli baculi bwx-console %s (%s)!\n"
+
+#: src/wx-console/wxbmainframe.cpp:283
+msgid ""
+"Warning : Unicode is disabled because you are using wxWidgets for GTK+ 1.2.\n"
+msgstr ""
+"Ostrzeżenie : Unicode jest wyłączony ponieważ używane jest wxWidgets dla GTK+ 1.2.\n"
+
+#: src/wx-console/wxbmainframe.cpp:287
+msgid ""
+"Warning : There is a problem with wxWidgets for GTK+ 2.0 without Unicode "
+"support when handling non-ASCII filenames: Every non-ASCII character in such "
+"filenames will be replaced by an interrogation mark.\n"
+"If this behaviour disturbs you, please build bwx-console against a Unicode "
+"version of wxWidgets for GTK+ 2.0.\n"
+"---\n"
+msgstr ""
+
+#: src/wx-console/wxbmainframe.cpp:291
+#: src/wx-console/wxbhistorytextctrl.cpp:82
+#: src/wx-console/wxbhistorytextctrl.cpp:153
+msgid "Type your command below:"
+msgstr "Napisz swoje polecenie poniżej:"
+
+#: src/wx-console/wxbmainframe.cpp:298
+msgid "Send"
+msgstr "Wysłano"
+
+#: src/wx-console/wxbmainframe.cpp:375 src/wx-console/wxbmainframe.cpp:387
+msgid "Error while parsing command line arguments, using defaults.\n"
+msgstr "Błąd podczas parsowania argumentów lini komend, używam domyślnych.\n"
+
+#: src/wx-console/wxbmainframe.cpp:376 src/wx-console/wxbmainframe.cpp:388
+msgid "Usage: bwx-console [-c configfile] [-w tmp]\n"
+msgstr "Użycie: bwx-console [-c configfile] [-w tmp]\n"
+
+#: src/wx-console/wxbmainframe.cpp:417
+#, c-format
+msgid ""
+"It seems that it is the first time you run bwx-console.\n"
+"This file (%s) has been choosen as default configuration file.\n"
+"Do you want to edit it? (if you click No you will have to select another "
+"file)"
+msgstr ""
+"wydaje się że to twoje pierwsze uruchomienie konsoli bwx.\n"
+"Ten plik (%s) został wybrany jako domyślny plik konfiguracyjny.\n"
+"Czy chcesz go edytować? (jeśli wybierzesz 'No' będziesz musiał wybrać inny "
+"plik)"
+
+#: src/wx-console/wxbmainframe.cpp:419
+msgid "First run"
+msgstr "Pierwsze uruchomienie"
+
+#: src/wx-console/wxbmainframe.cpp:436
+#, c-format
+msgid ""
+"Unable to read %s\n"
+"Error: %s\n"
+"Do you want to choose another one? (Press no to edit this file)"
+msgstr ""
+"Nie można odczytać %s\n"
+"Błąd: %s\n"
+"Czy chcesz wybrać inny? (Wybierz 'no' by edytowac ten plik)"
+
+#: src/wx-console/wxbmainframe.cpp:438
+msgid "Unable to read configuration file"
+msgstr "Nie można odczytać pliku konfiguracyjnego"
+
+#: src/wx-console/wxbmainframe.cpp:450
+msgid "Please choose a configuration file to use"
+msgstr "Proszę wybierz używany plik konfiguracyjny"
+
+#: src/wx-console/wxbmainframe.cpp:463
+msgid "This configuration file has been successfully read, use it as default?"
+msgstr "Ten plik konfiguracyjny został z powodzeniem odczytany, czy użyć go jako domyślny?"
+
+#: src/wx-console/wxbmainframe.cpp:464
+msgid "Configuration file read successfully"
+msgstr "Plik konfiguracyjny odczytany z powodzeniem"
+
+#: src/wx-console/wxbmainframe.cpp:474
+msgid "Using this configuration file: %s\n"
+msgstr "Użyj tego pliku konfiguracyjnego: %s\n"
+
+#: src/wx-console/wxbmainframe.cpp:479
+msgid "Connecting to the director..."
+msgstr "Podłączenie do dyrektora..."
+
+#: src/wx-console/wxbmainframe.cpp:494
+msgid "Failed to unregister a data parser !"
+msgstr "Niepowodzenie przy wyrejestrowaniu parsera danych!"
+
+#: src/wx-console/wxbmainframe.cpp:502
+msgid "Quitting.\n"
+msgstr "Wychodzenie.\n"
+
+#: src/wx-console/wxbmainframe.cpp:517
+msgid ""
+"Welcome to Bacula bwx-console.\n"
+"Written by Nicolas Boichat <nicolas at boichat.ch>\n"
+"Copyright (C), 2005-2007 Free Software Foundation Europe, e.V.\n"
+msgstr ""
+"Witamy w Bacula bwx-console.\n"
+"Napisane przez Nicolas Boichat <nicolas at boichat.ch>\n"
+"Copyright (C), 2005-2007 Free Software Foundation Europe, e.V.\n"
+
+#: src/wx-console/wxbmainframe.cpp:521
+msgid "About Bacula bwx-console"
+msgstr "O Bacula bwx-console"
+
+#: src/wx-console/wxbmainframe.cpp:527
+msgid "Please choose your default configuration file"
+msgstr "Proszę wybierz swój plik konfiguracyjny"
+
+#: src/wx-console/wxbmainframe.cpp:531
+msgid "Use this configuration file as default?"
+msgstr "Użyć tego pliku konfiguracyjnego jako domyślnego?"
+
+#: src/wx-console/wxbmainframe.cpp:532
+msgid "Configuration file"
+msgstr "Plik konfiguracyjny"
+
+#: src/wx-console/wxbmainframe.cpp:603
+msgid "Console thread terminated."
+msgstr "Zakończono wątek konsoli."
+
+#: src/wx-console/wxbmainframe.cpp:611
+msgid "Connection to the director lost. Quit program?"
+msgstr "Podłączenie do dyrektora utracone. Zkończyć program?"
+
+#: src/wx-console/wxbmainframe.cpp:612
+msgid "Connection lost"
+msgstr "Połączenie utracone."
+
+#: src/wx-console/wxbmainframe.cpp:628
+msgid "Connected to the director."
+msgstr "Podłączony do dyrektora."
+
+#: src/wx-console/wxbmainframe.cpp:651
+#, fuzzy
+msgid "Reconnect"
+msgstr "Utworzone"
+
+#: src/wx-console/wxbmainframe.cpp:652
+#, fuzzy
+msgid "Reconnect to the director"
+msgstr "Podłączenie do Dyrektora %s:%d"
+
+#: src/wx-console/wxbmainframe.cpp:666
+msgid "Disconnected of the director."
+msgstr "Rozłączanie dyrektora."
+
+#: src/wx-console/wxbmainframe.cpp:685 src/wx-console/wxbrestorepanel.cpp:720
+msgid "Unexpected question has been received.\n"
+msgstr "Otrzymano nieoczekiwane pytanie.\n"
+
+#: src/wx-console/wxbmainframe.cpp:708 src/wx-console/wxbmainframe.cpp:725
+msgid "bwx-console: unexpected director's question."
+msgstr "bwx-console: nieoczekiwane zapytanie Dyrektora."
+
+#: src/wx-console/wxbconfigpanel.cpp:213
+msgid "Apply"
+msgstr "Zastosuj"
+
+#: src/wx-console/console_thread.cpp:125
+msgid ""
+"Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined for "
+"Director \"%s\" in config file.\n"
+"At least one CA certificate store is required.\n"
+msgstr ""
+"Ani \"TLS CA Certificate\", ani \"TLS CA Certificate Dir\" nie są "
+"zdefiniowane dla Dyrektora \"%s\" w pliku konfiguracyjnym.\n"
+" Co najmniej jedno skadowanie certyfikatu CA jest wymagane.\n"
+
+#: src/wx-console/console_thread.cpp:132
+msgid ""
+"No Director resource defined in config file.\n"
+"Without that I don't how to speak to the Director :-(\n"
+msgstr ""
+"Brak definicji zasobu Dyrektora w pliku konfiguracyjnym\n"
+"Bez tego nie wiem jak rozmawiać z Dyrektorem :-(\n"
+
+#: src/wx-console/console_thread.cpp:151
+msgid ""
+"Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined for "
+"Console \"%s\" in config file.\n"
+msgstr ""
+"Ani \"TLS CA Certificate\", ani \"TLS CA Certificate Dir\" nie zostały "
+"zdefiniowane dla Konsoli \"%s\" w pliku konfiguracyjnym.\n"
+
+#: src/wx-console/console_thread.cpp:173
+msgid "Error while initializing windows sockets...\n"
+msgstr "Błąd w trakcie inicjalizacji gniazd windows...\n"
+
+#: src/wx-console/console_thread.cpp:189
+msgid "Error while cleaning up windows sockets...\n"
+msgstr "Błąd w trakcie czyszczenia gniazd windows...\n"
+
+#: src/wx-console/console_thread.cpp:228
+msgid "Error while initializing library."
+msgstr "Błąd w trakcie inicjalizacji biblioteki."
+
+#: src/wx-console/console_thread.cpp:256
+msgid "Cryptographic library initialization failed.\n"
+msgstr "Nieudana inicjalizacja biblioteki kryptograficznej.\n"
+
+#: src/wx-console/console_thread.cpp:260
+msgid "Please correct configuration file.\n"
+msgstr "Proszę popraw plik konfiguracyjny.\n"
+
+#: src/wx-console/console_thread.cpp:302
+msgid "Error : Library not initialized\n"
+msgstr "Błąd : Nie zainicjalizowana biblioteka\n"
+
+#: src/wx-console/console_thread.cpp:313
+msgid "Error : No configuration file loaded\n"
+msgstr "Błąd : Nie załadowano pliku konfiguracyjnego\n"
+
+#: src/wx-console/console_thread.cpp:323
+msgid "Connecting...\n"
+msgstr "Łączenie...\n"
+
+#: src/wx-console/console_thread.cpp:339
+msgid "Error : No director defined in config file.\n"
+msgstr "Błąd : Brak definicji dyrektora w pliku konfiguracyjnym.\n"
+
+#: src/wx-console/console_thread.cpp:351
+msgid "Multiple directors found in your config file.\n"
+msgstr "Znaleziono wielu dyrektorów w twoim pliku konfiguracyjnym.\n"
+
+#: src/wx-console/console_thread.cpp:360
+#, c-format
+msgid "Please choose a director (1-%d): "
+msgstr "Proszę wybierz dyrektora (1-%d): "
+
+#: src/wx-console/console_thread.cpp:389
+#, c-format
+msgid "Passphrase for Console \"%s\" TLS private key: "
+msgstr "Hasło dla klucza prywatnego TLS Konsoli \"%s\": "
+
+#: src/wx-console/console_thread.cpp:410
+#, c-format
+msgid "Passphrase for Director \"%s\" TLS private key: "
+msgstr "Hasło dla klucza prywatnego TLS Dyrektora \"%s\": "
+
+#: src/wx-console/console_thread.cpp:432
+msgid "Failed to connect to the director\n"
+msgstr "Nieudane podłączenie do dyrektora\n"
+
+#: src/wx-console/console_thread.cpp:442
+msgid "Connected\n"
+msgstr "Podłączony\n"
+
+#: src/wx-console/console_thread.cpp:499
+msgid "<< Unexpected signal received : "
+msgstr "<< Otrzymano nieoczekiwany sygnał : "
+
+#: src/wx-console/console_thread.cpp:519
+msgid "Connection terminated\n"
+msgstr "Podłączenie zakończone\n"
+
+#: src/wx-console/wxbconfigfileeditor.cpp:65
+msgid "Config file editor"
+msgstr "Edytor pliku konfiguracyjnego"
+
+#: src/wx-console/wxbconfigfileeditor.cpp:75
+msgid "# Bacula bwx-console Configuration File\n"
+msgstr "# Plik Konfiguracyjny Bacula bwx-console\n"
+
+#: src/wx-console/wxbconfigfileeditor.cpp:111
+msgid "Save and close"
+msgstr "Zapisz i zamknij"
+
+#: src/wx-console/wxbconfigfileeditor.cpp:112
+msgid "Close without saving"
+msgstr "Zamknij bez zapisywania"
+
+#: src/wx-console/wxbconfigfileeditor.cpp:139
+msgid "Unable to write to %s\n"
+msgstr "Nie mogę pisać do %s\n"
+
+#: src/wx-console/wxbconfigfileeditor.cpp:140
+msgid "Error while saving"
+msgstr "Błąd w trakcie zapisywania"
+
+#: src/wx-console/main.cpp:119
+msgid "Bacula bwx-console"
+msgstr "Bacula bwx-console"
+
+#: src/wx-console/wxbrestorepanel.cpp:234
+#: src/wx-console/wxbrestorepanel.cpp:1947
+#: src/wx-console/wxbrestorepanel.cpp:1976
+msgid "Enter restore mode"
+msgstr "Wprowadź tryb odtwarzania"
+
+#: src/wx-console/wxbrestorepanel.cpp:237
+msgid "Cancel restore"
+msgstr "Anuluj odtwarzanie"
+
+#: src/wx-console/wxbrestorepanel.cpp:263
+#: src/wx-console/wxbrestorepanel.cpp:317
+msgid "Add"
+msgstr "Dodaj"
+
+#: src/wx-console/wxbrestorepanel.cpp:265
+#: src/wx-console/wxbrestorepanel.cpp:319
+msgid "Remove"
+msgstr "Usuń"
+
+#: src/wx-console/wxbrestorepanel.cpp:267
+#: src/wx-console/wxbrestorepanel.cpp:321
+msgid "Refresh"
+msgstr "Odwierz"
+
+#: src/wx-console/wxbrestorepanel.cpp:286
+msgid "M"
+msgstr "M"
+
+#: src/wx-console/wxbrestorepanel.cpp:290
+msgid "Filename"
+msgstr "Nazwa pliku"
+
+#: src/wx-console/wxbrestorepanel.cpp:294
+msgid "Size"
+msgstr "Rozmiar"
+
+#: src/wx-console/wxbrestorepanel.cpp:298
+msgid "Date"
+msgstr "Data"
+
+#: src/wx-console/wxbrestorepanel.cpp:302
+msgid "Perm."
+msgstr "Prawa"
+
+#: src/wx-console/wxbrestorepanel.cpp:306
+msgid "User"
+msgstr "Użytkownik"
+
+#: src/wx-console/wxbrestorepanel.cpp:310
+msgid "Group"
+msgstr "Grupa"
+
+#: src/wx-console/wxbrestorepanel.cpp:335
+#: src/wx-console/wxbrestorepanel.cpp:348
+#: src/wx-console/wxbrestorepanel.cpp:503
+#: src/wx-console/wxbrestorepanel.cpp:513
+#: src/wx-console/wxbrestorepanel.cpp:516
+#: src/wx-console/wxbrestorepanel.cpp:1811
+#: src/wx-console/wxbrestorepanel.cpp:1897
+msgid "Job Name"
+msgstr "Nazwa Zadania"
+
+#: src/wx-console/wxbrestorepanel.cpp:337
+#: src/wx-console/wxbrestorepanel.cpp:353
+#: src/wx-console/wxbrestorepanel.cpp:455
+#: src/wx-console/wxbrestorepanel.cpp:456
+#: src/wx-console/wxbrestorepanel.cpp:466
+#: src/wx-console/wxbrestorepanel.cpp:467
+#: src/wx-console/wxbrestorepanel.cpp:1153
+#: src/wx-console/wxbrestorepanel.cpp:1156
+#: src/wx-console/wxbrestorepanel.cpp:1239
+#: src/wx-console/wxbrestorepanel.cpp:1849
+#: src/wx-console/wxbrestorepanel.cpp:1851
+#: src/wx-console/wxbrestorepanel.cpp:1912
+msgid "Fileset"
+msgstr "Zestaw plików"
+
+#: src/wx-console/wxbrestorepanel.cpp:340
+#: src/wx-console/wxbrestorepanel.cpp:1233
+#: src/wx-console/wxbrestorepanel.cpp:1249
+#: src/wx-console/wxbrestorepanel.cpp:1251
+#: src/wx-console/wxbrestorepanel.cpp:1259
+#: src/wx-console/wxbrestorepanel.cpp:1261
+#: src/wx-console/wxbrestorepanel.cpp:1280
+#: src/wx-console/wxbrestorepanel.cpp:1287
+#: src/wx-console/wxbrestorepanel.cpp:1839
+#: src/wx-console/wxbrestorepanel.cpp:1850
+#: src/wx-console/wxbrestorepanel.cpp:1971
+msgid "Before"
+msgstr "Przed"
+
+#: src/wx-console/wxbrestorepanel.cpp:342
+msgid "Please configure parameters concerning files to restore :"
+msgstr "Proszę skonfiguruj parametry związane z plikami do odtwarzania :"
+
+#: src/wx-console/wxbrestorepanel.cpp:351
+#: src/wx-console/wxbrestorepanel.cpp:1905
+msgid "always"
+msgstr "zawsze"
+
+#: src/wx-console/wxbrestorepanel.cpp:351
+msgid "if newer"
+msgstr "jeśli nowszy"
+
+#: src/wx-console/wxbrestorepanel.cpp:351
+msgid "if older"
+msgstr "jeśli starszy"
+
+#: src/wx-console/wxbrestorepanel.cpp:351
+#: src/wx-console/wxbrestorepanel.cpp:1908
+msgid "never"
+msgstr "nigdy"
+
+#: src/wx-console/wxbrestorepanel.cpp:359
+msgid "Please configure parameters concerning files restoration :"
+msgstr "Proszę skonfigurować parametry dotyczących odtwarzania plików :"
+
+#: src/wx-console/wxbrestorepanel.cpp:427
+msgid "Getting parameters list."
+msgstr "Pobieranie listy parametrów."
+
+#: src/wx-console/wxbrestorepanel.cpp:435
+msgid "Error : no clients returned by the director."
+msgstr "Błąd : dyrektor nie zwrócił klientów."
+
+#: src/wx-console/wxbrestorepanel.cpp:459
+msgid "Error : no filesets returned by the director."
+msgstr "Błąd : dyrektor nie zwrócił żadnych fileset'ów."
+
+#: src/wx-console/wxbrestorepanel.cpp:483
+msgid "Error : no storage returned by the director."
+msgstr "Błąd : dyrektor nie zwrócił storage."
+
+#: src/wx-console/wxbrestorepanel.cpp:506
+#: src/wx-console/wxbrestorepanel.cpp:530
+msgid "Error : no jobs returned by the director."
+msgstr "Błąd : dyrektor nie zwrócił zadań."
+
+#: src/wx-console/wxbrestorepanel.cpp:516
+msgid "RestoreFiles"
+msgstr "RestoreFiles"
+
+#: src/wx-console/wxbrestorepanel.cpp:551
+msgid "Please configure your restore parameters."
+msgstr "Proszę skonfiguruj swoje parametry odtwarzania."
+
+#: src/wx-console/wxbrestorepanel.cpp:556
+msgid "Please select a client."
+msgstr "Proszę zaznacz klienta."
+
+#: src/wx-console/wxbrestorepanel.cpp:560
+msgid "Please select a restore date."
+msgstr "Proszę wskaż datę odtwarzania."
+
+#: src/wx-console/wxbrestorepanel.cpp:565
+msgid "Building restore tree..."
+msgstr "Budowanie drzewa odtwarzania..."
+
+#: src/wx-console/wxbrestorepanel.cpp:613
+msgid "Error while starting restore: "
+msgstr "Błąd w trakcie uruchamiania odtwarzania: "
+
+#: src/wx-console/wxbrestorepanel.cpp:705
+msgid ""
+"Right click on a file or on a directory, or double-click on its mark to add "
+"it to the restore list."
+msgstr ""
+"Kliknięcie prawym przyciskiem myszy na pliku lub katalogu, lub podwójne "
+"kliknięcie na nich zaznacza je i dodaje do listy odtwarzania."
+
+#: src/wx-console/wxbrestorepanel.cpp:742
+#: src/wx-console/wxbrestorepanel.cpp:764
+msgid "bwx-console: unexpected restore question."
+msgstr "bwx-console: niespodziewane pytanie o odtwarzanie."
+
+#: src/wx-console/wxbrestorepanel.cpp:775
+msgid " files selected to be restored."
+msgstr " pliki zaznaczone do odtworzenia."
+
+#: src/wx-console/wxbrestorepanel.cpp:780
+msgid " file selected to be restored."
+msgstr " plik zaznaczony do odtworzenia."
+
+#: src/wx-console/wxbrestorepanel.cpp:787
+#, c-format
+msgid "Please configure your restore (%ld files selected to be restored)..."
+msgstr ""
+"Proszę skonfiguruj swoje odtwarzanie (%ld plików zaznaczonych do "
+"odtwarzania)..."
+
+#: src/wx-console/wxbrestorepanel.cpp:797
+msgid "Restore failed : no file selected.\n"
+msgstr "Nieudane odtwarzanie, nie wskazano pliku.\n"
+
+#: src/wx-console/wxbrestorepanel.cpp:798
+msgid "Restore failed : no file selected."
+msgstr "Nieudane odtwarzanie, nie wskazano pliku."
+
+#: src/wx-console/wxbrestorepanel.cpp:808
+msgid "Restoring, please wait..."
+msgstr "Odtwarzanie, proszę czekać..."
+
+#: src/wx-console/wxbrestorepanel.cpp:821
+msgid "Job queued. JobId="
+msgstr "Zadanie zakolejkowane. JobId="
+
+#: src/wx-console/wxbrestorepanel.cpp:823
+msgid "Restore queued, jobid="
+msgstr "Odtwarzanie zakolejkowane, jobid="
+
+#: src/wx-console/wxbrestorepanel.cpp:827
+msgid "Job failed."
+msgstr "Zadanie nieudane."
+
+#: src/wx-console/wxbrestorepanel.cpp:828
+msgid "Restore failed, please look at messages.\n"
+msgstr "Nieudane odtwarzanie, proszę zweryfikuj komunikaty.\n"
+
+#: src/wx-console/wxbrestorepanel.cpp:829
+msgid "Restore failed, please look at messages in console."
+msgstr "Odtwarzanie nieudane, proszę spojrzeć na komunikaty na konsoli."
+
+#: src/wx-console/wxbrestorepanel.cpp:835
+#: src/wx-console/wxbrestorepanel.cpp:836
+msgid "Failed to retrieve jobid.\n"
+msgstr "Nieudane pobranie jobid.\n"
+
+#: src/wx-console/wxbrestorepanel.cpp:862
+msgid ""
+"Restore is scheduled to run. bwx-console will not wait for its completion.\n"
+msgstr ""
+"Zadanie odtwarzania zaplanowane do uruchomienia. bwx-console nie będzie "
+"czekać na jego zakończenie.\n"
+
+#: src/wx-console/wxbrestorepanel.cpp:863
+msgid ""
+"Restore is scheduled to run. bwx-console will not wait for its completion."
+msgstr ""
+"Zadanie odtwarzania zaplanowane do uruchomienia. bwx-console nie będzie "
+"czekać na jego zakończenie."
+
+#: src/wx-console/wxbrestorepanel.cpp:889
+msgid "Restore job created, but not yet running."
+msgstr "Zadanie odtwarzania stworzone, lecz jeszcze nie uruchomione."
+
+#: src/wx-console/wxbrestorepanel.cpp:894
+msgid "Restore job running, please wait (%ld of %ld files restored)..."
+msgstr "Zadanie odtwarzania w trakcie, proszę czekać (%ld z %ld plików odtworzonych)..."
+
+#: src/wx-console/wxbrestorepanel.cpp:898
+msgid "Restore job terminated successfully."
+msgstr "Zadanie odtwarzania zakończone poprawnie."
+
+#: src/wx-console/wxbrestorepanel.cpp:899
+msgid "Restore job terminated successfully.\n"
+msgstr "Zadanie odtwarzania zakończone poprawnie.\n"
+
+#: src/wx-console/wxbrestorepanel.cpp:904
+msgid "Restore job terminated in error, see messages in console."
+msgstr "Zadanie odtwarzania zakończone z błędem, zobacz komunikaty na konsoli."
+
+#: src/wx-console/wxbrestorepanel.cpp:905
+msgid "Restore job terminated in error, see messages.\n"
+msgstr "Zadanie odtwarzania zakończone z błędem, zobacz komunikaty.\n"
+
+#: src/wx-console/wxbrestorepanel.cpp:910
+msgid "Restore job reported a non-fatal error."
+msgstr "Zadanie odtwarzania zaraportowało niekrytyczny błąd."
+
+#: src/wx-console/wxbrestorepanel.cpp:914
+msgid "Restore job reported a fatal error."
+msgstr "Zadanie odtwarzania zaraportowało błąd krytyczny."
+
+#: src/wx-console/wxbrestorepanel.cpp:919
+msgid "Restore job cancelled by user."
+msgstr "Zadanie odtwarzania anulowane przez użytkownika."
+
+#: src/wx-console/wxbrestorepanel.cpp:920
+msgid "Restore job cancelled by user.\n"
+msgstr "Zadanie odtwarzania anulowane przez użytkownika.\n"
+
+#: src/wx-console/wxbrestorepanel.cpp:925
+msgid "Restore job is waiting on File daemon."
+msgstr "Zadanie odtwarzania oczekuje na Demon Plików."
+
+#: src/wx-console/wxbrestorepanel.cpp:929
+msgid "Restore job is waiting for new media."
+msgstr "Zadanie odtwarzania oczekuje na nowe medium."
+
+#: src/wx-console/wxbrestorepanel.cpp:933
+msgid "Restore job is waiting for storage resource."
+msgstr "Zadanie odtwarzania oczekuje na zasoby storage."
+
+#: src/wx-console/wxbrestorepanel.cpp:937
+msgid "Restore job is waiting for job resource."
+msgstr "Zadanie odtwarzania oczekuje na zasoby dadania."
+
+#: src/wx-console/wxbrestorepanel.cpp:941
+msgid "Restore job is waiting for Client resource."
+msgstr "Zadanie odtwarzania oczekuje na zasoby Klienta."
+
+#: src/wx-console/wxbrestorepanel.cpp:945
+msgid "Restore job is waiting for maximum jobs."
+msgstr "Zadanie odtwarzania oczekuje z powodu maksymalnej iloiści zadań."
+
+#: src/wx-console/wxbrestorepanel.cpp:949
+msgid "Restore job is waiting for start time."
+msgstr "Zadanie odtwarzania oczekuje na czas uruchomienia."
+
+#: src/wx-console/wxbrestorepanel.cpp:953
+msgid "Restore job is waiting for higher priority jobs to finish."
+msgstr "Zadanie odtwarzania oczekuje na zakończenie zadań o wyższym priorytecie."
+
+#: src/wx-console/wxbrestorepanel.cpp:1002
+msgid ""
+"The restore job has not been started within one minute, bwx-console will not "
+"wait for its completion anymore.\n"
+msgstr ""
+"Zadanie odtwarzania nie wystartowało w ciągu minuty, bwx-console nie będzie "
+"już więcej czekać na jego zakończenie.\n"
+
+#: src/wx-console/wxbrestorepanel.cpp:1003
+msgid ""
+"The restore job has not been started within one minute, bwx-console will not "
+"wait for its completion anymore."
+msgstr ""
+"Zadanie odtwarzania nie wystartowało w ciągu minuty, bwx-console nie będzie "
+"już więcej czekać na jego zakończenie."
+
+#: src/wx-console/wxbrestorepanel.cpp:1013
+msgid "Restore done successfully.\n"
+msgstr "Odtwarzanie wykonane poprawnie.\n"
+
+#: src/wx-console/wxbrestorepanel.cpp:1014
+msgid "Restore done successfully."
+msgstr "Odtwarzanie wykonane poprawnie."
+
+#: src/wx-console/wxbrestorepanel.cpp:1086
+msgid "Applying restore configuration changes..."
+msgstr "Zastosowanie zmian konfiguracyjnych odtwarzania..."
+
+#: src/wx-console/wxbrestorepanel.cpp:1138
+msgid "Failed to find the selected client."
+msgstr "Nie można znaleźć wskazanego klienta."
+
+#: src/wx-console/wxbrestorepanel.cpp:1158
+msgid "Failed to find the selected fileset."
+msgstr "Nie można znaleźć wskazanego fileset."
+
+#: src/wx-console/wxbrestorepanel.cpp:1178
+msgid "Failed to find the selected storage."
+msgstr "Nie można znaleźć wskazanego storage."
+
+#: src/wx-console/wxbrestorepanel.cpp:1199
+#: src/wx-console/wxbrestorepanel.cpp:1886
+msgid "Run Restore job"
+msgstr "Uruchom zadanie Odtwarzania"
+
+#: src/wx-console/wxbrestorepanel.cpp:1216
+msgid "Restore configuration changes were applied."
+msgstr "Odtworzenie zmian konfiguracji zostało zastosowane."
+
+#: src/wx-console/wxbrestorepanel.cpp:1225
+msgid "Restore cancelled.\n"
+msgstr "Odtwarzanie anulowane.\n"
+
+#: src/wx-console/wxbrestorepanel.cpp:1226
+msgid "Restore cancelled."
+msgstr "Odtwarzanie anulowane."
+
+#: src/wx-console/wxbrestorepanel.cpp:1248
+msgid "No results to list."
+msgstr "Brak rezultatów do wylistowania."
+
+#: src/wx-console/wxbrestorepanel.cpp:1250
+msgid "No backup found for this client."
+msgstr "Nie znaleziono backupu dla tego klienta."
+
+#: src/wx-console/wxbrestorepanel.cpp:1257
+msgid "ERROR"
+msgstr "BŁĄD"
+
+#: src/wx-console/wxbrestorepanel.cpp:1258
+msgid "Query failed"
+msgstr "Nieudane zapytanie"
+
+#: src/wx-console/wxbrestorepanel.cpp:1260
+msgid "Cannot get previous backups list, see console."
+msgstr "Nie moąna otrzymać listy poprzednich backupów, zobacz konsolę."
+
+#: src/wx-console/wxbrestorepanel.cpp:1896
+msgid "JobName:"
+msgstr "Nazwa Zadania:"
+
+#: src/wx-console/wxbrestorepanel.cpp:1898
+msgid "Bootstrap:"
+msgstr "Bootstrap:"
+
+#: src/wx-console/wxbrestorepanel.cpp:1900
+msgid "Where:"
+msgstr "Gdzie:"
+
+#: src/wx-console/wxbrestorepanel.cpp:1903
+msgid "Replace:"
+msgstr "Zamiana:"
+
+#: src/wx-console/wxbrestorepanel.cpp:1906
+msgid "ifnewer"
+msgstr "ifnewer"
+
+#: src/wx-console/wxbrestorepanel.cpp:1907
+msgid "ifolder"
+msgstr "ifolder"
+
+#: src/wx-console/wxbrestorepanel.cpp:1911
+msgid "FileSet:"
+msgstr "FileSet:"
+
+#: src/wx-console/wxbrestorepanel.cpp:1913
+msgid "Client:"
+msgstr "Klient:"
+
+#: src/wx-console/wxbrestorepanel.cpp:1915
+msgid "Storage:"
+msgstr "Storage:"
+
+#: src/wx-console/wxbrestorepanel.cpp:1917
+msgid "When:"
+msgstr "Kiedy:"
+
+#: src/wx-console/wxbrestorepanel.cpp:1920
+msgid "Priority:"
+msgstr "Priorytet:"
+
+#: src/wx-console/wxbrestorepanel.cpp:2028
+msgid "Restoring..."
+msgstr "Odtwarzanie..."
+
+#: src/wx-console/wxbhistorytextctrl.cpp:117
+msgid "Unknown command."
+msgstr "Nieznana komenda."
+
+#: src/wx-console/wxbhistorytextctrl.cpp:126
+msgid "Possible completions: "
+msgstr "Możliwe uzupełnienia: "
+
 #: src/qt-console/bat_conf.cpp:154
 msgid "Console: name=%s\n"
 msgstr "Konsola: nazwa=%s\n"
diff --git a/po/sv.po b/po/sv.po
index a5b7408..0756cf3 100644
--- a/po/sv.po
+++ b/po/sv.po
@@ -1,13 +1,12 @@
 # Swedish translations for PACKAGE package.
-# Copyright (C) 2007-2014 Kern Sibbald
-# This file is distributed under the same license as the PACKAGE package.
-# Kern Sibbald <kern at bacula.org>, 2007.
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #
 msgid ""
 msgstr ""
 "Project-Id-Version: Bacula 2.1.x\n"
 "Report-Msgid-Bugs-To: bacula-devel at lists.sourceforge.net\n"
-"POT-Creation-Date: 2014-07-29 18:18+0200\n"
+"POT-Creation-Date: 2015-08-09 15:05+0200\n"
 "PO-Revision-Date: 2007-06-22 19:18+0200\n"
 "Last-Translator: Kern Sibbald <kern at bacula.org>\n"
 "Language-Team: Swedish <bacula-devel at lists.soureforge.net>\n"
@@ -17,232 +16,237 @@ msgstr ""
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=2; plural=(n != 1);\n"
 
-#: src/baconfig.h:60 src/baconfig.h:61 src/baconfig.h:66 src/baconfig.h:67
+#: src/baconfig.h:64 src/baconfig.h:65 src/baconfig.h:70 src/baconfig.h:71
+#: src/baconfig.h:82 src/baconfig.h:83
 #, c-format
 msgid "Failed ASSERT: %s\n"
 msgstr ""
 
-#: src/baconfig.h:76
+#: src/baconfig.h:91
 msgid "*None*"
 msgstr ""
 
-#: src/lib/status.h:73
+#: src/lib/status.h:78
 msgid ""
 "\n"
 "Terminated Jobs:\n"
 msgstr ""
 
-#: src/lib/status.h:80
+#: src/lib/status.h:85
 msgid " JobId  Level    Files      Bytes   Status   Finished        Name \n"
 msgstr ""
 
-#: src/lib/status.h:82
+#: src/lib/status.h:87
 msgid "===================================================================\n"
 msgstr ""
 
-#: src/lib/status.h:102
+#: src/lib/status.h:107
 msgid "Created"
 msgstr ""
 
-#: src/lib/status.h:106
+#: src/lib/status.h:111
 msgid "Error"
 msgstr ""
 
-#: src/lib/status.h:109
+#: src/lib/status.h:114
 msgid "Diffs"
 msgstr ""
 
-#: src/lib/status.h:112
+#: src/lib/status.h:117
 msgid "Cancel"
 msgstr ""
 
-#: src/lib/status.h:115
+#: src/lib/status.h:120
 msgid "OK"
 msgstr ""
 
-#: src/lib/status.h:118
+#: src/lib/status.h:123
 msgid "OK -- with warnings"
 msgstr ""
 
-#: src/lib/status.h:122
+#: src/lib/status.h:126
+msgid "Incomplete"
+msgstr ""
+
+#: src/lib/status.h:129
 msgid "Other"
 msgstr ""
 
-#: src/lib/status.h:134
+#: src/lib/status.h:141
 #, c-format
 msgid "%6d\t%-6s\t%8s\t%10s\t%-7s\t%-8s\t%s\n"
 msgstr ""
 
-#: src/lib/status.h:142
+#: src/lib/status.h:149
 #, c-format
 msgid "%6d  %-6s %8s %10s  %-7s  %-8s %s\n"
 msgstr ""
 
-#: src/lib/status.h:171 src/lib/status.h:182 src/lib/status.h:196
-#: src/lib/status.h:200 src/lib/status.h:204
+#: src/lib/status.h:178 src/lib/status.h:189 src/lib/status.h:203
+#: src/lib/status.h:207 src/lib/status.h:211
 msgid "Bacula "
 msgstr ""
 
-#: src/qt-console/bat_conf.cpp:130
+#: src/qt-console/bat_conf.cpp:133
 #, c-format
 msgid "No record for %d %s\n"
 msgstr ""
 
-#: src/qt-console/bat_conf.cpp:139
+#: src/qt-console/bat_conf.cpp:142
 #, c-format
 msgid "Director: name=%s address=%s DIRport=%d\n"
 msgstr ""
 
-#: src/qt-console/bat_conf.cpp:143
+#: src/qt-console/bat_conf.cpp:146
 #, c-format
 msgid "Console: name=%s\n"
 msgstr ""
 
-#: src/qt-console/bat_conf.cpp:146
-#: src/qt-console/tray-monitor/tray_conf.cpp:183
+#: src/qt-console/bat_conf.cpp:149
+#: src/qt-console/tray-monitor/tray_conf.cpp:187
 #, c-format
 msgid "ConsoleFont: name=%s font face=%s\n"
 msgstr ""
 
-#: src/qt-console/bat_conf.cpp:150 src/qt-console/bat_conf.cpp:231
-#: src/qt-console/bat_conf.cpp:279 src/qt-console/bat_conf.cpp:309
+#: src/qt-console/bat_conf.cpp:153 src/qt-console/bat_conf.cpp:234
+#: src/qt-console/bat_conf.cpp:284 src/qt-console/bat_conf.cpp:314
 #, c-format
 msgid "Unknown resource type %d\n"
 msgstr ""
 
-#: src/qt-console/bat_conf.cpp:257
-#: src/qt-console/tray-monitor/tray_conf.cpp:276
+#: src/qt-console/bat_conf.cpp:262
+#: src/qt-console/tray-monitor/tray_conf.cpp:280
 #, c-format
 msgid "%s item is required in %s resource, but not found.\n"
 msgstr ""
 
-#: src/qt-console/bat_conf.cpp:326
-#: src/qt-console/tray-monitor/tray_conf.cpp:360
+#: src/qt-console/bat_conf.cpp:331
+#: src/qt-console/tray-monitor/tray_conf.cpp:364
 #, c-format
 msgid "Attempt to define second %s resource named \"%s\" is not permitted.\n"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:85
+#: src/qt-console/bcomm/dircomm.cpp:89
 #, c-format
 msgid "Already connected\"%s\".\n"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:96
-#: src/qt-console/tray-monitor/tray-monitor.cpp:347
+#: src/qt-console/bcomm/dircomm.cpp:100
+#: src/qt-console/tray-monitor/tray-monitor.cpp:353
 #, c-format
 msgid "Connecting to Director %s:%d"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:98
+#: src/qt-console/bcomm/dircomm.cpp:102
 #, c-format
 msgid ""
 "Connecting to Director %s:%d\n"
 "\n"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:150
+#: src/qt-console/bcomm/dircomm.cpp:154
 #, c-format
 msgid "Failed to initialize TLS context for Console \"%s\".\n"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:173
+#: src/qt-console/bcomm/dircomm.cpp:177
 #, c-format
 msgid "Failed to initialize TLS context for Director \"%s\".\n"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:195
-#: src/qt-console/tray-monitor/tray-monitor.cpp:352
+#: src/qt-console/bcomm/dircomm.cpp:199
+#: src/qt-console/tray-monitor/tray-monitor.cpp:358
 msgid "Director daemon"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:233
+#: src/qt-console/bcomm/dircomm.cpp:237
 msgid "Initializing ..."
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:249 src/qt-console/console/console.cpp:130
+#: src/qt-console/bcomm/dircomm.cpp:253 src/qt-console/console/console.cpp:134
 msgid "Connected"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:373
+#: src/qt-console/bcomm/dircomm.cpp:377
 msgid "Command completed ..."
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:380 src/qt-console/console/console.cpp:367
+#: src/qt-console/bcomm/dircomm.cpp:384 src/qt-console/console/console.cpp:371
 msgid "Processing command ..."
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:387
+#: src/qt-console/bcomm/dircomm.cpp:391
 msgid "At main prompt waiting for input ..."
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:394 src/qt-console/bcomm/dircomm.cpp:407
+#: src/qt-console/bcomm/dircomm.cpp:398 src/qt-console/bcomm/dircomm.cpp:408
 msgid "At prompt waiting for input ..."
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:415
+#: src/qt-console/bcomm/dircomm.cpp:416
 msgid "Command failed."
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm.cpp:487
+#: src/qt-console/bcomm/dircomm.cpp:488
 msgid "Director disconnected."
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:107
+#: src/qt-console/bcomm/dircomm_auth.cpp:111
 #, c-format
 msgid "Director authorization problem at \"%s:%d\"\n"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:114
+#: src/qt-console/bcomm/dircomm_auth.cpp:118
 #, c-format
 msgid ""
 "Authorization problem: Remote server at \"%s:%d\" did not advertise required "
 "TLS support.\n"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:122
+#: src/qt-console/bcomm/dircomm_auth.cpp:126
 #, c-format
 msgid ""
 "Authorization problem with Director at \"%s:%d\": Remote server requires "
 "TLS.\n"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:133
+#: src/qt-console/bcomm/dircomm_auth.cpp:137
 #, c-format
 msgid "TLS negotiation failed with Director at \"%s:%d\"\n"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:145
+#: src/qt-console/bcomm/dircomm_auth.cpp:149
 #, c-format
 msgid ""
 "Bad response to Hello command: ERR=%s\n"
 "The Director at \"%s:%d\" is probably not running.\n"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:154
+#: src/qt-console/bcomm/dircomm_auth.cpp:158
 #, c-format
 msgid "Director at \"%s:%d\" rejected Hello command\n"
 msgstr ""
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:169
+#: src/qt-console/bcomm/dircomm_auth.cpp:173
 #, c-format
 msgid ""
 "Authorization problem with Director at \"%s:%d\"\n"
 "Most likely the passwords do not agree.\n"
 "If you are using TLS, there may have been a certificate validation error "
 "during the TLS handshake.\n"
-"Please see "
+"For help, please see "
 msgstr ""
 
-#: src/qt-console/main.cpp:154
+#: src/qt-console/main.cpp:159
 msgid "Cryptography library initialization failed.\n"
 msgstr ""
 
-#: src/qt-console/main.cpp:158
+#: src/qt-console/main.cpp:163
 #, c-format
 msgid "Please correct configuration file: %s\n"
 msgstr ""
 
-#: src/qt-console/main.cpp:180
+#: src/qt-console/main.cpp:187
 #, c-format
 msgid ""
 "\n"
@@ -257,88 +261,88 @@ msgid ""
 "\n"
 msgstr ""
 
-#: src/qt-console/main.cpp:213 src/qt-console/main.cpp:243
+#: src/qt-console/main.cpp:220 src/qt-console/main.cpp:250
 msgid "TLS required but not configured in Bacula.\n"
 msgstr ""
 
-#: src/qt-console/main.cpp:221
+#: src/qt-console/main.cpp:228
 #, c-format
 msgid ""
 "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined for "
 "Director \"%s\" in %s. At least one CA certificate store is required.\n"
 msgstr ""
 
-#: src/qt-console/main.cpp:230
+#: src/qt-console/main.cpp:237
 #, c-format
 msgid ""
 "No Director resource defined in %s\n"
 "Without that I don't how to speak to the Director :-(\n"
 msgstr ""
 
-#: src/qt-console/main.cpp:251
+#: src/qt-console/main.cpp:258
 #, c-format
 msgid ""
 "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined for "
 "Console \"%s\" in %s.\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:75
+#: src/qt-console/tray-monitor/authenticate.cpp:79
 msgid ""
 "Director authorization problem.\n"
 "Most likely the passwords do not agree.\n"
-"Please see "
+"For help, please see "
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:84
+#: src/qt-console/tray-monitor/authenticate.cpp:88
 #, c-format
 msgid "Bad response to Hello command: ERR=%s\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:91
+#: src/qt-console/tray-monitor/authenticate.cpp:95
 msgid "Director rejected Hello command\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:119
+#: src/qt-console/tray-monitor/authenticate.cpp:123
 #, c-format
 msgid "Error sending Hello to Storage daemon. ERR=%s\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:125
+#: src/qt-console/tray-monitor/authenticate.cpp:129
 msgid ""
 "Director and Storage daemon passwords or names not the same.\n"
-"Please see "
+"For help, please see "
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:132
+#: src/qt-console/tray-monitor/authenticate.cpp:136
 #, c-format
 msgid "bdird<stored: bad response to Hello command: ERR=%s\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:139
+#: src/qt-console/tray-monitor/authenticate.cpp:143
 msgid "Storage daemon rejected Hello command\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:165
+#: src/qt-console/tray-monitor/authenticate.cpp:169
 #, c-format
 msgid "Error sending Hello to File daemon. ERR=%s\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:171
+#: src/qt-console/tray-monitor/authenticate.cpp:175
 msgid ""
 "Director and File daemon passwords or names not the same.\n"
-"Please see "
+"For help, please see "
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:178
+#: src/qt-console/tray-monitor/authenticate.cpp:182
 #, c-format
 msgid "Bad response from File daemon to Hello command: ERR=%s\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:185
+#: src/qt-console/tray-monitor/authenticate.cpp:189
 msgid "File daemon rejected Hello command\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:55
+#: src/qt-console/tray-monitor/tray-monitor.cpp:59
 #, c-format
 msgid ""
 "\n"
@@ -353,14 +357,14 @@ msgid ""
 "\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:204
+#: src/qt-console/tray-monitor/tray-monitor.cpp:210
 #, c-format
 msgid ""
 "Error: %d Monitor resources defined in %s. You must define one and only one "
 "Monitor resource.\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:236
+#: src/qt-console/tray-monitor/tray-monitor.cpp:242
 #, c-format
 msgid ""
 "No Client, Storage or Director resource defined in %s\n"
@@ -368,7 +372,7 @@ msgid ""
 "Daemon :-(\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:251
+#: src/qt-console/tray-monitor/tray-monitor.cpp:257
 #, c-format
 msgid ""
 "Invalid refresh interval defined in %s\n"
@@ -376,106 +380,106 @@ msgid ""
 "minutes (read value: %d).\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:319
+#: src/qt-console/tray-monitor/tray-monitor.cpp:325
 #, c-format
 msgid "Error, currentitem is not a Client or a Storage..\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:357
+#: src/qt-console/tray-monitor/tray-monitor.cpp:363
 #, c-format
 msgid "Connecting to Client %s:%d"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:362
+#: src/qt-console/tray-monitor/tray-monitor.cpp:368
 msgid "File daemon"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:367
+#: src/qt-console/tray-monitor/tray-monitor.cpp:373
 #, c-format
 msgid "Connecting to Storage %s:%d"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:372
+#: src/qt-console/tray-monitor/tray-monitor.cpp:378
 msgid "Storage daemon"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:376
-#: src/qt-console/tray-monitor/tray-monitor.cpp:406
+#: src/qt-console/tray-monitor/tray-monitor.cpp:382
+#: src/qt-console/tray-monitor/tray-monitor.cpp:412
 #, c-format
 msgid "Error, currentitem is not a Client, a Storage or a Director..\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:381
+#: src/qt-console/tray-monitor/tray-monitor.cpp:387
 msgid "Cannot connect to daemon."
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:390
+#: src/qt-console/tray-monitor/tray-monitor.cpp:396
 #, c-format
 msgid "Authentication error : %s"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:397
+#: src/qt-console/tray-monitor/tray-monitor.cpp:403
 msgid "Opened connection with Director daemon."
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:400
+#: src/qt-console/tray-monitor/tray-monitor.cpp:406
 msgid "Opened connection with File daemon."
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:403
+#: src/qt-console/tray-monitor/tray-monitor.cpp:409
 msgid "Opened connection with Storage daemon."
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:454
+#: src/qt-console/tray-monitor/tray-monitor.cpp:460
 msgid "Error : BNET_HARDEOF or BNET_ERROR"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:463
+#: src/qt-console/tray-monitor/tray-monitor.cpp:469
 msgid "Error : Connection closed."
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:156
+#: src/qt-console/tray-monitor/tray_conf.cpp:160
 #, c-format
 msgid "No %s resource defined\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:165
+#: src/qt-console/tray-monitor/tray_conf.cpp:169
 #, c-format
 msgid "Monitor: name=%s FDtimeout=%s SDtimeout=%s\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:171
+#: src/qt-console/tray-monitor/tray_conf.cpp:175
 #, c-format
 msgid "Director: name=%s address=%s FDport=%d\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:175
+#: src/qt-console/tray-monitor/tray_conf.cpp:179
 #, c-format
 msgid "Client: name=%s address=%s FDport=%d\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:179
+#: src/qt-console/tray-monitor/tray_conf.cpp:183
 #, c-format
 msgid "Storage: name=%s address=%s SDport=%d\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:187
+#: src/qt-console/tray-monitor/tray_conf.cpp:191
 #, c-format
 msgid "Unknown resource type %d in dump_resource.\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:245
+#: src/qt-console/tray-monitor/tray_conf.cpp:249
 #, c-format
 msgid "Unknown resource type %d in free_resource.\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:282
+#: src/qt-console/tray-monitor/tray_conf.cpp:286
 #, c-format
 msgid "Too many items in %s resource\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:302
-#: src/qt-console/tray-monitor/tray_conf.cpp:340
+#: src/qt-console/tray-monitor/tray_conf.cpp:306
+#: src/qt-console/tray-monitor/tray_conf.cpp:344
 #, c-format
 msgid "Unknown resource type %d in save_resource.\n"
 msgstr ""
diff --git a/po/uk.po b/po/uk.po
index da77d3d..89af817 100644
--- a/po/uk.po
+++ b/po/uk.po
@@ -1,14 +1,14 @@
 # Ukrainian translations for bacula package
 # Український переклад bacula.
-# Copyright (C) 2010-2014 Kern Sibbald
-# This file is distributed under the same license as the bacula package.
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 # Vitaliy Kosharskiy <vkosharskiy at ukrcard.com.ua>, 2010.
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: bacula 5.0.3\n"
+"Project-Id-Version: bacula 3.0.3\n"
 "Report-Msgid-Bugs-To: bacula-devel at lists.sourceforge.net\n"
-"POT-Creation-Date: 2014-07-29 18:18+0200\n"
+"POT-Creation-Date: 2015-08-09 15:05+0200\n"
 "PO-Revision-Date: 2010-01-08 17:32+0300\n"
 "Last-Translator: Vitaliy Kosharskiy <kisa_co at ukrpost.net>\n"
 "Language-Team: Ukrainian\n"
@@ -19,123 +19,128 @@ msgstr ""
 "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
 "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
 
-#: src/baconfig.h:60 src/baconfig.h:61 src/baconfig.h:66 src/baconfig.h:67
+#: src/baconfig.h:64 src/baconfig.h:65 src/baconfig.h:70 src/baconfig.h:71
+#: src/baconfig.h:82 src/baconfig.h:83
 #, c-format
 msgid "Failed ASSERT: %s\n"
 msgstr ""
 
-#: src/baconfig.h:76
+#: src/baconfig.h:91
 msgid "*None*"
 msgstr ""
 
-#: src/lib/status.h:73
+#: src/lib/status.h:78
 msgid ""
 "\n"
 "Terminated Jobs:\n"
 msgstr ""
 
-#: src/lib/status.h:80
+#: src/lib/status.h:85
 msgid " JobId  Level    Files      Bytes   Status   Finished        Name \n"
 msgstr ""
 
-#: src/lib/status.h:82
+#: src/lib/status.h:87
 msgid "===================================================================\n"
 msgstr ""
 
-#: src/lib/status.h:102
+#: src/lib/status.h:107
 msgid "Created"
 msgstr ""
 
-#: src/lib/status.h:106
+#: src/lib/status.h:111
 msgid "Error"
 msgstr ""
 
-#: src/lib/status.h:109
+#: src/lib/status.h:114
 msgid "Diffs"
 msgstr ""
 
-#: src/lib/status.h:112
+#: src/lib/status.h:117
 msgid "Cancel"
 msgstr ""
 
-#: src/lib/status.h:115
+#: src/lib/status.h:120
 msgid "OK"
 msgstr ""
 
-#: src/lib/status.h:118
+#: src/lib/status.h:123
 msgid "OK -- with warnings"
 msgstr ""
 
-#: src/lib/status.h:122
+#: src/lib/status.h:126
+msgid "Incomplete"
+msgstr ""
+
+#: src/lib/status.h:129
 msgid "Other"
 msgstr ""
 
-#: src/lib/status.h:134
+#: src/lib/status.h:141
 #, c-format
 msgid "%6d\t%-6s\t%8s\t%10s\t%-7s\t%-8s\t%s\n"
 msgstr ""
 
-#: src/lib/status.h:142
+#: src/lib/status.h:149
 #, c-format
 msgid "%6d  %-6s %8s %10s  %-7s  %-8s %s\n"
 msgstr ""
 
-#: src/lib/status.h:171 src/lib/status.h:182 src/lib/status.h:196
-#: src/lib/status.h:200 src/lib/status.h:204
+#: src/lib/status.h:178 src/lib/status.h:189 src/lib/status.h:203
+#: src/lib/status.h:207 src/lib/status.h:211
 msgid "Bacula "
 msgstr ""
 
-#: src/qt-console/bat_conf.cpp:130
+#: src/qt-console/bat_conf.cpp:133
 #, c-format
 msgid "No record for %d %s\n"
 msgstr "Відсутні записи для %d %s\n"
 
-#: src/qt-console/bat_conf.cpp:139
+#: src/qt-console/bat_conf.cpp:142
 #, c-format
 msgid "Director: name=%s address=%s DIRport=%d\n"
 msgstr "Керівник: назва=%s адреса=%s DIRport=%d\n"
 
-#: src/qt-console/bat_conf.cpp:143
+#: src/qt-console/bat_conf.cpp:146
 #, c-format
 msgid "Console: name=%s\n"
 msgstr "Консоль: назва=%s\n"
 
-#: src/qt-console/bat_conf.cpp:146
-#: src/qt-console/tray-monitor/tray_conf.cpp:183
+#: src/qt-console/bat_conf.cpp:149
+#: src/qt-console/tray-monitor/tray_conf.cpp:187
 #, fuzzy, c-format
 msgid "ConsoleFont: name=%s font face=%s\n"
 msgstr "Консоль: назва=%s rcfile=%s histfile=%s\n"
 
-#: src/qt-console/bat_conf.cpp:150 src/qt-console/bat_conf.cpp:231
-#: src/qt-console/bat_conf.cpp:279 src/qt-console/bat_conf.cpp:309
+#: src/qt-console/bat_conf.cpp:153 src/qt-console/bat_conf.cpp:234
+#: src/qt-console/bat_conf.cpp:284 src/qt-console/bat_conf.cpp:314
 #, c-format
 msgid "Unknown resource type %d\n"
 msgstr "Невідомий тип ресурсу %d\n"
 
-#: src/qt-console/bat_conf.cpp:257
-#: src/qt-console/tray-monitor/tray_conf.cpp:276
+#: src/qt-console/bat_conf.cpp:262
+#: src/qt-console/tray-monitor/tray_conf.cpp:280
 #, c-format
 msgid "%s item is required in %s resource, but not found.\n"
 msgstr "Не знайдено необхідний елемент %s для ресурсу %s.\n"
 
-#: src/qt-console/bat_conf.cpp:326
-#: src/qt-console/tray-monitor/tray_conf.cpp:360
+#: src/qt-console/bat_conf.cpp:331
+#: src/qt-console/tray-monitor/tray_conf.cpp:364
 #, c-format
 msgid "Attempt to define second %s resource named \"%s\" is not permitted.\n"
 msgstr "Спроба визначити другий %s ресурс із назвою \"%s\" не дозволяється.\n"
 
-#: src/qt-console/bcomm/dircomm.cpp:85
+#: src/qt-console/bcomm/dircomm.cpp:89
 #, c-format
 msgid "Already connected\"%s\".\n"
 msgstr "Вже приєднано\"%s\".\n"
 
-#: src/qt-console/bcomm/dircomm.cpp:96
-#: src/qt-console/tray-monitor/tray-monitor.cpp:347
+#: src/qt-console/bcomm/dircomm.cpp:100
+#: src/qt-console/tray-monitor/tray-monitor.cpp:353
 #, c-format
 msgid "Connecting to Director %s:%d"
 msgstr "Приєднуюсь до Керівника %s:%d"
 
-#: src/qt-console/bcomm/dircomm.cpp:98
+#: src/qt-console/bcomm/dircomm.cpp:102
 #, c-format
 msgid ""
 "Connecting to Director %s:%d\n"
@@ -144,59 +149,59 @@ msgstr ""
 "З'єднуюсь із Керівником %s:%d\n"
 "\n"
 
-#: src/qt-console/bcomm/dircomm.cpp:150
+#: src/qt-console/bcomm/dircomm.cpp:154
 #, c-format
 msgid "Failed to initialize TLS context for Console \"%s\".\n"
 msgstr "Ініціалізація контексту TLS для Консолі невдала \"%s\".\n"
 
-#: src/qt-console/bcomm/dircomm.cpp:173
+#: src/qt-console/bcomm/dircomm.cpp:177
 #, c-format
 msgid "Failed to initialize TLS context for Director \"%s\".\n"
 msgstr "Ініціалізація контексту TLS для Керівника невдала \"%s\".\n"
 
-#: src/qt-console/bcomm/dircomm.cpp:195
-#: src/qt-console/tray-monitor/tray-monitor.cpp:352
+#: src/qt-console/bcomm/dircomm.cpp:199
+#: src/qt-console/tray-monitor/tray-monitor.cpp:358
 msgid "Director daemon"
 msgstr "Керівник"
 
-#: src/qt-console/bcomm/dircomm.cpp:233
+#: src/qt-console/bcomm/dircomm.cpp:237
 msgid "Initializing ..."
 msgstr "Ініціалізація ..."
 
-#: src/qt-console/bcomm/dircomm.cpp:249 src/qt-console/console/console.cpp:130
+#: src/qt-console/bcomm/dircomm.cpp:253 src/qt-console/console/console.cpp:134
 msgid "Connected"
 msgstr "З'єднано"
 
-#: src/qt-console/bcomm/dircomm.cpp:373
+#: src/qt-console/bcomm/dircomm.cpp:377
 msgid "Command completed ..."
 msgstr "Команду виконано ..."
 
-#: src/qt-console/bcomm/dircomm.cpp:380 src/qt-console/console/console.cpp:367
+#: src/qt-console/bcomm/dircomm.cpp:384 src/qt-console/console/console.cpp:371
 msgid "Processing command ..."
 msgstr "Виконання команди ..."
 
-#: src/qt-console/bcomm/dircomm.cpp:387
+#: src/qt-console/bcomm/dircomm.cpp:391
 msgid "At main prompt waiting for input ..."
 msgstr "Очікуться введення у основній рядку ..."
 
-#: src/qt-console/bcomm/dircomm.cpp:394 src/qt-console/bcomm/dircomm.cpp:407
+#: src/qt-console/bcomm/dircomm.cpp:398 src/qt-console/bcomm/dircomm.cpp:408
 msgid "At prompt waiting for input ..."
 msgstr "Очікуться введення у рядку ..."
 
-#: src/qt-console/bcomm/dircomm.cpp:415
+#: src/qt-console/bcomm/dircomm.cpp:416
 msgid "Command failed."
 msgstr "Помилка команди"
 
-#: src/qt-console/bcomm/dircomm.cpp:487
+#: src/qt-console/bcomm/dircomm.cpp:488
 msgid "Director disconnected."
 msgstr "Керівник від'єднано"
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:107
+#: src/qt-console/bcomm/dircomm_auth.cpp:111
 #, c-format
 msgid "Director authorization problem at \"%s:%d\"\n"
 msgstr "Проблеми авторизації Директора \"%s:%d\"\n"
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:114
+#: src/qt-console/bcomm/dircomm_auth.cpp:118
 #, c-format
 msgid ""
 "Authorization problem: Remote server at \"%s:%d\" did not advertise required "
@@ -205,7 +210,7 @@ msgstr ""
 "Проблеми авторизації: Віддалений сервер \"%s:%d\" не повідомляє про "
 "необхідність використання TLS.\n"
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:122
+#: src/qt-console/bcomm/dircomm_auth.cpp:126
 #, c-format
 msgid ""
 "Authorization problem with Director at \"%s:%d\": Remote server requires "
@@ -213,12 +218,12 @@ msgid ""
 msgstr ""
 "Проблеми авторизації Керівника \"%s:%d\": Віддалений сепвер вимагає TLS.\n"
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:133
+#: src/qt-console/bcomm/dircomm_auth.cpp:137
 #, c-format
 msgid "TLS negotiation failed with Director at \"%s:%d\"\n"
 msgstr "Встановлення TLS із Керівником невдале \"%s:%d\"\n"
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:145
+#: src/qt-console/bcomm/dircomm_auth.cpp:149
 #, c-format
 msgid ""
 "Bad response to Hello command: ERR=%s\n"
@@ -227,19 +232,19 @@ msgstr ""
 "Погана відповідь на команду Hello: ERR=%s\n"
 "Керівник \"%s:%d\" ймовірно не запущений.\n"
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:154
+#: src/qt-console/bcomm/dircomm_auth.cpp:158
 #, c-format
 msgid "Director at \"%s:%d\" rejected Hello command\n"
 msgstr "Керівник \"%s:%d\" відкинув команду Hello\n"
 
-#: src/qt-console/bcomm/dircomm_auth.cpp:169
+#: src/qt-console/bcomm/dircomm_auth.cpp:173
 #, fuzzy, c-format
 msgid ""
 "Authorization problem with Director at \"%s:%d\"\n"
 "Most likely the passwords do not agree.\n"
 "If you are using TLS, there may have been a certificate validation error "
 "during the TLS handshake.\n"
-"Please see "
+"For help, please see "
 msgstr ""
 "Проблеми авторизації із Керівником \"%s:%d\"\n"
 "Швидше за все, проблема у паролях.\n"
@@ -248,17 +253,17 @@ msgstr ""
 "Для отримання допомоги, будь ласка, перегляньте http://www.bacula.org/en/rel-"
 "manual/Bacula_Freque_Asked_Questi.html#SECTION003760000000000000000.\n"
 
-#: src/qt-console/main.cpp:154
+#: src/qt-console/main.cpp:159
 msgid "Cryptography library initialization failed.\n"
 msgstr "Ініціалізація криптографії невдала.\n"
 
-#: src/qt-console/main.cpp:158
+#: src/qt-console/main.cpp:163
 #, c-format
 msgid "Please correct configuration file: %s\n"
 msgstr "Будьласка виправте файл конфігурації: %s\n"
 
-#: src/qt-console/main.cpp:180
-#, c-format
+#: src/qt-console/main.cpp:187
+#, fuzzy, c-format
 msgid ""
 "\n"
 "Version: %s (%s) %s %s %s\n"
@@ -282,11 +287,11 @@ msgstr ""
 "       -?          print this message.\n"
 "\n"
 
-#: src/qt-console/main.cpp:213 src/qt-console/main.cpp:243
+#: src/qt-console/main.cpp:220 src/qt-console/main.cpp:250
 msgid "TLS required but not configured in Bacula.\n"
 msgstr "TLS необхідний, але не налаштовано у Bacula.\n"
 
-#: src/qt-console/main.cpp:221
+#: src/qt-console/main.cpp:228
 #, c-format
 msgid ""
 "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined for "
@@ -296,7 +301,7 @@ msgstr ""
 "задано для Керівника \"%s\" у %s. Необхідне щонайменше одне сховище для "
 "сертифікату CA.\n"
 
-#: src/qt-console/main.cpp:230
+#: src/qt-console/main.cpp:237
 #, c-format
 msgid ""
 "No Director resource defined in %s\n"
@@ -305,7 +310,7 @@ msgstr ""
 "У %s не задано ресурсу Керівника\n"
 "Без цього я не знаю як спілкуватись із Керівником :-(\n"
 
-#: src/qt-console/main.cpp:251
+#: src/qt-console/main.cpp:258
 #, c-format
 msgid ""
 "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined for "
@@ -314,68 +319,68 @@ msgstr ""
 "Жоден із параметрів \"TLS CA Certificate\" або \"TLS CA Certificate Dir\" не "
 "задано для Консолі \"%s\" у %s.\n"
 
-#: src/qt-console/tray-monitor/authenticate.cpp:75
+#: src/qt-console/tray-monitor/authenticate.cpp:79
 #, fuzzy
 msgid ""
 "Director authorization problem.\n"
 "Most likely the passwords do not agree.\n"
-"Please see "
+"For help, please see "
 msgstr ""
 "Проблеми під час авторизації Керівником.\n"
 "Швидше за все, невірні паролі.\n"
 "Для отримання допомоги, будь ласка, перегляньте http://www.bacula.org/en/rel-"
 "manual/Bacula_Freque_Asked_Questi.html#SECTION003760000000000000000.\n"
 
-#: src/qt-console/tray-monitor/authenticate.cpp:84
+#: src/qt-console/tray-monitor/authenticate.cpp:88
 #, c-format
 msgid "Bad response to Hello command: ERR=%s\n"
 msgstr "Погана відповідь на команду Hello: ERR=%s\n"
 
-#: src/qt-console/tray-monitor/authenticate.cpp:91
+#: src/qt-console/tray-monitor/authenticate.cpp:95
 msgid "Director rejected Hello command\n"
 msgstr "Керівник не прийняв команду Hello\n"
 
-#: src/qt-console/tray-monitor/authenticate.cpp:119
+#: src/qt-console/tray-monitor/authenticate.cpp:123
 #, c-format
 msgid "Error sending Hello to Storage daemon. ERR=%s\n"
 msgstr "Не вдалося надіслати Hello до Зберігача. ERR=%s\n"
 
-#: src/qt-console/tray-monitor/authenticate.cpp:125
+#: src/qt-console/tray-monitor/authenticate.cpp:129
 msgid ""
 "Director and Storage daemon passwords or names not the same.\n"
-"Please see "
+"For help, please see "
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:132
+#: src/qt-console/tray-monitor/authenticate.cpp:136
 #, c-format
 msgid "bdird<stored: bad response to Hello command: ERR=%s\n"
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:139
+#: src/qt-console/tray-monitor/authenticate.cpp:143
 msgid "Storage daemon rejected Hello command\n"
 msgstr "Зберігач відхилив команду Hello\n"
 
-#: src/qt-console/tray-monitor/authenticate.cpp:165
+#: src/qt-console/tray-monitor/authenticate.cpp:169
 #, c-format
 msgid "Error sending Hello to File daemon. ERR=%s\n"
 msgstr "Помилка надсилання Hello до Збирача. ERR=%s\n"
 
-#: src/qt-console/tray-monitor/authenticate.cpp:171
+#: src/qt-console/tray-monitor/authenticate.cpp:175
 msgid ""
 "Director and File daemon passwords or names not the same.\n"
-"Please see "
+"For help, please see "
 msgstr ""
 
-#: src/qt-console/tray-monitor/authenticate.cpp:178
+#: src/qt-console/tray-monitor/authenticate.cpp:182
 #, c-format
 msgid "Bad response from File daemon to Hello command: ERR=%s\n"
 msgstr "Невірна відповідь від Збирача на команду Hello: ERR=%s\n"
 
-#: src/qt-console/tray-monitor/authenticate.cpp:185
+#: src/qt-console/tray-monitor/authenticate.cpp:189
 msgid "File daemon rejected Hello command\n"
 msgstr "Збирач відхилив команду Hello \n"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:55
+#: src/qt-console/tray-monitor/tray-monitor.cpp:59
 #, fuzzy, c-format
 msgid ""
 "\n"
@@ -401,7 +406,7 @@ msgstr ""
 "       -?            показати це повідомлення.\n"
 "\n"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:204
+#: src/qt-console/tray-monitor/tray-monitor.cpp:210
 #, c-format
 msgid ""
 "Error: %d Monitor resources defined in %s. You must define one and only one "
@@ -410,7 +415,7 @@ msgstr ""
 "Помилка: %d ресурсів Спостерігача визначено у %s. Ви повинні визначити одині "
 "тільки один ресурс Спостерігача.\n"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:236
+#: src/qt-console/tray-monitor/tray-monitor.cpp:242
 #, c-format
 msgid ""
 "No Client, Storage or Director resource defined in %s\n"
@@ -420,7 +425,7 @@ msgstr ""
 "У %s не визначено жодного ресурсу Клієнту, Зберігача або Керівника\n"
 "Без цього я не знаю як отримати статус Зберігача, Збирача або Керівника\n"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:251
+#: src/qt-console/tray-monitor/tray-monitor.cpp:257
 #, c-format
 msgid ""
 "Invalid refresh interval defined in %s\n"
@@ -431,111 +436,115 @@ msgstr ""
 "Це значення повинно бути не меньше 1 секунди та не більше 10 хвилин "
 "(теперішнє значення: %d).\n"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:319
+#: src/qt-console/tray-monitor/tray-monitor.cpp:325
 #, c-format
 msgid "Error, currentitem is not a Client or a Storage..\n"
 msgstr "Помилка. Поточний пункт не є Клієнтом або Зберігачем.\n"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:357
+#: src/qt-console/tray-monitor/tray-monitor.cpp:363
 #, c-format
 msgid "Connecting to Client %s:%d"
 msgstr "Приєднуюсь до Клієнта %s:%d"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:362
+#: src/qt-console/tray-monitor/tray-monitor.cpp:368
 msgid "File daemon"
 msgstr "Збирач"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:367
+#: src/qt-console/tray-monitor/tray-monitor.cpp:373
 #, c-format
 msgid "Connecting to Storage %s:%d"
 msgstr "Приєднуюсь до Зберігача %s:%d"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:372
+#: src/qt-console/tray-monitor/tray-monitor.cpp:378
 msgid "Storage daemon"
 msgstr "Зберігач"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:376
-#: src/qt-console/tray-monitor/tray-monitor.cpp:406
+#: src/qt-console/tray-monitor/tray-monitor.cpp:382
+#: src/qt-console/tray-monitor/tray-monitor.cpp:412
 #, c-format
 msgid "Error, currentitem is not a Client, a Storage or a Director..\n"
 msgstr "Помилка. Поточний пункт не є Клієнтом або Зберігачем.\n"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:381
+#: src/qt-console/tray-monitor/tray-monitor.cpp:387
 msgid "Cannot connect to daemon."
 msgstr "Не можу приєднатись до демону."
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:390
+#: src/qt-console/tray-monitor/tray-monitor.cpp:396
 #, c-format
 msgid "Authentication error : %s"
 msgstr "Помилка автентифікації : %s"
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:397
+#: src/qt-console/tray-monitor/tray-monitor.cpp:403
 msgid "Opened connection with Director daemon."
 msgstr "Відкриті з'єднання із Керівником."
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:400
+#: src/qt-console/tray-monitor/tray-monitor.cpp:406
 msgid "Opened connection with File daemon."
 msgstr "Відкриті з'єднання із Збирачем."
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:403
+#: src/qt-console/tray-monitor/tray-monitor.cpp:409
 msgid "Opened connection with Storage daemon."
 msgstr "Відкриті з'єднання із Зберігачем."
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:454
+#: src/qt-console/tray-monitor/tray-monitor.cpp:460
 msgid "Error : BNET_HARDEOF or BNET_ERROR"
 msgstr ""
 
-#: src/qt-console/tray-monitor/tray-monitor.cpp:463
+#: src/qt-console/tray-monitor/tray-monitor.cpp:469
 msgid "Error : Connection closed."
 msgstr "Помилка : З'єднання завершено"
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:156
+#: src/qt-console/tray-monitor/tray_conf.cpp:160
 #, c-format
 msgid "No %s resource defined\n"
 msgstr "Ресурс %s не визначено\n"
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:165
+#: src/qt-console/tray-monitor/tray_conf.cpp:169
 #, c-format
 msgid "Monitor: name=%s FDtimeout=%s SDtimeout=%s\n"
 msgstr "Споглядач: назва=%s FDtimeout=%s SDtimeout=%s\n"
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:171
+#: src/qt-console/tray-monitor/tray_conf.cpp:175
 #, c-format
 msgid "Director: name=%s address=%s FDport=%d\n"
 msgstr "Керівник: назва=%s address=%s FDport=%d\n"
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:175
+#: src/qt-console/tray-monitor/tray_conf.cpp:179
 #, c-format
 msgid "Client: name=%s address=%s FDport=%d\n"
 msgstr "Клієнт: назва=%s address=%s FDport=%d\n"
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:179
+#: src/qt-console/tray-monitor/tray_conf.cpp:183
 #, c-format
 msgid "Storage: name=%s address=%s SDport=%d\n"
 msgstr "Сховище: назва=%s address=%s SDport=%d\n"
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:187
+#: src/qt-console/tray-monitor/tray_conf.cpp:191
 #, c-format
 msgid "Unknown resource type %d in dump_resource.\n"
 msgstr "Невідомий тип ресурсу %d у dump_resource.\n"
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:245
+#: src/qt-console/tray-monitor/tray_conf.cpp:249
 #, c-format
 msgid "Unknown resource type %d in free_resource.\n"
 msgstr "Невідомий тип ресурсу %d у free_resource.\n"
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:282
+#: src/qt-console/tray-monitor/tray_conf.cpp:286
 #, c-format
 msgid "Too many items in %s resource\n"
 msgstr "Забагато елементів у ресурсі %s\n"
 
-#: src/qt-console/tray-monitor/tray_conf.cpp:302
-#: src/qt-console/tray-monitor/tray_conf.cpp:340
+#: src/qt-console/tray-monitor/tray_conf.cpp:306
+#: src/qt-console/tray-monitor/tray_conf.cpp:344
 #, c-format
 msgid "Unknown resource type %d in save_resource.\n"
 msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 
 #, fuzzy
+#~ msgid "Fetch failed: ERR=%s\n"
+#~ msgstr "Помилка у %s файл %s: ERR=%s\n"
+
+#, fuzzy
 #~ msgid "Could not init database batch connection\n"
 #~ msgstr "Не вдалось відкрити%s: ERR=%s\n"
 
@@ -543,6 +552,14 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 #~ msgid "Create db Object record %s failed. ERR=%s"
 #~ msgstr "Не можливо створити теку %s: ERR=%s\n"
 
+#, fuzzy
+#~ msgid "Media record for Volume name \"%s\" not found.\n"
+#~ msgstr "Заборонені символи у назві Тому \"%s\"\n"
+
+#, fuzzy
+#~ msgid "Snapshot record for Snapshot name \"%s\" not found.\n"
+#~ msgstr "Заборонені символи у назві Тому \"%s\"\n"
+
 #~ msgid ""
 #~ "Authorization problem: Remote server did not advertise required TLS "
 #~ "support.\n"
@@ -562,7 +579,7 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 #~ "Most likely the passwords do not agree.\n"
 #~ "If you are using TLS, there may have been a certificate validation error "
 #~ "during the TLS handshake.\n"
-#~ "Please see "
+#~ "For help, please see "
 #~ msgstr ""
 #~ "Проблеми авторизації Керівника.\n"
 #~ "Швидше за все, проблема у паролях.\n"
@@ -571,9 +588,10 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 #~ "Для отримання допомоги, будь ласка, перегляньте http://www.bacula.org/en/"
 #~ "rel-manual/Bacula_Freque_Asked_Questi.html#SECTION003760000000000000000.\n"
 
+#, fuzzy
 #~ msgid ""
 #~ "\n"
-#~ "Version: "
+#~ "%sVersion: "
 #~ msgstr ""
 #~ "\n"
 #~ "Вірсія: "
@@ -599,6 +617,10 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 #~ msgid "echo command string"
 #~ msgstr "луна командного рядку"
 
+#, fuzzy
+#~ msgid "encode command string"
+#~ msgstr "луна командного рядку"
+
 #~ msgid "execute an external command"
 #~ msgstr "виконати зовнішню команду"
 
@@ -660,10 +682,45 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 #~ msgid "Too many arguments. Enclose command in double quotes.\n"
 #~ msgstr "Забагато параметрів. Оточіть комінду подвійними лапками.\n"
 
+#, fuzzy
+#~ msgid "@exec error: ERR=%s\n"
+#~ msgstr "Не вдалось створити %s: ERR=%s\n"
+
 #~ msgid "Console: name=%s rcfile=%s histfile=%s\n"
 #~ msgstr "Консоль: назва=%s rcfile=%s histfile=%s\n"
 
 #, fuzzy
+#~ msgid ""
+#~ "\n"
+#~ "%sVersion: %s (%s)\n"
+#~ "\n"
+#~ "Usage: bdirjson [-f -s] [-c config_file] [-d debug_level] [config_file]\n"
+#~ "       -r <res>    get resource type <res>\n"
+#~ "       -n <name>   get resource <name>\n"
+#~ "       -l <dirs>   get only directives matching dirs (use with -r)\n"
+#~ "       -D          get only data\n"
+#~ "       -R          do not apply JobDefs to Job\n"
+#~ "       -c <file>   set configuration file to file\n"
+#~ "       -d <nn>     set debug level to <nn>\n"
+#~ "       -dt         print timestamp in debug output\n"
+#~ "       -t          test - read configuration and exit\n"
+#~ "       -s          output in show text format\n"
+#~ "       -v          verbose user messages\n"
+#~ "       -?          print this message.\n"
+#~ "\n"
+#~ msgstr ""
+#~ "\n"
+#~ "Версія: %s (%s) %s %s %s\n"
+#~ "\n"
+#~ "Використання: bat [-s] [-c config_file] [-d debug_level] [config_file]\n"
+#~ "       -c <file>   set configuration file to file\n"
+#~ "       -dnn        set debug level to nn\n"
+#~ "       -s          без сигналів\n"
+#~ "       -t          перевірка - прочитати конфігурацію і вийти\n"
+#~ "       -?          print this message.\n"
+#~ "\n"
+
+#, fuzzy
 #~ msgid "Attribute create error: ERR=%s"
 #~ msgstr "Не вдалось створити %s: ERR=%s\n"
 
@@ -679,22 +736,23 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 #, fuzzy
 #~ msgid ""
 #~ "\n"
-#~ "Version: %s (%s)\n"
+#~ "%sVersion: %s (%s)\n"
 #~ "\n"
 #~ "Usage: bacula-dir [-f -s] [-c config_file] [-d debug_level] "
 #~ "[config_file]\n"
-#~ "       -c <file>   set configuration file to file\n"
-#~ "       -d <nn>     set debug level to <nn>\n"
-#~ "       -dt         print timestamp in debug output\n"
-#~ "       -f          run in foreground (for debugging)\n"
-#~ "       -g          groupid\n"
-#~ "       -m          print kaboom output (for debugging)\n"
-#~ "       -r <job>    run <job> now\n"
-#~ "       -s          no signals\n"
-#~ "       -t          test - read configuration and exit\n"
-#~ "       -u          userid\n"
-#~ "       -v          verbose user messages\n"
-#~ "       -?          print this message.\n"
+#~ "     -c <file>        set configuration file to file\n"
+#~ "     -d <nn>[,<tags>] set debug level to <nn>, debug tags to <tags>\n"
+#~ "     -dt              print timestamp in debug output\n"
+#~ "     -T               set trace on\n"
+#~ "     -f               run in foreground (for debugging)\n"
+#~ "     -g               groupid\n"
+#~ "     -m               print kaboom output (for debugging)\n"
+#~ "     -r <job>         run <job> now\n"
+#~ "     -s               no signals\n"
+#~ "     -t               test - read configuration and exit\n"
+#~ "     -u               userid\n"
+#~ "     -v               verbose user messages\n"
+#~ "     -?               print this message.\n"
 #~ "\n"
 #~ msgstr ""
 #~ "\n"
@@ -716,10 +774,24 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 #~ msgid "Could not update storage record for %s\n"
 #~ msgstr "Не вдалось відновити прапорці для файлу %s: ERR=%s\n"
 
+#, fuzzy
+#~ msgid "Client: Name=%s Enabled=%d Address=%s FDport=%d MaxJobs=%u\n"
+#~ msgstr "Клієнт: назва=%s address=%s FDport=%d\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "Attempt to redefine Storage resource \"%s\" referenced on line %d : %s\n"
+#~ msgstr ""
+#~ "Спроба визначити другий %s ресурс із назвою \"%s\" не дозволяється.\n"
+
 #~ msgid "Count not update counter %s: ERR=%s\n"
 #~ msgstr "Лічильник %s не оновлено: ERR=%s\n"
 
 #, fuzzy
+#~ msgid "ComponentInfo failed.\n"
+#~ msgstr "Помилка команди"
+
+#, fuzzy
 #~ msgid "Failed to select Storage daemon.\n"
 #~ msgstr "Відкриті з'єднання із Зберігачем.\n"
 
@@ -727,6 +799,14 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 #~ msgid "canceled"
 #~ msgstr "Статус задачі: Відмінена"
 
+#, fuzzy
+#~ msgid "Cannot create pool \"%s\" in database. ERR=%s"
+#~ msgstr "Не можливо створити теку %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "No Client specified.\n"
+#~ msgstr "зазначений час сну"
+
 #~ msgid "FileSet MD5 digest not found.\n"
 #~ msgstr "Не знайдено відбиток MD5 Набору Файлів.\n"
 
@@ -757,6 +837,18 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 #~ msgstr "Не вдалось відновити прапорці для файлу %s: ERR=%s\n"
 
 #, fuzzy
+#~ msgid "Bad response from SD to %s command. Wanted %s, got %s len=%ld\n"
+#~ msgstr "Невірна відповідь від Збирача на команду Hello: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Client resource not found\n"
+#~ msgstr "Не знайдено відбиток MD5 Набору Файлів.\n"
+
+#, fuzzy
+#~ msgid "Unable to get Snapshot record.\n"
+#~ msgstr "Не вдалось відновити прапорці для файлу %s: ERR=%s\n"
+
+#, fuzzy
 #~ msgid "Terminate Bconsole session"
 #~ msgstr "вивести версію Консолі"
 
@@ -781,6 +873,10 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 #~ msgstr "Керівник"
 
 #, fuzzy
+#~ msgid "Client \"%s\" %sabled\n"
+#~ msgstr "Помилка команди"
+
+#, fuzzy
 #~ msgid ""
 #~ "\n"
 #~ "Can't find %s command.\n"
@@ -788,6 +884,10 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 #~ msgstr ": неправильна команда\n"
 
 #, fuzzy
+#~ msgid "Command line"
+#~ msgstr "Не зрозумілий параметр командного рядка"
+
+#, fuzzy
 #~ msgid "Unable to get Job record for Job=%s\n"
 #~ msgstr "Не вдалось відновити прапорці для файлу %s: ERR=%s\n"
 
@@ -797,7 +897,7 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 
 #, fuzzy
 #~ msgid "Unable to get Client record for Client=%s\n"
-#~ msgstr "Не можливо встановити власника файлу %s: ERR=%s\n"
+#~ msgstr "Не вдалось відновити прапорці для файлу %s: ERR=%s\n"
 
 #, fuzzy
 #~ msgid "Unable to get last Job record for Client=%s\n"
@@ -812,6 +912,10 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 #~ msgstr "Заборонені символи у назві Тому \"%s\"\n"
 
 #, fuzzy
+#~ msgid "Unknown ObjectType %s\n"
+#~ msgstr "Невідомий тип ресурсу %d\n"
+
+#, fuzzy
 #~ msgid "Begin pruning Files.\n"
 #~ msgstr "Починається чистка файлів Клієнта \"%s\"\n"
 
@@ -853,14 +957,30 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 #~ msgstr "Не вдалось відкрити%s: ERR=%s\n"
 
 #, fuzzy
+#~ msgid "Unable to create component file %s. ERR=%s\n"
+#~ msgstr "Не можливо встановити власника файлу %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to fdopen component file %s. ERR=%s\n"
+#~ msgstr "Не можливо встановити власника файлу %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Error writing component file.\n"
+#~ msgstr "Помилка надсилання Hello до Збирача. ERR=%s\n"
+
+#, fuzzy
 #~ msgid "No authorization. NextPool \"%s\".\n"
-#~ msgstr "Проблеми авторизації Директора \"%s:%d\"\n"
+#~ msgstr "Від'єднуюсь від Зберігача %s:%d\n"
 
 #, fuzzy
 #~ msgid "Could not get job record for selected JobId=%d. ERR=%s"
 #~ msgstr "Не вдалось відновити прапорці для файлу %s: ERR=%s\n"
 
 #, fuzzy
+#~ msgid "Can't configure %32s\n"
+#~ msgstr "Не можливо створити чергу(fifo) %s: ERR=%s\n"
+
+#, fuzzy
 #~ msgid "Command input"
 #~ msgstr "Не зрозумілий параметр командного рядка"
 
@@ -869,6 +989,10 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 #~ msgstr "Не вдалось відновити прапорці для файлу %s: ERR=%s\n"
 
 #, fuzzy
+#~ msgid "User specified"
+#~ msgstr "зазначений час сну"
+
+#, fuzzy
 #~ msgid "Media Type specified twice.\n"
 #~ msgstr "зазначений час сну"
 
@@ -876,6 +1000,10 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 #~ msgid "NextPool specified twice.\n"
 #~ msgstr "зазначений час сну"
 
+#, fuzzy
+#~ msgid "Select Client resource"
+#~ msgstr "Не знайдено відбиток MD5 Набору Файлів.\n"
+
 #~ msgid ""
 #~ "Your request has multiple choices for \"%s\". Selection is not possible "
 #~ "in batch mode.\n"
@@ -892,6 +1020,10 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 #~ msgstr "Від'єднуюсь від Зберігача %s:%d\n"
 
 #, fuzzy
+#~ msgid "Console connected %sat %s\n"
+#~ msgstr "Вже приєднано\"%s\".\n"
+
+#, fuzzy
 #~ msgid "is waiting on Storage \"%s\""
 #~ msgstr "Від'єднуюсь від Зберігача %s:%d\n"
 
@@ -901,7 +1033,11 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 
 #, fuzzy
 #~ msgid "is waiting for a Shared Storage device"
-#~ msgstr "Від'єднуюсь від Зберігача %s:%d\n"
+#~ msgstr "Статус задачі: Очікування Зберігача"
+
+#, fuzzy
+#~ msgid "Snapshot parameters"
+#~ msgstr "Невідомий статус"
 
 #, fuzzy
 #~ msgid "Cannot verify checksum for %s\n"
@@ -947,13 +1083,95 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 #~ msgstr "Не можливо встановити власника файлу %s: ERR=%s\n"
 
 #, fuzzy
+#~ msgid "Network send error to SD. Data=%s ERR=%s\n"
+#~ msgstr "Помилка у %s файл %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "\n"
+#~ "%sVersion: %s (%s)\n"
+#~ "\n"
+#~ "Usage: bfdjson [-c config_file] [-d debug_level]\n"
+#~ "        -r <res>    get resource type <res>\n"
+#~ "        -n <name>   get resource <name>\n"
+#~ "        -l <dirs>   get only directives matching dirs (use with -r)\n"
+#~ "        -D          get only data\n"
+#~ "        -c <file>   use <file> as configuration file\n"
+#~ "        -d <nn>     set debug level to <nn>\n"
+#~ "        -dt         print a timestamp in debug output\n"
+#~ "        -t          test configuration file and exit\n"
+#~ "        -v          verbose user messages\n"
+#~ "        -?          print this message.\n"
+#~ "\n"
+#~ msgstr ""
+#~ "Автор Nicolas Boichat (2004)\n"
+#~ "\n"
+#~ "Версія: %s (%s) %s %s %s\n"
+#~ "\n"
+#~ "Використання: tray-monitor [-c config_file] [-d debug_level]\n"
+#~ "       -c <file>     задати конфігураційний файл <file>\n"
+#~ "       -d <nn>       встановити рівень відлагоджування у <nn>\n"
+#~ "       -dt           виводити часову мітку у даних відлагоджування\n"
+#~ "       -t            перевірка - прогитати конфігурацію і завершити\n"
+#~ "       -?            показати це повідомлення.\n"
+#~ "\n"
+
+#, fuzzy
 #~ msgid "Unsupported cipher on this system.\n"
 #~ msgstr "Цей тип відбитку не підтримується: %d\n"
 
+#, fuzzy
+#~ msgid "An error occurred while adding signer the stream.\n"
+#~ msgstr "Помилка у %s файл %s: ERR=%s\n"
+
 #~ msgid "Could not create %s: ERR=%s\n"
 #~ msgstr "Не вдалось створити %s: ERR=%s\n"
 
 #, fuzzy
+#~ msgid "Error while creating command string %s.\n"
+#~ msgstr "Помилка надсилання Hello до Збирача. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to create snapshot record. ERR=%s\n"
+#~ msgstr "Не можливо встановити власника файлу %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to create snapshot record, got %s\n"
+#~ msgstr "Не вдалось відновити прапорці для файлу %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to delete snapshot record. ERR=%s\n"
+#~ msgstr "Не вдалось відновити прапорці для файлу %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to delete snapshot record, got %s\n"
+#~ msgstr "Не вдалось відновити прапорці для файлу %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to get snapshot record. ERR=%s\n"
+#~ msgstr "Не вдалось відновити прапорці для файлу %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to get snapshot record, got %s\n"
+#~ msgstr "Не вдалось відновити прапорці для файлу %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to parse command output\n"
+#~ msgstr "Не можливо встановити власника файлу %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "   Unable to delete snapshot of %s ERR=%s\n"
+#~ msgstr "Не можливо встановити власника файлу %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "   Create Snapshot for %s\n"
+#~ msgstr "Не можливо створити теку %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "   Unable to create snapshot of %s ERR=%s\n"
+#~ msgstr "Не можливо встановити власника файлу %s: ERR=%s\n"
+
+#, fuzzy
 #~ msgid ""
 #~ "\n"
 #~ "%sVersion: %s (%s)\n"
@@ -986,16 +1204,32 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 #~ "\n"
 
 #, fuzzy
-#~ msgid "Command: \"%s\" is disabled.\n"
-#~ msgstr "Помилка команди"
+#~ msgid "Bad Hello command from Director at %s: %s\n"
+#~ msgstr "Від'єднуюсь від Керівника %s:%d\n"
+
+#, fuzzy
+#~ msgid "Connection from unknown Director %s at %s rejected.\n"
+#~ msgstr "Від'єднуюсь від Керівника %s:%d\n"
 
 #, fuzzy
 #~ msgid "SD connect failed: Bad Hello command\n"
 #~ msgstr "Керівник не прийняв команду Hello\n"
 
 #, fuzzy
-#~ msgid "2991 Bad setbandwidth command: %s\n"
-#~ msgstr "Погана відповідь на команду Hello: ERR=%s\n"
+#~ msgid "SD connect failed: Job name not found: %s\n"
+#~ msgstr "Керівник не прийняв команду Hello\n"
+
+#, fuzzy
+#~ msgid "SD \"%s\" tried to connect two times.\n"
+#~ msgstr "Ініціалізація контексту TLS для Консолі невдала \"%s\".\n"
+
+#, fuzzy
+#~ msgid "Recv caps from SD failed. ERR=%s\n"
+#~ msgstr "Помилка у %s файл %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Command: \"%s\" is disabled.\n"
+#~ msgstr "Помилка команди"
 
 #, fuzzy
 #~ msgid "Bad RestoreObject command: %s\n"
@@ -1009,7 +1243,16 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 #~ msgstr "Відкриті з'єднання із Зберігачем.\n"
 
 #, fuzzy
-#~ msgid "Bad response from SD to %s command. Wanted %s, got %s\n"
+#~ msgid "Generate VSS snapshots. Driver=\"%s\"\n"
+#~ msgstr "Не можливо створити теку %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "VSS CreateSnapshots failed. ERR=%s\n"
+#~ msgstr "Не можливо створити теку %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "Bad response from SD to %s command. Wanted %s, got len=%ld msg=\"%s\"\n"
 #~ msgstr "Невірна відповідь від Збирача на команду Hello: ERR=%s\n"
 
 #, fuzzy
@@ -1032,6 +1275,12 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 #~ msgstr "Відбиток"
 
 #, fuzzy
+#~ msgid ""
+#~ "An error=%d occurred while decoding encrypted session data stream: ERR="
+#~ "%s\n"
+#~ msgstr "Помилка у %s файл %s: ERR=%s\n"
+
+#, fuzzy
 #~ msgid "Cannot open resource fork for %s.\n"
 #~ msgstr "Не вдається відкрити файл %s для виведення. ERR=%s\n"
 
@@ -1040,6 +1289,18 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 #~ msgstr "Помилка у %s файл %s: ERR=%s\n"
 
 #, fuzzy
+#~ msgid "Write write error on %s: ERR=%s\n"
+#~ msgstr "Помилка у %s файл %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Director connected %sat: %s\n"
+#~ msgstr "Керівник від'єднано"
+
+#, fuzzy
+#~ msgid "WriteEncryptedFileRaw failure: ERR=%s\n"
+#~ msgstr "Помилка у %s файл %s: ERR=%s\n"
+
+#, fuzzy
 #~ msgid "llistea error on file \"%s\": ERR=%s\n"
 #~ msgstr "Помилка у %s файл %s: ERR=%s\n"
 
@@ -1079,21 +1340,45 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 #~ msgid "setproplist error on file \"%s\": ERR=%s\n"
 #~ msgstr "Помилка у %s файл %s: ERR=%s\n"
 
-#~ msgid "Unix attributes"
-#~ msgstr "Атрибули Unix"
+#~ msgid "Unable to set file owner %s: ERR=%s\n"
+#~ msgstr "Не можливо встановити власника файлу %s: ERR=%s\n"
 
-#~ msgid "File data"
-#~ msgstr "Дата файлу"
+#~ msgid "Unable to set file modes %s: ERR=%s\n"
+#~ msgstr "Не можливо встановити параметри файлу %s: ERR=%s\n"
 
-#~ msgid "MD5 digest"
-#~ msgstr "Відбиток MD5"
+#~ msgid "Unable to set file times %s: ERR=%s\n"
+#~ msgstr "Не можливо встановити час файлу %s: ERR=%s\n"
 
-#~ msgid "GZIP data"
-#~ msgstr "Дані, запаковані GZIP"
+#~ msgid ""
+#~ "File size of restored file %s not correct. Original %s, restored %s.\n"
+#~ msgstr ""
+#~ "Не правильний розмір відновленого файлу %s. Оригінальний %s, відновлений "
+#~ "%s.\n"
 
-#, fuzzy
-#~ msgid "Compressed data"
-#~ msgstr "Замало даних"
+#~ msgid "Unable to set file flags %s: ERR=%s\n"
+#~ msgstr "Не можливо встановити прапорці файлу %s: ERR=%s\n"
+
+#~ msgid "Error in %s file %s: ERR=%s\n"
+#~ msgstr "Помилка у %s файл %s: ERR=%s\n"
+
+#~ msgid "Error in %s: ERR=%s\n"
+#~ msgstr "Помилка у %s: ERR=%s\n"
+
+#~ msgid "Unix attributes"
+#~ msgstr "Атрибули Unix"
+
+#~ msgid "File data"
+#~ msgstr "Дата файлу"
+
+#~ msgid "MD5 digest"
+#~ msgstr "Відбиток MD5"
+
+#~ msgid "GZIP data"
+#~ msgstr "Дані, запаковані GZIP"
+
+#, fuzzy
+#~ msgid "Compressed data"
+#~ msgstr "Замало даних"
 
 #~ msgid "Extended attributes"
 #~ msgstr "Додаткові атрибути"
@@ -1174,126 +1459,126 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 #~ msgid "Encrypted MacOS fork data"
 #~ msgstr "Зашифровані дані MacOS Fork "
 
-#~ msgid "AIX Specific ACL attribs"
+#, fuzzy
+#~ msgid "AIX ACL attribs"
 #~ msgstr "Специфічні атрибути AIX ACL"
 
-#~ msgid "Darwin Specific ACL attribs"
+#, fuzzy
+#~ msgid "Darwin ACL attribs"
 #~ msgstr "Специфічні атрибути Darwin ACL"
 
-#~ msgid "FreeBSD Specific Default ACL attribs"
+#, fuzzy
+#~ msgid "FreeBSD Default ACL attribs"
 #~ msgstr "Специфічні атрибути FreeBSD Default ACL"
 
-#~ msgid "FreeBSD Specific Access ACL attribs"
+#, fuzzy
+#~ msgid "FreeBSD Access ACL attribs"
 #~ msgstr "Специфічні атрибути FreeBSD Access ACL"
 
-#~ msgid "HPUX Specific ACL attribs"
+#, fuzzy
+#~ msgid "HPUX ACL attribs"
 #~ msgstr "Специфічні атрибути HPUX ACL"
 
-#~ msgid "Irix Specific Default ACL attribs"
+#, fuzzy
+#~ msgid "Irix Default ACL attribs"
 #~ msgstr "Специфічні атрибути Irix Default ACL"
 
-#~ msgid "Irix Specific Access ACL attribs"
+#, fuzzy
+#~ msgid "Irix Access ACL attribs"
 #~ msgstr "Специфічні атрибути Irix Access ACL"
 
-#~ msgid "Linux Specific Default ACL attribs"
+#, fuzzy
+#~ msgid "Linux Default ACL attribs"
 #~ msgstr "Специфічні атрибути Linux Default ACL"
 
-#~ msgid "Linux Specific Access ACL attribs"
+#, fuzzy
+#~ msgid "Linux Access ACL attribs"
 #~ msgstr "Специфічні атрибути Linux Access ACL"
 
 #, fuzzy
-#~ msgid "TRU64 Specific Default ACL attribs"
+#~ msgid "TRU64 Default ACL attribs"
 #~ msgstr "Специфічні атрибути Irix Default ACL"
 
 #, fuzzy
-#~ msgid "TRU64 Specific Access ACL attribs"
+#~ msgid "TRU64 Access ACL attribs"
 #~ msgstr "Специфічні атрибути Irix Access ACL"
 
 #, fuzzy
-#~ msgid "Solaris Specific POSIX ACL attribs"
+#~ msgid "Solaris POSIX ACL attribs"
 #~ msgstr "Специфічні атрибути Solaris ACL"
 
 #, fuzzy
-#~ msgid "Solaris Specific NFSv4/ZFS ACL attribs"
+#~ msgid "Solaris NFSv4/ZFS ACL attribs"
 #~ msgstr "Специфічні атрибути Solaris ACL"
 
 #, fuzzy
-#~ msgid "AFS Specific ACL attribs"
+#~ msgid "AFS ACL attribs"
 #~ msgstr "Специфічні атрибути AIX ACL"
 
 #, fuzzy
-#~ msgid "AIX Specific POSIX ACL attribs"
+#~ msgid "AIX POSIX ACL attribs"
 #~ msgstr "Специфічні атрибути AIX ACL"
 
 #, fuzzy
-#~ msgid "AIX Specific NFSv4 ACL attribs"
+#~ msgid "AIX NFSv4 ACL attribs"
 #~ msgstr "Специфічні атрибути AIX ACL"
 
 #, fuzzy
-#~ msgid "FreeBSD Specific NFSv4/ZFS ACL attribs"
+#~ msgid "FreeBSD NFSv4/ZFS ACL attribs"
 #~ msgstr "Специфічні атрибути FreeBSD Access ACL"
 
 #, fuzzy
-#~ msgid "GNU Hurd Specific Default ACL attribs"
+#~ msgid "GNU Hurd Default ACL attribs"
 #~ msgstr "Специфічні атрибути Irix Default ACL"
 
 #, fuzzy
-#~ msgid "GNU Hurd Specific Access ACL attribs"
+#~ msgid "GNU Hurd Access ACL attribs"
 #~ msgstr "Специфічні атрибути Irix Access ACL"
 
 #, fuzzy
-#~ msgid "GNU Hurd Specific Extended attribs"
+#~ msgid "GNU Hurd Extended attribs"
 #~ msgstr "Специфічні додаткові атрибути Linux"
 
 #, fuzzy
-#~ msgid "IRIX Specific Extended attribs"
+#~ msgid "IRIX Extended attribs"
 #~ msgstr "Специфічні додаткові атрибути Linux"
 
 #, fuzzy
-#~ msgid "TRU64 Specific Extended attribs"
+#~ msgid "TRU64 Extended attribs"
 #~ msgstr "Специфічні додаткові атрибути Linux"
 
 #, fuzzy
-#~ msgid "AIX Specific Extended attribs"
-#~ msgstr "Специфічні додаткові атрибути Linux"
+#~ msgid "AIX Extended attribs"
+#~ msgstr "Додаткові атрибути"
 
 #, fuzzy
-#~ msgid "OpenBSD Specific Extended attribs"
+#~ msgid "OpenBSD Extended attribs"
 #~ msgstr "Специфічні додаткові атрибути NetBSD"
 
-#~ msgid "Solaris Specific Extended attribs"
+#, fuzzy
+#~ msgid "Solaris Extensible attribs or System Extended attribs"
+#~ msgstr "Специфічні додаткові атрибути Solaris"
+
+#, fuzzy
+#~ msgid "Solaris Extended attribs"
 #~ msgstr "Специфічні додаткові атрибути Solaris"
 
-#~ msgid "Darwin Specific Extended attribs"
+#, fuzzy
+#~ msgid "Darwin Extended attribs"
 #~ msgstr "Специфічні додаткові атрибути Darwin"
 
-#~ msgid "FreeBSD Specific Extended attribs"
+#, fuzzy
+#~ msgid "FreeBSD Extended attribs"
 #~ msgstr "Специфічні додаткові атрибути FreeBS"
 
-#~ msgid "Linux Specific Extended attribs"
+#, fuzzy
+#~ msgid "Linux Extended attribs"
 #~ msgstr "Специфічні додаткові атрибути Linux"
 
-#~ msgid "NetBSD Specific Extended attribs"
+#, fuzzy
+#~ msgid "NetBSD Extended attribs"
 #~ msgstr "Специфічні додаткові атрибути NetBSD"
 
-#~ msgid "Unable to set file modes %s: ERR=%s\n"
-#~ msgstr "Не можливо встановити параметри файлу %s: ERR=%s\n"
-
-#~ msgid "Unable to set file owner %s: ERR=%s\n"
-#~ msgstr "Не можливо встановити власника файлу %s: ERR=%s\n"
-
-#~ msgid "Unable to set file times %s: ERR=%s\n"
-#~ msgstr "Не можливо встановити час файлу %s: ERR=%s\n"
-
-#~ msgid ""
-#~ "File size of restored file %s not correct. Original %s, restored %s.\n"
-#~ msgstr ""
-#~ "Не правильний розмір відновленого файлу %s. Оригінальний %s, відновлений "
-#~ "%s.\n"
-
-#~ msgid "Unable to set file flags %s: ERR=%s\n"
-#~ msgstr "Не можливо встановити прапорці файлу %s: ERR=%s\n"
-
 #~ msgid "File skipped. Not newer: %s\n"
 #~ msgstr "Файл пропущено. Не новий: %s\n"
 
@@ -1370,14 +1655,85 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 #~ msgid "Too many subdirectories. Some permissions not reset.\n"
 #~ msgstr "Забагато підтек. Деякі обмеження не перевстановлено.\n"
 
+#~ msgid "Cannot open current directory: ERR=%s\n"
+#~ msgstr "Не можливо відкрити поточну теку: ERR=%s\n"
+
+#~ msgid "Cannot get current directory: ERR=%s\n"
+#~ msgstr "Не можливо отримати поточну теку: ERR=%s\n"
+
+#~ msgid "Cannot reset current directory: ERR=%s\n"
+#~ msgstr "Не можливо перевстановити поточну теку: ERR=%s\n"
+
 #, fuzzy
-#~ msgid "gethostbyname() for host \"%s\" failed: ERR=%s\n"
-#~ msgstr "Помилка у %s файл %s: ERR=%s\n"
+#~ msgid "Could not init bsock read mutex. ERR=%s\n"
+#~ msgstr "Не вдалось відкрити%s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Could not init bsock write mutex. ERR=%s\n"
+#~ msgstr "Не вдалось відкрити%s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Director authorization error at \"%s:%d\"\n"
+#~ msgstr "Проблеми авторизації Директора \"%s:%d\"\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "Authorization error: Remote server at \"%s:%d\" did not advertise "
+#~ "required TLS support.\n"
+#~ msgstr ""
+#~ "Проблеми авторизації: Віддалений сервер \"%s:%d\" не повідомляє про "
+#~ "необхідність використання TLS.\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "Authorization error with Director at \"%s:%d\": Remote server requires "
+#~ "TLS.\n"
+#~ msgstr ""
+#~ "Проблеми авторизації Керівника \"%s:%d\": Віддалений сепвер вимагає TLS.\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "Bad errmsg to Hello command: ERR=%s\n"
+#~ "The Director at \"%s:%d\" may not be running.\n"
+#~ msgstr ""
+#~ "Погана відповідь на команду Hello: ERR=%s\n"
+#~ "Керівник \"%s:%d\" ймовірно не запущений.\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "Authorization error with Director at \"%s:%d\"\n"
+#~ "Most likely the passwords do not agree.\n"
+#~ "If you are using TLS, there may have been a certificate validation error "
+#~ "during the TLS handshake.\n"
+#~ "For help, please see: "
+#~ msgstr ""
+#~ "Проблеми авторизації із Керівником \"%s:%d\"\n"
+#~ "Швидше за все, проблема у паролях.\n"
+#~ "Якщо Ви використовуєте TLS, можливо, невдала перевірка сертифікату під "
+#~ "час TLS handshake.\n"
+#~ "Для отримання допомоги, будь ласка, перегляньте http://www.bacula.org/en/"
+#~ "rel-manual/Bacula_Freque_Asked_Questi.html#SECTION003760000000000000000.\n"
 
 #, fuzzy
 #~ msgid "safe_unlink could not compile regex pattern \"%s\" ERR=%s\n"
 #~ msgstr "Не вдалось створити %s: ERR=%s\n"
 
+#, fuzzy
+#~ msgid "Cannot open %s file. %s ERR=%s\n"
+#~ msgstr "Не вдалось відкрити%s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Could not open %s file. %s ERR=%s\n"
+#~ msgstr "Не вдалось відкрити%s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Cannot lock %s file. %s ERR=%s\n"
+#~ msgstr "Не вдалось відкрити%s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Cannot not open %s file. %s ERR=%s\n"
+#~ msgstr "Не вдалось відкрити%s: ERR=%s\n"
+
 #~ msgid "Unsupported digest type: %d\n"
 #~ msgstr "Цей тип відбитку не підтримується: %d\n"
 
@@ -1407,6 +1763,10 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 #~ msgstr "Не можливо створити чергу(fifo) %s: ERR=%s\n"
 
 #, fuzzy
+#~ msgid "Cannot open lex\n"
+#~ msgstr "Не можливо створити чергу(fifo) %s: ERR=%s\n"
+
+#, fuzzy
 #~ msgid "Could not init msg_queue mutex. ERR=%s\n"
 #~ msgstr "Не вдалось відкрити%s: ERR=%s\n"
 
@@ -1427,47 +1787,360 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 #~ msgstr "Помилка у %s файл %s: ERR=%s\n"
 
 #, fuzzy
-#~ msgid "User cancel requested.\n"
-#~ msgstr "Статус задачі: Відмінена"
+#~ msgid "Can't run command %s. ERR=%s\n"
+#~ msgstr "Не вдалось створити ноду(node) %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Can't create working directory %s. ERR=%s\n"
+#~ msgstr "Не можливо створити теку %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Can't delete working directory %s. ERR=%s\n"
+#~ msgstr "Не можливо створити теку %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unknown parameter or missing argument for %s.\n"
+#~ msgstr "Невідомий статус"
+
+#, fuzzy
+#~ msgid "Unknown parameter for %s. Expecting block or file\n"
+#~ msgstr "Невідомий статус"
+
+#, fuzzy
+#~ msgid "Unknown parameter %s.\n"
+#~ msgstr "Невідомий статус"
+
+#, fuzzy
+#~ msgid "Unable to access guest volume\n"
+#~ msgstr "Не можливо встановити параметри файлу %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to create temporary file %s. ERR=%s\n"
+#~ msgstr "Не можливо встановити власника файлу %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to fdopen file %s. ERR=%s\n"
+#~ msgstr "Не можливо встановити власника файлу %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "  Dumping database \"%s\"\n"
+#~ msgstr "Не вдалось відкрити%s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to detect the MySQL data_directory on this system.\n"
+#~ msgstr "Не можливо встановити власника файлу %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to determine the last binlog %s\n"
+#~ msgstr "Не можливо встановити час файлу %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to get the BINLOG list.\n"
+#~ msgstr "Не можливо встановити час файлу %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to determine the last LSN for %s (Previous job is %s)\n"
+#~ msgstr "Не можливо встановити час файлу %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to detect datadir from MySQL\n"
+#~ msgstr "Не можливо встановити час файлу %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to get last LSN from the backup\n"
+#~ msgstr "Не вдалось відновити прапорці для файлу %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Restoring target database \"%s\"\n"
+#~ msgstr "Не вдалось відкрити%s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Creating target database \"%s\"\n"
+#~ msgstr "Не вдалось відкрити%s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Database \"%s\" already exists. Skipping creation.\n"
+#~ msgstr "Спроба створити вже існуючий Том \"%s\". Спробуйте ще раз.\n"
+
+#, fuzzy
+#~ msgid "Unable to parse or to use plugin options, %s\n"
+#~ msgstr "Не можливо встановити власника файлу %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unknown parameter or bad argument for %s.\n"
+#~ msgstr "Невідомий статус"
+
+#, fuzzy
+#~ msgid "Can't determine the last WAL file\n"
+#~ msgstr "Не можливо встановити час файлу %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Can't determine WAL directory\n"
+#~ msgstr "Не можливо створити теку %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Can't open WAL directory %s. ERR=%s\n"
+#~ msgstr "Не можливо створити теку %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to detect the PostgreSQL data_directory on this system.\n"
+#~ msgstr "Не можливо встановити власника файлу %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to find data_directory=%s on this system. ERR=%s\n"
+#~ msgstr "Не можливо встановити власника файлу %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to start the PITR backup on this system.\n"
+#~ msgstr "Не можливо встановити власника файлу %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to determine the first WAL file on this system.\n"
+#~ msgstr "Не можливо встановити власника файлу %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to analyse tablespaces %s on this system. ERR=%s\n"
+#~ msgstr "Не можливо встановити час файлу %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Unable to analyse data_directory %s on this system. ERR=%s\n"
+#~ msgstr "Не можливо встановити час файлу %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Can't create the %s file for recovery. ERR=%s\n"
+#~ msgstr "Не можливо створити теку %s: ERR=%s\n"
 
 #, fuzzy
 #~ msgid "Read open %s device %s Volume \"%s\" failed: ERR=%s\n"
 #~ msgstr "Помилка у %s файл %s: ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Could not ready %s device %s for append.\n"
-#~ msgstr "Не можливо створити відбиток.\n"
+#~ msgid "Could not ready %s device %s for append.\n"
+#~ msgstr "Не можливо створити відбиток.\n"
+
+#, fuzzy
+#~ msgid "Error closing device %s. ERR=%s.\n"
+#~ msgstr "Помилка у %s файл %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "DDE commit failed. ERR=%s\n"
+#~ msgstr "Помилка у %s файл %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Error writing end session label. ERR=%s\n"
+#~ msgstr "Помилка надсилання Hello до Збирача. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Lock failure on autochanger. ERR=%s\n"
+#~ msgstr "Проігноровано помилку SQL. ERR=%s\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "\n"
+#~ "%sVersion: %s (%s)\n"
+#~ "\n"
+#~ "Usage: bcopy [-d debug_level] <input-archive> <output-archive>\n"
+#~ "       -b bootstrap      specify a bootstrap file\n"
+#~ "       -c <file>         specify a Storage configuration file\n"
+#~ "       -d <nn>           set debug level to <nn>\n"
+#~ "       -dt               print timestamp in debug output\n"
+#~ "       -i                specify input Volume names (separated by |)\n"
+#~ "       -o                specify output Volume names (separated by |)\n"
+#~ "       -p                proceed inspite of errors\n"
+#~ "       -v                verbose\n"
+#~ "       -w <dir>          specify working directory (default /tmp)\n"
+#~ "       -?                print this message\n"
+#~ "\n"
+#~ msgstr ""
+#~ "\n"
+#~ "Версія: %s (%s) %s %s %s\n"
+#~ "\n"
+#~ "Використання: bat [-s] [-c config_file] [-d debug_level] [config_file]\n"
+#~ "       -c <file>   set configuration file to file\n"
+#~ "       -dnn        set debug level to nn\n"
+#~ "       -s          без сигналів\n"
+#~ "       -t          перевірка - прочитати конфігурацію і вийти\n"
+#~ "       -?          print this message.\n"
+#~ "\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "\n"
+#~ "%sVersion: %s (%s)\n"
+#~ "\n"
+#~ "Usage: bextract <options> <bacula-archive-device-name> <directory-to-"
+#~ "store-files>\n"
+#~ "       -b <file>       specify a bootstrap file\n"
+#~ "       -c <file>       specify a Storage configuration file\n"
+#~ "       -d <nn>         set debug level to <nn>\n"
+#~ "       -dt             print timestamp in debug output\n"
+#~ "       -T              send debug traces to trace file\n"
+#~ "       -e <file>       exclude list\n"
+#~ "       -i <file>       include list\n"
+#~ "       -p              proceed inspite of I/O errors\n"
+#~ "       -t              read data from volume, do not write anything\n"
+#~ "       -v              verbose\n"
+#~ "       -V <volumes>    specify Volume names (separated by |)\n"
+#~ "       -?              print this message\n"
+#~ "\n"
+#~ msgstr ""
+#~ "\n"
+#~ "Версія: %s (%s) %s %s %s\n"
+#~ "\n"
+#~ "Використання: bat [-s] [-c config_file] [-d debug_level] [config_file]\n"
+#~ "       -c <file>   set configuration file to file\n"
+#~ "       -dnn        set debug level to nn\n"
+#~ "       -s          без сигналів\n"
+#~ "       -t          перевірка - прочитати конфігурацію і вийти\n"
+#~ "       -?          print this message.\n"
+#~ "\n"
+
+#, fuzzy
+#~ msgid "Found %s error%s\n"
+#~ msgstr " (%d помилок)"
+
+#, fuzzy
+#~ msgid "Job failed or canceled.\n"
+#~ msgstr "Статус задачі: Відмінена"
+
+#, fuzzy
+#~ msgid "The Volume=%s on device=%s appears to be unlabeled.\n"
+#~ msgstr "У картотеці створено новий Том \"%s\".\n"
+
+#, fuzzy
+#~ msgid "Error sending Volume info to Director.\n"
+#~ msgstr "Помилка надсилання Hello до Збирача. ERR=%s\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "\n"
+#~ "%sVersion: %s (%s)\n"
+#~ "\n"
+#~ "Usage: bls [options] <device-name>\n"
+#~ "       -b <file>       specify a bootstrap file\n"
+#~ "       -c <file>       specify a Storage configuration file\n"
+#~ "       -d <nn>         set debug level to <nn>\n"
+#~ "       -dt             print timestamp in debug output\n"
+#~ "       -e <file>       exclude list\n"
+#~ "       -i <file>       include list\n"
+#~ "       -j              list jobs\n"
+#~ "       -k              list blocks\n"
+#~ "    (no j or k option) list saved files\n"
+#~ "       -L              dump label\n"
+#~ "       -p              proceed inspite of errors\n"
+#~ "       -v              be verbose\n"
+#~ "       -V              specify Volume names (separated by |)\n"
+#~ "       -E              Check records to detect errors\n"
+#~ "       -?              print this message\n"
+#~ "\n"
+#~ msgstr ""
+#~ "\n"
+#~ "Версія: %s (%s) %s %s %s\n"
+#~ "\n"
+#~ "Використання: bat [-s] [-c config_file] [-d debug_level] [config_file]\n"
+#~ "       -c <file>   set configuration file to file\n"
+#~ "       -dnn        set debug level to nn\n"
+#~ "       -s          без сигналів\n"
+#~ "       -t          перевірка - прочитати конфігурацію і вийти\n"
+#~ "       -?          print this message.\n"
+#~ "\n"
+
+#~ msgid "Got signed digest record\n"
+#~ msgstr "Отримано підписаний відбиток запису\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "\n"
+#~ "%sVersion: %s (%s)\n"
+#~ "\n"
+#~ "Usage: bsdjson [options] [-c config_file] [config_file]\n"
+#~ "        -r <res>    get resource type <res>\n"
+#~ "        -n <name>   get resource <name>\n"
+#~ "        -l <dirs>   get only directives matching dirs (use with -r)\n"
+#~ "        -D          get only data\n"
+#~ "        -c <file>   use <file> as configuration file\n"
+#~ "        -d <nn>     set debug level to <nn>\n"
+#~ "        -dt         print timestamp in debug output\n"
+#~ "        -t          test - read config and exit\n"
+#~ "        -v          verbose user messages\n"
+#~ "        -?          print this message.\n"
+#~ "\n"
+#~ msgstr ""
+#~ "Автор Nicolas Boichat (2004)\n"
+#~ "\n"
+#~ "Версія: %s (%s) %s %s %s\n"
+#~ "\n"
+#~ "Використання: tray-monitor [-c config_file] [-d debug_level]\n"
+#~ "       -c <file>     задати конфігураційний файл <file>\n"
+#~ "       -d <nn>       встановити рівень відлагоджування у <nn>\n"
+#~ "       -dt           виводити часову мітку у даних відлагоджування\n"
+#~ "       -t            перевірка - прогитати конфігурацію і завершити\n"
+#~ "       -?            показати це повідомлення.\n"
+#~ "\n"
+
+#, fuzzy
+#~ msgid "Volume type error: ERR=%s\n"
+#~ msgstr "Не вдалось створити %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Job canceled.\n"
+#~ msgstr "Статус задачі: Відмінена"
+
+#, fuzzy
+#~ msgid "do_unfill failed.\n"
+#~ msgstr "Помилка команди"
 
 #, fuzzy
-#~ msgid "Error writing end session label. ERR=%s\n"
-#~ msgstr "Помилка надсилання Hello до Збирача. ERR=%s\n"
+#~ msgid ""
+#~ "\n"
+#~ "%sVersion: %s (%s)\n"
+#~ "\n"
+#~ "Usage: btape <options> <device_name>\n"
+#~ "       -b <file>   specify bootstrap file\n"
+#~ "       -c <file>   set configuration file to file\n"
+#~ "       -d <nn>     set debug level to <nn>\n"
+#~ "       -dt         print timestamp in debug output\n"
+#~ "       -p          proceed inspite of I/O errors\n"
+#~ "       -s          turn off signals\n"
+#~ "       -v          be verbose\n"
+#~ "       -?          print this message.\n"
+#~ "\n"
+#~ msgstr ""
+#~ "Автор Nicolas Boichat (2004)\n"
+#~ "\n"
+#~ "Версія: %s (%s) %s %s %s\n"
+#~ "\n"
+#~ "Використання: tray-monitor [-c config_file] [-d debug_level]\n"
+#~ "       -c <file>     задати конфігураційний файл <file>\n"
+#~ "       -d <nn>       встановити рівень відлагоджування у <nn>\n"
+#~ "       -dt           виводити часову мітку у даних відлагоджування\n"
+#~ "       -t            перевірка - прогитати конфігурацію і завершити\n"
+#~ "       -?            показати це повідомлення.\n"
+#~ "\n"
 
 #, fuzzy
-#~ msgid "Lock failure on autochanger. ERR=%s\n"
-#~ msgstr "Проігноровано помилку SQL. ERR=%s\n"
+#~ msgid "Initializing DDE."
+#~ msgstr "Ініціалізація ..."
 
 #, fuzzy
-#~ msgid "Job failed or canceled.\n"
-#~ msgstr "Статус задачі: Відмінена"
+#~ msgid "Cannot create DedupDirectory: %s"
+#~ msgstr "Не можливо створити теку %s: ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Error sending Volume info to Director.\n"
-#~ msgstr "Помилка надсилання Hello до Збирача. ERR=%s\n"
-
-#~ msgid "Got signed digest record\n"
-#~ msgstr "Отримано підписаний відбиток запису\n"
+#~ msgid "Cannot create DedupIndexDirectory: %s"
+#~ msgstr "Не можливо створити теку %s: ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Volume type error: ERR=%s\n"
-#~ msgstr "Не вдалось створити %s: ERR=%s\n"
+#~ msgid "Cannot create recovery directory: %s"
+#~ msgstr "Не можливо створити теку %s: ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Job canceled.\n"
-#~ msgstr "Статус задачі: Відмінена"
+#~ msgid "Cannot delete temporary recovery directory: %s"
+#~ msgstr "Не можливо перевстановити поточну теку: ERR=%s\n"
 
 #, fuzzy
-#~ msgid "do_unfill failed.\n"
-#~ msgstr "Помилка команди"
+#~ msgid "Error sending chunk request to client\n"
+#~ msgstr "Помилка надсилання Hello до Збирача. ERR=%s\n"
 
 #, fuzzy
 #~ msgid "Unable to init spool mutex: ERR=%s\n"
@@ -1482,6 +2155,10 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 #~ msgstr "Не можливо встановити власника файлу %s: ERR=%s\n"
 
 #, fuzzy
+#~ msgid "Unable to init adata mutex: ERR=%s\n"
+#~ msgstr "Не можливо встановити власника файлу %s: ERR=%s\n"
+
+#, fuzzy
 #~ msgid "Unable to init volcat mutex: ERR=%s\n"
 #~ msgstr "Не можливо встановити власника файлу %s: ERR=%s\n"
 
@@ -1518,18 +2195,57 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 #~ msgstr "Невідомий статус задачі %c. "
 
 #, fuzzy
+#~ msgid "Cannot open session, received bad parameters.\n"
+#~ msgstr "Не вдається відкрити файл %s для виведення. ERR=%s\n"
+
+#, fuzzy
 #~ msgid "Could not open(%s,%s,0640): ERR=%s\n"
 #~ msgstr "Не вдалось відкрити%s: ERR=%s\n"
 
 #, fuzzy
+#~ msgid "Could not open aligned volume: %s, ERR=%s\n"
+#~ msgstr "Не вдалось відкрити%s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Invalid connection from %s. Len=%d\n"
+#~ msgstr "Від'єднуюсь від Клієнта %s:%d\n"
+
+#, fuzzy
+#~ msgid "Client connect failed: Job name not found: %s\n"
+#~ msgstr "Керівник не прийняв команду Hello\n"
+
+#, fuzzy
 #~ msgid "Recv request to Client failed. ERR=%s\n"
 #~ msgstr "Помилка у %s файл %s: ERR=%s\n"
 
 #, fuzzy
+#~ msgid "Send caps to Client failed. ERR=%s\n"
+#~ msgstr "Помилка у %s файл %s: ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Recv caps from Client failed. ERR=%s\n"
+#~ msgstr "Помилка у %s файл %s: ERR=%s\n"
+
+#, fuzzy
 #~ msgid "Couldn't rewind %s device %s: ERR=%s\n"
 #~ msgstr "Не вдалось створити жорстку лінку(hardlink) %s -> %s: ERR=%s\n"
 
 #, fuzzy
+#~ msgid ""
+#~ "Got Aligned or File type Volume %s on Dedup device %s. Wanted File.\n"
+#~ msgstr "У картотеці створено новий Том \"%s\".\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "Got Aligned or Dedup type Volume %s on File device %s. Wanted File.\n"
+#~ msgstr "У картотеці створено новий Том \"%s\".\n"
+
+#, fuzzy
+#~ msgid ""
+#~ "Got File or Dedup type Volume %s on Aligned device %s. Wanted Aligned.\n"
+#~ msgstr "У картотеці створено новий Том \"%s\".\n"
+
+#, fuzzy
 #~ msgid "Could not reserve volume %s on %s device %s\n"
 #~ msgstr "Не вдалось відновити прапорці для файлу %s: ERR=%s\n"
 
@@ -1547,7 +2263,7 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 
 #, fuzzy
 #~ msgid "Unable to write %s device %s: ERR=%s\n"
-#~ msgstr "Не можливо встановити час файлу %s: ERR=%s\n"
+#~ msgstr "Не можливо встановити власника файлу %s: ERR=%s\n"
 
 #, fuzzy
 #~ msgid "Open of %s device %s Volume \"%s\" failed: ERR=%s\n"
@@ -1558,6 +2274,10 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 #~ msgstr "Не можливо встановити час файлу %s: ERR=%s\n"
 
 #, fuzzy
+#~ msgid "Volume \"%s\" not loaded on %s device %s.\n"
+#~ msgstr "У картотеці створено новий Том \"%s\".\n"
+
+#, fuzzy
 #~ msgid "Labeled new Volume \"%s\" on %s device %s.\n"
 #~ msgstr "У картотеці створено новий Том \"%s\".\n"
 
@@ -1570,27 +2290,35 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 #~ msgstr "Не вдається відкрити файл %s для введення. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "3900 Unknown arg in .status command: %s\n"
-#~ msgstr "Невідомий статус задачі %c. "
+#~ msgid "Error sending header to Client. ERR=%s\n"
+#~ msgstr "Помилка надсилання Hello до Збирача. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Error sending data to Client. ERR=%s\n"
+#~ msgstr "Помилка надсилання Hello до Збирача. ERR=%s\n"
+
+#, fuzzy
+#~ msgid "Truncate on attributes file failed: ERR=%s\n"
+#~ msgstr "Помилка у %s файл %s: ERR=%s\n"
 
 #, fuzzy
 #~ msgid ""
 #~ "\n"
-#~ "Version: %s (%s)\n"
+#~ "%sVersion: %s (%s)\n"
 #~ "\n"
 #~ "Usage: bacula-sd [options] [-c config_file] [config_file]\n"
-#~ "        -c <file>   use <file> as configuration file\n"
-#~ "        -d <nn>     set debug level to <nn>\n"
-#~ "        -dt         print timestamp in debug output\n"
-#~ "        -f          run in foreground (for debugging)\n"
-#~ "        -g <group>  set groupid to group\n"
-#~ "        -m          print kaboom output (for debugging)\n"
-#~ "        -p          proceed despite I/O errors\n"
-#~ "        -s          no signals (for debugging)\n"
-#~ "        -t          test - read config and exit\n"
-#~ "        -u <user>   userid to <user>\n"
-#~ "        -v          verbose user messages\n"
-#~ "        -?          print this message.\n"
+#~ "     -c <file>         use <file> as configuration file\n"
+#~ "     -d <nn>[,<tags>]  set debug level to <nn>, debug tags to <tags>\n"
+#~ "     -dt               print timestamp in debug output\n"
+#~ "     -f                run in foreground (for debugging)\n"
+#~ "     -g <group>        set groupid to group\n"
+#~ "     -m                print kaboom output (for debugging)\n"
+#~ "     -p                proceed despite I/O errors\n"
+#~ "     -s                no signals (for debugging)\n"
+#~ "     -t                test - read config and exit\n"
+#~ "     -u <user>         userid to <user>\n"
+#~ "     -v                verbose user messages\n"
+#~ "     -?                print this message.\n"
 #~ "\n"
 #~ msgstr ""
 #~ "\n"
@@ -1605,6 +2333,10 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 #~ "\n"
 
 #, fuzzy
+#~ msgid "Unable to stat ControlDevice %s: ERR=%s\n"
+#~ msgstr "Не можливо встановити час файлу %s: ERR=%s\n"
+
+#, fuzzy
 #~ msgid "Unable to init lock: ERR=%s\n"
 #~ msgstr "Не можливо встановити власника файлу %s: ERR=%s\n"
 
@@ -1621,27 +2353,31 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 #~ msgstr "Не вдалось відкрити%s: ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Unknown ObjectType %s\n"
-#~ msgstr "Невідомий тип ресурсу %d\n"
+#~ msgid "Unable to resolve parent path for %ls\n"
+#~ msgstr "Не можливо встановити власника файлу %s: ERR=%s\n"
 
-#~ msgid "Cannot open current directory: ERR=%s\n"
-#~ msgstr "Не можливо відкрити поточну теку: ERR=%s\n"
+#, fuzzy
+#~ msgid "Unable to parse user supplied restore configuration\n"
+#~ msgstr "Не можливо встановити власника файлу %s: ERR=%s\n"
 
-#~ msgid "Cannot get current directory: ERR=%s\n"
-#~ msgstr "Не можливо отримати поточну теку: ERR=%s\n"
+#~ msgid "Bad Command Line Option"
+#~ msgstr "Не зрозумілий параметр командного рядка"
 
-#~ msgid "Cannot reset current directory: ERR=%s\n"
-#~ msgstr "Не можливо перевстановити поточну теку: ERR=%s\n"
+#, fuzzy
+#~ msgid "Unable to install the service"
+#~ msgstr "Не можливо встановити власника файлу %s: ERR=%s\n"
 
-#~ msgid "Error in %s file %s: ERR=%s\n"
-#~ msgstr "Помилка у %s файл %s: ERR=%s\n"
+#, fuzzy
+#~ msgid "Could not delete Registry key for "
+#~ msgstr "Не вдалось відновити прапорці для файлу %s: ERR=%s\n"
 
-#~ msgid "Error in %s: ERR=%s\n"
-#~ msgstr "Помилка у %s: ERR=%s\n"
+#, fuzzy
+#~ msgid "Could not lock database"
+#~ msgstr "Не вдалось відкрити%s: ERR=%s\n"
 
 #, fuzzy
-#~ msgid "CreateSGenerate VSS snapshots failed. ERR=%s\n"
-#~ msgstr "Не можливо створити теку %s: ERR=%s\n"
+#~ msgid "AIX Specific Extended attribs"
+#~ msgstr "Специфічні додаткові атрибути Linux"
 
 #~ msgid ""
 #~ "Written by Nicolas Boichat (2004)\n"
@@ -1701,12 +2437,6 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 #~ msgid "Close"
 #~ msgstr "Зачинити"
 
-#~ msgid "Disconnecting from Director %s:%d\n"
-#~ msgstr "Від'єднуюсь від Керівника %s:%d\n"
-
-#~ msgid "Disconnecting from Client %s:%d\n"
-#~ msgstr "Від'єднуюсь від Клієнта %s:%d\n"
-
 #~ msgid "Disconnecting from Storage %s:%d\n"
 #~ msgstr "Від'єднуюсь від Зберігача %s:%d\n"
 
@@ -1720,15 +2450,15 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 #~ "Поточна задача: %s\n"
 #~ "Остання задача: %s"
 
-#~ msgid " (%d errors)"
-#~ msgstr " (%d помилок)"
-
 #~ msgid " (%d error)"
 #~ msgstr " (%d помилка)"
 
 #~ msgid "No current job."
 #~ msgstr "Задачі відсутні"
 
+#~ msgid "No last job."
+#~ msgstr "Останні задачі відсутні"
+
 #~ msgid "Job status: Created"
 #~ msgstr "Статус задачі: Створена"
 
@@ -1780,9 +2510,6 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 #~ msgid "Job status: Waiting for maximum jobs"
 #~ msgstr "Статус задачі: Очікування кількості задач"
 
-#~ msgid "Job status: Waiting for start time"
-#~ msgstr "Статус задачі: Очікування часу початку"
-
 #~ msgid "Job status: Waiting for higher priority jobs to finish"
 #~ msgstr "Статус задачі: Очікування завершення пріоритетніших задач"
 
@@ -1807,114 +2534,11 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 #~ msgid "Opened connection with File daemon.\n"
 #~ msgstr "Відкриті з'єднання із Збирачем.\n"
 
-#, fuzzy
-#~ msgid "Truncate on attributes file failed: ERR=%s\n"
-#~ msgstr "Помилка у %s файл %s: ERR=%s\n"
-
 #~ msgid "Bad response to Hello command: ERR="
 #~ msgstr "Погана відповідь на команду Hello: ERR="
 
-#, fuzzy
-#~ msgid "Unable to write to %s\n"
-#~ msgstr "Не можливо встановити власника файлу %s: ERR=%s\n"
-
-#, fuzzy
-#~ msgid "Refresh"
-#~ msgstr "Оновити зараз"
-
-#, fuzzy
-#~ msgid "Filename"
-#~ msgstr "Збирач"
-
-#, fuzzy
-#~ msgid "Fileset"
-#~ msgstr "Дата файлу"
-
-#, fuzzy
-#~ msgid "Job failed."
-#~ msgstr "Статус задачі: Відмінена"
-
-#, fuzzy
-#~ msgid "Restore job is waiting on File daemon."
-#~ msgstr "Статус задачі: Очікування Збирача"
-
-#, fuzzy
-#~ msgid "Restore job is waiting for new media."
-#~ msgstr "Статус задачі: Очікування нового носія"
-
-#, fuzzy
-#~ msgid "Restore job is waiting for storage resource."
-#~ msgstr "Статус задачі: Очікування ресурсу зберігання"
-
-#, fuzzy
-#~ msgid "Restore job is waiting for job resource."
-#~ msgstr "Статус задачі: Очікування ресурсу задачі"
-
-#, fuzzy
-#~ msgid "Restore job is waiting for Client resource."
-#~ msgstr "Статус задачі: Очікування ресурсу Слієнту"
-
-#, fuzzy
-#~ msgid "Restore job is waiting for maximum jobs."
-#~ msgstr "Статус задачі: Очікування кількості задач"
-
-#, fuzzy
-#~ msgid "Restore job is waiting for higher priority jobs to finish."
-#~ msgstr "Статус задачі: Очікування завершення пріоритетніших задач"
-
-#, fuzzy
-#~ msgid "Restore cancelled."
-#~ msgstr "Статус задачі: Відмінена"
-
-#, fuzzy
-#~ msgid "Storage:"
-#~ msgstr "Зберігач"
-
-#, fuzzy
-#~ msgid ""
-#~ "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined "
-#~ "for Director \"%s\" in config file.\n"
-#~ "At least one CA certificate store is required.\n"
-#~ msgstr ""
-#~ "Жоден із параметрів \"TLS CA Certificate\" або \"TLS CA Certificate Dir\" "
-#~ "не задано для Керівника \"%s\" у %s. Необхідне щонайменше одне сховище "
-#~ "для сертифікату CA.\n"
-
-#, fuzzy
-#~ msgid ""
-#~ "No Director resource defined in config file.\n"
-#~ "Without that I don't how to speak to the Director :-(\n"
-#~ msgstr ""
-#~ "У %s не задано ресурсу Керівника\n"
-#~ "Без цього я не знаю як спілкуватись із Керівником :-(\n"
-
-#, fuzzy
-#~ msgid ""
-#~ "Neither \"TLS CA Certificate\" or \"TLS CA Certificate Dir\" are defined "
-#~ "for Console \"%s\" in config file.\n"
-#~ msgstr ""
-#~ "Жоден із параметрів \"TLS CA Certificate\" або \"TLS CA Certificate Dir\" "
-#~ "не задано для Консолі \"%s\" у %s.\n"
-
-#, fuzzy
-#~ msgid "Cryptographic library initialization failed.\n"
-#~ msgstr "Ініціалізація криптографії невдала.\n"
-
-#, fuzzy
-#~ msgid "Please correct configuration file.\n"
-#~ msgstr "Будьласка виправте файл конфігурації: %s\n"
-
-#, fuzzy
-#~ msgid "Error : Library not initialized\n"
-#~ msgstr "Ініціалізація криптографії невдала.\n"
-
-#, fuzzy
-#~ msgid "Error : No configuration file loaded\n"
-#~ msgstr "Будьласка виправте файл конфігурації: %s\n"
-
-#, fuzzy
-#~ msgid "Connecting...\n"
-#~ msgstr "З'єднано"
+#~ msgid "Welcome to bacula bwx-console %s (%s)!\n"
+#~ msgstr "Ласкаво просимо до bacula bwx-console %s (%s)!\n"
 
 #~ msgid "Passphrase for Console \"%s\" TLS private key: "
 #~ msgstr "Пароль для закритого ключа TLS Консолі \"%s\": "
@@ -1923,96 +2547,52 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 #~ msgstr "Пароль для закритого ключа TLS Керівника \"%s\": "
 
 #, fuzzy
-#~ msgid "Failed to connect to the director\n"
-#~ msgstr "Ініціалізація контексту TLS для Консолі невдала \"%s\".\n"
-
-#, fuzzy
-#~ msgid "Connected\n"
-#~ msgstr "З'єднано"
-
-#, fuzzy
-#~ msgid "Connection terminated\n"
-#~ msgstr "Приєднуюсь до Клієнта %s:%d\n"
-
-#, fuzzy
-#~ msgid "Unknown command."
-#~ msgstr "Невідомий статус"
-
-#, fuzzy
-#~ msgid "Connect"
-#~ msgstr "З'єднано"
-
-#, fuzzy
-#~ msgid "Connect to the director"
-#~ msgstr "Приєднуюсь до Керівника %s:%d"
-
-#, fuzzy
-#~ msgid "Disconnect"
-#~ msgstr "З'єднано"
-
-#, fuzzy
-#~ msgid "Disconnect of the director"
-#~ msgstr "Від'єднуюсь від Керівника %s:%d\n"
-
-#, fuzzy
-#~ msgid "Change of configuration file"
-#~ msgstr "Будьласка виправте файл конфігурації: %s\n"
-
-#, fuzzy
-#~ msgid "Change your default configuration file"
-#~ msgstr "Будьласка виправте файл конфігурації: %s\n"
-
-#, fuzzy
-#~ msgid "Edit your configuration file"
-#~ msgstr "Будьласка виправте файл конфігурації: %s\n"
-
-#, fuzzy
-#~ msgid "Unable to read configuration file"
-#~ msgstr "Будьласка виправте файл конфігурації: %s\n"
+#~ msgid "%s blocks of %lld changed during backup to %lld.\n"
+#~ msgstr "%s розмір змінився під час резервування.\n"
 
 #, fuzzy
-#~ msgid "Please choose a configuration file to use"
-#~ msgstr "Будьласка виправте файл конфігурації: %s\n"
+#~ msgid "Unable to read %s. ERR=%s\n"
+#~ msgstr "Не можливо встановити власника файлу %s: ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Using this configuration file: %s\n"
-#~ msgstr "Будьласка виправте файл конфігурації: %s\n"
+#~ msgid "Unable to get the Full job for %s\n"
+#~ msgstr "Не можливо встановити власника файлу %s: ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Connecting to the director..."
-#~ msgstr "Приєднуюсь до Керівника %s:%d"
+#~ msgid "Unable to write to %s to save full job name. ERR=%s\n"
+#~ msgstr "Не можливо встановити власника файлу %s: ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Please choose your default configuration file"
-#~ msgstr "Будьласка виправте файл конфігурації: %s\n"
+#~ msgid "Unable to save last controlfile into file %s. ERR=%s\n"
+#~ msgstr "Не можливо встановити власника файлу %s: ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Use this configuration file as default?"
-#~ msgstr "Будьласка виправте файл конфігурації: %s\n"
+#~ msgid "Unable to create  %s "
+#~ msgstr "Не можливо встановити власника файлу %s: ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Configuration file"
-#~ msgstr "Будьласка виправте файл конфігурації: %s\n"
+#~ msgid "Unable to save last SCN into file %s. ERR=%s\n"
+#~ msgstr "Не можливо встановити власника файлу %s: ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Connection lost"
-#~ msgstr "Помилка : З'єднання завершено"
+#~ msgid "Can't open /etc/oratab. ERR=%s\n"
+#~ msgstr "Не вдається відкрити файл %s для введення. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Connected to the director."
-#~ msgstr "Приєднуюсь до Керівника %s:%d"
+#~ msgid "Unable to open %s to save RMAN output. ERR=%s\n"
+#~ msgstr "Не вдається відкрити файл %s для виведення. ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Reconnect"
-#~ msgstr "З'єднано"
+#~ msgid "Error occured while dumping tempfiles ERR=%s\n"
+#~ msgstr "Помилка у %s файл %s: ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Reconnect to the director"
-#~ msgstr "Приєднуюсь до Керівника %s:%d"
+#~ msgid "Error occured while dumping logfiles ERR=%s\n"
+#~ msgstr "Помилка у %s файл %s: ERR=%s\n"
 
 #, fuzzy
-#~ msgid "Disconnected of the director."
-#~ msgstr "Від'єднуюсь від Керівника %s:%d\n"
+#~ msgid "Can't create pipe to discuss with Oracle. ERR=%s\n"
+#~ msgstr "Не можливо створити теку %s: ERR=%s\n"
 
 #~ msgid ""
 #~ "Authorization key rejected by Storage daemon.\n"
@@ -2040,6 +2620,12 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 #~ "Для отримання допомоги, будь ласка, перегляньте http://www.bacula.org/en/"
 #~ "rel-manual/Bacula_Freque_Asked_Questi.html#SECTION003760000000000000000.\n"
 
+#~ msgid "OSF1 Specific Default ACL attribs"
+#~ msgstr "Специфічні атрибути OSF1 Default ACL"
+
+#~ msgid "OSF1 Specific Access ACL attribs"
+#~ msgstr "Специфічні атрибути OSF1 Access ACL"
+
 #~ msgid ""
 #~ "Connection from unknown Director %s at %s rejected.\n"
 #~ "Please see http://www.bacula.org/en/rel-manual/Bacula_Freque_Asked_Questi."
@@ -2067,12 +2653,6 @@ msgstr "Невідомий тип ресурсу %d у save_resource.\n"
 #~ "Для отримання допомоги, будь ласка, перегляньте http://www.bacula.org/en/"
 #~ "rel-manual/Bacula_Freque_Asked_Questi.html#SECTION003760000000000000000.\n"
 
-#~ msgid "OSF1 Specific Default ACL attribs"
-#~ msgstr "Специфічні атрибути OSF1 Default ACL"
-
-#~ msgid "OSF1 Specific Access ACL attribs"
-#~ msgstr "Специфічні атрибути OSF1 Access ACL"
-
 #~ msgid "Pthread cond init error = %s\n"
 #~ msgstr "Помилка ініціалізації Pthread: %s\n"
 
diff --git a/release/README b/release/README
index f8b804f..969ae98 100644
--- a/release/README
+++ b/release/README
@@ -1,3 +1,7 @@
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 
 This directory contains the scripts that we use to create a new
 set of release files.
diff --git a/release/ReleaseProcedure.txt b/release/ReleaseProcedure.txt
index b304fb2..0aa407e 100644
--- a/release/ReleaseProcedure.txt
+++ b/release/ReleaseProcedure.txt
@@ -1,3 +1,7 @@
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 
 These are the steps to complete for making a new release.
 
diff --git a/release/check_packages b/release/check_packages
new file mode 100755
index 0000000..63c10b7
--- /dev/null
+++ b/release/check_packages
@@ -0,0 +1,25 @@
+#!/bin/sh
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+. ./config
+
+cp package-list /tmp/$$
+echo "s%@ver@%${ver}%g" >/tmp/$$
+echo "s%@lsmdate@%${lsmdate}%g" >>/tmp/$$
+sed -f /tmp/$$ package-list >/tmp/a$$
+
+echo "Checking that all packages in package-list are built"
+err=0
+for i in `cat /tmp/a$$`; do
+  if test ! -e $i ; then
+    echo "Error: package $i not found"
+    err=1
+  fi
+done
+if [ $err = 0 ] ; then
+   echo "All packages exist ..."
+fi
+
+rm -f /tmp/$$ /tmp/a$$
diff --git a/release/clean b/release/clean
index 4a547d5..deccc14 100755
--- a/release/clean
+++ b/release/clean
@@ -1,4 +1,7 @@
 #!/bin/sh
-
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # Remove old baculas
 rm -f bacula-* win*.log
diff --git a/release/config b/release/config
index 3646fe5..e6d9cbf 100644
--- a/release/config
+++ b/release/config
@@ -1,13 +1,15 @@
 #
 # Configuration for release scripts
-
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #
 # Set to the Branch you are working on
 #
-branch=${branch:-Branch-5.3}
+branch=${branch:-Branch-7.2}
 #
 # set reltype to release or beta -- for upload and setting DEVELOPER
-reltype=beta
+reltype=release
 
 repo=$reltype
 
diff --git a/release/git2changelog.pl b/release/git2changelog.pl
index 1ae1b41..f371deb 100755
--- a/release/git2changelog.pl
+++ b/release/git2changelog.pl
@@ -1,5 +1,8 @@
 #!/usr/bin/perl -w
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 =head USAGE
     
     ./git2changelog.pl Release-3.0.1..Release-3.0.2
diff --git a/release/makeall b/release/makeall
index aadd33c..4a86327 100755
--- a/release/makeall
+++ b/release/makeall
@@ -1,5 +1,8 @@
 #!/bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # Make full release
 #
 
@@ -12,4 +15,3 @@ cd $cwd
 
 ./makebacularel $bacula $remote $branch $ver
 ./makedocsrel $bacula $docs $remote $branch $ver
-
diff --git a/release/makebacularel b/release/makebacularel
index 869667a..aee0eda 100755
--- a/release/makebacularel
+++ b/release/makebacularel
@@ -1,5 +1,7 @@
 #!/bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #
 # This script is used to make a Bacula release
 #   bacula
@@ -94,7 +96,8 @@ cd ${cwd}
 tar xfz $base_pkg-$ver.tar.gz 
 # First remove Enterprise Win32 plugin source
 cd $base_pkg-$ver/bacula
-cp -fp ReleaseNotes ${cwd}/ReleaseNotes
+cp -fp ReleaseNotes ChangeLog src/version.h ${cwd}/
+cp -fp LICENSE* ${cwd}/
 
 cd ${cwd}/$base_pkg-$ver
 # Move directories to release names including version
diff --git a/release/makedocsonly b/release/makedocsonly
index f795a82..c18389c 100755
--- a/release/makedocsonly
+++ b/release/makedocsonly
@@ -1,5 +1,8 @@
 #!/bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # Make only the docs packages
 #
 
diff --git a/release/makedocsrel b/release/makedocsrel
index 8a4f97c..0b34cd7 100755
--- a/release/makedocsrel
+++ b/release/makedocsrel
@@ -1,5 +1,7 @@
 #!/bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #
 # This script is used to make a Bacula docs release
 #   docs
diff --git a/release/makemanualsrel b/release/makemanualsrel
new file mode 100755
index 0000000..2775cdc
--- /dev/null
+++ b/release/makemanualsrel
@@ -0,0 +1,64 @@
+#!/bin/sh
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+# This script is used to make a Bacula manuals release
+#   There are the html manuals and the pdf manuals.  Both
+#   are made from the docs source release.
+#
+# It writes in the current directory, so we recommend that you
+#  do not run it in the Bacula source or Git directory, but
+#  in a special release directory.
+#
+# Commit all changes, export the release, make a release tar.
+#
+# source ./config
+. ./config
+
+cwd=`pwd`
+ver=$1
+tagbase=Release-
+base_name=bacula
+# from where we get out package files
+base_pkg=${base_name}-docs
+html_name=${base_name}-html-manuals-${ver}
+pdf_name=${base_name}-pdf-manuals-${ver}
+
+if [ $# != 1 ] ; then
+  echo "Need $0 <version>"
+  echo "e.g. $0 6.4.0"
+  exit 1
+fi
+
+rm -rf $base_pkg-$ver
+echo "Detarring $base_pkg-$ver.tar.bz2"
+tar xfj $base_pkg-$ver.tar.bz2 
+cd $base_pkg-$ver/manuals/en
+mkdir -p html pdf
+for i in console developers main misc problems utility; do
+  cp -a $i/$i/ html/
+  cp $i/$i.pdf pdf/
+done
+
+# create index for bweb
+../../tools/create_index.pl main/main
+cp ../../tools/index.html .
+
+echo "Creating ${html_name}.tar.gz"
+tar cfz ${html_name}.tar.gz html css js images index.html
+echo "Creating ${pdf_name}.tar.gz"
+tar cfz ${pdf_name}.tar.gz pdf
+
+mv ${html_name}.tar.gz $cwd/
+mv ${pdf_name}.tar.gz $cwd/
+
+cd $cwd
+# Remove detared docs directory
+rm -rf $base_pkg-$ver ${html_name}.tar.gz.sig ${pdf_name}.tar.gz.sig
+./sign ${html_name}.tar.gz
+./sign ${pdf_name}.tar.gz
+echo " "
+echo "Done making html and pdf manuals"
+
+exit 0
diff --git a/release/makerescuerel b/release/makerescuerel
deleted file mode 100755
index 2f8add9..0000000
--- a/release/makerescuerel
+++ /dev/null
@@ -1,81 +0,0 @@
-#!/bin/sh
-#
-#
-# This script is used to make a Bacula rescue release
-#   rescue
-# It writes in the current directory, so we recommend that you
-#  do not run it in the Bacula source or Git directory, but
-#  in a special release directory.
-#
-# Commit all changes, export the release, make a release tar.
-#
-cwd=`pwd`
-reltype=release
-tagbase=Release-
-base_pkg=bacula-rescue
-base_dir=rescue
-branch=$2
-
-if [ $# != 2 ] ; then
-  echo "Need $0 <rescue-source-directory> <branch>"
-  echo "e.g. $0 rescue-source master"
-  exit 1
-fi
-cd $1
-if [ $? -ne 0 ]; then
-   echo "Directory: $1 does not exist"
-   exit 1
-fi
-cd $base_dir
-if [ $?  -ne 0 ]; then
-   echo "Directory: $1 does not exist"
-   exit 1
-fi
-
-src=`pwd` 
-git checkout ${branch}
-if [ $? -ne 0 ]; then
-   echo "Checkout of branch ${branch} in ${src} failed."
-   exit 1
-fi
-git pull origin ${branch}
-ver=`sed -n -e 's/^.*VERSION.*"\(.*\)"$/\1/p' version.h`
-fulltag=$tagbase$ver
-echo " "
-echo "Making $reltype for $base_pkg-$ver ..."
-echo " "
-echo "OK?  ctl-c to stop"
-read a
-
-git tag -d ${fulltag}
-echo "Creating new tag -- $fulltag"
-git tag $fulltag
-if [ $? != 0 ] ; then
-  echo " "
-  echo "Non-zero return status from Git"
-  echo " "
-  exit 1
-fi
-echo "Create Tag $fulltag done"
-cd ${cwd}
-rm -rf $base_pkg-$ver $base_pkg-$ver.tar.gz $base_pkg-$ver.tar.gz.sig
-rm -rf $fulltag
-cd ${src}
-git archive --format=tar --prefix=$base_pkg-$ver/ $fulltag | gzip >${cwd}/$base_pkg-$ver.tar.gz
-if [ $? != 0 ] ; then
-  echo " "
-  echo "Non-zero return status from Git"
-  echo " "
-  exit 1
-fi
-echo "Exported release into ${cwd}/$base_pkg-$ver.tar.gz"
-git checkout master
-cd ${cwd}
-./sign $base_pkg-$ver.tar.gz
-ls -l $base_pkg-$ver.tar.*
-
-if [ a$push != ano ]; then
-   cd ${src}
-   git push origin $branch
-   git push origin tag $fulltag
-fi
diff --git a/release/pushtags b/release/pushtags
index 7799995..07fd592 100755
--- a/release/pushtags
+++ b/release/pushtags
@@ -1,5 +1,8 @@
 #!/bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # Push tags
 #
 
diff --git a/release/sign b/release/sign
index f2bfdd9..2bdfc45 100755
--- a/release/sign
+++ b/release/sign
@@ -1,4 +1,8 @@
 #!/bin/sh
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 gpgkey=${gpgkey:-bacula}
 gpg --detach-sign --armor --default-key $gpgkey -o $1.sig $1
 gpg --verify $1.sig
diff --git a/release/upload b/release/upload
new file mode 100755
index 0000000..a5407c5
--- /dev/null
+++ b/release/upload
@@ -0,0 +1,38 @@
+#!/bin/sh
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+# Upload to File Release System on serfullver
+#
+. ./config
+
+ver="7.2.0"
+RSYNC="rsync -av --no-g --progress $upload_opt"
+
+do_upload()
+{
+where=$1
+echo "Creating ${where}:/home/src/$fullver"
+ssh ${where} <<EOF
+cd /home/src/
+mkdir -p $ver
+EOF
+
+echo "Uploading source"
+for i in bacula-$ver* bacula-*-$ver*; do \
+   echo "Uplod $i to ${where}:/home/src/$ver"
+   $RSYNC $i ${where}:/home/src/$ver/; \
+done
+
+# Upload release notes
+echo "Uplod ReleaseNotes to ${where}:/home/src/$ver"
+$RSYNC ReleaseNotes ${where}:/home/src/$ver/
+echo "Uplod ChangeLog to ${where}:/home/src/$ver"
+$RSYNC ChangeLog ${where}:/home/src/$ver/
+$RSYNC LICENSE* ${where}:/home/src/$ver/
+
+
+}
+
+do_upload bacula
diff --git a/scripts/Makefile.in b/scripts/Makefile.in
index 6d9503c..47e1d90 100755
--- a/scripts/Makefile.in
+++ b/scripts/Makefile.in
@@ -1,5 +1,8 @@
-# 
-# 
+#
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 @MCOMMON@
 
 working_dir=@working_dir@
@@ -84,6 +87,7 @@ uninstall:
 	(cd $(DESTDIR)$(scriptdir); $(RMF) btraceback.gdb)
 	(cd $(DESTDIR)$(scriptdir); $(RMF) btraceback.dbx)
 	(cd $(DESTDIR)$(scriptdir); $(RMF) btraceback.mdb)
+	(cd $(DESTDIR)$(scriptdir); $(RMF) breload)
 	(cd $(DESTDIR)$(sbindir);   $(RMF) btraceback)
 
 Makefile: Makefile.in
diff --git a/scripts/bacula-ctl-dir.in b/scripts/bacula-ctl-dir.in
index 0389584..745651c 100644
--- a/scripts/bacula-ctl-dir.in
+++ b/scripts/bacula-ctl-dir.in
@@ -1,13 +1,34 @@
 #! /bin/sh
 #
+#   Bacula(R) - The Network Backup Solution
+#
+#   Copyright (C) 2000-2015 Kern Sibbald
+#   Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
+#
+#   The original author of Bacula is Kern Sibbald, with contributions
+#   from many others, a complete list can be found in the file AUTHORS.
+#
+#   You may use this file and others of this release according to the
+#   license defined in the LICENSE file, which includes the Affero General
+#   Public License, v3.0 ("AGPLv3") and some additional permissions and
+#   terms pursuant to its AGPLv3 Section 7.
+#
+#   This notice must be preserved when any source code is 
+#   conveyed and/or propagated.
+#
+#   Bacula(R) is a registered trademark of Kern Sibbald.
+#
 # bacula-ctl-dir This shell script takes care of starting and stopping
-#		 the bacula Director daemon
+#                the bacula Director daemon
 #
 #   This is pretty much watered down version of the RedHat script
 #   that works on Solaris as well as Linux, but it won't work everywhere.
 #
 # description: The Leading Open Source Backup Solution.
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 
 PSCMD="@PSCMD@"
 PS="ps"
@@ -32,7 +53,7 @@ DIR_PORT=@dir_port@
 DIR_USER=@dir_user@
 DIR_GROUP=@dir_group@
 Bacula="@BACULA@"
-PIDOF=@PIDOF@	
+PIDOF=@PIDOF@   
 
 # A function to stop a program.
 killproc() {
@@ -61,31 +82,31 @@ killproc() {
    # Kill it.
    if [ "$pid" != "" ] ; then
       if [ "$notset" = "1" ] ; then
-	 if ${PS} -p "$pid">/dev/null 2>&1; then
-	     # TERM first, then KILL if not dead
-	     kill -TERM $pid 2>/dev/null
-	     sleep 1
-	     if ${PS} -p "$pid" >/dev/null 2>&1 ; then
-		 sleep 1
-		 if ${PS} -p "$pid" >/dev/null 2>&1 ; then
-		     sleep 3
-		     if ${PS} -p "$pid" >/dev/null 2>&1 ; then
-			 kill -KILL $pid 2>/dev/null
-		     fi
-		 fi
-	     fi
-	  fi
-	  ${PS} -p "$pid" >/dev/null 2>&1
-	  RC=$?
-	  [ $RC -eq 0 ] && failure "$base shutdown" || success "$base shutdown"
+         if ${PS} -p "$pid">/dev/null 2>&1; then
+             # TERM first, then KILL if not dead
+             kill -TERM $pid 2>/dev/null
+             sleep 1
+             if ${PS} -p "$pid" >/dev/null 2>&1 ; then
+                 sleep 1
+                 if ${PS} -p "$pid" >/dev/null 2>&1 ; then
+                     sleep 3
+                     if ${PS} -p "$pid" >/dev/null 2>&1 ; then
+                         kill -KILL $pid 2>/dev/null
+                     fi
+                 fi
+             fi
+          fi
+          ${PS} -p "$pid" >/dev/null 2>&1
+          RC=$?
+          [ $RC -eq 0 ] && failure "$base shutdown" || success "$base shutdown"
       #    RC=$((! $RC))
       # use specified level only
       else
-	 if ${PS} -p "$pid" >/dev/null 2>&1; then
-	    kill $killlevel $pid 2>/dev/null
-	    RC=$?
-	    [ $RC -eq 0 ] && success "$base $killlevel" || failure "$base $killlevel"
-	 fi
+         if ${PS} -p "$pid" >/dev/null 2>&1; then
+            kill $killlevel $pid 2>/dev/null
+            RC=$?
+            [ $RC -eq 0 ] && success "$base $killlevel" || failure "$base $killlevel"
+         fi
       fi
    else
       failure "$base shutdown"
@@ -113,8 +134,8 @@ pidofproc() {
    if [ -f ${PIDDIR}/$base.$2.pid ] ; then
       pid=`head -n 1 ${PIDDIR}/$base.$2.pid`
       if [ "$pid" != "" ] ; then
-	 echo $pid
-	 return 0
+         echo $pid
+         return 0
       fi
    fi
 
@@ -153,12 +174,12 @@ status() {
       return 0
    else
       pid=`${PSCMD} | ${AWK} 'BEGIN { prog=ARGV[1]; ARGC=1 } 
-	    { if ((prog == $2) || (("(" prog ")") == $2) ||
-		 (("[" prog "]") == $2) ||
-		 ((prog ":") == $2)) { print $1 ; exit 0 } }' $1`
+            { if ((prog == $2) || (("(" prog ")") == $2) ||
+                 (("[" prog "]") == $2) ||
+                 ((prog ":") == $2)) { print $1 ; exit 0 } }' $1`
       if [ "$pid" != "" ] ; then
-	 echo "$base (pid $pid) is running..."
-	 return 0
+         echo "$base (pid $pid) is running..."
+         return 0
       fi
    fi
 
@@ -166,8 +187,8 @@ status() {
    if [ -f ${PIDDIR}/$base.$2.pid ] ; then
       pid=`head -n 1 ${PIDDIR}/$base.$2.pid`
       if [ "$pid" != "" ] ; then
-	 echo "$base dead but pid file exists"
-	 return 1
+         echo "$base dead but pid file exists"
+         return 1
       fi
    fi
    # See if the subsys lock exists
@@ -198,29 +219,29 @@ fi
 case "$1" in
    start)
       [ -x ${BACDIRBIN}/bacula-dir ] && { 
-	  echo "Starting the $Bacula Director daemon"
-	 OPTIONS=''
-	 if [ "${DIR_USER}" != '' ]; then
-	    OPTIONS="${OPTIONS} -u ${DIR_USER}"
-	 fi
-
-	 if [ "${DIR_GROUP}" != '' ]; then
-	    OPTIONS="${OPTIONS} -g ${DIR_GROUP}"
-	 fi
-
-	 if [ "x${VALGRIND_DIR}" = "x1" ]; then
-	    valgrind --leak-check=full ${BACDIRBIN}/bacula-dir $2 $3 ${OPTIONS} -v -c ${BACDIRCFG}/bacula-dir.conf
-	 else
-	    ${BACDIRBIN}/bacula-dir $2 $3 ${OPTIONS} -v -c ${BACDIRCFG}/bacula-dir.conf
-	 fi
-	 sleep 1
+          echo "Starting the $Bacula Director daemon"
+         OPTIONS=''
+         if [ "${DIR_USER}" != '' ]; then
+            OPTIONS="${OPTIONS} -u ${DIR_USER}"
+         fi
+
+         if [ "${DIR_GROUP}" != '' ]; then
+            OPTIONS="${OPTIONS} -g ${DIR_GROUP}"
+         fi
+
+         if [ "x${VALGRIND_DIR}" = "x1" ]; then
+            valgrind --leak-check=full ${BACDIRBIN}/bacula-dir $2 $3 ${OPTIONS} -v -c ${BACDIRCFG}/bacula-dir.conf
+         else
+            ${BACDIRBIN}/bacula-dir $2 $3 ${OPTIONS} -v -c ${BACDIRCFG}/bacula-dir.conf
+         fi
+         sleep 1
       }
       ;;
 
    stop)
       [ -x ${BACDIRBIN}/bacula-dir ] && {
-	 echo "Stopping the $Bacula Director daemon"
-	 killproc ${BACDIRBIN}/bacula-dir ${DIR_PORT}
+         echo "Stopping the $Bacula Director daemon"
+         killproc ${BACDIRBIN}/bacula-dir ${DIR_PORT} $2
       }
       ;;
 
diff --git a/scripts/bacula-ctl-fd.in b/scripts/bacula-ctl-fd.in
index 3393ce6..c359eae 100644
--- a/scripts/bacula-ctl-fd.in
+++ b/scripts/bacula-ctl-fd.in
@@ -1,7 +1,25 @@
 #! /bin/sh
 #
+#   Bacula(R) - The Network Backup Solution
+#
+#   Copyright (C) 2000-2015 Kern Sibbald
+#   Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
+#
+#   The original author of Bacula is Kern Sibbald, with contributions
+#   from many others, a complete list can be found in the file AUTHORS.
+#
+#   You may use this file and others of this release according to the
+#   license defined in the LICENSE file, which includes the Affero General
+#   Public License, v3.0 ("AGPLv3") and some additional permissions and
+#   terms pursuant to its AGPLv3 Section 7.
+#
+#   This notice must be preserved when any source code is 
+#   conveyed and/or propagated.
+#
+#   Bacula(R) is a registered trademark of Kern Sibbald.
+#
 # bacula-ctl-fd This shell script takes care of starting and stopping
-#		the bacula File daemon.
+#               the bacula File daemon.
 #
 #   This is pretty much watered down version of the RedHat script
 #   that works on Solaris as well as Linux, but it won't work everywhere.
@@ -32,7 +50,7 @@ FD_PORT=@fd_port@
 FD_USER=@fd_user@
 FD_GROUP=@fd_group@
 Bacula="@BACULA@"
-PIDOF=@PIDOF@	
+PIDOF=@PIDOF@   
 
 # A function to stop a program.
 killproc() {
@@ -61,31 +79,31 @@ killproc() {
    # Kill it.
    if [ "$pid" != "" ] ; then
       if [ "$notset" = "1" ] ; then
-	 if ${PS} -p "$pid">/dev/null 2>&1; then
-	     # TERM first, then KILL if not dead
-	     kill -TERM $pid 2>/dev/null
-	     sleep 1
-	     if ${PS} -p "$pid" >/dev/null 2>&1 ; then
-		 sleep 1
-		 if ${PS} -p "$pid" >/dev/null 2>&1 ; then
-		     sleep 3
-		     if ${PS} -p "$pid" >/dev/null 2>&1 ; then
-			 kill -KILL $pid 2>/dev/null
-		     fi
-		 fi
-	     fi
-	  fi
-	  ${PS} -p "$pid" >/dev/null 2>&1
-	  RC=$?
-	  [ $RC -eq 0 ] && failure "$base shutdown" || success "$base shutdown"
+         if ${PS} -p "$pid">/dev/null 2>&1; then
+             # TERM first, then KILL if not dead
+             kill -TERM $pid 2>/dev/null
+             sleep 1
+             if ${PS} -p "$pid" >/dev/null 2>&1 ; then
+                 sleep 1
+                 if ${PS} -p "$pid" >/dev/null 2>&1 ; then
+                     sleep 3
+                     if ${PS} -p "$pid" >/dev/null 2>&1 ; then
+                         kill -KILL $pid 2>/dev/null
+                     fi
+                 fi
+             fi
+          fi
+          ${PS} -p "$pid" >/dev/null 2>&1
+          RC=$?
+          [ $RC -eq 0 ] && failure "$base shutdown" || success "$base shutdown"
       #    RC=$((! $RC))
       # use specified level only
       else
-	 if ${PS} -p "$pid" >/dev/null 2>&1; then
-	    kill $killlevel $pid 2>/dev/null
-	    RC=$?
-	    [ $RC -eq 0 ] && success "$base $killlevel" || failure "$base $killlevel"
-	 fi
+         if ${PS} -p "$pid" >/dev/null 2>&1; then
+            kill $killlevel $pid 2>/dev/null
+            RC=$?
+            [ $RC -eq 0 ] && success "$base $killlevel" || failure "$base $killlevel"
+         fi
       fi
    else
       failure "$base shutdown"
@@ -113,8 +131,8 @@ pidofproc() {
    if [ -f ${PIDDIR}/$base.$2.pid ] ; then
       pid=`head -n 1 ${PIDDIR}/$base.$2.pid`
       if [ "$pid" != "" ] ; then
-	 echo $pid
-	 return 0
+         echo $pid
+         return 0
       fi
    fi
 
@@ -153,12 +171,12 @@ status() {
       return 0
    else
       pid=`${PSCMD} | ${AWK} 'BEGIN { prog=ARGV[1]; ARGC=1 } 
-	    { if ((prog == $2) || (("(" prog ")") == $2) ||
-		 (("[" prog "]") == $2) ||
-		 ((prog ":") == $2)) { print $1 ; exit 0 } }' $1`
+            { if ((prog == $2) || (("(" prog ")") == $2) ||
+                 (("[" prog "]") == $2) ||
+                 ((prog ":") == $2)) { print $1 ; exit 0 } }' $1`
       if [ "$pid" != "" ] ; then
-	 echo "$base (pid $pid) is running..."
-	 return 0
+         echo "$base (pid $pid) is running..."
+         return 0
       fi
    fi
 
@@ -166,8 +184,8 @@ status() {
    if [ -f ${PIDDIR}/$base.$2.pid ] ; then
       pid=`head -n 1 ${PIDDIR}/$base.$2.pid`
       if [ "$pid" != "" ] ; then
-	 echo "$base dead but pid file exists"
-	 return 1
+         echo "$base dead but pid file exists"
+         return 1
       fi
    fi
    # See if the subsys lock exists
@@ -198,29 +216,29 @@ fi
 case "$1" in
    start)
       [ -x ${BACFDBIN}/bacula-fd ] && {
-	 echo "Starting the $Bacula File daemon"
-	 OPTIONS=''
-	 if [ "${FD_USER}" != '' ]; then
-	    OPTIONS="${OPTIONS} -u ${FD_USER}"
-	 fi
-
-	 if [ "${FD_GROUP}" != '' ]; then
-	    OPTIONS="${OPTIONS} -g ${FD_GROUP}"
-	 fi
-
-	 if [ "x${VALGRIND_FD}" = "x1" ]; then
-	    valgrind --leak-check=full ${BACFDBIN}/bacula-fd $2 $3 ${OPTIONS} -v -c ${BACFDCFG}/bacula-fd.conf
-	 else
-	    ${BACFDBIN}/bacula-fd $2 $3 ${OPTIONS} -v -c ${BACFDCFG}/bacula-fd.conf
-	 fi
+         echo "Starting the $Bacula File daemon"
+         OPTIONS=''
+         if [ "${FD_USER}" != '' ]; then
+            OPTIONS="${OPTIONS} -u ${FD_USER}"
+         fi
+
+         if [ "${FD_GROUP}" != '' ]; then
+            OPTIONS="${OPTIONS} -g ${FD_GROUP}"
+         fi
+
+         if [ "x${VALGRIND_FD}" = "x1" ]; then
+            valgrind --leak-check=full ${BACFDBIN}/bacula-fd $2 $3 ${OPTIONS} -v -c ${BACFDCFG}/bacula-fd.conf
+         else
+            ${BACFDBIN}/bacula-fd $2 $3 ${OPTIONS} -v -c ${BACFDCFG}/bacula-fd.conf
+         fi
       }
       ;;
 
    stop)
       # Stop the FD first so that SD will fail jobs and update catalog
       [ -x ${BACFDBIN}/bacula-fd ] && {
-	 echo "Stopping the $Bacula File daemon"
-	 killproc ${BACFDBIN}/bacula-fd ${FD_PORT}
+         echo "Stopping the $Bacula File daemon"
+         killproc ${BACFDBIN}/bacula-fd ${FD_PORT} $2
       }
       ;;
 
diff --git a/scripts/bacula-ctl-sd.in b/scripts/bacula-ctl-sd.in
index 1f85921..3f5543b 100644
--- a/scripts/bacula-ctl-sd.in
+++ b/scripts/bacula-ctl-sd.in
@@ -1,7 +1,25 @@
 #! /bin/sh
 #
+#   Bacula(R) - The Network Backup Solution
+#
+#   Copyright (C) 2000-2015 Kern Sibbald
+#   Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
+#
+#   The original author of Bacula is Kern Sibbald, with contributions
+#   from many others, a complete list can be found in the file AUTHORS.
+#
+#   You may use this file and others of this release according to the
+#   license defined in the LICENSE file, which includes the Affero General
+#   Public License, v3.0 ("AGPLv3") and some additional permissions and
+#   terms pursuant to its AGPLv3 Section 7.
+#
+#   This notice must be preserved when any source code is 
+#   conveyed and/or propagated.
+#
+#   Bacula(R) is a registered trademark of Kern Sibbald.
+#
 # bacula-ctl-sd This shell script takes care of starting and stopping
-#		the bacula Storage daemon
+#               the bacula Storage daemon
 #
 #   This is pretty much watered down version of the RedHat script
 #   that works on Solaris as well as Linux, but it won't work everywhere.
@@ -32,7 +50,7 @@ SD_PORT=@sd_port@
 SD_USER=@sd_user@
 SD_GROUP=@sd_group@
 Bacula="@BACULA@"
-PIDOF=@PIDOF@	
+PIDOF=@PIDOF@   
 
 # A function to stop a program.
 killproc() {
@@ -61,31 +79,31 @@ killproc() {
    # Kill it.
    if [ "$pid" != "" ] ; then
       if [ "$notset" = "1" ] ; then
-	 if ${PS} -p "$pid">/dev/null 2>&1; then
-	     # TERM first, then KILL if not dead
-	     kill -TERM $pid 2>/dev/null
-	     sleep 1
-	     if ${PS} -p "$pid" >/dev/null 2>&1 ; then
-		 sleep 1
-		 if ${PS} -p "$pid" >/dev/null 2>&1 ; then
-		     sleep 3
-		     if ${PS} -p "$pid" >/dev/null 2>&1 ; then
-			 kill -KILL $pid 2>/dev/null
-		     fi
-		 fi
-	     fi
-	  fi
-	  ${PS} -p "$pid" >/dev/null 2>&1
-	  RC=$?
-	  [ $RC -eq 0 ] && failure "$base shutdown" || success "$base shutdown"
+         if ${PS} -p "$pid">/dev/null 2>&1; then
+             # TERM first, then KILL if not dead
+             kill -TERM $pid 2>/dev/null
+             sleep 1
+             if ${PS} -p "$pid" >/dev/null 2>&1 ; then
+                 sleep 1
+                 if ${PS} -p "$pid" >/dev/null 2>&1 ; then
+                     sleep 3
+                     if ${PS} -p "$pid" >/dev/null 2>&1 ; then
+                         kill -KILL $pid 2>/dev/null
+                     fi
+                 fi
+             fi
+          fi
+          ${PS} -p "$pid" >/dev/null 2>&1
+          RC=$?
+          [ $RC -eq 0 ] && failure "$base shutdown" || success "$base shutdown"
       #    RC=$((! $RC))
       # use specified level only
       else
-	 if ${PS} -p "$pid" >/dev/null 2>&1; then
-	    kill $killlevel $pid 2>/dev/null
-	    RC=$?
-	    [ $RC -eq 0 ] && success "$base $killlevel" || failure "$base $killlevel"
-	 fi
+         if ${PS} -p "$pid" >/dev/null 2>&1; then
+            kill $killlevel $pid 2>/dev/null
+            RC=$?
+            [ $RC -eq 0 ] && success "$base $killlevel" || failure "$base $killlevel"
+         fi
       fi
    else
       failure "$base shutdown"
@@ -113,8 +131,8 @@ pidofproc() {
    if [ -f ${PIDDIR}/$base.$2.pid ] ; then
       pid=`head -n 1 ${PIDDIR}/$base.$2.pid`
       if [ "$pid" != "" ] ; then
-	 echo $pid
-	 return 0
+         echo $pid
+         return 0
       fi
    fi
 
@@ -153,12 +171,12 @@ status() {
       return 0
    else
       pid=`${PSCMD} | ${AWK} 'BEGIN { prog=ARGV[1]; ARGC=1 } 
-	    { if ((prog == $2) || (("(" prog ")") == $2) ||
-		 (("[" prog "]") == $2) ||
-		 ((prog ":") == $2)) { print $1 ; exit 0 } }' $1`
+            { if ((prog == $2) || (("(" prog ")") == $2) ||
+                 (("[" prog "]") == $2) ||
+                 ((prog ":") == $2)) { print $1 ; exit 0 } }' $1`
       if [ "$pid" != "" ] ; then
-	 echo "$base (pid $pid) is running..."
-	 return 0
+         echo "$base (pid $pid) is running..."
+         return 0
       fi
    fi
 
@@ -166,8 +184,8 @@ status() {
    if [ -f ${PIDDIR}/$base.$2.pid ] ; then
       pid=`head -n 1 ${PIDDIR}/$base.$2.pid`
       if [ "$pid" != "" ] ; then
-	 echo "$base dead but pid file exists"
-	 return 1
+         echo "$base dead but pid file exists"
+         return 1
       fi
    fi
    # See if the subsys lock exists
@@ -198,29 +216,29 @@ fi
 case "$1" in
    start)
       [ -x ${BACSDBIN}/bacula-sd ] && {
-	 echo "Starting the $Bacula Storage daemon"
-	 OPTIONS=''
-	 if [ "${SD_USER}" != '' ]; then
-	    OPTIONS="${OPTIONS} -u ${SD_USER}"
-	 fi
-
-	 if [ "${SD_GROUP}" != '' ]; then
-	    OPTIONS="${OPTIONS} -g ${SD_GROUP}"
-	 fi
-
-	 if [ "x${VALGRIND_SD}" = "x1" ]; then
-	    valgrind --leak-check=full ${BACSDBIN}/bacula-sd $2 $3 ${OPTIONS} -v -c ${BACSDCFG}/bacula-sd.conf
-	 else
-	    ${BACSDBIN}/bacula-sd $2 $3 ${OPTIONS} -v -c ${BACSDCFG}/bacula-sd.conf
-	 fi
+         echo "Starting the $Bacula Storage daemon"
+         OPTIONS=''
+         if [ "${SD_USER}" != '' ]; then
+            OPTIONS="${OPTIONS} -u ${SD_USER}"
+         fi
+
+         if [ "${SD_GROUP}" != '' ]; then
+            OPTIONS="${OPTIONS} -g ${SD_GROUP}"
+         fi
+
+         if [ "x${VALGRIND_SD}" = "x1" ]; then
+            valgrind --leak-check=full ${BACSDBIN}/bacula-sd $2 $3 ${OPTIONS} -v -c ${BACSDCFG}/bacula-sd.conf
+         else
+            ${BACSDBIN}/bacula-sd $2 $3 ${OPTIONS} -v -c ${BACSDCFG}/bacula-sd.conf
+         fi
       }
       ;;
 
 
    stop)
       [ -x ${BACSDBIN}/bacula-sd ] && {
-	 echo "Stopping the $Bacula Storage daemon"
-	 killproc ${BACSDBIN}/bacula-sd ${SD_PORT}
+         echo "Stopping the $Bacula Storage daemon"
+         killproc ${BACSDBIN}/bacula-sd ${SD_PORT} $2
       }
       ;;
 
diff --git a/scripts/bacula-tray-monitor.desktop.in b/scripts/bacula-tray-monitor.desktop.in
new file mode 100644
index 0000000..395f302
--- /dev/null
+++ b/scripts/bacula-tray-monitor.desktop.in
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Name=Bacula Monitor
+Comment=Notification Tray Monitor
+Icon=/usr/share/pixmaps/bacula-tray-monitor.xpm
+Exec=@sbindir@/bacula-tray-monitor -c @sysconfdir@/tray-monitor.conf
+Terminal=false
+Type=Application
+Encoding=UTF-8
+X-Desktop-File-Install-Version=0.3
+Categories=System;Application;Utility;X-Red-Hat-Base;
diff --git a/scripts/bacula.in b/scripts/bacula.in
index 02114b6..34adcfc 100755
--- a/scripts/bacula.in
+++ b/scripts/bacula.in
@@ -1,7 +1,25 @@
 #! /bin/sh
 #
+#   Bacula(R) - The Network Backup Solution
+#
+#   Copyright (C) 2000-2015 Kern Sibbald
+#   Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
+#
+#   The original author of Bacula is Kern Sibbald, with contributions
+#   from many others, a complete list can be found in the file AUTHORS.
+#
+#   You may use this file and others of this release according to the
+#   license defined in the LICENSE file, which includes the Affero General
+#   Public License, v3.0 ("AGPLv3") and some additional permissions and
+#   terms pursuant to its AGPLv3 Section 7.
+#
+#   This notice must be preserved when any source code is 
+#   conveyed and/or propagated.
+#
+#   Bacula(R) is a registered trademark of Kern Sibbald.
+#
 # bacula       This shell script takes care of starting and stopping
-#	       the bacula daemons.
+#              the bacula daemons.
 #
 #   This is pretty much watered down version of the RedHat script
 #   that works on Solaris as well as Linux, but it won't work everywhere.
diff --git a/scripts/bconsole.in b/scripts/bconsole.in
index 25ed4e9..f711fcf 100755
--- a/scripts/bconsole.in
+++ b/scripts/bconsole.in
@@ -1,4 +1,23 @@
 #!/bin/sh
+#
+#   Bacula(R) - The Network Backup Solution
+#
+#   Copyright (C) 2000-2015 Kern Sibbald
+#   Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
+#
+#   The original author of Bacula is Kern Sibbald, with contributions
+#   from many others, a complete list can be found in the file AUTHORS.
+#
+#   You may use this file and others of this release according to the
+#   license defined in the LICENSE file, which includes the Affero General
+#   Public License, v3.0 ("AGPLv3") and some additional permissions and
+#   terms pursuant to its AGPLv3 Section 7.
+#
+#   This notice must be preserved when any source code is 
+#   conveyed and/or propagated.
+#
+#   Bacula(R) is a registered trademark of Kern Sibbald.
+#
 which dirname >/dev/null 
 # does dirname exit?
 if [ $? = 0 ] ; then
diff --git a/scripts/breload b/scripts/breload
deleted file mode 100755
index 2b1e652..0000000
--- a/scripts/breload
+++ /dev/null
@@ -1,43 +0,0 @@
-#! /bin/sh
-#
-# breload This shell script takes care of reloading the director after
-#         a backup of the configuration and a bacula-dir -t test
-#
-#
-
-BACDIRBIN=/sbin
-BACDIRCFG=/etc/bacula
-BACWORKDIR=/var/bacula/working
-BACBKPDIR=$BACWORKDIR/bkp
-Bacula="Bacula"
-DIR_USER=
-RET=0
-
-if [ -x ${BACDIRBIN}/bacula-dir -a -r ${BACDIRCFG}/bacula-dir.conf ]; then
-  echo "Testing the $Bacula Director daemon configuration"
-
-  if [ $(whoami) != "$DIR_USER" ]; then
-      USER_OPT="-u $DIR_USER"
-  fi
-
-  ${BACDIRBIN}/bacula-dir -t $USER_OPT -c ${BACDIRCFG}/bacula-dir.conf
-
-  RET=$?
-  if [ $RET = 0 ]; then
-      if [ ! -d $BACBKPDIR ]; then
-         echo "Creating Backup configuration directory"
-         mkdir -p $BACBKPDIR 
-         chmod 700 $BACBKPDIR
-         chown $DIR_USER $BACBKPDIR
-      fi
-      if [ -d $BACBKPDIR ]; then
-        echo "Backup configuration"
-        tar cfz $BACBKPDIR/bacula-dir-conf.$(date +%s).tgz $BACDIRCFG/*conf
-      fi
-      echo reload | ${BACDIRBIN}/bconsole >/dev/null
-      echo "Reloading configuration"
-  else
-      echo "Can't reload configuration, please correct errors first"
-  fi
-fi 
-exit $RET
diff --git a/scripts/breload.in b/scripts/breload.in
new file mode 100644
index 0000000..958acad
--- /dev/null
+++ b/scripts/breload.in
@@ -0,0 +1,63 @@
+#! /bin/sh
+#
+#   Bacula(R) - The Network Backup Solution
+#
+#   Copyright (C) 2000-2015 Kern Sibbald
+#
+#   The original author of Bacula is Kern Sibbald, with contributions
+#   from many others, a complete list can be found in the file AUTHORS.
+#
+#   You may use this file and others of this release according to the
+#   license defined in the LICENSE file, which includes the Affero General
+#   Public License, v3.0 ("AGPLv3") and some additional permissions and
+#   terms pursuant to its AGPLv3 Section 7.
+#
+#   This notice must be preserved when any source code is 
+#   conveyed and/or propagated.
+#
+#   Bacula(R) is a registered trademark of Kern Sibbald.
+#
+# breload This shell script takes care of reloading the director after
+#	  a backup of the configuration and a bacula-dir -t test
+#
+#
+
+BACDIRBIN=@sbindir@
+BACDIRCFG=@sysconfdir@
+BACWORKDIR=@working_dir@
+BACBKPDIR=$BACWORKDIR/bkp
+Bacula="@BACULA@"
+DIR_USER=@dir_user@
+RET=0
+
+if [ -x ${BACDIRBIN}/bacula-dir -a -r ${BACDIRCFG}/bacula-dir.conf ]; then
+  echo "Testing the $Bacula Director daemon configuration"
+
+  if [ $(whoami) != "$DIR_USER" ]; then
+      USER_OPT="-u $DIR_USER"
+  fi
+
+  ${BACDIRBIN}/bacula-dir -t $USER_OPT -c ${BACDIRCFG}/bacula-dir.conf
+
+  RET=$?
+  if [ $RET = 0 ]; then
+      if [ ! -d $BACBKPDIR ]; then
+	 echo "Creating Backup configuration directory"
+	 mkdir -p $BACBKPDIR 
+	 chmod 700 $BACBKPDIR
+	 chown $DIR_USER $BACBKPDIR
+      fi
+      if [ -d $BACDIRCFG/conf.d ]; then
+	  CONFD=$BACDIRCFG/conf.d
+      fi
+      if [ -d $BACBKPDIR ]; then
+	echo "Backup configuration"
+	tar cfz $BACBKPDIR/bacula-dir-conf.$(date +%s).tgz $BACDIRCFG/*conf $CONFD
+      fi
+      echo reload | ${BACDIRBIN}/bconsole >/dev/null
+      echo "Reloading configuration"
+  else
+      echo "Can't reload configuration, please correct errors first"
+  fi
+fi 
+exit $RET
diff --git a/scripts/btraceback.dbx b/scripts/btraceback.dbx
index 8c7fe86..30c0d55 100644
--- a/scripts/btraceback.dbx
+++ b/scripts/btraceback.dbx
@@ -1,16 +1,21 @@
 # btraceback.dbx
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 
 dbxenv language_mode c++
 
+echo "fail_time ==> \c"; print -l (char *)fail_time
 echo "exename ==> \c"; print -l (char *)exename
 echo "exepath ==> \c"; print -l (char *)exepath
-echo "catalog_db ==> \c"; print -l (char *)catalog_db
+echo "assert_msg ==> \c"; print -l (char *)assert_msg
+echo "db_engine_name ==> \c"; print -l (char *)db_engine_name
 echo "version ==> \c"; print -l (char *)version
 echo "host_os ==> \c"; print -l (char *)host_os
 echo "distname ==> \c"; print -l (char *)distname
 echo "distver ==> \c"; print -l (char *)distver
 echo "dist_name ==> \c"; print -l (char *)dist_name
-echo "beef ==> \c"; print -l (int)beef
 
 echo "******** RUNNING THREADS/LWPS:"
 echo
diff --git a/scripts/btraceback.gdb b/scripts/btraceback.gdb
index 8ef1f03..aaed915 100644
--- a/scripts/btraceback.gdb
+++ b/scripts/btraceback.gdb
@@ -1,14 +1,15 @@
+print fail_time
 print my_name
 print exename
 print exepath
-print catalog_db
+print assert_msg
+print db_engine_name
 print version
 print host_os
 print distname
 print distver
 print host_name
 print dist_name
-print beef
 show env TestName
 bt
 thread apply all bt
diff --git a/scripts/btraceback.in b/scripts/btraceback.in
index 18f8d72..1b21954 100755
--- a/scripts/btraceback.in
+++ b/scripts/btraceback.in
@@ -1,5 +1,23 @@
 #!/bin/sh
-# 
+#
+#   Bacula(R) - The Network Backup Solution
+#
+#   Copyright (C) 2000-2015 Kern Sibbald
+#   Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
+#
+#   The original author of Bacula is Kern Sibbald, with contributions
+#   from many others, a complete list can be found in the file AUTHORS.
+#
+#   You may use this file and others of this release according to the
+#   license defined in the LICENSE file, which includes the Affero General
+#   Public License, v3.0 ("AGPLv3") and some additional permissions and
+#   terms pursuant to its AGPLv3 Section 7.
+#
+#   This notice must be preserved when any source code is 
+#   conveyed and/or propagated.
+#
+#   Bacula(R) is a registered trademark of Kern Sibbald.
+#
 # Script to do a stackdump of a Bacula daemon/program.
 #
 # We attempt to attach to running program
diff --git a/scripts/btraceback.mdb b/scripts/btraceback.mdb
index 1e3f9aa..c598f7e 100644
--- a/scripts/btraceback.mdb
+++ b/scripts/btraceback.mdb
@@ -1,4 +1,8 @@
 # btraceback.mdb
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 
 $G
 ::echo "******** RUNNING LWPS/THREADS:"
diff --git a/scripts/defaultconfig b/scripts/defaultconfig
index c233910..92d0e18 100755
--- a/scripts/defaultconfig
+++ b/scripts/defaultconfig
@@ -1,5 +1,8 @@
 #!/bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # This is a default configuration file for Bacula that
 # sets reasonable defaults, and assumes that you do not
 # have MySQL running.  It will "install" Bacula into 
diff --git a/scripts/devel_bacula.in b/scripts/devel_bacula.in
index 4357394..da0f675 100755
--- a/scripts/devel_bacula.in
+++ b/scripts/devel_bacula.in
@@ -1,5 +1,8 @@
 #! /bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # bacula       This shell script takes care of starting and stopping
 #	       the bacula daemons.
 #
diff --git a/scripts/disk-changer.in b/scripts/disk-changer.in
index 97b0eba..9627bad 100644
--- a/scripts/disk-changer.in
+++ b/scripts/disk-changer.in
@@ -4,21 +4,23 @@
 #
 #  Written by Kern Sibbald
 #
-#  Bacula® - The Network Backup Solution
+#   Bacula(R) - The Network Backup Solution
 #
-#  Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
+#   Copyright (C) 2000-2015 Kern Sibbald
+#   Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 #
-#  The main author of Bacula is Kern Sibbald, with contributions from many
-#  others, a complete list can be found in the file AUTHORS.
+#   The original author of Bacula is Kern Sibbald, with contributions
+#   from many others, a complete list can be found in the file AUTHORS.
 #
-#  You may use this file and others of this release according to the
-#  license defined in the LICENSE file, which includes the Affero General
-#  Public License, v3.0 ("AGPLv3") and some additional permissions and
-#  terms pursuant to its AGPLv3 Section 7.
-#
-#  Bacula® is a registered trademark of Kern Sibbald.
+#   You may use this file and others of this release according to the
+#   license defined in the LICENSE file, which includes the Affero General
+#   Public License, v3.0 ("AGPLv3") and some additional permissions and
+#   terms pursuant to its AGPLv3 Section 7.
 #
+#   This notice must be preserved when any source code is 
+#   conveyed and/or propagated.
 #
+#   Bacula(R) is a registered trademark of Kern Sibbald.
 #  If you set in your Device resource
 #
 #  Changer Command = "path-to-this-script/disk-changer %c %o %S %a %d"
@@ -29,28 +31,28 @@
 #    included.
 #
 #  disk-changer "changer-device" "command" "slot" "archive-device" "drive-index" "volume"
-#		    $1		    $2	     $3        $4		$5	   $6
+#                   $1              $2       $3        $4               $5         $6
 #
 # By default the autochanger has 10 Volumes and 1 Drive.
 #
 # Note: For this script to work, you *must" specify
-#    Device Type = File
+#    Device Type = File 
 # in each of the Devices associated with your AutoChanger resource.
 #
 # changer-device is the name of a file that overrides the default
 #   volumes and drives.  It may have:
-#	 maxslot=n   where n is one based (default 10)
-#	 maxdrive=m  where m is zero based (default 1 -- i.e. 2 drives)
-#
+#        maxslot=n   where n is one based (default 10)
+#        maxdrive=m  where m is zero based (default 1 -- i.e. 2 drives)
+#  
 #   This code can also simulate barcodes. You simply put
 #   a list of the slots and barcodes in the "base" directory/barcodes.
-#   See below for the base directory definition.  Example of a
+#   See below for the base directory definition.  Example of a 
 #   barcodes file:
 #      /var/bacula/barcodes
 #      1:Vol001
 #      2:Vol002
 #      ...
-#
+# 
 # archive-device is the name of the base directory where you want the
 #  Volumes stored appended with /drive0 for the first drive; /drive1
 #  for the second drive, ... For example, you might use
@@ -64,7 +66,7 @@
 # The Volumes will be created with names slot1, slot2, slot3, ... maxslot in the
 #  base directory. In the above example the base directory is /var/bacula.
 #  However, as with tapes, their Bacula Volume names will be stored inside the
-#  Volume label. In addition to the Volumes (e.g. /var/bacula/slot1,
+#  Volume label. In addition to the Volumes (e.g. /var/bacula/slot1, 
 #  /var/bacula/slot3, ...) this script will create a /var/bacula/loadedn
 #  file to keep track of what Slot is loaded. You should not change this file.
 #
@@ -84,7 +86,7 @@ wd=@working_dir@
 dbgfile="$wd/disk-changer.log"
 debug() {
     if test -f $dbgfile; then
-	echo "`date +\"%Y%m%d-%H:%M:%S\"` $*" >> $dbgfile
+        echo "`date +\"%Y%m%d-%H:%M:%S\"` $*" >> $dbgfile
     fi
 }
 
@@ -97,8 +99,8 @@ make_temp_file() {
   if test x${TMPFILE} = x; then
      TMPFILE="$wd/disk-changer.$$"
      if test -f ${TMPFILE}; then
-	echo "Temp file security problem on: ${TMPFILE}"
-	exit 1
+        echo "Temp file security problem on: ${TMPFILE}"
+        exit 1
      fi
   fi
 }
@@ -109,14 +111,14 @@ check_parm_count() {
     pCount=$1
     pCountNeed=$2
     if test $pCount -lt $pCountNeed; then
-	echo "usage: disk-changer ctl-device command [slot archive-device drive-index]"
-	echo "	Insufficient number of arguments arguments given."
-	if test $pCount -lt 2; then
-	    echo "  Mimimum usage is first two arguments ..."
-	else
-	    echo "  Command expected $pCountNeed arguments"
-	fi
-	exit 1
+        echo "usage: disk-changer ctl-device command [slot archive-device drive-index]"
+        echo "  Insufficient number of arguments arguments given."
+        if test $pCount -lt 2; then
+            echo "  Mimimum usage is first two arguments ..."
+        else
+            echo "  Command expected $pCountNeed arguments"
+        fi
+        exit 1
     fi
 }
 
@@ -129,7 +131,7 @@ get_dir() {
    dir=`echo "$device" | sed -e s%/$bn%%g`
    if [ ! -d $dir ]; then
       echo "ERROR: Autochanger directory \"$dir\" does not exist."
-      echo "	   You must create it."
+      echo "       You must create it."
       exit 1
    fi
 }
@@ -166,65 +168,67 @@ maxdrive=1
 maxslot=10
 
 # Pull in conf file
-if [ -f $ctl ]; then
+if [ -f $ctl ]; then 
    . $ctl
 fi
 
 
-# Check for special cases where only 2 arguments are needed,
+# Check for special cases where only 2 arguments are needed, 
 #  all others are a minimum of 5
 #
 case $2 in
     list|listall)
-	check_parm_count $# 2
-	;;
+        check_parm_count $# 2
+        ;;
     slots)
-	check_parm_count $# 2
-	;;
+        check_parm_count $# 2
+        ;;
     transfer)
-	check_parm_count $# 4
-	if [ $slot -gt $maxslot ]; then
-	   echo "Slot ($slot) out of range (1-$maxslot)"
-	   debug "Error: Slot ($slot) out of range (1-$maxslot)"
-	   exit 1
-	fi
-	;;
+        check_parm_count $# 4
+        if [ $slot -gt $maxslot ]; then
+           echo "Slot ($slot) out of range (1-$maxslot)"
+           debug "Error: Slot ($slot) out of range (1-$maxslot)"
+           exit 1
+        fi
+        ;;
     *)
-	check_parm_count $# 5
-	if [ $drive -gt $maxdrive ]; then
-	   echo "Drive ($drive) out of range (0-$maxdrive)"
-	   debug "Error: Drive ($drive) out of range (0-$maxdrive)"
-	   exit 1
-	fi
-	if [ $slot -gt $maxslot ]; then
-	   echo "Slot ($slot) out of range (1-$maxslot)"
-	   debug "Error: Slot ($slot) out of range (1-$maxslot)"
-	   exit 1
-	fi
-	;;
+        check_parm_count $# 5
+        if [ $drive -gt $maxdrive ]; then
+           echo "Drive ($drive) out of range (0-$maxdrive)"
+           debug "Error: Drive ($drive) out of range (0-$maxdrive)"
+           exit 1
+        fi
+        if [ $slot -gt $maxslot ]; then
+           echo "Slot ($slot) out of range (1-$maxslot)"
+           debug "Error: Slot ($slot) out of range (1-$maxslot)"
+           exit 1
+        fi
+        ;;
 esac
 
 
 debug "Parms: $ctl $cmd $slot $device $drive $volume $havevol"
 
-case $cmd in
+case $cmd in 
    unload)
       debug "Doing disk -f $ctl unload $slot $device $drive $volume"
       get_dir
       if [ -f $dir/loaded${drive} ]; then
-	 ld=`cat $dir/loaded${drive}`
-      else
-	 echo "Storage Element $slot is Already Full"
-	 debug "Unload error: $dir/loaded${drive} is already unloaded"
-	 exit 1
+         ld=`cat $dir/loaded${drive}`
+      else 
+         echo "Storage Element $slot is Already Full"
+         debug "Unload error: $dir/loaded${drive} is already unloaded"
+         exit 1
       fi
       if [ $slot -eq $ld ]; then
-	 echo "0" >$dir/loaded${drive}
-	 unlink $device 2>/dev/null >/dev/null
+         echo "0" >$dir/loaded${drive}
+         unlink $device 2>/dev/null >/dev/null
+         unlink ${device}.add 2>/dev/null >/dev/null
+         rm -f ${device} ${device}.add
       else
-	 echo "Storage Element $slot is Already Full"
-	 debug "Unload error: $dir/loaded${drive} slot=$ld is already unloaded"
-	 exit 1
+         echo "Storage Element $slot is Already Full"
+         debug "Unload error: $dir/loaded${drive} slot=$ld is already unloaded"
+         exit 1
       fi
       ;;
 
@@ -234,113 +238,117 @@ case $cmd in
       i=0
       # Check if slot already in a drive
       while [ $i -le $maxdrive ]; do
-	 if [ -f $dir/loaded${i} ]; then
-	    ld=`cat $dir/loaded${i}`
-	 else	
-	    ld=0
-	 fi
-	 if [ $ld -eq $slot ]; then
-	    echo "Drive ${i} Full (Storage element ${ld} loaded)"
-	    debug "Load error: Cannot load Slot=${ld} in drive=$drive. Already in drive=${i}"
-	    exit 1
-	 fi
-	 i=`expr $i + 1`
+         if [ -f $dir/loaded${i} ]; then
+            ld=`cat $dir/loaded${i}`
+         else    
+            ld=0
+         fi
+         if [ $ld -eq $slot ]; then
+            echo "Drive ${i} Full (Storage element ${ld} loaded)"
+            debug "Load error: Cannot load Slot=${ld} in drive=$drive. Already in drive=${i}"
+            exit 1
+         fi
+         i=`expr $i + 1`
       done
       # Check if we have a Volume name
       get_vol
       if [ $havevol -eq 0 ]; then
-	 # check if slot exists
-	 if [ ! -f $dir/slot${slot} ] ; then
-	    echo "source Element Address $slot is Empty"
-	    debug "Load error: source Element Address $slot is Empty"
-	    exit 1
-	 fi
+         # check if slot exists
+         if [ ! -f $dir/slot${slot} ] ; then
+            echo "source Element Address $slot is Empty"
+            debug "Load error: source Element Address $slot is Empty"
+            exit 1
+         fi
       fi
       if [ -f $dir/loaded${drive} ]; then
-	 ld=`cat $dir/loaded${drive}`
+         ld=`cat $dir/loaded${drive}`
       else
-	 ld=0
+         ld=0
       fi
       if [ $ld -ne 0 ]; then
-	 echo "Drive ${drive} Full (Storage element ${ld} loaded)"
-	 echo "Load error: Drive ${drive} Full (Storage element ${ld} loaded)"
-	 exit 1
+         echo "Drive ${drive} Full (Storage element ${ld} loaded)"
+         echo "Load error: Drive ${drive} Full (Storage element ${ld} loaded)"
+         exit 1
       fi
       echo "0" >$dir/loaded${drive}
       unlink $device 2>/dev/null >/dev/null
+      unlink ${device}.add 2>/dev/null >/dev/null
+      rm -f ${device} ${device}.add
       if [ $havevol -ne 0 ]; then
-	 ln -s $dir/$volume $device
-	 rtn=$?
+         ln -s $dir/$volume $device
+         ln -s $dir/${volume}.add ${device}.add
+         rtn=$?
       else
-	 ln -s $dir/slot${slot} $device
-	 rtn=$?
+         ln -s $dir/slot${slot} $device
+         ln -s $dir/slot${slot}.add ${device}.add
+         rtn=$?
       fi
       if [ $rtn -eq 0 ]; then
-	 echo $slot >$dir/loaded${drive}
+         echo $slot >$dir/loaded${drive}
       fi
       exit $rtn
       ;;
 
-   list)
+   list) 
       debug "Doing disk -f $ctl -- to list volumes"
-      get_dir
+      get_dir 
       if [ -f $dir/barcodes ]; then
-	 cat $dir/barcodes
+         cat $dir/barcodes
       else
-	 i=1
-	 while [ $i -le $maxslot ]; do
-	    slot=$i
-	    volume=
-	    get_vol
-	    if [ $havevol -eq 0 ]; then
-	       echo "$i:"
-	    else
-	       echo "$i:$volume"
-	    fi
-	    i=`expr $i + 1`
-	 done
+         i=1
+         while [ $i -le $maxslot ]; do
+            slot=$i
+            volume=
+            get_vol
+            if [ $havevol -eq 0 ]; then
+               echo "$i:"
+            else
+               echo "$i:$volume"
+            fi
+            i=`expr $i + 1`
+         done
       fi
       exit 0
       ;;
 
-   listall)
+   listall) 
       # ***FIXME*** must add new Volume stuff
       make_temp_file
       debug "Doing disk -f $ctl -- to list volumes"
-      get_dir
+      get_dir 
       if [ ! -f $dir/barcodes ]; then
-	  exit 0
+          exit 0
       fi
 
       # we print drive content seen by autochanger
       # and we also remove loaded media from the barcode list
       i=0
       while [ $i -le $maxdrive ]; do
-	 if [ -f $dir/loaded${i} ]; then
-	     ld=`cat $dir/loaded${i}`
-	     v=`awk -F: "/^$ld:/"' { print $2 }' $dir/barcodes`
-	     echo "D:$i:F:$ld:$v"
-	     echo "^$ld:" >> $TMPFILE
-	 fi
-	 i=`expr $i + 1`
+         if [ -f $dir/loaded${i} ]; then
+             ld=`cat $dir/loaded${i}`
+             v=`awk -F: "/^$ld:/"' { print $2 }' $dir/barcodes`
+             echo "D:$i:F:$ld:$v"
+             echo "^$ld:" >> $TMPFILE
+         fi
+         i=`expr $i + 1`
       done
 
       # Empty slots are not in barcodes file
       # When we detect a gap, we print missing rows as empty
       # At the end, we fill the gap between the last entry and maxslot
       grep -v -f $TMPFILE $dir/barcodes | sort -n | \
-      perl -ne 'BEGIN { $cur=1 }
+      perl -ne 'BEGIN { $cur=1 } 
        if (/(\d+):(.+)?/) {
-	 if ($cur == $1) {
-	   print "S:$1:F:$2\n"
-	 } else {
-	   while ($cur < $1) {
-	      print "S:$cur:E\n";
-	      $cur++;
-	   }
-	 }
-	 $cur++;
-       }
+         if ($cur == $1) { 
+           print "S:$1:F:$2\n" 
+         } else { 
+           while ($cur < $1) {
+              print "S:$cur:E\n";
+              $cur++;
+           }
+         }
+         $cur++;
+       } 
        END { while ($cur < '"$maxslot"') { print "S:$cur:E\n"; $cur++; } } '
 
       rm -f $TMPFILE
@@ -352,20 +360,21 @@ case $cmd in
       make_temp_file
       slotdest=$device
       if [ -f $dir/slot{$slotdest} ]; then
-	 echo "destination Element Address $slot is Full"
-	 exit 1
+         echo "destination Element Address $slot is Full"
+         exit 1
       fi
       if [ ! -f $dir/slot${slot} ] ; then
-	 echo "source Element Address $slot is Empty"
-	 exit 1
+         echo "source Element Address $slot is Empty"
+         exit 1
       fi
 
       echo "Transfering $slot to $slotdest"
       mv $dir/slot${slot} $dir/slot{$slotdest}
+      mv $dir/slot${slot}.add $dir/slot{$slotdest}.add
 
       if [ -f $dir/barcodes ]; then
-	 sed "s/^$slot:/$slotdest:/" >	$TMPFILE
-	 sort -n $TMPFILE > $dir/barcodes
+         sed "s/^$slot:/$slotdest:/" >  $TMPFILE
+         sort -n $TMPFILE > $dir/barcodes
       fi
       exit 0
       ;;
@@ -373,9 +382,9 @@ case $cmd in
       debug "Doing disk -f $ctl $drive -- to find what is loaded"
       get_dir
       if [ -f $dir/loaded${drive} ]; then
-	 a=`cat $dir/loaded${drive}`
+         a=`cat $dir/loaded${drive}`
       else
-	 a="0"
+         a="0"
       fi
       debug "Loaded: drive=$drive is $a"
       echo $a
diff --git a/scripts/dvd-handler.in b/scripts/dvd-handler.in
index a02878e..e8492ae 100644
--- a/scripts/dvd-handler.in
+++ b/scripts/dvd-handler.in
@@ -1,5 +1,23 @@
 #!@PYTHON@
 #
+#   Bacula(R) - The Network Backup Solution
+#
+#   Copyright (C) 2000-2015 Kern Sibbald
+#   Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
+#
+#   The original author of Bacula is Kern Sibbald, with contributions
+#   from many others, a complete list can be found in the file AUTHORS.
+#
+#   You may use this file and others of this release according to the
+#   license defined in the LICENSE file, which includes the Affero General
+#   Public License, v3.0 ("AGPLv3") and some additional permissions and
+#   terms pursuant to its AGPLv3 Section 7.
+#
+#   This notice must be preserved when any source code is 
+#   conveyed and/or propagated.
+#
+#   Bacula(R) is a registered trademark of Kern Sibbald.
+#
 # Check the free space available on a writable DVD
 # Should always exit with 0 status, otherwise it indicates a serious error.
 # (wrong number of arguments, Python exception...)
@@ -9,30 +27,30 @@
 #  operations used by Bacula:
 #
 #   free  (no arguments)
-#	      Scan the device and report the available space. It returns:
-#	      Prints on the first output line the free space available in bytes.
-#	      If an error occurs, prints a negative number (-errno), followed,
-#	      on the second line, by an error message.
+#             Scan the device and report the available space. It returns:
+#             Prints on the first output line the free space available in bytes.
+#             If an error occurs, prints a negative number (-errno), followed,
+#             on the second line, by an error message.
 #
 #   write  op filename
-#	       Write a part file to disk.
-#	       This operation needs two additional arguments.
-#	       The first (op) indicates to
-#		   0 -- append
-#		   1 -- first write to a blank disk
-#		   2 -- blank or truncate a disk
+#              Write a part file to disk.
+#              This operation needs two additional arguments.
+#              The first (op) indicates to
+#                  0 -- append
+#                  1 -- first write to a blank disk
+#                  2 -- blank or truncate a disk
 #
-#		The second is the filename to write
+#               The second is the filename to write
 #
 #   operations available but not used by Bacula:
 #
 #   test      Scan the device and report the information found.
-#	       This operation needs no further arguments.
+#              This operation needs no further arguments.
 #   prepare   Prepare a DVD+/-RW for being used by Bacula.
-#	       Note: This is only useful if you already have some
-#	       non-Bacula data on a medium, and you want to use
-#	       it with Bacula. Don't run this on blank media, it
-#	       is useless.
+#              Note: This is only useful if you already have some
+#              non-Bacula data on a medium, and you want to use
+#              it with Bacula. Don't run this on blank media, it
+#              is useless.
 #
 # 
 # $Id$
@@ -72,23 +90,23 @@ class disk:
 # dvd-writepart doesn't not always need to know the free space).
 #
 # The following methods are implemented:
-# __init__	 we need that...
-# __repr__	 this seems to be a good idea to have.
-#		 Quite minimalistic implementation, though.
-# __str__	 For casts to string. Return the current disk information
-# is_empty	 Returns TRUE if the disk is empty, blank... this needs more
-#		 work, especially concerning non-RW media and blank vs. no
-#		 filesystem considerations. Here, we should also look for
-#		 other filesystems - probably we don't want to silently
-#		 overwrite UDF or ext2 or anything not mentioned in fstab...
-#		 (NB: I don't think it is a problem)
-# free		 Returns the available free space.
-# write 	 Writes one part file to disk, either starting a new file
-#		 system on disk, or appending to it.
-#		 This method should also prepare a blank disk so that a
-#		 certain part of the disk is used to allow detection of a
-#		 used disk by all / more disk drives.
-# prepare 	 Blank the device
+# __init__       we need that...
+# __repr__       this seems to be a good idea to have.
+#                Quite minimalistic implementation, though.
+# __str__        For casts to string. Return the current disk information
+# is_empty       Returns TRUE if the disk is empty, blank... this needs more
+#                work, especially concerning non-RW media and blank vs. no
+#                filesystem considerations. Here, we should also look for
+#                other filesystems - probably we don't want to silently
+#                overwrite UDF or ext2 or anything not mentioned in fstab...
+#                (NB: I don't think it is a problem)
+# free           Returns the available free space.
+# write          Writes one part file to disk, either starting a new file
+#                system on disk, or appending to it.
+#                This method should also prepare a blank disk so that a
+#                certain part of the disk is used to allow detection of a
+#                used disk by all / more disk drives.
+# prepare        Blank the device
 #
 ###############################################################################
    def __init__(self, devicename):
@@ -107,10 +125,10 @@ class disk:
       self.growcmd += " -quiet"
 
       if self.is4gbsupported():
-	 self.growcmd += " -use-the-force-luke=4gms"
+         self.growcmd += " -use-the-force-luke=4gms"
 
       self.growparams = " -A 'Bacula Data' -input-charset=default -iso-level 3 -pad " + \
-			"-p 'dvd-handler / growisofs' -sysid 'BACULADATA' -R"
+                        "-p 'dvd-handler / growisofs' -sysid 'BACULADATA' -R"
 
       return
 
@@ -119,9 +137,9 @@ class disk:
 
    def __str__(self):
       if not self.freespace_collected:
-	 self.collect_freespace();
+         self.collect_freespace();
       if not self.mediumtype_collected:
-	 self.collect_mediumtype();
+         self.collect_mediumtype();
       
       self.me  = "Class disk, initialized with device '" + self.device + "'\n"
       self.me += "type = '" + self.disktype + "' mode='" + self.diskmode + "' status = '" + self.diskstatus + "'\n"
@@ -135,47 +153,47 @@ class disk:
       processi = popen2.Popen4("uname -s -r")
       status = processi.wait()
       if not os.WIFEXITED(status):
-	 return 1
+         return 1
       if os.WEXITSTATUS(status) != 0:
-	 return 1
+         return 1
       strres = processi.fromchild.readline()[0:-1]
       version = re.search(r"Linux (\d+)\.(\d+)\.(\d+)", strres)
       if not version: # Non-Linux: allow
-	 return 1
+         return 1
       
       if (int(version.group(1)) > 2) or (int(version.group(2)) > 6) or ((int(version.group(1)) == 2) and (int(version.group(2)) == 6) and (int(version.group(3)) >= 8)):
-	 return 1
+         return 1
       else:
-	 return 0
+         return 0
 
    def collect_freespace(self): # Collects current free space
       self.cmd = self.growcmd + " -F " + self.device
       processi = popen2.Popen4(self.cmd)
       status = processi.wait()
       if not os.WIFEXITED(status):
-	 raise DVDError(0, "growisofs process did not exit correctly.")
+         raise DVDError(0, "growisofs process did not exit correctly.")
       result = processi.fromchild.read()
       if os.WEXITSTATUS(status) != 0:
-	 if (os.WEXITSTATUS(status) & 0x7F) == errno.ENOSPC:
-	    # Kludge to force dvd-handler to return a free space of 0
-	    self.next_session = 1
-	    self.capacity = 1
-	    self.freespace_collected = 1
-	    return
-	 else:
-	    raise DVDError(os.WEXITSTATUS(status), "growisofs returned with an error " + result + ". Please check your are using a patched version of dvd+rw-tools.")
+         if (os.WEXITSTATUS(status) & 0x7F) == errno.ENOSPC:
+            # Kludge to force dvd-handler to return a free space of 0
+            self.next_session = 1
+            self.capacity = 1
+            self.freespace_collected = 1
+            return
+         else:
+            raise DVDError(os.WEXITSTATUS(status), "growisofs returned with an error " + result + ". Please check your are using a patched version of dvd+rw-tools.")
       next_sess = re.search(r"\snext_session=(\d+)\s", result, re.MULTILINE)
       capa = re.search(r"\scapacity=(\d+)\s", result, re.MULTILINE)
    
       if next_sess and capa:
-	 self.next_session = long(next_sess.group(1))
-	 self.capacity = long(capa.group(1))
-	 
-	 # testing cheat (emulate 4GB boundary at 100MB)
-	 #if self.next_session > 100000000:
-	 #   self.capacity = self.next_session
+         self.next_session = long(next_sess.group(1))
+         self.capacity = long(capa.group(1))
+         
+         # testing cheat (emulate 4GB boundary at 100MB)
+         #if self.next_session > 100000000:
+         #   self.capacity = self.next_session
       else:
-	 raise DVDError(0, "Cannot get next_session and capacity from growisofs.\nReturned: " + result)
+         raise DVDError(0, "Cannot get next_session and capacity from growisofs.\nReturned: " + result)
       
       self.freespace_collected = 1
       return
@@ -186,10 +204,10 @@ class disk:
       processi = popen2.Popen4(cmd)
       status = processi.wait()
       if not os.WIFEXITED(status):
-	 raise DVDError(0, self.dvdrwmediainfo + " process did not exit correctly.")
+         raise DVDError(0, self.dvdrwmediainfo + " process did not exit correctly.")
       if os.WEXITSTATUS(status) != 0:
-	 raise DVDError(0, "Cannot get media info from " + self.dvdrwmediainfo)
-	 return
+         raise DVDError(0, "Cannot get media info from " + self.dvdrwmediainfo)
+         return
       result = processi.fromchild.read()
       
       hardware = re.search(r"INQUIRY:\s+(.*)\n", result, re.MULTILINE)
@@ -198,23 +216,23 @@ class disk:
       status = re.search(r"\sDisc status:\s+(.*)\n", result, re.MULTILINE)
       
       if hardware:
-	 self.hardwaredevice = hardware.group(1)
+         self.hardwaredevice = hardware.group(1)
       
       if mediatype:
-	 self.disktype = mediatype.group(2)
+         self.disktype = mediatype.group(2)
       else:
-	 raise DVDError(0, "Media type not found in " + self.dvdrwmediainfo + " output")
+         raise DVDError(0, "Media type not found in " + self.dvdrwmediainfo + " output")
       
       if self.disktype == "DVD-RW":
-	 if mediamode:
-	    self.diskmode = mediamode.group(1)
-	 else:
-	    raise DVDError(0, "Media mode not found for DVD-RW in " + self.dvdrwmediainfo + " output")
+         if mediamode:
+            self.diskmode = mediamode.group(1)
+         else:
+            raise DVDError(0, "Media mode not found for DVD-RW in " + self.dvdrwmediainfo + " output")
       
       if status:
-	 self.diskstatus = status.group(1)
+         self.diskstatus = status.group(1)
       else:
-	 raise DVDError(0, "Disc status not found in " + self.dvdrwmediainfo + " output")
+         raise DVDError(0, "Disc status not found in " + self.dvdrwmediainfo + " output")
 
       
       self.mediumtype_collected = 1
@@ -222,76 +240,76 @@ class disk:
 
    def is_empty(self):
       if not self.freespace_collected:
-	 self.collect_freespace();
+         self.collect_freespace();
       
       return 0 == self.next_session
 
    def is_RW(self):
       if not self.mediumtype_collected:
-	 self.collect_mediumtype();
+         self.collect_mediumtype();
       return "DVD-RW" == self.disktype or "DVD+RW" == self.disktype or "DVD-RAM" == self.disktype
 
    def is_plus_RW(self):
       if not self.mediumtype_collected:
-	 self.collect_mediumtype();
+         self.collect_mediumtype();
       return "DVD+RW" == self.disktype
 
    def is_minus_RW(self):
       if not self.mediumtype_collected:
-	 self.collect_mediumtype();
+         self.collect_mediumtype();
       return "DVD-RW" == self.disktype
       
    def is_restricted_overwrite(self):
       if not self.mediumtype_collected:
-	 self.collect_mediumtype();
+         self.collect_mediumtype();
       return self.diskmode == "Restricted Overwrite"
 
    def is_blank(self):
       if not self.mediumtype_collected:
-	 self.collect_mediumtype();
+         self.collect_mediumtype();
       
       return self.diskstatus == "blank"
 
    def free(self):
       if not self.freespace_collected:
-	 self.collect_freespace();
+         self.collect_freespace();
       
       fr = self.capacity-self.next_session-self.margin
       if fr < 0:
-	 return 0
+         return 0
       else:
-	 return fr
+         return fr
 
    def term_handler(self, signum, frame):
       print 'dvd-handler: Signal term_handler called with signal', signum
       if self.pid != 0:
-	 print "dvd-handler: Sending SIGTERM to pid", self.pid
-	 os.kill(self.pid, signal.SIGTERM)
-	 time.sleep(10)
-	 print "dvd-handler: Sending SIGKILL to pid", self.pid
-	 os.kill(self.pid, signal.SIGKILL)
-	 sys.exit(1)
+         print "dvd-handler: Sending SIGTERM to pid", self.pid
+         os.kill(self.pid, signal.SIGTERM)
+         time.sleep(10)
+         print "dvd-handler: Sending SIGKILL to pid", self.pid
+         os.kill(self.pid, signal.SIGKILL)
+         sys.exit(1)
 
    def write(self, newvol, partfile):
       # Blank DVD+RW when there is no data on it
       if newvol and self.is_plus_RW() and self.is_blank():
-	 print "DVD+RW looks brand-new, blank it to fix some DVD-writers bugs."
-	 self.blank()
-	 print "Done, now writing the part file."
+         print "DVD+RW looks brand-new, blank it to fix some DVD-writers bugs."
+         self.blank()
+         print "Done, now writing the part file."
       
       if newvol and self.is_minus_RW() and (not self.is_restricted_overwrite()):
-	 print "DVD-RW is in " + self.diskmode + " mode, reformating it to Restricted Overwrite"
-	 self.reformat_minus_RW()
-	 print "Done, now writing the part file."
+         print "DVD-RW is in " + self.diskmode + " mode, reformating it to Restricted Overwrite"
+         self.reformat_minus_RW()
+         print "Done, now writing the part file."
       
       cmd = self.growcmd + self.growparams
       if newvol:
-	 # Ignore any existing iso9660 filesystem - used for truncate
-	 if newvol == 2:
-	     cmd += " -use-the-force-luke=tty"
-	 cmd += " -Z "
+         # Ignore any existing iso9660 filesystem - used for truncate
+         if newvol == 2:
+             cmd += " -use-the-force-luke=tty"
+         cmd += " -Z "
       else:
-	 cmd += " -M "
+         cmd += " -M "
       cmd += self.device + " " + str(partfile)
       print "Running " + cmd
       oldsig = signal.signal(signal.SIGTERM, self.term_handler)
@@ -299,40 +317,40 @@ class disk:
       self.pid = proc.pid
       status = proc.poll()
       while status == -1:
-	 line = proc.fromchild.readline()
-	 while len(line) > 0:
-	    print line,
-	    line = proc.fromchild.readline()
-	 time.sleep(1)
-	 status = proc.poll()
+         line = proc.fromchild.readline()
+         while len(line) > 0:
+            print line,
+            line = proc.fromchild.readline()
+         time.sleep(1)
+         status = proc.poll()
       self.pid = 0
       print
       signal.signal(signal.SIGTERM, oldsig)
       if not os.WIFEXITED(status):
-	 raise DVDError(0, cmd + " process did not exit correctly, signal/status " + str(status))
+         raise DVDError(0, cmd + " process did not exit correctly, signal/status " + str(status))
       if os.WEXITSTATUS(status) != 0:
-	 raise DVDError(os.WEXITSTATUS(status), cmd + " exited with status " + str(os.WEXITSTATUS(status)) + ", signal/status " + str(status))
+         raise DVDError(os.WEXITSTATUS(status), cmd + " exited with status " + str(os.WEXITSTATUS(status)) + ", signal/status " + str(status))
 
    def prepare(self):
       if not self.is_RW():
-	 raise DVDError(0, "I won't prepare a non-rewritable medium")
+         raise DVDError(0, "I won't prepare a non-rewritable medium")
       
       # Blank DVD+RW when there is no data on it
       if self.is_plus_RW() and self.is_blank():
-	 print "DVD+RW looks brand-new, blank it to fix some DVD-writers bugs."
-	 self.blank()
-	 return # It has been completely blanked: Medium is ready to be used by Bacula
+         print "DVD+RW looks brand-new, blank it to fix some DVD-writers bugs."
+         self.blank()
+         return # It has been completely blanked: Medium is ready to be used by Bacula
       
       if self.is_minus_RW() and (not self.is_restricted_overwrite()):
-	 print "DVD-RW is in " + self.diskmode + " mode, reformating it to Restricted Overwrite"
-	 self.reformat_minus_RW()
-	 return # Reformated: Medium is ready to be used by Bacula
+         print "DVD-RW is in " + self.diskmode + " mode, reformating it to Restricted Overwrite"
+         self.reformat_minus_RW()
+         return # Reformated: Medium is ready to be used by Bacula
       
       # TODO: Check if /dev/fd/0 and /dev/zero exists, otherwise, run self.blank()
       if not os.path.exists("/dev/fd/0") or not os.path.exists("/dev/zero"):
-	 print "/dev/fd/0 or /dev/zero doesn't exist, blank the medium completely."
-	 self.blank()
-	 return
+         print "/dev/fd/0 or /dev/zero doesn't exist, blank the medium completely."
+         self.blank()
+         return
       
       cmd = self.dd + " if=/dev/zero bs=1024 count=512 | " + self.growcmd + " -Z " + self.device + "=/dev/fd/0"
       print "Running " + cmd
@@ -341,17 +359,17 @@ class disk:
       self.pid = proc.pid
       status = proc.poll() 
       while status == -1:
-	 line = proc.fromchild.readline()
-	 while len(line) > 0:
-	    print line,
-	    line = proc.fromchild.readline()
-	 time.sleep(1)
-	 status = proc.poll()
+         line = proc.fromchild.readline()
+         while len(line) > 0:
+            print line,
+            line = proc.fromchild.readline()
+         time.sleep(1)
+         status = proc.poll()
       self.pid = 0
       print
       signal.signal(signal.SIGTERM, oldsig)
       if os.WEXITSTATUS(status) != 0:
-	 raise DVDError(os.WEXITSTATUS(status), cmd + " exited with status " + str(os.WEXITSTATUS(status)) + ", signal/status " + str(status))
+         raise DVDError(os.WEXITSTATUS(status), cmd + " exited with status " + str(os.WEXITSTATUS(status)) + ", signal/status " + str(status))
 
    def blank(self):
       cmd = self.growcmd + " -Z " + self.device + "=/dev/zero"
@@ -361,17 +379,17 @@ class disk:
       self.pid = proc.pid
       status = proc.poll()
       while status == -1:
-	 line = proc.fromchild.readline()
-	 while len(line) > 0:
-	    print line,
-	    line = proc.fromchild.readline()
-	 time.sleep(1)
-	 status = proc.poll()
+         line = proc.fromchild.readline()
+         while len(line) > 0:
+            print line,
+            line = proc.fromchild.readline()
+         time.sleep(1)
+         status = proc.poll()
       self.pid = 0
       print
       signal.signal(signal.SIGTERM, oldsig)
       if os.WEXITSTATUS(status) != 0:
-	 raise DVDError(os.WEXITSTATUS(status), cmd + " exited with status " + str(os.WEXITSTATUS(status)) + ", signal/status " + str(status))
+         raise DVDError(os.WEXITSTATUS(status), cmd + " exited with status " + str(os.WEXITSTATUS(status)) + ", signal/status " + str(status))
 
    def reformat_minus_RW(self):
       cmd = self.dvdrwformat + " -force " + self.device
@@ -381,17 +399,17 @@ class disk:
       self.pid = proc.pid
       status = proc.poll()
       while status == -1:
-	 line = proc.fromchild.readline()
-	 while len(line) > 0:
-	    print line,
-	    line = proc.fromchild.readline()
-	 time.sleep(1)
-	 status = proc.poll()
+         line = proc.fromchild.readline()
+         while len(line) > 0:
+            print line,
+            line = proc.fromchild.readline()
+         time.sleep(1)
+         status = proc.poll()
       self.pid = 0
       print
       signal.signal(signal.SIGTERM, oldsig)
       if os.WEXITSTATUS(status) != 0:
-	 raise DVDError(os.WEXITSTATUS(status), cmd + " exited with status " + str(os.WEXITSTATUS(status)) + ", signal/status " + str(status))
+         raise DVDError(os.WEXITSTATUS(status), cmd + " exited with status " + str(os.WEXITSTATUS(status)) + ", signal/status " + str(status))
 
 # class disk ends here.
 
@@ -400,7 +418,7 @@ class DVDError(Exception):
       self.errno = errno
       self.value = value
       if self.value[-1] == '\n':
-	 self.value = self.value[0:-1]
+         self.value = self.value[0:-1]
    def __str__(self):
       return str(self.value) + " || errno = " + str(self.errno) + " (" + os.strerror(self.errno & 0x7F) + ")"
 
@@ -417,19 +435,19 @@ dvd-handler DEVICE prepare
 where DEVICE is a device name like /dev/sr0 or /dev/dvd.
 
 Operations:
-test	  Scan the device and report the information found.
-	   This operation needs no further arguments.
-free	  Scan the device and report the available space.
-write	  Write a part file to disk.
-	   This operation needs two additional arguments.
-	   The first indicates to append (0), restart the
-	   disk (1) or restart existing disk (2). The second
-	   is the file to write.
+test      Scan the device and report the information found.
+           This operation needs no further arguments.
+free      Scan the device and report the available space.
+write     Write a part file to disk.
+           This operation needs two additional arguments.
+           The first indicates to append (0), restart the
+           disk (1) or restart existing disk (2). The second
+           is the file to write.
 prepare   Prepare a DVD+/-RW for being used by Bacula.
-	   Note: This is only useful if you already have some
-	   non-Bacula data on a medium, and you want to use
-	   it with Bacula. Don't run this on blank media, it
-	   is useless.
+           Note: This is only useful if you already have some
+           non-Bacula data on a medium, and you want to use
+           it with Bacula. Don't run this on blank media, it
+           is useless.
 """
    sys.exit(1)
 
@@ -441,31 +459,31 @@ dvd = disk(sys.argv[1])
 if "free" == sys.argv[2]:
    if len(sys.argv) == 3:
       try:
-	 free = dvd.free()
+         free = dvd.free()
       except DVDError, e:
-	 if e.errno != 0:
-	    print -e.errno
-	 else:
-	    print errno.EPIPE
-	 print str(e)
+         if e.errno != 0:
+            print -e.errno
+         else:
+            print errno.EPIPE
+         print str(e)
       else:
-	 print free
-	 print "No Error reported."
+         print free
+         print "No Error reported."
    else:
       print "Wrong number of arguments for free operation. Wanted 3 got", len(sys.argv)
       usage()
 elif "prepare" == sys.argv[2]:
    if len(sys.argv) == 3:
       try:
-	 dvd.prepare()
+         dvd.prepare()
       except DVDError, e:
-	 print "Error while preparing medium: ", str(e)
-	 if e.errno != 0:
-	    sys.exit(e.errno & 0x7F)
-	 else:
-	    sys.exit(errno.EPIPE)
+         print "Error while preparing medium: ", str(e)
+         if e.errno != 0:
+            sys.exit(e.errno & 0x7F)
+         else:
+            sys.exit(errno.EPIPE)
       else:
-	 print "Medium prepared successfully."
+         print "Medium prepared successfully."
    else:
       print "Wrong number of arguments for prepare operation. Wanted 3 got", len(sys.argv)
       usage()
@@ -479,15 +497,15 @@ elif "test" == sys.argv[2]:
 elif "write" == sys.argv[2]:
    if len(sys.argv) == 5:
       try:
-	 dvd.write(long(sys.argv[3]), sys.argv[4])
+         dvd.write(long(sys.argv[3]), sys.argv[4])
       except DVDError, e:
-	 print "Error while writing part file: ", str(e)
-	 if e.errno != 0:
-	    sys.exit(e.errno & 0x7F)
-	 else:
-	    sys.exit(errno.EPIPE)
+         print "Error while writing part file: ", str(e)
+         if e.errno != 0:
+            sys.exit(e.errno & 0x7F)
+         else:
+            sys.exit(errno.EPIPE)
       else:
-	 print "Part file " + sys.argv[4] + " successfully written to disk."
+         print "Part file " + sys.argv[4] + " successfully written to disk."
    else:
       print "Wrong number of arguments for write operation. Wanted 5 got", len(sys.argv)
       usage()
diff --git a/scripts/dvd-simulator.in b/scripts/dvd-simulator.in
index ea0e5c8..a3033f0 100644
--- a/scripts/dvd-simulator.in
+++ b/scripts/dvd-simulator.in
@@ -1,5 +1,23 @@
 #!@PYTHON@
 #
+#   Bacula(R) - The Network Backup Solution
+#
+#   Copyright (C) 2000-2015 Kern Sibbald
+#   Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
+#
+#   The original author of Bacula is Kern Sibbald, with contributions
+#   from many others, a complete list can be found in the file AUTHORS.
+#
+#   You may use this file and others of this release according to the
+#   license defined in the LICENSE file, which includes the Affero General
+#   Public License, v3.0 ("AGPLv3") and some additional permissions and
+#   terms pursuant to its AGPLv3 Section 7.
+#
+#   This notice must be preserved when any source code is 
+#   conveyed and/or propagated.
+#
+#   Bacula(R) is a registered trademark of Kern Sibbald.
+#
 #  Modified version of dvd-handler used to simulate reading/writing
 #    to a DVD but using disk storage. This is a pretty crude implementation
 #    and a lot of the old code is still here and just sort of blunders
@@ -10,27 +28,27 @@
 #  operations used by Bacula:
 #
 #   free  (no arguments)
-#	      Scan the device and report the available space.
+#             Scan the device and report the available space.
 #
 #   write  op filename
-#	       Write a part file to disk.
-#	       This operation needs two additional arguments.
-#	       The first (op) indicates to
-#		   0 -- append
-#		   1 -- first write to a blank disk
-#		   2 -- blank or truncate a disk
+#              Write a part file to disk.
+#              This operation needs two additional arguments.
+#              The first (op) indicates to
+#                  0 -- append
+#                  1 -- first write to a blank disk
+#                  2 -- blank or truncate a disk
 #
-#		The second is the filename to write
+#               The second is the filename to write
 #
 #   operations available but not used by Bacula:
 #
 #   test      Scan the device and report the information found.
-#	       This operation needs no further arguments.
+#              This operation needs no further arguments.
 #   prepare   Prepare a DVD+/-RW for being used by Bacula.
-#	       Note: This is only useful if you already have some
-#	       non-Bacula data on a medium, and you want to use
-#	       it with Bacula. Don't run this on blank media, it
-#	       is useless.
+#              Note: This is only useful if you already have some
+#              non-Bacula data on a medium, and you want to use
+#              it with Bacula. Don't run this on blank media, it
+#              is useless.
 #
 #
 # in case of operation ``free'' returns:
@@ -38,8 +56,6 @@
 # If an error occurs, prints a negative number (-errno), followed,
 # on the second line, by an error message.
 # 
-# $Id$
-#
 
 import popen2
 import os
@@ -76,23 +92,23 @@ class disk:
 # dvd-writepart doesn't not always need to know the free space).
 #
 # The following methods are implemented:
-# __init__	 we need that...
-# __repr__	 this seems to be a good idea to have.
-#		 Quite minimalistic implementation, though.
-# __str__	 For casts to string. Return the current disk information
-# is_empty	 Returns TRUE if the disk is empty, blank... this needs more
-#		 work, especially concerning non-RW media and blank vs. no
-#		 filesystem considerations. Here, we should also look for
-#		 other filesystems - probably we don't want to silently
-#		 overwrite UDF or ext2 or anything not mentioned in fstab...
-#		 (NB: I don't think it is a problem)
-# free		 Returns the available free space.
-# write 	 Writes one part file to disk, either starting a new file
-#		 system on disk, or appending to it.
-#		 This method should also prepare a blank disk so that a
-#		 certain part of the disk is used to allow detection of a
-#		 used disk by all / more disk drives.
-# blank 	 Blank the device
+# __init__       we need that...
+# __repr__       this seems to be a good idea to have.
+#                Quite minimalistic implementation, though.
+# __str__        For casts to string. Return the current disk information
+# is_empty       Returns TRUE if the disk is empty, blank... this needs more
+#                work, especially concerning non-RW media and blank vs. no
+#                filesystem considerations. Here, we should also look for
+#                other filesystems - probably we don't want to silently
+#                overwrite UDF or ext2 or anything not mentioned in fstab...
+#                (NB: I don't think it is a problem)
+# free           Returns the available free space.
+# write          Writes one part file to disk, either starting a new file
+#                system on disk, or appending to it.
+#                This method should also prepare a blank disk so that a
+#                certain part of the disk is used to allow detection of a
+#                used disk by all / more disk drives.
+# blank          Blank the device
 #
 ###############################################################################
    def __init__(self, devicename):
@@ -112,10 +128,10 @@ class disk:
       self.growcmd += " -quiet"
 
       if self.is4gbsupported():
-	 self.growcmd += " -use-the-force-luke=4gms"
+         self.growcmd += " -use-the-force-luke=4gms"
 
       self.growparams = " -A 'Bacula Data' -input-charset=default -iso-level 3 -pad " + \
-			"-p 'dvd-handler / growisofs' -sysid 'BACULADATA' -R"
+                        "-p 'dvd-handler / growisofs' -sysid 'BACULADATA' -R"
 
       return
 
@@ -124,9 +140,9 @@ class disk:
 
    def __str__(self):
       if not self.freespace_collected:
-	 self.collect_freespace();
+         self.collect_freespace();
       if not self.mediumtype_collected:
-	 self.collect_mediumtype();
+         self.collect_mediumtype();
       
       self.me  = "Class disk, initialized with device '" + self.device + "'\n"
       self.me += "type = '" + self.disktype + "' mode='" + self.diskmode + "' status = '" + self.diskstatus + "'\n"
@@ -140,18 +156,18 @@ class disk:
       processi = popen2.Popen4("uname -s -r")
       status = processi.wait()
       if not os.WIFEXITED(status):
-	 return 1
+         return 1
       if os.WEXITSTATUS(status) != 0:
-	 return 1
+         return 1
       strres = processi.fromchild.readline()[0:-1]
       version = re.search(r"Linux (\d+)\.(\d+)\.(\d+)", strres)
       if not version: # Non-Linux: allow
-	 return 1
+         return 1
       
       if (int(version.group(1)) > 2) or (int(version.group(2)) > 6) or ((int(version.group(1)) == 2) and (int(version.group(2)) == 6) and (int(version.group(3)) >= 8)):
-	 return 1
+         return 1
       else:
-	 return 0
+         return 0
 
    def collect_freespace(self): # Collects current free space
       self.next_session = 0
@@ -159,19 +175,19 @@ class disk:
       self.freespace_collected = 1
 
       cmd = "du -sb " + self.device
-      processi = popen2.Popen4(cmd)	   
+      processi = popen2.Popen4(cmd)        
       status = processi.wait()
       if not os.WIFEXITED(status):
-	 return 1;
+         return 1;
       if os.WEXITSTATUS(status) != 0:
-	 return 1;
+         return 1;
       result = processi.fromchild.read()
       
       used = re.search(r"(\d+)\s", result, re.MULTILINE)
 
       self.capacity = self.maxcapacity - long(used.group(1))
       if self.capacity < 0:
-	 self.capacity = 0
+         self.capacity = 0
 
       return 0
    
@@ -181,10 +197,10 @@ class disk:
       processi = popen2.Popen4(cmd)
       status = processi.wait()
       if not os.WIFEXITED(status):
-	 raise DVDError(0, self.dvdrwmediainfo + " process did not exit correctly.")
+         raise DVDError(0, self.dvdrwmediainfo + " process did not exit correctly.")
       if os.WEXITSTATUS(status) != 0:
-	 raise DVDError(0, "Cannot get media info from " + self.dvdrwmediainfo)
-	 return
+         raise DVDError(0, "Cannot get media info from " + self.dvdrwmediainfo)
+         return
       result = processi.fromchild.read()
       
       hardware = re.search(r"INQUIRY:\s+(.*)\n", result, re.MULTILINE)
@@ -193,23 +209,23 @@ class disk:
       status = re.search(r"\sDisc status:\s+(.*)\n", result, re.MULTILINE)
       
       if hardware:
-	 self.hardwaredevice = hardware.group(1)
+         self.hardwaredevice = hardware.group(1)
       
       if mediatype:
-	 self.disktype = mediatype.group(2)
+         self.disktype = mediatype.group(2)
       else:
-	 raise DVDError(0, "Media type not found in " + self.dvdrwmediainfo + " output")
+         raise DVDError(0, "Media type not found in " + self.dvdrwmediainfo + " output")
       
       if self.disktype == "DVD-RW":
-	 if mediamode:
-	    self.diskmode = mediamode.group(1)
-	 else:
-	    raise DVDError(0, "Media mode not found for DVD-RW in " + self.dvdrwmediainfo + " output")
+         if mediamode:
+            self.diskmode = mediamode.group(1)
+         else:
+            raise DVDError(0, "Media mode not found for DVD-RW in " + self.dvdrwmediainfo + " output")
       
       if status:
-	 self.diskstatus = status.group(1)
+         self.diskstatus = status.group(1)
       else:
-	 raise DVDError(0, "Disc status not found in " + self.dvdrwmediainfo + " output")
+         raise DVDError(0, "Disc status not found in " + self.dvdrwmediainfo + " output")
 
       
       self.mediumtype_collected = 1
@@ -217,84 +233,84 @@ class disk:
 
    def is_empty(self):
       if not self.freespace_collected:
-	 self.collect_freespace();
+         self.collect_freespace();
       
       return 0 == self.next_session
 
    def is_RW(self):
       if not self.mediumtype_collected:
-	 self.collect_mediumtype();
+         self.collect_mediumtype();
       return "DVD-RW" == self.disktype or "DVD+RW" == self.disktype or "DVD-RAM" == self.disktype
 
    def is_plus_RW(self):
       if not self.mediumtype_collected:
-	 self.collect_mediumtype();
+         self.collect_mediumtype();
       return "DVD+RW" == self.disktype
 
    def is_minus_RW(self):
       if not self.mediumtype_collected:
-	 self.collect_mediumtype();
+         self.collect_mediumtype();
       return "DVD-RW" == self.disktype
       
    def is_restricted_overwrite(self):
       if not self.mediumtype_collected:
-	 self.collect_mediumtype();
+         self.collect_mediumtype();
       return self.diskmode == "Restricted Overwrite"
 
    def is_blank(self):
       if not self.mediumtype_collected:
-	 self.collect_mediumtype();
+         self.collect_mediumtype();
       
       return self.diskstatus == "blank"
 
    def free(self):
       if not self.freespace_collected:
-	 self.collect_freespace();
+         self.collect_freespace();
       
       fr = self.capacity-self.next_session-self.margin
       if fr < 0:
-	 return 0
+         return 0
       else:
-	 return fr
+         return fr
 
    def term_handler(self, signum, frame):
       print 'dvd-handler: Signal term_handler called with signal', signum
       if self.pid != 0:
-	 print "dvd-handler: Sending SIGTERM to pid", self.pid
-	 os.kill(self.pid, signal.SIGTERM)
-	 time.sleep(10)
-	 print "dvd-handler: Sending SIGKILL to pid", self.pid
-	 os.kill(self.pid, signal.SIGKILL)
-	 sys.exit(1)
+         print "dvd-handler: Sending SIGTERM to pid", self.pid
+         os.kill(self.pid, signal.SIGTERM)
+         time.sleep(10)
+         print "dvd-handler: Sending SIGKILL to pid", self.pid
+         os.kill(self.pid, signal.SIGKILL)
+         sys.exit(1)
 
    def write(self, newvol, partfile):
       if newvol:
-	 print "Newvol", newvol
-	 print "Zap everything ..."
-	 os.system("rm -f "+self.device+"/*")
+         print "Newvol", newvol
+         print "Zap everything ..."
+         os.system("rm -f "+self.device+"/*")
       print "cp", partfile, self.device
       shutil.copy(partfile,self.device)
 
    def prepare(self):
       if not self.is_RW():
-	 raise DVDError(0, "I won't prepare a non-rewritable medium")
+         raise DVDError(0, "I won't prepare a non-rewritable medium")
       
       # Blank DVD+RW when there is no data on it
       if self.is_plus_RW() and self.is_blank():
-	 print "DVD+RW looks brand-new, blank it to fix some DVD-writers bugs."
-	 self.blank()
-	 return # It has been completely blanked: Medium is ready to be used by Bacula
+         print "DVD+RW looks brand-new, blank it to fix some DVD-writers bugs."
+         self.blank()
+         return # It has been completely blanked: Medium is ready to be used by Bacula
       
       if self.is_minus_RW() and (not self.is_restricted_overwrite()):
-	 print "DVD-RW is in " + self.diskmode + " mode, reformating it to Restricted Overwrite"
-	 self.reformat_minus_RW()
-	 return # Reformated: Medium is ready to be used by Bacula
+         print "DVD-RW is in " + self.diskmode + " mode, reformating it to Restricted Overwrite"
+         self.reformat_minus_RW()
+         return # Reformated: Medium is ready to be used by Bacula
       
       # TODO: Check if /dev/fd/0 and /dev/zero exists, otherwise, run self.blank()
       if not os.path.exists("/dev/fd/0") or not os.path.exists("/dev/zero"):
-	 print "/dev/fd/0 or /dev/zero doesn't exist, blank the medium completely."
-	 self.blank()
-	 return
+         print "/dev/fd/0 or /dev/zero doesn't exist, blank the medium completely."
+         self.blank()
+         return
       
       cmd = self.dd + " if=/dev/zero bs=1024 count=512 | " + self.growcmd + " -Z " + self.device + "=/dev/fd/0"
       print "Running " + cmd
@@ -303,17 +319,17 @@ class disk:
       self.pid = proc.pid
       status = proc.poll() 
       while status == -1:
-	 line = proc.fromchild.readline()
-	 while len(line) > 0:
-	    print line,
-	    line = proc.fromchild.readline()
-	 time.sleep(1)
-	 status = proc.poll()
+         line = proc.fromchild.readline()
+         while len(line) > 0:
+            print line,
+            line = proc.fromchild.readline()
+         time.sleep(1)
+         status = proc.poll()
       self.pid = 0
       print
       signal.signal(signal.SIGTERM, oldsig)
       if os.WEXITSTATUS(status) != 0:
-	 raise DVDError(os.WEXITSTATUS(status), cmd + " exited with status " + str(os.WEXITSTATUS(status)) + ", signal/status " + str(status))
+         raise DVDError(os.WEXITSTATUS(status), cmd + " exited with status " + str(os.WEXITSTATUS(status)) + ", signal/status " + str(status))
 
    def blank(self):
       cmd = self.growcmd + " -Z " + self.device + "=/dev/zero"
@@ -323,17 +339,17 @@ class disk:
       self.pid = proc.pid
       status = proc.poll()
       while status == -1:
-	 line = proc.fromchild.readline()
-	 while len(line) > 0:
-	    print line,
-	    line = proc.fromchild.readline()
-	 time.sleep(1)
-	 status = proc.poll()
+         line = proc.fromchild.readline()
+         while len(line) > 0:
+            print line,
+            line = proc.fromchild.readline()
+         time.sleep(1)
+         status = proc.poll()
       self.pid = 0
       print
       signal.signal(signal.SIGTERM, oldsig)
       if os.WEXITSTATUS(status) != 0:
-	 raise DVDError(os.WEXITSTATUS(status), cmd + " exited with status " + str(os.WEXITSTATUS(status)) + ", signal/status " + str(status))
+         raise DVDError(os.WEXITSTATUS(status), cmd + " exited with status " + str(os.WEXITSTATUS(status)) + ", signal/status " + str(status))
 
    def reformat_minus_RW(self):
       cmd = self.dvdrwformat + " -force " + self.device
@@ -343,17 +359,17 @@ class disk:
       self.pid = proc.pid
       status = proc.poll()
       while status == -1:
-	 line = proc.fromchild.readline()
-	 while len(line) > 0:
-	    print line,
-	    line = proc.fromchild.readline()
-	 time.sleep(1)
-	 status = proc.poll()
+         line = proc.fromchild.readline()
+         while len(line) > 0:
+            print line,
+            line = proc.fromchild.readline()
+         time.sleep(1)
+         status = proc.poll()
       self.pid = 0
       print
       signal.signal(signal.SIGTERM, oldsig)
       if os.WEXITSTATUS(status) != 0:
-	 raise DVDError(os.WEXITSTATUS(status), cmd + " exited with status " + str(os.WEXITSTATUS(status)) + ", signal/status " + str(status))
+         raise DVDError(os.WEXITSTATUS(status), cmd + " exited with status " + str(os.WEXITSTATUS(status)) + ", signal/status " + str(status))
 
 # class disk ends here.
 
@@ -362,7 +378,7 @@ class DVDError(Exception):
       self.errno = errno
       self.value = value
       if self.value[-1] == '\n':
-	 self.value = self.value[0:-1]
+         self.value = self.value[0:-1]
    def __str__(self):
       return str(self.value) + " || errno = " + str(self.errno) + " (" + os.strerror(self.errno & 0x7F) + ")"
 
@@ -379,19 +395,19 @@ dvd-handler DEVICE blank
 where DEVICE is a device name like /dev/sr0 or /dev/dvd.
 
 Operations:
-test	  Scan the device and report the information found.
-	   This operation needs no further arguments.
-free	  Scan the device and report the available space.
-write	  Write a part file to disk.
-	   This operation needs two additional arguments.
-	   The first indicates to append (0), restart the
-	   disk (1) or restart existing disk (2). The second
-	   is the file to write.
+test      Scan the device and report the information found.
+           This operation needs no further arguments.
+free      Scan the device and report the available space.
+write     Write a part file to disk.
+           This operation needs two additional arguments.
+           The first indicates to append (0), restart the
+           disk (1) or restart existing disk (2). The second
+           is the file to write.
 prepare   Prepare a DVD+/-RW for being used by Bacula.
-	   Note: This is only useful if you already have some
-	   non-Bacula data on a medium, and you want to use
-	   it with Bacula. Don't run this on blank media, it
-	   is useless.
+           Note: This is only useful if you already have some
+           non-Bacula data on a medium, and you want to use
+           it with Bacula. Don't run this on blank media, it
+           is useless.
 """
    sys.exit(1)
 
@@ -403,16 +419,16 @@ dvd = disk(sys.argv[1])
 if "free" == sys.argv[2]:
    if len(sys.argv) == 3:
       try:
-	 free = dvd.free()
+         free = dvd.free()
       except DVDError, e:
-	 if e.errno != 0:
-	    print -e.errno
-	 else:
-	    print errno.EPIPE
-	 print str(e)
+         if e.errno != 0:
+            print -e.errno
+         else:
+            print errno.EPIPE
+         print str(e)
       else:
-	 print free
-	 print "No Error reported."
+         print free
+         print "No Error reported."
    else:
       print "Wrong number of arguments for free operation. Wanted 3 got", len(sys.argv)
       print sys.argv[1], sys.argv[2], sys.argv[3]
@@ -420,15 +436,15 @@ if "free" == sys.argv[2]:
 elif "prepare" == sys.argv[2]:
    if len(sys.argv) == 3:
       try:
-	 dvd.prepare()
+         dvd.prepare()
       except DVDError, e:
-	 print "Error while preparing medium: ", str(e)
-	 if e.errno != 0:
-	    sys.exit(e.errno & 0x7F)
-	 else:
-	    sys.exit(errno.EPIPE)
+         print "Error while preparing medium: ", str(e)
+         if e.errno != 0:
+            sys.exit(e.errno & 0x7F)
+         else:
+            sys.exit(errno.EPIPE)
       else:
-	 print "Medium prepared successfully."
+         print "Medium prepared successfully."
    else:
       print "Wrong number of arguments for prepare operation."
       usage()
@@ -442,15 +458,15 @@ elif "test" == sys.argv[2]:
 elif "write" == sys.argv[2]:
    if len(sys.argv) == 5:
       try:
-	 dvd.write(long(sys.argv[3]), sys.argv[4])
+         dvd.write(long(sys.argv[3]), sys.argv[4])
       except DVDError, e:
-	 print "Error while writing part file: ", str(e)
-	 if e.errno != 0:
-	    sys.exit(e.errno & 0x7F)
-	 else:
-	    sys.exit(errno.EPIPE)
+         print "Error while writing part file: ", str(e)
+         if e.errno != 0:
+            sys.exit(e.errno & 0x7F)
+         else:
+            sys.exit(errno.EPIPE)
       else:
-	 print "Part file " + sys.argv[4] + " successfully written to disk."
+         print "Part file " + sys.argv[4] + " successfully written to disk."
    else:
       print "Wrong number of arguments for write operation."
       usage()
diff --git a/scripts/freespace b/scripts/freespace
new file mode 100755
index 0000000..5a28391
--- /dev/null
+++ b/scripts/freespace
@@ -0,0 +1,34 @@
+#!/bin/sh
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+# Bacula interface to get device freespace
+#
+#  If you set in your Device resource
+#
+#  Free Space Command = "path-to-this-script/freespace %a"
+#    you will have the following input to this script:
+#
+#
+#  freespace "archive-device"
+#                  $1
+#
+
+OS=`uname`
+case ${OS} in
+  SunOS)
+    cmd="/bin/df -P"
+    ;;
+  FreeBSD)
+    cmd="/bin/df -P"
+    ;;
+  Linux)
+    cmd="/bin/df -P"
+  ;;
+  *)
+    cmd="/bin/df -P"
+  ;;
+esac
+
+$cmd $1 | tail -1 | awk '{ print $4 }'
diff --git a/scripts/logrotate.in b/scripts/logrotate.in
index 0b1304c..a06db84 100644
--- a/scripts/logrotate.in
+++ b/scripts/logrotate.in
@@ -1,4 +1,8 @@
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+#
 # If you are appending to a log file (default), to
 #   have your log file compressed, rotated, and after a time
 #   deleted, after possibly editing the values below,	  
diff --git a/scripts/logwatch/Makefile.in b/scripts/logwatch/Makefile.in
index f1f5be2..1ecb7dd 100644
--- a/scripts/logwatch/Makefile.in
+++ b/scripts/logwatch/Makefile.in
@@ -1,5 +1,10 @@
 # Makefile to install logwatch script
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # 08 Jan 2005 D. Scott Barninger
+#
 
 SYSCONFDIR=/etc/log.d
 INSTALL=@INSTALL@
diff --git a/scripts/logwatch/bacula b/scripts/logwatch/bacula
index c0c7ad8..67eb321 100755
--- a/scripts/logwatch/bacula
+++ b/scripts/logwatch/bacula
@@ -5,8 +5,8 @@
 # Mon Jan 03 2005
 # D. Scott Barninger and Karl Cunningham
 #
-# Copyright 2005-2006 Free Software Foundation Europe e.V.
-# licensed under GPL-v2
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 
 use strict;
 use POSIX qw(strftime);
@@ -63,4 +63,3 @@ if (scalar(keys(%data))) {
 }
 
 exit(0);
-
diff --git a/scripts/manual_prune.pl b/scripts/manual_prune.pl
new file mode 100755
index 0000000..69d7f1d
--- /dev/null
+++ b/scripts/manual_prune.pl
@@ -0,0 +1,251 @@
+#!/usr/bin/perl -w
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+use strict;
+
+=head1 DESCRIPTION
+
+    manual_prune.pl -- prune volumes
+
+=head2 USAGE
+
+    manual_prune.pl [--bconsole=/path/to/bconsole] [--help] [--doprune] [--expired] [--fixerror] [--fileprune]
+
+    This program when run will manually prune all Volumes that it finds
+    in your Bacula catalog. It will respect all the Retention periods.
+    
+    manual_prune must have access to bconsole. It will execute bconsole
+      from /opt/bacula/bin.  If bconsole is in a different location,
+      you must specify the path to it with the --bconsole=... option.
+
+    If you do not add --doprune, you will see what the script proposes
+      to do, but it will not prune.
+
+    If you add --fixerror, it will change the status of any Volume
+      that is marked Error to Used so that it will be pruned.
+
+    If you add --expired, it will attempt to prune only those 
+      Volumes where the Volume Retention period has expired.
+
+    If you use --fileprune, the script will prune files and pathvisibility
+      useful to avoid blocking Bacula during pruning.
+
+    Adding --debug will print additional debug information.
+
+
+=head1 LICENSE
+
+   Copyright (C) 2008-2014 Bacula Systems SA
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
+   The licensor of Bacula Enterprise is Bacula Systems SA,
+   Rue Galilee 5, 1400 Yverdon-les-Bains, Switzerland.
+
+  This file has been made available for your personal use in the
+  hopes that it will allow community users to make better use of
+  Bacula.
+
+=head1 VERSION
+
+    1.4
+
+=cut
+
+use Getopt::Long qw/:config no_ignore_case/;
+use Pod::Usage;
+use File::Temp;
+
+my $help;
+my $do_prune;
+my $expired;
+my $debug;
+# set to your bconsole prog
+my $bconsole = "/opt/bacula/bin/bconsole";
+my $do_fix;
+my $do_file_prune;
+
+GetOptions('help'       => \$help,
+           'bconsole=s' => \$bconsole,
+           'expired'    => \$expired,
+           'debug'      => \$debug,
+           'fixerror'   => \$do_fix,
+           'fileprune'  => \$do_file_prune,
+           'doprune'    => \$do_prune)
+    || Pod::Usage::pod2usage(-exitval => 2, -verbose => 2) ;
+
+if ($help) {
+    Pod::Usage::pod2usage(-exitval => 2, -verbose => 2) ;
+}
+
+if (! -x $bconsole) {
+    die "Can't exec $bconsole, please specify --bconsole option $!";
+}
+
+my @vol;
+my @vol_purged;
+
+# This fix can work with File based device. Don't use it for Tape media
+if ($do_fix) {
+    my ($fh, $file) = File::Temp::tempfile();
+    print $fh "sql
+SELECT VolumeName AS \"?vol?\" FROM Media WHERE VolStatus = 'Error';
+
+";
+    close($fh);
+    open(FP, "cat $file | $bconsole|") or die "Can't open $bconsole (ERR=$!), adjust your \$PATH";
+    while (my $l = <FP>)
+    {
+        if ($l =~ /^\s*\|\s*([\w\d:\. \-]+?)\s*\|/) {
+            if ($debug) {
+                print $l;
+            }
+            push @vol, $1;
+        } 
+    }
+    close(FP);
+    unlink($file);
+
+    if (scalar(@vol) > 0) {
+        print "Will try to fix volume in Error: ", join(",", @vol), "\n";
+        open(FP, "|$bconsole") or die "Can't send commands to $bconsole";
+        print FP map { "update volume=$_ volstatus=Used\n" } @vol; 
+        close(FP);
+        @vol = ();
+    }
+}
+
+if ($do_file_prune) {
+    my ($fh, $file) = File::Temp::tempfile();
+    if ($do_prune) {
+        print $fh "sql
+BEGIN;
+CREATE TEMPORARY TABLE temp AS
+SELECT DISTINCT JobId FROM Job JOIN JobMedia USING (JobId) JOIN
+(SELECT Media.MediaId  AS MediaId 
+FROM      Media 
+WHERE   VolStatus IN ('Full', 'Used')
+  AND (    (Media.LastWritten) 
+         +  interval '1 second' * (Media.VolRetention)
+      ) < NOW()) AS M USING (MediaId)
+    WHERE Job.JobFiles > 50000 AND Job.PurgedFiles=0;
+SELECT JobId FROM temp;
+DELETE FROM File WHERE JobId IN (SELECT JobId FROM temp);
+DELETE FROM PathVisibility WHERE JobId IN (SELECT JobId FROM temp);
+UPDATE Job SET PurgedFiles=1 WHERE JobId IN (SELECT JobId FROM temp);
+DROP TABLE temp;
+COMMIT;
+
+quit
+";
+    } else {
+        print $fh "sql
+SELECT DISTINCT JobId FROM Job JOIN JobMedia USING (JobId) JOIN
+(SELECT Media.MediaId  AS MediaId 
+FROM      Media 
+WHERE   VolStatus IN ('Full', 'Used')
+  AND (    (Media.LastWritten) 
+         +  interval '1 second' * (Media.VolRetention)
+      ) < NOW()) AS M USING (MediaId)
+    WHERE Job.JobFiles > 50000 AND Job.PurgedFiles=0;
+
+quit
+";
+    }
+    close($fh);
+    open(FP, "cat $file | $bconsole|") or die "Can't open $bconsole (ERR=$!), adjust your \$PATH";
+    while (my $l = <FP>)
+    {
+       if ($debug || !$do_prune) {
+          print $l;
+       }
+    }
+    close(FP);
+    unlink($file);
+    exit 0;
+}
+
+# TODO: Fix it for SQLite
+# works only for postgresql and MySQL at the moment
+# One of the two query will fail, but it's not a problem
+if ($expired) {
+    my ($fh, $file) = File::Temp::tempfile();
+    print $fh "sql
+SELECT Media.VolumeName  AS volumename, 
+       Media.LastWritten AS lastwritten,
+       (
+          (Media.LastWritten) 
+        +  interval '1 second' * (Media.VolRetention)
+       ) AS expire
+FROM      Media 
+WHERE   VolStatus IN ('Full', 'Used')
+  AND (    (Media.LastWritten) 
+         +  interval '1 second' * (Media.VolRetention)
+      ) < NOW();
+SELECT Media.VolumeName  AS volumename, 
+       Media.LastWritten AS lastwritten,
+       (
+          Media.LastWritten +  Media.VolRetention
+       ) AS expire
+FROM      Media 
+WHERE   VolStatus IN ('Full', 'Used')
+  AND (    Media.LastWritten +  Media.VolRetention
+      ) < NOW();
+
+quit
+";
+    close($fh);
+    open(FP, "cat $file | $bconsole|") or die "Can't open $bconsole (ERR=$!), adjust your \$PATH";
+    while (my $l = <FP>)
+    {
+        #  | TestVolume001 | 2011-06-17 14:36:59 | 2011-06-17 14:37:00
+        if ($l =~ /^\s*\|\s*([\w\d:\. \-]+?)\s*\|\s*\d/) {
+            if ($debug) {
+                print $l;
+            }
+            push @vol, $1;
+        }
+    }
+    close(FP);
+    unlink($file);
+
+} else {
+
+    open(FP, "echo list volumes | $bconsole|") or die "Can't open $bconsole (ERR=$!), adjust your \$PATH";
+    while (my $l = <FP>)
+    {
+                  # |        1 |   TestVolume001 | Used
+        if ($l =~ /^\s*\|\s*\d+\s*\|\s*([\w\d-]+)\s*\|\s*Used/) {
+            push @vol, $1;
+        }
+        if ($l =~ /^\s*\|\s*\d+\s*\|\s*([\w\d-]+)\s*\|\s*Full/) {
+            push @vol, $1;
+        }
+        if ($l =~ /^\s*\|\s*\d+\s*\|\s*([\w\d-]+)\s*\|\s*Purged/) {
+            push @vol_purged, $1;
+        }
+    }
+    close(FP);
+
+    if ($? != 0) {
+        system("echo list volumes | $bconsole");
+        die "bconsole returns a non zero status, please check that you can execute it";
+        
+    }
+}
+
+if (!scalar(@vol)) {
+    print "No Volume(s) found to prune.\n";
+
+} else {
+    if ($do_prune) {
+        print "Attempting to to prune ", join(",", @vol), "\n";
+        open(FP, "|$bconsole") or die "Can't send commands to $bconsole";
+        print FP map { "prune volume=$_ yes\n" } @vol; 
+        close(FP);
+    } else {
+        print "Would have attempted to prune ", join(",", @vol), "\n";
+        print "You can actually prune by specifying the --doprune option.\n"
+    }
+}
diff --git a/scripts/mtx-changer.conf b/scripts/mtx-changer.conf
index 9630bdd..981efb9 100644
--- a/scripts/mtx-changer.conf
+++ b/scripts/mtx-changer.conf
@@ -1,10 +1,19 @@
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+#
 # This file is sourced by the mtx-changer script every time it runs.
 #   You can put your site customization here, and when you do an
 #   upgrade, the process should not modify this file.  Thus you
 #   preserve your mtx-changer configuration.
 #
 
+# We update the version when an incompatible change 
+#   to mtx-changer or this conf file is made, such as
+#   adding a new required variable.
+version=2
+
 # Set to 1 if you want to do offline before unload
 offline=0
 
@@ -21,10 +30,34 @@ inventory=0
 #  Storage Element line, so try setting the following to 1
 vxa_packetloader=0
 
+#
+# Debug logging
+#
+
+# If you have multiple SD's, set this differently for each one
+#  so you know which message comes from which one. This can
+#  be any string, and will appear in each debug message just
+#  after the time stamp.
+chgr_id=0
+
 # Set to 1 if you want debug info written to a log
 debug_log=0
 
+# Set to debug level you want to see 
+#     0 is off 
+#    10 is important events (load, unload, loaded)
+#   100 is everything
+# Note debug_log must be set to 1 for anything to be generated
+#
+debug_level=10  
 
+# Debug levels by importance
+#  Normally you do not need to change this
+dbglvl=100
+# More important messages
+idbglvl=10
+
+#
 # mt status output
 # SunOS     No Additional Sense
 # FreeBSD   Current Driver State: at rest.
diff --git a/scripts/mtx-changer.in b/scripts/mtx-changer.in
index ad9c0ca..9c7111d 100644
--- a/scripts/mtx-changer.in
+++ b/scripts/mtx-changer.in
@@ -1,23 +1,22 @@
 #!/bin/sh
 #
-# Bacula interface to mtx autoloader
+#   Bacula(R) - The Network Backup Solution
 #
-#  Written by Kern Sibbald
+#   Copyright (C) 2000-2015 Kern Sibbald
+#   Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 #
-#  Bacula® - The Network Backup Solution
+#   The original author of Bacula is Kern Sibbald, with contributions
+#   from many others, a complete list can be found in the file AUTHORS.
 #
-#  Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
+#   You may use this file and others of this release according to the
+#   license defined in the LICENSE file, which includes the Affero General
+#   Public License, v3.0 ("AGPLv3") and some additional permissions and
+#   terms pursuant to its AGPLv3 Section 7.
 #
-#  The main author of Bacula is Kern Sibbald, with contributions from many
-#  others, a complete list can be found in the file AUTHORS.
-#
-#  You may use this file and others of this release according to the
-#  license defined in the LICENSE file, which includes the Affero General
-#  Public License, v3.0 ("AGPLv3") and some additional permissions and
-#  terms pursuant to its AGPLv3 Section 7.
-#
-#  Bacula® is a registered trademark of Kern Sibbald.
+#   This notice must be preserved when any source code is 
+#   conveyed and/or propagated.
 #
+#   Bacula(R) is a registered trademark of Kern Sibbald.
 #
 #  If you set in your Device resource
 #
@@ -33,7 +32,7 @@
 #  for example:
 #
 #  mtx-changer /dev/sg0 load 1 /dev/nst0 0 (on a Linux system)
-#
+# 
 #  will request to load the first cartidge into drive 0, where
 #   the SCSI control channel is /dev/sg0, and the read/write device
 #   is /dev/nst0.
@@ -58,11 +57,14 @@
 #  Many changers need an offline after the unload. Also many
 #   changers need a sleep 60 after the mtx load.
 #
-#  N.B. If you change the script, take care to return either
+#  N.B. If you change the script, take care to return either 
 #   the mtx exit code or a 0. If the script exits with a non-zero
 #   exit code, Bacula will assume the request failed.
 #
 
+# myversion must be the same as version in mtx-changer.conf
+myversion=2
+
 # source our conf file
 if test ! -f @scriptdir@/mtx-changer.conf ; then
   echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
@@ -72,6 +74,13 @@ if test ! -f @scriptdir@/mtx-changer.conf ; then
 fi
 . @scriptdir@/mtx-changer.conf
 
+if test "${version}" != "${myversion}" ; then
+  echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
+  echo "ERROR: @scriptdir@/mtx-changer.conf has wrong version. Wanted ${myversion}, got ${version} !!!"
+  echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
+  exit 1
+fi
+
 MTX=@MTX@
 
 if test ${debug_log} -ne 0 ; then
@@ -79,8 +88,8 @@ if test ${debug_log} -ne 0 ; then
 fi
 dbgfile="@working_dir@/mtx.log"
 debug() {
-    if test -f $dbgfile; then
-        echo "`date +\"%Y%m%d-%H:%M:%S\"` $*" >> $dbgfile
+    if test -f $dbgfile -a ${debug_level} -ge $1; then
+        echo "`date +%m%d-%H:%M:%S.%N|cut -c1-16` ${chgr_id} $2" >> $dbgfile
     fi
 }
 
@@ -108,7 +117,7 @@ make_temp_file() {
 #  So we separate STDOUT and STDERR in
 #  certain of the mtx commands. The contents of STDERR
 #  is then printed after the STDOUT produced by mtx
-#  thus we sometimes get better changer results.
+#  thus we sometimes get better changer results. 
 #
 make_err_file() {
   ERRFILE=`mktemp @working_dir@/mtx.err.XXXXXXXXXX`
@@ -123,7 +132,7 @@ make_err_file() {
 
 
 #
-# The purpose of this function to wait a maximum
+# The purpose of this function to wait a maximum 
 #   time for the drive. It will
 #   return as soon as the drive is ready, or after
 #   waiting a maximum of 300 seconds.
@@ -134,12 +143,12 @@ make_err_file() {
 #   in the code at the top of this script.
 #
 wait_for_drive() {
-  i=0
+  i=0 
   while [ $i -le 300 ]; do  # Wait max 300 seconds
     if mt -f $1 status 2>&1 | grep "${ready}" >/dev/null 2>&1; then
       break
     fi
-    debug "Device $1 - not ready, retrying..."
+    debug $dbglvl "Device $1 - not ready, retrying..."
     sleep 1
     i=`expr $i + 1`
   done
@@ -162,7 +171,7 @@ check_parm_count() {
     fi
 }
 
-# Check for special cases where only 2 arguments are needed,
+# Check for special cases where only 2 arguments are needed, 
 #  all others are a minimum of 5
 #
 case $2 in
@@ -188,11 +197,10 @@ slot=$3
 device=$4
 drive=$5
 
-debug "Parms: $ctl $cmd $slot $device $drive"
+debug $dbglvl "Parms: $ctl $cmd $slot $device $drive"
 
-case $cmd in
+case $cmd in 
    unload)
-      debug "Doing mtx -f $ctl unload $slot $drive"
 
       if test ${offline} -eq 1 ; then
         mt -f $device offline
@@ -201,33 +209,60 @@ case $cmd in
         sleep ${offline_sleep}
       fi
       make_err_file
-      ${MTX} -f $ctl unload $slot $drive 2>${ERRFILE}
-      rtn=$?
+      for i in 1 2 3 4 5 ; do
+         debug $idbglvl "Doing mtx -f $ctl unload slot=$slot drv=$drive"
+         ${MTX} -f $ctl unload $slot $drive 2>${ERRFILE}
+         rtn=$?
+         if test $rtn -eq 0 ; then
+            break
+         fi
+         grep "Error Code=" ${ERRFILE} 2>/dev/null 1>/dev/null
+         if test $? -ne 0 ; then
+            break
+         fi
+         sleep $i
+      done
       cat ${ERRFILE}
       rm -f ${ERRFILE} >/dev/null 2>&1
+      if test $rtn -ne 0 ; then
+         debug $idbglvl "FAIL: mtx -f $ctl unload slot=$slot drv=$drive"
+      fi
       exit $rtn
       ;;
 
    load)
-      debug "Doing mtx -f $ctl load $slot $drive"
       make_err_file
-      ${MTX} -f $ctl load $slot $drive 2>${ERRFILE}
-      rtn=$?
+      for i in 1 2 3 4 5 ; do
+         debug $idbglvl "Doing mtx -f $ctl load slot=$slot drv=$drive"
+         ${MTX} -f $ctl load $slot $drive 2>${ERRFILE}
+         rtn=$?
+         if test $rtn -eq 0 ; then
+            break
+         fi
+         grep "Error Code=" ${ERRFILE} 2>/dev/null 1>/dev/null
+         if test $? -ne 0 ; then
+            break
+         fi
+         sleep $i
+      done
       if test ${load_sleep} -ne 0 ; then
         sleep ${load_sleep}
       fi
       wait_for_drive $device
       cat ${ERRFILE}
       rm -f ${ERRFILE} >/dev/null 2>&1
+      if test $rtn -ne 0 ; then
+         debug $idbglvl "FAIL: mtx -f $ctl load slot=$slot drv=$drive"
+      fi
       exit $rtn
       ;;
 
-   list)
-      debug "Doing mtx -f $ctl -- to list volumes"
+   list) 
       make_temp_file
       if test ${inventory} -ne 0 ; then
         ${MTX} -f $ctl inventory
       fi
+      debug $dbglvl "Doing mtx -f $ctl list"
       ${MTX} -f $ctl status >${TMPFILE}
       rtn=$?
       if test ${vxa_packetloader} -ne 0 ; then
@@ -237,30 +272,33 @@ case $cmd in
       fi
       cat ${TMPFILE} | grep "^Data Transfer Element [0-9]*:Full (Storage Element [0-9]" | awk '{printf "%s:%s\n",$7,$10}'
       rm -f ${TMPFILE} >/dev/null 2>&1
+      if test $rtn -ne 0 ; then
+         debug $idbglvl "FAIL: mtx -f $ctl list"
+      fi
       exit $rtn
       ;;
 
    listall)
 #  Drive content:         D:Drive num:F:Slot loaded:Volume Name
 #  D:0:F:2:vol2        or D:Drive num:E
-#  D:1:F:42:vol42
+#  D:1:F:42:vol42   
 #  D:3:E
-#
+# 
 #  Slot content:
 #  S:1:F:vol1             S:Slot num:F:Volume Name
 #  S:2:E               or S:Slot num:E
 #  S:3:F:vol4
-#
+# 
 #  Import/Export tray slots:
 #  I:10:F:vol10           I:Slot num:F:Volume Name
 #  I:11:E              or I:Slot num:E
 #  I:12:F:vol40
-
-      debug "Doing mtx -f $ctl -- to list all"
+ 
       make_temp_file
       if test ${inventory} -ne 0 ; then
         ${MTX} -f $ctl inventory
       fi
+      debug $dbglvl "Doing mtx -f $ctl -- to list all"
       ${MTX} -f $ctl status >${TMPFILE}
       rtn=$?
       # can be converted to awk+sed+cut, see below
@@ -274,7 +312,7 @@ case $cmd in
       # If perl isn't installed, you can use by those commands
 #cat ${TMPFILE} | grep "Data Transfer Element" | awk "{print \"D:\"\$4 \$7 \$9 \$10}" | sed "s/=/:/" | sed "s/Full/F:/" | sed "s/Empty/E/"
 #cat ${TMPFILE} | grep -v "Data Transfer Element" | grep "Storage Element" | grep -v "IMPORT/EXPORT" | awk "{print \"S:\"\$3 \$4 \$5}" | sed "s/IMPORT\/EXPORT//" | sed "s/Full *:VolumeTag=/F:/" | sed "s/Empty/E/"
-#cat ${TMPFILE} | grep -v "Data Transfer Element" | grep "Storage Element" | grep "IMPORT/EXPORT" | awk "{print \"I:\"\$3 \$4 \$5}" | sed "s/IMPORT\/EXPORT//" | sed "s/Full *:VolumeTag=/F:/" | sed "s/Empty/E/"
+#cat ${TMPFILE} | grep -v "Data Transfer Element" | grep "Storage Element" | grep "IMPORT/EXPORT" | awk "{print \"I:\"\$3 \$4 \$5}" | sed "s/IMPORT\/EXPORT//" | sed "s/Full *:VolumeTag=/F:/" | sed "s/Empty/E/" 
 
       rm -f ${TMPFILE} >/dev/null 2>&1
       exit $rtn
@@ -282,25 +320,35 @@ case $cmd in
 
    transfer)
       slotdest=$device
-      debug "Doing transfer from $slot to $slotdest"
+      debug $dbglvl "Doing transfer from $slot to $slotdest"
       ${MTX} -f $ctl transfer $slot $slotdest
       rtn=$?
+      if test $rtn -ne 0 ; then
+         debug $idbglvl "FAIL: mtx -f $ctl transfer from=$slot to=$slotdest"
+      fi
       exit $rtn
       ;;
 
    loaded)
-      debug "Doing mtx -f $ctl $drive -- to find what is loaded"
       make_temp_file
+      debug $idbglvl "Doing mtx -f $ctl $drive -- to find what is loaded"
       ${MTX} -f $ctl status >${TMPFILE}
       rtn=$?
       cat ${TMPFILE} | grep "^Data Transfer Element $drive:Full" | awk "{print \$7}"
       cat ${TMPFILE} | grep "^Data Transfer Element $drive:Empty" | awk "{print 0}"
       rm -f ${TMPFILE} >/dev/null 2>&1
+      if test $rtn -ne 0 ; then
+         debug $idbglvl "FAIL: mtx -f $ctl loaded drv=$drive"
+      fi
       exit $rtn
       ;;
 
    slots)
-      debug "Doing mtx -f $ctl -- to get count of slots"
+      debug $dbglvl "Doing mtx -f $ctl -- to get count of slots"
       ${MTX} -f $ctl status | grep " *Storage Changer" | awk "{print \$5}"
+      rtn=$?
+      if test $rtn -ne 0 ; then
+         debug $idbglvl "FAIL: mtx -f $ctl slots"
+      fi
       ;;
 esac
diff --git a/src/Makefile.in b/src/Makefile.in
index a729de8..88c3827 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,5 +1,6 @@
 #
-# Version $Id$
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #
 @MCOMMON@
 
@@ -8,9 +9,9 @@ VPATH = 	.
 .PATH:		.
 
 # one up
-basedir = ..
+basedir = @BUILD_DIR@
 # top dir
-topdir = ..
+topdir = @BUILD_DIR@
 # this dir relative to top dir
 thisdir = src
 
diff --git a/src/baconfig.h b/src/baconfig.h
index 28b0fd8..2b89e96 100644
--- a/src/baconfig.h
+++ b/src/baconfig.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /**
  * General header file configurations that apply to
@@ -46,8 +50,8 @@
 #define ioctl_req_t int
 #endif
 
-#define MANUAL_AUTH_URL "http://www.bacula.org/en/rel-manual/Bacula_Freque_Asked_Questi.html#SECTION00260000000000000000"
-
+#define MANUAL_AUTH_URL "http://www.bacula.org/rel-manual/en/problems/Bacula_Frequently_Asked_Que.html"
+ 
 #ifdef PROTOTYPES
 # define __PROTO(p)     p
 #else
@@ -72,6 +76,17 @@
 #define ASSERT2(x, y)
 #endif
 
+#ifdef DEVELOPER
+#define ASSERTD(x, y) if (!(x)) { \
+   set_assert_msg(__FILE__, __LINE__, y); \
+   Emsg1(M_ERROR, 0, _("Failed ASSERT: %s\n"), #x); \
+   Pmsg1(000, _("Failed ASSERT: %s\n"), #x); \
+   char *jcr = NULL; \
+   jcr[0] = 0; }
+#else
+#define ASSERTD(x, y)
+#endif
+
 /* Allow printing of NULL pointers */
 #define NPRT(x) (x)?(x):_("*None*")
 #define NPRTB(x) (x)?(x):""
@@ -154,7 +169,7 @@ void InitWinAPIWrapper();
 
 
 /* Use the following for strings not to be translated */
-#define NT_(s) (s)
+#define NT_(s) (s)   
 
 /* This should go away! ****FIXME***** */
 #define MAXSTRING 500
@@ -174,7 +189,7 @@ void InitWinAPIWrapper();
 /* All tape operations MUST be a multiple of this */
 #define TAPE_BSIZE 1024
 
-#ifdef DEV_BSIZE
+#ifdef DEV_BSIZE 
 #define B_DEV_BSIZE DEV_BSIZE
 #endif
 
@@ -229,6 +244,7 @@ void InitWinAPIWrapper();
 #define B_ISALPHA(c) (isascii((int)(c)) && isalpha((int)(c)))
 #define B_ISUPPER(c) (isascii((int)(c)) && isupper((int)(c)))
 #define B_ISDIGIT(c) (isascii((int)(c)) && isdigit((int)(c)))
+#define B_ISXDIGIT(c) (isascii((int)(c)) && isxdigit((int)(c)))
 
 /** For multiplying by 10 with shift and addition */
 #define B_TIMES10(d) ((d<<3)+(d<<1))
@@ -307,14 +323,31 @@ typedef off_t     boffset_t;
 void b_memset(const char *file, int line, void *mem, int val, size_t num);
 #endif
 
-/* First we look if we have a debug_level set,
- * then we look for simple debug level without tags
+/* we look for simple debug level 
  * then finally we check if tags are set on debug_level and lvl
  */
-#define chk_dbglvl(lvl) (debug_level > 0 && (                              \
-     ((((lvl) & DT_ALL) == 0)        && ((lvl) <= (debug_level & ~DT_ALL))) || \
-     (((lvl) & DT_ALL & debug_level) && (((lvl) & ~DT_ALL) <= (debug_level & ~DT_ALL)))))
 
+/*
+  lvl   |   debug_level  | tags  | result
+ -------+----------------+-------+-------
+  0     |   0            |       |  OK
+  T1|0  |   0            |       |  NOK
+  T1|0  |   0            |  T1   |  OK
+  10    |   0            |       |  NOK
+  10    |   10           |       |  OK
+  T1|10 |   10           |       |  NOK
+  T1|10 |   10           |  T1   |  OK
+  T1|10 |   10           |  T2   |  NOK
+ */
+
+/* The basic test is working because tags are on high bits */
+#if 1
+#define chk_dbglvl(lvl) ((lvl) <= debug_level ||                     \
+    (((lvl) & debug_level_tags) && (((lvl) & ~DT_ALL) <= debug_level)))
+#else
+/* Alain's macro for debug */
+#define chk_dbglvl(lvl) (((lvl) & debug_level_tags) || (((lvl) & ~DT_ALL) <= debug_level))
+#endif
 /**
  * The digit following Dmsg and Emsg indicates the number of substitutions in
  * the message string. We need to do this kludge because non-GNU compilers
@@ -422,13 +455,13 @@ void b_memset(const char *file, int line, void *mem, int val, size_t num);
 #define Jmsg8(jcr, typ, lvl, msg, a1, a2, a3, a4, a5, a6, a7, a8) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4, a5, a6, a7, a8)
 
 /** Queued Job Error Messages that are delivered according to the message resource */
-#define Qmsg0(jcr, typ, lvl, msg)             q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg)
-#define Qmsg1(jcr, typ, lvl, msg, a1)         q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1)
-#define Qmsg2(jcr, typ, lvl, msg, a1, a2)     q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2)
-#define Qmsg3(jcr, typ, lvl, msg, a1, a2, a3) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3)
-#define Qmsg4(jcr, typ, lvl, msg, a1, a2, a3, a4) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4)
-#define Qmsg5(jcr, typ, lvl, msg, a1, a2, a3, a4, a5) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4, a5)
-#define Qmsg6(jcr, typ, lvl, msg, a1, a2, a3, a4, a5, a6) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4, a5, a6)
+#define Qmsg0(jcr, typ, mtime, msg)             q_msg(__FILE__, __LINE__, jcr, typ, mtime, msg)
+#define Qmsg1(jcr, typ, mtime, msg, a1)         q_msg(__FILE__, __LINE__, jcr, typ, mtime, msg, a1)
+#define Qmsg2(jcr, typ, mtime, msg, a1, a2)     q_msg(__FILE__, __LINE__, jcr, typ, mtime, msg, a1, a2)
+#define Qmsg3(jcr, typ, mtime, msg, a1, a2, a3) q_msg(__FILE__, __LINE__, jcr, typ, mtime, msg, a1, a2, a3)
+#define Qmsg4(jcr, typ, mtime, msg, a1, a2, a3, a4) q_msg(__FILE__, __LINE__, jcr, typ, mtime, msg, a1, a2, a3, a4)
+#define Qmsg5(jcr, typ, mtime, msg, a1, a2, a3, a4, a5) q_msg(__FILE__, __LINE__, jcr, typ, mtime, msg, a1, a2, a3, a4, a5)
+#define Qmsg6(jcr, typ, mtime, msg, a1, a2, a3, a4, a5, a6) q_msg(__FILE__, __LINE__, jcr, typ, mtime, msg, a1, a2, a3, a4, a5, a6)
 
 
 /** Memory Messages that are edited into a Pool Memory buffer */
@@ -450,6 +483,20 @@ int  Mmsg(POOLMEM **msgbuf, const char *fmt,...);
 int  Mmsg(POOLMEM *&msgbuf, const char *fmt,...);
 int  Mmsg(POOL_MEM &msgbuf, const char *fmt,...);
 
+#define MmsgD0(level, msgbuf, fmt) \
+   { Mmsg(msgbuf, fmt); Dmsg1(level, "%s", msgbuf); }
+#define MmsgD1(level, msgbuf, fmt, a1) \
+   { Mmsg(msgbuf, fmt, a1); Dmsg1(level, "%s", msgbuf); }
+#define MmsgD2(level, msgbuf, fmt, a1, a2) \
+   { Mmsg(msgbuf, fmt, a1, a2); Dmsg1(level, "%s", msgbuf); }
+#define MmsgD3(level, msgbuf, fmt, a1, a2, a3) \
+   { Mmsg(msgbuf, fmt, a1, a2, a3); Dmsg1(level, "%s", msgbuf); }
+#define MmsgD4(level, msgbuf, fmt, a1, a2, a3, a4) \
+   { Mmsg(msgbuf, fmt, a1, a2, a3, a4); Dmsg1(level, "%s", msgbuf); }
+#define MmsgD5(level, msgbuf, fmt, a1, a2, a3, a4, a5) \
+   { Mmsg(msgbuf, fmt, a1, a2, a3, a4, a5); Dmsg1(level, "%s", msgbuf); }
+#define MmsgD6(level, msgbuf, fmt, a1, a2, a3, a4, a5, a6) \
+   { Mmsg(msgbuf, fmt, a1, a2, a3, a4, a5, a6); Dmsg1(level, "%s", msgbuf); }
 
 class JCR;
 void d_msg(const char *file, int line, int64_t level, const char *fmt,...);
@@ -465,14 +512,14 @@ int  m_msg(const char *file, int line, POOLMEM *&pool_buf, const char *fmt, ...)
 #ifndef HAVE_WXCONSOLE
 #undef strdup
 #define strdup(buf) bad_call_on_strdup_use_bstrdup(buf)
-#else
+#else 
 /* Groan, WxWidgets has its own way of doing NLS so cleanup */
 #ifndef ENABLE_NLS
 #undef _
 #undef setlocale
 #undef textdomain
 #undef bindtextdomain
-#endif
+#endif  
 #endif
 
 /** Use our fgets which handles interrupts */
@@ -512,55 +559,22 @@ int  m_msg(const char *file, int line, POOLMEM *&pool_buf, const char *fmt, ...)
 
 /* =============================================================
  *               OS Dependent defines
- * =============================================================
+ * ============================================================= 
  */
 #if defined (__digital__) && defined (__unix__)
-/* Tru64 - it does have fseeko and ftello , but since ftell/fseek are also 64 bit */
-/* take this 'shortcut' */
-#define fseeko fseek
-#define ftello ftell
-#else
-#ifndef HAVE_FSEEKO
-/* Bad news. This OS cannot handle 64 bit fseeks and ftells */
-#define fseeko fseek
-#define ftello ftell
-#endif
-#endif
-
-#ifdef HAVE_SUN_OS
-/*
- * On Solaris 2.5/2.6/7 and 8, threads are not timesliced by default,
- * so we need to explictly increase the conncurrency level.
- */
-#ifdef USE_THR_SETCONCURRENCY
-#include <thread.h>
-#define set_thread_concurrency(x)  thr_setconcurrency(x)
-extern int thr_setconcurrency(int);
-#define SunOS 1
-#else
-#define set_thread_concurrency(x)
-#endif
-
-#else
-/*
- * Not needed on most systems
- */
-#define set_thread_concurrency(x)
+/* Tru64 - has 64 bit fseeko and ftello */
+#define  fseeko fseek
+#define  ftello ftell
+#endif /* digital stuff */
 
+#ifndef HAVE_FSEEKO
+/* This OS does not handle 64 bit fseeks and ftells */
+#define  fseeko fseek
+#define  ftello ftell
 #endif
 
-#ifdef HAVE_DARWIN_OS
-/* Apparently someone forgot to wrap getdomainname as a C function */
-#ifdef  __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-int getdomainname(char *name, int len);
-#ifdef  __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* HAVE_DARWIN_OS */
 
-#if defined(HAVE_WIN32)
+#ifdef HAVE_WIN32
 /*
  *   Windows
  */
@@ -573,10 +587,7 @@ inline const char *first_path_separator(const char *path) { return strpbrk(path,
 extern void pause_msg(const char *file, const char *func, int line, const char *msg);
 #define pause(msg) if (debug_level) pause_msg(__FILE__, __func__, __LINE__, (msg))
 
-#else
-/*
- *   Unix/Linix
- */
+#else /* Unix/Linux */
 #define PathSeparator '/'
 /* Define Winsock functions if we aren't on Windows */
 
@@ -587,10 +598,53 @@ inline bool IsPathSeparator(int ch) { return ch == '/'; }
 inline char *first_path_separator(char *path) { return strchr(path, '/'); }
 inline const char *first_path_separator(const char *path) { return strchr(path, '/'); }
 #define pause(msg)
+#endif /* HAVE_WIN32 */
+
+#ifdef HAVE_DARWIN_OS
+/* Apparently someone forgot to wrap getdomainname as a C function */
+#ifdef __cplusplus
+extern "C" {
 #endif
+int getdomainname(char *name, int namelen);
+#ifdef __cplusplus
+}
+#endif
+#endif /* HAVE_DARWIN_OS */
+
+
+/* **** Unix Systems **** */
+#ifdef HAVE_SUN_OS
+/*
+ * On Solaris 2.5/2.6/7 and 8, threads are not timesliced by default,
+ * so we need to explictly increase the conncurrency level.
+ */
+#ifdef USE_THR_SETCONCURRENCY
+#include <thread.h>
+#define set_thread_concurrency(x)  thr_setconcurrency(x)
+extern int thr_setconcurrency(int);
+#define SunOS 1
+#else
+#define set_thread_concurrency(x)
+#define thr_setconcurrency(x)
+#endif
+
+#else
+#define set_thread_concurrency(x)
+#endif /* HAVE_SUN_OS */
 
 
-/** HP-UX 11 specific workarounds */
+#ifdef HAVE_OSF1_OS
+#ifdef __cplusplus
+extern "C" {
+#endif
+int fchdir(int filedes);
+long gethostid(void);
+int getdomainname(char *name, int namelen);
+#ifdef __cplusplus
+}
+#endif
+#endif /* HAVE_OSF1_OS */
+
 
 #ifdef HAVE_HPUX_OS
 # undef h_errno
@@ -600,30 +654,17 @@ extern int h_errno;
  * the problem is no system headers declares the prototypes for these functions
  * this is done below
  */
-#ifdef  __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-int getdomainname(char *name, int namelen);
-int setdomainname(char *name, int namelen);
-#ifdef  __cplusplus
-}
-#endif /* __cplusplus */
+#ifdef __cplusplus
+extern  "C" {
+#endif
+int getdomainname(char *name, int namlen);
+int setdomainname(char *name, int namlen);
+#ifdef __cplusplus
+} 
+#endif
 #endif /* HAVE_HPUX_OS */
 
 
-#ifdef HAVE_OSF1_OS
-#ifdef  __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-int fchdir(int filedes);
-long gethostid(void);
-int getdomainname(char *name, int len);
-#ifdef  __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* HAVE_OSF1_OS */
-
-
 /** Disabled because it breaks internationalisation...
 #undef HAVE_SETLOCALE
 #ifdef HAVE_SETLOCALE
diff --git a/src/bacula.h b/src/bacula.h
index 5ba3b89..ac10af3 100644
--- a/src/bacula.h
+++ b/src/bacula.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * bacula.h -- main header file to include in all Bacula source
@@ -35,8 +39,9 @@
 
 #if defined(HAVE_WIN32)
 #if defined(HAVE_MINGW)
-#include "mingwconfig.h"
+#include "winhdrs.h"
 #else
+#error "Only MINGW is supported"
 #include "winconfig.h"
 #endif
 #else
@@ -51,16 +56,18 @@
 
 
 /* System includes */
-#if HAVE_STDINT_H
+#if defined(HAVE_STDINT_H)
 #ifndef __sgi
 #include <stdint.h>
 #endif
+#elif defined(HAVE_INTTYPES_H)
+#include  <inttypes.h>
 #endif
-#if HAVE_STDARG_H
+#if defined(HAVE_STDARG_H)
 #include <stdarg.h>
 #endif
 #include <stdio.h>
-#if HAVE_STDLIB_H
+#if defined(HAVE_STDLIB_H)
 #include <stdlib.h>
 #endif
 #if HAVE_UNISTD_H
@@ -123,10 +130,10 @@ extern "C" {
 #endif
 #if defined(HAVE_WIN32) & !defined(HAVE_MINGW)
 #include <winsock2.h>
-#endif
+#endif 
 #if !defined(HAVE_WIN32) & !defined(HAVE_MINGW)
 #include <sys/stat.h>
-#endif
+#endif 
 #include <sys/time.h>
 #if HAVE_SYS_WAIT_H
 #include <sys/wait.h>
@@ -151,8 +158,8 @@ extern "C" {
  *  includes before these.
  */
 #if defined(HAVE_WIN32)
-#include <windows.h>
-#include "win32/compat/compat.h"
+//#include <windows.h>
+#include "compat.h"
 #endif
 
 #include "version.h"
@@ -163,7 +170,7 @@ extern "C" {
 #include "lib/lib.h"
 
 #if defined(HAVE_WIN32)
-#include "win32/winapi.h"
+#include "winapi.h"
 #include "winhost.h"
 #else
 #include "host.h"
diff --git a/src/bc_types.h b/src/bc_types.h
index 1e48bca..9e9ea17 100644
--- a/src/bc_types.h
+++ b/src/bc_types.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
     Define integer types for Bacula -- Kern Sibbald
@@ -28,8 +32,6 @@
 
     Also, we define types such as file address lengths.
 
-    Version $Id$
-
  */
 
 
diff --git a/src/c b/src/c
index 526055e..aeb8489 100644
--- a/src/c
+++ b/src/c
@@ -1,15 +1,17 @@
-/*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
diff --git a/src/c.scr b/src/c.scr
new file mode 100644
index 0000000..206188e
--- /dev/null
+++ b/src/c.scr
@@ -0,0 +1,8 @@
+l Copyright (C)
+-1
+mark
+l */
+mark
+db
+inc /home/kern/bacula/k/src/c
+e
diff --git a/src/cats/Makefile.in b/src/cats/Makefile.in
index f14eb7b..22d10b8 100644
--- a/src/cats/Makefile.in
+++ b/src/cats/Makefile.in
@@ -1,4 +1,7 @@
-# 
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 @MCOMMON@
 
 srcdir =	.
@@ -11,8 +14,8 @@ topdir = ../..
 # this dir relative to top dir
 thisdir = src/cats
 
-DEFS += -D_BDB_PRIV_INTERFACE_
-#CPPFLAGS += @DBI_DBD_DRIVERDIR@
+#CPPFLAGS += -DCATS_PRIVATE_DBI @DBI_DBD_DRIVERDIR@
+CPPFLAGS += -DCATS_PRIVATE_DBI
 
 DEBUG=@DEBUG@
 MKDIR=$(topdir)/autoconf/mkinstalldirs
@@ -43,12 +46,6 @@ SQLITE_SRCS = sqlite.c
 SQLITE_OBJS = $(SQLITE_SRCS:.c=.o)
 SQLITE_LOBJS = $(SQLITE_SRCS:.c=.lo)
 
-#INGRES_INCLUDE = @INGRES_INCLUDE@
-#INGRES_LIBS = @INGRES_LIBS@
-#INGRES_SRCS = ingres.c myingres.c
-#INGRES_OBJS = $(INGRES_SRCS:.c=.o)
-#INGRES_LOBJS = $(INGRES_SRCS:.c=.lo)
-
 #DBI_INCLUDE = @DBI_INCLUDE@
 #DBI_LIBS = @DBI_LIBS@
 #DBI_SRCS = dbi.c
@@ -59,7 +56,7 @@ DB_LIBS=@DB_LIBS@
 
 CATS_SRCS  = mysql.c postgresql.c sqlite.c
 LIBBACSQL_SRCS = bvfs.c cats.c sql.c sql_cmds.c sql_create.c sql_delete.c \
-		 sql_find.c sql_get.c sql_glue.c sql_list.c sql_update.c
+		 sql_find.c sql_get.c sql_list.c sql_update.c
 LIBBACSQL_OBJS = $(LIBBACSQL_SRCS:.c=.o)
 LIBBACCATS_OBJS = $(CATS_SRCS:.c=.o)
 LIBBACSQL_LOBJS = $(LIBBACSQL_SRCS:.c=.lo)
@@ -96,10 +93,6 @@ $(SQLITE_LOBJS):
 #	 @echo "Compiling $(@:.lo=.c)"
 #	 $(NO_ECHO)$(LIBTOOL_COMPILE) $(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DBI_INCLUDE) $(DINCLUDE) $(CFLAGS) $(@:.lo=.c)
 
-#$(INGRES_LOBJS):
-#	 @echo "Compiling $(@:.lo=.c)"
-#	 $(NO_ECHO)$(LIBTOOL_COMPILE) $(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(INGRES_INCLUDE) $(DINCLUDE) $(CFLAGS) $(@:.lo=.c)
-
 $(MYSQL_OBJS):
 	@echo "Compiling $(@:.o=.c)"
 	$(NO_ECHO)$(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(MYSQL_INCLUDE) $(DINCLUDE) $(CFLAGS) $(@:.o=.c)
@@ -112,10 +105,6 @@ $(SQLITE_OBJS):
 	@echo "Compiling $(@:.o=.c)"
 	$(NO_ECHO)$(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(SQLITE_INCLUDE) $(DINCLUDE) $(CFLAGS) $(@:.o=.c)
 
-#$(INGRES_OBJS):
-#	 @echo "Compiling $(@:.o=.c)"
-#	 $(NO_ECHO)$(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(INGRES_INCLUDE) $(DINCLUDE) $(CFLAGS) $(@:.o=.c)
-
 #$(DBI_OBJS):
 #	 @echo "Compiling $(@:.o=.c)"
 #	 $(NO_ECHO)$(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DBI_INCLUDE) $(DINCLUDE) $(CFLAGS) $(@:.o=.c)
@@ -124,12 +113,6 @@ all: Makefile libbacsql$(DEFAULT_ARCHIVE_TYPE) libbaccats$(DEFAULT_ARCHIVE_TYPE)
 	@echo "==== Make of sqllibs is good ===="
 	@echo " "
 
-#esql:
-#	 @echo "Generating myingres.c from myingres.sc"
-#	 $(NO_ECHO)$(II_SYSTEM)/ingres/bin/esqlcc -multi -extension=c myingres.sc
-#	 @echo "Generating myingres.h from myingres.sh"
-#	 $(NO_ECHO)$(II_SYSTEM)/ingres/bin/esqlcc -extension=h myingres.sh
-
 libbacsql.a: $(LIBBACSQL_OBJS)
 	@echo "Making $@ ..."
 	$(AR) rc  $@ $(LIBBACSQL_OBJS)
@@ -144,9 +127,9 @@ libbacsql.la: Makefile $(LIBBACSQL_LOBJS)
 	@echo "Making $@ ..."	  
 	$(LIBTOOL_LINK) $(CXX) $(DEFS) $(DEBUG) $(LDFLAGS) -o $@ $(LIBBACSQL_LOBJS) -export-dynamic -rpath $(libdir) -release $(LIBBACSQL_LT_RELEASE) $(DB_LIBS)
 
-libbaccats.la: Makefile cats_dummy.lo
+libbaccats.la: Makefile cats_null.lo
 	@echo "Making $@ ..."
-	$(LIBTOOL_LINK) $(CXX) $(DEFS) $(DEBUG) $(LDFLAGS) -o $@ cats_dummy.lo -export-dynamic -rpath $(libdir) -release $(LIBBACCATS_LT_RELEASE)
+	$(LIBTOOL_LINK) $(CXX) $(DEFS) $(DEBUG) $(LDFLAGS) -o $@ cats_null.lo -export-dynamic -rpath $(libdir) -release $(LIBBACCATS_LT_RELEASE)
 
 libbaccats-mysql.la: Makefile $(MYSQL_LOBJS)
 	@echo "Making $@ ..."
@@ -162,12 +145,6 @@ libbaccats-sqlite3.la: Makefile $(SQLITE_LOBJS)
 	@echo "Making $@ ..."
 	$(LIBTOOL_LINK) $(CXX) $(DEFS) $(DEBUG) $(LDFLAGS) -o $@ $(SQLITE_LOBJS) -export-dynamic -rpath $(libdir) -release $(LIBBACCATS_LT_RELEASE) \
 							   -soname libbaccats-$(LIBBACCATS_LT_RELEASE).so $(SQLITE_LIBS)
-
-#libbaccats-ingres.la: Makefile $(INGRES_LOBJS)
-#	 @echo "Making $@ ..."
-#	 $(LIBTOOL_LINK) $(CXX) $(DEFS) $(DEBUG) $(LDFLAGS) -o $@ $(INGRES_LOBJS) -export-dynamic -rpath $(libdir) -release $(LIBBACCATS_LT_RELEASE) \
-#							    -soname libbaccats-$(LIBBACCATS_LT_RELEASE).so $(INGRES_LIBS)
-
 #libbaccats-dbi.la: Makefile $(DBI_LOBJS)
 #	 @echo "Making $@ ..."
 #	 $(LIBTOOL_LINK) $(CXX) $(DEFS) $(DEBUG) $(LDFLAGS) -o $@ $(DBI_LOBJS) -export-dynamic -rpath $(libdir) -release $(LIBBACCATS_LT_RELEASE) \
@@ -197,16 +174,13 @@ realclean: clean
 	$(RMF) create_postgresql_database  update_postgresql_tables make_postgresql_tables
 	$(RMF) grant_postgresql_privileges drop_postgresql_tables   drop_postgresql_database
 
-	$(RMF) create_ingres_database update_ingres_tables make_ingres_tables
-	$(RMF) grant_ingres_privileges drop_ingres_tables   drop_ingres_database
-
 	$(RMF) create_sqlite_database	   update_sqlite_tables     make_sqlite_tables
 	$(RMF) grant_sqlite_privileges	   drop_sqlite_tables	    drop_sqlite_database
 
 	$(RMF) create_sqlite3_database	   update_sqlite3_tables     make_sqlite3_tables
 	$(RMF) grant_sqlite3_privileges    drop_sqlite3_tables	    drop_sqlite3_database
 
-	$(RMF) mysql sqlite postgresql ingres
+	$(RMF) mysql sqlite postgresql
 	$(RMF) make_catalog_backup make_catalog_backup.pl delete_catalog_backup
 
 distclean: realclean
@@ -319,7 +293,6 @@ uninstall: @LIBTOOL_UNINSTALL_TARGET@ @INCLUDE_UNINSTALL_TARGET@
 # and it also includes system headers.
 # `semi'-automatic since dependencies are generated at distribution time.
 
-#depend: esql  <-  SRE: if generating from 'real' ingres source
 depend: 
 	@$(MV) Makefile Makefile.bak
 	@$(SED) "/^# DO NOT DELETE:/,$$ d" Makefile.bak > Makefile
diff --git a/src/cats/bdb.h b/src/cats/bdb.h
new file mode 100644
index 0000000..cc53b4a
--- /dev/null
+++ b/src/cats/bdb.h
@@ -0,0 +1,250 @@
+/*
+   Bacula(R) - The Network Backup Solution
+
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2000-2015 Free Software Foundation Europe e.V.
+
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
+
+   You may use this file and others of this release according to the
+   license defined in the LICENSE file, which includes the Affero General
+   Public License, v3.0 ("AGPLv3") and some additional permissions and
+   terms pursuant to its AGPLv3 Section 7.
+
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
+/*
+ *  Catalog DB Interface class
+ *
+ *  Written by Kern E. Sibbald
+ *
+ */
+
+#ifndef __BDB_H_
+#define __BDB_H_ 1
+
+class BDB: public SMARTALLOC {
+public:
+   dlink m_link;                      /* queue control */
+   brwlock_t m_lock;                  /* transaction lock */
+   SQL_DRIVER m_db_driver_type;       /* driver type */
+   SQL_DBTYPE m_db_type;              /* database type */
+   char *m_db_name;                   /* database name */
+   char *m_db_user;                   /* database user */
+   char *m_db_address;                /* host name address */
+   char *m_db_socket;                 /* socket for local access */
+   char *m_db_password;               /* database password */
+   char *m_db_driver;                 /* database driver */
+   char *m_db_driverdir;              /* database driver dir */
+   int m_ref_count;                   /* reference count */
+   int m_db_port;                     /* port for host name address */
+   bool m_disabled_batch_insert;      /* explicitly disabled batch insert mode ? */
+   bool m_dedicated;                  /* is this connection dedicated? */
+   bool m_use_fatal_jmsg;             /* use Jmsg(M_FATAL) after bad queries? */
+   bool m_connected;                  /* connection made to db */
+   bool m_have_batch_insert;          /* have batch insert support ? */
+
+   /* Cats Internal */
+   int m_status;                      /* status */
+   int m_num_rows;                    /* number of rows returned by last query */
+   int m_num_fields;                  /* number of fields returned by last query */
+   int m_rows_size;                   /* size of malloced rows */
+   int m_fields_size;                 /* size of malloced fields */
+   int m_row_number;                  /* row number from xx_data_seek */
+   int m_field_number;                /* field number from sql_field_seek */
+   SQL_ROW m_rows;                    /* defined rows */
+   SQL_FIELD *m_fields;               /* defined fields */
+   bool m_allow_transactions;         /* transactions allowed */
+   bool m_transaction;                /* transaction started */
+
+   POOLMEM *cached_path;              /* cached path name */
+   POOLMEM *cmd;                      /* SQL command string */
+   POOLMEM *errmsg;                   /* nicely edited error message */
+   POOLMEM *esc_name;                 /* Escaped file name */
+   POOLMEM *esc_obj;                  /* Escaped restore object */
+   POOLMEM *esc_path;                 /* Escaped path name */
+   POOLMEM *fname;                    /* Filename only */
+   POOLMEM *path;                     /* Path only */
+   uint32_t cached_path_id;           /* cached path id */
+   int cached_path_len;               /* length of cached path */
+   int changes;                       /* changes during transaction */
+   int fnl;                           /* file name length */
+   int pnl;                           /* path name length */
+
+   /* methods */
+   BDB() {};
+   virtual ~BDB() {};
+   const char *get_db_name(void) { return m_db_name; };
+   const char *get_db_user(void) { return m_db_user; };
+   const bool is_connected(void) { return m_connected; };
+   const bool is_dedicated(void) { return m_dedicated; };
+   bool use_fatal_jmsg(void) { return m_use_fatal_jmsg; };
+   const bool batch_insert_available(void) { return m_have_batch_insert; };
+   void set_use_fatal_jmsg(bool val) { m_use_fatal_jmsg = val; };
+   void increment_refcount(void) { m_ref_count++; };
+   const int bdb_get_type_index(void) { return m_db_type; };
+   const char *bdb_get_engine_name(void);
+
+   BDB *bdb_clone_database_connection(JCR *jcr, bool mult_db_connections);
+   bool bdb_match_database(const char *db_driver, const char *db_name,
+            const char *bdb_address, int db_port);
+   bool bdb_sql_query(const char *query, int flags=0);
+   void bdb_lock(const char *file=__FILE__, int line=__LINE__);
+   void bdb_unlock(const char *file=__FILE__, int line=__LINE__);
+   void print_lock_info(FILE *fp);
+
+   /* sql.c */
+   bool UpdateDB(JCR *jcr, char *cmd, const char *file=__FILE__, int line=__LINE__);
+   bool InsertDB(JCR *jcr, char *cmd, const char *file=__FILE__, int line=__LINE__);
+   bool QueryDB(JCR *jcr, char *cmd, const char *file=__FILE__, int line=__LINE__);
+   int  DeleteDB(JCR *jcr, char *cmd, const char *file=__FILE__, int line=__LINE__);
+   char *bdb_strerror() { return errmsg; };
+   bool bdb_check_version(JCR *jcr);
+   bool bdb_open_batch_connexion(JCR *jcr);
+   bool bdb_check_max_connections(JCR *jcr, uint32_t max_concurrent_jobs);
+
+   /* sql_delete.c */
+   int bdb_delete_pool_record(JCR *jcr, POOL_DBR *pool_dbr);
+   int bdb_delete_media_record(JCR *jcr, MEDIA_DBR *mr);
+   int bdb_purge_media_record(JCR *jcr, MEDIA_DBR *mr);
+   int bdb_delete_snapshot_record(JCR *jcr, SNAPSHOT_DBR *sr);
+
+   /* sql_find.c */
+   bool bdb_find_last_job_start_time(JCR *jcr, JOB_DBR *jr, POOLMEM **stime, char *job, int JobLevel);
+   bool bdb_find_job_start_time(JCR *jcr, JOB_DBR *jr, POOLMEM **stime, char *job);
+   bool bdb_find_last_jobid(JCR *jcr, const char *Name, JOB_DBR *jr);
+   int bdb_find_next_volume(JCR *jcr, int index, bool InChanger, MEDIA_DBR *mr);
+   bool bdb_find_failed_job_since(JCR *jcr, JOB_DBR *jr, POOLMEM *stime, int &JobLevel);
+   
+   /* sql_create.c */
+   int bdb_create_path_record(JCR *jcr, ATTR_DBR *ar);
+   bool bdb_create_file_attributes_record(JCR *jcr, ATTR_DBR *ar);
+   bool bdb_create_job_record(JCR *jcr, JOB_DBR *jr);
+   int bdb_create_media_record(JCR *jcr, MEDIA_DBR *media_dbr);
+   int bdb_create_client_record(JCR *jcr, CLIENT_DBR *cr);
+   bool bdb_create_fileset_record(JCR *jcr, FILESET_DBR *fsr);
+   bool bdb_create_pool_record(JCR *jcr, POOL_DBR *pool_dbr);
+   bool bdb_create_jobmedia_record(JCR *jcr, JOBMEDIA_DBR *jr);
+   int bdb_create_counter_record(JCR *jcr, COUNTER_DBR *cr);
+   bool bdb_create_device_record(JCR *jcr, DEVICE_DBR *dr);
+   bool bdb_create_storage_record(JCR *jcr, STORAGE_DBR *sr);
+   bool bdb_create_mediatype_record(JCR *jcr, MEDIATYPE_DBR *mr);
+   bool bdb_create_attributes_record(JCR *jcr, ATTR_DBR *ar);
+   bool bdb_create_restore_object_record(JCR *jcr, ROBJECT_DBR *ar);
+   bool bdb_create_base_file_attributes_record(JCR *jcr, ATTR_DBR *ar);
+   bool bdb_commit_base_file_attributes_record(JCR *jcr);
+   bool bdb_create_base_file_list(JCR *jcr, char *jobids);
+   bool bdb_create_snapshot_record(JCR *jcr, SNAPSHOT_DBR *snap);
+   int bdb_create_file_record(JCR *jcr, ATTR_DBR *ar);
+   int bdb_create_filename_record(JCR *jcr, ATTR_DBR *ar);
+   bool bdb_create_batch_file_attributes_record(JCR *jcr, ATTR_DBR *ar);
+
+   /* sql_get.c */
+   bool bdb_get_file_record(JCR *jcr, JOB_DBR *jr, FILE_DBR *fdbr);
+   bool bdb_get_snapshot_record(JCR *jcr, SNAPSHOT_DBR *snap);
+   bool bdb_get_volume_jobids(JCR *jcr,
+            MEDIA_DBR *mr, db_list_ctx *lst);
+   bool bdb_get_base_file_list(JCR *jcr, bool use_md5,
+            DB_RESULT_HANDLER *result_handler,void *ctx);
+   int bdb_get_filename_record(JCR *jcr);
+   int bdb_get_path_record(JCR *jcr);
+   bool bdb_get_pool_record(JCR *jcr, POOL_DBR *pdbr);
+   bool bdb_get_pool_numvols(JCR *jcr, POOL_DBR *pdbr);
+   int bdb_get_client_record(JCR *jcr, CLIENT_DBR *cr);
+   bool bdb_get_job_record(JCR *jcr, JOB_DBR *jr);
+   int bdb_get_job_volume_names(JCR *jcr, JobId_t JobId, POOLMEM **VolumeNames);
+   bool bdb_get_file_attributes_record(JCR *jcr, char *fname, JOB_DBR *jr, FILE_DBR *fdbr);
+   int bdb_get_fileset_record(JCR *jcr, FILESET_DBR *fsr);
+   bool bdb_get_media_record(JCR *jcr, MEDIA_DBR *mr);
+   int bdb_get_num_media_records(JCR *jcr);
+   int bdb_get_num_pool_records(JCR *jcr);
+   int bdb_get_pool_ids(JCR *jcr, int *num_ids, DBId_t **ids);
+   int bdb_get_client_ids(JCR *jcr, int *num_ids, DBId_t **ids);
+   bool bdb_get_media_ids(JCR *jcr, MEDIA_DBR *mr, int *num_ids, uint32_t **ids);
+   int  bdb_get_job_volume_parameters(JCR *jcr, JobId_t JobId, VOL_PARAMS **VolParams);
+   bool bdb_get_counter_record(JCR *jcr, COUNTER_DBR *cr);
+   bool bdb_get_query_dbids(JCR *jcr, POOL_MEM &query, dbid_list &ids);
+   bool bdb_get_file_list(JCR *jcr, char *jobids,
+            bool use_md5, bool use_delta,
+            DB_RESULT_HANDLER *result_handler, void *ctx);
+   bool bdb_get_base_jobid(JCR *jcr, JOB_DBR *jr, JobId_t *jobid);
+   bool bdb_get_accurate_jobids(JCR *jcr, JOB_DBR *jr, db_list_ctx *jobids);
+   bool bdb_get_used_base_jobids(JCR *jcr, POOLMEM *jobids, db_list_ctx *result);
+   bool bdb_get_restoreobject_record(JCR *jcr, ROBJECT_DBR *rr);
+
+/* sql_list.c */
+   void bdb_list_pool_records(JCR *jcr, POOL_DBR *pr, DB_LIST_HANDLER sendit, void *ctx, e_list_type type);
+   alist *bdb_list_job_records(JCR *jcr, JOB_DBR *jr, DB_LIST_HANDLER sendit, void *ctx, e_list_type type);
+   void bdb_list_job_totals(JCR *jcr, JOB_DBR *jr, DB_LIST_HANDLER sendit, void *ctx);
+   void bdb_list_files_for_job(JCR *jcr, uint32_t jobid, DB_LIST_HANDLER sendit, void *ctx);
+   void bdb_list_media_records(JCR *jcr, MEDIA_DBR *mdbr, DB_LIST_HANDLER *sendit, void *ctx, e_list_type type);
+   void bdb_list_jobmedia_records(JCR *jcr, JobId_t JobId, DB_LIST_HANDLER *sendit, void *ctx, e_list_type type);
+   void bdb_list_joblog_records(JCR *jcr, JobId_t JobId, DB_LIST_HANDLER *sendit, void *ctx, e_list_type type);
+   int  bdb_list_sql_query(JCR *jcr, const char *query, DB_LIST_HANDLER *sendit, void *ctx, int verbose, e_list_type type);
+   void bdb_list_client_records(JCR *jcr, DB_LIST_HANDLER *sendit, void *ctx, e_list_type type);
+   void bdb_list_copies_records(JCR *jcr, uint32_t limit, char *jobids, DB_LIST_HANDLER *sendit, void *ctx, e_list_type type);
+   void bdb_list_base_files_for_job(JCR *jcr, JobId_t jobid, DB_LIST_HANDLER *sendit, void *ctx);
+   void bdb_list_restore_objects(JCR *jcr, ROBJECT_DBR *rr, DB_LIST_HANDLER *sendit, void *ctx, e_list_type type);
+   void bdb_list_snapshot_records(JCR *jcr, SNAPSHOT_DBR *sdbr,
+              DB_LIST_HANDLER *sendit, void *ctx, e_list_type type);
+
+
+   /* sql_update.c */
+   bool bdb_update_job_start_record(JCR *jcr, JOB_DBR *jr);
+   int  bdb_update_job_end_record(JCR *jcr, JOB_DBR *jr);
+   int  bdb_update_client_record(JCR *jcr, CLIENT_DBR *cr);
+   int  bdb_update_pool_record(JCR *jcr, POOL_DBR *pr);
+   bool bdb_update_storage_record(JCR *jcr, STORAGE_DBR *sr);
+   int  bdb_update_media_record(JCR *jcr, MEDIA_DBR *mr);
+   int  bdb_update_media_defaults(JCR *jcr, MEDIA_DBR *mr);
+   int  bdb_update_counter_record(JCR *jcr, COUNTER_DBR *cr);
+   int  bdb_add_digest_to_file_record(JCR *jcr, FileId_t FileId, char *digest, int type);
+   int  bdb_mark_file_record(JCR *jcr, FileId_t FileId, JobId_t JobId);
+   void bdb_make_inchanger_unique(JCR *jcr, MEDIA_DBR *mr);
+   int  bdb_update_stats(JCR *jcr, utime_t age);
+   bool bdb_update_snapshot_record(JCR *jcr, SNAPSHOT_DBR *sr);
+
+   /* Pure virtual low level methods */
+   virtual void bdb_escape_string(JCR *jcr, char *snew, char *old, int len) = 0;
+   virtual char *bdb_escape_object(JCR *jcr, char *old, int len) = 0;
+   virtual void bdb_unescape_object(JCR *jcr, char *from, int32_t expected_len,
+                   POOLMEM **dest, int32_t *len) = 0;
+   virtual bool bdb_open_database(JCR *jcr) = 0;
+   virtual void bdb_close_database(JCR *jcr) = 0;
+   virtual void bdb_start_transaction(JCR *jcr) = 0;
+   virtual void bdb_end_transaction(JCR *jcr) = 0;
+   virtual bool bdb_sql_query(const char *query, DB_RESULT_HANDLER *result_handler, void *ctx) = 0;
+   virtual void bdb_thread_cleanup(void) = 0;
+
+   /* By default, we use bdb_sql_query */
+   virtual bool bdb_big_sql_query(const char *query,
+                   DB_RESULT_HANDLER *result_handler, void *ctx) {
+      return bdb_sql_query(query, result_handler, ctx);
+   };
+
+   /* Cats Internal */
+#ifdef CATS_PRIVATE_DBI
+   int sql_num_rows(void) { return m_num_rows; };
+   void sql_field_seek(int field) { m_field_number = field; };
+   int sql_num_fields(void) { return m_num_fields; };
+   virtual void sql_free_result(void) = 0;
+   virtual SQL_ROW sql_fetch_row(void) = 0;
+   virtual bool sql_query(const char *query, int flags=0) = 0;
+   virtual const char *sql_strerror(void) = 0;
+   virtual void sql_data_seek(int row) = 0;
+   virtual int sql_affected_rows(void) = 0;
+   virtual uint64_t sql_insert_autokey_record(const char *query, const char *table_name) = 0;
+   virtual SQL_FIELD *sql_fetch_field(void) = 0;
+   virtual bool sql_field_is_not_null(int field_type) = 0;
+   virtual bool sql_field_is_numeric(int field_type) = 0;
+   virtual bool sql_batch_start(JCR *jcr) = 0;
+   virtual bool sql_batch_end(JCR *jcr, const char *error) = 0;
+   virtual bool sql_batch_insert(JCR *jcr, ATTR_DBR *ar) = 0;
+#endif
+};
+
+#endif /* __Bbdb_H_ */
diff --git a/src/cats/bdb_mysql.h b/src/cats/bdb_mysql.h
index b32d05f..d260a76 100644
--- a/src/cats/bdb_mysql.h
+++ b/src/cats/bdb_mysql.h
@@ -1,20 +1,26 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2009-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
-#ifndef __BDB_MYSQL_H_
-#define __BDB_MYSQL_H_ 1
+
+/* MySQL driver specific definitions */
+
+#ifdef __BDB_MYSQL_H_
 
 /*
  * Number of insert statements to batch-up in batch insert
@@ -23,30 +29,27 @@
  */
 #define MYSQL_CHANGES_PER_BATCH_INSERT 32
 
-class B_DB_MYSQL: public B_DB_PRIV {
+class BDB_MYSQL: public BDB {
 private:
    MYSQL *m_db_handle;
    MYSQL m_instance;
    MYSQL_RES *m_result;
 
 public:
-   B_DB_MYSQL(JCR *jcr, const char *db_driver, const char *db_name,
-              const char *db_user, const char *db_password,
-              const char *db_address, int db_port, const char *db_socket,
-              bool mult_db_connections, bool disable_batch_insert);
-   ~B_DB_MYSQL();
+   BDB_MYSQL();
+   ~BDB_MYSQL();
 
-   /* low level operations */
-   bool db_open_database(JCR *jcr);
-   void db_close_database(JCR *jcr);
-   void db_thread_cleanup(void);
-   void db_escape_string(JCR *jcr, char *snew, char *old, int len);
-   char *db_escape_object(JCR *jcr, char *old, int len);
-   void db_unescape_object(JCR *jcr, char *from, int32_t expected_len,
+   /* Functions that we override */
+   bool bdb_open_database(JCR *jcr);
+   void bdb_close_database(JCR *jcr);
+   void bdb_thread_cleanup(void);
+   void bdb_escape_string(JCR *jcr, char *snew, char *old, int len);
+   char *bdb_escape_object(JCR *jcr, char *old, int len);
+   void bdb_unescape_object(JCR *jcr, char *from, int32_t expected_len,
                            POOLMEM **dest, int32_t *len);
-   void db_start_transaction(JCR *jcr);
-   void db_end_transaction(JCR *jcr);
-   bool db_sql_query(const char *query, DB_RESULT_HANDLER *result_handler, void *ctx);
+   void bdb_start_transaction(JCR *jcr);
+   void bdb_end_transaction(JCR *jcr);
+   bool bdb_sql_query(const char *query, DB_RESULT_HANDLER *result_handler, void *ctx);
    void sql_free_result(void);
    SQL_ROW sql_fetch_row(void);
    bool sql_query(const char *query, int flags=0);
diff --git a/src/cats/bdb_postgresql.h b/src/cats/bdb_postgresql.h
index 2192c28..8881206 100644
--- a/src/cats/bdb_postgresql.h
+++ b/src/cats/bdb_postgresql.h
@@ -1,46 +1,49 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2009-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
-#ifndef __BDB_POSTGRESQL_H_
-#define __BDB_POSTGRESQL_H_ 1
 
-class B_DB_POSTGRESQL: public B_DB_PRIV {
+/* Postgresql driver specific definitions */
+
+#ifdef __BDB_POSTGRESQL_H_
+
+class BDB_POSTGRESQL: public BDB {
 private:
    PGconn *m_db_handle;
    PGresult *m_result;
-   POOLMEM *m_buf;                        /* Buffer to manipulate queries */
+   POOLMEM *m_buf;                /* Buffer to manipulate queries */
 
 public:
-   B_DB_POSTGRESQL(JCR *jcr, const char *db_driver, const char *db_name,
-                   const char *db_user, const char *db_password,
-                   const char *db_address, int db_port, const char *db_socket,
-                   bool mult_db_connections, bool disable_batch_insert);
-   ~B_DB_POSTGRESQL();
-
-   /* low level operations */
-   bool db_open_database(JCR *jcr);
-   void db_close_database(JCR *jcr);
-   void db_thread_cleanup(void);
-   void db_escape_string(JCR *jcr, char *snew, char *old, int len);
-   char *db_escape_object(JCR *jcr, char *old, int len);
-   void db_unescape_object(JCR *jcr, char *from, int32_t expected_len,
+   BDB_POSTGRESQL();
+   ~BDB_POSTGRESQL();
+
+   /* Functions that we override */
+   bool bdb_open_database(JCR *jcr);
+   void bdb_close_database(JCR *jcr);
+   void bdb_thread_cleanup(void);
+   void bdb_escape_string(JCR *jcr, char *snew, char *old, int len);
+   char *bdb_escape_object(JCR *jcr, char *old, int len);
+   void bdb_unescape_object(JCR *jcr, char *from, int32_t expected_len,
                            POOLMEM **dest, int32_t *len);
-   void db_start_transaction(JCR *jcr);
-   void db_end_transaction(JCR *jcr);
-   bool db_sql_query(const char *query, DB_RESULT_HANDLER *result_handler, void *ctx);
-   bool db_big_sql_query(const char *query, DB_RESULT_HANDLER *result_handler, void *ctx);
+   void bdb_start_transaction(JCR *jcr);
+   void bdb_end_transaction(JCR *jcr);
+   bool bdb_sql_query(const char *query, DB_RESULT_HANDLER *result_handler, void *ctx);
+   bool bdb_big_sql_query(const char *query, DB_RESULT_HANDLER *result_handler, void *ctx);
    void sql_free_result(void);
    SQL_ROW sql_fetch_row(void);
    bool sql_query(const char *query, int flags=0);
diff --git a/src/cats/bdb_priv.h b/src/cats/bdb_priv.h
deleted file mode 100644
index e58e04f..0000000
--- a/src/cats/bdb_priv.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
-   Bacula® - The Network Backup Solution
-
-   Copyright (C) 2011-2014 Free Software Foundation Europe e.V.
-
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
-
-   You may use this file and others of this release according to the
-   license defined in the LICENSE file, which includes the Affero General
-   Public License, v3.0 ("AGPLv3") and some additional permissions and
-   terms pursuant to its AGPLv3 Section 7.
-
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
-#ifndef __BDB_PRIV_H_
-#define __BDB_PRIV_H_ 1
-
-#ifndef _BDB_PRIV_INTERFACE_
-#error "Illegal inclusion of catalog private interface"
-#endif
-
-/*
- * Generic definition of a sql_row.
- */
-typedef char **SQL_ROW;
-
-/*
- * Generic definition of a a sql_field.
- */
-typedef struct sql_field {
-   char *name;                        /* name of column */
-   int max_length;                    /* max length */
-   uint32_t type;                     /* type */
-   uint32_t flags;                    /* flags */
-} SQL_FIELD;
-
-class B_DB_PRIV: public B_DB {
-protected:
-   int m_status;                      /* status */
-   int m_num_rows;                    /* number of rows returned by last query */
-   int m_num_fields;                  /* number of fields returned by last query */
-   int m_rows_size;                   /* size of malloced rows */
-   int m_fields_size;                 /* size of malloced fields */
-   int m_row_number;                  /* row number from xx_data_seek */
-   int m_field_number;                /* field number from sql_field_seek */
-   SQL_ROW m_rows;                    /* defined rows */
-   SQL_FIELD *m_fields;               /* defined fields */
-   bool m_allow_transactions;         /* transactions allowed */
-   bool m_transaction;                /* transaction started */
-
-public:
-   /* methods */
-   B_DB_PRIV() {};
-   virtual ~B_DB_PRIV() {};
-
-   int sql_num_rows(void) { return m_num_rows; };
-   void sql_field_seek(int field) { m_field_number = field; };
-   int sql_num_fields(void) { return m_num_fields; };
-   virtual void sql_free_result(void) = 0;
-   virtual SQL_ROW sql_fetch_row(void) = 0;
-   virtual bool sql_query(const char *query, int flags=0) = 0;
-   virtual const char *sql_strerror(void) = 0;
-   virtual void sql_data_seek(int row) = 0;
-   virtual int sql_affected_rows(void) = 0;
-   virtual uint64_t sql_insert_autokey_record(const char *query, const char *table_name) = 0;
-   virtual SQL_FIELD *sql_fetch_field(void) = 0;
-   virtual bool sql_field_is_not_null(int field_type) = 0;
-   virtual bool sql_field_is_numeric(int field_type) = 0;
-   virtual bool sql_batch_start(JCR *jcr) = 0;
-   virtual bool sql_batch_end(JCR *jcr, const char *error) = 0;
-   virtual bool sql_batch_insert(JCR *jcr, ATTR_DBR *ar) = 0;
-};
-
-#endif /* __BDB_PRIV_H_ */
diff --git a/src/cats/bdb_sqlite.h b/src/cats/bdb_sqlite.h
index 39a0b33..87f469d 100644
--- a/src/cats/bdb_sqlite.h
+++ b/src/cats/bdb_sqlite.h
@@ -1,22 +1,28 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2009-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
-#ifndef __BDB_SQLITE_H_
-#define __BDB_SQLITE_H_ 1
 
-class B_DB_SQLITE: public B_DB_PRIV {
+/* SQLite driver specific definitions */
+
+#ifdef __BDB_SQLITE_H_
+
+class BDB_SQLITE: public BDB {
 private:
    struct sqlite3 *m_db_handle;
    char **m_result;             /* sql_store_results() and sql_query() */
@@ -25,11 +31,8 @@ private:
    SQL_FIELD m_sql_field;       /* used when using db_sql_query() and sql_fetch_field() */
 
 public:
-   B_DB_SQLITE(JCR *jcr, const char *db_driver, const char *db_name,
-               const char *db_user, const char *db_password,
-               const char *db_address, int db_port, const char *db_socket,
-               bool mult_db_connections, bool disable_batch_insert);
-   ~B_DB_SQLITE();
+   BDB_SQLITE();
+   ~BDB_SQLITE();
 
    /* Used internaly by sqlite.c to access fields in db_sql_query() */
    void set_column_names(char **res, int nb) {
@@ -38,17 +41,17 @@ public:
       m_field_number = 0;
    }
 
-   /* low level operations */
-   bool db_open_database(JCR *jcr);
-   void db_close_database(JCR *jcr);
-   void db_thread_cleanup(void);
-   void db_escape_string(JCR *jcr, char *snew, char *old, int len);
-   char *db_escape_object(JCR *jcr, char *old, int len);
-   void db_unescape_object(JCR *jcr, char *from, int32_t expected_len,
+   /* Functions that we override */
+   bool bdb_open_database(JCR *jcr);
+   void bdb_close_database(JCR *jcr);
+   void bdb_thread_cleanup(void);
+   void bdb_escape_string(JCR *jcr, char *snew, char *old, int len);
+   char *bdb_escape_object(JCR *jcr, char *old, int len);
+   void bdb_unescape_object(JCR *jcr, char *from, int32_t expected_len,
                            POOLMEM **dest, int32_t *len);
-   void db_start_transaction(JCR *jcr);
-   void db_end_transaction(JCR *jcr);
-   bool db_sql_query(const char *query, DB_RESULT_HANDLER *result_handler, void *ctx);
+   void bdb_start_transaction(JCR *jcr);
+   void bdb_end_transaction(JCR *jcr);
+   bool bdb_sql_query(const char *query, DB_RESULT_HANDLER *result_handler, void *ctx);
    void sql_free_result(void);
    SQL_ROW sql_fetch_row(void);
    bool sql_query(const char *query, int flags=0);
diff --git a/src/cats/bvfs.c b/src/cats/bvfs.c
index 460f683..d73a49b 100644
--- a/src/cats/bvfs.c
+++ b/src/cats/bvfs.c
@@ -1,31 +1,31 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2009-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 
 #include "bacula.h"
-
+#include "cats.h" 
 #if HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL
-
-#include "cats.h"
-#include "bdb_priv.h"
-#include "sql_glue.h"
 #include "lib/htable.h"
 #include "bvfs.h"
 
-#define dbglevel 10
-#define dbglevel_sql 15
+#define dbglevel      DT_BVFS|10
+#define dbglevel_sql  DT_SQL|15
 
 static int result_handler(void *ctx, int fields, char **row)
 {
@@ -45,7 +45,7 @@ static int result_handler(void *ctx, int fields, char **row)
    return 0;
 }
 
-Bvfs::Bvfs(JCR *j, B_DB *mdb) {
+Bvfs::Bvfs(JCR *j, BDB *mdb) {
    jcr = j;
    jcr->inc_use_count();
    db = mdb;                 /* need to inc ref count */
@@ -101,7 +101,7 @@ char *Bvfs::escape_list(alist *lst)
          tmp = check_pool_memory_size(tmp, 2 * len + 2 + 2);
 
          tmp[0] = '\'';
-         db_escape_string(jcr, db, tmp + 1 , elt, len);
+         db->bdb_escape_string(jcr, tmp + 1 , elt, len);
          pm_strcat(tmp, "'");
 
          if (*escaped_list) {
@@ -171,7 +171,7 @@ void Bvfs::filter_jobid()
 
    db_list_ctx ctx;
    Dmsg1(dbglevel_sql, "q=%s\n", query.c_str());
-   db_sql_query(db, query.c_str(), db_list_handler, &ctx);
+   db->bdb_sql_query(query.c_str(), db_list_handler, &ctx);
    pm_strcpy(jobids, ctx.list);
 }
 
@@ -310,7 +310,7 @@ char *bvfs_basename_dir(char *path)
    return p;
 }
 
-static void build_path_hierarchy(JCR *jcr, B_DB *mdb,
+static void build_path_hierarchy(JCR *jcr, BDB *mdb,
                                  pathid_cache &ppathid_cache,
                                  char *org_pathid, char *path)
 {
@@ -333,12 +333,12 @@ static void build_path_hierarchy(JCR *jcr, B_DB *mdb,
               "SELECT PPathId FROM PathHierarchy WHERE PathId = %s",
               pathid);
 
-         if (!QUERY_DB(jcr, mdb, mdb->cmd)) {
+         if (!mdb->QueryDB(jcr, mdb->cmd)) {
             goto bail_out;      /* Query failed, just leave */
          }
 
          /* Do we have a result ? */
-         if (sql_num_rows(mdb) > 0) {
+         if (mdb->sql_num_rows() > 0) {
             ppathid_cache.insert(pathid);
             /* This dir was in the db ...
              * It means we can leave, the tree has allready been built for
@@ -349,7 +349,7 @@ static void build_path_hierarchy(JCR *jcr, B_DB *mdb,
             /* search or create parent PathId in Path table */
             mdb->path = bvfs_parent_dir(path);
             mdb->pnl = strlen(mdb->path);
-            if (!db_create_path_record(jcr, mdb, &parent)) {
+            if (!mdb->bdb_create_path_record(jcr, &parent)) {
                goto bail_out;
             }
             ppathid_cache.insert(pathid);
@@ -359,7 +359,7 @@ static void build_path_hierarchy(JCR *jcr, B_DB *mdb,
                  "VALUES (%s,%lld)",
                  pathid, (uint64_t) parent.PathId);
 
-            if (!INSERT_DB(jcr, mdb, mdb->cmd)) {
+            if (!mdb->InsertDB(jcr, mdb->cmd)) {
                goto bail_out;   /* Can't insert the record, just leave */
             }
 
@@ -385,22 +385,28 @@ bail_out:
  *        OK    1
  */
 static int update_path_hierarchy_cache(JCR *jcr,
-                                        B_DB *mdb,
+                                        BDB *mdb,
                                         pathid_cache &ppathid_cache,
                                         JobId_t JobId)
 {
    Dmsg0(dbglevel, "update_path_hierarchy_cache()\n");
-   int ret=0;
+   uint32_t ret=0;
    uint32_t num;
    char jobid[50];
    edit_uint64(JobId, jobid);
 
-   db_lock(mdb);
-   db_start_transaction(jcr, mdb);
+   mdb->bdb_lock();
+
+   /* We don't really want to harm users with spurious messages,
+    * everything is handled by transaction
+    */
+   mdb->set_use_fatal_jmsg(false);
+
+   mdb->bdb_start_transaction(jcr);
 
    Mmsg(mdb->cmd, "SELECT 1 FROM Job WHERE JobId = %s AND HasCache=1", jobid);
 
-   if (!QUERY_DB(jcr, mdb, mdb->cmd) || sql_num_rows(mdb) > 0) {
+   if (!mdb->QueryDB(jcr, mdb->cmd) || mdb->sql_num_rows() > 0) {
       Dmsg1(dbglevel, "already computed %d\n", (uint32_t)JobId );
       ret = 1;
       goto bail_out;
@@ -416,7 +422,7 @@ static int update_path_hierarchy_cache(JCR *jcr,
                             "WHERE BaseFiles.JobId = %s) AS B",
         jobid, jobid);
 
-   if (!QUERY_DB(jcr, mdb, mdb->cmd)) {
+   if (!mdb->QueryDB(jcr, mdb->cmd)) {
       Dmsg1(dbglevel, "Can't fill PathVisibility %d\n", (uint32_t)JobId );
       goto bail_out;
    }
@@ -436,7 +442,7 @@ static int update_path_hierarchy_cache(JCR *jcr,
       "ORDER BY Path", jobid);
    Dmsg1(dbglevel_sql, "q=%s\n", mdb->cmd);
 
-   if (!QUERY_DB(jcr, mdb, mdb->cmd)) {
+   if (!mdb->QueryDB(jcr, mdb->cmd)) {
       Dmsg1(dbglevel, "Can't get new Path %d\n", (uint32_t)JobId );
       goto bail_out;
    }
@@ -445,13 +451,13 @@ static int update_path_hierarchy_cache(JCR *jcr,
     * So, now i'm copying the result in memory to be able to query the
     * catalog descriptor again.
     */
-   num = sql_num_rows(mdb);
+   num = mdb->sql_num_rows();
    if (num > 0) {
       char **result = (char **)malloc (num * 2 * sizeof(char *));
 
       SQL_ROW row;
       int i=0;
-      while((row = sql_fetch_row(mdb))) {
+      while((row = mdb->sql_fetch_row())) {
          result[i++] = bstrdup(row[0]);
          result[i++] = bstrdup(row[1]);
       }
@@ -466,7 +472,7 @@ static int update_path_hierarchy_cache(JCR *jcr,
       free(result);
    }
 
-   if (mdb->db_get_type_index() == SQL_TYPE_SQLITE3) {
+   if (mdb->bdb_get_type_index() == SQL_TYPE_SQLITE3) {
       Mmsg(mdb->cmd,
  "INSERT INTO PathVisibility (PathId, JobId) "
    "SELECT DISTINCT h.PPathId AS PathId, %s "
@@ -491,19 +497,28 @@ static int update_path_hierarchy_cache(JCR *jcr,
    }
 
    do {
-      ret = QUERY_DB(jcr, mdb, mdb->cmd);
-   } while (ret && sql_affected_rows(mdb) > 0);
+      ret = mdb->QueryDB(jcr, mdb->cmd);
+   } while (ret && mdb->sql_affected_rows() > 0);
 
    Mmsg(mdb->cmd, "UPDATE Job SET HasCache=1 WHERE JobId=%s", jobid);
-   UPDATE_DB(jcr, mdb, mdb->cmd);
+   ret = mdb->UpdateDB(jcr, mdb->cmd);
 
 bail_out:
-   db_end_transaction(jcr, mdb);
-   db_unlock(mdb);
+   mdb->bdb_end_transaction(jcr);
+
+   if (!ret) {
+      Mmsg(mdb->cmd, "SELECT HasCache FROM Job WHERE JobId=%s", jobid);
+      mdb->bdb_sql_query(mdb->cmd, db_int_handler, &ret);
+   }
+
+   /* Enable back the FATAL message if something is wrong */
+   mdb->set_use_fatal_jmsg(true);
+
+   mdb->bdb_unlock();
    return ret;
 }
 
-/*
+/* 
  * Find an store the filename descriptor for empty directories Filename.Name=''
  */
 DBId_t Bvfs::get_dir_filenameid()
@@ -530,21 +545,30 @@ void Bvfs::fv_update_cache()
       return;                   /* Nothing to build */
    }
 
-   db_lock(db);
-   db_start_transaction(jcr, db);
+   db->bdb_lock();
+   /* We don't really want to harm users with spurious messages,
+    * everything is handled by transaction
+    */
+   db->set_use_fatal_jmsg(false);
+
+   db->bdb_start_transaction(jcr);
 
    pathid = get_root();
 
    fv_compute_size_and_count(pathid, &size, &count);
 
-   db_end_transaction(jcr, db);
-   db_unlock(db);
+   db->bdb_end_transaction(jcr);
+
+   /* Enable back the FATAL message if something is wrong */
+   db->set_use_fatal_jmsg(true);
+
+   db->bdb_unlock();
 }
 
 /* Not yet working */
 void Bvfs::fv_get_big_files(int64_t pathid, int64_t min_size, int32_t limit)
 {
-   Mmsg(db->cmd,
+   Mmsg(db->cmd, 
         "SELECT FilenameId AS filenameid, Name AS name, size "
           "FROM ( "
          "SELECT FilenameId, base64_decode_lstat(8,LStat) AS size "
@@ -570,11 +594,11 @@ void Bvfs::fv_get_current_size_and_count(int64_t pathid, int64_t *size, int64_t
  " WHERE PathId = %lld "
    " AND JobId = %s ", pathid, jobids);
 
-   if (!QUERY_DB(jcr, db, db->cmd)) {
+   if (!db->QueryDB(jcr, db->cmd)) {
       return;
    }
 
-   if ((row = sql_fetch_row(db))) {
+   if ((row = db->sql_fetch_row())) {
       *size = str_to_int64(row[0]);
       *count =  str_to_int64(row[1]);
    }
@@ -593,11 +617,11 @@ void Bvfs::fv_get_size_and_count(int64_t pathid, int64_t *size, int64_t *count)
  " WHERE PathId = %lld "
    " AND JobId = %s ", pathid, jobids);
 
-   if (!QUERY_DB(jcr, db, db->cmd)) {
+   if (!db->QueryDB(jcr, db->cmd)) {
       return;
    }
 
-   if ((row = sql_fetch_row(db))) {
+   if ((row = db->sql_fetch_row())) {
       *size = str_to_int64(row[0]);
       *count =  str_to_int64(row[1]);
    }
@@ -623,15 +647,15 @@ void Bvfs::fv_compute_size_and_count(int64_t pathid, int64_t *size, int64_t *cou
          " WHERE PPathId  = %lld "
            " AND JobId = %s ", pathid, jobids);
 
-   QUERY_DB(jcr, db, db->cmd);
-   int num = sql_num_rows(db);
+   db->QueryDB(jcr, db->cmd);
+   int num = db->sql_num_rows();
 
    if (num > 0) {
       int64_t *result = (int64_t *)malloc (num * sizeof(int64_t));
       SQL_ROW row;
       int i=0;
 
-      while((row = sql_fetch_row(db))) {
+      while((row = db->sql_fetch_row())) {
          result[i++] = str_to_int64(row[0]); /* PathId */
       }
 
@@ -658,23 +682,23 @@ void Bvfs::fv_update_size_and_count(int64_t pathid, int64_t size, int64_t count)
         " WHERE JobId = %s "
         " AND PathId = %lld ", count, size, jobids, pathid);
 
-   UPDATE_DB(jcr, db, db->cmd);
+   db->UpdateDB(jcr, db->cmd);
 }
 
-void bvfs_update_cache(JCR *jcr, B_DB *mdb)
+void bvfs_update_cache(JCR *jcr, BDB *mdb)
 {
    uint32_t nb=0;
    db_list_ctx jobids_list;
 
-   db_lock(mdb);
+   mdb->bdb_lock();
 
 #ifdef xxx
    /* TODO: Remove this code when updating make_bacula_table script */
    Mmsg(mdb->cmd, "SELECT 1 FROM Job WHERE HasCache<>2 LIMIT 1");
-   if (!QUERY_DB(jcr, mdb, mdb->cmd)) {
+   if (!mdb->QueryDB(jcr, mdb->cmd)) {
       Dmsg0(dbglevel, "Creating cache table\n");
       Mmsg(mdb->cmd, "ALTER TABLE Job ADD HasCache int DEFAULT 0");
-      QUERY_DB(jcr, mdb, mdb->cmd);
+      mdb->QueryDB(jcr, mdb->cmd);
 
       Mmsg(mdb->cmd,
            "CREATE TABLE PathHierarchy ( "
@@ -682,12 +706,12 @@ void bvfs_update_cache(JCR *jcr, B_DB *mdb)
            "PPathId integer NOT NULL, "
            "CONSTRAINT pathhierarchy_pkey "
            "PRIMARY KEY (PathId))");
-      QUERY_DB(jcr, mdb, mdb->cmd);
+      mdb->QueryDB(jcr, mdb->cmd);
 
       Mmsg(mdb->cmd,
            "CREATE INDEX pathhierarchy_ppathid "
            "ON PathHierarchy (PPathId)");
-      QUERY_DB(jcr, mdb, mdb->cmd);
+      mdb->QueryDB(jcr, mdb->cmd);
 
       Mmsg(mdb->cmd,
            "CREATE TABLE PathVisibility ("
@@ -697,12 +721,12 @@ void bvfs_update_cache(JCR *jcr, B_DB *mdb)
            "Files int4 DEFAULT 0, "
            "CONSTRAINT pathvisibility_pkey "
            "PRIMARY KEY (JobId, PathId))");
-      QUERY_DB(jcr, mdb, mdb->cmd);
+      mdb->QueryDB(jcr, mdb->cmd);
 
       Mmsg(mdb->cmd,
            "CREATE INDEX pathvisibility_jobid "
            "ON PathVisibility (JobId)");
-      QUERY_DB(jcr, mdb, mdb->cmd);
+      mdb->QueryDB(jcr, mdb->cmd);
 
    }
 #endif
@@ -713,28 +737,28 @@ void bvfs_update_cache(JCR *jcr, B_DB *mdb)
     "AND Type IN ('B') AND JobStatus IN ('T', 'f', 'A') "
   "ORDER BY JobId");
 
-   db_sql_query(mdb, mdb->cmd, db_list_handler, &jobids_list);
+   mdb->bdb_sql_query(mdb->cmd, db_list_handler, &jobids_list);
 
    bvfs_update_path_hierarchy_cache(jcr, mdb, jobids_list.list);
 
-   db_start_transaction(jcr, mdb);
+   mdb->bdb_start_transaction(jcr);
    Dmsg0(dbglevel, "Cleaning pathvisibility\n");
    Mmsg(mdb->cmd,
         "DELETE FROM PathVisibility "
          "WHERE NOT EXISTS "
         "(SELECT 1 FROM Job WHERE JobId=PathVisibility.JobId)");
-   nb = DELETE_DB(jcr, mdb, mdb->cmd);
+   nb = mdb->DeleteDB(jcr, mdb->cmd);
    Dmsg1(dbglevel, "Affected row(s) = %d\n", nb);
 
-   db_end_transaction(jcr, mdb);
-   db_unlock(mdb);
+   mdb->bdb_end_transaction(jcr);
+   mdb->bdb_unlock();
 }
 
 /*
  * Update the bvfs cache for given jobids (1,2,3,4)
  */
 int
-bvfs_update_path_hierarchy_cache(JCR *jcr, B_DB *mdb, char *jobids)
+bvfs_update_path_hierarchy_cache(JCR *jcr, BDB *mdb, char *jobids)
 {
    pathid_cache ppathid_cache;
    JobId_t JobId;
@@ -744,7 +768,8 @@ bvfs_update_path_hierarchy_cache(JCR *jcr, B_DB *mdb, char *jobids)
    for (p=jobids; ; ) {
       int stat = get_next_jobid_from_list(&p, &JobId);
       if (stat < 0) {
-         return 0;
+         ret = 0;
+         break;
       }
       if (stat == 0) {
          break;
@@ -761,7 +786,7 @@ bvfs_update_path_hierarchy_cache(JCR *jcr, B_DB *mdb, char *jobids)
  * Update the bvfs fileview for given jobids
  */
 void
-bvfs_update_fv_cache(JCR *jcr, B_DB *mdb, char *jobids)
+bvfs_update_fv_cache(JCR *jcr, BDB *mdb, char *jobids)
 {
    char *p;
    JobId_t JobId;
@@ -796,9 +821,9 @@ bool Bvfs::ch_dir(const char *path)
 {
    pm_strcpy(db->path, path);
    db->pnl = strlen(db->path);
-   db_lock(db);
-   ch_dir(db_get_path_record(jcr, db));
-   db_unlock(db);
+   db->bdb_lock();
+   ch_dir(db->bdb_get_path_record(jcr));
+   db->bdb_unlock();
    return pwd_id != 0;
 }
 
@@ -806,7 +831,7 @@ bool Bvfs::ch_dir(const char *path)
  * Get all file versions for a specified client
  * TODO: Handle basejobs using different client
  */
-void Bvfs::get_all_file_versions(DBId_t pathid, DBId_t fnid, const char *client)
+void Bvfs::get_all_file_versions(DBId_t pathid, FileId_t fnid, const char *client)
 {
    Dmsg3(dbglevel, "get_all_file_versions(%lld, %lld, %s)\n", (uint64_t)pathid,
          (uint64_t)fnid, client);
@@ -820,7 +845,7 @@ void Bvfs::get_all_file_versions(DBId_t pathid, DBId_t fnid, const char *client)
 
    POOL_MEM query;
 
-   Mmsg(query,//    1           2              3
+   Mmsg(query,//    1           2              3       
 "SELECT 'V', File.PathId, File.FilenameId,  File.Md5, "
 //         4          5           6
         "File.JobId, File.LStat, File.FileId, "
@@ -840,13 +865,13 @@ void Bvfs::get_all_file_versions(DBId_t pathid, DBId_t fnid, const char *client)
         ,edit_uint64(fnid, ed1), edit_uint64(pathid, ed2), client, q.c_str(),
         limit, offset);
    Dmsg1(dbglevel_sql, "q=%s\n", query.c_str());
-   db_sql_query(db, query.c_str(), list_entries, user_data);
+   db->bdb_sql_query(query.c_str(), list_entries, user_data);
 }
 
 /*
  * Get all volumes for a specific file
  */
-void Bvfs::get_volumes(DBId_t  fileid)
+void Bvfs::get_volumes(FileId_t fileid)
 {
    Dmsg1(dbglevel, "get_volumes(%lld)\n", (uint64_t)fileid);
 
@@ -854,25 +879,25 @@ void Bvfs::get_volumes(DBId_t  fileid)
    POOL_MEM query;
 
    Mmsg(query,
-//                          7                8
-"SELECT 'L',0,0,0,0,0,0, Media.VolumeName, Media.InChanger "
+//                                   7                8
+"SELECT DISTINCT 'L',0,0,0,0,0,0, Media.VolumeName, Media.InChanger "
 "FROM File JOIN JobMedia USING (JobId) JOIN Media USING (MediaId) "
 "WHERE File.FileId = %s "
   "AND File.FileIndex >= JobMedia.FirstIndex "
   "AND File.FileIndex <= JobMedia.LastIndex "
-  " ORDER BY JobMediaId LIMIT %d OFFSET %d"
+  " LIMIT %d OFFSET %d"
         ,edit_uint64(fileid, ed1), limit, offset);
    Dmsg1(dbglevel_sql, "q=%s\n", query.c_str());
-   db_sql_query(db, query.c_str(), list_entries, user_data);
+   db->bdb_sql_query(query.c_str(), list_entries, user_data);
 }
 
 DBId_t Bvfs::get_root()
 {
    int p;
    *db->path = 0;
-   db_lock(db);
-   p = db_get_path_record(jcr, db);
-   db_unlock(db);
+   db->bdb_lock();
+   p = db->bdb_get_path_record(jcr);
+   db->bdb_unlock();
    return p;
 }
 
@@ -933,7 +958,7 @@ void Bvfs::ls_special_dirs()
         query.c_str(), edit_uint64(dir_filenameid, ed2), jobids);
 
    Dmsg1(dbglevel_sql, "q=%s\n", query2.c_str());
-   db_sql_query(db, query2.c_str(), path_handler, this);
+   db->bdb_sql_query(query2.c_str(), path_handler, this);
 }
 
 /* Returns true if we have dirs to read */
@@ -949,7 +974,7 @@ bool Bvfs::ls_dirs()
    POOL_MEM filter;
    if (*pattern) {
       Mmsg(filter, " AND Path2.Path %s '%s' ",
-           match_query[db_get_type_index(db)], pattern);
+           match_query[db->bdb_get_type_index()], pattern);
 
    }
 
@@ -1002,24 +1027,24 @@ bool Bvfs::ls_dirs()
 
    Dmsg1(dbglevel_sql, "q=%s\n", query.c_str());
 
-   db_lock(db);
-   db_sql_query(db, query.c_str(), path_handler, this);
-   nb_record = sql_num_rows(db);
-   db_unlock(db);
+   db->bdb_lock();
+   db->bdb_sql_query(query.c_str(), path_handler, this);
+   nb_record = db->sql_num_rows();
+   db->bdb_unlock();
 
    return nb_record == limit;
 }
 
-void build_ls_files_query(B_DB *db, POOL_MEM &query,
+void build_ls_files_query(BDB *db, POOL_MEM &query,
                           const char *JobId, const char *PathId,
                           const char *filter, int64_t limit, int64_t offset)
 {
-   if (db_get_type_index(db) == SQL_TYPE_POSTGRESQL) {
-      Mmsg(query, sql_bvfs_list_files[db_get_type_index(db)],
+   if (db->bdb_get_type_index() == SQL_TYPE_POSTGRESQL) {
+      Mmsg(query, sql_bvfs_list_files[db->bdb_get_type_index()],
            JobId, PathId, JobId, PathId,
            filter, limit, offset);
    } else {
-      Mmsg(query, sql_bvfs_list_files[db_get_type_index(db)],
+      Mmsg(query, sql_bvfs_list_files[db->bdb_get_type_index()],
            JobId, PathId, JobId, PathId,
            limit, offset, filter, JobId, JobId);
    }
@@ -1043,7 +1068,7 @@ bool Bvfs::ls_files()
 
    edit_uint64(pwd_id, pathid);
    if (*pattern) {
-      Mmsg(filter, " AND Filename.Name %s '%s' ",
+      Mmsg(filter, " AND Filename.Name %s '%s' ", 
            match_query[db_get_type_index(db)], pattern);
 
    } else if (*filename) {
@@ -1056,10 +1081,10 @@ bool Bvfs::ls_files()
 
    Dmsg1(dbglevel_sql, "q=%s\n", query.c_str());
 
-   db_lock(db);
-   db_sql_query(db, query.c_str(), list_entries, user_data);
-   nb_record = sql_num_rows(db);
-   db_unlock(db);
+   db->bdb_lock();
+   db->bdb_sql_query(query.c_str(), list_entries, user_data);
+   nb_record = db->sql_num_rows();
+   db->bdb_unlock();
 
    return nb_record == limit;
 }
@@ -1121,11 +1146,11 @@ static bool check_temp(char *output_table)
 
 void Bvfs::clear_cache()
 {
-   db_sql_query(db, "BEGIN",                     NULL, NULL);
-   db_sql_query(db, "UPDATE Job SET HasCache=0", NULL, NULL);
-   db_sql_query(db, "TRUNCATE PathHierarchy",    NULL, NULL);
-   db_sql_query(db, "TRUNCATE PathVisibility",   NULL, NULL);
-   db_sql_query(db, "COMMIT",                    NULL, NULL);
+   db->bdb_sql_query("BEGIN",                     NULL, NULL);
+   db->bdb_sql_query("UPDATE Job SET HasCache=0", NULL, NULL);
+   db->bdb_sql_query("TRUNCATE PathHierarchy",    NULL, NULL);
+   db->bdb_sql_query("TRUNCATE PathVisibility",   NULL, NULL);
+   db->bdb_sql_query("COMMIT",                    NULL, NULL);
 }
 
 bool Bvfs::drop_restore_list(char *output_table)
@@ -1133,7 +1158,7 @@ bool Bvfs::drop_restore_list(char *output_table)
    POOL_MEM query;
    if (check_temp(output_table)) {
       Mmsg(query, "DROP TABLE %s", output_table);
-      db_sql_query(db, query.c_str(), NULL, NULL);
+      db->bdb_sql_query(query.c_str(), NULL, NULL);
       return true;
    }
    return false;
@@ -1145,6 +1170,7 @@ bool Bvfs::compute_restore_list(char *fileid, char *dirid, char *hardlink,
    POOL_MEM query;
    POOL_MEM tmp, tmp2;
    int64_t id, jobid, prev_jobid;
+   int num;
    bool init=false;
    bool ret=false;
    /* check args */
@@ -1159,14 +1185,14 @@ bool Bvfs::compute_restore_list(char *fileid, char *dirid, char *hardlink,
       return false;
    }
 
-   db_lock(db);
+   db->bdb_lock();
 
    /* Cleanup old tables first */
    Mmsg(query, "DROP TABLE btemp%s", output_table);
-   db_sql_query(db, query.c_str());
+   db->bdb_sql_query(query.c_str());
 
    Mmsg(query, "DROP TABLE %s", output_table);
-   db_sql_query(db, query.c_str());
+   db->bdb_sql_query(query.c_str());
 
    Mmsg(query, "CREATE TABLE btemp%s AS ", output_table);
 
@@ -1183,7 +1209,7 @@ bool Bvfs::compute_restore_list(char *fileid, char *dirid, char *hardlink,
    while (get_next_id_from_list(&dirid, &id) == 1) {
       Mmsg(tmp, "SELECT Path FROM Path WHERE PathId=%lld", id);
 
-      if (!db_sql_query(db, tmp.c_str(), get_path_handler, (void *)&tmp2)) {
+      if (!db->bdb_sql_query(tmp.c_str(), get_path_handler, (void *)&tmp2)) {
          Dmsg0(dbglevel, "Can't search for path\n");
          /* print error */
          goto bail_out;
@@ -1209,7 +1235,7 @@ bool Bvfs::compute_restore_list(char *fileid, char *dirid, char *hardlink,
 
       size_t len = strlen(tmp.c_str());
       tmp2.check_size((len+1) * 2);
-      db_escape_string(jcr, db, tmp2.c_str(), tmp.c_str(), len);
+      db->bdb_escape_string(jcr, tmp2.c_str(), tmp.c_str(), len);
 
       if (init) {
          query.strcat(" UNION ");
@@ -1271,41 +1297,135 @@ bool Bvfs::compute_restore_list(char *fileid, char *dirid, char *hardlink,
       init = true;
    }
 
-   Dmsg1(dbglevel_sql, "q=%s\n", query.c_str());
+   Dmsg1(dbglevel_sql, "query=%s\n", query.c_str());
 
-   if (!db_sql_query(db, query.c_str(), NULL, NULL)) {
-      Dmsg0(dbglevel, "Can't execute q\n");
+   if (!db->bdb_sql_query(query.c_str(), NULL, NULL)) {
+      Dmsg1(dbglevel, "Can't execute query=%s\n", query.c_str());
       goto bail_out;
    }
 
-   Mmsg(query, sql_bvfs_select[db_get_type_index(db)],
+   Mmsg(query, sql_bvfs_select[db->bdb_get_type_index()],
         output_table, output_table, output_table);
 
    /* TODO: handle jobid filter */
-   Dmsg1(dbglevel_sql, "q=%s\n", query.c_str());
-   if (!db_sql_query(db, query.c_str(), NULL, NULL)) {
-      Dmsg0(dbglevel, "Can't execute q\n");
+   Dmsg1(dbglevel_sql, "query=%s\n", query.c_str());
+   if (!db->bdb_sql_query(query.c_str(), NULL, NULL)) {
+      Dmsg1(dbglevel, "Can't execute query=%s\n", query.c_str());
       goto bail_out;
    }
 
-   /* MySQL need it */
-   if (db_get_type_index(db) == SQL_TYPE_MYSQL) {
+   /* MySQL needs the index */
+   if (db->bdb_get_type_index() == SQL_TYPE_MYSQL) {
       Mmsg(query, "CREATE INDEX idx_%s ON %s (JobId)",
            output_table, output_table);
-      Dmsg1(dbglevel_sql, "q=%s\n", query.c_str());
-      if (!db_sql_query(db, query.c_str(), NULL, NULL)) {
-         Dmsg0(dbglevel, "Can't execute q\n");
-         goto bail_out;
+      Dmsg1(dbglevel_sql, "query=%s\n", query.c_str());
+      if (!db->bdb_sql_query(query.c_str(), NULL, NULL)) {
+         Dmsg1(dbglevel, "Can't execute query=%s\n", query.c_str());
+         goto bail_out; 
+      } 
+   }
+
+   /* Check if some FileId have DeltaSeq > 0
+    * Foreach of them we need to get the accurate_job list, and compute
+    * what are dependencies
+    */
+   Mmsg(query, 
+        "SELECT F.FileId, F.JobId, F.FilenameId, F.PathId, F.DeltaSeq "
+          "FROM File AS F JOIN Job USING (JobId) JOIN %s USING (FileId) "
+         "WHERE DeltaSeq > 0", output_table);
+
+   if (!db->QueryDB(jcr, query.c_str())) {
+      Dmsg1(dbglevel_sql, "Can't execute query=%s\n", query.c_str());
+   }
+
+   /* TODO: Use an other DB connection can avoid to copy the result of the
+    * previous query into a temporary buffer
+    */
+   num = db->sql_num_rows();
+   Dmsg2(dbglevel, "Found %d Delta parts in restore selection q=%s\n", num, query.c_str());
+
+   if (num > 0) {
+      int64_t *result = (int64_t *)malloc (num * 4 * sizeof(int64_t));
+      SQL_ROW row;
+      int i=0;
+
+      while((row = db->sql_fetch_row())) {
+         result[i++] = str_to_int64(row[0]); /* FileId */
+         result[i++] = str_to_int64(row[1]); /* JobId */
+         result[i++] = str_to_int64(row[2]); /* FilenameId */
+         result[i++] = str_to_int64(row[3]); /* PathId */
       }
+
+      i=0;
+      while (num > 0) {
+         insert_missing_delta(output_table, result + i);
+         i += 4;
+         num--;
+      }
+      free(result);
    }
 
    ret = true;
 
 bail_out:
    Mmsg(query, "DROP TABLE btemp%s", output_table);
-   db_sql_query(db, query.c_str(), NULL, NULL);
-   db_unlock(db);
+   db->bdb_sql_query(query.c_str(), NULL, NULL);
+   db->bdb_unlock();
    return ret;
 }
+ 
+void Bvfs::insert_missing_delta(char *output_table, int64_t *res)
+{
+   char ed1[50], ed2[50];
+   db_list_ctx lst;
+   POOL_MEM query;
+   JOB_DBR jr, jr2;
+   memset(&jr, 0, sizeof(jr));
+   memset(&jr2, 0, sizeof(jr2));
+
+   /* Need to limit the query to StartTime, Client/Fileset */
+   jr2.JobId = res[1];
+   db->bdb_get_job_record(jcr, &jr2);
+
+   jr.JobId = res[1];
+   jr.ClientId = jr2.ClientId;
+   jr.FileSetId = jr2.FileSetId;
+   jr.JobLevel = L_INCREMENTAL;
+   jr.StartTime = jr2.StartTime;
+
+   /* Get accurate jobid list */
+   db->bdb_get_accurate_jobids(jcr, &jr, &lst);
+
+   Dmsg2(dbglevel_sql, "JobId list for %lld is %s\n", res[0], lst.list);
+
+   /* The list contains already the last DeltaSeq element, so
+    * we don't need to select it in the next query
+    */
+   for (int l = strlen(lst.list); l > 0; l--) {
+      if (lst.list[l] == ',') {
+         lst.list[l] = '\0';
+         break;
+      }
+   }
+
+   Dmsg1(dbglevel_sql, "JobId list after strip is %s\n", lst.list);
+
+   edit_int64(res[2], ed1);     /* fnid */
+   edit_int64(res[3], ed2);     /* pathid */
+
+   int id=db->bdb_get_type_index();
+   Mmsg(query, bvfs_select_delta_version_with_basejob_and_delta[id],
+        lst.list, ed1, ed2, 
+        lst.list, ed1, ed2, 
+        lst.list, lst.list);
+
+   Mmsg(db->cmd, "INSERT INTO %s "
+                   "SELECT JobId, FileIndex, FileId FROM (%s) AS F1",
+        output_table, query.c_str());
+
+   if (!db->bdb_sql_query(db->cmd, NULL, NULL)) {
+      Dmsg1(dbglevel_sql, "Can't exec q=%s\n", db->cmd);
+   }
+}
 
 #endif /* HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL */
diff --git a/src/cats/bvfs.h b/src/cats/bvfs.h
index d5532f4..7f792ac 100644
--- a/src/cats/bvfs.h
+++ b/src/cats/bvfs.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 
 
@@ -40,7 +44,7 @@ typedef enum {
 
 typedef enum {
    BVFS_Type    = 0,            /* Could be D, F, V, L */
-   BVFS_PathId  = 1,
+   BVFS_PathId  = 1, 
    BVFS_FilenameId = 2,
 
    BVFS_Name    = 3,
@@ -58,7 +62,7 @@ typedef enum {
 class Bvfs {
 
 public:
-   Bvfs(JCR *j, B_DB *mdb);
+   Bvfs(JCR *j, BDB *mdb);
    virtual ~Bvfs();
 
    void set_jobid(JobId_t id);
@@ -79,13 +83,13 @@ public:
    void set_pattern(char *p) {
       uint32_t len = strlen(p);
       pattern = check_pool_memory_size(pattern, len*2+1);
-      db_escape_string(jcr, db, pattern, p, len);
+      db->bdb_escape_string(jcr, pattern, p, len);
    }
 
    void set_filename(char *p) {
       uint32_t len = strlen(p);
       filename = check_pool_memory_size(filename, len*2+1);
-      db_escape_string(jcr, db, filename, p, len);
+      db->bdb_escape_string(jcr, filename, p, len);
    }
 
    /* Get the root point */
@@ -107,7 +111,7 @@ public:
    bool ls_files();             /* Returns true if we have more files to read */
    bool ls_dirs();              /* Returns true if we have more dir to read */
    void ls_special_dirs();      /* get . and .. */
-   void get_all_file_versions(DBId_t pathid, DBId_t fnid, const char *client);
+   void get_all_file_versions(DBId_t pathid, FileId_t fnid, const char *client);
 
    void update_cache();
 
@@ -195,16 +199,17 @@ public:
    int _handle_path(void *, int, char **);
 
    /* Handle Delta parts if any */
+   void insert_missing_delta(char *output_table, int64_t *res);
 
    /* Get a list of volumes */
-   void get_volumes(DBId_t fileid);
+   void get_volumes(FileId_t fileid);
 
 private:
    Bvfs(const Bvfs &);               /* prohibit pass by value */
    Bvfs & operator = (const Bvfs &); /* prohibit class assignment */
 
    JCR *jcr;
-   B_DB *db;
+   BDB *db;
    POOLMEM *jobids;
    char *username;              /* Used with Bweb */
 
@@ -250,11 +255,10 @@ private:
 #define bvfs_is_version(row) ((row)[BVFS_Type][0] == BVFS_FILE_VERSION)
 #define bvfs_is_volume_list(row) ((row)[BVFS_Type][0] == BVFS_VOLUME_LIST)
 
-void bvfs_update_fv_cache(JCR *jcr, B_DB *mdb, char *jobids);
-int bvfs_update_path_hierarchy_cache(JCR *jcr, B_DB *mdb, char *jobids);
-void bvfs_update_cache(JCR *jcr, B_DB *mdb);
+void bvfs_update_fv_cache(JCR *jcr, BDB *mdb, char *jobids);
+int bvfs_update_path_hierarchy_cache(JCR *jcr, BDB *mdb, char *jobids);
+void bvfs_update_cache(JCR *jcr, BDB *mdb);
 char *bvfs_parent_dir(char *path);
-extern const char *bvfs_select_delta_version_with_basejob_and_delta[];
 
 /* Return the basename of the with the trailing /  (update the given string)
  * TODO: see in the rest of bacula if we don't have
diff --git a/src/cats/cats.c b/src/cats/cats.c
index c3c26df..4d189d0 100644
--- a/src/cats/cats.c
+++ b/src/cats/cats.c
@@ -1,134 +1,150 @@
-/*
-   Bacula® - The Network Backup Solution
+/* 
+   Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2011-2014 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
-/*
- * Generic catalog class methods.
- *
- * Written by Marco van Wieringen, January 2011
- */
-
-#include "bacula.h"
-
-#if HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL
-
-#include "cats.h"
-#include "bdb_priv.h"
-#include "sql_glue.h"
-
-bool B_DB::db_match_database(const char *db_driver, const char *db_name,
-                             const char *db_address, int db_port)
-{
-   bool match;
-
-   if (db_driver) {
-      match = strcasecmp(m_db_driver, db_driver) == 0 &&
-              bstrcmp(m_db_name, db_name) &&
-              bstrcmp(m_db_address, db_address) &&
-              m_db_port == db_port &&
-              m_dedicated == false;
-   } else {
-      match = bstrcmp(m_db_name, db_name) &&
-              bstrcmp(m_db_address, db_address) &&
-              m_db_port == db_port &&
-              m_dedicated == false;
-   }
-   return match;
-}
-
-B_DB *B_DB::db_clone_database_connection(JCR *jcr, bool mult_db_connections)
-{
-   /*
-    * See if its a simple clone e.g. with mult_db_connections set to false
-    * then we just return the calling class pointer.
-    */
-   if (!mult_db_connections) {
-      m_ref_count++;
-      return this;
-   }
-
-   /*
-    * A bit more to do here just open a new session to the database.
-    */
-   return db_init_database(jcr, m_db_driver, m_db_name, m_db_user, m_db_password,
-                           m_db_address, m_db_port, m_db_socket, true, m_disabled_batch_insert);
-}
-
-const char *B_DB::db_get_type(void)
-{
-   switch (m_db_interface_type) {
-   case SQL_INTERFACE_TYPE_MYSQL:
-      return "MySQL";
-   case SQL_INTERFACE_TYPE_POSTGRESQL:
-      return "PostgreSQL";
-   case SQL_INTERFACE_TYPE_SQLITE3:
-      return "SQLite3";
-   default:
-      return "Unknown";
-   }
-}
-
-/*
- * Lock database, this can be called multiple times by the same
- * thread without blocking, but must be unlocked the number of
- * times it was locked using db_unlock().
- */
-void B_DB::_db_lock(const char *file, int line)
-{
-   int errstat;
-
-   if ((errstat = rwl_writelock_p(&m_lock, file, line)) != 0) {
-      berrno be;
-      e_msg(file, line, M_FATAL, 0, "rwl_writelock failure. stat=%d: ERR=%s\n",
-            errstat, be.bstrerror(errstat));
-   }
-}
-
-/*
- * Unlock the database. This can be called multiple times by the
- * same thread up to the number of times that thread called
- * db_lock()/
- */
-void B_DB::_db_unlock(const char *file, int line)
-{
-   int errstat;
-
-   if ((errstat = rwl_writeunlock(&m_lock)) != 0) {
-      berrno be;
-      e_msg(file, line, M_FATAL, 0, "rwl_writeunlock failure. stat=%d: ERR=%s\n",
-            errstat, be.bstrerror(errstat));
-   }
-}
-
-bool B_DB::db_sql_query(const char *query, int flags)
-{
-   bool retval;
-
-   db_lock(this);
-   retval = ((B_DB_PRIV *)this)->sql_query(query, flags);
-   if (!retval) {
-      Mmsg(errmsg, _("Query failed: %s: ERR=%s\n"), query, ((B_DB_PRIV *)this)->sql_strerror());
-   }
-   db_unlock(this);
-   return retval;
-}
-
-void B_DB::print_lock_info(FILE *fp)
-{
-   if (m_lock.valid == RWLOCK_VALID) {
-      fprintf(fp, "\tRWLOCK=%p w_active=%i w_wait=%i\n", &m_lock, m_lock.w_active, m_lock.w_wait);
-   }
-}
-
-#endif /* HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL */
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/ 
+/* 
+ * Generic catalog class methods. 
+ * 
+ * Note: at one point, this file was assembled from parts of other files 
+ *  by a programmer, and other than "wrapping" in a class, which is a trivial  
+ *  change for a C++ programmer, nothing substantial was done, yet all the  
+ *  code was recommitted under this programmer's name.  Consequently, we  
+ *  undo those changes here.  
+ */ 
+ 
+#include "bacula.h" 
+ 
+#if HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL 
+ 
+#include "cats.h" 
+ 
+bool BDB::bdb_match_database(const char *db_driver, const char *db_name, 
+                             const char *db_address, int db_port) 
+{ 
+   BDB *mdb = this; 
+   bool match; 
+ 
+   if (db_driver) { 
+      match = strcasecmp(mdb->m_db_driver, db_driver) == 0 && 
+              bstrcmp(mdb->m_db_name, db_name) && 
+              bstrcmp(mdb->m_db_address, db_address) && 
+              mdb->m_db_port == db_port && 
+              mdb->m_dedicated == false; 
+   } else { 
+      match = bstrcmp(mdb->m_db_name, db_name) && 
+              bstrcmp(mdb->m_db_address, db_address) && 
+              mdb->m_db_port == db_port && 
+              mdb->m_dedicated == false; 
+   } 
+   return match; 
+} 
+ 
+BDB *BDB::bdb_clone_database_connection(JCR *jcr, bool mult_db_connections) 
+{ 
+   BDB *mdb = this; 
+   /* 
+    * See if its a simple clone e.g. with mult_db_connections set to false 
+    * then we just return the calling class pointer. 
+    */ 
+   if (!mult_db_connections) { 
+      mdb->m_ref_count++; 
+      return mdb; 
+   } 
+ 
+   /* 
+    * A bit more to do here just open a new session to the database. 
+    */ 
+   return db_init_database(jcr, mdb->m_db_driver, mdb->m_db_name, 
+             mdb->m_db_user, mdb->m_db_password, mdb->m_db_address, 
+             mdb->m_db_port, mdb->m_db_socket, true, 
+             mdb->m_disabled_batch_insert); 
+} 
+ 
+const char *BDB::bdb_get_engine_name(void) 
+{ 
+   BDB *mdb = this; 
+   switch (mdb->m_db_driver_type) { 
+   case SQL_DRIVER_TYPE_MYSQL: 
+      return "MySQL"; 
+   case SQL_DRIVER_TYPE_POSTGRESQL: 
+      return "PostgreSQL"; 
+   case SQL_DRIVER_TYPE_SQLITE3: 
+      return "SQLite3"; 
+   default: 
+      return "Unknown"; 
+   } 
+} 
+ 
+/* 
+ * Lock database, this can be called multiple times by the same 
+ * thread without blocking, but must be unlocked the number of 
+ * times it was locked using db_unlock(). 
+ */ 
+void BDB::bdb_lock(const char *file, int line) 
+{ 
+   int errstat; 
+   BDB *mdb = this; 
+ 
+   if ((errstat = rwl_writelock_p(&mdb->m_lock, file, line)) != 0) { 
+      berrno be; 
+      e_msg(file, line, M_FATAL, 0, "rwl_writelock failure. stat=%d: ERR=%s\n", 
+            errstat, be.bstrerror(errstat)); 
+   } 
+} 
+ 
+/* 
+ * Unlock the database. This can be called multiple times by the 
+ * same thread up to the number of times that thread called 
+ * db_lock()/ 
+ */ 
+void BDB::bdb_unlock(const char *file, int line) 
+{ 
+   int errstat; 
+   BDB *mdb = this; 
+ 
+   if ((errstat = rwl_writeunlock(&mdb->m_lock)) != 0) { 
+      berrno be; 
+      e_msg(file, line, M_FATAL, 0, "rwl_writeunlock failure. stat=%d: ERR=%s\n", 
+            errstat, be.bstrerror(errstat)); 
+   } 
+} 
+ 
+bool BDB::bdb_sql_query(const char *query, int flags) 
+{ 
+   bool retval; 
+   BDB *mdb = this; 
+ 
+   bdb_lock(); 
+   retval = sql_query(query, flags); 
+   if (!retval) { 
+      Mmsg(mdb->errmsg, _("Query failed: %s: ERR=%s\n"), query, sql_strerror()); 
+   } 
+   bdb_unlock(); 
+   return retval; 
+} 
+ 
+void BDB::print_lock_info(FILE *fp) 
+{ 
+   BDB *mdb = this; 
+   if (mdb->m_lock.valid == RWLOCK_VALID) { 
+      fprintf(fp, "\tRWLOCK=%p w_active=%i w_wait=%i\n",  
+         &mdb->m_lock, mdb->m_lock.w_active, mdb->m_lock.w_wait); 
+   } 
+} 
+ 
+#endif /* HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL */ 
diff --git a/src/cats/cats.h b/src/cats/cats.h
index cc2d8d8..f1ee5dc 100644
--- a/src/cats/cats.h
+++ b/src/cats/cats.h
@@ -1,27 +1,34 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
- * Catalog header file
+ *  Catalog DB header file
  *
- *   Written by Kern E. Sibbald
+ *  Written by Kern E. Sibbald
  *
- * Anyone who accesses the database will need to include
- * this file.
+ *  Anyone who accesses the database will need to include
+ *   this file.
  */
 
+#ifndef __CATS_H_
+#define __CATS_H_ 1
+
 /*
    Here is how database versions work.
 
@@ -40,8 +47,28 @@
    will be copied to the updatedb directory with the correct name
    (in the present case 8 to 9).
  */
-#ifndef __CATS_H_
-#define __CATS_H_ 1
+
+/* Current database version number for all drivers */
+#define BDB_VERSION 15
+
+typedef void (DB_LIST_HANDLER)(void *, const char *);
+typedef int (DB_RESULT_HANDLER)(void *, int, char **);
+
+/* What kind of database we have */
+typedef enum {
+   SQL_TYPE_MYSQL      = 0,
+   SQL_TYPE_POSTGRESQL = 1,
+   SQL_TYPE_SQLITE3    = 2,
+   SQL_TYPE_UNKNOWN    = 99
+} SQL_DBTYPE;
+
+/* What kind of driver we have */
+typedef enum {
+   SQL_DRIVER_TYPE_MYSQL      = 0,
+   SQL_DRIVER_TYPE_POSTGRESQL = 1,
+   SQL_DRIVER_TYPE_SQLITE3    = 2,
+} SQL_DRIVER;
+
 
 /* ==============================================================
  *
@@ -53,6 +80,22 @@
 #define faddr_t long
 
 /*
+ * Generic definition of a sql_row.
+ */
+typedef char **SQL_ROW;
+
+/*
+ * Generic definition of a a sql_field.
+ */
+typedef struct sql_field {
+   char *name;                        /* name of column */
+   int max_length;                    /* max length */
+   uint32_t type;                     /* type */
+   uint32_t flags;                    /* flags */
+} SQL_FIELD;
+
+
+/*
  * Structure used when calling db_get_query_ids()
  *  allows the subroutine to return a list of ids.
  */
@@ -135,7 +178,6 @@ struct JOBMEDIA_DBR {
    uint32_t EndFile;                  /* End file on Volume */
    uint32_t StartBlock;               /* start block on tape */
    uint32_t EndBlock;                 /* last block */
-// uint32_t Copy;                     /* identical copy */
 };
 
 
@@ -151,8 +193,6 @@ struct VOL_PARAMS {
    uint64_t StartAddr;                /* Start address */
    uint64_t EndAddr;                  /* End address */
    int32_t InChanger;                 /* InChanger flag */
-// uint32_t Copy;                     /* identical copy */
-// uint32_t Stripe;                   /* RAIT strip number */
 };
 
 
@@ -181,6 +221,7 @@ struct ROBJECT_DBR {
    char *object_name;
    char *object;
    char *plugin_name;
+   char *JobIds;
    uint32_t object_len;
    uint32_t object_full_len;
    uint32_t object_index;
@@ -268,7 +309,6 @@ public:
    int ReadOnly;                      /* Set if read-only */
 };
 
-
 /* Media record -- same as the database */
 class MEDIA_DBR {
 public:
@@ -291,10 +331,13 @@ public:
    uint32_t VolBlocks;                /* Number of blocks */
    uint32_t VolMounts;                /* Number of times mounted */
    uint32_t VolErrors;                /* Number of read/write errors */
-   uint32_t VolWrites;                /* Number of writes */
-   uint32_t VolReads;                 /* Number of reads */
+   uint64_t VolWrites;                /* Number of writes */
+   uint64_t VolReads;                 /* Number of reads */
    uint64_t VolBytes;                 /* Number of bytes written */
-   uint32_t VolParts;                 /* Number of parts written */
+   uint64_t VolABytes;                /* Size of aligned volume */
+   uint64_t VolHoleBytes;             /* The size of Holes */
+   uint32_t VolHoles;                 /* Number of holes */
+   uint32_t VolType;                  /* Device type of where Volume labeled */
    uint64_t MaxVolBytes;              /* Max bytes to write to Volume */
    uint64_t VolCapacityBytes;         /* capacity estimate */
    uint64_t VolReadTime;              /* time spent reading volume */
@@ -364,6 +407,92 @@ struct FILESET_DBR {
    bool created;                      /* set when record newly created */
 };
 
+class SNAPSHOT_DBR {
+public:
+   SNAPSHOT_DBR() {
+      memset(this, 0, sizeof(SNAPSHOT_DBR));
+   };
+   ~SNAPSHOT_DBR() {
+      reset();
+   };
+   void debug(int level) {
+      Dmsg8(DT_SNAPSHOT|level,
+            "Snapshot      %s:\n"
+            "  Volume:     %s\n"
+            "  Device:     %s\n"
+            "  Id:         %d\n"
+            "  FileSet:    %s\n"
+            "  CreateDate: %s\n"
+            "  Client:     %s\n"
+            "  Type:       %s\n",
+            Name, NPRT(Volume), NPRT(Device), SnapshotId,
+            FileSet, CreateDate, Client, Type);
+   };
+   char *as_arg(POOLMEM **out) {
+      bash_spaces(Name);
+      bash_spaces(Type);
+
+      if (Volume) {
+         bash_spaces(Volume);
+      }
+      if (Device) {
+         bash_spaces(Device);
+      }
+
+      Mmsg(out, "name=%s volume=%s device=%s tdate=%d type=%s",
+           Name, NPRTB(Volume), NPRTB(Device), CreateTDate, Type);
+
+      unbash_spaces(Name);
+      unbash_spaces(Type);
+      if (Volume) {
+         unbash_spaces(Volume);
+      }
+      if (Device) {
+         unbash_spaces(Device);
+      }
+      return *out;
+   };
+   void reset() {
+      if (need_to_free) {
+         if (Volume) {
+            free(Volume);
+         }
+         if (Device) {
+            free(Device);
+         }
+         if (errmsg) {
+            free(errmsg);
+         }
+         errmsg = Volume = Device = NULL;
+      }
+      need_to_free = false;
+   };
+   bool    need_to_free;             /* Need to free the internal memory */
+   /* Used when searching snapshots */
+   char    created_after[MAX_TIME_LENGTH];
+   char    created_before[MAX_TIME_LENGTH];
+   bool    expired;                 /* Look for CreateTDate > (NOW - Retention) */
+   bool    sorted_client;           /* Results sorted by Client, SnapshotId */
+   int     status;                  /* Status of the snapshot */
+
+   DBId_t  SnapshotId;              /* Unique Snapshot ID */
+   DBId_t  JobId;                   /* Related JobId */
+   DBId_t  FileSetId;               /* FileSetId if any */
+   DBId_t  ClientId;                /* From which client this snapshot comes */
+   char    Name[MAX_NAME_LENGTH];   /* Snapshot Name */
+   char    FileSet[MAX_NAME_LENGTH];/* FileSet name if any */
+   char    Client[MAX_NAME_LENGTH]; /* Client name */
+   char    Type[MAX_NAME_LENGTH];   /* zfs, btrfs, lvm, netapp, */
+   char    Comment[MAX_NAME_LENGTH];/* Comment */
+   char    CreateDate[MAX_TIME_LENGTH]; /* Create date as string */
+   time_t  CreateTDate;             /* Create TDate (in sec, since epoch) */
+   char   *Volume;                  /* Volume taken in snapshot */
+   char   *Device;                  /* Device, Pool, Directory, ...  */
+   char   *errmsg;                  /* Error associated with a snapshot */
+   utime_t Retention;               /* Number of second before pruning the snapshot */
+   uint64_t Size;                   /* Snapshot Size */
+};
+
 /* Call back context for getting a 32/64 bit value from the database */
 class db_int64_ctx {
 public:
@@ -409,115 +538,24 @@ private:
    db_list_ctx &operator=(const db_list_ctx&); /* prohibit class assignment */
 };
 
-typedef enum {
-   SQL_INTERFACE_TYPE_MYSQL      = 0,
-   SQL_INTERFACE_TYPE_POSTGRESQL = 1,
-   SQL_INTERFACE_TYPE_SQLITE3    = 2,
-} SQL_INTERFACETYPE;
-
-typedef enum {
-   SQL_TYPE_MYSQL      = 0,
-   SQL_TYPE_POSTGRESQL = 1,
-   SQL_TYPE_SQLITE3    = 2,
-   SQL_TYPE_UNKNOWN    = 99
-} SQL_DBTYPE;
-
-typedef void (DB_LIST_HANDLER)(void *, const char *);
-typedef int (DB_RESULT_HANDLER)(void *, int, char **);
-
-#define db_lock(mdb)   mdb->_db_lock(__FILE__, __LINE__)
-#define db_unlock(mdb) mdb->_db_unlock(__FILE__, __LINE__)
-
-/* Current database version number for all drivers */
-#define BDB_VERSION 14
-
-class B_DB: public SMARTALLOC {
-protected:
-   brwlock_t m_lock;                      /* transaction lock */
-   dlink m_link;                          /* queue control */
-   SQL_INTERFACETYPE m_db_interface_type; /* type of backend used */
-   SQL_DBTYPE m_db_type;                  /* database type */
-   int m_ref_count;                       /* reference count */
-   bool m_connected;                      /* connection made to db */
-   bool m_have_batch_insert;              /* have batch insert support ? */
-   char *m_db_driver;                     /* database driver */
-   char *m_db_driverdir;                  /* database driver dir */
-   char *m_db_name;                       /* database name */
-   char *m_db_user;                       /* database user */
-   char *m_db_address;                    /* host name address */
-   char *m_db_socket;                     /* socket for local access */
-   char *m_db_password;                   /* database password */
-   int m_db_port;                         /* port for host name address */
-   bool m_disabled_batch_insert;          /* explicitly disabled batch insert mode ? */
-   bool m_dedicated;                      /* is this connection dedicated? */
-
-public:
-   POOLMEM *errmsg;                       /* nicely edited error message */
-   POOLMEM *cmd;                          /* SQL command string */
-   POOLMEM *cached_path;                  /* cached path name */
-   int cached_path_len;                   /* length of cached path */
-   uint32_t cached_path_id;               /* cached path id */
-   int changes;                           /* changes during transaction */
-   POOLMEM *fname;                        /* Filename only */
-   POOLMEM *path;                         /* Path only */
-   POOLMEM *esc_name;                     /* Escaped file name */
-   POOLMEM *esc_path;                     /* Escaped path name */
-   POOLMEM *esc_obj;                      /* Escaped restore object */
-   int fnl;                               /* file name length */
-   int pnl;                               /* path name length */
-
-   /* methods */
-   B_DB() {};
-   virtual ~B_DB() {};
-   const char *get_db_name(void) { return m_db_name; };
-   const char *get_db_user(void) { return m_db_user; };
-   bool is_connected(void) { return m_connected; };
-   bool batch_insert_available(void) { return m_have_batch_insert; };
-   void increment_refcount(void) { m_ref_count++; };
-
-   /* low level methods */
-   bool db_match_database(const char *db_driver, const char *db_name,
-                          const char *db_address, int db_port);
-   B_DB *db_clone_database_connection(JCR *jcr, bool mult_db_connections);
-   int db_get_type_index(void) { return m_db_type; };
-   const char *db_get_type(void);
-   void _db_lock(const char *file, int line);
-   void _db_unlock(const char *file, int line);
-   bool db_sql_query(const char *query, int flags=0);
-   void print_lock_info(FILE *fp);
-
-   /* Pure virtual low level methods */
-   virtual bool db_open_database(JCR *jcr) = 0;
-   virtual void db_close_database(JCR *jcr) = 0;
-   virtual void db_thread_cleanup(void) = 0;
-   virtual void db_escape_string(JCR *jcr, char *snew, char *old, int len) = 0;
-   virtual char *db_escape_object(JCR *jcr, char *old, int len) = 0;
-   virtual void db_unescape_object(JCR *jcr, char *from, int32_t expected_len,
-                                   POOLMEM **dest, int32_t *len) = 0;
-   virtual void db_start_transaction(JCR *jcr) = 0;
-   virtual void db_end_transaction(JCR *jcr) = 0;
-   virtual bool db_sql_query(const char *query, DB_RESULT_HANDLER *result_handler, void *ctx) = 0;
-
-   /* By default, we use db_sql_query */
-   virtual bool db_big_sql_query(const char *query,
-                                 DB_RESULT_HANDLER *result_handler, void *ctx) {
-      return db_sql_query(query, result_handler, ctx);
-   };
-};
-
-/* sql_query Query Flags */
+/* sql_query flags */
 #define QF_STORE_RESULT 0x01
-
-/* Use for better error location printing */
-#define UPDATE_DB(jcr, db, cmd) UpdateDB(__FILE__, __LINE__, jcr, db, cmd)
-#define INSERT_DB(jcr, db, cmd) InsertDB(__FILE__, __LINE__, jcr, db, cmd)
-#define QUERY_DB(jcr, db, cmd) QueryDB(__FILE__, __LINE__, jcr, db, cmd)
-#define DELETE_DB(jcr, db, cmd) DeleteDB(__FILE__, __LINE__, jcr, db, cmd)
-
+ 
+/* sql_list.c */
+enum e_list_type {
+   HORZ_LIST,                   /* list */
+   VERT_LIST,                   /* llist */
+   ARG_LIST,                    /* key1=v1 key2=v2 key3=v3 */
+   FAILED_JOBS,
+   INCOMPLETE_JOBS
+};
+ 
+#include "bdb.h"
 #include "protos.h"
 #include "jcr.h"
 #include "sql_cmds.h"
 
+
 /* Object used in db_list_xxx function */
 class LIST_CTX {
 public:
@@ -528,7 +566,7 @@ public:
    DB_LIST_HANDLER *send;       /* send data back */
    bool once;                   /* Used to print header one time */
    void *ctx;                   /* send() user argument */
-   B_DB *mdb;
+   BDB *mdb;
    JCR *jcr;
 
    void empty() {
@@ -542,7 +580,7 @@ public:
       }
    }
 
-   LIST_CTX(JCR *j, B_DB *m, DB_LIST_HANDLER *h, void *c, e_list_type t) {
+   LIST_CTX(JCR *j, BDB *m, DB_LIST_HANDLER *h, void *c, e_list_type t) {
       line[0] = '\0';
       once = false;
       num_rows = 0;
@@ -554,21 +592,17 @@ public:
    }
 };
 
-/*
- * Some functions exported by sql.c for use within the cats directory.
- */
+/* Functions exported by sql.c for use within the cats directory. */
 int list_result(void *vctx, int cols, char **row);
-int list_result(JCR *jcr, B_DB *mdb, DB_LIST_HANDLER *send, void *ctx, e_list_type type);
-void list_dashes(B_DB *mdb, DB_LIST_HANDLER *send, void *ctx);
-int get_sql_record_max(JCR *jcr, B_DB *mdb);
-bool check_tables_version(JCR *jcr, B_DB *mdb);
-bool db_check_max_connections(JCR *jcr, B_DB *mdb, uint32_t nb);
-
-void print_dashes(B_DB *mdb);
-void print_result(B_DB *mdb);
-int QueryDB(const char *file, int line, JCR *jcr, B_DB *db, char *select_cmd);
-int InsertDB(const char *file, int line, JCR *jcr, B_DB *db, char *select_cmd);
-int DeleteDB(const char *file, int line, JCR *jcr, B_DB *db, char *delete_cmd);
-int UpdateDB(const char *file, int line, JCR *jcr, B_DB *db, char *update_cmd);
-void split_path_and_file(JCR *jcr, B_DB *mdb, const char *fname);
-#endif /* __CATS_H_ */
+int list_result(JCR *jcr, BDB *mdb, DB_LIST_HANDLER *send, void *ctx, e_list_type type);
+int get_sql_record_max(JCR *jcr, BDB *mdb);
+void list_dashes(BDB *mdb, DB_LIST_HANDLER *send, void *ctx);
+
+void print_dashes(BDB *mdb);
+void print_result(BDB *mdb);
+int QueryDB(const char *file, int line, JCR *jcr, BDB *db, char *select_cmd);
+int InsertDB(const char *file, int line, JCR *jcr, BDB *db, char *select_cmd);
+int DeleteDB(const char *file, int line, JCR *jcr, BDB *db, char *delete_cmd);
+void split_path_and_file(JCR *jcr, BDB *mdb, const char *fname);
+
+#endif  /* __CATS_H_ */
diff --git a/src/cats/cats_dummy.c b/src/cats/cats_dummy.c
deleted file mode 100644
index 99959be..0000000
--- a/src/cats/cats_dummy.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
-   Bacula® - The Network Backup Solution
-
-   Copyright (C) 2010-2014 Free Software Foundation Europe e.V.
-
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
-
-   You may use this file and others of this release according to the
-   license defined in the LICENSE file, which includes the Affero General
-   Public License, v3.0 ("AGPLv3") and some additional permissions and
-   terms pursuant to its AGPLv3 Section 7.
-
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
-/*
- * Dummy bacula backend function replaced with the correct one at install time.
- */
-
-#include "bacula.h"
-#include "cats.h"
-
-B_DB *db_init_database(JCR *jcr, const char *db_driver, const char *db_name, const char *db_user,
-        const char *db_password, const char *db_address, int db_port, const char *db_socket,
-        bool mult_db_connections, bool disable_batch_insert)
-{
-   Jmsg(jcr, M_FATAL, 0, _("Please replace this null libbaccats library with a proper one.\n"));
-   return NULL;
-}
diff --git a/src/cats/cats_null.c b/src/cats/cats_null.c
new file mode 100644
index 0000000..df00f8e
--- /dev/null
+++ b/src/cats/cats_null.c
@@ -0,0 +1,35 @@
+/* 
+   Bacula(R) - The Network Backup Solution
+
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
+
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
+
+   You may use this file and others of this release according to the
+   license defined in the LICENSE file, which includes the Affero General
+   Public License, v3.0 ("AGPLv3") and some additional permissions and
+   terms pursuant to its AGPLv3 Section 7.
+
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/ 
+/* 
+ * Null Bacula backend function replaced with the correct one
+ *  at install time.
+ */ 
+ 
+#include  "bacula.h"
+#include  "cats.h"
+ 
+BDB *db_init_database(JCR *jcr, const char *db_driver, const char *db_name,
+         const char *db_user, const char *db_password, const char *db_address,
+         int db_port, const char *db_socket, bool mult_db_connections,
+         bool disable_batch_insert)
+{ 
+   Jmsg(jcr, M_FATAL, 0, _("Please replace this null libbaccats library with a proper one.\n"));
+   return NULL; 
+} 
diff --git a/src/cats/create_bacula_database.in b/src/cats/create_bacula_database.in
index cf00c99..0813977 100644
--- a/src/cats/create_bacula_database.in
+++ b/src/cats/create_bacula_database.in
@@ -1,23 +1,14 @@
 #!/bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # This routine creates the Bacula database
 # using PostgreSQL, Ingres, MySQL, or SQLite.
 #
-#
-#  Bacula® - The Network Backup Solution
-#
-#  Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
-#
-#  The main author of Bacula is Kern Sibbald, with contributions from many
-#  others, a complete list can be found in the file AUTHORS.
-#
-#  You may use this file and others of this release according to the
-#  license defined in the LICENSE file, which includes the Affero General
-#  Public License, v3.0 ("AGPLv3") and some additional permissions and
-#  terms pursuant to its AGPLv3 Section 7.
-#
-#  Bacula® is a registered trademark of Kern Sibbald.
-#
+
+# can be used to change the current user with su
+pre_command="sh -c"
 
 default_db_type=@DEFAULT_DB_TYPE@
 
@@ -39,10 +30,6 @@ if [ $# -gt 0 ]; then
        db_type=$1
        shift
        ;;
-     ingres)
-       db_type=$1
-       shift
-       ;;
      *)
        ;;
    esac
@@ -55,5 +42,9 @@ if [ -z "${db_type}" ]; then
    db_type="${default_db_type}"
 fi
 
+if [ $db_type = postgresql -a "$UID" = 0 ]; then
+    pre_command="su - postgres -c"
+fi
+
 echo "Creating ${db_type} database"
- at scriptdir@/create_${db_type}_database $*
+$pre_command "@scriptdir@/create_${db_type}_database $*"
diff --git a/src/cats/create_mysql_database.in b/src/cats/create_mysql_database.in
index 855bed3..123aa0b 100644
--- a/src/cats/create_mysql_database.in
+++ b/src/cats/create_mysql_database.in
@@ -1,21 +1,9 @@
 #!/bin/sh
 #
-# shell script to create Bacula database(s)
-#
-#
-#  Bacula® - The Network Backup Solution
-#
-#  Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #
-#  The main author of Bacula is Kern Sibbald, with contributions from many
-#  others, a complete list can be found in the file AUTHORS.
-#
-#  You may use this file and others of this release according to the
-#  license defined in the LICENSE file, which includes the Affero General
-#  Public License, v3.0 ("AGPLv3") and some additional permissions and
-#  terms pursuant to its AGPLv3 Section 7.
-#
-#  Bacula® is a registered trademark of Kern Sibbald.
+# shell script to create Bacula database(s)
 #
 
 bindir=@MYSQL_BINDIR@
diff --git a/src/cats/create_postgresql_database.in b/src/cats/create_postgresql_database.in
index c9e7f0c..a823607 100644
--- a/src/cats/create_postgresql_database.in
+++ b/src/cats/create_postgresql_database.in
@@ -1,21 +1,9 @@
 #!/bin/sh
 #
-# shell script to create Bacula database(s)
-#
-#
-#  Bacula® - The Network Backup Solution
-#
-#  Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #
-#  The main author of Bacula is Kern Sibbald, with contributions from many
-#  others, a complete list can be found in the file AUTHORS.
-#
-#  You may use this file and others of this release according to the
-#  license defined in the LICENSE file, which includes the Affero General
-#  Public License, v3.0 ("AGPLv3") and some additional permissions and
-#  terms pursuant to its AGPLv3 Section 7.
-#
-#  Bacula® is a registered trademark of Kern Sibbald.
+# shell script to create Bacula database(s)
 #
 
 PATH="@POSTGRESQL_BINDIR@:$PATH"
@@ -67,7 +55,7 @@ else
    echo "!!!! Creation of ${db_name} database failed. !!!!"
    echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
 fi
-if psql -l ${dbname} $* | grep " ${db_name}.*SQL_ASCII" >/dev/null; then 
+if psql -l | grep " ${db_name}.*SQL_ASCII" >/dev/null; then 
    echo "Database encoding OK"
 else
    echo " "
diff --git a/src/cats/create_sqlite3_database.in b/src/cats/create_sqlite3_database.in
index 510bc87..28a9b55 100644
--- a/src/cats/create_sqlite3_database.in
+++ b/src/cats/create_sqlite3_database.in
@@ -1,21 +1,9 @@
 #!/bin/sh
 #
-# shell script to create Bacula SQLite tables
-#
-#  Bacula® - The Network Backup Solution
-#
-#  Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
-#
-#  The main author of Bacula is Kern Sibbald, with contributions from many
-#  others, a complete list can be found in the file AUTHORS.
-#
-#  You may use this file and others of this release according to the
-#  license defined in the LICENSE file, which includes the Affero General
-#  Public License, v3.0 ("AGPLv3") and some additional permissions and
-#  terms pursuant to its AGPLv3 Section 7.
-#
-#  Bacula® is a registered trademark of Kern Sibbald.
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #
+# shell script to create Bacula SQLite tables
 
 bindir=@SQLITE_BINDIR@
 PATH=$bindir:$PATH
@@ -23,9 +11,5 @@ cd @working_dir@
 db_name=@db_name@
 
 sqlite3 $* ${db_name}.db <<END-OF-DATA
-.databases
 END-OF-DATA
-# Allow non root access
-chown @dir_user@:@dir_group@ ${db_name}.db
-chmod 0640 ${db_name}.db
 exit 0
diff --git a/src/cats/create_sqlite3_database.in.patch b/src/cats/create_sqlite3_database.in.patch
index c82adc4..e9a38f4 100644
--- a/src/cats/create_sqlite3_database.in.patch
+++ b/src/cats/create_sqlite3_database.in.patch
@@ -5,7 +5,7 @@
  # shell script to create Bacula SQLite tables
  
 -bindir=@SQLITE_BINDIR@
-+bindir=/usr/lib/bacula/sqlite
++bindir=/opt/bacula/sqlite
  cd @working_dir@
  db_name=@db_name@
- 
+
diff --git a/src/cats/delete_catalog_backup.in b/src/cats/delete_catalog_backup.in
index 9e232ff..bc72ef2 100755
--- a/src/cats/delete_catalog_backup.in
+++ b/src/cats/delete_catalog_backup.in
@@ -1,22 +1,20 @@
 #!/bin/sh
 #
-# This script deletes a catalog dump
-#
-#
-#  Bacula® - The Network Backup Solution
-#
-#  Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
-#
-#  The main author of Bacula is Kern Sibbald, with contributions from many
-#  others, a complete list can be found in the file AUTHORS.
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #
-#  You may use this file and others of this release according to the
-#  license defined in the LICENSE file, which includes the Affero General
-#  Public License, v3.0 ("AGPLv3") and some additional permissions and
-#  terms pursuant to its AGPLv3 Section 7.
-#
-#  Bacula® is a registered trademark of Kern Sibbald.
+# This script deletes a catalog dump
 #
 db_name=@db_name@
 
 rm -f @working_dir@/${db_name}.sql
+
+#
+# We recommend that you email a copy of the bsr file that was
+#  made for the Job that runs this script to yourself.
+#  You just need to put the bsr file in /opt/bacula/bsr/catalog.bsr
+#  or adjust the script below.	Please replace all %xxx% with what
+#  is appropriate at your site.
+#
+#/opt/bacula/bin/bsmtp -h %smtp-server% -s "catalog.bsr" \
+#   %your-name at company.org% </opt/bacula/bsr/catalog.bsr
diff --git a/src/cats/drop_bacula_database.in b/src/cats/drop_bacula_database.in
index d39fd57..20041b4 100755
--- a/src/cats/drop_bacula_database.in
+++ b/src/cats/drop_bacula_database.in
@@ -1,23 +1,11 @@
 #!/bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 #  Drop Bacula database -- works for whatever is configured,
 #  MySQL, SQLite, PostgreSQL, Ingres
 #
-#
-#  Bacula® - The Network Backup Solution
-#
-#  Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
-#
-#  The main author of Bacula is Kern Sibbald, with contributions from many
-#  others, a complete list can be found in the file AUTHORS.
-#
-#  You may use this file and others of this release according to the
-#  license defined in the LICENSE file, which includes the Affero General
-#  Public License, v3.0 ("AGPLv3") and some additional permissions and
-#  terms pursuant to its AGPLv3 Section 7.
-#
-#  Bacula® is a registered trademark of Kern Sibbald.
-#
 
 default_db_type=@DEFAULT_DB_TYPE@
 
@@ -39,10 +27,6 @@ if [ $# -gt 0 ]; then
        db_type=$1
        shift
        ;;
-     ingres)
-       db_type=$1
-       shift
-       ;;
      *)
        ;;
    esac
diff --git a/src/cats/drop_bacula_tables.in b/src/cats/drop_bacula_tables.in
index 019ced5..2209b97 100755
--- a/src/cats/drop_bacula_tables.in
+++ b/src/cats/drop_bacula_tables.in
@@ -1,23 +1,14 @@
 #!/bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 #  Drop Bacula tables -- works for whatever is configured,
 #  MySQL, SQLite, Ingres, or PostgreSQL
 #
-#
-#  Bacula® - The Network Backup Solution
-#
-#  Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
-#
-#  The main author of Bacula is Kern Sibbald, with contributions from many
-#  others, a complete list can be found in the file AUTHORS.
-#
-#  You may use this file and others of this release according to the
-#  license defined in the LICENSE file, which includes the Affero General
-#  Public License, v3.0 ("AGPLv3") and some additional permissions and
-#  terms pursuant to its AGPLv3 Section 7.
-#
-#  Bacula® is a registered trademark of Kern Sibbald.
-#
+
+# can be used to change the current user with su
+pre_command="sh -c"
 
 default_db_type=@DEFAULT_DB_TYPE@
 
@@ -39,10 +30,6 @@ if [ $# -gt 0 ]; then
        db_type=$1
        shift
        ;;
-     ingres)
-       db_type=$1
-       shift
-       ;;
      *)
        ;;
    esac
@@ -55,5 +42,9 @@ if [ -z "${db_type}" ]; then
    db_type="${default_db_type}"
 fi
 
- at scriptdir@/drop_${db_type}_tables $*
+if [ $db_type = postgresql -a "$UID" = 0 ]; then
+    pre_command="su - postgres -c"
+fi
+
+$pre_command "@scriptdir@/drop_${db_type}_tables $*"
 echo "Dropped ${db_type} tables"
diff --git a/src/cats/drop_mysql_database.in b/src/cats/drop_mysql_database.in
index 7be0008..d714647 100644
--- a/src/cats/drop_mysql_database.in
+++ b/src/cats/drop_mysql_database.in
@@ -1,21 +1,9 @@
 #!/bin/sh
 #
-# shell script to drop Bacula database(s)
-#
-#
-#  Bacula® - The Network Backup Solution
-#
-#  Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #
-#  The main author of Bacula is Kern Sibbald, with contributions from many
-#  others, a complete list can be found in the file AUTHORS.
-#
-#  You may use this file and others of this release according to the
-#  license defined in the LICENSE file, which includes the Affero General
-#  Public License, v3.0 ("AGPLv3") and some additional permissions and
-#  terms pursuant to its AGPLv3 Section 7.
-#
-#  Bacula® is a registered trademark of Kern Sibbald.
+# shell script to drop Bacula database(s)
 #
 
 bindir=@MYSQL_BINDIR@
diff --git a/src/cats/drop_mysql_tables.in b/src/cats/drop_mysql_tables.in
index 058d404..6b3067f 100644
--- a/src/cats/drop_mysql_tables.in
+++ b/src/cats/drop_mysql_tables.in
@@ -1,21 +1,9 @@
 #!/bin/sh
 #
-# shell script to delete Bacula tables for MySQL
-#
-#  Bacula® - The Network Backup Solution
-#
-#  Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
-#
-#  The main author of Bacula is Kern Sibbald, with contributions from many
-#  others, a complete list can be found in the file AUTHORS.
-#
-#  You may use this file and others of this release according to the
-#  license defined in the LICENSE file, which includes the Affero General
-#  Public License, v3.0 ("AGPLv3") and some additional permissions and
-#  terms pursuant to its AGPLv3 Section 7.
-#
-#  Bacula® is a registered trademark of Kern Sibbald.
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #
+# shell script to delete Bacula tables for MySQL
 
 bindir=@MYSQL_BINDIR@
 db_name=@db_name@
@@ -51,6 +39,7 @@ DROP TABLE IF EXISTS LocationLog;
 DROP TABLE IF EXISTS PathVisibility;
 DROP TABLE IF EXISTS PathHierarchy;
 DROP TABLE IF EXISTS RestoreObject;
+DROP TABLE IF EXISTS Snapshot;
 END-OF-DATA
 then
    echo "Deletion of ${db_name} MySQL tables succeeded."
diff --git a/src/cats/drop_postgresql_database.in b/src/cats/drop_postgresql_database.in
index 92a85c7..6f19704 100644
--- a/src/cats/drop_postgresql_database.in
+++ b/src/cats/drop_postgresql_database.in
@@ -1,21 +1,9 @@
 #!/bin/sh
 #
-# shell script to drop Bacula database(s)
-#
-#
-#  Bacula® - The Network Backup Solution
-#
-#  Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #
-#  The main author of Bacula is Kern Sibbald, with contributions from many
-#  others, a complete list can be found in the file AUTHORS.
-#
-#  You may use this file and others of this release according to the
-#  license defined in the LICENSE file, which includes the Affero General
-#  Public License, v3.0 ("AGPLv3") and some additional permissions and
-#  terms pursuant to its AGPLv3 Section 7.
-#
-#  Bacula® is a registered trademark of Kern Sibbald.
+# shell script to drop Bacula database(s)
 #
 
 bindir=@POSTGRESQL_BINDIR@
diff --git a/src/cats/drop_postgresql_tables.in b/src/cats/drop_postgresql_tables.in
index 1df04e5..b34481d 100644
--- a/src/cats/drop_postgresql_tables.in
+++ b/src/cats/drop_postgresql_tables.in
@@ -1,21 +1,9 @@
 #!/bin/sh
 #
-# shell script to delete Bacula tables for PostgreSQL
-#
-#  Bacula® - The Network Backup Solution
-#
-#  Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
-#
-#  The main author of Bacula is Kern Sibbald, with contributions from many
-#  others, a complete list can be found in the file AUTHORS.
-#
-#  You may use this file and others of this release according to the
-#  license defined in the LICENSE file, which includes the Affero General
-#  Public License, v3.0 ("AGPLv3") and some additional permissions and
-#  terms pursuant to its AGPLv3 Section 7.
-#
-#  Bacula® is a registered trademark of Kern Sibbald.
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #
+# shell script to delete Bacula tables for PostgreSQL
 
 bindir=@POSTGRESQL_BINDIR@
 db_name=@db_name@
@@ -47,6 +35,7 @@ drop table locationlog;
 drop table PathVisibility;
 drop table PathHierarchy;
 drop table RestoreObject;
+drop table Snapshot;
 END-OF-DATA
 pstat=$?
 if test $pstat = 0; 
diff --git a/src/cats/drop_sqlite3_database.in b/src/cats/drop_sqlite3_database.in
index 44f446c..6eb856b 100644
--- a/src/cats/drop_sqlite3_database.in
+++ b/src/cats/drop_sqlite3_database.in
@@ -1,21 +1,9 @@
 #!/bin/sh
 #
-# shell script to drop Bacula SQLite tables
-#
-#  Bacula® - The Network Backup Solution
-#
-#  Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
-#
-#  The main author of Bacula is Kern Sibbald, with contributions from many
-#  others, a complete list can be found in the file AUTHORS.
-#
-#  You may use this file and others of this release according to the
-#  license defined in the LICENSE file, which includes the Affero General
-#  Public License, v3.0 ("AGPLv3") and some additional permissions and
-#  terms pursuant to its AGPLv3 Section 7.
-#
-#  Bacula® is a registered trademark of Kern Sibbald.
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #
+# shell script to drop Bacula SQLite tables
 db_name=@db_name@
 
 cd @working_dir@
diff --git a/src/cats/drop_sqlite3_tables.in b/src/cats/drop_sqlite3_tables.in
index ca74c92..64e55ed 100644
--- a/src/cats/drop_sqlite3_tables.in
+++ b/src/cats/drop_sqlite3_tables.in
@@ -1,23 +1,11 @@
 #!/bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # shell script to Delete the SQLite Bacula database (same as deleting 
 #  the tables)
 #
-#
-#  Bacula® - The Network Backup Solution
-#
-#  Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
-#
-#  The main author of Bacula is Kern Sibbald, with contributions from many
-#  others, a complete list can be found in the file AUTHORS.
-#
-#  You may use this file and others of this release according to the
-#  license defined in the LICENSE file, which includes the Affero General
-#  Public License, v3.0 ("AGPLv3") and some additional permissions and
-#  terms pursuant to its AGPLv3 Section 7.
-#
-#  Bacula® is a registered trademark of Kern Sibbald.
-#
 db_name=@db_name@
 
 rm -f @working_dir@/${db_name}.db
diff --git a/src/cats/grant_bacula_privileges.in b/src/cats/grant_bacula_privileges.in
index 793d106..d38a880 100755
--- a/src/cats/grant_bacula_privileges.in
+++ b/src/cats/grant_bacula_privileges.in
@@ -1,24 +1,15 @@
 #!/bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # This routine makes the appropriately configured
 # Bacula tables for PostgreSQL or MySQL.
 # SQLite does not have permissions.
 #
-#
-#  Bacula® - The Network Backup Solution
-#
-#  Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
-#
-#  The main author of Bacula is Kern Sibbald, with contributions from many
-#  others, a complete list can be found in the file AUTHORS.
-#
-#  You may use this file and others of this release according to the
-#  license defined in the LICENSE file, which includes the Affero General
-#  Public License, v3.0 ("AGPLv3") and some additional permissions and
-#  terms pursuant to its AGPLv3 Section 7.
-#
-#  Bacula® is a registered trademark of Kern Sibbald.
-#
+
+# can be used to change the current user with su
+pre_command="sh -c"
 
 default_db_type=@DEFAULT_DB_TYPE@
 
@@ -40,10 +31,6 @@ if [ $# -gt 0 ]; then
        db_type=$1
        shift
        ;;
-     ingres)
-       db_type=$1
-       shift
-       ;;
      *)
        ;;
    esac
@@ -56,5 +43,9 @@ if [ -z "${db_type}" ]; then
    db_type="${default_db_type}"
 fi
 
+if [ $db_type = postgresql -a "$UID" = 0 ]; then
+    pre_command="su - postgres -c"
+fi
+
 echo "Granting ${db_type} privileges"
- at scriptdir@/grant_${db_type}_privileges $*
+$pre_command "@scriptdir@/grant_${db_type}_privileges $*"
diff --git a/src/cats/grant_mysql_privileges.in b/src/cats/grant_mysql_privileges.in
index 40203ca..f1fcca5 100644
--- a/src/cats/grant_mysql_privileges.in
+++ b/src/cats/grant_mysql_privileges.in
@@ -2,20 +2,8 @@
 #
 # shell script to grant privileges to the bacula database
 #
-#
-#  Bacula® - The Network Backup Solution
-#
-#  Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
-#
-#  The main author of Bacula is Kern Sibbald, with contributions from many
-#  others, a complete list can be found in the file AUTHORS.
-#
-#  You may use this file and others of this release according to the
-#  license defined in the LICENSE file, which includes the Affero General
-#  Public License, v3.0 ("AGPLv3") and some additional permissions and
-#  terms pursuant to its AGPLv3 Section 7.
-#
-#  Bacula® is a registered trademark of Kern Sibbald.
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #
 db_user=${db_user:- at db_user@}
 bindir=@MYSQL_BINDIR@
diff --git a/src/cats/grant_postgresql_privileges.in b/src/cats/grant_postgresql_privileges.in
index 1e49c02..1528fe7 100644
--- a/src/cats/grant_postgresql_privileges.in
+++ b/src/cats/grant_postgresql_privileges.in
@@ -2,20 +2,8 @@
 #
 # shell script to grant privileges to the bacula database
 #
-#
-#  Bacula® - The Network Backup Solution
-#
-#  Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
-#
-#  The main author of Bacula is Kern Sibbald, with contributions from many
-#  others, a complete list can be found in the file AUTHORS.
-#
-#  You may use this file and others of this release according to the
-#  license defined in the LICENSE file, which includes the Affero General
-#  Public License, v3.0 ("AGPLv3") and some additional permissions and
-#  terms pursuant to its AGPLv3 Section 7.
-#
-#  Bacula® is a registered trademark of Kern Sibbald.
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #
 db_user=${db_user:- at db_user@}
 bindir=@POSTGRESQL_BINDIR@
@@ -30,6 +18,9 @@ $bindir/psql -f - -d ${db_name} $* <<END-OF-DATA
 
 create user ${db_user} ${pass};
 
+-- for the database
+alter database ${db_name} owner to ${db_user} ;
+
 -- for tables
 grant all on unsavedfiles to ${db_user};
 grant all on basefiles	  to ${db_user};
@@ -56,6 +47,7 @@ grant all on jobhisto	  to ${db_user};
 grant all on PathHierarchy  to ${db_user};
 grant all on PathVisibility to ${db_user};
 grant all on RestoreObject to ${db_user};
+grant all on Snapshot to ${db_user};
 -- for sequences on those tables
 
 grant select, update on filename_filenameid_seq    to ${db_user};
@@ -75,6 +67,7 @@ grant select, update on location_locationid_seq    to ${db_user};
 grant select, update on locationlog_loclogid_seq   to ${db_user};
 grant select, update on log_logid_seq		   to ${db_user};
 grant select, update on restoreobject_restoreobjectid_seq to ${db_user};
+grant select, update on snapshot_snapshotid_seq to ${db_user};
 END-OF-DATA
 if [ $? -eq 0 ]
 then
diff --git a/src/cats/grant_sqlite3_privileges.in b/src/cats/grant_sqlite3_privileges.in
index 6972835..41bdfc9 100644
--- a/src/cats/grant_sqlite3_privileges.in
+++ b/src/cats/grant_sqlite3_privileges.in
@@ -1,21 +1,9 @@
 #!/bin/sh
 #
-# shell script to grant privileges to the bacula database
-#
-#
-#  Bacula® - The Network Backup Solution
-#
-#  Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #
-#  The main author of Bacula is Kern Sibbald, with contributions from many
-#  others, a complete list can be found in the file AUTHORS.
-#
-#  You may use this file and others of this release according to the
-#  license defined in the LICENSE file, which includes the Affero General
-#  Public License, v3.0 ("AGPLv3") and some additional permissions and
-#  terms pursuant to its AGPLv3 Section 7.
-#
-#  Bacula® is a registered trademark of Kern Sibbald.
+# shell script to grant privileges to the bacula database
 #
 bindir=@SQLITE_BINDIR@
 
diff --git a/src/cats/install-default-backend.in b/src/cats/install-default-backend.in
index 0491d94..5001e63 100755
--- a/src/cats/install-default-backend.in
+++ b/src/cats/install-default-backend.in
@@ -1,20 +1,8 @@
 #!/bin/sh
 #
-#  Bacula® - The Network Backup Solution
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #
-#  Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
-#
-#  The main author of Bacula is Kern Sibbald, with contributions from many
-#  others, a complete list can be found in the file AUTHORS.
-#
-#  You may use this file and others of this release according to the
-#  license defined in the LICENSE file, which includes the Affero General
-#  Public License, v3.0 ("AGPLv3") and some additional permissions and
-#  terms pursuant to its AGPLv3 Section 7.
-#
-#  Bacula® is a registered trademark of Kern Sibbald.
-#
-
 
 LIBTOOL="@BUILD_DIR@/libtool"
 
diff --git a/src/cats/make_bacula_tables.in b/src/cats/make_bacula_tables.in
index 951e59d..0082ddf 100755
--- a/src/cats/make_bacula_tables.in
+++ b/src/cats/make_bacula_tables.in
@@ -1,23 +1,14 @@
 #!/bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # This routine makes the appropriately configured
 # Bacula tables for PostgreSQL, Ingres, MySQL, or SQLite.
 #
-#
-#  Bacula® - The Network Backup Solution
-#
-#  Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
-#
-#  The main author of Bacula is Kern Sibbald, with contributions from many
-#  others, a complete list can be found in the file AUTHORS.
-#
-#  You may use this file and others of this release according to the
-#  license defined in the LICENSE file, which includes the Affero General
-#  Public License, v3.0 ("AGPLv3") and some additional permissions and
-#  terms pursuant to its AGPLv3 Section 7.
-#
-#  Bacula® is a registered trademark of Kern Sibbald.
-#
+
+# can be used to change the current user with su
+pre_command="sh -c"
 
 default_db_type=@DEFAULT_DB_TYPE@
 
@@ -39,10 +30,6 @@ if [ $# -gt 0 ]; then
        db_type=$1
        shift
        ;;
-     ingres)
-       db_type=$1
-       shift
-       ;;
      *)
        ;;
    esac
@@ -55,5 +42,9 @@ if [ -z "${db_type}" ]; then
    db_type="${default_db_type}"
 fi
 
+if [ $db_type = postgresql -a "$UID" = 0 ]; then
+    pre_command="su - postgres -c"
+fi
+
 echo "Making ${db_type} tables"
- at scriptdir@/make_${db_type}_tables $*
+$pre_command "@scriptdir@/make_${db_type}_tables $*"
diff --git a/src/cats/make_catalog_backup.in b/src/cats/make_catalog_backup.in
index 9731732..637fcf7 100755
--- a/src/cats/make_catalog_backup.in
+++ b/src/cats/make_catalog_backup.in
@@ -1,19 +1,7 @@
 #!/bin/sh
 #
-#  Bacula® - The Network Backup Solution
-#
-#  Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
-#
-#  The main author of Bacula is Kern Sibbald, with contributions from many
-#  others, a complete list can be found in the file AUTHORS.
-#
-#  You may use this file and others of this release according to the
-#  license defined in the LICENSE file, which includes the Affero General
-#  Public License, v3.0 ("AGPLv3") and some additional permissions and
-#  terms pursuant to its AGPLv3 Section 7.
-#
-#  Bacula® is a registered trademark of Kern Sibbald.
-#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #
 # This script dumps your Bacula catalog in ASCII format
 # It works for MySQL, SQLite, and PostgreSQL
diff --git a/src/cats/make_catalog_backup.in.patch b/src/cats/make_catalog_backup.in.patch
new file mode 100644
index 0000000..46d1834
--- /dev/null
+++ b/src/cats/make_catalog_backup.in.patch
@@ -0,0 +1,13 @@
+--- make_catalog_backup.in      2006-12-09 10:17:05.000000000 -0500
++++ make_catalog_backup.in.fixed        2006-12-09 10:24:40.000000000 -0500
+@@ -56,8 +56,7 @@ rm -f $1.sql
+ 
+ case ${db_type} in
+   sqlite3)
+-    BINDIR=@SQLITE_BINDIR@
+-    echo ".dump" | ${BINDIR}/sqlite3 $1.db >$1.sql
++    echo ".dump" | /opt/bacula/sqlite/sqlite3 $1.db >$1.sql
+     ;;
+   mysql)
+     BINDIR=@MYSQL_BINDIR@
+
diff --git a/src/cats/make_catalog_backup.pl.in b/src/cats/make_catalog_backup.pl.in
index 9a322aa..675f176 100644
--- a/src/cats/make_catalog_backup.pl.in
+++ b/src/cats/make_catalog_backup.pl.in
@@ -1,4 +1,8 @@
 #!/usr/bin/env perl
+#
+# Author: Eric Bollengier, Copyright, 2006
+# License: BSD 2-Clause; see file LICENSE-FOSS
+
 use strict;
 
 =head1 SCRIPT
@@ -8,27 +12,21 @@ use strict;
 
 =head1 USAGE
 
-    make_catalog_backup.pl MyCatalog
+    make_catalog_backup.pl [-m] MyCatalog
 
 =head1 LICENSE
+   Author: Eric Bollengier, 2010
+   License: BSD 2-Clause; see file LICENSE-FOSS
+=cut
 
-   Bacula® - The Network Backup Solution
-
-   Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
-
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
-
-   You may use this file and others of this release according to the
-   license defined in the LICENSE file, which includes the Affero General
-   Public License, v3.0 ("AGPLv3") and some additional permissions and
-   terms pursuant to its AGPLv3 Section 7.
-
-   Bacula® is a registered trademark of Kern Sibbald.
+my $cat = shift or die "Usage: $0 [-m] catalogname";
+my $mode = "dump";
 
-=cut
+if ($cat eq '-m') {
+    $mode = "analyse";
+    $cat = shift or die "Usage: $0 [-m] catalogname";
+}
 
-my $cat = shift or die "Usage: $0 catalogname";
 my $dir_conf='@sbindir@/dbcheck -B -c @sysconfdir@/bacula-dir.conf';
 my $wd = "@working_dir@";
 
@@ -42,76 +40,122 @@ sub dump_sqlite3
 }
 
 # TODO: use just ENV and drop the pg_service.conf file
-sub dump_pgsql
+sub setup_env_pgsql
 {
     my %args = @_;
     umask(0077);
 
     if ($args{db_address}) {
-        $ENV{PGHOST}=$args{db_address};
+	$ENV{PGHOST}=$args{db_address};
     }
     if ($args{db_socket}) {
-        $ENV{PGHOST}=$args{db_socket};
+	$ENV{PGHOST}=$args{db_socket};
     }
     if ($args{db_port}) {
-        $ENV{PGPORT}=$args{db_port};
+	$ENV{PGPORT}=$args{db_port};
     }
     if ($args{db_user}) {
-        $ENV{PGUSER}=$args{db_user};
+	$ENV{PGUSER}=$args{db_user};
     }
     if ($args{db_password}) {
-        $ENV{PGPASSWORD}=$args{db_password};
+	$ENV{PGPASSWORD}=$args{db_password};
     }
     $ENV{PGDATABASE}=$args{db_name};
+}
+
+sub dump_pgsql
+{
+    my %args = @_;
+    setup_env_pgsql(%args);
     exec("HOME='$wd' pg_dump -c > '$wd/$args{db_name}.sql'");
     print "Error while executing postgres dump $!\n";
-    return 1;               # in case of error
+    return 1;		    # in case of error
 }
 
-sub dump_mysql
+sub analyse_pgsql
+{
+    my %args = @_;
+    setup_env_pgsql(%args);
+    my @output =`LANG=C HOME='$wd' vacuumdb -z 2>&1`;
+    my $exitcode = $? >> 8;
+    print grep { !/^WARNING:\s+skipping\s\"(pg_|sql_)/ } @output;
+    if ($exitcode != 0) {
+	print "Error while executing postgres analyse. Exitcode=$exitcode\n";
+    }
+    return $exitcode;
+}
+
+sub setup_env_mysql
 {
     my %args = @_;
     umask(0077);
     unlink("$wd/.my.cnf");
-    open(MY, ">$wd/.my.cnf")
-        or die "Can't open $wd/.my.cnf for writing $@";
+    open(MY, ">$wd/.my.cnf") 
+	or die "Can't open $wd/.my.cnf for writing $@";
 
     $args{db_address} = $args{db_address} || "localhost";
     my $addr = "host=$args{db_address}";
-    if ($args{db_socket}) {     # unix socket is fastest than net socket
-        $addr = "socket=$args{db_socket}";
+    if ($args{db_socket}) {	# unix socket is fastest than net socket
+	$addr = "socket=\"$args{db_socket}\"";
     }
-
-    print MY "[client]
+    my $mode = $args{mode} || 'client';
+    print MY "[$mode]
 $addr
-user=$args{db_user}
-password=$args{db_password}
+user=\"$args{db_user}\"
+password=\"$args{db_password}\"
 ";
     if ($args{db_port}) {
-        print MY "port=$args{db_port}\n";
+       print MY "port=$args{db_port}\n";
     }
-
     close(MY);
+}
+
+sub dump_mysql
+{
+    my %args = @_;
 
+    setup_env_mysql(%args);
     exec("HOME='$wd' mysqldump -f --opt $args{db_name} > '$wd/$args{db_name}.sql'");
     print "Error while executing mysql dump $!\n";
     return 1;
 }
 
-sub dump_catalog
+sub analyse_mysql
 {
     my %args = @_;
+
+    $args{mode} = 'mysqlcheck';
+    setup_env_mysql(%args);
+
+    exec("HOME='$wd' mysqlcheck -a $args{db_name}");
+    print "Error while executing mysql analyse $!\n";
+    return 1;
+}
+
+sub handle_catalog
+{
+    my ($mode, %args) = @_;
     if ($args{db_type} eq 'SQLite3') {
-        $ENV{PATH}="@SQLITE_BINDIR@:$ENV{PATH}";
-        dump_sqlite3(%args);
+	$ENV{PATH}="@SQLITE_BINDIR@:$ENV{PATH}";
+	if ($mode eq 'dump') {
+	    dump_sqlite3(%args);
+	}
     } elsif ($args{db_type} eq 'PostgreSQL') {
-        $ENV{PATH}="@POSTGRESQL_BINDIR@:$ENV{PATH}";
-        dump_pgsql(%args);
+	$ENV{PATH}="@POSTGRESQL_BINDIR@:$ENV{PATH}";
+	if ($mode eq 'dump') {
+	    dump_pgsql(%args);
+	} else {
+	    analyse_pgsql(%args);
+	}
     } elsif ($args{db_type} eq 'MySQL') {
-        $ENV{PATH}="@MYSQL_BINDIR@:$ENV{PATH}";
-        dump_mysql(%args);
+	$ENV{PATH}="@MYSQL_BINDIR@:$ENV{PATH}";
+	if ($mode eq 'dump') {
+	    dump_mysql(%args);
+	} else {
+	    analyse_mysql(%args);
+	}
     } else {
-        die "This database type isn't supported";
+	die "This database type isn't supported";
     }
 }
 
@@ -130,19 +174,19 @@ my %cfg;
 while(my $l = <FP>)
 {
     if ($l =~ /catalog=(.+)/) {
-        if (exists $cfg{catalog} and $cfg{catalog} eq $cat) {
-            exit dump_catalog(%cfg);
-        }
-        %cfg = ();              # reset
+	if (exists $cfg{catalog} and $cfg{catalog} eq $cat) {
+	    exit handle_catalog($mode, %cfg);
+	}
+	%cfg = ();		# reset
     }
 
     if ($l =~ /(\w+)=(.+)/) {
-        $cfg{$1}=$2;
+	$cfg{$1}=$2;
     }
 }
 
 if (exists $cfg{catalog} and $cfg{catalog} eq $cat) {
-    exit dump_catalog(%cfg);
+    exit handle_catalog($mode, %cfg);
 }
 
 print "Can't find your catalog ($cat) in director configuration\n";
diff --git a/src/cats/make_mysql_tables.in b/src/cats/make_mysql_tables.in
index 19c5cbf..788617d 100644
--- a/src/cats/make_mysql_tables.in
+++ b/src/cats/make_mysql_tables.in
@@ -2,30 +2,19 @@
 #
 # shell script to create Bacula MySQL tables
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # Important note: 
 #   You won't get any support for performance issue if you changed the default
 #   schema.
 #
-#
-#  Bacula® - The Network Backup Solution
-#
-#  Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
-#
-#  The main author of Bacula is Kern Sibbald, with contributions from many
-#  others, a complete list can be found in the file AUTHORS.
-#
-#  You may use this file and others of this release according to the
-#  license defined in the LICENSE file, which includes the Affero General
-#  Public License, v3.0 ("AGPLv3") and some additional permissions and
-#  terms pursuant to its AGPLv3 Section 7.
-#
-#  Bacula® is a registered trademark of Kern Sibbald.
-#
 bindir=@MYSQL_BINDIR@
 PATH="$bindir:$PATH"
 db_name=${db_name:- at db_name@}
 
-if mysql -D ${db_name} $* -f <<END-OF-DATA
+if mysql $* -f <<END-OF-DATA
+USE ${db_name};
 --
 -- Note, we use BLOB rather than TEXT because in MySQL,
 --  BLOBs are identical to TEXT except that BLOB is case
@@ -163,6 +152,7 @@ CREATE TABLE Job (
    HasCache TINYINT DEFAULT 0,
    Reviewed TINYINT DEFAULT 0,
    Comment BLOB,
+   FileTable CHAR(20) DEFAULT 'File',
    PRIMARY KEY(JobId),
    INDEX (Name(128))
    );
@@ -196,8 +186,10 @@ CREATE TABLE JobHisto (
    HasCache TINYINT DEFAULT 0,
    Reviewed TINYINT DEFAULT 0,
    Comment BLOB,
+   FileTable CHAR(20) DEFAULT 'File',
    INDEX (JobId),
-   INDEX (StartTime)
+   INDEX (StartTime),
+   INDEX (JobTDate)
    );
 
 CREATE TABLE Location (
@@ -262,9 +254,13 @@ CREATE TABLE Media (
    VolBlocks INTEGER UNSIGNED DEFAULT 0,
    VolMounts INTEGER UNSIGNED DEFAULT 0,
    VolBytes BIGINT UNSIGNED DEFAULT 0,
-   VolParts INTEGER UNSIGNED DEFAULT 0,
+   VolABytes BIGINT UNSIGNED DEFAULT 0,
+   VolAPadding BIGINT UNSIGNED DEFAULT 0,
+   VolHoleBytes BIGINT UNSIGNED DEFAULT 0,
+   VolHoles INTEGER UNSIGNED DEFAULT 0,
+   VolParts INTEGER UNSIGNED DEFAULT 0,   /* Now used for VolType */
    VolErrors INTEGER UNSIGNED DEFAULT 0,
-   VolWrites INTEGER UNSIGNED DEFAULT 0,
+   VolWrites BIGINT UNSIGNED DEFAULT 0,
    VolCapacityBytes BIGINT UNSIGNED DEFAULT 0,
    VolStatus ENUM('Full', 'Archive', 'Append', 'Recycle', 'Purged',
     'Read-Only', 'Disabled', 'Error', 'Busy', 'Used', 'Cleaning') NOT NULL,
@@ -292,7 +288,8 @@ CREATE TABLE Media (
    Comment BLOB,
    PRIMARY KEY(MediaId),
    UNIQUE (VolumeName(128)),
-   INDEX (PoolId)
+   INDEX (PoolId),
+   INDEX (StorageId)
    );
 
 CREATE TABLE Pool (
@@ -411,6 +408,7 @@ INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES
    ('t', 'Waiting on start time',15),
    ('p', 'Waiting on higher priority jobs',15),
    ('i', 'Doing batch insert file records',15),
+   ('I', 'Incomplete Job',25),
    ('a', 'SD despooling attributes',15);
 
 CREATE TABLE PathHierarchy
@@ -426,7 +424,7 @@ CREATE INDEX pathhierarchy_ppathid
 CREATE TABLE PathVisibility
 (
       PathId integer NOT NULL,
-      JobId integer NOT NULL,
+      JobId integer UNSIGNED NOT NULL,
       Size int8 DEFAULT 0,
       Files int4 DEFAULT 0,
       CONSTRAINT pathvisibility_pkey PRIMARY KEY (JobId, PathId)
@@ -434,12 +432,35 @@ CREATE TABLE PathVisibility
 CREATE INDEX pathvisibility_jobid
 	     ON PathVisibility (JobId);
 
+
+CREATE TABLE Snapshot (
+  SnapshotId	  INTEGER UNSIGNED AUTO_INCREMENT,
+  Name		  TINYBLOB NOT NULL,
+  JobId 	  INTEGER UNSIGNED DEFAULT 0,
+  FileSetId	  INTEGER UNSIGNED DEFAULT 0,
+  CreateTDate	  BIGINT   NOT NULL,
+  CreateDate	  DATETIME NOT NULL,
+  ClientId	  INTEGER UNSIGNED DEFAULT 0,
+  Volume	  TINYBLOB NOT NULL,
+  Device	  TINYBLOB NOT NULL,
+  Type		  TINYBLOB NOT NULL,
+  Retention	  INTEGER DEFAULT 0,
+  Comment	  BLOB,
+  primary key (SnapshotId)
+);
+
+CREATE UNIQUE INDEX snapshot_idx ON Snapshot (Device(255), 
+					      Volume(255),
+					      Name(255));
+
+
+
 CREATE TABLE Version (
    VersionId INTEGER UNSIGNED NOT NULL 
    );
 
 -- Initialize Version		 
-INSERT INTO Version (VersionId) VALUES (@BDB_VERSION@);
+INSERT INTO Version (VersionId) VALUES (15);
 
 END-OF-DATA
 then
diff --git a/src/cats/make_postgresql_tables.in b/src/cats/make_postgresql_tables.in
index bc5435c..5faba4b 100644
--- a/src/cats/make_postgresql_tables.in
+++ b/src/cats/make_postgresql_tables.in
@@ -2,25 +2,13 @@
 #
 # shell script to create Bacula PostgreSQL tables
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # Important note: 
 #   You won't get any support for performance issue if you changed the default
 #   schema.
 #
-#
-#  Bacula® - The Network Backup Solution
-#
-#  Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
-#
-#  The main author of Bacula is Kern Sibbald, with contributions from many
-#  others, a complete list can be found in the file AUTHORS.
-#
-#  You may use this file and others of this release according to the
-#  license defined in the LICENSE file, which includes the Affero General
-#  Public License, v3.0 ("AGPLv3") and some additional permissions and
-#  terms pursuant to its AGPLv3 Section 7.
-#
-#  Bacula® is a registered trademark of Kern Sibbald.
-#
 bindir=@POSTGRESQL_BINDIR@
 PATH="$bindir:$PATH"
 db_name=${db_name:- at db_name@}
@@ -35,7 +23,7 @@ CREATE TABLE Filename
 );
 
 ALTER TABLE Filename ALTER COLUMN Name SET STATISTICS 1000;
-CREATE UNIQUE INDEX filename_name_idx on Filename (Name);
+CREATE UNIQUE INDEX filename_name_idx on Filename (Name text_pattern_ops);
 
 CREATE TABLE Path
 (
@@ -45,7 +33,7 @@ CREATE TABLE Path
 );
 
 ALTER TABLE Path ALTER COLUMN Path SET STATISTICS 1000;
-CREATE UNIQUE INDEX path_name_idx on Path (Path);
+CREATE UNIQUE INDEX path_name_idx on Path (Path text_pattern_ops);
 
 -- We strongly recommend to avoid the temptation to add new indexes.
 -- In general, these will cause very significant performance
@@ -81,7 +69,7 @@ CREATE INDEX file_jobid_idx on File (JobId);
 --
 -- Add this if you have a good number of job
 -- that run at the same time
--- ALTER SEQUENCE file_fileid_seq CACHE 1000;
+-- ALTER SEQUENCE file_fileid_seq CACHE 10;
 
 --
 -- Possibly add one or more of the following indexes
@@ -137,10 +125,11 @@ CREATE TABLE Job
     HasCache	      smallint	  default 0,
     Reviewed	      smallint	  default 0,
     Comment	      text,
+    FileTable	      text	  default 'File',
     primary key (jobid)
 );
 
-CREATE INDEX job_name_idx on job (name);
+CREATE INDEX job_name_idx on job (name text_pattern_ops);
 
 -- Create a table like Job for long term statistics 
 CREATE TABLE JobHisto (LIKE Job);
@@ -165,7 +154,7 @@ CREATE TABLE fileset
     primary key (filesetid)
 );
 
-CREATE INDEX fileset_name_idx on fileset (fileset);
+CREATE INDEX fileset_name_idx on fileset (fileset text_pattern_ops);
 
 CREATE TABLE jobmedia
 (
@@ -201,9 +190,13 @@ CREATE TABLE media
     volblocks	      integer	  default 0,
     volmounts	      integer	  default 0,
     volbytes	      bigint	  default 0,
-    volparts	      integer	  default 0,
+    volabytes	      bigint	  default 0,
+    volapadding       bigint	  default 0,
+    volholebytes      bigint	  default 0,
+    volholes	      integer	  default 0,
+    volparts	      integer	  default 0,   /* Now used for VolType */
     volerrors	      integer	  default 0,
-    volwrites	      integer	  default 0,
+    volwrites	      bigint	  default 0,
     volcapacitybytes  bigint	  default 0,
     volstatus	      text	  not null
 	check (volstatus in ('Full','Archive','Append',
@@ -234,9 +227,9 @@ CREATE TABLE media
     primary key (mediaid)
 );
 
-CREATE UNIQUE INDEX media_volumename_id ON Media (VolumeName);
+CREATE UNIQUE INDEX media_volumename_id ON Media (VolumeName text_pattern_ops);
 CREATE INDEX media_poolid_idx ON Media (PoolId);
-
+CREATE INDEX media_storageid_idx ON Media (StorageId);
  
 CREATE TABLE MediaType (
    MediaTypeId SERIAL,
@@ -303,7 +296,7 @@ CREATE TABLE pool
     primary key (poolid)
 );
 
-CREATE INDEX pool_name_idx on pool (name);
+CREATE INDEX pool_name_idx on pool (name text_pattern_ops);
 
 CREATE TABLE client
 (
@@ -316,7 +309,7 @@ CREATE TABLE client
     primary key (clientid)
 );
 
-create unique index client_name_idx on client (name);
+create unique index client_name_idx on client (name text_pattern_ops);
 
 CREATE TABLE Log
 (
@@ -460,8 +453,30 @@ INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES
    ('a', 'SD despooling attributes',15);
 INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES
    ('i', 'Doing batch insert file records',15);
+INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES
+   ('I', 'Incomplete Job',25);
+
+CREATE TABLE Snapshot (
+  SnapshotId	  serial,
+  Name		  text not null,
+  JobId 	  integer default 0,
+  FileSetId	  integer default 0,
+  CreateTDate	  bigint default 0,
+  CreateDate	  timestamp without time zone not null,
+  ClientId	  int default 0,
+  Volume	  text not null,
+  Device	  text not null,
+  Type		  text not null,
+  Retention	  integer default 0,
+  Comment	  text,
+  primary key (SnapshotId)
+);
+
+CREATE UNIQUE INDEX snapshot_idx ON Snapshot (Device text_pattern_ops, 
+					      Volume text_pattern_ops,
+					      Name text_pattern_ops);
 
-INSERT INTO Version (VersionId) VALUES (@BDB_VERSION@);
+INSERT INTO Version (VersionId) VALUES (15);
 
 -- Make sure we have appropriate permissions
 
diff --git a/src/cats/make_sqlite3_tables.in b/src/cats/make_sqlite3_tables.in
index b87be08..5b4322b 100644
--- a/src/cats/make_sqlite3_tables.in
+++ b/src/cats/make_sqlite3_tables.in
@@ -2,19 +2,8 @@
 #
 # shell script to create Bacula SQLite tables
 #
-#  Bacula® - The Network Backup Solution
-#
-#  Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
-#
-#  The main author of Bacula is Kern Sibbald, with contributions from many
-#  others, a complete list can be found in the file AUTHORS.
-#
-#  You may use this file and others of this release according to the
-#  license defined in the LICENSE file, which includes the Affero General
-#  Public License, v3.0 ("AGPLv3") and some additional permissions and
-#  terms pursuant to its AGPLv3 Section 7.
-#
-#  Bacula® is a registered trademark of Kern Sibbald.
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #
 
 bindir=@SQLITE_BINDIR@
@@ -109,6 +98,7 @@ CREATE TABLE Job (
    HasCache TINYINT DEFAULT 0,
    Reviewed TINYINT DEFAULT 0,
    Comment TEXT,
+   FileTable TEXT DEFAULT 'File',
    PRIMARY KEY(JobId) 
    );
 CREATE INDEX inx6 ON Job (Name);
@@ -141,7 +131,8 @@ CREATE TABLE JobHisto (
    HasBase TINYINT DEFAULT 0,
    HasCache TINYINT DEFAULT 0,
    Reviewed TINYINT DEFAULT 0,
-   Comment TEXT
+   Comment TEXT,
+   FileTable TEXT DEFAULT 'File'
    );
 CREATE INDEX inx61 ON JobHisto (StartTime);
 
@@ -216,9 +207,13 @@ CREATE TABLE Media (
    VolBlocks INTEGER UNSIGNED DEFAULT 0,
    VolMounts INTEGER UNSIGNED DEFAULT 0,
    VolBytes BIGINT UNSIGNED DEFAULT 0,
-   VolParts INTEGER UNSIGNED DEFAULT 0,
+   VolABytes BIGINT UNSIGNED DEFAULT 0,
+   VolAPadding BIGINT UNSIGNED DEFAULT 0,
+   VolHoleBytes BIGINT UNSIGNED DEFAULT 0,
+   VolHoles INTEGER UNSIGNED DEFAULT 0,
+   VolParts INTEGER UNSIGNED DEFAULT 0,    /* Now used for VolType */
    VolErrors INTEGER UNSIGNED DEFAULT 0,
-   VolWrites INTEGER UNSIGNED DEFAULT 0,
+   VolWrites BIGINT UNSIGNED DEFAULT 0,
    VolCapacityBytes BIGINT UNSIGNED DEFAULT 0,
    VolStatus VARCHAR(20) NOT NULL,
    Enabled TINYINT DEFAULT 1,
@@ -247,6 +242,8 @@ CREATE TABLE Media (
    );
 
 CREATE INDEX inx8 ON Media (PoolId);
+CREATE INDEX inx9 ON Media (StorageId);
+
 
 CREATE TABLE MediaType (
    MediaTypeId INTEGER,
@@ -397,6 +394,25 @@ CREATE TABLE PathVisibility
 CREATE INDEX pathvisibility_jobid
 	  ON PathVisibility (JobId);
 
+
+CREATE TABLE Snapshot (
+  SnapshotId	  serial,
+  Name		  text NOT NULL,
+  JobId 	  integer default 0,
+  FileSetId	  integer default 0,
+  CreateTDate	  bigint default 0,
+  CreateDate	  datetime not null,
+  ClientId	  int default 0,
+  Volume	  text not null,
+  Device	  text not null,
+  Type		  text not null,
+  Retention	  int default 0,
+  Comment	  text,
+  primary key (SnapshotId)
+);
+
+CREATE UNIQUE INDEX snapshot_idx ON Snapshot (Device, Volume, Name);
+
 CREATE TABLE Status (
    JobStatus CHAR(1) NOT NULL,
    JobStatusLong BLOB, 
@@ -446,11 +462,11 @@ INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES
    ('a', 'SD despooling attributes',15);
 INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES
    ('i', 'Doing batch insert file records',15);
-
+INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES
+   ('I', 'Incomplete Job',25);
 
 -- Initialize Version		 
-INSERT INTO Version (VersionId) VALUES (@BDB_VERSION@);
-
+INSERT INTO Version (VersionId) VALUES (15);
 
 PRAGMA default_cache_size = 100000;
 PRAGMA synchronous = NORMAL;
diff --git a/src/cats/make_sqlite3_tables.in.patch b/src/cats/make_sqlite3_tables.in.patch
deleted file mode 100644
index f9a9508..0000000
--- a/src/cats/make_sqlite3_tables.in.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- ./make_sqlite3_tables.in	2010-01-25 02:56:28.000000000 -0500
-+++ ../../../bacula-5.0.0-fixed/src/cats/make_sqlite3_tables.in	2010-01-31 10:09:50.000000000 -0500
-@@ -2,7 +2,7 @@
- #
- # shell script to create Bacula SQLite tables
- 
--bindir=@SQLITE_BINDIR@
-+bindir=/usr/lib/bacula/sqlite
- PATH="$bindir:$PATH"
- cd @working_dir@
- db_name=@db_name@
-
diff --git a/src/cats/mysql.c b/src/cats/mysql.c
index 496bb8b..2cc45c4 100644
--- a/src/cats/mysql.c
+++ b/src/cats/mysql.c
@@ -1,706 +1,721 @@
-/*
-   Bacula® - The Network Backup Solution
+/* 
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
-/*
- * Bacula Catalog Database routines specific to MySQL
- *   These are MySQL specific routines -- hopefully all
- *    other files are generic.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/ 
+/* 
+ * Bacula Catalog Database routines specific to MySQL 
+ *   These are MySQL specific routines -- hopefully all 
+ *    other files are generic. 
+ * 
+ *    Written by Kern Sibbald, March 2000 
  *
- *    Written by Kern Sibbald, March 2000
- *
- *  Class wrapper by Marco van Wieringen, January 2010
- */
-
-#include "bacula.h"
-
-#ifdef HAVE_MYSQL
-
-#include "cats.h"
-#include "bdb_priv.h"
-#include <mysql.h>
-#include <bdb_mysql.h>
-
-/* -----------------------------------------------------------------------
- *
- *   MySQL dependent defines and subroutines
- *
- * -----------------------------------------------------------------------
- */
-
-/*
- * List of open databases
- */
-static dlist *db_list = NULL;
-
-static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
-
-B_DB_MYSQL::B_DB_MYSQL(JCR *jcr,
-                       const char *db_driver,
-                       const char *db_name,
-                       const char *db_user,
-                       const char *db_password,
-                       const char *db_address,
-                       int db_port,
-                       const char *db_socket,
-                       bool mult_db_connections,
-                       bool disable_batch_insert)
-{
-   /*
-    * Initialize the parent class members.
-    */
-   m_db_interface_type = SQL_INTERFACE_TYPE_MYSQL;
-   m_db_type = SQL_TYPE_MYSQL;
-   m_db_driver = bstrdup("MySQL");
-   m_db_name = bstrdup(db_name);
-   m_db_user = bstrdup(db_user);
-   if (db_password) {
-      m_db_password = bstrdup(db_password);
-   }
-   if (db_address) {
-      m_db_address = bstrdup(db_address);
-   }
-   if (db_socket) {
-      m_db_socket = bstrdup(db_socket);
-   }
-   m_db_port = db_port;
-
-   if (disable_batch_insert) {
-      m_disabled_batch_insert = true;
-      m_have_batch_insert = false;
-   } else {
-      m_disabled_batch_insert = false;
-#if defined(USE_BATCH_FILE_INSERT)
-# if defined(HAVE_MYSQL_THREAD_SAFE)
-      m_have_batch_insert = mysql_thread_safe();
-# else
-      m_have_batch_insert = false;
-# endif /* HAVE_MYSQL_THREAD_SAFE */
-#else
-      m_have_batch_insert = false;
-#endif /* USE_BATCH_FILE_INSERT */
-   }
-   errmsg = get_pool_memory(PM_EMSG); /* get error message buffer */
-   *errmsg = 0;
-   cmd = get_pool_memory(PM_EMSG);    /* get command buffer */
-   cached_path = get_pool_memory(PM_FNAME);
-   cached_path_id = 0;
-   m_ref_count = 1;
-   fname = get_pool_memory(PM_FNAME);
-   path = get_pool_memory(PM_FNAME);
-   esc_name = get_pool_memory(PM_FNAME);
-   esc_path = get_pool_memory(PM_FNAME);
-   esc_obj = get_pool_memory(PM_FNAME);
-   m_allow_transactions = mult_db_connections;
-
-   /* At this time, when mult_db_connections == true, this is for
-    * specific console command such as bvfs or batch mode, and we don't
-    * want to share a batch mode or bvfs. In the future, we can change
-    * the creation function to add this parameter.
-    */
-   m_dedicated = mult_db_connections;
-
-   /*
-    * Initialize the private members.
-    */
-   m_db_handle = NULL;
-   m_result = NULL;
-
-   /*
-    * Put the db in the list.
-    */
-   if (db_list == NULL) {
-      db_list = New(dlist(this, &this->m_link));
-   }
-   db_list->append(this);
-}
-
-B_DB_MYSQL::~B_DB_MYSQL()
-{
-}
-
-/*
- * Now actually open the database.  This can generate errors,
- *  which are returned in the errmsg
- *
- * DO NOT close the database or delete mdb here !!!!
- */
-bool B_DB_MYSQL::db_open_database(JCR *jcr)
-{
-   bool retval = false;
-   int errstat;
-
-   P(mutex);
-   if (m_connected) {
-      retval = true;
-      goto bail_out;
-   }
-
-   if ((errstat=rwl_init(&m_lock)) != 0) {
-      berrno be;
-      Mmsg1(&errmsg, _("Unable to initialize DB lock. ERR=%s\n"),
-            be.bstrerror(errstat));
-      goto bail_out;
-   }
-
-   /*
-    * Connect to the database
-    */
-#ifdef xHAVE_EMBEDDED_MYSQL
-// mysql_server_init(0, NULL, NULL);
-#endif
-   mysql_init(&m_instance);
-
-   Dmsg0(50, "mysql_init done\n");
-   /*
-    * If connection fails, try at 5 sec intervals for 30 seconds.
-    */
-   for (int retry=0; retry < 6; retry++) {
-      m_db_handle = mysql_real_connect(
-           &(m_instance),           /* db */
-           m_db_address,            /* default = localhost */
-           m_db_user,               /* login name */
-           m_db_password,           /* password */
-           m_db_name,               /* database name */
-           m_db_port,               /* default port */
-           m_db_socket,             /* default = socket */
-           CLIENT_FOUND_ROWS);      /* flags */
-
-      /*
-       * If no connect, try once more in case it is a timing problem
-       */
-      if (m_db_handle != NULL) {
-         break;
-      }
-      bmicrosleep(5,0);
-   }
-
-   m_instance.reconnect = 1;             /* so connection does not timeout */
-   Dmsg0(50, "mysql_real_connect done\n");
-   Dmsg3(50, "db_user=%s db_name=%s db_password=%s\n", m_db_user, m_db_name,
-        (m_db_password == NULL) ? "(NULL)" : m_db_password);
-
-   if (m_db_handle == NULL) {
-      Mmsg2(&errmsg, _("Unable to connect to MySQL server.\n"
-"Database=%s User=%s\n"
-"MySQL connect failed either server not running or your authorization is incorrect.\n"),
-         m_db_name, m_db_user);
-#if MYSQL_VERSION_ID >= 40101
-      Dmsg3(50, "Error %u (%s): %s\n",
-            mysql_errno(&(m_instance)), mysql_sqlstate(&(m_instance)),
-            mysql_error(&(m_instance)));
-#else
-      Dmsg2(50, "Error %u: %s\n",
-            mysql_errno(&(m_instance)), mysql_error(&(m_instance)));
-#endif
-      goto bail_out;
-   }
-
-   m_connected = true;
-   if (!check_tables_version(jcr, this)) {
-      goto bail_out;
-   }
-
-   Dmsg3(100, "opendb ref=%d connected=%d db=%p\n", m_ref_count, m_connected, m_db_handle);
-
-   /*
-    * Set connection timeout to 8 days specialy for batch mode
-    */
-   sql_query("SET wait_timeout=691200");
-   sql_query("SET interactive_timeout=691200");
-
-   retval = true;
-
-bail_out:
-   V(mutex);
-   return retval;
-}
-
-void B_DB_MYSQL::db_close_database(JCR *jcr)
-{
-   if (m_connected) {
-      db_end_transaction(jcr);
-   }
-   P(mutex);
-   m_ref_count--;
-   Dmsg3(100, "closedb ref=%d connected=%d db=%p\n", m_ref_count, m_connected, m_db_handle);
-   if (m_ref_count == 0) {
-      if (m_connected) {
-         sql_free_result();
-      }
-      db_list->remove(this);
-      if (m_connected) {
-         Dmsg1(100, "close db=%p\n", m_db_handle);
-         mysql_close(&m_instance);
-
-#ifdef xHAVE_EMBEDDED_MYSQL
-//       mysql_server_end();
-#endif
-      }
-      if (rwl_is_init(&m_lock)) {
-         rwl_destroy(&m_lock);
-      }
-      free_pool_memory(errmsg);
-      free_pool_memory(cmd);
-      free_pool_memory(cached_path);
-      free_pool_memory(fname);
-      free_pool_memory(path);
-      free_pool_memory(esc_name);
-      free_pool_memory(esc_path);
-      free_pool_memory(esc_obj);
-      if (m_db_driver) {
-         free(m_db_driver);
-      }
-      if (m_db_name) {
-         free(m_db_name);
-      }
-      if (m_db_user) {
-         free(m_db_user);
-      }
-      if (m_db_password) {
-         free(m_db_password);
-      }
-      if (m_db_address) {
-         free(m_db_address);
-      }
-      if (m_db_socket) {
-         free(m_db_socket);
-      }
-      delete this;
-      if (db_list->size() == 0) {
-         delete db_list;
-         db_list = NULL;
-      }
-   }
-   V(mutex);
-}
-
-/*
- * This call is needed because the message channel thread
- *  opens a database on behalf of a jcr that was created in
- *  a different thread. MySQL then allocates thread specific
- *  data, which is NOT freed when the original jcr thread
- *  closes the database.  Thus the msgchan must call here
- *  to cleanup any thread specific data that it created.
- */
-void B_DB_MYSQL::db_thread_cleanup(void)
-{
-#ifndef HAVE_WIN32
-   mysql_thread_end();
-#endif
-}
-
-/*
- * Escape strings so that MySQL is happy
- *
- *   NOTE! len is the length of the old string. Your new
- *         string must be long enough (max 2*old+1) to hold
- *         the escaped output.
- */
-void B_DB_MYSQL::db_escape_string(JCR *jcr, char *snew, char *old, int len)
-{
-   mysql_real_escape_string(m_db_handle, snew, old, len);
-}
-
-/*
- * Escape binary object so that MySQL is happy
- * Memory is stored in B_DB struct, no need to free it
- */
-char *B_DB_MYSQL::db_escape_object(JCR *jcr, char *old, int len)
-{
-   esc_obj = check_pool_memory_size(esc_obj, len*2+1);
-   mysql_real_escape_string(m_db_handle, esc_obj, old, len);
-   return esc_obj;
-}
-
-/*
- * Unescape binary object so that MySQL is happy
- */
-void B_DB_MYSQL::db_unescape_object(JCR *jcr, char *from, int32_t expected_len,
-                                    POOLMEM **dest, int32_t *dest_len)
-{
-   if (!from) {
-      *dest[0] = 0;
-      *dest_len = 0;
-      return;
-   }
-   *dest = check_pool_memory_size(*dest, expected_len+1);
-   *dest_len = expected_len;
-   memcpy(*dest, from, expected_len);
-   (*dest)[expected_len]=0;
-}
-
-void B_DB_MYSQL::db_start_transaction(JCR *jcr)
-{
-   if (!jcr->attr) {
-      jcr->attr = get_pool_memory(PM_FNAME);
-   }
-   if (!jcr->ar) {
-      jcr->ar = (ATTR_DBR *)malloc(sizeof(ATTR_DBR));
-   }
-}
-
-void B_DB_MYSQL::db_end_transaction(JCR *jcr)
-{
-   if (jcr && jcr->cached_attribute) {
-      Dmsg0(400, "Flush last cached attribute.\n");
-      if (!db_create_attributes_record(jcr, this, jcr->ar)) {
-         Jmsg1(jcr, M_FATAL, 0, _("Attribute create error. %s"), db_strerror(jcr->db));
-      }
-      jcr->cached_attribute = false;
-   }
-}
-
-/*
- * Submit a general SQL command (cmd), and for each row returned,
- * the result_handler is called with the ctx.
- */
-bool B_DB_MYSQL::db_sql_query(const char *query, DB_RESULT_HANDLER *result_handler, void *ctx)
-{
-   int ret;
-   SQL_ROW row;
-   bool send = true;
-   bool retval = false;
-
-   Dmsg1(500, "db_sql_query starts with %s\n", query);
-
-   db_lock(this);
-   ret = mysql_query(m_db_handle, query);
-   if (ret != 0) {
-      Mmsg(errmsg, _("Query failed: %s: ERR=%s\n"), query, sql_strerror());
-      Dmsg0(500, "db_sql_query failed\n");
-      goto bail_out;
-   }
-
-   Dmsg0(500, "db_sql_query succeeded. checking handler\n");
-
-   if (result_handler != NULL) {
-      if ((m_result = mysql_use_result(m_db_handle)) != NULL) {
-         m_num_fields = mysql_num_fields(m_result);
-
-         /*
-          * We *must* fetch all rows
-          */
-         while ((row = mysql_fetch_row(m_result)) != NULL) {
-            if (send) {
-               /* the result handler returns 1 when it has
-                *  seen all the data it wants.  However, we
-                *  loop to the end of the data.
-                */
-               if (result_handler(ctx, m_num_fields, row)) {
-                  send = false;
-               }
-            }
-         }
-         sql_free_result();
-      }
-   }
-
-   Dmsg0(500, "db_sql_query finished\n");
-   retval = true;
-
-bail_out:
-   db_unlock(this);
-   return retval;
-}
-
-bool B_DB_MYSQL::sql_query(const char *query, int flags)
-{
-   int ret;
-   bool retval = true;
-
-   Dmsg1(500, "sql_query starts with '%s'\n", query);
-   /*
-    * We are starting a new query. reset everything.
-    */
-   m_num_rows     = -1;
-   m_row_number   = -1;
-   m_field_number = -1;
-
-   if (m_result) {
-      mysql_free_result(m_result);
-      m_result = NULL;
-   }
-
-   ret = mysql_query(m_db_handle, query);
-   if (ret == 0) {
-      Dmsg0(500, "we have a result\n");
-      if (flags & QF_STORE_RESULT) {
-         m_result = mysql_store_result(m_db_handle);
-         if (m_result != NULL) {
-            m_num_fields = mysql_num_fields(m_result);
-            Dmsg1(500, "we have %d fields\n", m_num_fields);
-            m_num_rows = mysql_num_rows(m_result);
-            Dmsg1(500, "we have %d rows\n", m_num_rows);
-         } else {
-            m_num_fields = 0;
-            m_num_rows = mysql_affected_rows(m_db_handle);
-            Dmsg1(500, "we have %d rows\n", m_num_rows);
-         }
-      } else {
-         m_num_fields = 0;
-         m_num_rows = mysql_affected_rows(m_db_handle);
-         Dmsg1(500, "we have %d rows\n", m_num_rows);
-      }
-   } else {
-      Dmsg0(500, "we failed\n");
-      m_status = 1;                   /* failed */
-      retval = false;
-   }
-   return retval;
-}
-
-void B_DB_MYSQL::sql_free_result(void)
-{
-   db_lock(this);
-   if (m_result) {
-      mysql_free_result(m_result);
-      m_result = NULL;
-   }
-   if (m_fields) {
-      free(m_fields);
-      m_fields = NULL;
-   }
-   m_num_rows = m_num_fields = 0;
-   db_unlock(this);
-}
-
-SQL_ROW B_DB_MYSQL::sql_fetch_row(void)
-{
-   if (!m_result) {
-      return NULL;
-   } else {
-      return mysql_fetch_row(m_result);
-   }
-}
-
-const char *B_DB_MYSQL::sql_strerror(void)
-{
-   return mysql_error(m_db_handle);
-}
-
-void B_DB_MYSQL::sql_data_seek(int row)
-{
-   return mysql_data_seek(m_result, row);
-}
-
-int B_DB_MYSQL::sql_affected_rows(void)
-{
-   return mysql_affected_rows(m_db_handle);
-}
-
-uint64_t B_DB_MYSQL::sql_insert_autokey_record(const char *query, const char *table_name)
-{
-   /*
-    * First execute the insert query and then retrieve the currval.
-    */
-   if (mysql_query(m_db_handle, query) != 0) {
-      return 0;
-   }
-
-   m_num_rows = mysql_affected_rows(m_db_handle);
-   if (m_num_rows != 1) {
-      return 0;
-   }
-
-   changes++;
-
-   return mysql_insert_id(m_db_handle);
-}
-
-SQL_FIELD *B_DB_MYSQL::sql_fetch_field(void)
-{
-   int i;
-   MYSQL_FIELD *field;
-
-   if (!m_fields || m_fields_size < m_num_fields) {
-      if (m_fields) {
-         free(m_fields);
-         m_fields = NULL;
-      }
-      Dmsg1(500, "allocating space for %d fields\n", m_num_fields);
-      m_fields = (SQL_FIELD *)malloc(sizeof(SQL_FIELD) * m_num_fields);
-      m_fields_size = m_num_fields;
-
-      for (i = 0; i < m_num_fields; i++) {
-         Dmsg1(500, "filling field %d\n", i);
-         if ((field = mysql_fetch_field(m_result)) != NULL) {
-            m_fields[i].name = field->name;
-            m_fields[i].max_length = field->max_length;
-            m_fields[i].type = field->type;
-            m_fields[i].flags = field->flags;
-
-            Dmsg4(500, "sql_fetch_field finds field '%s' has length='%d' type='%d' and IsNull=%d\n",
-                  m_fields[i].name, m_fields[i].max_length, m_fields[i].type, m_fields[i].flags);
-         }
-      }
-   }
-
-   /*
-    * Increment field number for the next time around
-    */
-   return &m_fields[m_field_number++];
-}
-
-bool B_DB_MYSQL::sql_field_is_not_null(int field_type)
-{
-   return IS_NOT_NULL(field_type);
-}
-
-bool B_DB_MYSQL::sql_field_is_numeric(int field_type)
-{
-   return IS_NUM(field_type);
-}
-
-/*
- * Returns true if OK
- *         false if failed
- */
-bool B_DB_MYSQL::sql_batch_start(JCR *jcr)
-{
-   bool retval;
-
-   db_lock(this);
-   retval = sql_query("CREATE TEMPORARY TABLE batch ("
-                              "FileIndex integer,"
-                              "JobId integer,"
-                              "Path blob,"
-                              "Name blob,"
-                              "LStat tinyblob,"
-                              "MD5 tinyblob,"
-                              "DeltaSeq integer)");
-   db_unlock(this);
-
-   /*
-    * Keep track of the number of changes in batch mode.
-    */
-   changes = 0;
-
-   return retval;
-}
-
-/* set error to something to abort operation */
-/*
- * Returns true if OK
- *         false if failed
- */
-bool B_DB_MYSQL::sql_batch_end(JCR *jcr, const char *error)
-{
-   m_status = 0;
-
-   /*
-    * Flush any pending inserts.
-    */
-   if (changes) {
-      return sql_query(cmd);
-   }
-
-   return true;
-}
-
-/*
- * Returns true if OK
- *         false if failed
- */
-bool B_DB_MYSQL::sql_batch_insert(JCR *jcr, ATTR_DBR *ar)
-{
-   const char *digest;
-   char ed1[50];
-
-   esc_name = check_pool_memory_size(esc_name, fnl*2+1);
-   db_escape_string(jcr, esc_name, fname, fnl);
-
-   esc_path = check_pool_memory_size(esc_path, pnl*2+1);
-   db_escape_string(jcr, esc_path, path, pnl);
-
-   if (ar->Digest == NULL || ar->Digest[0] == 0) {
-      digest = "0";
-   } else {
-      digest = ar->Digest;
-   }
-
-   /*
-    * Try to batch up multiple inserts using multi-row inserts.
-    */
-   if (changes == 0) {
-      Mmsg(cmd, "INSERT INTO batch VALUES "
-           "(%u,%s,'%s','%s','%s','%s',%u)",
-           ar->FileIndex, edit_int64(ar->JobId,ed1), esc_path,
-           esc_name, ar->attr, digest, ar->DeltaSeq);
-      changes++;
-   } else {
-      /*
-       * We use the esc_obj for temporary storage otherwise
-       * we keep on copying data.
-       */
-      Mmsg(esc_obj, ",(%u,%s,'%s','%s','%s','%s',%u)",
-           ar->FileIndex, edit_int64(ar->JobId,ed1), esc_path,
-           esc_name, ar->attr, digest, ar->DeltaSeq);
-      pm_strcat(cmd, esc_obj);
-      changes++;
-   }
-
-   /*
-    * See if we need to flush the query buffer filled
-    * with multi-row inserts.
-    */
-   if ((changes % MYSQL_CHANGES_PER_BATCH_INSERT) == 0) {
-      if (!sql_query(cmd)) {
-         changes = 0;
-         return false;
-      } else {
-         changes = 0;
-      }
-   }
-   return true;
-}
-
-/*
- * Initialize database data structure. In principal this should
- * never have errors, or it is really fatal.
- */
-B_DB *db_init_database(JCR *jcr, const char *db_driver, const char *db_name, const char *db_user,
-                       const char *db_password, const char *db_address, int db_port, const char *db_socket,
-                       bool mult_db_connections, bool disable_batch_insert)
-{
-   B_DB_MYSQL *mdb = NULL;
-
-   if (!db_user) {
-      Jmsg(jcr, M_FATAL, 0, _("A user name for MySQL must be supplied.\n"));
-      return NULL;
-   }
-   P(mutex);                          /* lock DB queue */
-
-   /*
-    * Look to see if DB already open
-    */
-   if (db_list && !mult_db_connections) {
-      foreach_dlist(mdb, db_list) {
-         if (mdb->db_match_database(db_driver, db_name, db_address, db_port)) {
-            Dmsg1(100, "DB REopen %s\n", db_name);
-            mdb->increment_refcount();
-            goto bail_out;
-         }
-      }
-   }
-   Dmsg0(100, "db_init_database first time\n");
-   mdb = New(B_DB_MYSQL(jcr, db_driver, db_name, db_user, db_password, db_address,
-                        db_port, db_socket, mult_db_connections, disable_batch_insert));
-
-bail_out:
-   V(mutex);
-   return mdb;
-}
-
-#endif /* HAVE_MYSQL */
+ * Note: at one point, this file was changed to class based by a certain   
+ *  programmer, and other than "wrapping" in a class, which is a trivial  
+ *  change for a C++ programmer, nothing substantial was done, yet all the  
+ *  code was recommitted under this programmer's name.  Consequently, we  
+ *  undo those changes here.  
+ * 
+ */ 
+ 
+#include "bacula.h" 
+ 
+#ifdef HAVE_MYSQL 
+ 
+#include "cats.h" 
+#include <mysql.h> 
+#define __BDB_MYSQL_H_ 1 
+#include "bdb_mysql.h" 
+ 
+/* ----------------------------------------------------------------------- 
+ * 
+ *   MySQL dependent defines and subroutines 
+ * 
+ * ----------------------------------------------------------------------- 
+ */ 
+ 
+/* List of open databases */ 
+static dlist *db_list = NULL; 
+ 
+static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; 
+ 
+BDB_MYSQL::BDB_MYSQL() 
+{ 
+   BDB_MYSQL *mdb = this; 
+ 
+   if (db_list == NULL) { 
+      db_list = New(dlist(this, &this->m_link)); 
+   } 
+   mdb->m_db_driver_type = SQL_DRIVER_TYPE_MYSQL; 
+   mdb->m_db_type = SQL_TYPE_MYSQL; 
+   mdb->m_db_driver = bstrdup("MySQL"); 
+   mdb->errmsg = get_pool_memory(PM_EMSG); /* get error message buffer */ 
+   mdb->errmsg[0] = 0; 
+   mdb->cmd = get_pool_memory(PM_EMSG);    /* get command buffer */ 
+   mdb->cached_path = get_pool_memory(PM_FNAME); 
+   mdb->cached_path_id = 0; 
+   mdb->m_ref_count = 1; 
+   mdb->fname = get_pool_memory(PM_FNAME); 
+   mdb->path = get_pool_memory(PM_FNAME); 
+   mdb->esc_name = get_pool_memory(PM_FNAME); 
+   mdb->esc_path = get_pool_memory(PM_FNAME); 
+   mdb->esc_obj = get_pool_memory(PM_FNAME); 
+   mdb->m_use_fatal_jmsg = true; 
+ 
+   /* Initialize the private members. */ 
+   mdb->m_db_handle = NULL; 
+   mdb->m_result = NULL; 
+ 
+   db_list->append(this); 
+} 
+ 
+BDB_MYSQL::~BDB_MYSQL() 
+{ 
+} 
+ 
+/* 
+ * Initialize database data structure. In principal this should 
+ * never have errors, or it is really fatal. 
+ */ 
+BDB *db_init_database(JCR *jcr, const char *db_driver, const char *db_name, const char *db_user, 
+                       const char *db_password, const char *db_address, int db_port, const char *db_socket, 
+                       bool mult_db_connections, bool disable_batch_insert) 
+{ 
+   BDB_MYSQL *mdb = NULL; 
+ 
+   if (!db_user) { 
+      Jmsg(jcr, M_FATAL, 0, _("A user name for MySQL must be supplied.\n")); 
+      return NULL; 
+   } 
+   P(mutex);                          /* lock DB queue */ 
+ 
+   /* 
+    * Look to see if DB already open 
+    */ 
+   if (db_list && !mult_db_connections) { 
+      foreach_dlist(mdb, db_list) { 
+         if (mdb->bdb_match_database(db_driver, db_name, db_address, db_port)) { 
+            Dmsg1(100, "DB REopen %s\n", db_name); 
+            mdb->increment_refcount(); 
+            goto get_out; 
+         } 
+      } 
+   } 
+   Dmsg0(100, "db_init_database first time\n"); 
+   mdb = New(BDB_MYSQL()); 
+   if (!mdb) goto get_out; 
+ 
+   /* 
+    * Initialize the parent class members. 
+    */ 
+   mdb->m_db_name = bstrdup(db_name); 
+   mdb->m_db_user = bstrdup(db_user); 
+   if (db_password) { 
+      mdb->m_db_password = bstrdup(db_password); 
+   } 
+   if (db_address) { 
+      mdb->m_db_address = bstrdup(db_address); 
+   } 
+   if (db_socket) { 
+      mdb->m_db_socket = bstrdup(db_socket); 
+   } 
+   mdb->m_db_port = db_port; 
+ 
+   if (disable_batch_insert) { 
+      mdb->m_disabled_batch_insert = true; 
+      mdb->m_have_batch_insert = false; 
+   } else { 
+      mdb->m_disabled_batch_insert = false; 
+#ifdef USE_BATCH_FILE_INSERT 
+#ifdef HAVE_MYSQL_THREAD_SAFE 
+      mdb->m_have_batch_insert = mysql_thread_safe(); 
+#else 
+      mdb->m_have_batch_insert = false; 
+#endif /* HAVE_MYSQL_THREAD_SAFE */ 
+#else 
+      mdb->m_have_batch_insert = false; 
+#endif /* USE_BATCH_FILE_INSERT */ 
+   } 
+ 
+   mdb->m_allow_transactions = mult_db_connections; 
+ 
+   /* At this time, when mult_db_connections == true, this is for 
+    * specific console command such as bvfs or batch mode, and we don't 
+    * want to share a batch mode or bvfs. In the future, we can change 
+    * the creation function to add this parameter. 
+    */ 
+   mdb->m_dedicated = mult_db_connections; 
+ 
+get_out: 
+   V(mutex); 
+   return mdb; 
+} 
+ 
+ 
+/* 
+ * Now actually open the database.  This can generate errors, 
+ *  which are returned in the errmsg 
+ * 
+ * DO NOT close the database or delete mdb here !!!! 
+ */ 
+bool BDB_MYSQL::bdb_open_database(JCR *jcr) 
+{ 
+   BDB_MYSQL *mdb = this; 
+   bool retval = false; 
+   int errstat; 
+ 
+   P(mutex); 
+   if (mdb->m_connected) { 
+      retval = true; 
+      goto get_out; 
+   } 
+ 
+   if ((errstat=rwl_init(&mdb->m_lock)) != 0) { 
+      berrno be; 
+      Mmsg1(&mdb->errmsg, _("Unable to initialize DB lock. ERR=%s\n"), 
+            be.bstrerror(errstat)); 
+      goto get_out; 
+   } 
+ 
+   /* 
+    * Connect to the database 
+    */ 
+#ifdef xHAVE_EMBEDDED_MYSQL 
+// mysql_server_init(0, NULL, NULL); 
+#endif 
+   mysql_init(&mdb->m_instance); 
+ 
+   Dmsg0(50, "mysql_init done\n"); 
+   /* 
+    * If connection fails, try at 5 sec intervals for 30 seconds. 
+    */ 
+   for (int retry=0; retry < 6; retry++) { 
+      mdb->m_db_handle = mysql_real_connect( 
+           &(mdb->m_instance),      /* db */ 
+           mdb->m_db_address,       /* default = localhost */ 
+           mdb->m_db_user,          /* login name */ 
+           mdb->m_db_password,      /* password */ 
+           mdb->m_db_name,          /* database name */ 
+           mdb->m_db_port,          /* default port */ 
+           mdb->m_db_socket,        /* default = socket */ 
+           CLIENT_FOUND_ROWS);      /* flags */ 
+ 
+      /* 
+       * If no connect, try once more in case it is a timing problem 
+       */ 
+      if (mdb->m_db_handle != NULL) { 
+         break; 
+      } 
+      bmicrosleep(5,0); 
+   } 
+ 
+   mdb->m_instance.reconnect = 1;             /* so connection does not timeout */ 
+   Dmsg0(50, "mysql_real_connect done\n"); 
+   Dmsg3(50, "db_user=%s db_name=%s db_password=%s\n", mdb->m_db_user, mdb->m_db_name, 
+        (mdb->m_db_password == NULL) ? "(NULL)" : mdb->m_db_password); 
+ 
+   if (mdb->m_db_handle == NULL) { 
+      Mmsg2(&mdb->errmsg, _("Unable to connect to MySQL server.\n" 
+"Database=%s User=%s\n" 
+"MySQL connect failed either server not running or your authorization is incorrect.\n"), 
+         mdb->m_db_name, mdb->m_db_user); 
+#if MYSQL_VERSION_ID >= 40101 
+      Dmsg3(50, "Error %u (%s): %s\n", 
+            mysql_errno(&(mdb->m_instance)), mysql_sqlstate(&(mdb->m_instance)), 
+            mysql_error(&(mdb->m_instance))); 
+#else 
+      Dmsg2(50, "Error %u: %s\n", 
+            mysql_errno(&(mdb->m_instance)), mysql_error(&(mdb->m_instance))); 
+#endif 
+      goto get_out; 
+   } 
+ 
+   mdb->m_connected = true; 
+   if (!bdb_check_version(jcr)) { 
+      goto get_out; 
+   } 
+ 
+   Dmsg3(100, "opendb ref=%d connected=%d db=%p\n", mdb->m_ref_count, mdb->m_connected, mdb->m_db_handle); 
+ 
+   /* 
+    * Set connection timeout to 8 days specialy for batch mode 
+    */ 
+   sql_query("SET wait_timeout=691200"); 
+   sql_query("SET interactive_timeout=691200"); 
+ 
+   retval = true; 
+ 
+get_out: 
+   V(mutex); 
+   return retval; 
+} 
+ 
+void BDB_MYSQL::bdb_close_database(JCR *jcr) 
+{ 
+   BDB_MYSQL *mdb = this; 
+ 
+   if (mdb->m_connected) { 
+      bdb_end_transaction(jcr); 
+   } 
+   P(mutex); 
+   mdb->m_ref_count--; 
+   Dmsg3(100, "closedb ref=%d connected=%d db=%p\n", mdb->m_ref_count, mdb->m_connected, mdb->m_db_handle); 
+   if (mdb->m_ref_count == 0) { 
+      if (mdb->m_connected) { 
+         sql_free_result(); 
+      } 
+      db_list->remove(mdb); 
+      if (mdb->m_connected) { 
+         Dmsg1(100, "close db=%p\n", mdb->m_db_handle); 
+         mysql_close(&mdb->m_instance); 
+      } 
+      if (is_rwl_valid(&mdb->m_lock)) { 
+         rwl_destroy(&mdb->m_lock); 
+      } 
+      free_pool_memory(mdb->errmsg); 
+      free_pool_memory(mdb->cmd); 
+      free_pool_memory(mdb->cached_path); 
+      free_pool_memory(mdb->fname); 
+      free_pool_memory(mdb->path); 
+      free_pool_memory(mdb->esc_name); 
+      free_pool_memory(mdb->esc_path); 
+      free_pool_memory(mdb->esc_obj); 
+      if (mdb->m_db_driver) { 
+         free(mdb->m_db_driver); 
+      } 
+      if (mdb->m_db_name) { 
+         free(mdb->m_db_name); 
+      } 
+      if (mdb->m_db_user) { 
+         free(mdb->m_db_user); 
+      } 
+      if (mdb->m_db_password) { 
+         free(mdb->m_db_password); 
+      } 
+      if (mdb->m_db_address) { 
+         free(mdb->m_db_address); 
+      } 
+      if (mdb->m_db_socket) { 
+         free(mdb->m_db_socket); 
+      } 
+      delete mdb; 
+      if (db_list->size() == 0) { 
+         delete db_list; 
+         db_list = NULL; 
+      } 
+   } 
+   V(mutex); 
+} 
+ 
+/* 
+ * This call is needed because the message channel thread 
+ *  opens a database on behalf of a jcr that was created in 
+ *  a different thread. MySQL then allocates thread specific 
+ *  data, which is NOT freed when the original jcr thread 
+ *  closes the database.  Thus the msgchan must call here 
+ *  to cleanup any thread specific data that it created. 
+ */ 
+void BDB_MYSQL::bdb_thread_cleanup(void) 
+{ 
+#ifndef HAVE_WIN32 
+   mysql_thread_end();       /* Cleanup thread specific data */ 
+#endif 
+} 
+ 
+/* 
+ * Escape strings so MySQL is happy 
+ * 
+ * len is the length of the old string. Your new 
+ *   string must be long enough (max 2*old+1) to hold 
+ *   the escaped output. 
+ */ 
+void BDB_MYSQL::bdb_escape_string(JCR *jcr, char *snew, char *old, int len) 
+{ 
+   BDB_MYSQL *mdb = this; 
+   mysql_real_escape_string(mdb->m_db_handle, snew, old, len); 
+} 
+ 
+/* 
+ * Escape binary object so that MySQL is happy 
+ * Memory is stored in BDB struct, no need to free it 
+ */ 
+char *BDB_MYSQL::bdb_escape_object(JCR *jcr, char *old, int len) 
+{ 
+   BDB_MYSQL *mdb = this; 
+   mdb->esc_obj = check_pool_memory_size(mdb->esc_obj, len*2+1); 
+   mysql_real_escape_string(mdb->m_db_handle, mdb->esc_obj, old, len); 
+   return mdb->esc_obj; 
+} 
+ 
+/* 
+ * Unescape binary object so that MySQL is happy 
+ */ 
+void BDB_MYSQL::bdb_unescape_object(JCR *jcr, char *from, int32_t expected_len, 
+                                    POOLMEM **dest, int32_t *dest_len) 
+{ 
+   if (!from) { 
+      *dest[0] = 0; 
+      *dest_len = 0; 
+      return; 
+   } 
+   *dest = check_pool_memory_size(*dest, expected_len+1); 
+   *dest_len = expected_len; 
+   memcpy(*dest, from, expected_len); 
+   (*dest)[expected_len]=0; 
+} 
+ 
+void BDB_MYSQL::bdb_start_transaction(JCR *jcr) 
+{ 
+   if (!jcr->attr) { 
+      jcr->attr = get_pool_memory(PM_FNAME); 
+   } 
+   if (!jcr->ar) { 
+      jcr->ar = (ATTR_DBR *)malloc(sizeof(ATTR_DBR)); 
+   } 
+} 
+ 
+void BDB_MYSQL::bdb_end_transaction(JCR *jcr) 
+{ 
+   if (jcr && jcr->cached_attribute) { 
+      Dmsg0(400, "Flush last cached attribute.\n"); 
+      if (!bdb_create_attributes_record(jcr, jcr->ar)) { 
+         Jmsg1(jcr, M_FATAL, 0, _("Attribute create error. %s"), jcr->db->bdb_strerror()); 
+      } 
+      jcr->cached_attribute = false; 
+   } 
+} 
+ 
+/* 
+ * Submit a general SQL command (cmd), and for each row returned, 
+ * the result_handler is called with the ctx. 
+ */ 
+bool BDB_MYSQL::bdb_sql_query(const char *query, DB_RESULT_HANDLER *result_handler, void *ctx) 
+{ 
+   int ret; 
+   SQL_ROW row; 
+   bool send = true; 
+   bool retval = false; 
+   BDB_MYSQL *mdb = this; 
+ 
+   Dmsg1(500, "db_sql_query starts with %s\n", query); 
+ 
+   bdb_lock(); 
+   errmsg[0] = 0; 
+   ret = mysql_query(m_db_handle, query); 
+   if (ret != 0) { 
+      Mmsg(mdb->errmsg, _("Query failed: %s: ERR=%s\n"), query, sql_strerror()); 
+      Dmsg0(500, "db_sql_query failed\n"); 
+      goto get_out; 
+   } 
+ 
+   Dmsg0(500, "db_sql_query succeeded. checking handler\n"); 
+ 
+   if (result_handler) { 
+      if ((mdb->m_result = mysql_use_result(mdb->m_db_handle)) != NULL) { 
+         mdb->m_num_fields = mysql_num_fields(mdb->m_result); 
+ 
+         /* 
+          * We *must* fetch all rows 
+          */ 
+         while ((row = mysql_fetch_row(m_result))) { 
+            if (send) { 
+               /* the result handler returns 1 when it has 
+                *  seen all the data it wants.  However, we 
+                *  loop to the end of the data. 
+                */ 
+               if (result_handler(ctx, mdb->m_num_fields, row)) { 
+                  send = false; 
+               } 
+            } 
+         } 
+         sql_free_result(); 
+      } 
+   } 
+ 
+   Dmsg0(500, "db_sql_query finished\n"); 
+   retval = true; 
+ 
+get_out: 
+   bdb_unlock(); 
+   return retval; 
+} 
+ 
+bool BDB_MYSQL::sql_query(const char *query, int flags) 
+{ 
+   int ret; 
+   bool retval = true; 
+   BDB_MYSQL *mdb = this; 
+ 
+   Dmsg1(500, "sql_query starts with '%s'\n", query); 
+   /* 
+    * We are starting a new query. reset everything. 
+    */ 
+   mdb->m_num_rows     = -1; 
+   mdb->m_row_number   = -1; 
+   mdb->m_field_number = -1; 
+ 
+   if (mdb->m_result) { 
+      mysql_free_result(mdb->m_result); 
+      mdb->m_result = NULL; 
+   } 
+ 
+   ret = mysql_query(mdb->m_db_handle, query); 
+   if (ret == 0) { 
+      Dmsg0(500, "we have a result\n"); 
+      if (flags & QF_STORE_RESULT) { 
+         mdb->m_result = mysql_store_result(mdb->m_db_handle); 
+         if (mdb->m_result != NULL) { 
+            mdb->m_num_fields = mysql_num_fields(mdb->m_result); 
+            Dmsg1(500, "we have %d fields\n", mdb->m_num_fields); 
+            mdb->m_num_rows = mysql_num_rows(mdb->m_result); 
+            Dmsg1(500, "we have %d rows\n", mdb->m_num_rows); 
+         } else { 
+            mdb->m_num_fields = 0; 
+            mdb->m_num_rows = mysql_affected_rows(mdb->m_db_handle); 
+            Dmsg1(500, "we have %d rows\n", mdb->m_num_rows); 
+         } 
+      } else { 
+         mdb->m_num_fields = 0; 
+         mdb->m_num_rows = mysql_affected_rows(mdb->m_db_handle); 
+         Dmsg1(500, "we have %d rows\n", mdb->m_num_rows); 
+      } 
+   } else { 
+      Dmsg0(500, "we failed\n"); 
+      mdb->m_status = 1;                   /* failed */ 
+      retval = false; 
+   } 
+   return retval; 
+} 
+ 
+void BDB_MYSQL::sql_free_result(void) 
+{ 
+   BDB_MYSQL *mdb = this; 
+   bdb_lock(); 
+   if (mdb->m_result) { 
+      mysql_free_result(mdb->m_result); 
+      mdb->m_result = NULL; 
+   } 
+   if (mdb->m_fields) { 
+      free(mdb->m_fields); 
+      mdb->m_fields = NULL; 
+   } 
+   mdb->m_num_rows = mdb->m_num_fields = 0; 
+   bdb_unlock(); 
+} 
+ 
+SQL_ROW BDB_MYSQL::sql_fetch_row(void) 
+{ 
+   BDB_MYSQL *mdb = this; 
+   if (!mdb->m_result) { 
+      return NULL; 
+   } else { 
+      return mysql_fetch_row(mdb->m_result); 
+   } 
+} 
+ 
+const char *BDB_MYSQL::sql_strerror(void) 
+{ 
+   BDB_MYSQL *mdb = this; 
+   return mysql_error(mdb->m_db_handle); 
+} 
+ 
+void BDB_MYSQL::sql_data_seek(int row) 
+{ 
+   BDB_MYSQL *mdb = this; 
+   return mysql_data_seek(mdb->m_result, row); 
+} 
+ 
+int BDB_MYSQL::sql_affected_rows(void) 
+{ 
+   BDB_MYSQL *mdb = this; 
+   return mysql_affected_rows(mdb->m_db_handle); 
+} 
+ 
+uint64_t BDB_MYSQL::sql_insert_autokey_record(const char *query, const char *table_name) 
+{ 
+   BDB_MYSQL *mdb = this; 
+   /* 
+    * First execute the insert query and then retrieve the currval. 
+    */ 
+   if (mysql_query(mdb->m_db_handle, query) != 0) { 
+      return 0; 
+   } 
+ 
+   mdb->m_num_rows = mysql_affected_rows(mdb->m_db_handle); 
+   if (mdb->m_num_rows != 1) { 
+      return 0; 
+   } 
+ 
+   mdb->changes++; 
+ 
+   return mysql_insert_id(mdb->m_db_handle); 
+} 
+ 
+SQL_FIELD *BDB_MYSQL::sql_fetch_field(void) 
+{ 
+   int i; 
+   MYSQL_FIELD *field; 
+   BDB_MYSQL *mdb = this; 
+ 
+   if (!mdb->m_fields || mdb->m_fields_size < mdb->m_num_fields) { 
+      if (mdb->m_fields) { 
+         free(mdb->m_fields); 
+         mdb->m_fields = NULL; 
+      } 
+      Dmsg1(500, "allocating space for %d fields\n", mdb->m_num_fields); 
+      mdb->m_fields = (SQL_FIELD *)malloc(sizeof(SQL_FIELD) * mdb->m_num_fields); 
+      mdb->m_fields_size = mdb->m_num_fields; 
+ 
+      for (i = 0; i < mdb->m_num_fields; i++) { 
+         Dmsg1(500, "filling field %d\n", i); 
+         if ((field = mysql_fetch_field(mdb->m_result)) != NULL) { 
+            mdb->m_fields[i].name = field->name; 
+            mdb->m_fields[i].max_length = field->max_length; 
+            mdb->m_fields[i].type = field->type; 
+            mdb->m_fields[i].flags = field->flags; 
+ 
+            Dmsg4(500, "sql_fetch_field finds field '%s' has length='%d' type='%d' and IsNull=%d\n", 
+                  mdb->m_fields[i].name, mdb->m_fields[i].max_length, mdb->m_fields[i].type, mdb->m_fields[i].flags); 
+         } 
+      } 
+   } 
+ 
+   /* 
+    * Increment field number for the next time around 
+    */ 
+   return &mdb->m_fields[mdb->m_field_number++]; 
+} 
+ 
+bool BDB_MYSQL::sql_field_is_not_null(int field_type) 
+{ 
+   return IS_NOT_NULL(field_type); 
+} 
+ 
+bool BDB_MYSQL::sql_field_is_numeric(int field_type) 
+{ 
+   return IS_NUM(field_type); 
+} 
+ 
+/* 
+ * Returns true  if OK 
+ *         false if failed 
+ */ 
+bool BDB_MYSQL::sql_batch_start(JCR *jcr) 
+{ 
+   BDB_MYSQL *mdb = this; 
+   bool retval; 
+ 
+   bdb_lock(); 
+   retval = sql_query("CREATE TEMPORARY TABLE batch (" 
+                      "FileIndex integer," 
+                      "JobId integer," 
+                      "Path blob," 
+                      "Name blob," 
+                      "LStat tinyblob," 
+                      "MD5 tinyblob," 
+                      "DeltaSeq integer)"); 
+   bdb_unlock(); 
+ 
+   /* 
+    * Keep track of the number of changes in batch mode. 
+    */ 
+   mdb->changes = 0; 
+ 
+   return retval; 
+} 
+ 
+/* set error to something to abort operation */ 
+/* 
+ * Returns true  if OK 
+ *         false if failed 
+ */ 
+bool BDB_MYSQL::sql_batch_end(JCR *jcr, const char *error) 
+{ 
+   BDB_MYSQL *mdb = this; 
+ 
+   mdb->m_status = 0; 
+ 
+   /* 
+    * Flush any pending inserts. 
+    */ 
+   if (mdb->changes) { 
+      return sql_query(mdb->cmd); 
+   } 
+ 
+   return true; 
+} 
+ 
+/* 
+ * Returns true  if OK 
+ *         false if failed 
+ */ 
+bool BDB_MYSQL::sql_batch_insert(JCR *jcr, ATTR_DBR *ar) 
+{ 
+   BDB_MYSQL *mdb = this; 
+   const char *digest; 
+   char ed1[50]; 
+ 
+   mdb->esc_name = check_pool_memory_size(mdb->esc_name, mdb->fnl*2+1); 
+   bdb_escape_string(jcr, mdb->esc_name, mdb->fname, mdb->fnl); 
+ 
+   mdb->esc_path = check_pool_memory_size(mdb->esc_path, mdb->pnl*2+1); 
+   bdb_escape_string(jcr, mdb->esc_path, mdb->path, mdb->pnl); 
+ 
+   if (ar->Digest == NULL || ar->Digest[0] == 0) { 
+      digest = "0"; 
+   } else { 
+      digest = ar->Digest; 
+   } 
+ 
+   /* 
+    * Try to batch up multiple inserts using multi-row inserts. 
+    */ 
+   if (mdb->changes == 0) { 
+      Mmsg(cmd, "INSERT INTO batch VALUES " 
+           "(%u,%s,'%s','%s','%s','%s',%u)", 
+           ar->FileIndex, edit_int64(ar->JobId,ed1), mdb->esc_path, 
+           mdb->esc_name, ar->attr, digest, ar->DeltaSeq); 
+      mdb->changes++; 
+   } else { 
+      /* 
+       * We use the esc_obj for temporary storage otherwise 
+       * we keep on copying data. 
+       */ 
+      Mmsg(mdb->esc_obj, ",(%u,%s,'%s','%s','%s','%s',%u)", 
+           ar->FileIndex, edit_int64(ar->JobId,ed1), mdb->esc_path, 
+           mdb->esc_name, ar->attr, digest, ar->DeltaSeq); 
+      pm_strcat(mdb->cmd, mdb->esc_obj); 
+      mdb->changes++; 
+   } 
+ 
+   /* 
+    * See if we need to flush the query buffer filled 
+    * with multi-row inserts. 
+    */ 
+   if ((mdb->changes % MYSQL_CHANGES_PER_BATCH_INSERT) == 0) { 
+      if (!sql_query(mdb->cmd)) { 
+         mdb->changes = 0; 
+         return false; 
+      } else { 
+         mdb->changes = 0; 
+      } 
+   } 
+   return true; 
+} 
+ 
+ 
+#endif /* HAVE_MYSQL */ 
diff --git a/src/cats/mysql.in b/src/cats/mysql.in
index d587785..b4e0d70 100644
--- a/src/cats/mysql.in
+++ b/src/cats/mysql.in
@@ -1,21 +1,9 @@
 #!/bin/sh
 #
-# shell script to create Bacula MySQL tables
-#
-#
-#  Bacula® - The Network Backup Solution
-#
-#  Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #
-#  The main author of Bacula is Kern Sibbald, with contributions from many
-#  others, a complete list can be found in the file AUTHORS.
-#
-#  You may use this file and others of this release according to the
-#  license defined in the LICENSE file, which includes the Affero General
-#  Public License, v3.0 ("AGPLv3") and some additional permissions and
-#  terms pursuant to its AGPLv3 Section 7.
-#
-#  Bacula® is a registered trademark of Kern Sibbald.
+# shell script to create Bacula MySQL tables
 #
 bindir=@MYSQL_BINDIR@
 db_name=@db_name@
diff --git a/src/cats/postgresql.c b/src/cats/postgresql.c
index cf85e88..76ac3dd 100644
--- a/src/cats/postgresql.c
+++ b/src/cats/postgresql.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2003-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Bacula Catalog Database routines specific to PostgreSQL
@@ -20,20 +24,29 @@
  *    Dan Langille, December 2003
  *    based upon work done by Kern Sibbald, March 2000
  *
- *   Class wrapper by Marco van Wieringen, January 2010
+ * Note: at one point, this file was changed to class based by a certain 
+ *  programmer, and other than "wrapping" in a class, which is a trivial
+ *  change for a C++ programmer, nothing substantial was done, yet all the
+ *  code was recommitted under this programmer's name.  Consequently, we
+ *  undo those changes here.  Unfortunately, it is too difficult to put
+ *  back the original author's name (Dan Langille) on the parts he wrote.
  */
 
 #include "bacula.h"
 
 #ifdef HAVE_POSTGRESQL
 
-#include "cats.h"
-#include "bdb_priv.h"
-#include "libpq-fe.h"
-#include "postgres_ext.h"       /* needed for NAMEDATALEN */
-#include "pg_config_manual.h"   /* get NAMEDATALEN on version 8.3 or later */
+#include  "cats.h"
+#include  "libpq-fe.h"
+#include  "postgres_ext.h"       /* needed for NAMEDATALEN */
+#include  "pg_config_manual.h"   /* get NAMEDATALEN on version 8.3 or later */
+#define __BDB_POSTGRESQL_H_ 1
 #include "bdb_postgresql.h"
 
+#define dbglvl_dbg   DT_SQL|100
+#define dbglvl_info  DT_SQL|50
+#define dbglvl_err   DT_SQL|10
+
 /* -----------------------------------------------------------------------
  *
  *   PostgreSQL dependent defines and subroutines
@@ -41,135 +54,159 @@
  * -----------------------------------------------------------------------
  */
 
+/* List of open databases */
+static dlist *db_list = NULL; 
+
+static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; 
+
+BDB_POSTGRESQL::BDB_POSTGRESQL()
+{
+   BDB_POSTGRESQL *mdb = this;
+
+   if (db_list == NULL) {
+      db_list = New(dlist(mdb, &mdb->m_link));
+   }
+   mdb->m_db_driver_type = SQL_DRIVER_TYPE_POSTGRESQL;
+   mdb->m_db_type = SQL_TYPE_POSTGRESQL;
+   mdb->m_db_driver = bstrdup("PostgreSQL");
+
+   mdb->errmsg = get_pool_memory(PM_EMSG); /* get error message buffer */
+   mdb->errmsg[0] = 0;
+   mdb->cmd = get_pool_memory(PM_EMSG);    /* get command buffer */
+   mdb->cached_path = get_pool_memory(PM_FNAME);
+   mdb->cached_path_id = 0;
+   mdb->m_ref_count = 1;
+   mdb->fname = get_pool_memory(PM_FNAME);
+   mdb->path = get_pool_memory(PM_FNAME);
+   mdb->esc_name = get_pool_memory(PM_FNAME);
+   mdb->esc_path = get_pool_memory(PM_FNAME);
+   mdb->esc_obj = get_pool_memory(PM_FNAME);
+   mdb->m_use_fatal_jmsg = true;
+
+   /* Initialize the private members. */
+   mdb->m_db_handle = NULL;
+   mdb->m_result = NULL;
+   mdb->m_buf =  get_pool_memory(PM_FNAME);
+
+   db_list->append(this);
+}
+
+BDB_POSTGRESQL::~BDB_POSTGRESQL()
+{
+}
+
 /*
- * List of open databases
+ * Initialize database data structure. In principal this should
+ * never have errors, or it is really fatal.
  */
-static dlist *db_list = NULL;
-
-static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
-
-B_DB_POSTGRESQL::B_DB_POSTGRESQL(JCR *jcr,
-   const char *db_driver,
-   const char *db_name,
-   const char *db_user,
-   const char *db_password,
-   const char *db_address,
-   int db_port,
-   const char *db_socket,
-   bool mult_db_connections,
-   bool disable_batch_insert)
+BDB *db_init_database(JCR *jcr, const char *db_driver, const char *db_name,
+                       const char *db_user, const char *db_password,
+                       const char *db_address, int db_port,
+                       const char *db_socket, bool mult_db_connections,
+                       bool disable_batch_insert)
 {
+   BDB_POSTGRESQL *mdb = NULL;
+
+   if (!db_user) {
+      Jmsg(jcr, M_FATAL, 0, _("A user name for PostgreSQL must be supplied.\n"));
+      return NULL;
+   }
+   P(mutex);                          /* lock DB queue */
+   if (db_list && !mult_db_connections) {
+      /*
+       * Look to see if DB already open
+       */
+      foreach_dlist(mdb, db_list) {
+         if (mdb->bdb_match_database(db_driver, db_name, db_address, db_port)) {
+            Dmsg1(dbglvl_info, "DB REopen %s\n", db_name);
+            mdb->increment_refcount();
+            goto get_out;
+         }
+      }
+   }
+   Dmsg0(dbglvl_info, "db_init_database first time\n");
+   /* Create the global Bacula db context */
+   mdb = New(BDB_POSTGRESQL());
+   if (!mdb) goto get_out;
+
    /*
     * Initialize the parent class members.
     */
-   m_db_interface_type = SQL_INTERFACE_TYPE_POSTGRESQL;
-   m_db_type = SQL_TYPE_POSTGRESQL;
-   m_db_driver = bstrdup("PostgreSQL");
-   m_db_name = bstrdup(db_name);
-   m_db_user = bstrdup(db_user);
+   mdb->m_db_name = bstrdup(db_name);
+   mdb->m_db_user = bstrdup(db_user);
    if (db_password) {
-      m_db_password = bstrdup(db_password);
+      mdb->m_db_password = bstrdup(db_password);
    }
    if (db_address) {
-      m_db_address = bstrdup(db_address);
+      mdb->m_db_address = bstrdup(db_address);
    }
    if (db_socket) {
-      m_db_socket = bstrdup(db_socket);
-   }
-   m_db_port = db_port;
-   if (disable_batch_insert) {
-      m_disabled_batch_insert = true;
-      m_have_batch_insert = false;
-   } else {
-      m_disabled_batch_insert = false;
-#if defined(USE_BATCH_FILE_INSERT)
-#if defined(HAVE_POSTGRESQL_BATCH_FILE_INSERT) || defined(HAVE_PQISTHREADSAFE)
-#ifdef HAVE_PQISTHREADSAFE
-      m_have_batch_insert = PQisthreadsafe();
-#else
-      m_have_batch_insert = true;
-#endif /* HAVE_PQISTHREADSAFE */
-#else
-      m_have_batch_insert = true;
-#endif /* HAVE_POSTGRESQL_BATCH_FILE_INSERT || HAVE_PQISTHREADSAFE */
-#else
-      m_have_batch_insert = false;
-#endif /* USE_BATCH_FILE_INSERT */
-   }
-   errmsg = get_pool_memory(PM_EMSG); /* get error message buffer */
-   *errmsg = 0;
-   cmd = get_pool_memory(PM_EMSG); /* get command buffer */
-   cached_path = get_pool_memory(PM_FNAME);
-   cached_path_id = 0;
-   m_ref_count = 1;
-   fname = get_pool_memory(PM_FNAME);
-   path = get_pool_memory(PM_FNAME);
-   esc_name = get_pool_memory(PM_FNAME);
-   esc_path = get_pool_memory(PM_FNAME);
-   esc_obj = get_pool_memory(PM_FNAME);
-   m_buf =  get_pool_memory(PM_FNAME);
-   m_allow_transactions = mult_db_connections;
+      mdb->m_db_socket = bstrdup(db_socket);
+   } 
+   mdb->m_db_port = db_port;
+
+   if (disable_batch_insert) { 
+      mdb->m_disabled_batch_insert = true;
+      mdb->m_have_batch_insert = false;
+   } else { 
+      mdb->m_disabled_batch_insert = false;
+#ifdef USE_BATCH_FILE_INSERT
+#if defined(HAVE_POSTGRESQL_BATCH_FILE_INSERT) || defined(HAVE_PQISTHREADSAFE) 
+#ifdef HAVE_PQISTHREADSAFE 
+      mdb->m_have_batch_insert = PQisthreadsafe();
+#else 
+      mdb->m_have_batch_insert = true;
+#endif /* HAVE_PQISTHREADSAFE */ 
+#else 
+      mdb->m_have_batch_insert = true;
+#endif /* HAVE_POSTGRESQL_BATCH_FILE_INSERT || HAVE_PQISTHREADSAFE */ 
+#else 
+      mdb->m_have_batch_insert = false;
+#endif /* USE_BATCH_FILE_INSERT */ 
+   } 
+   mdb->m_allow_transactions = mult_db_connections;
 
    /* At this time, when mult_db_connections == true, this is for
     * specific console command such as bvfs or batch mode, and we don't
     * want to share a batch mode or bvfs. In the future, we can change
     * the creation function to add this parameter.
     */
-   m_dedicated = mult_db_connections;
-
-   /*
-    * Initialize the private members.
-    */
-   m_db_handle = NULL;
-   m_result = NULL;
-
-   /*
-    * Put the db in the list.
-    */
-   if (db_list == NULL) {
-      db_list = New(dlist(this, &this->m_link));
-   }
-   db_list->append(this);
-}
-
-B_DB_POSTGRESQL::~B_DB_POSTGRESQL()
-{
-}
+   mdb->m_dedicated = mult_db_connections;
 
-/*
- * Check that the database correspond to the encoding we want
- */
-static bool pgsql_check_database_encoding(JCR *jcr, B_DB_POSTGRESQL *mdb)
+get_out:
+   V(mutex);
+   return mdb;
+} 
+  
+ 
+/* Check that the database corresponds to the encoding we want  */
+static bool pgsql_check_database_encoding(JCR *jcr, BDB_POSTGRESQL *mdb)
 {
    SQL_ROW row;
-   int ret = false;
+   int ret = false; 
 
-   if (!mdb->sql_query("SELECT getdatabaseencoding()", QF_STORE_RESULT)) {
+   if (!mdb->sql_query("SELECT getdatabaseencoding()", QF_STORE_RESULT)) { 
       Jmsg(jcr, M_ERROR, 0, "%s", mdb->errmsg);
-      return false;
+      return false; 
    }
 
-   if ((row = mdb->sql_fetch_row()) == NULL) {
-      Mmsg1(mdb->errmsg, _("error fetching row: %s\n"), mdb->sql_strerror());
+   if ((row = mdb->sql_fetch_row()) == NULL) { 
+      Mmsg1(mdb->errmsg, _("error fetching row: %s\n"), mdb->sql_strerror()); 
       Jmsg(jcr, M_ERROR, 0, "Can't check database encoding %s", mdb->errmsg);
-   } else {
+   } else { 
       ret = bstrcmp(row[0], "SQL_ASCII");
 
       if (ret) {
-         /*
-          * If we are in SQL_ASCII, we can force the client_encoding to SQL_ASCII too
-          */
-         mdb->sql_query("SET client_encoding TO 'SQL_ASCII'");
-
-      } else {
-         /*
-          * Something is wrong with database encoding
-          */
+         /* If we are in SQL_ASCII, we can force the client_encoding to SQL_ASCII too */
+         mdb->sql_query("SET client_encoding TO 'SQL_ASCII'"); 
+
+      } else { 
+         /* Something is wrong with database encoding */
          Mmsg(mdb->errmsg,
               _("Encoding error for database \"%s\". Wanted SQL_ASCII, got %s\n"),
-              mdb->get_db_name(), row[0]);
+              mdb->get_db_name(), row[0]); 
          Jmsg(jcr, M_WARNING, 0, "%s", mdb->errmsg);
-         Dmsg1(50, "%s", mdb->errmsg);
+         Dmsg1(dbglvl_err, "%s", mdb->errmsg);
       }
    }
    return ret;
@@ -179,29 +216,30 @@ static bool pgsql_check_database_encoding(JCR *jcr, B_DB_POSTGRESQL *mdb)
  * Now actually open the database.  This can generate errors,
  *   which are returned in the errmsg
  *
- * DO NOT close the database or delete mdb here !!!!
+ *  DO NOT close the database or delete mdb here !!!!
  */
-bool B_DB_POSTGRESQL::db_open_database(JCR *jcr)
+bool BDB_POSTGRESQL::bdb_open_database(JCR *jcr)
 {
-   bool retval = false;
+   bool retval = false; 
    int errstat;
    char buf[10], *port;
+   BDB_POSTGRESQL *mdb = this;
 
    P(mutex);
-   if (m_connected) {
-      retval = true;
-      goto bail_out;
+   if (mdb->m_connected) {
+      retval = true; 
+      goto get_out;
    }
 
-   if ((errstat=rwl_init(&m_lock)) != 0) {
+   if ((errstat=rwl_init(&mdb->m_lock)) != 0) {
       berrno be;
-      Mmsg1(&errmsg, _("Unable to initialize DB lock. ERR=%s\n"),
+      Mmsg1(&mdb->errmsg, _("Unable to initialize DB lock. ERR=%s\n"),
             be.bstrerror(errstat));
-      goto bail_out;
+      goto get_out;
    }
 
-   if (m_db_port) {
-      bsnprintf(buf, sizeof(buf), "%d", m_db_port);
+   if (mdb->m_db_port) {
+      bsnprintf(buf, sizeof(buf), "%d", mdb->m_db_port);
       port = buf;
    } else {
       port = NULL;
@@ -210,106 +248,105 @@ bool B_DB_POSTGRESQL::db_open_database(JCR *jcr)
    /* If connection fails, try at 5 sec intervals for 30 seconds. */
    for (int retry=0; retry < 6; retry++) {
       /* connect to the database */
-      m_db_handle = PQsetdbLogin(
-           m_db_address,         /* default = localhost */
-           port,                 /* default port */
-           NULL,                 /* pg options */
-           NULL,                 /* tty, ignored */
-           m_db_name,            /* database name */
-           m_db_user,            /* login name */
-           m_db_password);       /* password */
+      mdb->m_db_handle = PQsetdbLogin(
+           mdb->m_db_address,         /* default = localhost */
+           port,                      /* default port */
+           NULL,                      /* pg options */
+           NULL,                      /* tty, ignored */
+           mdb->m_db_name,            /* database name */
+           mdb->m_db_user,            /* login name */
+           mdb->m_db_password);       /* password */
 
       /* If no connect, try once more in case it is a timing problem */
-      if (PQstatus(m_db_handle) == CONNECTION_OK) {
+      if (PQstatus(mdb->m_db_handle) == CONNECTION_OK) {
          break;
       }
       bmicrosleep(5, 0);
    }
 
-   Dmsg0(50, "pg_real_connect done\n");
-   Dmsg3(50, "db_user=%s db_name=%s db_password=%s\n", m_db_user, m_db_name,
-        (m_db_password == NULL) ? "(NULL)" : m_db_password);
+   Dmsg0(dbglvl_info, "pg_real_connect done\n");
+   Dmsg3(dbglvl_info, "db_user=%s db_name=%s db_password=%s\n", mdb->m_db_user, mdb->m_db_name,
+        mdb->m_db_password==NULL?"(NULL)":mdb->m_db_password);
 
-   if (PQstatus(m_db_handle) != CONNECTION_OK) {
-      Mmsg2(&errmsg, _("Unable to connect to PostgreSQL server. Database=%s User=%s\n"
+   if (PQstatus(mdb->m_db_handle) != CONNECTION_OK) {
+      Mmsg2(&mdb->errmsg, _("Unable to connect to PostgreSQL server. Database=%s User=%s\n"
          "Possible causes: SQL server not running; password incorrect; max_connections exceeded.\n"),
-         m_db_name, m_db_user);
-      goto bail_out;
+         mdb->m_db_name, mdb->m_db_user);
+      goto get_out;
    }
 
-   m_connected = true;
-   if (!check_tables_version(jcr, this)) {
-      goto bail_out;
+   mdb->m_connected = true;
+   if (!bdb_check_version(jcr)) {
+      goto get_out;
    }
 
-   sql_query("SET datestyle TO 'ISO, YMD'");
+   sql_query("SET datestyle TO 'ISO, YMD'"); 
    sql_query("SET cursor_tuple_fraction=1");
 
-   /*
-    * Tell PostgreSQL we are using standard conforming strings
-    * and avoid warnings such as:
-    *  WARNING:  nonstandard use of \\ in a string literal
-    */
-   sql_query("SET standard_conforming_strings=on");
-
-   /*
-    * Check that encoding is SQL_ASCII
-    */
-   pgsql_check_database_encoding(jcr, this);
-
-   retval = true;
-
-bail_out:
+   /* 
+    * Tell PostgreSQL we are using standard conforming strings and avoid warnings such as:
+    *   WARNING:  nonstandard use of \\ in a string literal
+    */ 
+   sql_query("SET standard_conforming_strings=on"); 
+ 
+   /* Check that encoding is SQL_ASCII */
+   pgsql_check_database_encoding(jcr, mdb);
+ 
+   retval = true; 
+
+get_out:
    V(mutex);
-   return retval;
-}
+   return retval; 
+} 
 
-void B_DB_POSTGRESQL::db_close_database(JCR *jcr)
+void BDB_POSTGRESQL::bdb_close_database(JCR *jcr)
 {
-   if (m_connected) {
-      db_end_transaction(jcr);
-   }
+   BDB_POSTGRESQL *mdb = this;
+
+   if (mdb->m_connected) {
+      bdb_end_transaction(jcr);
+   } 
    P(mutex);
-   m_ref_count--;
-   if (m_ref_count == 0) {
-      if (m_connected) {
-         sql_free_result();
-      }
-      db_list->remove(this);
-      if (m_connected && m_db_handle) {
-         PQfinish(m_db_handle);
-      }
-      if (rwl_is_init(&m_lock)) {
-         rwl_destroy(&m_lock);
+   mdb->m_ref_count--;
+   if (mdb->m_ref_count == 0) {
+      if (mdb->m_connected) {
+         sql_free_result(); 
+      } 
+      db_list->remove(mdb);
+      if (mdb->m_connected && mdb->m_db_handle) {
+         PQfinish(mdb->m_db_handle);
       }
-      free_pool_memory(errmsg);
-      free_pool_memory(cmd);
-      free_pool_memory(cached_path);
-      free_pool_memory(fname);
-      free_pool_memory(path);
-      free_pool_memory(esc_name);
-      free_pool_memory(esc_path);
-      free_pool_memory(esc_obj);
-      free_pool_memory(m_buf);
-      if (m_db_driver) {
-         free(m_db_driver);
-      }
-      if (m_db_name) {
-         free(m_db_name);
-      }
-      if (m_db_user) {
-         free(m_db_user);
-      }
-      if (m_db_password) {
-         free(m_db_password);
-      }
-      if (m_db_address) {
-         free(m_db_address);
-      }
-      if (m_db_socket) {
-         free(m_db_socket);
-      }
-      delete this;
+      if (is_rwl_valid(&mdb->m_lock)) {
+         rwl_destroy(&mdb->m_lock);
+      } 
+      free_pool_memory(mdb->errmsg);
+      free_pool_memory(mdb->cmd);
+      free_pool_memory(mdb->cached_path);
+      free_pool_memory(mdb->fname);
+      free_pool_memory(mdb->path);
+      free_pool_memory(mdb->esc_name);
+      free_pool_memory(mdb->esc_path);
+      free_pool_memory(mdb->esc_obj);
+      free_pool_memory(mdb->m_buf);
+      if (mdb->m_db_driver) {
+         free(mdb->m_db_driver);
+      } 
+      if (mdb->m_db_name) {
+         free(mdb->m_db_name);
+      } 
+      if (mdb->m_db_user) {
+         free(mdb->m_db_user);
+      } 
+      if (mdb->m_db_password) {
+         free(mdb->m_db_password);
+      } 
+      if (mdb->m_db_address) {
+         free(mdb->m_db_address);
+      } 
+      if (mdb->m_db_socket) {
+         free(mdb->m_db_socket);
+      } 
+      delete mdb;
       if (db_list->size() == 0) {
          delete db_list;
          db_list = NULL;
@@ -318,59 +355,60 @@ void B_DB_POSTGRESQL::db_close_database(JCR *jcr)
    V(mutex);
 }
 
-void B_DB_POSTGRESQL::db_thread_cleanup(void)
+void BDB_POSTGRESQL::bdb_thread_cleanup(void)
 {
 }
 
 /*
- * Escape strings so that PostgreSQL is happy
+ * Escape strings so PostgreSQL is happy
  *
- *   NOTE! len is the length of the old string. Your new
- *         string must be long enough (max 2*old+1) to hold
- *         the escaped output.
+ *  len is the length of the old string. Your new
+ *    string must be long enough (max 2*old+1) to hold
+ *    the escaped output.
  */
-void B_DB_POSTGRESQL::db_escape_string(JCR *jcr, char *snew, char *old, int len)
+void BDB_POSTGRESQL::bdb_escape_string(JCR *jcr, char *snew, char *old, int len)
 {
-   int error;
-
-   PQescapeStringConn(m_db_handle, snew, old, len, &error);
-   if (error) {
-      Jmsg(jcr, M_FATAL, 0, _("PQescapeStringConn returned non-zero.\n"));
-      /* error on encoding, probably invalid multibyte encoding in the source string
-        see PQescapeStringConn documentation for details. */
-      Dmsg0(500, "PQescapeStringConn failed\n");
-   }
+   BDB_POSTGRESQL *mdb = this;
+   int failed; 
+
+   PQescapeStringConn(mdb->m_db_handle, snew, old, len, &failed);
+   if (failed) {
+      Jmsg(jcr, M_FATAL, 0, _("PQescapeStringConn returned non-zero.\n")); 
+      /* failed on encoding, probably invalid multibyte encoding in the source string
+         see PQescapeStringConn documentation for details. */
+      Dmsg0(dbglvl_err, "PQescapeStringConn failed\n");
+   } 
 }
 
 /*
  * Escape binary so that PostgreSQL is happy
  *
  */
-char *B_DB_POSTGRESQL::db_escape_object(JCR *jcr, char *old, int len)
+char *BDB_POSTGRESQL::bdb_escape_object(JCR *jcr, char *old, int len)
 {
    size_t new_len;
-   unsigned char *obj;
+   unsigned char *obj; 
+   BDB_POSTGRESQL *mdb = this;
 
-   obj = PQescapeByteaConn(m_db_handle, (unsigned const char *)old, len, &new_len);
-   if (!obj) {
+   mdb->esc_obj[0] = 0;
+   obj = PQescapeByteaConn(mdb->m_db_handle, (unsigned const char *)old, len, &new_len);
+   if (!obj) { 
       Jmsg(jcr, M_FATAL, 0, _("PQescapeByteaConn returned NULL.\n"));
+   } else {
+      mdb->esc_obj = check_pool_memory_size(mdb->esc_obj, new_len+1);
+      memcpy(mdb->esc_obj, obj, new_len);
+      mdb->esc_obj[new_len] = 0;
+      PQfreemem(obj);
    }
-
-   esc_obj = check_pool_memory_size(esc_obj, new_len+1);
-   memcpy(esc_obj, obj, new_len);
-   esc_obj[new_len]=0;
-
-   PQfreemem(obj);
-
-   return (char *)esc_obj;
+   return (char *)mdb->esc_obj;
 }
 
 /*
  * Unescape binary object so that PostgreSQL is happy
  *
  */
-void B_DB_POSTGRESQL::db_unescape_object(JCR *jcr, char *from, int32_t expected_len,
-                                         POOLMEM **dest, int32_t *dest_len)
+void BDB_POSTGRESQL::bdb_unescape_object(JCR *jcr, char *from, int32_t expected_len,
+                       POOLMEM **dest, int32_t *dest_len)
 {
    size_t new_len;
    unsigned char *obj;
@@ -394,95 +432,98 @@ void B_DB_POSTGRESQL::db_unescape_object(JCR *jcr, char *from, int32_t expected_
 
    PQfreemem(obj);
 
-   Dmsg1(010, "obj size: %d\n", *dest_len);
+   Dmsg1(dbglvl_info, "obj size: %d\n", *dest_len);
 }
 
 /*
- * Start a transaction. This groups inserts and makes things
- * much more efficient. Usually started when inserting
- * file attributes.
+ * Start a transaction. This groups inserts and makes things more efficient.
+ *  Usually started when inserting file attributes.
  */
-void B_DB_POSTGRESQL::db_start_transaction(JCR *jcr)
+void BDB_POSTGRESQL::bdb_start_transaction(JCR *jcr)
 {
-   if (!jcr->attr) {
-      jcr->attr = get_pool_memory(PM_FNAME);
-   }
-   if (!jcr->ar) {
-      jcr->ar = (ATTR_DBR *)malloc(sizeof(ATTR_DBR));
-   }
-
-   /*
-    * This is turned off because transactions break
-    * if multiple simultaneous jobs are run.
-    */
-   if (!m_allow_transactions) {
-      return;
-   }
-
-   db_lock(this);
-   /*
-    * Allow only 25,000 changes per transaction
-    */
-   if (m_transaction && changes > 25000) {
-      db_end_transaction(jcr);
-   }
-   if (!m_transaction) {
-      sql_query("BEGIN");  /* begin transaction */
-      Dmsg0(400, "Start PosgreSQL transaction\n");
-      m_transaction = true;
-   }
-   db_unlock(this);
+   BDB_POSTGRESQL *mdb = this;
+
+   if (!jcr->attr) { 
+      jcr->attr = get_pool_memory(PM_FNAME); 
+   }
+   if (!jcr->ar) { 
+      jcr->ar = (ATTR_DBR *)malloc(sizeof(ATTR_DBR)); 
+   }
+
+   /* 
+    * This is turned off because transactions break if
+    *  multiple simultaneous jobs are run.
+    */ 
+   if (!mdb->m_allow_transactions) {
+      return; 
+   }
+
+   bdb_lock();
+   /* Allow only 25,000 changes per transaction */
+   if (mdb->m_transaction && changes > 25000) {
+      bdb_end_transaction(jcr);
+   } 
+   if (!mdb->m_transaction) {
+      sql_query("BEGIN");             /* begin transaction */
+      Dmsg0(dbglvl_info, "Start PosgreSQL transaction\n");
+      mdb->m_transaction = true;
+   } 
+   bdb_unlock();
 }
 
-void B_DB_POSTGRESQL::db_end_transaction(JCR *jcr)
+void BDB_POSTGRESQL::bdb_end_transaction(JCR *jcr)
 {
-   if (jcr && jcr->cached_attribute) {
-      Dmsg0(400, "Flush last cached attribute.\n");
-      if (!db_create_attributes_record(jcr, this, jcr->ar)) {
-         Jmsg1(jcr, M_FATAL, 0, _("Attribute create error. %s"), db_strerror(jcr->db));
+   BDB_POSTGRESQL *mdb = this;
+
+   if (jcr && jcr->cached_attribute) { 
+      Dmsg0(dbglvl_info, "Flush last cached attribute.\n");
+      if (!bdb_create_attributes_record(jcr, jcr->ar)) {
+         Jmsg1(jcr, M_FATAL, 0, _("Attribute create error. %s"), jcr->db->bdb_strerror());
       }
-      jcr->cached_attribute = false;
+      jcr->cached_attribute = false; 
    }
 
-   if (!m_allow_transactions) {
-      return;
+   if (!mdb->m_allow_transactions) {
+      return; 
    }
 
-   db_lock(this);
-   if (m_transaction) {
-      sql_query("COMMIT"); /* end transaction */
-      m_transaction = false;
-      Dmsg1(400, "End PostgreSQL transaction changes=%d\n", changes);
+   bdb_lock();
+   if (mdb->m_transaction) {
+      sql_query("COMMIT");            /* end transaction */
+      mdb->m_transaction = false;
+      Dmsg1(dbglvl_info, "End PostgreSQL transaction changes=%d\n", changes);
    }
-   changes = 0;
-   db_unlock(this);
+   changes = 0; 
+   bdb_unlock();
 }
 
 
 /*
- * Submit a general SQL command (cmd), and for each row returned,
- * the result_handler is called with the ctx.
+ * Submit a general SQL command, and for each row returned,
+ *  the result_handler is called with the ctx.
  */
-bool B_DB_POSTGRESQL::db_big_sql_query(const char *query,
+bool BDB_POSTGRESQL::bdb_big_sql_query(const char *query,
                                        DB_RESULT_HANDLER *result_handler,
                                        void *ctx)
 {
-   SQL_ROW row;
-   bool retval = false;
-   bool in_transaction = m_transaction;
+   BDB_POSTGRESQL *mdb = this;
+   SQL_ROW row; 
+   bool retval = false; 
+   bool in_transaction = mdb->m_transaction;
 
-   Dmsg1(500, "db_sql_query starts with '%s'\n", query);
+   Dmsg1(dbglvl_info, "db_sql_query starts with '%s'\n", query);
 
+   mdb->errmsg[0] = 0;
    /* This code handles only SELECT queries */
    if (strncasecmp(query, "SELECT", 6) != 0) {
-      return db_sql_query(query, result_handler, ctx);
+      return bdb_sql_query(query, result_handler, ctx);
    }
 
    if (!result_handler) {       /* no need of big_query without handler */
-      return false;
+      return false; 
    }
 
-   db_lock(this);
+   bdb_lock();
 
    if (!in_transaction) {       /* CURSOR needs transaction */
       sql_query("BEGIN");
@@ -490,281 +531,274 @@ bool B_DB_POSTGRESQL::db_big_sql_query(const char *query,
 
    Mmsg(m_buf, "DECLARE _bac_cursor CURSOR FOR %s", query);
 
-   if (!sql_query(m_buf)) {
-      Mmsg(errmsg, _("Query failed: %s: ERR=%s\n"), m_buf, sql_strerror());
-      Dmsg0(50, "db_sql_query failed\n");
-      goto bail_out;
+   if (!sql_query(mdb->m_buf)) {
+      Mmsg(mdb->errmsg, _("Query failed: %s: ERR=%s\n"), mdb->m_buf, sql_strerror());
+      Dmsg1(dbglvl_err, "%s\n", mdb->errmsg);
+      goto get_out;
    }
 
    do {
       if (!sql_query("FETCH 100 FROM _bac_cursor")) {
-         goto bail_out;
+         Mmsg(mdb->errmsg, _("Fetch failed: ERR=%s\n"), sql_strerror());
+         Dmsg1(dbglvl_err, "%s\n", mdb->errmsg);
+         goto get_out;
       }
       while ((row = sql_fetch_row()) != NULL) {
-         Dmsg1(500, "Fetching %d rows\n", m_num_rows);
-         if (result_handler(ctx, m_num_fields, row))
+         Dmsg1(dbglvl_info, "Fetching %d rows\n", mdb->m_num_rows);
+         if (result_handler(ctx, mdb->m_num_fields, row))
             break;
       }
-      PQclear(m_result);
+      PQclear(mdb->m_result);
       m_result = NULL;
 
    } while (m_num_rows > 0);    /* TODO: Can probably test against 100 */
 
    sql_query("CLOSE _bac_cursor");
 
-   Dmsg0(500, "db_big_sql_query finished\n");
+   Dmsg0(dbglvl_info, "db_big_sql_query finished\n");
    sql_free_result();
    retval = true;
 
-bail_out:
+get_out:
    if (!in_transaction) {
       sql_query("COMMIT");  /* end transaction */
    }
 
-   db_unlock(this);
+   bdb_unlock();
    return retval;
 }
 
-/*
- * Submit a general SQL command (cmd), and for each row returned,
- * the result_handler is called with the ctx.
- */
-bool B_DB_POSTGRESQL::db_sql_query(const char *query, DB_RESULT_HANDLER *result_handler, void *ctx)
+/* 
+ * Submit a general SQL command, and for each row returned,
+ *  the result_handler is called with the ctx.
+ */ 
+bool BDB_POSTGRESQL::bdb_sql_query(const char *query, DB_RESULT_HANDLER *result_handler, void *ctx)
 {
-   SQL_ROW row;
-   bool retval = true;
-
-   Dmsg1(500, "db_sql_query starts with '%s'\n", query);
-
-   db_lock(this);
-   if (!sql_query(query, QF_STORE_RESULT)) {
-      Mmsg(errmsg, _("Query failed: %s: ERR=%s\n"), query, sql_strerror());
-      Dmsg0(500, "db_sql_query failed\n");
-      retval = false;
-      goto bail_out;
-   }
-
-   Dmsg0(500, "db_sql_query succeeded. checking handler\n");
-
-   if (result_handler != NULL) {
-      Dmsg0(500, "db_sql_query invoking handler\n");
-      while ((row = sql_fetch_row()) != NULL) {
-         Dmsg0(500, "db_sql_query sql_fetch_row worked\n");
-         if (result_handler(ctx, m_num_fields, row))
-            break;
-      }
-      sql_free_result();
-   }
-
-   Dmsg0(500, "db_sql_query finished\n");
-
-bail_out:
-   db_unlock(this);
-   return retval;
+   SQL_ROW row; 
+   bool retval = true; 
+   BDB_POSTGRESQL *mdb = this;
+
+   Dmsg1(dbglvl_info, "db_sql_query starts with '%s'\n", query);
+
+   bdb_lock();
+   mdb->errmsg[0] = 0;
+   if (!sql_query(query, QF_STORE_RESULT)) { 
+      Mmsg(mdb->errmsg, _("Query failed: %s: ERR=%s\n"), query, sql_strerror());
+      Dmsg0(dbglvl_err, "db_sql_query failed\n");
+      retval = false; 
+      goto get_out;
+   } 
+
+   Dmsg0(dbglvl_info, "db_sql_query succeeded. checking handler\n");
+
+   if (result_handler) {
+      Dmsg0(dbglvl_dbg, "db_sql_query invoking handler\n");
+      while ((row = sql_fetch_row())) {
+         Dmsg0(dbglvl_dbg, "db_sql_query sql_fetch_row worked\n");
+         if (result_handler(ctx, mdb->m_num_fields, row))
+            break; 
+      } 
+      sql_free_result(); 
+   } 
+
+   Dmsg0(dbglvl_info, "db_sql_query finished\n");
+
+get_out:
+   bdb_unlock();
+   return retval; 
 }
 
 /*
- * Note, if this routine returns false (failure), Bacula expects
- * that no result has been stored.
- * This is where QUERY_DB comes with Postgresql.
+ * If this routine returns false (failure), Bacula expects
+ *   that no result has been stored.
+ * This is where QueryDB calls to with Postgresql.
  *
- *  Returns:  true  on success
- *            false on failure
+ *  Returns: true  on success
+ *           false on failure
  *
  */
-bool B_DB_POSTGRESQL::sql_query(const char *query, int flags)
+bool BDB_POSTGRESQL::sql_query(const char *query, int flags)
 {
-   int i;
-   bool retval = false;
+   int i; 
+   bool retval = false; 
+   BDB_POSTGRESQL *mdb = this;
 
-   Dmsg1(500, "sql_query starts with '%s'\n", query);
-   /*
-    * We are starting a new query. reset everything.
-    */
-   m_num_rows     = -1;
-   m_row_number   = -1;
-   m_field_number = -1;
+   Dmsg1(dbglvl_info, "sql_query starts with '%s'\n", query);
 
-   if (m_result) {
-      PQclear(m_result);  /* hmm, someone forgot to free?? */
-      m_result = NULL;
-   }
+   /* We are starting a new query. reset everything. */
+   mdb->m_num_rows     = -1;
+   mdb->m_row_number   = -1;
+   mdb->m_field_number = -1;
 
-   for (i = 0; i < 10; i++) {
-      m_result = PQexec(m_db_handle, query);
-      if (m_result) {
+   if (mdb->m_result) {
+      PQclear(mdb->m_result);  /* hmm, someone forgot to free?? */
+      mdb->m_result = NULL;
+   } 
+
+   for (i = 0; i < 10; i++) { 
+      mdb->m_result = PQexec(mdb->m_db_handle, query);
+      if (mdb->m_result) {
          break;
       }
       bmicrosleep(5, 0);
    }
-   if (!m_result) {
-      Dmsg1(50, "Query failed: %s\n", query);
-      goto bail_out;
+   if (!mdb->m_result) {
+      Dmsg1(dbglvl_err, "Query failed: %s\n", query);
+      goto get_out;
    }
 
-   m_status = PQresultStatus(m_result);
-   if (m_status == PGRES_TUPLES_OK || m_status == PGRES_COMMAND_OK) {
-      Dmsg0(500, "we have a result\n");
+   mdb->m_status = PQresultStatus(mdb->m_result);
+   if (mdb->m_status == PGRES_TUPLES_OK || mdb->m_status == PGRES_COMMAND_OK) {
+      Dmsg0(dbglvl_dbg, "we have a result\n");
 
-      /*
-       * How many fields in the set?
-       */
-      m_num_fields = (int)PQnfields(m_result);
-      Dmsg1(500, "we have %d fields\n", m_num_fields);
+      /* How many fields in the set? */
+      mdb->m_num_fields = (int)PQnfields(mdb->m_result);
+      Dmsg1(dbglvl_dbg, "we have %d fields\n", mdb->m_num_fields);
 
-      m_num_rows = PQntuples(m_result);
-      Dmsg1(500, "we have %d rows\n", m_num_rows);
+      mdb->m_num_rows = PQntuples(mdb->m_result);
+      Dmsg1(dbglvl_dbg, "we have %d rows\n", mdb->m_num_rows);
 
-      m_row_number = 0;      /* we can start to fetch something */
-      m_status = 0;          /* succeed */
-      retval = true;
+      mdb->m_row_number = 0;      /* we can start to fetch something */
+      mdb->m_status = 0;          /* succeed */
+      retval = true; 
    } else {
-      Dmsg1(50, "Result status failed: %s\n", query);
-      goto bail_out;
+      Dmsg1(dbglvl_err, "Result status failed: %s\n", query);
+      goto get_out;
    }
 
-   Dmsg0(500, "sql_query finishing\n");
-   goto ok_out;
+   Dmsg0(dbglvl_info, "sql_query finishing\n");
+   goto ok_out; 
 
-bail_out:
-   Dmsg0(500, "we failed\n");
-   PQclear(m_result);
-   m_result = NULL;
-   m_status = 1;                   /* failed */
+get_out:
+   Dmsg0(dbglvl_err, "we failed\n");
+   PQclear(mdb->m_result);
+   mdb->m_result = NULL;
+   mdb->m_status = 1;                   /* failed */
+ 
+ok_out: 
+   return retval; 
+}  
 
-ok_out:
-   return retval;
-}
-
-void B_DB_POSTGRESQL::sql_free_result(void)
+void BDB_POSTGRESQL::sql_free_result(void)
 {
-   db_lock(this);
-   if (m_result) {
-      PQclear(m_result);
-      m_result = NULL;
-   }
-   if (m_rows) {
-      free(m_rows);
-      m_rows = NULL;
-   }
-   if (m_fields) {
-      free(m_fields);
-      m_fields = NULL;
-   }
-   m_num_rows = m_num_fields = 0;
-   db_unlock(this);
-}
-
-SQL_ROW B_DB_POSTGRESQL::sql_fetch_row(void)
-{
-   int j;
-   SQL_ROW row = NULL; /* by default, return NULL */
-
-   Dmsg0(500, "sql_fetch_row start\n");
-
-   if (m_num_fields == 0) {     /* No field, no row */
-      Dmsg0(500, "sql_fetch_row finishes returning NULL, no fields\n");
+   BDB_POSTGRESQL *mdb = this;
+
+   bdb_lock();
+   if (mdb->m_result) {
+      PQclear(mdb->m_result);
+      mdb->m_result = NULL;
+   }
+   if (mdb->m_rows) {
+      free(mdb->m_rows);
+      mdb->m_rows = NULL;
+   }
+   if (mdb->m_fields) {
+      free(mdb->m_fields);
+      mdb->m_fields = NULL;
+   } 
+   mdb->m_num_rows = mdb->m_num_fields = 0;
+   bdb_unlock();
+} 
+
+SQL_ROW BDB_POSTGRESQL::sql_fetch_row(void)
+{ 
+   SQL_ROW row = NULL;            /* by default, return NULL */
+   BDB_POSTGRESQL *mdb = this;
+ 
+   Dmsg0(dbglvl_info, "sql_fetch_row start\n");
+ 
+   if (mdb->m_num_fields == 0) {     /* No field, no row */
+      Dmsg0(dbglvl_err, "sql_fetch_row finishes returning NULL, no fields\n");
       return NULL;
    }
 
-   if (!m_rows || m_rows_size < m_num_fields) {
-      if (m_rows) {
-         Dmsg0(500, "sql_fetch_row freeing space\n");
-         free(m_rows);
-      }
-      Dmsg1(500, "we need space for %d bytes\n", sizeof(char *) * m_num_fields);
-      m_rows = (SQL_ROW)malloc(sizeof(char *) * m_num_fields);
-      m_rows_size = m_num_fields;
-
-      /*
-       * Now reset the row_number now that we have the space allocated
-       */
-      m_row_number = 0;
-   }
-
-   /*
-    * If still within the result set
-    */
-   if (m_row_number >= 0 && m_row_number < m_num_rows) {
-      Dmsg2(500, "sql_fetch_row row number '%d' is acceptable (0..%d)\n", m_row_number, m_num_rows);
-      /*
-       * Get each value from this row
-       */
-      for (j = 0; j < m_num_fields; j++) {
-         m_rows[j] = PQgetvalue(m_result, m_row_number, j);
-         Dmsg2(500, "sql_fetch_row field '%d' has value '%s'\n", j, m_rows[j]);
-      }
-      /*
-       * Increment the row number for the next call
-       */
-      m_row_number++;
-      row = m_rows;
-   } else {
-      Dmsg2(500, "sql_fetch_row row number '%d' is NOT acceptable (0..%d)\n", m_row_number, m_num_rows);
-   }
-
-   Dmsg1(500, "sql_fetch_row finishes returning %p\n", row);
-
-   return row;
-}
-
-const char *B_DB_POSTGRESQL::sql_strerror(void)
-{
-   return PQerrorMessage(m_db_handle);
+   if (!mdb->m_rows || mdb->m_rows_size < mdb->m_num_fields) {
+      if (mdb->m_rows) {
+         Dmsg0(dbglvl_dbg, "sql_fetch_row freeing space\n");
+         free(mdb->m_rows);
+      } 
+      Dmsg1(dbglvl_dbg, "we need space for %d bytes\n", sizeof(char *) * mdb->m_num_fields);
+      mdb->m_rows = (SQL_ROW)malloc(sizeof(char *) * mdb->m_num_fields);
+      mdb->m_rows_size = mdb->m_num_fields;
+ 
+      /* Now reset the row_number now that we have the space allocated */
+      mdb->m_row_number = 0;
+   }
+
+   /* If still within the result set */
+   if (mdb->m_row_number >= 0 && mdb->m_row_number < mdb->m_num_rows) {
+      Dmsg2(dbglvl_dbg, "sql_fetch_row row number '%d' is acceptable (0..%d)\n", mdb->m_row_number, m_num_rows);
+
+      /* Get each value from this row */
+      for (int j = 0; j < mdb->m_num_fields; j++) {
+         mdb->m_rows[j] = PQgetvalue(mdb->m_result, mdb->m_row_number, j);
+         Dmsg2(dbglvl_dbg, "sql_fetch_row field '%d' has value '%s'\n", j, mdb->m_rows[j]);
+      } 
+      mdb->m_row_number++;  /* Increment the row number for the next call */
+      row = mdb->m_rows;
+   } else { 
+      Dmsg2(dbglvl_dbg, "sql_fetch_row row number '%d' is NOT acceptable (0..%d)\n", mdb->m_row_number, m_num_rows);
+   }
+ 
+   Dmsg1(dbglvl_info, "sql_fetch_row finishes returning %p\n", row);
+ 
+   return row; 
 }
 
-void B_DB_POSTGRESQL::sql_data_seek(int row)
+const char *BDB_POSTGRESQL::sql_strerror(void)
 {
-   /*
-    * Set the row number to be returned on the next call to sql_fetch_row
-    */
-   m_row_number = row;
-}
-
-int B_DB_POSTGRESQL::sql_affected_rows(void)
-{
-   return (unsigned) str_to_int32(PQcmdTuples(m_result));
-}
-
-uint64_t B_DB_POSTGRESQL::sql_insert_autokey_record(const char *query, const char *table_name)
-{
-   int i;
-   uint64_t id = 0;
-   char sequence[NAMEDATALEN-1];
-   char getkeyval_query[NAMEDATALEN+50];
-   PGresult *pg_result;
-
-   /*
-    * First execute the insert query and then retrieve the currval.
-    */
-   if (!sql_query(query)) {
-      return 0;
-   }
-
-   m_num_rows = sql_affected_rows();
-   if (m_num_rows != 1) {
-      return 0;
-   }
-
-   changes++;
-
-   /*
-    * Obtain the current value of the sequence that
-    * provides the serial value for primary key of the table.
-    *
-    * currval is local to our session.  It is not affected by
-    * other transactions.
-    *
-    * Determine the name of the sequence.
-    * PostgreSQL automatically creates a sequence using
-    * <table>_<column>_seq.
-    * At the time of writing, all tables used this format for
-    * for their primary key: <table>id
-    * Except for basefiles which has a primary key on baseid.
-    * Therefore, we need to special case that one table.
-    *
-    * everything else can use the PostgreSQL formula.
-    */
+   BDB_POSTGRESQL *mdb = this;
+   return PQerrorMessage(mdb->m_db_handle);
+} 
+
+void BDB_POSTGRESQL::sql_data_seek(int row)
+{ 
+   BDB_POSTGRESQL *mdb = this;
+   /* Set the row number to be returned on the next call to sql_fetch_row */
+   mdb->m_row_number = row;
+} 
+
+int BDB_POSTGRESQL::sql_affected_rows(void)
+{ 
+   BDB_POSTGRESQL *mdb = this;
+   return (unsigned)str_to_int32(PQcmdTuples(mdb->m_result));
+} 
+ 
+uint64_t BDB_POSTGRESQL::sql_insert_autokey_record(const char *query, const char *table_name)
+{ 
+   uint64_t id = 0; 
+   char sequence[NAMEDATALEN-1]; 
+   char getkeyval_query[NAMEDATALEN+50]; 
+   PGresult *p_result;
+   BDB_POSTGRESQL *mdb = this;
+
+   /* First execute the insert query and then retrieve the currval. */
+   if (!sql_query(query)) { 
+      return 0; 
+   } 
+
+   mdb->m_num_rows = sql_affected_rows();
+   if (mdb->m_num_rows != 1) {
+      return 0; 
+   } 
+   mdb->changes++;
+   /* 
+    *  Obtain the current value of the sequence that
+    *  provides the serial value for primary key of the table.
+    * 
+    *  currval is local to our session.  It is not affected by
+    *  other transactions.
+    * 
+    *  Determine the name of the sequence.
+    *  PostgreSQL automatically creates a sequence using
+    *   <table>_<column>_seq.
+    *  At the time of writing, all tables used this format for
+    *   for their primary key: <table>id
+    *  Except for basefiles which has a primary key on baseid.
+    *  Therefore, we need to special case that one table.
+    * 
+    *  everything else can use the PostgreSQL formula.
+    */ 
    if (strcasecmp(table_name, "basefiles") == 0) {
       bstrncpy(sequence, "basefiles_baseid", sizeof(sequence));
    } else {
@@ -775,170 +809,164 @@ uint64_t B_DB_POSTGRESQL::sql_insert_autokey_record(const char *query, const cha
    }
 
    bstrncat(sequence, "_seq", sizeof(sequence));
-   bsnprintf(getkeyval_query, sizeof(getkeyval_query), "SELECT currval('%s')", sequence);
+   bsnprintf(getkeyval_query, sizeof(getkeyval_query), "SELECT currval('%s')", sequence); 
 
-   Dmsg1(500, "sql_insert_autokey_record executing query '%s'\n", getkeyval_query);
-   for (i = 0; i < 10; i++) {
-      pg_result = PQexec(m_db_handle, getkeyval_query);
-      if (pg_result) {
+   Dmsg1(dbglvl_info, "sql_insert_autokey_record executing query '%s'\n", getkeyval_query);
+   for (int i = 0; i < 10; i++) { 
+      p_result = PQexec(mdb->m_db_handle, getkeyval_query);
+      if (p_result) {
          break;
       }
       bmicrosleep(5, 0);
    }
-   if (!pg_result) {
-      Dmsg1(50, "Query failed: %s\n", getkeyval_query);
-      goto bail_out;
+   if (!p_result) {
+      Dmsg1(dbglvl_err, "Query failed: %s\n", getkeyval_query);
+      goto get_out;
    }
 
-   Dmsg0(500, "exec done");
+   Dmsg0(dbglvl_dbg, "exec done");
 
-   if (PQresultStatus(pg_result) == PGRES_TUPLES_OK) {
-      Dmsg0(500, "getting value");
-      id = str_to_uint64(PQgetvalue(pg_result, 0, 0));
-      Dmsg2(500, "got value '%s' which became %d\n", PQgetvalue(pg_result, 0, 0), id);
+   if (PQresultStatus(p_result) == PGRES_TUPLES_OK) {
+      Dmsg0(dbglvl_dbg, "getting value");
+      id = str_to_uint64(PQgetvalue(p_result, 0, 0));
+      Dmsg2(dbglvl_dbg, "got value '%s' which became %d\n", PQgetvalue(p_result, 0, 0), id);
    } else {
-      Dmsg1(50, "Result status failed: %s\n", getkeyval_query);
-      Mmsg1(&errmsg, _("error fetching currval: %s\n"), PQerrorMessage(m_db_handle));
+      Dmsg1(dbglvl_err, "Result status failed: %s\n", getkeyval_query);
+      Mmsg1(&mdb->errmsg, _("error fetching currval: %s\n"), PQerrorMessage(mdb->m_db_handle));
    }
 
-bail_out:
-   PQclear(pg_result);
-
+get_out:
+   PQclear(p_result);
    return id;
-}
-
-SQL_FIELD *B_DB_POSTGRESQL::sql_fetch_field(void)
-{
-   int i, j;
-   int max_length;
-   int this_length;
-
-   Dmsg0(500, "sql_fetch_field starts\n");
-
-   if (!m_fields || m_fields_size < m_num_fields) {
-      if (m_fields) {
-         free(m_fields);
-         m_fields = NULL;
-      }
-      Dmsg1(500, "allocating space for %d fields\n", m_num_fields);
-      m_fields = (SQL_FIELD *)malloc(sizeof(SQL_FIELD) * m_num_fields);
-      m_fields_size = m_num_fields;
-
-      for (i = 0; i < m_num_fields; i++) {
-         Dmsg1(500, "filling field %d\n", i);
-         m_fields[i].name = PQfname(m_result, i);
-         m_fields[i].type = PQftype(m_result, i);
-         m_fields[i].flags = 0;
-
-         /*
-          * For a given column, find the max length.
-          */
-         max_length = 0;
-         for (j = 0; j < m_num_rows; j++) {
-            if (PQgetisnull(m_result, j, i)) {
-                this_length = 4;        /* "NULL" */
-            } else {
-                this_length = cstrlen(PQgetvalue(m_result, j, i));
-            }
-
-            if (max_length < this_length) {
-               max_length = this_length;
-            }
-         }
-         m_fields[i].max_length = max_length;
-
-         Dmsg4(500, "sql_fetch_field finds field '%s' has length='%d' type='%d' and IsNull=%d\n",
-               m_fields[i].name, m_fields[i].max_length, m_fields[i].type, m_fields[i].flags);
-      }
-   }
-
-   /*
-    * Increment field number for the next time around
-    */
-   return &m_fields[m_field_number++];
-}
-
-bool B_DB_POSTGRESQL::sql_field_is_not_null(int field_type)
-{
-   switch (field_type) {
-   case 1:
-      return true;
-   default:
-      return false;
-   }
-}
-
-bool B_DB_POSTGRESQL::sql_field_is_numeric(int field_type)
-{
-   /*
-    * TEMP: the following is taken from select OID, typname from pg_type;
-    */
-   switch (field_type) {
-   case 20:
-   case 21:
-   case 23:
-   case 700:
-   case 701:
-      return true;
-   default:
-      return false;
-   }
-}
-
-/*
- * Escape strings so that PostgreSQL is happy on COPY
- *
- *   NOTE! len is the length of the old string. Your new
- *         string must be long enough (max 2*old+1) to hold
- *         the escaped output.
- */
-static char *pgsql_copy_escape(char *dest, char *src, size_t len)
-{
-   /* we have to escape \t, \n, \r, \ */
-   char c = '\0' ;
-
-   while (len > 0 && *src) {
-      switch (*src) {
-      case '\n':
-         c = 'n';
-         break;
-      case '\\':
-         c = '\\';
-         break;
-      case '\t':
-         c = 't';
-         break;
-      case '\r':
-         c = 'r';
-         break;
-      default:
-         c = '\0' ;
-      }
-
-      if (c) {
-         *dest = '\\';
-         dest++;
-         *dest = c;
-      } else {
-         *dest = *src;
-      }
-
-      len--;
-      src++;
-      dest++;
-   }
-
-   *dest = '\0';
-   return dest;
-}
-
-bool B_DB_POSTGRESQL::sql_batch_start(JCR *jcr)
+} 
+
+SQL_FIELD *BDB_POSTGRESQL::sql_fetch_field(void)
+{ 
+   int max_len; 
+   int this_len; 
+   BDB_POSTGRESQL *mdb = this;
+ 
+   Dmsg0(dbglvl_dbg, "sql_fetch_field starts\n");
+ 
+   if (!mdb->m_fields || mdb->m_fields_size < mdb->m_num_fields) {
+      if (mdb->m_fields) {
+         free(mdb->m_fields);
+         mdb->m_fields = NULL;
+      } 
+      Dmsg1(dbglvl_dbg, "allocating space for %d fields\n", mdb->m_num_fields);
+      mdb->m_fields = (SQL_FIELD *)malloc(sizeof(SQL_FIELD) * mdb->m_num_fields);
+      mdb->m_fields_size = mdb->m_num_fields;
+ 
+      for (int i = 0; i < mdb->m_num_fields; i++) {
+         Dmsg1(dbglvl_dbg, "filling field %d\n", i);
+         mdb->m_fields[i].name = PQfname(mdb->m_result, i);
+         mdb->m_fields[i].type = PQftype(mdb->m_result, i);
+         mdb->m_fields[i].flags = 0;
+ 
+         /* For a given column, find the max length. */
+         max_len = 0; 
+         for (int j = 0; j < mdb->m_num_rows; j++) {
+            if (PQgetisnull(mdb->m_result, j, i)) {
+               this_len = 4;         /* "NULL" */
+            } else { 
+               this_len = cstrlen(PQgetvalue(mdb->m_result, j, i));
+            } 
+
+            if (max_len < this_len) { 
+               max_len = this_len; 
+            } 
+         } 
+         mdb->m_fields[i].max_length = max_len;
+  
+         Dmsg4(dbglvl_dbg, "sql_fetch_field finds field '%s' has length='%d' type='%d' and IsNull=%d\n",
+               mdb->m_fields[i].name, mdb->m_fields[i].max_length, mdb->m_fields[i].type, mdb->m_fields[i].flags);
+      } 
+   } 
+ 
+   /* Increment field number for the next time around */
+   return &mdb->m_fields[mdb->m_field_number++];
+}  
+ 
+bool BDB_POSTGRESQL::sql_field_is_not_null(int field_type)
+{  
+   if (field_type == 1) {
+      return true; 
+   } 
+   return false; 
+} 
+ 
+bool BDB_POSTGRESQL::sql_field_is_numeric(int field_type)
+{ 
+    /*
+     * TEMP: the following is taken from select OID, typname from pg_type;
+     */
+    switch (field_type) {
+    case 20:
+    case 21:
+    case 23:
+    case 700:
+    case 701:
+       return true; 
+    default:
+       return false; 
+    }
+} 
+ 
+/* 
+ * Escape strings so PostgreSQL is happy on COPY
+ * 
+ * len is the length of the old string. Your new
+ *   string must be long enough (max 2*old+1) to hold
+ *   the escaped output.
+ */ 
+static char *pgsql_copy_escape(char *dest, char *src, size_t len) 
+{ 
+    /* we have to escape \t, \n, \r, \ */
+    char c = '\0' ;
+ 
+    while (len > 0 && *src) {
+       switch (*src) {
+       case '\n':
+          c = 'n';
+          break;
+       case '\\':
+          c = '\\';
+          break;
+       case '\t':
+          c = 't';
+          break;
+       case '\r':
+          c = 'r';
+          break;
+       default:
+          c = '\0' ;
+       }
+
+       if (c) {
+          *dest = '\\';
+          dest++;
+          *dest = c;
+       } else {
+          *dest = *src;
+       }
+
+       len--;
+       src++;
+       dest++;
+    }
+
+    *dest = '\0';
+    return dest;
+} 
+ 
+bool BDB_POSTGRESQL::sql_batch_start(JCR *jcr)
 {
+   BDB_POSTGRESQL *mdb = this;
    const char *query = "COPY batch FROM STDIN";
-
-   Dmsg0(500, "sql_batch_start started\n");
-
-   if (!sql_query("CREATE TEMPORARY TABLE batch ("
+ 
+   Dmsg0(dbglvl_info, "sql_batch_start started\n");
+ 
+   if  (!sql_query("CREATE TEMPORARY TABLE batch ("
                           "FileIndex int,"
                           "JobId int,"
                           "Path varchar,"
@@ -946,112 +974,109 @@ bool B_DB_POSTGRESQL::sql_batch_start(JCR *jcr)
                           "LStat varchar,"
                           "Md5 varchar,"
                           "DeltaSeq smallint)")) {
-      Dmsg0(500, "sql_batch_start failed\n");
-      return false;
+      Dmsg0(dbglvl_err, "sql_batch_start failed\n");
+      return false; 
    }
 
-   /*
-    * We are starting a new query.  reset everything.
-    */
-   m_num_rows     = -1;
-   m_row_number   = -1;
-   m_field_number = -1;
+   /* We are starting a new query.  reset everything. */
+   mdb->m_num_rows     = -1;
+   mdb->m_row_number   = -1;
+   mdb->m_field_number = -1;
 
-   sql_free_result();
+   sql_free_result(); 
 
    for (int i=0; i < 10; i++) {
-      m_result = PQexec(m_db_handle, query);
-      if (m_result) {
+      mdb->m_result = PQexec(mdb->m_db_handle, query);
+      if (mdb->m_result) {
          break;
       }
       bmicrosleep(5, 0);
    }
-   if (!m_result) {
-      Dmsg1(50, "Query failed: %s\n", query);
-      goto bail_out;
+   if (!mdb->m_result) {
+      Dmsg1(dbglvl_err, "Query failed: %s\n", query);
+      goto get_out;
    }
 
-   m_status = PQresultStatus(m_result);
-   if (m_status == PGRES_COPY_IN) {
-      /*
-       * How many fields in the set?
-       */
-      m_num_fields = (int) PQnfields(m_result);
-      m_num_rows = 0;
-      m_status = 1;
+   mdb->m_status = PQresultStatus(mdb->m_result);
+   if (mdb->m_status == PGRES_COPY_IN) {
+      /* How many fields in the set? */
+      mdb->m_num_fields = (int) PQnfields(mdb->m_result);
+      mdb->m_num_rows = 0;
+      mdb->m_status = 1;
    } else {
-      Dmsg1(50, "Result status failed: %s\n", query);
-      goto bail_out;
+      Dmsg1(dbglvl_err, "Result status failed: %s\n", query);
+      goto get_out;
    }
 
-   Dmsg0(500, "sql_batch_start finishing\n");
+   Dmsg0(dbglvl_info, "sql_batch_start finishing\n");
 
-   return true;
+   return true; 
 
-bail_out:
-   Mmsg1(&errmsg, _("error starting batch mode: %s"), PQerrorMessage(m_db_handle));
-   m_status = 0;
-   PQclear(m_result);
-   m_result = NULL;
-   return false;
+get_out:
+   Mmsg1(&mdb->errmsg, _("error starting batch mode: %s"), PQerrorMessage(mdb->m_db_handle));
+   mdb->m_status = 0;
+   PQclear(mdb->m_result);
+   mdb->m_result = NULL;
+   return false; 
 }
 
-/*
- * Set error to something to abort operation
- */
-bool B_DB_POSTGRESQL::sql_batch_end(JCR *jcr, const char *error)
+/* 
+ * Set error to something to abort the operation
+ */ 
+bool BDB_POSTGRESQL::sql_batch_end(JCR *jcr, const char *error)
 {
    int res;
    int count=30;
-   PGresult *pg_result;
+   PGresult *p_result;
+   BDB_POSTGRESQL *mdb = this;
 
-   Dmsg0(500, "sql_batch_end started\n");
+   Dmsg0(dbglvl_info, "sql_batch_end started\n");
 
    do {
-      res = PQputCopyEnd(m_db_handle, error);
+      res = PQputCopyEnd(mdb->m_db_handle, error);
    } while (res == 0 && --count > 0);
 
    if (res == 1) {
-      Dmsg0(500, "ok\n");
-      m_status = 0;
+      Dmsg0(dbglvl_dbg, "ok\n");
+      mdb->m_status = 0;
    }
 
    if (res <= 0) {
-      Dmsg0(500, "we failed\n");
-      m_status = 1;
-      Mmsg1(&errmsg, _("error ending batch mode: %s"), PQerrorMessage(m_db_handle));
-      Dmsg1(500, "failure %s\n", errmsg);
+      mdb->m_status = 1;
+      Mmsg1(&mdb->errmsg, _("error ending batch mode: %s"), PQerrorMessage(mdb->m_db_handle));
+      Dmsg1(dbglvl_err, "failure %s\n", errmsg);
    }
 
    /* Check command status and return to normal libpq state */
-   pg_result = PQgetResult(m_db_handle);
-   if (PQresultStatus(pg_result) != PGRES_COMMAND_OK) {
-      Mmsg1(&errmsg, _("error ending batch mode: %s"), PQerrorMessage(m_db_handle));
-      m_status = 1;
+   p_result = PQgetResult(mdb->m_db_handle);
+   if (PQresultStatus(p_result) != PGRES_COMMAND_OK) {
+      Mmsg1(&mdb->errmsg, _("error ending batch mode: %s"), PQerrorMessage(mdb->m_db_handle));
+      mdb->m_status = 1;
    }
 
    /* Get some statistics to compute the best plan */
    sql_query("ANALYZE batch");
 
-   PQclear(pg_result);
+   PQclear(p_result);
 
-   Dmsg0(500, "sql_batch_end finishing\n");
-   return true;
+   Dmsg0(dbglvl_info, "sql_batch_end finishing\n");
+   return true; 
 }
 
-bool B_DB_POSTGRESQL::sql_batch_insert(JCR *jcr, ATTR_DBR *ar)
+bool BDB_POSTGRESQL::sql_batch_insert(JCR *jcr, ATTR_DBR *ar)
 {
    int res;
    int count=30;
    size_t len;
    const char *digest;
    char ed1[50];
+   BDB_POSTGRESQL *mdb = this;
 
-   esc_name = check_pool_memory_size(esc_name, fnl*2+1);
-   pgsql_copy_escape(esc_name, fname, fnl);
+   mdb->esc_name = check_pool_memory_size(mdb->esc_name, fnl*2+1);
+   pgsql_copy_escape(mdb->esc_name, fname, fnl);
 
-   esc_path = check_pool_memory_size(esc_path, pnl*2+1);
-   pgsql_copy_escape(esc_path, path, pnl);
+   mdb->esc_path = check_pool_memory_size(mdb->esc_path, pnl*2+1);
+   pgsql_copy_escape(mdb->esc_path, path, pnl);
 
    if (ar->Digest == NULL || ar->Digest[0] == 0) {
       digest = "0";
@@ -1059,69 +1084,30 @@ bool B_DB_POSTGRESQL::sql_batch_insert(JCR *jcr, ATTR_DBR *ar)
       digest = ar->Digest;
    }
 
-   len = Mmsg(cmd, "%u\t%s\t%s\t%s\t%s\t%s\t%u\n",
-              ar->FileIndex, edit_int64(ar->JobId, ed1), esc_path,
-              esc_name, ar->attr, digest, ar->DeltaSeq);
+   len = Mmsg(mdb->cmd, "%u\t%s\t%s\t%s\t%s\t%s\t%u\n",
+              ar->FileIndex, edit_int64(ar->JobId, ed1), mdb->esc_path,
+              mdb->esc_name, ar->attr, digest, ar->DeltaSeq);
 
    do {
-      res = PQputCopyData(m_db_handle, cmd, len);
+      res = PQputCopyData(mdb->m_db_handle, mdb->cmd, len);
    } while (res == 0 && --count > 0);
 
    if (res == 1) {
-      Dmsg0(500, "ok\n");
-      changes++;
-      m_status = 1;
+      Dmsg0(dbglvl_dbg, "ok\n");
+      mdb->changes++;
+      mdb->m_status = 1;
    }
 
    if (res <= 0) {
-      Dmsg0(500, "we failed\n");
-      m_status = 0;
-      Mmsg1(&errmsg, _("error copying in batch mode: %s"), PQerrorMessage(m_db_handle));
-      Dmsg1(500, "failure %s\n", errmsg);
+      mdb->m_status = 0;
+      Mmsg1(&mdb->errmsg, _("error copying in batch mode: %s"), PQerrorMessage(mdb->m_db_handle));
+      Dmsg1(dbglvl_err, "failure %s\n", mdb->errmsg);
    }
 
-   Dmsg0(500, "sql_batch_insert finishing\n");
+   Dmsg0(dbglvl_info, "sql_batch_insert finishing\n");
 
-   return true;
+   return true; 
 }
 
-/*
- * Initialize database data structure. In principal this should
- * never have errors, or it is really fatal.
- */
-B_DB *db_init_database(JCR *jcr, const char *db_driver, const char *db_name,
-                       const char *db_user, const char *db_password,
-                       const char *db_address, int db_port,
-                       const char *db_socket, bool mult_db_connections,
-                       bool disable_batch_insert)
-{
-   B_DB_POSTGRESQL *mdb = NULL;
-
-   if (!db_user) {
-      Jmsg(jcr, M_FATAL, 0, _("A user name for PostgreSQL must be supplied.\n"));
-      return NULL;
-   }
-   P(mutex);                          /* lock DB queue */
-   if (db_list && !mult_db_connections) {
-      /*
-       * Look to see if DB already open
-       */
-      foreach_dlist(mdb, db_list) {
-         if (mdb->db_match_database(db_driver, db_name, db_address, db_port)) {
-            Dmsg1(100, "DB REopen %s\n", db_name);
-            mdb->increment_refcount();
-            goto bail_out;
-         }
-      }
-   }
-   Dmsg0(100, "db_init_database first time\n");
-   mdb = New(B_DB_POSTGRESQL(jcr, db_driver, db_name, db_user, db_password,
-                             db_address, db_port, db_socket,
-                             mult_db_connections, disable_batch_insert));
-
-bail_out:
-   V(mutex);
-   return mdb;
-}
 
 #endif /* HAVE_POSTGRESQL */
diff --git a/src/cats/postgresql.in b/src/cats/postgresql.in
index d890e47..ccd273d 100644
--- a/src/cats/postgresql.in
+++ b/src/cats/postgresql.in
@@ -1,21 +1,9 @@
 #!/bin/sh
 #
-# shell script to create Bacula PostgreSQL tables
-#
-#
-#  Bacula® - The Network Backup Solution
-#
-#  Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #
-#  The main author of Bacula is Kern Sibbald, with contributions from many
-#  others, a complete list can be found in the file AUTHORS.
-#
-#  You may use this file and others of this release according to the
-#  license defined in the LICENSE file, which includes the Affero General
-#  Public License, v3.0 ("AGPLv3") and some additional permissions and
-#  terms pursuant to its AGPLv3 Section 7.
-#
-#  Bacula® is a registered trademark of Kern Sibbald.
+# shell script to create Bacula PostgreSQL tables
 #
 bindir=@POSTGRESQL_BINDIR@
 db_name=@db_name@
diff --git a/src/cats/protos.h b/src/cats/protos.h
index f4a53c6..cc6510c 100644
--- a/src/cats/protos.h
+++ b/src/cats/protos.h
@@ -1,23 +1,40 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
  *  Database routines that are exported by the cats library for
  *    use elsewhere in Bacula (mainly the Director).
  *
+ * Note: the interface that is used by the core Bacula code outside
+ *  of the cats directory has names that are:
+ *  db_xxx(x, db, y, ...) 
+ *  usually with a database pointer such as db as an argument.  
+ *  This simplifies the vast bulk of the code and makes it easier to read.
+ *  These are translated into class calls on the db pointer by a #define
+ *  in this file.
+ *
+ *  The actual class code is named bdb_xxx(x, y, ...) and is called with
+ *  the class pointer such as db->bdb_xxx(x, y, ...)  The code in this
+ *  cats directory can use the db_xxx() calls or the db->bdb_xxx() calls.
+ *  In the Bacula core code we prefer using only the db_xxx() calls.
+ *
  *    Written by Kern Sibbald, MM
  */
 
@@ -26,114 +43,247 @@
 
 #include "cats.h"
 
-/* Database prototypes */
+BDB *db_init_database(JCR *jcr, const char *db_driver, const char *db_name,
+        const char *db_user, const char *db_password,
+        const char *db_address, int db_port,
+        const char *db_socket, bool mult_db_connections, bool disable_batch_insert);
+
+/* Database prototypes and defines */
+
+/* Misc */
+#define db_lock(mdb) \
+           mdb->bdb_lock()
+#define db_unlock(mdb) \
+           mdb->bdb_unlock()
+
+
+/* Virtual methods */
+#define db_escape_string(jcr, mdb, snew, old, len) \
+           mdb->bdb_escape_string(jcr, snew, old, len)
+#define db_escape_object(jcr, mdb, old, len) \
+           mdb->bdb_escape_object(jcr, old, len)
+#define db_unescape_object(jcr, mdb, from, expected_len, dest, len) \
+           mdb->bdb_unescape_object(jcr, from, expected_len, dest, len)
+#define db_open_database(jcr, mdb) \
+           mdb->bdb_open_database(jcr)
+#define db_close_database(jcr, mdb) \
+           mdb->bdb_close_database(jcr)
+#define db_close_database(jcr, mdb) \
+           mdb->bdb_close_database(jcr)
+#define db_start_transaction(jcr, mdb) \
+           mdb->bdb_start_transaction(jcr)
+#define db_end_transaction(jcr, mdb) \
+           mdb->bdb_end_transaction(jcr)
+#define db_sql_query(mdb, query, result_handler, ctx) \
+           mdb->bdb_sql_query(query, result_handler, ctx)
+#define db_thread_cleanup(mdb) \
+           mdb->bdb_thread_cleanup()
 
 /* sql.c */
-bool db_open_batch_connexion(JCR *jcr, B_DB *mdb);
-char *db_strerror(B_DB *mdb);
 int db_int64_handler(void *ctx, int num_fields, char **row);
 int db_strtime_handler(void *ctx, int num_fields, char **row);
 int db_list_handler(void *ctx, int num_fields, char **row);
-void db_debug_print(JCR *jcr, FILE *fp);
-int db_int_handler(void *ctx, int num_fields, char **row);
-void db_check_backend_thread_safe();
 int db_string_list_handler(void *ctx, int num_fields, char **row);
+int db_int_handler(void *ctx, int num_fields, char **row);
+void bdb_debug_print(JCR *jcr, FILE *fp);
+void db_free_restoreobject_record(JCR *jcr, ROBJECT_DBR *rr);
+
+#define db_open_batch_connexion(jcr, mdb) \
+           mdb->bdb_open_batch_connexion(jcr)
+#define db_strerror(mdb) \
+           mdb->bdb_strerror()
+#define db_debug_print(jcr, fp) \
+           bdb_debug_print(jcr, fp)
+#define db_check_max_connections(jcr, mdb, maxc) \
+           mdb->bdb_check_max_connections(jcr, maxc)
 
 /* sql_create.c */
-int db_create_path_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar);
-bool db_create_file_attributes_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar);
-bool db_create_job_record(JCR *jcr, B_DB *db, JOB_DBR *jr);
-int db_create_media_record(JCR *jcr, B_DB *db, MEDIA_DBR *media_dbr);
-int db_create_client_record(JCR *jcr, B_DB *db, CLIENT_DBR *cr);
-bool db_create_fileset_record(JCR *jcr, B_DB *db, FILESET_DBR *fsr);
-bool db_create_pool_record(JCR *jcr, B_DB *db, POOL_DBR *pool_dbr);
-bool db_create_jobmedia_record(JCR *jcr, B_DB *mdb, JOBMEDIA_DBR *jr);
-int db_create_counter_record(JCR *jcr, B_DB *mdb, COUNTER_DBR *cr);
-bool db_create_device_record(JCR *jcr, B_DB *mdb, DEVICE_DBR *dr);
-bool db_create_storage_record(JCR *jcr, B_DB *mdb, STORAGE_DBR *sr);
-bool db_create_mediatype_record(JCR *jcr, B_DB *mdb, MEDIATYPE_DBR *mr);
-bool db_write_batch_file_records(JCR *jcr);
-bool db_create_attributes_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar);
-bool db_create_restore_object_record(JCR *jcr, B_DB *mdb, ROBJECT_DBR *ar);
-bool db_create_base_file_attributes_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar);
-bool db_commit_base_file_attributes_record(JCR *jcr, B_DB *mdb);
-bool db_create_base_file_list(JCR *jcr, B_DB *mdb, char *jobids);
-void db_disable_batch_insert(bool disable);
+bool bdb_write_batch_file_records(JCR *jcr);
+void bdb_disable_batch_insert(bool disable);
+
+/* sql_get.c */
+void bdb_free_restoreobject_record(JCR *jcr, ROBJECT_DBR *rr);
+
+
+/* sql_create.c */
+#define db_create_path_record(jcr, mdb, ar) \
+           mdb->bdb_create_path_record(jcr, ar)
+#define db_create_file_attributes_record(jcr, mdb, ar) \
+           mdb->bdb_create_file_attributes_record(jcr, ar)
+#define db_create_job_record(jcr, mdb, jr) \
+           mdb->bdb_create_job_record(jcr, jr)
+#define db_create_media_record(jcr, mdb, media_dbr) \
+           mdb->bdb_create_media_record(jcr, media_dbr)
+#define db_create_client_record(jcr, mdb, cr) \
+           mdb->bdb_create_client_record(jcr, cr)
+#define db_create_fileset_record(jcr, mdb, fsr) \
+           mdb->bdb_create_fileset_record(jcr, fsr)
+#define db_create_pool_record(jcr, mdb, pool_dbr) \
+           mdb->bdb_create_pool_record(jcr, pool_dbr)
+#define db_create_jobmedia_record(jcr, mdb, jr) \
+           mdb->bdb_create_jobmedia_record(jcr, jr)
+#define db_create_counter_record(jcr, mdb, cr) \
+           mdb->bdb_create_counter_record(jcr, cr)
+#define db_create_device_record(jcr, mdb, dr) \
+           mdb->bdb_create_device_record(jcr, dr)
+#define db_create_storage_record(jcr, mdb, sr) \
+           mdb->bdb_create_storage_record(jcr, sr)
+#define db_create_mediatype_record(jcr, mdb, mr) \
+           mdb->bdb_create_mediatype_record(jcr, mr)
+#define db_write_batch_file_records(jcr) \
+           bdb_write_batch_file_records(jcr)
+#define db_create_attributes_record(jcr, mdb, ar) \
+           mdb->bdb_create_attributes_record(jcr, ar)
+#define db_create_restore_object_record(jcr, mdb, ar) \
+           mdb->bdb_create_restore_object_record(jcr, ar)
+#define db_create_base_file_attributes_record(jcr, mdb, ar) \
+           mdb->bdb_create_base_file_attributes_record(jcr, ar)
+#define db_commit_base_file_attributes_record(jcr, mdb) \
+           mdb->bdb_commit_base_file_attributes_record(jcr)
+#define db_create_base_file_list(jcr, mdb, jobids) \
+           mdb->bdb_create_base_file_list(jcr, jobids)
+#define db_disable_batch_insert(disable) \
+           bdb_disable_batch_insert(disable)
+#define db_create_snapshot_record(jcr, mdb, sr) \
+           mdb->bdb_create_snapshot_record(jcr, sr)
+
 
 /* sql_delete.c */
-int db_delete_pool_record(JCR *jcr, B_DB *db, POOL_DBR *pool_dbr);
-int db_delete_media_record(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr);
+#define db_delete_pool_record(jcr, mdb, pool_dbr) \
+           mdb->bdb_delete_pool_record(jcr, pool_dbr)
+#define db_delete_media_record(jcr, mdb, mr) \
+           mdb->bdb_delete_media_record(jcr, mr)
+#define db_purge_media_record(jcr, mdb, mr) \
+           mdb->bdb_purge_media_record(jcr, mr)
+#define db_delete_snapshot_record(jcr, mdb, sr) \
+           mdb->bdb_delete_snapshot_record(jcr, sr)
+
 
 /* sql_find.c */
-bool db_find_last_job_start_time(JCR *jcr, B_DB *mdb, JOB_DBR *jr, POOLMEM **stime, char *job, int JobLevel);
-bool db_find_job_start_time(JCR *jcr, B_DB *mdb, JOB_DBR *jr, POOLMEM **stime, char *job);
-bool db_find_last_jobid(JCR *jcr, B_DB *mdb, const char *Name, JOB_DBR *jr);
-int db_find_next_volume(JCR *jcr, B_DB *mdb, int index, bool InChanger, MEDIA_DBR *mr);
-bool db_find_failed_job_since(JCR *jcr, B_DB *mdb, JOB_DBR *jr, POOLMEM *stime, int &JobLevel);
+#define db_find_last_job_start_time(jcr, mdb, jr, stime, job, JobLevel) \
+           mdb->bdb_find_last_job_start_time(jcr, jr, stime, job, JobLevel)
+#define db_find_job_start_time(jcr, mdb, jr, stime, job) \
+           mdb->bdb_find_job_start_time(jcr, jr, stime, job)
+#define db_find_last_jobid(jcr, mdb, Name, jr) \
+           mdb->bdb_find_last_jobid(jcr, Name, jr)
+#define db_find_next_volume(jcr, mdb, index, InChanger, mr) \
+           mdb->bdb_find_next_volume(jcr, index, InChanger, mr)
+#define db_find_failed_job_since(jcr, mdb, jr, stime, JobLevel) \
+           mdb->bdb_find_failed_job_since(jcr, jr, stime, JobLevel)
 
 /* sql_get.c */
-bool db_get_volume_jobids(JCR *jcr, B_DB *mdb,
-                         MEDIA_DBR *mr, db_list_ctx *lst);
-bool db_get_base_file_list(JCR *jcr, B_DB *mdb, bool use_md5,
-                           DB_RESULT_HANDLER *result_handler,void *ctx);
-int db_get_path_record(JCR *jcr, B_DB *mdb);
-bool db_get_pool_record(JCR *jcr, B_DB *mdb, POOL_DBR *pdbr);
-bool db_get_pool_numvols(JCR *jcr, B_DB *mdb, POOL_DBR *pdbr);
-int db_get_client_record(JCR *jcr, B_DB *mdb, CLIENT_DBR *cr);
-bool db_get_job_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr);
-int db_get_job_volume_names(JCR *jcr, B_DB *mdb, JobId_t JobId, POOLMEM **VolumeNames);
-int db_get_file_attributes_record(JCR *jcr, B_DB *mdb, char *fname, JOB_DBR *jr, FILE_DBR *fdbr);
-int db_get_fileset_record(JCR *jcr, B_DB *mdb, FILESET_DBR *fsr);
-bool db_get_media_record(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr);
-int db_get_num_media_records(JCR *jcr, B_DB *mdb);
-int db_get_num_pool_records(JCR *jcr, B_DB *mdb);
-int db_get_pool_ids(JCR *jcr, B_DB *mdb, int *num_ids, DBId_t **ids);
-int db_get_client_ids(JCR *jcr, B_DB *mdb, int *num_ids, DBId_t **ids);
-bool db_get_media_ids(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr, int *num_ids, uint32_t **ids);
-int db_get_job_volume_parameters(JCR *jcr, B_DB *mdb, JobId_t JobId, VOL_PARAMS **VolParams);
-int db_get_client_record(JCR *jcr, B_DB *mdb, CLIENT_DBR *cdbr);
-int db_get_counter_record(JCR *jcr, B_DB *mdb, COUNTER_DBR *cr);
-bool db_get_query_dbids(JCR *jcr, B_DB *mdb, POOL_MEM &query, dbid_list &ids);
-bool db_get_file_list(JCR *jcr, B_DB *mdb, char *jobids,
-                      bool use_md5, bool use_delta,
-                      DB_RESULT_HANDLER *result_handler, void *ctx);
-bool db_get_base_jobid(JCR *jcr, B_DB *mdb, JOB_DBR *jr, JobId_t *jobid);
-bool db_accurate_get_jobids(JCR *jcr, B_DB *mdb, JOB_DBR *jr, db_list_ctx *jobids);
-bool db_get_used_base_jobids(JCR *jcr, B_DB *mdb, POOLMEM *jobids, db_list_ctx *result);
+#define db_get_volume_jobids(jcr, mdb, mr, lst) \
+           mdb->bdb_get_volume_jobids(jcr, mr, lst)
+#define db_get_base_file_list(jcr, mdb, use_md5, result_handler, ctx) \
+           mdb->bdb_get_base_file_list(jcr, use_md5, result_handler, ctx)
+#define db_get_path_record(jcr, mdb) \
+           mdb->bdb_get_path_record(jcr)
+#define db_get_pool_record(jcr, mdb, pdbr) \
+           mdb->bdb_get_pool_record(jcr, pdbr)
+#define db_get_pool_numvols(jcr, mdb, pdbr) \
+           mdb->bdb_get_pool_numvols(jcr, pdbr)
+#define db_get_client_record(jcr, mdb, cr) \
+           mdb->bdb_get_client_record(jcr, cr)
+#define db_get_job_record(jcr, mdb, jr) \
+           mdb->bdb_get_job_record(jcr, jr)
+#define db_get_job_volume_names(jcr, mdb, JobId, VolumeNames) \
+           mdb->bdb_get_job_volume_names(jcr, JobId, VolumeNames)
+#define db_get_file_attributes_record(jcr, mdb, fname, jr, fdbr) \
+           mdb->bdb_get_file_attributes_record(jcr, fname, jr, fdbr)
+#define db_get_fileset_record(jcr, mdb, fsr) \
+           mdb->bdb_get_fileset_record(jcr, fsr)
+#define db_get_media_record(jcr, mdb, mr) \
+           mdb->bdb_get_media_record(jcr, mr)
+#define db_get_num_media_records(jcr, mdb) \
+           mdb->bdb_get_num_media_records(jcr)
+#define db_get_num_pool_records(jcr, mdb) \
+           mdb->bdb_get_num_pool_records(jcr)
+#define db_get_pool_ids(jcr, mdb, num_ids, ids) \
+           mdb->bdb_get_pool_ids(jcr, num_ids, ids)
+#define db_get_client_ids(jcr, mdb, num_ids, ids) \
+           mdb->bdb_get_client_ids(jcr, num_ids, ids)
+#define db_get_media_ids(jcr, mdb, mr, num_ids, ids) \
+           mdb->bdb_get_media_ids(jcr, mr, num_ids, ids)
+#define db_get_job_volume_parameters(jcr, mdb, JobId, VolParams) \
+           mdb->bdb_get_job_volume_parameters(jcr, JobId, VolParams)
+#define db_get_counter_record(jcr, mdb, cr) \
+           mdb->bdb_get_counter_record(jcr, cr)
+#define db_get_query_dbids(jcr, mdb, query, ids) \
+           mdb->bdb_get_query_dbids(jcr, query, ids)
+#define db_get_file_list(jcr, mdb, jobids, use_md5, use_delta, result_handler, ctx) \
+           mdb->bdb_get_file_list(jcr, jobids, use_md5, use_delta, result_handler, ctx)
+#define db_get_base_jobid(jcr, mdb, jr, jobid) \
+           mdb->bdb_get_base_jobid(jcr, jr, jobid)
+#define db_get_accurate_jobids(jcr, mdb, jr, jobids) \
+           mdb->bdb_get_accurate_jobids(jcr, jr, jobids)
+#define db_get_used_base_jobids(jcr, mdb, jobids, result) \
+           mdb->bdb_get_used_base_jobids(jcr, jobids, result)
+#define db_get_restoreobject_record(jcr, mdb, rr) \
+           mdb->bdb_get_restoreobject_record(jcr, rr)
+#define db_get_type_index(mdb) \
+           mdb->bdb_get_type_index()
+#define db_get_engine_name(mdb) \
+           mdb->bdb_get_engine_name()
+#define db_get_snapshot_record(jcr, mdb, sr) \
+           mdb->bdb_get_snapshot_record(jcr, sr)
+
 /* sql_list.c */
-enum e_list_type {
-   HORZ_LIST,
-   VERT_LIST,
-   FAILED_JOBS,
-   INCOMPLETE_JOBS
-};
-
-void db_list_pool_records(JCR *jcr, B_DB *db, POOL_DBR *pr, DB_LIST_HANDLER sendit, void *ctx, e_list_type type);
-alist *db_list_job_records(JCR *jcr, B_DB *db, JOB_DBR *jr, DB_LIST_HANDLER sendit, void *ctx, e_list_type type);
-void db_list_job_totals(JCR *jcr, B_DB *db, JOB_DBR *jr, DB_LIST_HANDLER sendit, void *ctx);
-void db_list_files_for_job(JCR *jcr, B_DB *db, uint32_t jobid, DB_LIST_HANDLER sendit, void *ctx);
-void db_list_media_records(JCR *jcr, B_DB *mdb, MEDIA_DBR *mdbr, DB_LIST_HANDLER *sendit, void *ctx, e_list_type type);
-void db_list_jobmedia_records(JCR *jcr, B_DB *mdb, JobId_t JobId, DB_LIST_HANDLER *sendit, void *ctx, e_list_type type);
-void db_list_joblog_records(JCR *jcr, B_DB *mdb, JobId_t JobId, DB_LIST_HANDLER *sendit, void *ctx, e_list_type type);
-int  db_list_sql_query(JCR *jcr, B_DB *mdb, const char *query, DB_LIST_HANDLER *sendit, void *ctx, int verbose, e_list_type type);
-void db_list_client_records(JCR *jcr, B_DB *mdb, DB_LIST_HANDLER *sendit, void *ctx, e_list_type type);
-void db_list_copies_records(JCR *jcr, B_DB *mdb, uint32_t limit, char *jobids, DB_LIST_HANDLER *sendit, void *ctx, e_list_type type);
-void
-db_list_base_files_for_job(JCR *jcr, B_DB *mdb, JobId_t jobid, DB_LIST_HANDLER *sendit, void *ctx);
+#define db_list_pool_records(jcr, mdb, pr, sendit, ctx, type) \
+           mdb->bdb_list_pool_records(jcr, pr, sendit, ctx, type)
+#define db_list_job_records(jcr, mdb, jr, sendit, ctx, type) \
+           mdb->bdb_list_job_records(jcr, jr, sendit, ctx, type)
+#define db_list_job_totals(jcr, mdb, jr, sendit, ctx) \
+           mdb->bdb_list_job_totals(jcr, jr, sendit, ctx)
+#define db_list_files_for_job(jcr, mdb, jobid, sendit, ctx) \
+           mdb->bdb_list_files_for_job(jcr, jobid, sendit, ctx)
+#define db_list_media_records(jcr, mdb, mdbr, sendit, ctx, type) \
+           mdb->bdb_list_media_records(jcr, mdbr, sendit, ctx, type)
+#define db_list_jobmedia_records(jcr, mdb, JobId, sendit, ctx, type) \
+           mdb->bdb_list_jobmedia_records(jcr, JobId, sendit, ctx, type)
+#define db_list_joblog_records(jcr, mdb, JobId, sendit, ctx, type) \
+           mdb->bdb_list_joblog_records(jcr, JobId, sendit, ctx, type)
+#define db_list_sql_query(jcr, mdb, query, sendit, ctx, verbose, type) \
+           mdb->bdb_list_sql_query(jcr, query, sendit, ctx, verbose, type)
+#define db_list_client_records(jcr, mdb, sendit, ctx, type) \
+           mdb->bdb_list_client_records(jcr, sendit, ctx, type)
+#define db_list_copies_records(jcr, mdb, limit, jobids, sendit, ctx, type) \
+           mdb->bdb_list_copies_records(jcr, limit, jobids, sendit, ctx, type)
+#define db_list_base_files_for_job(jcr, mdb, jobid, sendit, ctx) \
+           mdb->bdb_list_base_files_for_job(jcr, jobid, sendit, ctx)
+#define db_list_restore_objects(jcr, mdb, rr, sendit, ctx, type) \
+           mdb->bdb_list_restore_objects(jcr, rr, sendit, ctx, type)
+#define db_list_snapshot_records(jcr, mdb, snapdbr, sendit, ua, llist) \
+           mdb->bdb_list_snapshot_records(jcr, snapdbr, sendit, ua, llist)
+
 
 
 /* sql_update.c */
-bool db_update_job_start_record(JCR *jcr, B_DB *db, JOB_DBR *jr);
-int  db_update_job_end_record(JCR *jcr, B_DB *db, JOB_DBR *jr);
-int  db_update_client_record(JCR *jcr, B_DB *mdb, CLIENT_DBR *cr);
-int  db_update_pool_record(JCR *jcr, B_DB *db, POOL_DBR *pr);
-bool db_update_storage_record(JCR *jcr, B_DB *mdb, STORAGE_DBR *sr);
-int  db_update_media_record(JCR *jcr, B_DB *db, MEDIA_DBR *mr);
-int  db_update_media_defaults(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr);
-int  db_update_counter_record(JCR *jcr, B_DB *mdb, COUNTER_DBR *cr);
-int  db_add_digest_to_file_record(JCR *jcr, B_DB *mdb, FileId_t FileId, char *digest, int type);
-int  db_mark_file_record(JCR *jcr, B_DB *mdb, FileId_t FileId, JobId_t JobId);
-void db_make_inchanger_unique(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr);
-int db_update_stats(JCR *jcr, B_DB *mdb, utime_t age);
+#define db_update_job_start_record(jcr, mdb, jr) \
+           mdb->bdb_update_job_start_record(jcr, jr)
+#define db_update_job_end_record(jcr, mdb, jr) \
+           mdb->bdb_update_job_end_record(jcr, jr)
+#define db_update_client_record(jcr, mdb, cr) \
+           mdb->bdb_update_client_record(jcr, cr)
+#define db_update_pool_record(jcr, mdb, pr) \
+           mdb->bdb_update_pool_record(jcr, pr)
+#define db_update_storage_record(jcr, mdb, sr) \
+           mdb->bdb_update_storage_record(jcr, sr)
+#define db_update_media_record(jcr, mdb, mr) \
+           mdb->bdb_update_media_record(jcr, mr)
+#define db_update_media_defaults(jcr, mdb, mr) \
+           mdb->bdb_update_media_defaults(jcr, mr)
+#define db_update_counter_record(jcr, mdb, cr) \
+           mdb->bdb_update_counter_record(jcr, cr)
+#define db_add_digest_to_file_record(jcr, mdb, FileId, digest, type) \
+           mdb->bdb_add_digest_to_file_record(jcr, FileId, digest, type)
+#define db_mark_file_record(jcr, mdb, FileId, JobId) \
+           mdb->bdb_mark_file_record(jcr, FileId, JobId)
+#define db_make_inchanger_unique(jcr, mdb, mr) \
+           mdb->bdb_make_inchanger_unique(jcr, mr)
+#define db_update_stats(jcr, mdb, age) \
+           mdb->bdb_update_stats(jcr, age)
+#define db_update_snapshot_record(jcr, mdb, sr) \
+           mdb->bdb_update_snapshot_record(jcr, sr)
+
 
 #endif /* __SQL_PROTOS_H */
diff --git a/src/cats/sql.c b/src/cats/sql.c
index 2a5af22..4b1278d 100644
--- a/src/cats/sql.c
+++ b/src/cats/sql.c
@@ -1,756 +1,793 @@
-/*
-   Bacula® - The Network Backup Solution
+/* 
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
-/*
- * Bacula Catalog Database interface routines
- *
- *     Almost generic set of SQL database interface routines
- *      (with a little more work)
- *     SQL engine specific routines are in mysql.c, postgresql.c,
- *       sqlite.c, ...
- *
- *    Written by Kern Sibbald, March 2000
- *
- */
-
-#include "bacula.h"
-
-#if HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL
-
-#include "cats.h"
-#include "bdb_priv.h"
-#include "sql_glue.h"
-
-/* Forward referenced subroutines */
-void print_dashes(B_DB *mdb);
-void print_result(B_DB *mdb);
-
-dbid_list::dbid_list()
-{
-   memset(this, 0, sizeof(dbid_list));
-   max_ids = 1000;
-   DBId = (DBId_t *)malloc(max_ids * sizeof(DBId_t));
-   num_ids = num_seen = tot_ids = 0;
-   PurgedFiles = NULL;
-}
-
-dbid_list::~dbid_list()
-{
-   free(DBId);
-}
-
-/*
- * Called here to retrieve an string list from the database
- */
-int db_string_list_handler(void *ctx, int num_fields, char **row)
-{
-   alist **val = (alist **)ctx;
-
-   if (row[0]) {
-      (*val)->append(bstrdup(row[0]));
-   }
-
-   return 0;
-}
-
-/*
- * Called here to retrieve an integer from the database
- */
-int db_int_handler(void *ctx, int num_fields, char **row)
-{
-   uint32_t *val = (uint32_t *)ctx;
-
-   Dmsg1(800, "int_handler starts with row pointing at %x\n", row);
-
-   if (row[0]) {
-      Dmsg1(800, "int_handler finds '%s'\n", row[0]);
-      *val = str_to_int64(row[0]);
-   } else {
-      Dmsg0(800, "int_handler finds zero\n");
-      *val = 0;
-   }
-   Dmsg0(800, "int_handler finishes\n");
-   return 0;
-}
-
-/*
- * Called here to retrieve a 32/64 bit integer from the database.
- *   The returned integer will be extended to 64 bit.
- */
-int db_int64_handler(void *ctx, int num_fields, char **row)
-{
-   db_int64_ctx *lctx = (db_int64_ctx *)ctx;
-
-   if (row[0]) {
-      lctx->value = str_to_int64(row[0]);
-      lctx->count++;
-   }
-   return 0;
-}
-
-/*
- * Called here to retrieve a btime from the database.
- *   The returned integer will be extended to 64 bit.
- */
-int db_strtime_handler(void *ctx, int num_fields, char **row)
-{
-   db_int64_ctx *lctx = (db_int64_ctx *)ctx;
-
-   if (row[0]) {
-      lctx->value = str_to_utime(row[0]);
-      lctx->count++;
-   }
-   return 0;
-}
-
-/*
- * Use to build a comma separated list of values from a query. "10,20,30"
- */
-int db_list_handler(void *ctx, int num_fields, char **row)
-{
-   db_list_ctx *lctx = (db_list_ctx *)ctx;
-   if (num_fields == 1 && row[0]) {
-      lctx->add(row[0]);
-   }
-   return 0;
-}
-
-/*
- * specific context passed from db_check_max_connections to db_max_connections_handler.
- */
-struct max_connections_context {
-   B_DB *db;
-   uint32_t nr_connections;
-};
-
-/*
- * Called here to retrieve an integer from the database
- */
-static inline int db_max_connections_handler(void *ctx, int num_fields, char **row)
-{
-   struct max_connections_context *context;
-   uint32_t index;
-
-   context = (struct max_connections_context *)ctx;
-   switch (db_get_type_index(context->db)) {
-   case SQL_TYPE_MYSQL:
-      index = 1;
-   default:
-      index = 0;
-   }
-
-   if (row[index]) {
-      context->nr_connections = str_to_int64(row[index]);
-   } else {
-      Dmsg0(800, "int_handler finds zero\n");
-      context->nr_connections = 0;
-   }
-   return 0;
-}
-
-/*
- * Check catalog max_connections setting
- */
-bool db_check_max_connections(JCR *jcr, B_DB *mdb, uint32_t max_concurrent_jobs)
-{
-   struct max_connections_context context;
-
-   /* Without Batch insert, no need to verify max_connections */
-   if (!mdb->batch_insert_available())
-      return true;
-
-   context.db = mdb;
-   context.nr_connections = 0;
-
-   /* Check max_connections setting */
-   if (!db_sql_query(mdb, sql_get_max_connections[db_get_type_index(mdb)],
-                     db_max_connections_handler, &context)) {
-      Jmsg(jcr, M_ERROR, 0, "Can't verify max_connections settings %s", mdb->errmsg);
-      return false;
-   }
-   if (context.nr_connections && max_concurrent_jobs && max_concurrent_jobs > context.nr_connections) {
-      Mmsg(mdb->errmsg,
-           _("Potential performance problem:\n"
-             "max_connections=%d set for %s database \"%s\" should be larger than Director's "
-             "MaxConcurrentJobs=%d\n"),
-           context.nr_connections, db_get_type(mdb), mdb->get_db_name(), max_concurrent_jobs);
-      Jmsg(jcr, M_WARNING, 0, "%s", mdb->errmsg);
-      return false;
-   }
-
-   return true;
-}
-
-/* NOTE!!! The following routines expect that the
- *  calling subroutine sets and clears the mutex
- */
-
-/* Check that the tables correspond to the version we want */
-bool check_tables_version(JCR *jcr, B_DB *mdb)
-{
-   uint32_t bacula_db_version = 0;
-   const char *query = "SELECT VersionId FROM Version";
-
-   bacula_db_version = 0;
-   if (!db_sql_query(mdb, query, db_int_handler, (void *)&bacula_db_version)) {
-      Jmsg(jcr, M_FATAL, 0, "%s", mdb->errmsg);
-      return false;
-   }
-   if (bacula_db_version != BDB_VERSION) {
-      Mmsg(mdb->errmsg, "Version error for database \"%s\". Wanted %d, got %d\n",
-          mdb->get_db_name(), BDB_VERSION, bacula_db_version);
-      Jmsg(jcr, M_FATAL, 0, "%s", mdb->errmsg);
-      return false;
-   }
-   return true;
-}
-
-/*
- * Utility routine for queries. The database MUST be locked before calling here.
- * Returns: 0 on failure
- *          1 on success
- */
-int
-QueryDB(const char *file, int line, JCR *jcr, B_DB *mdb, char *cmd)
-{
-   sql_free_result(mdb);
-   if (!sql_query(mdb, cmd, QF_STORE_RESULT)) {
-      m_msg(file, line, &mdb->errmsg, _("query %s failed:\n%s\n"), cmd, sql_strerror(mdb));
-      j_msg(file, line, jcr, M_FATAL, 0, "%s", mdb->errmsg);
-      if (verbose) {
-         j_msg(file, line, jcr, M_INFO, 0, "%s\n", cmd);
-      }
-      return 0;
-   }
-
-   return 1;
-}
-
-/*
- * Utility routine to do inserts
- * Returns: 0 on failure
- *          1 on success
- */
-int
-InsertDB(const char *file, int line, JCR *jcr, B_DB *mdb, char *cmd)
-{
-   int num_rows;
-
-   if (!sql_query(mdb, cmd)) {
-      m_msg(file, line, &mdb->errmsg,  _("insert %s failed:\n%s\n"), cmd, sql_strerror(mdb));
-      j_msg(file, line, jcr, M_FATAL, 0, "%s", mdb->errmsg);
-      if (verbose) {
-         j_msg(file, line, jcr, M_INFO, 0, "%s\n", cmd);
-      }
-      return 0;
-   }
-   num_rows = sql_affected_rows(mdb);
-   if (num_rows != 1) {
-      char ed1[30];
-      m_msg(file, line, &mdb->errmsg, _("Insertion problem: affected_rows=%s\n"),
-         edit_uint64(num_rows, ed1));
-      if (verbose) {
-         j_msg(file, line, jcr, M_INFO, 0, "%s\n", cmd);
-      }
-      return 0;
-   }
-   mdb->changes++;
-   return 1;
-}
-
-/* Utility routine for updates.
- *  Returns: 0 on failure
- *           1 on success
- */
-int
-UpdateDB(const char *file, int line, JCR *jcr, B_DB *mdb, char *cmd)
-{
-   int num_rows;
-
-   if (!sql_query(mdb, cmd)) {
-      m_msg(file, line, &mdb->errmsg, _("update %s failed:\n%s\n"), cmd, sql_strerror(mdb));
-      j_msg(file, line, jcr, M_ERROR, 0, "%s", mdb->errmsg);
-      if (verbose) {
-         j_msg(file, line, jcr, M_INFO, 0, "%s\n", cmd);
-      }
-      return 0;
-   }
-   num_rows = sql_affected_rows(mdb);
-   if (num_rows < 1) {
-      char ed1[30];
-      m_msg(file, line, &mdb->errmsg, _("Update failed: affected_rows=%s for %s\n"),
-         edit_uint64(num_rows, ed1), cmd);
-      if (verbose) {
-//       j_msg(file, line, jcr, M_INFO, 0, "%s\n", cmd);
-      }
-      return 0;
-   }
-   mdb->changes++;
-   return 1;
-}
-
-/*
- * Utility routine for deletes
- *
- * Returns: -1 on error
- *           n number of rows affected
- */
-int
-DeleteDB(const char *file, int line, JCR *jcr, B_DB *mdb, char *cmd)
-{
-
-   if (!sql_query(mdb, cmd)) {
-      m_msg(file, line, &mdb->errmsg, _("delete %s failed:\n%s\n"), cmd, sql_strerror(mdb));
-      j_msg(file, line, jcr, M_ERROR, 0, "%s", mdb->errmsg);
-      if (verbose) {
-         j_msg(file, line, jcr, M_INFO, 0, "%s\n", cmd);
-      }
-      return -1;
-   }
-   mdb->changes++;
-   return sql_affected_rows(mdb);
-}
-
-
-/*
- * Get record max. Query is already in mdb->cmd
- *  No locking done
- *
- * Returns: -1 on failure
- *          count on success
- */
-int get_sql_record_max(JCR *jcr, B_DB *mdb)
-{
-   SQL_ROW row;
-   int stat = 0;
-
-   if (QUERY_DB(jcr, mdb, mdb->cmd)) {
-      if ((row = sql_fetch_row(mdb)) == NULL) {
-         Mmsg1(&mdb->errmsg, _("error fetching row: %s\n"), sql_strerror(mdb));
-         stat = -1;
-      } else {
-         stat = str_to_int64(row[0]);
-      }
-      sql_free_result(mdb);
-   } else {
-      Mmsg1(&mdb->errmsg, _("error fetching row: %s\n"), sql_strerror(mdb));
-      stat = -1;
-   }
-   return stat;
-}
-
-/*
- * Return pre-edited error message
- */
-char *db_strerror(B_DB *mdb)
-{
-   return mdb->errmsg;
-}
-
-/*
- * Given a full filename, split it into its path
- *  and filename parts. They are returned in pool memory
- *  in the mdb structure.
- */
-void split_path_and_file(JCR *jcr, B_DB *mdb, const char *fname)
-{
-   const char *p, *f;
-
-   /* Find path without the filename.
-    * I.e. everything after the last / is a "filename".
-    * OK, maybe it is a directory name, but we treat it like
-    * a filename. If we don't find a / then the whole name
-    * must be a path name (e.g. c:).
-    */
-   for (p=f=fname; *p; p++) {
-      if (IsPathSeparator(*p)) {
-         f = p;                       /* set pos of last slash */
-      }
-   }
-   if (IsPathSeparator(*f)) {                   /* did we find a slash? */
-      f++;                            /* yes, point to filename */
-   } else {                           /* no, whole thing must be path name */
-      f = p;
-   }
-
-   /* If filename doesn't exist (i.e. root directory), we
-    * simply create a blank name consisting of a single
-    * space. This makes handling zero length filenames
-    * easier.
-    */
-   mdb->fnl = p - f;
-   if (mdb->fnl > 0) {
-      mdb->fname = check_pool_memory_size(mdb->fname, mdb->fnl+1);
-      memcpy(mdb->fname, f, mdb->fnl);    /* copy filename */
-      mdb->fname[mdb->fnl] = 0;
-   } else {
-      mdb->fname[0] = 0;
-      mdb->fnl = 0;
-   }
-
-   mdb->pnl = f - fname;
-   if (mdb->pnl > 0) {
-      mdb->path = check_pool_memory_size(mdb->path, mdb->pnl+1);
-      memcpy(mdb->path, fname, mdb->pnl);
-      mdb->path[mdb->pnl] = 0;
-   } else {
-      Mmsg1(&mdb->errmsg, _("Path length is zero. File=%s\n"), fname);
-      Jmsg(jcr, M_ERROR, 0, "%s", mdb->errmsg);
-      mdb->path[0] = 0;
-      mdb->pnl = 0;
-   }
-
-   Dmsg2(500, "split path=%s file=%s\n", mdb->path, mdb->fname);
-}
-
-/*
- * Set maximum field length to something reasonable
- */
-static int max_length(int max_length)
-{
-   int max_len = max_length;
-   /* Sanity check */
-   if (max_len < 0) {
-      max_len = 2;
-   } else if (max_len > 100) {
-      max_len = 100;
-   }
-   return max_len;
-}
-
-/*
- * List dashes as part of header for listing SQL results in a table
- */
-void list_dashes(B_DB *mdb, DB_LIST_HANDLER *send, void *ctx)
-{
-   SQL_FIELD  *field;
-   int i, j;
-   int len;
-   int num_fields;
-
-   sql_field_seek(mdb, 0);
-   send(ctx, "+");
-   num_fields = sql_num_fields(mdb);
-   for (i = 0; i < num_fields; i++) {
-      field = sql_fetch_field(mdb);
-      if (!field) {
-         break;
-      }
-      len = max_length(field->max_length + 2);
-      for (j = 0; j < len; j++) {
-         send(ctx, "-");
-      }
-      send(ctx, "+");
-   }
-   send(ctx, "\n");
-}
-
-/* Small handler to print the last line of a list xxx command */
-static void last_line_handler(void *vctx, const char *str)
-{
-   LIST_CTX *ctx = (LIST_CTX *)vctx;
-   bstrncat(ctx->line, str, sizeof(ctx->line));
-}
-
-int list_result(void *vctx, int nb_col, char **row)
-{
-   SQL_FIELD *field;
-   int i, col_len, max_len = 0;
-   int num_fields;
-   char buf[2000], ewc[30];
-
-   LIST_CTX *pctx = (LIST_CTX *)vctx;
-   DB_LIST_HANDLER *send = pctx->send;
-   e_list_type type = pctx->type;
-   B_DB *mdb = pctx->mdb;
-   void *ctx = pctx->ctx;
-   JCR *jcr = pctx->jcr;
-
-   num_fields = sql_num_fields(mdb);
-   if (!pctx->once) {
-      pctx->once = true;
-
-      Dmsg1(800, "list_result starts looking at %d fields\n", num_fields);
-      /* determine column display widths */
-      sql_field_seek(mdb, 0);
-      for (i = 0; i < num_fields; i++) {
-         Dmsg1(800, "list_result processing field %d\n", i);
-         field = sql_fetch_field(mdb);
-         if (!field) {
-            break;
-         }
-         col_len = cstrlen(field->name);
-         if (type == VERT_LIST) {
-            if (col_len > max_len) {
-               max_len = col_len;
-            }
-         } else {
-            if (sql_field_is_numeric(mdb, field->type) && (int)field->max_length > 0) { /* fixup for commas */
-               field->max_length += (field->max_length - 1) / 3;
-            }
-            if (col_len < (int)field->max_length) {
-               col_len = field->max_length;
-            }
-            if (col_len < 4 && !sql_field_is_not_null(mdb, field->flags)) {
-               col_len = 4;                 /* 4 = length of the word "NULL" */
-            }
-            field->max_length = col_len;    /* reset column info */
-         }
-      }
-
-      pctx->num_rows++;
-
-      Dmsg0(800, "list_result finished first loop\n");
-      if (type == VERT_LIST) {
-         goto vertical_list;
-      }
-
-      Dmsg1(800, "list_result starts second loop looking at %d fields\n", num_fields);
-
-      /* Keep the result to display the same line at the end of the table */
-      list_dashes(mdb, last_line_handler, pctx);
-      send(ctx, pctx->line);
-
-      send(ctx, "|");
-      sql_field_seek(mdb, 0);
-      for (i = 0; i < num_fields; i++) {
-         Dmsg1(800, "list_result looking at field %d\n", i);
-         field = sql_fetch_field(mdb);
-         if (!field) {
-            break;
-         }
-         max_len = max_length(field->max_length);
-         bsnprintf(buf, sizeof(buf), " %-*s |", max_len, field->name);
-         send(ctx, buf);
-      }
-      send(ctx, "\n");
-      list_dashes(mdb, send, ctx);
-   }
-
-   Dmsg1(800, "list_result starts third loop looking at %d fields\n", num_fields);
-
-   sql_field_seek(mdb, 0);
-   send(ctx, "|");
-   for (i = 0; i < num_fields; i++) {
-      field = sql_fetch_field(mdb);
-      if (!field) {
-         break;
-      }
-      max_len = max_length(field->max_length);
-      if (row[i] == NULL) {
-         bsnprintf(buf, sizeof(buf), " %-*s |", max_len, "NULL");
-      } else if (sql_field_is_numeric(mdb, field->type) && !jcr->gui && is_an_integer(row[i])) {
-         bsnprintf(buf, sizeof(buf), " %*s |", max_len,
-                   add_commas(row[i], ewc));
-      } else {
-         bsnprintf(buf, sizeof(buf), " %-*s |", max_len, row[i]);
-      }
-      send(ctx, buf);
-   }
-   send(ctx, "\n");
-   return 0;
-
-vertical_list:
-
-   Dmsg1(800, "list_result starts vertical list at %d fields\n", num_fields);
-
-   sql_field_seek(mdb, 0);
-   for (i = 0; i < num_fields; i++) {
-      field = sql_fetch_field(mdb);
-      if (!field) {
-         break;
-      }
-      if (row[i] == NULL) {
-         bsnprintf(buf, sizeof(buf), " %*s: %s\n", max_len, field->name, "NULL");
-      } else if (sql_field_is_numeric(mdb, field->type) && !jcr->gui && is_an_integer(row[i])) {
-         bsnprintf(buf, sizeof(buf), " %*s: %s\n", max_len, field->name,
-                   add_commas(row[i], ewc));
-      } else {
-         bsnprintf(buf, sizeof(buf), " %*s: %s\n", max_len, field->name, row[i]);
-      }
-      send(ctx, buf);
-   }
-   send(ctx, "\n");
-   return 0;
-}
-
-/*
- * If full_list is set, we list vertically, otherwise, we
- *  list on one line horizontally.
- * Return number of rows
- */
-int list_result(JCR *jcr, B_DB *mdb, DB_LIST_HANDLER *send, void *ctx, e_list_type type)
-{
-   SQL_FIELD *field;
-   SQL_ROW row;
-   int i, col_len, max_len = 0;
-   int num_fields;
-   char buf[2000], ewc[30];
-
-   Dmsg0(800, "list_result starts\n");
-   if (sql_num_rows(mdb) == 0) {
-      send(ctx, _("No results to list.\n"));
-      return sql_num_rows(mdb);
-   }
-
-   num_fields = sql_num_fields(mdb);
-   Dmsg1(800, "list_result starts looking at %d fields\n", num_fields);
-   /* determine column display widths */
-   sql_field_seek(mdb, 0);
-   for (i = 0; i < num_fields; i++) {
-      Dmsg1(800, "list_result processing field %d\n", i);
-      field = sql_fetch_field(mdb);
-      if (!field) {
-         break;
-      }
-      col_len = cstrlen(field->name);
-      if (type == VERT_LIST) {
-         if (col_len > max_len) {
-            max_len = col_len;
-         }
-      } else {
-         if (sql_field_is_numeric(mdb, field->type) && (int)field->max_length > 0) { /* fixup for commas */
-            field->max_length += (field->max_length - 1) / 3;
-         }
-         if (col_len < (int)field->max_length) {
-            col_len = field->max_length;
-         }
-         if (col_len < 4 && !sql_field_is_not_null(mdb, field->flags)) {
-            col_len = 4;                 /* 4 = length of the word "NULL" */
-         }
-         field->max_length = col_len;    /* reset column info */
-      }
-   }
-
-   Dmsg0(800, "list_result finished first loop\n");
-   if (type == VERT_LIST) {
-      goto vertical_list;
-   }
-
-   Dmsg1(800, "list_result starts second loop looking at %d fields\n", num_fields);
-   list_dashes(mdb, send, ctx);
-   send(ctx, "|");
-   sql_field_seek(mdb, 0);
-   for (i = 0; i < num_fields; i++) {
-      Dmsg1(800, "list_result looking at field %d\n", i);
-      field = sql_fetch_field(mdb);
-      if (!field) {
-         break;
-      }
-      max_len = max_length(field->max_length);
-      bsnprintf(buf, sizeof(buf), " %-*s |", max_len, field->name);
-      send(ctx, buf);
-   }
-   send(ctx, "\n");
-   list_dashes(mdb, send, ctx);
-
-   Dmsg1(800, "list_result starts third loop looking at %d fields\n", num_fields);
-   while ((row = sql_fetch_row(mdb)) != NULL) {
-      sql_field_seek(mdb, 0);
-      send(ctx, "|");
-      for (i = 0; i < num_fields; i++) {
-         field = sql_fetch_field(mdb);
-         if (!field) {
-            break;
-         }
-         max_len = max_length(field->max_length);
-         if (row[i] == NULL) {
-            bsnprintf(buf, sizeof(buf), " %-*s |", max_len, "NULL");
-         } else if (sql_field_is_numeric(mdb, field->type) && !jcr->gui && is_an_integer(row[i])) {
-            bsnprintf(buf, sizeof(buf), " %*s |", max_len,
-                      add_commas(row[i], ewc));
-         } else {
-            bsnprintf(buf, sizeof(buf), " %-*s |", max_len, row[i]);
-         }
-         send(ctx, buf);
-      }
-      send(ctx, "\n");
-   }
-   list_dashes(mdb, send, ctx);
-   return sql_num_rows(mdb);
-
-vertical_list:
-
-   Dmsg1(800, "list_result starts vertical list at %d fields\n", num_fields);
-   while ((row = sql_fetch_row(mdb)) != NULL) {
-      sql_field_seek(mdb, 0);
-      for (i = 0; i < num_fields; i++) {
-         field = sql_fetch_field(mdb);
-         if (!field) {
-            break;
-         }
-         if (row[i] == NULL) {
-            bsnprintf(buf, sizeof(buf), " %*s: %s\n", max_len, field->name, "NULL");
-         } else if (sql_field_is_numeric(mdb, field->type) && !jcr->gui && is_an_integer(row[i])) {
-            bsnprintf(buf, sizeof(buf), " %*s: %s\n", max_len, field->name,
-                add_commas(row[i], ewc));
-         } else {
-            bsnprintf(buf, sizeof(buf), " %*s: %s\n", max_len, field->name, row[i]);
-         }
-         send(ctx, buf);
-      }
-      send(ctx, "\n");
-   }
-   return sql_num_rows(mdb);
-}
-
-/*
- * Open a new connexion to mdb catalog. This function is used
- * by batch and accurate mode.
- */
-bool db_open_batch_connexion(JCR *jcr, B_DB *mdb)
-{
-   bool multi_db;
-
-   multi_db = mdb->batch_insert_available();
-
-   if (!jcr->db_batch) {
-      jcr->db_batch = db_clone_database_connection(mdb, jcr, multi_db);
-      if (!jcr->db_batch) {
-         Mmsg0(&mdb->errmsg, _("Could not init database batch connection\n"));
-         Jmsg(jcr, M_FATAL, 0, "%s", mdb->errmsg);
-         return false;
-      }
-
-      if (!db_open_database(jcr, jcr->db_batch)) {
-         Mmsg2(&mdb->errmsg,  _("Could not open database \"%s\": ERR=%s\n"),
-              jcr->db_batch->get_db_name(), db_strerror(jcr->db_batch));
-         Jmsg(jcr, M_FATAL, 0, "%s", mdb->errmsg);
-         return false;
-      }
-   }
-   return true;
-}
-
-/*
- * !!! WARNING !!! Use this function only when bacula is stopped.
- * ie, after a fatal signal and before exiting the program
- * Print information about a B_DB object.
- */
-void db_debug_print(JCR *jcr, FILE *fp)
-{
-   B_DB *mdb = jcr->db;
-
-   if (!mdb) {
-      return;
-   }
-
-   fprintf(fp, "B_DB=%p db_name=%s db_user=%s connected=%s\n",
-           mdb, NPRTB(mdb->get_db_name()), NPRTB(mdb->get_db_user()), mdb->is_connected() ? "true" : "false");
-   fprintf(fp, "\tcmd=\"%s\" changes=%i\n", NPRTB(mdb->cmd), mdb->changes);
-   mdb->print_lock_info(fp);
-}
-
-#endif /* HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL */
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/ 
+/* 
+ * Bacula Catalog Database interface routines 
+ * 
+ *     Almost generic set of SQL database interface routines 
+ *      (with a little more work) 
+ *     SQL engine specific routines are in mysql.c, postgresql.c, 
+ *       sqlite.c, ... 
+ * 
+ *    Written by Kern Sibbald, March 2000 
+ * 
+ * Note: at one point, this file was changed to class based by a certain   
+ *  programmer, and other than "wrapping" in a class, which is a trivial  
+ *  change for a C++ programmer, nothing substantial was done, yet all the  
+ *  code was recommitted under this programmer's name.  Consequently, we  
+ *  undo those changes here.  
+ */ 
+ 
+#include "bacula.h" 
+ 
+#if HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL 
+ 
+#include "cats.h" 
+ 
+/* Forward referenced subroutines */ 
+void print_dashes(BDB *mdb); 
+void print_result(BDB *mdb); 
+ 
+dbid_list::dbid_list() 
+{ 
+   memset(this, 0, sizeof(dbid_list)); 
+   max_ids = 1000; 
+   DBId = (DBId_t *)malloc(max_ids * sizeof(DBId_t)); 
+   num_ids = num_seen = tot_ids = 0; 
+   PurgedFiles = NULL; 
+} 
+ 
+dbid_list::~dbid_list() 
+{ 
+   free(DBId); 
+} 
+ 
+/* 
+ * Called here to retrieve an string list from the database 
+ */ 
+int db_string_list_handler(void *ctx, int num_fields, char **row) 
+{ 
+   alist **val = (alist **)ctx; 
+ 
+   if (row[0]) { 
+      (*val)->append(bstrdup(row[0])); 
+   } 
+ 
+   return 0; 
+} 
+ 
+/* 
+ * Called here to retrieve an integer from the database 
+ */ 
+int db_int_handler(void *ctx, int num_fields, char **row) 
+{ 
+   uint32_t *val = (uint32_t *)ctx; 
+ 
+   Dmsg1(800, "int_handler starts with row pointing at %x\n", row); 
+ 
+   if (row[0]) { 
+      Dmsg1(800, "int_handler finds '%s'\n", row[0]); 
+      *val = str_to_int64(row[0]); 
+   } else { 
+      Dmsg0(800, "int_handler finds zero\n"); 
+      *val = 0; 
+   } 
+   Dmsg0(800, "int_handler finishes\n"); 
+   return 0; 
+} 
+ 
+/* 
+ * Called here to retrieve a 32/64 bit integer from the database. 
+ *   The returned integer will be extended to 64 bit. 
+ */ 
+int db_int64_handler(void *ctx, int num_fields, char **row) 
+{ 
+   db_int64_ctx *lctx = (db_int64_ctx *)ctx; 
+ 
+   if (row[0]) { 
+      lctx->value = str_to_int64(row[0]); 
+      lctx->count++; 
+   } 
+   return 0; 
+} 
+ 
+/* 
+ * Called here to retrieve a btime from the database. 
+ *   The returned integer will be extended to 64 bit. 
+ */ 
+int db_strtime_handler(void *ctx, int num_fields, char **row) 
+{ 
+   db_int64_ctx *lctx = (db_int64_ctx *)ctx; 
+ 
+   if (row[0]) { 
+      lctx->value = str_to_utime(row[0]); 
+      lctx->count++; 
+   } 
+   return 0; 
+} 
+ 
+/* 
+ * Use to build a comma separated list of values from a query. "10,20,30" 
+ */ 
+int db_list_handler(void *ctx, int num_fields, char **row) 
+{ 
+   db_list_ctx *lctx = (db_list_ctx *)ctx; 
+   if (num_fields == 1 && row[0]) { 
+      lctx->add(row[0]); 
+   } 
+   return 0; 
+} 
+ 
+/* 
+ * specific context passed from bdb_check_max_connections to  
+ * db_max_connections_handler. 
+ */ 
+struct max_connections_context { 
+   BDB *db; 
+   uint32_t nr_connections; 
+}; 
+ 
+/* 
+ * Called here to retrieve max_connections from db 
+ */ 
+static int db_max_connections_handler(void *ctx, int num_fields, char **row) 
+{ 
+   struct max_connections_context *context; 
+   uint32_t index; 
+ 
+   context = (struct max_connections_context *)ctx; 
+   switch (context->db->bdb_get_type_index()) { 
+   case SQL_TYPE_MYSQL: 
+      index = 1; 
+   default: 
+      index = 0; 
+   } 
+ 
+   if (row[index]) { 
+      context->nr_connections = str_to_int64(row[index]); 
+   } else { 
+      Dmsg0(800, "int_handler finds zero\n"); 
+      context->nr_connections = 0; 
+   } 
+   return 0; 
+} 
+ 
+/* 
+ * Check catalog max_connections setting 
+ */ 
+bool BDB::bdb_check_max_connections(JCR *jcr, uint32_t max_concurrent_jobs) 
+{ 
+   struct max_connections_context context; 
+   
+   /* Without Batch insert, no need to verify max_connections */ 
+   if (!batch_insert_available()) 
+      return true; 
+ 
+   context.db = this; 
+   context.nr_connections = 0; 
+ 
+   /* Check max_connections setting */ 
+   if (!bdb_sql_query(sql_get_max_connections[bdb_get_type_index()], 
+                     db_max_connections_handler, &context)) { 
+      Jmsg(jcr, M_ERROR, 0, "Can't verify max_connections settings %s", errmsg); 
+      return false; 
+   } 
+   if (context.nr_connections && max_concurrent_jobs && max_concurrent_jobs > context.nr_connections) { 
+      Mmsg(errmsg, 
+           _("Potential performance problem:\n" 
+             "max_connections=%d set for %s database \"%s\" should be larger than Director's " 
+             "MaxConcurrentJobs=%d\n"), 
+           context.nr_connections, bdb_get_engine_name(), get_db_name(), max_concurrent_jobs); 
+      Jmsg(jcr, M_WARNING, 0, "%s", errmsg); 
+      return false; 
+   } 
+ 
+   return true; 
+} 
+ 
+/* NOTE!!! The following routines expect that the 
+ *  calling subroutine sets and clears the mutex 
+ */ 
+ 
+/* Check that the tables correspond to the version we want */ 
+bool BDB::bdb_check_version(JCR *jcr) 
+{ 
+   uint32_t bacula_db_version = 0; 
+   const char *query = "SELECT VersionId FROM Version"; 
+ 
+   bacula_db_version = 0; 
+   if (!bdb_sql_query(query, db_int_handler, (void *)&bacula_db_version)) { 
+      Jmsg(jcr, M_FATAL, 0, "%s", errmsg); 
+      return false; 
+   } 
+   if (bacula_db_version != BDB_VERSION) { 
+      Mmsg(errmsg, "Version error for database \"%s\". Wanted %d, got %d\n", 
+          get_db_name(), BDB_VERSION, bacula_db_version); 
+      Jmsg(jcr, M_FATAL, 0, "%s", errmsg); 
+      return false; 
+   } 
+   return true; 
+} 
+ 
+/* 
+ * Utility routine for queries. The database MUST be locked before calling here. 
+ * Returns: 0 on failure 
+ *          1 on success 
+ */ 
+bool BDB::QueryDB(JCR *jcr, char *cmd, const char *file, int line) 
+{ 
+   sql_free_result(); 
+   if (!sql_query(cmd, QF_STORE_RESULT)) { 
+      m_msg(file, line, &errmsg, _("query %s failed:\n%s\n"), cmd, sql_strerror()); 
+      if (use_fatal_jmsg()) { 
+         j_msg(file, line, jcr, M_FATAL, 0, "%s", errmsg); 
+      } 
+      if (verbose) { 
+         j_msg(file, line, jcr, M_INFO, 0, "%s\n", cmd); 
+      } 
+      return false; 
+   } 
+ 
+   return true; 
+} 
+ 
+/* 
+ * Utility routine to do inserts 
+ * Returns: 0 on failure 
+ *          1 on success 
+ */ 
+bool BDB::InsertDB(JCR *jcr, char *cmd, const char *file, int line) 
+{ 
+   if (!sql_query(cmd)) { 
+      m_msg(file, line, &errmsg,  _("insert %s failed:\n%s\n"), cmd, sql_strerror()); 
+      if (use_fatal_jmsg()) { 
+         j_msg(file, line, jcr, M_FATAL, 0, "%s", errmsg); 
+      } 
+      if (verbose) { 
+         j_msg(file, line, jcr, M_INFO, 0, "%s\n", cmd); 
+      } 
+      return false; 
+   } 
+   int num_rows = sql_affected_rows(); 
+   if (num_rows != 1) { 
+      char ed1[30]; 
+      m_msg(file, line, &errmsg, _("Insertion problem: affected_rows=%s\n"), 
+         edit_uint64(num_rows, ed1)); 
+      if (verbose) { 
+         j_msg(file, line, jcr, M_INFO, 0, "%s\n", cmd); 
+      } 
+      return false; 
+   } 
+   changes++; 
+   return true; 
+} 
+ 
+/* Utility routine for updates. 
+ *  Returns: false on failure 
+ *           true  on success 
+ */ 
+bool BDB::UpdateDB(JCR *jcr, char *cmd, const char *file, int line) 
+{ 
+   if (!sql_query(cmd)) { 
+      m_msg(file, line, &errmsg, _("update %s failed:\n%s\n"), cmd, sql_strerror()); 
+      j_msg(file, line, jcr, M_ERROR, 0, "%s", errmsg); 
+      if (verbose) { 
+         j_msg(file, line, jcr, M_INFO, 0, "%s\n", cmd); 
+      } 
+      return false; 
+   } 
+   int num_rows = sql_affected_rows(); 
+   if (num_rows < 1) { 
+      char ed1[30]; 
+      m_msg(file, line, &errmsg, _("Update failed: affected_rows=%s for %s\n"), 
+         edit_uint64(num_rows, ed1), cmd); 
+      if (verbose) { 
+//       j_msg(file, line, jcr, M_INFO, 0, "%s\n", cmd); 
+      } 
+      return false; 
+   } 
+   changes++; 
+   return true; 
+} 
+ 
+/* Utility routine for deletes 
+ * 
+ * Returns: -1 on error 
+ *           n number of rows affected 
+ */ 
+int BDB::DeleteDB(JCR *jcr, char *cmd, const char *file, int line) 
+{ 
+ 
+   if (!sql_query(cmd)) { 
+      m_msg(file, line, &errmsg, _("delete %s failed:\n%s\n"), cmd, sql_strerror()); 
+      j_msg(file, line, jcr, M_ERROR, 0, "%s", errmsg); 
+      if (verbose) { 
+         j_msg(file, line, jcr, M_INFO, 0, "%s\n", cmd); 
+      } 
+      return -1; 
+   } 
+   changes++; 
+   return sql_affected_rows(); 
+} 
+ 
+ 
+/* 
+ * Get record max. Query is already in mdb->cmd 
+ *  No locking done 
+ * 
+ * Returns: -1 on failure 
+ *          count on success 
+ */ 
+int get_sql_record_max(JCR *jcr, BDB *mdb) 
+{ 
+   SQL_ROW row; 
+   int stat = 0; 
+ 
+   if (mdb->QueryDB(jcr, mdb->cmd)) { 
+      if ((row = mdb->sql_fetch_row()) == NULL) { 
+         Mmsg1(&mdb->errmsg, _("error fetching row: %s\n"), mdb->sql_strerror()); 
+         stat = -1; 
+      } else { 
+         stat = str_to_int64(row[0]); 
+      } 
+      mdb->sql_free_result(); 
+   } else { 
+      Mmsg1(&mdb->errmsg, _("error fetching row: %s\n"), mdb->sql_strerror()); 
+      stat = -1; 
+   } 
+   return stat; 
+} 
+ 
+/* 
+ * Given a full filename, split it into its path 
+ *  and filename parts. They are returned in pool memory 
+ *  in the mdb structure. 
+ */ 
+void split_path_and_file(JCR *jcr, BDB *mdb, const char *afname) 
+{ 
+   const char *p, *f; 
+ 
+   /* Find path without the filename. 
+    * I.e. everything after the last / is a "filename". 
+    * OK, maybe it is a directory name, but we treat it like 
+    * a filename. If we don't find a / then the whole name 
+    * must be a path name (e.g. c:). 
+    */ 
+   for (p=f=afname; *p; p++) { 
+      if (IsPathSeparator(*p)) { 
+         f = p;                       /* set pos of last slash */ 
+      } 
+   } 
+   if (IsPathSeparator(*f)) {                   /* did we find a slash? */ 
+      f++;                            /* yes, point to filename */ 
+   } else {                           /* no, whole thing must be path name */ 
+      f = p; 
+   } 
+ 
+   /* If filename doesn't exist (i.e. root directory), we 
+    * simply create a blank name consisting of a single 
+    * space. This makes handling zero length filenames 
+    * easier. 
+    */ 
+   mdb->fnl = p - f; 
+   if (mdb->fnl > 0) { 
+      mdb->fname = check_pool_memory_size(mdb->fname, mdb->fnl+1); 
+      memcpy(mdb->fname, f, mdb->fnl);    /* copy filename */ 
+      mdb->fname[mdb->fnl] = 0; 
+   } else { 
+      mdb->fname[0] = 0; 
+      mdb->fnl = 0; 
+   } 
+ 
+   mdb->pnl = f - afname; 
+   if (mdb->pnl > 0) { 
+      mdb->path = check_pool_memory_size(mdb->path, mdb->pnl+1); 
+      memcpy(mdb->path, afname, mdb->pnl); 
+      mdb->path[mdb->pnl] = 0; 
+   } else { 
+      Mmsg1(&mdb->errmsg, _("Path length is zero. File=%s\n"), afname); 
+      Jmsg(jcr, M_FATAL, 0, "%s", mdb->errmsg); 
+      mdb->path[0] = 0; 
+      mdb->pnl = 0; 
+   } 
+ 
+   Dmsg3(500, "split fname=%s: path=%s file=%s\n", afname, mdb->path, mdb->fname); 
+} 
+ 
+/* 
+ * Set maximum field length to something reasonable 
+ */ 
+static int max_length(int max_length) 
+{ 
+   int max_len = max_length; 
+   /* Sanity check */ 
+   if (max_len < 0) { 
+      max_len = 2; 
+   } else if (max_len > 100) { 
+      max_len = 100; 
+   } 
+   return max_len; 
+} 
+ 
+/* 
+ * List dashes as part of header for listing SQL results in a table 
+ */ 
+void 
+list_dashes(BDB *mdb, DB_LIST_HANDLER *send, void *ctx) 
+{ 
+   SQL_FIELD  *field; 
+   int i, j; 
+   int len; 
+ 
+   mdb->sql_field_seek(0); 
+   send(ctx, "+"); 
+   for (i = 0; i < mdb->sql_num_fields(); i++) { 
+      field = mdb->sql_fetch_field(); 
+      if (!field) { 
+         break; 
+      } 
+      len = max_length(field->max_length + 2); 
+      for (j = 0; j < len; j++) { 
+         send(ctx, "-"); 
+      } 
+      send(ctx, "+"); 
+   } 
+   send(ctx, "\n"); 
+} 
+ 
+/* Small handler to print the last line of a list xxx command */ 
+static void last_line_handler(void *vctx, const char *str) 
+{ 
+   LIST_CTX *ctx = (LIST_CTX *)vctx; 
+   bstrncat(ctx->line, str, sizeof(ctx->line)); 
+} 
+ 
+int list_result(void *vctx, int nb_col, char **row) 
+{ 
+   SQL_FIELD *field; 
+   int i, col_len, max_len = 0; 
+   char buf[2000], ewc[30]; 
+ 
+   LIST_CTX *pctx = (LIST_CTX *)vctx; 
+   DB_LIST_HANDLER *send = pctx->send; 
+   e_list_type type = pctx->type; 
+   BDB *mdb = pctx->mdb; 
+   void *ctx = pctx->ctx; 
+   JCR *jcr = pctx->jcr; 
+ 
+   if (!pctx->once) { 
+      pctx->once = true; 
+ 
+      Dmsg1(800, "list_result starts looking at %d fields\n", mdb->sql_num_fields()); 
+      /* determine column display widths */ 
+      mdb->sql_field_seek(0); 
+      for (i = 0; i < mdb->sql_num_fields(); i++) { 
+         Dmsg1(800, "list_result processing field %d\n", i); 
+         field = mdb->sql_fetch_field(); 
+         if (!field) { 
+            break; 
+         } 
+         col_len = cstrlen(field->name); 
+         if (type == VERT_LIST) { 
+            if (col_len > max_len) { 
+               max_len = col_len; 
+            } 
+         } else { 
+            if (mdb->sql_field_is_numeric(field->type) && (int)field->max_length > 0) { /* fixup for commas */ 
+               field->max_length += (field->max_length - 1) / 3; 
+            } 
+            if (col_len < (int)field->max_length) { 
+               col_len = field->max_length; 
+            } 
+            if (col_len < 4 && !mdb->sql_field_is_not_null(field->flags)) { 
+               col_len = 4;                 /* 4 = length of the word "NULL" */ 
+            } 
+            field->max_length = col_len;    /* reset column info */ 
+         } 
+      } 
+ 
+      pctx->num_rows++; 
+ 
+      Dmsg0(800, "list_result finished first loop\n"); 
+      if (type == VERT_LIST) { 
+         goto vertical_list; 
+      } 
+      if (type == ARG_LIST) { 
+         goto arg_list; 
+      } 
+ 
+      Dmsg1(800, "list_result starts second loop looking at %d fields\n",  
+            mdb->sql_num_fields()); 
+ 
+      /* Keep the result to display the same line at the end of the table */ 
+      list_dashes(mdb, last_line_handler, pctx); 
+      send(ctx, pctx->line); 
+ 
+      send(ctx, "|"); 
+      mdb->sql_field_seek(0); 
+      for (i = 0; i < mdb->sql_num_fields(); i++) { 
+         Dmsg1(800, "list_result looking at field %d\n", i); 
+         field = mdb->sql_fetch_field(); 
+         if (!field) { 
+            break; 
+         } 
+         max_len = max_length(field->max_length); 
+         bsnprintf(buf, sizeof(buf), " %-*s |", max_len, field->name); 
+         send(ctx, buf); 
+      } 
+      send(ctx, "\n"); 
+      list_dashes(mdb, send, ctx); 
+   } 
+   Dmsg1(800, "list_result starts third loop looking at %d fields\n",  
+         mdb->sql_num_fields()); 
+   mdb->sql_field_seek(0); 
+   send(ctx, "|"); 
+   for (i = 0; i < mdb->sql_num_fields(); i++) { 
+      field = mdb->sql_fetch_field(); 
+      if (!field) { 
+         break; 
+      } 
+      max_len = max_length(field->max_length); 
+      if (row[i] == NULL) { 
+         bsnprintf(buf, sizeof(buf), " %-*s |", max_len, "NULL"); 
+      } else if (mdb->sql_field_is_numeric(field->type) && !jcr->gui && is_an_integer(row[i])) { 
+         bsnprintf(buf, sizeof(buf), " %*s |", max_len, 
+                   add_commas(row[i], ewc)); 
+      } else { 
+         bsnprintf(buf, sizeof(buf), " %-*s |", max_len, row[i]); 
+      } 
+      send(ctx, buf); 
+   } 
+   send(ctx, "\n"); 
+   return 0; 
+ 
+vertical_list: 
+ 
+   Dmsg1(800, "list_result starts vertical list at %d fields\n", mdb->sql_num_fields()); 
+   mdb->sql_field_seek(0); 
+   for (i = 0; i < mdb->sql_num_fields(); i++) { 
+      field = mdb->sql_fetch_field(); 
+      if (!field) { 
+         break; 
+      } 
+      if (row[i] == NULL) { 
+         bsnprintf(buf, sizeof(buf), " %*s: %s\n", max_len, field->name, "NULL"); 
+      } else if (mdb->sql_field_is_numeric(field->type) && !jcr->gui && is_an_integer(row[i])) { 
+         bsnprintf(buf, sizeof(buf), " %*s: %s\n", max_len, field->name, 
+                   add_commas(row[i], ewc)); 
+      } else { 
+         bsnprintf(buf, sizeof(buf), " %*s: %s\n", max_len, field->name, row[i]); 
+      } 
+      send(ctx, buf); 
+   } 
+   send(ctx, "\n"); 
+   return 0; 
+ 
+arg_list: 
+   Dmsg1(800, "list_result starts simple list at %d fields\n", mdb->sql_num_fields()); 
+   mdb->sql_field_seek(0); 
+   for (i = 0; i < mdb->sql_num_fields(); i++) { 
+      field = mdb->sql_fetch_field(); 
+      if (!field) { 
+         break; 
+      } 
+      if (row[i] == NULL) { 
+         bsnprintf(buf, sizeof(buf), "%s%s=", (i>0?" ":""), field->name); 
+      } else { 
+         bash_spaces(row[i]); 
+         bsnprintf(buf, sizeof(buf), "%s%s=%s ", (i>0?" ":""), field->name, row[i]); 
+      } 
+      send(ctx, buf); 
+   } 
+   send(ctx, "\n"); 
+   return 0; 
+ 
+} 
+ 
+/* 
+ * If full_list is set, we list vertically, otherwise, we 
+ *  list on one line horizontally. 
+ * Return number of rows 
+ */ 
+int 
+list_result(JCR *jcr, BDB *mdb, DB_LIST_HANDLER *send, void *ctx, e_list_type type) 
+{ 
+   SQL_FIELD *field; 
+   SQL_ROW row; 
+   int i, col_len, max_len = 0; 
+   char buf[2000], ewc[30]; 
+ 
+   Dmsg0(800, "list_result starts\n"); 
+   if (mdb->sql_num_rows() == 0) { 
+      send(ctx, _("No results to list.\n")); 
+      return mdb->sql_num_rows(); 
+   } 
+ 
+   Dmsg1(800, "list_result starts looking at %d fields\n", mdb->sql_num_fields()); 
+   /* determine column display widths */ 
+   mdb->sql_field_seek(0); 
+   for (i = 0; i < mdb->sql_num_fields(); i++) { 
+      Dmsg1(800, "list_result processing field %d\n", i); 
+      field = mdb->sql_fetch_field(); 
+      if (!field) { 
+         break; 
+      } 
+      col_len = cstrlen(field->name); 
+      if (type == VERT_LIST) { 
+         if (col_len > max_len) { 
+            max_len = col_len; 
+         } 
+      } else { 
+         if (mdb->sql_field_is_numeric(field->type) && (int)field->max_length > 0) { /* fixup for commas */ 
+            field->max_length += (field->max_length - 1) / 3; 
+         } 
+         if (col_len < (int)field->max_length) { 
+            col_len = field->max_length; 
+         } 
+         if (col_len < 4 && !mdb->sql_field_is_not_null(field->flags)) { 
+            col_len = 4;                 /* 4 = length of the word "NULL" */ 
+         } 
+         field->max_length = col_len;    /* reset column info */ 
+      } 
+   } 
+ 
+   Dmsg0(800, "list_result finished first loop\n"); 
+   if (type == VERT_LIST) { 
+      goto vertical_list; 
+   } 
+   if (type == ARG_LIST) { 
+      goto arg_list; 
+   } 
+ 
+   Dmsg1(800, "list_result starts second loop looking at %d fields\n", mdb->sql_num_fields()); 
+   list_dashes(mdb, send, ctx); 
+   send(ctx, "|"); 
+   mdb->sql_field_seek(0); 
+   for (i = 0; i < mdb->sql_num_fields(); i++) { 
+      Dmsg1(800, "list_result looking at field %d\n", i); 
+      field = mdb->sql_fetch_field(); 
+      if (!field) { 
+         break; 
+      } 
+      max_len = max_length(field->max_length); 
+      bsnprintf(buf, sizeof(buf), " %-*s |", max_len, field->name); 
+      send(ctx, buf); 
+   } 
+   send(ctx, "\n"); 
+   list_dashes(mdb, send, ctx); 
+ 
+   Dmsg1(800, "list_result starts third loop looking at %d fields\n", mdb->sql_num_fields()); 
+   while ((row = mdb->sql_fetch_row()) != NULL) { 
+      mdb->sql_field_seek(0); 
+      send(ctx, "|"); 
+      for (i = 0; i < mdb->sql_num_fields(); i++) { 
+         field = mdb->sql_fetch_field(); 
+         if (!field) { 
+            break; 
+         } 
+         max_len = max_length(field->max_length); 
+         if (row[i] == NULL) { 
+            bsnprintf(buf, sizeof(buf), " %-*s |", max_len, "NULL"); 
+         } else if (mdb->sql_field_is_numeric(field->type) && !jcr->gui && is_an_integer(row[i])) { 
+            bsnprintf(buf, sizeof(buf), " %*s |", max_len, 
+                      add_commas(row[i], ewc)); 
+         } else { 
+            bsnprintf(buf, sizeof(buf), " %-*s |", max_len, row[i]); 
+         } 
+         send(ctx, buf); 
+      } 
+      send(ctx, "\n"); 
+   } 
+   list_dashes(mdb, send, ctx); 
+   return mdb->sql_num_rows(); 
+ 
+vertical_list: 
+ 
+   Dmsg1(800, "list_result starts vertical list at %d fields\n", mdb->sql_num_fields()); 
+   while ((row = mdb->sql_fetch_row()) != NULL) { 
+      mdb->sql_field_seek(0); 
+      for (i = 0; i < mdb->sql_num_fields(); i++) { 
+         field = mdb->sql_fetch_field(); 
+         if (!field) { 
+            break; 
+         } 
+         if (row[i] == NULL) { 
+            bsnprintf(buf, sizeof(buf), " %*s: %s\n", max_len, field->name, "NULL"); 
+         } else if (mdb->sql_field_is_numeric(field->type) && !jcr->gui && is_an_integer(row[i])) { 
+            bsnprintf(buf, sizeof(buf), " %*s: %s\n", max_len, field->name, 
+                add_commas(row[i], ewc)); 
+         } else { 
+            bsnprintf(buf, sizeof(buf), " %*s: %s\n", max_len, field->name, row[i]); 
+         } 
+         send(ctx, buf); 
+      } 
+      send(ctx, "\n"); 
+   } 
+ 
+arg_list: 
+ 
+   Dmsg1(800, "list_result starts arg list at %d fields\n", mdb->sql_num_fields()); 
+   while ((row = mdb->sql_fetch_row()) != NULL) { 
+      mdb->sql_field_seek(0); 
+      for (i = 0; i < mdb->sql_num_fields(); i++) { 
+         field = mdb->sql_fetch_field(); 
+         if (!field) { 
+            break; 
+         } 
+         if (row[i] == NULL) { 
+            bsnprintf(buf, sizeof(buf), "%s%s=", (i>0?" ":""), field->name); 
+         } else { 
+            bash_spaces(row[i]); 
+            bsnprintf(buf, sizeof(buf), "%s%s=%s", (i>0?" ":""), field->name, row[i]); 
+         } 
+         send(ctx, buf); 
+      } 
+      send(ctx, "\n"); 
+   } 
+   return mdb->sql_num_rows(); 
+} 
+ 
+/* 
+ * Open a new connexion to mdb catalog. This function is used 
+ * by batch and accurate mode. 
+ */ 
+bool BDB::bdb_open_batch_connexion(JCR *jcr) 
+{ 
+   bool multi_db; 
+ 
+   multi_db = batch_insert_available(); 
+ 
+   if (!jcr->db_batch) { 
+      jcr->db_batch = bdb_clone_database_connection(jcr, multi_db); 
+      if (!jcr->db_batch) { 
+         Mmsg0(&errmsg, _("Could not init database batch connection\n")); 
+         Jmsg(jcr, M_FATAL, 0, "%s", errmsg); 
+         return false; 
+      } 
+ 
+      if (!jcr->db_batch->bdb_open_database(jcr)) { 
+         Mmsg2(&errmsg,  _("Could not open database \"%s\": ERR=%s\n"), 
+              jcr->db_batch->get_db_name(), jcr->db_batch->bdb_strerror()); 
+         Jmsg(jcr, M_FATAL, 0, "%s", errmsg); 
+         return false; 
+      } 
+   } 
+   return true; 
+} 
+ 
+/* 
+ * !!! WARNING !!! Use this function only when bacula is stopped. 
+ * ie, after a fatal signal and before exiting the program 
+ * Print information about a BDB object. 
+ */ 
+void bdb_debug_print(JCR *jcr, FILE *fp) 
+{ 
+   BDB *mdb = jcr->db; 
+ 
+   if (!mdb) { 
+      return; 
+   } 
+ 
+   fprintf(fp, "BDB=%p db_name=%s db_user=%s connected=%s\n", 
+           mdb, NPRTB(mdb->get_db_name()), NPRTB(mdb->get_db_user()), mdb->is_connected() ? "true" : "false"); 
+   fprintf(fp, "\tcmd=\"%s\" changes=%i\n", NPRTB(mdb->cmd), mdb->changes); 
+   mdb->print_lock_info(fp); 
+} 
+ 
+#endif /* HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL */ 
diff --git a/src/cats/sql_cmds.c b/src/cats/sql_cmds.c
index c996ee2..d80003b 100644
--- a/src/cats/sql_cmds.c
+++ b/src/cats/sql_cmds.c
@@ -1,21 +1,25 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2002-2014 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
- *  This file contains all the SQL commands that are either issued by the
- *  Director or which are database backend specific.
+ *  This file contains all the SQL commands that are either issued by
+ *   the Director or which are database backend specific.
  *
  *     Written by Kern Sibbald, July MMII
  */
@@ -28,7 +32,7 @@
 
 #include "bacula.h"
 
-const char *get_restore_objects =
+const char *get_restore_objects = 
    "SELECT JobId,ObjectLength,ObjectFullLength,ObjectIndex,"
            "ObjectType,ObjectCompression,FileIndex,ObjectName,"
            "RestoreObject,PluginName "
@@ -40,28 +44,27 @@ const char *get_restore_objects =
 const char *cleanup_created_job =
    "UPDATE Job SET JobStatus='f', StartTime=SchedTime, EndTime=SchedTime "
    "WHERE JobStatus = 'C'";
-const char *cleanup_running_job =
+const char *cleanup_running_job = 
    "UPDATE Job SET JobStatus='f', EndTime=StartTime WHERE JobStatus = 'R'";
 
 /* For sql_update.c db_update_stats */
 const char *fill_jobhisto =
-        "INSERT INTO JobHisto ("
-           "JobId, Job, Name, Type, Level, ClientId, JobStatus, "
-           "SchedTime, StartTime, EndTime, RealEndTime, JobTDate, "
-           "VolSessionId, VolSessionTime, JobFiles, JobBytes, ReadBytes, "
-           "JobErrors, JobMissingFiles, PoolId, FileSetId, PriorJobId, "
-           "PurgedFiles, HasBase, Reviewed, Comment ) "
-        "SELECT "
-           "JobId, Job, Name, Type, Level, ClientId, JobStatus, "
-           "SchedTime, StartTime, EndTime, RealEndTime, JobTDate, "
-           "VolSessionId, VolSessionTime, JobFiles, JobBytes, ReadBytes, "
-           "JobErrors, JobMissingFiles, PoolId, FileSetId, PriorJobId, "
+        "INSERT INTO JobHisto (JobId, Job, Name, Type, Level,"
+           "ClientId, JobStatus,"
+           "SchedTime, StartTime, EndTime, RealEndTime, JobTDate,"
+           "VolSessionId, VolSessionTime, JobFiles, JobBytes, ReadBytes,"
+           "JobErrors, JobMissingFiles, PoolId, FileSetId, PriorJobId,"
+           "PurgedFiles, HasBase, Reviewed, Comment)"
+        "SELECT JobId, Job, Name, Type, Level, ClientId, JobStatus,"
+           "SchedTime, StartTime, EndTime, RealEndTime, JobTDate,"
+           "VolSessionId, VolSessionTime, JobFiles, JobBytes, ReadBytes,"
+           "JobErrors, JobMissingFiles, PoolId, FileSetId, PriorJobId,"
            "PurgedFiles, HasBase, Reviewed, Comment "
           "FROM Job "
-         "WHERE JobStatus IN ('T','W','f','A','E') "
+         "WHERE JobStatus IN ('T','W','f','A','E')"
            "AND NOT EXISTS "
                 "(SELECT JobHisto.JobId "
-                   "FROM JobHisto WHERE JobHisto.Jobid=Job.JobId) "
+                   "FROM JobHisto WHERE JobHisto.Jobid=Job.JobId)"
            "AND JobTDate < %s ";
 
 /* For ua_update.c */
@@ -74,18 +77,18 @@ const char *client_backups =
    " FROM Client,Job,JobMedia,Media,FileSet"
    " WHERE Client.Name='%s'"
    " AND FileSet='%s'"
-   " AND Client.ClientId=Job.ClientId"
-   " AND JobStatus IN ('T','W') AND Type='B'"
-   " AND JobMedia.JobId=Job.JobId AND JobMedia.MediaId=Media.MediaId"
+   " AND Client.ClientId=Job.ClientId "
+   " AND JobStatus IN ('T','W') AND Type='B' "
+   " AND JobMedia.JobId=Job.JobId AND JobMedia.MediaId=Media.MediaId "
    " AND Job.FileSetId=FileSet.FileSetId"
    " ORDER BY Job.StartTime";
 
 /* ====== ua_prune.c */
 
-const char *sel_JobMedia =
-   "SELECT DISTINCT JobMedia.JobId FROM JobMedia,Job "
-   "WHERE MediaId=%s AND Job.JobId=JobMedia.JobId "
-   "AND Job.JobTDate<%s";
+const char *sel_JobMedia = 
+   "SELECT DISTINCT JobMedia.JobId FROM JobMedia,Job"
+   " WHERE MediaId=%s AND Job.JobId=JobMedia.JobId "
+   " AND Job.JobTDate<%s";
 
 /* Delete temp tables and indexes  */
 const char *drop_deltabs[] = {
@@ -105,7 +108,7 @@ const char *uar_list_jobs =
    "FROM Client,Job WHERE Client.ClientId=Job.ClientId AND JobStatus IN ('T','W') "
    "AND Type='B' ORDER BY StartTime DESC LIMIT 20";
 
-const char *uar_print_jobs =
+const char *uar_print_jobs = 
    "SELECT DISTINCT JobId,Level,JobFiles,JobBytes,StartTime,VolumeName"
    " FROM Job JOIN JobMedia USING (JobId) JOIN Media USING (MediaId) "
    " WHERE JobId IN (%s) "
@@ -187,7 +190,7 @@ const char *uar_list_temp =
    " ORDER BY StartTime ASC";
 
 
-const char *uar_sel_jobid_temp =
+const char *uar_sel_jobid_temp = 
    "SELECT DISTINCT JobId,StartTime FROM temp ORDER BY StartTime ASC";
 
 const char *uar_sel_all_temp1 = "SELECT * FROM temp1";
@@ -245,18 +248,18 @@ const char *uar_jobids_fileindex =
    "ORDER BY Job.StartTime DESC LIMIT 1";
 
 /* Query to get list of files from table -- presuably built by an external program */
-const char *uar_jobid_fileindex_from_table =
-   "SELECT JobId,FileIndex FROM %s ORDER BY JobId, FileIndex ASC";
+const char *uar_jobid_fileindex_from_table = 
+   "SELECT JobId, FileIndex FROM %s ORDER BY JobId, FileIndex ASC";
 
-/* Get the list of the last recent version per Delta with a given jobid list
- * This is a tricky part because with SQL the result of
+/* Get the list of the last recent version per Delta with a given
+ *  jobid list. This is a tricky part because with SQL the result of:
  *
- * SELECT MAX(A), B, C, D FROM... GROUP BY (B,C)
+ *   SELECT MAX(A), B, C, D FROM... GROUP BY (B,C)
  *
  * doesn't give the good result (for D).
  *
  * With PostgreSQL, we can use DISTINCT ON(), but with Mysql or Sqlite,
- * we need an extra join using JobTDate.
+ *  we need an extra join using JobTDate.
  */
 static const char *select_recent_version_with_basejob_default =
 "SELECT FileId, Job.JobId AS JobId, FileIndex, File.PathId AS PathId, "
@@ -285,8 +288,9 @@ static const char *select_recent_version_with_basejob_default =
   "AND T1.PathId = File.PathId "
   "AND T1.FilenameId = File.FilenameId";
 
-const char *select_recent_version_with_basejob[] = {
-   /* MySQL */
+const char *select_recent_version_with_basejob[] =
+{
+   /* MySQL  */
    select_recent_version_with_basejob_default,
 
    /* Postgresql */    /* The DISTINCT ON () permits to avoid extra join */
@@ -303,10 +307,10 @@ const char *select_recent_version_with_basejob[] = {
        ") AS T JOIN Job USING (JobId) "
    "ORDER BY FilenameId, PathId, JobTDate DESC ",
 
-   /* SQLite3 */
+   /* SQLite */
    select_recent_version_with_basejob_default
 };
-
+ 
 /* We do the same thing than the previous query, but we include
  * all delta parts. If the file has been deleted, we can have irrelevant
  * parts.
@@ -318,8 +322,7 @@ const char *select_recent_version_with_basejob[] = {
  *
  * If we detect a gap, we can discard further pieces
  * If a file starts at 1 instead of 0, the file has been deleted, and further
- * pieces are useless.
- *
+ *   pieces are useless.
  * This control should be reset for each new file
  */
 static const char *select_recent_version_with_basejob_and_delta_default =
@@ -367,14 +370,14 @@ const char *select_recent_version_with_basejob_and_delta[] = {
        ") AS T JOIN Job USING (JobId) "
    "ORDER BY FilenameId, PathId, DeltaSeq, JobTDate DESC ",
 
-   /* SQLite3 */
+   /* SQLite */
    select_recent_version_with_basejob_and_delta_default
 };
 
 /* Get the list of the last recent version with a given BaseJob jobid list
  * We don't handle Delta with BaseJobs, they have only Full files
  */
-static const char *select_recent_version_default =
+static const char *select_recent_version_default = 
   "SELECT j1.JobId AS JobId, f1.FileId AS FileId, f1.FileIndex AS FileIndex, "
           "f1.PathId AS PathId, f1.FilenameId AS FilenameId, "
           "f1.LStat AS LStat, f1.MD5 AS MD5, j1.JobTDate "
@@ -390,7 +393,8 @@ static const char *select_recent_version_default =
       "AND t1.PathId = f1.PathId "
       "AND j1.JobId = f1.JobId";
 
-const char *select_recent_version[] = {
+const char *select_recent_version[] =
+{
    /* MySQL */
    select_recent_version_default,
 
@@ -401,14 +405,14 @@ const char *select_recent_version[] = {
     "WHERE JobId IN (%s) "
     "ORDER BY FilenameId, PathId, JobTDate DESC ",
 
-   /* SQLite3 */
+   /* SQLite */
    select_recent_version_default
 };
 
-/* We don't create this table as TEMPORARY because MySQL MyISAM
- * 5.0 and 5.1 are unable to run further queries in this mode
+/* We don't create this table as TEMPORARY because MySQL 
+    MyISAM 5.0 and 5.1 are unable to run further queries in this mode
  */
-static const char *create_temp_accurate_jobids_default =
+static const char *create_temp_accurate_jobids_default = 
  "CREATE TABLE btemp3%s AS "
     "SELECT JobId, StartTime, EndTime, JobTDate, PurgedFiles "
       "FROM Job JOIN FileSet USING (FileSetId) "
@@ -482,7 +486,8 @@ const char *create_temp_new_basefile[] = {
 /* ====== ua_prune.c */
 
 /* List of SQL commands to create temp table and indicies  */
-const char *create_deltabs[] = {
+const char *create_deltabs[] =
+{
    /* MySQL */
    "CREATE TEMPORARY TABLE DelCandidates ("
    "JobId INTEGER UNSIGNED NOT NULL, "
@@ -490,29 +495,29 @@ const char *create_deltabs[] = {
    "FileSetId INTEGER UNSIGNED, "
    "JobFiles INTEGER UNSIGNED, "
    "JobStatus BINARY(1))",
-
-   /* Postgresql */
-   "CREATE TEMPORARY TABLE DelCandidates ("
+ 
+   /* PostgreSQL */
+   "CREATE TEMPORARY TABLE DelCandidates ( "
    "JobId INTEGER NOT NULL, "
    "PurgedFiles SMALLINT, "
    "FileSetId INTEGER, "
    "JobFiles INTEGER, "
    "JobStatus char(1))",
-
-   /* SQLite3 */
+ 
+   /* SQLite */
    "CREATE TEMPORARY TABLE DelCandidates ("
    "JobId INTEGER UNSIGNED NOT NULL, "
    "PurgedFiles TINYINT, "
    "FileSetId INTEGER UNSIGNED, "
    "JobFiles INTEGER UNSIGNED, "
    "JobStatus CHAR)"
-};
-
-/* ======= ua_purge.c */
+}; 
 
-/* Select the first available Copy Job that must be upgraded to a Backup job when the original backup job is expired. */
-
-static const char *uap_upgrade_copies_oldest_job_default =
+/* ======= ua_purge.c ====== */
+/* Select the first available Copy Job that must be upgraded 
+ *   to a Backup job when the original backup job is expired.
+ */
+static const char *uap_upgrade_copies_oldest_job_default = 
 "CREATE TEMPORARY TABLE cpy_tmp AS "
        "SELECT MIN(JobId) AS JobId FROM Job "     /* Choose the oldest job */
         "WHERE Type='%c' "                        /* JT_JOB_COPY */
@@ -527,22 +532,22 @@ static const char *uap_upgrade_copies_oldest_job_default =
               ") "
           "GROUP BY PriorJobId ";           /* one result per copy */
 
-const char *uap_upgrade_copies_oldest_job[] = {
-   /* Mysql */
+const char *uap_upgrade_copies_oldest_job[] =
+{
+   /* MySQL */
    uap_upgrade_copies_oldest_job_default,
-
-   /* Postgresql */
+   /* PostgreSQL */
    uap_upgrade_copies_oldest_job_default,
-
-   /* SQLite3 */
+   /* SQLite */
    uap_upgrade_copies_oldest_job_default
-};
-
-/* ======= ua_restore.c */
+}; 
+ 
+/* ======= ua_restore.c ====== */
 
 /* List Jobs where a particular file is saved */
-const char *uar_file[] = {
-   /* Mysql */
+const char *uar_file[] =
+{
+   /* MySQL */
    "SELECT Job.JobId as JobId,"
    "CONCAT(Path.Path,Filename.Name) as Name, "
    "StartTime,Type as JobType,JobStatus,JobFiles,JobBytes "
@@ -587,8 +592,8 @@ const char *uar_create_temp[] = {
    "StartFile INTEGER UNSIGNED,"
    "VolSessionId INTEGER UNSIGNED,"
    "VolSessionTime INTEGER UNSIGNED)",
-
-   /* Postgresql */
+ 
+   /* PostgreSQL */
    "CREATE TEMPORARY TABLE temp ("
    "JobId INTEGER NOT NULL,"
    "JobTDate BIGINT,"
@@ -601,8 +606,8 @@ const char *uar_create_temp[] = {
    "StartFile INTEGER,"
    "VolSessionId INTEGER,"
    "VolSessionTime INTEGER)",
-
-   /* SQLite3 */
+ 
+   /* SQLite */
    "CREATE TEMPORARY TABLE temp ("
    "JobId INTEGER UNSIGNED NOT NULL,"
    "JobTDate BIGINT UNSIGNED,"
@@ -615,26 +620,25 @@ const char *uar_create_temp[] = {
    "StartFile INTEGER UNSIGNED,"
    "VolSessionId INTEGER UNSIGNED,"
    "VolSessionTime INTEGER UNSIGNED)"
-};
+}; 
 
-const char *uar_create_temp1[] = {
-   /* Mysql */
+const char *uar_create_temp1[] =
+{
+   /* MySQL */
    "CREATE TEMPORARY TABLE temp1 ("
    "JobId INTEGER UNSIGNED NOT NULL,"
    "JobTDate BIGINT UNSIGNED)",
-
-   /* Postgresql */
+   /* PostgreSQL */
    "CREATE TEMPORARY TABLE temp1 ("
    "JobId INTEGER NOT NULL,"
    "JobTDate BIGINT)",
-
-   /* SQLite3 */
+   /* SQLite */
    "CREATE TEMPORARY TABLE temp1 ("
    "JobId INTEGER UNSIGNED NOT NULL,"
    "JobTDate BIGINT UNSIGNED)"
-};
+}; 
 
-/* Query to get all files in a directory -- no recursing
+/* Query to get all files in a directory no recursing
  *  Note, for PostgreSQL since it respects the "Single Value
  *  rule", the results of the SELECT will be unoptimized.
  *  I.e. the same file will be restored multiple times, once
@@ -689,12 +693,10 @@ const char *sql_media_order_most_recently_written[] = {
 const char *sql_get_max_connections[] = {
    /* Mysql */
    "SHOW VARIABLES LIKE 'max_connections'",
-
-   /* Postgresql */
+   /* PostgreSQL */
    "SHOW max_connections",
-
-   /* SQLite3 */
-   "SELECT 0"
+   /* SQLite */
+   "SELECT  0"
 };
 
 /*
@@ -715,11 +717,11 @@ const char *default_sql_bvfs_select =
   "AND File.FileIndex > 0 "
   "AND Job.JobId IN (SELECT DISTINCT JobId FROM btemp%s) ";
 
-const char *sql_bvfs_select[] = {
-   /* Mysql */
+const char *sql_bvfs_select[] =
+{
+   /* MySQL */
    default_sql_bvfs_select,
-
-   /* Postgresql */
+   /* PostgreSQL */
    "CREATE TABLE %s AS ( "
         "SELECT JobId, FileIndex, FileId "
           "FROM ( "
@@ -729,8 +731,7 @@ const char *sql_bvfs_select[] = {
               "ORDER BY PathId, FilenameId, JobTDate DESC "
           ") AS T "
           "WHERE FileIndex > 0)",
-
-   /* SQLite3 */
+   /* SQLite */
    default_sql_bvfs_select
 };
 
@@ -764,8 +765,7 @@ static const char *sql_bvfs_list_files_default =
        "OR Job.JobId IN (%s)) ";
 
 const char *sql_bvfs_list_files[] = {
-   /* Mysql */
-   /* JobId PathId JobId PathId Limit Offset AND? Filename? JobId JobId*/
+   /* MySQL */
    sql_bvfs_list_files_default,
 
    /* JobId PathId JobId PathId WHERE? Filename? Limit Offset*/
@@ -792,13 +792,13 @@ const char *sql_bvfs_list_files[] = {
    /* SQLite */
    sql_bvfs_list_files_default,
 
-   /* SQLite3 */
+   /* SQLite */
    sql_bvfs_list_files_default
 };
 
 /* Basically the same thing than select_recent_version_with_basejob_and_delta_default,
  * but we specify a single file with FilenameId/PathId
- *
+ * 
  * Input:
  * 1 JobId to look at
  * 2 FilenameId
@@ -820,7 +820,7 @@ const char *bvfs_select_delta_version_with_basejob_and_delta_default =
          "FROM File JOIN Job USING (JobId) "          /* from selected backup */
         "WHERE File.JobId IN (%s) AND FilenameId = %s AND PathId = %s "
          "UNION ALL "
-       "SELECT JobTDate, PathId, FilenameId, DeltaSeq " /*Get all files from */
+       "SELECT JobTDate, PathId, FilenameId, DeltaSeq " /*Get all files from */ 
          "FROM BaseFiles "                            /* BaseJob */
               "JOIN File USING (FileId) "
               "JOIN Job  ON    (BaseJobId = Job.JobId) "
@@ -838,7 +838,8 @@ const char *bvfs_select_delta_version_with_basejob_and_delta_default =
   "AND T1.FilenameId = File.FilenameId";
 
 
-const char *bvfs_select_delta_version_with_basejob_and_delta[] = {
+const char *bvfs_select_delta_version_with_basejob_and_delta[] =
+{
    /* MySQL */
    bvfs_select_delta_version_with_basejob_and_delta_default,
 
@@ -856,7 +857,7 @@ const char *bvfs_select_delta_version_with_basejob_and_delta[] = {
        ") AS T JOIN Job USING (JobId) "
    "ORDER BY FilenameId, PathId, DeltaSeq, JobTDate DESC ",
 
-   /* SQLite3 */
+   /* SQLite */
    bvfs_select_delta_version_with_basejob_and_delta_default
 };
 
@@ -900,15 +901,15 @@ const char *batch_fill_path_query[] = {
       "SELECT a.Path FROM "
          "(SELECT DISTINCT Path FROM batch) AS a WHERE NOT EXISTS "
          "(SELECT Path FROM Path AS p WHERE p.Path = a.Path)",
-
-   /* Postgresql */
-   "INSERT INTO Path (Path) "
+ 
+   /* PostgreSQL */
+   "INSERT INTO Path (Path)"
       "SELECT a.Path FROM "
          "(SELECT DISTINCT Path FROM batch) AS a "
        "WHERE NOT EXISTS (SELECT Path FROM Path WHERE Path = a.Path) ",
-
-   /* SQLite3 */
-   "INSERT INTO Path (Path) "
+ 
+   /* SQLite */
+   "INSERT INTO Path (Path)"
       "SELECT DISTINCT Path FROM batch "
       "EXCEPT SELECT Path FROM Path"
 };
@@ -936,85 +937,79 @@ const char *batch_fill_filename_query[] = {
 const char *match_query[] = {
    /* Mysql */
    "REGEXP",
-
-   /* Postgresql */
-   "~",
-
-   /* SQLite3 */
-   "LIKE"                      /* MATCH doesn't seems to work anymore... */
-};
-
+   /* PostgreSQL */
+   "~", 
+   /* SQLite */
+   "LIKE"                       /* MATCH doesn't seems to work anymore... */
+}; 
+ 
 static const char *insert_counter_values_default =
    "INSERT INTO Counters (Counter, MinValue, "
    "MaxValue, CurrentValue, WrapCounter) "
    "VALUES ('%s','%d','%d','%d','%s')";
 
 const char *insert_counter_values[] = {
-   /* Mysql */
+   /* MySQL */
    "INSERT INTO Counters (Counter, Counters.MinValue, "
    "Counters.MaxValue, CurrentValue, WrapCounter) "
    "VALUES ('%s','%d','%d','%d','%s')",
 
-   /* Postgresql */
+   /* PostgreSQL */
    insert_counter_values_default,
 
-   /* SQLite3 */
+   /* SQLite */
    insert_counter_values_default
 };
 
-static const char *select_counter_values_default =
-   "SELECT MinValue, MaxValue, CurrentValue, WrapCounter "
-   "FROM Counters WHERE Counter='%s'";
-
-const char *select_counter_values[] = {
-   /* Mysql */
-   "SELECT Counters.MinValue, Counters.MaxValue, CurrentValue, WrapCounter "
-   "FROM Counters WHERE Counter='%s'",
-
-   /* Postgresql */
-   select_counter_values_default,
-
-   /* SQLite3 */
-   select_counter_values_default
-};
-
-static const char *update_counter_values_default =
-   "UPDATE Counters SET "
-   "MinValue=%d, MaxValue=%d, CurrentValue=%d, WrapCounter='%s'"
-   "WHERE Counter='%s'";
-
-const char *update_counter_values[] = {
-   /* Mysql */
-   "UPDATE Counters SET "
-   "Counters.MinValue=%d, Counters.MaxValue=%d, CurrentValue=%d, WrapCounter='%s'"
-   "WHERE Counter='%s'",
-
-   /* Postgresql */
-   update_counter_values_default,
-
-   /* SQLite3 */
-   update_counter_values_default
-};
-
+static const char *select_counter_values_default = 
+   "SELECT MinValue, MaxValue, CurrentValue, WrapCounter"
+   " FROM Counters WHERE Counter='%s'";
+ 
+const char *select_counter_values[] =
+{
+   /* MySQL */
+   "SELECT Counters.MinValue, Counters.MaxValue, CurrentValue, WrapCounter"
+   " FROM Counters WHERE Counter='%s'",
+ 
+   /* PostgreSQL */
+   select_counter_values_default, 
+ 
+   /* SQLite */
+   select_counter_values_default 
+}; 
+ 
+static const char *update_counter_values_default = 
+   "UPDATE Counters SET MinValue=%d, MaxValue=%d, CurrentValue=%d,"
+    "WrapCounter='%s' WHERE Counter='%s'";
+ 
+const char *update_counter_values[] =
+{
+   /* MySQL */
+   "UPDATE Counters SET Counters.MinValue=%d, Counters.MaxValue=%d,"
+     "CurrentValue=%d, WrapCounter='%s' WHERE Counter='%s'",
+   /* PostgreSQL */
+   update_counter_values_default, 
+   /* SQLite */
+   update_counter_values_default 
+}; 
+ 
 static const char *expired_volumes_defaults =
-"SELECT Media.VolumeName  AS volumename, "
-       "Media.LastWritten AS lastwritten "
-" FROM  Media "
-" WHERE VolStatus IN ('Full', 'Used') "
-     " AND ( Media.LastWritten +  Media.VolRetention ) < NOW() "
+"SELECT Media.VolumeName  AS volumename,"
+       "Media.LastWritten AS lastwritten"
+" FROM  Media"
+" WHERE VolStatus IN ('Full', 'Used')"
+     " AND ( Media.LastWritten +  Media.VolRetention ) < NOW()"
      " %s ";
 
 const char *expired_volumes[] = {
-   /* Mysql */
+   /* MySQL */
    expired_volumes_defaults,
-
-   /* Postgresql */
+   /* PostgreSQL */
    "SELECT Media.VolumeName, Media.LastWritten "
    " FROM  Media "
    " WHERE VolStatus IN ('Full', 'Used') "
      " AND ( Media.LastWritten + (interval '1 second' * Media.VolRetention ) < NOW()) "
      " %s ",
-
-   /* SQLite3 */
+   /* SQLite */
    expired_volumes_defaults
 };
diff --git a/src/cats/sql_cmds.h b/src/cats/sql_cmds.h
index 9f98978..2c91f6f 100644
--- a/src/cats/sql_cmds.h
+++ b/src/cats/sql_cmds.h
@@ -1,24 +1,39 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 
+/*
+ *  sql_cmds.c contains all the SQL commands that are either issued by the
+ *    Director or which are database backend specific.
+ *
+ *   This file defines the external definitions necessary to
+ *    build on Windows
+ *
+ *     Kern Sibbald, July MMII
+ */
+
 extern const char CATS_IMP_EXP *batch_fill_filename_query[];
 extern const char CATS_IMP_EXP *batch_fill_path_query[];
 extern const char CATS_IMP_EXP *batch_lock_filename_query[];
 extern const char CATS_IMP_EXP *batch_lock_path_query[];
 extern const char CATS_IMP_EXP *batch_unlock_tables_query[];
+extern const char CATS_IMP_EXP *bvfs_select_delta_version_with_basejob_and_delta[];
 extern const char CATS_IMP_EXP *cleanup_created_job;
 extern const char CATS_IMP_EXP *cleanup_running_job;
 extern const char CATS_IMP_EXP *client_backups;
@@ -71,4 +86,4 @@ extern const char CATS_IMP_EXP *uar_sel_files;
 extern const char CATS_IMP_EXP *uar_sel_fileset;
 extern const char CATS_IMP_EXP *uar_sel_filesetid;
 extern const char CATS_IMP_EXP *uar_sel_jobid_temp;
-extern const char CATS_IMP_EXP *update_counter_values[];
+extern const char CATS_IMP_EXP *update_counter_values[]; 
diff --git a/src/cats/sql_create.c b/src/cats/sql_create.c
index 74d7603..9a84a49 100644
--- a/src/cats/sql_create.c
+++ b/src/cats/sql_create.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Bacula Catalog Database Create record interface routines
@@ -20,15 +24,13 @@
  *
  */
 
-#include "bacula.h"
+#include  "bacula.h"
 
 static const int dbglevel = 100;
 
 #if HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL
-
-#include "cats.h"
-#include "bdb_priv.h"
-#include "sql_glue.h"
+ 
+#include  "cats.h"
 
 /* -----------------------------------------------------------------------
  *
@@ -37,16 +39,11 @@ static const int dbglevel = 100;
  * -----------------------------------------------------------------------
  */
 
-/* Forward referenced subroutines */
-static int db_create_file_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar);
-static int db_create_filename_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar);
-
 /** Create a new record for the Job
  *  Returns: false on failure
  *          true  on success
  */
-bool
-db_create_job_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr)
+bool BDB::bdb_create_job_record(JCR *jcr, JOB_DBR *jr)
 {
    POOL_MEM buf;
    char dt[MAX_TIME_LENGTH];
@@ -59,7 +56,7 @@ db_create_job_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr)
    char esc_job[MAX_ESCAPE_NAME_LENGTH];
    char esc_name[MAX_ESCAPE_NAME_LENGTH];
 
-   db_lock(mdb);
+   bdb_lock();
 
    stime = jr->SchedTime;
    ASSERT(stime != 0);
@@ -70,13 +67,13 @@ db_create_job_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr)
 
    len = strlen(jcr->comment);  /* TODO: use jr instead of jcr to get comment */
    buf.check_size(len*2+1);
-   mdb->db_escape_string(jcr, buf.c_str(), jcr->comment, len);
+   bdb_escape_string(jcr, buf.c_str(), jcr->comment, len);
 
-   mdb->db_escape_string(jcr, esc_job, jr->Job, strlen(jr->Job));
-   mdb->db_escape_string(jcr, esc_name, jr->Name, strlen(jr->Name));
+   bdb_escape_string(jcr, esc_job, jr->Job, strlen(jr->Job));
+   bdb_escape_string(jcr, esc_name, jr->Name, strlen(jr->Name));
 
    /* Must create it */
-   Mmsg(mdb->cmd,
+   Mmsg(cmd,
 "INSERT INTO Job (Job,Name,Type,Level,JobStatus,SchedTime,JobTDate,"
                  "ClientId,Comment) "
 "VALUES ('%s','%s','%c','%c','%c','%s',%s,%s,'%s')",
@@ -84,15 +81,14 @@ db_create_job_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr)
            (char)(jr->JobStatus), dt, edit_uint64(JobTDate, ed1),
            edit_int64(jr->ClientId, ed2), buf.c_str());
 
-   jr->JobId = sql_insert_autokey_record(mdb, mdb->cmd, NT_("Job"));
-   if (jr->JobId == 0) {
-      Mmsg2(&mdb->errmsg, _("Create DB Job record %s failed. ERR=%s\n"),
-            mdb->cmd, sql_strerror(mdb));
+   if ((jr->JobId = sql_insert_autokey_record(cmd, NT_("Job"))) == 0) {
+      Mmsg2(&errmsg, _("Create DB Job record %s failed. ERR=%s\n"),
+            cmd, sql_strerror());
       ok = false;
    } else {
       ok = true;
    }
-   db_unlock(mdb);
+   bdb_unlock();
    return ok;
 }
 
@@ -101,25 +97,24 @@ db_create_job_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr)
  *  Returns: false on failure
  *          true  on success
  */
-bool
-db_create_jobmedia_record(JCR *jcr, B_DB *mdb, JOBMEDIA_DBR *jm)
+bool BDB::bdb_create_jobmedia_record(JCR *jcr, JOBMEDIA_DBR *jm)
 {
    bool ok = true;
    int count;
    char ed1[50], ed2[50];
 
-   db_lock(mdb);
+   bdb_lock();
 
    /* Now get count for VolIndex */
-   Mmsg(mdb->cmd, "SELECT count(*) from JobMedia WHERE JobId=%s",
+   Mmsg(cmd, "SELECT count(*) from JobMedia WHERE JobId=%s",
         edit_int64(jm->JobId, ed1));
-   count = get_sql_record_max(jcr, mdb);
+   count = get_sql_record_max(jcr, this);
    if (count < 0) {
       count = 0;
    }
    count++;
 
-   Mmsg(mdb->cmd,
+   Mmsg(cmd,
         "INSERT INTO JobMedia (JobId,MediaId,FirstIndex,LastIndex,"
         "StartFile,EndFile,StartBlock,EndBlock,VolIndex) "
         "VALUES (%s,%s,%u,%u,%u,%u,%u,%u,%u)",
@@ -128,23 +123,23 @@ db_create_jobmedia_record(JCR *jcr, B_DB *mdb, JOBMEDIA_DBR *jm)
         jm->FirstIndex, jm->LastIndex,
         jm->StartFile, jm->EndFile, jm->StartBlock, jm->EndBlock,count);
 
-   Dmsg0(300, mdb->cmd);
-   if (!INSERT_DB(jcr, mdb, mdb->cmd)) {
-      Mmsg2(&mdb->errmsg, _("Create JobMedia record %s failed: ERR=%s\n"), mdb->cmd,
-         sql_strerror(mdb));
+   Dmsg0(300, cmd);
+   if (!InsertDB(jcr, cmd)) {
+      Mmsg2(&errmsg, _("Create JobMedia record %s failed: ERR=%s\n"), cmd,
+         sql_strerror());
       ok = false;
    } else {
       /* Worked, now update the Media record with the EndFile and EndBlock */
-      Mmsg(mdb->cmd,
+      Mmsg(cmd,
            "UPDATE Media SET EndFile=%u, EndBlock=%u WHERE MediaId=%u",
            jm->EndFile, jm->EndBlock, jm->MediaId);
-      if (!UPDATE_DB(jcr, mdb, mdb->cmd)) {
-         Mmsg2(&mdb->errmsg, _("Update Media record %s failed: ERR=%s\n"), mdb->cmd,
-              sql_strerror(mdb));
+      if (!UpdateDB(jcr, cmd)) {
+         Mmsg2(&errmsg, _("Update Media record %s failed: ERR=%s\n"), cmd,
+              sql_strerror());
          ok = false;
       }
    }
-   db_unlock(mdb);
+   bdb_unlock();
    Dmsg0(300, "Return from JobMedia\n");
    return ok;
 }
@@ -153,37 +148,33 @@ db_create_jobmedia_record(JCR *jcr, B_DB *mdb, JOBMEDIA_DBR *jm)
  *  Returns: false on failure
  *          true  on success
  */
-bool
-db_create_pool_record(JCR *jcr, B_DB *mdb, POOL_DBR *pr)
+bool BDB::bdb_create_pool_record(JCR *jcr, POOL_DBR *pr)
 {
    bool stat;
    char ed1[30], ed2[30], ed3[50], ed4[50], ed5[50];
    char esc_name[MAX_ESCAPE_NAME_LENGTH];
    char esc_lf[MAX_ESCAPE_NAME_LENGTH];
 
-   int num_rows;
-
-
    Dmsg0(200, "In create pool\n");
-   db_lock(mdb);
-   mdb->db_escape_string(jcr, esc_name, pr->Name, strlen(pr->Name));
-   mdb->db_escape_string(jcr, esc_lf, pr->LabelFormat, strlen(pr->LabelFormat));
-   Mmsg(mdb->cmd, "SELECT PoolId,Name FROM Pool WHERE Name='%s'", esc_name);
-   Dmsg1(200, "selectpool: %s\n", mdb->cmd);
-
-   if (QUERY_DB(jcr, mdb, mdb->cmd)) {
-      num_rows = sql_num_rows(mdb);
-      if (num_rows > 0) {
-         Mmsg1(&mdb->errmsg, _("pool record %s already exists\n"), pr->Name);
-         sql_free_result(mdb);
-         db_unlock(mdb);
+   bdb_lock();
+   bdb_escape_string(jcr, esc_name, pr->Name, strlen(pr->Name));
+   bdb_escape_string(jcr, esc_lf, pr->LabelFormat, strlen(pr->LabelFormat));
+   Mmsg(cmd, "SELECT PoolId,Name FROM Pool WHERE Name='%s'", esc_name);
+   Dmsg1(200, "selectpool: %s\n", cmd);
+
+   if (QueryDB(jcr, cmd)) {
+      if (sql_num_rows() > 0) { 
+         Mmsg1(&errmsg, _("pool record %s already exists\n"), pr->Name);
+         sql_free_result();
+         bdb_unlock();
+         Dmsg1(200, "%s", errmsg); /* pool already exists */
          return false;
       }
-      sql_free_result(mdb);
+      sql_free_result();
    }
 
    /* Must create it */
-   Mmsg(mdb->cmd,
+   Mmsg(cmd,
 "INSERT INTO Pool (Name,NumVols,MaxVols,UseOnce,UseCatalog,"
 "AcceptAnyVolume,AutoPrune,Recycle,VolRetention,VolUseDuration,"
 "MaxVolJobs,MaxVolFiles,MaxVolBytes,PoolType,LabelType,LabelFormat,"
@@ -203,17 +194,15 @@ db_create_pool_record(JCR *jcr, B_DB *mdb, POOL_DBR *pr)
                   edit_int64(pr->ScratchPoolId,ed5),
                   pr->ActionOnPurge
       );
-   Dmsg1(200, "Create Pool: %s\n", mdb->cmd);
-   pr->PoolId = sql_insert_autokey_record(mdb, mdb->cmd, NT_("Pool"));
-   if (pr->PoolId == 0) {
-      Mmsg2(&mdb->errmsg, _("Create db Pool record %s failed: ERR=%s\n"),
-            mdb->cmd, sql_strerror(mdb));
+   Dmsg1(200, "Create Pool: %s\n", cmd);
+   if ((pr->PoolId = sql_insert_autokey_record(cmd, NT_("Pool"))) == 0) {
+      Mmsg2(&errmsg, _("Create db Pool record %s failed: ERR=%s\n"),
+            cmd, sql_strerror());
       stat = false;
    } else {
       stat = true;
    }
-   db_unlock(mdb);
-   Dmsg0(500, "Create Pool: done\n");
+   bdb_unlock();
    return stat;
 }
 
@@ -222,47 +211,43 @@ db_create_pool_record(JCR *jcr, B_DB *mdb, POOL_DBR *pr)
  * Returns: false on failure
  *          true  on success
  */
-bool
-db_create_device_record(JCR *jcr, B_DB *mdb, DEVICE_DBR *dr)
+bool BDB::bdb_create_device_record(JCR *jcr, DEVICE_DBR *dr)
 {
    bool ok;
    char ed1[30], ed2[30];
    char esc[MAX_ESCAPE_NAME_LENGTH];
-   int num_rows;
 
    Dmsg0(200, "In create Device\n");
-   db_lock(mdb);
-   mdb->db_escape_string(jcr, esc, dr->Name, strlen(dr->Name));
-   Mmsg(mdb->cmd, "SELECT DeviceId,Name FROM Device WHERE Name='%s'", esc);
-   Dmsg1(200, "selectdevice: %s\n", mdb->cmd);
-
-   if (QUERY_DB(jcr, mdb, mdb->cmd)) {
-      num_rows = sql_num_rows(mdb);
-      if (num_rows > 0) {
-         Mmsg1(&mdb->errmsg, _("Device record %s already exists\n"), dr->Name);
-         sql_free_result(mdb);
-         db_unlock(mdb);
+   bdb_lock();
+   bdb_escape_string(jcr, esc, dr->Name, strlen(dr->Name));
+   Mmsg(cmd, "SELECT DeviceId,Name FROM Device WHERE Name='%s'", esc);
+   Dmsg1(200, "selectdevice: %s\n", cmd);
+
+   if (QueryDB(jcr, cmd)) {
+      if (sql_num_rows() > 0) { 
+         Mmsg1(&errmsg, _("Device record %s already exists\n"), dr->Name);
+         sql_free_result();
+         bdb_unlock();
          return false;
       }
-      sql_free_result(mdb);
+      sql_free_result();
    }
 
    /* Must create it */
-   Mmsg(mdb->cmd,
+   Mmsg(cmd,
 "INSERT INTO Device (Name,MediaTypeId,StorageId) VALUES ('%s',%s,%s)",
                   esc,
                   edit_uint64(dr->MediaTypeId, ed1),
                   edit_int64(dr->StorageId, ed2));
-   Dmsg1(200, "Create Device: %s\n", mdb->cmd);
-   dr->DeviceId = sql_insert_autokey_record(mdb, mdb->cmd, NT_("Device"));
-   if (dr->DeviceId == 0) {
-      Mmsg2(&mdb->errmsg, _("Create db Device record %s failed: ERR=%s\n"),
-            mdb->cmd, sql_strerror(mdb));
+   Dmsg1(200, "Create Device: %s\n", cmd);
+   if ((dr->DeviceId = sql_insert_autokey_record(cmd, NT_("Device"))) == 0) {
+      Mmsg2(&errmsg, _("Create db Device record %s failed: ERR=%s\n"),
+            cmd, sql_strerror());
       ok = false;
    } else {
       ok = true;
    }
-   db_unlock(mdb);
+   bdb_unlock();
    return ok;
 }
 
@@ -273,59 +258,56 @@ db_create_device_record(JCR *jcr, B_DB *mdb, DEVICE_DBR *dr)
  * Returns: false on failure
  *          true  on success with id in sr->StorageId
  */
-bool db_create_storage_record(JCR *jcr, B_DB *mdb, STORAGE_DBR *sr)
+bool BDB::bdb_create_storage_record(JCR *jcr, STORAGE_DBR *sr)
 {
    SQL_ROW row;
    bool ok;
-   int num_rows;
    char esc[MAX_ESCAPE_NAME_LENGTH];
 
-   db_lock(mdb);
-   mdb->db_escape_string(jcr, esc, sr->Name, strlen(sr->Name));
-   Mmsg(mdb->cmd, "SELECT StorageId,AutoChanger FROM Storage WHERE Name='%s'",esc);
+   bdb_lock();
+   bdb_escape_string(jcr, esc, sr->Name, strlen(sr->Name));
+   Mmsg(cmd, "SELECT StorageId,AutoChanger FROM Storage WHERE Name='%s'",esc);
 
    sr->StorageId = 0;
    sr->created = false;
    /* Check if it already exists */
-   if (QUERY_DB(jcr, mdb, mdb->cmd)) {
-      num_rows = sql_num_rows(mdb);
+   if (QueryDB(jcr, cmd)) {
       /* If more than one, report error, but return first row */
-      if (num_rows > 1) {
-         Mmsg1(&mdb->errmsg, _("More than one Storage record!: %d\n"), num_rows);
-         Jmsg(jcr, M_ERROR, 0, "%s", mdb->errmsg);
+      if (sql_num_rows() > 1) { 
+         Mmsg1(&errmsg, _("More than one Storage record!: %d\n"), sql_num_rows());
+         Jmsg(jcr, M_ERROR, 0, "%s", errmsg);
       }
-      if (num_rows >= 1) {
-         if ((row = sql_fetch_row(mdb)) == NULL) {
-            Mmsg1(&mdb->errmsg, _("error fetching Storage row: %s\n"), sql_strerror(mdb));
-            Jmsg(jcr, M_ERROR, 0, "%s", mdb->errmsg);
-            sql_free_result(mdb);
-            db_unlock(mdb);
+      if (sql_num_rows() >= 1) { 
+         if ((row = sql_fetch_row()) == NULL) {
+            Mmsg1(&errmsg, _("error fetching Storage row: %s\n"), sql_strerror());
+            Jmsg(jcr, M_ERROR, 0, "%s", errmsg);
+            sql_free_result();
+            bdb_unlock();
             return false;
          }
          sr->StorageId = str_to_int64(row[0]);
          sr->AutoChanger = atoi(row[1]);   /* bool */
-         sql_free_result(mdb);
-         db_unlock(mdb);
+         sql_free_result();
+         bdb_unlock();
          return true;
       }
-      sql_free_result(mdb);
+      sql_free_result();
    }
 
    /* Must create it */
-   Mmsg(mdb->cmd, "INSERT INTO Storage (Name,AutoChanger)"
+   Mmsg(cmd, "INSERT INTO Storage (Name,AutoChanger)"
         " VALUES ('%s',%d)", esc, sr->AutoChanger);
 
-   sr->StorageId = sql_insert_autokey_record(mdb, mdb->cmd, NT_("Storage"));
-   if (sr->StorageId == 0) {
-      Mmsg2(&mdb->errmsg, _("Create DB Storage record %s failed. ERR=%s\n"),
-            mdb->cmd, sql_strerror(mdb));
-      Jmsg(jcr, M_ERROR, 0, "%s", mdb->errmsg);
+   if ((sr->StorageId = sql_insert_autokey_record(cmd, NT_("Storage"))) == 0) {
+      Mmsg2(&errmsg, _("Create DB Storage record %s failed. ERR=%s\n"),
+            cmd, sql_strerror());
+      Jmsg(jcr, M_ERROR, 0, "%s", errmsg);
       ok = false;
    } else {
       sr->created = true;
       ok = true;
    }
-   db_unlock(mdb);
+   bdb_unlock();
    return ok;
 }
 
@@ -335,46 +317,42 @@ bool db_create_storage_record(JCR *jcr, B_DB *mdb, STORAGE_DBR *sr)
  * Returns: false on failure
  *          true  on success
  */
-bool
-db_create_mediatype_record(JCR *jcr, B_DB *mdb, MEDIATYPE_DBR *mr)
+bool BDB::bdb_create_mediatype_record(JCR *jcr, MEDIATYPE_DBR *mr)
 {
    bool stat;
-   int num_rows;
    char esc[MAX_ESCAPE_NAME_LENGTH];
 
    Dmsg0(200, "In create mediatype\n");
-   db_lock(mdb);
-   mdb->db_escape_string(jcr, esc, mr->MediaType, strlen(mr->MediaType));
-   Mmsg(mdb->cmd, "SELECT MediaTypeId,MediaType FROM MediaType WHERE MediaType='%s'", esc);
-   Dmsg1(200, "selectmediatype: %s\n", mdb->cmd);
-
-   if (QUERY_DB(jcr, mdb, mdb->cmd)) {
-      num_rows = sql_num_rows(mdb);
-      if (num_rows > 0) {
-         Mmsg1(&mdb->errmsg, _("mediatype record %s already exists\n"), mr->MediaType);
-         sql_free_result(mdb);
-         db_unlock(mdb);
+   bdb_lock();
+   bdb_escape_string(jcr, esc, mr->MediaType, strlen(mr->MediaType));
+   Mmsg(cmd, "SELECT MediaTypeId,MediaType FROM MediaType WHERE MediaType='%s'", esc);
+   Dmsg1(200, "selectmediatype: %s\n", cmd);
+
+   if (QueryDB(jcr, cmd)) {
+      if (sql_num_rows() > 0) { 
+         Mmsg1(&errmsg, _("mediatype record %s already exists\n"), mr->MediaType);
+         sql_free_result();
+         bdb_unlock();
          return false;
       }
-      sql_free_result(mdb);
+      sql_free_result();
    }
 
    /* Must create it */
-   Mmsg(mdb->cmd,
+   Mmsg(cmd,
 "INSERT INTO MediaType (MediaType,ReadOnly) "
 "VALUES ('%s',%d)",
                   mr->MediaType,
                   mr->ReadOnly);
-   Dmsg1(200, "Create mediatype: %s\n", mdb->cmd);
-   mr->MediaTypeId = sql_insert_autokey_record(mdb, mdb->cmd, NT_("MediaType"));
-   if (mr->MediaTypeId == 0) {
-      Mmsg2(&mdb->errmsg, _("Create db mediatype record %s failed: ERR=%s\n"),
-            mdb->cmd, sql_strerror(mdb));
+   Dmsg1(200, "Create mediatype: %s\n", cmd);
+   if ((mr->MediaTypeId = sql_insert_autokey_record(cmd, NT_("MediaType"))) == 0) {
+      Mmsg2(&errmsg, _("Create db mediatype record %s failed: ERR=%s\n"),
+            cmd, sql_strerror());
       stat = false;
    } else {
       stat = true;
    }
-   db_unlock(mdb);
+   bdb_unlock();
    return stat;
 }
 
@@ -385,40 +363,37 @@ db_create_mediatype_record(JCR *jcr, B_DB *mdb, MEDIATYPE_DBR *mr)
  * Returns: 0 on failure
  *          1 on success
  */
-int
-db_create_media_record(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr)
+int BDB::bdb_create_media_record(JCR *jcr, MEDIA_DBR *mr)
 {
    int stat;
    char ed1[50], ed2[50], ed3[50], ed4[50], ed5[50], ed6[50], ed7[50], ed8[50];
    char ed9[50], ed10[50], ed11[50], ed12[50];
    struct tm tm;
-   int num_rows;
    char esc_name[MAX_ESCAPE_NAME_LENGTH];
    char esc_mtype[MAX_ESCAPE_NAME_LENGTH];
    char esc_status[MAX_ESCAPE_NAME_LENGTH];
 
 
-   db_lock(mdb);
-   mdb->db_escape_string(jcr, esc_name, mr->VolumeName, strlen(mr->VolumeName));
-   mdb->db_escape_string(jcr, esc_mtype, mr->MediaType, strlen(mr->MediaType));
-   mdb->db_escape_string(jcr, esc_status, mr->VolStatus, strlen(mr->VolStatus));
+   bdb_lock();
+   bdb_escape_string(jcr, esc_name, mr->VolumeName, strlen(mr->VolumeName));
+   bdb_escape_string(jcr, esc_mtype, mr->MediaType, strlen(mr->MediaType));
+   bdb_escape_string(jcr, esc_status, mr->VolStatus, strlen(mr->VolStatus));
 
-   Mmsg(mdb->cmd, "SELECT MediaId FROM Media WHERE VolumeName='%s'", esc_name);
-   Dmsg1(500, "selectpool: %s\n", mdb->cmd);
+   Mmsg(cmd, "SELECT MediaId FROM Media WHERE VolumeName='%s'", esc_name);
+   Dmsg1(500, "selectpool: %s\n", cmd);
 
-   if (QUERY_DB(jcr, mdb, mdb->cmd)) {
-      num_rows = sql_num_rows(mdb);
-      if (num_rows > 0) {
-         Mmsg1(&mdb->errmsg, _("Volume \"%s\" already exists.\n"), mr->VolumeName);
-         sql_free_result(mdb);
-         db_unlock(mdb);
+   if (QueryDB(jcr, cmd)) {
+      if (sql_num_rows() > 0) { 
+         Mmsg1(&errmsg, _("Volume \"%s\" already exists.\n"), mr->VolumeName);
+         sql_free_result();
+         bdb_unlock();
          return 0;
       }
-      sql_free_result(mdb);
+      sql_free_result();
    }
 
    /* Must create it */
-   Mmsg(mdb->cmd,
+   Mmsg(cmd,
 "INSERT INTO Media (VolumeName,MediaType,MediaTypeId,PoolId,MaxVolBytes,"
 "VolCapacityBytes,Recycle,VolRetention,VolUseDuration,MaxVolJobs,MaxVolFiles,"
 "VolStatus,Slot,VolBytes,InChanger,VolReadTime,VolWriteTime,VolParts,"
@@ -441,7 +416,7 @@ db_create_media_record(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr)
           mr->InChanger,
           edit_int64(mr->VolReadTime, ed6),
           edit_int64(mr->VolWriteTime, ed7),
-          mr->VolParts,
+          mr->VolType,   /* formerly VolParts */
           mr->LabelType,
           edit_int64(mr->StorageId, ed8),
           edit_int64(mr->DeviceId, ed9),
@@ -452,11 +427,10 @@ db_create_media_record(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr)
           );
 
 
-   Dmsg1(500, "Create Volume: %s\n", mdb->cmd);
-   mr->MediaId = sql_insert_autokey_record(mdb, mdb->cmd, NT_("Media"));
-   if (mr->MediaId == 0) {
-      Mmsg2(&mdb->errmsg, _("Create DB Media record %s failed. ERR=%s\n"),
-            mdb->cmd, sql_strerror(mdb));
+   Dmsg1(500, "Create Volume: %s\n", cmd);
+   if ((mr->MediaId = sql_insert_autokey_record(cmd, NT_("Media"))) == 0) {
+      Mmsg2(&errmsg, _("Create DB Media record %s failed. ERR=%s\n"),
+            cmd, sql_strerror());
       stat = 0;
    } else {
       stat = 1;
@@ -467,18 +441,18 @@ db_create_media_record(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr)
          }
          (void)localtime_r(&mr->LabelDate, &tm);
          strftime(dt, sizeof(dt), "%Y-%m-%d %H:%M:%S", &tm);
-         Mmsg(mdb->cmd, "UPDATE Media SET LabelDate='%s' "
+         Mmsg(cmd, "UPDATE Media SET LabelDate='%s' "
               "WHERE MediaId=%d", dt, mr->MediaId);
-         stat = UPDATE_DB(jcr, mdb, mdb->cmd);
+         stat = UpdateDB(jcr, cmd);
       }
       /*
        * Make sure that if InChanger is non-zero any other identical slot
        *   has InChanger zero.
        */
-      db_make_inchanger_unique(jcr, mdb, mr);
+      db_make_inchanger_unique(jcr, this, mr);
    }
 
-   db_unlock(mdb);
+   bdb_unlock();
    return stat;
 }
 
@@ -487,34 +461,32 @@ db_create_media_record(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr)
  * Returns: 0 on failure
  *          1 on success with id in cr->ClientId
  */
-int db_create_client_record(JCR *jcr, B_DB *mdb, CLIENT_DBR *cr)
+int BDB::bdb_create_client_record(JCR *jcr, CLIENT_DBR *cr)
 {
    SQL_ROW row;
    int stat;
    char ed1[50], ed2[50];
-   int num_rows;
    char esc_name[MAX_ESCAPE_NAME_LENGTH];
    char esc_uname[MAX_ESCAPE_NAME_LENGTH];
 
-   db_lock(mdb);
-   mdb->db_escape_string(jcr, esc_name, cr->Name, strlen(cr->Name));
-   mdb->db_escape_string(jcr, esc_uname, cr->Uname, strlen(cr->Uname));
-   Mmsg(mdb->cmd, "SELECT ClientId,Uname FROM Client WHERE Name='%s'",esc_name);
+   bdb_lock();
+   bdb_escape_string(jcr, esc_name, cr->Name, strlen(cr->Name));
+   bdb_escape_string(jcr, esc_uname, cr->Uname, strlen(cr->Uname));
+   Mmsg(cmd, "SELECT ClientId,Uname FROM Client WHERE Name='%s'",esc_name);
 
    cr->ClientId = 0;
-   if (QUERY_DB(jcr, mdb, mdb->cmd)) {
-      num_rows = sql_num_rows(mdb);
+   if (QueryDB(jcr, cmd)) {
       /* If more than one, report error, but return first row */
-      if (num_rows > 1) {
-         Mmsg1(&mdb->errmsg, _("More than one Client!: %d\n"), num_rows);
-         Jmsg(jcr, M_ERROR, 0, "%s", mdb->errmsg);
+      if (sql_num_rows() > 1) { 
+         Mmsg1(&errmsg, _("More than one Client!: %d\n"), sql_num_rows());
+         Jmsg(jcr, M_ERROR, 0, "%s", errmsg);
       }
-      if (num_rows >= 1) {
-         if ((row = sql_fetch_row(mdb)) == NULL) {
-            Mmsg1(&mdb->errmsg, _("error fetching Client row: %s\n"), sql_strerror(mdb));
-            Jmsg(jcr, M_ERROR, 0, "%s", mdb->errmsg);
-            sql_free_result(mdb);
-            db_unlock(mdb);
+      if (sql_num_rows() >= 1) { 
+         if ((row = sql_fetch_row()) == NULL) {
+            Mmsg1(&errmsg, _("error fetching Client row: %s\n"), sql_strerror());
+            Jmsg(jcr, M_ERROR, 0, "%s", errmsg);
+            sql_free_result();
+            bdb_unlock();
             return 0;
          }
          cr->ClientId = str_to_int64(row[0]);
@@ -523,67 +495,64 @@ int db_create_client_record(JCR *jcr, B_DB *mdb, CLIENT_DBR *cr)
          } else {
             cr->Uname[0] = 0;         /* no name */
          }
-         sql_free_result(mdb);
-         db_unlock(mdb);
+         sql_free_result();
+         bdb_unlock();
          return 1;
       }
-      sql_free_result(mdb);
+      sql_free_result();
    }
 
    /* Must create it */
-   Mmsg(mdb->cmd, "INSERT INTO Client (Name,Uname,AutoPrune,"
+   Mmsg(cmd, "INSERT INTO Client (Name,Uname,AutoPrune,"
 "FileRetention,JobRetention) VALUES "
 "('%s','%s',%d,%s,%s)", esc_name, esc_uname, cr->AutoPrune,
       edit_uint64(cr->FileRetention, ed1),
       edit_uint64(cr->JobRetention, ed2));
 
-   cr->ClientId = sql_insert_autokey_record(mdb, mdb->cmd, NT_("Client"));
-   if (cr->ClientId == 0) {
-      Mmsg2(&mdb->errmsg, _("Create DB Client record %s failed. ERR=%s\n"),
-            mdb->cmd, sql_strerror(mdb));
-      Jmsg(jcr, M_ERROR, 0, "%s", mdb->errmsg);
+   if ((cr->ClientId = sql_insert_autokey_record(cmd, NT_("Client"))) == 0) {
+      Mmsg2(&errmsg, _("Create DB Client record %s failed. ERR=%s\n"),
+            cmd, sql_strerror());
+      Jmsg(jcr, M_ERROR, 0, "%s", errmsg);
       stat = 0;
    } else {
       stat = 1;
    }
-   db_unlock(mdb);
+   bdb_unlock();
    return stat;
 }
 
 
 /** Create a Unique record for the Path -- no duplicates */
-int db_create_path_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar)
+int BDB::bdb_create_path_record(JCR *jcr, ATTR_DBR *ar)
 {
    SQL_ROW row;
    int stat;
-   int num_rows;
 
-   mdb->errmsg[0] = 0;
-   mdb->esc_name = check_pool_memory_size(mdb->esc_name, 2*mdb->pnl+2);
-   db_escape_string(jcr, mdb, mdb->esc_name, mdb->path, mdb->pnl);
+   errmsg[0] = 0;
+   esc_name = check_pool_memory_size(esc_name, 2*pnl+2);
+   bdb_escape_string(jcr, esc_name, path, pnl);
 
-   if (mdb->cached_path_id != 0 && mdb->cached_path_len == mdb->pnl &&
-       strcmp(mdb->cached_path, mdb->path) == 0) {
-      ar->PathId = mdb->cached_path_id;
+   if (cached_path_id != 0 && cached_path_len == pnl &&
+       strcmp(cached_path, path) == 0) {
+      ar->PathId = cached_path_id;
       return 1;
    }
 
-   Mmsg(mdb->cmd, "SELECT PathId FROM Path WHERE Path='%s'", mdb->esc_name);
+   Mmsg(cmd, "SELECT PathId FROM Path WHERE Path='%s'", esc_name);
 
-   if (QUERY_DB(jcr, mdb, mdb->cmd)) {
-      num_rows = sql_num_rows(mdb);
-      if (num_rows > 1) {
+   if (QueryDB(jcr, cmd)) {
+      if (sql_num_rows() > 1) { 
          char ed1[30];
-         Mmsg2(&mdb->errmsg, _("More than one Path!: %s for path: %s\n"),
-            edit_uint64(num_rows, ed1), mdb->path);
-         Jmsg(jcr, M_WARNING, 0, "%s", mdb->errmsg);
+         Mmsg2(&errmsg, _("More than one Path!: %s for path: %s\n"),
+            edit_uint64(sql_num_rows(), ed1), path);
+         Jmsg(jcr, M_WARNING, 0, "%s", errmsg);
       }
       /* Even if there are multiple paths, take the first one */
-      if (num_rows >= 1) {
-         if ((row = sql_fetch_row(mdb)) == NULL) {
-            Mmsg1(&mdb->errmsg, _("error fetching row: %s\n"), sql_strerror(mdb));
-            Jmsg(jcr, M_ERROR, 0, "%s", mdb->errmsg);
-            sql_free_result(mdb);
+      if (sql_num_rows() >= 1) { 
+         if ((row = sql_fetch_row()) == NULL) {
+            Mmsg1(&errmsg, _("error fetching row: %s\n"), sql_strerror());
+            Jmsg(jcr, M_ERROR, 0, "%s", errmsg);
+            sql_free_result();
             ar->PathId = 0;
             ASSERT2(ar->PathId,
                     "Your Path table is broken. "
@@ -591,26 +560,25 @@ int db_create_path_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar)
             return 0;
          }
          ar->PathId = str_to_int64(row[0]);
-         sql_free_result(mdb);
+         sql_free_result();
          /* Cache path */
-         if (ar->PathId != mdb->cached_path_id) {
-            mdb->cached_path_id = ar->PathId;
-            mdb->cached_path_len = mdb->pnl;
-            pm_strcpy(mdb->cached_path, mdb->path);
+         if (ar->PathId != cached_path_id) {
+            cached_path_id = ar->PathId;
+            cached_path_len = pnl;
+            pm_strcpy(cached_path, path);
          }
          ASSERT(ar->PathId);
          return 1;
       }
-      sql_free_result(mdb);
+      sql_free_result();
    }
 
-   Mmsg(mdb->cmd, "INSERT INTO Path (Path) VALUES ('%s')", mdb->esc_name);
+   Mmsg(cmd, "INSERT INTO Path (Path) VALUES ('%s')", esc_name);
 
-   ar->PathId = sql_insert_autokey_record(mdb, mdb->cmd, NT_("Path"));
-   if (ar->PathId == 0) {
-      Mmsg2(&mdb->errmsg, _("Create db Path record %s failed. ERR=%s\n"),
-         mdb->cmd, sql_strerror(mdb));
-      Jmsg(jcr, M_FATAL, 0, "%s", mdb->errmsg);
+   if ((ar->PathId = sql_insert_autokey_record(cmd, NT_("Path"))) == 0) {
+      Mmsg2(&errmsg, _("Create db Path record %s failed. ERR=%s\n"),
+         cmd, sql_strerror());
+      Jmsg(jcr, M_FATAL, 0, "%s", errmsg);
       ar->PathId = 0;
       stat = 0;
    } else {
@@ -618,10 +586,10 @@ int db_create_path_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar)
    }
 
    /* Cache path */
-   if (stat && ar->PathId != mdb->cached_path_id) {
-      mdb->cached_path_id = ar->PathId;
-      mdb->cached_path_len = mdb->pnl;
-      pm_strcpy(mdb->cached_path, mdb->path);
+   if (stat && ar->PathId != cached_path_id) {
+      cached_path_id = ar->PathId;
+      cached_path_len = pnl;
+      pm_strcpy(cached_path, path);
    }
    return stat;
 }
@@ -631,36 +599,36 @@ int db_create_path_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar)
  * Returns: 0 on failure
  *          1 on success with counter filled in
  */
-int db_create_counter_record(JCR *jcr, B_DB *mdb, COUNTER_DBR *cr)
+int BDB::bdb_create_counter_record(JCR *jcr, COUNTER_DBR *cr)
 {
    char esc[MAX_ESCAPE_NAME_LENGTH];
    COUNTER_DBR mcr;
    int stat;
 
-   db_lock(mdb);
+   bdb_lock();
    memset(&mcr, 0, sizeof(mcr));
    bstrncpy(mcr.Counter, cr->Counter, sizeof(mcr.Counter));
-   if (db_get_counter_record(jcr, mdb, &mcr)) {
+   if (bdb_get_counter_record(jcr, &mcr)) {
       memcpy(cr, &mcr, sizeof(COUNTER_DBR));
-      db_unlock(mdb);
+      bdb_unlock();
       return 1;
    }
-   mdb->db_escape_string(jcr, esc, cr->Counter, strlen(cr->Counter));
+   bdb_escape_string(jcr, esc, cr->Counter, strlen(cr->Counter));
 
    /* Must create it */
-   Mmsg(mdb->cmd, insert_counter_values[db_get_type_index(mdb)],
+   Mmsg(cmd, insert_counter_values[bdb_get_type_index()],
         esc, cr->MinValue, cr->MaxValue, cr->CurrentValue,
         cr->WrapCounter);
 
-   if (!INSERT_DB(jcr, mdb, mdb->cmd)) {
-      Mmsg2(&mdb->errmsg, _("Create DB Counters record %s failed. ERR=%s\n"),
-            mdb->cmd, sql_strerror(mdb));
-      Jmsg(jcr, M_ERROR, 0, "%s", mdb->errmsg);
+   if (!InsertDB(jcr, cmd)) {
+      Mmsg2(&errmsg, _("Create DB Counters record %s failed. ERR=%s\n"),
+            cmd, sql_strerror());
+      Jmsg(jcr, M_ERROR, 0, "%s", errmsg);
       stat = 0;
    } else {
       stat = 1;
    }
-   db_unlock(mdb);
+   bdb_unlock();
    return stat;
 }
 
@@ -670,36 +638,34 @@ int db_create_counter_record(JCR *jcr, B_DB *mdb, COUNTER_DBR *cr)
  *  Returns: 0 on failure
  *           1 on success with FileSetId in record
  */
-bool db_create_fileset_record(JCR *jcr, B_DB *mdb, FILESET_DBR *fsr)
+bool BDB::bdb_create_fileset_record(JCR *jcr, FILESET_DBR *fsr)
 {
    SQL_ROW row;
    bool stat;
    struct tm tm;
-   int num_rows;
    char esc_fs[MAX_ESCAPE_NAME_LENGTH];
    char esc_md5[MAX_ESCAPE_NAME_LENGTH];
 
    /* TODO: Escape FileSet and MD5 */
-   db_lock(mdb);
+   bdb_lock();
    fsr->created = false;
-   mdb->db_escape_string(jcr, esc_fs, fsr->FileSet, strlen(fsr->FileSet));
-   mdb->db_escape_string(jcr, esc_md5, fsr->MD5, strlen(fsr->MD5));
-   Mmsg(mdb->cmd, "SELECT FileSetId,CreateTime FROM FileSet WHERE "
+   bdb_escape_string(jcr, esc_fs, fsr->FileSet, strlen(fsr->FileSet));
+   bdb_escape_string(jcr, esc_md5, fsr->MD5, strlen(fsr->MD5));
+   Mmsg(cmd, "SELECT FileSetId,CreateTime FROM FileSet WHERE "
                   "FileSet='%s' AND MD5='%s'", esc_fs, esc_md5);
 
    fsr->FileSetId = 0;
-   if (QUERY_DB(jcr, mdb, mdb->cmd)) {
-      num_rows = sql_num_rows(mdb);
-      if (num_rows > 1) {
-         Mmsg1(&mdb->errmsg, _("More than one FileSet!: %d\n"), num_rows);
-         Jmsg(jcr, M_ERROR, 0, "%s", mdb->errmsg);
+   if (QueryDB(jcr, cmd)) {
+      if (sql_num_rows() > 1) { 
+         Mmsg1(&errmsg, _("More than one FileSet!: %d\n"), sql_num_rows());
+         Jmsg(jcr, M_ERROR, 0, "%s", errmsg);
       }
-      if (num_rows >= 1) {
-         if ((row = sql_fetch_row(mdb)) == NULL) {
-            Mmsg1(&mdb->errmsg, _("error fetching FileSet row: ERR=%s\n"), sql_strerror(mdb));
-            Jmsg(jcr, M_ERROR, 0, "%s", mdb->errmsg);
-            sql_free_result(mdb);
-            db_unlock(mdb);
+      if (sql_num_rows() >= 1) { 
+         if ((row = sql_fetch_row()) == NULL) {
+            Mmsg1(&errmsg, _("error fetching FileSet row: ERR=%s\n"), sql_strerror());
+            Jmsg(jcr, M_ERROR, 0, "%s", errmsg);
+            sql_free_result();
+            bdb_unlock();
             return false;
          }
          fsr->FileSetId = str_to_int64(row[0]);
@@ -708,11 +674,11 @@ bool db_create_fileset_record(JCR *jcr, B_DB *mdb, FILESET_DBR *fsr)
          } else {
             bstrncpy(fsr->cCreateTime, row[1], sizeof(fsr->cCreateTime));
          }
-         sql_free_result(mdb);
-         db_unlock(mdb);
+         sql_free_result();
+         bdb_unlock();
          return true;
       }
-      sql_free_result(mdb);
+      sql_free_result();
    }
 
    if (fsr->CreateTime == 0 && fsr->cCreateTime[0] == 0) {
@@ -722,21 +688,20 @@ bool db_create_fileset_record(JCR *jcr, B_DB *mdb, FILESET_DBR *fsr)
    strftime(fsr->cCreateTime, sizeof(fsr->cCreateTime), "%Y-%m-%d %H:%M:%S", &tm);
 
    /* Must create it */
-      Mmsg(mdb->cmd, "INSERT INTO FileSet (FileSet,MD5,CreateTime) "
+      Mmsg(cmd, "INSERT INTO FileSet (FileSet,MD5,CreateTime) "
 "VALUES ('%s','%s','%s')", esc_fs, esc_md5, fsr->cCreateTime);
 
-   fsr->FileSetId = sql_insert_autokey_record(mdb, mdb->cmd, NT_("FileSet"));
-   if (fsr->FileSetId == 0) {
-      Mmsg2(&mdb->errmsg, _("Create DB FileSet record %s failed. ERR=%s\n"),
-            mdb->cmd, sql_strerror(mdb));
-      Jmsg(jcr, M_ERROR, 0, "%s", mdb->errmsg);
+   if ((fsr->FileSetId = sql_insert_autokey_record(cmd, NT_("FileSet"))) == 0) {
+      Mmsg2(&errmsg, _("Create DB FileSet record %s failed. ERR=%s\n"),
+            cmd, sql_strerror());
+      Jmsg(jcr, M_ERROR, 0, "%s", errmsg);
       stat = false;
    } else {
       fsr->created = true;
       stat = true;
    }
 
-   db_unlock(mdb);
+   bdb_unlock();
    return stat;
 }
 
@@ -763,39 +728,39 @@ bool db_create_fileset_record(JCR *jcr, B_DB *mdb, FILESET_DBR *fsr)
 /* For maintenance, we can put batch mode in hold */
 static bool batch_mode_enabled = true;
 
-void db_disable_batch_insert(bool enabled)
+void bdb_disable_batch_insert(bool enabled)
 {
    batch_mode_enabled = enabled;
 }
 
-/**
- * All sql_batch_* functions are used to do bulk batch insert in File/Filename/Path
- *  tables.
+/*
+ * All sql_batch_xx functions are used to do bulk batch 
+ *  insert in File/Filename/Path tables.
  *
  *  To sum up :
  *   - bulk load a temp table
- *   - insert missing filenames into filename with a single query (lock filenames
+ *   - insert missing filenames into filename with a single query (lock filenames 
  *   - table before that to avoid possible duplicate inserts with concurrent update)
  *   - insert missing paths into path with another single query
  *   - then insert the join between the temp, filename and path tables into file.
  */
 
 /*
- * Returns true if OK
- *         false if failed
+ *  Returns true if OK
+ *          false if failed
  */
-bool db_write_batch_file_records(JCR *jcr)
+bool bdb_write_batch_file_records(JCR *jcr)
 {
-   bool retval = false;
+   bool retval = false; 
    int JobStatus = jcr->JobStatus;
 
    if (!jcr->batch_started) {         /* no files to backup ? */
-      Dmsg0(50,"db_create_file_record : no files\n");
+      Dmsg0(50,"db_write_batch_file_records: no files\n");
       return true;
    }
 
    if (job_canceled(jcr)) {
-      goto bail_out;
+      goto bail_out; 
    }
 
    jcr->JobStatus = JS_AttrInserting;
@@ -806,37 +771,35 @@ bool db_write_batch_file_records(JCR *jcr)
       bmicrosleep(10, 0);
 
       if (job_canceled(jcr)) {
-         goto bail_out;
+         goto bail_out; 
       }
    }
 
-   Dmsg1(50,"db_create_file_record changes=%u\n",jcr->db_batch->changes);
+   Dmsg1(50,"db_write_batch_file_records changes=%u\n",jcr->db_batch->changes);
 
-   if (!sql_batch_end(jcr, jcr->db_batch, NULL)) {
+   if (!jcr->db_batch->sql_batch_end(jcr, NULL)) {
       Jmsg1(jcr, M_FATAL, 0, "Batch end %s\n", jcr->db_batch->errmsg);
-      goto bail_out;
+      goto bail_out; 
    }
    if (job_canceled(jcr)) {
-      goto bail_out;
+      goto bail_out; 
    }
 
-   /*
-    * We have to lock tables
-    */
-   if (!db_sql_query(jcr->db_batch, batch_lock_path_query[db_get_type_index(jcr->db_batch)], NULL, NULL)) {
+   /* We have to lock tables */
+   if (!jcr->db_batch->bdb_sql_query(batch_lock_path_query[jcr->db_batch->bdb_get_type_index()], NULL, NULL)) {
       Jmsg1(jcr, M_FATAL, 0, "Lock Path table %s\n", jcr->db_batch->errmsg);
-      goto bail_out;
+      goto bail_out; 
    }
 
-   if (!db_sql_query(jcr->db_batch, batch_fill_path_query[db_get_type_index(jcr->db_batch)], NULL, NULL)) {
+   if (!jcr->db_batch->bdb_sql_query(batch_fill_path_query[jcr->db_batch->bdb_get_type_index()], NULL, NULL)) {
       Jmsg1(jcr, M_FATAL, 0, "Fill Path table %s\n",jcr->db_batch->errmsg);
-      db_sql_query(jcr->db_batch, batch_unlock_tables_query[db_get_type_index(jcr->db_batch)], NULL, NULL);
-      goto bail_out;
+      jcr->db_batch->bdb_sql_query(batch_unlock_tables_query[jcr->db_batch->bdb_get_type_index()], NULL, NULL);
+      goto bail_out; 
    }
 
-   if (!db_sql_query(jcr->db_batch, batch_unlock_tables_query[db_get_type_index(jcr->db_batch)], NULL, NULL)) {
+   if (!jcr->db_batch->bdb_sql_query(batch_unlock_tables_query[jcr->db_batch->bdb_get_type_index()], NULL, NULL)) {
       Jmsg1(jcr, M_FATAL, 0, "Unlock Path table %s\n", jcr->db_batch->errmsg);
-      goto bail_out;
+      goto bail_out; 
    }
 
    /*
@@ -846,7 +809,7 @@ bool db_write_batch_file_records(JCR *jcr)
       Jmsg1(jcr, M_FATAL, 0, "Lock Filename table %s\n", jcr->db_batch->errmsg);
       goto bail_out;
    }
-
+   
    if (!db_sql_query(jcr->db_batch, batch_fill_filename_query[db_get_type_index(jcr->db_batch)], NULL, NULL)) {
       Jmsg1(jcr,M_FATAL,0,"Fill Filename table %s\n",jcr->db_batch->errmsg);
       db_sql_query(jcr->db_batch, batch_unlock_tables_query[db_get_type_index(jcr->db_batch)], NULL, NULL);
@@ -857,8 +820,8 @@ bool db_write_batch_file_records(JCR *jcr)
       Jmsg1(jcr, M_FATAL, 0, "Unlock Filename table %s\n", jcr->db_batch->errmsg);
       goto bail_out;
    }
-
-   if (!db_sql_query(jcr->db_batch,
+   
+   if (!db_sql_query(jcr->db_batch, 
 "INSERT INTO File (FileIndex, JobId, PathId, FilenameId, LStat, MD5, DeltaSeq) "
     "SELECT batch.FileIndex, batch.JobId, Path.PathId, "
            "Filename.FilenameId,batch.LStat, batch.MD5, batch.DeltaSeq "
@@ -868,21 +831,21 @@ bool db_write_batch_file_records(JCR *jcr)
                      NULL, NULL))
    {
       Jmsg1(jcr, M_FATAL, 0, "Fill File table %s\n", jcr->db_batch->errmsg);
-      goto bail_out;
+      goto bail_out; 
    }
 
-   jcr->JobStatus = JobStatus;         /* reset entry status */
-   retval = true;
-
-bail_out:
-   db_sql_query(jcr->db_batch, "DROP TABLE batch", NULL,NULL);
+   jcr->JobStatus = JobStatus;    /* reset entry status */
+   retval = true; 
+ 
+bail_out: 
+   jcr->db_batch->bdb_sql_query("DROP TABLE batch", NULL,NULL);
    jcr->batch_started = false;
 
-   return retval;
+   return retval; 
 }
 
 /**
- * Create File record in B_DB
+ * Create File record in BDB
  *
  *  In order to reduce database size, we store the File attributes,
  *  the FileName, and the Path separately.  In principle, there
@@ -892,29 +855,28 @@ bail_out:
  *
  *  Note: all routines that call this expect to be able to call
  *    db_strerror(mdb) to get the error message, so the error message
- *    MUST be edited into mdb->errmsg before returning an error status.
+ *    MUST be edited into errmsg before returning an error status.
  */
-bool db_create_batch_file_attributes_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar)
+bool BDB::bdb_create_batch_file_attributes_record(JCR *jcr, ATTR_DBR *ar)
 {
    ASSERT(ar->FileType != FT_BASE);
-
    Dmsg1(dbglevel, "Fname=%s\n", ar->fname);
    Dmsg0(dbglevel, "put_file_into_catalog\n");
 
    if (jcr->batch_started && jcr->db_batch->changes > 500000) {
-      db_write_batch_file_records(jcr);
+      bdb_write_batch_file_records(jcr);
       jcr->db_batch->changes = 0;
    }
 
    /* Open the dedicated connexion */
    if (!jcr->batch_started) {
-      if (!db_open_batch_connexion(jcr, mdb)) {
+      if (!bdb_open_batch_connexion(jcr)) {
          return false;     /* error already printed */
       }
-      if (!sql_batch_start(jcr, jcr->db_batch)) {
-         Mmsg1(&mdb->errmsg,
+      if (!jcr->db_batch->sql_batch_start(jcr)) {
+         Mmsg1(&errmsg, 
               "Can't start batch mode: ERR=%s", db_strerror(jcr->db_batch));
-         Jmsg(jcr, M_FATAL, 0, "%s", mdb->errmsg);
+         Jmsg(jcr, M_FATAL, 0, "%s", errmsg);
          return false;
       }
       jcr->batch_started = true;
@@ -922,11 +884,11 @@ bool db_create_batch_file_attributes_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar)
 
    split_path_and_file(jcr, jcr->db_batch, ar->fname);
 
-   return sql_batch_insert(jcr, jcr->db_batch, ar);
+   return jcr->db_batch->sql_batch_insert(jcr, ar);
 }
 
 /**
- * Create File record in B_DB
+ * Create File record in BDB
  *
  *  In order to reduce database size, we store the File attributes,
  *  the FileName, and the Path separately.  In principle, there
@@ -934,44 +896,44 @@ bool db_create_batch_file_attributes_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar)
  *  how many times it occurs.  This is this subroutine, we separate
  *  the file and the path and create three database records.
  */
-bool db_create_file_attributes_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar)
+bool BDB::bdb_create_file_attributes_record(JCR *jcr, ATTR_DBR *ar)
 {
-   db_lock(mdb);
+   bdb_lock();
    Dmsg1(dbglevel, "Fname=%s\n", ar->fname);
    Dmsg0(dbglevel, "put_file_into_catalog\n");
 
-   split_path_and_file(jcr, mdb, ar->fname);
+   split_path_and_file(jcr, this, ar->fname);
 
-   if (!db_create_filename_record(jcr, mdb, ar)) {
+   if (!bdb_create_filename_record(jcr, ar)) {
       goto bail_out;
    }
-   Dmsg1(dbglevel, "db_create_filename_record: %s\n", mdb->esc_name);
+   Dmsg1(dbglevel, "bdb_create_filename_record: %s\n", esc_name);
 
 
-   if (!db_create_path_record(jcr, mdb, ar)) {
+   if (!bdb_create_path_record(jcr, ar)) {
       goto bail_out;
    }
-   Dmsg1(dbglevel, "db_create_path_record: %s\n", mdb->esc_name);
+   Dmsg1(dbglevel, "bdb_create_path_record: %s\n", esc_name);
 
    /* Now create master File record */
-   if (!db_create_file_record(jcr, mdb, ar)) {
-      goto bail_out;
+   if (!bdb_create_file_record(jcr, ar)) {
+      goto bail_out; 
    }
    Dmsg0(dbglevel, "db_create_file_record OK\n");
 
-   Dmsg3(dbglevel, "CreateAttributes Path=%s File=%s FilenameId=%d\n", mdb->path, mdb->fname, ar->FilenameId);
-   db_unlock(mdb);
+   Dmsg3(dbglevel, "CreateAttributes Path=%s File=%s FilenameId=%d\n", path, fname, ar->FilenameId);
+   bdb_unlock();
    return true;
 
-bail_out:
-   db_unlock(mdb);
+bail_out: 
+   bdb_unlock();
    return false;
 }
 /**
  * This is the master File entry containing the attributes.
  *  The filename and path records have already been created.
  */
-static int db_create_file_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar)
+int BDB::bdb_create_file_record(JCR *jcr, ATTR_DBR *ar)
 {
    int stat;
    static const char *no_digest = "0";
@@ -988,17 +950,16 @@ static int db_create_file_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar)
    }
 
    /* Must create it */
-   Mmsg(mdb->cmd,
+   Mmsg(cmd,
         "INSERT INTO File (FileIndex,JobId,PathId,FilenameId,"
         "LStat,MD5,DeltaSeq) VALUES (%u,%u,%u,%u,'%s','%s',%u)",
         ar->FileIndex, ar->JobId, ar->PathId, ar->FilenameId,
         ar->attr, digest, ar->DeltaSeq);
 
-   ar->FileId = sql_insert_autokey_record(mdb, mdb->cmd, NT_("File"));
-   if (ar->FileId == 0) {
-      Mmsg2(&mdb->errmsg, _("Create db File record %s failed. ERR=%s"),
-         mdb->cmd, sql_strerror(mdb));
-      Jmsg(jcr, M_FATAL, 0, "%s", mdb->errmsg);
+   if ((ar->FileId = sql_insert_autokey_record(cmd, NT_("File"))) == 0) {
+      Mmsg2(&errmsg, _("Create db File record %s failed. ERR=%s"),
+         cmd, sql_strerror());
+      Jmsg(jcr, M_FATAL, 0, "%s", errmsg);
       stat = 0;
    } else {
       stat = 1;
@@ -1007,82 +968,82 @@ static int db_create_file_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar)
 }
 
 /** Create a Unique record for the filename -- no duplicates */
-static int db_create_filename_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar)
+int BDB::bdb_create_filename_record(JCR *jcr, ATTR_DBR *ar)
 {
    SQL_ROW row;
    int num_rows;
 
-   mdb->errmsg[0] = 0;
-   mdb->esc_name = check_pool_memory_size(mdb->esc_name, 2*mdb->fnl+2);
-   db_escape_string(jcr, mdb, mdb->esc_name, mdb->fname, mdb->fnl);
-
-   Mmsg(mdb->cmd, "SELECT FilenameId FROM Filename WHERE Name='%s'", mdb->esc_name);
+   errmsg[0] = 0;
+   esc_name = check_pool_memory_size(esc_name, 2*fnl+2);
+   bdb_escape_string(jcr, esc_name, fname, fnl);
+   
+   Mmsg(cmd, "SELECT FilenameId FROM Filename WHERE Name='%s'", esc_name);
 
-   if (QUERY_DB(jcr, mdb, mdb->cmd)) {
-      num_rows = sql_num_rows(mdb);
+   if (QueryDB(jcr, cmd)) {
+      num_rows = sql_num_rows();
       if (num_rows > 1) {
          char ed1[30];
-         Mmsg2(&mdb->errmsg, _("More than one Filename! %s for file: %s\n"),
-            edit_uint64(num_rows, ed1), mdb->fname);
-         Jmsg(jcr, M_WARNING, 0, "%s", mdb->errmsg);
+         Mmsg2(&errmsg, _("More than one Filename! %s for file: %s\n"),
+            edit_uint64(num_rows, ed1), fname);
+         Jmsg(jcr, M_WARNING, 0, "%s", errmsg);
       }
       if (num_rows >= 1) {
-         if ((row = sql_fetch_row(mdb)) == NULL) {
-            Mmsg2(&mdb->errmsg, _("Error fetching row for file=%s: ERR=%s\n"),
-                mdb->fname, sql_strerror(mdb));
-            Jmsg(jcr, M_ERROR, 0, "%s", mdb->errmsg);
+         if ((row = sql_fetch_row()) == NULL) {
+            Mmsg2(&errmsg, _("Error fetching row for file=%s: ERR=%s\n"),
+                fname, sql_strerror());
+            Jmsg(jcr, M_ERROR, 0, "%s", errmsg);
             ar->FilenameId = 0;
          } else {
             ar->FilenameId = str_to_int64(row[0]);
          }
-         sql_free_result(mdb);
+         sql_free_result();
          return ar->FilenameId > 0;
       }
-      sql_free_result(mdb);
+      sql_free_result();
    }
 
-   Mmsg(mdb->cmd, "INSERT INTO Filename (Name) VALUES ('%s')", mdb->esc_name);
+   Mmsg(cmd, "INSERT INTO Filename (Name) VALUES ('%s')", esc_name);
 
-   ar->FilenameId = sql_insert_autokey_record(mdb, mdb->cmd, NT_("Filename"));
+   ar->FilenameId = sql_insert_autokey_record(cmd, NT_("Filename"));
    if (ar->FilenameId == 0) {
-      Mmsg2(&mdb->errmsg, _("Create db Filename record %s failed. ERR=%s\n"),
-            mdb->cmd, sql_strerror(mdb));
-      Jmsg(jcr, M_FATAL, 0, "%s", mdb->errmsg);
+      Mmsg2(&errmsg, _("Create db Filename record %s failed. ERR=%s\n"),
+            cmd, sql_strerror());
+      Jmsg(jcr, M_FATAL, 0, "%s", errmsg);
    }
    return ar->FilenameId > 0;
 }
 
-/**
+/* 
  * Create file attributes record, or base file attributes record
  */
-bool db_create_attributes_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar)
+bool BDB::bdb_create_attributes_record(JCR *jcr, ATTR_DBR *ar)
 {
    bool ret;
 
-   mdb->errmsg[0] = 0;
+   errmsg[0] = 0;
    /*
     * Make sure we have an acceptable attributes record.
     */
    if (!(ar->Stream == STREAM_UNIX_ATTRIBUTES ||
          ar->Stream == STREAM_UNIX_ATTRIBUTES_EX)) {
-      Mmsg1(&mdb->errmsg, _("Attempt to put non-attributes into catalog. Stream=%d\n"),
+      Mmsg1(&errmsg, _("Attempt to put non-attributes into catalog. Stream=%d\n"),
          ar->Stream);
-      Jmsg(jcr, M_FATAL, 0, "%s", mdb->errmsg);
+      Jmsg(jcr, M_FATAL, 0, "%s", errmsg);
       return false;
    }
 
    if (ar->FileType != FT_BASE) {
-      if (mdb->batch_insert_available()) {
-         ret = db_create_batch_file_attributes_record(jcr, mdb, ar);
+      if (batch_insert_available()) {
+         ret = bdb_create_batch_file_attributes_record(jcr, ar);
          /* Error message already printed */
-      } else {
-         ret = db_create_file_attributes_record(jcr, mdb, ar);
-      }
+      } else { 
+         ret = bdb_create_file_attributes_record(jcr, ar);
+      } 
    } else if (jcr->HasBase) {
-      ret = db_create_base_file_attributes_record(jcr, mdb, ar);
+      ret = bdb_create_base_file_attributes_record(jcr, ar);
    } else {
-      Mmsg0(&mdb->errmsg, _("Cannot Copy/Migrate job using BaseJob.\n"));
-      Jmsg(jcr, M_FATAL, 0, "%s", mdb->errmsg);
+      Mmsg0(&errmsg, _("Cannot Copy/Migrate job using BaseJob.\n"));
+      Jmsg(jcr, M_FATAL, 0, "%s", errmsg);
       ret = true;               /* in copy/migration what do we do ? */
    }
 
@@ -1090,29 +1051,30 @@ bool db_create_attributes_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar)
 }
 
 /**
- * Create Base File record in B_DB
+ * Create Base File record in BDB
  *
  */
-bool db_create_base_file_attributes_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar)
+bool BDB::bdb_create_base_file_attributes_record(JCR *jcr, ATTR_DBR *ar)
 {
    bool ret;
+
    Dmsg1(dbglevel, "create_base_file Fname=%s\n", ar->fname);
    Dmsg0(dbglevel, "put_base_file_into_catalog\n");
 
-   db_lock(mdb);
-   split_path_and_file(jcr, mdb, ar->fname);
+   bdb_lock();
+   split_path_and_file(jcr, this, ar->fname);
 
-   mdb->esc_name = check_pool_memory_size(mdb->esc_name, mdb->fnl*2+1);
-   db_escape_string(jcr, mdb, mdb->esc_name, mdb->fname, mdb->fnl);
+   esc_name = check_pool_memory_size(esc_name, fnl*2+1);
+   bdb_escape_string(jcr, esc_name, fname, fnl);
 
-   mdb->esc_path = check_pool_memory_size(mdb->esc_path, mdb->pnl*2+1);
-   db_escape_string(jcr, mdb, mdb->esc_path, mdb->path, mdb->pnl);
+   esc_path = check_pool_memory_size(esc_path, pnl*2+1);
+   bdb_escape_string(jcr, esc_path, path, pnl);
 
-   Mmsg(mdb->cmd, "INSERT INTO basefile%lld (Path, Name) VALUES ('%s','%s')",
-        (uint64_t)jcr->JobId, mdb->esc_path, mdb->esc_name);
+   Mmsg(cmd, "INSERT INTO basefile%lld (Path, Name) VALUES ('%s','%s')",
+        (uint64_t)jcr->JobId, esc_path, esc_name);
 
-   ret = INSERT_DB(jcr, mdb, mdb->cmd);
-   db_unlock(mdb);
+   ret = InsertDB(jcr, cmd);
+   bdb_unlock();
 
    return ret;
 }
@@ -1120,28 +1082,28 @@ bool db_create_base_file_attributes_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar)
 /**
  * Cleanup the base file temporary tables
  */
-static void db_cleanup_base_file(JCR *jcr, B_DB *mdb)
+static void db_cleanup_base_file(JCR *jcr, BDB *mdb)
 {
    POOL_MEM buf(PM_MESSAGE);
    Mmsg(buf, "DROP TABLE new_basefile%lld", (uint64_t) jcr->JobId);
-   db_sql_query(mdb, buf.c_str(), NULL, NULL);
+   mdb->bdb_sql_query(buf.c_str(), NULL, NULL);
 
    Mmsg(buf, "DROP TABLE basefile%lld", (uint64_t) jcr->JobId);
-   db_sql_query(mdb, buf.c_str(), NULL, NULL);
+   mdb->bdb_sql_query(buf.c_str(), NULL, NULL);
 }
 
 /**
  * Put all base file seen in the backup to the BaseFile table
  * and cleanup temporary tables
  */
-bool db_commit_base_file_attributes_record(JCR *jcr, B_DB *mdb)
+bool BDB::bdb_commit_base_file_attributes_record(JCR *jcr)
 {
    bool ret;
    char ed1[50];
 
-   db_lock(mdb);
+   bdb_lock();
 
-   Mmsg(mdb->cmd,
+   Mmsg(cmd,
   "INSERT INTO BaseFiles (BaseJobId, JobId, FileId, FileIndex) "
    "SELECT B.JobId AS BaseJobId, %s AS JobId, "
           "B.FileId, B.FileIndex "
@@ -1150,18 +1112,18 @@ bool db_commit_base_file_attributes_record(JCR *jcr, B_DB *mdb)
       "AND A.Name = B.Name "
     "ORDER BY B.FileId",
         edit_uint64(jcr->JobId, ed1), ed1, ed1);
-   ret = db_sql_query(mdb, mdb->cmd, NULL, NULL);
+   ret = bdb_sql_query(cmd, NULL, NULL);
    /*
     * Display error now, because the subsequent cleanup destroys the
     *  error message from the above query.
     */
    if (!ret) {
-      Jmsg1(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db));
+      Jmsg1(jcr, M_FATAL, 0, "%s", jcr->db->bdb_strerror());
    }
-   jcr->nb_base_files_used = sql_affected_rows(mdb);
-   db_cleanup_base_file(jcr, mdb);
+   jcr->nb_base_files_used = sql_affected_rows();
+   db_cleanup_base_file(jcr, this);
 
-   db_unlock(mdb);
+   bdb_unlock();
    return ret;
 }
 
@@ -1172,77 +1134,148 @@ bool db_commit_base_file_attributes_record(JCR *jcr, B_DB *mdb)
  * 3) Put the result in a temporary table for the end of job
  *
  */
-bool db_create_base_file_list(JCR *jcr, B_DB *mdb, char *jobids)
+bool BDB::bdb_create_base_file_list(JCR *jcr, char *jobids)
 {
    POOL_MEM buf;
-   bool ret=false;
+   bool ret = false;
 
-   db_lock(mdb);
+   bdb_lock();
 
    if (!*jobids) {
-      Mmsg(mdb->errmsg, _("ERR=JobIds are empty\n"));
-      goto bail_out;
+      Mmsg(errmsg, _("ERR=JobIds are empty\n"));
+      goto bail_out; 
    }
 
-   Mmsg(mdb->cmd, create_temp_basefile[db_get_type_index(mdb)], (uint64_t) jcr->JobId);
-   if (!db_sql_query(mdb, mdb->cmd, NULL, NULL)) {
-      goto bail_out;
+   Mmsg(cmd, create_temp_basefile[bdb_get_type_index()], (uint64_t) jcr->JobId);
+   if (!bdb_sql_query(cmd, NULL, NULL)) {
+      goto bail_out; 
    }
-   Mmsg(buf, select_recent_version[db_get_type_index(mdb)], jobids, jobids);
-   Mmsg(mdb->cmd, create_temp_new_basefile[db_get_type_index(mdb)], (uint64_t)jcr->JobId, buf.c_str());
+   Mmsg(buf, select_recent_version[bdb_get_type_index()], jobids, jobids);
+   Mmsg(cmd, create_temp_new_basefile[bdb_get_type_index()], (uint64_t)jcr->JobId, buf.c_str());
 
-   ret = db_sql_query(mdb, mdb->cmd, NULL, NULL);
-bail_out:
-   db_unlock(mdb);
+   ret = bdb_sql_query(cmd, NULL, NULL);
+bail_out: 
+   bdb_unlock();
    return ret;
 }
 
 /**
- * Create Restore Object record in B_DB
+ * Create Restore Object record in BDB
  *
  */
-bool db_create_restore_object_record(JCR *jcr, B_DB *mdb, ROBJECT_DBR *ro)
+bool BDB::bdb_create_restore_object_record(JCR *jcr, ROBJECT_DBR *ro)
 {
    bool stat;
    int plug_name_len;
    POOLMEM *esc_plug_name = get_pool_memory(PM_MESSAGE);
 
-   db_lock(mdb);
+   bdb_lock();
 
    Dmsg1(dbglevel, "Oname=%s\n", ro->object_name);
    Dmsg0(dbglevel, "put_object_into_catalog\n");
 
-   mdb->fnl = strlen(ro->object_name);
-   mdb->esc_name = check_pool_memory_size(mdb->esc_name, mdb->fnl*2+1);
-   db_escape_string(jcr, mdb, mdb->esc_name, ro->object_name, mdb->fnl);
+   fnl = strlen(ro->object_name);
+   esc_name = check_pool_memory_size(esc_name, fnl*2+1);
+   bdb_escape_string(jcr, esc_name, ro->object_name, fnl);
 
-   db_escape_object(jcr, mdb, ro->object, ro->object_len);
+   bdb_escape_object(jcr, ro->object, ro->object_len);
 
    plug_name_len = strlen(ro->plugin_name);
    esc_plug_name = check_pool_memory_size(esc_plug_name, plug_name_len*2+1);
-   db_escape_string(jcr, mdb, esc_plug_name, ro->plugin_name, plug_name_len);
+   bdb_escape_string(jcr, esc_plug_name, ro->plugin_name, plug_name_len);
 
-   Mmsg(mdb->cmd,
+   Mmsg(cmd,
         "INSERT INTO RestoreObject (ObjectName,PluginName,RestoreObject,"
         "ObjectLength,ObjectFullLength,ObjectIndex,ObjectType,"
         "ObjectCompression,FileIndex,JobId) "
         "VALUES ('%s','%s','%s',%d,%d,%d,%d,%d,%d,%u)",
-        mdb->esc_name, esc_plug_name, mdb->esc_obj,
+        esc_name, esc_plug_name, esc_obj,
         ro->object_len, ro->object_full_len, ro->object_index,
         ro->FileType, ro->object_compression, ro->FileIndex, ro->JobId);
 
-   ro->RestoreObjectId = sql_insert_autokey_record(mdb, mdb->cmd, NT_("RestoreObject"));
+   ro->RestoreObjectId = sql_insert_autokey_record(cmd, NT_("RestoreObject"));
    if (ro->RestoreObjectId == 0) {
-      Mmsg2(&mdb->errmsg, _("Create db Object record %s failed. ERR=%s"),
-         mdb->cmd, sql_strerror(mdb));
-      Jmsg(jcr, M_FATAL, 0, "%s", mdb->errmsg);
+      Mmsg2(&errmsg, _("Create db Object record %s failed. ERR=%s"),
+         cmd, sql_strerror());
+      Jmsg(jcr, M_FATAL, 0, "%s", errmsg);
       stat = false;
    } else {
       stat = true;
    }
-   db_unlock(mdb);
+   bdb_unlock();
    free_pool_memory(esc_plug_name);
    return stat;
 }
 
+bool BDB::bdb_create_snapshot_record(JCR *jcr, SNAPSHOT_DBR *snap)
+{
+   bool status = false;
+   char esc_name[MAX_ESCAPE_NAME_LENGTH];
+   POOLMEM *esc_vol = get_pool_memory(PM_MESSAGE);
+   POOLMEM *esc_dev = get_pool_memory(PM_MESSAGE);
+   POOLMEM *esc_type = get_pool_memory(PM_MESSAGE);
+   POOLMEM *esc_client = get_pool_memory(PM_MESSAGE);
+   POOLMEM *esc_fs = get_pool_memory(PM_MESSAGE);
+   char esc_comment[MAX_ESCAPE_NAME_LENGTH];
+   char dt[MAX_TIME_LENGTH], ed1[50], ed2[50];
+   time_t stime;
+   struct tm tm;
+
+   bdb_lock();
+
+   esc_vol = check_pool_memory_size(esc_vol, strlen(snap->Volume) * 2 + 1);
+   bdb_escape_string(jcr, esc_vol, snap->Volume, strlen(snap->Volume));
+
+   esc_dev = check_pool_memory_size(esc_dev, strlen(snap->Device) * 2 + 1);
+   bdb_escape_string(jcr, esc_dev, snap->Device, strlen(snap->Device));
+
+   esc_type = check_pool_memory_size(esc_type, strlen(snap->Type) * 2 + 1);
+   bdb_escape_string(jcr, esc_type, snap->Type, strlen(snap->Type));
+
+   bdb_escape_string(jcr, esc_comment, snap->Comment, strlen(snap->Comment));
+
+   if (*snap->Client) {
+      bdb_escape_string(jcr, esc_name, snap->Client, strlen(snap->Client));
+      Mmsg(esc_client, "(SELECT ClientId FROM Client WHERE Name='%s')", esc_name);
+
+   } else {
+      Mmsg(esc_client, "%d", snap->ClientId);
+   }
+
+   if (*snap->FileSet) {
+      bdb_escape_string(jcr, esc_name, snap->FileSet, strlen(snap->FileSet));
+      Mmsg(esc_fs, "(SELECT FileSetId FROM FileSet WHERE FileSet='%s' ORDER BY CreateTime DESC LIMIT 1)", esc_name);
+
+   } else {
+      Mmsg(esc_fs, "%d", snap->FileSetId);
+   }
+
+   bdb_escape_string(jcr, esc_name, snap->Name, strlen(snap->Name));
+
+   stime = snap->CreateTDate;
+   (void)localtime_r(&stime, &tm);
+   strftime(dt, sizeof(dt), "%Y-%m-%d %H:%M:%S", &tm);
+
+   Mmsg(cmd, "INSERT INTO Snapshot "
+        "(Name, JobId, CreateTDate, CreateDate, ClientId, FileSetId, Volume, Device, Type, Retention, Comment) "
+ "VALUES ('%s', %s, %d, '%s', %s, %s, '%s', '%s', '%s', %s, '%s')",
+        esc_name, edit_uint64(snap->JobId, ed2), stime, dt, esc_client, esc_fs, esc_vol,
+        esc_dev, esc_type, edit_int64(snap->Retention, ed1), esc_comment);
+
+   if (bdb_sql_query(cmd, NULL, NULL)) {
+      snap->SnapshotId = sql_insert_autokey_record(cmd, NT_("Snapshot"));
+      status = true;
+   }
+
+   bdb_unlock();
+
+   free_pool_memory(esc_vol);
+   free_pool_memory(esc_dev);
+   free_pool_memory(esc_type);
+   free_pool_memory(esc_client);
+   free_pool_memory(esc_fs);
+
+   return status;
+}
+
 #endif /* HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL */
diff --git a/src/cats/sql_delete.c b/src/cats/sql_delete.c
index 33bd3ed..7a6faa8 100644
--- a/src/cats/sql_delete.c
+++ b/src/cats/sql_delete.c
@@ -1,33 +1,34 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Bacula Catalog Database Delete record interface routines
  *
- *    Written by Kern Sibbald, December 2000
+ *    Written by Kern Sibbald, December 2000-2014
  *
  */
 
-#include "bacula.h"
+#include  "bacula.h"
 
 #if HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL
-
-#include "cats.h"
-#include "bdb_priv.h"
-#include "sql_glue.h"
-
+#include  "cats.h"
+ 
 /* -----------------------------------------------------------------------
  *
  *   Generic Routines (or almost generic)
@@ -44,57 +45,54 @@
  *           PoolId = number of Pools deleted (should be 1)
  *           NumVols = number of Media records deleted
  */
-int
-db_delete_pool_record(JCR *jcr, B_DB *mdb, POOL_DBR *pr)
+int BDB::bdb_delete_pool_record(JCR *jcr, POOL_DBR *pr)
 {
    SQL_ROW row;
-   int num_rows;
    char esc[MAX_ESCAPE_NAME_LENGTH];
 
-   db_lock(mdb);
-   mdb->db_escape_string(jcr, esc, pr->Name, strlen(pr->Name));
-   Mmsg(mdb->cmd, "SELECT PoolId FROM Pool WHERE Name='%s'", esc);
-   Dmsg1(10, "selectpool: %s\n", mdb->cmd);
+   bdb_lock();
+   bdb_escape_string(jcr, esc, pr->Name, strlen(pr->Name));
+   Mmsg(cmd, "SELECT PoolId FROM Pool WHERE Name='%s'", esc);
+   Dmsg1(10, "selectpool: %s\n", cmd);
 
    pr->PoolId = pr->NumVols = 0;
 
-   if (QUERY_DB(jcr, mdb, mdb->cmd)) {
-
-      num_rows = sql_num_rows(mdb);
-      if (num_rows == 0) {
-         Mmsg(mdb->errmsg, _("No pool record %s exists\n"), pr->Name);
-         sql_free_result(mdb);
-         db_unlock(mdb);
+   if (QueryDB(jcr, cmd)) {
+      int nrows = sql_num_rows();
+      if (nrows == 0) {
+         Mmsg(errmsg, _("No pool record %s exists\n"), pr->Name);
+         sql_free_result();
+         bdb_unlock();
          return 0;
-      } else if (num_rows != 1) {
-         Mmsg(mdb->errmsg, _("Expecting one pool record, got %d\n"), num_rows);
-         sql_free_result(mdb);
-         db_unlock(mdb);
+      } else if (nrows != 1) {
+         Mmsg(errmsg, _("Expecting one pool record, got %d\n"), nrows);
+         sql_free_result();
+         bdb_unlock();
          return 0;
       }
-      if ((row = sql_fetch_row(mdb)) == NULL) {
-         Mmsg1(&mdb->errmsg, _("Error fetching row %s\n"), sql_strerror(mdb));
-         db_unlock(mdb);
+      if ((row = sql_fetch_row()) == NULL) {
+         Mmsg1(&errmsg, _("Error fetching row %s\n"), sql_strerror());
+         bdb_unlock();
          return 0;
       }
       pr->PoolId = str_to_int64(row[0]);
-      sql_free_result(mdb);
+      sql_free_result();
    }
 
    /* Delete Media owned by this pool */
-   Mmsg(mdb->cmd,
+   Mmsg(cmd,
 "DELETE FROM Media WHERE Media.PoolId = %d", pr->PoolId);
 
-   pr->NumVols = DELETE_DB(jcr, mdb, mdb->cmd);
+   pr->NumVols = DeleteDB(jcr, cmd);
    Dmsg1(200, "Deleted %d Media records\n", pr->NumVols);
 
    /* Delete Pool */
-   Mmsg(mdb->cmd,
+   Mmsg(cmd,
 "DELETE FROM Pool WHERE Pool.PoolId = %d", pr->PoolId);
-   pr->PoolId = DELETE_DB(jcr, mdb, mdb->cmd);
+   pr->PoolId = DeleteDB(jcr, cmd);
    Dmsg1(200, "Deleted %d Pool records\n", pr->PoolId);
 
-   db_unlock(mdb);
+   bdb_unlock();
    return 1;
 }
 
@@ -141,7 +139,7 @@ static int delete_handler(void *ctx, int num_fields, char **row)
  *       We call it from relabel and delete volume=, both ensure
  *       that the volume is properly purged.
  */
-static int do_media_purge(B_DB *mdb, MEDIA_DBR *mr)
+static int do_media_purge(BDB *mdb, MEDIA_DBR *mr)
 {
    POOLMEM *query = get_pool_memory(PM_MESSAGE);
    struct s_del_ctx del;
@@ -160,16 +158,16 @@ static int do_media_purge(B_DB *mdb, MEDIA_DBR *mr)
       del.max_ids = MAX_DEL_LIST_LEN;
    }
    del.JobId = (JobId_t *)malloc(sizeof(JobId_t) * del.max_ids);
-   db_sql_query(mdb, mdb->cmd, delete_handler, (void *)&del);
+   mdb->bdb_sql_query(mdb->cmd, delete_handler, (void *)&del);
 
    for (i=0; i < del.num_ids; i++) {
       Dmsg1(400, "Delete JobId=%d\n", del.JobId[i]);
       Mmsg(query, "DELETE FROM Job WHERE JobId=%s", edit_int64(del.JobId[i], ed1));
-      db_sql_query(mdb, query, NULL, (void *)NULL);
+      mdb->bdb_sql_query(query, NULL, (void *)NULL);
       Mmsg(query, "DELETE FROM File WHERE JobId=%s", edit_int64(del.JobId[i], ed1));
-      db_sql_query(mdb, query, NULL, (void *)NULL);
+      mdb->bdb_sql_query(query, NULL, (void *)NULL);
       Mmsg(query, "DELETE FROM JobMedia WHERE JobId=%s", edit_int64(del.JobId[i], ed1));
-      db_sql_query(mdb, query, NULL, (void *)NULL);
+      mdb->bdb_sql_query(query, NULL, (void *)NULL);
    }
    free(del.JobId);
    free_pool_memory(query);
@@ -179,22 +177,22 @@ static int do_media_purge(B_DB *mdb, MEDIA_DBR *mr)
 /* Delete Media record and all records that
  * are associated with it.
  */
-int db_delete_media_record(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr)
+int BDB::bdb_delete_media_record(JCR *jcr, MEDIA_DBR *mr)
 {
-   db_lock(mdb);
-   if (mr->MediaId == 0 && !db_get_media_record(jcr, mdb, mr)) {
-      db_unlock(mdb);
+   bdb_lock();
+   if (mr->MediaId == 0 && !bdb_get_media_record(jcr, mr)) {
+      bdb_unlock();
       return 0;
    }
    /* Do purge if not already purged */
    if (strcmp(mr->VolStatus, "Purged") != 0) {
       /* Delete associated records */
-      do_media_purge(mdb, mr);
+      do_media_purge(this, mr);
    }
 
-   Mmsg(mdb->cmd, "DELETE FROM Media WHERE MediaId=%d", mr->MediaId);
-   db_sql_query(mdb, mdb->cmd, NULL, (void *)NULL);
-   db_unlock(mdb);
+   Mmsg(cmd, "DELETE FROM Media WHERE MediaId=%d", mr->MediaId);
+   bdb_sql_query(cmd, NULL, (void *)NULL);
+   bdb_unlock();
    return 1;
 }
 
@@ -204,26 +202,40 @@ int db_delete_media_record(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr)
  * media record itself. But the media status
  * is changed to "Purged".
  */
-int db_purge_media_record(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr)
+int BDB::bdb_purge_media_record(JCR *jcr, MEDIA_DBR *mr)
 {
-   db_lock(mdb);
-   if (mr->MediaId == 0 && !db_get_media_record(jcr, mdb, mr)) {
-      db_unlock(mdb);
+   bdb_lock();
+   if (mr->MediaId == 0 && !bdb_get_media_record(jcr, mr)) {
+      bdb_unlock();
       return 0;
    }
    /* Delete associated records */
-   do_media_purge(mdb, mr);           /* Note, always purge */
+   do_media_purge(this, mr);           /* Note, always purge */
 
    /* Mark Volume as purged */
    strcpy(mr->VolStatus, "Purged");
-   if (!db_update_media_record(jcr, mdb, mr)) {
-      db_unlock(mdb);
+   if (!bdb_update_media_record(jcr, mr)) {
+      bdb_unlock();
       return 0;
    }
 
-   db_unlock(mdb);
+   bdb_unlock();
    return 1;
 }
 
+/* Delete Snapshot record */
+int BDB::bdb_delete_snapshot_record(JCR *jcr, SNAPSHOT_DBR *sr)
+{
+   bdb_lock();
+   if (sr->SnapshotId == 0 && !bdb_get_snapshot_record(jcr, sr)) {
+      bdb_unlock();
+      return 0;
+   }
+
+   Mmsg(cmd, "DELETE FROM Snapshot WHERE SnapshotId=%d", sr->SnapshotId);
+   bdb_sql_query(cmd, NULL, (void *)NULL);
+   bdb_unlock();
+   return 1;
+}
 
 #endif /* HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL */
diff --git a/src/cats/sql_find.c b/src/cats/sql_find.c
index ba9c75d..7c83b2e 100644
--- a/src/cats/sql_find.c
+++ b/src/cats/sql_find.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Bacula Catalog Database Find record interface routines
@@ -24,13 +28,11 @@
  *
  */
 
-#include "bacula.h"
+#include  "bacula.h"
 
 #if HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL
 
 #include "cats.h"
-#include "bdb_priv.h"
-#include "sql_glue.h"
 
 /* -----------------------------------------------------------------------
  *
@@ -49,22 +51,21 @@
  * Returns: 0 on failure
  *          1 on success, jr is unchanged, but stime and job are set
  */
-bool
-db_find_job_start_time(JCR *jcr, B_DB *mdb, JOB_DBR *jr, POOLMEM **stime, char *job)
+bool BDB::bdb_find_job_start_time(JCR *jcr, JOB_DBR *jr, POOLMEM **stime, char *job)
 {
    SQL_ROW row;
    char ed1[50], ed2[50];
    char esc_name[MAX_ESCAPE_NAME_LENGTH];
 
-   db_lock(mdb);
-   mdb->db_escape_string(jcr, esc_name, jr->Name, strlen(jr->Name));
+   bdb_lock();
+   bdb_escape_string(jcr, esc_name, jr->Name, strlen(jr->Name));
    pm_strcpy(stime, "0000-00-00 00:00:00");   /* default */
    job[0] = 0;
 
    /* If no Id given, we must find corresponding job */
    if (jr->JobId == 0) {
       /* Differential is since last Full backup */
-      Mmsg(mdb->cmd,
+      Mmsg(cmd,
 "SELECT StartTime, Job FROM Job WHERE JobStatus IN ('T','W') AND Type='%c' AND "
 "Level='%c' AND Name='%s' AND ClientId=%s AND FileSetId=%s "
 "ORDER BY StartTime DESC LIMIT 1",
@@ -82,58 +83,58 @@ db_find_job_start_time(JCR *jcr, B_DB *mdb, JOB_DBR *jr, POOLMEM **stime, char *
           *  then we do a second look to find the most recent
           *  backup
           */
-         if (!QUERY_DB(jcr, mdb, mdb->cmd)) {
-            Mmsg2(&mdb->errmsg, _("Query error for start time request: ERR=%s\nCMD=%s\n"),
-               sql_strerror(mdb), mdb->cmd);
+         if (!QueryDB(jcr, cmd)) {
+            Mmsg2(&errmsg, _("Query error for start time request: ERR=%s\nCMD=%s\n"),
+               sql_strerror(), cmd);
             goto bail_out;
          }
-         if ((row = sql_fetch_row(mdb)) == NULL) {
-            sql_free_result(mdb);
-            Mmsg(mdb->errmsg, _("No prior Full backup Job record found.\n"));
+         if ((row = sql_fetch_row()) == NULL) {
+            sql_free_result();
+            Mmsg(errmsg, _("No prior Full backup Job record found.\n"));
             goto bail_out;
          }
-         sql_free_result(mdb);
+         sql_free_result();
          /* Now edit SQL command for Incremental Job */
-         Mmsg(mdb->cmd,
+         Mmsg(cmd,
 "SELECT StartTime, Job FROM Job WHERE JobStatus IN ('T','W') AND Type='%c' AND "
 "Level IN ('%c','%c','%c') AND Name='%s' AND ClientId=%s "
 "AND FileSetId=%s ORDER BY StartTime DESC LIMIT 1",
             jr->JobType, L_INCREMENTAL, L_DIFFERENTIAL, L_FULL, esc_name,
             edit_int64(jr->ClientId, ed1), edit_int64(jr->FileSetId, ed2));
       } else {
-         Mmsg1(mdb->errmsg, _("Unknown level=%d\n"), jr->JobLevel);
+         Mmsg1(errmsg, _("Unknown level=%d\n"), jr->JobLevel);
          goto bail_out;
       }
    } else {
-      Dmsg1(100, "Submitting: %s\n", mdb->cmd);
-      Mmsg(mdb->cmd, "SELECT StartTime, Job FROM Job WHERE Job.JobId=%s",
+      Dmsg1(100, "Submitting: %s\n", cmd);
+      Mmsg(cmd, "SELECT StartTime, Job FROM Job WHERE Job.JobId=%s",
            edit_int64(jr->JobId, ed1));
    }
 
-   if (!QUERY_DB(jcr, mdb, mdb->cmd)) {
+   if (!QueryDB(jcr, cmd)) {
       pm_strcpy(stime, "");                   /* set EOS */
-      Mmsg2(&mdb->errmsg, _("Query error for start time request: ERR=%s\nCMD=%s\n"),
-         sql_strerror(mdb),  mdb->cmd);
+      Mmsg2(&errmsg, _("Query error for start time request: ERR=%s\nCMD=%s\n"),
+         sql_strerror(),  cmd);
       goto bail_out;
    }
 
-   if ((row = sql_fetch_row(mdb)) == NULL) {
-      Mmsg2(&mdb->errmsg, _("No Job record found: ERR=%s\nCMD=%s\n"),
-         sql_strerror(mdb),  mdb->cmd);
-      sql_free_result(mdb);
+   if ((row = sql_fetch_row()) == NULL) {
+      Mmsg2(&errmsg, _("No Job record found: ERR=%s\nCMD=%s\n"),
+         sql_strerror(),  cmd);
+      sql_free_result();
       goto bail_out;
    }
    Dmsg2(100, "Got start time: %s, job: %s\n", row[0], row[1]);
    pm_strcpy(stime, row[0]);
    bstrncpy(job, row[1], MAX_NAME_LENGTH);
 
-   sql_free_result(mdb);
+   sql_free_result();
 
-   db_unlock(mdb);
+   bdb_unlock();
    return true;
 
 bail_out:
-   db_unlock(mdb);
+   bdb_unlock();
    return false;
 }
 
@@ -147,45 +148,44 @@ bail_out:
  * Returns: false on failure
  *          true  on success, jr is unchanged, but stime and job are set
  */
-bool
-db_find_last_job_start_time(JCR *jcr, B_DB *mdb, JOB_DBR *jr,
+bool BDB::bdb_find_last_job_start_time(JCR *jcr, JOB_DBR *jr,
                             POOLMEM **stime, char *job, int JobLevel)
 {
    SQL_ROW row;
    char ed1[50], ed2[50];
    char esc_name[MAX_ESCAPE_NAME_LENGTH];
 
-   db_lock(mdb);
-   mdb->db_escape_string(jcr, esc_name, jr->Name, strlen(jr->Name));
+   bdb_lock();
+   bdb_escape_string(jcr, esc_name, jr->Name, strlen(jr->Name));
    pm_strcpy(stime, "0000-00-00 00:00:00");   /* default */
    job[0] = 0;
 
-   Mmsg(mdb->cmd,
+   Mmsg(cmd,
 "SELECT StartTime, Job FROM Job WHERE JobStatus IN ('T','W') AND Type='%c' AND "
 "Level='%c' AND Name='%s' AND ClientId=%s AND FileSetId=%s "
 "ORDER BY StartTime DESC LIMIT 1",
       jr->JobType, JobLevel, esc_name,
       edit_int64(jr->ClientId, ed1), edit_int64(jr->FileSetId, ed2));
-   if (!QUERY_DB(jcr, mdb, mdb->cmd)) {
-      Mmsg2(&mdb->errmsg, _("Query error for start time request: ERR=%s\nCMD=%s\n"),
-         sql_strerror(mdb), mdb->cmd);
+   if (!QueryDB(jcr, cmd)) {
+      Mmsg2(&errmsg, _("Query error for start time request: ERR=%s\nCMD=%s\n"),
+         sql_strerror(), cmd);
       goto bail_out;
    }
-   if ((row = sql_fetch_row(mdb)) == NULL) {
-      sql_free_result(mdb);
-      Mmsg(mdb->errmsg, _("No prior Full backup Job record found.\n"));
+   if ((row = sql_fetch_row()) == NULL) {
+      sql_free_result();
+      Mmsg(errmsg, _("No prior Full backup Job record found.\n"));
       goto bail_out;
    }
    Dmsg1(100, "Got start time: %s\n", row[0]);
    pm_strcpy(stime, row[0]);
    bstrncpy(job, row[1], MAX_NAME_LENGTH);
 
-   sql_free_result(mdb);
-   db_unlock(mdb);
+   sql_free_result();
+   bdb_unlock();
    return true;
 
 bail_out:
-   db_unlock(mdb);
+   bdb_unlock();
    return false;
 }
 
@@ -197,18 +197,17 @@ bail_out:
  *          true  on success, jr is unchanged and stime unchanged
  *                level returned in JobLevel
  */
-bool
-db_find_failed_job_since(JCR *jcr, B_DB *mdb, JOB_DBR *jr, POOLMEM *stime, int &JobLevel)
+bool BDB::bdb_find_failed_job_since(JCR *jcr, JOB_DBR *jr, POOLMEM *stime, int &JobLevel)
 {
    SQL_ROW row;
    char ed1[50], ed2[50];
    char esc_name[MAX_ESCAPE_NAME_LENGTH];
 
-   db_lock(mdb);
-   mdb->db_escape_string(jcr, esc_name, jr->Name, strlen(jr->Name));
+   bdb_lock();
+   bdb_escape_string(jcr, esc_name, jr->Name, strlen(jr->Name));
 
    /* Differential is since last Full backup */
-   Mmsg(mdb->cmd,
+   Mmsg(cmd,
 "SELECT Level FROM Job WHERE JobStatus NOT IN ('T','W') AND "
 "Type='%c' AND Level IN ('%c','%c') AND Name='%s' AND ClientId=%s "
 "AND FileSetId=%s AND StartTime>'%s' "
@@ -216,20 +215,20 @@ db_find_failed_job_since(JCR *jcr, B_DB *mdb, JOB_DBR *jr, POOLMEM *stime, int &
          jr->JobType, L_FULL, L_DIFFERENTIAL, esc_name,
          edit_int64(jr->ClientId, ed1), edit_int64(jr->FileSetId, ed2),
          stime);
-   if (!QUERY_DB(jcr, mdb, mdb->cmd)) {
-      db_unlock(mdb);
+   if (!QueryDB(jcr, cmd)) {
+      bdb_unlock();
       return false;
    }
 
-   if ((row = sql_fetch_row(mdb)) == NULL) {
-      sql_free_result(mdb);
-      db_unlock(mdb);
+   if ((row = sql_fetch_row()) == NULL) {
+      sql_free_result();
+      bdb_unlock();
       return false;
    }
    JobLevel = (int)*row[0];
-   sql_free_result(mdb);
+   sql_free_result();
 
-   db_unlock(mdb);
+   bdb_unlock();
    return true;
 }
 
@@ -242,19 +241,18 @@ db_find_failed_job_since(JCR *jcr, B_DB *mdb, JOB_DBR *jr, POOLMEM *stime, int &
  * Returns: true  on success
  *          false on failure
  */
-bool
-db_find_last_jobid(JCR *jcr, B_DB *mdb, const char *Name, JOB_DBR *jr)
+bool BDB::bdb_find_last_jobid(JCR *jcr, const char *Name, JOB_DBR *jr)
 {
    SQL_ROW row;
    char ed1[50];
    char esc_name[MAX_ESCAPE_NAME_LENGTH];
 
-   db_lock(mdb);
+   bdb_lock();
    /* Find last full */
    Dmsg2(100, "JobLevel=%d JobType=%d\n", jr->JobLevel, jr->JobType);
    if (jr->JobLevel == L_VERIFY_CATALOG) {
-      mdb->db_escape_string(jcr, esc_name, jr->Name, strlen(jr->Name));
-      Mmsg(mdb->cmd,
+      bdb_escape_string(jcr, esc_name, jr->Name, strlen(jr->Name));
+      Mmsg(cmd,
 "SELECT JobId FROM Job WHERE Type='V' AND Level='%c' AND "
 " JobStatus IN ('T','W') AND Name='%s' AND "
 "ClientId=%s ORDER BY StartTime DESC LIMIT 1",
@@ -264,45 +262,45 @@ db_find_last_jobid(JCR *jcr, B_DB *mdb, const char *Name, JOB_DBR *jr)
               jr->JobLevel == L_VERIFY_DISK_TO_CATALOG ||
               jr->JobType == JT_BACKUP) {
       if (Name) {
-         mdb->db_escape_string(jcr, esc_name, (char*)Name,
+         bdb_escape_string(jcr, esc_name, (char*)Name,
                                MIN(strlen(Name), sizeof(esc_name)));
-         Mmsg(mdb->cmd,
+         Mmsg(cmd,
 "SELECT JobId FROM Job WHERE Type='B' AND JobStatus IN ('T','W') AND "
 "Name='%s' ORDER BY StartTime DESC LIMIT 1", esc_name);
       } else {
-         Mmsg(mdb->cmd,
+         Mmsg(cmd,
 "SELECT JobId FROM Job WHERE Type='B' AND JobStatus IN ('T','W') AND "
 "ClientId=%s ORDER BY StartTime DESC LIMIT 1",
            edit_int64(jr->ClientId, ed1));
       }
    } else {
-      Mmsg1(&mdb->errmsg, _("Unknown Job level=%d\n"), jr->JobLevel);
-      db_unlock(mdb);
+      Mmsg1(&errmsg, _("Unknown Job level=%d\n"), jr->JobLevel);
+      bdb_unlock();
       return false;
    }
-   Dmsg1(100, "Query: %s\n", mdb->cmd);
-   if (!QUERY_DB(jcr, mdb, mdb->cmd)) {
-      db_unlock(mdb);
+   Dmsg1(100, "Query: %s\n", cmd);
+   if (!QueryDB(jcr, cmd)) {
+      bdb_unlock();
       return false;
    }
-   if ((row = sql_fetch_row(mdb)) == NULL) {
-      Mmsg1(&mdb->errmsg, _("No Job found for: %s.\n"), mdb->cmd);
-      sql_free_result(mdb);
-      db_unlock(mdb);
+   if ((row = sql_fetch_row()) == NULL) {
+      Mmsg1(&errmsg, _("No Job found for: %s.\n"), cmd);
+      sql_free_result();
+      bdb_unlock();
       return false;
    }
 
    jr->JobId = str_to_int64(row[0]);
-   sql_free_result(mdb);
+   sql_free_result();
 
    Dmsg1(100, "db_get_last_jobid: got JobId=%d\n", jr->JobId);
    if (jr->JobId <= 0) {
-      Mmsg1(&mdb->errmsg, _("No Job found for: %s\n"), mdb->cmd);
-      db_unlock(mdb);
+      Mmsg1(&errmsg, _("No Job found for: %s\n"), cmd);
+      bdb_unlock();
       return false;
    }
 
-   db_unlock(mdb);
+   bdb_unlock();
    return true;
 }
 
@@ -314,8 +312,7 @@ db_find_last_jobid(JCR *jcr, B_DB *mdb, const char *Name, JOB_DBR *jr)
  * Returns: 0 on failure
  *          numrows on success
  */
-int
-db_find_next_volume(JCR *jcr, B_DB *mdb, int item, bool InChanger, MEDIA_DBR *mr)
+int BDB::bdb_find_next_volume(JCR *jcr, int item, bool InChanger, MEDIA_DBR *mr)
 {
    SQL_ROW row = NULL;
    int numrows;
@@ -324,13 +321,13 @@ db_find_next_volume(JCR *jcr, B_DB *mdb, int item, bool InChanger, MEDIA_DBR *mr
    char esc_status[MAX_ESCAPE_NAME_LENGTH];
    char ed1[50];
 
-   db_lock(mdb);
-   mdb->db_escape_string(jcr, esc_type, mr->MediaType, strlen(mr->MediaType));
-   mdb->db_escape_string(jcr, esc_status, mr->VolStatus, strlen(mr->VolStatus));
+   bdb_lock();
+   bdb_escape_string(jcr, esc_type, mr->MediaType, strlen(mr->MediaType));
+   bdb_escape_string(jcr, esc_status, mr->VolStatus, strlen(mr->VolStatus));
 
    if (item == -1) {       /* find oldest volume */
       /* Find oldest volume */
-      Mmsg(mdb->cmd, "SELECT MediaId,VolumeName,VolJobs,VolFiles,VolBlocks,"
+      Mmsg(cmd, "SELECT MediaId,VolumeName,VolJobs,VolFiles,VolBlocks,"
          "VolBytes,VolMounts,VolErrors,VolWrites,MaxVolBytes,VolCapacityBytes,"
          "MediaType,VolStatus,PoolId,VolRetention,VolUseDuration,MaxVolJobs,"
          "MaxVolFiles,Recycle,Slot,FirstWritten,LastWritten,InChanger,"
@@ -344,23 +341,19 @@ db_find_next_volume(JCR *jcr, B_DB *mdb, int item, bool InChanger, MEDIA_DBR *mr
      item = 1;
    } else {
       POOL_MEM changer(PM_FNAME);
+      POOL_MEM voltype(PM_FNAME);
       /* Find next available volume */
-      /* ***FIXME***
-       * replace switch with
-       *  if (StorageId == 0)
-       *    break;
-       */
       if (InChanger) {
          Mmsg(changer, " AND InChanger=1 AND StorageId=%s ",
-              edit_int64(mr->StorageId, ed1));
+                 edit_int64(mr->StorageId, ed1));
       }
       if (strcmp(mr->VolStatus, "Recycle") == 0 ||
           strcmp(mr->VolStatus, "Purged") == 0) {
          order = "AND Recycle=1 ORDER BY LastWritten ASC,MediaId";  /* take oldest that can be recycled */
       } else {
-         order = sql_media_order_most_recently_written[db_get_type_index(mdb)];    /* take most recently written */
+         order = sql_media_order_most_recently_written[bdb_get_type_index()];    /* take most recently written */
       }
-      Mmsg(mdb->cmd, "SELECT MediaId,VolumeName,VolJobs,VolFiles,VolBlocks,"
+      Mmsg(cmd, "SELECT MediaId,VolumeName,VolJobs,VolFiles,VolBlocks,"
          "VolBytes,VolMounts,VolErrors,VolWrites,MaxVolBytes,VolCapacityBytes,"
          "MediaType,VolStatus,PoolId,VolRetention,VolUseDuration,MaxVolJobs,"
          "MaxVolFiles,Recycle,Slot,FirstWritten,LastWritten,InChanger,"
@@ -370,37 +363,40 @@ db_find_next_volume(JCR *jcr, B_DB *mdb, int item, bool InChanger, MEDIA_DBR *mr
          "FROM Media WHERE PoolId=%s AND MediaType='%s' AND Enabled=1 "
          "AND VolStatus='%s' "
          "%s "
+         "%s "
          "%s LIMIT %d",
          edit_int64(mr->PoolId, ed1), esc_type,
-         esc_status, changer.c_str(), order, item);
+         esc_status,
+         voltype.c_str(),
+         changer.c_str(), order, item);
    }
-   Dmsg1(100, "fnextvol=%s\n", mdb->cmd);
-   if (!QUERY_DB(jcr, mdb, mdb->cmd)) {
-      db_unlock(mdb);
+   Dmsg1(100, "fnextvol=%s\n", cmd);
+   if (!QueryDB(jcr, cmd)) {
+      bdb_unlock();
       return 0;
    }
 
-   numrows = sql_num_rows(mdb);
+   numrows = sql_num_rows();
    if (item > numrows || item < 1) {
       Dmsg2(050, "item=%d got=%d\n", item, numrows);
-      Mmsg2(&mdb->errmsg, _("Request for Volume item %d greater than max %d or less than 1\n"),
+      Mmsg2(&errmsg, _("Request for Volume item %d greater than max %d or less than 1\n"),
          item, numrows);
-      db_unlock(mdb);
+      bdb_unlock();
       return 0;
    }
 
    /* Note, we previously seeked to the row using:
-    *  sql_data_seek(mdb, item-1);
+    *  sql_data_seek(item-1);
     * but this failed on PostgreSQL, so now we loop
     * over all the records.  This should not be too horrible since
     * the maximum Volumes we look at in any case is 20.
     */
    while (item-- > 0) {
-      if ((row = sql_fetch_row(mdb)) == NULL) {
+      if ((row = sql_fetch_row()) == NULL) {
          Dmsg1(050, "Fail fetch item=%d\n", item+1);
-         Mmsg1(&mdb->errmsg, _("No Volume record found for item %d.\n"), item);
-         sql_free_result(mdb);
-         db_unlock(mdb);
+         Mmsg1(&errmsg, _("No Volume record found for item %d.\n"), item);
+         sql_free_result();
+         bdb_unlock();
          return 0;
       }
    }
@@ -433,7 +429,7 @@ db_find_next_volume(JCR *jcr, B_DB *mdb, int item, bool InChanger, MEDIA_DBR *mr
    mr->InChanger = str_to_uint64(row[22]);
    mr->EndFile = str_to_uint64(row[23]);
    mr->EndBlock = str_to_uint64(row[24]);
-   mr->VolParts = str_to_int64(row[25]);
+   mr->VolType = str_to_int64(row[25]);   /* formerly VolParts */
    mr->LabelType = str_to_int64(row[26]);
    bstrncpy(mr->cLabelDate, row[27]!=NULL?row[27]:"", sizeof(mr->cLabelDate));
    mr->LabelDate = (time_t)str_to_utime(mr->cLabelDate);
@@ -449,9 +445,9 @@ db_find_next_volume(JCR *jcr, B_DB *mdb, int item, bool InChanger, MEDIA_DBR *mr
    mr->VolWriteTime = str_to_int64(row[36]);
    mr->ActionOnPurge = str_to_int64(row[37]);
 
-   sql_free_result(mdb);
+   sql_free_result();
 
-   db_unlock(mdb);
+   bdb_unlock();
    Dmsg1(050, "Rtn numrows=%d\n", numrows);
    return numrows;
 }
diff --git a/src/cats/sql_get.c b/src/cats/sql_get.c
index c1f9016..2414a13 100644
--- a/src/cats/sql_get.c
+++ b/src/cats/sql_get.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /**
  * Bacula Catalog Database Get record interface routines
@@ -23,13 +27,11 @@
  *
  */
 
-#include "bacula.h"
+#include  "bacula.h"
 
 #if HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL
 
-#include "cats.h"
-#include "bdb_priv.h"
-#include "sql_glue.h"
+#include  "cats.h"
 
 /* -----------------------------------------------------------------------
  *
@@ -38,42 +40,37 @@
  * -----------------------------------------------------------------------
  */
 
-/* Forward referenced functions */
-static int db_get_file_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr, FILE_DBR *fdbr);
-static int db_get_filename_record(JCR *jcr, B_DB *mdb);
-
-
-/**
+/*
  * Given a full filename (with path), look up the File record
  * (with attributes) in the database.
  *
- *  Returns: 0 on failure
- *           1 on success with the File record in FILE_DBR
+ *  Returns: false on failure
+ *           true on success with the File record in FILE_DBR
  */
-int db_get_file_attributes_record(JCR *jcr, B_DB *mdb, char *fname, JOB_DBR *jr, FILE_DBR *fdbr)
+bool BDB::bdb_get_file_attributes_record(JCR *jcr, char *afname, JOB_DBR *jr, FILE_DBR *fdbr)
 {
-   int stat;
-   Dmsg1(100, "db_get_file_att_record fname=%s \n", fname);
+   bool ok;
 
-   db_lock(mdb);
-   split_path_and_file(jcr, mdb, fname);
+   Dmsg1(500, "db_get_file_att_record fname=%s \n", afname);
 
-   fdbr->FilenameId = db_get_filename_record(jcr, mdb);
+   bdb_lock();
 
-   fdbr->PathId = db_get_path_record(jcr, mdb);
+   split_path_and_file(jcr, this, afname);
 
-   stat = db_get_file_record(jcr, mdb, jr, fdbr);
+   fdbr->FilenameId = bdb_get_filename_record(jcr);
 
-   db_unlock(mdb);
+   fdbr->PathId = bdb_get_path_record(jcr);
 
-   return stat;
+   ok = bdb_get_file_record(jcr, jr, fdbr);
+
+   bdb_unlock();
+
+   return ok;
 }
 
 
 /**
  * Get a File record
- * Returns: 0 on failure
- *          1 on success
  *
  *  DO NOT use Jmsg in this routine.
  *
@@ -87,79 +84,85 @@ int db_get_file_attributes_record(JCR *jcr, B_DB *mdb, char *fname, JOB_DBR *jr,
  *    we cannot recurse into it, and the other is when we find an
  *    explicit mention of the directory. This can also happen if the
  *    use includes the directory twice.  In this case, Verify
- *    VolumeToCatalog fails because we have two copies in the catalog,
- *    and only the first one is marked (twice).  So, when calling from Verify,
- *    VolumeToCatalog jr is not NULL and we know jr->FileIndex is the fileindex
+ *    VolumeToCatalog fails because we have two copies in the catalog, and
+ *    only the first one is marked (twice).  So, when calling from Verify,
+ *    VolumeToCatalog jr is not NULL, and we know jr->FileIndex is the fileindex
  *    of the version of the directory/file we actually want and do
  *    a more explicit SQL search.
+ *
+ * Returns: false on failure
+ *          true  on success
+ *
  */
-static
-int db_get_file_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr, FILE_DBR *fdbr)
+bool BDB::bdb_get_file_record(JCR *jcr, JOB_DBR *jr, FILE_DBR *fdbr)
 {
    SQL_ROW row;
-   int stat = 0;
+   bool ok = false;
    char ed1[50], ed2[50], ed3[50];
-   int num_rows;
 
-   if (jcr->getJobLevel() == L_VERIFY_DISK_TO_CATALOG) {
-      Mmsg(mdb->cmd,
+   switch (jcr->getJobLevel()) {
+   case L_VERIFY_VOLUME_TO_CATALOG:
+      Mmsg(cmd,
+"SELECT FileId, LStat, MD5 FROM File WHERE File.JobId=%s AND File.PathId=%s AND "
+"File.FilenameId=%s AND File.FileIndex=%u",
+      edit_int64(fdbr->JobId, ed1),
+      edit_int64(fdbr->PathId, ed2),
+      edit_int64(fdbr->FilenameId,ed3),
+      jr->FileIndex);
+      break;
+   case L_VERIFY_DISK_TO_CATALOG:
+      Mmsg(cmd,
 "SELECT FileId, LStat, MD5 FROM File,Job WHERE "
 "File.JobId=Job.JobId AND File.PathId=%s AND "
 "File.FilenameId=%s AND Job.Type='B' AND Job.JobStatus IN ('T','W') AND "
 "ClientId=%s ORDER BY StartTime DESC LIMIT 1",
-      edit_int64(fdbr->PathId, ed1),
-      edit_int64(fdbr->FilenameId, ed2),
+      edit_int64(fdbr->PathId, ed1), 
+      edit_int64(fdbr->FilenameId, ed2), 
       edit_int64(jr->ClientId,ed3));
-   } else if (jcr->getJobLevel() == L_VERIFY_VOLUME_TO_CATALOG) {
-      Mmsg(mdb->cmd,
-           "SELECT FileId, LStat, MD5 FROM File WHERE File.JobId=%s AND File.PathId=%s AND "
-           "File.FilenameId=%s AND File.FileIndex=%u",
-           edit_int64(fdbr->JobId, ed1),
-           edit_int64(fdbr->PathId, ed2),
-           edit_int64(fdbr->FilenameId,ed3),
-           jr->FileIndex);
-   } else {
-      Mmsg(mdb->cmd,
+      break;
+   default:
+      Mmsg(cmd,
 "SELECT FileId, LStat, MD5 FROM File WHERE File.JobId=%s AND File.PathId=%s AND "
 "File.FilenameId=%s",
       edit_int64(fdbr->JobId, ed1),
       edit_int64(fdbr->PathId, ed2),
       edit_int64(fdbr->FilenameId,ed3));
+      break;
    }
+
    Dmsg3(450, "Get_file_record JobId=%u FilenameId=%u PathId=%u\n",
       fdbr->JobId, fdbr->FilenameId, fdbr->PathId);
 
-   Dmsg1(100, "Query=%s\n", mdb->cmd);
+   Dmsg1(100, "Query=%s\n", cmd);
 
-   if (QUERY_DB(jcr, mdb, mdb->cmd)) {
-      num_rows = sql_num_rows(mdb);
-      Dmsg1(050, "get_file_record num_rows=%d\n", num_rows);
-      if (num_rows >= 1) {
-         if ((row = sql_fetch_row(mdb)) == NULL) {
-            Mmsg1(mdb->errmsg, _("Error fetching row: %s\n"), sql_strerror(mdb));
+   if (QueryDB(jcr, cmd)) {
+      Dmsg1(100, "get_file_record sql_num_rows()=%d\n", sql_num_rows());
+      if (sql_num_rows() >= 1) {
+         if ((row = sql_fetch_row()) == NULL) {
+            Mmsg1(errmsg, _("Error fetching row: %s\n"), sql_strerror());
          } else {
             fdbr->FileId = (FileId_t)str_to_int64(row[0]);
             bstrncpy(fdbr->LStat, row[1], sizeof(fdbr->LStat));
             bstrncpy(fdbr->Digest, row[2], sizeof(fdbr->Digest));
-            stat = 1;
-            if (num_rows > 1) {
-               Mmsg3(mdb->errmsg, _("get_file_record want 1 got rows=%d PathId=%s FilenameId=%s\n"),
-                  num_rows,
-                  edit_int64(fdbr->PathId, ed1),
+            ok = true;
+            if (sql_num_rows() > 1) {
+               Mmsg3(errmsg, _("get_file_record want 1 got rows=%d PathId=%s FilenameId=%s\n"),
+                  sql_num_rows(), 
+                  edit_int64(fdbr->PathId, ed1), 
                   edit_int64(fdbr->FilenameId, ed2));
-               Dmsg1(000, "=== Problem!  %s", mdb->errmsg);
+               Dmsg1(000, "=== Problem!  %s", errmsg);
             }
          }
       } else {
-         Mmsg2(mdb->errmsg, _("File record for PathId=%s FilenameId=%s not found.\n"),
-            edit_int64(fdbr->PathId, ed1),
+         Mmsg2(errmsg, _("File record for PathId=%s FilenameId=%s not found.\n"),
+            edit_int64(fdbr->PathId, ed1), 
             edit_int64(fdbr->FilenameId, ed2));
       }
-      sql_free_result(mdb);
+      sql_free_result();
    } else {
-      Mmsg(mdb->errmsg, _("File record not found in Catalog.\n"));
+      Mmsg(errmsg, _("File record not found in Catalog.\n"));
    }
-   return stat;
+   return ok;
 
 }
 
@@ -170,41 +173,41 @@ int db_get_file_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr, FILE_DBR *fdbr)
  *
  *   DO NOT use Jmsg in this routine (see notes for get_file_record)
  */
-static int db_get_filename_record(JCR *jcr, B_DB *mdb)
+int BDB::bdb_get_filename_record(JCR *jcr)
 {
    SQL_ROW row;
    int FilenameId = 0;
    int num_rows;
 
-   mdb->esc_name = check_pool_memory_size(mdb->esc_name, 2*mdb->fnl+2);
-   db_escape_string(jcr, mdb, mdb->esc_name, mdb->fname, mdb->fnl);
+   esc_name = check_pool_memory_size(esc_name, 2*fnl+2);
+   bdb_escape_string(jcr, esc_name, fname, fnl);
 
-   Mmsg(mdb->cmd, "SELECT FilenameId FROM Filename WHERE Name='%s'", mdb->esc_name);
-   if (QUERY_DB(jcr, mdb, mdb->cmd)) {
+   Mmsg(cmd, "SELECT FilenameId FROM Filename WHERE Name='%s'", esc_name);
+   if (QueryDB(jcr, cmd)) {
       char ed1[30];
-      num_rows = sql_num_rows(mdb);
+      num_rows = sql_num_rows();
       if (num_rows > 1) {
-         Mmsg2(mdb->errmsg, _("More than one Filename!: %s for file: %s\n"),
-            edit_uint64(num_rows, ed1), mdb->fname);
-         Jmsg(jcr, M_WARNING, 0, "%s", mdb->errmsg);
+         Mmsg2(errmsg, _("More than one Filename!: %s for file: %s\n"),
+            edit_uint64(num_rows, ed1), fname);
+         Jmsg(jcr, M_WARNING, 0, "%s", errmsg);
       }
       if (num_rows >= 1) {
-         if ((row = sql_fetch_row(mdb)) == NULL) {
-            Mmsg1(mdb->errmsg, _("error fetching row: %s\n"), sql_strerror(mdb));
+         if ((row = sql_fetch_row()) == NULL) {
+            Mmsg1(errmsg, _("error fetching row: %s\n"), sql_strerror());
          } else {
             FilenameId = str_to_int64(row[0]);
             if (FilenameId <= 0) {
-               Mmsg2(mdb->errmsg, _("Get DB Filename record %s found bad record: %d\n"),
-                  mdb->cmd, FilenameId);
+               Mmsg2(errmsg, _("Get DB Filename record %s found bad record: %d\n"),
+                  cmd, FilenameId);
                FilenameId = 0;
             }
          }
       } else {
-         Mmsg1(mdb->errmsg, _("Filename record: %s not found.\n"), mdb->fname);
+         Mmsg1(errmsg, _("Filename record: %s not found.\n"), fname);
       }
-      sql_free_result(mdb);
+      sql_free_result();
    } else {
-      Mmsg(mdb->errmsg, _("Filename record: %s not found in Catalog.\n"), mdb->fname);
+      Mmsg(errmsg, _("Filename record: %s not found in Catalog.\n"), fname);
    }
    return FilenameId;
 }
@@ -216,55 +219,53 @@ static int db_get_filename_record(JCR *jcr, B_DB *mdb)
  *
  *   DO NOT use Jmsg in this routine (see notes for get_file_record)
  */
-int db_get_path_record(JCR *jcr, B_DB *mdb)
+int BDB::bdb_get_path_record(JCR *jcr)
 {
    SQL_ROW row;
    uint32_t PathId = 0;
-   int num_rows;
 
-   mdb->esc_name = check_pool_memory_size(mdb->esc_name, 2*mdb->pnl+2);
-   db_escape_string(jcr, mdb, mdb->esc_name, mdb->path, mdb->pnl);
+   esc_name = check_pool_memory_size(esc_name, 2*pnl+2);
+   bdb_escape_string(jcr, esc_name, path, pnl);
 
-   if (mdb->cached_path_id != 0 && mdb->cached_path_len == mdb->pnl &&
-       strcmp(mdb->cached_path, mdb->path) == 0) {
-      return mdb->cached_path_id;
+   if (cached_path_id != 0 && cached_path_len == pnl &&
+       strcmp(cached_path, path) == 0) {
+      return cached_path_id;
    }
 
-   Mmsg(mdb->cmd, "SELECT PathId FROM Path WHERE Path='%s'", mdb->esc_name);
+   Mmsg(cmd, "SELECT PathId FROM Path WHERE Path='%s'", esc_name);
 
-   if (QUERY_DB(jcr, mdb, mdb->cmd)) {
+   if (QueryDB(jcr, cmd)) {
       char ed1[30];
-      num_rows = sql_num_rows(mdb);
-      if (num_rows > 1) {
-         Mmsg2(mdb->errmsg, _("More than one Path!: %s for path: %s\n"),
-            edit_uint64(num_rows, ed1), mdb->path);
-         Jmsg(jcr, M_WARNING, 0, "%s", mdb->errmsg);
+      if (sql_num_rows() > 1) {
+         Mmsg2(errmsg, _("More than one Path!: %s for path: %s\n"),
+            edit_uint64(sql_num_rows(), ed1), path);
+         Jmsg(jcr, M_WARNING, 0, "%s", errmsg);
       }
       /* Even if there are multiple paths, take the first one */
-      if (num_rows >= 1) {
-         if ((row = sql_fetch_row(mdb)) == NULL) {
-            Mmsg1(mdb->errmsg, _("error fetching row: %s\n"), sql_strerror(mdb));
+      if (sql_num_rows() >= 1) {
+         if ((row = sql_fetch_row()) == NULL) {
+            Mmsg1(errmsg, _("error fetching row: %s\n"), sql_strerror());
          } else {
             PathId = str_to_int64(row[0]);
             if (PathId <= 0) {
-               Mmsg2(mdb->errmsg, _("Get DB path record %s found bad record: %s\n"),
-                  mdb->cmd, edit_int64(PathId, ed1));
+               Mmsg2(errmsg, _("Get DB path record %s found bad record: %s\n"),
+                  cmd, edit_int64(PathId, ed1));
                PathId = 0;
             } else {
                /* Cache path */
-               if (PathId != mdb->cached_path_id) {
-                  mdb->cached_path_id = PathId;
-                  mdb->cached_path_len = mdb->pnl;
-                  pm_strcpy(mdb->cached_path, mdb->path);
+               if (PathId != cached_path_id) {
+                  cached_path_id = PathId;
+                  cached_path_len = pnl;
+                  pm_strcpy(cached_path, path);
                }
             }
          }
       } else {
-         Mmsg1(mdb->errmsg, _("Path record: %s not found.\n"), mdb->path);
+         Mmsg1(errmsg, _("Path record: %s not found.\n"), path);
       }
-      sql_free_result(mdb);
+      sql_free_result();
    } else {
-      Mmsg(mdb->errmsg, _("Path record: %s not found in Catalog.\n"), mdb->path);
+      Mmsg(errmsg, _("Path record: %s not found in Catalog.\n"), path);
    }
    return PathId;
 }
@@ -275,22 +276,22 @@ int db_get_path_record(JCR *jcr, B_DB *mdb)
  * Returns: false on failure
  *          true  on success
  */
-bool db_get_job_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr)
+bool BDB::bdb_get_job_record(JCR *jcr, JOB_DBR *jr)
 {
    SQL_ROW row;
    char ed1[50];
    char esc[MAX_ESCAPE_NAME_LENGTH];
 
-   db_lock(mdb);
+   bdb_lock();
    if (jr->JobId == 0) {
-      mdb->db_escape_string(jcr, esc, jr->Job, strlen(jr->Job));
-      Mmsg(mdb->cmd, "SELECT VolSessionId,VolSessionTime,"
+      bdb_escape_string(jcr, esc, jr->Job, strlen(jr->Job));
+      Mmsg(cmd, "SELECT VolSessionId,VolSessionTime,"
 "PoolId,StartTime,EndTime,JobFiles,JobBytes,JobTDate,Job,JobStatus,"
 "Type,Level,ClientId,Name,PriorJobId,RealEndTime,JobId,FileSetId,"
 "SchedTime,RealEndTime,ReadBytes,HasBase,PurgedFiles "
 "FROM Job WHERE Job='%s'", esc);
     } else {
-      Mmsg(mdb->cmd, "SELECT VolSessionId,VolSessionTime,"
+      Mmsg(cmd, "SELECT VolSessionId,VolSessionTime,"
 "PoolId,StartTime,EndTime,JobFiles,JobBytes,JobTDate,Job,JobStatus,"
 "Type,Level,ClientId,Name,PriorJobId,RealEndTime,JobId,FileSetId,"
 "SchedTime,RealEndTime,ReadBytes,HasBase,PurgedFiles "
@@ -298,14 +299,14 @@ bool db_get_job_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr)
           edit_int64(jr->JobId, ed1));
     }
 
-   if (!QUERY_DB(jcr, mdb, mdb->cmd)) {
-      db_unlock(mdb);
+   if (!QueryDB(jcr, cmd)) {
+      bdb_unlock();
       return false;                   /* failed */
    }
-   if ((row = sql_fetch_row(mdb)) == NULL) {
-      Mmsg1(mdb->errmsg, _("No Job found for JobId %s\n"), edit_int64(jr->JobId, ed1));
-      sql_free_result(mdb);
-      db_unlock(mdb);
+   if ((row = sql_fetch_row()) == NULL) {
+      Mmsg1(errmsg, _("No Job found for JobId %s\n"), edit_int64(jr->JobId, ed1));
+      sql_free_result();
+      bdb_unlock();
       return false;                   /* failed */
    }
 
@@ -329,8 +330,8 @@ bool db_get_job_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr)
       jr->JobId = str_to_int64(row[16]);
    }
    jr->FileSetId = str_to_int64(row[17]);
-   bstrncpy(jr->cSchedTime, row[3]!=NULL?row[18]:"", sizeof(jr->cSchedTime));
-   bstrncpy(jr->cRealEndTime, row[3]!=NULL?row[19]:"", sizeof(jr->cRealEndTime));
+   bstrncpy(jr->cSchedTime, row[18]!=NULL?row[18]:"", sizeof(jr->cSchedTime));
+   bstrncpy(jr->cRealEndTime, row[19]!=NULL?row[19]:"", sizeof(jr->cRealEndTime));
    jr->ReadBytes = str_to_int64(row[20]);
    jr->StartTime = str_to_utime(jr->cStartTime);
    jr->SchedTime = str_to_utime(jr->cSchedTime);
@@ -338,9 +339,9 @@ bool db_get_job_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr)
    jr->RealEndTime = str_to_utime(jr->cRealEndTime);
    jr->HasBase = str_to_int64(row[21]);
    jr->PurgedFiles = str_to_int64(row[22]);
-   sql_free_result(mdb);
+   sql_free_result();
 
-   db_unlock(mdb);
+   bdb_unlock();
    return true;
 }
 
@@ -354,36 +355,34 @@ bool db_get_job_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr)
  *
  *  Returns: number of volumes on success
  */
-int db_get_job_volume_names(JCR *jcr, B_DB *mdb, JobId_t JobId, POOLMEM **VolumeNames)
+int BDB::bdb_get_job_volume_names(JCR *jcr, JobId_t JobId, POOLMEM **VolumeNames)
 {
    SQL_ROW row;
    char ed1[50];
    int stat = 0;
    int i;
-   int num_rows;
 
-   db_lock(mdb);
+   bdb_lock();
    /* Get one entry per VolumeName, but "sort" by VolIndex */
-   Mmsg(mdb->cmd,
+   Mmsg(cmd,
         "SELECT VolumeName,MAX(VolIndex) FROM JobMedia,Media WHERE "
         "JobMedia.JobId=%s AND JobMedia.MediaId=Media.MediaId "
         "GROUP BY VolumeName "
         "ORDER BY 2 ASC", edit_int64(JobId,ed1));
 
-   Dmsg1(130, "VolNam=%s\n", mdb->cmd);
+   Dmsg1(130, "VolNam=%s\n", cmd);
    *VolumeNames[0] = 0;
-   if (QUERY_DB(jcr, mdb, mdb->cmd)) {
-      num_rows = sql_num_rows(mdb);
-      Dmsg1(130, "Num rows=%d\n", num_rows);
-      if (num_rows <= 0) {
-         Mmsg1(mdb->errmsg, _("No volumes found for JobId=%d\n"), JobId);
+   if (QueryDB(jcr, cmd)) {
+      Dmsg1(130, "Num rows=%d\n", sql_num_rows());
+      if (sql_num_rows() <= 0) {
+         Mmsg1(errmsg, _("No volumes found for JobId=%d\n"), JobId);
          stat = 0;
       } else {
-         stat = num_rows;
+         stat = sql_num_rows();
          for (i=0; i < stat; i++) {
-            if ((row = sql_fetch_row(mdb)) == NULL) {
-               Mmsg2(mdb->errmsg, _("Error fetching row %d: ERR=%s\n"), i, sql_strerror(mdb));
-               Jmsg(jcr, M_ERROR, 0, "%s", mdb->errmsg);
+            if ((row = sql_fetch_row()) == NULL) {
+               Mmsg2(errmsg, _("Error fetching row %d: ERR=%s\n"), i, sql_strerror());
+               Jmsg(jcr, M_ERROR, 0, "%s", errmsg);
                stat = 0;
                break;
             } else {
@@ -394,11 +393,11 @@ int db_get_job_volume_names(JCR *jcr, B_DB *mdb, JobId_t JobId, POOLMEM **Volume
             }
          }
       }
-      sql_free_result(mdb);
+      sql_free_result();
    } else {
-      Mmsg(mdb->errmsg, _("No Volume for JobId %d found in Catalog.\n"), JobId);
+      Mmsg(errmsg, _("No Volume for JobId %d found in Catalog.\n"), JobId);
    }
-   db_unlock(mdb);
+   bdb_unlock();
    return stat;
 }
 
@@ -410,17 +409,16 @@ int db_get_job_volume_names(JCR *jcr, B_DB *mdb, JobId_t JobId, POOLMEM **Volume
  *
  *  Returns: number of volumes on success
  */
-int db_get_job_volume_parameters(JCR *jcr, B_DB *mdb, JobId_t JobId, VOL_PARAMS **VolParams)
+int BDB::bdb_get_job_volume_parameters(JCR *jcr, JobId_t JobId, VOL_PARAMS **VolParams)
 {
    SQL_ROW row;
    char ed1[50];
    int stat = 0;
    int i;
    VOL_PARAMS *Vols = NULL;
-   int num_rows;
 
-   db_lock(mdb);
-   Mmsg(mdb->cmd,
+   bdb_lock();
+   Mmsg(cmd,
 "SELECT VolumeName,MediaType,FirstIndex,LastIndex,StartFile,"
 "JobMedia.EndFile,StartBlock,JobMedia.EndBlock,"
 "Slot,StorageId,InChanger"
@@ -428,24 +426,23 @@ int db_get_job_volume_parameters(JCR *jcr, B_DB *mdb, JobId_t JobId, VOL_PARAMS
 " AND JobMedia.MediaId=Media.MediaId ORDER BY VolIndex,JobMediaId",
         edit_int64(JobId, ed1));
 
-   Dmsg1(130, "VolNam=%s\n", mdb->cmd);
-   if (QUERY_DB(jcr, mdb, mdb->cmd)) {
-      num_rows = sql_num_rows(mdb);
-      Dmsg1(200, "Num rows=%d\n", num_rows);
-      if (num_rows <= 0) {
-         Mmsg1(mdb->errmsg, _("No volumes found for JobId=%d\n"), JobId);
+   Dmsg1(130, "VolNam=%s\n", cmd);
+   if (QueryDB(jcr, cmd)) {
+      Dmsg1(200, "Num rows=%d\n", sql_num_rows());
+      if (sql_num_rows() <= 0) {
+         Mmsg1(errmsg, _("No volumes found for JobId=%d\n"), JobId);
          stat = 0;
       } else {
-         stat = num_rows;
+         stat = sql_num_rows();
          DBId_t *SId = NULL;
          if (stat > 0) {
             *VolParams = Vols = (VOL_PARAMS *)malloc(stat * sizeof(VOL_PARAMS));
             SId = (DBId_t *)malloc(stat * sizeof(DBId_t));
          }
          for (i=0; i < stat; i++) {
-            if ((row = sql_fetch_row(mdb)) == NULL) {
-               Mmsg2(mdb->errmsg, _("Error fetching row %d: ERR=%s\n"), i, sql_strerror(mdb));
-               Jmsg(jcr, M_ERROR, 0, "%s", mdb->errmsg);
+            if ((row = sql_fetch_row()) == NULL) {
+               Mmsg2(errmsg, _("Error fetching row %d: ERR=%s\n"), i, sql_strerror());
+               Jmsg(jcr, M_ERROR, 0, "%s", errmsg);
                stat = 0;
                break;
             } else {
@@ -470,10 +467,10 @@ int db_get_job_volume_parameters(JCR *jcr, B_DB *mdb, JobId_t JobId, VOL_PARAMS
          }
          for (i=0; i < stat; i++) {
             if (SId[i] != 0) {
-               Mmsg(mdb->cmd, "SELECT Name from Storage WHERE StorageId=%s",
+               Mmsg(cmd, "SELECT Name from Storage WHERE StorageId=%s",
                   edit_int64(SId[i], ed1));
-               if (QUERY_DB(jcr, mdb, mdb->cmd)) {
-                  if ((row = sql_fetch_row(mdb)) && row[0]) {
+               if (QueryDB(jcr, cmd)) {
+                  if ((row = sql_fetch_row()) && row[0]) {
                      bstrncpy(Vols[i].Storage, row[0], MAX_NAME_LENGTH);
                   }
                }
@@ -483,9 +480,9 @@ int db_get_job_volume_parameters(JCR *jcr, B_DB *mdb, JobId_t JobId, VOL_PARAMS
             free(SId);
          }
       }
-      sql_free_result(mdb);
+      sql_free_result();
    }
-   db_unlock(mdb);
+   bdb_unlock();
    return stat;
 }
 
@@ -497,14 +494,14 @@ int db_get_job_volume_parameters(JCR *jcr, B_DB *mdb, JobId_t JobId, VOL_PARAMS
  * Returns: -1 on failure
  *          number on success
  */
-int db_get_num_pool_records(JCR *jcr, B_DB *mdb)
+int BDB::bdb_get_num_pool_records(JCR *jcr)
 {
    int stat = 0;
 
-   db_lock(mdb);
-   Mmsg(mdb->cmd, "SELECT count(*) from Pool");
-   stat = get_sql_record_max(jcr, mdb);
-   db_unlock(mdb);
+   bdb_lock();
+   Mmsg(cmd, "SELECT count(*) from Pool");
+   stat = get_sql_record_max(jcr, this);
+   bdb_unlock();
    return stat;
 }
 
@@ -515,33 +512,33 @@ int db_get_num_pool_records(JCR *jcr, B_DB *mdb)
  *  Returns 0: on failure
  *          1: on success
  */
-int db_get_pool_ids(JCR *jcr, B_DB *mdb, int *num_ids, uint32_t *ids[])
+int BDB::bdb_get_pool_ids(JCR *jcr, int *num_ids, uint32_t *ids[])
 {
    SQL_ROW row;
    int stat = 0;
    int i = 0;
    uint32_t *id;
 
-   db_lock(mdb);
+   bdb_lock();
    *ids = NULL;
-   Mmsg(mdb->cmd, "SELECT PoolId FROM Pool");
-   if (QUERY_DB(jcr, mdb, mdb->cmd)) {
-      *num_ids = sql_num_rows(mdb);
+   Mmsg(cmd, "SELECT PoolId FROM Pool");
+   if (QueryDB(jcr, cmd)) {
+      *num_ids = sql_num_rows();
       if (*num_ids > 0) {
          id = (uint32_t *)malloc(*num_ids * sizeof(uint32_t));
-         while ((row = sql_fetch_row(mdb)) != NULL) {
+         while ((row = sql_fetch_row()) != NULL) {
             id[i++] = str_to_uint64(row[0]);
          }
          *ids = id;
       }
-      sql_free_result(mdb);
+      sql_free_result();
       stat = 1;
    } else {
-      Mmsg(mdb->errmsg, _("Pool id select failed: ERR=%s\n"), sql_strerror(mdb));
-      Jmsg(jcr, M_ERROR, 0, "%s", mdb->errmsg);
+      Mmsg(errmsg, _("Pool id select failed: ERR=%s\n"), sql_strerror());
+      Jmsg(jcr, M_ERROR, 0, "%s", errmsg);
       stat = 0;
    }
-   db_unlock(mdb);
+   bdb_unlock();
    return stat;
 }
 
@@ -552,33 +549,33 @@ int db_get_pool_ids(JCR *jcr, B_DB *mdb, int *num_ids, uint32_t *ids[])
  *  Returns 0: on failure
  *          1: on success
  */
-int db_get_client_ids(JCR *jcr, B_DB *mdb, int *num_ids, uint32_t *ids[])
+int BDB::bdb_get_client_ids(JCR *jcr, int *num_ids, uint32_t *ids[])
 {
    SQL_ROW row;
    int stat = 0;
    int i = 0;
    uint32_t *id;
 
-   db_lock(mdb);
+   bdb_lock();
    *ids = NULL;
-   Mmsg(mdb->cmd, "SELECT ClientId FROM Client ORDER BY Name");
-   if (QUERY_DB(jcr, mdb, mdb->cmd)) {
-      *num_ids = sql_num_rows(mdb);
+   Mmsg(cmd, "SELECT ClientId FROM Client ORDER BY Name ASC");
+   if (QueryDB(jcr, cmd)) {
+      *num_ids = sql_num_rows();
       if (*num_ids > 0) {
          id = (uint32_t *)malloc(*num_ids * sizeof(uint32_t));
-         while ((row = sql_fetch_row(mdb)) != NULL) {
+         while ((row = sql_fetch_row()) != NULL) {
             id[i++] = str_to_uint64(row[0]);
          }
          *ids = id;
       }
-      sql_free_result(mdb);
+      sql_free_result();
       stat = 1;
    } else {
-      Mmsg(mdb->errmsg, _("Client id select failed: ERR=%s\n"), sql_strerror(mdb));
-      Jmsg(jcr, M_ERROR, 0, "%s", mdb->errmsg);
+      Mmsg(errmsg, _("Client id select failed: ERR=%s\n"), sql_strerror());
+      Jmsg(jcr, M_ERROR, 0, "%s", errmsg);
       stat = 0;
    }
-   db_unlock(mdb);
+   bdb_unlock();
    return stat;
 }
 
@@ -587,41 +584,39 @@ int db_get_client_ids(JCR *jcr, B_DB *mdb, int *num_ids, uint32_t *ids[])
  * Returns: false on failure
  *          true on success
  */
-bool db_get_pool_record(JCR *jcr, B_DB *mdb, POOL_DBR *pdbr)
+bool BDB::bdb_get_pool_record(JCR *jcr, POOL_DBR *pdbr)
 {
    SQL_ROW row;
    bool ok = false;
    char ed1[50];
-   int num_rows;
    char esc[MAX_ESCAPE_NAME_LENGTH];
 
-   db_lock(mdb);
+   bdb_lock();
    if (pdbr->PoolId != 0) {               /* find by id */
-      Mmsg(mdb->cmd,
+      Mmsg(cmd,
 "SELECT PoolId,Name,NumVols,MaxVols,UseOnce,UseCatalog,AcceptAnyVolume,"
 "AutoPrune,Recycle,VolRetention,VolUseDuration,MaxVolJobs,MaxVolFiles,"
 "MaxVolBytes,PoolType,LabelType,LabelFormat,RecyclePoolId,ScratchPoolId,"
 "ActionOnPurge FROM Pool WHERE Pool.PoolId=%s",
          edit_int64(pdbr->PoolId, ed1));
    } else {                           /* find by name */
-      mdb->db_escape_string(jcr, esc, pdbr->Name, strlen(pdbr->Name));
-      Mmsg(mdb->cmd,
+      bdb_escape_string(jcr, esc, pdbr->Name, strlen(pdbr->Name));
+      Mmsg(cmd,
 "SELECT PoolId,Name,NumVols,MaxVols,UseOnce,UseCatalog,AcceptAnyVolume,"
 "AutoPrune,Recycle,VolRetention,VolUseDuration,MaxVolJobs,MaxVolFiles,"
 "MaxVolBytes,PoolType,LabelType,LabelFormat,RecyclePoolId,ScratchPoolId,"
 "ActionOnPurge FROM Pool WHERE Pool.Name='%s'", esc);
    }
-   if (QUERY_DB(jcr, mdb, mdb->cmd)) {
-      num_rows = sql_num_rows(mdb);
-      if (num_rows > 1) {
+   if (QueryDB(jcr, cmd)) {
+      if (sql_num_rows() > 1) {
          char ed1[30];
-         Mmsg1(mdb->errmsg, _("More than one Pool!: %s\n"),
-            edit_uint64(num_rows, ed1));
-         Jmsg(jcr, M_ERROR, 0, "%s", mdb->errmsg);
-      } else if (num_rows == 1) {
-         if ((row = sql_fetch_row(mdb)) == NULL) {
-            Mmsg1(mdb->errmsg, _("error fetching row: %s\n"), sql_strerror(mdb));
-            Jmsg(jcr, M_ERROR, 0, "%s", mdb->errmsg);
+         Mmsg1(errmsg, _("More than one Pool! Num=%s\n"),
+            edit_uint64(sql_num_rows(), ed1));
+         Jmsg(jcr, M_ERROR, 0, "%s", errmsg);
+      } else if (sql_num_rows() == 1) {
+         if ((row = sql_fetch_row()) == NULL) {
+            Mmsg1(errmsg, _("error fetching row: %s\n"), sql_strerror());
+            Jmsg(jcr, M_ERROR, 0, "%s", errmsg);
          } else {
             pdbr->PoolId = str_to_int64(row[0]);
             bstrncpy(pdbr->Name, row[1]!=NULL?row[1]:"", sizeof(pdbr->Name));
@@ -646,9 +641,9 @@ bool db_get_pool_record(JCR *jcr, B_DB *mdb, POOL_DBR *pdbr)
             ok = true;
          }
       }
-      sql_free_result(mdb);
+      sql_free_result();
    }
-   db_unlock(mdb);
+   bdb_unlock();
    return ok;
 }
 /**
@@ -659,31 +654,142 @@ bool db_get_pool_record(JCR *jcr, B_DB *mdb, POOL_DBR *pdbr)
  * Returns: false on failure
  *          true on success
  */
-bool db_get_pool_numvols(JCR *jcr, B_DB *mdb, POOL_DBR *pdbr)
+bool BDB::bdb_get_pool_numvols(JCR *jcr, POOL_DBR *pdbr)
 {
    bool ok;
    char ed1[50];
 
-   ok = db_get_pool_record(jcr, mdb, pdbr);
+   ok = db_get_pool_record(jcr, this, pdbr);
 
-   db_lock(mdb);
+   bdb_lock();
    if (ok) {
       uint32_t NumVols;
-      Mmsg(mdb->cmd, "SELECT count(*) from Media WHERE PoolId=%s",
+      Mmsg(cmd, "SELECT count(*) from Media WHERE PoolId=%s",
          edit_int64(pdbr->PoolId, ed1));
-      NumVols = get_sql_record_max(jcr, mdb);
+      NumVols = get_sql_record_max(jcr, this);
       Dmsg2(400, "Actual NumVols=%d Pool NumVols=%d\n", NumVols, pdbr->NumVols);
       if (NumVols != pdbr->NumVols) {
          pdbr->NumVols = NumVols;
-         db_update_pool_record(jcr, mdb, pdbr);
+         db_update_pool_record(jcr, this, pdbr);
       }
    } else {
-      Mmsg(mdb->errmsg, _("Pool record not found in Catalog.\n"));
+      Mmsg(errmsg, _("Pool record not found in Catalog.\n"));
    }
-   db_unlock(mdb);
+   bdb_unlock();
    return ok;
 }
 
+/*
+ * Free restoreobject record (some fields are allocated through malloc)
+ */
+void db_free_restoreobject_record(JCR *jcr, ROBJECT_DBR *rr)
+{
+   if (rr->object) {
+      free(rr->object);
+   }
+   if (rr->object_name) {
+      free(rr->object_name);
+   }
+   if (rr->plugin_name) {
+      free(rr->plugin_name);
+   }
+   rr->object = rr->plugin_name = rr->object_name = NULL;
+}
+
+/*
+ * Get RestoreObject  Record
+ * If the RestoreObjectId is non-zero, we get its record
+ *
+ * You must call db_free_restoreobject_record() after db_get_restoreobject_record()
+ *
+ * Returns: false on failure
+ *          true  on success
+ */
+bool BDB::bdb_get_restoreobject_record(JCR *jcr, ROBJECT_DBR *rr)
+{
+   SQL_ROW row;
+   int stat = false;
+   char ed1[50];
+   int32_t len;
+
+   bdb_lock();
+   Mmsg(cmd,
+        "SELECT ObjectName, PluginName, ObjectType, JobId, ObjectCompression, "
+               "RestoreObject, ObjectLength, ObjectFullLength, FileIndex "
+          "FROM RestoreObject "
+         "WHERE RestoreObjectId=%s",
+           edit_int64(rr->RestoreObjectId, ed1));
+
+   /* Using the JobId permits to check the Job name against ACLs and
+    * make sure that the current user is authorized to see the Restore object
+    */
+   if (rr->JobId) {
+      pm_strcat(cmd, " AND JobId=");
+      pm_strcat(cmd, edit_int64(rr->JobId, ed1));
+
+   } else if (rr->JobIds && is_a_number_list(rr->JobIds)) {
+      pm_strcat(cmd, " AND JobId IN (");
+      pm_strcat(cmd, rr->JobIds);
+      pm_strcat(cmd, ")");
+   }
+
+   if (QueryDB(jcr, cmd)) {
+      if (sql_num_rows() > 1) {
+         char ed1[30];
+         Mmsg1(errmsg, _("Error got %s RestoreObjects but expected only one!\n"),
+            edit_uint64(sql_num_rows(), ed1));
+         sql_data_seek(sql_num_rows()-1);
+      }
+      if ((row = sql_fetch_row()) == NULL) {
+         Mmsg1(errmsg, _("RestoreObject record \"%d\" not found.\n"), rr->RestoreObjectId);
+      } else {
+         db_free_restoreobject_record(jcr, rr);
+         rr->object_name = bstrdup(row[0]);
+         rr->plugin_name = bstrdup(row[1]);
+         rr->FileType = str_to_uint64(row[2]);
+         rr->JobId = str_to_uint64(row[3]);
+         rr->object_compression = str_to_int64(row[4]);
+         rr->object_len  = str_to_uint64(row[6]);
+         rr->object_full_len = str_to_uint64(row[7]);
+         rr->object_index = str_to_uint64(row[8]);
+
+         bdb_unescape_object(jcr,
+                            row[5],                /* Object  */
+                            rr->object_len,        /* Object length */
+                            &cmd, &len);
+
+         if (rr->object_compression > 0) {
+            int out_len = rr->object_full_len + 100; /* full length */
+            char *obj = (char *)malloc(out_len);
+            Zinflate(cmd, rr->object_len, obj, out_len); /* out_len is updated */
+            if (out_len != (int)rr->object_full_len) {
+               Dmsg3(10, "Decompression failed. Len wanted=%d got=%d. Object=%s\n",
+                     rr->object_full_len, out_len, rr->plugin_name);
+
+               Mmsg(errmsg, _("Decompression failed. Len wanted=%d got=%d. Object=%s\n"),
+                    rr->object_full_len, out_len, rr->plugin_name);
+            }
+            obj[out_len] = 0;
+            rr->object = obj;
+            rr->object_len = out_len;
+
+         } else {
+            rr->object = (char *)malloc(sizeof(char)*(len+1));
+            memcpy(rr->object, cmd, len);
+            rr->object[len] = 0;
+            rr->object_len = len;
+         }
+
+         stat = true;
+      }
+      sql_free_result();
+   } else {
+      Mmsg(errmsg, _("RestoreObject record not found in Catalog.\n"));
+   }
+   bdb_unlock();
+   return stat;
+}
+
 /**
  * Get Client Record
  * If the ClientId is non-zero, we get its record,
@@ -692,37 +798,35 @@ bool db_get_pool_numvols(JCR *jcr, B_DB *mdb, POOL_DBR *pdbr)
  * Returns: 0 on failure
  *          1 on success
  */
-int db_get_client_record(JCR *jcr, B_DB *mdb, CLIENT_DBR *cdbr)
+int BDB::bdb_get_client_record(JCR *jcr, CLIENT_DBR *cdbr)
 {
    SQL_ROW row;
    int stat = 0;
    char ed1[50];
-   int num_rows;
    char esc[MAX_ESCAPE_NAME_LENGTH];
 
-   db_lock(mdb);
+   bdb_lock();
    if (cdbr->ClientId != 0) {               /* find by id */
-      Mmsg(mdb->cmd,
+      Mmsg(cmd,
 "SELECT ClientId,Name,Uname,AutoPrune,FileRetention,JobRetention "
 "FROM Client WHERE Client.ClientId=%s",
         edit_int64(cdbr->ClientId, ed1));
    } else {                           /* find by name */
-      mdb->db_escape_string(jcr, esc, cdbr->Name, strlen(cdbr->Name));
-      Mmsg(mdb->cmd,
+      bdb_escape_string(jcr, esc, cdbr->Name, strlen(cdbr->Name));
+      Mmsg(cmd,
 "SELECT ClientId,Name,Uname,AutoPrune,FileRetention,JobRetention "
 "FROM Client WHERE Client.Name='%s'", esc);
    }
 
-   if (QUERY_DB(jcr, mdb, mdb->cmd)) {
-      num_rows = sql_num_rows(mdb);
-      if (num_rows > 1) {
-         Mmsg1(mdb->errmsg, _("More than one Client!: %s\n"),
-            edit_uint64(num_rows, ed1));
-         Jmsg(jcr, M_ERROR, 0, "%s", mdb->errmsg);
-      } else if (num_rows == 1) {
-         if ((row = sql_fetch_row(mdb)) == NULL) {
-            Mmsg1(mdb->errmsg, _("error fetching row: %s\n"), sql_strerror(mdb));
-            Jmsg(jcr, M_ERROR, 0, "%s", mdb->errmsg);
+   if (QueryDB(jcr, cmd)) {
+      if (sql_num_rows() > 1) {
+         Mmsg1(errmsg, _("More than one Client!: %s\n"),
+            edit_uint64(sql_num_rows(), ed1));
+         Jmsg(jcr, M_ERROR, 0, "%s", errmsg);
+      } else if (sql_num_rows() == 1) {
+         if ((row = sql_fetch_row()) == NULL) {
+            Mmsg1(errmsg, _("error fetching row: %s\n"), sql_strerror());
+            Jmsg(jcr, M_ERROR, 0, "%s", errmsg);
          } else {
             cdbr->ClientId = str_to_int64(row[0]);
             bstrncpy(cdbr->Name, row[1]!=NULL?row[1]:"", sizeof(cdbr->Name));
@@ -733,13 +837,13 @@ int db_get_client_record(JCR *jcr, B_DB *mdb, CLIENT_DBR *cdbr)
             stat = 1;
          }
       } else {
-         Mmsg(mdb->errmsg, _("Client record not found in Catalog.\n"));
+         Mmsg(errmsg, _("Client record not found in Catalog.\n"));
       }
-      sql_free_result(mdb);
+      sql_free_result();
    } else {
-      Mmsg(mdb->errmsg, _("Client record not found in Catalog.\n"));
+      Mmsg(errmsg, _("Client record not found in Catalog.\n"));
    }
-   db_unlock(mdb);
+   bdb_unlock();
    return stat;
 }
 
@@ -749,31 +853,29 @@ int db_get_client_record(JCR *jcr, B_DB *mdb, CLIENT_DBR *cdbr)
  * Returns: 0 on failure
  *          1 on success
  */
-int db_get_counter_record(JCR *jcr, B_DB *mdb, COUNTER_DBR *cr)
+bool BDB::bdb_get_counter_record(JCR *jcr, COUNTER_DBR *cr)
 {
    SQL_ROW row;
-   int num_rows;
    char esc[MAX_ESCAPE_NAME_LENGTH];
 
-   db_lock(mdb);
-   mdb->db_escape_string(jcr, esc, cr->Counter, strlen(cr->Counter));
+   bdb_lock();
+   bdb_escape_string(jcr, esc, cr->Counter, strlen(cr->Counter));
 
-   Mmsg(mdb->cmd, select_counter_values[mdb->db_get_type_index()], esc);
-   if (QUERY_DB(jcr, mdb, mdb->cmd)) {
-      num_rows = sql_num_rows(mdb);
+   Mmsg(cmd, select_counter_values[bdb_get_type_index()], esc);
+   if (QueryDB(jcr, cmd)) {
 
       /* If more than one, report error, but return first row */
-      if (num_rows > 1) {
-         Mmsg1(mdb->errmsg, _("More than one Counter!: %d\n"), num_rows);
-         Jmsg(jcr, M_ERROR, 0, "%s", mdb->errmsg);
+      if (sql_num_rows() > 1) {
+         Mmsg1(errmsg, _("More than one Counter!: %d\n"), sql_num_rows());
+         Jmsg(jcr, M_ERROR, 0, "%s", errmsg);
       }
-      if (num_rows >= 1) {
-         if ((row = sql_fetch_row(mdb)) == NULL) {
-            Mmsg1(mdb->errmsg, _("error fetching Counter row: %s\n"), sql_strerror(mdb));
-            Jmsg(jcr, M_ERROR, 0, "%s", mdb->errmsg);
-            sql_free_result(mdb);
-            db_unlock(mdb);
-            return 0;
+      if (sql_num_rows() >= 1) {
+         if ((row = sql_fetch_row()) == NULL) {
+            Mmsg1(errmsg, _("error fetching Counter row: %s\n"), sql_strerror());
+            Jmsg(jcr, M_ERROR, 0, "%s", errmsg);
+            sql_free_result();
+            bdb_unlock();
+            return false;
          }
          cr->MinValue = str_to_int64(row[0]);
          cr->MaxValue = str_to_int64(row[1]);
@@ -783,16 +885,16 @@ int db_get_counter_record(JCR *jcr, B_DB *mdb, COUNTER_DBR *cr)
          } else {
             cr->WrapCounter[0] = 0;
          }
-         sql_free_result(mdb);
-         db_unlock(mdb);
-         return 1;
+         sql_free_result();
+         bdb_unlock();
+         return true;
       }
-      sql_free_result(mdb);
+      sql_free_result();
    } else {
-      Mmsg(mdb->errmsg, _("Counter record: %s not found in Catalog.\n"), cr->Counter);
+      Mmsg(errmsg, _("Counter record: %s not found in Catalog.\n"), cr->Counter);
    }
-   db_unlock(mdb);
-   return 0;
+   bdb_unlock();
+   return false;
 }
 
 
@@ -804,37 +906,35 @@ int db_get_counter_record(JCR *jcr, B_DB *mdb, COUNTER_DBR *cr)
  * Returns: 0 on failure
  *          id on success
  */
-int db_get_fileset_record(JCR *jcr, B_DB *mdb, FILESET_DBR *fsr)
+int BDB::bdb_get_fileset_record(JCR *jcr, FILESET_DBR *fsr)
 {
    SQL_ROW row;
    int stat = 0;
    char ed1[50];
-   int num_rows;
    char esc[MAX_ESCAPE_NAME_LENGTH];
 
-   db_lock(mdb);
+   bdb_lock();
    if (fsr->FileSetId != 0) {               /* find by id */
-      Mmsg(mdb->cmd,
+      Mmsg(cmd,
            "SELECT FileSetId,FileSet,MD5,CreateTime FROM FileSet "
            "WHERE FileSetId=%s",
            edit_int64(fsr->FileSetId, ed1));
    } else {                           /* find by name */
-      mdb->db_escape_string(jcr, esc, fsr->FileSet, strlen(fsr->FileSet));
-      Mmsg(mdb->cmd,
+      bdb_escape_string(jcr, esc, fsr->FileSet, strlen(fsr->FileSet));
+      Mmsg(cmd,
            "SELECT FileSetId,FileSet,MD5,CreateTime FROM FileSet "
            "WHERE FileSet='%s' ORDER BY CreateTime DESC LIMIT 1", esc);
    }
 
-   if (QUERY_DB(jcr, mdb, mdb->cmd)) {
-      num_rows = sql_num_rows(mdb);
-      if (num_rows > 1) {
+   if (QueryDB(jcr, cmd)) {
+      if (sql_num_rows() > 1) {
          char ed1[30];
-         Mmsg1(mdb->errmsg, _("Error got %s FileSets but expected only one!\n"),
-            edit_uint64(num_rows, ed1));
-         sql_data_seek(mdb, num_rows-1);
+         Mmsg1(errmsg, _("Error got %s FileSets but expected only one!\n"),
+            edit_uint64(sql_num_rows(), ed1));
+         sql_data_seek(sql_num_rows()-1);
       }
-      if ((row = sql_fetch_row(mdb)) == NULL) {
-         Mmsg1(mdb->errmsg, _("FileSet record \"%s\" not found.\n"), fsr->FileSet);
+      if ((row = sql_fetch_row()) == NULL) {
+         Mmsg1(errmsg, _("FileSet record \"%s\" not found.\n"), fsr->FileSet);
       } else {
          fsr->FileSetId = str_to_int64(row[0]);
          bstrncpy(fsr->FileSet, row[1]!=NULL?row[1]:"", sizeof(fsr->FileSet));
@@ -842,11 +942,11 @@ int db_get_fileset_record(JCR *jcr, B_DB *mdb, FILESET_DBR *fsr)
          bstrncpy(fsr->cCreateTime, row[3]!=NULL?row[3]:"", sizeof(fsr->cCreateTime));
          stat = fsr->FileSetId;
       }
-      sql_free_result(mdb);
+      sql_free_result();
    } else {
-      Mmsg(mdb->errmsg, _("FileSet record not found in Catalog.\n"));
+      Mmsg(errmsg, _("FileSet record not found in Catalog.\n"));
    }
-   db_unlock(mdb);
+   bdb_unlock();
    return stat;
 }
 
@@ -857,14 +957,14 @@ int db_get_fileset_record(JCR *jcr, B_DB *mdb, FILESET_DBR *fsr)
  * Returns: -1 on failure
  *          number on success
  */
-int db_get_num_media_records(JCR *jcr, B_DB *mdb)
+int BDB::bdb_get_num_media_records(JCR *jcr)
 {
    int stat = 0;
 
-   db_lock(mdb);
-   Mmsg(mdb->cmd, "SELECT count(*) from Media");
-   stat = get_sql_record_max(jcr, mdb);
-   db_unlock(mdb);
+   bdb_lock();
+   Mmsg(cmd, "SELECT count(*) from Media");
+   stat = get_sql_record_max(jcr, this);
+   bdb_unlock();
    return stat;
 }
 
@@ -877,7 +977,7 @@ int db_get_num_media_records(JCR *jcr, B_DB *mdb)
  *  Returns false: on failure
  *          true:  on success
  */
-bool db_get_media_ids(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr, int *num_ids, uint32_t *ids[])
+bool BDB::bdb_get_media_ids(JCR *jcr, MEDIA_DBR *mr, int *num_ids, uint32_t *ids[])
 {
    SQL_ROW row;
    int i = 0;
@@ -887,64 +987,64 @@ bool db_get_media_ids(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr, int *num_ids, uint32_t
    char buf[MAX_NAME_LENGTH*3]; /* Can contain MAX_NAME_LENGTH*2+1 + AND ....='' */
    char esc[MAX_NAME_LENGTH*2+1];
 
-   db_lock(mdb);
+   bdb_lock();
    *ids = NULL;
 
-   Mmsg(mdb->cmd, "SELECT DISTINCT MediaId FROM Media WHERE Recycle=%d AND Enabled=%d ",
+   Mmsg(cmd, "SELECT DISTINCT MediaId FROM Media WHERE Recycle=%d AND Enabled=%d ",
         mr->Recycle, mr->Enabled);
 
    if (*mr->MediaType) {
-      db_escape_string(jcr, mdb, esc, mr->MediaType, strlen(mr->MediaType));
+      bdb_escape_string(jcr, esc, mr->MediaType, strlen(mr->MediaType));
       bsnprintf(buf, sizeof(buf), "AND MediaType='%s' ", esc);
-      pm_strcat(mdb->cmd, buf);
+      pm_strcat(cmd, buf);
    }
 
    if (mr->StorageId) {
       bsnprintf(buf, sizeof(buf), "AND StorageId=%s ", edit_uint64(mr->StorageId, ed1));
-      pm_strcat(mdb->cmd, buf);
+      pm_strcat(cmd, buf);
    }
 
    if (mr->PoolId) {
       bsnprintf(buf, sizeof(buf), "AND PoolId=%s ", edit_uint64(mr->PoolId, ed1));
-      pm_strcat(mdb->cmd, buf);
+      pm_strcat(cmd, buf);
    }
 
    if (mr->VolBytes) {
       bsnprintf(buf, sizeof(buf), "AND VolBytes > %s ", edit_uint64(mr->VolBytes, ed1));
-      pm_strcat(mdb->cmd, buf);
+      pm_strcat(cmd, buf);
    }
 
    if (*mr->VolumeName) {
-      db_escape_string(jcr, mdb, esc, mr->VolumeName, strlen(mr->VolumeName));
+      bdb_escape_string(jcr, esc, mr->VolumeName, strlen(mr->VolumeName));
       bsnprintf(buf, sizeof(buf), "AND VolumeName = '%s' ", esc);
-      pm_strcat(mdb->cmd, buf);
+      pm_strcat(cmd, buf);
    }
 
    if (*mr->VolStatus) {
-      db_escape_string(jcr, mdb, esc, mr->VolStatus, strlen(mr->VolStatus));
+      bdb_escape_string(jcr, esc, mr->VolStatus, strlen(mr->VolStatus));
       bsnprintf(buf, sizeof(buf), "AND VolStatus = '%s' ", esc);
-      pm_strcat(mdb->cmd, buf);
+      pm_strcat(cmd, buf);
    }
 
-   Dmsg1(100, "q=%s\n", mdb->cmd);
+   Dmsg1(100, "q=%s\n", cmd);
 
-   if (QUERY_DB(jcr, mdb, mdb->cmd)) {
-      *num_ids = sql_num_rows(mdb);
+   if (QueryDB(jcr, cmd)) {
+      *num_ids = sql_num_rows();
       if (*num_ids > 0) {
          id = (uint32_t *)malloc(*num_ids * sizeof(uint32_t));
-         while ((row = sql_fetch_row(mdb)) != NULL) {
+         while ((row = sql_fetch_row()) != NULL) {
             id[i++] = str_to_uint64(row[0]);
          }
          *ids = id;
       }
-      sql_free_result(mdb);
+      sql_free_result();
       ok = true;
    } else {
-      Mmsg(mdb->errmsg, _("Media id select failed: ERR=%s\n"), sql_strerror(mdb));
-      Jmsg(jcr, M_ERROR, 0, "%s", mdb->errmsg);
+      Mmsg(errmsg, _("Media id select failed: ERR=%s\n"), sql_strerror());
+      Jmsg(jcr, M_ERROR, 0, "%s", errmsg);
       ok = false;
    }
-   db_unlock(mdb);
+   bdb_unlock();
    return ok;
 }
 
@@ -956,33 +1056,33 @@ bool db_get_media_ids(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr, int *num_ids, uint32_t
  *  Returns false: on failure
  *          true:  on success
  */
-bool db_get_query_dbids(JCR *jcr, B_DB *mdb, POOL_MEM &query, dbid_list &ids)
+bool BDB::bdb_get_query_dbids(JCR *jcr, POOL_MEM &query, dbid_list &ids)
 {
    SQL_ROW row;
    int i = 0;
    bool ok = false;
 
-   db_lock(mdb);
+   bdb_lock();
    ids.num_ids = 0;
-   if (QUERY_DB(jcr, mdb, query.c_str())) {
-      ids.num_ids = sql_num_rows(mdb);
+   if (QueryDB(jcr, query.c_str())) {
+      ids.num_ids = sql_num_rows();
       if (ids.num_ids > 0) {
          if (ids.max_ids < ids.num_ids) {
             free(ids.DBId);
             ids.DBId = (DBId_t *)malloc(ids.num_ids * sizeof(DBId_t));
          }
-         while ((row = sql_fetch_row(mdb)) != NULL) {
+         while ((row = sql_fetch_row()) != NULL) {
             ids.DBId[i++] = str_to_uint64(row[0]);
          }
       }
-      sql_free_result(mdb);
+      sql_free_result();
       ok = true;
    } else {
-      Mmsg(mdb->errmsg, _("query dbids failed: ERR=%s\n"), sql_strerror(mdb));
-      Jmsg(jcr, M_ERROR, 0, "%s", mdb->errmsg);
+      Mmsg(errmsg, _("query dbids failed: ERR=%s\n"), sql_strerror());
+      Jmsg(jcr, M_ERROR, 0, "%s", errmsg);
       ok = false;
    }
-   db_unlock(mdb);
+   bdb_unlock();
    return ok;
 }
 
@@ -992,24 +1092,23 @@ bool db_get_query_dbids(JCR *jcr, B_DB *mdb, POOL_MEM &query, dbid_list &ids)
  * Returns: false: on failure
  *          true:  on success
  */
-bool db_get_media_record(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr)
+bool BDB::bdb_get_media_record(JCR *jcr, MEDIA_DBR *mr)
 {
    SQL_ROW row;
    char ed1[50];
    bool ok = false;
-   int num_rows;
    char esc[MAX_ESCAPE_NAME_LENGTH];
 
-   db_lock(mdb);
+   bdb_lock();
    if (mr->MediaId == 0 && mr->VolumeName[0] == 0) {
-      Mmsg(mdb->cmd, "SELECT count(*) from Media");
-      mr->MediaId = get_sql_record_max(jcr, mdb);
-      db_unlock(mdb);
+      Mmsg(cmd, "SELECT count(*) from Media");
+      mr->MediaId = get_sql_record_max(jcr, this);
+      bdb_unlock();
       return true;
    }
    if (mr->MediaId != 0) {               /* find by id */
-      Mmsg(mdb->cmd, "SELECT MediaId,VolumeName,VolJobs,VolFiles,"
-         "VolBlocks,VolBytes,VolMounts,"
+      Mmsg(cmd, "SELECT MediaId,VolumeName,VolJobs,VolFiles,"
+         "VolBlocks,VolBytes,VolABytes,VolHoleBytes,VolHoles,VolMounts,"
          "VolErrors,VolWrites,MaxVolBytes,VolCapacityBytes,"
          "MediaType,VolStatus,PoolId,VolRetention,VolUseDuration,MaxVolJobs,"
          "MaxVolFiles,Recycle,Slot,FirstWritten,LastWritten,InChanger,"
@@ -1019,9 +1118,9 @@ bool db_get_media_record(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr)
          "FROM Media WHERE MediaId=%s",
          edit_int64(mr->MediaId, ed1));
    } else {                           /* find by name */
-      mdb->db_escape_string(jcr, esc, mr->VolumeName, strlen(mr->VolumeName));
-      Mmsg(mdb->cmd, "SELECT MediaId,VolumeName,VolJobs,VolFiles,"
-         "VolBlocks,VolBytes,VolMounts,"
+      bdb_escape_string(jcr, esc, mr->VolumeName, strlen(mr->VolumeName));
+      Mmsg(cmd, "SELECT MediaId,VolumeName,VolJobs,VolFiles,"
+         "VolBlocks,VolBytes,VolABytes,VolHoleBytes,VolHoles,VolMounts,"
          "VolErrors,VolWrites,MaxVolBytes,VolCapacityBytes,"
          "MediaType,VolStatus,PoolId,VolRetention,VolUseDuration,MaxVolJobs,"
          "MaxVolFiles,Recycle,Slot,FirstWritten,LastWritten,InChanger,"
@@ -1031,17 +1130,16 @@ bool db_get_media_record(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr)
          "FROM Media WHERE VolumeName='%s'", esc);
    }
 
-   if (QUERY_DB(jcr, mdb, mdb->cmd)) {
+   if (QueryDB(jcr, cmd)) {
       char ed1[50];
-      num_rows = sql_num_rows(mdb);
-      if (num_rows > 1) {
-         Mmsg1(mdb->errmsg, _("More than one Volume!: %s\n"),
-            edit_uint64(num_rows, ed1));
-         Jmsg(jcr, M_ERROR, 0, "%s", mdb->errmsg);
-      } else if (num_rows == 1) {
-         if ((row = sql_fetch_row(mdb)) == NULL) {
-            Mmsg1(mdb->errmsg, _("error fetching row: %s\n"), sql_strerror(mdb));
-            Jmsg(jcr, M_ERROR, 0, "%s", mdb->errmsg);
+      if (sql_num_rows() > 1) {
+         Mmsg1(errmsg, _("More than one Volume!: %s\n"),
+            edit_uint64(sql_num_rows(), ed1));
+         Jmsg(jcr, M_ERROR, 0, "%s", errmsg);
+      } else if (sql_num_rows() == 1) {
+         if ((row = sql_fetch_row()) == NULL) {
+            Mmsg1(errmsg, _("error fetching row: %s\n"), sql_strerror());
+            Jmsg(jcr, M_ERROR, 0, "%s", errmsg);
          } else {
             /* return values */
             mr->MediaId = str_to_int64(row[0]);
@@ -1050,64 +1148,67 @@ bool db_get_media_record(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr)
             mr->VolFiles = str_to_int64(row[3]);
             mr->VolBlocks = str_to_int64(row[4]);
             mr->VolBytes = str_to_uint64(row[5]);
-            mr->VolMounts = str_to_int64(row[6]);
-            mr->VolErrors = str_to_int64(row[7]);
-            mr->VolWrites = str_to_int64(row[8]);
-            mr->MaxVolBytes = str_to_uint64(row[9]);
-            mr->VolCapacityBytes = str_to_uint64(row[10]);
-            bstrncpy(mr->MediaType, row[11]!=NULL?row[11]:"", sizeof(mr->MediaType));
-            bstrncpy(mr->VolStatus, row[12]!=NULL?row[12]:"", sizeof(mr->VolStatus));
-            mr->PoolId = str_to_int64(row[13]);
-            mr->VolRetention = str_to_uint64(row[14]);
-            mr->VolUseDuration = str_to_uint64(row[15]);
-            mr->MaxVolJobs = str_to_int64(row[16]);
-            mr->MaxVolFiles = str_to_int64(row[17]);
-            mr->Recycle = str_to_int64(row[18]);
-            mr->Slot = str_to_int64(row[19]);
-            bstrncpy(mr->cFirstWritten, row[20]!=NULL?row[20]:"", sizeof(mr->cFirstWritten));
+            mr->VolABytes = str_to_uint64(row[6]);
+            mr->VolHoleBytes = str_to_uint64(row[7]);
+            mr->VolHoles = str_to_int64(row[8]);
+            mr->VolMounts = str_to_int64(row[9]);
+            mr->VolErrors = str_to_int64(row[10]);
+            mr->VolWrites = str_to_int64(row[11]);
+            mr->MaxVolBytes = str_to_uint64(row[12]);
+            mr->VolCapacityBytes = str_to_uint64(row[13]);
+            bstrncpy(mr->MediaType, row[14]!=NULL?row[14]:"", sizeof(mr->MediaType));
+            bstrncpy(mr->VolStatus, row[15]!=NULL?row[15]:"", sizeof(mr->VolStatus));
+            mr->PoolId = str_to_int64(row[16]);
+            mr->VolRetention = str_to_uint64(row[17]);
+            mr->VolUseDuration = str_to_uint64(row[18]);
+            mr->MaxVolJobs = str_to_int64(row[19]);
+            mr->MaxVolFiles = str_to_int64(row[20]);
+            mr->Recycle = str_to_int64(row[21]);
+            mr->Slot = str_to_int64(row[22]);
+            bstrncpy(mr->cFirstWritten, row[23]!=NULL?row[23]:"", sizeof(mr->cFirstWritten));
             mr->FirstWritten = (time_t)str_to_utime(mr->cFirstWritten);
-            bstrncpy(mr->cLastWritten, row[21]!=NULL?row[21]:"", sizeof(mr->cLastWritten));
+            bstrncpy(mr->cLastWritten, row[24]!=NULL?row[24]:"", sizeof(mr->cLastWritten));
             mr->LastWritten = (time_t)str_to_utime(mr->cLastWritten);
-            mr->InChanger = str_to_uint64(row[22]);
-            mr->EndFile = str_to_uint64(row[23]);
-            mr->EndBlock = str_to_uint64(row[24]);
-            mr->VolParts = str_to_int64(row[25]);
-            mr->LabelType = str_to_int64(row[26]);
-            bstrncpy(mr->cLabelDate, row[27]!=NULL?row[27]:"", sizeof(mr->cLabelDate));
+            mr->InChanger = str_to_uint64(row[25]);
+            mr->EndFile = str_to_uint64(row[26]);
+            mr->EndBlock = str_to_uint64(row[27]);
+            mr->VolType = str_to_int64(row[28]);   /* formerly VolParts */
+            mr->LabelType = str_to_int64(row[29]);
+            bstrncpy(mr->cLabelDate, row[30]!=NULL?row[30]:"", sizeof(mr->cLabelDate));
             mr->LabelDate = (time_t)str_to_utime(mr->cLabelDate);
-            mr->StorageId = str_to_int64(row[28]);
-            mr->Enabled = str_to_int64(row[29]);
-            mr->LocationId = str_to_int64(row[30]);
-            mr->RecycleCount = str_to_int64(row[31]);
-            bstrncpy(mr->cInitialWrite, row[32]!=NULL?row[32]:"", sizeof(mr->cInitialWrite));
+            mr->StorageId = str_to_int64(row[31]);
+            mr->Enabled = str_to_int64(row[32]);
+            mr->LocationId = str_to_int64(row[33]);
+            mr->RecycleCount = str_to_int64(row[34]);
+            bstrncpy(mr->cInitialWrite, row[35]!=NULL?row[35]:"", sizeof(mr->cInitialWrite));
             mr->InitialWrite = (time_t)str_to_utime(mr->cInitialWrite);
-            mr->ScratchPoolId = str_to_int64(row[33]);
-            mr->RecyclePoolId = str_to_int64(row[34]);
-            mr->VolReadTime = str_to_int64(row[35]);
-            mr->VolWriteTime = str_to_int64(row[36]);
-            mr->ActionOnPurge = str_to_int32(row[37]);
+            mr->ScratchPoolId = str_to_int64(row[36]);
+            mr->RecyclePoolId = str_to_int64(row[37]);
+            mr->VolReadTime = str_to_int64(row[38]);
+            mr->VolWriteTime = str_to_int64(row[39]);
+            mr->ActionOnPurge = str_to_int32(row[40]);
 
             ok = true;
          }
       } else {
          if (mr->MediaId != 0) {
-            Mmsg1(mdb->errmsg, _("Media record MediaId=%s not found.\n"),
+            Mmsg1(errmsg, _("Media record with MediaId=%s not found.\n"),
                edit_int64(mr->MediaId, ed1));
          } else {
-            Mmsg1(mdb->errmsg, _("Media record for Volume \"%s\" not found.\n"),
+            Mmsg1(errmsg, _("Media record for Volume name \"%s\" not found.\n"),
                   mr->VolumeName);
          }
       }
-      sql_free_result(mdb);
+      sql_free_result();
    } else {
       if (mr->MediaId != 0) {
-         Mmsg(mdb->errmsg, _("Media record for MediaId=%u not found in Catalog.\n"),
+         Mmsg(errmsg, _("Media record for MediaId=%u not found in Catalog.\n"),
             mr->MediaId);
        } else {
-         Mmsg(mdb->errmsg, _("Media record for Vol=%s not found in Catalog.\n"),
+         Mmsg(errmsg, _("Media record for Volume Name \"%s\" not found in Catalog.\n"),
             mr->VolumeName);
    }   }
-   db_unlock(mdb);
+   bdb_unlock();
    return ok;
 }
 
@@ -1131,24 +1232,24 @@ static void strip_md5(char *q)
  *
  * TODO: See if we can do the SORT only if needed (as an argument)
  */
-bool db_get_file_list(JCR *jcr, B_DB *mdb, char *jobids,
+bool BDB::bdb_get_file_list(JCR *jcr, char *jobids,
                       bool use_md5, bool use_delta,
                       DB_RESULT_HANDLER *result_handler, void *ctx)
 {
    if (!*jobids) {
-      db_lock(mdb);
-      Mmsg(mdb->errmsg, _("ERR=JobIds are empty\n"));
-      db_unlock(mdb);
+      bdb_lock();
+      Mmsg(errmsg, _("ERR=JobIds are empty\n"));
+      bdb_unlock();
       return false;
    }
    POOL_MEM buf(PM_MESSAGE);
    POOL_MEM buf2(PM_MESSAGE);
    if (use_delta) {
-      Mmsg(buf2, select_recent_version_with_basejob_and_delta[db_get_type_index(mdb)],
+      Mmsg(buf2, select_recent_version_with_basejob_and_delta[bdb_get_type_index()],
            jobids, jobids, jobids, jobids);
 
    } else {
-      Mmsg(buf2, select_recent_version_with_basejob[db_get_type_index(mdb)],
+      Mmsg(buf2, select_recent_version_with_basejob[bdb_get_type_index()],
            jobids, jobids, jobids, jobids);
    }
 
@@ -1172,22 +1273,23 @@ bool db_get_file_list(JCR *jcr, B_DB *mdb, char *jobids,
 
    Dmsg1(100, "q=%s\n", buf.c_str());
 
-   return db_big_sql_query(mdb, buf.c_str(), result_handler, ctx);
+   return bdb_big_sql_query(buf.c_str(), result_handler, ctx);
 }
 
 /**
  * This procedure gets the base jobid list used by jobids,
  */
-bool db_get_used_base_jobids(JCR *jcr, B_DB *mdb,
+bool BDB::bdb_get_used_base_jobids(JCR *jcr,
                              POOLMEM *jobids, db_list_ctx *result)
 {
    POOL_MEM buf;
+
    Mmsg(buf,
  "SELECT DISTINCT BaseJobId "
  "  FROM Job JOIN BaseFiles USING (JobId) "
  " WHERE Job.HasBase = 1 "
  "   AND Job.JobId IN (%s) ", jobids);
-   return db_sql_query(mdb, buf.c_str(), db_list_handler, result);
+   return bdb_sql_query(buf.c_str(), db_list_handler, result);
 }
 
 /**
@@ -1201,7 +1303,7 @@ bool db_get_used_base_jobids(JCR *jcr, B_DB *mdb,
  *
  * TODO: look and merge from ua_restore.c
  */
-bool db_accurate_get_jobids(JCR *jcr, B_DB *mdb,
+bool BDB::bdb_get_accurate_jobids(JCR *jcr,
                             JOB_DBR *jr, db_list_ctx *jobids)
 {
    bool ret=false;
@@ -1216,13 +1318,13 @@ bool db_accurate_get_jobids(JCR *jcr, B_DB *mdb,
    jobids->reset();
 
    /* First, find the last good Full backup for this job/client/fileset */
-   Mmsg(query, create_temp_accurate_jobids[db_get_type_index(mdb)],
+   Mmsg(query, create_temp_accurate_jobids[bdb_get_type_index()],
         edit_uint64(jcr->JobId, jobid),
         edit_uint64(jr->ClientId, clientid),
         date,
         edit_uint64(jr->FileSetId, filesetid));
 
-   if (!db_sql_query(mdb, query.c_str(), NULL, NULL)) {
+   if (!bdb_sql_query(query.c_str(), NULL, NULL)) {
       goto bail_out;
    }
 
@@ -1244,7 +1346,7 @@ bool db_accurate_get_jobids(JCR *jcr, B_DB *mdb,
            date,
            filesetid);
 
-      if (!db_sql_query(mdb, query.c_str(), NULL, NULL)) {
+      if (!bdb_sql_query(query.c_str(), NULL, NULL)) {
          goto bail_out;
       }
 
@@ -1264,25 +1366,25 @@ bool db_accurate_get_jobids(JCR *jcr, B_DB *mdb,
            jobid,
            date,
            filesetid);
-      if (!db_sql_query(mdb, query.c_str(), NULL, NULL)) {
+      if (!bdb_sql_query(query.c_str(), NULL, NULL)) {
          goto bail_out;
       }
    }
 
    /* build a jobid list ie: 1,2,3,4 */
    Mmsg(query, "SELECT JobId FROM btemp3%s ORDER by JobTDate", jobid);
-   db_sql_query(mdb, query.c_str(), db_list_handler, jobids);
-   Dmsg1(1, "db_accurate_get_jobids=%s\n", jobids->list);
+   bdb_sql_query(query.c_str(), db_list_handler, jobids);
+   Dmsg1(1, "db_get_accurate_jobids=%s\n", jobids->list);
    ret = true;
 
 bail_out:
    Mmsg(query, "DROP TABLE btemp3%s", jobid);
-   db_sql_query(mdb, query.c_str(), NULL, NULL);
+   bdb_sql_query(query.c_str(), NULL, NULL);
 
    return ret;
 }
 
-bool db_get_base_file_list(JCR *jcr, B_DB *mdb, bool use_md5,
+bool BDB::bdb_get_base_file_list(JCR *jcr, bool use_md5,
                            DB_RESULT_HANDLER *result_handler, void *ctx)
 {
    POOL_MEM buf(PM_MESSAGE);
@@ -1295,25 +1397,25 @@ bool db_get_base_file_list(JCR *jcr, B_DB *mdb, bool use_md5,
    if (!use_md5) {
       strip_md5(buf.c_str());
    }
-   return db_sql_query(mdb, buf.c_str(), result_handler, ctx);
+   return bdb_sql_query(buf.c_str(), result_handler, ctx);
 }
 
-bool db_get_base_jobid(JCR *jcr, B_DB *mdb, JOB_DBR *jr, JobId_t *jobid)
+bool BDB::bdb_get_base_jobid(JCR *jcr, JOB_DBR *jr, JobId_t *jobid)
 {
    POOL_MEM query(PM_FNAME);
    utime_t StartTime;
    db_int64_ctx lctx;
    char date[MAX_TIME_LENGTH];
    char esc[MAX_ESCAPE_NAME_LENGTH];
-   bool ret=false;
-// char clientid[50], filesetid[50];
+   bool ret = false;
+
    *jobid = 0;
    lctx.count = 0;
    lctx.value = 0;
 
    StartTime = (jr->StartTime)?jr->StartTime:time(NULL);
    bstrutime(date, sizeof(date),  StartTime + 1);
-   mdb->db_escape_string(jcr, esc, jr->Name, strlen(jr->Name));
+   bdb_escape_string(jcr, esc, jr->Name, strlen(jr->Name));
 
    /* we can take also client name, fileset, etc... */
 
@@ -1333,7 +1435,7 @@ bool db_get_base_jobid(JCR *jcr, B_DB *mdb, JOB_DBR *jr, JobId_t *jobid)
         date);
 
    Dmsg1(10, "db_get_base_jobid q=%s\n", query.c_str());
-   if (!db_sql_query(mdb, query.c_str(), db_int64_handler, &lctx)) {
+   if (!bdb_sql_query(query.c_str(), db_int64_handler, &lctx)) {
       goto bail_out;
    }
    *jobid = (JobId_t) lctx.value;
@@ -1346,18 +1448,112 @@ bail_out:
 }
 
 /* Get JobIds associated with a volume */
-bool db_get_volume_jobids(JCR *jcr, B_DB *mdb,
+bool BDB::bdb_get_volume_jobids(JCR *jcr,
                          MEDIA_DBR *mr, db_list_ctx *lst)
 {
    char ed1[50];
-   bool ret=false;
+   bool ret = false;
 
-   db_lock(mdb);
-   Mmsg(mdb->cmd, "SELECT DISTINCT JobId FROM JobMedia WHERE MediaId=%s",
+   bdb_lock();
+   Mmsg(cmd, "SELECT DISTINCT JobId FROM JobMedia WHERE MediaId=%s",
         edit_int64(mr->MediaId, ed1));
-   ret = db_sql_query(mdb, mdb->cmd, db_list_handler, lst);
-   db_unlock(mdb);
+   ret = bdb_sql_query(cmd, db_list_handler, lst);
+   bdb_unlock();
    return ret;
 }
 
+/**
+ * Get Snapshot Record
+ *
+ * Returns: false: on failure
+ *          true:  on success
+ */
+bool BDB::bdb_get_snapshot_record(JCR *jcr, SNAPSHOT_DBR *sr)
+{
+   SQL_ROW row;
+   char ed1[50];
+   bool ok = false;
+   char esc[MAX_ESCAPE_NAME_LENGTH];
+   POOL_MEM filter1, filter2;
+
+   if (sr->SnapshotId == 0 && (sr->Name[0] == 0 || sr->Device[0] == 0)) {
+      Dmsg0(10, "No SnapshotId or Name/Device provided\n");
+      return false;
+   }
+
+   bdb_lock();
+
+   if (sr->SnapshotId != 0) {               /* find by id */
+      Mmsg(filter1, "Snapshot.SnapshotId=%d", sr->SnapshotId);
+
+   } else if (*sr->Name && *sr->Device) { /* find by name */
+      bdb_escape_string(jcr, esc, sr->Name, strlen(sr->Name));
+      Mmsg(filter1, "Snapshot.Name='%s'", esc);
+      bdb_escape_string(jcr, esc, sr->Device, strlen(sr->Device));
+      Mmsg(filter2, "AND Snapshot.Device='%s'", esc);
+
+   } else {
+      Dmsg0(10, "No SnapshotId or Name and Device\n");
+      return false;
+   }
+
+   Mmsg(cmd, "SELECT SnapshotId, Snapshot.Name, JobId, Snapshot.FileSetId, "
+        "FileSet.FileSet, CreateTDate, CreateDate, "
+        "Client.Name AS Client, Snapshot.ClientId, Volume, Device, Type, Retention, "
+        "Comment FROM Snapshot JOIN Client USING (ClientId) LEFT JOIN FileSet USING (FileSetId) WHERE %s %s",
+        filter1.c_str(), filter2.c_str());
+
+   if (QueryDB(jcr, cmd)) {
+      char ed1[50];
+      if (sql_num_rows() > 1) {
+         Mmsg1(errmsg, _("More than one Snapshot!: %s\n"),
+            edit_uint64(sql_num_rows(), ed1));
+         Jmsg(jcr, M_ERROR, 0, "%s", errmsg);
+      } else if (sql_num_rows() == 1) {
+         if ((row = sql_fetch_row()) == NULL) {
+            Mmsg1(errmsg, _("error fetching row: %s\n"), sql_strerror());
+            Jmsg(jcr, M_ERROR, 0, "%s", errmsg);
+         } else {
+            /* return values */
+            sr->reset();
+            sr->need_to_free = true;
+            sr->SnapshotId = str_to_int64(row[0]);
+            bstrncpy(sr->Name, row[1], sizeof(sr->Name));
+            sr->JobId = str_to_int64(row[2]);
+            sr->FileSetId = str_to_int64(row[3]);
+            bstrncpy(sr->FileSet, row[4], sizeof(sr->FileSet));
+            sr->CreateTDate = str_to_uint64(row[5]);
+            bstrncpy(sr->CreateDate, row[6], sizeof(sr->CreateDate));
+            bstrncpy(sr->Client, row[7], sizeof(sr->Client));
+            sr->ClientId = str_to_int64(row[8]);
+            sr->Volume = bstrdup(row[9]);
+            sr->Device = bstrdup(row[10]);
+            bstrncpy(sr->Type, row[11], sizeof(sr->Type));
+            sr->Retention = str_to_int64(row[12]);
+            bstrncpy(sr->Comment, NPRTB(row[13]), sizeof(sr->Comment));
+            ok = true;
+         }
+      } else {
+         if (sr->SnapshotId != 0) {
+            Mmsg1(errmsg, _("Snapshot record with SnapshotId=%s not found.\n"),
+               edit_int64(sr->SnapshotId, ed1));
+         } else {
+            Mmsg1(errmsg, _("Snapshot record for Snapshot name \"%s\" not found.\n"),
+                  sr->Name);
+         }
+      }
+      sql_free_result();
+   } else {
+      if (sr->SnapshotId != 0) {
+         Mmsg1(errmsg, _("Snapshot record with SnapshotId=%s not found.\n"),
+               edit_int64(sr->SnapshotId, ed1));
+      } else {
+         Mmsg1(errmsg, _("Snapshot record for Snapshot name \"%s\" not found.\n"),
+                  sr->Name);
+      }
+   }
+   bdb_unlock();
+   return ok;
+}
+
 #endif /* HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL */
diff --git a/src/cats/sql_glue.c b/src/cats/sql_glue.c
deleted file mode 100644
index 3607eb0..0000000
--- a/src/cats/sql_glue.c
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
-   Bacula® - The Network Backup Solution
-
-   Copyright (C) 2009-2014 Free Software Foundation Europe e.V.
-
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
-
-   You may use this file and others of this release according to the
-   license defined in the LICENSE file, which includes the Affero General
-   Public License, v3.0 ("AGPLv3") and some additional permissions and
-   terms pursuant to its AGPLv3 Section 7.
-
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
-/*
- * Bacula Glue code for the catalog refactoring.
- *
- * Written by Marco van Wieringen, November 2009
- */
-
-#include "bacula.h"
-
-#if HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL
-
-#include "cats.h"
-#include "bdb_priv.h"
-#include "sql_glue.h"
-
-/* -----------------------------------------------------------------------
- *
- *   Generic Glue Routines
- *
- * -----------------------------------------------------------------------
- */
-bool db_match_database(B_DB *mdb, const char *db_driver, const char *db_name,
-                       const char *db_address, int db_port)
-{
-   return mdb->db_match_database(db_driver, db_name, db_address, db_port);
-}
-
-B_DB *db_clone_database_connection(B_DB *mdb, JCR *jcr, bool mult_db_connections)
-{
-   return mdb->db_clone_database_connection(jcr, mult_db_connections);
-}
-
-const char *db_get_type(B_DB *mdb)
-{
-   return mdb->db_get_type();
-}
-
-int db_get_type_index(B_DB *mdb)
-{
-   return mdb->db_get_type_index();
-}
-
-bool db_open_database(JCR *jcr, B_DB *mdb)
-{
-   return mdb->db_open_database(jcr);
-}
-
-void db_close_database(JCR *jcr, B_DB *mdb)
-{
-   if (mdb) {
-      mdb->db_close_database(jcr);
-   }
-}
-
-void db_thread_cleanup(B_DB *mdb)
-{
-   mdb->db_thread_cleanup();
-}
-
-void db_escape_string(JCR *jcr, B_DB *mdb, char *snew, char *old, int len)
-{
-   mdb->db_escape_string(jcr, snew, old, len);
-}
-
-char *db_escape_object(JCR *jcr, B_DB *mdb, char *old, int len)
-{
-   return mdb->db_escape_object(jcr, old, len);
-}
-
-void db_unescape_object(JCR *jcr, B_DB *mdb,
-                        char *from, int32_t expected_len,
-                        POOLMEM **dest, int32_t *len)
-{
-   mdb->db_unescape_object(jcr, from, expected_len, dest, len);
-}
-
-void db_start_transaction(JCR *jcr, B_DB *mdb)
-{
-   mdb->db_start_transaction(jcr);
-}
-
-void db_end_transaction(JCR *jcr, B_DB *mdb)
-{
-   mdb->db_end_transaction(jcr);
-}
-
-bool db_sql_query(B_DB *mdb, const char *query, int flags)
-{
-   mdb->errmsg[0] = 0;
-   return mdb->db_sql_query(query, flags);
-}
-
-bool db_sql_query(B_DB *mdb, const char *query, DB_RESULT_HANDLER *result_handler, void *ctx)
-{
-   mdb->errmsg[0] = 0;
-   return mdb->db_sql_query(query, result_handler, ctx);
-}
-
-bool db_big_sql_query(B_DB *mdb, const char *query, DB_RESULT_HANDLER *result_handler, void *ctx)
-{
-   mdb->errmsg[0] = 0;
-   return mdb->db_big_sql_query(query, result_handler, ctx);
-}
-
-void sql_free_result(B_DB *mdb)
-{
-   ((B_DB_PRIV *)mdb)->sql_free_result();
-}
-
-SQL_ROW sql_fetch_row(B_DB *mdb)
-{
-   return ((B_DB_PRIV *)mdb)->sql_fetch_row();
-}
-
-bool sql_query(B_DB *mdb, const char *query, int flags)
-{
-   mdb->errmsg[0] = 0;
-   return ((B_DB_PRIV *)mdb)->sql_query(query, flags);
-}
-
-const char *sql_strerror(B_DB *mdb)
-{
-   return ((B_DB_PRIV *)mdb)->sql_strerror();
-}
-
-int sql_num_rows(B_DB *mdb)
-{
-   return ((B_DB_PRIV *)mdb)->sql_num_rows();
-}
-
-void sql_data_seek(B_DB *mdb, int row)
-{
-   ((B_DB_PRIV *)mdb)->sql_data_seek(row);
-}
-
-int sql_affected_rows(B_DB *mdb)
-{
-   return ((B_DB_PRIV *)mdb)->sql_affected_rows();
-}
-
-uint64_t sql_insert_autokey_record(B_DB *mdb, const char *query, const char *table_name)
-{
-   return ((B_DB_PRIV *)mdb)->sql_insert_autokey_record(query, table_name);
-}
-
-void sql_field_seek(B_DB *mdb, int field)
-{
-   ((B_DB_PRIV *)mdb)->sql_field_seek(field);
-}
-
-SQL_FIELD *sql_fetch_field(B_DB *mdb)
-{
-   return ((B_DB_PRIV *)mdb)->sql_fetch_field();
-}
-
-int sql_num_fields(B_DB *mdb)
-{
-   return ((B_DB_PRIV *)mdb)->sql_num_fields();
-}
-
-bool sql_field_is_not_null(B_DB *mdb, int field_type)
-{
-   return ((B_DB_PRIV *)mdb)->sql_field_is_not_null(field_type);
-}
-
-bool sql_field_is_numeric(B_DB *mdb, int field_type)
-{
-   return ((B_DB_PRIV *)mdb)->sql_field_is_numeric(field_type);
-}
-
-bool sql_batch_start(JCR *jcr, B_DB *mdb)
-{
-   return ((B_DB_PRIV *)mdb)->sql_batch_start(jcr);
-}
-
-bool sql_batch_end(JCR *jcr, B_DB *mdb, const char *error)
-{
-   return ((B_DB_PRIV *)mdb)->sql_batch_end(jcr, error);
-}
-
-bool sql_batch_insert(JCR *jcr, B_DB *mdb, ATTR_DBR *ar)
-{
-   return ((B_DB_PRIV *)mdb)->sql_batch_insert(jcr, ar);
-}
-
-#endif /* HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL */
diff --git a/src/cats/sql_glue.h b/src/cats/sql_glue.h
deleted file mode 100644
index 3ae685a..0000000
--- a/src/cats/sql_glue.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
-   Bacula® - The Network Backup Solution
-
-   Copyright (C) 2009-2014 Free Software Foundation Europe e.V.
-
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
-
-   You may use this file and others of this release according to the
-   license defined in the LICENSE file, which includes the Affero General
-   Public License, v3.0 ("AGPLv3") and some additional permissions and
-   terms pursuant to its AGPLv3 Section 7.
-
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
-#ifndef __SQL_GLUE_H_
-#define __SQL_GLUE_H_ 1
-
-/*
- * Prototypes for entry points into the different backends.
- */
-bool db_match_database(B_DB *mdb, const char *db_driver, const char *db_name,
-                       const char *db_address, int db_port);
-B_DB *db_clone_database_connection(B_DB *mdb, JCR *jcr, bool mult_db_connections);
-int db_get_type_index(B_DB *mdb);
-const char *db_get_type(B_DB *mdb);
-B_DB *db_init_database(JCR *jcr, const char *db_driver, const char *db_name,
-              const char *db_user, const char *db_password,
-              const char *db_address, int db_port,
-              const char *db_socket, bool mult_db_connections, bool disable_batch_insert);
-bool db_open_database(JCR *jcr, B_DB *mdb);
-void db_close_database(JCR *jcr, B_DB *mdb);
-void db_thread_cleanup(B_DB *mdb);
-void db_escape_string(JCR *jcr, B_DB *mdb, char *snew, char *old, int len);
-char *db_escape_object(JCR *jcr, B_DB *mdb, char *old, int len);
-void db_unescape_object(JCR *jcr, B_DB *mdb,
-                        char *from, int32_t expected_len,
-                        POOLMEM **dest, int32_t *len);
-void db_start_transaction(JCR *jcr, B_DB *mdb);
-void db_end_transaction(JCR *jcr, B_DB *mdb);
-bool db_sql_query(B_DB *mdb, const char *query, int flags=0);
-bool db_sql_query(B_DB *mdb, const char *query, DB_RESULT_HANDLER *result_handler, void *ctx);
-bool db_big_sql_query(B_DB *mdb, const char *query, DB_RESULT_HANDLER *result_handler, void *ctx);
-
-#ifdef _BDB_PRIV_INTERFACE_
-void sql_free_result(B_DB *mdb);
-SQL_ROW sql_fetch_row(B_DB *mdb);
-bool sql_query(B_DB *mdb, const char *query, int flags=0);
-const char *sql_strerror(B_DB *mdb);
-int sql_num_rows(B_DB *mdb);
-void sql_data_seek(B_DB *mdb, int row);
-int sql_affected_rows(B_DB *mdb);
-uint64_t sql_insert_autokey_record(B_DB *mdb, const char *query, const char *table_name);
-void sql_field_seek(B_DB *mdb, int field);
-SQL_FIELD *sql_fetch_field(B_DB *mdb);
-int sql_num_fields(B_DB *mdb);
-bool sql_field_is_not_null(B_DB *mdb, int field_type);
-bool sql_field_is_numeric(B_DB *mdb, int field_type);
-bool sql_batch_start(JCR *jcr, B_DB *mdb);
-bool sql_batch_end(JCR *jcr, B_DB *mdb, const char *error);
-bool sql_batch_insert(JCR *jcr, B_DB *mdb, ATTR_DBR *ar);
-#endif /* _BDB_PRIV_INTERFACE_ */
-#endif /* __SQL_GLUE_H_ */
diff --git a/src/cats/sql_list.c b/src/cats/sql_list.c
index 9cd86bb..9f237e5 100644
--- a/src/cats/sql_list.c
+++ b/src/cats/sql_list.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Bacula Catalog Database List records interface routines
@@ -20,13 +24,11 @@
  *
  */
 
-#include "bacula.h"
+#include  "bacula.h"
 
 #if HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL
 
-#include "cats.h"
-#include "bdb_priv.h"
-#include "sql_glue.h"
+#include  "cats.h"
 
 /* -----------------------------------------------------------------------
  *
@@ -38,43 +40,42 @@
 /*
  * Submit general SQL query
  */
-int db_list_sql_query(JCR *jcr, B_DB *mdb, const char *query, DB_LIST_HANDLER *sendit,
+int BDB::bdb_list_sql_query(JCR *jcr, const char *query, DB_LIST_HANDLER *sendit,
                       void *ctx, int verbose, e_list_type type)
 {
-   db_lock(mdb);
-   if (!sql_query(mdb, query, QF_STORE_RESULT)) {
-      Mmsg(mdb->errmsg, _("Query failed: %s\n"), sql_strerror(mdb));
+   bdb_lock();
+   if (!sql_query(query, QF_STORE_RESULT)) {
+      Mmsg(errmsg, _("Query failed: %s\n"), sql_strerror());
       if (verbose) {
-         sendit(ctx, mdb->errmsg);
+         sendit(ctx, errmsg);
       }
-      db_unlock(mdb);
+      bdb_unlock();
       return 0;
    }
 
-   list_result(jcr, mdb, sendit, ctx, type);
-   sql_free_result(mdb);
-   db_unlock(mdb);
+   list_result(jcr,this, sendit, ctx, type);
+   sql_free_result();
+   bdb_unlock();
    return 1;
 }
 
-void
-db_list_pool_records(JCR *jcr, B_DB *mdb, POOL_DBR *pdbr,
+void BDB::bdb_list_pool_records(JCR *jcr, POOL_DBR *pdbr,
                      DB_LIST_HANDLER *sendit, void *ctx, e_list_type type)
 {
    char esc[MAX_ESCAPE_NAME_LENGTH];
 
-   db_lock(mdb);
-   mdb->db_escape_string(jcr, esc, pdbr->Name, strlen(pdbr->Name));
+   bdb_lock();
+   bdb_escape_string(jcr, esc, pdbr->Name, strlen(pdbr->Name));
 
    if (type == VERT_LIST) {
       if (pdbr->Name[0] != 0) {
-         Mmsg(mdb->cmd, "SELECT PoolId,Name,NumVols,MaxVols,UseOnce,UseCatalog,"
+         Mmsg(cmd, "SELECT PoolId,Name,NumVols,MaxVols,UseOnce,UseCatalog,"
             "AcceptAnyVolume,VolRetention,VolUseDuration,MaxVolJobs,MaxVolBytes,"
             "AutoPrune,Recycle,PoolType,LabelFormat,Enabled,ScratchPoolId,"
             "RecyclePoolId,LabelType "
             " FROM Pool WHERE Name='%s'", esc);
       } else {
-         Mmsg(mdb->cmd, "SELECT PoolId,Name,NumVols,MaxVols,UseOnce,UseCatalog,"
+         Mmsg(cmd, "SELECT PoolId,Name,NumVols,MaxVols,UseOnce,UseCatalog,"
             "AcceptAnyVolume,VolRetention,VolUseDuration,MaxVolJobs,MaxVolBytes,"
             "AutoPrune,Recycle,PoolType,LabelFormat,Enabled,ScratchPoolId,"
             "RecyclePoolId,LabelType "
@@ -82,82 +83,135 @@ db_list_pool_records(JCR *jcr, B_DB *mdb, POOL_DBR *pdbr,
       }
    } else {
       if (pdbr->Name[0] != 0) {
-         Mmsg(mdb->cmd, "SELECT PoolId,Name,NumVols,MaxVols,PoolType,LabelFormat "
+         Mmsg(cmd, "SELECT PoolId,Name,NumVols,MaxVols,PoolType,LabelFormat "
            "FROM Pool WHERE Name='%s'", esc);
       } else {
-         Mmsg(mdb->cmd, "SELECT PoolId,Name,NumVols,MaxVols,PoolType,LabelFormat "
+         Mmsg(cmd, "SELECT PoolId,Name,NumVols,MaxVols,PoolType,LabelFormat "
            "FROM Pool ORDER BY PoolId");
       }
    }
 
-   if (!QUERY_DB(jcr, mdb, mdb->cmd)) {
-      db_unlock(mdb);
+   if (!QueryDB(jcr, cmd)) {
+      bdb_unlock();
       return;
    }
 
-   list_result(jcr, mdb, sendit, ctx, type);
+   list_result(jcr, this, sendit, ctx, type);
 
-   sql_free_result(mdb);
-   db_unlock(mdb);
+   sql_free_result();
+   bdb_unlock();
 }
 
-void
-db_list_client_records(JCR *jcr, B_DB *mdb, DB_LIST_HANDLER *sendit, void *ctx, e_list_type type)
+void BDB::bdb_list_client_records(JCR *jcr, DB_LIST_HANDLER *sendit, void *ctx, e_list_type type)
 {
-   db_lock(mdb);
+   bdb_lock();
    if (type == VERT_LIST) {
-      Mmsg(mdb->cmd, "SELECT ClientId,Name,Uname,AutoPrune,FileRetention,"
+      Mmsg(cmd, "SELECT ClientId,Name,Uname,AutoPrune,FileRetention,"
          "JobRetention "
          "FROM Client ORDER BY ClientId");
    } else {
-      Mmsg(mdb->cmd, "SELECT ClientId,Name,FileRetention,JobRetention "
+      Mmsg(cmd, "SELECT ClientId,Name,FileRetention,JobRetention "
          "FROM Client ORDER BY ClientId");
    }
 
-   if (!QUERY_DB(jcr, mdb, mdb->cmd)) {
-      db_unlock(mdb);
+   if (!QueryDB(jcr, cmd)) {
+      bdb_unlock();
       return;
    }
 
-   list_result(jcr, mdb, sendit, ctx, type);
+   list_result(jcr, this, sendit, ctx, type);
 
-   sql_free_result(mdb);
-   db_unlock(mdb);
+   sql_free_result();
+   bdb_unlock();
 }
 
+/*
+ * List restore objects
+ *
+ * JobId | JobIds: List RestoreObjects for specific Job(s)
+ * It is possible to specify the ObjectType using FileType field.
+ */
+void BDB::bdb_list_restore_objects(JCR *jcr, ROBJECT_DBR *rr, DB_LIST_HANDLER *sendit, void *ctx, e_list_type type)
+{
+   POOL_MEM filter;
+   char  ed1[50];
+   char *jobid;
+
+   if (rr->JobIds && is_a_number_list(rr->JobIds)) {
+      jobid = rr->JobIds;
+
+   } else if (rr->JobId) {
+      jobid = edit_int64(rr->JobId, ed1);
+
+   } else {
+      return;
+   }
+
+   if (rr->FileType > 0) {
+      Mmsg(filter, "AND ObjectType = %d ", rr->FileType);
+   }
+
+   bdb_lock();
+   if (type == VERT_LIST) {
+      Mmsg(cmd, "SELECT JobId, RestoreObjectId, ObjectName, "
+           "PluginName, ObjectType "
+           "FROM RestoreObject JOIN Job USING (JobId) WHERE JobId IN (%s) %s "
+           "ORDER BY JobTDate ASC, RestoreObjectId",
+           jobid, filter.c_str());
+   } else {
+      Mmsg(cmd, "SELECT JobId, RestoreObjectId, ObjectName, "
+           "PluginName, ObjectType, ObjectLength "
+           "FROM RestoreObject JOIN Job USING (JobId) WHERE JobId IN (%s) %s "
+           "ORDER BY JobTDate ASC, RestoreObjectId",
+           jobid, filter.c_str());
+   }
+
+   if (!QueryDB(jcr, cmd)) {
+      bdb_unlock();
+      return;
+   }
+
+   list_result(jcr, this, sendit, ctx, type);
+
+   sql_free_result();
+   bdb_unlock();
+}
 
 /*
  * If VolumeName is non-zero, list the record for that Volume
  *   otherwise, list the Volumes in the Pool specified by PoolId
  */
-void
-db_list_media_records(JCR *jcr, B_DB *mdb, MEDIA_DBR *mdbr,
+void BDB::bdb_list_media_records(JCR *jcr, MEDIA_DBR *mdbr,
                       DB_LIST_HANDLER *sendit, void *ctx, e_list_type type)
 {
    char ed1[50];
    char esc[MAX_ESCAPE_NAME_LENGTH];
 
-   db_lock(mdb);
-   mdb->db_escape_string(jcr, esc, mdbr->VolumeName, strlen(mdbr->VolumeName));
+   bdb_lock();
+   bdb_escape_string(jcr, esc, mdbr->VolumeName, strlen(mdbr->VolumeName));
 
    if (type == VERT_LIST) {
       if (mdbr->VolumeName[0] != 0) {
-         Mmsg(mdb->cmd, "SELECT MediaId,VolumeName,Slot,PoolId,"
-            "MediaType,FirstWritten,LastWritten,LabelDate,VolJobs,"
-            "VolFiles,VolBlocks,VolMounts,VolBytes,VolErrors,VolWrites,"
+         Mmsg(cmd, "SELECT MediaId,VolumeName,Slot,PoolId,"
+            "MediaType,MediaTypeId,FirstWritten,LastWritten,LabelDate,VolJobs,"
+            "VolFiles,VolBlocks,VolMounts,VolBytes,VolABytes,VolAPadding,"
+            "VolHoleBytes,VolHoles,VolErrors,VolWrites,"
             "VolCapacityBytes,VolStatus,Enabled,Recycle,VolRetention,"
             "VolUseDuration,MaxVolJobs,MaxVolFiles,MaxVolBytes,InChanger,"
             "EndFile,EndBlock,VolParts,LabelType,StorageId,DeviceId,"
+            "MediaAddressing,VolReadTime,VolWriteTime,"
             "LocationId,RecycleCount,InitialWrite,ScratchPoolId,RecyclePoolId, "
             "ActionOnPurge,Comment"
             " FROM Media WHERE Media.VolumeName='%s'", esc);
       } else {
-         Mmsg(mdb->cmd, "SELECT MediaId,VolumeName,Slot,PoolId,"
-            "MediaType,FirstWritten,LastWritten,LabelDate,VolJobs,"
-            "VolFiles,VolBlocks,VolMounts,VolBytes,VolErrors,VolWrites,"
+         Mmsg(cmd, "SELECT MediaId,VolumeName,Slot,PoolId,"
+            "MediaType,MediaTypeId,FirstWritten,LastWritten,LabelDate,VolJobs,"
+            "VolFiles,VolBlocks,VolMounts,VolBytes,VolABytes,VolAPadding,"
+            "VolHoleBytes,VolHoles,VolErrors,VolWrites,"
             "VolCapacityBytes,VolStatus,Enabled,Recycle,VolRetention,"
             "VolUseDuration,MaxVolJobs,MaxVolFiles,MaxVolBytes,InChanger,"
             "EndFile,EndBlock,VolParts,LabelType,StorageId,DeviceId,"
+            "MediaAddressing,VolReadTime,VolWriteTime,"
             "LocationId,RecycleCount,InitialWrite,ScratchPoolId,RecyclePoolId, "
             "ActionOnPurge,Comment"
             " FROM Media WHERE Media.PoolId=%s ORDER BY MediaId",
@@ -165,42 +219,43 @@ db_list_media_records(JCR *jcr, B_DB *mdb, MEDIA_DBR *mdbr,
       }
    } else {
       if (mdbr->VolumeName[0] != 0) {
-         Mmsg(mdb->cmd, "SELECT MediaId,VolumeName,VolStatus,Enabled,"
-            "VolBytes,VolFiles,VolRetention,Recycle,Slot,InChanger,MediaType,LastWritten "
+         Mmsg(cmd, "SELECT MediaId,VolumeName,VolStatus,Enabled,"
+            "VolBytes,VolFiles,VolRetention,Recycle,Slot,InChanger,MediaType,VolParts,LastWritten "
             "FROM Media WHERE Media.VolumeName='%s'", esc);
       } else {
-         Mmsg(mdb->cmd, "SELECT MediaId,VolumeName,VolStatus,Enabled,"
-            "VolBytes,VolFiles,VolRetention,Recycle,Slot,InChanger,MediaType,LastWritten "
+         Mmsg(cmd, "SELECT MediaId,VolumeName,VolStatus,Enabled,"
+            "VolBytes,VolFiles,VolRetention,Recycle,Slot,InChanger,MediaType,VolParts,LastWritten "
             "FROM Media WHERE Media.PoolId=%s ORDER BY MediaId",
             edit_int64(mdbr->PoolId, ed1));
       }
    }
 
-   if (!QUERY_DB(jcr, mdb, mdb->cmd)) {
-      db_unlock(mdb);
+   if (!QueryDB(jcr, cmd)) {
+      bdb_unlock();
       return;
    }
 
-   list_result(jcr, mdb, sendit, ctx, type);
+   list_result(jcr, this, sendit, ctx, type);
 
-   sql_free_result(mdb);
-   db_unlock(mdb);
+   sql_free_result();
+   bdb_unlock();
 }
 
-void db_list_jobmedia_records(JCR *jcr, B_DB *mdb, uint32_t JobId,
+void BDB::bdb_list_jobmedia_records(JCR *jcr, uint32_t JobId,
                               DB_LIST_HANDLER *sendit, void *ctx, e_list_type type)
 {
    char ed1[50];
-   db_lock(mdb);
+
+   bdb_lock();
    if (type == VERT_LIST) {
       if (JobId > 0) {                   /* do by JobId */
-         Mmsg(mdb->cmd, "SELECT JobMediaId,JobId,Media.MediaId,Media.VolumeName,"
+         Mmsg(cmd, "SELECT JobMediaId,JobId,Media.MediaId,Media.VolumeName,"
             "FirstIndex,LastIndex,StartFile,JobMedia.EndFile,StartBlock,"
             "JobMedia.EndBlock "
             "FROM JobMedia,Media WHERE Media.MediaId=JobMedia.MediaId "
             "AND JobMedia.JobId=%s", edit_int64(JobId, ed1));
       } else {
-         Mmsg(mdb->cmd, "SELECT JobMediaId,JobId,Media.MediaId,Media.VolumeName,"
+         Mmsg(cmd, "SELECT JobMediaId,JobId,Media.MediaId,Media.VolumeName,"
             "FirstIndex,LastIndex,StartFile,JobMedia.EndFile,StartBlock,"
             "JobMedia.EndBlock "
             "FROM JobMedia,Media WHERE Media.MediaId=JobMedia.MediaId");
@@ -208,27 +263,27 @@ void db_list_jobmedia_records(JCR *jcr, B_DB *mdb, uint32_t JobId,
 
    } else {
       if (JobId > 0) {                   /* do by JobId */
-         Mmsg(mdb->cmd, "SELECT JobId,Media.VolumeName,FirstIndex,LastIndex "
+         Mmsg(cmd, "SELECT JobId,Media.VolumeName,FirstIndex,LastIndex "
             "FROM JobMedia,Media WHERE Media.MediaId=JobMedia.MediaId "
             "AND JobMedia.JobId=%s", edit_int64(JobId, ed1));
       } else {
-         Mmsg(mdb->cmd, "SELECT JobId,Media.VolumeName,FirstIndex,LastIndex "
+         Mmsg(cmd, "SELECT JobId,Media.VolumeName,FirstIndex,LastIndex "
             "FROM JobMedia,Media WHERE Media.MediaId=JobMedia.MediaId");
       }
    }
-   if (!QUERY_DB(jcr, mdb, mdb->cmd)) {
-      db_unlock(mdb);
+   if (!QueryDB(jcr, cmd)) {
+      bdb_unlock();
       return;
    }
 
-   list_result(jcr, mdb, sendit, ctx, type);
+   list_result(jcr, this, sendit, ctx, type);
 
-   sql_free_result(mdb);
-   db_unlock(mdb);
+   sql_free_result();
+   bdb_unlock();
 }
 
 
-void db_list_copies_records(JCR *jcr, B_DB *mdb, uint32_t limit, char *JobIds,
+void BDB::bdb_list_copies_records(JCR *jcr, uint32_t limit, char *JobIds,
                             DB_LIST_HANDLER *sendit, void *ctx, e_list_type type)
 {
    POOL_MEM str_limit(PM_MESSAGE);
@@ -243,8 +298,8 @@ void db_list_copies_records(JCR *jcr, B_DB *mdb, uint32_t limit, char *JobIds,
            JobIds, JobIds);
    }
 
-   db_lock(mdb);
-   Mmsg(mdb->cmd,
+   bdb_lock();
+   Mmsg(cmd,
    "SELECT DISTINCT Job.PriorJobId AS JobId, Job.Job, "
                    "Job.JobId AS CopyJobId, Media.MediaType "
      "FROM Job "
@@ -253,52 +308,52 @@ void db_list_copies_records(JCR *jcr, B_DB *mdb, uint32_t limit, char *JobIds,
     "WHERE Job.Type = '%c' %s ORDER BY Job.PriorJobId DESC %s",
         (char) JT_JOB_COPY, str_jobids.c_str(), str_limit.c_str());
 
-   if (!QUERY_DB(jcr, mdb, mdb->cmd)) {
+   if (!QueryDB(jcr, cmd)) {
       goto bail_out;
    }
 
-   if (sql_num_rows(mdb)) {
+   if (sql_num_rows()) {
       if (JobIds && JobIds[0]) {
          sendit(ctx, _("These JobIds have copies as follows:\n"));
       } else {
          sendit(ctx, _("The catalog contains copies as follows:\n"));
       }
 
-      list_result(jcr, mdb, sendit, ctx, type);
+      list_result(jcr, this, sendit, ctx, type);
    }
 
-   sql_free_result(mdb);
+   sql_free_result();
 
 bail_out:
-   db_unlock(mdb);
+   bdb_unlock();
 }
 
-void db_list_joblog_records(JCR *jcr, B_DB *mdb, uint32_t JobId,
+void BDB::bdb_list_joblog_records(JCR *jcr, uint32_t JobId,
                               DB_LIST_HANDLER *sendit, void *ctx, e_list_type type)
 {
    char ed1[50];
-
+ 
    if (JobId <= 0) {
       return;
    }
-   db_lock(mdb);
+   bdb_lock();
    if (type == VERT_LIST) {
-      Mmsg(mdb->cmd, "SELECT Time,LogText FROM Log "
+      Mmsg(cmd, "SELECT Time,LogText FROM Log "
            "WHERE Log.JobId=%s ORDER BY LogId ASC", edit_int64(JobId, ed1));
    } else {
-      Mmsg(mdb->cmd, "SELECT LogText FROM Log "
+      Mmsg(cmd, "SELECT LogText FROM Log "
            "WHERE Log.JobId=%s ORDER BY LogId ASC", edit_int64(JobId, ed1));
    }
-   if (!QUERY_DB(jcr, mdb, mdb->cmd)) {
+   if (!QueryDB(jcr, cmd)) {
       goto bail_out;
    }
 
-   list_result(jcr, mdb, sendit, ctx, type);
+   list_result(jcr, this, sendit, ctx, type);
 
-   sql_free_result(mdb);
+   sql_free_result();
 
 bail_out:
-   db_unlock(mdb);
+   bdb_unlock();
 }
 
 
@@ -308,8 +363,7 @@ bail_out:
  *  Currently, we return all jobs or if jr->JobId is set,
  *  only the job with the specified id.
  */
-alist *
-db_list_job_records(JCR *jcr, B_DB *mdb, JOB_DBR *jr, DB_LIST_HANDLER *sendit,
+alist *BDB::bdb_list_job_records(JCR *jcr, JOB_DBR *jr, DB_LIST_HANDLER *sendit,
                     void *ctx, e_list_type type)
 {
    char ed1[50];
@@ -318,7 +372,7 @@ db_list_job_records(JCR *jcr, B_DB *mdb, JOB_DBR *jr, DB_LIST_HANDLER *sendit,
    char esc[MAX_ESCAPE_NAME_LENGTH];
    alist *list = NULL;
 
-   db_lock(mdb);
+   bdb_lock();
    if (jr->limit > 0) {
       snprintf(limit, sizeof(limit), " LIMIT %d", jr->limit);
    } else {
@@ -327,62 +381,96 @@ db_list_job_records(JCR *jcr, B_DB *mdb, JOB_DBR *jr, DB_LIST_HANDLER *sendit,
    switch (type) {
    case VERT_LIST:
       if (jr->JobId == 0 && jr->Job[0] == 0) {
-         Mmsg(mdb->cmd,
+         Mmsg(cmd,
             "SELECT JobId,Job,Job.Name,PurgedFiles,Type,Level,"
             "Job.ClientId,Client.Name as ClientName,JobStatus,SchedTime,"
             "StartTime,EndTime,RealEndTime,JobTDate,"
-            "VolSessionId,VolSessionTime,JobFiles,JobErrors,"
+            "VolSessionId,VolSessionTime,JobFiles,JobBytes,ReadBytes,JobErrors,"
             "JobMissingFiles,Job.PoolId,Pool.Name as PooLname,PriorJobId,"
             "Job.FileSetId,FileSet.FileSet,Job.HasCache "
-            "FROM Job,Client,Pool,FileSet WHERE "
-            "Client.ClientId=Job.ClientId AND Pool.PoolId=Job.PoolId "
-            "AND FileSet.FileSetId=Job.FileSetId  ORDER BY StartTime%s", limit);
+            "FROM Job JOIN Client USING (ClientId) LEFT JOIN Pool USING (PoolId) "
+            "LEFT JOIN FileSet USING (FileSetId) ",
+            "ORDER BY StartTime%s", limit);
       } else {                           /* single record */
-         Mmsg(mdb->cmd,
+         Mmsg(cmd,
             "SELECT JobId,Job,Job.Name,PurgedFiles,Type,Level,"
-            "Job.ClientId,Client.Name,JobStatus,SchedTime,"
+            "Job.ClientId,Client.Name as ClientName,JobStatus,SchedTime,"
             "StartTime,EndTime,RealEndTime,JobTDate,"
-            "VolSessionId,VolSessionTime,JobFiles,JobErrors,"
+            "VolSessionId,VolSessionTime,JobFiles,JobBytes,ReadBytes,JobErrors,"
             "JobMissingFiles,Job.PoolId,Pool.Name as PooLname,PriorJobId,"
             "Job.FileSetId,FileSet.FileSet,Job.HasCache "
-            "FROM Job,Client,Pool,FileSet WHERE Job.JobId=%s AND "
-            "Client.ClientId=Job.ClientId AND Pool.PoolId=Job.PoolId "
-            "AND FileSet.FileSetId=Job.FileSetId",
+            "FROM Job JOIN Client USING (ClientId) LEFT JOIN Pool USING (PoolId) "
+            "LEFT JOIN FileSet USING (FileSetId) WHERE Job.JobId=%s ",
             edit_int64(jr->JobId, ed1));
       }
       break;
    case HORZ_LIST:
       if (jr->Name[0] != 0) {
-         mdb->db_escape_string(jcr, esc, jr->Name, strlen(jr->Name));
-         Mmsg(mdb->cmd,
+         bdb_escape_string(jcr, esc, jr->Name, strlen(jr->Name));
+         Mmsg(cmd,
            "SELECT JobId,Name,StartTime,Type,Level,JobFiles,JobBytes,JobStatus "
              "FROM Job WHERE Name='%s' ORDER BY StartTime,JobId ASC", esc);
       } else if (jr->Job[0] != 0) {
-         mdb->db_escape_string(jcr, esc, jr->Job, strlen(jr->Job));
-         Mmsg(mdb->cmd,
+         bdb_escape_string(jcr, esc, jr->Job, strlen(jr->Job));
+         Mmsg(cmd,
             "SELECT JobId,Name,StartTime,Type,Level,JobFiles,JobBytes,JobStatus "
             "FROM Job WHERE Job='%s' ORDER BY StartTime,JobId ASC", esc);
       } else if (jr->JobId != 0) {
-         Mmsg(mdb->cmd,
+         Mmsg(cmd,
             "SELECT JobId,Name,StartTime,Type,Level,JobFiles,JobBytes,JobStatus "
             "FROM Job WHERE JobId=%s", edit_int64(jr->JobId, ed1));
       } else {                           /* all records */
-         Mmsg(mdb->cmd,
+         Mmsg(cmd,
            "SELECT JobId,Name,StartTime,Type,Level,JobFiles,JobBytes,JobStatus "
            "FROM Job ORDER BY StartTime,JobId ASC%s", limit);
       }
       break;
+   case INCOMPLETE_JOBS:
+      if (jr->Name[0] != 0) {
+         bdb_escape_string(jcr, esc, jr->Name, strlen(jr->Name));
+         if (jr->JobStatus == JS_FatalError) {
+            snprintf(status, sizeof(status), "JobStatus IN ('E','f') AND");
+         } else if (jr->JobStatus != 0) {
+            snprintf(status, sizeof(status), "JobStatus='%c' AND", jr->JobStatus);
+         } else {
+            status[0] = 0;
+         }
+         Mmsg(cmd,
+           "SELECT JobId,Name,StartTime,Type,Level,JobFiles,JobBytes,JobStatus "
+             "FROM Job WHERE %s Name='%s' ORDER BY StartTime,JobId ASC%s",
+              status, esc, limit);
+         Dmsg1(100, "SQL: %s\n", cmd);
+      } else {                           /* all records */
+         if (jr->JobStatus != 0) {
+            snprintf(status, sizeof(status), "WHERE JobStatus='%c'", jr->JobStatus);
+         } else {
+            status[0] = 0;
+         }
+         Mmsg(cmd,
+           "SELECT JobId,Name,StartTime,Type,Level,JobFiles,JobBytes,JobStatus "
+           "FROM Job %s ORDER BY StartTime,JobId ASC%s", status, limit);
+         Dmsg1(100, "SQL: %s\n", cmd);
+      }
+      break;
    default:
       break;
    }
-   if (!QUERY_DB(jcr, mdb, mdb->cmd)) {
-      db_unlock(mdb);
+   if (!QueryDB(jcr, cmd)) {
+      bdb_unlock();
       return NULL;
    }
-   sql_data_seek(mdb, 0);
-   list_result(jcr, mdb, sendit, ctx, type);
-   sql_free_result(mdb);
-   db_unlock(mdb);
+   if (type == INCOMPLETE_JOBS) {
+      SQL_ROW row;
+      list = New(alist(10));
+      sql_data_seek(0);
+      for (int i=0; (row=sql_fetch_row()) != NULL; i++) {
+         list->append(bstrdup(row[0]));
+      }
+   }
+   sql_data_seek(0);
+   list_result(jcr, this, sendit, ctx, type);
+   sql_free_result();
+   bdb_unlock();
    return list;
 }
 
@@ -390,52 +478,50 @@ db_list_job_records(JCR *jcr, B_DB *mdb, JOB_DBR *jr, DB_LIST_HANDLER *sendit,
  * List Job totals
  *
  */
-void
-db_list_job_totals(JCR *jcr, B_DB *mdb, JOB_DBR *jr, DB_LIST_HANDLER *sendit, void *ctx)
+void BDB::bdb_list_job_totals(JCR *jcr, JOB_DBR *jr, DB_LIST_HANDLER *sendit, void *ctx)
 {
-   db_lock(mdb);
+   bdb_lock();
 
    /* List by Job */
-   Mmsg(mdb->cmd, "SELECT  count(*) AS Jobs,sum(JobFiles) "
+   Mmsg(cmd, "SELECT  count(*) AS Jobs,sum(JobFiles) "
       "AS Files,sum(JobBytes) AS Bytes,Name AS Job FROM Job GROUP BY Name");
 
-   if (!QUERY_DB(jcr, mdb, mdb->cmd)) {
-      db_unlock(mdb);
+   if (!QueryDB(jcr, cmd)) {
+      bdb_unlock();
       return;
    }
 
-   list_result(jcr, mdb, sendit, ctx, HORZ_LIST);
+   list_result(jcr, this, sendit, ctx, HORZ_LIST);
 
-   sql_free_result(mdb);
+   sql_free_result();
 
    /* Do Grand Total */
-   Mmsg(mdb->cmd, "SELECT count(*) AS Jobs,sum(JobFiles) "
+   Mmsg(cmd, "SELECT count(*) AS Jobs,sum(JobFiles) "
         "AS Files,sum(JobBytes) As Bytes FROM Job");
 
-   if (!QUERY_DB(jcr, mdb, mdb->cmd)) {
-      db_unlock(mdb);
+   if (!QueryDB(jcr, cmd)) {
+      bdb_unlock();
       return;
    }
 
-   list_result(jcr, mdb, sendit, ctx, HORZ_LIST);
+   list_result(jcr, this, sendit, ctx, HORZ_LIST);
 
-   sql_free_result(mdb);
-   db_unlock(mdb);
+   sql_free_result();
+   bdb_unlock();
 }
 
-void
-db_list_files_for_job(JCR *jcr, B_DB *mdb, JobId_t jobid, DB_LIST_HANDLER *sendit, void *ctx)
+void BDB::bdb_list_files_for_job(JCR *jcr, JobId_t jobid, DB_LIST_HANDLER *sendit, void *ctx)
 {
    char ed1[50];
-   LIST_CTX lctx(jcr, mdb, sendit, ctx, HORZ_LIST);
+   LIST_CTX lctx(jcr, this, sendit, ctx, HORZ_LIST);
 
-   db_lock(mdb);
+   bdb_lock();
 
    /*
     * Stupid MySQL is NON-STANDARD !
     */
-   if (db_get_type_index(mdb) == SQL_TYPE_MYSQL) {
-      Mmsg(mdb->cmd, "SELECT CONCAT(Path.Path,Filename.Name) AS Filename "
+   if (bdb_get_type_index() == SQL_TYPE_MYSQL) {
+      Mmsg(cmd, "SELECT CONCAT(Path.Path,Filename.Name) AS Filename "
            "FROM (SELECT PathId, FilenameId FROM File WHERE JobId=%s "
                   "UNION ALL "
                  "SELECT PathId, FilenameId "
@@ -447,7 +533,7 @@ db_list_files_for_job(JCR *jcr, B_DB *mdb, JobId_t jobid, DB_LIST_HANDLER *sendi
            "AND Path.PathId=F.PathId",
            edit_int64(jobid, ed1), ed1);
    } else {
-      Mmsg(mdb->cmd, "SELECT Path.Path||Filename.Name AS Filename "
+      Mmsg(cmd, "SELECT Path.Path||Filename.Name AS Filename "
            "FROM (SELECT PathId, FilenameId FROM File WHERE JobId=%s "
                   "UNION ALL "
                  "SELECT PathId, FilenameId "
@@ -460,30 +546,29 @@ db_list_files_for_job(JCR *jcr, B_DB *mdb, JobId_t jobid, DB_LIST_HANDLER *sendi
            edit_int64(jobid, ed1), ed1);
    }
 
-   if (!db_big_sql_query(mdb, mdb->cmd, list_result, &lctx)) {
-       db_unlock(mdb);
+   if (!bdb_big_sql_query(cmd, list_result, &lctx)) {
+       bdb_unlock();
        return;
    }
 
    lctx.send_dashes();
 
-   sql_free_result(mdb);
-   db_unlock(mdb);
+   sql_free_result();
+   bdb_unlock();
 }
 
-void
-db_list_base_files_for_job(JCR *jcr, B_DB *mdb, JobId_t jobid, DB_LIST_HANDLER *sendit, void *ctx)
+void BDB::bdb_list_base_files_for_job(JCR *jcr, JobId_t jobid, DB_LIST_HANDLER *sendit, void *ctx)
 {
    char ed1[50];
-   LIST_CTX lctx(jcr, mdb, sendit, ctx, HORZ_LIST);
+   LIST_CTX lctx(jcr, this, sendit, ctx, HORZ_LIST);
 
-   db_lock(mdb);
+   bdb_lock();
 
    /*
     * Stupid MySQL is NON-STANDARD !
     */
-   if (db_get_type_index(mdb) == SQL_TYPE_MYSQL) {
-      Mmsg(mdb->cmd, "SELECT CONCAT(Path.Path,Filename.Name) AS Filename "
+   if (bdb_get_type_index() == SQL_TYPE_MYSQL) {
+      Mmsg(cmd, "SELECT CONCAT(Path.Path,Filename.Name) AS Filename "
            "FROM BaseFiles, File, Filename, Path "
            "WHERE BaseFiles.JobId=%s AND BaseFiles.BaseJobId = File.JobId "
            "AND BaseFiles.FileId = File.FileId "
@@ -491,7 +576,7 @@ db_list_base_files_for_job(JCR *jcr, B_DB *mdb, JobId_t jobid, DB_LIST_HANDLER *
            "AND Path.PathId=File.PathId",
          edit_int64(jobid, ed1));
    } else {
-      Mmsg(mdb->cmd, "SELECT Path.Path||Filename.Name AS Filename "
+      Mmsg(cmd, "SELECT Path.Path||Filename.Name AS Filename "
            "FROM BaseFiles, File, Filename, Path "
            "WHERE BaseFiles.JobId=%s AND BaseFiles.BaseJobId = File.JobId "
            "AND BaseFiles.FileId = File.FileId "
@@ -500,15 +585,122 @@ db_list_base_files_for_job(JCR *jcr, B_DB *mdb, JobId_t jobid, DB_LIST_HANDLER *
            edit_int64(jobid, ed1));
    }
 
-   if (!db_big_sql_query(mdb, mdb->cmd, list_result, &lctx)) {
-       db_unlock(mdb);
+   if (!bdb_big_sql_query(cmd, list_result, &lctx)) {
+       bdb_unlock();
        return;
    }
 
    lctx.send_dashes();
 
-   sql_free_result(mdb);
-   db_unlock(mdb);
+   sql_free_result();
+   bdb_unlock();
+}
+
+#define append_filter(buf, sql)  \
+   do {                          \
+      if (*buf) {                \
+         pm_strcat(buf, " AND ");\
+      } else {                   \
+         pm_strcpy(buf, " WHERE ");\
+      }                          \
+      pm_strcat(buf, sql);       \
+   } while (0)
+
+void BDB::bdb_list_snapshot_records(JCR *jcr, SNAPSHOT_DBR *sdbr,
+              DB_LIST_HANDLER *sendit, void *ctx, e_list_type type)
+{
+   POOLMEM *filter = get_pool_memory(PM_MESSAGE);
+   POOLMEM *tmp    = get_pool_memory(PM_MESSAGE);
+   POOLMEM *esc    = get_pool_memory(PM_MESSAGE);
+   char ed1[50];
+
+   bdb_lock();
+   *filter = 0;
+
+   if (sdbr->Name[0]) {
+      bdb_escape_string(jcr, esc, sdbr->Name, strlen(sdbr->Name));
+      Mmsg(tmp, "Name='%s'", esc);
+      append_filter(filter, tmp);
+   }
+   if (sdbr->SnapshotId > 0) {
+      Mmsg(tmp, "Snapshot.SnapshotId=%d", sdbr->SnapshotId);
+      append_filter(filter, tmp);
+   }
+   if (sdbr->ClientId > 0) {
+      Mmsg(tmp, "Snapshot.ClientId=%d", sdbr->ClientId);
+      append_filter(filter, tmp);
+   }
+   if (sdbr->JobId > 0) {
+      Mmsg(tmp, "Snapshot.JobId=%d", sdbr->JobId);
+      append_filter(filter, tmp);
+   }
+   if (*sdbr->Client) {
+      bdb_escape_string(jcr, esc, sdbr->Client, strlen(sdbr->Client));
+      Mmsg(tmp, "Client.Name='%s'", esc);
+      append_filter(filter, tmp);
+   }
+   if (sdbr->Device && *(sdbr->Device)) {
+      esc = check_pool_memory_size(esc, strlen(sdbr->Device) * 2 + 1);
+      bdb_escape_string(jcr, esc, sdbr->Device, strlen(sdbr->Device));
+      Mmsg(tmp, "Device='%s'", esc);
+      append_filter(filter, tmp);
+   }
+   if (*sdbr->Type) {
+      bdb_escape_string(jcr, esc, sdbr->Type, strlen(sdbr->Type));
+      Mmsg(tmp, "Type='%s'", esc);
+      append_filter(filter, tmp);
+   }
+   if (*sdbr->created_before) {
+      bdb_escape_string(jcr, esc, sdbr->created_before, strlen(sdbr->created_before));
+      Mmsg(tmp, "CreateDate <= '%s'", esc);
+      append_filter(filter, tmp);
+   }
+   if (*sdbr->created_after) {
+      bdb_escape_string(jcr, esc, sdbr->created_after, strlen(sdbr->created_after));
+      Mmsg(tmp, "CreateDate >= '%s'", esc);
+      append_filter(filter, tmp);
+   }
+   if (sdbr->expired) {
+      Mmsg(tmp, "CreateTDate < (%s - Retention)", edit_int64(time(NULL), ed1));
+      append_filter(filter, tmp);
+   }
+   if (*sdbr->CreateDate) {
+      bdb_escape_string(jcr, esc, sdbr->CreateDate, strlen(sdbr->CreateDate));
+      Mmsg(tmp, "CreateDate = '%s'", esc);
+      append_filter(filter, tmp);
+   }
+
+   if (sdbr->sorted_client) {
+      pm_strcat(filter, " ORDER BY Client.Name, SnapshotId DESC");
+
+   } else {
+      pm_strcat(filter, " ORDER BY SnapshotId DESC");
+   }
+
+   if (type == VERT_LIST || type == ARG_LIST) {
+      Mmsg(cmd, "SELECT SnapshotId, Snapshot.Name, CreateDate, Client.Name AS Client, "
+           "FileSet.FileSet AS FileSet, JobId, Volume, Device, Type, Retention, Comment "
+           "FROM Snapshot JOIN Client USING (ClientId) LEFT JOIN FileSet USING (FileSetId) %s", filter);
+
+   } else if (type == HORZ_LIST) {
+      Mmsg(cmd, "SELECT SnapshotId, Snapshot.Name, CreateDate, Client.Name AS Client, "
+           "Device, Type "
+           "FROM Snapshot JOIN Client USING (ClientId) %s", filter);
+   }
+
+   if (!QueryDB(jcr, cmd)) {
+      goto bail_out;
+   }
+
+   list_result(jcr, this, sendit, ctx, type);
+
+bail_out:
+   sql_free_result();
+   bdb_unlock();
+
+   free_pool_memory(filter);
+   free_pool_memory(esc);
+   free_pool_memory(tmp);
 }
 
 #endif /* HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL */
diff --git a/src/cats/sql_update.c b/src/cats/sql_update.c
index a6c6baa..3c051aa 100644
--- a/src/cats/sql_update.c
+++ b/src/cats/sql_update.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Bacula Catalog Database Update record interface routines
@@ -20,13 +24,11 @@
  *
  */
 
-#include "bacula.h"
+#include  "bacula.h"
 
 #if HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL
-
-#include "cats.h"
-#include "bdb_priv.h"
-#include "sql_glue.h"
+ 
+#include  "cats.h"
 
 /* -----------------------------------------------------------------------
  *
@@ -42,37 +44,36 @@
  * -----------------------------------------------------------------------
  */
 /* Update the attributes record by adding the file digest */
-int
-db_add_digest_to_file_record(JCR *jcr, B_DB *mdb, FileId_t FileId, char *digest,
+int BDB::bdb_add_digest_to_file_record(JCR *jcr, FileId_t FileId, char *digest,
                           int type)
 {
    int ret;
    char ed1[50];
    int len = strlen(digest);
 
-   db_lock(mdb);
-   mdb->esc_name = check_pool_memory_size(mdb->esc_name, len*2+1);
-   mdb->db_escape_string(jcr, mdb->esc_name, digest, len);
-   Mmsg(mdb->cmd, "UPDATE File SET MD5='%s' WHERE FileId=%s", mdb->esc_name,
+   bdb_lock();
+   esc_name = check_pool_memory_size(esc_name, len*2+1);
+   bdb_escape_string(jcr, esc_name, digest, len);
+   Mmsg(cmd, "UPDATE File SET MD5='%s' WHERE FileId=%s", esc_name,
         edit_int64(FileId, ed1));
-   ret = UPDATE_DB(jcr, mdb, mdb->cmd);
-   db_unlock(mdb);
+   ret = UpdateDB(jcr, cmd);
+   bdb_unlock();
    return ret;
 }
 
 /* Mark the file record as being visited during database
  * verify compare. Stuff JobId into the MarkId field
  */
-int db_mark_file_record(JCR *jcr, B_DB *mdb, FileId_t FileId, JobId_t JobId)
+int BDB::bdb_mark_file_record(JCR *jcr, FileId_t FileId, JobId_t JobId)
 {
    int stat;
    char ed1[50], ed2[50];
 
-   db_lock(mdb);
-   Mmsg(mdb->cmd, "UPDATE File SET MarkId=%s WHERE FileId=%s",
+   bdb_lock();
+   Mmsg(cmd, "UPDATE File SET MarkId=%s WHERE FileId=%s",
       edit_int64(JobId, ed1), edit_int64(FileId, ed2));
-   stat = UPDATE_DB(jcr, mdb, mdb->cmd);
-   db_unlock(mdb);
+   stat = UpdateDB(jcr, cmd);
+   bdb_unlock();
    return stat;
 }
 
@@ -82,8 +83,7 @@ int db_mark_file_record(JCR *jcr, B_DB *mdb, FileId_t FileId, JobId_t JobId)
  *  Returns: false on failure
  *           true  on success
  */
-bool
-db_update_job_start_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr)
+bool BDB::bdb_update_job_start_record(JCR *jcr, JOB_DBR *jr)
 {
    char dt[MAX_TIME_LENGTH];
    time_t stime;
@@ -97,8 +97,8 @@ db_update_job_start_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr)
    strftime(dt, sizeof(dt), "%Y-%m-%d %H:%M:%S", &tm);
    JobTDate = (btime_t)stime;
 
-   db_lock(mdb);
-   Mmsg(mdb->cmd, "UPDATE Job SET JobStatus='%c',Level='%c',StartTime='%s',"
+   bdb_lock();
+   Mmsg(cmd, "UPDATE Job SET JobStatus='%c',Level='%c',StartTime='%s',"
 "ClientId=%s,JobTDate=%s,PoolId=%s,FileSetId=%s WHERE JobId=%s",
       (char)(jcr->JobStatus),
       (char)(jr->JobLevel), dt,
@@ -108,9 +108,9 @@ db_update_job_start_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr)
       edit_int64(jr->FileSetId, ed4),
       edit_int64(jr->JobId, ed5));
 
-   stat = UPDATE_DB(jcr, mdb, mdb->cmd);
-   mdb->changes = 0;
-   db_unlock(mdb);
+   stat = UpdateDB(jcr, cmd);
+   changes = 0;
+   bdb_unlock();
    return stat;
 }
 
@@ -118,21 +118,21 @@ db_update_job_start_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr)
  * Update Long term statistics with all jobs that were run before
  * age seconds
  */
-int
-db_update_stats(JCR *jcr, B_DB *mdb, utime_t age)
+int BDB::bdb_update_stats(JCR *jcr, utime_t age)
 {
    char ed1[30];
    int rows;
+
    utime_t now = (utime_t)time(NULL);
    edit_uint64(now - age, ed1);
 
-   db_lock(mdb);
+   bdb_lock();
 
-   Mmsg(mdb->cmd, fill_jobhisto, ed1);
-   QUERY_DB(jcr, mdb, mdb->cmd); /* TODO: get a message ? */
-   rows = sql_affected_rows(mdb);
+   Mmsg(cmd, fill_jobhisto, ed1);
+   QueryDB(jcr, cmd); /* TODO: get a message ? */
+   rows = sql_affected_rows();
 
-   db_unlock(mdb);
+   bdb_unlock();
 
    return rows;
 }
@@ -143,8 +143,7 @@ db_update_stats(JCR *jcr, B_DB *mdb, utime_t age)
  *  Returns: 0 on failure
  *           1 on success
  */
-int
-db_update_job_end_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr)
+int BDB::bdb_update_job_end_record(JCR *jcr, JOB_DBR *jr)
 {
    char dt[MAX_TIME_LENGTH];
    char rdt[MAX_TIME_LENGTH];
@@ -164,7 +163,7 @@ db_update_job_end_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr)
    ttime = jr->EndTime;
    (void)localtime_r(&ttime, &tm);
    strftime(dt, sizeof(dt), "%Y-%m-%d %H:%M:%S", &tm);
-                                            
+
    if (jr->RealEndTime == 0 || jr->RealEndTime < jr->EndTime) {
       jr->RealEndTime = jr->EndTime;
    }
@@ -174,8 +173,8 @@ db_update_job_end_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr)
 
    JobTDate = ttime;
 
-   db_lock(mdb);
-   Mmsg(mdb->cmd,
+   bdb_lock();
+   Mmsg(cmd,
       "UPDATE Job SET JobStatus='%c',EndTime='%s',"
 "ClientId=%u,JobBytes=%s,ReadBytes=%s,JobFiles=%u,JobErrors=%u,VolSessionId=%u,"
 "VolSessionTime=%u,PoolId=%u,FileSetId=%u,JobTDate=%s,"
@@ -187,9 +186,9 @@ db_update_job_end_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr)
       rdt, PriorJobId, jr->HasBase, jr->PurgedFiles,
       edit_int64(jr->JobId, ed3));
 
-   stat = UPDATE_DB(jcr, mdb, mdb->cmd);
+   stat = UpdateDB(jcr, cmd);
 
-   db_unlock(mdb);
+   bdb_unlock();
    return stat;
 }
 
@@ -198,8 +197,7 @@ db_update_job_end_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr)
  *   Returns: 0 on failure
  *            1 on success
  */
-int
-db_update_client_record(JCR *jcr, B_DB *mdb, CLIENT_DBR *cr)
+int BDB::bdb_update_client_record(JCR *jcr, CLIENT_DBR *cr)
 {
    int stat;
    char ed1[50], ed2[50];
@@ -207,16 +205,16 @@ db_update_client_record(JCR *jcr, B_DB *mdb, CLIENT_DBR *cr)
    char esc_uname[MAX_ESCAPE_NAME_LENGTH];
    CLIENT_DBR tcr;
 
-   db_lock(mdb);
+   bdb_lock();
    memcpy(&tcr, cr, sizeof(tcr));
-   if (!db_create_client_record(jcr, mdb, &tcr)) {
-      db_unlock(mdb);
+   if (!bdb_create_client_record(jcr, &tcr)) {
+      bdb_unlock();
       return 0;
    }
 
-   mdb->db_escape_string(jcr, esc_name, cr->Name, strlen(cr->Name));
-   mdb->db_escape_string(jcr, esc_uname, cr->Uname, strlen(cr->Uname));
-   Mmsg(mdb->cmd,
+   bdb_escape_string(jcr, esc_name, cr->Name, strlen(cr->Name));
+   bdb_escape_string(jcr, esc_uname, cr->Uname, strlen(cr->Uname));
+   Mmsg(cmd,
 "UPDATE Client SET AutoPrune=%d,FileRetention=%s,JobRetention=%s,"
 "Uname='%s' WHERE Name='%s'",
       cr->AutoPrune,
@@ -224,8 +222,8 @@ db_update_client_record(JCR *jcr, B_DB *mdb, CLIENT_DBR *cr)
       edit_uint64(cr->JobRetention, ed2),
       esc_uname, esc_name);
 
-   stat = UPDATE_DB(jcr, mdb, mdb->cmd);
-   db_unlock(mdb);
+   stat = UpdateDB(jcr, cmd);
+   bdb_unlock();
    return stat;
 }
 
@@ -235,37 +233,37 @@ db_update_client_record(JCR *jcr, B_DB *mdb, CLIENT_DBR *cr)
  *   Returns: 0 on failure
  *            1 on success
  */
-int db_update_counter_record(JCR *jcr, B_DB *mdb, COUNTER_DBR *cr)
+int BDB::bdb_update_counter_record(JCR *jcr, COUNTER_DBR *cr)
 {
    char esc[MAX_ESCAPE_NAME_LENGTH];
-   db_lock(mdb);
-   mdb->db_escape_string(jcr, esc, cr->Counter, strlen(cr->Counter));
-   Mmsg(mdb->cmd,
-        update_counter_values[mdb->db_get_type_index()],
-        cr->MinValue, cr->MaxValue, cr->CurrentValue,
-        cr->WrapCounter, esc);
-
-   int stat = UPDATE_DB(jcr, mdb, mdb->cmd);
-   db_unlock(mdb);
+
+   bdb_lock();
+   bdb_escape_string(jcr, esc, cr->Counter, strlen(cr->Counter));
+   Mmsg(cmd, update_counter_values[bdb_get_type_index()],
+      cr->MinValue, cr->MaxValue, cr->CurrentValue,
+      cr->WrapCounter, esc);
+
+   int stat = UpdateDB(jcr, cmd);
+   bdb_unlock();
    return stat;
 }
 
 
-int db_update_pool_record(JCR *jcr, B_DB *mdb, POOL_DBR *pr)
+int BDB::bdb_update_pool_record(JCR *jcr, POOL_DBR *pr)
 {
    int stat;
    char ed1[50], ed2[50], ed3[50], ed4[50], ed5[50], ed6[50];
    char esc[MAX_ESCAPE_NAME_LENGTH];
 
-   db_lock(mdb);
-   mdb->db_escape_string(jcr, esc, pr->LabelFormat, strlen(pr->LabelFormat));
+   bdb_lock();
+   bdb_escape_string(jcr, esc, pr->LabelFormat, strlen(pr->LabelFormat));
 
-   Mmsg(mdb->cmd, "SELECT count(*) from Media WHERE PoolId=%s",
+   Mmsg(cmd, "SELECT count(*) from Media WHERE PoolId=%s",
       edit_int64(pr->PoolId, ed4));
-   pr->NumVols = get_sql_record_max(jcr, mdb);
+   pr->NumVols = get_sql_record_max(jcr, this);
    Dmsg1(400, "NumVols=%d\n", pr->NumVols);
 
-   Mmsg(mdb->cmd,
+   Mmsg(cmd,
 "UPDATE Pool SET NumVols=%u,MaxVols=%u,UseOnce=%d,UseCatalog=%d,"
 "AcceptAnyVolume=%d,VolRetention='%s',VolUseDuration='%s',"
 "MaxVolJobs=%u,MaxVolFiles=%u,MaxVolBytes=%s,Recycle=%d,"
@@ -281,22 +279,22 @@ int db_update_pool_record(JCR *jcr, B_DB *mdb, POOL_DBR *pr)
       edit_int64(pr->ScratchPoolId,ed6),
       pr->ActionOnPurge,
       ed4);
-   stat = UPDATE_DB(jcr, mdb, mdb->cmd);
-   db_unlock(mdb);
+   stat = UpdateDB(jcr, cmd);
+   bdb_unlock();
    return stat;
 }
 
-bool
-db_update_storage_record(JCR *jcr, B_DB *mdb, STORAGE_DBR *sr)
+bool BDB::bdb_update_storage_record(JCR *jcr, STORAGE_DBR *sr)
 {
    int stat;
    char ed1[50];
-   db_lock(mdb);
-   Mmsg(mdb->cmd, "UPDATE Storage SET AutoChanger=%d WHERE StorageId=%s",
+
+   bdb_lock();
+   Mmsg(cmd, "UPDATE Storage SET AutoChanger=%d WHERE StorageId=%s",
       sr->AutoChanger, edit_int64(sr->StorageId, ed1));
 
-   stat = UPDATE_DB(jcr, mdb, mdb->cmd);
-   db_unlock(mdb);
+   stat = UpdateDB(jcr, cmd);
+   bdb_unlock();
    return stat;
 }
 
@@ -307,33 +305,32 @@ db_update_storage_record(JCR *jcr, B_DB *mdb, STORAGE_DBR *sr)
  * Returns: 0 on failure
  *          numrows on success
  */
-int
-db_update_media_record(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr)
+int BDB::bdb_update_media_record(JCR *jcr, MEDIA_DBR *mr)
 {
    char dt[MAX_TIME_LENGTH];
    time_t ttime;
    struct tm tm;
    int stat;
-   char ed1[50], ed4[50];
+   char ed1[50], ed2[50],  ed3[50],  ed4[50];
    char ed5[50], ed6[50],  ed7[50],  ed8[50];
    char ed9[50], ed10[50], ed11[50], ed12[50];
-   char ed13[50];
+   char ed13[50], ed14[50];
    char esc_name[MAX_ESCAPE_NAME_LENGTH];
    char esc_status[MAX_ESCAPE_NAME_LENGTH];
 
    Dmsg1(100, "update_media: FirstWritten=%d\n", mr->FirstWritten);
-   db_lock(mdb);
-   mdb->db_escape_string(jcr, esc_name, mr->VolumeName, strlen(mr->VolumeName));
-   mdb->db_escape_string(jcr, esc_status, mr->VolStatus, strlen(mr->VolStatus));
+   bdb_lock();
+   bdb_escape_string(jcr, esc_name, mr->VolumeName, strlen(mr->VolumeName));
+   bdb_escape_string(jcr, esc_status, mr->VolStatus, strlen(mr->VolStatus));
 
    if (mr->set_first_written) {
       Dmsg1(400, "Set FirstWritten Vol=%s\n", mr->VolumeName);
       ttime = mr->FirstWritten;
       (void)localtime_r(&ttime, &tm);
       strftime(dt, sizeof(dt), "%Y-%m-%d %H:%M:%S", &tm);
-      Mmsg(mdb->cmd, "UPDATE Media SET FirstWritten='%s'"
+      Mmsg(cmd, "UPDATE Media SET FirstWritten='%s'"
            " WHERE VolumeName='%s'", dt, esc_name);
-      stat = UPDATE_DB(jcr, mdb, mdb->cmd);
+      stat = UpdateDB(jcr, cmd);
       Dmsg1(400, "Firstwritten=%d\n", mr->FirstWritten);
    }
 
@@ -345,18 +342,18 @@ db_update_media_record(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr)
       }
       (void)localtime_r(&ttime, &tm);
       strftime(dt, sizeof(dt), "%Y-%m-%d %H:%M:%S", &tm);
-      Mmsg(mdb->cmd, "UPDATE Media SET LabelDate='%s' "
+      Mmsg(cmd, "UPDATE Media SET LabelDate='%s' "
            "WHERE VolumeName='%s'", dt, esc_name);
-      UPDATE_DB(jcr, mdb, mdb->cmd);
+      UpdateDB(jcr, cmd);
    }
 
    if (mr->LastWritten != 0) {
       ttime = mr->LastWritten;
       (void)localtime_r(&ttime, &tm);
       strftime(dt, sizeof(dt), "%Y-%m-%d %H:%M:%S", &tm);
-      Mmsg(mdb->cmd, "UPDATE Media Set LastWritten='%s' "
+      Mmsg(cmd, "UPDATE Media Set LastWritten='%s' "
            "WHERE VolumeName='%s'", dt, esc_name);
-      UPDATE_DB(jcr, mdb, mdb->cmd);
+      UpdateDB(jcr, cmd);
    }
 
    /* sanity checks for #1066 */
@@ -367,43 +364,47 @@ db_update_media_record(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr)
       mr->VolWriteTime = 0;
    }
 
-   Mmsg(mdb->cmd, "UPDATE Media SET VolJobs=%u,"
-        "VolFiles=%u,VolBlocks=%u,VolBytes=%s,"
-        "VolMounts=%u,VolErrors=%u,"
-        "VolWrites=%u,MaxVolBytes=%s,VolStatus='%s',"
+   Mmsg(cmd, "UPDATE Media SET VolJobs=%u,"
+        "VolFiles=%u,VolBlocks=%u,VolBytes=%s,VolABytes=%s,"
+        "VolHoleBytes=%s,VolHoles=%u,VolMounts=%u,VolErrors=%u,"
+        "VolWrites=%s,MaxVolBytes=%s,VolStatus='%s',"
         "Slot=%d,InChanger=%d,VolReadTime=%s,VolWriteTime=%s,VolParts=%d,"
         "LabelType=%d,StorageId=%s,PoolId=%s,VolRetention=%s,VolUseDuration=%s,"
         "MaxVolJobs=%d,MaxVolFiles=%d,Enabled=%d,LocationId=%s,"
-        "ScratchPoolId=%s,RecyclePoolId=%s,RecycleCount=%d,Recycle=%d,ActionOnPurge=%d"
+        "ScratchPoolId=%s,RecyclePoolId=%s,RecycleCount=%d,Recycle=%d,"
+        "ActionOnPurge=%d"
         " WHERE VolumeName='%s'",
         mr->VolJobs, mr->VolFiles, mr->VolBlocks,
         edit_uint64(mr->VolBytes, ed1),
-        mr->VolMounts, mr->VolErrors, mr->VolWrites,
-        edit_uint64(mr->MaxVolBytes, ed4),
+        edit_uint64(mr->VolABytes, ed2),
+        edit_uint64(mr->VolHoleBytes, ed3),
+        mr->VolHoles, mr->VolMounts, mr->VolErrors,
+        edit_uint64(mr->VolWrites, ed4),
+        edit_uint64(mr->MaxVolBytes, ed5),
         esc_status, mr->Slot, mr->InChanger,
-        edit_int64(mr->VolReadTime, ed5),
-        edit_int64(mr->VolWriteTime, ed6),
-        mr->VolParts,
+        edit_int64(mr->VolReadTime, ed6),
+        edit_int64(mr->VolWriteTime, ed7),
+        mr->VolType,  /* formerly VolParts */
         mr->LabelType,
-        edit_int64(mr->StorageId, ed7),
-        edit_int64(mr->PoolId, ed8),
-        edit_uint64(mr->VolRetention, ed9),
-        edit_uint64(mr->VolUseDuration, ed10),
+        edit_int64(mr->StorageId, ed8),
+        edit_int64(mr->PoolId, ed9),
+        edit_uint64(mr->VolRetention, ed10),
+        edit_uint64(mr->VolUseDuration, ed11),
         mr->MaxVolJobs, mr->MaxVolFiles,
-        mr->Enabled, edit_uint64(mr->LocationId, ed11),
-        edit_uint64(mr->ScratchPoolId, ed12),
-        edit_uint64(mr->RecyclePoolId, ed13),
+        mr->Enabled, edit_uint64(mr->LocationId, ed12),
+        edit_uint64(mr->ScratchPoolId, ed13),
+        edit_uint64(mr->RecyclePoolId, ed14),
         mr->RecycleCount,mr->Recycle, mr->ActionOnPurge,
         esc_name);
 
-   Dmsg1(400, "%s\n", mdb->cmd);
+   Dmsg1(400, "%s\n", cmd);
 
-   stat = UPDATE_DB(jcr, mdb, mdb->cmd);
+   stat = UpdateDB(jcr, cmd);
 
    /* Make sure InChanger is 0 for any record having the same Slot */
-   db_make_inchanger_unique(jcr, mdb, mr);
+   db_make_inchanger_unique(jcr, this, mr);
 
-   db_unlock(mdb);
+   bdb_unlock();
    return stat;
 }
 
@@ -413,17 +414,16 @@ db_update_media_record(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr)
  * Returns: 0 on failure
  *          numrows on success
  */
-int
-db_update_media_defaults(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr)
+int BDB::bdb_update_media_defaults(JCR *jcr, MEDIA_DBR *mr)
 {
    int stat;
    char ed1[50], ed2[50], ed3[50], ed4[50], ed5[50];
    char esc[MAX_ESCAPE_NAME_LENGTH];
 
-   db_lock(mdb);
+   bdb_lock();
    if (mr->VolumeName[0]) {
-      mdb->db_escape_string(jcr, esc, mr->VolumeName, strlen(mr->VolumeName));
-      Mmsg(mdb->cmd, "UPDATE Media SET "
+      bdb_escape_string(jcr, esc, mr->VolumeName, strlen(mr->VolumeName));
+      Mmsg(cmd, "UPDATE Media SET "
            "ActionOnPurge=%d, Recycle=%d,VolRetention=%s,VolUseDuration=%s,"
            "MaxVolJobs=%u,MaxVolFiles=%u,MaxVolBytes=%s,RecyclePoolId=%s"
            " WHERE VolumeName='%s'",
@@ -434,7 +434,7 @@ db_update_media_defaults(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr)
            edit_uint64(mr->RecyclePoolId, ed4),
            esc);
    } else {
-      Mmsg(mdb->cmd, "UPDATE Media SET "
+      Mmsg(cmd, "UPDATE Media SET "
            "ActionOnPurge=%d, Recycle=%d,VolRetention=%s,VolUseDuration=%s,"
            "MaxVolJobs=%u,MaxVolFiles=%u,MaxVolBytes=%s,RecyclePoolId=%s"
            " WHERE PoolId=%s",
@@ -446,11 +446,11 @@ db_update_media_defaults(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr)
            edit_int64(mr->PoolId, ed5));
    }
 
-   Dmsg1(400, "%s\n", mdb->cmd);
+   Dmsg1(400, "%s\n", cmd);
 
-   stat = UPDATE_DB(jcr, mdb, mdb->cmd);
+   stat = UpdateDB(jcr, cmd);
 
-   db_unlock(mdb);
+   bdb_unlock();
    return stat;
 }
 
@@ -461,35 +461,54 @@ db_update_media_defaults(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr)
  *
  * This routine assumes the database is already locked.
  */
-void
-db_make_inchanger_unique(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr)
+void BDB::bdb_make_inchanger_unique(JCR *jcr, MEDIA_DBR *mr)
 {
    char ed1[50], ed2[50];
    char esc[MAX_ESCAPE_NAME_LENGTH];
-   if (mr->InChanger != 0 && mr->Slot != 0 && mr->StorageId != 0) {
 
+   if (mr->InChanger != 0 && mr->Slot != 0 && mr->StorageId != 0) {
        if (mr->MediaId != 0) {
-          Mmsg(mdb->cmd, "UPDATE Media SET InChanger=0, Slot=0 WHERE "
+          Mmsg(cmd, "UPDATE Media SET InChanger=0, Slot=0 WHERE "
                "Slot=%d AND StorageId=%s AND MediaId!=%s",
                mr->Slot,
                edit_int64(mr->StorageId, ed1), edit_int64(mr->MediaId, ed2));
 
        } else if (*mr->VolumeName) {
-          mdb->db_escape_string(jcr, esc,mr->VolumeName,strlen(mr->VolumeName));
-          Mmsg(mdb->cmd, "UPDATE Media SET InChanger=0, Slot=0 WHERE "
+          bdb_escape_string(jcr, esc,mr->VolumeName,strlen(mr->VolumeName));
+          Mmsg(cmd, "UPDATE Media SET InChanger=0, Slot=0 WHERE "
                "Slot=%d AND StorageId=%s AND VolumeName!='%s'",
                mr->Slot,
                edit_int64(mr->StorageId, ed1), esc);
 
        } else {  /* used by ua_label to reset all volume with this slot */
-          Mmsg(mdb->cmd, "UPDATE Media SET InChanger=0, Slot=0 WHERE "
+          Mmsg(cmd, "UPDATE Media SET InChanger=0, Slot=0 WHERE "
                "Slot=%d AND StorageId=%s",
                mr->Slot,
                edit_int64(mr->StorageId, ed1), mr->VolumeName);
        }
-       Dmsg1(100, "%s\n", mdb->cmd);
-       UPDATE_DB(jcr, mdb, mdb->cmd);
+       Dmsg1(100, "%s\n", cmd);
+       UpdateDB(jcr, cmd);
    }
 }
 
+/* Update only Retention */
+bool BDB::bdb_update_snapshot_record(JCR *jcr, SNAPSHOT_DBR *sr)
+{
+   int stat, len;
+   char ed1[50], ed2[50];
+
+   len = strlen(sr->Comment);
+   bdb_lock();
+
+   esc_name = check_pool_memory_size(esc_name, len*2+1);
+   bdb_escape_string(jcr, esc_name, sr->Comment, len);
+
+   Mmsg(cmd, "UPDATE Snapshot SET Retention=%s, Comment='%s' WHERE SnapshotId=%s",
+        edit_int64(sr->Retention, ed2), sr->Comment, edit_int64(sr->SnapshotId, ed1));
+
+   stat = UpdateDB(jcr, cmd);
+   bdb_unlock();
+   return stat;
+}
+
 #endif /* HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL */
diff --git a/src/cats/sqlite.c b/src/cats/sqlite.c
index ca222e9..c47899c 100644
--- a/src/cats/sqlite.c
+++ b/src/cats/sqlite.c
@@ -1,736 +1,739 @@
-/*
-   Bacula® - The Network Backup Solution
+/* 
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
-/*
- * Bacula Catalog Database routines specific to SQLite
- *
- *    Written by Kern Sibbald, January 2002
- *
- *  Add class wrapper Marco van Wieringen, January 2010
- */
-
-#include "bacula.h"
-
-#if HAVE_SQLITE3
-
-#include "cats.h"
-#include "bdb_priv.h"
-#include <sqlite3.h>
-#include "bdb_sqlite.h"
-
-/* -----------------------------------------------------------------------
- *
- *    SQLite dependent defines and subroutines
- *
- * -----------------------------------------------------------------------
- */
-
-/*
- * List of open databases
- */
-static dlist *db_list = NULL;
-
-static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
-
-/*
- * When using mult_db_connections = true,
- * sqlite can be BUSY. We just need sleep a little in this case.
- */
-static int sqlite_busy_handler(void *arg, int calls)
-{
-   bmicrosleep(0, 500);
-   return 1;
-}
-
-B_DB_SQLITE::B_DB_SQLITE(JCR *jcr,
-                         const char *db_driver,
-                         const char *db_name,
-                         const char *db_user,
-                         const char *db_password,
-                         const char *db_address,
-                         int db_port,
-                         const char *db_socket,
-                         bool mult_db_connections,
-                         bool disable_batch_insert)
-{
-   /*
-    * Initialize the parent class members.
-    */
-   m_db_interface_type = SQL_INTERFACE_TYPE_SQLITE3;
-   m_db_type = SQL_TYPE_SQLITE3;
-   m_db_driver = bstrdup("SQLite3");
-   m_db_name = bstrdup(db_name);
-   if (disable_batch_insert) {
-      m_disabled_batch_insert = true;
-      m_have_batch_insert = false;
-   } else {
-      m_disabled_batch_insert = false;
-#if defined(USE_BATCH_FILE_INSERT)
-#if defined(HAVE_SQLITE3_THREADSAFE)
-      m_have_batch_insert = sqlite3_threadsafe();
-#else
-      m_have_batch_insert = false;
-#endif /* HAVE_SQLITE3_THREADSAFE */
-#else
-      m_have_batch_insert = false;
-#endif /* USE_BATCH_FILE_INSERT */
-   }
-   errmsg = get_pool_memory(PM_EMSG); /* get error message buffer */
-   *errmsg = 0;
-   cmd = get_pool_memory(PM_EMSG);    /* get command buffer */
-   cached_path = get_pool_memory(PM_FNAME);
-   cached_path_id = 0;
-   m_ref_count = 1;
-   fname = get_pool_memory(PM_FNAME);
-   path = get_pool_memory(PM_FNAME);
-   esc_name = get_pool_memory(PM_FNAME);
-   esc_path = get_pool_memory(PM_FNAME);
-   esc_obj  = get_pool_memory(PM_FNAME);
-   m_allow_transactions = mult_db_connections;
-
-   /* At this time, when mult_db_connections == true, this is for
-    * specific console command such as bvfs or batch mode, and we don't
-    * want to share a batch mode or bvfs. In the future, we can change
-    * the creation function to add this parameter.
-    */
-   m_dedicated = mult_db_connections;
-
-   /*
-    * Initialize the private members.
-    */
-   m_db_handle = NULL;
-   m_result = NULL;
-   m_sqlite_errmsg = NULL;
-
-   /*
-    * Put the db in the list.
-    */
-   if (db_list == NULL) {
-      db_list = New(dlist(this, &this->m_link));
-   }
-   db_list->append(this);
-}
-
-B_DB_SQLITE::~B_DB_SQLITE()
-{
-}
-
-/*
- * Now actually open the database.  This can generate errors,
- * which are returned in the errmsg
- *
- * DO NOT close the database or delete mdb here !!!!
- */
-bool B_DB_SQLITE::db_open_database(JCR *jcr)
-{
-   bool retval = false;
-   char *db_path;
-   int len;
-   struct stat statbuf;
-   int ret;
-   int errstat;
-   int retry = 0;
-
-   P(mutex);
-   if (m_connected) {
-      retval = true;
-      goto bail_out;
-   }
-
-   if ((errstat=rwl_init(&m_lock)) != 0) {
-      berrno be;
-      Mmsg1(&errmsg, _("Unable to initialize DB lock. ERR=%s\n"),
-            be.bstrerror(errstat));
-      goto bail_out;
-   }
-
-   /*
-    * Open the database
-    */
-   len = strlen(working_directory) + strlen(m_db_name) + 5;
-   db_path = (char *)malloc(len);
-   strcpy(db_path, working_directory);
-   strcat(db_path, "/");
-   strcat(db_path, m_db_name);
-   strcat(db_path, ".db");
-   if (stat(db_path, &statbuf) != 0) {
-      Mmsg1(&errmsg, _("Database %s does not exist, please create it.\n"),
-         db_path);
-      free(db_path);
-      goto bail_out;
-   }
-
-   for (m_db_handle = NULL; !m_db_handle && retry++ < 10; ) {
-      ret = sqlite3_open(db_path, &m_db_handle);
-      if (ret != SQLITE_OK) {
-         m_sqlite_errmsg = (char *)sqlite3_errmsg(m_db_handle);
-         sqlite3_close(m_db_handle);
-         m_db_handle = NULL;
-      } else {
-         m_sqlite_errmsg = NULL;
-      }
-
-      Dmsg0(300, "sqlite_open\n");
-      if (!m_db_handle) {
-         bmicrosleep(1, 0);
-      }
-   }
-   if (m_db_handle == NULL) {
-      Mmsg2(&errmsg, _("Unable to open Database=%s. ERR=%s\n"),
-         db_path, m_sqlite_errmsg ? m_sqlite_errmsg : _("unknown"));
-      free(db_path);
-      goto bail_out;
-   }
-   m_connected = true;
-   free(db_path);
-
-   /*
-    * Set busy handler to wait when we use mult_db_connections = true
-    */
-   sqlite3_busy_handler(m_db_handle, sqlite_busy_handler, NULL);
-
-#if defined(SQLITE3_INIT_QUERY)
-   sql_query(SQLITE3_INIT_QUERY);
-#endif
-
-   if (!check_tables_version(jcr, this)) {
-      goto bail_out;
-   }
-   retval = true;
-
-bail_out:
-   V(mutex);
-   return retval;
-}
-
-void B_DB_SQLITE::db_close_database(JCR *jcr)
-{
-   if (m_connected) {
-      db_end_transaction(jcr);
-   }
-   P(mutex);
-   m_ref_count--;
-   if (m_ref_count == 0) {
-      if (m_connected) {
-         sql_free_result();
-      }
-      db_list->remove(this);
-      if (m_connected && m_db_handle) {
-         sqlite3_close(m_db_handle);
-      }
-      if (rwl_is_init(&m_lock)) {
-         rwl_destroy(&m_lock);
-      }
-      free_pool_memory(errmsg);
-      free_pool_memory(cmd);
-      free_pool_memory(cached_path);
-      free_pool_memory(fname);
-      free_pool_memory(path);
-      free_pool_memory(esc_name);
-      free_pool_memory(esc_path);
-      free_pool_memory(esc_obj);
-      if (m_db_driver) {
-         free(m_db_driver);
-      }
-      if (m_db_name) {
-         free(m_db_name);
-      }
-      delete this;
-      if (db_list->size() == 0) {
-         delete db_list;
-         db_list = NULL;
-      }
-   }
-   V(mutex);
-}
-
-void B_DB_SQLITE::db_thread_cleanup(void)
-{
-   sqlite3_thread_cleanup();
-}
-
-/*
- * Escape strings so that SQLite is happy
- *
- *   NOTE! len is the length of the old string. Your new
- *         string must be long enough (max 2*old+1) to hold
- *         the escaped output.
- */
-void B_DB_SQLITE::db_escape_string(JCR *jcr, char *snew, char *old, int len)
-{
-   char *n, *o;
-
-   n = snew;
-   o = old;
-   while (len--) {
-      switch (*o) {
-      case '\'':
-         *n++ = '\'';
-         *n++ = '\'';
-         o++;
-         break;
-      case 0:
-         *n++ = '\\';
-         *n++ = 0;
-         o++;
-         break;
-      default:
-         *n++ = *o++;
-         break;
-      }
-   }
-   *n = 0;
-}
-
-/*
- * Escape binary object so that SQLite is happy
- * Memory is stored in B_DB struct, no need to free it
- *
- * TODO: this should be implemented  (escape \0)
- */
-char *B_DB_SQLITE::db_escape_object(JCR *jcr, char *old, int len)
-{
-   int l;
-   int max = len*2;           /* TODO: too big, should be *4/3 */
-
-   esc_obj = check_pool_memory_size(esc_obj, max);
-   l = bin_to_base64(esc_obj, max, old, len, true);
-   esc_obj[l] = 0;
-   ASSERT(l < max);    /* TODO: add check for l */
-
-   return esc_obj;
-}
-
-/*
- * Unescape binary object so that SQLIte is happy
- *
- * TODO: need to be implemented (escape \0)
- */
-
-void B_DB_SQLITE::db_unescape_object(JCR *jcr, char *from, int32_t expected_len,
-                                     POOLMEM **dest, int32_t *dest_len)
-{
-   if (!from) {
-      *dest[0] = 0;
-      *dest_len = 0;
-      return;
-   }
-   *dest = check_pool_memory_size(*dest, expected_len+1);
-   base64_to_bin(*dest, expected_len+1, from, strlen(from));
-   *dest_len = expected_len;
-   (*dest)[expected_len]=0;
-}
-
-/*
- * Start a transaction. This groups inserts and makes things
- * much more efficient. Usually started when inserting
- * file attributes.
- */
-void B_DB_SQLITE::db_start_transaction(JCR *jcr)
-{
-   if (!jcr->attr) {
-      jcr->attr = get_pool_memory(PM_FNAME);
-   }
-   if (!jcr->ar) {
-      jcr->ar = (ATTR_DBR *)malloc(sizeof(ATTR_DBR));
-   }
-
-   if (!m_allow_transactions) {
-      return;
-   }
-
-   db_lock(this);
-   /*
-    * Allow only 10,000 changes per transaction
-    */
-   if (m_transaction && changes > 10000) {
-      db_end_transaction(jcr);
-   }
-   if (!m_transaction) {
-      sql_query("BEGIN");  /* begin transaction */
-      Dmsg0(400, "Start SQLite transaction\n");
-      m_transaction = true;
-   }
-   db_unlock(this);
-}
-
-void B_DB_SQLITE::db_end_transaction(JCR *jcr)
-{
-   if (jcr && jcr->cached_attribute) {
-      Dmsg0(400, "Flush last cached attribute.\n");
-      if (!db_create_attributes_record(jcr, this, jcr->ar)) {
-         Jmsg1(jcr, M_FATAL, 0, _("Attribute create error. %s"), db_strerror(jcr->db));
-      }
-      jcr->cached_attribute = false;
-   }
-
-   if (!m_allow_transactions) {
-      return;
-   }
-
-   db_lock(this);
-   if (m_transaction) {
-      sql_query("COMMIT"); /* end transaction */
-      m_transaction = false;
-      Dmsg1(400, "End SQLite transaction changes=%d\n", changes);
-   }
-   changes = 0;
-   db_unlock(this);
-}
-
-struct rh_data {
-   B_DB_SQLITE *mdb;
-   DB_RESULT_HANDLER *result_handler;
-   void *ctx;
-   bool initialized;
-};
-
-/*
- * Convert SQLite's callback into Bacula DB callback
- */
-static int sqlite_result_handler(void *arh_data, int num_fields, char **rows, char **col_names)
-{
-   struct rh_data *rh_data = (struct rh_data *)arh_data;
-
-   /* The db_sql_query doesn't have access to m_results, so if we wan't to get
-    * fields information, we need to use col_names
-    */
-   if (!rh_data->initialized) {
-      rh_data->mdb->set_column_names(col_names, num_fields);
-      rh_data->initialized = true;
-   }
-   if (rh_data->result_handler) {
-      (*(rh_data->result_handler))(rh_data->ctx, num_fields, rows);
-   }
-
-   return 0;
-}
-
-/*
- * Submit a general SQL command (cmd), and for each row returned,
- *  the result_handler is called with the ctx.
- */
-bool B_DB_SQLITE::db_sql_query(const char *query, DB_RESULT_HANDLER *result_handler, void *ctx)
-{
-   bool retval = false;
-   int stat;
-   struct rh_data rh_data;
-
-   Dmsg1(500, "db_sql_query starts with '%s'\n", query);
-
-   db_lock(this);
-   if (m_sqlite_errmsg) {
-      sqlite3_free(m_sqlite_errmsg);
-      m_sqlite_errmsg = NULL;
-   }
-   sql_free_result();
-
-   rh_data.ctx = ctx;
-   rh_data.mdb = this;
-   rh_data.initialized = false;
-   rh_data.result_handler = result_handler;
-
-   stat = sqlite3_exec(m_db_handle, query, sqlite_result_handler,
-                       (void *)&rh_data, &m_sqlite_errmsg);
-
-   if (stat != SQLITE_OK) {
-      Mmsg(errmsg, _("Query failed: %s: ERR=%s\n"), query, sql_strerror());
-      Dmsg0(500, "db_sql_query finished\n");
-      goto bail_out;
-   }
-   Dmsg0(500, "db_sql_query finished\n");
-   sql_free_result();
-   retval = true;
-
-bail_out:
-   db_unlock(this);
-   return retval;
-}
-
-/*
- * Submit a sqlite query and retrieve all the data
- */
-bool B_DB_SQLITE::sql_query(const char *query, int flags)
-{
-   int stat;
-   bool retval = false;
-
-   Dmsg1(500, "sql_query starts with '%s'\n", query);
-
-   sql_free_result();
-   if (m_sqlite_errmsg) {
-      sqlite3_free(m_sqlite_errmsg);
-      m_sqlite_errmsg = NULL;
-   }
-
-   stat = sqlite3_get_table(m_db_handle, (char *)query, &m_result,
-                            &m_num_rows, &m_num_fields, &m_sqlite_errmsg);
-
-   m_row_number = 0;               /* no row fetched */
-   if (stat != 0) {                   /* something went wrong */
-      m_num_rows = m_num_fields = 0;
-      Dmsg0(500, "sql_query finished\n");
-   } else {
-      Dmsg0(500, "sql_query finished\n");
-      retval = true;
-   }
-   return retval;
-}
-
-void B_DB_SQLITE::sql_free_result(void)
-{
-   db_lock(this);
-   if (m_fields) {
-      free(m_fields);
-      m_fields = NULL;
-   }
-   if (m_result) {
-      sqlite3_free_table(m_result);
-      m_result = NULL;
-   }
-   m_col_names = NULL;
-   m_num_rows = m_num_fields = 0;
-   db_unlock(this);
-}
-
-/*
- * Fetch one row at a time
- */
-SQL_ROW B_DB_SQLITE::sql_fetch_row(void)
-{
-   if (!m_result || (m_row_number >= m_num_rows)) {
-      return NULL;
-   }
-   m_row_number++;
-   return &m_result[m_num_fields * m_row_number];
-}
-
-const char *B_DB_SQLITE::sql_strerror(void)
-{
-   return m_sqlite_errmsg ? m_sqlite_errmsg : "unknown";
-}
-
-void B_DB_SQLITE::sql_data_seek(int row)
-{
-   /*
-    * Set the row number to be returned on the next call to sql_fetch_row
-    */
-   m_row_number = row;
-}
-
-int B_DB_SQLITE::sql_affected_rows(void)
-{
-   return sqlite3_changes(m_db_handle);
-}
-
-uint64_t B_DB_SQLITE::sql_insert_autokey_record(const char *query, const char *table_name)
-{
-   /*
-    * First execute the insert query and then retrieve the currval.
-    */
-   if (!sql_query(query)) {
-      return 0;
-   }
-
-   m_num_rows = sql_affected_rows();
-   if (m_num_rows != 1) {
-      return 0;
-   }
-
-   changes++;
-
-   return sqlite3_last_insert_rowid(m_db_handle);
-}
-
-SQL_FIELD *B_DB_SQLITE::sql_fetch_field(void)
-{
-   int i, j, len;
-
-   /* We are in the middle of a db_sql_query and we want to get fields info */
-   if (m_col_names != NULL) {
-      if (m_num_fields > m_field_number) {
-         m_sql_field.name = m_col_names[m_field_number];
-         /* We don't have the maximum field length, so we can use 80 as
-          * estimation.
-          */
-         len = MAX(cstrlen(m_sql_field.name), 80/m_num_fields);
-         m_sql_field.max_length = len;
-
-         m_field_number++;
-         m_sql_field.type = 0;  /* not numeric */
-         m_sql_field.flags = 1; /* not null */
-         return &m_sql_field;
-      } else {                  /* too much fetch_field() */
-         return NULL;
-      }
-   }
-
-   /* We are after a sql_query() that stores the result in m_results */
-   if (!m_fields || m_fields_size < m_num_fields) {
-      if (m_fields) {
-         free(m_fields);
-         m_fields = NULL;
-      }
-      Dmsg1(500, "allocating space for %d fields\n", m_num_fields);
-      m_fields = (SQL_FIELD *)malloc(sizeof(SQL_FIELD) * m_num_fields);
-      m_fields_size = m_num_fields;
-
-      for (i = 0; i < m_num_fields; i++) {
-         Dmsg1(500, "filling field %d\n", i);
-         m_fields[i].name = m_result[i];
-         m_fields[i].max_length = cstrlen(m_fields[i].name);
-         for (j = 1; j <= m_num_rows; j++) {
-            if (m_result[i + m_num_fields * j]) {
-               len = (uint32_t)cstrlen(m_result[i + m_num_fields * j]);
-            } else {
-               len = 0;
-            }
-            if (len > m_fields[i].max_length) {
-               m_fields[i].max_length = len;
-            }
-         }
-         m_fields[i].type = 0;
-         m_fields[i].flags = 1;        /* not null */
-
-         Dmsg4(500, "sql_fetch_field finds field '%s' has length='%d' type='%d' and IsNull=%d\n",
-               m_fields[i].name, m_fields[i].max_length, m_fields[i].type, m_fields[i].flags);
-      }
-   }
-
-   /*
-    * Increment field number for the next time around
-    */
-   return &m_fields[m_field_number++];
-}
-
-bool B_DB_SQLITE::sql_field_is_not_null(int field_type)
-{
-   switch (field_type) {
-   case 1:
-      return true;
-   default:
-      return false;
-   }
-}
-
-bool B_DB_SQLITE::sql_field_is_numeric(int field_type)
-{
-   switch (field_type) {
-   case 1:
-      return true;
-   default:
-      return false;
-   }
-}
-
-/*
- * Returns true if OK
- *         false if failed
- */
-bool B_DB_SQLITE::sql_batch_start(JCR *jcr)
-{
-   bool retval;
-
-   db_lock(this);
-   retval = sql_query("CREATE TEMPORARY TABLE batch ("
-                              "FileIndex integer,"
-                              "JobId integer,"
-                              "Path blob,"
-                              "Name blob,"
-                              "LStat tinyblob,"
-                              "MD5 tinyblob,"
-                              "DeltaSeq integer)");
-   db_unlock(this);
-
-   return retval;
-}
-
-/* set error to something to abort operation */
-/*
- * Returns true if OK
- *         false if failed
- */
-bool B_DB_SQLITE::sql_batch_end(JCR *jcr, const char *error)
-{
-   m_status = 0;
-
-   return true;
-}
-
-/*
- * Returns true if OK
- *         false if failed
- */
-bool B_DB_SQLITE::sql_batch_insert(JCR *jcr, ATTR_DBR *ar)
-{
-   const char *digest;
-   char ed1[50];
-
-   esc_name = check_pool_memory_size(esc_name, fnl*2+1);
-   db_escape_string(jcr, esc_name, fname, fnl);
-
-   esc_path = check_pool_memory_size(esc_path, pnl*2+1);
-   db_escape_string(jcr, esc_path, path, pnl);
-
-   if (ar->Digest == NULL || ar->Digest[0] == 0) {
-      digest = "0";
-   } else {
-      digest = ar->Digest;
-   }
-
-   Mmsg(cmd, "INSERT INTO batch VALUES "
-        "(%u,%s,'%s','%s','%s','%s',%u)",
-        ar->FileIndex, edit_int64(ar->JobId,ed1), esc_path,
-        esc_name, ar->attr, digest, ar->DeltaSeq);
-
-   return sql_query(cmd);
-}
-
-/*
- * Initialize database data structure. In principal this should
- * never have errors, or it is really fatal.
- */
-B_DB *db_init_database(JCR *jcr, const char *db_driver, const char *db_name,
-                       const char *db_user, const char *db_password,
-                       const char *db_address, int db_port,
-                       const char *db_socket, bool mult_db_connections,
-                       bool disable_batch_insert)
-{
-   B_DB *mdb = NULL;
-
-   P(mutex);                          /* lock DB queue */
-   /*
-    * Look to see if DB already open
-    */
-   if (db_list && !mult_db_connections) {
-      foreach_dlist(mdb, db_list) {
-         if (mdb->db_match_database(db_driver, db_name, db_address, db_port)) {
-            Dmsg1(300, "DB REopen %s\n", db_name);
-            mdb->increment_refcount();
-            goto bail_out;
-         }
-      }
-   }
-   Dmsg0(300, "db_init_database first time\n");
-   mdb = New(B_DB_SQLITE(jcr, db_driver, db_name, db_user, db_password,
-                         db_address, db_port, db_socket, mult_db_connections,
-                         disable_batch_insert));
-
-bail_out:
-   V(mutex);
-   return mdb;
-}
-
-#endif /* HAVE_SQLITE3 */
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/ 
+/* 
+ * Bacula Catalog Database routines specific to SQLite 
+ * 
+ *    Written by Kern Sibbald, January 2002 
+ * 
+ * Note: at one point, this file was changed to class based by a certain  
+ *  programmer, and other than "wrapping" in a class, which is a trivial 
+ *  change for a C++ programmer, nothing substantial was done, yet all the 
+ *  code was recommitted under this programmer's name.  Consequently, we 
+ *  undo those changes here. 
+ */ 
+ 
+#include "bacula.h" 
+ 
+#if HAVE_SQLITE3  
+ 
+#include "cats.h" 
+#include <sqlite3.h> 
+#define __BDB_SQLITE_H_ 1 
+#include "bdb_sqlite.h" 
+ 
+/* ----------------------------------------------------------------------- 
+ * 
+ *    SQLite dependent defines and subroutines 
+ * 
+ * ----------------------------------------------------------------------- 
+ */ 
+ 
+/* List of open databases */ 
+static dlist *db_list = NULL; 
+ 
+static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; 
+ 
+/* 
+ * When using mult_db_connections 
+ *   sqlite can be BUSY. We just need sleep a little in this case. 
+ */ 
+static int my_sqlite_busy_handler(void *arg, int calls) 
+{  
+   bmicrosleep(0, 500); 
+   return 1; 
+}  
+ 
+BDB_SQLITE::BDB_SQLITE() 
+{  
+   BDB_SQLITE *mdb = this; 
+ 
+   if (db_list == NULL) { 
+      db_list = New(dlist(mdb, &mdb->m_link)); 
+   } 
+   mdb->m_db_driver_type = SQL_DRIVER_TYPE_SQLITE3; 
+   mdb->m_db_type = SQL_TYPE_SQLITE3; 
+   mdb->m_db_driver = bstrdup("SQLite3"); 
+ 
+   mdb->errmsg = get_pool_memory(PM_EMSG); /* get error message buffer */ 
+   mdb->errmsg[0] = 0; 
+   mdb->cmd = get_pool_memory(PM_EMSG);    /* get command buffer */ 
+   mdb->cached_path = get_pool_memory(PM_FNAME); 
+   mdb->cached_path_id = 0; 
+   mdb->m_ref_count = 1; 
+   mdb->fname = get_pool_memory(PM_FNAME); 
+   mdb->path = get_pool_memory(PM_FNAME); 
+   mdb->esc_name = get_pool_memory(PM_FNAME); 
+   mdb->esc_path = get_pool_memory(PM_FNAME); 
+   mdb->esc_obj  = get_pool_memory(PM_FNAME); 
+   mdb->m_use_fatal_jmsg = true; 
+ 
+   /* Initialize the private members. */ 
+   mdb->m_db_handle = NULL; 
+   mdb->m_result = NULL; 
+   mdb->m_sqlite_errmsg = NULL; 
+ 
+   db_list->append(this); 
+}  
+ 
+BDB_SQLITE::~BDB_SQLITE() 
+{  
+}  
+ 
+/* 
+ * Initialize database data structure. In principal this should 
+ * never have errors, or it is really fatal. 
+ */ 
+BDB *db_init_database(JCR *jcr, const char *db_driver, const char *db_name, 
+                       const char *db_user, const char *db_password, 
+                       const char *db_address, int db_port, 
+                       const char *db_socket, bool mult_db_connections, 
+                       bool disable_batch_insert) 
+{  
+   BDB_SQLITE *mdb = NULL; 
+ 
+   P(mutex);                          /* lock DB queue */ 
+   /* 
+    * Look to see if DB already open 
+    */ 
+   if (db_list && !mult_db_connections) { 
+      foreach_dlist(mdb, db_list) { 
+         if (mdb->bdb_match_database(db_driver, db_name, db_address, db_port)) { 
+            Dmsg1(300, "DB REopen %s\n", db_name); 
+            mdb->increment_refcount(); 
+            goto bail_out; 
+         } 
+      } 
+   } 
+   Dmsg0(300, "db_init_database first time\n"); 
+   mdb = New(BDB_SQLITE()); 
+ 
+   mdb->m_db_name = bstrdup(db_name); 
+   if (disable_batch_insert) { 
+      mdb->m_disabled_batch_insert = true; 
+      mdb->m_have_batch_insert = false; 
+   } else { 
+      mdb->m_disabled_batch_insert = false; 
+#ifdef USE_BATCH_FILE_INSERT 
+#ifdef HAVE_SQLITE3_THREADSAFE 
+      mdb->m_have_batch_insert = sqlite3_threadsafe(); 
+#else 
+      mdb->m_have_batch_insert = false; 
+#endif /* HAVE_SQLITE3_THREADSAFE */ 
+#else 
+      mdb->m_have_batch_insert = false; 
+#endif /* USE_BATCH_FILE_INSERT */ 
+   } 
+   mdb->m_allow_transactions = mult_db_connections; 
+ 
+   /* At this time, when mult_db_connections == true, this is for 
+    * specific console command such as bvfs or batch mode, and we don't 
+    * want to share a batch mode or bvfs. In the future, we can change 
+    * the creation function to add this parameter. 
+    */ 
+   mdb->m_dedicated = mult_db_connections; 
+ 
+bail_out: 
+   V(mutex); 
+   return mdb; 
+}  
+ 
+ 
+/* 
+ * Now actually open the database.  This can generate errors, 
+ * which are returned in the errmsg 
+ * 
+ * DO NOT close the database or delete mdb here !!!! 
+ */ 
+bool BDB_SQLITE::bdb_open_database(JCR *jcr) 
+{  
+   bool retval = false; 
+   char *db_file; 
+   int len; 
+   struct stat statbuf; 
+   int ret; 
+   int errstat; 
+   int retry = 0; 
+   int64_t starttime; 
+   BDB_SQLITE *mdb = this; 
+ 
+   P(mutex); 
+   if (mdb->m_connected) { 
+      retval = true; 
+      goto bail_out; 
+   } 
+ 
+   if ((errstat=rwl_init(&mdb->m_lock)) != 0) { 
+      berrno be; 
+      Mmsg1(&mdb->errmsg, _("Unable to initialize DB lock. ERR=%s\n"), 
+            be.bstrerror(errstat)); 
+      goto bail_out; 
+   } 
+ 
+   /* 
+    * Open the database 
+    */ 
+   len = strlen(working_directory) + strlen(mdb->m_db_name) + 5; 
+   db_file = (char *)malloc(len); 
+   strcpy(db_file, working_directory); 
+   strcat(db_file, "/"); 
+   strcat(db_file, m_db_name); 
+   strcat(db_file, ".db"); 
+   if (stat(db_file, &statbuf) != 0) { 
+      Mmsg1(&mdb->errmsg, _("Database %s does not exist, please create it.\n"), 
+         db_file); 
+      free(db_file); 
+      goto bail_out; 
+   } 
+ 
+   for (mdb->m_db_handle = NULL; !mdb->m_db_handle && retry++ < 10; ) { 
+      ret = sqlite3_open(db_file, &mdb->m_db_handle); 
+      if (ret != SQLITE_OK) { 
+         mdb->m_sqlite_errmsg = (char *)sqlite3_errmsg(mdb->m_db_handle); 
+         sqlite3_close(mdb->m_db_handle); 
+         mdb->m_db_handle = NULL; 
+      } else { 
+         mdb->m_sqlite_errmsg = NULL; 
+      } 
+ 
+      Dmsg0(300, "sqlite_open\n"); 
+      if (!mdb->m_db_handle) { 
+         bmicrosleep(1, 0); 
+      } 
+   } 
+   if (mdb->m_db_handle == NULL) { 
+      Mmsg2(&mdb->errmsg, _("Unable to open Database=%s. ERR=%s\n"), 
+         db_file, mdb->m_sqlite_errmsg ? mdb->m_sqlite_errmsg : _("unknown")); 
+      free(db_file); 
+      goto bail_out; 
+   } 
+   mdb->m_connected = true; 
+   free(db_file); 
+ 
+   /* 
+    * Set busy handler to wait when we use mult_db_connections = true 
+    */ 
+   sqlite3_busy_handler(mdb->m_db_handle, my_sqlite_busy_handler, NULL); 
+ 
+#if defined(SQLITE3_INIT_QUERY) 
+   sql_query(SQLITE3_INIT_QUERY); 
+#endif 
+ 
+   if (!bdb_check_version(jcr)) { 
+      goto bail_out; 
+   } 
+ 
+   retval = true; 
+ 
+bail_out: 
+   V(mutex); 
+   return retval; 
+}  
+ 
+void BDB_SQLITE::bdb_close_database(JCR *jcr) 
+{  
+   BDB_SQLITE *mdb = this; 
+ 
+   if (mdb->m_connected) { 
+      bdb_end_transaction(jcr); 
+   } 
+   P(mutex); 
+   mdb->m_ref_count--; 
+   if (mdb->m_ref_count == 0) { 
+      if (mdb->m_connected) { 
+         sql_free_result(); 
+      } 
+      db_list->remove(mdb); 
+      if (mdb->m_connected && mdb->m_db_handle) { 
+         sqlite3_close(mdb->m_db_handle); 
+      } 
+      if (is_rwl_valid(&mdb->m_lock)) { 
+         rwl_destroy(&mdb->m_lock); 
+      } 
+      free_pool_memory(mdb->errmsg); 
+      free_pool_memory(mdb->cmd); 
+      free_pool_memory(mdb->cached_path); 
+      free_pool_memory(mdb->fname); 
+      free_pool_memory(mdb->path); 
+      free_pool_memory(mdb->esc_name); 
+      free_pool_memory(mdb->esc_path); 
+      free_pool_memory(mdb->esc_obj); 
+      if (mdb->m_db_driver) { 
+         free(mdb->m_db_driver); 
+      } 
+      if (mdb->m_db_name) { 
+         free(mdb->m_db_name); 
+      } 
+      delete this; 
+      if (db_list->size() == 0) { 
+         delete db_list; 
+         db_list = NULL; 
+      } 
+   } 
+   V(mutex); 
+}  
+ 
+void BDB_SQLITE::bdb_thread_cleanup(void) 
+{  
+   sqlite3_thread_cleanup(); 
+}  
+ 
+/* 
+ * Escape strings so SQLite is happy 
+ * 
+ * len is the length of the old string. Your new 
+ *   string must be long enough (max 2*old+1) to hold 
+ *   the escaped output. 
+ */ 
+void BDB_SQLITE::bdb_escape_string(JCR *jcr, char *snew, char *sold, int len) 
+{  
+   char *n, *o; 
+ 
+   n = snew; 
+   o = sold; 
+   while (len--) { 
+      switch (*o) { 
+      case '\'': 
+         *n++ = '\''; 
+         *n++ = '\''; 
+         o++; 
+         break; 
+      case 0: 
+         *n++ = '\\'; 
+         *n++ = 0; 
+         o++; 
+         break; 
+      default: 
+         *n++ = *o++; 
+         break; 
+      } 
+   } 
+   *n = 0; 
+}  
+ 
+/* 
+ * Escape binary object so that SQLite is happy 
+ * Memory is stored in BDB struct, no need to free it 
+ * 
+ * TODO: this should be implemented  (escape \0) 
+ */ 
+char *BDB_SQLITE::bdb_escape_object(JCR *jcr, char *old, int len) 
+{  
+   int l; 
+   int max = len*2;           /* TODO: too big, should be *4/3 */ 
+ 
+   esc_obj = check_pool_memory_size(esc_obj, max); 
+   l = bin_to_base64(esc_obj, max, old, len, true); 
+   esc_obj[l] = 0; 
+   ASSERT(l < max);    /* TODO: add check for l */ 
+ 
+   return esc_obj; 
+}  
+ 
+/* 
+ * Unescape binary object so that SQLIte is happy 
+ * 
+ * TODO: need to be implemented (escape \0) 
+ */ 
+ 
+void BDB_SQLITE::bdb_unescape_object(JCR *jcr, char *from, int32_t expected_len, 
+                                     POOLMEM **dest, int32_t *dest_len) 
+{  
+   if (!from) { 
+      *dest[0] = 0; 
+      *dest_len = 0; 
+      return; 
+   } 
+   *dest = check_pool_memory_size(*dest, expected_len+1); 
+   base64_to_bin(*dest, expected_len+1, from, strlen(from)); 
+   *dest_len = expected_len; 
+   (*dest)[expected_len] = 0; 
+}  
+ 
+/* 
+ * Start a transaction. This groups inserts and makes things 
+ *  more efficient. Usually started when inserting file attributes. 
+ */ 
+void BDB_SQLITE::bdb_start_transaction(JCR *jcr) 
+{  
+   BDB_SQLITE *mdb = this; 
+ 
+   if (!jcr->attr) { 
+      jcr->attr = get_pool_memory(PM_FNAME); 
+   } 
+   if (!jcr->ar) { 
+      jcr->ar = (ATTR_DBR *)malloc(sizeof(ATTR_DBR)); 
+   } 
+ 
+   if (!mdb->m_allow_transactions) { 
+      return; 
+   } 
+ 
+   bdb_lock(); 
+   /* 
+    * Allow only 10,000 changes per transaction 
+    */ 
+   if (mdb->m_transaction && mdb->changes > 10000) { 
+      bdb_end_transaction(jcr); 
+   } 
+   if (!mdb->m_transaction) { 
+      sql_query("BEGIN");                  /* begin transaction */ 
+      Dmsg0(400, "Start SQLite transaction\n"); 
+      mdb->m_transaction = true; 
+   } 
+   bdb_unlock(); 
+}  
+ 
+void BDB_SQLITE::bdb_end_transaction(JCR *jcr) 
+{  
+   BDB_SQLITE *mdb = this; 
+ 
+   if (jcr && jcr->cached_attribute) { 
+      Dmsg0(400, "Flush last cached attribute.\n"); 
+      if (!bdb_create_attributes_record(jcr, jcr->ar)) { 
+         Jmsg1(jcr, M_FATAL, 0, _("Attribute create error. %s"), jcr->db->bdb_strerror()); 
+      } 
+      jcr->cached_attribute = false; 
+   } 
+ 
+   if (!mdb->m_allow_transactions) { 
+      return; 
+   } 
+ 
+   bdb_lock(); 
+   if (mdb->m_transaction) { 
+      sql_query("COMMIT"); /* end transaction */ 
+      mdb->m_transaction = false; 
+      Dmsg1(400, "End SQLite transaction changes=%d\n", changes); 
+   } 
+   mdb->changes = 0; 
+   bdb_unlock(); 
+}  
+ 
+struct rh_data { 
+   BDB_SQLITE *mdb; 
+   DB_RESULT_HANDLER *result_handler; 
+   void *ctx; 
+   bool initialized; 
+}; 
+ 
+/* 
+ * Convert SQLite's callback into Bacula DB callback 
+ */ 
+static int sqlite_result_handler(void *arh_data, int num_fields, char **rows, char **col_names) 
+{  
+   struct rh_data *rh_data = (struct rh_data *)arh_data; 
+ 
+   /* The db_sql_query doesn't have access to m_results, so if we wan't to get 
+    * fields information, we need to use col_names 
+    */ 
+   if (!rh_data->initialized) { 
+      rh_data->mdb->set_column_names(col_names, num_fields); 
+      rh_data->initialized = true; 
+   } 
+   if (rh_data->result_handler) { 
+      (*(rh_data->result_handler))(rh_data->ctx, num_fields, rows); 
+   } 
+ 
+   return 0; 
+}  
+ 
+/* 
+ * Submit a general SQL command (cmd), and for each row returned, 
+ *  the result_handler is called with the ctx. 
+ */ 
+bool BDB_SQLITE::bdb_sql_query(const char *query, DB_RESULT_HANDLER *result_handler, void *ctx) 
+{  
+   BDB_SQLITE *mdb = this; 
+   bool retval = false; 
+   int stat; 
+   struct rh_data rh_data; 
+ 
+   Dmsg1(500, "db_sql_query starts with '%s'\n", query); 
+ 
+   bdb_lock(); 
+   mdb->errmsg[0] = 0; 
+   if (mdb->m_sqlite_errmsg) { 
+      sqlite3_free(mdb->m_sqlite_errmsg); 
+      mdb->m_sqlite_errmsg = NULL; 
+   } 
+   sql_free_result(); 
+ 
+   rh_data.ctx = ctx; 
+   rh_data.mdb = this; 
+   rh_data.initialized = false; 
+   rh_data.result_handler = result_handler; 
+ 
+   stat = sqlite3_exec(m_db_handle, query, sqlite_result_handler, 
+                       (void *)&rh_data, &m_sqlite_errmsg); 
+ 
+   if (stat != SQLITE_OK) { 
+      Mmsg(mdb->errmsg, _("Query failed: %s: ERR=%s\n"), query, sql_strerror()); 
+      Dmsg0(500, "db_sql_query finished\n"); 
+      goto bail_out; 
+   } 
+   Dmsg0(500, "db_sql_query finished\n"); 
+   sql_free_result(); 
+   retval = true; 
+ 
+bail_out: 
+   bdb_unlock(); 
+   return retval; 
+}  
+ 
+/* 
+ * Submit a sqlite query and retrieve all the data 
+ */ 
+bool BDB_SQLITE::sql_query(const char *query, int flags) 
+{  
+   int stat; 
+   bool retval = false; 
+   BDB_SQLITE *mdb = this; 
+ 
+   Dmsg1(500, "sql_query starts with '%s'\n", query); 
+ 
+   sql_free_result(); 
+   if (mdb->m_sqlite_errmsg) { 
+      sqlite3_free(mdb->m_sqlite_errmsg); 
+      mdb->m_sqlite_errmsg = NULL; 
+   } 
+ 
+   stat = sqlite3_get_table(m_db_handle, (char *)query, &m_result, 
+                            &m_num_rows, &m_num_fields, &m_sqlite_errmsg); 
+ 
+   mdb->m_row_number = 0;               /* no row fetched */ 
+   if (stat != 0) {                     /* something went wrong */ 
+      mdb->m_num_rows = mdb->m_num_fields = 0; 
+      Dmsg0(500, "sql_query finished\n"); 
+   } else { 
+      Dmsg0(500, "sql_query finished\n"); 
+      retval = true; 
+   } 
+   return retval; 
+}  
+ 
+void BDB_SQLITE::sql_free_result(void) 
+{  
+   BDB_SQLITE *mdb = this; 
+ 
+   bdb_lock(); 
+   if (mdb->m_fields) { 
+      free(mdb->m_fields); 
+      mdb->m_fields = NULL; 
+   } 
+   if (mdb->m_result) { 
+      sqlite3_free_table(mdb->m_result); 
+      mdb->m_result = NULL; 
+   } 
+   mdb->m_col_names = NULL; 
+   mdb->m_num_rows = mdb->m_num_fields = 0; 
+   bdb_unlock(); 
+}  
+ 
+/* 
+ * Fetch one row at a time 
+ */ 
+SQL_ROW BDB_SQLITE::sql_fetch_row(void) 
+{  
+   BDB_SQLITE *mdb = this; 
+   if (!mdb->m_result || (mdb->m_row_number >= mdb->m_num_rows)) { 
+      return NULL; 
+   } 
+   mdb->m_row_number++; 
+   return &mdb->m_result[mdb->m_num_fields * mdb->m_row_number]; 
+}  
+ 
+const char *BDB_SQLITE::sql_strerror(void) 
+{  
+   BDB_SQLITE *mdb = this; 
+   return mdb->m_sqlite_errmsg ? mdb->m_sqlite_errmsg : "unknown"; 
+}  
+ 
+void BDB_SQLITE::sql_data_seek(int row) 
+{  
+   BDB_SQLITE *mdb = this; 
+   /* Set the row number to be returned on the next call to sql_fetch_row  */ 
+   mdb->m_row_number = row; 
+}  
+ 
+int BDB_SQLITE::sql_affected_rows(void) 
+{  
+   BDB_SQLITE *mdb = this; 
+   return sqlite3_changes(mdb->m_db_handle); 
+}  
+ 
+uint64_t BDB_SQLITE::sql_insert_autokey_record(const char *query, const char *table_name) 
+{  
+   BDB_SQLITE *mdb = this; 
+   /* First execute the insert query and then retrieve the currval.  */ 
+   if (!sql_query(query)) { 
+      return 0; 
+   } 
+ 
+   mdb->m_num_rows = sql_affected_rows(); 
+   if (mdb->m_num_rows != 1) { 
+      return 0; 
+   } 
+ 
+   mdb->changes++; 
+ 
+   return sqlite3_last_insert_rowid(mdb->m_db_handle); 
+}  
+ 
+SQL_FIELD *BDB_SQLITE::sql_fetch_field(void) 
+{  
+   BDB_SQLITE *mdb = this; 
+   int i, j, len; 
+ 
+   /* We are in the middle of a db_sql_query and we want to get fields info */ 
+   if (mdb->m_col_names != NULL) { 
+      if (mdb->m_num_fields > mdb->m_field_number) { 
+         mdb->m_sql_field.name = mdb->m_col_names[mdb->m_field_number]; 
+         /* We don't have the maximum field length, so we can use 80 as 
+          * estimation. 
+          */ 
+         len = MAX(cstrlen(mdb->m_sql_field.name), 80/mdb->m_num_fields); 
+         mdb->m_sql_field.max_length = len; 
+ 
+         mdb->m_field_number++; 
+         mdb->m_sql_field.type = 0;  /* not numeric */ 
+         mdb->m_sql_field.flags = 1; /* not null */ 
+         return &mdb->m_sql_field; 
+      } else {                  /* too much fetch_field() */ 
+         return NULL; 
+      } 
+   } 
+ 
+   /* We are after a sql_query() that stores the result in m_results */ 
+   if (!mdb->m_fields || mdb->m_fields_size < mdb->m_num_fields) { 
+      if (mdb->m_fields) { 
+         free(mdb->m_fields); 
+         mdb->m_fields = NULL; 
+      } 
+      Dmsg1(500, "allocating space for %d fields\n", m_num_fields); 
+      mdb->m_fields = (SQL_FIELD *)malloc(sizeof(SQL_FIELD) * mdb->m_num_fields); 
+      mdb->m_fields_size = mdb->m_num_fields; 
+ 
+      for (i = 0; i < mdb->m_num_fields; i++) { 
+         Dmsg1(500, "filling field %d\n", i); 
+         mdb->m_fields[i].name = mdb->m_result[i]; 
+         mdb->m_fields[i].max_length = cstrlen(mdb->m_fields[i].name); 
+         for (j = 1; j <= mdb->m_num_rows; j++) { 
+            if (mdb->m_result[i + mdb->m_num_fields * j]) { 
+               len = (uint32_t)cstrlen(mdb->m_result[i + mdb->m_num_fields * j]); 
+            } else { 
+               len = 0; 
+            } 
+            if (len > mdb->m_fields[i].max_length) { 
+               mdb->m_fields[i].max_length = len; 
+            } 
+         } 
+         mdb->m_fields[i].type = 0; 
+         mdb->m_fields[i].flags = 1;        /* not null */ 
+ 
+         Dmsg4(500, "sql_fetch_field finds field '%s' has length='%d' type='%d' and IsNull=%d\n", 
+               mdb->m_fields[i].name, mdb->m_fields[i].max_length, mdb->m_fields[i].type, mdb->m_fields[i].flags); 
+      } 
+   } 
+ 
+   /* Increment field number for the next time around */ 
+   return &mdb->m_fields[mdb->m_field_number++]; 
+}  
+ 
+bool BDB_SQLITE::sql_field_is_not_null(int field_type) 
+{  
+   if (field_type == 1) { 
+      return true; 
+   } 
+   return false; 
+}  
+ 
+bool BDB_SQLITE::sql_field_is_numeric(int field_type) 
+{  
+   if (field_type == 1) { 
+      return true; 
+   } 
+   return false; 
+}  
+ 
+/* 
+ * Returns true  if OK 
+ *         false if failed 
+ */ 
+bool BDB_SQLITE::sql_batch_start(JCR *jcr) 
+{  
+   bool ret; 
+ 
+   bdb_lock(); 
+   ret = sql_query("CREATE TEMPORARY TABLE batch ("
+                   "FileIndex integer,"
+                   "JobId integer,"
+                   "Path blob,"
+                   "Name blob,"
+                   "LStat tinyblob,"
+                   "MD5 tinyblob,"
+                   "DeltaSeq integer)"); 
+   bdb_unlock(); 
+ 
+   return ret; 
+}  
+ 
+/* Set error to something to abort operation */ 
+/* 
+ * Returns true  if OK 
+ *         false if failed 
+ */ 
+bool BDB_SQLITE::sql_batch_end(JCR *jcr, const char *error) 
+{  
+   m_status = 0; 
+   return true; 
+}  
+ 
+/* 
+ * Returns true  if OK 
+ *         false if failed 
+ */ 
+bool BDB_SQLITE::sql_batch_insert(JCR *jcr, ATTR_DBR *ar) 
+{  
+   BDB_SQLITE *mdb = this; 
+   const char *digest; 
+   char ed1[50]; 
+ 
+   mdb->esc_name = check_pool_memory_size(mdb->esc_name, mdb->fnl*2+1); 
+   bdb_escape_string(jcr, mdb->esc_name, mdb->fname, mdb->fnl); 
+ 
+   mdb->esc_path = check_pool_memory_size(mdb->esc_path, mdb->pnl*2+1); 
+   bdb_escape_string(jcr, mdb->esc_path, mdb->path, mdb->pnl); 
+ 
+   if (ar->Digest == NULL || ar->Digest[0] == 0) { 
+      digest = "0"; 
+   } else { 
+      digest = ar->Digest; 
+   } 
+ 
+   Mmsg(mdb->cmd, "INSERT INTO batch VALUES " 
+        "(%u,%s,'%s','%s','%s','%s',%u)", 
+        ar->FileIndex, edit_int64(ar->JobId,ed1), mdb->esc_path, 
+        mdb->esc_name, ar->attr, digest, ar->DeltaSeq); 
+ 
+   return sql_query(mdb->cmd); 
+}  
+ 
+ 
+#endif /* HAVE_SQLITE3 */ 
diff --git a/src/cats/sqlite.in b/src/cats/sqlite.in
index 425e2d9..61c23ae 100644
--- a/src/cats/sqlite.in
+++ b/src/cats/sqlite.in
@@ -1,21 +1,9 @@
 #!/bin/sh
 #
-# shell script to invoke SQLite on Bacula database
-#
-#  Bacula® - The Network Backup Solution
-#
-#  Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
-#
-#  The main author of Bacula is Kern Sibbald, with contributions from many
-#  others, a complete list can be found in the file AUTHORS.
-#
-#  You may use this file and others of this release according to the
-#  license defined in the LICENSE file, which includes the Affero General
-#  Public License, v3.0 ("AGPLv3") and some additional permissions and
-#  terms pursuant to its AGPLv3 Section 7.
-#
-#  Bacula® is a registered trademark of Kern Sibbald.
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #
+# shell script to invoke SQLite on Bacula database
 
 bindir=@SQLITE_BINDIR@
 db_name=@db_name@
diff --git a/src/cats/update_bacula_tables.in b/src/cats/update_bacula_tables.in
index 334b391..1249077 100755
--- a/src/cats/update_bacula_tables.in
+++ b/src/cats/update_bacula_tables.in
@@ -1,23 +1,14 @@
 #!/bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # This routine alters the appropriately configured
 # Bacula tables for PostgreSQL, Ingres, MySQL, or SQLite.
 #
-#
-#  Bacula® - The Network Backup Solution
-#
-#  Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
-#
-#  The main author of Bacula is Kern Sibbald, with contributions from many
-#  others, a complete list can be found in the file AUTHORS.
-#
-#  You may use this file and others of this release according to the
-#  license defined in the LICENSE file, which includes the Affero General
-#  Public License, v3.0 ("AGPLv3") and some additional permissions and
-#  terms pursuant to its AGPLv3 Section 7.
-#
-#  Bacula® is a registered trademark of Kern Sibbald.
-#
+
+# can be used to change the current user with su
+pre_command="sh -c"
 
 default_db_type=@DEFAULT_DB_TYPE@
 
@@ -39,10 +30,6 @@ if [ $# -gt 0 ]; then
        db_type=$1
        shift
        ;;
-     ingres)
-       db_type=$1
-       shift
-       ;;
      *)
        ;;
    esac
@@ -55,5 +42,9 @@ if [ -z "${db_type}" ]; then
    db_type="${default_db_type}"
 fi
 
+if [ $db_type = postgresql -a "$UID" = 0 ]; then
+    pre_command="su - postgres -c"
+fi
+
 echo "Altering ${db_type} tables"
- at scriptdir@/update_${db_type}_tables $*
+$pre_command "@scriptdir@/update_${db_type}_tables $*"
diff --git a/src/cats/update_mysql_tables.in b/src/cats/update_mysql_tables.in
index 5dca6e9..f2862fe 100644
--- a/src/cats/update_mysql_tables.in
+++ b/src/cats/update_mysql_tables.in
@@ -1,43 +1,59 @@
 #!/bin/sh
 #
-# Shell script to update MySQL Community version 5.0.x to 5.2.x
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #
+# Shell script to update MySQL tables from Bacula Community version 
+#  5.0.x, 5.2.x, 7.0.x
 #
-#  Bacula® - The Network Backup Solution
-#
-#  Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
-#
-#  The main author of Bacula is Kern Sibbald, with contributions from many
-#  others, a complete list can be found in the file AUTHORS.
-#
-#  You may use this file and others of this release according to the
-#  license defined in the LICENSE file, which includes the Affero General
-#  Public License, v3.0 ("AGPLv3") and some additional permissions and
-#  terms pursuant to its AGPLv3 Section 7.
-#
-#  Bacula® is a registered trademark of Kern Sibbald.
-#
-
 echo " "
-echo "This script will update a Bacula MySQL database from version 12 to 14"
-echo " which is needed to convert from Bacula Community version 5.0.x to 5.2.x"
+echo "This script will update a Bacula MySQL database from version 12-14 to 15"
 echo " "
+echo "Depending on the current version of your catalog, you may have to run this script"
+echo "	multiple times"
+echo " "
+
 bindir=@MYSQL_BINDIR@
 PATH="$bindir:$PATH"
-db_name=${db_name:- at db_name@}
-
-mysql -D ${db_name} $* -e "select VersionId from Version\G" >/tmp/$$
-DBVERSION=`sed -n -e 's/^VersionId: \(.*\)$/\1/p' /tmp/$$`
-if [ $DBVERSION != 12 ] ; then
-   echo " "
-   echo "The existing database is version $DBVERSION !!"
-   echo "This script can only update an existing version 12 database to version 14."
-   echo "Error. Cannot upgrade this database."
-   echo " "
-   exit 1
+db_name=@db_name@
+
+ARGS=$*
+
+getVersion()
+{
+    mysql $ARGS -D ${db_name} -e "select VersionId from Version LIMIT 1\G" >/tmp/$$
+    DBVERSION=`sed -n -e 's/^VersionId: \(.*\)$/\1/p' /tmp/$$`
+}
+
+getVersion
+
+if [ "x$DBVERSION" = x ]; then
+    echo
+    echo "Unable to detect database version, you can specify connection information"
+    echo "on the command line."
+    echo "Error. Cannot upgrade this database."
+    exit 1
 fi
 
-if mysql -D ${db_name} $* -f <<END-OF-DATA
+if [ "$DBVERSION" -lt 12 -o "$DBVERSION" -gt 14 ] ; then
+    echo " "
+    echo "The existing database is version $DBVERSION !!"
+    echo "This script can only update an existing version 12-14 version 15."
+    echo "Error. Cannot upgrade this database."
+    echo " "
+    exit 1
+fi
+
+# For all versions, we need to create the Index on Media(StorageId)
+# It may fail, but it's not a big problem
+# mysql $* -f <<END-OF-DATA >/dev/null 2> /dev/null
+# CREATE INDEX media_storageid_idx ON Media (StorageId);
+# END-OF-DATA
+
+if [ "$DBVERSION" -eq 12 ] ; then
+    if mysql $* -f <<END-OF-DATA
+USE ${db_name};
+
 CREATE TABLE RestoreObject (
    RestoreObjectId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
    ObjectName BLOB NOT NULL,
@@ -55,16 +71,79 @@ CREATE TABLE RestoreObject (
 );
 
 CREATE INDEX jobhisto_jobid_idx ON JobHisto (JobId);
+UPDATE Version SET VersionId=13;
+
+END-OF-DATA
+    then
+	echo "Update of Bacula MySQL tables from 12 to 13 succeeded."
+	getVersion
+    else
+	echo "Update of Bacula MySQL tables from 12 to 13 failed."
+	exit 1
+    fi
+fi
+
+if [ "$DBVERSION" -eq 13 ] ; then
+    if mysql $* -f <<END-OF-DATA
+USE ${db_name};
 
 ALTER TABLE File ADD COLUMN DeltaSeq smallint default 0;
+UPDATE Version SET VersionId=14;
+
+END-OF-DATA
+    then
+	echo "Update of Bacula MySQL tables from 13 to 14 succeeded."
+	getVersion
+    else
+	echo "Update of Bacula MySQL tables from 13 to 14 failed."
+	exit 1
+    fi
+fi
+
+if [ "$DBVERSION" -eq 14 ] ; then
+    if mysql $* -f <<END-OF-DATA
+USE ${db_name};
 
-DELETE FROM Version;
-INSERT INTO Version (VersionId) VALUES (14);
+INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES
+   ('I', 'Incomplete Job',25);
+ALTER TABLE Media ADD COLUMN VolABytes BIGINT UNSIGNED DEFAULT 0;
+ALTER TABLE Media ADD COLUMN VolAPadding BIGINT UNSIGNED DEFAULT 0;
+ALTER TABLE Media ADD COLUMN VolHoleBytes BIGINT UNSIGNED DEFAULT 0;
+ALTER TABLE Media ADD COLUMN VolHoles INTEGER UNSIGNED DEFAULT 0;
+ALTER TABLE Media CHANGE VolWrites VolWrites BIGINT UNSIGNED;
 
+CREATE TABLE Snapshot (
+  SnapshotId	  INTEGER UNSIGNED AUTO_INCREMENT,
+  Name		  TINYBLOB NOT NULL,
+  JobId 	  INTEGER UNSIGNED DEFAULT 0,
+  FileSetId	  INTEGER UNSIGNED DEFAULT 0,
+  CreateTDate	  BIGINT   NOT NULL,
+  CreateDate	  DATETIME NOT NULL,
+  ClientId	  INTEGER UNSIGNED DEFAULT 0,
+  Volume	  TINYBLOB NOT NULL,
+  Device	  TINYBLOB NOT NULL,
+  Type		  TINYBLOB NOT NULL,
+  Retention	  INTEGER DEFAULT 0,
+  Comment	  BLOB,
+  primary key (SnapshotId)
+);
+
+CREATE UNIQUE INDEX snapshot_idx ON Snapshot (Device(255), Volume(255), Name(255));
+
+CREATE INDEX jobtdate_idx on JobHisto (JobTDate);
+
+UPDATE Version SET VersionId=15;
 END-OF-DATA
-then
-   echo "Update of Bacula MySQL tables succeeded."
-else
-   echo "Update of Bacula MySQL tables failed."
+    then
+	echo "Update of Bacula MySQL tables from 14 to 15 succeeded."
+	getVersion
+    else
+	echo "Update of Bacula MySQL tables from 14 to 15 failed."
+	exit 1
+    fi
 fi
+
+
+END-OF-DATA
+
 exit 0
diff --git a/src/cats/update_postgresql_tables.in b/src/cats/update_postgresql_tables.in
index a24d3a9..6681046 100644
--- a/src/cats/update_postgresql_tables.in
+++ b/src/cats/update_postgresql_tables.in
@@ -1,44 +1,51 @@
 #!/bin/sh
 #
-# Shell script to update PostgreSQL tables from version 12 to 14
-#  or Bacula Community version 5.0.x to 5.2.x
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #
+# Shell script to update MySQL tables from Bacula Community version 
+#  5.0.x, 5.2.x, 7.0.x
 #
-#  Bacula® - The Network Backup Solution
-#
-#  Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
-#
-#  The main author of Bacula is Kern Sibbald, with contributions from many
-#  others, a complete list can be found in the file AUTHORS.
-#
-#  You may use this file and others of this release according to the
-#  license defined in the LICENSE file, which includes the Affero General
-#  Public License, v3.0 ("AGPLv3") and some additional permissions and
-#  terms pursuant to its AGPLv3 Section 7.
-#
-#  Bacula® is a registered trademark of Kern Sibbald.
-#
-
 echo " "
-echo "This script will update a Bacula PostgreSQL database from version 12 to 14"
-echo "	which is needed to convert from Bacula Community version 5.0.x to 5.2.x"
+echo "This script will update a Bacula MySQL database from version 12-14 to 15"
+echo " "
+echo "Depending on the current version of your catalog, you may have to run this script"
+echo "	multiple times"
 echo " "
 
 bindir=@POSTGRESQL_BINDIR@
 PATH="$bindir:$PATH"
 db_name=@db_name@
 
-DBVERSION=`psql -d ${db_name} -t --pset format=unaligned -c "select VersionId from Version" $*`
-if [ $DBVERSION != 12 ] ; then
-   echo " "
-   echo "The existing database is version $DBVERSION !!"
-   echo "This script can only update an existing version 12 database to version 14."
-   echo "Error. Cannot upgrade this database."
-   echo " "
-   exit 1
+ARGS=$*
+
+getVersion()
+{
+    DBVERSION=`psql -d ${db_name} -t --pset format=unaligned -c "select VersionId from Version LIMIT 1" $ARGS`
+}
+
+getVersion
+
+if [ "x$DBVERSION" = x ]; then
+    echo
+    echo "Unable to detect database version, you can specify connection information"
+    echo "on the command line."
+    echo "Error. Cannot upgrade this database."
+    exit 1
+fi
+
+if [ "$DBVERSION" -lt 12 -o "$DBVERSION" -gt 14 ] ; then
+    echo " "
+    echo "The existing database is version $DBVERSION !!"
+    echo "This script can only update an existing version 12-14, 1014-1016 database to version 1017."
+    echo "Error. Cannot upgrade this database."
+    echo " "
+    exit 1
 fi
 
-if psql -f - -d ${db_name} $* <<END-OF-DATA
+if [ "$DBVERSION" -eq 12 ] ; then
+    # from 5.0
+    if psql -f - -d ${db_name} $* <<END-OF-DATA
 BEGIN; -- Necessary for Bacula core
 CREATE TABLE RestoreObject (
    RestoreObjectId SERIAL NOT NULL,
@@ -54,22 +61,90 @@ CREATE TABLE RestoreObject (
    ObjectCompression INTEGER DEFAULT 0,
    PRIMARY KEY(RestoreObjectId)
    );
+
 CREATE INDEX restore_jobid_idx on RestoreObject(JobId);
+UPDATE Version SET VersionId=12;
+
+COMMIT;
+END-OF-DATA
+    then
+	echo "Update of Bacula PostgreSQL tables 12 to 13 succeeded."
+	getVersion
+    else
+	echo "Update of Bacula PostgreSQL tables 12 to 13 failed."
+	exit 1
+    fi
+fi
+
+if [ "$DBVERSION" -eq 13 ] ; then
+    # from 4.0
+    if psql -f - -d ${db_name} $* <<END-OF-DATA
+BEGIN; -- Necessary for Bacula core
 
 ALTER TABLE File ADD COLUMN DeltaSeq smallint default 0;
 
 UPDATE Version SET VersionId=14;
 COMMIT;
 
-set client_min_messages = fatal;
-CREATE INDEX media_poolid_idx on Media (PoolId);
+-- ANALYSE;
+
+END-OF-DATA
+    then
+	echo "Update of Bacula PostgreSQL tables from 13 to 14 succeeded."
+	getVersion
+    else
+	echo "Update of Bacula PostgreSQL tables failed."
+	exit 1
+    fi
+fi
 
-ANALYSE;
+
+if [ "$DBVERSION" -eq 14 ] ; then
+    # from 5.2
+    if psql -f - -d ${db_name} $* <<END-OF-DATA
+INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES
+   ('I', 'Incomplete Job',25);
+ALTER TABLE Media ADD COLUMN volabytes bigint default 0;
+ALTER TABLE Media ADD COLUMN volapadding bigint default 0;
+ALTER TABLE Media ADD COLUMN volholebytes bigint default 0;
+ALTER TABLE Media ADD COLUMN volholes integer default 0;
+ALTER TABLE Media ALTER VolWrites TYPE BIGINT;
+
+CREATE TABLE Snapshot (
+  SnapshotId	  serial,
+  Name		  text not null,
+  JobId 	  integer default 0,
+  FileSetId	  integer default 0,
+  CreateTDate	  bigint default 0,
+  CreateDate	  timestamp without time zone not null,
+  ClientId	  int default 0,
+  Volume	  text not null,
+  Device	  text not null,
+  Type		  text not null,
+  Retention	  integer default 0,
+  Comment	  text,
+  primary key (SnapshotId)
+);
+
+CREATE UNIQUE INDEX snapshot_idx ON Snapshot (Device text_pattern_ops, 
+					      Volume text_pattern_ops, 
+					      Name text_pattern_ops);
+UPDATE Version SET VersionId=15;
 
 END-OF-DATA
-then
-   echo "Update of Bacula PostgreSQL tables succeeded."
-else
-   echo "Update of Bacula PostgreSQL tables failed."
+    then
+	echo "Update of Bacula PostgreSQL tables 14 to 15 succeeded."
+	getVersion
+    else
+	echo "Update of Bacula PostgreSQL tables 14 to 15 failed."
+	exit 1
+    fi
 fi
-exit 0
+
+# For all versions, we need to create the Index on Media(PoolId/StorageId)
+# It may fail, but it's not a big problem
+psql -f - -d ${db_name} $* <<END-OF-DATA
+set client_min_messages = fatal;
+CREATE INDEX media_poolid_idx on Media (PoolId);
+CREATE INDEX media_storageid_idx ON Media (StorageId);
+END-OF-DATA
diff --git a/src/cats/update_sqlite3_tables.in b/src/cats/update_sqlite3_tables.in
index 368ee28..0f1f15a 100644
--- a/src/cats/update_sqlite3_tables.in
+++ b/src/cats/update_sqlite3_tables.in
@@ -1,26 +1,16 @@
 #!/bin/sh
 #
-# Shell script to update sqlite3 tables from Bacula Community version 5.0.x to 5.2.x
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #
+# Shell script to update MySQL tables from Bacula Community version 
+#  5.0.x, 5.2.x, 7.0.x
 #
-#  Bacula® - The Network Backup Solution
-#
-#  Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
-#
-#  The main author of Bacula is Kern Sibbald, with contributions from many
-#  others, a complete list can be found in the file AUTHORS.
-#
-#  You may use this file and others of this release according to the
-#  license defined in the LICENSE file, which includes the Affero General
-#  Public License, v3.0 ("AGPLv3") and some additional permissions and
-#  terms pursuant to its AGPLv3 Section 7.
-#
-#  Bacula® is a registered trademark of Kern Sibbald.
-#
-
 echo " "
-echo "This script will update a Bacula sqlite3 database from version 12 to 14"
-echo "	which is needed to convert from Bacula Community version 5.0.x to 5.2.x"
+echo "This script will update a Bacula MySQL database from version 12-14 to 15"
+echo " "
+echo "Depending on the current version of your catalog, you may have to run this script"
+echo "	multiple times"
 echo " "
 
 bindir=@SQLITE_BINDIR@
@@ -29,18 +19,19 @@ cd @working_dir@
 db_name=@db_name@
 
 DBVERSION=`sqlite3 ${db_name}.db <<END
-select VersionId from Version;
+SELECT VersionId FROM Version LIMIT 1;
 END
 `
-if [ $DBVERSION != 12 ] ; then
-   echo " "
-   echo "The existing database is version $DBVERSION !!"
-   echo "This script can only update an existing version 12 database to version 14."
-   echo "Error. Cannot upgrade this database."
-   echo " "
-   exit 1
+if [ "$DBVERSION" -lt 12 -o "$DBVERSION" -gt 14 ] ; then
+    echo " "
+    echo "The existing database is version $DBVERSION !!"
+    echo "This script can only update an existing version 12, 13, 14 or 1014 database to version 1015."
+    echo "Error. Cannot upgrade this database."
+    echo " "
+    exit 1
 fi
 
+if [ "$DBVERSION" = 12 ] ; then
 sqlite3 $* ${db_name}.db <<END-OF-DATA
 BEGIN;
 
@@ -60,9 +51,62 @@ CREATE TABLE RestoreObject (
    );
 CREATE INDEX restore_jobid_idx ON RestoreObject (JobId);
 
-ALTER TABLE File ADD COLUMN DeltaSeq smallint default 0;
+UPDATE Version SET VersionId=13;
+COMMIT;
+
+END-OF-DATA
+DBVERSION=13
+fi
+
+if [ "$DBVERSION" = 13 ] ; then
+
+sqlite3 $* ${db_name}.db <<END-OF-DATA
+BEGIN;
 
+ALTER TABLE File ADD COLUMN DeltaSeq smallint default 0;
 UPDATE Version SET VersionId=14;
+
 COMMIT;
 
 END-OF-DATA
+
+DBVERSION=14
+
+fi
+
+if [ "$DBVERSION" = 14 ] ; then
+    sqlite3 $* ${db_name}.db  <<END-OF-DATA
+INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES
+   ('I', 'Incomplete Job',25);
+ALTER TABLE Media ADD COLUMN VolABytes BIGINT UNSIGNED DEFAULT 0;
+ALTER TABLE Media ADD COLUMN VolAPadding BIGINT UNSIGNED DEFAULT 0;
+ALTER TABLE Media ADD COLUMN VolHoleBytes BIGINT UNSIGNED DEFAULT 0;
+ALTER TABLE Media ADD COLUMN VolHoles INTEGER UNSIGNED DEFAULT 0;
+ALTER TABLE Media CHANGE VolWrites VolWrites BIGINT UNSIGNED;
+
+CREATE TABLE Snapshot (
+  SnapshotId	  INTEGER UNSIGNED AUTO_INCREMENT,
+  Name		  TINYBLOB NOT NULL,
+  JobId 	  INTEGER UNSIGNED DEFAULT 0,
+  FileSetId INTEGER UNSIGNED DEFAULT 0;
+  CreateTDate	  BIGINT   NOT NULL,
+  CreateDate	  DATETIME NOT NULL,
+  ClientId	  INTEGER DEFAULT 0,
+  Volume	  TINYBLOB NOT NULL,
+  Device	  TINYBLOB NOT NULL,
+  Type		  TINYBLOB NOT NULL,
+  Retention	  INTEGER DEFAULT 0,
+  Comment	  BLOB,
+  primary key (SnapshotId)
+);
+
+CREATE UNIQUE INDEX snapshot_idx ON Snapshot (Device(255), Volume(255), Name(255));
+
+CREATE INDEX jobtdate_idx on JobHisto (JobTDate);
+
+UPDATE Version SET VersionId=15;
+END-OF-DATA
+DBVERSION=15
+fi
+
+END-OF-DATA
diff --git a/src/cats/update_sqlite3_tables.in.patch b/src/cats/update_sqlite3_tables.in.patch
index 252a0f3..1a01855 100644
--- a/src/cats/update_sqlite3_tables.in.patch
+++ b/src/cats/update_sqlite3_tables.in.patch
@@ -1,11 +1,12 @@
 --- ./update_sqlite3_tables.in	2010-01-25 02:56:28.000000000 -0500
 +++ ../../../bacula-5.0.0-fixed/src/cats/update_sqlite3_tables.in	2010-01-31 10:22:52.000000000 -0500
-@@ -7,7 +7,7 @@ echo "This script will update a Bacula MySQL database from version 12 to 14"
- echo " which is needed to convert from Bacula Community version 5.0.x to 5.2.x"
+@@ -9,7 +9,7 @@ echo "  which is needed to convert from Bacula Enterprise version 2.6.x to 4.0.x"
+ echo " or Bacula Community version 5.0.x to 5.2.x"
  echo " "
  
 -bindir=@SQLITE_BINDIR@
-+bindir=/usr/lib/bacula/sqlite
++bindir=/opt/bacula/sqlite
  PATH="$bindir:$PATH"
  cd @working_dir@
  db_name=@db_name@
+
diff --git a/src/ch.h b/src/ch.h
index a3b9198..9345d69 100644
--- a/src/ch.h
+++ b/src/ch.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /**
  * Compressed stream header struct
diff --git a/src/console/Makefile.in b/src/console/Makefile.in
index 0186d33..8969cb6 100644
--- a/src/console/Makefile.in
+++ b/src/console/Makefile.in
@@ -1,5 +1,6 @@
 #
-#  Version $Id$
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #
 @MCOMMON@
 
@@ -20,7 +21,7 @@ first_rule: all
 dummy:
 
 #
-CONSSRCS = console.c console_conf.c authenticate.c @CONS_SRC@ 
+CONSSRCS = console.c console_conf.c authenticate.c @CONS_SRC@
 CONSOBJS = console.o console_conf.o authenticate.o @CONS_OBJ@
 
 # these are the objects that are changed by the .configure process
@@ -88,7 +89,7 @@ install: all
 	   echo " is no longer used, and you might want to delete it."; \
 	   echo " "; \
 	fi
-	$(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) bconsole $(DESTDIR)$(sbindir)/bconsole
+	$(LIBTOOL_INSTALL) $(INSTALL_PROGRAM_ALL) bconsole $(DESTDIR)$(sbindir)/bconsole
 	@srcconf=bconsole.conf; \
 	if  test -f ${DESTDIR}${sysconfdir}/$$srcconf; then \
 	   destconf=$$srcconf.new; \
@@ -112,7 +113,6 @@ uninstall:
 	(cd $(DESTDIR)$(sysconfdir); $(RMF) console.conf bconsole.conf bconsole.conf.new)
 
 
-
 # Semi-automatic generation of dependencies:
 # Use gcc -MM because X11 `makedepend' doesn't work on all systems
 # and it also includes system headers.
diff --git a/src/console/authenticate.c b/src/console/authenticate.c
index fe5de73..08116fc 100644
--- a/src/console/authenticate.c
+++ b/src/console/authenticate.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -28,13 +32,12 @@
 
 #include "bacula.h"
 #include "console_conf.h"
-#include "jcr.h"
 
 /*
  * Version at end of Hello
  *   prior to 06Aug13 no version
  */
-#define UA_VERSION 1
+#define UA_VERSION 100
 
 void senditf(const char *fmt, ...);
 void sendit(const char *buf);
@@ -51,9 +54,8 @@ static char newOKhello[]   = "1000 OK: %d";
 /*
  * Authenticate Director
  */
-int authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons)
+int authenticate_director(BSOCK *dir, DIRRES *director, CONRES *cons)
 {
-   BSOCK *dir = jcr->dir_bsock;
    int tls_local_need = BNET_TLS_NONE;
    int tls_remote_need = BNET_TLS_NONE;
    bool tls_authenticate;
@@ -166,6 +168,6 @@ bail_out:
    sendit( _("Director authorization problem.\n"
              "Most likely the passwords do not agree.\n"
              "If you are using TLS, there may have been a certificate validation error during the TLS handshake.\n"
-             "Please see " MANUAL_AUTH_URL " for help.\n"));
+             "For help, please see " MANUAL_AUTH_URL "\n"));
    return 0;
 }
diff --git a/src/console/bconsole.conf.in b/src/console/bconsole.conf.in
index 08016a1..84d23a2 100644
--- a/src/console/bconsole.conf.in
+++ b/src/console/bconsole.conf.in
@@ -1,6 +1,9 @@
 #
 # Bacula User Agent (or Console) Configuration File
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 
 Director {
   Name = @basename at -dir
diff --git a/src/console/conio.c b/src/console/conio.c
index cfa5d66..f2c69f1 100755
--- a/src/console/conio.c
+++ b/src/console/conio.c
@@ -1,24 +1,30 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 1981-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
 
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
 /*
-  Generalized console input/output handler
-  A maintanable replacement for readline()
+      Generalized console input/output handler
+      A maintanable replacement for readline()
 
-  Written in 1981, updated for Bacula, Kern Sibbald, December MMIII
+         Updated for Bacula, Kern Sibbald, December MMIII
+
+      This code is in part derived from code that I wrote in
+      1981, so some of it is a bit old and could use a cleanup.
 
 */
 
@@ -31,6 +37,7 @@
  *  Each subsequent character starts with 10 (i.e. (c & 0xC0) == 0x80)
  */
 
+
 #ifdef  TEST_PROGRAM
 #include <stdio.h>
 #include <unistd.h>
@@ -51,8 +58,8 @@
 #include <curses.h>
 #include <term.h>
 
-#if defined(HAVE_SUN_OS)
-#if !defined(_TERM_H)
+#ifdef HAVE_SUN_OS
+#ifndef _TERM_H
 extern "C" int tgetent(void *, const char *);
 extern "C" int tgetnum(const char *);
 extern "C" char *tgetstr (const char*, char**);
diff --git a/src/console/conio.h b/src/console/conio.h
index 57296af..c009850 100644
--- a/src/console/conio.h
+++ b/src/console/conio.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2004-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 
 #ifndef __CONIO_H
diff --git a/src/console/console.c b/src/console/console.c
index d716e36..b2f0814 100644
--- a/src/console/console.c
+++ b/src/console/console.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -47,7 +51,7 @@
 //extern int rl_catch_signals;
 
 /* Imported functions */
-int authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons);
+int authenticate_director(BSOCK *dir, DIRRES *director, CONRES *cons);
 extern bool parse_cons_config(CONFIG *config, const char *configfile, int exit_code);
 
 /* Forward referenced functions */
@@ -93,6 +97,7 @@ static int echocmd(FILE *input, BSOCK *UA_sock);
 static int timecmd(FILE *input, BSOCK *UA_sock);
 static int sleepcmd(FILE *input, BSOCK *UA_sock);
 static int execcmd(FILE *input, BSOCK *UA_sock);
+
 #ifdef HAVE_READLINE
 static int eolcmd(FILE *input, BSOCK *UA_sock);
 
@@ -111,7 +116,7 @@ static void usage()
 {
    fprintf(stderr, _(
 PROG_COPYRIGHT
-"\nVersion: " VERSION " (" BDATE ") %s %s %s\n\n"
+"\n%sVersion: " VERSION " (" BDATE ") %s %s %s\n\n"
 "Usage: bconsole [-s] [-c config_file] [-d debug_level]\n"
 "       -D <dir>    select a Director\n"
 "       -l          list Directors defined\n"
@@ -123,7 +128,7 @@ PROG_COPYRIGHT
 "       -u <nn>     set command execution timeout to <nn> seconds\n"
 "       -t          test - read configuration and exit\n"
 "       -?          print this message.\n"
-"\n"), 2000, HOST_OS, DISTNAME, DISTVER);
+"\n"), 2000, "", HOST_OS, DISTNAME, DISTVER);
 }
 
 
@@ -217,7 +222,6 @@ static int do_a_command(FILE *input, BSOCK *UA_sock)
    return stat;
 }
 
-
 static void read_and_process_input(FILE *input, BSOCK *UA_sock)
 {
    const char *prompt = "*";
@@ -243,11 +247,10 @@ static void read_and_process_input(FILE *input, BSOCK *UA_sock)
          }
       } else {
          /* Reading input from a file */
-         int len = sizeof_pool_memory(UA_sock->msg) - 1;
          if (usrbrk()) {
             break;
          }
-         if (fgets(UA_sock->msg, len, input) == NULL) {
+         if (bfgets(UA_sock->msg, input) == NULL) {
             stat = -1;
          } else {
             sendit(UA_sock->msg);  /* echo to terminal */
@@ -283,11 +286,17 @@ static void read_and_process_input(FILE *input, BSOCK *UA_sock)
          }
          stop_bsock_timer(tid);
       }
-      if (strcmp(UA_sock->msg, ".quit") == 0 || strcmp(UA_sock->msg, ".exit") == 0) {
+      if (strcasecmp(UA_sock->msg, ".quit") == 0 || strcasecmp(UA_sock->msg, ".exit") == 0) {
          break;
       }
       tid = start_bsock_timer(UA_sock, timeout);
-      while ((stat = UA_sock->recv()) >= 0) {
+      while (1) {
+         stat = UA_sock->recv();
+
+         if (stat < 0) {
+            break;
+         }
+
          if (at_prompt) {
             if (!stop) {
                sendit("\n");
@@ -314,7 +323,7 @@ static void read_and_process_input(FILE *input, BSOCK *UA_sock)
          if (UA_sock->msglen == BNET_SUB_PROMPT) {
             at_prompt = true;
          }
-         Dmsg1(100, "Got poll %s\n", bnet_sig_to_ascii(UA_sock));
+         Dmsg1(100, "Got poll %s\n", bnet_sig_to_ascii(UA_sock->msglen));
       }
    }
 }
@@ -448,12 +457,12 @@ static void match_kw(regex_t *preg, const char *what, int len, POOLMEM **buf)
 {
    int rc, size;
    int nmatch=20;
-   regmatch_t pmatch[20];
+   regmatch_t pmatch[nmatch];
 
    if (len <= 0) {
       return;
    }
-   rc = regexec(preg, what, nmatch, pmatch, 0);
+   rc = regexec(preg, what, nmatch, pmatch,  0);
    if (rc == 0) {
 #if 0
       Pmsg1(0, "\n\n%s\n0123456789012345678901234567890123456789\n        10         20         30\n", what);
@@ -599,7 +608,10 @@ static struct cpl_keywords_t cpl_keywords[] = {
    {"m",          ".ls"            },
    {"unmark",     ".lsmark"        },
    {"catalog=",   ".catalogs"      },
-   {"actiononpurge=", ".actiononpurge" }
+   {"actiononpurge=", ".actiononpurge" },
+   {"tags=",      ".tags"          },
+   {"recylepool=", ".pool"         },
+   {"allfrompool=",".pool"         }
 };
 #define key_size ((int)(sizeof(cpl_keywords)/sizeof(struct cpl_keywords_t)))
 
@@ -873,7 +885,7 @@ static int console_init_history(const char *histfile)
    return ret;
 }
 
-bool select_director(const char *director, DIRRES **ret_dir, CONRES **ret_cons)
+static bool select_director(const char *director, DIRRES **ret_dir, CONRES **ret_cons)
 {
    int numcon=0, numdir=0;
    int i=0, item=0;
@@ -1189,13 +1201,15 @@ int main(int argc, char *argv[])
    }
    if (!UA_sock->connect(NULL, 5, 15, heart_beat, "Director daemon", dir->address,
                           NULL, dir->DIRport, 0)) {
+      UA_sock->destroy();
+      UA_sock = NULL;
       terminate_console(0);
       return 1;
    }
    jcr.dir_bsock = UA_sock;
 
    /* If cons==NULL, default console will be used */
-   if (!authenticate_director(&jcr, dir, cons)) {
+   if (!authenticate_director(UA_sock, dir, cons)) {
       terminate_console(0);
       return 1;
    }
@@ -1455,7 +1469,6 @@ static int execcmd(FILE *input, BSOCK *UA_sock)
    return 1;
 }
 
-
 /* @echo xxx yyy */
 static int echocmd(FILE *input, BSOCK *UA_sock)
 {
diff --git a/src/console/console_conf.c b/src/console/console_conf.c
index 5ea82aa..65c850a 100644
--- a/src/console/console_conf.c
+++ b/src/console/console_conf.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *   Main configuration file parser for Bacula User Agent
@@ -71,53 +75,54 @@ int32_t res_all_size = sizeof(res_all);
 
 /*  Console "globals" */
 static RES_ITEM cons_items[] = {
-   {"name",           store_name,     ITEM(res_cons.hdr.name), 0, ITEM_REQUIRED, 0},
-   {"description",    store_str,      ITEM(res_cons.hdr.desc), 0, 0, 0},
-   {"rcfile",         store_dir,      ITEM(res_cons.rc_file), 0, 0, 0},
-   {"historyfile",    store_dir,      ITEM(res_cons.hist_file), 0, 0, 0},
-   {"password",       store_password, ITEM(res_cons.password), 0, ITEM_REQUIRED, 0},
-   {"tlsauthenticate",store_bool,    ITEM(res_cons.tls_authenticate), 0, 0, 0},
-   {"tlsenable",      store_bool,    ITEM(res_cons.tls_enable), 0, 0, 0},
-   {"tlsrequire",     store_bool,    ITEM(res_cons.tls_require), 0, 0, 0},
-   {"tlscacertificatefile", store_dir, ITEM(res_cons.tls_ca_certfile), 0, 0, 0},
-   {"tlscacertificatedir", store_dir,  ITEM(res_cons.tls_ca_certdir), 0, 0, 0},
-   {"tlscertificate", store_dir,       ITEM(res_cons.tls_certfile), 0, 0, 0},
-   {"tlskey",         store_dir,       ITEM(res_cons.tls_keyfile), 0, 0, 0},
-   {"director",       store_str,       ITEM(res_cons.director), 0, 0, 0},
-   {"heartbeatinterval", store_time, ITEM(res_cons.heartbeat_interval), 0, ITEM_DEFAULT, 0},
+   {"Name",           store_name,     ITEM(res_cons.hdr.name), 0, ITEM_REQUIRED, 0},
+   {"Description",    store_str,      ITEM(res_cons.hdr.desc), 0, 0, 0},
+   {"RCFile",         store_dir,      ITEM(res_cons.rc_file), 0, 0, 0},
+   {"HistoryFile",    store_dir,      ITEM(res_cons.hist_file), 0, 0, 0},
+   {"Password",       store_password, ITEM(res_cons.password), 0, ITEM_REQUIRED, 0},
+   {"TlsAuthenticate",store_bool,    ITEM(res_cons.tls_authenticate), 0, 0, 0},
+   {"TlsEnable",      store_bool,    ITEM(res_cons.tls_enable), 0, 0, 0},
+   {"TlsRequire",     store_bool,    ITEM(res_cons.tls_require), 0, 0, 0},
+   {"TlsCaCertificateFile", store_dir, ITEM(res_cons.tls_ca_certfile), 0, 0, 0},
+   {"TlsCaCertificateDir", store_dir,  ITEM(res_cons.tls_ca_certdir), 0, 0, 0},
+   {"TlsCertificate", store_dir,       ITEM(res_cons.tls_certfile), 0, 0, 0},
+   {"TlsKey",         store_dir,       ITEM(res_cons.tls_keyfile), 0, 0, 0},
+   {"Director",       store_str,       ITEM(res_cons.director), 0, 0, 0},
+   {"HeartbeatInterval", store_time, ITEM(res_cons.heartbeat_interval), 0, ITEM_DEFAULT, 5 * 60},
    {NULL, NULL, {0}, 0, 0, 0}
 };
 
 
 /*  Director's that we can contact */
 static RES_ITEM dir_items[] = {
-   {"name",           store_name,      ITEM(res_dir.hdr.name), 0, ITEM_REQUIRED, 0},
-   {"description",    store_str,       ITEM(res_dir.hdr.desc), 0, 0, 0},
-   {"dirport",        store_pint32,    ITEM(res_dir.DIRport),  0, ITEM_DEFAULT, 9101},
-   {"address",        store_str,       ITEM(res_dir.address),  0, 0, 0},
-   {"password",       store_password,  ITEM(res_dir.password), 0, ITEM_REQUIRED, 0},
-   {"tlsauthenticate",store_bool,    ITEM(res_dir.tls_enable), 0, 0, 0},
-   {"tlsenable",      store_bool,    ITEM(res_dir.tls_enable), 0, 0, 0},
-   {"tlsrequire",     store_bool,    ITEM(res_dir.tls_require), 0, 0, 0},
-   {"tlscacertificatefile", store_dir, ITEM(res_dir.tls_ca_certfile), 0, 0, 0},
-   {"tlscacertificatedir", store_dir,  ITEM(res_dir.tls_ca_certdir), 0, 0, 0},
-   {"tlscertificate", store_dir,       ITEM(res_dir.tls_certfile), 0, 0, 0},
-   {"tlskey",         store_dir,       ITEM(res_dir.tls_keyfile), 0, 0, 0},
-   {"heartbeatinterval", store_time, ITEM(res_dir.heartbeat_interval), 0, ITEM_DEFAULT, 0},
+   {"Name",           store_name,      ITEM(res_dir.hdr.name), 0, ITEM_REQUIRED, 0},
+   {"Description",    store_str,       ITEM(res_dir.hdr.desc), 0, 0, 0},
+   {"DirPort",        store_pint32,    ITEM(res_dir.DIRport),  0, ITEM_DEFAULT, 9101},
+   {"Address",        store_str,       ITEM(res_dir.address),  0, 0, 0},
+   {"Password",       store_password,  ITEM(res_dir.password), 0, ITEM_REQUIRED, 0},
+   {"TlsAuthenticate",store_bool,    ITEM(res_dir.tls_enable), 0, 0, 0},
+   {"TlsEnable",      store_bool,    ITEM(res_dir.tls_enable), 0, 0, 0},
+   {"TlsRequire",     store_bool,    ITEM(res_dir.tls_require), 0, 0, 0},
+   {"TlsCaCertificateFile", store_dir, ITEM(res_dir.tls_ca_certfile), 0, 0, 0},
+   {"TlsCaCertificateDir", store_dir,  ITEM(res_dir.tls_ca_certdir), 0, 0, 0},
+   {"TlsCertificate", store_dir,       ITEM(res_dir.tls_certfile), 0, 0, 0},
+   {"TlsKey",         store_dir,       ITEM(res_dir.tls_keyfile), 0, 0, 0},
+   {"HeartbeatInterval", store_time, ITEM(res_dir.heartbeat_interval), 0, ITEM_DEFAULT, 5 * 60},
    {NULL, NULL, {0}, 0, 0, 0}
 };
 
 /*
  * This is the master resource definition.
  * It must have one item for each of the resources.
+ *
+ *   name            item         rcode
  */
 RES_TABLE resources[] = {
-   {"console",       cons_items,  R_CONSOLE},
-   {"director",      dir_items,   R_DIRECTOR},
+   {"Console",       cons_items,  R_CONSOLE},
+   {"Director",      dir_items,   R_DIRECTOR},
    {NULL,            NULL,        0}
 };
 
-
 /* Dump contents of resource */
 void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fmt, ...), void *sock)
 {
@@ -161,8 +166,9 @@ void free_resource(RES *sres, int type)
    RES *nres;
    URES *res = (URES *)sres;
 
-   if (res == NULL)
+   if (res == NULL) {
       return;
+   }
 
    /* common stuff -- free the resource name */
    nres = (RES *)res->res_dir.hdr.next;
@@ -247,7 +253,7 @@ void save_resource(int type, RES_ITEM *items, int pass)
    for (i=0; items[i].name; i++) {
       if (items[i].flags & ITEM_REQUIRED) {
             if (!bit_is_set(i, res_all.res_dir.hdr.item_present)) {
-               Emsg2(M_ABORT, 0, _("%s item is required in %s resource, but not found.\n"),
+               Emsg2(M_ERROR_TERM, 0, _("%s item is required in %s resource, but not found.\n"),
                  items[i].name, resources[rindex]);
              }
       }
diff --git a/src/console/console_conf.h b/src/console/console_conf.h
index 042790e..d54995f 100644
--- a/src/console/console_conf.h
+++ b/src/console/console_conf.h
@@ -1,24 +1,27 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Bacula User Agent specific configuration and defines
  *
  *     Kern Sibbald, Sep MM
  *
- *     Version $Id$
  */
 
 /*
diff --git a/src/console/func.h b/src/console/func.h
index e096c9c..2a717a1 100755
--- a/src/console/func.h
+++ b/src/console/func.h
@@ -1,3 +1,22 @@
+/*
+   Bacula(R) - The Network Backup Solution
+
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 1981-2014 Free Software Foundation Europe e.V.
+
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
+
+   You may use this file and others of this release according to the
+   license defined in the LICENSE file, which includes the Affero General
+   Public License, v3.0 ("AGPLv3") and some additional permissions and
+   terms pursuant to its AGPLv3 Section 7.
+
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
 /* Definitions of internal function codes */
 
 /* Functions that work on current line */
diff --git a/src/count-lines b/src/count-lines
new file mode 100755
index 0000000..a680905
--- /dev/null
+++ b/src/count-lines
@@ -0,0 +1,9 @@
+#!/bin/sh
+rm -f 1
+touch 1
+find . -type d >2
+for i in `cat 2` ; do
+  ls -1 $i/*.c $i/*.cpp $i/*.h $i/*.in 2>/dev/null >>1
+done
+cat 1 | $HOME/bin/lines
+# rm -f 1 2
diff --git a/src/dird/Makefile.in b/src/dird/Makefile.in
index c4c47df..2567372 100644
--- a/src/dird/Makefile.in
+++ b/src/dird/Makefile.in
@@ -1,7 +1,9 @@
 #
 #  Bacula Director Makefile
 #
-#  
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 @MCOMMON@
 
 srcdir =	.
@@ -11,9 +13,9 @@ VPATH = 	.
 dir_group=@dir_group@
 
 # one up
-basedir = ..
+basedir = @BUILD_DIR@/src
 # top dir
-topdir = ../..
+topdir = @BUILD_DIR@
 # this dir relative to top dir
 thisdir = src/dird
 
@@ -21,7 +23,6 @@ DEBUG=@DEBUG@
 
 GETTEXT_LIBS = @LIBINTL@
 CAP_LIBS = @CAP_LIBS@
-
 DB_LIBS=@DB_LIBS@
 
 first_rule: all
@@ -40,7 +41,7 @@ SVRSRCS = dird.c admin.c authenticate.c \
 	  ua_query.c \
 	  ua_input.c ua_label.c ua_output.c ua_prune.c \
 	  ua_purge.c ua_restore.c ua_run.c \
-	  ua_select.c ua_server.c \
+	  ua_select.c ua_server.c snapshot.c \
 	  ua_status.c ua_tree.c ua_update.c vbackup.c verify.c
 SVROBJS = $(SVRSRCS:.c=.o)
 
@@ -115,7 +116,7 @@ install: all
 	@if  test -f ${DESTDIR}${scriptdir}/query.sql; then \
 	   echo "  ==> Saving existing query.sql to query.sql.old"; \
 	   $(MV) -f ${DESTDIR}${scriptdir}/query.sql ${DESTDIR}${scriptdir}/query.sql.old; \
-	fi 
+	fi
 	${INSTALL_DATA} query.sql ${DESTDIR}${scriptdir}/query.sql
 	@if test -f static-bacula-dir; then \
 	   $(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) static-bacula-dir $(DESTDIR)$(sbindir)/static-bacula-dir; \
@@ -123,7 +124,6 @@ install: all
 
 
 uninstall:
-	(cd $(DESTDIR)$(sbindir); $(RMF) bacula-dir
 	(cd $(DESTDIR)$(sysconfdir); $(RMF) bacula-dir.conf bacula-dir.conf.new)
 	(cd $(DESTDIR)$(scriptdir); $(RMF) query.sql)
 
diff --git a/src/dird/admin.c b/src/dird/admin.c
index 05bd6db..c056bce 100644
--- a/src/dird/admin.c
+++ b/src/dird/admin.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2003-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
diff --git a/src/dird/authenticate.c b/src/dird/authenticate.c
index a725408..6212519 100644
--- a/src/dird/authenticate.c
+++ b/src/dird/authenticate.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -33,9 +37,9 @@ extern DIRRES *director;
 
 /* Version at end of Hello
  *   prior to 06Aug13 no version
- *   1 06Aug13 - added comm line compression
+ *      102 04Jun15 - added jobmedia change
  */
-#define DIR_VERSION 1
+#define DIR_VERSION 102
 
 
 /* Command sent to SD */
@@ -110,7 +114,7 @@ bool authenticate_storage_daemon(JCR *jcr, STORE *store)
             "Passwords or names not the same or\n"
             "Maximum Concurrent Jobs exceeded on the SD or\n"
             "SD networking messed up (restart daemon).\n"
-            "Please see " MANUAL_AUTH_URL " for help.\n"),
+            "For help, please see: " MANUAL_AUTH_URL "\n"),
             sd->host(), sd->port());
       return 0;
    }
@@ -160,6 +164,11 @@ bool authenticate_storage_daemon(JCR *jcr, STORE *store)
          sd->host(), sd->port());
       return 0;
    }
+   if (jcr->SDVersion < 305) {
+      Jmsg2(jcr, M_FATAL, 0, _("Older Storage daemon at \"%s:%d\" incompatible with this Director.\n"),
+         sd->host(), sd->port());
+      return 0;
+   }
    return 1;
 }
 
@@ -223,7 +232,7 @@ int authenticate_file_daemon(JCR *jcr)
             "Passwords or names not the same or\n"
             "Maximum Concurrent Jobs exceeded on the FD or\n"
             "FD networking messed up (restart daemon).\n"
-            "Please see " MANUAL_AUTH_URL " for help.\n"),
+            "For help, please see: " MANUAL_AUTH_URL "\n"),
             fd->host(), fd->port());
       return 0;
    }
@@ -416,7 +425,7 @@ auth_done:
       sleep(5);
       return 0;
    }
-   ua->fsend(_("1000 OK: %d %s Version: %s (%s)\n"),
-      DIR_VERSION, my_name, VERSION, BDATE);
+   ua->fsend(_("1000 OK: %d %s %sVersion: %s (%s)\n"),
+      DIR_VERSION, my_name, "", VERSION, BDATE);
    return 1;
 }
diff --git a/src/dird/autoprune.c b/src/dird/autoprune.c
index 01bef33..2b8233f 100644
--- a/src/dird/autoprune.c
+++ b/src/dird/autoprune.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2002-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -136,7 +140,7 @@ void prune_volumes(JCR *jcr, bool InChanger, MEDIA_DBR *mr,
 
    set_storageid_in_mr(store, mr);
    if (InChanger) {
-      Mmsg(changer, "AND InChanger=1 AND StorageId IN (%s) ", edit_int64(mr->StorageId, ed3));
+      Mmsg(changer, "AND InChanger=1 AND StorageId=%s ", edit_int64(mr->StorageId, ed3));
    }
 
    Mmsg(query, select, ed1, ed2, mr->MediaType, changer.c_str());
@@ -174,7 +178,7 @@ void prune_volumes(JCR *jcr, bool InChanger, MEDIA_DBR *mr,
             purge_job_list_from_catalog(ua, prune_list);
             prune_list.num_ids = 0;             /* reset count */
          }
-         if (!is_volume_purged(ua, &lmr)) {
+         if (!is_volume_purged(ua, &lmr, false)) {
             Dmsg1(100, "Vol=%s not pruned\n", lmr.VolumeName);
             continue;
          }
diff --git a/src/dird/backup.c b/src/dird/backup.c
index 89109f2..9f2f939 100644
--- a/src/dird/backup.c
+++ b/src/dird/backup.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -39,7 +43,6 @@ static char storaddr[]  = "storage address=%s port=%d ssl=%d\n";
 /* Responses received from File daemon */
 static char OKbackup[]   = "2000 OK backup\n";
 static char OKstore[]    = "2000 OK storage\n";
-/* Pre 17 Aug 2013 */
 static char EndJob[]     = "2800 End Job TermCode=%d JobFiles=%u "
                            "ReadBytes=%llu JobBytes=%llu Errors=%u "
                            "VSS=%d Encrypt=%d\n";
@@ -240,6 +243,7 @@ bool send_accurate_current_files(JCR *jcr)
    db_list_ctx nb;
    char ed1[50];
 
+   /* In base level, no previous job is used and no restart incomplete jobs */
    if (jcr->is_canceled() || jcr->is_JobLevel(L_BASE)) {
       return true;
    }
@@ -257,7 +261,7 @@ bool send_accurate_current_files(JCR *jcr)
       }
    } else {
       /* For Incr/Diff level, we search for older jobs */
-      db_accurate_get_jobids(jcr, jcr->db, &jcr->jr, &jobids);
+      db_get_accurate_jobids(jcr, jcr->db, &jcr->jr, &jobids);
 
       /* We are in Incr/Diff, but no Full to build the accurate list... */
       if (jobids.count == 0) {
@@ -266,6 +270,7 @@ bool send_accurate_current_files(JCR *jcr)
       }
    }
 
+   /* For incomplete Jobs, we add our own id */
    if (jcr->rerunning) {
       edit_int64(jcr->JobId, ed1);
       jobids.add(ed1);
@@ -305,7 +310,7 @@ bool send_accurate_current_files(JCR *jcr)
       if (!db_get_file_list(jcr, jcr->db_batch,
                        jobids.list, jcr->use_accurate_chksum, false /* no delta */,
                        accurate_list_handler, (void *)jcr)) {
-         Jmsg1(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db));
+         Jmsg1(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db_batch));
          return false;
       }
    }
@@ -432,8 +437,13 @@ bool do_backup(JCR *jcr)
    }
 
    /* Print Job Start message */
-   Jmsg(jcr, M_INFO, 0, _("Start Backup JobId %s, Job=%s\n"),
+   if (jcr->rerunning) {
+      Jmsg(jcr, M_INFO, 0, _("Restart Incomplete Backup JobId %s, Job=%s\n"),
            edit_uint64(jcr->JobId, ed1), jcr->Job);
+   } else {
+      Jmsg(jcr, M_INFO, 0, _("Start Backup JobId %s, Job=%s\n"),
+           edit_uint64(jcr->JobId, ed1), jcr->Job);
+   }
 
    jcr->setJobStatus(JS_Running);
    Dmsg2(100, "JobId=%d JobLevel=%c\n", jcr->jr.JobId, jcr->jr.JobLevel);
@@ -442,6 +452,34 @@ bool do_backup(JCR *jcr)
       return false;
    }
 
+   /* For incomplete Jobs, we add our own id */
+   if (jcr->rerunning) {
+      edit_int64(jcr->JobId, ed1);
+      Mmsg(buf, "SELECT max(FileIndex) FROM File WHERE JobId=%s", ed1);
+      if (db_sql_query(jcr->db, buf.c_str(), db_int64_handler, &job)) {
+         Jmsg(jcr, M_INFO, 0, _("Found %ld files from prior incomplete Job.\n"),
+            (int32_t)job.value);
+      } else {
+         Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db));
+         return false;
+      }
+      jcr->JobFiles = job.value;
+      Dmsg1(100, "==== FI=%ld\n", jcr->JobFiles);
+      Mmsg(buf, "SELECT VolSessionId FROM Job WHERE JobId=%s", ed1);
+      if (!db_sql_query(jcr->db, buf.c_str(), db_int64_handler, &job)) {
+         Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db));
+         return false;
+      }
+      jcr->VolSessionId = job.value;
+      Mmsg(buf, "SELECT VolSessionTime FROM Job WHERE JobId=%s", ed1);
+      if (!db_sql_query(jcr->db, buf.c_str(), db_int64_handler, &job)) {
+         Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db));
+         return false;
+      }
+      jcr->VolSessionTime = job.value;
+      Dmsg4(100, "JobId=%s JobFiles=%ld VolSessionId=%ld VolSessionTime=%ld\n", ed1,
+            jcr->JobFiles, jcr->VolSessionId, jcr->VolSessionTime);
+   }
 
    /*
     * Open a message channel connection with the Storage
@@ -507,10 +545,12 @@ bool do_backup(JCR *jcr)
       send_bwlimit(jcr, jcr->Job); /* Old clients don't have this command */
    }
 
+   send_snapshot_retention(jcr, jcr->snapshot_retention);
+
    store = jcr->wstore;
 
    if (jcr->sd_calls_client) {
-      if (jcr->FDVersion < 5) {
+      if (jcr->FDVersion < 10) {
          Jmsg(jcr, M_FATAL, 0, _("The File daemon does not support SDCallsClient.\n"));
          goto bail_out;
       }
@@ -620,7 +660,7 @@ int wait_for_job_termination(JCR *jcr, int timeout)
    uint32_t JobWarnings = 0;
    uint64_t ReadBytes = 0;
    uint64_t JobBytes = 0;
-   int VSS = 0;
+   int VSS = 0;                 /* or Snapshot on Unix */
    int Encrypt = 0;
    btimer_t *tid=NULL;
 
@@ -630,10 +670,10 @@ int wait_for_job_termination(JCR *jcr, int timeout)
       }
       /* Wait for Client to terminate */
       while ((n = bget_dirmsg(fd)) >= 0) {
-         if (!fd_ok &&
+         if (!fd_ok && 
               (sscanf(fd->msg, EndJob, &jcr->FDJobStatus, &JobFiles,
                      &ReadBytes, &JobBytes, &JobErrors, &VSS, &Encrypt) == 7 ||
-              sscanf(fd->msg, OldEndJob, &jcr->FDJobStatus, &JobFiles,
+               sscanf(fd->msg, OldEndJob, &jcr->FDJobStatus, &JobFiles,
                      &ReadBytes, &JobBytes, &JobErrors) == 5)) {
             fd_ok = true;
             jcr->setJobStatus(jcr->FDJobStatus);
@@ -662,7 +702,7 @@ int wait_for_job_termination(JCR *jcr, int timeout)
    }
 
    /*
-    * Force cancel in SD if failing,
+    * Force cancel in SD if failing, but not for Incomplete jobs
     *  so that we let the SD despool.
     */
    Dmsg5(100, "cancel=%d fd_ok=%d FDJS=%d JS=%d SDJS=%d\n", jcr->is_canceled(), fd_ok, jcr->FDJobStatus,
@@ -683,7 +723,7 @@ int wait_for_job_termination(JCR *jcr, int timeout)
       jcr->ReadBytes = ReadBytes;
       jcr->JobBytes = JobBytes;
       jcr->JobWarnings = JobWarnings;
-      jcr->VSS = VSS;
+      jcr->Snapshot = VSS;
       jcr->Encrypt = Encrypt;
    } else if (jcr->getJobStatus() != JS_Canceled) {
       Jmsg(jcr, M_FATAL, 0, _("No Job status returned from FD.\n"));
@@ -713,7 +753,7 @@ void backup_cleanup(JCR *jcr, int TermCode)
 {
    char sdt[50], edt[50], schedt[50];
    char ec1[30], ec2[30], ec3[30], ec4[30], ec5[30];
-   char ec6[30], ec7[30], ec8[30], elapsed[50];
+   char ec6[30], ec7[30], ec8[30], ec9[30], ec10[30], elapsed[50];
    char data_compress[200];
    char term_code[100], fd_term_msg[100], sd_term_msg[100];
    const char *term_msg;
@@ -733,18 +773,6 @@ void backup_cleanup(JCR *jcr, int TermCode)
    Dmsg2(100, "Enter backup_cleanup %d %c\n", TermCode, TermCode);
    memset(&cr, 0, sizeof(cr));
 
-#ifdef xxxx
-   /* The current implementation of the JS_Warning status is not
-    * completed. SQL part looks to be ok, but the code is using
-    * JS_Terminated almost everywhere instead of (JS_Terminated || JS_Warning)
-    * as we do with is_canceled()
-    */
-   if (jcr->getJobStatus() == JS_Terminated &&
-        (jcr->JobErrors || jcr->SDErrors || jcr->JobWarnings)) {
-      TermCode = JS_Warnings;
-   }
-#endif
-
    update_job_end(jcr, TermCode);
 
    if (!db_get_job_record(jcr, jcr->db, &jcr->jr)) {
@@ -776,6 +804,9 @@ void backup_cleanup(JCR *jcr, int TermCode)
             term_msg = _("Backup OK");
          }
          break;
+      case JS_Incomplete:
+         term_msg = _("Backup failed -- incomplete");
+         break;
       case JS_Warnings:
          term_msg = _("Backup OK -- with warnings");
          break;
@@ -829,12 +860,12 @@ void backup_cleanup(JCR *jcr, int TermCode)
    if (jcr->ReadBytes == 0) {
       bstrncpy(data_compress, "None", sizeof(data_compress));
    } else {
-      compression = (double)100 - 100.0 * ((double)jcr->JobBytes / (double)jcr->ReadBytes);
+      compression = (double)100 - 100.0 * ((double)jcr->SDJobBytes / (double)jcr->ReadBytes);
       if (compression < 0.5) {
          bstrncpy(data_compress, "None", sizeof(data_compress));
       } else {
-         if (jcr->JobBytes > 0) {
-            ratio = (double)jcr->ReadBytes / (double)jcr->JobBytes;
+         if (jcr->SDJobBytes > 0) {
+            ratio = (double)jcr->ReadBytes / (double)jcr->SDJobBytes;
          } else {
             ratio = 1.0;
          }
@@ -852,10 +883,19 @@ void backup_cleanup(JCR *jcr, int TermCode)
            jcr->nb_base_files_used*100.0/jcr->nb_base_files);
    }
    /* Edit string for last volume size */
-   Mmsg(vol_info, _("%s (%sB)"),
+   if (mr.VolABytes != 0) {
+      Mmsg(vol_info, _("meta: %s (%sB) aligned: %s (%sB)"),
+        edit_uint64_with_commas(mr.VolBytes, ec7),
+        edit_uint64_with_suffix(mr.VolBytes, ec8),
+        edit_uint64_with_commas(mr.VolABytes, ec9),
+        edit_uint64_with_suffix(mr.VolABytes, ec10));
+   } else {
+     Mmsg(vol_info, _("%s (%sB)"),
         edit_uint64_with_commas(mr.VolBytes, ec7),
         edit_uint64_with_suffix(mr.VolBytes, ec8));
+   }
 
+// bmicrosleep(15, 0);                /* for debugging SIGHUP */
 
    Jmsg(jcr, msg_type, 0, _("%s %s %s (%s):\n"
 "  Build OS:               %s %s %s\n"
@@ -879,7 +919,7 @@ void backup_cleanup(JCR *jcr, int TermCode)
 "  Rate:                   %.1f KB/s\n"
 "  Software Compression:   %s\n"
 "%s"                                         /* Basefile info */
-"  VSS:                    %s\n"
+"  Snapshot/VSS:           %s\n"
 "  Encryption:             %s\n"
 "  Accurate:               %s\n"
 "  Volume name(s):         %s\n"
@@ -915,7 +955,7 @@ void backup_cleanup(JCR *jcr, int TermCode)
         kbps,
         data_compress,
         base_info.c_str(),
-        jcr->VSS?_("yes"):_("no"),
+        jcr->Snapshot?_("yes"):_("no"),
         jcr->Encrypt?_("yes"):_("no"),
         jcr->accurate?_("yes"):_("no"),
         jcr->VolumeName,
diff --git a/src/dird/bsr.c b/src/dird/bsr.c
index 97d1607..b24a28c 100644
--- a/src/dird/bsr.c
+++ b/src/dird/bsr.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2002-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -50,7 +54,7 @@ static void free_findex(RBSR_FINDEX *fi)
    }
 }
 
-/*
+/* 
  * Get storage device name from Storage resource
  */
 static bool get_storage_device(char *device, char *storage)
@@ -59,7 +63,7 @@ static bool get_storage_device(char *device, char *storage)
    if (storage[0] == 0) {
       return false;
    }
-   store = (STORE *)GetResWithName(R_STORAGE, storage);
+   store = (STORE *)GetResWithName(R_STORAGE, storage);    
    if (!store) {
       return false;
    }
@@ -188,7 +192,7 @@ static void make_unique_restore_filename(UAContext *ua, POOL_MEM &fname)
    JCR *jcr = ua->jcr;
    int i = find_arg_with_value(ua, "bootstrap");
    if (i >= 0) {
-      Mmsg(fname, "%s", ua->argv[i]);
+      Mmsg(fname, "%s", ua->argv[i]);              
       jcr->unlink_bsr = false;
    } else {
       P(mutex);
@@ -237,7 +241,7 @@ uint32_t write_bsr_file(UAContext *ua, RESTORE_CTX &rx)
 
    ua->send_msg(_("Bootstrap records written to %s\n"), fname.c_str());
 
-   if (chk_dbglvl(10)) {
+   if (debug_level >= 10) {
       print_bsr(ua, rx);
    }
 
@@ -267,7 +271,7 @@ static void display_vol_info(UAContext *ua, RESTORE_CTX &rx, JobId_t JobId)
             } else {
                online = ' ';
             }
-            Mmsg(volmsg, "%c%-25s %-25s %-25s",
+            Mmsg(volmsg, "%c%-25s %-25s %-25s", 
                  online, bsr->VolParams[i].VolumeName,
                  bsr->VolParams[i].Storage, Device);
             add_prompt(ua, volmsg.c_str());
@@ -316,7 +320,7 @@ void display_bsr_info(UAContext *ua, RESTORE_CTX &rx)
 /*
  * Write bsr data for a single bsr record
  */
-static uint32_t write_bsr_item(RBSR *bsr, UAContext *ua,
+static uint32_t write_bsr_item(RBSR *bsr, UAContext *ua, 
                    RESTORE_CTX &rx, FILE *fd, bool &first, uint32_t &LastIndex)
 {
    char ed1[50], ed2[50];
@@ -381,7 +385,7 @@ static uint32_t write_bsr_item(RBSR *bsr, UAContext *ua,
  * Here we actually write out the details of the bsr file.
  *  Note, there is one bsr for each JobId, but the bsr may
  *  have multiple volumes, which have been entered in the
- *  order they were written.
+ *  order they were written.  
  * The bsrs must be written out in the order the JobIds
  *  are found in the jobid list.
  */
@@ -551,7 +555,7 @@ void add_findex_all(RBSR *bsr, uint32_t JobId)
          nbsr->next->JobId = JobId;
 
          /* If we use regexp to restore, set it for each jobid */
-         if (bsr->fileregex) {
+         if (bsr->fileregex) { 
             nbsr->next->fileregex = bstrdup(bsr->fileregex);
          }
 
diff --git a/src/dird/bsr.h b/src/dird/bsr.h
index 1844646..216e16f 100644
--- a/src/dird/bsr.h
+++ b/src/dird/bsr.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2002-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -22,7 +26,6 @@
  *
  *     Kern Sibbald, July MMII
  *
- *   Version $Id$
  */
 
 
@@ -52,4 +55,3 @@ struct RBSR {
    RBSR_FINDEX *fi;                   /* File indexes this JobId */
    char *fileregex;                   /* Only restore files matching regex */
 };
-
diff --git a/src/dird/catreq.c b/src/dird/catreq.c
index 5e4c663..3bb86d0 100644
--- a/src/dird/catreq.c
+++ b/src/dird/catreq.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -37,27 +41,25 @@
  */
 
 /* Requests from the Storage daemon */
-static char Find_media[] = "CatReq Job=%127s FindMedia=%d pool_name=%127s media_type=%127s\n";
+static char Find_media[] = "CatReq Job=%127s FindMedia=%d pool_name=%127s media_type=%127s vol_type=%d\n";
 static char Get_Vol_Info[] = "CatReq Job=%127s GetVolInfo VolName=%127s write=%d\n";
 
 static char Update_media[] = "CatReq Job=%127s UpdateMedia VolName=%s"
-   " VolJobs=%u VolFiles=%u VolBlocks=%u VolBytes=%lld VolMounts=%u"
+   " VolJobs=%u VolFiles=%u VolBlocks=%u VolBytes=%lld VolABytes=%lld"
+   " VolHoleBytes=%lld VolHoles=%u VolMounts=%u"
    " VolErrors=%u VolWrites=%lld MaxVolBytes=%lld EndTime=%lld VolStatus=%10s"
    " Slot=%d relabel=%d InChanger=%d VolReadTime=%lld VolWriteTime=%lld"
-   " VolFirstWritten=%lld VolParts=%u\n";
-
-static char Create_job_media[] = "CatReq Job=%127s CreateJobMedia "
-   " FirstIndex=%u LastIndex=%u StartFile=%u EndFile=%u "
-   " StartBlock=%u EndBlock=%u Copy=%d Strip=%d MediaId=%" lld "\n";
+   " VolFirstWritten=%lld VolType=%u\n";
 
+static char Create_jobmedia[] = "CatReq Job=%127s CreateJobMedia\n";
 
 /* Responses  sent to Storage daemon */
 static char OK_media[] = "1000 OK VolName=%s VolJobs=%u VolFiles=%u"
-   " VolBlocks=%u VolBytes=%s"
+   " VolBlocks=%u VolBytes=%s VolABytes=%s VolHoleBytes=%s VolHoles=%u"
    " VolMounts=%u VolErrors=%u VolWrites=%s"
    " MaxVolBytes=%s VolCapacityBytes=%s VolStatus=%s Slot=%d"
    " MaxVolJobs=%u MaxVolFiles=%u InChanger=%d VolReadTime=%s"
-   " VolWriteTime=%s EndFile=%u EndBlock=%u VolParts=%u LabelType=%d"
+   " VolWriteTime=%s EndFile=%u EndBlock=%u VolType=%u LabelType=%d"
    " MediaId=%s ScratchPoolId=%s\n";
 
 static char OK_create[] = "1000 OK CreateJobMedia\n";
@@ -66,7 +68,7 @@ static char OK_create[] = "1000 OK CreateJobMedia\n";
 static int send_volume_info_to_storage_daemon(JCR *jcr, BSOCK *sd, MEDIA_DBR *mr)
 {
    int stat;
-   char ed1[50], ed4[50], ed5[50], ed6[50], ed7[50], ed8[50],
+   char ed1[50], ed2[50], ed3[50], ed4[50], ed5[50], ed6[50], ed7[50], ed8[50],
         ed9[50], ed10[50];
 
    jcr->MediaId = mr->MediaId;
@@ -74,7 +76,9 @@ static int send_volume_info_to_storage_daemon(JCR *jcr, BSOCK *sd, MEDIA_DBR *mr
    bash_spaces(mr->VolumeName);
    stat = sd->fsend(OK_media, mr->VolumeName, mr->VolJobs,
       mr->VolFiles, mr->VolBlocks, edit_uint64(mr->VolBytes, ed1),
-      mr->VolMounts, mr->VolErrors,
+      edit_uint64(mr->VolABytes, ed2),
+      edit_uint64(mr->VolHoleBytes, ed3),
+      mr->VolHoles, mr->VolMounts, mr->VolErrors,
       edit_uint64(mr->VolWrites, ed4),
       edit_uint64(mr->MaxVolBytes, ed5),
       edit_uint64(mr->VolCapacityBytes, ed6),
@@ -83,7 +87,7 @@ static int send_volume_info_to_storage_daemon(JCR *jcr, BSOCK *sd, MEDIA_DBR *mr
       edit_int64(mr->VolReadTime, ed7),
       edit_int64(mr->VolWriteTime, ed8),
       mr->EndFile, mr->EndBlock,
-      mr->VolParts,
+      mr->VolType,
       mr->LabelType,
       edit_uint64(mr->MediaId, ed9),
       edit_uint64(mr->ScratchPoolId, ed10));
@@ -92,6 +96,9 @@ static int send_volume_info_to_storage_daemon(JCR *jcr, BSOCK *sd, MEDIA_DBR *mr
    return stat;
 }
 
+/* TODO: See if we want to let the FD do all kind
+ *       of catalog request/update
+ */
 void catalog_request(JCR *jcr, BSOCK *bs)
 {
    MEDIA_DBR mr, sdmr;
@@ -101,7 +108,6 @@ void catalog_request(JCR *jcr, BSOCK *bs)
    int index, ok, label, writing;
    POOLMEM *omsg;
    POOL_DBR pr;
-   uint32_t Stripe, Copy;
    uint64_t MediaId;
    utime_t VolFirstWritten;
    utime_t VolLastWritten;
@@ -126,8 +132,8 @@ void catalog_request(JCR *jcr, BSOCK *bs)
    /*
     * Find next appendable medium for SD
     */
-   n = sscanf(bs->msg, Find_media, &Job, &index, &pool_name, &mr.MediaType);
-   if (n == 4) {
+   n = sscanf(bs->msg, Find_media, &Job, &index, &pool_name, &mr.MediaType, &mr.VolType);
+   if (n == 5) {
       memset(&pr, 0, sizeof(pr));
       bstrncpy(pr.Name, pool_name, sizeof(pr.Name));
       unbash_spaces(pr.Name);
@@ -222,11 +228,12 @@ void catalog_request(JCR *jcr, BSOCK *bs)
     */
    n = sscanf(bs->msg, Update_media, &Job, &sdmr.VolumeName,
       &sdmr.VolJobs, &sdmr.VolFiles, &sdmr.VolBlocks, &sdmr.VolBytes,
+      &sdmr.VolABytes, &sdmr.VolHoleBytes, &sdmr.VolHoles,
       &sdmr.VolMounts, &sdmr.VolErrors, &sdmr.VolWrites, &sdmr.MaxVolBytes,
       &VolLastWritten, &sdmr.VolStatus, &sdmr.Slot, &label, &sdmr.InChanger,
       &sdmr.VolReadTime, &sdmr.VolWriteTime, &VolFirstWritten,
-      &sdmr.VolParts);
-    if (n == 19) {
+      &sdmr.VolType);
+    if (n == 22) {
       db_lock(jcr->db);
       Dmsg3(400, "Update media %s oldStat=%s newStat=%s\n", sdmr.VolumeName,
          mr.VolStatus, sdmr.VolStatus);
@@ -298,12 +305,15 @@ void catalog_request(JCR *jcr, BSOCK *bs)
       mr.VolFiles     = sdmr.VolFiles;
       mr.VolBlocks    = sdmr.VolBlocks;
       mr.VolBytes     = sdmr.VolBytes;
+      mr.VolABytes    = sdmr.VolABytes;
+      mr.VolHoleBytes = sdmr.VolHoleBytes;
+      mr.VolHoles     = sdmr.VolHoles;
       mr.VolMounts    = sdmr.VolMounts;
       mr.VolErrors    = sdmr.VolErrors;
       mr.VolWrites    = sdmr.VolWrites;
       mr.Slot         = sdmr.Slot;
       mr.InChanger    = sdmr.InChanger;
-      mr.VolParts     = sdmr.VolParts;
+      mr.VolType     = sdmr.VolType;
       bstrncpy(mr.VolStatus, sdmr.VolStatus, sizeof(mr.VolStatus));
       if (sdmr.VolReadTime >= 0) {
          mr.VolReadTime  = sdmr.VolReadTime;
@@ -334,28 +344,48 @@ void catalog_request(JCR *jcr, BSOCK *bs)
    /*
     * Request to create a JobMedia record
     */
-   n = sscanf(bs->msg, Create_job_media, &Job,
-      &jm.FirstIndex, &jm.LastIndex, &jm.StartFile, &jm.EndFile,
-      &jm.StartBlock, &jm.EndBlock, &Copy, &Stripe, &MediaId);
-   if (n == 10) {
+   if (sscanf(bs->msg, Create_jobmedia, &Job) == 1) {
       if (jcr->wjcr) {
          jm.JobId = jcr->wjcr->JobId;
       } else {
          jm.JobId = jcr->JobId;
       }
-      jm.MediaId = MediaId;
-      Dmsg6(400, "create_jobmedia JobId=%d MediaId=%d SF=%d EF=%d FI=%d LI=%d\n",
-         jm.JobId, jm.MediaId, jm.StartFile, jm.EndFile, jm.FirstIndex, jm.LastIndex);
-      if (!db_create_jobmedia_record(jcr, jcr->db, &jm)) {
+      ok = true;
+      db_lock(jcr->db);
+      db_start_transaction(jcr, jcr->db);
+      while (bs->recv() >= 0) {
+         if (ok && sscanf(bs->msg, "%u %u %u %u %u %u %lld\n",
+             &jm.FirstIndex, &jm.LastIndex, &jm.StartFile, &jm.EndFile,
+             &jm.StartBlock, &jm.EndBlock, &MediaId) != 7) {
+            ok = false;
+            continue;
+         }
+         if (ok) {
+            jm.MediaId = MediaId;
+            Dmsg6(400, "create_jobmedia JobId=%d MediaId=%d SF=%d EF=%d FI=%d LI=%d\n",
+              jm.JobId, jm.MediaId, jm.StartFile, jm.EndFile, jm.FirstIndex, jm.LastIndex);
+            ok = db_create_jobmedia_record(jcr, jcr->db, &jm);
+         }
+      }
+      db_end_transaction(jcr, jcr->db);
+      if (!ok) {
          Jmsg(jcr, M_FATAL, 0, _("Catalog error creating JobMedia record. %s"),
             db_strerror(jcr->db));
+         db_unlock(jcr->db);
          bs->fsend(_("1992 Create JobMedia error\n"));
-      } else {
-         Dmsg0(400, "JobMedia record created\n");
-         bs->fsend(OK_create);
+         goto ok_out; 
       }
+      db_unlock(jcr->db);
+      Dmsg0(400, "JobMedia record created\n");
+      bs->fsend(OK_create);
       goto ok_out;
    }
+
+   /* Handle snapshot catalog request */
+   if (snapshot_catreq(jcr, bs)) {
+      goto ok_out;
+   }
+
    Dmsg1(1000, "Tried create_jobmedia. fields wanted=10, got=%d\n", n);
 
    /* Everything failed. Send error message. */
@@ -389,7 +419,7 @@ static void update_attribute(JCR *jcr, char *msg, int32_t msglen)
    uint32_t reclen;
 
    /* Start transaction allocates jcr->attr and jcr->ar if needed */
-   db_start_transaction(jcr, jcr->db);     /* start transaction if not already open */
+   db_start_transaction(jcr, jcr->db); /* start transaction if not already open */
    ar = jcr->ar;
 
    /*
@@ -595,7 +625,7 @@ static void update_attribute(JCR *jcr, char *msg, int32_t msglen)
 
             /* Update BaseFile table */
             if (!db_create_attributes_record(jcr, jcr->db, ar)) {
-               Jmsg1(jcr, M_FATAL, 0, _("attribute create error. %s"),
+               Jmsg1(jcr, M_FATAL, 0, _("attribute create error. ERR=%s"),
                         db_strerror(jcr->db));
             }
             jcr->cached_attribute = false;
diff --git a/src/dird/dir_plugins.c b/src/dird/dir_plugins.c
index 6f693fe..c672341 100644
--- a/src/dird/dir_plugins.c
+++ b/src/dird/dir_plugins.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Main program to test loading and running Bacula plugins.
@@ -89,10 +93,10 @@ int generate_plugin_event(JCR *jcr, bDirEventType eventType, void *value)
    bpContext *plugin_ctx;
    bDirEvent event;
    Plugin *plugin;
-   int i;
+   int i = 0;
    bRC rc = bRC_OK;
 
-   if (!bplugin_list || !jcr || !jcr->plugin_ctx_list) {
+   if (!b_plugin_list || !jcr || !jcr->plugin_ctx_list) {
       return bRC_OK;                  /* Return if no plugins loaded */
    }
    if (jcr->is_job_canceled()) {
@@ -104,7 +108,7 @@ int generate_plugin_event(JCR *jcr, bDirEventType eventType, void *value)
 
    Dmsg2(dbglvl, "dir-plugin_ctx_list=%p JobId=%d\n", jcr->plugin_ctx_list, jcr->JobId);
 
-   foreach_alist_index(i, plugin, bplugin_list) {
+   foreach_alist_index(i, plugin, b_plugin_list) {
       plugin_ctx = &plugin_ctx_list[i];
       if (is_plugin_disabled(plugin_ctx)) {
          continue;
@@ -145,18 +149,18 @@ void load_dir_plugins(const char *plugin_dir)
    Plugin *plugin;
    int i;
 
-   Dmsg0(dbglvl, "Load dir plugins\n");
+   Dmsg0(dbglvl, "Load Director plugins\n");
    if (!plugin_dir) {
-      Dmsg0(dbglvl, "No dir plugin dir!\n");
+      Dmsg0(dbglvl, "No Director plugin directory!\n");
       return;
    }
-   bplugin_list = New(alist(10, not_owned_by_alist));
+   b_plugin_list = New(alist(10, not_owned_by_alist));
    if (!load_plugins((void *)&binfo, (void *)&bfuncs, plugin_dir, plugin_type,
                 is_plugin_compatible)) {
       /* Either none found, or some error */
-      if (bplugin_list->size() == 0) {
-         delete bplugin_list;
-         bplugin_list = NULL;
+      if (b_plugin_list->size() == 0) {
+         delete b_plugin_list;
+         b_plugin_list = NULL;
          Dmsg0(dbglvl, "No plugins loaded\n");
          return;
       }
@@ -165,12 +169,12 @@ void load_dir_plugins(const char *plugin_dir)
     * Verify that the plugin is acceptable, and print information
     *  about it.
     */
-   foreach_alist_index(i, plugin, bplugin_list) {
+   foreach_alist_index(i, plugin, b_plugin_list) {
       Jmsg(NULL, M_INFO, 0, _("Loaded plugin: %s\n"), plugin->file);
       Dmsg1(dbglvl, "Loaded plugin: %s\n", plugin->file);
    }
 
-   Dmsg1(dbglvl, "num plugins=%d\n", bplugin_list->size());
+   Dmsg1(dbglvl, "num plugins=%d\n", b_plugin_list->size());
    dbg_plugin_add_hook(dump_dir_plugin);
 }
 
@@ -226,18 +230,18 @@ static bool is_plugin_compatible(Plugin *plugin)
 void new_plugins(JCR *jcr)
 {
    Plugin *plugin;
-   int i;
+   int i = 0;
 
    Dmsg0(dbglvl, "=== enter new_plugins ===\n");
-   if (!bplugin_list) {
-      Dmsg0(dbglvl, "No dir plugin list!\n");
+   if (!b_plugin_list) {
+      Dmsg0(dbglvl, "No Director plugin list!\n");
       return;
    }
    if (jcr->is_job_canceled()) {
       return;
    }
 
-   int num = bplugin_list->size();
+   int num = b_plugin_list->size();
 
    Dmsg1(dbglvl, "dir-plugin-list size=%d\n", num);
    if (num == 0) {
@@ -248,7 +252,7 @@ void new_plugins(JCR *jcr)
 
    bpContext *plugin_ctx_list = jcr->plugin_ctx_list;
    Dmsg2(dbglvl, "Instantiate dir-plugin_ctx_list=%p JobId=%d\n", jcr->plugin_ctx_list, jcr->JobId);
-   foreach_alist_index(i, plugin, bplugin_list) {
+   foreach_alist_index(i, plugin, b_plugin_list) {
       /* Start a new instance of each plugin */
       bacula_ctx *b_ctx = (bacula_ctx *)malloc(sizeof(bacula_ctx));
       memset(b_ctx, 0, sizeof(bacula_ctx));
@@ -267,15 +271,15 @@ void new_plugins(JCR *jcr)
 void free_plugins(JCR *jcr)
 {
    Plugin *plugin;
-   int i;
+   int i = 0;
 
-   if (!bplugin_list || !jcr->plugin_ctx_list) {
+   if (!b_plugin_list || !jcr->plugin_ctx_list) {
       return;
    }
 
    bpContext *plugin_ctx_list = (bpContext *)jcr->plugin_ctx_list;
    Dmsg2(dbglvl, "Free instance dir-plugin_ctx_list=%p JobId=%d\n", jcr->plugin_ctx_list, jcr->JobId);
-   foreach_alist_index(i, plugin, bplugin_list) {
+   foreach_alist_index(i, plugin, b_plugin_list) {
       /* Free the plugin instance */
       dirplug_func(plugin)->freePlugin(&plugin_ctx_list[i]);
       free(plugin_ctx_list[i].bContext);     /* free Bacula private context */
diff --git a/src/dird/dir_plugins.h b/src/dird/dir_plugins.h
index 363acd0..0fa7f72 100644
--- a/src/dird/dir_plugins.h
+++ b/src/dird/dir_plugins.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Interface definition for Bacula Plugins
diff --git a/src/dird/dird.c b/src/dird/dird.c
index 8706334..aa1ec18 100644
--- a/src/dird/dird.c
+++ b/src/dird/dird.c
@@ -1,23 +1,27 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
  *   Bacula Director daemon -- this is the main program
  *
- *     Written by Kern Sibbald, March MM
+ *     Kern Sibbald, March MM
  *
  */
 
@@ -59,6 +63,7 @@ void store_replace(LEX *lc, RES_ITEM *item, int index, int pass);
 void store_migtype(LEX *lc, RES_ITEM *item, int index, int pass);
 void init_device_resources();
 
+
 static char *runjob = NULL;
 static bool background = true;
 static void init_reload(void);
@@ -70,6 +75,7 @@ int FDConnectTimeout;
 int SDConnectTimeout;
 char *configfile = NULL;
 void *start_heap;
+utime_t last_reload_time = 0;
 
 /* Globals Imported */
 extern RES_ITEM job_items[];
@@ -90,56 +96,57 @@ static bool check_catalog(cat_op mode);
 
 #define CONFIG_FILE "bacula-dir.conf" /* default configuration file */
 
-/*
- * This allows the message handler to operate on the database
- *   by using a pointer to this function. The pointer is
- *   needed because the other daemons do not have access
- *   to the database.  If the pointer is
- *   not defined (other daemons), then writing the database
- *   is disabled.
- */
-static bool dir_sql_query(JCR *jcr, const char *cmd)
-{
-   if (!jcr || !jcr->db || !jcr->db->is_connected()) {
-      return false;
-   }
-
-   return db_sql_query(jcr->db, cmd);
-}
-
-static bool dir_sql_escape(JCR *jcr, B_DB *mdb, char *snew, char *old, int len)
-{
-   if (!jcr || !jcr->db || !jcr->db->is_connected()) {
-      return false;
-   }
-
-   db_escape_string(jcr, mdb, snew, old, len);
-   return true;
-}
+static bool dir_sql_query(JCR *jcr, const char *cmd) 
+{ 
+   if (jcr && jcr->db && jcr->db->is_connected()) {
+      return db_sql_query(jcr->db, cmd, NULL, NULL);
+   } 
+   return false; 
+} 
+
+static bool dir_sql_escape(JCR *jcr, BDB *mdb, char *snew, char *sold, int len) 
+{ 
+   if (jcr && jcr->db && jcr->db->is_connected()) { 
+      db_escape_string(jcr, mdb, snew, sold, len);
+      return true;
+   } 
+   return false; 
+} 
 
 static void usage()
 {
    fprintf(stderr, _(
-PROG_COPYRIGHT
-"\nVersion: %s (%s)\n\n"
-"Usage: bacula-dir [-f -s] [-c config_file] [-d debug_level] [config_file]\n"
-"       -c <file>   set configuration file to file\n"
-"       -d <nn>     set debug level to <nn>\n"
-"       -dt         print timestamp in debug output\n"
-"       -f          run in foreground (for debugging)\n"
-"       -g          groupid\n"
-"       -m          print kaboom output (for debugging)\n"
-"       -r <job>    run <job> now\n"
-"       -s          no signals\n"
-"       -t          test - read configuration and exit\n"
-"       -u          userid\n"
-"       -v          verbose user messages\n"
-"       -?          print this message.\n"
-"\n"), 2000, VERSION, BDATE);
+      PROG_COPYRIGHT
+      "\nVersion: %s (%s)\n\n"
+      "Usage: bacula-dir [-f -s] [-c config_file] [-d debug_level] [config_file]\n"
+      "     -c <file>        set configuration file to file\n"
+      "     -d <nn>[,<tags>] set debug level to <nn>, debug tags to <tags>\n"
+      "     -dt              print timestamp in debug output\n"
+      "     -T               set trace on\n"
+      "     -f               run in foreground (for debugging)\n"
+      "     -g               groupid\n"
+      "     -m               print kaboom output (for debugging)\n"
+      "     -r <job>         run <job> now\n"
+      "     -s               no signals\n"
+      "     -t               test - read configuration and exit\n"
+      "     -u               userid\n"
+      "     -v               verbose user messages\n"
+      "     -?               print this message.\n"
+      "\n"), 2000, VERSION, BDATE);
 
    exit(1);
 }
 
+/*
+ * !!! WARNING !!! Use this function only when bacula is stopped.
+ * ie, after a fatal signal and before exiting the program
+ * Print information about a JCR
+ */
+static void dir_debug_print(JCR *jcr, FILE *fp)
+{
+   fprintf(fp, "\twstore=%p rstore=%p wjcr=%p client=%p reschedule_count=%d SD_msg_chan_started=%d\n",
+           jcr->wstore, jcr->rstore, jcr->wjcr, jcr->client, jcr->reschedule_count, (int)jcr->SD_msg_chan_started);
+}
 
 /*********************************************************************
  *
@@ -173,7 +180,7 @@ int main (int argc, char *argv[])
 
    console_command = run_console_command;
 
-   while ((ch = getopt(argc, argv, "c:d:fg:mr:stu:v?")) != -1) {
+   while ((ch = getopt(argc, argv, "c:d:fg:mr:stu:v?T")) != -1) {
       switch (ch) {
       case 'c':                    /* specify config file */
          if (configfile != NULL) {
@@ -186,12 +193,24 @@ int main (int argc, char *argv[])
          if (*optarg == 't') {
             dbg_timestamp = true;
          } else {
+            char *p;
+            /* We probably find a tag list -d 10,sql,bvfs */
+            if ((p = strchr(optarg, ',')) != NULL) {
+               *p = 0;
+            }
             debug_level = atoi(optarg);
             if (debug_level <= 0) {
                debug_level = 1;
             }
+            if (p) {
+               debug_parse_tags(p+1, &debug_level_tags);
+            }
          }
-         Dmsg1(10, "Debug level = %d\n", debug_level);
+         Dmsg1(10, "Debug level = %lld\n", debug_level);
+         break;
+
+      case 'T':
+         set_trace(true);
          break;
 
       case 'f':                    /* run in foreground */
@@ -256,11 +275,19 @@ int main (int argc, char *argv[])
       usage();
    }
 
+   if (!test_config) {                /* we don't need to do this block in test mode */
+      if (background) {
+         daemon_start();
+         init_stack_dump();              /* grab new pid */
+      }
+   }
+
    if (configfile == NULL) {
       configfile = bstrdup(CONFIG_FILE);
    }
 
    config = new_config_parser();
+
    parse_dir_config(config, configfile, M_ERROR_TERM);
 
    if (init_crypto() != 0) {
@@ -271,11 +298,7 @@ int main (int argc, char *argv[])
       Jmsg((JCR *)NULL, M_ERROR_TERM, 0, _("Please correct configuration file: %s\n"), configfile);
    }
 
-   if (!test_config) {                /* we don't need to do this block in test mode */
-      if (background) {
-         daemon_start();
-         init_stack_dump();              /* grab new pid */
-      }
+   if (!test_config) {
       /* Create pid must come after we are a daemon -- so we have our final pid */
       create_pid_file(director->pid_directory, "bacula-dir",
                       get_first_port_host_order(director->DIRaddrs));
@@ -308,8 +331,8 @@ int main (int argc, char *argv[])
    cleanup_old_files();
 
    /* Plug database interface for library routines */
-   p_sql_query = (sql_query_func)dir_sql_query;
-   p_sql_escape = (sql_escape_func)dir_sql_escape;
+   p_sql_query = (sql_query_call)dir_sql_query;
+   p_sql_escape = (sql_escape_call)dir_sql_escape;
 
    FDConnectTimeout = (int)director->FDConnectTimeout;
    SDConnectTimeout = (int)director->SDConnectTimeout;
@@ -329,7 +352,10 @@ int main (int argc, char *argv[])
 
    init_job_server(director->MaxConcurrentJobs);
 
-   dbg_jcr_add_hook(db_debug_print); /* used to debug B_DB connexion after fatal signal */
+   dbg_jcr_add_hook(dir_debug_print); /* used to director variables */
+   dbg_jcr_add_hook(bdb_debug_print);     /* used to debug B_DB connexion after fatal signal */
+
+//   init_device_resources();
 
    Dmsg0(200, "wait for next job\n");
    /* Main loop -- call scheduler to get next job to run */
@@ -347,53 +373,12 @@ int main (int argc, char *argv[])
    return 0;
 }
 
-/* Cleanup and then exit */
-void terminate_dird(int sig)
-{
-   static bool already_here = false;
-
-   if (already_here) {                /* avoid recursive temination problems */
-      bmicrosleep(2, 0);              /* yield */
-      exit(1);
-   }
-   already_here = true;
-   debug_level = 0;                   /* turn off debug */
-   stop_watchdog();
-   generate_daemon_event(NULL, "Exit");
-   unload_plugins();
-   write_state_file(director->working_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
-   delete_pid_file(director->pid_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
-   term_scheduler();
-   term_job_server();
-   if (runjob) {
-      free(runjob);
-   }
-   if (configfile != NULL) {
-      free(configfile);
-   }
-   if (debug_level > 5) {
-      print_memory_pool_stats();
-   }
-   if (config) {
-      config->free_resources();
-      free(config);
-      config = NULL;
-   }
-   term_ua_server();
-   term_msg();                        /* terminate message handler */
-   cleanup_crypto();
-   close_memory_pool();               /* release free memory in pool */
-   lmgr_cleanup_main();
-   sm_dump(false);
-   exit(sig);
-}
-
 struct RELOAD_TABLE {
    int job_count;
    RES **res_table;
 };
 
-static const int max_reloads = 32;
+static const int max_reloads = 50;
 static RELOAD_TABLE reload_table[max_reloads];
 
 static void init_reload(void)
@@ -404,6 +389,10 @@ static void init_reload(void)
    }
 }
 
+/*
+ * This subroutine frees a saved resource table.
+ *  It was saved when a new table was created with "reload"
+ */
 static void free_saved_resources(int table)
 {
    int num = r_last - r_first + 1;
@@ -564,6 +553,47 @@ bail_out:
    already_here = false;
 }
 
+/* Cleanup and then exit */
+void terminate_dird(int sig)
+{
+   static bool already_here = false;
+
+   if (already_here) {                /* avoid recursive temination problems */
+      bmicrosleep(2, 0);              /* yield */
+      exit(1);
+   }
+   already_here = true;
+   debug_level = 0;                   /* turn off debug */
+   stop_watchdog();
+   generate_daemon_event(NULL, "Exit");
+   unload_plugins();
+   write_state_file(director->working_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
+   delete_pid_file(director->pid_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
+   term_scheduler();
+   term_job_server();
+   if (runjob) {
+      free(runjob);
+   }
+   if (configfile != NULL) {
+      free(configfile);
+   }
+   if (chk_dbglvl(5)) {
+      print_memory_pool_stats();
+   }
+   if (config) {
+      config->free_resources();
+      free(config);
+      config = NULL;
+   }
+   term_ua_server();
+   term_msg();                        /* terminate message handler */
+   cleanup_crypto();
+   close_memory_pool();               /* release free memory in pool */
+   lmgr_cleanup_main();
+   sm_dump(false);
+   exit(sig);
+}
+
 /*
  * Make a quick check to see that we have all the
  * resources needed.
@@ -757,6 +787,7 @@ static bool check_resources()
                 */
                } else if (job_items[i].handler == store_time   ||
                           job_items[i].handler == store_size64 ||
+                          job_items[i].handler == store_speed  ||
                           job_items[i].handler == store_int64) {
                   def_lvalue = (int64_t *)((char *)(job->jobdefs) + offset);
                   Dmsg5(400, "Job \"%s\", field \"%s\" def_lvalue=%" lld " item %d offset=%u\n",
@@ -896,50 +927,11 @@ static bool check_resources()
       }
    }
 
-   /* Loop over Storages */
-   STORE *store;
-   foreach_res(store, R_STORAGE) {
-      /* tls_require implies tls_enable */
-      if (store->tls_require) {
-         if (have_tls) {
-            store->tls_enable = true;
-         } else {
-            Jmsg(NULL, M_FATAL, 0, _("TLS required but not configured in Bacula.\n"));
-            OK = false;
-            continue;
-         }
-      }
-
-      need_tls = store->tls_enable || store->tls_authenticate;
-
-      if ((!store->tls_ca_certfile && !store->tls_ca_certdir) && need_tls) {
-         Jmsg(NULL, M_FATAL, 0, _("Neither \"TLS CA Certificate\""
-              " or \"TLS CA Certificate Dir\" are defined for Storage \"%s\" in %s.\n"),
-              store->name(), configfile);
-         OK = false;
-      }
-
-      /* If everything is well, attempt to initialize our per-resource TLS context */
-      if (OK && (need_tls || store->tls_require)) {
-        /* Initialize TLS context:
-         * Args: CA certfile, CA certdir, Certfile, Keyfile,
-         * Keyfile PEM Callback, Keyfile CB Userdata, DHfile, Verify Peer */
-         store->tls_ctx = new_tls_context(store->tls_ca_certfile,
-            store->tls_ca_certdir, store->tls_certfile,
-            store->tls_keyfile, NULL, NULL, NULL, true);
-
-         if (!store->tls_ctx) {
-            Jmsg(NULL, M_FATAL, 0, _("Failed to initialize TLS context for Storage \"%s\" in %s.\n"),
-                 store->name(), configfile);
-            OK = false;
-         }
-      }
-   }
-
    UnlockRes();
    if (OK) {
       close_msg(NULL);                /* close temp message handler */
       init_msg(NULL, director->messages); /* open daemon message handler */
+      last_reload_time = time(NULL);
    }
    return OK;
 }
@@ -953,20 +945,22 @@ static bool check_resources()
 static bool check_catalog(cat_op mode)
 {
    bool OK = true;
+   bool need_tls;
 
    /* Loop over databases */
    CAT *catalog;
    foreach_res(catalog, R_CATALOG) {
-      B_DB *db;
+      BDB *db;
       /*
        * Make sure we can open catalog, otherwise print a warning
        * message because the server is probably not running.
        */
-      db = db_init_database(NULL, catalog->db_driver, catalog->db_name, catalog->db_user,
-                            catalog->db_password, catalog->db_address,
-                            catalog->db_port, catalog->db_socket,
-                            catalog->mult_db_connections,
-                            catalog->disable_batch_insert);
+      db = db_init_database(NULL, catalog->db_driver, catalog->db_name, 
+              catalog->db_user,
+              catalog->db_password, catalog->db_address,
+              catalog->db_port, catalog->db_socket,
+              catalog->mult_db_connections,
+              catalog->disable_batch_insert);
       if (!db || !db_open_database(NULL, db)) {
          Pmsg2(000, _("Could not open Catalog \"%s\", database \"%s\".\n"),
               catalog->name(), catalog->db_name);
@@ -989,7 +983,7 @@ static bool check_catalog(cat_op mode)
 
       /* we are in testing mode, so don't touch anything in the catalog */
       if (mode == CHECK_CONNECTION) {
-         db_close_database(NULL, db);
+         if (db) db_close_database(NULL, db);
          continue;
       }
 
@@ -1032,6 +1026,7 @@ static bool check_catalog(cat_op mode)
                client->catalog->name(), client->name());
          memset(&cr, 0, sizeof(cr));
          bstrncpy(cr.Name, client->name(), sizeof(cr.Name));
+
          db_create_client_record(NULL, db, &cr);
       }
 
@@ -1065,6 +1060,41 @@ static bool check_catalog(cat_op mode)
                OK = false;
             }
          }
+
+         /* tls_require implies tls_enable */
+         if (store->tls_require) {
+            if (have_tls) {
+               store->tls_enable = true;
+            } else {
+               Jmsg(NULL, M_FATAL, 0, _("TLS required but not configured in Bacula.\n"));
+               OK = false;
+            }
+         }
+
+         need_tls = store->tls_enable || store->tls_authenticate;
+
+         if ((!store->tls_ca_certfile && !store->tls_ca_certdir) && need_tls) {
+            Jmsg(NULL, M_FATAL, 0, _("Neither \"TLS CA Certificate\""
+                 " or \"TLS CA Certificate Dir\" are defined for Storage \"%s\" in %s.\n"),
+                 store->name(), configfile);
+            OK = false;
+         }
+
+         /* If everything is well, attempt to initialize our per-resource TLS context */
+         if (OK && (need_tls || store->tls_require)) {
+           /* Initialize TLS context:
+            * Args: CA certfile, CA certdir, Certfile, Keyfile,
+            * Keyfile PEM Callback, Keyfile CB Userdata, DHfile, Verify Peer */
+            store->tls_ctx = new_tls_context(store->tls_ca_certfile,
+               store->tls_ca_certdir, store->tls_certfile,
+               store->tls_keyfile, NULL, NULL, NULL, true);
+
+            if (!store->tls_ctx) {
+               Jmsg(NULL, M_FATAL, 0, _("Failed to initialize TLS context for Storage \"%s\" in %s.\n"),
+                    store->name(), configfile);
+               OK = false;
+            }
+         }
       }
 
       /* Loop over all counters, defining them in each database */
@@ -1099,10 +1129,9 @@ static bool check_catalog(cat_op mode)
          db_sql_query(db, cleanup_running_job, NULL, NULL);
       }
 
-      /* Set type in global for debugging */
-      set_db_type(db_get_type(db));
-
-      db_close_database(NULL, db);
+      /* Set SQL engine name in global for debugging */
+      set_db_engine_name(db_get_engine_name(db));
+      if (db) db_close_database(NULL, db);
    }
    return OK;
 }
@@ -1122,8 +1151,8 @@ static void cleanup_old_files()
    regmatch_t pmatch[nmatch];
    berrno be;
 
-   /* Exclude spaces and look for .mail or .restore.xx.bsr files */
-   const char *pat1 = "^[^ ]+\\.(restore\\.[^ ]+\\.bsr|mail)$";
+   /* Exclude spaces and look for .mail, .tmp or .restore.xx.bsr files */
+   const char *pat1 = "^[^ ]+\\.(restore\\.[^ ]+\\.bsr|mail|tmp)$";
 
    /* Setup working directory prefix */
    pm_strcpy(basename, director->working_directory);
diff --git a/src/dird/dird.h b/src/dird/dird.h
index 9b87a01..6f35c13 100644
--- a/src/dird/dird.h
+++ b/src/dird/dird.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Includes specific to the Director
@@ -29,7 +33,6 @@
 
 #include "dir_plugins.h"
 #include "cats/cats.h"
-#include "cats/sql_glue.h"
 
 #include "jcr.h"
 #include "bsr.h"
diff --git a/src/dird/dird_conf.c b/src/dird/dird_conf.c
index ebd1bc2..9e23711 100644
--- a/src/dird/dird_conf.c
+++ b/src/dird/dird_conf.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *   Main configuration file parser for Bacula Directors,
@@ -62,9 +66,8 @@ void store_level(LEX *lc, RES_ITEM *item, int index, int pass);
 void store_replace(LEX *lc, RES_ITEM *item, int index, int pass);
 void store_acl(LEX *lc, RES_ITEM *item, int index, int pass);
 void store_migtype(LEX *lc, RES_ITEM *item, int index, int pass);
-static void store_actiononpurge(LEX *lc, RES_ITEM *item, int index, int pass);
 static void store_device(LEX *lc, RES_ITEM *item, int index, int pass);
-static void store_runscript(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_actiononpurge(LEX *lc, RES_ITEM *item, int index, int pass);
 static void store_runscript_when(LEX *lc, RES_ITEM *item, int index, int pass);
 static void store_runscript_cmd(LEX *lc, RES_ITEM *item, int index, int pass);
 static void store_short_runscript(LEX *lc, RES_ITEM *item, int index, int pass);
@@ -83,10 +86,10 @@ URES res_all;
 #endif
 int32_t res_all_size = sizeof(res_all);
 
-
-/* Definition of records permitted within each
+/*
+ * Definition of records permitted within each
  * resource with the routine to process the record
- * information.  NOTE! quoted names must be in lower case.
+ * information.
  */
 /*
  *    Director Resource
@@ -94,37 +97,38 @@ int32_t res_all_size = sizeof(res_all);
  *   name          handler     value                 code flags    default_value
  */
 static RES_ITEM dir_items[] = {
-   {"name",        store_name,     ITEM(res_dir.hdr.name), 0, ITEM_REQUIRED, 0},
-   {"description", store_str,      ITEM(res_dir.hdr.desc), 0, 0, 0},
-   {"messages",    store_res,      ITEM(res_dir.messages), R_MSGS, 0, 0},
-   {"dirport",     store_addresses_port,    ITEM(res_dir.DIRaddrs),  0, ITEM_DEFAULT, 9101},
-   {"diraddress",  store_addresses_address, ITEM(res_dir.DIRaddrs),  0, ITEM_DEFAULT, 9101},
-   {"diraddresses",store_addresses,         ITEM(res_dir.DIRaddrs),  0, ITEM_DEFAULT, 9101},
-   {"dirsourceaddress",store_addresses_address, ITEM(res_dir.DIRsrc_addr),  0, ITEM_DEFAULT, 0},
-   {"queryfile",   store_dir,      ITEM(res_dir.query_file), 0, ITEM_REQUIRED, 0},
-   {"workingdirectory", store_dir, ITEM(res_dir.working_directory), 0, ITEM_REQUIRED, 0},
-   {"plugindirectory",  store_dir, ITEM(res_dir.plugin_directory),  0, 0, 0},
-   {"scriptsdirectory", store_dir, ITEM(res_dir.scripts_directory), 0, 0, 0},
-   {"piddirectory",     store_dir, ITEM(res_dir.pid_directory),     0, ITEM_REQUIRED, 0},
-   {"subsysdirectory",  store_dir, ITEM(res_dir.subsys_directory),  0, 0, 0},
-   {"maximumconcurrentjobs", store_pint32, ITEM(res_dir.MaxConcurrentJobs), 0, ITEM_DEFAULT, 1},
-   {"maximumconsoleconnections", store_pint32, ITEM(res_dir.MaxConsoleConnect), 0, ITEM_DEFAULT, 20},
-   {"password",    store_password, ITEM(res_dir.password), 0, ITEM_REQUIRED, 0},
-   {"fdconnecttimeout", store_time,ITEM(res_dir.FDConnectTimeout), 0, ITEM_DEFAULT, 3 * 60},
-   {"sdconnecttimeout", store_time,ITEM(res_dir.SDConnectTimeout), 0, ITEM_DEFAULT, 30 * 60},
-   {"heartbeatinterval", store_time, ITEM(res_dir.heartbeat_interval), 0, ITEM_DEFAULT, 0},
-   {"tlsauthenticate",      store_bool,      ITEM(res_dir.tls_authenticate), 0, 0, 0},
-   {"tlsenable",            store_bool,      ITEM(res_dir.tls_enable), 0, 0, 0},
-   {"tlsrequire",           store_bool,      ITEM(res_dir.tls_require), 0, 0, 0},
-   {"tlsverifypeer",        store_bool,      ITEM(res_dir.tls_verify_peer), 0, ITEM_DEFAULT, true},
-   {"tlscacertificatefile", store_dir,       ITEM(res_dir.tls_ca_certfile), 0, 0, 0},
-   {"tlscacertificatedir",  store_dir,       ITEM(res_dir.tls_ca_certdir), 0, 0, 0},
-   {"tlscertificate",       store_dir,       ITEM(res_dir.tls_certfile), 0, 0, 0},
-   {"tlskey",               store_dir,       ITEM(res_dir.tls_keyfile), 0, 0, 0},
-   {"tlsdhfile",            store_dir,       ITEM(res_dir.tls_dhfile), 0, 0, 0},
-   {"tlsallowedcn",         store_alist_str, ITEM(res_dir.tls_allowed_cns), 0, 0, 0},
-   {"statisticsretention",  store_time,      ITEM(res_dir.stats_retention),  0, ITEM_DEFAULT, 60*60*24*31*12*5},
-   {"verid",                store_str,       ITEM(res_dir.verid), 0, 0, 0},
+   {"Name",        store_name,     ITEM(res_dir.hdr.name), 0, ITEM_REQUIRED, 0},
+   {"Description", store_str,      ITEM(res_dir.hdr.desc), 0, 0, 0},
+   {"Messages",    store_res,      ITEM(res_dir.messages), R_MSGS, 0, 0},
+   {"DirPort",     store_addresses_port,    ITEM(res_dir.DIRaddrs),  0, ITEM_DEFAULT, 9101},
+   {"DirAddress",  store_addresses_address, ITEM(res_dir.DIRaddrs),  0, ITEM_DEFAULT, 9101},
+   {"DirAddresses",store_addresses,         ITEM(res_dir.DIRaddrs),  0, ITEM_DEFAULT, 9101},
+   {"DirSourceAddress",store_addresses_address, ITEM(res_dir.DIRsrc_addr),  0, ITEM_DEFAULT, 0},
+   {"QueryFile",   store_dir,      ITEM(res_dir.query_file), 0, ITEM_REQUIRED, 0},
+   {"WorkingDirectory", store_dir, ITEM(res_dir.working_directory), 0, ITEM_REQUIRED, 0},
+   {"PluginDirectory",  store_dir, ITEM(res_dir.plugin_directory),  0, 0, 0},
+   {"ScriptsDirectory", store_dir, ITEM(res_dir.scripts_directory), 0, 0, 0},
+   {"PidDirectory",     store_dir, ITEM(res_dir.pid_directory),     0, ITEM_REQUIRED, 0},
+   {"SubsysDirectory",  store_dir, ITEM(res_dir.subsys_directory),  0, 0, 0},
+   {"MaximumConcurrentJobs", store_pint32, ITEM(res_dir.MaxConcurrentJobs), 0, ITEM_DEFAULT, 1},
+   {"MaximumReloadRequests", store_pint32, ITEM(res_dir.MaxReload), 0, ITEM_DEFAULT, 32},
+   {"MaximumConsoleConnections", store_pint32, ITEM(res_dir.MaxConsoleConnect), 0, ITEM_DEFAULT, 20},
+   {"Password",    store_password, ITEM(res_dir.password), 0, ITEM_REQUIRED, 0},
+   {"FdConnectTimeout", store_time,ITEM(res_dir.FDConnectTimeout), 0, ITEM_DEFAULT, 3 * 60},
+   {"SdConnectTimeout", store_time,ITEM(res_dir.SDConnectTimeout), 0, ITEM_DEFAULT, 30 * 60},
+   {"HeartbeatInterval", store_time, ITEM(res_dir.heartbeat_interval), 0, ITEM_DEFAULT, 5 * 60},
+   {"TlsAuthenticate",      store_bool,      ITEM(res_dir.tls_authenticate), 0, 0, 0},
+   {"TlsEnable",            store_bool,      ITEM(res_dir.tls_enable), 0, 0, 0},
+   {"TlsRequire",           store_bool,      ITEM(res_dir.tls_require), 0, 0, 0},
+   {"TlsVerifyPeer",        store_bool,      ITEM(res_dir.tls_verify_peer), 0, ITEM_DEFAULT, true},
+   {"TlsCaCertificateFile", store_dir,       ITEM(res_dir.tls_ca_certfile), 0, 0, 0},
+   {"TlsCaCertificateDir",  store_dir,       ITEM(res_dir.tls_ca_certdir), 0, 0, 0},
+   {"TlsCertificate",       store_dir,       ITEM(res_dir.tls_certfile), 0, 0, 0},
+   {"TlsKey",               store_dir,       ITEM(res_dir.tls_keyfile), 0, 0, 0},
+   {"TlsDhFile",            store_dir,       ITEM(res_dir.tls_dhfile), 0, 0, 0},
+   {"TlsAllowedCn",         store_alist_str, ITEM(res_dir.tls_allowed_cns), 0, 0, 0},
+   {"StatisticsRetention",  store_time,      ITEM(res_dir.stats_retention),  0, ITEM_DEFAULT, 60*60*24*31*12*5},
+   {"VerId",                store_str,       ITEM(res_dir.verid), 0, 0, 0},
    {NULL, NULL, {0}, 0, 0, 0}
 };
 
@@ -134,30 +138,30 @@ static RES_ITEM dir_items[] = {
  *   name          handler     value                 code flags    default_value
  */
 static RES_ITEM con_items[] = {
-   {"name",        store_name,     ITEM(res_con.hdr.name), 0, ITEM_REQUIRED, 0},
-   {"description", store_str,      ITEM(res_con.hdr.desc), 0, 0, 0},
-   {"password",    store_password, ITEM(res_con.password), 0, ITEM_REQUIRED, 0},
-   {"jobacl",      store_acl,      ITEM(res_con.ACL_lists), Job_ACL, 0, 0},
-   {"clientacl",   store_acl,      ITEM(res_con.ACL_lists), Client_ACL, 0, 0},
-   {"storageacl",  store_acl,      ITEM(res_con.ACL_lists), Storage_ACL, 0, 0},
-   {"scheduleacl", store_acl,      ITEM(res_con.ACL_lists), Schedule_ACL, 0, 0},
-   {"runacl",      store_acl,      ITEM(res_con.ACL_lists), Run_ACL, 0, 0},
-   {"poolacl",     store_acl,      ITEM(res_con.ACL_lists), Pool_ACL, 0, 0},
-   {"commandacl",  store_acl,      ITEM(res_con.ACL_lists), Command_ACL, 0, 0},
-   {"filesetacl",  store_acl,      ITEM(res_con.ACL_lists), FileSet_ACL, 0, 0},
-   {"catalogacl",  store_acl,      ITEM(res_con.ACL_lists), Catalog_ACL, 0, 0},
-   {"whereacl",    store_acl,      ITEM(res_con.ACL_lists), Where_ACL, 0, 0},
-   {"pluginoptionsacl",     store_acl,       ITEM(res_con.ACL_lists), PluginOptions_ACL, 0, 0},
-   {"tlsauthenticate",      store_bool,      ITEM(res_con.tls_authenticate), 0, 0, 0},
-   {"tlsenable",            store_bool,      ITEM(res_con.tls_enable), 0, 0, 0},
-   {"tlsrequire",           store_bool,      ITEM(res_con.tls_require), 0, 0, 0},
-   {"tlsverifypeer",        store_bool,      ITEM(res_con.tls_verify_peer), 0, ITEM_DEFAULT, true},
-   {"tlscacertificatefile", store_dir,       ITEM(res_con.tls_ca_certfile), 0, 0, 0},
-   {"tlscacertificatedir",  store_dir,       ITEM(res_con.tls_ca_certdir), 0, 0, 0},
-   {"tlscertificate",       store_dir,       ITEM(res_con.tls_certfile), 0, 0, 0},
-   {"tlskey",               store_dir,       ITEM(res_con.tls_keyfile), 0, 0, 0},
-   {"tlsdhfile",            store_dir,       ITEM(res_con.tls_dhfile), 0, 0, 0},
-   {"tlsallowedcn",         store_alist_str, ITEM(res_con.tls_allowed_cns), 0, 0, 0},
+   {"Name",        store_name,     ITEM(res_con.hdr.name), 0, ITEM_REQUIRED, 0},
+   {"Description", store_str,      ITEM(res_con.hdr.desc), 0, 0, 0},
+   {"Password",    store_password, ITEM(res_con.password), 0, ITEM_REQUIRED, 0},
+   {"JobAcl",      store_acl,      ITEM(res_con.ACL_lists), Job_ACL, 0, 0},
+   {"ClientAcl",   store_acl,      ITEM(res_con.ACL_lists), Client_ACL, 0, 0},
+   {"StorageAcl",  store_acl,      ITEM(res_con.ACL_lists), Storage_ACL, 0, 0},
+   {"ScheduleAcl", store_acl,      ITEM(res_con.ACL_lists), Schedule_ACL, 0, 0},
+   {"RunAcl",      store_acl,      ITEM(res_con.ACL_lists), Run_ACL, 0, 0},
+   {"PoolAcl",     store_acl,      ITEM(res_con.ACL_lists), Pool_ACL, 0, 0},
+   {"CommandAcl",  store_acl,      ITEM(res_con.ACL_lists), Command_ACL, 0, 0},
+   {"FilesetAcl",  store_acl,      ITEM(res_con.ACL_lists), FileSet_ACL, 0, 0},
+   {"CatalogAcl",  store_acl,      ITEM(res_con.ACL_lists), Catalog_ACL, 0, 0},
+   {"WhereAcl",    store_acl,      ITEM(res_con.ACL_lists), Where_ACL, 0, 0},
+   {"PluginOptionsAcl",     store_acl,       ITEM(res_con.ACL_lists), PluginOptions_ACL, 0, 0},
+   {"TlsAuthenticate",      store_bool,      ITEM(res_con.tls_authenticate), 0, 0, 0},
+   {"TlsEnable",            store_bool,      ITEM(res_con.tls_enable), 0, 0, 0},
+   {"TlsRequire",           store_bool,      ITEM(res_con.tls_require), 0, 0, 0},
+   {"TlsVerifyPeer",        store_bool,      ITEM(res_con.tls_verify_peer), 0, ITEM_DEFAULT, true},
+   {"TlsCaCertificateFile", store_dir,       ITEM(res_con.tls_ca_certfile), 0, 0, 0},
+   {"TlsCaCertificateDir",  store_dir,       ITEM(res_con.tls_ca_certdir), 0, 0, 0},
+   {"TlsCertificate",       store_dir,       ITEM(res_con.tls_certfile), 0, 0, 0},
+   {"TlsKey",               store_dir,       ITEM(res_con.tls_keyfile), 0, 0, 0},
+   {"TlsDhFile",            store_dir,       ITEM(res_con.tls_dhfile), 0, 0, 0},
+   {"TlsAllowedCn",         store_alist_str, ITEM(res_con.tls_allowed_cns), 0, 0, 0},
    {NULL, NULL, {0}, 0, 0, 0}
 };
 
@@ -169,30 +173,32 @@ static RES_ITEM con_items[] = {
  */
 
 static RES_ITEM cli_items[] = {
-   {"name",     store_name,       ITEM(res_client.hdr.name), 0, ITEM_REQUIRED, 0},
-   {"description", store_str,     ITEM(res_client.hdr.desc), 0, 0, 0},
-   {"address",  store_str,        ITEM(res_client.address),  0, ITEM_REQUIRED, 0},
+   {"Name",     store_name,       ITEM(res_client.hdr.name), 0, ITEM_REQUIRED, 0},
+   {"Description", store_str,     ITEM(res_client.hdr.desc), 0, 0, 0},
    {"fdaddress",  store_str,      ITEM(res_client.address),  0, 0, 0},
-   {"fdport",   store_pint32,     ITEM(res_client.FDport),   0, ITEM_DEFAULT, 9102},
-   {"password", store_password,   ITEM(res_client.password), 0, ITEM_REQUIRED, 0},
+   {"Address",  store_str,        ITEM(res_client.address),  0, ITEM_REQUIRED, 0},
+   {"FdPort",   store_pint32,     ITEM(res_client.FDport),   0, ITEM_DEFAULT, 9102},
    {"fdpassword", store_password, ITEM(res_client.password), 0, 0, 0},
-   {"fdstorageaddress", store_str, ITEM(res_client.fd_storage_address), 0, 0, 0},
-   {"catalog",  store_res,        ITEM(res_client.catalog),  R_CATALOG, ITEM_REQUIRED, 0},
-   {"fileretention", store_time,  ITEM(res_client.FileRetention), 0, ITEM_DEFAULT, 60*60*24*60},
-   {"jobretention",  store_time,  ITEM(res_client.JobRetention),  0, ITEM_DEFAULT, 60*60*24*180},
-   {"heartbeatinterval", store_time, ITEM(res_client.heartbeat_interval), 0, ITEM_DEFAULT, 0},
-   {"autoprune", store_bool,      ITEM(res_client.AutoPrune), 0, ITEM_DEFAULT, true},
-   {"sdcallsclient",        store_bool, ITEM(res_client.sd_calls_client), 0, ITEM_DEFAULT, false},
-   {"maximumconcurrentjobs", store_pint32,   ITEM(res_client.MaxConcurrentJobs), 0, ITEM_DEFAULT, 1},
-   {"tlsauthenticate",      store_bool,      ITEM(res_client.tls_authenticate), 0, 0, 0},
-   {"tlsenable",            store_bool,      ITEM(res_client.tls_enable), 0, 0, 0},
-   {"tlsrequire",           store_bool,      ITEM(res_client.tls_require), 0, 0, 0},
-   {"tlscacertificatefile", store_dir,       ITEM(res_client.tls_ca_certfile), 0, 0, 0},
-   {"tlscacertificatedir",  store_dir,       ITEM(res_client.tls_ca_certdir), 0, 0, 0},
-   {"tlscertificate",       store_dir,       ITEM(res_client.tls_certfile), 0, 0, 0},
-   {"tlskey",               store_dir,       ITEM(res_client.tls_keyfile), 0, 0, 0},
-   {"tlsallowedcn",         store_alist_str, ITEM(res_client.tls_allowed_cns), 0, 0, 0},
-   {"maximumbandwidthperjob", store_speed, ITEM(res_client.max_bandwidth), 0, 0, 0},
+   {"Password", store_password,   ITEM(res_client.password), 0, ITEM_REQUIRED, 0},
+   {"FdStorageAddress", store_str, ITEM(res_client.fd_storage_address), 0, 0, 0},
+   {"Catalog",  store_res,        ITEM(res_client.catalog),  R_CATALOG, ITEM_REQUIRED, 0},
+   {"FileRetention", store_time,  ITEM(res_client.FileRetention), 0, ITEM_DEFAULT, 60*60*24*60},
+   {"JobRetention",  store_time,  ITEM(res_client.JobRetention),  0, ITEM_DEFAULT, 60*60*24*180},
+   {"HeartbeatInterval",    store_time, ITEM(res_client.heartbeat_interval), 0, ITEM_DEFAULT, 5 * 60},
+   {"AutoPrune",            store_bool, ITEM(res_client.AutoPrune), 0, ITEM_DEFAULT, true},
+   {"SDCallsClient",        store_bool, ITEM(res_client.sd_calls_client), 0, ITEM_DEFAULT, false},
+   {"SnapshotRetention",  store_time,  ITEM(res_client.SnapRetention),  0, ITEM_DEFAULT, 0},
+   {"MaximumConcurrentJobs", store_pint32,   ITEM(res_client.MaxConcurrentJobs), 0, ITEM_DEFAULT, 1},
+   {"TlsAuthenticate",      store_bool,      ITEM(res_client.tls_authenticate), 0, 0, 0},
+   {"TlsEnable",            store_bool,      ITEM(res_client.tls_enable), 0, 0, 0},
+   {"TlsRequire",           store_bool,      ITEM(res_client.tls_require), 0, 0, 0},
+   {"TlsCaCertificateFile", store_dir,       ITEM(res_client.tls_ca_certfile), 0, 0, 0},
+   {"TlsCaCertificateDir",  store_dir,       ITEM(res_client.tls_ca_certdir), 0, 0, 0},
+   {"TlsCertificate",       store_dir,       ITEM(res_client.tls_certfile), 0, 0, 0},
+   {"TlsKey",               store_dir,       ITEM(res_client.tls_keyfile), 0, 0, 0},
+   {"TlsAllowedCn",         store_alist_str, ITEM(res_client.tls_allowed_cns), 0, 0, 0},
+   {"MaximumBandwidthPerJob", store_speed, ITEM(res_client.max_bandwidth), 0, 0, 0},
+   {"Enabled",     store_bool, ITEM(res_client.enabled), 0, ITEM_DEFAULT, true},
    {NULL, NULL, {0}, 0, 0, 0}
 };
 
@@ -201,30 +207,30 @@ static RES_ITEM cli_items[] = {
  *   name          handler     value                 code flags    default_value
  */
 static RES_ITEM store_items[] = {
-   {"name",        store_name,     ITEM(res_store.hdr.name),   0, ITEM_REQUIRED, 0},
-   {"description", store_str,      ITEM(res_store.hdr.desc),   0, 0, 0},
-   {"sdport",      store_pint32,   ITEM(res_store.SDport),     0, ITEM_DEFAULT, 9103},
-   {"address",     store_str,      ITEM(res_store.address),    0, ITEM_REQUIRED, 0},
+   {"Name",        store_name,     ITEM(res_store.hdr.name),   0, ITEM_REQUIRED, 0},
+   {"Description", store_str,      ITEM(res_store.hdr.desc),   0, 0, 0},
+   {"SdPort",      store_pint32,   ITEM(res_store.SDport),     0, ITEM_DEFAULT, 9103},
    {"sdaddress",   store_str,      ITEM(res_store.address),    0, 0, 0},
-   {"password",    store_password, ITEM(res_store.password),   0, ITEM_REQUIRED, 0},
-   {"fdstorageaddress", store_str, ITEM(res_store.fd_storage_address), 0, 0, 0},
+   {"Address",     store_str,      ITEM(res_store.address),    0, ITEM_REQUIRED, 0},
+   {"FdStorageAddress", store_str, ITEM(res_store.fd_storage_address), 0, 0, 0},
    {"sdpassword",  store_password, ITEM(res_store.password),   0, 0, 0},
-   {"device",      store_device,   ITEM(res_store.device),     R_DEVICE, ITEM_REQUIRED, 0},
-   {"mediatype",   store_strname,  ITEM(res_store.media_type), 0, ITEM_REQUIRED, 0},
-   {"autochanger", store_bool,     ITEM(res_store.autochanger), 0, ITEM_DEFAULT, 0},
-   {"enabled",     store_bool,     ITEM(res_store.enabled),     0, ITEM_DEFAULT, true},
-   {"allowcompression",  store_bool, ITEM(res_store.AllowCompress), 0, ITEM_DEFAULT, true},
-   {"heartbeatinterval", store_time, ITEM(res_store.heartbeat_interval), 0, ITEM_DEFAULT, 0},
-   {"maximumconcurrentjobs", store_pint32, ITEM(res_store.MaxConcurrentJobs), 0, ITEM_DEFAULT, 1},
-   {"maximumconcurrentreadjobs", store_pint32, ITEM(res_store.MaxConcurrentReadJobs), 0, ITEM_DEFAULT, 0},
+   {"Password",    store_password, ITEM(res_store.password),   0, ITEM_REQUIRED, 0},
+   {"Device",      store_device,   ITEM(res_store.device),     R_DEVICE, ITEM_REQUIRED, 0},
+   {"MediaType",   store_strname,  ITEM(res_store.media_type), 0, ITEM_REQUIRED, 0},
+   {"Autochanger", store_bool,     ITEM(res_store.autochanger), 0, ITEM_DEFAULT, false},
+   {"Enabled",     store_bool,     ITEM(res_store.enabled),     0, ITEM_DEFAULT, true},
+   {"AllowCompression",  store_bool, ITEM(res_store.AllowCompress), 0, ITEM_DEFAULT, true},
+   {"HeartbeatInterval", store_time, ITEM(res_store.heartbeat_interval), 0, ITEM_DEFAULT, 5 * 60},
+   {"MaximumConcurrentJobs", store_pint32, ITEM(res_store.MaxConcurrentJobs), 0, ITEM_DEFAULT, 1},
+   {"MaximumConcurrentReadjobs", store_pint32, ITEM(res_store.MaxConcurrentReadJobs), 0, ITEM_DEFAULT, 0},
    {"sddport", store_pint32, ITEM(res_store.SDDport), 0, 0, 0}, /* deprecated */
-   {"tlsauthenticate",      store_bool,      ITEM(res_store.tls_authenticate), 0, 0, 0},
-   {"tlsenable",            store_bool,      ITEM(res_store.tls_enable), 0, 0, 0},
-   {"tlsrequire",           store_bool,      ITEM(res_store.tls_require), 0, 0, 0},
-   {"tlscacertificatefile", store_dir,       ITEM(res_store.tls_ca_certfile), 0, 0, 0},
-   {"tlscacertificatedir",  store_dir,       ITEM(res_store.tls_ca_certdir), 0, 0, 0},
-   {"tlscertificate",       store_dir,       ITEM(res_store.tls_certfile), 0, 0, 0},
-   {"tlskey",               store_dir,       ITEM(res_store.tls_keyfile), 0, 0, 0},
+   {"TlsAuthenticate",      store_bool,      ITEM(res_store.tls_authenticate), 0, 0, 0},
+   {"TlsEnable",            store_bool,      ITEM(res_store.tls_enable), 0, 0, 0},
+   {"TlsRequire",           store_bool,      ITEM(res_store.tls_require), 0, 0, 0},
+   {"TlsCaCertificateFile", store_dir,       ITEM(res_store.tls_ca_certfile), 0, 0, 0},
+   {"TlsCaCertificateDir",  store_dir,       ITEM(res_store.tls_ca_certdir), 0, 0, 0},
+   {"TlsCertificate",       store_dir,       ITEM(res_store.tls_certfile), 0, 0, 0},
+   {"TlsKey",               store_dir,       ITEM(res_store.tls_keyfile), 0, 0, 0},
    {NULL, NULL, {0}, 0, 0, 0}
 };
 
@@ -234,22 +240,22 @@ static RES_ITEM store_items[] = {
  *   name          handler     value                 code flags    default_value
  */
 static RES_ITEM cat_items[] = {
-   {"name",     store_name,     ITEM(res_cat.hdr.name),    0, ITEM_REQUIRED, 0},
-   {"description", store_str,   ITEM(res_cat.hdr.desc),    0, 0, 0},
-   {"address",  store_str,      ITEM(res_cat.db_address),  0, 0, 0},
+   {"Name",     store_name,     ITEM(res_cat.hdr.name),    0, ITEM_REQUIRED, 0},
+   {"Description", store_str,   ITEM(res_cat.hdr.desc),    0, 0, 0},
    {"dbaddress", store_str,     ITEM(res_cat.db_address),  0, 0, 0},
-   {"dbport",   store_pint32,   ITEM(res_cat.db_port),      0, 0, 0},
+   {"Address",  store_str,      ITEM(res_cat.db_address),  0, 0, 0},
+   {"DbPort",   store_pint32,   ITEM(res_cat.db_port),      0, 0, 0},
    /* keep this password as store_str for the moment */
-   {"password", store_str,      ITEM(res_cat.db_password), 0, 0, 0},
    {"dbpassword", store_str,    ITEM(res_cat.db_password), 0, 0, 0},
+   {"Password", store_str,      ITEM(res_cat.db_password), 0, 0, 0},
    {"dbuser",   store_str,      ITEM(res_cat.db_user),     0, 0, 0},
-   {"user",     store_str,      ITEM(res_cat.db_user),     0, 0, 0},
-   {"dbname",   store_str,      ITEM(res_cat.db_name),     0, ITEM_REQUIRED, 0},
+   {"User",     store_str,      ITEM(res_cat.db_user),     0, 0, 0},
+   {"DbName",   store_str,      ITEM(res_cat.db_name),     0, ITEM_REQUIRED, 0},
    {"dbdriver", store_str,      ITEM(res_cat.db_driver),   0, 0, 0},
-   {"dbsocket", store_str,      ITEM(res_cat.db_socket),   0, 0, 0},
+   {"DbSocket", store_str,      ITEM(res_cat.db_socket),   0, 0, 0},
    /* Turned off for the moment */
-   {"multipleconnections", store_bit, ITEM(res_cat.mult_db_connections), 0, 0, 0},
-   {"disablebatchinsert", store_bool, ITEM(res_cat.disable_batch_insert), 0, ITEM_DEFAULT, false},
+   {"MultipleConnections", store_bit, ITEM(res_cat.mult_db_connections), 0, 0, 0},
+   {"DisableBatchInsert", store_bool, ITEM(res_cat.disable_batch_insert), 0, ITEM_DEFAULT, false},
    {NULL, NULL, {0}, 0, 0, 0}
 };
 
@@ -259,99 +265,102 @@ static RES_ITEM cat_items[] = {
  *   name          handler     value                 code flags    default_value
  */
 RES_ITEM job_items[] = {
-   {"name",      store_name,    ITEM(res_job.hdr.name), 0, ITEM_REQUIRED, 0},
-   {"description", store_str,   ITEM(res_job.hdr.desc), 0, 0, 0},
-   {"type",      store_jobtype, ITEM(res_job.JobType),  0, ITEM_REQUIRED, 0},
-   {"level",     store_level,   ITEM(res_job.JobLevel),    0, 0, 0},
-   {"messages",  store_res,     ITEM(res_job.messages), R_MSGS, ITEM_REQUIRED, 0},
-   {"storage",   store_alist_res, ITEM(res_job.storage),  R_STORAGE, 0, 0},
-   {"pool",      store_res,     ITEM(res_job.pool),     R_POOL, ITEM_REQUIRED, 0},
-   {"nextpool",  store_res,     ITEM(res_job.next_pool), R_POOL, 0, 0},
-   {"fullbackuppool",  store_res, ITEM(res_job.full_pool),   R_POOL, 0, 0},
-   {"incrementalbackuppool",  store_res, ITEM(res_job.inc_pool), R_POOL, 0, 0},
-   {"differentialbackuppool", store_res, ITEM(res_job.diff_pool), R_POOL, 0, 0},
-   {"client",    store_res,     ITEM(res_job.client),   R_CLIENT, ITEM_REQUIRED, 0},
-   {"fileset",   store_res,     ITEM(res_job.fileset),  R_FILESET, ITEM_REQUIRED, 0},
-   {"schedule",  store_res,     ITEM(res_job.schedule), R_SCHEDULE, 0, 0},
-   {"verifyjob", store_res,     ITEM(res_job.verify_job), R_JOB, 0, 0},
-   {"jobtoverify", store_res,   ITEM(res_job.verify_job), R_JOB, 0, 0},
-   {"jobdefs",   store_res,     ITEM(res_job.jobdefs),    R_JOBDEFS, 0, 0},
-   {"run",       store_alist_str, ITEM(res_job.run_cmds), 0, 0, 0},
+   {"Name",      store_name,    ITEM(res_job.hdr.name),  0, ITEM_REQUIRED, 0},
+   {"Description", store_str,   ITEM(res_job.hdr.desc),  0, 0, 0},
+   {"Type",      store_jobtype, ITEM(res_job.JobType),   0, ITEM_REQUIRED, 0},
+   {"Level",     store_level,   ITEM(res_job.JobLevel),    0, 0, 0},
+   {"Messages",  store_res,     ITEM(res_job.messages),  R_MSGS, ITEM_REQUIRED, 0},
+   {"Storage",   store_alist_res, ITEM(res_job.storage),  R_STORAGE, 0, 0},
+   {"Pool",      store_res,     ITEM(res_job.pool),      R_POOL, ITEM_REQUIRED, 0},
+   {"NextPool",  store_res,     ITEM(res_job.next_pool), R_POOL, 0, 0},
+   {"FullBackupPool",  store_res, ITEM(res_job.full_pool),   R_POOL, 0, 0},
+   {"IncrementalBackupPool",  store_res, ITEM(res_job.inc_pool), R_POOL, 0, 0},
+   {"DifferentialBackupPool", store_res, ITEM(res_job.diff_pool), R_POOL, 0, 0},
+   {"Client",    store_res,     ITEM(res_job.client),   R_CLIENT, ITEM_REQUIRED, 0},
+   {"Fileset",   store_res,     ITEM(res_job.fileset),  R_FILESET, ITEM_REQUIRED, 0},
+   {"Schedule",  store_res,     ITEM(res_job.schedule), R_SCHEDULE, 0, 0},
+   {"VerifyJob", store_res,     ITEM(res_job.verify_job), R_JOB, 0, 0},
+   {"JobToVerify", store_res,   ITEM(res_job.verify_job), R_JOB, 0, 0},
+   {"JobDefs",   store_res,     ITEM(res_job.jobdefs),    R_JOBDEFS, 0, 0},
+   {"Run",       store_alist_str, ITEM(res_job.run_cmds), 0, 0, 0},
    /* Root of where to restore files */
-   {"where",    store_dir,      ITEM(res_job.RestoreWhere), 0, 0, 0},
-   {"regexwhere",    store_str, ITEM(res_job.RegexWhere), 0, 0, 0},
-   {"stripprefix",   store_str, ITEM(res_job.strip_prefix), 0, 0, 0},
-   {"addprefix",    store_str,  ITEM(res_job.add_prefix), 0, 0, 0},
-   {"addsuffix",    store_str,  ITEM(res_job.add_suffix), 0, 0, 0},
+   {"Where",    store_dir,      ITEM(res_job.RestoreWhere), 0, 0, 0},
+   {"RegexWhere",    store_str, ITEM(res_job.RegexWhere), 0, 0, 0},
+   {"StripPrefix",   store_str, ITEM(res_job.strip_prefix), 0, 0, 0},
+   {"AddPrefix",    store_str,  ITEM(res_job.add_prefix), 0, 0, 0},
+   {"AddSuffix",    store_str,  ITEM(res_job.add_suffix), 0, 0, 0},
    /* Where to find bootstrap during restore */
-   {"bootstrap",store_dir,      ITEM(res_job.RestoreBootstrap), 0, 0, 0},
+   {"Bootstrap",store_dir,      ITEM(res_job.RestoreBootstrap), 0, 0, 0},
    /* Where to write bootstrap file during backup */
-   {"writebootstrap",store_dir, ITEM(res_job.WriteBootstrap), 0, 0, 0},
-   {"writeverifylist",store_dir,ITEM(res_job.WriteVerifyList), 0, 0, 0},
-   {"replace",  store_replace,  ITEM(res_job.replace), 0, ITEM_DEFAULT, REPLACE_ALWAYS},
-   {"maximumbandwidth", store_speed, ITEM(res_job.max_bandwidth), 0, 0, 0},
-   {"maxrunschedtime", store_time, ITEM(res_job.MaxRunSchedTime), 0, 0, 0},
-   {"maxruntime",   store_time, ITEM(res_job.MaxRunTime), 0, 0, 0},
+   {"WriteBootstrap",store_dir, ITEM(res_job.WriteBootstrap), 0, 0, 0},
+   {"WriteVerifyList",store_dir,ITEM(res_job.WriteVerifyList), 0, 0, 0},
+   {"Replace",  store_replace,  ITEM(res_job.replace), 0, ITEM_DEFAULT, REPLACE_ALWAYS},
+   {"MaximumBandwidth", store_speed, ITEM(res_job.max_bandwidth), 0, 0, 0},
+   {"MaxRunSchedTime", store_time, ITEM(res_job.MaxRunSchedTime), 0, 0, 0},
+   {"MaxRunTime",   store_time, ITEM(res_job.MaxRunTime), 0, 0, 0},
    /* xxxMaxWaitTime are deprecated */
    {"fullmaxwaittime",  store_time, ITEM(res_job.FullMaxRunTime), 0, 0, 0},
    {"incrementalmaxwaittime",  store_time, ITEM(res_job.IncMaxRunTime), 0, 0, 0},
    {"differentialmaxwaittime", store_time, ITEM(res_job.DiffMaxRunTime), 0, 0, 0},
-   {"fullmaxruntime",  store_time, ITEM(res_job.FullMaxRunTime), 0, 0, 0},
-   {"incrementalmaxruntime",  store_time, ITEM(res_job.IncMaxRunTime), 0, 0, 0},
-   {"differentialmaxruntime", store_time, ITEM(res_job.DiffMaxRunTime), 0, 0, 0},
-   {"maxwaittime",  store_time, ITEM(res_job.MaxWaitTime), 0, 0, 0},
-   {"maxstartdelay",store_time, ITEM(res_job.MaxStartDelay), 0, 0, 0},
-   {"maxfullinterval",  store_time, ITEM(res_job.MaxFullInterval), 0, 0, 0},
-   {"maxdiffinterval",  store_time, ITEM(res_job.MaxDiffInterval), 0, 0, 0},
-   {"prefixlinks", store_bool, ITEM(res_job.PrefixLinks), 0, ITEM_DEFAULT, false},
-   {"prunejobs",   store_bool, ITEM(res_job.PruneJobs), 0, ITEM_DEFAULT, false},
-   {"prunefiles",  store_bool, ITEM(res_job.PruneFiles), 0, ITEM_DEFAULT, false},
-   {"prunevolumes",store_bool, ITEM(res_job.PruneVolumes), 0, ITEM_DEFAULT, false},
-   {"purgemigrationjob",  store_bool, ITEM(res_job.PurgeMigrateJob), 0, ITEM_DEFAULT, false},
-   {"enabled",     store_bool, ITEM(res_job.enabled), 0, ITEM_DEFAULT, true},
-   {"spoolattributes",store_bool, ITEM(res_job.SpoolAttributes), 0, ITEM_DEFAULT, false},
-   {"spooldata",   store_bool, ITEM(res_job.spool_data), 0, ITEM_DEFAULT, false},
-   {"spoolsize",   store_size64, ITEM(res_job.spool_size), 0, 0, 0},
-   {"rerunfailedlevels",   store_bool, ITEM(res_job.rerun_failed_levels), 0, ITEM_DEFAULT, false},
-   {"prefermountedvolumes", store_bool, ITEM(res_job.PreferMountedVolumes), 0, ITEM_DEFAULT, true},
+   {"FullMaxRunTime",  store_time, ITEM(res_job.FullMaxRunTime), 0, 0, 0},
+   {"IncrementalMaxRunTime",  store_time, ITEM(res_job.IncMaxRunTime), 0, 0, 0},
+   {"DifferentialMaxRunTime", store_time, ITEM(res_job.DiffMaxRunTime), 0, 0, 0},
+   {"MaxWaitTime",  store_time, ITEM(res_job.MaxWaitTime), 0, 0, 0},
+   {"MaxStartDelay",store_time, ITEM(res_job.MaxStartDelay), 0, 0, 0},
+   {"MaxFullInterval",  store_time, ITEM(res_job.MaxFullInterval), 0, 0, 0},
+   {"MaxDiffInterval",  store_time, ITEM(res_job.MaxDiffInterval), 0, 0, 0},
+   {"PrefixLinks", store_bool, ITEM(res_job.PrefixLinks), 0, ITEM_DEFAULT, false},
+   {"PruneJobs",   store_bool, ITEM(res_job.PruneJobs), 0, ITEM_DEFAULT, false},
+   {"PruneFiles",  store_bool, ITEM(res_job.PruneFiles), 0, ITEM_DEFAULT, false},
+   {"PruneVolumes",store_bool, ITEM(res_job.PruneVolumes), 0, ITEM_DEFAULT, false},
+   {"PurgeMigrationJob",  store_bool, ITEM(res_job.PurgeMigrateJob), 0, ITEM_DEFAULT, false},
+   {"Enabled",     store_bool, ITEM(res_job.enabled), 0, ITEM_DEFAULT, true},
+   {"SnapshotRetention",  store_time,  ITEM(res_job.SnapRetention),  0, ITEM_DEFAULT, 0},
+   {"SpoolAttributes",store_bool, ITEM(res_job.SpoolAttributes), 0, ITEM_DEFAULT, true},
+   {"SpoolData",   store_bool, ITEM(res_job.spool_data), 0, ITEM_DEFAULT, false},
+   {"SpoolSize",   store_size64, ITEM(res_job.spool_size), 0, 0, 0},
+   {"ReRunFailedLevels",   store_bool, ITEM(res_job.rerun_failed_levels), 0, ITEM_DEFAULT, false},
+   {"PreferMountedVolumes", store_bool, ITEM(res_job.PreferMountedVolumes), 0, ITEM_DEFAULT, true},
    {"runbeforejob", store_short_runscript,  ITEM(res_job.RunScripts),  0, 0, 0},
    {"runafterjob",  store_short_runscript,  ITEM(res_job.RunScripts),  0, 0, 0},
    {"runafterfailedjob",  store_short_runscript,  ITEM(res_job.RunScripts),  0, 0, 0},
    {"clientrunbeforejob", store_short_runscript,  ITEM(res_job.RunScripts),  0, 0, 0},
    {"clientrunafterjob",  store_short_runscript,  ITEM(res_job.RunScripts),  0, 0, 0},
-   {"maximumconcurrentjobs", store_pint32, ITEM(res_job.MaxConcurrentJobs), 0, ITEM_DEFAULT, 1},
-   {"maximumspawnedjobs", store_pint32, ITEM(res_job.MaxSpawnedJobs), 0, ITEM_DEFAULT, 600},
-   {"rescheduleonerror", store_bool, ITEM(res_job.RescheduleOnError), 0, ITEM_DEFAULT, false},
-   {"rescheduleinterval", store_time, ITEM(res_job.RescheduleInterval), 0, ITEM_DEFAULT, 60 * 30},
-   {"rescheduletimes",    store_pint32, ITEM(res_job.RescheduleTimes), 0, 0, 0},
-   {"priority",           store_pint32, ITEM(res_job.Priority), 0, ITEM_DEFAULT, 10},
-   {"allowmixedpriority", store_bool, ITEM(res_job.allow_mixed_priority), 0, ITEM_DEFAULT, false},
-   {"writepartafterjob",  store_bool, ITEM(res_job.write_part_after_job), 0, ITEM_DEFAULT, true},
-   {"selectionpattern",   store_str, ITEM(res_job.selection_pattern), 0, 0, 0},
-   {"runscript",          store_runscript, ITEM(res_job.RunScripts), 0, ITEM_NO_EQUALS, 0},
-   {"selectiontype",      store_migtype, ITEM(res_job.selection_type), 0, 0, 0},
-   {"accurate",           store_bool, ITEM(res_job.accurate), 0,0,0},
-   {"allowduplicatejobs", store_bool, ITEM(res_job.AllowDuplicateJobs), 0, ITEM_DEFAULT, true},
+   {"Runscript",          store_runscript, ITEM(res_job.RunScripts), 0, ITEM_NO_EQUALS, 0},
+   {"MaximumConcurrentJobs", store_pint32, ITEM(res_job.MaxConcurrentJobs), 0, ITEM_DEFAULT, 1},
+   {"MaximumSpawnedJobs", store_pint32, ITEM(res_job.MaxSpawnedJobs), 0, ITEM_DEFAULT, 600},
+   {"RescheduleOnError", store_bool, ITEM(res_job.RescheduleOnError), 0, ITEM_DEFAULT, false},
+   {"RescheduleIncompleteJobs", store_bool, ITEM(res_job.RescheduleIncompleteJobs), 0, ITEM_DEFAULT, true},
+   {"RescheduleInterval", store_time, ITEM(res_job.RescheduleInterval), 0, ITEM_DEFAULT, 60 * 30},
+   {"RescheduleTimes",    store_pint32, ITEM(res_job.RescheduleTimes), 0, 0, 0},
+   {"Priority",           store_pint32, ITEM(res_job.Priority), 0, ITEM_DEFAULT, 10},
+   {"AllowMixedPriority", store_bool, ITEM(res_job.allow_mixed_priority), 0, ITEM_DEFAULT, false},
+   {"WritePartAfterJob",  store_bool, ITEM(res_job.write_part_after_job), 0, ITEM_DEFAULT, true},
+   {"SelectionPattern",   store_str, ITEM(res_job.selection_pattern), 0, 0, 0},
+   {"SelectionType",      store_migtype, ITEM(res_job.selection_type), 0, 0, 0},
+   {"Accurate",           store_bool, ITEM(res_job.accurate), 0,0,0},
+   {"AllowDuplicateJobs", store_bool, ITEM(res_job.AllowDuplicateJobs), 0, ITEM_DEFAULT, true},
    {"allowhigherduplicates",   store_bool, ITEM(res_job.AllowHigherDuplicates), 0, ITEM_DEFAULT, true},
-   {"cancellowerlevelduplicates", store_bool, ITEM(res_job.CancelLowerLevelDuplicates), 0, ITEM_DEFAULT, false},
-   {"cancelqueuedduplicates",  store_bool, ITEM(res_job.CancelQueuedDuplicates), 0, ITEM_DEFAULT, false},
-   {"cancelrunningduplicates", store_bool, ITEM(res_job.CancelRunningDuplicates), 0, ITEM_DEFAULT, false},
-   {"pluginoptions", store_str, ITEM(res_job.PluginOptions), 0, 0, 0},
-   {"base", store_alist_res, ITEM(res_job.base),  R_JOB, 0, 0},
+   {"CancelLowerLevelDuplicates", store_bool, ITEM(res_job.CancelLowerLevelDuplicates), 0, ITEM_DEFAULT, false},
+   {"CancelQueuedDuplicates",  store_bool, ITEM(res_job.CancelQueuedDuplicates), 0, ITEM_DEFAULT, false},
+   {"CancelRunningDuplicates", store_bool, ITEM(res_job.CancelRunningDuplicates), 0, ITEM_DEFAULT, false},
+   {"PluginOptions", store_str, ITEM(res_job.PluginOptions), 0, 0, 0},
+   {"Base", store_alist_res, ITEM(res_job.base),  R_JOB, 0, 0},
    {NULL, NULL, {0}, 0, 0, 0}
 };
 
-/* FileSet resource
+/* Fileset resource
  *
- *   name          handler     value                 code flags    default_value
+ *   Name          handler     value                 code flags    default_value
  */
 static RES_ITEM fs_items[] = {
-   {"name",        store_name, ITEM(res_fs.hdr.name), 0, ITEM_REQUIRED, 0},
-   {"description", store_str,  ITEM(res_fs.hdr.desc), 0, 0, 0},
-   {"include",     store_inc,  {0},                   0, ITEM_NO_EQUALS, 0},
-   {"exclude",     store_inc,  {0},                   1, ITEM_NO_EQUALS, 0},
-   {"ignorefilesetchanges", store_bool, ITEM(res_fs.ignore_fs_changes), 0, ITEM_DEFAULT, false},
-   {"enablevss",   store_bool, ITEM(res_fs.enable_vss), 0, ITEM_DEFAULT, true},
+   {"Name",        store_name, ITEM(res_fs.hdr.name), 0, ITEM_REQUIRED, 0},
+   {"Description", store_str,  ITEM(res_fs.hdr.desc), 0, 0, 0},
+   {"IgnoreFilesetChanges", store_bool, ITEM(res_fs.ignore_fs_changes), 0, ITEM_DEFAULT, false},
+   {"EnableVss",     store_bool, ITEM(res_fs.enable_vss), 0, ITEM_DEFAULT, true},
+   {"EnableSnapshot",store_bool, ITEM(res_fs.enable_snapshot), 0, ITEM_DEFAULT, false},
+   {"Include",     store_inc,  {0},                   0, ITEM_NO_EQUALS, 0},
+   {"Exclude",     store_inc,  {0},                   1, ITEM_NO_EQUALS, 0},
    {NULL,          NULL,       {0},                  0, 0, 0}
 };
 
@@ -361,9 +370,10 @@ static RES_ITEM fs_items[] = {
  *   name          handler     value                 code flags    default_value
  */
 static RES_ITEM sch_items[] = {
-   {"name",        store_name,  ITEM(res_sch.hdr.name), 0, ITEM_REQUIRED, 0},
-   {"description", store_str,   ITEM(res_sch.hdr.desc), 0, 0, 0},
-   {"run",         store_run,   ITEM(res_sch.run),      0, 0, 0},
+   {"Name",        store_name,  ITEM(res_sch.hdr.name), 0, ITEM_REQUIRED, 0},
+   {"Description", store_str,   ITEM(res_sch.hdr.desc), 0, 0, 0},
+   {"Run",         store_run,   ITEM(res_sch.run),      0, 0, 0},
+   {"Enabled",     store_bool,  ITEM(res_sch.enabled),  0, ITEM_DEFAULT, true},
    {NULL, NULL, {0}, 0, 0, 0}
 };
 
@@ -372,38 +382,38 @@ static RES_ITEM sch_items[] = {
  *   name             handler     value                        code flags default_value
  */
 static RES_ITEM pool_items[] = {
-   {"name",            store_name,    ITEM(res_pool.hdr.name),      0, ITEM_REQUIRED, 0},
-   {"description",     store_str,     ITEM(res_pool.hdr.desc),      0, 0,     0},
-   {"pooltype",        store_strname, ITEM(res_pool.pool_type),     0, ITEM_REQUIRED, 0},
-   {"labelformat",     store_strname, ITEM(res_pool.label_format),  0, 0,     0},
-   {"labeltype",       store_label,   ITEM(res_pool.LabelType),     0, 0,     0},
-   {"cleaningprefix",  store_strname, ITEM(res_pool.cleaning_prefix), 0, 0,   0},
-   {"usecatalog",      store_bool,    ITEM(res_pool.use_catalog),    0, ITEM_DEFAULT, true},
-   {"usevolumeonce",   store_bool,    ITEM(res_pool.use_volume_once), 0, 0,   0},
-   {"purgeoldestvolume", store_bool,  ITEM(res_pool.purge_oldest_volume), 0, 0, 0},
-   {"actiononpurge",   store_actiononpurge, ITEM(res_pool.action_on_purge), 0, 0, 0},
-   {"recycleoldestvolume", store_bool,  ITEM(res_pool.recycle_oldest_volume), 0, 0, 0},
-   {"recyclecurrentvolume", store_bool, ITEM(res_pool.recycle_current_volume), 0, 0, 0},
-   {"maximumvolumes",  store_pint32,    ITEM(res_pool.max_volumes),   0, 0,        0},
-   {"maximumvolumejobs", store_pint32,  ITEM(res_pool.MaxVolJobs),    0, 0,       0},
-   {"maximumvolumefiles", store_pint32, ITEM(res_pool.MaxVolFiles),   0, 0,       0},
-   {"maximumvolumebytes", store_size64, ITEM(res_pool.MaxVolBytes),   0, 0,       0},
-   {"catalogfiles",    store_bool,    ITEM(res_pool.catalog_files),  0, ITEM_DEFAULT, true},
-   {"volumeretention", store_time,    ITEM(res_pool.VolRetention),   0, ITEM_DEFAULT, 60*60*24*365},
-   {"volumeuseduration", store_time,  ITEM(res_pool.VolUseDuration), 0, 0, 0},
-   {"migrationtime",  store_time,     ITEM(res_pool.MigrationTime), 0, 0, 0},
-   {"migrationhighbytes", store_size64, ITEM(res_pool.MigrationHighBytes), 0, 0, 0},
-   {"migrationlowbytes", store_size64,  ITEM(res_pool.MigrationLowBytes), 0, 0, 0},
-   {"nextpool",      store_res,       ITEM(res_pool.NextPool), R_POOL, 0, 0},
-   {"storage",       store_alist_res, ITEM(res_pool.storage),  R_STORAGE, 0, 0},
-   {"autoprune",     store_bool,      ITEM(res_pool.AutoPrune), 0, ITEM_DEFAULT, true},
-   {"recycle",       store_bool,      ITEM(res_pool.Recycle),   0, ITEM_DEFAULT, true},
-   {"recyclepool",   store_res,       ITEM(res_pool.RecyclePool), R_POOL, 0, 0},
-   {"scratchpool",   store_res,       ITEM(res_pool.ScratchPool), R_POOL, 0, 0},
-   {"copypool",      store_alist_res, ITEM(res_pool.CopyPool), R_POOL, 0, 0},
-   {"catalog",       store_res,       ITEM(res_pool.catalog), R_CATALOG, 0, 0},
-   {"fileretention", store_time,      ITEM(res_pool.FileRetention), 0, 0, 0},
-   {"jobretention",  store_time,      ITEM(res_pool.JobRetention),  0, 0, 0},
+   {"Name",            store_name,    ITEM(res_pool.hdr.name),      0, ITEM_REQUIRED, 0},
+   {"Description",     store_str,     ITEM(res_pool.hdr.desc),      0, 0,     0},
+   {"PoolType",        store_strname, ITEM(res_pool.pool_type),     0, ITEM_REQUIRED, 0},
+   {"LabelFormat",     store_strname, ITEM(res_pool.label_format),  0, 0,     0},
+   {"LabelType",       store_label,   ITEM(res_pool.LabelType),     0, 0,     0},
+   {"CleaningPrefix",  store_strname, ITEM(res_pool.cleaning_prefix), 0, 0,   0},
+   {"UseCatalog",      store_bool,    ITEM(res_pool.use_catalog),    0, ITEM_DEFAULT, true},
+   {"UseVolumeOnce",   store_bool,    ITEM(res_pool.use_volume_once), 0, 0,   0},
+   {"PurgeOldestVolume", store_bool,  ITEM(res_pool.purge_oldest_volume), 0, 0, 0},
+   {"ActionOnPurge",   store_actiononpurge, ITEM(res_pool.action_on_purge), 0, 0, 0},
+   {"RecycleOldestVolume", store_bool,  ITEM(res_pool.recycle_oldest_volume), 0, 0, 0},
+   {"RecycleCurrentVolume", store_bool, ITEM(res_pool.recycle_current_volume), 0, 0, 0},
+   {"MaximumVolumes",  store_pint32,    ITEM(res_pool.max_volumes),   0, 0,        0},
+   {"MaximumVolumeJobs", store_pint32,  ITEM(res_pool.MaxVolJobs),    0, 0,       0},
+   {"MaximumVolumeFiles", store_pint32, ITEM(res_pool.MaxVolFiles),   0, 0,       0},
+   {"MaximumVolumeBytes", store_size64, ITEM(res_pool.MaxVolBytes),   0, 0,       0},
+   {"CatalogFiles",    store_bool,    ITEM(res_pool.catalog_files),  0, ITEM_DEFAULT, true},
+   {"VolumeRetention", store_time,    ITEM(res_pool.VolRetention),   0, ITEM_DEFAULT, 60*60*24*365},
+   {"VolumeUseDuration", store_time,  ITEM(res_pool.VolUseDuration), 0, 0, 0},
+   {"MigrationTime",  store_time,     ITEM(res_pool.MigrationTime), 0, 0, 0},
+   {"MigrationHighBytes", store_size64, ITEM(res_pool.MigrationHighBytes), 0, 0, 0},
+   {"MigrationLowBytes", store_size64,  ITEM(res_pool.MigrationLowBytes), 0, 0, 0},
+   {"NextPool",      store_res,       ITEM(res_pool.NextPool), R_POOL, 0, 0},
+   {"Storage",       store_alist_res, ITEM(res_pool.storage),  R_STORAGE, 0, 0},
+   {"AutoPrune",     store_bool,      ITEM(res_pool.AutoPrune), 0, ITEM_DEFAULT, true},
+   {"Recycle",       store_bool,      ITEM(res_pool.Recycle),   0, ITEM_DEFAULT, true},
+   {"RecyclePool",   store_res,       ITEM(res_pool.RecyclePool), R_POOL, 0, 0},
+   {"ScratchPool",   store_res,       ITEM(res_pool.ScratchPool), R_POOL, 0, 0},
+   {"CopyPool",      store_alist_res, ITEM(res_pool.CopyPool), R_POOL, 0, 0},
+   {"Catalog",       store_res,       ITEM(res_pool.catalog), R_CATALOG, 0, 0},
+   {"FileRetention", store_time,      ITEM(res_pool.FileRetention), 0, 0, 0},
+   {"JobRetention",  store_time,      ITEM(res_pool.JobRetention),  0, 0, 0},
 
    {NULL, NULL, {0}, 0, 0, 0}
 };
@@ -413,12 +423,12 @@ static RES_ITEM pool_items[] = {
  *   name             handler     value                        code flags default_value
  */
 static RES_ITEM counter_items[] = {
-   {"name",            store_name,    ITEM(res_counter.hdr.name),        0, ITEM_REQUIRED, 0},
-   {"description",     store_str,     ITEM(res_counter.hdr.desc),        0, 0,     0},
-   {"minimum",         store_int32,   ITEM(res_counter.MinValue),        0, ITEM_DEFAULT, 0},
-   {"maximum",         store_pint32,  ITEM(res_counter.MaxValue),        0, ITEM_DEFAULT, INT32_MAX},
-   {"wrapcounter",     store_res,     ITEM(res_counter.WrapCounter),     R_COUNTER, 0, 0},
-   {"catalog",         store_res,     ITEM(res_counter.Catalog),         R_CATALOG, 0, 0},
+   {"Name",            store_name,    ITEM(res_counter.hdr.name),        0, ITEM_REQUIRED, 0},
+   {"Description",     store_str,     ITEM(res_counter.hdr.desc),        0, 0,     0},
+   {"Minimum",         store_int32,   ITEM(res_counter.MinValue),        0, ITEM_DEFAULT, 0},
+   {"Maximum",         store_pint32,  ITEM(res_counter.MaxValue),        0, ITEM_DEFAULT, INT32_MAX},
+   {"WrapCounter",     store_res,     ITEM(res_counter.WrapCounter),     R_COUNTER, 0, 0},
+   {"Catalog",         store_res,     ITEM(res_counter.Catalog),         R_CATALOG, 0, 0},
    {NULL, NULL, {0}, 0, 0, 0}
 };
 
@@ -433,22 +443,22 @@ extern RES_ITEM msgs_items[];
  *  NOTE!!! keep it in the same order as the R_codes
  *    or eliminate all resources[rindex].name
  *
- *  name             items        rcode        res_head
+ *  name             items        rcode
  */
 RES_TABLE resources[] = {
-   {"director",      dir_items,   R_DIRECTOR},
-   {"client",        cli_items,   R_CLIENT},
-   {"job",           job_items,   R_JOB},
-   {"storage",       store_items, R_STORAGE},
-   {"catalog",       cat_items,   R_CATALOG},
-   {"schedule",      sch_items,   R_SCHEDULE},
-   {"fileset",       fs_items,    R_FILESET},
-   {"pool",          pool_items,  R_POOL},
-   {"messages",      msgs_items,  R_MSGS},
-   {"counter",       counter_items, R_COUNTER},
-   {"console",       con_items,   R_CONSOLE},
-   {"jobdefs",       job_items,   R_JOBDEFS},
-   {"device",        NULL,        R_DEVICE},  /* info obtained from SD */
+   {"Director",      dir_items,   R_DIRECTOR},
+   {"Client",        cli_items,   R_CLIENT},
+   {"Job",           job_items,   R_JOB},
+   {"Storage",       store_items, R_STORAGE},
+   {"Catalog",       cat_items,   R_CATALOG},
+   {"Schedule",      sch_items,   R_SCHEDULE},
+   {"Fileset",       fs_items,    R_FILESET},
+   {"Pool",          pool_items,  R_POOL},
+   {"Messages",      msgs_items,  R_MSGS},
+   {"Counter",       counter_items, R_COUNTER},
+   {"Console",       con_items,   R_CONSOLE},
+   {"JobDefs",       job_items,   R_JOBDEFS},
+   {"Device",        NULL,        R_DEVICE},  /* info obtained from SD */
    {NULL,            NULL,        0}
 };
 
@@ -480,17 +490,18 @@ struct s_jl joblevels[] = {
    {NULL,            0,                          0}
 };
 
+
 /* Keywords (RHS) permitted in Job type records
  *
  *   type_name       job_type
  */
-struct s_jt jobtypes[] = {
-   {"backup",        JT_BACKUP},
-   {"admin",         JT_ADMIN},
-   {"verify",        JT_VERIFY},
-   {"restore",       JT_RESTORE},
-   {"migrate",       JT_MIGRATE},
-   {"copy",          JT_COPY},
+s_jt jobtypes[] = {
+   {"Backup",        JT_BACKUP},
+   {"Admin",         JT_ADMIN},
+   {"Verify",        JT_VERIFY},
+   {"Restore",       JT_RESTORE},
+   {"Migrate",       JT_MIGRATE},
+   {"Copy",          JT_COPY},
    {NULL,            0}
 };
 
@@ -499,16 +510,16 @@ struct s_jt jobtypes[] = {
  *
  *   type_name       job_type
  */
-struct s_jt migtypes[] = {
-   {"smallestvolume",   MT_SMALLEST_VOL},
-   {"oldestvolume",     MT_OLDEST_VOL},
-   {"pooloccupancy",    MT_POOL_OCCUPANCY},
-   {"pooltime",         MT_POOL_TIME},
-   {"pooluncopiedjobs", MT_POOL_UNCOPIED_JOBS},
-   {"client",           MT_CLIENT},
-   {"volume",           MT_VOLUME},
-   {"job",              MT_JOB},
-   {"sqlquery",         MT_SQLQUERY},
+s_jt migtypes[] = {
+   {"SmallestVolume",   MT_SMALLEST_VOL},
+   {"OldestVolume",     MT_OLDEST_VOL},
+   {"PoolOccupancy",    MT_POOL_OCCUPANCY},
+   {"PoolTime",         MT_POOL_TIME},
+   {"PoolUncopiedJobs", MT_POOL_UNCOPIED_JOBS},
+   {"Client",           MT_CLIENT},
+   {"Volume",           MT_VOLUME},
+   {"Job",              MT_JOB},
+   {"SqlQuery",         MT_SQLQUERY},
    {NULL,            0}
 };
 
@@ -516,10 +527,10 @@ struct s_jt migtypes[] = {
 
 /* Options permitted in Restore replace= */
 struct s_kw ReplaceOptions[] = {
-   {"always",         REPLACE_ALWAYS},
-   {"ifnewer",        REPLACE_IFNEWER},
-   {"ifolder",        REPLACE_IFOLDER},
-   {"never",          REPLACE_NEVER},
+   {"Always",         REPLACE_ALWAYS},
+   {"IfNewer",        REPLACE_IFNEWER},
+   {"IfOlder",        REPLACE_IFOLDER},
+   {"Never",          REPLACE_NEVER},
    {NULL,               0}
 };
 
@@ -550,9 +561,9 @@ const char *level_to_str(int level)
 }
 
 /* Dump contents of resource */
-void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fmt, ...), void *sock)
+void dump_resource(int type, RES *ares, void sendit(void *sock, const char *fmt, ...), void *sock)
 {
-   URES *res = (URES *)reshdr;
+   URES *res = (URES *)ares;
    bool recurse = true;
    char ed1[100], ed2[100], ed3[100];
    DEVICE *dev;
@@ -563,13 +574,13 @@ void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fm
       return;
    }
    if (type < 0) {                    /* no recursion */
-      type = - type;
+      type = -type;
       recurse = false;
    }
    switch (type) {
    case R_DIRECTOR:
       sendit(sock, _("Director: name=%s MaxJobs=%d FDtimeout=%s SDtimeout=%s\n"),
-         reshdr->name, res->res_dir.MaxConcurrentJobs,
+         ares->name, res->res_dir.MaxConcurrentJobs,
          edit_uint64(res->res_dir.FDConnectTimeout, ed1),
          edit_uint64(res->res_dir.SDConnectTimeout, ed2));
       if (res->res_dir.query_file) {
@@ -605,8 +616,9 @@ void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fm
       if (!acl_access_ok(ua, Client_ACL, res->res_client.hdr.name)) {
          break;
       }
-      sendit(sock, _("Client: name=%s address=%s FDport=%d MaxJobs=%u\n"),
-         res->res_client.hdr.name, res->res_client.address, res->res_client.FDport,
+      sendit(sock, _("Client: Name=%s Enabled=%d Address=%s FDport=%d MaxJobs=%u\n"),
+         res->res_client.hdr.name, res->res_client.enabled,
+         res->res_client.address, res->res_client.FDport,
          res->res_client.MaxConcurrentJobs);
       sendit(sock, _("      JobRetention=%s FileRetention=%s AutoPrune=%d\n"),
          edit_utime(res->res_client.JobRetention, ed1, sizeof(ed1)),
@@ -643,12 +655,13 @@ void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fm
          break;
       }
       sendit(sock, _("Storage: name=%s address=%s SDport=%d MaxJobs=%u\n"
-"      DeviceName=%s MediaType=%s StorageId=%s\n"),
+"      DeviceName=%s MediaType=%s StorageId=%s Autochanger=%d\n"),
          res->res_store.hdr.name, res->res_store.address, res->res_store.SDport,
          res->res_store.MaxConcurrentJobs,
          res->res_store.dev_name(),
          res->res_store.media_type,
-         edit_int64(res->res_store.StorageId, ed1));
+         edit_int64(res->res_store.StorageId, ed1),
+         res->res_store.autochanger);
       if (res->res_store.fd_storage_address) {
          sendit(sock, "      FDStorageAddress=%s\n", res->res_store.fd_storage_address);
       }
@@ -763,15 +776,15 @@ void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fm
          dump_resource(-R_POOL, (RES *)res->res_job.pool, sendit, sock);
       }
       if (res->res_job.full_pool) {
-         sendit(sock, _("  --> "));
+         sendit(sock, _("  --> FullBackup"));
          dump_resource(-R_POOL, (RES *)res->res_job.full_pool, sendit, sock);
       }
       if (res->res_job.inc_pool) {
-         sendit(sock, _("  --> "));
+         sendit(sock, _("  --> IncrementalBackup"));
          dump_resource(-R_POOL, (RES *)res->res_job.inc_pool, sendit, sock);
       }
       if (res->res_job.diff_pool) {
-         sendit(sock, _("  --> "));
+         sendit(sock, _("  --> DifferentialBackup"));
          dump_resource(-R_POOL, (RES *)res->res_job.diff_pool, sendit, sock);
       }
       if (res->res_job.verify_job) {
@@ -870,8 +883,7 @@ void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fm
          if (incexe->plugin_list.size()) {
             sendit(sock, "      N\n");
          }
-
-      }
+      } /* end for over includes */
 
       for (i=0; i<res->res_fs.num_excludes; i++) {
          INCEXE *incexe = res->res_fs.exclude_items[i];
@@ -883,17 +895,19 @@ void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fm
          }
       }
       break;
-   }
+   } /* end case R_FILESET */
 
    case R_SCHEDULE:
       if (!acl_access_ok(ua, Schedule_ACL, res->res_sch.hdr.name)) {
          break;
       }
+
       if (res->res_sch.run) {
          int i;
          RUN *run = res->res_sch.run;
          char buf[1000], num[30];
-         sendit(sock, _("Schedule: name=%s\n"), res->res_sch.hdr.name);
+         sendit(sock, _("Schedule: Name=%s Enabled=%d\n"), 
+            res->res_sch.hdr.name, res->res_sch.enabled);
          if (!run) {
             break;
          }
@@ -1059,6 +1073,7 @@ next_run:
    if (recurse && res->res_dir.hdr.next) {
       dump_resource(type, res->res_dir.hdr.next, sendit, sock);
    }
+
 }
 
 /*
@@ -1100,6 +1115,7 @@ static void free_incexe(INCEXE *incexe)
    free(incexe);
 }
 
+
 /*
  * Free memory of resource -- called when daemon terminates.
  * NB, we don't need to worry about freeing any references
@@ -1107,15 +1123,17 @@ static void free_incexe(INCEXE *incexe)
  * resource chain is traversed.  Mainly we worry about freeing
  * allocated strings (names).
  */
-void free_resource(RES *sres, int type)
+void free_resource(RES *rres, int type)
 {
    int num;
-   RES *nres;                         /* next resource if linked */
-   URES *res = (URES *)sres;
+   RES *nres;
+   URES *res = (URES *)rres;
 
-   if (res == NULL)
+   if (res == NULL) {
       return;
+   }
 
+   Dmsg3(200, "type=%d res=%p name=%s\n", type, res, res->res_dir.hdr.name);
    /* common stuff -- free the resource name and description */
    nres = (RES *)res->res_dir.hdr.next;
    if (res->res_dir.hdr.name) {
@@ -1672,7 +1690,7 @@ void save_resource(int type, RES_ITEM *items, int pass)
    }
 }
 
-static void store_actiononpurge(LEX *lc, RES_ITEM *item, int index, int pass)
+void store_actiononpurge(LEX *lc, RES_ITEM *item, int index, int pass)
 {
    uint32_t *destination = (uint32_t*)item->value;
    lex_get_token(lc, T_NAME);
@@ -1868,6 +1886,8 @@ static void store_runscript_when(LEX *lc, RES_ITEM *item, int index, int pass)
       *(uint32_t *)(item->value) = SCRIPT_After;
    } else if (strcasecmp(lc->str, "aftervss") == 0) {
       *(uint32_t *)(item->value) = SCRIPT_AfterVSS;
+   } else if (strcasecmp(lc->str, "aftersnapshot") == 0) {
+      *(uint32_t *)(item->value) = SCRIPT_AfterVSS;
    } else if (strcasecmp(lc->str, "always") == 0) {
       *(uint32_t *)(item->value) = SCRIPT_Any;
    } else {
@@ -1934,31 +1954,31 @@ static void store_short_runscript(LEX *lc, RES_ITEM *item, int index, int pass)
 
       /* TODO: remove all script->old_proto with bacula 1.42 */
 
-      if (strcmp(item->name, "runbeforejob") == 0) {
+      if (strcasecmp(item->name, "runbeforejob") == 0) {
          script->when = SCRIPT_Before;
          script->fail_on_error = true;
          script->set_target("");
 
-      } else if (strcmp(item->name, "runafterjob") == 0) {
+      } else if (strcasecmp(item->name, "runafterjob") == 0) {
          script->when = SCRIPT_After;
          script->on_success = true;
          script->on_failure = false;
          script->set_target("");
 
-      } else if (strcmp(item->name, "clientrunafterjob") == 0) {
+      } else if (strcasecmp(item->name, "clientrunafterjob") == 0) {
          script->old_proto = true;
          script->when = SCRIPT_After;
          script->set_target("%c");
          script->on_success = true;
          script->on_failure = false;
 
-      } else if (strcmp(item->name, "clientrunbeforejob") == 0) {
+      } else if (strcasecmp(item->name, "clientrunbeforejob") == 0) {
          script->old_proto = true;
          script->when = SCRIPT_Before;
          script->set_target("%c");
          script->fail_on_error = true;
 
-      } else if (strcmp(item->name, "runafterfailedjob") == 0) {
+      } else if (strcasecmp(item->name, "runafterfailedjob") == 0) {
          script->when = SCRIPT_After;
          script->on_failure = true;
          script->on_success = false;
@@ -1972,8 +1992,8 @@ static void store_short_runscript(LEX *lc, RES_ITEM *item, int index, int pass)
       (*runscripts)->append(script);
       script->debug();
    }
-
    scan_to_eol(lc);
+   set_bit(index, res_all.hdr.item_present);
 }
 
 /* Store a bool in a bit field without modifing res_all.hdr
@@ -2016,7 +2036,7 @@ static RES_ITEM runscript_items[] = {
  *  resource.  We treat the RunScript like a sort of
  *  mini-resource within the Job resource.
  */
-static void store_runscript(LEX *lc, RES_ITEM *item, int index, int pass)
+void store_runscript(LEX *lc, RES_ITEM *item, int index, int pass)
 {
    char *c;
    int token, i, t;
diff --git a/src/dird/dird_conf.h b/src/dird/dird_conf.h
index b3eea1e..90700e5 100644
--- a/src/dird/dird_conf.h
+++ b/src/dird/dird_conf.h
@@ -1,22 +1,26 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Director specific configuration and defines
  *
- *     Written by Kern Sibbald, Feb MM
+ *     Kern Sibbald, Feb MM
  *
  */
 
@@ -38,7 +42,8 @@ enum {
    R_COUNTER,
    R_CONSOLE,
    R_JOBDEFS,
-   R_DEVICE,
+   R_DEVICE,       /* This is the real last device class */
+
    R_FIRST = R_DIRECTOR,
    R_LAST  = R_DEVICE                 /* keep this updated */
 };
@@ -55,11 +60,11 @@ enum {
    R_BACKUP
 };
 
-
-/* Used for certain KeyWord tables */
-struct s_kw {
+/* Options for FileSet keywords */
+struct s_fs_opt {
    const char *name;
-   uint32_t token;
+   int keyword;
+   const char *option;
 };
 
 /* Job Level keyword structure */
@@ -105,6 +110,7 @@ public:
    uint32_t MaxConcurrentJobs;        /* Max concurrent jobs for whole director */
    uint32_t MaxSpawnedJobs;           /* Max Jobs that can be started by Migration/Copy */
    uint32_t MaxConsoleConnect;        /* Max concurrent console session */
+   uint32_t MaxReload;                /* Maximum reload requests */
    utime_t FDConnectTimeout;          /* timeout for connect in seconds */
    utime_t SDConnectTimeout;          /* timeout in seconds */
    utime_t heartbeat_interval;        /* Interval to send heartbeats */
@@ -222,8 +228,8 @@ public:
    char *db_user;
    char *db_name;
    char *db_driver;                   /* Select appropriate driver */
-   uint32_t mult_db_connections;      /* set if multiple connections wanted */
-   bool disable_batch_insert;         /* set if batch inserts should be disabled */
+   uint32_t mult_db_connections;      /* set for multiple db connections */
+   bool disable_batch_insert;         /* set to disable batch inserts */
 
    /* Methods */
    char *name() const;
@@ -244,6 +250,7 @@ public:
    uint32_t FDport;                   /* Where File daemon listens */
    utime_t FileRetention;             /* file retention period in seconds */
    utime_t JobRetention;              /* job retention period in seconds */
+   utime_t SnapRetention;             /* Snapshot retention period in seconds */
    utime_t heartbeat_interval;        /* Interval to send heartbeats */
    char *address;
    char *fd_storage_address;          /* Storage address to use from FD side  */
@@ -260,6 +267,7 @@ public:
    bool tls_authenticate;             /* Authenticated with TLS */
    bool tls_enable;                   /* Enable TLS */
    bool tls_require;                  /* Require TLS */
+   bool enabled;                      /* Set if client enabled */
    bool AutoPrune;                    /* Do automatic pruning? */
    bool sd_calls_client;              /* SD calls the client */
    int64_t max_bandwidth;             /* Limit speed on this client */
@@ -299,8 +307,8 @@ public:
    bool tls_enable;                   /* Enable TLS */
    bool tls_require;                  /* Require TLS */
    bool enabled;                      /* Set if device is enabled */
-   bool  autochanger;                 /* set if autochanger */
    bool AllowCompress;                /* set if this Storage should allow jobs to enable compression */
+   bool autochanger;                  /* set if we are part of an autochanger */
    int64_t StorageId;                 /* Set from Storage DB record */
    utime_t heartbeat_interval;        /* Interval to send heartbeats */
    uint32_t drives;                   /* number of drives in autochanger */
@@ -361,13 +369,14 @@ class JOB {
 public:
    RES   hdr;
 
-   uint32_t   JobType;                /* job type (backup, verify, restore */
-   uint32_t   JobLevel;               /* default backup/verify level */
-   int32_t   Priority;                /* Job priority */
-   uint32_t   RestoreJobId;           /* What -- JobId to restore */
-   int32_t   RescheduleTimes;         /* Number of times to reschedule job */
-   uint32_t   replace;                /* How (overwrite, ..) */
-   uint32_t   selection_type;
+   uint32_t JobType;                  /* job type (backup, verify, restore */
+   uint32_t JobLevel;                 /* default backup/verify level */
+   uint32_t RestoreJobId;             /* What -- JobId to restore */
+   uint32_t replace;                  /* How (overwrite, ..) */
+   uint32_t selection_type;
+
+   int32_t  Priority;                 /* Job priority */
+   int32_t  RescheduleTimes;          /* Number of times to reschedule job */
 
    char *RestoreWhere;                /* Where on disk to restore -- directory */
    char *RegexWhere;                  /* RegexWhere option */
@@ -391,6 +400,7 @@ public:
    utime_t MaxFullInterval;           /* Maximum time interval between Fulls */
    utime_t MaxDiffInterval;           /* Maximum time interval between Diffs */
    utime_t DuplicateJobProximity;     /* Permitted time between duplicicates */
+   utime_t SnapRetention;             /* Snapshot retention period in seconds */
    int64_t spool_size;                /* Size of spool file for this job */
    int32_t MaxConcurrentJobs;         /* Maximum concurrent jobs */
    int32_t NumConcurrentJobs;         /* number of concurrent jobs running */
@@ -435,7 +445,7 @@ public:
    bool CancelQueuedDuplicates;       /* Cancel queued jobs */
    bool CancelRunningDuplicates;      /* Cancel Running jobs */
    bool PurgeMigrateJob;              /* Purges source job on completion */
-   bool IgnoreDuplicateJobChecking;   /* Ignore Duplicate Job Checking */
+   bool IgnoreDuplicateJobChecking;   /* Set to ignore Duplicate Job Checking */
 
    alist *base;                       /* Base jobs */
    int64_t max_bandwidth;             /* Speed limit on this job */
@@ -446,8 +456,40 @@ public:
 
 inline char *JOB::name() const { return hdr.name; }
 
+/* Define FileSet Options keyword values */
+enum {
+   INC_KW_NONE,
+   INC_KW_COMPRESSION,
+   INC_KW_DIGEST,
+   INC_KW_ENCRYPTION,
+   INC_KW_VERIFY,
+   INC_KW_BASEJOB,
+   INC_KW_ACCURATE,
+   INC_KW_ONEFS,
+   INC_KW_RECURSE,
+   INC_KW_SPARSE,
+   INC_KW_HARDLINK,
+   INC_KW_REPLACE,               /* restore options */
+   INC_KW_READFIFO,              /* Causes fifo data to be read */
+   INC_KW_PORTABLE,
+   INC_KW_MTIMEONLY,
+   INC_KW_KEEPATIME,
+   INC_KW_EXCLUDE,
+   INC_KW_ACL,
+   INC_KW_IGNORECASE,
+   INC_KW_HFSPLUS,
+   INC_KW_NOATIME,
+   INC_KW_ENHANCEDWILD,
+   INC_KW_CHKCHANGES,
+   INC_KW_STRIPPATH,
+   INC_KW_HONOR_NODUMP,
+   INC_KW_XATTR,
+   INC_KW_MAX                   /* Keep this last */
+};
+
+
 #undef  MAX_FOPTS
-#define MAX_FOPTS 40
+#define MAX_FOPTS 50
 
 /* File options structure */
 struct FOPTS {
@@ -470,6 +512,7 @@ struct FOPTS {
 
 /* This is either an include item or an exclude item */
 struct INCEXE {
+   char  opt_present[INC_KW_MAX+1]; /* set if option is present in conf file */
    FOPTS *current_opts;               /* points to current options structure */
    FOPTS **opts_list;                 /* options list */
    int32_t num_opts;                  /* number of options items */
@@ -496,6 +539,7 @@ public:
    char MD5[30];                      /* base 64 representation of MD5 */
    bool ignore_fs_changes;            /* Don't force Full if FS changed */
    bool enable_vss;                   /* Enable Volume Shadow Copy */
+   bool enable_snapshot;              /* Enable Snapshot */
 
    /* Methods */
    char *name() const;
@@ -512,6 +556,8 @@ public:
    RES   hdr;
 
    RUN *run;
+   bool enabled;                      /* set if enabled */
+   /* Methods */
    char *name() const;
 };
 
@@ -582,8 +628,6 @@ public:
 inline char *POOL::name() const { return hdr.name; }
 
 
-
-
 /* Define the Union of all the above
  * resource structure definitions.
  */
@@ -636,6 +680,7 @@ public:
    uint32_t minute;                   /* minute to run job */
    time_t last_run;                   /* last time run */
    time_t next_run;                   /* next time to run */
+   bool last_day_set;                 /* set if last_day is used */
    char hour[nbytes_for_bits(24)];    /* bit set for each hour */
    char mday[nbytes_for_bits(32)];    /* bit set for each day of month */
    char month[nbytes_for_bits(12)];   /* bit set for each month */
@@ -650,3 +695,23 @@ public:
 #define GetJobResWithName(x) ((JOB *)GetResWithName(R_JOB, (x)))
 #define GetFileSetResWithName(x) ((FILESET *)GetResWithName(R_FILESET, (x)))
 #define GetCatalogResWithName(x) ((CAT *)GetResWithName(R_CATALOG, (x)))
+
+/* Imported subroutines */
+void store_jobtype(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_level(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_replace(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_migtype(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_acl(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_ac_res(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_actiononpurge(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_inc(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_regex(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_wild(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_fstype(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_drivetype(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_opts(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_lopts(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_base(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_plugin(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_run(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_runscript(LEX *lc, RES_ITEM *item, int index, int pass);
diff --git a/src/dird/expand.c b/src/dird/expand.c
index c9be631..00a0577 100644
--- a/src/dird/expand.c
+++ b/src/dird/expand.c
@@ -8,19 +8,23 @@
  *   Version $Id$
  */
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2003-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 
 #include "bacula.h"
diff --git a/src/dird/fd_cmds.c b/src/dird/fd_cmds.c
index adff580..9d69048 100644
--- a/src/dird/fd_cmds.c
+++ b/src/dird/fd_cmds.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -34,13 +38,14 @@
 const int dbglvl = 400;
 
 /* Commands sent to File daemon */
-static char filesetcmd[]  = "fileset%s\n"; /* set full fileset */
+static char filesetcmd[]  = "fileset%s%s\n"; /* set full fileset */
 static char jobcmd[]      = "JobId=%s Job=%s SDid=%u SDtime=%u Authorization=%s\n";
 /* Note, mtime_only is not used here -- implemented as file option */
 static char levelcmd[]    = "level = %s%s%s mtime_only=%d %s%s\n";
 static char runscript[]   = "Run OnSuccess=%u OnFailure=%u AbortOnError=%u When=%u Command=%s\n";
 static char runbeforenow[]= "RunBeforeNow\n";
 static char bandwidthcmd[] = "setbandwidth=%lld Job=%s\n";
+static char component_info[] = "component_info\n";
 
 /* Responses received from File daemon */
 static char OKinc[]          = "2000 OK include\n";
@@ -49,6 +54,7 @@ static char OKlevel[]        = "2000 OK level\n";
 static char OKRunScript[]    = "2000 OK RunScript\n";
 static char OKRunBeforeNow[] = "2000 OK RunBeforeNow\n";
 static char OKRestoreObject[] = "2000 OK ObjectRestored\n";
+static char OKComponentInfo[] = "2000 OK ComponentInfo\n";
 static char OKBandwidth[]    = "2000 OK Bandwidth\n";
 
 /* Forward referenced functions */
@@ -74,6 +80,12 @@ int connect_to_file_daemon(JCR *jcr, int retry_interval, int max_retry_time,
    char ed1[30];
    utime_t heart_beat;
 
+   if (!jcr->client) {
+      Jmsg(jcr, M_FATAL, 0, _("File daemon not defined for current Job\n"));
+      Dmsg0(10, "No Client defined for the job.\n");
+      return 0;
+   }
+
    if (jcr->client->heartbeat_interval) {
       heart_beat = jcr->client->heartbeat_interval;
    } else {
@@ -193,7 +205,7 @@ void get_level_since_time(JCR *jcr, char *since, int since_len)
        * This is probably redundant, but some of the code below
        * uses jcr->stime, so don't remove unless you are sure.
        */
-      if (!db_find_job_start_time(jcr,jcr->db, &jcr->jr, &jcr->stime, jcr->PrevJob)) {
+      if (!db_find_job_start_time(jcr, jcr->db, &jcr->jr, &jcr->stime, jcr->PrevJob)) {
          do_full = true;
       }
       have_full = db_find_last_job_start_time(jcr, jcr->db, &jcr->jr,
@@ -371,8 +383,11 @@ static bool send_fileset(JCR *jcr)
          }
          for (j=0; j<ie->num_opts; j++) {
             FOPTS *fo = ie->opts_list[j];
-
             bool enhanced_wild = false;
+            bool stripped_opts = false;
+            bool compress_disabled = false;
+            char newopts[MAX_FOPTS];
+
             for (k=0; fo->opts[k]!='\0'; k++) {
                if (fo->opts[k]=='W') {
                   enhanced_wild = true;
@@ -380,34 +395,41 @@ static bool send_fileset(JCR *jcr)
                }
             }
 
-            /* Strip out compression option Zn if disallowed for this Storage */
-            if (store && !store->AllowCompress) {
-               char newopts[MAX_FOPTS];
-               bool done=false;         /* print warning only if compression enabled in FS */
+            /*
+             * Strip out compression option Zn if disallowed
+             *  for this Storage.
+             * Strip out dedup option dn if old FD
+             */
+            bool strip_compress = store && !store->AllowCompress;
+            if (strip_compress || jcr->FDVersion >= 11) {
                int j = 0;
                for (k=0; fo->opts[k]!='\0'; k++) {
-                 /* Z compress option is followed by the single-digit compress level or 'o' */
-                 if (fo->opts[k]=='Z') {
-                    done=true;
-                    k++;                /* skip option and level */
-                 } else {
-                    newopts[j] = fo->opts[k];
-                    j++;
-                 }
+                  /* Z compress option is followed by the single-digit compress level or 'o' */
+                  if (strip_compress && fo->opts[k]=='Z') {
+                     stripped_opts = true;
+                     compress_disabled = true;
+                     k++;                /* skip level */
+                  } else if (jcr->FDVersion < 11 && fo->opts[k]=='d') {
+                     stripped_opts = true;
+                     k++;              /* skip level */
+                  } else {
+                     newopts[j] = fo->opts[k];
+                     j++;
+                  }
                }
                newopts[j] = '\0';
-
-               if (done) {
+               if (compress_disabled) {
                   Jmsg(jcr, M_INFO, 0,
                       _("FD compression disabled for this Job because AllowCompress=No in Storage resource.\n") );
                }
+            }
+            if (stripped_opts) {
                /* Send the new trimmed option set without overwriting fo->opts */
                fd->fsend("O %s\n", newopts);
             } else {
                /* Send the original options */
                fd->fsend("O %s\n", fo->opts);
             }
-
             for (k=0; k<fo->regex.size(); k++) {
                fd->fsend("R %s\n", fo->regex.get(k));
             }
@@ -566,7 +588,9 @@ bool send_include_list(JCR *jcr)
 {
    BSOCK *fd = jcr->file_bsock;
    if (jcr->fileset->new_include) {
-      fd->fsend(filesetcmd, jcr->fileset->enable_vss ? " vss=1" : "");
+      fd->fsend(filesetcmd,
+                jcr->fileset->enable_vss ? " vss=1" : "",
+                jcr->fileset->enable_snapshot ? " snap=1" : "");
       return send_fileset(jcr);
    }
    return true;
@@ -783,6 +807,48 @@ bool send_restore_objects(JCR *jcr)
 }
 
 /*
+ * Send the plugin a list of component info files.  These
+ *  were files that were created during the backup for
+ *  the VSS plugin.  The list is a list of those component
+ *  files that have been chosen for restore.  We
+ *  send them before the Restore Objects.
+ */
+bool send_component_info(JCR *jcr)
+{
+   BSOCK *fd;
+   char buf[2000];
+   bool ok = true;
+
+   if (!jcr->component_fd) {
+      return true;           /* nothing to send */
+   }
+   /* Don't send if old version FD */
+   if (jcr->FDVersion < 6) {
+      goto bail_out;
+   }
+
+   rewind(jcr->component_fd);
+   fd = jcr->file_bsock;
+   fd->fsend(component_info);
+   while (fgets(buf, sizeof(buf), jcr->component_fd)) {
+      fd->fsend("%s", buf);
+      Dmsg1(050, "Send component_info to FD: %s\n", buf);
+   }
+   fd->signal(BNET_EOD);
+   if (!response(jcr, fd, OKComponentInfo, "ComponentInfo", DISPLAY_ERROR)) {
+      Jmsg(jcr, M_FATAL, 0, _("ComponentInfo failed.\n"));
+      ok = false;
+   }
+
+bail_out:
+   fclose(jcr->component_fd);
+   jcr->component_fd = NULL;
+   unlink(jcr->component_fname);
+   free_and_null_pool_memory(jcr->component_fname);
+   return ok;
+}
+
+/*
  * Read the attributes from the File daemon for
  * a Verify job and store them in the catalog.
  */
@@ -856,6 +922,7 @@ int get_attributes_and_put_in_catalog(JCR *jcr)
          ar->JobId = jcr->JobId;
          ar->ClientId = jcr->ClientId;
          ar->PathId = 0;
+         ar->FilenameId = 0;
          ar->Digest = NULL;
          ar->DigestType = CRYPTO_DIGEST_NONE;
          ar->DeltaSeq = 0;
diff --git a/src/dird/getmsg.c b/src/dird/getmsg.c
index 364298b..28b2d6e 100644
--- a/src/dird/getmsg.c
+++ b/src/dird/getmsg.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -82,6 +86,10 @@ static void set_jcr_sd_job_status(JCR *jcr, int SDJobStatus)
       jcr->wait_time = time(NULL);
    }
    jcr->SDJobStatus = SDJobStatus;
+   if (jcr->SDJobStatus == JS_Incomplete) {
+      jcr->setJobStatus(JS_Incomplete);
+   }
+
 }
 
 /*
@@ -214,17 +222,17 @@ int bget_dirmsg(BSOCK *bs)
        *   CatReq Job=nn Catalog-Request-Message
        */
       if (bs->msg[0] == 'C') {        /* Catalog request */
-         Dmsg2(900, "Catalog req jcr 0x%x: %s", jcr, bs->msg);
+         Dmsg2(900, "Catalog req jcr=%p: %s", jcr, bs->msg);
          catalog_request(jcr, bs);
          continue;
       }
       if (bs->msg[0] == 'U') {        /* SD sending attributes */
-         Dmsg2(900, "Catalog upd jcr 0x%x: %s", jcr, bs->msg);
+         Dmsg2(900, "Catalog upd jcr=%p: %s", jcr, bs->msg);
          catalog_update(jcr, bs);
          continue;
       }
       if (bs->msg[0] == 'B') {        /* SD sending file spool attributes */
-         Dmsg2(100, "Blast attributes jcr 0x%x: %s", jcr, bs->msg);
+         Dmsg2(100, "Blast attributes jcr=%p: %s", jcr, bs->msg);
          char filename[256];
          if (sscanf(bs->msg, "BlastAttr Job=%127s File=%255s",
                     Job, filename) != 2) {
diff --git a/src/dird/inc_conf.c b/src/dird/inc_conf.c
index a463553..560fc1a 100644
--- a/src/dird/inc_conf.c
+++ b/src/dird/inc_conf.c
@@ -1,23 +1,27 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *   Configuration file parser for new and old Include and
  *      Exclude records
  *
- *     Written by Kern Sibbald, March MMIII
+ *     Kern Sibbald, March MMIII
  *
  */
 
@@ -34,19 +38,20 @@
 void store_inc(LEX *lc, RES_ITEM *item, int index, int pass);
 
 static void store_newinc(LEX *lc, RES_ITEM *item, int index, int pass);
-static void store_regex(LEX *lc, RES_ITEM *item, int index, int pass);
-static void store_wild(LEX *lc, RES_ITEM *item, int index, int pass);
-static void store_fstype(LEX *lc, RES_ITEM *item, int index, int pass);
-static void store_drivetype(LEX *lc, RES_ITEM *item, int index, int pass);
-static void store_opts(LEX *lc, RES_ITEM *item, int index, int pass);
-static void store_base(LEX *lc, RES_ITEM *item, int index, int pass);
-static void store_plugin(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_regex(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_wild(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_fstype(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_drivetype(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_opts(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_lopts(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_base(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_plugin(LEX *lc, RES_ITEM *item, int index, int pass);
 static void setup_current_opts(void);
 
 /* Include and Exclude items */
 static void store_fname(LEX *lc, RES_ITEM2 *item, int index, int pass, bool exclude);
 static void store_plugin_name(LEX *lc, RES_ITEM2 *item, int index, int pass, bool exclude);
-static void options_res(LEX *lc, RES_ITEM2 *item, int index, int pass, bool exclude);
+static void store_options_res(LEX *lc, RES_ITEM2 *item, int index, int pass, bool exclude);
 static void store_excludedir(LEX *lc, RES_ITEM2 *item, int index, int pass, bool exclude);
 
 
@@ -71,190 +76,170 @@ static INCEXE res_incexe;
  * new Include/Exclude items
  *   name             handler     value    code flags default_value
  */
-static RES_ITEM2 newinc_items[] = {
-   {"file",            store_fname,       {0},      0, 0, 0},
-   {"plugin",          store_plugin_name, {0},      0, 0, 0},
-   {"excludedircontaining", store_excludedir,  {0}, 0, 0, 0},
-   {"options",         options_res,       {0},      0, 0, 0},
+RES_ITEM2 newinc_items[] = {
+   {"File",            store_fname,       {0},      0, 0, 0},
+   {"Plugin",          store_plugin_name, {0},      0, 0, 0},
+   {"ExcludeDirContaining", store_excludedir,  {0}, 0, 0, 0},
+   {"Options",         store_options_res,      {0},      0, 0, 0},
    {NULL, NULL, {0}, 0, 0, 0}
 };
 
 /*
  * Items that are valid in an Options resource
+ *
+ *   name             handler      value    code flags default_value
+ *
+ *  Encryption in FS_option_kw table ???
+ *  ReadFifo not in FS_option_kw table ???
+ *
  */
-static RES_ITEM options_items[] = {
-   {"compression",     store_opts,    {0},     0, 0, 0},
-   {"signature",       store_opts,    {0},     0, 0, 0},
-   {"basejob",         store_opts,    {0},     0, 0, 0},
-   {"accurate",        store_opts,    {0},     0, 0, 0},
-   {"verify",          store_opts,    {0},     0, 0, 0},
-   {"onefs",           store_opts,    {0},     0, 0, 0},
-   {"recurse",         store_opts,    {0},     0, 0, 0},
-   {"sparse",          store_opts,    {0},     0, 0, 0},
-   {"hardlinks",       store_opts,    {0},     0, 0, 0},
-   {"readfifo",        store_opts,    {0},     0, 0, 0},
-   {"replace",         store_opts,    {0},     0, 0, 0},
-   {"portable",        store_opts,    {0},     0, 0, 0},
-   {"mtimeonly",       store_opts,    {0},     0, 0, 0},
-   {"keepatime",       store_opts,    {0},     0, 0, 0},
-   {"regex",           store_regex,   {0},     0, 0, 0},
-   {"regexdir",        store_regex,   {0},     1, 0, 0},
-   {"regexfile",       store_regex,   {0},     2, 0, 0},
-   {"base",            store_base,    {0},     0, 0, 0},
-   {"wild",            store_wild,    {0},     0, 0, 0},
-   {"wilddir",         store_wild,    {0},     1, 0, 0},
-   {"wildfile",        store_wild,    {0},     2, 0, 0},
-   {"exclude",         store_opts,    {0},     0, 0, 0},
-   {"aclsupport",      store_opts,    {0},     0, 0, 0},
-   {"plugin",          store_plugin,  {0},     0, 0, 0},
-   {"ignorecase",      store_opts,    {0},     0, 0, 0},
-   {"fstype",          store_fstype,  {0},     0, 0, 0},
-   {"hfsplussupport",  store_opts,    {0},     0, 0, 0},
-   {"noatime",         store_opts,    {0},     0, 0, 0},
-   {"enhancedwild",    store_opts,    {0},     0, 0, 0},
-   {"drivetype",       store_drivetype, {0},   0, 0, 0},
-   {"checkfilechanges",store_opts,    {0},     0, 0, 1},
-   {"strippath",       store_opts,    {0},     0, 0, 0},
-   {"honornodumpflag", store_opts,    {0},     0, 0, 0},
-   {"xattrsupport",    store_opts,    {0},     0, 0, 0},
+RES_ITEM options_items[] = {
+   {"Compression",     store_opts,    {0},   0, INC_KW_COMPRESSION,  0},
+   {"Signature",       store_opts,    {0},   0, INC_KW_DIGEST,       0},
+   {"OneFs",           store_opts,    {0},   0, INC_KW_ONEFS,        0},
+   {"Recurse",         store_opts,    {0},   0, INC_KW_RECURSE,      0},
+   {"Sparse",          store_opts,    {0},   0, INC_KW_SPARSE,       0},
+   {"HardLinks",       store_opts,    {0},   0, INC_KW_HARDLINK,     0},
+   {"Replace",         store_opts,    {0},   0, INC_KW_REPLACE,      0},
+   {"Portable",        store_opts,    {0},   0, INC_KW_PORTABLE,     0},
+   {"MtimeOnly",       store_opts,    {0},   0, INC_KW_MTIMEONLY,    0},
+   {"KeepAtime",       store_opts,    {0},   0, INC_KW_KEEPATIME,    0},
+   {"Exclude",         store_opts,    {0},   0, INC_KW_EXCLUDE,      0},
+   {"AclSupport",      store_opts,    {0},   0, INC_KW_ACL,          0},
+   {"IgnoreCase",      store_opts,    {0},   0, INC_KW_IGNORECASE,   0},
+   {"HfsPlusSupport",  store_opts,    {0},   0, INC_KW_HFSPLUS,      0},
+   {"NoAtime",         store_opts,    {0},   0, INC_KW_NOATIME,      0},
+   {"EnhancedWild",    store_opts,    {0},   0, INC_KW_ENHANCEDWILD, 0},
+   {"CheckFileChanges",store_opts,    {0},   0, INC_KW_CHKCHANGES,   1},
+   {"HonorNoDumpFlag", store_opts,    {0},   0, INC_KW_HONOR_NODUMP, 0},
+   {"XattrSupport",    store_opts,    {0},   0, INC_KW_XATTR,        0},
+   {"ReadFifo",        store_opts,    {0},   0, INC_KW_READFIFO,     0},
+   {"BaseJob",         store_lopts,   {0}, 'J', INC_KW_BASEJOB,      0},
+   {"Accurate",        store_lopts,   {0}, 'C', INC_KW_ACCURATE,     0},
+   {"Verify",          store_lopts,   {0}, 'V', INC_KW_VERIFY,       0},
+   {"StripPath",       store_lopts,   {0}, 'P', INC_KW_STRIPPATH,    0},
+   {"Regex",           store_regex,   {0},   0, 0, 0},
+   {"RegexDir",        store_regex,   {0},   1, 0, 0},
+   {"RegexFile",       store_regex,   {0},   2, 0, 0},
+   {"Base",            store_base,    {0},   0, 0, 0},
+   {"Wild",            store_wild,    {0},   0, 0, 0},
+   {"WildDir",         store_wild,    {0},   1, 0, 0},
+   {"WildFile",        store_wild,    {0},   2, 0, 0},
+   {"Plugin",          store_plugin,  {0},   0, 0, 0},
+   {"FsType",          store_fstype,  {0},   0, 0, 0},
+   {"DriveType",       store_drivetype, {0}, 0, 0, 0},
    {NULL, NULL, {0}, 0, 0, 0}
 };
 
-
-/* Define FileSet KeyWord values */
-enum {
-   INC_KW_NONE,
-   INC_KW_COMPRESSION,
-   INC_KW_DIGEST,
-   INC_KW_ENCRYPTION,
-   INC_KW_VERIFY,
-   INC_KW_BASEJOB,
-   INC_KW_ACCURATE,
-   INC_KW_ONEFS,
-   INC_KW_RECURSE,
-   INC_KW_SPARSE,
-   INC_KW_HARDLINK,
-   INC_KW_REPLACE,               /* restore options */
-   INC_KW_READFIFO,              /* Causes fifo data to be read */
-   INC_KW_PORTABLE,
-   INC_KW_MTIMEONLY,
-   INC_KW_KEEPATIME,
-   INC_KW_EXCLUDE,
-   INC_KW_ACL,
-   INC_KW_IGNORECASE,
-   INC_KW_HFSPLUS,
-   INC_KW_NOATIME,
-   INC_KW_ENHANCEDWILD,
-   INC_KW_CHKCHANGES,
-   INC_KW_STRIPPATH,
-   INC_KW_HONOR_NODUMP,
-   INC_KW_XATTR
-};
-
 /*
  * This is the list of options that can be stored by store_opts
  *   Note, now that the old style Include/Exclude code is gone,
  *   the INC_KW code could be put into the "code" field of the
  *   options given above.
+ *
+ *    name            token
  */
-static struct s_kw FS_option_kw[] = {
-   {"compression", INC_KW_COMPRESSION},
-   {"signature",   INC_KW_DIGEST},
-   {"encryption",  INC_KW_ENCRYPTION},
-   {"verify",      INC_KW_VERIFY},
-   {"basejob",     INC_KW_BASEJOB},
-   {"accurate",    INC_KW_ACCURATE},
-   {"onefs",       INC_KW_ONEFS},
-   {"recurse",     INC_KW_RECURSE},
-   {"sparse",      INC_KW_SPARSE},
-   {"hardlinks",   INC_KW_HARDLINK},
-   {"replace",     INC_KW_REPLACE},
-   {"readfifo",    INC_KW_READFIFO},
-   {"portable",    INC_KW_PORTABLE},
-   {"mtimeonly",   INC_KW_MTIMEONLY},
-   {"keepatime",   INC_KW_KEEPATIME},
-   {"exclude",     INC_KW_EXCLUDE},
-   {"aclsupport",  INC_KW_ACL},
-   {"ignorecase",  INC_KW_IGNORECASE},
-   {"hfsplussupport", INC_KW_HFSPLUS},
-   {"noatime",     INC_KW_NOATIME},
-   {"enhancedwild", INC_KW_ENHANCEDWILD},
-   {"checkfilechanges", INC_KW_CHKCHANGES},
-   {"strippath",   INC_KW_STRIPPATH},
-   {"honornodumpflag", INC_KW_HONOR_NODUMP},
-   {"xattrsupport", INC_KW_XATTR},
+s_kw FS_option_kw[] = {
+   {"Compression", INC_KW_COMPRESSION},
+   {"Signature",   INC_KW_DIGEST},
+   {"Encryption",  INC_KW_ENCRYPTION},
+   {"Verify",      INC_KW_VERIFY},
+   {"BaseJob",     INC_KW_BASEJOB},
+   {"Accurate",    INC_KW_ACCURATE},
+   {"OneFs",       INC_KW_ONEFS},
+   {"Recurse",     INC_KW_RECURSE},
+   {"Sparse",      INC_KW_SPARSE},
+   {"HardLinks",   INC_KW_HARDLINK},
+   {"Replace",     INC_KW_REPLACE},
+   {"ReadFifo",    INC_KW_READFIFO},
+   {"Portable",    INC_KW_PORTABLE},
+   {"MtimeOnly",   INC_KW_MTIMEONLY},
+   {"KeepAtime",   INC_KW_KEEPATIME},
+   {"Exclude",     INC_KW_EXCLUDE},
+   {"AclSupport",  INC_KW_ACL},
+   {"IgnoreCase",  INC_KW_IGNORECASE},
+   {"HfsPlusSupport", INC_KW_HFSPLUS},
+   {"NoAtime",     INC_KW_NOATIME},
+   {"EnhancedWild", INC_KW_ENHANCEDWILD},
+   {"CheckFileChanges", INC_KW_CHKCHANGES},
+   {"StripPath",   INC_KW_STRIPPATH},
+   {"HonorNoDumpFlag", INC_KW_HONOR_NODUMP},
+   {"XattrSupport", INC_KW_XATTR},
    {NULL,          0}
 };
 
-/* Options for FileSet keywords */
-
-struct s_fs_opt {
-   const char *name;
-   int keyword;
-   const char *option;
-};
-
 /*
  * Options permitted for each keyword and resulting value.
  * The output goes into opts, which are then transmitted to
  * the FD for application as options to the following list of
  * included files.
+ *
+ * Note! all 0's in options must come after the value that
+ *       is non-zero.
+ *
+ * NOTE!!  The following long options (see scan_include_options())
+ *   V = Verify
+ *   C = Accurate
+ *   J = BaseJob
+ *   P = StripPath
+ *
+ *   name       keyword             option
  */
-static struct s_fs_opt FS_options[] = {
-   {"md5",      INC_KW_DIGEST,        "M"},
-   {"sha1",     INC_KW_DIGEST,        "S"},
-   {"sha256",   INC_KW_DIGEST,       "S2"},
-   {"sha512",   INC_KW_DIGEST,       "S3"},
-   {"gzip",     INC_KW_COMPRESSION,  "Z6"},
-   {"gzip1",    INC_KW_COMPRESSION,  "Z1"},
-   {"gzip2",    INC_KW_COMPRESSION,  "Z2"},
-   {"gzip3",    INC_KW_COMPRESSION,  "Z3"},
-   {"gzip4",    INC_KW_COMPRESSION,  "Z4"},
-   {"gzip5",    INC_KW_COMPRESSION,  "Z5"},
-   {"gzip6",    INC_KW_COMPRESSION,  "Z6"},
-   {"gzip7",    INC_KW_COMPRESSION,  "Z7"},
-   {"gzip8",    INC_KW_COMPRESSION,  "Z8"},
-   {"gzip9",    INC_KW_COMPRESSION,  "Z9"},
-   {"lzo",      INC_KW_COMPRESSION,  "Zo"},
+struct s_fs_opt FS_options[] = {
+   {"Md5",      INC_KW_DIGEST,        "M"},
+   {"Sha1",     INC_KW_DIGEST,        "S"},
+   {"Sha256",   INC_KW_DIGEST,       "S2"},
+   {"Sha512",   INC_KW_DIGEST,       "S3"},
+   {"Gzip",     INC_KW_COMPRESSION,  "Z6"},
+   {"Gzip1",    INC_KW_COMPRESSION,  "Z1"},
+   {"Gzip2",    INC_KW_COMPRESSION,  "Z2"},
+   {"Gzip3",    INC_KW_COMPRESSION,  "Z3"},
+   {"Gzip4",    INC_KW_COMPRESSION,  "Z4"},
+   {"Gzip5",    INC_KW_COMPRESSION,  "Z5"},
+   {"Gzip6",    INC_KW_COMPRESSION,  "Z6"},
+   {"Gzip7",    INC_KW_COMPRESSION,  "Z7"},
+   {"Gzip8",    INC_KW_COMPRESSION,  "Z8"},
+   {"Gzip9",    INC_KW_COMPRESSION,  "Z9"},
+   {"Lzo",      INC_KW_COMPRESSION,  "Zo"},
    {"blowfish", INC_KW_ENCRYPTION,    "B"},   /* ***FIXME*** not implemented */
    {"3des",     INC_KW_ENCRYPTION,    "3"},   /* ***FIXME*** not implemented */
-   {"yes",      INC_KW_ONEFS,         "0"},
-   {"no",       INC_KW_ONEFS,         "f"},
-   {"yes",      INC_KW_RECURSE,       "0"},
-   {"no",       INC_KW_RECURSE,       "h"},
-   {"yes",      INC_KW_SPARSE,        "s"},
-   {"no",       INC_KW_SPARSE,        "0"},
-   {"yes",      INC_KW_HARDLINK,      "0"},
-   {"no",       INC_KW_HARDLINK,      "H"},
-   {"always",   INC_KW_REPLACE,       "a"},
-   {"ifnewer",  INC_KW_REPLACE,       "w"},
-   {"never",    INC_KW_REPLACE,       "n"},
-   {"yes",      INC_KW_READFIFO,      "r"},
-   {"no",       INC_KW_READFIFO,      "0"},
-   {"yes",      INC_KW_PORTABLE,      "p"},
-   {"no",       INC_KW_PORTABLE,      "0"},
-   {"yes",      INC_KW_MTIMEONLY,     "m"},
-   {"no",       INC_KW_MTIMEONLY,     "0"},
-   {"yes",      INC_KW_KEEPATIME,     "k"},
-   {"no",       INC_KW_KEEPATIME,     "0"},
-   {"yes",      INC_KW_EXCLUDE,       "e"},
-   {"no",       INC_KW_EXCLUDE,       "0"},
-   {"yes",      INC_KW_ACL,           "A"},
-   {"no",       INC_KW_ACL,           "0"},
-   {"yes",      INC_KW_IGNORECASE,    "i"},
-   {"no",       INC_KW_IGNORECASE,    "0"},
-   {"yes",      INC_KW_HFSPLUS,       "R"},   /* "R" for resource fork */
-   {"no",       INC_KW_HFSPLUS,       "0"},
-   {"yes",      INC_KW_NOATIME,       "K"},
-   {"no",       INC_KW_NOATIME,       "0"},
-   {"yes",      INC_KW_ENHANCEDWILD,  "K"},
-   {"no",       INC_KW_ENHANCEDWILD,  "0"},
-   {"yes",      INC_KW_CHKCHANGES,    "c"},
-   {"no",       INC_KW_CHKCHANGES,    "0"},
-   {"yes",      INC_KW_HONOR_NODUMP,  "N"},
-   {"no",       INC_KW_HONOR_NODUMP,  "0"},
-   {"yes",      INC_KW_XATTR,         "X"},
-   {"no",       INC_KW_XATTR,         "0"},
+   {"No",       INC_KW_ONEFS,         "f"},
+   {"Yes",      INC_KW_ONEFS,         "0"},
+   {"No",       INC_KW_RECURSE,       "h"},
+   {"Yes",      INC_KW_RECURSE,       "0"},
+   {"Yes",      INC_KW_SPARSE,        "s"},
+   {"No",       INC_KW_SPARSE,        "0"},
+   {"No",       INC_KW_HARDLINK,      "H"},
+   {"Yes",      INC_KW_HARDLINK,      "0"},
+   {"Always",   INC_KW_REPLACE,       "a"},
+   {"IfNewer",  INC_KW_REPLACE,       "w"},
+   {"Never",    INC_KW_REPLACE,       "n"},
+   {"Yes",      INC_KW_READFIFO,      "r"},
+   {"No",       INC_KW_READFIFO,      "0"},
+   {"Yes",      INC_KW_PORTABLE,      "p"},
+   {"No",       INC_KW_PORTABLE,      "0"},
+   {"Yes",      INC_KW_MTIMEONLY,     "m"},
+   {"No",       INC_KW_MTIMEONLY,     "0"},
+   {"Yes",      INC_KW_KEEPATIME,     "k"},
+   {"No",       INC_KW_KEEPATIME,     "0"},
+   {"Yes",      INC_KW_EXCLUDE,       "e"},
+   {"No",       INC_KW_EXCLUDE,       "0"},
+   {"Yes",      INC_KW_ACL,           "A"},
+   {"No",       INC_KW_ACL,           "0"},
+   {"Yes",      INC_KW_IGNORECASE,    "i"},
+   {"No",       INC_KW_IGNORECASE,    "0"},
+   {"Yes",      INC_KW_HFSPLUS,       "R"},   /* "R" for resource fork */
+   {"No",       INC_KW_HFSPLUS,       "0"},
+   {"Yes",      INC_KW_NOATIME,       "K"},
+   {"No",       INC_KW_NOATIME,       "0"},
+   {"Yes",      INC_KW_ENHANCEDWILD,  "K"},
+   {"No",       INC_KW_ENHANCEDWILD,  "0"},
+   {"Yes",      INC_KW_CHKCHANGES,    "c"},
+   {"No",       INC_KW_CHKCHANGES,    "0"},
+   {"Yes",      INC_KW_HONOR_NODUMP,  "N"},
+   {"No",       INC_KW_HONOR_NODUMP,  "0"},
+   {"Yes",      INC_KW_XATTR,         "X"},
+   {"No",       INC_KW_XATTR,         "0"},
    {NULL,       0,                      0}
 };
 
@@ -262,9 +247,12 @@ static struct s_fs_opt FS_options[] = {
 
 /*
  * Scan for right hand side of Include options (keyword=option) is
- *    converted into one or two characters. Verifyopts=xxxx is Vxxxx:
+ *    converted into one or two characters. Verify=xxxx is Vxxxx:
  *    Whatever is found is concatenated to the opts string.
  * This code is also used inside an Options resource.
+ *
+ * This function returns true for a long option (terminates with :)
+ *   and false for a normal 1 or 2 character option.
  */
 static void scan_include_options(LEX *lc, int keyword, char *opts, int optlen)
 {
@@ -276,20 +264,20 @@ static void scan_include_options(LEX *lc, int keyword, char *opts, int optlen)
    option[2] = 0;                     /* terminate options */
    lc->options |= LOPT_STRING;        /* force string */
    lex_get_token(lc, T_STRING);       /* expect at least one option */
+   /*
+    * ***FIXME**** ensure these are in permitted set
+    */
    if (keyword == INC_KW_VERIFY) { /* special case */
-      /* ***FIXME**** ensure these are in permitted set */
       bstrncat(opts, "V", optlen);         /* indicate Verify */
       bstrncat(opts, lc->str, optlen);
       bstrncat(opts, ":", optlen);         /* terminate it */
       Dmsg3(900, "Catopts=%s option=%s optlen=%d\n", opts, option,optlen);
    } else if (keyword == INC_KW_ACCURATE) { /* special case */
-      /* ***FIXME**** ensure these are in permitted set */
       bstrncat(opts, "C", optlen);         /* indicate Accurate */
       bstrncat(opts, lc->str, optlen);
       bstrncat(opts, ":", optlen);         /* terminate it */
       Dmsg3(900, "Catopts=%s option=%s optlen=%d\n", opts, option,optlen);
    } else if (keyword == INC_KW_BASEJOB) { /* special case */
-      /* ***FIXME**** ensure these are in permitted set */
       bstrncat(opts, "J", optlen);         /* indicate BaseJob */
       bstrncat(opts, lc->str, optlen);
       bstrncat(opts, ":", optlen);         /* terminate it */
@@ -428,7 +416,7 @@ static void store_newinc(LEX *lc, RES_ITEM *item, int index, int pass)
 
 
 /* Store regex info */
-static void store_regex(LEX *lc, RES_ITEM *item, int index, int pass)
+void store_regex(LEX *lc, RES_ITEM *item, int index, int pass)
 {
    int token, rc;
    regex_t preg;
@@ -476,7 +464,7 @@ static void store_regex(LEX *lc, RES_ITEM *item, int index, int pass)
 }
 
 /* Store Base info */
-static void store_base(LEX *lc, RES_ITEM *item, int index, int pass)
+void store_base(LEX *lc, RES_ITEM *item, int index, int pass)
 {
 
    lex_get_token(lc, T_NAME);
@@ -490,7 +478,7 @@ static void store_base(LEX *lc, RES_ITEM *item, int index, int pass)
 }
 
 /* Store reader info */
-static void store_plugin(LEX *lc, RES_ITEM *item, int index, int pass)
+void store_plugin(LEX *lc, RES_ITEM *item, int index, int pass)
 {
 
    lex_get_token(lc, T_NAME);
@@ -505,7 +493,7 @@ static void store_plugin(LEX *lc, RES_ITEM *item, int index, int pass)
 
 
 /* Store Wild-card info */
-static void store_wild(LEX *lc, RES_ITEM *item, int index, int pass)
+void store_wild(LEX *lc, RES_ITEM *item, int index, int pass)
 {
    int token;
    const char *type;
@@ -550,23 +538,24 @@ static void store_wild(LEX *lc, RES_ITEM *item, int index, int pass)
 }
 
 /* Store fstype info */
-static void store_fstype(LEX *lc, RES_ITEM *item, int index, int pass)
+void store_fstype(LEX *lc, RES_ITEM *item, int index, int pass)
 {
    int token;
-
-   token = lex_get_token(lc, T_SKIP_EOL);
    if (pass == 1) {
-      /* Pickup fstype string */
-      switch (token) {
-      case T_IDENTIFIER:
-      case T_UNQUOTED_STRING:
-      case T_QUOTED_STRING:
+      for (;;) {
+         token = lex_get_token(lc, T_STRING);   /* scan next item */
+         if (token == T_ERROR) {
+            break;
+         }
          res_incexe.current_opts->fstype.append(bstrdup(lc->str));
+
          Dmsg3(900, "set fstype %p size=%d %s\n",
-            res_incexe.current_opts, res_incexe.current_opts->fstype.size(), lc->str);
-         break;
-      default:
-         scan_err1(lc, _("Expected an fstype string, got: %s\n"), lc->str);
+            res_incexe.current_opts, res_incexe.current_opts->fstype.size(),lc->str);
+
+         if (lc->ch != ',') {         /* if no other item follows */
+            break;                    /* get out */
+         }
+         lex_get_token(lc, T_ALL);    /* eat comma */
       }
    }
    scan_to_eol(lc);
@@ -588,23 +577,22 @@ static void store_excludedir(LEX *lc, RES_ITEM2 *item, int index, int pass, bool
 }
 
 /* Store drivetype info */
-static void store_drivetype(LEX *lc, RES_ITEM *item, int index, int pass)
+void store_drivetype(LEX *lc, RES_ITEM *item, int index, int pass)
 {
    int token;
-
-   token = lex_get_token(lc, T_SKIP_EOL);
    if (pass == 1) {
-      /* Pickup drivetype string */
-      switch (token) {
-      case T_IDENTIFIER:
-      case T_UNQUOTED_STRING:
-      case T_QUOTED_STRING:
+      for (;;) {
+         token = lex_get_token(lc, T_STRING);   /* scan next item */
+         if (token == T_ERROR) {
+            break;
+         }
          res_incexe.current_opts->drivetype.append(bstrdup(lc->str));
          Dmsg3(900, "set drivetype %p size=%d %s\n",
-            res_incexe.current_opts, res_incexe.current_opts->drivetype.size(), lc->str);
-         break;
-      default:
-         scan_err1(lc, _("Expected an drivetype string, got: %s\n"), lc->str);
+            res_incexe.current_opts, res_incexe.current_opts->drivetype.size(),lc->str);
+         if (lc->ch != ',') {         /* if no other item follows */
+            break;                    /* get out */
+         }
+         lex_get_token(lc, T_ALL);    /* eat comma */
       }
    }
    scan_to_eol(lc);
@@ -698,7 +686,7 @@ static void store_plugin_name(LEX *lc, RES_ITEM2 *item, int index, int pass, boo
 /*
  * Come here when Options seen in Include/Exclude
  */
-static void options_res(LEX *lc, RES_ITEM2 *item, int index, int pass, bool exclude)
+static void store_options_res(LEX *lc, RES_ITEM2 *item, int index, int pass, bool exclude)
 {
    int token, i;
 
@@ -743,11 +731,18 @@ static void options_res(LEX *lc, RES_ITEM2 *item, int index, int pass, bool excl
    }
 }
 
+/*
+ * Different subroutine, but uses store_opts
+ */
+void store_lopts(LEX *lc, RES_ITEM *item, int index, int pass)
+{
+   store_opts(lc, item, index, pass);
+}
 
 /*
  * New style options come here
  */
-static void store_opts(LEX *lc, RES_ITEM *item, int index, int pass)
+void store_opts(LEX *lc, RES_ITEM *item, int index, int pass)
 {
    int i;
    int keyword;
@@ -772,10 +767,12 @@ static void store_opts(LEX *lc, RES_ITEM *item, int index, int pass)
       Dmsg2(900, "new pass=%d incexe opts=%s\n", pass, res_incexe.current_opts->opts);
    }
    scan_to_eol(lc);
+   set_bit(keyword, res_incexe.opt_present);
 }
 
 
 
+
 /* If current_opts not defined, create first entry */
 static void setup_current_opts(void)
 {
diff --git a/src/dird/job.c b/src/dird/job.c
index 08c9fee..20b0905 100644
--- a/src/dird/job.c
+++ b/src/dird/job.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -113,19 +117,21 @@ bool setup_job(JCR *jcr)
     */
    Dmsg0(100, "Open database\n");
    jcr->db = db_init_database(jcr, jcr->catalog->db_driver, jcr->catalog->db_name,
-                              jcr->catalog->db_user, jcr->catalog->db_password,
-                              jcr->catalog->db_address, jcr->catalog->db_port,
-                              jcr->catalog->db_socket, jcr->catalog->mult_db_connections,
-                              jcr->catalog->disable_batch_insert);
+                jcr->catalog->db_user, jcr->catalog->db_password,
+                jcr->catalog->db_address, jcr->catalog->db_port,
+                jcr->catalog->db_socket, jcr->catalog->mult_db_connections,
+                jcr->catalog->disable_batch_insert);
    if (!jcr->db || !db_open_database(jcr, jcr->db)) {
       Jmsg(jcr, M_FATAL, 0, _("Could not open database \"%s\".\n"),
                  jcr->catalog->db_name);
       if (jcr->db) {
          Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db));
          db_close_database(jcr, jcr->db);
+         jcr->db = NULL;
       }
       goto bail_out;
    }
+
    Dmsg0(150, "DB opened\n");
    if (!jcr->fname) {
       jcr->fname = get_pool_memory(PM_FNAME);
@@ -232,6 +238,144 @@ bail_out:
    return false;
 }
 
+/*
+ * Setup a job for a resume command
+ */
+static bool setup_resume_job(JCR *jcr, JOB_DBR *jr)
+{
+   int errstat;
+   jcr->lock();
+   Dsm_check(100);
+   init_msg(jcr, jcr->messages);
+
+   /* Initialize termination condition variable */
+   if ((errstat = pthread_cond_init(&jcr->term_wait, NULL)) != 0) {
+      berrno be;
+      Jmsg1(jcr, M_FATAL, 0, _("Unable to init job cond variable: ERR=%s\n"), be.bstrerror(errstat));
+      jcr->unlock();
+      goto bail_out;
+   }
+   jcr->term_wait_inited = true;
+
+   jcr->setJobStatus(JS_Created);
+   jcr->unlock();
+
+   /*
+    * Open database
+    */
+   Dmsg0(100, "Open database\n");
+   jcr->db = db_init_database(jcr, jcr->catalog->db_driver, jcr->catalog->db_name,
+                              jcr->catalog->db_user, jcr->catalog->db_password,
+                              jcr->catalog->db_address, jcr->catalog->db_port,
+                              jcr->catalog->db_socket, jcr->catalog->mult_db_connections,
+                              jcr->catalog->disable_batch_insert);
+   if (!jcr->db || !db_open_database(jcr, jcr->db)) {
+      Jmsg(jcr, M_FATAL, 0, _("Could not open database \"%s\".\n"),
+                 jcr->catalog->db_name);
+      if (jcr->db) {
+         Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db));
+         db_close_database(jcr, jcr->db);
+         jcr->db = NULL;
+      }
+      goto bail_out;
+   }
+   Dmsg0(100, "DB opened\n");
+   if (!jcr->fname) {
+      jcr->fname = get_pool_memory(PM_FNAME);
+   }
+   if (!jcr->pool_source) {
+      jcr->pool_source = get_pool_memory(PM_MESSAGE);
+      pm_strcpy(jcr->pool_source, _("unknown source"));
+   }
+   if (!jcr->next_pool_source) {
+      jcr->next_pool_source = get_pool_memory(PM_MESSAGE);
+      pm_strcpy(jcr->next_pool_source, _("unknown source"));
+   }
+
+
+   /*
+    * Setup Job record.  Make sure original job is Incomplete.
+    */
+   memcpy(&jcr->jr, jr, sizeof(JOB_DBR));
+   jcr->sched_time = jcr->jr.SchedTime;
+   jcr->start_time = jcr->jr.StartTime;
+   jcr->jr.EndTime = 0;               /* perhaps rescheduled, clear it */
+   jcr->setJobType(jcr->jr.JobType);
+   jcr->setJobLevel(jcr->jr.JobLevel);
+   jcr->JobId = jcr->jr.JobId;
+   if (!get_or_create_client_record(jcr)) {
+      Dmsg0(100, "Could not create client record.\n");
+      goto bail_out;
+   }
+
+   Dmsg6(100, "Got job record JobId=%d Job=%s Name=%s Type=%c Level=%c Status=%c\n",
+       jcr->jr.JobId, jcr->jr.Job, jcr->jr.Name, jcr->jr.JobType, jcr->jr.JobLevel,
+       jcr->jr.JobStatus);
+   if (jcr->jr.JobStatus != JS_Incomplete) {
+      /* ***FIXME*** add error message */
+      Dmsg1(100, "Job is not an Incomplete: status=%c\n", jcr->jr.JobStatus);
+      goto bail_out;
+   }
+   bstrncpy(jcr->Job, jcr->jr.Job, sizeof(jcr->Job));
+   jcr->setJobType(jcr->jr.JobType);
+   jcr->setJobLevel(jcr->jr.JobLevel);
+
+   generate_daemon_event(jcr, "JobStart");
+   new_plugins(jcr);                  /* instantiate plugins for this jcr */
+   generate_plugin_event(jcr, bDirEventJobStart);
+
+   if (job_canceled(jcr)) {
+      Dmsg0(100, "Oops. Job canceled\n");
+      goto bail_out;
+   }
+
+   /* Re-run the old job */
+   jcr->rerunning = true;
+
+   /*
+    * Now, do pre-run stuff, like setting job level (Inc/diff, ...)
+    *  this allows us to setup a proper job start record for restarting
+    *  in case of later errors.
+    */
+   switch (jcr->getJobType()) {
+   case JT_BACKUP:
+      if (!do_backup_init(jcr)) {
+         backup_cleanup(jcr, JS_ErrorTerminated);
+         goto bail_out;
+      }
+      break;
+   default:
+      Pmsg1(0, _("Unimplemented job type: %d\n"), jcr->getJobType());
+      jcr->setJobStatus(JS_ErrorTerminated);
+      goto bail_out;
+   }
+
+   generate_plugin_event(jcr, bDirEventJobInit);
+   Dsm_check(100);
+   return true;
+
+bail_out:
+   return false;
+}
+
+JobId_t resume_job(JCR *jcr, JOB_DBR *jr)
+{
+   int stat;
+   if (setup_resume_job(jcr, jr)) {
+      Dmsg0(200, "Add jrc to work queue\n");
+      /* Queue the job to be run */
+      if ((stat = jobq_add(&job_queue, jcr)) != 0) {
+         berrno be;
+         Jmsg(jcr, M_FATAL, 0, _("Could not add job queue: ERR=%s\n"), be.bstrerror(stat));
+         return 0;
+      }
+      return jcr->JobId;
+   }
+   return 0;
+}
+
+
+
 void update_job_end(JCR *jcr, int TermCode)
 {
    dequeue_messages(jcr);             /* display any queued messages */
@@ -367,18 +511,23 @@ void sd_msg_thread_send_signal(JCR *jcr, int sig)
    jcr->unlock();
 }
 
-static int cancel_file_daemon_job(UAContext *ua, const char *cmd, JCR *jcr)
+static bool cancel_file_daemon_job(UAContext *ua, const char *cmd, JCR *jcr)
 {
+   CLIENT *old_client;
+
    if (!jcr->client) {
       Dmsg0(100, "No client to cancel\n");
-      return 0;
+      return false;
    }
+   old_client = ua->jcr->client;
    ua->jcr->client = jcr->client;
    if (!connect_to_file_daemon(ua->jcr, 10, FDConnectTimeout, 1)) {
       ua->error_msg(_("Failed to connect to File daemon.\n"));
-      return 0;
+      ua->jcr->client = old_client;
+      return false;
    }
-   Dmsg0(100, "Connected to file daemon\n");
+   Dmsg3(10, "Connected to file daemon %s for cancel ua.jcr=%p jcr=%p\n",
+         ua->jcr->client->name(), ua->jcr, jcr);
    BSOCK *fd = ua->jcr->file_bsock;
    fd->fsend("%s Job=%s\n", cmd, jcr->Job);
    while (fd->recv() >= 0) {
@@ -386,8 +535,8 @@ static int cancel_file_daemon_job(UAContext *ua, const char *cmd, JCR *jcr)
    }
    fd->signal(BNET_TERMINATE);
    free_bsock(ua->jcr->file_bsock);
-   ua->jcr->client = NULL;
-   return 1;
+   ua->jcr->client = old_client;
+   return true;
 }
 
 static bool cancel_sd_job(UAContext *ua, const char *cmd, JCR *jcr)
@@ -417,7 +566,10 @@ static bool cancel_sd_job(UAContext *ua, const char *cmd, JCR *jcr)
       ua->error_msg(_("Failed to connect to Storage daemon.\n"));
       return false;
    }
-   Dmsg0(200, "Connected to storage daemon\n");
+
+   Dmsg3(10, "Connected to storage daemon %s for cancel ua.jcr=%p jcr=%p\n",
+         ua->jcr->wstore->name(), ua->jcr, jcr);
+
    BSOCK *sd = ua->jcr->store_bsock;
    sd->fsend("%s Job=%s\n", cmd, jcr->Job);
    while (sd->recv() >= 0) {
@@ -439,13 +591,14 @@ static int cancel_inactive_job(UAContext *ua, JCR *jcr)
    USTORE     store;
    CLIENT     *client;
 
+   Dmsg2(10, "cancel_inactive_job ua.jcr=%p jcr=%p\n", ua->jcr, jcr);
+
    if (!jcr->client) {
       memset(&cr, 0, sizeof(cr));
 
       /* User is kind enough to provide the client name */
       if ((i = find_arg_with_value(ua, "client")) > 0) {
          bstrncpy(cr.Name, ua->argv[i], sizeof(cr.Name));
-
       } else {
          memset(&jr, 0, sizeof(jr));
          bstrncpy(jr.Job, jcr->Job, sizeof(jr.Job));
@@ -500,15 +653,16 @@ bail_out:
  *  Returns: true  if cancel appears to be successful
  *           false on failure. Message sent to ua->jcr.
  */
-bool cancel_job(UAContext *ua, JCR *jcr, bool cancel)
+bool
+cancel_job(UAContext *ua, JCR *jcr, bool cancel)
 {
    char ed1[50];
    int32_t old_status = jcr->JobStatus;
    int status;
    const char *reason, *cmd;
    bool force = find_arg(ua, "inactive") > 0;
-   JCR *wjcr = jcr->wjcr;
 
+   Dmsg3(10, "cancel_job jcr=%p jobid=%d use_count\n", jcr, jcr->JobId, jcr->use_count());
 
    /* If the user explicitely ask, we can send the cancel command to
     * the FD.
@@ -517,9 +671,16 @@ bool cancel_job(UAContext *ua, JCR *jcr, bool cancel)
       return cancel_inactive_job(ua, jcr);
    }
 
-   status = JS_Canceled;
-   reason = _("canceled");
-   cmd = NT_("cancel");
+   if (cancel) {
+      status = JS_Canceled;
+      reason = _("canceled");
+      cmd = NT_("cancel");
+   } else {
+      status = JS_Incomplete;
+      reason = _("stopped");
+      cmd = NT_("stop");
+      jcr->RescheduleIncompleteJobs = false; /* do not restart */
+   }
 
    jcr->setJobStatus(status);
 
@@ -571,10 +732,14 @@ bool cancel_job(UAContext *ua, JCR *jcr, bool cancel)
       }
 
       /* Cancel Copy/Migration Storage daemon */
-      if (wjcr  && wjcr->store_bsock) {
-         /* do not return now, we want to try to cancel the sd socket */
-         cancel_sd_job(ua, cmd, wjcr);
+      if (jcr->wjcr) {
+         /* The wjcr is valid until we call free_jcr(jcr) */
+         JCR *wjcr = jcr->wjcr;
 
+         if (wjcr->store_bsock) {
+            /* do not return now, we want to try to cancel the sd socket */
+            cancel_sd_job(ua, cmd, wjcr);
+         }
          /* We test file_bsock because the previous operation can take
           * several minutes
           */
@@ -799,7 +964,7 @@ DBId_t get_or_create_pool_record(JCR *jcr, char *pool_name)
    while (!db_get_pool_record(jcr, jcr->db, &pr)) { /* get by Name */
       /* Try to create the pool */
       if (create_pool(jcr, jcr->db, jcr->pool, POOL_OP_CREATE) < 0) {
-         Jmsg(jcr, M_FATAL, 0, _("Pool \"%s\" not in database. ERR=%s"), pr.Name,
+         Jmsg(jcr, M_FATAL, 0, _("Cannot create pool \"%s\" in database. ERR=%s"), pr.Name,
             db_strerror(jcr->db));
          return 0;
       } else {
@@ -818,19 +983,13 @@ bool allow_duplicate_job(JCR *jcr)
 {
    JOB *job = jcr->job;
    JCR *djcr;                /* possible duplicate job */
-   bool cancel_dup = false;
-   bool cancel_me = false;
 
-   /*
-    * See if AllowDuplicateJobs is set or
-    * if duplicate checking is disabled for this job.
-    */
+   /* Is AllowDuplicateJobs is set or is duplicate checking 
+    *  disabled for this job? */
    if (job->AllowDuplicateJobs || jcr->IgnoreDuplicateJobChecking) {
       return true;
    }
-
    Dmsg0(800, "Enter allow_duplicate_job\n");
-
    /*
     * After this point, we do not want to allow any duplicate
     * job to run.
@@ -840,16 +999,14 @@ bool allow_duplicate_job(JCR *jcr)
       if (jcr == djcr || djcr->JobId == 0) {
          continue;                   /* do not cancel this job or consoles */
       }
-
-      /*
-       * See if this Job has the IgnoreDuplicateJobChecking flag set, ignore it
-       * for any checking against other jobs.
-       */
+      /* Does Job has the IgnoreDuplicateJobChecking flag set,
+       * if so do not check it against other jobs */
       if (djcr->IgnoreDuplicateJobChecking) {
-         continue;
-      }
-
+         continue; 
+      } 
       if (strcmp(job->name(), djcr->job->name()) == 0) {
+         bool cancel_dup = false;
+         bool cancel_me = false;
          if (job->DuplicateJobProximity > 0) {
             utime_t now = (utime_t)time(NULL);
             if ((now - djcr->start_time) > job->DuplicateJobProximity) {
@@ -889,12 +1046,9 @@ bool allow_duplicate_job(JCR *jcr)
                  djcr->JobId);
               break;     /* get out of foreach_jcr */
             }
-         }
-
-         /*
-          * Cancel one of the two jobs (me or dup)
-          * If CancelQueuedDuplicates is set do so only if job is queued.
-          */
+         } 
+         /* Cancel one of the two jobs (me or dup) */
+         /* If CancelQueuedDuplicates is set do so only if job is queued */
          if (job->CancelQueuedDuplicates) {
              switch (djcr->JobStatus) {
              case JS_Created:
@@ -911,11 +1065,8 @@ bool allow_duplicate_job(JCR *jcr)
                 break;
              }
          }
-
          if (cancel_dup || job->CancelRunningDuplicates) {
-            /*
-             * Zap the duplicated job djcr
-             */
+            /* Zap the duplicated job djcr */
             UAContext *ua = new_ua_context(jcr);
             Jmsg(jcr, M_INFO, 0, _("Cancelling duplicate JobId=%d.\n"), djcr->JobId);
             cancel_job(ua, djcr);
@@ -925,9 +1076,7 @@ bool allow_duplicate_job(JCR *jcr)
             free_ua_context(ua);
             Dmsg2(800, "Cancel dup %p JobId=%d\n", djcr, djcr->JobId);
          } else {
-            /*
-             * Zap current job
-             */
+             /* Zap current job */
             jcr->setJobStatus(JS_Canceled);
             Jmsg(jcr, M_FATAL, 0, _("JobId %d already running. Duplicate job not allowed.\n"),
                djcr->JobId);
@@ -951,7 +1100,10 @@ bool apply_wstorage_overrides(JCR *jcr, POOL *opool)
    const char *source;
 
    Dmsg1(100, "Original pool=%s\n", opool->name());
-   if (jcr->run_next_pool_override) {
+   if (jcr->cmdline_next_pool_override) {
+      /* Can be Command line or User input */
+      source = NPRT(jcr->next_pool_source);
+   } else if (jcr->run_next_pool_override) {
       pm_strcpy(jcr->next_pool_source, _("Run NextPool override"));
       pm_strcpy(jcr->pool_source, _("Run NextPool override"));
       source = _("Run NextPool override");
@@ -1056,6 +1208,10 @@ bool get_or_create_client_record(JCR *jcr)
 {
    CLIENT_DBR cr;
 
+   if (!jcr->client) {
+      Jmsg(jcr, M_FATAL, 0, _("No Client specified.\n"));
+      return false;
+   }
    memset(&cr, 0, sizeof(cr));
    bstrncpy(cr.Name, jcr->client->hdr.name, sizeof(cr.Name));
    cr.AutoPrune = jcr->client->AutoPrune;
@@ -1178,6 +1334,7 @@ void create_unique_job_name(JCR *jcr, const char *base_name)
    char name[MAX_NAME_LENGTH];
    char *p;
    int len;
+   int local_seq;
 
    /* Guarantee unique start time -- maximum one per second, and
     * thus unique Job Name
@@ -1192,6 +1349,7 @@ void create_unique_job_name(JCR *jcr, const char *base_name)
       }
    }
    last_start_time = now;
+   local_seq = seq;
    V(mutex);                          /* allow creation of jobs */
    jcr->start_time = now;
    /* Form Unique JobName */
@@ -1201,7 +1359,7 @@ void create_unique_job_name(JCR *jcr, const char *base_name)
    len = strlen(dt) + 5;   /* dt + .%02d EOS */
    bstrncpy(name, base_name, sizeof(name));
    name[sizeof(name)-len] = 0;          /* truncate if too long */
-   bsnprintf(jcr->Job, sizeof(jcr->Job), "%s.%s_%02d", name, dt, seq); /* add date & time */
+   bsnprintf(jcr->Job, sizeof(jcr->Job), "%s.%s_%02d", name, dt, local_seq); /* add date & time */
    /* Convert spaces into underscores */
    for (p=jcr->Job; *p; p++) {
       if (*p == ' ') {
@@ -1247,6 +1405,10 @@ void dird_free_jcr(JCR *jcr)
    Dmsg0(200, "Start dird free_jcr\n");
 
    dird_free_jcr_pointers(jcr);
+   if (jcr->wjcr) {
+      free_jcr(jcr->wjcr);
+      jcr->wjcr = NULL;
+   }
    /* Free bsock packets */
    free_bsock(jcr->file_bsock);
    free_bsock(jcr->store_bsock);
diff --git a/src/dird/jobq.c b/src/dird/jobq.c
index ddd33be..5c95825 100644
--- a/src/dird/jobq.c
+++ b/src/dird/jobq.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2003-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Bacula job queue routines.
@@ -188,6 +192,30 @@ void *sched_wait(void *arg)
    return NULL;
 }
 
+/* Procedure to update the Client->NumConcurrentJobs */
+static void update_client_numconcurrentjobs(JCR *jcr, int val)
+{
+   if (!jcr->client) {
+      return;
+   }
+
+   switch (jcr->getJobType())
+   {
+   case JT_MIGRATE:
+   case JT_COPY:
+   case JT_ADMIN:
+      break;
+   case JT_BACKUP:
+      if (jcr->no_client_used()) {
+         break;
+      }
+   /* Failback wanted */
+   default:
+      jcr->client->NumConcurrentJobs += val;
+      break;
+   }
+}
+
 /*
  *  Add a job to the queue
  *    jq is a queue that was created with jobq_init
@@ -442,9 +470,6 @@ void *jobq_server(void *arg)
          remove_jcr_from_tsd(je->jcr);
          je->jcr->set_killable(false);
 
-         /* Clear the threadid, probably not necessary */
-         memset(&jcr->my_thread_id, 0, sizeof(jcr->my_thread_id));
-
          Dmsg2(2300, "Back from user engine jobid=%d use=%d.\n", jcr->JobId,
             jcr->use_count());
 
@@ -460,9 +485,7 @@ void *jobq_server(void *arg)
          if (jcr->acquired_resource_locks) {
             dec_read_store(jcr);
             dec_write_store(jcr);
-            if (jcr->client) {
-               jcr->client->NumConcurrentJobs--;
-            }
+            update_client_numconcurrentjobs(jcr, -1);
             jcr->job->NumConcurrentJobs--;
             jcr->acquired_resource_locks = false;
          }
@@ -614,6 +637,10 @@ static bool reschedule_job(JCR *jcr, jobq_t *jq, jobq_item_t *je)
    if (jcr->job->RescheduleTimes == 0 ||
        jcr->reschedule_count < jcr->job->RescheduleTimes) {
       resched =
+         /* Check for incomplete jobs */
+         (jcr->RescheduleIncompleteJobs &&
+          jcr->is_incomplete() && jcr->is_JobType(JT_BACKUP) &&
+          !(jcr->HasBase||jcr->is_JobLevel(L_BASE))) ||
          /* Check for failed jobs */
          (jcr->job->RescheduleOnError &&
           !jcr->is_JobStatus(JS_Terminated) &&
@@ -627,6 +654,7 @@ static bool reschedule_job(JCR *jcr, jobq_t *jq, jobq_item_t *je)
         * Reschedule this job by cleaning it up, but
         *  reuse the same JobId if possible.
         */
+      jcr->rerunning = jcr->is_incomplete();   /* save incomplete status */
       time_t now = time(NULL);
       jcr->reschedule_count++;
       jcr->sched_time = now + jcr->job->RescheduleInterval;
@@ -644,8 +672,8 @@ static bool reschedule_job(JCR *jcr, jobq_t *jq, jobq_item_t *je)
       if (!allow_duplicate_job(jcr)) {
          return false;
       }
-      /* Only jobs with no output jobs can run on same JCR */
-      if (jcr->JobBytes == 0) {
+      /* Only jobs with no output or Incomplete jobs can run on same JCR */
+      if (jcr->JobBytes == 0 || jcr->rerunning) {
          Dmsg2(2300, "Requeue job=%d use=%d\n", jcr->JobId, jcr->use_count());
          V(jq->mutex);
          /*
@@ -655,9 +683,9 @@ static bool reschedule_job(JCR *jcr, jobq_t *jq, jobq_item_t *je)
          if (jcr->wasVirtualFull) {
             jcr->setJobLevel(L_VIRTUAL_FULL);
          }
-         /* 
+         /*
           * When we are using the same jcr then make sure to reset
-          *   RealEndTime back to zero.  
+          *   RealEndTime back to zero.
           */
          jcr->jr.RealEndTime = 0;
          jobq_add(jq, jcr);     /* queue the job to run again */
@@ -674,6 +702,21 @@ static bool reschedule_job(JCR *jcr, jobq_t *jq, jobq_item_t *je)
        */
       JCR *njcr = new_jcr(sizeof(JCR), dird_free_jcr);
       set_jcr_defaults(njcr, jcr->job);
+      /*
+       * Eliminate the new job_end_push, then copy the one from
+       *  the old job, and set the old one to be empty.
+       */
+      void *v;
+      lock_jobs();              /* protect ourself from reload_config() */
+      LockRes();
+      foreach_alist(v, (&jcr->job_end_push)) {
+         njcr->job_end_push.append(v);
+      }
+      jcr->job_end_push.destroy();
+      jcr->job_end_push.init(1, false);
+      UnlockRes();
+      unlock_jobs();
+
       njcr->reschedule_count = jcr->reschedule_count;
       njcr->sched_time = jcr->sched_time;
       njcr->initial_sched_time = jcr->initial_sched_time;
@@ -776,7 +819,7 @@ static bool acquire_resources(JCR *jcr)
 
    if (jcr->client) {
       if (jcr->client->NumConcurrentJobs < jcr->client->MaxConcurrentJobs) {
-         jcr->client->NumConcurrentJobs++;
+         update_client_numconcurrentjobs(jcr, 1);
       } else {
          /* Back out previous locks */
          dec_write_store(jcr);
@@ -791,9 +834,7 @@ static bool acquire_resources(JCR *jcr)
       /* Back out previous locks */
       dec_write_store(jcr);
       dec_read_store(jcr);
-      if (jcr->client) {
-         jcr->client->NumConcurrentJobs--;
-      }
+      update_client_numconcurrentjobs(jcr, -1);
       jcr->setJobStatus(JS_WaitJobRes);
       return false;
    }
diff --git a/src/dird/jobq.h b/src/dird/jobq.h
index 8ee20b2..c365d26 100644
--- a/src/dird/jobq.h
+++ b/src/dird/jobq.h
@@ -7,22 +7,25 @@
  *    adapted from "Programming with POSIX Threads", by
  *    David R. Butenhof
  *
- *   Version $Id$
  */
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 
 #ifndef __JOBQ_H
diff --git a/src/dird/mac.c b/src/dird/mac.c
index 6483011..eb1c17b 100644
--- a/src/dird/mac.c
+++ b/src/dird/mac.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2004-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -179,6 +183,13 @@ bool do_mac_init(JCR *jcr)
     *   the previous backup job "prev_job".
     */
    set_jcr_defaults(wjcr, prev_job);
+   /* fix MA 987 cannot copy/migrate jobs with a Level=VF in the job resource
+    * If the prev_job level definition is VirtualFull,
+    * change it to Incremental, otherwise the writing SD would do a VF
+    */
+   if (wjcr->getJobLevel() == L_VIRTUAL_FULL) {
+      wjcr->setJobLevel(L_INCREMENTAL);
+   }
    if (!setup_job(wjcr)) {
       Jmsg(jcr, M_FATAL, 0, _("setup job failed.\n"));
       return false;
@@ -361,7 +372,7 @@ bool do_mac(JCR *jcr)
    /* TODO: See priority with bandwidth parameter */
    if (jcr->job->max_bandwidth > 0) {
       jcr->max_bandwidth = jcr->job->max_bandwidth;
-   } else if (jcr->client->max_bandwidth > 0) {
+   } else if (jcr->client && jcr->client->max_bandwidth > 0) {
       jcr->max_bandwidth = jcr->client->max_bandwidth;
    }
 
@@ -395,7 +406,9 @@ bool do_mac(JCR *jcr)
       goto bail_out;
    }
    sd = jcr->store_bsock;
-   jcr->sd_calls_client = jcr->client->sd_calls_client;
+   if (jcr->client) {
+      jcr->sd_calls_client = jcr->client->sd_calls_client;
+   }
 
    Dmsg2(dbglevel, "Read store=%s, write store=%s\n",
       ((STORE *)jcr->rstorage->first())->name(),
@@ -607,7 +620,7 @@ void mac_cleanup(JCR *jcr, int TermCode, int writeTermCode)
 {
    char sdt[MAX_TIME_LENGTH], edt[MAX_TIME_LENGTH];
    char ec1[30], ec2[30], ec3[30], ec4[30], ec5[30], elapsed[50];
-   char ec6[50], ec7[50], ec8[50];
+   char ec6[50], ec7[50], ec8[50], ec9[30], ec10[30];
    char term_code[100], sd_term_msg[100];
    const char *term_msg;
    int msg_type = M_INFO;
@@ -662,6 +675,11 @@ void mac_cleanup(JCR *jcr, int TermCode, int writeTermCode)
            new_jobid, old_jobid);
          db_sql_query(wjcr->db, query.c_str(), NULL, NULL);
 
+         /* Move RestoreObjects */
+         Mmsg(query, "UPDATE RestoreObject SET JobId=%s WHERE JobId=%s",
+           new_jobid, old_jobid);
+         db_sql_query(wjcr->db, query.c_str(), NULL, NULL);
+
          if (jcr->job->PurgeMigrateJob) {
             /* Purge old Job record */
             purge_jobs_from_catalog(ua, old_jobid);
@@ -684,9 +702,20 @@ void mac_cleanup(JCR *jcr, int TermCode, int writeTermCode)
                       "SELECT %s, Time, LogText FROM Log WHERE JobId=%s",
               new_jobid, old_jobid);
          db_sql_query(wjcr->db, query.c_str(), NULL, NULL);
+
          Mmsg(query, "UPDATE Job SET Type='%c' WHERE JobId=%s",
               (char)JT_JOB_COPY, new_jobid);
          db_sql_query(wjcr->db, query.c_str(), NULL, NULL);
+
+         /* Copy RestoreObjects */
+         Mmsg(query, "INSERT INTO RestoreObject (ObjectName,PluginName,RestoreObject,"
+              "ObjectLength,ObjectFullLength,ObjectIndex,ObjectType,"
+              "ObjectCompression,FileIndex,JobId) "
+        "SELECT ObjectName,PluginName,RestoreObject,"
+          "ObjectLength,ObjectFullLength,ObjectIndex,ObjectType,"
+          "ObjectCompression,FileIndex,%s FROM RestoreObject WHERE JobId=%s",
+           new_jobid, old_jobid);
+         db_sql_query(wjcr->db, query.c_str(), NULL, NULL);
       }
 
       if (!db_get_job_record(jcr, jcr->db, &jcr->jr)) {
@@ -792,9 +821,17 @@ void mac_cleanup(JCR *jcr, int TermCode, int writeTermCode)
    jobstatus_to_ascii(jcr->SDJobStatus, sd_term_msg, sizeof(sd_term_msg));
 
    /* Edit string for last volume size */
-   Mmsg(vol_info, _("%s (%sB)"),
+   if (mr.VolABytes != 0) {
+      Mmsg(vol_info, _("meta: %s (%sB) aligned: %s (%sB)"),
+        edit_uint64_with_commas(mr.VolBytes, ec4),
+        edit_uint64_with_suffix(mr.VolBytes, ec5),
+        edit_uint64_with_commas(mr.VolABytes, ec9),
+        edit_uint64_with_suffix(mr.VolBytes, ec10));
+   } else {
+     Mmsg(vol_info, _("%s (%sB)"),
         edit_uint64_with_commas(mr.VolBytes, ec4),
         edit_uint64_with_suffix(mr.VolBytes, ec5));
+   }
 
    Jmsg(jcr, msg_type, 0, _("%s %s %s (%s):\n"
 "  Build OS:               %s %s %s\n"
@@ -858,11 +895,6 @@ void mac_cleanup(JCR *jcr, int TermCode, int writeTermCode)
         sd_term_msg,
         term_code);
 
-   Dmsg1(100, "migrate_cleanup() wjcr=0x%x\n", jcr->wjcr);
-   if (jcr->wjcr) {
-      free_jcr(jcr->wjcr);
-      jcr->wjcr = NULL;
-   }
    Dmsg0(100, "Leave migrate_cleanup()\n");
 }
 
diff --git a/src/dird/mac_sql.c b/src/dird/mac_sql.c
index e81fdbd..a7623a7 100644
--- a/src/dird/mac_sql.c
+++ b/src/dird/mac_sql.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2004-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -566,8 +570,8 @@ static bool regex_find_jobids(JCR *jcr, idpkt *ids, const char *query1,
          }
       }
       if (last_item) {
-         free(last_item->item);
          Dmsg1(dbglevel, "Remove item %s\n", last_item->item);
+         free(last_item->item);
          item_chain->remove(last_item);
       }
       regfree(&preg);
diff --git a/src/dird/mountreq.c b/src/dird/mountreq.c
index 52a178b..ab101b7 100644
--- a/src/dird/mountreq.c
+++ b/src/dird/mountreq.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
diff --git a/src/dird/msgchan.c b/src/dird/msgchan.c
index 7ea6359..b287f4a 100644
--- a/src/dird/msgchan.c
+++ b/src/dird/msgchan.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -185,7 +189,11 @@ bool start_storage_daemon_job(JCR *jcr, alist *rstore, alist *wstore, bool send_
     */
    pm_strcpy(job_name, jcr->job->name());
    bash_spaces(job_name);
-   pm_strcpy(client_name, jcr->client->name());
+   if (jcr->client) {
+      pm_strcpy(client_name, jcr->client->name());
+   } else {
+      pm_strcpy(client_name, "**Dummy**");
+   }
    bash_spaces(client_name);
    pm_strcpy(fileset_name, jcr->fileset->name());
    bash_spaces(fileset_name);
@@ -375,7 +383,7 @@ bool start_storage_daemon_message_thread(JCR *jcr)
       Jmsg1(jcr, M_ABORT, 0, _("Cannot create message thread: %s\n"), be.bstrerror(status));
    }
    /* Wait for thread to start */
-   while (!jcr->SD_msg_chan_started) {
+   while (jcr->SD_msg_chan_started == false) {
       bmicrosleep(0, 50);
       if (job_canceled(jcr) || jcr->sd_msg_thread_done) {
          return false;
@@ -388,15 +396,15 @@ bool start_storage_daemon_message_thread(JCR *jcr)
 extern "C" void msg_thread_cleanup(void *arg)
 {
    JCR *jcr = (JCR *)arg;
-   db_end_transaction(jcr, jcr->db);        /* terminate any open transaction */
+   db_end_transaction(jcr, jcr->db);      /* terminate any open transaction */
    jcr->lock();
    jcr->sd_msg_thread_done = true;
    jcr->SD_msg_chan_started = false;
    jcr->unlock();
    pthread_cond_broadcast(&jcr->term_wait); /* wakeup any waiting threads */
    Dmsg2(100, "=== End msg_thread. JobId=%d usecnt=%d\n", jcr->JobId, jcr->use_count());
-   db_thread_cleanup(jcr->db);              /* remove thread specific data */
-   free_jcr(jcr);                           /* release jcr */
+   db_thread_cleanup(jcr->db);           /* remove thread specific data */
+   free_jcr(jcr);                        /* release jcr */
 }
 
 /*
diff --git a/src/dird/newvol.c b/src/dird/newvol.c
index 2f7eab3..46f5b92 100644
--- a/src/dird/newvol.c
+++ b/src/dird/newvol.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
diff --git a/src/dird/next_vol.c b/src/dird/next_vol.c
index 74238fc..54fa108 100644
--- a/src/dird/next_vol.c
+++ b/src/dird/next_vol.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -19,7 +23,7 @@
  *    volume for append.  Split out of catreq.c August MMIII
  *    catalog request from the Storage daemon.
 
- *     Written by Kern Sibbald, March MMI
+ *     Kern Sibbald, March MMI
  *
  */
 
diff --git a/src/dird/protos.h b/src/dird/protos.h
index 6c86360..9c68e0d 100644
--- a/src/dird/protos.h
+++ b/src/dird/protos.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Director external function prototypes
@@ -121,7 +125,8 @@ extern DBId_t get_or_create_pool_record(JCR *jcr, char *pool_name);
 extern void apply_pool_overrides(JCR *jcr);
 extern bool apply_wstorage_overrides(JCR *jcr, POOL *original_pool);
 extern JobId_t run_job(JCR *jcr);
-extern bool cancel_job(UAContext *ua, JCR *jcr, bool cancel = true);
+extern JobId_t resume_job(JCR *jcr, JOB_DBR *jr);
+extern bool cancel_job(UAContext *ua, JCR *jcr, bool cancel=true);
 extern void get_job_storage(USTORE *store, JOB *job, RUN *run);
 extern void init_jcr_job_record(JCR *jcr);
 extern void update_job_end(JCR *jcr, int TermCode);
@@ -205,11 +210,11 @@ enum e_pool_op {
    POOL_OP_UPDATE,
    POOL_OP_CREATE
 };
-int create_pool(JCR *jcr, B_DB *db, POOL *pool, e_pool_op op);
+int create_pool(JCR *jcr, BDB *db, POOL *pool, e_pool_op op);
 void set_pool_dbr_defaults_in_media_dbr(MEDIA_DBR *mr, POOL_DBR *pr);
-bool set_pooldbr_references(JCR *jcr, B_DB *db, POOL_DBR *pr, POOL *pool);
+bool set_pooldbr_references(JCR *jcr, BDB *db, POOL_DBR *pr, POOL *pool);
 void set_pooldbr_from_poolres(POOL_DBR *pr, POOL *pool, e_pool_op op);
-int update_pool_references(JCR *jcr, B_DB *db, POOL *pool);
+int update_pool_references(JCR *jcr, BDB *db, POOL *pool);
 
 /* ua_input.c */
 bool get_cmd(UAContext *ua, const char *prompt, bool subprompt=false);
@@ -237,6 +242,9 @@ bool acl_access_jobid_ok(UAContext *ua, const char *jobids);
 
 /* ua_restore.c */
 void find_storage_resource(UAContext *ua, RESTORE_CTX &rx, char *Storage, char *MediaType);
+bool insert_table_into_findex_list(UAContext *ua, RESTORE_CTX *rx, char *table);
+void new_rx(RESTORE_CTX *rx);
+void free_rx(RESTORE_CTX *rx);
 
 /* ua_server.c */
 void bsendmsg(void *ua_ctx, const char *fmt, ...);
@@ -252,8 +260,10 @@ STORE   *select_storage_resource(UAContext *ua, bool unique=false);
 JOB     *select_job_resource(UAContext *ua);
 JOB     *select_enable_disable_job_resource(UAContext *ua, bool enable);
 JOB     *select_restore_job_resource(UAContext *ua);
+CLIENT  *select_enable_disable_client_resource(UAContext *ua, bool enable);
 CLIENT  *select_client_resource(UAContext *ua);
 FILESET *select_fileset_resource(UAContext *ua);
+SCHED   *select_enable_disable_schedule_resource(UAContext *ua, bool enable);
 int     select_pool_and_media_dbr(UAContext *ua, POOL_DBR *pr, MEDIA_DBR *mr);
 int     select_media_dbr(UAContext *ua, MEDIA_DBR *mr);
 bool    select_pool_dbr(UAContext *ua, POOL_DBR *pr, const char *argk="pool");
@@ -283,6 +293,7 @@ int find_arg(UAContext *ua, const char *keyword);
 int find_arg_with_value(UAContext *ua, const char *keyword);
 int do_keyword_prompt(UAContext *ua, const char *msg, const char **list);
 int confirm_retention(UAContext *ua, utime_t *ret, const char *msg);
+int confirm_retention_yesno(UAContext *ua, utime_t ret, const char *msg);
 bool get_level_from_name(JCR *jcr, const char *level_name);
 
 /* ua_status.c */
@@ -316,8 +327,19 @@ void purge_files_from_job_list(UAContext *ua, del_ctx &del);
 
 /* ua_run.c */
 extern int run_cmd(UAContext *ua, const char *cmd);
+extern int restart_cmd(UAContext *ua, const char *cmd);
 
 /* verify.c */
 extern bool do_verify(JCR *jcr);
 extern bool do_verify_init(JCR *jcr);
 extern void verify_cleanup(JCR *jcr, int TermCode);
+
+/* snapshot.c */
+int  select_snapshot_dbr(UAContext *ua, SNAPSHOT_DBR *sr);
+void snapshot_list(UAContext *ua, int i, DB_LIST_HANDLER *sendit, e_list_type llist);
+int  snapshot_cmd(UAContext *ua, const char *cmd);
+int  snapshot_catreq(JCR *jcr, BSOCK *bs);
+int  delete_snapshot(UAContext *ua);
+bool update_snapshot(UAContext *ua);
+int prune_snapshot(UAContext *ua);
+bool send_snapshot_retention(JCR *jcr, utime_t val);
diff --git a/src/dird/query.sql b/src/dird/query.sql
index d852775..d04cb8c 100644
--- a/src/dird/query.sql
+++ b/src/dird/query.sql
@@ -3,5 +3,5 @@
 #  for some sample queries. 
 #
 # 1
-:The default file is empty, see <bacula-source>/examples/sample-query.sql for samples
-SELECT 'See <bacula-source>/examples/sample-query.sql for samples' AS Info;
+:The default file is empty, see sample-query.sql (in /opt/bacula/scripts or <bacula-source>/examples) for samples
+SELECT 'See sample-query.sql (in /opt/bacula/scripts or <bacula-source>/examples) for samples' AS Info;
diff --git a/src/dird/recycle.c b/src/dird/recycle.c
index 4cd2d4f..6ba990c 100644
--- a/src/dird/recycle.c
+++ b/src/dird/recycle.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2002-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
diff --git a/src/dird/restore.c b/src/dird/restore.c
index 99bffc6..5228390 100644
--- a/src/dird/restore.c
+++ b/src/dird/restore.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2000-2015 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /**
  *   Bacula Director -- restore.c -- responsible for restoring files
@@ -178,7 +182,8 @@ static bool is_on_same_storage(JCR *jcr, char *new_one)
    if (!new_store) {
       Jmsg(jcr, M_WARNING, 0,
            _("Could not get storage resource '%s'.\n"), new_one);
-      return false;
+      /* If not storage found, use last one */
+      return true;
    }
    /* if Port and Hostname/IP are same, we are talking to the same
     * Storage Daemon
@@ -403,7 +408,7 @@ bool restore_bootstrap(JCR *jcr)
          /*
           * SD must call "client" i.e. FD
           */
-         if (jcr->FDVersion < 5) {
+         if (jcr->FDVersion < 10) {
             Jmsg(jcr, M_FATAL, 0, _("The File daemon does not support SDCallsClient.\n"));
             goto bail_out;
          }
@@ -413,8 +418,9 @@ bool restore_bootstrap(JCR *jcr)
          if (!run_storage_and_start_message_thread(jcr, sd)) {
             goto bail_out;
          }
-         store_address = jcr->wstore->address;  /* dummy */
-         store_port = 0;           /* flag that SD calls FD */
+
+         store_address = jcr->rstore->address;  /* dummy */
+         store_port = 0;                        /* flag that SD calls FD */
 
       } else {
          /*
@@ -466,6 +472,14 @@ bool restore_bootstrap(JCR *jcr)
          if (!send_runscripts_commands(jcr)) {
             goto bail_out;
          }
+         if (!send_component_info(jcr)) {
+            Pmsg0(000, "FAIL: Send component info\n");
+            goto bail_out;
+         }
+         if (!send_restore_objects(jcr)) {
+            Pmsg0(000, "FAIL: Send restore objects\n");
+            goto bail_out;
+         }
       }
 
       fd->fsend("%s", restore_cmd.c_str());
@@ -532,6 +546,10 @@ bool do_restore(JCR *jcr)
    /* Print Job Start message */
    Jmsg(jcr, M_INFO, 0, _("Start Restore Job %s\n"), jcr->Job);
 
+   if (jcr->client) {
+      jcr->sd_calls_client = jcr->client->sd_calls_client;
+   }
+
    /* Read the bootstrap file and do the restore */
    if (!restore_bootstrap(jcr)) {
       goto bail_out;
@@ -569,6 +587,15 @@ void restore_cleanup(JCR *jcr, int TermCode)
    Dmsg0(20, "In restore_cleanup\n");
    update_job_end(jcr, TermCode);
 
+   if (jcr->component_fd) {
+      fclose(jcr->component_fd);
+      jcr->component_fd = NULL;
+   }
+   if (jcr->component_fname && *jcr->component_fname) {
+      unlink(jcr->component_fname);
+   }
+   free_and_null_pool_memory(jcr->component_fname);
+
    if (jcr->unlink_bsr && jcr->RestoreBootstrap) {
       unlink(jcr->RestoreBootstrap);
       jcr->unlink_bsr = false;
diff --git a/src/dird/run_conf.c b/src/dird/run_conf.c
index e96882d..9d21eb9 100644
--- a/src/dird/run_conf.c
+++ b/src/dird/run_conf.c
@@ -1,24 +1,28 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
  *  Configuration parser for Director Run Configuration
  *   directives, which are part of the Schedule Resource
  *
- *     Written by Kern Sibbald, May MM
+ *     Kern Sibbald, May MM
  *
  */
 
@@ -148,19 +152,19 @@ static void set_defaults()
  *    name              token
  */
 s_kw RunFields[] = {
-   {"pool",              'P'},
-   {"fullpool",          'f'},
-   {"incrementalpool",   'i'},
-   {"differentialpool",  'd'},
-   {"level",             'L'},
-   {"storage",           'S'},
-   {"messages",          'M'},
-   {"priority",          'p'},
-   {"spooldata",         's'},
+   {"Pool",              'P'},
+   {"FullPool",          'f'},
+   {"IncrementalPool",   'i'},
+   {"DifferentialPool",  'd'},
+   {"Level",             'L'},
+   {"Storage",           'S'},
+   {"Messages",          'M'},
+   {"Priority",          'p'},
+   {"SpoolData",         's'},
    {"writepartafterjob", 'W'},
-   {"maxrunschedtime",   'm'},
-   {"accurate",          'a'},
-   {"nextpool",          'N'},
+   {"MaxRunSchedTime",   'm'},
+   {"Accurate",          'a'},
+   {"NextPool",          'N'},
    {NULL,                 0}
 };
 
@@ -513,6 +517,7 @@ void store_run(LEX *lc, RES_ITEM *item, int index, int pass)
             clear_bits(0, 30, lrun.mday);
             have_mday = true;
          }
+         lrun.last_day_set = true;
          set_bit(31, lrun.mday);   /* day 32 => last day of month */
          break;
       case s_range:
diff --git a/src/dird/scheduler.c b/src/dird/scheduler.c
index f9252f8..eb8dc0b 100644
--- a/src/dird/scheduler.c
+++ b/src/dird/scheduler.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -174,11 +178,11 @@ again:
    jcr = new_jcr(sizeof(JCR), dird_free_jcr);
    run = next_job->run;               /* pick up needed values */
    job = next_job->job;
-   if (job->enabled) {
-      dump_job(next_job, _("Run job"));
+   if (job->enabled && (!job->client || job->client->enabled)) {
+      dump_job(next_job, _("Run job"));  /* no client and job enabled */
    }
    free(next_job);
-   if (!job->enabled) {
+   if (!job->enabled || (job->client && !job->client->enabled)) {
       free_jcr(jcr);
       goto again;                     /* ignore this job */
    }
@@ -300,7 +304,8 @@ static void find_runs()
    LockRes();
    foreach_res(job, R_JOB) {
       sched = job->schedule;
-      if (sched == NULL || !job->enabled) { /* scheduled? or enabled? */
+      if (!sched || !job->enabled || (sched && !sched->enabled) ||
+         (job->client && !job->client->enabled)) {
          continue;                    /* no, skip this job */
       }
       Dmsg1(dbglvl, "Got job: %s\n", job->hdr.name);
@@ -434,6 +439,7 @@ static void dump_job(job_item *ji, const char *msg)
 #ifdef SCHED_DEBUG
    char dt[MAX_TIME_LENGTH];
    int64_t save_debug = debug_level;
+
    if (!chk_dbglvl(dbglvl)) {
       return;
    }
diff --git a/src/dird/snapshot.c b/src/dird/snapshot.c
new file mode 100644
index 0000000..3cf9ad2
--- /dev/null
+++ b/src/dird/snapshot.c
@@ -0,0 +1,765 @@
+/*
+   Bacula(R) - The Network Backup Solution
+
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
+
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
+
+   You may use this file and others of this release according to the
+   license defined in the LICENSE file, which includes the Affero General
+   Public License, v3.0 ("AGPLv3") and some additional permissions and
+   terms pursuant to its AGPLv3 Section 7.
+
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
+
+   Written by Eric Bollengier, 2015
+*/
+
+#include "bacula.h"
+#include "dird.h"
+
+static char CreateSnap[] = "CatReq Job=%127s new_snapshot name=%127s volume=%s device=%s tdate=%d type=%127s retention=%50s";
+static char ListSnap[] = "CatReq Job=%127s list_snapshot name=%127s volume=%s device=%s tdate=%d type=%127s before=%50s after=%50s";
+static char DelSnap[] = "CatReq Job=%127s del_snapshot name=%127s device=%s";
+static char snapretentioncmd[] = "snapshot retention=%s\n";
+
+
+static void send_list(void *ctx, const char *msg)
+{
+   BSOCK *bs = (BSOCK *)ctx;
+   bs->fsend("%s", msg);
+}
+
+
+/* Scan command line for common snapshot arguments */
+static void snapshot_scan_cmdline(UAContext *ua, int start, SNAPSHOT_DBR *snapdbr)
+{
+   for (int j=start; j<ua->argc; j++) {
+      if (strcasecmp(ua->argk[j], NT_("device")) == 0 && ua->argv[j]) {
+         snapdbr->Device = bstrdup(ua->argv[j]);
+         snapdbr->need_to_free = true;
+
+      } else if (strcasecmp(ua->argk[j], NT_("jobid")) == 0 && ua->argv[j]) {
+         snapdbr->JobId = str_to_int64(ua->argv[j]);
+
+      } else if (strcasecmp(ua->argk[j], NT_("type")) == 0 && ua->argv[j]) {
+         bstrncpy(snapdbr->Type, ua->argv[j], sizeof(snapdbr->Type));
+
+      } else if (strcasecmp(ua->argk[j], NT_("client")) == 0 && ua->argv[j]) {
+         bstrncpy(snapdbr->Client, ua->argv[j], sizeof(snapdbr->Client));
+
+      } else if (strcasecmp(ua->argk[j], NT_("snapshotid")) == 0 && ua->argv[j]) {
+         snapdbr->SnapshotId = str_to_int64(ua->argv[j]);
+
+      } else if (strcasecmp(ua->argk[j], NT_("snapshot")) == 0 && ua->argv[j]) {
+         bstrncpy(snapdbr->Name, ua->argv[j], sizeof(snapdbr->Name));
+
+      } else if (strcasecmp(ua->argk[j], NT_("volume")) == 0 && ua->argv[j]) {
+         snapdbr->Volume = bstrdup(ua->argv[j]);
+         snapdbr->need_to_free = true;
+
+      } else if (strcasecmp(ua->argk[j], NT_("createdate")) == 0 && ua->argv[j]) {
+         bstrncpy(snapdbr->CreateDate, ua->argv[j], sizeof(snapdbr->CreateDate));
+         snapdbr->CreateTDate = str_to_utime(ua->argv[j]);
+
+      } else if (strcasecmp(ua->argk[j], NT_("createtdate")) == 0 && ua->argv[j]) {
+         snapdbr->CreateTDate = str_to_uint64(ua->argv[j]);
+         bstrutime(snapdbr->CreateDate, sizeof(snapdbr->CreateDate), snapdbr->CreateTDate);
+
+      } else if (strcasecmp(ua->argk[j], NT_("name")) == 0 && ua->argv[j]) {
+         bstrncpy(snapdbr->Name, ua->argv[j], sizeof(snapdbr->Name));
+
+      } else if (strcasecmp(ua->argk[j], NT_("size")) == 0 && ua->argv[j]) {
+         snapdbr->Size = str_to_uint64(ua->argv[j]);
+
+      } else if (strcasecmp(ua->argk[j], NT_("status")) == 0 && ua->argv[j]) {
+         snapdbr->status = str_to_uint64(ua->argv[j]);
+
+      } else if (strcasecmp(ua->argk[j], NT_("error")) == 0 && ua->argv[j]) {
+         snapdbr->errmsg = bstrdup(ua->argv[j]);
+         unbash_spaces(snapdbr->errmsg);
+         snapdbr->need_to_free = true;
+
+      } else {
+         continue;
+      }
+   }
+}
+
+/* Get a snapshot record, and check that the current UA can access to the Client/FileSet */
+static int get_snapshot_record(UAContext *ua, SNAPSHOT_DBR *snapdbr)
+{
+   if (!open_client_db(ua)) {
+      Dmsg0(10, "Unable to open database\n");
+      return 0;
+   }
+   if (!db_get_snapshot_record(ua->jcr, ua->db, snapdbr)) {
+      Dmsg0(10, "Unable to get snapshot record\n");
+      return 0;
+   }
+   /* Need to check if the client is authorized */
+   if (!acl_access_ok(ua, Client_ACL, snapdbr->Client)) {
+      Dmsg0(10, "Client access denied\n");
+      return 0;
+   }
+   if (snapdbr->FileSetId && !acl_access_ok(ua, FileSet_ACL, snapdbr->FileSet)) {
+      Dmsg0(10, "Fileset access denied\n");
+      return 0;
+   }
+   return 1;
+}
+
+static int check_response(UAContext *ua, BSOCK *sd, const char *resp, const char *cmd)
+{
+   if (sd->errors) {
+      return 0;
+   }
+   if (bget_msg(sd) > 0) {
+      unbash_spaces(sd->msg);
+      if (strcmp(sd->msg, resp) == 0) {
+         return 1;
+      }
+   }
+   if (sd->is_error()) {
+      ua->error_msg(_("Comm error with SD. bad response to %s. ERR=%s\n"),
+                    cmd, sd->bstrerror());
+   } else {
+      ua->error_msg(_("Bad response from SD to %s command. Wanted %s, got %s len=%ld\n"),
+                    cmd, resp, sd->msg, sd->msglen);
+   }
+   return 0;
+}
+
+bool send_snapshot_retention(JCR *jcr, utime_t val)
+{
+   BSOCK *fd = jcr->file_bsock;
+   char ed1[50];
+   if (val > 0 && jcr->FDVersion >= 13) {
+      fd->fsend(snapretentioncmd, edit_uint64(val, ed1));
+      if (!response(jcr, fd, (char*)"2000 Snapshot retention\n", "set Snapshot Retention", DISPLAY_ERROR)) {
+         jcr->snapshot_retention = 0;      /* can't set snapshot retention */
+         return false;
+      }
+   }
+   return true;
+}
+
+/* Called from delete_cmd() in ua_cmd.c */
+int delete_snapshot(UAContext *ua)
+{
+   POOLMEM     *out;
+   SNAPSHOT_DBR snapdbr;
+   CLIENT      *client;
+   BSOCK       *fd;
+
+   if (!open_new_client_db(ua)) {
+      return 1;
+   }
+
+   /* If the client or the fileset are not authorized,
+    * the function will fail.
+    */
+   if (!select_snapshot_dbr(ua, &snapdbr)) {
+      ua->error_msg(_("Snapshot not found\n"));
+      snapdbr.debug(0);
+      return 0;
+   }
+
+   client = (CLIENT *)GetResWithName(R_CLIENT, snapdbr.Client);
+   if (!client) {
+      ua->error_msg(_("Client resource not found\n"));
+      return 0;
+   }
+
+   /* Connect to File daemon */
+   ua->jcr->client = client;
+
+   /* Try to connect for 15 seconds */
+   ua->send_msg(_("Connecting to Client %s at %s:%d\n"),
+      client->name(), client->address, client->FDport);
+   if (!connect_to_file_daemon(ua->jcr, 1, 15, 0)) {
+      ua->error_msg(_("Failed to connect to Client.\n"));
+      ua->jcr->client = NULL;
+      return 0;
+   }
+
+   fd = ua->jcr->file_bsock;
+   out = get_pool_memory(PM_FNAME);
+   fd->fsend("snapshot del %s\n", snapdbr.as_arg(&out));
+   free_pool_memory(out);
+
+   /* If the snapshot is not found, still delete ours */
+   if (check_response(ua, fd, "2000 Snapshot deleted ERR=\n", "Snapshot")) {
+      ua->send_msg(_("Snapshot \"%s\" deleted from client %s\n"), snapdbr.Name,
+                   snapdbr.Client);
+   }
+
+   ua->jcr->file_bsock->signal(BNET_TERMINATE);
+   free_bsock(ua->jcr->file_bsock);
+   ua->jcr->client = NULL;
+
+   db_delete_snapshot_record(ua->jcr, ua->db, &snapdbr);
+   ua->send_msg(_("Snapshot \"%s\" deleted from catalog\n"), snapdbr.Name);
+   return 1;
+}
+
+/* Called from menu, if snap_list is valid, the snapshot
+ * list will be stored in this list. (not_owned_by_alist)
+ */
+int list_snapshot(UAContext *ua, alist *snap_list)
+{
+   SNAPSHOT_DBR snap;
+   POOLMEM     *buf;
+   CLIENT      *client;
+   BSOCK       *fd;
+
+   client = select_client_resource(ua);
+   if (!client) {
+      return 0;
+   }
+
+   /* Connect to File daemon */
+   ua->jcr->client = client;
+
+   /* Try to connect for 15 seconds */
+   ua->send_msg(_("Connecting to Client %s at %s:%d\n"),
+      client->name(), client->address, client->FDport);
+   if (!connect_to_file_daemon(ua->jcr, 1, 15, 0)) {
+      ua->error_msg(_("Failed to connect to Client.\n"));
+      return 0;
+   }
+
+   fd = ua->jcr->file_bsock;
+
+   /* The command line can have filters */
+   snapshot_scan_cmdline(ua, 0, &snap);
+   buf = get_pool_memory(PM_FNAME);
+
+   fd->fsend("snapshot list %s\n", snap.as_arg(&buf));
+   while (fd->recv() >= 0) {
+      if (snap_list) {
+         SNAPSHOT_DBR *snapr = new SNAPSHOT_DBR();
+         parse_args(fd->msg, &ua->args, &ua->argc, ua->argk, ua->argv, MAX_CMD_ARGS);
+         snapshot_scan_cmdline(ua, 0, snapr);
+         bstrncpy(snapr->Client, client->name(), sizeof(snapr->Client));
+         snap_list->append(snapr);
+         snapr->debug(0);
+      } else {
+         ua->send_msg("%s", fd->msg);
+      }
+   }
+
+   /* Reset the UA arg list */
+   parse_args(ua->cmd, &ua->args, &ua->argc, ua->argk, ua->argv, MAX_CMD_ARGS);
+
+   ua->jcr->file_bsock->signal(BNET_TERMINATE);
+   free_bsock(ua->jcr->file_bsock);
+   ua->jcr->client = NULL;
+   free_pool_memory(buf);
+   return 1;
+}
+
+static void storeit(void *ctx, const char *msg)
+{
+   char ed1[51];
+   alist *lst = (alist *)ctx;
+   if (sscanf(msg, "snapshotid=%50s", ed1) == 1) {
+      lst->append((void *)(intptr_t) str_to_int64(ed1));
+   }
+}
+
+int prune_snapshot(UAContext *ua)
+{
+   /* First, we get the snapshot list that can be pruned */
+   CLIENT *client = NULL;
+   BSOCK  *fd = NULL;
+   POOLMEM *buf = NULL;
+   SNAPSHOT_DBR snapdbr;
+   alist *lst;
+   intptr_t id;
+
+   snapshot_scan_cmdline(ua, 0, &snapdbr);
+   snapdbr.expired = true;
+   if (!open_client_db(ua)) {
+      Dmsg0(10, "Unable to open database\n");
+      return 0;
+   }
+
+   buf = get_pool_memory(PM_FNAME);
+   lst = New(alist(10, not_owned_by_alist));
+   db_list_snapshot_records(ua->jcr, ua->db, &snapdbr, storeit, lst, ARG_LIST);
+   foreach_alist(id, lst) {
+      snapdbr.reset();
+      snapdbr.SnapshotId = id;
+      if (get_snapshot_record(ua, &snapdbr)) {
+
+         ua->send_msg(_("Snapshot \"%s\" on Client %s\n"), snapdbr.Name, snapdbr.Client);
+         if (!confirm_retention_yesno(ua, snapdbr.Retention, "Snapshot")) {
+            continue;
+         }
+
+         if (client && strcmp(client->hdr.name, snapdbr.Client) != 0) {
+            ua->jcr->file_bsock->signal(BNET_TERMINATE);
+            free_bsock(ua->jcr->file_bsock);
+            ua->jcr->client = NULL;
+            client = NULL;
+         }
+
+         if (!client) {
+            client = (CLIENT *)GetResWithName(R_CLIENT, snapdbr.Client);
+            if (!client) {
+               continue;
+            }
+
+            /* Connect to File daemon */
+            ua->jcr->client = client;
+
+            /* Try to connect for 15 seconds */
+            ua->send_msg(_("Connecting to Client %s at %s:%d\n"),
+                         client->name(), client->address, client->FDport);
+            if (!connect_to_file_daemon(ua->jcr, 1, 15, 0)) {
+               ua->error_msg(_("Failed to connect to Client.\n"));
+               free_bsock(ua->jcr->file_bsock);
+               ua->jcr->client = NULL;
+               client = NULL;
+               continue;
+            }
+
+            fd = ua->jcr->file_bsock;
+         }
+
+         fd->fsend("snapshot del %s\n", snapdbr.as_arg(&buf));
+
+         fd->recv();
+         if (strncmp(fd->msg, "2000", 4) == 0) {
+            ua->send_msg("Snapshot %s deleted\n", snapdbr.Volume);
+            db_delete_snapshot_record(ua->jcr, ua->db, &snapdbr);
+         } else {
+            unbash_spaces(fd->msg);
+            ua->send_msg("%s", fd->msg);
+         }
+      }
+   }
+
+   if (ua->jcr->file_bsock) {
+      ua->jcr->file_bsock->signal(BNET_TERMINATE);
+      free_bsock(ua->jcr->file_bsock);
+      ua->jcr->client = NULL;
+   }
+
+   free_pool_memory(buf);
+   delete lst;
+   return 1;
+}
+
+
+/* Called from the FD, in catreq.c */
+int snapshot_catreq(JCR *jcr, BSOCK *bs)
+{
+   SNAPSHOT_DBR snapdbr;
+   char Job[MAX_NAME_LENGTH], ed1[50];
+   POOLMEM *vol = get_memory(bs->msglen);
+   POOLMEM *dev = get_memory(bs->msglen);
+   POOLMEM *err = get_pool_memory(PM_MESSAGE);
+   int n, ret = 1, expired;
+   *vol = *dev = 0;
+
+   Dmsg1(DT_SNAPSHOT|10, "Get snapshot catalog request %s\n", bs->msg);
+
+   /* We need to create a snapshot record in the catalog */
+   n = sscanf(bs->msg, CreateSnap, Job, snapdbr.Name, vol, dev, 
+              &snapdbr.CreateTDate, snapdbr.Type, ed1);
+   if (n == 7) {
+      snapdbr.Volume = vol;
+      snapdbr.Device = dev;
+      snapdbr.JobId = jcr->JobId;
+      unbash_spaces(snapdbr.Name);
+      unbash_spaces(snapdbr.Volume);
+      unbash_spaces(snapdbr.Device);
+      snapdbr.Retention = str_to_uint64(ed1);
+      bstrftimes(snapdbr.CreateDate, sizeof(snapdbr.CreateDate), snapdbr.CreateTDate);
+      unbash_spaces(snapdbr.Type);
+      bstrncpy(snapdbr.Client, jcr->client->hdr.name, sizeof(snapdbr.Client));
+      bstrncpy(snapdbr.FileSet, (jcr->fileset)?jcr->fileset->hdr.name:"", sizeof(snapdbr.FileSet));
+
+      Dmsg1(DT_SNAPSHOT|10, "Creating snapshot %s\n", snapdbr.Name);
+      snapdbr.debug(20);
+
+      /* We lock the db before to keep the error message */
+      db_lock(jcr->db);
+      ret = db_create_snapshot_record(jcr, jcr->db, &snapdbr);
+      pm_strcpy(err, jcr->db->errmsg);
+      db_unlock(jcr->db);
+
+      if (ret) {
+         bs->fsend("1000 Snapshot created\n");
+
+      } else {
+         bs->fsend("1999 Snapshot not created ERR=%s\n", err);
+      }
+      goto bail_out;
+   }
+
+   n = sscanf(bs->msg, ListSnap, Job, snapdbr.Name, vol, dev, &snapdbr.CreateTDate, snapdbr.Type,
+              snapdbr.created_before, snapdbr.created_after, &expired);
+   if (n == 8) {
+      snapdbr.Volume = vol;
+      snapdbr.Device = dev;
+      unbash_spaces(snapdbr.Name);
+      unbash_spaces(snapdbr.Volume);
+      unbash_spaces(snapdbr.Device);
+      bstrftimes(snapdbr.CreateDate, sizeof(snapdbr.CreateDate), snapdbr.CreateTDate);
+      unbash_spaces(snapdbr.Type);
+      unbash_spaces(snapdbr.created_before);
+      unbash_spaces(snapdbr.created_after);
+      bstrncpy(snapdbr.Client, jcr->client->hdr.name, sizeof(snapdbr.Client));
+      snapdbr.expired = (expired != 0);
+      Dmsg0(DT_SNAPSHOT|10, "List snapshots\n");
+      snapdbr.debug(20);
+      db_list_snapshot_records(jcr, jcr->db, &snapdbr, send_list, bs, ARG_LIST);
+      bs->signal(BNET_EOD);
+      goto bail_out;
+   }
+
+   n = sscanf(bs->msg, DelSnap, Job, snapdbr.Name, dev);
+   if (n == 3) {
+      snapdbr.Device = dev;
+      unbash_spaces(snapdbr.Name);
+      unbash_spaces(snapdbr.Device);
+      bstrncpy(snapdbr.Client, jcr->client->hdr.name, sizeof(snapdbr.Client));
+      Dmsg2(DT_SNAPSHOT|10, "Delete snapshot %s from %s\n", snapdbr.Name, snapdbr.Client);
+      snapdbr.debug(20);      
+
+      /* We lock the db before to keep the error message */
+      db_lock(jcr->db);
+      ret = db_delete_snapshot_record(jcr, jcr->db, &snapdbr);
+      pm_strcpy(err, jcr->db->errmsg);
+      db_unlock(jcr->db);
+
+      if (ret) {
+         bs->fsend("1000 Snapshot deleted\n");
+
+      } else {
+         bs->fsend("1999 Snapshot not deleted ERR=%s\n", err);
+      }
+      goto bail_out;
+   }
+   ret = 0;
+
+bail_out:
+   free_pool_memory(vol);
+   free_pool_memory(dev);
+   free_pool_memory(err);
+   return ret;
+}
+
+/* List snapshots, allow to use some parameters from the command line */
+void snapshot_list(UAContext *ua, int i, DB_LIST_HANDLER *sendit, e_list_type llist)
+{
+   SNAPSHOT_DBR snapdbr;
+   snapshot_scan_cmdline(ua, i, &snapdbr);
+   if (open_new_client_db(ua)) {
+      db_list_snapshot_records(ua->jcr, ua->db, &snapdbr, sendit, ua, llist);
+   }
+}
+
+static int list_client_snapshot(UAContext *ua, bool sync)
+{
+   SNAPSHOT_DBR *s, stemp;
+   alist *lst;
+//   char ed1[50];
+
+   if (sync) {
+      if (!open_new_client_db(ua)) {
+         return 1;
+      }
+   }
+
+   lst = New(alist(10, not_owned_by_alist));
+   if (list_snapshot(ua, lst)) {
+      foreach_alist(s, lst) {
+         ua->send_msg(_(
+            "Snapshot      %s:\n"
+            "  Volume:     %s\n"
+            "  Device:     %s\n"
+            "  CreateDate: %s\n"
+//            "  Size:       %sB\n",
+            "  Type:       %s\n"
+            "  Status:     %s\n"
+            "  Error:      %s\n"),
+            s->Name, NPRT(s->Volume), NPRT(s->Device),
+            s->CreateDate,
+//          edit_uint64_with_suffix(s->Size, ed1),
+                      s->Type, s->status?_("OK"):_("Error"), s->errmsg);
+         if (sync && s->Device && *s->Name) {
+            stemp.reset();
+            stemp.Device = s->Device;
+            bstrncpy(stemp.Name, s->Name, sizeof(stemp.Name));
+            if (!db_get_snapshot_record(ua->jcr, ua->db, &stemp)) {
+               if (db_create_snapshot_record(ua->jcr, ua->db, s)) {
+                  ua->send_msg(_("Snapshot added in Catalog\n"));
+               }
+            }
+         }
+      }
+      if (lst->size() == 0) {
+         ua->send_msg(_("No snapshot found\n"));
+      }
+   }
+   /* Cleanup the list */
+   foreach_alist (s, lst) {
+      delete s;
+   }
+   delete lst;
+   return 1;
+}
+
+/* Ask client to create/prune/delete a snapshot via the command line */
+int snapshot_cmd(UAContext *ua, const char *cmd)
+{
+   SNAPSHOT_DBR snapdbr;
+   for (int i=0; i<ua->argc; i++) {
+      if (strcasecmp(ua->argk[i], NT_("purge")) == 0) {
+
+      } else if (strcasecmp(ua->argk[i], NT_("prune")) == 0) {
+         return prune_snapshot(ua);
+
+      } else if (strcasecmp(ua->argk[i], NT_("listclient")) == 0) {
+         return list_client_snapshot(ua, false);
+
+      } else if (strcasecmp(ua->argk[i], NT_("list")) == 0) {
+         snapshot_list(ua, 0, prtit, HORZ_LIST);
+         return 1;
+
+      } else if (strcasecmp(ua->argk[i], NT_("create")) == 0) {
+         /* We need a job definition, or a client */
+
+      } else if (strcasecmp(ua->argk[i], NT_("delete")) == 0) {
+         return delete_snapshot(ua);
+
+      } else if (strcasecmp(ua->argk[i], NT_("status")) == 0) {
+
+      } else if (strcasecmp(ua->argk[i], NT_("sync")) == 0) {
+         return list_client_snapshot(ua, true);
+
+      } else if (strcasecmp(ua->argk[i], NT_("update")) == 0) {
+         return update_snapshot(ua);
+
+      } else {
+         continue;
+      }
+   }
+
+   for ( ;; ) {
+
+      start_prompt(ua, _("Snapshot choice: \n"));
+      add_prompt(ua, _("List snapshots in Catalog"));
+      add_prompt(ua, _("List snapshots on Client"));
+      add_prompt(ua, _("Prune snapshots"));
+      add_prompt(ua, _("Delete snapshot"));
+      add_prompt(ua, _("Update snapshot parameters"));
+      add_prompt(ua, _("Update catalog with Client snapshots"));
+      add_prompt(ua, _("Done"));
+
+      switch(do_prompt(ua, "", _("Select action to perform on Snapshot Engine"), NULL, 0)) {
+      case 0:                         /* list catalog */
+         snapshot_list(ua, 0, prtit, HORZ_LIST);
+         break;
+      case 1:                         /* list client */
+         list_client_snapshot(ua, false);
+         break;
+      case 2:                   /* prune */
+         prune_snapshot(ua);
+         break;
+      case 3:                   /* delete */
+         delete_snapshot(ua);
+         break;
+      case 4:                      /* update snapshot */
+         update_snapshot(ua);
+         break;
+      case 5:                      /* sync snapshot */
+         list_client_snapshot(ua, true);
+         break;
+      case 6:                   /* done */
+      default:
+         ua->info_msg(_("Selection terminated.\n"));
+         return 1;
+      }
+   }
+   return 1;
+}
+
+/* Select a Snapshot record from the database, might be in ua_select.c */
+int select_snapshot_dbr(UAContext *ua, SNAPSHOT_DBR *sr)
+{
+   int   ret = 0;
+   char *p;
+   POOLMEM *err = get_pool_memory(PM_FNAME);
+   *err=0;
+
+   sr->reset();
+   snapshot_scan_cmdline(ua, 0, sr);
+
+   if (sr->SnapshotId == 0 && (sr->Name[0] == 0 || sr->Client[0] == 0)) {
+      CLIENT_DBR cr;
+      memset(&cr, 0, sizeof(cr));
+      /* Get the pool from client=<client-name> */
+      if (!get_client_dbr(ua, &cr)) {
+         goto bail_out;
+      }
+      sr->ClientId = cr.ClientId;
+      db_list_snapshot_records(ua->jcr, ua->db, sr, prtit, ua, HORZ_LIST);
+      if (!get_cmd(ua, _("Enter a SnapshotId: "))) {
+         goto bail_out;
+      }
+      p = ua->cmd;
+      if (*p == '*') {
+         p++;
+      }
+      if (is_a_number(p)) {
+         sr->SnapshotId = str_to_int64(p);
+      } else {
+         goto bail_out;
+      }
+   }
+
+   if (!get_snapshot_record(ua, sr)) {
+      ua->error_msg(_("Unable to get Snapshot record.\n"));
+      goto bail_out;
+   }
+
+   ret = 1;
+
+bail_out:
+   if (!ret && *err) {
+      ua->error_msg("%s", err);
+   }
+   free_pool_memory(err);
+   return ret;
+}
+
+/* This part should be in ua_update.c */
+static void update_snapretention(UAContext *ua, char *val, SNAPSHOT_DBR *sr)
+{
+   char ed1[150];
+   POOL_MEM tmp(PM_MESSAGE);
+   bool ret;
+   if (!duration_to_utime(val, &sr->Retention)) {
+      ua->error_msg(_("Invalid retention period specified: %s\n"), val);
+      return;
+   }
+
+   db_lock(ua->db);
+   if (!(ret = db_update_snapshot_record(ua->jcr, ua->db, sr))) {
+      pm_strcpy(tmp, db_strerror(ua->db));
+   }
+   db_unlock(ua->db);
+
+   if (!ret) {
+      ua->error_msg("%s", tmp.c_str());
+
+   } else {
+      ua->info_msg(_("New retention period is: %s\n"),
+         edit_utime(sr->Retention, ed1, sizeof(ed1)));
+   }
+}
+
+/* This part should be in ua_update.c */
+static void update_snapcomment(UAContext *ua, char *val, SNAPSHOT_DBR *sr)
+{
+   POOL_MEM tmp(PM_MESSAGE);
+   bool ret;
+
+   bstrncpy(sr->Comment, val, sizeof(sr->Comment));
+
+   db_lock(ua->db);
+   if (!(ret = db_update_snapshot_record(ua->jcr, ua->db, sr))) {
+      pm_strcpy(tmp, db_strerror(ua->db));
+   }
+   db_unlock(ua->db);
+
+   if (!ret) {
+      ua->error_msg("%s", tmp.c_str());
+
+   } else {
+      ua->info_msg(_("New Comment is: %s\n"), sr->Comment);
+   }
+}
+
+/* This part should be in ua_update.c */
+bool update_snapshot(UAContext *ua)
+{
+   SNAPSHOT_DBR sr;
+   POOL_MEM ret;
+   char ed1[130];
+   bool done = false;
+   int i;
+   const char *kw[] = {
+      NT_("Retention"),                /* 0 */
+      NT_("Comment"),                  /* 1 */
+      NULL };
+
+   for (i=0; kw[i]; i++) {
+      int j;
+      if ((j=find_arg_with_value(ua, kw[i])) > 0) {
+         /* If all from pool don't select a media record */
+         if (!select_snapshot_dbr(ua, &sr)) {
+            return 0;
+         }
+         switch (i) {
+         case 0:
+            update_snapretention(ua, ua->argv[j], &sr);
+            break;
+         case 1:
+            update_snapcomment(ua, ua->argv[j], &sr);
+            break;
+         default:
+            break;
+         }
+         done = true;
+      }
+   }
+
+   for ( ; !done; ) {
+      start_prompt(ua, _("Parameters to modify:\n"));
+      add_prompt(ua, _("Snapshot Retention Period"));  /* 0 */
+      add_prompt(ua, _("Snapshot Comment"));           /* 1 */
+      add_prompt(ua, _("Done"));                       /* 2 */
+      i = do_prompt(ua, "", _("Select parameter to modify"), NULL, 0);
+      if (i == 2) {
+         return 0;
+      }
+
+      if (!select_snapshot_dbr(ua, &sr)) {  /* Get Snapshot record */
+         return 0;
+      }
+      ua->info_msg(_("Updating Snapshot \"%s\" on \"%s\"\n"), sr.Name, sr.Client);
+
+      switch (i) {
+      case 0:                         /* Snapshot retention */
+         ua->info_msg(_("Current retention period is: %s\n"),
+            edit_utime(sr.Retention, ed1, sizeof(ed1)));
+         if (!get_cmd(ua, _("Enter Snapshot Retention period: "))) {
+            return 0;
+         }
+         update_snapretention(ua, ua->cmd, &sr);
+         break;
+      case 1:
+         ua->info_msg(_("Current comment is: %s\n"), NPRTB(sr.Comment));
+         if (!get_cmd(ua, _("Enter Snapshot comment: "))) {
+            return 0;
+         }
+         update_snapcomment(ua, ua->cmd, &sr);
+         break;
+      default:                        /* Done or error */
+         ua->info_msg(_("Selection terminated.\n"));
+         return 1;
+      }
+   }
+   return 1;
+}
diff --git a/src/dird/ua.h b/src/dird/ua.h
index 0e3e855..aed04ce 100644
--- a/src/dird/ua.h
+++ b/src/dird/ua.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Includes specific to the Director User Agent Server
@@ -28,9 +32,9 @@ public:
    BSOCK *UA_sock;
    BSOCK *sd;
    JCR *jcr;
-   B_DB *db;                          /* Pointing to shared or private db */
-   B_DB *shared_db;                   /* Main Bacula DB access */
-   B_DB *private_db;                  /* Private DB access */
+   BDB *db;                          /* Pointing to shared or private db */
+   BDB *shared_db;                   /* Main Bacula DB access */
+   BDB *private_db;                  /* Private DB access */
    CAT *catalog;
    CONRES *cons;                      /* console resource */
    POOLMEM *cmd;                      /* return command/name buffer */
@@ -122,6 +126,8 @@ struct RESTORE_CTX {
    bool all;                          /* mark all as default */
    bool hardlinks_in_mem;             /* keep hard links in memory */
    NAME_LIST name_list;
+   POOLMEM *component_fname;
+   FILE *component_fd;
 };
 
 #define MAX_ID_LIST_LEN 2000000
diff --git a/src/dird/ua_acl.c b/src/dird/ua_acl.c
index 4b70374..23a0ec8 100644
--- a/src/dird/ua_acl.c
+++ b/src/dird/ua_acl.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2004-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
diff --git a/src/dird/ua_cmds.c b/src/dird/ua_cmds.c
index b01b8cc..ab8d979 100644
--- a/src/dird/ua_cmds.c
+++ b/src/dird/ua_cmds.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -78,6 +82,7 @@ static void do_job_delete(UAContext *ua, JobId_t JobId);
 static int delete_volume(UAContext *ua);
 static int delete_pool(UAContext *ua);
 static void delete_job(UAContext *ua);
+static void do_storage_cmd(UAContext *ua, const char *command);
 
 int qhelp_cmd(UAContext *ua, const char *cmd);
 int quit_cmd(UAContext *ua, const char *cmd);
@@ -97,7 +102,7 @@ static struct cmdstruct commands[] = {                                      /* C
  { NT_("automount"),   automount_cmd,  _("Automount after label"),        NT_("on | off"),    false},
  { NT_("cancel"),     cancel_cmd,    _("Cancel a job"), NT_("jobid=<number-list> | job=<job-name> | ujobid=<unique-jobid> | inactive client=<client-name> storage=<storage-name> | all"), false},
  { NT_("create"),     create_cmd,    _("Create DB Pool from resource"), NT_("pool=<pool-name>"),                    false},
- { NT_("delete"),     delete_cmd,    _("Delete volume, pool or job"), NT_("volume=<vol-name> pool=<pool-name> jobid=<id>"), true},
+ { NT_("delete"),     delete_cmd,    _("Delete volume, pool or job"), NT_("volume=<vol-name> | pool=<pool-name> | jobid=<id> | snapshot"), true},
  { NT_("disable"),    disable_cmd,   _("Disable a job, attributes batch process"), NT_("job=<name> | batch"),  true},
  { NT_("enable"),     enable_cmd,    _("Enable a job, attributes batch process"), NT_("job=<name> | batch"),   true},
  { NT_("estimate"),   estimate_cmd,  _("Performs FileSet estimate, listing gives full listing"),
@@ -108,23 +113,24 @@ static struct cmdstruct commands[] = {                                      /* C
  { NT_("help"),       help_cmd,      _("Print help on specific command"),
    NT_("add autodisplay automount cancel create delete disable\n\tenable estimate exit gui label list llist"
        "\n\tmessages memory mount prune purge quit query\n\trestore relabel release reload run status"
-       "\n\tsetbandwidth setdebug setip show sqlquery time trace unmount\n\tumount update use var version wait"),         false},
+       "\n\tsetbandwidth setdebug setip show sqlquery time trace unmount\n\tumount update use var version wait"
+       "\n\tsnapshot"),         false},
 
  { NT_("label"),      label_cmd,     _("Label a tape"), NT_("storage=<storage> volume=<vol> pool=<pool> slot=<slot> barcodes"), false},
  { NT_("list"),       list_cmd,      _("List objects from catalog"),
    NT_("pools | jobs | jobtotals | volume | media <pool=pool-name> | files jobid=<nn> | copies jobid=<nn> |\n"
-       "\tjoblog jobid=<nn>"), false},
+       "\tjoblog jobid=<nn> | snapshot"), false},
 
  { NT_("llist"),      llist_cmd,     _("Full or long list like list command"),
-   NT_("pools | jobs | joblog jobid=<nn> | jobtotals | media <pool=pool-name> | files jobid=<nn> | copies jobid=<nn>"), true},
+   NT_("pools | jobs | joblog jobid=<nn> | jobtotals | media <pool=pool-name> | files jobid=<nn> | copies jobid=<nn> | snapshot"), false},
 
  { NT_("messages"),   messagescmd,   _("Display pending messages"),   NT_(""),    false},
  { NT_("memory"),     memory_cmd,    _("Print current memory usage"), NT_(""),    true},
  { NT_("mount"),      mount_cmd,     _("Mount storage"),
-   NT_("storage=<storage-name> slot=<num> drive=<num> [ jobid=<id> | job=<job-name> ]"), false},
+   NT_("storage=<storage-name> slot=<num> drive=<num> [ device=<device-name> ] [ jobid=<id> | job=<job-name> ]"), false},
 
  { NT_("prune"),      prunecmd,      _("Prune expired records from catalog"),
-   NT_("files | jobs | pool=<pool> | client=<client-name> | [ expired ] volume=<volume-name> "), true},
+   NT_("files | jobs | pool=<pool> | snapshot  [client=<client-name>] | client=<client-name> | [ expired ] volume=<volume-name> "), true},
 
  { NT_("purge"),      purge_cmd,     _("Purge records from catalog"), NT_("files jobs volume=<vol> [mediatype=<type> pool=<pool> allpools storage=<st> drive=<num>]"),  true},
  { NT_("quit"),       quit_cmd,      _("Terminate Bconsole session"), NT_(""),              false},
@@ -137,26 +143,40 @@ static struct cmdstruct commands[] = {                                      /* C
  { NT_("relabel"),    relabel_cmd,   _("Relabel a tape"),
    NT_("storage=<storage-name> oldvolume=<old-volume-name>\n\tvolume=<newvolume-name> pool=<pool>"), false},
 
- { NT_("release"),    release_cmd,   _("Release storage"),  NT_("storage=<storage-name>"),      false},
+ { NT_("release"),    release_cmd,   _("Release storage"),  NT_("storage=<storage-name> [ device=<device-name> ] "),      false},
  { NT_("reload"),     reload_cmd,    _("Reload conf file"), NT_(""),                  true},
  { NT_("run"),        run_cmd,       _("Run a job"),
    NT_("job=<job-name> client=<client-name>\n\tfileset=<FileSet-name> level=<level-keyword>\n\tstorage=<storage-name>"
        " where=<directory-prefix>\n\twhen=<universal-time-specification> pool=<pool-name>\n\t"
        " nextpool=<next-pool-name> comment=<text> accurate=<bool> spooldata=<bool> yes"), false},
 
+ { NT_("restart"),    restart_cmd,   _("Restart a job"),
+   NT_("incomplete job=<job-name> client=<client-name>\n\tfileset=<FileSet-name> level=<level-keyword>\n\tstorage=<storage-name>"
+       "when=<universal-time-specification>\n\tcomment=<text> spooldata=<bool> jobid=<jobid>"), false},
+
+ { NT_("resume"),    restart_cmd,   _("Resume a job"),
+   NT_("incomplete job=<job-name> client=<client-name>\n\tfileset=<FileSet-name> level=<level-keyword>\n\tstorage=<storage-name>"
+       "when=<universal-time-specification>\n\tcomment=<text> spooldata=<bool> jobid=<jobid>"), false},
+
  { NT_("status"),     status_cmd,    _("Report status"),
-   NT_("all | dir=<dir-name> | director | client=<client-name> | storage=<storage-name> slots | days=nnn"), true},
+   NT_("all | dir=<dir-name> | director | client=<client-name> |\n"
+       "\tstorage=<storage-name> slots |\n"
+       "\tschedule [job=<job-name>] [days=<nn>] [limit=<nn>] [toto]\n"
+       "\t\t[time=<universal-time-specification>]"), true},
 
  { NT_("stop"),       cancel_cmd,    _("Stop a job"), NT_("jobid=<number-list> job=<job-name> ujobid=<unique-jobid> all"), false},
  { NT_("setdebug"),   setdebug_cmd,  _("Sets debug level"),
-   NT_("level=<nn> trace=0/1 client=<client-name> | dir | storage=<storage-name> | all"), true},
+   NT_("level=<nn> tags=<tags> trace=0/1 options=<0tTc> tags=<tags> | client=<client-name> | dir | storage=<storage-name> | all"), true},
 
  { NT_("setbandwidth"),   setbwlimit_cmd,  _("Sets bandwidth"),
    NT_("limit=<nn-kbs> client=<client-name> jobid=<number> job=<job-name> ujobid=<unique-jobid>"), true},
 
+ { NT_("snapshot"),   snapshot_cmd,  _("Handle snapshots"), 
+   NT_("[client=<client-name> | job=<job-name> | jobid=<jobid>] [delete | list | listclient | prune | sync | update]"), true},
+
  { NT_("setip"),      setip_cmd,     _("Sets new client address -- if authorized"), NT_(""),   false},
  { NT_("show"),       show_cmd,      _("Show resource records"),
-   NT_("job=<xxx> |  pool=<yyy> | fileset=<aaa> schedule=<sss> | client=<zzz> | disabled | all"), true},
+   NT_("job=<xxx> |  pool=<yyy> | fileset=<aaa> | schedule=<sss> | client=<zzz> | storage=<sss> | disabled | all"), true},
 
  { NT_("sqlquery"),   sqlquerycmd,   _("Use SQL to query catalog"), NT_(""),          false},
  { NT_("time"),       time_cmd,      _("Print current time"),       NT_(""),          true},
@@ -166,10 +186,10 @@ static struct cmdstruct commands[] = {                                      /* C
    NT_("storage=<storage-name> [ drive=<num> ] | jobid=<id> | job=<job-name>"), false},
 
  { NT_("umount"),     unmount_cmd,   _("Umount - for old-time Unix guys, see unmount"),
-   NT_("storage=<storage-name> [ drive=<num> ] | jobid=<id> | job=<job-name>"), false},
+   NT_("storage=<storage-name> [ drive=<num> ] [ device=<dev-name> ]| jobid=<id> | job=<job-name>"), false},
 
  { NT_("update"),     update_cmd,    _("Update volume, pool or stats"),
-   NT_("stats\n\tpool=<poolname>\n\tslots storage=<storage> scan"
+   NT_("stats\n\tsnapshot\n\tpool=<poolname>\n\tslots storage=<storage> scan"
        "\n\tvolume=<volname> volstatus=<status> volretention=<time-def>"
        "\n\t pool=<pool> recycle=<yes/no> slot=<number>\n\t inchanger=<yes/no>"
        "\n\t maxvolbytes=<size> maxvolfiles=<nb> maxvoljobs=<nb>"
@@ -226,7 +246,7 @@ bool do_a_command(UAContext *ua)
          if (ua->api) user->signal(BNET_CMD_BEGIN);
          ok = (*commands[i].func)(ua, ua->cmd);   /* go execute command */
          if (ua->api) user->signal(ok?BNET_CMD_OK:BNET_CMD_FAILED);
-         found = true;
+         found = (user && user->is_stop()) ? false : true;
          break;
       }
    }
@@ -430,7 +450,8 @@ int automount_cmd(UAContext *ua, const char *cmd)
 }
 
 /*
- * Cancel a job
+ * Cancel/Stop a job -- Stop marks it as Incomplete
+ *   so that it can be restarted.
  */
 static int cancel_cmd(UAContext *ua, const char *cmd)
 {
@@ -499,7 +520,7 @@ void set_pooldbr_from_poolres(POOL_DBR *pr, POOL *pool, e_pool_op op)
 }
 
 /* set/update Pool.RecyclePoolId and Pool.ScratchPoolId in Catalog */
-int update_pool_references(JCR *jcr, B_DB *db, POOL *pool)
+int update_pool_references(JCR *jcr, BDB *db, POOL *pool)
 {
    POOL_DBR  pr;
 
@@ -531,7 +552,7 @@ int update_pool_references(JCR *jcr, B_DB *db, POOL *pool)
 /* set POOL_DBR.RecyclePoolId and POOL_DBR.ScratchPoolId from Pool resource
  * works with set_pooldbr_from_poolres
  */
-bool set_pooldbr_references(JCR *jcr, B_DB *db, POOL_DBR *pr, POOL *pool)
+bool set_pooldbr_references(JCR *jcr, BDB *db, POOL_DBR *pr, POOL *pool)
 {
    POOL_DBR rpool;
    bool ret = true;
@@ -583,7 +604,7 @@ bool set_pooldbr_references(JCR *jcr, B_DB *db, POOL_DBR *pr, POOL *pool)
  *           1  record created
  */
 
-int create_pool(JCR *jcr, B_DB *db, POOL *pool, e_pool_op op)
+int create_pool(JCR *jcr, BDB *db, POOL *pool, e_pool_op op)
 {
    POOL_DBR  pr;
    memset(&pr, 0, sizeof(POOL_DBR));
@@ -650,11 +671,14 @@ extern char *configfile;
 
 static int setbwlimit_client(UAContext *ua, CLIENT *client, char *Job, int64_t limit)
 {
+   CLIENT *old_client;
+
    if (!client) {
       return 1;
    }
 
    /* Connect to File daemon */
+   old_client = ua->jcr->client;
    ua->jcr->client = client;
    ua->jcr->max_bandwidth = limit;
 
@@ -663,7 +687,7 @@ static int setbwlimit_client(UAContext *ua, CLIENT *client, char *Job, int64_t l
       client->name(), client->address, client->FDport);
    if (!connect_to_file_daemon(ua->jcr, 1, 15, 0)) {
       ua->error_msg(_("Failed to connect to Client.\n"));
-      return 1;
+      goto bail_out;
    }
    Dmsg0(120, "Connected to file daemon\n");
 
@@ -671,14 +695,17 @@ static int setbwlimit_client(UAContext *ua, CLIENT *client, char *Job, int64_t l
       ua->error_msg(_("Failed to set bandwidth limit to Client.\n"));
 
    } else {
+      /* Note, we add 2000 OK that was sent by FD to us to message */
       ua->info_msg(_("2000 OK Limiting bandwidth to %lldkb/s %s\n"),
                    limit/1024, *Job?Job:_("on running and future jobs"));
    }
 
    ua->jcr->file_bsock->signal(BNET_TERMINATE);
    free_bsock(ua->jcr->file_bsock);
-   ua->jcr->client = NULL;
    ua->jcr->max_bandwidth = 0;
+
+bail_out:
+   ua->jcr->client = old_client;
    return 1;
 }
 
@@ -723,8 +750,8 @@ static int setbwlimit_cmd(UAContext *ua, const char *cmd)
          jcr->max_bandwidth = limit; /* TODO: see for locking (Should be safe)*/
          bstrncpy(Job, jcr->Job, sizeof(Job));
          client = jcr->client;
-         free_jcr(jcr);
          setbwlimit_client(ua, client, Job, limit);
+         free_jcr(jcr);
       }
 
    } else {
@@ -770,10 +797,15 @@ get_out:
    return 1;
 }
 
-
-static void do_en_disable_cmd(UAContext *ua, bool setting)
+/*
+ * Does all sorts of enable/disable commands: batch, scheduler (not implemented)
+ *  job, client, schedule, storage
+ */
+static void do_enable_disable_cmd(UAContext *ua, bool setting)
 {
-   JOB *job;
+   JOB *job = NULL;
+   CLIENT *client = NULL;
+   SCHED *sched = NULL;
    int i;
 
    if (find_arg(ua, NT_("batch")) > 0) {
@@ -789,45 +821,99 @@ static void do_en_disable_cmd(UAContext *ua, bool setting)
     * }
     */
 
-   i = find_arg_with_value(ua, NT_("job"));
-   if (i < 0) {
-      job = select_enable_disable_job_resource(ua, setting);
-      if (!job) {
+   i = find_arg(ua, NT_("job"));
+   if (i >= 0) {
+      if (ua->argv[i]) {
+         LockRes();
+         job = GetJobResWithName(ua->argv[i]);
+         UnlockRes();
+      } else {
+         job = select_enable_disable_job_resource(ua, setting);
+         if (!job) {
+            return;
+         }
+      }
+   }
+   if (job) {
+      if (!acl_access_ok(ua, Job_ACL, job->name())) {
+         ua->error_msg(_("Unauthorized command from this console.\n"));
          return;
       }
-   } else {
-      LockRes();
-      job = GetJobResWithName(ua->argv[i]);
-      UnlockRes();
+      job->enabled = setting;
+      ua->send_msg(_("Job \"%s\" %sabled\n"), job->name(), setting?"en":"dis");
    }
-   if (!job) {
-      ua->error_msg(_("Job \"%s\" not found.\n"), ua->argv[i]);
-      return;
+
+   i = find_arg(ua, NT_("client"));
+   if (i >= 0) {
+      if (ua->argv[i]) {
+         LockRes();
+         client = GetClientResWithName(ua->argv[i]);
+         UnlockRes();
+      } else {
+         client = select_enable_disable_client_resource(ua, setting);
+         if (!client) {
+            return;
+         }
+      }
+   }
+   if (client) {
+      if (!acl_access_ok(ua, Client_ACL, client->name())) {
+         ua->error_msg(_("Unauthorized command from this console.\n"));
+         return;
+      }
+      client->enabled = setting;
+      ua->send_msg(_("Client \"%s\" %sabled\n"), client->name(), setting?"en":"dis");
    }
 
-   if (!acl_access_ok(ua, Job_ACL, job->name())) {
-      ua->error_msg(_("Unauthorized command from this console.\n"));
-      return;
+   i = find_arg(ua, NT_("schedule"));
+   if (i >= 0) {
+      if (ua->argv[i]) {
+         LockRes();
+         sched = (SCHED *)GetResWithName(R_SCHEDULE, ua->argv[i]);
+         UnlockRes();
+      } else {
+         sched = select_enable_disable_schedule_resource(ua, setting);
+         if (!sched) {
+            return;
+         }
+      }
+   }
+   if (sched) {
+      if (!acl_access_ok(ua, Schedule_ACL, sched->name())) {
+         ua->error_msg(_("Unauthorized command from this console.\n"));
+         return;
+      }
+      sched->enabled = setting;
+      ua->send_msg(_("Schedule \"%s\" %sabled\n"), sched->name(), setting?"en":"dis");
    }
-   job->enabled = setting;
-   ua->send_msg(_("Job \"%s\" %sabled\n"), job->name(), setting?"en":"dis");
+
+   i = find_arg(ua, NT_("storage"));
+   if (i >= 0) {
+      do_storage_cmd(ua, setting?"enable":"disable");
+   }
+
+   if (i < 0 && !sched && !client && !job) {
+      ua->error_msg(_("You must enter one of the following keywords: job, client, schedule, or storage.\n"));
+   }
+
    return;
 }
 
 static int enable_cmd(UAContext *ua, const char *cmd)
 {
-   do_en_disable_cmd(ua, true);
+   do_enable_disable_cmd(ua, true);
    return 1;
 }
 
 static int disable_cmd(UAContext *ua, const char *cmd)
 {
-   do_en_disable_cmd(ua, false);
+   do_enable_disable_cmd(ua, false);
    return 1;
 }
 
 static void do_storage_setdebug(UAContext *ua, STORE *store,
-                                int64_t level, int trace_flag, char *options, char *tags)
+               int64_t level, int trace_flag, int hangup, int blowup,
+               char *options, char *tags)
 {
    BSOCK *sd;
    USTORE lstore;
@@ -844,8 +930,8 @@ static void do_storage_setdebug(UAContext *ua, STORE *store,
    }
    Dmsg0(120, _("Connected to storage daemon\n"));
    sd = ua->jcr->store_bsock;
-   sd->fsend("setdebug=%ld trace=%ld hangup=0 options=%s tags=%s\n",
-             (int32_t)level, trace_flag, options, NPRTB(tags));
+   sd->fsend("setdebug=%ld trace=%ld hangup=%ld blowup=%ld options=%s tags=%s\n",
+             (int32_t)level, trace_flag, hangup, blowup, options, NPRTB(tags));
    if (sd->recv() >= 0) {
       ua->send_msg("%s", sd->msg);
    }
@@ -859,45 +945,53 @@ static void do_storage_setdebug(UAContext *ua, STORE *store,
  *  level = debug level
  *  trace = send debug output to a file
  *  options = various options for debug or specific FD behavior
- *  hangup = how many records to send to SD before hanging up
+ *  hangup = how many records to send to FD before hanging up
  *    obviously this is most useful for testing restarting
  *    failed jobs.
+ *  blowup = how many records to send to FD before blowing up the FD.
  */
 static void do_client_setdebug(UAContext *ua, CLIENT *client,
-                               int64_t level, int trace, int hangup, char *options, char *tags)
+               int64_t level, int trace, int hangup, int blowup,
+               char *options, char *tags)
 {
+   CLIENT *old_client;
    BSOCK *fd;
 
    /* Connect to File daemon */
 
+   old_client = ua->jcr->client;
    ua->jcr->client = client;
    /* Try to connect for 15 seconds */
    ua->send_msg(_("Connecting to Client %s at %s:%d\n"),
       client->name(), client->address, client->FDport);
    if (!connect_to_file_daemon(ua->jcr, 1, 15, 0)) {
       ua->error_msg(_("Failed to connect to Client.\n"));
+      ua->jcr->client = old_client;
       return;
    }
    Dmsg0(120, "Connected to file daemon\n");
 
    fd = ua->jcr->file_bsock;
-   if (ua->jcr->FDVersion < 8 || !options) {
+   if (ua->jcr->FDVersion <= 10) {
       fd->fsend("setdebug=%ld trace=%d hangup=%d\n",
                 (int32_t)level, trace, hangup);
    } else {
-      fd->fsend("setdebug=%ld trace=%d hangup=%d options=%s tags=%s\n",
-                (int32_t)level, trace, hangup, options, NPRTB(tags));
+      fd->fsend("setdebug=%ld trace=%d hangup=%d blowup=%d options=%s tags=%s\n",
+                (int32_t)level, trace, hangup, blowup, options, NPRTB(tags));
    }
    if (fd->recv() >= 0) {
       ua->send_msg("%s", fd->msg);
    }
    fd->signal(BNET_TERMINATE);
    free_bsock(ua->jcr->file_bsock);
+   ua->jcr->client = old_client;
    return;
 }
 
 
-static void do_all_setdebug(UAContext *ua, int64_t level, int trace_flag, int hangup, char *options, char *tags)
+static void do_all_setdebug(UAContext *ua, int64_t level,
+               int trace_flag, int hangup, int blowup,
+               char *options, char *tags)
 {
    STORE *store, **unique_store;
    CLIENT *client, **unique_client;
@@ -936,7 +1030,8 @@ static void do_all_setdebug(UAContext *ua, int64_t level, int trace_flag, int ha
 
    /* Call each unique Storage daemon */
    for (j=0; j<i; j++) {
-      do_storage_setdebug(ua, unique_store[j], level, trace_flag, options, tags);
+      do_storage_setdebug(ua, unique_store[j], level, trace_flag,
+         hangup, blowup, options, tags);
    }
    free(unique_store);
 
@@ -970,7 +1065,8 @@ static void do_all_setdebug(UAContext *ua, int64_t level, int trace_flag, int ha
 
    /* Call each unique File daemon */
    for (j=0; j<i; j++) {
-      do_client_setdebug(ua, unique_client[j], level, trace_flag, hangup, options, tags);
+      do_client_setdebug(ua, unique_client[j], level, trace_flag,
+         hangup, blowup, options, tags);
    }
    free(unique_client);
 }
@@ -985,6 +1081,7 @@ static int setdebug_cmd(UAContext *ua, const char *cmd)
    int64_t level=0, tags=0;
    int trace_flag = -1;
    int hangup = -1;
+   int blowup = -1;
    int i;
    char *tags_str=NULL;
    char options[60];
@@ -1029,22 +1126,28 @@ static int setdebug_cmd(UAContext *ua, const char *cmd)
       }
    }
 
-   /* Look for hangup (debug only)flag. -1 => not change */
+   /* Look for hangup (debug only) flag. -1 => not change */
    i = find_arg_with_value(ua, "hangup");
    if (i >= 0) {
       hangup = atoi(ua->argv[i]);
    }
 
+   /* Look for blowup (debug only) flag. -1 => not change */
+   i = find_arg_with_value(ua, "blowup");
+   if (i >= 0) {
+      blowup = atoi(ua->argv[i]);
+   }
 
    /* General debug? */
    for (i=1; i<ua->argc; i++) {
       if (strcasecmp(ua->argk[i], "all") == 0) {
-         do_all_setdebug(ua, level, trace_flag, hangup, options, tags_str);
+         do_all_setdebug(ua, level, trace_flag, hangup, blowup, options, tags_str);
          return 1;
       }
       if (strcasecmp(ua->argk[i], "dir") == 0 ||
           strcasecmp(ua->argk[i], "director") == 0) {
-         debug_level = level | tags;
+         debug_level = level;
+         debug_level_tags = tags;
          set_trace(trace_flag);
          set_debug_flags(options);
          return 1;
@@ -1055,13 +1158,15 @@ static int setdebug_cmd(UAContext *ua, const char *cmd)
          if (ua->argv[i]) {
             client = GetClientResWithName(ua->argv[i]);
             if (client) {
-               do_client_setdebug(ua, client, level, trace_flag, hangup, options, tags_str);
+               do_client_setdebug(ua, client, level, trace_flag,
+                  hangup, blowup, options, tags_str);
                return 1;
             }
          }
          client = select_client_resource(ua);
          if (client) {
-            do_client_setdebug(ua, client, level, trace_flag, hangup, options, tags_str);
+            do_client_setdebug(ua, client, level, trace_flag,
+               hangup, blowup, options, tags_str);
             return 1;
          }
       }
@@ -1073,13 +1178,15 @@ static int setdebug_cmd(UAContext *ua, const char *cmd)
          if (ua->argv[i]) {
             store = GetStoreResWithName(ua->argv[i]);
             if (store) {
-               do_storage_setdebug(ua, store, level, trace_flag, options, tags_str);
+               do_storage_setdebug(ua, store, level, trace_flag,
+                  hangup, blowup, options, tags_str);
                return 1;
             }
          }
          store = get_storage_resource(ua, false/*no default*/, true/*unique*/);
          if (store) {
-            do_storage_setdebug(ua, store, level, trace_flag, options, tags_str);
+            do_storage_setdebug(ua, store, level, trace_flag,
+               hangup, blowup, options, tags_str);
             return 1;
          }
       }
@@ -1095,24 +1202,26 @@ static int setdebug_cmd(UAContext *ua, const char *cmd)
    add_prompt(ua, _("All"));
    switch(do_prompt(ua, "", _("Select daemon type to set debug level"), NULL, 0)) {
    case 0:                         /* Director */
-      debug_level = level | tags;
+      debug_level = level;
       set_trace(trace_flag);
       set_debug_flags(options);
       break;
    case 1:
       store = get_storage_resource(ua, false/*no default*/, true/*unique*/);
       if (store) {
-         do_storage_setdebug(ua, store, level, trace_flag, options, tags_str);
+         do_storage_setdebug(ua, store, level, trace_flag, hangup, blowup,
+            options, tags_str);
       }
       break;
    case 2:
       client = select_client_resource(ua);
       if (client) {
-         do_client_setdebug(ua, client, level, trace_flag, hangup, options, tags_str);
+         do_client_setdebug(ua, client, level, trace_flag, hangup, blowup,
+            options, tags_str);
       }
       break;
    case 3:
-      do_all_setdebug(ua, level, trace_flag, hangup, options, tags_str);
+      do_all_setdebug(ua, level, trace_flag, hangup, blowup, options, tags_str);
       break;
    default:
       break;
@@ -1129,7 +1238,7 @@ static int trace_cmd(UAContext *ua, const char *cmd)
 
    if (ua->argc != 2) {
       if (!get_cmd(ua, _("Turn on or off? "))) {
-            return 1;
+         return 1;
       }
       onoff = ua->cmd;
    } else {
@@ -1138,7 +1247,6 @@ static int trace_cmd(UAContext *ua, const char *cmd)
 
    set_trace((strcasecmp(onoff, NT_("off")) == 0) ? false : true);
    return 1;
-
 }
 
 static int var_cmd(UAContext *ua, const char *cmd)
@@ -1235,11 +1343,12 @@ static int estimate_cmd(UAContext *ua, const char *cmd)
          if (ua->argv[i]) {
             if (!get_level_from_name(ua->jcr, ua->argv[i])) {
                ua->error_msg(_("Level \"%s\" not valid.\n"), ua->argv[i]);
+               return 1;
             }
             continue;
          } else {
-            ua->error_msg(_("Level value missing.\n"));
-            return 1;
+            ua->error_msg(_("Level value missing.\n")); 
+            return 1; 
          }
       }
       if (strcasecmp(ua->argk[i], NT_("accurate")) == 0) {
@@ -1247,11 +1356,12 @@ static int estimate_cmd(UAContext *ua, const char *cmd)
             if (!is_yesno(ua->argv[i], &accurate)) {
                ua->error_msg(_("Invalid value for accurate. "
                                "It must be yes or no.\n"));
+               return 1;
             }
             continue;
          } else {
             ua->error_msg(_("Accurate value missing.\n"));
-            return 1;
+            return 1; 
          }
       }
    }
@@ -1354,7 +1464,6 @@ bail_out:
    return 1;
 }
 
-
 /*
  * print time
  */
@@ -1393,6 +1502,7 @@ static int delete_cmd(UAContext *ua, const char *cmd)
       NT_("volume"),
       NT_("pool"),
       NT_("jobid"),
+      NT_("snapshot"),
       NULL};
 
    /* Deleting large jobs can take time! */
@@ -1409,11 +1519,14 @@ static int delete_cmd(UAContext *ua, const char *cmd)
       return 1;
    case 2:
       int i;
-      while ((i = find_arg(ua, "jobid")) > 0) {
+      while ((i=find_arg(ua, "jobid")) > 0) {
          delete_job(ua);
          *ua->argk[i] = 0;         /* zap keyword already visited */
       }
       return 1;
+   case 3:
+      delete_snapshot(ua);
+      return 1;
    default:
       break;
    }
@@ -1432,6 +1545,9 @@ static int delete_cmd(UAContext *ua, const char *cmd)
    case 2:
       delete_job(ua);
       return 1;
+   case 3:
+      delete_snapshot(ua);
+      return 1;
    default:
       ua->warning_msg(_("Nothing done.\n"));
       break;
@@ -1440,31 +1556,31 @@ static int delete_cmd(UAContext *ua, const char *cmd)
 }
 
 /*
- * delete_job has been modified to parse JobID lists like the following:
+ * delete_job has been modified to parse JobID lists like the
+ * following:
  * delete JobID=3,4,6,7-11,14
  *
  * Thanks to Phil Stracchino for the above addition.
  */
 static void delete_job(UAContext *ua)
 {
-   int i;
    int JobId;               /* not JobId_t because it's unsigned and not compatible with sellist */
    char buf[256];
    sellist sl;
 
-   i = find_arg_with_value(ua, NT_("jobid"));
+   int i = find_arg_with_value(ua, NT_("jobid"));
    if (i >= 0) {
       if (!sl.set_string(ua->argv[i], true)) {
          ua->warning_msg("%s", sl.get_errmsg());
          return;
-      }
-
+      } 
+ 
       if (sl.size() > 25 && (find_arg(ua, "yes") < 0)) {
          bsnprintf(buf, sizeof(buf),
                    _("Are you sure you want to delete %d JobIds ? (yes/no): "), sl.size());
          if (!get_yesno(ua, buf)) {
             return;
-         }
+         } 
       }
 
       foreach_sellist(JobId, &sl) {
@@ -1489,7 +1605,7 @@ static void do_job_delete(UAContext *ua, JobId_t JobId)
 
    edit_int64(JobId, ed1);
    purge_jobs_from_catalog(ua, ed1);
-   ua->send_msg(_("Jobid %s and associated records deleted from the catalog.\n"), ed1);
+   ua->send_msg(_("JobId=%s and associated records deleted from the catalog.\n"), ed1);
 }
 
 /*
@@ -1568,14 +1684,14 @@ int memory_cmd(UAContext *ua, const char *cmd)
    return 1;
 }
 
-static void do_mount_cmd(UAContext *ua, const char *command)
+static void do_storage_cmd(UAContext *ua, const char *command)
 {
    USTORE store;
    BSOCK *sd;
    JCR *jcr = ua->jcr;
    char dev_name[MAX_NAME_LENGTH];
-   int drive;
-   int slot = -1;
+   int drive, i;
+   int slot;
 
    if (!open_client_db(ua)) {
       return;
@@ -1589,25 +1705,34 @@ static void do_mount_cmd(UAContext *ua, const char *command)
    pm_strcpy(store.store_source, _("unknown source"));
    set_wstorage(jcr, &store);
    drive = get_storage_drive(ua, store.store);
-   if (strcmp(command, "mount") == 0) {
-      slot = get_storage_slot(ua, store.store);
+   slot = get_storage_slot(ua, store.store);
+
+   /* Users may set a device name directly on the command line */
+   if ((i = find_arg_with_value(ua, "device")) > 0) {
+      POOLMEM *errmsg = get_pool_memory(PM_NAME);
+      if (!is_name_valid(ua->argv[i], &errmsg)) {
+         ua->error_msg(_("Invalid device name. %s"), errmsg);
+         free_pool_memory(errmsg);
+         return;
+      }
+      free_pool_memory(errmsg);
+      bstrncpy(dev_name, ua->argv[i], sizeof(dev_name));
+
+   } else {                     /* We take the default device name */
+      bstrncpy(dev_name, store.store->dev_name(), sizeof(dev_name));
    }
 
    Dmsg3(120, "Found storage, MediaType=%s DevName=%s drive=%d\n",
       store.store->media_type, store.store->dev_name(), drive);
+   Dmsg4(120, "Cmd: %s %s drive=%d slot=%d\n", command, dev_name, drive, slot);
 
    if (!connect_to_storage_daemon(jcr, 10, SDConnectTimeout, 1)) {
       ua->error_msg(_("Failed to connect to Storage daemon.\n"));
       return;
    }
    sd = jcr->store_bsock;
-   bstrncpy(dev_name, store.store->dev_name(), sizeof(dev_name));
    bash_spaces(dev_name);
-   if (slot > 0) {
-      sd->fsend("%s %s drive=%d slot=%d", command, dev_name, drive, slot);
-   } else {
-      sd->fsend("%s %s drive=%d", command, dev_name, drive);
-   }
+   sd->fsend("%s %s drive=%d slot=%d", command, dev_name, drive, slot);
    while (sd->recv() >= 0) {
       ua->send_msg("%s", sd->msg);
    }
@@ -1620,7 +1745,7 @@ static void do_mount_cmd(UAContext *ua, const char *command)
  */
 static int mount_cmd(UAContext *ua, const char *cmd)
 {
-   do_mount_cmd(ua, "mount");          /* mount */
+   do_storage_cmd(ua, "mount")  ;          /* mount */
    return 1;
 }
 
@@ -1630,7 +1755,7 @@ static int mount_cmd(UAContext *ua, const char *cmd)
  */
 static int unmount_cmd(UAContext *ua, const char *cmd)
 {
-   do_mount_cmd(ua, "unmount");          /* unmount */
+   do_storage_cmd(ua, "unmount");          /* unmount */
    return 1;
 }
 
@@ -1640,7 +1765,7 @@ static int unmount_cmd(UAContext *ua, const char *cmd)
  */
 static int release_cmd(UAContext *ua, const char *cmd)
 {
-   do_mount_cmd(ua, "release");          /* release */
+   do_storage_cmd(ua, "release");          /* release */
    return 1;
 }
 
@@ -1824,14 +1949,14 @@ int wait_cmd(UAContext *ua, const char *cmd)
              "SELECT JobStatus FROM Job WHERE JobId='%i'", jobid);
 
 
-   db_sql_query(ua->db, buf,
-                status_handler, (void *)&jobstatus);
+   db_sql_query(ua->db, buf, status_handler, (void *)&jobstatus);
 
    switch (jobstatus) {
    case JS_Error:
       status = 1 ;         /* Warning */
       break;
 
+   case JS_Incomplete:
    case JS_FatalError:
    case JS_ErrorTerminated:
    case JS_Canceled:
@@ -1850,8 +1975,8 @@ int wait_cmd(UAContext *ua, const char *cmd)
 
    ua->send_msg("JobId=%i\n", jobid) ;
    ua->send_msg("JobStatus=%s (%c)\n",
-            job_status_to_str(jobstatus),
-            jobstatus) ;
+                job_status_to_str(jobstatus, 0),
+                jobstatus) ;
 
    if (ua->gui || ua->api) {
       ua->send_msg("ExitStatus=%i\n", status) ;
@@ -2078,7 +2203,7 @@ bool open_db(UAContext *ua)
                              ua->catalog->db_user,
                              ua->catalog->db_password, ua->catalog->db_address,
                              ua->catalog->db_port, ua->catalog->db_socket,
-                             mult_db_conn, ua->catalog->disable_batch_insert);
+                             mult_db_conn, ua->catalog->disable_batch_insert); 
    if (!ua->db || !db_open_database(ua->jcr, ua->db)) {
       ua->error_msg(_("Could not open catalog database \"%s\".\n"),
                  ua->catalog->db_name);
diff --git a/src/dird/ua_dotcmds.c b/src/dird/ua_dotcmds.c
index a764d7d..4aeadfb 100644
--- a/src/dird/ua_dotcmds.c
+++ b/src/dird/ua_dotcmds.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2002-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -52,6 +56,7 @@ static bool schedulescmd(UAContext *ua, const char *cmd);
 static bool storagecmd(UAContext *ua, const char *cmd);
 static bool defaultscmd(UAContext *ua, const char *cmd);
 static bool typescmd(UAContext *ua, const char *cmd);
+static bool tagscmd(UAContext *ua, const char *cmd);
 static bool backupscmd(UAContext *ua, const char *cmd);
 static bool levelscmd(UAContext *ua, const char *cmd);
 static bool getmsgscmd(UAContext *ua, const char *cmd);
@@ -71,7 +76,9 @@ static bool dot_bvfs_restore(UAContext *ua, const char *cmd);
 static bool dot_bvfs_cleanup(UAContext *ua, const char *cmd);
 static bool dot_bvfs_clear_cache(UAContext *ua, const char *cmd);
 static bool dot_bvfs_decode_lstat(UAContext *ua, const char *cmd);
+static bool dot_bvfs_update_fv(UAContext *ua, const char *cmd);
 static bool dot_bvfs_get_volumes(UAContext *ua, const char *cmd);
+static bool dot_bvfs_get_jobs(UAContext *ua, const char *cmd);
 
 static bool putfile_cmd(UAContext *ua, const char *cmd);
 static bool api_cmd(UAContext *ua, const char *cmd);
@@ -113,12 +120,15 @@ static struct cmdstruct commands[] = { /* help */  /* can be used in runscript *
  { NT_(".bvfs_get_volumes"),dot_bvfs_get_volumes,NULL,       true},
  { NT_(".bvfs_update"), dot_bvfs_update,         NULL,       true},
  { NT_(".bvfs_get_jobids"), dot_bvfs_get_jobids, NULL,       true},
+ { NT_(".bvfs_get_jobs"), dot_bvfs_get_jobs,     NULL,       true},
  { NT_(".bvfs_versions"), dot_bvfs_versions,     NULL,       true},
  { NT_(".bvfs_restore"),  dot_bvfs_restore,      NULL,       true},
  { NT_(".bvfs_cleanup"),  dot_bvfs_cleanup,      NULL,       true},
  { NT_(".bvfs_decode_lstat"),dot_bvfs_decode_lstat,NULL,     true},
  { NT_(".bvfs_clear_cache"),dot_bvfs_clear_cache,NULL,       false},
- { NT_(".types"),      typescmd,                 NULL,       false}
+ { NT_(".bvfs_update_fv"),dot_bvfs_update_fv,    NULL,       true},
+ { NT_(".types"),      typescmd,                 NULL,       false},
+ { NT_(".tags"),      tagscmd,                   NULL,       false}
 };
 #define comsize ((int)(sizeof(commands)/sizeof(struct cmdstruct)))
 
@@ -133,8 +143,8 @@ bool do_a_dot_command(UAContext *ua)
    bool found = false;
    BSOCK *user = ua->UA_sock;
 
-   Dmsg1(1400, "Dot command: %s\n", user->msg);
-   if (ua->argc == 0) {
+   Dmsg1(1400, "Dot command: %s\n", user?user->msg:"");
+   if (ua->argc == 0 || !user) {
       return false;
    }
 
@@ -163,7 +173,7 @@ bool do_a_dot_command(UAContext *ua)
          ok = (*commands[i].func)(ua, ua->cmd);   /* go execute command */
          if (ua->api) user->signal(ok?BNET_CMD_OK:BNET_CMD_FAILED);
          ua->gui = gui;
-         found = true;
+         found = user->is_stop() ? false : true;
          break;
       }
    }
@@ -174,6 +184,17 @@ bool do_a_dot_command(UAContext *ua)
    return ok;
 }
 
+static void bvfs_set_acl(UAContext *ua, Bvfs *bvfs)
+{
+   /* If no console resource => default console and all is permitted */
+   if (!ua || !ua->cons) {
+      return;
+   }
+   bvfs->set_job_acl(ua->cons->ACL_lists[Job_ACL]);
+   bvfs->set_client_acl(ua->cons->ACL_lists[Client_ACL]);
+   bvfs->set_fileset_acl(ua->cons->ACL_lists[FileSet_ACL]);
+   bvfs->set_pool_acl(ua->cons->ACL_lists[Pool_ACL]);
+}
 
 static bool dot_bvfs_decode_lstat(UAContext *ua, const char *cmd)
 {
@@ -233,6 +254,27 @@ static bool dot_bvfs_update(UAContext *ua, const char *cmd)
    return true;
 }
 
+static bool dot_bvfs_update_fv(UAContext *ua, const char *cmd)
+{
+   int pos = find_arg_with_value(ua, "jobid");
+
+   if (pos == -1 || !is_a_number_list(ua->argv[pos])) {
+      ua->error_msg("Expecting to find jobid=1,2,3 argument\n");
+      return 1;
+   }
+
+   if (!open_new_client_db(ua)) {
+      return 1;
+   }
+
+   bvfs_update_path_hierarchy_cache(ua->jcr, ua->db, ua->argv[pos]);
+   bvfs_update_fv_cache(ua->jcr, ua->db, ua->argv[pos]);
+
+   ua->info_msg("OK\n");
+
+   return true;
+}
+
 static bool dot_bvfs_clear_cache(UAContext *ua, const char *cmd)
 {
    if (!open_client_db(ua)) {
@@ -366,6 +408,25 @@ static bool bvfs_parse_arg(UAContext *ua,
          }
       }
 
+      if (strcasecmp(ua->argk[i], NT_("ujobid")) == 0) {
+         JOB_DBR jr;
+         memset(&jr, 0, sizeof(jr));
+         bstrncpy(jr.Job, ua->argv[i], sizeof(jr.Job));
+         if (!open_new_client_db(ua)) {
+            return false;
+         }
+         if (!db_get_job_record(ua->jcr, ua->db, &jr)) {
+            return false;
+         }
+         if (!acl_access_ok(ua, Job_ACL, jr.Name)) {
+            return false;
+         }
+         /* Store the jobid after the ua->cmd, a bit kluggy */
+         int len = strlen(ua->cmd);
+         ua->cmd = check_pool_memory_size(ua->cmd, len + 1 + 50);
+         *jobid = edit_uint64(jr.JobId, ua->cmd + len + 1);
+      }
+
       if (strcasecmp(ua->argk[i], NT_("limit")) == 0) {
          if (is_a_number(ua->argv[i])) {
             *limit = str_to_int64(ua->argv[i]);
@@ -428,6 +489,7 @@ static bool dot_bvfs_restore(UAContext *ua, const char *cmd)
    }
 
    Bvfs fs(ua->jcr, ua->db);
+   bvfs_set_acl(ua, &fs);
    fs.set_username(username);
    fs.set_jobids(jobid);
 
@@ -488,6 +550,7 @@ static bool dot_bvfs_get_volumes(UAContext *ua, const char *cmd)
    }
 
    Bvfs fs(ua->jcr, ua->db);
+   bvfs_set_acl(ua, &fs);
    fs.set_username(username);
    fs.set_handler(bvfs_result_handler, ua);
    fs.set_limit(limit);
@@ -532,6 +595,7 @@ static bool dot_bvfs_lsfiles(UAContext *ua, const char *cmd)
    }
 
    Bvfs fs(ua->jcr, ua->db);
+   bvfs_set_acl(ua, &fs);
    fs.set_username(username);
    fs.set_jobids(jobid);
    fs.set_handler(bvfs_result_handler, ua);
@@ -563,8 +627,11 @@ static bool dot_bvfs_lsfiles(UAContext *ua, const char *cmd)
 static bool dot_bvfs_lsdirs(UAContext *ua, const char *cmd)
 {
    DBId_t pathid=0;
-   int limit=2000, offset=0;
+   int   limit=2000, offset=0;
    char *path=NULL, *jobid=NULL, *username=NULL;
+   char *pattern=NULL;
+   int   dironly;
+   int i;
 
    if (!bvfs_parse_arg(ua, &pathid, &path, &jobid, &username,
                        &limit, &offset))
@@ -573,16 +640,27 @@ static bool dot_bvfs_lsdirs(UAContext *ua, const char *cmd)
       return true;              /* not enough param */
    }
 
+   if ((i = find_arg_with_value(ua, "pattern")) >= 0) {
+      pattern = ua->argv[i];
+   }
+
+   dironly = find_arg(ua, "dironly");
+
    if (!open_new_client_db(ua)) {
       return 1;
    }
 
    Bvfs fs(ua->jcr, ua->db);
+   bvfs_set_acl(ua, &fs);
    fs.set_username(username);
    fs.set_jobids(jobid);
    fs.set_limit(limit);
    fs.set_handler(bvfs_result_handler, ua);
 
+   if (pattern) {
+      fs.set_pattern(pattern);
+   }
+
    if (pathid) {
       fs.ch_dir(pathid);
    } else {
@@ -592,13 +670,15 @@ static bool dot_bvfs_lsdirs(UAContext *ua, const char *cmd)
    fs.set_offset(offset);
 
    fs.ls_special_dirs();
-   fs.ls_dirs();
 
+   if (dironly < 0) {
+      fs.ls_dirs();
+   }
    return true;
 }
 
 /*
- * .bvfs_versions fnid=10 pathid=10 copies versions
+ * .bvfs_versions fnid=10 pathid=10 client=xxx copies versions
  *
  */
 static bool dot_bvfs_versions(UAContext *ua, const char *cmd)
@@ -626,6 +706,7 @@ static bool dot_bvfs_versions(UAContext *ua, const char *cmd)
    }
 
    Bvfs fs(ua->jcr, ua->db);
+   bvfs_set_acl(ua, &fs);
    fs.set_limit(limit);
    fs.set_see_all_versions(versions);
    fs.set_see_copies(copies);
@@ -667,6 +748,7 @@ static bool dot_bvfs_get_jobids(UAContext *ua, const char *cmd)
    }
 
    Bvfs fs(ua->jcr, ua->db);
+   bvfs_set_acl(ua, &fs);
 
    if ((pos = find_arg_with_value(ua, "username")) >= 0) {
       fs.set_username(ua->argv[pos]);
@@ -791,7 +873,7 @@ static bool dot_bvfs_get_jobids(UAContext *ua, const char *cmd)
    /* Foreach different FileSet, we build a restore jobid list */
    for (int i=0; i < ids.num_ids; i++) {
       jr.FileSetId = ids.DBId[i];
-      if (!db_accurate_get_jobids(ua->jcr, ua->db, &jr, &tempids)) {
+      if (!db_get_accurate_jobids(ua->jcr, ua->db, &jr, &tempids)) {
          return true;
       }
       jobids.add(tempids);
@@ -802,6 +884,55 @@ static bool dot_bvfs_get_jobids(UAContext *ua, const char *cmd)
    return true;
 }
 
+static int jobs_handler(void *ctx, int num_field, char **row)
+{
+   UAContext *ua = (UAContext *)ctx;
+   ua->send_msg("%s %s %s\n", row[0], row[1], row[2]);
+   return 0;
+}
+
+/* .bvfs_get_jobs client=xxx [fileset=yyyy]
+ * 1 yyyyy Backup1_xxx_xxx_xxxx_xxx
+ * 2 yyyyy Backup1_xxx_xxx_xxxx_xxx
+ */
+static bool dot_bvfs_get_jobs(UAContext *ua, const char *cmd)
+{
+   int pos, posj;
+   POOL_MEM tmp;
+   char esc_cli[MAX_ESCAPE_NAME_LENGTH];
+   char esc_job[MAX_ESCAPE_NAME_LENGTH];
+   if (!open_new_client_db(ua)) {
+      return true;
+   }
+
+   if ((pos = find_arg_with_value(ua, "client")) < 0) {
+      return true;
+   }
+
+   posj = find_arg_with_value(ua, "ujobid");
+
+   if (!acl_access_ok(ua, Client_ACL, ua->argv[pos])) {
+      return true;
+   }
+   
+   db_lock(ua->db);
+   db_escape_string(ua->jcr, ua->db, esc_cli, ua->argv[pos], sizeof(esc_cli));
+   if (posj >= 0) {
+      db_escape_string(ua->jcr, ua->db, esc_job, ua->argv[posj], sizeof(esc_job));
+      Mmsg(tmp, "AND Job.Job = '%s'", esc_job);
+   }
+   Mmsg(ua->db->cmd,
+      "SELECT JobId, JobTDate, Job "
+        "FROM Job JOIN Client USING (ClientId) "
+         "WHERE Client.Name = '%s' AND Job.Type = 'B' AND Job.JobStatus IN ('T', 'W') "
+         "%s "
+         "ORDER By JobTDate DESC",
+        esc_cli, tmp.c_str());
+   db_sql_query(ua->db, ua->db->cmd, jobs_handler, ua);
+   db_unlock(ua->db);
+   return true;
+}
+
 static bool dot_quit_cmd(UAContext *ua, const char *cmd)
 {
    quit_cmd(ua, cmd);
@@ -1204,6 +1335,15 @@ static bool typescmd(UAContext *ua, const char *cmd)
    return true;
 }
 
+static bool tagscmd(UAContext *ua, const char *cmd)
+{
+   uint32_t i = 0;
+   for (const char *p = debug_get_tag(i++, NULL) ; p ; p = debug_get_tag(i++, NULL)) {
+      ua->send_msg("%s\n", p);
+   }
+   return true;
+}
+
 /*
  * If this command is called, it tells the director that we
  *  are a program that wants a sort of API, and hence,
@@ -1324,8 +1464,8 @@ static bool mediatypescmd(UAContext *ua, const char *cmd)
       return true;
    }
    if (!db_sql_query(ua->db,
-                  "SELECT DISTINCT MediaType FROM MediaType ORDER BY MediaType",
-                  one_handler, (void *)ua))
+           "SELECT DISTINCT MediaType FROM MediaType ORDER BY MediaType",
+           one_handler, (void *)ua))
    {
       ua->error_msg(_("List MediaType failed: ERR=%s\n"), db_strerror(ua->db));
    }
@@ -1338,8 +1478,8 @@ static bool mediacmd(UAContext *ua, const char *cmd)
       return true;
    }
    if (!db_sql_query(ua->db,
-                  "SELECT DISTINCT Media.VolumeName FROM Media ORDER BY VolumeName",
-                  one_handler, (void *)ua))
+          "SELECT DISTINCT Media.VolumeName FROM Media ORDER BY VolumeName",
+          one_handler, (void *)ua))
    {
       ua->error_msg(_("List Media failed: ERR=%s\n"), db_strerror(ua->db));
    }
@@ -1352,8 +1492,8 @@ static bool locationscmd(UAContext *ua, const char *cmd)
       return true;
    }
    if (!db_sql_query(ua->db,
-                  "SELECT DISTINCT Location FROM Location ORDER BY Location",
-                  one_handler, (void *)ua))
+           "SELECT DISTINCT Location FROM Location ORDER BY Location",
+           one_handler, (void *)ua))
    {
       ua->error_msg(_("List Location failed: ERR=%s\n"), db_strerror(ua->db));
    }
@@ -1406,22 +1546,17 @@ static bool volstatuscmd(UAContext *ua, const char *cmd)
  */
 static bool defaultscmd(UAContext *ua, const char *cmd)
 {
-   JOB *job;
-   CLIENT *client;
-   STORE *storage;
-   POOL *pool;
    char ed1[50];
-
    if (ua->argc != 2 || !ua->argv[1]) {
       return true;
    }
 
-   /* Job defaults */
+   /* Send Job defaults */
    if (strcmp(ua->argk[1], "job") == 0) {
       if (!acl_access_ok(ua, Job_ACL, ua->argv[1])) {
          return true;
       }
-      job = (JOB *)GetResWithName(R_JOB, ua->argv[1]);
+      JOB *job = (JOB *)GetResWithName(R_JOB, ua->argv[1]);
       if (job) {
          USTORE store;
          ua->send_msg("job=%s", job->name());
@@ -1438,28 +1573,38 @@ static bool defaultscmd(UAContext *ua, const char *cmd)
          ua->send_msg("catalog=%s", job->client?job->client->catalog->name():_("*None*"));
       }
    }
-   /* Client defaults */
-   else if (strcmp(ua->argk[1], "client") == 0) {
-      if (!acl_access_ok(ua, Client_ACL, ua->argv[1])) {
+   /* Send Pool defaults */
+   else if (strcmp(ua->argk[1], "pool") == 0) {
+      if (!acl_access_ok(ua, Pool_ACL, ua->argv[1])) {
          return true;
       }
-      client = (CLIENT *)GetResWithName(R_CLIENT, ua->argv[1]);
-      if (client) {
-         ua->send_msg("client=%s", client->name());
-         ua->send_msg("address=%s", client->address);
-         ua->send_msg("fdport=%d", client->FDport);
-         ua->send_msg("file_retention=%s", edit_uint64(client->FileRetention, ed1));
-         ua->send_msg("job_retention=%s", edit_uint64(client->JobRetention, ed1));
-         ua->send_msg("autoprune=%d", client->AutoPrune);
-         ua->send_msg("catalog=%s", client->catalog->name());
+      POOL *pool = (POOL *)GetResWithName(R_POOL, ua->argv[1]);
+      if (pool) {
+         ua->send_msg("pool=%s", pool->name());
+         ua->send_msg("pool_type=%s", pool->pool_type);
+         ua->send_msg("label_format=%s", pool->label_format?pool->label_format:"");
+         ua->send_msg("use_volume_once=%d", pool->use_volume_once);
+         ua->send_msg("purge_oldest_volume=%d", pool->purge_oldest_volume);
+         ua->send_msg("recycle_oldest_volume=%d", pool->recycle_oldest_volume);
+         ua->send_msg("recycle_current_volume=%d", pool->recycle_current_volume);
+         ua->send_msg("max_volumes=%d", pool->max_volumes);
+         ua->send_msg("vol_retention=%s", edit_uint64(pool->VolRetention, ed1));
+         ua->send_msg("vol_use_duration=%s", edit_uint64(pool->VolUseDuration, ed1));
+         ua->send_msg("max_vol_jobs=%d", pool->MaxVolJobs);
+         ua->send_msg("max_vol_files=%d", pool->MaxVolFiles);
+         ua->send_msg("max_vol_bytes=%s", edit_uint64(pool->MaxVolBytes, ed1));
+         ua->send_msg("auto_prune=%d", pool->AutoPrune);
+         ua->send_msg("recycle=%d", pool->Recycle);
+         ua->send_msg("file_retention=%s", edit_uint64(pool->FileRetention, ed1));
+         ua->send_msg("job_retention=%s", edit_uint64(pool->JobRetention, ed1));
       }
-   }
-   /* Storage defaults */
+   } 
+   /* Send Storage defaults */
    else if (strcmp(ua->argk[1], "storage") == 0) {
       if (!acl_access_ok(ua, Storage_ACL, ua->argv[1])) {
          return true;
       }
-      storage = (STORE *)GetResWithName(R_STORAGE, ua->argv[1]);
+      STORE *storage = (STORE *)GetResWithName(R_STORAGE, ua->argv[1]);
       DEVICE *device;
       if (storage) {
          ua->send_msg("storage=%s", storage->name());
@@ -1475,31 +1620,21 @@ static bool defaultscmd(UAContext *ua, const char *cmd)
             }
          }
       }
-   }
-   /* Pool defaults */
-   else if (strcmp(ua->argk[1], "pool") == 0) {
-      if (!acl_access_ok(ua, Pool_ACL, ua->argv[1])) {
+   } 
+   /* Send Client defaults */
+   else if (strcmp(ua->argk[1], "client") == 0) {
+      if (!acl_access_ok(ua, Client_ACL, ua->argv[1])) {
          return true;
       }
-      pool = (POOL *)GetResWithName(R_POOL, ua->argv[1]);
-      if (pool) {
-         ua->send_msg("pool=%s", pool->name());
-         ua->send_msg("pool_type=%s", pool->pool_type);
-         ua->send_msg("label_format=%s", pool->label_format?pool->label_format:"");
-         ua->send_msg("use_volume_once=%d", pool->use_volume_once);
-         ua->send_msg("purge_oldest_volume=%d", pool->purge_oldest_volume);
-         ua->send_msg("recycle_oldest_volume=%d", pool->recycle_oldest_volume);
-         ua->send_msg("recycle_current_volume=%d", pool->recycle_current_volume);
-         ua->send_msg("max_volumes=%d", pool->max_volumes);
-         ua->send_msg("vol_retention=%s", edit_uint64(pool->VolRetention, ed1));
-         ua->send_msg("vol_use_duration=%s", edit_uint64(pool->VolUseDuration, ed1));
-         ua->send_msg("max_vol_jobs=%d", pool->MaxVolJobs);
-         ua->send_msg("max_vol_files=%d", pool->MaxVolFiles);
-         ua->send_msg("max_vol_bytes=%s", edit_uint64(pool->MaxVolBytes, ed1));
-         ua->send_msg("auto_prune=%d", pool->AutoPrune);
-         ua->send_msg("recycle=%d", pool->Recycle);
-         ua->send_msg("file_retention=%s", edit_uint64(pool->FileRetention, ed1));
-         ua->send_msg("job_retention=%s", edit_uint64(pool->JobRetention, ed1));
+      CLIENT *client = (CLIENT *)GetResWithName(R_CLIENT, ua->argv[1]);
+      if (client) {
+         ua->send_msg("client=%s", client->name());
+         ua->send_msg("address=%s", client->address);
+         ua->send_msg("fdport=%d", client->FDport);
+         ua->send_msg("file_retention=%s", edit_uint64(client->FileRetention, ed1));
+         ua->send_msg("job_retention=%s", edit_uint64(client->JobRetention, ed1));
+         ua->send_msg("autoprune=%d", client->AutoPrune);
+         ua->send_msg("catalog=%s", client->catalog->name());
       }
    }
    return true;
diff --git a/src/dird/ua_input.c b/src/dird/ua_input.c
index 421a9e6..7d55aa8 100644
--- a/src/dird/ua_input.c
+++ b/src/dird/ua_input.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
diff --git a/src/dird/ua_label.c b/src/dird/ua_label.c
index 012f337..1a78c06 100644
--- a/src/dird/ua_label.c
+++ b/src/dird/ua_label.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2003-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -671,8 +675,9 @@ static bool send_label_request(UAContext *ua, MEDIA_DBR *mr, MEDIA_DBR *omr,
    BSOCK *sd;
    char dev_name[MAX_NAME_LENGTH];
    bool ok = false;
-   bool is_dvd = false;
    uint64_t VolBytes = 0;
+   uint64_t VolABytes = 0;
+   uint32_t VolType = 0;
 
    if (!(sd=open_sd_bsock(ua))) {
       return false;
@@ -702,11 +707,9 @@ static bool send_label_request(UAContext *ua, MEDIA_DBR *mr, MEDIA_DBR *omr,
    }
 
    while (sd->recv() >= 0) {
-      int dvd;
       ua->send_msg("%s", sd->msg);
-      if (sscanf(sd->msg, "3000 OK label. VolBytes=%llu DVD=%d ", &VolBytes,
-                 &dvd) == 2) {
-         is_dvd = dvd;
+      if (sscanf(sd->msg, "3000 OK label. VolBytes=%llu VolABytes=%lld VolType=%d ",
+                 &VolBytes, &VolABytes, &VolType) == 3) {
          ok = true;
       }
    }
@@ -715,14 +718,11 @@ static bool send_label_request(UAContext *ua, MEDIA_DBR *mr, MEDIA_DBR *omr,
    unbash_spaces(pr->Name);
    mr->LabelDate = time(NULL);
    mr->set_label_date = true;
-   if (is_dvd) {
-      /* We know that a freshly labelled DVD has 1 VolParts */
-      /* This does not apply to auto-labelled DVDs. */
-      mr->VolParts = 1;
-   }
    if (ok) {
       if (media_record_exists) {      /* we update it */
          mr->VolBytes = VolBytes;
+         mr->VolABytes = VolABytes;
+         mr->VolType = VolType;
          mr->InChanger = mr->Slot > 0;  /* if slot give assume in changer */
          set_storageid_in_mr(ua->jcr->wstore, mr);
          if (!db_update_media_record(ua->jcr, ua->db, mr)) {
@@ -732,6 +732,8 @@ static bool send_label_request(UAContext *ua, MEDIA_DBR *mr, MEDIA_DBR *omr,
       } else {                        /* create the media record */
          set_pool_dbr_defaults_in_media_dbr(mr, pr);
          mr->VolBytes = VolBytes;
+         mr->VolABytes = VolABytes;
+         mr->VolType = VolType;
          mr->InChanger = mr->Slot > 0;  /* if slot give assume in changer */
          mr->Enabled = 1;
          set_storageid_in_mr(ua->jcr->wstore, mr);
@@ -854,7 +856,7 @@ static vol_list_t *get_vol_list_from_SD(UAContext *ua, bool scan)
          if (!is_volume_name_legal(ua, p)) {
             p--;
             *p = ':';
-            ua->error_msg(_("Invalid Volume name: %s\n"), sd->msg);
+            ua->error_msg(_("Invalid Volume name: %s. Volume skipped.\n"), sd->msg);
             continue;
          }
       }
diff --git a/src/dird/ua_output.c b/src/dird/ua_output.c
index d5106fd..a0b6c9b 100644
--- a/src/dird/ua_output.c
+++ b/src/dird/ua_output.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -19,8 +23,6 @@
  *     I.e. messages, listing database, showing resources, ...
  *
  *     Kern Sibbald, September MM
- *
- *   Version $Id$
  */
 
 #include "bacula.h"
@@ -148,18 +150,20 @@ int show_cmd(UAContext *ua, const char *cmd)
 
    LockRes();
    for (i=1; i<ua->argc; i++) {
-      if (strcasecmp(ua->argk[i], _("disabled")) == 0) {
+      if (strcasecmp(ua->argk[i], NT_("disabled")) == 0) {
          show_disabled_jobs(ua);
          goto bail_out;
       }
+
       type = 0;
+
       res_name = ua->argk[i];
       if (!ua->argv[i]) {             /* was a name given? */
          /* No name, dump all resources of specified type */
          recurse = 1;
          len = strlen(res_name);
          for (j=0; reses[j].res_name; j++) {
-            if (strncasecmp(res_name, _(reses[j].res_name), len) == 0) {
+            if (strncasecmp(res_name, reses[j].res_name, len) == 0) {
                type = reses[j].type;
                if (type > 0) {
                   res = res_head[type-r_first];
@@ -175,7 +179,7 @@ int show_cmd(UAContext *ua, const char *cmd)
          recurse = 0;
          len = strlen(res_name);
          for (j=0; reses[j].res_name; j++) {
-            if (strncasecmp(res_name, _(reses[j].res_name), len) == 0) {
+            if (strncasecmp(res_name, reses[j].res_name, len) == 0) {
                type = reses[j].type;
                res = (RES *)GetResWithName(type, ua->argv[i]);
                if (!res) {
@@ -187,7 +191,8 @@ int show_cmd(UAContext *ua, const char *cmd)
       }
 
       switch (type) {
-      case -1:                           /* all */
+      /* All resources */
+      case -1:
          for (j=r_first; j<=r_last; j++) {
             /* Skip R_DEVICE since it is really not used or updated */
             if (j != R_DEVICE) {
@@ -195,18 +200,22 @@ int show_cmd(UAContext *ua, const char *cmd)
             }
          }
          break;
+      /* Help */
       case -2:
          ua->send_msg(_("Keywords for the show command are:\n"));
          for (j=0; reses[j].res_name; j++) {
-            ua->error_msg("%s\n", _(reses[j].res_name));
+            ua->error_msg("%s\n", reses[j].res_name);
          }
          goto bail_out;
+      /* Resource not found */
       case -3:
          ua->error_msg(_("%s resource %s not found.\n"), res_name, ua->argv[i]);
          goto bail_out;
+      /* Resource not found */
       case 0:
          ua->error_msg(_("Resource %s not found\n"), res_name);
          goto bail_out;
+      /* Dump a specific type */
       default:
          dump_resource(recurse?type:-type, res, bsendmsg, ua);
          break;
@@ -217,8 +226,72 @@ bail_out:
    return 1;
 }
 
+/*
+ * Check if the access is permitted for a list of jobids
+ *
+ * Not in ua_acl.c because it's using db access, and tools such
+ * as bdirjson are not linked with cats.
+ */
+bool acl_access_jobid_ok(UAContext *ua, const char *jobids)
+{
+   char     *tmp=NULL, *p;
+   bool      ret=false;
+   JOB_DBR   jr;
+   uint32_t  jid;
+
+   if (!jobids) {
+      return false;
+   }
+
+   if (!is_a_number_list(jobids)) {
+      return false;
+   }
+
+   /* If no console resource => default console and all is permitted */
+   if (!ua || !ua->cons) {
+      Dmsg0(1400, "Root cons access OK.\n");
+      return true;     /* No cons resource -> root console OK for everything */
+   }
+
+   alist *list = ua->cons->ACL_lists[Job_ACL];
+   if (!list) {                       /* empty list */
+      return false;                   /* List empty, reject everything */
+   }
+
+   /* Special case *all* gives full access */
+   if (list->size() == 1 && strcasecmp("*all*", (char *)list->get(0)) == 0) {
+      return true;
+   }
+
+   /* If we can't open the database, just say no */
+   if (!open_new_client_db(ua)) {
+      return false;
+   }
+
+   p = tmp = bstrdup(jobids);
 
+   while (get_next_jobid_from_list(&p, &jid) > 0) {
+      memset(&jr, 0, sizeof(jr));
+      jr.JobId = jid;
 
+      if (db_get_job_record(ua->jcr, ua->db, &jr)) {
+         for (int i=0; i<list->size(); i++) {
+            if (strcasecmp(jr.Name, (char *)list->get(i)) == 0) {
+               Dmsg3(1400, "ACL found %s in %d %s\n", jr.Name,
+                     Job_ACL, (char *)list->get(i));
+               ret = true;
+               goto bail_out;
+            }
+         }
+      }
+   }
+
+bail_out:
+   if (tmp) {
+      free(tmp);
+   }
+   return ret;
+}
 
 /*
  *  List contents of database
@@ -266,7 +339,7 @@ static int do_list_cmd(UAContext *ua, const char *cmd, e_list_type llist)
    POOL_DBR pr;
    MEDIA_DBR mr;
 
-   if (!open_client_db(ua))
+   if (!open_new_client_db(ua))
       return 1;
 
    memset(&jr, 0, sizeof(jr));
@@ -413,7 +486,6 @@ static int do_list_cmd(UAContext *ua, const char *cmd, e_list_type llist)
       } else if (strcasecmp(ua->argk[i], NT_("clients")) == 0) {
          db_list_client_records(ua->jcr, ua->db, prtit, ua, llist);
 
-
       /* List MEDIA or VOLUMES */
       } else if (strcasecmp(ua->argk[i], NT_("media")) == 0 ||
                  strcasecmp(ua->argk[i], NT_("volume")) == 0 ||
@@ -442,7 +514,7 @@ static int do_list_cmd(UAContext *ua, const char *cmd, e_list_type llist)
             int num_pools;
             uint32_t *ids;
             /* List a specific volume? */
-            if (ua->argv[i]) {
+            if (ua->argv[i] && *ua->argv[i]) {
                bstrncpy(mr.VolumeName, ua->argv[i], sizeof(mr.VolumeName));
                db_list_media_records(ua->jcr, ua->db, &mr, prtit, ua, llist);
                return 1;
@@ -509,6 +581,12 @@ static int do_list_cmd(UAContext *ua, const char *cmd, e_list_type llist)
       } else if (strcasecmp(ua->argk[i], NT_("limit")) == 0
                  || strcasecmp(ua->argk[i], NT_("days")) == 0) {
          /* Ignore it */
+      } else if (strcasecmp(ua->argk[i], NT_("snapshot")) == 0 ||
+                 strcasecmp(ua->argk[i], NT_("snapshots")) == 0) 
+      {
+         snapshot_list(ua, i, prtit, llist);
+         return 1;
+
       } else {
          ua->error_msg(_("Unknown list keyword: %s\n"), NPRT(ua->argk[i]));
       }
@@ -573,10 +651,8 @@ static bool list_nextvol(UAContext *ua, int ndays)
    }
 
 get_out:
-   if (jcr->db) {
-      db_close_database(jcr, jcr->db);
-      jcr->db = NULL;
-   }
+   if (jcr->db) db_close_database(jcr, jcr->db);
+   jcr->db = NULL;
    free_jcr(jcr);
    if (!found) {
       ua->error_msg(_("Could not find next Volume for Job %s.\n"),
@@ -602,7 +678,8 @@ RUN *find_next_run(RUN *run, JOB *job, utime_t &runtime, int ndays)
    bool is_scheduled;
 
    sched = job->schedule;
-   if (sched == NULL) {            /* scheduled? */
+   if (!sched || !job->enabled || (sched && !sched->enabled) ||
+       (job->client && !job->client->enabled)) {
       return NULL;                 /* no nothing to report */
    }
 
@@ -705,11 +782,11 @@ bool complete_jcr_for_job(JCR *jcr, JOB *job, POOL *pool)
 
    Dmsg0(100, "complete_jcr open db\n");
    jcr->db = db_init_database(jcr, jcr->catalog->db_driver, jcr->catalog->db_name,
-                              jcr->catalog->db_user,
-                              jcr->catalog->db_password, jcr->catalog->db_address,
-                              jcr->catalog->db_port, jcr->catalog->db_socket,
-                              jcr->catalog->mult_db_connections,
-                              jcr->catalog->disable_batch_insert);
+                jcr->catalog->db_user,
+                jcr->catalog->db_password, jcr->catalog->db_address,
+                jcr->catalog->db_port, jcr->catalog->db_socket,
+                jcr->catalog->mult_db_connections,
+                jcr->catalog->disable_batch_insert);
    if (!jcr->db || !db_open_database(jcr, jcr->db)) {
       Jmsg(jcr, M_FATAL, 0, _("Could not open database \"%s\".\n"),
                  jcr->catalog->db_name);
@@ -800,7 +877,7 @@ void prtit(void *ctx, const char *msg)
 {
    UAContext *ua = (UAContext *)ctx;
 
-   ua->UA_sock->fsend("%s", msg);
+   if (ua) ua->send_msg("%s", msg);
 }
 
 /*
diff --git a/src/dird/ua_prune.c b/src/dird/ua_prune.c
index 9a86f24..f83b831 100644
--- a/src/dird/ua_prune.c
+++ b/src/dird/ua_prune.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2002-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -103,6 +107,7 @@ int prunecmd(UAContext *ua, const char *cmd)
       NT_("Jobs"),
       NT_("Volume"),
       NT_("Stats"),
+      NT_("Snapshots"),
       NULL};
 
    if (!open_new_client_db(ua)) {
@@ -111,7 +116,7 @@ int prunecmd(UAContext *ua, const char *cmd)
 
    /* First search args */
    kw = find_arg_keyword(ua, keywords);
-   if (kw < 0 || kw > 3) {
+   if (kw < 0 || kw > 4) {
       /* no args, so ask user */
       kw = do_keyword_prompt(ua, _("Choose item to prune"), keywords);
    }
@@ -189,6 +194,9 @@ int prunecmd(UAContext *ua, const char *cmd)
       }
       prune_stats(ua, retention);
       return true;
+   case 4:  /* prune snapshots */
+      prune_snapshot(ua);
+      return true;
    default:
       break;
    }
@@ -237,7 +245,7 @@ bool prune_set_filter(UAContext *ua, CLIENT *client, POOL *pool, utime_t period,
    db_lock(ua->db);
    if (client) {
       db_escape_string(ua->jcr, ua->db, ed2,
-                       client->name(), strlen(client->name()));
+         client->name(), strlen(client->name()));
       Mmsg(tmp, " AND Client.Name = '%s' ", ed2);
       pm_strcat(*add_where, tmp.c_str());
       pm_strcat(*add_from, " JOIN Client USING (ClientId) ");
@@ -245,7 +253,7 @@ bool prune_set_filter(UAContext *ua, CLIENT *client, POOL *pool, utime_t period,
 
    if (pool) {
       db_escape_string(ua->jcr, ua->db, ed2,
-                       pool->name(), strlen(pool->name()));
+              pool->name(), strlen(pool->name()));
       Mmsg(tmp, " AND Pool.Name = '%s' ", ed2);
       pm_strcat(*add_where, tmp.c_str());
       /* Use ON() instead of USING for some old SQLite */
@@ -360,7 +368,7 @@ static void drop_temp_tables(UAContext *ua)
 static bool create_temp_tables(UAContext *ua)
 {
    /* Create temp tables and indicies */
-   if (!db_sql_query(ua->db, create_deltabs[db_get_type_index(ua->db)], NULL, (void *)NULL)) {
+   if (!db_sql_query(ua->db, create_deltabs[ua->db->bdb_get_type_index()], NULL, (void *)NULL)) {
       ua->error_msg("%s", db_strerror(ua->db));
       Dmsg0(100, "create DelTables table failed\n");
       return false;
@@ -543,7 +551,7 @@ int prune_jobs(UAContext *ua, CLIENT *client, POOL *pool, int JobType)
    foreach_alist(elt, jobids_check) {
       jr.ClientId = elt->ClientId;   /* should be always the same */
       jr.FileSetId = elt->FileSetId;
-      db_accurate_get_jobids(ua->jcr, ua->db, &jr, &tempids);
+      db_get_accurate_jobids(ua->jcr, ua->db, &jr, &tempids);
       jobids.add(tempids);
    }
 
@@ -647,7 +655,7 @@ static bool prune_expired_volumes(UAContext *ua)
    if ((i = find_arg_with_value(ua, "mediatype")) >= 0) {
       char ed1[MAX_ESCAPE_NAME_LENGTH];
       db_escape_string(ua->jcr, ua->db, ed1,
-                       ua->argv[i], strlen(ua->argv[i]));
+         ua->argv[i], strlen(ua->argv[i]));
       Mmsg(query, " AND MediaType = '%s' ", ed1);
       pm_strcat(filter, query.c_str());
    }
@@ -665,7 +673,7 @@ static bool prune_expired_volumes(UAContext *ua)
 
    lst = New(alist(5, owned_by_alist));
 
-   Mmsg(query,  expired_volumes[db_get_type_index(ua->db)], filter.c_str());
+   Mmsg(query, expired_volumes[db_get_type_index(ua->db)], filter.c_str());
    db_sql_query(ua->db, query.c_str(), db_string_list_handler, &lst);
 
    foreach_alist(val, lst) {
@@ -673,7 +681,9 @@ static bool prune_expired_volumes(UAContext *ua)
       bstrncpy(mr.VolumeName, val, sizeof(mr.VolumeName));
       db_get_media_record(ua->jcr, ua->db, &mr);
       Mmsg(query, _("Volume \"%s\""), val);
+      Dmsg1(100, "Do prune %s\n", query.c_str());
       if (confirm_retention(ua, &mr.VolRetention, query.c_str())) {
+         Dmsg1(100, "Call Prune %s\n", query.c_str());
          prune_volume(ua, &mr);
       }
    }
@@ -715,9 +725,15 @@ bool prune_volume(UAContext *ua, MEDIA_DBR *mr)
       count = get_prune_list_for_volume(ua, mr, &del);
       Dmsg1(100, "Num pruned = %d\n", count);
       if (count != 0) {
+         ua->info_msg(_("Found %d Job(s) associated with the Volume \"%s\" that will be pruned\n"),
+                      count, mr->VolumeName);
          purge_job_list_from_catalog(ua, del);
+
+      } else {
+         ua->info_msg(_("Found no Job associated with the Volume \"%s\" to prune\n"),
+                      mr->VolumeName);
       }
-      ok = is_volume_purged(ua, mr);
+      ok = is_volume_purged(ua, mr, false);
    }
 
    db_unlock(ua->db);
@@ -749,7 +765,7 @@ int get_prune_list_for_volume(UAContext *ua, MEDIA_DBR *mr, del_ctx *del)
    now = (utime_t)time(NULL);
    edit_int64(now-period, ed2);
    Mmsg(query, sel_JobMedia, ed1, ed2);
-   Dmsg3(250, "Now=%d period=%d now-period=%s\n", (int)now, (int)period,
+   Dmsg3(200, "Now=%d period=%d now-period=%s\n", (int)now, (int)period,
       ed2);
 
    Dmsg1(100, "Query=%s\n", query.c_str());
diff --git a/src/dird/ua_purge.c b/src/dird/ua_purge.c
index 7d87c80..2507c57 100644
--- a/src/dird/ua_purge.c
+++ b/src/dird/ua_purge.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2002-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -384,11 +388,11 @@ void purge_files_from_job_list(UAContext *ua, del_ctx &del)
 void upgrade_copies(UAContext *ua, char *jobs)
 {
    POOL_MEM query(PM_MESSAGE);
+   int dbtype = ua->db->bdb_get_type_index();
 
    db_lock(ua->db);
-
-   /* Do it in two times for mysql */
-   Mmsg(query, uap_upgrade_copies_oldest_job[db_get_type_index(ua->db)], JT_JOB_COPY, jobs, jobs);
+   
+   Mmsg(query, uap_upgrade_copies_oldest_job[dbtype], JT_JOB_COPY, jobs, jobs);
    db_sql_query(ua->db, query.c_str(), NULL, (void *)NULL);
    Dmsg1(050, "Upgrade copies Log sql=%s\n", query.c_str());
 
@@ -426,6 +430,12 @@ void purge_jobs_from_catalog(UAContext *ua, char *jobs)
    db_sql_query(ua->db, query.c_str(), NULL, (void *)NULL);
    Dmsg1(050, "Delete RestoreObject sql=%s\n", query.c_str());
 
+   /* The JobId of the Snapshot record is no longer usable 
+    * TODO: Migth want to use a copy for the jobid? 
+    */
+   Mmsg(query, "UPDATE Snapshot SET JobId=0 WHERE JobId IN (%s)", jobs);
+   db_sql_query(ua->db, query.c_str(), NULL, (void *)NULL);
+
    upgrade_copies(ua, jobs);
 
    /* Now remove the Job record itself */
@@ -554,9 +564,10 @@ static void do_truncate_on_purge(UAContext *ua, MEDIA_DBR *mr,
                                  char *pool, char *storage,
                                  int drive, BSOCK *sd)
 {
-   int dvd;
-   bool ok=false;
+   bool ok = false;
    uint64_t VolBytes = 0;
+   uint64_t VolABytes = 0;
+   uint32_t VolType = 0;
 
    /* TODO: Return if not mr->Recyle ? */
    if (!mr->Recycle) {
@@ -593,13 +604,16 @@ static void do_truncate_on_purge(UAContext *ua, MEDIA_DBR *mr,
    /* Send relabel command, and check for valid response */
    while (sd->recv() >= 0) {
       ua->send_msg("%s", sd->msg);
-      if (sscanf(sd->msg, "3000 OK label. VolBytes=%llu DVD=%d ", &VolBytes, &dvd) == 2) {
+      if (sscanf(sd->msg, "3000 OK label. VolBytes=%llu VolABytes=%lld VolType=%d ",
+         &VolBytes, &VolABytes, &VolType) == 3) {
          ok = true;
       }
    }
 
    if (ok) {
       mr->VolBytes = VolBytes;
+      mr->VolABytes = VolABytes;
+      mr->VolType = VolType;
       mr->VolFiles = 0;
       set_storageid_in_mr(NULL, mr);
       if (!db_update_media_record(ua->jcr, ua->db, mr)) {
@@ -700,7 +714,7 @@ int truncate_cmd(UAContext *ua, const char *cmd)
    }
 
    if (!nb) {
-      ua->send_msg(_("No Volumes found to perform %s action.\n"), action);
+      ua->send_msg(_("No Volumes found to perform \"truncate\" command.\n"));
       goto bail_out;
    }
 
@@ -764,8 +778,7 @@ bool mark_media_purged(UAContext *ua, MEDIA_DBR *mr)
          newpr.PoolId = mr->RecyclePoolId;
          oldpr.PoolId = mr->PoolId;
          if (   db_get_pool_numvols(jcr, ua->db, &oldpr)
-             && db_get_pool_numvols(jcr, ua->db, &newpr))
-         {
+             && db_get_pool_numvols(jcr, ua->db, &newpr)) {
             /* check if destination pool size is ok */
             if (newpr.MaxVols > 0 && newpr.NumVols >= newpr.MaxVols) {
                ua->error_msg(_("Unable move recycled Volume in full "
diff --git a/src/dird/ua_query.c b/src/dird/ua_query.c
index f1aa8ab..1f8449c 100644
--- a/src/dird/ua_query.c
+++ b/src/dird/ua_query.c
@@ -7,19 +7,23 @@
  *   Version $Id$
  */
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 
 #include "bacula.h"
diff --git a/src/dird/ua_restore.c b/src/dird/ua_restore.c
index 4a629d9..65b069e 100644
--- a/src/dird/ua_restore.c
+++ b/src/dird/ua_restore.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2002-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -42,7 +46,6 @@ static int fileset_handler(void *ctx, int num_fields, char **row);
 static void free_name_list(NAME_LIST *name_list);
 static bool select_backups_before_date(UAContext *ua, RESTORE_CTX *rx, char *date);
 static bool build_directory_tree(UAContext *ua, RESTORE_CTX *rx);
-static void free_rx(RESTORE_CTX *rx);
 static void split_path_and_filename(UAContext *ua, RESTORE_CTX *rx, char *fname);
 static int jobid_fileindex_handler(void *ctx, int num_fields, char **row);
 static bool insert_file_into_findex_list(UAContext *ua, RESTORE_CTX *rx, char *file,
@@ -54,9 +57,33 @@ static int get_client_name(UAContext *ua, RESTORE_CTX *rx);
 static int get_restore_client_name(UAContext *ua, RESTORE_CTX &rx);
 static bool get_date(UAContext *ua, char *date, int date_len);
 static int restore_count_handler(void *ctx, int num_fields, char **row);
-static bool insert_table_into_findex_list(UAContext *ua, RESTORE_CTX *rx, char *table);
 static void get_and_display_basejobs(UAContext *ua, RESTORE_CTX *rx);
 
+void new_rx(RESTORE_CTX *rx)
+{
+   memset(rx, 0, sizeof(*rx));
+   rx->path = get_pool_memory(PM_FNAME);
+   rx->path[0] = 0;
+
+   rx->fname = get_pool_memory(PM_FNAME);
+   rx->fname[0] = 0;
+
+   rx->JobIds = get_pool_memory(PM_FNAME);
+   rx->JobIds[0] = 0;
+
+   rx->component_fname = get_pool_memory(PM_FNAME);
+   rx->component_fname[0] = 0;
+
+   rx->BaseJobIds = get_pool_memory(PM_FNAME);
+   rx->BaseJobIds[0] = 0;
+
+   rx->query = get_pool_memory(PM_FNAME);
+   rx->query[0] = 0;
+
+   rx->bsr = new_bsr();
+   rx->hardlinks_in_mem = true;
+}
+
 /*
  *   Restore files
  *
@@ -73,25 +100,8 @@ int restore_cmd(UAContext *ua, const char *cmd)
    char *strip_prefix, *add_prefix, *add_suffix, *regexp;
    strip_prefix = add_prefix = add_suffix = regexp = NULL;
 
-   memset(&rx, 0, sizeof(rx));
-   rx.path = get_pool_memory(PM_FNAME);
-   rx.path[0] = 0;
-
-   rx.fname = get_pool_memory(PM_FNAME);
-   rx.fname[0] = 0;
-
-   rx.JobIds = get_pool_memory(PM_FNAME);
-   rx.JobIds[0] = 0;
-
-   rx.BaseJobIds = get_pool_memory(PM_FNAME);
-   rx.BaseJobIds[0] = 0;
-
-   rx.query = get_pool_memory(PM_FNAME);
-   rx.query[0] = 0;
-
-   rx.bsr = new_bsr();
-   rx.hardlinks_in_mem = true;
-
+   new_rx(&rx);                 /* Initialize RESTORE_CTX */
+   
    if (!open_new_client_db(ua)) {
       goto bail_out;
    }
@@ -204,6 +214,8 @@ int restore_cmd(UAContext *ua, const char *cmd)
          ua->warning_msg(_("No files selected to be restored.\n"));
          goto bail_out;
       }
+
+      ua->send_msg(_("Bootstrap records written to %s\n"), ua->jcr->RestoreBootstrap);
       display_bsr_info(ua, rx);          /* display vols needed, etc */
 
       if (rx.selected_files==1) {
@@ -289,7 +301,7 @@ int restore_cmd(UAContext *ua, const char *cmd)
    }
    Dmsg1(200, "Submitting: %s\n", ua->cmd);
    /*
-    * Transfer jobids, to jcr to
+    * Transfer jobids, component stuff to jcr to
     *  pass to run_cmd().  Note, these are fields and
     *  other things that are not passed on the command
     *  line.
@@ -297,6 +309,10 @@ int restore_cmd(UAContext *ua, const char *cmd)
    /* ***FIXME*** pass jobids on command line */
    jcr->JobIds = rx.JobIds;
    rx.JobIds = NULL;
+   jcr->component_fname = rx.component_fname;
+   rx.component_fname = NULL;
+   jcr->component_fd = rx.component_fd;
+   rx.component_fd = NULL;
    parse_ua_args(ua);
    run_cmd(ua, ua->cmd);
    free_rx(&rx);
@@ -342,7 +358,7 @@ static void get_and_display_basejobs(UAContext *ua, RESTORE_CTX *rx)
    pm_strcpy(rx->BaseJobIds, jobids.list);
 }
 
-static void free_rx(RESTORE_CTX *rx)
+void free_rx(RESTORE_CTX *rx)
 {
    free_bsr(rx->bsr);
    rx->bsr = NULL;
@@ -351,6 +367,14 @@ static void free_rx(RESTORE_CTX *rx)
    free_and_null_pool_memory(rx->fname);
    free_and_null_pool_memory(rx->path);
    free_and_null_pool_memory(rx->query);
+   if (rx->component_fd) {
+      fclose(rx->component_fd);
+      rx->component_fd = NULL;
+   }
+   if (rx->component_fname) {
+      unlink(rx->component_fname);
+   }
+   free_and_null_pool_memory(rx->component_fname);
    free_name_list(&rx->name_list);
 }
 
@@ -791,7 +815,7 @@ static int user_select_jobids_or_files(UAContext *ua, RESTORE_CTX *rx)
          ua->send_msg(_("Selecting jobs to build the Full state at %s\n"),
                       jr.cStartTime);
          jr.JobLevel = L_INCREMENTAL; /* Take Full+Diff+Incr */
-         if (!db_accurate_get_jobids(ua->jcr, ua->db, &jr, &jobids)) {
+         if (!db_get_accurate_jobids(ua->jcr, ua->db, &jr, &jobids)) {
             return 0;
          }
          pm_strcpy(rx->JobIds, jobids.list);
@@ -986,7 +1010,7 @@ static bool insert_dir_into_findex_list(UAContext *ua, RESTORE_CTX *rx, char *di
 /*
  * Get the JobId and FileIndexes of all files in the specified table
  */
-static bool insert_table_into_findex_list(UAContext *ua, RESTORE_CTX *rx, char *table)
+bool insert_table_into_findex_list(UAContext *ua, RESTORE_CTX *rx, char *table)
 {
    strip_trailing_junk(table);
    Mmsg(rx->query, uar_jobid_fileindex_from_table, table);
@@ -1106,6 +1130,43 @@ static void add_delta_list_findex(RESTORE_CTX *rx, struct delta_list *lst)
    add_findex(rx->bsr, lst->JobId, lst->FileIndex);
 }
 
+/*
+ * This is a list of all the files (components) that the
+ *  user has requested for restore. It is requested by
+ *  the plugin (for now hard coded only for VSS).
+ *  In the future, this will be requested by a RestoreObject
+ *  and the plugin name will be sent to the FD.
+ */
+static bool write_component_file(UAContext *ua, RESTORE_CTX *rx, char *fname)
+{
+   int fd;
+   if (!rx->component_fd) {
+      Mmsg(rx->component_fname, "%s/%s.restore.sel.XXXXXX", working_directory, my_name);
+      fd = mkstemp(rx->component_fname);
+      if (fd < 0) {
+         berrno be;
+         ua->error_msg(_("Unable to create component file %s. ERR=%s\n"),
+            rx->component_fname, be.bstrerror());
+         return false;
+      }
+      rx->component_fd = fdopen(fd, "w+");
+      if (!rx->component_fd) {
+         berrno be;
+         ua->error_msg(_("Unable to fdopen component file %s. ERR=%s\n"),
+            rx->component_fname, be.bstrerror());
+         return false;
+      }
+   }
+   fprintf(rx->component_fd, "%s\n", fname);
+   if (ferror(rx->component_fd)) {
+      ua->error_msg(_("Error writing component file.\n"));
+     fclose(rx->component_fd);
+     unlink(rx->component_fname);
+     rx->component_fd = NULL;
+     return false;
+   }
+   return true;
+}
 
 static bool build_directory_tree(UAContext *ua, RESTORE_CTX *rx)
 {
@@ -1230,6 +1291,7 @@ static bool build_directory_tree(UAContext *ua, RESTORE_CTX *rx)
        *  extracted making a bootstrap file.
        */
       if (OK) {
+         char cwd[2000];
          for (TREE_NODE *node=first_tree_node(tree.root); node; node=next_tree_node(node)) {
             Dmsg2(400, "FI=%d node=0x%x\n", node->FileIndex, node);
             if (node->extract || node->extract_dir) {
@@ -1237,6 +1299,18 @@ static bool build_directory_tree(UAContext *ua, RESTORE_CTX *rx)
                /* TODO: optimize bsr insertion when jobid are non sorted */
                add_delta_list_findex(rx, node->delta_list);
                add_findex(rx->bsr, node->JobId, node->FileIndex);
+               /*
+                * Special VSS plugin code to return selected
+                *   components. For the moment, it is hard coded
+                *   for the VSS plugin.
+                */
+               if (fnmatch(":component_info_*", node->fname, 0) == 0) {
+                  tree_getpath(node, cwd, sizeof(cwd));
+                  if (!write_component_file(ua, rx, cwd)) {
+                     OK = false;
+                     break;
+                  }
+               }
                if (node->extract && node->type != TN_NEWDIR) {
                   rx->selected_files++;  /* count only saved files */
                }
@@ -1265,8 +1339,8 @@ static bool select_backups_before_date(UAContext *ua, RESTORE_CTX *rx, char *dat
    int i;
 
    /* Create temp tables */
-   db_sql_query(ua->db, uar_del_temp, NULL, NULL);
-   db_sql_query(ua->db, uar_del_temp1, NULL, NULL);
+  db_sql_query(ua->db, uar_del_temp, NULL, NULL);
+  db_sql_query(ua->db, uar_del_temp1, NULL, NULL);
    if (!db_sql_query(ua->db, uar_create_temp[db_get_type_index(ua->db)], NULL, NULL)) {
       ua->error_msg("%s\n", db_strerror(ua->db));
    }
@@ -1406,8 +1480,8 @@ static bool select_backups_before_date(UAContext *ua, RESTORE_CTX *rx, char *dat
    }
 
 bail_out:
-   db_sql_query(ua->db, uar_del_temp, NULL, NULL);
-   db_sql_query(ua->db, uar_del_temp1, NULL, NULL);
+  db_sql_query(ua->db, uar_del_temp, NULL, NULL);
+  db_sql_query(ua->db, uar_del_temp1, NULL, NULL);
    return ok;
 }
 
@@ -1560,7 +1634,7 @@ void find_storage_resource(UAContext *ua, RESTORE_CTX &rx, char *Storage, char *
             if (acl_access_ok(ua, Storage_ACL, store->name())) {
                rx.store = store;
                Dmsg1(200, "Set store=%s\n", rx.store->name());
-               if (Storage == NULL) {
+               if (Storage == NULL || Storage[0] == 0) {
                   ua->warning_msg(_("Using Storage \"%s\" from MediaType \"%s\".\n"),
                      store->name(), MediaType);
                } else {
diff --git a/src/dird/ua_run.c b/src/dird/ua_run.c
index 1f593fb..f5756d2 100644
--- a/src/dird/ua_run.c
+++ b/src/dird/ua_run.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -128,6 +132,14 @@ int run_cmd(UAContext *ua, const char *cmd)
          jcr->JobIds = ua->jcr->JobIds;
          ua->jcr->JobIds = NULL;
       }
+      /* Transfer VSS component info */
+      if (ua->jcr->component_fname) {
+         jcr->component_fname = ua->jcr->component_fname;
+         ua->jcr->component_fname = NULL;
+         jcr->component_fd = ua->jcr->component_fd;
+         ua->jcr->component_fd = NULL;
+      }
+
       if (!set_run_context_in_jcr(ua, jcr, rc)) {
          break; /* error get out of while loop */
       }
@@ -181,7 +193,23 @@ int run_cmd(UAContext *ua, const char *cmd)
 
 bail_out:
    ua->send_msg(_("Job not run.\n"));
+   if (ua->jcr->component_fd) {
+      fclose(ua->jcr->component_fd);
+      ua->jcr->component_fd = NULL;
+   }
+   if (ua->jcr->component_fname) {
+      unlink(ua->jcr->component_fname);
+      free_and_null_pool_memory(ua->jcr->component_fname);
+   }
    if (jcr) {
+      if (jcr->component_fd) {
+         fclose(jcr->component_fd);
+         jcr->component_fd = NULL;
+      }
+      if (jcr->component_fname) {
+         unlink(jcr->component_fname);
+         free_and_null_pool_memory(jcr->component_fname);
+      }
       free_jcr(jcr);
    }
    return 0;                       /* do not run */
@@ -191,8 +219,13 @@ static JobId_t start_job(UAContext *ua, JCR *jcr, run_ctx &rc)
 {
    JobId_t JobId;
 
-   Dmsg1(100, "Starting JobId=%d\n", rc.jr.JobId);
-   JobId = run_job(jcr);
+   if (rc.jr.JobStatus == JS_Incomplete) {
+      Dmsg1(100, "Ressuming JobId=%d\n", rc.jr.JobId);
+      JobId = resume_job(jcr, &rc.jr);
+   } else {
+      Dmsg1(100, "Starting JobId=%d\n", rc.jr.JobId);
+      JobId = run_job(jcr);
+   }
    Dmsg4(100, "JobId=%u NewJobId=%d pool=%s priority=%d\n", (int)jcr->JobId,
          JobId, jcr->pool->name(), jcr->JobPriority);
    free_jcr(jcr);                  /* release jcr */
@@ -513,7 +546,7 @@ static bool get_jobid_from_list(UAContext *ua, sellist &sl, run_ctx &rc)
 }
 
 /*
- * Restart Canceled or Failed
+ * Restart Canceled, Failed, or Incomplete Jobs
  *
  *  Returns: 0 on error
  *           JobId if OK
@@ -531,6 +564,7 @@ int restart_cmd(UAContext *ua, const char *cmd)
       int32_t job_status;
    };
    struct s_js kw[] = {
+      {"Incomplete", JS_Incomplete},
       {"Canceled",   JS_Canceled},
       {"Failed",     JS_FatalError},
       {"All",        0},
@@ -603,7 +637,6 @@ int restart_cmd(UAContext *ua, const char *cmd)
    return 0;                       /* do not run */
 }
 
-
 int modify_job_parameters(UAContext *ua, JCR *jcr, run_ctx &rc)
 {
    int i, opt;
@@ -653,10 +686,6 @@ int modify_job_parameters(UAContext *ua, JCR *jcr, run_ctx &rc)
       case 0:
          /* Level */
          select_job_level(ua, jcr);
-         if (jcr->is_JobType(JT_BACKUP) && !jcr->is_JobLevel(L_VIRTUAL_FULL)) {
-            apply_pool_overrides(jcr);
-            rc.pool = jcr->pool;
-         }
          goto try_again;
       case 1:
          /* Storage */
@@ -725,12 +754,12 @@ int modify_job_parameters(UAContext *ua, JCR *jcr, run_ctx &rc)
              jcr->getJobType() == JT_MIGRATE ||
              jcr->getJobType() == JT_VERIFY) {      /* Pool */
             rc.pool = select_pool_resource(ua);
-            if (rc.pool && rc.pool != jcr->pool) {
+            if (rc.pool) {
                jcr->pool = rc.pool;
-               pm_strcpy(jcr->pool_source, _("User input"));
                Dmsg1(100, "Set new pool=%s\n", jcr->pool->name());
+               goto try_again;
             }
-            goto try_again;
+            break;
          }
 
          /* Bootstrap */
@@ -764,7 +793,6 @@ int modify_job_parameters(UAContext *ua, JCR *jcr, run_ctx &rc)
             rc.next_pool = select_pool_resource(ua);
             if (rc.next_pool) {
                jcr->next_pool = rc.next_pool;
-               pm_strcpy(jcr->next_pool_source, _("Command input"));
                goto try_again;
             }
          }
@@ -818,6 +846,16 @@ int modify_job_parameters(UAContext *ua, JCR *jcr, run_ctx &rc)
          }
          goto try_again;
       case 12:
+         /* Plugin Options */
+         //generate_plugin_event(jcr, bEventJobConfig, &rc);
+         if (!get_cmd(ua, _("Please Plugin Options string: "))) {
+            break;
+         }
+         if (jcr->plugin_options) {
+            free(jcr->plugin_options);
+            jcr->plugin_options = NULL;
+         }
+         jcr->plugin_options = bstrdup(ua->cmd);
          goto try_again;
       case -1:                        /* error or cancel */
          goto bail_out;
@@ -848,8 +886,13 @@ static bool set_run_context_in_jcr(UAContext *ua, JCR *jcr, run_ctx &rc)
    jcr->previous_job = rc.previous_job;
    jcr->pool = rc.pool;
    jcr->next_pool = rc.next_pool;
+   if (rc.next_pool) {
+      jcr->cmdline_next_pool_override = true;
+   }
    if (rc.pool_name) {
       pm_strcpy(jcr->pool_source, _("Command input"));
+   } else if (jcr->pool != jcr->job->pool) {
+      pm_strcpy(jcr->pool_source, _("User input"));
    }
    if (rc.next_pool_name) {
       pm_strcpy(jcr->next_pool_source, _("Command input"));
@@ -859,7 +902,11 @@ static bool set_run_context_in_jcr(UAContext *ua, JCR *jcr, run_ctx &rc)
 
    set_rwstorage(jcr, rc.store);
    jcr->client = rc.client;
-   pm_strcpy(jcr->client_name, rc.client->name());
+   if (jcr->client) {
+      pm_strcpy(jcr->client_name, rc.client->name());
+   } else {
+      pm_strcpy(jcr->client_name, "**Dummy**");
+   }
    if (rc.media_type) {
       if (!jcr->media_type) {
          jcr->media_type = get_pool_memory(PM_NAME);
@@ -934,6 +981,14 @@ static bool set_run_context_in_jcr(UAContext *ua, JCR *jcr, run_ctx &rc)
    }
    rc.replace = NULL;
 
+   /* Set Snapshot Retention (Job <- Client) */
+   if (jcr->client) {
+      jcr->snapshot_retention = jcr->client->SnapRetention;
+   }
+   if (jcr->job && jcr->job->SnapRetention > 0) {
+      jcr->snapshot_retention = jcr->job->SnapRetention;
+   }
+
    if (rc.Priority) {
       jcr->JobPriority = rc.Priority;
       rc.Priority = 0;
@@ -962,7 +1017,7 @@ static bool set_run_context_in_jcr(UAContext *ua, JCR *jcr, run_ctx &rc)
    }
    rc.replace = ReplaceOptions[0].name;
    for (i=0; ReplaceOptions[i].name; i++) {
-      if ((int)ReplaceOptions[i].token == (int)jcr->replace) {
+      if (ReplaceOptions[i].token == jcr->replace) {
          rc.replace = ReplaceOptions[i].name;
       }
    }
@@ -1268,7 +1323,8 @@ static bool display_job_parameters(UAContext *ua, JCR *jcr, JOB *job, const char
                         "%s"
                         "Storage:  %s\n"
                         "When:     %s\n"
-                        "Priority: %d\n",
+                        "Priority: %d\n"
+                        "%s%s%s",
                  job->name(),
                  level_to_str(jcr->getJobLevel()),
                  jcr->client->name(),
@@ -1277,7 +1333,10 @@ static bool display_job_parameters(UAContext *ua, JCR *jcr, JOB *job, const char
                  next_pool,
                  jcr->wstore?jcr->wstore->name():"*None*",
                  bstrutime(dt, sizeof(dt), jcr->sched_time),
-                 jcr->JobPriority);
+                 jcr->JobPriority,
+                 jcr->plugin_options?"Plugin Options: ":"",
+                 jcr->plugin_options?jcr->plugin_options:"",
+                 jcr->plugin_options?"\n":"");
          } else {
             if (jcr->is_JobLevel(L_VIRTUAL_FULL)) {
                bsnprintf(next_pool, sizeof(next_pool),
@@ -1294,7 +1353,8 @@ static bool display_job_parameters(UAContext *ua, JCR *jcr, JOB *job, const char
                         "%s"
                         "Storage:  %s (From %s)\n"
                         "When:     %s\n"
-                        "Priority: %d\n"),
+                        "Priority: %d\n"
+                        "%s%s%s"),
                  job->name(),
                  level_to_str(jcr->getJobLevel()),
                  jcr->client->name(),
@@ -1303,7 +1363,10 @@ static bool display_job_parameters(UAContext *ua, JCR *jcr, JOB *job, const char
                  next_pool,
                  jcr->wstore?jcr->wstore->name():"*None*", jcr->wstore_source,
                  bstrutime(dt, sizeof(dt), jcr->sched_time),
-                 jcr->JobPriority);
+                 jcr->JobPriority,
+                 jcr->plugin_options?"Plugin Options: ":"",
+                 jcr->plugin_options?jcr->plugin_options:"",
+                 jcr->plugin_options?"\n":"");
          }
       } else {  /* JT_VERIFY */
          JOB_DBR jr;
@@ -1407,7 +1470,8 @@ static bool display_job_parameters(UAContext *ua, JCR *jcr, JOB *job, const char
                         "Storage:         %s\n"
                         "When:            %s\n"
                         "Catalog:         %s\n"
-                        "Priority:        %d\n",
+                        "Priority:        %d\n"
+                        "Plugin Options:  %s\n",
                  job->name(),
                  NPRT(jcr->RestoreBootstrap),
                  jcr->RegexWhere?jcr->RegexWhere:job->RegexWhere,
@@ -1418,7 +1482,9 @@ static bool display_job_parameters(UAContext *ua, JCR *jcr, JOB *job, const char
                  jcr->rstore->name(),
                  bstrutime(dt, sizeof(dt), jcr->sched_time),
                  jcr->catalog->name(),
-                 jcr->JobPriority);
+                 jcr->JobPriority,
+                 NPRTB(jcr->plugin_options));
+
             } else {
                ua->send_msg(_("Run Restore job\n"
                         "JobName:         %s\n"
@@ -1431,7 +1497,8 @@ static bool display_job_parameters(UAContext *ua, JCR *jcr, JOB *job, const char
                         "Storage:         %s\n"
                         "When:            %s\n"
                         "Catalog:         %s\n"
-                        "Priority:        %d\n"),
+                        "Priority:        %d\n"
+                        "Plugin Options:  %s\n"),
                  job->name(),
                  NPRT(jcr->RestoreBootstrap),
                  jcr->RegexWhere?jcr->RegexWhere:job->RegexWhere,
@@ -1442,7 +1509,8 @@ static bool display_job_parameters(UAContext *ua, JCR *jcr, JOB *job, const char
                  jcr->rstore->name(),
                  bstrutime(dt, sizeof(dt), jcr->sched_time),
                  jcr->catalog->name(),
-                 jcr->JobPriority);
+                 jcr->JobPriority,
+                 NPRTB(jcr->plugin_options));
             }
          } else {
             if (ua->api) {
@@ -1459,7 +1527,8 @@ static bool display_job_parameters(UAContext *ua, JCR *jcr, JOB *job, const char
                         "Storage:         %s\n"
                         "When:            %s\n"
                         "Catalog:         %s\n"
-                        "Priority:        %d\n",
+                        "Priority:        %d\n"
+                        "Plugin Options:  %s\n",
                  job->name(),
                  NPRT(jcr->RestoreBootstrap),
                  jcr->where?jcr->where:NPRT(job->RestoreWhere),
@@ -1470,7 +1539,9 @@ static bool display_job_parameters(UAContext *ua, JCR *jcr, JOB *job, const char
                  jcr->rstore->name(),
                  bstrutime(dt, sizeof(dt), jcr->sched_time),
                  jcr->catalog->name(),
-                 jcr->JobPriority);
+                 jcr->JobPriority,
+                 NPRTB(jcr->plugin_options));
+
             } else {
                ua->send_msg(_("Run Restore job\n"
                         "JobName:         %s\n"
@@ -1483,7 +1554,8 @@ static bool display_job_parameters(UAContext *ua, JCR *jcr, JOB *job, const char
                         "Storage:         %s\n"
                         "When:            %s\n"
                         "Catalog:         %s\n"
-                        "Priority:        %d\n"),
+                        "Priority:        %d\n"
+                        "Plugin Options:  %s\n"),
                  job->name(),
                  NPRT(jcr->RestoreBootstrap),
                  jcr->where?jcr->where:NPRT(job->RestoreWhere),
@@ -1494,7 +1566,8 @@ static bool display_job_parameters(UAContext *ua, JCR *jcr, JOB *job, const char
                  jcr->rstore->name(),
                  bstrutime(dt, sizeof(dt), jcr->sched_time),
                  jcr->catalog->name(),
-                 jcr->JobPriority);
+                 jcr->JobPriority,
+                 NPRTB(jcr->plugin_options));
             }
          }
 
@@ -1522,14 +1595,16 @@ static bool display_job_parameters(UAContext *ua, JCR *jcr, JOB *job, const char
                         "JobId:           %s\n"
                         "When:            %s\n"
                         "Catalog:         %s\n"
-                        "Priority:        %d\n"),
+                        "Priority:        %d\n"
+                        "Plugin Options:  %s\n"),
               replace,
               jcr->client->name(),
               jcr->rstore->name(),
               jcr->RestoreJobId==0?"*None*":edit_uint64(jcr->RestoreJobId, ec1),
               bstrutime(dt, sizeof(dt), jcr->sched_time),
               jcr->catalog->name(),
-              jcr->JobPriority);
+              jcr->JobPriority,
+              NPRTB(jcr->plugin_options));
        }
       break;
    case JT_COPY:
@@ -1620,7 +1695,7 @@ static bool scan_run_command_line_arguments(UAContext *ua, run_ctx &rc)
       "alljobid",                     /* 0 Used in a switch() */
       "jobid",                        /* 1 */
       "client",                       /* 2 */
-      "fd",                           /* 3 */
+      "fd",
       "fileset",                      /* 4 */
       "level",                        /* 5 */
       "storage",                      /* 6 */
@@ -1631,7 +1706,7 @@ static bool scan_run_command_line_arguments(UAContext *ua, run_ctx &rc)
       "replace",                      /* 11 */
       "when",                         /* 12 */
       "priority",                     /* 13 */
-      "yes",                          /* 14  -- if you change this change YES_POS too */
+      "yes",        /* 14  -- if you change this change YES_POS too */
       "verifyjob",                    /* 15 */
       "files",                        /* 16 number of files to restore */
       "catalog",                      /* 17 override catalog */
@@ -1650,8 +1725,7 @@ static bool scan_run_command_line_arguments(UAContext *ua, run_ctx &rc)
       "job",                          /* 30 */
       "mediatype",                    /* 31 */
       "nextpool",                     /* 32 override next pool name */
-      NULL
-   };
+      NULL};
 
 #define YES_POS 14
 
@@ -1670,6 +1744,7 @@ static bool scan_run_command_line_arguments(UAContext *ua, run_ctx &rc)
    rc.spool_data_set = false;
    rc.ignoreduplicatecheck = false;
    rc.comment = NULL;
+   rc.plugin_options = NULL;
 
    for (i=1; i<ua->argc; i++) {
       Dmsg2(800, "Doing arg %d = %s\n", i, ua->argk[i]);
diff --git a/src/dird/ua_select.c b/src/dird/ua_select.c
index 72a5d61..343dbbe 100644
--- a/src/dird/ua_select.c
+++ b/src/dird/ua_select.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -27,6 +31,28 @@
 /* Imported variables */
 extern struct s_jl joblevels[];
 
+int confirm_retention_yesno(UAContext *ua, utime_t ret, const char *msg)
+{
+   char ed1[100];
+   int val;
+
+   /* Look for "yes" in command line */
+   if (find_arg(ua, NT_("yes")) != -1) {
+      return 1;
+   }
+
+   for ( ;; ) {
+       ua->info_msg(_("The current %s retention period is: %s\n"),
+          msg, edit_utime(ret, ed1, sizeof(ed1)));
+       if (!get_cmd(ua, _("Continue? (yes/no): "))) {
+          return 0;
+       }
+       if (is_yesno(ua->cmd, &val)) {
+          return val;           /* is 1 for yes, 0 for no */
+       }
+    }
+    return 1;
+}
 
 /*
  * Confirm a retention period
@@ -36,14 +62,15 @@ int confirm_retention(UAContext *ua, utime_t *ret, const char *msg)
    char ed1[100];
    int val;
 
-   int yes_in_arg = find_arg(ua, NT_("yes"));
+   /* Look for "yes" in command line */
+   if (find_arg(ua, NT_("yes")) != -1) {
+      return 1;
+   }
 
    for ( ;; ) {
        ua->info_msg(_("The current %s retention period is: %s\n"),
           msg, edit_utime(*ret, ed1, sizeof(ed1)));
-       if (yes_in_arg != -1) {
-          return 1;
-       }
+
        if (!get_cmd(ua, _("Continue? (yes/mod/no): "))) {
           return 0;
        }
@@ -251,7 +278,11 @@ JOB *select_enable_disable_job_resource(UAContext *ua, bool enable)
    JOB *job;
 
    LockRes();
-   start_prompt(ua, _("The defined Job resources are:\n"));
+   if (enable) {
+      start_prompt(ua, _("The disabled Job resources are:\n"));
+   } else {
+      start_prompt(ua, _("The enabled Job resources are:\n"));
+   }
    foreach_res(job, R_JOB) {
       if (!acl_access_ok(ua, Job_ACL, job->name())) {
          continue;
@@ -333,6 +364,32 @@ JOB *select_restore_job_resource(UAContext *ua)
    return job;
 }
 
+/*
+ * Select a client to enable or disable
+ */
+CLIENT *select_enable_disable_client_resource(UAContext *ua, bool enable)
+{
+   char name[MAX_NAME_LENGTH];
+   CLIENT *client;
+
+   LockRes();
+   start_prompt(ua, _("The defined Client resources are:\n"));
+   foreach_res(client, R_CLIENT) {
+      if (!acl_access_ok(ua, Client_ACL, client->name())) {
+         continue;
+      }
+      if (client->enabled == enable) {   /* Already enabled/disabled? */
+         continue;                       /* yes, skip */
+      }
+      add_prompt(ua, client->name());
+   }
+   UnlockRes();
+   if (do_prompt(ua, _("Client"), _("Select Client resource"), name, sizeof(name)) < 0) {
+      return NULL;
+   }
+   client = (CLIENT *)GetResWithName(R_CLIENT, name);
+   return client;
+}
 
 
 /*
@@ -385,6 +442,34 @@ CLIENT *get_client_resource(UAContext *ua)
    return select_client_resource(ua);
 }
 
+/*
+ * Select a schedule to enable or disable
+ */
+SCHED *select_enable_disable_schedule_resource(UAContext *ua, bool enable)
+{
+   char name[MAX_NAME_LENGTH];
+   SCHED *sched;
+
+   LockRes();
+   start_prompt(ua, _("The defined Schedule resources are:\n"));
+   foreach_res(sched, R_SCHEDULE) {
+      if (!acl_access_ok(ua, Schedule_ACL, sched->name())) {
+         continue;
+      }
+      if (sched->enabled == enable) {   /* Already enabled/disabled? */
+         continue;                      /* yes, skip */
+      }
+      add_prompt(ua, sched->name());
+   }
+   UnlockRes();
+   if (do_prompt(ua, _("Schedule"), _("Select Schedule resource"), name, sizeof(name)) < 0) {
+      return NULL;
+   }
+   sched = (SCHED *)GetResWithName(R_SCHEDULE, name);
+   return sched;
+}
+
+
 /* Scan what the user has entered looking for:
  *
  *  client=<client-name>
@@ -619,7 +704,7 @@ int select_media_dbr(UAContext *ua, MEDIA_DBR *mr)
       }
       mr->PoolId = pr.PoolId;
       db_list_media_records(ua->jcr, ua->db, mr, prtit, ua, HORZ_LIST);
-      if (!get_cmd(ua, _("Enter *MediaId or Volume name: "))) {
+      if (!get_cmd(ua, _("Enter a Volume name or *MediaId: "))) {
          goto bail_out;
       }
       if (ua->cmd[0] == '*' && is_a_number(ua->cmd+1)) {
@@ -1299,13 +1384,20 @@ int select_running_jobs(UAContext *ua, alist *jcrs, const char *reason)
             ua->error_msg(_("No value given for \"job\".\n"));
             goto bail_out;
          }
-         if (!(jcr=get_jcr_by_partial_name(ua->argv[i]))) {
-            ua->warning_msg(_("Warning Job %s is not running.\n"), ua->argv[i]);
-            jcr = new_jcr(sizeof(JCR), dird_free_jcr);
-            bstrncpy(jcr->Job, ua->argv[i], sizeof(jcr->Job));
-         }
+         jcr = get_jcr_by_partial_name(ua->argv[i]);
+
          if (jcr && jcr->job && acl_access_ok(ua, Job_ACL, jcr->job->name())) {
             jcrs->append(jcr);
+
+         } else if (jcr) {
+            if (jcr->job) {
+               ua->error_msg(_("Unauthorized command from this console "
+                               "for job=%s.\n"), ua->argv[i]);
+            }
+            free_jcr(jcr);
+
+         } else {
+            ua->warning_msg(_("Warning Job %s is not running.\n"), ua->argv[i]);
          }
          if (jcrs->size() == 0) {
             goto bail_out;               /* If we did not find specified jobid, get out */
@@ -1317,13 +1409,20 @@ int select_running_jobs(UAContext *ua, alist *jcrs, const char *reason)
             ua->error_msg(_("No value given for \"ujobid\".\n"));
             goto bail_out;
          }
-         if (!(jcr=get_jcr_by_full_name(ua->argv[i]))) {
-            ua->warning_msg(_("Warning Job %s is not running.\n"), ua->argv[i]);
-            jcr = new_jcr(sizeof(JCR), dird_free_jcr);
-            bstrncpy(jcr->Job, ua->argv[i], sizeof(jcr->Job));
-         }
+         jcr = get_jcr_by_full_name(ua->argv[i]);
+
          if (jcr && jcr->job && acl_access_ok(ua, Job_ACL, jcr->job->name())) {
             jcrs->append(jcr);
+
+         } else if (jcr) {
+            if (jcr->job) {
+               ua->error_msg(_("Unauthorized command from this console "
+                               "for ujobid=%s.\n"), ua->argv[i]);
+            }
+            free_jcr(jcr);
+
+         } else {
+            ua->warning_msg(_("Warning Job %s is not running.\n"), ua->argv[i]);
          }
          if (jcrs->size() == 0) {
             goto bail_out;               /* If we did not find specified jobid, get out */
diff --git a/src/dird/ua_server.c b/src/dird/ua_server.c
index b099fff..eb5c586 100644
--- a/src/dird/ua_server.c
+++ b/src/dird/ua_server.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
diff --git a/src/dird/ua_status.c b/src/dird/ua_status.c
index 1e5d7a3..6ac3d66 100644
--- a/src/dird/ua_status.c
+++ b/src/dird/ua_status.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -288,29 +292,30 @@ static void do_all_status(UAContext *ua)
 
 void list_dir_status_header(UAContext *ua)
 {
-   char dt[MAX_TIME_LENGTH];
+   char dt[MAX_TIME_LENGTH], dt1[MAX_TIME_LENGTH];
    char b1[35], b2[35], b3[35], b4[35], b5[35];
 
-   ua->send_msg(_("%s Version: %s (%s) %s %s %s\n"), my_name, VERSION, BDATE,
-            HOST_OS, DISTNAME, DISTVER);
+   ua->send_msg(_("%s %sVersion: %s (%s) %s %s %s\n"), my_name,
+            "", VERSION, BDATE, HOST_OS, DISTNAME, DISTVER);
    bstrftime_nc(dt, sizeof(dt), daemon_start_time);
-   ua->send_msg(_("Daemon started %s. Jobs: run=%d, running=%d "
-                  "mode=%d,%d\n"), dt,
-                num_jobs_run, job_count(), (int)DEVELOPER_MODE, (int)BEEF);
+   bstrftimes(dt1, sizeof(dt1), last_reload_time);
+   ua->send_msg(_("Daemon started %s, conf reloaded %s\n"), dt, dt1);
+   ua->send_msg(_(" Jobs: run=%d, running=%d mode=%d\n"),
+      num_jobs_run, job_count(), (int)DEVELOPER_MODE);
    ua->send_msg(_(" Heap: heap=%s smbytes=%s max_bytes=%s bufs=%s max_bufs=%s\n"),
-            edit_uint64_with_commas((char *)sbrk(0)-(char *)start_heap, b1),
-            edit_uint64_with_commas(sm_bytes, b2),
-            edit_uint64_with_commas(sm_max_bytes, b3),
-            edit_uint64_with_commas(sm_buffers, b4),
-            edit_uint64_with_commas(sm_max_buffers, b5));
+      edit_uint64_with_commas((char *)sbrk(0)-(char *)start_heap, b1),
+      edit_uint64_with_commas(sm_bytes, b2),
+      edit_uint64_with_commas(sm_max_bytes, b3),
+      edit_uint64_with_commas(sm_buffers, b4),
+      edit_uint64_with_commas(sm_max_buffers, b5));
 
    /* TODO: use this function once for all daemons */
-   if (bplugin_list->size() > 0) {
+   if (b_plugin_list->size() > 0) {
       int len;
       Plugin *plugin;
       POOL_MEM msg(PM_FNAME);
       pm_strcpy(msg, " Plugin: ");
-      foreach_alist(plugin, bplugin_list) {
+      foreach_alist(plugin, b_plugin_list) {
          len = pm_strcat(msg, plugin->file);
          if (len > 80) {
             pm_strcat(msg, "\n   ");
@@ -355,7 +360,7 @@ static void do_storage_status(UAContext *ua, STORE *store, char *cmd)
    }
    /*
     * The Storage daemon is problematic because it shows information
-    *  related to multiple Jobs, so if there is a Client or Job
+    *  related to multiple Job, so if there is a Client or Job
     *  ACL restriction, we forbid all access to the Storage.
     */
    if (have_restricted_acl(ua, Client_ACL) ||
@@ -379,13 +384,29 @@ static void do_storage_status(UAContext *ua, STORE *store, char *cmd)
    sd = ua->jcr->store_bsock;
    if (cmd) {
       POOL_MEM devname;
-      int i = find_arg_with_value(ua, "device");
-      if (i>0) {
-         Mmsg(devname, "device=%s", ua->argv[i]);
+      /*
+       * For .status storage=xxx shstore list
+       *  send .status shstore list xxx-device
+       */
+      if (strcasecmp(cmd, "shstore") == 0) {
+         if (!ua->argk[3]) {
+            ua->send_msg(_("Must have three aguments\n"));
+            return;
+         }
+         pm_strcpy(devname, store->dev_name());
          bash_spaces(devname.c_str());
+         sd->fsend(".status %s %s %s api=%d api_opts=%s",
+                   cmd, ua->argk[3], devname.c_str(),
+                   ua->api, ua->api_opts);
+      } else {
+         int i = find_arg_with_value(ua, "device");
+         if (i>0) {
+            Mmsg(devname, "device=%s", ua->argv[i]);
+            bash_spaces(devname.c_str());
+         }
+         sd->fsend(".status %s api=%d api_opts=%s %s",
+                   cmd, ua->api, ua->api_opts, devname.c_str());
       }
-      sd->fsend(".status %s api=%d api_opts=%s %s",
-                cmd, ua->api, ua->api_opts, devname.c_str());
    } else {
       sd->fsend("status");
    }
@@ -509,7 +530,7 @@ static void prt_runtime(UAContext *ua, sched_pkt *sp)
       level_ptr = level_to_str(sp->level);
       break;
    }
-   if (ua->api) {
+   if (ua->api == 1) {
       ua->send_msg(_("%-14s\t%-8s\t%3d\t%-18s\t%-18s\t%s\n"),
          level_ptr, job_type_to_str(sp->job->JobType), sp->priority, dt,
          sp->job->name(), mr.VolumeName);
@@ -595,10 +616,11 @@ static void llist_scheduled_jobs(UAContext *ua)
    LockRes();
    foreach_res(job, R_JOB) {
       sched = job->schedule;
-      if (sched == NULL || !job->enabled) { /* scheduled? or enabled? */
+      if (!sched || !job->enabled || (sched && !sched->enabled) ||
+         (job->client && !job->client->enabled)) {
          continue;                    /* no, skip this job */
       }
-      if (job_name[0] && bstrcmp(job_name, job->name()) != 0) {
+      if (job_name[0] && strcmp(job_name, job->name()) != 0) {
          continue;
       }
       for (run=sched->run; run; run=run->next) {
@@ -808,38 +830,46 @@ static void list_running_jobs(UAContext *ua)
 {
    JCR *jcr;
    int njobs = 0;
+   int i;
    const char *msg;
    char *emsg;                        /* edited message */
    char dt[MAX_TIME_LENGTH];
    char level[10];
    bool pool_mem = false;
+   JobId_t jid = 0;
+
+   if ((i = find_arg_with_value(ua, "jobid")) >= 0) {
+      jid = str_to_int64(ua->argv[i]);
+   }
 
    Dmsg0(200, "enter list_run_jobs()\n");
-   if (!ua->api) ua->send_msg(_("\nRunning Jobs:\n"));
-   foreach_jcr(jcr) {
-      if (jcr->JobId == 0) {      /* this is us */
-         /* this is a console or other control job. We only show console
-          * jobs in the status output.
-          */
-         if (jcr->getJobType() == JT_CONSOLE && !ua->api) {
-            bstrftime_nc(dt, sizeof(dt), jcr->start_time);
-            ua->send_msg(_("Console connected at %s\n"), dt);
+
+   if (!ua->api) {
+      ua->send_msg(_("\nRunning Jobs:\n"));
+      foreach_jcr(jcr) {
+         if (jcr->JobId == 0) {      /* this is us */
+            /* this is a console or other control job. We only show console
+             * jobs in the status output.
+             */
+            if (jcr->getJobType() == JT_CONSOLE) {
+               bstrftime_nc(dt, sizeof(dt), jcr->start_time);
+               ua->send_msg(_("Console connected %sat %s\n"),
+                            (ua->UA_sock && ua->UA_sock->tls)?_("using TLS "):"",
+                            dt);
+            }
+            continue;
          }
-         continue;
+         njobs++;
       }
-      njobs++;
-   }
-   endeach_jcr(jcr);
-
-   if (njobs == 0) {
-      /* Note the following message is used in regress -- don't change */
-      if (!ua->api)  {
+      endeach_jcr(jcr);
+      if (njobs == 0) {
+         /* Note the following message is used in regress -- don't change */
          ua->send_msg(_("No Jobs running.\n====\n"));
+         Dmsg0(200, "leave list_run_jobs()\n");
+         return;
       }
-      Dmsg0(200, "leave list_run_jobs()\n");
-      return;
    }
-   njobs = 0;
+
    if (!ua->api) {
       ua->send_msg(_(" JobId  Type Level     Files     Bytes  Name              Status\n"));
       ua->send_msg(_("======================================================================\n"));
@@ -848,7 +878,10 @@ static void list_running_jobs(UAContext *ua)
       if (jcr->JobId == 0 || !acl_access_ok(ua, Job_ACL, jcr->job->name())) {
          continue;
       }
-      njobs++;
+      /* JobId keyword found in command line */
+      if (jid > 0 && jcr->JobId != jid) {
+         continue;
+      }
       switch (jcr->JobStatus) {
       case JS_Created:
          msg = _("is waiting execution");
@@ -865,6 +898,9 @@ static void list_running_jobs(UAContext *ua)
       case JS_Warnings:
          msg = _("has terminated with warnings");
          break;
+      case JS_Incomplete:
+         msg = _("has terminated in incomplete state");
+         break;
       case JS_ErrorTerminated:
          msg = _("has erred");
          break;
@@ -1007,6 +1043,7 @@ static void list_running_jobs(UAContext *ua)
          ua->send_msg(_("%6d\t%-6s\t%-20s\t%s\t%s\n"),
                       jcr->JobId, level, jcr->Job, msg, jcr->comment);
          unbash_spaces(jcr->comment);
+
       } else {
          char b1[50], b2[50], b3[50];
          level[4] = 0;
@@ -1095,6 +1132,9 @@ static void list_terminated_jobs(UAContext *ua)
       case JS_Warnings:
          termstat = _("OK -- with warnings");
          break;
+      case JS_Incomplete:
+         termstat = _("Incomplete");
+         break;
       default:
          termstat = _("Other");
          break;
diff --git a/src/dird/ua_tree.c b/src/dird/ua_tree.c
index 3cf5c15..8230e0c 100644
--- a/src/dird/ua_tree.c
+++ b/src/dird/ua_tree.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2002-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -123,7 +127,7 @@ bool user_select_files_from_tree(TREE_CTX *tree)
       if (ua->api) user->signal(BNET_CMD_BEGIN);
       parse_args_only(ua->cmd, &ua->args, &ua->argc, ua->argk, ua->argv, MAX_CMD_ARGS);
       if (ua->argc == 0) {
-         ua->warning_msg(_("Invalid command \"%s\". Enter \"done\" to exit.\n"), ua->cmd);
+         ua->warning_msg(_("Invalid command \"%s\".  Enter \"done\" to exit.\n"), ua->cmd);
          if (ua->api) user->signal(BNET_CMD_FAILED);
          continue;
       }
@@ -142,7 +146,7 @@ bool user_select_files_from_tree(TREE_CTX *tree)
             /* Some unknow dot command -- probably .messages, ignore it */
             continue;
          }
-         ua->warning_msg(_("Invalid command \"%s\". Enter \"done\" to exit.\n"), ua->cmd);
+         ua->warning_msg(_("Invalid command \"%s\".  Enter \"done\" to exit.\n"), ua->cmd);
          if (ua->api) user->signal(BNET_CMD_FAILED);
          continue;
       }
diff --git a/src/dird/ua_update.c b/src/dird/ua_update.c
index 65fe68e..6362d8c 100644
--- a/src/dird/ua_update.c
+++ b/src/dird/ua_update.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -54,6 +58,8 @@ int update_cmd(UAContext *ua, const char *cmd)
       NT_("slot"),   /* 4 */
       NT_("jobid"),  /* 5 */
       NT_("stats"),  /* 6 */
+      NT_("snap"),   /* 7 */
+      NT_("snapshot"),/* 8 */
       NULL};
 
    if (!open_client_db(ua)) {
@@ -78,6 +84,10 @@ int update_cmd(UAContext *ua, const char *cmd)
    case 6:
       update_stats(ua);
       return 1;
+   case 7:
+   case 8:
+      update_snapshot(ua);
+      return 1;
    default:
       break;
    }
@@ -87,6 +97,7 @@ int update_cmd(UAContext *ua, const char *cmd)
    add_prompt(ua, _("Pool from resource"));
    add_prompt(ua, _("Slots from autochanger"));
    add_prompt(ua, _("Long term statistics"));
+   add_prompt(ua, _("Snapshot parameters"));
    switch (do_prompt(ua, _("item"), _("Choose catalog item to update"), NULL, 0)) {
    case 0:
       update_volume(ua);
@@ -100,6 +111,9 @@ int update_cmd(UAContext *ua, const char *cmd)
    case 3:
       update_stats(ua);
       break;
+   case 4:
+      update_snapshot(ua);
+      break;
    default:
       break;
    }
diff --git a/src/dird/vbackup.c b/src/dird/vbackup.c
index 64d69bb..a1af9dc 100644
--- a/src/dird/vbackup.c
+++ b/src/dird/vbackup.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2008-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -146,7 +150,7 @@ _("This Job is not an Accurate backup so is not equivalent to a Full backup.\n")
               jr.cStartTime);
 
          jr.JobLevel = L_INCREMENTAL; /* Take Full+Diff+Incr */
-         db_accurate_get_jobids(jcr, jcr->db, &jr, &jobids);
+         db_get_accurate_jobids(jcr, jcr->db, &jr, &jobids);
 
       } else if (sel.set_string(jcr->JobIds, true)) {
          /* Found alljobid keyword */
@@ -204,7 +208,7 @@ _("This Job is not an Accurate backup so is not equivalent to a Full backup.\n")
 
    } else {                     /* No argument provided */
       jcr->jr.JobLevel = L_VIRTUAL_FULL;
-      db_accurate_get_jobids(jcr, jcr->db, &jcr->jr, &jobids);
+      db_get_accurate_jobids(jcr, jcr->db, &jcr->jr, &jobids);
       Dmsg1(10, "Accurate jobids=%s\n", jobids.list);
    }
 
diff --git a/src/dird/verify.c b/src/dird/verify.c
index 84575ba..a811859 100644
--- a/src/dird/verify.c
+++ b/src/dird/verify.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -271,7 +275,7 @@ bool do_verify(JCR *jcr)
       break;
    case L_VERIFY_VOLUME_TO_CATALOG:
       if (jcr->sd_calls_client) {
-         if (jcr->FDVersion < 5) {
+         if (jcr->FDVersion < 10) {
             Jmsg(jcr, M_FATAL, 0, _("The File daemon does not support SDCallsClient.\n"));
             goto bail_out;
          }
@@ -552,22 +556,27 @@ void get_attributes_and_compare_to_catalog(JCR *jcr, JobId_t JobId)
     *   Link name  ???
     */
    while ((n=bget_dirmsg(fd)) >= 0 && !job_canceled(jcr)) {
-      int stream;
+      int32_t stream, full_stream;
       char *attr, *p, *fn;
       char Opts_Digest[MAXSTRING];        /* Verify Opts or MD5/SHA1 digest */
 
       if (job_canceled(jcr)) {
-         goto bail_out;
+         free_pool_memory(fname);
+         return;
       }
       fname = check_pool_memory_size(fname, fd->msglen);
       jcr->fname = check_pool_memory_size(jcr->fname, fd->msglen);
       Dmsg1(200, "Atts+Digest=%s\n", fd->msg);
-      if ((len = sscanf(fd->msg, "%ld %d %100s", &file_index, &stream,
+      if ((len = sscanf(fd->msg, "%ld %d %100s", &file_index, &full_stream,
             fname)) != 3) {
          Jmsg3(jcr, M_FATAL, 0, _("bird<filed: bad attributes, expected 3 fields got %d\n"
 " mslen=%d msg=%s\n"), len, fd->msglen, fd->msg);
-         goto bail_out;
+         free_pool_memory(fname);
+         return;
       }
+      stream = full_stream & STREAMMASK_TYPE;
+      Dmsg4(30, "Got hdr: FilInx=%d FullStream=%d Stream=%d fname=%s.\n", file_index, full_stream, stream, fname);
+
       /*
        * We read the Options or Signature into fname
        *  to prevent overrun, now copy it to proper location.
@@ -737,7 +746,8 @@ void get_attributes_and_compare_to_catalog(JCR *jcr, JobId_t JobId)
          if (jcr->FileIndex != (uint32_t)file_index) {
             Jmsg2(jcr, M_FATAL, 0, _("MD5/SHA1 index %d not same as attributes %d\n"),
                file_index, jcr->FileIndex);
-            goto bail_out;
+            free_pool_memory(fname);
+            return;
          }
          if (do_Digest != CRYPTO_DIGEST_NONE) {
             db_escape_string(jcr, jcr->db, buf, Opts_Digest, strlen(Opts_Digest));
@@ -756,7 +766,8 @@ void get_attributes_and_compare_to_catalog(JCR *jcr, JobId_t JobId)
       berrno be;
       Jmsg2(jcr, M_FATAL, 0, _("bdird<filed: bad attributes from filed n=%d : %s\n"),
                         n, be.bstrerror());
-      goto bail_out;
+      free_pool_memory(fname);
+      return;
    }
 
    /* Now find all the files that are missing -- i.e. all files in
@@ -774,8 +785,6 @@ void get_attributes_and_compare_to_catalog(JCR *jcr, JobId_t JobId)
    if (jcr->fn_printed) {
       jcr->setJobStatus(JS_Differences);
    }
-
-bail_out:
    free_pool_memory(fname);
 }
 
diff --git a/src/filed/Makefile.in b/src/filed/Makefile.in
index 1a6ca05..7fca1a8 100644
--- a/src/filed/Makefile.in
+++ b/src/filed/Makefile.in
@@ -1,8 +1,9 @@
 #
 # Bacula Makefile for the File daemon
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #
-
 @MCOMMON@
 
 srcdir =	.
@@ -29,9 +30,10 @@ first_rule: all
 dummy:
 
 #
-SVRSRCS = filed.c authenticate.c acl.c backup.c estimate.c \
+SVRSRCS = filed.c authenticate.c acl.c backup.c crypto.c \
+	  estimate.c \
 	  fd_plugins.c accurate.c \
-	  filed_conf.c heartbeat.c job.c \
+	  filed_conf.c heartbeat.c hello.c job.c fd_snapshot.c \
 	  restore.c status.c verify.c verify_vol.c xattr.c
 SVROBJS = $(SVRSRCS:.c=.o)
 
@@ -61,40 +63,15 @@ acl.o: acl.c
 	@echo "Compiling $<"
 	$(NO_ECHO)$(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) $(LZO_INC) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) $(AFS_CFLAGS) $<
 
-win32/winlib.a:
-	@if test -f win32/Makefile -a "${GMAKE}" != "none"; then \
-	   (cd win32; $(GMAKE) DESTDIR=$(DESTDIR)); \
-	fi
-	@rm -f bacula-fd.exe
-
-win32/winmain.o:
-	@if test -f win32/Makefile -a "${GMAKE}" != "none"; then \
-	   (cd win32; $(GMAKE) DESTDIR=$(DESTDIR)); \
-	fi
-	@rm -f bacula-fd.exe
-
-win32/winres.res:
-	@if test -f win32/Makefile -a "${GMAKE}" != "none"; then \
-	   (cd win32; $(GMAKE) DESTDIR=$(DESTDIR)); \
-	fi
-	@rm -f bacula-fd.exe
-
-# win32 libraries if needed
-win32:	$(WIN32OBJS)
-	@if test -f win32/Makefile -a "${GMAKE}" != "none"; then \
-	   (cd win32; $(GMAKE) DESTDIR=$(DESTDIR)); \
-	fi
-	@rm -f bacula-fd.exe
-
 bacula-fd:  Makefile $(SVROBJS) ../findlib/libbacfind$(DEFAULT_ARCHIVE_TYPE) ../lib/libbaccfg$(DEFAULT_ARCHIVE_TYPE) ../lib/libbac$(DEFAULT_ARCHIVE_TYPE)
 	@echo "Linking $@ ..."
 	$(LIBTOOL_LINK) $(CXX) $(WLDFLAGS) $(LDFLAGS) -L../lib -L../findlib -o $@ $(SVROBJS) \
-	  $(WIN32LIBS) $(FDLIBS) $(ZLIBS) -lbacfind -lbaccfg -lbac -lm $(LIBS) \
+	  $(FDLIBS) $(ZLIBS) -lbacfind -lbaccfg -lbac -lm $(LIBS) \
 	  $(DLIB) $(WRAPLIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS) $(CAP_LIBS) $(AFS_LIBS) $(LZO_LIBS)
 
 static-bacula-fd: Makefile $(SVROBJS) ../findlib/libbacfind.a ../lib/libbaccfg$(DEFAULT_ARCHIVE_TYPE) ../lib/libbac$(DEFAULT_ARCHIVE_TYPE)
 	$(LIBTOOL_LINK) $(CXX) $(WLDFLAGS) $(LDFLAGS) -static -L../lib -L../findlib -o $@ $(SVROBJS) \
-	   $(WIN32LIBS) $(FDLIBS) $(ZLIBS) -lbacfind -lbaccfg -lbac -lm $(LIBS) \
+	   $(FDLIBS) $(ZLIBS) -lbacfind -lbaccfg -lbac -lm $(LIBS) \
 	   $(DLIB) $(WRAPLIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS) $(CAP_LIBS) $(AFS_LIBS) $(LZO_LIBS)
 	strip $@
 
@@ -108,9 +85,6 @@ libtool-clean:
 clean:	libtool-clean
 	@$(RMF) bacula-fd filed core core.* a.out *.o *.bak *~ *.intpro *.extpro 1 2 3
 	@$(RMF) static-bacula-fd
-	@if test -f win32/Makefile -a "${GMAKE}" != "none"; then \
-	   (cd win32; $(GMAKE) clean); \
-	fi
 
 realclean: clean
 	@$(RMF) tags bacula-fd.conf
@@ -118,19 +92,13 @@ realclean: clean
 distclean: realclean
 	if test $(srcdir) = .; then $(MAKE) realclean; fi
 	(cd $(srcdir); $(RMF) Makefile)
-	@if test -f win32/Makefile -a "${GMAKE}" != "none"; then \
-	   (cd win32; $(GMAKE) distclean); \
-	fi
 
 devclean: realclean
 	if test $(srcdir) = .; then $(MAKE) realclean; fi
 	(cd $(srcdir); $(RMF) Makefile)
-	@if test -f win32/Makefile -a "${GMAKE}" != "none"; then \
-	   (cd win32; $(GMAKE) devclean); \
-	fi
 
 install: all
-	$(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) bacula-fd $(DESTDIR)$(sbindir)/bacula-fd 
+	$(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) bacula-fd $(DESTDIR)$(sbindir)/bacula-fd
 	@srcconf=bacula-fd.conf; \
 	if  test -f ${DESTDIR}${sysconfdir}/$$srcconf; then \
 	   destconf=$$srcconf.new; \
@@ -148,7 +116,6 @@ install: all
 	fi
 
 uninstall:
-	(cd $(DESTDIR)$(sbindir); $(RMF) bacula-fd)
 	(cd $(DESTDIR)$(sysconfdir); $(RMF) bacula-fd.conf)
 	(cd $(DESTDIR)$(sysconfdir); $(RMF) bacula-fd.conf.new)
 
diff --git a/src/filed/accurate.c b/src/filed/accurate.c
index 4bf7974..62d572b 100644
--- a/src/filed/accurate.c
+++ b/src/filed/accurate.c
@@ -1,25 +1,26 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2000-2015 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
-/*
- *  Version $Id $
- *
- */
 
 #include "bacula.h"
 #include "filed.h"
+#include "backup.h"
 
 static int dbglvl=100;
 
@@ -86,8 +87,11 @@ static bool accurate_send_base_file_list(JCR *jcr)
    CurFile *elt;
    struct stat statc;
    int32_t LinkFIc;
-   FF_PKT *ff_pkt;
-   int stream = STREAM_UNIX_ATTRIBUTES;
+   bctx_t bctx;
+
+   memset(&bctx, 0, sizeof(bctx));
+   bctx.jcr = jcr;
+   bctx.data_stream = STREAM_UNIX_ATTRIBUTES;
 
    if (!jcr->accurate || jcr->getJobLevel() != L_FULL) {
       return true;
@@ -97,22 +101,22 @@ static bool accurate_send_base_file_list(JCR *jcr)
       return true;
    }
 
-   ff_pkt = init_find_files();
-   ff_pkt->type = FT_BASE;
+   bctx.ff_pkt = init_find_files();
+   bctx.ff_pkt->type = FT_BASE;
 
    foreach_htable(elt, jcr->file_list) {
       if (elt->seen) {
          Dmsg2(dbglvl, "base file fname=%s seen=%i\n", elt->fname, elt->seen);
          /* TODO: skip the decode and use directly the lstat field */
          decode_stat(elt->lstat, &statc, sizeof(statc), &LinkFIc); /* decode catalog stat */
-         ff_pkt->fname = elt->fname;
-         ff_pkt->statp = statc;
-         encode_and_send_attributes(jcr, ff_pkt, stream);
+         bctx.ff_pkt->fname = elt->fname;
+         bctx.ff_pkt->statp = statc;
+         encode_and_send_attributes(bctx);
 //       free(elt->fname);
       }
    }
 
-   term_find_files(ff_pkt);
+   term_find_files(bctx.ff_pkt);
    return true;
 }
 
@@ -126,8 +130,11 @@ static bool accurate_send_deleted_list(JCR *jcr)
    CurFile *elt;
    struct stat statc;
    int32_t LinkFIc;
-   FF_PKT *ff_pkt;
-   int stream = STREAM_UNIX_ATTRIBUTES;
+   bctx_t bctx;
+
+   memset(&bctx, 0, sizeof(bctx));
+   bctx.jcr = jcr;
+   bctx.data_stream = STREAM_UNIX_ATTRIBUTES;
 
    if (!jcr->accurate) {
       return true;
@@ -137,8 +144,8 @@ static bool accurate_send_deleted_list(JCR *jcr)
       return true;
    }
 
-   ff_pkt = init_find_files();
-   ff_pkt->type = FT_DELETED;
+   bctx.ff_pkt = init_find_files();
+   bctx.ff_pkt->type = FT_DELETED;
 
    foreach_htable(elt, jcr->file_list) {
       if (elt->seen || plugin_check_file(jcr, elt->fname)) {
@@ -147,14 +154,14 @@ static bool accurate_send_deleted_list(JCR *jcr)
       Dmsg2(dbglvl, "deleted fname=%s seen=%i\n", elt->fname, elt->seen);
       /* TODO: skip the decode and use directly the lstat field */
       decode_stat(elt->lstat, &statc, sizeof(statc), &LinkFIc); /* decode catalog stat */
-      ff_pkt->fname = elt->fname;
-      ff_pkt->statp.st_mtime = statc.st_mtime;
-      ff_pkt->statp.st_ctime = statc.st_ctime;
-      encode_and_send_attributes(jcr, ff_pkt, stream);
+      bctx.ff_pkt->fname = elt->fname;
+      bctx.ff_pkt->statp.st_mtime = statc.st_mtime;
+      bctx.ff_pkt->statp.st_ctime = statc.st_ctime;
+      encode_and_send_attributes(bctx);
 //    free(elt->fname);
    }
 
-   term_find_files(ff_pkt);
+   term_find_files(bctx.ff_pkt);
    return true;
 }
 
@@ -172,7 +179,7 @@ bool accurate_finish(JCR *jcr)
 {
    bool ret = true;
 
-   if (jcr->is_canceled()) {
+   if (jcr->is_canceled() || jcr->is_incomplete()) {
       accurate_free(jcr);
       return ret;
    }
@@ -268,9 +275,11 @@ bool accurate_check_file(JCR *jcr, FF_PKT *ff_pkt)
    if (!accurate_lookup(jcr, fname, &elt)) {
       Dmsg1(dbglvl, "accurate %s (not found)\n", fname);
       stat = true;
+      unstrip_path(ff_pkt);
       goto bail_out;
    }
 
+   unstrip_path(ff_pkt);     /* Get full path back */
    ff_pkt->accurate_found = true;
    ff_pkt->delta_seq = elt.delta_seq;
 
@@ -354,6 +363,16 @@ bool accurate_check_file(JCR *jcr, FF_PKT *ff_pkt)
             stat = true;
          }
          break;
+      case 'M':                 /* Look mtime/ctime like normal incremental backup */
+         if (ff_pkt->incremental &&
+             (ff_pkt->statp.st_mtime > ff_pkt->save_time &&
+              ((ff_pkt->flags & FO_MTIMEONLY) ||
+               ff_pkt->statp.st_ctime > ff_pkt->save_time)))
+         {
+            Dmsg1(dbglvl-1, "%s      mtime/ctime more recent than save_time\n", fname);
+            stat = true;
+         }
+         break;
       case 'c':                /* ctime */
          if (statc.st_ctime != ff_pkt->statp.st_ctime) {
             Dmsg1(dbglvl-1, "%s      st_ctime differs\n", fname);
@@ -475,7 +494,6 @@ bool accurate_check_file(JCR *jcr, FF_PKT *ff_pkt)
    }
 
 bail_out:
-   unstrip_path(ff_pkt);
    return stat;
 }
 
diff --git a/src/filed/acl.c b/src/filed/acl.c
index 60c5531..8a63b6b 100644
--- a/src/filed/acl.c
+++ b/src/filed/acl.c
@@ -1,19 +1,23 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2004-2014 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2004-2015 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
-/**
+/*
  * Functions to handle ACLs for bacula.
  *
  * Currently we support the following OSes:
@@ -46,47 +50,48 @@
  * certain platforms and if they use they same encoding we might allow
  * different platform streams to be decoded on an other similar platform.
  *
- *   Original written by Preben 'Peppe' Guldberg, December 2004
- *   Major rewrite by Marco van Wieringen, November 2008
- *   Major overhaul by Marco van Wieringen, January 2012
+ * Original written by Preben 'Peppe' Guldberg, December 2004
+ *
  */
 
 #include "bacula.h"
 #include "filed.h"
 
 #if !defined(HAVE_ACL) && !defined(HAVE_AFS_ACL)
-/**
+/*
  * Entry points when compiled without support for ACLs or on an unsupported platform.
  */
-bacl_exit_code build_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
+bool backup_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
 {
-   return bacl_exit_fatal;
+   Jmsg(jcr, M_FATAL, 0, "ACL backup requested but not configured in Bacula.\n");
+   return false;
 }
 
-bacl_exit_code parse_acl_streams(JCR *jcr,
+bacl_rtn_code restore_acl_streams(JCR *jcr,
                                  int stream,
                                  char *content,
                                  uint32_t content_length)
 {
-   return bacl_exit_fatal;
+   Jmsg(jcr, M_FATAL, 0, "ACL backup requested but not configured in Bacula.\n");
+   return bacl_rtn_fatal;
 }
 #else
-/**
+/*
  * Send an ACL stream to the SD.
  */
-static bacl_exit_code send_acl_stream(JCR *jcr, int stream)
+static bacl_rtn_code send_acl_stream(JCR *jcr, int stream)
 {
    BSOCK *sd = jcr->store_bsock;
    POOLMEM *msgsave;
 #ifdef FD_NO_SEND_TEST
-   return bacl_exit_ok;
+   return bacl_rtn_ok;
 #endif
 
    /*
     * Sanity check
     */
-   if (jcr->acl_data->u.build->content_length <= 0) {
-      return bacl_exit_ok;
+   if (jcr->acl_ctx->content_length <= 0) {
+      return bacl_rtn_ok;
    }
 
    /*
@@ -95,22 +100,22 @@ static bacl_exit_code send_acl_stream(JCR *jcr, int stream)
    if (!sd->fsend("%ld %d 0", jcr->JobFiles, stream)) {
       Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"),
             sd->bstrerror());
-      return bacl_exit_fatal;
+      return bacl_rtn_fatal;
    }
 
    /*
     * Send the buffer to the storage deamon
     */
-   Dmsg1(400, "Backing up ACL <%s>\n", jcr->acl_data->u.build->content);
+   Dmsg1(400, "Backing up ACL <%s>\n", jcr->acl_ctx->content);
    msgsave = sd->msg;
-   sd->msg = jcr->acl_data->u.build->content;
-   sd->msglen = jcr->acl_data->u.build->content_length + 1;
+   sd->msg = jcr->acl_ctx->content;
+   sd->msglen = jcr->acl_ctx->content_length + 1;
    if (!sd->send()) {
       sd->msg = msgsave;
       sd->msglen = 0;
       Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"),
             sd->bstrerror());
-      return bacl_exit_fatal;
+      return bacl_rtn_fatal;
    }
 
    jcr->JobBytes += sd->msglen;
@@ -118,11 +123,11 @@ static bacl_exit_code send_acl_stream(JCR *jcr, int stream)
    if (!sd->signal(BNET_EOD)) {
       Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"),
             sd->bstrerror());
-      return bacl_exit_fatal;
+      return bacl_rtn_fatal;
    }
 
    Dmsg1(200, "ACL of file: %s successfully backed up!\n", jcr->last_fname);
-   return bacl_exit_ok;
+   return bacl_rtn_ok;
 }
 
 /*
@@ -143,9 +148,6 @@ static bool acl_is_trivial(struct acl *acl)
 
 static bool acl_nfs4_is_trivial(nfs4_acl_int_t *acl)
 {
-#if 0
-   return (acl->aclEntryN > 0 ? false : true);
-#else
    int i;
    int count = acl->aclEntryN;
    nfs4_ace_int_t *ace;
@@ -167,7 +169,6 @@ static bool acl_nfs4_is_trivial(nfs4_acl_int_t *acl)
       }
    }
    return true;
-#endif
 }
 
 /*
@@ -182,12 +183,12 @@ static int os_default_acl_streams[1] = {
    -1
 };
 
-static bacl_exit_code aix_build_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
+static bacl_rtn_code aix_backup_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
 {
    mode_t mode;
    acl_type_t type;
    size_t aclsize, acltxtsize;
-   bacl_exit_code retval = bacl_exit_error;
+   bacl_rtn_code retval = bacl_rtn_error;
    POOLMEM *aclbuf = get_pool_memory(PM_MESSAGE);
 
    /*
@@ -197,29 +198,23 @@ static bacl_exit_code aix_build_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
    type.u64 = ACL_ANY;
    if (aclx_get(jcr->last_fname, GET_ACLINFO_ONLY, &type, NULL, &aclsize, &mode) < 0) {
       berrno be;
-
-      switch (errno) {
-      case ENOENT:
-         retval = bacl_exit_ok;
-         goto bail_out;
-      case ENOSYS:
+      if (errno == ENOENT) {
+         retval = bacl_rtn_ok;
+      } else if (errno == ENOSYS) {
          /*
           * If the filesystem reports it doesn't support ACLs we clear the
           * BACL_FLAG_SAVE_NATIVE flag so we skip ACL saves on all other files
           * on the same filesystem. The BACL_FLAG_SAVE_NATIVE flag gets set again
           * when we change from one filesystem to an other.
           */
-         jcr->acl_data->flags &= ~BACL_FLAG_SAVE_NATIVE;
-         retval = bacl_exit_ok;
-         goto bail_out;
-      default:
-         Mmsg2(jcr->errmsg,
-               _("aclx_get error on file \"%s\": ERR=%s\n"),
-               jcr->last_fname, be.bstrerror());
-         Dmsg2(100, "aclx_get error file=%s ERR=%s\n",
+         jcr->acl_ctx->flags &= ~BACL_FLAG_SAVE_NATIVE;
+         retval = bacl_rtn_ok;
+      } else {
+         Mmsg2(jcr->errmsg, _("aclx_get error on file \"%s\": ERR=%s\n"),
                jcr->last_fname, be.bstrerror());
-         goto bail_out;
+         Dmsg1(100, "%s", jcr->errmsg);
       }
+      goto get_out;
    }
 
    /*
@@ -232,19 +227,14 @@ static bacl_exit_code aix_build_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
     */
    if (aclx_get(jcr->last_fname, 0, &type, aclbuf, &aclsize, &mode) < 0) {
       berrno be;
-
-      switch (errno) {
-      case ENOENT:
-         retval = bacl_exit_ok;
-         goto bail_out;
-      default:
-         Mmsg2(jcr->errmsg,
-               _("aclx_get error on file \"%s\": ERR=%s\n"),
-               jcr->last_fname, be.bstrerror());
-         Dmsg2(100, "aclx_get error file=%s ERR=%s\n",
+      if (errno == ENOENT) {
+         retval = bacl_rtn_ok;
+      } else {
+         Mmsg2(jcr->errmsg, _("aclx_get error on file \"%s\": ERR=%s\n"),
                jcr->last_fname, be.bstrerror());
-         goto bail_out;
+         Dmsg1(100, "%s", jcr->errmsg);
       }
+      goto get_out;
    }
 
    /*
@@ -253,60 +243,51 @@ static bacl_exit_code aix_build_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
    switch (type.u64) {
    case ACL_AIXC:
       if (acl_is_trivial((struct acl *)aclbuf)) {
-         retval = bacl_exit_ok;
-         goto bail_out;
+         retval = bacl_rtn_ok;
+         goto get_out;
       }
       break;
    case ACL_NFS4:
       if (acl_nfs4_is_trivial((nfs4_acl_int_t *)aclbuf)) {
-         retval = bacl_exit_ok;
-         goto bail_out;
+         retval = bacl_rtn_ok;
+         goto get_out;
       }
       break;
    default:
-      Mmsg2(jcr->errmsg,
-            _("Unknown acl type encountered on file \"%s\": %ld\n"),
-            jcr->last_fname, type.u64);
-      Dmsg2(100, "Unknown acl type encountered on file \"%s\": %ld\n",
+      Mmsg2(jcr->errmsg,  _("Unknown acl type encountered on file \"%s\": %ld\n"),
             jcr->last_fname, type.u64);
-      goto bail_out;
+      Dmsg1(100, "%s", jcr->errmsg);
+      goto get_out;
    }
 
    /*
     * We have a non-trivial acl lets convert it into some ASCII form.
     */
-   acltxtsize = sizeof_pool_memory(jcr->acl_data->u.build->content);
-   if (aclx_printStr(jcr->acl_data->u.build->content, &acltxtsize, aclbuf,
+   acltxtsize = sizeof_pool_memory(jcr->acl_ctx->content);
+   if (aclx_printStr(jcr->acl_ctx->content, &acltxtsize, aclbuf,
                      aclsize, type, jcr->last_fname, 0) < 0) {
-      switch (errno) {
-      case ENOSPC:
+      if ((errno == ENOSPC) {
          /*
           * Our buffer is not big enough, acltxtsize should be updated with the value
           * the aclx_printStr really need. So we increase the buffer and try again.
           */
-         jcr->acl_data->u.build->content =
-         check_pool_memory_size(jcr->acl_data->u.build->content, acltxtsize + 1);
-         if (aclx_printStr(jcr->acl_data->u.build->content, &acltxtsize, aclbuf,
+         jcr->acl_ctx->content = check_pool_memory_size(jcr->acl_ctx->content, acltxtsize + 1);
+         if (aclx_printStr(jcr->acl_ctx->content, &acltxtsize, aclbuf,
                            aclsize, type, jcr->last_fname, 0) < 0) {
-            Mmsg1(jcr->errmsg,
-                  _("Failed to convert acl into text on file \"%s\"\n"),
+            Mmsg1(jcr->errmsg, _("Failed to convert acl into text on file \"%s\"\n"),
                   jcr->last_fname);
-            Dmsg2(100, "Failed to convert acl into text on file \"%s\": %ld\n",
-                  jcr->last_fname, type.u64);
-            goto bail_out;
+            Dmsg1(100, "%s", jcr->errmsg);
+            goto get_out;
          }
-         break;
-      default:
-         Mmsg1(jcr->errmsg,
-               _("Failed to convert acl into text on file \"%s\"\n"),
+      } else {
+         Mmsg1(jcr->errmsg, _("Failed to convert acl into text on file \"%s\"\n"),
                jcr->last_fname);
-         Dmsg2(100, "Failed to convert acl into text on file \"%s\": %ld\n",
-               jcr->last_fname, type.u64);
-         goto bail_out;
+         Dmsg1(100, "%s", jcr->errmsg);
+         goto get_out;
       }
    }
 
-   jcr->acl_data->u.build->content_length = strlen(jcr->acl_data->u.build->content) + 1;
+   jcr->acl_ctx->content_length = strlen(jcr->acl_ctx->content) + 1;
    switch (type.u64) {
    case ACL_AIXC:
       retval = send_acl_stream(jcr, STREAM_ACL_AIX_AIXC);
@@ -316,7 +297,7 @@ static bacl_exit_code aix_build_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
       break;
    }
 
-bail_out:
+get_out:
    free_pool_memory(aclbuf);
 
    return retval;
@@ -348,7 +329,7 @@ static inline bool aix_query_acl_support(JCR *jcr,
    return false;
 }
 
-static bacl_exit_code aix_parse_acl_streams(JCR *jcr,
+static bacl_rtn_code aix_restore_acl_streams(JCR *jcr,
                                             int stream,
                                             char *content,
                                             uint32_t content_length)
@@ -356,7 +337,7 @@ static bacl_exit_code aix_parse_acl_streams(JCR *jcr,
    int cnt;
    acl_type_t type;
    size_t aclsize;
-   bacl_exit_code retval = bacl_exit_error;
+   bacl_rtn_code retval = bacl_rtn_error;
    POOLMEM *aclbuf = get_pool_memory(PM_MESSAGE);
 
    switch (stream) {
@@ -365,17 +346,17 @@ static bacl_exit_code aix_parse_acl_streams(JCR *jcr,
        * Handle the old stream using the old system call for now.
        */
       if (acl_put(jcr->last_fname, content, 0) != 0) {
-         retval = bacl_exit_error;
-         goto bail_out;
+         retval = bacl_rtn_error;
+         goto get_out;
       }
-      retval = bacl_exit_ok;
-      goto bail_out;
+      retval = bacl_rtn_ok;
+      goto get_out;
    case STREAM_ACL_AIX_AIXC:
       if (!aix_query_acl_support(jcr, ACL_AIXC, &type)) {
          Mmsg1(jcr->errmsg,
                _("Trying to restore POSIX acl on file \"%s\" on filesystem without AIXC acl support\n"),
                jcr->last_fname);
-         goto bail_out;
+         goto get_out;
       }
       break;
    case STREAM_ACL_AIX_NFS4:
@@ -383,12 +364,12 @@ static bacl_exit_code aix_parse_acl_streams(JCR *jcr,
          Mmsg1(jcr->errmsg,
                _("Trying to restore NFSv4 acl on file \"%s\" on filesystem without NFS4 acl support\n"),
                jcr->last_fname);
-         goto bail_out;
+         goto get_out;
       }
       break;
    default:
-      goto bail_out;
-   } /* end switch (stream) */
+      goto get_out;
+   }
 
    /*
     * Set the acl buffer to an initial size. For now we set it
@@ -398,9 +379,7 @@ static bacl_exit_code aix_parse_acl_streams(JCR *jcr,
    aclsize = content_length;
    if (aclx_scanStr(content, aclbuf, &aclsize, type) < 0) {
       berrno be;
-
-      switch (errno) {
-      case ENOSPC:
+      if (errno == ENOSPC) {
          /*
           * The buffer isn't big enough. The man page doesn't say that aclsize
           * is updated to the needed size as what is done with aclx_printStr.
@@ -419,65 +398,46 @@ static bacl_exit_code aix_parse_acl_streams(JCR *jcr,
              * See why we failed this time, ENOSPC retry if max retries not met,
              * otherwise abort.
              */
-            switch (errno) {
-            case ENOSPC:
-               if (cnt < 3) {
-                  continue;
-               }
-               /*
-                * FALLTHROUGH
-                */
-            default:
-               Mmsg2(jcr->errmsg,
-                     _("aclx_scanStr error on file \"%s\": ERR=%s\n"),
-                     jcr->last_fname, be.bstrerror(errno));
-               Dmsg2(100, "aclx_scanStr error file=%s ERR=%s\n",
-                     jcr->last_fname, be.bstrerror());
-               goto bail_out;
+            if (errno == ENOSPC && cnt < 3) {
+               continue;
             }
+            Mmsg2(jcr->errmsg, _("aclx_scanStr error on file \"%s\": ERR=%s\n"),
+                  jcr->last_fname, be.bstrerror(errno));
+            Dmsg1(100, "%s", jcr->errmsg);
+            goto get_out;
          }
-         break;
-      default:
-         Mmsg2(jcr->errmsg,
-               _("aclx_scanStr error on file \"%s\": ERR=%s\n"),
-               jcr->last_fname, be.bstrerror());
-         Dmsg2(100, "aclx_scanStr error file=%s ERR=%s\n",
+      } else {
+         Mmsg2(jcr->errmsg, _("aclx_scanStr error on file \"%s\": ERR=%s\n"),
                jcr->last_fname, be.bstrerror());
+         Dmsg1(100, "%s", jcr->errmsg);
+         goto get_out
       }
    }
 
    if (aclx_put(jcr->last_fname, SET_ACL, type, aclbuf, aclsize, 0) < 0) {
       berrno be;
-
-      switch (errno) {
-      case ENOENT:
-         retval = bacl_exit_ok;
-         goto bail_out;
-      case ENOSYS:
+      if (errno == ENOENT) {
+         retval = bacl_rtn_ok;
+      } else if (ENOSYS) {
          /*
           * If the filesystem reports it doesn't support ACLs we clear the
           * BACL_FLAG_RESTORE_NATIVE flag so we skip ACL restores on all other files
           * on the same filesystem. The BACL_FLAG_RESTORE_NATIVE flag gets set again
           * when we change from one filesystem to an other.
           */
-         jcr->acl_data->flags &= ~BACL_FLAG_RESTORE_NATIVE;
-         retval = bacl_exit_ok;
-         goto bail_out;
-      default:
-         Mmsg2(jcr->errmsg,
-               _("aclx_put error on file \"%s\": ERR=%s\n"),
-               jcr->last_fname, be.bstrerror());
-         Dmsg2(100, "aclx_put error file=%s ERR=%s\n",
+         jcr->acl_ctx->flags &= ~BACL_FLAG_RESTORE_NATIVE;
+      } else {
+         Mmsg2(jcr->errmsg, _("aclx_put error on file \"%s\": ERR=%s\n"),
                jcr->last_fname, be.bstrerror());
-         goto bail_out;
+         Dmsg1(100, "%s", jcr->errmsg);
+         goto get_out;
       }
    }
 
-   retval = bacl_exit_ok;
+   retval = bacl_rtn_ok;
 
-bail_out:
+get_out:
    free_pool_memory(aclbuf);
-
    return retval;
 }
 
@@ -495,40 +455,40 @@ static int os_default_acl_streams[1] = {
    -1
 };
 
-static bacl_exit_code aix_build_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
+static bacl_rtn_code aix_backup_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
 {
    char *acl_text;
 
    if ((acl_text = acl_get(jcr->last_fname)) != NULL) {
-      jcr->acl_data->u.build->content_length =
-      pm_strcpy(jcr->acl_data->u.build->content, acl_text);
+      jcr->acl_ctx->content_length =
+         pm_strcpy(jcr->acl_ctx->content, acl_text);
       actuallyfree(acl_text);
       return send_acl_stream(jcr, STREAM_ACL_AIX_TEXT);
    }
-   return bacl_exit_error;
+   return bacl_rtn_error;
 }
 
-static bacl_exit_code aix_parse_acl_streams(JCR *jcr,
+static bacl_rtn_code aix_restore_acl_streams(JCR *jcr,
                                             int stream,
                                             char *content,
                                             uint32_t content_length)
 {
    if (acl_put(jcr->last_fname, content, 0) != 0) {
-      return bacl_exit_error;
+      return bacl_rtn_error;
    }
-   return bacl_exit_ok;
+   return bacl_rtn_ok;
 }
 #endif /* HAVE_EXTENDED_ACL */
 
 /*
  * For this OS setup the build and parse function pointer to the OS specific functions.
  */
-static bacl_exit_code (*os_build_acl_streams)
+static bacl_rtn_code (*os_backup_acl_streams)
                       (JCR *jcr, FF_PKT *ff_pkt) =
-                      aix_build_acl_streams;
-static bacl_exit_code (*os_parse_acl_streams)
+                      aix_backup_acl_streams;
+static bacl_rtn_code (*os_restore_acl_streams)
                       (JCR *jcr, int stream, char *content, uint32_t content_length) =
-                      aix_parse_acl_streams;
+                      aix_restore_acl_streams;
 
 #elif defined(HAVE_DARWIN_OS) || \
       defined(HAVE_FREEBSD_OS) || \
@@ -744,20 +704,20 @@ static bool acl_is_trivial(acl_t acl)
 }
 #endif
 
-/**
+/*
  * Generic wrapper around acl_get_file call.
  */
-static bacl_exit_code generic_get_acl_from_os(JCR *jcr, bacl_type acltype)
+static bacl_rtn_code generic_get_acl_from_os(JCR *jcr, bacl_type acltype)
 {
    acl_t acl;
    acl_type_t ostype;
    char *acl_text;
-   bacl_exit_code retval = bacl_exit_ok;
+   bacl_rtn_code retval = bacl_rtn_ok;
 
    ostype = bac_to_os_acltype(acltype);
    acl = acl_get_file(jcr->last_fname, ostype);
    if (acl) {
-      /**
+      /*
        * From observation, IRIX's acl_get_file() seems to return a
        * non-NULL acl with a count field of -1 when a file has no ACL
        * defined, while IRIX's acl_to_text() returns NULL when presented
@@ -767,31 +727,29 @@ static bacl_exit_code generic_get_acl_from_os(JCR *jcr, bacl_type acltype)
        * zero entries in the acl returned.
        */
       if (acl_count_entries(acl) <= 0) {
-         goto bail_out;
+         goto get_out;
       }
 
       /*
        * Make sure this is not just a trivial ACL.
        */
-#if !defined(HAVE_DARWIN_OS)
+#ifndef HAVE_DARWIN_OS
       if (acltype == BACL_TYPE_ACCESS && acl_is_trivial(acl)) {
          /*
           * The ACLs simply reflect the (already known) standard permissions
           * So we don't send an ACL stream to the SD.
           */
-         goto bail_out;
+         goto get_out;
       }
 #endif
+
 #if defined(HAVE_FREEBSD_OS) && defined(_PC_ACL_NFS4)
       if (acltype == BACL_TYPE_NFS4) {
          int trivial;
          if (acl_is_trivial_np(acl, &trivial) == 0) {
+            /* Trivial ACLS are standard permissions. Do not send to SD. */
             if (trivial == 1) {
-               /*
-                * The ACLs simply reflect the (already known) standard permissions
-                * So we don't send an ACL stream to the SD.
-                */
-               goto bail_out;
+               goto get_out;
             }
          }
       }
@@ -801,22 +759,19 @@ static bacl_exit_code generic_get_acl_from_os(JCR *jcr, bacl_type acltype)
        * Convert the internal acl representation into a text representation.
        */
       if ((acl_text = acl_to_text(acl, NULL)) != NULL) {
-         jcr->acl_data->u.build->content_length =
-         pm_strcpy(jcr->acl_data->u.build->content, acl_text);
+         jcr->acl_ctx->content_length =
+            pm_strcpy(jcr->acl_ctx->content, acl_text);
          acl_free(acl);
          acl_free(acl_text);
-         return bacl_exit_ok;
+         return bacl_rtn_ok;
       }
 
       berrno be;
       Mmsg2(jcr->errmsg,
             _("acl_to_text error on file \"%s\": ERR=%s\n"),
             jcr->last_fname, be.bstrerror());
-      Dmsg2(100, "acl_to_text error file=%s ERR=%s\n",
-            jcr->last_fname, be.bstrerror());
-
-      retval = bacl_exit_error;
-      goto bail_out;
+      Dmsg1(100, "%s", jcr->errmsg);
+      retval = bacl_rtn_error;
    } else {
       berrno be;
 
@@ -824,7 +779,6 @@ static bacl_exit_code generic_get_acl_from_os(JCR *jcr, bacl_type acltype)
        * Handle errors gracefully.
        */
       switch (errno) {
-#if defined(BACL_ENOTSUP)
       case BACL_ENOTSUP:
          /*
           * If the filesystem reports it doesn't support ACLs we clear the
@@ -832,37 +786,33 @@ static bacl_exit_code generic_get_acl_from_os(JCR *jcr, bacl_type acltype)
           * on the same filesystem. The BACL_FLAG_SAVE_NATIVE flag gets set again
           * when we change from one filesystem to an other.
           */
-         jcr->acl_data->flags &= ~BACL_FLAG_SAVE_NATIVE;
-         goto bail_out;
-#endif
+         jcr->acl_ctx->flags &= ~BACL_FLAG_SAVE_NATIVE;
+         break;
       case ENOENT:
-         goto bail_out;
+         break;
       default:
          /* Some real error */
-         Mmsg2(jcr->errmsg,
-               _("acl_get_file error on file \"%s\": ERR=%s\n"),
-               jcr->last_fname, be.bstrerror());
-         Dmsg2(100, "acl_get_file error file=%s ERR=%s\n",
-               jcr->last_fname, be.bstrerror());
-
-         retval = bacl_exit_error;
-         goto bail_out;
+         Mmsg2(jcr->errmsg, _("acl_get_file error on file \"%s\": ERR=%s\n"),
+            jcr->last_fname, be.bstrerror());
+         Dmsg1(100, "%s", jcr->errmsg);
+         retval = bacl_rtn_error;
+         break;
       }
    }
 
-bail_out:
+get_out:
    if (acl) {
       acl_free(acl);
    }
-   pm_strcpy(jcr->acl_data->u.build->content, "");
-   jcr->acl_data->u.build->content_length = 0;
+   pm_strcpy(jcr->acl_ctx->content, "");
+   jcr->acl_ctx->content_length = 0;
    return retval;
 }
 
-/**
+/*
  * Generic wrapper around acl_set_file call.
  */
-static bacl_exit_code generic_set_acl_on_os(JCR *jcr,
+static bacl_rtn_code generic_set_acl_on_os(JCR *jcr,
                                             bacl_type acltype,
                                             char *content,
                                             uint32_t content_length)
@@ -876,14 +826,13 @@ static bacl_exit_code generic_set_acl_on_os(JCR *jcr,
    ostype = bac_to_os_acltype(acltype);
    if (ostype == ACL_TYPE_DEFAULT && strlen(content) == 0) {
       if (acl_delete_def_file(jcr->last_fname) == 0) {
-         return bacl_exit_ok;
+         return bacl_rtn_ok;
       }
       berrno be;
 
       switch (errno) {
       case ENOENT:
-         return bacl_exit_ok;
-#if defined(BACL_ENOTSUP)
+         return bacl_rtn_ok;
       case BACL_ENOTSUP:
          /*
           * If the filesystem reports it doesn't support ACLs we clear the
@@ -891,17 +840,16 @@ static bacl_exit_code generic_set_acl_on_os(JCR *jcr,
           * on the same filesystem. The BACL_FLAG_RESTORE_NATIVE flag gets set again
           * when we change from one filesystem to an other.
           */
-         jcr->acl_data->flags &= ~BACL_FLAG_RESTORE_NATIVE;
+         jcr->acl_ctx->flags &= ~BACL_FLAG_RESTORE_NATIVE;
          Mmsg1(jcr->errmsg,
                _("acl_delete_def_file error on file \"%s\": filesystem doesn't support ACLs\n"),
                jcr->last_fname);
-         return bacl_exit_error;
-#endif
+         return bacl_rtn_error;
       default:
          Mmsg2(jcr->errmsg,
                _("acl_delete_def_file error on file \"%s\": ERR=%s\n"),
                jcr->last_fname, be.bstrerror());
-         return bacl_exit_error;
+         return bacl_rtn_error;
       }
    }
 
@@ -912,13 +860,12 @@ static bacl_exit_code generic_set_acl_on_os(JCR *jcr,
       Mmsg2(jcr->errmsg,
             _("acl_from_text error on file \"%s\": ERR=%s\n"),
             jcr->last_fname, be.bstrerror());
-      Dmsg3(100, "acl_from_text error acl=%s file=%s ERR=%s\n",
-            content, jcr->last_fname, be.bstrerror());
-      return bacl_exit_error;
+      Dmsg1(100, "%s", jcr->errmsg);
+      return bacl_rtn_error;
    }
 
 #ifndef HAVE_FREEBSD_OS
-   /**
+   /*
     * FreeBSD always fails acl_valid() - at least on valid input...
     * As it does the right thing, given valid input, just ignore acl_valid().
     */
@@ -928,14 +875,13 @@ static bacl_exit_code generic_set_acl_on_os(JCR *jcr,
       Mmsg2(jcr->errmsg,
             _("acl_valid error on file \"%s\": ERR=%s\n"),
             jcr->last_fname, be.bstrerror());
-      Dmsg3(100, "acl_valid error acl=%s file=%s ERR=%s\n",
-            content, jcr->last_fname, be.bstrerror());
+      Dmsg1(100, "%s", jcr->errmsg);
       acl_free(acl);
-      return bacl_exit_error;
+      return bacl_rtn_error;
    }
 #endif
 
-   /**
+   /*
     * Restore the ACLs, but don't complain about links which really should
     * not have attributes, and the file it is linked to may not yet be restored.
     * This is only true for the old acl streams as in the new implementation we
@@ -943,12 +889,10 @@ static bacl_exit_code generic_set_acl_on_os(JCR *jcr,
     */
    if (acl_set_file(jcr->last_fname, ostype, acl) != 0 && jcr->last_type != FT_LNK) {
       berrno be;
-
       switch (errno) {
       case ENOENT:
          acl_free(acl);
-         return bacl_exit_ok;
-#if defined(BACL_ENOTSUP)
+         return bacl_rtn_ok;
       case BACL_ENOTSUP:
          /*
           * If the filesystem reports it doesn't support ACLs we clear the
@@ -956,34 +900,30 @@ static bacl_exit_code generic_set_acl_on_os(JCR *jcr,
           * on the same filesystem. The BACL_FLAG_RESTORE_NATIVE flag gets set again
           * when we change from one filesystem to an other.
           */
-         jcr->acl_data->flags &= ~BACL_FLAG_RESTORE_NATIVE;
+         jcr->acl_ctx->flags &= ~BACL_FLAG_RESTORE_NATIVE;
          Mmsg1(jcr->errmsg,
                _("acl_set_file error on file \"%s\": filesystem doesn't support ACLs\n"),
                jcr->last_fname);
-         Dmsg2(100, "acl_set_file error acl=%s file=%s filesystem doesn't support ACLs\n",
-               content, jcr->last_fname);
+         Dmsg1(100, "%s", jcr->errmsg);
          acl_free(acl);
-         return bacl_exit_error;
-#endif
+         return bacl_rtn_error;
       default:
-         Mmsg2(jcr->errmsg,
-               _("acl_set_file error on file \"%s\": ERR=%s\n"),
+         Mmsg2(jcr->errmsg, _("acl_set_file error on file \"%s\": ERR=%s\n"),
                jcr->last_fname, be.bstrerror());
-         Dmsg3(100, "acl_set_file error acl=%s file=%s ERR=%s\n",
-               content, jcr->last_fname, be.bstrerror());
+         Dmsg1(100, "%s", jcr->errmsg);
          acl_free(acl);
-         return bacl_exit_error;
+         return bacl_rtn_error;
       }
    }
    acl_free(acl);
-   return bacl_exit_ok;
+   return bacl_rtn_ok;
 }
 
-/**
+/*
  * OS specific functions for handling different types of acl streams.
  */
 #if defined(HAVE_DARWIN_OS)
-/**
+/*
  * Define the supported ACL streams for this OS
  */
 static int os_access_acl_streams[1] = {
@@ -993,10 +933,10 @@ static int os_default_acl_streams[1] = {
    -1
 };
 
-static bacl_exit_code darwin_build_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
+static bacl_rtn_code darwin_backup_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
 {
 #if defined(HAVE_ACL_TYPE_EXTENDED)
-   /**
+   /*
     * On MacOS X, acl_get_file (name, ACL_TYPE_ACCESS)
     * and acl_get_file (name, ACL_TYPE_DEFAULT)
     * always return NULL / EINVAL.  There is no point in making
@@ -1005,23 +945,23 @@ static bacl_exit_code darwin_build_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
     *
     * Read access ACLs for files, dirs and links
     */
-   if (generic_get_acl_from_os(jcr, BACL_TYPE_EXTENDED) == bacl_exit_fatal)
-      return bacl_exit_fatal;
+   if (generic_get_acl_from_os(jcr, BACL_TYPE_EXTENDED) == bacl_rtn_fatal)
+      return bacl_rtn_fatal;
 #else
-   /**
+   /*
     * Read access ACLs for files, dirs and links
     */
-   if (generic_get_acl_from_os(jcr, BACL_TYPE_ACCESS) == bacl_exit_fatal)
-      return bacl_exit_fatal;
+   if (generic_get_acl_from_os(jcr, BACL_TYPE_ACCESS) == bacl_rtn_fatal)
+      return bacl_rtn_fatal;
 #endif
 
-   if (jcr->acl_data->u.build->content_length > 0) {
+   if (jcr->acl_ctx->content_length > 0) {
       return send_acl_stream(jcr, STREAM_ACL_DARWIN_ACCESS_ACL);
    }
-   return bacl_exit_ok;
+   return bacl_rtn_ok;
 }
 
-static bacl_exit_code darwin_parse_acl_streams(JCR *jcr,
+static bacl_rtn_code darwin_restore_acl_streams(JCR *jcr,
                                                int stream,
                                                char *content,
                                                uint32_t content_length)
@@ -1036,12 +976,12 @@ static bacl_exit_code darwin_parse_acl_streams(JCR *jcr,
 /*
  * For this OS setup the build and parse function pointer to the OS specific functions.
  */
-static bacl_exit_code (*os_build_acl_streams)
+static bacl_rtn_code (*os_backup_acl_streams)
                       (JCR *jcr, FF_PKT *ff_pkt) =
-                      darwin_build_acl_streams;
-static bacl_exit_code (*os_parse_acl_streams)
+                      darwin_backup_acl_streams;
+static bacl_rtn_code (*os_restore_acl_streams)
                       (JCR *jcr, int stream, char *content, uint32_t content_length) =
-                      darwin_parse_acl_streams;
+                      darwin_restore_acl_streams;
 
 #elif defined(HAVE_FREEBSD_OS)
 /*
@@ -1055,7 +995,7 @@ static int os_default_acl_streams[1] = {
    STREAM_ACL_FREEBSD_DEFAULT_ACL
 };
 
-static bacl_exit_code freebsd_build_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
+static bacl_rtn_code freebsd_backup_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
 {
    int acl_enabled = 0;
    bacl_type acltype = BACL_TYPE_NONE;
@@ -1065,27 +1005,18 @@ static bacl_exit_code freebsd_build_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
     * See if filesystem supports NFS4 acls.
     */
    acl_enabled = pathconf(jcr->last_fname, _PC_ACL_NFS4);
-   switch (acl_enabled) {
-   case -1: {
+   if (acl_enabled < 0) {
       berrno be;
-
-      switch (errno) {
-      case ENOENT:
-         return bacl_exit_ok;
-      default:
-         Mmsg2(jcr->errmsg,
-               _("pathconf error on file \"%s\": ERR=%s\n"),
-               jcr->last_fname, be.bstrerror());
-         Dmsg2(100, "pathconf error file=%s ERR=%s\n",
+      if (errno == ENOENT) {
+         return bacl_rtn_ok;
+      } else {
+         Mmsg2(jcr->errmsg, _("pathconf error on file \"%s\": ERR=%s\n"),
                jcr->last_fname, be.bstrerror());
-         return bacl_exit_error;
+         Dmsg1(100, "%s", jcr->errmsg);
+         return bacl_rtn_error;
       }
-   }
-   case 0:
-      break;
-   default:
+   } else if (acl_enabled != 0) {
       acltype = BACL_TYPE_NFS4;
-      break;
    }
 #endif
 
@@ -1094,27 +1025,18 @@ static bacl_exit_code freebsd_build_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
        * See if filesystem supports POSIX acls.
        */
       acl_enabled = pathconf(jcr->last_fname, _PC_ACL_EXTENDED);
-      switch (acl_enabled) {
-      case -1: {
+      if (acl_enabled < 0) {
          berrno be;
-
-         switch (errno) {
-         case ENOENT:
-            return bacl_exit_ok;
-         default:
-            Mmsg2(jcr->errmsg,
-                  _("pathconf error on file \"%s\": ERR=%s\n"),
-                  jcr->last_fname, be.bstrerror());
-            Dmsg2(100, "pathconf error file=%s ERR=%s\n",
+         if (errno == ENOENT) {
+            return bacl_rtn_ok;
+         } else {
+            Mmsg2(jcr->errmsg, _("pathconf error on file \"%s\": ERR=%s\n"),
                   jcr->last_fname, be.bstrerror());
-            return bacl_exit_error;
+            Dmsg1(100, "%s", jcr->errmsg);
+            return bacl_rtn_error;
          }
-      }
-      case 0:
-         break;
-      default:
+      } else if (acl_enabled != 0) {
          acltype = BACL_TYPE_ACCESS;
-         break;
       }
    }
 
@@ -1125,10 +1047,10 @@ static bacl_exit_code freebsd_build_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
     * when we change from one filesystem to an other.
     */
    if (acl_enabled == 0) {
-      jcr->acl_data->flags &= ~BACL_FLAG_SAVE_NATIVE;
-      pm_strcpy(jcr->acl_data->u.build->content, "");
-      jcr->acl_data->u.build->content_length = 0;
-      return bacl_exit_ok;
+      jcr->acl_ctx->flags &= ~BACL_FLAG_SAVE_NATIVE;
+      pm_strcpy(jcr->acl_ctx->content, "");
+      jcr->acl_ctx->content_length = 0;
+      return bacl_rtn_ok;
    }
 
    /*
@@ -1139,35 +1061,35 @@ static bacl_exit_code freebsd_build_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
       /*
        * Read NFS4 ACLs for files, dirs and links
        */
-      if (generic_get_acl_from_os(jcr, BACL_TYPE_NFS4) == bacl_exit_fatal)
-         return bacl_exit_fatal;
+      if (generic_get_acl_from_os(jcr, BACL_TYPE_NFS4) == bacl_rtn_fatal)
+         return bacl_rtn_fatal;
 
-      if (jcr->acl_data->u.build->content_length > 0) {
-         if (send_acl_stream(jcr, STREAM_ACL_FREEBSD_NFS4_ACL) == bacl_exit_fatal)
-            return bacl_exit_fatal;
+      if (jcr->acl_ctx->content_length > 0) {
+         if (send_acl_stream(jcr, STREAM_ACL_FREEBSD_NFS4_ACL) == bacl_rtn_fatal)
+            return bacl_rtn_fatal;
       }
       break;
    case BACL_TYPE_ACCESS:
       /*
        * Read access ACLs for files, dirs and links
        */
-      if (generic_get_acl_from_os(jcr, BACL_TYPE_ACCESS) == bacl_exit_fatal)
-         return bacl_exit_fatal;
+      if (generic_get_acl_from_os(jcr, BACL_TYPE_ACCESS) == bacl_rtn_fatal)
+         return bacl_rtn_fatal;
 
-      if (jcr->acl_data->u.build->content_length > 0) {
-         if (send_acl_stream(jcr, STREAM_ACL_FREEBSD_ACCESS_ACL) == bacl_exit_fatal)
-            return bacl_exit_fatal;
+      if (jcr->acl_ctx->content_length > 0) {
+         if (send_acl_stream(jcr, STREAM_ACL_FREEBSD_ACCESS_ACL) == bacl_rtn_fatal)
+            return bacl_rtn_fatal;
       }
 
       /*
        * Directories can have default ACLs too
        */
       if (ff_pkt->type == FT_DIREND) {
-         if (generic_get_acl_from_os(jcr, BACL_TYPE_DEFAULT) == bacl_exit_fatal)
-            return bacl_exit_fatal;
-         if (jcr->acl_data->u.build->content_length > 0) {
-            if (send_acl_stream(jcr, STREAM_ACL_FREEBSD_DEFAULT_ACL) == bacl_exit_fatal)
-               return bacl_exit_fatal;
+         if (generic_get_acl_from_os(jcr, BACL_TYPE_DEFAULT) == bacl_rtn_fatal)
+            return bacl_rtn_fatal;
+         if (jcr->acl_ctx->content_length > 0) {
+            if (send_acl_stream(jcr, STREAM_ACL_FREEBSD_DEFAULT_ACL) == bacl_rtn_fatal)
+               return bacl_rtn_fatal;
          }
       }
       break;
@@ -1175,10 +1097,10 @@ static bacl_exit_code freebsd_build_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
       break;
    }
 
-   return bacl_exit_ok;
+   return bacl_rtn_ok;
 }
 
-static bacl_exit_code freebsd_parse_acl_streams(JCR *jcr,
+static bacl_rtn_code freebsd_restore_acl_streams(JCR *jcr,
                                                 int stream,
                                                 char *content,
                                                 uint32_t content_length)
@@ -1208,36 +1130,28 @@ static bacl_exit_code freebsd_parse_acl_streams(JCR *jcr,
       break;
    }
 
-   switch (acl_enabled) {
-   case -1: {
+   if (acl_enabled < 0) {
       berrno be;
-
-      switch (errno) {
-      case ENOENT:
-         return bacl_exit_ok;
-      default:
-         Mmsg2(jcr->errmsg,
-               _("pathconf error on file \"%s\": ERR=%s\n"),
+      if (errno == ENOENT) {
+         return bacl_rtn_ok;
+      } else {
+         Mmsg2(jcr->errmsg, _("pathconf error on file \"%s\": ERR=%s\n"),
                jcr->last_fname, be.bstrerror());
-         Dmsg3(100, "pathconf error acl=%s file=%s ERR=%s\n",
-               content, jcr->last_fname, be.bstrerror());
-         return bacl_exit_error;
+         Dmsg1(100, "%s", jcr->errmsg);
+         return bacl_rtn_error;
       }
-   }
-   case 0:
+   } else if (acl_enabled == 0) {
       /*
        * If the filesystem reports it doesn't support ACLs we clear the
        * BACL_FLAG_RESTORE_NATIVE flag so we skip ACL restores on all other files
        * on the same filesystem. The BACL_FLAG_RESTORE_NATIVE flag gets set again
        * when we change from one filesystem to an other.
        */
-      jcr->acl_data->flags &= ~BACL_FLAG_SAVE_NATIVE;
+      jcr->acl_ctx->flags &= ~BACL_FLAG_SAVE_NATIVE;
       Mmsg2(jcr->errmsg,
             _("Trying to restore acl on file \"%s\" on filesystem without %s acl support\n"),
             jcr->last_fname, acl_type_name);
-      return bacl_exit_error;
-   default:
-      break;
+      return bacl_rtn_error;
    }
 
    /*
@@ -1255,18 +1169,18 @@ static bacl_exit_code freebsd_parse_acl_streams(JCR *jcr,
    default:
       break;
    }
-   return bacl_exit_error;
+   return bacl_rtn_error;
 }
 
 /*
  * For this OSes setup the build and parse function pointer to the OS specific functions.
  */
-static bacl_exit_code (*os_build_acl_streams)
+static bacl_rtn_code (*os_backup_acl_streams)
                       (JCR *jcr, FF_PKT *ff_pkt) =
-                      freebsd_build_acl_streams;
-static bacl_exit_code (*os_parse_acl_streams)
+                      freebsd_backup_acl_streams;
+static bacl_rtn_code (*os_restore_acl_streams)
                       (JCR *jcr, int stream, char *content, uint32_t content_length) =
-                      freebsd_parse_acl_streams;
+                      freebsd_restore_acl_streams;
 
 #elif defined(HAVE_IRIX_OS) || \
       defined(HAVE_LINUX_OS) || \
@@ -1275,56 +1189,44 @@ static bacl_exit_code (*os_parse_acl_streams)
  * Define the supported ACL streams for these OSes
  */
 #if defined(HAVE_IRIX_OS)
-static int os_access_acl_streams[1] = {
-   STREAM_ACL_IRIX_ACCESS_ACL
-};
-static int os_default_acl_streams[1] = {
-   STREAM_ACL_IRIX_DEFAULT_ACL
-};
+static int os_access_acl_streams[1] = {STREAM_ACL_IRIX_ACCESS_ACL};
+static int os_default_acl_streams[1] = {STREAM_ACL_IRIX_DEFAULT_ACL};
 #elif defined(HAVE_LINUX_OS)
-static int os_access_acl_streams[1] = {
-   STREAM_ACL_LINUX_ACCESS_ACL
-};
-static int os_default_acl_streams[1] = {
-   STREAM_ACL_LINUX_DEFAULT_ACL
-};
+static int os_access_acl_streams[1] = {STREAM_ACL_LINUX_ACCESS};
+static int os_default_acl_streams[1] = {STREAM_ACL_LINUX_DEFAULT};
 #elif defined(HAVE_HURD_OS)
-static int os_access_acl_streams[1] = {
-   STREAM_ACL_HURD_ACCESS_ACL
-};
-static int os_default_acl_streams[1] = {
-   STREAM_ACL_HURD_DEFAULT_ACL
-};
+static int os_access_acl_streams[1] = {STREAM_ACL_HURD_ACCESS};
+static int os_default_acl_streams[1] = {STREAM_ACL_HURD_DEFAULT};
 #endif
 
-static bacl_exit_code generic_build_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
+static bacl_rtn_code generic_backup_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
 {
    /*
     * Read access ACLs for files, dirs and links
     */
-   if (generic_get_acl_from_os(jcr, BACL_TYPE_ACCESS) == bacl_exit_fatal)
-      return bacl_exit_fatal;
+   if (generic_get_acl_from_os(jcr, BACL_TYPE_ACCESS) == bacl_rtn_fatal)
+      return bacl_rtn_fatal;
 
-   if (jcr->acl_data->u.build->content_length > 0) {
-      if (send_acl_stream(jcr, os_access_acl_streams[0]) == bacl_exit_fatal)
-         return bacl_exit_fatal;
+   if (jcr->acl_ctx->content_length > 0) {
+      if (send_acl_stream(jcr, os_access_acl_streams[0]) == bacl_rtn_fatal)
+         return bacl_rtn_fatal;
    }
 
    /*
     * Directories can have default ACLs too
     */
    if (ff_pkt->type == FT_DIREND) {
-      if (generic_get_acl_from_os(jcr, BACL_TYPE_DEFAULT) == bacl_exit_fatal)
-         return bacl_exit_fatal;
-      if (jcr->acl_data->u.build->content_length > 0) {
-         if (send_acl_stream(jcr, os_default_acl_streams[0]) == bacl_exit_fatal)
-            return bacl_exit_fatal;
+      if (generic_get_acl_from_os(jcr, BACL_TYPE_DEFAULT) == bacl_rtn_fatal)
+         return bacl_rtn_fatal;
+      if (jcr->acl_ctx->content_length > 0) {
+         if (send_acl_stream(jcr, os_default_acl_streams[0]) == bacl_rtn_fatal)
+            return bacl_rtn_fatal;
       }
    }
-   return bacl_exit_ok;
+   return bacl_rtn_ok;
 }
 
-static bacl_exit_code generic_parse_acl_streams(JCR *jcr,
+static bacl_rtn_code generic_restore_acl_streams(JCR *jcr,
                                                 int stream,
                                                 char *content,
                                                 uint32_t content_length)
@@ -1352,18 +1254,18 @@ static bacl_exit_code generic_parse_acl_streams(JCR *jcr,
       }
       break;
    }
-   return bacl_exit_error;
+   return bacl_rtn_error;
 }
 
 /*
  * For this OSes setup the build and parse function pointer to the OS specific functions.
  */
-static bacl_exit_code (*os_build_acl_streams)
+static bacl_rtn_code (*os_backup_acl_streams)
                       (JCR *jcr, FF_PKT *ff_pkt) =
-                      generic_build_acl_streams;
-static bacl_exit_code (*os_parse_acl_streams)
+                      generic_backup_acl_streams;
+static bacl_rtn_code (*os_restore_acl_streams)
                       (JCR *jcr, int stream, char *content, uint32_t content_length) =
-                      generic_parse_acl_streams;
+                      generic_restore_acl_streams;
 
 #elif defined(HAVE_OSF1_OS)
 
@@ -1378,44 +1280,44 @@ static int os_default_acl_streams[2] = {
    STREAM_ACL_TRU64_DEFAULT_DIR_ACL
 };
 
-static bacl_exit_code tru64_build_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
+static bacl_rtn_code tru64_backup_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
 {
    /*
     * Read access ACLs for files, dirs and links
     */
-   if (generic_get_acl_from_os(jcr, BACL_TYPE_ACCESS) == bacl_exit_fatal) {
-      return bacl_exit_error;
-   if (jcr->acl_data->u.build->content_length > 0) {
+   if (generic_get_acl_from_os(jcr, BACL_TYPE_ACCESS) == bacl_rtn_fatal) {
+      return bacl_rtn_error;
+   if (jcr->acl_ctx->content_length > 0) {
       if (!send_acl_stream(jcr, STREAM_ACL_TRU64_ACCESS_ACL))
-         return bacl_exit_error;
+         return bacl_rtn_error;
    }
    /*
     * Directories can have default ACLs too
     */
    if (ff_pkt->type == FT_DIREND) {
-      if (generic_get_acl_from_os(jcr, BACL_TYPE_DEFAULT) == bacl_exit_fatal) {
-         return bacl_exit_error;
-      if (jcr->acl_data->u.build->content_length > 0) {
+      if (generic_get_acl_from_os(jcr, BACL_TYPE_DEFAULT) == bacl_rtn_fatal) {
+         return bacl_rtn_error;
+      if (jcr->acl_ctx->content_length > 0) {
          if (!send_acl_stream(jcr, STREAM_ACL_TRU64_DEFAULT_ACL))
-            return bacl_exit_error;
+            return bacl_rtn_error;
       }
-      /**
+      /*
        * Tru64 has next to BACL_TYPE_DEFAULT also BACL_TYPE_DEFAULT_DIR acls.
        * This is an inherited acl for all subdirs.
        * See http://www.helsinki.fi/atk/unix/dec_manuals/DOC_40D/AQ0R2DTE/DOCU_018.HTM
        * Section 21.5 Default ACLs
        */
-      if (generic_get_acl_from_os(jcr, BACL_TYPE_DEFAULT_DIR) == bacl_exit_fatal) {
-         return bacl_exit_error;
-      if (jcr->acl_data->u.build->content_length > 0) {
+      if (generic_get_acl_from_os(jcr, BACL_TYPE_DEFAULT_DIR) == bacl_rtn_fatal) {
+         return bacl_rtn_error;
+      if (jcr->acl_ctx->content_length > 0) {
          if (!send_acl_stream(jcr, STREAM_ACL_TRU64_DEFAULT_DIR_ACL))
-            return bacl_exit_error;
+            return bacl_rtn_error;
       }
    }
-   return bacl_exit_ok;
+   return bacl_rtn_ok;
 }
 
-static bacl_exit_code tru64_parse_acl_streams(JCR *jcr,
+static bacl_rtn_code tru64_restore_acl_streams(JCR *jcr,
                                               int stream,
                                               char *content,
                                               uint32_t content_length)
@@ -1434,12 +1336,12 @@ static bacl_exit_code tru64_parse_acl_streams(JCR *jcr,
 /*
  * For this OS setup the build and parse function pointer to the OS specific functions.
  */
-static bacl_exit_code (*os_build_acl_streams)
+static bacl_rtn_code (*os_backup_acl_streams)
                       (JCR *jcr, FF_PKT *ff_pkt) =
-                      tru64_build_acl_streams;
-static bacl_exit_code (*os_parse_acl_streams)
+                      tru64_backup_acl_streams;
+static bacl_rtn_code (*os_restore_acl_streams)
                       (JCR *jcr, int stream, char *content, uint32_t content_length) =
-                      tru64_parse_acl_streams;
+                      tru64_restore_acl_streams;
 
 #endif
 
@@ -1487,7 +1389,7 @@ static bool acl_is_trivial(int count, struct acl_entry *entries, struct stat sb)
 /*
  * OS specific functions for handling different types of acl streams.
  */
-static bacl_exit_code hpux_build_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
+static bacl_rtn_code hpux_backup_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
 {
    int n;
    struct acl_entry acls[NACLENTRIES];
@@ -1495,9 +1397,7 @@ static bacl_exit_code hpux_build_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
 
    if ((n = getacl(jcr->last_fname, 0, acls)) < 0) {
       berrno be;
-
       switch (errno) {
-#if defined(BACL_ENOTSUP)
       case BACL_ENOTSUP:
          /*
           * Not supported, just pretend there is nothing to see
@@ -1507,31 +1407,27 @@ static bacl_exit_code hpux_build_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
           * on the same filesystem. The BACL_FLAG_SAVE_NATIVE flag gets set again
           * when we change from one filesystem to an other.
           */
-         jcr->acl_data->flags &= ~BACL_FLAG_SAVE_NATIVE;
-         pm_strcpy(jcr->acl_data->u.build->content, "");
-         jcr->acl_data->u.build->content_length = 0;
-         return bacl_exit_ok;
-#endif
+         jcr->acl_ctx->flags &= ~BACL_FLAG_SAVE_NATIVE;
+         pm_strcpy(jcr->acl_ctx->content, "");
+         jcr->acl_ctx->content_length = 0;
+         return bacl_rtn_ok;
       case ENOENT:
-         pm_strcpy(jcr->acl_data->u.build->content, "");
-         jcr->acl_data->u.build->content_length = 0;
-         return bacl_exit_ok;
+         pm_strcpy(jcr->acl_ctx->content, "");
+         jcr->acl_ctx->content_length = 0;
+         return bacl_rtn_ok;
       default:
-         Mmsg2(jcr->errmsg,
-               _("getacl error on file \"%s\": ERR=%s\n"),
-               jcr->last_fname, be.bstrerror());
-         Dmsg2(100, "getacl error file=%s ERR=%s\n",
+         Mmsg2(jcr->errmsg, _("getacl error on file \"%s\": ERR=%s\n"),
                jcr->last_fname, be.bstrerror());
-
-         pm_strcpy(jcr->acl_data->u.build->content, "");
-         jcr->acl_data->u.build->content_length = 0;
-         return bacl_exit_error;
+         Dmsg1(100, "%s", jcr->errmsg);
+         pm_strcpy(jcr->acl_ctx->content, "");
+         jcr->acl_ctx->content_length = 0;
+         return bacl_rtn_error;
       }
    }
    if (n == 0) {
-      pm_strcpy(jcr->acl_data->u.build->content, "");
-      jcr->acl_data->u.build->content_length = 0;
-      return bacl_exit_ok;
+      pm_strcpy(jcr->acl_ctx->content, "");
+      jcr->acl_ctx->content_length = 0;
+      return bacl_rtn_ok;
    }
    if ((n = getacl(jcr->last_fname, n, acls)) > 0) {
       if (acl_is_trivial(n, acls, ff_pkt->statp)) {
@@ -1539,30 +1435,28 @@ static bacl_exit_code hpux_build_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
           * The ACLs simply reflect the (already known) standard permissions
           * So we don't send an ACL stream to the SD.
           */
-         pm_strcpy(jcr->acl_data->u.build->content, "");
-         jcr->acl_data->u.build->content_length = 0;
-         return bacl_exit_ok;
+         pm_strcpy(jcr->acl_ctx->content, "");
+         jcr->acl_ctx->content_length = 0;
+         return bacl_rtn_ok;
       }
       if ((acl_text = acltostr(n, acls, FORM_SHORT)) != NULL) {
-         jcr->acl_data->u.build->content_length =
-         pm_strcpy(jcr->acl_data->u.build->content, acl_text);
+         jcr->acl_ctx->content_length =
+           pm_strcpy(jcr->acl_ctx->content, acl_text);
          actuallyfree(acl_text);
 
          return send_acl_stream(jcr, STREAM_ACL_HPUX_ACL_ENTRY);
       }
 
       berrno be;
-      Mmsg2(jcr->errmsg,
-            _("acltostr error on file \"%s\": ERR=%s\n"),
+      Mmsg2(jcr->errmsg, _("acltostr error on file \"%s\": ERR=%s\n"),
             jcr->last_fname, be.bstrerror());
-      Dmsg3(100, "acltostr error acl=%s file=%s ERR=%s\n",
-            jcr->acl_data->u.build->content, jcr->last_fname, be.bstrerror());
-      return bacl_exit_error;
+      Dmsg1(100, "%s", jcr->errmsg);
+      return bacl_rtn_error;
    }
-   return bacl_exit_error;
+   return bacl_rtn_error;
 }
 
-static bacl_exit_code hpux_parse_acl_streams(JCR *jcr,
+static bacl_rtn_code hpux_restore_acl_streams(JCR *jcr,
                                              int stream,
                                              char *content,
                                              uint32_t content_length)
@@ -1573,26 +1467,19 @@ static bacl_exit_code hpux_parse_acl_streams(JCR *jcr,
    n = strtoacl(content, 0, NACLENTRIES, acls, ACL_FILEOWNER, ACL_FILEGROUP);
    if (n <= 0) {
       berrno be;
-
-      Mmsg2(jcr->errmsg,
-            _("strtoacl error on file \"%s\": ERR=%s\n"),
-            jcr->last_fname, be.bstrerror());
-      Dmsg3(100, "strtoacl error acl=%s file=%s ERR=%s\n",
-            content, jcr->last_fname, be.bstrerror());
-      return bacl_exit_error;
+      Mmsg2(jcr->errmsg, _("strtoacl error on file \"%s\": ERR=%s\n"),
+         jcr->last_fname, be.bstrerror());
+      Dmsg1(100, "%s", jcr->errmsg);
+      return bacl_rtn_error;
    }
    if (strtoacl(content, n, NACLENTRIES, acls, ACL_FILEOWNER, ACL_FILEGROUP) != n) {
       berrno be;
-
-      Mmsg2(jcr->errmsg,
-            _("strtoacl error on file \"%s\": ERR=%s\n"),
-            jcr->last_fname, be.bstrerror());
-      Dmsg3(100, "strtoacl error acl=%s file=%s ERR=%s\n",
-            content, jcr->last_fname, be.bstrerror());
-
-      return bacl_exit_error;
+      Mmsg2(jcr->errmsg, _("strtoacl error on file \"%s\": ERR=%s\n"),
+         jcr->last_fname, be.bstrerror());
+      Dmsg1(100, "%s", jcr->errmsg);
+      return bacl_rtn_error;
    }
-   /**
+   /*
     * Restore the ACLs, but don't complain about links which really should
     * not have attributes, and the file it is linked to may not yet be restored.
     * This is only true for the old acl streams as in the new implementation we
@@ -1603,8 +1490,7 @@ static bacl_exit_code hpux_parse_acl_streams(JCR *jcr,
 
       switch (errno) {
       case ENOENT:
-         return bacl_exit_ok;
-#if defined(BACL_ENOTSUP)
+         return bacl_rtn_ok;
       case BACL_ENOTSUP:
          /*
           * If the filesystem reports it doesn't support ACLs we clear the
@@ -1612,35 +1498,32 @@ static bacl_exit_code hpux_parse_acl_streams(JCR *jcr,
           * on the same filesystem. The BACL_FLAG_RESTORE_NATIVE flag gets set again
           * when we change from one filesystem to an other.
           */
-         jcr->acl_data->flags &= ~BACL_FLAG_SAVE_NATIVE;
+         jcr->acl_ctx->flags &= ~BACL_FLAG_SAVE_NATIVE;
          Mmsg1(jcr->errmsg,
                _("setacl error on file \"%s\": filesystem doesn't support ACLs\n"),
                jcr->last_fname);
-         Dmsg2(100, "setacl error acl=%s file=%s filesystem doesn't support ACLs\n",
-               content, jcr->last_fname);
-         return bacl_exit_error;
-#endif
+         Dmsg1(100, "%s", jcr->errmsg);
+         return bacl_rtn_error;
       default:
-         Mmsg2(jcr->errmsg,
-               _("setacl error on file \"%s\": ERR=%s\n"),
+         Mmsg2(jcr->errmsg, _("setacl error on file \"%s\": ERR=%s\n"),
                jcr->last_fname, be.bstrerror());
-         Dmsg3(100, "setacl error acl=%s file=%s ERR=%s\n",
-               content, jcr->last_fname, be.bstrerror());
-         return bacl_exit_error;
+         Dmsg1(100, "%s", jcr->errmsg);
+         return bacl_rtn_error;
       }
    }
-   return bacl_exit_ok;
+   return bacl_rtn_ok;
 }
 
 /*
  * For this OS setup the build and parse function pointer to the OS specific functions.
  */
-static bacl_exit_code (*os_build_acl_streams)
+static bacl_rtn_code (*os_backup_acl_streams)
                       (JCR *jcr, FF_PKT *ff_pkt) =
-                      hpux_build_acl_streams;
-static bacl_exit_code (*os_parse_acl_streams)
+                      hpux_backup_acl_streams;
+
+static bacl_rtn_code (*os_restore_acl_streams)
                       (JCR *jcr, int stream, char *content, uint32_t content_length) =
-                      hpux_parse_acl_streams;
+                      hpux_restore_acl_streams;
 
 #elif defined(HAVE_SUN_OS)
 #ifdef HAVE_SYS_ACL_H
@@ -1650,7 +1533,7 @@ static bacl_exit_code (*os_parse_acl_streams)
 #endif
 
 #if defined(HAVE_EXTENDED_ACL)
-/**
+/*
  * We define some internals of the Solaris acl libs here as those
  * are not exposed yet. Probably because they want us to see the
  * acls as opague data. But as we need to support different platforms
@@ -1669,7 +1552,7 @@ typedef enum acl_type {
 } acl_type_t;
 #endif
 
-/**
+/*
  * Two external references to functions in the libsec library function not in current include files.
  */
 extern "C" {
@@ -1688,70 +1571,59 @@ static int os_default_acl_streams[1] = {
    -1
 };
 
-/**
+/*
  * As the new libsec interface with acl_totext and acl_fromtext also handles
  * the old format from acltotext we can use the new functions even
  * for acls retrieved and stored in the database with older fd versions. If the
  * new interface is not defined (Solaris 9 and older we fall back to the old code)
  */
-static bacl_exit_code solaris_build_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
+static bacl_rtn_code solaris_backup_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
 {
    int acl_enabled, flags;
    acl_t *aclp;
    char *acl_text;
-   bacl_exit_code stream_status = bacl_exit_error;
+   bacl_rtn_code stream_status = bacl_rtn_error;
 
    /*
     * See if filesystem supports acls.
     */
    acl_enabled = pathconf(jcr->last_fname, _PC_ACL_ENABLED);
-   switch (acl_enabled) {
-   case 0:
+   if (acl_enabled == 0) {
       /*
        * If the filesystem reports it doesn't support ACLs we clear the
        * BACL_FLAG_SAVE_NATIVE flag so we skip ACL saves on all other files
        * on the same filesystem. The BACL_FLAG_SAVE_NATIVE flag gets set again
        * when we change from one filesystem to an other.
        */
-      jcr->acl_data->flags &= ~BACL_FLAG_SAVE_NATIVE;
-      pm_strcpy(jcr->acl_data->u.build->content, "");
-      jcr->acl_data->u.build->content_length = 0;
-      return bacl_exit_ok;
-   case -1: {
+      jcr->acl_ctx->flags &= ~BACL_FLAG_SAVE_NATIVE;
+      pm_strcpy(jcr->acl_ctx->content, "");
+      jcr->acl_ctx->content_length = 0;
+      return bacl_rtn_ok;
+   }
+   if (acl_enabled < 0) {
       berrno be;
-
-      switch (errno) {
-      case ENOENT:
-         return bacl_exit_ok;
-      default:
-         Mmsg2(jcr->errmsg,
-               _("pathconf error on file \"%s\": ERR=%s\n"),
-               jcr->last_fname, be.bstrerror());
-         Dmsg2(100, "pathconf error file=%s ERR=%s\n",
+      if (errno == ENOENT) {
+         return bacl_rtn_ok;
+      } else {
+         Mmsg2(jcr->errmsg, _("pathconf error on file \"%s\": ERR=%s\n"),
                jcr->last_fname, be.bstrerror());
-         return bacl_exit_error;
+         Dmsg1(100, "%s", jcr->errmsg);
+         return bacl_rtn_error;
       }
    }
-   default:
-      break;
-   }
 
    /*
     * Get ACL info: don't bother allocating space if there is only a trivial ACL.
     */
    if (acl_get(jcr->last_fname, ACL_NO_TRIVIAL, &aclp) != 0) {
       berrno be;
-
-      switch (errno) {
-      case ENOENT:
-         return bacl_exit_ok;
-      default:
-         Mmsg2(jcr->errmsg,
-               _("acl_get error on file \"%s\": ERR=%s\n"),
-               jcr->last_fname, acl_strerror(errno));
-         Dmsg2(100, "acl_get error file=%s ERR=%s\n",
+      if (errno == ENOENT) {
+         return bacl_rtn_ok;
+      } else {
+         Mmsg2(jcr->errmsg, _("acl_get error on file \"%s\": ERR=%s\n"),
                jcr->last_fname, acl_strerror(errno));
-         return bacl_exit_error;
+         Dmsg1(100, "%s", jcr->errmsg);
+         return bacl_rtn_error;
       }
    }
 
@@ -1760,9 +1632,9 @@ static bacl_exit_code solaris_build_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
        * The ACLs simply reflect the (already known) standard permissions
        * So we don't send an ACL stream to the SD.
        */
-      pm_strcpy(jcr->acl_data->u.build->content, "");
-      jcr->acl_data->u.build->content_length = 0;
-      return bacl_exit_ok;
+      pm_strcpy(jcr->acl_ctx->content, "");
+      jcr->acl_ctx->content_length = 0;
+      return bacl_rtn_ok;
    }
 
 #if defined(ACL_SID_FMT)
@@ -1775,8 +1647,8 @@ static bacl_exit_code solaris_build_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
 #endif /* ACL_SID_FMT */
 
    if ((acl_text = acl_totext(aclp, flags)) != NULL) {
-      jcr->acl_data->u.build->content_length =
-      pm_strcpy(jcr->acl_data->u.build->content, acl_text);
+      jcr->acl_ctx->content_length =
+         pm_strcpy(jcr->acl_ctx->content, acl_text);
       actuallyfree(acl_text);
 
       switch (acl_type(aclp)) {
@@ -1795,149 +1667,133 @@ static bacl_exit_code solaris_build_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
    return stream_status;
 }
 
-static bacl_exit_code solaris_parse_acl_streams(JCR *jcr,
-                                                int stream,
-                                                char *content,
-                                                uint32_t content_length)
+static bacl_rtn_code solaris_restore_acl_streams(JCR *jcr, int stream, char *content,
+                                                 uint32_t content_length)
 {
    acl_t *aclp;
    int acl_enabled, error;
 
+   if (stream != STREAM_UNIX_ACCESS_ACL || stream != STREAM_ACL_SOLARIS_ACLENT ||
+       stream != STREAM_ACL_SOLARIS_ACE) {
+      return bacl_rtn_error;
+   }
+
+   /*
+    * First make sure the filesystem supports acls.
+    */
+   acl_enabled = pathconf(jcr->last_fname, _PC_ACL_ENABLED);
+   if (acl_enabled == 0) {
+      /*
+       * If the filesystem reports it doesn't support ACLs we clear the
+       * BACL_FLAG_RESTORE_NATIVE flag so we skip ACL restores on all other files
+       * on the same filesystem. The BACL_FLAG_RESTORE_NATIVE flag gets set again
+       * when we change from one filesystem to an other.
+       */
+      jcr->acl_ctx->flags &= ~BACL_FLAG_RESTORE_NATIVE;
+      Mmsg1(jcr->errmsg,
+            _("Trying to restore acl on file \"%s\" on filesystem without acl support\n"),
+            jcr->last_fname);
+      return bacl_rtn_error;
+   } else if (acl_enabled < 0) {
+      berrno be;
+      if (errno == ENOENT) {
+         return bacl_rtn_ok;
+      } else {
+         Mmsg2(jcr->errmsg, _("pathconf error on file \"%s\": ERR=%s\n"),
+               jcr->last_fname, be.bstrerror());
+         Dmsg1(100, "%s", jcr->errmsg);
+         return bacl_rtn_error;
+      }
+   }
+   /*
+    * On a filesystem with ACL support make sure this particular ACL type can be restored.
+    */
    switch (stream) {
-   case STREAM_UNIX_ACCESS_ACL:
    case STREAM_ACL_SOLARIS_ACLENT:
-   case STREAM_ACL_SOLARIS_ACE:
       /*
-       * First make sure the filesystem supports acls.
+       * An aclent can be restored on filesystems with _ACL_ACLENT_ENABLED or _ACL_ACE_ENABLED support.
        */
-      acl_enabled = pathconf(jcr->last_fname, _PC_ACL_ENABLED);
-      switch (acl_enabled) {
-      case 0:
-         /*
-          * If the filesystem reports it doesn't support ACLs we clear the
-          * BACL_FLAG_RESTORE_NATIVE flag so we skip ACL restores on all other files
-          * on the same filesystem. The BACL_FLAG_RESTORE_NATIVE flag gets set again
-          * when we change from one filesystem to an other.
-          */
-         jcr->acl_data->flags &= ~BACL_FLAG_RESTORE_NATIVE;
+      if ((acl_enabled & (_ACL_ACLENT_ENABLED | _ACL_ACE_ENABLED)) == 0) {
          Mmsg1(jcr->errmsg,
-               _("Trying to restore acl on file \"%s\" on filesystem without acl support\n"),
+               _("Trying to restore POSIX acl on file \"%s\" on filesystem without aclent acl support\n"),
                jcr->last_fname);
-         return bacl_exit_error;
-      case -1: {
-         berrno be;
-
-         switch (errno) {
-         case ENOENT:
-            return bacl_exit_ok;
-         default:
-            Mmsg2(jcr->errmsg,
-                  _("pathconf error on file \"%s\": ERR=%s\n"),
-                  jcr->last_fname, be.bstrerror());
-            Dmsg3(100, "pathconf error acl=%s file=%s ERR=%s\n",
-                  content, jcr->last_fname, be.bstrerror());
-            return bacl_exit_error;
-         }
+         return bacl_rtn_error;
       }
-      default:
-         /*
-          * On a filesystem with ACL support make sure this particular ACL type can be restored.
-          */
-         switch (stream) {
-         case STREAM_ACL_SOLARIS_ACLENT:
-            /*
-             * An aclent can be restored on filesystems with _ACL_ACLENT_ENABLED or _ACL_ACE_ENABLED support.
-             */
-            if ((acl_enabled & (_ACL_ACLENT_ENABLED | _ACL_ACE_ENABLED)) == 0) {
-               Mmsg1(jcr->errmsg,
-                     _("Trying to restore POSIX acl on file \"%s\" on filesystem without aclent acl support\n"),
-                     jcr->last_fname);
-               return bacl_exit_error;
-            }
-            break;
-         case STREAM_ACL_SOLARIS_ACE:
-            /*
-             * An ace can only be restored on a filesystem with _ACL_ACE_ENABLED support.
-             */
-            if ((acl_enabled & _ACL_ACE_ENABLED) == 0) {
-               Mmsg1(jcr->errmsg,
-                     _("Trying to restore NFSv4 acl on file \"%s\" on filesystem without ace acl support\n"),
-                     jcr->last_fname);
-               return bacl_exit_error;
-            }
-            break;
-         default:
-            /*
-             * Stream id which doesn't describe the type of acl which is encoded.
-             */
-            break;
-         }
-         break;
+      break;
+   case STREAM_ACL_SOLARIS_ACE:
+      /*
+       * An ace can only be restored on a filesystem with _ACL_ACE_ENABLED support.
+       */
+      if ((acl_enabled & _ACL_ACE_ENABLED) == 0) {
+         Mmsg1(jcr->errmsg,
+               _("Trying to restore NFSv4 acl on file \"%s\" on filesystem without ace acl support\n"),
+               jcr->last_fname);
+         return bacl_rtn_error;
       }
+      break;
+   default:
+      /*
+       * Stream id which doesn't describe the type of acl which is encoded.
+       */
+      break;
+   }
 
-      if ((error = acl_fromtext(content, &aclp)) != 0) {
-         Mmsg2(jcr->errmsg,
-               _("acl_fromtext error on file \"%s\": ERR=%s\n"),
-               jcr->last_fname, acl_strerror(error));
-         Dmsg3(100, "acl_fromtext error acl=%s file=%s ERR=%s\n",
-               content, jcr->last_fname, acl_strerror(error));
-         return bacl_exit_error;
-      }
+   if ((error = acl_fromtext(content, &aclp)) != 0) {
+      Mmsg2(jcr->errmsg,
+            _("acl_fromtext error on file \"%s\": ERR=%s\n"),
+            jcr->last_fname, acl_strerror(error));
+      Dmsg1(100, "%s", jcr->errmsg);
+      return bacl_rtn_error;
+   }
 
+   /*
+    * Validate that the conversion gave us the correct acl type.
+    */
+   switch (stream) {
+   case STREAM_ACL_SOLARIS_ACLENT:
+      if (acl_type(aclp) != ACLENT_T) {
+         Mmsg1(jcr->errmsg,
+               _("wrong encoding of acl type in acl stream on file \"%s\"\n"),
+               jcr->last_fname);
+         return bacl_rtn_error;
+      }
+      break;
+   case STREAM_ACL_SOLARIS_ACE:
+      if (acl_type(aclp) != ACE_T) {
+         Mmsg1(jcr->errmsg,
+               _("wrong encoding of acl type in acl stream on file \"%s\"\n"),
+               jcr->last_fname);
+         return bacl_rtn_error;
+      }
+      break;
+   default:
       /*
-       * Validate that the conversion gave us the correct acl type.
+       * Stream id which doesn't describe the type of acl which is encoded.
        */
-      switch (stream) {
-      case STREAM_ACL_SOLARIS_ACLENT:
-         if (acl_type(aclp) != ACLENT_T) {
-            Mmsg1(jcr->errmsg,
-                  _("wrong encoding of acl type in acl stream on file \"%s\"\n"),
-                  jcr->last_fname);
-            return bacl_exit_error;
-         }
-         break;
-      case STREAM_ACL_SOLARIS_ACE:
-         if (acl_type(aclp) != ACE_T) {
-            Mmsg1(jcr->errmsg,
-                  _("wrong encoding of acl type in acl stream on file \"%s\"\n"),
-                  jcr->last_fname);
-            return bacl_exit_error;
-         }
-         break;
-      default:
-         /*
-          * Stream id which doesn't describe the type of acl which is encoded.
-          */
-         break;
-      }
+      break;
+   }
 
-      /**
-       * Restore the ACLs, but don't complain about links which really should
-       * not have attributes, and the file it is linked to may not yet be restored.
-       * This is only true for the old acl streams as in the new implementation we
-       * don't save acls of symlinks (which cannot have acls anyhow)
-       */
-      if ((error = acl_set(jcr->last_fname, aclp)) == -1 && jcr->last_type != FT_LNK) {
-         switch (errno) {
-         case ENOENT:
-            acl_free(aclp);
-            return bacl_exit_ok;
-         default:
-            Mmsg2(jcr->errmsg,
-                  _("acl_set error on file \"%s\": ERR=%s\n"),
-                  jcr->last_fname, acl_strerror(error));
-            Dmsg3(100, "acl_set error acl=%s file=%s ERR=%s\n",
-                  content, jcr->last_fname, acl_strerror(error));
-            acl_free(aclp);
-            return bacl_exit_error;
-         }
+   /*
+    * Restore the ACLs, but don't complain about links which really should
+    * not have attributes, and the file it is linked to may not yet be restored.
+    * This is only true for the old acl streams as in the new implementation we
+    * don't save acls of symlinks (which cannot have acls anyhow)
+    */
+   if ((error = acl_set(jcr->last_fname, aclp)) == -1 && jcr->last_type != FT_LNK) {
+      if (errno == ENOENT) {
+         acl_free(aclp);
+         return bacl_rtn_ok;
+      } else {
+         Mmsg2(jcr->errmsg, _("acl_set error on file \"%s\": ERR=%s\n"),
+               jcr->last_fname, acl_strerror(error));
+         Dmsg1(100, "%s", jcr->errmsg);
+         acl_free(aclp);
+         return bacl_rtn_error;
       }
+   }
 
-      acl_free(aclp);
-      return bacl_exit_ok;
-   default:
-      return bacl_exit_error;
-   } /* end switch (stream) */
+   acl_free(aclp);
+   return bacl_rtn_ok;
 }
 
 #else /* HAVE_EXTENDED_ACL */
@@ -1976,7 +1832,7 @@ static bool acl_is_trivial(int count, aclent_t *entries)
 /*
  * OS specific functions for handling different types of acl streams.
  */
-static bacl_exit_code solaris_build_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
+static bacl_rtn_code solaris_backup_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
 {
    int n;
    aclent_t *acls;
@@ -1984,7 +1840,7 @@ static bacl_exit_code solaris_build_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
 
    n = acl(jcr->last_fname, GETACLCNT, 0, NULL);
    if (n < MIN_ACL_ENTRIES) {
-      return bacl_exit_error;
+      return bacl_rtn_error;
    }
 
    acls = (aclent_t *)malloc(n * sizeof(aclent_t));
@@ -1995,34 +1851,30 @@ static bacl_exit_code solaris_build_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
           * So we don't send an ACL stream to the SD.
           */
          free(acls);
-         pm_strcpy(jcr->acl_data->u.build->content, "");
-         jcr->acl_data->u.build->content_length = 0;
-         return bacl_exit_ok;
+         pm_strcpy(jcr->acl_ctx->content, "");
+         jcr->acl_ctx->content_length = 0;
+         return bacl_rtn_ok;
       }
 
       if ((acl_text = acltotext(acls, n)) != NULL) {
-         jcr->acl_data->u.build->content_length =
-         pm_strcpy(jcr->acl_data->u.build->content, acl_text);
+         jcr->acl_ctx->content_length =
+            pm_strcpy(jcr->acl_ctx->content, acl_text);
          actuallyfree(acl_text);
          free(acls);
          return send_acl_stream(jcr, STREAM_ACL_SOLARIS_ACLENT);
       }
 
       berrno be;
-      Mmsg2(jcr->errmsg,
-            _("acltotext error on file \"%s\": ERR=%s\n"),
+      Mmsg2(jcr->errmsg, _("acltotext error on file \"%s\": ERR=%s\n"),
             jcr->last_fname, be.bstrerror());
-      Dmsg3(100, "acltotext error acl=%s file=%s ERR=%s\n",
-            jcr->acl_data->u.build->content, jcr->last_fname, be.bstrerror());
+      Dmsg1(100, "%s", jcr->errmsg);
    }
 
    free(acls);
-   return bacl_exit_error;
+   return bacl_rtn_error;
 }
 
-static bacl_exit_code solaris_parse_acl_streams(JCR *jcr,
-                                                int stream,
-                                                char *content,
+static bacl_rtn_code solaris_restore_acl_streams(JCR *jcr, int stream, char *content,
                                                 uint32_t content_length)
 {
    int n;
@@ -2032,12 +1884,10 @@ static bacl_exit_code solaris_parse_acl_streams(JCR *jcr,
    if (!acls) {
       berrno be;
 
-      Mmsg2(jcr->errmsg,
-            _("aclfromtext error on file \"%s\": ERR=%s\n"),
+      Mmsg2(jcr->errmsg, _("aclfromtext error on file \"%s\": ERR=%s\n"),
             jcr->last_fname, be.bstrerror());
-      Dmsg3(100, "aclfromtext error acl=%s file=%s ERR=%s\n",
-            content, jcr->last_fname, be.bstrerror());
-      return bacl_exit_error;
+      Dmsg1(100, "%s", jcr->errmsg);
+      return bacl_rtn_error;
    }
 
    /*
@@ -2046,35 +1896,31 @@ static bacl_exit_code solaris_parse_acl_streams(JCR *jcr,
     */
    if (acl(jcr->last_fname, SETACL, n, acls) == -1 && jcr->last_type != FT_LNK) {
       berrno be;
-
-      switch (errno) {
-      case ENOENT:
+      if (errno == ENOENT) {
          actuallyfree(acls);
-         return bacl_exit_ok;
-      default:
-         Mmsg2(jcr->errmsg,
-               _("acl(SETACL) error on file \"%s\": ERR=%s\n"),
+         return bacl_rtn_ok;
+      } else {
+         Mmsg2(jcr->errmsg, _("acl(SETACL) error on file \"%s\": ERR=%s\n"),
                jcr->last_fname, be.bstrerror());
-         Dmsg3(100, "acl(SETACL) error acl=%s file=%s ERR=%s\n",
-               content, jcr->last_fname, be.bstrerror());
+         Dmsg1(100, "%s", jcr->errmsg);
          actuallyfree(acls);
-         return bacl_exit_error;
+         return bacl_rtn_error;
       }
    }
    actuallyfree(acls);
-   return bacl_exit_ok;
+   return bacl_rtn_ok;
 }
 #endif /* HAVE_EXTENDED_ACL */
 
 /*
  * For this OS setup the build and parse function pointer to the OS specific functions.
  */
-static bacl_exit_code (*os_build_acl_streams)
+static bacl_rtn_code (*os_backup_acl_streams)
                       (JCR *jcr, FF_PKT *ff_pkt) =
-                      solaris_build_acl_streams;
-static bacl_exit_code (*os_parse_acl_streams)
+                      solaris_backup_acl_streams;
+static bacl_rtn_code (*os_restore_acl_streams)
                       (JCR *jcr, int stream, char *content, uint32_t content_length) =
-                      solaris_parse_acl_streams;
+                      solaris_restore_acl_streams;
 
 #endif /* HAVE_SUN_OS */
 #endif /* HAVE_ACL */
@@ -2088,14 +1934,14 @@ static bacl_exit_code (*os_parse_acl_streams)
 #error "configure failed to detect availability of afs/afsint.h and/or afs/venus.h"
 #endif
 
-/**
+/*
  * External references to functions in the libsys library function not in current include files.
  */
 extern "C" {
 long pioctl(char *pathp, long opcode, struct ViceIoctl *blobp, int follow);
 }
 
-static bacl_exit_code afs_build_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
+static bacl_rtn_code afs_backup_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
 {
    int error;
    struct ViceIoctl vip;
@@ -2106,7 +1952,7 @@ static bacl_exit_code afs_build_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
     * request them for anything other then that.
     */
    if (ff_pkt->type != FT_DIREND) {
-      return bacl_exit_ok;
+      return bacl_rtn_ok;
    }
 
    vip.in = NULL;
@@ -2117,22 +1963,16 @@ static bacl_exit_code afs_build_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
 
    if ((error = pioctl(jcr->last_fname, VIOCGETAL, &vip, 0)) < 0) {
       berrno be;
-
-      Mmsg2(jcr->errmsg,
-            _("pioctl VIOCGETAL error on file \"%s\": ERR=%s\n"),
-            jcr->last_fname, be.bstrerror());
-      Dmsg2(100, "pioctl VIOCGETAL error file=%s ERR=%s\n",
+      Mmsg2(jcr->errmsg, _("pioctl VIOCGETAL error on file \"%s\": ERR=%s\n"),
             jcr->last_fname, be.bstrerror());
-      return bacl_exit_error;
+         Dmsg1(100, "%s", jcr->errmsg);
+      return bacl_rtn_error;
    }
-   jcr->acl_data->u.build->content_length =
-   pm_strcpy(jcr->acl_data->u.build->content, acl_text);
+   jcr->acl_ctx->content_length = pm_strcpy(jcr->acl_ctx->content, acl_text);
    return send_acl_stream(jcr, STREAM_ACL_AFS_TEXT);
 }
 
-static bacl_exit_code afs_parse_acl_stream(JCR *jcr,
-                                           int stream,
-                                           char *content,
+static bacl_rtn_code afs_restore_acl_stream(JCR *jcr, int stream, char *content,
                                            uint32_t content_length)
 {
    int error;
@@ -2145,39 +1985,42 @@ static bacl_exit_code afs_parse_acl_stream(JCR *jcr,
 
    if ((error = pioctl(jcr->last_fname, VIOCSETAL, &vip, 0)) < 0) {
       berrno be;
-
-      Mmsg2(jcr->errmsg,
-            _("pioctl VIOCSETAL error on file \"%s\": ERR=%s\n"),
-            jcr->last_fname, be.bstrerror());
-      Dmsg2(100, "pioctl VIOCSETAL error file=%s ERR=%s\n",
+      Mmsg2(jcr->errmsg, _("pioctl VIOCSETAL error on file \"%s\": ERR=%s\n"),
             jcr->last_fname, be.bstrerror());
-
-      return bacl_exit_error;
+      Dmsg1(100, "%s", jcr->errmsg);
+      return bacl_rtn_error;
    }
-   return bacl_exit_ok;
+   return bacl_rtn_ok;
 }
 #endif /* HAVE_AFS_ACL */
 
-/**
+/*
  * Entry points when compiled with support for ACLs on a supported platform.
  */
 
-/**
+/*
  * Read and send an ACL for the last encountered file.
  */
-bacl_exit_code build_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
+bool backup_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
 {
+   bacl_rtn_code rtn = bacl_rtn_error;
+
+   if (!(ff_pkt->flags & FO_ACL && ff_pkt->type != FT_LNK && !ff_pkt->cmd_plugin)) {
+      return true;      /* No acl request */
+   }
+   jcr->errmsg[0] = 0;
+
    /*
     * See if we are changing from one device to an other.
     * We save the current device we are scanning and compare
     * it with the current st_dev in the last stat performed on
     * the file we are currently storing.
     */
-   if (jcr->acl_data->current_dev != ff_pkt->statp.st_dev) {
+   if (jcr->acl_ctx->current_dev != ff_pkt->statp.st_dev) {
       /*
        * Reset the acl save flags.
        */
-      jcr->acl_data->flags = 0;
+      jcr->acl_ctx->flags = 0;
 
 #if defined(HAVE_AFS_ACL)
       /*
@@ -2185,52 +2028,72 @@ bacl_exit_code build_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
        * Set the BACL_FLAG_SAVE_AFS flag if it is. If not set the BACL_FLAG_SAVE_NATIVE flag.
        */
       if (fstype_equals(jcr->last_fname, "afs")) {
-         jcr->acl_data->flags |= BACL_FLAG_SAVE_AFS;
+         jcr->acl_ctx->flags |= BACL_FLAG_SAVE_AFS;
       } else {
-         jcr->acl_data->flags |= BACL_FLAG_SAVE_NATIVE;
+         jcr->acl_ctx->flags |= BACL_FLAG_SAVE_NATIVE;
       }
 #else
-      jcr->acl_data->flags |= BACL_FLAG_SAVE_NATIVE;
+      jcr->acl_ctx->flags |= BACL_FLAG_SAVE_NATIVE;
 #endif
 
       /*
        * Save that we started scanning a new filesystem.
        */
-      jcr->acl_data->current_dev = ff_pkt->statp.st_dev;
+      jcr->acl_ctx->current_dev = ff_pkt->statp.st_dev;
    }
 
-#if defined(HAVE_AFS_ACL)
+#ifdef HAVE_AFS_ACL
    /*
     * See if the BACL_FLAG_SAVE_AFS flag is set which lets us know if we should
     * save AFS ACLs.
     */
-   if (jcr->acl_data->flags & BACL_FLAG_SAVE_AFS) {
-      return afs_build_acl_streams(jcr, ff_pkt);
+   if (jcr->acl_ctx->flags & BACL_FLAG_SAVE_AFS) {
+      rtn = afs_backup_acl_streams(jcr, ff_pkt);
+      goto get_out;
    }
 #endif
-#if defined(HAVE_ACL)
+
+#ifdef HAVE_ACL
    /*
     * See if the BACL_FLAG_SAVE_NATIVE flag is set which lets us know if we should
     * save native ACLs.
     */
-   if (jcr->acl_data->flags & BACL_FLAG_SAVE_NATIVE) {
+   if (jcr->acl_ctx->flags & BACL_FLAG_SAVE_NATIVE) {
       /*
        * Call the appropriate function.
        */
-      if (os_build_acl_streams) {
-         return os_build_acl_streams(jcr, ff_pkt);
+      if (os_backup_acl_streams) {
+         rtn = os_backup_acl_streams(jcr, ff_pkt);
+         goto get_out;
       }
    } else {
-      return bacl_exit_ok;
+      return true;
    }
 #endif
-   return bacl_exit_error;
+
+get_out:
+   switch (rtn) {
+   case bacl_rtn_fatal:
+      return false;
+   case bacl_rtn_ok:
+      return true;
+   case bacl_rtn_error:
+      if (jcr->acl_ctx->nr_errors < ACL_MAX_ERROR_PRINT_PER_JOB) {
+         if (jcr->errmsg[0]) {
+            Jmsg(jcr, M_WARNING, 0, "Operating system ACLs not configured.\n");
+         } else {
+            Jmsg(jcr, M_WARNING, 0, "%s", jcr->errmsg);
+         }
+         jcr->acl_ctx->nr_errors++;
+      }
+      return true;
+   }
+   /* Theoretically we cannot get here */
+   return false;
 }
 
-bacl_exit_code parse_acl_streams(JCR *jcr,
-                                 int stream,
-                                 char *content,
-                                 uint32_t content_length)
+bacl_rtn_code restore_acl_streams(JCR *jcr, int stream,
+                  char *content, uint32_t content_length)
 {
    int ret;
    struct stat st;
@@ -2243,31 +2106,22 @@ bacl_exit_code parse_acl_streams(JCR *jcr,
     * the file we are currently restoring.
     */
    ret = lstat(jcr->last_fname, &st);
-   switch (ret) {
-   case -1: {
+   if (ret < 0) {
       berrno be;
-
-      switch (errno) {
-      case ENOENT:
-         return bacl_exit_ok;
-      default:
-         Mmsg2(jcr->errmsg,
-               _("Unable to stat file \"%s\": ERR=%s\n"),
-               jcr->last_fname, be.bstrerror());
-         Dmsg2(100, "Unable to stat file \"%s\": ERR=%s\n",
+      if (errno == ENOENT) {
+         return bacl_rtn_ok;
+      } else {
+         Mmsg2(jcr->errmsg, _("Unable to stat file \"%s\": ERR=%s\n"),
                jcr->last_fname, be.bstrerror());
-         return bacl_exit_error;
+         Dmsg1(100, "%s", jcr->errmsg);
+         return bacl_rtn_error;
       }
-      break;
    }
-   case 0:
-      break;
-   }
-   if (jcr->acl_data->current_dev != st.st_dev) {
+   if (jcr->acl_ctx->current_dev != st.st_dev) {
       /*
        * Reset the acl save flags.
        */
-      jcr->acl_data->flags = 0;
+      jcr->acl_ctx->flags = 0;
 
 #if defined(HAVE_AFS_ACL)
       /*
@@ -2275,57 +2129,56 @@ bacl_exit_code parse_acl_streams(JCR *jcr,
        * Set the BACL_FLAG_RESTORE_AFS flag if it is. If not set the BACL_FLAG_RETORE_NATIVE flag.
        */
       if (fstype_equals(jcr->last_fname, "afs")) {
-         jcr->acl_data->flags |= BACL_FLAG_RESTORE_AFS;
+         jcr->acl_ctx->flags |= BACL_FLAG_RESTORE_AFS;
       } else {
-         jcr->acl_data->flags |= BACL_FLAG_RESTORE_NATIVE;
+         jcr->acl_ctx->flags |= BACL_FLAG_RESTORE_NATIVE;
       }
 #else
-      jcr->acl_data->flags |= BACL_FLAG_RESTORE_NATIVE;
+      jcr->acl_ctx->flags |= BACL_FLAG_RESTORE_NATIVE;
 #endif
 
-      /*
-       * Save that we started restoring to a new filesystem.
-       */
-      jcr->acl_data->current_dev = st.st_dev;
+      /* Save that we started restoring to a new filesystem. */
+      jcr->acl_ctx->current_dev = st.st_dev;
    }
 
    switch (stream) {
-#if defined(HAVE_AFS_ACL)
+#ifdef HAVE_AFS_ACL
    case STREAM_ACL_AFS_TEXT:
-      if (jcr->acl_data->flags & BACL_FLAG_RESTORE_AFS) {
-         return afs_parse_acl_stream(jcr, stream, content, content_length);
+      if (jcr->acl_ctx->flags & BACL_FLAG_RESTORE_AFS) {
+         return afs_restore_acl_stream(jcr, stream, content, content_length);
       } else {
          /*
           * Increment error count but don't log an error again for the same filesystem.
           */
-         jcr->acl_data->u.parse->nr_errors++;
-         return bacl_exit_ok;
+         jcr->acl_ctx->nr_errors++;
+         return bacl_rtn_ok;
       }
 #endif
-#if defined(HAVE_ACL)
+
+#ifdef HAVE_ACL
    case STREAM_UNIX_ACCESS_ACL:
    case STREAM_UNIX_DEFAULT_ACL:
       /*
        * Handle legacy ACL streams.
        */
-      if ((jcr->acl_data->flags & BACL_FLAG_RESTORE_NATIVE) && os_parse_acl_streams) {
-         return os_parse_acl_streams(jcr, stream, content, content_length);
+      if ((jcr->acl_ctx->flags & BACL_FLAG_RESTORE_NATIVE) && os_restore_acl_streams) {
+         return os_restore_acl_streams(jcr, stream, content, content_length);
       } else {
          /*
           * Increment error count but don't log an error again for the same filesystem.
           */
-         jcr->acl_data->u.parse->nr_errors++;
-         return bacl_exit_ok;
+         jcr->acl_ctx->nr_errors++;
+         return bacl_rtn_ok;
       }
       break;
    default:
-      if ((jcr->acl_data->flags & BACL_FLAG_RESTORE_NATIVE) && os_parse_acl_streams) {
+      if ((jcr->acl_ctx->flags & BACL_FLAG_RESTORE_NATIVE) && os_restore_acl_streams) {
          /*
           * Walk the os_access_acl_streams array with the supported Access ACL streams for this OS.
           */
          for (cnt = 0; cnt < sizeof(os_access_acl_streams) / sizeof(int); cnt++) {
             if (os_access_acl_streams[cnt] == stream) {
-               return os_parse_acl_streams(jcr, stream, content, content_length);
+               return os_restore_acl_streams(jcr, stream, content, content_length);
             }
          }
          /*
@@ -2333,15 +2186,15 @@ bacl_exit_code parse_acl_streams(JCR *jcr,
           */
          for (cnt = 0; cnt < sizeof(os_default_acl_streams) / sizeof(int); cnt++) {
             if (os_default_acl_streams[cnt] == stream) {
-               return os_parse_acl_streams(jcr, stream, content, content_length);
+               return os_restore_acl_streams(jcr, stream, content, content_length);
             }
          }
       } else {
          /*
           * Increment error count but don't log an error again for the same filesystem.
           */
-         jcr->acl_data->u.parse->nr_errors++;
-         return bacl_exit_ok;
+         jcr->acl_ctx->nr_errors++;
+         return bacl_rtn_ok;
       }
       break;
 #else
@@ -2349,9 +2202,8 @@ bacl_exit_code parse_acl_streams(JCR *jcr,
       break;
 #endif
    }
-   Qmsg2(jcr, M_WARNING, 0,
-      _("Can't restore ACLs of %s - incompatible acl stream encountered - %d\n"),
-      jcr->last_fname, stream);
-   return bacl_exit_error;
+   Qmsg2(jcr, M_WARNING, 0, _("Cannot restore ACLs of %s - incompatible acl stream encountered - %d\n"),
+         jcr->last_fname, stream);
+   return bacl_rtn_error;
 }
 #endif
diff --git a/src/filed/acl.h b/src/filed/acl.h
index bb63529..716a7d5 100644
--- a/src/filed/acl.h
+++ b/src/filed/acl.h
@@ -1,85 +1,66 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2004-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Properties we use for getting and setting ACLs.
  */
 
-#ifndef __ACL_H
-#define __ACL_H
-
-/* For shorter ACL strings when possible, define BACL_WANT_SHORT_ACLS */
-/* #define BACL_WANT_SHORT_ACLS */
+#ifndef __BACL_H_
+#define __BACL_H_
 
-/* For numeric user/group ids when possible, define BACL_WANT_NUMERIC_IDS */
-/* #define BACL_WANT_NUMERIC_IDS */
+/* Global JCR data */
+struct acl_ctx_t  {
+   uint32_t nr_errors;
+   uint32_t flags;              /* See BACL_FLAG_* */
+   uint32_t current_dev;
+   uint32_t content_length;
+   POOLMEM *content;
+};
 
 /*
  * We support the following types of ACLs
  */
 typedef enum {
-   BACL_TYPE_NONE = 0,
-   BACL_TYPE_ACCESS = 1,
-   BACL_TYPE_DEFAULT = 2,
+   BACL_TYPE_NONE        = 0,
+   BACL_TYPE_ACCESS      = 1,
+   BACL_TYPE_DEFAULT     = 2,
    BACL_TYPE_DEFAULT_DIR = 3,
-   BACL_TYPE_EXTENDED = 4,
-   BACL_TYPE_NFS4 = 5
+   BACL_TYPE_EXTENDED    = 4,
+   BACL_TYPE_NFS4        = 5
 } bacl_type;
 
+#define BACL_FLAG_SAVE_NATIVE     0x01
+#define BACL_FLAG_SAVE_AFS        0x02
+#define BACL_FLAG_RESTORE_NATIVE  0x04
+#define BACL_FLAG_RESTORE_AFS     0x08
+
 /*
- * This value is used as ostype when we encounter an invalid acl type.
- * The way the code is build this should never happen.
+ * Ensure we have none
  */
-#if !defined(ACL_TYPE_NONE)
+#ifndef ACL_TYPE_NONE
 #define ACL_TYPE_NONE 0x0
 #endif
+ 
+#ifdef HAVE_IRIX_OS
+#define BACL_ENOTSUP  ENOSYS
+#else
+#define BACL_ENOTSUP  EOPNOTSUPP
+#endif /* HAVE_IRIX_OS */
 
-#if defined(HAVE_FREEBSD_OS) || \
-    defined(HAVE_DARWIN_OS) || \
-    defined(HAVE_HPUX_OS) || \
-    defined(HAVE_LINUX_OS)
-#define BACL_ENOTSUP EOPNOTSUPP
-#elif defined(HAVE_IRIX_OS)
-#define BACL_ENOTSUP ENOSYS
-#endif
-
-#define BACL_FLAG_SAVE_NATIVE    0x01
-#define BACL_FLAG_SAVE_AFS       0x02
-#define BACL_FLAG_RESTORE_NATIVE 0x04
-#define BACL_FLAG_RESTORE_AFS    0x08
-
-struct acl_build_data_t {
-   uint32_t nr_errors;
-   uint32_t content_length;
-   POOLMEM *content;
-};
-
-struct acl_parse_data_t {
-   uint32_t nr_errors;
-};
-
-/*
- * Internal tracking data.
- */
-struct acl_data_t {
-   uint32_t flags;		/* See BACL_FLAG_* */
-   uint32_t current_dev;
-   union {
-      struct acl_build_data_t *build;
-      struct acl_parse_data_t *parse;
-   } u;
-};
-
-#endif
+#endif /* __BACL_H_ */
diff --git a/src/filed/authenticate.c b/src/filed/authenticate.c
index 47184a6..e432e06 100644
--- a/src/filed/authenticate.c
+++ b/src/filed/authenticate.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Authenticate Director who is attempting to connect.
@@ -27,68 +31,21 @@ extern CLIENT *me;                 /* my resource */
 
 const int dbglvl = 50;
 
-/* Version at end of Hello
- *   prior to 10Mar08 no version
- *   1 10Mar08
- *   2 13Mar09 - added the ability to restore from multiple storages
- *   3 03Sep10 - added the restore object command for vss plugin 4.0
- *   4 25Nov10 - added bandwidth command 5.1
- *   5 01Jan14 - added SD Calls Client and api version to status command
- */
-#define FD_VERSION 5
-
-static char hello_sd[]  = "Hello Bacula SD: Start Job %s %d\n";
-
-static char hello_dir[]  = "2000 OK Hello %d\n";
-static char Dir_sorry[] = "2999 Authentication failed.\n";
 static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
 
-/*********************************************************************
- *
+/*
+ * Authenticated the Director
  */
-static bool authenticate(int rcode, BSOCK *bs, JCR* jcr)
+bool authenticate_director(JCR *jcr)
 {
-   POOLMEM *dirname = get_pool_memory(PM_MESSAGE);
-   DIRRES *director = NULL;
+   DIRRES *director = jcr->director;
    int tls_local_need = BNET_TLS_NONE;
    int tls_remote_need = BNET_TLS_NONE;
    int compatible = true;                 /* Want md5 compatible DIR */
    bool auth_success = false;
    alist *verify_list = NULL;
    btimer_t *tid = NULL;
-   int dir_version = 0;
-
-   if (rcode != R_DIRECTOR) {
-      Dmsg1(dbglvl, "I only authenticate directors, not %d\n", rcode);
-      Jmsg1(jcr, M_FATAL, 0, _("I only authenticate directors, not %d\n"), rcode);
-      goto auth_fatal;
-   }
-
-   dirname = check_pool_memory_size(dirname, bs->msglen);
-
-   if (sscanf(bs->msg, "Hello Director %s calling %d", dirname, &dir_version) != 2 &&
-       sscanf(bs->msg, "Hello Director %s calling", dirname) != 1) {
-      char addr[64];
-      char *who = bs->get_peer(addr, sizeof(addr)) ? bs->who() : addr;
-      bs->msg[100] = 0;
-      Dmsg2(dbglvl, "Bad Hello command from Director at %s: %s\n",
-            bs->who(), bs->msg);
-      Jmsg2(jcr, M_FATAL, 0, _("Bad Hello command from Director at %s: %s\n"),
-            who, bs->msg);
-      goto auth_fatal;
-   }
-   unbash_spaces(dirname);
-   foreach_res(director, R_DIRECTOR) {
-      if (strcmp(director->hdr.name, dirname) == 0)
-         break;
-   }
-   if (!director) {
-      char addr[64];
-      char *who = bs->get_peer(addr, sizeof(addr)) ? bs->who() : addr;
-      Jmsg2(jcr, M_FATAL, 0, _("Connection from unknown Director %s at %s rejected.\n"),
-            dirname, who);
-      goto auth_fatal;
-   }
+   BSOCK *dir = jcr->dir_bsock;
 
    if (have_tls) {
       /* TLS Requirement */
@@ -109,28 +66,28 @@ static bool authenticate(int rcode, BSOCK *bs, JCR* jcr)
       }
    }
 
-   tid = start_bsock_timer(bs, AUTH_TIMEOUT);
+   tid = start_bsock_timer(dir, AUTH_TIMEOUT);
    /* Challenge the director */
-   auth_success = cram_md5_challenge(bs, director->password, tls_local_need, compatible);
+   auth_success = cram_md5_challenge(dir, director->password, tls_local_need, compatible);
    if (job_canceled(jcr)) {
       auth_success = false;
       goto auth_fatal;                   /* quick exit */
    }
    if (auth_success) {
-      auth_success = cram_md5_respond(bs, director->password, &tls_remote_need, &compatible);
+      auth_success = cram_md5_respond(dir, director->password, &tls_remote_need, &compatible);
       if (!auth_success) {
           char addr[64];
-          char *who = bs->get_peer(addr, sizeof(addr)) ? bs->who() : addr;
+          char *who = dir->get_peer(addr, sizeof(addr)) ? dir->who() : addr;
           Dmsg1(dbglvl, "cram_get_auth respond failed for Director: %s\n", who);
       }
    } else {
        char addr[64];
-       char *who = bs->get_peer(addr, sizeof(addr)) ? bs->who() : addr;
+       char *who = dir->get_peer(addr, sizeof(addr)) ? dir->who() : addr;
        Dmsg1(dbglvl, "cram_auth challenge failed for Director %s\n", who);
    }
    if (!auth_success) {
        Emsg1(M_FATAL, 0, _("Incorrect password given by Director at %s.\n"),
-             bs->who());
+             dir->who());
        goto auth_fatal;
    }
 
@@ -153,57 +110,39 @@ static bool authenticate(int rcode, BSOCK *bs, JCR* jcr)
 
    if (tls_local_need >= BNET_TLS_OK && tls_remote_need >= BNET_TLS_OK) {
       /* Engage TLS! Full Speed Ahead! */
-      if (!bnet_tls_server(director->tls_ctx, bs, verify_list)) {
+      if (!bnet_tls_server(director->tls_ctx, dir, verify_list)) {
          Jmsg0(jcr, M_FATAL, 0, _("TLS negotiation failed.\n"));
          auth_success = false;
          goto auth_fatal;
       }
       if (director->tls_authenticate) {         /* authentication only? */
-         bs->free_tls();                        /* shutodown tls */
+         dir->free_tls();                        /* shutodown tls */
       }
    }
+   auth_success = true;
 
 auth_fatal:
    if (tid) {
       stop_bsock_timer(tid);
       tid = NULL;
    }
-   free_pool_memory(dirname);
-   jcr->director = director;
-   /* Single thread all failures to avoid DOS */
-   if (!auth_success) {
-      P(mutex);
-      bmicrosleep(6, 0);
-      V(mutex);
+   if (auth_success) {
+      return send_hello_ok(dir);
    }
-   return auth_success;
+   send_sorry(dir);
+   /* Single thread all failures to avoid DOS */
+   P(mutex);
+   bmicrosleep(6, 0);
+   V(mutex);
+   return false;
 }
 
-/*
- * Inititiate the communications with the Director.
- * He has made a connection to our server.
- *
- * Basic tasks done here:
- *   We read Director's initial message and authorize him.
- *
- */
-int authenticate_director(JCR *jcr)
-{
-   BSOCK *dir = jcr->dir_bsock;
-
-   if (!authenticate(R_DIRECTOR, dir, jcr)) {
-      dir->fsend("%s", Dir_sorry);
-      Emsg0(M_FATAL, 0, _("Unable to authenticate Director\n"));
-      return 0;
-   }
-   return dir->fsend(hello_dir, FD_VERSION);
-}
 
 /*
  * First prove our identity to the Storage daemon, then
  * make him prove his identity.
  */
-int authenticate_storagedaemon(JCR *jcr)
+bool authenticate_storagedaemon(JCR *jcr)
 {
    BSOCK *sd = jcr->store_bsock;
    int tls_local_need = BNET_TLS_NONE;
@@ -232,10 +171,6 @@ int authenticate_storagedaemon(JCR *jcr)
       goto auth_fatal;
    }
 
-
-   sd->fsend(hello_sd, jcr->Job, FD_VERSION);
-   Dmsg1(100, "Send to SD: %s\n", sd->msg);
-
    /* Respond to SD challenge */
    Dmsg0(050, "==== respond to SD challenge\n");
    auth_success = cram_md5_respond(sd, jcr->sd_auth_key, &tls_remote_need, &compatible);
@@ -256,7 +191,7 @@ int authenticate_storagedaemon(JCR *jcr)
 
    if (!auth_success) {
       Jmsg(jcr, M_FATAL, 0, _("Authorization key rejected by Storage daemon.\n"
-       "Please see " MANUAL_AUTH_URL " for help.\n"));
+       "For help, please see " MANUAL_AUTH_URL "\n"));
       goto auth_fatal;
    } else {
       Dmsg0(050, "Authorization with SD is OK\n");
@@ -295,7 +230,6 @@ int authenticate_storagedaemon(JCR *jcr)
       goto auth_fatal;
    }
    sscanf(sd->msg, "3000 OK Hello %d", &sd_version);
-
    /* At this point, we have successfully connected */
 
 auth_fatal:
diff --git a/src/filed/backup.c b/src/filed/backup.c
index bd31cc7..31ed90a 100644
--- a/src/filed/backup.c
+++ b/src/filed/backup.c
@@ -1,19 +1,23 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
-/**
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
+ */
+/*
  *  Bacula File Daemon  backup.c  send file attributes and data
  *   to the Storage daemon.
  *
@@ -23,34 +27,30 @@
 
 #include "bacula.h"
 #include "filed.h"
-#include "ch.h"
-
-#ifdef HAVE_DARWIN_OS
-const bool have_darwin_os = true;
-#else
-const bool have_darwin_os = false;
-#endif
+#include "backup.h"
 
-#if defined(HAVE_ACL)
-const bool have_acl = true;
+#ifdef HAVE_LZO
+const bool have_lzo = true;
 #else
-const bool have_acl = false;
+const bool have_lzo = false;
 #endif
 
-#if defined(HAVE_XATTR)
-const bool have_xattr = true;
+#ifdef HAVE_LIBZ
+const bool have_libz = true;
 #else
-const bool have_xattr = false;
+const bool have_libz = false;
 #endif
 
 /* Forward referenced functions */
 int save_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level);
-static int send_data(JCR *jcr, int stream, FF_PKT *ff_pkt, DIGEST *digest, DIGEST *signature_digest);
-bool encode_and_send_attributes(JCR *jcr, FF_PKT *ff_pkt, int &data_stream);
-static bool crypto_session_start(JCR *jcr);
-static void crypto_session_end(JCR *jcr);
-static bool crypto_session_send(JCR *jcr, BSOCK *sd);
+static int send_data(bctx_t &bctx, int stream);
 static void close_vss_backup_session(JCR *jcr);
+#ifdef HAVE_DARWIN_OS
+static bool send_resource_fork(bctx_t &bctx);
+#endif
+static bool setup_compression(bctx_t &bctx);
+static bool do_lzo_compression(bctx_t &bctx);
+static bool do_libz_compression(bctx_t &bctx);
 
 /**
  * Find all the requested files and send them
@@ -108,13 +108,13 @@ bool blast_data_to_storage_daemon(JCR *jcr, char *addr)
     *
     *  For the same reason, lzo compression is initialized here.
     */
-#ifdef HAVE_LZO
-   jcr->compress_buf_size = MAX(jcr->buf_size + (jcr->buf_size / 16) + 67 + (int)sizeof(comp_stream_header), jcr->buf_size + ((jcr->buf_size+999) / 1000) + 30);
-   jcr->compress_buf = get_memory(jcr->compress_buf_size);
-#else
-   jcr->compress_buf_size = jcr->buf_size + ((jcr->buf_size+999) / 1000) + 30;
-   jcr->compress_buf = get_memory(jcr->compress_buf_size);
-#endif
+   if (have_lzo) {
+      jcr->compress_buf_size = MAX(jcr->buf_size + (jcr->buf_size / 16) + 67 + (int)sizeof(comp_stream_header), jcr->buf_size + ((jcr->buf_size+999) / 1000) + 30);
+      jcr->compress_buf = get_memory(jcr->compress_buf_size);
+   } else {
+      jcr->compress_buf_size = jcr->buf_size + ((jcr->buf_size+999) / 1000) + 30;
+      jcr->compress_buf = get_memory(jcr->compress_buf_size);
+   }
 
 #ifdef HAVE_LIBZ
    z_stream *pZlibStream = (z_stream*)malloc(sizeof(z_stream));
@@ -147,30 +147,26 @@ bool blast_data_to_storage_daemon(JCR *jcr, char *addr)
       return false;
    }
 
-   set_find_options((FF_PKT *)jcr->ff, jcr->incremental, jcr->mtime);
+   set_find_options(jcr->ff, jcr->incremental, jcr->mtime);
+   set_find_snapshot_function(jcr->ff, snapshot_convert_path);
 
    /** in accurate mode, we overload the find_one check function */
    if (jcr->accurate) {
       set_find_changed_function((FF_PKT *)jcr->ff, accurate_check_file);
    }
-
    start_heartbeat_monitor(jcr);
 
-   if (have_acl) {
-      jcr->acl_data = (acl_data_t *)malloc(sizeof(acl_data_t));
-      memset(jcr->acl_data, 0, sizeof(acl_data_t));
-      jcr->acl_data->u.build = (acl_build_data_t *)malloc(sizeof(acl_build_data_t));
-      memset(jcr->acl_data->u.build, 0, sizeof(acl_build_data_t));
-      jcr->acl_data->u.build->content = get_pool_memory(PM_MESSAGE);
-   }
+#ifdef HAVE_ACL
+   jcr->acl_ctx = (acl_ctx_t *)malloc(sizeof(acl_ctx_t));
+   memset(jcr->acl_ctx, 0, sizeof(acl_ctx_t));
+   jcr->acl_ctx->content = get_pool_memory(PM_MESSAGE);
+#endif
+#ifdef HAVE_XATTR
+   jcr->xattr_ctx = (xattr_ctx_t *)malloc(sizeof(xattr_ctx_t));
+   memset(jcr->xattr_ctx, 0, sizeof(xattr_ctx_t));
+   jcr->xattr_ctx->content = get_pool_memory(PM_MESSAGE);
+#endif
 
-   if (have_xattr) {
-      jcr->xattr_data = (xattr_data_t *)malloc(sizeof(xattr_data_t));
-      memset(jcr->xattr_data, 0, sizeof(xattr_data_t));
-      jcr->xattr_data->u.build = (xattr_build_data_t *)malloc(sizeof(xattr_build_data_t));
-      memset(jcr->xattr_data->u.build, 0, sizeof(xattr_build_data_t));
-      jcr->xattr_data->u.build->content = get_pool_memory(PM_MESSAGE);
-   }
 
    /** Subroutine save_file() is called for each file */
    if (!find_files(jcr, (FF_PKT *)jcr->ff, save_file, plugin_save)) {
@@ -178,15 +174,20 @@ bool blast_data_to_storage_daemon(JCR *jcr, char *addr)
       jcr->setJobStatus(JS_ErrorTerminated);
    }
 
-   if (have_acl && jcr->acl_data->u.build->nr_errors > 0) {
-      Jmsg(jcr, M_WARNING, 0, _("Encountered %ld acl errors while doing backup\n"),
-           jcr->acl_data->u.build->nr_errors);
-   }
-   if (have_xattr && jcr->xattr_data->u.build->nr_errors > 0) {
-      Jmsg(jcr, M_WARNING, 0, _("Encountered %ld xattr errors while doing backup\n"),
-           jcr->xattr_data->u.build->nr_errors);
-   }
-
+#ifdef HAVE_ACL
+   if (jcr->acl_ctx->nr_errors > 0) {
+      Jmsg(jcr, M_WARNING, 0, _("Had %ld acl errors while doing backup\n"),
+           jcr->acl_ctx->nr_errors);
+   } 
+#endif
+#ifdef HAVE_XATTR
+   if (jcr->xattr_ctx->nr_errors > 0) {
+      Jmsg(jcr, M_WARNING, 0, _("Had %ld xattr errors while doing backup\n"),
+           jcr->xattr_ctx->nr_errors);
+   } 
+#endif
+   /* Delete or keep snapshots */
+   close_snapshot_backup_session(jcr);
    close_vss_backup_session(jcr);
 
    accurate_finish(jcr);              /* send deleted or base file list to SD */
@@ -195,37 +196,34 @@ bool blast_data_to_storage_daemon(JCR *jcr, char *addr)
 
    sd->signal(BNET_EOD);            /* end of sending data */
 
-   if (have_acl && jcr->acl_data) {
-      free_pool_memory(jcr->acl_data->u.build->content);
-      free(jcr->acl_data->u.build);
-      free(jcr->acl_data);
-      jcr->acl_data = NULL;
-   }
-   if (have_xattr && jcr->xattr_data) {
-      free_pool_memory(jcr->xattr_data->u.build->content);
-      free(jcr->xattr_data->u.build);
-      free(jcr->xattr_data);
-      jcr->xattr_data = NULL;
-   }
+
+#ifdef HAVE_ACL
+   if (jcr->acl_ctx) {
+      free_and_null_pool_memory(jcr->acl_ctx->content);
+      bfree_and_null(jcr->acl_ctx);
+   } 
+#endif
+#ifdef HAVE_XATTR
+   if (jcr->xattr_ctx) {
+      free_and_null_pool_memory(jcr->xattr_ctx->content);
+      bfree_and_null(jcr->xattr_ctx);
+   } 
+#endif
    if (jcr->big_buf) {
-      free(jcr->big_buf);
-      jcr->big_buf = NULL;
+      bfree_and_null(jcr->big_buf);
    }
    if (jcr->compress_buf) {
-      free_pool_memory(jcr->compress_buf);
-      jcr->compress_buf = NULL;
+      free_and_null_pool_memory(jcr->compress_buf);
    }
    if (jcr->pZLIB_compress_workset) {
       /* Free the zlib stream */
 #ifdef HAVE_LIBZ
       deflateEnd((z_stream *)jcr->pZLIB_compress_workset);
 #endif
-      free (jcr->pZLIB_compress_workset);
-      jcr->pZLIB_compress_workset = NULL;
+      bfree_and_null(jcr->pZLIB_compress_workset);
    }
    if (jcr->LZO_compress_workset) {
-      free (jcr->LZO_compress_workset);
-      jcr->LZO_compress_workset = NULL;
+      bfree_and_null(jcr->LZO_compress_workset);
    }
 
    crypto_session_end(jcr);
@@ -235,84 +233,6 @@ bool blast_data_to_storage_daemon(JCR *jcr, char *addr)
    return ok;
 }
 
-static bool crypto_session_start(JCR *jcr)
-{
-   crypto_cipher_t cipher = (crypto_cipher_t) me->pki_cipher;
-
-   /**
-    * Create encryption session data and a cached, DER-encoded session data
-    * structure. We use a single session key for each backup, so we'll encode
-    * the session data only once.
-    */
-   if (jcr->crypto.pki_encrypt) {
-      uint32_t size = 0;
-
-      /** Create per-job session encryption context */
-      jcr->crypto.pki_session = crypto_session_new(cipher, jcr->crypto.pki_recipients);
-      if (!jcr->crypto.pki_session) {
-         Jmsg(jcr, M_FATAL, 0, _("Unsupported cipher on this system.\n"));
-         return false;
-      }
-
-      /** Get the session data size */
-      if (!crypto_session_encode(jcr->crypto.pki_session, (uint8_t *)0, &size)) {
-         Jmsg(jcr, M_FATAL, 0, _("An error occurred while encrypting the stream.\n"));
-         return false;
-      }
-
-      /** Allocate buffer */
-      jcr->crypto.pki_session_encoded = get_memory(size);
-
-      /** Encode session data */
-      if (!crypto_session_encode(jcr->crypto.pki_session, (uint8_t *)jcr->crypto.pki_session_encoded, &size)) {
-         Jmsg(jcr, M_FATAL, 0, _("An error occurred while encrypting the stream.\n"));
-         return false;
-      }
-
-      /** ... and store the encoded size */
-      jcr->crypto.pki_session_encoded_size = size;
-
-      /** Allocate the encryption/decryption buffer */
-      jcr->crypto.crypto_buf = get_memory(CRYPTO_CIPHER_MAX_BLOCK_SIZE);
-   }
-   return true;
-}
-
-static void crypto_session_end(JCR *jcr)
-{
-   if (jcr->crypto.crypto_buf) {
-      free_pool_memory(jcr->crypto.crypto_buf);
-      jcr->crypto.crypto_buf = NULL;
-   }
-   if (jcr->crypto.pki_session) {
-      crypto_session_free(jcr->crypto.pki_session);
-   }
-   if (jcr->crypto.pki_session_encoded) {
-      free_pool_memory(jcr->crypto.pki_session_encoded);
-      jcr->crypto.pki_session_encoded = NULL;
-   }
-}
-
-static bool crypto_session_send(JCR *jcr, BSOCK *sd)
-{
-   POOLMEM *msgsave;
-
-   /** Send our header */
-   Dmsg2(100, "Send hdr fi=%ld stream=%d\n", jcr->JobFiles, STREAM_ENCRYPTED_SESSION_DATA);
-   sd->fsend("%ld %d %lld", jcr->JobFiles, STREAM_ENCRYPTED_SESSION_DATA,
-      (int64_t)jcr->ff->statp.st_size);
-   msgsave = sd->msg;
-   sd->msg = jcr->crypto.pki_session_encoded;
-   sd->msglen = jcr->crypto.pki_session_encoded_size;
-   jcr->JobBytes += sd->msglen;
-
-   Dmsg1(100, "Send data len=%d\n", sd->msglen);
-   sd->send();
-   sd->msg = msgsave;
-   sd->signal(BNET_EOD);
-   return true;
-}
-
 
 /**
  * Called here by find() for each file included.
@@ -329,18 +249,19 @@ int save_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level)
    bool do_read = false;
    bool plugin_started = false;
    bool do_plugin_set = false;
-   int stat, data_stream;
+   int stat;
    int rtnstat = 0;
-   DIGEST *digest = NULL;
-   DIGEST *signing_digest = NULL;
-   int digest_stream = STREAM_NONE;
-   SIGNATURE *sig = NULL;
    bool has_file_data = false;
-   struct save_pkt sp;          /* use by option plugin */
+   struct save_pkt sp;          /* used by option plugin */
+   BSOCK *sd = jcr->store_bsock;
+   bctx_t bctx;                  /* backup context */
+
+   memset(&bctx, 0, sizeof(bctx));
+   bctx.sd = sd;
+   bctx.ff_pkt = ff_pkt;
+   bctx.jcr = jcr;
 
-   crypto_digest_t signing_algorithm = (crypto_digest_t) me->pki_digest;
 
-   BSOCK *sd = jcr->store_bsock;
    time_t now = time(NULL);
    if (jcr->last_stat_time == 0) {
       jcr->last_stat_time = now;
@@ -351,8 +272,8 @@ int save_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level)
       jcr->last_stat_time = now;
    }
 
-   if (jcr->is_canceled()) {
-      Dmsg0(100, "Job canceled by user.\n");
+   if (jcr->is_canceled() || jcr->is_incomplete()) {
+      Dmsg0(100, "Job canceled by user or marked incomplete.\n");
       return 0;
    }
 
@@ -471,64 +392,8 @@ int save_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level)
    Dmsg1(130, "bfiled: sending %s to stored\n", ff_pkt->fname);
 
    /** Digests and encryption are only useful if there's file data */
-   if (has_file_data) {
-      /**
-       * Setup for digest handling. If this fails, the digest will be set to NULL
-       * and not used. Note, the digest (file hash) can be any one of the four
-       * algorithms below.
-       *
-       * The signing digest is a single algorithm depending on
-       * whether or not we have SHA2.
-       *   ****FIXME****  the signing algoritm should really be
-       *   determined a different way!!!!!!  What happens if
-       *   sha2 was available during backup but not restore?
-       */
-      if (ff_pkt->flags & FO_MD5) {
-         digest = crypto_digest_new(jcr, CRYPTO_DIGEST_MD5);
-         digest_stream = STREAM_MD5_DIGEST;
-
-      } else if (ff_pkt->flags & FO_SHA1) {
-         digest = crypto_digest_new(jcr, CRYPTO_DIGEST_SHA1);
-         digest_stream = STREAM_SHA1_DIGEST;
-
-      } else if (ff_pkt->flags & FO_SHA256) {
-         digest = crypto_digest_new(jcr, CRYPTO_DIGEST_SHA256);
-         digest_stream = STREAM_SHA256_DIGEST;
-
-      } else if (ff_pkt->flags & FO_SHA512) {
-         digest = crypto_digest_new(jcr, CRYPTO_DIGEST_SHA512);
-         digest_stream = STREAM_SHA512_DIGEST;
-      }
-
-      /** Did digest initialization fail? */
-      if (digest_stream != STREAM_NONE && digest == NULL) {
-         Jmsg(jcr, M_WARNING, 0, _("%s digest initialization failed\n"),
-            stream_to_ascii(digest_stream));
-      }
-
-      /**
-       * Set up signature digest handling. If this fails, the signature digest
-       * will be set to NULL and not used.
-       */
-      /* TODO landonf: We should really only calculate the digest once, for
-       * both verification and signing.
-       */
-      if (jcr->crypto.pki_sign) {
-         signing_digest = crypto_digest_new(jcr, signing_algorithm);
-
-         /** Full-stop if a failure occurred initializing the signature digest */
-         if (signing_digest == NULL) {
-            Jmsg(jcr, M_NOTSAVED, 0, _("%s signature digest initialization failed\n"),
-               stream_to_ascii(signing_algorithm));
-            jcr->JobErrors++;
-            goto good_rtn;
-         }
-      }
-
-      /** Enable encryption */
-      if (jcr->crypto.pki_encrypt) {
-         ff_pkt->flags |= FO_ENCRYPT;
-      }
+   if (has_file_data && !crypto_setup_digests(bctx)) {
+      goto good_rtn;
    }
 
    /** Initialize the file descriptor we use for data and other streams. */
@@ -571,7 +436,7 @@ int save_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level)
    }
 
    /** Send attributes -- must be done after binit() */
-   if (!encode_and_send_attributes(jcr, ff_pkt, data_stream)) {
+   if (!encode_and_send_attributes(bctx)) {
       goto bail_out;
    }
    /** Meta data only for restore object */
@@ -623,6 +488,7 @@ int save_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level)
       int noatime = ff_pkt->flags & FO_NOATIME ? O_NOATIME : 0;
       ff_pkt->bfd.reparse_point = (ff_pkt->type == FT_REPARSE ||
                                    ff_pkt->type == FT_JUNCTION);
+      set_fattrs(&ff_pkt->bfd, &ff_pkt->statp);
       if (bopen(&ff_pkt->bfd, ff_pkt->fname, O_RDONLY | O_BINARY | noatime, 0) < 0) {
          ff_pkt->ff_errno = errno;
          berrno be;
@@ -640,7 +506,7 @@ int save_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level)
          tid = NULL;
       }
 
-      stat = send_data(jcr, data_stream, ff_pkt, digest, signing_digest);
+      stat = send_data(bctx, bctx.data_stream);
 
       if (ff_pkt->flags & FO_CHKCHANGES) {
          has_file_changed(jcr, ff_pkt);
@@ -653,195 +519,42 @@ int save_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level)
       }
    }
 
-   if (have_darwin_os) {
-      /** Regular files can have resource forks and Finder Info */
-      if (ff_pkt->type != FT_LNKSAVED && (S_ISREG(ff_pkt->statp.st_mode) &&
-          ff_pkt->flags & FO_HFSPLUS)) {
-         if (ff_pkt->hfsinfo.rsrclength > 0) {
-            int flags;
-            int rsrc_stream;
-            if (!bopen_rsrc(&ff_pkt->bfd, ff_pkt->fname, O_RDONLY | O_BINARY, 0) < 0) {
-               ff_pkt->ff_errno = errno;
-               berrno be;
-               Jmsg(jcr, M_NOTSAVED, -1, _("     Cannot open resource fork for \"%s\": ERR=%s.\n"),
-                    ff_pkt->fname, be.bstrerror());
-               jcr->JobErrors++;
-               if (is_bopen(&ff_pkt->bfd)) {
-                  bclose(&ff_pkt->bfd);
-               }
-               goto good_rtn;
-            }
-            flags = ff_pkt->flags;
-            ff_pkt->flags &= ~(FO_COMPRESS|FO_SPARSE|FO_OFFSETS);
-            if (flags & FO_ENCRYPT) {
-               rsrc_stream = STREAM_ENCRYPTED_MACOS_FORK_DATA;
-            } else {
-               rsrc_stream = STREAM_MACOS_FORK_DATA;
-            }
-            stat = send_data(jcr, rsrc_stream, ff_pkt, digest, signing_digest);
-            ff_pkt->flags = flags;
-            bclose(&ff_pkt->bfd);
-            if (!stat) {
-               goto bail_out;
-            }
-         }
-
-         Dmsg1(300, "Saving Finder Info for \"%s\"\n", ff_pkt->fname);
-         sd->fsend("%ld %d 0", jcr->JobFiles, STREAM_HFSPLUS_ATTRIBUTES);
-         Dmsg1(300, "bfiled>stored:header %s\n", sd->msg);
-         pm_memcpy(sd->msg, ff_pkt->hfsinfo.fndrinfo, 32);
-         sd->msglen = 32;
-         if (digest) {
-            crypto_digest_update(digest, (uint8_t *)sd->msg, sd->msglen);
-         }
-         if (signing_digest) {
-            crypto_digest_update(signing_digest, (uint8_t *)sd->msg, sd->msglen);
-         }
-         sd->send();
-         sd->signal(BNET_EOD);
-      }
+#ifdef HAVE_DARWIN_OS
+   if (!send_resource_fork(bctx)) {
+      goto bail_out;
    }
+#endif
 
-   /**
+   /*
     * Save ACLs when requested and available for anything not being a symlink
     * and not being a plugin.
     */
-   if (have_acl) {
-      if (ff_pkt->flags & FO_ACL && ff_pkt->type != FT_LNK && !ff_pkt->cmd_plugin) {
-         switch (build_acl_streams(jcr, ff_pkt)) {
-         case bacl_exit_fatal:
-            goto bail_out;
-         case bacl_exit_error:
-            /**
-             * Non-fatal errors, count them and when the number is under
-             * ACL_REPORT_ERR_MAX_PER_JOB print the error message set by the
-             * lower level routine in jcr->errmsg.
-             */
-            if (jcr->acl_data->u.build->nr_errors < ACL_REPORT_ERR_MAX_PER_JOB) {
-               Jmsg(jcr, M_WARNING, 0, "%s", jcr->errmsg);
-            }
-            jcr->acl_data->u.build->nr_errors++;
-            break;
-         case bacl_exit_ok:
-            break;
-         }
-      }
+#ifdef HAVE_ACL
+   if (!backup_acl_streams(jcr, ff_pkt)) {
+      goto bail_out;
    }
+#endif
 
-   /**
+   /*
     * Save Extended Attributes when requested and available for all files not
     * being a plugin.
     */
-   if (have_xattr) {
-      if (ff_pkt->flags & FO_XATTR && !ff_pkt->cmd_plugin) {
-         switch (build_xattr_streams(jcr, ff_pkt)) {
-         case bxattr_exit_fatal:
-            goto bail_out;
-         case bxattr_exit_error:
-            /**
-             * Non-fatal errors, count them and when the number is under
-             * XATTR_REPORT_ERR_MAX_PER_JOB print the error message set by the
-             * lower level routine in jcr->errmsg.
-             */
-            if (jcr->xattr_data->u.build->nr_errors < XATTR_REPORT_ERR_MAX_PER_JOB) {
-               Jmsg(jcr, M_WARNING, 0, "%s", jcr->errmsg);
-            }
-            jcr->xattr_data->u.build->nr_errors++;
-            break;
-         case bxattr_exit_ok:
-            break;
-         }
-      }
-   }
-
-   /** Terminate the signing digest and send it to the Storage daemon */
-   if (signing_digest) {
-      uint32_t size = 0;
-
-      if ((sig = crypto_sign_new(jcr)) == NULL) {
-         Jmsg(jcr, M_FATAL, 0, _("Failed to allocate memory for crypto signature.\n"));
-         goto bail_out;
-      }
-
-      if (!crypto_sign_add_signer(sig, signing_digest, jcr->crypto.pki_keypair)) {
-         Jmsg(jcr, M_FATAL, 0, _("An error occurred while adding signer the stream.\n"));
-         goto bail_out;
-      }
-
-      /** Get signature size */
-      if (!crypto_sign_encode(sig, NULL, &size)) {
-         Jmsg(jcr, M_FATAL, 0, _("An error occurred while signing the stream.\n"));
-         goto bail_out;
-      }
-
-      /** Grow the bsock buffer to fit our message if necessary */
-      if (sizeof_pool_memory(sd->msg) < (int32_t)size) {
-         sd->msg = realloc_pool_memory(sd->msg, size);
-      }
-
-      /** Send our header */
-      sd->fsend("%ld %ld 0", jcr->JobFiles, STREAM_SIGNED_DIGEST);
-      Dmsg1(300, "bfiled>stored:header %s\n", sd->msg);
-
-      /** Encode signature data */
-      if (!crypto_sign_encode(sig, (uint8_t *)sd->msg, &size)) {
-         Jmsg(jcr, M_FATAL, 0, _("An error occurred while signing the stream.\n"));
-         goto bail_out;
-      }
-
-      sd->msglen = size;
-      sd->send();
-      sd->signal(BNET_EOD);              /* end of checksum */
-   }
-
-   /** Terminate any digest and send it to Storage daemon */
-   if (digest) {
-      uint32_t size;
-
-      sd->fsend("%ld %d 0", jcr->JobFiles, digest_stream);
-      Dmsg1(300, "bfiled>stored:header %s\n", sd->msg);
-
-      size = CRYPTO_DIGEST_MAX_SIZE;
-
-      /** Grow the bsock buffer to fit our message if necessary */
-      if (sizeof_pool_memory(sd->msg) < (int32_t)size) {
-         sd->msg = realloc_pool_memory(sd->msg, size);
-      }
-
-      if (!crypto_digest_finalize(digest, (uint8_t *)sd->msg, &size)) {
-         Jmsg(jcr, M_FATAL, 0, _("An error occurred finalizing signing the stream.\n"));
-         goto bail_out;
-      }
-
-      /* Keep the checksum if this file is a hardlink */
-      if (ff_pkt->linked) {
-         ff_pkt_set_link_digest(ff_pkt, digest_stream, sd->msg, size);
-      }
-
-      sd->msglen = size;
-      sd->send();
-      sd->signal(BNET_EOD);              /* end of checksum */
+#ifdef HAVE_XATTR
+   if (!backup_xattr_streams(jcr, ff_pkt)) {
+      goto bail_out;
    }
+#endif
 
-   /* Check if original file has a digest, and send it */
-   if (ff_pkt->type == FT_LNKSAVED && ff_pkt->digest) {
-      Dmsg2(300, "Link %s digest %d\n", ff_pkt->fname, ff_pkt->digest_len);
-      sd->fsend("%ld %d 0", jcr->JobFiles, ff_pkt->digest_stream);
-
-      sd->msg = check_pool_memory_size(sd->msg, ff_pkt->digest_len);
-      memcpy(sd->msg, ff_pkt->digest, ff_pkt->digest_len);
-      sd->msglen = ff_pkt->digest_len;
-      sd->send();
-
-      sd->signal(BNET_EOD);              /* end of hardlink record */
+   if (!crypto_terminate_digests(bctx)) {
+      goto bail_out;
    }
 
 good_rtn:
    rtnstat = 1;
 
 bail_out:
-   if (jcr->is_canceled()) {
-      Dmsg0(100, "Job canceled by user.\n");
+   if (jcr->is_incomplete() || jcr->is_canceled()) {
+      Dmsg0(100, "Job canceled by user or marked incomplete.\n");
       rtnstat = 0;
    }
    if (plugin_started) {
@@ -853,22 +566,14 @@ bail_out:
       jcr->plugin = NULL;
       jcr->opt_plugin = false;
    }
-   if (digest) {
-      crypto_digest_free(digest);
-   }
-   if (signing_digest) {
-      crypto_digest_free(signing_digest);
-   }
-   if (sig) {
-      crypto_sign_free(sig);
-   }
+   crypto_free(bctx);
    return rtnstat;
 }
 
 /**
  * Send data read from an already open file descriptor.
  *
- * We return 1 on sucess and 0 on errors.
+ * We return 1 on success and 0 on errors.
  *
  * ***FIXME***
  * We use ff_pkt->statp.st_size when FO_SPARSE to know when to stop
@@ -876,118 +581,31 @@ bail_out:
  * Currently this is not a problem as the only other stream, resource forks,
  * are not handled as sparse files.
  */
-static int send_data(JCR *jcr, int stream, FF_PKT *ff_pkt, DIGEST *digest,
-                     DIGEST *signing_digest)
+static int send_data(bctx_t &bctx, int stream)
 {
+   JCR *jcr = bctx.jcr;
    BSOCK *sd = jcr->store_bsock;
-   uint64_t fileAddr = 0;             /* file address */
-   char *rbuf, *wbuf;
-   int32_t rsize = jcr->buf_size;      /* read buffer size */
-   POOLMEM *msgsave;
-   CIPHER_CONTEXT *cipher_ctx = NULL; /* Quell bogus uninitialized warnings */
-   const uint8_t *cipher_input;
-   uint32_t cipher_input_len;
-   uint32_t cipher_block_size;
-   uint32_t encrypted_len;
+
 #ifdef FD_NO_SEND_TEST
    return 1;
 #endif
 
-   msgsave = sd->msg;
-   rbuf = sd->msg;                    /* read buffer */
-   wbuf = sd->msg;                    /* write buffer */
-   cipher_input = (uint8_t *)rbuf;    /* encrypt uncompressed data */
-
-   Dmsg1(300, "Saving data, type=%d\n", ff_pkt->type);
-
-#if defined(HAVE_LIBZ) || defined(HAVE_LZO)
-   uLong compress_len = 0;
-   uLong max_compress_len = 0;
-   const Bytef *cbuf = NULL;
- #ifdef HAVE_LIBZ
-   int zstat;
-
-   if ((ff_pkt->flags & FO_COMPRESS) && ff_pkt->Compress_algo == COMPRESS_GZIP) {
-      if ((ff_pkt->flags & FO_SPARSE) || (ff_pkt->flags & FO_OFFSETS)) {
-         cbuf = (Bytef *)jcr->compress_buf + OFFSET_FADDR_SIZE;
-         max_compress_len = jcr->compress_buf_size - OFFSET_FADDR_SIZE;
-      } else {
-         cbuf = (Bytef *)jcr->compress_buf;
-         max_compress_len = jcr->compress_buf_size; /* set max length */
-      }
-      wbuf = jcr->compress_buf;    /* compressed output here */
-      cipher_input = (uint8_t *)jcr->compress_buf; /* encrypt compressed data */
-
-      /**
-       * Only change zlib parameters if there is no pending operation.
-       * This should never happen as deflatereset is called after each
-       * deflate.
-       */
-
-      if (((z_stream*)jcr->pZLIB_compress_workset)->total_in == 0) {
-         /** set gzip compression level - must be done per file */
-         if ((zstat=deflateParams((z_stream*)jcr->pZLIB_compress_workset,
-              ff_pkt->Compress_level, Z_DEFAULT_STRATEGY)) != Z_OK) {
-            Jmsg(jcr, M_FATAL, 0, _("Compression deflateParams error: %d\n"), zstat);
-            jcr->setJobStatus(JS_ErrorTerminated);
-            goto err;
-         }
-      }
-   }
- #endif
- #ifdef HAVE_LZO
-   Bytef *cbuf2;
-   int lzores;
-   comp_stream_header ch;
+   bctx.rsize = jcr->buf_size;
+   bctx.fileAddr = 0;
+   bctx.cipher_ctx = NULL;
+   bctx.msgsave = sd->msg;
+   bctx.rbuf = sd->msg;                    /* read buffer */
+   bctx.wbuf = sd->msg;                    /* write buffer */
+   bctx.cipher_input = (uint8_t *)bctx.rbuf;    /* encrypt uncompressed data */
 
-   memset(&ch, 0, sizeof(comp_stream_header));
-   cbuf2 = NULL;
+   Dmsg1(300, "Saving data, type=%d\n", bctx.ff_pkt->type);
 
-   if ((ff_pkt->flags & FO_COMPRESS) && ff_pkt->Compress_algo == COMPRESS_LZO1X) {
-      if ((ff_pkt->flags & FO_SPARSE) || (ff_pkt->flags & FO_OFFSETS)) {
-         cbuf = (Bytef *)jcr->compress_buf + OFFSET_FADDR_SIZE;
-         cbuf2 = (Bytef *)jcr->compress_buf + OFFSET_FADDR_SIZE + sizeof(comp_stream_header);
-         max_compress_len = jcr->compress_buf_size - OFFSET_FADDR_SIZE;
-      } else {
-         cbuf = (Bytef *)jcr->compress_buf;
-         cbuf2 = (Bytef *)jcr->compress_buf + sizeof(comp_stream_header);
-         max_compress_len = jcr->compress_buf_size; /* set max length */
-      }
-      ch.magic = COMPRESS_LZO1X;
-      ch.version = COMP_HEAD_VERSION;
-      wbuf = jcr->compress_buf;    /* compressed output here */
-      cipher_input = (uint8_t *)jcr->compress_buf; /* encrypt compressed data */
+   if (!setup_compression(bctx)) {
+      goto err;
    }
- #endif
-#else
-   const uint32_t max_compress_len = 0;
-#endif
-
-   if (ff_pkt->flags & FO_ENCRYPT) {
-      if ((ff_pkt->flags & FO_SPARSE) || (ff_pkt->flags & FO_OFFSETS)) {
-         Jmsg0(jcr, M_FATAL, 0, _("Encrypting sparse or offset data not supported.\n"));
-         goto err;
-      }
-      /** Allocate the cipher context */
-      if ((cipher_ctx = crypto_cipher_new(jcr->crypto.pki_session, true,
-           &cipher_block_size)) == NULL) {
-         /* Shouldn't happen! */
-         Jmsg0(jcr, M_FATAL, 0, _("Failed to initialize encryption context.\n"));
-         goto err;
-      }
-
-      /**
-       * Grow the crypto buffer, if necessary.
-       * crypto_cipher_update() will buffer up to (cipher_block_size - 1).
-       * We grow crypto_buf to the maximum number of blocks that
-       * could be returned for the given read buffer size.
-       * (Using the larger of either rsize or max_compress_len)
-       */
-      jcr->crypto.crypto_buf = check_pool_memory_size(jcr->crypto.crypto_buf,
-           (MAX(rsize + (int)sizeof(uint32_t), (int32_t)max_compress_len) +
-            cipher_block_size - 1) / cipher_block_size * cipher_block_size);
 
-      wbuf = jcr->crypto.crypto_buf; /* Encrypted, possibly compressed output here. */
+   if (bctx.ff_pkt->flags & FO_ENCRYPT && !crypto_allocate_ctx(bctx)) {
+      return false;
    }
 
    /**
@@ -995,7 +613,7 @@ static int send_data(JCR *jcr, int stream, FF_PKT *ff_pkt, DIGEST *digest,
     *    <file-index> <stream> <expected stream length>
     */
    if (!sd->fsend("%ld %d %lld", jcr->JobFiles, stream,
-        (int64_t)ff_pkt->statp.st_size)) {
+        (int64_t)bctx.ff_pkt->statp.st_size)) {
       if (!jcr->is_job_canceled()) {
          Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"),
                sd->bstrerror());
@@ -1008,229 +626,74 @@ static int send_data(JCR *jcr, int stream, FF_PKT *ff_pkt, DIGEST *digest,
     * Make space at beginning of buffer for fileAddr because this
     *   same buffer will be used for writing if compression is off.
     */
-   if ((ff_pkt->flags & FO_SPARSE) || (ff_pkt->flags & FO_OFFSETS)) {
-      rbuf += OFFSET_FADDR_SIZE;
-      rsize -= OFFSET_FADDR_SIZE;
+   if ((bctx.ff_pkt->flags & FO_SPARSE) || (bctx.ff_pkt->flags & FO_OFFSETS)) {
+      bctx.rbuf += OFFSET_FADDR_SIZE;
+      bctx.rsize -= OFFSET_FADDR_SIZE;
 #ifdef HAVE_FREEBSD_OS
       /**
        * To read FreeBSD partitions, the read size must be
        *  a multiple of 512.
        */
-      rsize = (rsize/512) * 512;
+      bctx.rsize = (bctx.rsize/512) * 512;
 #endif
    }
 
    /** a RAW device read on win32 only works if the buffer is a multiple of 512 */
 #ifdef HAVE_WIN32
-   if (S_ISBLK(ff_pkt->statp.st_mode))
-      rsize = (rsize/512) * 512;
-#endif
-
-   /**
-    * Read the file data
-    */
-   while ((sd->msglen=(uint32_t)bread(&ff_pkt->bfd, rbuf, rsize)) > 0) {
-
-      /** Check for sparse blocks */
-      if (ff_pkt->flags & FO_SPARSE) {
-         ser_declare;
-         bool allZeros = false;
-         if ((sd->msglen == rsize &&
-              fileAddr+sd->msglen < (uint64_t)ff_pkt->statp.st_size) ||
-             ((ff_pkt->type == FT_RAW || ff_pkt->type == FT_FIFO) &&
-               (uint64_t)ff_pkt->statp.st_size == 0)) {
-            allZeros = is_buf_zero(rbuf, rsize);
-         }
-         if (!allZeros) {
-            /** Put file address as first data in buffer */
-            ser_begin(wbuf, OFFSET_FADDR_SIZE);
-            ser_uint64(fileAddr);     /* store fileAddr in begin of buffer */
-         }
-         fileAddr += sd->msglen;      /* update file address */
-         /** Skip block of all zeros */
-         if (allZeros) {
-            continue;                 /* skip block of zeros */
-         }
-      } else if (ff_pkt->flags & FO_OFFSETS) {
-         ser_declare;
-         ser_begin(wbuf, OFFSET_FADDR_SIZE);
-         ser_uint64(ff_pkt->bfd.offset);     /* store offset in begin of buffer */
-      }
-
-      jcr->ReadBytes += sd->msglen;         /* count bytes read */
-
-      /** Uncompressed cipher input length */
-      cipher_input_len = sd->msglen;
-
-      /** Update checksum if requested */
-      if (digest) {
-         crypto_digest_update(digest, (uint8_t *)rbuf, sd->msglen);
-      }
-
-      /** Update signing digest if requested */
-      if (signing_digest) {
-         crypto_digest_update(signing_digest, (uint8_t *)rbuf, sd->msglen);
-      }
-
-#ifdef HAVE_LIBZ
-      /** Do compression if turned on */
-      if (ff_pkt->flags & FO_COMPRESS && ff_pkt->Compress_algo == COMPRESS_GZIP && jcr->pZLIB_compress_workset) {
-         Dmsg3(400, "cbuf=0x%x rbuf=0x%x len=%u\n", cbuf, rbuf, sd->msglen);
-
-         ((z_stream*)jcr->pZLIB_compress_workset)->next_in   = (Bytef *)rbuf;
-                ((z_stream*)jcr->pZLIB_compress_workset)->avail_in  = sd->msglen;
-         ((z_stream*)jcr->pZLIB_compress_workset)->next_out  = (Bytef *)cbuf;
-                ((z_stream*)jcr->pZLIB_compress_workset)->avail_out = max_compress_len;
-
-         if ((zstat=deflate((z_stream*)jcr->pZLIB_compress_workset, Z_FINISH)) != Z_STREAM_END) {
-            Jmsg(jcr, M_FATAL, 0, _("Compression deflate error: %d\n"), zstat);
-            jcr->setJobStatus(JS_ErrorTerminated);
-            goto err;
-         }
-         compress_len = ((z_stream*)jcr->pZLIB_compress_workset)->total_out;
-         /** reset zlib stream to be able to begin from scratch again */
-         if ((zstat=deflateReset((z_stream*)jcr->pZLIB_compress_workset)) != Z_OK) {
-            Jmsg(jcr, M_FATAL, 0, _("Compression deflateReset error: %d\n"), zstat);
-            jcr->setJobStatus(JS_ErrorTerminated);
-            goto err;
-         }
-
-         Dmsg2(400, "GZIP compressed len=%d uncompressed len=%d\n", compress_len,
-               sd->msglen);
-
-         sd->msglen = compress_len;      /* set compressed length */
-         cipher_input_len = compress_len;
+   if (S_ISBLK(bctx.ff_pkt->statp.st_mode)) {
+      bctx.rsize = (bctx.rsize/512) * 512;
+   }
+   Dmsg1(200, "Fattrs=0X%x\n", bctx.ff_pkt->bfd.fattrs);
+   if (bctx.ff_pkt->bfd.fattrs & FILE_ATTRIBUTE_ENCRYPTED) {
+      if (!p_ReadEncryptedFileRaw) {
+         Jmsg0(bctx.jcr, M_FATAL, 0, _("Windows Encrypted data not supported on this OS.\n"));
+         goto err;
       }
-#endif
-#ifdef HAVE_LZO
-      /** Do compression if turned on */
-      if (ff_pkt->flags & FO_COMPRESS && ff_pkt->Compress_algo == COMPRESS_LZO1X && jcr->LZO_compress_workset) {
-         lzo_uint len;          /* TODO: See with the latest patch how to handle lzo_uint with 64bit */
-
-         ser_declare;
-         ser_begin(cbuf, sizeof(comp_stream_header));
-
-         Dmsg3(400, "cbuf=0x%x rbuf=0x%x len=%u\n", cbuf, rbuf, sd->msglen);
-
-         lzores = lzo1x_1_compress((const unsigned char*)rbuf, sd->msglen, cbuf2,
-                                   &len, jcr->LZO_compress_workset);
-         compress_len = len;
-         if (lzores == LZO_E_OK && compress_len <= max_compress_len) {
-            /* complete header */
-            ser_uint32(COMPRESS_LZO1X);
-            ser_uint32(compress_len);
-            ser_uint16(ch.level);
-            ser_uint16(ch.version);
-         } else {
-            /** this should NEVER happen */
-            Jmsg(jcr, M_FATAL, 0, _("Compression LZO error: %d\n"), lzores);
-            jcr->setJobStatus(JS_ErrorTerminated);
-            goto err;
-         }
-
-         Dmsg2(400, "LZO compressed len=%d uncompressed len=%d\n", compress_len,
-               sd->msglen);
-
-         compress_len += sizeof(comp_stream_header); /* add size of header */
-         sd->msglen = compress_len;      /* set compressed length */
-         cipher_input_len = compress_len;
+      /* This single call reads all EFS data delivers it to a callback */
+      if (p_ReadEncryptedFileRaw((PFE_EXPORT_FUNC)read_efs_data_cb, &bctx,
+            bctx.ff_pkt->bfd.pvContext) != 0) {
+         goto err;
       }
+      /* All read, so skip to finish sending */
+      goto finish_sending;
+   }
+   /* Fall through to standard bread() loop */
 #endif
 
-      /**
-       * Note, here we prepend the current record length to the beginning
-       *  of the encrypted data. This is because both sparse and compression
-       *  restore handling want records returned to them with exactly the
-       *  same number of bytes that were processed in the backup handling.
-       *  That is, both are block filters rather than a stream.  When doing
-       *  compression, the compression routines may buffer data, so that for
-       *  any one record compressed, when it is decompressed the same size
-       *  will not be obtained. Of course, the buffered data eventually comes
-       *  out in subsequent crypto_cipher_update() calls or at least
-       *  when crypto_cipher_finalize() is called.  Unfortunately, this
-       *  "feature" of encryption enormously complicates the restore code.
-       */
-      if (ff_pkt->flags & FO_ENCRYPT) {
-         uint32_t initial_len = 0;
-         ser_declare;
-
-         if ((ff_pkt->flags & FO_SPARSE) || (ff_pkt->flags & FO_OFFSETS)) {
-            cipher_input_len += OFFSET_FADDR_SIZE;
-         }
-
-         /** Encrypt the length of the input block */
-         uint8_t packet_len[sizeof(uint32_t)];
-
-         ser_begin(packet_len, sizeof(uint32_t));
-         ser_uint32(cipher_input_len);    /* store data len in begin of buffer */
-         Dmsg1(20, "Encrypt len=%d\n", cipher_input_len);
-
-         if (!crypto_cipher_update(cipher_ctx, packet_len, sizeof(packet_len),
-             (uint8_t *)jcr->crypto.crypto_buf, &initial_len)) {
-            /** Encryption failed. Shouldn't happen. */
-            Jmsg(jcr, M_FATAL, 0, _("Encryption error\n"));
-            goto err;
-         }
-
-         /** Encrypt the input block */
-         if (crypto_cipher_update(cipher_ctx, cipher_input, cipher_input_len,
-             (uint8_t *)&jcr->crypto.crypto_buf[initial_len], &encrypted_len)) {
-            if ((initial_len + encrypted_len) == 0) {
-               /** No full block of data available, read more data */
-               continue;
-            }
-            Dmsg2(400, "encrypted len=%d unencrypted len=%d\n", encrypted_len,
-                  sd->msglen);
-            sd->msglen = initial_len + encrypted_len; /* set encrypted length */
-         } else {
-            /** Encryption failed. Shouldn't happen. */
-            Jmsg(jcr, M_FATAL, 0, _("Encryption error\n"));
-            goto err;
-         }
-      }
-
-      /* Send the buffer to the Storage daemon */
-      if ((ff_pkt->flags & FO_SPARSE) || (ff_pkt->flags & FO_OFFSETS)) {
-         sd->msglen += OFFSET_FADDR_SIZE; /* include fileAddr in size */
-      }
-      sd->msg = wbuf;              /* set correct write buffer */
-      if (!sd->send()) {
-         if (!jcr->is_job_canceled()) {
-            Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"),
-                  sd->bstrerror());
-         }
+   /*
+    * Normal read the file data in a loop and send it to SD
+    */
+   while ((sd->msglen=(uint32_t)bread(&bctx.ff_pkt->bfd, bctx.rbuf, bctx.rsize)) > 0) {
+      if (!process_and_send_data(bctx)) {
          goto err;
       }
-      Dmsg1(130, "Send data to SD len=%d\n", sd->msglen);
-      /*          #endif */
-      jcr->JobBytes += sd->msglen;      /* count bytes saved possibly compressed/encrypted */
-      sd->msg = msgsave;                /* restore read buffer */
-
    } /* end while read file data */
+   goto finish_sending;
 
+finish_sending:
    if (sd->msglen < 0) {                 /* error */
       berrno be;
       Jmsg(jcr, M_ERROR, 0, _("Read error on file %s. ERR=%s\n"),
-         ff_pkt->fname, be.bstrerror(ff_pkt->bfd.berrno));
+         bctx.ff_pkt->fname, be.bstrerror(bctx.ff_pkt->bfd.berrno));
       if (jcr->JobErrors++ > 1000) {       /* insanity check */
          Jmsg(jcr, M_FATAL, 0, _("Too many errors. JobErrors=%d.\n"), jcr->JobErrors);
       }
-   } else if (ff_pkt->flags & FO_ENCRYPT) {
+   } else if (bctx.ff_pkt->flags & FO_ENCRYPT) {
       /**
        * For encryption, we must call finalize to push out any
        *  buffered data.
        */
-      if (!crypto_cipher_finalize(cipher_ctx, (uint8_t *)jcr->crypto.crypto_buf,
-           &encrypted_len)) {
+      if (!crypto_cipher_finalize(bctx.cipher_ctx, (uint8_t *)jcr->crypto.crypto_buf,
+           &bctx.encrypted_len)) {
          /* Padding failed. Shouldn't happen. */
          Jmsg(jcr, M_FATAL, 0, _("Encryption padding error\n"));
          goto err;
       }
 
       /** Note, on SSL pre-0.9.7, there is always some output */
-      if (encrypted_len > 0) {
-         sd->msglen = encrypted_len;      /* set encrypted length */
-         sd->msg = jcr->crypto.crypto_buf;       /* set correct write buffer */
+      if (bctx.encrypted_len > 0) {
+         sd->msglen = bctx.encrypted_len;     /* set encrypted length */
+         sd->msg = jcr->crypto.crypto_buf;    /* set correct write buffer */
          if (!sd->send()) {
             if (!jcr->is_job_canceled()) {
                Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"),
@@ -1240,10 +703,11 @@ static int send_data(JCR *jcr, int stream, FF_PKT *ff_pkt, DIGEST *digest,
          }
          Dmsg1(130, "Send data to SD len=%d\n", sd->msglen);
          jcr->JobBytes += sd->msglen;     /* count bytes saved possibly compressed/encrypted */
-         sd->msg = msgsave;               /* restore bnet buffer */
+         sd->msg = bctx.msgsave;          /* restore bnet buffer */
       }
    }
 
+
    if (!sd->signal(BNET_EOD)) {        /* indicate end of file data */
       if (!jcr->is_job_canceled()) {
          Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"),
@@ -1253,25 +717,160 @@ static int send_data(JCR *jcr, int stream, FF_PKT *ff_pkt, DIGEST *digest,
    }
 
    /** Free the cipher context */
-   if (cipher_ctx) {
-      crypto_cipher_free(cipher_ctx);
+   if (bctx.cipher_ctx) {
+      crypto_cipher_free(bctx.cipher_ctx);
    }
    return 1;
 
 err:
    /** Free the cipher context */
-   if (cipher_ctx) {
-      crypto_cipher_free(cipher_ctx);
+   if (bctx.cipher_ctx) {
+      crypto_cipher_free(bctx.cipher_ctx);
    }
 
-   sd->msg = msgsave; /* restore bnet buffer */
+   sd->msg = bctx.msgsave; /* restore bnet buffer */
    sd->msglen = 0;
    return 0;
 }
 
-bool encode_and_send_attributes(JCR *jcr, FF_PKT *ff_pkt, int &data_stream)
+
+/*
+ * Apply processing (sparse, compression, encryption, and
+ *   send to the SD.
+ */
+bool process_and_send_data(bctx_t &bctx)
 {
-   BSOCK *sd = jcr->store_bsock;
+   BSOCK *sd = bctx.sd;
+   JCR *jcr = bctx.jcr;
+
+   /** Check for sparse blocks */
+   if (bctx.ff_pkt->flags & FO_SPARSE) {
+      ser_declare;
+      bool allZeros = false;
+      if ((sd->msglen == bctx.rsize &&
+           bctx.fileAddr+sd->msglen < (uint64_t)bctx.ff_pkt->statp.st_size) ||
+          ((bctx.ff_pkt->type == FT_RAW || bctx.ff_pkt->type == FT_FIFO) &&
+            (uint64_t)bctx.ff_pkt->statp.st_size == 0)) {
+         allZeros = is_buf_zero(bctx.rbuf, bctx.rsize);
+      }
+      if (!allZeros) {
+         /** Put file address as first data in buffer */
+         ser_begin(bctx.wbuf, OFFSET_FADDR_SIZE);
+         ser_uint64(bctx.fileAddr);     /* store fileAddr in begin of buffer */
+      }
+      bctx.fileAddr += sd->msglen;      /* update file address */
+      /** Skip block of all zeros */
+      if (allZeros) {
+         return true;                 /* skip block of zeros */
+      }
+   } else if (bctx.ff_pkt->flags & FO_OFFSETS) {
+      ser_declare;
+      ser_begin(bctx.wbuf, OFFSET_FADDR_SIZE);
+      ser_uint64(bctx.ff_pkt->bfd.offset);     /* store offset in begin of buffer */
+   }
+
+   jcr->ReadBytes += sd->msglen;         /* count bytes read */
+
+   /** Uncompressed cipher input length */
+   bctx.cipher_input_len = sd->msglen;
+
+   /** Update checksum if requested */
+   if (bctx.digest) {
+      crypto_digest_update(bctx.digest, (uint8_t *)bctx.rbuf, sd->msglen);
+   }
+
+   /** Update signing digest if requested */
+   if (bctx.signing_digest) {
+      crypto_digest_update(bctx.signing_digest, (uint8_t *)bctx.rbuf, sd->msglen);
+   }
+
+   if (have_libz && !do_libz_compression(bctx)) {
+      goto err;
+   }
+
+   if (have_lzo && !do_lzo_compression(bctx)) {
+      goto err;
+   }
+
+   /**
+    * Note, here we prepend the current record length to the beginning
+    *  of the encrypted data. This is because both sparse and compression
+    *  restore handling want records returned to them with exactly the
+    *  same number of bytes that were processed in the backup handling.
+    *  That is, both are block filters rather than a stream.  When doing
+    *  compression, the compression routines may buffer data, so that for
+    *  any one record compressed, when it is decompressed the same size
+    *  will not be obtained. Of course, the buffered data eventually comes
+    *  out in subsequent crypto_cipher_update() calls or at least
+    *  when crypto_cipher_finalize() is called.  Unfortunately, this
+    *  "feature" of encryption enormously complicates the restore code.
+    */
+   if (bctx.ff_pkt->flags & FO_ENCRYPT) {
+      uint32_t initial_len = 0;
+      ser_declare;
+
+      if ((bctx.ff_pkt->flags & FO_SPARSE) || (bctx.ff_pkt->flags & FO_OFFSETS)) {
+         bctx.cipher_input_len += OFFSET_FADDR_SIZE;
+      }
+
+      /** Encrypt the length of the input block */
+      uint8_t packet_len[sizeof(uint32_t)];
+
+      ser_begin(packet_len, sizeof(uint32_t));
+      ser_uint32(bctx.cipher_input_len);    /* store data len in begin of buffer */
+      Dmsg1(20, "Encrypt len=%d\n", bctx.cipher_input_len);
+
+      if (!crypto_cipher_update(bctx.cipher_ctx, packet_len, sizeof(packet_len),
+          (uint8_t *)jcr->crypto.crypto_buf, &initial_len)) {
+         /** Encryption failed. Shouldn't happen. */
+         Jmsg(jcr, M_FATAL, 0, _("Encryption error\n"));
+         goto err;
+      }
+
+      /** Encrypt the input block */
+      if (crypto_cipher_update(bctx.cipher_ctx, bctx.cipher_input, bctx.cipher_input_len,
+          (uint8_t *)&jcr->crypto.crypto_buf[initial_len], &bctx.encrypted_len)) {
+         if ((initial_len + bctx.encrypted_len) == 0) {
+            /** No full block of data available, read more data */
+            return true;
+         }
+         Dmsg2(400, "encrypted len=%d unencrypted len=%d\n", bctx.encrypted_len,
+               sd->msglen);
+         sd->msglen = initial_len + bctx.encrypted_len; /* set encrypted length */
+      } else {
+         /** Encryption failed. Shouldn't happen. */
+         Jmsg(jcr, M_FATAL, 0, _("Encryption error\n"));
+         goto err;
+      }
+   }
+
+   /* Send the buffer to the Storage daemon */
+   if ((bctx.ff_pkt->flags & FO_SPARSE) || (bctx.ff_pkt->flags & FO_OFFSETS)) {
+      sd->msglen += OFFSET_FADDR_SIZE; /* include fileAddr in size */
+   }
+   sd->msg = bctx.wbuf;              /* set correct write buffer */
+   if (!sd->send()) {
+      if (!jcr->is_job_canceled()) {
+         Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"),
+               sd->bstrerror());
+      }
+      goto err;
+   }
+   Dmsg1(130, "Send data to SD len=%d\n", sd->msglen);
+   /*          #endif */
+   jcr->JobBytes += sd->msglen;      /* count bytes saved possibly compressed/encrypted */
+   sd->msg = bctx.msgsave;                /* restore read buffer */
+   return true;
+
+err:
+   return false;
+}
+
+bool encode_and_send_attributes(bctx_t &bctx)
+{
+   BSOCK *sd = bctx.jcr->store_bsock;
+   JCR *jcr = bctx.jcr;
+   FF_PKT *ff_pkt = bctx.ff_pkt;
    char attribs[MAXSTRING];
    char attribsExBuf[MAXSTRING];
    char *attribsEx = NULL;
@@ -1279,18 +878,19 @@ bool encode_and_send_attributes(JCR *jcr, FF_PKT *ff_pkt, int &data_stream)
    int comp_len;
    bool stat;
    int hangup = get_hangup();
+   int blowup = get_blowup();
 #ifdef FD_NO_SEND_TEST
    return true;
 #endif
 
    Dmsg1(300, "encode_and_send_attrs fname=%s\n", ff_pkt->fname);
    /** Find what data stream we will use, then encode the attributes */
-   if ((data_stream = select_data_stream(ff_pkt)) == STREAM_NONE) {
+   if ((bctx.data_stream = select_data_stream(ff_pkt)) == STREAM_NONE) {
       /* This should not happen */
       Jmsg0(jcr, M_FATAL, 0, _("Invalid file flags, no supported data stream type.\n"));
       return false;
    }
-   encode_stat(attribs, &ff_pkt->statp, sizeof(ff_pkt->statp), ff_pkt->LinkFI, data_stream);
+   encode_stat(attribs, &ff_pkt->statp, sizeof(ff_pkt->statp), ff_pkt->LinkFI, bctx.data_stream);
 
    /** Now possibly extend the attributes */
    if (IS_FT_OBJECT(ff_pkt->type)) {
@@ -1309,20 +909,26 @@ bool encode_and_send_attributes(JCR *jcr, FF_PKT *ff_pkt, int &data_stream)
    jcr->unlock();
 
    /* Debug code: check if we must hangup */
-   if (hangup && (jcr->JobFiles > (uint32_t)hangup)) {
+   if (hangup > 0 && (jcr->JobFiles > (uint32_t)hangup)) {
+      jcr->setJobStatus(JS_Incomplete);
       Jmsg1(jcr, M_FATAL, 0, "Debug hangup requested after %d files.\n", hangup);
       set_hangup(0);
       return false;
    }
 
+   if (blowup > 0 && (jcr->JobFiles > (uint32_t)blowup)) {
+      Jmsg1(jcr, M_ABORT, 0, "Debug blowup requested after %d files.\n", blowup);
+      return false;
+   }
+
    /**
     * Send Attributes header to Storage daemon
     *    <file-index> <stream> <info>
     */
    if (!sd->fsend("%ld %d 0", jcr->JobFiles, attr_stream)) {
-      if (!jcr->is_canceled()) {
-         Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"),
-               sd->bstrerror());
+      if (!jcr->is_canceled() && !jcr->is_incomplete()) {
+         Jmsg2(jcr, M_FATAL, 0, _("Network send error to SD. Data=%s ERR=%s\n"),
+               sd->msg, sd->bstrerror());
       }
       return false;
    }
@@ -1427,7 +1033,271 @@ bool encode_and_send_attributes(JCR *jcr, FF_PKT *ff_pkt, int &data_stream)
    return stat;
 }
 
-/**
+/*
+ * Setup bctx for doing compression
+ */
+static bool setup_compression(bctx_t &bctx)
+{
+   JCR *jcr = bctx.jcr;
+
+#if defined(HAVE_LIBZ) || defined(HAVE_LZO)
+   bctx.compress_len = 0;
+   bctx.max_compress_len = 0;
+   bctx.cbuf = NULL;
+ #ifdef HAVE_LIBZ
+   int zstat;
+
+   if ((bctx.ff_pkt->flags & FO_COMPRESS) && bctx.ff_pkt->Compress_algo == COMPRESS_GZIP) {
+      if ((bctx.ff_pkt->flags & FO_SPARSE) || (bctx.ff_pkt->flags & FO_OFFSETS)) {
+         bctx.cbuf = (Bytef *)jcr->compress_buf + OFFSET_FADDR_SIZE;
+         bctx.max_compress_len = jcr->compress_buf_size - OFFSET_FADDR_SIZE;
+      } else {
+         bctx.cbuf = (Bytef *)jcr->compress_buf;
+         bctx.max_compress_len = jcr->compress_buf_size; /* set max length */
+      }
+      bctx.wbuf = jcr->compress_buf;    /* compressed output here */
+      bctx.cipher_input = (uint8_t *)jcr->compress_buf; /* encrypt compressed data */
+
+      /**
+       * Only change zlib parameters if there is no pending operation.
+       * This should never happen as deflatereset is called after each
+       * deflate.
+       */
+
+      if (((z_stream*)jcr->pZLIB_compress_workset)->total_in == 0) {
+         /** set gzip compression level - must be done per file */
+         if ((zstat=deflateParams((z_stream*)jcr->pZLIB_compress_workset,
+              bctx.ff_pkt->Compress_level, Z_DEFAULT_STRATEGY)) != Z_OK) {
+            Jmsg(jcr, M_FATAL, 0, _("Compression deflateParams error: %d\n"), zstat);
+            jcr->setJobStatus(JS_ErrorTerminated);
+            return false;
+         }
+      }
+   }
+ #endif
+ #ifdef HAVE_LZO
+   memset(&bctx.ch, 0, sizeof(comp_stream_header));
+   bctx.cbuf2 = NULL;
+
+   if ((bctx.ff_pkt->flags & FO_COMPRESS) && bctx.ff_pkt->Compress_algo == COMPRESS_LZO1X) {
+      if ((bctx.ff_pkt->flags & FO_SPARSE) || (bctx.ff_pkt->flags & FO_OFFSETS)) {
+         bctx.cbuf = (Bytef *)jcr->compress_buf + OFFSET_FADDR_SIZE;
+         bctx.cbuf2 = (Bytef *)jcr->compress_buf + OFFSET_FADDR_SIZE + sizeof(comp_stream_header);
+         bctx.max_compress_len = jcr->compress_buf_size - OFFSET_FADDR_SIZE;
+      } else {
+         bctx.cbuf = (Bytef *)jcr->compress_buf;
+         bctx.cbuf2 = (Bytef *)jcr->compress_buf + sizeof(comp_stream_header);
+         bctx.max_compress_len = jcr->compress_buf_size; /* set max length */
+      }
+      bctx.ch.magic = COMPRESS_LZO1X;
+      bctx.ch.version = COMP_HEAD_VERSION;
+      bctx.wbuf = jcr->compress_buf;    /* compressed output here */
+      bctx.cipher_input = (uint8_t *)jcr->compress_buf; /* encrypt compressed data */
+   }
+ #endif
+#else
+   bctx.max_compress_len = 0;
+#endif
+   return true;
+}
+
+/*
+ * Send MacOS resource fork to SD
+ */
+#ifdef HAVE_DARWIN_OS
+static bool send_resource_fork(bctx_t &bctx)
+{
+   FF_PKT *ff_pkt = bctx.ff_pkt;
+   JCR *jcr = bctx.jcr;
+   BSOCK *sd = bctx.sd;
+   int stat;
+
+   /** Regular files can have resource forks and Finder Info */
+   if (ff_pkt->type != FT_LNKSAVED && (S_ISREG(ff_pkt->statp.st_mode) &&
+       ff_pkt->flags & FO_HFSPLUS)) {
+      if (ff_pkt->hfsinfo.rsrclength > 0) {
+         int flags;
+         int rsrc_stream;
+         if (bopen_rsrc(&ff_pkt->bfd, ff_pkt->fname, O_RDONLY | O_BINARY, 0) < 0) {
+            ff_pkt->ff_errno = errno;
+            berrno be;
+            Jmsg(jcr, M_NOTSAVED, -1, _("     Cannot open resource fork for \"%s\": ERR=%s.\n"),
+                 ff_pkt->fname, be.bstrerror());
+            jcr->JobErrors++;
+            if (is_bopen(&ff_pkt->bfd)) {
+               bclose(&ff_pkt->bfd);
+            }
+            return true;
+         }
+         flags = ff_pkt->flags;
+         ff_pkt->flags &= ~(FO_COMPRESS|FO_SPARSE|FO_OFFSETS);
+         if (flags & FO_ENCRYPT) {
+            rsrc_stream = STREAM_ENCRYPTED_MACOS_FORK_DATA;
+         } else {
+            rsrc_stream = STREAM_MACOS_FORK_DATA;
+         }
+         stat = send_data(bctx, rsrc_stream);
+         ff_pkt->flags = flags;
+         bclose(&ff_pkt->bfd);
+         if (!stat) {
+            return false;
+         }
+      }
+
+      Dmsg1(300, "Saving Finder Info for \"%s\"\n", ff_pkt->fname);
+      sd->fsend("%ld %d 0", jcr->JobFiles, STREAM_HFSPLUS_ATTRIBUTES);
+      Dmsg1(300, "bfiled>stored:header %s\n", sd->msg);
+      pm_memcpy(sd->msg, ff_pkt->hfsinfo.fndrinfo, 32);
+      sd->msglen = 32;
+      if (bctx.digest) {
+         crypto_digest_update(bctx.digest, (uint8_t *)sd->msg, sd->msglen);
+      }
+      if (bctx.signing_digest) {
+         crypto_digest_update(bctx.signing_digest, (uint8_t *)sd->msg, sd->msglen);
+      }
+      sd->send();
+      sd->signal(BNET_EOD);
+   }
+   return true;
+}
+#endif
+
+static bool do_libz_compression(bctx_t &bctx)
+{
+#ifdef HAVE_LIBZ
+   JCR *jcr = bctx.jcr;
+   BSOCK *sd = bctx.sd;
+   int zstat;
+
+   /** Do compression if turned on */
+   if (bctx.ff_pkt->flags & FO_COMPRESS && bctx.ff_pkt->Compress_algo == COMPRESS_GZIP && jcr->pZLIB_compress_workset) {
+      Dmsg3(400, "cbuf=0x%x rbuf=0x%x len=%u\n", bctx.cbuf, bctx.rbuf, sd->msglen);
+
+      ((z_stream*)jcr->pZLIB_compress_workset)->next_in   = (Bytef *)bctx.rbuf;
+             ((z_stream*)jcr->pZLIB_compress_workset)->avail_in  = sd->msglen;
+      ((z_stream*)jcr->pZLIB_compress_workset)->next_out  = bctx.cbuf;
+             ((z_stream*)jcr->pZLIB_compress_workset)->avail_out = bctx.max_compress_len;
+
+      if ((zstat=deflate((z_stream*)jcr->pZLIB_compress_workset, Z_FINISH)) != Z_STREAM_END) {
+         Jmsg(jcr, M_FATAL, 0, _("Compression deflate error: %d\n"), zstat);
+         jcr->setJobStatus(JS_ErrorTerminated);
+         return false;
+      }
+      bctx.compress_len = ((z_stream*)jcr->pZLIB_compress_workset)->total_out;
+      /** reset zlib stream to be able to begin from scratch again */
+      if ((zstat=deflateReset((z_stream*)jcr->pZLIB_compress_workset)) != Z_OK) {
+         Jmsg(jcr, M_FATAL, 0, _("Compression deflateReset error: %d\n"), zstat);
+         jcr->setJobStatus(JS_ErrorTerminated);
+         return false;
+      }
+
+      Dmsg2(400, "GZIP compressed len=%d uncompressed len=%d\n", bctx.compress_len,
+            sd->msglen);
+
+      sd->msglen = bctx.compress_len;      /* set compressed length */
+      bctx.cipher_input_len = bctx.compress_len;
+   }
+#endif
+   return true;
+}
+
+static bool do_lzo_compression(bctx_t &bctx)
+{
+#ifdef HAVE_LZO
+   JCR *jcr = bctx.jcr;
+   BSOCK *sd = bctx.sd;
+   int lzores;
+
+   /** Do compression if turned on */
+   if (bctx.ff_pkt->flags & FO_COMPRESS && bctx.ff_pkt->Compress_algo == COMPRESS_LZO1X && jcr->LZO_compress_workset) {
+      lzo_uint len;          /* TODO: See with the latest patch how to handle lzo_uint with 64bit */
+
+      ser_declare;
+      ser_begin(bctx.cbuf, sizeof(comp_stream_header));
+
+      Dmsg3(400, "cbuf=0x%x rbuf=0x%x len=%u\n", bctx.cbuf, bctx.rbuf, sd->msglen);
+
+      lzores = lzo1x_1_compress((const unsigned char*)bctx.rbuf, sd->msglen, bctx.cbuf2,
+                                &len, jcr->LZO_compress_workset);
+      bctx.compress_len = len;
+      if (lzores == LZO_E_OK && bctx.compress_len <= bctx.max_compress_len) {
+         /* complete header */
+         ser_uint32(COMPRESS_LZO1X);
+         ser_uint32(bctx.compress_len);
+         ser_uint16(bctx.ch.level);
+         ser_uint16(bctx.ch.version);
+      } else {
+         /** this should NEVER happen */
+         Jmsg(jcr, M_FATAL, 0, _("Compression LZO error: %d\n"), lzores);
+         jcr->setJobStatus(JS_ErrorTerminated);
+         return false;
+      }
+
+      Dmsg2(400, "LZO compressed len=%d uncompressed len=%d\n", bctx.compress_len,
+            sd->msglen);
+
+      bctx.compress_len += sizeof(comp_stream_header); /* add size of header */
+      sd->msglen = bctx.compress_len;      /* set compressed length */
+      bctx.cipher_input_len = bctx.compress_len;
+   }
+#endif
+   return true;
+}
+
+/*
+ * Do in place strip of path
+ */
+static bool do_snap_strip(FF_PKT *ff)
+{
+   /* if the string starts with the snapshot path name, we can replace
+    * by the volume name. The volume_path is smaller than the snapshot_path
+    * snapshot_path = volume_path + /.snapshots/job-xxxx
+    */
+   ASSERT(strlen(ff->snapshot_path) > strlen(ff->volume_path));
+   int sp_first = strlen(ff->snapshot_path); /* point after snapshot_path in fname */
+   if (strncmp(ff->fname, ff->snapshot_path, sp_first) == 0) {
+      int last = pm_strcpy(ff->snap_fname, ff->volume_path);
+      last = MAX(last - 1, 0);
+
+      if (ff->snap_fname[last] == '/') {
+         if (ff->fname[sp_first] == '/') { /* compare with the first character of the string (sp_first not sp_first-1) */
+            ff->snap_fname[last] = 0;
+         }
+      } else {
+         if (ff->fname[sp_first] != '/') {
+            pm_strcat(ff->snap_fname, "/");
+         }
+      }
+
+      pm_strcat(ff->snap_fname, ff->fname + sp_first);
+      ASSERT(strlen(ff->fname) > strlen(ff->snap_fname));
+      strcpy(ff->fname, ff->snap_fname);
+      Dmsg2(DT_SNAPSHOT|20, "%s -> %s\n", ff->fname_save, ff->fname);
+   }
+   if (strncmp(ff->link, ff->snapshot_path, sp_first) == 0) {
+      int last = pm_strcpy(ff->snap_fname, ff->volume_path);
+      last = MAX(last - 1, 0);
+
+      if (ff->snap_fname[last] == '/') {
+         if (ff->link[sp_first] == '/') { /* compare with the first character of the string (sp_first not sp_first-1) */
+            ff->snap_fname[last] = 0;
+         }
+      } else {
+         if (ff->link[sp_first] != '/') {
+            pm_strcat(ff->snap_fname, "/");
+         }
+      }
+
+      pm_strcat(ff->snap_fname, ff->link + sp_first);
+      ASSERT(strlen(ff->link) > strlen(ff->snap_fname));
+      strcpy(ff->link, ff->snap_fname);
+      Dmsg2(DT_SNAPSHOT|20, "%s -> %s\n", ff->link_save, ff->link);
+   }
+
+   return true;
+}
+
+/*
  * Do in place strip of path
  */
 static bool do_strip(int count, char *in)
@@ -1472,16 +1342,23 @@ static bool do_strip(int count, char *in)
  *   for dealing with snapshots, by removing the snapshot directory, or
  *   in handling vendor migrations where files have been restored with
  *   a vendor product into a subdirectory.
+ *
+ *   When we are using snapshots, we might need to convert the path
+ *   back to the original one using the strip_snap_path option.
  */
 void strip_path(FF_PKT *ff_pkt)
 {
-   if (!(ff_pkt->flags & FO_STRIPPATH) || ff_pkt->strip_path <= 0) {
+   if (!ff_pkt->strip_snap_path        && 
+       (!(ff_pkt->flags & FO_STRIPPATH) || ff_pkt->strip_path <= 0))
+   {
       Dmsg1(200, "No strip for %s\n", ff_pkt->fname);
       return;
    }
+   /* shared part between strip and snapshot */
    if (!ff_pkt->fname_save) {
      ff_pkt->fname_save = get_pool_memory(PM_FNAME);
      ff_pkt->link_save = get_pool_memory(PM_FNAME);
+     *ff_pkt->link_save = 0;
    }
    pm_strcpy(ff_pkt->fname_save, ff_pkt->fname);
    if (ff_pkt->type != FT_LNK && ff_pkt->fname != ff_pkt->link) {
@@ -1489,6 +1366,19 @@ void strip_path(FF_PKT *ff_pkt)
       Dmsg2(500, "strcpy link_save=%d link=%d\n", strlen(ff_pkt->link_save),
          strlen(ff_pkt->link));
       Dsm_check(200);
+   } 
+
+   if (ff_pkt->strip_snap_path) {
+      if (!do_snap_strip(ff_pkt)) {
+         Dmsg1(0, "Something wrong with do_snap_strip(%s)\n", ff_pkt->fname);
+         unstrip_path(ff_pkt);
+         goto rtn;
+      }
+   }
+
+   /* See if we want also to strip the path */
+   if (!(ff_pkt->flags & FO_STRIPPATH) || ff_pkt->strip_path <= 0) {
+      goto rtn;
    }
 
    /**
@@ -1511,21 +1401,24 @@ void strip_path(FF_PKT *ff_pkt)
    }
 
 rtn:
-   Dmsg3(100, "fname=%s stripped=%s link=%s\n", ff_pkt->fname_save, ff_pkt->fname,
+   Dmsg3(10, "fname=%s stripped=%s link=%s\n", ff_pkt->fname_save, ff_pkt->fname,
        ff_pkt->link);
 }
 
 void unstrip_path(FF_PKT *ff_pkt)
 {
-   if (!(ff_pkt->flags & FO_STRIPPATH) || ff_pkt->strip_path <= 0) {
+   if (!ff_pkt->strip_snap_path &&
+       (!(ff_pkt->flags & FO_STRIPPATH) || ff_pkt->strip_path <= 0))
+   {
       return;
    }
+   
    strcpy(ff_pkt->fname, ff_pkt->fname_save);
    if (ff_pkt->type != FT_LNK && ff_pkt->fname != ff_pkt->link) {
-      Dmsg2(500, "strcpy link=%s link_save=%s\n", ff_pkt->link,
+      Dmsg2(10, "strcpy link=%s link_save=%s\n", ff_pkt->link,
           ff_pkt->link_save);
       strcpy(ff_pkt->link, ff_pkt->link_save);
-      Dmsg2(500, "strcpy link=%d link_save=%d\n", strlen(ff_pkt->link),
+      Dmsg2(10, "strcpy link=%d link_save=%d\n", strlen(ff_pkt->link),
           strlen(ff_pkt->link_save));
       Dsm_check(200);
    }
@@ -1536,7 +1429,7 @@ static void close_vss_backup_session(JCR *jcr)
 #if defined(WIN32_VSS)
    /* STOP VSS ON WIN32 */
    /* tell vss to close the backup session */
-   if (jcr->VSS) {
+   if (jcr->Snapshot) {
       if (g_pVSSClient->CloseBackup()) {
          /* inform user about writer states */
          for (int i=0; i<(int)g_pVSSClient->GetWriterCount(); i++) {
diff --git a/src/filed/backup.h b/src/filed/backup.h
new file mode 100644
index 0000000..4ce8c1c
--- /dev/null
+++ b/src/filed/backup.h
@@ -0,0 +1,80 @@
+/*
+   Bacula(R) - The Network Backup Solution
+
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2014 Free Software Foundation Europe e.V.
+
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
+
+   You may use this file and others of this release according to the
+   license defined in the LICENSE file, which includes the Affero General
+   Public License, v3.0 ("AGPLv3") and some additional permissions and
+   terms pursuant to its AGPLv3 Section 7.
+
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
+
+#ifndef __BACKUP_H
+#define __BACKUP_H
+
+#include "ch.h"
+
+/*
+ * Define a backup context
+ */
+struct bctx_t {
+   /* Global variables */
+   JCR *jcr;
+   FF_PKT *ff_pkt;                    /* find file packet */
+   int data_stream;
+   BSOCK *sd;
+   uint64_t fileAddr;
+   char *rbuf, *wbuf;
+   int32_t rsize;
+   POOLMEM *msgsave;
+
+   /* Crypto variables */
+   DIGEST *digest;
+   DIGEST *signing_digest;
+   int digest_stream;
+   SIGNATURE *sig;
+   CIPHER_CONTEXT *cipher_ctx;
+   const uint8_t *cipher_input;
+   uint32_t cipher_input_len;
+   uint32_t cipher_block_size;
+   uint32_t encrypted_len;
+
+   /* Compression variables */
+#if defined(HAVE_LIBZ) || defined(HAVE_LZO)
+   uLong compress_len;
+   uLong max_compress_len;
+   Bytef *cbuf;
+   Bytef *cbuf2;
+#endif
+#ifdef HAVE_LZO
+   comp_stream_header ch;
+#endif
+
+};
+
+bool crypto_setup_digests(bctx_t &bctx);
+bool crypto_terminate_digests(bctx_t &bctx);
+bool crypto_session_start(JCR *jcr);
+void crypto_session_end(JCR *jcr);
+bool crypto_session_send(JCR *jcr, BSOCK *sd);
+bool crypto_allocate_ctx(bctx_t &bctx);
+void crypto_free(bctx_t &bctx);
+
+bool encode_and_send_attributes(bctx_t &bctx);
+
+bool process_and_send_data(bctx_t &bctx);
+
+#ifdef HAVE_WIN32
+DWORD WINAPI read_efs_data_cb(PBYTE pbData, PVOID pvCallbackContext, ULONG ulLength);
+#endif
+
+#endif
diff --git a/src/filed/bacula-fd.conf.in b/src/filed/bacula-fd.conf.in
index 67171a9..2c05dd9 100644
--- a/src/filed/bacula-fd.conf.in
+++ b/src/filed/bacula-fd.conf.in
@@ -6,6 +6,10 @@
 # There is not much to change here except perhaps the
 # File daemon Name to
 #
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 
 #
 # List Directors who are permitted to contact this File daemon
diff --git a/src/filed/crypto.c b/src/filed/crypto.c
new file mode 100644
index 0000000..f3eabd5
--- /dev/null
+++ b/src/filed/crypto.c
@@ -0,0 +1,322 @@
+/*
+   Bacula(R) - The Network Backup Solution
+
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
+
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
+
+   You may use this file and others of this release according to the
+   license defined in the LICENSE file, which includes the Affero General
+   Public License, v3.0 ("AGPLv3") and some additional permissions and
+   terms pursuant to its AGPLv3 Section 7.
+
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
+ */
+/*
+ *  Crypto subroutines used in backup.c
+ *
+ * Split from backup.c August 2014
+ *
+ *    Kern Sibbald, August MMXIV
+ *
+ */
+
+#include "bacula.h"
+#include "filed.h"
+#include "ch.h"
+#include "backup.h"
+
+
+bool crypto_allocate_ctx(bctx_t &bctx)
+{
+   JCR *jcr = bctx.jcr;
+
+   if ((bctx.ff_pkt->flags & FO_SPARSE) || (bctx.ff_pkt->flags & FO_OFFSETS)) {
+      Jmsg0(jcr, M_FATAL, 0, _("Encrypting sparse or offset data not supported.\n"));
+      return false;
+   }
+   /** Allocate the cipher context */
+   if ((bctx.cipher_ctx = crypto_cipher_new(jcr->crypto.pki_session, true,
+        &bctx.cipher_block_size)) == NULL) {
+      /* Shouldn't happen! */
+      Jmsg0(jcr, M_FATAL, 0, _("Failed to initialize encryption context.\n"));
+      return false;
+   }
+
+   /**
+    * Grow the crypto buffer, if necessary.
+    * crypto_cipher_update() will buffer up to (cipher_block_size - 1).
+    * We grow crypto_buf to the maximum number of blocks that
+    * could be returned for the given read buffer size.
+    * (Using the larger of either rsize or max_compress_len)
+    */
+   jcr->crypto.crypto_buf = check_pool_memory_size(jcr->crypto.crypto_buf,
+        (MAX(bctx.rsize + (int)sizeof(uint32_t), (int32_t)bctx.max_compress_len) +
+         bctx.cipher_block_size - 1) / bctx.cipher_block_size * bctx.cipher_block_size);
+
+   bctx.wbuf = jcr->crypto.crypto_buf; /* Encrypted, possibly compressed output here. */
+   return true;
+}
+
+
+bool crypto_setup_digests(bctx_t &bctx)
+{
+   JCR *jcr = bctx.jcr;
+   FF_PKT *ff_pkt = bctx.ff_pkt;
+
+   crypto_digest_t signing_algorithm = (crypto_digest_t)me->pki_digest;
+
+   /**
+    * Setup for digest handling. If this fails, the digest will be set to NULL
+    * and not used. Note, the digest (file hash) can be any one of the four
+    * algorithms below.
+    *
+    * The signing digest is a single algorithm depending on
+    * whether or not we have SHA2.
+    *   ****FIXME****  the signing algoritm should really be
+    *   determined a different way!!!!!!  What happens if
+    *   sha2 was available during backup but not restore?
+    */
+   if (ff_pkt->flags & FO_MD5) {
+      bctx.digest = crypto_digest_new(jcr, CRYPTO_DIGEST_MD5);
+      bctx.digest_stream = STREAM_MD5_DIGEST;
+
+   } else if (ff_pkt->flags & FO_SHA1) {
+      bctx.digest = crypto_digest_new(jcr, CRYPTO_DIGEST_SHA1);
+      bctx.digest_stream = STREAM_SHA1_DIGEST;
+
+   } else if (ff_pkt->flags & FO_SHA256) {
+      bctx.digest = crypto_digest_new(jcr, CRYPTO_DIGEST_SHA256);
+      bctx.digest_stream = STREAM_SHA256_DIGEST;
+
+   } else if (ff_pkt->flags & FO_SHA512) {
+      bctx.digest = crypto_digest_new(jcr, CRYPTO_DIGEST_SHA512);
+      bctx.digest_stream = STREAM_SHA512_DIGEST;
+   }
+
+   /** Did digest initialization fail? */
+   if (bctx.digest_stream != STREAM_NONE && bctx.digest == NULL) {
+      Jmsg(jcr, M_WARNING, 0, _("%s digest initialization failed\n"),
+         stream_to_ascii(bctx.digest_stream));
+   }
+
+   /**
+    * Set up signature digest handling. If this fails, the signature digest
+    * will be set to NULL and not used.
+    */
+   /* TODO landonf: We should really only calculate the digest once, for
+    * both verification and signing.
+    */
+   if (jcr->crypto.pki_sign) {
+      bctx.signing_digest = crypto_digest_new(jcr, signing_algorithm);
+
+      /** Full-stop if a failure occurred initializing the signature digest */
+      if (bctx.signing_digest == NULL) {
+         Jmsg(jcr, M_NOTSAVED, 0, _("%s signature digest initialization failed\n"),
+            stream_to_ascii(signing_algorithm));
+         jcr->JobErrors++;
+         return false;
+      }
+   }
+
+   /** Enable encryption */
+   if (jcr->crypto.pki_encrypt) {
+      ff_pkt->flags |= FO_ENCRYPT;
+   }
+   return true;
+}
+
+
+bool crypto_session_start(JCR *jcr)
+{
+   crypto_cipher_t cipher = (crypto_cipher_t) me->pki_cipher;
+
+   /**
+    * Create encryption session data and a cached, DER-encoded session data
+    * structure. We use a single session key for each backup, so we'll encode
+    * the session data only once.
+    */
+   if (jcr->crypto.pki_encrypt) {
+      uint32_t size = 0;
+
+      /** Create per-job session encryption context */
+      jcr->crypto.pki_session = crypto_session_new(cipher, jcr->crypto.pki_recipients);
+      if (!jcr->crypto.pki_session) {
+         Jmsg(jcr, M_FATAL, 0, _("Unsupported cipher on this system.\n"));
+         return false;
+      }
+
+      /** Get the session data size */
+      if (!crypto_session_encode(jcr->crypto.pki_session, (uint8_t *)0, &size)) {
+         Jmsg(jcr, M_FATAL, 0, _("An error occurred while encrypting the stream.\n"));
+         return false;
+      }
+
+      /** Allocate buffer */
+      jcr->crypto.pki_session_encoded = get_memory(size);
+
+      /** Encode session data */
+      if (!crypto_session_encode(jcr->crypto.pki_session, (uint8_t *)jcr->crypto.pki_session_encoded, &size)) {
+         Jmsg(jcr, M_FATAL, 0, _("An error occurred while encrypting the stream.\n"));
+         return false;
+      }
+
+      /** ... and store the encoded size */
+      jcr->crypto.pki_session_encoded_size = size;
+
+      /** Allocate the encryption/decryption buffer */
+      jcr->crypto.crypto_buf = get_memory(CRYPTO_CIPHER_MAX_BLOCK_SIZE);
+   }
+   return true;
+}
+
+void crypto_session_end(JCR *jcr)
+{
+   if (jcr->crypto.crypto_buf) {
+      free_pool_memory(jcr->crypto.crypto_buf);
+      jcr->crypto.crypto_buf = NULL;
+   }
+   if (jcr->crypto.pki_session) {
+      crypto_session_free(jcr->crypto.pki_session);
+   }
+   if (jcr->crypto.pki_session_encoded) {
+      free_pool_memory(jcr->crypto.pki_session_encoded);
+      jcr->crypto.pki_session_encoded = NULL;
+   }
+}
+
+bool crypto_session_send(JCR *jcr, BSOCK *sd)
+{
+   POOLMEM *msgsave;
+
+   /** Send our header */
+   Dmsg2(100, "Send hdr fi=%ld stream=%d\n", jcr->JobFiles, STREAM_ENCRYPTED_SESSION_DATA);
+   sd->fsend("%ld %d %lld", jcr->JobFiles, STREAM_ENCRYPTED_SESSION_DATA,
+      (int64_t)jcr->ff->statp.st_size);
+   msgsave = sd->msg;
+   sd->msg = jcr->crypto.pki_session_encoded;
+   sd->msglen = jcr->crypto.pki_session_encoded_size;
+   jcr->JobBytes += sd->msglen;
+
+   Dmsg1(100, "Send data len=%d\n", sd->msglen);
+   sd->send();
+   sd->msg = msgsave;
+   sd->signal(BNET_EOD);
+   return true;
+}
+
+bool crypto_terminate_digests(bctx_t &bctx)
+{
+   JCR *jcr;
+   BSOCK *sd;
+   FF_PKT *ff_pkt;
+
+   jcr = bctx.jcr;
+   sd = bctx.sd;
+   ff_pkt = bctx.ff_pkt;
+
+   /** Terminate the signing digest and send it to the Storage daemon */
+   if (bctx.signing_digest) {
+      uint32_t size = 0;
+
+      if ((bctx.sig = crypto_sign_new(jcr)) == NULL) {
+         Jmsg(jcr, M_FATAL, 0, _("Failed to allocate memory for crypto signature.\n"));
+         return false;
+      }
+
+      if (!crypto_sign_add_signer(bctx.sig, bctx.signing_digest, jcr->crypto.pki_keypair)) {
+         Jmsg(jcr, M_FATAL, 0, _("An error occurred while adding signer the stream.\n"));
+         return false;
+      }
+
+      /** Get signature size */
+      if (!crypto_sign_encode(bctx.sig, NULL, &size)) {
+         Jmsg(jcr, M_FATAL, 0, _("An error occurred while signing the stream.\n"));
+         return false;
+      }
+
+      /** Grow the bsock buffer to fit our message if necessary */
+      if (sizeof_pool_memory(sd->msg) < (int32_t)size) {
+         sd->msg = realloc_pool_memory(sd->msg, size);
+      }
+
+      /** Send our header */
+      sd->fsend("%ld %ld 0", jcr->JobFiles, STREAM_SIGNED_DIGEST);
+      Dmsg1(300, "bfiled>stored:header %s\n", sd->msg);
+
+      /** Encode signature data */
+      if (!crypto_sign_encode(bctx.sig, (uint8_t *)sd->msg, &size)) {
+         Jmsg(jcr, M_FATAL, 0, _("An error occurred while signing the stream.\n"));
+         return false;
+      }
+
+      sd->msglen = size;
+      sd->send();
+      sd->signal(BNET_EOD);              /* end of checksum */
+   }
+
+   /** Terminate any digest and send it to Storage daemon */
+   if (bctx.digest) {
+      uint32_t size;
+
+      sd->fsend("%ld %d 0", jcr->JobFiles, bctx.digest_stream);
+      Dmsg1(300, "bfiled>stored:header %s\n", sd->msg);
+
+      size = CRYPTO_DIGEST_MAX_SIZE;
+
+      /** Grow the bsock buffer to fit our message if necessary */
+      if (sizeof_pool_memory(sd->msg) < (int32_t)size) {
+         sd->msg = realloc_pool_memory(sd->msg, size);
+      }
+
+      if (!crypto_digest_finalize(bctx.digest, (uint8_t *)sd->msg, &size)) {
+         Jmsg(jcr, M_FATAL, 0, _("An error occurred finalizing signing the stream.\n"));
+         return false;
+      }
+
+      /* Keep the checksum if this file is a hardlink */
+      if (ff_pkt->linked) {
+         ff_pkt_set_link_digest(ff_pkt, bctx.digest_stream, sd->msg, size);
+      }
+
+      sd->msglen = size;
+      sd->send();
+      sd->signal(BNET_EOD);              /* end of checksum */
+   }
+
+   /* Check if original file has a digest, and send it */
+   if (ff_pkt->type == FT_LNKSAVED && ff_pkt->digest) {
+      Dmsg2(300, "Link %s digest %d\n", ff_pkt->fname, ff_pkt->digest_len);
+      sd->fsend("%ld %d 0", jcr->JobFiles, ff_pkt->digest_stream);
+
+      sd->msg = check_pool_memory_size(sd->msg, ff_pkt->digest_len);
+      memcpy(sd->msg, ff_pkt->digest, ff_pkt->digest_len);
+      sd->msglen = ff_pkt->digest_len;
+      sd->send();
+
+      sd->signal(BNET_EOD);              /* end of hardlink record */
+   }
+
+   return true;
+}
+
+void crypto_free(bctx_t &bctx)
+{
+   if (bctx.digest) {
+      crypto_digest_free(bctx.digest);
+      bctx.digest = NULL;
+   }
+   if (bctx.signing_digest) {
+      crypto_digest_free(bctx.signing_digest);
+      bctx.signing_digest = NULL;
+   }
+   if (bctx.sig) {
+      crypto_sign_free(bctx.sig);
+      bctx.sig = NULL;
+   }
+}
diff --git a/src/filed/estimate.c b/src/filed/estimate.c
index 26fe43f..216b69d 100644
--- a/src/filed/estimate.c
+++ b/src/filed/estimate.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *  Bacula File Daemon estimate.c
diff --git a/src/filed/fd_plugins.c b/src/filed/fd_plugins.c
index 84fba4b..922d1e0 100644
--- a/src/filed/fd_plugins.c
+++ b/src/filed/fd_plugins.c
@@ -1,23 +1,27 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /**
  * Main program to test loading and running Bacula plugins.
  *   Destined to become Bacula pluginloader, ...
  *
- *   Written by Kern Sibbald, October 2007
+ * Kern Sibbald, October 2007
  */
 #include "bacula.h"
 #include "filed.h"
@@ -26,14 +30,9 @@ extern CLIENT *me;
 extern DLL_IMP_EXP char *exepath;
 extern DLL_IMP_EXP char *version;
 extern DLL_IMP_EXP char *dist_name;
-extern DLL_IMP_EXP int beef;
 
 const int dbglvl = 150;
-#ifdef HAVE_WIN32
-const char *plugin_type = "-fd.dll";
-#else
 const char *plugin_type = "-fd.so";
-#endif
 
 extern int save_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level);
 extern bool check_changes(JCR *jcr, FF_PKT *ff_pkt);
@@ -180,7 +179,7 @@ void generate_plugin_event(JCR *jcr, bEventType eventType, void *value)
    restore_object_pkt *rop;
 
    Dsm_check(999);
-   if (!bplugin_list || !jcr || !jcr->plugin_ctx_list) {
+   if (!b_plugin_list || !jcr || !jcr->plugin_ctx_list) {
       return;                         /* Return if no plugins loaded */
    }
 
@@ -213,7 +212,7 @@ void generate_plugin_event(JCR *jcr, bEventType eventType, void *value)
       call_if_canceled = true; /* plugin *must* see this call */
       break;
    case bEventStartRestoreJob:
-      foreach_alist_index(i, plugin, bplugin_list) {
+      foreach_alist_index(i, plugin, b_plugin_list) {
          plugin->restoreFileStarted = false;
          plugin->createFileCalled = false;
       }
@@ -239,7 +238,7 @@ void generate_plugin_event(JCR *jcr, bEventType eventType, void *value)
     * Pass event to every plugin (except if name is set). If name
     *   is set, we pass it only to the plugin with that name.
     */
-   foreach_alist_index(i, plugin, bplugin_list) {
+   foreach_alist_index(i, plugin, b_plugin_list) {
       if (!for_this_plugin(plugin, name, len)) {
          Dmsg2(dbglvl, "Not for this plugin name=%s NULL=%d\n",
             name, name==NULL?1:0);
@@ -280,7 +279,7 @@ bool plugin_check_file(JCR *jcr, char *fname)
    int i;
 
    Dsm_check(999);
-   if (!bplugin_list || !jcr || !jcr->plugin_ctx_list || jcr->is_job_canceled()) {
+   if (!b_plugin_list || !jcr || !jcr->plugin_ctx_list || jcr->is_job_canceled()) {
       return false;                      /* Return if no plugins loaded */
    }
 
@@ -289,7 +288,7 @@ bool plugin_check_file(JCR *jcr, char *fname)
    Dmsg2(dbglvl, "plugin_ctx=%p JobId=%d\n", jcr->plugin_ctx_list, jcr->JobId);
 
    /* Pass event to every plugin */
-   foreach_alist_index(i, plugin, bplugin_list) {
+   foreach_alist_index(i, plugin, b_plugin_list) {
       jcr->plugin_ctx = &plugin_ctx_list[i];
       jcr->plugin = plugin;
       if (is_plugin_disabled(jcr)) {
@@ -408,7 +407,7 @@ bRC plugin_option_handle_file(JCR *jcr, FF_PKT *ff_pkt, struct save_pkt *sp)
    sp->delta_seq = ff_pkt->delta_seq;
    sp->accurate_found = ff_pkt->accurate_found;
 
-   if (!bplugin_list || !jcr->plugin_ctx_list || jcr->is_job_canceled()) {
+   if (!b_plugin_list || !jcr->plugin_ctx_list || jcr->is_job_canceled()) {
       Jmsg1(jcr, M_FATAL, 0, "Command plugin \"%s\" requested, but is not loaded.\n", cmd);
       goto bail_out;         /* Return if no plugins loaded */
    }
@@ -418,7 +417,7 @@ bRC plugin_option_handle_file(JCR *jcr, FF_PKT *ff_pkt, struct save_pkt *sp)
    }
 
    /* Note, we stop the loop on the first plugin that matches the name */
-   foreach_alist_index(i, plugin, bplugin_list) {
+   foreach_alist_index(i, plugin, b_plugin_list) {
       Dmsg4(dbglvl, "plugin=%s plen=%d cmd=%s len=%d\n", plugin->file, plugin->file_len, cmd, len);
       if (!for_this_plugin(plugin, cmd, len)) {
          continue;
@@ -489,7 +488,7 @@ int plugin_save(JCR *jcr, FF_PKT *ff_pkt, bool top_level)
    POOL_MEM link(PM_FNAME);
 
    Dsm_check(999);
-   if (!bplugin_list || !jcr->plugin_ctx_list || jcr->is_job_canceled()) {
+   if (!b_plugin_list || !jcr->plugin_ctx_list || jcr->is_job_canceled()) {
       Jmsg1(jcr, M_FATAL, 0, "Command plugin \"%s\" requested, but is not loaded.\n", cmd);
       return 1;                            /* Return if no plugins loaded */
    }
@@ -503,7 +502,7 @@ int plugin_save(JCR *jcr, FF_PKT *ff_pkt, bool top_level)
    }
 
    /* Note, we stop the loop on the first plugin that matches the name */
-   foreach_alist_index(i, plugin, bplugin_list) {
+   foreach_alist_index(i, plugin, b_plugin_list) {
       Dmsg4(dbglvl, "plugin=%s plen=%d cmd=%s len=%d\n", plugin->file, plugin->file_len, cmd, len);
       if (!for_this_plugin(plugin, cmd, len)) {
          continue;
@@ -634,7 +633,7 @@ int plugin_estimate(JCR *jcr, FF_PKT *ff_pkt, bool top_level)
    ATTR attr;
 
    Dsm_check(999);
-   if (!bplugin_list || !jcr->plugin_ctx_list) {
+   if (!b_plugin_list || !jcr->plugin_ctx_list) {
       Jmsg1(jcr, M_FATAL, 0, "Command plugin \"%s\" requested, but is not loaded.\n", cmd);
       return 1;                            /* Return if no plugins loaded */
    }
@@ -648,7 +647,7 @@ int plugin_estimate(JCR *jcr, FF_PKT *ff_pkt, bool top_level)
    }
 
    /* Note, we stop the loop on the first plugin that matches the name */
-   foreach_alist_index(i, plugin, bplugin_list) {
+   foreach_alist_index(i, plugin, b_plugin_list) {
       Dmsg4(dbglvl, "plugin=%s plen=%d cmd=%s len=%d\n", plugin->file, plugin->file_len, cmd, len);
       if (!for_this_plugin(plugin, cmd, len)) {
          continue;
@@ -869,7 +868,7 @@ bool plugin_name_stream(JCR *jcr, char *name)
     * Search for correct plugin as specified on the command
     */
    Dsm_check(999);
-   foreach_alist_index(i, plugin, bplugin_list) {
+   foreach_alist_index(i, plugin, b_plugin_list) {
       bEvent event;
       Dmsg3(dbglvl, "plugin=%s cmd=%s len=%d\n", plugin->file, cmd, len);
       if (!for_this_plugin(plugin, cmd, len)) {
@@ -934,7 +933,7 @@ int plugin_create_file(JCR *jcr, ATTR *attr, BFILE *bfd, int replace)
    int rc;
 
    Dsm_check(999);
-   if (!plugin || !plugin_ctx || !set_cmd_plugin(bfd, jcr) || jcr->is_job_canceled()) {
+   if (!plugin || !plugin_ctx || jcr->is_job_canceled()) {
       return CF_ERROR;
    }
 
@@ -987,6 +986,9 @@ int plugin_create_file(JCR *jcr, ATTR *attr, BFILE *bfd, int replace)
       return CF_CORE;           /* Let Bacula core handle the file creation */
    }
 
+   /* Use the bfile for plugin */
+   set_cmd_plugin(bfd, jcr);
+
    /* Created link or directory? */
    if (rp.create_status == CF_CREATED) {
       return rp.create_status;        /* yes, no need to bopen */
@@ -1096,14 +1098,14 @@ void load_fd_plugins(const char *plugin_dir)
       return;
    }
 
-   bplugin_list = New(alist(10, not_owned_by_alist));
+   b_plugin_list = New(alist(10, not_owned_by_alist));
    Dsm_check(999);
    if (!load_plugins((void *)&binfo, (void *)&bfuncs, plugin_dir, plugin_type,
                      is_plugin_compatible)) {
       /* Either none found, or some error */
-      if (bplugin_list->size() == 0) {
-         delete bplugin_list;
-         bplugin_list = NULL;
+      if (b_plugin_list->size() == 0) {
+         delete b_plugin_list;
+         b_plugin_list = NULL;
          Dmsg0(dbglvl, "No plugins loaded\n");
          return;
       }
@@ -1121,7 +1123,7 @@ void load_fd_plugins(const char *plugin_dir)
     * Verify that the plugin is acceptable, and print information
     *  about it.
     */
-   foreach_alist_index(i, plugin, bplugin_list) {
+   foreach_alist_index(i, plugin, b_plugin_list) {
       Jmsg(NULL, M_INFO, 0, _("Loaded plugin: %s\n"), plugin->file);
       Dmsg1(dbglvl, "Loaded plugin: %s\n", plugin->file);
    }
@@ -1158,7 +1160,8 @@ static bool is_plugin_compatible(Plugin *plugin)
       return false;
    }
    if (strcmp(info->plugin_license, "Bacula AGPLv3") != 0 &&
-       strcmp(info->plugin_license, "AGPLv3") != 0) {
+       strcmp(info->plugin_license, "AGPLv3") != 0 &&
+       strcmp(info->plugin_license, "Bacula Systems(R) SA") != 0) {
       Jmsg(NULL, M_ERROR, 0, _("Plugin license incompatible. Plugin=%s license=%s\n"),
            plugin->file, info->plugin_license);
       Dmsg2(50, "Plugin license incompatible. Plugin=%s license=%s\n",
@@ -1179,7 +1182,7 @@ static bool is_plugin_compatible(Plugin *plugin)
 
 /**
  * Create a new instance of each plugin for this Job
- *   Note, bplugin_list can exist but jcr->plugin_ctx_list can
+ *   Note, b_plugin_list can exist but jcr->plugin_ctx_list can
  *   be NULL if no plugins were loaded.
  */
 void new_plugins(JCR *jcr)
@@ -1188,7 +1191,7 @@ void new_plugins(JCR *jcr)
    int i;
 
    Dsm_check(999);
-   if (!bplugin_list) {
+   if (!b_plugin_list) {
       Dmsg0(dbglvl, "plugin list is NULL\n");
       return;
    }
@@ -1196,7 +1199,7 @@ void new_plugins(JCR *jcr)
       return;
    }
 
-   int num = bplugin_list->size();
+   int num = b_plugin_list->size();
 
    if (num == 0) {
       Dmsg0(dbglvl, "No plugins loaded\n");
@@ -1207,7 +1210,7 @@ void new_plugins(JCR *jcr)
 
    bpContext *plugin_ctx_list = (bpContext *)jcr->plugin_ctx_list;
    Dmsg2(dbglvl, "Instantiate plugin_ctx=%p JobId=%d\n", plugin_ctx_list, jcr->JobId);
-   foreach_alist_index(i, plugin, bplugin_list) {
+   foreach_alist_index(i, plugin, b_plugin_list) {
       Dsm_check(999);
       /* Start a new instance of each plugin */
       bacula_ctx *b_ctx = (bacula_ctx *)malloc(sizeof(bacula_ctx));
@@ -1235,14 +1238,14 @@ void free_plugins(JCR *jcr)
    Plugin *plugin;
    int i;
 
-   if (!bplugin_list || !jcr->plugin_ctx_list) {
+   if (!b_plugin_list || !jcr->plugin_ctx_list) {
       return;                         /* no plugins, nothing to do */
    }
 
    Dsm_check(999);
    bpContext *plugin_ctx_list = (bpContext *)jcr->plugin_ctx_list;
    Dmsg2(dbglvl, "Free instance plugin_ctx=%p JobId=%d\n", plugin_ctx_list, jcr->JobId);
-   foreach_alist_index(i, plugin, bplugin_list) {
+   foreach_alist_index(i, plugin, b_plugin_list) {
       /* Free the plugin instance */
       plug_func(plugin)->freePlugin(&plugin_ctx_list[i]);
       free(plugin_ctx_list[i].bContext);     /* free Bacula private context */
@@ -1445,13 +1448,12 @@ static bRC baculaGetValue(bpContext *ctx, bVariable var, void *value)
    case bVarDistName:
       *(char **)value = dist_name;
       break;
-   case bVarBEEF:
-      *((int *)value) = beef;
-      break;
    case bVarPrevJobName:
       break;
    case bVarPrefixLinks:
       break;
+   case bVarxxx:
+      break;
    default:
       break;
    }
@@ -1502,23 +1504,14 @@ static bRC baculaGetValue(bpContext *ctx, bVariable var, void *value)
       *((int *)value) = (int)jcr->accurate;
       Dmsg1(dbglvl, "Bacula: return accurate=%d\n", (int)jcr->accurate);
       break;
+   case bVarInteractiveSession:
+      *(int *)value = (int)jcr->interactive_session;
+      break;
    case bVarFileSeen:
       break;                 /* a write only variable, ignore read request */
    case bVarVssObject:
-#ifdef HAVE_WIN32
-      if (g_pVSSClient) {
-         *(void **)value = g_pVSSClient->GetVssObject();
-         break;
-       }
-#endif
        return bRC_Error;
    case bVarVssDllHandle:
-#ifdef HAVE_WIN32
-      if (g_pVSSClient) {
-         *(void **)value = g_pVSSClient->GetVssDllHandle();
-         break;
-       }
-#endif
        return bRC_Error;
    case bVarWhere:
       *(char **)value = jcr->where;
@@ -1534,7 +1527,7 @@ static bRC baculaGetValue(bpContext *ctx, bVariable var, void *value)
    case bVarExePath:
    case bVarVersion:
    case bVarDistName:
-   case bVarBEEF:
+   case bVarxxx:
       break;
    }
    Dsm_check(999);
@@ -1560,6 +1553,9 @@ static bRC baculaSetValue(bpContext *ctx, bVariable var, void *value)
          return bRC_Error;
       }
       break;
+   case bVarInteractiveSession:
+      jcr->interactive_session = (((intptr_t) value) == 1);
+      break;
    default:
       break;
    }
diff --git a/src/filed/fd_plugins.h b/src/filed/fd_plugins.h
index 855327e..63af7d7 100644
--- a/src/filed/fd_plugins.h
+++ b/src/filed/fd_plugins.h
@@ -1,22 +1,26 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Application Programming Interface (API) definition for Bacula Plugins
  *
- *  Written by Kern Sibbald, October 2007
+ * Kern Sibbald, October 2007
  *
  */
 
@@ -175,9 +179,10 @@ typedef enum {
   bVarExePath    = 16,
   bVarVersion    = 17,
   bVarDistName   = 18,
-  bVarBEEF       = 19,
+  bVarxxx        = 19,
   bVarPrevJobName = 20,
-  bVarPrefixLinks = 21
+  bVarPrefixLinks = 21,
+  bVarInteractiveSession = 22
 } bVariable;
 
 /* Events that are passed to plugin */
@@ -290,7 +295,7 @@ typedef enum {
 
 # define FD_PLUGIN_MAGIC  "*FDPluginData*"
 
-#define FD_PLUGIN_INTERFACE_VERSION  ( 12 )
+#define FD_PLUGIN_INTERFACE_VERSION  ( 13 )
 
 typedef struct s_pluginInfo {
    uint32_t size;
diff --git a/src/filed/fd_snapshot.c b/src/filed/fd_snapshot.c
new file mode 100644
index 0000000..aac0116
--- /dev/null
+++ b/src/filed/fd_snapshot.c
@@ -0,0 +1,1901 @@
+/*
+   Bacula(R) - The Network Backup Solution
+
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
+
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
+
+   You may use this file and others of this release according to the
+   license defined in the LICENSE file, which includes the Affero General
+   Public License, v3.0 ("AGPLv3") and some additional permissions and
+   terms pursuant to its AGPLv3 Section 7.
+
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
+
+   Written by Eric Bollengier, 2015
+*/
+
+/*
+           Documentation about snapshot backend
+----------------------------------------------------------------
+
+The snapshot manager is using environment variables to communicate.
+
+Variables:
+
+SNAPSHOT_ACTION
+  Operation such as:
+     create, delete, list, mount, unmount, check, support, subvolume
+
+SNAPSHOT_VOLUME
+  Volume name
+   ex: /dev/vgroot/home_Test-2014-01-01_00_00  (lvm)
+       /home/.snapshots/Test-2014-01-01_00_00  (btrfs)
+       /.zfs/snapshot/Test-2014-01-01_00_00    (zfs)
+
+  The volume name is generated by the create command
+
+SNAPSHOT_DEVICE
+  Device name
+   ex: /dev/vgroot/home (lvm)
+       /home            (btrfs)
+       /                (zfs)
+
+  The device name can be found via getmntent()
+
+SNAPSHOT_NAME
+  Snapshot name, usually the Job name
+
+SNAPSHOT_FSTYPE
+  Device filesystem type, can be found via getmntent()
+  ex: btrfs, zfs, ext4
+
+SNAPSHOT_TYPE
+  Snapshot backend type, generated by support command
+  ex: lvm, btrfs, zfs
+
+SNAPSHOT_MOUNTPOINT
+  Device mount point, found via getmntent()
+
+SNAPSHOT_SNAPMOUNTPOINT
+  Snapshot mount point is generated by the mount command
+
+
+                   Protocol
+----------------------------------------------------------------
+
+OK: exit code 0 and status=1 in the output
+ERR: exit code <> 0 and/or status=0 in the output
+
+status=1 keyword="value" keyword2="value2"
+
+status=0 error="Error message"
+
+
+                   Workflow
+----------------------------------------------------------------
+
+1) List filesystems
+ get SNAPSHOT_DEVICE, SNAPSHOT_FSTYPE, SNAPSHOT_MOUNTPOINT
+
+ volume="" name="" device="" createtime=""
+
+2) Test if a filesystem supports snapshot feature
+ SNAPSHOT_ACTION=support
+ SNAPSHOT_DEVICE=/home
+ SNAPSHOT_MOUNTPOINT=/home
+ SNAPSHOT_FSTYPE=btrfs
+
+ => status=1 type=btrfs device=/home
+ => status=0
+
+2a) Test if a filesystem contains subvolumes
+ SNAPSHOT_ACTION=subvolumes
+ SNAPSHOT_DEVICE=/home
+ SNAPSHOT_FSTYPE=btrfs
+
+ => dev=10 mountpoint=/home/subvol fstype=btrfs
+
+3) Create a snapshot
+ SNAPSHOT_ACTION=create
+ SNAPSHOT_NAME=Test-2014-01-01_00_00 
+ SNAPSHOT_DEVICE=/home
+ SNAPSHOT_MOUNTPOINT=/home
+ SNAPSHOT_FSTYPE=btrfs
+ SNAPSHOT_TYPE=btrfs
+
+ => status=1 volume="/home/.snapshots/Test-2014-01-01_00_00" createtdate=1418935776 type=btrfs
+
+4) Mount the snapshot
+ SNAPSHOT_ACTION=mount
+ SNAPSHOT_NAME=Test-2014-01-01_00_00 
+ SNAPSHOT_DEVICE=/home
+ SNAPSHOT_MOUNTPOINT=/home
+ SNAPSHOT_FSTYPE=btrfs
+ SNAPSHOT_TYPE=btrfs
+
+ => status=1 volume="/home/.snapshots/Test-2014-01-01_00_00" createtdate=1418935776 type=btrfs
+ 
+
+5) Unmount the snapshot
+ SNAPSHOT_ACTION=unmount
+ SNAPSHOT_SNAPMOUNTPOINT=/home/.snapshots/Test-2014-01-01_00_00
+
+ => status=1
+
+6) Delete the snapshot
+ SNAPSHOT_ACTION=delete
+ SNAPSHOT_VOLUME=/home/.snapshot/Test-2014-01-01_00_00
+
+ => status=1
+
+ */
+
+#include "bacula.h"
+#include "filed.h"
+#define USE_CMD_PARSER
+#include "plugins/fd/fd_common.h"
+#undef Jmsg
+#include "fd_snapshot.h"
+#define APPMANAGER_CMD "%eappmanager"
+#define APP_DIR "/tmp/app.d"
+#define SNAPSHOT_CMD "%ebsnapshot"
+
+/* Defined in messages.c */
+extern char *exepath;
+
+/* Catalog interface with the director */
+static char CreateSnap[] = "CatReq Job=%s new_snapshot name=%s volume=%s device=%s tdate=%d type=%s retention=%s";
+static char DelSnap[] = "CatReq Job=%s del_snapshot name=%s device=%s";
+static char GetSnap[] = "CatReq Job=%s get_snapshot name=%s volume=%s";
+
+/* Command line interface with the director */
+static char LsCmd[] = "snapshot ls name=%127s volume=%s device=%s tdate=%d type=%127s path=%s";
+static char DelCmd[] = "snapshot del name=%127s volume=%s device=%s tdate=%d type=%127s";
+static char QueryCmd[] = "snapshot query name=%127s volume=%s device=%s tdate=%d type=%127s";
+static char PruneCmd[] = "snapshot prune volume=%s type=%127s";
+static char SyncCmd[] = "snapshot sync volume=%s type=%127%";
+static char ListCmd[] = "snapshot list";
+static char ConfCmd[] = "snapshot retention=%50s";
+
+/* Small function to quickly tell us if we can do snapshot here */
+static bool is_snapshot_supported(JCR *jcr)
+{
+   bool ret;
+   struct stat sp;
+   POOLMEM    *cmd = get_pool_memory(PM_FNAME);
+   const char *p;
+   const char *str;
+   char add[20];
+
+   /* We are not really interested by arguments, just
+    * the filename
+    */
+   *cmd = 0;
+   for (p=me->snapshot_command; *p; p++) {
+      if (*p == '%') {
+         switch (*++p) {
+         case '%':
+            str = "%";
+            break;
+         case 'e':
+            str = NPRTB(exepath);
+            break;
+         default:
+            add[0] = '%';
+            add[1] = *p;
+            add[2] = 0;
+            str = add;
+         }
+
+      } else if (*p == ' ') {
+         break;
+
+      } else {
+         add[0] = *p;
+         add[1] = 0;
+         str = add;
+      }
+      pm_strcat(cmd, str);
+   }
+
+   ret = stat(cmd, &sp) == 0;
+   free_pool_memory(cmd);
+   Dmsg1(10, "Snapshot = %d\n", ret);
+   return ret;
+}
+
+/* Return the default snapshot handler, must be freed at the end */
+char *snapshot_get_command()
+{
+   return bstrdup(SNAPSHOT_CMD);
+}
+
+/* Initialize the snapshot manager at the begining of the
+ * job and create snapshots
+ */
+bool open_snapshot_backup_session(JCR *jcr)
+{
+   if (!is_snapshot_supported(jcr)) {
+      Dmsg0(DT_SNAPSHOT, "Snapshot not supported\n");
+      return false;
+   }
+
+   jcr->snap_mgr = New(snapshot_manager(jcr));
+   /* Get all volumes and subvolumes */
+   if (!jcr->snap_mgr->scan_mtab()) {
+      berrno be;                /* error probably in errno */
+      Dmsg1(DT_SNAPSHOT, "Unable to scan mtab. ERR=%s\n", be.bstrerror());
+      Jmsg(jcr, M_ERROR, 0, "Unable to scan mtab to determine devices to snapshot\n");
+      return false;
+   }
+   /* Match the volume list with the fileset */
+   if (!jcr->snap_mgr->scan_fileset()) {
+      Jmsg(jcr, M_ERROR,0, "Unable to scan fileset to determine devices to snapshot\n");
+      return false;
+   }
+   /* Create fileset needed */
+   if (!jcr->snap_mgr->create_snapshots()) {
+      /* Error message already displayed if needed */
+      return false;
+   }
+   return true;                 /* We should have some snapshots */
+}
+
+/* Command that can be called from outside */
+bool list_all_snapshots(JCR *jcr, alist *lst)
+{
+   snapshot_manager snap_mgr(jcr);
+
+   /* Get all volumes and subvolumes */
+   if (!snap_mgr.scan_mtab()) {
+      return false;
+   }
+   /* list snapshots */
+   if (snap_mgr.list_snapshots(lst)) {
+      return false;
+   }
+   return true;
+}
+
+/* Cleanup the snapshot manager at the end of the job */
+void close_snapshot_backup_session(JCR *jcr)
+{
+   if (jcr->snap_mgr) {
+      jcr->snap_mgr->cleanup_snapshots();
+      delete jcr->snap_mgr;
+      jcr->snap_mgr = NULL;
+   }
+}
+
+/* Special cmd_parser subclass to not look after plugin
+ * names when decoding the line
+ */
+class arg_parser: public cmd_parser
+{
+public:
+   arg_parser(): cmd_parser() { use_name = false; };
+   virtual ~arg_parser() {};
+};
+
+class snapshot;
+
+/* Device that exists on the system */
+class fs_device: public SMARTALLOC
+{
+public:
+   rblink link;
+
+   uint32_t  dev;               /* dev no */
+   char     *mountpoint;        /* where it's mounted */
+   char     *fstype;            /* ntfs, ext3, ext4... */
+   char     *device;            /* /dev/mapper/xxx */
+
+   bool      supportSnapshotTested; /* True if support() was called */
+   bool      isSuitableForSnapshot; /* Compatible with snapshots */
+   bool      inSnapshotSet;
+   bool      inFileSet;
+   snapshot *snap;              /* Associated snapshot */
+
+   dlist     *include;          /* Where the fs_device was found in the fileset */
+   void      *node;             /* At which node */
+
+
+   fs_device(): 
+      dev(0), mountpoint(NULL), fstype(NULL), device(NULL), 
+         supportSnapshotTested(false), isSuitableForSnapshot(false), snap(NULL)
+      {
+      };
+
+   fs_device(uint32_t adev, const char *adevice, const char *amountpoint, const char *aftype) {
+      dev        = adev;
+      fstype     = bstrdup(aftype);
+      device    = bstrdup(adevice);
+      mountpoint = bstrdup(amountpoint);
+      supportSnapshotTested = false;
+      isSuitableForSnapshot = false;
+      inSnapshotSet = false;
+      inFileSet = false;
+      snap       = NULL;
+      include    = NULL;
+      node       = NULL;
+   };
+
+   ~fs_device() {
+      destroy();
+   };
+
+   /* Call support() and cache the result in supportSnapshotTested and isSuitableForSnapshot */
+   bool can_do_snapshot();
+
+   void setInFileSet(dlist *inc, void *where) {
+      include = inc;            /* where we need to include subvolumes */
+      node = where;             /* after which node */
+      inFileSet = true;
+      inSnapshotSet = true;
+   };
+
+   void set_snap(snapshot *s) {
+      snap = s;
+   };
+
+   void destroy();
+};
+
+/* The device list is stored in a rblist, using the
+ * dev no as key. The devno can be found in every stat()
+ * packet.
+ */
+static int compare_entries(void *item1, void *item2)
+{
+   fs_device *dev1 = (fs_device *) item1;
+   fs_device *dev2 = (fs_device *) item2;
+   if (dev1->dev > dev2->dev) {
+      return 1;
+
+   } else if (dev1->dev < dev2->dev) {
+      return -1;
+
+   } else {
+      return 0;
+   }
+}
+
+static int search_entry(void *item1, void *item2)
+{
+   uint32_t dev1 = (intptr_t) item1;
+   fs_device* dev2 = (fs_device *) item2;
+   if (dev1 > dev2->dev) {
+      return 1;
+
+   } else if (dev1 < dev2->dev) {
+      return -1;
+
+   } else {
+      return 0;
+   }
+}
+
+/* List of all fd_device that are on the system
+ * Some devices are excluded automatically from
+ * the list, such as proc, sysfs, etc...
+ */
+class mtab: public SMARTALLOC
+{
+public:
+   rblist     *entries;
+   int         sCount;          /* Snapshot count */
+   int         dCount;          /* Device count */
+   mtab() {
+      fs_device *elt = NULL;
+      entries = New(rblist(elt, &elt->link));
+      dCount = sCount = 0;
+   };
+
+   ~mtab() {
+      fs_device *elt;
+      foreach_rblist(elt, entries) {
+         elt->destroy();
+      }
+      delete entries;
+   };
+
+   /* Have we devices for snapshot in our list ? */
+   bool empty() {
+      return sCount == 0;
+   };
+
+   /* Get a fs_device corresponding to a file */
+   fs_device *search(char *file);
+
+   /* Get subvolumes for a specific device */
+   bool get_subvolumes(uint32_t dev, alist *items, FF_PKT *ff) {
+      fs_device *elt, *elt2;
+      elt = (fs_device *)entries->search((void*)(intptr_t)dev, search_entry);
+      if (!elt) {
+         return false;
+      }
+
+      foreach_rblist(elt2, entries) {
+         if (elt2->dev == elt->dev) {
+            continue;
+         }
+         if (strncmp(elt2->mountpoint, elt->mountpoint, strlen(elt->mountpoint)) == 0) {
+            /* the mount point is included in the volume */
+
+            if (file_is_excluded(ff, elt2->mountpoint)) {
+               Dmsg1(DT_SNAPSHOT|50, "Looks to be excluded %s\n", elt2->mountpoint);
+
+            } else {
+               items->append(elt2);
+            }
+         }
+      }
+      return items->size() > 0;
+   };
+
+   bool add_in_snapshot_set(char *file, dlist *inc, void *node) {
+
+      fs_device *elt = search(file);
+      if (!elt) {
+         Dmsg1(DT_SNAPSHOT, "%s will not be added to snapshot set\n", file);
+         return sCount == dCount;        /* not found in our list, skip it */
+      }
+      return add_in_snapshot_set(elt, inc, node);
+   };
+
+   bool add_in_snapshot_set(fs_device *elt, dlist *inc, void *node) {
+      Dmsg4(DT_SNAPSHOT|10, "%s in=%d can=%d tested=%d\n", elt->mountpoint, elt->inSnapshotSet, 
+            elt->isSuitableForSnapshot, elt->supportSnapshotTested);
+      if (!elt->inSnapshotSet && elt->can_do_snapshot()) {
+         Dmsg1(DT_SNAPSHOT, "Marking %s for snapshot\n", elt->mountpoint);
+         elt->setInFileSet(inc, node);
+         sCount++;
+      }
+      /* It will help to count when all devices are in the snapshot set */
+      Dmsg2(DT_SNAPSHOT|10, "sCount %d = dCount %d\n", sCount, dCount); 
+      return sCount == dCount;
+   };
+
+   bool add_entry(fs_device *vol) {
+      fs_device *ret = (fs_device *) entries->insert(vol, compare_entries);
+      if (ret == vol && vol->snap) {
+         dCount++;              /* We skip directly FS such as /proc, /sys or /dev */
+      }
+      return ret == vol;
+   };
+};
+
+/* Snapshot descriptor, used to communicate with the snapshot
+ * backend on the system.
+ */
+class snapshot: public SMARTALLOC
+{
+private:
+   JCR *jcr;
+
+public:
+   const char *action;             /* current action */
+   char     Name[MAX_NAME_LENGTH]; /* Name of the snapshot */
+   char     Type[MAX_NAME_LENGTH]; /* lvm, btrfs, netapp */
+   char     FSType[MAX_NAME_LENGTH];     /* btrfs, zfs, ext3 */
+   char     CreateDate[MAX_TIME_LENGTH]; /* Creation date */
+   time_t   CreateTDate;                 /* Creation date in seconds */
+   int64_t  size;               /* Size of the snapshot */
+   int      status;             /* snapshot status */
+   utime_t  Retention;          /* Snapshot retention, might come from Pool/FileSet */
+
+   POOLMEM *Volume;             /* Path of the volume */
+   POOLMEM *Device;             /* Device path */
+   POOLMEM *MountPoint;         /* Device Mount point */
+   POOLMEM *SnapMountPoint;     /* Snapshot Mount point */
+   POOLMEM *path;               /* path used in ls query */
+   POOLMEM *errmsg;             /* Error message generated by commands */
+   POOLMEM *SnapDirectory;      /* Where snapshots are stored */
+
+   char   **env;                /* Variables used to call snapshot */
+   bool     mounted;            /* True if mounted on SnapMountPoint */
+   bool     created;            /* True if the snapshot is created */
+
+   snapshot(JCR *ajcr) {
+      jcr    = ajcr;
+      env    = NULL;
+      path   = get_pool_memory(PM_FNAME);
+      errmsg = get_pool_memory(PM_MESSAGE);
+      Volume = get_pool_memory(PM_FNAME);
+      Device = get_pool_memory(PM_FNAME);
+      MountPoint     = get_pool_memory(PM_FNAME);
+      SnapMountPoint = get_pool_memory(PM_FNAME);
+      SnapDirectory  = get_pool_memory(PM_FNAME);
+      reset();
+   };
+
+   ~snapshot() {
+      free_pool_memory(path);
+      free_pool_memory(errmsg);
+      free_pool_memory(Volume);
+      free_pool_memory(Device);
+      free_pool_memory(MountPoint);
+      free_pool_memory(SnapMountPoint);
+      free_pool_memory(SnapDirectory);
+      free_env();
+   };
+
+   void reset() {
+      *SnapDirectory = *Type = *FSType = *SnapMountPoint = 0;
+      *MountPoint = *Volume = *Device = *path = *errmsg = 0;
+      action    = NULL;
+      size      = -1;
+      status    = 0;
+      mounted   = false;
+      created   = false;
+      Retention = jcr->snapshot_retention;
+   };
+
+   /* Free the env[] structure */
+   void free_env() {
+      if (env) {
+         for (int i=0; env[i] ; i++) {
+            free(env[i]);
+         }
+         free(env);
+         env = NULL;
+      }
+   };
+
+   void set_device(const char *d) {
+      pm_strcpy(Device, d);
+   };
+
+   void set_mountpoint(const char *d) {
+      pm_strcpy(MountPoint, d);
+   };
+
+   void set_name(const char *n) {
+      bstrncpy(Name, n, sizeof(Name));
+   };
+
+   void set_fstype(const char *n) {
+      bstrncpy(FSType, n, sizeof(FSType));
+   };
+
+   void set_action(const char *a) {
+      action = a;
+   };
+
+   /* Convert a real top path to a snapshot path
+    * and set proper variables inside ff_pkt
+    * to translate back all subfiles.
+    */
+   bool convert_path(FF_PKT *ff) {
+      if (!*MountPoint || !*SnapMountPoint) {
+         Dmsg2(DT_SNAPSHOT, "MountPoint=%s SnapMountPoint=%s\n", 
+               NPRT(MountPoint), NPRT(SnapMountPoint));
+         return false;
+      }
+      if (!ff->snap_top_fname) {
+         ff->snap_top_fname = get_pool_memory(PM_FNAME);
+      }
+      ff->volume_path = MountPoint;       /* /tmp */
+      ff->snapshot_path = SnapMountPoint; /* /tmp/.snapshot/Job.20140502.01.01.01 */
+      ff->top_fname_save = ff->top_fname;
+
+      int mp_first = strlen(MountPoint); /* will point to after MountPoint in top_fname */
+      int last = pm_strcpy(ff->snap_top_fname, SnapMountPoint);
+      last = MAX(last - 1, 0);
+
+      /* We need to concat path and avoid double / and no / */
+      if (ff->snap_top_fname[last] == '/') {
+         if (ff->top_fname[mp_first] == '/') {
+            ff->snap_top_fname[last] = 0; /* strip double / */
+         }
+      } else {                            /* no / at all */
+         if (ff->top_fname[mp_first] != '/') {
+            pm_strcat(ff->snap_top_fname, "/");
+         }
+      }
+
+      pm_strcat(ff->snap_top_fname, ff->top_fname + mp_first);
+      ff->top_fname = ff->snap_top_fname;
+      ff->strip_snap_path = true;
+      Dmsg1(DT_SNAPSHOT|50, "top_fname=%s\n", ff->top_fname);
+      return true;
+   };
+
+   /* Create a environment used in the child process */
+   int edit_snapshot_env() {
+      int      i   = 0;
+      POOLMEM *tmp = get_pool_memory(PM_FNAME);
+      free_env();
+
+      /* Update "10" to add more variables */
+      env = (char **) malloc(sizeof(char *) * 10);
+
+      if (*Name) {
+         Mmsg(tmp, "SNAPSHOT_NAME=%s", Name);
+         env[i++] = bstrdup(tmp);
+      }
+      if (*Volume) {
+         Mmsg(tmp, "SNAPSHOT_VOLUME=%s", Volume);
+         env[i++] = bstrdup(tmp);
+      }
+      if (*Device) {
+         Mmsg(tmp, "SNAPSHOT_DEVICE=%s", Device);
+         env[i++] = bstrdup(tmp);
+      }
+      if (*Type) {
+         Mmsg(tmp, "SNAPSHOT_TYPE=%s", Type);
+         env[i++] = bstrdup(tmp);
+      }
+      if (*FSType) {
+         Mmsg(tmp, "SNAPSHOT_FSTYPE=%s", FSType);
+         env[i++] = bstrdup(tmp);
+      }
+      if (*MountPoint) {
+         Mmsg(tmp, "SNAPSHOT_MOUNTPOINT=%s", MountPoint);
+         env[i++] = bstrdup(tmp);
+      }
+      if (*SnapDirectory) {
+         Mmsg(tmp, "SNAPSHOT_SNAPDIRECTORY=%s", SnapDirectory);
+         env[i++] = bstrdup(tmp);
+      }
+      if (*SnapMountPoint) {
+         Mmsg(tmp, "SNAPSHOT_SNAPMOUNTPOINT=%s", SnapMountPoint);
+         env[i++] = bstrdup(tmp);
+      }
+      /* When adding new entries, do not forget to add more slots to env[] */
+
+      Mmsg(tmp, "SNAPSHOT_ACTION=%s", action);
+      env[i++] = bstrdup(tmp);
+
+      env[i] = NULL;            /* last record */
+
+      if (chk_dbglvl(DT_SNAPSHOT|100)) {
+         for (i = 0; env[i] ; i++) {
+            Dmsg1(0, "%s\n", env[i]);
+         }
+      }
+
+      free_pool_memory(tmp);
+      return 1;
+   };
+
+   /* Edit the command line if needed */
+   int edit_snapshot_codes(POOLMEM **omsg, const char *imsg) {
+      const char *p;
+      const char *str;
+      char add[20];
+
+      **omsg = 0;
+      for (p=imsg; *p; p++) {
+         if (*p == '%') {
+            switch (*++p) {
+            case '%':
+               str = "%";
+               break;
+            case 'e':
+               str = NPRTB(exepath);
+               break;
+            case 'n':
+               str = Name;
+               break;
+            case 'v':
+               str = Volume;
+               break;
+            case 'd':
+               str = Device;
+               break;
+            case 'D':
+               str = SnapDirectory;
+               break;
+            case 'a':
+               str = NPRT(action);
+               break;
+            case 't':
+               str = Type;
+               break;
+            case 'f':
+               str = FSType;
+               break;
+            case 'p':
+               str = MountPoint;
+               break;
+            case 's':
+               str = SnapMountPoint;
+               break;
+            default:
+               add[0] = '%';
+               add[1] = *p;
+               add[2] = 0;
+               str = add;
+            }
+
+         } else {
+            add[0] = *p;
+            add[1] = 0;
+            str = add;
+         }
+         pm_strcat(omsg, str);
+      }
+
+      if (chk_dbglvl(DT_SNAPSHOT|10)) {
+         POOL_MEM tmp;
+         Mmsg(tmp, " -d %d -o /tmp/bsnapshot.log ", debug_level);
+         pm_strcat(omsg, tmp.c_str());
+      }
+
+      Dmsg2(DT_SNAPSHOT|30, "edit_snapshot_codes: %s -> %s\n", imsg, *omsg);
+      return 1;
+   };
+
+   /* Call the snapshot backend to know if we can snapshot the current FS */
+   int support_snapshot(fs_device *vol) {
+      arg_parser cmd;
+      status = 0;
+
+      reset();
+      set_device(vol->device);
+      set_mountpoint(vol->mountpoint);
+      set_fstype(vol->fstype);
+
+      if (!do_command("support", &cmd)) {
+         goto bail_out;
+      }
+      scan_arg(&cmd);
+
+   bail_out:
+      Dmsg2(DT_SNAPSHOT|50, "%s snapshot support status=%d\n", vol->mountpoint, status);
+      return status;
+   };
+
+   /* Scan sub volumes for a particular volume */
+   int scan_subvolumes(fs_device *vol, alist *lst) {
+      int ret = 0;
+      arg_parser cmd;
+      uint32_t   dev=0;
+      char      *mp=NULL, *fstype=NULL, *device=Device;
+
+      reset();
+      set_device(vol->device);
+      set_mountpoint(vol->mountpoint);
+      set_fstype(vol->fstype);
+
+      if (!do_command("subvolumes", &cmd)) {
+         goto bail_out;
+      }
+
+      for (int i = 0; i < cmd.argc ; i++) {
+         if (strcasecmp(cmd.argk[i], "Dev") == 0 && cmd.argv[i]) {
+            dev = str_to_int64(cmd.argv[i]);
+
+         } else if (strcasecmp(cmd.argk[i], "MountPoint") == 0 && cmd.argv[i]) {
+            mp = cmd.argv[i];
+
+         } else if (strcasecmp(cmd.argk[i], "Device") == 0 && cmd.argv[i]) {
+            device = cmd.argv[i];
+
+         } else if (strcasecmp(cmd.argk[i], "FSType") == 0 && cmd.argv[i]) {
+            fstype = cmd.argv[i];
+            if (mp && fstype && dev) {
+               fs_device *elt = New(fs_device(dev, device, mp, fstype));
+               lst->append(elt);
+               /* reset variables */
+            }
+            dev = 0;
+            mp  = fstype = NULL;
+            device = Device;
+         }
+      }
+      ret = 1;
+
+   bail_out:
+      return ret;
+   };
+
+   /* Prune current snapshots
+    *  - List snapshots available on the director, keep a list locally
+    *  - get mtab, list snapshots for all devices, or devices that are in the director list
+    */
+   int prune(BSOCK *bs) {
+      return 1;
+   };
+
+   /* List local snapshots, list director snapshots, and synchronize the two */
+   int sync(BSOCK *bs) {
+      return 1;
+   };
+
+   /* List files from a snapshot
+    *  Need to set the Volume and the Path
+    */
+   int ls(BSOCK *bs) {
+      return 1;
+   };
+
+   /* Scan common arguments */
+   int scan_arg(arg_parser *cmd) {
+      for (int i = 0; i < cmd->argc ; i++) {
+         if (strcasecmp(cmd->argk[i], "Volume") == 0 && cmd->argv[i]) {
+            pm_strcpy(Volume, cmd->argv[i]);
+
+         } else if (strcasecmp(cmd->argk[i], "CreateDate") == 0 && cmd->argv[i]) {
+            bstrncpy(CreateDate, cmd->argv[i], sizeof(CreateDate));
+            CreateTDate = str_to_utime(CreateDate);
+
+         } else if (strcasecmp(cmd->argk[i], "CreateTDate") == 0 && cmd->argv[i]) {
+            CreateTDate = str_to_int64(cmd->argv[i]);
+            bstrftimes(CreateDate, sizeof(CreateDate), CreateTDate);
+
+         } else if (strcasecmp(cmd->argk[i], "Type") == 0 && cmd->argv[i]) {
+            bstrncpy(Type, cmd->argv[i], sizeof(Type));
+
+         } else if (strcasecmp(cmd->argk[i], "SnapMountPoint") == 0 && cmd->argv[i]) {
+            pm_strcpy(SnapMountPoint, cmd->argv[i]);
+
+         } else if (strcasecmp(cmd->argk[i], "SnapDirectory") == 0 && cmd->argv[i]) {
+            pm_strcpy(SnapDirectory, cmd->argv[i]);
+
+         } else if (strcasecmp(cmd->argk[i], "status") == 0 && cmd->argv[i]) {
+            status = str_to_int64(cmd->argv[i]);
+
+         } else if (strcasecmp(cmd->argk[i], "Device") == 0 && cmd->argv[i]) {
+            pm_strcpy(Device, cmd->argv[i]);
+         }
+      }
+      return 1;
+   };
+
+   /* Create a snapshot with already given attributes
+    *  Need to set Name and Device at the minimum
+    */
+   int create() {
+      int ret = 0;
+      arg_parser cmd;
+
+      if (!*Name || !*Device) {
+         goto bail_out;
+      }
+
+      Dmsg2(DT_SNAPSHOT, "Create Snapshot of %s %s\n", Device, Name);
+
+      /* TODO: see if we handle multiple snapshots per call */
+      if (!do_command("create", &cmd)) {
+         goto bail_out;
+      }
+
+      scan_arg(&cmd);
+      created = 1;
+
+      ret = 1;
+
+   bail_out:
+      return ret;
+   };
+
+   int mount() {
+      arg_parser cmd;
+      status = 0;
+
+      if (!*Name || !*Volume || !*Device || !*Type) {
+         goto bail_out;
+      }
+
+      Dmsg1(DT_SNAPSHOT, "Doing mount of %s\n", Volume);
+
+      if (!do_command("mount", &cmd)) {
+         goto bail_out;
+      }
+
+      *SnapMountPoint = 0;
+
+      scan_arg(&cmd);
+
+      mounted = (status > 0 && *SnapMountPoint);
+
+   bail_out:
+      return status;
+   };
+
+   int unmount() {
+      arg_parser cmd;
+      status = 0;
+
+      if (!*Name || !*SnapMountPoint || !*Type || !mounted) {
+         goto bail_out;
+      }
+
+      Dmsg1(DT_SNAPSHOT, "Doing unmount of a %s\n", SnapMountPoint);
+
+      if (!do_command("unmount", &cmd)) {
+         goto bail_out;
+      }
+
+      scan_arg(&cmd);
+
+      mounted = 0;
+
+   bail_out:
+      return status;
+   };
+
+   /* Delete a snapshot with the given device name */
+   int del() {
+      int ret = 0;
+      arg_parser cmd;
+      if (!*Name || !*Volume || !created) {
+         goto bail_out;
+      }
+      ret = do_command("delete", &cmd);
+   bail_out:
+      return ret;
+   };
+
+   /* TODO: Need to read stdout as well */
+   int do_command(const char *act, arg_parser *cmd) {
+      int ret = 0, rcode;
+      POOLMEM *command = get_pool_memory(PM_FNAME);
+      POOLMEM *out = get_pool_memory(PM_FNAME);
+
+      set_action(act);
+      edit_snapshot_codes(&command, me->snapshot_command);
+      edit_snapshot_env();
+
+      Dmsg1(DT_SNAPSHOT|20, "Execute %s command\n", act);
+
+      if (*command == 0) {
+         Mmsg(errmsg, _("Error while creating command string %s.\n"), act);
+         Dmsg1(DT_SNAPSHOT, "%s", errmsg);
+         goto bail_out;
+      }
+
+      /* If the exit code is 1, we can expect to have a clear error
+       * message in the output
+       */
+      if ((rcode = run_program_full_output(command, 600, out, env)) != 0) {
+         if ((rcode & ~b_errno_exit) == 1) { /* exit 1, look the output */
+            if (cmd->parse_cmd(out) == bRC_OK) {
+               int i = cmd->find_arg_with_value("status");
+               if (i >= 0) {
+                  /* If we have a status, take it */
+                  status = str_to_int64(cmd->argv[i]);
+               } else {
+                  status = 0;
+               }
+               i = cmd->find_arg_with_value("error");
+               if (i >= 0) {
+                  pm_strcpy(errmsg, cmd->argv[i]);
+                  Dmsg1(DT_SNAPSHOT|20, "%s\n", errmsg);
+                  goto bail_out;
+               }
+            }
+         }
+         berrno be;
+         Mmsg(errmsg, _("Error while executing \"%s\" %s. %s %s\n"), 
+              act, command, out, be.bstrerror());
+         Dmsg1(DT_SNAPSHOT, "%s", errmsg);
+         goto bail_out;
+      }
+
+      /* Need to decode the output of the script
+       * TODO: some commands will have multiple lines
+       */
+      if (cmd->parse_cmd(out) != bRC_OK) {
+         Dmsg2(DT_SNAPSHOT, "snapshot command %s output error: [%s]\n", act, out);
+         Mmsg(errmsg, _("Unable to parse snapshot command output\n"));
+         goto bail_out;
+      }
+      Dmsg1(DT_SNAPSHOT|50, "ret = %s\n", out);
+      ret = 1;
+   bail_out:
+      free_pool_memory(command);
+      free_pool_memory(out);
+      return ret;
+   };
+
+   int list(alist *lst) {
+      Dmsg0(DT_SNAPSHOT, "Doing list of a snapshots of a given device\n");
+      snapshot  *snap;
+      arg_parser cmd;
+      int i, ret=0, status=1;
+      char *volume=NULL, *name=NULL, *device=NULL, *createdate=NULL, *error=NULL;
+      utime_t createtdate = 0;
+
+      /* TODO: Here we need to loop over a list */
+      if (!do_command("list", &cmd)) {
+         goto bail_out;
+      }
+      ret = 1;
+
+      /* should get
+       * volume=xxx device=zzzz name=yyy createtdate=12121212 size=xx status=xx error=xx type=lvm
+       */
+      for (i = 0; i < cmd.argc ; i++) {
+         if (strcasecmp(cmd.argk[i], "Volume") == 0) {
+            volume = cmd.argv[i];
+
+         } else if (strcasecmp(cmd.argk[i], "Name") == 0) {
+            name = cmd.argv[i];
+
+         } else if (strcasecmp(cmd.argk[i], "Device") == 0) {
+            device = cmd.argv[i];
+
+         } else if (strcasecmp(cmd.argk[i], "Error") == 0) {
+            error = cmd.argv[i];
+
+         } else if (strcasecmp(cmd.argk[i], "Status") == 0) {
+            status = str_to_int64(cmd.argv[i]);
+
+         } else if (strcasecmp(cmd.argk[i], "Type") == 0) {
+            snap = New(snapshot(jcr));
+            pm_strcpy(snap->Volume, volume);
+            pm_strcpy(snap->Device, NPRTB(device));
+            bstrncpy(snap->Name, NPRTB(name), sizeof(snap->Name));
+            bstrncpy(snap->Type, cmd.argv[i], sizeof(snap->Type));
+            bstrncpy(snap->CreateDate, createdate, sizeof(snap->CreateDate));
+            pm_strcpy(snap->errmsg, NPRTB(error));
+            snap->status = status;
+            snap->CreateTDate = createtdate;
+            error = createdate = device = name = volume = NULL;
+            status = 1;
+            createtdate = 0;
+            lst->append(snap);
+
+         } else if (strcasecmp(cmd.argk[i], "CreateTDate") == 0) {
+            createtdate = str_to_int64(cmd.argv[i]);
+
+         } else if (strcasecmp(cmd.argk[i], "CreateDate") == 0) {
+            createdate = cmd.argv[i];
+            createtdate = str_to_utime(cmd.argv[i]);
+         }
+      }
+   bail_out:
+      return ret;
+   };
+
+   /* Query information about snapshot */
+   int query() {
+      Dmsg0(0, "Doing query of a snapshot\n");
+      arg_parser cmd;
+      int i, ret=0;
+
+      if (!*Volume) {
+         goto bail_out;
+      }
+
+      if (!do_command("query", &cmd)) {
+         goto bail_out;
+      }
+
+      if ((i = cmd.find_arg_with_value("size")) >= 0) {
+         size = str_to_int64(cmd.argv[i]);
+      }
+
+      if ((i = cmd.find_arg_with_value("status")) >= 0) {
+         status = str_to_int64(cmd.argv[i]);
+      }
+
+      ret = 1;
+
+   bail_out:
+      return ret;
+   };
+
+   /* Quickly unbash all attributes after a sscanf */
+   void unbash_spaces() {
+      ::unbash_spaces(Volume);
+      ::unbash_spaces(Device);
+      ::unbash_spaces(path);
+      ::unbash_spaces(Name);
+      ::unbash_spaces(CreateDate);
+      ::unbash_spaces(errmsg);
+   };
+
+   void bash_spaces() {
+      ::bash_spaces(Volume);
+      ::bash_spaces(Device);
+      ::bash_spaces(path);
+      ::bash_spaces(Name);
+      ::bash_spaces(CreateDate);
+      ::bash_spaces(errmsg);
+   };
+
+   /* Quicky make sure we have enough space to handle the request */
+   void check_buffer_size(int len) {
+      Volume = check_pool_memory_size(Volume, len);
+      Device = check_pool_memory_size(Device, len);
+      path   = check_pool_memory_size(path, len);
+   };
+
+   /* Create Catalog entry for the current snapshot */
+   int create_catalog_entry() {
+      int ret = 0;
+      char ed1[50];
+      bash_spaces();
+      jcr->dir_bsock->fsend(CreateSnap,
+                            jcr->Job, Name, Volume,
+                            Device, CreateTDate, Type, edit_uint64(Retention, ed1));
+      if (jcr->dir_bsock->recv() < 0) {
+         Mmsg(errmsg, _("Unable to create snapshot record. ERR=%s\n"),
+              jcr->dir_bsock->bstrerror());
+
+      } else if (strncmp(jcr->dir_bsock->msg, "1000", 4) != 0) {
+         Mmsg(errmsg, _("Unable to create snapshot record, got %s\n"),
+              jcr->dir_bsock->msg);
+
+      } else {
+         ret = 1;               /* OK */
+      }
+      unbash_spaces();
+      return ret;
+   };
+
+   /* Delete Catalog entry of the current snapshot */
+   int delete_catalog_entry() {
+      int ret = 0;
+      bash_spaces();
+      jcr->dir_bsock->fsend(DelSnap, jcr->Job, Name, Device);
+
+      if (jcr->dir_bsock->recv() < 0) {
+         Mmsg(errmsg, _("Unable to delete snapshot record. ERR=%s\n"),
+              jcr->dir_bsock->bstrerror());
+
+      } else if (strncmp(jcr->dir_bsock->msg, "1000", 4) != 0) {
+         Mmsg(errmsg, _("Unable to delete snapshot record, got %s\n"),
+              jcr->dir_bsock->msg);
+
+      } else {
+         ret = 1;               /* OK */
+      }
+
+      unbash_spaces();
+      return ret;
+   };
+
+   /* Get Catalog entry of the current snapshot */
+   int get_catalog_entry() {
+      int ret = 0;
+      arg_parser cmd;
+
+      if (!*Name || !*Volume) {
+         return ret;
+      }
+
+      bash_spaces();
+      jcr->dir_bsock->fsend(GetSnap, jcr->Job, Name, Volume);
+
+      if (jcr->dir_bsock->recv() < 0) {
+         Mmsg(errmsg, _("Unable to get snapshot record. ERR=%s\n"),
+              jcr->dir_bsock->bstrerror());
+
+      } else if (strncmp(jcr->dir_bsock->msg, "1000", 4) != 0) {
+         Mmsg(errmsg, _("Unable to get snapshot record, got %s\n"),
+              jcr->dir_bsock->msg);
+
+      } else {
+         if (cmd.parse_cmd(jcr->dir_bsock->msg) != bRC_OK) {
+            Mmsg(errmsg, _("Unable to parse command output\n"));
+            scan_arg(&cmd);     /* Fill all parameters from director */
+
+         } else {
+            ret = 1;               /* OK */
+         }
+      }
+
+      unbash_spaces();
+      return ret;
+   };
+
+};
+
+/* Should be after snapshot declaration */
+void fs_device::destroy() {
+   if (fstype) {
+      free(fstype);
+      fstype = NULL;
+   }
+   if (mountpoint) {
+      free(mountpoint);
+      mountpoint = NULL;
+   }
+   if (device) {
+      free(device);
+      device = NULL;
+   }
+   if (snap) {
+      delete snap;
+      snap = NULL;
+   }
+}
+
+bool fs_device::can_do_snapshot() {
+   if (snap && !supportSnapshotTested) {
+      if (snap->support_snapshot(this)) {
+         Dmsg2(DT_SNAPSHOT, "%s suitable for snapshot, type %s\n",
+               mountpoint, snap->Type);
+         isSuitableForSnapshot = true;
+
+      } else {
+         Dmsg2(DT_SNAPSHOT, "%s is not suitable for snapshot, type %s\n",
+               mountpoint, snap->Type);
+      }
+      supportSnapshotTested = true;
+   }
+   return isSuitableForSnapshot;
+}
+
+/* Should be after the snapshot declaration */
+fs_device *mtab::search(char *file) {
+   struct stat statp;
+   if (lstat(file, &statp) != 0) {
+      Dmsg1(DT_SNAPSHOT, "%s not found\n", file);
+      return NULL;              /* not found */
+   }
+   
+   fs_device *elt = (fs_device *)entries->search((void *)((intptr_t)(statp.st_dev)),
+                                                 search_entry);
+   if (!elt) {
+      Dmsg2(DT_SNAPSHOT, "Device %d for file %s not found in our mount list\n",
+            statp.st_dev, file);
+      return NULL;        /* not found in our list, skip it */
+   }
+
+   if (!elt->can_do_snapshot()) {
+      Dmsg2(DT_SNAPSHOT, "Device %d for file %s not snapshotable\n",
+            statp.st_dev, file);
+      return NULL;
+   }
+   Dmsg2(DT_SNAPSHOT, "Found device %d for file %s\n", elt->dev, file);
+   return elt;
+}
+
+/* Application to quiesce/un-quiesce */
+struct app {
+   BPIPE *fd;                   /* Communication channel */
+   char  *name;                 /* Pointer to the script name */
+   char   cmd[1];               /* Command line */
+};
+
+/* In the application manager, we want to run a set
+ * of scripts and see if applications are running or
+ * not on our partitions.
+ *
+ * We can specify application in the fileset, or just
+ * try all application that are installed.
+ *
+ */
+class app_manager: public SMARTALLOC
+{
+private:
+   JCR     *jcr;
+   char    *appdir;             /* Where to find application scripts */
+   alist   *applst;             /* Application list (script list to call) */
+   int      apptimeout;         /* Timeout when trying to quiesce application */
+   mtab    *mount_list;         /* snapshot set */
+
+public:
+    app_manager(JCR *ajcr, mtab *m, char *dir): 
+      jcr(ajcr),
+      appdir(dir),
+      applst(New(alist(10, owned_by_alist))),
+      apptimeout(300),
+      mount_list(m) {};
+
+   ~app_manager() {
+      delete applst;
+   };
+
+   /* Put in a file the list of all devices that
+    * are in the snapshot set
+    */
+   bool dump_snapshotset() {
+      return true;
+   };
+
+   /* Scan application */
+   bool scan() {
+      POOLMEM *results;
+      bool  ret=false;
+      char *end, *start;
+      struct stat sp;
+      struct app *elt = NULL;
+
+      if (!appdir || !*appdir || stat(appdir, &sp) == -1) {
+         Dmsg0(DT_SNAPSHOT, "app not configured\n");
+         return true;
+      }
+
+      /* Create a file with the list of all devices that are suitable
+       * for snapshot
+       */
+      dump_snapshotset();
+
+      results = get_pool_memory(PM_FNAME);
+      if (run_program_full_output((char*)APPMANAGER_CMD, apptimeout, results) != 0) {
+         berrno be;
+         Dmsg2(DT_SNAPSHOT, "app scan error results=%s ERR=%s\n", results, be.bstrerror());
+         goto bail_out;
+      }
+
+      ret = true;
+      start = results;
+
+      /* Put each line of the output in our list */
+      for (start = results; start && *start;) {
+         end = strchr(start, '\n');
+         if (end) {
+            *end = 0;
+            elt = (struct app *) malloc(sizeof(struct app) + strlen(start) + 1);
+
+            elt->fd = NULL;
+            strcpy(elt->cmd, start);
+            elt->name = (char *)last_path_separator(elt->cmd);
+            if (elt->name) {
+               elt->name++;
+
+            } else {
+               elt->name = elt->cmd;
+            }
+ 
+            applst->append(elt);
+            Dmsg2(10, "+ %s (%s)\n", elt->name, elt->cmd);
+            *end = '\n';
+            end++;
+         }
+         start = end;
+      }
+   bail_out:
+      free_pool_memory(results);
+      return ret;
+   };
+
+   bool unquiesce() {
+      if (applst->size() == 0) {
+         return true;
+      }
+
+      Jmsg(jcr, M_INFO, 0, _("Un-Quiescing applications\n"));
+      return true;
+   };
+
+   /* Quiesce applications */
+   bool quiesce() {
+      bool ret = true;
+
+      if (applst->size() == 0) {
+         return true;
+      }
+
+      Jmsg(jcr, M_INFO, 0, _("Quiescing applications\n"));
+
+      for (int i = 0 ; i < applst->size() ; i++) {
+         struct app *elt = (struct app *) applst->get(i);
+         elt->fd = open_bpipe(elt->cmd, 0, "rw");
+         if (!elt->fd) {
+            /* Unable to execute the program */
+            continue;
+         }
+         /* Send some commands here */
+      }
+      return ret;
+   };
+};
+
+snapshot_manager::snapshot_manager(JCR *ajcr):
+   jcr(ajcr), mount_list(New(mtab())) {
+}
+
+snapshot_manager::~snapshot_manager() {
+   delete mount_list;
+}
+
+bool snapshot_manager::cleanup_snapshots()
+{
+   fs_device *elt;
+   foreach_rblist(elt, mount_list->entries) {
+      if (elt->can_do_snapshot() && elt->inSnapshotSet) {
+         snapshot *s = elt->snap;
+         if (!s->created) {
+            continue;
+         }
+         if (s->unmount()) {
+            /* TODO: Display an error? Can check mounted status */
+         }
+         /* When no retention is set, we delete the snapshot
+          * just after the backup
+          */
+         if (s->Retention == 0) {
+            if (s->del()) {
+               Jmsg(jcr, M_INFO, 0, _("   Delete Snapshot for %s\n"), elt->mountpoint);
+
+            } else {
+               Jmsg(jcr, M_ERROR, 0, _("   Unable to delete snapshot of %s ERR=%s\n"),
+                    elt->mountpoint, s->errmsg);
+            }
+         }
+      }
+   }
+   return true;
+}
+
+bool snapshot_manager::create_snapshots()
+{
+   /* No snapshot, no quiescing */
+   if (mount_list->empty()) {
+      Dmsg0(DT_SNAPSHOT, "The mount list is empty, no snapshot to take\n");
+      return false;
+   }
+
+   /* First thing to do is to quiesce application */
+   app_manager apps(jcr, mount_list, (char *)APP_DIR);
+
+   /* TODO: Let see if we really need to abort
+    * the snapshot part if application 
+    */
+   if (!apps.scan()) {
+      return false;
+   }
+
+   if (!apps.quiesce()) {
+      return false;
+   }
+
+   fs_device *elt;
+   foreach_rblist(elt, mount_list->entries) {
+      if (elt->can_do_snapshot() && elt->inSnapshotSet) {
+         snapshot *s = elt->snap;
+         if (s->create()) {
+            Jmsg(jcr, M_INFO, 0, _("   Create Snapshot for %s\n"), elt->mountpoint);
+
+            if (s->Retention > 0) {/* Create snapshot catalog entry if we need to keep them */
+               s->create_catalog_entry();
+            }
+
+         } else if (s->status == 2) { /* Use Error message */
+            elt->isSuitableForSnapshot = false; /* Disable snapshot for this device */
+            Jmsg(jcr, M_ERROR, 0, _("   Unable to create snapshot of %s ERR=%s\n"),
+                 elt->mountpoint, s->errmsg);
+
+         } else {               /* By default, an error in the creation should be fatal */
+            Jmsg(jcr, M_FATAL, 0, _("   Unable to create snapshot of %s ERR=%s\n"),
+                 elt->mountpoint, s->errmsg);
+            apps.unquiesce();
+            return false;
+         }
+
+      } else {
+         Dmsg3(DT_SNAPSHOT|20, "No Snapshot for %s suitable=%d inset=%d\n",
+               elt->mountpoint, elt->isSuitableForSnapshot, elt->inSnapshotSet);
+      }
+   }
+
+   /* Snapshots are ok, we need to release applications */
+   if (!apps.unquiesce()) {
+      return false;
+   }
+
+   /* Save the include context */
+   POOL_MEM t;
+   findINCEXE *old = get_incexe(jcr);
+   findINCEXE *exclude = NULL;
+   foreach_rblist(elt, mount_list->entries) {
+      if (elt->can_do_snapshot() && elt->inSnapshotSet) {
+         snapshot *s = elt->snap;
+
+         if (!s->mount()) {
+            Jmsg(jcr, M_ERROR, 0, "   Unable to mount snapshot %s ERR=%s\n",
+                 elt->mountpoint, s->errmsg);
+
+         } else if (*s->SnapDirectory) {
+            if (!exclude) {
+               exclude = new_exclude(jcr);
+               /* Set the Exclude context */
+               set_incexe(jcr, exclude);
+            }
+            Mmsg(t, "%s/.snapshots", elt->snap->SnapMountPoint);
+            Dmsg1(DT_SNAPSHOT|10, "Excluding %s\n", t.c_str());
+            add_file_to_fileset(jcr, t.c_str(), true);
+         }
+      }
+   }
+
+   /* Restore the current context */
+   if (exclude) {
+      set_incexe(jcr, old);
+   }
+   return true;
+}
+
+/* TODO: We might want to use some filters here */
+bool snapshot_manager::list_snapshots(alist *lst)
+{
+   fs_device *elt;
+
+   /* No device, no snapshot */
+   if (mount_list->dCount == 0) {
+      Dmsg0(DT_SNAPSHOT, "mount list is empty, no snapshot\n");
+      return false;
+   }
+
+   foreach_rblist(elt, mount_list->entries) {
+      if (elt->can_do_snapshot()) {
+         elt->snap->list(lst);
+      }
+   }
+   return true;
+}
+
+void snapshot_manager::add_mount_point(uint32_t dev, const char *device,
+                                       const char *mountpoint, const char *fstype)
+{
+   bool       check=true;
+   alist      list(10, not_owned_by_alist);
+   fs_device *vol = New(fs_device(dev, device, mountpoint, fstype));
+
+   /* These FS are not supposed to use snapshot */
+   const char *specialmp[] = {
+      "/proc/",
+      "/sys/",
+      NULL
+   };
+   /* These FS are not supposed to use snapshot */
+   const char *specialfs[] = {
+      "autofs",
+      "binfmt_misc",
+      "cgroup",
+      "configfs",
+      "debugfs",
+      "dev",
+      "devpts",
+      "devtmpfs",
+      "ecryptfs",
+      "fuse.gvfsd-fuse",
+      "fusectl",
+      "fd",
+      "hugetlbfs",
+      "mqueue",
+      "proc",
+      "pstore",
+      "rpc_pipefs",
+      "securityfs",
+      "selinuxfs",
+      "sysfs",
+      "systemd-1",
+      "tmpfs",
+      NULL
+   };
+
+   /* We skip directly /proc, /sys */
+   for (int i=0; specialmp[i] ; i++) {
+      if (strncasecmp(specialmp[i], mountpoint, strlen(specialmp[i])) == 0) {
+         check = false;
+         break;
+      }
+   }
+
+   if (check) {
+      for (int i=0; specialfs[i] ; i++) {
+         if (strcasecmp(specialfs[i], fstype) == 0) {
+            check = false;
+            break;
+         }
+      }
+   }
+
+   if (check) {
+      snapshot *snap = New(snapshot(jcr));
+      snap->set_name(jcr->Job);
+      vol->snap = snap;
+
+      if (snap->scan_subvolumes(vol, &list)) {
+         for (int i = list.size() - 1 ; i >= 0 ; i--) {
+            fs_device *d = (fs_device *)list.remove(i);
+            add_mount_point(d->dev, d->device, d->mountpoint, d->fstype);
+            delete d;
+         }
+      }
+   }
+
+   Dmsg4(DT_SNAPSHOT|20, "Adding %s dev=%d snap?=%d to the mount list (%d)\n",
+         mountpoint, dev, check, mount_list->dCount);
+
+   if (!mount_list->add_entry(vol)) {
+      Dmsg1(DT_SNAPSHOT, "%s Already exists in mount list\n", vol->mountpoint);
+      delete vol;
+   }
+}
+
+/* In this handler, we need to fill a mtab structure */
+static void add_handler(void *user_ctx,
+                        struct stat *st,
+                        const char *fstype,
+                        const char *mountpoint,
+                        const char *mntopts,
+                        const char *device)
+{
+   Dmsg5(DT_SNAPSHOT|50, "dev=%ld device=%s mountpoint=%s fstype=%s mntopts=%s\n",
+         st->st_dev, device, mountpoint, fstype, mntopts);
+
+   /* TODO: If the fstype is btrfs or zfs, the fs might contains subvolumes,
+    * and these subvolumes may not be reported in the mntent list. In this
+    * case, we need to call proper btrfs/zfs commands to list them.
+    *   # btrfs subvolume list /mnt
+    *   ID 256 gen 17 top level 5 path test
+    *   ID 259 gen 18 top level 5 path test/titi
+    */
+   snapshot_manager *snapmgr = (snapshot_manager *)user_ctx;
+   snapmgr->add_mount_point(st->st_dev, device, mountpoint, fstype);
+}
+
+bool snapshot_manager::scan_mtab()
+{
+   return read_mtab(add_handler, this);
+}
+
+
+/* Scan the fileset to select partitions to snapshot */
+bool snapshot_manager::scan_fileset()
+{
+   if (!jcr->ff || !jcr->ff->fileset) {
+      Dmsg0(DT_SNAPSHOT, "No fileset associated with JCR\n");
+      return false;
+   }
+
+   findFILESET *fileset = jcr->ff->fileset;
+   dlistString *node;
+   int64_t      flags = 0;
+
+   for (int i=0; i<fileset->include_list.size(); i++) {
+
+      findFOPTS  *fo;
+      findINCEXE *incexe = (findINCEXE *)fileset->include_list.get(i);
+
+      /* look through all files */
+      foreach_dlist(node, &incexe->name_list) {
+         char *fname = node->c_str();
+         if (mount_list->add_in_snapshot_set(fname, &incexe->name_list, node)) {
+            /* When all volumes are selected, we can stop */
+            Dmsg0(DT_SNAPSHOT, "All Volumes are marked, stopping the loop here\n");
+            goto all_included;
+         }
+      }
+
+      foreach_alist(fo, &incexe->opts_list) {
+         flags |= fo->flags; /* We are looking for FO_MULTIFS and recurse */
+      }
+   }
+
+all_included:
+   /* If we allow recursion and multifs, we need to include sub volumes by hand
+    * in the backup list
+    */
+   if (flags & FO_MULTIFS) {
+      fs_device *elt, *elt2;
+
+      foreach_rblist(elt, mount_list->entries) {
+         if (!elt->inFileSet) {
+            continue;
+         }
+         alist     *lst = New(alist(10, not_owned_by_alist));
+         mount_list->get_subvolumes(elt->dev, lst, jcr->ff);
+         foreach_alist(elt2, lst) {
+            if (elt2->inFileSet) {
+               continue;
+            }
+
+            /* TODO: See how to avoid having two entries for the same directory */
+            /* Add the directory explicitely in the fileset */
+            elt->include->insert_after(new_dlistString(elt2->mountpoint), elt->node);
+
+            if (mount_list->add_in_snapshot_set(elt2, elt->include, elt->node)) {
+               /* When all volumes are selected, we can stop */
+               Dmsg0(DT_SNAPSHOT, "All Volumes are marked, stopping the loop here\n");
+               delete lst;
+               return true;
+            }
+         }
+         delete lst;
+      }
+   }
+   return true;
+}
+
+int snapshot_cmd(JCR *jcr)
+{
+   BSOCK *dir = jcr->dir_bsock;
+   int n, ret = 1;
+   char ed1[50];
+   snapshot snap(jcr);
+   snap.check_buffer_size(dir->msglen);
+
+   n = sscanf(dir->msg, QueryCmd, snap.Name, snap.Volume, snap.Device, &snap.CreateTDate, snap.Type);
+   if (n == 5) {
+      snap.unbash_spaces();
+      Dmsg0(DT_SNAPSHOT|10, "Doing query of a snapshot\n");
+      n = snap.query();
+      bash_spaces(snap.errmsg);
+      dir->fsend("%d Snapshot status=%d size=%lld ERR=%s\n", n?2000:2999, snap.status, snap.size, snap.errmsg);
+      goto bail_out;
+   }
+
+   n = sscanf(dir->msg, LsCmd, snap.Name, snap.Volume, snap.Device, &snap.CreateTDate, snap.Type, snap.path);
+   if (n == 6) {
+      snap.unbash_spaces();
+      Dmsg0(DT_SNAPSHOT|10, "Doing ls of a snapshot\n");
+      n = snap.ls(dir);
+      dir->signal(BNET_EOD);
+      goto bail_out;
+   }
+
+   n = sscanf(dir->msg, DelCmd, snap.Name, snap.Volume, snap.Device, &snap.CreateTDate, snap.Type);
+   if (n == 5) {
+      Dmsg0(DT_SNAPSHOT|10, "Doing del of a snapshot\n");
+      snap.unbash_spaces();
+      n = snap.del();
+      bash_spaces(snap.errmsg);
+      dir->fsend("%d Snapshot deleted ERR=%s\n", n?2000:2999, snap.errmsg);
+      goto bail_out;
+   }
+
+   n = sscanf(dir->msg, PruneCmd, snap.Volume, snap.Type);
+   if (n == 2) {
+      snap.unbash_spaces();
+      n = snap.prune(dir);
+      bash_spaces(snap.errmsg);
+      dir->fsend("%d Snapshot pruned ERR=%s\n", n?2000:2999, snap.errmsg);
+      Dmsg0(DT_SNAPSHOT|10, "Doing pruning of snapshots\n");
+      goto bail_out;
+   }
+
+   n = sscanf(dir->msg, SyncCmd, snap.Volume, snap.Type);
+   if (n == 2) {
+      snap.unbash_spaces();
+      n = snap.sync(dir);
+      bash_spaces(snap.errmsg);
+      dir->fsend("%d Snapshot synced ERR=%s\n", n?2000:2999, snap.errmsg);
+      Dmsg0(DT_SNAPSHOT|10, "Doing sync of snapshots\n");
+      goto bail_out;
+   }
+
+   /* TODO: Include a path name or a device name */
+   if (strncmp(dir->msg, ListCmd, strlen(ListCmd)) == 0) {
+      snapshot *elt;
+      char      ed1[50];
+      alist    *lst = New(alist(10, not_owned_by_alist));
+      list_all_snapshots(jcr, lst);
+      foreach_alist(elt, lst) {
+         elt->bash_spaces();
+         dir->fsend("volume=\"%s\" createtdate=\"%s\" name=\"%s\" device=\"%s\" status=%d error=\"%s\" type=\"%s\"\n",
+                    elt->Volume, edit_uint64(elt->CreateTDate, ed1), 
+                    elt->Name, elt->Device, elt->status, elt->errmsg, elt->Type);
+         delete elt;
+      }
+      delete lst;
+      dir->signal(BNET_EOD);      
+      goto bail_out;
+   }
+
+   n = sscanf(dir->msg, ConfCmd, ed1);
+   if (n == 1) {
+      jcr->snapshot_retention = str_to_uint64(ed1);
+      dir->fsend("2000 Snapshot retention\n");
+      goto bail_out;
+   }
+
+   dir->fsend("2999 Snapshot command not found\n");
+   dir->signal(BNET_EOD);
+   ret = 0;
+
+bail_out:
+   return ret;
+}
+
+bool snapshot_convert_path(JCR *jcr, FF_PKT *ff, dlist *filelist, dlistString *node)
+{
+   Dmsg1(DT_SNAPSHOT, "snapshot_convert_path(%s)\n", ff->top_fname);
+   snapshot_manager *snapmgr = jcr->snap_mgr;
+   ff->strip_snap_path = false;
+
+   if (!snapmgr) {
+      return true;
+   }
+
+   fs_device *elt = snapmgr->mount_list->search(ff->top_fname);
+   if (!elt) {
+      return true;              /* not found */
+   }
+
+   if (!ff->snap_fname) {
+      ff->snap_fname = get_pool_memory(PM_FNAME);
+   }
+
+   /* Convert the filename to the original path */
+   if (!elt->snap->convert_path(ff)) {
+      Dmsg2(DT_SNAPSHOT, "Device %d for file %s not snapshotable\n",
+            elt->dev, ff->top_fname);
+      return true;
+   }
+   return true;
+}
+
+/* ListSnap[] = "CatReq Job=%s list_snapshot name=%s volume=%s device=%s tdate=%d type=%s before=%s after=%s expired=%d"; */
+
+/* List Catalog entry of the current client */
+int snapshot_list_catalog(JCR *jcr,
+                          const char *query,
+                          alist *lst)
+{
+   int ret = 0, i;
+   arg_parser cmd;
+   POOL_MEM q, tmp;
+   if (cmd.parse_cmd(query) != bRC_OK) {
+      Dmsg1(DT_SNAPSHOT, "Unable to decode query %s\n", query);
+      return 0;
+   }
+   Mmsg(q, "CatReq Job=%s list_snapshot name=", jcr->Job);
+   if ((i = cmd.find_arg_with_value("name")) >= 0) {
+      bash_spaces(cmd.argv[i]);
+      pm_strcat(q, cmd.argv[i]);
+   }
+
+   pm_strcat(q, " volume=");
+   if ((i = cmd.find_arg_with_value("volume")) >= 0) {
+      bash_spaces(cmd.argv[i]);
+      pm_strcat(q, cmd.argv[i]);
+   }
+
+   pm_strcat(q, " device=");
+   if ((i = cmd.find_arg_with_value("device")) >= 0) {
+      bash_spaces(cmd.argv[i]);
+      pm_strcat(q, cmd.argv[i]);
+   }
+
+   pm_strcat(q, " tdate=");
+   if ((i = cmd.find_arg_with_value("tdate")) >= 0) {
+      bash_spaces(cmd.argv[i]);
+      pm_strcat(q, cmd.argv[i]);
+   }
+
+   pm_strcat(q, " type=");
+   if ((i = cmd.find_arg_with_value("type")) >= 0) {
+      bash_spaces(cmd.argv[i]);
+      pm_strcat(q, cmd.argv[i]);
+   }
+
+   pm_strcat(q, " before=");
+   if ((i = cmd.find_arg_with_value("before")) >= 0) {
+      bash_spaces(cmd.argv[i]);
+      pm_strcat(q, cmd.argv[i]);
+   }
+
+   pm_strcat(q, " after=");
+   if ((i = cmd.find_arg_with_value("after")) >= 0) {
+      bash_spaces(cmd.argv[i]);
+      pm_strcat(q, cmd.argv[i]);
+   }
+
+   pm_strcat(q, " expired=");
+   if ((i = cmd.find_arg_with_value("expired")) >= 0) {
+      bash_spaces(cmd.argv[i]);
+      pm_strcat(q, cmd.argv[i]);
+   }
+
+   jcr->dir_bsock->fsend("%s\n", q.c_str());
+
+   while (jcr->dir_bsock->recv() > 0) {
+      if (cmd.parse_cmd(jcr->dir_bsock->msg) != bRC_OK) {
+         Dmsg1(DT_SNAPSHOT, "Unable to decode director output %s\n", jcr->dir_bsock->msg);
+
+      } else {
+         ret = 1;               /* OK */
+         snapshot *s = New(snapshot(jcr));
+         s->scan_arg(&cmd);
+         lst->append(s);
+      }
+   }
+   return ret;
+}
diff --git a/src/filed/fd_snapshot.h b/src/filed/fd_snapshot.h
new file mode 100644
index 0000000..5d670de
--- /dev/null
+++ b/src/filed/fd_snapshot.h
@@ -0,0 +1,68 @@
+/*
+   Bacula(R) - The Network Backup Solution
+
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
+
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
+
+   You may use this file and others of this release according to the
+   license defined in the LICENSE file, which includes the Affero General
+   Public License, v3.0 ("AGPLv3") and some additional permissions and
+   terms pursuant to its AGPLv3 Section 7.
+
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
+
+   Written by Eric Bollengier 2015
+*/
+
+#ifndef FD_SNAPSHOT_H
+#define FD_SNAPSHOT_H
+
+/* default snapshot handler */
+char *snapshot_get_command();
+
+/* Internal objects */
+class mtab;                     /* device list */
+class fs_device;
+
+class snapshot_manager: public SMARTALLOC
+{
+private:
+   JCR  *jcr;
+public:
+   mtab *mount_list;
+
+   snapshot_manager(JCR *ajcr);
+   virtual ~snapshot_manager();
+
+   /* Quiesce application and take snapshot */
+   bool create_snapshots();
+   
+   /* Cleanup snapshots */
+   bool cleanup_snapshots();
+
+   /* List snapshots */
+   bool list_snapshots(alist *ret);
+
+   /* Scan the fileset for devices and application */
+   bool scan_fileset();
+
+   /* Scan the mtab */
+   bool scan_mtab();
+
+   /* Add a mount point to the mtab list */
+   void add_mount_point(uint32_t dev, const char *device, 
+                        const char *mountpoint, const char *fstype);
+};
+
+void close_snapshot_backup_session(JCR *jcr);
+bool open_snapshot_backup_session(JCR *jcr);
+
+bool snapshot_convert_path(JCR *jcr, FF_PKT *ff, dlist *filelist, dlistString *node);
+
+#endif  /* FD_SNAPSHOT_H */
diff --git a/src/filed/filed.c b/src/filed/filed.c
index 69d5aa9..8e273bf 100644
--- a/src/filed/filed.c
+++ b/src/filed/filed.c
@@ -1,28 +1,31 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *  Bacula File Daemon
  *
- *    Written by Kern Sibbald, March MM
+ *    Kern Sibbald, March MM
  *
  */
 
 #include "bacula.h"
 #include "filed.h"
-#include "lib/mntent_cache.h"
 
 /* Imported Functions */
 extern void *handle_connection_request(void *dir_sock);
@@ -37,7 +40,10 @@ bool no_signals = false;
 void *start_heap;
 extern struct s_cmds cmds[];
 
-#define CONFIG_FILE "bacula-fd.conf" /* default config file */
+#ifndef CONFIG_FILE                   /* Might be overwritten */
+ #define CONFIG_FILE "bacula-fd.conf" /* default config file */
+ #define PROG_NAME   "bacula-fd"
+#endif
 
 char *configfile = NULL;
 static bool foreground = false;
@@ -48,23 +54,23 @@ static CONFIG *config;
 static void usage()
 {
    fprintf(stderr, _(
-PROG_COPYRIGHT
-"\n%sVersion: %s (%s)\n\n"
-"Usage: bacula-fd [-f -s] [-c config_file] [-d debug_level]\n"
-"     -c <file>        use <file> as configuration file\n"
-"     -d <n>[,<tags>]  set debug level to <nn>, debug tags to <tags>\n"
-"     -dt              print a timestamp in debug output\n"
-"     -f               run in foreground (for debugging)\n"
-"     -g               groupid\n"
-"     -k               keep readall capabilities\n"
-"     -m               print kaboom output (for debugging)\n"
-"     -s               no signals (for debugging)\n"
-"     -t               test configuration file and exit\n"
-"     -T               set trace on\n"
-"     -u               userid\n"
-"     -v               verbose user messages\n"
-"     -?               print this message.\n"
-"\n"), 2000, "", VERSION, BDATE);
+      PROG_COPYRIGHT
+      "\nVersion: %s (%s)\n\n"
+      "Usage: bacula-fd [-f -s] [-c config_file] [-d debug_level]\n"
+      "     -c <file>        use <file> as configuration file\n"
+      "     -d <n>[,<tags>]  set debug level to <nn>, debug tags to <tags>\n"
+      "     -dt              print a timestamp in debug output\n"
+      "     -f               run in foreground (for debugging)\n"
+      "     -g               groupid\n"
+      "     -k               keep readall capabilities\n"
+      "     -m               print kaboom output (for debugging)\n"
+      "     -s               no signals (for debugging)\n"
+      "     -t               test configuration file and exit\n"
+      "     -T               set trace on\n"
+      "     -u               userid\n"
+      "     -v               verbose user messages\n"
+      "     -?               print this message.\n"
+      "\n"), 2000, VERSION, BDATE);
 
    exit(1);
 }
@@ -75,9 +81,6 @@ PROG_COPYRIGHT
  *  Main Bacula Unix Client Program
  *
  */
-#if defined(HAVE_WIN32)
-#define main BaculaMain
-#endif
 
 int main (int argc, char *argv[])
 {
@@ -93,7 +96,7 @@ int main (int argc, char *argv[])
    textdomain("bacula");
 
    init_stack_dump();
-   my_name_is(argc, argv, "bacula-fd");
+   my_name_is(argc, argv, PROG_NAME);
    init_msg(NULL, NULL);
    daemon_start_time = time(NULL);
 
@@ -120,7 +123,7 @@ int main (int argc, char *argv[])
                debug_level = 1;
             }
             if (p) {
-               debug_parse_tags(p+1, &debug_level);
+               debug_parse_tags(p+1, &debug_level_tags);
             }
          }
          break;
@@ -197,6 +200,11 @@ int main (int argc, char *argv[])
       configfile = bstrdup(CONFIG_FILE);
    }
 
+   if (!foreground) {
+      daemon_start();
+      init_stack_dump();              /* set new pid */
+   }
+
    config = new_config_parser();
    parse_fd_config(config, configfile, M_ERROR_TERM);
 
@@ -216,18 +224,13 @@ int main (int argc, char *argv[])
       terminate_filed(0);
    }
 
-   if (!foreground) {
-      daemon_start();
-      init_stack_dump();              /* set new pid */
-   }
-
    set_thread_concurrency(me->MaxConcurrentJobs + 10);
    lmgr_init_thread(); /* initialize the lockmanager stack */
 
    /* Maximum 1 daemon at a time */
-   create_pid_file(me->pid_directory, "bacula-fd",
+   create_pid_file(me->pid_directory, PROG_NAME,
                    get_first_port_host_order(me->FDaddrs));
-   read_state_file(me->working_directory, "bacula-fd",
+   read_state_file(me->working_directory, PROG_NAME,
                    get_first_port_host_order(me->FDaddrs));
 
    load_fd_plugins(me->plugin_directory);
@@ -238,6 +241,11 @@ int main (int argc, char *argv[])
    me += 1000000;
 #endif
 
+   /* Setup default value for the the snapshot handler */
+   if (!me->snapshot_command) {
+      me->snapshot_command = snapshot_get_command();
+   }
+
    if (!no_signals) {
       start_watchdog();               /* start watchdog thread */
       init_jcr_subsystem();           /* start JCR watchdogs etc. */
@@ -271,7 +279,6 @@ void terminate_filed(int sig)
    bnet_stop_thread_server(server_tid);
    generate_daemon_event(NULL, "Exit");
    unload_plugins();
-   flush_mntent_cache();
    write_state_file(me->working_directory, "bacula-fd", get_first_port_host_order(me->FDaddrs));
    delete_pid_file(me->pid_directory, "bacula-fd", get_first_port_host_order(me->FDaddrs));
 
@@ -282,6 +289,7 @@ void terminate_filed(int sig)
    if (debug_level > 0) {
       print_memory_pool_stats();
    }
+
    if (config) {
       config->free_resources();
       free(config);
diff --git a/src/filed/filed.h b/src/filed/filed.h
index 308fb19..9eaf2eb 100644
--- a/src/filed/filed.h
+++ b/src/filed/filed.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Bacula File Daemon specific configuration and defines
@@ -20,45 +24,45 @@
  *
  */
 
-/*
- * Number of acl errors to report per job.
- */
-#define ACL_REPORT_ERR_MAX_PER_JOB      25
+//#define TEST_WORKER
+#ifdef  TEST_WORKER
+#define ERROR_BUFFER_OVERFLOW 1
+#define ERROR_SUCCESS 0
+#endif
 
-/*
- * Number of xattr errors to report per job.
- */
-#define XATTR_REPORT_ERR_MAX_PER_JOB    25
 
-/*
- * Return codes from acl subroutines.
- */
-typedef enum {
-   bacl_exit_fatal = -1,
-   bacl_exit_error = 0,
-   bacl_exit_ok = 1
-} bacl_exit_code;
-
-/*
- * Return codes from xattr subroutines.
- */
-typedef enum {
-   bxattr_exit_fatal = -1,
-   bxattr_exit_error = 0,
-   bxattr_exit_ok = 1
-} bxattr_exit_code;
+/* acl errors to report per job. */
+#define ACL_MAX_ERROR_PRINT_PER_JOB   25
+ 
+/* xattr errors to report per job. */
+#define XATTR_MAX_ERROR_PRINT_PER_JOB 25
+ 
+/* Return values from acl subroutines. */
+enum bacl_rtn_code {
+   bacl_rtn_fatal = -1,
+   bacl_rtn_error =  0,
+   bacl_rtn_ok    =  1
+};
+ 
+/* Return values from xattr subroutines. */
+enum bxattr_rtn_code {
+   bxattr_rtn_fatal = -1,
+   bxattr_rtn_error =  0,
+   bxattr_rtn_ok    =  1
+};
 
 #define FILE_DAEMON 1
-#include "lib/htable.h"
-#include "filed_conf.h"
-#include "fd_plugins.h"
-#include "findlib/find.h"
-#include "acl.h"
-#include "xattr.h"
-#include "jcr.h"
-#include "protos.h"                   /* file daemon prototypes */
-#include "lib/runscript.h"
-#include "lib/breg.h"
+#include  "lib/htable.h"
+#include  "filed_conf.h"
+#include  "fd_plugins.h"
+#include  "fd_snapshot.h"
+#include  "findlib/find.h"
+#include  "acl.h"
+#include  "xattr.h"
+#include  "jcr.h"
+#include  "protos.h"                   /* file daemon prototypes */
+#include  "lib/runscript.h"
+#include  "lib/breg.h"
 #ifdef HAVE_LIBZ
 #include <zlib.h>                     /* compression headers */
 #else
diff --git a/src/filed/filed_conf.c b/src/filed/filed_conf.c
index 7ecd4f2..164786b 100644
--- a/src/filed/filed_conf.c
+++ b/src/filed/filed_conf.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *   Main configuration file parser for Bacula File Daemon (Client)
@@ -32,7 +36,7 @@
  *      definitions as well as any specific store routines
  *      for the resource records.
  *
- *     Written by Kern Sibbald, September MM
+ *     Kern Sibbald, September MM
  *
  */
 
@@ -77,64 +81,65 @@ static void store_digest_type(LEX *lc, RES_ITEM *item, int index, int pass);
 
 /* Client or File daemon "Global" resources */
 static RES_ITEM cli_items[] = {
-   {"name",        store_name,  ITEM(res_client.hdr.name), 0, ITEM_REQUIRED, 0},
-   {"description", store_str,   ITEM(res_client.hdr.desc), 0, 0, 0},
-   {"fdport",      store_addresses_port,    ITEM(res_client.FDaddrs),  0, ITEM_DEFAULT, 9102},
-   {"fdaddress",   store_addresses_address, ITEM(res_client.FDaddrs),  0, ITEM_DEFAULT, 9102},
-   {"fdaddresses", store_addresses,         ITEM(res_client.FDaddrs),  0, ITEM_DEFAULT, 9102},
-   {"fdsourceaddress", store_addresses_address, ITEM(res_client.FDsrc_addr),  0, ITEM_DEFAULT, 0},
-
-   {"workingdirectory",  store_dir, ITEM(res_client.working_directory), 0, ITEM_REQUIRED, 0},
-   {"piddirectory",  store_dir,     ITEM(res_client.pid_directory),     0, ITEM_REQUIRED, 0},
-   {"subsysdirectory",  store_dir,  ITEM(res_client.subsys_directory),  0, 0, 0},
-   {"plugindirectory",  store_dir,  ITEM(res_client.plugin_directory),  0, 0, 0},
-   {"scriptsdirectory", store_dir,  ITEM(res_client.scripts_directory),  0, 0, 0},
-   {"maximumconcurrentjobs", store_pint32,  ITEM(res_client.MaxConcurrentJobs), 0, ITEM_DEFAULT, 20},
-   {"messages",      store_res, ITEM(res_client.messages), R_MSGS, 0, 0},
-   {"sdconnecttimeout", store_time,ITEM(res_client.SDConnectTimeout), 0, ITEM_DEFAULT, 60 * 30},
-   {"heartbeatinterval", store_time, ITEM(res_client.heartbeat_interval), 0, ITEM_DEFAULT, 0},
-   {"maximumnetworkbuffersize", store_pint32, ITEM(res_client.max_network_buffer_size), 0, 0, 0},
+   {"Name",        store_name,  ITEM(res_client.hdr.name), 0, ITEM_REQUIRED, 0},
+   {"Description", store_str,   ITEM(res_client.hdr.desc), 0, 0, 0},
+   {"FdPort",      store_addresses_port,    ITEM(res_client.FDaddrs),  0, ITEM_DEFAULT, 9102},
+   {"FdAddress",   store_addresses_address, ITEM(res_client.FDaddrs),  0, ITEM_DEFAULT, 9102},
+   {"FdAddresses", store_addresses,         ITEM(res_client.FDaddrs),  0, ITEM_DEFAULT, 9102},
+   {"FdSourceAddress", store_addresses_address, ITEM(res_client.FDsrc_addr),  0, ITEM_DEFAULT, 0},
+
+   {"WorkingDirectory",  store_dir, ITEM(res_client.working_directory), 0, ITEM_REQUIRED, 0},
+   {"PidDirectory",  store_dir,     ITEM(res_client.pid_directory),     0, ITEM_REQUIRED, 0},
+   {"SubsysDirectory",  store_dir,  ITEM(res_client.subsys_directory),  0, 0, 0},
+   {"PluginDirectory",  store_dir,  ITEM(res_client.plugin_directory),  0, 0, 0},
+   {"SnapshotCommand",  store_str,  ITEM(res_client.snapshot_command), 0, 0, 0},
+   {"ScriptsDirectory", store_dir,  ITEM(res_client.scripts_directory),  0, 0, 0},
+   {"MaximumConcurrentJobs", store_pint32,  ITEM(res_client.MaxConcurrentJobs), 0, ITEM_DEFAULT, 20},
+   {"Messages",      store_res, ITEM(res_client.messages), R_MSGS, 0, 0},
+   {"SdConnectTimeout", store_time,ITEM(res_client.SDConnectTimeout), 0, ITEM_DEFAULT, 60 * 30},
+   {"HeartbeatInterval", store_time, ITEM(res_client.heartbeat_interval), 0, ITEM_DEFAULT, 5 * 60},
+   {"MaximumNetWorkBufferSize", store_pint32, ITEM(res_client.max_network_buffer_size), 0, 0, 0},
 #ifdef DATA_ENCRYPTION
-   {"pkisignatures",         store_bool,    ITEM(res_client.pki_sign), 0, ITEM_DEFAULT, 0},
-   {"pkiencryption",         store_bool,    ITEM(res_client.pki_encrypt), 0, ITEM_DEFAULT, 0},
-   {"pkikeypair",            store_dir,       ITEM(res_client.pki_keypair_file), 0, 0, 0},
-   {"pkisigner",             store_alist_str, ITEM(res_client.pki_signing_key_files), 0, 0, 0},
-   {"pkimasterkey",          store_alist_str, ITEM(res_client.pki_master_key_files), 0, 0, 0},
-   {"pkicipher",             store_cipher_type, ITEM(res_client.pki_cipher), 0, 0, 0},
-   {"pkipigest",             store_digest_type, ITEM(res_client.pki_digest), 0, 0, 0},
+   {"PkiSignatures",         store_bool,    ITEM(res_client.pki_sign), 0, ITEM_DEFAULT, 0},
+   {"PkiEncryption",         store_bool,    ITEM(res_client.pki_encrypt), 0, ITEM_DEFAULT, 0},
+   {"PkiKeyPair",            store_dir,         ITEM(res_client.pki_keypair_file), 0, 0, 0},
+   {"PkiSigner",             store_alist_str,   ITEM(res_client.pki_signing_key_files), 0, 0, 0},
+   {"PkiMasterKey",          store_alist_str,   ITEM(res_client.pki_master_key_files), 0, 0, 0},
+   {"PkiCipher",             store_cipher_type, ITEM(res_client.pki_cipher), 0, 0, 0},
+   {"PkiDigest",             store_digest_type, ITEM(res_client.pki_digest), 0, 0, 0},
 #endif
-   {"tlsauthenticate",       store_bool,    ITEM(res_client.tls_authenticate),  0, 0, 0},
-   {"tlsenable",             store_bool,    ITEM(res_client.tls_enable),  0, 0, 0},
-   {"tlsrequire",            store_bool,    ITEM(res_client.tls_require), 0, 0, 0},
-   {"tlscacertificatefile",  store_dir,       ITEM(res_client.tls_ca_certfile), 0, 0, 0},
-   {"tlscacertificatedir",   store_dir,       ITEM(res_client.tls_ca_certdir), 0, 0, 0},
-   {"tlscertificate",        store_dir,       ITEM(res_client.tls_certfile), 0, 0, 0},
-   {"tlskey",                store_dir,       ITEM(res_client.tls_keyfile), 0, 0, 0},
-   {"verid",                 store_str,       ITEM(res_client.verid), 0, 0, 0},
-   {"maximumbandwidthperjob",store_speed,   ITEM(res_client.max_bandwidth_per_job), 0, 0, 0},
-   {"disablecommand",        store_alist_str, ITEM(res_client.disable_cmds), 0, 0, 0},
+   {"TlsAuthenticate",       store_bool,    ITEM(res_client.tls_authenticate),  0, 0, 0},
+   {"TlsEnable",             store_bool,    ITEM(res_client.tls_enable),  0, 0, 0},
+   {"TlsRequire",            store_bool,    ITEM(res_client.tls_require), 0, 0, 0},
+   {"TlsCaCertificateFile",  store_dir,     ITEM(res_client.tls_ca_certfile), 0, 0, 0},
+   {"TlsCaCertificateDir",   store_dir,     ITEM(res_client.tls_ca_certdir), 0, 0, 0},
+   {"TlsCertificate",        store_dir,     ITEM(res_client.tls_certfile), 0, 0, 0},
+   {"TlsKey",                store_dir,     ITEM(res_client.tls_keyfile), 0, 0, 0},
+   {"VerId",                 store_str,     ITEM(res_client.verid), 0, 0, 0},
+   {"MaximumBandwidthPerJob",store_speed,   ITEM(res_client.max_bandwidth_per_job), 0, 0, 0},
+   {"DisableCommand",        store_alist_str, ITEM(res_client.disable_cmds), 0, 0, 0},
    {NULL, NULL, {0}, 0, 0, 0}
 };
 
 /* Directors that can use our services */
 static RES_ITEM dir_items[] = {
-   {"name",        store_name,     ITEM(res_dir.hdr.name),  0, ITEM_REQUIRED, 0},
-   {"description", store_str,      ITEM(res_dir.hdr.desc),  0, 0, 0},
-   {"password",    store_password, ITEM(res_dir.password),  0, ITEM_REQUIRED, 0},
-   {"address",     store_str,      ITEM(res_dir.address),   0, 0, 0},
-   {"monitor",     store_bool,   ITEM(res_dir.monitor),   0, ITEM_DEFAULT, 0},
-   {"tlsauthenticate",      store_bool,    ITEM(res_dir.tls_authenticate), 0, 0, 0},
-   {"tlsenable",            store_bool,    ITEM(res_dir.tls_enable), 0, 0, 0},
-   {"tlsrequire",           store_bool,    ITEM(res_dir.tls_require), 0, 0, 0},
-   {"tlsverifypeer",        store_bool,    ITEM(res_dir.tls_verify_peer), 0, ITEM_DEFAULT, 1},
-   {"tlscacertificatefile", store_dir,       ITEM(res_dir.tls_ca_certfile), 0, 0, 0},
-   {"tlscacertificatedir",  store_dir,       ITEM(res_dir.tls_ca_certdir), 0, 0, 0},
-   {"tlscertificate",       store_dir,       ITEM(res_dir.tls_certfile), 0, 0, 0},
-   {"tlskey",               store_dir,       ITEM(res_dir.tls_keyfile), 0, 0, 0},
-   {"tlsdhfile",            store_dir,       ITEM(res_dir.tls_dhfile), 0, 0, 0},
-   {"tlsallowedcn",         store_alist_str, ITEM(res_dir.tls_allowed_cns), 0, 0, 0},
-   {"maximumbandwidthperjob", store_speed,     ITEM(res_dir.max_bandwidth_per_job), 0, 0, 0},
-   {"disablecommand",        store_alist_str, ITEM(res_dir.disable_cmds), 0, 0, 0},
+   {"Name",        store_name,     ITEM(res_dir.hdr.name),  0, ITEM_REQUIRED, 0},
+   {"Description", store_str,      ITEM(res_dir.hdr.desc),  0, 0, 0},
+   {"Password",    store_password, ITEM(res_dir.password),  0, ITEM_REQUIRED, 0},
+   {"Address",     store_str,      ITEM(res_dir.address),   0, 0, 0},
+   {"Monitor",     store_bool,   ITEM(res_dir.monitor),   0, ITEM_DEFAULT, 0},
+   {"TlsAuthenticate",      store_bool,    ITEM(res_dir.tls_authenticate), 0, 0, 0},
+   {"TlsEnable",            store_bool,    ITEM(res_dir.tls_enable), 0, 0, 0},
+   {"TlsRequire",           store_bool,    ITEM(res_dir.tls_require), 0, 0, 0},
+   {"TlsVerifyPeer",        store_bool,    ITEM(res_dir.tls_verify_peer), 0, ITEM_DEFAULT, 1},
+   {"TlsCaCertificateFile", store_dir,       ITEM(res_dir.tls_ca_certfile), 0, 0, 0},
+   {"TlsCaCertificateDir",  store_dir,       ITEM(res_dir.tls_ca_certdir), 0, 0, 0},
+   {"TlsCertificate",       store_dir,       ITEM(res_dir.tls_certfile), 0, 0, 0},
+   {"TlsKey",               store_dir,       ITEM(res_dir.tls_keyfile), 0, 0, 0},
+   {"TlsDhFile",            store_dir,       ITEM(res_dir.tls_dhfile), 0, 0, 0},
+   {"TlsAllowedCn",         store_alist_str, ITEM(res_dir.tls_allowed_cns), 0, 0, 0},
+   {"MaximumBandwidthPerJob", store_speed,     ITEM(res_dir.max_bandwidth_per_job), 0, 0, 0},
+   {"DisableCommand",        store_alist_str, ITEM(res_dir.disable_cmds), 0, 0, 0},
    {NULL, NULL, {0}, 0, 0, 0}
 };
 
@@ -146,10 +151,10 @@ extern RES_ITEM msgs_items[];
  * It must have one item for each of the resources.
  */
 RES_TABLE resources[] = {
-   {"director",      dir_items,   R_DIRECTOR},
-   {"filedaemon",    cli_items,   R_CLIENT},
-   {"client",        cli_items,   R_CLIENT},     /* alias for filedaemon */
-   {"messages",      msgs_items,  R_MSGS},
+   {"Director",      dir_items,   R_DIRECTOR},
+   {"FileDaemon",    cli_items,   R_CLIENT},
+   {"Messages",      msgs_items,  R_MSGS},
+   {"Client",        cli_items,   R_CLIENT},     /* alias for filedaemon */
    {NULL,            NULL,        0}
 };
 
@@ -224,9 +229,9 @@ static void store_digest_type(LEX *lc, RES_ITEM *item, int index, int pass)
 }
 
 /* Dump contents of resource */
-void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fmt, ...), void *sock)
+void dump_resource(int type, RES *ares, void sendit(void *sock, const char *fmt, ...), void *sock)
 {
-   URES *res = (URES *)reshdr;
+   URES *res = (URES *)ares;
    int recurse = 1;
 
    if (res == NULL) {
@@ -239,11 +244,11 @@ void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fm
    }
    switch (type) {
    case R_DIRECTOR:
-      sendit(sock, "Director: name=%s password=%s\n", reshdr->name,
+      sendit(sock, "Director: name=%s password=%s\n", ares->name,
               res->res_dir.password);
       break;
    case R_CLIENT:
-      sendit(sock, "Client: name=%s FDport=%d\n", reshdr->name,
+      sendit(sock, "Client: name=%s FDport=%d\n", ares->name,
               get_first_port_host_order(res->res_client.FDaddrs));
       break;
    case R_MSGS:
@@ -256,11 +261,13 @@ void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fm
    default:
       sendit(sock, "Unknown resource type %d\n", type);
    }
+   ares = GetNextRes(type, ares);
    if (recurse && res->res_dir.hdr.next) {
       dump_resource(type, res->res_dir.hdr.next, sendit, sock);
    }
 }
 
+
 /*
  * Free memory of resource.
  * NB, we don't need to worry about freeing any references
@@ -343,7 +350,9 @@ void free_resource(RES *sres, int type)
       if (res->res_client.FDsrc_addr) {
          free_addresses(res->res_client.FDsrc_addr);
       }
-
+      if (res->res_client.snapshot_command) {
+         free(res->res_client.snapshot_command);
+      }
       if (res->res_client.pki_keypair_file) {
          free(res->res_client.pki_keypair_file);
       }
@@ -400,10 +409,12 @@ void free_resource(RES *sres, int type)
       }
       break;
    case R_MSGS:
-      if (res->res_msgs.mail_cmd)
+      if (res->res_msgs.mail_cmd) {
          free(res->res_msgs.mail_cmd);
-      if (res->res_msgs.operator_cmd)
+      }
+      if (res->res_msgs.operator_cmd) {
          free(res->res_msgs.operator_cmd);
+      }
       free_msgs_res((MSGS *)res);  /* free message resource */
       res = NULL;
       break;
@@ -436,7 +447,7 @@ void save_resource(int type, RES_ITEM *items, int pass)
    for (i=0; items[i].name; i++) {
       if (items[i].flags & ITEM_REQUIRED) {
             if (!bit_is_set(i, res_all.res_dir.hdr.item_present)) {
-               Emsg2(M_ABORT, 0, _("%s item is required in %s resource, but not found.\n"),
+               Emsg2(M_ERROR_TERM, 0, _("%s item is required in %s resource, but not found.\n"),
                  items[i].name, resources[rindex]);
              }
       }
@@ -459,6 +470,7 @@ void save_resource(int type, RES_ITEM *items, int pass)
                Emsg1(M_ABORT, 0, _("Cannot find Director resource %s\n"), res_all.res_dir.hdr.name);
             }
             res->res_dir.tls_allowed_cns = res_all.res_dir.tls_allowed_cns;
+            res->res_dir.disable_cmds = res_all.res_dir.disable_cmds;
             break;
          case R_CLIENT:
             if ((res = (URES *)GetResWithName(R_CLIENT, res_all.res_dir.hdr.name)) == NULL) {
@@ -471,6 +483,7 @@ void save_resource(int type, RES_ITEM *items, int pass)
             res->res_client.pki_recipients = res_all.res_client.pki_recipients;
 
             res->res_client.messages = res_all.res_client.messages;
+            res->res_client.disable_cmds = res_all.res_client.disable_cmds;
             break;
          default:
             Emsg1(M_ERROR, 0, _("Unknown resource type %d\n"), type);
diff --git a/src/filed/filed_conf.h b/src/filed/filed_conf.h
index 003c76b..7ab4b65 100644
--- a/src/filed/filed_conf.h
+++ b/src/filed/filed_conf.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Bacula File Daemon specific configuration
@@ -70,6 +74,7 @@ struct CLIENT {
    char *subsys_directory;
    char *plugin_directory;            /* Plugin directory */
    char *scripts_directory;
+   char *snapshot_command;
    MSGS *messages;                    /* daemon message handler */
    uint32_t MaxConcurrentJobs;
    utime_t SDConnectTimeout;          /* timeout in seconds */
diff --git a/src/filed/heartbeat.c b/src/filed/heartbeat.c
index 9795049..783bfb2 100644
--- a/src/filed/heartbeat.c
+++ b/src/filed/heartbeat.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2003-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *  Bacula File Daemon heartbeat routines
diff --git a/src/filed/hello.c b/src/filed/hello.c
new file mode 100644
index 0000000..2ec9105
--- /dev/null
+++ b/src/filed/hello.c
@@ -0,0 +1,214 @@
+/*
+   Bacula(R) - The Network Backup Solution
+
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
+
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
+
+   You may use this file and others of this release according to the
+   license defined in the LICENSE file, which includes the Affero General
+   Public License, v3.0 ("AGPLv3") and some additional permissions and
+   terms pursuant to its AGPLv3 Section 7.
+
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
+/*
+ * Authenticate Director who is attempting to connect.
+ *
+ *   Kern Sibbald, October 2000
+ *
+ */
+
+#include "bacula.h"
+#include "filed.h"
+
+extern CLIENT *me;                 /* my resource */
+
+const int dbglvl = 50;
+
+/* FD_VERSION history
+ *   None prior to 10Mar08
+ *   1 10Mar08
+ *   2 13Mar09 - added the ability to restore from multiple storages
+ *   3 03Sep10 - added the restore object command
+ *   4 25Nov10 - added bandwidth command 5.1
+ *   5 24Nov11 - added new restore object command format (pluginname)
+ *   6 15Feb12 - added Component selection information list
+ *   7 19Feb12 - added Expected files to restore
+ *   8 22Mar13 - added restore options + version for SD
+ *   9 06Aug13 - skipped
+ *  10 01Jan14 - added SD Calls Client
+ *  11 O4May14 - skipped
+ *  12 22Jun14 - skipped
+ * 213 04Feb15 - added snapshot protocol with the DIR
+ */
+
+#define FD_VERSION 213 /* FD version */
+
+static char hello_sd[]  = "Hello Bacula SD: Start Job %s %d\n";
+static char hello_dir[] = "2000 OK Hello %d\n";
+static char sorry_dir[] = "2999 Authentication failed.\n";
+
+static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+
+/*********************************************************************
+ *
+ * Validate hello from the Director
+ *
+ * Returns: true  if Hello is good.
+ *          false if Hello is bad.
+ */
+bool validate_dir_hello(JCR *jcr)
+{
+   POOLMEM *dirname;
+   DIRRES *director = NULL;
+   int dir_version = 0;
+   BSOCK *dir = jcr->dir_bsock;
+   bool auth_success = false;
+
+   if (dir->msglen < 25 || dir->msglen > 500) {
+      Dmsg2(dbglvl, "Bad Hello command from Director at %s. Len=%d.\n",
+            dir->who(), dir->msglen);
+      Jmsg2(jcr, M_FATAL, 0, _("Bad Hello command from Director at %s. Len=%d.\n"),
+            dir->who(), dir->msglen);
+      return false;
+   }
+   dirname = get_pool_memory(PM_MESSAGE);
+   dirname = check_pool_memory_size(dirname, dir->msglen);
+
+   if (sscanf(dir->msg, "Hello Director %127s calling %d", dirname, &dir_version) != 2 &&
+       sscanf(dir->msg, "Hello Director %127s calling", dirname) != 1) {
+      char addr[64];
+      char *who = dir->get_peer(addr, sizeof(addr)) ? dir->who() : addr;
+      dir->msg[100] = 0;
+      Dmsg2(dbglvl, "Bad Hello command from Director at %s: %s\n",
+            dir->who(), dir->msg);
+      Jmsg2(jcr, M_FATAL, 0, _("Bad Hello command from Director at %s: %s\n"),
+            who, dir->msg);
+      goto auth_fatal;
+   }
+   unbash_spaces(dirname);
+   foreach_res(director, R_DIRECTOR) {
+      if (strcmp(director->hdr.name, dirname) == 0)
+         break;
+   }
+   if (!director) {
+      char addr[64];
+      char *who = dir->get_peer(addr, sizeof(addr)) ? dir->who() : addr;
+      Jmsg2(jcr, M_FATAL, 0, _("Connection from unknown Director %s at %s rejected.\n"),
+            dirname, who);
+      goto auth_fatal;
+   }
+   auth_success = true;
+
+auth_fatal:
+   free_pool_memory(dirname);
+   jcr->director = director;
+   /* Single thread all failures to avoid DOS */
+   if (!auth_success) {
+      P(mutex);
+      bmicrosleep(6, 0);
+      V(mutex);
+   }
+   return auth_success;
+}
+
+/*
+ * Note, we handle the initial connection request here.
+ *   We only get the jobname and the SD version, then we
+ *   return, authentication will be done when the Director
+ *   sends the storage command -- as is usually the case.
+ *   This should be called only once by the SD.
+ */
+void *handle_storage_connection(BSOCK *sd)
+{
+   char job_name[500];
+   char tbuf[150];
+   int sd_version = 0;
+   JCR *jcr;
+
+   if (sscanf(sd->msg, "Hello FD: Bacula Storage calling Start Job %127s %d",
+       job_name, &sd_version) != 2) {
+      Jmsg(NULL, M_FATAL, 0, _("SD connect failed: Bad Hello command\n"));
+      return NULL;
+   }
+   Dmsg1(110, "Got a SD connection at %s\n", bstrftimes(tbuf, sizeof(tbuf),
+         (utime_t)time(NULL)));
+   Dmsg1(50, "%s", sd->msg);
+
+   if (!(jcr=get_jcr_by_full_name(job_name))) {
+      Jmsg1(NULL, M_FATAL, 0, _("SD connect failed: Job name not found: %s\n"), job_name);
+      Dmsg1(3, "**** Job \"%s\" not found.\n", job_name);
+      sd->destroy();
+      return NULL;
+   }
+   set_jcr_in_tsd(jcr);
+   Dmsg1(150, "Found Job %s\n", job_name);
+
+   jcr->lock_auth();
+   /* We already have a socket connected, just discard it */
+   if (jcr->sd_calls_client_bsock) {
+      Qmsg1(jcr, M_WARNING, 0, _("SD \"%s\" tried to connect two times.\n"), sd->who());
+      free_bsock(sd);
+      /* will exit just after the unlock() */
+
+   } else {
+      /* If we have a previous socket in store_bsock, we are in multi restore mode */
+      jcr->sd_calls_client_bsock = sd;
+      sd->set_jcr(jcr);
+   }
+   jcr->unlock_auth();
+
+   if (!sd) {                   /* freed by free_bsock(), connection already done */
+      free_jcr(jcr);
+      return NULL;
+   }
+
+   if (!jcr->max_bandwidth) {
+      if (jcr->director->max_bandwidth_per_job) {
+         jcr->max_bandwidth = jcr->director->max_bandwidth_per_job;
+
+      } else if (me->max_bandwidth_per_job) {
+         jcr->max_bandwidth = me->max_bandwidth_per_job;
+      }
+   }
+   sd->set_bwlimit(jcr->max_bandwidth);
+
+   pthread_cond_signal(&jcr->job_start_wait); /* wake waiting job */
+   free_jcr(jcr);
+   return NULL;
+}
+
+
+/*
+ * Send Hello OK to DIR
+ */
+bool send_hello_ok(BSOCK *bs)
+{
+   return bs->fsend(hello_dir, FD_VERSION);
+}
+
+bool send_sorry(BSOCK *bs)
+{
+   return bs->fsend(sorry_dir);
+}
+
+/*
+ * Send Hello to SD
+ */
+bool send_hello_sd(JCR *jcr, char *Job)
+{
+   bool rtn;
+   BSOCK *sd = jcr->store_bsock;
+
+   bash_spaces(Job);
+   rtn = sd->fsend(hello_sd, Job, FD_VERSION);
+   unbash_spaces(Job);
+   Dmsg1(100, "Send to SD: %s\n", sd->msg);
+   return rtn;
+}
diff --git a/src/filed/job.c b/src/filed/job.c
index de3c798..1da24a6 100644
--- a/src/filed/job.c
+++ b/src/filed/job.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *  Bacula File Daemon Job processing
@@ -23,33 +27,29 @@
 #include "bacula.h"
 #include "filed.h"
 #include "ch.h"
-#ifdef WIN32_VSS
-#include "vss.h"
-static pthread_mutex_t vss_mutex = PTHREAD_MUTEX_INITIALIZER;
-#endif
 
 /* Globals */
 bool win32decomp = false;
 bool no_win32_write_errors = false;
-static int enable_vss = 0;
+
+/* Static variables */
 static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
 
-/*
- * As Windows saves ACLs as part of the standard backup stream
- * we just pretend here that is has implicit acl support.
- */
-#if defined(HAVE_ACL) || defined(HAVE_WIN32)
-const bool have_acl = true;
-#else
-const bool have_acl = false;
-#endif
 
-#if defined(HAVE_XATTR)
-const bool have_xattr = true;
-#else
-const bool have_xattr = false;
-#endif
+const bool have_win32 = false;
+
+#ifdef HAVE_ACL
+const bool have_acl = true; 
+#else 
+const bool have_acl = false; 
+#endif 
 
+#if HAVE_XATTR
+const bool have_xattr = true; 
+#else 
+const bool have_xattr = false; 
+#endif 
+ 
 extern CLIENT *me;                    /* our client resource */
 
 /* Imported functions */
@@ -59,6 +59,7 @@ extern int accurate_cmd(JCR *jcr);
 
 /* Forward referenced functions */
 static int backup_cmd(JCR *jcr);
+static int component_cmd(JCR *jcr);
 static int cancel_cmd(JCR *jcr);
 static int setdebug_cmd(JCR *jcr);
 static int setbandwidth_cmd(JCR *jcr);
@@ -98,6 +99,7 @@ struct s_cmds cmds[] = {
    {"cancel",       cancel_cmd,    0},
    {"setdebug=",    setdebug_cmd,  0},
    {"setbandwidth=",setbandwidth_cmd, 0},
+   {"snapshot",     snapshot_cmd,  0},
    {"estimate",     estimate_cmd,  0},
    {"Hello",        hello_cmd,     1},
    {"fileset",      fileset_cmd,   0},
@@ -110,6 +112,7 @@ struct s_cmds cmds[] = {
    {".status",      qstatus_cmd,   1},
    {"storage ",     storage_cmd,   0},
    {"verify",       verify_cmd,    0},
+   {"component",    component_cmd, 0},
    {"RunBeforeNow", runbeforenow_cmd, 0},
    {"RunBeforeJob", runbefore_cmd, 0},
    {"RunAfterJob",  runafter_cmd,  0},
@@ -117,6 +120,7 @@ struct s_cmds cmds[] = {
    {"accurate",     accurate_cmd,  0},
    {"restoreobject", restore_object_cmd, 0},
    {"sm_dump",      sm_dump_cmd, 0},
+   {"stop",         cancel_cmd,    0},
 #ifdef DEVELOPER
    {"exit",         exit_cmd, 0},
 #endif
@@ -168,16 +172,19 @@ static char OKsession[]   = "2000 OK session\n";
 static char OKstore[]     = "2000 OK storage\n";
 static char OKstoreend[]  = "2000 OK storage end\n";
 static char OKjob[]       = "2000 OK Job %s (%s) %s,%s,%s";
-static char OKsetdebug[]  = "2000 OK setdebug=%ld trace=%ld hangup=%ld options=%s tags=%s\n";
+static char OKsetdebug[]  = "2000 OK setdebug=%ld trace=%ld hangup=%ld"
+                            " blowup=%ld options=%s tags=%s\n";
 static char BADjob[]      = "2901 Bad Job\n";
 static char EndJob[]      = "2800 End Job TermCode=%d JobFiles=%d ReadBytes=%lld"
-                            " JobBytes=%lld Errors=%d VSS=%d Encrypt=%d\n";
+                            " JobBytes=%lld Errors=%d VSS=%d Encrypt=%d"
+                            " CommBytes=0 CompressCommBytes=0\n";
 static char OKRunBefore[] = "2000 OK RunBefore\n";
 static char OKRunBeforeNow[] = "2000 OK RunBeforeNow\n";
 static char OKRunAfter[]  = "2000 OK RunAfter\n";
 static char OKRunScript[] = "2000 OK RunScript\n";
 static char BADcmd[]      = "2902 Bad %s\n";
 static char OKRestoreObject[] = "2000 OK ObjectRestored\n";
+static char OKComponentInfo[] = "2000 OK ComponentInfo\n";
 
 
 /* Responses received from Storage Daemon */
@@ -196,6 +203,7 @@ static char append_close[] = "append close session %d\n";
 static char read_open[]    = "read open session = %s %ld %ld %ld %ld %ld %ld\n";
 static char read_data[]    = "read data %d\n";
 static char read_close[]   = "read close session %d\n";
+static char read_ctrl[]    = "read control %d\n";
 
 /*
  * Accept requests from a Director
@@ -225,8 +233,8 @@ static char read_close[]   = "read close session %d\n";
  *  4. FD connects to SD
  *  5. FD gets/runs ClientRunBeforeJob and sends ClientRunAfterJob
  *  6. Dir sends include/exclude
- *  7. FD sends data to SD
- *  8. SD/FD disconnects while SD despools data and attributes (optional)
+ *  7. FD sends the file data to SD
+ *  8. SD/FD disconnects while the SD despools data and attributes (optional)
  *  9. FD runs ClientRunAfterJob
  */
 
@@ -238,7 +246,9 @@ static void *handle_director_request(BSOCK *dir)
    JCR *jcr;
    const char jobname[12] = "*Director*";
 
+   prevent_os_suspensions();   /* do not suspend during backup/restore */
    jcr = new_jcr(sizeof(JCR), filed_free_jcr); /* create JCR */
+   jcr->sd_calls_client_bsock = NULL;
    jcr->sd_calls_client = false;
    jcr->dir_bsock = dir;
    jcr->ff = init_find_files();
@@ -254,6 +264,7 @@ static void *handle_director_request(BSOCK *dir)
    jcr->crypto.pki_keypair = me->pki_keypair;
    jcr->crypto.pki_signers = me->pki_signers;
    jcr->crypto.pki_recipients = me->pki_recipients;
+
    dir->set_jcr(jcr);
    /* Initialize SD start condition variable */
    int errstat = pthread_cond_init(&jcr->job_start_wait, NULL);
@@ -262,7 +273,6 @@ static void *handle_director_request(BSOCK *dir)
       Jmsg1(jcr, M_FATAL, 0, _("Unable to init job cond variable: ERR=%s\n"), be.bstrerror(errstat));
       goto bail_out;
    }
-
    enable_backup_privileges(NULL, 1 /* ignore_errors */);
 
    for (quit=false; !quit;) {
@@ -325,11 +335,12 @@ static void *handle_director_request(BSOCK *dir)
 
    if (jcr->JobId) {            /* send EndJob if running a job */
       uint32_t vss, encrypt;
+      /* Send termination status back to Dir */
       encrypt = jcr->crypto.pki_encrypt;
-      vss = jcr->VSS;
+      vss = jcr->Snapshot;
       dir->fsend(EndJob, jcr->JobStatus, jcr->JobFiles,
               jcr->ReadBytes, jcr->JobBytes, jcr->JobErrors, vss,
-              encrypt);
+              encrypt, 0, 0);
       //Dmsg0(0/*110*/, dir->msg);
    }
 
@@ -414,6 +425,7 @@ bail_out:
       free(fileset);
    }
    ff->fileset = NULL;
+   ff->mount_points.destroy();
    Dmsg0(100, "Calling term_find_files\n");
    term_find_files(jcr->ff);
    jcr->ff = NULL;
@@ -421,59 +433,12 @@ bail_out:
    pthread_cond_destroy(&jcr->job_start_wait);
    free_jcr(jcr);                     /* destroy JCR record */
    Dmsg0(100, "Done with free_jcr\n");
+   allow_os_suspensions();            /* FD can now be suspended */
    Dsm_check(100);
    garbage_collect_memory_pool();
    return NULL;
 }
 
-/*
- * Note, we handle the initial connection request here.
- *   We only get the jobname and the SD version, then we
- *   return, authentication will be done when the Director
- *   sends the storage command -- as is usually the case.
- *   This should be called only once by the SD.
- */
-static void *handle_storage_request(BSOCK *sd)
-{
-   char job_name[500];
-   char tbuf[150];
-   int sd_version;
-   JCR *jcr;
-
-   if (sscanf(sd->msg, "Hello FD: Bacula Storage calling Start Job %127s %d\n",
-       job_name, &sd_version) != 2) {
-      Jmsg(NULL, M_FATAL, 0, _("SD connect failed: Bad Hello command\n"));
-      return NULL;
-   }
-   Dmsg1(110, "Got a SD connection at %s\n", bstrftimes(tbuf, sizeof(tbuf),
-         (utime_t)time(NULL)));
-   Dmsg1(50, "%s", sd->msg);
-
-   if (!(jcr=get_jcr_by_full_name(job_name))) {
-      Jmsg1(NULL, M_FATAL, 0, _("SD connect failed: Job name not found: %s\n"), job_name);
-      Dmsg1(3, "**** Job \"%s\" not found.\n", job_name);
-      sd->destroy();
-      return NULL;
-   }
-
-   Dmsg1(150, "Found Job %s\n", job_name);
-
-   jcr->store_bsock = sd;
-   jcr->store_bsock->set_jcr(jcr);
-
-   if (!jcr->max_bandwidth) {
-      if (jcr->director->max_bandwidth_per_job) {
-         jcr->max_bandwidth = jcr->director->max_bandwidth_per_job;
-
-      } else if (me->max_bandwidth_per_job) {
-         jcr->max_bandwidth = me->max_bandwidth_per_job;
-      }
-   }
-   sd->set_bwlimit(jcr->max_bandwidth);
-   pthread_cond_signal(&jcr->job_start_wait); /* wake waiting job */
-   free_jcr(jcr);
-   return NULL;
-}
 
 /*
  * Accept requests from a Director or a Storage daemon
@@ -496,7 +461,7 @@ void *handle_connection_request(void *caller)
          return handle_director_request(bs);
       }
       if (strncmp(bs->msg, "Hello FD: Bacula Storage", 20) ==0) {
-         return handle_storage_request(bs);
+         return handle_storage_connection(bs);
       }
    }
 bail_out:
@@ -533,6 +498,9 @@ static int exit_cmd(JCR *jcr)
 static int hello_cmd(JCR *jcr)
 {
    Dmsg0(120, "Calling Authenticate\n");
+   if (!validate_dir_hello(jcr)) {
+      return 0;
+   }
    if (!authenticate_director(jcr)) {
       return 0;
    }
@@ -556,6 +524,9 @@ static int cancel_cmd(JCR *jcr)
    if (sscanf(dir->msg, "cancel Job=%127s", Job) == 1) {
       status = JS_Canceled;
       reason = "canceled";
+   } else if (sscanf(dir->msg, "stop Job=%127s", Job) == 1) {
+      status = JS_Incomplete;
+      reason = "stopped";
    } else {
       dir->fsend(_("2902 Error scanning cancel command.\n"));
       goto bail_out;
@@ -630,17 +601,20 @@ static int setbandwidth_cmd(JCR *jcr)
 static int setdebug_cmd(JCR *jcr)
 {
    BSOCK *dir = jcr->dir_bsock;
-   int32_t trace, hangup, lvl;
-   int64_t level;
+   int32_t trace, lvl;
+   int32_t hangup = -1;
+   int32_t blowup = -1;
+   int64_t level, level_tags = 0;
    int scan;
    char options[60];
    char tags[512];
 
    Dmsg1(50, "setdebug_cmd: %s", dir->msg);
    tags[0] = options[0] = 0;
-   scan = sscanf(dir->msg, "setdebug=%ld trace=%ld hangup=%ld options=%55s tags=%511s",
-                 &lvl, &trace, &hangup, options, tags);
-   if (scan != 5) {
+   scan = sscanf(dir->msg, "setdebug=%ld trace=%ld hangup=%ld blowup=%ld"
+             " options=%55s tags=%511s",
+                 &lvl, &trace, &hangup, &blowup, options, tags);
+   if (scan != 6) {
       scan = sscanf(dir->msg, "setdebug=%ld trace=%ld hangup=%ld",
                     &lvl, &trace, &hangup);
       if (scan != 3) {
@@ -657,19 +631,22 @@ static int setdebug_cmd(JCR *jcr)
    level = lvl;
    set_trace(trace);
    set_hangup(hangup);
-   if (!debug_parse_tags(tags, &level)) {
+   set_blowup(blowup);
+   if (!debug_parse_tags(tags, &level_tags)) {
       *tags = 0;
    }
    if (level >= 0) {
       debug_level = level;
    }
+   debug_level_tags = level_tags;
 
    /* handle other options */
    set_debug_flags(options);
 
-   Dmsg5(150, "level=%ld trace=%ld hangup=%ld options=%s tags=%s\n",
-         lvl, get_trace(), get_hangup(), options, tags);
-   return dir->fsend(OKsetdebug, lvl, get_trace(), get_hangup(), options, tags);
+   Dmsg6(150, "level=%ld trace=%ld hangup=%ld blowup=%d options=%s tags=%s\n",
+         lvl, get_trace(), get_hangup(), get_blowup(), options, tags);
+   return dir->fsend(OKsetdebug, lvl, get_trace(), get_hangup(),
+             get_blowup(), options, tags);
 }
 
 
@@ -708,6 +685,7 @@ static int job_cmd(JCR *jcr)
       dir->fsend(BADjob);
       return 0;
    }
+   set_jcr_in_tsd(jcr);
    set_storage_auth_key(jcr, sd_auth_key.c_str());
    Dmsg2(120, "JobId=%d Auth=%s\n", jcr->JobId, jcr->sd_auth_key);
    Mmsg(jcr->errmsg, "JobId=%d Job=%s", jcr->JobId, jcr->Job);
@@ -974,6 +952,7 @@ static bool init_fileset(JCR *jcr)
    return true;
 }
 
+
 static void append_file(JCR *jcr, findINCEXE *incexe,
                         const char *buf, bool is_file)
 {
@@ -991,7 +970,7 @@ static void append_file(JCR *jcr, findINCEXE *incexe,
    }
 }
 
-/*
+/**
  * Add fname to include/exclude fileset list. First check for
  * | and < and if necessary perform command.
  */
@@ -1466,6 +1445,8 @@ static int set_options(findFOPTS *fo, const char *opts)
    const char *p;
    char strip[100];
 
+// Commented out as it is not backward compatible - KES
+
    for (p=opts; *p; p++) {
       switch (*p) {
       case 'a':                 /* alway replace */
@@ -1633,11 +1614,8 @@ static int fileset_cmd(JCR *jcr)
    POOL_MEM buf(PM_MESSAGE);
    BSOCK *dir = jcr->dir_bsock;
    int rtnstat;
-   int vss = 0;
-
-   sscanf(dir->msg, "fileset vss=%d", &vss);
-   enable_vss = vss;
 
+   jcr->Snapshot = (strstr(dir->msg, "snap=1") != NULL);
    if (!init_fileset(jcr)) {
       return 0;
    }
@@ -1656,6 +1634,21 @@ static int fileset_cmd(JCR *jcr)
 }
 
 
+/*
+ * The Director sends us the component info file, which
+ *   we will in turn pass to the VSS plugin.
+ */
+static int component_cmd(JCR *jcr)
+{
+   BSOCK *dir = jcr->dir_bsock;
+
+   while (dir->recv() >= 0) {
+       Dmsg1(200, "filed<dird: component: %s", dir->msg);
+       generate_plugin_event(jcr, bEventComponentInfo, (void *)dir->msg);
+   }
+   return dir->fsend(OKComponentInfo);
+}
+
 
 /**
  * Get backup level from Director
@@ -1705,7 +1698,7 @@ static int level_cmd(JCR *jcr)
    } else if (strcasecmp(level, "since_utime") == 0) {
       buf = get_memory(dir->msglen+1);
       utime_t since_time, adj;
-      btime_t his_time, bt_start, rt=0, bt_adj=0;
+      btime_t his_time, bt_start, rt=0, bt_adj=0, his_time_prev=0, n=0;
       if (jcr->getJobLevel() == L_NONE) {
          jcr->setJobLevel(L_SINCE);     /* if no other job level set, do it now */
       }
@@ -1732,21 +1725,28 @@ static int level_cmd(JCR *jcr)
          if (sscanf(dir->msg, "btime %s", buf) != 1) {
             goto bail_out;
          }
-         if (i < 2) {                 /* toss first two results */
-            continue;
-         }
          his_time = str_to_uint64(buf);
          rt = get_current_btime() - bt_start; /* compute round trip time */
+         /* skip first two results and check for leap second */
+         /* if any of the FD or DIR went back in time, skip this iteration */
+         if (i < 2 || (his_time_prev > 0 && his_time < his_time_prev) || rt<0) {
+            his_time_prev = his_time;
+            continue;
+         }
+         his_time_prev = his_time;
+         n++;
          Dmsg2(100, "Dirtime=%s FDtime=%s\n", edit_uint64(his_time, ed1),
                edit_uint64(bt_start, ed2));
          bt_adj +=  bt_start - his_time - rt/2;
          Dmsg2(100, "rt=%s adj=%s\n", edit_uint64(rt, ed1), edit_uint64(bt_adj, ed2));
       }
-
-      bt_adj = bt_adj / 8;            /* compute average time */
-      Dmsg2(100, "rt=%s adj=%s\n", edit_uint64(rt, ed1), edit_uint64(bt_adj, ed2));
-      adj = btime_to_utime(bt_adj);
-      since_time += adj;              /* adjust for clock difference */
+      adj = 0;
+      if (n > 0) { /* Should be 1 in the worst case */
+         bt_adj = bt_adj / n;            /* compute average time */
+         Dmsg2(100, "rt=%s adj=%s\n", edit_uint64(rt, ed1), edit_uint64(bt_adj, ed2));
+         adj = btime_to_utime(bt_adj);
+         since_time += adj;              /* adjust for clock difference */
+      }
       /* Don't notify if time within 3 seconds */
       if (adj > 3 || adj < -3) {
          int type;
@@ -1817,10 +1817,7 @@ static void set_storage_auth_key(JCR *jcr, char *key)
     * We can be contacting multiple storage daemons.
     * So, make sure that any old jcr->store_bsock is cleaned up.
     */
-   if (jcr->store_bsock) {
-      jcr->store_bsock->destroy();
-      jcr->store_bsock = NULL;
-   }
+   free_bsock(jcr->store_bsock);
 
    /**
     * We can be contacting multiple storage daemons.
@@ -1877,10 +1874,10 @@ static int storage_cmd(JCR *jcr)
       }
    }
 
-   if (stored_port != 0) {
-      jcr->sd_calls_client = false;   /* We are doing the connecting */
+   if (stored_port != 0) { /* We are doing the connecting */
       Dmsg3(110, "Connect to storage: %s:%d ssl=%d\n", jcr->stored_addr, stored_port,
             enable_ssl);
+      jcr->sd_calls_client = false;
       sd = new_bsock();
       /* Open command communications with Storage daemon */
       /* Try to connect for 1 hour at 10 second intervals */
@@ -1904,7 +1901,9 @@ static int storage_cmd(JCR *jcr)
       struct timespec timeout;
       int errstat;
 
+      free_bsock(jcr->store_bsock);
       jcr->sd_calls_client = true;
+
       /*
        * Wait for the Storage daemon to contact us to start the Job,
        *  when he does, we will be released, unless the 30 minutes
@@ -1914,7 +1913,7 @@ static int storage_cmd(JCR *jcr)
       timeout.tv_nsec = tv.tv_usec * 1000;
       timeout.tv_sec = tv.tv_sec + 30 * 60;  /* wait 30 minutes */
       P(mutex);
-      while (jcr->store_bsock == NULL && !jcr->is_job_canceled()) {
+      while (jcr->sd_calls_client_bsock == NULL && !jcr->is_job_canceled()) {
          errstat = pthread_cond_timedwait(&jcr->job_start_wait, &mutex, &timeout);
          if (errstat == ETIMEDOUT || errstat == EINVAL || errstat == EPERM) {
             break;
@@ -1925,7 +1924,7 @@ static int storage_cmd(JCR *jcr)
       Dmsg2(800, "Auth fail or cancel for jid=%d %p\n", jcr->JobId, jcr);
 
       /* We should already have a storage connection! */
-      if (jcr->store_bsock == NULL) {
+      if (jcr->sd_calls_client_bsock == NULL) {
          Pmsg0(000, "Failed connect from Storage daemon. SD bsock=NULL.\n");
          Pmsg1(000, "Storagecmd: %s", dir->msg);
          Jmsg0(jcr, M_FATAL, 0, _("Failed connect from Storage daemon. SD bsock=NULL.\n"));
@@ -1934,9 +1933,18 @@ static int storage_cmd(JCR *jcr)
       if (jcr->is_job_canceled()) {
          goto bail_out;
       }
+      /* Assign the new socket to the main one */
+      jcr->lock_auth();
+      jcr->store_bsock = jcr->sd_calls_client_bsock;
+      jcr->sd_calls_client_bsock = NULL;
+      jcr->unlock_auth();
    }
    jcr->store_bsock->set_bwlimit(jcr->max_bandwidth);
 
+   if (!send_hello_sd(jcr, jcr->Job)) {
+      goto bail_out;
+   }
+
    if (!authenticate_storagedaemon(jcr)) {
       goto bail_out;
    }
@@ -1969,22 +1977,20 @@ static int backup_cmd(JCR *jcr)
    }
 
    /*
-    * Validate some options given to the backup make sense for the compiled in
-    * options of this filed.
-    */
-   if (jcr->ff->flags & FO_ACL && !have_acl) {
-      Jmsg(jcr, M_FATAL, 0, _("ACL support not configured for your machine.\n"));
-      goto cleanup;
-   }
-   if (jcr->ff->flags & FO_XATTR && !have_xattr) {
-      Jmsg(jcr, M_FATAL, 0, _("XATTR support not configured for your machine.\n"));
-      goto cleanup;
-   }
-
+    * If explicitly requesting FO_ACL or FO_XATTR, fail job if it
+    *  is not available on Client machine
+    */ 
+   if (jcr->ff->flags & FO_ACL && !(have_acl||have_win32)) {
+      Jmsg(jcr, M_FATAL, 0, _("ACL support not configured for Client.\n"));
+      goto cleanup; 
+   } 
+   if (jcr->ff->flags & FO_XATTR && !have_xattr) { 
+      Jmsg(jcr, M_FATAL, 0, _("XATTR support not configured for Client.\n"));
+      goto cleanup; 
+   } 
    jcr->setJobStatus(JS_Blocked);
    jcr->setJobType(JT_BACKUP);
    Dmsg1(100, "begin backup ff=%p\n", jcr->ff);
-
    if (sd == NULL) {
       Jmsg(jcr, M_FATAL, 0, _("Cannot contact Storage daemon\n"));
       dir->fsend(BADcmd, "backup");
@@ -2031,7 +2037,16 @@ static int backup_cmd(JCR *jcr)
    generate_daemon_event(jcr, "JobStart");
    generate_plugin_event(jcr, bEventStartBackupJob);
 
-   /*
+   if (jcr->Snapshot) {
+      Dmsg0(10, "Open a snapshot session\n");
+      /* TODO: See if we abort the job */
+      jcr->Snapshot = open_snapshot_backup_session(jcr);
+   }
+   /* Call RunScript just after the Snapshot creation, usually, we restart services */
+   run_scripts(jcr, jcr->RunScripts, "ClientAfterVSS");
+
+
+   /**
     * Send Files to Storage daemon
     */
    Dmsg1(110, "begin blast ff=%p\n", (FF_PKT *)jcr->ff);
@@ -2068,23 +2083,29 @@ static int backup_cmd(JCR *jcr)
        * Send Append Close to Storage daemon
        */
       sd->fsend(append_close, jcr->Ticket);
+      sd->msg[0] = 0;
       while (bget_msg(sd) >= 0) {    /* stop on signal or error */
          if (sscanf(sd->msg, OK_close, &SDJobStatus) == 1) {
             ok = 1;
             Dmsg2(200, "SDJobStatus = %d %c\n", SDJobStatus, (char)SDJobStatus);
+         } else {
+            Dmsg1(100, "append_close: scan fail from %s\n", sd->msg);
          }
       }
       if (!ok) {
          Jmsg(jcr, M_FATAL, 0, _("Append Close with SD failed.\n"));
+         Dmsg1(100, "append_close: scan fail from %s\n", sd->msg);
          goto cleanup;
       }
-      if (!(SDJobStatus == JS_Terminated || SDJobStatus == JS_Warnings)) {
+      if (!(SDJobStatus == JS_Terminated || SDJobStatus == JS_Warnings ||
+            SDJobStatus == JS_Incomplete)) {
          Jmsg(jcr, M_FATAL, 0, _("Bad status %d %c returned from Storage Daemon.\n"),
             SDJobStatus, (char)SDJobStatus);
       }
    }
 
 cleanup:
+
    generate_plugin_event(jcr, bEventEndBackupJob);
    return 0;                          /* return and stop command loop */
 }
@@ -2304,7 +2325,6 @@ static int restore_cmd(JCR *jcr)
    /* Inform Storage daemon that we are done */
    sd->signal(BNET_TERMINATE);
 
-
 bail_out:
    bfree_and_null(jcr->where);
 
@@ -2380,6 +2400,14 @@ static int open_sd_read_session(JCR *jcr)
    }
 
    /*
+    * Use interactive session for the current restore
+    */
+   if (jcr->interactive_session) {
+      sd->fsend(read_ctrl, jcr->Ticket);
+      Dmsg1(110, ">stored: %s", sd->msg);
+   }
+
+   /*
     * Start read of data with Storage daemon
     */
    sd->fsend(read_data, jcr->Ticket);
@@ -2400,8 +2428,18 @@ static int open_sd_read_session(JCR *jcr)
  */
 static void filed_free_jcr(JCR *jcr)
 {
-   free_bsock(jcr->dir_bsock);
-   free_bsock(jcr->store_bsock);
+   if (jcr->dir_bsock) {
+      free_bsock(jcr->dir_bsock);
+      jcr->dir_bsock = NULL;
+   }
+   if (jcr->sd_calls_client_bsock) {
+      free_bsock(jcr->sd_calls_client_bsock);
+      jcr->sd_calls_client_bsock = NULL;
+   }
+   if (jcr->store_bsock) {
+      free_bsock(jcr->store_bsock);
+      jcr->store_bsock = NULL;
+   }
    if (jcr->last_fname) {
       free_pool_memory(jcr->last_fname);
    }
@@ -2440,8 +2478,9 @@ int response(JCR *jcr, BSOCK *sd, char *resp, const char *cmd)
       Jmsg2(jcr, M_FATAL, 0, _("Comm error with SD. bad response to %s. ERR=%s\n"),
          cmd, sd->bstrerror());
    } else {
-      Jmsg3(jcr, M_FATAL, 0, _("Bad response from SD to %s command. Wanted %s, got %s\n"),
-         cmd, resp, sd->msg);
+      char buf[256];
+      Jmsg4(jcr, M_FATAL, 0, _("Bad response from SD to %s command. Wanted %s, got len=%ld msg=\"%s\"\n"),
+         cmd, resp, sd->msglen, smartdump(sd->msg, sd->msglen, buf, sizeof(buf)));
    }
    return 0;
 }
diff --git a/src/filed/protos.h b/src/filed/protos.h
index ac9863a..96a836c 100644
--- a/src/filed/protos.h
+++ b/src/filed/protos.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Written by Kern Sibbald, MM
@@ -21,10 +25,21 @@
 extern bool blast_data_to_storage_daemon(JCR *jcr, char *addr);
 extern void do_verify_volume(JCR *jcr);
 extern void do_restore(JCR *jcr);
-extern int authenticate_director(JCR *jcr);
-extern int authenticate_storagedaemon(JCR *jcr);
 extern int make_estimate(JCR *jcr);
 
+/* From authenticate.c */
+bool authenticate_director(JCR *jcr);
+bool authenticate_storagedaemon(JCR *jcr);
+
+/* From hello.c */
+bool validate_dir_hello(JCR *jcr);
+bool send_hello_ok(BSOCK *bs);
+bool send_sorry(BSOCK *bs);
+bool send_hello_sd(JCR *jcr, char *Job);
+void *handle_storage_connection(BSOCK *sd);
+bool send_fdcaps(JCR *jcr);
+bool recv_sdcaps(JCR *jcr);
+
 /* From verify.c */
 int digest_file(JCR *jcr, FF_PKT *ff_pkt, DIGEST *digest);
 void do_verify(JCR *jcr);
@@ -36,8 +51,9 @@ void start_dir_heartbeat(JCR *jcr);
 void stop_dir_heartbeat(JCR *jcr);
 
 /* From acl.c */
-bacl_exit_code build_acl_streams(JCR *jcr, FF_PKT *ff_pkt);
-bacl_exit_code parse_acl_streams(JCR *jcr, int stream, char *content, uint32_t content_length);
+bool backup_acl_streams(JCR *jcr, FF_PKT *ff_pkt);
+bacl_rtn_code restore_acl_streams(JCR *jcr, int stream, char *content, 
+   uint32_t content_length);
 
 /* from accurate.c */
 bool accurate_finish(JCR *jcr);
@@ -46,13 +62,13 @@ bool accurate_mark_file_as_seen(JCR *jcr, char *fname);
 void accurate_free(JCR *jcr);
 
 /* from backup.c */
-bool encode_and_send_attributes(JCR *jcr, FF_PKT *ff_pkt, int &data_stream);
 void strip_path(FF_PKT *ff_pkt);
 void unstrip_path(FF_PKT *ff_pkt);
 
 /* from xattr.c */
-bxattr_exit_code build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt);
-bxattr_exit_code parse_xattr_streams(JCR *jcr, int stream, char *content, uint32_t content_length);
+bool backup_xattr_streams(JCR *jcr, FF_PKT *ff_pkt);
+bxattr_rtn_code restore_xattr_streams(JCR *jcr, int stream, 
+   char *content, uint32_t content_length);
 
 /* from job.c */
 findINCEXE *new_exclude(JCR *jcr);
@@ -65,3 +81,6 @@ int add_options_to_fileset(JCR *jcr, const char *item);
 int add_wild_to_fileset(JCR *jcr, const char *item, int type);
 int add_regex_to_fileset(JCR *jcr, const char *item, int type);
 findINCEXE *new_include(JCR *jcr);
+
+/* from snapshot.c */
+int snapshot_cmd(JCR *jcr);
diff --git a/src/filed/restore.c b/src/filed/restore.c
index 4aa4898..24580bd 100644
--- a/src/filed/restore.c
+++ b/src/filed/restore.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *  Bacula File Daemon  restore.c Restorefiles.
@@ -56,14 +60,10 @@ const bool have_xattr = true;
 const bool have_xattr = false;
 #endif
 
-/*
- * Data received from Storage Daemon
- */
+/* Data received from Storage Daemon */
 static char rec_header[] = "rechdr %ld %ld %ld %ld %ld";
 
-/*
- * Forward referenced functions
- */
+/* Forward referenced functions */
 #if   defined(HAVE_LIBZ)
 static const char *zlib_strerror(int stat);
 const bool have_libz = true;
@@ -78,26 +78,26 @@ const bool have_lzo = false;
 
 static void deallocate_cipher(r_ctx &rctx);
 static void deallocate_fork_cipher(r_ctx &rctx);
+static bool verify_signature(r_ctx &rctx);
 static void free_signature(r_ctx &rctx);
 static void free_session(r_ctx &rctx);
-static bool close_previous_stream(JCR *jcr, r_ctx &rctx);
-static bool verify_signature(JCR *jcr, r_ctx &rctx);
-int32_t extract_data(JCR *jcr, BFILE *bfd, POOLMEM *buf, int32_t buflen,
-                     uint64_t *addr, int flags, int32_t stream, RESTORE_CIPHER_CTX *cipher_ctx);
-bool flush_cipher(JCR *jcr, BFILE *bfd, uint64_t *addr, int flags, int32_t stream,
+static bool close_previous_stream(r_ctx &rctx);
+static int32_t extract_data(r_ctx &rctx, POOLMEM *buf, int32_t buflen);
+static bool flush_cipher(r_ctx &rctx, BFILE *bfd,  uint64_t *addr, int flags, int32_t stream,
                   RESTORE_CIPHER_CTX *cipher_ctx);
 
 /*
  * Close a bfd check that we are at the expected file offset.
  * Makes use of some code from set_attributes().
  */
-static int bclose_chksize(JCR *jcr, BFILE *bfd, boffset_t osize)
+static int bclose_chksize(r_ctx &rctx, BFILE *bfd, boffset_t osize)
 {
    char ec1[50], ec2[50];
    boffset_t fsize;
+   JCR *jcr = rctx.jcr;
 
    fsize = blseek(bfd, 0, SEEK_CUR);
-   bclose(bfd);
+   bclose(bfd);                              /* first close file */
    if (fsize > 0 && fsize != osize) {
       Qmsg3(jcr, M_WARNING, 0, _("Size of data or stream of %s not correct. Original %s, restored %s.\n"),
             jcr->last_fname, edit_uint64(osize, ec1),
@@ -119,65 +119,76 @@ static bool restore_finderinfo(JCR *jcr, POOLMEM *buf, int32_t buflen)
    Dmsg0(130, "Restoring Finder Info\n");
    jcr->ff->flags |= FO_HFSPLUS;
    if (buflen != 32) {
-      Jmsg(jcr, M_WARNING, 0, _("Invalid length of Finder Info (got %d, not 32)\n"), buflen);
+      Jmsg(jcr, M_WARNING, 0, _("Invalid length of Finder Info (got %d, wanted 32)\n"), buflen);
       return false;
    }
 
    if (setattrlist(jcr->last_fname, &attrList, buf, buflen, 0) != 0) {
-      Jmsg(jcr, M_WARNING, 0, _("Could not set Finder Info on %s\n"), jcr->last_fname);
+      Jmsg(jcr, M_WARNING, 0, _("Error setting Finder Info on \"%s\"\n"), jcr->last_fname);
       return false;
    }
 
    return true;
 }
 #else
+
 static bool restore_finderinfo(JCR *jcr, POOLMEM *buf, int32_t buflen)
 {
    return true;
 }
+
 #endif
 
 /*
- * Cleanup of delayed restore stack with streams for later
- * processing.
- */
-static inline void drop_delayed_restore_streams(r_ctx &rctx, bool reuse)
+ * Cleanup of delayed restore stack with streams for later processing.
+ */ 
+static void drop_delayed_restore_streams(r_ctx &rctx, bool reuse)
 {
    RESTORE_DATA_STREAM *rds;
 
-   if (!rctx.delayed_streams ||
-       rctx.delayed_streams->empty()) {
+   if (!rctx.delayed_streams) {
+      if (reuse) {
+         rctx.delayed_streams = New(alist(10, owned_by_alist));
+      }
+      return;
+   }
+   if (rctx.delayed_streams->empty()) {
       return;
    }
 
    foreach_alist(rds, rctx.delayed_streams) {
-      free(rds->content);
+      if (rds->content) {
+         free(rds->content);
+         rds->content = NULL;
+      }
    }
-
    rctx.delayed_streams->destroy();
    if (reuse) {
       rctx.delayed_streams->init(10, owned_by_alist);
    }
 }
 
+
 /*
  * Push a data stream onto the delayed restore stack for
  * later processing.
  */
-static inline void push_delayed_restore_stream(r_ctx &rctx, BSOCK *sd)
+static inline void push_delayed_restore_stream(r_ctx &rctx, char *msg, int msglen)
 {
    RESTORE_DATA_STREAM *rds;
 
+   if (msglen <= 0) {
+      return;
+   }
    if (!rctx.delayed_streams) {
       rctx.delayed_streams = New(alist(10, owned_by_alist));
    }
 
    rds = (RESTORE_DATA_STREAM *)malloc(sizeof(RESTORE_DATA_STREAM));
    rds->stream = rctx.stream;
-   rds->content = (char *)malloc(sd->msglen);
-   memcpy(rds->content, sd->msg, sd->msglen);
-   rds->content_length = sd->msglen;
-
+   rds->content = (char *)malloc(msglen);
+   memcpy(rds->content, msg, msglen);
+   rds->content_length = msglen;
    rctx.delayed_streams->append(rds);
 }
 
@@ -185,26 +196,23 @@ static inline void push_delayed_restore_stream(r_ctx &rctx, BSOCK *sd)
  * Perform a restore of an ACL using the stream received.
  * This can either be a delayed restore or direct restore.
  */
-static inline bool do_restore_acl(JCR *jcr,
-                                  int stream,
-                                  char *content,
-                                  uint32_t content_length)
-
+static inline bool do_restore_acl(JCR *jcr, int stream, char *content,
+                                  uint32_t content_length) 
 {
-   switch (parse_acl_streams(jcr, stream, content, content_length)) {
-   case bacl_exit_fatal:
+   switch (restore_acl_streams(jcr, stream, content, content_length)) {
+   case bacl_rtn_fatal:
       return false;
-   case bacl_exit_error:
+   case bacl_rtn_error:
       /*
-       * Non-fatal errors, count them and when the number is under ACL_REPORT_ERR_MAX_PER_JOB
+       * Non-fatal errors, count them and when the number is under ACL_MAX_ERROR_PRINT_PER_JOB
        * print the error message set by the lower level routine in jcr->errmsg.
        */
-      if (jcr->acl_data->u.parse->nr_errors < ACL_REPORT_ERR_MAX_PER_JOB) {
+      if (jcr->acl_ctx->nr_errors < ACL_MAX_ERROR_PRINT_PER_JOB) {
          Jmsg(jcr, M_WARNING, 0, "%s", jcr->errmsg);
       }
-      jcr->acl_data->u.parse->nr_errors++;
+      jcr->acl_ctx->nr_errors++;
       break;
-   case bacl_exit_ok:
+   case bacl_rtn_ok:
       break;
    }
    return true;
@@ -214,25 +222,23 @@ static inline bool do_restore_acl(JCR *jcr,
  * Perform a restore of an XATTR using the stream received.
  * This can either be a delayed restore or direct restore.
  */
-static inline bool do_restore_xattr(JCR *jcr,
-                                    int stream,
-                                    char *content,
-                                    uint32_t content_length)
+static inline bool do_restore_xattr(JCR *jcr, int stream, char *content,
+                                    uint32_t content_length) 
 {
-   switch (parse_xattr_streams(jcr, stream, content, content_length)) {
-   case bxattr_exit_fatal:
+   switch (restore_xattr_streams(jcr, stream, content, content_length)) {
+   case bxattr_rtn_fatal:
       return false;
-   case bxattr_exit_error:
+   case bxattr_rtn_error:
       /*
-       * Non-fatal errors, count them and when the number is under XATTR_REPORT_ERR_MAX_PER_JOB
+       * Non-fatal errors, count them and when the number is under XATTR_MAX_ERROR_PRINT_PER_JOB
        * print the error message set by the lower level routine in jcr->errmsg.
        */
-      if (jcr->xattr_data->u.parse->nr_errors < XATTR_REPORT_ERR_MAX_PER_JOB) {
+      if (jcr->xattr_ctx->nr_errors < XATTR_MAX_ERROR_PRINT_PER_JOB) {
          Jmsg(jcr, M_WARNING, 0, "%s", jcr->errmsg);
       }
-      jcr->xattr_data->u.parse->nr_errors++;
+      jcr->xattr_ctx->nr_errors++;
       break;
-   case bxattr_exit_ok:
+   case bxattr_rtn_ok:
       break;
    }
    return true;
@@ -245,9 +251,10 @@ static inline bool do_restore_xattr(JCR *jcr,
  * attributes otherwise we might clear some security flags
  * by setting the attributes.
  */
-static inline bool pop_delayed_data_streams(JCR *jcr, r_ctx &rctx)
+static inline bool pop_delayed_data_streams(r_ctx &rctx)
 {
    RESTORE_DATA_STREAM *rds;
+   JCR *jcr = rctx.jcr;
 
    /*
     * See if there is anything todo.
@@ -273,29 +280,28 @@ static inline bool pop_delayed_data_streams(JCR *jcr, r_ctx &rctx)
       case STREAM_UNIX_ACCESS_ACL:
       case STREAM_UNIX_DEFAULT_ACL:
       case STREAM_ACL_AIX_TEXT:
-      case STREAM_ACL_DARWIN_ACCESS_ACL:
-      case STREAM_ACL_FREEBSD_DEFAULT_ACL:
-      case STREAM_ACL_FREEBSD_ACCESS_ACL:
+      case STREAM_ACL_DARWIN_ACCESS:
+      case STREAM_ACL_FREEBSD_DEFAULT:
+      case STREAM_ACL_FREEBSD_ACCESS:
       case STREAM_ACL_HPUX_ACL_ENTRY:
-      case STREAM_ACL_IRIX_DEFAULT_ACL:
-      case STREAM_ACL_IRIX_ACCESS_ACL:
-      case STREAM_ACL_LINUX_DEFAULT_ACL:
-      case STREAM_ACL_LINUX_ACCESS_ACL:
-      case STREAM_ACL_TRU64_DEFAULT_ACL:
-      case STREAM_ACL_TRU64_DEFAULT_DIR_ACL:
-      case STREAM_ACL_TRU64_ACCESS_ACL:
-      case STREAM_ACL_SOLARIS_ACLENT:
-      case STREAM_ACL_SOLARIS_ACE:
+      case STREAM_ACL_IRIX_DEFAULT:
+      case STREAM_ACL_IRIX_ACCESS:
+      case STREAM_ACL_LINUX_DEFAULT:
+      case STREAM_ACL_LINUX_ACCESS:
+      case STREAM_ACL_TRU64_DEFAULT:
+      case STREAM_ACL_TRU64_DEFAULT_DIR:
+      case STREAM_ACL_TRU64_ACCESS:
+      case STREAM_ACL_SOLARIS_POSIX:
+      case STREAM_ACL_SOLARIS_NFS4:
       case STREAM_ACL_AFS_TEXT:
       case STREAM_ACL_AIX_AIXC:
       case STREAM_ACL_AIX_NFS4:
-      case STREAM_ACL_FREEBSD_NFS4_ACL:
-      case STREAM_ACL_HURD_DEFAULT_ACL:
-      case STREAM_ACL_HURD_ACCESS_ACL:
+      case STREAM_ACL_FREEBSD_NFS4:
+      case STREAM_ACL_HURD_DEFAULT:
+      case STREAM_ACL_HURD_ACCESS:
          if (!do_restore_acl(jcr, rds->stream, rds->content, rds->content_length)) {
-            goto bail_out;
+            goto get_out;
          }
-         free(rds->content);
          break;
       case STREAM_XATTR_HURD:
       case STREAM_XATTR_IRIX:
@@ -308,39 +314,29 @@ static inline bool pop_delayed_data_streams(JCR *jcr, r_ctx &rctx)
       case STREAM_XATTR_LINUX:
       case STREAM_XATTR_NETBSD:
          if (!do_restore_xattr(jcr, rds->stream, rds->content, rds->content_length)) {
-            goto bail_out;
+            goto get_out;
          }
-         free(rds->content);
          break;
       default:
          Jmsg(jcr, M_WARNING, 0, _("Unknown stream=%d ignored. This shouldn't happen!\n"),
               rds->stream);
          break;
       }
+      if (rds->content) {
+         free(rds->content);
+         rds->content = NULL;
+      }
    }
-
-   /*
-    * We processed the stack so we can destroy it.
-    */
-   rctx.delayed_streams->destroy();
-
-   /*
-    * (Re)Initialize the stack for a new use.
-    */
-   rctx.delayed_streams->init(10, owned_by_alist);
-
+   
+   drop_delayed_restore_streams(rctx, true);
    return true;
 
-bail_out:
-
-   /*
-    * Destroy the content of the stack and (re)initialize it for a new use.
-    */
+get_out:
    drop_delayed_restore_streams(rctx, true);
-
    return false;
 }
 
+
 /*
  * Restore the requested files.
  */
@@ -349,10 +345,10 @@ void do_restore(JCR *jcr)
    BSOCK *sd;
    uint32_t VolSessionId, VolSessionTime;
    int32_t file_index;
-   char ec1[50];                      /* Buffer printing huge values */
-   uint32_t buf_size;                 /* client buffer size */
+   char ec1[50];                       /* Buffer printing huge values */
+   uint32_t buf_size;                  /* client buffer size */
    int stat;
-   int64_t rsrc_len = 0;              /* Original length of resource fork */
+   int64_t rsrc_len = 0;               /* Original length of resource fork */
    r_ctx rctx;
    ATTR *attr;
    /* ***FIXME*** make configurable */
@@ -361,17 +357,15 @@ void do_restore(JCR *jcr)
    memset(&rctx, 0, sizeof(rctx));
    rctx.jcr = jcr;
 
-   /*
-    * The following variables keep track of "known unknowns"
-    */
-   int non_support_data = 0;
-   int non_support_attr = 0;
-   int non_support_rsrc = 0;
-   int non_support_finfo = 0;
-   int non_support_acl = 0;
-   int non_support_progname = 0;
-   int non_support_crypto = 0;
-   int non_support_xattr = 0;
+   /* The following variables keep track of "known unknowns" */
+   int non_suppored_data = 0;
+   int non_suppored_attr = 0;
+   int non_suppored_rsrc = 0;
+   int non_suppored_finfo = 0;
+   int non_suppored_acl = 0;
+   int non_suppored_progname = 0;
+   int non_suppored_crypto = 0;
+   int non_suppored_xattr = 0;
 
    sd = jcr->store_bsock;
    jcr->setJobStatus(JS_Running);
@@ -390,10 +384,6 @@ void do_restore(JCR *jcr)
    }
    jcr->buf_size = sd->msglen;
 
-   /*
-    * St Bernard code goes here if implemented -- see end of file
-    */
-
    /* use the same buffer size to decompress both gzip and lzo */
    if (have_libz || have_lzo) {
       uint32_t compress_buf_size = jcr->buf_size + 12 + ((jcr->buf_size+999) / 1000) + 100;
@@ -401,10 +391,17 @@ void do_restore(JCR *jcr)
       jcr->compress_buf_size = compress_buf_size;
    }
 
+
+   GetMsg *fdmsg;
+   fdmsg = New(GetMsg(jcr, sd, rec_header, GETMSG_MAX_MSG_SIZE));
+
+   fdmsg->start_read_sock();
+   bmessage *bmsg = fdmsg->new_msg(); /* get a message, to exchange with fdmsg */
+
 #ifdef HAVE_LZO
    if (lzo_init() != LZO_E_OK) {
       Jmsg(jcr, M_FATAL, 0, _("LZO init failed\n"));
-      goto bail_out;
+      goto get_out;
    }
 #endif
 
@@ -420,7 +417,7 @@ void do_restore(JCR *jcr)
     *   receive records in the following order:
     *   1. Stream record header
     *   2. Stream data (one or more of the following in the order given)
-    *        a. Attributes (Unix or Win32)
+    *        a. Attributes (Unix or Windows)
     *        b. Possibly stream encryption session data (e.g., symmetric session key)
     *        c. File data for the file
     *        d. Alternate data stream (e.g. Resource Fork)
@@ -448,80 +445,62 @@ void do_restore(JCR *jcr)
    binit(&rctx.forkbfd);
    attr = rctx.attr = new_attr(jcr);
    if (have_acl) {
-      jcr->acl_data = (acl_data_t *)malloc(sizeof(acl_data_t));
-      memset(jcr->acl_data, 0, sizeof(acl_data_t));
-      jcr->acl_data->u.parse = (acl_parse_data_t *)malloc(sizeof(acl_parse_data_t));
-      memset(jcr->acl_data->u.parse, 0, sizeof(acl_parse_data_t));
+      jcr->acl_ctx = (acl_ctx_t *)malloc(sizeof(acl_ctx_t));
+      memset(jcr->acl_ctx, 0, sizeof(acl_ctx_t));
    }
    if (have_xattr) {
-      jcr->xattr_data = (xattr_data_t *)malloc(sizeof(xattr_data_t));
-      memset(jcr->xattr_data, 0, sizeof(xattr_data_t));
-      jcr->xattr_data->u.parse = (xattr_parse_data_t *)malloc(sizeof(xattr_parse_data_t));
-      memset(jcr->xattr_data->u.parse, 0, sizeof(xattr_parse_data_t));
+      jcr->xattr_ctx = (xattr_ctx_t *)malloc(sizeof(xattr_ctx_t));
+      memset(jcr->xattr_ctx, 0, sizeof(xattr_ctx_t));
    }
 
-   while (bget_msg(sd) >= 0 && !job_canceled(jcr)) {
-      /*
-       * Remember previous stream type
-       */
+   Dsm_check(200);
+   while (fdmsg->bget_msg(&bmsg) >= 0 && !job_canceled(jcr)) {
+      /* Remember previous stream type */
       rctx.prev_stream = rctx.stream;
 
-      /*
-       * First we expect a Stream Record Header
-       */
-      if (sscanf(sd->msg, rec_header, &VolSessionId, &VolSessionTime, &file_index,
+      /* First we expect a Stream Record Header */
+      Dsm_check(200);
+      if (sscanf(bmsg->rbuf, rec_header, &VolSessionId, &VolSessionTime, &file_index,
           &rctx.full_stream, &rctx.size) != 5) {
-         Jmsg1(jcr, M_FATAL, 0, _("Record header scan error: %s\n"), sd->msg);
-         goto bail_out;
+         Jmsg1(jcr, M_FATAL, 0, _("Record header scan error: %s\n"), bmsg->rbuf);
+         goto get_out;
       }
       /* Strip off new stream high bits */
       rctx.stream = rctx.full_stream & STREAMMASK_TYPE;
-      Dmsg5(150, "Got hdr: Files=%d FilInx=%d size=%d Stream=%d, %s.\n",
-            jcr->JobFiles, file_index, rctx.size, rctx.stream, stream_to_ascii(rctx.stream));
 
-      /*
-       * Now we expect the Stream Data
-       */
-      if (bget_msg(sd) < 0) {
+      /* Now we expect the Stream Data */
+      if (fdmsg->bget_msg(&bmsg) < 0) {
          Jmsg1(jcr, M_FATAL, 0, _("Data record error. ERR=%s\n"), sd->bstrerror());
-         goto bail_out;
+         goto get_out;
       }
-      if (rctx.size != (uint32_t)sd->msglen) {
+      if (rctx.size != (uint32_t)bmsg->origlen) {
          Jmsg2(jcr, M_FATAL, 0, _("Actual data size %d not same as header %d\n"),
-               sd->msglen, rctx.size);
+               bmsg->origlen, rctx.size);
          Dmsg2(50, "Actual data size %d not same as header %d\n",
-               sd->msglen, rctx.size);
-         goto bail_out;
+               bmsg->origlen, rctx.size);
+         goto get_out;
       }
-      Dmsg3(130, "Got stream: %s len=%d extract=%d\n", stream_to_ascii(rctx.stream),
-            sd->msglen, rctx.extract);
+      Dmsg3(620, "Got stream: %s len=%d extract=%d\n", stream_to_ascii(rctx.stream),
+            bmsg->msglen, rctx.extract);
 
-      /*
-       * If we change streams, close and reset alternate data streams
-       */
+      /* If we change streams, close and reset alternate data streams */
       if (rctx.prev_stream != rctx.stream) {
          if (is_bopen(&rctx.forkbfd)) {
             deallocate_fork_cipher(rctx);
-            bclose_chksize(jcr, &rctx.forkbfd, rctx.fork_size);
+            bclose_chksize(rctx, &rctx.forkbfd, rctx.fork_size);
          }
-         /*
-          * Use an impossible value and set a proper one below
-          */
+         /* Use an impossible value and set a proper one below */
          rctx.fork_size = -1;
          rctx.fork_addr = 0;
       }
 
-      /*
-       * File Attributes stream
-       */
+      /* File Attributes stream */
       switch (rctx.stream) {
       case STREAM_UNIX_ATTRIBUTES:
       case STREAM_UNIX_ATTRIBUTES_EX:
-         /*
-          * if any previous stream open, close it
-          */
-         if (!close_previous_stream(jcr, rctx)) {
-            goto bail_out;
+         /* if any previous stream open, close it */
+         if (!close_previous_stream(rctx)) {
+            goto get_out;
          }
 
          /*
@@ -541,8 +520,8 @@ void do_restore(JCR *jcr)
          /*
           * Unpack attributes and do sanity check them
           */
-         if (!unpack_attributes_record(jcr, rctx.stream, sd->msg, sd->msglen, attr)) {
-            goto bail_out;
+         if (!unpack_attributes_record(jcr, rctx.stream, bmsg->rbuf, bmsg->rbuflen, attr)) {
+            goto get_out;
          }
 
          attr->data_stream = decode_stat(attr->attr, &attr->statp, sizeof(attr->statp), &attr->LinkFI);
@@ -550,13 +529,13 @@ void do_restore(JCR *jcr)
          Dmsg5(100, "Stream %d: %s, File %s\nattrib=%s\nattribsEx=%s\n",
                attr->data_stream, stream_to_ascii(attr->data_stream),
                attr->fname, attr->attr, attr->attrEx);
-         Dmsg3(100, "=== msglen=%d attrExlen=%d msg=%s\n", sd->msglen,
-               strlen(attr->attrEx), sd->msg);
+         Dmsg3(100, "=== msglen=%d attrExlen=%d msg=%s\n", bmsg->rbuflen,
+               strlen(attr->attrEx), bmsg->rbuf);
 
          if (!is_restore_stream_supported(attr->data_stream)) {
             Dmsg2(15, "Non-supported data stream %d: %s\n",
                attr->data_stream, stream_to_ascii(attr->data_stream));
-            if (!non_support_data++) {
+            if (!non_suppored_data++) {
                Jmsg(jcr, M_WARNING, 0, _("%s stream not supported on this Client.\n"),
                     stream_to_ascii(attr->data_stream));
             }
@@ -567,7 +546,7 @@ void do_restore(JCR *jcr)
 
          /*
           * Try to actually create the file, which returns a status telling
-          * us if we need to extract or not.
+          *  us if we need to extract or not.
           */
          jcr->num_files_examined++;
          rctx.extract = false;
@@ -590,25 +569,16 @@ void do_restore(JCR *jcr)
          case CF_SKIP:
             jcr->JobFiles++;
             break;
-         case CF_EXTRACT:
-            /*
-             * File created and we expect file data
-             */
+         case CF_EXTRACT:      /* File created and we expect file data */
             rctx.extract = true;
-            /*
-             * FALLTHROUGH
-             */
-         case CF_CREATED:
-            /*
-             * File created, but there is no content
-             */
+            /* FALLTHROUGH WANTED */
+         case CF_CREATED:      /* File created, but there is no content */
+            /* File created, but there is no content */
             rctx.fileAddr = 0;
             print_ls_output(jcr, attr);
 
             if (have_darwin_os) {
-               /*
-                * Only restore the resource fork for regular files
-                */
+               /* Only restore the resource fork for regular files */
                from_base64(&rsrc_len, attr->attrEx);
                if (attr->type == FT_REG && rsrc_len > 0) {
                   rctx.extract = true;
@@ -625,9 +595,7 @@ void do_restore(JCR *jcr)
             }
 
             if (!rctx.extract) {
-               /*
-                * set attributes now because file will not be extracted
-                */
+               /* set attributes now because file will not be extracted */
                if (jcr->plugin) {
                   plugin_set_attributes(jcr, attr, &rctx.bfd);
                } else {
@@ -638,15 +606,16 @@ void do_restore(JCR *jcr)
          }
          break;
 
-      /*
-       * Data stream
-       */
+      /* Data stream */
       case STREAM_ENCRYPTED_SESSION_DATA:
          crypto_error_t cryptoerr;
 
-         /*
-          * Is this an unexpected session data entry?
-          */
+         /* The current file will not be extracted, do not create a crypto session */
+         if (!rctx.extract) {
+            break;
+         }
+
+         /* Is this an unexpected session data entry? */
          if (rctx.cs) {
             Jmsg0(jcr, M_ERROR, 0, _("Unexpected cryptographic session data stream.\n"));
             rctx.extract = false;
@@ -654,9 +623,7 @@ void do_restore(JCR *jcr)
             continue;
          }
 
-         /*
-          * Do we have any keys at all?
-          */
+         /* Do we have any keys at all? */
          if (!jcr->crypto.pki_recipients) {
             Jmsg(jcr, M_ERROR, 0, _("No private decryption keys have been defined to decrypt encrypted backup data.\n"));
             rctx.extract = false;
@@ -675,16 +642,12 @@ void do_restore(JCR *jcr)
             break;
          }
 
-         /*
-          * Decode and save session keys.
-          */
-         cryptoerr = crypto_session_decode((uint8_t *)sd->msg, (uint32_t)sd->msglen,
+         /* Decode and save session keys. */
+         cryptoerr = crypto_session_decode((uint8_t *)bmsg->rbuf, (uint32_t)bmsg->rbuflen,
                         jcr->crypto.pki_recipients, &rctx.cs);
          switch (cryptoerr) {
          case CRYPTO_ERROR_NONE:
-            /*
-             * Success
-             */
+            /* Success */
             break;
          case CRYPTO_ERROR_NORECIPIENT:
             Jmsg(jcr, M_ERROR, 0, _("Missing private key required to decrypt encrypted backup data.\n"));
@@ -731,9 +694,7 @@ void do_restore(JCR *jcr)
       case STREAM_ENCRYPTED_WIN32_GZIP_DATA:
       case STREAM_ENCRYPTED_FILE_COMPRESSED_DATA:
       case STREAM_ENCRYPTED_WIN32_COMPRESSED_DATA:
-         /*
-          * Force an expected, consistent stream type here
-          */
+         /* Force an expected, consistent stream type here */
          if (rctx.extract && (rctx.prev_stream == rctx.stream
                          || rctx.prev_stream == STREAM_UNIX_ATTRIBUTES
                          || rctx.prev_stream == STREAM_UNIX_ATTRIBUTES_EX
@@ -766,9 +727,7 @@ void do_restore(JCR *jcr)
                   || rctx.stream == STREAM_ENCRYPTED_FILE_COMPRESSED_DATA
                   || rctx.stream == STREAM_ENCRYPTED_WIN32_COMPRESSED_DATA
                   || rctx.stream == STREAM_ENCRYPTED_WIN32_GZIP_DATA) {
-               /*
-                * Set up a decryption context
-                */
+               /* Set up a decryption context */
                if (!rctx.cipher_ctx.cipher) {
                   if (!rctx.cs) {
                      Jmsg1(jcr, M_ERROR, 0, _("Missing encryption session data stream for %s\n"), jcr->last_fname);
@@ -792,14 +751,10 @@ void do_restore(JCR *jcr)
             if (is_win32_stream(rctx.stream) &&
                 (win32decomp || !have_win32_api())) {
                set_portable_backup(&rctx.bfd);
-               /*
-                * "decompose" BackupWrite data
-                */
-               rctx.flags |= FO_WIN32DECOMP;
+               rctx.flags |= FO_WIN32DECOMP; /* "decompose" BackupWrite data */
             }
 
-            if (extract_data(jcr, &rctx.bfd, sd->msg, sd->msglen, &rctx.fileAddr,
-                             rctx.flags, rctx.stream, &rctx.cipher_ctx) < 0) {
+            if (extract_data(rctx, bmsg->rbuf, bmsg->rbuflen) < 0) {
                rctx.extract = false;
                bclose(&rctx.bfd);
                continue;
@@ -820,9 +775,7 @@ void do_restore(JCR *jcr)
             if (rctx.stream == STREAM_ENCRYPTED_MACOS_FORK_DATA) {
                rctx.fork_flags |= FO_ENCRYPT;
 
-               /*
-                * Set up a decryption context
-                */
+               /* Set up a decryption context */
                if (rctx.extract && !rctx.fork_cipher_ctx.cipher) {
                   if (!rctx.cs) {
                      Jmsg1(jcr, M_ERROR, 0, _("Missing encryption session data stream for %s\n"), jcr->last_fname);
@@ -853,50 +806,49 @@ void do_restore(JCR *jcr)
                   Dmsg0(130, "Restoring resource fork\n");
                }
 
-               if (extract_data(jcr, &rctx.forkbfd, sd->msg, sd->msglen, &rctx.fork_addr, rctx.fork_flags,
-                                rctx.stream, &rctx.fork_cipher_ctx) < 0) {
+               if (extract_data(rctx, bmsg->rbuf, bmsg->rbuflen) < 0) {
                   rctx.extract = false;
                   bclose(&rctx.forkbfd);
                   continue;
                }
             }
          } else {
-            non_support_rsrc++;
+            non_suppored_rsrc++;
          }
          break;
 
       case STREAM_HFSPLUS_ATTRIBUTES:
          if (have_darwin_os) {
-            if (!restore_finderinfo(jcr, sd->msg, sd->msglen)) {
+            if (!restore_finderinfo(jcr, bmsg->rbuf, bmsg->rbuflen)) {
                continue;
             }
          } else {
-            non_support_finfo++;
+            non_suppored_finfo++;
          }
          break;
 
       case STREAM_UNIX_ACCESS_ACL:
       case STREAM_UNIX_DEFAULT_ACL:
       case STREAM_ACL_AIX_TEXT:
-      case STREAM_ACL_DARWIN_ACCESS_ACL:
-      case STREAM_ACL_FREEBSD_DEFAULT_ACL:
-      case STREAM_ACL_FREEBSD_ACCESS_ACL:
+      case STREAM_ACL_DARWIN_ACCESS:
+      case STREAM_ACL_FREEBSD_DEFAULT:
+      case STREAM_ACL_FREEBSD_ACCESS:
       case STREAM_ACL_HPUX_ACL_ENTRY:
-      case STREAM_ACL_IRIX_DEFAULT_ACL:
-      case STREAM_ACL_IRIX_ACCESS_ACL:
-      case STREAM_ACL_LINUX_DEFAULT_ACL:
-      case STREAM_ACL_LINUX_ACCESS_ACL:
-      case STREAM_ACL_TRU64_DEFAULT_ACL:
-      case STREAM_ACL_TRU64_DEFAULT_DIR_ACL:
-      case STREAM_ACL_TRU64_ACCESS_ACL:
-      case STREAM_ACL_SOLARIS_ACLENT:
-      case STREAM_ACL_SOLARIS_ACE:
+      case STREAM_ACL_IRIX_DEFAULT:
+      case STREAM_ACL_IRIX_ACCESS:
+      case STREAM_ACL_LINUX_DEFAULT:
+      case STREAM_ACL_LINUX_ACCESS:
+      case STREAM_ACL_TRU64_DEFAULT:
+      case STREAM_ACL_TRU64_DEFAULT_DIR:
+      case STREAM_ACL_TRU64_ACCESS:
+      case STREAM_ACL_SOLARIS_POSIX:
+      case STREAM_ACL_SOLARIS_NFS4:
       case STREAM_ACL_AFS_TEXT:
       case STREAM_ACL_AIX_AIXC:
       case STREAM_ACL_AIX_NFS4:
-      case STREAM_ACL_FREEBSD_NFS4_ACL:
-      case STREAM_ACL_HURD_DEFAULT_ACL:
-      case STREAM_ACL_HURD_ACCESS_ACL:
+      case STREAM_ACL_FREEBSD_NFS4:
+      case STREAM_ACL_HURD_DEFAULT:
+      case STREAM_ACL_HURD_ACCESS:
          /*
           * Do not restore ACLs when
           * a) The current file is not extracted
@@ -914,14 +866,14 @@ void do_restore(JCR *jcr)
              * the restore of acls till a later stage.
              */
             if (jcr->last_type != FT_DIREND) {
-               push_delayed_restore_stream(rctx, sd);
+               push_delayed_restore_stream(rctx, bmsg->rbuf, bmsg->rbuflen);
             } else {
-               if (!do_restore_acl(jcr, rctx.stream, sd->msg, sd->msglen)) {
-                  goto bail_out;
+               if (!do_restore_acl(jcr, rctx.stream, bmsg->rbuf, bmsg->rbuflen)) {
+                  goto get_out;
                }
             }
          } else {
-            non_support_acl++;
+            non_suppored_acl++;
          }
          break;
 
@@ -952,14 +904,14 @@ void do_restore(JCR *jcr)
              * the restore of xattr till a later stage.
              */
             if (jcr->last_type != FT_DIREND) {
-               push_delayed_restore_stream(rctx, sd);
+               push_delayed_restore_stream(rctx, bmsg->rbuf, bmsg->rbuflen);
             } else {
-               if (!do_restore_xattr(jcr, rctx.stream, sd->msg, sd->msglen)) {
-                  goto bail_out;
+               if (!do_restore_xattr(jcr, rctx.stream, bmsg->rbuf, bmsg->rbuflen)) {
+                  goto get_out;
                }
             }
          } else {
-            non_support_xattr++;
+            non_suppored_xattr++;
          }
          break;
 
@@ -976,27 +928,23 @@ void do_restore(JCR *jcr)
             break;
          }
          if (have_xattr) {
-            if (!do_restore_xattr(jcr, rctx.stream, sd->msg, sd->msglen)) {
-               goto bail_out;
+            if (!do_restore_xattr(jcr, rctx.stream, bmsg->rbuf, bmsg->rbuflen)) {
+               goto get_out;
             }
          } else {
-            non_support_xattr++;
+            non_suppored_xattr++;
          }
          break;
 
       case STREAM_SIGNED_DIGEST:
-         /*
-          * Is this an unexpected signature?
-          */
+         /* Is this an unexpected signature? */
          if (rctx.sig) {
             Jmsg0(jcr, M_ERROR, 0, _("Unexpected cryptographic signature data stream.\n"));
             free_signature(rctx);
             continue;
          }
-         /*
-          * Save signature.
-          */
-         if (rctx.extract && (rctx.sig = crypto_sign_decode(jcr, (uint8_t *)sd->msg, (uint32_t)sd->msglen)) == NULL) {
+         /* Save signature. */
+         if (rctx.extract && (rctx.sig = crypto_sign_decode(jcr, (uint8_t *)bmsg->rbuf, (uint32_t)bmsg->rbuflen)) == NULL) {
             Jmsg1(jcr, M_ERROR, 0, _("Failed to decode message signature for %s\n"), jcr->last_fname);
          }
          break;
@@ -1009,32 +957,33 @@ void do_restore(JCR *jcr)
 
       case STREAM_PROGRAM_NAMES:
       case STREAM_PROGRAM_DATA:
-         if (!non_support_progname) {
+         if (!non_suppored_progname) {
             Pmsg0(000, "Got Program Name or Data Stream. Ignored.\n");
-            non_support_progname++;
+            non_suppored_progname++;
          }
          break;
 
       case STREAM_PLUGIN_NAME:
-         if (!close_previous_stream(jcr, rctx)) {
-            goto bail_out;
+         if (!close_previous_stream(rctx)) {
+            goto get_out;
          }
-         Dmsg1(150, "restore stream_plugin_name=%s\n", sd->msg);
-         plugin_name_stream(jcr, sd->msg);
+         Dmsg1(150, "restore stream_plugin_name=%s\n", bmsg->rbuf);
+         plugin_name_stream(jcr, bmsg->rbuf);
          break;
 
       case STREAM_RESTORE_OBJECT:
          break;                    /* these are sent by Director */
 
       default:
-         if (!close_previous_stream(jcr, rctx)) {
-            goto bail_out;
+         if (!close_previous_stream(rctx)) {
+            goto get_out;
          }
          Jmsg(jcr, M_WARNING, 0, _("Unknown stream=%d ignored. This shouldn't happen!\n"),
               rctx.stream);
-         Dmsg2(0, "Unknown stream=%d data=%s\n", rctx.stream, sd->msg);
+         Dmsg2(0, "Unknown stream=%d data=%s\n", rctx.stream, bmsg->rbuf);
          break;
       } /* end switch(stream) */
+      Dsm_check(200);
    } /* end while get_msg() */
 
    /*
@@ -1042,55 +991,58 @@ void do_restore(JCR *jcr)
     * archive since we just hit an end of file, so close the file.
     */
    if (is_bopen(&rctx.forkbfd)) {
-      bclose_chksize(jcr, &rctx.forkbfd, rctx.fork_size);
+      bclose_chksize(rctx, &rctx.forkbfd, rctx.fork_size);
    }
 
-   if (!close_previous_stream(jcr, rctx)) {
-      goto bail_out;
+   if (!close_previous_stream(rctx)) {
+      goto get_out;
    }
    jcr->setJobStatus(JS_Terminated);
    goto ok_out;
 
-bail_out:
+get_out:
    jcr->setJobStatus(JS_ErrorTerminated);
 
 ok_out:
+   Dsm_check(200);
+   fdmsg->wait_read_sock();
+   delete bmsg;
+   free_GetMsg(fdmsg);
+   Dsm_check(200);
    /*
     * First output the statistics.
     */
    Dmsg2(10, "End Do Restore. Files=%d Bytes=%s\n", jcr->JobFiles,
       edit_uint64(jcr->JobBytes, ec1));
-   if (have_acl && jcr->acl_data->u.parse->nr_errors > 0) {
+   if (have_acl && jcr->acl_ctx->nr_errors > 0) {
       Jmsg(jcr, M_WARNING, 0, _("Encountered %ld acl errors while doing restore\n"),
-           jcr->acl_data->u.parse->nr_errors);
+           jcr->acl_ctx->nr_errors);
    }
-   if (have_xattr && jcr->xattr_data->u.parse->nr_errors > 0) {
+   if (have_xattr && jcr->xattr_ctx->nr_errors > 0) {
       Jmsg(jcr, M_WARNING, 0, _("Encountered %ld xattr errors while doing restore\n"),
-           jcr->xattr_data->u.parse->nr_errors);
+           jcr->xattr_ctx->nr_errors);
    }
-   if (non_support_data > 1 || non_support_attr > 1) {
+   if (non_suppored_data > 1 || non_suppored_attr > 1) {
       Jmsg(jcr, M_WARNING, 0, _("%d non-supported data streams and %d non-supported attrib streams ignored.\n"),
-         non_support_data, non_support_attr);
-   }
-   if (non_support_rsrc) {
-      Jmsg(jcr, M_INFO, 0, _("%d non-supported resource fork streams ignored.\n"), non_support_rsrc);
-   }
-   if (non_support_finfo) {
-      Jmsg(jcr, M_INFO, 0, _("%d non-supported Finder Info streams ignored.\n"), non_support_finfo);
-   }
-   if (non_support_acl) {
-      Jmsg(jcr, M_INFO, 0, _("%d non-supported acl streams ignored.\n"), non_support_acl);
-   }
-   if (non_support_crypto) {
-      Jmsg(jcr, M_INFO, 0, _("%d non-supported crypto streams ignored.\n"), non_support_acl);
-   }
-   if (non_support_xattr) {
-      Jmsg(jcr, M_INFO, 0, _("%d non-supported xattr streams ignored.\n"), non_support_xattr);
-   }
-
-   /*
-    * Free Signature & Crypto Data
-    */
+         non_suppored_data, non_suppored_attr);
+   } 
+   if (non_suppored_rsrc) {
+      Jmsg(jcr, M_INFO, 0, _("%d non-supported resource fork streams ignored.\n"), non_suppored_rsrc);
+   } 
+   if (non_suppored_finfo) {
+      Jmsg(jcr, M_INFO, 0, _("%d non-supported Finder Info streams ignored.\n"), non_suppored_finfo);
+   } 
+   if (non_suppored_acl) {
+      Jmsg(jcr, M_INFO, 0, _("%d non-supported acl streams ignored.\n"), non_suppored_acl);
+   } 
+   if (non_suppored_crypto) {
+      Jmsg(jcr, M_INFO, 0, _("%d non-supported crypto streams ignored.\n"), non_suppored_acl);
+   } 
+   if (non_suppored_xattr) {
+      Jmsg(jcr, M_INFO, 0, _("%d non-supported xattr streams ignored.\n"), non_suppored_xattr);
+   } 
+ 
+   /* Free Signature & Crypto Data */
    free_signature(rctx);
    free_session(rctx);
    if (jcr->crypto.digest) {
@@ -1098,22 +1050,18 @@ ok_out:
       jcr->crypto.digest = NULL;
    }
 
-   /*
-    * Free file cipher restore context
-    */
+   /* Free file cipher restore context */
    if (rctx.cipher_ctx.cipher) {
       crypto_cipher_free(rctx.cipher_ctx.cipher);
       rctx.cipher_ctx.cipher = NULL;
    }
-
+ 
    if (rctx.cipher_ctx.buf) {
       free_pool_memory(rctx.cipher_ctx.buf);
       rctx.cipher_ctx.buf = NULL;
    }
 
-   /*
-    * Free alternate stream cipher restore context
-    */
+   /* Free alternate stream cipher restore context */
    if (rctx.fork_cipher_ctx.cipher) {
       crypto_cipher_free(rctx.fork_cipher_ctx.cipher);
       rctx.fork_cipher_ctx.cipher = NULL;
@@ -1128,27 +1076,30 @@ ok_out:
       jcr->compress_buf = NULL;
       jcr->compress_buf_size = 0;
    }
+ 
+   if (have_acl && jcr->acl_ctx) {
+      if (jcr->acl_ctx->content) {
+         free(jcr->acl_ctx->content);
+      }
+      free(jcr->acl_ctx);
+      jcr->acl_ctx = NULL;
+   } 
+ 
+   if (have_xattr && jcr->xattr_ctx) {
+      if (jcr->xattr_ctx->content) {
+         free(jcr->xattr_ctx->content);
+      }
+      free(jcr->xattr_ctx);
+      jcr->xattr_ctx = NULL;
+   } 
 
-   if (have_acl && jcr->acl_data) {
-      free(jcr->acl_data->u.parse);
-      free(jcr->acl_data);
-      jcr->acl_data = NULL;
-   }
-
-   if (have_xattr && jcr->xattr_data) {
-      free(jcr->xattr_data->u.parse);
-      free(jcr->xattr_data);
-      jcr->xattr_data = NULL;
-   }
-
-   /*
-    * Free the delayed stream stack list.
-    */
+   /* Free the delayed stream stack list. */
    if (rctx.delayed_streams) {
       drop_delayed_restore_streams(rctx, false);
       delete rctx.delayed_streams;
    }
 
+   Dsm_check(200);
    bclose(&rctx.forkbfd);
    bclose(&rctx.bfd);
    free_attr(rctx.attr);
@@ -1188,165 +1139,32 @@ static int do_file_digest(JCR *jcr, FF_PKT *ff_pkt, bool top_level)
    return (digest_file(jcr, ff_pkt, jcr->crypto.digest));
 }
 
-/*
- * Verify the signature for the last restored file
- * Return value is either true (signature correct)
- * or false (signature could not be verified).
- * TODO landonf: Implement without using find_one_file and
- * without re-reading the file.
- */
-static bool verify_signature(JCR *jcr, r_ctx &rctx)
-{
-   X509_KEYPAIR *keypair;
-   DIGEST *digest = NULL;
-   crypto_error_t err;
-   uint64_t saved_bytes;
-   crypto_digest_t signing_algorithm = have_sha2 ?
-                                       CRYPTO_DIGEST_SHA256 : CRYPTO_DIGEST_SHA1;
-   crypto_digest_t algorithm;
-   SIGNATURE *sig = rctx.sig;
-
-
-   if (!jcr->crypto.pki_sign) {
-      /*
-       * no signature OK
-       */
-      return true;
-   }
-   if (!sig) {
-      if (rctx.type == FT_REGE || rctx.type == FT_REG || rctx.type == FT_RAW) {
-         Jmsg1(jcr, M_ERROR, 0, _("Missing cryptographic signature for %s\n"),
-               jcr->last_fname);
-         goto bail_out;
-      }
-      return true;
-   }
-
-   /*
-    * Iterate through the trusted signers
-    */
-   foreach_alist(keypair, jcr->crypto.pki_signers) {
-      err = crypto_sign_get_digest(sig, jcr->crypto.pki_keypair, algorithm, &digest);
-      switch (err) {
-      case CRYPTO_ERROR_NONE:
-         Dmsg0(50, "== Got digest\n");
-         /*
-          * We computed jcr->crypto.digest using signing_algorithm while writing
-          * the file. If it is not the same as the algorithm used for
-          * this file, punt by releasing the computed algorithm and
-          * computing by re-reading the file.
-          */
-         if (algorithm != signing_algorithm) {
-            if (jcr->crypto.digest) {
-               crypto_digest_free(jcr->crypto.digest);
-               jcr->crypto.digest = NULL;
-            }
-         }
-         if (jcr->crypto.digest) {
-             /*
-              * Use digest computed while writing the file to verify the signature
-              */
-            if ((err = crypto_sign_verify(sig, keypair, jcr->crypto.digest)) != CRYPTO_ERROR_NONE) {
-               Dmsg1(50, "Bad signature on %s\n", jcr->last_fname);
-               Jmsg2(jcr, M_ERROR, 0, _("Signature validation failed for file %s: ERR=%s\n"),
-                     jcr->last_fname, crypto_strerror(err));
-               goto bail_out;
-            }
-         } else {
-            /*
-             * Signature found, digest allocated.  Old method,
-             * re-read the file and compute the digest
-             */
-            jcr->crypto.digest = digest;
-
-            /*
-             * Checksum the entire file
-             * Make sure we don't modify JobBytes by saving and restoring it
-             */
-            saved_bytes = jcr->JobBytes;
-            if (find_one_file(jcr, jcr->ff, do_file_digest, jcr->last_fname, (dev_t)-1, 1) != 0) {
-               Jmsg(jcr, M_ERROR, 0, _("Digest one file failed for file: %s\n"),
-                    jcr->last_fname);
-               jcr->JobBytes = saved_bytes;
-               goto bail_out;
-            }
-            jcr->JobBytes = saved_bytes;
-
-            /*
-             * Verify the signature
-             */
-            if ((err = crypto_sign_verify(sig, keypair, digest)) != CRYPTO_ERROR_NONE) {
-               Dmsg1(50, "Bad signature on %s\n", jcr->last_fname);
-               Jmsg2(jcr, M_ERROR, 0, _("Signature validation failed for file %s: ERR=%s\n"),
-                     jcr->last_fname, crypto_strerror(err));
-               goto bail_out;
-            }
-            jcr->crypto.digest = NULL;
-         }
-
-         /*
-          * Valid signature
-          */
-         Dmsg1(50, "Signature good on %s\n", jcr->last_fname);
-         crypto_digest_free(digest);
-         return true;
-
-      case CRYPTO_ERROR_NOSIGNER:
-         /*
-          * Signature not found, try again
-          */
-         if (digest) {
-            crypto_digest_free(digest);
-            digest = NULL;
-         }
-         continue;
-      default:
-         /*
-          * Something strange happened (that shouldn't happen!)...
-          */
-         Qmsg2(jcr, M_ERROR, 0, _("Signature validation failed for %s: %s\n"), jcr->last_fname, crypto_strerror(err));
-         goto bail_out;
-      }
-   }
-
-   /*
-    * No signer
-    */
-   Dmsg1(50, "Could not find a valid public key for signature on %s\n", jcr->last_fname);
-
-bail_out:
-   if (digest) {
-      crypto_digest_free(digest);
-   }
-   return false;
-}
-
 bool sparse_data(JCR *jcr, BFILE *bfd, uint64_t *addr, char **data, uint32_t *length)
 {
-      unser_declare;
-      uint64_t faddr;
-      char ec1[50];
-      unser_begin(*data, OFFSET_FADDR_SIZE);
-      unser_uint64(faddr);
-      if (*addr != faddr) {
-         *addr = faddr;
-         if (blseek(bfd, (boffset_t)*addr, SEEK_SET) < 0) {
-            berrno be;
-            Jmsg3(jcr, M_ERROR, 0, _("Seek to %s error on %s: ERR=%s\n"),
-                  edit_uint64(*addr, ec1), jcr->last_fname,
-                  be.bstrerror(bfd->berrno));
-            return false;
-         }
+   unser_declare;
+   uint64_t faddr;
+   char ec1[50];
+   unser_begin(*data, OFFSET_FADDR_SIZE);
+   unser_uint64(faddr);
+   if (*addr != faddr) {
+      *addr = faddr;
+      if (blseek(bfd, (boffset_t)*addr, SEEK_SET) < 0) {
+         berrno be;
+         Jmsg3(jcr, M_ERROR, 0, _("Seek to %s error on %s: ERR=%s\n"),
+               edit_uint64(*addr, ec1), jcr->last_fname,
+               be.bstrerror(bfd->berrno));
+         return false;
       }
-      *data += OFFSET_FADDR_SIZE;
-      *length -= OFFSET_FADDR_SIZE;
-      return true;
+   }
+   *data += OFFSET_FADDR_SIZE;
+   *length -= OFFSET_FADDR_SIZE;
+   return true;
 }
 
 bool decompress_data(JCR *jcr, int32_t stream, char **data, uint32_t *length)
 {
 #if defined(HAVE_LZO) || defined(HAVE_LIBZ)
-   char ec1[50]; /* Buffer printing huge values */
+   char ec1[50];                   /* Buffer printing huge values */
 #endif
 
    Dmsg1(200, "Stream found in decompress_data(): %d\n", stream);
@@ -1373,7 +1191,7 @@ bool decompress_data(JCR *jcr, int32_t stream, char **data, uint32_t *length)
 
       /* version check */
       if (comp_version != COMP_HEAD_VERSION) {
-         Qmsg(jcr, M_ERROR, 0, _("Compressed header version error. version=0x%x\n"), comp_version);
+         Qmsg(jcr, M_ERROR, 0, _("Compressed header version error. Got=0x%x want=0x%x\n"), comp_version, COMP_HEAD_VERSION);
          return false;
       }
       /* size check */
@@ -1421,17 +1239,15 @@ bool decompress_data(JCR *jcr, int32_t stream, char **data, uint32_t *length)
 
       /*
        * NOTE! We only use uLong and Byte because they are
-       * needed by the zlib routines, they should not otherwise
-       * be used in Bacula.
-       */
+       *  needed by the zlib routines, they should not otherwise
+       *  be used in Bacula.
+       */ 
       compress_len = jcr->compress_buf_size;
       Dmsg2(200, "Comp_len=%d msglen=%d\n", compress_len, *length);
       while ((stat=uncompress((Byte *)jcr->compress_buf, &compress_len,
                               (const Byte *)*data, (uLong)*length)) == Z_BUF_ERROR)
       {
-         /*
-          * The buffer size is too small, try with a bigger one
-          */
+         /* The buffer size is too small, try with a bigger one. */
          compress_len = jcr->compress_buf_size = jcr->compress_buf_size + (jcr->compress_buf_size >> 1);
          Dmsg2(200, "Comp_len=%d msglen=%d\n", compress_len, *length);
          jcr->compress_buf = check_pool_memory_size(jcr->compress_buf,
@@ -1463,8 +1279,10 @@ static void unser_crypto_packet_len(RESTORE_CIPHER_CTX *ctx)
    }
 }
 
-bool store_data(JCR *jcr, BFILE *bfd, char *data, const int32_t length, bool win32_decomp)
+static bool store_data(r_ctx &rctx, char *data, const int32_t length, bool win32_decomp)
 {
+   JCR *jcr = rctx.jcr;
+   BFILE *bfd = &rctx.bfd;
    ssize_t wstat;
 
    if (jcr->crypto.digest) {
@@ -1477,7 +1295,9 @@ bool store_data(JCR *jcr, BFILE *bfd, char *data, const int32_t length, bool win
                jcr->last_fname, be.bstrerror(bfd->berrno));
          return false;
       }
-   } else if ((wstat=bwrite(bfd, data, length)) != (ssize_t)length) {
+   }
+
+   if ((wstat=bwrite(bfd, data, length)) != (ssize_t)length) {
       berrno be;
       int type = M_ERROR;
       int len = strlen(jcr->last_fname);
@@ -1498,11 +1318,11 @@ bool store_data(JCR *jcr, BFILE *bfd, char *data, const int32_t length, bool win
       if (type != 0) {
          if (wstat >= 0) {
             /* Insufficient bytes written */
-            Jmsg4(jcr, type, 0, _("Wrong write size error at %lld block=%d wanted=%d wrote=%d\n"),
+            Jmsg4(jcr, type, 0, _("Wrong write size error at byte=%lld block=%d wanted=%d wrote=%d\n"),
                bfd->total_bytes, bfd->block, length, wstat);
          } else {
             /* Error */
-            Jmsg6(jcr, type, 0, _("Write write error at %lld block=%d write_len=%d lerror=%d on %s: ERR=%s\n"),
+            Jmsg6(jcr, type, 0, _("Write error at byte=%lld block=%d write_len=%d lerror=%d on %s: ERR=%s\n"),
                bfd->total_bytes, bfd->block, length, bfd->lerror,
                jcr->last_fname, be.bstrerror(bfd->berrno));
          }
@@ -1523,14 +1343,18 @@ bool store_data(JCR *jcr, BFILE *bfd, char *data, const int32_t length, bool win
  * The flags specify whether to use sparse files or compression.
  * Return value is the number of bytes written, or -1 on errors.
  */
-int32_t extract_data(JCR *jcr, BFILE *bfd, POOLMEM *buf, int32_t buflen,
-                     uint64_t *addr, int flags, int32_t stream, RESTORE_CIPHER_CTX *cipher_ctx)
+int32_t extract_data(r_ctx &rctx, POOLMEM *buf, int32_t buflen)
 {
-   char *wbuf;                 /* write buffer */
-   uint32_t wsize;             /* write size */
-   uint32_t rsize;             /* read size */
-   uint32_t decrypted_len = 0; /* Decryption output length */
-   char ec1[50];               /* Buffer printing huge values */
+   JCR *jcr = rctx.jcr;
+   BFILE *bfd = &rctx.bfd;
+   int flags = rctx.flags;
+   int32_t stream = rctx.stream;
+   RESTORE_CIPHER_CTX *cipher_ctx = &rctx.cipher_ctx;
+   char *wbuf;                        /* write buffer */
+   uint32_t wsize;                    /* write size */
+   uint32_t rsize;                    /* read size */
+   uint32_t decrypted_len = 0;        /* Decryption output length */
+   char ec1[50];                      /* Buffer printing huge values */
 
    rsize = buflen;
    jcr->ReadBytes += rsize;
@@ -1541,9 +1365,6 @@ int32_t extract_data(JCR *jcr, BFILE *bfd, POOLMEM *buf, int32_t buflen,
       ASSERT(cipher_ctx->cipher);
 
       /*
-       * NOTE: We must implement block preserving semantics for the
-       * non-streaming compression and sparse code.
-       *
        * Grow the crypto buffer, if necessary.
        * crypto_cipher_update() will process only whole blocks,
        * buffering the remaining input.
@@ -1551,25 +1372,19 @@ int32_t extract_data(JCR *jcr, BFILE *bfd, POOLMEM *buf, int32_t buflen,
       cipher_ctx->buf = check_pool_memory_size(cipher_ctx->buf,
                         cipher_ctx->buf_len + wsize + cipher_ctx->block_size);
 
-      /*
-       * Decrypt the input block
-       */
+      /* Decrypt the input block */
       if (!crypto_cipher_update(cipher_ctx->cipher,
                                 (const u_int8_t *)wbuf,
                                 wsize,
                                 (u_int8_t *)&cipher_ctx->buf[cipher_ctx->buf_len],
                                 &decrypted_len)) {
-         /*
-          * Decryption failed. Shouldn't happen.
-          */
+         /* Decryption failed. Shouldn't happen. */
          Jmsg(jcr, M_FATAL, 0, _("Decryption error\n"));
-         goto bail_out;
+         goto get_out;
       }
 
       if (decrypted_len == 0) {
-         /*
-          * No full block of encrypted data available, write more data
-          */
+         /* No full block of encrypted data available, write more data */
          return 0;
       }
 
@@ -1578,25 +1393,20 @@ int32_t extract_data(JCR *jcr, BFILE *bfd, POOLMEM *buf, int32_t buflen,
       cipher_ctx->buf_len += decrypted_len;
       wbuf = cipher_ctx->buf;
 
-      /*
-       * If one full preserved block is available, write it to disk,
-       * and then buffer any remaining data. This should be effecient
-       * as long as Bacula's block size is not significantly smaller than the
-       * encryption block size (extremely unlikely!)
-       */
+      /* If one full preserved block is available, write it to disk,
+       *  and then buffer any remaining data. This should be effecient
+       *  as long as Bacula's block size is not significantly smaller than the
+       *  encryption block size (extremely unlikely!)
+       */ 
       unser_crypto_packet_len(cipher_ctx);
       Dmsg1(500, "Crypto unser block size=%d\n", cipher_ctx->packet_len - CRYPTO_LEN_SIZE);
 
       if (cipher_ctx->packet_len == 0 || cipher_ctx->buf_len < cipher_ctx->packet_len) {
-         /*
-          * No full preserved block is available.
-          */
+         /* No full preserved block is available. */
          return 0;
       }
 
-      /*
-       * We have one full block, set up the filter input buffers
-       */
+      /* We have one full block, set up the filter input buffers */
       wsize = cipher_ctx->packet_len - CRYPTO_LEN_SIZE;
       wbuf = &wbuf[CRYPTO_LEN_SIZE]; /* Skip the block length header */
       cipher_ctx->buf_len -= cipher_ctx->packet_len;
@@ -1604,27 +1414,25 @@ int32_t extract_data(JCR *jcr, BFILE *bfd, POOLMEM *buf, int32_t buflen,
    }
 
    if ((flags & FO_SPARSE) || (flags & FO_OFFSETS)) {
-      if (!sparse_data(jcr, bfd, addr, &wbuf, &wsize)) {
-         goto bail_out;
+      if (!sparse_data(jcr, bfd, &rctx.fileAddr, &wbuf, &wsize)) {
+         goto get_out;
       }
    }
 
    if (flags & FO_COMPRESS) {
       if (!decompress_data(jcr, stream, &wbuf, &wsize)) {
-         goto bail_out;
+         goto get_out;
       }
    }
 
-   if (!store_data(jcr, bfd, wbuf, wsize, (flags & FO_WIN32DECOMP) != 0)) {
-      goto bail_out;
+   if (!store_data(rctx, wbuf, wsize, (flags & FO_WIN32DECOMP) != 0)) {
+      goto get_out;
    }
    jcr->JobBytes += wsize;
-   *addr += wsize;
+   rctx.fileAddr += wsize;
    Dmsg2(130, "Write %u bytes, JobBytes=%s\n", wsize, edit_uint64(jcr->JobBytes, ec1));
 
-   /*
-    * Clean up crypto buffers
-    */
+   /* Clean up crypto buffers */
    if (flags & FO_ENCRYPT) {
       /* Move any remaining data to start of buffer */
       if (cipher_ctx->buf_len > 0) {
@@ -1632,23 +1440,23 @@ int32_t extract_data(JCR *jcr, BFILE *bfd, POOLMEM *buf, int32_t buflen,
          memmove(cipher_ctx->buf, &cipher_ctx->buf[cipher_ctx->packet_len],
             cipher_ctx->buf_len);
       }
-      /*
-       * The packet was successfully written, reset the length so that the next
-       * packet length may be re-read by unser_crypto_packet_len()
-       */
+      /* The packet was successfully written, reset the length so that 
+       *  the next packet length may be re-read by unser_crypto_packet_len() */
       cipher_ctx->packet_len = 0;
    }
    return wsize;
 
-bail_out:
+get_out:
    return -1;
 }
 
 /*
  * If extracting, close any previous stream
  */
-static bool close_previous_stream(JCR *jcr, r_ctx &rctx)
+static bool close_previous_stream(r_ctx &rctx)
 {
+   bool rtn = true;
+
    /*
     * If extracting, it was from previous stream, so
     * close the output file and validate the signature.
@@ -1656,7 +1464,7 @@ static bool close_previous_stream(JCR *jcr, r_ctx &rctx)
    if (rctx.extract) {
       if (rctx.size > 0 && !is_bopen(&rctx.bfd)) {
          Jmsg0(rctx.jcr, M_ERROR, 0, _("Logic error: output file should be open\n"));
-         Dmsg2(000, "=== logic error size=%d bopen=%d\n", rctx.size,
+         Pmsg2(000, "=== logic error size=%d bopen=%d\n", rctx.size,
             is_bopen(&rctx.bfd));
       }
 
@@ -1672,43 +1480,36 @@ static bool close_previous_stream(JCR *jcr, r_ctx &rctx)
       }
       rctx.extract = false;
 
-      /*
-       * Now perform the delayed restore of some specific data streams.
-       */
-      if (!pop_delayed_data_streams(jcr, rctx)) {
-         return false;
-      }
-
-      /*
-       * Verify the cryptographic signature, if any
-       */
+      /* Now perform the delayed restore of some specific data streams. */
+      rtn = pop_delayed_data_streams(rctx);
+ 
+      /* Verify the cryptographic signature, if any */
       rctx.type = rctx.attr->type;
-      verify_signature(rctx.jcr, rctx);
+      verify_signature(rctx);
 
-      /*
-       * Free Signature
-       */
+      /* Free Signature */
       free_signature(rctx);
       free_session(rctx);
       rctx.jcr->ff->flags = 0;
       Dmsg0(130, "Stop extracting.\n");
    } else if (is_bopen(&rctx.bfd)) {
       Jmsg0(rctx.jcr, M_ERROR, 0, _("Logic error: output file should not be open\n"));
-      Dmsg0(000, "=== logic error !open\n");
+      Pmsg0(000, "=== logic error !open\n");
       bclose(&rctx.bfd);
    }
 
-   return true;
-}
+   return rtn;
+} 
 
 /*
  * In the context of jcr, flush any remaining data from the cipher context,
  * writing it to bfd.
  * Return value is true on success, false on failure.
  */
-bool flush_cipher(JCR *jcr, BFILE *bfd, uint64_t *addr, int flags, int32_t stream,
+bool flush_cipher(r_ctx &rctx, BFILE *bfd, uint64_t *addr, int flags, int32_t stream,
                   RESTORE_CIPHER_CTX *cipher_ctx)
 {
+   JCR *jcr = rctx.jcr;
    uint32_t decrypted_len = 0;
    char *wbuf;                        /* write buffer */
    uint32_t wsize;                    /* write size */
@@ -1716,25 +1517,19 @@ bool flush_cipher(JCR *jcr, BFILE *bfd, uint64_t *addr, int flags, int32_t strea
    bool second_pass = false;
 
 again:
-   /*
-    * Write out the remaining block and free the cipher context
-    */
-   cipher_ctx->buf = check_pool_memory_size(cipher_ctx->buf, cipher_ctx->buf_len +
-                                            cipher_ctx->block_size);
+   /* Write out the remaining block and free the cipher context */
+   cipher_ctx->buf = check_pool_memory_size(cipher_ctx->buf,
+                        cipher_ctx->buf_len + cipher_ctx->block_size);
 
    if (!crypto_cipher_finalize(cipher_ctx->cipher, (uint8_t *)&cipher_ctx->buf[cipher_ctx->buf_len],
         &decrypted_len)) {
-      /*
-       * Writing out the final, buffered block failed. Shouldn't happen.
-       */
+      /* Writing out the final, buffered block failed. Shouldn't happen. */
       Jmsg3(jcr, M_ERROR, 0, _("Decryption error. buf_len=%d decrypt_len=%d on file %s\n"),
             cipher_ctx->buf_len, decrypted_len, jcr->last_fname);
    }
 
    Dmsg2(130, "Flush decrypt len=%d buf_len=%d\n", decrypted_len, cipher_ctx->buf_len);
-   /*
-    * If nothing new was decrypted, and our output buffer is empty, return
-    */
+   /* If nothing new was decrypted, and our output buffer is empty, return */
    if (decrypted_len == 0 && cipher_ctx->buf_len == 0) {
       return true;
    }
@@ -1744,10 +1539,8 @@ again:
    unser_crypto_packet_len(cipher_ctx);
    Dmsg1(500, "Crypto unser block size=%d\n", cipher_ctx->packet_len - CRYPTO_LEN_SIZE);
    wsize = cipher_ctx->packet_len - CRYPTO_LEN_SIZE;
-   /*
-    * Decrypted, possibly decompressed output here.
-    */
-   wbuf = &cipher_ctx->buf[CRYPTO_LEN_SIZE];
+   /* Decrypted, possibly decompressed output here. */
+   wbuf = &cipher_ctx->buf[CRYPTO_LEN_SIZE]; /* Skip the block length header */
    cipher_ctx->buf_len -= cipher_ctx->packet_len;
    Dmsg2(130, "Encryption writing full block, %u bytes, remaining %u bytes in buffer\n", wsize, cipher_ctx->buf_len);
 
@@ -1764,24 +1557,20 @@ again:
    }
 
    Dmsg0(130, "Call store_data\n");
-   if (!store_data(jcr, bfd, wbuf, wsize, (flags & FO_WIN32DECOMP) != 0)) {
+   if (!store_data(rctx, wbuf, wsize, (flags & FO_WIN32DECOMP) != 0)) {
       return false;
    }
    jcr->JobBytes += wsize;
    Dmsg2(130, "Flush write %u bytes, JobBytes=%s\n", wsize, edit_uint64(jcr->JobBytes, ec1));
 
-   /*
-    * Move any remaining data to start of buffer
-    */
+   /* Move any remaining data to start of buffer. */
    if (cipher_ctx->buf_len > 0) {
       Dmsg1(130, "Moving %u buffered bytes to start of buffer\n", cipher_ctx->buf_len);
       memmove(cipher_ctx->buf, &cipher_ctx->buf[cipher_ctx->packet_len],
          cipher_ctx->buf_len);
    }
-   /*
-    * The packet was successfully written, reset the length so that the next
-    * packet length may be re-read by unser_crypto_packet_len()
-    */
+   /* The packet was successfully written, reset the length so that the next
+    *  packet length may be re-read by unser_crypto_packet_len() */
    cipher_ctx->packet_len = 0;
 
    if (cipher_ctx->buf_len >0 && !second_pass) {
@@ -1789,9 +1578,7 @@ again:
       goto again;
    }
 
-   /*
-    * Stop decryption
-    */
+   /* Stop decryption */
    cipher_ctx->buf_len = 0;
    cipher_ctx->packet_len = 0;
 
@@ -1800,11 +1587,9 @@ again:
 
 static void deallocate_cipher(r_ctx &rctx)
 {
-   /*
-    * Flush and deallocate previous stream's cipher context
-    */
+    /* Flush and deallocate previous stream's cipher context */
    if (rctx.cipher_ctx.cipher) {
-      flush_cipher(rctx.jcr, &rctx.bfd, &rctx.fileAddr, rctx.flags, rctx.comp_stream, &rctx.cipher_ctx);
+      flush_cipher(rctx, &rctx.bfd, &rctx.fileAddr, rctx.flags, rctx.comp_stream, &rctx.cipher_ctx);
       crypto_cipher_free(rctx.cipher_ctx.cipher);
       rctx.cipher_ctx.cipher = NULL;
    }
@@ -1813,11 +1598,9 @@ static void deallocate_cipher(r_ctx &rctx)
 static void deallocate_fork_cipher(r_ctx &rctx)
 {
 
-   /*
-    * Flush and deallocate previous stream's fork cipher context
-    */
+   /* Flush and deallocate previous stream's fork cipher context */
    if (rctx.fork_cipher_ctx.cipher) {
-      flush_cipher(rctx.jcr, &rctx.forkbfd, &rctx.fork_addr, rctx.fork_flags, rctx.comp_stream, &rctx.fork_cipher_ctx);
+      flush_cipher(rctx, &rctx.forkbfd, &rctx.fork_addr, rctx.fork_flags, rctx.comp_stream, &rctx.fork_cipher_ctx);
       crypto_cipher_free(rctx.fork_cipher_ctx.cipher);
       rctx.fork_cipher_ctx.cipher = NULL;
    }
@@ -1839,30 +1622,118 @@ static void free_session(r_ctx &rctx)
    }
 }
 
-
 /*
- * This code if implemented goes above
+ * Verify the signature for the last restored file
+ * Return value is either true (signature correct)
+ * or false (signature could not be verified).
+ * TODO landonf: Implement without using find_one_file and
+ * without re-reading the file.
  */
-#ifdef stbernard_implemented
-/  #if defined(HAVE_WIN32)
-   bool        bResumeOfmOnExit = FALSE;
-   if (isOpenFileManagerRunning()) {
-       if ( pauseOpenFileManager() ) {
-          Jmsg(jcr, M_INFO, 0, _("Open File Manager paused\n") );
-          bResumeOfmOnExit = TRUE;
-       }
-       else {
-          Jmsg(jcr, M_ERROR, 0, _("FAILED to pause Open File Manager\n") );
-       }
+static bool verify_signature(r_ctx &rctx)
+{
+   JCR *jcr = rctx.jcr;
+   X509_KEYPAIR *keypair;
+   DIGEST *digest = NULL;
+   crypto_error_t err;
+   uint64_t saved_bytes;
+   crypto_digest_t signing_algorithm = have_sha2 ?
+                                       CRYPTO_DIGEST_SHA256 : CRYPTO_DIGEST_SHA1;
+   crypto_digest_t algorithm;
+   SIGNATURE *sig = rctx.sig;
+
+
+   if (!jcr->crypto.pki_sign) {
+      /* no signature OK */
+      return true;
    }
-   {
-       char username[UNLEN+1];
-       DWORD usize = sizeof(username);
-       int privs = enable_backup_privileges(NULL, 1);
-       if (GetUserName(username, &usize)) {
-          Jmsg2(jcr, M_INFO, 0, _("Running as '%s'. Privmask=%#08x\n"), username,
-       } else {
-          Jmsg(jcr, M_WARNING, 0, _("Failed to retrieve current UserName\n"));
-       }
+   if (!sig) {
+      if (rctx.type == FT_REGE || rctx.type == FT_REG || rctx.type == FT_RAW) {
+         Jmsg1(jcr, M_ERROR, 0, _("Missing cryptographic signature for %s\n"),
+               jcr->last_fname);
+         goto get_out;
+      }
+      return true;
    }
-#endif
+
+   /* Iterate through the trusted signers */
+   foreach_alist(keypair, jcr->crypto.pki_signers) {
+      err = crypto_sign_get_digest(sig, jcr->crypto.pki_keypair, algorithm, &digest);
+      switch (err) {
+      case CRYPTO_ERROR_NONE:
+         Dmsg0(50, "== Got digest\n");
+         /*
+          * We computed jcr->crypto.digest using signing_algorithm while writing
+          * the file. If it is not the same as the algorithm used for
+          * this file, punt by releasing the computed algorithm and
+          * computing by re-reading the file.
+          */
+         if (algorithm != signing_algorithm) {
+            if (jcr->crypto.digest) {
+               crypto_digest_free(jcr->crypto.digest);
+               jcr->crypto.digest = NULL;
+            }
+         }
+         if (jcr->crypto.digest) {
+            /* Use digest computed while writing the file to verify 
+             *  the signature */
+            if ((err = crypto_sign_verify(sig, keypair, jcr->crypto.digest)) != CRYPTO_ERROR_NONE) {
+               Dmsg1(50, "Bad signature on %s\n", jcr->last_fname);
+               Jmsg2(jcr, M_ERROR, 0, _("Signature validation failed for file %s: ERR=%s\n"),
+                     jcr->last_fname, crypto_strerror(err));
+               goto get_out;
+            }
+         } else {
+            /* Signature found, digest allocated.  Old method,
+             *  re-read the file and compute the digest */
+            jcr->crypto.digest = digest;
+
+            /* Checksum the entire file
+             * Make sure we don't modify JobBytes by saving and 
+             *  restoring it */
+            saved_bytes = jcr->JobBytes;
+            if (find_one_file(jcr, jcr->ff, do_file_digest, jcr->last_fname, (dev_t)-1, 1) != 0) {
+               Jmsg(jcr, M_ERROR, 0, _("Digest one file failed for file: %s\n"),
+                    jcr->last_fname);
+               jcr->JobBytes = saved_bytes;
+               goto get_out;
+            }
+            jcr->JobBytes = saved_bytes;
+
+            /* Verify the signature */
+            if ((err = crypto_sign_verify(sig, keypair, digest)) != CRYPTO_ERROR_NONE) {
+               Dmsg1(50, "Bad signature on %s\n", jcr->last_fname);
+               Jmsg2(jcr, M_ERROR, 0, _("Signature validation failed for file %s: ERR=%s\n"),
+                     jcr->last_fname, crypto_strerror(err));
+               goto get_out;
+            }
+            jcr->crypto.digest = NULL;
+         }
+
+         /* Valid signature */
+         Dmsg1(50, "Signature good on %s\n", jcr->last_fname);
+         crypto_digest_free(digest);
+         return true;
+
+      case CRYPTO_ERROR_NOSIGNER:
+         /* Signature not found, try again */
+         if (digest) {
+            crypto_digest_free(digest);
+            digest = NULL;
+         }
+         continue;
+      default:
+         /* Something strange happened (that shouldn't happen!)... */
+         Qmsg2(jcr, M_ERROR, 0, _("Signature validation failed for %s: %s\n"), jcr->last_fname, crypto_strerror(err));
+         goto get_out;
+      }
+   }
+
+   /* No signer */
+   Dmsg1(50, "Could not find a valid public key for signature on %s\n", jcr->last_fname);
+
+get_out:
+   if (digest) {
+      crypto_digest_free(digest);
+   }
+   return false;
+}
diff --git a/src/filed/restore.h b/src/filed/restore.h
index 779e49b..e04ecd3 100644
--- a/src/filed/restore.h
+++ b/src/filed/restore.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2009 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2009-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 
 #ifndef __RESTORE_H
@@ -50,6 +54,7 @@ struct r_ctx {
    ATTR *attr;                         /* Pointer to attributes */
    bool extract;                       /* set when extracting */
    alist *delayed_streams;             /* streams that should be restored as last */
+   int32_t count;                      /* Debug count */
 
    SIGNATURE *sig;                     /* Cryptographic signature (if any) for file */
    CRYPTO_SESSION *cs;                 /* Cryptographic session data (if any) for file */
diff --git a/src/filed/status.c b/src/filed/status.c
index 5747057..e65cdc0 100644
--- a/src/filed/status.c
+++ b/src/filed/status.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *  Bacula File Daemon Status routines
@@ -40,16 +44,7 @@ static char qstatus2[] = ".status %127s api=%d api_opts=%127s";
 static char OKqstatus[]   = "2000 OK .status\n";
 static char DotStatusJob[] = "JobId=%d JobStatus=%c JobErrors=%d\n";
 
-#if defined(HAVE_WIN32)
-static int privs = 0;
-#endif
-#ifdef WIN32_VSS
-#include "vss.h"
-#define VSS " VSS"
-extern VSSClient *g_pVSSClient;
-#else
 #define VSS ""
-#endif
 
 /*
  * General status generator
@@ -67,6 +62,7 @@ static const bool have_lzo = true;
 static const bool have_lzo = false;
 #endif
 
+
 static void  list_status_header(STATUS_PKT *sp)
 {
    POOL_MEM msg(PM_MESSAGE);
@@ -74,65 +70,14 @@ static void  list_status_header(STATUS_PKT *sp)
    int len;
    char dt[MAX_TIME_LENGTH];
 
-   len = Mmsg(msg, _("%s Version: %s (%s) %s %s %s %s\n"),
-              my_name, VERSION, BDATE, VSS, HOST_OS,
+   len = Mmsg(msg, _("%s %sVersion: %s (%s) %s %s %s %s\n"),
+              my_name, "", VERSION, BDATE, VSS, HOST_OS,
               DISTNAME, DISTVER);
    sendit(msg.c_str(), len, sp);
    bstrftime_nc(dt, sizeof(dt), daemon_start_time);
    len = Mmsg(msg, _("Daemon started %s. Jobs: run=%d running=%d.\n"),
         dt, num_jobs_run, job_count());
    sendit(msg.c_str(), len, sp);
-#if defined(HAVE_WIN32)
-   char buf[300];
-   if (GetWindowsVersionString(buf, sizeof(buf))) {
-      len = Mmsg(msg, "%s\n", buf);
-      sendit(msg.c_str(), len, sp);
-   }
-   if (debug_level > 0) {
-      if (!privs) {
-         privs = enable_backup_privileges(NULL, 1);
-      }
-      len = Mmsg(msg, "VSS %s, Priv 0x%x\n", g_pVSSClient?"enabled":"disabled", privs);
-      sendit(msg.c_str(), len, sp);
-      len = Mmsg(msg, "APIs=%sOPT,%sATP,%sLPV,%sCFA,%sCFW,\n",
-                 p_OpenProcessToken?"":"!",
-                 p_AdjustTokenPrivileges?"":"!",
-                 p_LookupPrivilegeValue?"":"!",
-                 p_CreateFileA?"":"!",
-                 p_CreateFileW?"":"!");
-      sendit(msg.c_str(), len, sp);
-      len = Mmsg(msg, " %sWUL,%sWMKD,%sGFAA,%sGFAW,%sGFAEA,%sGFAEW,%sSFAA,%sSFAW,%sBR,%sBW,%sSPSP,\n",
-                 p_wunlink?"":"!",
-                 p_wmkdir?"":"!",
-                 p_GetFileAttributesA?"":"!",
-                 p_GetFileAttributesW?"":"!",
-                 p_GetFileAttributesExA?"":"!",
-                 p_GetFileAttributesExW?"":"!",
-                 p_SetFileAttributesA?"":"!",
-                 p_SetFileAttributesW?"":"!",
-                 p_BackupRead?"":"!",
-                 p_BackupWrite?"":"!",
-                 p_SetProcessShutdownParameters?"":"!");
-      sendit(msg.c_str(), len, sp);
-      len = Mmsg(msg, " %sWC2MB,%sMB2WC,%sFFFA,%sFFFW,%sFNFA,%sFNFW,%sSCDA,%sSCDW,\n",
-                 p_WideCharToMultiByte?"":"!",
-                 p_MultiByteToWideChar?"":"!",
-                 p_FindFirstFileA?"":"!",
-                 p_FindFirstFileW?"":"!",
-                 p_FindNextFileA?"":"!",
-                 p_FindNextFileW?"":"!",
-                 p_SetCurrentDirectoryA?"":"!",
-                 p_SetCurrentDirectoryW?"":"!");
-      sendit(msg.c_str(), len, sp);
-      len = Mmsg(msg, " %sGCDA,%sGCDW,%sGVPNW,%sGVNFVMPW,%sLZO\n",
-                 p_GetCurrentDirectoryA?"":"!",
-                 p_GetCurrentDirectoryW?"":"!",
-                 p_GetVolumePathNameW?"":"!",
-                 p_GetVolumeNameForVolumeMountPointW?"":"!",
-                 have_lzo?"":"!");
-      sendit(msg.c_str(), len, sp);
-   }
-#endif
    len = Mmsg(msg, _(" Heap: heap=%s smbytes=%s max_bytes=%s bufs=%s max_bufs=%s\n"),
          edit_uint64_with_commas((char *)sbrk(0)-(char *)start_heap, b1),
          edit_uint64_with_commas(sm_bytes, b2),
@@ -141,16 +86,16 @@ static void  list_status_header(STATUS_PKT *sp)
          edit_uint64_with_commas(sm_max_buffers, b5));
    sendit(msg.c_str(), len, sp);
    len = Mmsg(msg, _(" Sizes: boffset_t=%d size_t=%d debug=%s trace=%d "
-                     "mode=%d,%d bwlimit=%skB/s\n"),
+                     "mode=%d bwlimit=%skB/s\n"),
               sizeof(boffset_t), sizeof(size_t),
-              edit_uint64(debug_level, b2), get_trace(), (int)DEVELOPER_MODE, (int)BEEF,
+              edit_uint64(debug_level, b2), get_trace(), (int)DEVELOPER_MODE,
               edit_uint64_with_commas(me->max_bandwidth_per_job/1024, b1));
    sendit(msg.c_str(), len, sp);
-   if (bplugin_list->size() > 0) {
+   if (b_plugin_list->size() > 0) {
       Plugin *plugin;
       int len;
       pm_strcpy(msg, " Plugin: ");
-      foreach_alist(plugin, bplugin_list) {
+      foreach_alist(plugin, b_plugin_list) {
          len = pm_strcat(msg, plugin->file);
          /* Print plugin version when debug activated */
          if (debug_level > 0 && plugin->pinfo) {
@@ -175,9 +120,10 @@ static void  list_status_header(STATUS_PKT *sp)
  */
 static void  list_running_jobs_plain(STATUS_PKT *sp)
 {
-   int total_sec, inst_sec, total_bps, inst_bps;
+   int total_sec, inst_sec;
+   uint64_t total_bps, inst_bps;
    POOL_MEM msg(PM_MESSAGE);
-   char b1[50], b2[50], b3[50], b4[50], b5[50];
+   char b1[50], b2[50], b3[50], b4[50], b5[50], b6[50];
    int len;
    bool found = false;
    JCR *njcr;
@@ -188,15 +134,12 @@ static void  list_running_jobs_plain(STATUS_PKT *sp)
    len = Mmsg(msg, _("\nRunning Jobs:\n"));
    sendit(msg.c_str(), len, sp);
    const char *vss = "";
-#ifdef WIN32_VSS
-   if (g_pVSSClient && g_pVSSClient->IsInitialized()) {
-      vss = "VSS ";
-   }
-#endif
    foreach_jcr(njcr) {
       bstrftime_nc(dt, sizeof(dt), njcr->start_time);
       if (njcr->JobId == 0) {
-         len = Mmsg(msg, _("Director connected at: %s\n"), dt);
+         len = Mmsg(msg, _("Director connected %sat: %s\n"),
+                    (njcr->dir_bsock && njcr->dir_bsock->tls)?_("using TLS "):"",
+                    dt);
       } else {
          len = Mmsg(msg, _("JobId %d Job %s is running.\n"),
                     njcr->JobId, njcr->Job);
@@ -230,12 +173,13 @@ static void  list_running_jobs_plain(STATUS_PKT *sp)
       /* total bps (AveBytes/sec) since start of job */
       total_bps = njcr->JobBytes / total_sec;
       len = Mmsg(msg,  _("    Files=%s Bytes=%s AveBytes/sec=%s LastBytes/sec=%s Errors=%d\n"
-                         "    Bwlimit=%s\n"),
+                         "    Bwlimit=%s ReadBytes=%s\n"),
            edit_uint64_with_commas(njcr->JobFiles, b1),
            edit_uint64_with_commas(njcr->JobBytes, b2),
            edit_uint64_with_commas(total_bps, b3),
            edit_uint64_with_commas(inst_bps, b4),
-           njcr->JobErrors, edit_uint64_with_commas(njcr->max_bandwidth, b5));
+           njcr->JobErrors, edit_uint64_with_commas(njcr->max_bandwidth, b5),
+           edit_uint64_with_commas(njcr->ReadBytes, b6));
       sendit(msg.c_str(), len, sp);
 
       if (njcr->is_JobType(JT_RESTORE) && njcr->ExpectedFiles > 0) {
@@ -264,8 +208,9 @@ static void  list_running_jobs_plain(STATUS_PKT *sp)
 
       found = true;
       if (njcr->store_bsock) {
-         len = Mmsg(msg, "    SDReadSeqNo=%" lld " fd=%d\n",
-             njcr->store_bsock->read_seqno, njcr->store_bsock->m_fd);
+         len = Mmsg(msg, "    SDReadSeqNo=%" lld " fd=%d SDtls=%d\n",
+                    njcr->store_bsock->read_seqno, njcr->store_bsock->m_fd,
+                    (njcr->store_bsock->tls)?1:0);
          sendit(msg.c_str(), len, sp);
       } else {
          len = Mmsg(msg, _("    SDSocket closed.\n"));
@@ -281,79 +226,9 @@ static void  list_running_jobs_plain(STATUS_PKT *sp)
    sendit(_("====\n"), 5, sp);
 }
 
-static void  list_running_jobs_api(STATUS_PKT *sp)
-{
-   int sec, bps;
-   POOL_MEM msg(PM_MESSAGE);
-   char b1[32], b2[32], b3[32];
-   int len;
-   JCR *njcr;
-   char dt[MAX_TIME_LENGTH];
-   /*
-    * List running jobs for Bat/Bweb (simple to parse)
-    */
-   int vss = 0;
-#ifdef WIN32_VSS
-   if (g_pVSSClient && g_pVSSClient->IsInitialized()) {
-      vss = 1;
-   }
-#endif
-   foreach_jcr(njcr) {
-      bstrutime(dt, sizeof(dt), njcr->start_time);
-      if (njcr->JobId == 0) {
-         len = Mmsg(msg, "DirectorConnected=%s\n", dt);
-      } else {
-         len = Mmsg(msg, "JobId=%d\n Job=%s\n",
-                    njcr->JobId, njcr->Job);
-         sendit(msg.c_str(), len, sp);
-         len = Mmsg(msg," VSS=%d\n Level=%c\n JobType=%c\n JobStarted=%s\n",
-                    vss, njcr->getJobLevel(),
-                    njcr->getJobType(), dt);
-      }
-      sendit(msg.c_str(), len, sp);
-      if (njcr->JobId == 0) {
-         continue;
-      }
-      sec = time(NULL) - njcr->start_time;
-      if (sec <= 0) {
-         sec = 1;
-      }
-      bps = (int)(njcr->JobBytes / sec);
-      len = Mmsg(msg, " Files=%s\n Bytes=%s\n Bytes/sec=%s\n Errors=%d\n",
-                 edit_uint64(njcr->JobFiles, b1),
-                 edit_uint64(njcr->JobBytes, b2),
-                 edit_uint64(bps, b3),
-                 njcr->JobErrors);
-      sendit(msg.c_str(), len, sp);
-      len = Mmsg(msg, " Files Examined=%s\n",
-           edit_uint64(njcr->num_files_examined, b1));
-      sendit(msg.c_str(), len, sp);
-      if (njcr->JobFiles > 0) {
-         njcr->lock();
-         len = Mmsg(msg, " Processing file=%s\n", njcr->last_fname);
-         njcr->unlock();
-         sendit(msg.c_str(), len, sp);
-      }
-
-      if (njcr->store_bsock) {
-         len = Mmsg(msg, " SDReadSeqNo=%" lld "\n fd=%d\n",
-             njcr->store_bsock->read_seqno, njcr->store_bsock->m_fd);
-         sendit(msg.c_str(), len, sp);
-      } else {
-         len = Mmsg(msg, _(" SDSocket=closed\n"));
-         sendit(msg.c_str(), len, sp);
-      }
-   }
-   endeach_jcr(njcr);
-}
-
 static void  list_running_jobs(STATUS_PKT *sp)
 {
-   if (sp->api) {
-      list_running_jobs_api(sp);
-   } else {
-      list_running_jobs_plain(sp);
-   }
+   list_running_jobs_plain(sp);
 }
 
 /*
diff --git a/src/filed/verify.c b/src/filed/verify.c
index d4350f0..1f0717b 100644
--- a/src/filed/verify.c
+++ b/src/filed/verify.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *  Bacula File Daemon  verify.c  Verify files.
@@ -23,12 +27,6 @@
 #include "bacula.h"
 #include "filed.h"
 
-#ifdef HAVE_DARWIN_OS
-const bool have_darwin_os = true;
-#else
-const bool have_darwin_os = false;
-#endif
-
 static int verify_file(JCR *jcr, FF_PKT *ff_pkt, bool);
 static int read_digest(BFILE *bfd, DIGEST *digest, JCR *jcr);
 
@@ -285,9 +283,8 @@ int digest_file(JCR *jcr, FF_PKT *ff_pkt, DIGEST *digest)
    Dmsg0(50, "=== digest_file\n");
    binit(&bfd);
 
-   if (ff_pkt->statp.st_size > 0 ||
-       ff_pkt->type == FT_RAW ||
-       ff_pkt->type == FT_FIFO) {
+   if (ff_pkt->statp.st_size > 0 || ff_pkt->type == FT_RAW
+         || ff_pkt->type == FT_FIFO) {
       int noatime = ff_pkt->flags & FO_NOATIME ? O_NOATIME : 0;
       if ((bopen(&bfd, ff_pkt->fname, O_RDONLY | O_BINARY | noatime, 0)) < 0) {
          ff_pkt->ff_errno = errno;
@@ -302,27 +299,26 @@ int digest_file(JCR *jcr, FF_PKT *ff_pkt, DIGEST *digest)
       bclose(&bfd);
    }
 
-   if (have_darwin_os) {
-      /* Open resource fork if necessary */
-      if (ff_pkt->flags & FO_HFSPLUS && ff_pkt->hfsinfo.rsrclength > 0) {
-         if (bopen_rsrc(&bfd, ff_pkt->fname, O_RDONLY | O_BINARY, 0) < 0) {
-            ff_pkt->ff_errno = errno;
-            berrno be;
-            Jmsg(jcr, M_ERROR, -1, _("     Cannot open resource fork for %s: ERR=%s.\n"),
-                  ff_pkt->fname, be.bstrerror());
-            if (is_bopen(&ff_pkt->bfd)) {
-               bclose(&ff_pkt->bfd);
-            }
-            return 1;
+#ifdef HAVE_DARWIN_OS
+   /* Open resource fork if necessary */
+   if (ff_pkt->flags & FO_HFSPLUS && ff_pkt->hfsinfo.rsrclength > 0) {
+      if (bopen_rsrc(&bfd, ff_pkt->fname, O_RDONLY | O_BINARY, 0) < 0) {
+         ff_pkt->ff_errno = errno;
+         berrno be;
+         Jmsg(jcr, M_ERROR, -1, _("     Cannot open resource fork for %s: ERR=%s.\n"),
+               ff_pkt->fname, be.bstrerror());
+         if (is_bopen(&ff_pkt->bfd)) {
+            bclose(&ff_pkt->bfd);
          }
-         read_digest(&bfd, digest, jcr);
-         bclose(&bfd);
-      }
-
-      if (digest && ff_pkt->flags & FO_HFSPLUS) {
-         crypto_digest_update(digest, (uint8_t *)ff_pkt->hfsinfo.fndrinfo, 32);
-      }
-   }
+         return 1;
+      } 
+      read_digest(&bfd, digest, jcr);
+      bclose(&bfd);
+   } 
+   if (digest && ff_pkt->flags & FO_HFSPLUS) {
+      crypto_digest_update(digest, (uint8_t *)ff_pkt->hfsinfo.fndrinfo, 32);
+   } 
+#endif
    return 0;
 }
 
diff --git a/src/filed/verify_vol.c b/src/filed/verify_vol.c
index aba6650..e29a7dc 100644
--- a/src/filed/verify_vol.c
+++ b/src/filed/verify_vol.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2002-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *  Bacula File Daemon  verify-vol.c Verify files on a Volume
@@ -39,7 +43,7 @@ void do_verify_volume(JCR *jcr)
    BSOCK *sd, *dir;
    POOLMEM *fname;                    /* original file name */
    POOLMEM *lname;                    /* link name */
-   int32_t stream;
+   int32_t stream, full_stream;
    uint32_t size;
    uint32_t VolSessionId, VolSessionTime, file_index;
    uint32_t record_file_index;
@@ -73,32 +77,37 @@ void do_verify_volume(JCR *jcr)
    fname = get_pool_memory(PM_FNAME);
    lname = get_pool_memory(PM_FNAME);
 
+   GetMsg *fdmsg = New(GetMsg(jcr, sd, rec_header, GETMSG_MAX_MSG_SIZE));
+   fdmsg->start_read_sock();
+   bmessage *bmsg = New(bmessage(GETMSG_MAX_MSG_SIZE));
+
    /*
     * Get a record from the Storage daemon
     */
-   while (bget_msg(sd) >= 0 && !job_canceled(jcr)) {
+   while (fdmsg->bget_msg(&bmsg) >= 0 && !job_canceled(jcr)) {
       /*
        * First we expect a Stream Record Header
        */
-      if (sscanf(sd->msg, rec_header, &VolSessionId, &VolSessionTime, &file_index,
-          &stream, &size) != 5) {
-         Jmsg1(jcr, M_FATAL, 0, _("Record header scan error: %s\n"), sd->msg);
+      if (sscanf(bmsg->rbuf, rec_header, &VolSessionId, &VolSessionTime, &file_index,
+          &full_stream, &size) != 5) {
+         Jmsg1(jcr, M_FATAL, 0, _("Record header scan error: %s\n"), bmsg->rbuf);
          goto bail_out;
       }
-      Dmsg3(30, "Got hdr: FilInx=%d Stream=%d size=%d.\n", file_index, stream, size);
+      stream = full_stream & STREAMMASK_TYPE;
+      Dmsg4(30, "Got hdr: FilInx=%d FullStream=%d Stream=%d size=%d.\n", file_index, full_stream, stream, size);
 
       /*
        * Now we expect the Stream Data
        */
-      if (bget_msg(sd) < 0) {
+      if (fdmsg->bget_msg(&bmsg) < 0) {
          Jmsg1(jcr, M_FATAL, 0, _("Data record error. ERR=%s\n"), sd->bstrerror());
          goto bail_out;
       }
-      if (size != ((uint32_t)sd->msglen)) {
-         Jmsg2(jcr, M_FATAL, 0, _("Actual data size %d not same as header %d\n"), sd->msglen, size);
+      if (size != ((uint32_t)bmsg->origlen)) {
+         Jmsg2(jcr, M_FATAL, 0, _("Actual data size %d not same as header %d\n"), bmsg->origlen, size);
          goto bail_out;
       }
-      Dmsg2(30, "Got stream data %s, len=%d\n", stream_to_ascii(stream), sd->msglen);
+      Dmsg2(30, "Got stream data %s, len=%d\n", stream_to_ascii(stream), bmsg->rbuflen);
 
       /* File Attributes stream */
       switch (stream) {
@@ -108,12 +117,12 @@ void do_verify_volume(JCR *jcr)
 
          Dmsg0(400, "Stream=Unix Attributes.\n");
 
-         if ((int)sizeof_pool_memory(fname) < sd->msglen) {
-            fname = realloc_pool_memory(fname, sd->msglen + 1);
+         if ((int)sizeof_pool_memory(fname) < bmsg->rbuflen) {
+            fname = realloc_pool_memory(fname, bmsg->rbuflen + 1);
          }
 
-         if ((int)sizeof_pool_memory(lname) < sd->msglen) {
-            lname = realloc_pool_memory(lname, sd->msglen + 1);
+         if ((int)sizeof_pool_memory(lname) < bmsg->rbuflen) {
+            lname = realloc_pool_memory(lname, bmsg->rbuflen + 1);
          }
          *fname = 0;
          *lname = 0;
@@ -127,13 +136,13 @@ void do_verify_volume(JCR *jcr)
           *    Link name (if file linked i.e. FT_LNK)
           *    Extended Attributes (if Win32)
           */
-         if (sscanf(sd->msg, "%d %d", &record_file_index, &type) != 2) {
-            Jmsg(jcr, M_FATAL, 0, _("Error scanning record header: %s\n"), sd->msg);
+         if (sscanf(bmsg->rbuf, "%d %d", &record_file_index, &type) != 2) {
+            Jmsg(jcr, M_FATAL, 0, _("Error scanning record header: %s\n"), bmsg->rbuf);
             Dmsg0(0, "\nError scanning header\n");
             goto bail_out;
          }
          Dmsg2(30, "Got Attr: FilInx=%d type=%d\n", record_file_index, type);
-         ap = sd->msg;
+         ap = bmsg->rbuf;
          while (*ap++ != ' ')         /* skip record file index */
             ;
          while (*ap++ != ' ')         /* skip type */
@@ -197,7 +206,7 @@ void do_verify_volume(JCR *jcr)
          break;
 
       case STREAM_MD5_DIGEST:
-         bin_to_base64(digest, sizeof(digest), (char *)sd->msg, CRYPTO_DIGEST_MD5_SIZE, true);
+         bin_to_base64(digest, sizeof(digest), (char *)bmsg->rbuf, CRYPTO_DIGEST_MD5_SIZE, true);
          Dmsg2(400, "send inx=%d MD5=%s\n", jcr->JobFiles, digest);
          dir->fsend("%d %d %s *MD5-%d*", jcr->JobFiles, STREAM_MD5_DIGEST, digest,
                     jcr->JobFiles);
@@ -205,7 +214,7 @@ void do_verify_volume(JCR *jcr)
          break;
 
       case STREAM_SHA1_DIGEST:
-         bin_to_base64(digest, sizeof(digest), (char *)sd->msg, CRYPTO_DIGEST_SHA1_SIZE, true);
+         bin_to_base64(digest, sizeof(digest), (char *)bmsg->rbuf, CRYPTO_DIGEST_SHA1_SIZE, true);
          Dmsg2(400, "send inx=%d SHA1=%s\n", jcr->JobFiles, digest);
          dir->fsend("%d %d %s *SHA1-%d*", jcr->JobFiles, STREAM_SHA1_DIGEST,
                     digest, jcr->JobFiles);
@@ -213,7 +222,7 @@ void do_verify_volume(JCR *jcr)
          break;
 
       case STREAM_SHA256_DIGEST:
-         bin_to_base64(digest, sizeof(digest), (char *)sd->msg, CRYPTO_DIGEST_SHA256_SIZE, true);
+         bin_to_base64(digest, sizeof(digest), (char *)bmsg->rbuf, CRYPTO_DIGEST_SHA256_SIZE, true);
          Dmsg2(400, "send inx=%d SHA256=%s\n", jcr->JobFiles, digest);
          dir->fsend("%d %d %s *SHA256-%d*", jcr->JobFiles, STREAM_SHA256_DIGEST,
                     digest, jcr->JobFiles);
@@ -221,7 +230,7 @@ void do_verify_volume(JCR *jcr)
          break;
 
       case STREAM_SHA512_DIGEST:
-         bin_to_base64(digest, sizeof(digest), (char *)sd->msg, CRYPTO_DIGEST_SHA512_SIZE, true);
+         bin_to_base64(digest, sizeof(digest), (char *)bmsg->rbuf, CRYPTO_DIGEST_SHA512_SIZE, true);
          Dmsg2(400, "send inx=%d SHA512=%s\n", jcr->JobFiles, digest);
          dir->fsend("%d %d %s *SHA512-%d*", jcr->JobFiles, STREAM_SHA512_DIGEST,
                     digest, jcr->JobFiles);
@@ -251,6 +260,11 @@ bail_out:
    jcr->setJobStatus(JS_ErrorTerminated);
 
 ok_out:
+   Dmsg0(215, "wait BufferedMsg\n");
+   fdmsg->wait_read_sock();
+   delete bmsg;
+   free_GetMsg(fdmsg);
+
    if (jcr->compress_buf) {
       free(jcr->compress_buf);
       jcr->compress_buf = NULL;
diff --git a/src/filed/xattr.c b/src/filed/xattr.c
index 64d3f9c..9240544 100644
--- a/src/filed/xattr.c
+++ b/src/filed/xattr.c
@@ -1,188 +1,186 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2008-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
-/**
- * Functions to handle Extended Attributes for bacula.
- *
- * Extended Attributes are so OS specific we only restore Extended Attributes if
- * they were saved using a filed on the same platform.
- *
- * Currently we support the following OSes:
- *   - AIX (Extended Attributes)
- *   - Darwin (Extended Attributes)
- *   - FreeBSD (Extended Attributes)
- *   - GNU HURD (Extended Attributes)
- *   - IRIX (Extended Attributes)
- *   - Linux (Extended Attributes)
- *   - NetBSD (Extended Attributes)
- *   - OpenBSD (Extended Attributes)
- *     (As it seems either they never implemented xattr or they are removed
- *      the support as it stated it was in version 3.1 but the current syscall
- *      tabled shows the extattr_ functions are not implemented. So as such we
- *      might eventually support xattr on OpenBSD when they implemented them using
- *      the same interface as FreeBSD and NetBSD.
- *   - Solaris (Extended Attributes and Extensible Attributes)
- *   - Tru64 (Extended Attributes)
+/* 
+ * Functions to handle Extended Attributes for bacula. 
+ * 
+ * Extended Attributes are so OS specific we only restore Extended Attributes if 
+ * they were saved using a filed on the same platform. 
+ * 
+ * Currently we support the following OSes: 
+ *   - AIX (Extended Attributes) 
+ *   - Darwin (Extended Attributes) 
+ *   - FreeBSD (Extended Attributes) 
+ *   - GNU HURD (Extended Attributes) 
+ *   - IRIX (Extended Attributes) 
+ *   - Linux (Extended Attributes) 
+ *   - NetBSD (Extended Attributes) 
+ *   - OpenBSD (Extended Attributes) 
+ *     (As it seems either they never implemented xattr or they are removed 
+ *      the support as it stated it was in version 3.1 but the current syscall 
+ *      tabled shows the extattr_ functions are not implemented. So as such we 
+ *      might eventually support xattr on OpenBSD when they implemented them using 
+ *      the same interface as FreeBSD and NetBSD. 
+ *   - Solaris (Extended Attributes and Extensible Attributes) 
+ *   - Tru64 (Extended Attributes) 
  *
- *   Written by Marco van Wieringen, November 2008
- *   Major overhaul January 2012 + June 2012
- */
-
-#include "bacula.h"
-#include "filed.h"
-
-#if !defined(HAVE_XATTR)
-/**
- * Entry points when compiled without support for XATTRs or on an unsupported platform.
- */
-bxattr_exit_code build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
+ *   Written by Marco van Wieringen, November 2008 
+ *   Major overhaul January 2012 + June 2012 
+ *   Simplfied by Kern Sibbald, June 2015
+ */ 
+ 
+#include "bacula.h" 
+#include "filed.h"   
+ 
+#ifndef HAVE_XATTR 
+/* 
+ * Entry points when compiled without support for XATTRs or on an unsupported platform. 
+ */ 
+bool backup_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
 {
-   return bxattr_exit_fatal;
+   Jmsg(jcr, M_FATAL, 0, "XATTR backup requested but not configured in Bacula.\n");
+   return false;
 }
 
-bxattr_exit_code parse_xattr_streams(JCR *jcr,
-                                     int stream,
-                                     char *content,
-                                     uint32_t content_length)
+bxattr_rtn_code restore_xattr_streams(JCR *jcr, int stream, char *content,
+                                    uint32_t content_length)
 {
-   return bxattr_exit_fatal;
+   return bxattr_rtn_fatal;
 }
-#else
-/**
+#else 
+/* 
  * Send a XATTR stream to the SD.
- */
-static bxattr_exit_code send_xattr_stream(JCR *jcr, int stream)
-{
+ */ 
+static bxattr_rtn_code send_xattr_stream(JCR *jcr, int stream)
+{ 
    BSOCK *sd = jcr->store_bsock;
    POOLMEM *msgsave;
-#ifdef FD_NO_SEND_TEST
-   return bxattr_exit_ok;
-#endif
 
-   /*
-    * Sanity check
-    */
-   if (jcr->xattr_data->u.build->content_length <= 0) {
-      return bxattr_exit_ok;
-   }
+#ifdef FD_NO_SEND_TEST 
+   return bxattr_rtn_ok;
+#endif 
 
-   /*
-    * Send header
-    */
+   /* 
+    * Sanity check 
+    */ 
+   if (jcr->xattr_ctx->content_length <= 0) {
+      return bxattr_rtn_ok;
+   }
+ 
+   /* 
+    * Send header 
+    */ 
    if (!sd->fsend("%ld %d 0", jcr->JobFiles, stream)) {
       Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"),
             sd->bstrerror());
-      return bxattr_exit_fatal;
-   }
-
-   /*
-    * Send the buffer to the storage deamon
-    */
-   Dmsg1(400, "Backing up XATTR <%s>\n", jcr->xattr_data->u.build->content);
+      return bxattr_rtn_fatal;
+   } 
+ 
+   /* 
+    * Send the buffer to the storage deamon 
+    */ 
+   Dmsg1(400, "Backing up XATTR <%s>\n", jcr->xattr_ctx->content);
    msgsave = sd->msg;
-   sd->msg = jcr->xattr_data->u.build->content;
-   sd->msglen = jcr->xattr_data->u.build->content_length;
+   sd->msg = jcr->xattr_ctx->content;
+   sd->msglen = jcr->xattr_ctx->content_length;
    if (!sd->send()) {
       sd->msg = msgsave;
       sd->msglen = 0;
       Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"),
             sd->bstrerror());
-      return bxattr_exit_fatal;
-   }
-
+      return bxattr_rtn_fatal;
+   } 
+ 
    jcr->JobBytes += sd->msglen;
    sd->msg = msgsave;
    if (!sd->signal(BNET_EOD)) {
       Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"),
             sd->bstrerror());
-      return bxattr_exit_fatal;
-   }
+      return bxattr_rtn_fatal;
+   } 
    Dmsg1(200, "XATTR of file: %s successfully backed up!\n", jcr->last_fname);
-   return bxattr_exit_ok;
-}
-
-/**
- * First some generic functions for OSes that use the same xattr encoding scheme.
- * Currently for all OSes except for Solaris.
- */
-#if !defined(HAVE_SUN_OS)
+   return bxattr_rtn_ok;
+} 
+ 
+/* 
+ * First some generic functions for OSes that use the same xattr encoding scheme. 
+ * Currently for all OSes except for Solaris. 
+ */ 
+#ifndef HAVE_SUN_OS
 static void xattr_drop_internal_table(alist *xattr_value_list)
 {
    xattr_t *current_xattr;
-
-   /*
-    * Walk the list of xattrs and free allocated memory on traversing.
-    */
+   
+   if (!xattr_value_list) {
+      return;
+   }
+   /* Walk the list of xattrs and free allocated memory. */
    foreach_alist(current_xattr, xattr_value_list) {
-      /*
-       * See if we can shortcut.
-       */
-      if (current_xattr == NULL || current_xattr->magic != XATTR_MAGIC)
-         break;
-
-      free(current_xattr->name);
-
-      if (current_xattr->value_length > 0)
+      if (current_xattr->magic != XATTR_MAGIC) {
+         continue;
+      }
+      if (current_xattr->name) {
+         free(current_xattr->name);
+      }
+      if (current_xattr->value && current_xattr->value_length > 0) {
          free(current_xattr->value);
-
+      }
       free(current_xattr);
    }
-
    delete xattr_value_list;
 }
 
-/**
- * The xattr stream for OSX, FreeBSD, Linux and NetBSD is a serialized stream of bytes
- * which encodes one or more xattr_t structures.
- *
- * The Serialized stream consists of the following elements:
- *    magic - A magic string which makes it easy to detect any binary incompatabilites
- *    name_length - The length of the following xattr name
- *    name - The name of the extended attribute
- *    value_length - The length of the following xattr data
- *    value - The actual content of the extended attribute
- *
- * This is repeated 1 or more times.
- *
- */
-static uint32_t serialize_xattr_stream(JCR *jcr,
-                                       uint32_t expected_serialize_len,
+/*
+ * The xattr stream for OSX, FreeBSD, Linux and NetBSD is a serialized stream of bytes 
+ * which encodes one or more xattr_t structures. 
+ * 
+ * The Serialized stream consists of the following elements: 
+ *    magic - A magic string which makes it easy to detect any binary incompatabilites 
+ *    name_length - The length of the following xattr name 
+ *    name - The name of the extended attribute 
+ *    value_length - The length of the following xattr data 
+ *    value - The actual content of the extended attribute 
+ * 
+ * This is repeated 1 or more times. 
+ * 
+ */ 
+static uint32_t serialize_xattr_stream(JCR *jcr, uint32_t expected_serialize_len,
                                        alist *xattr_value_list)
-{
+{ 
    xattr_t *current_xattr;
    ser_declare;
-
-   /*
-    * Make sure the serialized stream fits in the poolmem buffer.
-    * We allocate some more to be sure the stream is gonna fit.
-    */
-   jcr->xattr_data->u.build->content =
-   check_pool_memory_size(jcr->xattr_data->u.build->content,
-                          expected_serialize_len + 10);
-   ser_begin(jcr->xattr_data->u.build->content,
-             expected_serialize_len + 10);
-
-   /*
-    * Walk the list of xattrs and serialize the data.
-    */
+ 
+   /* 
+    * Make sure the serialized stream fits in the poolmem buffer. 
+    * We allocate some more to be sure the stream is gonna fit. 
+    */ 
+   jcr->xattr_ctx->content =
+   check_pool_memory_size(jcr->xattr_ctx->content, expected_serialize_len + 10);
+   ser_begin(jcr->xattr_ctx->content, expected_serialize_len + 10);
+ 
+   /* 
+    * Walk the list of xattrs and serialize the data. 
+    */ 
    foreach_alist(current_xattr, xattr_value_list) {
-      /*
-       * See if we can shortcut.
-       */
-      if (current_xattr == NULL || current_xattr->magic != XATTR_MAGIC)
-         break;
+      if (current_xattr->magic != XATTR_MAGIC) {
+         continue;                 /* Don't write invalid xattr */
+      }
 
       ser_uint32(current_xattr->magic);
       ser_uint32(current_xattr->name_length);
@@ -191,7 +189,6 @@ static uint32_t serialize_xattr_stream(JCR *jcr,
       ser_uint32(current_xattr->value_length);
       if (current_xattr->value_length > 0 && current_xattr->value) {
          ser_bytes(current_xattr->value, current_xattr->value_length);
-
          Dmsg3(100, "Backup xattr named %s, value %*s\n",
                current_xattr->name, current_xattr->value, current_xattr->value);
       } else {
@@ -199,14 +196,12 @@ static uint32_t serialize_xattr_stream(JCR *jcr,
       }
    }
 
-   ser_end(jcr->xattr_data->u.build->content, expected_serialize_len + 10);
-   jcr->xattr_data->u.build->content_length =
-   ser_length(jcr->xattr_data->u.build->content);
-
-   return jcr->xattr_data->u.build->content_length;
+   ser_end(jcr->xattr_ctx->content, expected_serialize_len + 10);
+   jcr->xattr_ctx->content_length = ser_length(jcr->xattr_ctx->content);
+   return jcr->xattr_ctx->content_length;
 }
 
-static bxattr_exit_code unserialize_xattr_stream(JCR *jcr,
+static bxattr_rtn_code unserialize_xattr_stream(JCR *jcr,
                                                  char *content,
                                                  uint32_t content_length,
                                                  alist *xattr_value_list)
@@ -214,67 +209,63 @@ static bxattr_exit_code unserialize_xattr_stream(JCR *jcr,
    unser_declare;
    xattr_t *current_xattr;
 
-   /**
-    * Parse the stream and call restore_xattr_on_file for each extended attribute.
+   /*
+    * Restore the stream and call restore_xattr_on_file for each extended attribute.
     *
     * Start unserializing the data. We keep on looping while we have not
     * unserialized all bytes in the stream.
     */
    unser_begin(content, content_length);
    while (unser_length(content) < content_length) {
-      /*
-       * First make sure the magic is present. This way we can easily catch corruption.
-       * Any missing MAGIC is fatal we do NOT try to continue.
-       */
+      /* 
+       * First make sure the magic is present. This way we can easily catch corruption. 
+       * Any missing MAGIC is fatal we do NOT try to continue. 
+       */ 
       current_xattr = (xattr_t *)malloc(sizeof(xattr_t));
       unser_uint32(current_xattr->magic);
       if (current_xattr->magic != XATTR_MAGIC) {
-         Mmsg1(jcr->errmsg,
-               _("Illegal xattr stream, no XATTR_MAGIC on file \"%s\"\n"),
-               jcr->last_fname);
-         Dmsg1(100, "Illegal xattr stream, no XATTR_MAGIC on file \"%s\"\n",
+         Mmsg1(jcr->errmsg, _("Invalid xattr stream, no XATTR_MAGIC on file \"%s\"\n"),
                jcr->last_fname);
+         Dmsg1(100, "%s", jcr->errmsg);
          free(current_xattr);
-         return bxattr_exit_error;
+         return bxattr_rtn_error;
       }
-
-      /*
-       * Decode the valuepair. First decode the length of the name.
-       */
+ 
+      /* 
+       * Decode the valuepair. First decode the length of the name. 
+       */ 
       unser_uint32(current_xattr->name_length);
       if (current_xattr->name_length == 0) {
-         Mmsg1(jcr->errmsg,
-               _("Illegal xattr stream, xattr name length <= 0 on file \"%s\"\n"),
-               jcr->last_fname);
-         Dmsg1(100, "Illegal xattr stream, xattr name length <= 0 on file \"%s\"\n",
+         Mmsg1(jcr->errmsg, _("Invalid xattr stream, xattr name length <= 0 on file \"%s\"\n"),
                jcr->last_fname);
+         Dmsg1(100, "%s", jcr->errmsg);
          free(current_xattr);
-         return bxattr_exit_error;
+         return bxattr_rtn_error;
       }
-
-      /*
-       * Allocate room for the name and decode its content.
-       */
+ 
+      /* 
+       * Allocate room for the name and decode its content. 
+       */ 
       current_xattr->name = (char *)malloc(current_xattr->name_length + 1);
       unser_bytes(current_xattr->name, current_xattr->name_length);
-
-      /*
-       * The xattr_name needs to be null terminated.
-       */
+ 
+      /* 
+       * The xattr_name needs to be null terminated. 
+       */ 
       current_xattr->name[current_xattr->name_length] = '\0';
-
-      /*
-       * Decode the value length.
-       */
+ 
+      /* 
+       * Decode the value length. 
+       */ 
       unser_uint32(current_xattr->value_length);
-
+ 
       if (current_xattr->value_length > 0) {
-         /*
-          * Allocate room for the value and decode its content.
-          */
+         /* 
+          * Allocate room for the value and decode its content. 
+          */ 
          current_xattr->value = (char *)malloc(current_xattr->value_length);
          unser_bytes(current_xattr->value, current_xattr->value_length);
-
+ 
          Dmsg3(100, "Restoring xattr named %s, value %*s\n",
                current_xattr->name, current_xattr->value, current_xattr->value);
       } else {
@@ -286,15 +277,15 @@ static bxattr_exit_code unserialize_xattr_stream(JCR *jcr,
    }
 
    unser_end(content, content_length);
-   return bxattr_exit_ok;
+   return bxattr_rtn_ok;
 }
 #endif
 
-/*
+/* 
  * This is a supported OS, See what kind of interface we should use.
- */
+ */ 
 #if defined(HAVE_AIX_OS)
-
+ 
 #if (!defined(HAVE_LISTEA) && !defined(HAVE_LLISTEA)) || \
     (!defined(HAVE_GETEA) && !defined(HAVE_LGETEA)) || \
     (!defined(HAVE_SETEA) && !defined(HAVE_LSETEA))
@@ -327,58 +318,45 @@ static int os_default_xattr_streams[1] = {
 #define llistea listea
 #endif
 
-static bxattr_exit_code aix_xattr_build_streams(JCR *jcr, FF_PKT *ff_pkt)
+static bxattr_rtn_code aix_xattr_build_streams(JCR *jcr, FF_PKT *ff_pkt)
 {
    char *bp;
    bool skip_xattr;
    char *xattr_list = NULL;
    int cnt, xattr_count = 0;
    uint32_t name_length;
-   int32_t xattr_list_len,
-           xattr_value_len;
+   int32_t xattr_list_len, xattr_value_len;
    uint32_t expected_serialize_len = 0;
    xattr_t *current_xattr;
    alist *xattr_value_list = NULL;
-   bxattr_exit_code retval = bxattr_exit_error;
+   bxattr_rtn_code retval = bxattr_rtn_error;
 
    /*
     * First get the length of the available list with extended attributes.
     */
    xattr_list_len = llistea(jcr->last_fname, NULL, 0);
-   switch (xattr_list_len) {
-   case -1: {
+   if (xattr_list_len < 0) {
       berrno be;
-
-      switch (errno) {
-      case ENOENT:
-      case EFORMAT:
-         retval = bxattr_exit_ok;
-         goto bail_out;
-      case ENOTSUP:
+      if (errno == ENOENT || errno == EFORMAT) {
+         retval = bxattr_rtn_ok;
+      } else if (errno == ENOTSUP) {
          /*
           * If the filesystem reports it doesn't support XATTRs we clear the
           * BXATTR_FLAG_SAVE_NATIVE flag so we skip XATTR saves on all other files
           * on the same filesystem. The BXATTR_FLAG_SAVE_NATIVE flags gets sets again
           * when we change from one filesystem to an other.
           */
-         jcr->xattr_data->flags &= ~BXATTR_FLAG_SAVE_NATIVE;
-         retval = bxattr_exit_ok;
-         goto bail_out;
-      default:
-         Mmsg2(jcr->errmsg,
-               _("llistea error on file \"%s\": ERR=%s\n"),
-               jcr->last_fname, be.bstrerror());
-         Dmsg2(100, "llistea error file=%s ERR=%s\n",
+         jcr->xattr_ctx->flags &= ~BXATTR_FLAG_SAVE_NATIVE;
+         retval = bxattr_rtn_ok;
+      } else {
+         Mmsg2(jcr->errmsg, _("XATTR llistea error on file \"%s\": ERR=%s\n"),
                jcr->last_fname, be.bstrerror());
-         goto bail_out;
+         Dmsg1(100, "%s", jcr->errmsg);
       }
-      break;
-   }
-   case 0:
-      retval = bxattr_exit_ok;
-      goto bail_out;
-   default:
-      break;
+      goto get_out;
+   } else if (xattr_list_len == 0) {
+      retval = bxattr_rtn_ok;
+      goto get_out;
    }
 
    /*
@@ -391,27 +369,16 @@ static bxattr_exit_code aix_xattr_build_streams(JCR *jcr, FF_PKT *ff_pkt)
     * Get the actual list of extended attributes names for a file.
     */
    xattr_list_len = llistea(jcr->last_fname, xattr_list, xattr_list_len);
-   switch (xattr_list_len) {
-   case -1: {
+   if (xattr_list_len < 0) {
       berrno be;
-
-      switch (errno) {
-      case ENOENT:
-      case EFORMAT:
-         retval = bxattr_exit_ok;
-         goto bail_out;
-      default:
-         Mmsg2(jcr->errmsg,
-               _("llistea error on file \"%s\": ERR=%s\n"),
-               jcr->last_fname, be.bstrerror());
-         Dmsg2(100, "llistea error file=%s ERR=%s\n",
+      if (errno == ENOENT || errno == EFORMAT) {
+         retval = bxattr_rtn_ok;
+      } else {
+         Mmsg2(jcr->errmsg, _("XATTR llistea error on file \"%s\": ERR=%s\n"),
                jcr->last_fname, be.bstrerror());
-         goto bail_out;
+         Dmsg1(100, "%s", jcr->errmsg);
       }
-      break;
-   }
-   default:
-      break;
+      goto get_out;
    }
    xattr_list[xattr_list_len] = '\0';
 
@@ -419,8 +386,7 @@ static bxattr_exit_code aix_xattr_build_streams(JCR *jcr, FF_PKT *ff_pkt)
     * Walk the list of extended attributes names and retrieve the data.
     * We already count the bytes needed for serializing the stream later on.
     */
-   for (bp = xattr_list;
-       (bp - xattr_list) + 1 < xattr_list_len;
+   for (bp = xattr_list; (bp - xattr_list) + 1 < xattr_list_len;
         bp = strchr(bp, '\0') + 1) {
       skip_xattr = false;
 
@@ -441,31 +407,20 @@ static bxattr_exit_code aix_xattr_build_streams(JCR *jcr, FF_PKT *ff_pkt)
        * First see how long the value is for the extended attribute.
        */
       xattr_value_len = lgetea(jcr->last_fname, bp, NULL, 0);
-      switch (xattr_value_len) {
-      case -1: {
+      if (xattr_value_len < 0) {
          berrno be;
-
-         switch (errno) {
-         case ENOENT:
-         case EFORMAT:
-            retval = bxattr_exit_ok;
-            goto bail_out;
-         default:
-            Mmsg2(jcr->errmsg,
-                  _("lgetea error on file \"%s\": ERR=%s\n"),
-                  jcr->last_fname, be.bstrerror());
-            Dmsg2(100, "lgetea error file=%s ERR=%s\n",
+         if (errno == ENOENT || errno == EFORMAT) {
+            retval = bxattr_rtn_ok;
+         } else {
+            Mmsg2(jcr->errmsg, _("XATTR lgetea error on file \"%s\": ERR=%s\n"),
                   jcr->last_fname, be.bstrerror());
-            goto bail_out;
+            Dmsg1(100, "%s", jcr->errmsg);
          }
-         break;
-      }
-      default:
-         break;
+         goto get_out;
       }
 
       /*
-       * Each xattr valuepair starts with a magic so we can parse it easier.
+       * Each xattr valuepair starts with a magic so we can restore it easier.
        */
       current_xattr = (xattr_t *)malloc(sizeof(xattr_t));
       memset(current_xattr, 0, sizeof(xattr_t));
@@ -482,13 +437,11 @@ static bxattr_exit_code aix_xattr_build_streams(JCR *jcr, FF_PKT *ff_pkt)
       expected_serialize_len += sizeof(current_xattr->name_length) +
                                 current_xattr->name_length;
 
-      switch (xattr_value_len) {
-      case 0:
+      if (xattr_value_len == 0) {
          current_xattr->value = NULL;
          current_xattr->value_length = 0;
          expected_serialize_len += sizeof(current_xattr->value_length);
-         break;
-      default:
+      } else {
          /*
           * Allocate space for storing the value.
           */
@@ -498,19 +451,12 @@ static bxattr_exit_code aix_xattr_build_streams(JCR *jcr, FF_PKT *ff_pkt)
          xattr_value_len = lgetea(jcr->last_fname, bp, current_xattr->value, xattr_value_len);
          if (xattr_value_len < 0) {
             berrno be;
-
-            switch (errno) {
-            case ENOENT:
-            case EFORMAT:
-               retval = bxattr_exit_ok;
-               break;
-            default:
-               Mmsg2(jcr->errmsg,
-                     _("lgetea error on file \"%s\": ERR=%s\n"),
-                     jcr->last_fname, be.bstrerror());
-               Dmsg2(100, "lgetea error file=%s ERR=%s\n",
+            if (errno == ENOENT || errno == EFORMAT) {
+               retval = bxattr_rtn_ok;
+            } else {
+               Mmsg2(jcr->errmsg, _("XATTR lgetea error on file \"%s\": ERR=%s\n"),
                      jcr->last_fname, be.bstrerror());
-               break;
+               Dmsg1(100, "%s", jcr->errmsg);
             }
 
             /*
@@ -519,7 +465,7 @@ static bxattr_exit_code aix_xattr_build_streams(JCR *jcr, FF_PKT *ff_pkt)
             free(current_xattr->value);
             free(current_xattr->name);
             free(current_xattr);
-            goto bail_out;
+            goto get_out;
          }
          /*
           * Store the actual length of the value.
@@ -527,7 +473,6 @@ static bxattr_exit_code aix_xattr_build_streams(JCR *jcr, FF_PKT *ff_pkt)
          current_xattr->value_length = xattr_value_len;
          expected_serialize_len += sizeof(current_xattr->value_length) +
                                    current_xattr->value_length;
-         break;
       }
 
       if (xattr_value_list == NULL) {
@@ -540,11 +485,11 @@ static bxattr_exit_code aix_xattr_build_streams(JCR *jcr, FF_PKT *ff_pkt)
       /*
        * Protect ourself against things getting out of hand.
        */
-      if (expected_serialize_len >= MAX_XATTR_STREAM) {
+      if (expected_serialize_len >= MAX_XATTR_LENGTH) {
          Mmsg2(jcr->errmsg,
                _("Xattr stream on file \"%s\" exceeds maximum size of %d bytes\n"),
-               jcr->last_fname, MAX_XATTR_STREAM);
-         goto bail_out;
+               jcr->last_fname, MAX_XATTR_LENGTH);
+         goto get_out;
       }
    }
 
@@ -555,18 +500,13 @@ static bxattr_exit_code aix_xattr_build_streams(JCR *jcr, FF_PKT *ff_pkt)
     * If we found any xattr send them to the SD.
     */
    if (xattr_count > 0) {
-      /*
-       * Serialize the datastream.
-       */
-      if (serialize_xattr_stream(jcr,
-                                 expected_serialize_len,
+      /* Serialize the datastream. */
+      if (serialize_xattr_stream(jcr, expected_serialize_len,
                                  xattr_value_list) < expected_serialize_len) {
-         Mmsg1(jcr->errmsg,
-               _("Failed to serialize extended attributes on file \"%s\"\n"),
-               jcr->last_fname);
-         Dmsg1(100, "Failed to serialize extended attributes on file \"%s\"\n",
+         Mmsg1(jcr->errmsg, _("Failed to serialize extended attributes on file \"%s\"\n"),
                jcr->last_fname);
-         goto bail_out;
+         Dmsg1(100, "%s", jcr->errmsg);
+         goto get_out;
       }
 
       /*
@@ -574,10 +514,10 @@ static bxattr_exit_code aix_xattr_build_streams(JCR *jcr, FF_PKT *ff_pkt)
        */
       retval = send_xattr_stream(jcr, os_default_xattr_streams[0]);
    } else {
-      retval = bxattr_exit_ok;
+      retval = bxattr_rtn_ok;
    }
 
-bail_out:
+get_out:
    if (xattr_list != NULL) {
       free(xattr_list);
    }
@@ -588,35 +528,28 @@ bail_out:
    return retval;
 }
 
-static bxattr_exit_code aix_parse_xattr_streams(JCR *jcr,
-                                                int stream,
-                                                char *content,
-                                                uint32_t content_length)
+static bxattr_rtn_code aix_restore_xattr_streams(JCR *jcr, int stream, char *content,
+                                               uint32_t content_length)
 {
    xattr_t *current_xattr;
    alist *xattr_value_list;
-   bxattr_exit_code retval = bxattr_exit_error;
+   bxattr_rtn_code retval = bxattr_rtn_error;
 
    xattr_value_list = New(alist(10, not_owned_by_alist));
 
-   if (unserialize_xattr_stream(jcr,
-                                content,
-                                content_length,
-                                xattr_value_list) != bxattr_exit_ok) {
-      goto bail_out;
+   if (unserialize_xattr_stream(jcr, content, content_length,
+                                xattr_value_list) != bxattr_rtn_ok) {
+      goto get_out;
    }
 
    foreach_alist(current_xattr, xattr_value_list) {
-      if (lsetea(jcr->last_fname,
-                 current_xattr->name,
-                 current_xattr->value,
+      if (lsetea(jcr->last_fname, current_xattr->name, current_xattr->value,
                  current_xattr->value_length, 0) != 0) {
          berrno be;
-
          switch (errno) {
          case ENOENT:
          case EFORMAT:
-            goto bail_out;
+            break;
          case ENOTSUP:
             /*
              * If the filesystem reports it doesn't support XATTRs we clear
@@ -625,36 +558,34 @@ static bxattr_exit_code aix_parse_xattr_streams(JCR *jcr,
              * BXATTR_FLAG_RESTORE_NATIVE flags gets sets again when we
              * change from one filesystem to an other.
              */
-            jcr->xattr_data->flags &= ~BXATTR_FLAG_RESTORE_NATIVE;
-            goto bail_out;
+            jcr->xattr_ctx->flags &= ~BXATTR_FLAG_RESTORE_NATIVE;
+            break;
          default:
-            Mmsg2(jcr->errmsg,
-                  _("lsetea error on file \"%s\": ERR=%s\n"),
+            Mmsg2(jcr->errmsg, _("XATTR lsetea error on file \"%s\": ERR=%s\n"),
                   jcr->last_fname, be.bstrerror());
-            Dmsg2(100, "lsetea error file=%s ERR=%s\n",
-                  jcr->last_fname, be.bstrerror());
-            goto bail_out;
+            Dmsg1(100, "%s", jcr->errmsg);
+            break;
          }
+         goto get_out;
       }
    }
+   retval = bxattr_rtn_ok;
 
-   retval = bxattr_exit_ok;
-
-bail_out:
+get_out:
    xattr_drop_internal_table(xattr_value_list);
 
    return retval;
 }
 
 /*
- * Function pointers to the build and parse function to use for these xattrs.
+ * Function pointers to the build and restore function to use for these xattrs.
  */
-static bxattr_exit_code (*os_build_xattr_streams)
+static bxattr_rtn_code (*os_backup_xattr_streams)
                         (JCR *jcr, FF_PKT *ff_pkt) =
                         aix_xattr_build_streams;
-static bxattr_exit_code (*os_parse_xattr_streams)
+static bxattr_rtn_code (*os_restore_xattr_streams)
                         (JCR *jcr, int stream, char *content, uint32_t content_length) =
-                        aix_parse_xattr_streams;
+                        aix_restore_xattr_streams;
 
 #elif defined(HAVE_IRIX_OS)
 
@@ -691,7 +622,7 @@ static xattr_naming_space xattr_naming_spaces[] = {
    }
 };
 
-static bxattr_exit_code irix_xattr_build_streams(JCR *jcr, FF_PKT *ff_pkt)
+static bxattr_rtn_code irix_xattr_build_streams(JCR *jcr, FF_PKT *ff_pkt)
 {
    char dummy[32];
    int cnt, length, xattr_count = 0;
@@ -701,27 +632,24 @@ static bxattr_exit_code irix_xattr_build_streams(JCR *jcr, FF_PKT *ff_pkt)
    xattr_t *current_xattr;
    alist *xattr_value_list = NULL;
    uint32_t expected_serialize_len = 0;
-   bxattr_exit_code retval = bxattr_exit_error;
+   bxattr_rtn_code retval = bxattr_rtn_error;
    POOLMEM *xattrbuf = get_memory(ATTR_MAX_VALUELEN);
 
    for (cnt = 0; xattr_naming_spaces[cnt].name != NULL; cnt++) {
       memset(&cursor, 0, sizeof(attrlist_cursor_t));
-      while (1) {
+      for ( ;; } {
          if (attr_list(jcr->last_fname, xattrbuf, ATTR_MAX_VALUELEN,
                        xattr_naming_spaces[cnt].flags, &cursor) != 0) {
             berrno be;
-
             switch (errno) {
             case ENOENT:
-               retval = bxattr_exit_ok;
-               goto bail_out;
+               retval = bxattr_rtn_ok;
+               goto get_out;
             default:
-               Mmsg2(jcr->errmsg,
-                     _("attr_list error on file \"%s\": ERR=%s\n"),
+               Mmsg2(jcr->errmsg, _("XATTR attr_list error on file \"%s\": ERR=%s\n"),
                      jcr->last_fname, be.bstrerror());
-               Dmsg2(100, "attr_list error file=%s ERR=%s\n",
-                     jcr->last_fname, be.bstrerror());
-               goto bail_out;
+               Dmsg1(100, "%s", jcr->errmsg);
+               goto get_out;
             }
          }
 
@@ -740,12 +668,11 @@ static bxattr_exit_code irix_xattr_build_streams(JCR *jcr, FF_PKT *ff_pkt)
             if (attr_get(jcr->last_fname, attrlist_ent->a_name, dummy,
                          &length, xattr_naming_spaces[cnt].flags) != 0) {
                berrno be;
-
                switch (errno) {
                case ENOENT:
                case ENOATTR:
-                  retval = bxattr_exit_ok;
-                  goto bail_out;
+                  retval = bxattr_rtn_ok;
+                  goto get_out;
                case E2BIG:
                   /*
                    * Size of the xattr is bigger then the 32 bytes dummy which is
@@ -754,17 +681,15 @@ static bxattr_exit_code irix_xattr_build_streams(JCR *jcr, FF_PKT *ff_pkt)
                    */
                   break;
                default:
-                  Mmsg2(jcr->errmsg,
-                        _("attr_list error on file \"%s\": ERR=%s\n"),
-                        jcr->last_fname, be.bstrerror());
-                  Dmsg2(100, "attr_list error file=%s ERR=%s\n",
+                  Mmsg2(jcr->errmsg, _("XATTR attr_list error on file \"%s\": ERR=%s\n"),
                         jcr->last_fname, be.bstrerror());
-                  goto bail_out;
+                  Dmsg1(100, "%s", jcr->errmsg);
+                  goto get_out;
                }
             }
 
             /*
-             * Each xattr valuepair starts with a magic so we can parse it easier.
+             * Each xattr valuepair starts with a magic so we can restore it easier.
              */
             current_xattr = (xattr_t *)malloc(sizeof(xattr_t));
             memset(current_xattr, 0, sizeof(xattr_t));
@@ -797,7 +722,7 @@ static bxattr_exit_code irix_xattr_build_streams(JCR *jcr, FF_PKT *ff_pkt)
                switch (errno) {
                case ENOENT:
                case ENOATTR:
-                  retval = bxattr_exit_ok;
+                  retval = bxattr_rtn_ok;
                   break;
                case E2BIG:
                   /*
@@ -815,7 +740,7 @@ static bxattr_exit_code irix_xattr_build_streams(JCR *jcr, FF_PKT *ff_pkt)
                      switch (errno) {
                      case ENOENT:
                      case ENOATTR:
-                        retval = bxattr_exit_ok;
+                        retval = bxattr_rtn_ok;
                         break;
                      default:
                         Mmsg2(jcr->errmsg,
@@ -830,11 +755,9 @@ static bxattr_exit_code irix_xattr_build_streams(JCR *jcr, FF_PKT *ff_pkt)
                   }
                   break;
                default:
-                  Mmsg2(jcr->errmsg,
-                        _("attr_list error on file \"%s\": ERR=%s\n"),
-                        jcr->last_fname, be.bstrerror());
-                  Dmsg2(100, "attr_list error file=%s ERR=%s\n",
+                  Mmsg2(jcr->errmsg, _("XATTR attr_list error on file \"%s\": ERR=%s\n"),
                         jcr->last_fname, be.bstrerror());
+                  Dmsg1(100, "%s", jcr->errmsg);
                   break;
                }
 
@@ -844,7 +767,7 @@ static bxattr_exit_code irix_xattr_build_streams(JCR *jcr, FF_PKT *ff_pkt)
                free(current_xattr->value);
                free(current_xattr->name);
                free(current_xattr);
-               goto bail_out;
+               goto get_out;
             }
 
 ok_continue:
@@ -862,11 +785,11 @@ ok_continue:
             /*
              * Protect ourself against things getting out of hand.
              */
-            if (expected_serialize_len >= MAX_XATTR_STREAM) {
+            if (expected_serialize_len >= MAX_XATTR_LENGTH) {
                Mmsg2(jcr->errmsg,
-                     _("Xattr stream on file \"%s\" exceeds maximum size of %d bytes\n"),
-                     jcr->last_fname, MAX_XATTR_STREAM);
-               goto bail_out;
+                     _("XATTR stream on file \"%s\" exceeds maximum size of %d bytes\n"),
+                     jcr->last_fname, MAX_XATTR_LENGTH);
+               goto get_out;
             }
          }
 
@@ -883,29 +806,22 @@ ok_continue:
     * If we found any xattr send them to the SD.
     */
    if (xattr_count > 0) {
-      /*
-       * Serialize the datastream.
-       */
-      if (serialize_xattr_stream(jcr,
-                                 expected_serialize_len,
+      /* Serialize the XATTR */
+      if (serialize_xattr_stream(jcr, expected_serialize_len,
                                  xattr_value_list) < expected_serialize_len) {
-         Mmsg1(jcr->errmsg,
-               _("Failed to serialize extended attributes on file \"%s\"\n"),
+         Mmsg1(jcr->errmsg, _("Failed to serialize extended attributes on file \"%s\"\n"),
                jcr->last_fname);
-         Dmsg1(100, "Failed to serialize extended attributes on file \"%s\"\n",
-               jcr->last_fname);
-         goto bail_out;
+         Dmsg1(100, "%s", jcr->errmsg);
+         goto get_out;
       }
 
-      /*
-       * Send the datastream to the SD.
-       */
+      /* Send the XATTR to the SD. */
       retval = send_xattr_stream(jcr, os_default_xattr_streams[0]);
    } else {
-      retval = bxattr_exit_ok;
+      retval = bxattr_rtn_ok;
    }
 
-bail_out:
+get_out:
    free_pool_memory(xattrbuf);
 
    if (xattr_value_list != NULL) {
@@ -915,7 +831,7 @@ bail_out:
    return retval;
 }
 
-static bxattr_exit_code irix_parse_xattr_streams(JCR *jcr,
+static bxattr_rtn_code irix_restore_xattr_streams(JCR *jcr,
                                                  int stream,
                                                  char *content,
                                                  uint32_t content_length)
@@ -924,15 +840,15 @@ static bxattr_exit_code irix_parse_xattr_streams(JCR *jcr,
    int cnt, cmp_size, name_space_index, flags;
    xattr_t *current_xattr;
    alist *xattr_value_list;
-   bxattr_exit_code retval = bxattr_exit_error;
+   bxattr_rtn_code retval = bxattr_rtn_error;
 
    xattr_value_list = New(alist(10, not_owned_by_alist));
 
    if (unserialize_xattr_stream(jcr,
                                 content,
                                 content_length,
-                                xattr_value_list) != bxattr_exit_ok) {
-      goto bail_out;
+                                xattr_value_list) != bxattr_rtn_ok) {
+      goto get_out;
    }
 
    foreach_alist(current_xattr, xattr_value_list) {
@@ -955,11 +871,10 @@ static bxattr_exit_code irix_parse_xattr_streams(JCR *jcr,
        */
       if (name_space_index == 0) {
          Mmsg2(jcr->errmsg,
-               _("Received illegal xattr named %s on file \"%s\"\n"),
-               current_xattr->name, jcr->last_fname);
-         Dmsg2(100, "Received illegal xattr named %s on file \"%s\"\n",
+               _("Received invalid xattr named %s on file \"%s\"\n"),
                current_xattr->name, jcr->last_fname);
-         goto bail_out;
+         Dmsg1(100, "%s", jcr->errmsg);
+         goto get_out;
       }
 
       /*
@@ -973,8 +888,8 @@ static bxattr_exit_code irix_parse_xattr_streams(JCR *jcr,
 
          switch (errno) {
          case ENOENT:
-            retval = bxattr_exit_ok;
-            goto bail_out;
+            retval = bxattr_rtn_ok;
+            goto get_out;
          case EEXIST:
             /*
              * The xattr already exists we need to replace it.
@@ -984,46 +899,42 @@ static bxattr_exit_code irix_parse_xattr_streams(JCR *jcr,
                          current_xattr->value_length, flags) != 0) {
                switch (errno) {
                case ENOENT:
-                  retval = bxattr_exit_ok;
-                  goto bail_out;
+                  retval = bxattr_rtn_ok;
+                  goto get_out;
                default:
-                  Mmsg2(jcr->errmsg,
-                        _("attr_set error on file \"%s\": ERR=%s\n"),
+                  Mmsg2(jcr->errmsg, _("attr_set error on file \"%s\": ERR=%s\n"),
                         jcr->last_fname, be.bstrerror(errno));
-                  Dmsg2(100, "attr_set error file=%s ERR=%s\n",
-                        jcr->last_fname, be.bstrerror());
-                  goto bail_out;
+                  Dmsg1(100, "%s", jcr->errmsg);
+                  goto get_out;
                }
             }
             break;
          default:
-            Mmsg2(jcr->errmsg,
-                  _("attr_set error on file \"%s\": ERR=%s\n"),
+            Mmsg2(jcr->errmsg, _("attr_set error on file \"%s\": ERR=%s\n"),
                   jcr->last_fname, be.bstrerror());
-            Dmsg2(100, "attr_set error file=%s ERR=%s\n",
-                  jcr->last_fname, be.bstrerror());
-            goto bail_out;
+            Dmsg1(100, "%s", jcr->errmsg);
+            goto get_out;
          }
       }
    }
 
-   retval = bxattr_exit_ok;
+   retval = bxattr_rtn_ok;
 
-bail_out:
+get_out:
    xattr_drop_internal_table(xattr_value_list);
 
    return retval;
 }
 
 /*
- * Function pointers to the build and parse function to use for these xattrs.
+ * Function pointers to the build and restore function to use for these xattrs.
  */
-static bxattr_exit_code (*os_build_xattr_streams)
+static bxattr_rtn_code (*os_backup_xattr_streams)
                         (JCR *jcr, FF_PKT *ff_pkt) =
                         irix_xattr_build_streams;
-static bxattr_exit_code (*os_parse_xattr_streams)
+static bxattr_rtn_code (*os_restore_xattr_streams)
                         (JCR *jcr, int stream, char *content, uint32_t content_length) =
-                        irix_parse_xattr_streams;
+                        irix_restore_xattr_streams;
 
 #elif defined(HAVE_DARWIN_OS) || \
       defined(HAVE_LINUX_OS) || \
@@ -1109,7 +1020,7 @@ static const char *xattr_skiplist[1] = {
    #endif
 #endif
 
-static bxattr_exit_code generic_xattr_build_streams(JCR *jcr, FF_PKT *ff_pkt)
+static bxattr_rtn_code generic_xattr_build_streams(JCR *jcr, FF_PKT *ff_pkt)
 {
    char *bp;
    bool skip_xattr;
@@ -1121,7 +1032,7 @@ static bxattr_exit_code generic_xattr_build_streams(JCR *jcr, FF_PKT *ff_pkt)
    uint32_t expected_serialize_len = 0;
    xattr_t *current_xattr;
    alist *xattr_value_list = NULL;
-   bxattr_exit_code retval = bxattr_exit_error;
+   bxattr_rtn_code retval = bxattr_rtn_error;
 
    /*
     * First get the length of the available list with extended attributes.
@@ -1133,8 +1044,8 @@ static bxattr_exit_code generic_xattr_build_streams(JCR *jcr, FF_PKT *ff_pkt)
 
       switch (errno) {
       case ENOENT:
-         retval = bxattr_exit_ok;
-         goto bail_out;
+         retval = bxattr_rtn_ok;
+         goto get_out;
       case BXATTR_ENOTSUP:
          /*
           * If the filesystem reports it doesn't support XATTRs we clear
@@ -1143,22 +1054,20 @@ static bxattr_exit_code generic_xattr_build_streams(JCR *jcr, FF_PKT *ff_pkt)
           * BXATTR_FLAG_RESTORE_NATIVE flags gets sets again when we
           * change from one filesystem to an other.
           */
-         jcr->xattr_data->flags &= ~BXATTR_FLAG_SAVE_NATIVE;
-         retval = bxattr_exit_ok;
-         goto bail_out;
+         jcr->xattr_ctx->flags &= ~BXATTR_FLAG_SAVE_NATIVE;
+         retval = bxattr_rtn_ok;
+         goto get_out;
       default:
-         Mmsg2(jcr->errmsg,
-               _("llistxattr error on file \"%s\": ERR=%s\n"),
-               jcr->last_fname, be.bstrerror());
-         Dmsg2(100, "llistxattr error file=%s ERR=%s\n",
+         Mmsg2(jcr->errmsg, _("llistxattr error on file \"%s\": ERR=%s\n"),
                jcr->last_fname, be.bstrerror());
-         goto bail_out;
+         Dmsg1(100, "%s", jcr->errmsg);
+         goto get_out;
       }
       break;
    }
    case 0:
-      retval = bxattr_exit_ok;
-      goto bail_out;
+      retval = bxattr_rtn_ok;
+      goto get_out;
    default:
       break;
    }
@@ -1173,26 +1082,16 @@ static bxattr_exit_code generic_xattr_build_streams(JCR *jcr, FF_PKT *ff_pkt)
     * Get the actual list of extended attributes names for a file.
     */
    xattr_list_len = llistxattr(jcr->last_fname, xattr_list, xattr_list_len);
-   switch (xattr_list_len) {
-   case -1: {
+   if (xattr_list_len < 0) {
       berrno be;
-
-      switch (errno) {
-      case ENOENT:
-         retval = bxattr_exit_ok;
-         goto bail_out;
-      default:
-         Mmsg2(jcr->errmsg,
-               _("llistxattr error on file \"%s\": ERR=%s\n"),
-               jcr->last_fname, be.bstrerror());
-         Dmsg2(100, "llistxattr error file=%s ERR=%s\n",
+      if (errno == ENOENT) {
+         retval = bxattr_rtn_ok;
+      } else {
+         Mmsg2(jcr->errmsg, _("llistxattr error on file \"%s\": ERR=%s\n"),
                jcr->last_fname, be.bstrerror());
-         goto bail_out;
+         Dmsg1(100, "%s", jcr->errmsg);
       }
-      break;
-   }
-   default:
-      break;
+     goto get_out;
    }
    xattr_list[xattr_list_len] = '\0';
 
@@ -1241,30 +1140,20 @@ static bxattr_exit_code generic_xattr_build_streams(JCR *jcr, FF_PKT *ff_pkt)
        * First see how long the value is for the extended attribute.
        */
       xattr_value_len = lgetxattr(jcr->last_fname, bp, NULL, 0);
-      switch (xattr_value_len) {
-      case -1: {
+      if (xattr_value_len < 0) {
          berrno be;
-
-         switch (errno) {
-         case ENOENT:
-            retval = bxattr_exit_ok;
-            goto bail_out;
-         default:
-            Mmsg2(jcr->errmsg,
-                  _("lgetxattr error on file \"%s\": ERR=%s\n"),
-                  jcr->last_fname, be.bstrerror());
-            Dmsg2(100, "lgetxattr error file=%s ERR=%s\n",
+         if (errno == ENOENT) {
+            retval = bxattr_rtn_ok;
+         } else {
+            Mmsg2(jcr->errmsg, _("lgetxattr error on file \"%s\": ERR=%s\n"),
                   jcr->last_fname, be.bstrerror());
-            goto bail_out;
+            Dmsg1(100, "%s", jcr->errmsg);
          }
-         break;
-      }
-      default:
-         break;
+         goto get_out;
       }
 
       /*
-       * Each xattr valuepair starts with a magic so we can parse it easier.
+       * Each xattr valuepair starts with a magic so we can restore it easier.
        */
       current_xattr = (xattr_t *)malloc(sizeof(xattr_t));
       current_xattr->magic = XATTR_MAGIC;
@@ -1299,14 +1188,12 @@ static bxattr_exit_code generic_xattr_build_streams(JCR *jcr, FF_PKT *ff_pkt)
 
             switch (errno) {
             case ENOENT:
-               retval = bxattr_exit_ok;
+               retval = bxattr_rtn_ok;
                break;
             default:
-               Mmsg2(jcr->errmsg,
-                     _("lgetxattr error on file \"%s\": ERR=%s\n"),
-                     jcr->last_fname, be.bstrerror());
-               Dmsg2(100, "lgetxattr error file=%s ERR=%s\n",
+               Mmsg2(jcr->errmsg, _("lgetxattr error on file \"%s\": ERR=%s\n"),
                      jcr->last_fname, be.bstrerror());
+               Dmsg1(100, "%s", jcr->errmsg);
                break;
             }
 
@@ -1316,7 +1203,7 @@ static bxattr_exit_code generic_xattr_build_streams(JCR *jcr, FF_PKT *ff_pkt)
             free(current_xattr->value);
             free(current_xattr->name);
             free(current_xattr);
-            goto bail_out;
+            goto get_out;
          }
 
          /*
@@ -1337,11 +1224,11 @@ static bxattr_exit_code generic_xattr_build_streams(JCR *jcr, FF_PKT *ff_pkt)
       /*
        * Protect ourself against things getting out of hand.
        */
-      if (expected_serialize_len >= MAX_XATTR_STREAM) {
+      if (expected_serialize_len >= MAX_XATTR_LENGTH) {
          Mmsg2(jcr->errmsg,
                _("Xattr stream on file \"%s\" exceeds maximum size of %d bytes\n"),
-               jcr->last_fname, MAX_XATTR_STREAM);
-         goto bail_out;
+               jcr->last_fname, MAX_XATTR_LENGTH);
+         goto get_out;
       }
    }
 
@@ -1355,15 +1242,12 @@ static bxattr_exit_code generic_xattr_build_streams(JCR *jcr, FF_PKT *ff_pkt)
       /*
        * Serialize the datastream.
        */
-      if (serialize_xattr_stream(jcr,
-                                 expected_serialize_len,
+      if (serialize_xattr_stream(jcr, expected_serialize_len,
                                  xattr_value_list) < expected_serialize_len) {
-         Mmsg1(jcr->errmsg,
-               _("Failed to serialize extended attributes on file \"%s\"\n"),
+         Mmsg1(jcr->errmsg, _("Failed to serialize extended attributes on file \"%s\"\n"),
                jcr->last_fname);
-         Dmsg1(100, "Failed to serialize extended attributes on file \"%s\"\n",
-               jcr->last_fname);
-         goto bail_out;
+         Dmsg1(100, "%s", jcr->errmsg);
+         goto get_out;
       }
 
       /*
@@ -1371,10 +1255,10 @@ static bxattr_exit_code generic_xattr_build_streams(JCR *jcr, FF_PKT *ff_pkt)
        */
       retval = send_xattr_stream(jcr, os_default_xattr_streams[0]);
    } else {
-      retval = bxattr_exit_ok;
+      retval = bxattr_rtn_ok;
    }
 
-bail_out:
+get_out:
    if (xattr_list != NULL) {
       free(xattr_list);
    }
@@ -1385,32 +1269,27 @@ bail_out:
    return retval;
 }
 
-static bxattr_exit_code generic_parse_xattr_streams(JCR *jcr,
-                                                    int stream,
+static bxattr_rtn_code generic_restore_xattr_streams(JCR *jcr, int stream,
                                                     char *content,
                                                     uint32_t content_length)
 {
    xattr_t *current_xattr;
    alist *xattr_value_list;
-   bxattr_exit_code retval = bxattr_exit_error;
+   bxattr_rtn_code retval = bxattr_rtn_error;
 
    xattr_value_list = New(alist(10, not_owned_by_alist));
 
-   if (unserialize_xattr_stream(jcr,
-                                content,
-                                content_length,
-                                xattr_value_list) != bxattr_exit_ok) {
-      goto bail_out;
+   if (unserialize_xattr_stream(jcr, content, content_length,
+                                xattr_value_list) != bxattr_rtn_ok) {
+      goto get_out;
    }
 
    foreach_alist(current_xattr, xattr_value_list) {
       if (lsetxattr(jcr->last_fname, current_xattr->name, current_xattr->value, current_xattr->value_length, 0) != 0) {
          berrno be;
-
-         switch (errno) {
-         case ENOENT:
-            goto bail_out;
-         case BXATTR_ENOTSUP:
+         if (errno == ENOENT) {
+            goto get_out;
+         } else if (errno == BXATTR_ENOTSUP) {
             /*
              * If the filesystem reports it doesn't support XATTRs we clear
              * the BXATTR_FLAG_RESTORE_NATIVE flag so we skip XATTR restores
@@ -1418,36 +1297,32 @@ static bxattr_exit_code generic_parse_xattr_streams(JCR *jcr,
              * BXATTR_FLAG_RESTORE_NATIVE flags gets sets again when we
              * change from one filesystem to an other.
              */
-            jcr->xattr_data->flags &= ~BXATTR_FLAG_RESTORE_NATIVE;
-            goto bail_out;
-         default:
-            Mmsg2(jcr->errmsg,
-                  _("lsetxattr error on file \"%s\": ERR=%s\n"),
+            jcr->xattr_ctx->flags &= ~BXATTR_FLAG_RESTORE_NATIVE;
+         } else {
+            Mmsg2(jcr->errmsg, _("lsetxattr error on file \"%s\": ERR=%s\n"),
                   jcr->last_fname, be.bstrerror());
-            Dmsg2(100, "lsetxattr error file=%s ERR=%s\n",
-                  jcr->last_fname, be.bstrerror());
-            goto bail_out;
+            Dmsg1(100, "%s", jcr->errmsg);
          }
+         goto get_out;
       }
    }
 
-   retval = bxattr_exit_ok;
+   retval = bxattr_rtn_ok;
 
-bail_out:
+get_out:
    xattr_drop_internal_table(xattr_value_list);
-
    return retval;
 }
 
 /*
- * Function pointers to the build and parse function to use for these xattrs.
+ * Function pointers to the build and restore functions to use for these xattrs.
  */
-static bxattr_exit_code (*os_build_xattr_streams)
+static bxattr_rtn_code (*os_backup_xattr_streams)
                         (JCR *jcr, FF_PKT *ff_pkt) =
                         generic_xattr_build_streams;
-static bxattr_exit_code (*os_parse_xattr_streams)
+static bxattr_rtn_code (*os_restore_xattr_streams)
                         (JCR *jcr, int stream, char *content, uint32_t content_length) =
-                        generic_parse_xattr_streams;
+                        generic_restore_xattr_streams;
 
 #elif defined(HAVE_FREEBSD_OS) || \
       defined(HAVE_NETBSD_OS) || \
@@ -1528,7 +1403,7 @@ static const char *xattr_skiplist[1] = {
 };
 #endif
 
-static bxattr_exit_code bsd_build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
+static bxattr_rtn_code bsd_backup_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
 {
    bool skip_xattr;
    char *xattr_list = NULL;
@@ -1542,7 +1417,7 @@ static bxattr_exit_code bsd_build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
    char current_attrname[XATTR_BUFSIZ], current_attrtuple[XATTR_BUFSIZ];
    xattr_t *current_xattr;
    alist *xattr_value_list = NULL;
-   bxattr_exit_code retval = bxattr_exit_error;
+   bxattr_rtn_code retval = bxattr_rtn_error;
 
    /*
     * Loop over all available xattr namespaces.
@@ -1566,8 +1441,8 @@ static bxattr_exit_code bsd_build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
 
          switch (errno) {
          case ENOENT:
-            retval = bxattr_exit_ok;
-            goto bail_out;
+            retval = bxattr_rtn_ok;
+            goto get_out;
 #if defined(EOPNOTSUPP)
          case EOPNOTSUPP:
 #endif
@@ -1579,12 +1454,10 @@ static bxattr_exit_code bsd_build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
              * FALLTHROUGH
              */
          default:
-            Mmsg2(jcr->errmsg,
-                  _("extattr_list_link error on file \"%s\": ERR=%s\n"),
+            Mmsg2(jcr->errmsg, _("extattr_list_link error on file \"%s\": ERR=%s\n"),
                   jcr->last_fname, be.bstrerror());
-            Dmsg2(100, "extattr_list_link error file=%s ERR=%s\n",
-                  jcr->last_fname, be.bstrerror());
-            goto bail_out;
+            Dmsg1(100, "%s", jcr->errmsg);
+            goto get_out;
          }
          break;
       }
@@ -1605,26 +1478,16 @@ static bxattr_exit_code bsd_build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
        */
       xattr_list_len = extattr_list_link(jcr->last_fname, attrnamespace,
                                          xattr_list, xattr_list_len);
-      switch (xattr_list_len) {
-      case -1: {
+      if (xattr_list_len < 0) {
          berrno be;
-
-         switch (errno) {
-         case ENOENT:
-            retval = bxattr_exit_ok;
-            goto bail_out;
-         default:
-            Mmsg2(jcr->errmsg,
-                  _("extattr_list_link error on file \"%s\": ERR=%s\n"),
+         if (errno == ENOENT) {
+            retval = bxattr_rtn_ok;
+         } else {
+            Mmsg2(jcr->errmsg, _("extattr_list_link error on file \"%s\": ERR=%s\n"),
                   jcr->last_fname, be.bstrerror());
-            Dmsg2(100, "extattr_list_link error file=%s ERR=%s\n",
-                  jcr->last_fname, be.bstrerror());
-            goto bail_out;
+            Dmsg1(100, "%s", jcr->errmsg);
          }
-         break;
-      }
-      default:
-         break;
+         goto get_out;
       }
       xattr_list[xattr_list_len] = '\0';
 
@@ -1634,12 +1497,10 @@ static bxattr_exit_code bsd_build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
        * returns a strdupped string which we need to free.
        */
       if (extattr_namespace_to_string(attrnamespace, &current_attrnamespace) != 0) {
-         Mmsg2(jcr->errmsg,
-               _("Failed to convert %d into namespace on file \"%s\"\n"),
-               attrnamespace, jcr->last_fname);
-         Dmsg2(100, "Failed to convert %d into namespace on file \"%s\"\n",
+         Mmsg2(jcr->errmsg, _("Failed to convert %d into namespace on file \"%s\"\n"),
                attrnamespace, jcr->last_fname);
-         goto bail_out;
+         Dmsg1(100, "%s", jcr->errmsg);
+         goto get_out;
       }
 
       /*
@@ -1711,15 +1572,13 @@ static bxattr_exit_code bsd_build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
 
             switch (errno) {
             case ENOENT:
-               retval = bxattr_exit_ok;
-               goto bail_out;
+               retval = bxattr_rtn_ok;
+               goto get_out;
             default:
-               Mmsg2(jcr->errmsg,
-                     _("extattr_get_link error on file \"%s\": ERR=%s\n"),
+               Mmsg2(jcr->errmsg, _("extattr_get_link error on file \"%s\": ERR=%s\n"),
                      jcr->last_fname, be.bstrerror());
-               Dmsg2(100, "extattr_get_link error file=%s ERR=%s\n",
-                     jcr->last_fname, be.bstrerror());
-               goto bail_out;
+               Dmsg1(100, "%s", jcr->errmsg);
+               goto get_out;
             }
             break;
          }
@@ -1728,7 +1587,7 @@ static bxattr_exit_code bsd_build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
          }
 
          /*
-          * Each xattr valuepair starts with a magic so we can parse it easier.
+          * Each xattr valuepair starts with a magic so we can restore it easier.
           */
          current_xattr = (xattr_t *)malloc(sizeof(xattr_t));
          memset(current_xattr, 0, sizeof(xattr_t));
@@ -1766,14 +1625,12 @@ static bxattr_exit_code bsd_build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
 
                switch (errno) {
                case ENOENT:
-                  retval = bxattr_exit_ok;
+                  retval = bxattr_rtn_ok;
                   break;
                default:
-                  Mmsg2(jcr->errmsg,
-                        _("extattr_get_link error on file \"%s\": ERR=%s\n"),
-                        jcr->last_fname, be.bstrerror());
-                  Dmsg2(100, "extattr_get_link error file=%s ERR=%s\n",
+                  Mmsg2(jcr->errmsg, _("extattr_get_link error on file \"%s\": ERR=%s\n"),
                         jcr->last_fname, be.bstrerror());
+                  Dmsg1(100, "%s", jcr->errmsg);
                   break;
                }
 
@@ -1783,7 +1640,7 @@ static bxattr_exit_code bsd_build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
                free(current_xattr->value);
                free(current_xattr->name);
                free(current_xattr);
-               goto bail_out;
+               goto get_out;
             }
 
             /*
@@ -1805,11 +1662,11 @@ static bxattr_exit_code bsd_build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
          /*
           * Protect ourself against things getting out of hand.
           */
-         if (expected_serialize_len >= MAX_XATTR_STREAM) {
-            Mmsg2(jcr->errmsg,
-                  _("Xattr stream on file \"%s\" exceeds maximum size of %d bytes\n"),
-                  jcr->last_fname, MAX_XATTR_STREAM);
-            goto bail_out;
+         if (expected_serialize_len >= MAX_XATTR_LENGTH) {
+            Mmsg2(jcr->errmsg, _("Xattr stream on file \"%s\" exceeds maximum size of %d bytes\n"),
+                  jcr->last_fname, MAX_XATTR_LENGTH);
+            Dmsg1(100, "%s", jcr->errmsg);
+            goto get_out;
          }
       }
 
@@ -1836,12 +1693,10 @@ static bxattr_exit_code bsd_build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
       if (serialize_xattr_stream(jcr,
                                  expected_serialize_len,
                                  xattr_value_list) < expected_serialize_len) {
-         Mmsg1(jcr->errmsg,
-               _("Failed to serialize extended attributes on file \"%s\"\n"),
-               jcr->last_fname);
-         Dmsg1(100, "Failed to serialize extended attributes on file \"%s\"\n",
+         Mmsg1(jcr->errmsg, _("Failed to serialize extended attributes on file \"%s\"\n"),
                jcr->last_fname);
-         goto bail_out;
+         Dmsg1(100, "%s", jcr->errmsg);
+         goto get_out;
       }
 
       /*
@@ -1849,10 +1704,10 @@ static bxattr_exit_code bsd_build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
        */
       retval = send_xattr_stream(jcr, os_default_xattr_streams[0]);
    } else {
-      retval = bxattr_exit_ok;
+      retval = bxattr_rtn_ok;
    }
 
-bail_out:
+get_out:
    if (current_attrnamespace != NULL) {
       actuallyfree(current_attrnamespace);
    }
@@ -1866,7 +1721,7 @@ bail_out:
    return retval;
 }
 
-static bxattr_exit_code bsd_parse_xattr_streams(JCR *jcr,
+static bxattr_rtn_code bsd_restore_xattr_streams(JCR *jcr,
                                                 int stream,
                                                 char *content,
                                                 uint32_t content_length)
@@ -1875,15 +1730,15 @@ static bxattr_exit_code bsd_parse_xattr_streams(JCR *jcr,
    alist *xattr_value_list;
    int current_attrnamespace, cnt;
    char *attrnamespace, *attrname;
-   bxattr_exit_code retval = bxattr_exit_error;
+   bxattr_rtn_code retval = bxattr_rtn_error;
 
    xattr_value_list = New(alist(10, not_owned_by_alist));
 
    if (unserialize_xattr_stream(jcr,
                                 content,
                                 content_length,
-                                xattr_value_list) != bxattr_exit_ok) {
-      goto bail_out;
+                                xattr_value_list) != bxattr_rtn_ok) {
+      goto get_out;
    }
 
    foreach_alist(current_xattr, xattr_value_list) {
@@ -1893,12 +1748,10 @@ static bxattr_exit_code bsd_parse_xattr_streams(JCR *jcr,
        */
       attrnamespace = current_xattr->name;
       if ((attrname = strchr(attrnamespace, '.')) == (char *)NULL) {
-         Mmsg2(jcr->errmsg,
-               _("Failed to split %s into namespace and name part on file \"%s\"\n"),
-               current_xattr->name, jcr->last_fname);
-         Dmsg2(100, "Failed to split %s into namespace and name part on file \"%s\"\n",
+         Mmsg2(jcr->errmsg, _("Failed to split %s into namespace and name part on file \"%s\"\n"),
                current_xattr->name, jcr->last_fname);
-         goto bail_out;
+         Dmsg1(100, "%s", jcr->errmsg);
+         goto get_out;
       }
       *attrname++ = '\0';
 
@@ -1906,12 +1759,10 @@ static bxattr_exit_code bsd_parse_xattr_streams(JCR *jcr,
        * Make sure the attrnamespace makes sense.
        */
       if (extattr_string_to_namespace(attrnamespace, &current_attrnamespace) != 0) {
-         Mmsg2(jcr->errmsg,
-               _("Failed to convert %s into namespace on file \"%s\"\n"),
-               attrnamespace, jcr->last_fname);
-         Dmsg2(100, "Failed to convert %s into namespace on file \"%s\"\n",
+         Mmsg2(jcr->errmsg, _("Failed to convert %s into namespace on file \"%s\"\n"),
                attrnamespace, jcr->last_fname);
-         goto bail_out;
+         Dmsg1(100, "%s", jcr->errmsg);
+         goto get_out;
       }
 
       /*
@@ -1921,40 +1772,33 @@ static bxattr_exit_code bsd_parse_xattr_streams(JCR *jcr,
                              attrname, current_xattr->value, current_xattr->value_length);
       if (cnt < 0 || cnt != (int)current_xattr->value_length) {
          berrno be;
-
-         switch (errno) {
-         case ENOENT:
-            goto bail_out;
-            break;
-         default:
-            Mmsg2(jcr->errmsg,
-                  _("extattr_set_link error on file \"%s\": ERR=%s\n"),
-                  jcr->last_fname, be.bstrerror());
-            Dmsg2(100, "extattr_set_link error file=%s ERR=%s\n",
+         if (errno == ENOENT) {
+            goto get_out;
+         } else {
+            Mmsg2(jcr->errmsg, _("extattr_set_link error on file \"%s\": ERR=%s\n"),
                   jcr->last_fname, be.bstrerror());
-            goto bail_out;
-            break;
+            Dmsg1(100, "%s", jcr->errmsg);
+            goto get_out;
          }
       }
    }
 
-   retval = bxattr_exit_ok;
+   retval = bxattr_rtn_ok;
 
-bail_out:
+get_out:
    xattr_drop_internal_table(xattr_value_list);
-
    return retval;
 }
 
 /*
- * Function pointers to the build and parse function to use for these xattrs.
+ * Function pointers to the build and restore function to use for these xattrs.
  */
-static bxattr_exit_code (*os_build_xattr_streams)
+static bxattr_rtn_code (*os_backup_xattr_streams)
                         (JCR *jcr, FF_PKT *ff_pkt) =
-                        bsd_build_xattr_streams;
-static bxattr_exit_code (*os_parse_xattr_streams)
+                        bsd_backup_xattr_streams;
+static bxattr_rtn_code (*os_restore_xattr_streams)
                         (JCR *jcr, int stream, char *content, uint32_t content_length) =
-                        bsd_parse_xattr_streams;
+                        bsd_restore_xattr_streams;
 
 #elif defined(HAVE_OSF1_OS)
 
@@ -1985,7 +1829,7 @@ static const char *xattr_skiplist[1] = {
    NULL
 };
 
-static bxattr_exit_code tru64_build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
+static bxattr_rtn_code tru64_backup_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
 {
    int cnt;
    char *bp,
@@ -2002,7 +1846,7 @@ static bxattr_exit_code tru64_build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
    xattr_t *current_xattr;
    alist *xattr_value_list = NULL;
    struct proplistname_args prop_args;
-   bxattr_exit_code retval = bxattr_exit_error;
+   bxattr_rtn_code retval = bxattr_rtn_error;
    POOLMEM *xattrbuf = get_pool_memory(PM_MESSAGE);
 
    xattrbuf_size = sizeof_pool_memory(xattrbuf);
@@ -2026,16 +1870,14 @@ static bxattr_exit_code tru64_build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
           * BXATTR_FLAG_RESTORE_NATIVE flags gets sets again when we
           * change from one filesystem to an other.
           */
-         jcr->xattr_data->flags &= ~BXATTR_FLAG_SAVE_NATIVE;
-         retval = bxattr_exit_ok;
-         goto bail_out;
+         jcr->xattr_ctx->flags &= ~BXATTR_FLAG_SAVE_NATIVE;
+         retval = bxattr_rtn_ok;
+         goto get_out;
       default:
-         Mmsg2(jcr->errmsg,
-               _("getproplist error on file \"%s\": ERR=%s\n"),
-               jcr->last_fname, be.bstrerror());
-         Dmsg2(100, "getproplist error file=%s ERR=%s\n",
+         Mmsg2(jcr->errmsg, _("getproplist error on file \"%s\": ERR=%s\n"),
                jcr->last_fname, be.bstrerror());
-         goto bail_out;
+         Dmsg1(100, "%s", jcr->errmsg);
+         goto get_out;
       }
       break;
    }
@@ -2055,12 +1897,10 @@ static bxattr_exit_code tru64_build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
 
             switch (errno) {
             default:
-               Mmsg2(jcr->errmsg,
-                     _("getproplist error on file \"%s\": ERR=%s\n"),
+               Mmsg2(jcr->errmsg, _("getproplist error on file \"%s\": ERR=%s\n"),
                      jcr->last_fname, be.bstrerror());
-               Dmsg2(100, "getproplist error file=%s ERR=%s\n",
-                     jcr->last_fname, be.bstrerror());
-               goto bail_out;
+               Dmsg1(100, "%s", jcr->errmsg);
+               goto get_out;
             }
             break;
          }
@@ -2071,8 +1911,8 @@ static bxattr_exit_code tru64_build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
              * we are better of forgetting this xattr as it seems its list is changing at this
              * exact moment so we can never make a good backup copy of it.
              */
-            retval = bxattr_exit_ok;
-            goto bail_out;
+            retval = bxattr_rtn_ok;
+            goto get_out;
          default:
             break;
          }
@@ -2080,8 +1920,8 @@ static bxattr_exit_code tru64_build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
          /*
           * No xattr on file.
           */
-         retval = bxattr_exit_ok;
-         goto bail_out;
+         retval = bxattr_rtn_ok;
+         goto get_out;
       }
       break;
    default:
@@ -2132,7 +1972,7 @@ static bxattr_exit_code tru64_build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
       }
 
       /*
-       * Each xattr valuepair starts with a magic so we can parse it easier.
+       * Each xattr valuepair starts with a magic so we can restore it easier.
        */
       current_xattr = (xattr_t *)malloc(sizeof(xattr_t));
       memset(current_xattr, 0, sizeof(xattr_t));
@@ -2162,11 +2002,11 @@ static bxattr_exit_code tru64_build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
       /*
        * Protect ourself against things getting out of hand.
        */
-      if (expected_serialize_len >= MAX_XATTR_STREAM) {
+      if (expected_serialize_len >= MAX_XATTR_LENGTH) {
          Mmsg2(jcr->errmsg,
                _("Xattr stream on file \"%s\" exceeds maximum size of %d bytes\n"),
-               jcr->last_fname, MAX_XATTR_STREAM);
-         goto bail_out;
+               jcr->last_fname, MAX_XATTR_LENGTH);
+         goto get_out;
       }
    }
 
@@ -2180,12 +2020,10 @@ static bxattr_exit_code tru64_build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
       if (serialize_xattr_stream(jcr,
                                  expected_serialize_len,
                                  xattr_value_list) < expected_serialize_len) {
-         Mmsg1(jcr->errmsg,
-               _("Failed to serialize extended attributes on file \"%s\"\n"),
-               jcr->last_fname);
-         Dmsg1(100, "Failed to serialize extended attributes on file \"%s\"\n",
+         Mmsg1(jcr->errmsg, _("Failed to serialize extended attributes on file \"%s\"\n"),
                jcr->last_fname);
-         goto bail_out;
+         Dmsg1(100, "%s", jcr->errmsg);
+         goto get_out;
       }
 
       /*
@@ -2193,10 +2031,10 @@ static bxattr_exit_code tru64_build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
        */
       retval = send_xattr_stream(jcr, os_default_xattr_streams[0]);
    } else {
-      retval = bxattr_exit_ok;
+      retval = bxattr_rtn_ok;
    }
 
-bail_out:
+get_out:
    if (xattr_value_list != NULL) {
       xattr_drop_internal_table(xattr_value_list);
    }
@@ -2205,7 +2043,7 @@ bail_out:
    return retval;
 }
 
-static bxattr_exit_code tru64_parse_xattr_streams(JCR *jcr,
+static bxattr_rtn_code tru64_restore_xattr_streams(JCR *jcr,
                                                   int stream,
                                                   char *content,
                                                   uint32_t content_length)
@@ -2214,15 +2052,15 @@ static bxattr_exit_code tru64_parse_xattr_streams(JCR *jcr,
    int32_t xattrbuf_size, cnt;
    xattr_t *current_xattr;
    alist *xattr_value_list;
-   bxattr_exit_code retval = bxattr_exit_error;
+   bxattr_rtn_code retval = bxattr_rtn_error;
 
    xattr_value_list = New(alist(10, not_owned_by_alist));
 
    if (unserialize_xattr_stream(jcr,
                                 content,
                                 content_length,
-                                xattr_value_list) != bxattr_exit_ok) {
-      goto bail_out;
+                                xattr_value_list) != bxattr_rtn_ok) {
+      goto get_out;
    }
 
    /*
@@ -2249,12 +2087,10 @@ static bxattr_exit_code tru64_parse_xattr_streams(JCR *jcr,
     * Sanity check.
     */
    if (cnt != xattrbuf_size) {
-      Mmsg1(jcr->errmsg,
-            _("Unable create proper proplist to restore xattrs on file \"%s\"\n"),
-            jcr->last_fname);
-      Dmsg1(100, "Unable create proper proplist to restore xattrs on file \"%s\"\n",
+      Mmsg1(jcr->errmsg, _("Unable create proper proplist to restore xattrs on file \"%s\"\n"),
             jcr->last_fname);
-      goto bail_out;
+      Dmsg1(100, "%s", jcr->errmsg);
+      goto get_out;
    }
 
    /*
@@ -2274,16 +2110,14 @@ static bxattr_exit_code tru64_parse_xattr_streams(JCR *jcr,
           * BXATTR_FLAG_RESTORE_NATIVE flags gets sets again when we
           * change from one filesystem to an other.
           */
-         jcr->xattr_data->flags &= ~BXATTR_FLAG_RESTORE_NATIVE;
-         retval = bxattr_exit_ok;
-         goto bail_out;
+         jcr->xattr_ctx->flags &= ~BXATTR_FLAG_RESTORE_NATIVE;
+         retval = bxattr_rtn_ok;
+         goto get_out;
       default:
-         Mmsg2(jcr->errmsg,
-               _("setproplist error on file \"%s\": ERR=%s\n"),
+         Mmsg2(jcr->errmsg, _("setproplist error on file \"%s\": ERR=%s\n"),
                jcr->last_fname, be.bstrerror());
-         Dmsg2(100, "setproplist error file=%s ERR=%s\n",
-               jcr->last_fname, be.bstrerror());
-         goto bail_out;
+         Dmsg1(100, "%s", jcr->errmsg);
+         goto get_out;
       }
       break;
    }
@@ -2291,9 +2125,9 @@ static bxattr_exit_code tru64_parse_xattr_streams(JCR *jcr,
       break;
    }
 
-   retval = bxattr_exit_ok;
+   retval = bxattr_rtn_ok;
 
-bail_out:
+get_out:
    if (xattrbuf) {
       free(xattrbuf);
    }
@@ -2303,14 +2137,14 @@ bail_out:
 }
 
 /*
- * Function pointers to the build and parse function to use for these xattrs.
+ * Function pointers to the build and restore function to use for these xattrs.
  */
-static bxattr_exit_code (*os_build_xattr_streams)
+static bxattr_rtn_code (*os_backup_xattr_streams)
                         (JCR *jcr, FF_PKT *ff_pkt) =
-                        tru64_build_xattr_streams;
-static bxattr_exit_code (*os_parse_xattr_streams)
+                        tru64_backup_xattr_streams;
+static bxattr_rtn_code (*os_restore_xattr_streams)
                         (JCR *jcr, int stream, char *content, uint32_t content_length) =
-                        tru64_parse_xattr_streams;
+                        tru64_restore_xattr_streams;
 
 #elif defined(HAVE_SUN_OS)
 /*
@@ -2437,7 +2271,7 @@ static inline xattr_link_cache_entry_t *find_xattr_link_cache_entry(JCR *jcr, in
 {
    xattr_link_cache_entry_t *ptr;
 
-   foreach_alist(ptr, jcr->xattr_data->u.build->link_cache) {
+   foreach_alist(ptr, jcr->xattr_ctx->link_cache) {
       if (ptr && ptr->inum == inum) {
          return ptr;
       }
@@ -2454,10 +2288,10 @@ static inline void add_xattr_link_cache_entry(JCR *jcr, ino_t inum, char *target
    ptr->inum = inum;
    ptr->target = bstrdup(target);
 
-   if (!jcr->xattr_data->u.build->link_cache) {
-      jcr->xattr_data->u.build->link_cache = New(alist(10, not_owned_by_alist));
+   if (!jcr->xattr_ctx->link_cache) {
+      jcr->xattr_ctx->link_cache = New(alist(10, not_owned_by_alist));
    }
-   jcr->xattr_data->u.build->link_cache->append(ptr);
+   jcr->xattr_ctx->link_cache->append(ptr);
 }
 
 static inline void drop_xattr_link_cache(JCR *jcr)
@@ -2467,13 +2301,13 @@ static inline void drop_xattr_link_cache(JCR *jcr)
    /*
     * Walk the list of xattr link cache entries and free allocated memory on traversing.
     */
-   foreach_alist(ptr, jcr->xattr_data->u.build->link_cache) {
+   foreach_alist(ptr, jcr->xattr_ctx->link_cache) {
       free(ptr->target);
       free(ptr);
    }
 
-   delete jcr->xattr_data->u.build->link_cache;
-   jcr->xattr_data->u.build->link_cache = NULL;
+   delete jcr->xattr_ctx->link_cache;
+   jcr->xattr_ctx->link_cache = NULL;
 }
 
 #if defined(HAVE_SYS_NVPAIR_H) && defined(_PC_SATTR_ENABLED)
@@ -2513,7 +2347,7 @@ static bool solaris_has_non_transient_extensible_attributes(int fd)
          fattr = name_to_attr(name);
       } else {
          retval = true;
-         goto bail_out;
+         goto get_out;
       }
 
       type = nvpair_type(pair);
@@ -2525,23 +2359,23 @@ static bool solaris_has_non_transient_extensible_attributes(int fd)
          if (value && fattr != F_ARCHIVE &&
                       fattr != F_AV_MODIFIED) {
             retval = true;
-            goto bail_out;
+            goto get_out;
          }
          break;
       case DATA_TYPE_UINT64_ARRAY:
          if (fattr != F_CRTIME) {
             retval = true;
-            goto bail_out;
+            goto get_out;
          }
          break;
       case DATA_TYPE_NVLIST:
       default:
          retval = true;
-         goto bail_out;
+         goto get_out;
       }
    }
 
-bail_out:
+get_out:
    if (response != NULL) {
       nvlist_free(response);
    }
@@ -2571,9 +2405,9 @@ static bool acl_is_trivial(int count, aclent_t *entries)
 }
 #endif /* HAVE_ACL && !HAVE_EXTENDED_ACL */
 
-static bxattr_exit_code solaris_save_xattr_acl(JCR *jcr, int fd, const char *attrname, char **acl_text)
+static bxattr_rtn_code solaris_save_xattr_acl(JCR *jcr, int fd, const char *attrname, char **acl_text)
 {
-   bxattr_exit_code retval = bxattr_exit_error;
+   bxattr_rtn_code retval = bxattr_rtn_error;
 #ifdef HAVE_ACL
 #ifdef HAVE_EXTENDED_ACL
    int flags;
@@ -2593,15 +2427,13 @@ static bxattr_exit_code solaris_save_xattr_acl(JCR *jcr, int fd, const char *att
 
          switch (errno) {
          case ENOENT:
-            retval = bxattr_exit_ok;
-            goto bail_out;
+            retval = bxattr_rtn_ok;
+            goto get_out;
          default:
-            Mmsg3(jcr->errmsg,
-                  _("Unable to get acl on xattr %s on file \"%s\": ERR=%s\n"),
-                  attrname, jcr->last_fname, be.bstrerror());
-            Dmsg3(100, "facl_get/acl_get of xattr %s on \"%s\" failed: ERR=%s\n",
+            Mmsg3(jcr->errmsg, _("Unable to get acl on xattr %s on file \"%s\": ERR=%s\n"),
                   attrname, jcr->last_fname, be.bstrerror());
-            goto bail_out;
+            Dmsg1(100, "%s", jcr->errmsg);
+            goto get_out;
          }
       }
 
@@ -2623,7 +2455,7 @@ static bxattr_exit_code solaris_save_xattr_acl(JCR *jcr, int fd, const char *att
    } else {
       *acl_text = NULL;
    }
-   retval = bxattr_exit_ok;
+   retval = bxattr_rtn_ok;
 #else /* HAVE_EXTENDED_ACL */
    int n;
    aclent_t *acls = NULL;
@@ -2646,16 +2478,14 @@ static bxattr_exit_code solaris_save_xattr_acl(JCR *jcr, int fd, const char *att
          switch (errno) {
          case ENOENT:
             free(acls);
-            retval = bxattr_exit_ok;
-            goto bail_out;
+            retval = bxattr_rtn_ok;
+            goto get_out;
          default:
-            Mmsg3(jcr->errmsg,
-                  _("Unable to get acl on xattr %s on file \"%s\": ERR=%s\n"),
-                  attrname, jcr->last_fname, be.bstrerror());
-            Dmsg3(100, "facl/acl of xattr %s on \"%s\" failed: ERR=%s\n",
+            Mmsg3(jcr->errmsg, _("Unable to get acl on xattr %s on file \"%s\": ERR=%s\n"),
                   attrname, jcr->last_fname, be.bstrerror());
+            Dmsg1(100, "%s", jcr->errmsg);
             free(acls);
-            goto bail_out;
+            goto get_out;
          }
       }
 
@@ -2666,13 +2496,11 @@ static bxattr_exit_code solaris_save_xattr_acl(JCR *jcr, int fd, const char *att
          if ((*acl_text = acltotext(acls, n)) == NULL) {
             berrno be;
 
-            Mmsg3(jcr->errmsg,
-                  _("Unable to get acl text on xattr %s on file \"%s\": ERR=%s\n"),
-                  attrname, jcr->last_fname, be.bstrerror());
-            Dmsg3(100, "acltotext of xattr %s on \"%s\" failed: ERR=%s\n",
+            Mmsg3(jcr->errmsg, _("Unable to get acl text on xattr %s on file \"%s\": ERR=%s\n"),
                   attrname, jcr->last_fname, be.bstrerror());
+            Dmsg1(100, "%s", jcr->errmsg);
             free(acls);
-            goto bail_out;
+            goto get_out;
          }
       } else {
          *acl_text = NULL;
@@ -2682,27 +2510,27 @@ static bxattr_exit_code solaris_save_xattr_acl(JCR *jcr, int fd, const char *att
    } else {
       *acl_text = NULL;
    }
-   retval = bxattr_exit_ok;
+   retval = bxattr_rtn_ok;
 #endif /* HAVE_EXTENDED_ACL */
 
 #else /* HAVE_ACL */
-   retval = bxattr_exit_ok;
+   retval = bxattr_rtn_ok;
 #endif /* HAVE_ACL */
 
-bail_out:
+get_out:
    return retval;
 }
 
 /*
  * Forward declaration for recursive function call.
  */
-static bxattr_exit_code solaris_save_xattrs(JCR *jcr, const char *xattr_namespace, const char *attr_parent);
+static bxattr_rtn_code solaris_save_xattrs(JCR *jcr, const char *xattr_namespace, const char *attr_parent);
 
 /*
  * Save an extended or extensible attribute.
  * This is stored as an opaque stream of bytes with the following encoding:
  *
- * <xattr_name>\0<stat_buffer>\0<acl_string>\0<actual_xattr_data>
+ * <xattr_name>\0<stat_buffer>\0<acl_string>\0<actual_xattr_ctx>
  *
  * or for a hardlinked or symlinked attribute
  *
@@ -2711,9 +2539,9 @@ static bxattr_exit_code solaris_save_xattrs(JCR *jcr, const char *xattr_namespac
  * xattr_name can be a subpath relative to the file the xattr is on.
  * stat_buffer is the string representation of the stat struct.
  * acl_string is an acl text when a non trivial acl is set on the xattr.
- * actual_xattr_data is the content of the xattr file.
+ * actual_xattr_ctx is the content of the xattr file.
  */
-static bxattr_exit_code solaris_save_xattr(JCR *jcr, int fd, const char *xattr_namespace,
+static bxattr_rtn_code solaris_save_xattr(JCR *jcr, int fd, const char *xattr_namespace,
                                            const char *attrname, bool toplevel_hidden_dir, int stream)
 {
    int cnt;
@@ -2725,7 +2553,7 @@ static bxattr_exit_code solaris_save_xattr(JCR *jcr, int fd, const char *xattr_n
    char *acl_text = NULL;
    char attribs[MAXSTRING];
    char buffer[XATTR_BUFSIZ];
-   bxattr_exit_code retval = bxattr_exit_error;
+   bxattr_rtn_code retval = bxattr_rtn_error;
 
    bsnprintf(target_attrname, sizeof(target_attrname), "%s%s", xattr_namespace, attrname);
 
@@ -2737,15 +2565,13 @@ static bxattr_exit_code solaris_save_xattr(JCR *jcr, int fd, const char *xattr_n
 
       switch (errno) {
       case ENOENT:
-         retval = bxattr_exit_ok;
-         goto bail_out;
+         retval = bxattr_rtn_ok;
+         goto get_out;
       default:
-         Mmsg3(jcr->errmsg,
-               _("Unable to get status on xattr %s on file \"%s\": ERR=%s\n"),
-               target_attrname, jcr->last_fname, be.bstrerror());
-         Dmsg3(100, "fstatat of xattr %s on \"%s\" failed: ERR=%s\n",
+         Mmsg3(jcr->errmsg, _("Unable to get status on xattr %s on file \"%s\": ERR=%s\n"),
                target_attrname, jcr->last_fname, be.bstrerror());
-         goto bail_out;
+         Dmsg1(100, "%s", jcr->errmsg);
+         goto get_out;
       }
    }
 
@@ -2761,8 +2587,8 @@ static bxattr_exit_code solaris_save_xattr(JCR *jcr, int fd, const char *xattr_n
       /*
        * Get any acl on the xattr.
        */
-      if (solaris_save_xattr_acl(jcr, attrfd, attrname, &acl_text) != bxattr_exit_ok)
-         goto bail_out;
+      if (solaris_save_xattr_acl(jcr, attrfd, attrname, &acl_text) != bxattr_rtn_ok)
+         goto get_out;
 
       /*
        * The current implementation of xattr on Solaris doesn't support this,
@@ -2778,8 +2604,8 @@ static bxattr_exit_code solaris_save_xattr(JCR *jcr, int fd, const char *xattr_n
       /*
        * Get any acl on the xattr.
        */
-      if (solaris_save_xattr_acl(jcr, attrfd, attrname, &acl_text) != bxattr_exit_ok)
-         goto bail_out;
+      if (solaris_save_xattr_acl(jcr, attrfd, attrname, &acl_text) != bxattr_rtn_ok)
+         goto get_out;
 
       /*
        * See if this is the toplevel_hidden_dir being saved.
@@ -2787,7 +2613,7 @@ static bxattr_exit_code solaris_save_xattr(JCR *jcr, int fd, const char *xattr_n
       if (toplevel_hidden_dir) {
          /*
           * Save the data for later storage when we encounter a real xattr.
-          * We store the data in the jcr->xattr_data->u.build->content buffer
+          * We store the data in the jcr->xattr_ctx->content buffer
           * and flush that just before sending out the first real xattr.
           * Encode the stat struct into an ASCII representation and jump
           * out of the function.
@@ -2797,9 +2623,9 @@ static bxattr_exit_code solaris_save_xattr(JCR *jcr, int fd, const char *xattr_n
                          "%s%c%s%c%s%c",
                          target_attrname, 0, attribs, 0,
                          (acl_text) ? acl_text : "", 0);
-         pm_memcpy(jcr->xattr_data->u.build->content, buffer, cnt);
-         jcr->xattr_data->u.build->content_length = cnt;
-         goto bail_out;
+         pm_memcpy(jcr->xattr_ctx->content, buffer, cnt);
+         jcr->xattr_ctx->content_length = cnt;
+         goto get_out;
       } else {
          /*
           * The current implementation of xattr on Solaris doesn't support this,
@@ -2829,15 +2655,15 @@ static bxattr_exit_code solaris_save_xattr(JCR *jcr, int fd, const char *xattr_n
             cnt = bsnprintf(buffer, sizeof(buffer),
                             "%s%c%s%c%s%c",
                             target_attrname, 0, attribs, 0, xlce->target, 0);
-            pm_memcpy(jcr->xattr_data->u.build->content, buffer, cnt);
-            jcr->xattr_data->u.build->content_length = cnt;
+            pm_memcpy(jcr->xattr_ctx->content, buffer, cnt);
+            jcr->xattr_ctx->content_length = cnt;
             retval = send_xattr_stream(jcr, stream);
 
             /*
              * For a hard linked file we are ready now, no need to recursively
              * save the attributes.
              */
-            goto bail_out;
+            goto get_out;
          }
 
          /*
@@ -2850,8 +2676,8 @@ static bxattr_exit_code solaris_save_xattr(JCR *jcr, int fd, const char *xattr_n
       /*
        * Get any acl on the xattr.
        */
-      if (solaris_save_xattr_acl(jcr, attrfd, attrname, &acl_text) != bxattr_exit_ok) {
-         goto bail_out;
+      if (solaris_save_xattr_acl(jcr, attrfd, attrname, &acl_text) != bxattr_rtn_ok) {
+         goto get_out;
       }
 
       /*
@@ -2870,15 +2696,13 @@ static bxattr_exit_code solaris_save_xattr(JCR *jcr, int fd, const char *xattr_n
 
          switch (errno) {
          case ENOENT:
-            retval = bxattr_exit_ok;
-            goto bail_out;
+            retval = bxattr_rtn_ok;
+            goto get_out;
          default:
-            Mmsg3(jcr->errmsg,
-                  _("Unable to open xattr %s on \"%s\": ERR=%s\n"),
+            Mmsg3(jcr->errmsg, _("Unable to open xattr %s on \"%s\": ERR=%s\n"),
                   target_attrname, jcr->last_fname, be.bstrerror());
-            Dmsg3(100, "openat of xattr %s on \"%s\" failed: ERR=%s\n",
-                  target_attrname, jcr->last_fname, be.bstrerror());
-            goto bail_out;
+            Dmsg1(100, "%s", jcr->errmsg);
+            goto get_out;
          }
       }
       break;
@@ -2893,15 +2717,13 @@ static bxattr_exit_code solaris_save_xattr(JCR *jcr, int fd, const char *xattr_n
 
          switch (errno) {
          case ENOENT:
-            retval = bxattr_exit_ok;
-            goto bail_out;
+            retval = bxattr_rtn_ok;
+            goto get_out;
          default:
-            Mmsg3(jcr->errmsg,
-                  _("Unable to read symlin %s on \"%s\": ERR=%s\n"),
-                  target_attrname, jcr->last_fname, be.bstrerror());
-            Dmsg3(100, "readlink of xattr %s on \"%s\" failed: ERR=%s\n",
+            Mmsg3(jcr->errmsg, _("Unable to read symlin %s on \"%s\": ERR=%s\n"),
                   target_attrname, jcr->last_fname, be.bstrerror());
-            goto bail_out;
+            Dmsg1(100, "%s", jcr->errmsg);
+            goto get_out;
          }
       }
 
@@ -2912,38 +2734,38 @@ static bxattr_exit_code solaris_save_xattr(JCR *jcr, int fd, const char *xattr_n
       cnt = bsnprintf(buffer, sizeof(buffer),
                       "%s%c%s%c%s%c",
                       target_attrname, 0, attribs, 0, link_source, 0);
-      pm_memcpy(jcr->xattr_data->u.build->content, buffer, cnt);
-      jcr->xattr_data->u.build->content_length = cnt;
+      pm_memcpy(jcr->xattr_ctx->content, buffer, cnt);
+      jcr->xattr_ctx->content_length = cnt;
       retval = send_xattr_stream(jcr, stream);
 
-      if (retval == bxattr_exit_ok) {
-         jcr->xattr_data->u.build->nr_saved++;
+      if (retval == bxattr_rtn_ok) {
+         jcr->xattr_ctx->nr_saved++;
       }
 
       /*
        * For a soft linked file we are ready now, no need to recursively save the attributes.
        */
-      goto bail_out;
+      goto get_out;
    default:
-      goto bail_out;
+      goto get_out;
    }
 
    /*
     * See if this is the first real xattr being saved.
     * If it is save the toplevel_hidden_dir attributes first.
     * This is easy as its stored already in the
-    * jcr->xattr_data->u.build->content buffer.
+    * jcr->xattr_ctx->content buffer.
     */
-   if (jcr->xattr_data->u.build->nr_saved == 0) {
+   if (jcr->xattr_ctx->nr_saved == 0) {
       retval = send_xattr_stream(jcr, STREAM_XATTR_SOLARIS);
-      if (retval != bxattr_exit_ok) {
-         goto bail_out;
+      if (retval != bxattr_rtn_ok) {
+         goto get_out;
       }
-      jcr->xattr_data->u.build->nr_saved++;
+      jcr->xattr_ctx->nr_saved++;
    }
 
-   pm_memcpy(jcr->xattr_data->u.build->content, buffer, cnt);
-   jcr->xattr_data->u.build->content_length = cnt;
+   pm_memcpy(jcr->xattr_ctx->content, buffer, cnt);
+   jcr->xattr_ctx->content_length = cnt;
 
    /*
     * Only dump the content of regular files.
@@ -2954,29 +2776,27 @@ static bxattr_exit_code solaris_save_xattr(JCR *jcr, int fd, const char *xattr_n
          /*
           * Protect ourself against things getting out of hand.
           */
-         if (st.st_size >= MAX_XATTR_STREAM) {
+         if (st.st_size >= MAX_XATTR_LENGTH) {
             Mmsg2(jcr->errmsg,
                   _("Xattr stream on file \"%s\" exceeds maximum size of %d bytes\n"),
-                  jcr->last_fname, MAX_XATTR_STREAM);
-            goto bail_out;
+                  jcr->last_fname, MAX_XATTR_LENGTH);
+            goto get_out;
          }
 
          while ((cnt = read(attrfd, buffer, sizeof(buffer))) > 0) {
-            jcr->xattr_data->u.build->content =
-            check_pool_memory_size(jcr->xattr_data->u.build->content,
-                                   jcr->xattr_data->u.build->content_length + cnt);
-            memcpy(jcr->xattr_data->u.build->content +
-                   jcr->xattr_data->u.build->content_length, buffer, cnt);
-            jcr->xattr_data->u.build->content_length += cnt;
+            jcr->xattr_ctx->content =
+               check_pool_memory_size(jcr->xattr_ctx->content,
+                  jcr->xattr_ctx->content_length + cnt);
+            memcpy(jcr->xattr_ctx->content +
+                   jcr->xattr_ctx->content_length, buffer, cnt);
+            jcr->xattr_ctx->content_length += cnt;
          }
 
          if (cnt < 0) {
-            Mmsg2(jcr->errmsg,
-                  _("Unable to read content of xattr %s on file \"%s\"\n"),
+            Mmsg2(jcr->errmsg, _("Unable to read content of xattr %s on file \"%s\"\n"),
                   target_attrname, jcr->last_fname);
-            Dmsg2(100, "read of data from xattr %s on \"%s\" failed\n",
-                  target_attrname, jcr->last_fname);
-            goto bail_out;
+            Dmsg1(100, "%s", jcr->errmsg);
+            goto get_out;
          }
       }
       break;
@@ -2989,10 +2809,10 @@ static bxattr_exit_code solaris_save_xattr(JCR *jcr, int fd, const char *xattr_n
     * We build a new xattr stream send it to the SD.
     */
    retval = send_xattr_stream(jcr, stream);
-   if (retval != bxattr_exit_ok) {
-       goto bail_out;
+   if (retval != bxattr_rtn_ok) {
+       goto get_out;
    }
-   jcr->xattr_data->u.build->nr_saved++;
+   jcr->xattr_ctx->nr_saved++;
 
    /*
     * Recursivly call solaris_save_extended_attributes for archiving the attributes
@@ -3008,19 +2828,17 @@ static bxattr_exit_code solaris_save_xattr(JCR *jcr, int fd, const char *xattr_n
 
       switch (errno) {
       case ENOENT:
-         retval = bxattr_exit_ok;
-         goto bail_out;
+         retval = bxattr_rtn_ok;
+         goto get_out;
       default:
-         Mmsg2(jcr->errmsg,
-               _("Unable to chdir to xattr space of file \"%s\": ERR=%s\n"),
+         Mmsg2(jcr->errmsg, _("Unable to chdir to xattr space of file \"%s\": ERR=%s\n"),
                jcr->last_fname, be.bstrerror());
-         Dmsg3(100, "Unable to fchdir to xattr space of file \"%s\" using fd %d: ERR=%s\n",
-               jcr->last_fname, fd, be.bstrerror());
-         goto bail_out;
+         Dmsg1(100, "%s", jcr->errmsg);
+         goto get_out;
       }
    }
 
-bail_out:
+get_out:
    if (acl_text != NULL) {
       free(acl_text);
    }
@@ -3030,14 +2848,14 @@ bail_out:
    return retval;
 }
 
-static bxattr_exit_code solaris_save_xattrs(JCR *jcr, const char *xattr_namespace, const char *attr_parent)
+static bxattr_rtn_code solaris_save_xattrs(JCR *jcr, const char *xattr_namespace, const char *attr_parent)
 {
    const char *name;
    int fd, filefd = -1, attrdirfd = -1;
    DIR *dirp;
    struct dirent *dp;
    char current_xattr_namespace[PATH_MAX];
-   bxattr_exit_code retval = bxattr_exit_error;
+   bxattr_rtn_code retval = bxattr_rtn_error;
 
    /*
     * Determine what argument to use. Use attr_parent when set
@@ -3065,15 +2883,13 @@ static bxattr_exit_code solaris_save_xattrs(JCR *jcr, const char *xattr_namespac
 
       switch (errno) {
       case ENOENT:
-         retval = bxattr_exit_ok;
-         goto bail_out;
+         retval = bxattr_rtn_ok;
+         goto get_out;
       default:
-         Mmsg2(jcr->errmsg,
-               _("Unable to open file \"%s\": ERR=%s\n"),
+         Mmsg2(jcr->errmsg, _("Unable to open file \"%s\": ERR=%s\n"),
                jcr->last_fname, be.bstrerror());
-         Dmsg2(100, "Unable to open file \"%s\": ERR=%s\n",
-               jcr->last_fname, be.bstrerror());
-         goto bail_out;
+         Dmsg1(100, "%s", jcr->errmsg);
+         goto get_out;
       }
    }
 
@@ -3090,18 +2906,16 @@ static bxattr_exit_code solaris_save_xattrs(JCR *jcr, const char *xattr_namespac
           * Which is not problem we just forget about this this xattr.
           * But as this is not an error we return a positive return value.
           */
-         retval = bxattr_exit_ok;
-         goto bail_out;
+         retval = bxattr_rtn_ok;
+         goto get_out;
       case ENOENT:
-         retval = bxattr_exit_ok;
-         goto bail_out;
+         retval = bxattr_rtn_ok;
+         goto get_out;
       default:
-         Mmsg3(jcr->errmsg,
-               _("Unable to open xattr space %s on file \"%s\": ERR=%s\n"),
-               name, jcr->last_fname, be.bstrerror());
-         Dmsg3(100, "Unable to open xattr space %s on file \"%s\": ERR=%s\n",
+         Mmsg3(jcr->errmsg, _("Unable to open xattr space %s on file \"%s\": ERR=%s\n"),
                name, jcr->last_fname, be.bstrerror());
-         goto bail_out;
+         Dmsg1(100, "%s", jcr->errmsg);
+         goto get_out;
       }
    }
 
@@ -3112,12 +2926,10 @@ static bxattr_exit_code solaris_save_xattrs(JCR *jcr, const char *xattr_namespac
    if (fchdir(attrdirfd) < 0) {
       berrno be;
 
-      Mmsg2(jcr->errmsg,
-            _("Unable to chdir to xattr space on file \"%s\": ERR=%s\n"),
+      Mmsg2(jcr->errmsg, _("Unable to chdir to xattr space on file \"%s\": ERR=%s\n"),
             jcr->last_fname, be.bstrerror());
-      Dmsg3(100, "Unable to fchdir to xattr space on file \"%s\" using fd %d: ERR=%s\n",
-            jcr->last_fname, attrdirfd, be.bstrerror());
-      goto bail_out;
+      Dmsg1(100, "%s", jcr->errmsg);
+      goto get_out;
    }
 
    /*
@@ -3133,13 +2945,11 @@ static bxattr_exit_code solaris_save_xattrs(JCR *jcr, const char *xattr_namespac
        (dirp = fdopendir(fd)) == (DIR *)NULL) {
       berrno be;
 
-      Mmsg2(jcr->errmsg,
-            _("Unable to list the xattr space on file \"%s\": ERR=%s\n"),
+      Mmsg2(jcr->errmsg, _("Unable to list the xattr space on file \"%s\": ERR=%s\n"),
             jcr->last_fname, be.bstrerror());
-      Dmsg3(100, "Unable to fdopendir xattr space on file \"%s\" using fd %d: ERR=%s\n",
-            jcr->last_fname, fd, be.bstrerror());
+      Dmsg1(100, "%s", jcr->errmsg);
 
-      goto bail_out;
+      goto get_out;
    }
 
    /*
@@ -3204,9 +3014,9 @@ static bxattr_exit_code solaris_save_xattrs(JCR *jcr, const char *xattr_namespac
    }
 
    closedir(dirp);
-   retval = bxattr_exit_ok;
+   retval = bxattr_rtn_ok;
 
-bail_out:
+get_out:
    if (attrdirfd != -1)
       close(attrdirfd);
    if (filefd != -1)
@@ -3215,7 +3025,7 @@ bail_out:
 }
 
 #ifdef HAVE_ACL
-static bxattr_exit_code solaris_restore_xattr_acl(JCR *jcr,
+static bxattr_rtn_code solaris_restore_xattr_acl(JCR *jcr,
                                                   int fd,
                                                   const char *attrname,
                                                   char *acl_text)
@@ -3228,25 +3038,23 @@ static bxattr_exit_code solaris_restore_xattr_acl(JCR *jcr,
       Mmsg1(jcr->errmsg,
             _("Unable to convert acl from text on file \"%s\"\n"),
             jcr->last_fname);
-      return bxattr_exit_error;
+      return bxattr_rtn_error;
    }
 
    if ((fd != -1 && facl_set(fd, aclp) != 0) ||
         acl_set(attrname, aclp) != 0) {
       berrno be;
 
-      Mmsg3(jcr->errmsg,
-            _("Unable to restore acl of xattr %s on file \"%s\": ERR=%s\n"),
+      Mmsg3(jcr->errmsg, _("Unable to restore acl of xattr %s on file \"%s\": ERR=%s\n"),
             attrname, jcr->last_fname, be.bstrerror());
-      Dmsg3(100, "Unable to restore acl of xattr %s on file \"%s\": ERR=%s\n",
-            attrname, jcr->last_fname, be.bstrerror());
-      return bxattr_exit_error;
+      Dmsg1(100, "%s", jcr->errmsg);
+      return bxattr_rtn_error;
    }
 
    if (aclp) {
       acl_free(aclp);
    }
-   return bxattr_exit_ok;
+   return bxattr_rtn_ok;
 
 #else /* HAVE_EXTENDED_ACL */
    int n;
@@ -3258,26 +3066,24 @@ static bxattr_exit_code solaris_restore_xattr_acl(JCR *jcr,
            acl(attrname, SETACL, n, acls) != 0) {
          berrno be;
 
-         Mmsg3(jcr->errmsg,
-               _("Unable to restore acl of xattr %s on file \"%s\": ERR=%s\n"),
-               attrname, jcr->last_fname, be.bstrerror());
-         Dmsg3(100, "Unable to restore acl of xattr %s on file \"%s\": ERR=%s\n",
+         Mmsg3(jcr->errmsg, _("Unable to restore acl of xattr %s on file \"%s\": ERR=%s\n"),
                attrname, jcr->last_fname, be.bstrerror());
-         return bxattr_exit_error;
+         Dmsg1(100, "%s", jcr->errmsg);
+         return bxattr_rtn_error;
       }
    }
 
    if (acls) {
       free(acls);
    }
-   return bxattr_exit_ok;
+   return bxattr_rtn_ok;
 
 #endif /* HAVE_EXTENDED_ACL */
 
 }
 #endif /* HAVE_ACL */
 
-static bxattr_exit_code solaris_restore_xattrs(JCR *jcr,
+static bxattr_rtn_code solaris_restore_xattrs(JCR *jcr,
                                                bool is_extensible,
                                                char *content,
                                                uint32_t content_length)
@@ -3292,10 +3098,10 @@ static bxattr_exit_code solaris_restore_xattrs(JCR *jcr,
    int32_t inum;
    struct stat st;
    struct timeval times[2];
-   bxattr_exit_code retval = bxattr_exit_error;
+   bxattr_rtn_code retval = bxattr_rtn_error;
 
    /*
-    * Parse the xattr stream. First the part that is the same for all xattrs.
+    * Restore the xattr stream. First the part that is the same for all xattrs.
     */
    used_bytes = 0;
 
@@ -3307,7 +3113,7 @@ static bxattr_exit_code solaris_restore_xattrs(JCR *jcr,
    target_attrname = content + 1;
    if ((bp = strchr(target_attrname, '\0')) == (char *)NULL ||
        (used_bytes = (bp - content)) >= (int32_t)(content_length - 1)) {
-      goto parse_error;
+      goto restore_error;
    }
    attribs = ++bp;
 
@@ -3317,12 +3123,10 @@ static bxattr_exit_code solaris_restore_xattrs(JCR *jcr,
    if ((filefd = open(jcr->last_fname, O_RDONLY | O_NONBLOCK)) < 0) {
       berrno be;
 
-      Mmsg2(jcr->errmsg,
-            _("Unable to open file \"%s\": ERR=%s\n"),
-            jcr->last_fname, be.bstrerror());
-      Dmsg2(100, "Unable to open file \"%s\": ERR=%s\n",
+      Mmsg2(jcr->errmsg, _("Unable to open file \"%s\": ERR=%s\n"),
             jcr->last_fname, be.bstrerror());
-      goto bail_out;
+      Dmsg1(100, "%s", jcr->errmsg);
+      goto get_out;
    }
 
    /*
@@ -3331,23 +3135,19 @@ static bxattr_exit_code solaris_restore_xattrs(JCR *jcr,
    if ((attrdirfd = openat(filefd, ".", O_RDONLY | O_XATTR)) < 0) {
       berrno be;
 
-      Mmsg2(jcr->errmsg,
-            _("Unable to open xattr space on file \"%s\": ERR=%s\n"),
+      Mmsg2(jcr->errmsg, _("Unable to open xattr space on file \"%s\": ERR=%s\n"),
             jcr->last_fname, be.bstrerror());
-      Dmsg2(100, "Unable to open xattr space on file \"%s\": ERR=%s\n",
-            jcr->last_fname, be.bstrerror());
-      goto bail_out;
+      Dmsg1(100, "%s", jcr->errmsg);
+      goto get_out;
    }
 
    if (fchdir(attrdirfd) < 0) {
       berrno be;
 
-      Mmsg2(jcr->errmsg,
-            _("Unable to chdir to xattr space on file \"%s\": ERR=%s\n"),
+      Mmsg2(jcr->errmsg, _("Unable to chdir to xattr space on file \"%s\": ERR=%s\n"),
             jcr->last_fname, be.bstrerror());
-      Dmsg3(100, "Unable to fchdir to xattr space on file \"%s\" using fd %d: ERR=%s\n",
-            jcr->last_fname, attrdirfd, be.bstrerror());
-      goto bail_out;
+      Dmsg1(100, "%s", jcr->errmsg);
+      goto get_out;
    }
 
    /*
@@ -3361,12 +3161,10 @@ static bxattr_exit_code solaris_restore_xattrs(JCR *jcr,
       if ((fd = open(target_attrname, O_RDONLY | O_NONBLOCK)) < 0) {
          berrno be;
 
-         Mmsg3(jcr->errmsg,
-               _("Unable to open xattr %s on file \"%s\": ERR=%s\n"),
-               target_attrname, jcr->last_fname, be.bstrerror());
-         Dmsg3(100, "Unable to open xattr %s on file \"%s\": ERR=%s\n",
+         Mmsg3(jcr->errmsg, _("Unable to open xattr %s on file \"%s\": ERR=%s\n"),
                target_attrname, jcr->last_fname, be.bstrerror());
-         goto bail_out;
+         Dmsg1(100, "%s", jcr->errmsg);
+         goto get_out;
       }
 
       close(filefd);
@@ -3378,12 +3176,10 @@ static bxattr_exit_code solaris_restore_xattrs(JCR *jcr,
       if ((fd = openat(filefd, ".", O_RDONLY | O_XATTR)) < 0) {
          berrno be;
 
-         Mmsg3(jcr->errmsg,
-               _("Unable to open xattr space %s on file \"%s\": ERR=%s\n"),
+         Mmsg3(jcr->errmsg, _("Unable to open xattr space %s on file \"%s\": ERR=%s\n"),
                target_attrname, jcr->last_fname, be.bstrerror());
-         Dmsg3(100, "Unable to open xattr space %s on file \"%s\": ERR=%s\n",
-               target_attrname, jcr->last_fname, be.bstrerror());
-         goto bail_out;
+         Dmsg1(100, "%s", jcr->errmsg);
+         goto get_out;
       }
 
       close(attrdirfd);
@@ -3395,12 +3191,10 @@ static bxattr_exit_code solaris_restore_xattrs(JCR *jcr,
       if (fchdir(attrdirfd) < 0) {
          berrno be;
 
-         Mmsg3(jcr->errmsg,
-               _("Unable to chdir to xattr space %s on file \"%s\": ERR=%s\n"),
+         Mmsg3(jcr->errmsg, _("Unable to chdir to xattr space %s on file \"%s\": ERR=%s\n"),
                target_attrname, jcr->last_fname, be.bstrerror());
-         Dmsg4(100, "Unable to fchdir to xattr space %s on file \"%s\" using fd %d: ERR=%s\n",
-               target_attrname, jcr->last_fname, attrdirfd, be.bstrerror());
-         goto bail_out;
+         Dmsg1(100, "%s", jcr->errmsg);
+         goto get_out;
       }
 
       target_attrname = ++bp;
@@ -3416,7 +3210,7 @@ static bxattr_exit_code solaris_restore_xattrs(JCR *jcr,
     */
    if ((bp = strchr(attribs, '\0')) == (char *)NULL ||
        (used_bytes = (bp - content)) >= (int32_t)(content_length - 1)) {
-      goto parse_error;
+      goto restore_error;
    }
    acl_text = ++bp;
 
@@ -3435,12 +3229,10 @@ static bxattr_exit_code solaris_restore_xattrs(JCR *jcr,
       if (mkfifo(target_attrname, st.st_mode) < 0) {
          berrno be;
 
-         Mmsg3(jcr->errmsg,
-               _("Unable to mkfifo xattr %s on file \"%s\": ERR=%s\n"),
+         Mmsg3(jcr->errmsg, _("Unable to mkfifo xattr %s on file \"%s\": ERR=%s\n"),
                target_attrname, jcr->last_fname, be.bstrerror());
-         Dmsg3(100, "Unable to mkfifo xattr %s on file \"%s\": ERR=%s\n",
-               target_attrname,  jcr->last_fname, be.bstrerror());
-         goto bail_out;
+         Dmsg1(100, "%s", jcr->errmsg);
+         goto get_out;
       }
       break;
    case S_IFCHR:
@@ -3453,12 +3245,10 @@ static bxattr_exit_code solaris_restore_xattrs(JCR *jcr,
       if (mknod(target_attrname, st.st_mode, st.st_rdev) < 0) {
          berrno be;
 
-         Mmsg3(jcr->errmsg,
-               _("Unable to mknod xattr %s on file \"%s\": ERR=%s\n"),
+         Mmsg3(jcr->errmsg, _("Unable to mknod xattr %s on file \"%s\": ERR=%s\n"),
                target_attrname, jcr->last_fname, be.bstrerror());
-         Dmsg3(100, "Unable to mknod xattr %s on file \"%s\": ERR=%s\n",
-               target_attrname,  jcr->last_fname, be.bstrerror());
-         goto bail_out;
+         Dmsg1(100, "%s", jcr->errmsg);
+         goto get_out;
       }
       break;
    case S_IFDIR:
@@ -3472,11 +3262,12 @@ static bxattr_exit_code solaris_restore_xattrs(JCR *jcr,
          if (mkdir(target_attrname, st.st_mode) < 0) {
             berrno be;
 
+            /* *** FIXME *** why not Mmsg? */
             Jmsg3(jcr, M_WARNING, 0, _("Unable to mkdir xattr %s on file \"%s\": ERR=%s\n"),
                target_attrname, jcr->last_fname, be.bstrerror());
             Dmsg3(100, "Unable to mkdir xattr %s on file \"%s\": ERR=%s\n",
                target_attrname,  jcr->last_fname, be.bstrerror());
-            goto bail_out;
+            goto get_out;
          }
       }
       break;
@@ -3491,23 +3282,21 @@ static bxattr_exit_code solaris_restore_xattrs(JCR *jcr,
          if (link(linked_target, target_attrname) < 0) {
             berrno be;
 
-            Mmsg4(jcr->errmsg,
-                  _("Unable to link xattr %s to %s on file \"%s\": ERR=%s\n"),
+            Mmsg4(jcr->errmsg, _("Unable to link xattr %s to %s on file \"%s\": ERR=%s\n"),
                   target_attrname, linked_target, jcr->last_fname, be.bstrerror());
-            Dmsg4(100, "Unable to link xattr %s to %s on file \"%s\": ERR=%s\n",
-                  target_attrname, linked_target, jcr->last_fname, be.bstrerror());
-            goto bail_out;
+            Dmsg1(100, "%s", jcr->errmsg);
+            goto get_out;
          }
 
          /*
           * Successfully restored xattr.
           */
-         retval = bxattr_exit_ok;
-         goto bail_out;
+         retval = bxattr_rtn_ok;
+         goto get_out;
       } else {
          if ((bp = strchr(acl_text, '\0')) == (char *)NULL ||
              (used_bytes = (bp - content)) >= (int32_t)content_length) {
-            goto parse_error;
+            goto restore_error;
          }
 
          if (used_bytes < (int32_t)(content_length - 1))
@@ -3523,12 +3312,10 @@ static bxattr_exit_code solaris_restore_xattrs(JCR *jcr,
          if ((attrfd = openat(attrdirfd, target_attrname, O_RDWR | O_CREAT | O_TRUNC, st.st_mode)) < 0) {
             berrno be;
 
-            Mmsg3(jcr->errmsg,
-                  _("Unable to open xattr %s on file \"%s\": ERR=%s\n"),
-                  target_attrname, jcr->last_fname, be.bstrerror());
-            Dmsg3(100, "Unable to open xattr %s on file \"%s\": ERR=%s\n",
+            Mmsg3(jcr->errmsg, _("Unable to open xattr %s on file \"%s\": ERR=%s\n"),
                   target_attrname, jcr->last_fname, be.bstrerror());
-            goto bail_out;
+            Dmsg1(100, "%s", jcr->errmsg);
+            goto get_out;
          }
       }
 
@@ -3544,12 +3331,10 @@ static bxattr_exit_code solaris_restore_xattrs(JCR *jcr,
           * we have available as data of the stream.
           */
          if (cnt != st.st_size) {
-            Mmsg2(jcr->errmsg,
-                  _("Unable to restore data of xattr %s on file \"%s\": Not all data available in xattr stream\n"),
-                  target_attrname, jcr->last_fname);
-            Dmsg2(100, "Unable to restore data of xattr %s on file \"%s\": Not all data available in xattr stream\n",
+            Mmsg2(jcr->errmsg, _("Unable to restore data of xattr %s on file \"%s\": Not all data available in xattr stream\n"),
                   target_attrname, jcr->last_fname);
-            goto bail_out;
+            Dmsg1(100, "%s", jcr->errmsg);
+            goto get_out;
          }
 
          while (cnt > 0) {
@@ -3557,12 +3342,10 @@ static bxattr_exit_code solaris_restore_xattrs(JCR *jcr,
             if (cnt < 0) {
                berrno be;
 
-               Mmsg3(jcr->errmsg,
-                     _("Unable to restore data of xattr %s on file \"%s\": ERR=%s\n"),
-                     target_attrname, jcr->last_fname, be.bstrerror());
-               Dmsg3(100, "Unable to restore data of xattr %s on file \"%s\": ERR=%s\n",
+               Mmsg3(jcr->errmsg, _("Unable to restore data of xattr %s on file \"%s\": ERR=%s\n"),
                      target_attrname, jcr->last_fname, be.bstrerror());
-               goto bail_out;
+               Dmsg1(100, "%s", jcr->errmsg);
+               goto get_out;
             }
 
             used_bytes += cnt;
@@ -3580,21 +3363,19 @@ static bxattr_exit_code solaris_restore_xattrs(JCR *jcr,
       if (symlink(linked_target, target_attrname) < 0) {
          berrno be;
 
-         Mmsg4(jcr->errmsg,
-               _("Unable to symlink xattr %s to %s on file \"%s\": ERR=%s\n"),
+         Mmsg4(jcr->errmsg, _("Unable to symlink xattr %s to %s on file \"%s\": ERR=%s\n"),
                target_attrname, linked_target, jcr->last_fname, be.bstrerror());
-         Dmsg4(100, "Unable to symlink xattr %s to %s on file \"%s\": ERR=%s\n",
-               target_attrname, linked_target, jcr->last_fname, be.bstrerror());
-         goto bail_out;
+         Dmsg1(100, "%s", jcr->errmsg);
+         goto get_out;
       }
 
       /*
        * Successfully restored xattr.
        */
-      retval = bxattr_exit_ok;
-      goto bail_out;
+      retval = bxattr_rtn_ok;
+      goto get_out;
    default:
-      goto bail_out;
+      goto get_out;
    }
 
    /*
@@ -3603,33 +3384,22 @@ static bxattr_exit_code solaris_restore_xattrs(JCR *jcr,
    if (!is_extensible) {
       if (fchownat(attrdirfd, target_attrname, st.st_uid, st.st_gid, AT_SYMLINK_NOFOLLOW) < 0) {
          berrno be;
-
-         switch (errno) {
-         case EINVAL:
-            /*
-             * Gentile way of the system saying this type of xattr layering is not supported.
-             * But as this is not an error we return a positive return value.
-             */
-            retval = bxattr_exit_ok;
-            break;
-         case ENOENT:
-            retval = bxattr_exit_ok;
-            break;
-         default:
-            Mmsg3(jcr->errmsg,
-                  _("Unable to restore owner of xattr %s on file \"%s\": ERR=%s\n"),
-                  target_attrname, jcr->last_fname, be.bstrerror());
-            Dmsg3(100, "Unable to restore owner of xattr %s on file \"%s\": ERR=%s\n",
+         /* EINVAL means is not supported, no fail */
+         if (errno == EINVAL || errno == ENOENT) {
+            retval = bxattr_rtn_ok;
+         } else {
+            Mmsg3(jcr->errmsg, _("Unable to restore owner of xattr %s on file \"%s\": ERR=%s\n"),
                   target_attrname, jcr->last_fname, be.bstrerror());
+            Dmsg1(100, "%s", jcr->errmsg);
          }
-         goto bail_out;
+         goto get_out;
       }
    }
 
 #ifdef HAVE_ACL
    if (acl_text && *acl_text)
-      if (solaris_restore_xattr_acl(jcr, attrfd, target_attrname, acl_text) != bxattr_exit_ok)
-         goto bail_out;
+      if (solaris_restore_xattr_acl(jcr, attrfd, target_attrname, acl_text) != bxattr_rtn_ok)
+         goto get_out;
 #endif /* HAVE_ACL */
 
    /*
@@ -3643,30 +3413,25 @@ static bxattr_exit_code solaris_restore_xattrs(JCR *jcr,
 
       if (futimesat(attrdirfd, target_attrname, times) < 0) {
          berrno be;
-
-         Mmsg3(jcr->errmsg,
-               _("Unable to restore filetimes of xattr %s on file \"%s\": ERR=%s\n"),
+         Mmsg3(jcr->errmsg, _("Unable to restore filetimes of xattr %s on file \"%s\": ERR=%s\n"),
                target_attrname, jcr->last_fname, be.bstrerror());
-         Dmsg3(100, "Unable to restore filetimes of xattr %s on file \"%s\": ERR=%s\n",
-               target_attrname, jcr->last_fname, be.bstrerror());
-         goto bail_out;
+         Dmsg1(100, "%s", jcr->errmsg);
+         goto get_out;
       }
    }
 
    /*
     * Successfully restored xattr.
     */
-   retval = bxattr_exit_ok;
-   goto bail_out;
+   retval = bxattr_rtn_ok;
+   goto get_out;
 
-parse_error:
-   Mmsg1(jcr->errmsg,
-         _("Illegal xattr stream, failed to parse xattr stream on file \"%s\"\n"),
-         jcr->last_fname);
-   Dmsg1(100, "Illegal xattr stream, failed to parse xattr stream on file \"%s\"\n",
+restore_error:
+   Mmsg1(jcr->errmsg, _("Invalid xattr stream, failed to restore xattr stream on file \"%s\"\n"),
          jcr->last_fname);
+   Dmsg1(100, "%s", jcr->errmsg);
 
-bail_out:
+get_out:
    if (attrfd != -1) {
       close(attrfd);
    }
@@ -3679,17 +3444,17 @@ bail_out:
    return retval;
 }
 
-static bxattr_exit_code solaris_build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
+static bxattr_rtn_code solaris_backup_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
 {
    char cwd[PATH_MAX];
-   bxattr_exit_code retval = bxattr_exit_ok;
+   bxattr_rtn_code retval = bxattr_rtn_ok;
 
    /*
     * First see if extended attributes or extensible attributes are present.
     * If not just pretend things went ok.
     */
    if (pathconf(jcr->last_fname, _PC_XATTR_EXISTS) > 0) {
-      jcr->xattr_data->u.build->nr_saved = 0;
+      jcr->xattr_ctx->nr_saved = 0;
 
       /*
        * As we change the cwd in the save function save the current cwd
@@ -3698,21 +3463,21 @@ static bxattr_exit_code solaris_build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
       getcwd(cwd, sizeof(cwd));
       retval = solaris_save_xattrs(jcr, NULL, NULL);
       chdir(cwd);
-      if (jcr->xattr_data->u.build->link_cache) {
+      if (jcr->xattr_ctx->link_cache) {
          drop_xattr_link_cache(jcr);
       }
    }
    return retval;
 }
 
-static bxattr_exit_code solaris_parse_xattr_streams(JCR *jcr,
+static bxattr_rtn_code solaris_restore_xattr_streams(JCR *jcr,
                                                     int stream,
                                                     char *content,
                                                     uint32_t content_length)
 {
    char cwd[PATH_MAX];
    bool is_extensible = false;
-   bxattr_exit_code retval = bxattr_exit_error;
+   bxattr_rtn_code retval = bxattr_rtn_error;
 
    /*
     * First make sure we can restore xattr on the filesystem.
@@ -3721,12 +3486,10 @@ static bxattr_exit_code solaris_parse_xattr_streams(JCR *jcr,
 #if defined(HAVE_SYS_NVPAIR_H) && defined(_PC_SATTR_ENABLED)
    case STREAM_XATTR_SOLARIS_SYS:
       if (pathconf(jcr->last_fname, _PC_SATTR_ENABLED) <= 0) {
-         Mmsg1(jcr->errmsg,
-         _("Failed to restore extensible attributes on file \"%s\"\n"),
-         jcr->last_fname);
-         Dmsg1(100, "Unable to restore extensible attributes on file \"%s\", filesystem doesn't support this\n",
-            jcr->last_fname);
-         goto bail_out;
+         Mmsg1(jcr->errmsg, _("Failed to restore extensible attributes on file \"%s\"\n"),
+               jcr->last_fname);
+         Dmsg1(100, "%s", jcr->errmsg);
+         goto get_out;
       }
 
       is_extensible = true;
@@ -3734,16 +3497,14 @@ static bxattr_exit_code solaris_parse_xattr_streams(JCR *jcr,
 #endif
    case STREAM_XATTR_SOLARIS:
       if (pathconf(jcr->last_fname, _PC_XATTR_ENABLED) <= 0) {
-         Mmsg1(jcr->errmsg,
-               _("Failed to restore extended attributes on file \"%s\"\n"),
+         Mmsg1(jcr->errmsg, _("Failed to restore extended attributes on file \"%s\"\n"),
                jcr->last_fname);
-         Dmsg1(100, "Unable to restore extended attributes on file \"%s\", filesystem doesn't support this\n",
-            jcr->last_fname);
-         goto bail_out;
+         Dmsg1(100, "%s", jcr->errmsg);
+         goto get_out;
       }
       break;
    default:
-      goto bail_out;
+      goto get_out;
    }
 
    /*
@@ -3754,55 +3515,80 @@ static bxattr_exit_code solaris_parse_xattr_streams(JCR *jcr,
    retval = solaris_restore_xattrs(jcr, is_extensible, content, content_length);
    chdir(cwd);
 
-bail_out:
+get_out:
    return retval;
 }
 
 
 /*
- * Function pointers to the build and parse function to use for these xattrs.
+ * Function pointers to the build and restore function to use for these xattrs.
  */
-static bxattr_exit_code (*os_build_xattr_streams)
+static bxattr_rtn_code (*os_backup_xattr_streams)
                         (JCR *jcr, FF_PKT *ff_pkt) =
-                        solaris_build_xattr_streams;
-static bxattr_exit_code (*os_parse_xattr_streams)
+                        solaris_backup_xattr_streams;
+static bxattr_rtn_code (*os_restore_xattr_streams)
                         (JCR *jcr, int stream, char *content, uint32_t content_length) =
-                        solaris_parse_xattr_streams;
+                        solaris_restore_xattr_streams;
 
 #endif /* defined(HAVE_SUN_OS) */
 
 /*
  * Entry points when compiled with support for XATTRs on a supported platform.
  */
-bxattr_exit_code build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
+bool backup_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
 {
+   bxattr_rtn_code rtn = bxattr_rtn_ok;
+
+   if (!(ff_pkt->flags & FO_XATTR && !ff_pkt->cmd_plugin)) {
+      return true;
+   }
+
+   jcr->errmsg[0] = 0;
+
    /*
     * See if we are changing from one device to an other.
     * We save the current device we are scanning and compare
     * it with the current st_dev in the last stat performed on
     * the file we are currently storing.
     */
-   if (jcr->xattr_data->current_dev != ff_pkt->statp.st_dev) {
+   if (jcr->xattr_ctx->current_dev != ff_pkt->statp.st_dev) {
       /*
        * Reset the acl save flags.
        */
-      jcr->xattr_data->flags = 0;
-      jcr->xattr_data->flags |= BXATTR_FLAG_SAVE_NATIVE;
+      jcr->xattr_ctx->flags = 0;
+      jcr->xattr_ctx->flags |= BXATTR_FLAG_SAVE_NATIVE;
 
       /*
        * Save that we started scanning a new filesystem.
        */
-      jcr->xattr_data->current_dev = ff_pkt->statp.st_dev;
+      jcr->xattr_ctx->current_dev = ff_pkt->statp.st_dev;
    }
 
-   if ((jcr->xattr_data->flags & BXATTR_FLAG_SAVE_NATIVE) && os_parse_xattr_streams) {
-      return os_build_xattr_streams(jcr, ff_pkt);
-   } else {
-      return bxattr_exit_ok;
+   if ((jcr->xattr_ctx->flags & BXATTR_FLAG_SAVE_NATIVE) && os_restore_xattr_streams) {
+      rtn = os_backup_xattr_streams(jcr, ff_pkt);
    }
+   switch (rtn) {
+   case bxattr_rtn_fatal:
+      return false;
+   case bxattr_rtn_ok:
+      return true;
+   case bxattr_rtn_error:
+      if (jcr->xattr_ctx->nr_errors < XATTR_MAX_ERROR_PRINT_PER_JOB) {
+         if (jcr->errmsg[0]) {
+            Jmsg(jcr, M_WARNING, 0, "Operating system XATTRs not configured.\n");
+         } else {
+            Jmsg(jcr, M_WARNING, 0, "%s", jcr->errmsg);
+         }
+         jcr->xattr_ctx->nr_errors++;
+      }
+      return true;
+   }
+   /* Theoretically we cannot get here */
+   return false;
+
 }
 
-bxattr_exit_code parse_xattr_streams(JCR *jcr,
+bxattr_rtn_code restore_xattr_streams(JCR *jcr,
                                      int stream,
                                      char *content,
                                      uint32_t content_length)
@@ -3810,7 +3596,7 @@ bxattr_exit_code parse_xattr_streams(JCR *jcr,
    int ret;
    struct stat st;
    unsigned int cnt;
-   bxattr_exit_code retval = bxattr_exit_error;
+   bxattr_rtn_code retval = bxattr_rtn_error;
 
    /*
     * See if we are changing from one device to an other.
@@ -3819,70 +3605,60 @@ bxattr_exit_code parse_xattr_streams(JCR *jcr,
     * the file we are currently restoring.
     */
    ret = lstat(jcr->last_fname, &st);
-   switch (ret) {
-   case -1: {
+   if (ret < 0) {
       berrno be;
-
-      switch (errno) {
-      case ENOENT:
-         retval = bxattr_exit_ok;
-         goto bail_out;
-      default:
-         Mmsg2(jcr->errmsg,
-               _("Unable to stat file \"%s\": ERR=%s\n"),
-               jcr->last_fname, be.bstrerror());
-         Dmsg2(100, "Unable to stat file \"%s\": ERR=%s\n",
+      if (errno == ENOENT) {
+         retval = bxattr_rtn_ok;
+      } else {
+         Mmsg2(jcr->errmsg, _("Unable to stat file \"%s\": ERR=%s\n"),
                jcr->last_fname, be.bstrerror());
-         goto bail_out;
+         Dmsg1(100, "%s", jcr->errmsg);
       }
-      break;
-   }
-   case 0:
-      break;
+      goto get_out;
    }
-   if (jcr->xattr_data->current_dev != st.st_dev) {
+   if (jcr->xattr_ctx->current_dev != st.st_dev) {
       /*
        * Reset the acl save flags.
        */
-      jcr->xattr_data->flags = 0;
-      jcr->xattr_data->flags |= BXATTR_FLAG_RESTORE_NATIVE;
+      jcr->xattr_ctx->flags = 0;
+      jcr->xattr_ctx->flags |= BXATTR_FLAG_RESTORE_NATIVE;
 
       /*
        * Save that we started restoring to a new filesystem.
        */
-      jcr->xattr_data->current_dev = st.st_dev;
+      jcr->xattr_ctx->current_dev = st.st_dev;
    }
 
    /*
     * See if we are still restoring native xattr to this filesystem.
     */
-   if ((jcr->xattr_data->flags & BXATTR_FLAG_RESTORE_NATIVE) && os_parse_xattr_streams) {
+   if ((jcr->xattr_ctx->flags & BXATTR_FLAG_RESTORE_NATIVE) && os_restore_xattr_streams) {
       /*
-       * See if we can parse this stream, and ifso give it a try.
+       * See if we can restore this stream, and ifso give it a try.
        */
       for (cnt = 0; cnt < sizeof(os_default_xattr_streams) / sizeof(int); cnt++) {
          if (os_default_xattr_streams[cnt] == stream) {
-            retval = os_parse_xattr_streams(jcr, stream, content, content_length);
-            goto bail_out;
+            retval = os_restore_xattr_streams(jcr, stream, content, content_length);
+            goto get_out;
          }
       }
    } else {
       /*
        * Increment error count but don't log an error again for the same filesystem.
        */
-      jcr->xattr_data->u.parse->nr_errors++;
-      retval = bxattr_exit_ok;
-      goto bail_out;
+      jcr->xattr_ctx->nr_errors++;
+      retval = bxattr_rtn_ok;
+      goto get_out;
    }
 
    /*
     * Issue a warning and discard the message. But pretend the restore was ok.
     */
    Jmsg2(jcr, M_WARNING, 0,
-         _("Can't restore Extended Attributes of %s - incompatible xattr stream encountered - %d\n"),
+         _("Cannot restore Extended Attributes of %s - incompatible xattr stream encountered - %d\n"),
          jcr->last_fname, stream);
 
-bail_out:
+get_out:
    return retval;
 }
 #endif
diff --git a/src/filed/xattr.h b/src/filed/xattr.h
index 131e6c6..b2bbe23 100644
--- a/src/filed/xattr.h
+++ b/src/filed/xattr.h
@@ -1,21 +1,25 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2004-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 
-#ifndef __XATTR_H
-#define __XATTR_H
+#ifndef __BXATTR_H_
+#define __BXATTR_H_
 
 #if defined(HAVE_LINUX_OS)
 #define BXATTR_ENOTSUP EOPNOTSUPP
@@ -53,38 +57,21 @@ struct xattr_link_cache_entry_t {
 #define BXATTR_FLAG_SAVE_NATIVE    0x01
 #define BXATTR_FLAG_RESTORE_NATIVE 0x02
 
-struct xattr_build_data_t {
-   uint32_t nr_errors;
-   uint32_t nr_saved;
-   POOLMEM *content;
-   uint32_t content_length;
-   alist *link_cache;
-};
-
-struct xattr_parse_data_t {
-   uint32_t nr_errors;
-};
-
 /*
  * Internal tracking data.
  */
-struct xattr_data_t {
+struct xattr_ctx_t {
    uint32_t flags;              /* See BXATTR_FLAG_* */
    uint32_t current_dev;
-   union {
-      struct xattr_build_data_t *build;
-      struct xattr_parse_data_t *parse;
-   } u;
+   uint32_t nr_errors;
+   uint32_t nr_saved;
+   POOLMEM *content;
+   uint32_t content_length;
+   alist *link_cache;
 };
 
-/*
- * Maximum size of the XATTR stream this prevents us from blowing up the filed.
- */
-#define MAX_XATTR_STREAM  (1 * 1024 * 1024) /* 1 Mb */
+#define MAX_XATTR_LENGTH  (1 * 1024 * 1024) /* 1 Mb */
 
-/*
- * Upperlimit on a xattr internal buffer
- */
-#define XATTR_BUFSIZ	1024
+#define XATTR_BUFSIZ    1024
 
-#endif
+#endif /* __BXATTR_H_ */
diff --git a/src/fileopts.h b/src/fileopts.h
index 5b3e87b..0dee792 100644
--- a/src/fileopts.h
+++ b/src/fileopts.h
@@ -1,20 +1,24 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
- * File types
+ * File types 
  *
  *     Kern Sibbald MMI
  *
@@ -25,7 +29,7 @@
 #ifndef __BFILEOPTS_H
 #define __BFILEOPTS_H
 
-/*
+/*  
  * Options saved int "options" of the include/exclude lists.
  * They are directly jammed ito  "flag" of ff packet
  */
diff --git a/src/filetypes.h b/src/filetypes.h
index 9d50586..96ef11e 100644
--- a/src/filetypes.h
+++ b/src/filetypes.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /**
  * Stream definitions.  Split from baconfig.h Nov 2010
@@ -51,7 +55,7 @@
 #define FT_NOOPEN    15               /* Could not open directory */
 #define FT_RAW       16               /* Raw block device */
 #define FT_FIFO      17               /* Raw fifo device */
-/**
+/** 
  * The DIRBEGIN packet is sent to the FD file processing routine so
  * that it can filter packets, but otherwise, it is not used
  * or saved */
diff --git a/src/findlib/Makefile.in b/src/findlib/Makefile.in
index cd3c2a3..7370881 100644
--- a/src/findlib/Makefile.in
+++ b/src/findlib/Makefile.in
@@ -1,4 +1,7 @@
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 #  Find files library Makefile
 #
 @MCOMMON@
@@ -22,11 +25,12 @@ dummy:
 #
 # include files installed when using libtool
 #
-INCLUDE_FILES = bfile.h find.h protos.h 
+INCLUDE_FILES = bfile.h find.h protos.h
 
 #
-LIBBACFIND_SRCS = find.c match.c find_one.c file_attrs.c file_create.c \
-		  bfile.c drivetype.c priv.c fstype.c makepath.c
+LIBBACFIND_SRCS = find.c match.c find_one.c attribs.c create_file.c \
+		  bfile.c drivetype.c enable_priv.c fstype.c mkpath.c \
+		  savecwd.c
 LIBBACFIND_OBJS = $(LIBBACFIND_SRCS:.c=.o)
 LIBBACFIND_LOBJS = $(LIBBACFIND_SRCS:.c=.lo)
 
@@ -49,12 +53,12 @@ all: Makefile libbacfind$(DEFAULT_ARCHIVE_TYPE) ../lib/libbac$(DEFAULT_ARCHIVE_T
 	@echo "==== Make of findlib is good ===="
 	@echo " "
 
-libbacfind.a: $(LIBBACFIND_OBJS) 
+libbacfind.a: $(LIBBACFIND_OBJS)
 	@echo "Making $@ ..."
 	$(AR) rc  $@ $(LIBBACFIND_OBJS)
 	$(RANLIB) $@
 
-libbacfind.la: Makefile $(LIBBACFIND_LOBJS) 
+libbacfind.la: Makefile $(LIBBACFIND_LOBJS)
 	@echo "Making $@ ..."
 	$(LIBTOOL_LINK) $(CXX) $(DEFS) $(DEBUG) $(LDFLAGS) -o $@ $(LIBBACFIND_LOBJS) -export-dynamic -rpath $(libdir) -release $(LIBBACFIND_LT_RELEASE)
 
diff --git a/src/findlib/file_attrs.c b/src/findlib/attribs.c
similarity index 88%
rename from src/findlib/file_attrs.c
rename to src/findlib/attribs.c
index 9268ce1..5c8f518 100644
--- a/src/findlib/file_attrs.c
+++ b/src/findlib/attribs.c
@@ -1,31 +1,23 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2002-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from
-   many others, a complete list can be found in the file AUTHORS.
-   This program is Free Software; you can redistribute it and/or
-   modify it under the terms of version three of the GNU Affero General Public
-   License as published by the Free Software Foundation and included
-   in the file LICENSE.
-
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU Affero General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-   02110-1301, USA.
-
-   Bacula® is a registered trademark of Kern Sibbald.
-   The licensor of Bacula is the Free Software Foundation Europe
-   (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
-   Switzerland, email:ftf at fsfeurope.org.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
+
+   You may use this file and others of this release according to the
+   license defined in the LICENSE file, which includes the Affero General
+   Public License, v3.0 ("AGPLv3") and some additional permissions and
+   terms pursuant to its AGPLv3 Section 7.
+
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
-/**
+/*
  *  Encode and decode standard Unix attributes and
  *   Extended attributes for Win32 and
  *   other non-Unix systems, or Unix systems with ACLs, ...
@@ -97,6 +89,7 @@ bool set_mod_own_time(JCR *jcr, BFILE *ofd, ATTR *attr)
             attr->ofname, be.bstrerror());
          ok = false;
       }
+
 #ifdef HAVE_FCHMOD
       if (fchmod(ofd->fid, attr->statp.st_mode) < 0 && print_error) {
 #else
@@ -168,15 +161,15 @@ int select_data_stream(FF_PKT *ff_pkt)
       return STREAM_FILE_DATA;
    }
 
-   /**
+   /*
     *  Fix all incompatible options
     */
-   /** No sparse option for encrypted data */
+   /* No sparse option for encrypted data */
    if (ff_pkt->flags & FO_ENCRYPT) {
       ff_pkt->flags &= ~FO_SPARSE;
    }
 
-   /** Note, no sparse option for win32_data */
+   /* Note, no sparse option for win32_data */
    if (!is_portable_backup(&ff_pkt->bfd)) {
       stream = STREAM_WIN32_DATA;
       ff_pkt->flags &= ~FO_SPARSE;
@@ -189,18 +182,18 @@ int select_data_stream(FF_PKT *ff_pkt)
       stream = STREAM_SPARSE_DATA;
    }
 
-   /** Encryption is only supported for file data */
+   /* Encryption is only supported for file data */
    if (stream != STREAM_FILE_DATA && stream != STREAM_WIN32_DATA &&
          stream != STREAM_MACOS_FORK_DATA) {
       ff_pkt->flags &= ~FO_ENCRYPT;
    }
 
-   /** Compression is not supported for Mac fork data */
+   /* Compression is not supported for Mac fork data */
    if (stream == STREAM_MACOS_FORK_DATA) {
       ff_pkt->flags &= ~FO_COMPRESS;
    }
 
-   /**
+   /*
     * Handle compression and encryption options
     */
 #if defined(HAVE_LIBZ) || defined(HAVE_LZO)
@@ -218,7 +211,7 @@ int select_data_stream(FF_PKT *ff_pkt)
                   stream = STREAM_GZIP_DATA;
                break;
             default:
-               /**
+               /*
                 * All stream types that do not support compression should clear out
                 * FO_COMPRESS above, and this code block should be unreachable.
                 */
@@ -240,7 +233,7 @@ int select_data_stream(FF_PKT *ff_pkt)
                   stream = STREAM_COMPRESSED_DATA;
                break;
             default:
-               /**
+               /*
                 * All stream types that do not support compression should clear out
                 * FO_COMPRESS above, and this code block should be unreachable.
                 */
@@ -285,7 +278,7 @@ int select_data_stream(FF_PKT *ff_pkt)
 }
 
 
-/**
+/*
  * Encode a stat structure into a base64 character string
  *   All systems must create such a structure.
  *   In addition, we tack on the LinkFI, which is non-zero in
@@ -299,7 +292,6 @@ int select_data_stream(FF_PKT *ff_pkt)
 void encode_stat(char *buf, struct stat *statp, int stat_size, int32_t LinkFI, int data_stream)
 {
    char *p = buf;
-
    /*
     * We read the stat packet so make sure the caller's conception
     *  is the same as ours.  They can be different if LARGEFILE is not
@@ -307,44 +299,44 @@ void encode_stat(char *buf, struct stat *statp, int stat_size, int32_t LinkFI, i
     */
    ASSERT(stat_size == (int)sizeof(struct stat));
 
-   /**
+   /*
     *  Encode a stat packet.  I should have done this more intelligently
     *   with a length so that it could be easily expanded.
     */
-   p += to_base64((int64_t)statp->st_dev, p);
+    p += to_base64((int64_t)statp->st_dev, p);
    *p++ = ' ';                        /* separate fields with a space */
-   p += to_base64((int64_t)statp->st_ino, p);
+    p += to_base64((int64_t)statp->st_ino, p);
    *p++ = ' ';
-   p += to_base64((int64_t)statp->st_mode, p);
+    p += to_base64((int64_t)statp->st_mode, p);
    *p++ = ' ';
-   p += to_base64((int64_t)statp->st_nlink, p);
+    p += to_base64((int64_t)statp->st_nlink, p);
    *p++ = ' ';
-   p += to_base64((int64_t)statp->st_uid, p);
+    p += to_base64((int64_t)statp->st_uid, p);
    *p++ = ' ';
-   p += to_base64((int64_t)statp->st_gid, p);
+    p += to_base64((int64_t)statp->st_gid, p);
    *p++ = ' ';
-   p += to_base64((int64_t)statp->st_rdev, p);
+    p += to_base64((int64_t)statp->st_rdev, p);
    *p++ = ' ';
-   p += to_base64((int64_t)statp->st_size, p);
+    p += to_base64((int64_t)statp->st_size, p);
    *p++ = ' ';
 #ifndef HAVE_MINGW
-   p += to_base64((int64_t)statp->st_blksize, p);
+    p += to_base64((int64_t)statp->st_blksize, p);
    *p++ = ' ';
-   p += to_base64((int64_t)statp->st_blocks, p);
+    p += to_base64((int64_t)statp->st_blocks, p);
    *p++ = ' ';
 #else
-   p += to_base64((int64_t)0, p); /* output place holder */
+    p += to_base64((int64_t)0, p); /* output place holder */
    *p++ = ' ';
-   p += to_base64((int64_t)0, p); /* output place holder */
+    p += to_base64((int64_t)0, p); /* output place holder */
    *p++ = ' ';
 #endif
-   p += to_base64((int64_t)statp->st_atime, p);
+    p += to_base64((int64_t)statp->st_atime, p);
    *p++ = ' ';
-   p += to_base64((int64_t)statp->st_mtime, p);
+    p += to_base64((int64_t)statp->st_mtime, p);
    *p++ = ' ';
    p += to_base64((int64_t)statp->st_ctime, p);
    *p++ = ' ';
-   p += to_base64((int64_t)LinkFI, p);
+    p += to_base64((int64_t)LinkFI, p);
    *p++ = ' ';
 
 #ifdef HAVE_CHFLAGS
@@ -488,7 +480,7 @@ int decode_stat(char *buf, struct stat *statp, int stat_size, int32_t *LinkFI)
    return data_stream;
 }
 
-/** Decode a LinkFI field of encoded stat packet */
+/* Decode a LinkFI field of encoded stat packet */
 int32_t decode_LinkFI(char *buf, struct stat *statp, int stat_size)
 {
    char *p = buf;
@@ -536,7 +528,7 @@ int32_t decode_LinkFI(char *buf, struct stat *statp, int stat_size)
    return 0;
 }
 
-/**
+/*
  * Set file modes, permissions and times
  *
  *  fname is the original filename
@@ -583,7 +575,7 @@ bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd)
     *   try to do a chmod as that will update the file behind it.
     */
    if (attr->type == FT_LNK) {
-      /** Change owner of link, not of real file */
+      /* Change owner of link, not of real file */
       if (lchown(attr->ofname, attr->statp.st_uid, attr->statp.st_gid) < 0 && print_error) {
          berrno be;
          Jmsg2(jcr, M_ERROR, 0, _("Unable to set file owner %s: ERR=%s\n"),
@@ -597,7 +589,7 @@ bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd)
       ok = set_mod_own_time(jcr, ofd, attr);
 
 #ifdef HAVE_CHFLAGS
-      /**
+      /*
        * FreeBSD user flags
        *
        * Note, this should really be done before the utime() above,
@@ -629,9 +621,9 @@ bail_out:
 /*                                                             */
 /*=============================================================*/
 
-#if !defined(HAVE_WIN32)
+#ifndef HAVE_WIN32
 
-/**
+/*
  * It is possible to piggyback additional data e.g. ACLs on
  *   the encode_stat() data by returning the extended attributes
  *   here.  They must be "self-contained" (i.e. you keep track
@@ -643,7 +635,7 @@ bail_out:
 int encode_attribsEx(JCR *jcr, char *attribsEx, FF_PKT *ff_pkt)
 {
 #ifdef HAVE_DARWIN_OS
-   /**
+   /*
     * We save the Mac resource fork length so that on a
     * restore, we can be sure we put back the whole resource.
     */
@@ -665,3 +657,4 @@ int encode_attribsEx(JCR *jcr, char *attribsEx, FF_PKT *ff_pkt)
 }
 
 #endif
+
diff --git a/src/findlib/bfile.c b/src/findlib/bfile.c
index 663e932..92d6286 100644
--- a/src/findlib/bfile.c
+++ b/src/findlib/bfile.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2003-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *  Bacula low level File I/O routines.  This routine simulates
@@ -81,136 +85,136 @@ const char *stream_to_ascii(int stream)
    static char buf[20];
 
    switch (stream & STREAMMASK_TYPE) {
-   case STREAM_UNIX_ATTRIBUTES:
-      return _("Unix attributes");
-   case STREAM_FILE_DATA:
-      return _("File data");
-   case STREAM_MD5_DIGEST:
-      return _("MD5 digest");
-   case STREAM_GZIP_DATA:
-      return _("GZIP data");
-   case STREAM_COMPRESSED_DATA:
-      return _("Compressed data");
-   case STREAM_UNIX_ATTRIBUTES_EX:
-      return _("Extended attributes");
-   case STREAM_SPARSE_DATA:
-      return _("Sparse data");
-   case STREAM_SPARSE_GZIP_DATA:
-      return _("GZIP sparse data");
-   case STREAM_SPARSE_COMPRESSED_DATA:
-      return _("Compressed sparse data");
-   case STREAM_PROGRAM_NAMES:
-      return _("Program names");
-   case STREAM_PROGRAM_DATA:
-      return _("Program data");
-   case STREAM_SHA1_DIGEST:
-      return _("SHA1 digest");
-   case STREAM_WIN32_DATA:
-      return _("Win32 data");
-   case STREAM_WIN32_GZIP_DATA:
-      return _("Win32 GZIP data");
-   case STREAM_WIN32_COMPRESSED_DATA:
-      return _("Win32 compressed data");
-   case STREAM_MACOS_FORK_DATA:
-      return _("MacOS Fork data");
-   case STREAM_HFSPLUS_ATTRIBUTES:
-      return _("HFS+ attribs");
-   case STREAM_UNIX_ACCESS_ACL:
-      return _("Standard Unix ACL attribs");
-   case STREAM_UNIX_DEFAULT_ACL:
-      return _("Default Unix ACL attribs");
-   case STREAM_SHA256_DIGEST:
-      return _("SHA256 digest");
-   case STREAM_SHA512_DIGEST:
-      return _("SHA512 digest");
-   case STREAM_SIGNED_DIGEST:
-      return _("Signed digest");
-   case STREAM_ENCRYPTED_FILE_DATA:
-      return _("Encrypted File data");
-   case STREAM_ENCRYPTED_WIN32_DATA:
-      return _("Encrypted Win32 data");
-   case STREAM_ENCRYPTED_SESSION_DATA:
-      return _("Encrypted session data");
-   case STREAM_ENCRYPTED_FILE_GZIP_DATA:
-      return _("Encrypted GZIP data");
-   case STREAM_ENCRYPTED_FILE_COMPRESSED_DATA:
-      return _("Encrypted compressed data");
-   case STREAM_ENCRYPTED_WIN32_GZIP_DATA:
-      return _("Encrypted Win32 GZIP data");
-   case STREAM_ENCRYPTED_WIN32_COMPRESSED_DATA:
-      return _("Encrypted Win32 Compressed data");
-   case STREAM_ENCRYPTED_MACOS_FORK_DATA:
-      return _("Encrypted MacOS fork data");
-   case STREAM_PLUGIN_NAME:
-      return _("Plugin Name");
-   case STREAM_PLUGIN_DATA:
-      return _("Plugin Data");
-   case STREAM_RESTORE_OBJECT:
-      return _("Restore Object");
-   case STREAM_ACL_AIX_TEXT:
-      return _("AIX Specific ACL attribs");
-   case STREAM_ACL_DARWIN_ACCESS_ACL:
-      return _("Darwin Specific ACL attribs");
-   case STREAM_ACL_FREEBSD_DEFAULT_ACL:
-      return _("FreeBSD Specific Default ACL attribs");
-   case STREAM_ACL_FREEBSD_ACCESS_ACL:
-      return _("FreeBSD Specific Access ACL attribs");
-   case STREAM_ACL_HPUX_ACL_ENTRY:
-      return _("HPUX Specific ACL attribs");
-   case STREAM_ACL_IRIX_DEFAULT_ACL:
-      return _("Irix Specific Default ACL attribs");
-   case STREAM_ACL_IRIX_ACCESS_ACL:
-      return _("Irix Specific Access ACL attribs");
-   case STREAM_ACL_LINUX_DEFAULT_ACL:
-      return _("Linux Specific Default ACL attribs");
-   case STREAM_ACL_LINUX_ACCESS_ACL:
-      return _("Linux Specific Access ACL attribs");
-   case STREAM_ACL_TRU64_DEFAULT_ACL:
-      return _("TRU64 Specific Default ACL attribs");
-   case STREAM_ACL_TRU64_ACCESS_ACL:
-      return _("TRU64 Specific Access ACL attribs");
-   case STREAM_ACL_SOLARIS_ACLENT:
-      return _("Solaris Specific POSIX ACL attribs");
-   case STREAM_ACL_SOLARIS_ACE:
-      return _("Solaris Specific NFSv4/ZFS ACL attribs");
-   case STREAM_ACL_AFS_TEXT:
-      return _("AFS Specific ACL attribs");
-   case STREAM_ACL_AIX_AIXC:
-      return _("AIX Specific POSIX ACL attribs");
-   case STREAM_ACL_AIX_NFS4:
-      return _("AIX Specific NFSv4 ACL attribs");
-   case STREAM_ACL_FREEBSD_NFS4_ACL:
-      return _("FreeBSD Specific NFSv4/ZFS ACL attribs");
-   case STREAM_ACL_HURD_DEFAULT_ACL:
-      return _("GNU Hurd Specific Default ACL attribs");
-   case STREAM_ACL_HURD_ACCESS_ACL:
-      return _("GNU Hurd Specific Access ACL attribs");
-   case STREAM_XATTR_HURD:
-      return _("GNU Hurd Specific Extended attribs");
-   case STREAM_XATTR_IRIX:
-      return _("IRIX Specific Extended attribs");
-   case STREAM_XATTR_TRU64:
-      return _("TRU64 Specific Extended attribs");
-   case STREAM_XATTR_AIX:
-      return _("AIX Specific Extended attribs");
-   case STREAM_XATTR_OPENBSD:
-      return _("OpenBSD Specific Extended attribs");
-   case STREAM_XATTR_SOLARIS_SYS:
-      return _("Solaris Specific Extensible attribs or System Extended attribs");
-   case STREAM_XATTR_SOLARIS:
-      return _("Solaris Specific Extended attribs");
-   case STREAM_XATTR_DARWIN:
-      return _("Darwin Specific Extended attribs");
-   case STREAM_XATTR_FREEBSD:
-      return _("FreeBSD Specific Extended attribs");
-   case STREAM_XATTR_LINUX:
-      return _("Linux Specific Extended attribs");
-   case STREAM_XATTR_NETBSD:
-      return _("NetBSD Specific Extended attribs");
-   default:
-      sprintf(buf, "%d", stream);
-      return (const char *)buf;
-   }
+      case STREAM_UNIX_ATTRIBUTES:
+         return _("Unix attributes");
+      case STREAM_FILE_DATA:
+         return _("File data");
+      case STREAM_MD5_DIGEST:
+         return _("MD5 digest");
+      case STREAM_GZIP_DATA:
+         return _("GZIP data");
+      case STREAM_COMPRESSED_DATA:
+         return _("Compressed data");
+      case STREAM_UNIX_ATTRIBUTES_EX:
+         return _("Extended attributes");
+      case STREAM_SPARSE_DATA:
+         return _("Sparse data");
+      case STREAM_SPARSE_GZIP_DATA:
+         return _("GZIP sparse data");
+      case STREAM_SPARSE_COMPRESSED_DATA:
+         return _("Compressed sparse data");
+      case STREAM_PROGRAM_NAMES:
+         return _("Program names");
+      case STREAM_PROGRAM_DATA:
+         return _("Program data");
+      case STREAM_SHA1_DIGEST:
+         return _("SHA1 digest");
+      case STREAM_WIN32_DATA:
+         return _("Win32 data");
+      case STREAM_WIN32_GZIP_DATA:
+         return _("Win32 GZIP data");
+      case STREAM_WIN32_COMPRESSED_DATA:
+         return _("Win32 compressed data");
+      case STREAM_MACOS_FORK_DATA:
+         return _("MacOS Fork data");
+      case STREAM_HFSPLUS_ATTRIBUTES:
+         return _("HFS+ attribs");
+      case STREAM_UNIX_ACCESS_ACL:
+         return _("Standard Unix ACL attribs");
+      case STREAM_UNIX_DEFAULT_ACL:
+         return _("Default Unix ACL attribs");
+      case STREAM_SHA256_DIGEST:
+         return _("SHA256 digest");
+      case STREAM_SHA512_DIGEST:
+         return _("SHA512 digest");
+      case STREAM_SIGNED_DIGEST:
+         return _("Signed digest");
+      case STREAM_ENCRYPTED_FILE_DATA:
+         return _("Encrypted File data");
+      case STREAM_ENCRYPTED_WIN32_DATA:
+         return _("Encrypted Win32 data");
+      case STREAM_ENCRYPTED_SESSION_DATA:
+         return _("Encrypted session data");
+      case STREAM_ENCRYPTED_FILE_GZIP_DATA:
+         return _("Encrypted GZIP data");
+      case STREAM_ENCRYPTED_FILE_COMPRESSED_DATA:
+         return _("Encrypted compressed data");
+      case STREAM_ENCRYPTED_WIN32_GZIP_DATA:
+         return _("Encrypted Win32 GZIP data");
+      case STREAM_ENCRYPTED_WIN32_COMPRESSED_DATA:
+         return _("Encrypted Win32 Compressed data");
+      case STREAM_ENCRYPTED_MACOS_FORK_DATA:
+         return _("Encrypted MacOS fork data");
+      case STREAM_PLUGIN_NAME:
+         return _("Plugin Name");
+      case STREAM_PLUGIN_DATA:
+         return _("Plugin Data");
+      case STREAM_RESTORE_OBJECT:
+         return _("Restore Object");
+      case STREAM_ACL_AIX_TEXT:
+         return _("AIX ACL attribs");
+      case STREAM_ACL_DARWIN_ACCESS:
+         return _("Darwin ACL attribs");
+      case STREAM_ACL_FREEBSD_DEFAULT:
+         return _("FreeBSD Default ACL attribs");
+      case STREAM_ACL_FREEBSD_ACCESS:
+         return _("FreeBSD Access ACL attribs");
+      case STREAM_ACL_HPUX_ACL_ENTRY:
+         return _("HPUX ACL attribs");
+      case STREAM_ACL_IRIX_DEFAULT:
+         return _("Irix Default ACL attribs");
+      case STREAM_ACL_IRIX_ACCESS:
+         return _("Irix Access ACL attribs");
+      case STREAM_ACL_LINUX_DEFAULT:
+         return _("Linux Default ACL attribs");
+      case STREAM_ACL_LINUX_ACCESS:
+         return _("Linux Access ACL attribs");
+      case STREAM_ACL_TRU64_DEFAULT:
+         return _("TRU64 Default ACL attribs");
+      case STREAM_ACL_TRU64_ACCESS:
+         return _("TRU64 Access ACL attribs");
+      case STREAM_ACL_SOLARIS_POSIX:
+         return _("Solaris POSIX ACL attribs");
+      case STREAM_ACL_SOLARIS_NFS4:
+         return _("Solaris NFSv4/ZFS ACL attribs");
+      case STREAM_ACL_AFS_TEXT:
+         return _("AFS ACL attribs");
+      case STREAM_ACL_AIX_AIXC:
+         return _("AIX POSIX ACL attribs");
+      case STREAM_ACL_AIX_NFS4:
+         return _("AIX NFSv4 ACL attribs");
+      case STREAM_ACL_FREEBSD_NFS4:
+         return _("FreeBSD NFSv4/ZFS ACL attribs");
+      case STREAM_ACL_HURD_DEFAULT:
+         return _("GNU Hurd Default ACL attribs");
+      case STREAM_ACL_HURD_ACCESS:
+         return _("GNU Hurd Access ACL attribs");
+      case STREAM_XATTR_HURD:
+         return _("GNU Hurd Extended attribs");
+      case STREAM_XATTR_IRIX:
+         return _("IRIX Extended attribs");
+      case STREAM_XATTR_TRU64:
+         return _("TRU64 Extended attribs");
+      case STREAM_XATTR_AIX:
+         return _("AIX Extended attribs");
+      case STREAM_XATTR_OPENBSD:
+         return _("OpenBSD Extended attribs");
+      case STREAM_XATTR_SOLARIS_SYS:
+         return _("Solaris Extensible attribs or System Extended attribs");
+      case STREAM_XATTR_SOLARIS:
+         return _("Solaris Extended attribs");
+      case STREAM_XATTR_DARWIN:
+         return _("Darwin Extended attribs");
+      case STREAM_XATTR_FREEBSD:
+         return _("FreeBSD Extended attribs");
+      case STREAM_XATTR_LINUX:
+         return _("Linux Extended attribs");
+      case STREAM_XATTR_NETBSD:
+         return _("NetBSD Extended attribs");
+      default:
+         sprintf(buf, "%d", stream);
+         return (const char *)buf;
+      }
 }
 
 /**
@@ -254,7 +258,7 @@ void int32_LE2BE(int32_t* pBE, const int32_t v)
 }
 
 
-/*
+/**
  *  Read a BackupRead block and pull out the file data
  */
 bool processWin32BackupAPIBlock (BFILE *bfd, void *pBuffer, ssize_t dwSize)
@@ -555,12 +559,12 @@ int bopen_rsrc(BFILE *bfd, const char *fname, uint64_t flags, mode_t mode)
    free_pool_memory(rsrc_fname);
    return bfd->fid;
 }
-#else
+#else /* Unix */
+
 /* Unix */
 int bopen_rsrc(BFILE *bfd, const char *fname, uint64_t flags, mode_t mode)
-{
-   return -1;
-}
+    { return -1; }
+
 #endif
 
 
@@ -569,7 +573,7 @@ int bclose(BFILE *bfd)
 {
    int stat;
 
-   Dmsg1(400, "Close file %d\n", bfd->fid);
+   Dmsg2(400, "Close bfd=%p file %d\n", bfd, bfd->fid);
 
    if (bfd->fid == -1) {
       return 0;
@@ -649,3 +653,4 @@ boffset_t blseek(BFILE *bfd, boffset_t offset, int whence)
    bfd->berrno = errno;
    return pos;
 }
+
diff --git a/src/findlib/bfile.h b/src/findlib/bfile.h
index e1b543a..d0797ae 100644
--- a/src/findlib/bfile.h
+++ b/src/findlib/bfile.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2003-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *  Bacula low level File I/O routines.  This routine simulates
@@ -52,7 +56,7 @@ typedef struct _PROCESS_WIN32_BACKUPAPIBLOCK_CONTEXT {
  *
  *  =======================================================
  */
-#if defined(HAVE_WIN32)
+#ifdef HAVE_WIN32
 
 enum {
    BF_CLOSED,
@@ -63,7 +67,8 @@ enum {
 /* In bfile.c */
 
 /* Basic Win32 low level I/O file packet */
-struct BFILE {
+class BFILE {
+public:
    bool use_backup_api;               /* set if using BackupRead/Write */
    int mode;                          /* set if file is open */
    HANDLE fh;                         /* Win32 file handle */
@@ -72,6 +77,7 @@ struct BFILE {
    POOLMEM *errmsg;                   /* error message buffer */
    DWORD rw_bytes;                    /* Bytes read or written */
    DWORD lerror;                      /* Last error code */
+   DWORD fattrs;                      /* Windows file attributes */
    int berrno;                        /* errno */
    int block;                         /* Count of read/writes */
    uint64_t total_bytes;              /* bytes written */
@@ -81,10 +87,16 @@ struct BFILE {
    int use_backup_decomp;             /* set if using BackupRead Stream Decomposition */
    bool reparse_point;                /* set if reparse point */
    bool cmd_plugin;                   /* set if we have a command plugin */
+   bool const is_encrypted() const;
 };
 
+/* Windows encrypted file system */
+inline const bool BFILE::is_encrypted() const
+  { return (fattrs & FILE_ATTRIBUTE_ENCRYPTED) != 0; };
+
 HANDLE bget_handle(BFILE *bfd);
 
+
 #else   /* Linux/Unix systems */
 
 /*  =======================================================
@@ -114,6 +126,11 @@ struct BFILE {
 
 void    binit(BFILE *bfd);
 bool    is_bopen(BFILE *bfd);
+#ifdef HAVE_WIN32
+void    set_fattrs(BFILE *bfd, struct stat *statp);
+#else
+#define set_fattrs(bfd, fattrs)
+#endif
 bool    set_win32_backup(BFILE *bfd);
 bool    set_portable_backup(BFILE *bfd);
 bool    set_cmd_plugin(BFILE *bfd, JCR *jcr);
diff --git a/src/findlib/file_create.c b/src/findlib/create_file.c
similarity index 88%
rename from src/findlib/file_create.c
rename to src/findlib/create_file.c
index 0abb200..0641b69 100644
--- a/src/findlib/file_create.c
+++ b/src/findlib/create_file.c
@@ -1,29 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from
-   many others, a complete list can be found in the file AUTHORS.
-   This program is Free Software; you can redistribute it and/or
-   modify it under the terms of version three of the GNU Affero General Public
-   License as published by the Free Software Foundation and included
-   in the file LICENSE.
-
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU Affero General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-   02110-1301, USA.
-
-   Bacula® is a registered trademark of Kern Sibbald.
-   The licensor of Bacula is the Free Software Foundation Europe
-   (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
-   Switzerland, email:ftf at fsfeurope.org.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
+
+   You may use this file and others of this release according to the
+   license defined in the LICENSE file, which includes the Affero General
+   Public License, v3.0 ("AGPLv3") and some additional permissions and
+   terms pursuant to its AGPLv3 Section 7.
+
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *  Create a file, and reset the modes
@@ -85,7 +77,11 @@ int create_file(JCR *jcr, ATTR *attr, BFILE *bfd, int replace)
    struct stat mstatp;
 
    bfd->reparse_point = false;
-   set_portable_backup(bfd);
+   if (is_win32_stream(attr->data_stream)) {
+      set_win32_backup(bfd);
+   } else {
+      set_portable_backup(bfd);
+   }
 
    new_mode = attr->statp.st_mode;
    Dmsg3(200, "type=%d newmode=%x file=%s\n", attr->type, new_mode, attr->ofname);
@@ -93,6 +89,29 @@ int create_file(JCR *jcr, ATTR *attr, BFILE *bfd, int replace)
    gid = attr->statp.st_gid;
    uid = attr->statp.st_uid;
 
+#ifdef HAVE_WIN32
+   if (!bfd->use_backup_api) {
+      // eliminate invalid windows filename characters from foreign filenames
+      char *ch = (char *)attr->ofname;
+      if (ch[0] != 0 && ch[1] != 0) {
+         ch += 2;
+         while (*ch) {
+            switch (*ch) {
+            case ':':
+            case '<':
+            case '>':
+            case '*':
+            case '?':
+            case '|':
+               *ch = '_';
+                break;
+            }
+            ch++;
+         }
+      }
+   }
+#endif
+
    Dmsg2(400, "Replace=%c %d\n", (char)replace, replace);
    if (lstat(attr->ofname, &mstatp) == 0) {
       exists = true;
@@ -197,7 +216,7 @@ int create_file(JCR *jcr, ATTR *attr, BFILE *bfd, int replace)
             bclose(bfd);
          }
 
-
+         set_fattrs(bfd, &attr->statp);
          if ((bopen(bfd, attr->ofname, flags, S_IRUSR | S_IWUSR)) < 0) {
             berrno be;
             be.set_errno(bfd->berrno);
@@ -208,6 +227,7 @@ int create_file(JCR *jcr, ATTR *attr, BFILE *bfd, int replace)
          }
          return CF_EXTRACT;
 
+#ifndef HAVE_WIN32  // none of these exist in MS Windows
       case FT_RAW:                    /* Bacula raw device e.g. /dev/sda1 */
       case FT_FIFO:                   /* Bacula fifo to save data */
       case FT_SPEC:
@@ -259,6 +279,7 @@ int create_file(JCR *jcr, ATTR *attr, BFILE *bfd, int replace)
                Qmsg1(jcr, M_ERROR, 0, _("bpkt already open fid=%d\n"), bfd->fid);
             }
             Dmsg2(400, "open %s flags=0x%x\n", attr->ofname, flags);
+            set_fattrs(bfd, &attr->statp);
             if ((bopen(bfd, attr->ofname, flags, 0)) < 0) {
                berrno be;
                be.set_errno(bfd->berrno);
@@ -330,6 +351,7 @@ int create_file(JCR *jcr, ATTR *attr, BFILE *bfd, int replace)
 
          }
          return CF_CREATED;
+#endif
       } /* End inner switch */
 
    case FT_REPARSE:
@@ -351,9 +373,18 @@ int create_file(JCR *jcr, ATTR *attr, BFILE *bfd, int replace)
          if (is_bopen(bfd)) {
             Qmsg1(jcr, M_ERROR, 0, _("bpkt already open fid=%d\n"), bfd->fid);
          }
+         set_fattrs(bfd, &attr->statp);
          if ((bopen(bfd, attr->ofname, O_WRONLY|O_BINARY, 0)) < 0) {
             berrno be;
             be.set_errno(bfd->berrno);
+#ifdef HAVE_WIN32
+            /* Check for trying to create a drive, if so, skip */
+            if (attr->ofname[1] == ':' &&
+                IsPathSeparator(attr->ofname[2]) &&
+                attr->ofname[3] == '\0') {
+               return CF_SKIP;
+            }
+#endif
             Qmsg2(jcr, M_ERROR, 0, _("Could not open %s: ERR=%s\n"),
                   attr->ofname, be.bstrerror());
             return CF_ERROR;
@@ -398,10 +429,20 @@ static int separate_path_and_file(JCR *jcr, char *fname, char *ofile)
 
    /* Separate pathname and filename */
    for (q=p=f=ofile; *p; p++) {
+#ifdef HAVE_WIN32
+      if (IsPathSeparator(*p)) {
+         f = q;
+         if (IsPathSeparator(p[1])) {
+            p++;
+         }
+      }
+      *q++ = *p;                   /* copy data */
+#else
       if (IsPathSeparator(*p)) {
          f = q;                    /* possible filename */
       }
       q++;
+#endif
    }
 
    if (IsPathSeparator(*f)) {
diff --git a/src/findlib/drivetype.c b/src/findlib/drivetype.c
index 24c0802..1f68fa0 100644
--- a/src/findlib/drivetype.c
+++ b/src/findlib/drivetype.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2006-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *  Implement routines to determine drive type (Windows specific).
diff --git a/src/findlib/enable_priv.c b/src/findlib/enable_priv.c
new file mode 100644
index 0000000..884ed41
--- /dev/null
+++ b/src/findlib/enable_priv.c
@@ -0,0 +1,44 @@
+/*
+   Bacula(R) - The Network Backup Solution
+
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2003-2014 Free Software Foundation Europe e.V.
+
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
+
+   You may use this file and others of this release according to the
+   license defined in the LICENSE file, which includes the Affero General
+   Public License, v3.0 ("AGPLv3") and some additional permissions and
+   terms pursuant to its AGPLv3 Section 7.
+
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
+/*
+ *  Enable backup privileges for Win32 systems.
+ *
+ *    Kern Sibbald, May MMIII
+ *
+ */
+
+#include "bacula.h"
+#include "find.h"
+#include "jcr.h"
+
+
+/*=============================================================*/
+/*                                                             */
+/*                 * * *  U n i x * * * *                      */
+/*                                                             */
+/*=============================================================*/
+
+#if !defined(HAVE_WIN32)
+
+int enable_backup_privileges(JCR *jcr, int ignore_errors)
+ { return 0; }
+
+
+#endif
diff --git a/src/findlib/find.c b/src/findlib/find.c
index 606b4f0..a9f2d6e 100644
--- a/src/findlib/find.c
+++ b/src/findlib/find.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Main routine for finding files on a file system.
@@ -91,21 +95,11 @@ set_find_changed_function(FF_PKT *ff, bool check_fct(JCR *jcr, FF_PKT *ff))
    ff->check_fct = check_fct;
 }
 
-/*
- * For VSS we need to know which windows drives
- * are used, because we create a snapshot of all used
- * drives before operation
- *
- * the function returns the number of used drives and
- * fills "drives" with up to 26 (A..Z) drive names
- *
- * szDrives must be at least 27 bytes long
- */
-int
-get_win32_driveletters(FF_PKT *ff, char* szDrives)
+void
+set_find_snapshot_function(FF_PKT *ff, 
+                           bool convert_path(JCR *jcr, FF_PKT *ff, dlist *filelist, dlistString *node))
 {
-   int nCount = 0;
-   return nCount;
+   ff->snapshot_convert_fct = convert_path;
 }
 
 /*
@@ -172,10 +166,17 @@ find_files(JCR *jcr, FF_PKT *ff, int file_save(JCR *jcr, FF_PKT *ff_pkt, bool to
          foreach_dlist(node, &incexe->name_list) {
             char *fname = node->c_str();
             Dmsg1(dbglvl, "F %s\n", fname);
+
             ff->top_fname = fname;
+            /* Convert the filename if needed */
+            if (ff->snapshot_convert_fct) {
+               ff->snapshot_convert_fct(jcr, ff, &incexe->name_list, node);
+            }
+
             if (find_one_file(jcr, ff, our_callback, ff->top_fname, (dev_t)-1, true) == 0) {
                return 0;                  /* error return */
             }
+
             if (job_canceled(jcr)) {
                return 0;
             }
@@ -465,6 +466,15 @@ term_find_files(FF_PKT *ff)
    if (ff->ignoredir_fname) {
       free_pool_memory(ff->ignoredir_fname);
    }
+   if (ff->snap_fname) {
+      free_pool_memory(ff->snap_fname);
+   }
+   if (ff->snap_top_fname) {
+      free_pool_memory(ff->snap_top_fname);
+   }
+   if (ff->mtab_list) {
+      delete ff->mtab_list;
+   }
    hard_links = term_find_one(ff);
    free(ff);
    return hard_links;
diff --git a/src/findlib/find.h b/src/findlib/find.h
index 188245e..a12bf03 100644
--- a/src/findlib/find.h
+++ b/src/findlib/find.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * File types as returned by find_files()
@@ -64,9 +68,9 @@ int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);
 
 struct s_included_file {
    struct s_included_file *next;
-   uint32_t options;                  /* backup options */
+   uint64_t options;                  /* backup options */
    uint32_t algo;                     /* compression algorithm. 4 letters stored as an interger */
-   int level;                         /* compression level */
+   int Compress_level;                /* compression level */
    int len;                           /* length of fname */
    int pattern;                       /* set if wild card pattern */
    char VerifyOpts[20];               /* Options for verify */
@@ -96,7 +100,7 @@ enum {
 
 /* File options structure */
 struct findFOPTS {
-   uint32_t flags;                    /* options in bits */
+   uint64_t flags;                    /* options in bits */
    uint32_t Compress_algo;            /* compression algorithm. 4 letters stored as an interger */
    int Compress_level;                /* compression level */
    int strip_path;                    /* strip path count */
@@ -154,6 +158,16 @@ struct FF_PKT {
    char *object_name;                 /* Object name */
    char *object;                      /* restore object */
    char *plugin;                      /* Current Options{Plugin=} name */
+
+   /* Specific snapshot part */
+   char *volume_path;                 /* volume path */
+   char *snapshot_path;               /* snapshot path */
+   char *top_fname_save;
+   POOLMEM *snap_fname;               /* buffer used when stripping path */
+   POOLMEM *snap_top_fname;
+   bool strip_snap_path;              /* convert snapshot path or not */
+   bool (*snapshot_convert_fct)(JCR *jcr, FF_PKT *ff, dlist *filelist, dlistString *node);
+
    POOLMEM *sys_fname;                /* system filename */
    POOLMEM *fname_save;               /* save when stripping path */
    POOLMEM *link_save;                /* save when stripping path */
@@ -190,14 +204,18 @@ struct FF_PKT {
    bool (*check_fct)(JCR *, FF_PKT *); /* optionnal user fct to check file changes */
 
    /* Values set by accept_file while processing Options */
-   uint32_t flags;                    /* backup options */
+   uint64_t flags;                    /* backup options */
    uint32_t Compress_algo;            /* compression algorithm. 4 letters stored as an interger */
    int Compress_level;                /* compression level */
    int strip_path;                    /* strip path count */
    bool cmd_plugin;                   /* set if we have a command plugin */
    bool opt_plugin;                   /* set if we have an option plugin */
+   rblist *mtab_list;                 /* List of mtab entries */
+   uint64_t last_fstype;              /* cache last file system type */
+   char *last_fstypename;             /* cache last file system type name */
    alist fstypes;                     /* allowed file system types */
    alist drivetypes;                  /* allowed drive types */
+   alist mount_points;                /* Possible mount points to be snapshotted */
 
    /* List of all hard linked files found */
    struct f_link **linkhash;          /* hard linked files */
@@ -209,6 +227,10 @@ struct FF_PKT {
    struct HFSPLUS_INFO hfsinfo;       /* Finder Info and resource fork size */
 };
 
+typedef void (mtab_handler_t)(void *user_ctx, struct stat *st,
+               const char *fstype, const char *mountpoint,
+               const char *mntopts, const char *fsname);
+bool read_mtab(mtab_handler_t *mtab_handler, void *user_ctx);
 
 #include "protos.h"
 
diff --git a/src/findlib/find_one.c b/src/findlib/find_one.c
index b87a571..d0c1fbf 100644
--- a/src/findlib/find_one.c
+++ b/src/findlib/find_one.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
 
@@ -85,12 +89,22 @@ static FF_PKT *new_dir_ff_pkt(FF_PKT *ff_pkt)
    dir_ff_pkt->fname = bstrdup(ff_pkt->fname);
    dir_ff_pkt->link = bstrdup(ff_pkt->link);
    dir_ff_pkt->sys_fname = get_pool_memory(PM_FNAME);
+
+   if (ff_pkt->strip_snap_path) {
+      dir_ff_pkt->fname_save = get_pool_memory(PM_FNAME);
+      dir_ff_pkt->link_save = get_pool_memory(PM_FNAME);
+      pm_strcpy(dir_ff_pkt->fname_save, ff_pkt->fname_save);
+      pm_strcpy(dir_ff_pkt->link_save, ff_pkt->link_save);
+
+   } else {
+      dir_ff_pkt->fname_save = NULL;
+      dir_ff_pkt->link_save = NULL;
+   }
+
    dir_ff_pkt->included_files_list = NULL;
    dir_ff_pkt->excluded_files_list = NULL;
    dir_ff_pkt->excluded_paths_list = NULL;
    dir_ff_pkt->linkhash = NULL;
-   dir_ff_pkt->fname_save = NULL;
-   dir_ff_pkt->link_save = NULL;
    dir_ff_pkt->ignoredir_fname = NULL;
    return dir_ff_pkt;
 }
@@ -109,9 +123,6 @@ static void free_dir_ff_pkt(FF_PKT *dir_ff_pkt)
    if (dir_ff_pkt->link_save) {
       free_pool_memory(dir_ff_pkt->link_save);
    }
-   if (dir_ff_pkt->ignoredir_fname) {
-      free_pool_memory(dir_ff_pkt->ignoredir_fname);
-   }
    free(dir_ff_pkt);
 }
 
@@ -126,7 +137,7 @@ static int accept_fstype(FF_PKT *ff, void *dummy) {
 
    if (ff->fstypes.size()) {
       accept = false;
-      if (!fstype(ff->fname, fs, sizeof(fs))) {
+      if (!fstype(ff, fs, sizeof(fs))) {
          Dmsg1(50, "Cannot determine file system type for \"%s\"\n", ff->fname);
       } else {
          for (i = 0; i < ff->fstypes.size(); ++i) {
@@ -376,7 +387,7 @@ find_one_file(JCR *jcr, FF_PKT *ff_pkt,
 
          char fs[100];
 
-         if (!fstype(ff_pkt->fname, fs, sizeof(fs))) {
+         if (!fstype(ff_pkt, fs, sizeof(fs))) {
              bstrncpy(fs, "unknown", sizeof(fs));
          }
 
@@ -634,10 +645,12 @@ find_one_file(JCR *jcr, FF_PKT *ff_pkt,
        * to cross, or we may be restricted by a list of permitted
        * file systems.
        */
+      bool is_win32_mount_point = false;
       if (!top_level && ff_pkt->flags & FO_NO_RECURSION) {
          ff_pkt->type = FT_NORECURSE;
          recurse = false;
-      } else if (!top_level && (parent_device != ff_pkt->statp.st_dev)) {
+      } else if (!top_level && (parent_device != ff_pkt->statp.st_dev ||
+                 is_win32_mount_point)) {
          if(!(ff_pkt->flags & FO_MULTIFS)) {
             ff_pkt->type = FT_NOFSCHG;
             recurse = false;
diff --git a/src/findlib/fstype.c b/src/findlib/fstype.c
index 82d2b91..3ed575d 100644
--- a/src/findlib/fstype.c
+++ b/src/findlib/fstype.c
@@ -1,24 +1,27 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2004-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *  Implement routines to determine file system types.
  *
  *   Written by Preben 'Peppe' Guldberg, December MMIV
- *
- *   Version $Id$
+ *   Updated by Kern Sibbald, April MMXV
  */
 
 
@@ -26,57 +29,86 @@
 
 #include "bacula.h"
 #include "find.h"
+#include <sys/types.h>
+#include <sys/stat.h>
 
 #else /* Set up for testing a stand alone program */
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#define SUPPORTEDOSES \
-   "HAVE_DARWIN_OS\n" \
-   "HAVE_FREEBSD_OS\n" \
-   "HAVE_HPUX_OS\n" \
-   "HAVE_IRIX_OS\n" \
-   "HAVE_LINUX_OS\n" \
-   "HAVE_NETBSD_OS\n" \
-   "HAVE_OPENBSD_OS\n" \
-   "HAVE_SUN_OS\n" \
-   "HAVE_OSF1_OS\n" \
-   "HAVE_WIN32\n"
-#define false              0
-#define true               1
 #define bstrncpy           strncpy
-#define bstrcmp(s1, s2)    !strcmp(s1, s2)
 #define Dmsg0(n,s)         fprintf(stderr, s)
 #define Dmsg1(n,s,a1)      fprintf(stderr, s, a1)
 #define Dmsg2(n,s,a1,a2)   fprintf(stderr, s, a1, a2)
 #endif
 
+#define is_rootfs(x) bstrcmp("rootfs", x)
+
+#if defined(HAVE_GETMNTINFO) || defined(HAVE_GETMNTENT)
+static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+#endif
+
+struct mtab_item {
+   rblink link;
+   uint64_t dev;
+   char fstype[1];
+};
+
+/* Compare two device types */
+static int compare_mtab_items(void *item1, void *item2)
+{
+   mtab_item *mtab1, *mtab2;
+   mtab1 = (mtab_item *)item1;
+   mtab2 = (mtab_item *)item2;
+   if (mtab1->dev < mtab2->dev) return -1;
+   if (mtab1->dev > mtab2->dev) return 1;
+   return 0;
+}
+
+void add_mtab_item(void *user_ctx, struct stat *st, const char *fstype,
+                      const char *mountpoint, const char *mntopts,
+                      const char *fsname)
+{
+   rblist *mtab_list = (rblist *)user_ctx;
+   mtab_item *item, *ritem;
+   int len = strlen(fstype) + 1;
+   
+   item = (mtab_item *)malloc(sizeof(mtab_item) + len);
+   item->dev = (uint64_t)st->st_dev;
+   bstrncpy(item->fstype, fstype, len);
+   ritem = (mtab_item *)mtab_list->insert((void *)item, compare_mtab_items);
+   if (ritem != item) {
+      /* Item already inserted, so we discard this one */
+      free(item);
+   }
+}
+
+
 /*
  * These functions should be implemented for each OS
  *
- * bool fstype(const char *fname, char *fs, int fslen);
+ *       bool fstype(FF_PKT *ff_pkt, char *fs, int fslen);
  */
-#if defined(HAVE_DARWIN_OS) || \
-    defined(HAVE_FREEBSD_OS) || \
-    defined(HAVE_OPENBSD_OS)
+#if defined(HAVE_DARWIN_OS) \
+   || defined(HAVE_FREEBSD_OS ) \
+   || defined(HAVE_OPENBSD_OS)
 
 #include <sys/param.h>
 #include <sys/mount.h>
 
-bool fstype(const char *fname, char *fs, int fslen)
+bool fstype(FF_PKT *ff_pkt, char *fs, int fslen)
 {
+   char *fname = ff_pkt->fname;
    struct statfs st;
-
+ 
    if (statfs(fname, &st) == 0) {
       bstrncpy(fs, st.f_fstypename, fslen);
       return true;
    }
-
    Dmsg1(50, "statfs() failed for \"%s\"\n", fname);
    return false;
 }
-
 #elif defined(HAVE_NETBSD_OS)
 #include <sys/param.h>
 #include <sys/mount.h>
@@ -86,58 +118,161 @@ bool fstype(const char *fname, char *fs, int fslen)
 #define statvfs statfs
 #endif
 
-bool fstype(const char *fname, char *fs, int fslen)
+bool fstype(FF_PKT *ff_pkt, char *fs, int fslen)
 {
+   char *fname = ff_pkt->fname;
    struct statvfs st;
-
    if (statvfs(fname, &st) == 0) {
       bstrncpy(fs, st.f_fstypename, fslen);
       return true;
    }
-
    Dmsg1(50, "statfs() failed for \"%s\"\n", fname);
    return false;
 }
-
-#elif defined(HAVE_HPUX_OS) || \
-      defined(HAVE_IRIX_OS)
+#elif defined(HAVE_HPUX_OS) \
+   || defined(HAVE_IRIX_OS)
 
 #include <sys/types.h>
 #include <sys/statvfs.h>
 
-bool fstype(const char *fname, char *fs, int fslen)
+bool fstype(FF_PKT *ff_pkt, char *fs, int fslen)
 {
+   char *fname = ff_pkt->fname;
    struct statvfs st;
-
    if (statvfs(fname, &st) == 0) {
       bstrncpy(fs, st.f_basetype, fslen);
       return true;
    }
-
    Dmsg1(50, "statfs() failed for \"%s\"\n", fname);
    return false;
 }
 
-#elif defined(HAVE_LINUX_OS) || \
-      defined(HAVE_OSF1_OS)
+#elif defined(HAVE_LINUX_OS)
 
-#include <sys/stat.h>
-#include "lib/mntent_cache.h"
+#include <sys/vfs.h>
+#include <mntent.h>
 
-bool fstype(const char *fname, char *fs, int fslen)
+/*
+ * Linux statfs() does not return the filesystem name type.  It
+ *  only returns a binary fstype, so we must look up the type name
+ *  in mtab.
+ */
+bool fstype(FF_PKT *ff_pkt, char *fs, int fslen)
 {
-   struct stat st;
-   mntent_cache_entry_t *mce;
+   char *fname = ff_pkt->fname;
+   struct statfs st;
+   const char *fstype;
 
-   if (lstat(fname, &st) == 0) {
-      if ((mce = find_mntent_mapping(st.st_dev)) != NULL) {
-         bstrncpy(fs, mce->fstype, fslen);
+   if (statfs(fname, &st) == 0) {
+      mtab_item *item, search_item;
+      if (ff_pkt->last_fstypename && ff_pkt->last_fstype == (uint64_t)st.f_type) {
+         bstrncpy(fs, ff_pkt->last_fstypename, fslen);
+         return true; 
+      }
+      if (!ff_pkt->mtab_list) {
+         ff_pkt->mtab_list = New(rblist());
+         read_mtab(add_mtab_item, ff_pkt->mtab_list);
+      }
+      search_item.dev = st.f_type;
+      item = (mtab_item *)ff_pkt->mtab_list->search((void *)&search_item, compare_mtab_items);
+      if (item) {
+         ff_pkt->last_fstype = st.f_type;
+         bstrncpy(ff_pkt->last_fstypename, item->fstype, sizeof(ff_pkt->last_fstype));
+         bstrncpy(fs, ff_pkt->last_fstypename, fslen);
          return true;
       }
-      return false;
-   }
+      /*
+       * Values obtained from statfs(2), testing and
+       *
+       *    $ grep -r SUPER_MAGIC /usr/include/linux
+       */
+      switch (st.f_type) {
+      /* Known good values */
+      /* ext2, ext3, and ext4 have the same code */
+      case 0xef53:         fstype = "ext2"; break;          /* EXT2_SUPER_MAGIC */
+      case 0x3153464a:     fstype = "jfs"; break;           /* JFS_SUPER_MAGIC */
+      case 0x5346544e:     fstype = "ntfs"; break;          /* NTFS_SB_MAGIC */
+      case 0x9fa0:         fstype = "proc"; break;          /* PROC_SUPER_MAGIC */
+      case 0x52654973:     fstype = "reiserfs"; break;      /* REISERFS_SUPER_MAGIC */
+      case 0x58465342:     fstype = "xfs"; break;           /* XFS_SB_MAGIC */
+      case 0x9fa2:         fstype = "usbdevfs"; break;      /* USBDEVICE_SUPER_MAGIC */
+      case 0x62656572:     fstype = "sysfs"; break;         /* SYSFS_MAGIC */
+      case 0x517B:         fstype = "smbfs"; break;         /* SMB_SUPER_MAGIC */
+      case 0x9660:         fstype = "iso9660"; break;       /* ISOFS_SUPER_MAGIC */
+      case 0xadf5:         fstype = "adfs"; break;          /* ADFS_SUPER_MAGIC */
+      case 0xadff:         fstype = "affs"; break;          /* AFFS_SUPER_MAGIC */
+      case 0x42465331:     fstype = "befs"; break;          /* BEFS_SUPER_MAGIC */
+      case 0xFF534D42:     fstype = "cifs"; break;          /* CIFS_MAGIC_NUMBER */
+      case 0x73757245:     fstype = "coda"; break;          /* CODA_SUPER_MAGIC */
+      case 0x012ff7b7:     fstype = "coherent"; break;      /* COH_SUPER_MAGIC */
+      case 0x28cd3d45:     fstype = "cramfs"; break;        /* CRAMFS_MAGIC */
+      case 0x1373:         fstype = "devfs"; break;         /* DEVFS_SUPER_MAGIC */
+      case 0x414A53:       fstype = "efs"; break;           /* EFS_SUPER_MAGIC */
+      case 0x137d:         fstype = "ext"; break;           /* EXT_SUPER_MAGIC */
+      case 0xef51:         fstype = "oldext2"; break;          /* EXT2_OLD_SUPER_MAGIC */
+      case 0x4244:         fstype = "hfs"; break;          /* EXT2_OLD_SUPER_MAGIC */
+      case 0xf995e849:     fstype = "hpfs"; break;          /* HPFS_SUPER_MAGIC */
+      case 0x958458f6:     fstype = "hugetlbfs"; break;     /* HUGETLBFS_MAGIC */
+      case 0x72b6:         fstype = "jffs2"; break;         /* JFFS2_SUPER_MAGIC */
+      case 0x2468:         fstype = "minix"; break;         /* MINIX2_SUPER_MAGIC */
+      case 0x2478:         fstype = "minix"; break;         /* MINIX2_SUPER_MAGIC2 */
+      case 0x137f:         fstype = "minix"; break;         /* MINIX_SUPER_MAGIC */
+      case 0x138f:         fstype = "minix"; break;         /* MINIX_SUPER_MAGIC2 */
+      case 0x4d44:         fstype = "msdos"; break;         /* MSDOS_SUPER_MAGIC */
+      case 0x564c:         fstype = "ncpfs"; break;         /* NCP_SUPER_MAGIC */
+      case 0x6969:         fstype = "nfs"; break;           /* NFS_SUPER_MAGIC */
+      case 0x9fa1:         fstype = "openpromfs"; break;    /* OPENPROM_SUPER_MAGIC */
+      case 0x002f:         fstype = "qnx4"; break;          /* QNX4_SUPER_MAGIC */
+      case 0x7275:         fstype = "romfs"; break;          /* QNX4_SUPER_MAGIC */
+      case 0x012ff7b6:     fstype = "sysv2"; break;
+      case 0x012ff7b5:     fstype = "sysv4"; break;
+      case 0x01021994:     fstype = "tempfs"; break;
+      case 0x15013346:     fstype = "udf"; break;
+      case 0x00011954:     fstype = "ufs"; break;
+      case 0xa501FCF5:     fstype = "vxfs"; break;
+      case 0x012FF7B4:     fstype = "xenix"; break;
+      case 0x012FD16D:     fstype = "xiafs"; break;
+
+
+#if 0       /* These need confirmation */
+      case 0x6B414653:     fstype = "afs"; break;           /* AFS_FS_MAGIC */
+      case 0x0187:         fstype = "autofs"; break;        /* AUTOFS_SUPER_MAGIC */
+      case 0x62646576:     fstype = "bdev"; break;          /* ??? */
+      case 0x1BADFACE:     fstype = "bfs"; break;           /* BFS_MAGIC */
+      case 0x42494e4d:     fstype = "binfmt_misc"; break;   /* ??? */
+      case (('C'<<8)|'N'): fstype = "capifs"; break;        /* CAPIFS_SUPER_MAGIC */
+      case 0x1cd1:         fstype = "devpts"; break;        /* ??? */
+      case 0x03111965:     fstype = "eventpollfs"; break;   /* EVENTPOLLFS_MAGIC */
+      case 0xBAD1DEA:      fstype = "futexfs"; break;       /* ??? */
+      case 0xaee71ee7:     fstype = "gadgetfs"; break;      /* GADGETFS_MAGIC */
+      case 0x00c0ffee:     fstype = "hostfs"; break;        /* HOSTFS_SUPER_MAGIC */
+      case 0xb00000ee:     fstype = "hppfs"; break;         /* HPPFS_SUPER_MAGIC */
+      case 0x12061983:     fstype = "hwgfs"; break;         /* HWGFS_MAGIC */
+      case 0x66726f67:     fstype = "ibmasmfs"; break;      /* IBMASMFS_MAGIC */
+      case 0x19800202:     fstype = "mqueue"; break;        /* MQUEUE_MAGIC */
+      case 0x6f70726f:     fstype = "oprofilefs"; break;    /* OPROFILEFS_MAGIC */
+      case 0xa0b4d889:     fstype = "pfmfs"; break;         /* PFMFS_MAGIC */
+      case 0x50495045:     fstype = "pipfs"; break;         /* PIPEFS_MAGIC */
+      case 0x858458f6:     fstype = "ramfs"; break;         /* RAMFS_MAGIC */
+      case 0x7275:         fstype = "romfs"; break;         /* ROMFS_MAGIC */
+      case 0x858458f6:     fstype = "rootfs"; break;        /* RAMFS_MAGIC */
+      case 0x67596969:     fstype = "rpc_pipefs"; break;    /* RPCAUTH_GSSMAGIC */
+      case 0x534F434B:     fstype = "sockfs"; break;        /* SOCKFS_MAGIC */
+      case 0x858458f6:     fstype = "tmpfs"; break;         /* RAMFS_MAGIC */
+      case 0x01021994:     fstype = "tmpfs"; break;         /* TMPFS_MAGIC */
+#endif
 
-   Dmsg1(50, "lstat() failed for \"%s\"\n", fname);
+      default:
+         Dmsg2(10, "Unknown file system type \"0x%x\" for \"%s\".\n", st.f_type,
+               fname);
+         return false;
+      }
+      ff_pkt->last_fstype = st.f_type;
+      bstrncpy(ff_pkt->last_fstypename, fstype, sizeof(ff_pkt->last_fstypename));
+      bstrncpy(fs, fstype, fslen);
+      return true;
+   }
+   Dmsg1(50, "statfs() failed for \"%s\"\n", fname);
    return false;
 }
 
@@ -146,82 +281,138 @@ bool fstype(const char *fname, char *fs, int fslen)
 #include <sys/types.h>
 #include <sys/stat.h>
 
-bool fstype(const char *fname, char *fs, int fslen)
+bool fstype(FF_PKT *ff_pkt, char *fs, int fslen)
 {
-   struct stat st;
+   /* Solaris has the filesystem type name in the lstat packet */
+   bstrncpy(fs, ff_pkt->statp.st_fstype, fslen);
+   return true;
+}
+ 
+#elif defined (__digital__) && defined (__unix__)  /* Tru64 */
+/* Tru64 */
+#include <sys/stat.h>
+#include <sys/mount.h>
 
-   if (lstat(fname, &st) == 0) {
-      bstrncpy(fs, st.st_fstype, fslen);
-      return true;
+bool fstype(FF_PKT *ff_pkt, char *fs, int fslen)
+{
+   char *fname = ff_pkt->fname;
+   struct statfs st;
+   if (statfs((char *)fname, &st) == 0) {
+      switch (st.f_type) {
+      /* Known good values */
+      case 0xa:         bstrncpy(fs, "advfs", fslen); return true;        /* Tru64 AdvFS */
+      case 0xe:         bstrncpy(fs, "nfs", fslen); return true;          /* Tru64 NFS   */
+      default:
+         Dmsg2(10, "Unknown file system type \"0x%x\" for \"%s\".\n", st.f_type,
+               fname);
+         return false;
+      }
    }
-
-   Dmsg1(50, "lstat() failed for \"%s\"\n", fname);
+   Dmsg1(50, "statfs() failed for \"%s\"\n", fname);
    return false;
 }
+/* Tru64 */
 
-#elif defined (HAVE_WIN32)
-/* Windows */
+#else    /* No recognised OS */
 
-bool fstype(const char *fname, char *fs, int fslen)
+bool fstype(FF_PKT *ff_pkt, char *fs, int fslen)
 {
-   DWORD componentlength;
-   DWORD fsflags;
-   CHAR rootpath[4];
-   UINT oldmode;
-   BOOL result;
-
-   /* Copy Drive Letter, colon, and backslash to rootpath */
-   bstrncpy(rootpath, fname, sizeof(rootpath));
+   char *fname = ff_pkt->fname;
+   Dmsg0(10, "!!! fstype() not implemented for this OS. !!!\n");
+   return false;
+}
+#endif
 
-   /* We don't want any popups if there isn't any media in the drive */
-   oldmode = SetErrorMode(SEM_FAILCRITICALERRORS);
+/* Read mtab entries  */
+bool read_mtab(mtab_handler_t *mtab_handler, void *user_ctx)
+{ 
+#ifdef HAVE_GETMNTENT
+   FILE *mntfp;
+   struct stat st;
+ 
+#ifdef HAVE_LINUX_OS
+   struct mntent *mnt;
+   P(mutex);
+   if ((mntfp = setmntent("/proc/mounts", "r")) == NULL) {
+      if ((mntfp = setmntent(_PATH_MOUNTED, "r")) == NULL) {
+         V(mutex);
+         return false;
+      }
+   } 
+   while ((mnt = getmntent(mntfp)) != NULL) {
+      if (is_rootfs(mnt->mnt_type)) {
+         continue;
+      }
 
-   result = GetVolumeInformation(rootpath, NULL, 0, NULL, &componentlength, &fsflags, fs, fslen);
+      if (stat(mnt->mnt_dir, &st) < 0) {
+         continue;
+      }
+      mtab_handler(user_ctx, &st, mnt->mnt_type, mnt->mnt_dir,
+         mnt->mnt_opts, mnt->mnt_fsname);
+   }
+   endmntent(mntfp);
+   V(mutex);
+#endif
 
-   SetErrorMode(oldmode);
+#ifdef HAVE_SUN_OS
+   struct mnttab mnt;
 
-   if (result) {
-      /* Windows returns NTFS, FAT, etc.  Make it lowercase to be consistent with other OSes */
-      lcase(fs);
-   } else {
-      Dmsg2(10, "GetVolumeInformation() failed for \"%s\", Error = %d.\n", rootpath, GetLastError());
+   P(mutex);
+   if ((mntfp = fopen(MNTTAB, "r")) == NULL) {
+      V(mutex);
+      return false;
    }
 
-   return result != 0;
-}
-
-/* Windows */
+   while (getmntent(mntfp, &mnt) == 0) {
+      if (is_rootfs(mnt.mnt_fstype)) {
+         continue;
+      }
+      if (stat(mnt.mnt_mountp, &st) < 0) {
+         continue;
+      }
+      mtab_handler(user_ctx, &st, mnt.mnt_fstype, mnt.mnt_mountp,
+         mnt.mnt_mntopts, mnt.mnt_special);
+   }
+   fclose(fp);
+   V(mutex);
+#endif
 
-#else    /* No recognised OS */
+#endif /* HAVE_GETMNTENT */
 
-bool fstype(const char *fname, char *fs, int fslen)
-{
-   Dmsg0(10, "!!! fstype() not implemented for this OS. !!!\n");
-#ifdef TEST_PROGRAM
-   Dmsg1(10, "Please define one of the following when compiling:\n\n%s\n",
-         SUPPORTEDOSES);
-   exit(EXIT_FAILURE);
+#ifdef HAVE_GETMNTINFO
+   struct stat st;
+#if defined(ST_NOWAIT)
+   int flags = ST_NOWAIT;
+#elif defined(MNT_NOWAIT)
+   int flags = MNT_NOWAIT;
+#else
+   int flags = 0;
 #endif
-
-   return false;
-}
+#if defined(HAVE_NETBSD_OS)
+   struct statvfs *mntinfo;
+#else
+   struct statfs *mntinfo;
 #endif
-
-/*
- * Compare function build on top of fstype, OS independent.
- *
- * bool fstype_equals(const char *fname, const char *fstypename);
- */
-bool fstype_equals(const char *fname, const char *fstypename)
-{
-   char fs_typename[128];
-
-   if (fstype(fname, fs_typename, sizeof(fs_typename))) {
-      return bstrcmp(fs_typename, fstypename);
+   int nument;
+
+   P(mutex);
+   if ((nument = getmntinfo(&mntinfo, flags)) > 0) {
+      while (nument-- > 0) {
+         if (is_rootfs(mntinfo->f_fstypename)) {
+            continue;
+         }
+         if (stat(mntinfo->f_mntonname, &st) < 0) {
+            continue;
+         }
+         mtab_handler(user_ctx, &st, mntinfo->f_mntfromname,
+            mntinfo->f_mntonname, mntinfo->f_fstypename, NULL);
+         mntinfo++;
+      }
    }
-
-   return false;
-}
+   V(mutex);
+#endif /* HAVE_GETMNTINFO */
+   return true;
+} 
 
 #ifdef TEST_PROGRAM
 int main(int argc, char **argv)
diff --git a/src/findlib/match.c b/src/findlib/match.c
index ba85de6..69a19a8 100644
--- a/src/findlib/match.c
+++ b/src/findlib/match.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *     Old style
@@ -39,11 +43,7 @@
 #endif
 
 /* Fold case in fnmatch() on Win32 */
-#ifdef HAVE_WIN32
-static const int fnmode = FNM_CASEFOLD;
-#else
 static const int fnmode = 0;
-#endif
 
 
 #undef bmalloc
@@ -179,14 +179,14 @@ void add_fname_to_include_list(FF_PKT *ff, int prefixed, const char *fname)
             if (*rp >= '0' && *rp <= '9') {
                inc->options |= FO_COMPRESS;
                inc->algo = COMPRESS_GZIP;
-               inc->level = *rp - '0';
+               inc->Compress_level = *rp - '0';
             }
-            else if (*rp == 'o') {
+               else if (*rp == 'o') {
                inc->options |= FO_COMPRESS;
                inc->algo = COMPRESS_LZO1X;
-               inc->level = 1; /* not used with LZO */
+               inc->Compress_level = 1; /* not used with LZO */
             }
-            Dmsg2(200, "Compression alg=%d level=%d\n", inc->algo, inc->level);
+            Dmsg2(200, "Compression alg=%d level=%d\n", inc->algo, inc->Compress_level);
             break;
          case 'K':
             inc->options |= FO_NOATIME;
@@ -285,7 +285,7 @@ struct s_included_file *get_next_included_file(FF_PKT *ff, struct s_included_fil
    if (inc) {
       ff->flags = inc->options;
       ff->Compress_algo = inc->algo;
-      ff->Compress_level = inc->level;
+      ff->Compress_level = inc->Compress_level;
    }
    return inc;
 }
diff --git a/src/findlib/makepath.c b/src/findlib/mkpath.c
similarity index 77%
rename from src/findlib/makepath.c
rename to src/findlib/mkpath.c
index 511c628..f1c4fee 100644
--- a/src/findlib/makepath.c
+++ b/src/findlib/mkpath.c
@@ -1,29 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from
-   many others, a complete list can be found in the file AUTHORS.
-   This program is Free Software; you can redistribute it and/or
-   modify it under the terms of version three of the GNU Affero General Public
-   License as published by the Free Software Foundation and included
-   in the file LICENSE.
-
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU Affero General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-   02110-1301, USA.
-
-   Bacula® is a registered trademark of Kern Sibbald.
-   The licensor of Bacula is the Free Software Foundation Europe
-   (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
-   Switzerland, email:ftf at fsfeurope.org.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
+
+   You may use this file and others of this release according to the
+   license defined in the LICENSE file, which includes the Affero General
+   Public License, v3.0 ("AGPLv3") and some additional permissions and
+   terms pursuant to its AGPLv3 Section 7.
+
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 
 /*
@@ -31,6 +23,13 @@
  *
  *  This is tricky code, especially when writing from scratch. Fortunately,
  *    a non-copyrighted version of mkdir was available to consult.
+ *
+ * ***FIXME*** the mkpath code could be significantly optimized by
+ *   walking up the path chain from the bottom until it either gets
+ *   to the top or finds an existing directory then walk back down
+ *   creating the path components.  Currently, it always starts at
+ *   the top, which can be rather inefficient for long path names.
+ *
  */
 #include "bacula.h"
 #include "jcr.h"
@@ -147,6 +146,8 @@ static bool makedir(JCR *jcr, char *path, mode_t mode, int *created)
       }
       return true;                 /* directory exists */
    }
+#if 0
+   /* TODO: This code rely on statp that is not initialized, we need to do a stat() */
    if (S_ISLNK(statp.st_mode)) {
       /*
        * Note, we created a directory, not a link, so if we find a
@@ -156,7 +157,7 @@ static bool makedir(JCR *jcr, char *path, mode_t mode, int *created)
          path);
       return false;
    }
-
+#endif
    if (jcr->keep_path_list) {
       /* When replace=NEVER, we keep track of all directories newly created */
       path_list_add(jcr, strlen(path), path);
@@ -243,32 +244,7 @@ bool makepath(ATTR *attr, const char *apath, mode_t mode, mode_t parent_mode,
     */
    tmode = 0777;
 
-#if defined(HAVE_WIN32)
-   /* Validate drive letter */
-   if (path[1] == ':') {
-      char drive[4] = "X:\\";
-
-      drive[0] = path[0];
-
-      UINT drive_type = GetDriveType(drive);
-
-      if (drive_type == DRIVE_UNKNOWN || drive_type == DRIVE_NO_ROOT_DIR) {
-         Jmsg1(jcr, M_ERROR, 0, _("%c: is not a valid drive.\n"), path[0]);
-         goto bail_out;
-      }
-
-      if (path[2] == '\0') {          /* attempt to create a drive */
-         ok = true;
-         goto bail_out;               /* OK, it is already there */
-      }
-
-      p = &path[3];
-   } else {
-      p = path;
-   }
-#else
    p = path;
-#endif
 
    /* Skip leading slash(es) */
    while (IsPathSeparator(*p)) {
@@ -301,20 +277,7 @@ bool makepath(ATTR *attr, const char *apath, mode_t mode, mode_t parent_mode,
    }
 
    /* Now set the proper owner and modes */
-#if defined(HAVE_WIN32)
-
-   /* Don't propagate the hidden or encrypted attributes to parent directories */
-   parent_mode &= ~S_ISVTX;
-   parent_mode &= ~S_ISGID;
-
-   if (path[1] == ':') {
-      p = &path[3];
-   } else {
-      p = path;
-   }
-#else
    p = path;
-#endif
    /* Skip leading slash(es) */
    while (IsPathSeparator(*p)) {
       p++;
diff --git a/src/findlib/priv.c b/src/findlib/priv.c
deleted file mode 100644
index 0bd0495..0000000
--- a/src/findlib/priv.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
-   Bacula® - The Network Backup Solution
-
-   Copyright (C) 2003-2014 Free Software Foundation Europe e.V.
-
-   The main author of Bacula is Kern Sibbald, with contributions from
-   many others, a complete list can be found in the file AUTHORS.
-   This program is Free Software; you can redistribute it and/or
-   modify it under the terms of version three of the GNU Affero General Public
-   License as published by the Free Software Foundation and included
-   in the file LICENSE.
-
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU Affero General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-   02110-1301, USA.
-
-   Bacula® is a registered trademark of Kern Sibbald.
-   The licensor of Bacula is the Free Software Foundation Europe
-   (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
-   Switzerland, email:ftf at fsfeurope.org.
-*/
-/*
- *  Enable backup privileges for Win32 systems.
- *
- *    Kern Sibbald, May MMIII
- *
- */
-
-#include "bacula.h"
-#include "jcr.h"
-
-
-/*=============================================================*/
-/*                                                             */
-/*                 * * *  U n i x * * * *                      */
-/*                                                             */
-/*=============================================================*/
-
-int enable_backup_privileges(JCR *jcr, int ignore_errors)
- { return 0; }
-
diff --git a/src/findlib/protos.h b/src/findlib/protos.h
index caf331c..7291ee8 100644
--- a/src/findlib/protos.h
+++ b/src/findlib/protos.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Prototypes for finlib directory of Bacula
@@ -31,13 +35,14 @@ int    create_file       (JCR *jcr, ATTR *attr, BFILE *ofd, int replace);
 
 /* From find.c */
 FF_PKT *init_find_files();
+void set_find_snapshot_function(FF_PKT *ff, 
+                                bool convert_path(JCR *jcr, FF_PKT *ff, dlist *filelist, dlistString *node));
 void  set_find_options(FF_PKT *ff, int incremental, time_t mtime);
 void set_find_changed_function(FF_PKT *ff, bool check_fct(JCR *jcr, FF_PKT *ff));
 int   find_files(JCR *jcr, FF_PKT *ff, int file_sub(JCR *, FF_PKT *ff_pkt, bool),
                  int plugin_sub(JCR *, FF_PKT *ff_pkt, bool));
 int   match_files(JCR *jcr, FF_PKT *ff, int sub(JCR *, FF_PKT *ff_pkt, bool));
 int   term_find_files(FF_PKT *ff);
-int   get_win32_driveletters(FF_PKT *ff, char* szDrives);
 bool  is_in_fileset(FF_PKT *ff);
 bool accept_file(FF_PKT *ff);
 
@@ -75,10 +80,11 @@ bool path_list_add(JCR *jcr, uint32_t len, char *fname);
 
 
 /* from fstype.c */
-bool fstype(const char *fname, char *fs, int fslen);
-bool fstype_equals(const char *fname, const char *fstypename);
+bool fstype(FF_PKT *ff_pkt, char *fs, int fslen);
+bool fstype_equals(const char *fname, const char *fstype_name);
 
 /* from drivetype.c */
 bool drivetype(const char *fname, char *fs, int fslen);
 
 /* from bfile.c -- see bfile.h */
+/* from namedpipe.c -- see namedpipe.h */
diff --git a/src/findlib/savecwd.c b/src/findlib/savecwd.c
new file mode 100644
index 0000000..2c64cc7
--- /dev/null
+++ b/src/findlib/savecwd.c
@@ -0,0 +1,121 @@
+/*
+   Bacula(R) - The Network Backup Solution
+
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
+
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
+
+   You may use this file and others of this release according to the
+   license defined in the LICENSE file, which includes the Affero General
+   Public License, v3.0 ("AGPLv3") and some additional permissions and
+   terms pursuant to its AGPLv3 Section 7.
+
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
+
+/*
+ *  Kern Sibbald, August MMVII
+ *
+ */
+
+#include "bacula.h"
+#include "savecwd.h"
+
+/*
+ * Attempt to save the current working directory by various means so that
+ *  we can optimize code by doing a cwd and then restore the cwd.
+ */
+
+#ifdef HAVE_FCHDIR
+static bool fchdir_failed = false;          /* set if we get a fchdir failure */
+#else
+static bool fchdir_failed = true;           /* set if we get a fchdir failure */
+#endif
+
+/*
+ * Save current working directory.
+ * Returns: true if OK
+ *          false if failed
+ */
+bool saveCWD::save(JCR *jcr)
+{
+   release();                                /* clean up */
+   if (!fchdir_failed) {
+      m_fd = open(".", O_RDONLY);
+      if (m_fd < 0) {
+         berrno be;
+         Jmsg1(jcr, M_ERROR, 0, _("Cannot open current directory: ERR=%s\n"), be.bstrerror());
+         m_saved = false;
+         return false;
+      }
+   }
+
+   if (fchdir_failed) {
+      POOLMEM *buf = get_memory(5000);
+      m_cwd = (POOLMEM *)getcwd(buf, sizeof_pool_memory(buf));
+      if (m_cwd == NULL) {
+         berrno be;
+         Jmsg1(jcr, M_ERROR, 0, _("Cannot get current directory: ERR=%s\n"), be.bstrerror());
+         free_pool_memory(buf);
+         m_saved = false;
+         return false;
+      }
+   }
+   m_saved = true;
+   return true;
+}
+
+/*
+ * Restore previous working directory.
+ * Returns: true if OK
+ *          false if failed
+ */
+bool saveCWD::restore(JCR *jcr)
+{
+   if (!m_saved) {
+      return true;
+   }
+   m_saved = false;
+   if (m_fd >= 0) {
+      if (fchdir(m_fd) != 0) {
+         berrno be;
+         Jmsg1(jcr, M_ERROR, 0, _("Cannot reset current directory: ERR=%s\n"), be.bstrerror());
+         close(m_fd);
+         m_fd = -1;
+         fchdir_failed = true;
+         chdir("/");                  /* punt */
+         return false;
+      }
+      return true;
+   }
+   if (chdir(m_cwd) < 0) {
+      berrno be;
+      Jmsg1(jcr, M_ERROR, 0, _("Cannot reset current directory: ERR=%s\n"), be.bstrerror());
+      chdir("/");
+      free_pool_memory(m_cwd);
+      m_cwd = NULL;
+      return false;
+   }
+   return true;
+}
+
+void saveCWD::release()
+{
+   if (!m_saved) {
+      return;
+   }
+   m_saved = false;
+   if (m_fd >= 0) {
+      close(m_fd);
+      m_fd = -1;
+   }
+   if (m_cwd) {
+      free_pool_memory(m_cwd);
+      m_cwd = NULL;
+   }
+}
diff --git a/src/findlib/savecwd.h b/src/findlib/savecwd.h
new file mode 100644
index 0000000..d88eeac
--- /dev/null
+++ b/src/findlib/savecwd.h
@@ -0,0 +1,43 @@
+/*
+   Bacula(R) - The Network Backup Solution
+
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
+
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
+
+   You may use this file and others of this release according to the
+   license defined in the LICENSE file, which includes the Affero General
+   Public License, v3.0 ("AGPLv3") and some additional permissions and
+   terms pursuant to its AGPLv3 Section 7.
+
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
+
+/*
+ *  Kern Sibbald, August MMVII
+ *
+ */
+
+#ifndef _SAVECWD_H
+#define _SAVECWD_H 1
+
+class saveCWD {
+   bool m_saved;                   /* set if we should do chdir i.e. save_cwd worked */
+   int m_fd;                       /* fd of current dir before chdir */
+   char *m_cwd;                    /* cwd before chdir if fd fchdir() works */
+
+public:
+   saveCWD() { m_saved=false; m_fd=-1; m_cwd=NULL; };
+   ~saveCWD() { release(); };
+   bool save(JCR *jcr);
+   bool restore(JCR *jcr);
+   void release();
+   bool is_saved() { return m_saved; };
+};
+
+#endif /* _SAVECWD_H */
diff --git a/src/host.h.in b/src/host.h.in
index 801e945..821c7d1 100644
--- a/src/host.h.in
+++ b/src/host.h.in
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2000-2010 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Define Host machine
diff --git a/src/jcr.h b/src/jcr.h
index ef56593..e9fc371 100644
--- a/src/jcr.h
+++ b/src/jcr.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Bacula JCR Structure definition for Daemons and the Library
@@ -62,6 +66,7 @@
 #define JS_Differences           'D'  /* Verify differences */
 #define JS_ErrorTerminated       'E'  /* Job terminated in error */
 #define JS_WaitFD                'F'  /* waiting on File daemon */
+#define JS_Incomplete            'I'  /* Incomplete Job */
 #define JS_DataCommitting        'L'  /* Committing data (last despool) */
 #define JS_WaitMount             'M'  /* waiting for Mount */
 #define JS_Running               'R'  /* running */
@@ -133,17 +138,18 @@ enum {
 class JCR;
 class BSOCK;
 struct FF_PKT;
-class  B_DB;
+class  BDB;
 struct ATTR_DBR;
 class Plugin;
 struct save_pkt;
 struct bpContext;
-struct xattr_private_data_t;
+
 
 #ifdef FILE_DAEMON
 class htable;
-struct acl_data_t;
-struct xattr_data_t;
+struct acl_ctx_t;
+struct xattr_ctx_t;
+class snapshot_manager;
 
 struct CRYPTO_CTX {
    bool pki_sign;                     /* Enable PKI Signatures? */
@@ -165,6 +171,7 @@ typedef void (JCR_free_HANDLER)(JCR *jcr);
 class JCR {
 private:
    pthread_mutex_t mutex;             /* jcr mutex */
+   pthread_mutex_t mutex_auth;        /* used during authentication */
    volatile int32_t _use_count;       /* use count */
    int32_t m_JobType;                 /* backup, restore, verify ... */
    int32_t m_JobLevel;                /* Job level */
@@ -172,13 +179,22 @@ private:
 public:
    void lock() {P(mutex); };
    void unlock() {V(mutex); };
+   void lock_auth() {P(mutex_auth);};
+   void unlock_auth() {V(mutex_auth);};
    void inc_use_count(void) {lock(); _use_count++; unlock(); };
    void dec_use_count(void) {lock(); _use_count--; unlock(); };
    int32_t use_count() const { return _use_count; };
-   void init_mutex(void) {pthread_mutex_init(&mutex, NULL); };
-   void destroy_mutex(void) {pthread_mutex_destroy(&mutex); };
+   void init_mutex(void) {
+      pthread_mutex_init(&mutex, NULL);
+      pthread_mutex_init(&mutex_auth, NULL);
+   };
+   void destroy_mutex(void) {
+      pthread_mutex_destroy(&mutex_auth);
+      pthread_mutex_destroy(&mutex);
+   };
    bool is_job_canceled() {return job_canceled(this); };
    bool is_canceled() {return job_canceled(this); };
+   bool is_incomplete() { return JobStatus == JS_Incomplete; };
    bool is_JobLevel(int32_t JobLevel) { return JobLevel == m_JobLevel; };
    bool is_JobType(int32_t JobType) { return JobType == m_JobType; };
    bool is_JobStatus(int32_t aJobStatus) { return aJobStatus == JobStatus; };
@@ -194,9 +210,9 @@ public:
    };
    const char *get_OperationName();       /* in lib/jcr.c */
    const char *get_ActionName(bool past); /* in lib/jcr.c */
-   void setJobStatus(int newJobStatus);   /* in lib/jcr.c */
+   void setJobStatus(int JobStatus);      /* in lib/jcr.c */
    bool sendJobStatus();                  /* in lib/jcr.c */
-   bool sendJobStatus(int newJobStatus);  /* in lib/jcr.c */
+   bool sendJobStatus(int JobStatus);     /* in lib/jcr.c */
    bool JobReads();                       /* in lib/jcr.c */
    void my_thread_send_signal(int sig);   /* in lib/jcr.c */
    void set_killable(bool killable);      /* in lib/jcr.c */
@@ -224,11 +240,14 @@ public:
    uint32_t VolSessionTime;
    uint32_t JobFiles;                 /* Number of files written, this job */
    uint32_t JobErrors;                /* Number of non-fatal errors this job */
+   uint32_t SDErrors;                 /* Number of non-fatal SD errors */
    uint32_t JobWarnings;              /* Number of warning messages */
    uint32_t LastRate;                 /* Last sample bytes/sec */
    uint64_t JobBytes;                 /* Number of bytes processed this job */
    uint64_t LastJobBytes;             /* Last sample number bytes */
-   uint64_t ReadBytes;                /* Bytes read */
+   uint64_t ReadBytes;                /* Bytes read -- before compression */
+   uint64_t CommBytes;                /* FD comm line bytes sent to SD */
+   uint64_t CommCompressedBytes;      /* FD comm line compressed bytes sent to SD */
    FileId_t FileId;                   /* Last FileId used */
    volatile int32_t JobStatus;        /* ready, running, blocked, terminated */
    int32_t JobPriority;               /* Job priority */
@@ -266,12 +285,13 @@ public:
    bool rerunning;                    /* rerunning an incomplete job */
    bool job_started;                  /* Set when the job is actually started */
    bool sd_calls_client;              /* Set for SD to call client (FD/SD) */
+   bool exiting;                      /* Set when exiting */
 
    void *Python_job;                  /* Python Job Object */
    void *Python_events;               /* Python Events Object */
    POOLMEM *attr;                     /* Attribute string from SD */
-   B_DB *db;                          /* database pointer */
-   B_DB *db_batch;                    /* database pointer for batch and accurate */
+   BDB *db;                          /* database pointer */
+   BDB *db_batch;                    /* database pointer for batch and accurate */
    uint64_t nb_base_files;            /* Number of base files */
    uint64_t nb_base_files_used;       /* Number of useful files in base */
 
@@ -287,11 +307,14 @@ public:
    int64_t max_bandwidth;             /* Bandwidth limit for this Job */
    htable *path_list;                 /* Directory list (used by findlib) */
 
+   uint32_t getErrors() { return JobErrors + SDErrors; }; /* Get error count */
+
    /* Daemon specific part of JCR */
    /* This should be empty in the library */
 
 #ifdef DIRECTOR_DAEMON
    /* Director Daemon specific data part of JCR */
+   bool SD_msg_chan_started;          /* True if the msg thread is started */
    pthread_t SD_msg_chan;             /* Message channel thread id */
    pthread_cond_t term_wait;          /* Wait for job termination */
    workq_ele_t *work_item;            /* Work queue item if scheduled */
@@ -315,7 +338,6 @@ public:
    MSGS *messages;                    /* Default message handler */
    uint32_t SDJobFiles;               /* Number of files written, this job */
    uint64_t SDJobBytes;               /* Number of bytes processed this job */
-   uint32_t SDErrors;                 /* Number of non-fatal errors */
    volatile int32_t SDJobStatus;      /* Storage Job Status */
    volatile int32_t FDJobStatus;      /* File daemon Job Status */
    uint32_t ExpectedFiles;            /* Expected restore files */
@@ -323,7 +345,9 @@ public:
    uint32_t FileIndex;                /* Last FileIndex processed */
    utime_t MaxRunSchedTime;           /* max run time in seconds from Initial Scheduled time */
    POOLMEM *fname;                    /* name to put into catalog */
+   POOLMEM *component_fname;          /* Component info file name */
    POOLMEM *media_type;               /* Set if user supplied Storage */
+   FILE *component_fd;                /* Component info file desc */
    JOB_DBR jr;                        /* Job DB record for current job */
    JOB_DBR previous_jr;               /* previous job database record */
    JOB *previous_job;                 /* Job resource of migration previous job */
@@ -348,8 +372,8 @@ public:
    int32_t FDVersion;                 /* File daemon version number */
    int32_t SDVersion;                 /* Storage daemon version number */
    int64_t spool_size;                /* Spool size for this job */
+   utime_t snapshot_retention;        /* Snapshot retention (from Client/Job resource) */
    volatile bool sd_msg_thread_done;  /* Set when Storage message thread done */
-   bool SD_msg_chan_started;          /* Set if message thread started */
    bool wasVirtualFull;               /* set if job was VirtualFull */
    bool IgnoreDuplicateJobChecking;   /* set in migration jobs */
    bool spool_data;                   /* Spool data in SD */
@@ -360,13 +384,14 @@ public:
    bool needs_sd;                     /* set if SD needed by Job */
    bool cloned;                       /* set if cloned */
    bool unlink_bsr;                   /* Unlink bsr file created */
-   bool VSS;                          /* VSS used by FD */
+   bool Snapshot;                     /* Snapshot used by FD (VSS on Windows) */
    bool Encrypt;                      /* Encryption used by FD */
    bool stats_enabled;                /* Keep all job records in a table for long term statistics */
    bool no_maxtime;                   /* Don't check Max*Time for this JCR */
    bool keep_sd_auth_key;             /* Clear or not the SD auth key after connection*/
    bool use_accurate_chksum;          /* Use or not checksum option in accurate code */
    bool run_pool_override;
+   bool cmdline_next_pool_override;   /* Next pool is overridden */
    bool run_next_pool_override;       /* Next pool is overridden */
    bool run_full_pool_override;
    bool run_inc_pool_override;
@@ -380,12 +405,13 @@ public:
 
 #ifdef FILE_DAEMON
    /* File Daemon specific part of JCR */
+   BSOCK *sd_calls_client_bsock;      /* Socket used by SDCallsClient feature */
    uint32_t num_files_examined;       /* files examined this job */
    POOLMEM *last_fname;               /* last file saved/verified */
    POOLMEM *job_metadata;             /* VSS job metadata */
    pthread_cond_t job_start_wait;     /* Wait for SD to start Job */
-   acl_data_t *acl_data;              /* ACLs for backup/restore */
-   xattr_data_t *xattr_data;          /* Extended Attributes for backup/restore */
+   acl_ctx_t *acl_ctx;                /* ACLs for backup/restore */
+   xattr_ctx_t *xattr_ctx;            /* Extended Attributes for backup/restore */
    int32_t last_type;                 /* type of last file saved/verified */
    int incremental;                   /* set if incremental for SINCE */
    time_t last_stat_time;             /* Last time stats sent to Dir */
@@ -415,11 +441,14 @@ public:
    alist *RunScripts;                 /* Commands to run before and after job */
    CRYPTO_CTX crypto;                 /* Crypto ctx */
    DIRRES* director;                  /* Director resource */
-   bool VSS;                          /* VSS used by FD */
+   bool Snapshot;                     /* Snapshot used by FD (or VSS) */
    bool got_metadata;                 /* set when found job_metatdata */
    bool multi_restore;                /* Dir can do multiple storage restore */
+   bool interactive_session;          /* Use interactive session with the SD */
    htable *file_list;                 /* Previous file list (accurate mode) */
    uint64_t base_size;                /* compute space saved with base job */
+   utime_t snapshot_retention;        /* Snapshot retention (from director) */
+   snapshot_manager *snap_mgr;        /* Snapshot manager */
 #endif /* FILE_DAEMON */
 
 
@@ -427,6 +456,7 @@ public:
    /* Storage Daemon specific part of JCR */
    JCR *next_dev;                     /* next JCR attached to device */
    JCR *prev_dev;                     /* previous JCR attached to device */
+   dlist *jobmedia_queue;             /* JobMedia queue */
    char *dir_auth_key;                /* Dir auth key */
    pthread_cond_t job_start_wait;     /* Wait for FD to start Job */
    int32_t type;
@@ -438,7 +468,7 @@ public:
    POOLMEM *fileset_md5;              /* MD5 for FileSet */
    char stored_addr[MAX_NAME_LENGTH]; /* storage daemon address */
    char client_addr[MAX_NAME_LENGTH]; /* client daemon address */
-   VOL_LIST *VolList;                 /* list to read */
+   VOL_LIST *VolList;                 /* list to read, freed at the end of the job */
    int32_t NumWriteVolumes;           /* number of volumes written */
    int32_t NumReadVolumes;            /* total number of volumes to read */
    int32_t CurReadVolume;             /* current read volume number */
@@ -447,6 +477,8 @@ public:
    int32_t FDVersion;                 /* File daemon version number */
    int32_t SDVersion;                 /* Storage daemon version number */
    bool session_opened;
+   bool interactive_session;          /* Interactive session with the FD */
+   bool is_ok_data_sent;              /* the "3000 OK data" has been sent */
    long Ticket;                       /* ticket for this job */
    bool ignore_label_errors;          /* ignore Volume label errors */
    bool spool_attributes;             /* set if spooling attributes */
diff --git a/src/lib/Makefile.in b/src/lib/Makefile.in
index 82ec57e..4726e77 100644
--- a/src/lib/Makefile.in
+++ b/src/lib/Makefile.in
@@ -1,5 +1,7 @@
 #
-
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 @MCOMMON@
 
 # Define library versions
@@ -7,7 +9,6 @@ LIBBAC_LT_RELEASE = @LIBBAC_LT_RELEASE@
 LIBBACCFG_LT_RELEASE = @LIBBACCFG_LT_RELEASE@
 
 #
-
 srcdir =	.
 VPATH = 	.
 .PATH:		.
@@ -35,7 +36,7 @@ INCLUDE_FILES = ../baconfig.h ../bacula.h ../bc_types.h \
 		berrno.h bits.h bpipe.h breg.h bregex.h \
 		bsock.h btime.h btimers.h crypto.h dlist.h \
 		fnmatch.h guid_to_name.h htable.h lex.h \
-		lib.h md5.h mem_pool.h message.h mntent_cache.h \
+		lib.h md5.h mem_pool.h message.h \
 		openssl.h plugins.h protos.h queue.h rblist.h \
 		runscript.h rwlock.h serial.h sellist.h sha1.h \
 		smartall.h status.h tls.h tree.h var.h \
@@ -47,13 +48,13 @@ INCLUDE_FILES = ../baconfig.h ../bacula.h ../bc_types.h \
 # libbac
 #
 LIBBAC_SRCS = attr.c base64.c berrno.c bsys.c binflate.c bget_msg.c \
-	      bnet.c bnet_server.c runscript.c \
-	      bsock.c bpipe.c bsnprintf.c btime.c \
-	      cram-md5.c crc32.c crypto.c daemon.c edit.c fnmatch.c \
+	      crc32.c \
+	      bnet.c bnet_server.c bsock.c bpipe.c bsnprintf.c btime.c \
+	      cram-md5.c crypto.c daemon.c edit.c fnmatch.c \
 	      guid_to_name.c hmac.c jcr.c lex.c alist.c dlist.c \
-	      md5.c message.c mem_pool.c mntent_cache.c openssl.c \
+	      md5.c message.c mem_pool.c openssl.c \
 	      plugins.c priv.c queue.c bregex.c \
-	      rwlock.c scan.c sellist.c serial.c sha1.c \
+	      runscript.c rwlock.c scan.c sellist.c serial.c sha1.c \
 	      signal.c smartall.c rblist.c tls.c tree.c \
 	      util.c var.c watchdog.c workq.c btimers.c \
 	      address_conf.c breg.c htable.c lockmgr.c devlock.c
@@ -68,7 +69,6 @@ LIBBACCFG_SRCS = ini.c parse_conf.c res.c
 LIBBACCFG_OBJS = $(LIBBACCFG_SRCS:.c=.o)
 LIBBACCFG_LOBJS = $(LIBBACCFG_SRCS:.c=.lo)
 
-
 .SUFFIXES:	.c .cc .o .lo .ch .dvi .pdf .tex .view .w .1
 .PHONY:
 .DONTCARE:
@@ -92,9 +92,8 @@ LIBBACCFG_LOBJS = $(LIBBACCFG_SRCS:.c=.lo)
 
 # specific build rules
 
-
 #-------------------------------------------------------------------------
-all: Makefile libbac$(DEFAULT_ARCHIVE_TYPE) libbaccfg$(DEFAULT_ARCHIVE_TYPE) 
+all: Makefile libbac$(DEFAULT_ARCHIVE_TYPE) libbaccfg$(DEFAULT_ARCHIVE_TYPE)
 	@echo "==== Make of lib is good ===="
 	@echo " "
 
@@ -107,12 +106,12 @@ libbac.la: Makefile $(LIBBAC_LOBJS)
 	@echo "Making $@ ..."
 	$(LIBTOOL_LINK) $(CXX) $(DEFS) $(DEBUG) $(LDFLAGS) -o $@ $(LIBBAC_LOBJS) -export-dynamic -rpath $(libdir) -release $(LIBBAC_LT_RELEASE) $(WRAPLIBS) $(CAP_LIBS) $(ZLIBS) $(OPENSSL_LIBS) $(LIBS) $(DLLIBS)
 
-libbaccfg.a: $(LIBBACCFG_OBJS) 
+libbaccfg.a: $(LIBBACCFG_OBJS)
 	@echo "Making $@ ..."
 	$(AR) rc  $@ $(LIBBACCFG_OBJS)
 	$(RANLIB) $@
 
-libbaccfg.la: Makefile $(LIBBACCFG_LOBJS) 
+libbaccfg.la: Makefile $(LIBBACCFG_LOBJS)
 	@echo "Making $@ ..."
 	$(LIBTOOL_LINK) $(CXX) $(DEFS) $(DEBUG) $(LDFLAGS) -o $@ $(LIBBACCFG_LOBJS) -export-dynamic -rpath $(libdir) -release $(LIBBACCFG_LT_RELEASE) $(OPENSSL_LIBS) $(LIBS)
 
@@ -120,21 +119,21 @@ Makefile: $(srcdir)/Makefile.in $(topdir)/config.status
 	cd $(topdir) \
 	  && CONFIG_FILES=$(thisdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
 
-lockmgr_test: Makefile
+lockmgr_test: Makefile lockmgr.c
 	$(RMF) lockmgr.o
 	$(CXX) -D _TEST_IT $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE)  $(CFLAGS) lockmgr.c
 	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L. -o $@ lockmgr.o $(DLIB) -lbac -lm $(LIBS) $(OPENSSL_LIBS)
 	rm -f lockmgr.o
 	$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) lockmgr.c
 
-base64_test: Makefile 
+base64_test: Makefile base64.c
 	$(RMF) base64.o
 	$(CXX) -DBIN_TEST $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE)	$(CFLAGS) base64.c
 	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L. -o $@ base64.o $(DLIB) -lbac -lm $(LIBS) $(OPENSSL_LIBS)
 	rm -f base64.o
 	$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) base64.c
 
-rwlock_test: Makefile
+rwlock_test: Makefile rwlock.c
 	$(RMF) rwlock.o
 	$(CXX) -DTEST_RWLOCK $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE)  $(CFLAGS) rwlock.c
 	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L. -o $@ rwlock.o $(DLIB) -lbac -lm $(LIBS) $(OPENSSL_LIBS)
@@ -155,14 +154,22 @@ htable_test: Makefile
 	$(RMF) htable.o
 	$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) htable.c
 
-crc32sum: Makefile crc32.o	 
-	$(RMF) crc32.o
-	$(CXX) -DCRC32_SUM $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE)  $(CFLAGS) crc32.c
-	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L. -o $@ crc32.o $(DLIB) -lbac -lm $(LIBS) $(OPENSSL_LIBS)
-	$(RMF) crc32.o
-	$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) crc32.c
+sellist_test: Makefile sellist.c
+	$(RMF) sellist.o
+	$(CXX) -DTEST_PROGRAM $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE)	$(CFLAGS) sellist.c
+	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L. -o $@ sellist.o $(DLIB) -lbac -lm $(LIBS) $(OPENSSL_LIBS)
+	$(RMF) sellist.o
+	$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) sellist.c
+
+
+xml_test: Makefile xml.o
+	$(RMF) xml.o
+	$(CXX) -DTEST_PROG $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE)  $(CFLAGS) xml.c
+	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L. -o $@ xml.o $(DLIB) -lbac -lm $(LIBS) $(OPENSSL_LIBS)
+	$(RMF) xml.o
+	$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) xml.c
 
-md5sum: Makefile md5.o	 
+md5sum: Makefile md5.o	
 	$(RMF) md5.o
 	$(CXX) -DMD5_SUM $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE)  $(CFLAGS) md5.c
 	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L. -o $@ md5.o $(DLIB) -lbac -lm $(LIBS) $(OPENSSL_LIBS)
diff --git a/src/lib/address_conf.c b/src/lib/address_conf.c
index 0d5fb07..59dbd0f 100644
--- a/src/lib/address_conf.c
+++ b/src/lib/address_conf.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2004-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *   Configuration file parser for IP-Addresse ipv4 and ipv6
@@ -65,7 +69,7 @@ IPADDR::IPADDR(int af) : type(R_EMPTY)
      saddr4->sin_port = 0xffff;
   }
 #ifdef HAVE_IPV6
-  else if (af  == AF_INET6) {
+  else {
      saddr6->sin6_port = 0xffff;
   }
 #endif
@@ -96,11 +100,11 @@ unsigned short IPADDR::get_port_net_order() const
       port = saddr4->sin_port;
    }
 #ifdef HAVE_IPV6
-   else if (saddr->sa_family == AF_INET6) {
+   else {
       port = saddr6->sin6_port;
    }
 #endif
-   return port;
+    return port;
 }
 
 void IPADDR::set_port_net(unsigned short port)
@@ -109,7 +113,7 @@ void IPADDR::set_port_net(unsigned short port)
       saddr4->sin_port = port;
    }
 #ifdef HAVE_IPV6
-   else if (saddr->sa_family == AF_INET6) {
+   else {
       saddr6->sin6_port = port;
    }
 #endif
@@ -151,6 +155,14 @@ void IPADDR::copy_addr(IPADDR *src)
 #endif
 }
 
+#ifdef NEED_IN6ADDR_ANY
+/* The <netinet/in.h> header shall declare the following external variable
+ * On Oses such as Solaris, it requires to define also XPG4_2 and EXTENSIONS
+ * and we have no real idea on what it will change.
+ */
+extern const struct in6_addr in6addr_any;
+#endif
+
 void IPADDR::set_addr_any()
 {
    if (saddr->sa_family == AF_INET) {
@@ -201,11 +213,10 @@ const char *IPADDR::get_address(char *outputbuf, int outlen)
 const char *IPADDR::build_address_str(char *buf, int blen)
 {
    char tmp[1024];
-   *buf = 0;
    if (get_family() == AF_INET) {
       bsnprintf(buf, blen, "%s:%hu ",
                 get_address(tmp, sizeof(tmp) - 1), get_port_host_order());
-   } else if (get_family() == AF_INET6) {
+   } else {
       bsnprintf(buf, blen, "[%s]:%hu ",
                 get_address(tmp, sizeof(tmp) - 1), get_port_host_order());
    }
@@ -575,7 +586,7 @@ int sockaddr_get_port_net_order(const struct sockaddr *client_addr)
       return ((struct sockaddr_in *)client_addr)->sin_port;
    }
 #ifdef HAVE_IPV6
-   else if (client_addr->sa_family == AF_INET6) {
+   else {
       return ((struct sockaddr_in6 *)client_addr)->sin6_port;
    }
 #endif
@@ -588,7 +599,7 @@ int sockaddr_get_port(const struct sockaddr *client_addr)
       return ntohs(((struct sockaddr_in *)client_addr)->sin_port);
    }
 #ifdef HAVE_IPV6
-   else if (client_addr->sa_family == AF_INET6) {
+   else {
       return ntohs(((struct sockaddr_in6 *)client_addr)->sin6_port);
    }
 #endif
diff --git a/src/lib/address_conf.h b/src/lib/address_conf.h
index 1035946..e745b36 100644
--- a/src/lib/address_conf.h
+++ b/src/lib/address_conf.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2004-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
diff --git a/src/lib/alist.c b/src/lib/alist.c
index c569a04..38a197f 100644
--- a/src/lib/alist.c
+++ b/src/lib/alist.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2003-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *  Bacula array list routines
diff --git a/src/lib/alist.h b/src/lib/alist.h
index 0f89ed3..0964149 100644
--- a/src/lib/alist.h
+++ b/src/lib/alist.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2003-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *  Kern Sibbald, June MMIII
diff --git a/src/lib/attr.c b/src/lib/attr.c
index b6df46b..595cebd 100644
--- a/src/lib/attr.c
+++ b/src/lib/attr.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2003-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *   attr.c  Unpack an Attribute record returned from the tape
@@ -87,7 +91,7 @@ int unpack_attributes_record(JCR *jcr, int32_t stream, char *rec, int32_t reclen
    while (*p++ != ' ')               /* skip type */
       { }
 
-   attr->fname = p;                   /* set filname position */
+   attr->fname = p;                   /* set filename position */
    while (*p++ != 0)                  /* skip filename */
       { }
    attr->attr = p;                    /* set attributes position */
diff --git a/src/lib/attr.h b/src/lib/attr.h
index 495c178..d8d7a31 100644
--- a/src/lib/attr.h
+++ b/src/lib/attr.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2003-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *   attr.h Definition of attributes packet for unpacking from tape
diff --git a/src/lib/base64.c b/src/lib/base64.c
index 0ffdeae..deb2cae 100644
--- a/src/lib/base64.c
+++ b/src/lib/base64.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *   Generic base 64 input and output routines
@@ -237,13 +241,13 @@ int base64_to_bin(char *dest, int dest_size, char *src, int srclen)
 #ifdef BIN_TEST
 int main(int argc, char *argv[])
 {
-   int xx = 0;
    int len;
    char buf[100];
    char junk[100];
    int i;
 
 #ifdef xxxx
+   int xx = 0;
    for (i=0; i < 1000; i++) {
       bin_to_base64(buf, sizeof(buf), (char *)&xx, 4, true);
       printf("xx=%s\n", buf);
diff --git a/src/lib/base64.h b/src/lib/base64.h
index a6fc1a5..6313482 100644
--- a/src/lib/base64.h
+++ b/src/lib/base64.h
@@ -1,25 +1,27 @@
 /*
- *   Generic base 64 input and output routines
- *
- *    Written by Kern E. Sibbald, March MM.
- *
- *   Version $Id$
- */
-/*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
+/*
+ *   Generic base 64 input and output routines
+ *
+ *    Written by Kern E. Sibbald, March MM.
+ */
 
 /* Maximum size of len bytes after base64 encoding */
 #define BASE64_SIZE(len) ((4 * len + 2) / 3 + 1)
diff --git a/src/lib/berrno.c b/src/lib/berrno.c
index 8f3968b..382683c 100644
--- a/src/lib/berrno.c
+++ b/src/lib/berrno.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2004-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *  Bacula errno handler
@@ -21,7 +25,7 @@
  *
  *    See berrno.h for how to use berrno.
  *
- *   Written by Kern Sibbald, July MMIV
+ *   Kern Sibbald, July MMIV
  *
  *
  */
@@ -38,7 +42,7 @@ const char *berrno::bstrerror()
 {
    *m_buf = 0;
 #ifdef HAVE_WIN32
-   if (m_berrno & (b_errno_win32)) {
+   if (m_berrno & (b_errno_win32 | b_errno_WSA)) {
       format_win32_message();
       return (const char *)m_buf;
    }
@@ -84,7 +88,7 @@ void berrno::format_win32_message()
    FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER |
        FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
        NULL,
-       GetLastError(),
+       m_berrno & b_errno_WSA ? WSAGetLastError() : GetLastError(),
        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
        (LPTSTR)&msg,
        0,
diff --git a/src/lib/berrno.h b/src/lib/berrno.h
index f524c28..e6b099b 100644
--- a/src/lib/berrno.h
+++ b/src/lib/berrno.h
@@ -1,21 +1,25 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2004-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
- *   Written by Kern Sibbald, July MMIV
+ * Kern Sibbald, July MMIV
  *
  */
 
@@ -24,6 +28,7 @@
  */
 #ifdef HAVE_WIN32
 #define b_errno_win32  (1<<29)        /* user reserved bit */
+#define b_errno_WSA    (1<<26)
 #else
 #define b_errno_win32  0              /* On Unix/Linix system */
 #endif
diff --git a/src/lib/bget_msg.c b/src/lib/bget_msg.c
index 2a8a6a6..ff9b0e4 100644
--- a/src/lib/bget_msg.c
+++ b/src/lib/bget_msg.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *  Subroutines to receive network data and handle
@@ -21,7 +25,8 @@
  *
  */
 
-#include "bacula.h"                   /* pull in global headers */
+#include "bacula.h"
+#include "jcr.h"
 
 static char OK_msg[]   = "2000 OK\n";
 static char TERM_msg[] = "2999 Terminate\n";
@@ -38,6 +43,7 @@ static char TERM_msg[] = "2999 Terminate\n";
  * Returns -1 on signal (BNET_SIGNAL)
  * Returns -2 on hard end of file (BNET_HARDEOF)
  * Returns -3 on error  (BNET_ERROR)
+ * Returns -4 on Command (BNET_COMMAND)
  */
 int bget_msg(BSOCK *sock)
 {
@@ -91,3 +97,69 @@ int bget_msg(BSOCK *sock)
       }
    }
 }
+
+bmessage::bmessage(int bufsize)
+{
+   msg = get_pool_memory(PM_BSOCK);
+   msg = realloc_pool_memory(msg, bufsize);
+   status = bmessage::bm_busy;
+   jobbytes = 0;
+}
+
+bmessage::~bmessage()
+{
+   free_pool_memory(msg);
+}
+
+void bmessage::swap(BSOCK *sock)
+{
+   POOLMEM *swap = sock->msg;
+   sock->msg = msg;
+   msg = swap;
+}
+
+GetMsg::GetMsg(JCR *a_jcr, BSOCK *a_bsock, const char *a_rec_header, int32_t a_bufsize):
+      jcr(a_jcr),
+      bsock(a_bsock),
+      rec_header(a_rec_header),
+      bufsize(a_bufsize),
+      m_is_stop(false),
+      m_is_done(false),
+      m_is_error(false),
+      m_use_count(1)
+{
+   jcr->inc_use_count();        /* We own a copy of the JCR */
+   bmsg_aux = New(bmessage(bufsize));
+   bmsg = bmsg_aux;
+   pthread_mutex_init(&mutex, 0);
+   pthread_cond_init(&cond, NULL);
+};
+
+GetMsg::~GetMsg()
+{
+   free_jcr(jcr);               /* Release our copy of the JCR */
+   delete bmsg_aux;
+   pthread_mutex_destroy(&mutex);
+   pthread_cond_destroy(&cond);
+};
+
+int GetMsg::bget_msg(bmessage **pbmsg)
+{
+   // Get our own local copy of the socket
+
+   if (pbmsg == NULL) {
+      pbmsg = &bmsg_aux;
+   }
+   bmessage *bmsg = *pbmsg;
+   bmsg->ret = ::bget_msg(bsock);
+   bmsg->status = bmessage::bm_ready;
+   bmsg->rbuflen = bmsg->msglen = bmsg->origlen = bsock->msglen;
+/*   bmsg->is_header = !bmsg->is_header; ALAIN SAYS: I think this line is useless */
+   /* swap msg instead of copying */
+   bmsg->swap(bsock);
+   bmsg->rbuf = bmsg->msg;
+
+   msglen = bmsg->msglen;
+   msg = bmsg->msg;
+   return bmsg->ret;
+}
diff --git a/src/lib/bget_msg.h b/src/lib/bget_msg.h
new file mode 100644
index 0000000..fa8f011
--- /dev/null
+++ b/src/lib/bget_msg.h
@@ -0,0 +1,111 @@
+/*
+   Bacula(R) - The Network Backup Solution
+
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2013-2014 Free Software Foundation Europe e.V.
+
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
+
+   You may use this file and others of this release according to the
+   license defined in the LICENSE file, which includes the Affero General
+   Public License, v3.0 ("AGPLv3") and some additional permissions and
+   terms pursuant to its AGPLv3 Section 7.
+
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
+
+#ifndef __BGET_MSG_H_
+#define __BGET_MSG_H_
+
+#include "bacula.h"
+
+typedef uint64_t blockaddr;
+typedef int64_t  blockidx;
+
+#ifdef COMMUNITY
+#define BLOCK_HEAD_SIZE               4       // only one int
+#define GETMSG_MAX_BLOCK_SIZE    (65*1024-BLOCK_HEAD_SIZE)
+#define GETMSG_MAX_HASH_SIZE     64  /* SHA512 */
+#define GETMSG_MAX_MSG_SIZE      (GETMSG_MAX_BLOCK_SIZE+GETMSG_MAX_HASH_SIZE+sizeof(uint32_t)+OFFSET_FADDR_SIZE+100)
+#endif
+
+
+class bmessage: public SMARTALLOC
+{
+public:
+   enum { bm_none, bm_ready, bm_busy, bm_ref };
+
+   POOLMEM *msg;    // exchanged with BSOCK
+   int32_t msglen;  // length from BSOCK
+   int32_t origlen; // length before rehydration, to be compared with length in header
+   char *rbuf;      // adjusted to point to data inside *msg
+   int32_t rbuflen; // adjusted from msglen
+   int status;
+   int ret;         // return value from bget_msg()
+   int jobbytes;    // must be added to jcr->JobBytes if block is downloaded
+
+   bmessage(int bufsize);
+   virtual ~bmessage();
+   void swap(BSOCK *sock);
+};
+
+class GetMsg: public SMARTALLOC
+{
+public:
+   JCR *jcr;
+   BSOCK *bsock;
+   const char *rec_header;        /* Format of a header */
+   int32_t bufsize;               /* "ideal" bufsize from JCR */
+
+   bool m_is_stop;                /* set by the read thread when bsock->is_stop() */
+   bool m_is_done;                /* set when the read thread finish (no more record will be pushed) */
+   bool m_is_error;               /* set when the read thread get an error */
+
+   int32_t m_use_count;
+
+   pthread_mutex_t mutex;
+   pthread_cond_t cond;
+   bmessage *bmsg_aux;
+   bmessage *bmsg;   // local bmsg used by bget_msg(NULL)
+   int32_t msglen;   // used to mimic BSOCK, updated by bget_msg()
+   POOLMEM *msg;     // used to mimic BSOCK, updated by bget_msg()
+
+   void inc_use_count(void) {P(mutex); m_use_count++; V(mutex); };
+   void dec_use_count(void) {P(mutex); m_use_count--; V(mutex); };
+   int32_t use_count() { int32_t v; P(mutex); v = m_use_count; V(mutex); return v;};
+
+
+   GetMsg(JCR *a_jcr, BSOCK *a_bsock, const char *a_rec_header, int32_t a_bufsize);
+   virtual ~GetMsg();
+
+   virtual int bget_msg(bmessage **pbmsg=NULL);
+   inline virtual void *do_read_sock_thread(void) { return NULL; };
+   inline virtual int start_read_sock() { return 0; };
+   inline virtual void *wait_read_sock() { return NULL;};
+
+   virtual bool is_stop() { return (m_is_stop!=false); };
+   virtual bool is_done() { return (m_is_done!=false); };
+   virtual bool is_error(){ return (m_is_error!=false); };
+
+   bmessage *new_msg() { return New(bmessage(bufsize)); };
+
+};
+
+/* Call this function to release the memory associated with the message queue
+ * The reading thread is using the BufferedMsgBase to work, so we need to free
+ * the memory only when the main thread and the reading thread agree
+ */
+inline void free_GetMsg(GetMsg *b)
+{
+   b->dec_use_count();
+   ASSERT2(b->use_count() >= 0, "GetMsg use_count too low");
+   if (b->use_count() == 0) {
+      delete b;
+   }
+}
+
+#endif
diff --git a/src/lib/binflate.c b/src/lib/binflate.c
index 3e4cb2e..9cd73f2 100644
--- a/src/lib/binflate.c
+++ b/src/lib/binflate.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2010-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Bacula zlib compression wrappers
diff --git a/src/lib/bits.h b/src/lib/bits.h
index d961203..4974700 100644
--- a/src/lib/bits.h
+++ b/src/lib/bits.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /* Some elementary bit manipulations
  *
diff --git a/src/lib/bnet.c b/src/lib/bnet.c
index f61929f..52c8e05 100644
--- a/src/lib/bnet.c
+++ b/src/lib/bnet.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Network Utility Routines
@@ -33,6 +37,8 @@
 #endif
 
 #ifdef HAVE_WIN32
+#undef inet_pton
+#define inet_pton binet_pton
 #define socketRead(fd, buf, len)  recv(fd, buf, len, 0)
 #define socketWrite(fd, buf, len) send(fd, buf, len, 0)
 #define socketClose(fd)           closesocket(fd)
@@ -73,7 +79,7 @@ int32_t read_nbytes(BSOCK * bsock, char *ptr, int32_t nbytes)
 
 #ifdef HAVE_WIN32
       /*
-       * For Windows, we must simulate Unix errno on a socket
+       * We simulate errno on Windows for a socket
        *  error in order to handle errors correctly.
        */
       if (nread == SOCKET_ERROR) {
@@ -151,7 +157,7 @@ int32_t write_nbytes(BSOCK * bsock, char *ptr, int32_t nbytes)
 
 #ifdef HAVE_WIN32
          /*
-          * For Windows, we must simulate Unix errno on a socket
+          * We simulate errno on Windows for a socket
           *  error in order to handle errors correctly.
           */
          if (nwritten == SOCKET_ERROR) {
@@ -322,65 +328,61 @@ bool bnet_tls_client(TLS_CONTEXT *ctx, BSOCK * bsock, alist *verify_list)
 #define NO_DATA         4          /* Valid name, no data record of requested type. */
 #endif
 
-#if HAVE_GETADDRINFO
-const char *resolv_host(int family, const char *host, dlist *addr_list)
-{
-   int res;
-   struct addrinfo hints;
-   struct addrinfo *ai, *rp;
-   IPADDR *addr;
-
-   memset(&hints, 0, sizeof(struct addrinfo));
-   hints.ai_family = family;
-   hints.ai_socktype = SOCK_STREAM;
-   hints.ai_protocol = IPPROTO_TCP;
-   hints.ai_flags = 0;
-
-   res = getaddrinfo(host, NULL, &hints, &ai);
-   if (res != 0) {
-      return gai_strerror(res);
-   }
-
-   for (rp = ai; rp != NULL; rp = rp->ai_next) {
-      switch (rp->ai_addr->sa_family) {
-      case AF_INET:
-         addr = New(IPADDR(rp->ai_addr->sa_family));
-         addr->set_type(IPADDR::R_MULTIPLE);
-         /*
-          * Some serious casting to get the struct in_addr *
-          * rp->ai_addr == struct sockaddr
-          * as this is AF_INET family we can cast that
-          * to struct_sockaddr_in. Of that we need the
-          * address of the sin_addr member which contains a
-          * struct in_addr
-          */
-         addr->set_addr4(&(((struct sockaddr_in *)rp->ai_addr)->sin_addr));
-         break;
-#ifdef HAVE_IPV6
-      case AF_INET6:
-         addr = New(IPADDR(rp->ai_addr->sa_family));
-         addr->set_type(IPADDR::R_MULTIPLE);
-         /*
-          * Some serious casting to get the struct in6_addr *
-          * rp->ai_addr == struct sockaddr
-          * as this is AF_INET6 family we can cast that
-          * to struct_sockaddr_in6. Of that we need the
-          * address of the sin6_addr member which contains a
-          * struct in6_addr
-          */
-         addr->set_addr6(&(((struct sockaddr_in6 *)rp->ai_addr)->sin6_addr));
-         break;
-#endif
-      default:
-         continue;
-      }
-      addr_list->append(addr);
-   }
-   freeaddrinfo(ai);
-   return NULL;
-}
-
-#else
+#if defined(HAVE_GETADDRINFO)
+/* 
+ * getaddrinfo.c - Simple example of using getaddrinfo(3) function.
+ * 
+ * Michal Ludvig <michal at logix.cz> (c) 2002, 2003
+ * http://www.logix.cz/michal/devel/
+ *
+ * License: public domain.
+ */
+const char *resolv_host(int family, const char *host, dlist *addr_list) 
+{ 
+   IPADDR *ipaddr;
+   struct addrinfo hints, *res, *rp;
+   int errcode;
+   //char addrstr[100];
+   void *ptr;
+
+   memset (&hints, 0, sizeof(hints));
+   hints.ai_family = family; 
+   hints.ai_socktype = SOCK_STREAM; 
+   //hints.ai_flags |= AI_CANONNAME;
+
+   errcode = getaddrinfo (host, NULL, &hints, &res);
+   if (errcode != 0) return gai_strerror(errcode);
+
+   for (rp=res; res; res=res->ai_next) {
+      //inet_ntop (res->ai_family, res->ai_addr->sa_data, addrstr, 100);
+      switch (res->ai_family) {
+      case AF_INET: 
+         ipaddr = New(IPADDR(rp->ai_addr->sa_family));
+         ipaddr->set_type(IPADDR::R_MULTIPLE);
+         ptr = &((struct sockaddr_in *) res->ai_addr)->sin_addr;
+         ipaddr->set_addr4((in_addr *)ptr);
+         break; 
+#if defined(HAVE_IPV6)
+      case AF_INET6: 
+         ipaddr = New(IPADDR(rp->ai_addr->sa_family));
+         ipaddr->set_type(IPADDR::R_MULTIPLE);
+         ptr = &((struct sockaddr_in6 *) res->ai_addr)->sin6_addr;
+         ipaddr->set_addr6((in6_addr *)ptr);
+         break; 
+#endif 
+      default: 
+         continue; 
+      } 
+      //inet_ntop (res->ai_family, ptr, addrstr, 100);
+      //Pmsg3(000, "IPv%d address: %s (%s)\n", res->ai_family == PF_INET6 ? 6 : 4,
+      //         addrstr, res->ai_canonname);
+      addr_list->append(ipaddr);
+   } 
+   freeaddrinfo(rp);
+   return NULL; 
+} 
+
+#else 
 
 /*
  * Get human readable error for gethostbyname()
@@ -439,15 +441,14 @@ static const char *resolv_host(int family, const char *host, dlist * addr_list)
          IPADDR *addr =  New(IPADDR(hp->h_addrtype));
          addr->set_type(IPADDR::R_MULTIPLE);
          if (addr->get_family() == AF_INET) {
-            addr->set_addr4((struct in_addr*)*p);
-            addr_list->append(addr);
+             addr->set_addr4((struct in_addr*)*p);
          }
 #ifdef HAVE_IPV6
-         else if (addr->get_family() == AF_INET6) {
-            addr->set_addr6((struct in6_addr*)*p);
-            addr_list->append(addr);
+         else {
+             addr->set_addr6((struct in6_addr*)*p);
          }
 #endif
+         addr_list->append(addr);
       }
       V(ip_mutex);
    }
@@ -464,7 +465,7 @@ static IPADDR *add_any(int family)
 }
 
 /*
- * i host = 0 mean INADDR_ANY only ipv4
+ * i host = 0 means INADDR_ANY only for IPv4
  */
 dlist *bnet_host2ipaddrs(const char *host, int family, const char **errstr)
 {
@@ -491,13 +492,13 @@ dlist *bnet_host2ipaddrs(const char *host, int family, const char **errstr)
       addr->set_addr4(&inaddr);
       addr_list->append(addr);
 #ifdef HAVE_IPV6
-   } else if (inet_pton(AF_INET6, host, &inaddr6) == 1) {
+   } else if (inet_pton(AF_INET6, host, &inaddr6) == 1) { 
       addr = New(IPADDR(AF_INET6));
       addr->set_type(IPADDR::R_MULTIPLE);
       addr->set_addr6(&inaddr6);
       addr_list->append(addr);
 #endif
-   } else {
+   } else { 
       if (family != 0) {
          errmsg = resolv_host(family, host, addr_list);
          if (errmsg) {
@@ -529,10 +530,10 @@ dlist *bnet_host2ipaddrs(const char *host, int family, const char **errstr)
  * Convert a network "signal" code into
  * human readable ASCII.
  */
-const char *bnet_sig_to_ascii(BSOCK * bs)
+const char *bnet_sig_to_ascii(int32_t msglen)
 {
    static char buf[30];
-   switch (bs->msglen) {
+   switch (msglen) {
    case BNET_EOD:
       return "BNET_EOD";           /* end of data stream */
    case BNET_EOD_POLL:
@@ -552,7 +553,7 @@ const char *bnet_sig_to_ascii(BSOCK * bs)
    case BNET_TEXT_INPUT:
       return "BNET_TEXT_INPUT";
    default:
-      sprintf(buf, _("Unknown sig %d"), (int)bs->msglen);
+      bsnprintf(buf, sizeof(buf), _("Unknown sig %d"), (int)msglen);
       return buf;
    }
 }
@@ -570,6 +571,7 @@ BSOCK *init_bsock(JCR * jcr, int sockfd, const char *who, const char *host, int
    bsock->tls = NULL;
    bsock->errors = 0;
    bsock->m_blocking = 1;
+   bsock->pout_msg_no = &bsock->out_msg_no;
    bsock->msg = get_pool_memory(PM_BSOCK);
    bsock->errmsg = get_pool_memory(PM_MESSAGE);
    bsock->set_who(bstrdup(who));
@@ -585,6 +587,7 @@ BSOCK *init_bsock(JCR * jcr, int sockfd, const char *who, const char *host, int
 BSOCK *dup_bsock(BSOCK *osock)
 {
    BSOCK *bsock = (BSOCK *)malloc(sizeof(BSOCK));
+   osock->set_locking();
    memcpy(bsock, osock, sizeof(BSOCK));
    bsock->msg = get_pool_memory(PM_BSOCK);
    bsock->errmsg = get_pool_memory(PM_MESSAGE);
diff --git a/src/lib/bnet_server.c b/src/lib/bnet_server.c
index f00e8da..354320d 100644
--- a/src/lib/bnet_server.c
+++ b/src/lib/bnet_server.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
  /*
   * Originally written by Kern Sibbald for inclusion in apcupsd,
@@ -51,17 +55,15 @@ void bnet_stop_thread_server(pthread_t tid)
    }
 }
 
-/*
- * Become Threaded Network Server
- *
- * This function is able to handle multiple server ips in
- * ipv4 and ipv6 style. The Addresses are given in a comma
- * seperated string in bind_addr
- *
- * At the moment it is inpossible to bind different ports.
- */
-void bnet_thread_server(dlist *addr_list, int max_clients, workq_t *client_wq,
-                        void *handle_client_request(void *bsock))
+ /*
+     Become Threaded Network Server
+     This function is able to handle multiple server ips in
+     ipv4 and ipv6 style. The Addresse are give in a comma
+     seperated string in bind_addr
+     In the moment it is inpossible to bind different ports.
+  */
+void bnet_thread_server(dlist *addrs, int max_clients, 
+        workq_t *client_wq, void *handle_client_request(void *bsock))
 {
    int newsockfd, stat;
    socklen_t clilen;
@@ -71,7 +73,7 @@ void bnet_thread_server(dlist *addr_list, int max_clients, workq_t *client_wq,
 #ifdef HAVE_LIBWRAP
    struct request_info request;
 #endif
-   IPADDR *ipaddr;
+   IPADDR *addr;
    struct s_sockfd {
       dlink link;                     /* this MUST be the first item */
       int fd;
@@ -81,29 +83,26 @@ void bnet_thread_server(dlist *addr_list, int max_clients, workq_t *client_wq,
    dlist sockfds;
 
    char allbuf[256 * 10];
-
-   remove_duplicate_addresses(addr_list);
-
-   Dmsg1(20, "Addresses %s\n", build_addresses_str(addr_list, allbuf, sizeof(allbuf)));
-
+   remove_duplicate_addresses(addrs);
+   Dmsg1(20, "Addresses %s\n", build_addresses_str(addrs, allbuf, sizeof(allbuf)));
    /*
     * Listen on each address provided.
     */
-   foreach_dlist(ipaddr, addr_list) {
+   foreach_dlist(addr, addrs) {
       /* Allocate on stack from -- no need to free */
       fd_ptr = (s_sockfd *)alloca(sizeof(s_sockfd));
-      fd_ptr->port = ipaddr->get_port_net_order();
+      fd_ptr->port = addr->get_port_net_order();
       /*
        * Open a TCP socket
        */
-      for (tlog= 60; (fd_ptr->fd=socket(ipaddr->get_family(), SOCK_STREAM, 0)) < 0; tlog -= 10) {
+      for (tlog= 60; (fd_ptr->fd=socket(addr->get_family(), SOCK_STREAM, 0)) < 0; tlog -= 10) {
          if (tlog <= 0) {
             berrno be;
             char curbuf[256];
             Emsg3(M_ABORT, 0, _("Cannot open stream socket. ERR=%s. Current %s All %s\n"),
                        be.bstrerror(),
-                       ipaddr->build_address_str(curbuf, sizeof(curbuf)),
-                       build_addresses_str(addr_list, allbuf, sizeof(allbuf)));
+                       addr->build_address_str(curbuf, sizeof(curbuf)),
+                       build_addresses_str(addrs, allbuf, sizeof(allbuf)));
          }
          bmicrosleep(10, 0);
       }
@@ -118,7 +117,7 @@ void bnet_thread_server(dlist *addr_list, int max_clients, workq_t *client_wq,
       }
 
       int tmax = 1 * (60 / 5);    /* wait 1 minute max */
-      for (tlog = 0; bind(fd_ptr->fd, ipaddr->get_sockaddr(), ipaddr->get_sockaddr_len()) == SOCKET_ERROR; tlog -= 5) {
+      for (tlog = 0; bind(fd_ptr->fd, addr->get_sockaddr(), addr->get_sockaddr_len()) == SOCKET_ERROR; tlog -= 5) {
          berrno be;
          if (tlog <= 0) {
             tlog = 1 * 60;         /* Complain every 1 minute */
diff --git a/src/lib/bpipe.c b/src/lib/bpipe.c
index 44c5164..81d673f 100644
--- a/src/lib/bpipe.c
+++ b/src/lib/bpipe.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2002-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *   bpipe.c bi-directional pipe
@@ -60,7 +64,7 @@ void build_sh_argc_argv(char *cmd, int *bargc, char *bargv[], int max_arg)
  *   a bi-directional pipe so that the user can read from and
  *   write to the program.
  */
-BPIPE *open_bpipe(char *prog, int wait, const char *mode)
+BPIPE *open_bpipe(char *prog, int wait, const char *mode, char *envp[])
 {
    char *bargv[MAX_ARGV];
    int bargc, i;
@@ -143,6 +147,13 @@ BPIPE *open_bpipe(char *prog, int wait, const char *mode)
       for (i=3; i<=32; i++) {         /* close any open file descriptors */
          close(i);
       }
+
+      /* Setup the environment if requested, we do not use execvpe()
+       * because it's not wildly available
+       * TODO: Implement envp to windows version of bpipe
+       */
+      setup_env(envp);
+
       execvp(bargv[0], bargv);        /* call the program */
       /* Convert errno into an exit code for later analysis */
       for (i=0; i< num_execvp_errors; i++) {
@@ -388,7 +399,7 @@ int run_program(char *prog, int wait, POOLMEM *&results)
  *           non-zero on error == berrno status
  *
  */
-int run_program_full_output(char *prog, int wait, POOLMEM *&results)
+int run_program_full_output(char *prog, int wait, POOLMEM *&results, char *env[])
 {
    BPIPE *bpipe;
    int stat1, stat2;
@@ -405,7 +416,7 @@ int run_program_full_output(char *prog, int wait, POOLMEM *&results)
 
    results[0] = 0;
    mode = (char *)"r";
-   bpipe = open_bpipe(prog, wait, mode);
+   bpipe = open_bpipe(prog, wait, mode, env);
    if (!bpipe) {
       stat1 = ENOENT;
       goto bail_out;
diff --git a/src/lib/bpipe.h b/src/lib/bpipe.h
index d49f3a9..038be35 100644
--- a/src/lib/bpipe.h
+++ b/src/lib/bpipe.h
@@ -1,22 +1,24 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2002-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *   Bi-directional pipe structure
- *
- *   Version $Id$
  */
 
 class BPIPE {
diff --git a/src/lib/breg.c b/src/lib/breg.c
index 893e8ba..6358796 100644
--- a/src/lib/breg.c
+++ b/src/lib/breg.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2006-2014 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Manipulation routines for BREGEXP list
@@ -243,19 +247,19 @@ char *BREGEXP::return_fname(const char *fname, int len)
    return result;
 }
 
-int BREGEXP::compute_dest_len(const char *fname, regmatch_t pmatch[])
+int BREGEXP::compute_dest_len(const char *fname, regmatch_t breg[])
 {
    int len=0;
    char *p;
    char *psubst = subst;
    int no;
 
-   if (!fname || !pmatch) {
+   if (!fname || !breg) {
       return 0;
    }
 
    /* match failed ? */
-   if (pmatch[0].rm_so < 0) {
+   if (breg[0].rm_so < 0) {
       return 0;
    }
 
@@ -267,8 +271,8 @@ int BREGEXP::compute_dest_len(const char *fname, regmatch_t pmatch[])
          /* we check if the back reference exists */
          /* references can not match if we are using (..)? */
 
-         if (pmatch[no].rm_so >= 0 && pmatch[no].rm_eo >= 0) {
-            len += pmatch[no].rm_eo - pmatch[no].rm_so;
+         if (breg[no].rm_so >= 0 && breg[no].rm_eo >= 0) {
+            len += breg[no].rm_eo - breg[no].rm_so;
          }
 
       } else {
@@ -277,13 +281,13 @@ int BREGEXP::compute_dest_len(const char *fname, regmatch_t pmatch[])
    }
 
    /* $0 is replaced by subst */
-   len -= pmatch[0].rm_eo - pmatch[0].rm_so;
+   len -= breg[0].rm_eo - breg[0].rm_so;
    len += strlen(fname) + 1;
 
    return len;
 }
 
-char *BREGEXP::edit_subst(const char *fname, regmatch_t pmatch[])
+char *BREGEXP::edit_subst(const char *fname, regmatch_t breg[])
 {
    int i;
    char *p;
@@ -292,10 +296,10 @@ char *BREGEXP::edit_subst(const char *fname, regmatch_t pmatch[])
    int len;
 
    /* il faut recopier fname dans dest
-    *  on recopie le debut fname -> pmatch->start[0]
+    *  on recopie le debut fname -> breg->start[0]
     */
 
-   for (i = 0; i < pmatch[0].rm_so ; i++) {
+   for (i = 0; i < breg[0].rm_so ; i++) {
       result[i] = fname[i];
    }
 
@@ -307,9 +311,9 @@ char *BREGEXP::edit_subst(const char *fname, regmatch_t pmatch[])
          no = *psubst++ - '0';
 
          /* have a back reference ? */
-         if (pmatch[no].rm_so >= 0 && pmatch[no].rm_eo >= 0) {
-            len = pmatch[no].rm_eo - pmatch[no].rm_so;
-            bstrncpy(result + i, fname + pmatch[no].rm_so, len + 1);
+         if (breg[no].rm_so >= 0 && breg[no].rm_eo >= 0) {
+            len = breg[no].rm_eo - breg[no].rm_so;
+            bstrncpy(result + i, fname + breg[no].rm_so, len + 1);
             i += len ;
          }
 
@@ -319,7 +323,7 @@ char *BREGEXP::edit_subst(const char *fname, regmatch_t pmatch[])
    }
 
    /* we copy what is out of the match */
-   strcpy(result + i, fname + pmatch[0].rm_eo);
+   strcpy(result + i, fname + breg[0].rm_eo);
 
    return result;
 }
diff --git a/src/lib/breg.h b/src/lib/breg.h
index cfb19d9..e364860 100644
--- a/src/lib/breg.h
+++ b/src/lib/breg.h
@@ -1,23 +1,26 @@
 /*
- * Bacula BREGEXP Structure definition for FileDaemon
- * Eric Bollengier March 2007
- * Version $Id$
- */
-/*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2006-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
+/*
+ * Bacula BREGEXP Structure definition for FileDaemon
+ * Eric Bollengier March 2007
+ */
 
 
 #ifndef __BREG_H_
@@ -63,8 +66,8 @@ public:
    char *eor;                   /* end of regexp in expr */
 
    char *return_fname(const char *fname, int len); /* return fname as result */
-   char *edit_subst(const char *fname, regmatch_t pmatch[]);
-   int compute_dest_len(const char *fname, regmatch_t pmatch[]);
+   char *edit_subst(const char *fname, regmatch_t breg[]);
+   int compute_dest_len(const char *fname, regmatch_t breg[]);
    bool extract_regexp(const char *motif);
 };
 
diff --git a/src/lib/bregex.c b/src/lib/bregex.c
index b6ef5d6..5ac6e6d 100644
--- a/src/lib/bregex.c
+++ b/src/lib/bregex.c
@@ -33,19 +33,23 @@
  *    Eric Bollengier April 2007
  */
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2006-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 
 
@@ -1488,7 +1492,7 @@ int regexec(regex_t * preg, const char *string, size_t nmatch,
    int len = strlen(string);
    struct re_registers regs;
    stat = re_search(preg, (unsigned char *)string, len, 0, len, &regs);
-   if (stat >= 0) {
+   if (stat >= 0 && nmatch > 0) {
       re_registers_to_regmatch(&regs, pmatch, nmatch);
    }
    /* stat is the start position in the string base 0 where
diff --git a/src/lib/bregex.h b/src/lib/bregex.h
index d115ef8..1a40e19 100644
--- a/src/lib/bregex.h
+++ b/src/lib/bregex.h
@@ -25,19 +25,23 @@ extern "C" {
  *     Kern Sibbald April, 2006
  */
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2006-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 
 #ifndef REGEXPR_H
diff --git a/src/lib/bsnprintf.c b/src/lib/bsnprintf.c
index a1f21a6..f669f52 100644
--- a/src/lib/bsnprintf.c
+++ b/src/lib/bsnprintf.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2005-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Copyright Patrick Powell 1995
diff --git a/src/lib/bsock.c b/src/lib/bsock.c
index d947ba0..6daef47 100644
--- a/src/lib/bsock.c
+++ b/src/lib/bsock.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Network Utility Routines
@@ -25,26 +29,17 @@
 #include <netdb.h>
 #include <netinet/tcp.h>
 
-#ifndef ENODATA                    /* not defined on BSD systems */
-#define ENODATA EPIPE
-#endif
-
-#ifndef SOL_TCP
-#define SOL_TCP IPPROTO_TCP
-#endif
-
-#ifdef HAVE_WIN32
-#include <mswsock.h>
-#define socketRead(fd, buf, len)  ::recv(fd, buf, len, 0)
-#define socketWrite(fd, buf, len) ::send(fd, buf, len, 0)
-#define socketClose(fd)           ::closesocket(fd)
-static void win_close_wait(int fd);
-#else
+#if !defined(ENODATA)              /* not defined on BSD systems */
+#define ENODATA  EPIPE
+#endif 
+ 
+#if !defined(SOL_TCP)              /* Not defined on some systems */
+#define SOL_TCP  IPPROTO_TCP
+#endif 
+ 
 #define socketRead(fd, buf, len)  ::read(fd, buf, len)
 #define socketWrite(fd, buf, len) ::write(fd, buf, len)
 #define socketClose(fd)           ::close(fd)
-#endif
-
 
 /*
  * This is a non-class BSOCK "constructor"  because we want to
@@ -63,6 +58,7 @@ void BSOCK::init()
    set_closed();
    set_terminated();
    m_blocking = 1;
+   pout_msg_no = &out_msg_no;
    msg = get_pool_memory(PM_BSOCK);
    errmsg = get_pool_memory(PM_MESSAGE);
    timeout = BSOCK_TIMEOUT;
@@ -223,7 +219,7 @@ bool BSOCK::open(JCR *jcr, const char *name, char *host, char *service,
             *fatal = 1;
             Qmsg3(jcr, M_ERROR, 0,  _("Socket open error. proto=%d port=%d. ERR=%s\n"),
                ipaddr->get_family(), ipaddr->get_port_host_order(), be.bstrerror());
-            Pmsg3(000, _("Socket open error. proto=%d port=%d. ERR=%s\n"),
+            Pmsg3(300, _("Socket open error. proto=%d port=%d. ERR=%s\n"),
                ipaddr->get_family(), ipaddr->get_port_host_order(), be.bstrerror());
             break;
          }
@@ -321,9 +317,17 @@ bool BSOCK::set_locking()
    if (m_use_locking) {
       return true;                      /* already set */
    }
-   if ((stat = pthread_mutex_init(&m_mutex, NULL)) != 0) {
+   pm_rmutex = &m_rmutex;
+   pm_wmutex = &m_wmutex;
+   if ((stat = pthread_mutex_init(pm_rmutex, NULL)) != 0) {
       berrno be;
-      Qmsg(m_jcr, M_FATAL, 0, _("Could not init bsock mutex. ERR=%s\n"),
+      Qmsg(m_jcr, M_FATAL, 0, _("Could not init bsock read mutex. ERR=%s\n"),
+         be.bstrerror(stat));
+      return false;
+   }
+   if ((stat = pthread_mutex_init(pm_wmutex, NULL)) != 0) {
+      berrno be;
+      Qmsg(m_jcr, M_FATAL, 0, _("Could not init bsock write mutex. ERR=%s\n"),
          be.bstrerror(stat));
       return false;
    }
@@ -333,30 +337,32 @@ bool BSOCK::set_locking()
 
 void BSOCK::clear_locking()
 {
-   if (!m_use_locking) {
+   if (!m_use_locking || m_duped) {
       return;
    }
    m_use_locking = false;
-   pthread_mutex_destroy(&m_mutex);
+   pthread_mutex_destroy(pm_rmutex);
+   pthread_mutex_destroy(pm_wmutex);
+   pm_rmutex = NULL;
+   pm_wmutex = NULL;
    return;
 }
 
 /*
- * Send a message over the network. The send consists of
- * two network packets. The first is sends a 32 bit integer containing
- * the length of the data packet which follows.
  *
  * Returns: false on failure
  *          true  on success
  */
-bool BSOCK::send()
+bool BSOCK::send(int aflags)
 {
    int32_t rc;
    int32_t pktsiz;
-   int32_t *hdr;
+   int32_t *hdrptr;
+   int hdrsiz;
    bool ok = true;
    int32_t save_msglen;
    POOLMEM *save_msg;
+   bool locked = false;
 
    if (is_closed()) {
       if (!m_suppress_error_msgs) {
@@ -378,6 +384,7 @@ bool BSOCK::send()
       }
       return false;
    }
+
    if (msglen > 4000000) {
       if (!m_suppress_error_msgs) {
          Qmsg4(m_jcr, M_ERROR, 0,
@@ -387,30 +394,45 @@ bool BSOCK::send()
       return false;
    }
 
-   if (m_use_locking) P(m_mutex);
+   if (m_use_locking) {
+      pP(pm_wmutex);
+      locked = true;
+   }
    save_msglen = msglen;
    save_msg = msg;
+   m_flags = aflags;
+
    /* Compute total packet length */
    if (msglen <= 0) {
-      pktsiz = sizeof(pktsiz);               /* signal, no data */
+      hdrsiz = sizeof(pktsiz);
+      pktsiz = hdrsiz;                     /* signal, no data */
+   } else if (m_flags) {
+      hdrsiz = 2 * sizeof(pktsiz);         /* have 64 bit header */
+      pktsiz = msglen + hdrsiz;
    } else {
-      pktsiz = msglen + sizeof(pktsiz);      /* data */
+      hdrsiz = sizeof(pktsiz);             /* have 32 bit header */
+      pktsiz = msglen + hdrsiz;
    }
+
    /*
     * Store packet length at head of message -- note, we
     *  have reserved an int32_t just before msg, so we can
     *  store there
     */
-   hdr = (int32_t *)(msg - (int)sizeof(pktsiz));
-   *hdr = htonl(msglen);              /* store signal/length */
+   hdrptr = (int32_t *)(msg - hdrsiz);
+   *hdrptr = htonl(msglen);             /* store signal/length */
+   if (m_flags) {
+      *(hdrptr+1) = htonl(m_flags);     /* store flags */
+   }
 
-   out_msg_no++;            /* increment message number */
+   (*pout_msg_no)++;        /* increment message number */
 
    /* send data packet */
    timer_start = watchdog_time;  /* start timer */
    clear_timed_out();
    /* Full I/O done in one write */
-   rc = write_nbytes(this, (char *)hdr, pktsiz);
+   rc = write_nbytes(this, (char *)hdrptr, pktsiz);
+//   if (chk_dbglvl(DT_NETWORK|1900)) dump_bsock_msg(m_fd, *pout_msg_no, "SEND", rc, msglen, m_flags, save_msg, save_msglen);
    timer_start = 0;         /* clear timer */
    if (rc != pktsiz) {
       errors++;
@@ -435,7 +457,7 @@ bool BSOCK::send()
    }
    msglen = save_msglen;
    msg = save_msg;
-   if (m_use_locking) V(m_mutex);
+   if (locked) pV(pm_wmutex);
    return ok;
 }
 
@@ -478,7 +500,7 @@ bool BSOCK::fsend(const char *fmt, ...)
  * Returns -1 on signal (BNET_SIGNAL)
  * Returns -2 on hard end of file (BNET_HARDEOF)
  * Returns -3 on error  (BNET_ERROR)
- *
+ * Returns -4 on COMMAND (BNET_COMMAND)
  *  Unfortunately, it is a bit complicated because we have these
  *    four return types:
  *    1. Normal data
@@ -495,14 +517,15 @@ int32_t BSOCK::recv()
 
    msg[0] = 0;
    msglen = 0;
+   m_flags = 0;
    if (errors || is_terminated() || is_closed()) {
       return BNET_HARDEOF;
    }
-
    if (m_use_locking) {
-      P(m_mutex);
+      pP(pm_rmutex);
       locked = true;
    }
+
    read_seqno++;            /* bump sequence number */
    timer_start = watchdog_time;  /* set start wait time */
    clear_timed_out();
@@ -602,7 +625,9 @@ int32_t BSOCK::recv()
    Dsm_check(300);
 
 get_out:
-   if (locked) V(m_mutex);
+//   if ((chk_dbglvl(DT_NETWORK|1900))) dump_bsock_msg(m_fd, read_seqno, "RECV", nbytes, o_pktsiz, m_flags, msg, msglen);
+
+   if (locked) pV(pm_rmutex);
    return nbytes;                  /* return actual length of message */
 }
 
@@ -647,8 +672,8 @@ bool BSOCK::despool(void update_attr_spool_size(ssize_t size), ssize_t tsize)
          if (nbytes != (size_t)msglen) {
             berrno be;
             Dmsg2(400, "nbytes=%d msglen=%d\n", nbytes, msglen);
-            Qmsg3(get_jcr(), M_FATAL, 0, _("fread attr spool error. Wanted=%d got=%d bytes. ERR=%s\n"),
-                  msglen, nbytes, be.bstrerror());
+            Qmsg2(get_jcr(), M_FATAL, 0, _("fread attr spool error. Wanted=%d got=%d bytes.\n"),
+                  msglen, nbytes);
             update_attr_spool_size(tsize - last);
             return false;
          }
@@ -681,13 +706,16 @@ const char *BSOCK::bstrerror()
    if (errmsg == NULL) {
       errmsg = get_pool_memory(PM_MESSAGE);
    }
-   pm_strcpy(errmsg, be.bstrerror(b_errno));
+   if (b_errno == 0) {
+      pm_strcpy(errmsg, "I/O Error");
+   } else {
+      pm_strcpy(errmsg, be.bstrerror(b_errno));
+   }
    return errmsg;
 }
 
 int BSOCK::get_peer(char *buf, socklen_t buflen)
 {
-#if !defined(HAVE_WIN32)
     if (peer_addr.sin_family == 0) {
         socklen_t salen = sizeof(peer_addr);
         int rval = (getpeername)(m_fd, (struct sockaddr *)&peer_addr, &salen);
@@ -697,9 +725,6 @@ int BSOCK::get_peer(char *buf, socklen_t buflen)
         return -1;
 
     return 0;
-#else
-    return -1;
-#endif
 }
 
 /*
@@ -783,7 +808,6 @@ bool BSOCK::set_buffer_size(uint32_t size, int rw)
  */
 int BSOCK::set_nonblocking()
 {
-#ifndef HAVE_WIN32
    int oflags;
 
    /* Get current flags */
@@ -800,16 +824,6 @@ int BSOCK::set_nonblocking()
 
    m_blocking = 0;
    return oflags;
-#else
-   int flags;
-   u_long ioctlArg = 1;
-
-   flags = m_blocking;
-   ioctlsocket(m_fd, FIONBIO, &ioctlArg);
-   m_blocking = 0;
-
-   return flags;
-#endif
 }
 
 /*
@@ -818,7 +832,6 @@ int BSOCK::set_nonblocking()
  */
 int BSOCK::set_blocking()
 {
-#ifndef HAVE_WIN32
    int oflags;
    /* Get current flags */
    if ((oflags = fcntl(m_fd, F_GETFL, 0)) < 0) {
@@ -834,16 +847,6 @@ int BSOCK::set_blocking()
 
    m_blocking = 1;
    return oflags;
-#else
-   int flags;
-   u_long ioctlArg = 0;
-
-   flags = m_blocking;
-   ioctlsocket(m_fd, FIONBIO, &ioctlArg);
-   m_blocking = 1;
-
-   return flags;
-#endif
 }
 
 void BSOCK::set_killable(bool killable)
@@ -858,19 +861,12 @@ void BSOCK::set_killable(bool killable)
  */
 void BSOCK::restore_blocking (int flags)
 {
-#ifndef HAVE_WIN32
    if ((fcntl(m_fd, F_SETFL, flags)) < 0) {
       berrno be;
       Qmsg1(get_jcr(), M_ABORT, 0, _("fcntl F_SETFL error. ERR=%s\n"), be.bstrerror());
    }
 
    m_blocking = (flags & O_NONBLOCK) ? true : false;
-#else
-   u_long ioctlArg = flags;
-
-   ioctlsocket(m_fd, FIONBIO, &ioctlArg);
-   m_blocking = 1;
-#endif
 }
 
 /*
@@ -903,6 +899,11 @@ int BSOCK::wait_data(int sec, int usec)
          return -1;                /* error return */
       default:
          b_errno = 0;
+#ifdef HAVE_TLS
+         if (this->tls && !tls_bsock_probe(this)) {
+            continue; /* false alarm, maybe a session key negotiation in progress on the socket */
+         }
+#endif
          return 1;
       }
    }
@@ -932,6 +933,12 @@ int BSOCK::wait_data_intr(int sec, int usec)
       return -1;                /* error return */
    default:
       b_errno = 0;
+#ifdef HAVE_TLS
+      if (this->tls && !tls_bsock_probe(this)) {
+         /* maybe a session key negotiation waked up the socket */
+         return 0;
+      }
+#endif
       break;
    }
    return 1;
@@ -974,15 +981,9 @@ void BSOCK::close()
             bsock->tls = NULL;
          }
 
-#ifdef HAVE_WIN32
-         if (!bsock->is_timed_out()) {
-            win_close_wait(bsock->m_fd);  /* Ensure that data is not discarded */
-         }
-#else
          if (bsock->is_timed_out()) {
             shutdown(bsock->m_fd, SHUT_RDWR);   /* discard any pending I/O */
          }
-#endif
          /* On Windows this discards data if we did not do a close_wait() */
          socketClose(bsock->m_fd);      /* normal close */
       }
@@ -1120,7 +1121,7 @@ bail_out:
    bsnprintf(errmsg, errmsg_len, _("Authorization error with Director at \"%s:%d\"\n"
              "Most likely the passwords do not agree.\n"
              "If you are using TLS, there may have been a certificate validation error during the TLS handshake.\n"
-             "Please see " MANUAL_AUTH_URL " for help.\n"),
+             "For help, please see: " MANUAL_AUTH_URL "\n"),
              dir->host(), dir->port());
    return false;
 }
@@ -1139,14 +1140,14 @@ void BSOCK::control_bwlimit(int bytes)
 
    m_nb_bytes += bytes;
 
-   /* Less than 0.1ms since the last call, see the next time */
-   if (temp < 100) {
+   if (temp < 0 || temp > 10000000) { /* Take care of clock problems (>10s) or back in time */
+      m_nb_bytes = bytes;
+      m_last_tick = now;
       return;
    }
 
-   if (temp > 10000000) { /* Take care of clock problems (>10s) */
-      m_nb_bytes = bytes;
-      m_last_tick = now;
+   /* Less than 0.1ms since the last call, see the next time */
+   if (temp < 100) {
       return;
    }
 
@@ -1167,25 +1168,3 @@ void BSOCK::control_bwlimit(int bytes)
       m_last_tick = now;
    }
 }
-
-#ifdef HAVE_WIN32
-/*
- * closesocket is supposed to do a graceful disconnect under Window
- *   but it doesn't. Comments on http://msdn.microsoft.com/en-us/li
- *   confirm this behaviour. DisconnectEx is required instead, but
- *   that function needs to be retrieved via WS IOCTL
- */
-static void
-win_close_wait(int fd)
-{
-   int ret;
-   GUID disconnectex_guid = WSAID_DISCONNECTEX;
-   DWORD bytes_returned;
-   LPFN_DISCONNECTEX DisconnectEx;
-   ret = WSAIoctl(fd, SIO_GET_EXTENSION_FUNCTION_POINTER, &disconnectex_guid, sizeof(disconnectex_guid), &DisconnectEx, sizeof(DisconnectEx), &bytes_returned, NULL, NULL);
-   Dmsg1(100, "WSAIoctl(SIO_GET_EXTENSION_FUNCTION_POINTER, WSAID_DISCONNECTEX) ret = %d\n", ret);
-   if (!ret) {
-      DisconnectEx(fd, NULL, 0, 0);
-   }
-}
-#endif
diff --git a/src/lib/bsock.h b/src/lib/bsock.h
index 7c82db1..2248212 100644
--- a/src/lib/bsock.h
+++ b/src/lib/bsock.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Bacula Sock Class definition
@@ -54,6 +58,7 @@ public:
    IPADDR *src_addr;                  /* IP address to source connections from */
    uint32_t in_msg_no;                /* input message number */
    uint32_t out_msg_no;               /* output message number */
+   uint32_t *pout_msg_no;             /* pointer to the above */
    int32_t msglen;                    /* message length */
    volatile time_t timer_start;       /* time started read/write */
    volatile time_t timeout;           /* timeout BSOCK after this interval */
@@ -67,9 +72,12 @@ public:
    struct sockaddr_in peer_addr;      /* peer's IP address */
 
 private:
-   BSOCK *m_next;                     /* next BSOCK if duped */
+   BSOCK *m_next;                     /* next BSOCK if duped (not actually used) */
    JCR *m_jcr;                        /* jcr or NULL for error msgs */
-   pthread_mutex_t m_mutex;           /* for locking if use_locking set */
+   pthread_mutex_t m_rmutex;          /* for read locking if use_locking set */
+   pthread_mutex_t m_wmutex;          /* for write locking if use_locking set */
+   pthread_mutex_t *pm_rmutex;        /* Pointer to the read mutex */
+   pthread_mutex_t *pm_wmutex;        /* Pointer to the write mutex */
    char *m_who;                       /* Name of daemon to which we are talking */
    char *m_host;                      /* Host name/IP */
    int m_port;                        /* desired port */
@@ -78,6 +86,7 @@ private:
    boffset_t m_last_data_end;          /* offset of last valid data written */
    int32_t m_FileIndex;               /* attr spool FI */
    int32_t m_lastFileIndex;           /* last valid attr spool FI */
+   uint32_t m_flags;                  /* Special flags */
    volatile bool m_timed_out: 1;      /* timed out in read/write */
    volatile bool m_terminated: 1;     /* set when BNET_TERMINATE arrives */
    bool m_closed: 1;                  /* set when socket is closed */
@@ -102,7 +111,8 @@ public:
                 utime_t heart_beat, const char *name, char *host,
                 char *service, int port, int verbose);
    int32_t recv();
-   bool send();
+   bool send() { return send(0); };
+   bool send(int flags);
    bool fsend(const char*, ...);
    bool signal(int signal);
    void close();                      /* close connection and destroy packet */
@@ -118,7 +128,7 @@ public:
    int wait_data(int sec, int usec=0);
    int wait_data_intr(int sec, int usec=0);
    bool authenticate_director(const char *name, const char *password,
-                  TLS_CONTEXT *tls_ctx, char *response, int response_len);
+           TLS_CONTEXT *tls_ctx, char *response, int response_len);
    bool set_locking();                /* in bsock.c */
    void clear_locking();              /* in bsock.c */
    void set_source_address(dlist *src_addr_list);
@@ -165,6 +175,7 @@ public:
    void start_timer(int sec) { m_tid = start_bsock_timer(this, sec); };
    void stop_timer() { stop_bsock_timer(m_tid); };
    void swap_msgs();
+
 };
 
 /*
diff --git a/src/lib/bsys.c b/src/lib/bsys.c
index 40e048e..4226e01 100644
--- a/src/lib/bsys.c
+++ b/src/lib/bsys.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Miscellaneous Bacula memory and thread safe routines
@@ -56,6 +60,14 @@ POOLMEM *quote_string(POOLMEM *snew, const char *old)
          *n++ = '\\';
          *n++ = '\\';
          break;
+      case '\r':
+         *n++ = '\\';
+         *n++ = 'r';
+         break;
+      case '\n':
+         *n++ = '\\';
+         *n++ = 'n';
+         break;
       default:
          *n++ = old[i];
          break;
@@ -515,21 +527,40 @@ void b_memset(const char *file, int line, void *mem, int val, size_t num)
 
 #if !defined(HAVE_WIN32)
 static int del_pid_file_ok = FALSE;
+static int pid_fd = -1;
 #endif
 
-/*
- * Create a standard "Unix" pid file.
+#ifdef HAVE_FCNTL_LOCK
+/* a convenient function [un]lock file using fnctl()
+ * code must be in F_UNLCK, F_RDLCK, F_WRLCK
+ * return -1 for error and errno is set
  */
-void create_pid_file(char *dir, const char *progname, int port)
+int fcntl_lock(int fd, int code)
 {
+   struct flock l;
+   l.l_type = code;
+   l.l_whence = l.l_start = l.l_len = 0;
+   l.l_len = 1;
+   return fcntl(fd, F_SETLK, &l);
+}
+#endif
+
+/* Create a disk pid "lock" file
+ *  returns
+ *    0: Error with the error message in errmsg
+ *    1: Succcess
+ *    2: Successs, but a previous file was found
+ */
+#if !defined(HAVE_FCNTL_LOCK) || defined(HAVE_WIN32)
+int create_lock_file(char *fname, const char *progname, const char *filetype, POOLMEM **errmsg)
+{
+   int ret = 1;
 #if !defined(HAVE_WIN32)
    int pidfd, len;
    int oldpid;
    char  pidbuf[20];
-   POOLMEM *fname = get_pool_memory(PM_FNAME);
    struct stat statp;
 
-   Mmsg(&fname, "%s/%s.%d.pid", dir, progname, port);
    if (stat(fname, &statp) == 0) {
       /* File exists, see what we have */
       *pidbuf = 0;
@@ -537,8 +568,10 @@ void create_pid_file(char *dir, const char *progname, int port)
            read(pidfd, &pidbuf, sizeof(pidbuf)) < 0 ||
            sscanf(pidbuf, "%d", &oldpid) != 1) {
          berrno be;
-         Emsg2(M_ERROR_TERM, 0, _("Cannot open pid file. %s ERR=%s\n"), fname,
-               be.bstrerror());
+         Mmsg(errmsg, _("Cannot open %s file. %s ERR=%s\n"), filetype, fname,
+              be.bstrerror());
+         close(pidfd); /* if it was successfully opened */
+         return 0;
       }
       /* Some OSes (IRIX) don't bother to clean out the old pid files after a crash, and
        * since they use a deterministic algorithm for assigning PIDs, we can have
@@ -552,27 +585,84 @@ void create_pid_file(char *dir, const char *progname, int port)
        * For more details see bug #797.
        */
        if ((oldpid != (int)getpid()) && (kill(oldpid, 0) != -1 || errno != ESRCH)) {
-         Emsg3(M_ERROR_TERM, 0, _("%s is already running. pid=%d\nCheck file %s\n"),
+          Mmsg(errmsg, _("%s is already running. pid=%d\nCheck file %s\n"),
                progname, oldpid, fname);
+          return 0;
       }
       /* He is not alive, so take over file ownership */
       unlink(fname);                  /* remove stale pid file */
+      ret = 2;
    }
    /* Create new pid file */
    if ((pidfd = open(fname, O_CREAT|O_TRUNC|O_WRONLY|O_BINARY, 0640)) >= 0) {
       len = sprintf(pidbuf, "%d\n", (int)getpid());
       write(pidfd, pidbuf, len);
       close(pidfd);
-      del_pid_file_ok = TRUE;         /* we created it so we can delete it */
+      /* ret is already 1 */
    } else {
       berrno be;
-      Emsg2(M_ERROR_TERM, 0, _("Could not open pid file. %s ERR=%s\n"), fname,
-            be.bstrerror());
+      Mmsg(errmsg, _("Could not open %s file. %s ERR=%s\n"), filetype, fname, be.bstrerror());
+      return 0;
    }
-   free_pool_memory(fname);
 #endif
+   return ret;
 }
+#else /* defined(HAVE_FCNTL_LOCK) */
+int create_lock_file(char *fname, const char *progname, const char *filetype, POOLMEM **errmsg)
+{
+   int len;
+   int oldpid;
+   char pidbuf[20];
 
+   /* Open the pidfile for writing */
+   if ((pid_fd = open(fname, O_CREAT|O_RDWR, 0640)) >= 0) {
+      if (fcntl_lock(pid_fd, F_WRLCK) == -1) {
+         berrno be;
+         /* already locked by someone else, try to read the pid */
+         if (read(pid_fd, &pidbuf, sizeof(pidbuf)) > 0 &&
+             sscanf(pidbuf, "%d", &oldpid) == 1) {
+            Mmsg(errmsg, _("%s is already running. pid=%d\nCheck file %s\n"),
+                 progname, oldpid, fname);
+         } else {
+            Mmsg(errmsg, _("Cannot lock %s file. %s ERR=%s\n"), filetype, fname, be.bstrerror());
+         }
+         close(pid_fd);
+         pid_fd=-1;
+         return 0;
+      }
+      /* write the pid */
+      len = sprintf(pidbuf, "%d\n", (int)getpid());
+      write(pid_fd, pidbuf, len);
+      /* KEEP THE FILE OPEN TO KEEP THE LOCK !!! */
+      return 1;
+   } else {
+      berrno be;
+      Mmsg(errmsg, _("Cannot not open %s file. %s ERR=%s\n"), filetype, fname, be.bstrerror());
+      return 0;
+   }
+}
+#endif
+
+/*
+ * Create a standard "Unix" pid file.
+ */
+void create_pid_file(char *dir, const char *progname, int port)
+{
+   POOLMEM *errmsg = get_pool_memory(PM_MESSAGE);
+   POOLMEM *fname = get_pool_memory(PM_FNAME);
+
+   Mmsg(fname, "%s/%s.%d.pid", dir, progname, port);
+   if (create_lock_file(fname, progname, "pid", &errmsg) == 0) {
+      Emsg1(M_ERROR_TERM, 0, "%s", errmsg);
+      /* never return */
+   }
+#if !defined(HAVE_WIN32)
+   del_pid_file_ok = TRUE;         /* we created it so we can delete it */
+#endif
+
+   free_pool_memory(fname);
+   free_pool_memory(errmsg);
+}
 
 /*
  * Delete the pid file if we created it
@@ -581,7 +671,9 @@ int delete_pid_file(char *dir, const char *progname, int port)
 {
 #if !defined(HAVE_WIN32)
    POOLMEM *fname = get_pool_memory(PM_FNAME);
-
+   if (pid_fd!=-1) {
+      close(pid_fd);
+   }
    if (!del_pid_file_ok) {
       free_pool_memory(fname);
       return 0;
@@ -913,3 +1005,102 @@ void stack_trace()
 #else /* HAVE_BACKTRACE && HAVE_GCC */
 void stack_trace() {}
 #endif /* HAVE_BACKTRACE && HAVE_GCC */
+
+#ifdef HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#else
+#define statvfs statfs
+#endif
+/* statvfs.h defines ST_APPEND, which is also used by Bacula */
+#undef ST_APPEND
+
+
+int fs_get_free_space(const char *path, int64_t *freeval, int64_t *totalval)
+{
+#ifndef HAVE_WIN32
+   struct statvfs st;
+
+   if (statvfs(path, &st) == 0) {
+      *freeval = (uint64_t)st.f_bsize * (uint64_t)st.f_bavail;
+      *totalval = (uint64_t)st.f_blocks * (uint64_t)st.f_frsize;
+      return 0;
+   }
+#endif
+   *totalval = *freeval = 0;
+   return -1;
+}
+
+void setup_env(char *envp[])
+{
+   if (envp) {
+#if defined(HAVE_SETENV)
+      char *p;
+      POOLMEM *tmp = get_pool_memory(PM_FNAME);
+      for (int i=0; envp[i] ; i++) {
+         pm_strcpy(tmp, envp[i]);
+         p = strchr(tmp, '='); /* HOME=/tmp */
+         if (p) {
+            *p=0;                       /* HOME\0tmp\0 */
+            setenv(tmp, p+1, true);
+         }
+      }
+      free_pool_memory(tmp);
+#elif defined(HAVE_PUTENV)
+      for (int i=0; envp[i] ; i++) {
+         putenv(envp[i]);
+      }
+#else
+#error "putenv() and setenv() are not available on this system"
+#endif
+   }
+}
+
+/* Small function to copy a file somewhere else, 
+ * for debug purpose.
+ */
+int copyfile(const char *src, const char *dst)
+{
+   int     fd_src=-1, fd_dst=-1;
+   ssize_t len, lenw;
+   char    buf[4096];
+   berrno  be;
+   fd_src = open(src, O_RDONLY);
+   if (fd_src < 0) {
+      Dmsg2(0, "Unable to open %s ERR=%s\n", src, be.bstrerror(errno));
+      goto bail_out;
+   }
+   fd_dst = open(dst, O_WRONLY | O_CREAT | O_EXCL, 0600);
+   if (fd_dst < 0) {
+      Dmsg2(0, "Unable to open %s ERR=%s\n", dst, be.bstrerror(errno));
+      goto bail_out;
+   }
+
+   while ((len = read(fd_src, buf, sizeof(buf))) > 0)
+    {
+        char *out_ptr = buf;
+        do {
+            lenw = write(fd_dst, out_ptr, len);
+            if (lenw >= 0) {
+                len -= lenw;
+                out_ptr += lenw;
+            } else if (errno != EINTR) {
+               Dmsg3(0, "Unable to write %d bytes in %s. ERR=%s\n", len, dst, be.bstrerror(errno));
+               goto bail_out;
+            }
+        } while (len > 0);
+    }
+
+    if (len == 0) {
+       close(fd_src);
+       if (close(fd_dst) < 0) {
+          Dmsg2(0, "Unable to close %s properly. ERR=%s\n", dst, be.bstrerror(errno));
+          return -1;
+       }
+       /* Success! */
+       return 0;
+    }
+bail_out:
+    close(fd_src);
+    close(fd_dst);
+    return -1;
+}
diff --git a/src/lib/btime.c b/src/lib/btime.c
index 3a1a151..0748a10 100644
--- a/src/lib/btime.c
+++ b/src/lib/btime.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Bacula floating point time and date routines -- John Walker
diff --git a/src/lib/btime.h b/src/lib/btime.h
index 8da4f4d..c4632e8 100644
--- a/src/lib/btime.h
+++ b/src/lib/btime.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 
 /*
diff --git a/src/lib/btimers.c b/src/lib/btimers.c
index d73b3c8..543c0f0 100644
--- a/src/lib/btimers.c
+++ b/src/lib/btimers.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2004-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Process and thread timer routines, built on top of watchdogs.
diff --git a/src/lib/btimers.h b/src/lib/btimers.h
index a638aa5..c43690d 100644
--- a/src/lib/btimers.h
+++ b/src/lib/btimers.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2003-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Process and thread timer routines, built on top of watchdogs.
diff --git a/src/lib/cram-md5.c b/src/lib/cram-md5.c
index b1a9443..5583be4 100644
--- a/src/lib/cram-md5.c
+++ b/src/lib/cram-md5.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *  Challenge Response Authentication Method using MD5 (CRAM-MD5)
@@ -26,6 +30,7 @@
 
 const int dbglvl = 50;
 
+
 /* Authorize other end
  * Codes that tls_local_need and tls_remote_need can take:
  *   BNET_TLS_NONE     I cannot do tls
@@ -117,6 +122,10 @@ bool cram_md5_respond(BSOCK *bs, const char *password, int *tls_remote_need, int
       return false;
    }
    Dmsg1(100, "cram-get received: %s", bs->msg);
+   /*
+    * Note that the next call is only to keep compatibility with very
+    *  old versions of Bacula that used a non-compatible base64 algorithm.
+    */
    if (sscanf(bs->msg, "auth cram-md5c %s ssl=%d", chal, tls_remote_need) == 2) {
       *compatible = true;
    } else if (sscanf(bs->msg, "auth cram-md5 %s ssl=%d", chal, tls_remote_need) != 2) {
diff --git a/src/lib/crc32.c b/src/lib/crc32.c
index b0ba199..74ee4b0 100644
--- a/src/lib/crc32.c
+++ b/src/lib/crc32.c
@@ -1,26 +1,41 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2010 Joakim Tjernlund
+   Copyright (c) 2010-2015, Joakim Tjernlund
+   All rights reserved.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are
+   met:
 
-   You may use this file and others of this release according to the
-   license defined in the LICENSE file, which includes the Affero General
-   Public License, v3.0 ("AGPLv3") and some additional permissions and
-   terms pursuant to its AGPLv3 Section 7.
+   1.  Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+
+   2.  Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+   IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+   TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+   PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+   TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-   Bacula® is a registered trademark of Kern Sibbald.
 */
 /*
  *  Original 32 bit CRC.  Algorithm from RFC 2083 (png format)
  *
  *   By Kern Sibbald, January 2001
  *
- *   Inproved, faster version
+ *   Improved, faster version
  *
- *   By Joakim Tjernlunc, 2010
+ *   By Joakim Tjernlund, 2010
  */
 
 
@@ -358,7 +373,7 @@ tole(0xccb0a91fL), tole(0x740cce7aL), tole(0x66b96194L), tole(0xde0506f1L)},
  */
 uint32_t bcrc32(unsigned char*buf, int len)
 {
-# ifdef HAVE_LITTLE_ENDIAN
+# if defined(HAVE_LITTLE_ENDIAN)
 #  define DO_CRC(x) crc = tab[0][(crc ^ (x)) & 255 ] ^ (crc >> 8)
 #  define DO_CRC4 crc = tab[3][(crc) & 255 ] ^ \
                 tab[2][(crc >> 8) & 255 ] ^ \
diff --git a/src/lib/crypto.c b/src/lib/crypto.c
index f62e97a..bf4a182 100644
--- a/src/lib/crypto.c
+++ b/src/lib/crypto.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2005-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * crypto.c Encryption support functions
@@ -128,9 +132,6 @@
 #ifdef HAVE_CRYPTO /* Is encryption enabled? */
 #ifdef HAVE_OPENSSL /* How about OpenSSL? */
 
-/* Are we initialized? */
-static int crypto_initialized = false;
-
 /* ASN.1 Declarations */
 #define BACULA_ASN1_VERSION 0
 
@@ -1364,77 +1365,6 @@ void crypto_cipher_free (CIPHER_CONTEXT *cipher_ctx)
 }
 
 
-/*
- * Perform global initialization of OpenSSL
- * This function is not thread safe.
- *  Returns: 0 on success
- *           errno on failure
- */
-int init_crypto (void)
-{
-   int stat;
-
-   if ((stat = openssl_init_threads()) != 0) {
-      berrno be;
-      Jmsg1(NULL, M_ABORT, 0,
-        _("Unable to init OpenSSL threading: ERR=%s\n"), be.bstrerror(stat));
-   }
-
-   /* Load libssl and libcrypto human-readable error strings */
-   SSL_load_error_strings();
-
-   /* Initialize OpenSSL SSL  library */
-   SSL_library_init();
-
-   /* Register OpenSSL ciphers and digests */
-   OpenSSL_add_all_algorithms();
-
-   if (!openssl_seed_prng()) {
-      Jmsg0(NULL, M_ERROR_TERM, 0, _("Failed to seed OpenSSL PRNG\n"));
-   }
-
-   crypto_initialized = true;
-
-   return stat;
-}
-
-/*
- * Perform global cleanup of OpenSSL
- * All cryptographic operations must be completed before calling this function.
- * This function is not thread safe.
- *  Returns: 0 on success
- *           errno on failure
- */
-int cleanup_crypto (void)
-{
-   /*
-    * Ensure that we've actually been initialized; Doing this here decreases the
-    * complexity of client's termination/cleanup code.
-    */
-   if (!crypto_initialized) {
-      return 0;
-   }
-
-   if (!openssl_save_prng()) {
-      Jmsg0(NULL, M_ERROR, 0, _("Failed to save OpenSSL PRNG\n"));
-   }
-
-   openssl_cleanup_threads();
-
-   /* Free libssl and libcrypto error strings */
-   ERR_free_strings();
-
-   /* Free all ciphers and digests */
-   EVP_cleanup();
-
-   /* Free memory used by PRNG */
-   RAND_cleanup();
-
-   crypto_initialized = false;
-
-   return 0;
-}
-
 
 #else /* HAVE_OPENSSL */
 # error No encryption library available
@@ -1540,10 +1470,6 @@ void crypto_digest_free(DIGEST *digest)
    free(digest);
 }
 
-/* Dummy routines */
-int init_crypto (void) { return 0; }
-int cleanup_crypto (void) { return 0; }
-
 SIGNATURE *crypto_sign_new(JCR *jcr) { return NULL; }
 
 crypto_error_t crypto_sign_get_digest (SIGNATURE *sig, X509_KEYPAIR *keypair,
diff --git a/src/lib/crypto.h b/src/lib/crypto.h
index 2a75302..9b4728f 100644
--- a/src/lib/crypto.h
+++ b/src/lib/crypto.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2005-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * crypto.h Encryption support functions
diff --git a/src/lib/daemon.c b/src/lib/daemon.c
index deb030f..31e4a25 100644
--- a/src/lib/daemon.c
+++ b/src/lib/daemon.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *  daemon.c by Kern Sibbald 2000
@@ -32,20 +36,18 @@
 void
 daemon_start()
 {
-#if !defined(HAVE_WIN32)
-   int i;
-   int fd;
+#ifndef HAVE_WIN32
+   int i, fd, next_fd;
    pid_t cpid;
    mode_t oldmask;
 #ifdef DEVELOPER
-   int low_fd = 2;
+   next_fd = 3;
 #else
-   int low_fd = -1;
+   next_fd = 0;
 #endif
    /*
     *  Become a daemon.
     */
-
    Dmsg0(900, "Enter daemon_start\n");
    if ( (cpid = fork() ) < 0) {
       berrno be;
@@ -53,35 +55,23 @@ daemon_start()
    } else if (cpid > 0) {
       exit(0);              /* parent exits */
    }
-   /* Child continues */
 
+   /* Child continues */
    setsid();
 
    /* In the PRODUCTION system, we close ALL
     * file descriptors except stdin, stdout, and stderr.
     */
    if (debug_level > 0) {
-      low_fd = 2;                     /* don't close debug output */
+      next_fd = 3;                    /* don't close debug output */
    }
 
 #if defined(HAVE_FCNTL_F_CLOSEM)
-   /*
-    * fcntl(fd, F_CLOSEM) needs the minimum filedescriptor
-    * to close. the current code sets the last one to keep
-    * open. So increment it with 1 and use that as argument.
-    */
-   low_fd++;
-   fcntl(low_fd, F_CLOSEM);
+   fcntl(next_fd, F_CLOSEM);
 #elif defined(HAVE_CLOSEFROM)
-   /*
-    * closefrom needs the minimum filedescriptor to close.
-    * the current code sets the last one to keep open.
-    * So increment it with 1 and use that as argument.
-    */
-   low_fd++;
-   closefrom(low_fd);
+   closefrom(next_fd);
 #else
-   for (i=sysconf(_SC_OPEN_MAX)-1; i > low_fd; i--) {
+   for (i=sysconf(_SC_OPEN_MAX); i >= next_fd; i--) {
       close(i);
    }
 #endif
diff --git a/src/lib/devlock.c b/src/lib/devlock.c
index e716670..ca8dcb6 100644
--- a/src/lib/devlock.c
+++ b/src/lib/devlock.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Bacula Thread Read/Write locking code. It permits
@@ -26,7 +30,7 @@
  *
  */
 
-#define _LOCKMGR_COMPLIANT
+#define LOCKMGR_COMPLIANT
 #include "bacula.h"
 #include "devlock.h"
 
@@ -501,14 +505,12 @@ int main (int argc, char *argv[])
     int thread_writes = 0;
     int data_writes = 0;
 
-#ifdef USE_THR_SETCONCURRENCY
     /*
-     * On Solaris 2.5,2.6,7 and 8 threads are not timesliced. To ensure
-     * that our threads can run concurrently, we need to
-     * increase the concurrency level to THREADS.
+     * For Solaris 2.5,2.6,7 and 8 threads are not timesliced.
+     *  To ensure our threads can run concurrently, we specifically
+     *  set the concurrency level to THREADS.
      */
-    thr_setconcurrency (THREADS);
-#endif
+    thr_setconcurrency(THREADS); /* Turned on only for Solaris */
 
     /*
      * Initialize the shared data.
@@ -584,7 +586,7 @@ int main (int argc, char *argv[])
  *
  * Demonstrate use of non-blocking read-write locks.
  *
- * Special notes: On older Solaris system, call thr_setconcurrency()
+ * On older Solaris system, call thr_setconcurrency()
  * to allow interleaved thread execution, since threads are not
  * timesliced.
  */
@@ -674,15 +676,13 @@ int main (int argc, char *argv[])
     int thread_updates = 0, data_updates = 0;
     int status;
 
-#ifdef USE_THR_SETCONCURRENCY
     /*
-     * On Solaris 2.5,2.6,7 and 8 threads are not timesliced. To ensure
-     * that our threads can run concurrently, we need to
-     * increase the concurrency level to THREADS.
+     * For Solaris 2.5,2.6,7 and 8 threads are not timesliced.
+     *  To ensure our threads can run concurrently, we specifically
+     *  set the concurrency level to THREADS.
      */
     DPRINTF (("Setting concurrency level to %d\n", THREADS));
-    thr_setconcurrency (THREADS);
-#endif
+    thr_setconcurrency(THREADS); /* Turned on only for Solaris */
 
     /*
      * Initialize the shared data.
diff --git a/src/lib/devlock.h b/src/lib/devlock.h
index 2f3b6a3..7c3812c 100644
--- a/src/lib/devlock.h
+++ b/src/lib/devlock.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Bacula Thread Read/Write locking code. It permits
diff --git a/src/lib/dlist.c b/src/lib/dlist.c
index 1566265..6ac67d7 100644
--- a/src/lib/dlist.c
+++ b/src/lib/dlist.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2003-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *  Bacula doubly linked list routines.
diff --git a/src/lib/dlist.h b/src/lib/dlist.h
index 4c28fc0..b5d7e06 100644
--- a/src/lib/dlist.h
+++ b/src/lib/dlist.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2004-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *  Written by Kern Sibbald MMIV
@@ -190,6 +194,7 @@ class dlistString
 {
 public:
    char *c_str() { return m_str; };
+   dlink get_link() { return m_link; }; /* eliminate clang compiler warning */
 
 private:
    dlink m_link;
diff --git a/src/lib/edit.c b/src/lib/edit.c
index b5d0d5c..6e3cd09 100644
--- a/src/lib/edit.c
+++ b/src/lib/edit.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2002-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *   edit.c  edit string to ascii, and ascii to internal
@@ -38,9 +42,23 @@ uint64_t str_to_uint64(char *str)
    if (*p == '+') {
       p++;
    }
-   while (B_ISDIGIT(*p)) {
-      value = B_TIMES10(value) + *p - '0';
-      p++;
+   if (*p == '0' && *(p+1) == 'x') {
+      p = p + 2; /* skip 0x */
+
+      while (B_ISXDIGIT(*p)) {
+         if (B_ISDIGIT(*p)) {
+            value = (value<<4) + (*p - '0');
+
+         } else {
+            value = (value<<4) + (tolower(*p) - 'a' + 10);
+         }
+         p++;
+      }
+   } else {
+      while (B_ISDIGIT(*p)) {
+         value = B_TIMES10(value) + *p - '0';
+         p++;
+      }
    }
    return value;
 }
diff --git a/src/lib/guid_to_name.c b/src/lib/guid_to_name.c
index 7b98174..3db8e8a 100644
--- a/src/lib/guid_to_name.c
+++ b/src/lib/guid_to_name.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Written by Kern Sibbald, July 2007 to replace idcache.c
diff --git a/src/lib/guid_to_name.h b/src/lib/guid_to_name.h
index 55515c8..bfbecfe 100644
--- a/src/lib/guid_to_name.h
+++ b/src/lib/guid_to_name.h
@@ -1,24 +1,27 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Written by Kern Sibbald, July 2007 to replace idcache.c
  *
  *  Program to convert uid and gid into names, and cache the results
  *   for preformance reasons.
- *
  */
 
 class guid_list {
diff --git a/src/lib/hmac.c b/src/lib/hmac.c
index 92b9402..a4e132f 100644
--- a/src/lib/hmac.c
+++ b/src/lib/hmac.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 
 /*
@@ -20,9 +24,7 @@
  * hmac_md5 was based on sample code in RFC2104 (thanks guys).
  *
  * Adapted to Bacula by Kern E. Sibbald, February MMI.
- *
  */
-
 #include "bacula.h"
 
 #define PAD_LEN 64           /* PAD length */
diff --git a/src/lib/htable.c b/src/lib/htable.c
index 0e85f92..2c60147 100644
--- a/src/lib/htable.c
+++ b/src/lib/htable.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2003-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *  Bacula hash table routines
@@ -37,20 +41,16 @@
  */
 
 #include "bacula.h"
+#include "htable.h"
 
-#define B_PAGE_SIZE 4096
-#define MIN_PAGES 32
-#define MAX_PAGES 2400
-#define MIN_BUF_SIZE (MIN_PAGES * B_PAGE_SIZE) /* 128 Kb */
-#define MAX_BUF_SIZE (MAX_PAGES * B_PAGE_SIZE) /* approx 10MB */
-
-#define dbglvl     500
-#define dbglvl_mem DT_MEMORY|100
+#define lli long long int
+static const int dbglvl = 500;
 
 /* ===================================================================
  *    htable
  */
 
+#ifdef BIG_MALLOC
 /*
  * This subroutine gets a big buffer.
  */
@@ -65,7 +65,7 @@ void htable::malloc_big_buf(int size)
    mem_block = hmem;
    hmem->mem = mem_block->first;
    hmem->rem = (char *)hmem + size - hmem->mem;
-   Dmsg3(dbglvl_mem, "malloc buf=%p size=%d rem=%d\n", hmem, size, hmem->rem);
+   Dmsg3(100, "malloc buf=%p size=%d rem=%d\n", hmem, size, hmem->rem);
 }
 
 /* This routine frees the whole tree */
@@ -76,36 +76,46 @@ void htable::hash_big_free()
    for (hmem=mem_block; hmem; ) {
       rel = hmem;
       hmem = hmem->next;
-      Dmsg1(dbglvl_mem, "free malloc buf=%p\n", rel);
+      Dmsg1(100, "free malloc buf=%p\n", rel);
       free(rel);
    }
 }
 
+#endif
+
 /*
- * Normal hash malloc routine that gets a
+ * Normal hash malloc routine that gets a 
  *  "small" buffer from the big buffer
  */
 char *htable::hash_malloc(int size)
 {
-   int mb_size;
+#ifdef BIG_MALLOC
    char *buf;
    int asize = BALIGN(size);
 
    if (mem_block->rem < asize) {
-      if (total_size >= (extend_length / 2)) {
-         mb_size = extend_length;
+      uint32_t mb_size;
+      if (total_size >= 1000000) {
+         mb_size = 1000000;
       } else {
-         mb_size = extend_length / 2;
+         mb_size = 100000;
       }
       malloc_big_buf(mb_size);
-      Dmsg1(dbglvl_mem, "Created new big buffer of %ld bytes\n", mb_size);
    }
    mem_block->rem -= asize;
    buf = mem_block->mem;
    mem_block->mem += asize;
    return buf;
+#else 
+   total_size += size;
+   blocks++;
+   return (char *)malloc(size);
+#endif
 }
 
+
+ 
+
 /*
  * Create hash of key, stored in hash then
  *  create and return the pseudo random bucket index
@@ -117,39 +127,29 @@ void htable::hash_index(char *key)
       hash +=  ((hash << 5) | (hash >> (sizeof(hash)*8-5))) + (uint32_t)*p;
    }
    /* Multiply by large prime number, take top bits, mask for remainder */
-   index = ((hash * 1103515249) >> rshift) & mask;
-   Dmsg2(dbglvl, "Leave hash_index hash=0x%llx index=%d\n", hash, index);
-}
-
-void htable::hash_index(uint32_t key)
-{
-   hash = key;
-   /* Multiply by large prime number, take top bits, mask for remainder */
-   index = ((hash * 1103515249) >> rshift) & mask;
-   Dmsg2(dbglvl, "Leave hash_index hash=0x%llx index=%d\n", hash, index);
-}
-
-void htable::hash_index(uint64_t key)
-{
-   hash = key;
-   /* Multiply by large prime number, take top bits, mask for remainder */
-   index = ((hash * 1103515249) >> rshift) & mask;
-   Dmsg2(dbglvl, "Leave hash_index hash=0x%llx index=%d\n", hash, index);
-}
-
+   index = ((hash * 1103515249LL) >> rshift) & mask;
+   Dmsg2(dbglvl, "Leave hash_index hash=0x%x index=%d\n", hash, index);
+} 
+ 
+void htable::hash_index(uint64_t ikey)
+{ 
+   hash = ikey;           /* already have starting binary hash */
+   /* Same algorithm as for char * */
+   index = ((hash * 1103515249LL) >> rshift) & mask;
+   Dmsg2(dbglvl, "Leave hash_index hash=0x%x index=%d\n", hash, index);
+} 
+ 
 /*
  * tsize is the estimated number of entries in the hash table
  */
-htable::htable(void *item, void *link, int tsize, int nr_pages)
+htable::htable(void *item, void *link, int tsize)
 {
-   init(item, link, tsize, nr_pages);
+   init(item, link, tsize);
 }
 
-void htable::init(void *item, void *link, int tsize, int nr_pages)
+void htable::init(void *item, void *link, int tsize)
 {
    int pwr;
-   int pagesize;
-   int buffer_size;
 
    memset(this, 0, sizeof(htable));
    if (tsize < 31) {
@@ -160,31 +160,15 @@ void htable::init(void *item, void *link, int tsize, int nr_pages)
       tsize >>= 1;
    }
    loffset = (char *)link - (char *)item;
-   mask = ~((~0) << pwr);             /* 3 bits => table size = 8 */
+   mask = ~((~0)<<pwr);               /* 3 bits => table size = 8 */
    rshift = 30 - pwr;                 /* start using bits 28, 29, 30 */
-   buckets = 1 << pwr;                /* hash table size -- power of two */
+   buckets = 1<<pwr;                  /* hash table size -- power of two */
    max_items = buckets * 4;           /* allow average 4 entries per chain */
    table = (hlink **)malloc(buckets * sizeof(hlink *));
    memset(table, 0, buckets * sizeof(hlink *));
-
-#ifdef HAVE_GETPAGESIZE
-   pagesize = getpagesize();
-#else
-   pagesize = B_PAGE_SIZE;
-#endif
-   if (nr_pages == 0) {
-      buffer_size = MAX_BUF_SIZE;
-   } else {
-      buffer_size = pagesize * nr_pages;
-      if (buffer_size > MAX_BUF_SIZE) {
-         buffer_size = MAX_BUF_SIZE;
-      } else if (buffer_size < MIN_BUF_SIZE) {
-         buffer_size = MIN_BUF_SIZE;
-      }
-   }
-   malloc_big_buf(buffer_size);
-   extend_length = buffer_size;
-   Dmsg1(dbglvl_mem, "Allocated big buffer of %ld bytes\n", buffer_size);
+#ifdef BIG_MALLOC
+   malloc_big_buf(1000000);   /* ***FIXME*** need variable or some estimate */
+#endif /* BIG_MALLOC */
 }
 
 uint32_t htable::size()
@@ -194,7 +178,7 @@ uint32_t htable::size()
 
 /*
  * Take each hash link and walk down the chain of items
- *  that hash there counting them (i.e. the hits),
+ *  that hash there counting them (i.e. the hits), 
  *  then report that number.
  * Obiously, the more hits in a chain, the more time
  *  it takes to reference them. Empty chains are not so
@@ -231,20 +215,17 @@ void htable::stats()
    }
    printf("buckets=%d num_items=%d max_items=%d\n", buckets, num_items, max_items);
    printf("max hits in a bucket = %d\n", max);
-   printf("total bytes malloced = %lld\n", (long long int)total_size);
-   printf("total bytes malloced = %lld\n", (long long int)total_size);
+#ifdef BIG_MALLOC
+   printf("total bytes malloced = %lld\n", (lli)total_size);
    printf("total blocks malloced = %d\n", blocks);
+#endif
 }
 
 void htable::grow_table()
 {
-   htable *big;
-   hlink *cur;
-   void *ni;
-
    Dmsg1(100, "Grow called old size = %d\n", buckets);
    /* Setup a bigger table */
-   big = (htable *)malloc(sizeof(htable));
+   htable *big = (htable *)malloc(sizeof(htable));
    memcpy(big, this, sizeof(htable));  /* start with original class data */
    big->loffset = loffset;
    big->mask = mask<<1 | 1;
@@ -267,22 +248,15 @@ void htable::grow_table()
     * to the next bucket.
     */
    for (void *item=first(); item; ) {
-      cur = (hlink *)((char *)item+loffset);
-      ni = cur->next; /* save link overwritten by insert */
-      switch (cur->key_type) {
-      case KEY_TYPE_CHAR:
-         Dmsg1(100, "Grow insert: %s\n", cur->key.char_key);
-         big->insert(cur->key.char_key, item);
-         break;
-      case KEY_TYPE_UINT32:
-         Dmsg1(100, "Grow insert: %ld\n", cur->key.uint32_key);
-         big->insert(cur->key.uint32_key, item);
-         break;
-      case KEY_TYPE_UINT64:
-         Dmsg1(100, "Grow insert: %ld\n", cur->key.uint64_key);
-         big->insert(cur->key.uint64_key, item);
-         break;
-      }
+      void *ni = ((hlink *)((char *)item+loffset))->next;  /* save link overwritten by insert */
+      hlink *hp = (hlink *)((char *)item+loffset);
+      if (hp->is_ikey) {
+         Dmsg1(100, "Grow insert: %lld\n", hp->key.ikey);
+         big->insert(hp->key.ikey, item);
+      } else {
+         Dmsg1(100, "Grow insert: %s\n", hp->key.key);
+         big->insert(hp->key.key, item);
+      }  
       if (ni) {
          item = (void *)((char *)ni-loffset);
       } else {
@@ -303,7 +277,6 @@ void htable::grow_table()
 bool htable::insert(char *key, void *item)
 {
    hlink *hp;
-
    if (lookup(key)) {
       return false;                   /* already exists */
    }
@@ -314,11 +287,11 @@ bool htable::insert(char *key, void *item)
       index, item, loffset);
    hp->next = table[index];
    hp->hash = hash;
-   hp->key_type = KEY_TYPE_CHAR;
-   hp->key.char_key = key;
+   hp->key.key = key;
+   hp->is_ikey = false;
    table[index] = hp;
-   Dmsg3(dbglvl, "Insert hp->next=%p hp->hash=0x%llx hp->key=%s\n",
-      hp->next, hp->hash, hp->key.char_key);
+   Dmsg3(dbglvl, "Insert hp->next=%p hp->hash=0x%x hp->key=%s\n",
+      hp->next, hp->hash, hp->key.key);
 
    if (++num_items >= max_items) {
       Dmsg2(dbglvl, "num_items=%d max_items=%d\n", num_items, max_items);
@@ -328,102 +301,60 @@ bool htable::insert(char *key, void *item)
    return true;
 }
 
-bool htable::insert(uint32_t key, void *item)
-{
-   hlink *hp;
-
-   if (lookup(key)) {
-      return false;                   /* already exists */
-   }
-   ASSERT(index < buckets);
-   Dmsg2(dbglvl, "Insert: hash=%p index=%d\n", hash, index);
-   hp = (hlink *)(((char *)item)+loffset);
-   Dmsg4(dbglvl, "Insert hp=%p index=%d item=%p offset=%u\n", hp,
-      index, item, loffset);
-   hp->next = table[index];
-   hp->hash = hash;
-   hp->key_type = KEY_TYPE_UINT32;
-   hp->key.uint32_key = key;
-   table[index] = hp;
-   Dmsg3(dbglvl, "Insert hp->next=%p hp->hash=0x%llx hp->key=%d\n",
-      hp->next, hp->hash, hp->key.uint32_key);
-
-   if (++num_items >= max_items) {
-      Dmsg2(dbglvl, "num_items=%d max_items=%d\n", num_items, max_items);
-      grow_table();
-   }
-   Dmsg3(dbglvl, "Leave insert index=%d num_items=%d key=%d\n", index, num_items, key);
-   return true;
-}
-
-bool htable::insert(uint64_t key, void *item)
-{
-   hlink *hp;
-
-   if (lookup(key)) {
-      return false;                   /* already exists */
-   }
-   ASSERT(index < buckets);
-   Dmsg2(dbglvl, "Insert: hash=%p index=%d\n", hash, index);
-   hp = (hlink *)(((char *)item)+loffset);
-   Dmsg4(dbglvl, "Insert hp=%p index=%d item=%p offset=%u\n", hp,
-      index, item, loffset);
-   hp->next = table[index];
-   hp->hash = hash;
-   hp->key_type = KEY_TYPE_UINT64;
-   hp->key.uint64_key = key;
-   table[index] = hp;
-   Dmsg3(dbglvl, "Insert hp->next=%p hp->hash=0x%llx hp->key=%ld\n",
-      hp->next, hp->hash, hp->key.uint64_key);
-
-   if (++num_items >= max_items) {
-      Dmsg2(dbglvl, "num_items=%d max_items=%d\n", num_items, max_items);
-      grow_table();
-   }
-   Dmsg3(dbglvl, "Leave insert index=%d num_items=%d key=%lld\n", index, num_items, key);
-   return true;
-}
-
 void *htable::lookup(char *key)
-{
-   hash_index(key);
-   for (hlink *hp=table[index]; hp; hp=(hlink *)hp->next) {
-      ASSERT(hp->key_type == KEY_TYPE_CHAR);
-//    Dmsg2(100, "hp=%p key=%s\n", hp, hp->key.char_key);
-      if (hash == hp->hash && strcmp(key, hp->key.char_key) == 0) {
-         Dmsg1(dbglvl, "lookup return %p\n", ((char *)hp)-loffset);
-         return ((char *)hp)-loffset;
-      }
-   }
-   return NULL;
-}
-
-void *htable::lookup(uint32_t key)
-{
-   hash_index(key);
-   for (hlink *hp=table[index]; hp; hp=(hlink *)hp->next) {
-      ASSERT(hp->key_type == KEY_TYPE_UINT32);
-      if (hash == hp->hash && key == hp->key.uint32_key) {
-         Dmsg1(dbglvl, "lookup return %p\n", ((char *)hp)-loffset);
-         return ((char *)hp)-loffset;
-      }
-   }
-   return NULL;
-}
-
-void *htable::lookup(uint64_t key)
-{
-   hash_index(key);
-   for (hlink *hp=table[index]; hp; hp=(hlink *)hp->next) {
-      ASSERT(hp->key_type == KEY_TYPE_UINT64);
-      if (hash == hp->hash && key == hp->key.uint64_key) {
-         Dmsg1(dbglvl, "lookup return %p\n", ((char *)hp)-loffset);
-         return ((char *)hp)-loffset;
-      }
-   }
-   return NULL;
-}
-
+{ 
+   hash_index(key); 
+   for (hlink *hp=table[index]; hp; hp=(hlink *)hp->next) { 
+//    Dmsg2(100, "hp=%p key=%s\n", hp, hp->key.key);
+      if (hash == hp->hash && strcmp(key, hp->key.key) == 0) {
+         Dmsg1(dbglvl, "lookup return %p\n", ((char *)hp)-loffset); 
+         return ((char *)hp)-loffset; 
+      } 
+   } 
+   return NULL; 
+} 
+ 
+bool htable::insert(uint64_t ikey, void *item)
+{ 
+   hlink *hp; 
+   if (lookup(ikey)) {
+      return false;                  /* already exists */
+   } 
+   ASSERT(index < buckets); 
+   Dmsg2(dbglvl, "Insert: hash=%p index=%d\n", hash, index); 
+   hp = (hlink *)(((char *)item)+loffset); 
+   Dmsg4(dbglvl, "Insert hp=%p index=%d item=%p offset=%u\n", hp, index, 
+     item, loffset);
+   hp->next = table[index]; 
+   hp->hash = hash; 
+   hp->key.ikey = ikey;
+   hp->is_ikey = true;
+   table[index] = hp; 
+   Dmsg3(dbglvl, "Insert hp->next=%p hp->hash=0x%x hp->ikey=%lld\n", hp->next, 
+      hp->hash, hp->key.ikey);
+ 
+   if (++num_items >= max_items) { 
+      Dmsg2(dbglvl, "num_items=%d max_items=%d\n", num_items, max_items); 
+      grow_table(); 
+   } 
+   Dmsg3(dbglvl, "Leave insert index=%d num_items=%d key=%lld\n",
+      index, num_items, ikey);
+   return true;  
+} 
+ 
+void *htable::lookup(uint64_t ikey)
+{ 
+   hash_index(ikey);
+   for (hlink *hp=table[index]; hp; hp=(hlink *)hp->next) { 
+//    Dmsg2(100, "hp=%p key=%lld\n", hp, hp->key.ikey);
+      if (hash == hp->hash && ikey == hp->key.ikey) {
+         Dmsg1(dbglvl, "lookup return %p\n", ((char *)hp)-loffset); 
+         return ((char *)hp)-loffset; 
+      } 
+   } 
+   return NULL; 
+} 
+ 
 void *htable::next()
 {
    Dmsg1(dbglvl, "Enter next: walkptr=%p\n", walkptr);
@@ -469,11 +400,21 @@ void *htable::first()
 /* Destroy the table and its contents */
 void htable::destroy()
 {
+#ifdef BIG_MALLOC
    hash_big_free();
+#else
+   void *ni;
+   void *li = first();
+
+   while (li) {
+      ni = next();
+      free(li);
+      li=ni;
+   }
+#endif
 
    free(table);
    table = NULL;
-   garbage_collect_memory();
    Dmsg0(100, "Done destroy.\n");
 }
 
@@ -482,19 +423,11 @@ void htable::destroy()
 #ifdef TEST_PROGRAM
 
 struct MYJCR {
-#ifndef TEST_NON_CHAR
    char *key;
-#else
-   uint32_t key;
-#endif
    hlink link;
 };
 
-#ifndef TEST_SMALL_HTABLE
 #define NITEMS 5000000
-#else
-#define NITEMS 5000
-#endif
 
 int main()
 {
@@ -505,25 +438,16 @@ int main()
    int count = 0;
 
    jcrtbl = (htable *)malloc(sizeof(htable));
+   jcrtbl->init(jcr, &jcr->link, NITEMS); 
 
-#ifndef TEST_SMALL_HTABLE
-   jcrtbl->init(jcr, &jcr->link, NITEMS);
-#else
-   jcrtbl->init(jcr, &jcr->link, NITEMS, 128);
-#endif
    Dmsg1(000, "Inserting %d items\n", NITEMS);
    for (int i=0; i<NITEMS; i++) {
-#ifndef TEST_NON_CHAR
       int len;
       len = sprintf(mkey, "This is htable item %d", i) + 1;
 
       jcr = (MYJCR *)jcrtbl->hash_malloc(sizeof(MYJCR));
       jcr->key = (char *)jcrtbl->hash_malloc(len);
       memcpy(jcr->key, mkey, len);
-#else
-      jcr = (MYJCR *)jcrtbl->hash_malloc(sizeof(MYJCR));
-      jcr->key = i;
-#endif
       Dmsg2(100, "link=%p jcr=%p\n", jcr->link, jcr);
 
       jcrtbl->insert(jcr->key, jcr);
@@ -534,22 +458,16 @@ int main()
    if (!(item = (MYJCR *)jcrtbl->lookup(save_jcr->key))) {
       printf("Bad news: %s not found.\n", save_jcr->key);
    } else {
-#ifndef TEST_NON_CHAR
       printf("Item 10's key is: %s\n", item->key);
-#else
-      printf("Item 10's key is: %ld\n", item->key);
-#endif
    }
 
    jcrtbl->stats();
    printf("Walk the hash table:\n");
    foreach_htable (jcr, jcrtbl) {
-#ifndef TEST_NON_CHAR
 //    printf("htable item = %s\n", jcr->key);
 #ifndef BIG_MALLOC
       free(jcr->key);
 #endif
-#endif
       count++;
    }
    printf("Got %d items -- %s\n", count, count==NITEMS?"OK":"***ERROR***");
diff --git a/src/lib/htable.h b/src/lib/htable.h
index 816fc79..73c6eb6 100644
--- a/src/lib/htable.h
+++ b/src/lib/htable.h
@@ -1,24 +1,34 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2004-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Written by Kern Sibbald, MMIV
  */
 
-#ifndef HTABLE_H
-#define HTABLE_H
+#ifndef _HTABLE_H_
+#define _HTABLE_H_
+
+/*
+ *
+ * Written by Kern Sibbald, MMIV
+ *
+ */
 
 /* ========================================================================
  *
@@ -26,6 +36,11 @@
  *
  */
 
+/* 
+ * BIG_MALLOC is to provide a large malloc service to htable
+ */
+#define BIG_MALLOC
+
 /*
  * Loop var through each member of table
  */
@@ -41,71 +56,64 @@
             (*((void **)&(var))=(void *)((tbl)->next())))
 #endif
 
-typedef enum {
-   KEY_TYPE_CHAR = 1,
-   KEY_TYPE_UINT32 = 2,
-   KEY_TYPE_UINT64 = 3
-} key_type_t;
-
-union hlink_key {
-   char *char_key;
-   uint32_t uint32_key;
-   uint64_t uint64_key;
-};
+union key_val {
+   char *key;                   /* char key */
+   uint64_t ikey;               /* integer key */
+}; 
 
 struct hlink {
    void *next;                        /* next hash item */
-   key_type_t key_type;               /* type of key used to hash */
-   union hlink_key key;               /* key for this item */
-   uint64_t hash;                     /* hash for this key */
+   uint64_t hash;                     /* 64 bit hash for this key */
+   union key_val key;                 /* key value this key */
+   bool is_ikey;                      /* set if integer key */
 };
 
 struct h_mem {
    struct h_mem *next;                /* next buffer */
-   int32_t rem;                       /* remaining bytes in big_buffer */
    char *mem;                         /* memory pointer */
+   int32_t rem;                       /* remaining bytes in big_buffer */
    char first[1];                     /* first byte */
 };
 
 class htable : public SMARTALLOC {
    hlink **table;                     /* hash table */
-   int loffset;                       /* link offset in item */
-   hlink *walkptr;                    /* table walk pointer */
    uint64_t hash;                     /* temp storage */
    uint64_t total_size;               /* total bytes malloced */
-   uint32_t extend_length;            /* number of bytes to allocate when extending buffer */
-   uint32_t walk_index;               /* table walk index */
+   int loffset;                       /* link offset in item */
    uint32_t num_items;                /* current number of items */
    uint32_t max_items;                /* maximum items before growing */
    uint32_t buckets;                  /* size of hash table */
    uint32_t index;                    /* temp storage */
    uint32_t mask;                     /* "remainder" mask */
    uint32_t rshift;                   /* amount to shift down */
+   hlink *walkptr;                    /* table walk pointer */
+   uint32_t walk_index;               /* table walk index */
    uint32_t blocks;                   /* blocks malloced */
+#ifdef BIG_MALLOC
    struct h_mem *mem_block;           /* malloc'ed memory block chain */
    void malloc_big_buf(int size);     /* Get a big buffer */
+#endif
    void hash_index(char *key);        /* produce hash key,index */
-   void hash_index(uint32_t key);     /* produce hash key,index */
-   void hash_index(uint64_t key);     /* produce hash key,index */
+   void hash_index(uint64_t ikey);    /* produce hash key,index */
    void grow_table();                 /* grow the table */
 
 public:
-   htable(void *item, void *link, int tsize = 31, int nr_pages = 0);
+   htable(void *item, void *link, int tsize = 31);
    ~htable() { destroy(); }
-   void init(void *item, void *link, int tsize = 31, int nr_pages = 0);
-   bool insert(char *key, void *item);
-   bool insert(uint32_t key, void *item);
-   bool insert(uint64_t key, void *item);
-   void *lookup(char *key);
-   void *lookup(uint32_t key);
-   void *lookup(uint64_t key);
+   void  init(void *item, void *link, int tsize = 31);
+   bool  insert(char *key, void *item);      /* char key */
+   bool  insert(uint64_t ikey, void *item);  /* 64 bit key */
+   void *lookup(char *key);                  /* char key */
+   void *lookup(uint64_t ikey);              /* 64 bit key */
    void *first();                     /* get first item in table */
    void *next();                      /* get next item in table */
-   void destroy();
-   void stats();                      /* print stats about the table */
+   void  destroy();
+   void  stats();                     /* print stats about the table */
    uint32_t size();                   /* return size of table */
    char *hash_malloc(int size);       /* malloc bytes for a hash entry */
+#ifdef BIG_MALLOC
    void hash_big_free();              /* free all hash allocated big buffers */
+#endif
 };
 
-#endif  /* HTABLE_H */
+#endif
diff --git a/src/lib/ini.c b/src/lib/ini.c
index 7be5a86..b585b1b 100644
--- a/src/lib/ini.c
+++ b/src/lib/ini.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2011-2014 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2010-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Handle simple configuration file such as "ini" files.
@@ -42,6 +46,8 @@ static struct ini_store funcs[] = {
    {"@STR@",    "String",           ini_store_str},
    {"@BOOL@",   "on/off",           ini_store_bool},
    {"@ALIST@",  "String list",      ini_store_alist_str},
+   {"@DATE@",   "Date",             ini_store_date},
+/* TODO: Add protocol for the FD @ASKFD@ */
    {NULL,       NULL,               NULL}
 };
 
@@ -140,6 +146,8 @@ void ConfigFile::free_items()
          bfree_and_null_const(items[i].comment);
          bfree_and_null_const(items[i].default_value);
       }
+   }
+   if (items) {
       free(items);
    }
    items = NULL;
@@ -219,7 +227,7 @@ bool ConfigFile::serialize(const char *fname)
 int ConfigFile::serialize(POOLMEM **buf)
 {
    int len;
-   POOLMEM *tmp;
+   POOLMEM *tmp, *tmp2;
    if (!items) {
       **buf = 0;
       return 0;
@@ -228,14 +236,16 @@ int ConfigFile::serialize(POOLMEM **buf)
    len = Mmsg(buf, "# Plugin configuration file\n# Version %d\n", version);
 
    tmp = get_pool_memory(PM_MESSAGE);
+   tmp2 = get_pool_memory(PM_MESSAGE);
 
    for (int i=0; items[i].name ; i++) {
       if (items[i].comment) {
-         Mmsg(tmp, "OptPrompt=\"%s\"\n", items[i].comment);
+         Mmsg(tmp, "OptPrompt=%s\n", quote_string(tmp2, items[i].comment));
          pm_strcat(buf, tmp);
       }
       if (items[i].default_value) {
-         Mmsg(tmp, "OptDefault=\"%s\"\n", items[i].default_value);
+         Mmsg(tmp, "OptDefault=%s\n",
+              quote_string(tmp2, items[i].default_value));
          pm_strcat(buf, tmp);
       }
       if (items[i].required) {
@@ -243,12 +253,14 @@ int ConfigFile::serialize(POOLMEM **buf)
          pm_strcat(buf, tmp);
       }
 
-      /* variable = @INT64@ */
       Mmsg(tmp, "%s=%s\n\n",
            items[i].name, ini_get_store_code(items[i].handler));
+
+      /* variable = @INT64@ */
       len = pm_strcat(buf, tmp);
    }
    free_pool_memory(tmp);
+   free_pool_memory(tmp2);
 
    return len ;
 }
@@ -257,7 +269,7 @@ int ConfigFile::serialize(POOLMEM **buf)
 int ConfigFile::dump_results(POOLMEM **buf)
 {
    int len;
-   POOLMEM *tmp;
+   POOLMEM *tmp, *tmp2;
    if (!items) {
       **buf = 0;
       return 0;
@@ -265,6 +277,7 @@ int ConfigFile::dump_results(POOLMEM **buf)
    len = Mmsg(buf, "# Plugin configuration file\n# Version %d\n", version);
 
    tmp = get_pool_memory(PM_MESSAGE);
+   tmp2 = get_pool_memory(PM_MESSAGE);
 
    for (int i=0; items[i].name ; i++) {
       if (items[i].found) {
@@ -273,63 +286,67 @@ int ConfigFile::dump_results(POOLMEM **buf)
             Mmsg(tmp, "# %s\n", items[i].comment);
             pm_strcat(buf, tmp);
          }
-         Mmsg(tmp, "%s=%s\n\n", items[i].name, this->edit);
+         if (items[i].handler == ini_store_str  ||
+             items[i].handler == ini_store_name ||
+             items[i].handler == ini_store_date)
+         {
+            Mmsg(tmp, "%s=%s\n\n",
+                 items[i].name,
+                 quote_string(tmp2, this->edit));
+
+         } else {
+            Mmsg(tmp, "%s=%s\n\n", items[i].name, this->edit);
+         }
          len = pm_strcat(buf, tmp);
       }
    }
    free_pool_memory(tmp);
+   free_pool_memory(tmp2);
 
    return len ;
 }
 
-/* Parse a config file used by Plugin/Director */
-bool ConfigFile::parse(const char *fname)
+bool ConfigFile::parse()
 {
    int token, i;
-   bool ret=false;
-
-   if (!items) {
-      return false;
-   }
+   bool ret = false;
+   bool found;
 
-   if ((lc = lex_open_file(lc, fname, s_err)) == NULL) {
-      berrno be;
-      Emsg2(M_ERROR, 0, _("Cannot open config file %s: %s\n"),
-            fname, be.bstrerror());
-      return false;
-   }
    lc->options |= LOPT_NO_EXTERN;
    lc->caller_ctx = (void *)this;
 
    while ((token=lex_get_token(lc, T_ALL)) != T_EOF) {
-      Dmsg1(dbglevel, "parse got token=%s\n", lex_tok_to_str(token));
       if (token == T_EOL) {
          continue;
       }
+      found = false;
       for (i=0; items[i].name; i++) {
          if (strcasecmp(items[i].name, lc->str) == 0) {
             if ((token = lex_get_token(lc, T_EQUALS)) == T_ERROR) {
-               Dmsg1(dbglevel, "in T_IDENT got token=%s\n",
-                     lex_tok_to_str(token));
+               Dmsg2(dbglevel, "in T_IDENT got token=%s str=%s\n", lex_tok_to_str(token), lc->str);
                break;
             }
-
+            Dmsg2(dbglevel, "parse got token=%s str=%s\n", lex_tok_to_str(token), lc->str);
             Dmsg1(dbglevel, "calling handler for %s\n", items[i].name);
             /* Call item handler */
             ret = items[i].found = items[i].handler(lc, this, &items[i]);
-            i = -1;
+            found = true;
             break;
          }
       }
-      if (i >= 0) {
-         Dmsg1(dbglevel, "Keyword = %s\n", lc->str);
+      if (!found) {
+         Dmsg1(dbglevel, "Unfound keyword=%s\n", lc->str);
          scan_err1(lc, "Keyword %s not found", lc->str);
          /* We can raise an error here */
          break;
+      } else {
+         Dmsg1(dbglevel, "Found keyword=%s\n", items[i].name);
       }
       if (!ret) {
+         Dmsg1(dbglevel, "Error getting value for keyword=%s\n", items[i].name);
          break;
       }
+      Dmsg0(dbglevel, "Continue with while(token) loop\n");
    }
 
    for (i=0; items[i].name; i++) {
@@ -340,10 +357,40 @@ bool ConfigFile::parse(const char *fname)
    }
 
    lc = lex_close_file(lc);
-
    return ret;
 }
 
+/* Parse a config file used by Plugin/Director */
+bool ConfigFile::parse(const char *fname)
+{
+   if (!items) {
+      return false;
+   }
+
+   if ((lc = lex_open_file(lc, fname, s_err)) == NULL) {
+      berrno be;
+      Emsg2(M_ERROR, 0, _("Cannot open config file %s: %s\n"),
+            fname, be.bstrerror());
+      return false;
+   }
+   return parse();          /* Parse file */
+}
+
+/* Parse a config buffer used by Plugin/Director */
+bool ConfigFile::parse_buf(const char *buffer)
+{
+   if (!items) {
+      return false;
+   }
+
+   if ((lc = lex_open_buf(lc, buffer, s_err)) == NULL) {
+      Emsg0(M_ERROR, 0, _("Cannot open lex\n"));
+      return false;
+   }
+   return parse();         /* Parse memory buffer */
+}
+
+
 /* Analyse the content of a ini file to build the item list
  * It uses special syntax for datatype. Used by Director on Restore object
  *
@@ -475,8 +522,10 @@ bool ini_store_name(LEX *lc, ConfigFile *inifile, ini_items *item)
       return true;
    }
    if (lex_get_token(lc, T_NAME) == T_ERROR) {
+      Dmsg0(dbglevel, "Want token=T_NAME got T_ERROR\n");
       return false;
    }
+   Dmsg1(dbglevel, "ini_store_name: %s\n", lc->str);
    strncpy(item->val.nameval, lc->str, sizeof(item->val.nameval));
    scan_to_eol(lc);
    return true;
@@ -575,19 +624,38 @@ bool ini_store_bool(LEX *lc, ConfigFile *inifile, ini_items *item)
    }
    if (strcasecmp(lc->str, "yes")  == 0 ||
        strcasecmp(lc->str, "true") == 0 ||
-       strcasecmp(lc->str, "on")   == 0)
+       strcasecmp(lc->str, "on")   == 0 ||
+       strcasecmp(lc->str, "1")    == 0)
    {
       item->val.boolval = true;
 
    } else if (strcasecmp(lc->str, "no")    == 0 ||
               strcasecmp(lc->str, "false") == 0 ||
-              strcasecmp(lc->str, "off")   == 0)
+              strcasecmp(lc->str, "off")   == 0 ||
+              strcasecmp(lc->str, "0")     == 0)
    {
       item->val.boolval = false;
 
    } else {
       /* YES and NO must not be translated */
-      scan_err2(lc, _("Expect %s, got: %s"), "YES, NO, ON, OFF, TRUE, or FALSE", lc->str);
+      scan_err2(lc, _("Expect %s, got: %s"), "YES, NO, ON, OFF, 0, 1, TRUE, or FALSE", lc->str);
+      return false;
+   }
+   scan_to_eol(lc);
+   return true;
+}
+
+bool ini_store_date(LEX *lc, ConfigFile *inifile, ini_items *item)
+{
+   if (!lc) {
+      bstrutime(inifile->edit,sizeof_pool_memory(inifile->edit),item->val.btimeval);
+      return true;
+   }
+   if (lex_get_token(lc, T_STRING) == T_ERROR) {
+      return false;
+   }
+   item->val.btimeval = str_to_utime(lc->str);
+   if (item->val.btimeval == 0) {
       return false;
    }
    scan_to_eol(lc);
@@ -637,6 +705,15 @@ int report()
    return err>0;
 }
 
+struct ini_items membuf_items[] = {
+   /* name          handler           comment             req */
+   {"client",      ini_store_name,    "Client name",       0},
+   {"serial",      ini_store_int32,   "Serial number",     1},
+   {"max_clients", ini_store_int32,   "Max Clients",       0},
+   {NULL,          NULL,              NULL,                0}
+};
+
+
 struct ini_items test_items[] = {
    /* name          handler           comment             req */
    {"datastore",   ini_store_name,    "Target Datastore", 0},
@@ -647,16 +724,62 @@ struct ini_items test_items[] = {
    {"pint64",      ini_store_pint64,  "pint",             0},
    {"int32",       ini_store_int32,   "int 32bit",        0},
    {"plugin.test", ini_store_str,     "test with .",      0},
+   {"adate",       ini_store_date,    "test with date",   0},
    {NULL,          NULL,              NULL,               0}
 };
 
+/* In order to link with libbaccfg */
+int32_t r_last;
+int32_t r_first;
+RES_HEAD **res_head;
+void save_resource(int type, RES_ITEM *items, int pass){}
+void dump_resource(int type, RES *ares, void sendit(void *sock, const char *fmt, ...), void *sock){}
+void free_resource(RES *rres, int type){}
+union URES {
+};
+RES_TABLE resources[] = {};
+URES res_all;
+
 int main()
 {
    FILE *fp;
-   int pos;
+   int pos, size;
    ConfigFile *ini = new ConfigFile();
    POOLMEM *buf = get_pool_memory(PM_BSOCK);
+   char buffer[2000];
+
+   //debug_level=500;
+   printf("Begin Memory buffer Test\n");
+   ok(ini->register_items(membuf_items, sizeof(struct ini_items)), "Check sizeof ini_items");
 
+   if ((fp = fopen("test.cfg", "w")) == NULL) {
+      exit (1);
+   }
+   fprintf(fp, "client=JohnDoe\n");
+   fprintf(fp, "serial=2\n");
+   fprintf(fp, "max_clients=3\n");
+   fflush(fp);
+   fseek(fp, 0, SEEK_END);
+   size = ftell(fp);
+   fclose(fp);
+
+   if ((fp = fopen("test.cfg", "rb")) == NULL) {
+      printf("Could not open file test.cfg\n");
+      exit (1);
+   }
+
+   size = fread(buffer, 1, size, fp);
+   buffer[size] = 0;
+   //printf("size of read buffer is: %d\n", size);
+   //printf("====buf=%s\n", buffer);
+
+   ok(ini->parse_buf(buffer), "Test memory read with all members");
+
+   ini->clear_items();
+   fclose(fp);
+
+   //debug_level = 0;
+   printf("\n\nBegin Original Full Tests\n");
    nok(ini->register_items(test_items, 5), "Check bad sizeof ini_items");
    ok(ini->register_items(test_items, sizeof(struct ini_items)), "Check sizeof ini_items");
 
@@ -674,6 +797,7 @@ int main()
    fprintf(fp, "int32=100\n");
    fprintf(fp, "bool=yes\n");
    fprintf(fp, "plugin.test=parameter\n");
+   fprintf(fp, "adate=\"1970-01-02 12:00:00\"\n");
 
    fflush(fp);
 
@@ -687,6 +811,7 @@ int main()
    ok(ini->items[2].val.int64val == 10, "Test int");
    ok(ini->items[4].val.boolval == true, "Test bool");
    ok(ini->items[6].val.int32val == 100, "Test int 32");
+   ok(ini->items[6].val.btimeval != 126000, "Test btime");
 
    alist *list = ini->items[3].val.alistval;
    nok(ini->items[3].found, "Test presence of alist");
@@ -740,6 +865,7 @@ int main()
            "pouet=@STR@\n"
            "int32=@INT32@\n"
            "plugin.test=@STR@\n"
+           "adate=@DATE@\n"
       );
    fclose(fp);
 
@@ -767,6 +893,9 @@ int main()
    ok((pos = ini->get_item("bool")) == 4, "Check bool definition");
    ok(ini->items[pos].val.boolval == true, "Test bool");
 
+   ok((pos = ini->get_item("adate")) == 9, "Check adate definition");
+   ok(ini->items[pos].val.btimeval == 126000, "Test date");
+
    ok(ini->dump_results(&buf), "Test to dump results");
    printf("<%s>\n", buf);
 
diff --git a/src/lib/ini.h b/src/lib/ini.h
index c68994b..851a578 100644
--- a/src/lib/ini.h
+++ b/src/lib/ini.h
@@ -1,28 +1,21 @@
 /*
-   Copyright (C) 2011-2011 Bacula Systems(R) SA
-
-   The main author of Bacula is Kern Sibbald, with contributions from
-   many others, a complete list can be found in the file AUTHORS.
-   This program is Free Software; you can modify it under the terms of
-   version three of the GNU Affero General Public License as published by the
-   Free Software Foundation, which is listed in the file LICENSE.
-
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU Affero General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-   02110-1301, USA.
-
-   Bacula® is a registered trademark of Kern Sibbald.
-   Bacula Systems(R) is a trademark of Bacula Systems SA.
-   Bacula Enterprise(TM) is a trademark of Bacula Systems SA.
-
-   The licensor of Bacula Enterprise(TM) is Bacula Systems(R) SA,
-   Rue Galilee 5, 1400 Yverdon-les-Bains, Switzerland.
+   Bacula(R) - The Network Backup Solution
+
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2010-2014 Free Software Foundation Europe e.V.
+
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
+
+   You may use this file and others of this release according to the
+   license defined in the LICENSE file, which includes the Affero General
+   Public License, v3.0 ("AGPLv3") and some additional permissions and
+   terms pursuant to its AGPLv3 Section 7.
+
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 
 #ifndef INI_H
@@ -61,6 +54,7 @@ typedef union {
    char    nameval[MAX_NAME_LENGTH];
    int64_t int64val;
    int32_t int32val;
+   btime_t btimeval;
    alist   *alistval;
    bool    boolval;
 } item_value;
@@ -141,7 +135,7 @@ public:
       sizeof_ini_items = sizeof(struct ini_items);
    }
 
-   ~ConfigFile() {
+   virtual ~ConfigFile() {
       if (lc) {
          lex_close_file(lc);
       }
@@ -198,7 +192,7 @@ public:
    int dump_results(POOLMEM **buf);
 
    /* Get item position in items list (useful when dynamic) */
-   int get_item(const char *name);
+   virtual int get_item(const char *name);
 
    /* Register config file structure, if size doesn't match */
    bool register_items(struct ini_items *aitems, int size) {
@@ -213,9 +207,15 @@ public:
       return false;
    }
 
-   /* Parse a ini file with a item list previously registred (plugin side) */
+   /* Parse an ini file with a item list previously registred (plugin side) */
    bool parse(const char *filename);
 
+   /* Parse an ini buffer */
+   bool parse_buf(const char *buf);
+
+   /* Parse file or buffer already setup */
+   bool parse();
+
    /* Create a item list from a ini file (director side) */
    bool unserialize(const char *filename);
 
@@ -239,6 +239,7 @@ bool ini_store_int64(LEX *lc, ConfigFile *inifile, ini_items *item);
 bool ini_store_pint32(LEX *lc, ConfigFile *inifile, ini_items *item);
 bool ini_store_int32(LEX *lc, ConfigFile *inifile, ini_items *item);
 bool ini_store_bool(LEX *lc, ConfigFile *inifile, ini_items *item);
+bool ini_store_date(LEX *lc, ConfigFile *inifile, ini_items *item);
 
 /* Get handler code from handler @ */
 const char *ini_get_store_code(INI_ITEM_HANDLER *handler);
diff --git a/src/lib/jcr.c b/src/lib/jcr.c
index ab56a6b..b99041d 100644
--- a/src/lib/jcr.c
+++ b/src/lib/jcr.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Manipulation routines for Job Control Records and
@@ -321,7 +325,6 @@ JCR *new_jcr(int size, JCR_free_HANDLER *daemon_free_jcr)
 {
    JCR *jcr;
    MQUEUE_ITEM *item = NULL;
-   struct sigaction sigtimer;
    int status;
 
    Dmsg0(dbglvl, "Enter new_jcr\n");
@@ -358,10 +361,13 @@ JCR *new_jcr(int size, JCR_free_HANDLER *daemon_free_jcr)
    jcr->setJobType(JT_SYSTEM);           /* internal job until defined */
    jcr->setJobLevel(L_NONE);
    jcr->setJobStatus(JS_Created);        /* ready to run */
+#ifndef HAVE_WIN32
+   struct sigaction sigtimer;
    sigtimer.sa_flags = 0;
    sigtimer.sa_handler = timeout_handler;
    sigfillset(&sigtimer.sa_mask);
    sigaction(TIMEOUT_SIGNAL, &sigtimer, NULL);
+#endif
 
    /*
     * Locking jobs is a global lock that is needed
@@ -493,10 +499,10 @@ void free_jcr(JCR *jcr)
 
    lock_jcr_chain();
    jcr->dec_use_count();              /* decrement use count */
-   if (jcr->use_count() < 0) {
-      Jmsg2(jcr, M_ERROR, 0, _("JCR use_count=%d JobId=%d\n"),
-         jcr->use_count(), jcr->JobId);
-   }
+   ASSERT2(jcr->use_count() >= 0, "JCR use_count < 0");
+   //    Jmsg2(jcr, M_ERROR, 0, _("JCR use_count=%d JobId=%d\n"),
+   //      jcr->use_count(), jcr->JobId);
+   //}
    if (jcr->JobId > 0) {
       Dmsg3(dbglvl, "Dec free_jcr jid=%u use_count=%d Job=%s\n",
          jcr->JobId, jcr->use_count(), jcr->Job);
@@ -509,6 +515,7 @@ void free_jcr(JCR *jcr)
       Dmsg3(dbglvl, "remove jcr jid=%u use_count=%d Job=%s\n",
             jcr->JobId, jcr->use_count(), jcr->Job);
    }
+   jcr->exiting = true;
    remove_jcr(jcr);                   /* remove Jcr from chain */
    unlock_jcr_chain();
 
@@ -566,6 +573,7 @@ void free_jcr(JCR *jcr)
    }
 
    free_common_jcr(jcr);
+   close_msg(NULL);                   /* flush any daemon messages */
    Dmsg0(dbglvl, "Exit free_jcr\n");
 }
 
@@ -583,10 +591,9 @@ void remove_jcr_from_tsd(JCR *jcr)
 
 void JCR::set_killable(bool killable)
 {
-   JCR *jcr = this;
-   jcr->lock();
-   jcr->my_thread_killable = killable;
-   jcr->unlock();
+   lock();
+   my_thread_killable = killable;
+   unlock();
 }
 
 /*
@@ -606,17 +613,24 @@ void set_jcr_in_tsd(JCR *jcr)
 
 void JCR::my_thread_send_signal(int sig)
 {
+   lock_jcr_chain();   /* use global lock */
    this->lock();
+   if (this->exiting) {
+      goto get_out;
+   }
    if (this->is_killable() &&
        !pthread_equal(this->my_thread_id, pthread_self()))
    {
       Dmsg1(800, "Send kill to jid=%d\n", this->JobId);
       pthread_kill(this->my_thread_id, sig);
+      this->exiting = true;
 
    } else if (!this->is_killable()) {
       Dmsg1(10, "Warning, can't send kill to jid=%d\n", this->JobId);
    }
+get_out:
    this->unlock();
+   unlock_jcr_chain();
 }
 
 /*
@@ -830,6 +844,9 @@ static int get_status_priority(int JobStatus)
 {
    int priority = 0;
    switch (JobStatus) {
+   case JS_Incomplete:
+      priority = 10;
+      break;
    case JS_ErrorTerminated:
    case JS_FatalError:
    case JS_Canceled:
@@ -850,9 +867,8 @@ static int get_status_priority(int JobStatus)
  */
 bool JCR::sendJobStatus()
 {
-   JCR *jcr = this;
-   if (jcr->dir_bsock) {
-      return jcr->dir_bsock->fsend(Job_status, jcr->Job, jcr->JobStatus);
+   if (dir_bsock) {
+      return dir_bsock->fsend(Job_status, Job, JobStatus);
    }
    return true;
 }
@@ -860,13 +876,12 @@ bool JCR::sendJobStatus()
 /*
  * Set and send Job status to Director
  */
-bool JCR::sendJobStatus(int newJobStatus)
+bool JCR::sendJobStatus(int aJobStatus)
 {
-   JCR *jcr = this;
-   if (!jcr->is_JobStatus(newJobStatus)) {
-      setJobStatus(newJobStatus);
-      if (jcr->dir_bsock) {
-         return jcr->dir_bsock->fsend(Job_status, jcr->Job, jcr->JobStatus);
+   if (!is_JobStatus(aJobStatus)) {
+      setJobStatus(aJobStatus);
+      if (dir_bsock) {
+         return dir_bsock->fsend(Job_status, Job, JobStatus);
       }
    }
    return true;
@@ -874,23 +889,21 @@ bool JCR::sendJobStatus(int newJobStatus)
 
 void JCR::setJobStarted()
 {
-   JCR *jcr = this;
-   jcr->job_started = true;
-   jcr->job_started_time = time(NULL);
+   job_started = true;
+   job_started_time = time(NULL);
 }
 
 void JCR::setJobStatus(int newJobStatus)
 {
-   JCR *jcr = this;
    int priority, old_priority;
-   int oldJobStatus = jcr->JobStatus;
+   int oldJobStatus = JobStatus;
    priority = get_status_priority(newJobStatus);
    old_priority = get_status_priority(oldJobStatus);
 
    Dmsg2(800, "set_jcr_job_status(%s, %c)\n", Job, newJobStatus);
 
    /* Update wait_time depending on newJobStatus and oldJobStatus */
-   update_wait_time(jcr, newJobStatus);
+   update_wait_time(this, newJobStatus);
 
    /*
     * For a set of errors, ... keep the current status
@@ -907,13 +920,13 @@ void JCR::setJobStatus(int newJobStatus)
    if (priority > old_priority || (
        priority == 0 && old_priority == 0)) {
       Dmsg4(800, "Set new stat. old: %c,%d new: %c,%d\n",
-         jcr->JobStatus, old_priority, newJobStatus, priority);
-      jcr->JobStatus = newJobStatus;     /* replace with new status */
+         JobStatus, old_priority, newJobStatus, priority);
+      JobStatus = newJobStatus;     /* replace with new status */
    }
 
-   if (oldJobStatus != jcr->JobStatus) {
+   if (oldJobStatus != JobStatus) {
       Dmsg2(800, "leave setJobStatus old=%c new=%c\n", oldJobStatus, newJobStatus);
-//    generate_plugin_event(jcr, bEventStatusChange, NULL);
+//    generate_plugin_event(this, bEventStatusChange, NULL);
    }
 }
 
@@ -1159,7 +1172,7 @@ extern "C" void timeout_handler(int sig)
 }
 
 /* Used to display specific daemon information after a fatal signal
- * (like B_DB in the director)
+ * (like BDB in the director)
  */
 #define MAX_DBG_HOOK 10
 static dbg_jcr_hook_t *dbg_jcr_hooks[MAX_DBG_HOOK];
@@ -1186,6 +1199,7 @@ void dbg_jcr_add_hook(dbg_jcr_hook_t *hook)
 void dbg_print_jcr(FILE *fp)
 {
    char buf1[128], buf2[128], buf3[128], buf4[128];
+
    if (!jcrs) {
       return;
    }
@@ -1195,11 +1209,8 @@ void dbg_print_jcr(FILE *fp)
    for (JCR *jcr = (JCR *)jcrs->first(); jcr ; jcr = (JCR *)jcrs->next(jcr)) {
       fprintf(fp, "threadid=%p JobId=%d JobStatus=%c jcr=%p name=%s\n",
               get_threadid(jcr->my_thread_id), (int)jcr->JobId, jcr->JobStatus, jcr, jcr->Job);
-      fprintf(fp, "threadid=%p killable=%d JobId=%d JobStatus=%c "
-                  "jcr=%p name=%s\n",
-              get_threadid(jcr->my_thread_id), jcr->is_killable(),
-              (int)jcr->JobId, jcr->JobStatus, jcr, jcr->Job);
-      fprintf(fp, "\tuse_count=%i\n", jcr->use_count());
+      fprintf(fp, "\tuse_count=%i killable=%d\n",
+              jcr->use_count(), jcr->is_killable());
       fprintf(fp, "\tJobType=%c JobLevel=%c\n",
               jcr->getJobType(), jcr->getJobLevel());
       bstrftime(buf1, sizeof(buf1), jcr->sched_time);
diff --git a/src/lib/lex.c b/src/lib/lex.c
index ead211c..a337757 100644
--- a/src/lib/lex.c
+++ b/src/lib/lex.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Lexical scanner for Bacula configuration file
@@ -34,7 +38,7 @@ static const int dbglvl = 5000;
 void scan_to_eol(LEX *lc)
 {
    int token;
-   Dmsg0(dbglvl, "start scan to eof\n");
+   Dmsg0(dbglvl, "start scan to eol\n");
    while ((token = lex_get_token(lc, T_ALL)) != T_EOL) {
       if (token == T_EOB) {
          lex_unget_char(lc);
@@ -127,7 +131,9 @@ LEX *lex_close_file(LEX *lf)
       fclose(lf->fd);
    }
    Dmsg1(dbglvl, "Close cfg file %s\n", lf->fname);
-   free(lf->fname);
+   if (lf->fname) {
+      free(lf->fname);
+   }
    free_memory(lf->line);
    lf->line = NULL;
    free_memory(lf->str);
@@ -147,6 +153,56 @@ LEX *lex_close_file(LEX *lf)
 }
 
 /*
+ * Open a configuration in memory buffer. We push the
+ * state of the current file (lf) so that we
+ * can do includes.  This is a bit of a hammer.
+ * Instead of passing back the pointer to the
+ * new packet, I simply replace the contents
+ * of the caller's packet with the new packet,
+ * and link the contents of the old packet into
+ * the next field.
+ *
+ */
+LEX *lex_open_buf(LEX *lf, const char *buffer, LEX_ERROR_HANDLER *scan_error)
+
+{
+   LEX *nf;
+
+   Dmsg0(400, "Open config buffer\n");
+   nf = (LEX *)malloc(sizeof(LEX));
+   if (lf) {
+      memcpy(nf, lf, sizeof(LEX));
+      memset(lf, 0, sizeof(LEX));
+      lf->next = nf;                  /* if have lf, push it behind new one */
+      lf->options = nf->options;      /* preserve user options */
+      /*
+       * preserve err_type to prevent bacula exiting on 'reload'
+       * if config is invalid. Fixes bug #877
+       */
+      lf->err_type = nf->err_type;
+   } else {
+      lf = nf;                        /* start new packet */
+      memset(lf, 0, sizeof(LEX));
+      lex_set_error_handler_error_type(lf, M_ERROR_TERM);
+   }
+   if (scan_error) {
+      lf->scan_error = scan_error;
+   } else {
+      lex_set_default_error_handler(lf);
+   }
+   lf->fd = NULL;
+   lf->bpipe = NULL;
+   lf->fname = NULL;
+   lf->line = get_memory(5000);
+   pm_strcpy(lf->line, buffer);
+   pm_strcat(lf->line, "");
+   lf->state = lex_none;
+   lf->ch = 0;
+   lf->str = get_memory(5000);
+   return lf;
+}
+
+/*
  * Open a new configuration file. We push the
  * state of the current file (lf) so that we
  * can do includes.  This is a bit of a hammer.
@@ -220,7 +276,7 @@ int lex_get_char(LEX *lf)
       Emsg0(M_ABORT, 0, _("get_char: called after EOF."
          " You may have a open double quote without the closing double quote.\n"));
    }
-   if (lf->ch == L_EOL) {
+   if (lf->fd && lf->ch == L_EOL) {
       if (bfgets(lf->line, lf->fd) == NULL) {
          lf->ch = L_EOF;
          if (lf->next) {
@@ -231,14 +287,32 @@ int lex_get_char(LEX *lf)
       lf->line_no++;
       lf->col_no = 0;
       Dmsg2(1000, "fget line=%d %s", lf->line_no, lf->line);
+   } else if (lf->ch == L_EOL) {
+      lf->line_no++;
+      lf->col_no++;
    }
    lf->ch = (uint8_t)lf->line[lf->col_no];
-   if (lf->ch == 0) {
-      lf->ch = L_EOL;
+   if (lf->fd) {
+      if (lf->ch == 0) {
+         lf->ch = L_EOL;           /* reached end of line, force bfgets */
+      } else {
+         lf->col_no++;
+      }
    } else {
-      lf->col_no++;
+      if (lf->ch == 0) {           /* End of buffer, stop scan */
+         lf->ch = L_EOF;
+         if (lf->next) {
+            lex_close_file(lf);
+         }
+         return lf->ch;
+      } else if (lf->ch == '\n') {  /* End of line */
+         Dmsg0(dbglvl, "Found newline return L_EOL\n");
+         lf->ch = L_EOL;
+      } else {
+         lf->col_no++;
+      }
    }
-   Dmsg2(dbglvl, "lex_get_char: %c %d\n", lf->ch, lf->ch);
+   Dmsg3(dbglvl, "lex_get_char: %c %d col=%d\n", lf->ch, lf->ch, lf->col_no);
    return lf->ch;
 }
 
@@ -380,12 +454,12 @@ lex_get_token(LEX *lf, int expect)
       to tell which byte we are expecting. */
    int bom_bytes_seen = 0;
 
-   Dmsg0(dbglvl, "enter lex_get_token\n");
+   Dmsg1(dbglvl, "enter lex_get_token state=%s\n", lex_state_to_str(lf->state));
    while (token == T_NONE) {
       ch = lex_get_char(lf);
       switch (lf->state) {
       case lex_none:
-         Dmsg2(dbglvl, "Lex state lex_none ch=%d,%x\n", ch, ch);
+         Dmsg2(dbglvl, "Lex state lex_none ch=%c,%d\n", ch, ch);
          if (B_ISSPACE(ch))
             break;
          if (B_ISALPHA(ch)) {
diff --git a/src/lib/lex.h b/src/lib/lex.h
index d2568fc..17afcda 100644
--- a/src/lib/lex.h
+++ b/src/lib/lex.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *   lex.h
diff --git a/src/lib/lib.h b/src/lib/lib.h
index 174e04b..cdeeeee 100644
--- a/src/lib/lib.h
+++ b/src/lib/lib.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *   Library includes for Bacula lib directory
@@ -59,3 +63,4 @@
 #include "htable.h"
 #include "sellist.h"
 #include "protos.h"
+#include "bget_msg.h"
diff --git a/src/lib/lockmgr.c b/src/lib/lockmgr.c
index a72dd72..109a7ee 100644
--- a/src/lib/lockmgr.c
+++ b/src/lib/lockmgr.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2008-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 
 /*
@@ -44,7 +48,7 @@
 
  */
 
-#define _LOCKMGR_COMPLIANT
+#define LOCKMGR_COMPLIANT
 #include "bacula.h"
 
 #undef ASSERT
@@ -69,14 +73,14 @@
   http://www.cs.berkeley.edu/~kamil/teaching/sp03/041403.pdf
 
   This lock manager will replace some pthread calls. It can be
-  enabled with _USE_LOCKMGR
+  enabled with USE_LOCKMGR
 
   Some part of the code can't use this manager, for example the
   rwlock object or the smartalloc lib. To disable LMGR, just add
-  _LOCKMGR_COMPLIANT before the inclusion of "bacula.h"
+  LOCKMGR_COMPLIANT before the inclusion of "bacula.h"
 
   cd build/src/tools
-  g++ -g -c lockmgr.c -I.. -I../lib -D_USE_LOCKMGR -D_TEST_IT
+  g++ -g -c lockmgr.c -I.. -I../lib -DUSE_LOCKMGR -D_TEST_IT
   g++ -o lockmgr lockmgr.o -lbac -L../lib/.libs -lssl -lpthread
 
 */
@@ -85,7 +89,7 @@
 
 /*
  * pthread_mutex_lock for memory allocator and other
- * parts that are _LOCKMGR_COMPLIANT
+ * parts that are LOCKMGR_COMPLIANT
  */
 void lmgr_p(pthread_mutex_t *m)
 {
@@ -107,13 +111,13 @@ void lmgr_v(pthread_mutex_t *m)
    }
 }
 
-#ifdef _USE_LOCKMGR
+#ifdef USE_LOCKMGR
 
 typedef enum
 {
    LMGR_WHITE,                  /* never seen */
    LMGR_BLACK,                  /* no loop */
-   LMGR_GREY                    /* seen before */
+   LMGR_GRAY                    /* already seen */
 } lmgr_color_t;
 
 /*
@@ -207,11 +211,11 @@ static void search_all_node(dlist *g, lmgr_node_t *v, alist *ret)
    }
 }
 
-static bool visite(dlist *g, lmgr_node_t *v)
+static bool visit(dlist *g, lmgr_node_t *v)
 {
    bool ret=false;
    lmgr_node_t *n;
-   v->mark_as_seen(LMGR_GREY);
+   v->mark_as_seen(LMGR_GRAY);
 
    alist *d = New(alist(5, false)); /* use alist because own=false */
    search_all_node(g, v, d);
@@ -221,11 +225,11 @@ static bool visite(dlist *g, lmgr_node_t *v)
    //}
 
    foreach_alist(n, d) {
-      if (n->seen == LMGR_GREY) { /* already seen this node */
+      if (n->seen == LMGR_GRAY) { /* already seen this node */
          ret = true;
          goto bail_out;
       } else if (n->seen == LMGR_WHITE) {
-         if (visite(g, n)) {
+         if (visit(g, n)) {
             ret = true;
             goto bail_out;
          }
@@ -242,7 +246,7 @@ static bool contains_cycle(dlist *g)
    lmgr_node_t *n;
    foreach_dlist(n, g) {
       if (n->seen == LMGR_WHITE) {
-         if (visite(g, n)) {
+         if (visit(g, n)) {
             return true;
          }
       }
@@ -271,6 +275,8 @@ typedef struct
 
 static int32_t global_event_id=0;
 
+static int global_int_thread_id=0; /* Keep an integer for each thread */
+
 /* Keep this number of event per thread */
 #ifdef _TEST_IT
 # define LMGR_THREAD_EVENT_MAX  15
@@ -286,6 +292,7 @@ public:
    dlink link;
    pthread_mutex_t mutex;
    pthread_t       thread_id;
+   intptr_t        int_thread_id;
    lmgr_lock_t     lock_list[LMGR_MAX_LOCK];
    int current;
    int max;
@@ -377,8 +384,13 @@ public:
    }
 
    void _dump(FILE *fp) {
+#ifdef HAVE_WIN32
+      fprintf(fp, "thread_id=%p int_threadid=%p max=%i current=%i\n",
+              (void *)(intptr_t)GetCurrentThreadId(), (void *)int_thread_id, max, current);
+#else
       fprintf(fp, "threadid=%p max=%i current=%i\n",
               (void *)thread_id, max, current);
+#endif
       for(int i=0; i<=current; i++) {
          fprintf(fp, "   lock=%p state=%s priority=%i %s:%i\n",
                  lock_list[i].lock,
@@ -570,6 +582,7 @@ void lmgr_register_thread(lmgr_thread_t *item)
 {
    lmgr_p(&lmgr_global_mutex);
    {
+      item->int_thread_id = ++global_int_thread_id;
       global_mgr->prepend(item);
    }
    lmgr_v(&lmgr_global_mutex);
@@ -590,6 +603,11 @@ void lmgr_unregister_thread(lmgr_thread_t *item)
    lmgr_v(&lmgr_global_mutex);
 }
 
+#ifdef HAVE_WIN32
+# define TID int_thread_id
+#else
+# define TID thread_id
+#endif
 /*
  * Search for a deadlock when it's secure to walk across
  * locks list. (after lmgr_detect_deadlock or a fatal signal)
@@ -616,9 +634,9 @@ bool lmgr_detect_deadlock_unlocked()
           *
           */
          if (lock->state == LMGR_LOCK_GRANTED) {
-            node = New(lmgr_node_t((void*)lock->lock, (void*)item->thread_id));
+            node = New(lmgr_node_t((void*)lock->lock, (void*)item->TID));
          } else if (lock->state == LMGR_LOCK_WANTED) {
-            node = New(lmgr_node_t((void*)item->thread_id, (void*)lock->lock));
+            node = New(lmgr_node_t((void*)item->TID, (void*)lock->lock));
          }
          if (node) {
             g->append(node);
@@ -745,6 +763,15 @@ inline lmgr_thread_t *lmgr_get_thread_info()
    }
 }
 
+/* On windows, the thread id is a struct, and sometime (for debug or openssl),
+ * we need a int
+ */
+intptr_t bthread_get_thread_id()
+{
+   lmgr_thread_t *self = lmgr_get_thread_info();
+   return self->int_thread_id;
+}
+
 /*
  * launch once for all threads
  */
@@ -817,6 +844,10 @@ void lmgr_cleanup_main()
    }
    if (use_undertaker) {
       pthread_cancel(undertaker);
+#ifdef DEVELOPER
+      /* Should avoid memory leak reporting */
+      pthread_join(undertaker, NULL);
+#endif
    }
    lmgr_cleanup_thread();
    lmgr_p(&lmgr_global_mutex);
@@ -1106,7 +1137,16 @@ int lmgr_thread_create(pthread_t *thread,
    return pthread_create(thread, attr, lmgr_thread_launcher, a);
 }
 
-#else  /* _USE_LOCKMGR */
+#else  /* USE_LOCKMGR */
+
+intptr_t bthread_get_thread_id()
+{
+# ifdef HAVE_WIN32
+   return (intptr_t)GetCurrentThreadId();
+# else
+   return (intptr_t)pthread_self();
+# endif
+}
 
 /*
  * !!! WARNING !!!
@@ -1118,7 +1158,7 @@ void dbg_print_lock(FILE *fp)
    Pmsg0(000, "lockmgr disabled\n");
 }
 
-#endif  /* _USE_LOCKMGR */
+#endif  /* USE_LOCKMGR */
 
 #ifdef _TEST_IT
 
diff --git a/src/lib/lockmgr.h b/src/lib/lockmgr.h
index 6844eeb..6cc2e4f 100644
--- a/src/lib/lockmgr.h
+++ b/src/lib/lockmgr.h
@@ -1,21 +1,25 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2008-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 
-#ifndef _LOCKMGR_H
-#define _LOCKMGR_H 1
+#ifndef LOCKMGR_H
+#define LOCKMGR_H 1
 
 #include "mutex_list.h"     /* Manage mutex with priority in a central place */
 
@@ -26,7 +30,12 @@
 void lmgr_p(pthread_mutex_t *m);
 void lmgr_v(pthread_mutex_t *m);
 
-#ifdef _USE_LOCKMGR
+/*
+ * Get integer thread id
+ */
+intptr_t bthread_get_thread_id();
+
+#ifdef USE_LOCKMGR
 
 typedef struct bthread_mutex_t
 {
@@ -181,17 +190,21 @@ int bthread_kill(pthread_t thread, int sig,
 #define bthread_cond_timedwait(x,y,z) bthread_cond_timedwait_p(x,y,z, __FILE__, __LINE__)
 
 /*
- * Define _LOCKMGR_COMPLIANT to use real pthread functions
+ * Define LOCKMGR_COMPLIANT to use real pthread functions
  */
 #define real_P(x) lmgr_p(&(x))
 #define real_V(x) lmgr_v(&(x))
 
-#ifdef _LOCKMGR_COMPLIANT
-# define P(x) lmgr_p(&(x))
-# define V(x) lmgr_v(&(x))
+#ifdef LOCKMGR_COMPLIANT
+# define P(x)  lmgr_p(&(x))
+# define pP(x) lmgr_p(x)
+# define V(x)  lmgr_v(&(x))
+# define pV(x) lmgr_v(x)
 #else
-# define P(x)                   bthread_mutex_lock_p(&(x), __FILE__, __LINE__)
-# define V(x)                   bthread_mutex_unlock_p(&(x), __FILE__, __LINE__)
+# define P(x)  bthread_mutex_lock_p(&(x), __FILE__, __LINE__)
+# define pP(x) bthread_mutex_lock_p((x), __FILE__, __LINE__)
+# define V(x)  bthread_mutex_unlock_p(&(x), __FILE__, __LINE__)
+# define pV(x) bthread_mutex_unlock_p((x), __FILE__, __LINE__)
 # define pthread_create(a, b, c, d)      lmgr_thread_create(a,b,c,d)
 # define pthread_mutex_lock(x)           bthread_mutex_lock(x)
 # define pthread_mutex_unlock(x)         bthread_mutex_unlock(x)
@@ -203,7 +216,7 @@ int bthread_kill(pthread_t thread, int sig,
 # endif
 #endif
 
-#else   /* _USE_LOCKMGR */
+#else   /* !USE_LOCKMGR */
 
 # define lmgr_detect_deadloc()
 # define lmgr_add_event_p(c, u, f, l)
@@ -224,14 +237,15 @@ int bthread_kill(pthread_t thread, int sig,
 # define lmgr_cond_wait(a,b)             pthread_cond_wait(a,b)
 # define lmgr_cond_timedwait(a,b,c)      pthread_cond_timedwait(a,b,c)
 # define bthread_mutex_t                 pthread_mutex_t
-# define P(x) lmgr_p(&(x))
-# define V(x) lmgr_v(&(x))
+# define P(x)  lmgr_p(&(x))
+# define pP(x) lmgr_p((x))
+# define V(x)  lmgr_v(&(x))
+# define pV(x) lmgr_v((x))
 # define BTHREAD_MUTEX_PRIORITY(p)      PTHREAD_MUTEX_INITIALIZER
 # define BTHREAD_MUTEX_NO_PRIORITY      PTHREAD_MUTEX_INITIALIZER
 # define BTHREAD_MUTEX_INITIALIZER      PTHREAD_MUTEX_INITIALIZER
 # define lmgr_mutex_is_locked(m)        (1)
 # define bthread_cond_wait_p(w, x, y, z) pthread_cond_wait(w,x)
+#endif  /* USE_LOCKMGR */
 
-#endif  /* _USE_LOCKMGR */
-
-#endif  /* _LOCKMGR_H */
+#endif  /* LOCKMGR_H */
diff --git a/src/lib/md5.c b/src/lib/md5.c
index 421b7a6..09bafa2 100644
--- a/src/lib/md5.c
+++ b/src/lib/md5.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * This code implements the MD5 message-digest algorithm.
@@ -161,7 +165,7 @@ void MD5Final(unsigned char digest[16], struct MD5Context *ctx)
     MD5Transform(ctx->buf, (uint32_t *) ctx->in);
     byteReverse((unsigned char *) ctx->buf, 4);
     memcpy(digest, ctx->buf, 16);
-    memset(ctx, 0, sizeof(*ctx));        /* In case it's sensitive */
+    memset(ctx, 0, sizeof(struct MD5Context));        /* In case it's sensitive */
 }
 
 
diff --git a/src/lib/md5.h b/src/lib/md5.h
index 3301481..a0414ba 100644
--- a/src/lib/md5.h
+++ b/src/lib/md5.h
@@ -1,25 +1,27 @@
 /*
- * Bacula MD5 definitions
- *
- *  Kern Sibbald, 2001
- *
- *   Version $Id$
- */
-/*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
+/*
+ * Bacula MD5 definitions
+ *
+ *  Kern Sibbald, 2001
+ */
 
 #ifndef __BMD5_H
 #define __BMD5_H
diff --git a/src/lib/mem_pool.c b/src/lib/mem_pool.c
index 84fec5c..7f8f86d 100644
--- a/src/lib/mem_pool.c
+++ b/src/lib/mem_pool.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *  Bacula memory pool routines.
@@ -85,6 +89,7 @@ struct abufhead {
    int32_t pool;                      /* pool */
    struct abufhead *next;             /* pointer to next free buffer */
    int32_t bnet_size;                 /* dummy for bnet_send() */
+   int32_t bnet_extension;            /* dummy for bnet extension */
 };
 
 static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
diff --git a/src/lib/mem_pool.h b/src/lib/mem_pool.h
index cc74bbe..0d4fccf 100644
--- a/src/lib/mem_pool.h
+++ b/src/lib/mem_pool.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Memory Pool prototypes
diff --git a/src/lib/message.c b/src/lib/message.c
index bc5da5c..4c32a12 100644
--- a/src/lib/message.c
+++ b/src/lib/message.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Bacula message handling routines
@@ -21,15 +25,15 @@
  *   otherwise you may get into recursive calls if there are
  *   errors, and that can lead to looping or deadlocks.
  *
- *   Written by Kern Sibbald, April 2000
+ *   Kern Sibbald, April 2000
  *
  */
 
 #include "bacula.h"
 #include "jcr.h"
 
-sql_query_func p_sql_query = NULL;
-sql_escape_func p_sql_escape = NULL;
+sql_query_call  p_sql_query = NULL;
+sql_escape_call p_sql_escape = NULL;
 
 #define FULL_LOCATION 1               /* set for file:line in Debug messages */
 
@@ -43,20 +47,21 @@ const char *version = VERSION " (" BDATE ")";
 const char *dist_name = DISTNAME " " DISTVER;
 char *exepath = (char *)NULL;
 char *exename = (char *)NULL;
-char *catalog_db = NULL;              /* database type */
+char db_engine_name[50] = {0};        /* Database engine name or type */
 char con_fname[500];                  /* Console filename */
-char my_name[30] = {0};               /* daemon name is stored here */
+char my_name[MAX_NAME_LENGTH] = {0};  /* daemon name is stored here */
 char host_name[50] = {0};             /* host machine name */
 char fail_time[30] = {0};             /* Time of failure */
 int verbose = 0;                      /* increase User messages */
 int64_t debug_level = 0;              /* debug level */
+int64_t debug_level_tags = 0;         /* debug tags */
 int32_t debug_flags = 0;              /* debug flags */
-int beef = BEEF;
 int console_msg_pending = false;
 utime_t daemon_start_time = 0;        /* Daemon start time */
 FILE *con_fd = NULL;                  /* Console file descriptor */
 brwlock_t con_lock;                   /* Console lock structure */
 bool dbg_timestamp = false;           /* print timestamp in debug output */
+bool dbg_thread = false;              /* add thread_id to details */
 bool prt_kaboom = false;              /* Print kaboom output */
 job_code_callback_t message_job_code_callback = NULL;   /* Job code callback. Only used by director. */
 
@@ -81,6 +86,7 @@ static bool trace = true;
 static bool trace = false;
 #endif
 static int hangup = 0;
+static int blowup = 0;
 
 /* Constants */
 const char *host_os = HOST_OS;
@@ -105,16 +111,6 @@ static const char *bstrrpath(const char *start, const char *end)
    return end;
 }
 
-/*
- * Returns: 0 if not configured
- *         -1 on error
- *          1 OK
- */
-int generate_daemon_event(JCR *jcr, const char *event)
-{
-   return 0;
-}
-
 /* Some message class methods */
 void MSGS::lock()
 {
@@ -197,6 +193,14 @@ void set_debug_flags(char *options)
          dbg_timestamp = false;
          break;
 
+      case 'h':
+         dbg_thread = true;
+         break;
+
+      case 'H':
+         dbg_thread = false;
+         break;
+
       case 'c':
          /* truncate the trace file */
          if (trace && trace_fd) {
@@ -300,15 +304,11 @@ set_assert_msg(const char *file, int line, const char *msg)
    assert_msg = bstrdup(buf);
 }
 
-void
-set_db_type(const char *name)
-{
-   if (catalog_db != NULL) {
-      free(catalog_db);
-   }
-   catalog_db = bstrdup(name);
-}
-
+void set_db_engine_name(const char *name)
+{ 
+   bstrncpy(db_engine_name, name, sizeof(db_engine_name)-1);
+} 
+ 
 /*
  * Initialize message handler for a daemon or a Job
  *   We make a copy of the MSGS resource passed, so it belows
@@ -584,6 +584,7 @@ void close_msg(JCR *jcr)
    Dmsg1(850, "===Begin close msg resource at %p\n", msgs);
    cmd = get_pool_memory(PM_MESSAGE);
    for (d=msgs->dest_chain; d; ) {
+      bool success;
       if (d->fd) {
          switch (d->dest_code) {
          case MD_FILE:
@@ -600,39 +601,18 @@ void close_msg(JCR *jcr)
             if (!d->fd) {
                break;
             }
+            success = jcr && (jcr->JobStatus == JS_Terminated || jcr->JobStatus == JS_Warnings);
 
-            switch (d->dest_code) {
-            case MD_MAIL_ON_ERROR:
-               if (jcr) {
-                  switch (jcr->JobStatus) {
-                  case JS_Terminated:
-                  case JS_Warnings:
-                     goto rem_temp_file;
-                  default:
-                     break;
-                  }
-               }
-               break;
-            case MD_MAIL_ON_SUCCESS:
-               if (jcr) {
-                  switch (jcr->JobStatus) {
-                  case JS_Terminated:
-                  case JS_Warnings:
-                     break;
-                  default:
-                     goto rem_temp_file;
-                  }
-               }
-               break;
-            default:
-               break;
+            if (d->dest_code == MD_MAIL_ON_ERROR && success) {
+               goto rem_temp_file;       /* no mail */
+            } else if (d->dest_code == MD_MAIL_ON_SUCCESS && !success) {
+               goto rem_temp_file;       /* no mail */
             }
 
             if (!(bpipe=open_mail_pipe(jcr, cmd, d))) {
                Pmsg0(000, _("open mail pipe failed.\n"));
-               goto rem_temp_file;
+               goto rem_temp_file;       /* error get out */
             }
-
             Dmsg0(850, "Opened mail pipe\n");
             len = d->max_len+10;
             line = get_memory(len);
@@ -667,6 +647,7 @@ void close_msg(JCR *jcr)
                                  "ERR=%s\n"), cmd, be.bstrerror());
             }
             free_memory(line);
+
 rem_temp_file:
             /* Remove temp mail file */
             if (d->fd) {
@@ -754,11 +735,9 @@ void term_msg()
    if (trace_fd) {
       fclose(trace_fd);
       trace_fd = NULL;
+      trace = false;
    }
-   if (catalog_db) {
-      free(catalog_db);
-      catalog_db = NULL;
-   }
+   working_directory = NULL;
    term_last_jobs_list();
 }
 
@@ -872,10 +851,11 @@ void dispatch_message(JCR *jcr, int type, utime_t mtime, char *msg)
 
     for (d=msgs->dest_chain; d; d=d->next) {
        if (bit_is_set(type, d->msg_types)) {
+          bool ok;
           switch (d->dest_code) {
              case MD_CATALOG:
                 char ed1[50];
-                if (!jcr || !jcr->db) {
+                if (!jcr || !jcr->db) { 
                    break;
                 }
                 if (p_sql_query && p_sql_escape) {
@@ -883,18 +863,17 @@ void dispatch_message(JCR *jcr, int type, utime_t mtime, char *msg)
                    POOLMEM *esc_msg = get_pool_memory(PM_MESSAGE);
 
                    int len = strlen(msg) + 1;
-                   esc_msg = check_pool_memory_size(esc_msg, len * 2 + 1);
-                   if (p_sql_escape(jcr, jcr->db, esc_msg, msg, len)) {
-                      bstrutime(dt, sizeof(dt), mtime);
-                      Mmsg(cmd, "INSERT INTO Log (JobId, Time, LogText) VALUES (%s,'%s','%s')",
-                            edit_int64(jcr->JobId, ed1), dt, esc_msg);
-                      if (!p_sql_query(jcr, cmd)) {
-                         delivery_error(_("Msg delivery error: Unable to store data in database.\n"));
-                      }
-                   } else {
-                      delivery_error(_("Msg delivery error: Unable to store data in database.\n"));
-                   }
-
+                   esc_msg = check_pool_memory_size(esc_msg, len*2+1);
+                   ok = p_sql_escape(jcr, jcr->db, esc_msg, msg, len);
+                   if (ok) {
+                      bstrutime(dt, sizeof(dt), mtime); 
+                      Mmsg(cmd, "INSERT INTO Log (JobId, Time, LogText) VALUES (%s,'%s','%s')", 
+                           edit_int64(jcr->JobId, ed1), dt, esc_msg);
+                      ok = p_sql_query(jcr, cmd);
+                   } 
+                   if (!ok) {
+                      delivery_error(_("Message delivery error: Unable to store data in database.\n"));
+                   } 
                    free_pool_memory(cmd);
                    free_pool_memory(esc_msg);
                 }
@@ -1099,13 +1078,13 @@ static void pt_out(char *buf)
  *
  *  If the level is negative, the details of file and line number
  *  are not printed.
+ *
  */
 void
-d_msg(const char *file, int line, int64_t level, const char *fmt,...)
+vd_msg(const char *file, int line, int64_t level, const char *fmt, va_list arg_ptr)
 {
     char      buf[5000];
-    int       len;
-    va_list   arg_ptr;
+    int       len = 0; /* space used in buf */
     bool      details = true;
     utime_t   mtime;
 
@@ -1117,31 +1096,39 @@ d_msg(const char *file, int line, int64_t level, const char *fmt,...)
     if (chk_dbglvl(level)) {
        if (dbg_timestamp) {
           mtime = time(NULL);
-          bstrftimes(buf, sizeof(buf), mtime);
+          bstrftimes(buf+len, sizeof(buf)-len, mtime);
           len = strlen(buf);
           buf[len++] = ' ';
-          buf[len] = 0;
-          pt_out(buf);
        }
 
 #ifdef FULL_LOCATION
        if (details) {
-          len = bsnprintf(buf, sizeof(buf), "%s: %s:%d-%u ",
-                my_name, get_basename(file), line, get_jobid_from_tsd());
-       } else {
-          len = 0;
+          if (dbg_thread) {
+             len += bsnprintf(buf+len, sizeof(buf)-len, "%s[%lld]: %s:%d-%u ",
+                             my_name, bthread_get_thread_id(),
+                             get_basename(file), line, get_jobid_from_tsd());
+          } else {
+             len += bsnprintf(buf+len, sizeof(buf)-len, "%s: %s:%d-%u ",
+                   my_name, get_basename(file), line, get_jobid_from_tsd());
+          }
        }
-#else
-       len = 0;
 #endif
-       va_start(arg_ptr, fmt);
        bvsnprintf(buf+len, sizeof(buf)-len, (char *)fmt, arg_ptr);
-       va_end(arg_ptr);
 
        pt_out(buf);
     }
 }
 
+void
+d_msg(const char *file, int line, int64_t level, const char *fmt,...)
+{
+   va_list arg_ptr;
+   va_start(arg_ptr, fmt);
+   vd_msg(file, line, level, fmt, arg_ptr); /* without tags */
+   va_end(arg_ptr);
+}
+
+
 /*
  * Set trace flag on/off. If argument is negative, there is no change
  */
@@ -1176,6 +1163,21 @@ int get_hangup(void)
    return hangup;
 }
 
+void set_blowup(int blowup_value)
+{
+   if (blowup_value < 0) {
+      return;
+   } else {
+      blowup = blowup_value;
+   }
+}
+
+int get_blowup(void)
+{
+   return blowup;
+}
+
+
 bool get_trace(void)
 {
    return trace;
@@ -1192,18 +1194,21 @@ void
 p_msg(const char *file, int line, int level, const char *fmt,...)
 {
     char      buf[5000];
-    int       len;
+    int       len = 0; /* space used in buf */
     va_list   arg_ptr;
 
+    if (dbg_timestamp) {
+       utime_t mtime = time(NULL);
+       bstrftimes(buf+len, sizeof(buf)-len, mtime);
+       len = strlen(buf);
+       buf[len++] = ' ';
+    }
+
 #ifdef FULL_LOCATION
     if (level >= 0) {
-       len = bsnprintf(buf, sizeof(buf), "%s: %s:%d-%u ",
+       len += bsnprintf(buf+len, sizeof(buf)-len, "%s: %s:%d-%u ",
              my_name, get_basename(file), line, get_jobid_from_tsd());
-    } else {
-       len = 0;
     }
-#else
-       len = 0;
 #endif
 
     va_start(arg_ptr, fmt);
@@ -1232,12 +1237,14 @@ t_msg(const char *file, int line, int64_t level, const char *fmt,...)
     va_list   arg_ptr;
     int       details = TRUE;
 
+    level = level & ~DT_ALL;    /* level should be tag free */
+
     if (level < 0) {
        details = FALSE;
        level = -level;
     }
 
-    if (chk_dbglvl(level)) {
+    if (level <= debug_level) {
        if (!trace_fd) {
           bsnprintf(buf, sizeof(buf), "%s/%s.trace", working_directory ? working_directory : ".", my_name);
           trace_fd = fopen(buf, "a+b");
@@ -1318,6 +1325,7 @@ e_msg(const char *file, int line, int type, int level, const char *fmt,...)
     bvsnprintf(buf+len, sizeof(buf)-len, (char *)fmt, arg_ptr);
     va_end(arg_ptr);
 
+    pt_out(buf);
     dispatch_message(NULL, type, 0, buf);
 
     if (type == M_ABORT) {
@@ -1457,6 +1465,10 @@ void j_msg(const char *file, int line, JCR *jcr, int type, utime_t mtime, const
    int i, len, maxlen;
    POOLMEM *pool_buf;
 
+   va_start(arg_ptr, fmt);
+   vd_msg(file, line, 0, fmt, arg_ptr);
+   va_end(arg_ptr);
+
    pool_buf = get_pool_memory(PM_EMSG);
    i = Mmsg(pool_buf, "%s:%d ", get_basename(file), line);
 
@@ -1619,6 +1631,12 @@ void Qmsg(JCR *jcr, int type, utime_t mtime, const char *fmt,...)
    if (!jcr) {
       jcr = get_jcr_from_tsd();
    }
+
+   if (jcr && type==M_FATAL) {
+      // TODO ASX MUST use a lock to protect access jcr->JobStatus from another thread
+      jcr->setJobStatus(JS_FatalError);
+    }
+
    /* If no jcr or no queue or dequeuing send to syslog */
    if (!jcr || !jcr->msg_queue || jcr->dequeuing_msgs) {
       syslog(LOG_DAEMON|LOG_ERR, "%s", item->msg);
@@ -1702,10 +1720,25 @@ static struct debugtags debug_tags[] = {
  { NT_("memory"),      DT_MEMORY,   _("Debug memory allocation")},
  { NT_("scheduler"),   DT_SCHEDULER,_("Debug scheduler information")},
  { NT_("protocol"),    DT_PROTOCOL, _("Debug protocol information")},
+ { NT_("snapshot"),    DT_SNAPSHOT, _("Debug snapshots")},
+ { NT_("asx"),         DT_ASX,      _("ASX personal's debugging")},
  { NT_("all"),         DT_ALL,      _("Debug all information")},
  { NULL,               0,   NULL}
 };
 
+#define MAX_TAG (sizeof(debug_tags) / sizeof(struct debugtags))
+
+const char *debug_get_tag(uint32_t pos, const char **desc)
+{
+   if (pos < MAX_TAG) {
+      if (desc) {
+         *desc = debug_tags[pos].help;
+      }
+      return debug_tags[pos].tag;
+   }
+   return NULL;
+}
+
 /* Allow +-, */
 bool debug_find_tag(const char *tagname, bool add, int64_t *current_level)
 {
@@ -1783,3 +1816,5 @@ bool debug_parse_tags(const char *options, int64_t *current_level)
    *current_level = level;
    return ret;
 }
+
+int generate_daemon_event(JCR *jcr, const char *event) { return 0; }
diff --git a/src/lib/message.h b/src/lib/message.h
index 382606f..32b4845 100644
--- a/src/lib/message.h
+++ b/src/lib/message.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Define Message Types for Bacula
@@ -153,8 +157,11 @@ struct MQUEUE_ITEM {
 #define    DT_MEMORY     (1<<24)                /* memory  */
 #define    DT_SCHEDULER  (1<<23)                /* scheduler */
 #define    DT_PROTOCOL   (1<<22)                /* protocol */
+#define    DT_SNAPSHOT   (1<<19)                /* Snapshot */
+#define    DT_ASX        (1<<16)                /* used by Alain for personal debugging */
 #define    DT_ALL        (0x7FFF0000)           /* all (up to debug_level 65635, 15 flags available) */
 
+const char *debug_get_tag(uint32_t pos, const char **desc);
 bool debug_find_tag(const char *tagname, bool add, int64_t *current_level);
 bool debug_parse_tags(const char *options, int64_t *current_level);
 
@@ -167,14 +174,15 @@ bool get_trace(void);
 void set_debug_flags(char *options);
 const char *get_basename(const char *pathname);
 
-class B_DB;
-typedef bool (*sql_query_func)(JCR *jcr, const char *cmd);
-typedef bool (*sql_escape_func)(JCR *jcr, B_DB *db, char *snew, char *old, int len);
+class BDB;                                              /* define forward reference */
+typedef bool (*sql_query_call)(JCR *jcr, const char *cmd);
+typedef bool (*sql_escape_call)(JCR *jcr, BDB *db, char *snew, char *sold, int len);
 
-extern DLL_IMP_EXP sql_query_func     p_sql_query;
-extern DLL_IMP_EXP sql_escape_func    p_sql_escape;
+extern DLL_IMP_EXP sql_query_call  p_sql_query;
+extern DLL_IMP_EXP sql_escape_call p_sql_escape;
 
 extern DLL_IMP_EXP int64_t       debug_level;
+extern DLL_IMP_EXP int64_t       debug_level_tags;
 extern DLL_IMP_EXP int32_t       debug_flags;
 extern DLL_IMP_EXP bool          dbg_timestamp;          /* print timestamp in debug output */
 extern DLL_IMP_EXP bool          prt_kaboom;             /* Print kaboom output */
diff --git a/src/lib/mntent_cache.c b/src/lib/mntent_cache.c
deleted file mode 100644
index 0b34c70..0000000
--- a/src/lib/mntent_cache.c
+++ /dev/null
@@ -1,484 +0,0 @@
-/*
-   Bacula® - The Network Backup Solution
-
-   Copyright (C) 2009-2014 Free Software Foundation Europe e.V.
-
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
-
-   You may use this file and others of this release according to the
-   license defined in the LICENSE file, which includes the Affero General
-   Public License, v3.0 ("AGPLv3") and some additional permissions and
-   terms pursuant to its AGPLv3 Section 7.
-
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
-
-/**
- * This code implements a cache with the current mounted filesystems for which
- * its uses the mostly in kernel mount information and export the different OS
- * specific interfaces using a generic interface. We use a hashed cache which is
- * accessed using a hash on the device id and we keep the previous cache hit as
- * most of the time we get called quite a lot with most of the time the same
- * device so keeping the previous cache hit we have a very optimized code path.
- *
- * This interface is implemented for the following OS-es:
- *
- * - Linux
- * - HPUX
- * - DARWIN (OSX)
- * - IRIX
- * - AIX
- * - OSF1 (Tru64)
- * - Solaris
- *
- * Currently we only use this code for Linux and OSF1 based fstype determination.
- * For the other OS-es we can use the fstype present in stat structure on those OS-es.
- *
- * This code replaces the big switch we used before based on SUPER_MAGIC present in
- * the statfs(2) structure but which need extra code for each new filesystem added to
- * the OS and for Linux that tends to be often as it has quite some different filesystems.
- * This new implementation should eliminate this as we use the Linux /proc/mounts in kernel
- * data which automatically adds any new filesystem when added to the kernel.
- */
-
-/*
- *  Marco van Wieringen, August 2009
- */
-
-#include "bacula.h"
-#include "mntent_cache.h"
-
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#if defined(HAVE_GETMNTENT)
-#if defined(HAVE_LINUX_OS) || \
-    defined(HAVE_HPUX_OS) || \
-    defined(HAVE_AIX_OS)
-#include <mntent.h>
-#elif defined(HAVE_SUN_OS)
-#include <sys/mnttab.h>
-#elif defined(HAVE_HURD_OS)
-#include <hurd/paths.h>
-#include <mntent.h>
-#endif /* HAVE_GETMNTENT */
-#elif defined(HAVE_GETMNTINFO)
-#if defined(HAVE_OPENBSD_OS)
-#include <sys/param.h>
-#include <sys/mount.h>
-#elif defined(HAVE_NETBSD_OS)
-#include <sys/types.h>
-#include <sys/statvfs.h>
-#else
-#include <sys/param.h>
-#include <sys/ucred.h>
-#include <sys/mount.h>
-#endif
-#elif defined(HAVE_AIX_OS)
-#include <fshelp.h>
-#include <sys/vfs.h>
-#elif defined(HAVE_OSF1_OS)
-#include <sys/mount.h>
-#endif
-
-/*
- * Protected data by mutex lock.
- */
-static pthread_mutex_t mntent_cache_lock = PTHREAD_MUTEX_INITIALIZER;
-static mntent_cache_entry_t *previous_cache_hit = NULL;
-static htable *mntent_cache_entry_hashtable = NULL;
-
-/*
- * Last time a rescan of the mountlist took place.
- */
-static time_t last_rescan = 0;
-
-static const char *skipped_fs_types[] = {
-#if defined(HAVE_LINUX_OS)
-   "rootfs",
-#endif
-   NULL
-};
-
-/**
- * Add a new entry to the cache.
- * This function should be called with a write lock on the mntent_cache.
- */
-static inline void add_mntent_mapping(uint32_t dev,
-                                      const char *special,
-                                      const char *mountpoint,
-                                      const char *fstype,
-                                      const char *mntopts)
-{
-   int len;
-   mntent_cache_entry_t *mce;
-
-   /*
-    * Calculate the length of all strings so we can allocate the buffer
-    * as one big chunk of memory using the hash_malloc method.
-    */
-   len = strlen(special) + 1;
-   len += strlen(mountpoint) + 1;
-   len += strlen(fstype) + 1;
-   if (mntopts) {
-      len += strlen(mntopts) + 1;
-   }
-
-   /*
-    * We allocate all members of the hash entry in the same memory chunk.
-    */
-   mce = (mntent_cache_entry_t *)mntent_cache_entry_hashtable->hash_malloc(sizeof(mntent_cache_entry_t) + len);
-   mce->dev = dev;
-
-   mce->special = (char *)mce + sizeof(mntent_cache_entry_t);
-   strcpy(mce->special, special);
-
-   mce->mountpoint = mce->special + strlen(mce->special) + 1;
-   strcpy(mce->mountpoint, mountpoint);
-
-   mce->fstype = mce->mountpoint + strlen(mce->mountpoint) + 1;
-   strcpy(mce->fstype, fstype);
-
-   if (mntopts) {
-      mce->mntopts = mce->fstype + strlen(mce->fstype) + 1;
-      strcpy(mce->mntopts, mntopts);
-   } else {
-      mce->mntopts = NULL;
-   }
-
-   mntent_cache_entry_hashtable->insert(mce->dev, mce);
-}
-
-static inline bool skip_fstype(const char *fstype)
-{
-   int i;
-
-   for (i = 0; skipped_fs_types[i]; i++) {
-      if (bstrcmp(fstype, skipped_fs_types[i]))
-         return true;
-   }
-
-   return false;
-}
-
-/**
- * OS specific function to load the different mntents into the cache.
- * This function should be called with a write lock on the mntent_cache.
- */
-static void refresh_mount_cache(void)
-{
-#if defined(HAVE_GETMNTENT)
-   FILE *fp;
-   struct stat st;
-#if defined(HAVE_LINUX_OS) || \
-    defined(HAVE_HPUX_OS) || \
-    defined(HAVE_IRIX_OS) || \
-    defined(HAVE_AIX_OS) || \
-    defined(HAVE_HURD_OS)
-   struct mntent *mnt;
-
-#if defined(HAVE_LINUX_OS)
-   if ((fp = setmntent("/proc/mounts", "r")) == (FILE *)NULL) {
-      if ((fp = setmntent(_PATH_MOUNTED, "r")) == (FILE *)NULL) {
-         return;
-      }
-   }
-#elif defined(HAVE_HPUX_OS)
-   if ((fp = fopen(MNT_MNTTAB, "r")) == (FILE *)NULL) {
-      return;
-   }
-#elif defined(HAVE_IRIX_OS)
-   if ((fp = setmntent(MOUNTED, "r")) == (FILE *)NULL) {
-      return;
-   }
-#elif defined(HAVE_AIX_OS)
-   if ((fp = setmntent(MNTTAB, "r")) == (FILE *)NULL) {
-      return;
-   }
-#elif defined(HAVE_HURD_OS)
-   if ((fp = setmntent(_PATH_MNTTAB, "r")) == (FILE *)NULL) {
-      return;
-   }
-#endif
-
-   while ((mnt = getmntent(fp)) != (struct mntent *)NULL) {
-      if (skip_fstype(mnt->mnt_type)) {
-         continue;
-      }
-
-      if (stat(mnt->mnt_dir, &st) < 0) {
-         continue;
-      }
-
-      add_mntent_mapping(st.st_dev, mnt->mnt_fsname, mnt->mnt_dir, mnt->mnt_type, mnt->mnt_opts);
-   }
-
-   endmntent(fp);
-#elif defined(HAVE_SUN_OS)
-   struct mnttab mnt;
-
-   if ((fp = fopen(MNTTAB, "r")) == (FILE *)NULL)
-      return;
-
-   while (getmntent(fp, &mnt) == 0) {
-      if (skip_fstype(mnt.mnt_fstype)) {
-         continue;
-      }
-
-      if (stat(mnt.mnt_mountp, &st) < 0) {
-         continue;
-      }
-
-      add_mntent_mapping(st.st_dev, mnt.mnt_special, mnt.mnt_mountp, mnt.mnt_fstype, mnt.mnt_mntopts);
-   }
-
-   fclose(fp);
-#endif /* HAVE_SUN_OS */
-#elif defined(HAVE_GETMNTINFO)
-   int cnt;
-   struct stat st;
-#if defined(HAVE_NETBSD_OS)
-   struct statvfs *mntinfo;
-#else
-   struct statfs *mntinfo;
-#endif
-#if defined(ST_NOWAIT)
-   int flags = ST_NOWAIT;
-#elif defined(MNT_NOWAIT)
-   int flags = MNT_NOWAIT;
-#else
-   int flags = 0;
-#endif
-
-   if ((cnt = getmntinfo(&mntinfo, flags)) > 0) {
-      while (cnt > 0) {
-         if (!skip_fstype(mntinfo->f_fstypename) &&
-             stat(mntinfo->f_mntonname, &st) == 0) {
-            add_mntent_mapping(st.st_dev,
-                               mntinfo->f_mntfromname,
-                               mntinfo->f_mntonname,
-                               mntinfo->f_fstypename,
-                               NULL);
-         }
-         mntinfo++;
-         cnt--;
-      }
-   }
-#elif defined(HAVE_AIX_OS)
-   int bufsize;
-   char *entries, *current;
-   struct vmount *vmp;
-   struct stat st;
-   struct vfs_ent *ve;
-   int n_entries, cnt;
-
-   if (mntctl(MCTL_QUERY, sizeof(bufsize), (struct vmount *)&bufsize) != 0) {
-      return;
-   }
-
-   entries = malloc(bufsize);
-   if ((n_entries = mntctl(MCTL_QUERY, bufsize, (struct vmount *) entries)) < 0) {
-      free(entries);
-      return;
-   }
-
-   cnt = 0;
-   current = entries;
-   while (cnt < n_entries) {
-      vmp = (struct vmount *)current;
-
-      if (skip_fstype(ve->vfsent_name)) {
-         continue;
-      }
-
-      if (stat(current + vmp->vmt_data[VMT_STUB].vmt_off, &st) < 0) {
-         continue;
-      }
-
-      ve = getvfsbytype(vmp->vmt_gfstype);
-      if (ve && ve->vfsent_name) {
-         add_mntent_mapping(st.st_dev,
-                            current + vmp->vmt_data[VMT_OBJECT].vmt_off,
-                            current + vmp->vmt_data[VMT_STUB].vmt_off,
-                            ve->vfsent_name,
-                            current + vmp->vmt_data[VMT_ARGS].vmt_off);
-      }
-      current = current + vmp->vmt_length;
-      cnt++;
-   }
-   free(entries);
-#elif defined(HAVE_OSF1_OS)
-   struct statfs *entries, *current;
-   struct stat st;
-   int n_entries, cnt;
-   int size;
-
-   if ((n_entries = getfsstat((struct statfs *)0, 0L, MNT_NOWAIT)) < 0) {
-      return;
-   }
-
-   size = (n_entries + 1) * sizeof(struct statfs);
-   entries = malloc(size);
-
-   if ((n_entries = getfsstat(entries, size, MNT_NOWAIT)) < 0) {
-      free(entries);
-      return;
-   }
-
-   cnt = 0;
-   current = entries;
-   while (cnt < n_entries) {
-      if (skip_fstype(current->f_fstypename)) {
-         continue;
-      }
-
-      if (stat(current->f_mntonname, &st) < 0) {
-         continue;
-      }
-      add_mntent_mapping(st.st_dev,
-                         current->f_mntfromname,
-                         current->f_mntonname,
-                         current->f_fstypename,
-                         NULL);
-      current++;
-      cnt++;
-   }
-   free(stats);
-#endif
-}
-
-/**
- * Clear the cache (either by flushing it or by initializing it.)
- * This function should be called with a write lock on the mntent_cache.
- */
-static void clear_mount_cache()
-{
-   mntent_cache_entry_t *mce = NULL;
-
-   if (!mntent_cache_entry_hashtable) {
-      /**
-       * Initialize the hash table.
-       */
-      mntent_cache_entry_hashtable = (htable *)malloc(sizeof(htable));
-      mntent_cache_entry_hashtable->init(mce, &mce->link,
-                                         NR_MNTENT_CACHE_ENTRIES,
-                                         NR_MNTENT_HTABLE_PAGES);
-   } else {
-      /**
-       * Clear the previous_cache_hit.
-       */
-      previous_cache_hit = NULL;
-
-      /**
-       * Destroy the current content and (re)initialize the hashtable.
-       */
-      mntent_cache_entry_hashtable->destroy();
-      mntent_cache_entry_hashtable->init(mce, &mce->link,
-                                         NR_MNTENT_CACHE_ENTRIES,
-                                         NR_MNTENT_HTABLE_PAGES);
-   }
-}
-
-/**
- * Initialize the cache for use.
- * This function should be called with a write lock on the mntent_cache.
- */
-static void initialize_mntent_cache(void)
-{
-   /**
-    * Make sure the cache is empty (either by flushing it or by initializing it.)
-    */
-   clear_mount_cache();
-
-   /**
-    * Refresh the cache.
-    */
-   refresh_mount_cache();
-}
-
-/**
- * Flush the current content from the cache.
- */
-void flush_mntent_cache(void)
-{
-   /**
-    * Lock the cache.
-    */
-   P(mntent_cache_lock);
-
-   if (mntent_cache_entry_hashtable) {
-      previous_cache_hit = NULL;
-      mntent_cache_entry_hashtable->destroy();
-      mntent_cache_entry_hashtable = NULL;
-   }
-
-   V(mntent_cache_lock);
-}
-
-/**
- * Find a mapping in the cache.
- */
-mntent_cache_entry_t *find_mntent_mapping(uint32_t dev)
-{
-   mntent_cache_entry_t *mce = NULL;
-   time_t now;
-
-   /**
-    * Lock the cache.
-    */
-   P(mntent_cache_lock);
-
-   /**
-    * Shortcut when we get a request for the same device again.
-    */
-   if (previous_cache_hit && previous_cache_hit->dev == dev) {
-      mce = previous_cache_hit;
-      goto ok_out;
-   }
-
-   /**
-    * Initialize the cache if that was not done before.
-    */
-   if (!mntent_cache_entry_hashtable) {
-      initialize_mntent_cache();
-      last_rescan = time(NULL);
-   } else {
-      /**
-       * We rescan the mountlist when called when more then
-       * MNTENT_RESCAN_INTERVAL seconds have past since the
-       * last rescan. This way we never work with data older
-       * then MNTENT_RESCAN_INTERVAL seconds.
-       */
-      now = time(NULL);
-      if ((now - last_rescan) > MNTENT_RESCAN_INTERVAL) {
-         initialize_mntent_cache();
-      }
-   }
-
-   mce = (mntent_cache_entry_t *)mntent_cache_entry_hashtable->lookup(dev);
-
-   /**
-    * If we fail to lookup the mountpoint its probably a mountpoint added
-    * after we did our initial scan. Lets rescan the mountlist and try
-    * the lookup again.
-    */
-   if (!mce) {
-      initialize_mntent_cache();
-      mce = (mntent_cache_entry_t *)mntent_cache_entry_hashtable->lookup(dev);
-   }
-
-   /*
-    * Store the last successfull lookup as the previous_cache_hit.
-    */
-   if (mce) {
-      previous_cache_hit = mce;
-   }
-
-ok_out:
-   V(mntent_cache_lock);
-   return mce;
-}
diff --git a/src/lib/mntent_cache.h b/src/lib/mntent_cache.h
deleted file mode 100644
index 9a064fb..0000000
--- a/src/lib/mntent_cache.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-   Bacula® - The Network Backup Solution
-
-   Copyright (C) 2009-2014 Free Software Foundation Europe e.V.
-
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
-
-   You may use this file and others of this release according to the
-   license defined in the LICENSE file, which includes the Affero General
-   Public License, v3.0 ("AGPLv3") and some additional permissions and
-   terms pursuant to its AGPLv3 Section 7.
-
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
-
-/*
- *  Marco van Wieringen, August 2009
- */
-
-#ifndef _MNTENT_CACHE_H
-#define _MNTENT_CACHE_H 1
-
-/*
- * Don't use the mountlist data when its older then this amount
- * of seconds but perform a rescan of the mountlist.
- */
-#define MNTENT_RESCAN_INTERVAL		1800
-
-/*
- * Initial size of number of hash entries we expect in the cache.
- * If more are needed the hash table will grow as needed.
- */
-#define NR_MNTENT_CACHE_ENTRIES		256
-
-/*
- * Number of pages to allocate for the big_buffer used by htable.
- */
-#define NR_MNTENT_HTABLE_PAGES		32
-
-struct mntent_cache_entry_t {
-   hlink link;
-   uint32_t dev;
-   char *special;
-   char *mountpoint;
-   char *fstype;
-   char *mntopts;
-};
-
-mntent_cache_entry_t *find_mntent_mapping(uint32_t dev);
-void flush_mntent_cache(void);
-
-#endif /* _MNTENT_CACHE_H */
diff --git a/src/lib/mutex_list.h b/src/lib/mutex_list.h
index ab76b14..11a2ee7 100644
--- a/src/lib/mutex_list.h
+++ b/src/lib/mutex_list.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2009-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 
 #ifndef MUTEX_LIST_H
diff --git a/src/lib/openssl.c b/src/lib/openssl.c
index 647f38e..985a78a 100644
--- a/src/lib/openssl.c
+++ b/src/lib/openssl.c
@@ -1,25 +1,27 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2005-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * openssl.c OpenSSL support functions
  *
  * Author: Landon Fuller <landonf at opendarwin.org>
  *
- * Version $Id$
- *
  * This file was contributed to the Bacula project by Landon Fuller.
  *
  * Landon Fuller has been granted a perpetual, worldwide, non-exclusive,
@@ -38,6 +40,9 @@
 
 #ifdef HAVE_OPENSSL
 
+/* Are we initialized? */
+static int crypto_initialized = false;
+
 /* Array of mutexes for use with OpenSSL static locking */
 static pthread_mutex_t *mutexes;
 
@@ -82,9 +87,6 @@ void openssl_post_errors(JCR *jcr, int code, const char *errstring)
  */
 static unsigned long get_openssl_thread_id(void)
 {
-#ifdef HAVE_WIN32
-   return (unsigned long)getpid();
-#else
    /*
     * Comparison without use of pthread_equal() is mandated by the OpenSSL API
     *
@@ -92,7 +94,6 @@ static unsigned long get_openssl_thread_id(void)
     *   emulation code, which defines pthread_t as a structure.
     */
    return ((unsigned long)pthread_self());
-#endif
 }
 
 /*
@@ -254,4 +255,81 @@ int openssl_save_prng (void)
    return 1;
 }
 
+/*
+ * Perform global initialization of OpenSSL
+ * This function is not thread safe.
+ *  Returns: 0 on success
+ *           errno on failure
+ */
+int init_crypto (void)
+{
+   int stat;
+
+   if ((stat = openssl_init_threads()) != 0) {
+      berrno be;
+      Jmsg1(NULL, M_ABORT, 0,
+        _("Unable to init OpenSSL threading: ERR=%s\n"), be.bstrerror(stat));
+   }
+
+   /* Load libssl and libcrypto human-readable error strings */
+   SSL_load_error_strings();
+
+   /* Initialize OpenSSL SSL  library */
+   SSL_library_init();
+
+   /* Register OpenSSL ciphers and digests */
+   OpenSSL_add_all_algorithms();
+
+   if (!openssl_seed_prng()) {
+      Jmsg0(NULL, M_ERROR_TERM, 0, _("Failed to seed OpenSSL PRNG\n"));
+   }
+
+   crypto_initialized = true;
+
+   return stat;
+}
+
+/*
+ * Perform global cleanup of OpenSSL
+ * All cryptographic operations must be completed before calling this function.
+ * This function is not thread safe.
+ *  Returns: 0 on success
+ *           errno on failure
+ */
+int cleanup_crypto (void)
+{
+   /*
+    * Ensure that we've actually been initialized; Doing this here decreases the
+    * complexity of client's termination/cleanup code.
+    */
+   if (!crypto_initialized) {
+      return 0;
+   }
+
+   if (!openssl_save_prng()) {
+      Jmsg0(NULL, M_ERROR, 0, _("Failed to save OpenSSL PRNG\n"));
+   }
+
+   openssl_cleanup_threads();
+
+   /* Free libssl and libcrypto error strings */
+   ERR_free_strings();
+
+   /* Free all ciphers and digests */
+   EVP_cleanup();
+
+   /* Free memory used by PRNG */
+   RAND_cleanup();
+
+   crypto_initialized = false;
+
+   return 0;
+}
+
+#else
+
+/* Dummy routines */
+int init_crypto (void) { return 0; }
+int cleanup_crypto (void) { return 0; }
+
 #endif /* HAVE_OPENSSL */
diff --git a/src/lib/openssl.h b/src/lib/openssl.h
index 339fafe..4e93cf0 100644
--- a/src/lib/openssl.h
+++ b/src/lib/openssl.h
@@ -1,25 +1,27 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2005-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * openssl.h OpenSSL support functions
  *
  * Author: Landon Fuller <landonf at opendarwin.org>
  *
- * Version $Id$
- *
  * This file was contributed to the Bacula project by Landon Fuller.
  *
  * Landon Fuller has been granted a perpetual, worldwide, non-exclusive,
diff --git a/src/lib/parse_conf.c b/src/lib/parse_conf.c
index b75786f..eb86e8a 100644
--- a/src/lib/parse_conf.c
+++ b/src/lib/parse_conf.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *   Master Configuration routines.
@@ -86,22 +90,22 @@ static bool find_config_file(const char *config_file, char *full_path, int max_p
  *  name         handler      value       code   flags  default_value
  */
 RES_ITEM msgs_items[] = {
-   {"name",        store_name,    ITEM(res_msgs.hdr.name),  0, 0, 0},
-   {"description", store_str,     ITEM(res_msgs.hdr.desc),  0, 0, 0},
-   {"mailcommand", store_str,     ITEM(res_msgs.mail_cmd),  0, 0, 0},
-   {"operatorcommand", store_str, ITEM(res_msgs.operator_cmd), 0, 0, 0},
-   {"syslog",      store_msgs, ITEM(res_msgs), MD_SYSLOG,   0, 0},
-   {"mail",        store_msgs, ITEM(res_msgs), MD_MAIL,     0, 0},
-   {"mailonerror", store_msgs, ITEM(res_msgs), MD_MAIL_ON_ERROR, 0, 0},
-   {"mailonsuccess", store_msgs, ITEM(res_msgs), MD_MAIL_ON_SUCCESS, 0, 0},
-   {"file",        store_msgs, ITEM(res_msgs), MD_FILE,     0, 0},
-   {"append",      store_msgs, ITEM(res_msgs), MD_APPEND,   0, 0},
-   {"stdout",      store_msgs, ITEM(res_msgs), MD_STDOUT,   0, 0},
-   {"stderr",      store_msgs, ITEM(res_msgs), MD_STDERR,   0, 0},
-   {"director",    store_msgs, ITEM(res_msgs), MD_DIRECTOR, 0, 0},
-   {"console",     store_msgs, ITEM(res_msgs), MD_CONSOLE,  0, 0},
-   {"operator",    store_msgs, ITEM(res_msgs), MD_OPERATOR, 0, 0},
-   {"catalog",     store_msgs, ITEM(res_msgs), MD_CATALOG,  0, 0},
+   {"Name",        store_name,    ITEM(res_msgs.hdr.name),  0, 0, 0},
+   {"Description", store_str,     ITEM(res_msgs.hdr.desc),  0, 0, 0},
+   {"MailCommand", store_str,     ITEM(res_msgs.mail_cmd),  0, 0, 0},
+   {"OperatorCommand", store_str, ITEM(res_msgs.operator_cmd), 0, 0, 0},
+   {"Syslog",      store_msgs, ITEM(res_msgs), MD_SYSLOG,   0, 0},
+   {"Mail",        store_msgs, ITEM(res_msgs), MD_MAIL,     0, 0},
+   {"MailOnError", store_msgs, ITEM(res_msgs), MD_MAIL_ON_ERROR, 0, 0},
+   {"MailOnSuccess", store_msgs, ITEM(res_msgs), MD_MAIL_ON_SUCCESS, 0, 0},
+   {"File",        store_msgs, ITEM(res_msgs), MD_FILE,     0, 0},
+   {"Append",      store_msgs, ITEM(res_msgs), MD_APPEND,   0, 0},
+   {"Stdout",      store_msgs, ITEM(res_msgs), MD_STDOUT,   0, 0},
+   {"Stderr",      store_msgs, ITEM(res_msgs), MD_STDERR,   0, 0},
+   {"Director",    store_msgs, ITEM(res_msgs), MD_DIRECTOR, 0, 0},
+   {"Console",     store_msgs, ITEM(res_msgs), MD_CONSOLE,  0, 0},
+   {"Operator",    store_msgs, ITEM(res_msgs), MD_OPERATOR, 0, 0},
+   {"Catalog",     store_msgs, ITEM(res_msgs), MD_CATALOG,  ITEM_LAST, 0},
    {NULL,          NULL,       {0},       0, 0, 0}
 };
 
@@ -111,40 +115,35 @@ struct s_mtypes {
 };
 /* Various message types */
 static struct s_mtypes msg_types[] = {
-   {"debug",         M_DEBUG},
-   {"abort",         M_ABORT},
-   {"fatal",         M_FATAL},
-   {"error",         M_ERROR},
-   {"warning",       M_WARNING},
-   {"info",          M_INFO},
-   {"saved",         M_SAVED},
-   {"notsaved",      M_NOTSAVED},
-   {"skipped",       M_SKIPPED},
-   {"mount",         M_MOUNT},
-   {"terminate",     M_TERM},
-   {"restored",      M_RESTORED},
-   {"security",      M_SECURITY},
-   {"alert",         M_ALERT},
-   {"volmgmt",       M_VOLMGMT},
-   {"all",           M_MAX+1},
+   {"Debug",         M_DEBUG},
+   {"Abort",         M_ABORT},
+   {"Fatal",         M_FATAL},
+   {"Error",         M_ERROR},
+   {"Warning",       M_WARNING},
+   {"Info",          M_INFO},
+   {"Saved",         M_SAVED},
+   {"NotSaved",      M_NOTSAVED},
+   {"Skipped",       M_SKIPPED},
+   {"Mount",         M_MOUNT},
+   {"Terminate",     M_TERM},
+   {"Restored",      M_RESTORED},
+   {"Security",      M_SECURITY},
+   {"Alert",         M_ALERT},
+   {"VolMgmt",       M_VOLMGMT},
+   {"ErrorTerm",     M_ERROR_TERM},
+   {"All",           M_MAX+1},
    {NULL,            0}
 };
 
-/* Used for certain KeyWord tables */
-struct s_kw {
-   const char *name;
-   int token;
-};
-
 /*
  * Tape Label types permitted in Pool records
  *
  *   tape label      label code = token
  */
-static s_kw tapelabels[] = {
-   {"bacula",        B_BACULA_LABEL},
-   {"ansi",          B_ANSI_LABEL},
-   {"ibm",           B_IBM_LABEL},
+s_kw tapelabels[] = {
+   {"Bacula",        B_BACULA_LABEL},
+   {"ANSI",          B_ANSI_LABEL},
+   {"IBM",           B_IBM_LABEL},
    {NULL,            0}
 };
 
@@ -544,15 +543,20 @@ void store_alist_str(LEX *lc, RES_ITEM *item, int index, int pass)
    if (pass == 2) {
       if (*(item->value) == NULL) {
          list = New(alist(10, owned_by_alist));
+         *(item->value) = (char *)list;
       } else {
          list = (alist *)(*(item->value));
       }
-
-      lex_get_token(lc, T_STRING);   /* scan next item */
-      Dmsg4(900, "Append %s to alist %p size=%d %s\n",
-         lc->str, list, list->size(), item->name);
-      list->append(bstrdup(lc->str));
-      *(item->value) = (char *)list;
+      for (;;) {
+         lex_get_token(lc, T_STRING);   /* scan next item */
+         Dmsg4(900, "Append %s to alist 0x%p size=%d %s\n",
+            lc->str, list, list->size(), item->name);
+         list->append(bstrdup(lc->str));
+         if (lc->ch != ',') {         /* if no other item follows */
+            break;                    /* get out */
+         }
+         lex_get_token(lc, T_ALL);    /* eat comma */
+      }
    }
    scan_to_eol(lc);
    set_bit(index, res_all.hdr.item_present);
@@ -840,21 +844,6 @@ void CONFIG::init(
  *  Note, the default behavior unless you have set an alternate
  *  scan_error handler is to die on an error.
  */
-#ifdef xxx
-int
-parse_config(const char *cf, LEX_ERROR_HANDLER *scan_error, int err_type)
-{
-   int ok;
-   CONFIG *config = new_config_parser();
-   config->init(cf, scan_error, err_type, (void *)&res_all, res_all_size,
-                r_first, r_last, resources, res_head);
-   ok = config->parse_config();
-   free(config);
-   return ok;
-}
-#endif
-
-
 bool CONFIG::parse_config()
 {
    LEX *lc = NULL;
@@ -1031,28 +1020,7 @@ bail_out:
 
 const char *get_default_configdir()
 {
-#if defined(HAVE_WIN32)
-   HRESULT hr;
-   static char szConfigDir[MAX_PATH + 1] = { 0 };
-
-   if (!p_SHGetFolderPath) {
-      bstrncpy(szConfigDir, DEFAULT_CONFIGDIR, sizeof(szConfigDir));
-      return szConfigDir;
-   }
-
-   if (szConfigDir[0] == '\0') {
-      hr = p_SHGetFolderPath(NULL, CSIDL_COMMON_APPDATA, NULL, 0, szConfigDir);
-
-      if (SUCCEEDED(hr)) {
-         bstrncat(szConfigDir, "\\Bacula", sizeof(szConfigDir));
-      } else {
-         bstrncpy(szConfigDir, DEFAULT_CONFIGDIR, sizeof(szConfigDir));
-      }
-   }
-   return szConfigDir;
-#else
    return SYSCONFDIR;
-#endif
 }
 
 /*
diff --git a/src/lib/parse_conf.h b/src/lib/parse_conf.h
index 88ac9d2..2eaf51c 100644
--- a/src/lib/parse_conf.h
+++ b/src/lib/parse_conf.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -19,6 +23,12 @@
  *
  */
 
+/* Used for certain keyword tables */
+struct s_kw {
+   const char *name;
+   uint32_t token;
+};
+
 struct RES_ITEM;                    /* Declare forward referenced structure */
 struct RES_ITEM2;                  /* Declare forward referenced structure */
 class RES;                         /* Declare forware referenced structure */
@@ -113,6 +123,7 @@ struct RES_TABLE {
 #define ITEM_REQUIRED    0x1          /* item required */
 #define ITEM_DEFAULT     0x2          /* default supplied */
 #define ITEM_NO_EQUALS   0x4          /* Don't scan = after name */
+#define ITEM_LAST        0x8          /* Last item in list */
 
 /* Message Resource */
 class MSGS {
diff --git a/src/lib/plugins.c b/src/lib/plugins.c
index fef2787..95ec2b1 100644
--- a/src/lib/plugins.c
+++ b/src/lib/plugins.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *    Plugin load/unloader for all Bacula daemons
@@ -43,7 +47,7 @@ static const int dbglvl = 50;
  * NOTE!!! This is a global do not try walking it with
  *   foreach_alist, you must use foreach_alist_index !!!!!!
  */
-alist *bplugin_list = NULL;
+alist *b_plugin_list = NULL;
 
 /*
  * Create a new plugin "class" entry and enter it in the
@@ -194,7 +198,7 @@ bool load_plugins(void *binfo, void *bfuncs, const char *plugin_dir,
       }
 
       found = true;                /* found a plugin */
-      bplugin_list->append(plugin);
+      b_plugin_list->append(plugin);
    }
 
 get_out:
@@ -217,10 +221,10 @@ void unload_plugins()
 {
    Plugin *plugin;
 
-   if (!bplugin_list) {
+   if (!b_plugin_list) {
       return;
    }
-   foreach_alist(plugin, bplugin_list) {
+   foreach_alist(plugin, b_plugin_list) {
       /* Shut it down and unload it */
       plugin->unloadPlugin();
       dlclose(plugin->pHandle);
@@ -229,8 +233,8 @@ void unload_plugins()
       }
       free(plugin);
    }
-   delete bplugin_list;
-   bplugin_list = NULL;
+   delete b_plugin_list;
+   b_plugin_list = NULL;
 }
 
 /*
@@ -251,12 +255,12 @@ void dbg_plugin_add_hook(dbg_plugin_hook_t *fct)
 void dbg_print_plugin(FILE *fp)
 {
    Plugin *plugin;
-   fprintf(fp, "Attempt to dump plugins. Hook count=%d\n", dbg_plugin_hook_count);
+   fprintf(fp, "List plugins. Hook count=%d\n", dbg_plugin_hook_count);
 
-   if (!bplugin_list) {
+   if (!b_plugin_list) {
       return;
    }
-   foreach_alist(plugin, bplugin_list) {
+   foreach_alist(plugin, b_plugin_list) {
       for(int i=0; i < dbg_plugin_hook_count; i++) {
 //       dbg_plugin_hook_t *fct = dbg_plugin_hooks[i];
          fprintf(fp, "Plugin %p name=\"%s\" disabled=%d\n",
diff --git a/src/lib/plugins.h b/src/lib/plugins.h
index b5f9021..cd5470d 100644
--- a/src/lib/plugins.h
+++ b/src/lib/plugins.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Common plugin definitions
@@ -28,7 +32,7 @@
  ****************************************************************************/
 
 #ifndef BUILD_PLUGIN
-extern DLL_IMP_EXP alist *bplugin_list;
+extern DLL_IMP_EXP  alist *b_plugin_list;
 #endif
 
 /* Universal return codes from all plugin functions */
diff --git a/src/lib/priv.c b/src/lib/priv.c
index 08f625e..663b466 100644
--- a/src/lib/priv.c
+++ b/src/lib/priv.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 
 #include "bacula.h"
diff --git a/src/lib/protos.h b/src/lib/protos.h
index 2e3f09b..c26df09 100644
--- a/src/lib/protos.h
+++ b/src/lib/protos.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Prototypes for lib directory of Bacula
@@ -42,6 +46,8 @@ int       bin_to_base64          (char *buf, int buflen, char *bin, int binlen,
 int       base64_to_bin(char *dest, int destlen, char *src, int srclen);
 
 /* bsys.c */
+int copyfile(const char *src, const char *dst);
+void setup_env(char *envp[]);
 POOLMEM  *quote_string           (POOLMEM *snew, const char *old);
 POOLMEM  *quote_where            (POOLMEM *snew, const char *old);
 char     *bstrncpy               (char *dest, const char *src, int maxlen);
@@ -61,6 +67,7 @@ void     *bcalloc                (size_t size1, size_t size2);
 int       bsnprintf              (char *str, int32_t size, const char *format, ...);
 int       bvsnprintf             (char *str, int32_t size, const char *format, va_list ap);
 int       pool_sprintf           (char *pool_buf, const char *fmt, ...);
+int       create_lock_file       (char *fname, const char *progname, const char *filetype, POOLMEM **errmsg);
 void      create_pid_file        (char *dir, const char *progname, int port);
 int       delete_pid_file        (char *dir, const char *progname, int port);
 void      drop                   (char *uid, char *gid, bool keep_readall_caps);
@@ -78,6 +85,7 @@ int       Zdeflate(char *in, int in_len, char *out, int &out_len);
 int       Zinflate(char *in, int in_len, char *out, int &out_len);
 void      stack_trace();
 int       safer_unlink(const char *pathname, const char *regex);
+int fs_get_free_space(const char *path, int64_t *freeval, int64_t *totalval);
 
 /* bnet.c */
 bool       bnet_tls_server       (TLS_CONTEXT *ctx, BSOCK *bsock,
@@ -95,7 +103,7 @@ int        bnet_get_peer           (BSOCK *bs, char *buf, socklen_t buflen);
 BSOCK *    dup_bsock             (BSOCK *bsock);
 void       term_bsock            (BSOCK *bsock);
 const char *bnet_strerror         (BSOCK *bsock);
-const char *bnet_sig_to_ascii     (BSOCK *bsock);
+const char *bnet_sig_to_ascii     (int32_t msglen);
 dlist *bnet_host2ipaddrs(const char *host, int family, const char **errstr);
 void       bnet_restore_blocking (BSOCK *sock, int flags);
 int        set_socket_errno(int sockstat);
@@ -104,7 +112,7 @@ int        set_socket_errno(int sockstat);
 int      bget_msg(BSOCK *sock);
 
 /* bpipe.c */
-BPIPE *          open_bpipe(char *prog, int wait, const char *mode);
+BPIPE *          open_bpipe(char *prog, int wait, const char *mode, char *envp[]=NULL);
 int              close_wpipe(BPIPE *bpipe);
 int              close_bpipe(BPIPE *bpipe);
 
@@ -115,7 +123,7 @@ void hmac_md5(uint8_t* text, int text_len, uint8_t* key, int key_len, uint8_t *h
 
 /* crc32.c */
 
-uint32_t bcrc32(uint8_t *buf, int len);
+uint32_t bcrc32(unsigned char *buf, int len);
 
 /* crypto.c */
 int                init_crypto                 (void);
@@ -199,6 +207,7 @@ uint32_t get_jobid_from_tid(pthread_t tid);
 /* lex.c */
 LEX *     lex_close_file         (LEX *lf);
 LEX *     lex_open_file          (LEX *lf, const char *fname, LEX_ERROR_HANDLER *scan_error);
+LEX *     lex_open_buf           (LEX *lf, const char *buf, LEX_ERROR_HANDLER *scan_error);
 int       lex_get_char           (LEX *lf);
 void      lex_unget_char         (LEX *lf);
 const char *  lex_tok_to_str     (int token);
@@ -223,23 +232,26 @@ void       dispatch_message      (JCR *jcr, int type, utime_t mtime, char *buf);
 void       init_console_msg      (const char *wd);
 void       free_msgs_res         (MSGS *msgs);
 void       dequeue_messages      (JCR *jcr);
+void       set_db_engine_name    (const char *name);
 void       set_trace             (int trace_flag);
 bool       get_trace             (void);
 void       set_hangup            (int hangup_value);
+void       set_blowup            (int blowup_value);
 int        get_hangup            (void);
-void       set_db_type           (const char *name);
+int        get_blowup            (void);
 void       set_assert_msg        (const char *file, int line, const char *msg);
 void       register_message_callback(void msg_callback(int type, char *msg));
 
 /* bnet_server.c */
-void       bnet_thread_server(dlist *addr_list, int max_clients, workq_t *client_wq,
-                   void *handle_client_request(void *bsock));
+void       bnet_thread_server(dlist *addr_list, int max_clients, 
+              workq_t *client_wq, void *handle_client_request(void *bsock));
 void       bnet_stop_thread_server(pthread_t tid);
 void             bnet_server             (int port, void handle_client_request(BSOCK *bsock));
 int              net_connect             (int port);
 BSOCK *          bnet_bind               (int port);
 BSOCK *          bnet_accept             (BSOCK *bsock, char *who);
 
+/* message.c */
 typedef int (EVENT_HANDLER)(JCR *jcr, const char *event);
 int generate_daemon_event(JCR *jcr, const char *event);
 
@@ -285,6 +297,7 @@ TLS_CONNECTION   *new_tls_connection     (TLS_CONTEXT *ctx, int fd);
 bool             tls_bsock_accept        (BSOCK *bsock);
 int              tls_bsock_writen        (BSOCK *bsock, char *ptr, int32_t nbytes);
 int              tls_bsock_readn         (BSOCK *bsock, char *ptr, int32_t nbytes);
+bool             tls_bsock_probe         (BSOCK *bsock);
 #endif /* HAVE_TLS */
 bool             tls_bsock_connect       (BSOCK *bsock);
 void             tls_bsock_shutdown      (BSOCK *bsock);
@@ -294,7 +307,7 @@ bool             get_tls_enable          (TLS_CONTEXT *ctx);
 
 
 /* util.c */
-bool             is_buf_zero             (char *buf, int len);
+bool             is_buf_zero             (const char *buf, int len);
 void             lcase                   (char *str);
 void             bash_spaces             (char *str);
 void             bash_spaces             (POOL_MEM &pm);
@@ -302,14 +315,17 @@ void             unbash_spaces           (char *str);
 void             unbash_spaces           (POOL_MEM &pm);
 char *           encode_time             (utime_t time, char *buf);
 char *           encode_mode             (mode_t mode, char *buf);
+char *           hexdump(const char *data, int len, char *buf, int capacity);
+char *           asciidump(const char *data, int len, char *buf, int capacity);
+char *           smartdump(const char *data, int len, char *buf, int capacity, bool *is_ascii=NULL);
 int              do_shell_expansion      (char *name, int name_len);
 void             jobstatus_to_ascii      (int JobStatus, char *msg, int maxlen);
 void             jobstatus_to_ascii_gui  (int JobStatus, char *msg, int maxlen);
 int              run_program             (char *prog, int wait, POOLMEM *&results);
-int              run_program_full_output (char *prog, int wait, POOLMEM *&results);
+int              run_program_full_output (char *prog, int wait, POOLMEM *&results, char *env[]=NULL);
 char *           action_on_purge_to_string(int aop, POOL_MEM &ret);
 const char *     job_type_to_str         (int type);
-const char *     job_status_to_str       (int stat);
+const char *     job_status_to_str       (int stat, int errors);
 const char *     job_level_to_str        (int level);
 const char *     volume_status_to_str    (const char *status);
 void             make_session_key        (char *key, char *seed, int mode);
diff --git a/src/lib/queue.c b/src/lib/queue.c
index bc64f02..4ad37b0 100644
--- a/src/lib/queue.c
+++ b/src/lib/queue.c
@@ -1,32 +1,35 @@
 /*
+   Bacula(R) - The Network Backup Solution
 
-                         Q U E U E
-                     Queue Handling Routines
-
-        Taken from smartall written by John Walker.
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-                  http://www.fourmilab.ch/smartall/
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
+   You may use this file and others of this release according to the
+   license defined in the LICENSE file, which includes the Affero General
+   Public License, v3.0 ("AGPLv3") and some additional permissions and
+   terms pursuant to its AGPLv3 Section 7.
 
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
 
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
-   Bacula® - The Network Backup Solution
 
-   Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
+                         Q U E U E
+                     Queue Handling Routines
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+        Taken from smartall written by John Walker.
 
-   You may use this file and others of this release according to the
-   license defined in the LICENSE file, which includes the Affero General
-   Public License, v3.0 ("AGPLv3") and some additional permissions and
-   terms pursuant to its AGPLv3 Section 7.
+                  http://www.fourmilab.ch/smartall/
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
 
 
+*/
+
 #include "bacula.h"
 
 /*  General purpose queue  */
diff --git a/src/lib/queue.h b/src/lib/queue.h
index f8d9ecc..a3fa685 100644
--- a/src/lib/queue.h
+++ b/src/lib/queue.h
@@ -1,24 +1,25 @@
 /*
- *  Written by John Walker MM
- *
- *   Version $Id$
- */
-/*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
 
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
+/*
+ *  Written by John Walker MM
+ */
 
 /*  General purpose queue  */
 
diff --git a/src/lib/rblist.c b/src/lib/rblist.c
index 81ef484..04a142b 100644
--- a/src/lib/rblist.c
+++ b/src/lib/rblist.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2005-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *  Bacula red-black binary tree routines.
@@ -370,7 +374,7 @@ void rblist::destroy()
 #ifdef TEST_PROGRAM
 
 struct MYJCR {
-   void link;
+   rblink link;
    char *buf;
 };
 
diff --git a/src/lib/rblist.h b/src/lib/rblist.h
index d804cd2..d4e1de1 100644
--- a/src/lib/rblist.h
+++ b/src/lib/rblist.h
@@ -1,23 +1,22 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2005-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
-
-/*
- *   Version $Id$
- */
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
 
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
 /* ========================================================================
  *
  *   red-black binary tree routines -- rblist.h
diff --git a/src/lib/res.c b/src/lib/res.c
index 9ee51f1..dff2006 100644
--- a/src/lib/res.c
+++ b/src/lib/res.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *  This file handles locking and seaching resources
diff --git a/src/lib/runscript.c b/src/lib/runscript.c
index 595021b..95536ab 100644
--- a/src/lib/runscript.c
+++ b/src/lib/runscript.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2006-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Manipulation routines for RunScript list
diff --git a/src/lib/runscript.h b/src/lib/runscript.h
index 2adb254..900c15c 100644
--- a/src/lib/runscript.h
+++ b/src/lib/runscript.h
@@ -1,22 +1,25 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2006-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Bacula RUNSCRIPT Structure definition for FileDaemon and Director
  * Eric Bollengier May 2006
- * Version $Id$
  */
 
 
@@ -46,7 +49,7 @@ enum {
    SCRIPT_Never  = 0,
    SCRIPT_After  = (1<<0),      /* AfterJob */
    SCRIPT_Before = (1<<1),      /* BeforeJob */
-   SCRIPT_AfterVSS = (1<<2),	/* BeforeJob and After VSS */
+   SCRIPT_AfterVSS = (1<<2),    /* BeforeJob and After VSS */
    SCRIPT_Any    = SCRIPT_Before | SCRIPT_After
 };
 
diff --git a/src/lib/rwlock.c b/src/lib/rwlock.c
index a077a66..cbad3be 100644
--- a/src/lib/rwlock.c
+++ b/src/lib/rwlock.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Bacula Thread Read/Write locking code. It permits
@@ -26,7 +30,7 @@
  *
  */
 
-#define _LOCKMGR_COMPLIANT
+#define LOCKMGR_COMPLIANT
 #include "bacula.h"
 
 /*
@@ -101,11 +105,6 @@ int rwl_destroy(brwlock_t *rwl)
   return (stat != 0 ? stat : (stat1 != 0 ? stat1 : stat2));
 }
 
-bool rwl_is_init(brwlock_t *rwl)
-{
-   return (rwl->valid == RWLOCK_VALID);
-}
-
 /*
  * Handle cleanup when the read lock condition variable
  * wait is released.
@@ -314,6 +313,12 @@ int rwl_writeunlock(brwlock_t *rwl)
    return (stat == 0 ? stat2 : stat);
 }
 
+bool is_rwl_valid(brwlock_t *rwl)
+{
+   return (rwl->valid == RWLOCK_VALID);
+}
+
+
 #ifdef TEST_RWLOCK
 
 #define THREADS     300
@@ -437,14 +442,11 @@ int main (int argc, char *argv[])
     int thread_writes = 0;
     int data_writes = 0;
 
-#ifdef USE_THR_SETCONCURRENCY
     /*
-     * On Solaris 2.5,2.6,7 and 8 threads are not timesliced. To ensure
-     * that our threads can run concurrently, we need to
-     * increase the concurrency level to THREADS.
+     * For Solaris 2.5,2.6,7 and 8 threads are not timesliced.
+     * Ensure our threads can run concurrently.
      */
-    thr_setconcurrency (THREADS);
-#endif
+    thr_setconcurrency(THREADS);      /* Only implemented on Solaris */
 
     /*
      * Initialize the shared data.
@@ -520,7 +522,7 @@ int main (int argc, char *argv[])
  *
  * Demonstrate use of non-blocking read-write locks.
  *
- * Special notes: On older Solaris system, call thr_setconcurrency()
+ * On older Solaris systems, call thr_setconcurrency()
  * to allow interleaved thread execution, since threads are not
  * timesliced.
  */
@@ -610,15 +612,12 @@ int main (int argc, char *argv[])
     int thread_updates = 0, data_updates = 0;
     int status;
 
-#ifdef USE_THR_SETCONCURRENCY
     /*
-     * On Solaris 2.5,2.6,7 and 8 threads are not timesliced. To ensure
-     * that our threads can run concurrently, we need to
-     * increase the concurrency level to THREADS.
+     * For Solaris 2.5,2.6,7 and 8 threads are not timesliced.
+     * Ensure our threads can run concurrently.
      */
     DPRINTF (("Setting concurrency level to %d\n", THREADS));
-    thr_setconcurrency (THREADS);
-#endif
+    thr_setconcurrency(THREADS);      /* Only implemented on Solaris */
 
     /*
      * Initialize the shared data.
diff --git a/src/lib/rwlock.h b/src/lib/rwlock.h
index ee5c947..f6a1178 100644
--- a/src/lib/rwlock.h
+++ b/src/lib/rwlock.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Bacula Thread Read/Write locking code. It permits
@@ -21,9 +25,6 @@
  *
  *  This code adapted from "Programming with POSIX Threads", by
  *    David R. Butenhof
- *
- *   Version $Id$
- *
  */
 
 #ifndef __RWLOCK_H
@@ -61,7 +62,6 @@ typedef struct s_rwsteal_tag {
  */
 extern int rwl_init(brwlock_t *wrlock, int priority=0);
 extern int rwl_destroy(brwlock_t *rwlock);
-extern bool rwl_is_init(brwlock_t *rwl);
 extern int rwl_readlock(brwlock_t *rwlock);
 extern int rwl_readtrylock(brwlock_t *rwlock);
 extern int rwl_readunlock(brwlock_t *rwlock);
@@ -69,5 +69,6 @@ extern int rwl_writelock_p(brwlock_t *rwlock,
                            const char *file="*unknown*", int line=0);
 extern int rwl_writetrylock(brwlock_t *rwlock);
 extern int rwl_writeunlock(brwlock_t *rwlock);
+extern bool is_rwl_valid(brwlock_t *rwl);
 
 #endif /* __RWLOCK_H */
diff --git a/src/lib/scan.c b/src/lib/scan.c
index 1581365..bbedc68 100644
--- a/src/lib/scan.c
+++ b/src/lib/scan.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *   scan.c -- scanning routines for Bacula
@@ -20,17 +24,15 @@
  *
  */
 
+
 #include "bacula.h"
 #include "jcr.h"
 #include "findlib/find.h"
 
-/*
- * Strip leading space from command line arguments
- */
+/* Strip leading space from command line arguments */
 void strip_leading_space(char *str)
 {
    char *p = str;
-
    while (B_ISSPACE(*p)) {
       p++;
    }
@@ -39,49 +41,35 @@ void strip_leading_space(char *str)
    }
 }
 
-/*
- * Strip any trailing junk from the command
- */
+
+/* Strip any trailing junk from the command */
 void strip_trailing_junk(char *cmd)
 {
    char *p;
 
-   /*
-    * Strip trailing junk from command
-    */
-   p = cmd + strlen(cmd) - 1;
-   while ((p >= cmd) && (*p == '\n' || *p == '\r' || *p == ' ')) {
+   /* strip trailing junk from command */
+   p = cmd - 1 + strlen(cmd);
+   while ((p >= cmd) && (B_ISSPACE(*p) || *p == '\n' || *p == '\r')) {
       *p-- = 0;
-   }
+   } 
 }
 
-/*
- * Strip any trailing newline characters from the string
- */
+/* Strip any trailing newline characters from the string */
 void strip_trailing_newline(char *cmd)
 {
    char *p;
-
-   p = cmd + strlen(cmd) - 1;
-   while ((p >= cmd) && (*p == '\n' || *p == '\r')) {
-      *p-- = 0;
-   }
+   p = cmd - 1 + strlen(cmd);
+   while ((p >= cmd) && (*p == '\n' || *p == '\r')) *p-- = 0;
 }
 
-/*
- * Strip any trailing slashes from a directory path
- */
+/* Strip any trailing slashes from a directory path */
 void strip_trailing_slashes(char *dir)
 {
    char *p;
 
-   /*
-    * Strip trailing slashes
-    */
-   p = dir + strlen(dir) - 1;
-   while (p >= dir && IsPathSeparator(*p)) {
-      *p-- = 0;
-   }
+   /* strip trailing slashes */
+   p = dir -1 + strlen(dir);
+   while (p >= dir && IsPathSeparator(*p)) *p-- = 0;
 }
 
 /*
@@ -123,10 +111,9 @@ bool skip_nonspaces(char **msg)
    return *p ? true : false;
 }
 
-/*
- * Folded search for string - case insensitive
- */
-int fstrsch(const char *a, const char *b)   /* folded case search */
+/* folded search for string - case insensitive */
+int
+fstrsch(const char *a, const char *b)   /* folded case search */
 {
    const char *s1,*s2;
    char c1, c2;
@@ -153,6 +140,7 @@ int fstrsch(const char *a, const char *b)   /* folded case search */
    return 1;
 }
 
+
 /*
  * Return next argument from command line.  Note, this
  *   routine is destructive because it stored 0 at the end
@@ -280,9 +268,7 @@ int parse_args_only(POOLMEM *cmd, POOLMEM **args, int *argc,
    strip_trailing_junk(*args);
    p = *args;
    *argc = 0;
-   /*
-    * Pick up all arguments
-    */
+   /* Pick up all arguments */
    while (*argc < max_args) {
       n = next_arg(&p);
       if (*n) {
@@ -295,13 +281,14 @@ int parse_args_only(POOLMEM *cmd, POOLMEM **args, int *argc,
    return 1;
 }
 
+
 /*
  * Given a full filename, split it into its path
  *  and filename parts. They are returned in pool memory
  *  in the arguments provided.
  */
 void split_path_and_filename(const char *fname, POOLMEM **path, int *pnl,
-                             POOLMEM **file, int *fnl)
+        POOLMEM **file, int *fnl)
 {
    const char *f;
    int slen;
diff --git a/src/lib/sellist.c b/src/lib/sellist.c
index 0997068..7fb221e 100644
--- a/src/lib/sellist.c
+++ b/src/lib/sellist.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2011-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *  Kern Sibbald, January  MMXII
diff --git a/src/lib/sellist.h b/src/lib/sellist.h
index 18389e9..e0386a1 100644
--- a/src/lib/sellist.h
+++ b/src/lib/sellist.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2011-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *  Kern Sibbald, January  MMXII
diff --git a/src/lib/serial.c b/src/lib/serial.c
index 560c6d6..2375ba6 100644
--- a/src/lib/serial.c
+++ b/src/lib/serial.c
@@ -1,22 +1,26 @@
 /*
+   Bacula(R) - The Network Backup Solution
 
-                   Serialisation Support Functions
-                          John Walker
-*/
-/*
-   Bacula® - The Network Backup Solution
-
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
+/*
+
+                   Serialisation Support Functions
+                          John Walker
 */
 
 
@@ -216,6 +220,29 @@ uint32_t unserial_uint32(uint8_t * * const ptr)
     return ntohl(vo);
 }
 
+/*  unserial_int64  --  Unserialise a 64 bit integer.  */
+
+int64_t unserial_int64(uint8_t * * const ptr)
+{
+    int64_t v;
+
+    if (bigendian()) {
+        memcpy(&v, *ptr, sizeof(int64_t));
+    } else {
+        int i;
+        uint8_t rv[sizeof(int64_t)];
+        uint8_t *pv = (uint8_t *) &v;
+
+        memcpy(&v, *ptr, sizeof(uint64_t));
+        for (i = 0; i < 8; i++) {
+            rv[i] = pv[7 - i];
+        }
+        memcpy(&v, &rv, sizeof(uint64_t));
+    }
+    *ptr += sizeof(uint64_t);
+    return v;
+}
+
 /*  unserial_uint64  --  Unserialise an unsigned 64 bit integer.  */
 
 uint64_t unserial_uint64(uint8_t * * const ptr)
diff --git a/src/lib/serial.h b/src/lib/serial.h
index fe73914..75324b3 100644
--- a/src/lib/serial.h
+++ b/src/lib/serial.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -67,12 +71,17 @@ extern void unserial_string(uint8_t * * const ptr, char * const str, int max);
 #define unser_length(x) ((uint32_t)(ser_ptr - (uint8_t *)(x)))
 
 /*  ser_end(x, s)  --  End serialisation into a buffer x of size s.  */
-#define ser_end(x, s)   ASSERT(ser_length(x) <= (s))
-#define unser_end(x, s)   ASSERT(ser_length(x) <= (s))
+#define ser_end(x, s)   ASSERT(ser_length(x) <= ((uint32_t)(s)))
+#define unser_end(x, s)   ASSERT(unser_length(x) <= ((uint32_t)(s)))
 
 /*  ser_check(x, s)  --  Verify length of serialised data in buffer x is
                          expected length s.  */
-#define ser_check(x, s) ASSERT(ser_length(x) == (s))
+#define ser_check(x, s) ASSERT(ser_length(x) == ((uint32_t)(s)))
+#define unser_check(x, s) ASSERT(unser_length(x) == ((uint32_t)(s)))
+
+/*  ser_assign(ptr, len) -- assign current position to ptr and go len bytes forward  */
+#define ser_assign(ptr, len) { ptr = (typeof(ptr))ser_ptr; ser_ptr += (len); }
+#define unser_assign(ptr, len) { ptr = (typeof(ptr))ser_ptr; ser_ptr += (len); }
 
 /*                          Serialisation                   */
 
diff --git a/src/lib/signal.c b/src/lib/signal.c
index e23f274..a9c4d1a 100644
--- a/src/lib/signal.c
+++ b/src/lib/signal.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *  Signal handlers for Bacula daemons
@@ -85,7 +89,7 @@ static void dbg_print_bacula()
 
    fprintf(stderr, "Dumping: %s\n", buf);
 
-   /* Print also B_DB and RWLOCK structure
+   /* Print also BDB and RWLOCK structure
     * Can add more info about JCR with dbg_jcr_add_hook()
     */
    dbg_print_lock(fp);
@@ -140,7 +144,7 @@ extern "C" void signal_handler(int sig)
    }
    already_dead++;
    /* Don't use Emsg here as it may lock and thus block us */
-   if (sig == SIGTERM) {
+   if (sig == SIGTERM || sig == SIGINT) {
        syslog(LOG_DAEMON|LOG_ERR, "Shutting down Bacula service: %s ...\n", my_name);
    } else {
       fprintf(stderr, _("Bacula interrupted by signal %d: %s\n"), sig, get_signal_name(sig));
@@ -152,7 +156,7 @@ extern "C" void signal_handler(int sig)
    }
 
 #ifdef TRACEBACK
-   if (sig != SIGTERM) {
+   if (sig != SIGTERM && sig != SIGINT) {
       struct sigaction sigdefault;
       static char *argv[5];
       static char pid_buf[20];
@@ -247,7 +251,7 @@ extern "C" void signal_handler(int sig)
 #ifdef direct_print
       if (prt_kaboom) {
          FILE *fd;
-         snprintf(buf, sizeof(buf), "%s/bacula.%s.traceback", working_directory, pid_buf);
+         snprintf(buf, sizeof(buf), "%s/%s.%s.traceback", working_directory, my_name, pid_buf);
          fd = fopen(buf, "r");
          if (fd != NULL) {
             printf("\n\n ==== Traceback output ====\n\n");
@@ -260,7 +264,7 @@ extern "C" void signal_handler(int sig)
       }
 #else
       if (prt_kaboom) {
-         snprintf(buf, sizeof(buf), "/bin/cat %s/bacula.%s.traceback", working_directory, pid_buf);
+         snprintf(buf, sizeof(buf), "/bin/cat %s/%s.%s.traceback", working_directory, my_name, pid_buf);
          fprintf(stderr, "\n\n ==== Traceback output ====\n\n");
          system(buf);
          fprintf(stderr, " ==== End traceback output ====\n\n");
@@ -387,7 +391,7 @@ void init_signals(void terminate(int sig))
    sigaction(SIGWINCH,  &sigignore, NULL);
    sigaction(SIGIO,     &sighandle, NULL);
 
-   sigaction(SIGINT,    &sigdefault, NULL);
+   sigaction(SIGINT,    &sighandle, NULL);
    sigaction(SIGXCPU,   &sigdefault, NULL);
    sigaction(SIGXFSZ,   &sigdefault, NULL);
 
diff --git a/src/lib/smartall.c b/src/lib/smartall.c
index b515419..6f77db1 100644
--- a/src/lib/smartall.c
+++ b/src/lib/smartall.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
 
@@ -30,7 +34,7 @@
 
 */
 
-#define _LOCKMGR_COMPLIANT
+#define LOCKMGR_COMPLIANT
 
 #include "bacula.h"
 /* Use the real routines here */
@@ -132,7 +136,7 @@ static void *smalloc(const char *fname, int lineno, unsigned int nbytes)
    } else {
       Emsg0(M_ABORT, 0, _("Out of memory\n"));
    }
-   Dmsg4(DT_MEMORY|50, "smalloc %d at %p from %s:%d\n", nbytes, buf, fname, lineno);
+   Dmsg4(DT_MEMORY|1050, "smalloc %d at %p from %s:%d\n", nbytes, buf, fname, lineno);
 #if    SMALLOC_SANITY_CHECK > 0
    if (sm_bytes > SMALLOC_SANITY_CHECK) {
       Emsg0(M_ABORT, 0, _("Too much memory used."));
@@ -147,9 +151,11 @@ static void *smalloc(const char *fname, int lineno, unsigned int nbytes)
 void sm_new_owner(const char *fname, int lineno, char *buf)
 {
    buf -= HEAD_SIZE;  /* Decrement to header */
+   P(mutex);
    ((struct abufhead *)buf)->abfname = bufimode ? NULL : fname;
    ((struct abufhead *)buf)->ablineno = (uint32_t) lineno;
    ((struct abufhead *)buf)->abin_use = true;
+   V(mutex);
    return;
 }
 
@@ -173,13 +179,13 @@ void sm_free(const char *file, int line, void *fp)
    struct abufhead *head = (struct abufhead *)cp;
 
    P(mutex);
-   Dmsg4(DT_MEMORY|50, "sm_free %d at %p from %s:%d\n",
+   Dmsg4(DT_MEMORY|1050, "sm_free %d at %p from %s:%d\n",
          head->ablen, fp,
          get_basename(head->abfname), head->ablineno);
 
    if (!head->abin_use) {
       V(mutex);
-      Emsg2(M_ABORT, 0, _("double free from %s:%d\n"), file, lineno);
+      Emsg2(M_ABORT, 0, _("in-use bit not set: double free from %s:%d\n"), file, lineno);
    }
    head->abin_use = false;
 
@@ -276,7 +282,7 @@ void *sm_realloc(const char *fname, int lineno, void *ptr, unsigned int size)
    void *buf;
    char *cp = (char *) ptr;
 
-   Dmsg4(DT_MEMORY|50, "sm_realloc %s:%d %p %d\n", get_basename(fname), (uint32_t)lineno, ptr, size);
+   Dmsg4(DT_MEMORY|1050, "sm_realloc %s:%d %p %d\n", get_basename(fname), (uint32_t)lineno, ptr, size);
    if (size <= 0) {
       e_msg(fname, lineno, M_ABORT, 0, _("sm_realloc size: %d\n"), size);
    }
@@ -316,7 +322,7 @@ void *sm_realloc(const char *fname, int lineno, void *ptr, unsigned int size)
       /* All done.  Free and dechain the original buffer. */
       sm_free(fname, lineno, ptr);
    }
-   Dmsg4(DT_MEMORY|60, _("sm_realloc %d at %p from %s:%d\n"), size, buf, get_basename(fname), (uint32_t)lineno);
+   Dmsg4(DT_MEMORY|1060, _("sm_realloc %d at %p from %s:%d\n"), size, buf, get_basename(fname), (uint32_t)lineno);
    return buf;
 }
 
@@ -347,7 +353,7 @@ void *actuallycalloc(unsigned int nelem, unsigned int elsize)
 
 void *actuallyrealloc(void *ptr, unsigned int size)
 {
-   Dmsg2(DT_MEMORY|40, "Actuallyrealloc %p %d\n", ptr, size);
+   Dmsg2(DT_MEMORY|1040, "Actuallyrealloc %p %d\n", ptr, size);
    return realloc(ptr, size);
 }
 
diff --git a/src/lib/smartall.h b/src/lib/smartall.h
index de2a040..d40c731 100644
--- a/src/lib/smartall.h
+++ b/src/lib/smartall.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
 
diff --git a/src/lib/status.h b/src/lib/status.h
index 8dacd18..5028480 100644
--- a/src/lib/status.h
+++ b/src/lib/status.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2008-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *  Status packet definition that is used in both the SD and FD. It
@@ -21,8 +25,6 @@
  *
  *     Kern Sibbald, March MMVII
  *
- *   Version $Id: $
- *
  */
 
 #ifndef __STATUS_H_
@@ -62,6 +64,9 @@ static void sendit(const char *msg, int len, STATUS_PKT *sp)
    }
 }
 
+#ifndef STATUS_FUNCTIONS
+#define STATUS_FUNCTIONS
+
 /* common to SD/FD */
 static void list_terminated_jobs(STATUS_PKT *sp)
 {
@@ -117,6 +122,8 @@ static void list_terminated_jobs(STATUS_PKT *sp)
       case JS_Warnings:
          termstat = _("OK -- with warnings");
          break;
+      case JS_Incomplete:
+         termstat = _("Incomplete");
          break;
       default:
          termstat = _("Other");
@@ -217,5 +224,6 @@ done:
 
 #endif /* HAVE_WIN32 */
 
+#endif  /* ! STATUS_FUNCTIONS */
 
 #endif
diff --git a/src/lib/tls.c b/src/lib/tls.c
index 32d4c75..0c9c761 100644
--- a/src/lib/tls.c
+++ b/src/lib/tls.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2005-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * tls.c TLS support functions
@@ -56,6 +60,8 @@ struct TLS_Context {
 
 struct TLS_Connection {
    SSL *openssl;
+   pthread_mutex_t wlock;  /* make openssl_bsock_readwrite() atomic when writing */
+   pthread_mutex_t rwlock; /* only one SSL_read() or SSL_write() at a time */
 };
 
 /*
@@ -108,8 +114,27 @@ TLS_CONTEXT *new_tls_context(const char *ca_certfile, const char *ca_certdir,
 
    ctx = (TLS_CONTEXT *)malloc(sizeof(TLS_CONTEXT));
 
-   /* Allocate our OpenSSL TLSv1 Context */
+   /* Allocate our OpenSSL TLS Context */
+#if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
+   /* Allows SSLv3, TLSv1, TLSv1.1 and TLSv1.2 protocols */
+   ctx->openssl = SSL_CTX_new(TLS_method());
+
+#elif (OPENSSL_VERSION_NUMBER >= 0x10000000L)
+   /* Allows most all protocols */
+   ctx->openssl = SSL_CTX_new(SSLv23_method());
+
+#else
+   /* Older method only understands TLSv1 */
    ctx->openssl = SSL_CTX_new(TLSv1_method());
+#endif
+
+   /* Use SSL_OP_ALL to turn on all "rather harmless" workarounds that
+    * OpenSSL offers 
+    */
+   SSL_CTX_set_options(ctx->openssl, SSL_OP_ALL);
+
+   /* Now disable old broken SSLv3 and SSLv2 protocols */
+   SSL_CTX_set_options(ctx->openssl, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3);
 
    if (!ctx->openssl) {
       openssl_post_errors(M_FATAL, _("Error initializing SSL context"));
@@ -443,6 +468,9 @@ TLS_CONNECTION *new_tls_connection(TLS_CONTEXT *ctx, int fd)
    /* Non-blocking partial writes */
    SSL_set_mode(tls->openssl, SSL_MODE_ENABLE_PARTIAL_WRITE|SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER);
 
+   pthread_mutex_init(&tls->wlock, NULL);
+   pthread_mutex_init(&tls->rwlock, NULL);
+
    return tls;
 
 err:
@@ -458,6 +486,8 @@ err:
  */
 void free_tls_connection(TLS_CONNECTION *tls)
 {
+   pthread_mutex_destroy(&tls->rwlock);
+   pthread_mutex_destroy(&tls->wlock);
    SSL_free(tls->openssl);
    free(tls);
 }
@@ -634,12 +664,18 @@ static inline int openssl_bsock_readwrite(BSOCK *bsock, char *ptr, int nbytes, b
 
    nleft = nbytes;
 
+   if (write) {
+      pthread_mutex_lock(&tls->wlock);
+   }
    while (nleft > 0) {
+
+      pthread_mutex_lock(&tls->rwlock);
       if (write) {
          nwritten = SSL_write(tls->openssl, ptr, nleft);
       } else {
          nwritten = SSL_read(tls->openssl, ptr, nleft);
       }
+      pthread_mutex_unlock(&tls->rwlock);
 
       /* Handle errors */
       switch (SSL_get_error(tls->openssl, nwritten)) {
@@ -702,6 +738,9 @@ static inline int openssl_bsock_readwrite(BSOCK *bsock, char *ptr, int nbytes, b
    }
 
 cleanup:
+   if (write) {
+      pthread_mutex_unlock(&tls->wlock);
+   }
    /* Restore saved flags */
    bsock->restore_blocking(flags);
 
@@ -724,6 +763,14 @@ int tls_bsock_readn(BSOCK *bsock, char *ptr, int32_t nbytes)
    return openssl_bsock_readwrite(bsock, ptr, nbytes, false);
 }
 
+/* test if 4 bytes can be read without "blocking" */
+bool tls_bsock_probe(BSOCK *bsock)
+{
+   int32_t pktsiz;
+   return SSL_peek(bsock->tls->openssl, &pktsiz, sizeof(pktsiz))==sizeof(pktsiz);
+}
+
+
 #else /* HAVE_OPENSSL */
 # error No TLS implementation available.
 #endif /* !HAVE_OPENSSL */
diff --git a/src/lib/tls.h b/src/lib/tls.h
index e9c90eb..5747ddd 100644
--- a/src/lib/tls.h
+++ b/src/lib/tls.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2005-2014 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * tls.h TLS support functions
diff --git a/src/lib/tree.c b/src/lib/tree.c
index 1012f17..81fdfe5 100644
--- a/src/lib/tree.c
+++ b/src/lib/tree.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2002-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Directory tree build/traverse routines
@@ -91,7 +95,7 @@ TREE_ROOT *new_tree(int count)
    root->type = TN_ROOT;
    root->fname = "";
    HL_ENTRY* entry = NULL;
-   root->hardlinks.init(entry, &entry->link, 0, 1);
+   root->hardlinks.init(entry, &entry->link, 0);
    return root;
 }
 
diff --git a/src/lib/tree.h b/src/lib/tree.h
index f2e7ec6..dd70d2f 100644
--- a/src/lib/tree.h
+++ b/src/lib/tree.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2002-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Directory tree build/traverse routines
diff --git a/src/lib/util.c b/src/lib/util.c
index c64e222..4267354 100644
--- a/src/lib/util.c
+++ b/src/lib/util.c
@@ -1,24 +1,26 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *   util.c  miscellaneous utility subroutines for Bacula
  *
  *    Kern Sibbald, MM
- *
- *   Version $Id$
  */
 
 #include "bacula.h"
@@ -31,10 +33,10 @@
  */
 
 /* Return true of buffer has all zero bytes */
-bool is_buf_zero(char *buf, int len)
+bool is_buf_zero(const char *buf, int len)
 {
    uint64_t *ip;
-   char *p;
+   const char *p;
    int i, len64, done, rem;
 
    if (buf[0] != 0) {
@@ -155,6 +157,95 @@ char *encode_time(utime_t utime, char *buf)
 
 
 
+static char hexatable[]="0123456789abcdef";
+
+/*
+ * do an hexadump of data[0:len] into buf[0:capacity]
+ * a space is inserted between every 4 bytes
+ * usage:
+ *    char buf[10];
+ *    Dmsg2("msglen=%d msg=%s", fd->msglen, hexdump(fd->msg, fd->msglen, buf, sizeof(buf));
+ * ==>
+ *    msglen=36 msg=12345678 12345678
+ */
+char *hexdump(const char *data, int len, char *buf, int capacity)
+{
+   char *b=buf;
+   int i=0;
+   while (i<len && capacity>2) {
+      if (i>0 && i%4==0) {
+         *(b++)=' ';
+         capacity--;
+      }
+      if (capacity>2) {
+         *(b++)=hexatable[(data[i]&0xF0)>>4];
+         *(b++)=hexatable[data[i++]&0x0F];
+      }
+      capacity-=2;
+   }
+   *b='\0';
+   return buf;
+}
+
+/*
+ * do an ASCII dump of data[0:len] into buf[0:capacity]
+ * non printable chars are replaced by hexa "\xx"
+ * usage:
+ *    char buf[10];
+ *    Dmsg2("msglen=%d msg=%s", fd->msglen, asciidump(fd->msg, fd->msglen, buf, sizeof(buf));
+ * ==>
+ *    msglen=5 msg=abcd\10
+ */
+char *asciidump(const char *data, int len, char *buf, int capacity)
+{
+   char *b=buf;
+   const unsigned char *p=(const unsigned char *)data;
+   while (len>0 && capacity>1) {
+      if (isprint(*p)) {
+         *(b++)=*(p++);
+         capacity--;
+      } else {
+         if (capacity>3) {
+            *(b++)='\\';
+            *(b++)=hexatable[((*p)&0xF0)>>4];
+            *(b++)=hexatable[(*(p++))&0x0F];
+         }
+         capacity-=3;
+      }
+      len--;
+   }
+   *b='\0';
+   return buf;
+}
+
+char *smartdump(const char *data, int len, char *buf, int capacity, bool *is_ascii)
+{
+   char *b=buf;
+   int l=len;
+   int c=capacity;
+   const unsigned char *p=(const unsigned char *)data;
+   if (is_ascii != NULL) {
+      *is_ascii = false;
+   }
+   while (l>0 && c>1) {
+      if (isprint(*p)) {
+         *(b++)=*(p++);
+      } else if (isspace(*p) || *p=='\0') {
+         *(b++)=' ';
+         p++;
+      } else {
+         return hexdump(data, len, buf, capacity);
+      }
+      c--;
+      l--;
+   }
+   *b='\0';
+   if (is_ascii != NULL) {
+      *is_ascii = true;
+   }
+   return buf;
+}
+
 /*
  * Convert a JobStatus code into a human readable form
  */
@@ -176,6 +267,9 @@ void jobstatus_to_ascii(int JobStatus, char *msg, int maxlen)
    case JS_Terminated:
       jobstat = _("OK");
       break;
+   case JS_Incomplete:
+      jobstat = _("Incomplete job");
+      break;
    case JS_FatalError:
    case JS_ErrorTerminated:
       jobstat = _("Error");
@@ -296,17 +390,20 @@ void jobstatus_to_ascii_gui(int JobStatus, char *msg, int maxlen)
    }
 }
 
-
 /*
  * Convert Job Termination Status into a string
  */
-const char *job_status_to_str(int stat)
+const char *job_status_to_str(int status, int errors)
 {
    const char *str;
 
-   switch (stat) {
+   switch (status) {
    case JS_Terminated:
-      str = _("OK");
+      if (errors > 0) {
+         str = _("OK -- with warnings");
+      } else {
+         str = _("OK");
+      }
       break;
    case JS_Warnings:
       str = _("OK -- with warnings");
@@ -707,6 +804,8 @@ void decode_session_key(char *decode, char *session, char *key, int maxlen)
  *  %v = Volume name
  *  %b = Job Bytes
  *  %F = Job Files
+ *  %E = Job Errors
+ *  %R = Job ReadBytes
  *
  *  omsg = edited output message
  *  imsg = input string containing edit codes (%x)
@@ -741,11 +840,14 @@ POOLMEM *edit_job_codes(JCR *jcr, char *omsg, char *imsg, const char *to, job_co
             break;
          case 'e':
             if (jcr) {
-               str = job_status_to_str(jcr->JobStatus);
+               str = job_status_to_str(jcr->JobStatus, jcr->getErrors());
             } else {
                str = _("*none*");
             }
             break;
+         case 'E':                    /* Job Errors */
+            str = edit_uint64(jcr->getErrors(), add);
+            break;
          case 'i':
             if (jcr) {
                bsnprintf(add, sizeof(add), "%d", jcr->JobId);
@@ -820,6 +922,9 @@ POOLMEM *edit_job_codes(JCR *jcr, char *omsg, char *imsg, const char *to, job_co
             edit_uint64(getpid(), add);
             str = add;
             break;
+         case 'R':                    /* Job ReadBytes */
+            str = edit_uint64(jcr->ReadBytes, add);
+            break;
          default:
             str = NULL;
             if (callback != NULL) {
diff --git a/src/lib/var.c b/src/lib/var.c
index 3e52682..644afda 100644
--- a/src/lib/var.c
+++ b/src/lib/var.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2003-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
 **  OSSP var - Variable Expansion
@@ -1863,6 +1867,7 @@ lookup_value(
     if (ctx->rel_lookup_flag && rc == VAR_ERR_UNDEFINED_VARIABLE) {
         ctx->rel_lookup_cnt--;
         buf[0] = EOS;
+        /* ****FIXME**** passing back stack variable!!! */
         *val_ptr  = buf;
         *val_len  = 0;
         *val_size = 0;
@@ -2403,7 +2408,7 @@ var_create(
         return VAR_RC(VAR_ERR_INVALID_ARGUMENT);
     if ((var = (var_t *)malloc(sizeof(var_t))) == NULL)
         return VAR_RC(VAR_ERR_OUT_OF_MEMORY);
-    memset(var, 0, sizeof(*var));
+    memset(var, 0, sizeof(var_t));
     var_config(var, VAR_CONFIG_SYNTAX, &var_syntax_default);
     *pvar = var;
     return VAR_OK;
@@ -2428,7 +2433,7 @@ var_config(
     ...)
 {
     va_list ap;
-    var_rc_t rc;
+    var_rc_t rc = VAR_OK;
 
     if (var == NULL)
         return VAR_RC(VAR_ERR_INVALID_ARGUMENT);
diff --git a/src/lib/var.h b/src/lib/var.h
index 0e60056..df94f86 100644
--- a/src/lib/var.h
+++ b/src/lib/var.h
@@ -1,19 +1,4 @@
 /*
-   Bacula® - The Network Backup Solution
-
-   Copyright (C) 2003-2014 Free Software Foundation Europe e.V.
-
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
-
-   You may use this file and others of this release according to the
-   license defined in the LICENSE file, which includes the Affero General
-   Public License, v3.0 ("AGPLv3") and some additional permissions and
-   terms pursuant to its AGPLv3 Section 7.
-
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
-/*
 **  OSSP var - Variable Expansion
 **  Copyright (c) 2001-2002 Ralf S. Engelschall <rse at engelschall.com>
 **  Copyright (c) 2001-2002 The OSSP Project (http://www.ossp.org/)
diff --git a/src/lib/waitq.h b/src/lib/waitq.h
index 69a6927..4059ee3 100644
--- a/src/lib/waitq.h
+++ b/src/lib/waitq.h
@@ -1,30 +1,32 @@
 /*
- * Bacula wait queue routines. Permits waiting for something
- *   to be done. I.e. for operator to mount new volume.
- *
- *  Kern Sibbald, March MMI
- *
- *  This code inspired from "Programming with POSIX Threads", by
- *    David R. Butenhof
- *
- *   Version $Id$
- *
- */
-/*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
+/*
+ * Bacula wait queue routines. Permits waiting for something
+ *   to be done. I.e. for operator to mount new volume.
+ *
+ *  Kern Sibbald, March MMI
+ *
+ *  This code inspired from "Programming with POSIX Threads", by
+ *    David R. Butenhof
+ *
+ */
 
 #ifndef __WAITQ_H
 #define __WAITQ_H 1
diff --git a/src/lib/watchdog.c b/src/lib/watchdog.c
index 9795397..8ee7761 100644
--- a/src/lib/watchdog.c
+++ b/src/lib/watchdog.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2002-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Bacula thread watchdog routine. General routine that
diff --git a/src/lib/watchdog.h b/src/lib/watchdog.h
index 3688cc1..8298d63 100644
--- a/src/lib/watchdog.h
+++ b/src/lib/watchdog.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2002-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Watchdog timer routines
diff --git a/src/lib/workq.c b/src/lib/workq.c
index 6a754d1..36bdd5c 100644
--- a/src/lib/workq.c
+++ b/src/lib/workq.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Bacula work queue routines. Permits passing work to
diff --git a/src/lib/workq.h b/src/lib/workq.h
index 90521cc..9a1b405 100644
--- a/src/lib/workq.h
+++ b/src/lib/workq.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Bacula work queue routines. Permits passing work to
@@ -21,8 +25,6 @@
  *
  *  This code adapted from "Programming with POSIX Threads", by
  *    David R. Butenhof
- *
- *   Version $Id$
  */
 
 #ifndef __WORKQ_H
diff --git a/src/plugins/Makefile b/src/plugins/Makefile
index cd007a2..2aa5d1d 100644
--- a/src/plugins/Makefile
+++ b/src/plugins/Makefile
@@ -1,6 +1,9 @@
 #
 # Simple Makefile for building test plugins for Bacula
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 
 first_rule: all
 dummy:
diff --git a/src/plugins/dir/Makefile.in b/src/plugins/dir/Makefile.in
index f49565c..6ba5121 100644
--- a/src/plugins/dir/Makefile.in
+++ b/src/plugins/dir/Makefile.in
@@ -1,6 +1,9 @@
 #
 # Simple Makefile for building test FD plugins for Bacula
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 @MCOMMON@
 
 
@@ -37,8 +40,7 @@ clean: @LIBTOOL_CLEAN_TARGET@
 	rm -f main *.so *.o 1 2 3
 
 distclean: clean
-	rm -f Makefile *.la *.lo
-	rm -rf .libs
+	rm -f Makefile
 
 libtool-uninstall:
 	$(LIBTOOL_UNINSTALL) $(RMF) $(DESTDIR)$(plugindir)/example-plugin-dir.la
diff --git a/src/plugins/dir/example-plugin-dir.c b/src/plugins/dir/example-plugin-dir.c
index ea32d42..40768e4 100644
--- a/src/plugins/dir/example-plugin-dir.c
+++ b/src/plugins/dir/example-plugin-dir.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Sample Plugin program
@@ -26,7 +30,7 @@
 extern "C" {
 #endif
 
-#define PLUGIN_LICENSE      "Bacula AGPLv3"
+#define PLUGIN_LICENSE      "AGPLv3"
 #define PLUGIN_AUTHOR       "Kern Sibbald"
 #define PLUGIN_DATE         "January 2008"
 #define PLUGIN_VERSION      "1"
@@ -79,7 +83,7 @@ bRC loadPlugin(bDirInfo *lbinfo, bDirFuncs *lbfuncs, pDirInfo **pinfo, pDirFuncs
    return bRC_OK;
 }
 
-bRC unloadPlugin()
+bRC unloadPlugin() 
 {
    printf("plugin: Unloaded\n");
    return bRC_OK;
@@ -102,13 +106,13 @@ static bRC freePlugin(bpContext *ctx)
    return bRC_OK;
 }
 
-static bRC getPluginValue(bpContext *ctx, pDirVariable var, void *value)
+static bRC getPluginValue(bpContext *ctx, pDirVariable var, void *value) 
 {
    printf("plugin: getPluginValue var=%d\n", var);
    return bRC_OK;
 }
 
-static bRC setPluginValue(bpContext *ctx, pDirVariable var, void *value)
+static bRC setPluginValue(bpContext *ctx, pDirVariable var, void *value) 
 {
    printf("plugin: setPluginValue var=%d\n", var);
    return bRC_OK;
diff --git a/src/plugins/fd/Makefile.in b/src/plugins/fd/Makefile.in
index 0255f49..914d865 100644
--- a/src/plugins/fd/Makefile.in
+++ b/src/plugins/fd/Makefile.in
@@ -1,6 +1,9 @@
 #
 # Simple Makefile for building test FD plugins for Bacula
 #
+# Copyright (C) 2000-2015 by Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 #
 @MCOMMON@
 
diff --git a/src/plugins/fd/bpipe-fd.c b/src/plugins/fd/bpipe-fd.c
index 3338514..fe58a2d 100644
--- a/src/plugins/fd/bpipe-fd.c
+++ b/src/plugins/fd/bpipe-fd.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * A simple pipe plugin for the Bacula File Daemon
@@ -35,7 +39,7 @@ extern "C" {
 
 static const int dbglvl = 150;
 
-#define PLUGIN_LICENSE      "Bacula AGPLv3"
+#define PLUGIN_LICENSE      "AGPLv3"
 #define PLUGIN_AUTHOR       "Kern Sibbald"
 #define PLUGIN_DATE         "January 2008"
 #define PLUGIN_VERSION      "1"
@@ -100,7 +104,7 @@ static pFuncs pluginFuncs = {
  */
 struct plugin_ctx {
    boffset_t offset;
-   FILE *fd;                          /* pipe file descriptor */
+   BPIPE *pfd;                        /* bpipe file descriptor */
    bool backup;                       /* set for backup (not needed) */
    char *cmd;                         /* plugin command line */
    char *fname;                       /* filename to "backup/restore" */
@@ -130,16 +134,16 @@ bRC loadPlugin(bInfo *lbinfo, bFuncs *lbfuncs, pInfo **pinfo, pFuncs **pfuncs)
 }
 
 /*
- * External entry point to unload the plugin
+ * External entry point to unload the plugin 
  */
-bRC unloadPlugin()
+bRC unloadPlugin() 
 {
 // printf("bpipe-fd: Unloaded\n");
    return bRC_OK;
 }
 
 /*
- * The following entry points are accessed through the function
+ * The following entry points are accessed through the function 
  *   pointers we supplied to Bacula. Each plugin type (dir, fd, sd)
  *   has its own set of entry points that the plugin must define.
  */
@@ -177,7 +181,7 @@ static bRC freePlugin(bpContext *ctx)
 /*
  * Return some plugin value (none defined)
  */
-static bRC getPluginValue(bpContext *ctx, pVariable var, void *value)
+static bRC getPluginValue(bpContext *ctx, pVariable var, void *value) 
 {
    return bRC_OK;
 }
@@ -185,7 +189,7 @@ static bRC getPluginValue(bpContext *ctx, pVariable var, void *value)
 /*
  * Set a plugin value (none defined)
  */
-static bRC setPluginValue(bpContext *ctx, pVariable var, void *value)
+static bRC setPluginValue(bpContext *ctx, pVariable var, void *value) 
 {
    return bRC_OK;
 }
@@ -209,7 +213,7 @@ static bRC handlePluginEvent(bpContext *ctx, bEvent *event, void *value)
     */
    switch (event->eventType) {
    case bEventPluginCommand:
-      bfuncs->DebugMessage(ctx, fi, li, dbglvl,
+      bfuncs->DebugMessage(ctx, fi, li, dbglvl, 
                            "bpipe-fd: PluginCommand=%s\n", (char *)value);
       break;
    case bEventJobStart:
@@ -270,7 +274,7 @@ static bRC handlePluginEvent(bpContext *ctx, bEvent *event, void *value)
       }
       *p++ = 0;           /* terminate reader string */
       p_ctx->writer = p;
-//    printf("bpipe-fd: plugin=%s fname=%s reader=%s writer=%s\n",
+//    printf("bpipe-fd: plugin=%s fname=%s reader=%s writer=%s\n", 
 //         p_ctx->cmd, p_ctx->fname, p_ctx->reader, p_ctx->writer);
       break;
 
@@ -281,7 +285,7 @@ static bRC handlePluginEvent(bpContext *ctx, bEvent *event, void *value)
    return bRC_OK;
 }
 
-/*
+/* 
  * Start the backup of a specific file
  */
 static bRC startBackupFile(bpContext *ctx, struct save_pkt *sp)
@@ -327,8 +331,8 @@ static bRC pluginIO(bpContext *ctx, struct io_pkt *io)
    if (!p_ctx) {
       return bRC_Error;
    }
-
-   io->status = 0;
+    
+   io->status = -1;
    io->io_errno = 0;
    switch(io->func) {
    case IO_OPEN:
@@ -336,12 +340,12 @@ static bRC pluginIO(bpContext *ctx, struct io_pkt *io)
       if (io->flags & (O_CREAT | O_WRONLY)) {
          char *writer_codes = apply_rp_codes(p_ctx);
 
-         p_ctx->fd = popen(writer_codes, "w");
-         bfuncs->DebugMessage(ctx, fi, li, dbglvl, "bpipe-fd: IO_OPEN fd=%d writer=%s\n",
-             p_ctx->fd, writer_codes);
-         if (!p_ctx->fd) {
+         p_ctx->pfd = open_bpipe(writer_codes, 0, "ws");
+         bfuncs->DebugMessage(ctx, fi, li, dbglvl, "bpipe-fd: IO_OPEN fd=%p writer=%s\n", 
+             p_ctx->pfd, writer_codes);
+         if (!p_ctx->pfd) {
             io->io_errno = errno;
-            bfuncs->JobMessage(ctx, fi, li, M_FATAL, 0,
+            bfuncs->JobMessage(ctx, fi, li, M_FATAL, 0, 
                "Open pipe writer=%s failed: ERR=%s\n", writer_codes, strerror(errno));
             if (writer_codes) {
                free(writer_codes);
@@ -351,85 +355,70 @@ static bRC pluginIO(bpContext *ctx, struct io_pkt *io)
          if (writer_codes) {
             free(writer_codes);
          }
+         io->status = fileno(p_ctx->pfd->wfd);
       } else {
-         p_ctx->fd = popen(p_ctx->reader, "r");
-         bfuncs->DebugMessage(ctx, fi, li, dbglvl, "bpipe-fd: IO_OPEN fd=%p reader=%s\n",
-            p_ctx->fd, p_ctx->reader);
-         if (!p_ctx->fd) {
+         p_ctx->pfd = open_bpipe(p_ctx->reader, 0, "rs");
+         bfuncs->DebugMessage(ctx, fi, li, dbglvl, "bpipe-fd: IO_OPEN fd=%p reader=%s\n", 
+            p_ctx->pfd, p_ctx->reader);
+         if (!p_ctx->pfd) {
             io->io_errno = errno;
-            bfuncs->JobMessage(ctx, fi, li, M_FATAL, 0,
+            bfuncs->JobMessage(ctx, fi, li, M_FATAL, 0, 
                "Open pipe reader=%s failed: ERR=%s\n", p_ctx->reader, strerror(errno));
             return bRC_Error;
          }
+         io->status = fileno(p_ctx->pfd->rfd);
       }
       sleep(1);                 /* let pipe connect */
       break;
 
    case IO_READ:
-      if (!p_ctx->fd) {
+      if (!p_ctx->pfd) {
          bfuncs->JobMessage(ctx, fi, li, M_FATAL, 0, "Logic error: NULL read FD\n");
          return bRC_Error;
       }
-      io->status = fread(io->buf, 1, io->count, p_ctx->fd);
+      io->status = fread(io->buf, 1, io->count, p_ctx->pfd->rfd);
 //    bfuncs->DebugMessage(ctx, fi, li, dbglvl, "bpipe-fd: IO_READ buf=%p len=%d\n", io->buf, io->status);
-      if (io->status == 0 && ferror(p_ctx->fd)) {
-         bfuncs->JobMessage(ctx, fi, li, M_FATAL, 0,
+      if (io->status == 0 && ferror(p_ctx->pfd->rfd)) {
+         bfuncs->JobMessage(ctx, fi, li, M_FATAL, 0, 
             "Pipe read error: ERR=%s\n", strerror(errno));
-         bfuncs->DebugMessage(ctx, fi, li, dbglvl,
+         bfuncs->DebugMessage(ctx, fi, li, dbglvl, 
             "Pipe read error: ERR=%s\n", strerror(errno));
          return bRC_Error;
       }
       break;
 
    case IO_WRITE:
-      if (!p_ctx->fd) {
+      if (!p_ctx->pfd) {
          bfuncs->JobMessage(ctx, fi, li, M_FATAL, 0, "Logic error: NULL write FD\n");
          return bRC_Error;
       }
 //    printf("bpipe-fd: IO_WRITE fd=%p buf=%p len=%d\n", p_ctx->fd, io->buf, io->count);
-      io->status = fwrite(io->buf, 1, io->count, p_ctx->fd);
+      io->status = fwrite(io->buf, 1, io->count, p_ctx->pfd->wfd);
 //    printf("bpipe-fd: IO_WRITE buf=%p len=%d\n", io->buf, io->status);
-      if (io->status == 0 && ferror(p_ctx->fd)) {
-         bfuncs->JobMessage(ctx, fi, li, M_FATAL, 0,
+      if (io->status == 0 && ferror(p_ctx->pfd->wfd)) {
+         bfuncs->JobMessage(ctx, fi, li, M_FATAL, 0, 
             "Pipe write error\n");
-         bfuncs->DebugMessage(ctx, fi, li, dbglvl,
+         bfuncs->DebugMessage(ctx, fi, li, dbglvl, 
             "Pipe read error: ERR=%s\n", strerror(errno));
          return bRC_Error;
       }
       break;
 
    case IO_CLOSE:
-      if (!p_ctx->fd) {
+      if (!p_ctx->pfd) {
          bfuncs->JobMessage(ctx, fi, li, M_FATAL, 0, "Logic error: NULL FD on bpipe close\n");
          return bRC_Error;
       }
-      io->status = pclose(p_ctx->fd);
-
-      /* Problem during execution */
-      if (io->status < 0) {
-         io->io_errno = errno;
-         bfuncs->JobMessage(ctx, fi, li, M_ERROR, 0, "bpipe-fd: Error closing stream for pseudo file %s: %d (%s)\n",
-                            p_ctx->fname, io->status, strerror(errno));
-
-      /* Problem inside the subprogram */
-      } else if (io->status > 0) {
-         int status=1;
-         if (WIFEXITED(io->status)) {    /* process exit()ed */
-            status = WEXITSTATUS(io->status);
-
-         } else if (WIFSIGNALED(io->status)) {  /* process died */
-#ifndef HAVE_WIN32
-            status = WTERMSIG(io->status);
-#endif
-         }
-         bfuncs->DebugMessage(ctx, fi, li, dbglvl, "bpipe-fd: exit=%d\n", io->status);
-         bfuncs->JobMessage(ctx, fi, li, M_ERROR, 0, "bpipe-fd: Error closing stream for pseudo file %s: exit %d\n",
-               p_ctx->fname, status);
+      io->status = close_bpipe(p_ctx->pfd);
+      if (io->status != 0) {
+         bfuncs->JobMessage(ctx, fi, li, M_ERROR, 0, "bpipe-fd: Error closing for file %s: %d\n", 
+                            p_ctx->fname, io->status);
       }
       break;
 
    case IO_SEEK:
       io->offset = p_ctx->offset;
+      io->status = 0;
       break;
    }
    return bRC_OK;
@@ -458,7 +447,7 @@ static bRC endRestoreFile(bpContext *ctx)
 /*
  * This is called during restore to create the file (if necessary)
  * We must return in rp->create_status:
- *
+ *   
  *  CF_ERROR    -- error
  *  CF_SKIP     -- skip processing this file
  *  CF_EXTRACT  -- extract the file (i.e.call i/o routines)
@@ -536,9 +525,9 @@ static char *apply_rp_codes(struct plugin_ctx * p_ctx)
       }
    }
 
-   /* Required mem:
-    * len(imsg)
-    * + number of "where" codes * (len(where)-2)
+   /* Required mem: 
+    * len(imsg) 
+    * + number of "where" codes * (len(where)-2) 
     * - number of "replace" codes
     */
    omsg = (char*)malloc(strlen(imsg) + (w_count * (strlen(p_ctx->where)-2)) - r_count + 1);
diff --git a/src/plugins/fd/example-plugin-fd.c b/src/plugins/fd/example-plugin-fd.c
index 3a6f843..1f16ea8 100644
--- a/src/plugins/fd/example-plugin-fd.c
+++ b/src/plugins/fd/example-plugin-fd.c
@@ -1,19 +1,22 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2010-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
 
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
 #define BUILD_PLUGIN
 #define BUILDING_DLL            /* required for Windows plugin */
 
@@ -102,7 +105,7 @@ loadPlugin(bInfo *lbinfo, bFuncs *lbfuncs, pInfo **pinfo, pFuncs **pfuncs)
  *  Bacula is going to exit.
  */
 bRC DLL_IMP_EXP
-unloadPlugin()
+unloadPlugin() 
 {
    printf("plugin: Unloaded\n");
    return bRC_OK;
@@ -125,7 +128,7 @@ static bRC newPlugin(bpContext *ctx)
 }
 
 /*
- * Release everything concerning a particular instance of a
+ * Release everything concerning a particular instance of a 
  *  plugin. Normally called when the Job terminates.
  */
 static bRC freePlugin(bpContext *ctx)
@@ -140,17 +143,17 @@ static bRC freePlugin(bpContext *ctx)
  * Called by core code to get a variable from the plugin.
  *   Not currently used.
  */
-static bRC getPluginValue(bpContext *ctx, pVariable var, void *value)
+static bRC getPluginValue(bpContext *ctx, pVariable var, void *value) 
 {
 // printf("plugin: getPluginValue var=%d\n", var);
    return bRC_OK;
 }
 
-/*
+/* 
  * Called by core code to set a plugin variable.
  *  Not currently used.
  */
-static bRC setPluginValue(bpContext *ctx, pVariable var, void *value)
+static bRC setPluginValue(bpContext *ctx, pVariable var, void *value) 
 {
 // printf("plugin: setPluginValue var=%d\n", var);
    return bRC_OK;
@@ -228,13 +231,13 @@ static bRC startBackupFile(bpContext *ctx, struct save_pkt *sp)
  * Done backing up a file.
  */
 static bRC endBackupFile(bpContext *ctx)
-{
+{ 
    return bRC_OK;
 }
 
 /*
  * Do actual I/O.  Bacula calls this after startBackupFile
- *   or after startRestoreFile to do the actual file
+ *   or after startRestoreFile to do the actual file 
  *   input or output.
  */
 static bRC pluginIO(bpContext *ctx, struct io_pkt *io)
diff --git a/src/plugins/fd/fd_common.h b/src/plugins/fd/fd_common.h
index bcdd4e3..50ba835 100644
--- a/src/plugins/fd/fd_common.h
+++ b/src/plugins/fd/fd_common.h
@@ -1,18 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2010-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
 
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 
 /* You can include this file to your plugin to have
@@ -59,49 +62,144 @@ DLL_IMP_EXP void reallyfree(const char *file, int line, void *fp);
 #define malloc(s)    sm_malloc(__FILE__, __LINE__, (s))
 #define free(o)      sm_free(__FILE__, __LINE__, (o))
 
-inline void *operator new(size_t size, char const * file, int line)
-{
-   void *pnew = sm_malloc(file,line, size);
-   memset((char *)pnew, 0, size);
-   return pnew;
-}
+#define Dmsg(context, level,  ...) bfuncs->DebugMessage(context, __FILE__, __LINE__, level, __VA_ARGS__ )
+#define Jmsg(context, type,  ...) bfuncs->JobMessage(context, __FILE__, __LINE__, type, 0, __VA_ARGS__ )
 
-inline void *operator new[](size_t size, char const * file, int line)
-{
-   void *pnew = sm_malloc(file, line, size);
-   memset((char *)pnew, 0, size);
-   return pnew;
-}
 
-inline void *operator new(size_t size)
-{
-   void *pnew = sm_malloc(__FILE__, __LINE__, size);
-   memset((char *)pnew, 0, size);
-   return pnew;
-}
+#ifdef USE_CMD_PARSER
+/* from lib/scan.c */
+extern int parse_args(POOLMEM *cmd, POOLMEM **args, int *argc,
+                      char **argk, char **argv, int max_args);
+extern int parse_args_only(POOLMEM *cmd, POOLMEM **args, int *argc,
+                           char **argk, char **argv, int max_args);
+
+class cmd_parser {
+public:
+   POOLMEM *args;
+   POOLMEM *cmd;                /* plugin command line */
+   POOLMEM *org;                /* original command line */
+
+   char **argk;                  /* Argument keywords */
+   char **argv;                  /* Argument values */
+   int argc;                    /* Number of arguments */
+   int max_cmd;                 /* Max number of arguments */
+   bool  use_name;              /* Search for : */
+
+   cmd_parser() {
+      org = get_pool_memory(PM_FNAME);
+      args = get_pool_memory(PM_FNAME);
+      cmd = get_pool_memory(PM_FNAME);
+      *args = *org  = *cmd = 0;
+      argc = 0; 
+      use_name = true;
+      max_cmd = MAX_CMD_ARGS;
+      argk = argv = NULL;
+   };
+
+   virtual ~cmd_parser() {
+      free_pool_memory(org);
+      free_pool_memory(cmd);
+      free_pool_memory(args);
+      if (argk) {
+         free(argk);
+      }
+      if (argv) {
+         free(argv);
+      }
+   }
 
-inline void *operator new[](size_t size)
-{
-   void *pnew = sm_malloc(__FILE__, __LINE__, size);
-   memset((char *)pnew, 0, size);
-   return pnew;
-}
+   /*
+    * Given a single keyword, find it in the argument list, but
+    *   it must have a value
+    * Returns: -1 if not found or no value
+    *           list index (base 0) on success
+    */
+   int find_arg_with_value(const char *keyword)
+   {
+      for (int i=1; i<argc; i++) {
+         if (strcasecmp(keyword, argk[i]) == 0) {
+            if (argv[i]) {
+               return i;
+            } else {
+               return -1;
+            }
+         }
+      }
+      return -1;
+   }
 
-#define new   new(__FILE__, __LINE__)
+   /*
+    * Given a single keyword, find it in the argument list
+    * Returns: -1 if not found
+    *           list index (base 0) on success
+    */
+   int find_arg(const char *keyword)
+   {
+      for (int i=1; i<argc; i++) {
+         if (strcasecmp(keyword, argk[i]) == 0) {
+            return i;
+         }
+      }
+      return -1;
+   }
 
-inline void operator delete(void *buf)
-{
-   sm_free( __FILE__, __LINE__, buf);
-}
+   /* 
+    * Build args, argc, argk from Plugin Restore|Backup command
+    */
 
-inline void operator delete[] (void *buf)
-{
-  sm_free(__FILE__, __LINE__, buf);
-}
+   bRC parse_cmd(const char *line)
+   {
+      char *a;
+      int nbequal = 0;
+      if (!line || *line == '\0') {
+         return bRC_Error;
+      }
 
-#define Dmsg(context, level,  ...) bfuncs->DebugMessage(context, __FILE__, __LINE__, level, __VA_ARGS__ )
-#define Jmsg(context, type,  ...) bfuncs->JobMessage(context, __FILE__, __LINE__, type, 0, __VA_ARGS__ )
+      /* Same command line that before */
+      if (!strcmp(line, org)) {
+         return bRC_OK;
+      }
+      
+      /* 
+       * line = delta:minsize=10002 param1=xxx
+       *             |     backup command
+       */
+      pm_strcpy(org, line);
+      pm_strcpy(cmd, line);
+
+      if (use_name) {
+         if ((a = strchr(cmd, ':')) != NULL) {
+            *a = ' ';              /* replace : by ' ' for command line processing */
+         } else {
+            return bRC_Error;
+         }
+      }
 
+      for (char *p = cmd; *p ; p++) {
+         if (*p == '=') {
+            nbequal++;
+         }
+      }
+
+      if (argk) {
+         free(argk);
+      }
+      if (argv) {
+         free(argv);
+      }
+
+      max_cmd = MAX(nbequal, MAX_CMD_ARGS) + 1;
+
+      argk = (char **) malloc(sizeof(char **) * max_cmd);
+      argv = (char **) malloc(sizeof(char **) * max_cmd);
+      
+      parse_args(cmd, &args, &argc, argk, argv, max_cmd);
+      
+      return bRC_OK;
+   }
+
+};
+#endif  /* USE_CMD_PARSER */
 
 #ifdef USE_ADD_DRIVE
 /* Keep drive letters for windows vss snapshot */
@@ -114,7 +212,7 @@ static void add_drive(char *drives, int *nCount, char *fname) {
          drives[*nCount] = ch;
          drives[*nCount+1] = 0;
          (*nCount)++;
-      }
+      }                                
    }
 }
 
@@ -128,6 +226,6 @@ static void copy_drives(char *drives, char *dest) {
       }
    }
 }
-#endif
+#endif  /* USE_ADD_DRIVE */
 
-#endif
+#endif  /* ! PCOMMON_H */
diff --git a/src/plugins/fd/test-deltaseq-fd.c b/src/plugins/fd/test-deltaseq-fd.c
index 71bbc8d..c5ab173 100644
--- a/src/plugins/fd/test-deltaseq-fd.c
+++ b/src/plugins/fd/test-deltaseq-fd.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * A simple delta plugin for the Bacula File Daemon
@@ -32,7 +36,7 @@ extern "C" {
 
 static const int dbglvl = 0;
 
-#define PLUGIN_LICENSE      "Bacula AGPLv3"
+#define PLUGIN_LICENSE      "AGPLv3"
 #define PLUGIN_AUTHOR       "Eric Bollengier"
 #define PLUGIN_DATE         "November 2010"
 #define PLUGIN_VERSION      "1"
@@ -51,6 +55,7 @@ static bRC startRestoreFile(bpContext *ctx, const char *cmd);
 static bRC endRestoreFile(bpContext *ctx);
 static bRC createFile(bpContext *ctx, struct restore_pkt *rp);
 static bRC setFileAttributes(bpContext *ctx, struct restore_pkt *rp);
+static bRC checkFile(bpContext *ctx, char *fname);
 
 /* Pointers to Bacula functions */
 static bFuncs *bfuncs = NULL;
@@ -65,7 +70,7 @@ static pInfo pluginInfo = {
    PLUGIN_AUTHOR,
    PLUGIN_DATE,
    PLUGIN_VERSION,
-   PLUGIN_DESCRIPTION,
+   PLUGIN_DESCRIPTION
 };
 
 /* Plugin entry points for Bacula */
@@ -86,7 +91,7 @@ static pFuncs pluginFuncs = {
    pluginIO,
    createFile,
    setFileAttributes,
-   NULL                         /* no checkFile */
+   checkFile
 };
 
 #define get_self(x) ((delta_test*)((x)->pContext))
@@ -105,7 +110,7 @@ public:
    bool done;
    int level;
 
-   delta_test(bpContext *bpc) {
+   delta_test(bpContext *bpc) { 
       fd = NULL;
       ctx = bpc;
       done = false;
@@ -142,16 +147,16 @@ bRC loadPlugin(bInfo *lbinfo, bFuncs *lbfuncs, pInfo **pinfo, pFuncs **pfuncs)
 }
 
 /*
- * External entry point to unload the plugin
+ * External entry point to unload the plugin 
  */
-bRC unloadPlugin()
+bRC unloadPlugin() 
 {
 // Dmsg(NULL, dbglvl, "delta-test-fd: Unloaded\n");
    return bRC_OK;
 }
 
 /*
- * The following entry points are accessed through the function
+ * The following entry points are accessed through the function 
  *   pointers we supplied to Bacula. Each plugin type (dir, fd, sd)
  *   has its own set of entry points that the plugin must define.
  */
@@ -184,7 +189,7 @@ static bRC freePlugin(bpContext *ctx)
 /*
  * Return some plugin value (none defined)
  */
-static bRC getPluginValue(bpContext *ctx, pVariable var, void *value)
+static bRC getPluginValue(bpContext *ctx, pVariable var, void *value) 
 {
    return bRC_OK;
 }
@@ -192,7 +197,7 @@ static bRC getPluginValue(bpContext *ctx, pVariable var, void *value)
 /*
  * Set a plugin value (none defined)
  */
-static bRC setPluginValue(bpContext *ctx, pVariable var, void *value)
+static bRC setPluginValue(bpContext *ctx, pVariable var, void *value) 
 {
    return bRC_OK;
 }
@@ -218,7 +223,7 @@ static bRC handlePluginEvent(bpContext *ctx, bEvent *event, void *value)
     */
    switch (event->eventType) {
    case bEventPluginCommand:
-//    Dmsg(ctx, dbglvl,
+//    Dmsg(ctx, dbglvl, 
 //         "delta-test-fd: PluginCommand=%s\n", (char *)value);
       break;
    case bEventJobStart:
@@ -259,7 +264,7 @@ static bRC handlePluginEvent(bpContext *ctx, bEvent *event, void *value)
       if (self->level == 'I' || self->level == 'D') {
          bfuncs->getBaculaValue(ctx, bVarAccurate, (void *)&accurate);
          if (!accurate) {       /* can be changed to FATAL */
-            Jmsg(ctx, M_FATAL,
+            Jmsg(ctx, M_FATAL, 
                  "Accurate mode should be turned on when using the "
                  "delta-test plugin\n");
             return bRC_Error;
@@ -282,7 +287,7 @@ static const char *files[] = {
 };
 static int nb_files = 4;
 
-/*
+/* 
  * Start the backup of a specific file
  */
 static bRC startBackupFile(bpContext *ctx, struct save_pkt *sp)
@@ -309,7 +314,7 @@ static bRC startBackupFile(bpContext *ctx, struct save_pkt *sp)
       self->delta = sp->delta_seq + 1;
    }
    pm_strcpy(self->fname, files[self->delta % nb_files]);
-   Dmsg(ctx, dbglvl, "delta-test-fd: delta_seq=%i delta=%i fname=%s\n",
+   Dmsg(ctx, dbglvl, "delta-test-fd: delta_seq=%i delta=%i fname=%s\n", 
         sp->delta_seq, self->delta, self->fname);
 // Dmsg(ctx, dbglvl, "delta-test-fd: startBackupFile\n");
    return bRC_OK;
@@ -338,7 +343,7 @@ static bRC pluginIO(bpContext *ctx, struct io_pkt *io)
    if (!self) {
       return bRC_Error;
    }
-
+    
    io->status = 0;
    io->io_errno = 0;
    switch(io->func) {
@@ -353,7 +358,7 @@ static bRC pluginIO(bpContext *ctx, struct io_pkt *io)
          }
          if (!self->fd) {
             io->io_errno = errno;
-            Jmsg(ctx, M_FATAL,
+            Jmsg(ctx, M_FATAL, 
                  "Open failed: ERR=%s\n", strerror(errno));
             return bRC_Error;
          }
@@ -362,7 +367,7 @@ static bRC pluginIO(bpContext *ctx, struct io_pkt *io)
          self->fd = fopen(self->fname, "r");
          if (!self->fd) {
             io->io_errno = errno;
-            Jmsg(ctx, M_FATAL,
+            Jmsg(ctx, M_FATAL, 
                "Open failed: ERR=%s\n", strerror(errno));
             return bRC_Error;
          }
@@ -379,7 +384,7 @@ static bRC pluginIO(bpContext *ctx, struct io_pkt *io)
       } else {
          /* first time, read 300, then replace 50-250 by other data */
          if (self->delta == 0) {
-            io->status = fread(io->buf, 1, 400, self->fd);
+            io->status = fread(io->buf, 1, 400, self->fd);            
          } else {
             io->offset = self->delta * 100 / 2; /* chunks are melted */
             io->status = fread(io->buf, 1, 100, self->fd);
@@ -388,9 +393,9 @@ static bRC pluginIO(bpContext *ctx, struct io_pkt *io)
          self->done = true;
       }
       if (io->status == 0 && ferror(self->fd)) {
-         Jmsg(ctx, M_FATAL,
+         Jmsg(ctx, M_FATAL, 
             "Pipe read error: ERR=%s\n", strerror(errno));
-         Dmsg(ctx, dbglvl,
+         Dmsg(ctx, dbglvl, 
             "Pipe read error: ERR=%s\n", strerror(errno));
          return bRC_Error;
       }
@@ -405,9 +410,9 @@ static bRC pluginIO(bpContext *ctx, struct io_pkt *io)
       Dmsg(ctx, dbglvl, "delta-test-fd: WRITE count=%lld\n", (int64_t)io->count);
       io->status = fwrite(io->buf, 1, io->count, self->fd);
       if (io->status == 0 && ferror(self->fd)) {
-         Jmsg(ctx, M_FATAL,
+         Jmsg(ctx, M_FATAL, 
             "Pipe write error\n");
-         Dmsg(ctx, dbglvl,
+         Dmsg(ctx, dbglvl, 
             "Pipe read error: ERR=%s\n", strerror(errno));
          return bRC_Error;
       }
@@ -457,7 +462,7 @@ static bRC endRestoreFile(bpContext *ctx)
 /*
  * This is called during restore to create the file (if necessary)
  * We must return in rp->create_status:
- *
+ *   
  *  CF_ERROR    -- error
  *  CF_SKIP     -- skip processing this file
  *  CF_EXTRACT  -- extract the file (i.e.call i/o routines)
@@ -482,6 +487,12 @@ static bRC setFileAttributes(bpContext *ctx, struct restore_pkt *rp)
    return bRC_OK;
 }
 
+/* When using Incremental dump, all previous dumps are necessary */
+static bRC checkFile(bpContext *ctx, char *fname)
+{
+   return bRC_OK;
+}
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/plugins/fd/test-plugin-fd.c b/src/plugins/fd/test-plugin-fd.c
index 0dff4c1..634fe2a 100644
--- a/src/plugins/fd/test-plugin-fd.c
+++ b/src/plugins/fd/test-plugin-fd.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * A simple test plugin for the Bacula File Daemon derived from
@@ -38,7 +42,7 @@ extern "C" {
 
 static const int dbglvl = 000;
 
-#define PLUGIN_LICENSE      "Bacula AGPLv3"
+#define PLUGIN_LICENSE      "AGPLv3"
 #define PLUGIN_AUTHOR       "Kern Sibbald"
 #define PLUGIN_DATE         "May 2011"
 #define PLUGIN_VERSION      "3"
@@ -102,7 +106,7 @@ static struct ini_items test_items[] = {
    { "string2",  ini_store_str,  "2nd String",        0},
    { "ok",       ini_store_bool, "boolean",           0},
 
-// We can also use the ITEMS_DEFAULT
+// We can also use the ITEMS_DEFAULT  
 // { "ok",       ini_store_bool, "boolean",           0, ITEMS_DEFAULT},
    { NULL,       NULL,           NULL,                0}
 };
@@ -144,16 +148,16 @@ bRC loadPlugin(bInfo *lbinfo, bFuncs *lbfuncs, pInfo **pinfo, pFuncs **pfuncs)
 }
 
 /*
- * External entry point to unload the plugin
+ * External entry point to unload the plugin 
  */
-bRC unloadPlugin()
+bRC unloadPlugin() 
 {
 // printf("test-plugin-fd: Unloaded\n");
    return bRC_OK;
 }
 
 /*
- * The following entry points are accessed through the function
+ * The following entry points are accessed through the function 
  *   pointers we supplied to Bacula. Each plugin type (dir, fd, sd)
  *   has its own set of entry points that the plugin must define.
  */
@@ -194,7 +198,7 @@ static bRC freePlugin(bpContext *ctx)
 /*
  * Return some plugin value (none defined)
  */
-static bRC getPluginValue(bpContext *ctx, pVariable var, void *value)
+static bRC getPluginValue(bpContext *ctx, pVariable var, void *value) 
 {
    return bRC_OK;
 }
@@ -202,7 +206,7 @@ static bRC getPluginValue(bpContext *ctx, pVariable var, void *value)
 /*
  * Set a plugin value (none defined)
  */
-static bRC setPluginValue(bpContext *ctx, pVariable var, void *value)
+static bRC setPluginValue(bpContext *ctx, pVariable var, void *value) 
 {
    return bRC_OK;
 }
@@ -254,7 +258,7 @@ static bRC handlePluginEvent(bpContext *ctx, bEvent *event, void *value)
          break;
       }
       rop = (restore_object_pkt *)value;
-      bfuncs->DebugMessage(ctx, fi, li, dbglvl,
+      bfuncs->DebugMessage(ctx, fi, li, dbglvl, 
                            "Get RestoreObject len=%d JobId=%d oname=%s type=%d data=%.127s\n",
                            rop->object_len, rop->JobId, rop->object_name, rop->object_type,
                            rop->object);
@@ -280,7 +284,7 @@ static bRC handlePluginEvent(bpContext *ctx, bEvent *event, void *value)
          }
          ini.register_items(test_items, sizeof(struct ini_items));
          if (ini.parse(ini.out_fname)) {
-            bfuncs->JobMessage(ctx, fi, li, M_INFO, 0, "string1 = %s\n",
+            bfuncs->JobMessage(ctx, fi, li, M_INFO, 0, "string1 = %s\n", 
                                ini.items[0].val.strval);
          } else {
             bfuncs->JobMessage(ctx, fi, li, M_ERROR, 0, "Can't parse config\n");
@@ -320,7 +324,7 @@ static bRC handlePluginEvent(bpContext *ctx, bEvent *event, void *value)
       }
       *p++ = 0;           /* terminate reader string */
       p_ctx->writer = p;
-      printf("test-plugin-fd: plugin=%s fname=%s reader=%s writer=%s\n",
+      printf("test-plugin-fd: plugin=%s fname=%s reader=%s writer=%s\n", 
           p_ctx->cmd, p_ctx->fname, p_ctx->reader, p_ctx->writer);
       break;
    }
@@ -339,7 +343,7 @@ static bRC handlePluginEvent(bpContext *ctx, bEvent *event, void *value)
    return bRC_OK;
 }
 
-/*
+/* 
  * Start the backup of a specific file
  */
 static bRC startBackupFile(bpContext *ctx, struct save_pkt *sp)
@@ -351,15 +355,15 @@ static bRC startBackupFile(bpContext *ctx, struct save_pkt *sp)
 
    if (p_ctx->nb_obj == 0) {
       sp->fname = (char *)"takeme.h";
-      bfuncs->DebugMessage(ctx, fi, li, dbglvl, "AcceptFile=%s = %d\n",
+      bfuncs->DebugMessage(ctx, fi, li, dbglvl, "AcceptFile=%s = %d\n", 
                            sp->fname, bfuncs->AcceptFile(ctx, sp));
 
       sp->fname = (char *)"/path/to/excludeme.o";
-      bfuncs->DebugMessage(ctx, fi, li, dbglvl, "AcceptFile=%s = %d\n",
+      bfuncs->DebugMessage(ctx, fi, li, dbglvl, "AcceptFile=%s = %d\n", 
                            sp->fname, bfuncs->AcceptFile(ctx, sp));
 
       sp->fname = (char *)"/path/to/excludeme.c";
-      bfuncs->DebugMessage(ctx, fi, li, dbglvl, "AcceptFile=%s = %d\n",
+      bfuncs->DebugMessage(ctx, fi, li, dbglvl, "AcceptFile=%s = %d\n", 
                            sp->fname, bfuncs->AcceptFile(ctx, sp));
    }
 
@@ -574,7 +578,7 @@ static bRC startBackupFile(bpContext *ctx, struct save_pkt *sp)
          fclose(fp);
       }
       free_pool_memory(q);
-
+   
    } else if (p_ctx->nb_obj == 1) {
       ConfigFile ini;
       p_ctx->buf = get_pool_memory(PM_BSOCK);
@@ -586,7 +590,7 @@ static bRC startBackupFile(bpContext *ctx, struct save_pkt *sp)
       sp->type = FT_PLUGIN_CONFIG;
 
       Dmsg1(0, "RestoreOptions=<%s>\n", p_ctx->buf);
-   }
+   } 
 
    time_t now = time(NULL);
    sp->index = ++p_ctx->nb_obj;
@@ -598,7 +602,7 @@ static bRC startBackupFile(bpContext *ctx, struct save_pkt *sp)
    sp->statp.st_blksize = 4096;
    sp->statp.st_blocks = 1;
    bfuncs->DebugMessage(ctx, fi, li, dbglvl,
-                        "Creating RestoreObject len=%d oname=%s data=%.127s\n",
+                        "Creating RestoreObject len=%d oname=%s data=%.127s\n", 
                         sp->object_len, sp->object_name, sp->object);
 
    printf("test-plugin-fd: startBackupFile\n");
@@ -627,7 +631,7 @@ static bRC pluginIO(bpContext *ctx, struct io_pkt *io)
    if (!p_ctx) {
       return bRC_Error;
    }
-
+    
    io->status = 0;
    io->io_errno = 0;
    return bRC_OK;
@@ -656,7 +660,7 @@ static bRC endRestoreFile(bpContext *ctx)
 /*
  * This is called during restore to create the file (if necessary)
  * We must return in rp->create_status:
- *
+ *   
  *  CF_ERROR    -- error
  *  CF_SKIP     -- skip processing this file
  *  CF_EXTRACT  -- extract the file (i.e.call i/o routines)
diff --git a/src/plugins/sd/Makefile.in b/src/plugins/sd/Makefile.in
index d06554d..ef5797d 100644
--- a/src/plugins/sd/Makefile.in
+++ b/src/plugins/sd/Makefile.in
@@ -1,6 +1,8 @@
 #
-# Simple Makefile for building test FD plugins for Bacula
+# Simple Makefile for building test SD plugins for Bacula
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 #
 @MCOMMON@
 
@@ -11,14 +13,14 @@ SDDIR=../../stored
 SRCDIR=../..
 LIBDIR=../../lib
 
-.SUFFIXES:    .c .o .lo
+.SUFFIXES:    .c .lo
 
 .c.lo:
 	$(LIBTOOL_COMPILE) $(CXX) $(DEFS) $(DEBUG) $(CPPFLAGS) -I${SRCDIR} -I${SDDIR} -DTEST_PROGRAM -c $<
 
 all: example-plugin-sd.la
 
-example-plugin-sd.lo: example-plugin-sd.c ${SDDIR}/sd_plugins.h
+example-plugin-sd.lo: example-plugin-sd.c
 	$(LIBTOOL_COMPILE) $(CXX) $(DEFS) $(DEBUG) $(CFLAGS) -I../.. -I${SDDIR} -c example-plugin-sd.c
 
 example-plugin-sd.la: Makefile example-plugin-sd$(DEFAULT_OBJECT_TYPE)
@@ -32,16 +34,13 @@ install: all
 libtool-clean:
 	find . -name '*.lo' -print | xargs $(LIBTOOL_CLEAN) $(RMF)
 	$(RMF) *.la
-	$(RMF) -rf .libs _libs
+	$(RMF) -r .libs _libs
 
 clean: @LIBTOOL_CLEAN_TARGET@
-	rm -f main *.so *.o 1 2 3 *.la *.lo
-	rm -rf .libs
-
+	rm -f main *.la *.so *.o 1 2 3
 
 distclean: clean
-	rm -f Makefile *.la *.lo
-	rm -rf .libs
+	rm -f Makefile
 
 libtool-uninstall:
 	$(LIBTOOL_UNINSTALL) $(RMF) $(DESTDIR)$(plugindir)/example-plugin-sd.so
diff --git a/src/plugins/sd/example-plugin-sd.c b/src/plugins/sd/example-plugin-sd.c
index b3f2c2c..21b674a 100644
--- a/src/plugins/sd/example-plugin-sd.c
+++ b/src/plugins/sd/example-plugin-sd.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Sample Storage daemon Plugin program
@@ -19,14 +23,14 @@
  *  Kern Sibbald, October 2007
  *
  */
-#include "bacula.h"
-#include "stored.h"
+#include "bacula.h"         /* General Bacula headers */
+#include "stored.h"         /* Pull in storage daemon headers */
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-#define PLUGIN_LICENSE      "Bacula AGPLv3"
+#define PLUGIN_LICENSE      "AGPLv3"
 #define PLUGIN_AUTHOR       "Kern Sibbald"
 #define PLUGIN_DATE         "November 2011"
 #define PLUGIN_VERSION      "2"
@@ -38,6 +42,7 @@ static bRC freePlugin(bpContext *ctx);
 static bRC getPluginValue(bpContext *ctx, psdVariable var, void *value);
 static bRC setPluginValue(bpContext *ctx, psdVariable var, void *value);
 static bRC handlePluginEvent(bpContext *ctx, bsdEvent *event, void *value);
+static bRC handleGlobalPluginEvent(bsdEvent *event, void *value);
 
 
 /* Pointers to Bacula functions */
@@ -64,7 +69,8 @@ static psdFuncs pluginFuncs = {
    freePlugin,                        /* free plugin instance */
    getPluginValue,
    setPluginValue,
-   handlePluginEvent
+   handlePluginEvent,
+   handleGlobalPluginEvent
 };
 
 /*
@@ -87,17 +93,17 @@ loadPlugin(bsdInfo *lbinfo, bsdFuncs *lbfuncs, psdInfo **pinfo, psdFuncs **pfunc
 }
 
 /*
- * External entry point to unload the plugin
+ * External entry point to unload the plugin 
  */
 bRC DLL_IMP_EXP
-unloadPlugin()
+unloadPlugin() 
 {
    printf("example-plugin-sd: Unloaded\n");
    return bRC_OK;
 }
 
 /*
- * The following entry points are accessed through the function
+ * The following entry points are accessed through the function 
  *   pointers we supplied to Bacula. Each plugin type (dir, fd, sd)
  *   has its own set of entry points that the plugin must define.
  */
@@ -127,7 +133,7 @@ static bRC freePlugin(bpContext *ctx)
 /*
  * Return some plugin value (none defined)
  */
-static bRC getPluginValue(bpContext *ctx, psdVariable var, void *value)
+static bRC getPluginValue(bpContext *ctx, psdVariable var, void *value) 
 {
    printf("example-plugin-sd: getPluginValue var=%d\n", var);
    return bRC_OK;
@@ -136,7 +142,7 @@ static bRC getPluginValue(bpContext *ctx, psdVariable var, void *value)
 /*
  * Set a plugin value (none defined)
  */
-static bRC setPluginValue(bpContext *ctx, psdVariable var, void *value)
+static bRC setPluginValue(bpContext *ctx, psdVariable var, void *value) 
 {
    printf("example-plugin-sd: setPluginValue var=%d\n", var);
    return bRC_OK;
@@ -163,6 +169,15 @@ static bRC handlePluginEvent(bpContext *ctx, bsdEvent *event, void *value)
    return bRC_OK;
 }
 
+/*
+ * Handle a Global event -- no context
+ */
+static bRC handleGlobalPluginEvent(bsdEvent *event, void *value)
+{
+   return bRC_OK;
+}
+
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/plugins/sd/main.c b/src/plugins/sd/main.c
index 07100ee..4be5275 100644
--- a/src/plugins/sd/main.c
+++ b/src/plugins/sd/main.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Main program to test loading and running Bacula plugins.
@@ -41,7 +45,7 @@ static bFuncs bfuncs = {
    NULL,
    NULL
 };
-
+    
 
 
 
@@ -51,8 +55,8 @@ int main(int argc, char *argv[])
    bpContext ctx;
    bEvent event;
    Plugin *plugin;
-
-   bplugin_list = New(alist(10, not_owned_by_alist));
+    
+   b_plugin_list = New(alist(10, not_owned_by_alist));
 
    ctx.bContext = NULL;
    ctx.pContext = NULL;
@@ -60,24 +64,24 @@ int main(int argc, char *argv[])
 
    load_plugins((void *)&bfuncs, plugin_dir, plugin_type);
 
-   foreach_alist(plugin, bplugin_list) {
-      printf("bacula: plugin_size=%d plugin_version=%d\n",
+   foreach_alist(plugin, b_plugin_list) {
+      printf("bacula: plugin_size=%d plugin_version=%d\n", 
               pref(plugin)->size, pref(plugin)->interface);
       printf("License: %s\nAuthor: %s\nDate: %s\nVersion: %s\nDescription: %s\n",
-         pref(plugin)->plugin_license, pref(plugin)->plugin_author,
-         pref(plugin)->plugin_date, pref(plugin)->plugin_version,
+         pref(plugin)->plugin_license, pref(plugin)->plugin_author, 
+         pref(plugin)->plugin_date, pref(plugin)->plugin_version, 
          pref(plugin)->plugin_description);
 
       /* Start a new instance of the plugin */
       pref(plugin)->newPlugin(&ctx);
-      event.eventType = bEventNewVolume;
+      event.eventType = bEventNewVolume;   
       pref(plugin)->handlePluginEvent(&ctx, &event);
       /* Free the plugin instance */
       pref(plugin)->freePlugin(&ctx);
 
       /* Start a new instance of the plugin */
       pref(plugin)->newPlugin(&ctx);
-      event.eventType = bEventNewVolume;
+      event.eventType = bEventNewVolume;   
       pref(plugin)->handlePluginEvent(&ctx, &event);
       /* Free the plugin instance */
       pref(plugin)->freePlugin(&ctx);
diff --git a/src/qt-console/README b/src/qt-console/README
index 1db13a3..6f392ff 100644
--- a/src/qt-console/README
+++ b/src/qt-console/README
@@ -13,9 +13,10 @@ yourself or if your distro does not have it, we have included the source
 in depkgs-qt, which you can download from the Bacula Source Forge        
 download area.
 
-Building and running bat is done much like bconsole.  You add the appropriate
- options to your ./configure, then simply do a make.  Please see the
-Installation chapter of the manual for more details.
+Building and running bat is done much like bconsole, the gnome console,
+or the wxWidgets console.  You add the appropriate options to your   
+./configure, then simply do a make.  Please see the Installation chapter
+of the manual for more details.
 
 
 Win32 mingw infos for QT4 :
@@ -103,7 +104,8 @@ Design/implementation considerations:
   a tree view, but for the moment does nothing ...  It is a bit
   ugly. Canceling it should get you back to the normal command prompt.
 
-- Implement a restore page that does a directory tree restore selection.
+- Implement a restore page that does a directory tree restore selection
+  much like wx-console does.
 
 Not working:
 - The left selection window and the right window (where the console
diff --git a/src/qt-console/bat.h b/src/qt-console/bat.h
index 2bbdbe1..214ac7d 100644
--- a/src/qt-console/bat.h
+++ b/src/qt-console/bat.h
@@ -2,19 +2,23 @@
 #define _BAT_H_
 
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *   Kern Sibbald, January 2007
diff --git a/src/qt-console/bat.pro.in b/src/qt-console/bat.pro.in
index cacba21..7c43f13 100644
--- a/src/qt-console/bat.pro.in
+++ b/src/qt-console/bat.pro.in
@@ -5,7 +5,7 @@
 #      Edit only bat.pro.in  -- bat.pro is built by the ./configure program
 #
 #   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-#    
+#
 CONFIG += qt debug @QWT@
 
 bins.path = /$(DESTDIR)@sbindir@
@@ -27,7 +27,7 @@ QMAKE_INSTALL_PROGRAM = $${LIBTOOL_INSTALL} install -m @SBINPERM@ -p
 QMAKE_CLEAN += .libs/* bat
 
 qwt {
-  INCLUDEPATH += @QWT_INC@ 
+  INCLUDEPATH += @QWT_INC@
   LIBS        += @QWT_LDFLAGS@ @QWT_LIB@
 }
 
@@ -41,10 +41,10 @@ OBJECTS_DIR  = obj
 UI_DIR       = ui
 
 # Main window
-FORMS += main.ui 
+FORMS += main.ui
 FORMS += prefs.ui
-FORMS += label/label.ui 
-FORMS += relabel/relabel.ui 
+FORMS += label/label.ui
+FORMS += relabel/relabel.ui
 FORMS += mount/mount.ui
 FORMS += console/console.ui
 FORMS += restore/restore.ui restore/prerestore.ui restore/brestore.ui
diff --git a/src/qt-console/bat.pro.mingw32.in b/src/qt-console/bat.pro.mingw32.in
index 1f2c71d..23ac93a 100644
--- a/src/qt-console/bat.pro.mingw32.in
+++ b/src/qt-console/bat.pro.mingw32.in
@@ -32,10 +32,19 @@ qwt {
   LIBS        += @QWT_LDFLAGS@ @QWT_LIB@
 }
 
-RESOURCES    = main.qrc
-MOC_DIR      = moc32
-OBJECTS_DIR  = obj32
-UI_DIR       = ui32
+RESOURCES               = main.qrc
+MOC_DIR                 = moc32
+OBJECTS_DIR             = obj32
+UI_DIR                  = ui32
+QMAKE_CC                = i686-w64-mingw32-gcc
+QMAKE_CXX               = i686-w64-mingw32-g++
+QMAKE_INCDIR            = $(DEPKGS)/depkgs-mingw32/include/pthreads $(DEPKGS)/depkgs-mingw32/include/ ../win32/compat 
+QMAKE_INCDIR_QT         = $(DEPKGS)/depkgs-mingw32/include/qt
+QMAKE_LIBDIR_QT         = $(DEPKGS)/depkgs-mingw32/lib/qt
+QMAKE_LINK              = i686-w64-mingw32-g++
+QMAKE_LFLAGS            = -mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import  -m32 -fno-strict-aliasing -Wl,-enable-runtime-pseudo-reloc
+QMAKE_LIB               = i686-w64-mingw32-ar -ru
+QMAKE_RC                = i686-w64-mingw32-windres
 
 # Main window
 FORMS += main.ui 
diff --git a/src/qt-console/bat.pro.mingw32.in b/src/qt-console/bat.pro.mingw64
similarity index 81%
copy from src/qt-console/bat.pro.mingw32.in
copy to src/qt-console/bat.pro.mingw64
index 1f2c71d..4812fec 100644
--- a/src/qt-console/bat.pro.mingw32.in
+++ b/src/qt-console/bat.pro.mingw64
@@ -2,7 +2,7 @@
 #
 # !!!!!!! IMPORTANT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 #
-# Edit only bat.pro.mingw32.in  -- bat.pro.mingw32 is built by the ./configure program
+# Edit only bat.pro.mingw64.in  -- bat.pro.mingw64 is built by the ./configure program
 #
 # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 #    
@@ -21,21 +21,30 @@ INCLUDEPATH += .. . ./console ./restore ./select
 
 cross-win32 {
 #  LIBS       +=  ../win32/dll/bacula.a
-  LIBS       +=  -mwindows -L../win32/release32 -lbacula
+  LIBS       +=  -mwindows -L../win32/release64 -lbacula
 }
 !cross-win32 {
-  LIBS        += -L../lib -lbac -L../findlib -lbacfind @OPENSSL_LIBS@
+  LIBS        += -L../lib -lbac -L../findlib -lbacfind -lssl -lcrypto
 }
 
 qwt {
-  INCLUDEPATH += @QWT_INC@ 
-  LIBS        += @QWT_LDFLAGS@ @QWT_LIB@
+  INCLUDEPATH +=  
+  LIBS        +=  
 }
 
-RESOURCES    = main.qrc
-MOC_DIR      = moc32
-OBJECTS_DIR  = obj32
-UI_DIR       = ui32
+RESOURCES               = main.qrc
+MOC_DIR                 = moc64
+OBJECTS_DIR             = obj64
+UI_DIR                  = ui64
+QMAKE_CC                = x86_64-w64-mingw32-gcc
+QMAKE_CXX               = x86_64-w64-mingw32-g++
+QMAKE_INCDIR            = $(DEPKGS)/depkgs-mingw-w64/include/pthreads $(DEPKGS)/depkgs-mingw-w64/include/ ../win32/compat 
+QMAKE_INCDIR_QT         = $(DEPKGS)/depkgs-mingw-w64/include/qt
+QMAKE_LIBDIR_QT         = $(DEPKGS)/depkgs-mingw-w64/lib/qt
+QMAKE_LINK              = x86_64-w64-mingw32-g++
+QMAKE_LFLAGS            = -mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import  -m64 -fno-strict-aliasing -Wl,-enable-runtime-pseudo-reloc
+QMAKE_LIB               = x86_64-w64-mingw32-ar -ru
+QMAKE_RC                = x86_64-w64-mingw32-windres
 
 # Main window
 FORMS += main.ui 
diff --git a/src/qt-console/bat.pro.mingw32.in b/src/qt-console/bat.pro.mingw64.in
similarity index 83%
copy from src/qt-console/bat.pro.mingw32.in
copy to src/qt-console/bat.pro.mingw64.in
index 1f2c71d..1c22a2a 100644
--- a/src/qt-console/bat.pro.mingw32.in
+++ b/src/qt-console/bat.pro.mingw64.in
@@ -2,7 +2,7 @@
 #
 # !!!!!!! IMPORTANT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 #
-# Edit only bat.pro.mingw32.in  -- bat.pro.mingw32 is built by the ./configure program
+# Edit only bat.pro.mingw64.in  -- bat.pro.mingw64 is built by the ./configure program
 #
 # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 #    
@@ -21,7 +21,7 @@ INCLUDEPATH += .. . ./console ./restore ./select
 
 cross-win32 {
 #  LIBS       +=  ../win32/dll/bacula.a
-  LIBS       +=  -mwindows -L../win32/release32 -lbacula
+  LIBS       +=  -mwindows -L../win32/release64 -lbacula
 }
 !cross-win32 {
   LIBS        += -L../lib -lbac -L../findlib -lbacfind @OPENSSL_LIBS@
@@ -32,10 +32,19 @@ qwt {
   LIBS        += @QWT_LDFLAGS@ @QWT_LIB@
 }
 
-RESOURCES    = main.qrc
-MOC_DIR      = moc32
-OBJECTS_DIR  = obj32
-UI_DIR       = ui32
+RESOURCES               = main.qrc
+MOC_DIR                 = moc64
+OBJECTS_DIR             = obj64
+UI_DIR                  = ui64
+QMAKE_CC                = x86_64-w64-mingw32-gcc
+QMAKE_CXX               = x86_64-w64-mingw32-g++
+QMAKE_INCDIR            = $(DEPKGS)/depkgs-mingw-w64/include/pthreads $(DEPKGS)/depkgs-mingw-w64/include/ ../win32/compat 
+QMAKE_INCDIR_QT         = $(DEPKGS)/depkgs-mingw-w64/include/qt
+QMAKE_LIBDIR_QT         = $(DEPKGS)/depkgs-mingw-w64/lib/qt
+QMAKE_LINK              = x86_64-w64-mingw32-g++
+QMAKE_LFLAGS            = -mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import  -m64 -fno-strict-aliasing -Wl,-enable-runtime-pseudo-reloc
+QMAKE_LIB               = x86_64-w64-mingw32-ar -ru
+QMAKE_RC                = x86_64-w64-mingw32-windres
 
 # Main window
 FORMS += main.ui 
diff --git a/src/qt-console/bat_conf.cpp b/src/qt-console/bat_conf.cpp
index 279e7fa..429cf4d 100644
--- a/src/qt-console/bat_conf.cpp
+++ b/src/qt-console/bat_conf.cpp
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2000-2009 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2000-2013 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *   Main configuration file parser for Bacula User Agent
@@ -34,7 +38,6 @@
  *
  *     Kern Sibbald, January MM, September MM
  *
- *     Version $Id$
  */
 
 #include "bacula.h"
@@ -80,7 +83,7 @@ static RES_ITEM dir_items[] = {
    {"tlscacertificatedir", store_dir,  ITEM(dir_res.tls_ca_certdir), 0, 0, 0},
    {"tlscertificate", store_dir,       ITEM(dir_res.tls_certfile), 0, 0, 0},
    {"tlskey",         store_dir,       ITEM(dir_res.tls_keyfile), 0, 0, 0},
-   {"heartbeatinterval", store_time, ITEM(dir_res.heartbeat_interval), 0, ITEM_DEFAULT, 0},
+   {"heartbeatinterval", store_time, ITEM(dir_res.heartbeat_interval), 0, ITEM_DEFAULT, 5 * 60},
    {NULL, NULL, {0}, 0, 0, 0}
 };
 
@@ -95,7 +98,7 @@ static RES_ITEM con_items[] = {
    {"tlscacertificatedir", store_dir,  ITEM(con_res.tls_ca_certdir), 0, 0, 0},
    {"tlscertificate", store_dir,       ITEM(con_res.tls_certfile), 0, 0, 0},
    {"tlskey",         store_dir,       ITEM(con_res.tls_keyfile), 0, 0, 0},
-   {"heartbeatinterval", store_time, ITEM(con_res.heartbeat_interval), 0, ITEM_DEFAULT, 0},
+   {"heartbeatinterval", store_time, ITEM(con_res.heartbeat_interval), 0, ITEM_DEFAULT, 5 * 60},
    {"director",       store_str,       ITEM(con_res.director), 0, 0, 0},
    {NULL, NULL, {0}, 0, 0, 0}
 };
@@ -121,9 +124,9 @@ RES_TABLE resources[] = {
 
 
 /* Dump contents of resource */
-void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fmt, ...), void *sock)
+void dump_resource(int type, RES *ares, void sendit(void *sock, const char *fmt, ...), void *sock)
 {
-   URES *res = (URES *)reshdr;
+   URES *res = (URES *)ares;
    bool recurse = true;
 
    if (res == NULL) {
@@ -136,15 +139,15 @@ void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fm
    }
    switch (type) {
    case R_DIRECTOR:
-      printf(_("Director: name=%s address=%s DIRport=%d\n"), reshdr->name,
+      printf(_("Director: name=%s address=%s DIRport=%d\n"), ares->name,
               res->dir_res.address, res->dir_res.DIRport);
       break;
    case R_CONSOLE:
-      printf(_("Console: name=%s\n"), reshdr->name);
+      printf(_("Console: name=%s\n"), ares->name);
       break;
    case R_CONSOLE_FONT:
       printf(_("ConsoleFont: name=%s font face=%s\n"),
-             reshdr->name, NPRT(res->con_font.fontface));
+             ares->name, NPRT(res->con_font.fontface));
       break;
    default:
       printf(_("Unknown resource type %d\n"), type);
@@ -183,7 +186,7 @@ void free_resource(RES *sres, int type)
       if (res->dir_res.address) {
          free(res->dir_res.address);
       }
-      if (res->dir_res.tls_ctx) {
+      if (res->dir_res.tls_ctx) { 
          free_tls_context(res->dir_res.tls_ctx);
       }
       if (res->dir_res.tls_ca_certfile) {
@@ -203,7 +206,7 @@ void free_resource(RES *sres, int type)
       if (res->con_res.password) {
          free(res->con_res.password);
       }
-      if (res->con_res.tls_ctx) {
+      if (res->con_res.tls_ctx) { 
          free_tls_context(res->con_res.tls_ctx);
       }
       if (res->con_res.tls_ca_certfile) {
@@ -231,7 +234,9 @@ void free_resource(RES *sres, int type)
       printf(_("Unknown resource type %d\n"), type);
    }
    /* Common stuff again -- free the resource, recurse to next one */
-   free(res);
+   if (res) {
+      free(res);
+   }
    if (nres) {
       free_resource(nres, type);
    }
diff --git a/src/qt-console/bat_conf.h b/src/qt-console/bat_conf.h
index e9e41f7..143168c 100644
--- a/src/qt-console/bat_conf.h
+++ b/src/qt-console/bat_conf.h
@@ -1,24 +1,26 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2002-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Bacula Adminstration Tool (bat)
  *
  *     Kern Sibbald, March 2002
- *
- *     Version $Id$
  */
 
 #ifndef _BAT_CONF_H_
diff --git a/src/qt-console/bcomm/dircomm.cpp b/src/qt-console/bcomm/dircomm.cpp
index 4b81699..5591064 100644
--- a/src/qt-console/bcomm/dircomm.cpp
+++ b/src/qt-console/bcomm/dircomm.cpp
@@ -1,24 +1,28 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2011 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *  DirComm, Director communications,class
  *
  *   Kern Sibbald, January MMVII
  *
- */
+ */ 
 
 #include "bat.h"
 #include "console.h"
@@ -63,7 +67,7 @@ void DirComm::terminate()
 }
 
 /*
- * Connect to Director.
+ * Connect to Director. 
  */
 bool DirComm::connect_dir()
 {
@@ -100,7 +104,7 @@ bool DirComm::connect_dir()
 
    /* Give GUI a chance */
    app->processEvents();
-
+   
    LockRes();
    /* If cons==NULL, default console will be used */
    for (i=0; i<numcon; i++) {
@@ -135,12 +139,12 @@ bool DirComm::connect_dir()
    /* Initialize Console TLS context once */
    if (cons && !cons->tls_ctx && (cons->tls_enable || cons->tls_require)) {
       /* Generate passphrase prompt */
-      bsnprintf(buf, sizeof(buf), "Passphrase for Console \"%s\" TLS private key: ",
+      bsnprintf(buf, sizeof(buf), "Passphrase for Console \"%s\" TLS private key: ", 
                 cons->name());
 
       /* Initialize TLS context:
        * Args: CA certfile, CA certdir, Certfile, Keyfile,
-       * Keyfile PEM Callback, Keyfile CB Userdata, DHfile, Verify Peer
+       * Keyfile PEM Callback, Keyfile CB Userdata, DHfile, Verify Peer   
        */
       cons->tls_ctx = new_tls_context(cons->tls_ca_certfile,
          cons->tls_ca_certdir, cons->tls_certfile,
@@ -159,7 +163,7 @@ bool DirComm::connect_dir()
    /* Initialize Director TLS context once */
    if (!m_console->m_dir->tls_ctx && (m_console->m_dir->tls_enable || m_console->m_dir->tls_require)) {
       /* Generate passphrase prompt */
-      bsnprintf(buf, sizeof(buf), "Passphrase for Director \"%s\" TLS private key: ",
+      bsnprintf(buf, sizeof(buf), "Passphrase for Director \"%s\" TLS private key: ", 
                 m_console->m_dir->name());
 
       /* Initialize TLS context:
@@ -186,7 +190,7 @@ bool DirComm::connect_dir()
       heart_beat = cons->heartbeat_interval;
    } else {
       heart_beat = 0;
-   }
+   }        
 
    if (!m_sock) {
       m_sock = new_bsock();
@@ -232,7 +236,7 @@ bool DirComm::connect_dir()
 
    mainWin->set_status(_("Initializing ..."));
 
-   /*
+   /* 
     * Set up input notifier
     */
    m_notifier = new QSocketNotifier(m_sock->m_fd, QSocketNotifier::Read, 0);
@@ -261,8 +265,8 @@ bail_out:
    return false;
 }
 
-/*
- * This should be moved into a bSocket class
+/* 
+ * This should be moved into a bSocket class 
  */
 char *DirComm::msg()
 {
@@ -315,7 +319,7 @@ int DirComm::sock_read()
    return stat;
 }
 
-/*
+/* 
  * Blocking read from director
  */
 int DirComm::read()
@@ -331,7 +335,7 @@ int DirComm::read()
          stat = m_sock->wait_data_intr(0, 50000);
          if (stat > 0) {
             break;
-         }
+         } 
          app->processEvents();
          if (m_api_set && m_console->is_messagesPending() && is_notify_enabled() && m_console->hasFocus()) {
             if (mainWin->m_commDebug) Pmsg1(000, "conn %i process_events\n", m_conn);
@@ -394,13 +398,10 @@ int DirComm::read()
          mainWin->set_status(_("At prompt waiting for input ..."));
          break;
       case BNET_TEXT_INPUT:
-         if (mainWin->m_commDebug) Pmsg4(000, "conn %i TEXT_INPUT at_prompt=%d  m_in_select=%d notify=%d\n",
+         if (mainWin->m_commDebug) Pmsg4(000, "conn %i TEXT_INPUT at_prompt=%d  m_in_select=%d notify=%d\n", 
                m_conn, m_at_prompt, m_in_select, is_notify_enabled());
-         //if (!m_in_select && is_notify_enabled()) {
-         if (!m_in_select) {
-            mainWin->waitExit();
+         if (!m_in_select && is_notify_enabled()) {
             new textInputDialog(m_console, m_conn);
-         } else {
             if (mainWin->m_commDebug) Pmsg0(000, "!m_in_select && is_notify_enabled\n");
             m_at_prompt = true;
             m_at_main_prompt = false;
@@ -488,7 +489,7 @@ int DirComm::read()
          stat = BNET_HARDEOF;
       }
       break;
-   }
+   } 
    return stat;
 }
 
@@ -512,7 +513,7 @@ void DirComm::notify_read_dir(int /* fd */)
 
 /*
  * When the notifier is enabled, read_dir() will automatically be
- * called by the Qt event loop when ever there is any output
+ * called by the Qt event loop when ever there is any output 
  * from the Director, and read_dir() will then display it on
  * the console.
  *
@@ -520,13 +521,13 @@ void DirComm::notify_read_dir(int /* fd */)
  * from the Directory, so we set notify to off.
  *    m_console->notify(false);
  */
-bool DirComm::notify(bool enable)
-{
+bool DirComm::notify(bool enable) 
+{ 
    bool prev_enabled = false;
    /* Set global flag */
    mainWin->m_notify = enable;
    if (m_notifier) {
-      prev_enabled = m_notifier->isEnabled();
+      prev_enabled = m_notifier->isEnabled();   
       m_notifier->setEnabled(enable);
       m_notify = enable;
       if (mainWin->m_connDebug) Pmsg3(000, "conn=%i set_notify=%d prev=%d\n", m_conn, enable, prev_enabled);
@@ -543,7 +544,7 @@ bool DirComm::is_notify_enabled() const
 
 /*
  * Call-back for reading a passphrase for an encrypted PEM file
- * This function uses getpass(),
+ * This function uses getpass(), 
  *  which uses a static buffer and is NOT thread-safe.
  */
 static int tls_pem_callback(char *buf, int size, const void *userdata)
diff --git a/src/qt-console/bcomm/dircomm.h b/src/qt-console/bcomm/dircomm.h
index 630c071..5d64461 100644
--- a/src/qt-console/bcomm/dircomm.h
+++ b/src/qt-console/bcomm/dircomm.h
@@ -1,23 +1,25 @@
 #ifndef _DIRCOMM_H_
 #define _DIRCOMM_H_
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
- *   Version $Id$
- *
  *   Kern Sibbald, January 2007
  */
 
@@ -45,7 +47,7 @@ public:
    ~DirComm();
    Console *m_console;
    int  sock_read();
-   bool authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons,
+   bool authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons, 
           char *buf, int buflen);
    bool is_connected() { return m_sock != NULL; };
    bool is_ready() { return is_connected() && m_at_prompt && m_at_main_prompt; };
@@ -54,7 +56,7 @@ public:
    bool is_notify_enabled() const;
    bool is_in_command() const { return m_in_command > 0; };
    void terminate();
-   bool connect_dir();
+   bool connect_dir();                     
    int read(void);
    int write(const char *msg);
    int write(QString msg);
@@ -63,7 +65,7 @@ public slots:
    void notify_read_dir(int fd);
 
 private:
-   BSOCK *m_sock;
+   BSOCK *m_sock;   
    bool m_at_prompt;
    bool m_at_main_prompt;
    bool m_sent_blank;
diff --git a/src/qt-console/bcomm/dircomm_auth.cpp b/src/qt-console/bcomm/dircomm_auth.cpp
index 548a26e..32ac44c 100644
--- a/src/qt-console/bcomm/dircomm_auth.cpp
+++ b/src/qt-console/bcomm/dircomm_auth.cpp
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2001-2013 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 
 /*
@@ -46,8 +50,8 @@ static char newOKhello[]   = "1000 OK: %d";
 /*
  * Authenticate Director
  */
-bool DirComm::authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons,
-                char *errmsg, int errmsg_len)
+bool DirComm::authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons, 
+                char *errmsg, int errmsg_len) 
 {
    BSOCK *dir = jcr->dir_bsock;
    int tls_local_need = BNET_TLS_NONE;
@@ -156,10 +160,10 @@ bool DirComm::authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons,
       return false;
    } else {
       /* If Dir version exists, get it */
-      sscanf(dir->msg, newOKhello, &dir_version);
+      sscanf(dir->msg, newOKhello, &dir_version); 
    }
 
-   if (m_conn == 0) {
+   if (m_conn == 0) { 
       bsnprintf(errmsg, errmsg_len, "%s", dir->msg);
    }
    return true;
@@ -169,7 +173,7 @@ bail_out:
    bsnprintf(errmsg, errmsg_len, _("Authorization problem with Director at \"%s:%d\"\n"
              "Most likely the passwords do not agree.\n"
              "If you are using TLS, there may have been a certificate validation error during the TLS handshake.\n"
-             "Please see " MANUAL_AUTH_URL " for help.\n"),
+             "For help, please see " MANUAL_AUTH_URL "\n"),
              dir->host(), dir->port());
    return false;
 }
diff --git a/src/qt-console/clients/clients.cpp b/src/qt-console/clients/clients.cpp
index 6ba383d..b9c2ea8 100644
--- a/src/qt-console/clients/clients.cpp
+++ b/src/qt-console/clients/clients.cpp
@@ -1,27 +1,29 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2009 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
 
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
+ 
 /*
- *   Version $Id$
- *
  *  Clients Class
  *
  *   Dirk Bartley, March 2007
  *
- */
+ */ 
 
 #include "bat.h"
 #include <QAbstractEventDispatcher>
@@ -55,7 +57,7 @@ Clients::~Clients()
 }
 
 /*
- * The main meat of the class!!  The function that queries the director and
+ * The main meat of the class!!  The function that queries the director and 
  * creates the widgets with appropriate values.
  */
 void Clients::populateTable()
@@ -115,6 +117,10 @@ void Clients::populateTable()
          foreach (QString resultline, results) {
             QStringList fieldlist = resultline.split("\t");
 
+            if (fieldlist.size() < 5) { // Uname is checked after
+               Pmsg1(0, "Unexpected line %s\n", resultline.toUtf8().data());
+               continue;
+            }
             if (m_firstpopulation) {
                settingsOpenStatus(fieldlist[0]);
             }
@@ -141,7 +147,11 @@ void Clients::populateTable()
             item.setNumericFld(col++, fld.next());
 
             /* uname */
-            item.setTextFld(col++, fld.next());
+            if (fld.hasNext()) {
+               item.setTextFld(col++, fld.next());
+            } else {
+               item.setTextFld(col++, "");
+            }
 
             row++;
          }
@@ -150,7 +160,7 @@ void Clients::populateTable()
    /* set default sorting */
    tableWidget->sortByColumn(sortcol, sortord);
    tableWidget->setSortingEnabled(true);
-
+   
    /* Resize rows and columns */
    tableWidget->resizeColumnsToContents();
    tableWidget->resizeRowsToContents();
@@ -214,8 +224,8 @@ void Clients::tableItemChanged(QTableWidgetItem *currentwidgetitem, QTableWidget
    }
 }
 
-/*
- * Setup a context menu
+/* 
+ * Setup a context menu 
  * Made separate from populate so that it would not create context menu over and
  * over as the tree is repopulated.
  */
@@ -274,7 +284,7 @@ void Clients::currentStackItem()
 }
 
 /*
- * Function responding to actionPurgeJobs
+ * Function responding to actionPurgeJobs 
  */
 void Clients::consolePurgeJobs()
 {
diff --git a/src/qt-console/clients/clients.h b/src/qt-console/clients/clients.h
index 4a7dbf8..cbb593e 100644
--- a/src/qt-console/clients/clients.h
+++ b/src/qt-console/clients/clients.h
@@ -1,23 +1,25 @@
 #ifndef _CLIENTS_H_
 #define _CLIENTS_H_
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
- *   Version $Id$
- *
  *   Dirk Bartley, March 2007
  */
 
@@ -28,7 +30,7 @@
 
 class Clients : public Pages, public Ui::ClientForm
 {
-   Q_OBJECT
+   Q_OBJECT 
 
 public:
    Clients();
diff --git a/src/qt-console/console/console.cpp b/src/qt-console/console/console.cpp
index ade97e5..eb8ef45 100644
--- a/src/qt-console/console/console.cpp
+++ b/src/qt-console/console/console.cpp
@@ -1,24 +1,28 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *  Console Class
  *
  *   Written by Kern Sibbald, January MMVII
  *
- */
+ */ 
 
 #include "bat.h"
 #include "console.h"
@@ -37,7 +41,7 @@ Console::Console(QTabWidget *parent) : Pages()
    m_warningPrevent = false;
    m_dircommCounter = 0;
 
-   /*
+   /* 
     * Create a connection to the Director and put it in a hash table
     */
    m_dircommHash.insert(m_dircommCounter, new DirComm(this, m_dircommCounter));
@@ -128,7 +132,7 @@ void Console::connect_dir()
       beginNewCommand(0);
    }
    mainWin->set_status(_("Connected"));
-
+   
    startTimer();                      /* start message timer */
 }
 
@@ -166,7 +170,7 @@ void Console::populateLists(int conn)
    dir_cmd(conn, ".jobs", job_list);
    dir_cmd(conn, ".jobs type=R", restore_list);
    dir_cmd(conn, ".clients", client_list);
-   dir_cmd(conn, ".filesets", fileset_list);
+   dir_cmd(conn, ".filesets", fileset_list);  
    dir_cmd(conn, ".msgs", messages_list);
    dir_cmd(conn, ".pools", pool_list);
    dir_cmd(conn, ".storage", storage_list);
@@ -219,7 +223,7 @@ bool Console::dir_cmd(const char *cmd, QStringList &results)
 
 /*
  * Send a command to the Director, and return the
- *  results in a QStringList.
+ *  results in a QStringList.  
  */
 bool Console::dir_cmd(int conn, const char *cmd, QStringList &results)
 {
@@ -278,7 +282,7 @@ bool Console::sql_cmd(const char *query, QStringList &results)
 
 /*
  * Send an sql query to the Director, and return the
- *  results in a QStringList.
+ *  results in a QStringList.  
  */
 bool Console::sql_cmd(int &conn, const char *query, QStringList &results, bool donotify)
 {
@@ -296,7 +300,7 @@ bool Console::sql_cmd(int &conn, const char *query, QStringList &results, bool d
       dircomm->notify(false);
    }
    mainWin->waitEnter();
-
+   
    pm_strcpy(cmd, ".sql query=\"");
    pm_strcat(cmd, query);
    pm_strcat(cmd, "\"");
@@ -329,7 +333,7 @@ bool Console::sql_cmd(int &conn, const char *query, QStringList &results, bool d
    return !mainWin->isClosing();      /* return false if closing */
 }
 
-/*
+/* 
  * Overloads for
  * Sending a command to the Director
  */
@@ -396,9 +400,9 @@ bool Console::get_job_defaults(int &conn, struct job_defaults &job_defs)
    return get_job_defaults(conn, job_defs, true);
 }
 
-/*
+/*  
  * Send a job name to the director, and read all the resulting
- *  defaults.
+ *  defaults. 
  */
 bool Console::get_job_defaults(int &conn, struct job_defaults &job_defs, bool donotify)
 {
@@ -414,10 +418,12 @@ bool Console::get_job_defaults(int &conn, struct job_defaults &job_defs, bool do
    }
    beginNewCommand(conn);
    bool prevWaitState = mainWin->getWaitState();
-   if (!prevWaitState)
+   if (!prevWaitState) {
       mainWin->waitEnter();
-   if (mainWin->m_connDebug)
+   }
+   if (mainWin->m_connDebug) {
       Pmsg2(000, "job_defaults conn %i %s\n", conn, m_dir->name());
+   }
    scmd = QString(".defaults job=\"%1\"").arg(job_defs.job_name);
    dircomm->write(scmd);
    while ((stat = dircomm->read()) > 0) {
@@ -509,7 +515,7 @@ void Console::writeSettings()
  * Read and restore user settings associated with this console
  */
 void Console::readSettings()
-{
+{ 
    QFont font = get_font();
 
    QSettings settings(m_dir->name(), "bat");
@@ -576,6 +582,7 @@ void Console::display_textf(const char *fmt, ...)
 
 void Console::display_text(const QString buf)
 {
+   if (mainWin->isClosing()) return;
    if (buf.size() != 0) {
       m_cursor->insertText(buf);
       update_cursor();
@@ -585,6 +592,7 @@ void Console::display_text(const QString buf)
 
 void Console::display_text(const char *buf)
 {
+   if (mainWin->isClosing()) return;
    if (*buf != 0) {
       m_cursor->insertText(buf);
       update_cursor();
@@ -593,6 +601,7 @@ void Console::display_text(const char *buf)
 
 void Console::display_html(const QString buf)
 {
+   if (mainWin->isClosing()) return;
    if (buf.size() != 0) {
       m_cursor->insertHtml(buf);
       update_cursor();
@@ -610,6 +619,9 @@ void Console::beginNewCommand(int conn)
 {
    DirComm *dircomm = m_dircommHash.value(conn);
 
+   if (dircomm->m_at_main_prompt) {
+      return;
+   }
    for (int i=0; i < 3; i++) {
       dircomm->write(".");
       while (dircomm->read() > 0) {
@@ -620,11 +632,11 @@ void Console::beginNewCommand(int conn)
          break;
       }
    }
-   display_text("\n");
+   //display_text("\n");
 }
 
 void Console::displayToPrompt(int conn)
-{
+{ 
    DirComm *dircomm = m_dircommHash.value(conn);
 
    int stat = 0;
@@ -666,7 +678,7 @@ void Console::discardToPrompt(int conn)
 }
 
 QString Console::returnFromPrompt(int conn)
-{
+{ 
    DirComm *dircomm = m_dircommHash.value(conn);
    QString text("");
 
@@ -686,7 +698,7 @@ QString Console::returnFromPrompt(int conn)
 
 /*
  * When the notifier is enabled, read_dir() will automatically be
- * called by the Qt event loop when ever there is any output
+ * called by the Qt event loop when ever there is any output 
  * from the Director, and read_dir() will then display it on
  * the console.
  *
@@ -697,7 +709,7 @@ QString Console::returnFromPrompt(int conn)
 
 /* dual purpose function to turn notify off and return a connection */
 int Console::notifyOff()
-{
+{ 
    int conn = 0;
    if (getDirComm(conn)) {
       notify(conn, false);
@@ -707,7 +719,7 @@ int Console::notifyOff()
 
 /* knowing a connection, turn notify off or on */
 bool Console::notify(int conn, bool enable)
-{
+{ 
    DirComm *dircomm = m_dircommHash.value(conn);
    if (dircomm) {
       return dircomm->notify(enable);
@@ -732,8 +744,8 @@ void Console::setDirectorTreeItem(QTreeWidgetItem *item)
    m_directorTreeItem = item;
 }
 
-void Console::setDirRes(DIRRES *dir)
-{
+void Console::setDirRes(DIRRES *dir) 
+{ 
    m_dir = dir;
 }
 
@@ -769,7 +781,7 @@ bool Console::hasFocus()
       return false;
 }
 
-/* For adding feature to have the gui's messages button change when
+/* For adding feature to have the gui's messages button change when 
  * messages are pending */
 bool Console::messagesPending(bool pend)
 {
@@ -864,13 +876,13 @@ bool Console::getDirComm(int &conn)
 /*
  * Try to find a free (unused but established) connection
  * KES: Note, I think there is a problem here because for
- *   some reason, the notifier is often turned off on file
+ *   some reason, the notifier is often turned off on file  
  *   descriptors that seem to me to be available.  That means
  *   that we do not use a free descriptor and thus we will create
  *   a new connection that is maybe not necessary.  Someone needs
  *   to look into whether or not notify() is correctly turned on
  *   when we are back at the command prompt and idle.
- *
+ *                         
  */
 bool Console::findDirComm(int &conn)
 {
@@ -882,7 +894,7 @@ bool Console::findDirComm(int &conn)
          return true;
       }
       if (mainWin->m_connDebug) {
-         Pmsg4(000, "currentDirComm=%d at_prompt=%d at_main=%d && notify=%d\n",
+         Pmsg4(000, "currentDirComm=%d at_prompt=%d at_main=%d && notify=%d\n",                                      
             dircomm->m_conn, dircomm->m_at_prompt, dircomm->m_at_main_prompt, dircomm->is_notify_enabled());
       }
       ++iter;
diff --git a/src/qt-console/console/console.h b/src/qt-console/console/console.h
index 1d16764..e5e6c3a 100644
--- a/src/qt-console/console/console.h
+++ b/src/qt-console/console/console.h
@@ -1,23 +1,25 @@
 #ifndef _CONSOLE_H_
 #define _CONSOLE_H_
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
- *   Version $Id$
- *
  *   Kern Sibbald, January 2007
  */
 
@@ -54,7 +56,7 @@ struct job_defaults {
 
 class Console : public Pages, public Ui::ConsoleForm
 {
-   Q_OBJECT
+   Q_OBJECT 
    friend class DirComm;
 
 public:
@@ -68,7 +70,7 @@ public:
    int notifyOff(); // enables/disables socket notification - returns the previous state
    bool notify(int conn, bool enable); // enables/disables socket notification - returns the previous state
    bool is_notify_enabled(int conn) const;
-   bool getDirComm(int &conn);
+   bool getDirComm(int &conn);  
    bool findDirComm(int &conn);
    void displayToPrompt(int conn);
    QString returnFromPrompt(int conn);
@@ -128,7 +130,7 @@ public:
    QStringList location_list;
 
 public slots:
-   void connect_dir();
+   void connect_dir();                     
    void status_dir(void);
    void messages(void);
    void set_font(void);
diff --git a/src/qt-console/fileset/fileset.cpp b/src/qt-console/fileset/fileset.cpp
index a3f49b1..1a8a3f9 100644
--- a/src/qt-console/fileset/fileset.cpp
+++ b/src/qt-console/fileset/fileset.cpp
@@ -1,27 +1,29 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2009 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
 
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
+ 
 /*
- *   Version $Id$
- *
  *  FileSet Class
  *
  *   Dirk Bartley, March 2007
  *
- */
+ */ 
 
 #include "bat.h"
 #include <QAbstractEventDispatcher>
@@ -53,7 +55,7 @@ FileSet::~FileSet()
 }
 
 /*
- * The main meat of the class!!  The function that querries the director and
+ * The main meat of the class!!  The function that querries the director and 
  * creates the widgets with appropriate values.
  */
 void FileSet::populateTable()
@@ -109,13 +111,17 @@ void FileSet::populateTable()
          /* Iterate through the record returned from the query */
          foreach (QString resultline, results) {
             fieldlist = resultline.split("\t");
+            if (fieldlist.size() != 3) {
+               Pmsg1(000, "Unexpected line %s", resultline.toUtf8().data());
+               continue;
+            }
 
             /* remove this fileSet from notFoundList */
             int indexOf = notFoundList.indexOf(fieldlist[0]);
             if (indexOf != -1) { notFoundList.removeAt(indexOf); }
 
             TableItemFormatter item(*tableWidget, row);
-
+  
             /* Iterate through fields in the record */
             QStringListIterator fld(fieldlist);
             int col = 0;
@@ -138,11 +144,11 @@ void FileSet::populateTable()
       item.setTextFld(0, filesetName);
       row++;
    }
-
+   
    /* set default sorting */
    tableWidget->sortByColumn(headerlist.indexOf(tr("FileSet Name")), Qt::AscendingOrder);
    tableWidget->setSortingEnabled(true);
-
+   
    /* Resize rows and columns */
    tableWidget->resizeColumnsToContents();
    tableWidget->resizeRowsToContents();
@@ -203,8 +209,8 @@ void FileSet::tableItemChanged(QTableWidgetItem *currentwidgetitem, QTableWidget
    }
 }
 
-/*
- * Setup a context menu
+/* 
+ * Setup a context menu 
  * Made separate from populate so that it would not create context menu over and
  * over as the tree is repopulated.
  */
@@ -262,7 +268,7 @@ void FileSet::writeSettings()
  * Read and restore user settings associated with this page
  */
 void FileSet::readSettings()
-{
+{ 
    QSettings settings(m_console->m_dir->name(), "bat");
    settings.beginGroup("FileSet");
    restoreGeometry(settings.value("geometry").toByteArray());
diff --git a/src/qt-console/fileset/fileset.h b/src/qt-console/fileset/fileset.h
index d75b112..90f33b0 100644
--- a/src/qt-console/fileset/fileset.h
+++ b/src/qt-console/fileset/fileset.h
@@ -1,23 +1,25 @@
 #ifndef _FILESET_H_
 #define _FILESET_H_
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
- *   Version $Id$
- *
  *   Dirk Bartley, March 2007
  */
 
@@ -28,7 +30,7 @@
 
 class FileSet : public Pages, public Ui::FileSetForm
 {
-   Q_OBJECT
+   Q_OBJECT 
 
 public:
    FileSet();
diff --git a/src/qt-console/help/help.cpp b/src/qt-console/help/help.cpp
index dad2dac..3e99563 100644
--- a/src/qt-console/help/help.cpp
+++ b/src/qt-console/help/help.cpp
@@ -1,25 +1,29 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2010 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
 
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
+ 
 /*
  *  Help Window class
  *
  *   Kern Sibbald, May MMVII
  *
- */
+ */ 
 
 #include "bat.h"
 #include "help.h"
diff --git a/src/qt-console/help/help.h b/src/qt-console/help/help.h
index e2f9a29..3d11ef7 100644
--- a/src/qt-console/help/help.h
+++ b/src/qt-console/help/help.h
@@ -2,21 +2,25 @@
 #define _HELP_H_
 
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
 
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
+ 
 /*
  *  Help Window class
  *
@@ -25,14 +29,14 @@
  *   Kern Sibbald, May MMVII
  *
  *  $Id$
- */
+ */ 
 
 #include "bat.h"
 #include "ui_help.h"
 
 class Help : public QWidget, public Ui::helpForm
 {
-   Q_OBJECT
+   Q_OBJECT 
 
 public:
    Help(const QString &path, const QString &file, QWidget *parent = NULL);
diff --git a/src/qt-console/job/job.cpp b/src/qt-console/job/job.cpp
index ca27d00..515ed47 100644
--- a/src/qt-console/job/job.cpp
+++ b/src/qt-console/job/job.cpp
@@ -1,19 +1,23 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2007-2009 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
 
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
+ 
 #include "bat.h"
 #include "job.h"
 #include "util/fmtwidgetitem.h"
@@ -28,6 +32,7 @@ Job::Job(QString &jobId, QTreeWidgetItem *parentTreeWidgetItem) : Pages()
    thisitem->setIcon(0,QIcon(QString::fromUtf8(":images/joblog.png")));
    m_cursor = new QTextCursor(textJobLog->document());
 
+   m_bwlimit = 0;
    m_jobId = jobId;
    m_timer = NULL;
    getFont();
@@ -37,6 +42,7 @@ Job::Job(QString &jobId, QTreeWidgetItem *parentTreeWidgetItem) : Pages()
    connect(pbCancel, SIGNAL(clicked()), this, SLOT(cancelJob()));
    connect(pbRun, SIGNAL(clicked()), this, SLOT(rerun()));
    connect(list_Volume, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(showInfoVolume(QListWidgetItem *)));
+   connect(spin_Bwlimit, SIGNAL(valueChanged(int)), this, SLOT(storeBwLimit(int)));
 
    populateAll();
    dockPage();
@@ -131,7 +137,7 @@ void Job::populateText()
    if (mainWin->m_sqlDebug) {
       Pmsg1(000, "Log query cmd : %s\n", query.toUtf8().data());
    }
-
+  
    QStringList results;
    if (m_console->sql_cmd(query, results)) {
 
@@ -141,13 +147,13 @@ void Job::populateText()
                "It is possible you may need to add \"catalog = all\" "
                "to the Messages resource for this job.\n"), QMessageBox::Ok);
          return;
-      }
+      } 
 
       QString jobstr("JobId "); /* FIXME: should this be translated ? */
       jobstr += m_jobId;
 
       QString htmlbuf("<html><body><pre>");
-
+  
       /* Iterate through the lines of results. */
       QString field;
       QStringList fieldlist;
@@ -155,7 +161,7 @@ void Job::populateText()
       QString lastSvc;
       foreach (QString resultline, results) {
          fieldlist = resultline.split("\t");
-
+         
          if (fieldlist.size() < 2)
             continue;
 
@@ -164,12 +170,12 @@ void Job::populateText()
          field = fieldlist[1].trimmed();
          int colon = field.indexOf(":");
          if (colon > 0) {
-            /* string is like <service> <jobId xxxx>: ..."
-             * we split at ':' then remove the jobId xxxx string (always the same) */
+            /* string is like <service> <jobId xxxx>: ..." 
+             * we split at ':' then remove the jobId xxxx string (always the same) */ 
             QString curSvc(field.left(colon).replace(jobstr,"").trimmed());
             if (curSvc == lastSvc  && curTime == lastTime) {
                curTime.clear();
-               curSvc.clear();
+               curSvc.clear(); 
             } else {
                lastTime = curTime;
                lastSvc = curSvc;
@@ -196,7 +202,7 @@ void Job::populateText()
 //          htmlbuf += "<td>" + curTime + "</td>";
             htmlbuf += "\n" + field ;
          }
-
+  
       } /* foreach resultline */
 
       htmlbuf += "</pre></body></html>";
@@ -204,13 +210,17 @@ void Job::populateText()
       /* full text ready. Here a custom sheet is used to align columns */
       QString logSheet(".err {color:#FF0000;}");
       textJobLog->document()->setDefaultStyleSheet(logSheet);
-      textJobLog->document()->setHtml(htmlbuf);
+      textJobLog->document()->setHtml(htmlbuf); 
       textJobLog->moveCursor(QTextCursor::Start);
 
    } /* if results from query */
-
+  
 }
 
+void Job::storeBwLimit(int val)
+{
+   m_bwlimit = val;
+}
 
 void Job::updateRunInfo()
 {
@@ -219,6 +229,17 @@ void Job::updateRunInfo()
    QStringList lst;
    bool parseit=false;
 
+#ifdef xxx
+   /* This doesn't seem like the right thing to do */
+   if (m_bwlimit >= 100) {
+      cmd = QString("setbandwidth limit=" + QString::number(m_bwlimit) 
+                    + " jobid=" + m_jobId);
+      m_console->dir_cmd(cmd, results);
+      results.clear();
+      m_bwlimit = 0;
+   }
+#endif
+
    cmd = QString(".status client=\"" + m_client + "\" running");
 /*
  *  JobId 5 Job backup.2010-12-21_09.28.17_03 is running.
@@ -238,13 +259,17 @@ void Job::updateRunInfo()
  */
    QRegExp jobline("(JobId) (\\d+) Job ");
    QRegExp itemline("([\\w /]+)[:=]\\s*(.+)");
+   QRegExp filesline("Files: Examined=([\\d,]+) Backed up=([\\d,])");
    QRegExp oldline("Files=([\\d,]+) Bytes=([\\d,]+) Bytes/sec=([\\d,]+) Errors=([\\d,]+)");
+   QRegExp restoreline("Files: Restored=([\\d,]+) Expected=([\\d,]+) Completed=([\\d,]+)%");
+   QRegExp restoreline2("Files Examined=([\\d,]+) Expected Files=([\\d,]+) Percent Complete=([\\d,]+)");
+
    QString com(",");
    QString empty("");
-
+   
    if (m_console->dir_cmd(cmd, results)) {
       foreach (QString mline, results) {
-         foreach (QString line, mline.split("\n")) {
+         foreach (QString line, mline.split("\n")) { 
             line = line.trimmed();
             if (oldline.indexIn(line) >= 0) {
                if (parseit) {
@@ -256,6 +281,21 @@ void Job::updateRunInfo()
                }
                continue;
 
+            } else if (filesline.indexIn(line) >= 0) {
+               if (parseit) {
+                  lst = filesline.capturedTexts(); // Will also catch Backed up
+                  label_FilesExamined->setText(lst[1]);
+               }
+               continue;
+
+// TODO: Need to be fixed
+//            } else if (restoreline2.indexIn(line) >= 0) {
+//               if (parseit) {
+//                  lst = filesline.capturedTexts();
+//                  label_FilesExamined->setText(lst[1]); // Can also handle Expected and Completed
+//               }
+//               continue;
+
             } else if (jobline.indexIn(line) >= 0) {
                lst = jobline.capturedTexts();
                lst.removeFirst();
@@ -265,12 +305,12 @@ void Job::updateRunInfo()
                lst.removeFirst();
 
             } else {
-               if (mainWin->m_miscDebug)
+               if (mainWin->m_miscDebug) 
                   Pmsg1(0, "bad line=%s\n", line.toUtf8().data());
                continue;
             }
             if (lst.count() < 2) {
-               if (mainWin->m_miscDebug)
+               if (mainWin->m_miscDebug) 
                   Pmsg2(0, "bad line=%s count=%d\n", line.toUtf8().data(), lst.count());
             }
             if (lst[0] == "JobId") {
@@ -283,36 +323,53 @@ void Job::updateRunInfo()
             if (!parseit) {
                continue;
             }
-
+            
 //         } else if (lst[0] == "Job") {
 //            grpRun->setTitle(lst[1]);
-
-//
+            
+//               
 //         } else if (lst[0] == "VSS") {
 
 //         } else if (lst[0] == "Level") {
 //            Info->setText(lst[1]);
 //
-//         } else if (lst[0] == "JobType") {
+//         } else if (lst[0] == "JobType" || lst[0] == "Type") {
 //
-//         } else if (lst[0] == "JobStarted") {
+//         } else if (lst[0] == "JobStarted" || lst[0] == "StartTime") {
 //            Started->setText(lst[1]);
 
+#ifdef xxx
+            if (lst[0] == "Bwlimit") {
+               int val = lst[1].toInt();
+               if (val > 0) {
+                  chk_Bwlimit->setChecked(true);
+                  spin_Bwlimit->setEnabled(true);
+                  spin_Bwlimit->setValue(lst[1].toInt()/1024);
+               } else {
+                  chk_Bwlimit->setEnabled(false);
+                  spin_Bwlimit->setEnabled(false);
+                  spin_Bwlimit->setValue(0);
+               }
+#endif
+               
             if (lst[0] == "Errors") {
                label_JobErrors->setText(lst[1]);
-
+               
             } else if (lst[0] == "Bytes/sec") {
                label_Speed->setText(convertBytesSI(lst[1].toULongLong())+"/s");
-
-            } else if (lst[0] == "Files") {
+               
+            } else if (lst[0] == "Files" || lst[0] == "JobFiles") {
                label_JobFiles->setText(lst[1]);
-
-            } else if (lst[0] == "Bytes") {
+               
+            } else if (lst[0] == "Bytes" || lst[0] == "JobBytes") {
                label_JobBytes->setText(convertBytesSI(lst[1].toULongLong()));
+               
+            } else if (lst[0] == "Examined") {
+               label_FilesExamined->setText(lst[1]);
 
             } else if (lst[0] == "Files Examined") {
                label_FilesExamined->setText(lst[1]);
-
+               
             } else if (lst[0] == "Processing file") {
                label_CurrentFile->setText(lst[1]);
             }
@@ -328,14 +385,14 @@ void Job::populateForm()
 {
    QString stat, err;
    char buf[256];
-   QString query =
+   QString query = 
       "SELECT JobId, Job.Name, Level, Client.Name, Pool.Name, FileSet,"
       "SchedTime, StartTime, EndTime, EndTime-StartTime AS Duration, "
       "JobBytes, JobFiles, JobErrors, JobStatus, PurgedFiles "
       "FROM Job JOIN Client USING (ClientId) "
         "LEFT JOIN Pool ON (Job.PoolId = Pool.PoolId) "
         "LEFT JOIN FileSet ON (Job.FileSetId = FileSet.FileSetId)"
-      "WHERE JobId=" + m_jobId;
+      "WHERE JobId=" + m_jobId; 
    QStringList results;
    if (m_console->sql_cmd(query, results)) {
       QString resultline, duration;
@@ -343,10 +400,14 @@ void Job::populateForm()
 
       foreach (resultline, results) { // should have only one result
          fieldlist = resultline.split("\t");
+         if (fieldlist.size() != 15) {
+            Pmsg1(000, "Unexpected line %s", resultline.toUtf8().data());
+            continue;
+         }
          QStringListIterator fld(fieldlist);
          label_JobId->setText(fld.next());
          label_Name->setText(fld.next());
-
+         
          label_Level->setText(job_level_to_str(fld.next()[0].toAscii()));
 
          m_client = fld.next();
@@ -357,9 +418,9 @@ void Job::populateForm()
          label_StartTime->setText(fld.next());
          label_EndTime->setText(fld.next());
          duration = fld.next();
-         /*
+         /* 
           * Note: if we have a negative duration, it is because the EndTime
-          *  is zero (i.e. the Job is still running).  We should use
+          *  is zero (i.e. the Job is still running).  We should use 
           *  duration = StartTime - current_time
           */
          if (duration.left(1) == "-") {
@@ -405,16 +466,16 @@ void Job::populateForm()
       }
    }
 }
-
+  
 void Job::populateVolumes()
 {
 
-   QString query =
+   QString query = 
       "SELECT DISTINCT VolumeName, InChanger, Slot "
       "FROM Job JOIN JobMedia USING (JobId) JOIN Media USING (MediaId) "
-      "WHERE JobId=" + m_jobId + " ORDER BY VolumeName ";
+      "WHERE JobId=" + m_jobId + " ORDER BY VolumeName "; 
    if (mainWin->m_sqlDebug) Pmsg1(0, "Query cmd : %s\n",query.toUtf8().data());
-
+         
 
    QStringList results;
    if (m_console->sql_cmd(query, results)) {
@@ -424,7 +485,7 @@ void Job::populateVolumes()
       foreach (resultline, results) { // should have only one result
          fieldlist = resultline.split("\t");
          QStringListIterator fld(fieldlist);
-//         QListWidgetItem(QIcon(":/images/inchanger" + fld.next() + ".png"),
+//         QListWidgetItem(QIcon(":/images/inchanger" + fld.next() + ".png"), 
 //                         fld.next(), list_Volume);
          list_Volume->addItem(fld.next());
       }
diff --git a/src/qt-console/job/job.h b/src/qt-console/job/job.h
index 9c08c17..44d328a 100644
--- a/src/qt-console/job/job.h
+++ b/src/qt-console/job/job.h
@@ -1,19 +1,23 @@
 #ifndef _JOB_H_
 #define _JOB_H_
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 
 #include <QtGui>
@@ -22,7 +26,7 @@
 
 class Job : public Pages, public Ui::JobForm
 {
-   Q_OBJECT
+   Q_OBJECT 
 
 public:
    Job(QString &jobId, QTreeWidgetItem *parentTreeWidgetItem);
@@ -33,6 +37,7 @@ public slots:
    void cancelJob();
    void showInfoVolume(QListWidgetItem *);
    void rerun();
+   void storeBwLimit(int val);
 
 private slots:
 
@@ -46,6 +51,7 @@ private:
    QString m_jobId;
    QString m_client;
    QTimer *m_timer;
+   int m_bwlimit;
 };
 
 #endif /* _JOB_H_ */
diff --git a/src/qt-console/job/job.ui b/src/qt-console/job/job.ui
index 6f3305c..a60cb74 100644
--- a/src/qt-console/job/job.ui
+++ b/src/qt-console/job/job.ui
@@ -692,6 +692,35 @@
           </property>
          </widget>
         </item>
+        <item row="3" column="1">
+         <widget class="QSpinBox" name="spin_Bwlimit">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="suffix">
+           <string> kB/s</string>
+          </property>
+          <property name="minimum">
+           <number>100</number>
+          </property>
+          <property name="maximum">
+           <number>200000</number>
+          </property>
+          <property name="singleStep">
+           <number>100</number>
+          </property>
+          <property name="value">
+           <number>200000</number>
+          </property>
+         </widget>
+        </item>
+        <item row="3" column="0">
+         <widget class="QCheckBox" name="chk_Bwlimit">
+          <property name="text">
+           <string>Bandwidth Limit:</string>
+          </property>
+         </widget>
+        </item>
        </layout>
       </widget>
      </item>
diff --git a/src/qt-console/jobgraphs/jobplot.cpp b/src/qt-console/jobgraphs/jobplot.cpp
index 510d9f0..1b14e41 100644
--- a/src/qt-console/jobgraphs/jobplot.cpp
+++ b/src/qt-console/jobgraphs/jobplot.cpp
@@ -1,27 +1,29 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2007 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
 
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
+ 
 /*
- *   Version $Id$
- *
  *  JobPlots Class
  *
  *   Dirk Bartley, March 2007
  *
- */
+ */ 
 
 #include "bat.h"
 #include <QtGui>
@@ -181,7 +183,7 @@ void JobPlot::setupControls()
       controls->limitSpinBox->setValue(mainWin->m_recordLimitVal);
       controls->daysCheckBox->setCheckState(mainWin->m_daysLimitCheck ? Qt::Checked : Qt::Unchecked);
       controls->daysSpinBox->setValue(mainWin->m_daysLimitVal);
-   }
+   } 
 }
 
 /*
@@ -248,7 +250,7 @@ void JobPlot::runQuery()
 
       QString field;
       QStringList fieldlist;
-
+   
       int row = 0;
       /* Iterate through the record returned from the query */
       foreach (resultline, results) {
@@ -271,7 +273,7 @@ void JobPlot::runQuery()
          }
          row++;
       }
-   }
+   } 
    if ((controls->volumeComboBox->itemText(volumeIndex) != tr("Any")) && (results.count() == 0)){
       /* for context sensitive searches, let the user know if there were no
        *        * results */
@@ -308,7 +310,7 @@ void JobPlot::setupUserInterface()
    area->setObjectName(QString::fromUtf8("area"));
    controls = new JobPlotControls();
    area->setWidget(controls);
-
+   
    m_splitter->addWidget(m_jobPlot);
    m_splitter->addWidget(area);
 
@@ -386,7 +388,7 @@ void JobPlot::addCurve()
          }
          QDateTime mdt = QDateTime::fromString(monthBegin, mainWin->m_dtformat);
          double monbeg = mdt.toTime_t();
-
+   
          //  ...a vertical line at the first of each month
          QwtPlotMarker *mX = new QwtPlotMarker();
          mX->setLabel(mdt.toString("MMM-d"));
@@ -436,7 +438,7 @@ void JobPlot::setPlotType(QString currentText)
 void JobPlot::fillSymbolCombo(QComboBox *q)
 {
   q->addItem( tr("Ellipse"), (int)QwtSymbol::Ellipse);
-  q->addItem( tr("Rect"), (int)QwtSymbol::Rect);
+  q->addItem( tr("Rect"), (int)QwtSymbol::Rect); 
   q->addItem( tr("Diamond"), (int)QwtSymbol::Diamond);
   q->addItem( tr("Triangle"), (int)QwtSymbol::Triangle);
   q->addItem( tr("DTrianle"), (int)QwtSymbol::DTriangle);
@@ -449,7 +451,7 @@ void JobPlot::fillSymbolCombo(QComboBox *q)
   q->addItem( tr("Vline"), (int)QwtSymbol::VLine);
   q->addItem( tr("Star1"), (int)QwtSymbol::Star1);
   q->addItem( tr("Star2"), (int)QwtSymbol::Star2);
-  q->addItem( tr("Hexagon"), (int)QwtSymbol::Hexagon);
+  q->addItem( tr("Hexagon"), (int)QwtSymbol::Hexagon); 
   q->addItem( tr("None"), (int)QwtSymbol::NoSymbol);
 }
 
@@ -478,7 +480,7 @@ void JobPlot::setSymbolType(int index, int type)
       sym.setStyle( (QwtSymbol::Style)style.toInt() );
       sym.setBrush(QColor(Qt::yellow));
       m_fileCurve->setSymbol(sym);
-
+   
    } else {
       style = controls->byteSymbolTypeCombo->itemData(index);
       sym.setStyle( (QwtSymbol::Style)style.toInt() );
@@ -533,7 +535,7 @@ void JobPlot::writeSettings()
    settings.endGroup();
 }
 
-/*
+/* 
  * Read settings values for Controls
  */
 void JobPlot::readControlSettings()
@@ -559,7 +561,7 @@ void JobPlot::readSplitterSettings()
 {
    QSettings settings(m_console->m_dir->name(), "bat");
    settings.beginGroup("JobPlot");
-   if (settings.contains("m_splitterSizes")) {
+   if (settings.contains("m_splitterSizes")) { 
       m_splitter->restoreState(settings.value("m_splitterSizes").toByteArray());
    }
    settings.endGroup();
diff --git a/src/qt-console/jobgraphs/jobplot.h b/src/qt-console/jobgraphs/jobplot.h
index c418bff..4297b4b 100644
--- a/src/qt-console/jobgraphs/jobplot.h
+++ b/src/qt-console/jobgraphs/jobplot.h
@@ -1,23 +1,25 @@
 #ifndef _JOBPLOT_H_
 #define _JOBPLOT_H_
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
- *   Version $Id$
- *
  *   Dirk Bartley, March 2007
  */
 
@@ -48,7 +50,7 @@ struct PlotJobData
 
 /*
  * Class for the purpose of having a single object to pass data to the JobPlot
- * Constructor.  The other option was a constructor with this many passed
+ * Constructor.  The other option was a constructor with this many passed 
  * values or some sort of code to parse a list.  I liked this best at the time.
  */
 class JobPlotPass
@@ -100,7 +102,7 @@ public:
  */
 class JobPlot : public Pages
 {
-   Q_OBJECT
+   Q_OBJECT 
 
 public:
    JobPlot(QTreeWidgetItem *parentTreeWidgetItem, JobPlotPass &);
diff --git a/src/qt-console/joblist/joblist.cpp b/src/qt-console/joblist/joblist.cpp
index 222043a..4afbb68 100644
--- a/src/qt-console/joblist/joblist.cpp
+++ b/src/qt-console/joblist/joblist.cpp
@@ -1,24 +1,26 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2009 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
- *   Version $Id$
- *
  *   Dirk Bartley, March 2007
  */
-
+ 
 #include "bat.h"
 #include <QAbstractEventDispatcher>
 #include <QTableWidgetItem>
@@ -110,8 +112,8 @@ void JobList::populateTable()
 
    /* Set up the Header for the table */
    QStringList headerlist = (QStringList()
-      << tr("Job Id") << tr("Job Name") << tr("Client") << tr("Job Starttime")
-      << tr("Job Type") << tr("Job Level") << tr("Job Files")
+      << tr("Job Id") << tr("Job Name") << tr("Client") << tr("Job Starttime") 
+      << tr("Job Type") << tr("Job Level") << tr("Job Files") 
       << tr("Job Bytes") << tr("Job Status")  << tr("Purged") << tr("File Set")
       << tr("Pool Name") << tr("First Volume") << tr("VolCount"));
 
@@ -157,7 +159,7 @@ void JobList::populateTable()
             continue; /* some fields missing, ignore row */
 
          TableItemFormatter jobitem(*mp_tableWidget, row);
-
+  
          /* Iterate through fields in the record */
          QStringListIterator fld(fieldlist);
          int col = 0;
@@ -205,11 +207,11 @@ void JobList::populateTable()
          jobitem.setNumericFld(col++, fld.next());
          row++;
       }
-   }
+   } 
    /* set default sorting */
    mp_tableWidget->sortByColumn(m_jobIdIndex, Qt::DescendingOrder);
    mp_tableWidget->setSortingEnabled(true);
-
+   
    /* Resize the columns */
    mp_tableWidget->resizeColumnsToContents();
    mp_tableWidget->resizeRowsToContents();
@@ -266,7 +268,7 @@ void JobList::fillQueryString(QString &query)
       m_mediaName = volumeComboBox->itemText(volumeIndex);
    QString distinct = "";
    if (m_mediaName != tr("Any")) { distinct = "DISTINCT "; }
-   query += "SELECT " + distinct + "Job.JobId AS JobId, Job.Name AS JobName, "
+   query += "SELECT " + distinct + "Job.JobId AS JobId, Job.Name AS JobName, " 
             " Client.Name AS Client,"
             " Job.Starttime AS JobStart, Job.Type AS JobType,"
             " Job.Level AS BackupLevel, Job.Jobfiles AS FileCount,"
@@ -384,7 +386,7 @@ void JobList::treeWidgetName(QString &desc)
  */
 void JobList::createConnections()
 {
-   /* connect to the action specific to this pages class that shows up in the
+   /* connect to the action specific to this pages class that shows up in the 
     * page selector tree */
    connect(actionRefreshJobList, SIGNAL(triggered()), this, SLOT(populateTable()));
    connect(refreshButton, SIGNAL(pressed()), this, SLOT(populateTable()));
diff --git a/src/qt-console/joblist/joblist.h b/src/qt-console/joblist/joblist.h
index 9f13912..1a154ba 100644
--- a/src/qt-console/joblist/joblist.h
+++ b/src/qt-console/joblist/joblist.h
@@ -1,23 +1,25 @@
 #ifndef _JOBLIST_H_
 #define _JOBLIST_H_
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
- *   Version $Id$
- *
  *   Dirk Bartley, March 2007
  */
 
@@ -28,10 +30,10 @@
 
 class JobList : public Pages, public Ui::JobListForm
 {
-   Q_OBJECT
+   Q_OBJECT 
 
 public:
-   JobList(const QString &medianame, const QString &clientname,
+   JobList(const QString &medianame, const QString &clientname, 
            const QString &jobname, const QString &filesetname, QTreeWidgetItem *);
    ~JobList();
    virtual void PgSeltreeWidgetClicked();
diff --git a/src/qt-console/joblog/joblog.cpp b/src/qt-console/joblog/joblog.cpp
index 871edb3..11d8bb9 100644
--- a/src/qt-console/joblog/joblog.cpp
+++ b/src/qt-console/joblog/joblog.cpp
@@ -1,27 +1,29 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2009 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
 
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
+ 
 /*
- *   Version $Id$
- *
  *  JobLog Class
  *
  *   Dirk Bartley, March 2007
  *
- */
+ */ 
 
 #include "bat.h"
 #include "joblog.h"
@@ -69,24 +71,24 @@ void JobLog::populateText()
    if (mainWin->m_sqlDebug) {
       Pmsg1(000, "Log query cmd : %s\n", query.toUtf8().data());
    }
-
+  
    QStringList results;
    if (m_console->sql_cmd(query, results)) {
 
       if (!results.size()) {
          QMessageBox::warning(this, tr("Bat"),
             tr("There were no results!\n"
-	       "It is possible you may need to add \"catalog = all\" "
-	       "to the Messages resource for this job.\n"), QMessageBox::Ok);
-	 return;
-      }
+               "It is possible you may need to add \"catalog = all\" "
+               "to the Messages resource for this job.\n"), QMessageBox::Ok);
+         return;
+      } 
 
       QString jobstr("JobId "); /* FIXME: should this be translated ? */
       jobstr += m_jobId;
 
       QString htmlbuf("<html><body><b>" + tr("Log records for job %1").arg(m_jobId) );
       htmlbuf += "</b><table>";
-
+  
       /* Iterate through the lines of results. */
       QString field;
       QStringList fieldlist;
@@ -94,52 +96,52 @@ void JobLog::populateText()
       QString lastSvc;
       foreach (QString resultline, results) {
          fieldlist = resultline.split("\t");
-	
-	 if (fieldlist.size() < 2)
-	    continue;
-
-	 htmlbuf +="<tr>";
-
-	 QString curTime = fieldlist[0].trimmed();
-
-	 field = fieldlist[1].trimmed();
-	 int colon = field.indexOf(":");
-	 if (colon > 0) {
- 	    /* string is like <service> <jobId xxxx>: ..."
-	     * we split at ':' then remove the jobId xxxx string (always the same) */
-	    QString curSvc(field.left(colon).replace(jobstr,"").trimmed());
-	    if (curSvc == lastSvc  && curTime == lastTime) {
-	       curTime.clear();
-	       curSvc.clear();
-	    } else {
-	       lastTime = curTime;
-	       lastSvc = curSvc;
-	    }
-	    htmlbuf += "<td>" + curTime + "</td>";
-	    htmlbuf += "<td><p>" + curSvc + "</p></td>";
-
-	    /* rest of string is marked as pre-formatted (here trimming should
-	     * be avoided, to preserve original formatting) */
-	    QString msg(field.mid(colon+2));
-	    if (msg.startsWith( tr("Error:")) ) { /* FIXME: should really be translated ? */
- 	       /* error msg, use a specific class */
-	       htmlbuf += "<td><pre class=err>" + msg + "</pre></td>";
-	    } else {
-	       htmlbuf += "<td><pre>" + msg + "</pre></td>";
-	    }
-	 } else {
- 	    /* non standard string, place as-is */
-	    if (curTime == lastTime) {
-	       curTime.clear();
-	    } else {
-	       lastTime = curTime;
-	    }
-	    htmlbuf += "<td>" + curTime + "</td>";
-	    htmlbuf += "<td><pre>" + field + "</pre></td>";
-	 }
-
-	 htmlbuf += "</tr>";
-
+         
+         if (fieldlist.size() < 2)
+            continue;
+
+         htmlbuf +="<tr>";
+
+         QString curTime = fieldlist[0].trimmed();
+
+         field = fieldlist[1].trimmed();
+         int colon = field.indexOf(":");
+         if (colon > 0) {
+            /* string is like <service> <jobId xxxx>: ..." 
+             * we split at ':' then remove the jobId xxxx string (always the same) */ 
+            QString curSvc(field.left(colon).replace(jobstr,"").trimmed());
+            if (curSvc == lastSvc  && curTime == lastTime) {
+               curTime.clear();
+               curSvc.clear(); 
+            } else {
+               lastTime = curTime;
+               lastSvc = curSvc;
+            }
+            htmlbuf += "<td>" + curTime + "</td>";
+            htmlbuf += "<td><p>" + curSvc + "</p></td>";
+
+            /* rest of string is marked as pre-formatted (here trimming should
+             * be avoided, to preserve original formatting) */
+            QString msg(field.mid(colon+2));
+            if (msg.startsWith( tr("Error:")) ) { /* FIXME: should really be translated ? */
+               /* error msg, use a specific class */
+               htmlbuf += "<td><pre class=err>" + msg + "</pre></td>";
+            } else {
+               htmlbuf += "<td><pre>" + msg + "</pre></td>";
+            }
+         } else {
+            /* non standard string, place as-is */
+            if (curTime == lastTime) {
+               curTime.clear();
+            } else {
+               lastTime = curTime;
+            }
+            htmlbuf += "<td>" + curTime + "</td>";
+            htmlbuf += "<td><pre>" + field + "</pre></td>";
+         }
+
+         htmlbuf += "</tr>";
+  
       } /* foreach resultline */
 
       htmlbuf += "</table></body></html>";
@@ -147,10 +149,10 @@ void JobLog::populateText()
       /* full text ready. Here a custom sheet is used to align columns */
       QString logSheet("p,pre,.err {margin-left: 10px} .err {color:#FF0000;}");
       textEdit->document()->setDefaultStyleSheet(logSheet);
-      textEdit->document()->setHtml(htmlbuf);
+      textEdit->document()->setHtml(htmlbuf); 
       textEdit->moveCursor(QTextCursor::Start);
 
    } /* if results from query */
-
+  
 }
-
+  
diff --git a/src/qt-console/joblog/joblog.h b/src/qt-console/joblog/joblog.h
index e890497..27d6bbb 100644
--- a/src/qt-console/joblog/joblog.h
+++ b/src/qt-console/joblog/joblog.h
@@ -1,23 +1,25 @@
 #ifndef _JOBLOG_H_
 #define _JOBLOG_H_
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
- *   Version $Id$
- *
  *   Dirk Bartley, March 2007
  */
 
@@ -27,7 +29,7 @@
 
 class JobLog : public Pages, public Ui::JobLogForm
 {
-   Q_OBJECT
+   Q_OBJECT 
 
 public:
    JobLog(QString &jobId, QTreeWidgetItem *parentTreeWidgetItem);
diff --git a/src/qt-console/jobs/jobs.cpp b/src/qt-console/jobs/jobs.cpp
index 2dbff14..edb6217 100644
--- a/src/qt-console/jobs/jobs.cpp
+++ b/src/qt-console/jobs/jobs.cpp
@@ -1,24 +1,28 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
 
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
+ 
 /*
  *  Jobs Class
  *
  *   Dirk Bartley, March 2007
- */
+ */ 
 
 #include "bat.h"
 #include "jobs/jobs.h"
@@ -51,7 +55,7 @@ Jobs::~Jobs()
 }
 
 /*
- * The main meat of the class!!  The function that querries the director and
+ * The main meat of the class!!  The function that querries the director and 
  * creates the widgets with appropriate values.
  */
 void Jobs::populateTable()
@@ -65,9 +69,9 @@ void Jobs::populateTable()
    m_checkcurwidget = false;
    tableWidget->clear();
    m_checkcurwidget = true;
-   QStringList headerlist = (QStringList() << tr("Job Name")
-      << tr("Pool") << tr("Messages") << tr("Client")
-      << tr("Storage") << tr("Level") << tr("Type")
+   QStringList headerlist = (QStringList() << tr("Job Name") 
+      << tr("Pool") << tr("Messages") << tr("Client") 
+      << tr("Storage") << tr("Level") << tr("Type") 
       << tr("FileSet") << tr("Catalog") << tr("Enabled")
       << tr("Where"));
 
@@ -89,7 +93,7 @@ void Jobs::populateTable()
       if (m_console->get_job_defaults(job_defs)) {
          int col = 0;
          TableItemFormatter jobsItem(*tableWidget, row);
-         jobsItem.setTextFld(col++, jobName);
+         jobsItem.setTextFld(col++, jobName); 
          jobsItem.setTextFld(col++, job_defs.pool_name);
          jobsItem.setTextFld(col++, job_defs.messages_name);
          jobsItem.setTextFld(col++, job_defs.client_name);
@@ -106,7 +110,7 @@ void Jobs::populateTable()
    /* set default sorting */
    tableWidget->sortByColumn(headerlist.indexOf(tr("Job Name")), Qt::AscendingOrder);
    tableWidget->setSortingEnabled(true);
-
+   
    /* Resize rows and columns */
    tableWidget->resizeColumnsToContents();
    tableWidget->resizeRowsToContents();
@@ -165,8 +169,8 @@ void Jobs::tableItemChanged(QTableWidgetItem *currentwidgetitem, QTableWidgetIte
    }
 }
 
-/*
- * Setup a context menu
+/* 
+ * Setup a context menu 
  * Made separate from populate so that it would not create context menu over and
  * over as the table is repopulated.
  */
@@ -252,7 +256,7 @@ void Jobs::listJobs()
 }
 
 /*
- * Open a new job run page with the currently selected job
+ * Open a new job run page with the currently selected job 
  * defaulted In
  */
 void Jobs::runJob()
diff --git a/src/qt-console/jobs/jobs.h b/src/qt-console/jobs/jobs.h
index 0b77ac5..425a398 100644
--- a/src/qt-console/jobs/jobs.h
+++ b/src/qt-console/jobs/jobs.h
@@ -1,23 +1,25 @@
 #ifndef _JOBS_H_
 #define _JOBS_H_
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
- *   Version $Id$
- *
  *   Dirk Bartley, March 2007
  */
 
@@ -28,7 +30,7 @@
 
 class Jobs : public Pages, public Ui::jobsForm
 {
-   Q_OBJECT
+   Q_OBJECT 
 
 public:
    Jobs();
diff --git a/src/qt-console/label/label.cpp b/src/qt-console/label/label.cpp
index 914e427..fae53a7 100644
--- a/src/qt-console/label/label.cpp
+++ b/src/qt-console/label/label.cpp
@@ -1,25 +1,29 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2011 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
 
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
+ 
 /*
  *  Label Page class
  *
  *   Kern Sibbald, February MMVII
  *
- */
+ */ 
 
 #include "bat.h"
 #include "label.h"
@@ -81,7 +85,7 @@ void labelPage::okButtonPushed()
    scmd = QString("label volume=\"%1\" pool=\"%2\" storage=\"%3\" slot=%4\n")
                   .arg(volumeName->text())
                   .arg(poolCombo->currentText())
-                  .arg(storageCombo->currentText())
+                  .arg(storageCombo->currentText()) 
                   .arg(slotSpin->value());
    if (mainWin->m_commandDebug) {
       Pmsg1(000, "sending command : %s\n", scmd.toUtf8().data());
diff --git a/src/qt-console/label/label.h b/src/qt-console/label/label.h
index 6f5bd2b..ff87637 100644
--- a/src/qt-console/label/label.h
+++ b/src/qt-console/label/label.h
@@ -1,19 +1,23 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
-/*
+/* 
  * Kern Sibbald, February MMVII
  */
 
@@ -27,7 +31,7 @@
 
 class labelPage : public Pages, public Ui::labelForm
 {
-   Q_OBJECT
+   Q_OBJECT 
 
 public:
    labelPage();
diff --git a/src/qt-console/main.cpp b/src/qt-console/main.cpp
index 870cabc..9e8c723 100644
--- a/src/qt-console/main.cpp
+++ b/src/qt-console/main.cpp
@@ -1,24 +1,28 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *  Main program for bat (qt-console)
  *
  *   Written by Kern Sibbald, January MMVII
  *
- */
+ */ 
 
 
 #include "bat.h"
@@ -38,7 +42,7 @@ MainWin *mainWin;
 QApplication *app;
 
 /* Forward referenced functions */
-void terminate_console(int sig);
+void terminate_console(int sig);                                
 static void usage();
 static int check_resources();
 
@@ -59,11 +63,11 @@ int main(int argc, char *argv[])
    bool test_config = false;
 
 
-   app = new QApplication(argc, argv);
+   app = new QApplication(argc, argv);        
    app->setStyle(new QPlastiqueStyle());
    app->setQuitOnLastWindowClosed(true);
    QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
-
+     
    QTranslator qtTranslator;
    qtTranslator.load(QString("qt_") + QLocale::system().name(),QLibraryInfo::location(QLibraryInfo::TranslationsPath));
    app->installTranslator(&qtTranslator);
@@ -90,13 +94,14 @@ int main(int argc, char *argv[])
    init_msg(NULL, NULL);
    working_directory  = "/tmp";
 
+#ifndef HAVE_WIN32
    struct sigaction sigignore;
    sigignore.sa_flags = 0;
    sigignore.sa_handler = SIG_IGN;
    sigfillset(&sigignore.sa_mask);
    sigaction(SIGPIPE, &sigignore, NULL);
    sigaction(SIGUSR2, &sigignore, NULL);
-
+#endif
 
    while ((ch = getopt(argc, argv, "bc:d:r:st?")) != -1) {
       switch (ch) {
@@ -169,7 +174,9 @@ int main(int argc, char *argv[])
 
 void terminate_console(int /*sig*/)
 {
-// WSA_Cleanup();                  /* TODO: check when we have to call it */
+#ifdef HAVE_WIN32
+   WSACleanup();                  /* TODO: check when we have to call it */
+#endif
    exit(0);
 }
 
@@ -225,7 +232,7 @@ static int check_resources()
          ok = false;
       }
    }
-
+   
    if (numdir == 0) {
       Emsg1(M_FATAL, 0, _("No Director resource defined in %s\n"
                           "Without that I don't how to speak to the Director :-(\n"), configfile);
diff --git a/src/qt-console/mainwin.cpp b/src/qt-console/mainwin.cpp
index 6425ca3..835f715 100644
--- a/src/qt-console/mainwin.cpp
+++ b/src/qt-console/mainwin.cpp
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2010 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 
 /*
@@ -20,7 +24,7 @@
  *
  *   Kern Sibbald, January MMVII
  *
- */
+ */ 
 
 #include "bat.h"
 #include "version.h"
@@ -44,7 +48,7 @@
 #include "status/dirstat.h"
 #include "util/fmtwidgetitem.h"
 
-/*
+/* 
  * Daemon message callback
  */
 void message_callback(int /* type */, char *msg)
@@ -85,7 +89,7 @@ MainWin::MainWin(QWidget *parent) : QMainWindow(parent)
    foreach(Console *console, m_consoleHash) {
       console->connect_dir();
    }
-   /*
+   /* 
     * Note, the notifier is now a global flag, although each notifier
     *  can be individually turned on and off at a socket level.  Once
     *  the notifier is turned off, we don't accept anything from anyone
@@ -157,8 +161,8 @@ void MainWin::createPages()
       item->setForeground(0, redBrush);
 
       /*
-       * Create instances in alphabetic order of the rest
-       *  of the classes that will by default exist under each Director.
+       * Create instances in alphabetic order of the rest 
+       *  of the classes that will by default exist under each Director.  
        */
       new bRestore();
       new Clients();
@@ -305,7 +309,7 @@ void MainWin::disconnectSignals()
  */
 void MainWin::waitEnter()
 {
-   if (m_waitState || m_isClosing) {
+   if (m_waitState || m_isClosing) { 
       return;
    }
    m_waitState = true;
@@ -351,7 +355,7 @@ void MainWin::disconnectConsoleSignals(Console *console)
 }
 
 
-/*
+/* 
  * Two functions to respond to menu items to repop lists and execute reload and repopulate
  * the lists for jobs, clients, filesets .. ..
  */
@@ -366,8 +370,8 @@ void MainWin::reloadRepopLists()
    m_currentConsole->populateLists(false);
 }
 
-/*
- * Reimplementation of QWidget closeEvent virtual function
+/* 
+ * Reimplementation of QWidget closeEvent virtual function   
  */
 void MainWin::closeEvent(QCloseEvent *event)
 {
@@ -413,7 +417,7 @@ void MainWin::writeSettings()
 }
 
 void MainWin::readSettings()
-{
+{ 
    QSettings settings("bacula.org", "bat");
 
    settings.beginGroup("MainWin");
@@ -425,7 +429,7 @@ void MainWin::readSettings()
 
 /*
  * This subroutine is called with an item in the Page Selection window
- *   is clicked
+ *   is clicked 
  */
 void MainWin::treeItemClicked(QTreeWidgetItem *item, int /*column*/)
 {
@@ -478,7 +482,7 @@ void MainWin::treeItemChanged(QTreeWidgetItem *currentitem, QTreeWidgetItem *pre
       nextPage = NULL;
       nextConsole = NULL;
    }
-
+          
    /* The Previous item */
 
    /* this condition prevents a segfault.  The first time there is no previousitem*/
@@ -506,7 +510,7 @@ void MainWin::treeItemChanged(QTreeWidgetItem *currentitem, QTreeWidgetItem *pre
    }
 
    /* process the current (next) item */
-
+   
    if ((nextPage) || (nextConsole)) {
       if (nextConsole != previousConsole) {
          /* make connections to the current console */
@@ -521,7 +525,7 @@ void MainWin::treeItemChanged(QTreeWidgetItem *currentitem, QTreeWidgetItem *pre
       /* set the value for the currently active console */
       int stackindex = tabWidget->indexOf(nextPage);
       nextPage->firstUseDock();
-
+   
       /* Is this page currently on the stack or is it undocked */
       if (stackindex >= 0) {
          /* put this page on the top of the stack */
@@ -544,22 +548,22 @@ void MainWin::treeItemChanged(QTreeWidgetItem *currentitem, QTreeWidgetItem *pre
    }
 }
 
-void MainWin::labelButtonClicked()
+void MainWin::labelButtonClicked() 
 {
    new labelPage();
 }
 
-void MainWin::runButtonClicked()
+void MainWin::runButtonClicked() 
 {
    new runPage("");
 }
 
-void MainWin::estimateButtonClicked()
+void MainWin::estimateButtonClicked() 
 {
    new estimatePage();
 }
 
-void MainWin::browseButtonClicked()
+void MainWin::browseButtonClicked() 
 {
 //   new restoreTree();
 }
@@ -581,7 +585,7 @@ void MainWin::statusPageButtonClicked()
    }
 }
 
-void MainWin::restoreButtonClicked()
+void MainWin::restoreButtonClicked() 
 {
    new prerestorePage();
    if (mainWin->m_miscDebug) Pmsg0(000, "in restoreButtonClicked after prerestorePage\n");
@@ -624,9 +628,8 @@ void MainWin::input_line()
 void MainWin::about()
 {
    QMessageBox::about(this, tr("About bat"),
-      tr("<br><h2>Bat %1 (%2), by Dirk H Bartley and Kern Sibbald</h2>"
-         "<p>Copyright © 2007-%3 Free Software Foundation Europe e.V."
-         "<p>Improved by Bacula Systems SA."
+      tr("<br><h2>Bacula Bat %1 (%2)</h2>"
+         "<p>Copyright © 2007-%3 Kern Sibbald"
          "<p>The <b>bat</b> is an administrative console"
          " interface to the Director.").arg(VERSION).arg(BDATE).arg(BYEAR));
 }
@@ -673,14 +676,14 @@ void MainWin::undockWindowButton()
 }
 
 /*
- * Function to respond to action on page selector context menu to toggle the
+ * Function to respond to action on page selector context menu to toggle the 
  * dock status of the window associated with the page selectors current
  * tree widget item.
  */
 void MainWin::toggleDockContextWindow()
 {
    QTreeWidgetItem *currentitem = treeWidget->currentItem();
-
+   
    /* Is this a page that has been inserted into the hash  */
    if (getFromHash(currentitem)) {
       Pages* page = getFromHash(currentitem);
@@ -776,8 +779,8 @@ void MainWin::closePage(int item)
       if (getFromHash(currentitem)) {
          page = getFromHash(currentitem);
       }
-   }
-
+   }   
+   
    if (page) {
       if (page->isCloseable()) {
          page->closeStackPage();
@@ -967,7 +970,7 @@ void MainWin::readPreferences()
    settings.beginGroup("Misc");
    m_longList = settings.value("longList", false).toBool();
    ItemFormatterBase::setBytesConversion(
-         (ItemFormatterBase::BYTES_CONVERSION) settings.value("byteConvert",
+         (ItemFormatterBase::BYTES_CONVERSION) settings.value("byteConvert", 
          ItemFormatterBase::BYTES_CONVERSION_IEC).toInt());
    m_openPlot = settings.value("openplot", false).toBool();
    m_openBrowser = settings.value("openbrowser", false).toBool();
diff --git a/src/qt-console/mainwin.h b/src/qt-console/mainwin.h
index f29464a..3d96e76 100644
--- a/src/qt-console/mainwin.h
+++ b/src/qt-console/mainwin.h
@@ -1,21 +1,23 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
-/*
- *   Version $Id$
- *
+/* 
  * qt-console main window class definition.
  *
  *  Written by Kern Sibbald, January MMVII
@@ -31,7 +33,7 @@
 class Console;
 class Pages;
 
-class MainWin : public QMainWindow, public Ui::MainForm
+class MainWin : public QMainWindow, public Ui::MainForm    
 {
    Q_OBJECT
 
@@ -130,8 +132,8 @@ protected:
 private:
    void connectConsole();
    void createPages();
-   void connectSignals();
-   void disconnectSignals();
+   void connectSignals(); 
+   void disconnectSignals(); 
    void connectConsoleSignals();
    void disconnectConsoleSignals(Console *console);
 
diff --git a/src/qt-console/make-win32 b/src/qt-console/make-win32
index 5b1bab2..9ee9a3d 100755
--- a/src/qt-console/make-win32
+++ b/src/qt-console/make-win32
@@ -1,40 +1,73 @@
 #!/bin/sh
 #
-#  Used to build the Win32 version of bat
+#  Used to build the Win32/Win64 version of bat
 #
+
+prepare_bat_build ()
+{
+   local version=$1
+   local dpkgs_mingw
+   if test -d ../win32/release${version}; then
+
+
+      if [ ${version} -eq 32 ]
+      then
+        depkgs_mingw='depkgs-mingw32'
+
+      elif [ ${version} -eq 64 ]
+      then
+        depkgs_mingw='depkgs-mingw-w64'
+      else
+        echo "wrong version - '${version}'."
+        exit 1
+      fi
+
+      cp -f ${DEPKGS}/${depkgs_mingw}/lib/qt/QtGui4.dll ../win32/release${version}
+      cp -f ${DEPKGS}/${depkgs_mingw}/lib/qt/QtCore4.dll ../win32/release${version}
+
+      rm -rf ../win32/release${version}/help
+      mkdir ../win32/release${version}/help
+      cp -f help/*.html ../win32/release${version}/help/
+      cp -f images/status.png ../win32/release${version}/help/
+      cp -f images/mail-message-new.png ../win32/release${version}/help/
+      qmake -spec win32 -unix -o Makefile.mingw${version} bat.pro.mingw${version}
+      echo "Make Windows bat"
+      make -j3 -f Makefile.mingw${version} $2
+      if test -f release/bat.exe; then
+         cp -f release/bat.exe ../win32/release${version}
+      else
+         cp -f debug/bat.exe ../win32/release${version}
+      fi
+   fi
+}
+
+prepare_tray_monitor_build ()
+{
+    local version=$1
+    cd tray-monitor
+    qmake -spec ../win32 -unix -o Makefile.mingw${version} tray-monitor.pro.mingw${version}
+    echo "Make Windows tray-monitor"
+    make -j3 -f Makefile.mingw${version} $2
+    if test -f release/bacula-tray-monitor.exe; then
+       cp -f release/bacula-tray-monitor.exe ../../win32/release${version}
+    else
+       cp -f debug/bacula-tray-monitor.exe ../../win32/release${version}
+    fi
+    rm -f release/bacula-tray-monitor.exe debug/bacula-tray-monitor.exe
+    cd ..
+}
+
+readonly BUILD_ARCH="$1"
+
 rm -f debug/bat.exe
 if test -f ../config.h ; then
    mv -f ../config.h ../config.h.orig
 fi
-qmake -spec win32 -unix -o Makefile.mingw32 bat.pro.mingw32
-echo "Make Windows bat"
-make -j3 -f Makefile.mingw32 $1
+
+prepare_bat_build ${BUILD_ARCH:-64}
+
 if test -e ../config.h.orig ; then
    mv -f ../config.h.orig ../config.h
 fi
-if test -d ../win32/release32; then
-   if test -f release/bat.exe; then
-      cp -f release/bat.exe ../win32/release32
-   else
-      cp -f debug/bat.exe ../win32/release32
-   fi 
-   cp -f ${DEPKGS}/depkgs-mingw32/lib/qt/QtGui4.dll ../win32/release32
-   cp -f ${DEPKGS}/depkgs-mingw32/lib/qt/QtCore4.dll ../win32/release32
-   rm -rf ../win32/release32/help
-   mkdir ../win32/release32/help
-   cp -f help/*.html ../win32/release32/help/
-   cp -f images/status.png ../win32/release32/help/
-   cp -f images/mail-message-new.png ../win32/release32/help/
-fi
 
-cd tray-monitor
-rm -f release/bacula-tray-monitor.exe debug/bacula-tray-monitor.exe
-qmake -spec ../win32 -unix -o Makefile.mingw32 tray-monitor.pro
-echo "Make Windows tray-monitor"
-make -j3 -f Makefile.mingw32 $1
-if test -f release/bacula-tray-monitor.exe; then
-   cp -f release/bacula-tray-monitor.exe ../../win32/release32
-else
-   cp -f debug/bacula-tray-monitor.exe ../../win32/release32
-fi 
-cd ..
+prepare_tray_monitor_build ${BUILD_ARCH:-64}
diff --git a/src/qt-console/mediaedit/mediaedit.cpp b/src/qt-console/mediaedit/mediaedit.cpp
index 12b1cfa..783c6da 100644
--- a/src/qt-console/mediaedit/mediaedit.cpp
+++ b/src/qt-console/mediaedit/mediaedit.cpp
@@ -1,24 +1,26 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2009 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
- *   Version $Id$
- *
  *   Dirk Bartley, March 2007
  */
-
+ 
 #include "bat.h"
 #include <QAbstractEventDispatcher>
 #include <QTableWidgetItem>
@@ -26,9 +28,9 @@
 #include "mediaedit.h"
 
 /*
- * A constructor
+ * A constructor 
  */
-MediaEdit::MediaEdit(QTreeWidgetItem *parentWidget, QString &mediaId)
+MediaEdit::MediaEdit(QTreeWidgetItem *parentWidget, QString &mediaId) 
   : Pages()
 {
    setupUi(this);
@@ -55,7 +57,7 @@ MediaEdit::MediaEdit(QTreeWidgetItem *parentWidget, QString &mediaId)
    poolCombo->addItems(m_console->pool_list);
 
    /* The media's Status */
-   QStringList statusList = (QStringList() << "Full" << "Used" << "Append"
+   QStringList statusList = (QStringList() << "Full" << "Used" << "Append" 
        << "Error" << "Purged" << "Recycle" << "Read-Only" << "Cleaning");
    statusCombo->addItems(statusList);
 
@@ -290,7 +292,7 @@ void MediaEdit::useDurationChanged()
 void MediaEdit::setSpins(int value)
 {
    int years, months, days, hours, minutes, seconds, left;
-
+        
    years = abs(value / 31536000);
    left = value - years * 31536000;
    months = abs(left / 2592000);
@@ -364,7 +366,7 @@ void MediaEdit::durationChanged()
    connectSpins();
    if (retentionRadio->isChecked()) {
       int retention;
-      retention = secondsSpin->value() + minutesSpin->value() * 60 +
+      retention = secondsSpin->value() + minutesSpin->value() * 60 + 
          hoursSpin->value() * 3600 + daysSpin->value() * 86400 +
          monthsSpin->value() * 2592000 +
          yearsSpin->value() * 31536000;
@@ -374,7 +376,7 @@ void MediaEdit::durationChanged()
    }
    if (useDurationRadio->isChecked()) {
       int useDuration;
-      useDuration = secondsSpin->value() + minutesSpin->value() * 60 +
+      useDuration = secondsSpin->value() + minutesSpin->value() * 60 + 
          hoursSpin->value() * 3600 + daysSpin->value() * 86400 +
          monthsSpin->value() * 2592000 +
          yearsSpin->value() * 31536000;
diff --git a/src/qt-console/mediaedit/mediaedit.h b/src/qt-console/mediaedit/mediaedit.h
index 252fc44..7aa986e 100644
--- a/src/qt-console/mediaedit/mediaedit.h
+++ b/src/qt-console/mediaedit/mediaedit.h
@@ -1,23 +1,25 @@
 #ifndef _MEDIAEDIT_H_
 #define _MEDIAEDIT_H_
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
- *   Version $Id$
- *
  *   Dirk Bartley, March 2007
  */
 
@@ -28,7 +30,7 @@
 
 class MediaEdit : public Pages, public Ui::mediaEditForm
 {
-   Q_OBJECT
+   Q_OBJECT 
 
 public:
    MediaEdit(QTreeWidgetItem *parentWidget, QString &mediaId);
diff --git a/src/qt-console/mediainfo/mediainfo.cpp b/src/qt-console/mediainfo/mediainfo.cpp
index 040192a..6184d40 100644
--- a/src/qt-console/mediainfo/mediainfo.cpp
+++ b/src/qt-console/mediainfo/mediainfo.cpp
@@ -1,19 +1,23 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2009 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
 
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
+ 
 #include "bat.h"
 #include <QAbstractEventDispatcher>
 #include <QTableWidgetItem>
@@ -26,9 +30,9 @@
 #include "job/job.h"
 
 /*
- * A constructor
+ * A constructor 
  */
-MediaInfo::MediaInfo(QTreeWidgetItem *parentWidget, QString &mediaName)
+MediaInfo::MediaInfo(QTreeWidgetItem *parentWidget, QString &mediaName) 
   : Pages()
 {
    setupUi(this);
@@ -41,7 +45,7 @@ MediaInfo::MediaInfo(QTreeWidgetItem *parentWidget, QString &mediaName)
    connect(pbDelete, SIGNAL(clicked()), this, SLOT(deleteVol()));
    connect(pbEdit, SIGNAL(clicked()), this, SLOT(editVol()));
    connect(tableJob, SIGNAL(itemDoubleClicked(QTableWidgetItem*)), this, SLOT(showInfoForJob(QTableWidgetItem *)));
-
+   
    dockPage();
    setCurrent();
    populateForm();
@@ -121,7 +125,7 @@ void MediaInfo::populateForm()
    QString stat, LastWritten;
    struct tm tm;
    char buf[256];
-   QString query =
+   QString query = 
       "SELECT MediaId, VolumeName, Pool.Name, MediaType, FirstWritten,"
       "LastWritten, VolMounts, VolBytes, Media.Enabled,"
       "Location.Location, VolStatus, RecyclePool.Name, Media.Recycle, "
@@ -159,7 +163,7 @@ void MediaInfo::populateForm()
          label_Location->setText(fld.next());
          label_VolStatus->setText(fld.next());
          label_RecyclePool->setText(fld.next());
-         chkbox_Recycle->setCheckState(fld.next().toInt()?Qt::Checked:Qt::Unchecked);
+         chkbox_Recycle->setCheckState(fld.next().toInt()?Qt::Checked:Qt::Unchecked);         
          edit_utime(fld.next().toULongLong(), buf, sizeof(buf));
          label_VolReadTime->setText(QString(buf));
 
@@ -181,7 +185,7 @@ void MediaInfo::populateForm()
             t = str_to_utime(LastWritten.toAscii().data());
             t = t + stat.toULongLong();
             ttime = t;
-            localtime_r(&ttime, &tm);
+            localtime_r(&ttime, &tm);         
             strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", &tm);
             label_Expire->setText(QString(buf));
          }
@@ -193,11 +197,11 @@ void MediaInfo::populateForm()
 
 //         jobstatus_to_ascii_gui(stat[0].toAscii(), buf, sizeof(buf));
 //         stat = buf;
-//
+//       
       }
    }
 
-   query =
+   query = 
       "SELECT DISTINCT JobId, Name, StartTime, Type, Level, JobFiles,"
       "JobBytes,JobStatus "
       "FROM Job JOIN JobMedia USING (JobId) JOIN Media USING (MediaId) "
@@ -219,7 +223,7 @@ void MediaInfo::populateForm()
          TableItemFormatter jobitem(*tableJob, row);
 
          /* JobId */
-         jobitem.setNumericFld(index++, fld.next());
+         jobitem.setNumericFld(index++, fld.next()); 
 
          /* job name */
          jobitem.setTextFld(index++, fld.next());
diff --git a/src/qt-console/mediainfo/mediainfo.h b/src/qt-console/mediainfo/mediainfo.h
index c9194c2..0e64d5d 100644
--- a/src/qt-console/mediainfo/mediainfo.h
+++ b/src/qt-console/mediainfo/mediainfo.h
@@ -1,22 +1,25 @@
 #ifndef _MEDIAINFO_H_
 #define _MEDIAINFO_H_
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
- *   Version $Id$
  *
  */
 
@@ -27,7 +30,7 @@
 
 class MediaInfo : public Pages, public Ui::mediaInfoForm
 {
-   Q_OBJECT
+   Q_OBJECT 
 
 public:
    MediaInfo(QTreeWidgetItem *parentWidget, QString &mediaId);
diff --git a/src/qt-console/mediainfo/mediainfo.ui b/src/qt-console/mediainfo/mediainfo.ui
index 2393f83..9dc9fa7 100644
--- a/src/qt-console/mediainfo/mediainfo.ui
+++ b/src/qt-console/mediainfo/mediainfo.ui
@@ -431,7 +431,7 @@
         <item row="7" column="0" >
          <widget class="QLabel" name="label_16" >
           <property name="text" >
-           <string>First Written:</string>
+            <string>First Written:</string>
           </property>
          </widget>
         </item>
diff --git a/src/qt-console/medialist/medialist.cpp b/src/qt-console/medialist/medialist.cpp
index 2627840..e9adb2a 100644
--- a/src/qt-console/medialist/medialist.cpp
+++ b/src/qt-console/medialist/medialist.cpp
@@ -1,25 +1,29 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2010 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
 
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
+ 
 /*
  *  MediaList Class
  *
  *   Dirk Bartley, March 2007
  *
- */
+ */ 
 
 #include "bat.h"
 #include <QAbstractEventDispatcher>
@@ -57,7 +61,7 @@ MediaList::~MediaList()
 }
 
 /*
- * The main meat of the class!!  The function that querries the director and
+ * The main meat of the class!!  The function that querries the director and 
  * creates the widgets with appropriate values.
  */
 void MediaList::populateTree()
@@ -86,7 +90,7 @@ void MediaList::populateTree()
    m_topItem->setText(0, tr("Pools"));
    m_topItem->setData(0, Qt::UserRole, 0);
    m_topItem->setExpanded(true);
-
+   
    mp_treeWidget->setHeaderLabels(headerlist);
 
    QSettings settings(m_console->m_dir->name(), "bat");
@@ -155,20 +159,21 @@ void MediaList::populateTree()
                pooltreeitem->setExpanded(true);
             }
 
-            if (fieldlist.size() < 18)
+            if (fieldlist.size() < 21) { // Handle recyclepool specifically, and pool is already removed
+               Pmsg2(000, "Unexpected line %s %d", resultline.toUtf8().data(), fieldlist.size());
                continue; // some fields missing, ignore row
-
+            }
             int index = 0;
             TreeItemFormatter mediaitem(*pooltreeitem, 2);
-
+  
             /* Iterate through fields in the record */
             QStringListIterator fld(fieldlist);
 
             /* volname */
-            mediaitem.setTextFld(index++, fld.next());
+            mediaitem.setTextFld(index++, fld.next()); 
 
             /* id */
-            mediaitem.setNumericFld(index++, fld.next());
+            mediaitem.setNumericFld(index++, fld.next()); 
 
             /* status */
             mediaitem.setVolStatusFld(index++, fld.next());
@@ -180,24 +185,25 @@ void MediaList::populateTree()
             mediaitem.setBytesFld(index++, fld.next());
 
             /* files */
-            mediaitem.setNumericFld(index++, fld.next());
+            mediaitem.setNumericFld(index++, fld.next()); 
 
             /* jobs */
-            mediaitem.setNumericFld(index++, fld.next());
+            mediaitem.setNumericFld(index++, fld.next()); 
 
             /* retention */
             mediaitem.setDurationFld(index++, fld.next());
 
             /* media type */
-            mediaitem.setTextFld(index++, fld.next());
+            mediaitem.setTextFld(index++, fld.next()); 
 
             /* inchanger + slot */
             int inchanger = fld.next().toInt();
             if (inchanger) {
-               mediaitem.setNumericFld(index++, fld.next());
-            } else {
+               mediaitem.setNumericFld(index++, fld.next()); 
+            }
+            else {
                /* volume not in changer, show blank slot */
-               mediaitem.setNumericFld(index++, "");
+               mediaitem.setNumericFld(index++, ""); 
                fld.next();
             }
 
@@ -205,10 +211,10 @@ void MediaList::populateTree()
             mediaitem.setDurationFld(index++, fld.next());
 
             /* max jobs */
-            mediaitem.setNumericFld(index++, fld.next());
+            mediaitem.setNumericFld(index++, fld.next()); 
 
             /* max files */
-            mediaitem.setNumericFld(index++, fld.next());
+            mediaitem.setNumericFld(index++, fld.next()); 
 
             /* max bytes */
             mediaitem.setBytesFld(index++, fld.next());
@@ -217,10 +223,10 @@ void MediaList::populateTree()
             mediaitem.setBoolFld(index++, fld.next());
 
             /* last written */
-            mediaitem.setTextFld(index++, fld.next());
+            mediaitem.setTextFld(index++, fld.next()); 
 
             /* first written */
-            mediaitem.setTextFld(index++, fld.next());
+            mediaitem.setTextFld(index++, fld.next()); 
 
             /* read time */
             mediaitem.setDurationFld(index++, fld.next());
@@ -229,10 +235,14 @@ void MediaList::populateTree()
             mediaitem.setDurationFld(index++, fld.next());
 
             /* Recycle Count */
-            mediaitem.setNumericFld(index++, fld.next());
+            mediaitem.setNumericFld(index++, fld.next()); 
 
             /* recycle pool */
-            mediaitem.setTextFld(index++, fld.next());
+            if (fld.hasNext()) {
+               mediaitem.setTextFld(index++, fld.next());
+            } else {
+               mediaitem.setTextFld(index++, "");
+            }
 
          } /* foreach resultline */
          counter += 1;
@@ -322,8 +332,8 @@ void MediaList::treeItemChanged(QTreeWidgetItem *currentwidgetitem, QTreeWidgetI
    }
 }
 
-/*
- * Setup a context menu
+/* 
+ * Setup a context menu 
  * Made separate from populate so that it would not create context menu over and
  * over as the tree is repopulated.
  */
diff --git a/src/qt-console/medialist/medialist.h b/src/qt-console/medialist/medialist.h
index 3ce2e0c..7850540 100644
--- a/src/qt-console/medialist/medialist.h
+++ b/src/qt-console/medialist/medialist.h
@@ -1,19 +1,23 @@
 #ifndef _MEDIALIST_H_
 #define _MEDIALIST_H_
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *   Dirk Bartley, March 2007
@@ -26,7 +30,7 @@
 
 class MediaList : public Pages, public Ui::MediaListForm
 {
-   Q_OBJECT
+   Q_OBJECT 
 
 public:
    MediaList();
diff --git a/src/qt-console/medialist/mediaview.cpp b/src/qt-console/medialist/mediaview.cpp
index 1475297..5650a26 100644
--- a/src/qt-console/medialist/mediaview.cpp
+++ b/src/qt-console/medialist/mediaview.cpp
@@ -1,19 +1,23 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2010 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
 
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
+ 
 #include "bat.h"
 #include <QAbstractEventDispatcher>
 #include <QMenu>
@@ -38,7 +42,7 @@ MediaView::MediaView() : Pages()
    connect(m_pbPurge, SIGNAL(pressed()), this, SLOT(purgePushed()));
    connect(m_pbDelete, SIGNAL(pressed()), this, SLOT(deletePushed()));
    connect(m_pbPrune, SIGNAL(pressed()), this, SLOT(prunePushed()));
-   connect(m_tableMedia, SIGNAL(itemDoubleClicked(QTableWidgetItem*)),
+   connect(m_tableMedia, SIGNAL(itemDoubleClicked(QTableWidgetItem*)), 
            this, SLOT(showInfoForMedia(QTableWidgetItem *)));
 
    /* mp_treeWidget, Storage Tree Tree Widget inherited from ui_medialist.h */
@@ -70,7 +74,7 @@ void MediaView::editPushed()
    QStringList sel;
    QString cmd;
    getSelection(sel);
-
+   
    for(int i=0; i<sel.count(); i++) {
       cmd = sel.at(i);
       new MediaEdit(mainWin->getFromHash(this), cmd);
@@ -103,28 +107,19 @@ void MediaView::purgePushed()
 
 bool MediaView::getSelection(QStringList &list)
 {
-   int i, nb, nr_rows, row;
-   bool *tab;
    QTableWidgetItem *it;
    QList<QTableWidgetItem*> items = m_tableMedia->selectedItems();
-
-   /*
-    * See if anything is selected.
-    */
-   nb = items.count();
+   int row;
+   int nrows;                      /* number of rows */
+   bool *tab;
+   int nb = items.count();
    if (!nb) {
       return false;
    }
-
-   /*
-    * Create a nibble map for each row so we can see if its
-    * selected or not.
-    */
-   nr_rows = m_tableMedia->rowCount();
-   tab = (bool *)malloc (nr_rows * sizeof(bool));
-   memset(tab, 0, sizeof(bool) * nr_rows);
-
-   for (i = 0; i < nb; ++i) {
+   nrows = m_tableMedia->rowCount();
+   tab = (bool *) malloc (nrows * sizeof(bool));
+   memset(tab, 0, sizeof(bool)*nrows);
+   for (int i = 0; i < nb; ++i) {
       row = items[i]->row();
       if (!tab[row]) {
          tab[row] = true;
@@ -133,7 +128,6 @@ bool MediaView::getSelection(QStringList &list)
       }
    }
    free(tab);
-
    return list.count() > 0;
 }
 
@@ -193,7 +187,7 @@ void MediaView::populateForm()
    m_cbLocation->addItems(m_console->location_list);
 }
 
-/*
+/* 
  * If chkExpired button is checked, we can remove all non Expired
  * entries
  */
@@ -225,7 +219,7 @@ void MediaView::filterExipired(QStringList &list)
 }
 
 /*
- * The main meat of the class!!  The function that querries the director and
+ * The main meat of the class!!  The function that querries the director and 
  * creates the widgets with appropriate values.
  */
 void MediaView::populateTable()
@@ -248,7 +242,7 @@ void MediaView::populateTable()
    if (m_cbPool->currentText() != "") {
       cmd = " Pool.Name = '" + m_cbPool->currentText() + "'";
       where.append(cmd);
-   }
+   } 
 
    if (m_cbStatus->currentText() != "") {
       cmd = " Media.VolStatus = '" + m_cbStatus->currentText() + "'";
@@ -293,22 +287,26 @@ void MediaView::populateTable()
    if (m_console->sql_cmd(query, results)) {
       foreach (resultline, results) {
          fieldlist = resultline.split("\t");
-         if (fieldlist.at(1).toInt() >= 1) {
+         if (fieldlist.size() != 3) {
+            Pmsg1(000, "Unexpected line %s", resultline.toUtf8().data());
+            continue;
+         }
+         if (fieldlist.at(1).toInt() >= 1) { 
             //           MediaType
-            hash_size[fieldlist.at(2)]
-               = fieldlist.at(0).toFloat();
+            hash_size[fieldlist.at(2)] 
+               = fieldlist.at(0).toFloat(); 
          }
       }
-   }
-
+   }      
+   
    m_tableMedia->clearContents();
-   query =
+   query = 
       "SELECT VolumeName, InChanger, "
       "Slot, MediaType, VolStatus, VolBytes, Pool.Name,  "
       "LastWritten, Media.VolRetention "
       "FROM Media JOIN Pool USING (PoolId) "
       "LEFT JOIN Location ON (Media.LocationId=Location.LocationId) "
-      + cmd +
+      + cmd + 
       " ORDER BY VolumeName LIMIT " + m_sbLimit->cleanText();
 
    m_tableMedia->sortByColumn(0, Qt::AscendingOrder);
@@ -321,25 +319,25 @@ void MediaView::populateTable()
       int row=0;
       filterExipired(results);
       m_tableMedia->setRowCount(results.size());
-
       foreach (resultline, results) { // should have only one result
          int index = 0;
-         QString VolBytes, MediaType, LastWritten, VolStatus;
+         QString Slot, VolBytes, MediaType, LastWritten, VolStatus;
          fieldlist = resultline.split("\t");
-         if (fieldlist.size() != 10) {
+         if (fieldlist.size() != 9) {
+            Pmsg1(000, "Unexpected line %s", resultline.toUtf8().data());
             continue;
          }
          QStringListIterator fld(fieldlist);
          TableItemFormatter mediaitem(*m_tableMedia, row);
 
          /* VolumeName */
-         mediaitem.setTextFld(index++, fld.next());
-
+         mediaitem.setTextFld(index++, fld.next()); 
+         
          /* Online */
          mediaitem.setInChanger(index++, fld.next());
 
-         /* Slot */
-         mediaitem.setNumericFld(index++, fld.next());
+         Slot = fld.next();            // Slot
+         mediaitem.setNumericFld(index++, Slot);
 
          MediaType = fld.next();
          VolStatus = fld.next();
@@ -372,10 +370,10 @@ void MediaView::populateTable()
             t = str_to_utime(LastWritten.toAscii().data());
             t = t + stat.toULongLong();
             ttime = t;
-            localtime_r(&ttime, &tm);
+            localtime_r(&ttime, &tm);         
             strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", &tm);
          }
-
+         
          /* LastWritten */
          mediaitem.setTextFld(index++, LastWritten);
 
@@ -427,7 +425,7 @@ void MediaView::currentStackItem()
 //    setConsoleCurrent();
 //    new relabelDialog(m_console, m_currentVolumeName);
 // }
-//
+// 
 // /*
 //  * Called from the signal of the context sensitive menu to purge!
 //  */
@@ -437,14 +435,14 @@ void MediaView::currentStackItem()
 //    consoleCommand(cmd);
 //    populateTable();
 // }
-//
+// 
 // void MediaView::allVolumes()
 // {
 //    QString cmd = "update volume allfrompools";
 //    consoleCommand(cmd);
 //    populateTable();
 // }
-//
+// 
 //  /*
 //   * Called from the signal of the context sensitive menu to purge!
 //   */
@@ -458,4 +456,4 @@ void MediaView::currentStackItem()
 //     consoleCommand(cmd);
 //     populateTable();
 //  }
-//
+//  
diff --git a/src/qt-console/medialist/mediaview.h b/src/qt-console/medialist/mediaview.h
index d11d271..0b41717 100644
--- a/src/qt-console/medialist/mediaview.h
+++ b/src/qt-console/medialist/mediaview.h
@@ -1,19 +1,23 @@
 #ifndef _MEDIAVIEW_H_
 #define _MEDIAVIEW_H_
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 
 #include <QtGui>
@@ -23,7 +27,7 @@
 
 class MediaView : public Pages, public Ui::MediaViewForm
 {
-   Q_OBJECT
+   Q_OBJECT 
 
 public:
    MediaView();
diff --git a/src/qt-console/mount/mount.cpp b/src/qt-console/mount/mount.cpp
index 188004a..475e486 100644
--- a/src/qt-console/mount/mount.cpp
+++ b/src/qt-console/mount/mount.cpp
@@ -1,32 +1,36 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2007 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
 
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
+ 
 /*
  *  Label Dialog class
  *
  *   Kern Sibbald, February MMVII
  *
- */
+ */ 
 
 #include "bat.h"
 #include "mount/mount.h"
 #include <QMessageBox>
 
 /*
- * A constructor
+ * A constructor 
  */
 mountDialog::mountDialog(Console *console, QString &storageName) : QDialog()
 {
diff --git a/src/qt-console/mount/mount.h b/src/qt-console/mount/mount.h
index 157c851..9706d2b 100644
--- a/src/qt-console/mount/mount.h
+++ b/src/qt-console/mount/mount.h
@@ -1,19 +1,23 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
-/*
+/* 
  * Kern Sibbald, February MMVII
  */
 
@@ -26,7 +30,7 @@
 
 class mountDialog : public QDialog, public Ui::mountForm
 {
-   Q_OBJECT
+   Q_OBJECT 
 
 public:
    mountDialog(Console *console, QString &storage);
diff --git a/src/qt-console/pages.cpp b/src/qt-console/pages.cpp
index 0a7c70c..d21a76e 100644
--- a/src/qt-console/pages.cpp
+++ b/src/qt-console/pages.cpp
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2011 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *   Dirk Bartley, March 2007
@@ -21,7 +25,7 @@
 #include "pages.h"
 
 /* A global function */
-bool isWin32Path(QString &fullPath)
+bool isWin32Path(QString &fullPath) 
 {
    if (fullPath.size()<2) {
       return false;
@@ -121,8 +125,8 @@ void Pages::undockPage()
 }
 
 /*
- * This function is intended to be called with the subclasses.  When it is
- * called the specific sublclass does not have to be known to Pages.  When it
+ * This function is intended to be called with the subclasses.  When it is 
+ * called the specific sublclass does not have to be known to Pages.  When it 
  * is called this function will change the page from it's current state of being
  * docked or undocked and change it to the other.
  */
@@ -137,7 +141,7 @@ void Pages::togglePageDocking()
 }
 
 /*
- * This function is because I wanted for some reason to keep it protected but still
+ * This function is because I wanted for some reason to keep it protected but still 
  * give any subclasses the ability to find out if it is currently stacked or not.
  */
 bool Pages::isDocked()
@@ -194,8 +198,8 @@ void Pages::closeEvent(QCloseEvent* event)
    /* this fixes my woes of getting the widget to show up on top when closed */
    event->ignore();
 
-   /* Set the current tree widget item in the Page Selector window to the item
-    * which represents "this"
+   /* Set the current tree widget item in the Page Selector window to the item 
+    * which represents "this" 
     * Which will also bring "this" to the top of the stacked widget */
    setCurrent();
 }
@@ -265,7 +269,7 @@ void Pages::pgInitialize(const QString &tname, QTreeWidgetItem *parentTreeWidget
    }
 
    QTreeWidgetItem *item = new QTreeWidgetItem(parentTreeWidgetItem);
-   QString name;
+   QString name; 
    treeWidgetName(name);
    item->setText(0, name);
    mainWin->hashInsert(item, this);
@@ -293,24 +297,22 @@ void Pages::consoleCommand(QString &command)
 void Pages::consoleCommand(QString &command, bool setCurrent)
 {
    int conn;
-   bool donotify = false;
-   if (m_console->getDirComm(conn))  {
-      if (m_console->is_notify_enabled(conn)) {
-         donotify = true;
-         m_console->notify(conn, false);
-      }
-      consoleCommand(command, conn, setCurrent);
-      if (donotify) { m_console->notify(conn, true); }
+   if (m_console->getDirComm(conn)) {
+      consoleCommand(command, conn, setCurrent, true);
    }
 }
 
-void Pages::consoleCommand(QString &command, int conn)
-{
-   consoleCommand(command, conn, true);
-}
-
-void Pages::consoleCommand(QString &command, int conn, bool setCurrent)
+/*
+ * Lowest level of console command method.
+ * "notify" parameter default is set to true by higher level console command call.
+ * In most cases "notify" parameter should be set to true value because after console
+ * command sent, notifier should be always enabled for catch all Director responses.
+ */
+void Pages::consoleCommand(QString &command, int conn, bool setCurrent, bool notify)
 {
+   if (notify) {
+      m_console->notify(conn, true);
+   }
    /* Bring this director's console to the front of the stack */
    if (setCurrent) { setConsoleCurrent(); }
    QString displayhtml("<font color=\"blue\">");
@@ -367,7 +369,7 @@ void Pages::setCurrent()
 
 /*
  * Function to set the text of the toggle dock context menu when page and
- * widget item are NOT known.
+ * widget item are NOT known.  
  */
 void Pages::setContextMenuDockText()
 {
@@ -378,7 +380,7 @@ void Pages::setContextMenuDockText()
    } else {
       docktext = tr("ReDock %1 Window").arg(item->text(0));
    }
-
+      
    mainWin->actionToggleDock->setText(docktext);
    setTreeWidgetItemDockColor();
 }
diff --git a/src/qt-console/pages.h b/src/qt-console/pages.h
index bc460ca..997207a 100644
--- a/src/qt-console/pages.h
+++ b/src/qt-console/pages.h
@@ -1,19 +1,23 @@
 #ifndef _PAGES_H_
 #define _PAGES_H_
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *   Dirk Bartley, March 2007
@@ -31,7 +35,7 @@
  *  of or into the stack.  It also provides virtual functions called
  *  from in mainwin so that subclasses can contain functions to allow them
  *  to populate the screens at the time of first viewing, (when selected) as
- *  opposed to  the first creation of the console connection.  The
+ *  opposed to  the first creation of the console connection.  The 
  *  console is not connected until after the page selector tree has been
  *  populated.
  */
@@ -58,9 +62,8 @@ public:
    void setContextMenuDockText();
    void setTreeWidgetItemDockColor();
    void consoleCommand(QString &);
-   void consoleCommand(QString &, int conn);
    void consoleCommand(QString &, bool setCurrent);
-   void consoleCommand(QString &, int conn, bool setCurrent);
+   void consoleCommand(QString &, int conn, bool setCurrent=true, bool notify=true);
    QString &name() { return m_name; };
    void getVolumeList(QStringList &);
    void getStatusList(QStringList &);
diff --git a/src/qt-console/relabel/relabel.cpp b/src/qt-console/relabel/relabel.cpp
index fb967f6..aeace6c 100644
--- a/src/qt-console/relabel/relabel.cpp
+++ b/src/qt-console/relabel/relabel.cpp
@@ -1,25 +1,29 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2009 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
 
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
+ 
 /*
  *  Label Dialog class
  *
  *   Kern Sibbald, February MMVII
  *
- */
+ */ 
 
 #include "bat.h"
 #include "relabel.h"
@@ -81,7 +85,7 @@ void relabelDialog::accept()
       return;
    }
    if (m_fromVolume == volumeName->text().toUtf8()) {
-      QMessageBox::warning(this, tr("New name must be different"),
+      QMessageBox::warning(this, tr("New name must be different"), 
                            tr("New name must be different"),
                            QMessageBox::Ok, QMessageBox::Ok);
       return;
diff --git a/src/qt-console/relabel/relabel.h b/src/qt-console/relabel/relabel.h
index c4aa636..746ba3c 100644
--- a/src/qt-console/relabel/relabel.h
+++ b/src/qt-console/relabel/relabel.h
@@ -1,19 +1,23 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
-/*
+/* 
  * Kern Sibbald, February MMVII
  */
 
@@ -26,7 +30,7 @@
 
 class relabelDialog : public QDialog, public Ui::relabelForm
 {
-   Q_OBJECT
+   Q_OBJECT 
 
 public:
    relabelDialog(Console *console, QString &fromVolume);
diff --git a/src/qt-console/restore/brestore.cpp b/src/qt-console/restore/brestore.cpp
index 980bd8e..7503fb2 100644
--- a/src/qt-console/restore/brestore.cpp
+++ b/src/qt-console/restore/brestore.cpp
@@ -1,26 +1,30 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2011 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
 
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
+ 
 /*
  *
  *  bRestore Class  (Eric's brestore)
  *
  *   Kern Sibbald, January MMVII
  *
- */
+ */ 
 
 #include "bat.h"
 #include "restore.h"
@@ -183,7 +187,7 @@ void bRestore::displayFiles(int64_t pathid, QString path)
    LocationEntry->setText(m_path);
    QString offset = QString().setNum(Offset1Spin->value());
    QString limit=QString().setNum(Offset2Spin->value() - Offset1Spin->value());
-   QString q = ".bvfs_lsdir jobid=" + m_jobids + arg
+   QString q = ".bvfs_lsdir jobid=" + m_jobids + arg 
       + " limit=" + limit + " offset=" + offset ;
    if (mainWin->m_miscDebug) qDebug() << q;
    if (m_console->dir_cmd(q, results)) {
@@ -220,7 +224,7 @@ void bRestore::displayFiles(int64_t pathid, QString path)
          fieldlist = resultline.split("\t");
          TableItemFormatter item(*FileList, row++);
          item.setTextFld(col++, fieldlist.at(5)); // name
-         decode_stat(fieldlist.at(4).toLocal8Bit().data(),
+         decode_stat(fieldlist.at(4).toLocal8Bit().data(), 
                      &statp, sizeof(statp), &LinkFI);
          item.setBytesFld(col++, QString().setNum(statp.st_size));
          item.setDateFld(col++, statp.st_mtime);
@@ -245,7 +249,7 @@ void bRestore::PgSeltreeWidgetClicked()
 }
 
 // Display all versions of a file for this client
-void bRestore::displayFileVersion(QString pathid, QString fnid,
+void bRestore::displayFileVersion(QString pathid, QString fnid, 
                                   QString client, QString filename)
 {
    int row=0;
@@ -253,10 +257,10 @@ void bRestore::displayFileVersion(QString pathid, QString fnid,
    int32_t LinkFI;
    Freeze frz_rev(*FileRevisions); /* disable updating*/
    FileRevisions->clearContents();
-
+   
    QString q = ".bvfs_versions jobid=" + m_jobids +
-      " pathid=" + pathid +
-      " fnid=" + fnid +
+      " pathid=" + pathid + 
+      " fnid=" + fnid + 
       " client=" + client;
 
    if (VersionsChk->checkState() == Qt::Checked) {
@@ -274,10 +278,10 @@ void bRestore::displayFileVersion(QString pathid, QString fnid,
          //PathId, FilenameId, fileid, jobid, lstat, Md5, VolName, Inchanger
          fieldlist = resultline.split("\t");
          TableItemFormatter item(*FileRevisions, row++);
-         item.setInChanger(col++, fieldlist.at(7)); // inchanger
+         item.setInChanger(col++, fieldlist.at(7));    // inchanger
          item.setTextFld(col++, fieldlist.at(6)); // Volume
          item.setNumericFld(col++, fieldlist.at(3)); // JobId
-         decode_stat(fieldlist.at(4).toLocal8Bit().data(),
+         decode_stat(fieldlist.at(4).toLocal8Bit().data(), 
                      &statp, sizeof(statp), &LinkFI);
          item.setBytesFld(col++, QString().setNum(statp.st_size)); // size
          item.setDateFld(col++, statp.st_mtime); // date
@@ -343,9 +347,9 @@ void bRestore::setupPage()
    ClientList->addItems(m_console->client_list);
    connect(ClientList, SIGNAL(currentIndexChanged(int)), this, SLOT(setClient()));
    connect(JobList, SIGNAL(currentIndexChanged(int)), this, SLOT(setJob()));
-   connect(FileList, SIGNAL(itemClicked(QTableWidgetItem*)),
+   connect(FileList, SIGNAL(itemClicked(QTableWidgetItem*)), 
            this, SLOT(clearVersions(QTableWidgetItem *)));
-   connect(FileList, SIGNAL(itemDoubleClicked(QTableWidgetItem*)),
+   connect(FileList, SIGNAL(itemDoubleClicked(QTableWidgetItem*)), 
            this, SLOT(showInfoForFile(QTableWidgetItem *)));
    connect(LocationBp, SIGNAL(pressed()), this, SLOT(applyLocation()));
    connect(MergeChk, SIGNAL(clicked()), this, SLOT(setJob()));
@@ -450,7 +454,7 @@ void bRestoreTable::dropEvent(QDropEvent *event)
          item.setFileType(0, "folder");
       }
       item.setTextFld(col++, fields.at(5)); // filename
-      decode_stat(fields.at(4).toLocal8Bit().data(),
+      decode_stat(fields.at(4).toLocal8Bit().data(), 
                   &statp, sizeof(statp), &LinkFI);
       item.setBytesFld(col++, QString().setNum(statp.st_size)); // size
       item.setDateFld(col++, statp.st_mtime); // date
@@ -534,7 +538,7 @@ bRunRestore::bRunRestore(bRestore *parent)
    computeVolumeList();
 }
 
-void bRestore::get_info_from_selection(QStringList &fileids,
+void bRestore::get_info_from_selection(QStringList &fileids, 
                                        QStringList &jobids,
                                        QStringList &dirids,
                                        QStringList &findexes)
@@ -548,7 +552,7 @@ void bRestore::get_info_from_selection(QStringList &fileids,
       if (lst.at(1) != "0") {   // skip path
          fileids << lst.at(2);
          jobids << lst.at(3);
-         decode_stat(lst.at(4).toLocal8Bit().data(),
+         decode_stat(lst.at(4).toLocal8Bit().data(), 
                      &statp, sizeof(statp), &LinkFI);
          if (LinkFI) {
             findexes << lst.at(3) + "," + QString().setNum(LinkFI);
@@ -576,7 +580,7 @@ void bRunRestore::computeVolumeList()
    QString q =
 " SELECT DISTINCT VolumeName, Enabled, InChanger "
  " FROM File, "
-  " ( " // -- Get all media from this job
+  " ( " // -- Get all media from this job 
      " SELECT MIN(FirstIndex) AS FirstIndex, MAX(LastIndex) AS LastIndex, "
             " VolumeName, Enabled, Inchanger "
        " FROM JobMedia JOIN Media USING (MediaId) "
@@ -593,7 +597,7 @@ void bRunRestore::computeVolumeList()
       TableMedia->setRowCount(results.size());
       /* Iterate through the record returned from the query */
       foreach (QString resultline, results) {
-         // 0        1          2
+         // 0        1          2 
          //volname, enabled, inchanger
          fieldlist = resultline.split("\t");
          int col=0;
@@ -671,7 +675,7 @@ int64_t bRunRestore::runRestore(QString tablename)
    q += " file=\"?" + tablename + "\"";
    q += " when=\"" + WhenEditor->dateTime().toString("yyyy-MM-dd hh:mm:ss") + "\"";
    q += " done yes";
-
+   
    if (mainWin->m_miscDebug) qDebug() << q;
    QStringList results;
    if (brestore->console()->dir_cmd(q, results)) {
@@ -707,5 +711,5 @@ void bRunRestore::computeRestore()
          q = ".bvfs_cleanup path=b2123";
          brestore->console()->dir_cmd(q, results);
       }
-   }
+   }   
 }
diff --git a/src/qt-console/restore/brestore.ui b/src/qt-console/restore/brestore.ui
index 388362b..921df79 100644
--- a/src/qt-console/restore/brestore.ui
+++ b/src/qt-console/restore/brestore.ui
@@ -505,7 +505,7 @@ p, li { white-space: pre-wrap; }
          <item>
           <widget class="QPushButton" name="RestoreBp">
            <property name="text">
-            <string>Restore</string>
+            <string>Restore...</string>
            </property>
           </widget>
          </item>
diff --git a/src/qt-console/restore/prerestore.cpp b/src/qt-console/restore/prerestore.cpp
index 50cf3e7..482c8d1 100644
--- a/src/qt-console/restore/prerestore.cpp
+++ b/src/qt-console/restore/prerestore.cpp
@@ -1,25 +1,29 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2010 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
 
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
+ 
 /*
  *  preRestore -> dialog put up to determine the restore type
  *
  *   Kern Sibbald, February MMVII
  *
- */
+ */ 
 
 #include "bat.h"
 #include "restore.h"
@@ -155,10 +159,10 @@ void prerestorePage::okButtonPushed()
    if (mainWin->m_commandDebug) {
       Pmsg1(000, "preRestore command \'%s\'\n", cmd.toUtf8().data());
    }
-   /*
+   /* 
     * Send off command that looks something like:
     *
-    * restore fileset="Full Set" client="timmy-fd"
+    * restore fileset="Full Set" client="timmy-fd" 
     *        storage="File" current select
     */
    m_console->write_dir(m_conn, cmd.toUtf8().data());
@@ -347,7 +351,7 @@ void prerestorePage::jobRadioClicked(bool checked)
       selectJobIdsRadio->setChecked(true);
    }
    if (mainWin->m_miscDebug) {
-      Pmsg2(000, "jobRadio=%d jobidsRadio=%d\n", selectJobRadio->isChecked(),
+      Pmsg2(000, "jobRadio=%d jobidsRadio=%d\n", selectJobRadio->isChecked(), 
          selectJobIdsRadio->isChecked());
    }
 }
@@ -380,7 +384,7 @@ void prerestorePage::jobidsRadioClicked(bool checked)
       selectJobIdsRadio->setChecked(false);
    }
    if (mainWin->m_miscDebug) {
-      Pmsg2(000, "jobRadio=%d jobidsRadio=%d\n", selectJobRadio->isChecked(),
+      Pmsg2(000, "jobRadio=%d jobidsRadio=%d\n", selectJobRadio->isChecked(), 
          selectJobIdsRadio->isChecked());
    }
 }
diff --git a/src/qt-console/restore/restore.cpp b/src/qt-console/restore/restore.cpp
index caeefee..70cc299 100644
--- a/src/qt-console/restore/restore.cpp
+++ b/src/qt-console/restore/restore.cpp
@@ -1,25 +1,29 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2010 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
 
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
+ 
 /*
- *  Restore Class
+ *  Restore Class 
  *
  *   Kern Sibbald, February MMVII
  *
- */
+ */ 
 
 #include "bat.h"
 #include "restore.h"
@@ -40,7 +44,7 @@ restorePage::restorePage(int conn) : Pages()
 
    m_console->notify(m_conn, false);          /* this should already be off */
 
-   connect(fileWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)),
+   connect(fileWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), 
            this, SLOT(fileDoubleClicked(QTreeWidgetItem *, int)));
    connect(directoryWidget, SIGNAL(
            currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
@@ -60,14 +64,14 @@ restorePage::restorePage(int conn) : Pages()
    setFont(m_console->get_font());
    m_console->displayToPrompt(m_conn);
 
-   titles << tr("Mark") << tr("File") << tr("Mode") << tr("User")
+   titles << tr("Mark") << tr("File") << tr("Mode") << tr("User") 
           << tr("Group") << tr("Size") << tr("Date");
    fileWidget->setHeaderLabels(titles);
 
    get_cwd();
 
    readSettings();
-   /* wait was entered from pre-restore
+   /* wait was entered from pre-restore 
     * will exit, but will reenter in fillDirectory */
    mainWin->waitExit();
    fillDirectory();
@@ -209,11 +213,11 @@ void restorePage::addDirectory(QString &newdirr)
          directoryWidget->setCurrentItem(NULL);
       }
    } else {
-      // Unix add / first if not already there
+      // Unix add / first if not already there 
       if (m_dirPaths.empty()) {
          QTreeWidgetItem *item = new QTreeWidgetItem(directoryWidget);
          item->setIcon(0,QIcon(QString::fromUtf8(":images/folder.png")));
-
+            
          QString text("/");
          item->setText(0, text.toUtf8().data());
          if (mainWin->m_miscDebug) {
@@ -223,7 +227,7 @@ void restorePage::addDirectory(QString &newdirr)
          m_dirTreeItems.insert(item, text);
       }
    }
-
+ 
    /* Does it already exist ?? */
    if (!m_dirPaths.contains(fullpath)) {
       QTreeWidgetItem *item = NULL;
@@ -325,8 +329,8 @@ void restorePage::fileDoubleClicked(QTreeWidgetItem *item, int column)
       m_console->displayToPrompt(m_conn);
       mainWin->waitExit();
       return;
-   }
-   /*
+   }    
+   /* 
     * Double clicking other than column 0 means to decend into
     *  the directory -- or nothing if it is not a directory.
     */
@@ -422,7 +426,7 @@ void restorePage::unmarkButtonPushed()
 }
 
 /*
- * Change current working directory
+ * Change current working directory 
  */
 bool restorePage::cwd(const char *dir)
 {
@@ -449,7 +453,7 @@ bool restorePage::cwd(const char *dir)
 }
 
 /*
- * Return cwd when in tree restore mode
+ * Return cwd when in tree restore mode 
  */
 char *restorePage::get_cwd()
 {
@@ -464,7 +468,7 @@ char *restorePage::get_cwd()
       Dmsg1(dbglvl, "Something went wrong read stat=%d\n", stat);
       QMessageBox::critical(this, "Error", tr(".pwd command failed"), QMessageBox::Ok);
    }
-   m_console->discardToPrompt(m_conn);
+   m_console->discardToPrompt(m_conn); 
    mainWin->waitExit();
    return m_cwd.toUtf8().data();
 }
@@ -488,7 +492,7 @@ void restorePage::readSettings()
    m_splitText = "splitterSizes_2";
    QSettings settings(m_console->m_dir->name(), "bat");
    settings.beginGroup("RestorePage");
-   if (settings.contains(m_splitText)) {
+   if (settings.contains(m_splitText)) { 
       splitter->restoreState(settings.value(m_splitText).toByteArray());
    }
    settings.endGroup();
diff --git a/src/qt-console/restore/restore.h b/src/qt-console/restore/restore.h
index ac79fd4..8710635 100644
--- a/src/qt-console/restore/restore.h
+++ b/src/qt-console/restore/restore.h
@@ -2,34 +2,38 @@
 #define _RESTORE_H_
 
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
  *  Kern Sibbald, February 2007
  */
 
-#include <sys/types.h>
-
+#include <stdint.h>
+#include <sys/types.h>     /* Needed for some systems */
 #include <QtGui>
 #include "pages.h"
 #include "ui_runrestore.h"
 
 class bRestoreTable : public QTableWidget
 {
-   Q_OBJECT
+   Q_OBJECT 
 private:
    QPoint dragStartPosition;
 public:
@@ -61,7 +65,7 @@ enum {
  */
 class prerestorePage : public Pages, public Ui::prerestoreForm
 {
-   Q_OBJECT
+   Q_OBJECT 
 
 public:
    prerestorePage();
@@ -85,14 +89,14 @@ private:
    unsigned int m_dataInType;
 };
 
-/*
+/*  
  * The restore dialog is brought up once we are in the Bacula
  * restore tree routines.  It handles putting up a GUI tree
  * representation of the files to be restored.
  */
 class restorePage : public Pages, public Ui::restoreForm
 {
-   Q_OBJECT
+   Q_OBJECT 
 
 public:
    restorePage(int conn);
@@ -124,7 +128,7 @@ private:
 
 class bRestore : public Pages, public Ui::bRestoreForm
 {
-   Q_OBJECT
+   Q_OBJECT 
 
 public:
    bRestore();
@@ -151,13 +155,13 @@ private:
    void setupPage();
    bool m_populated;
    void displayFiles(int64_t pathid, QString path);
-   void displayFileVersion(QString pathid, QString fnid,
+   void displayFileVersion(QString pathid, QString fnid, 
                            QString client, QString filename);
 };
 
 class bRunRestore : public QDialog, public Ui::bRunRestoreForm
 {
-   Q_OBJECT
+   Q_OBJECT 
 private:
    bRestore *brestore;
    QStringList m_fileids, m_jobids, m_dirids, m_findexes;
diff --git a/src/qt-console/restore/restoretree.cpp b/src/qt-console/restore/restoretree.cpp
index c44f6f3..0bc9172 100644
--- a/src/qt-console/restore/restoretree.cpp
+++ b/src/qt-console/restore/restoretree.cpp
@@ -1,26 +1,30 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2010 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
 
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
+ 
 /*
  *
- *  Restore Class
+ *  Restore Class 
  *
  *   Kern Sibbald, February MMVII
  *
- */
+ */ 
 
 #include "bat.h"
 #include "restoretree.h"
@@ -159,7 +163,7 @@ void restoreTree::populateDirectoryTree()
    updateRefresh();
    int taskcount = 3, ontask = 1;
    if (m_dropdownChanged) taskcount += 1;
-
+   
    /* Set progress bars and repaint */
    prBar1->setVisible(true);
    prBar1->setRange(0,taskcount);
@@ -280,7 +284,7 @@ void restoreTree::populateDirectoryTree()
 /*
  *  Function to set m_checkedJobs from the jobs that are checked in the table
  *  of jobs
- */
+ */     
 void restoreTree::setJobsCheckedList()
 {
    m_JobsCheckedList = "";
@@ -324,7 +328,7 @@ void restoreTree::parseDirectory(const QString &dir_in)
 
      QTreeWidgetItem *item       = NULL;
      QTreeWidgetItem *parentItem = m_dirPaths.value(parent);
-
+     
      if (parentItem==0) {
        // recurse to build parent...
        parseDirectory(parent);
@@ -409,7 +413,7 @@ void restoreTree::directoryCurrentItemChanged(QTreeWidgetItem *item, QTreeWidget
    fileTable->setColumnCount(headerlist.size());
    fileTable->setHorizontalHeaderLabels(headerlist);
    fileTable->setRowCount(0);
-
+   
    m_fileCheckStateList.clear();
    disconnect(fileTable, SIGNAL(itemChanged(QTableWidgetItem *)),
            this, SLOT(fileTableItemChanged(QTableWidgetItem *)));
@@ -430,12 +434,12 @@ void restoreTree::directoryCurrentItemChanged(QTreeWidgetItem *item, QTreeWidget
 
       QStringList results;
       if (m_console->sql_cmd(cmd, results)) {
-
+      
          QTableWidgetItem* tableItem;
          QString field;
          QStringList fieldlist;
          fileTable->setRowCount(results.size());
-
+   
          int row = 0;
          /* Iterate through the record returned from the query */
          foreach (QString resultline, results) {
@@ -446,7 +450,7 @@ void restoreTree::directoryCurrentItemChanged(QTreeWidgetItem *item, QTreeWidget
                field = field.trimmed();  /* strip leading & trailing spaces */
                tableItem = new QTableWidgetItem(field, 1);
                /* Possible flags are Qt::ItemFlags flag = Qt::ItemIsSelectable | Qt::ItemIsEditablex
-                *  | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | Qt::ItemIsUserCheckable
+                *  | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | Qt::ItemIsUserCheckable 
                 *  | Qt::ItemIsEnabled | Qt::ItemIsTristate; */
                tableItem->setForeground(blackBrush);
                /* Just in case a column ever gets added */
@@ -508,16 +512,16 @@ void restoreTree::fileCurrentItemChanged(QTableWidgetItem *currentFileTableItem,
 
    QBrush blackBrush(Qt::black);
 
-   QStringList headerlist = (QStringList()
+   QStringList headerlist = (QStringList() 
       << tr("Job Id") << tr("Type") << tr("End Time") << tr("Hash") << tr("FileId") << tr("Job Type") << tr("First Volume"));
    versionTable->clear();
    versionTable->setColumnCount(headerlist.size());
    versionTable->setHorizontalHeaderLabels(headerlist);
    versionTable->setRowCount(0);
-
+   
    int pathid = m_directoryPathIdHash.value(directory, -1);
    if ((pathid != -1) && (fileNameId != -1)) {
-      QString cmd =
+      QString cmd = 
          "SELECT Job.JobId AS JobId, Job.Level AS Type,"
            " Job.EndTime AS EndTime, File.MD5 AS MD5,"
            " File.FileId AS FileId, Job.Type AS JobType,"
@@ -531,16 +535,16 @@ void restoreTree::fileCurrentItemChanged(QTableWidgetItem *currentFileTableItem,
          " AND Filename.FilenameId=" + QString("%1").arg(fileNameId) +
          " AND Job.Jobid IN (" + m_checkedJobs + ")"
          " ORDER BY Job.EndTime DESC";
-
+   
       if (mainWin->m_sqlDebug) Pmsg1(000, "Query cmd : %s\n", cmd.toUtf8().data());
       QStringList results;
       if (m_console->sql_cmd(cmd, results)) {
-
+      
          QTableWidgetItem* tableItem;
          QString field;
          QStringList fieldlist;
          versionTable->setRowCount(results.size());
-
+   
          int row = 0;
          /* Iterate through the record returned from the query */
          foreach (QString resultline, results) {
@@ -638,7 +642,7 @@ void restoreTree::populateJobTable()
    QBrush blackBrush(Qt::black);
 
    if (mainWin->m_rtPopDirDebug) Pmsg0(000, "Repopulating the Job Table\n");
-   QStringList headerlist = (QStringList()
+   QStringList headerlist = (QStringList() 
       << tr("Job Id") << tr("End Time") << tr("Level") << tr("Type")
       << tr("Name") << tr("Purged") << tr("TU") << tr("TD"));
    m_toggleUpIndex = headerlist.indexOf(tr("TU"));
@@ -684,7 +688,7 @@ void restoreTree::populateJobTable()
 
    QStringList results;
    if (m_console->sql_cmd(jobQuery, results)) {
-
+   
       QTableWidgetItem* tableItem;
       QString field;
       QStringList fieldlist;
@@ -714,7 +718,7 @@ void restoreTree::populateJobTable()
                   if (mainWin->m_sqlDebug) Pmsg1(000, "Column=%d\n", column);
                   if (column == 0) {
                      bool ok;
-                     int purged = fieldlist[purgedIndex].toInt(&ok, 10);
+                     int purged = fieldlist[purgedIndex].toInt(&ok, 10); 
                      if (!((ok) && (purged == 1))) {
                         Qt::ItemFlags flag = Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsTristate;
                         tableItem->setFlags(flag);
@@ -1301,7 +1305,7 @@ void restoreTree::directoryIconStateRemove()
 
       QStringList paths;
       fullPathtoSubPaths(paths, keyPath);
-      /* if the state of the item in m_fileExceptionHash is checked
+      /* if the state of the item in m_fileExceptionHash is checked 
        * each of the subpaths should be "Checked Green" */
       if (state == Qt::Checked) {
 
@@ -1461,7 +1465,7 @@ void restoreTree::restoreButtonPushed()
          if (mainWin->m_rtRestore1Debug)
             Pmsg1(000, "Directory Checked=\"%s\"\n", directory.toUtf8().data());
          /* With a checked directory, query for the files in the directory */
-
+   
          QString cmd =
             "SELECT Filename.Name AS Filename, t1.JobId AS JobId, File.FileIndex AS FileIndex"
             " FROM"
@@ -1478,12 +1482,12 @@ void restoreTree::restoreButtonPushed()
               " AND File.FilenameId=t1.FilenameId"
               " AND Job.Jobid=t1.JobId"
             " ORDER BY Filename";
-
+   
          if (mainWin->m_sqlDebug) Pmsg1(000, "Query cmd : %s\n", cmd.toUtf8().data());
          QStringList results;
          if (m_console->sql_cmd(cmd, results)) {
             QStringList fieldlist;
-
+      
             int row = 0;
             /* Iterate through the record returned from the query */
             foreach (QString resultline, results) {
@@ -1507,7 +1511,7 @@ void restoreTree::restoreButtonPushed()
                   column++;
                }
                fileExcpState = m_fileExceptionHash.value(fullPath, (Qt::CheckState)3);
-
+               
                int excpVersion = m_versionExceptionHash.value(fullPath, 0);
                if (fileExcpState != Qt::Unchecked) {
                   QString debugtext;
@@ -1674,7 +1678,7 @@ int restoreTree::mostRecentVersionfromFullPath(QString &fullPath)
             " AND Filename.Name='" + fileName + "'"
             " AND File.FilenameId!=" + QString("%1").arg(m_nullFileNameId) +
             " GROUP BY Filename.Name";
-
+    
          if (mainWin->m_sqlDebug) Pmsg1(000, "Query cmd : %s\n", cmd.toUtf8().data());
          QStringList results;
          if (m_console->sql_cmd(cmd, results)) {
diff --git a/src/qt-console/restore/restoretree.h b/src/qt-console/restore/restoretree.h
index 7e203a4..ae39d3c 100644
--- a/src/qt-console/restore/restoretree.h
+++ b/src/qt-console/restore/restoretree.h
@@ -2,23 +2,25 @@
 #define _RESTORETREE_H_
 
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
- *   Version $Id$
- *
  *  Kern Sibbald, February 2007
  */
 
@@ -27,12 +29,12 @@
 #include "ui_restoretree.h"
 
 
-/*
+/*  
  * A restore tree to view files in the catalog
  */
 class restoreTree : public Pages, public Ui::restoreTreeForm
 {
-   Q_OBJECT
+   Q_OBJECT 
 
 public:
    restoreTree();
diff --git a/src/qt-console/run/estimate.cpp b/src/qt-console/run/estimate.cpp
index 28399da..9aa894e 100644
--- a/src/qt-console/run/estimate.cpp
+++ b/src/qt-console/run/estimate.cpp
@@ -1,26 +1,30 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2009 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
 
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
+ 
 /*
  *  Run Dialog class
  *
  *   Kern Sibbald, February MMVII
  *
  *  $Id$
- */
+ */ 
 
 #include "bat.h"
 #include "run.h"
@@ -61,7 +65,7 @@ void estimatePage::okButtonPushed()
    m_aButtonPushed = true;
    this->hide();
    QString cmd;
-   QTextStream(&cmd) << "estimate" <<
+   QTextStream(&cmd) << "estimate" << 
       " job=\"" << jobCombo->currentText() << "\"" <<
       " fileset=\"" << filesetCombo->currentText() << "\"" <<
       " level=\"" << levelCombo->currentText() << "\"" <<
@@ -74,7 +78,7 @@ void estimatePage::okButtonPushed()
       Pmsg1(000, "command : %s\n", cmd.toUtf8().data());
    }
 
-   consoleCommand(cmd, m_conn);
+   consoleCommand(cmd, m_conn, true, true);
    m_console->notify(m_conn, true);
    closeStackPage();
    mainWin->resetFocus();
diff --git a/src/qt-console/run/prune.cpp b/src/qt-console/run/prune.cpp
index 2836312..94e08c7 100644
--- a/src/qt-console/run/prune.cpp
+++ b/src/qt-console/run/prune.cpp
@@ -1,26 +1,30 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2009 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
 
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
+ 
 /*
  *  Run Dialog class
  *
  *   Kern Sibbald, February MMVII
  *
  *  $Id$
- */
+ */ 
 
 #include "bat.h"
 #include "run.h"
diff --git a/src/qt-console/run/run.cpp b/src/qt-console/run/run.cpp
index d7585ae..a86f526 100644
--- a/src/qt-console/run/run.cpp
+++ b/src/qt-console/run/run.cpp
@@ -1,25 +1,29 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2011 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
 
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
+ 
 /*
  *  Run Dialog class
  *
  *   Kern Sibbald, February MMVII
  *
- */
+ */ 
 
 #include "bat.h"
 #include "run.h"
@@ -41,7 +45,7 @@ runPage::runPage(const QString &defJob) : Pages()
 }
 
 
-runPage::runPage(const QString &defJob, const QString &level,
+runPage::runPage(const QString &defJob, const QString &level, 
                  const QString &pool, const QString &storage,
                  const QString &client, const QString &fileset)
    : Pages()
@@ -57,7 +61,7 @@ runPage::runPage(const QString &defJob, const QString &level,
    poolCombo->setCurrentIndex(poolCombo->findText(pool, Qt::MatchExactly));
 
    if (storage != "") {         // TODO: enable storage
-      storageCombo->setCurrentIndex(storageCombo->findText(storage,
+      storageCombo->setCurrentIndex(storageCombo->findText(storage, 
                                                            Qt::MatchExactly));
    }
    show();
@@ -70,7 +74,7 @@ runPage::runPage(const QString &defJob, const QString &level,
 void runPage::init()
 {
    QDateTime dt;
-   QDesktopWidget *desk = QApplication::desktop();
+   QDesktopWidget *desk = QApplication::desktop(); 
    QRect scrn;
 
    m_name = tr("Run");
@@ -114,7 +118,7 @@ void runPage::okButtonPushed()
 {
    this->hide();
    QString cmd;
-   QTextStream(&cmd) << "run" <<
+   QTextStream(&cmd) << "run" << 
       " job=\"" << jobCombo->currentText() << "\"" <<
       " fileset=\"" << filesetCombo->currentText() << "\"" <<
       " level=\"" << levelCombo->currentText() << "\"" <<
@@ -129,7 +133,7 @@ void runPage::okButtonPushed()
       * with a  job */
 #endif
    if (bootstrap->text() != "") {
-      cmd += " bootstrap=\"" + bootstrap->text() + "\"";
+      cmd += " bootstrap=\"" + bootstrap->text() + "\""; 
    }
    cmd += " yes";
 
diff --git a/src/qt-console/run/run.h b/src/qt-console/run/run.h
index 4838d4a..59d037b 100644
--- a/src/qt-console/run/run.h
+++ b/src/qt-console/run/run.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 
 #ifndef _RUN_H_
@@ -26,14 +30,14 @@
 
 class runPage : public Pages, public Ui::runForm
 {
-   Q_OBJECT
+   Q_OBJECT 
 
 public:
    runPage();
 
    runPage(const QString &defJob);
 
-   runPage(const QString &defJob,
+   runPage(const QString &defJob, 
            const QString &level,
            const QString &pool,
            const QString &storage,
@@ -52,7 +56,7 @@ private:
 
 class runCmdPage : public Pages, public Ui::runCmdForm
 {
-   Q_OBJECT
+   Q_OBJECT 
 
 public:
    runCmdPage(int conn);
@@ -68,7 +72,7 @@ private:
 
 class estimatePage : public Pages, public Ui::estimateForm
 {
-   Q_OBJECT
+   Q_OBJECT 
 
 public:
    estimatePage();
@@ -85,7 +89,7 @@ private:
 
 class prunePage : public Pages, public Ui::pruneForm
 {
-   Q_OBJECT
+   Q_OBJECT 
 
 public:
    prunePage(const QString &volume, const QString &client);
diff --git a/src/qt-console/run/runcmd.cpp b/src/qt-console/run/runcmd.cpp
index e9369ca..6ce39ce 100644
--- a/src/qt-console/run/runcmd.cpp
+++ b/src/qt-console/run/runcmd.cpp
@@ -1,31 +1,35 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2010 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
 
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
+ 
 /*
  *  Run Command Dialog class
  *
  *  This is called when a Run Command signal is received from the
- *    Director. We parse the Director's output and throw up a
+ *    Director. We parse the Director's output and throw up a 
  *    dialog box.  This happens, for example, after the user finishes
  *    selecting files to be restored. The Director will then submit a
  *    run command, that causes this page to be popped up.
  *
  *   Kern Sibbald, March MMVII
  *
- */
+ */ 
 
 #include "bat.h"
 #include "run.h"
@@ -44,7 +48,6 @@ runCmdPage::runCmdPage(int conn) : Pages()
    m_console->notify(conn, false);
 
    fill();
-   m_console->discardToPrompt(m_conn);
 
    connect(okButton, SIGNAL(pressed()), this, SLOT(okButtonPushed()));
    connect(cancelButton, SIGNAL(pressed()), this, SLOT(cancelButtonPushed()));
@@ -62,7 +65,7 @@ void runCmdPage::fill()
 
    clientCombo->addItems(m_console->client_list);
    filesetCombo->addItems(m_console->fileset_list);
-   replaceCombo->addItems(QStringList() << tr("never") << tr("always") << tr("ifnewer")
+   replaceCombo->addItems(QStringList() << tr("never") << tr("always") << tr("ifnewer") 
         << tr("ifolder"));
    replaceCombo->setCurrentIndex(replaceCombo->findText(tr("never"), Qt::MatchExactly));
    storageCombo->addItems(m_console->storage_list);
@@ -115,7 +118,7 @@ void runCmdPage::fill()
       if (item.startsWith("Priority:")) {
          bool okay;
          int pri = val.toInt(&okay, 10);
-         if (okay)
+         if (okay) 
             prioritySpin->setValue(pri);
          continue;
       }
@@ -142,7 +145,7 @@ void runCmdPage::okButtonPushed()
    QTextStream(&pri) << " priority=\"" << prioritySpin->value() << "\"";
    cmd += pri;
    cmd += " yes\n";
-
+   
    setConsoleCurrent();
    QString displayhtml("<font color=\"blue\">");
    displayhtml += cmd + "</font>\n";
@@ -159,12 +162,11 @@ void runCmdPage::okButtonPushed()
 
 void runCmdPage::cancelButtonPushed()
 {
-   m_console->displayToPrompt(m_conn);
-   m_console->write_dir(".");
-   m_console->displayToPrompt(m_conn);
-   mainWin->set_status(tr(" Canceled"));
    this->hide();
+   m_console->write_dir(m_conn, "no");
+   m_console->displayToPrompt(m_conn);
    m_console->notify(m_conn, true);
+   mainWin->set_status(tr(" Canceled"));
    closeStackPage();
    mainWin->resetFocus();
 }
diff --git a/src/qt-console/select/select.cpp b/src/qt-console/select/select.cpp
index 9184581..8d628de 100644
--- a/src/qt-console/select/select.cpp
+++ b/src/qt-console/select/select.cpp
@@ -1,25 +1,29 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2010 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
 
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
+ 
 /*
  *  Select dialog class
  *
  *   Kern Sibbald, March MMVII
  *
- */
+ */ 
 
 #include "bat.h"
 #include "select.h"
diff --git a/src/qt-console/select/select.h b/src/qt-console/select/select.h
index fdeee45..a4377fc 100644
--- a/src/qt-console/select/select.h
+++ b/src/qt-console/select/select.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 
 #ifndef _SELECT_H_
@@ -23,7 +27,7 @@
 
 class selectDialog : public QDialog, public Ui::selectForm
 {
-   Q_OBJECT
+   Q_OBJECT 
 
 public:
    selectDialog(Console *console, int conn);
@@ -41,7 +45,7 @@ private:
 
 class yesnoPopUp : public QDialog
 {
-   Q_OBJECT
+   Q_OBJECT 
 
 public:
    yesnoPopUp(Console *console, int conn);
diff --git a/src/qt-console/select/textinput.cpp b/src/qt-console/select/textinput.cpp
index a085bce..691f646 100644
--- a/src/qt-console/select/textinput.cpp
+++ b/src/qt-console/select/textinput.cpp
@@ -1,25 +1,29 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2010 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
 
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
+ 
 /*
  *  Select dialog class
  *
  *   Kern Sibbald, March MMVII
  *
- */
+ */ 
 
 #include "bat.h"
 #include "textinput.h"
@@ -27,7 +31,7 @@
 /*
  * Read input text box
  */
-textInputDialog::textInputDialog(Console *console, int conn)
+textInputDialog::textInputDialog(Console *console, int conn) 
 {
    m_conn = conn;
    QDateTime dt;
diff --git a/src/qt-console/select/textinput.h b/src/qt-console/select/textinput.h
index cfbcf07..83fb93e 100644
--- a/src/qt-console/select/textinput.h
+++ b/src/qt-console/select/textinput.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 
 #ifndef _TEXTENTRY_H_
@@ -23,7 +27,7 @@
 
 class textInputDialog : public QDialog, public Ui::textInputForm
 {
-   Q_OBJECT
+   Q_OBJECT 
 
 public:
    textInputDialog(Console *console, int conn);
diff --git a/src/qt-console/status/clientstat.cpp b/src/qt-console/status/clientstat.cpp
index 4096830..97393a9 100644
--- a/src/qt-console/status/clientstat.cpp
+++ b/src/qt-console/status/clientstat.cpp
@@ -1,22 +1,26 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2010 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *   Dirk Bartley, March 2007
  */
-
+ 
 #include "bat.h"
 #include <QAbstractEventDispatcher>
 #include <QTableWidgetItem>
diff --git a/src/qt-console/status/clientstat.h b/src/qt-console/status/clientstat.h
index 2c4c88d..f88dfa9 100644
--- a/src/qt-console/status/clientstat.h
+++ b/src/qt-console/status/clientstat.h
@@ -1,23 +1,25 @@
 #ifndef _CLIENTSTAT_H_
 #define _CLIENTSTAT_H_
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
- *   Version $Id: clientstat.h 5372 2007-08-17 12:17:04Z kerns $
- *
  *   Dirk Bartley, March 2007
  */
 
@@ -28,7 +30,7 @@
 
 class ClientStat : public Pages, public Ui::ClientStatForm
 {
-   Q_OBJECT
+   Q_OBJECT 
 
 public:
    ClientStat(QString&, QTreeWidgetItem*);
diff --git a/src/qt-console/status/dirstat.cpp b/src/qt-console/status/dirstat.cpp
index 4190de6..1747f4c 100644
--- a/src/qt-console/status/dirstat.cpp
+++ b/src/qt-console/status/dirstat.cpp
@@ -1,23 +1,27 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2010 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
  *   Dirk Bartley, March 2007
  */
-
+ 
 #include "bat.h"
 #include <QAbstractEventDispatcher>
 #include <QTableWidgetItem>
@@ -131,10 +135,10 @@ void DirStat::populateTerminated()
    terminatedTable->clear();
    QStringList headerlist = (QStringList()
       << tr("Job Id") << tr("Job Level") << tr("Job Files")
-      << tr("Job Bytes") << tr("Job Status") << tr("Job Time")
+      << tr("Job Bytes") << tr("Job Status") << tr("Job Time") 
       << tr("Job Name"));
    QStringList flaglist = (QStringList()
-      << "R" << "L" << "R" << "R" << "LC"
+      << "R" << "L" << "R" << "R" << "LC" 
       << "L" << "L");
 
    terminatedTable->setColumnCount(headerlist.size());
@@ -187,7 +191,7 @@ void DirStat::populateScheduled()
 
    scheduledTable->clear();
    QStringList headerlist = (QStringList()
-      << tr("Job Level") << tr("Job Type") << tr("Priority") << tr("Job Time")
+      << tr("Job Level") << tr("Job Type") << tr("Priority") << tr("Job Time") 
       << tr("Job Name") << tr("Volume"));
    QStringList flaglist = (QStringList()
       << "L" << "L" << "R" << "L" << "L" << "L");
diff --git a/src/qt-console/status/dirstat.h b/src/qt-console/status/dirstat.h
index 501ccf4..c83c918 100644
--- a/src/qt-console/status/dirstat.h
+++ b/src/qt-console/status/dirstat.h
@@ -1,23 +1,25 @@
 #ifndef _DIRSTAT_H_
 #define _DIRSTAT_H_
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
- *   Version $Id: dirstat.h 5372 2007-08-17 12:17:04Z kerns $
- *
  *   Dirk Bartley, March 2007
  */
 
@@ -28,7 +30,7 @@
 
 class DirStat : public Pages, public Ui::DirStatForm
 {
-   Q_OBJECT
+   Q_OBJECT 
 
 public:
    DirStat();
diff --git a/src/qt-console/status/storstat.cpp b/src/qt-console/status/storstat.cpp
index 59bca70..86eff95 100644
--- a/src/qt-console/status/storstat.cpp
+++ b/src/qt-console/status/storstat.cpp
@@ -1,23 +1,27 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2010 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
  *   Dirk Bartley, March 2007
  */
-
+ 
 #include "bat.h"
 #include <QAbstractEventDispatcher>
 #include <QTableWidgetItem>
@@ -29,7 +33,7 @@ static bool working = false;     /* prevent timer recursion */
 
 /*
 .status storage=<storage-name> <keyword>
-where <storage-name> is the storage name in the Director, and
+where <storage-name> is the storage name in the Director, and 
 <keyword> is one of the following:
 header
 running
@@ -228,10 +232,10 @@ void StorStat::populateTerminated()
    terminatedTable->clear();
    QStringList headerlist = (QStringList()
       << tr("Job Id") << tr("Job Level") << tr("Job Files")
-      << tr("Job Bytes") << tr("Job Status") << tr("Job Time")
+      << tr("Job Bytes") << tr("Job Status") << tr("Job Time") 
       << tr("Job Name"));
    QStringList flaglist = (QStringList()
-      << "R" << "L" << "R" << "R" << "LC"
+      << "R" << "L" << "R" << "R" << "LC" 
       << "L" << "L");
 
    terminatedTable->setColumnCount(headerlist.size());
@@ -437,4 +441,4 @@ void StorStat::releaseButtonPushed()
 void StorStat::labelButtonPushed()
 {
    new labelPage(m_storage);
-}
+}  
diff --git a/src/qt-console/status/storstat.h b/src/qt-console/status/storstat.h
index 66cd155..55bd74a 100644
--- a/src/qt-console/status/storstat.h
+++ b/src/qt-console/status/storstat.h
@@ -1,23 +1,25 @@
 #ifndef _STORSTAT_H_
 #define _STORSTAT_H_
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
- *   Version $Id: dirstat.h 5372 2007-08-17 12:17:04Z kerns $
- *
  *   Dirk Bartley, March 2007
  */
 
@@ -28,7 +30,7 @@
 
 class StorStat : public Pages, public Ui::StorStatForm
 {
-   Q_OBJECT
+   Q_OBJECT 
 
 public:
    StorStat(QString &, QTreeWidgetItem *);
diff --git a/src/qt-console/storage/content.cpp b/src/qt-console/storage/content.cpp
index a41f873..fe3acf7 100644
--- a/src/qt-console/storage/content.cpp
+++ b/src/qt-console/storage/content.cpp
@@ -1,19 +1,23 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2009 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
 
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
+ 
 #include "bat.h"
 #include <QAbstractEventDispatcher>
 #include <QMenu>
@@ -24,11 +28,11 @@
 #include "util/fmtwidgetitem.h"
 #include "status/storstat.h"
 
-//
+// 
 // TODO: List tray
 //       List drives in autochanger
 //       use user selection to add slot= argument
-//
+// 
 
 Content::Content(QString storage, QTreeWidgetItem *parentWidget) : Pages()
 {
@@ -91,8 +95,12 @@ void table_get_selection(QTableWidget *table, QString &sel)
     * We take only one instance
     */
    int s = table->rowCount();
+   if (s == 0) {
+      /* No selection?? */
+      return;
+   }
    bool *tab = (bool *)malloc(s * sizeof(bool));
-   memset(tab, 0, s);
+   memset(tab, 0, s); 
 
    foreach (item, table->selectedItems()) {
       current = item->row();
@@ -161,7 +169,7 @@ void Content::statusStorageWindow()
 }
 
 /*
- * The main meat of the class!!  The function that querries the director and
+ * The main meat of the class!!  The function that querries the director and 
  * creates the widgets with appropriate values.
  */
 void Content::populateContent()
@@ -212,33 +220,33 @@ void Content::populateContent()
       }
 
       /* Slot */
-      slotitem.setNumericFld(index++, fld.next());
+      slotitem.setNumericFld(index++, fld.next()); 
 
       /* Real Slot */
       if (fld.next() != "") {
 
          /* Volume */
          slotitem.setTextFld(index++, fld.next());
-
+         
          /* Bytes */
          slotitem.setBytesFld(index++, fld.next());
-
+         
          /* Status */
          slotitem.setVolStatusFld(index++, fld.next());
-
+         
          /* MediaType */
          slotitem.setTextFld(index++, fld.next());
-
+         
          /* Pool */
          slotitem.setTextFld(index++, fld.next());
-
+         
          tim = fld.next().toInt();
          if (tim > 0) {
             /* LastW */
             localtime_r(&tim, &tm);
             strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", &tm);
             slotitem.setTextFld(index++, QString(buf));
-
+            
             /* Expire */
             tim = fld.next().toInt();
             localtime_r(&tim, &tm);
@@ -249,6 +257,7 @@ void Content::populateContent()
       row++;
    }
 
+
    tableContent->verticalHeader()->hide();
    tableContent->sortByColumn(0, Qt::AscendingOrder);
    tableContent->setSortingEnabled(true);
@@ -262,17 +271,16 @@ void Content::populateContent()
    tableTray->setEditTriggers(QAbstractItemView::NoEditTriggers);
 
    tableDrive->verticalHeader()->hide();
+   /* Get count of rows needed (Drives) */
    QStringList drives = results_all.filter(QRegExp("^D\\|[0-9]+\\|"));
+   /* Ensure we have sufficient rows for Drive display */
    tableDrive->setRowCount(drives.size());
-
    row = 0;
    foreach (resultline, drives) {
       fieldlist = resultline.split("|");
       if (fieldlist.size() < 4) {
-         Pmsg1(0, "Discarding %s\n", resultline.data());
          continue; /* some fields missing, ignore row */
       }
-
       int index=0;
       QStringListIterator fld(fieldlist);
       TableItemFormatter slotitem(*tableDrive, row);
@@ -281,14 +289,14 @@ void Content::populateContent()
       fld.next();
 
       /* Number */
-      slotitem.setNumericFld(index++, fld.next());
+      slotitem.setNumericFld(index++, fld.next()); 
 
       /* Slot */
       fld.next();
-
+      
       /* Volume */
       slotitem.setTextFld(index++, fld.next());
-
+         
       row++;
    }
 
@@ -316,7 +324,7 @@ void Content::consoleUpdateSlots()
 {
    QString sel = "";
    table_get_selection(tableContent, sel);
-
+   
    QString cmd("update slots");
    if (sel != "") {
       cmd += sel;
diff --git a/src/qt-console/storage/content.h b/src/qt-console/storage/content.h
index 9f86c5d..854cb55 100644
--- a/src/qt-console/storage/content.h
+++ b/src/qt-console/storage/content.h
@@ -1,19 +1,23 @@
 #ifndef _CONTENT_H_
 #define _CONTENT_H_
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 
 #include <QtGui>
@@ -23,7 +27,7 @@
 
 class Content : public Pages, public Ui::ContentForm
 {
-   Q_OBJECT
+   Q_OBJECT 
 
 public:
    Content(QString storage, QTreeWidgetItem *parentWidget);
diff --git a/src/qt-console/storage/storage.cpp b/src/qt-console/storage/storage.cpp
index da61da6..9f5dc22 100644
--- a/src/qt-console/storage/storage.cpp
+++ b/src/qt-console/storage/storage.cpp
@@ -1,26 +1,30 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2010 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
 
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
+ 
 /*
  *
  *  Storage Class
  *
  *   Dirk Bartley, March 2007
  *
- */
+ */ 
 
 #include "bat.h"
 #include <QAbstractEventDispatcher>
@@ -57,7 +61,7 @@ Storage::~Storage()
 }
 
 /*
- * The main meat of the class!!  The function that querries the director and
+ * The main meat of the class!!  The function that querries the director and 
  * creates the widgets with appropriate values.
  */
 void Storage::populateTree()
@@ -73,7 +77,7 @@ void Storage::populateTree()
    m_checkcurwidget = true;
 
    QStringList headerlist = (QStringList() << tr("Name") << tr("Id")
-        << tr("Changer") << tr("Slot") << tr("Status") << tr("Enabled") << tr("Pool")
+        << tr("Changer") << tr("Slot") << tr("Status") << tr("Enabled") << tr("Pool") 
         << tr("Media Type") );
 
    m_topItem = new QTreeWidgetItem(mp_treeWidget);
@@ -119,6 +123,10 @@ void Storage::populateTree()
          QStringList fieldlist;
          foreach (QString resultline, results) {
             fieldlist = resultline.split("\t");
+            if (fieldlist.size() != 3) {
+               Pmsg1(000, "Unexpected line %s", resultline.toUtf8().data());
+               continue;
+            }
             storageName = fieldlist.takeFirst();
             if (m_firstpopulation) {
                settingsOpenStatus(storageName);
@@ -132,9 +140,9 @@ void Storage::populateTree()
 
             int index = 1;
             QStringListIterator fld(fieldlist);
-
+ 
             /* storage id */
-            storageItem.setNumericFld(index++, fld.next());
+            storageItem.setNumericFld(index++, fld.next() );
 
             /* changer */
             QString changer = fld.next();
@@ -159,7 +167,7 @@ void Storage::mediaList(QTreeWidgetItem *parent, const QString &storageID)
 {
    QString query("SELECT Media.VolumeName AS Media, Media.Slot AS Slot,"
                  " Media.VolStatus AS VolStatus, Media.Enabled AS Enabled,"
-                 " Pool.Name AS MediaPool, Media.MediaType AS MediaType"
+                 " Pool.Name AS MediaPool, Media.MediaType AS MediaType" 
                  " From Media"
                  " JOIN Pool ON (Media.PoolId=Pool.PoolId)"
                  " WHERE Media.StorageId='" + storageID + "'"
@@ -175,11 +183,11 @@ void Storage::mediaList(QTreeWidgetItem *parent, const QString &storageID)
       QString resultline;
       QString field;
       QStringList fieldlist;
-
+ 
       foreach (resultline, results) {
          fieldlist = resultline.split("\t");
          if (fieldlist.size() < 6)
-             continue;
+             continue; 
 
          /* Iterate through fields in the record */
          QStringListIterator fld(fieldlist);
@@ -187,8 +195,8 @@ void Storage::mediaList(QTreeWidgetItem *parent, const QString &storageID)
          TreeItemFormatter fmt(*parent, 2);
 
          /* volname */
-         fmt.setTextFld(index++, fld.next());
-
+         fmt.setTextFld(index++, fld.next()); 
+ 
          /* skip the next two columns, unused by media */
          index += 2;
 
@@ -199,13 +207,13 @@ void Storage::mediaList(QTreeWidgetItem *parent, const QString &storageID)
          fmt.setVolStatusFld(index++, fld.next());
 
          /* enabled */
-         fmt.setBoolFld(index++, fld.next());
+         fmt.setBoolFld(index++, fld.next()); 
 
          /* pool */
-         fmt.setTextFld(index++, fld.next());
+         fmt.setTextFld(index++, fld.next()); 
 
          /* media type */
-         fmt.setTextFld(index++, fld.next());
+         fmt.setTextFld(index++, fld.next()); 
 
       }
    }
@@ -285,8 +293,8 @@ void Storage::treeItemChanged(QTreeWidgetItem *currentwidgetitem, QTreeWidgetIte
    }
 }
 
-/*
- * Setup a context menu
+/* 
+ * Setup a context menu 
  * Made separate from populate so that it would not create context menu over and
  * over as the tree is repopulated.
  */
@@ -323,7 +331,7 @@ void Storage::createContextMenu()
 
 void Storage::contentWindow()
 {
-   if (m_currentStorage != "" && m_currentAutoChanger) {
+   if (m_currentStorage != "" && m_currentAutoChanger) { 
       QTreeWidgetItem *parentItem = mainWin->getFromHash(this);
       new Content(m_currentStorage, parentItem);
    }
diff --git a/src/qt-console/storage/storage.h b/src/qt-console/storage/storage.h
index 2eee355..7ff77e6 100644
--- a/src/qt-console/storage/storage.h
+++ b/src/qt-console/storage/storage.h
@@ -1,23 +1,25 @@
 #ifndef _STORAGE_H_
 #define _STORAGE_H_
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
- *   Version $Id$
- *
  *   Dirk Bartley, March 2007
  */
 
@@ -28,7 +30,7 @@
 
 class Storage : public Pages, public Ui::StorageForm
 {
-   Q_OBJECT
+   Q_OBJECT 
 
 public:
    Storage();
diff --git a/src/qt-console/tray-monitor/authenticate.cpp b/src/qt-console/tray-monitor/authenticate.cpp
index 22688b1..16f78dd 100644
--- a/src/qt-console/tray-monitor/authenticate.cpp
+++ b/src/qt-console/tray-monitor/authenticate.cpp
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2004-2014 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2004-2013 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -26,8 +30,8 @@
  *
  */
 
+#include "winhdrs.h"
 #include "tray-monitor.h"
-#include "jcr.h"
 
 void senditf(const char *fmt, ...);
 void sendit(const char *buf);
@@ -74,7 +78,7 @@ int authenticate_director(JCR *jcr, MONITOR *mon, DIRRES *director)
       stop_bsock_timer(tid);
       Jmsg0(jcr, M_FATAL, 0, _("Director authorization problem.\n"
             "Most likely the passwords do not agree.\n"
-       "Please see " MANUAL_AUTH_URL " for help.\n"));
+       "For help, please see " MANUAL_AUTH_URL "\n"));
       return 0;
    }
 
@@ -123,7 +127,7 @@ int authenticate_storage_daemon(JCR *jcr, MONITOR *monitor, STORE* store)
        !cram_md5_challenge(sd, store->password, tls_local_need, compatible)) {
       stop_bsock_timer(tid);
       Jmsg0(jcr, M_FATAL, 0, _("Director and Storage daemon passwords or names not the same.\n"
-       "Please see " MANUAL_AUTH_URL " for help.\n"));
+       "For help, please see " MANUAL_AUTH_URL "\n"));
       return 0;
    }
    Dmsg1(116, ">stored: %s", sd->msg);
@@ -169,7 +173,7 @@ int authenticate_file_daemon(JCR *jcr, MONITOR *monitor, CLIENT* client)
        !cram_md5_challenge(fd, client->password, tls_local_need, compatible)) {
       stop_bsock_timer(tid);
       Jmsg(jcr, M_FATAL, 0, _("Director and File daemon passwords or names not the same.\n"
-       "Please see " MANUAL_AUTH_URL " for help.\n"));
+       "For help, please see " MANUAL_AUTH_URL "\n"));
       return 0;
    }
    Dmsg1(116, ">filed: %s", fd->msg);
diff --git a/src/qt-console/tray-monitor/tray-monitor.cpp b/src/qt-console/tray-monitor/tray-monitor.cpp
index ed69d10..590a1c0 100644
--- a/src/qt-console/tray-monitor/tray-monitor.cpp
+++ b/src/qt-console/tray-monitor/tray-monitor.cpp
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2004-2014 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2004-2013 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 
 #include "tray-ui.h"
@@ -141,11 +145,13 @@ int main(int argc, char *argv[])
    init_msg(NULL, NULL, NULL);
    working_directory = "/tmp";
 
+#ifndef HAVE_WIN32
    struct sigaction sigignore;
    sigignore.sa_flags = 0;
    sigignore.sa_handler = SIG_IGN;
    sigfillset(&sigignore.sa_mask);
    sigaction(SIGPIPE, &sigignore, NULL);
+#endif
 
    while ((ch = getopt(argc, argv, "bc:d:th?f:s:")) != -1) {
       switch (ch) {
@@ -444,7 +450,7 @@ int docmd(monitoritem* item, const char* command)
             item->D_sock->signal(BNET_HB_RESPONSE);
          }
          else {
-            qDebug() << bnet_sig_to_ascii(item->D_sock);
+            qDebug() << bnet_sig_to_ascii(item->D_sock->msglen);
          }
       }
       else { /* BNET_HARDEOF || BNET_ERROR */
diff --git a/src/qt-console/tray-monitor/tray-monitor.h b/src/qt-console/tray-monitor/tray-monitor.h
index 33f111b..0e03420 100644
--- a/src/qt-console/tray-monitor/tray-monitor.h
+++ b/src/qt-console/tray-monitor/tray-monitor.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2004-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Includes specific to the tray monitor
@@ -117,7 +121,7 @@ public:
          /* Pointer to default value */
          *def++ = 0;
          strip_trailing_junk(def);
-
+         
          if (strcmp(dircomm->msg, "job") == 0) {
             if (strcmp(def, job_defs.job_name.toUtf8().data()) != 0) {
                goto bail_out;
diff --git a/src/qt-console/tray-monitor/tray-monitor.pro.in b/src/qt-console/tray-monitor/tray-monitor.pro.in
index 5a37f7d..924267c 100644
--- a/src/qt-console/tray-monitor/tray-monitor.pro.in
+++ b/src/qt-console/tray-monitor/tray-monitor.pro.in
@@ -32,7 +32,7 @@ LIBTOOL_LINK = @QMAKE_LIBTOOL@ --silent --tag=CXX --mode=link
 LIBTOOL_INSTALL = @QMAKE_LIBTOOL@ --silent --mode=install
 QMAKE_LINK   = $${LIBTOOL_LINK} $(CXX)
 QMAKE_INSTALL_PROGRAM = $${LIBTOOL_INSTALL} install -m @SBINPERM@ -p
-QMAKE_CLEAN += .libs/* bacula-tray-monitor release/bacula-tray-monitor
+QMAKE_CLEAN += obj/* .libs/* bacula-tray-monitor release/bacula-tray-monitor
 
 RESOURCES    = ../main.qrc
 MOC_DIR      = moc
diff --git a/src/qt-console/tray-monitor/tray-monitor.pro.in b/src/qt-console/tray-monitor/tray-monitor.pro.mingw32.in
similarity index 58%
copy from src/qt-console/tray-monitor/tray-monitor.pro.in
copy to src/qt-console/tray-monitor/tray-monitor.pro.mingw32.in
index 5a37f7d..cb212b2 100644
--- a/src/qt-console/tray-monitor/tray-monitor.pro.in
+++ b/src/qt-console/tray-monitor/tray-monitor.pro.mingw32.in
@@ -2,7 +2,7 @@
 #
 #  !!!!!!! IMPORTANT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 #
-#  Edit only tray-monitor.pro.in  -- tray-monitor.pro is built by the ./configure program
+#  Edit only tray-monitor.pro.mingw32.in  -- tray-monitor.pro.mingw32 is built by the ./configure program
 #
 #  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 #    
@@ -34,10 +34,19 @@ QMAKE_LINK   = $${LIBTOOL_LINK} $(CXX)
 QMAKE_INSTALL_PROGRAM = $${LIBTOOL_INSTALL} install -m @SBINPERM@ -p
 QMAKE_CLEAN += .libs/* bacula-tray-monitor release/bacula-tray-monitor
 
-RESOURCES    = ../main.qrc
-MOC_DIR      = moc
-OBJECTS_DIR  = obj
-UI_DIR       = ui
+RESOURCES               = ../main.qrc
+MOC_DIR                 = moc32
+OBJECTS_DIR             = obj32
+UI_DIR                  = ui32
+QMAKE_CC                = i686-w64-mingw32-gcc
+QMAKE_CXX               = i686-w64-mingw32-g++
+QMAKE_INCDIR            = $(DEPKGS)/depkgs-mingw32/include/pthreads $(DEPKGS)/depkgs-mingw32/include/ ../win32/compat 
+QMAKE_INCDIR_QT         = $(DEPKGS)/depkgs-mingw32/include/qt
+QMAKE_LIBDIR_QT         = $(DEPKGS)/depkgs-mingw32/lib/qt
+QMAKE_LINK              = i686-w64-mingw32-g++
+QMAKE_LFLAGS            = -mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import  -m32 -fno-strict-aliasing -Wl,-enable-runtime-pseudo-reloc
+QMAKE_LIB               = i686-w64-mingw32-ar -ru
+QMAKE_RC                = i686-w64-mingw32-windres
 
 # Main directory
 HEADERS += tray_conf.h  tray-monitor.h  tray-ui.h 
diff --git a/src/qt-console/tray-monitor/tray-monitor.pro.in b/src/qt-console/tray-monitor/tray-monitor.pro.mingw64.in
similarity index 55%
copy from src/qt-console/tray-monitor/tray-monitor.pro.in
copy to src/qt-console/tray-monitor/tray-monitor.pro.mingw64.in
index 5a37f7d..a52c640 100644
--- a/src/qt-console/tray-monitor/tray-monitor.pro.in
+++ b/src/qt-console/tray-monitor/tray-monitor.pro.mingw64.in
@@ -2,7 +2,7 @@
 #
 #  !!!!!!! IMPORTANT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 #
-#  Edit only tray-monitor.pro.in  -- tray-monitor.pro is built by the ./configure program
+#  Edit only tray-monitor.pro.mingw64.in  -- tray-monitor.pro.mingw64 is built by the ./configure program
 #
 #  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 #    
@@ -11,7 +11,7 @@ CONFIG += qt
 #CONFIG += qt debug 
 
 cross-win32 {
-  LIBS       +=  -mwindows -L../../win32/release32 -lbacula
+  LIBS       +=  -mwindows -L../../win32/release64 -lbacula
   INCLUDEPATH += ../../win32/compat
 }
 !cross-win32 {
@@ -34,10 +34,19 @@ QMAKE_LINK   = $${LIBTOOL_LINK} $(CXX)
 QMAKE_INSTALL_PROGRAM = $${LIBTOOL_INSTALL} install -m @SBINPERM@ -p
 QMAKE_CLEAN += .libs/* bacula-tray-monitor release/bacula-tray-monitor
 
-RESOURCES    = ../main.qrc
-MOC_DIR      = moc
-OBJECTS_DIR  = obj
-UI_DIR       = ui
+RESOURCES               = ../main.qrc
+MOC_DIR                 = moc64
+OBJECTS_DIR             = obj64
+UI_DIR                  = ui64
+QMAKE_CC                = x86_64-w64-mingw32-gcc
+QMAKE_CXX               = x86_64-w64-mingw32-g++
+QMAKE_INCDIR            = $(DEPKGS)/depkgs-mingw-w64/include/pthreads $(DEPKGS)/depkgs-mingw-w64/include/ ../win32/compat 
+QMAKE_INCDIR_QT         = $(DEPKGS)/depkgs-mingw-w64/include/qt
+QMAKE_LIBDIR_QT         = $(DEPKGS)/depkgs-mingw-w64/lib/qt
+QMAKE_LINK              = x86_64-w64-mingw32-g++
+QMAKE_LFLAGS            = -mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import  -m64 -fno-strict-aliasing -Wl,-enable-runtime-pseudo-reloc
+QMAKE_LIB               = x86_64-w64-mingw32-ar -ru
+QMAKE_RC                = x86_64-w64-mingw32-windres
 
 # Main directory
 HEADERS += tray_conf.h  tray-monitor.h  tray-ui.h 
diff --git a/src/qt-console/tray-monitor/tray-ui.h b/src/qt-console/tray-monitor/tray-ui.h
index d008405..e4e5dfc 100644
--- a/src/qt-console/tray-monitor/tray-ui.h
+++ b/src/qt-console/tray-monitor/tray-ui.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2011-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 
 #ifndef TRAYUI_H
@@ -23,6 +27,7 @@
 # endif
 #endif
 
+#include "winhdrs.h"
 #include <QAction>
 #include <QApplication>
 #include <QButtonGroup>
@@ -45,7 +50,7 @@
 #include <QFont>
 
 #include "version.h"
-#include "ui/ui_run.h"
+#include "ui_run.h"
 #include "tray-monitor.h"
 
 class RunDlg: public QDialog, public Ui::runForm
@@ -70,7 +75,7 @@ public:
 
       qDebug() << "start getting elements";
       get_list(item, ".jobs type=B", res.job_list);
-
+      
       if (res.job_list.length() == 0) {
          QMessageBox msgBox;
          msgBox.setText("This restricted console doesn't have access to Backup jobs");
@@ -192,7 +197,7 @@ public:
        return hash.value(QString(title));
     }
 
-    void clearText(char *title)
+    void clearText(char *title) 
     {
        QPlainTextEdit *w = getTextEdit(title);
        if (!w) {
@@ -201,7 +206,7 @@ public:
        w->clear();
     }
 
-    void appendText(char *title, char *line)
+    void appendText(char *title, char *line) 
     {
        QPlainTextEdit *w = getTextEdit(title);
        if (!w) {
@@ -244,7 +249,7 @@ public:
         director = NULL;
         if (TrayMonitor->objectName().isEmpty())
             TrayMonitor->setObjectName(QString::fromUtf8("TrayMonitor"));
-        TrayMonitor->setWindowIcon(QIcon(":/images/cartridge1.png"));
+        TrayMonitor->setWindowIcon(QIcon(":/images/cartridge1.png")); 
         TrayMonitor->resize(789, 595);
         centralwidget = new QWidget(TrayMonitor);
         centralwidget->setObjectName(QString::fromUtf8("centralwidget"));
@@ -306,7 +311,7 @@ public:
         stmenu->addAction(actAbout);
         stmenu->addSeparator();
         stmenu->addAction(actQuit);
-
+        
         connect(actRun, SIGNAL(triggered()), this, SLOT(cb_run()));
         connect(actShow, SIGNAL(triggered()), this, SLOT(cb_show()));
         connect(actQuit, SIGNAL(triggered()), this, SLOT(cb_quit()));
@@ -344,8 +349,8 @@ private slots:
     void cb_about() {
        QMessageBox::about(this, "Bacula Tray Monitor", "Bacula Tray Monitor\n"
                           "For more information, see: www.baculasystems.com\n"
-                          "Copyright (C) 1999-2010, Bacula Systems(R) SA\n"
-                          "Licensed under GNU AGPLv3.");
+                          "Copyright (C) 1999-2015, Kern Sibbald.\n"
+                          "License AGPLv3 see LICENSE.");
     }
 
     void cb_run() {
diff --git a/src/qt-console/tray-monitor/tray_conf.cpp b/src/qt-console/tray-monitor/tray_conf.cpp
index a6bbbf2..ed6643f 100644
--- a/src/qt-console/tray-monitor/tray_conf.cpp
+++ b/src/qt-console/tray-monitor/tray_conf.cpp
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2004-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
 *   Main configuration file parser for Bacula Tray Monitor.
diff --git a/src/qt-console/tray-monitor/tray_conf.h b/src/qt-console/tray-monitor/tray_conf.h
index a75a56e..38320a0 100644
--- a/src/qt-console/tray-monitor/tray_conf.h
+++ b/src/qt-console/tray-monitor/tray_conf.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2004-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Tray Monitor specific configuration and defines
diff --git a/src/qt-console/ts/bat_de.ts b/src/qt-console/ts/bat_de.ts
index 3cae1c9..b7d8241 100644
--- a/src/qt-console/ts/bat_de.ts
+++ b/src/qt-console/ts/bat_de.ts
@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE TS><TS version="1.1">
+<!DOCTYPE TS>
+<TS version="2.0">
 <context>
     <name>ClientForm</name>
     <message>
@@ -8,96 +9,181 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../clients/clients.ui" line="31"/>
+        <location filename="../clients/clients.ui" line="26"/>
         <source>Refresh Client List</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../clients/clients.ui" line="34"/>
+        <location filename="../clients/clients.ui" line="29"/>
         <source>Requery the director for the list of clients.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../clients/clients.ui" line="42"/>
+        <location filename="../clients/clients.ui" line="38"/>
         <source>List Jobs of Client</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../clients/clients.ui" line="45"/>
+        <location filename="../clients/clients.ui" line="41"/>
         <source>Open a joblist page selecting this client.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../clients/clients.ui" line="53"/>
-        <source>Status Client In Console</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../clients/clients.ui" line="56"/>
-        <source>Execute status client in console.</source>
+        <location filename="../clients/clients.ui" line="74"/>
+        <source>Status Client</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../clients/clients.ui" line="64"/>
+        <location filename="../clients/clients.ui" line="50"/>
         <source>Purge Jobs</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../clients/clients.ui" line="67"/>
+        <location filename="../clients/clients.ui" line="53"/>
         <source>Purge jobs peformed from this client.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../clients/clients.ui" line="75"/>
+        <location filename="../clients/clients.ui" line="62"/>
         <source>Prune Jobs</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../clients/clients.ui" line="78"/>
+        <location filename="../clients/clients.ui" line="65"/>
         <source>Open the diaolog to prune for this client.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
+    <name>ClientStat</name>
+    <message>
+        <location filename="../status/clientstat.cpp" line="37"/>
+        <source>Client Status %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/clientstat.cpp" line="143"/>
+        <source>Job Id</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/clientstat.cpp" line="143"/>
+        <source>Job Level</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/clientstat.cpp" line="143"/>
+        <source>Job Files</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/clientstat.cpp" line="144"/>
+        <source>Job Bytes</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/clientstat.cpp" line="144"/>
+        <source>Job Status</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/clientstat.cpp" line="144"/>
+        <source>Job Time</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/clientstat.cpp" line="145"/>
+        <source>Job Name</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>ClientStatForm</name>
+    <message>
+        <location filename="../status/clientstat.ui" line="13"/>
+        <source>Form</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/clientstat.ui" line="30"/>
+        <source>Running</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/clientstat.ui" line="40"/>
+        <source>Header</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/clientstat.ui" line="123"/>
+        <source>Refresh Timer</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/clientstat.ui" line="151"/>
+        <source>Do Refresh</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/clientstat.ui" line="176"/>
+        <source><html><head><meta name="qrichtext" content="1" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:13pt; font-weight:600;">Terminated Jobs</span></p></body></html></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/clientstat.ui" line="199"/>
+        <source>Refresh</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/clientstat.ui" line="207"/>
+        <source>Cancel Running Job</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>Clients</name>
     <message>
-        <location filename="../clients/clients.cpp" line="85"/>
+        <location filename="../clients/clients.cpp" line="38"/>
         <source>Clients</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../clients/clients.cpp" line="81"/>
+        <location filename="../clients/clients.cpp" line="68"/>
+        <location filename="../clients/clients.cpp" line="71"/>
         <source>Client Name</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../clients/clients.cpp" line="82"/>
+        <location filename="../clients/clients.cpp" line="68"/>
         <source>File Retention</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../clients/clients.cpp" line="82"/>
+        <location filename="../clients/clients.cpp" line="69"/>
         <source>Job Retention</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../clients/clients.cpp" line="82"/>
+        <location filename="../clients/clients.cpp" line="69"/>
         <source>AutoPrune</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../clients/clients.cpp" line="82"/>
+        <location filename="../clients/clients.cpp" line="69"/>
         <source>ClientId</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../clients/clients.cpp" line="82"/>
+        <location filename="../clients/clients.cpp" line="69"/>
         <source>Uname</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../clients/clients.cpp" line="257"/>
-        <source>Are you sure you want to purge ??  !!!.
+        <location filename="../clients/clients.cpp" line="283"/>
+        <source>Are you sure you want to purge all jobs of client "%1" ?
 The Purge command will delete associated Catalog database records from Jobs and Volumes without considering the retention period. Purge  works only on the Catalog database and does not affect data written to Volumes. This command can be dangerous because you can delete catalog records associated with current backups of files, and we recommend that you do not use it unless you know what you are doing.
 
  Is there any way I can get you to click Cancel here?  You really don't want to do this
@@ -105,6 +191,35 @@ The Purge command will delete associated Catalog database records from Jobs and
 Press OK to proceed with the purge operation?</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <location filename="../clients/clients.cpp" line="319"/>
+        <source>Client Status %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>Console</name>
+    <message>
+        <location filename="../console/console.cpp" line="33"/>
+        <source>Console</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../console/console.cpp" line="119"/>
+        <source>No Director found.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../console/console.cpp" line="375"/>
+        <source> Director not connected. Click on connect button.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../console/console.cpp" line="806"/>
+        <source>Director is currently disconnected
+Please reconnect!</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>ConsoleForm</name>
@@ -135,77 +250,214 @@ Press OK to proceed with the purge operation?</source>
     </message>
 </context>
 <context>
+    <name>Content</name>
+    <message>
+        <location filename="../storage/content.cpp" line="152"/>
+        <source>Storage Status %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>ContentForm</name>
+    <message>
+        <location filename="../storage/content.ui" line="13"/>
+        <source>Form</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/content.ui" line="33"/>
+        <source>Actions</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/content.ui" line="39"/>
+        <source>Update slots</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/content.ui" line="49"/>
+        <source>Label</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/content.ui" line="62"/>
+        <source>Move to tray</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/content.ui" line="75"/>
+        <source>Empty tray</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/content.ui" line="85"/>
+        <source>Mount</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/content.ui" line="92"/>
+        <source>Unmount</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/content.ui" line="99"/>
+        <source>Status</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/content.ui" line="106"/>
+        <source>Release</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/content.ui" line="134"/>
+        <source>Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/content.ui" line="156"/>
+        <source>Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/content.ui" line="161"/>
+        <location filename="../storage/content.ui" line="214"/>
+        <source>Volume</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/content.ui" line="184"/>
+        <source>Import/Export</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/content.ui" line="209"/>
+        <source>Slot</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/content.ui" line="227"/>
+        <source>Content</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/content.ui" line="246"/>
+        <source>  Slot  </source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/content.ui" line="251"/>
+        <source>  Volume   </source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/content.ui" line="256"/>
+        <source>   Bytes   </source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/content.ui" line="261"/>
+        <source>   Status   </source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/content.ui" line="266"/>
+        <source>   Media Type   </source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/content.ui" line="271"/>
+        <source>   Pool   </source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/content.ui" line="276"/>
+        <source>   Last Written   </source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/content.ui" line="281"/>
+        <source>   When expire?   </source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>DirComm</name>
     <message>
-        <location filename="../bcomm/dircomm.cpp" line="523"/>
-        <source>Bat</source>
+        <location filename="../bcomm/dircomm.cpp" line="85"/>
+        <source>Already connected.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>DirStat</name>
     <message>
-        <location filename="../status/dirstat.cpp" line="235"/>
+        <location filename="../status/dirstat.cpp" line="134"/>
+        <location filename="../status/dirstat.cpp" line="239"/>
         <source>Job Id</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../status/dirstat.cpp" line="235"/>
+        <location filename="../status/dirstat.cpp" line="134"/>
+        <location filename="../status/dirstat.cpp" line="191"/>
+        <location filename="../status/dirstat.cpp" line="239"/>
         <source>Job Level</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../status/dirstat.cpp" line="137"/>
+        <location filename="../status/dirstat.cpp" line="134"/>
         <source>Job Files</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../status/dirstat.cpp" line="137"/>
+        <location filename="../status/dirstat.cpp" line="135"/>
         <source>Job Bytes</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../status/dirstat.cpp" line="137"/>
+        <location filename="../status/dirstat.cpp" line="135"/>
         <source>Job Status</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
+        <location filename="../status/dirstat.cpp" line="135"/>
         <location filename="../status/dirstat.cpp" line="191"/>
         <source>Job Time</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../status/dirstat.cpp" line="191"/>
+        <location filename="../status/dirstat.cpp" line="136"/>
+        <location filename="../status/dirstat.cpp" line="192"/>
         <source>Job Name</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../status/dirstat.cpp" line="190"/>
+        <location filename="../status/dirstat.cpp" line="191"/>
         <source>Job Type</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../status/dirstat.cpp" line="190"/>
+        <location filename="../status/dirstat.cpp" line="191"/>
         <source>Priority</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../status/dirstat.cpp" line="191"/>
+        <location filename="../status/dirstat.cpp" line="192"/>
         <source>Volume</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../status/dirstat.cpp" line="235"/>
+        <location filename="../status/dirstat.cpp" line="239"/>
         <source>Job Data</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../status/dirstat.cpp" line="235"/>
+        <location filename="../status/dirstat.cpp" line="239"/>
         <source>Job Info</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../status/dirstat.cpp" line="45"/>
+        <location filename="../status/dirstat.cpp" line="35"/>
         <source>Director Status</source>
         <translation type="unfinished"></translation>
     </message>
@@ -218,7 +470,17 @@ Press OK to proceed with the purge operation?</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../status/dirstat.ui" line="102"/>
+        <location filename="../status/dirstat.ui" line="105"/>
+        <source>Refresh Timer</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/dirstat.ui" line="133"/>
+        <source>Do Refresh</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/dirstat.ui" line="173"/>
         <source><html><head><meta name="qrichtext" content="1" /><style type="text/css">
 p, li { white-space: pre-wrap; }
 </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">
@@ -226,7 +488,7 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../status/dirstat.ui" line="131"/>
+        <location filename="../status/dirstat.ui" line="211"/>
         <source><html><head><meta name="qrichtext" content="1" /><style type="text/css">
 p, li { white-space: pre-wrap; }
 </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">
@@ -234,39 +496,50 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../status/dirstat.ui" line="160"/>
+        <location filename="../status/dirstat.ui" line="249"/>
         <source><html><head><meta name="qrichtext" content="1" /><style type="text/css">
 p, li { white-space: pre-wrap; }
 </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">
 <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:13pt; font-weight:600;">Terminated Jobs</span></p></body></html></source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <location filename="../status/dirstat.ui" line="272"/>
+        <source>Refresh</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/dirstat.ui" line="280"/>
+        <source>Cancel Selected Running Jobs</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/dirstat.ui" line="288"/>
+        <source>Disable Scheduled Job</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>FileSet</name>
     <message>
-        <location filename="../fileset/fileset.cpp" line="46"/>
+        <location filename="../fileset/fileset.cpp" line="36"/>
         <source>FileSets</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../fileset/fileset.cpp" line="82"/>
-        <source>  FileSet Name  </source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../fileset/fileset.cpp" line="83"/>
+        <location filename="../fileset/fileset.cpp" line="69"/>
         <source>FileSet Id</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../fileset/fileset.cpp" line="83"/>
-        <source>Create Time</source>
+        <location filename="../fileset/fileset.cpp" line="69"/>
+        <location filename="../fileset/fileset.cpp" line="144"/>
+        <source>FileSet Name</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../fileset/fileset.cpp" line="86"/>
-        <source>FileSet</source>
+        <location filename="../fileset/fileset.cpp" line="70"/>
+        <source>Create Time</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -278,22 +551,22 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../fileset/fileset.ui" line="31"/>
+        <location filename="../fileset/fileset.ui" line="25"/>
         <source>Refresh FileSet List</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../fileset/fileset.ui" line="34"/>
+        <location filename="../fileset/fileset.ui" line="28"/>
         <source>Requery the director for the list of storage objects.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../fileset/fileset.ui" line="42"/>
-        <source>Status FileSet In Console</source>
+        <location filename="../fileset/fileset.ui" line="36"/>
+        <source>Show FileSet In Console</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../fileset/fileset.ui" line="50"/>
+        <location filename="../fileset/fileset.ui" line="44"/>
         <source>ShowJobs</source>
         <translation type="unfinished"></translation>
     </message>
@@ -301,1682 +574,3268 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>Help</name>
     <message>
-        <location filename="../help/help.cpp" line="61"/>
+        <location filename="../help/help.cpp" line="53"/>
         <source>Help: %1</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
-    <name>JobList</name>
+    <name>Job</name>
     <message>
-        <location filename="../joblist/joblist.cpp" line="319"/>
-        <source>Any</source>
+        <location filename="../job/job.cpp" line="27"/>
+        <source>Job</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="235"/>
-        <source>Job Id</source>
+        <location filename="../job/job.cpp" line="71"/>
+        <source>Are you sure you want to delete??  !!!.
+This delete command is used to delete a Job record and all associated catalog records that were created. This command operates only on the Catalog database and has no effect on the actual data written to a Volume. This command can be dangerous and we strongly recommend that you do not use it unless you know what you are doing.  The Job and all its associated records (File and JobMedia) will be deleted from the catalog.Press OK to proceed with delete operation.?</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="232"/>
-        <source>Job Name</source>
+        <location filename="../job/job.cpp" line="91"/>
+        <source>Are you sure you want to cancel this job?</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="232"/>
-        <source>Client</source>
+        <location filename="../job/job.cpp" line="142"/>
+        <source>Bat</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="239"/>
-        <source>Job Starttime</source>
+        <location filename="../job/job.cpp" line="143"/>
+        <source>There were no results!
+It is possible you may need to add "catalog = all" to the Messages resource for this job.
+</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="237"/>
-        <source>Job Type</source>
+        <location filename="../job/job.cpp" line="186"/>
+        <source>Error:</source>
         <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>JobForm</name>
     <message>
-        <location filename="../joblist/joblist.cpp" line="242"/>
-        <source>Job Level</source>
+        <location filename="../job/job.ui" line="14"/>
+        <source>Form</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="240"/>
-        <source>Job Files</source>
+        <location filename="../job/job.ui" line="24"/>
+        <source>Cancel</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="241"/>
-        <source>Job Bytes</source>
+        <location filename="../job/job.ui" line="38"/>
+        <source>Delete</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="238"/>
-        <source>Job Status</source>
+        <location filename="../job/job.ui" line="55"/>
+        <source>View errors for this Job</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="236"/>
-        <source>Purged</source>
+        <location filename="../job/job.ui" line="58"/>
+        <source>Errors</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="234"/>
-        <source>File Set</source>
+        <location filename="../job/job.ui" line="75"/>
+        <source>Media</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="295"/>
-        <source>IS</source>
+        <location filename="../job/job.ui" line="92"/>
+        <source>History</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="296"/>
-        <source>NOT</source>
+        <location filename="../job/job.ui" line="112"/>
+        <source>Run again</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="299"/>
-        <source>Backup</source>
+        <location filename="../job/job.ui" line="129"/>
+        <source>Read doc</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="300"/>
-        <source>Restore</source>
+        <location filename="../job/job.ui" line="142"/>
+        <source>FileSet</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="324"/>
-        <source>The Jobs query returned no results.
-Press OK to continue?</source>
+        <location filename="../job/job.ui" line="159"/>
+        <source>Stats</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="539"/>
-        <source>Are you sure you want to delete??  !!!.
-This delete command is used to delete a Job record and all associated catalog records that were created. This command operates only on the Catalog database and has no effect on the actual data written to a Volume. This command can be dangerous and we strongly recommend that you do not use it unless you know what you are doing.  The Job and all its associated records (File and JobMedia) will be deleted from the catalog.Press OK to proceed with delete operation.?</source>
+        <location filename="../job/job.ui" line="173"/>
+        <source>Refresh</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="557"/>
-        <source>Are you sure you want to purge ??  !!!.
-The Purge command will delete associated Catalog database records from Jobs and Volumes without considering the retention period. Purge  works only on the Catalog database and does not affect data written to Volumes. This command can be dangerous because you can delete catalog records associated with current backups of files, and we recommend that you do not use it unless you know what you are doing.
-Press OK to proceed with the purge operation?</source>
+        <location filename="../job/job.ui" line="224"/>
+        <source>Basic Information</source>
         <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>JobListForm</name>
     <message>
-        <location filename="../joblist/joblist.ui" line="13"/>
-        <source>Form</source>
+        <location filename="../job/job.ui" line="230"/>
+        <source>JobId:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.ui" line="88"/>
-        <source>Refresh</source>
+        <location filename="../job/job.ui" line="237"/>
+        <source>2</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.ui" line="98"/>
-        <source>Graph</source>
+        <location filename="../job/job.ui" line="247"/>
+        <source>Job Name:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.ui" line="124"/>
-        <source>FileSet</source>
+        <location filename="../job/job.ui" line="254"/>
+        <source>Test</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.ui" line="154"/>
-        <source>Status</source>
+        <location filename="../job/job.ui" line="264"/>
+        <source>Level:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.ui" line="174"/>
-        <source>Purged</source>
+        <location filename="../job/job.ui" line="271"/>
+        <source>VirtualFull</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.ui" line="204"/>
-        <source>Record Limit</source>
+        <location filename="../job/job.ui" line="281"/>
+        <source>Client:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.ui" line="234"/>
-        <source>Days Limit</source>
+        <location filename="../job/job.ui" line="288"/>
+        <source>client-fd</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.ui" line="268"/>
-        <source>Clients</source>
+        <location filename="../job/job.ui" line="298"/>
+        <source>FileSet:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.ui" line="288"/>
-        <source>Volume</source>
+        <location filename="../job/job.ui" line="305"/>
+        <source>TheFileSet</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.ui" line="318"/>
-        <source>Job</source>
+        <location filename="../job/job.ui" line="315"/>
+        <source>Pool:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.ui" line="338"/>
-        <source>Level</source>
+        <location filename="../job/job.ui" line="322"/>
+        <source>ThePool</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.ui" line="356"/>
-        <source>Refresh Job List</source>
+        <location filename="../job/job.ui" line="353"/>
+        <source>Status</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.ui" line="359"/>
-        <source>Requery the director for the list of jobs.</source>
+        <location filename="../job/job.ui" line="359"/>
+        <source>Status:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.ui" line="367"/>
-        <source>ListJobid</source>
+        <location filename="../job/job.ui" line="379"/>
+        <source>Errors:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.ui" line="375"/>
-        <source>List Files On Job</source>
+        <location filename="../job/job.ui" line="386"/>
+        <source>0</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.ui" line="383"/>
-        <source>ListJobMedia</source>
+        <location filename="../job/job.ui" line="396"/>
+        <source>Files:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.ui" line="391"/>
-        <source>ListVolumes</source>
+        <location filename="../job/job.ui" line="403"/>
+        <source>1,924</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.ui" line="399"/>
-        <source>DeleteJob</source>
+        <location filename="../job/job.ui" line="413"/>
+        <source>Bytes:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.ui" line="407"/>
-        <source>PurgeFiles</source>
+        <location filename="../job/job.ui" line="420"/>
+        <source>109 MB</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.ui" line="415"/>
-        <source>Restore From Job</source>
+        <location filename="../job/job.ui" line="430"/>
+        <source>Purged:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.ui" line="423"/>
-        <source>Restore From Time</source>
+        <location filename="../job/job.ui" line="471"/>
+        <source>Times</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.ui" line="431"/>
-        <source>Show Log for Job</source>
+        <location filename="../job/job.ui" line="477"/>
+        <source>Sched Time:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.ui" line="439"/>
-        <source>Cancel Currently Running Job</source>
+        <location filename="../job/job.ui" line="484"/>
+        <location filename="../job/job.ui" line="501"/>
+        <source>2009-07-31 00:10:00</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.ui" line="447"/>
-        <source>List Job Totals in Console</source>
+        <location filename="../job/job.ui" line="494"/>
+        <source>Start Time:</source>
         <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>JobLog</name>
     <message>
-        <location filename="../joblog/joblog.cpp" line="110"/>
-        <source>Bat</source>
+        <location filename="../job/job.ui" line="511"/>
+        <source>End Time:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../joblog/joblog.cpp" line="113"/>
-        <source>There were no results ??  !!!.
-It is possible you may need to add "catalog = all" to the Messages stanza for this job.
-</source>
+        <location filename="../job/job.ui" line="518"/>
+        <source>2009-07-31 00:20:00</source>
         <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>JobLogForm</name>
     <message>
-        <location filename="../joblog/joblog.ui" line="13"/>
-        <source>Job Log</source>
+        <location filename="../job/job.ui" line="528"/>
+        <source>Duration:</source>
         <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>JobPlot</name>
     <message>
-        <location filename="../jobgraphs/jobplot.cpp" line="312"/>
-        <source>Bat</source>
+        <location filename="../job/job.ui" line="535"/>
+        <source>00:10:00</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplot.cpp" line="314"/>
-        <source>The Jobs query returned no results.
-Press OK to continue?</source>
+        <location filename="../job/job.ui" line="572"/>
+        <source>Volume Used</source>
         <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>JobPlotControlsForm</name>
     <message>
-        <location filename="../jobgraphs/jobplotcontrols.ui" line="27"/>
-        <source>Form</source>
+        <location filename="../job/job.ui" line="603"/>
+        <source>Vol0001</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplotcontrols.ui" line="81"/>
-        <source>File Data</source>
+        <location filename="../job/job.ui" line="644"/>
+        <source>Running Information</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplotcontrols.ui" line="88"/>
-        <source>Byte Data</source>
+        <location filename="../job/job.ui" line="650"/>
+        <source>Speed:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplotcontrols.ui" line="147"/>
-        <source>Refresh</source>
+        <location filename="../job/job.ui" line="657"/>
+        <source>Files Examined:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplotcontrols.ui" line="238"/>
-        <source>Status</source>
+        <location filename="../job/job.ui" line="664"/>
+        <source>Current File:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplotcontrols.ui" line="245"/>
-        <source>Level</source>
+        <location filename="../job/job.ui" line="677"/>
+        <source>/var/www/bacula/spool</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplotcontrols.ui" line="252"/>
-        <source>Purged</source>
+        <location filename="../job/job.ui" line="684"/>
+        <source>100,000</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplotcontrols.ui" line="265"/>
-        <source>FileSet</source>
+        <location filename="../job/job.ui" line="691"/>
+        <source>100 MB/s</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplotcontrols.ui" line="272"/>
-        <source>Volume</source>
+        <location filename="../job/job.ui" line="701"/>
+        <source> kB/s</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplotcontrols.ui" line="279"/>
-        <source>Client</source>
+        <location filename="../job/job.ui" line="720"/>
+        <source>Bandwidth Limit:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplotcontrols.ui" line="286"/>
-        <source>Job</source>
+        <location filename="../job/job.ui" line="745"/>
+        <source><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html><head><meta name="qrichtext" content="1" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'DejaVu Sans'; font-size:10pt;"></p></body></html></source>
         <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>JobList</name>
     <message>
-        <location filename="../jobgraphs/jobplotcontrols.ui" line="293"/>
-        <source>Days Limit</source>
+        <location filename="../joblist/joblist.cpp" line="218"/>
+        <location filename="../joblist/joblist.cpp" line="233"/>
+        <location filename="../joblist/joblist.cpp" line="239"/>
+        <location filename="../joblist/joblist.cpp" line="243"/>
+        <location filename="../joblist/joblist.cpp" line="251"/>
+        <location filename="../joblist/joblist.cpp" line="255"/>
+        <location filename="../joblist/joblist.cpp" line="269"/>
+        <location filename="../joblist/joblist.cpp" line="284"/>
+        <source>Any</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplotcontrols.ui" line="308"/>
-        <source>Record Limit</source>
+        <location filename="../joblist/joblist.cpp" line="114"/>
+        <location filename="../joblist/joblist.cpp" line="119"/>
+        <source>Job Id</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplotcontrols.ui" line="315"/>
-        <source>Byte Symbol Type</source>
+        <location filename="../joblist/joblist.cpp" line="114"/>
+        <location filename="../joblist/joblist.cpp" line="127"/>
+        <source>Job Name</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplotcontrols.ui" line="322"/>
-        <source>File Symbol Type</source>
+        <location filename="../joblist/joblist.cpp" line="114"/>
+        <location filename="../joblist/joblist.cpp" line="129"/>
+        <source>Client</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplotcontrols.ui" line="329"/>
-        <source>Graph Type</source>
+        <location filename="../joblist/joblist.cpp" line="114"/>
+        <location filename="../joblist/joblist.cpp" line="123"/>
+        <source>Job Starttime</source>
         <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>Jobs</name>
     <message>
-        <location filename="../jobs/jobs.cpp" line="85"/>
-        <source>Jobs</source>
+        <location filename="../joblist/joblist.cpp" line="115"/>
+        <location filename="../joblist/joblist.cpp" line="121"/>
+        <source>Job Type</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobs/jobs.cpp" line="78"/>
-        <source>Job Name</source>
+        <location filename="../joblist/joblist.cpp" line="115"/>
+        <location filename="../joblist/joblist.cpp" line="126"/>
+        <source>Job Level</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobs/jobs.cpp" line="78"/>
-        <source>Pool</source>
+        <location filename="../joblist/joblist.cpp" line="115"/>
+        <location filename="../joblist/joblist.cpp" line="124"/>
+        <source>Job Files</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobs/jobs.cpp" line="79"/>
-        <source>Messages</source>
+        <location filename="../joblist/joblist.cpp" line="116"/>
+        <location filename="../joblist/joblist.cpp" line="125"/>
+        <source>Job Bytes</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobs/jobs.cpp" line="79"/>
-        <source>Client</source>
+        <location filename="../joblist/joblist.cpp" line="116"/>
+        <location filename="../joblist/joblist.cpp" line="122"/>
+        <source>Job Status</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobs/jobs.cpp" line="79"/>
-        <source>Storage</source>
+        <location filename="../joblist/joblist.cpp" line="116"/>
+        <location filename="../joblist/joblist.cpp" line="120"/>
+        <source>Purged</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobs/jobs.cpp" line="79"/>
-        <source>Where</source>
+        <location filename="../joblist/joblist.cpp" line="116"/>
+        <location filename="../joblist/joblist.cpp" line="128"/>
+        <source>File Set</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobs/jobs.cpp" line="79"/>
-        <source>Level</source>
+        <location filename="../joblist/joblist.cpp" line="117"/>
+        <source>Pool Name</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobs/jobs.cpp" line="83"/>
-        <source>Type</source>
+        <location filename="../joblist/joblist.cpp" line="117"/>
+        <source>First Volume</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobs/jobs.cpp" line="81"/>
-        <source>FileSet</source>
+        <location filename="../joblist/joblist.cpp" line="117"/>
+        <source>VolCount</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobs/jobs.cpp" line="81"/>
-        <source>Catalog</source>
+        <location filename="../joblist/joblist.cpp" line="635"/>
+        <source>Delete list of %1 Jobs</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobs/jobs.cpp" line="81"/>
-        <source>Enabled</source>
+        <location filename="../joblist/joblist.cpp" line="637"/>
+        <source>Purge Files from list of %1 Jobs</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobs/jobs.cpp" line="165"/>
-        <source>Backup</source>
+        <location filename="../joblist/joblist.cpp" line="640"/>
+        <source>Delete Single Job</source>
         <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>MainForm</name>
     <message>
-        <location filename="../main.ui" line="14"/>
-        <source>bat - Bacula Admin Tool</source>
+        <location filename="../joblist/joblist.cpp" line="641"/>
+        <source>Purge Files from single job</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="23"/>
-        <source>Bacula Administration Tool</source>
+        <location filename="../joblist/joblist.cpp" line="707"/>
+        <source>Running</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="26"/>
-        <source>It's a Dock widget to allow page selection</source>
+        <location filename="../joblist/joblist.cpp" line="707"/>
+        <source>Created, not yet running</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="79"/>
-        <source>&Edit</source>
+        <location filename="../joblist/joblist.cpp" line="697"/>
+        <source>Backup</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="87"/>
-        <source>Settings</source>
+        <location filename="../joblist/joblist.cpp" line="222"/>
+        <source>The Jobs query returned no results.
+Press OK to continue?</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="94"/>
-        <source>&Help</source>
+        <location filename="../joblist/joblist.cpp" line="370"/>
+        <source>Jobs Run on Volume %1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="101"/>
-        <source>&File</source>
+        <location filename="../joblist/joblist.cpp" line="372"/>
+        <source>Jobs Run from Client %1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="117"/>
-        <source>Current Status</source>
+        <location filename="../joblist/joblist.cpp" line="374"/>
+        <source>Jobs Run of Job %1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="128"/>
-        <source>Tool Bar</source>
+        <location filename="../joblist/joblist.cpp" line="376"/>
+        <source>Jobs Run with fileset %1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="188"/>
-        <source>Page Selector</source>
+        <location filename="../joblist/joblist.cpp" line="378"/>
+        <source>Jobs Run</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="233"/>
-        <source>Selects panel window</source>
+        <location filename="../joblist/joblist.cpp" line="454"/>
+        <source>Are you sure you want to delete??  !!!.
+This delete command is used to delete a Job record and all associated catalog records that were created. This command operates only on the Catalog database and has no effect on the actual data written to a Volume. This command can be dangerous and we strongly recommend that you do not use it unless you know what you are doing.  The Job and all its associated records (File and JobMedia) will be deleted from the catalog.Press OK to proceed with delete operation.?</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="236"/>
-        <source>Use items in this tree to select what window is in panel</source>
+        <location filename="../joblist/joblist.cpp" line="475"/>
+        <source>run job="%1" client="%2" level=%3</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="248"/>
-        <source>Console Entry</source>
+        <location filename="../joblist/joblist.cpp" line="477"/>
+        <source> fileset="%1"</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="251"/>
-        <source>Enter a bacula command</source>
+        <location filename="../joblist/joblist.cpp" line="490"/>
+        <source>Are you sure you want to purge ??  !!!.
+The Purge command will delete associated Catalog database records from Jobs and Volumes without considering the retention period. Purge  works only on the Catalog database and does not affect data written to Volumes. This command can be dangerous because you can delete catalog records associated with current backups of files, and we recommend that you do not use it unless you know what you are doing.
+Press OK to proceed with the purge operation?</source>
         <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>JobListForm</name>
     <message>
-        <location filename="../main.ui" line="254"/>
-        <source>Console Command entry Dock Widget</source>
+        <location filename="../joblist/joblist.ui" line="14"/>
+        <source>Form</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="263"/>
-        <source>Console Command Line Entry</source>
+        <location filename="../joblist/joblist.ui" line="322"/>
+        <source>Refresh</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="287"/>
-        <source>Command:</source>
+        <location filename="../joblist/joblist.ui" line="333"/>
+        <source>Graph</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="294"/>
-        <source>Click here to enter command</source>
+        <location filename="../joblist/joblist.ui" line="278"/>
+        <source>FileSet</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="305"/>
-        <source>&Quit</source>
+        <location filename="../joblist/joblist.ui" line="231"/>
+        <source>Status</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="308"/>
-        <source>Ctrl+Q</source>
+        <location filename="../joblist/joblist.ui" line="251"/>
+        <source>Purged</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="316"/>
-        <source>&About bat</source>
+        <location filename="../joblist/joblist.ui" line="67"/>
+        <source>Record Limit</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="324"/>
-        <source>&Copy</source>
+        <location filename="../joblist/joblist.ui" line="97"/>
+        <source>Days Limit</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="332"/>
-        <source>Cu&t</source>
+        <location filename="../joblist/joblist.ui" line="131"/>
+        <source>Clients</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="340"/>
-        <source>new</source>
+        <location filename="../joblist/joblist.ui" line="151"/>
+        <source>Volume</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="348"/>
-        <source>open</source>
+        <location filename="../joblist/joblist.ui" line="181"/>
+        <source>Job</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="356"/>
-        <source>&Paste</source>
+        <location filename="../joblist/joblist.ui" line="201"/>
+        <source>Level</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="364"/>
-        <source>&Print</source>
+        <location filename="../joblist/joblist.ui" line="298"/>
+        <source>Pool</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="367"/>
-        <source>Print</source>
+        <location filename="../joblist/joblist.ui" line="346"/>
+        <source>Filter Copy Jobs</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="375"/>
-        <source>&Save</source>
+        <location filename="../joblist/joblist.ui" line="353"/>
+        <source>Filter Migration Jobs</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="378"/>
-        <source>Save (not implemented)</source>
+        <location filename="../joblist/joblist.ui" line="367"/>
+        <source>Refresh Job List</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="386"/>
-        <source>Connect</source>
+        <location filename="../joblist/joblist.ui" line="370"/>
+        <source>Requery the director for the list of jobs.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="389"/>
-        <source>Connect/disconnect</source>
+        <location filename="../joblist/joblist.ui" line="388"/>
+        <source>List Job Volumes</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="397"/>
-        <source>Label</source>
+        <location filename="../joblist/joblist.ui" line="397"/>
+        <source>List Volumes</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="403"/>
-        <source>Label a Volume</source>
+        <location filename="../joblist/joblist.ui" line="406"/>
+        <source>Delete Job</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="411"/>
-        <source>Restore</source>
+        <location filename="../joblist/joblist.ui" line="415"/>
+        <source>Purge Files</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="414"/>
-        <source>Restore Files</source>
+        <location filename="../joblist/joblist.ui" line="424"/>
+        <source>Restart Job</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="431"/>
-        <source>Run Job</source>
+        <location filename="../joblist/joblist.ui" line="451"/>
+        <source>Show Job Log</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="434"/>
-        <source>Run a Job</source>
+        <location filename="../joblist/joblist.ui" line="460"/>
+        <source>Show Job Info</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="451"/>
-        <source>Estimate Job</source>
+        <location filename="../joblist/joblist.ui" line="478"/>
+        <source>List Job Totals on Console</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="454"/>
-        <source>Estimate a Job</source>
+        <location filename="../joblist/joblist.ui" line="379"/>
+        <source>List Files On Job</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="462"/>
-        <source>Status Dir</source>
-        <comment>Query status of director</comment>
+        <location filename="../joblist/joblist.ui" line="433"/>
+        <source>Restore From Job</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="465"/>
-        <source>Status Dir</source>
+        <location filename="../joblist/joblist.ui" line="442"/>
+        <source>Restore From Time</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="471"/>
-        <source>Query status of director in console</source>
+        <location filename="../joblist/joblist.ui" line="469"/>
+        <source>Cancel Currently Running Job</source>
         <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>JobLog</name>
     <message>
-        <location filename="../main.ui" line="479"/>
-        <source>&Select Font ...</source>
+        <location filename="../joblog/joblog.cpp" line="33"/>
+        <source>JobLog</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="487"/>
-        <source>Undock Window</source>
+        <location filename="../joblog/joblog.cpp" line="78"/>
+        <source>Bat</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="490"/>
-        <source>Undock Current Window</source>
+        <location filename="../joblog/joblog.cpp" line="79"/>
+        <source>There were no results!
+It is possible you may need to add "catalog = all" to the Messages resource for this job.
+</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="498"/>
-        <source>ToggleDock</source>
+        <location filename="../joblog/joblog.cpp" line="88"/>
+        <source>Log records for job %1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="504"/>
-        <source>Toggle Dock Status</source>
+        <location filename="../joblog/joblog.cpp" line="125"/>
+        <source>Error:</source>
         <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>JobLogForm</name>
     <message>
-        <location filename="../main.ui" line="512"/>
-        <source>Close Page</source>
+        <location filename="../joblog/joblog.ui" line="13"/>
+        <source>Job Log</source>
         <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>JobPlot</name>
     <message>
-        <location filename="../main.ui" line="515"/>
-        <source>Close The Current Page</source>
+        <location filename="../jobgraphs/jobplot.cpp" line="70"/>
+        <source>JobPlot</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="523"/>
-        <source>Messages</source>
+        <location filename="../jobgraphs/jobplot.cpp" line="126"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="421"/>
+        <source>Sticks</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="526"/>
-        <source>Display any messages queued at the director</source>
+        <location filename="../jobgraphs/jobplot.cpp" line="127"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="423"/>
+        <source>Lines</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="534"/>
-        <source>&Preferences ...</source>
+        <location filename="../jobgraphs/jobplot.cpp" line="127"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="427"/>
+        <source>Steps</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="540"/>
-        <source>Set Preferences</source>
+        <location filename="../jobgraphs/jobplot.cpp" line="127"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="429"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="454"/>
+        <source>None</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="548"/>
-        <source>bat &Help</source>
+        <location filename="../jobgraphs/jobplot.cpp" line="144"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="149"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="151"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="158"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="162"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="209"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="276"/>
+        <source>Any</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="556"/>
-        <source>Browse</source>
+        <location filename="../jobgraphs/jobplot.cpp" line="280"/>
+        <source>The Jobs query returned no results.
+Press OK to continue?</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="562"/>
-        <source>Browse Cataloged Files</source>
+        <location filename="../jobgraphs/jobplot.cpp" line="324"/>
+        <source>Files and Bytes backed up</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="570"/>
-        <source>JobPlot</source>
+        <location filename="../jobgraphs/jobplot.cpp" line="329"/>
+        <source><-- Bytes Kb</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="576"/>
-        <source>Plot Job Files and Bytes</source>
+        <location filename="../jobgraphs/jobplot.cpp" line="330"/>
+        <source>date of backup --></source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="584"/>
-        <source>Status Dir Page</source>
+        <location filename="../jobgraphs/jobplot.cpp" line="331"/>
+        <source>Number of Files --></source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../main.ui" line="587"/>
-        <source>Director Status Page</source>
+        <location filename="../jobgraphs/jobplot.cpp" line="335"/>
+        <source>Files</source>
         <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>MainWin</name>
     <message>
-        <location filename="../mainwin.cpp" line="477"/>
-        <source>Director not connected. Click on connect button.</source>
+        <location filename="../jobgraphs/jobplot.cpp" line="340"/>
+        <source>Bytes</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../mainwin.cpp" line="488"/>
-        <source>About bat</source>
+        <location filename="../jobgraphs/jobplot.cpp" line="417"/>
+        <source>Fitted</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../mainwin.cpp" line="490"/>
-        <source><br><h2>bat 1.0, by Dirk H Bartley and Kern Sibbald</h2><p>Copyright &copy; 2007-</source>
+        <location filename="../jobgraphs/jobplot.cpp" line="439"/>
+        <source>Ellipse</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../mainwin.cpp" line="513"/>
-        <source> Ready</source>
+        <location filename="../jobgraphs/jobplot.cpp" line="440"/>
+        <source>Rect</source>
         <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>MediaEdit</name>
     <message>
-        <location filename="../mediaedit/mediaedit.cpp" line="47"/>
-        <source>Media Edit</source>
+        <location filename="../jobgraphs/jobplot.cpp" line="441"/>
+        <source>Diamond</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../mediaedit/mediaedit.cpp" line="196"/>
-        <source>No Volume name</source>
+        <location filename="../jobgraphs/jobplot.cpp" line="442"/>
+        <source>Triangle</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../mediaedit/mediaedit.cpp" line="196"/>
-        <source>No Volume name given</source>
+        <location filename="../jobgraphs/jobplot.cpp" line="443"/>
+        <source>DTrianle</source>
         <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>MediaList</name>
     <message>
-        <location filename="../medialist/medialist.cpp" line="50"/>
-        <source>Media</source>
+        <location filename="../jobgraphs/jobplot.cpp" line="444"/>
+        <source>UTriangle</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="83"/>
-        <source>Volume Name</source>
+        <location filename="../jobgraphs/jobplot.cpp" line="445"/>
+        <source>LTriangle</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="83"/>
-        <source>Id</source>
+        <location filename="../jobgraphs/jobplot.cpp" line="446"/>
+        <source>RTriangle</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="83"/>
-        <source>Status</source>
+        <location filename="../jobgraphs/jobplot.cpp" line="447"/>
+        <source>Cross</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="86"/>
-        <source>Enabled</source>
+        <location filename="../jobgraphs/jobplot.cpp" line="448"/>
+        <source>XCross</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="83"/>
-        <source>Bytes</source>
+        <location filename="../jobgraphs/jobplot.cpp" line="449"/>
+        <source>HLine</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="84"/>
-        <source>Files</source>
+        <location filename="../jobgraphs/jobplot.cpp" line="450"/>
+        <source>Vline</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="84"/>
-        <source>Jobs</source>
+        <location filename="../jobgraphs/jobplot.cpp" line="451"/>
+        <source>Star1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="84"/>
-        <source>Retention</source>
+        <location filename="../jobgraphs/jobplot.cpp" line="452"/>
+        <source>Star2</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="84"/>
-        <source>Media Type</source>
+        <location filename="../jobgraphs/jobplot.cpp" line="453"/>
+        <source>Hexagon</source>
         <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>JobPlotControlsForm</name>
     <message>
-        <location filename="../medialist/medialist.cpp" line="84"/>
-        <source>Slot</source>
+        <location filename="../jobgraphs/jobplotcontrols.ui" line="27"/>
+        <source>Form</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="85"/>
-        <source>Use Duration</source>
+        <location filename="../jobgraphs/jobplotcontrols.ui" line="81"/>
+        <source>File Data</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="85"/>
-        <source>Max Jobs</source>
+        <location filename="../jobgraphs/jobplotcontrols.ui" line="88"/>
+        <source>Byte Data</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="85"/>
-        <source>Max Files</source>
+        <location filename="../jobgraphs/jobplotcontrols.ui" line="147"/>
+        <source>Refresh</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="85"/>
-        <source>Max Bytes</source>
+        <location filename="../jobgraphs/jobplotcontrols.ui" line="238"/>
+        <source>Status</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="85"/>
-        <source>Recycle</source>
+        <location filename="../jobgraphs/jobplotcontrols.ui" line="245"/>
+        <source>Level</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="86"/>
-        <source>RecyclePool</source>
+        <location filename="../jobgraphs/jobplotcontrols.ui" line="252"/>
+        <source>Purged</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="86"/>
-        <source>Last Written</source>
+        <location filename="../jobgraphs/jobplotcontrols.ui" line="265"/>
+        <source>FileSet</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="101"/>
-        <source>Pools</source>
+        <location filename="../jobgraphs/jobplotcontrols.ui" line="272"/>
+        <source>Volume</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="323"/>
-        <source>Are you sure you want to delete??  !!!.
-This delete command is used to delete a Volume record and all associated catalog records that were created. This command operates only on the Catalog database and has no effect on the actual data written to a Volume. This command can be dangerous and we strongly recommend that you do not use it unless you know what you are doing.  All Jobs and all associated records (File and JobMedia) will be deleted from the catalog.Press OK to proceed with delete operation.?</source>
+        <location filename="../jobgraphs/jobplotcontrols.ui" line="279"/>
+        <source>Client</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="345"/>
-        <source>Are you sure you want to purge ??  !!!.
-The Purge command will delete associated Catalog database records from Jobs and Volumes without considering the retention period. Purge  works only on the Catalog database and does not affect data written to Volumes. This command can be dangerous because you can delete catalog records associated with current backups of files, and we recommend that you do not use it unless you know what you are doing.
-Press OK to proceed with the purge operation?</source>
+        <location filename="../jobgraphs/jobplotcontrols.ui" line="286"/>
+        <source>Job</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../jobgraphs/jobplotcontrols.ui" line="293"/>
+        <source>Days Limit</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../jobgraphs/jobplotcontrols.ui" line="308"/>
+        <source>Record Limit</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../jobgraphs/jobplotcontrols.ui" line="315"/>
+        <source>Byte Symbol Type</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../jobgraphs/jobplotcontrols.ui" line="322"/>
+        <source>File Symbol Type</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../jobgraphs/jobplotcontrols.ui" line="329"/>
+        <source>Graph Type</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
-    <name>MediaListForm</name>
+    <name>Jobs</name>
     <message>
-        <location filename="../medialist/medialist.ui" line="13"/>
-        <source>Media Tree</source>
+        <location filename="../jobs/jobs.cpp" line="32"/>
+        <source>Jobs</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.ui" line="31"/>
-        <source>Refresh Media List</source>
+        <location filename="../jobs/jobs.cpp" line="69"/>
+        <location filename="../jobs/jobs.cpp" line="108"/>
+        <source>Job Name</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.ui" line="34"/>
-        <source>Requery the director for the list of media.</source>
+        <location filename="../jobs/jobs.cpp" line="70"/>
+        <source>Pool</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.ui" line="42"/>
-        <source>Edit Volume</source>
+        <location filename="../jobs/jobs.cpp" line="70"/>
+        <source>Messages</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.ui" line="50"/>
-        <source>List Jobs On Volume</source>
+        <location filename="../jobs/jobs.cpp" line="70"/>
+        <source>Client</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.ui" line="58"/>
-        <source>Delete Volume</source>
+        <location filename="../jobs/jobs.cpp" line="71"/>
+        <source>Storage</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.ui" line="66"/>
-        <source>Prune Volume</source>
+        <location filename="../jobs/jobs.cpp" line="73"/>
+        <source>Where</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.ui" line="74"/>
-        <source>Purge Volume</source>
+        <location filename="../jobs/jobs.cpp" line="71"/>
+        <source>Level</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.ui" line="82"/>
-        <source>Relabel Volume</source>
+        <location filename="../jobs/jobs.cpp" line="71"/>
+        <location filename="../jobs/jobs.cpp" line="75"/>
+        <source>Type</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.ui" line="99"/>
-        <source>Update all Volumes From Pool</source>
+        <location filename="../jobs/jobs.cpp" line="72"/>
+        <source>FileSet</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.ui" line="116"/>
-        <source>Update all Volumes from all Pools</source>
+        <location filename="../jobs/jobs.cpp" line="72"/>
+        <source>Catalog</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.ui" line="124"/>
-        <source>Volume From Pool</source>
+        <location filename="../jobs/jobs.cpp" line="72"/>
+        <source>Enabled</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
-    <name>Pages</name>
+    <name>MainForm</name>
     <message>
-        <location filename="../pages.cpp" line="264"/>
-        <source> of Director </source>
+        <location filename="../main.ui" line="15"/>
+        <source>bat - Bacula Admin Tool</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../pages.cpp" line="294"/>
-        <source>UnDock </source>
+        <location filename="../main.ui" line="25"/>
+        <source>Bacula Administration Tool</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../pages.cpp" line="296"/>
-        <source>ReDock </source>
+        <location filename="../main.ui" line="28"/>
+        <source>It's a Dock widget to allow page selection</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../pages.cpp" line="298"/>
-        <source> Window</source>
+        <location filename="../main.ui" line="58"/>
+        <source>Settings</source>
         <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>PrefsForm</name>
     <message>
-        <location filename="../prefs.ui" line="19"/>
-        <source>Preferences</source>
+        <location filename="../main.ui" line="65"/>
+        <source>&Help</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="50"/>
-        <source>Messages</source>
+        <location filename="../main.ui" line="72"/>
+        <source>&File</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="80"/>
-        <source>Messages Options</source>
+        <location filename="../main.ui" line="85"/>
+        <location filename="../main.ui" line="88"/>
+        <source>Current Status</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="104"/>
-        <source>Message check interval in seconds</source>
+        <location filename="../main.ui" line="99"/>
+        <source>Tool Bar</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="111"/>
-        <source>Check Messages</source>
+        <location filename="../main.ui" line="199"/>
+        <source>Selects panel window</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="129"/>
-        <source>Joblist</source>
+        <location filename="../main.ui" line="202"/>
+        <source>Use items in this tree to select what window is in panel</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="159"/>
-        <source>Joblist Limit Options</source>
+        <location filename="../main.ui" line="209"/>
+        <source>1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="203"/>
-        <source>Days Limit</source>
+        <location filename="../main.ui" line="217"/>
+        <source>Command:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="236"/>
-        <source>Record Limit</source>
+        <location filename="../main.ui" line="224"/>
+        <source>Click here to enter command</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="249"/>
-        <source>Misc</source>
+        <location filename="../main.ui" line="233"/>
+        <source>&Quit</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="261"/>
-        <source>Convert</source>
+        <location filename="../main.ui" line="236"/>
+        <source>Ctrl+Q</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="273"/>
-        <source>Convert Off</source>
+        <location filename="../main.ui" line="245"/>
+        <source>&About bat</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="286"/>
-        <source>Convert Bytes with IEC 1000B = KB</source>
+        <location filename="../main.ui" line="254"/>
+        <source>&Copy</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="299"/>
-        <source>Convert Bytes with 1024B = KB</source>
+        <location filename="../main.ui" line="263"/>
+        <source>Cu&t</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="313"/>
-        <source>Context Sensitive List Commands</source>
+        <location filename="../main.ui" line="272"/>
+        <source>new</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="337"/>
-        <source>Execute Long List</source>
+        <location filename="../main.ui" line="281"/>
+        <source>open</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="353"/>
-        <source>GroupBox</source>
+        <location filename="../main.ui" line="290"/>
+        <source>&Paste</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="365"/>
-        <source>Open Plot page on startup</source>
+        <location filename="../main.ui" line="299"/>
+        <source>&Print</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="378"/>
-        <source>Open Browser page on startup</source>
+        <location filename="../main.ui" line="302"/>
+        <source>Print</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="391"/>
-        <source>Open Director Status page on startup</source>
+        <location filename="../main.ui" line="311"/>
+        <source>&Save</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="398"/>
-        <source>Debug</source>
+        <location filename="../main.ui" line="314"/>
+        <source>Save (not implemented)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="543"/>
-        <source>Debugging Options</source>
+        <location filename="../main.ui" line="323"/>
+        <source>Connect</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="472"/>
-        <source>Debug comm</source>
+        <location filename="../main.ui" line="326"/>
+        <source>Connect/disconnect</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="479"/>
-        <source>Display all messages in console</source>
+        <location filename="../main.ui" line="335"/>
+        <source>Label</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="486"/>
-        <source>Debug Commands</source>
+        <location filename="../main.ui" line="338"/>
+        <location filename="../main.ui" line="341"/>
+        <source>Label a Volume</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="493"/>
-        <source>Debug Sql queries</source>
+        <location filename="../main.ui" line="350"/>
+        <source>Restore</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="500"/>
-        <source>Debug Miscelaneous Items</source>
+        <location filename="../main.ui" line="353"/>
+        <source>Restore Files</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="513"/>
-        <source>RestoreTree</source>
+        <location filename="../main.ui" line="365"/>
+        <location filename="../main.ui" line="368"/>
+        <location filename="../main.ui" line="371"/>
+        <source>Run Job</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="587"/>
-        <source>Restore Debug 2</source>
+        <location filename="../main.ui" line="374"/>
+        <source>Run a Job</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="594"/>
-        <source>Directory Item Changed</source>
+        <location filename="../main.ui" line="386"/>
+        <location filename="../main.ui" line="389"/>
+        <location filename="../main.ui" line="392"/>
+        <source>Estimate Job</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="601"/>
-        <source>Restore Debug 1</source>
+        <location filename="../main.ui" line="395"/>
+        <source>Estimate a Job</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="608"/>
-        <source>Directory Current Item Changed Debug</source>
+        <location filename="../main.ui" line="404"/>
+        <source>Status Dir</source>
+        <comment>Query status of director</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="615"/>
-        <source>Update File Table Debug</source>
+        <location filename="../main.ui" line="407"/>
+        <source>Status Dir</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="622"/>
-        <source>Version Table Item Changed Debug</source>
+        <location filename="../main.ui" line="410"/>
+        <location filename="../main.ui" line="413"/>
+        <source>Query status of director in console</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="629"/>
-        <source>File Table Item Changed Debug</source>
+        <location filename="../main.ui" line="421"/>
+        <source>&Select Font ...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="636"/>
-        <source>Icon State Debug</source>
+        <location filename="../main.ui" line="430"/>
+        <source>Undock Window</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="643"/>
-        <source>Update Checks Debug</source>
+        <location filename="../main.ui" line="433"/>
+        <source>Undock Current Window</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="650"/>
-        <source>Restore Debug 3</source>
+        <location filename="../main.ui" line="442"/>
+        <source>ToggleDock</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="657"/>
-        <source>Update Version Table Debug</source>
+        <location filename="../main.ui" line="445"/>
+        <location filename="../main.ui" line="448"/>
+        <source>Toggle Dock Status</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="664"/>
-        <source>Populate Directory Debug</source>
+        <location filename="../main.ui" line="457"/>
+        <source>Close Page</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../prefs.ui" line="726"/>
-        <source><h2>Preferences</h2></source>
+        <location filename="../main.ui" line="460"/>
+        <source>Close The Current Page</source>
         <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>Storage</name>
     <message>
-        <location filename="../storage/storage.cpp" line="87"/>
-        <source>Storage</source>
+        <location filename="../main.ui" line="469"/>
+        <source>Messages</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../storage/storage.cpp" line="83"/>
-        <source>Storage Name</source>
+        <location filename="../main.ui" line="472"/>
+        <source>Display any messages queued at the director</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../storage/storage.cpp" line="84"/>
-        <source>Storage Id</source>
+        <location filename="../main.ui" line="480"/>
+        <source>&Preferences ...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../storage/storage.cpp" line="84"/>
-        <source>Auto Changer</source>
+        <location filename="../main.ui" line="483"/>
+        <location filename="../main.ui" line="486"/>
+        <source>Set Preferences</source>
         <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>StorageForm</name>
     <message>
-        <location filename="../storage/storage.ui" line="13"/>
-        <source>Storage Tree</source>
+        <location filename="../main.ui" line="495"/>
+        <source>bat &Help</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../storage/storage.ui" line="31"/>
-        <source>Refresh Storage List</source>
+        <location filename="../main.ui" line="507"/>
+        <source>Browse</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../storage/storage.ui" line="34"/>
-        <source>Requery the director for the list of storage objects.</source>
+        <location filename="../main.ui" line="510"/>
+        <location filename="../main.ui" line="513"/>
+        <source>Browse Cataloged Files</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../storage/storage.ui" line="45"/>
-        <source>Status Storage In Console</source>
+        <location filename="../main.ui" line="522"/>
+        <source>JobPlot</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../storage/storage.ui" line="56"/>
-        <source>Label Storage</source>
+        <location filename="../main.ui" line="525"/>
+        <location filename="../main.ui" line="528"/>
+        <source>Plot Job Files and Bytes</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../storage/storage.ui" line="67"/>
-        <source>MountStorage</source>
+        <location filename="../main.ui" line="537"/>
+        <source>Status Dir Page</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../storage/storage.ui" line="78"/>
-        <source>UnMount Storage</source>
+        <location filename="../main.ui" line="540"/>
+        <source>Director Status Page</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../storage/storage.ui" line="89"/>
-        <source>Update Slots</source>
+        <location filename="../main.ui" line="549"/>
+        <source>Repop Lists</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../storage/storage.ui" line="100"/>
-        <source>Update Slots Scan</source>
+        <location filename="../main.ui" line="558"/>
+        <source>Reload and Repop</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../storage/storage.ui" line="108"/>
-        <source>Release</source>
+        <location filename="../main.ui" line="567"/>
+        <source>back</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../main.ui" line="570"/>
+        <location filename="../main.ui" line="573"/>
+        <source>Previous Page</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
-    <name>bRestoreForm</name>
+    <name>MainWin</name>
     <message>
-        <location filename="../restore/brestore.ui" line="13"/>
-        <source>brestore</source>
+        <location filename="../mainwin.cpp" line="70"/>
+        <source>Select Page</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/brestore.ui" line="41"/>
-        <source>File list</source>
+        <location filename="../mainwin.cpp" line="146"/>
+        <source>Console</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/brestore.ui" line="217"/>
-        <source>Type</source>
+        <location filename="../mainwin.cpp" line="574"/>
+        <source>Director Status</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/brestore.ui" line="67"/>
-        <source>File Name</source>
+        <location filename="../mainwin.cpp" line="616"/>
+        <source>Director not connected. Click on connect button.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/brestore.ui" line="242"/>
-        <source>Size</source>
+        <location filename="../mainwin.cpp" line="627"/>
+        <source>About bat</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/brestore.ui" line="135"/>
-        <source>Date</source>
+        <location filename="../mainwin.cpp" line="628"/>
+        <source><br><h2>Bacula Bat %1 (%2)</h2><p>Copyright &copy; 2007-%3 Kern Sibbald<p>The <b>bat</b> is an administrative console interface to the Director.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/brestore.ui" line="94"/>
-        <source>File revisions</source>
+        <location filename="../mainwin.cpp" line="651"/>
+        <source> Ready</source>
         <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>MediaEdit</name>
     <message>
-        <location filename="../restore/brestore.ui" line="115"/>
-        <source>InChanger</source>
+        <location filename="../mediaedit/mediaedit.cpp" line="36"/>
+        <source>Media Edit</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/brestore.ui" line="120"/>
-        <source>Volume</source>
+        <location filename="../mediaedit/mediaedit.cpp" line="183"/>
+        <source>No Volume name</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/brestore.ui" line="227"/>
-        <source>JobId</source>
+        <location filename="../mediaedit/mediaedit.cpp" line="183"/>
+        <source>No Volume name given</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>MediaInfo</name>
+    <message>
+        <location filename="../mediainfo/mediainfo.cpp" line="36"/>
+        <source>Media Info</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../mediainfo/mediainfo.cpp" line="73"/>
+        <source>Are you sure you want to purge ??  !!!.
+The Purge command will delete associated Catalog database records from Jobs and Volumes without considering the retention period. Purge  works only on the Catalog database and does not affect data written to Volumes. This command can be dangerous because you can delete catalog records associated with current backups of files, and we recommend that you do not use it unless you know what you are doing.
+Press OK to proceed with the purge operation?</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../mediainfo/mediainfo.cpp" line="92"/>
+        <source>Are you sure you want to delete??  !!!.
+This delete command is used to delete a Volume record and all associated catalog records that were created. This command operates only on the Catalog database and has no effect on the actual data written to a Volume. This command can be dangerous and we strongly recommend that you do not use it unless you know what you are doing.  All Jobs and all associated records (File and JobMedia) will be deleted from the catalog.Press OK to proceed with delete operation.?</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>MediaList</name>
+    <message>
+        <location filename="../medialist/medialist.cpp" line="76"/>
+        <source>Volume Name</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/medialist.cpp" line="76"/>
+        <source>Id</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/medialist.cpp" line="76"/>
+        <source>Status</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/medialist.cpp" line="76"/>
+        <source>Enabled</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/medialist.cpp" line="76"/>
+        <source>Bytes</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/medialist.cpp" line="76"/>
+        <source>Files</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/medialist.cpp" line="77"/>
+        <source>Jobs</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/medialist.cpp" line="77"/>
+        <source>Retention</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/medialist.cpp" line="77"/>
+        <source>Media Type</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/medialist.cpp" line="77"/>
+        <source>Slot</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/medialist.cpp" line="77"/>
+        <source>Use Duration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/medialist.cpp" line="78"/>
+        <source>Max Jobs</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/medialist.cpp" line="78"/>
+        <source>Max Files</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/medialist.cpp" line="78"/>
+        <source>Max Bytes</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/medialist.cpp" line="78"/>
+        <source>Recycle</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/medialist.cpp" line="79"/>
+        <source>Last Written</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/medialist.cpp" line="40"/>
+        <location filename="../medialist/medialist.cpp" line="87"/>
+        <source>Pools</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/medialist.cpp" line="79"/>
+        <source>First Written</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/medialist.cpp" line="79"/>
+        <source>Read Time</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/medialist.cpp" line="80"/>
+        <source>Write Time</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/medialist.cpp" line="80"/>
+        <source>Recycle Count</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/medialist.cpp" line="80"/>
+        <source>Recycle Pool</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/medialist.cpp" line="370"/>
+        <source>Are you sure you want to delete??  !!!.
+This delete command is used to delete a Volume record and all associated catalog records that were created. This command operates only on the Catalog database and has no effect on the actual data written to a Volume. This command can be dangerous and we strongly recommend that you do not use it unless you know what you are doing.  All Jobs and all associated records (File and JobMedia) will be deleted from the catalog.Press OK to proceed with delete operation.?</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/medialist.cpp" line="392"/>
+        <source>Are you sure you want to purge ??  !!!.
+The Purge command will delete associated Catalog database records from Jobs and Volumes without considering the retention period. Purge  works only on the Catalog database and does not affect data written to Volumes. This command can be dangerous because you can delete catalog records associated with current backups of files, and we recommend that you do not use it unless you know what you are doing.
+Press OK to proceed with the purge operation?</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>MediaListForm</name>
+    <message>
+        <location filename="../medialist/medialist.ui" line="13"/>
+        <source>Media Tree</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/medialist.ui" line="31"/>
+        <source>Refresh Media List</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/medialist.ui" line="34"/>
+        <source>Requery the director for the list of media.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/medialist.ui" line="42"/>
+        <source>Edit Volume</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/medialist.ui" line="50"/>
+        <source>List Jobs On Volume</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/medialist.ui" line="58"/>
+        <source>Delete Volume</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/medialist.ui" line="66"/>
+        <source>Prune Volume</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/medialist.ui" line="74"/>
+        <source>Purge Volume</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/medialist.ui" line="82"/>
+        <source>Relabel Volume</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/medialist.ui" line="90"/>
+        <location filename="../medialist/medialist.ui" line="93"/>
+        <location filename="../medialist/medialist.ui" line="96"/>
+        <location filename="../medialist/medialist.ui" line="99"/>
+        <source>Update all Volumes From Pool</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/medialist.ui" line="107"/>
+        <location filename="../medialist/medialist.ui" line="110"/>
+        <location filename="../medialist/medialist.ui" line="113"/>
+        <location filename="../medialist/medialist.ui" line="116"/>
+        <source>Update all Volumes from all Pools</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/medialist.ui" line="124"/>
+        <source>Volume From Pool</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>MediaView</name>
+    <message>
+        <location filename="../medialist/mediaview.cpp" line="33"/>
+        <source>Media</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/mediaview.cpp" line="84"/>
+        <source>Are you sure you want to purge ??  !!!.
+The Purge command will delete associated Catalog database records from Jobs and Volumes without considering the retention period. Purge  works only on the Catalog database and does not affect data written to Volumes. This command can be dangerous because you can delete catalog records associated with current backups of files, and we recommend that you do not use it unless you know what you are doing.
+Press OK to proceed with the purge operation?</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/mediaview.cpp" line="157"/>
+        <source>Are you sure you want to delete??  !!!.
+This delete command is used to delete a Volume record and all associated catalog records that were created. This command operates only on the Catalog database and has no effect on the actual data written to a Volume. This command can be dangerous and we strongly recommend that you do not use it unless you know what you are doing.  All Jobs and all associated records (File and JobMedia) will be deleted from the catalog.Press OK to proceed with delete operation.?</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>MediaViewForm</name>
+    <message>
+        <location filename="../medialist/mediaview.ui" line="14"/>
+        <source>Form</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/mediaview.ui" line="22"/>
+        <source>Edit</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/mediaview.ui" line="36"/>
+        <source>Purge</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/mediaview.ui" line="50"/>
+        <source>Delete</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/mediaview.ui" line="64"/>
+        <source>Prune</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/mediaview.ui" line="93"/>
+        <source>Filter</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/mediaview.ui" line="99"/>
+        <source>Media Type:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/mediaview.ui" line="109"/>
+        <source>Status:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/mediaview.ui" line="119"/>
+        <source>Limit:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/mediaview.ui" line="139"/>
+        <source>Name:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/mediaview.ui" line="169"/>
+        <source>Pool:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/mediaview.ui" line="179"/>
+        <source>Location:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/mediaview.ui" line="189"/>
+        <source>Expired</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/mediaview.ui" line="209"/>
+        <source>Apply</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/mediaview.ui" line="233"/>
+        <source> Volume Name </source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/mediaview.ui" line="238"/>
+        <source>Online</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/mediaview.ui" line="243"/>
+        <source>Slot</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/mediaview.ui" line="248"/>
+        <source>Vol Bytes</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/mediaview.ui" line="253"/>
+        <source>Vol Usage</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/mediaview.ui" line="258"/>
+        <source>Vol Status</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/mediaview.ui" line="263"/>
+        <source>Pool</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/mediaview.ui" line="268"/>
+        <source>Media Type</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/mediaview.ui" line="273"/>
+        <source>Last Written</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../medialist/mediaview.ui" line="278"/>
+        <source>When expire?</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>Pages</name>
+    <message>
+        <location filename="../pages.cpp" line="349"/>
+        <source>%1 of Director %2</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../pages.cpp" line="378"/>
+        <source>UnDock %1 Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../pages.cpp" line="380"/>
+        <source>ReDock %1 Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../pages.cpp" line="395"/>
+        <source>Console</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>PrefsForm</name>
+    <message>
+        <location filename="../prefs.ui" line="19"/>
+        <source>Preferences</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="68"/>
+        <source>Messages Options</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="80"/>
+        <source>Message check interval in seconds</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="93"/>
+        <source>Check Messages</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="113"/>
+        <source>Joblist</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="143"/>
+        <source>Joblist Limit Options</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="187"/>
+        <source>Days Limit</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="220"/>
+        <source>Record Limit</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="233"/>
+        <source>Misc</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="245"/>
+        <source>Convert</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="257"/>
+        <source>Convert Off</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="297"/>
+        <source>Context Sensitive List Commands</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="321"/>
+        <source>Execute Long List</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="349"/>
+        <source>Open Plot page on startup</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="362"/>
+        <source>Open Browser page on startup</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="375"/>
+        <source>Open Director Status page on startup</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="382"/>
+        <source>Debug</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="412"/>
+        <location filename="../prefs.ui" line="494"/>
+        <source>Debugging Options</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="418"/>
+        <source>Debug comm</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="432"/>
+        <source>Display all messages in console</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="446"/>
+        <source>Debug Commands</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="439"/>
+        <source>Debug Sql queries</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="50"/>
+        <source>Timers</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="270"/>
+        <source>Display Bytes using IEC units (1024B = 1 KiB)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="283"/>
+        <source>Display Bytes using SI units (1000B = 1KB)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="337"/>
+        <source>Open Pages</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="425"/>
+        <source>Debug multiple connection</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="453"/>
+        <source>Debug Miscelaneous Items</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="464"/>
+        <source>RestoreTree</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="538"/>
+        <source>Restore Debug 2</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="545"/>
+        <source>Directory Item Changed</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="552"/>
+        <source>Restore Debug 1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="559"/>
+        <source>Directory Current Item Changed Debug</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="566"/>
+        <source>Update File Table Debug</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="573"/>
+        <source>Version Table Item Changed Debug</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="580"/>
+        <source>File Table Item Changed Debug</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="587"/>
+        <source>Icon State Debug</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="594"/>
+        <source>Update Checks Debug</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="601"/>
+        <source>Restore Debug 3</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="608"/>
+        <source>Update Version Table Debug</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="615"/>
+        <source>Populate Directory Debug</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../prefs.ui" line="677"/>
+        <source><h2>Preferences</h2></source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>QObject</name>
+    <message>
+        <location filename="../util/comboutil.cpp" line="34"/>
+        <source>Any</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../util/comboutil.cpp" line="61"/>
+        <location filename="../util/fmtwidgetitem.cpp" line="261"/>
+        <location filename="../util/fmtwidgetitem.cpp" line="269"/>
+        <source>No</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../util/comboutil.cpp" line="62"/>
+        <location filename="../util/fmtwidgetitem.cpp" line="259"/>
+        <location filename="../util/fmtwidgetitem.cpp" line="267"/>
+        <source>Yes</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../util/fmtwidgetitem.cpp" line="46"/>
+        <source>Invalid job status %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>StorStat</name>
+    <message>
+        <location filename="../status/storstat.cpp" line="53"/>
+        <source>Storage Status %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/storstat.cpp" line="231"/>
+        <source>Job Id</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/storstat.cpp" line="231"/>
+        <source>Job Level</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/storstat.cpp" line="231"/>
+        <source>Job Files</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/storstat.cpp" line="232"/>
+        <source>Job Bytes</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/storstat.cpp" line="232"/>
+        <source>Job Status</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/storstat.cpp" line="232"/>
+        <source>Job Time</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/storstat.cpp" line="233"/>
+        <source>Job Name</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>StorStatForm</name>
+    <message>
+        <location filename="../status/storstat.ui" line="13"/>
+        <source>Form</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/storstat.ui" line="30"/>
+        <source>Header</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/storstat.ui" line="40"/>
+        <source>Waitreservation</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/storstat.ui" line="50"/>
+        <source>Devices</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/storstat.ui" line="60"/>
+        <source>Volumes</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/storstat.ui" line="70"/>
+        <source>Spooling</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/storstat.ui" line="80"/>
+        <source>Running</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/storstat.ui" line="90"/>
+        <source>Misc</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/storstat.ui" line="105"/>
+        <source>Mount</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/storstat.ui" line="112"/>
+        <source>UMount</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/storstat.ui" line="119"/>
+        <source>Label</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/storstat.ui" line="126"/>
+        <source>Release</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/storstat.ui" line="150"/>
+        <source>Refresh Timer</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/storstat.ui" line="178"/>
+        <source>Do Refresh</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/storstat.ui" line="203"/>
+        <source><html><head><meta name="qrichtext" content="1" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:13pt; font-weight:600;">Terminated Jobs</span></p></body></html></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/storstat.ui" line="226"/>
+        <source>Refresh</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/storstat.ui" line="234"/>
+        <source>Cancel Running Job</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../status/storstat.ui" line="242"/>
+        <source>Disable Scheduled Job</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>Storage</name>
+    <message>
+        <location filename="../storage/storage.cpp" line="39"/>
+        <location filename="../storage/storage.cpp" line="81"/>
+        <source>Storage</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/storage.cpp" line="76"/>
+        <source>Name</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/storage.cpp" line="76"/>
+        <source>Id</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/storage.cpp" line="77"/>
+        <source>Changer</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/storage.cpp" line="77"/>
+        <source>Slot</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/storage.cpp" line="77"/>
+        <source>Status</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/storage.cpp" line="77"/>
+        <source>Enabled</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/storage.cpp" line="77"/>
+        <source>Pool</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/storage.cpp" line="78"/>
+        <source>Media Type</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/storage.cpp" line="258"/>
+        <source>Yes</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/storage.cpp" line="266"/>
+        <source>Status Storage "%1"</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/storage.cpp" line="268"/>
+        <source>Status Storage "%1" in Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/storage.cpp" line="270"/>
+        <source>Label media in Storage "%1"</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/storage.cpp" line="272"/>
+        <source>Mount media in Storage "%1"</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/storage.cpp" line="274"/>
+        <source>"UN" Mount media in Storage "%1"</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/storage.cpp" line="275"/>
+        <source>Release media in Storage "%1"</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/storage.cpp" line="280"/>
+        <source>Barcode Scan media in Storage "%1"</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/storage.cpp" line="282"/>
+        <source>Read scan media in Storage "%1"</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/storage.cpp" line="418"/>
+        <source>Storage Status %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>StorageForm</name>
+    <message>
+        <location filename="../storage/storage.ui" line="13"/>
+        <source>Storage Tree</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/storage.ui" line="38"/>
+        <source>1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/storage.ui" line="49"/>
+        <source>Refresh Storage List</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/storage.ui" line="52"/>
+        <source>Requery the director for the list of storage objects.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/storage.ui" line="60"/>
+        <location filename="../storage/storage.ui" line="63"/>
+        <source>Status Storage In Console</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/storage.ui" line="71"/>
+        <location filename="../storage/storage.ui" line="74"/>
+        <source>Label Storage</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/storage.ui" line="82"/>
+        <location filename="../storage/storage.ui" line="85"/>
+        <source>MountStorage</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/storage.ui" line="93"/>
+        <location filename="../storage/storage.ui" line="96"/>
+        <source>UnMount Storage</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/storage.ui" line="104"/>
+        <location filename="../storage/storage.ui" line="107"/>
+        <source>Update Slots</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/storage.ui" line="115"/>
+        <location filename="../storage/storage.ui" line="118"/>
+        <source>Update Slots Scan</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/storage.ui" line="126"/>
+        <source>Release</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../storage/storage.ui" line="134"/>
+        <source>Status Storage Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>bRestore</name>
+    <message>
+        <location filename="../restore/brestore.cpp" line="32"/>
+        <source>bRestore</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>bRestoreForm</name>
+    <message>
+        <location filename="../restore/brestore.ui" line="14"/>
+        <source>brestore</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/brestore.ui" line="82"/>
+        <source>Merge Jobs</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/brestore.ui" line="92"/>
+        <source>View all Versions</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/brestore.ui" line="99"/>
+        <source>Current Directory</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/brestore.ui" line="138"/>
+        <source>File list -- drag below for restore</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/brestore.ui" line="150"/>
+        <source>Double Click File Name to decend</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/brestore.ui" line="178"/>
+        <location filename="../restore/brestore.ui" line="542"/>
+        <source>Type</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/brestore.ui" line="183"/>
+        <source>File Name</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/brestore.ui" line="186"/>
+        <source>Double Click to decend</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/brestore.ui" line="191"/>
+        <location filename="../restore/brestore.ui" line="430"/>
+        <location filename="../restore/brestore.ui" line="552"/>
+        <source>Size</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/brestore.ui" line="196"/>
+        <location filename="../restore/brestore.ui" line="435"/>
+        <location filename="../restore/brestore.ui" line="557"/>
+        <source>Date</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/brestore.ui" line="209"/>
+        <source>Selection Range</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/brestore.ui" line="264"/>
+        <source>-</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/brestore.ui" line="329"/>
+        <source>File Filter </source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/brestore.ui" line="378"/>
+        <source>File revisions -- drag below for restore</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/brestore.ui" line="467"/>
+        <source><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html><head><meta name="qrichtext" content="1" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Drag and drop <span style=" font-weight:600;">File list</span> and/or <span style=" font-weight:600;">File revisions</span> items here for Restore</p></body></html></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/brestore.ui" line="508"/>
+        <source>Restore...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/brestore.ui" line="584"/>
+        <source>Select from Client list drop down then select from Job list drop down</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/brestore.ui" line="415"/>
+        <source>InChanger</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/brestore.ui" line="420"/>
+        <source>Volume</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/brestore.ui" line="425"/>
+        <location filename="../restore/brestore.ui" line="562"/>
+        <source>JobId</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/brestore.ui" line="440"/>
+        <source>Chksum</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/brestore.ui" line="491"/>
+        <source>Clear</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/brestore.ui" line="501"/>
+        <source>Estimate</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/brestore.ui" line="547"/>
+        <source>FileName</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/brestore.ui" line="567"/>
+        <source>FileIndex</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/brestore.ui" line="572"/>
+        <source>Nb Files</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>bRunRestoreForm</name>
+    <message>
+        <location filename="../restore/runrestore.ui" line="14"/>
+        <source>Run restore</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/runrestore.ui" line="24"/>
+        <source>Standard</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/runrestore.ui" line="30"/>
+        <source>Restore options</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/runrestore.ui" line="39"/>
+        <source>Client:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/runrestore.ui" line="52"/>
+        <source>Where:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/runrestore.ui" line="65"/>
+        <source>Replace:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/runrestore.ui" line="78"/>
+        <source>Comment:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/runrestore.ui" line="94"/>
+        <source>Media needed</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/runrestore.ui" line="107"/>
+        <source>InChanger</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/runrestore.ui" line="112"/>
+        <source>Volume</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/runrestore.ui" line="120"/>
+        <source>Compute with directories</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/runrestore.ui" line="134"/>
+        <source>Advanced</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/runrestore.ui" line="140"/>
+        <source>File Relocation</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/runrestore.ui" line="146"/>
+        <source>Use file 
+relocation:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/runrestore.ui" line="161"/>
+        <source>Strip prefix:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/runrestore.ui" line="175"/>
+        <source>Add prefix:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/runrestore.ui" line="189"/>
+        <source>Add suffix:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/runrestore.ui" line="203"/>
+        <source>Use regexp:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/runrestore.ui" line="220"/>
+        <source>Where 
+regexp:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/runrestore.ui" line="238"/>
+        <source>Other options</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/runrestore.ui" line="244"/>
+        <source>When:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/runrestore.ui" line="251"/>
+        <source>Priority:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/runrestore.ui" line="265"/>
+        <source>Storage:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/runrestore.ui" line="289"/>
+        <source>Job:</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>estimateForm</name>
+    <message>
+        <location filename="../run/estimate.ui" line="13"/>
+        <source>Form</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../run/estimate.ui" line="44"/>
+        <source>List Files</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../run/estimate.ui" line="77"/>
+        <source>Level:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../run/estimate.ui" line="93"/>
+        <source>Client:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../run/estimate.ui" line="112"/>
+        <source>Job:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../run/estimate.ui" line="122"/>
+        <source>FileSet:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../run/estimate.ui" line="161"/>
+        <source><h3>Estimate a backup Job</h3></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../run/estimate.ui" line="204"/>
+        <source>OK</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../run/estimate.ui" line="211"/>
+        <source>Cancel</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>estimatePage</name>
+    <message>
+        <location filename="../run/estimate.cpp" line="36"/>
+        <source>Estimate</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>helpForm</name>
+    <message>
+        <location filename="../help/help.ui" line="13"/>
+        <source>Form</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../help/help.ui" line="36"/>
+        <source>&Home</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../help/help.ui" line="43"/>
+        <source>&Back</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../help/help.ui" line="63"/>
+        <source>Close</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>jobsForm</name>
+    <message>
+        <location filename="../jobs/jobs.ui" line="13"/>
+        <source>Client Tree</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../jobs/jobs.ui" line="25"/>
+        <source>Refresh Jobs List</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../jobs/jobs.ui" line="28"/>
+        <source>Requery the director for the list of clients.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../jobs/jobs.ui" line="36"/>
+        <location filename="../jobs/jobs.ui" line="39"/>
+        <location filename="../jobs/jobs.ui" line="42"/>
+        <location filename="../jobs/jobs.ui" line="45"/>
+        <source>List Files Command</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../jobs/jobs.ui" line="53"/>
+        <location filename="../jobs/jobs.ui" line="56"/>
+        <location filename="../jobs/jobs.ui" line="59"/>
+        <location filename="../jobs/jobs.ui" line="62"/>
+        <source>List Volumes Command</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../jobs/jobs.ui" line="70"/>
+        <location filename="../jobs/jobs.ui" line="73"/>
+        <location filename="../jobs/jobs.ui" line="76"/>
+        <location filename="../jobs/jobs.ui" line="79"/>
+        <source>List Next Volume Command</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../jobs/jobs.ui" line="87"/>
+        <location filename="../jobs/jobs.ui" line="90"/>
+        <location filename="../jobs/jobs.ui" line="93"/>
+        <location filename="../jobs/jobs.ui" line="96"/>
+        <source>Enable Job Command</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../jobs/jobs.ui" line="104"/>
+        <location filename="../jobs/jobs.ui" line="107"/>
+        <location filename="../jobs/jobs.ui" line="110"/>
+        <location filename="../jobs/jobs.ui" line="113"/>
+        <source>Disable Job Command</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../jobs/jobs.ui" line="121"/>
+        <location filename="../jobs/jobs.ui" line="124"/>
+        <location filename="../jobs/jobs.ui" line="127"/>
+        <location filename="../jobs/jobs.ui" line="130"/>
+        <source>Open JobList on Job</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../jobs/jobs.ui" line="138"/>
+        <location filename="../jobs/jobs.ui" line="141"/>
+        <source>Cancel Job Command</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../jobs/jobs.ui" line="149"/>
+        <source>RunJob</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>labelForm</name>
+    <message>
+        <location filename="../label/label.ui" line="17"/>
+        <source>Form</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../label/label.ui" line="90"/>
+        <source>OK</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../label/label.ui" line="100"/>
+        <source>Cancel</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../label/label.ui" line="109"/>
+        <source>Volume Name:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../label/label.ui" line="122"/>
+        <source>Storage:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../label/label.ui" line="141"/>
+        <source>Enter Name of Volume to create</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../label/label.ui" line="155"/>
+        <source>Slot:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../label/label.ui" line="173"/>
+        <source>Execute Automount</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../label/label.ui" line="180"/>
+        <source>On</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../label/label.ui" line="187"/>
+        <source>Off</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../label/label.ui" line="212"/>
+        <source>Pool:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../label/label.ui" line="249"/>
+        <source><html><head><meta name="qrichtext" content="1" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600;">Label a Volume</span></p></body></html></source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>mediaEditForm</name>
+    <message>
+        <location filename="../mediaedit/mediaedit.ui" line="13"/>
+        <source>Form</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../mediaedit/mediaedit.ui" line="33"/>
+        <source>Pool:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../mediaedit/mediaedit.ui" line="43"/>
+        <source>Volume Status:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../mediaedit/mediaedit.ui" line="50"/>
+        <source>Max Volume Bytes:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../mediaedit/mediaedit.ui" line="66"/>
+        <source>Slot:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../mediaedit/mediaedit.ui" line="76"/>
+        <source>Max Volume Jobs:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../mediaedit/mediaedit.ui" line="86"/>
+        <source>Use Duration:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../mediaedit/mediaedit.ui" line="117"/>
+        <source>OK</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../mediaedit/mediaedit.ui" line="124"/>
+        <source>Cancel</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../mediaedit/mediaedit.ui" line="140"/>
+        <source>Retention:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../mediaedit/mediaedit.ui" line="150"/>
+        <source>Recycle Pool:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../mediaedit/mediaedit.ui" line="171"/>
+        <source>Enabled</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../mediaedit/mediaedit.ui" line="200"/>
+        <source>Max Volume Files:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../mediaedit/mediaedit.ui" line="241"/>
+        <source>Years</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../mediaedit/mediaedit.ui" line="248"/>
+        <source>Seconds</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../mediaedit/mediaedit.ui" line="265"/>
+        <source>Use Duration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../mediaedit/mediaedit.ui" line="285"/>
+        <source>Days</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../mediaedit/mediaedit.ui" line="302"/>
+        <source>Hours</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../mediaedit/mediaedit.ui" line="309"/>
+        <source>Months</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/brestore.ui" line="140"/>
-        <source>Chksum</source>
+        <location filename="../mediaedit/mediaedit.ui" line="339"/>
+        <source>Retention</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/brestore.ui" line="167"/>
-        <source><html><head><meta name="qrichtext" content="1" /><style type="text/css">
-p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Restore items list</span></p></body></html></source>
+        <location filename="../mediaedit/mediaedit.ui" line="356"/>
+        <source>Minutes</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/brestore.ui" line="190"/>
-        <source>Clear</source>
+        <location filename="../mediaedit/mediaedit.ui" line="399"/>
+        <source>Volume : </source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/brestore.ui" line="197"/>
-        <source>Estimate</source>
+        <location filename="../mediaedit/mediaedit.ui" line="442"/>
+        <source>Recycle</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/brestore.ui" line="204"/>
-        <source>Restore</source>
+        <location filename="../mediaedit/mediaedit.ui" line="491"/>
+        <source><html><head><meta name="qrichtext" content="1" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600;">Edit a Volume</span></p></body></html></source>
         <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>mediaInfoForm</name>
     <message>
-        <location filename="../restore/brestore.ui" line="222"/>
-        <source>FileName</source>
+        <location filename="../mediainfo/mediainfo.ui" line="13"/>
+        <source>Form</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/brestore.ui" line="232"/>
-        <source>FileIndex</source>
+        <location filename="../mediainfo/mediainfo.ui" line="21"/>
+        <source>Edit</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/brestore.ui" line="237"/>
-        <source>Nb Files</source>
+        <location filename="../mediainfo/mediainfo.ui" line="35"/>
+        <source>Purge</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/brestore.ui" line="288"/>
-        <source>Location</source>
+        <location filename="../mediainfo/mediainfo.ui" line="49"/>
+        <source>Delete</source>
         <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>estimateForm</name>
     <message>
-        <location filename="../run/estimate.ui" line="13"/>
-        <source>Form</source>
+        <location filename="../mediainfo/mediainfo.ui" line="63"/>
+        <source>Prune</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../run/estimate.ui" line="44"/>
-        <source>List Files</source>
+        <location filename="../mediainfo/mediainfo.ui" line="80"/>
+        <source>Load</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../run/estimate.ui" line="77"/>
-        <source>Level:</source>
+        <location filename="../mediainfo/mediainfo.ui" line="97"/>
+        <source>Unload</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../run/estimate.ui" line="93"/>
-        <source>Client:</source>
+        <location filename="../mediainfo/mediainfo.ui" line="149"/>
+        <source>Information</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../run/estimate.ui" line="112"/>
-        <source>Job:</source>
+        <location filename="../mediainfo/mediainfo.ui" line="155"/>
+        <source>Name:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../run/estimate.ui" line="122"/>
-        <source>FileSet:</source>
+        <location filename="../mediainfo/mediainfo.ui" line="162"/>
+        <source>Vol0001</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../run/estimate.ui" line="161"/>
-        <source><h3>Estimate a backup Job</h3></source>
+        <location filename="../mediainfo/mediainfo.ui" line="172"/>
+        <source>Pool:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../run/estimate.ui" line="204"/>
-        <source>OK</source>
+        <location filename="../mediainfo/mediainfo.ui" line="179"/>
+        <source>Default</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../run/estimate.ui" line="211"/>
-        <source>Cancel</source>
+        <location filename="../mediainfo/mediainfo.ui" line="189"/>
+        <source>Online:</source>
         <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>estimatePage</name>
     <message>
-        <location filename="../run/estimate.cpp" line="47"/>
-        <source>Estimate</source>
+        <location filename="../mediainfo/mediainfo.ui" line="206"/>
+        <source>Enabled:</source>
         <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>helpForm</name>
     <message>
-        <location filename="../help/help.ui" line="13"/>
-        <source>Form</source>
+        <location filename="../mediainfo/mediainfo.ui" line="213"/>
+        <source>yes</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../help/help.ui" line="36"/>
-        <source>&Home</source>
+        <location filename="../mediainfo/mediainfo.ui" line="220"/>
+        <source>Location:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../help/help.ui" line="43"/>
-        <source>&Back</source>
+        <location filename="../mediainfo/mediainfo.ui" line="227"/>
+        <source>Vault</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../help/help.ui" line="63"/>
-        <source>Close</source>
+        <location filename="../mediainfo/mediainfo.ui" line="237"/>
+        <source>Status:</source>
         <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>jobsForm</name>
     <message>
-        <location filename="../jobs/jobs.ui" line="13"/>
-        <source>Client Tree</source>
+        <location filename="../mediainfo/mediainfo.ui" line="244"/>
+        <source>Append</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobs/jobs.ui" line="31"/>
-        <source>Refresh Jobs List</source>
+        <location filename="../mediainfo/mediainfo.ui" line="254"/>
+        <source>Media Type:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobs/jobs.ui" line="34"/>
-        <source>Requery the director for the list of clients.</source>
+        <location filename="../mediainfo/mediainfo.ui" line="261"/>
+        <source>File</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobs/jobs.ui" line="51"/>
-        <source>List Files Command</source>
+        <location filename="../mediainfo/mediainfo.ui" line="271"/>
+        <source>Recycle Pool:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobs/jobs.ui" line="68"/>
-        <source>List Volumes Command</source>
+        <location filename="../mediainfo/mediainfo.ui" line="278"/>
+        <source>Scratch</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobs/jobs.ui" line="85"/>
-        <source>List Next Volume Command</source>
+        <location filename="../mediainfo/mediainfo.ui" line="309"/>
+        <source>Statistics</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobs/jobs.ui" line="102"/>
-        <source>Enable Job Command</source>
+        <location filename="../mediainfo/mediainfo.ui" line="315"/>
+        <source>Vol Bytes:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobs/jobs.ui" line="119"/>
-        <source>Disable Job Command</source>
+        <location filename="../mediainfo/mediainfo.ui" line="322"/>
+        <source>19.8 MB</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobs/jobs.ui" line="136"/>
-        <source>Open JobList on Job</source>
+        <location filename="../mediainfo/mediainfo.ui" line="332"/>
+        <source>Vol Mounts:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobs/jobs.ui" line="147"/>
-        <source>Cancel Job Command</source>
+        <location filename="../mediainfo/mediainfo.ui" line="339"/>
+        <source>10</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobs/jobs.ui" line="155"/>
-        <source>RunJob</source>
+        <location filename="../mediainfo/mediainfo.ui" line="349"/>
+        <source>Recycle count:</source>
         <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>labelForm</name>
     <message>
-        <location filename="../label/label.ui" line="13"/>
-        <source>Form</source>
+        <location filename="../mediainfo/mediainfo.ui" line="356"/>
+        <source>5</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../label/label.ui" line="86"/>
-        <source>OK</source>
+        <location filename="../mediainfo/mediainfo.ui" line="366"/>
+        <source>Read time:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../label/label.ui" line="93"/>
-        <source>Cancel</source>
+        <location filename="../mediainfo/mediainfo.ui" line="373"/>
+        <source>10 mins</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../label/label.ui" line="102"/>
-        <source>Volume Name:</source>
+        <location filename="../mediainfo/mediainfo.ui" line="383"/>
+        <source>Write time:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../label/label.ui" line="115"/>
-        <source>Storage:</source>
+        <location filename="../mediainfo/mediainfo.ui" line="390"/>
+        <source>20 mins</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../label/label.ui" line="142"/>
-        <source>Slot:</source>
+        <location filename="../mediainfo/mediainfo.ui" line="400"/>
+        <source>Errors:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../label/label.ui" line="160"/>
-        <source>Execute Automount</source>
+        <location filename="../mediainfo/mediainfo.ui" line="407"/>
+        <location filename="../mediainfo/mediainfo.ui" line="485"/>
+        <location filename="../mediainfo/mediainfo.ui" line="502"/>
+        <location filename="../mediainfo/mediainfo.ui" line="519"/>
+        <location filename="../mediainfo/mediainfo.ui" line="536"/>
+        <source>0</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../label/label.ui" line="167"/>
-        <source>On</source>
+        <location filename="../mediainfo/mediainfo.ui" line="417"/>
+        <source>Last Written:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../label/label.ui" line="174"/>
-        <source>Off</source>
+        <location filename="../mediainfo/mediainfo.ui" line="424"/>
+        <source>2009-07-05 12:23:00</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../label/label.ui" line="199"/>
-        <source>Pool:</source>
+        <location filename="../mediainfo/mediainfo.ui" line="434"/>
+        <source>First Written:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../label/label.ui" line="236"/>
-        <source><html><head><meta name="qrichtext" content="1" /><style type="text/css">
-p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600;">Label a Volume</span></p></body></html></source>
+        <location filename="../mediainfo/mediainfo.ui" line="441"/>
+        <source>2009-06-05 10:00:00</source>
         <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>mediaEditForm</name>
     <message>
-        <location filename="../mediaedit/mediaedit.ui" line="13"/>
-        <source>Form</source>
+        <location filename="../mediainfo/mediainfo.ui" line="472"/>
+        <source>Limits</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../mediaedit/mediaedit.ui" line="33"/>
-        <source>Pool:</source>
+        <location filename="../mediainfo/mediainfo.ui" line="478"/>
+        <source>Use duration:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../mediaedit/mediaedit.ui" line="43"/>
-        <source>Volume Status:</source>
+        <location filename="../mediainfo/mediainfo.ui" line="495"/>
+        <source>Max jobs:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../mediaedit/mediaedit.ui" line="50"/>
-        <source>Max Volume Bytes:</source>
+        <location filename="../mediainfo/mediainfo.ui" line="512"/>
+        <source>Max files:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../mediaedit/mediaedit.ui" line="66"/>
-        <source>Slot:</source>
+        <location filename="../mediainfo/mediainfo.ui" line="529"/>
+        <source>Max bytes:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../mediaedit/mediaedit.ui" line="76"/>
-        <source>Max Volume Jobs:</source>
+        <location filename="../mediainfo/mediainfo.ui" line="546"/>
+        <source>Recycle:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../mediaedit/mediaedit.ui" line="86"/>
-        <source>Use Duration:</source>
+        <location filename="../mediainfo/mediainfo.ui" line="563"/>
+        <source>Retention:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../mediaedit/mediaedit.ui" line="117"/>
-        <source>OK</source>
+        <location filename="../mediainfo/mediainfo.ui" line="570"/>
+        <source>365 days</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../mediaedit/mediaedit.ui" line="124"/>
-        <source>Cancel</source>
+        <location filename="../mediainfo/mediainfo.ui" line="580"/>
+        <source>Expire:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../mediaedit/mediaedit.ui" line="140"/>
-        <source>Retension:</source>
+        <location filename="../mediainfo/mediainfo.ui" line="587"/>
+        <source>2010-08-03 23:10:03</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../mediaedit/mediaedit.ui" line="150"/>
-        <source>Recycle Pool:</source>
+        <location filename="../mediainfo/mediainfo.ui" line="621"/>
+        <source>Jobs</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../mediaedit/mediaedit.ui" line="171"/>
-        <source>Enabled</source>
+        <location filename="../mediainfo/mediainfo.ui" line="631"/>
+        <source>JobId</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../mediaedit/mediaedit.ui" line="200"/>
-        <source>Max Volume Files:</source>
+        <location filename="../mediainfo/mediainfo.ui" line="639"/>
+        <source>Name</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../mediaedit/mediaedit.ui" line="241"/>
-        <source>Years</source>
+        <location filename="../mediainfo/mediainfo.ui" line="647"/>
+        <source>Start Time</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../mediaedit/mediaedit.ui" line="248"/>
-        <source>Seconds</source>
+        <location filename="../mediainfo/mediainfo.ui" line="655"/>
+        <source>Type</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../mediaedit/mediaedit.ui" line="265"/>
-        <source>Use Duration</source>
+        <location filename="../mediainfo/mediainfo.ui" line="663"/>
+        <source>Level</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../mediaedit/mediaedit.ui" line="285"/>
-        <source>Days</source>
+        <location filename="../mediainfo/mediainfo.ui" line="671"/>
+        <source>Files</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../mediaedit/mediaedit.ui" line="302"/>
-        <source>Hours</source>
+        <location filename="../mediainfo/mediainfo.ui" line="679"/>
+        <source>Bytes</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../mediaedit/mediaedit.ui" line="309"/>
-        <source>Months</source>
+        <location filename="../mediainfo/mediainfo.ui" line="687"/>
+        <source>Status</source>
         <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>mountDialog</name>
     <message>
-        <location filename="../mediaedit/mediaedit.ui" line="339"/>
-        <source>Retention</source>
+        <location filename="../mount/mount.cpp" line="40"/>
+        <source>Storage : %1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../mediaedit/mediaedit.ui" line="356"/>
-        <source>Minutes</source>
+        <location filename="../mount/mount.cpp" line="48"/>
+        <source>No Storage name</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../mediaedit/mediaedit.ui" line="399"/>
-        <source>Volume : </source>
+        <location filename="../mount/mount.cpp" line="48"/>
+        <source>No Storage name given</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../mediaedit/mediaedit.ui" line="442"/>
-        <source>Recycle</source>
+        <location filename="../mount/mount.cpp" line="60"/>
+        <source>Context sensitive command :
+
+</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../mediaedit/mediaedit.ui" line="491"/>
-        <source><html><head><meta name="qrichtext" content="1" /><style type="text/css">
-p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600;">Edit a Volume</span></p></body></html></source>
+        <location filename="../mount/mount.cpp" line="63"/>
+        <source>Director Response :
+
+</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -2009,7 +3868,7 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>prefsDialog</name>
     <message>
-        <location filename="../mainwin.cpp" line="768"/>
+        <location filename="../mainwin.cpp" line="942"/>
         <source>Canceled</source>
         <translation type="unfinished"></translation>
     </message>
@@ -2095,50 +3954,53 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>prerestorePage</name>
     <message>
-        <location filename="../restore/prerestore.cpp" line="62"/>
+        <location filename="../restore/prerestore.cpp" line="49"/>
         <source>Restore</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/prerestore.cpp" line="76"/>
+        <location filename="../restore/prerestore.cpp" line="59"/>
+        <location filename="../restore/prerestore.cpp" line="135"/>
+        <location filename="../restore/prerestore.cpp" line="206"/>
         <source>Any</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/prerestore.cpp" line="104"/>
+        <location filename="../restore/prerestore.cpp" line="71"/>
+        <location filename="../restore/prerestore.cpp" line="87"/>
         <source>Comma separted list of Job Ids</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/prerestore.cpp" line="194"/>
+        <location filename="../restore/prerestore.cpp" line="187"/>
         <source>Canceled</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/prerestore.cpp" line="274"/>
+        <location filename="../restore/prerestore.cpp" line="268"/>
         <source>There can be no spaces in the text for the joblist.
 Press OK to continue?</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/prerestore.cpp" line="306"/>
+        <location filename="../restore/prerestore.cpp" line="300"/>
         <source>The string is not a comma separated list of integers.
 Press OK to continue?</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/prerestore.cpp" line="310"/>
+        <location filename="../restore/prerestore.cpp" line="305"/>
         <source>Bat</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/prerestore.cpp" line="312"/>
+        <location filename="../restore/prerestore.cpp" line="306"/>
         <source>At least one of the jobs is not a valid job of type "Backup".
 Press OK to continue?</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/prerestore.cpp" line="318"/>
+        <location filename="../restore/prerestore.cpp" line="312"/>
         <source>All jobs in the list must be of the same jobName and same client.
 Press OK to continue?</source>
         <translation type="unfinished"></translation>
@@ -2195,17 +4057,22 @@ Press OK to continue?</source>
 <context>
     <name>prunePage</name>
     <message>
-        <location filename="../run/prune.cpp" line="47"/>
+        <location filename="../run/prune.cpp" line="36"/>
         <source>Prune</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../run/prune.cpp" line="140"/>
+        <location filename="../run/prune.cpp" line="56"/>
+        <location filename="../run/prune.cpp" line="58"/>
+        <location filename="../run/prune.cpp" line="92"/>
+        <location filename="../run/prune.cpp" line="95"/>
+        <location filename="../run/prune.cpp" line="122"/>
+        <location filename="../run/prune.cpp" line="129"/>
         <source>Any</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../run/prune.cpp" line="124"/>
+        <location filename="../run/prune.cpp" line="113"/>
         <source> Canceled</source>
         <translation type="unfinished"></translation>
     </message>
@@ -2213,22 +4080,23 @@ Press OK to continue?</source>
 <context>
     <name>relabelDialog</name>
     <message>
-        <location filename="../relabel/relabel.cpp" line="53"/>
+        <location filename="../relabel/relabel.cpp" line="42"/>
         <source>From Volume : </source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../relabel/relabel.cpp" line="64"/>
+        <location filename="../relabel/relabel.cpp" line="80"/>
         <source>No Volume name</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../relabel/relabel.cpp" line="64"/>
+        <location filename="../relabel/relabel.cpp" line="80"/>
         <source>No Volume name given</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../relabel/relabel.cpp" line="70"/>
+        <location filename="../relabel/relabel.cpp" line="85"/>
+        <location filename="../relabel/relabel.cpp" line="86"/>
         <source>New name must be different</source>
         <translation type="unfinished"></translation>
     </message>
@@ -2282,87 +4150,94 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restore.ui" line="123"/>
+        <location filename="../restore/restore.ui" line="206"/>
+        <source>Select a Directory</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/restore.ui" line="216"/>
+        <source>Directories</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/restore.ui" line="256"/>
+        <location filename="../restore/restore.ui" line="261"/>
         <source>1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restore.ui" line="128"/>
+        <location filename="../restore/restore.ui" line="266"/>
         <source>2</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restore.ui" line="133"/>
+        <location filename="../restore/restore.ui" line="271"/>
         <source>3</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restore.ui" line="138"/>
+        <location filename="../restore/restore.ui" line="276"/>
         <source>4</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restore.ui" line="143"/>
+        <location filename="../restore/restore.ui" line="281"/>
         <source>5</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restore.ui" line="148"/>
+        <location filename="../restore/restore.ui" line="286"/>
         <source>6</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restore.ui" line="190"/>
-        <source><h2>Directories</h2></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../restore/restore.ui" line="219"/>
+        <location filename="../restore/restore.ui" line="41"/>
         <source><h3>Restore Select</h3></source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restore.ui" line="254"/>
+        <location filename="../restore/restore.ui" line="76"/>
         <source>Up</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restore.ui" line="469"/>
+        <location filename="../restore/restore.ui" line="98"/>
+        <location filename="../restore/restore.ui" line="384"/>
         <source>Mark</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restore.ui" line="298"/>
+        <location filename="../restore/restore.ui" line="120"/>
         <source>Unmark</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restore.ui" line="324"/>
+        <location filename="../restore/restore.ui" line="146"/>
         <source><h2>Files</h2></source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restore.ui" line="369"/>
+        <location filename="../restore/restore.ui" line="374"/>
         <source>Status:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restore.ui" line="414"/>
+        <location filename="../restore/restore.ui" line="303"/>
         <source>Current Dir:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restore.ui" line="450"/>
+        <location filename="../restore/restore.ui" line="352"/>
         <source>OK</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restore.ui" line="457"/>
+        <location filename="../restore/restore.ui" line="359"/>
         <source>Cancel</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restore.ui" line="477"/>
+        <location filename="../restore/restore.ui" line="392"/>
         <source>UnMark</source>
         <translation type="unfinished"></translation>
     </message>
@@ -2370,59 +4245,75 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>restorePage</name>
     <message>
-        <location filename="../restore/restore.cpp" line="46"/>
+        <location filename="../restore/restore.cpp" line="37"/>
         <source>Restore Select</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restore.cpp" line="74"/>
+        <location filename="../restore/restore.cpp" line="64"/>
         <source>Mark</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restore.cpp" line="74"/>
+        <location filename="../restore/restore.cpp" line="64"/>
         <source>File</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restore.cpp" line="74"/>
+        <location filename="../restore/restore.cpp" line="64"/>
         <source>Mode</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restore.cpp" line="75"/>
+        <location filename="../restore/restore.cpp" line="64"/>
         <source>User</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restore.cpp" line="75"/>
+        <location filename="../restore/restore.cpp" line="65"/>
         <source>Group</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restore.cpp" line="75"/>
+        <location filename="../restore/restore.cpp" line="65"/>
         <source>Size</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restore.cpp" line="75"/>
+        <location filename="../restore/restore.cpp" line="65"/>
         <source>Date</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restore.cpp" line="189"/>
-        <source>In addDirectory cwd "%1" newdir "%2"
+        <location filename="../restore/restore.cpp" line="188"/>
+        <source>In addDirectory cwd "%1" newdir "%2" fullpath "%3"
 </source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restore.cpp" line="236"/>
+        <location filename="../restore/restore.cpp" line="419"/>
+        <location filename="../restore/restore.cpp" line="420"/>
+        <source>Nothing selected, nothing done</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/restore.cpp" line="445"/>
+        <source>cd command failed</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/restore.cpp" line="466"/>
+        <source>.pwd command failed</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/restore.cpp" line="251"/>
         <source>In else of if parent cwd "%1" newdir "%2"
 </source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restore.cpp" line="286"/>
+        <location filename="../restore/restore.cpp" line="300"/>
         <source>Canceled</source>
         <translation type="unfinished"></translation>
     </message>
@@ -2430,238 +4321,285 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>restoreTree</name>
     <message>
-        <location filename="../restore/restoretree.cpp" line="45"/>
+        <location filename="../restore/restoretree.cpp" line="33"/>
         <source>Version Browser</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="118"/>
+        <location filename="../restore/restoretree.cpp" line="106"/>
         <source>Directories</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="755"/>
+        <location filename="../restore/restoretree.cpp" line="109"/>
+        <location filename="../restore/restoretree.cpp" line="111"/>
+        <location filename="../restore/restoretree.cpp" line="357"/>
+        <location filename="../restore/restoretree.cpp" line="358"/>
+        <location filename="../restore/restoretree.cpp" line="639"/>
+        <location filename="../restore/restoretree.cpp" line="642"/>
         <source>Any</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="142"/>
+        <location filename="../restore/restoretree.cpp" line="130"/>
         <source>Refresh From Re-Select</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="145"/>
+        <location filename="../restore/restoretree.cpp" line="133"/>
         <source>Refresh From JobChecks</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="238"/>
-        <source>Task </source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../restore/restoretree.cpp" line="181"/>
+        <location filename="../restore/restoretree.cpp" line="171"/>
         <source>Querying Database</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="198"/>
+        <location filename="../restore/restoretree.cpp" line="188"/>
         <source>Querying Jobs</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="241"/>
+        <location filename="../restore/restoretree.cpp" line="208"/>
         <source>Querying for Directories</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="249"/>
+        <location filename="../restore/restoretree.cpp" line="216"/>
         <source>Processing Directories</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="281"/>
-        <source>No jobs were selected in the job query !!!.
-Press OK to continue?</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../restore/restoretree.cpp" line="384"/>
-        <source>In addDirectory cwd "%1" newdir "%2"
-</source>
+        <location filename="../restore/restoretree.cpp" line="386"/>
+        <source>File Name</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="438"/>
-        <source>In else of if parent cwd "%1" newdir "%2"
-</source>
+        <location filename="../restore/restoretree.cpp" line="386"/>
+        <source>Filename Id</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="511"/>
-        <source>File Name</source>
+        <location filename="../restore/restoretree.cpp" line="167"/>
+        <location filename="../restore/restoretree.cpp" line="185"/>
+        <location filename="../restore/restoretree.cpp" line="205"/>
+        <source>Task %1 of %2</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="511"/>
-        <source>Filename Id</source>
+        <location filename="../restore/restoretree.cpp" line="248"/>
+        <source>No jobs were selected in the job query !!!.
+Press OK to continue</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="521"/>
-        <source>Present Working Directory : </source>
+        <location filename="../restore/restoretree.cpp" line="396"/>
+        <source>Present Working Directory: %1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="735"/>
+        <location filename="../restore/restoretree.cpp" line="490"/>
+        <location filename="../restore/restoretree.cpp" line="619"/>
         <source>Job Id</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="616"/>
+        <location filename="../restore/restoretree.cpp" line="490"/>
+        <location filename="../restore/restoretree.cpp" line="619"/>
+        <location filename="../restore/restoretree.cpp" line="624"/>
         <source>Type</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="735"/>
+        <location filename="../restore/restoretree.cpp" line="490"/>
+        <location filename="../restore/restoretree.cpp" line="619"/>
         <source>End Time</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="616"/>
+        <location filename="../restore/restoretree.cpp" line="490"/>
         <source>Hash</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="616"/>
+        <location filename="../restore/restoretree.cpp" line="490"/>
         <source>FileId</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="702"/>
+        <location filename="../restore/restoretree.cpp" line="490"/>
+        <source>Job Type</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/restoretree.cpp" line="490"/>
+        <source>First Volume</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/restoretree.cpp" line="584"/>
         <source>RestoreTreePage</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="736"/>
+        <location filename="../restore/restoretree.cpp" line="619"/>
         <source>Level</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="736"/>
+        <location filename="../restore/restoretree.cpp" line="620"/>
         <source>Name</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="739"/>
+        <location filename="../restore/restoretree.cpp" line="620"/>
+        <location filename="../restore/restoretree.cpp" line="623"/>
         <source>Purged</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="737"/>
+        <location filename="../restore/restoretree.cpp" line="620"/>
+        <location filename="../restore/restoretree.cpp" line="621"/>
         <source>TU</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="738"/>
+        <location filename="../restore/restoretree.cpp" line="620"/>
+        <location filename="../restore/restoretree.cpp" line="622"/>
         <source>TD</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <location filename="../restore/restoretree.cpp" line="1407"/>
+        <source>Task 1 of 3</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/restoretree.cpp" line="1409"/>
+        <source>Processing Checked directories</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/restoretree.cpp" line="1511"/>
+        <source>Task 2 of 3</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/restoretree.cpp" line="1512"/>
+        <source>Processing Exceptions</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/restoretree.cpp" line="1549"/>
+        <source>Task 3 of 3</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../restore/restoretree.cpp" line="1550"/>
+        <source>Filling Database Table</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>restoreTreeForm</name>
     <message>
-        <location filename="../restore/restoretree.ui" line="13"/>
+        <location filename="../restore/restoretree.ui" line="14"/>
         <source>Form</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.ui" line="38"/>
+        <location filename="../restore/restoretree.ui" line="39"/>
         <source>Jobs</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.ui" line="205"/>
+        <location filename="../restore/restoretree.ui" line="52"/>
+        <location filename="../restore/restoretree.ui" line="75"/>
+        <location filename="../restore/restoretree.ui" line="213"/>
         <source>TextLabel</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.ui" line="108"/>
+        <location filename="../restore/restoretree.ui" line="115"/>
         <source>Files</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.ui" line="131"/>
+        <location filename="../restore/restoretree.ui" line="138"/>
         <source>Versions of File</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.ui" line="141"/>
+        <location filename="../restore/restoretree.ui" line="148"/>
         <source>FileName</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.ui" line="195"/>
+        <location filename="../restore/restoretree.ui" line="202"/>
         <source>Refresh</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.ui" line="212"/>
+        <location filename="../restore/restoretree.ui" line="220"/>
         <source>Restore</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.ui" line="232"/>
+        <location filename="../restore/restoretree.ui" line="241"/>
         <source>Job</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.ui" line="250"/>
+        <location filename="../restore/restoretree.ui" line="254"/>
+        <location filename="../restore/restoretree.ui" line="257"/>
         <source>Job List Job Criterion Selector</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.ui" line="267"/>
+        <location filename="../restore/restoretree.ui" line="274"/>
         <source>Client</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.ui" line="285"/>
+        <location filename="../restore/restoretree.ui" line="287"/>
+        <location filename="../restore/restoretree.ui" line="290"/>
         <source>Job List Client Criterion Selector</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.ui" line="302"/>
+        <location filename="../restore/restoretree.ui" line="307"/>
         <source>FileSet</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
         <location filename="../restore/restoretree.ui" line="320"/>
+        <location filename="../restore/restoretree.ui" line="323"/>
         <source>Job List Fileset Criterion Selector</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.ui" line="337"/>
+        <location filename="../restore/restoretree.ui" line="340"/>
         <source>Record Limit</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.ui" line="367"/>
+        <location filename="../restore/restoretree.ui" line="370"/>
         <source>Days Limit</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.ui" line="396"/>
+        <location filename="../restore/restoretree.ui" line="397"/>
         <source>Directory</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.ui" line="407"/>
+        <location filename="../restore/restoretree.ui" line="410"/>
         <source>Select Directory</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.ui" line="415"/>
+        <location filename="../restore/restoretree.ui" line="420"/>
         <source>UnselectDirectory</source>
         <translation type="unfinished"></translation>
     </message>
@@ -2747,32 +4685,33 @@ Press OK to continue?</source>
 <context>
     <name>runCmdPage</name>
     <message>
-        <location filename="../run/runcmd.cpp" line="51"/>
+        <location filename="../run/runcmd.cpp" line="39"/>
         <source>Restore Run</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../run/runcmd.cpp" line="79"/>
+        <location filename="../run/runcmd.cpp" line="66"/>
+        <location filename="../run/runcmd.cpp" line="68"/>
         <source>never</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../run/runcmd.cpp" line="77"/>
+        <location filename="../run/runcmd.cpp" line="66"/>
         <source>always</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../run/runcmd.cpp" line="78"/>
+        <location filename="../run/runcmd.cpp" line="66"/>
         <source>ifnewer</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../run/runcmd.cpp" line="78"/>
+        <location filename="../run/runcmd.cpp" line="67"/>
         <source>ifolder</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../run/runcmd.cpp" line="177"/>
+        <location filename="../run/runcmd.cpp" line="166"/>
         <source> Canceled</source>
         <translation type="unfinished"></translation>
     </message>
@@ -2780,87 +4719,92 @@ Press OK to continue?</source>
 <context>
     <name>runForm</name>
     <message>
-        <location filename="../run/run.ui" line="13"/>
-        <source>Form</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../run/run.ui" line="33"/>
+        <location filename="../run/run.ui" line="162"/>
         <source>Level:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../run/run.ui" line="46"/>
+        <location filename="../run/run.ui" line="270"/>
         <source>Bootstrap:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../run/run.ui" line="91"/>
+        <location filename="../run/run.ui" line="260"/>
         <source>yyyy-mm-dd hh:mm:ss</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../run/run.ui" line="101"/>
+        <location filename="../run/run.ui" line="80"/>
         <source>Job:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../run/run.ui" line="124"/>
+        <location filename="../run/run.ui" line="201"/>
         <source>Pool:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../run/run.ui" line="142"/>
+        <location filename="../run/run.ui" line="110"/>
         <source>Type:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../run/run.ui" line="149"/>
+        <location filename="../run/run.ui" line="19"/>
+        <source>Run job</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../run/run.ui" line="74"/>
+        <source>Job properties</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../run/run.ui" line="117"/>
         <source><h3>Backup<h3/></source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../run/run.ui" line="158"/>
+        <location filename="../run/run.ui" line="188"/>
         <source>FileSet:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../run/run.ui" line="168"/>
+        <location filename="../run/run.ui" line="227"/>
         <source>Messages:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../run/run.ui" line="205"/>
+        <location filename="../run/run.ui" line="36"/>
         <source><h3>Run a Job</h3></source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../run/run.ui" line="230"/>
+        <location filename="../run/run.ui" line="139"/>
         <source>Priority:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../run/run.ui" line="243"/>
+        <location filename="../run/run.ui" line="126"/>
         <source>Client:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../run/run.ui" line="274"/>
+        <location filename="../run/run.ui" line="338"/>
         <source>OK</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../run/run.ui" line="281"/>
+        <location filename="../run/run.ui" line="345"/>
         <source>Cancel</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../run/run.ui" line="306"/>
+        <location filename="../run/run.ui" line="214"/>
         <source>Storage:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../run/run.ui" line="319"/>
+        <location filename="../run/run.ui" line="240"/>
         <source>When:</source>
         <translation type="unfinished"></translation>
     </message>
@@ -2868,12 +4812,12 @@ Press OK to continue?</source>
 <context>
     <name>runPage</name>
     <message>
-        <location filename="../run/run.cpp" line="47"/>
+        <location filename="../run/run.cpp" line="77"/>
         <source>Run</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../run/run.cpp" line="117"/>
+        <location filename="../run/run.cpp" line="150"/>
         <source> Canceled</source>
         <translation type="unfinished"></translation>
     </message>
@@ -2881,7 +4825,7 @@ Press OK to continue?</source>
 <context>
     <name>selectDialog</name>
     <message>
-        <location filename="../select/select.cpp" line="83"/>
+        <location filename="../select/select.cpp" line="73"/>
         <source> Canceled</source>
         <translation type="unfinished"></translation>
     </message>
@@ -2895,9 +4839,30 @@ Press OK to continue?</source>
     </message>
 </context>
 <context>
+    <name>textInputDialog</name>
+    <message>
+        <location filename="../select/textinput.cpp" line="59"/>
+        <source> Canceled</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>textInputForm</name>
+    <message>
+        <location filename="../select/textinput.ui" line="20"/>
+        <source>Text input dialog</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../select/textinput.ui" line="57"/>
+        <source>Message</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>yesnoPopUp</name>
     <message>
-        <location filename="../select/select.cpp" line="111"/>
+        <location filename="../select/select.cpp" line="102"/>
         <source>Bat Question</source>
         <translation type="unfinished"></translation>
     </message>
diff --git a/src/qt-console/ts/bat_fr.ts b/src/qt-console/ts/bat_fr.ts
index ed7ffa6..0faf644 100644
--- a/src/qt-console/ts/bat_fr.ts
+++ b/src/qt-console/ts/bat_fr.ts
@@ -57,42 +57,42 @@
 <context>
     <name>ClientStat</name>
     <message>
-        <location filename="../status/clientstat.cpp" line="49"/>
+        <location filename="../status/clientstat.cpp" line="37"/>
         <source>Client Status %1</source>
         <translation>État du client %1</translation>
     </message>
     <message>
-        <location filename="../status/clientstat.cpp" line="155"/>
+        <location filename="../status/clientstat.cpp" line="143"/>
         <source>Job Id</source>
         <translation>Id du travail</translation>
     </message>
     <message>
-        <location filename="../status/clientstat.cpp" line="155"/>
+        <location filename="../status/clientstat.cpp" line="143"/>
         <source>Job Level</source>
         <translation>Niveau</translation>
     </message>
     <message>
-        <location filename="../status/clientstat.cpp" line="155"/>
+        <location filename="../status/clientstat.cpp" line="143"/>
         <source>Job Files</source>
         <translation>Fichiers</translation>
     </message>
     <message>
-        <location filename="../status/clientstat.cpp" line="156"/>
+        <location filename="../status/clientstat.cpp" line="144"/>
         <source>Job Bytes</source>
         <translation>Octets</translation>
     </message>
     <message>
-        <location filename="../status/clientstat.cpp" line="156"/>
+        <location filename="../status/clientstat.cpp" line="144"/>
         <source>Job Status</source>
         <translation>État</translation>
     </message>
     <message>
-        <location filename="../status/clientstat.cpp" line="156"/>
+        <location filename="../status/clientstat.cpp" line="144"/>
         <source>Job Time</source>
         <translation>Heure</translation>
     </message>
     <message>
-        <location filename="../status/clientstat.cpp" line="157"/>
+        <location filename="../status/clientstat.cpp" line="145"/>
         <source>Job Name</source>
         <translation>Nom</translation>
     </message>
@@ -149,43 +149,43 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>Clients</name>
     <message>
-        <location filename="../clients/clients.cpp" line="49"/>
+        <location filename="../clients/clients.cpp" line="38"/>
         <source>Clients</source>
         <translation>Clients</translation>
     </message>
     <message>
-        <location filename="../clients/clients.cpp" line="79"/>
-        <location filename="../clients/clients.cpp" line="82"/>
+        <location filename="../clients/clients.cpp" line="68"/>
+        <location filename="../clients/clients.cpp" line="71"/>
         <source>Client Name</source>
         <translation>Nom du client</translation>
     </message>
     <message>
-        <location filename="../clients/clients.cpp" line="79"/>
+        <location filename="../clients/clients.cpp" line="68"/>
         <source>File Retention</source>
         <translation>Durée de rétention du fichier</translation>
     </message>
     <message>
-        <location filename="../clients/clients.cpp" line="80"/>
+        <location filename="../clients/clients.cpp" line="69"/>
         <source>Job Retention</source>
         <translation>Rétention du travail</translation>
     </message>
     <message>
-        <location filename="../clients/clients.cpp" line="80"/>
+        <location filename="../clients/clients.cpp" line="69"/>
         <source>AutoPrune</source>
         <translation>Élagage auto</translation>
     </message>
     <message>
-        <location filename="../clients/clients.cpp" line="80"/>
+        <location filename="../clients/clients.cpp" line="69"/>
         <source>ClientId</source>
         <translation>Id du client</translation>
     </message>
     <message>
-        <location filename="../clients/clients.cpp" line="80"/>
+        <location filename="../clients/clients.cpp" line="69"/>
         <source>Uname</source>
         <translation>Uname</translation>
     </message>
     <message>
-        <location filename="../clients/clients.cpp" line="294"/>
+        <location filename="../clients/clients.cpp" line="283"/>
         <source>Are you sure you want to purge all jobs of client "%1" ?
 The Purge command will delete associated Catalog database records from Jobs and Volumes without considering the retention period. Purge  works only on the Catalog database and does not affect data written to Volumes. This command can be dangerous because you can delete catalog records associated with current backups of files, and we recommend that you do not use it unless you know what you are doing.
 
@@ -200,7 +200,7 @@ Comment vous persuader de clicker Annuler ? Vous ne désirez probablement pas fa
 Cliquer OK pour réaliser l'opération de purge ?</translation>
     </message>
     <message>
-        <location filename="../clients/clients.cpp" line="330"/>
+        <location filename="../clients/clients.cpp" line="319"/>
         <source>Client Status %1</source>
         <translation>État du client %1</translation>
     </message>
@@ -208,22 +208,22 @@ Cliquer OK pour réaliser l'opération de purge ?</translation>
 <context>
     <name>Console</name>
     <message>
-        <location filename="../console/console.cpp" line="44"/>
+        <location filename="../console/console.cpp" line="33"/>
         <source>Console</source>
         <translation>Console</translation>
     </message>
     <message>
-        <location filename="../console/console.cpp" line="130"/>
+        <location filename="../console/console.cpp" line="119"/>
         <source>No Director found.</source>
         <translation>Aucun Director trouvé.</translation>
     </message>
     <message>
-        <location filename="../console/console.cpp" line="380"/>
+        <location filename="../console/console.cpp" line="375"/>
         <source> Director not connected. Click on connect button.</source>
         <translation> Director déconnecté. Cliquer sur le bouton connexion.</translation>
     </message>
     <message>
-        <location filename="../console/console.cpp" line="795"/>
+        <location filename="../console/console.cpp" line="806"/>
         <source>Director is currently disconnected
 Please reconnect!</source>
         <translation>le Director est actuellement déconnecté
@@ -261,7 +261,7 @@ Veuillez vous reconnecter !</translation>
 <context>
     <name>Content</name>
     <message>
-        <location filename="../storage/content.cpp" line="163"/>
+        <location filename="../storage/content.cpp" line="152"/>
         <source>Storage Status %1</source>
         <translation>Etat du dépôt %1</translation>
     </message>
@@ -397,7 +397,7 @@ Veuillez vous reconnecter !</translation>
         <translation type="obsolete">Bat</translation>
     </message>
     <message>
-        <location filename="../bcomm/dircomm.cpp" line="89"/>
+        <location filename="../bcomm/dircomm.cpp" line="85"/>
         <source>Already connected.</source>
         <translation>Déjà connecté.</translation>
     </message>
@@ -405,72 +405,72 @@ Veuillez vous reconnecter !</translation>
 <context>
     <name>DirStat</name>
     <message>
-        <location filename="../status/dirstat.cpp" line="145"/>
-        <location filename="../status/dirstat.cpp" line="250"/>
+        <location filename="../status/dirstat.cpp" line="134"/>
+        <location filename="../status/dirstat.cpp" line="239"/>
         <source>Job Id</source>
         <translation>Id du travail</translation>
     </message>
     <message>
-        <location filename="../status/dirstat.cpp" line="145"/>
-        <location filename="../status/dirstat.cpp" line="202"/>
-        <location filename="../status/dirstat.cpp" line="250"/>
+        <location filename="../status/dirstat.cpp" line="134"/>
+        <location filename="../status/dirstat.cpp" line="191"/>
+        <location filename="../status/dirstat.cpp" line="239"/>
         <source>Job Level</source>
         <translation>Niveau</translation>
     </message>
     <message>
-        <location filename="../status/dirstat.cpp" line="145"/>
+        <location filename="../status/dirstat.cpp" line="134"/>
         <source>Job Files</source>
         <translation>Fichiers</translation>
     </message>
     <message>
-        <location filename="../status/dirstat.cpp" line="146"/>
+        <location filename="../status/dirstat.cpp" line="135"/>
         <source>Job Bytes</source>
         <translation>Octets</translation>
     </message>
     <message>
-        <location filename="../status/dirstat.cpp" line="146"/>
+        <location filename="../status/dirstat.cpp" line="135"/>
         <source>Job Status</source>
         <translation>État</translation>
     </message>
     <message>
-        <location filename="../status/dirstat.cpp" line="146"/>
-        <location filename="../status/dirstat.cpp" line="202"/>
+        <location filename="../status/dirstat.cpp" line="135"/>
+        <location filename="../status/dirstat.cpp" line="191"/>
         <source>Job Time</source>
         <translation>Heure</translation>
     </message>
     <message>
-        <location filename="../status/dirstat.cpp" line="147"/>
-        <location filename="../status/dirstat.cpp" line="203"/>
+        <location filename="../status/dirstat.cpp" line="136"/>
+        <location filename="../status/dirstat.cpp" line="192"/>
         <source>Job Name</source>
         <translation>Nom</translation>
     </message>
     <message>
-        <location filename="../status/dirstat.cpp" line="202"/>
+        <location filename="../status/dirstat.cpp" line="191"/>
         <source>Job Type</source>
         <translation>Type de travail</translation>
     </message>
     <message>
-        <location filename="../status/dirstat.cpp" line="202"/>
+        <location filename="../status/dirstat.cpp" line="191"/>
         <source>Priority</source>
         <translation>Priorité</translation>
     </message>
     <message>
-        <location filename="../status/dirstat.cpp" line="203"/>
+        <location filename="../status/dirstat.cpp" line="192"/>
         <source>Volume</source>
         <translation>Volume</translation>
     </message>
     <message>
-        <location filename="../status/dirstat.cpp" line="250"/>
+        <location filename="../status/dirstat.cpp" line="239"/>
         <source>Job Data</source>
         <translation>Données</translation>
     </message>
     <message>
-        <location filename="../status/dirstat.cpp" line="250"/>
+        <location filename="../status/dirstat.cpp" line="239"/>
         <source>Job Info</source>
         <translation>Information</translation>
     </message>
     <message>
-        <location filename="../status/dirstat.cpp" line="46"/>
+        <location filename="../status/dirstat.cpp" line="35"/>
         <source>Director Status</source>
         <translation>État du director</translation>
     </message>
@@ -541,7 +541,7 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>FileSet</name>
     <message>
-        <location filename="../fileset/fileset.cpp" line="47"/>
+        <location filename="../fileset/fileset.cpp" line="36"/>
         <source>FileSets</source>
         <translation>Jeux de fichiers</translation>
     </message>
@@ -550,12 +550,12 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">  FileSet Name  </translation>
     </message>
     <message>
-        <location filename="../fileset/fileset.cpp" line="80"/>
+        <location filename="../fileset/fileset.cpp" line="69"/>
         <source>FileSet Id</source>
         <translation>Id du jeu de fichiers</translation>
     </message>
     <message>
-        <location filename="../fileset/fileset.cpp" line="81"/>
+        <location filename="../fileset/fileset.cpp" line="70"/>
         <source>Create Time</source>
         <translation>Date de création</translation>
     </message>
@@ -564,8 +564,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">FileSet</translation>
     </message>
     <message>
-        <location filename="../fileset/fileset.cpp" line="80"/>
-        <location filename="../fileset/fileset.cpp" line="155"/>
+        <location filename="../fileset/fileset.cpp" line="69"/>
+        <location filename="../fileset/fileset.cpp" line="144"/>
         <source>FileSet Name</source>
         <translation>Nom</translation>
     </message>
@@ -601,7 +601,7 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>Help</name>
     <message>
-        <location filename="../help/help.cpp" line="64"/>
+        <location filename="../help/help.cpp" line="53"/>
         <source>Help: %1</source>
         <translation>Aide : %1</translation>
     </message>
@@ -609,28 +609,28 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>Job</name>
     <message>
-        <location filename="../job/job.cpp" line="38"/>
+        <location filename="../job/job.cpp" line="27"/>
         <source>Job</source>
         <translation>Travail</translation>
     </message>
     <message>
-        <location filename="../job/job.cpp" line="80"/>
+        <location filename="../job/job.cpp" line="71"/>
         <source>Are you sure you want to delete??  !!!.
 This delete command is used to delete a Job record and all associated catalog records that were created. This command operates only on the Catalog database and has no effect on the actual data written to a Volume. This command can be dangerous and we strongly recommend that you do not use it unless you know what you are doing.  The Job and all its associated records (File and JobMedia) will be deleted from the catalog.Press OK to proceed with delete operation.?</source>
         <translation>Êtes-vous sûr de vouloir détruire??  !!!.Cette commande est utilisée pour détruire un enregistrement "travail" et tous les enregistrements associés du catalogue. Cette commande influe uniquement sur le catalogue et n'a pas d'effet sur les données écrites sur un volume. Cette commande peut être dangereuse et nous vous recommandons fortement de ne pas l'utiliser, sauf si vous savez exactement ce que vous faites.  Le travail et les autres enregi [...]
     </message>
     <message>
-        <location filename="../job/job.cpp" line="100"/>
+        <location filename="../job/job.cpp" line="91"/>
         <source>Are you sure you want to cancel this job?</source>
         <translation>Êtes-vous sûr de vouloir annuler ce travail ?</translation>
     </message>
     <message>
-        <location filename="../job/job.cpp" line="151"/>
+        <location filename="../job/job.cpp" line="142"/>
         <source>Bat</source>
         <translation>Bat</translation>
     </message>
     <message>
-        <location filename="../job/job.cpp" line="152"/>
+        <location filename="../job/job.cpp" line="143"/>
         <source>There were no results!
 It is possible you may need to add "catalog = all" to the Messages resource for this job.
 </source>
@@ -639,7 +639,7 @@ Il se pourrait que vous deviez ajouter "catalog = all" à la ressource
 </translation>
     </message>
     <message>
-        <location filename="../job/job.cpp" line="195"/>
+        <location filename="../job/job.cpp" line="186"/>
         <source>Error:</source>
         <translation>Erreur :</translation>
     </message>
@@ -903,7 +903,17 @@ Il se pourrait que vous deviez ajouter "catalog = all" à la ressource
         <translation></translation>
     </message>
     <message>
-        <location filename="../job/job.ui" line="716"/>
+        <location filename="../job/job.ui" line="701"/>
+        <source> kB/s</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../job/job.ui" line="720"/>
+        <source>Bandwidth Limit:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../job/job.ui" line="745"/>
         <source><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
 <html><head><meta name="qrichtext" content="1" /><style type="text/css">
 p, li { white-space: pre-wrap; }
@@ -915,20 +925,20 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>JobList</name>
     <message>
-        <location filename="../joblist/joblist.cpp" line="233"/>
+        <location filename="../joblist/joblist.cpp" line="222"/>
         <source>The Jobs query returned no results.
 Press OK to continue?</source>
         <translation>La requête ne renvoie aucun travail.
 Cliquer OK pour continuer ?</translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="465"/>
+        <location filename="../joblist/joblist.cpp" line="454"/>
         <source>Are you sure you want to delete??  !!!.
 This delete command is used to delete a Job record and all associated catalog records that were created. This command operates only on the Catalog database and has no effect on the actual data written to a Volume. This command can be dangerous and we strongly recommend that you do not use it unless you know what you are doing.  The Job and all its associated records (File and JobMedia) will be deleted from the catalog.Press OK to proceed with delete operation.?</source>
         <translation>Êtes-vous sûr de vouloir détruire??  !!!.Cette commande est utilisée pour détruire un enregistrement "travail" et tous les enregistrements associés du catalogue. Cette commande influe uniquement sur le catalogue et n'a pas d'effet sur les données écrites sur un volume. Cette commande peut être dangereuse et nous vous recommandons fortement de ne pas l'utiliser, sauf si vous savez exactement ce que vous faites.  Le travail et les autres enregi [...]
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="501"/>
+        <location filename="../joblist/joblist.cpp" line="490"/>
         <source>Are you sure you want to purge ??  !!!.
 The Purge command will delete associated Catalog database records from Jobs and Volumes without considering the retention period. Purge  works only on the Catalog database and does not affect data written to Volumes. This command can be dangerous because you can delete catalog records associated with current backups of files, and we recommend that you do not use it unless you know what you are doing.
 Press OK to proceed with the purge operation?</source>
@@ -937,86 +947,86 @@ La commande de purge va détruire les enregistrements du catalogue associés (tr
 Cliquer OK pour réaliser la purge?</translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="229"/>
-        <location filename="../joblist/joblist.cpp" line="244"/>
-        <location filename="../joblist/joblist.cpp" line="250"/>
-        <location filename="../joblist/joblist.cpp" line="254"/>
-        <location filename="../joblist/joblist.cpp" line="262"/>
-        <location filename="../joblist/joblist.cpp" line="266"/>
-        <location filename="../joblist/joblist.cpp" line="280"/>
-        <location filename="../joblist/joblist.cpp" line="295"/>
+        <location filename="../joblist/joblist.cpp" line="218"/>
+        <location filename="../joblist/joblist.cpp" line="233"/>
+        <location filename="../joblist/joblist.cpp" line="239"/>
+        <location filename="../joblist/joblist.cpp" line="243"/>
+        <location filename="../joblist/joblist.cpp" line="251"/>
+        <location filename="../joblist/joblist.cpp" line="255"/>
+        <location filename="../joblist/joblist.cpp" line="269"/>
+        <location filename="../joblist/joblist.cpp" line="284"/>
         <source>Any</source>
         <translatorcomment>Tous, mais peut-on le traduire ?</translatorcomment>
         <translation></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="125"/>
-        <location filename="../joblist/joblist.cpp" line="130"/>
+        <location filename="../joblist/joblist.cpp" line="114"/>
+        <location filename="../joblist/joblist.cpp" line="119"/>
         <source>Job Id</source>
         <translation>Id du travail</translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="125"/>
-        <location filename="../joblist/joblist.cpp" line="138"/>
+        <location filename="../joblist/joblist.cpp" line="114"/>
+        <location filename="../joblist/joblist.cpp" line="127"/>
         <source>Job Name</source>
         <translation>Nom</translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="125"/>
-        <location filename="../joblist/joblist.cpp" line="140"/>
+        <location filename="../joblist/joblist.cpp" line="114"/>
+        <location filename="../joblist/joblist.cpp" line="129"/>
         <source>Client</source>
         <translation>Client</translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="125"/>
-        <location filename="../joblist/joblist.cpp" line="134"/>
+        <location filename="../joblist/joblist.cpp" line="114"/>
+        <location filename="../joblist/joblist.cpp" line="123"/>
         <source>Job Starttime</source>
         <translation>Heure de début</translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="126"/>
-        <location filename="../joblist/joblist.cpp" line="132"/>
+        <location filename="../joblist/joblist.cpp" line="115"/>
+        <location filename="../joblist/joblist.cpp" line="121"/>
         <source>Job Type</source>
         <translation>Type de travail</translation>
     </message>
     <message>
+        <location filename="../joblist/joblist.cpp" line="115"/>
         <location filename="../joblist/joblist.cpp" line="126"/>
-        <location filename="../joblist/joblist.cpp" line="137"/>
         <source>Job Level</source>
         <translation>Niveau</translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="126"/>
-        <location filename="../joblist/joblist.cpp" line="135"/>
+        <location filename="../joblist/joblist.cpp" line="115"/>
+        <location filename="../joblist/joblist.cpp" line="124"/>
         <source>Job Files</source>
         <translation>Fichiers</translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="127"/>
-        <location filename="../joblist/joblist.cpp" line="136"/>
+        <location filename="../joblist/joblist.cpp" line="116"/>
+        <location filename="../joblist/joblist.cpp" line="125"/>
         <source>Job Bytes</source>
         <translation>Octets</translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="127"/>
-        <location filename="../joblist/joblist.cpp" line="133"/>
+        <location filename="../joblist/joblist.cpp" line="116"/>
+        <location filename="../joblist/joblist.cpp" line="122"/>
         <source>Job Status</source>
         <translation>État</translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="127"/>
-        <location filename="../joblist/joblist.cpp" line="131"/>
+        <location filename="../joblist/joblist.cpp" line="116"/>
+        <location filename="../joblist/joblist.cpp" line="120"/>
         <source>Purged</source>
         <translation>Purgé</translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="127"/>
-        <location filename="../joblist/joblist.cpp" line="139"/>
+        <location filename="../joblist/joblist.cpp" line="116"/>
+        <location filename="../joblist/joblist.cpp" line="128"/>
         <source>File Set</source>
         <translation>Jeu de fichiers</translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="708"/>
+        <location filename="../joblist/joblist.cpp" line="697"/>
         <source>Backup</source>
         <translatorcomment>Sauvegarde .... mais peut-on le traduire ?</translatorcomment>
         <translation></translation>
@@ -1026,85 +1036,85 @@ Cliquer OK pour réaliser la purge?</translation>
         <translation type="obsolete">Restauration</translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="128"/>
+        <location filename="../joblist/joblist.cpp" line="117"/>
         <source>Pool Name</source>
         <translation>Nom du Groupe</translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="128"/>
+        <location filename="../joblist/joblist.cpp" line="117"/>
         <source>First Volume</source>
         <translation>Premier Volume</translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="128"/>
+        <location filename="../joblist/joblist.cpp" line="117"/>
         <source>VolCount</source>
         <translation>nb de volumes</translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="381"/>
+        <location filename="../joblist/joblist.cpp" line="370"/>
         <source>Jobs Run on Volume %1</source>
         <translation>Exécutions sur le volume %1</translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="383"/>
+        <location filename="../joblist/joblist.cpp" line="372"/>
         <source>Jobs Run from Client %1</source>
         <translation>Exécutions depuis le client %1</translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="385"/>
+        <location filename="../joblist/joblist.cpp" line="374"/>
         <source>Jobs Run of Job %1</source>
         <translation>Exécutions du travail %1</translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="387"/>
+        <location filename="../joblist/joblist.cpp" line="376"/>
         <source>Jobs Run with fileset %1</source>
         <translation>Exécutions avec le jeu de fichiers %1</translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="389"/>
+        <location filename="../joblist/joblist.cpp" line="378"/>
         <source>Jobs Run</source>
         <translation>Exécutions de travaux</translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="486"/>
+        <location filename="../joblist/joblist.cpp" line="475"/>
         <source>run job="%1" client="%2" level=%3</source>
         <translatorcomment>faut-il traduire les commandes envoyées à la console ? je ne crois pas.</translatorcomment>
         <translation></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="488"/>
+        <location filename="../joblist/joblist.cpp" line="477"/>
         <source> fileset="%1"</source>
         <translatorcomment>faut-il traduire les commandes envoyées à la console ? je ne crois pas.</translatorcomment>
         <translation></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="646"/>
+        <location filename="../joblist/joblist.cpp" line="635"/>
         <source>Delete list of %1 Jobs</source>
         <translation>Détruire %1 travaux</translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="648"/>
+        <location filename="../joblist/joblist.cpp" line="637"/>
         <source>Purge Files from list of %1 Jobs</source>
         <translation>Purger les fichiers de %1 travaux</translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="651"/>
+        <location filename="../joblist/joblist.cpp" line="640"/>
         <source>Delete Single Job</source>
         <translation>Détruire un travail</translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="652"/>
+        <location filename="../joblist/joblist.cpp" line="641"/>
         <source>Purge Files from single job</source>
         <translation>Purger les fichiers d'un travail</translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="718"/>
+        <location filename="../joblist/joblist.cpp" line="707"/>
         <source>Running</source>
         <translatorcomment>En cours ... mais faut-il le traduire ?</translatorcomment>
         <translation></translation>
     </message>
     <message>
-        <location filename="../joblist/joblist.cpp" line="718"/>
+        <location filename="../joblist/joblist.cpp" line="707"/>
         <source>Created, not yet running</source>
         <translatorcomment>Créé, pas encore lancé ... mais faut-il le traduire ?</translatorcomment>
         <translation></translation>
@@ -1261,17 +1271,17 @@ Cliquer OK pour réaliser la purge?</translation>
 <context>
     <name>JobLog</name>
     <message>
-        <location filename="../joblog/joblog.cpp" line="89"/>
+        <location filename="../joblog/joblog.cpp" line="78"/>
         <source>Bat</source>
         <translation>Bat</translation>
     </message>
     <message>
-        <location filename="../joblog/joblog.cpp" line="44"/>
+        <location filename="../joblog/joblog.cpp" line="33"/>
         <source>JobLog</source>
         <translation>Traces du travail</translation>
     </message>
     <message>
-        <location filename="../joblog/joblog.cpp" line="90"/>
+        <location filename="../joblog/joblog.cpp" line="79"/>
         <source>There were no results!
 It is possible you may need to add "catalog = all" to the Messages resource for this job.
 </source>
@@ -1280,12 +1290,12 @@ Il se pourrait que vous deviez ajouter "catalog = all" à la ressource
 </translation>
     </message>
     <message>
-        <location filename="../joblog/joblog.cpp" line="99"/>
+        <location filename="../joblog/joblog.cpp" line="88"/>
         <source>Log records for job %1</source>
         <translation>Enregistrements de trace du travail %1</translation>
     </message>
     <message>
-        <location filename="../joblog/joblog.cpp" line="136"/>
+        <location filename="../joblog/joblog.cpp" line="125"/>
         <source>Error:</source>
         <translatorcomment>Erreur : ... mais faut-il le traduire ?</translatorcomment>
         <translation></translation>
@@ -1302,160 +1312,160 @@ Il se pourrait que vous deviez ajouter "catalog = all" à la ressource
 <context>
     <name>JobPlot</name>
     <message>
-        <location filename="../jobgraphs/jobplot.cpp" line="291"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="280"/>
         <source>The Jobs query returned no results.
 Press OK to continue?</source>
         <translation>La requête ne renvoie aucun travail.
 Cliquer OK pour continuer ?</translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplot.cpp" line="81"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="70"/>
         <source>JobPlot</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplot.cpp" line="137"/>
-        <location filename="../jobgraphs/jobplot.cpp" line="432"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="126"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="421"/>
         <source>Sticks</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplot.cpp" line="138"/>
-        <location filename="../jobgraphs/jobplot.cpp" line="434"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="127"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="423"/>
         <source>Lines</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplot.cpp" line="138"/>
-        <location filename="../jobgraphs/jobplot.cpp" line="438"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="127"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="427"/>
         <source>Steps</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplot.cpp" line="138"/>
-        <location filename="../jobgraphs/jobplot.cpp" line="440"/>
-        <location filename="../jobgraphs/jobplot.cpp" line="465"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="127"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="429"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="454"/>
         <source>None</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplot.cpp" line="155"/>
-        <location filename="../jobgraphs/jobplot.cpp" line="160"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="144"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="149"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="151"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="158"/>
         <location filename="../jobgraphs/jobplot.cpp" line="162"/>
-        <location filename="../jobgraphs/jobplot.cpp" line="169"/>
-        <location filename="../jobgraphs/jobplot.cpp" line="173"/>
-        <location filename="../jobgraphs/jobplot.cpp" line="220"/>
-        <location filename="../jobgraphs/jobplot.cpp" line="287"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="209"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="276"/>
         <source>Any</source>
         <translation type="unfinished">Tous</translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplot.cpp" line="335"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="324"/>
         <source>Files and Bytes backed up</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplot.cpp" line="340"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="329"/>
         <source><-- Bytes Kb</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplot.cpp" line="341"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="330"/>
         <source>date of backup --></source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplot.cpp" line="342"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="331"/>
         <source>Number of Files --></source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplot.cpp" line="346"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="335"/>
         <source>Files</source>
         <translation type="unfinished">Fichiers</translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplot.cpp" line="351"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="340"/>
         <source>Bytes</source>
         <translation type="unfinished">Octets</translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplot.cpp" line="428"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="417"/>
         <source>Fitted</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplot.cpp" line="450"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="439"/>
         <source>Ellipse</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplot.cpp" line="451"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="440"/>
         <source>Rect</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplot.cpp" line="452"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="441"/>
         <source>Diamond</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplot.cpp" line="453"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="442"/>
         <source>Triangle</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplot.cpp" line="454"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="443"/>
         <source>DTrianle</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplot.cpp" line="455"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="444"/>
         <source>UTriangle</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplot.cpp" line="456"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="445"/>
         <source>LTriangle</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplot.cpp" line="457"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="446"/>
         <source>RTriangle</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplot.cpp" line="458"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="447"/>
         <source>Cross</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplot.cpp" line="459"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="448"/>
         <source>XCross</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplot.cpp" line="460"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="449"/>
         <source>HLine</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplot.cpp" line="461"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="450"/>
         <source>Vline</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplot.cpp" line="462"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="451"/>
         <source>Star1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplot.cpp" line="463"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="452"/>
         <source>Star2</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../jobgraphs/jobplot.cpp" line="464"/>
+        <location filename="../jobgraphs/jobplot.cpp" line="453"/>
         <source>Hexagon</source>
         <translation type="unfinished"></translation>
     </message>
@@ -1546,64 +1556,64 @@ Cliquer OK pour continuer ?</translation>
 <context>
     <name>Jobs</name>
     <message>
-        <location filename="../jobs/jobs.cpp" line="46"/>
+        <location filename="../jobs/jobs.cpp" line="32"/>
         <source>Jobs</source>
         <translation>Travaux</translation>
     </message>
     <message>
-        <location filename="../jobs/jobs.cpp" line="83"/>
-        <location filename="../jobs/jobs.cpp" line="122"/>
+        <location filename="../jobs/jobs.cpp" line="69"/>
+        <location filename="../jobs/jobs.cpp" line="108"/>
         <source>Job Name</source>
         <translation>Nom du travail</translation>
     </message>
     <message>
-        <location filename="../jobs/jobs.cpp" line="84"/>
+        <location filename="../jobs/jobs.cpp" line="70"/>
         <source>Pool</source>
         <translation>Groupe</translation>
     </message>
     <message>
-        <location filename="../jobs/jobs.cpp" line="84"/>
+        <location filename="../jobs/jobs.cpp" line="70"/>
         <source>Messages</source>
         <translation>Messages</translation>
     </message>
     <message>
-        <location filename="../jobs/jobs.cpp" line="84"/>
+        <location filename="../jobs/jobs.cpp" line="70"/>
         <source>Client</source>
         <translation>Client</translation>
     </message>
     <message>
-        <location filename="../jobs/jobs.cpp" line="85"/>
+        <location filename="../jobs/jobs.cpp" line="71"/>
         <source>Storage</source>
         <translation>Dépôt</translation>
     </message>
     <message>
-        <location filename="../jobs/jobs.cpp" line="87"/>
+        <location filename="../jobs/jobs.cpp" line="73"/>
         <source>Where</source>
         <translation>Où</translation>
     </message>
     <message>
-        <location filename="../jobs/jobs.cpp" line="85"/>
+        <location filename="../jobs/jobs.cpp" line="71"/>
         <source>Level</source>
         <translation>Niveau</translation>
     </message>
     <message>
-        <location filename="../jobs/jobs.cpp" line="85"/>
-        <location filename="../jobs/jobs.cpp" line="89"/>
+        <location filename="../jobs/jobs.cpp" line="71"/>
+        <location filename="../jobs/jobs.cpp" line="75"/>
         <source>Type</source>
         <translation>Type</translation>
     </message>
     <message>
-        <location filename="../jobs/jobs.cpp" line="86"/>
+        <location filename="../jobs/jobs.cpp" line="72"/>
         <source>FileSet</source>
         <translation>Jeu de fichiers</translation>
     </message>
     <message>
-        <location filename="../jobs/jobs.cpp" line="86"/>
+        <location filename="../jobs/jobs.cpp" line="72"/>
         <source>Catalog</source>
         <translation>Catalogue</translation>
     </message>
     <message>
-        <location filename="../jobs/jobs.cpp" line="86"/>
+        <location filename="../jobs/jobs.cpp" line="72"/>
         <source>Enabled</source>
         <translation>Activé</translation>
     </message>
@@ -1935,12 +1945,12 @@ Cliquer OK pour continuer ?</translation>
 <context>
     <name>MainWin</name>
     <message>
-        <location filename="../mainwin.cpp" line="627"/>
+        <location filename="../mainwin.cpp" line="616"/>
         <source>Director not connected. Click on connect button.</source>
         <translation>le Director n'est pas connecté. Cliquer le bouton de connexion.</translation>
     </message>
     <message>
-        <location filename="../mainwin.cpp" line="638"/>
+        <location filename="../mainwin.cpp" line="627"/>
         <source>About bat</source>
         <translation>À propos de bat</translation>
     </message>
@@ -1949,45 +1959,49 @@ Cliquer OK pour continuer ?</translation>
         <translation type="obsolete"><br><h2>bat 1.0, par Dirk H Bartley et Kern Sibbald</h2><p>Copyright &copy; 2007-</translation>
     </message>
     <message>
-        <location filename="../mainwin.cpp" line="663"/>
+        <location filename="../mainwin.cpp" line="651"/>
         <source> Ready</source>
         <translation>Prêt</translation>
     </message>
     <message>
-        <location filename="../mainwin.cpp" line="81"/>
+        <location filename="../mainwin.cpp" line="70"/>
         <source>Select Page</source>
         <translation>Sélection d'onglet</translation>
     </message>
     <message>
-        <location filename="../mainwin.cpp" line="157"/>
+        <location filename="../mainwin.cpp" line="146"/>
         <source>Console</source>
         <translation>Console</translation>
     </message>
     <message>
-        <location filename="../mainwin.cpp" line="585"/>
+        <location filename="../mainwin.cpp" line="574"/>
         <source>Director Status</source>
         <translation>Etat du director</translation>
     </message>
     <message>
-        <location filename="../mainwin.cpp" line="639"/>
-        <source><br><h2>bat %1 (%2), by Dirk H Bartley and Kern Sibbald</h2><p>Copyright &copy; 2007-%3 Free Software Foundation Europe e.V.<p>The <b>bat</b> is an administrative console interface to the Director.</source>
-        <translation><br><h2>bat %1 (%2), par Dirk H Bartley et Kern Sibbald</h2><p>Copyright &copy; 2007-%3 Free Software Foundation Europe e.V.<p><b>bat</b> est une console d'administration pour le "Director".</translation>
+        <location filename="../mainwin.cpp" line="628"/>
+        <source><br><h2>Bacula Bat %1 (%2)</h2><p>Copyright &copy; 2007-%3 Kern Sibbald<p>The <b>bat</b> is an administrative console interface to the Director.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><br><h2>bat %1 (%2), by Dirk H Bartley and Kern Sibbald</h2><p>Copyright &copy; 2007-%3 Kern Sibbald<p>The <b>bat</b> is an administrative console interface to the Director.</source>
+        <translation type="obsolete"><br><h2>bat %1 (%2), par Dirk H Bartley et Kern Sibbald</h2><p>Copyright &copy; 2007-%3 Kern Sibbald<p><b>bat</b> est une console d'administration pour le "Director".</translation>
     </message>
 </context>
 <context>
     <name>MediaEdit</name>
     <message>
-        <location filename="../mediaedit/mediaedit.cpp" line="47"/>
+        <location filename="../mediaedit/mediaedit.cpp" line="36"/>
         <source>Media Edit</source>
         <translation>Édition du support</translation>
     </message>
     <message>
-        <location filename="../mediaedit/mediaedit.cpp" line="194"/>
+        <location filename="../mediaedit/mediaedit.cpp" line="183"/>
         <source>No Volume name</source>
         <translation>Pas de nom de volume</translation>
     </message>
     <message>
-        <location filename="../mediaedit/mediaedit.cpp" line="194"/>
+        <location filename="../mediaedit/mediaedit.cpp" line="183"/>
         <source>No Volume name given</source>
         <translation>Pas de nom de Volume donné</translation>
     </message>
@@ -1995,12 +2009,12 @@ Cliquer OK pour continuer ?</translation>
 <context>
     <name>MediaInfo</name>
     <message>
-        <location filename="../mediainfo/mediainfo.cpp" line="47"/>
+        <location filename="../mediainfo/mediainfo.cpp" line="36"/>
         <source>Media Info</source>
         <translation>Informations du support</translation>
     </message>
     <message>
-        <location filename="../mediainfo/mediainfo.cpp" line="84"/>
+        <location filename="../mediainfo/mediainfo.cpp" line="73"/>
         <source>Are you sure you want to purge ??  !!!.
 The Purge command will delete associated Catalog database records from Jobs and Volumes without considering the retention period. Purge  works only on the Catalog database and does not affect data written to Volumes. This command can be dangerous because you can delete catalog records associated with current backups of files, and we recommend that you do not use it unless you know what you are doing.
 Press OK to proceed with the purge operation?</source>
@@ -2009,7 +2023,7 @@ La commande de purge va détruire les enregistrements du catalogue associés (tr
 Cliquer OK pour réaliser la purge?</translation>
     </message>
     <message>
-        <location filename="../mediainfo/mediainfo.cpp" line="103"/>
+        <location filename="../mediainfo/mediainfo.cpp" line="92"/>
         <source>Are you sure you want to delete??  !!!.
 This delete command is used to delete a Volume record and all associated catalog records that were created. This command operates only on the Catalog database and has no effect on the actual data written to a Volume. This command can be dangerous and we strongly recommend that you do not use it unless you know what you are doing.  All Jobs and all associated records (File and JobMedia) will be deleted from the catalog.Press OK to proceed with delete operation.?</source>
         <translation>Êtes-vous sûr de vouloir détruire??  !!!.
@@ -2019,14 +2033,14 @@ Cette commande est utilisée pour détruire un enregistrement "volume"
 <context>
     <name>MediaList</name>
     <message>
-        <location filename="../medialist/medialist.cpp" line="380"/>
+        <location filename="../medialist/medialist.cpp" line="370"/>
         <source>Are you sure you want to delete??  !!!.
 This delete command is used to delete a Volume record and all associated catalog records that were created. This command operates only on the Catalog database and has no effect on the actual data written to a Volume. This command can be dangerous and we strongly recommend that you do not use it unless you know what you are doing.  All Jobs and all associated records (File and JobMedia) will be deleted from the catalog.Press OK to proceed with delete operation.?</source>
         <translation>Êtes-vous sûr de vouloir détruire??  !!!.
 Cette commande est utilisée pour détruire un enregistrement "volume" et tous les enregistrements associés du catalogue. Cette commande influe uniquement sur le catalogue et n'a pas d'effet sur les données écritessur un volume. Cette commande peut être dangereuse et nous vous recommandons fortement de ne pas l'utiliser, sauf si vous savez exactement ce que vous faites.  Tous les travaux et autres enregistrements associés (fichiers et supports) seront détruits du c [...]
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="402"/>
+        <location filename="../medialist/medialist.cpp" line="392"/>
         <source>Are you sure you want to purge ??  !!!.
 The Purge command will delete associated Catalog database records from Jobs and Volumes without considering the retention period. Purge  works only on the Catalog database and does not affect data written to Volumes. This command can be dangerous because you can delete catalog records associated with current backups of files, and we recommend that you do not use it unless you know what you are doing.
 Press OK to proceed with the purge operation?</source>
@@ -2035,113 +2049,113 @@ La commande de purge va détruire les enregistrements du catalogue associés (tr
 Cliquer OK pour réaliser la purge?</translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="84"/>
+        <location filename="../medialist/medialist.cpp" line="76"/>
         <source>Volume Name</source>
         <translation>Nom de volume</translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="84"/>
+        <location filename="../medialist/medialist.cpp" line="76"/>
         <source>Id</source>
         <translation></translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="84"/>
+        <location filename="../medialist/medialist.cpp" line="76"/>
         <source>Status</source>
         <translation>État</translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="84"/>
+        <location filename="../medialist/medialist.cpp" line="76"/>
         <source>Enabled</source>
         <translation>Activé</translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="84"/>
+        <location filename="../medialist/medialist.cpp" line="76"/>
         <source>Bytes</source>
         <translation>Octets</translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="84"/>
+        <location filename="../medialist/medialist.cpp" line="76"/>
         <source>Files</source>
         <translation>Fichiers</translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="85"/>
+        <location filename="../medialist/medialist.cpp" line="77"/>
         <source>Jobs</source>
         <translation>Travaux</translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="85"/>
+        <location filename="../medialist/medialist.cpp" line="77"/>
         <source>Retention</source>
         <translation>Rétention</translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="85"/>
+        <location filename="../medialist/medialist.cpp" line="77"/>
         <source>Media Type</source>
         <translation>Type de support</translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="85"/>
+        <location filename="../medialist/medialist.cpp" line="77"/>
         <source>Slot</source>
         <translation>Slot</translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="85"/>
+        <location filename="../medialist/medialist.cpp" line="77"/>
         <source>Use Duration</source>
         <translation>Durée d'utilisation</translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="86"/>
+        <location filename="../medialist/medialist.cpp" line="78"/>
         <source>Max Jobs</source>
         <translation>nb max de travaux</translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="86"/>
+        <location filename="../medialist/medialist.cpp" line="78"/>
         <source>Max Files</source>
         <translation>nb max de fichiers</translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="86"/>
+        <location filename="../medialist/medialist.cpp" line="78"/>
         <source>Max Bytes</source>
         <translation>nb max d'octets</translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="86"/>
+        <location filename="../medialist/medialist.cpp" line="78"/>
         <source>Recycle</source>
         <translation>Recycler</translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="87"/>
+        <location filename="../medialist/medialist.cpp" line="79"/>
         <source>Last Written</source>
         <translation>Dernière écriture</translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="51"/>
-        <location filename="../medialist/medialist.cpp" line="95"/>
+        <location filename="../medialist/medialist.cpp" line="40"/>
+        <location filename="../medialist/medialist.cpp" line="87"/>
         <source>Pools</source>
         <translation>Groupes</translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="87"/>
+        <location filename="../medialist/medialist.cpp" line="79"/>
         <source>First Written</source>
         <translation>Première écriture</translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="87"/>
+        <location filename="../medialist/medialist.cpp" line="79"/>
         <source>Read Time</source>
         <translation>Temps de lecture</translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="88"/>
+        <location filename="../medialist/medialist.cpp" line="80"/>
         <source>Write Time</source>
         <translation>Temps d'écriture</translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="88"/>
+        <location filename="../medialist/medialist.cpp" line="80"/>
         <source>Recycle Count</source>
         <translation>Compteur de recyclage</translation>
     </message>
     <message>
-        <location filename="../medialist/medialist.cpp" line="88"/>
+        <location filename="../medialist/medialist.cpp" line="80"/>
         <source>Recycle Pool</source>
         <translation>Groupe de recyclage</translation>
     </message>
@@ -2218,12 +2232,12 @@ Cliquer OK pour réaliser la purge?</translation>
 <context>
     <name>MediaView</name>
     <message>
-        <location filename="../medialist/mediaview.cpp" line="44"/>
+        <location filename="../medialist/mediaview.cpp" line="33"/>
         <source>Media</source>
         <translation>Support</translation>
     </message>
     <message>
-        <location filename="../medialist/mediaview.cpp" line="95"/>
+        <location filename="../medialist/mediaview.cpp" line="84"/>
         <source>Are you sure you want to purge ??  !!!.
 The Purge command will delete associated Catalog database records from Jobs and Volumes without considering the retention period. Purge  works only on the Catalog database and does not affect data written to Volumes. This command can be dangerous because you can delete catalog records associated with current backups of files, and we recommend that you do not use it unless you know what you are doing.
 Press OK to proceed with the purge operation?</source>
@@ -2232,7 +2246,7 @@ La commande de purge va détruire les enregistrements du catalogue associés (tr
 Cliquer OK pour réaliser la purge ?</translation>
     </message>
     <message>
-        <location filename="../medialist/mediaview.cpp" line="156"/>
+        <location filename="../medialist/mediaview.cpp" line="157"/>
         <source>Are you sure you want to delete??  !!!.
 This delete command is used to delete a Volume record and all associated catalog records that were created. This command operates only on the Catalog database and has no effect on the actual data written to a Volume. This command can be dangerous and we strongly recommend that you do not use it unless you know what you are doing.  All Jobs and all associated records (File and JobMedia) will be deleted from the catalog.Press OK to proceed with delete operation.?</source>
         <translation>Êtes-vous sûr de vouloir détruire??  !!!.
@@ -2365,22 +2379,22 @@ Cette commande est utilisée pour détruire un enregistrement "volume"
 <context>
     <name>Pages</name>
     <message>
-        <location filename="../pages.cpp" line="360"/>
+        <location filename="../pages.cpp" line="349"/>
         <source>%1 of Director %2</source>
         <translation>%1 du Director %2</translation>
     </message>
     <message>
-        <location filename="../pages.cpp" line="389"/>
+        <location filename="../pages.cpp" line="378"/>
         <source>UnDock %1 Window</source>
         <translation>Déplacer %1 vers une nouvelle fenêtre</translation>
     </message>
     <message>
-        <location filename="../pages.cpp" line="391"/>
+        <location filename="../pages.cpp" line="380"/>
         <source>ReDock %1 Window</source>
         <translation>Remettre %1 en onglet</translation>
     </message>
     <message>
-        <location filename="../pages.cpp" line="406"/>
+        <location filename="../pages.cpp" line="395"/>
         <source>Console</source>
         <translation>Console</translation>
     </message>
@@ -2614,26 +2628,26 @@ Cette commande est utilisée pour détruire un enregistrement "volume"
 <context>
     <name>QObject</name>
     <message>
-        <location filename="../util/comboutil.cpp" line="45"/>
+        <location filename="../util/comboutil.cpp" line="34"/>
         <source>Any</source>
         <translation>Tous</translation>
     </message>
     <message>
-        <location filename="../util/comboutil.cpp" line="72"/>
-        <location filename="../util/fmtwidgetitem.cpp" line="272"/>
-        <location filename="../util/fmtwidgetitem.cpp" line="280"/>
+        <location filename="../util/comboutil.cpp" line="61"/>
+        <location filename="../util/fmtwidgetitem.cpp" line="261"/>
+        <location filename="../util/fmtwidgetitem.cpp" line="269"/>
         <source>No</source>
         <translation>Non</translation>
     </message>
     <message>
-        <location filename="../util/comboutil.cpp" line="73"/>
-        <location filename="../util/fmtwidgetitem.cpp" line="270"/>
-        <location filename="../util/fmtwidgetitem.cpp" line="278"/>
+        <location filename="../util/comboutil.cpp" line="62"/>
+        <location filename="../util/fmtwidgetitem.cpp" line="259"/>
+        <location filename="../util/fmtwidgetitem.cpp" line="267"/>
         <source>Yes</source>
         <translation>Oui</translation>
     </message>
     <message>
-        <location filename="../util/fmtwidgetitem.cpp" line="57"/>
+        <location filename="../util/fmtwidgetitem.cpp" line="46"/>
         <source>Invalid job status %1</source>
         <translation>État de travail invalide : %1</translation>
     </message>
@@ -2641,42 +2655,42 @@ Cette commande est utilisée pour détruire un enregistrement "volume"
 <context>
     <name>StorStat</name>
     <message>
-        <location filename="../status/storstat.cpp" line="64"/>
+        <location filename="../status/storstat.cpp" line="53"/>
         <source>Storage Status %1</source>
         <translation>Etat du dépôt %1</translation>
     </message>
     <message>
-        <location filename="../status/storstat.cpp" line="242"/>
+        <location filename="../status/storstat.cpp" line="231"/>
         <source>Job Id</source>
         <translation>Id du travail</translation>
     </message>
     <message>
-        <location filename="../status/storstat.cpp" line="242"/>
+        <location filename="../status/storstat.cpp" line="231"/>
         <source>Job Level</source>
         <translation>Niveau du Travail</translation>
     </message>
     <message>
-        <location filename="../status/storstat.cpp" line="242"/>
+        <location filename="../status/storstat.cpp" line="231"/>
         <source>Job Files</source>
         <translation>Fichiers</translation>
     </message>
     <message>
-        <location filename="../status/storstat.cpp" line="243"/>
+        <location filename="../status/storstat.cpp" line="232"/>
         <source>Job Bytes</source>
         <translation>Octets</translation>
     </message>
     <message>
-        <location filename="../status/storstat.cpp" line="243"/>
+        <location filename="../status/storstat.cpp" line="232"/>
         <source>Job Status</source>
         <translation>État</translation>
     </message>
     <message>
-        <location filename="../status/storstat.cpp" line="243"/>
+        <location filename="../status/storstat.cpp" line="232"/>
         <source>Job Time</source>
         <translation>Heure</translation>
     </message>
     <message>
-        <location filename="../status/storstat.cpp" line="244"/>
+        <location filename="../status/storstat.cpp" line="233"/>
         <source>Job Name</source>
         <translation>Nom</translation>
     </message>
@@ -2783,98 +2797,98 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>Storage</name>
     <message>
-        <location filename="../storage/storage.cpp" line="51"/>
-        <location filename="../storage/storage.cpp" line="93"/>
+        <location filename="../storage/storage.cpp" line="39"/>
+        <location filename="../storage/storage.cpp" line="81"/>
         <source>Storage</source>
         <translation>Dépôt</translation>
     </message>
     <message>
-        <location filename="../storage/storage.cpp" line="88"/>
+        <location filename="../storage/storage.cpp" line="76"/>
         <source>Name</source>
         <translation>Nom</translation>
     </message>
     <message>
-        <location filename="../storage/storage.cpp" line="88"/>
+        <location filename="../storage/storage.cpp" line="76"/>
         <source>Id</source>
         <translation>Id</translation>
     </message>
     <message>
-        <location filename="../storage/storage.cpp" line="89"/>
+        <location filename="../storage/storage.cpp" line="77"/>
         <source>Changer</source>
         <translation>Changeur</translation>
     </message>
     <message>
-        <location filename="../storage/storage.cpp" line="89"/>
+        <location filename="../storage/storage.cpp" line="77"/>
         <source>Slot</source>
         <translation>Emplacement</translation>
     </message>
     <message>
-        <location filename="../storage/storage.cpp" line="89"/>
+        <location filename="../storage/storage.cpp" line="77"/>
         <source>Status</source>
         <translation>État</translation>
     </message>
     <message>
-        <location filename="../storage/storage.cpp" line="89"/>
+        <location filename="../storage/storage.cpp" line="77"/>
         <source>Enabled</source>
         <translation>Activé</translation>
     </message>
     <message>
-        <location filename="../storage/storage.cpp" line="89"/>
+        <location filename="../storage/storage.cpp" line="77"/>
         <source>Pool</source>
         <translation>Groupe</translation>
     </message>
     <message>
-        <location filename="../storage/storage.cpp" line="90"/>
+        <location filename="../storage/storage.cpp" line="78"/>
         <source>Media Type</source>
         <translation>Type de support</translation>
     </message>
     <message>
-        <location filename="../storage/storage.cpp" line="270"/>
+        <location filename="../storage/storage.cpp" line="258"/>
         <source>Yes</source>
         <translation>Oui</translation>
     </message>
     <message>
-        <location filename="../storage/storage.cpp" line="278"/>
+        <location filename="../storage/storage.cpp" line="266"/>
         <source>Status Storage "%1"</source>
         <translation>État du dépôt "%1"</translation>
     </message>
     <message>
-        <location filename="../storage/storage.cpp" line="280"/>
+        <location filename="../storage/storage.cpp" line="268"/>
         <source>Status Storage "%1" in Window</source>
         <translation>État du dépôt "%1" (dans une fenêtre)</translation>
     </message>
     <message>
-        <location filename="../storage/storage.cpp" line="282"/>
+        <location filename="../storage/storage.cpp" line="270"/>
         <source>Label media in Storage "%1"</source>
         <translation>Étiqueter le support dans le dépôt "%1"</translation>
     </message>
     <message>
-        <location filename="../storage/storage.cpp" line="284"/>
+        <location filename="../storage/storage.cpp" line="272"/>
         <source>Mount media in Storage "%1"</source>
         <translation>Monter le support dans le dépôt "%1"</translation>
     </message>
     <message>
-        <location filename="../storage/storage.cpp" line="286"/>
+        <location filename="../storage/storage.cpp" line="274"/>
         <source>"UN" Mount media in Storage "%1"</source>
         <translation>Démonter le support dans le dépôt "%1"</translation>
     </message>
     <message>
-        <location filename="../storage/storage.cpp" line="287"/>
+        <location filename="../storage/storage.cpp" line="275"/>
         <source>Release media in Storage "%1"</source>
         <translation>Libérer le support dans le dépôt "%1"</translation>
     </message>
     <message>
-        <location filename="../storage/storage.cpp" line="292"/>
+        <location filename="../storage/storage.cpp" line="280"/>
         <source>Barcode Scan media in Storage "%1"</source>
         <translation>Scanner le code-barre du support dans le dépôt "%1"</translation>
     </message>
     <message>
-        <location filename="../storage/storage.cpp" line="294"/>
+        <location filename="../storage/storage.cpp" line="282"/>
         <source>Read scan media in Storage "%1"</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../storage/storage.cpp" line="430"/>
+        <location filename="../storage/storage.cpp" line="418"/>
         <source>Storage Status %1</source>
         <translation>État du dépôt %1</translation>
     </message>
@@ -2951,7 +2965,7 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>bRestore</name>
     <message>
-        <location filename="../restore/brestore.cpp" line="43"/>
+        <location filename="../restore/brestore.cpp" line="32"/>
         <source>bRestore</source>
         <translation>b-Restauration</translation>
     </message>
@@ -3020,9 +3034,8 @@ p, li { white-space: pre-wrap; }
         <translation>Estimer</translation>
     </message>
     <message>
-        <location filename="../restore/brestore.ui" line="508"/>
         <source>Restore</source>
-        <translation>Restaurer</translation>
+        <translation type="obsolete">Restaurer</translation>
     </message>
     <message>
         <location filename="../restore/brestore.ui" line="547"/>
@@ -3103,6 +3116,11 @@ p, li { white-space: pre-wrap; }
 <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Glisser et déplacer ici depuis <span style=" font-weight:600;">"Liste des fichiers"</span> et/ou depuis <span style=" font-weight:600;">"Versions de fichier"</span> les éléments à restaurer.</p></body></html></translation>
     </message>
     <message>
+        <location filename="../restore/brestore.ui" line="508"/>
+        <source>Restore...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
         <location filename="../restore/brestore.ui" line="584"/>
         <source>Select from Client list drop down then select from Job list drop down</source>
         <translation>Choisir un élément dans la liste déroulante "Client List" puis dans la liste déroulante "Job list"</translation>
@@ -3284,7 +3302,7 @@ regexp:</source>
 <context>
     <name>estimatePage</name>
     <message>
-        <location filename="../run/estimate.cpp" line="47"/>
+        <location filename="../run/estimate.cpp" line="36"/>
         <source>Estimate</source>
         <translation>Estimer</translation>
     </message>
@@ -3892,22 +3910,22 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>mountDialog</name>
     <message>
-        <location filename="../mount/mount.cpp" line="51"/>
+        <location filename="../mount/mount.cpp" line="40"/>
         <source>Storage : %1</source>
         <translation>Dépôt : %1</translation>
     </message>
     <message>
-        <location filename="../mount/mount.cpp" line="59"/>
+        <location filename="../mount/mount.cpp" line="48"/>
         <source>No Storage name</source>
         <translation>Pas de nom de dépôt</translation>
     </message>
     <message>
-        <location filename="../mount/mount.cpp" line="59"/>
+        <location filename="../mount/mount.cpp" line="48"/>
         <source>No Storage name given</source>
         <translation>Pas de nom de dépôt indiqué</translation>
     </message>
     <message>
-        <location filename="../mount/mount.cpp" line="71"/>
+        <location filename="../mount/mount.cpp" line="60"/>
         <source>Context sensitive command :
 
 </source>
@@ -3916,7 +3934,7 @@ p, li { white-space: pre-wrap; }
 </translation>
     </message>
     <message>
-        <location filename="../mount/mount.cpp" line="74"/>
+        <location filename="../mount/mount.cpp" line="63"/>
         <source>Director Response :
 
 </source>
@@ -3955,7 +3973,7 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>prefsDialog</name>
     <message>
-        <location filename="../mainwin.cpp" line="954"/>
+        <location filename="../mainwin.cpp" line="942"/>
         <source>Canceled</source>
         <translation>Annulé</translation>
     </message>
@@ -4041,56 +4059,56 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>prerestorePage</name>
     <message>
-        <location filename="../restore/prerestore.cpp" line="316"/>
+        <location filename="../restore/prerestore.cpp" line="305"/>
         <source>Bat</source>
         <translation>Bat</translation>
     </message>
     <message>
-        <location filename="../restore/prerestore.cpp" line="279"/>
+        <location filename="../restore/prerestore.cpp" line="268"/>
         <source>There can be no spaces in the text for the joblist.
 Press OK to continue?</source>
         <translation>Il ne peut pas y avoir d'espace dans la liste des travaux.
 Appuyer sur OK pour continuer ?</translation>
     </message>
     <message>
-        <location filename="../restore/prerestore.cpp" line="317"/>
+        <location filename="../restore/prerestore.cpp" line="306"/>
         <source>At least one of the jobs is not a valid job of type "Backup".
 Press OK to continue?</source>
         <translation>Il y a au moins un travail qui n'est pas du type "Backup" (Sauvegarde).
 Appuyer sur OK pour continuer ?</translation>
     </message>
     <message>
-        <location filename="../restore/prerestore.cpp" line="323"/>
+        <location filename="../restore/prerestore.cpp" line="312"/>
         <source>All jobs in the list must be of the same jobName and same client.
 Press OK to continue?</source>
         <translation>Tous les travaux de la liste doivent avoir le même nom et le même Client.
 Appuyer sur OK pour continuer ?</translation>
     </message>
     <message>
-        <location filename="../restore/prerestore.cpp" line="60"/>
+        <location filename="../restore/prerestore.cpp" line="49"/>
         <source>Restore</source>
         <translation>Restaurer</translation>
     </message>
     <message>
-        <location filename="../restore/prerestore.cpp" line="70"/>
-        <location filename="../restore/prerestore.cpp" line="146"/>
-        <location filename="../restore/prerestore.cpp" line="217"/>
+        <location filename="../restore/prerestore.cpp" line="59"/>
+        <location filename="../restore/prerestore.cpp" line="135"/>
+        <location filename="../restore/prerestore.cpp" line="206"/>
         <source>Any</source>
         <translation>Tous</translation>
     </message>
     <message>
-        <location filename="../restore/prerestore.cpp" line="82"/>
-        <location filename="../restore/prerestore.cpp" line="98"/>
+        <location filename="../restore/prerestore.cpp" line="71"/>
+        <location filename="../restore/prerestore.cpp" line="87"/>
         <source>Comma separted list of Job Ids</source>
         <translation>Liste de "id de travail" séparés par des virgules</translation>
     </message>
     <message>
-        <location filename="../restore/prerestore.cpp" line="198"/>
+        <location filename="../restore/prerestore.cpp" line="187"/>
         <source>Canceled</source>
         <translation>Annulé</translation>
     </message>
     <message>
-        <location filename="../restore/prerestore.cpp" line="311"/>
+        <location filename="../restore/prerestore.cpp" line="300"/>
         <source>The string is not a comma separated list of integers.
 Press OK to continue?</source>
         <translation>La chaine n'est pas une liste de nombres séparés par des virgules.
@@ -4148,22 +4166,22 @@ Appuyer sur OK pour continuer ?</translation>
 <context>
     <name>prunePage</name>
     <message>
-        <location filename="../run/prune.cpp" line="47"/>
+        <location filename="../run/prune.cpp" line="36"/>
         <source>Prune</source>
         <translation>Élaguer (prune)</translation>
     </message>
     <message>
-        <location filename="../run/prune.cpp" line="67"/>
-        <location filename="../run/prune.cpp" line="69"/>
-        <location filename="../run/prune.cpp" line="103"/>
-        <location filename="../run/prune.cpp" line="106"/>
-        <location filename="../run/prune.cpp" line="133"/>
-        <location filename="../run/prune.cpp" line="140"/>
+        <location filename="../run/prune.cpp" line="56"/>
+        <location filename="../run/prune.cpp" line="58"/>
+        <location filename="../run/prune.cpp" line="92"/>
+        <location filename="../run/prune.cpp" line="95"/>
+        <location filename="../run/prune.cpp" line="122"/>
+        <location filename="../run/prune.cpp" line="129"/>
         <source>Any</source>
         <translation>Tous</translation>
     </message>
     <message>
-        <location filename="../run/prune.cpp" line="124"/>
+        <location filename="../run/prune.cpp" line="113"/>
         <source> Canceled</source>
         <translation> Annulé</translation>
     </message>
@@ -4171,23 +4189,23 @@ Appuyer sur OK pour continuer ?</translation>
 <context>
     <name>relabelDialog</name>
     <message>
-        <location filename="../relabel/relabel.cpp" line="53"/>
+        <location filename="../relabel/relabel.cpp" line="42"/>
         <source>From Volume : </source>
         <translation>Volume : </translation>
     </message>
     <message>
-        <location filename="../relabel/relabel.cpp" line="91"/>
+        <location filename="../relabel/relabel.cpp" line="80"/>
         <source>No Volume name</source>
         <translation>Pas de nom de volume</translation>
     </message>
     <message>
-        <location filename="../relabel/relabel.cpp" line="91"/>
+        <location filename="../relabel/relabel.cpp" line="80"/>
         <source>No Volume name given</source>
         <translation>Pas de nom de Volume donné</translation>
     </message>
     <message>
-        <location filename="../relabel/relabel.cpp" line="96"/>
-        <location filename="../relabel/relabel.cpp" line="97"/>
+        <location filename="../relabel/relabel.cpp" line="85"/>
+        <location filename="../relabel/relabel.cpp" line="86"/>
         <source>New name must be different</source>
         <translation>Le nouveau nom doit être différent</translation>
     </message>
@@ -4343,75 +4361,75 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>restorePage</name>
     <message>
-        <location filename="../restore/restore.cpp" line="48"/>
+        <location filename="../restore/restore.cpp" line="37"/>
         <source>Restore Select</source>
         <translation>Sélection pour restauration</translation>
     </message>
     <message>
-        <location filename="../restore/restore.cpp" line="75"/>
+        <location filename="../restore/restore.cpp" line="64"/>
         <source>Mark</source>
         <translation>Sélectionner</translation>
     </message>
     <message>
-        <location filename="../restore/restore.cpp" line="75"/>
+        <location filename="../restore/restore.cpp" line="64"/>
         <source>File</source>
         <translation>Fichier</translation>
     </message>
     <message>
-        <location filename="../restore/restore.cpp" line="75"/>
+        <location filename="../restore/restore.cpp" line="64"/>
         <source>Mode</source>
         <translation>Mode</translation>
     </message>
     <message>
-        <location filename="../restore/restore.cpp" line="75"/>
+        <location filename="../restore/restore.cpp" line="64"/>
         <source>User</source>
         <translation>Propriétaire</translation>
     </message>
     <message>
-        <location filename="../restore/restore.cpp" line="76"/>
+        <location filename="../restore/restore.cpp" line="65"/>
         <source>Group</source>
         <translation>Groupe</translation>
     </message>
     <message>
-        <location filename="../restore/restore.cpp" line="76"/>
+        <location filename="../restore/restore.cpp" line="65"/>
         <source>Size</source>
         <translation>Taille</translation>
     </message>
     <message>
-        <location filename="../restore/restore.cpp" line="76"/>
+        <location filename="../restore/restore.cpp" line="65"/>
         <source>Date</source>
         <translation>Date</translation>
     </message>
     <message>
-        <location filename="../restore/restore.cpp" line="262"/>
+        <location filename="../restore/restore.cpp" line="251"/>
         <source>In else of if parent cwd "%1" newdir "%2"
 </source>
         <translation>Dans le "else" du "if parent" cwd "%1" newdir "%2"</translation>
     </message>
     <message>
-        <location filename="../restore/restore.cpp" line="311"/>
+        <location filename="../restore/restore.cpp" line="300"/>
         <source>Canceled</source>
         <translation>Annulé</translation>
     </message>
     <message>
-        <location filename="../restore/restore.cpp" line="199"/>
+        <location filename="../restore/restore.cpp" line="188"/>
         <source>In addDirectory cwd "%1" newdir "%2" fullpath "%3"
 </source>
         <translation>Dans "addDirectory" cwd "%1" newdir "%2" fullpath "%3"</translation>
     </message>
     <message>
-        <location filename="../restore/restore.cpp" line="430"/>
-        <location filename="../restore/restore.cpp" line="431"/>
+        <location filename="../restore/restore.cpp" line="419"/>
+        <location filename="../restore/restore.cpp" line="420"/>
         <source>Nothing selected, nothing done</source>
         <translation>Rien de sélectionné, rien de fait</translation>
     </message>
     <message>
-        <location filename="../restore/restore.cpp" line="456"/>
+        <location filename="../restore/restore.cpp" line="445"/>
         <source>cd command failed</source>
         <translation>la commande cd a échoué</translation>
     </message>
     <message>
-        <location filename="../restore/restore.cpp" line="477"/>
+        <location filename="../restore/restore.cpp" line="466"/>
         <source>.pwd command failed</source>
         <translation>la commande ".pwd" a échoué</translation>
     </message>
@@ -4419,27 +4437,27 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>restoreTree</name>
     <message>
-        <location filename="../restore/restoretree.cpp" line="44"/>
+        <location filename="../restore/restoretree.cpp" line="33"/>
         <source>Version Browser</source>
         <translation>Navigateur temporel</translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="118"/>
+        <location filename="../restore/restoretree.cpp" line="106"/>
         <source>Directories</source>
         <translation>Dossiers</translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="121"/>
-        <location filename="../restore/restoretree.cpp" line="123"/>
-        <location filename="../restore/restoretree.cpp" line="391"/>
-        <location filename="../restore/restoretree.cpp" line="392"/>
-        <location filename="../restore/restoretree.cpp" line="674"/>
-        <location filename="../restore/restoretree.cpp" line="677"/>
+        <location filename="../restore/restoretree.cpp" line="109"/>
+        <location filename="../restore/restoretree.cpp" line="111"/>
+        <location filename="../restore/restoretree.cpp" line="357"/>
+        <location filename="../restore/restoretree.cpp" line="358"/>
+        <location filename="../restore/restoretree.cpp" line="639"/>
+        <location filename="../restore/restoretree.cpp" line="642"/>
         <source>Any</source>
         <translation>Tous</translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="145"/>
+        <location filename="../restore/restoretree.cpp" line="133"/>
         <source>Refresh From JobChecks</source>
         <translation>Rafraichir depuis JobChecks</translation>
     </message>
@@ -4448,158 +4466,158 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Taches </translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="183"/>
+        <location filename="../restore/restoretree.cpp" line="171"/>
         <source>Querying Database</source>
         <translation>Interrogation en cours</translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="200"/>
+        <location filename="../restore/restoretree.cpp" line="188"/>
         <source>Querying Jobs</source>
         <translation>Interrogation des travaux</translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="242"/>
+        <location filename="../restore/restoretree.cpp" line="208"/>
         <source>Querying for Directories</source>
         <translation>Interrogation des dossiers</translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="250"/>
+        <location filename="../restore/restoretree.cpp" line="216"/>
         <source>Processing Directories</source>
         <translation>Analyse des dossiers</translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="420"/>
+        <location filename="../restore/restoretree.cpp" line="386"/>
         <source>File Name</source>
         <translation>Nom de fichier</translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="420"/>
+        <location filename="../restore/restoretree.cpp" line="386"/>
         <source>Filename Id</source>
         <translation>Id du nom de fichier</translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="524"/>
-        <location filename="../restore/restoretree.cpp" line="654"/>
+        <location filename="../restore/restoretree.cpp" line="490"/>
+        <location filename="../restore/restoretree.cpp" line="619"/>
         <source>Job Id</source>
         <translation></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="524"/>
-        <location filename="../restore/restoretree.cpp" line="654"/>
-        <location filename="../restore/restoretree.cpp" line="659"/>
+        <location filename="../restore/restoretree.cpp" line="490"/>
+        <location filename="../restore/restoretree.cpp" line="619"/>
+        <location filename="../restore/restoretree.cpp" line="624"/>
         <source>Type</source>
         <translation>Type</translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="524"/>
-        <location filename="../restore/restoretree.cpp" line="654"/>
+        <location filename="../restore/restoretree.cpp" line="490"/>
+        <location filename="../restore/restoretree.cpp" line="619"/>
         <source>End Time</source>
         <translation>Heure de fin</translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="524"/>
+        <location filename="../restore/restoretree.cpp" line="490"/>
         <source>Hash</source>
         <translation></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="524"/>
+        <location filename="../restore/restoretree.cpp" line="490"/>
         <source>FileId</source>
         <translation>FileId</translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="619"/>
+        <location filename="../restore/restoretree.cpp" line="584"/>
         <source>RestoreTreePage</source>
         <translation>Onglet de l'arbre de restauration</translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="654"/>
+        <location filename="../restore/restoretree.cpp" line="619"/>
         <source>Level</source>
         <translation>Niveau</translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="655"/>
+        <location filename="../restore/restoretree.cpp" line="620"/>
         <source>Name</source>
         <translation>Nom</translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="655"/>
-        <location filename="../restore/restoretree.cpp" line="658"/>
+        <location filename="../restore/restoretree.cpp" line="620"/>
+        <location filename="../restore/restoretree.cpp" line="623"/>
         <source>Purged</source>
         <translation>Purgé</translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="655"/>
-        <location filename="../restore/restoretree.cpp" line="656"/>
+        <location filename="../restore/restoretree.cpp" line="620"/>
+        <location filename="../restore/restoretree.cpp" line="621"/>
         <source>TU</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="655"/>
-        <location filename="../restore/restoretree.cpp" line="657"/>
+        <location filename="../restore/restoretree.cpp" line="620"/>
+        <location filename="../restore/restoretree.cpp" line="622"/>
         <source>TD</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="142"/>
+        <location filename="../restore/restoretree.cpp" line="130"/>
         <source>Refresh From Re-Select</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="179"/>
-        <location filename="../restore/restoretree.cpp" line="197"/>
-        <location filename="../restore/restoretree.cpp" line="239"/>
+        <location filename="../restore/restoretree.cpp" line="167"/>
+        <location filename="../restore/restoretree.cpp" line="185"/>
+        <location filename="../restore/restoretree.cpp" line="205"/>
         <source>Task %1 of %2</source>
         <translation>Tâche %1 sur %2</translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="282"/>
+        <location filename="../restore/restoretree.cpp" line="248"/>
         <source>No jobs were selected in the job query !!!.
 Press OK to continue</source>
         <translation>La requête ne renvoie aucun travail !!!
 Cliquer OK pour continuer</translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="430"/>
+        <location filename="../restore/restoretree.cpp" line="396"/>
         <source>Present Working Directory: %1</source>
         <translation>Dossier de travail actuel : %1</translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="524"/>
+        <location filename="../restore/restoretree.cpp" line="490"/>
         <source>Job Type</source>
         <translation>Type de travail</translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="524"/>
+        <location filename="../restore/restoretree.cpp" line="490"/>
         <source>First Volume</source>
         <translation>Premier volume</translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="1442"/>
+        <location filename="../restore/restoretree.cpp" line="1407"/>
         <source>Task 1 of 3</source>
         <translation>Tâche 1 sur 3</translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="1444"/>
+        <location filename="../restore/restoretree.cpp" line="1409"/>
         <source>Processing Checked directories</source>
         <translation>Traitement des dossiers</translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="1548"/>
+        <location filename="../restore/restoretree.cpp" line="1511"/>
         <source>Task 2 of 3</source>
         <translation>Tâche 2 sur 3</translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="1549"/>
+        <location filename="../restore/restoretree.cpp" line="1512"/>
         <source>Processing Exceptions</source>
         <translation>Traitement des exceptions</translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="1586"/>
+        <location filename="../restore/restoretree.cpp" line="1549"/>
         <source>Task 3 of 3</source>
         <translation>Tâche 3 sur 3</translation>
     </message>
     <message>
-        <location filename="../restore/restoretree.cpp" line="1587"/>
+        <location filename="../restore/restoretree.cpp" line="1550"/>
         <source>Filling Database Table</source>
         <translation>Remplissage de la base de données</translation>
     </message>
@@ -4788,37 +4806,37 @@ Cliquer OK pour continuer</translation>
 <context>
     <name>runCmdPage</name>
     <message>
-        <location filename="../run/runcmd.cpp" line="50"/>
+        <location filename="../run/runcmd.cpp" line="39"/>
         <source>Restore Run</source>
         <translation>Restauration</translation>
     </message>
     <message>
-        <location filename="../run/runcmd.cpp" line="77"/>
-        <location filename="../run/runcmd.cpp" line="79"/>
+        <location filename="../run/runcmd.cpp" line="66"/>
+        <location filename="../run/runcmd.cpp" line="68"/>
         <source>never</source>
         <translatorcomment>jamais ... mais il faudrait retraduire dans okButtonPushed.</translatorcomment>
         <translation>never</translation>
     </message>
     <message>
-        <location filename="../run/runcmd.cpp" line="77"/>
+        <location filename="../run/runcmd.cpp" line="66"/>
         <source>always</source>
         <translatorcomment>toujours ... mais il faudrait retraduire dans okButtonPushed.</translatorcomment>
         <translation>always</translation>
     </message>
     <message>
-        <location filename="../run/runcmd.cpp" line="77"/>
+        <location filename="../run/runcmd.cpp" line="66"/>
         <source>ifnewer</source>
         <translatorcomment>si nouveau ... mais il faudrait retraduire dans okButtonPushed.</translatorcomment>
         <translation>si nouveau</translation>
     </message>
     <message>
-        <location filename="../run/runcmd.cpp" line="78"/>
+        <location filename="../run/runcmd.cpp" line="67"/>
         <source>ifolder</source>
         <translatorcomment>si plus vieux ... mais il faudrait retraduire dans okButtonPushed.</translatorcomment>
         <translation>si ancien</translation>
     </message>
     <message>
-        <location filename="../run/runcmd.cpp" line="177"/>
+        <location filename="../run/runcmd.cpp" line="166"/>
         <source> Canceled</source>
         <translation> Annulé</translation>
     </message>
@@ -4923,12 +4941,12 @@ Cliquer OK pour continuer</translation>
 <context>
     <name>runPage</name>
     <message>
-        <location filename="../run/run.cpp" line="88"/>
+        <location filename="../run/run.cpp" line="77"/>
         <source>Run</source>
         <translation>Lancer</translation>
     </message>
     <message>
-        <location filename="../run/run.cpp" line="161"/>
+        <location filename="../run/run.cpp" line="150"/>
         <source> Canceled</source>
         <translation> Annulé</translation>
     </message>
@@ -4936,7 +4954,7 @@ Cliquer OK pour continuer</translation>
 <context>
     <name>selectDialog</name>
     <message>
-        <location filename="../select/select.cpp" line="84"/>
+        <location filename="../select/select.cpp" line="73"/>
         <source> Canceled</source>
         <translation> Annulé</translation>
     </message>
@@ -4952,7 +4970,7 @@ Cliquer OK pour continuer</translation>
 <context>
     <name>textInputDialog</name>
     <message>
-        <location filename="../select/textinput.cpp" line="70"/>
+        <location filename="../select/textinput.cpp" line="59"/>
         <source> Canceled</source>
         <translation> Annulé</translation>
     </message>
@@ -4960,20 +4978,28 @@ Cliquer OK pour continuer</translation>
 <context>
     <name>textInputForm</name>
     <message>
-        <location filename="../select/textinput.ui" line="17"/>
         <source>Selection dialog</source>
-        <translation>Dialogue de sélection</translation>
+        <translation type="obsolete">Dialogue de sélection</translation>
     </message>
     <message>
-        <location filename="../select/textinput.ui" line="30"/>
         <source>TextLabel</source>
-        <translation>TextLabel</translation>
+        <translation type="obsolete">TextLabel</translation>
+    </message>
+    <message>
+        <location filename="../select/textinput.ui" line="20"/>
+        <source>Text input dialog</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../select/textinput.ui" line="57"/>
+        <source>Message</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>yesnoPopUp</name>
     <message>
-        <location filename="../select/select.cpp" line="113"/>
+        <location filename="../select/select.cpp" line="102"/>
         <source>Bat Question</source>
         <translation>Bat Question</translation>
     </message>
diff --git a/src/qt-console/util/comboutil.cpp b/src/qt-console/util/comboutil.cpp
index 1abc5c2..cd78b93 100644
--- a/src/qt-console/util/comboutil.cpp
+++ b/src/qt-console/util/comboutil.cpp
@@ -1,22 +1,24 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2009 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 
 /*
- *   Version $Id$
- *
  *   ComboBox helper functions
  *
  *   Riccardo Ghetta, May 2008
@@ -99,30 +101,30 @@ void levelComboCond(QStringList &cndlist, const QComboBox *combo, const char *fl
 void jobStatusComboFill(QComboBox *combo)
 {
    static const char js[] = {
-		      JS_Terminated,
+                      JS_Terminated,
                       JS_Created,
-		      JS_Running,
-		      JS_Blocked,
-		      JS_ErrorTerminated,
-		      JS_Error,
-		      JS_FatalError,
-		      JS_Differences,
-		      JS_Canceled,
-		      JS_WaitFD,
-		      JS_WaitSD,
-		      JS_WaitMedia,
-		      JS_WaitMount,
-		      JS_WaitStoreRes,
-		      JS_WaitJobRes,
-		      JS_WaitClientRes,
-		      JS_WaitMaxJobs,
-		      JS_WaitStartTime,
-		      JS_WaitPriority,
-		      JS_AttrDespooling,
-		      JS_AttrInserting,
-		      JS_DataDespooling,
-		      JS_DataCommitting,
-		      '\0'};
+                      JS_Running,
+                      JS_Blocked,
+                      JS_ErrorTerminated,
+                      JS_Error,
+                      JS_FatalError,
+                      JS_Differences,
+                      JS_Canceled,
+                      JS_WaitFD,
+                      JS_WaitSD,
+                      JS_WaitMedia,
+                      JS_WaitMount,
+                      JS_WaitStoreRes,
+                      JS_WaitJobRes,
+                      JS_WaitClientRes,
+                      JS_WaitMaxJobs,
+                      JS_WaitStartTime,
+                      JS_WaitPriority,
+                      JS_AttrDespooling,
+                      JS_AttrInserting,
+                      JS_DataDespooling,
+                      JS_DataCommitting,
+                      '\0'};
 
    int pos;
 
diff --git a/src/qt-console/util/comboutil.h b/src/qt-console/util/comboutil.h
index d440f82..8933b4f 100644
--- a/src/qt-console/util/comboutil.h
+++ b/src/qt-console/util/comboutil.h
@@ -1,24 +1,26 @@
 #ifndef _COMBOUTIL_H_
 #define _COMBOUTIL_H_
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
- *   Version $Id$
- *
- *   Combobox helpers - Riccardo Ghetta, May 2008
+ *   Combobox helpers - Riccardo Ghetta, May 2008 
  */
 
 class QComboBox;
diff --git a/src/qt-console/util/fmtwidgetitem.cpp b/src/qt-console/util/fmtwidgetitem.cpp
index dd08129..aebd111 100644
--- a/src/qt-console/util/fmtwidgetitem.cpp
+++ b/src/qt-console/util/fmtwidgetitem.cpp
@@ -1,26 +1,30 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2010 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
 
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
+ 
 /*
  *
  *  Helper functions for tree widget formatting
  *
  *   Riccardo Ghetta, May 2008
  *
- */
+ */ 
 
 #include "bat.h"
 #include <QTreeWidgetItem>
@@ -56,13 +60,13 @@ QString convertJobStatus(const QString &sts)
 Freeze::Freeze(QWidget &q):
 qw(&q)
 {
-   qw->setUpdatesEnabled(false);
+   qw->setUpdatesEnabled(false); 
 }
 
 Freeze::~Freeze()
 {
    if (qw) {
-      qw->setUpdatesEnabled(true);
+      qw->setUpdatesEnabled(true); 
       qw->update();
    }
 }
@@ -89,15 +93,15 @@ QString convertBytesIEC(qint64 qfld)
       smaller unit (e.g. GB for a TB number and so on) */
    char suffix;
    if (qfld >= EB) {
-      qfld /= PB;
+      qfld /= PB; 
       suffix = 'E';
    }
    else if (qfld >= PB) {
-      qfld /= TB;
+      qfld /= TB; 
       suffix = 'P';
    }
    else if (qfld >= TB) {
-      qfld /= GB;
+      qfld /= GB; 
       suffix = 'T';
    }
    else if (qfld >= GB) {
@@ -113,7 +117,7 @@ QString convertBytesIEC(qint64 qfld)
    }
    else  {
       /* plain bytes, no need to reformat */
-      return QString("%1 B").arg(qfld);
+      return QString("%1 B").arg(qfld); 
    }
 
    /* having divided for a smaller unit, now we can safely convert to double and
@@ -135,15 +139,15 @@ QString convertBytesSI(qint64 qfld)
       smaller unit (e.g. GB for a TB number and so on) */
    char suffix;
    if (qfld >= EB) {
-      qfld /= PB;
+      qfld /= PB; 
       suffix = 'E';
    }
    else if (qfld >= PB) {
-      qfld /= TB;
+      qfld /= TB; 
       suffix = 'P';
    }
    else if (qfld >= TB) {
-      qfld /= GB;
+      qfld /= GB; 
       suffix = 'T';
    }
    else if (qfld >= GB) {
@@ -159,7 +163,7 @@ QString convertBytesSI(qint64 qfld)
    }
    else  {
       /* plain bytes, no need to reformat */
-      return QString("%1 B").arg(qfld);
+      return QString("%1 B").arg(qfld); 
    }
 
    /* having divided for a smaller unit, now we can safely convert to double and
@@ -210,7 +214,7 @@ void ItemFormatterBase::setPercent(int index, float value)
 /* By default, the setPixmap implementation with tooltip don't implement
  * the tooltip stuff
  */
-void ItemFormatterBase::setPixmap(int index, const QPixmap &pix,
+void ItemFormatterBase::setPixmap(int index, const QPixmap &pix, 
                                   const QString & /* tip */)
 {
    setPixmap(index, pix);
@@ -271,13 +275,13 @@ void ItemFormatterBase::setBoolFld(int index, int fld, bool center)
 void ItemFormatterBase::setNumericFld(int index, const QString &fld)
 {
    setRightFld(index, fld.trimmed());
-   setSortValue(index, fld.toDouble());
+   setSortValue(index, fld.toDouble() );
 }
 
 void ItemFormatterBase::setNumericFld(int index, const QString &fld, const QVariant &sortval)
 {
    setRightFld(index, fld.trimmed());
-   setSortValue(index, sortval);
+   setSortValue(index, sortval );
 }
 
 void ItemFormatterBase::setBytesFld(int index, const QString &fld)
@@ -375,7 +379,7 @@ void ItemFormatterBase::setJobStatusFld(int index, const QString &status, bool c
       setBackground(index, Qt::green);
    } else if (redchars.contains(st, Qt::CaseSensitive)) {
       setBackground(index, Qt::red);
-   } else if (yellowchars.contains(st, Qt::CaseSensitive)){
+   } else if (yellowchars.contains(st, Qt::CaseSensitive)){ 
       setBackground(index, Qt::yellow);
    }
 }
@@ -455,7 +459,7 @@ void TableItemFormatter::BatSortingTableItem::setSortData(const QVariant &d)
    setData(SORTDATA_ROLE, d);
 }
 
-bool TableItemFormatter::BatSortingTableItem::operator< ( const QTableWidgetItem & o ) const
+bool TableItemFormatter::BatSortingTableItem::operator< ( const QTableWidgetItem & o ) const 
 {
    QVariant my = data(SORTDATA_ROLE);
    QVariant other = o.data(SORTDATA_ROLE);
@@ -464,11 +468,11 @@ bool TableItemFormatter::BatSortingTableItem::operator< ( const QTableWidgetItem
 
    /* 64bit integers must be handled separately, others can be converted to double */
    if (QVariant::ULongLong == my.type()) {
-      return my.toULongLong() < other.toULongLong();
+      return my.toULongLong() < other.toULongLong(); 
    } else if (QVariant::LongLong == my.type()) {
-      return my.toLongLong() < other.toLongLong();
+      return my.toLongLong() < other.toLongLong(); 
    } else if (my.canConvert(QVariant::Double)) {
-      return my.toDouble() < other.toDouble();
+      return my.toDouble() < other.toDouble(); 
    } else {
       return QTableWidgetItem::operator< (o); /* invalid combination, revert to default sorting */
    }
@@ -496,7 +500,7 @@ void TableItemFormatter::setPixmap(int index, const QPixmap &pix)
    parent->setCellWidget(row, index, lbl);
 }
 
-void TableItemFormatter::setPixmap(int index, const QPixmap &pix,
+void TableItemFormatter::setPixmap(int index, const QPixmap &pix, 
                                    const QString &tips)
 {
 // Centered, but not sortable !
diff --git a/src/qt-console/util/fmtwidgetitem.h b/src/qt-console/util/fmtwidgetitem.h
index 05da32e..6dd5e12 100644
--- a/src/qt-console/util/fmtwidgetitem.h
+++ b/src/qt-console/util/fmtwidgetitem.h
@@ -1,22 +1,26 @@
 #ifndef _FMTWIDGETITEM_H_
 #define _FMTWIDGETITEM_H_
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
- *   TreeView formatting helpers - Riccardo Ghetta, May 2008
+ *   TreeView formatting helpers - Riccardo Ghetta, May 2008 
  */
 
 class QWidget;
@@ -68,7 +72,7 @@ public:
    };
 
 public:
-   virtual ~ItemFormatterBase();
+   virtual ~ItemFormatterBase(); 
 
    /* Prints Yes if fld is != 0, No otherwise. Centers field if center true*/
    void setBoolFld(int index, const QString &fld, bool center = true);
@@ -98,19 +102,19 @@ public:
 
    /* fld value interpreted as volume status. Colored accordingly */
    void setVolStatusFld(int index, const QString &fld, bool center = true);
-
+  
    /* fld value interpreted as job status. Colored accordingly */
    void setJobStatusFld(int index, const QString &status, bool center = true);
-
+  
    /* fld value interpreted as job type. */
    void setJobTypeFld(int index, const QString &fld, bool center = false);
-
+  
    /* fld value interpreted as job level. */
    void setJobLevelFld(int index, const QString &fld, bool center = false);
 
    /* fld value interpreted as Online/Offline */
    void setInChanger(int index, const QString &InChanger);
-
+  
    /* fld value interpreted as file or folder */
    void setFileType(int index, const QString &type);
 
@@ -174,14 +178,14 @@ class TableItemFormatter : public ItemFormatterBase
 {
 private:
 
-   /* specialized widget item - allows an optional data property for sorting */
+   /* specialized widget item - allows an optional data property for sorting */ 
    class BatSortingTableItem : public QTableWidgetItem
    {
    private:
       static const int SORTDATA_ROLE = Qt::UserRole + 100;
    public:
       BatSortingTableItem();
-
+      
       /* uses the sort data if available, reverts to default behavior othervise */
       virtual bool operator< ( const QTableWidgetItem & o ) const;
 
diff --git a/src/qt-console/win32/qmake.conf b/src/qt-console/win32/qmake.conf
index 581668d..7a4c04b 100644
--- a/src/qt-console/win32/qmake.conf
+++ b/src/qt-console/win32/qmake.conf
@@ -14,12 +14,11 @@ QMAKE_COMPILER_DEFINES  += __GNUC__ WIN32
 QMAKE_EXT_OBJ           = .o
 QMAKE_EXT_RES           = _res.o
 
-QMAKE_CC                = $(DEPKGS)/cross-tools/mingw32/bin/mingw32-gcc
 QMAKE_LEX               = flex
 QMAKE_LEXFLAGS          =
 QMAKE_YACC              = byacc
 QMAKE_YACCFLAGS         = -d
-QMAKE_CFLAGS            = -DHAVE_MINGW -DHAVE_WIN32
+QMAKE_CFLAGS            = -DHAVE_MINGW -DHAVE_WIN32 -DHAVE_MINGW_W64
 QMAKE_CFLAGS_DEPS       = -M
 QMAKE_CFLAGS_WARN_ON    = -Wall
 QMAKE_CFLAGS_WARN_OFF   = -w
@@ -27,8 +26,7 @@ QMAKE_CFLAGS_RELEASE    = -O2
 QMAKE_CFLAGS_DEBUG      = -g -O2
 QMAKE_CFLAGS_YACC       = -Wno-unused -Wno-parentheses
 
-QMAKE_CXX               = $(DEPKGS)/cross-tools/mingw32/bin/mingw32-g++
-QMAKE_CXXFLAGS          = $$QMAKE_CFLAGS -DHAVE_MINGW -DHAVE_WIN32 -DHAVE_ZLIB_H -DHAVE_LIBZ -DHAVE_CRYPTO -DHAVE_OPENSSL -DHAVE_TLS 
+QMAKE_CXXFLAGS          = $$QMAKE_CFLAGS -DHAVE_MINGW -DHAVE_WIN32 -DHAVE_ZLIB_H -DHAVE_LIBZ -DHAVE_CRYPTO -DHAVE_OPENSSL -DHAVE_TLS -DHAVE_MINGW_W64
 QMAKE_CXXFLAGS_DEPS     = $$QMAKE_CFLAGS_DEPS
 QMAKE_CXXFLAGS_WARN_ON  = $$QMAKE_CFLAGS_WARN_ON
 QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF
@@ -45,13 +43,13 @@ QMAKE_INCDIR            = $(DEPKGS)/depkgs-mingw32/include/pthreads $(DEPKGS)/de
 QMAKE_INCDIR_QT         = $(DEPKGS)/depkgs-mingw32/include/qt
 QMAKE_LIBDIR_QT         = $(DEPKGS)/depkgs-mingw32/lib/qt
 
-QMAKE_RUN_CC            = $(CC) -c $(CFLAGS) $(INCPATH) -o $obj $src
-QMAKE_RUN_CC_IMP        = $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+QMAKE_RUN_CC            = $(CXX) -c $(CFLAGS) $(INCPATH) -o $obj $src
+QMAKE_RUN_CC_IMP        = $(CXX) -c $(CFLAGS) $(INCPATH) -o $@ $<
 QMAKE_RUN_CXX           = $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $obj $src
 QMAKE_RUN_CXX_IMP       = $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
 
-QMAKE_LINK              = $(DEPKGS)/cross-tools/mingw32/bin/mingw32-g++
-QMAKE_LFLAGS            = -mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import  -mno-cygwin -m32 -fno-strict-aliasing -Wl,-enable-runtime-pseudo-reloc
+QMAKE_LINK              = i686-w64-mingw32-g++
+QMAKE_LFLAGS            = -mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -m32 -fno-strict-aliasing -Wl,-enable-runtime-pseudo-reloc
 
 QMAKE_LFLAGS_EXCEPTIONS_ON = -mthreads -Wl
 QMAKE_LFLAGS_EXCEPTIONS_OFF =
@@ -64,7 +62,7 @@ QMAKE_LINK_OBJECT_MAX   = 10
 QMAKE_LINK_OBJECT_SCRIPT= object_script
 
 
-QMAKE_LIBS              = -lwsock32
+QMAKE_LIBS              = -lwsock32 -lstdc++
 QMAKE_LIBS_CORE         = -lkernel32 -luser32 -lshell32 -luuid -lole32 -ladvapi32 -lws2_32
 QMAKE_LIBS_GUI          = -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lws2_32 -lole32 -luuid -luser32 -ladvapi32
 QMAKE_LIBS_NETWORK      = -lws2_32
@@ -88,10 +86,8 @@ QMAKE_UIC               = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}uic
 QMAKE_IDC               = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}idc
 
 QMAKE_IDL               = midl
-QMAKE_LIB               = $(DEPKGS)/cross-tools/mingw32/bin/mingw32-ar -ru
-QMAKE_RC                = $(DEPKGS)/cross-tools/mingw32/bin/mingw32-windres
 QMAKE_ZIP               = zip -r -9
 
-QMAKE_STRIP             = $(DEPKGS)/cross-tools/mingw32/bin/mingw32-strip
+QMAKE_STRIP             = i686-w64-mingw32-strip
 QMAKE_STRIPFLAGS_LIB    += --strip-unneeded
 load(qt_config)
diff --git a/src/qt-console/win32/qplatformdefs.h b/src/qt-console/win32/qplatformdefs.h
index b01b8a6..4802c2b 100644
--- a/src/qt-console/win32/qplatformdefs.h
+++ b/src/qt-console/win32/qplatformdefs.h
@@ -49,6 +49,7 @@
 
 #include "qglobal.h"
 
+#include "winhdrs.h"
 #include <tchar.h>
 #include <io.h>
 #include <direct.h>
@@ -57,77 +58,76 @@
 #include <errno.h>
 #include <sys/stat.h>
 #include <stdlib.h>
-#include <windows.h>
 #include <limits.h>
 
 #if !defined(_WIN32_WINNT) || (_WIN32_WINNT-0 < 0x0500)
 typedef enum {
-    NameUnknown		  = 0, 
+    NameUnknown           = 0, 
     NameFullyQualifiedDN  = 1, 
-    NameSamCompatible	  = 2, 
-    NameDisplay		  = 3, 
-    NameUniqueId	  = 6, 
-    NameCanonical	  = 7, 
-    NameUserPrincipal	  = 8, 
-    NameCanonicalEx	  = 9, 
+    NameSamCompatible     = 2, 
+    NameDisplay           = 3, 
+    NameUniqueId          = 6, 
+    NameCanonical         = 7, 
+    NameUserPrincipal     = 8, 
+    NameCanonicalEx       = 9, 
     NameServicePrincipal  = 10, 
-    NameDnsDomain	  = 12
+    NameDnsDomain         = 12
 } EXTENDED_NAME_FORMAT, *PEXTENDED_NAME_FORMAT;
 #endif
 
 #define Q_FS_FAT
 #ifdef QT_LARGEFILE_SUPPORT
-#define QT_STATBUF		struct _stati64		// non-ANSI defs
-#define QT_STATBUF4TSTAT	struct _stati64		// non-ANSI defs
-#define QT_STAT			::_stati64
-#define QT_FSTAT		::_fstati64
+#define QT_STATBUF              struct _stati64         // non-ANSI defs
+#define QT_STATBUF4TSTAT        struct _stati64         // non-ANSI defs
+#define QT_STAT                 ::_stati64
+#define QT_FSTAT                ::_fstati64
 #else
-#define QT_STATBUF		struct _stat		// non-ANSI defs
-#define QT_STATBUF4TSTAT	struct _stat		// non-ANSI defs
-#define QT_STAT			::_stat
-#define QT_FSTAT		::_fstat
+#define QT_STATBUF              struct _stat            // non-ANSI defs
+#define QT_STATBUF4TSTAT        struct _stat            // non-ANSI defs
+#define QT_STAT                 ::_stat
+#define QT_FSTAT                ::_fstat
 #endif
-#define QT_STAT_REG		_S_IFREG
-#define QT_STAT_DIR		_S_IFDIR
-#define QT_STAT_MASK		_S_IFMT
+#define QT_STAT_REG             _S_IFREG
+#define QT_STAT_DIR             _S_IFDIR
+#define QT_STAT_MASK            _S_IFMT
 #if defined(_S_IFLNK)
-#  define QT_STAT_LNK		_S_IFLNK
+#  define QT_STAT_LNK           _S_IFLNK
 #endif
-#define QT_FILENO		_fileno
-#define QT_OPEN			::_open
-#define QT_CLOSE		::_close
+#define QT_FILENO               _fileno
+#define QT_OPEN                 ::_open
+#define QT_CLOSE                ::_close
 #ifdef QT_LARGEFILE_SUPPORT
-#define QT_LSEEK		::_lseeki64
+#define QT_LSEEK                ::_lseeki64
 #ifndef UNICODE
-#define QT_TSTAT		::_stati64
+#define QT_TSTAT                ::_stati64
 #else
-#define QT_TSTAT		::_wstati64
+#define QT_TSTAT                ::_wstati64
 #endif
 #else
-#define QT_LSEEK		::_lseek
+#define QT_LSEEK                ::_lseek
 #ifndef UNICODE
-#define QT_TSTAT		::_stat
+#define QT_TSTAT                ::_stat
 #else
-#define QT_TSTAT		::_wstat
+#define QT_TSTAT                ::_wstat
 #endif
 #endif
-#define QT_READ			::_read
-#define QT_WRITE		::_write
-#define QT_ACCESS		::_access
-#define QT_GETCWD		::_getcwd
-#define QT_CHDIR		::_chdir
-#define QT_MKDIR		::_mkdir
-#define QT_RMDIR		::_rmdir
+#define QT_READ                 ::_read
+#define QT_WRITE                ::_write
+#define QT_ACCESS               ::_access
+#define QT_GETCWD               ::_getcwd
+#define QT_CHDIR                ::_chdir
+#define QT_MKDIR                ::_mkdir
+#define QT_RMDIR                ::_rmdir
 #define QT_OPEN_LARGEFILE       0
-#define QT_OPEN_RDONLY		_O_RDONLY
-#define QT_OPEN_WRONLY		_O_WRONLY
-#define QT_OPEN_RDWR		_O_RDWR
-#define QT_OPEN_CREAT		_O_CREAT
-#define QT_OPEN_TRUNC		_O_TRUNC
-#define QT_OPEN_APPEND		_O_APPEND
+#define QT_OPEN_RDONLY          _O_RDONLY
+#define QT_OPEN_WRONLY          _O_WRONLY
+#define QT_OPEN_RDWR            _O_RDWR
+#define QT_OPEN_CREAT           _O_CREAT
+#define QT_OPEN_TRUNC           _O_TRUNC
+#define QT_OPEN_APPEND          _O_APPEND
 #if defined(O_TEXT)
-# define QT_OPEN_TEXT		_O_TEXT
-# define QT_OPEN_BINARY		_O_BINARY
+# define QT_OPEN_TEXT           _O_TEXT
+# define QT_OPEN_BINARY         _O_BINARY
 #endif
 
 #define QT_FOPEN                ::fopen
@@ -147,15 +147,15 @@ typedef enum {
 #define QT_OFF_T                long
 #endif
 
-#define QT_SIGNAL_ARGS		int
+#define QT_SIGNAL_ARGS          int
 
-#define QT_VSNPRINTF		::_vsnprintf
-#define QT_SNPRINTF		::_snprintf
+#define QT_VSNPRINTF            ::_vsnprintf
+#define QT_SNPRINTF             ::_snprintf
 
-# define F_OK	0
-# define X_OK	1
-# define W_OK	2
-# define R_OK	4
+# define F_OK   0
+# define X_OK   1
+# define W_OK   2
+# define R_OK   4
 
 
 #endif // QPLATFORMDEFS_H
diff --git a/src/stored/Makefile.in b/src/stored/Makefile.in
index 7671fa7..9a84b4c 100644
--- a/src/stored/Makefile.in
+++ b/src/stored/Makefile.in
@@ -1,4 +1,7 @@
 #
+# Copyright (C) 2000-2015 by Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 @MCOMMON@
 
 srcdir =	.
@@ -29,6 +32,7 @@ SDOBJS =  stored.o ansi_label.o vtape_dev.o \
 	  askdir.o authenticate.o \
 	  block.o block_util.o butil.o dev.o os.o file_dev.o tape_dev.o \
 	  device.o dircmd.o ebcdic.o fd_cmds.o job.o \
+	  hello.o \
 	  label.o lock.o match_bsr.o mount.o parse_bsr.o \
 	  read.o read_records.o \
 	  record_read.o record_write.o record_util.o \
diff --git a/src/stored/acquire.c b/src/stored/acquire.c
index a64b14d..b6faaf1 100644
--- a/src/stored/acquire.c
+++ b/src/stored/acquire.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2002-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *  Routines to acquire and release a device for read/write
@@ -34,8 +38,8 @@ static void set_dcr_from_vol(DCR *dcr, VOL_LIST *vol);
  *  reserve_device_for_read(). We read the Volume label from the block and
  *  leave the block pointers just after the label.
  *
- *  Returns: NULL if failed for any reason
- *           dcr  if successful
+ *  Returns: false if failed for any reason
+ *           true  if successful
  */
 bool acquire_device_for_read(DCR *dcr)
 {
@@ -193,7 +197,7 @@ bool acquire_device_for_read(DCR *dcr)
                              dev->is_labeled();
 // tape_initially_mounted = tape_previously_mounted;
 
-   /* Volume info is always needed because of VolParts */
+   /* Volume info is always needed because of VolType */
    Dmsg1(rdbglvl, "dir_get_volume_info vol=%s\n", dcr->VolumeName);
    if (!dir_get_volume_info(dcr, GET_VOL_INFO_FOR_READ)) {
       Dmsg2(rdbglvl, "dir_get_vol_info failed for vol=%s: %s\n",
@@ -304,7 +308,7 @@ default_path:
             goto get_out;             /* error return */
          }
 
-         /* Volume info is always needed because of VolParts */
+         /* Volume info is always needed because of VolType */
          Dmsg1(150, "dir_get_volume_info vol=%s\n", dcr->VolumeName);
          if (!dir_get_volume_info(dcr, GET_VOL_INFO_FOR_READ)) {
             Dmsg2(150, "dir_get_vol_info failed for vol=%s: %s\n",
@@ -550,7 +554,9 @@ bool release_device(DCR *dcr)
    /* If no writers, close if file or !CAP_ALWAYS_OPEN */
    if (dev->num_writers == 0 && (!dev->is_tape() || !dev->has_cap(CAP_ALWAYSOPEN))) {
       generate_plugin_event(jcr, bsdEventDeviceClose, dcr);
-      dev->close();
+      if (!dev->close()) {
+         Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg);
+      }
       free_volume(dev);
    }
    unlock_volumes();
@@ -653,6 +659,7 @@ DCR *new_dcr(JCR *jcr, DCR *dcr, DEVICE *dev, bool writing)
    if (dev) {
       dcr->free_blocks();
       dcr->block = new_block(dev);
+      dcr->ameta_block = dcr->block;
       if (dcr->rec) {
          free_record(dcr->rec);
       }
@@ -742,6 +749,12 @@ void DEVICE::detach_dcr_from_dev(DCR *dcr)
          attached_dcrs->remove(dcr);  /* detach dcr from device */
       }
    }
+   /* Check if someone accidentally left a drive reserved, and clear it */
+   if (attached_dcrs->size() == 0 && num_reserved() > 0) {
+      Pmsg2(000, "Warning!!! dcrs=0 reserved=%d setting reserved==0. dev=%s\n",
+         num_reserved(), print_name());
+      m_num_reserved = 0;
+   }
    dcr->attached_to_dev = false;
    Unlock_dcrs();
    Unlock();
diff --git a/src/stored/ansi_label.c b/src/stored/ansi_label.c
index 31a74e7..516c925 100644
--- a/src/stored/ansi_label.c
+++ b/src/stored/ansi_label.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2005-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
diff --git a/src/stored/append.c b/src/stored/append.c
index fa3946f..973476a 100644
--- a/src/stored/append.c
+++ b/src/stored/append.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Append code for Storage daemon
@@ -27,6 +31,28 @@
 static char OK_data[]    = "3000 OK data\n";
 static char OK_append[]  = "3000 OK append data\n";
 
+/* Forward referenced functions */
+
+
+/*
+ * Check if we can mark this job incomplete
+ *
+ */
+void possible_incomplete_job(JCR *jcr, int32_t last_file_index)
+{
+   /*
+    * Note, here we decide if it is worthwhile to restart
+    *  the Job at this point. For the moment, if at least
+    *  10 Files have been seen.
+    *  We must be sure that the saved files are safe.
+    *  Using this function when their is as comm line problem is probably safe,
+    *  it is inappropriate to use it for a any failure that could
+    *  involve corrupted data.
+    */
+   if (jcr->spool_attributes && last_file_index > 10) {
+      jcr->setJobStatus(JS_Incomplete);
+   }
+}
 /*
  *  Append Data sent from Client (FD/SD)
  *
@@ -43,7 +69,8 @@ bool do_append_data(JCR *jcr)
    DCR *dcr = jcr->dcr;
    DEVICE *dev;
    char ec[50];
-
+   POOLMEM *eblock = NULL;
+   POOL_MEM errmsg(PM_EMSG);
 
    if (!dcr) {
       pm_strcpy(jcr->errmsg, _("DCR is NULL!!!\n"));
@@ -98,6 +125,7 @@ bool do_append_data(JCR *jcr)
       jcr->setJobStatus(JS_ErrorTerminated);
       ok = false;
    }
+
    //ASSERT(dev->VolCatInfo.VolCatName[0]);
    if (dev->VolCatInfo.VolCatName[0] == 0) {
       Pmsg0(000, _("NULL Volume name. This shouldn't happen!!!\n"));
@@ -118,7 +146,7 @@ bool do_append_data(JCR *jcr)
     *     - Multiple records of data
     *     - EOD record
     *
-    *    The Stream header is just used to sychronize things, and
+    *    The Stream header is just used to synchronize things, and
     *    none of the stream header is written to tape.
     *    The Multiple records of data, contain first the Attributes,
     *    then after another stream header, the file data, then
@@ -130,6 +158,12 @@ bool do_append_data(JCR *jcr)
     */
    dcr->VolFirstIndex = dcr->VolLastIndex = 0;
    jcr->run_time = time(NULL);              /* start counting time for rates */
+
+   GetMsg *qfd;
+
+   qfd = New(GetMsg(jcr, fd, NULL, GETMSG_MAX_MSG_SIZE));
+   qfd->start_read_sock();
+
    for (last_file_index = 0; ok && !jcr->is_job_canceled(); ) {
 
       /* Read Stream header from the File daemon.
@@ -140,20 +174,26 @@ bool do_append_data(JCR *jcr)
        *       will be the size backed up if the file does not
        *       grow during the backup.
        */
-     if ((n=bget_msg(fd)) <= 0) {
-         if (n == BNET_SIGNAL && fd->msglen == BNET_EOD) {
+      n = qfd->bget_msg(NULL);
+      if (n <= 0) {
+         if (n == BNET_SIGNAL && qfd->msglen == BNET_EOD) {
             Dmsg0(200, "Got EOD on reading header.\n");
             break;                    /* end of data */
          }
          Jmsg3(jcr, M_FATAL, 0, _("Error reading data header from FD. n=%d msglen=%d ERR=%s\n"),
-               n, fd->msglen, fd->bstrerror());
+               n, qfd->msglen, fd->bstrerror());
+         // ASX TODO the fd->bstrerror() can be related to the wrong error, I should Queue the error too
+         possible_incomplete_job(jcr, last_file_index);
          ok = false;
          break;
       }
 
-      if (sscanf(fd->msg, "%ld %ld %lld", &file_index, &stream, &stream_len) != 3) {
-         Jmsg1(jcr, M_FATAL, 0, _("Malformed data header from FD: %s\n"), fd->msg);
+      if (sscanf(qfd->msg, "%ld %ld %lld", &file_index, &stream, &stream_len) != 3) {
+         // TODO ASX already done in bufmsg, should reuse the values
+         char buf[256];
+         Jmsg1(jcr, M_FATAL, 0, _("Malformed data header from FD: %s\n"), asciidump(qfd->msg, qfd->msglen, buf, sizeof(buf)));
          ok = false;
+         possible_incomplete_job(jcr, last_file_index);
          break;
       }
 
@@ -162,6 +202,8 @@ bool do_append_data(JCR *jcr)
 
       /*
        * We make sure the file_index is advancing sequentially.
+       * An incomplete job can start the file_index at any number.
+       * otherwise, it must start at 1.
        */
       if (jcr->rerunning && file_index > 0 && last_file_index == 0) {
          goto fi_checked;
@@ -173,6 +215,7 @@ bool do_append_data(JCR *jcr)
       }
       Jmsg2(jcr, M_FATAL, 0, _("FI=%d from FD not positive or last_FI=%d\n"),
             file_index, last_file_index);
+      possible_incomplete_job(jcr, last_file_index);
       ok = false;
       break;
 
@@ -185,21 +228,21 @@ fi_checked:
       /* Read data stream from the File daemon.
        *  The data stream is just raw bytes
        */
-      while ((n=bget_msg(fd)) > 0 && !jcr->is_job_canceled()) {
+      while ((n=qfd->bget_msg(NULL)) > 0 && !jcr->is_job_canceled()) {
+
          rec.VolSessionId = jcr->VolSessionId;
          rec.VolSessionTime = jcr->VolSessionTime;
          rec.FileIndex = file_index;
          rec.Stream = stream;
          rec.StreamLen = stream_len;
          rec.maskedStream = stream & STREAMMASK_TYPE;   /* strip high bits */
-         rec.data_len = fd->msglen;
-         rec.data = fd->msg;            /* use message buffer */
+         rec.data_len = qfd->msglen;
+         rec.data = qfd->msg;            /* use message buffer */
 
          Dmsg4(850, "before writ_rec FI=%d SessId=%d Strm=%s len=%d\n",
             rec.FileIndex, rec.VolSessionId,
             stream_to_ascii(buf1, rec.Stream,rec.FileIndex),
             rec.data_len);
-
          ok = dcr->write_record(&rec);
          if (!ok) {
             Dmsg2(90, "Got write_block_to_dev error on device %s. %s\n",
@@ -207,6 +250,7 @@ fi_checked:
             break;
          }
          jcr->JobBytes += rec.data_len;   /* increment bytes this job */
+         jcr->JobBytes += qfd->bmsg->jobbytes; // if the block as been downloaded, count it
          Dmsg4(850, "write_record FI=%s SessId=%d Strm=%s len=%d\n",
             FI_to_ascii(buf1, rec.FileIndex), rec.VolSessionId,
             stream_to_ascii(buf2, rec.Stream, rec.FileIndex), rec.data_len);
@@ -221,12 +265,20 @@ fi_checked:
             Dmsg1(350, "Network read error from FD. ERR=%s\n", fd->bstrerror());
             Jmsg1(jcr, M_FATAL, 0, _("Network error reading from FD. ERR=%s\n"),
                   fd->bstrerror());
+            possible_incomplete_job(jcr, last_file_index);
          }
          ok = false;
          break;
       }
    }
 
+   qfd->wait_read_sock();
+   free_GetMsg(qfd);
+
+   if (eblock != NULL) {
+      free_pool_memory(eblock);
+   }
+
    /* Create Job status for end of session label */
    jcr->setJobStatus(ok?JS_Terminated:JS_ErrorTerminated);
 
@@ -250,24 +302,26 @@ fi_checked:
          if (ok && !jcr->is_job_canceled()) {
             Jmsg1(jcr, M_FATAL, 0, _("Error writing end session label. ERR=%s\n"),
                   dev->bstrerror());
+            possible_incomplete_job(jcr, last_file_index);
          }
          jcr->setJobStatus(JS_ErrorTerminated);
          ok = false;
       }
       /* Flush out final partial block of this session */
-      if (!dcr->write_block_to_device()) {
+      if (!dcr->write_final_block_to_device()) {
          /* Print only if ok and not cancelled to avoid spurious messages */
          if (ok && !jcr->is_job_canceled()) {
             Jmsg2(jcr, M_FATAL, 0, _("Fatal append error on device %s: ERR=%s\n"),
                   dev->print_name(), dev->bstrerror());
-            Dmsg0(100, _("Set ok=FALSE after write_block_to_device.\n"));
+            Dmsg0(100, _("Set ok=FALSE after write_final_block_to_device.\n"));
+            possible_incomplete_job(jcr, last_file_index);
          }
          jcr->setJobStatus(JS_ErrorTerminated);
          ok = false;
       }
    }
-
-   if (!ok) {
+   flush_jobmedia_queue(jcr);
+   if (!ok && !jcr->is_JobStatus(JS_Incomplete)) {
       discard_data_spool(dcr);
    } else {
       /* Note: if commit is OK, the device will remain blocked */
@@ -294,7 +348,7 @@ fi_checked:
     */
    release_device(dcr);
 
-   if (!ok || jcr->is_job_canceled()) {
+   if ((!ok || jcr->is_job_canceled()) && !jcr->is_JobStatus(JS_Incomplete)) {
       discard_attribute_spool(jcr);
    } else {
       commit_attribute_spool(jcr);
diff --git a/src/stored/askdir.c b/src/stored/askdir.c
index f31a30f..a3cb80e 100644
--- a/src/stored/askdir.c
+++ b/src/stored/askdir.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *  Subroutines to handle Catalog reqests sent to the Director
@@ -27,26 +31,26 @@
 static const int dbglvl = 200;
 
 /* Requests sent to the Director */
-static char Find_media[]   = "CatReq Job=%s FindMedia=%d pool_name=%s media_type=%s\n";
+static char Find_media[]   = "CatReq Job=%s FindMedia=%d pool_name=%s media_type=%s vol_type=%d\n";
 static char Get_Vol_Info[] = "CatReq Job=%s GetVolInfo VolName=%s write=%d\n";
 static char Update_media[] = "CatReq Job=%s UpdateMedia VolName=%s"
-   " VolJobs=%u VolFiles=%u VolBlocks=%u VolBytes=%s VolMounts=%u"
+   " VolJobs=%u VolFiles=%u VolBlocks=%u VolBytes=%s VolABytes=%s"
+   " VolHoleBytes=%s VolHoles=%u VolMounts=%u"
    " VolErrors=%u VolWrites=%u MaxVolBytes=%s EndTime=%s VolStatus=%s"
    " Slot=%d relabel=%d InChanger=%d VolReadTime=%s VolWriteTime=%s"
-   " VolFirstWritten=%s VolParts=%u\n";
-static char Create_job_media[] = "CatReq Job=%s CreateJobMedia"
-   " FirstIndex=%u LastIndex=%u StartFile=%u EndFile=%u"
-   " StartBlock=%u EndBlock=%u Copy=%d Strip=%d MediaId=%s\n";
+   " VolFirstWritten=%s VolType=%u\n";
+static char Create_jobmedia[] = "CatReq Job=%s CreateJobMedia\n";
 static char FileAttributes[] = "UpdCat Job=%s FileAttributes ";
 
 /* Responses received from the Director */
 static char OK_media[] = "1000 OK VolName=%127s VolJobs=%u VolFiles=%lu"
-   " VolBlocks=%lu VolBytes=%lld VolMounts=%lu"
+   " VolBlocks=%lu VolBytes=%lld VolABytes=%lld"
+   " VolHoleBytes=%lld VolHoles=%lu VolMounts=%lu"
    " VolErrors=%lu VolWrites=%lu"
    " MaxVolBytes=%lld VolCapacityBytes=%lld VolStatus=%20s"
    " Slot=%ld MaxVolJobs=%lu MaxVolFiles=%lu InChanger=%ld"
    " VolReadTime=%lld VolWriteTime=%lld EndFile=%lu EndBlock=%lu"
-   " VolParts=%lu LabelType=%ld MediaId=%lld ScratchPoolId=%lld\n";
+   " VolType=%lu LabelType=%ld MediaId=%lld ScratchPoolId=%lld\n";
 
 
 static char OK_create[] = "1000 OK CreateJobMedia\n";
@@ -60,6 +64,7 @@ static char Device_update[] = "DevUpd Job=%s device=%s "
    "open=%d labeled=%d offline=%d "
    "reserved=%d max_writers=%d "
    "autoselect=%d autochanger=%d "
+   "enabled=%d "
    "changer_name=%s media_type=%s volume_name=%s\n";
 
 
@@ -96,6 +101,7 @@ bool dir_update_device(JCR *jcr, DEVICE *dev)
       dev->is_offline()!=0, dev->reserved_device,
       dev->is_tape()?100000:1,
       dev->autoselect, 0,
+      dev->enabled,
       ChangerName.c_str(), MediaType.c_str(), VolumeName.c_str());
    Dmsg1(dbglvl, ">dird: %s\n", dir->msg);
    return ok;
@@ -121,6 +127,7 @@ bool dir_update_changer(JCR *jcr, AUTOCHANGER *changer)
       0, 0, 0,                  /* is_open, is_labeled, offline */
       0, 0,                     /* reserved, max_writers */
       0,                        /* Autoselect */
+      0,                        /* Enabled */
       changer->device->size(),  /* Number of devices */
       "0",                      /* PoolId */
       "*",                      /* ChangerName */
@@ -173,14 +180,15 @@ static bool do_get_volume_info(DCR *dcr)
     n = sscanf(dir->msg, OK_media, vol.VolCatName,
                &vol.VolCatJobs, &vol.VolCatFiles,
                &vol.VolCatBlocks, &vol.VolCatAmetaBytes,
-               &vol.VolCatMounts, &vol.VolCatErrors,
+               &vol.VolCatAdataBytes, &vol.VolCatHoleBytes,
+               &vol.VolCatHoles, &vol.VolCatMounts, &vol.VolCatErrors,
                &vol.VolCatWrites, &vol.VolCatMaxBytes,
                &vol.VolCatCapacityBytes, vol.VolCatStatus,
                &vol.Slot, &vol.VolCatMaxJobs, &vol.VolCatMaxFiles,
                &InChanger, &vol.VolReadTime, &vol.VolWriteTime,
-               &vol.EndFile, &vol.EndBlock, &vol.VolCatParts,
+               &vol.EndFile, &vol.EndBlock, &vol.VolCatType,
                &vol.LabelType, &vol.VolMediaId, &vol.VolScratchPoolId);
-    if (n != 23) {
+    if (n != 26) {
        Dmsg1(dbglvl, "get_volume_info failed: ERR=%s", dir->msg);
        /*
         * Note, we can get an error here either because there is
@@ -201,7 +209,8 @@ static bool do_get_volume_info(DCR *dcr)
     Dmsg2(dbglvl, "do_reqest_vol_info return true slot=%d Volume=%s\n",
           vol.Slot, vol.VolCatName);
     Dmsg3(dbglvl, "Dir returned VolCatAmetaBytes=%lld Status=%s Vol=%s\n",
-       vol.VolCatAmetaBytes, vol.VolCatStatus, vol.VolCatName);
+       vol.VolCatAmetaBytes,
+       vol.VolCatStatus, vol.VolCatName);
     return true;
 }
 
@@ -270,7 +279,8 @@ bool dir_find_next_appendable_volume(DCR *dcr)
     for (int vol_index=1;  vol_index < 30; vol_index++) {
        bash_spaces(dcr->media_type);
        bash_spaces(dcr->pool_name);
-       dir->fsend(Find_media, jcr->Job, vol_index, dcr->pool_name, dcr->media_type);
+       dir->fsend(Find_media, jcr->Job, vol_index, dcr->pool_name, dcr->media_type,
+                  dcr->dev->dev_type);
        unbash_spaces(dcr->media_type);
        unbash_spaces(dcr->pool_name);
        Dmsg1(dbglvl, ">dird %s", dir->msg);
@@ -282,6 +292,15 @@ bool dir_find_next_appendable_volume(DCR *dcr)
              Dmsg1(dbglvl, "Got same vol = %s\n", lastVolume);
              break;
           }
+          /*
+           * If we have VolType and we are disk or ameta, the VolType must match
+           */
+          if (dcr->VolCatInfo.VolCatType != 0 &&
+              (dcr->dev->dev_type == B_FILE_DEV) &&
+               dcr->dev->dev_type != (int)dcr->VolCatInfo.VolCatType) {
+             Dmsg2(000, "Skip vol. Wanted VolType=%d Got=%d\n", dcr->dev->dev_type, dcr->VolCatInfo.VolCatType);
+             continue;
+          }
           bstrncpy(lastVolume, dcr->VolumeName, sizeof(lastVolume));
           if (dcr->can_i_write_volume()) {
              Dmsg1(dbglvl, "Call reserve_volume for write. Vol=%s\n", dcr->VolumeName);
@@ -338,9 +357,9 @@ bool dir_update_volume_info(DCR *dcr, bool label, bool update_LastWritten)
 {
    JCR *jcr = dcr->jcr;
    BSOCK *dir = jcr->dir_bsock;
-   DEVICE *dev = dcr->dev;
+   DEVICE *dev = dcr->ameta_dev;
    VOLUME_CAT_INFO *vol;
-   char ed1[50], ed4[50], ed5[50], ed6[50], ed7[50], ed8[50];
+   char ed1[50], ed2[50], ed3[50], ed4[50], ed5[50], ed6[50], ed7[50], ed8[50];
    int InChanger;
    bool ok = false;
    POOL_MEM VolumeName;
@@ -360,6 +379,8 @@ bool dir_update_volume_info(DCR *dcr, bool label, bool update_LastWritten)
    /* Lock during Volume update */
    P(vol_info_mutex);
    dev->Lock_VolCatInfo();
+   Dmsg3(100, "Update cat VolBytes=%lld Status=%s Vol=%s\n",
+      vol->VolCatAmetaBytes, vol->VolCatStatus, vol->VolCatName);
    /* Just labeled or relabeled the tape */
    if (label) {
       dev->setVolCatStatus("Append");
@@ -370,10 +391,18 @@ bool dir_update_volume_info(DCR *dcr, bool label, bool update_LastWritten)
    pm_strcpy(VolumeName, vol->VolCatName);
    bash_spaces(VolumeName);
    InChanger = vol->InChanger;
+   vol->VolCatHoleBytes = 0;
+
+   /* Set device type where this Volume used */
+   if (vol->VolCatType == 0) {
+      vol->VolCatType = dev->dev_type;
+   }
    dir->fsend(Update_media, jcr->Job,
       VolumeName.c_str(), vol->VolCatJobs, vol->VolCatFiles,
       vol->VolCatBlocks, edit_uint64(vol->VolCatAmetaBytes, ed1),
-      vol->VolCatMounts, vol->VolCatErrors,
+      edit_uint64(vol->VolCatAdataBytes, ed2),
+      edit_uint64(vol->VolCatHoleBytes, ed3),
+      vol->VolCatHoles, vol->VolCatMounts, vol->VolCatErrors,
       vol->VolCatWrites, edit_uint64(vol->VolCatMaxBytes, ed4),
       edit_uint64(vol->VolLastWritten, ed5),
       vol->VolCatStatus, vol->Slot, label,
@@ -381,7 +410,7 @@ bool dir_update_volume_info(DCR *dcr, bool label, bool update_LastWritten)
       edit_int64(vol->VolReadTime, ed6),
       edit_int64(vol->VolWriteTime, ed7),
       edit_uint64(vol->VolFirstWritten, ed8),
-      vol->VolCatParts);
+      vol->VolCatType);
     Dmsg1(100, ">dird %s", dir->msg);
 
    /* Do not lock device here because it may be locked from label */
@@ -399,7 +428,13 @@ bool dir_update_volume_info(DCR *dcr, bool label, bool update_LastWritten)
       }
       Dmsg1(100, "get_volume_info() %s", dir->msg);
       /* Update dev Volume info in case something changed (e.g. expired) */
+      dcr->VolCatInfo.VolCatAdataBytes = dev->VolCatInfo.VolCatAdataBytes;
       dcr->VolCatInfo.VolCatAmetaBytes = dev->VolCatInfo.VolCatAmetaBytes;
+      dcr->VolCatInfo.VolCatHoleBytes = dev->VolCatInfo.VolCatHoleBytes;
+      dcr->VolCatInfo.VolCatHoles = dev->VolCatInfo.VolCatHoles;
+      dcr->VolCatInfo.VolCatPadding = dev->VolCatInfo.VolCatPadding;
+      dcr->VolCatInfo.VolCatAmetaPadding = dev->VolCatInfo.VolCatAmetaPadding;
+      dcr->VolCatInfo.VolCatAdataPadding = dev->VolCatInfo.VolCatAdataPadding;
       dcr->VolCatInfo.VolCatFiles = dev->VolCatInfo.VolCatFiles;
       bstrncpy(vol->VolCatStatus, dcr->VolCatInfo.VolCatStatus, sizeof(vol->VolCatStatus));
       /* ***FIXME***  copy other fields that can change, if any */
@@ -412,18 +447,87 @@ bail_out:
    return ok;
 }
 
-/**
+struct JOBMEDIA_ITEM {
+   dlink link;
+   uint32_t VolFirstIndex;
+   uint32_t VolLastIndex;
+   uint32_t StartFile;
+   uint32_t EndFile;
+   uint32_t StartBlock;
+   uint32_t EndBlock;
+   int64_t  VolMediaId;
+};
+
+void create_jobmedia_queue(JCR *jcr)
+{
+   JOBMEDIA_ITEM *item = NULL;
+   jcr->jobmedia_queue = New(dlist(item, &item->link));
+}
+
+bool flush_jobmedia_queue(JCR *jcr)
+{
+   JOBMEDIA_ITEM *item;
+   BSOCK *dir = jcr->dir_bsock;
+   bool ok;
+
+   if (!jcr->jobmedia_queue || jcr->jobmedia_queue->size() == 0) {
+      //Dmsg0(000, "No jobmedia_queue\n");
+      return true;     /* should never happen */
+   }
+   Dmsg1(400, "=== Flush jobmedia queue = %d\n", jcr->jobmedia_queue->size());
+
+   dir->fsend(Create_jobmedia, jcr->Job);
+   foreach_dlist(item, jcr->jobmedia_queue) {
+      ok = dir->fsend("%u %u %u %u %u %u %lld\n",
+         item->VolFirstIndex, item->VolLastIndex,
+         item->StartFile, item->EndFile,
+         item->StartBlock, item->EndBlock,
+         item->VolMediaId);
+      Dmsg2(400, "sd->dir: ok=%d Jobmedia=%s", ok, dir->msg);
+   }
+   dir->signal(BNET_EOD);
+   jcr->jobmedia_queue->destroy();
+
+   if (dir->recv() <= 0) {
+      Dmsg0(dbglvl, "create_jobmedia error bnet_recv\n");
+      Jmsg(jcr, M_FATAL, 0, _("Error creating JobMedia records: ERR=%s\n"),
+           dir->bstrerror());
+      return false;
+   }
+   Dmsg1(210, "<dird %s", dir->msg);
+   if (strcmp(dir->msg, OK_create) != 0) {
+      Dmsg1(dbglvl, "Bad response from Dir: %s\n", dir->msg);
+      Jmsg(jcr, M_FATAL, 0, _("Error creating JobMedia records: %s\n"), dir->msg);
+      return false;
+   }
+   return true;
+}
+
+/*
  * After writing a Volume, create the JobMedia record.
  */
 bool dir_create_jobmedia_record(DCR *dcr, bool zero)
 {
    JCR *jcr = dcr->jcr;
    BSOCK *dir = jcr->dir_bsock;
-   char ed1[50];
+   JOBMEDIA_ITEM *item;
+   bool ok = true;;
 
    if (!dcr->WroteVol) {
+      return true;
+   }
+   if (dcr->VolLastIndex == 0) {
+      Dmsg7(dbglvl, "JobMedia Vol=%s wrote=%d MediaId=%d FI=%d LI=%d StartBlock=%d EndBlock=%d Suppressed\n",
+         dcr->VolumeName, dcr->WroteVol, dcr->VolMediaId,
+         dcr->VolFirstIndex, dcr->VolLastIndex, dcr->StartBlock, dcr->EndBlock);
       return true;                    /* nothing written to the Volume */
    }
+   if (dcr->StartFile == dcr->EndFile && dcr->EndBlock < dcr->StartBlock) {
+      Dmsg7(0/*dbglvl*/, "PROBLEM Vol=%s wrote=%d MediaId=%d FI=%d LI=%d StartBlock=%d EndBlock=%d Suppressed\n",
+         dcr->VolumeName, dcr->WroteVol, dcr->VolMediaId,
+         dcr->VolFirstIndex, dcr->VolLastIndex, dcr->StartBlock, dcr->EndBlock);
+      return true;
+   }
 
    /* If system job, do not update catalog */
    if (jcr->getJobType() == JT_SYSTEM) {
@@ -439,36 +543,50 @@ bool dir_create_jobmedia_record(DCR *dcr, bool zero)
       return true;
    }
 
+   /*
+    * If this Job is incomplete, we need to backup the FileIndex
+    *  to the last correctly saved file so that the JobMedia
+    *  LastIndex is correct.
+    *
+    *  Note: ***FIXME*** though it is not required, we probably
+    *   should also keep a last EndFile and last EndBlock and
+    *   reset them correctly too so that the JobMedia record is
+    *   really correct.
+    */
+   if (jcr->is_JobStatus(JS_Incomplete)) {
+      dcr->VolLastIndex = dir->get_lastFileIndex();
+      Dmsg1(100, "======= Set FI=%ld\n", dcr->VolLastIndex);
+   }
+
    Dmsg7(100, "JobMedia Vol=%s wrote=%d MediaId=%d FI=%d LI=%d StartBlock=%d EndBlock=%d Wrote\n",
       dcr->VolumeName, dcr->WroteVol, dcr->VolMediaId,
       dcr->VolFirstIndex, dcr->VolLastIndex, dcr->StartBlock, dcr->EndBlock);
    dcr->WroteVol = false;
+   item = (JOBMEDIA_ITEM *)malloc(sizeof(JOBMEDIA_ITEM));
    if (zero) {
-      /* Send dummy place holder to avoid purging */
-      dir->fsend(Create_job_media, jcr->Job,
-         0 , 0, 0, 0, 0, 0, 0, 0, edit_uint64(dcr->VolMediaId, ed1));
+      item->VolFirstIndex = item->VolLastIndex = 0;
+      item->StartFile = item->EndFile = 0;
+      item->StartBlock = item->EndBlock = 0;
+      item->VolMediaId = dcr->VolMediaId;
    } else {
-      dir->fsend(Create_job_media, jcr->Job,
-         dcr->VolFirstIndex, dcr->VolLastIndex,
-         dcr->StartFile, dcr->EndFile,
-         dcr->StartBlock, dcr->EndBlock,
-         dcr->Copy, dcr->Stripe,
-         edit_uint64(dcr->VolMediaId, ed1));
-   }
-   Dmsg1(dbglvl, ">dird %s", dir->msg);
-   if (dir->recv() <= 0) {
-      Dmsg0(dbglvl, "create_jobmedia error bnet_recv\n");
-      Jmsg(jcr, M_FATAL, 0, _("Error creating JobMedia record: ERR=%s\n"),
-           dir->bstrerror());
-      return false;
+      item->VolFirstIndex = dcr->VolFirstIndex;
+      item->VolLastIndex = dcr->VolLastIndex;
+      item->StartFile = dcr->StartFile;
+      item->EndFile = dcr->EndFile;
+      item->StartBlock = dcr->StartBlock;
+      item->EndBlock = dcr->EndBlock;
+      item->VolMediaId = dcr->VolMediaId;
    }
-   Dmsg1(210, "<dird %s", dir->msg);
-   if (strcmp(dir->msg, OK_create) != 0) {
-      Dmsg1(dbglvl, "Bad response from Dir: %s\n", dir->msg);
-      Jmsg(jcr, M_FATAL, 0, _("Error creating JobMedia record: %s\n"), dir->msg);
-      return false;
+   jcr->jobmedia_queue->append(item);
+   /* Flush at 100 queue size of 100 jobmedia records */
+   if (zero || jcr->jobmedia_queue->size() >= 100) {
+      ok = flush_jobmedia_queue(jcr);
    }
-   return true;
+
+   dcr->VolFirstIndex = dcr->VolLastIndex = 0;
+   dcr->StartFile = dcr->EndFile = 0;
+   dcr->StartBlock = dcr->EndBlock = 0;
+   return ok;
 }
 
 
@@ -546,6 +664,7 @@ bool dir_ask_sysop_to_create_appendable_volume(DCR *dcr)
    bool got_vol = false;
 
    if (job_canceled(jcr)) {
+      dev->poll = false;
       return false;
    }
    Dmsg0(400, "enter dir_ask_sysop_to_create_appendable_volume\n");
@@ -556,6 +675,7 @@ bool dir_ask_sysop_to_create_appendable_volume(DCR *dcr)
               _("Job %s canceled while waiting for mount on Storage Device \"%s\".\n"),
               jcr->Job, dev->print_name());
          Jmsg(jcr, M_INFO, 0, "%s", dev->errmsg);
+         dev->poll = false;
          return false;
       }
       got_vol = dir_find_next_appendable_volume(dcr);   /* get suggested volume */
@@ -594,6 +714,7 @@ bool dir_ask_sysop_to_create_appendable_volume(DCR *dcr)
                dev->print_name(), jcr->Job);
             Jmsg(jcr, M_FATAL, 0, "%s", dev->errmsg);
             Dmsg1(dbglvl, "Gave up waiting on device %s\n", dev->print_name());
+            dev->poll = false;
             return false;             /* exceeded maximum waits */
          }
          continue;
@@ -602,12 +723,14 @@ bool dir_ask_sysop_to_create_appendable_volume(DCR *dcr)
          berrno be;
          Mmsg0(dev->errmsg, _("pthread error in mount_next_volume.\n"));
          Jmsg(jcr, M_FATAL, 0, "%s", dev->errmsg);
+         dev->poll = false;
          return false;
       }
       Dmsg1(dbglvl, "Someone woke me for device %s\n", dev->print_name());
    }
 
 get_out:
+   dev->poll = false;
    jcr->sendJobStatus(JS_Running);
    Dmsg0(dbglvl, "leave dir_ask_sysop_to_create_appendable_volume\n");
    return true;
@@ -634,6 +757,13 @@ bool dir_ask_sysop_to_mount_volume(DCR *dcr, bool write_access)
    Dmsg0(400, "enter dir_ask_sysop_to_mount_volume\n");
    if (!dcr->VolumeName[0]) {
       Mmsg0(dev->errmsg, _("Cannot request another volume: no volume name given.\n"));
+      dev->poll = false;
+      return false;
+   }
+
+   if (dcr->no_mount_request) {
+      Mmsg(dev->errmsg, _("The current operation doesn't support mount request\n"));
+      dev->poll = false;
       return false;
    }
 
@@ -641,6 +771,7 @@ bool dir_ask_sysop_to_mount_volume(DCR *dcr, bool write_access)
       if (job_canceled(jcr)) {
          Mmsg(dev->errmsg, _("Job %s canceled while waiting for mount on Storage Device %s.\n"),
               jcr->Job, dev->print_name());
+         dev->poll = false;
          return false;
       }
 
@@ -654,7 +785,7 @@ bool dir_ask_sysop_to_mount_volume(DCR *dcr, bool write_access)
        *   Otherwise skip it.
        */
       if (!dev->poll && (stat == W_TIMEOUT || stat == W_MOUNT)) {
-         char *msg;
+         const char *msg;
          if (write_access) {
             msg = _("%sPlease mount append Volume \"%s\" or label a new one for:\n"
               "    Job:          %s\n"
@@ -695,6 +826,7 @@ bool dir_ask_sysop_to_mount_volume(DCR *dcr, bool write_access)
                dev->print_name(), jcr->Job);
             Jmsg(jcr, M_FATAL, 0, "%s", dev->errmsg);
             Dmsg1(400, "Gave up waiting on device %s\n", dev->print_name());
+            dev->poll = false;
             return false;             /* exceeded maximum waits */
          }
          continue;
@@ -703,6 +835,7 @@ bool dir_ask_sysop_to_mount_volume(DCR *dcr, bool write_access)
          berrno be;
          Mmsg(dev->errmsg, _("pthread error in mount_volume\n"));
          Jmsg(jcr, M_FATAL, 0, "%s", dev->errmsg);
+         dev->poll = false;
          return false;
       }
       Dmsg1(100, "Someone woke me for device %s\n", dev->print_name());
@@ -710,6 +843,7 @@ bool dir_ask_sysop_to_mount_volume(DCR *dcr, bool write_access)
    }
 
 get_out:
+   dev->poll = false;
    jcr->sendJobStatus(JS_Running);
    Dmsg0(100, "leave dir_ask_sysop_to_mount_volume\n");
    return true;
diff --git a/src/stored/authenticate.c b/src/stored/authenticate.c
index 2289c30..7572cd7 100644
--- a/src/stored/authenticate.c
+++ b/src/stored/authenticate.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Authenticate caller
@@ -26,83 +30,22 @@
 
 extern STORES *me;               /* our Global resource */
 
-
 const int dbglvl = 50;
 
-/* Version at end of Hello
- *   prior to 06Aug13 no version
- *   1 06Aug13 - added comm line compression
- *   2 13Dec13 - added api version to status command
- *   3 22Feb14 - Added SD->SD with SD_Calls_Client
- */
-#define SD_VERSION 3
-#define FD_VERSION 10
-static char hello_sd[]  = "Hello Bacula SD: Start Job %s %d %d\n";
-
-
-static char Dir_sorry[] = "3999 No go\n";
-static char OK_hello[]  = "3000 OK Hello %d\n";
-
 static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
 
-/*********************************************************************
- *
- *
+/*
+ * Authenticate the Director
  */
-static int authenticate(int rcode, BSOCK *bs, JCR* jcr)
+bool authenticate_director(JCR* jcr)
 {
-   POOLMEM *dirname;
-   DIRRES *director = NULL;
+   DIRRES *director = jcr->director;
    int tls_local_need = BNET_TLS_NONE;
    int tls_remote_need = BNET_TLS_NONE;
    int compatible = true;                  /* require md5 compatible DIR */
    bool auth_success = false;
    alist *verify_list = NULL;
-   int dir_version = 0;
-
-   if (rcode != R_DIRECTOR) {
-      Dmsg1(dbglvl, "I only authenticate Directors, not %d\n", rcode);
-      Jmsg1(jcr, M_FATAL, 0, _("I only authenticate Directors, not %d\n"), rcode);
-      return 0;
-   }
-   if (bs->msglen < 25 || bs->msglen > 500) {
-      Dmsg2(dbglvl, "Bad Hello command from Director at %s. Len=%d.\n",
-            bs->who(), bs->msglen);
-      Jmsg2(jcr, M_FATAL, 0, _("Bad Hello command from Director at %s. Len=%d.\n"),
-            bs->who(), bs->msglen);
-      return 0;
-   }
-   dirname = get_pool_memory(PM_MESSAGE);
-   dirname = check_pool_memory_size(dirname, bs->msglen);
-
-   if (sscanf(bs->msg, "Hello SD: Bacula Director %127s calling %d",
-          dirname, &dir_version) != 2 &&
-       sscanf(bs->msg, "Hello SD: Bacula Director %127s calling",
-          dirname) != 1) {
-      bs->msg[100] = 0;
-      Dmsg2(dbglvl, "Bad Hello command from Director at %s: %s\n",
-            bs->who(), bs->msg);
-      Jmsg2(jcr, M_FATAL, 0, _("Bad Hello command from Director at %s: %s\n"),
-            bs->who(), bs->msg);
-      free_pool_memory(dirname);
-      return 0;
-   }
-   director = NULL;
-   unbash_spaces(dirname);
-   foreach_res(director, rcode) {
-      if (strcasecmp(director->hdr.name, dirname) == 0) {
-         break;
-      }
-   }
-   if (!director) {
-      Dmsg2(dbglvl, "Connection from unknown Director %s at %s rejected.\n",
-            dirname, bs->who());
-      Jmsg2(jcr, M_FATAL, 0, _("Connection from unknown Director %s at %s rejected.\n"
-       "Please see " MANUAL_AUTH_URL " for help.\n"),
-            dirname, bs->who());
-      free_pool_memory(dirname);
-      return 0;
-   }
+   BSOCK *dir = jcr->dir_bsock;
 
    /* TLS Requirement */
    if (director->tls_enable) {
@@ -121,21 +64,21 @@ static int authenticate(int rcode, BSOCK *bs, JCR* jcr)
       verify_list = director->tls_allowed_cns;
    }
 
-   /* Timeout Hello after 10 mins */
-   btimer_t *tid = start_bsock_timer(bs, AUTH_TIMEOUT);
-   auth_success = cram_md5_challenge(bs, director->password, tls_local_need, compatible);
+   /* Timeout authentication after 10 mins */
+   btimer_t *tid = start_bsock_timer(dir, AUTH_TIMEOUT);
+   auth_success = cram_md5_challenge(dir, director->password, tls_local_need, compatible);
    if (auth_success) {
-      auth_success = cram_md5_respond(bs, director->password, &tls_remote_need, &compatible);
+      auth_success = cram_md5_respond(dir, director->password, &tls_remote_need, &compatible);
       if (!auth_success) {
-         Dmsg1(dbglvl, "cram_get_auth respond failed with Director %s\n", bs->who());
+         Dmsg1(dbglvl, "cram_get_auth respond failed with Director %s\n", dir->who());
       }
    } else {
-      Dmsg1(dbglvl, "cram_auth challenge failed with Director %s\n", bs->who());
+      Dmsg1(dbglvl, "cram_auth challenge failed with Director %s\n", dir->who());
    }
 
    if (!auth_success) {
       Jmsg0(jcr, M_FATAL, 0, _("Incorrect password given by Director.\n"
-       "Please see " MANUAL_AUTH_URL " for help.\n"));
+       "For help, please see: " MANUAL_AUTH_URL "\n"));
       auth_success = false;
       goto auth_fatal;
    }
@@ -159,53 +102,33 @@ static int authenticate(int rcode, BSOCK *bs, JCR* jcr)
 
    if (tls_local_need >= BNET_TLS_OK && tls_remote_need >= BNET_TLS_OK) {
       /* Engage TLS! Full Speed Ahead! */
-      if (!bnet_tls_server(director->tls_ctx, bs, verify_list)) {
+      if (!bnet_tls_server(director->tls_ctx, dir, verify_list)) {
          Jmsg(jcr, M_FATAL, 0, _("TLS negotiation failed with DIR at \"%s:%d\"\n"),
-            bs->host(), bs->port());
+            dir->host(), dir->port());
          auth_success = false;
          goto auth_fatal;
       }
       if (director->tls_authenticate) {     /* authenticate with tls only? */
-         bs->free_tls();                    /* yes, shut it down */
+         dir->free_tls();                   /* yes, shut it down */
       }
    }
 
 auth_fatal:
    stop_bsock_timer(tid);
-   free_pool_memory(dirname);
    jcr->director = director;
-   return auth_success;
-}
-
-/*
- * Inititiate the message channel with the Director.
- * He has made a connection to our server.
- *
- * Basic tasks done here:
- *   Assume the Hello message is already in the input
- *     buffer.  We then authenticate him.
- *   Get device, media, and pool information from Director
- *
- *   This is the channel across which we will send error
- *     messages and job status information.
- */
-int authenticate_director(JCR *jcr)
-{
-   BSOCK *dir = jcr->dir_bsock;
-
-   if (!authenticate(R_DIRECTOR, dir, jcr)) {
-      dir->fsend(Dir_sorry);
-      Dmsg1(dbglvl, "Unable to authenticate Director at %s.\n", dir->who());
-      Jmsg1(jcr, M_ERROR, 0, _("Unable to authenticate Director at %s.\n"), dir->who());
-      bmicrosleep(5, 0);
-      return 0;
+   if (auth_success) {
+      return send_hello_ok(dir);
    }
-   return dir->fsend(OK_hello, SD_VERSION);
+   send_sorry(dir);
+   Dmsg1(dbglvl, "Unable to authenticate Director at %s.\n", dir->who());
+   Jmsg1(jcr, M_ERROR, 0, _("Unable to authenticate Director at %s.\n"), dir->who());
+   bmicrosleep(5, 0);
+   return false;
 }
 
-int authenticate_filed(JCR *jcr)
+
+int authenticate_filed(JCR *jcr, BSOCK *fd, int FDVersion)
 {
-   BSOCK *fd = jcr->file_bsock;
    int tls_local_need = BNET_TLS_NONE;
    int tls_remote_need = BNET_TLS_NONE;
    int compatible = true;                 /* require md5 compatible FD */
@@ -229,7 +152,7 @@ int authenticate_filed(JCR *jcr)
       verify_list = me->tls_allowed_cns;
    }
 
-   /* Timeout Hello after 5 mins */
+   /* Timeout authentication after 5 mins */
    btimer_t *tid = start_bsock_timer(fd, AUTH_TIMEOUT);
    /* Challenge FD */
    Dmsg0(050, "Challenge FD\n");
@@ -247,7 +170,7 @@ int authenticate_filed(JCR *jcr)
 
    if (!auth_success) {
       Jmsg(jcr, M_FATAL, 0, _("Incorrect authorization key from File daemon at %s rejected.\n"
-       "Please see " MANUAL_AUTH_URL " for help.\n"),
+       "For help, please see: " MANUAL_AUTH_URL "\n"),
            fd->who());
       auth_success = false;
       goto auth_fatal;
@@ -287,13 +210,17 @@ auth_fatal:
    stop_bsock_timer(tid);
    if (!auth_success) {
       Jmsg(jcr, M_FATAL, 0, _("Incorrect authorization key from File daemon at %s rejected.\n"
-       "Please see " MANUAL_AUTH_URL " for help.\n"),
+       "For help, please see: " MANUAL_AUTH_URL "\n"),
            fd->who());
    }
-   jcr->authenticated = auth_success;
-   if (auth_success && jcr->FDVersion >= 5) {
-      /* Send hello and our version to FD */
-      fd->fsend(OK_hello, SD_VERSION);
+
+   /* Version 5 of the protocol is a bit special, it is used by both 6.0.0
+    * Enterprise version and 7.0.x Community version, but do not support the
+    * same level of features. As nobody is using the 6.0.0 release, we can
+    * be pretty sure that the FD in version 5 is a community FD.
+    */
+   if (auth_success && (FDVersion >= 9 || FDVersion == 5)) {
+      send_hello_ok(fd);
    }
    return auth_success;
 }
@@ -302,7 +229,7 @@ auth_fatal:
  * First prove our identity to the Storage daemon, then
  * make him prove his identity.
  */
-bool authenticate_storagedaemon(JCR *jcr, char *Job)
+bool authenticate_storagedaemon(JCR *jcr)
 {
    BSOCK *sd = jcr->store_bsock;
    int tls_local_need = BNET_TLS_NONE;
@@ -331,11 +258,6 @@ bool authenticate_storagedaemon(JCR *jcr, char *Job)
       goto auth_fatal;
    }
 
-
-   bash_spaces(Job);
-   sd->fsend(hello_sd, Job, FD_VERSION, SD_VERSION);
-   Dmsg1(100, "Send to SD: %s\n", sd->msg);
-
    /* Respond to SD challenge */
    Dmsg0(050, "Respond to SD challenge\n");
    auth_success = cram_md5_respond(sd, jcr->sd_auth_key, &tls_remote_need, &compatible);
@@ -395,7 +317,6 @@ bool authenticate_storagedaemon(JCR *jcr, char *Job)
       goto auth_fatal;
    }
    sscanf(sd->msg, "3000 OK Hello %d", &sd_version);
-
    /* At this point, we have successfully connected */
 
 auth_fatal:
diff --git a/src/stored/autochanger.c b/src/stored/autochanger.c
index 4f294e6..4060056 100644
--- a/src/stored/autochanger.c
+++ b/src/stored/autochanger.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2002-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
diff --git a/src/stored/bacula-sd.conf.in b/src/stored/bacula-sd.conf.in
index 73d5669..f994810 100644
--- a/src/stored/bacula-sd.conf.in
+++ b/src/stored/bacula-sd.conf.in
@@ -9,6 +9,10 @@
 #   "Media Type" in the Device resource, please ensure
 #   that dird.conf has corresponding changes.
 #
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 
 Storage {                             # definition of myself
   Name = @basename at -sd
@@ -39,6 +43,8 @@ Director {
 #
 # Note, for a list of additional Device templates please
 #  see the directory <bacula-source>/examples/devices
+# Or follow the following link:
+#  http://bacula.svn.sourceforge.net/viewvc/bacula/trunk/bacula/examples/devices/
 #
 
 #
diff --git a/src/stored/bcopy.c b/src/stored/bcopy.c
index ce1144e..eaac36e 100644
--- a/src/stored/bcopy.c
+++ b/src/stored/bcopy.c
@@ -1,23 +1,27 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2002-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
  *  Program to copy a Bacula from one volume to another.
  *
- *   Written by Kern E. Sibbald, October 2002
+ *   Kern E. Sibbald, October 2002
  *
  */
 
@@ -54,12 +58,11 @@ bool forge_on = false;                /* proceed inspite of I/O errors */
 pthread_mutex_t device_release_mutex = PTHREAD_MUTEX_INITIALIZER;
 pthread_cond_t wait_device_release = PTHREAD_COND_INITIALIZER;
 
-
 static void usage()
 {
    fprintf(stderr, _(
 PROG_COPYRIGHT
-"\nVersion: %s (%s)\n\n"
+"\n%sVersion: %s (%s)\n\n"
 "Usage: bcopy [-d debug_level] <input-archive> <output-archive>\n"
 "       -b bootstrap      specify a bootstrap file\n"
 "       -c <file>         specify a Storage configuration file\n"
@@ -70,7 +73,7 @@ PROG_COPYRIGHT
 "       -p                proceed inspite of errors\n"
 "       -v                verbose\n"
 "       -w <dir>          specify working directory (default /tmp)\n"
-"       -?                print this message\n\n"), 2002, VERSION, BDATE);
+"       -?                print this message\n\n"), 2002, "", VERSION, BDATE);
    exit(1);
 }
 
@@ -165,7 +168,7 @@ int main (int argc, char *argv[])
 
    /* Setup and acquire input device for reading */
    Dmsg0(100, "About to setup input jcr\n");
-   in_jcr = setup_jcr("bcopy", argv[0], bsr, iVolumeName, SD_READ); /* read device */
+   in_jcr = setup_jcr("bcopy", argv[0], bsr, iVolumeName, SD_READ, true/*read dedup data*/); /* read device */
    if (!in_jcr) {
       exit(1);
    }
@@ -203,7 +206,7 @@ int main (int argc, char *argv[])
    ok = read_records(in_jcr->dcr, record_cb, mount_next_read_volume);
 
    if (ok || out_dev->can_write()) {
-      if (!out_jcr->dcr->write_block_to_device()) {
+      if (!out_jcr->dcr->write_final_block_to_device()) {
          Pmsg0(000, _("Write of last block failed.\n"));
       }
    }
@@ -237,7 +240,7 @@ static bool record_cb(DCR *in_dcr, DEV_RECORD *rec)
       get_session_record(in_dcr->dev, rec, &sessrec);
 
       if (verbose > 1) {
-         dump_label_record(in_dcr->dev, rec, 1);
+         dump_label_record(in_dcr->dev, rec, 1/*verbose*/, false/*check err*/);
       }
       switch (rec->FileIndex) {
       case PRE_LABEL:
@@ -352,6 +355,7 @@ static void get_session_record(DEVICE *dev, DEV_RECORD *rec, SESSION_LABEL *sess
 bool    dir_find_next_appendable_volume(DCR *dcr) { return 1;}
 bool    dir_update_volume_info(DCR *dcr, bool relabel, bool update_LastWritten) { return 1; }
 bool    dir_create_jobmedia_record(DCR *dcr, bool zero) { return 1; }
+bool    flush_jobmedia_queue(JCR *jcr) { return true; }
 bool    dir_ask_sysop_to_create_appendable_volume(DCR *dcr) { return 1; }
 bool    dir_update_file_attributes(DCR *dcr, DEV_RECORD *rec) { return 1;}
 bool    dir_send_job_status(JCR *jcr) {return 1;}
@@ -371,9 +375,6 @@ bool dir_get_volume_info(DCR *dcr, enum get_vol_info_rw  writing)
 {
    Dmsg0(100, "Fake dir_get_volume_info\n");
    dcr->setVolCatName(dcr->VolumeName);
-#ifdef BUILD_DVD
-   dcr->VolCatInfo.VolCatParts = find_num_dvd_parts(dcr);
-#endif
-   Dmsg2(500, "Vol=%s num_parts=%d\n", dcr->getVolCatName(), dcr->VolCatInfo.VolCatParts);
+   Dmsg2(500, "Vol=%s VolType=%d\n", dcr->getVolCatName(), dcr->VolCatInfo.VolCatType);
    return 1;
 }
diff --git a/src/stored/bextract.c b/src/stored/bextract.c
index 5e2664a..baeb42e 100644
--- a/src/stored/bextract.c
+++ b/src/stored/bextract.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -46,7 +50,10 @@ static bool extract = false;
 static int non_support_data = 0;
 static long total = 0;
 static ATTR *attr;
+static POOLMEM *curr_fname;
 static char *where;
+static uint64_t num_errors = 0;
+static uint64_t num_records = 0;
 static uint32_t num_files = 0;
 static uint32_t compress_buf_size = 70000;
 static POOLMEM *compress_buf;
@@ -65,6 +72,7 @@ void *start_heap;
 char *configfile = NULL;
 STORES *me = NULL;                    /* our Global resource */
 bool forge_on = false;
+bool skip_extract = false;
 pthread_mutex_t device_release_mutex = PTHREAD_MUTEX_INITIALIZER;
 pthread_cond_t wait_device_release = PTHREAD_COND_INITIALIZER;
 
@@ -72,18 +80,20 @@ static void usage()
 {
    fprintf(stderr, _(
 PROG_COPYRIGHT
-"\nVersion: %s (%s)\n\n"
+"\n%sVersion: %s (%s)\n\n"
 "Usage: bextract <options> <bacula-archive-device-name> <directory-to-store-files>\n"
 "       -b <file>       specify a bootstrap file\n"
 "       -c <file>       specify a Storage configuration file\n"
 "       -d <nn>         set debug level to <nn>\n"
 "       -dt             print timestamp in debug output\n"
+"       -T              send debug traces to trace file\n"
 "       -e <file>       exclude list\n"
 "       -i <file>       include list\n"
 "       -p              proceed inspite of I/O errors\n"
+"       -t              read data from volume, do not write anything\n"
 "       -v              verbose\n"
 "       -V <volumes>    specify Volume names (separated by |)\n"
-"       -?              print this message\n\n"), 2000, VERSION, BDATE);
+"       -?              print this message\n\n"), 2000, "", VERSION, BDATE);
    exit(1);
 }
 
@@ -110,13 +120,21 @@ int main (int argc, char *argv[])
    ff = init_find_files();
    binit(&bfd);
 
-   while ((ch = getopt(argc, argv, "b:c:d:e:i:pvV:?")) != -1) {
+   while ((ch = getopt(argc, argv, "Ttb:c:d:e:i:pvV:?")) != -1) {
       switch (ch) {
+      case 't':
+         skip_extract = true;
+         break;
+
       case 'b':                    /* bootstrap file */
          bsr = parse_bsr(NULL, optarg);
 //       dump_bsr(bsr, true);
          break;
 
+      case 'T':                 /* Send debug to trace file */
+         set_trace(1);
+         break;
+
       case 'c':                    /* specify config file */
          if (configfile != NULL) {
             free(configfile);
@@ -226,11 +244,12 @@ int main (int argc, char *argv[])
 
 static void do_extract(char *devname)
 {
+   char ed1[50];
    struct stat statp;
 
    enable_backup_privileges(NULL, 1);
 
-   jcr = setup_jcr("bextract", devname, bsr, VolumeName, SD_READ);
+   jcr = setup_jcr("bextract", devname, bsr, VolumeName, SD_READ, false/*read dedup data*/);
    if (!jcr) {
       exit(1);
    }
@@ -255,6 +274,8 @@ static void do_extract(char *devname)
    attr = new_attr(jcr);
 
    compress_buf = get_memory(compress_buf_size);
+   curr_fname = get_pool_memory(PM_FNAME);
+   *curr_fname = 0;
 
    read_records(dcr, record_cb, mount_next_read_volume);
    /* If output file is still open, it was the last one in the
@@ -267,8 +288,12 @@ static void do_extract(char *devname)
    free_attr(attr);
    free_jcr(jcr);
    dev->term();
+   free_pool_memory(curr_fname);
 
    printf(_("%u files restored.\n"), num_files);
+   if (num_errors) {
+      printf(_("Found %s error%s\n"), edit_uint64(num_errors, ed1), num_errors>1? "s":"");
+   }
    return;
 }
 
@@ -297,13 +322,46 @@ static bool store_data(BFILE *bfd, char *data, const int32_t length)
  */
 static bool record_cb(DCR *dcr, DEV_RECORD *rec)
 {
-   int stat;
+   int stat, ret=true;
    JCR *jcr = dcr->jcr;
+   char ed1[50];
+
+   bool     restoredatap = false;
+   POOLMEM *orgdata = NULL;
+   uint32_t orgdata_len = 0;
 
    if (rec->FileIndex < 0) {
       return true;                    /* we don't want labels */
    }
 
+   /* In this mode, we do not create any file on disk, just read
+    * everything from the volume.
+    */
+   if (skip_extract) {
+      switch (rec->maskedStream) {
+      case STREAM_UNIX_ATTRIBUTES:
+      case STREAM_UNIX_ATTRIBUTES_EX:
+         if (!unpack_attributes_record(jcr, rec->Stream, rec->data, rec->data_len, attr)) {
+            Emsg0(M_ERROR_TERM, 0, _("Cannot continue.\n"));
+         }
+         if (verbose) {
+            attr->data_stream = decode_stat(attr->attr, &attr->statp, sizeof(attr->statp), &attr->LinkFI);
+            build_attr_output_fnames(jcr, attr);
+            print_ls_output(jcr, attr);
+         }
+         pm_strcpy(curr_fname, attr->fname);
+         num_files++;
+         break;
+      }
+      num_records++;
+
+      /* We display some progress information if verbose not set or set to 2 */
+      if (verbose != 1 && (num_records % 200000) == 0L) {
+         fprintf(stderr, "\rfiles=%d records=%s\n", num_files, edit_uint64(num_records, ed1));
+      }
+      return true;
+   }
+
    /* File Attributes stream */
 
    switch (rec->maskedStream) {
@@ -325,6 +383,9 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec)
          Emsg0(M_ERROR_TERM, 0, _("Cannot continue.\n"));
       }
 
+      /* Keep the name of the current file if we find a bad block */
+      pm_strcpy(curr_fname, attr->fname);
+
       if (file_is_included(ff, attr->fname) && !file_is_excluded(ff, attr->fname)) {
          attr->data_stream = decode_stat(attr->attr, &attr->statp, sizeof(attr->statp), &attr->LinkFI);
          if (!is_restore_stream_supported(attr->data_stream)) {
@@ -333,7 +394,7 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec)
                   stream_to_ascii(attr->data_stream));
             }
             extract = false;
-            return true;
+            goto bail_out;
          }
 
          build_attr_output_fnames(jcr, attr);
@@ -341,11 +402,12 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec)
          if (attr->type == FT_DELETED) { /* TODO: choose the right fname/ofname */
             Jmsg(jcr, M_INFO, 0, _("%s was deleted.\n"), attr->fname);
             extract = false;
-            return true;
+            goto bail_out;
          }
 
          extract = false;
          stat = create_file(jcr, attr, &bfd, REPLACE_ALWAYS);
+
          switch (stat) {
          case CF_ERROR:
          case CF_SKIP:
@@ -426,7 +488,7 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec)
                   Emsg3(M_ERROR, 0, _("Seek to %s error on %s: ERR=%s\n"),
                      edit_uint64(fileAddr, ec1), attr->ofname, be.bstrerror());
                   extract = false;
-                  return true;
+                  goto bail_out;
                }
             }
          } else {
@@ -444,7 +506,7 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec)
          if (stat != Z_OK) {
             Emsg1(M_ERROR, 0, _("Uncompression error. ERR=%d\n"), stat);
             extract = false;
-            return true;
+            goto bail_out;
          }
 
          Dmsg2(100, "Write uncompressed %d bytes, total before write=%d\n", compress_len, total);
@@ -458,7 +520,7 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec)
       if (extract) {
          Emsg0(M_ERROR, 0, _("GZIP data stream found, but GZIP not configured!\n"));
          extract = false;
-         return true;
+         goto bail_out;
       }
 #endif
       break;
@@ -491,7 +553,7 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec)
                   Emsg3(M_ERROR, 0, _("Seek to %s error on %s: ERR=%s\n"),
                      edit_uint64(fileAddr, ec1), attr->ofname, be.bstrerror());
                   extract = false;
-                  return true;
+                  goto bail_out;
                }
             }
          } else {
@@ -512,13 +574,15 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec)
          /* version check */
          if (comp_version != COMP_HEAD_VERSION) {
             Emsg1(M_ERROR, 0, _("Compressed header version error. version=0x%x\n"), comp_version);
-            return false;
+            ret = false;
+            goto bail_out;
          }
          /* size check */
          if (comp_len + sizeof(comp_stream_header) != wsize) {
             Emsg2(M_ERROR, 0, _("Compressed header size error. comp_len=%d, msglen=%d\n"),
                  comp_len, wsize);
-            return false;
+            ret = false;
+            goto bail_out;
          }
 
           switch(comp_magic) {
@@ -540,7 +604,7 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec)
                if (r != LZO_E_OK) {
                   Emsg1(M_ERROR, 0, _("LZO uncompression error. ERR=%d\n"), r);
                   extract = false;
-                  return true;
+                  goto bail_out;
                }
                Dmsg2(100, "Write uncompressed %d bytes, total before write=%d\n", compress_len, total);
                store_data(&bfd, compress_buf, compress_len);
@@ -552,7 +616,7 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec)
             default:
                Emsg1(M_ERROR, 0, _("Compression algorithm 0x%x found, but not supported!\n"), comp_magic);
                extract = false;
-               return true;
+               goto bail_out;
          }
 
       }
@@ -591,13 +655,19 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec)
       break;
 
    } /* end switch */
-   return true;
+bail_out:
+   if (restoredatap) {
+      rec->data = orgdata;
+      rec->data_len = orgdata_len;
+   }
+   return ret;
 }
 
 /* Dummies to replace askdir.c */
 bool    dir_find_next_appendable_volume(DCR *dcr) { return 1;}
 bool    dir_update_volume_info(DCR *dcr, bool relabel, bool update_LastWritten) { return 1; }
 bool    dir_create_jobmedia_record(DCR *dcr, bool zero) { return 1; }
+bool    flush_jobmedia_queue(JCR *jcr) { return true; }
 bool    dir_ask_sysop_to_create_appendable_volume(DCR *dcr) { return 1; }
 bool    dir_update_file_attributes(DCR *dcr, DEV_RECORD *rec) { return 1;}
 bool    dir_send_job_status(JCR *jcr) {return 1;}
@@ -617,9 +687,6 @@ bool dir_get_volume_info(DCR *dcr, enum get_vol_info_rw  writing)
 {
    Dmsg0(100, "Fake dir_get_volume_info\n");
    dcr->setVolCatName(dcr->VolumeName);
-#ifdef BUILD_DVD
-   dcr->VolCatInfo.VolCatParts = find_num_dvd_parts(dcr);
-#endif
-   Dmsg2(500, "Vol=%s num_parts=%d\n", dcr->getVolCatName(), dcr->VolCatInfo.VolCatParts);
+   Dmsg2(500, "Vol=%s VolType=%d\n", dcr->getVolCatName(), dcr->VolCatInfo.VolCatType);
    return 1;
 }
diff --git a/src/stored/block.c b/src/stored/block.c
index 3cf0dbb..75ec5bf 100644
--- a/src/stored/block.c
+++ b/src/stored/block.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -53,15 +57,15 @@ bool unser_block_header(JCR *jcr, DEVICE *dev, DEV_BLOCK *block);
  *        : false on failure
  *
  */
-bool DCR::write_block_to_device()
+bool DCR::write_block_to_device(bool final)
 {
-   bool stat = true;
+   bool ok = true;
    DCR *dcr = this;
 
    if (dcr->spooling) {
       Dmsg0(200, "Write to spool\n");
-      stat = write_block_to_spool_file(dcr);
-      return stat;
+      ok = write_block_to_spool_file(dcr);
+      return ok;
    }
 
    if (!is_dev_locked()) {        /* device already locked? */
@@ -70,28 +74,31 @@ bool DCR::write_block_to_device()
    }
 
    if (!check_for_newvol_or_newfile(dcr)) {
-      stat = false;
+      ok = false;
       goto bail_out;   /* fatal error */
    }
 
    Dmsg1(500, "Write block to dev=%p\n", dcr->dev);
    if (!write_block_to_dev()) {
+      Dmsg1(40, "*** Failed write_block_to_dev block=%p\n", block);
       if (job_canceled(jcr) || jcr->getJobType() == JT_SYSTEM) {
-         stat = false;
+         ok = false;
          Dmsg2(40, "cancel=%d or SYSTEM=%d\n", job_canceled(jcr),
             jcr->getJobType() == JT_SYSTEM);
       } else {
-         Dmsg0(40, "Calling fixup_device ...\n");
-         stat = fixup_device_block_write_error(dcr);
+         ok = fixup_device_block_write_error(dcr);
       }
    }
+   if (ok && final && !dir_create_jobmedia_record(dcr)) {
+      Jmsg(jcr, M_FATAL, 0, _("Error writing final JobMedia record to catalog.\n"));
+   }
 
 bail_out:
    if (!dcr->is_dev_locked()) {        /* did we lock dev above? */
       /* note, do not change this to dcr->dunlock */
       dev->Unlock();                  /* unlock it now */
    }
-   return stat;
+   return ok;
 }
 
 /*
@@ -151,7 +158,6 @@ bool DCR::write_block_to_dev()
 
    checksum = ser_block_header(block, dev->do_checksum());
 
-   /* Handle max vol size here */
    if (user_volume_size_reached(dcr, true)) {
       Dmsg0(40, "Calling terminate_writing_volume\n");
       terminate_writing_volume(dcr);
@@ -258,10 +264,18 @@ bool DCR::write_block_to_dev()
         dev->dev_errno = ENOSPC;            /* out of space */
       }
       if (dev->dev_errno == ENOSPC) {
-         dev->clear_nospace();
-         Jmsg(jcr, M_INFO, 0, _("End of Volume \"%s\" at %u:%u on device %s. Write of %u bytes got %d.\n"),
-            dev->getVolCatName(),
-            dev->file, dev->block_num, dev->print_name(), wlen, stat);
+         dev->update_freespace();
+         if (dev->is_freespace_ok() && dev->free_space < dev->min_free_space) {
+            dev->set_nospace();
+            Jmsg(jcr, M_WARNING, 0, _("Out of freespace caused End of Volume \"%s\" at %u:%u on device %s. Write of %u bytes got %d.\n"),
+               dev->getVolCatName(),
+               dev->file, dev->block_num, dev->print_name(), wlen, stat);
+         } else {
+            dev->clear_nospace();
+            Jmsg(jcr, M_INFO, 0, _("End of Volume \"%s\" at %u:%u on device %s. Write of %u bytes got %d.\n"),
+               dev->getVolCatName(),
+               dev->file, dev->block_num, dev->print_name(), wlen, stat);
+         }
       }
       if (chk_dbglvl(100)) {
          berrno be;
@@ -282,8 +296,6 @@ bool DCR::write_block_to_dev()
    Dmsg2(1300, "VolCatBytes=%lld newVolCatBytes=%lld\n", dev->VolCatInfo.VolCatBytes,
       (dev->VolCatInfo.VolCatBytes+wlen));
    dev->updateVolCatBytes(wlen);
-   Dmsg2(200, "AmetaBytes=%lld Bytes=%lld\n",
-         dev->VolCatInfo.VolCatAmetaBytes, dev->VolCatInfo.VolCatBytes);
    dev->updateVolCatBlocks(1);
    dev->EndBlock = dev->block_num;
    dev->EndFile  = dev->file;
@@ -292,34 +304,35 @@ bool DCR::write_block_to_dev()
 
    /* Update dcr values */
    if (dev->is_tape()) {
-      dcr->EndBlock = dev->EndBlock;
-      dcr->EndFile  = dev->EndFile;
+      if (dcr->EndFile != dev->EndFile || dev->EndBlock > dcr->EndBlock) {
+         dcr->EndBlock = dev->EndBlock;
+         dcr->EndFile  = dev->EndFile;
+      }
       dev->block_num++;
    } else {
       /* Save address of block just written */
       uint64_t addr = dev->file_addr + wlen - 1;
-      if (dcr->EndBlock > (uint32_t)addr ||
-          dcr->EndFile > (uint32_t)(addr >> 32)) {
-         Pmsg4(000, "Incorrect EndBlock/EndFile oldEndBlock=%d newEndBlock=%d oldEndFile=%d newEndFile=%d\n",
+      if (dcr->EndFile == (uint32_t)(addr >> 32) &&
+          (uint32_t)addr < dcr->EndBlock) {
+         Pmsg4(000, "Possible incorrect EndBlock oldEndBlock=%d newEndBlock=%d oldEndFile=%d newEndFile=%d\n",
             dcr->EndBlock, (uint32_t)addr, dcr->EndFile, (uint32_t)(addr >> 32));
+      } else {
+         dcr->EndBlock = (uint32_t)addr;
+         dcr->EndFile = (uint32_t)(addr >> 32);
       }
-      dcr->EndBlock = (uint32_t)addr;
-      dcr->EndFile = (uint32_t)(addr >> 32);
       dev->block_num = (uint32_t)addr;
       dev->file = (uint32_t)(addr >> 32);
       block->BlockAddr = dev->file_addr + wlen;
       Dmsg3(150, "Set block->BlockAddr=%lld wlen=%d block=%x\n",
          block->BlockAddr, wlen, block);
-      Dmsg2(200, "AmetaBytes=%lld Bytes=%lld\n",
-         dev->VolCatInfo.VolCatAmetaBytes, dev->VolCatInfo.VolCatBytes);
    }
    dcr->VolMediaId = dev->VolCatInfo.VolMediaId;
    Dmsg3(150, "VolFirstIndex=%d blockFirstIndex=%d Vol=%s\n",
-     dcr->VolFirstIndex, block->FirstIndex, dcr->VolumeName);
+      dcr->VolFirstIndex, block->FirstIndex, dcr->VolumeName);
    if (dcr->VolFirstIndex == 0 && block->FirstIndex > 0) {
       dcr->VolFirstIndex = block->FirstIndex;
    }
-   if (block->LastIndex > 0) {
+   if (block->LastIndex > (int32_t)dcr->VolLastIndex) {
       dcr->VolLastIndex = block->LastIndex;
    }
    dcr->WroteVol = true;
@@ -350,6 +363,18 @@ bool DCR::read_block_from_device(bool check_block_numbers)
    return ok;
 }
 
+static void set_block_position(DCR *dcr, DEVICE *dev, DEV_BLOCK *block)
+{
+   if (dev->is_tape()) {
+      block->Block = dev->block_num;
+      block->File = dev->file;
+   } else {
+      block->Block = (uint32_t)dev->file_addr;
+      block->File  = (uint32_t)(dev->file_addr >> 32);
+   }
+   block->RecNum = 0;
+}
+
 /*
  * Read the next block into the block structure and unserialize
  *  the block header.  For a file, the block may be partially
@@ -380,11 +405,12 @@ bool DCR::read_block_from_dev(bool check_block_numbers)
       Mmsg4(dev->errmsg, _("Attempt to read closed device: fd=%d at file:blk %u:%u on device %s\n"),
          dev->fd(), dev->file, dev->block_num, dev->print_name());
       Jmsg(dcr->jcr, M_FATAL, 0, "%s", dev->errmsg);
-      Pmsg2(000, "Fatal: dev=%p dcr=%p\n", dev, dcr);
       Pmsg1(000, "%s", dev->errmsg);
       block->read_len = 0;
       return false;
-    }
+   }
+
+   set_block_position(dcr, dev, block);
 
 reread:
    if (looping > 1) {
@@ -398,6 +424,21 @@ reread:
 
    dump_block(block, "before read");
 
+#ifdef xxxBUILD_DVD
+   /* Check for DVD part file end */
+   if (dev->at_eof() && dev->is_dvd() && dev->num_dvd_parts > 0 &&
+        dev->part <= dev->num_dvd_parts) {
+      Dmsg0(400, "Call dvd_open_next_part\n");
+      if (dvd_open_next_part(dcr) < 0) {
+         Mmsg3(dev->errmsg, _("Unable to open device part=%d %s: ERR=%s\n"),
+               dev->part, dev->print_name(), dev->bstrerror());
+         Jmsg(dcr->jcr, M_FATAL, 0, "%s", dev->errmsg);
+         dev->dev_errno = EIO;
+         return false;
+      }
+   }
+#endif /* xxxBUILD_DVD */
+
    retry = 0;
    errno = 0;
    stat = 0;
@@ -423,7 +464,7 @@ reread:
       block->read_len = 0;
       if (dev->file == 0 && dev->block_num == 0) { /* Attempt to read label */
          Mmsg(dev->errmsg, _("The Volume=%s on device=%s appears to be unlabeled.\n"),
-            dev->VolCatInfo.VolCatName, dev->print_name());
+            "", dev->VolCatInfo.VolCatName, dev->print_name());
       } else {
          Mmsg5(dev->errmsg, _("Read error on fd=%d at file:blk %u:%u on device %s. ERR=%s.\n"),
             dev->fd(), dev->file, dev->block_num, dev->print_name(), be.bstrerror());
@@ -436,11 +477,11 @@ reread:
    }
    if (stat == 0) {             /* Got EOF ! */
       if (dev->file == 0 && dev->block_num == 0) { /* Attempt to read label */
-         Mmsg2(dev->errmsg, _("The Volume=%s on device=%s appears to be unlabeled.\n"),
-            dev->VolCatInfo.VolCatName, dev->print_name());
+         Mmsg3(dev->errmsg, _("The %sVolume=%s on device=%s appears to be unlabeled.\n"),
+            "", dev->VolCatInfo.VolCatName, dev->print_name());
       } else {
-         Mmsg3(dev->errmsg, _("Read zero bytes Vol=%s at %lld on device %s.\n"),
-               dev->VolCatInfo.VolCatName, pos, dev->print_name());
+         Mmsg4(dev->errmsg, _("Read zero %sbytes Vol=%s at %lld on device %s.\n"),
+               "", dev->VolCatInfo.VolCatName, pos, dev->print_name());
       }
       dev->block_num = 0;
       block->read_len = 0;
@@ -549,16 +590,20 @@ reread:
 
    /* Update dcr values */
    if (dev->is_tape()) {
-      dcr->EndBlock = dev->EndBlock;
-      dcr->EndFile  = dev->EndFile;
+      if (dcr->EndFile != dev->EndFile || dev->EndBlock > dcr->EndBlock) {
+         dcr->EndBlock = dev->EndBlock;
+         dcr->EndFile  = dev->EndFile;
+      }
    } else {
       /* We need to take care about a short block in EndBlock/File
        * computation
        */
       uint32_t len = MIN(block->read_len, block->block_len);
       uint64_t addr = dev->file_addr + len - 1;
-      dcr->EndBlock = (uint32_t)addr;
-      dcr->EndFile = (uint32_t)(addr >> 32);
+      if ((uint32_t)(addr >> 32) != dcr->EndFile || (uint32_t)addr > dcr->EndBlock) {
+         dcr->EndBlock = (uint32_t)addr;
+         dcr->EndFile = (uint32_t)(addr >> 32);
+      }
       dev->block_num = dev->EndBlock = (uint32_t)addr;
       dev->file = dev->EndFile = (uint32_t)(addr >> 32);
    }
diff --git a/src/stored/block.h b/src/stored/block.h
index a438350..ff8f085 100644
--- a/src/stored/block.h
+++ b/src/stored/block.h
@@ -1,22 +1,26 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Block definitions for Bacula media data format.
  *
- *    Written by Kern Sibbald, MM
+ *    Kern Sibbald, MM
  *
  */
 
@@ -92,12 +96,14 @@ class DEVICE;                         /* for forward reference */
  */
 struct DEV_BLOCK {
    DEV_BLOCK *next;                   /* pointer to next one */
-   DEVICE *dev;                       /* pointer to device */
+   DEVICE    *dev;                    /* pointer to device */
    /* binbuf is the number of bytes remaining in the buffer.
     *   For writes, it is bytes not yet written.
     *   For reads, it is remaining bytes not yet read.
     */
    uint64_t BlockAddr;                /* Block address */
+   uint32_t File;                     /* Block address on volume */
+   uint32_t Block;                    /* Block address on volume */
    uint32_t binbuf;                   /* bytes in buffer */
    uint32_t block_len;                /* length of current block read */
    uint32_t buf_len;                  /* max/default block length */
@@ -108,10 +114,12 @@ struct DEV_BLOCK {
    uint32_t VolSessionTime;           /* */
    uint32_t read_errors;              /* block errors (checksum, header, ...) */
    uint32_t CheckSum;                 /* Block checksum */
+   uint32_t RecNum;                   /* Number of records read from the current block */
    int      BlockVer;                 /* block version 1 or 2 */
    bool     write_failed;             /* set if write failed */
    bool     block_read;               /* set when block read */
    bool     needs_write;              /* block must be written */
+   bool     adata;                    /* adata block */
    bool     no_header;                /* Set if no block header */
    bool     new_fi;                   /* New FI arrived */
    int32_t  FirstIndex;               /* first index this block */
diff --git a/src/stored/block_util.c b/src/stored/block_util.c
index 790dad8..7fc45d2 100644
--- a/src/stored/block_util.c
+++ b/src/stored/block_util.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -554,6 +558,7 @@ bool terminate_writing_volume(DCR *dcr)
        Jmsg(dcr->jcr, M_FATAL, 0, "%s", dev->errmsg);
        ok = false;
    }
+   flush_jobmedia_queue(dcr->jcr);
    dcr->block->write_failed = true;
    if (dev->can_append() && !dev->weof(1)) {     /* end the tape */
       dev->VolCatInfo.VolCatErrors++;
@@ -626,6 +631,7 @@ bool check_for_newvol_or_newfile(DCR *dcr)
          return false;
       }
       if (dcr->NewVol) {
+         flush_jobmedia_queue(jcr);
          /* Note, setting a new volume also handles any pending new file */
          set_new_volume_parameters(dcr);
       } else {
diff --git a/src/stored/bls.c b/src/stored/bls.c
index 3ee9604..e677004 100644
--- a/src/stored/bls.c
+++ b/src/stored/bls.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -53,7 +57,8 @@ STORES *me = NULL;                    /* our Global resource */
 bool forge_on = false;
 pthread_mutex_t device_release_mutex = PTHREAD_MUTEX_INITIALIZER;
 pthread_cond_t wait_device_release = PTHREAD_COND_INITIALIZER;
-
+bool detect_errors = false;
+int  errors = 0;
 
 static FF_PKT *ff;
 
@@ -63,7 +68,7 @@ static void usage()
 {
    fprintf(stderr, _(
 PROG_COPYRIGHT
-"\nVersion: %s (%s)\n\n"
+"\n%sVersion: %s (%s)\n\n"
 "Usage: bls [options] <device-name>\n"
 "       -b <file>       specify a bootstrap file\n"
 "       -c <file>       specify a Storage configuration file\n"
@@ -78,7 +83,8 @@ PROG_COPYRIGHT
 "       -p              proceed inspite of errors\n"
 "       -v              be verbose\n"
 "       -V              specify Volume names (separated by |)\n"
-"       -?              print this message\n\n"), 2000, VERSION, BDATE);
+"       -E              Check records to detect errors\n"
+"       -?              print this message\n\n"), 2000, "", VERSION, BDATE);
    exit(1);
 }
 
@@ -106,12 +112,16 @@ int main (int argc, char *argv[])
 
    ff = init_find_files();
 
-   while ((ch = getopt(argc, argv, "b:c:d:e:i:jkLpvV:?")) != -1) {
+   while ((ch = getopt(argc, argv, "b:c:d:e:i:jkLpvV:?E")) != -1) {
       switch (ch) {
       case 'b':
          bsrName = optarg;
          break;
 
+      case 'E':
+         detect_errors = true;
+         break;
+
       case 'c':                    /* specify config file */
          if (configfile != NULL) {
             free(configfile);
@@ -252,6 +262,10 @@ int main (int argc, char *argv[])
    }
    term_include_exclude_files(ff);
    term_find_files(ff);
+
+   if (detect_errors) {
+      return (errors > 0)? 1 : 0;
+   }
    return 0;
 }
 
@@ -298,6 +312,7 @@ static void do_blocks(char *infname)
             continue;
          } else {
             /* I/O error */
+            errors++;
             display_tape_error_status(jcr, dev);
             break;
          }
@@ -335,7 +350,7 @@ static void do_blocks(char *infname)
 static bool jobs_cb(DCR *dcr, DEV_RECORD *rec)
 {
    if (rec->FileIndex < 0) {
-      dump_label_record(dcr->dev, rec, verbose);
+      dump_label_record(dcr->dev, rec, verbose, detect_errors);
    }
    rec->remainder = 0;
    return true;
@@ -344,7 +359,9 @@ static bool jobs_cb(DCR *dcr, DEV_RECORD *rec)
 /* Do list job records */
 static void do_jobs(char *infname)
 {
-   read_records(dcr, jobs_cb, mount_next_read_volume);
+   if (!read_records(dcr, jobs_cb, mount_next_read_volume)) {
+      errors++;
+   }
 }
 
 /* Do an ls type listing of an archive */
@@ -354,7 +371,9 @@ static void do_ls(char *infname)
       dump_volume_label(dev);
       return;
    }
-   read_records(dcr, record_cb, mount_next_read_volume);
+   if (!read_records(dcr, record_cb, mount_next_read_volume)) {
+      errors++;
+   }
    printf("%u files found.\n", num_files);
 }
 
@@ -364,7 +383,7 @@ static void do_ls(char *infname)
 static bool record_cb(DCR *dcr, DEV_RECORD *rec)
 {
    if (verbose && rec->FileIndex < 0) {
-      dump_label_record(dcr->dev, rec, verbose);
+      dump_label_record(dcr->dev, rec, verbose, false);
       return true;
    }
    if (verbose) {
@@ -464,6 +483,7 @@ static void get_session_record(DEVICE *dev, DEV_RECORD *rec, SESSION_LABEL *sess
 bool    dir_find_next_appendable_volume(DCR *dcr) { return 1;}
 bool    dir_update_volume_info(DCR *dcr, bool relabel, bool update_LastWritten) { return 1; }
 bool    dir_create_jobmedia_record(DCR *dcr, bool zero) { return 1; }
+bool    flush_jobmedia_queue(JCR *jcr) { return true; }
 bool    dir_ask_sysop_to_create_appendable_volume(DCR *dcr) { return 1; }
 bool    dir_update_file_attributes(DCR *dcr, DEV_RECORD *rec) { return 1;}
 bool    dir_send_job_status(JCR *jcr) {return 1;}
@@ -484,9 +504,6 @@ bool dir_get_volume_info(DCR *dcr, enum get_vol_info_rw  writing)
 {
    Dmsg0(100, "Fake dir_get_volume_info\n");
    dcr->setVolCatName(dcr->VolumeName);
-#ifdef BUILD_DVD
-   dcr->VolCatInfo.VolCatParts = find_num_dvd_parts(dcr);
-#endif
-   Dmsg2(500, "Vol=%s num_parts=%d\n", dcr->getVolCatName(), dcr->VolCatInfo.VolCatParts);
+   Dmsg2(500, "Vol=%s VolType=%d\n", dcr->getVolCatName(), dcr->VolCatInfo.VolCatType);
    return 1;
 }
diff --git a/src/stored/bscan.c b/src/stored/bscan.c
index 0a02971..3702b88 100644
--- a/src/stored/bscan.c
+++ b/src/stored/bscan.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -27,32 +31,31 @@
 #include "stored.h"
 #include "findlib/find.h"
 #include "cats/cats.h"
-#include "cats/sql_glue.h"
 
 extern bool parse_sd_config(CONFIG *config, const char *configfile, int exit_code);
 
 /* Forward referenced functions */
 static void do_scan(void);
 static bool record_cb(DCR *dcr, DEV_RECORD *rec);
-static int  create_file_attributes_record(B_DB *db, JCR *mjcr,
+static int  create_file_attributes_record(BDB *db, JCR *mjcr,
                                char *fname, char *lname, int type,
                                char *ap, DEV_RECORD *rec);
-static int  create_media_record(B_DB *db, MEDIA_DBR *mr, VOLUME_LABEL *vl);
-static bool update_media_record(B_DB *db, MEDIA_DBR *mr);
-static int  create_pool_record(B_DB *db, POOL_DBR *pr);
-static JCR *create_job_record(B_DB *db, JOB_DBR *mr, SESSION_LABEL *label, DEV_RECORD *rec);
-static int  update_job_record(B_DB *db, JOB_DBR *mr, SESSION_LABEL *elabel,
+static int  create_media_record(BDB *db, MEDIA_DBR *mr, VOLUME_LABEL *vl);
+static bool update_media_record(BDB *db, MEDIA_DBR *mr);
+static int  create_pool_record(BDB *db, POOL_DBR *pr);
+static JCR *create_job_record(BDB *db, JOB_DBR *mr, SESSION_LABEL *label, DEV_RECORD *rec);
+static int  update_job_record(BDB *db, JOB_DBR *mr, SESSION_LABEL *elabel,
                               DEV_RECORD *rec);
-static int  create_client_record(B_DB *db, CLIENT_DBR *cr);
-static int  create_fileset_record(B_DB *db, FILESET_DBR *fsr);
-static int  create_jobmedia_record(B_DB *db, JCR *jcr);
+static int  create_client_record(BDB *db, CLIENT_DBR *cr);
+static int  create_fileset_record(BDB *db, FILESET_DBR *fsr);
+static int  create_jobmedia_record(BDB *db, JCR *jcr);
 static JCR *create_jcr(JOB_DBR *jr, DEV_RECORD *rec, uint32_t JobId);
-static int update_digest_record(B_DB *db, char *digest, DEV_RECORD *rec, int type);
+static int update_digest_record(BDB *db, char *digest, DEV_RECORD *rec, int type);
 
 
 /* Local variables */
 static DEVICE *dev = NULL;
-static B_DB *db;
+static BDB *db;
 static JCR *bjcr;                     /* jcr for bscan */
 static BSR *bsr = NULL;
 static MEDIA_DBR mr;
@@ -98,12 +101,11 @@ bool forge_on = false;                /* proceed inspite of I/O errors */
 pthread_mutex_t device_release_mutex = PTHREAD_MUTEX_INITIALIZER;
 pthread_cond_t wait_device_release = PTHREAD_COND_INITIALIZER;
 
-
 static void usage()
 {
    fprintf(stderr, _(
 PROG_COPYRIGHT
-"\nVersion: %s (%s)\n\n"
+"\n%sVersion: %s (%s)\n\n"
 "Usage: bscan [ options ] <bacula-archive>\n"
 "       -b bootstrap      specify a bootstrap file\n"
 "       -c <file>         specify configuration file\n"
@@ -124,7 +126,7 @@ PROG_COPYRIGHT
 "       -V <Volumes>      specify Volume names (separated by |)\n"
 "       -w <dir>          specify working directory (default from conf file)\n"
 "       -?                print this message\n\n"),
-      2001, VERSION, BDATE);
+      2001, "", VERSION, BDATE);
    exit(1);
 }
 
@@ -281,12 +283,18 @@ int main (int argc, char *argv[])
          edit_uint64(currentVolumeSize, ed1));
    }
 
-   if ((db = db_init_database(NULL, db_driver, db_name, db_user, db_password,
-                              db_host, db_port, NULL, false, false)) == NULL) {
-      Emsg0(M_ERROR_TERM, 0, _("Could not init Bacula database\n"));
-   }
-   if (!db_open_database(NULL, db)) {
-      Emsg0(M_ERROR_TERM, 0, db_strerror(db));
+   db = db_init_database(NULL, db_driver, db_name, db_user, db_password,
+                            db_host, db_port, NULL, false, false);
+   if (!db || !db_open_database(NULL, db)) {
+      Pmsg2(000, _("Could not open Catalog \"%s\", database \"%s\".\n"),
+           db_driver, db_name);
+      if (db) {
+         Jmsg(NULL, M_FATAL, 0, _("%s"), db_strerror(db));
+         Pmsg1(000, "%s", db_strerror(db));
+         db_close_database(NULL, db);
+      }
+      Jmsg(NULL, M_ERROR_TERM, 0, _("Could not open Catalog \"%s\", database \"%s\".\n"),
+           db_driver, db_name);
    }
    Dmsg0(200, "Database opened\n");
    if (verbose) {
@@ -421,7 +429,7 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec)
       bool save_update_db = update_db;
 
       if (verbose > 1) {
-         dump_label_record(dev, rec, 1);
+         dump_label_record(dev, rec, 1, false);
       }
       switch (rec->FileIndex) {
       case PRE_LABEL:
@@ -802,43 +810,43 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec)
       }
       break;
 
-   case STREAM_UNIX_ACCESS_ACL:          /* Deprecated Standard ACL attributes on UNIX */
-   case STREAM_UNIX_DEFAULT_ACL:         /* Deprecated Default ACL attributes on UNIX */
-   case STREAM_HFSPLUS_ATTRIBUTES:
-   case STREAM_ACL_AIX_TEXT:
-   case STREAM_ACL_DARWIN_ACCESS_ACL:
-   case STREAM_ACL_FREEBSD_DEFAULT_ACL:
-   case STREAM_ACL_FREEBSD_ACCESS_ACL:
-   case STREAM_ACL_HPUX_ACL_ENTRY:
-   case STREAM_ACL_IRIX_DEFAULT_ACL:
-   case STREAM_ACL_IRIX_ACCESS_ACL:
-   case STREAM_ACL_LINUX_DEFAULT_ACL:
-   case STREAM_ACL_LINUX_ACCESS_ACL:
-   case STREAM_ACL_TRU64_DEFAULT_ACL:
-   case STREAM_ACL_TRU64_DEFAULT_DIR_ACL:
-   case STREAM_ACL_TRU64_ACCESS_ACL:
-   case STREAM_ACL_SOLARIS_ACLENT:
-   case STREAM_ACL_SOLARIS_ACE:
-   case STREAM_ACL_AFS_TEXT:
-   case STREAM_ACL_AIX_AIXC:
-   case STREAM_ACL_AIX_NFS4:
-   case STREAM_ACL_FREEBSD_NFS4_ACL:
-   case STREAM_ACL_HURD_DEFAULT_ACL:
-   case STREAM_ACL_HURD_ACCESS_ACL:
+   case  STREAM_UNIX_ACCESS_ACL:          /* Deprecated Standard ACL attributes on UNIX */
+   case  STREAM_UNIX_DEFAULT_ACL:         /* Deprecated Default ACL attributes on UNIX */
+   case  STREAM_HFSPLUS_ATTRIBUTES:
+   case  STREAM_ACL_AIX_TEXT:
+   case  STREAM_ACL_DARWIN_ACCESS:
+   case  STREAM_ACL_FREEBSD_DEFAULT:
+   case  STREAM_ACL_FREEBSD_ACCESS:
+   case  STREAM_ACL_HPUX_ACL_ENTRY:
+   case  STREAM_ACL_IRIX_DEFAULT:
+   case  STREAM_ACL_IRIX_ACCESS:
+   case  STREAM_ACL_LINUX_DEFAULT:
+   case  STREAM_ACL_LINUX_ACCESS:
+   case  STREAM_ACL_TRU64_DEFAULT:
+   case  STREAM_ACL_TRU64_DEFAULT_DIR:
+   case  STREAM_ACL_TRU64_ACCESS:
+   case  STREAM_ACL_SOLARIS_POSIX:
+   case  STREAM_ACL_SOLARIS_NFS4:
+   case  STREAM_ACL_AFS_TEXT:
+   case  STREAM_ACL_AIX_AIXC:
+   case  STREAM_ACL_AIX_NFS4:
+   case  STREAM_ACL_FREEBSD_NFS4:
+   case  STREAM_ACL_HURD_DEFAULT:
+   case  STREAM_ACL_HURD_ACCESS:
       /* Ignore Unix ACL attributes */
       break;
 
-   case STREAM_XATTR_HURD:
-   case STREAM_XATTR_IRIX:
-   case STREAM_XATTR_TRU64:
-   case STREAM_XATTR_AIX:
-   case STREAM_XATTR_OPENBSD:
-   case STREAM_XATTR_SOLARIS_SYS:
-   case STREAM_XATTR_SOLARIS:
-   case STREAM_XATTR_DARWIN:
-   case STREAM_XATTR_FREEBSD:
-   case STREAM_XATTR_LINUX:
-   case STREAM_XATTR_NETBSD:
+   case  STREAM_XATTR_HURD:
+   case  STREAM_XATTR_IRIX:
+   case  STREAM_XATTR_TRU64:
+   case  STREAM_XATTR_AIX:
+   case  STREAM_XATTR_OPENBSD:
+   case  STREAM_XATTR_SOLARIS_SYS:
+   case  STREAM_XATTR_SOLARIS:
+   case  STREAM_XATTR_DARWIN:
+   case  STREAM_XATTR_FREEBSD:
+   case  STREAM_XATTR_LINUX:
+   case  STREAM_XATTR_NETBSD:
       /* Ignore Unix Extended attributes */
       break;
 
@@ -878,7 +886,7 @@ static void bscan_free_jcr(JCR *jcr)
  * We got a File Attributes record on the tape.  Now, lookup the Job
  *   record, and then create the attributes record.
  */
-static int create_file_attributes_record(B_DB *db, JCR *mjcr,
+static int create_file_attributes_record(BDB *db, JCR *mjcr,
                                char *fname, char *lname, int type,
                                char *ap, DEV_RECORD *rec)
 {
@@ -919,7 +927,7 @@ static int create_file_attributes_record(B_DB *db, JCR *mjcr,
 /*
  * For each Volume we see, we create a Medium record
  */
-static int create_media_record(B_DB *db, MEDIA_DBR *mr, VOLUME_LABEL *vl)
+static int create_media_record(BDB *db, MEDIA_DBR *mr, VOLUME_LABEL *vl)
 {
    struct date_time dt;
    struct tm tm;
@@ -973,7 +981,7 @@ static int create_media_record(B_DB *db, MEDIA_DBR *mr, VOLUME_LABEL *vl)
 /*
  * Called at end of media to update it
  */
-static bool update_media_record(B_DB *db, MEDIA_DBR *mr)
+static bool update_media_record(BDB *db, MEDIA_DBR *mr)
 {
    if (!update_db && !update_vol_info) {
       return true;
@@ -992,7 +1000,7 @@ static bool update_media_record(B_DB *db, MEDIA_DBR *mr)
 }
 
 
-static int create_pool_record(B_DB *db, POOL_DBR *pr)
+static int create_pool_record(BDB *db, POOL_DBR *pr)
 {
    pr->NumVols++;
    pr->UseCatalog = 1;
@@ -1016,7 +1024,7 @@ static int create_pool_record(B_DB *db, POOL_DBR *pr)
 /*
  * Called from SOS to create a client for the current Job
  */
-static int create_client_record(B_DB *db, CLIENT_DBR *cr)
+static int create_client_record(BDB *db, CLIENT_DBR *cr)
 {
    /*
     * Note, update_db can temporarily be set false while
@@ -1040,7 +1048,7 @@ static int create_client_record(B_DB *db, CLIENT_DBR *cr)
    return 1;
 }
 
-static int create_fileset_record(B_DB *db, FILESET_DBR *fsr)
+static int create_fileset_record(BDB *db, FILESET_DBR *fsr)
 {
    if (!update_db) {
       return 1;
@@ -1072,7 +1080,7 @@ static int create_fileset_record(B_DB *db, FILESET_DBR *fsr)
  *  the Job record and to update it when the Job actually
  *  begins running.
  */
-static JCR *create_job_record(B_DB *db, JOB_DBR *jr, SESSION_LABEL *label,
+static JCR *create_job_record(BDB *db, JOB_DBR *jr, SESSION_LABEL *label,
                              DEV_RECORD *rec)
 {
    JCR *mjcr;
@@ -1127,7 +1135,7 @@ static JCR *create_job_record(B_DB *db, JOB_DBR *jr, SESSION_LABEL *label,
  * Simulate the database call that updates the Job
  *  at Job termination time.
  */
-static int update_job_record(B_DB *db, JOB_DBR *jr, SESSION_LABEL *elabel,
+static int update_job_record(BDB *db, JOB_DBR *jr, SESSION_LABEL *elabel,
                               DEV_RECORD *rec)
 {
    struct date_time dt;
@@ -1238,7 +1246,7 @@ static int update_job_record(B_DB *db, JOB_DBR *jr, SESSION_LABEL *elabel,
    return 1;
 }
 
-static int create_jobmedia_record(B_DB *db, JCR *mjcr)
+static int create_jobmedia_record(BDB *db, JCR *mjcr)
 {
    JOBMEDIA_DBR jmr;
    DCR *dcr = mjcr->read_dcr;
@@ -1276,7 +1284,7 @@ static int create_jobmedia_record(B_DB *db, JCR *mjcr)
 /*
  * Simulate the database call that updates the MD5/SHA1 record
  */
-static int update_digest_record(B_DB *db, char *digest, DEV_RECORD *rec, int type)
+static int update_digest_record(BDB *db, char *digest, DEV_RECORD *rec, int type)
 {
    JCR *mjcr;
 
@@ -1339,6 +1347,7 @@ static JCR *create_jcr(JOB_DBR *jr, DEV_RECORD *rec, uint32_t JobId)
 bool    dir_find_next_appendable_volume(DCR *dcr) { return 1;}
 bool    dir_update_volume_info(DCR *dcr, bool relabel, bool update_LastWritten) { return 1; }
 bool    dir_create_jobmedia_record(DCR *dcr, bool zero) { return 1; }
+bool    flush_jobmedia_queue(JCR *jcr) { return true; }
 bool    dir_ask_sysop_to_create_appendable_volume(DCR *dcr) { return 1; }
 bool    dir_update_file_attributes(DCR *dcr, DEV_RECORD *rec) { return 1;}
 bool    dir_send_job_status(JCR *jcr) {return 1;}
@@ -1360,9 +1369,6 @@ bool dir_get_volume_info(DCR *dcr, enum get_vol_info_rw writing)
 {
    Dmsg0(100, "Fake dir_get_volume_info\n");
    dcr->setVolCatName(dcr->VolumeName);
-#ifdef BUILD_DVD
-   dcr->VolCatInfo.VolCatParts = find_num_dvd_parts(dcr);
-#endif
-   Dmsg2(500, "Vol=%s num_parts=%d\n", dcr->getVolCatName(), dcr->VolCatInfo.VolCatParts);
+   Dmsg2(500, "Vol=%s VolType=%d\n", dcr->getVolCatName(), dcr->VolCatInfo.VolCatType);
    return 1;
 }
diff --git a/src/stored/bsr.h b/src/stored/bsr.h
index 577a268..568bfe9 100644
--- a/src/stored/bsr.h
+++ b/src/stored/bsr.h
@@ -1,25 +1,27 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2002-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * BootStrap record definition -- for restoring files.
  *
  *    Kern Sibbald, June 2002
  *
- *   Version $Id$
- *
  */
 
 
@@ -140,6 +142,7 @@ struct BSR {
    BSR          *next;                /* pointer to next one */
    BSR          *prev;                /* pointer to previous one */
    BSR          *root;                /* root bsr */
+   BSR          *cur_bsr;
    bool          reposition;          /* set when any bsr is marked done */
    bool          mount_next_volume;   /* set when next volume should be mounted */
    bool          done;                /* set when everything found for this bsr */
@@ -149,6 +152,7 @@ struct BSR {
    BSR_VOLUME   *volume;
    uint32_t      count;               /* count of files to restore this bsr */
    uint32_t      found;               /* count of restored files this bsr */
+   int32_t       LastFI;              /* LastFI seen by this bsr */
    BSR_VOLFILE  *volfile;
    BSR_VOLBLOCK *volblock;
    BSR_VOLADDR  *voladdr;
diff --git a/src/stored/btape.c b/src/stored/btape.c
index 109294b..f4fa3aa 100644
--- a/src/stored/btape.c
+++ b/src/stored/btape.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -136,7 +140,6 @@ static int vol_num = 0;
 
 static JCR *jcr = NULL;
 
-
 static void usage();
 static void terminate_btape(int sig);
 int get_cmd(const char *prompt);
@@ -1114,7 +1117,7 @@ static bool write_two_files()
    /*
     * Set big max_file_size so that write_record_to_block
     * doesn't insert any additional EOF marks
-    * Do calculation in 64 bits to avoid overflow.  
+    * Do calculation in 64 bits to avoid overflow.
     */
    dev->max_file_size = (uint64_t)2 * (uint64_t)num_recs * (uint64_t)dev->max_block_size;
    Pmsg2(-1, _("\n=== Write, rewind, and re-read test ===\n\n"
@@ -2522,6 +2525,7 @@ static bool do_unfill()
 
    dev->close();
    dev->num_writers = 0;
+   dcr->clear_writing();
    if (!acquire_device_for_read(dcr)) {
       Pmsg1(-1, "%s", dev->print_errmsg());
       goto bail_out;
@@ -2585,6 +2589,7 @@ static bool do_unfill()
    }
 
    dev->clear_read();
+   dcr->clear_writing();
    if (!acquire_device_for_read(dcr)) {
       Pmsg1(-1, "%s", dev->print_errmsg());
       goto bail_out;
@@ -2950,7 +2955,7 @@ static void usage()
 {
    fprintf(stderr, _(
 PROG_COPYRIGHT
-"\nVersion: %s (%s)\n\n"
+"\n%sVersion: %s (%s)\n\n"
 "Usage: btape <options> <device_name>\n"
 "       -b <file>   specify bootstrap file\n"
 "       -c <file>   set configuration file to file\n"
@@ -2960,7 +2965,7 @@ PROG_COPYRIGHT
 "       -s          turn off signals\n"
 "       -v          be verbose\n"
 "       -?          print this message.\n"
-"\n"), 2000, VERSION, BDATE);
+"\n"), 2000, "", VERSION, BDATE);
 
 }
 
@@ -3002,6 +3007,7 @@ get_cmd(const char *prompt)
 /* Dummies to replace askdir.c */
 bool    dir_update_file_attributes(DCR *dcr, DEV_RECORD *rec) { return 1;}
 bool    dir_send_job_status(JCR *jcr) {return 1;}
+bool    flush_jobmedia_queue(JCR *jcr) { return true; }
 
 bool dir_update_volume_info(DCR *dcr, bool relabel, bool update_LastWritten)
 {
diff --git a/src/stored/butil.c b/src/stored/butil.c
index 471d328..bc9d14a 100644
--- a/src/stored/butil.c
+++ b/src/stored/butil.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -30,7 +34,8 @@
 #include "stored.h"
 
 /* Forward referenced functions */
-static DCR *setup_to_access_device(JCR *jcr, char *dev_name, const char *VolumeName, bool writing);
+static DCR *setup_to_access_device(JCR *jcr, char *dev_name,
+   const char *VolumeName, bool writing, bool read_dedup_data);
 static DEVRES *find_device_res(char *device_name, bool writing);
 static void my_free_jcr(JCR *jcr);
 
@@ -84,7 +89,7 @@ void setup_me()
  *  tools (e.g. bls, bextract, bscan, ...)
  */
 JCR *setup_jcr(const char *name, char *dev_name, BSR *bsr,
-               const char *VolumeName, bool writing)
+               const char *VolumeName, bool writing, bool read_dedup_data)
 {
    DCR *dcr;
    JCR *jcr = new_jcr(sizeof(JCR), my_free_jcr);
@@ -110,7 +115,7 @@ JCR *setup_jcr(const char *name, char *dev_name, BSR *bsr,
    init_autochangers();
    create_volume_lists();
 
-   dcr = setup_to_access_device(jcr, dev_name, VolumeName, writing);
+   dcr = setup_to_access_device(jcr, dev_name, VolumeName, writing, read_dedup_data);
    if (!dcr) {
       return NULL;
    }
@@ -128,7 +133,7 @@ JCR *setup_jcr(const char *name, char *dev_name, BSR *bsr,
  *     the caller will do it.
  */
 static DCR *setup_to_access_device(JCR *jcr, char *dev_name,
-              const char *VolumeName, bool writing)
+              const char *VolumeName, bool writing, bool read_dedup_data)
 {
    DEVICE *dev;
    char *p;
diff --git a/src/stored/dev.c b/src/stored/dev.c
index 263a881..2ff57f8 100644
--- a/src/stored/dev.c
+++ b/src/stored/dev.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -79,7 +83,7 @@ extern uint32_t status_dev(DEVICE *dev);
 
 /* Forward referenced functions */
 const char *mode_to_str(int mode);
-DEVICE *m_init_dev(JCR *jcr, DEVRES *device, bool alt);
+DEVICE *m_init_dev(JCR *jcr, DEVRES *device);
 /*
  * Device types for printing
  */
@@ -91,8 +95,7 @@ static const char *prt_dev_types[] = {
    "FIFO",
    "Vtape",
    "FTP",
-   "VTL",
-   "virtual"
+   "VTL"
 };
 
 /*
@@ -109,16 +112,16 @@ static const char *prt_dev_types[] = {
 DEVICE *init_dev(JCR *jcr, DEVRES *device)
 {
    generate_global_plugin_event(bsdGlobalEventDeviceInit, device);
-   DEVICE *dev = m_init_dev(jcr, device, false);
+   DEVICE *dev = m_init_dev(jcr, device);
    return dev;
 }
 
-DEVICE *m_init_dev(JCR *jcr, DEVRES *device, bool alt)
+DEVICE *m_init_dev(JCR *jcr, DEVRES *device)
 {
    struct stat statp;
    int errstat;
    DCR *dcr = NULL;
-   DEVICE *dev;
+   DEVICE *dev = NULL;
    uint32_t max_bs;
 
    /* If no device type specified, try to guess */
@@ -151,14 +154,14 @@ DEVICE *m_init_dev(JCR *jcr, DEVRES *device, bool alt)
       } else {
          device->dev_type = B_DVD_DEV;
       }
+      if (strcmp(device->device_name, "/dev/null") == 0) {
+         device->dev_type = B_NULL_DEV;
+      }
    }
    switch (device->dev_type) {
    case B_DVD_DEV:
       Jmsg0(jcr, M_FATAL, 0, _("DVD support is now deprecated.\n"));
       return NULL;
-   case B_VIRTUAL_DEV:
-      Jmsg0(jcr, M_FATAL, 0, _("Aligned device not supported. Please use \"DeviceType = File\"\n"));
-      return NULL;
    case B_VTAPE_DEV:
       dev = New(vtape);
       break;
@@ -167,26 +170,16 @@ DEVICE *m_init_dev(JCR *jcr, DEVRES *device, bool alt)
       dev = New(ftp_device);
       break;
 #endif
-#ifdef xHAVE_WIN32
-/* TODO: defined in src/win32/stored/mtops.cpp */
-   case B_TAPE_DEV:
-      dev = New(win_tape_dev);
-      break;
-   case B_FILE_DEV:
-      dev = New(win_file_dev);
-      break;
-#else
    case B_TAPE_DEV:
       dev = New(tape_dev);
       break;
    case B_FILE_DEV:
    case B_FIFO_DEV:
+   case B_NULL_DEV:
       dev = New(file_dev);
       break;
-      break;
-#endif
    default:
-         return NULL;
+      return NULL;
    }
    dev->clear_slot();         /* unknown */
 
@@ -198,6 +191,7 @@ DEVICE *m_init_dev(JCR *jcr, DEVRES *device, bool alt)
    Mmsg(dev->prt_name, "\"%s\" (%s)", device->hdr.name, device->device_name);
    Dmsg1(400, "Allocate dev=%s\n", dev->print_name());
    dev->capabilities = device->cap_bits;
+   dev->min_free_space = device->min_free_space;
    dev->min_block_size = device->min_block_size;
    dev->max_block_size = device->max_block_size;
    dev->max_volume_size = device->max_volume_size;
@@ -209,6 +203,7 @@ DEVICE *m_init_dev(JCR *jcr, DEVRES *device, bool alt)
    dev->vol_poll_interval = device->vol_poll_interval;
    dev->max_spool_size = device->max_spool_size;
    dev->drive_index = device->drive_index;
+   dev->enabled = device->enabled;
    dev->autoselect = device->autoselect;
    dev->read_only = device->read_only;
    dev->dev_type = device->dev_type;
@@ -222,24 +217,13 @@ DEVICE *m_init_dev(JCR *jcr, DEVRES *device, bool alt)
    if (dev->vol_poll_interval && dev->vol_poll_interval < 60) {
       dev->vol_poll_interval = 60;
    }
-   /*
-    * ***FIXME*** remove this when we implement write device
-    *  switching.
-    *
-    * We limit aligned Jobs to run one at a time.
-    * This is required because:
-    *  1. BlockAddr must be local for each JCR, today it
-    *     is global.
-    *  2. When flushing buffers, all other processes must
-    *     be locked out, and they currently are not.
-    *  3. We need to reserve the full space for a job, but
-    *     currently space for only one block is reserved.
-    *  4. In the case that the file grows, we must be able
-    *     to create multiple references to the correct data
-    *     blocks, if they are not contiguous.
-    */
 
-   device->dev = dev;
+   if (!device->dev) {
+      /* The first time we create a DEVICE from the DEVRES, we keep a pointer
+       * to the DEVICE accessible from the DEVRES.
+       */
+      device->dev = dev;
+   }
 
    if (dev->is_fifo()) {
       dev->capabilities |= CAP_STREAM; /* set stream device */
@@ -260,6 +244,11 @@ DEVICE *m_init_dev(JCR *jcr, DEVRES *device, bool alt)
       if (!device->mount_command || !device->unmount_command) {
          Jmsg0(jcr, M_ERROR_TERM, 0, _("Mount and unmount commands must defined for a device which requires mount.\n"));
       }
+   } 
+
+   /* Keep the device ID in the DEVICE struct to identify the hardware */
+   if (dev->is_file() && stat(dev->archive_name(), &statp) == 0) {
+         dev->devno = statp.st_dev;
    }
 
    /* Sanity check */
@@ -394,7 +383,7 @@ bool DEVICE::open(DCR *dcr, int omode)
    if (is_tape() || is_fifo()) {
       open_tape_device(dcr, omode);
    } else if (is_ftp()) {
-      this->open_device(dcr, omode);
+      open_device(dcr, omode);
    } else {
       Dmsg1(100, "call open_file_device mode=%s\n", mode_to_str(omode));
       open_file_device(dcr, omode);
@@ -539,12 +528,207 @@ void DEVICE::clear_volhdr()
    setVolCatInfo(false);
 }
 
+void DEVICE::set_nospace()
+{
+   state |= ST_NOSPACE;
+}
+
+void DEVICE::clear_nospace()
+{
+   state &= ~ST_NOSPACE;
+}
+
+/* Put device in append mode */
+void DEVICE::set_append()
+{
+   state &= ~(ST_NOSPACE|ST_READ|ST_EOT|ST_EOF|ST_WEOT);  /* remove EOF/EOT flags */
+   state |= ST_APPEND;
+}
+
+/* Clear append mode */
+void DEVICE::clear_append()
+{
+   state &= ~ST_APPEND;
+}
+
+/* Put device in read mode */
+void DEVICE::set_read()
+{
+   state &= ~(ST_APPEND|ST_EOT|ST_EOF|ST_WEOT);  /* remove EOF/EOT flags */
+   state |= ST_READ;
+}
+
+/* Clear read mode */
+void DEVICE::clear_read()
+{
+   state &= ~ST_READ;
+}
+
+/*
+ * Get freespace using OS calls
+ * TODO: See if it's working with mount commands
+ */
+bool DEVICE::get_os_device_freespace()
+{
+   int64_t freespace, totalspace;
+
+   if (!is_file()) {
+      return true;
+   }
+   if (fs_get_free_space(dev_name, &freespace, &totalspace) == 0) {
+      set_freespace(freespace,  totalspace, 0, true);
+      Mmsg(errmsg, "");
+      return true;
+
+   } else {
+      set_freespace(0, 0, 0, false); /* No valid freespace */
+   }
+   return false;
+}
+
+/* Update the free space on the device */
+bool DEVICE::update_freespace()
+{
+   POOL_MEM ocmd(PM_FNAME);
+   POOLMEM* results;
+   char* icmd;
+   char* p;
+   uint64_t free, total;
+   char ed1[50];
+   bool ok = false;
+   int status;
+   berrno be;
+
+   if (!is_file()) {
+      Mmsg(errmsg, "");
+      return true;
+   }
+
+   /* The device must be mounted in order for freespace to work */
+   if (requires_mount()) {
+      mount(1);
+   }
+
+   if (get_os_device_freespace()) {
+      Dmsg4(20, "get_os_device_freespace: free_space=%s freespace_ok=%d free_space_errno=%d have_media=%d\n",
+         edit_uint64(free_space, ed1), !!is_freespace_ok(), free_space_errno, !!have_media());
+      return true;
+   }
+
+   icmd = device->free_space_command;
+
+   if (!icmd) {
+      set_freespace(0, 0, 0, false);
+      Dmsg2(20, "ERROR: update_free_space_dev: free_space=%s, free_space_errno=%d (!icmd)\n",
+            edit_uint64(free_space, ed1), free_space_errno);
+      Mmsg(errmsg, _("No FreeSpace command defined.\n"));
+      return false;
+   }
+
+   edit_mount_codes(ocmd, icmd);
+
+   Dmsg1(20, "update_freespace: cmd=%s\n", ocmd.c_str());
+
+   results = get_pool_memory(PM_MESSAGE);
+
+   Dmsg1(20, "Run freespace prog=%s\n", ocmd.c_str());
+   status = run_program_full_output(ocmd.c_str(), max_open_wait/2, results);
+   Dmsg2(20, "Freespace status=%d result=%s\n", status, results);
+   /* Should report "1223232 12323232\n"  "free  total\n" */
+   if (status == 0) {
+      free = str_to_int64(results) * 1024;
+      p = results;
+
+      if (skip_nonspaces(&p)) {
+         total = str_to_int64(p) * 1024;
+
+      } else {
+         total = 0;
+      }
+
+      Dmsg1(400, "Free space program run: Freespace=%s\n", results);
+      if (free >= 0) {
+         set_freespace(free, total, 0, true); /* have valid freespace */
+         Mmsg(errmsg, "");
+         ok = true;
+      }
+   } else {
+      set_freespace(0, 0, EPIPE, false); /* no valid freespace */
+      Mmsg2(errmsg, _("Cannot run free space command. Results=%s ERR=%s\n"),
+            results, be.bstrerror(status));
+
+      dev_errno = free_space_errno;
+      Dmsg4(20, "Cannot get free space on device %s. free_space=%s, "
+         "free_space_errno=%d ERR=%s\n",
+            print_name(), edit_uint64(free_space, ed1),
+            free_space_errno, errmsg);
+   }
+   free_pool_memory(results);
+   Dmsg4(20, "leave update_freespace: free_space=%s freespace_ok=%d free_space_errno=%d have_media=%d\n",
+      edit_uint64(free_space, ed1), !!is_freespace_ok(), free_space_errno, !!have_media());
+   return ok;
+}
+
+void DEVICE::updateVolCatBytes(uint64_t bytes)
+{
+   DEVICE *dev = this;
+   Lock_VolCatInfo();
+   dev->VolCatInfo.VolCatAmetaBytes += bytes;
+   Dmsg1(200, "updateVolBytes ameta=%lld\n",
+      dev->VolCatInfo.VolCatAmetaBytes);
+   dev->VolCatInfo.VolCatBytes += bytes;
+   setVolCatInfo(false);
+   Unlock_VolCatInfo();
+}
+
+void DEVICE::updateVolCatBlocks(uint32_t blocks)
+{
+   DEVICE *dev = this;
+   Lock_VolCatInfo();
+   dev->VolCatInfo.VolCatAmetaBlocks += blocks;
+   dev->VolCatInfo.VolCatBlocks += blocks;
+   setVolCatInfo(false);
+   Unlock_VolCatInfo();
+}
+
+
+void DEVICE::updateVolCatWrites(uint32_t writes)
+{
+   DEVICE *dev = this;
+   Lock_VolCatInfo();
+   dev->VolCatInfo.VolCatAmetaWrites += writes;
+   dev->VolCatInfo.VolCatWrites += writes;
+   setVolCatInfo(false);
+   Unlock_VolCatInfo();
+}
+
+void DEVICE::updateVolCatReads(uint32_t reads)
+{
+   DEVICE *dev = this;
+   Lock_VolCatInfo();
+   dev->VolCatInfo.VolCatAmetaReads += reads;
+   dev->VolCatInfo.VolCatReads += reads;
+   setVolCatInfo(false);
+   Unlock_VolCatInfo();
+}
+
+void DEVICE::updateVolCatReadBytes(uint64_t bytes)
+{
+   DEVICE *dev = this;
+   Lock_VolCatInfo();
+   dev->VolCatInfo.VolCatAmetaRBytes += bytes;
+   dev->VolCatInfo.VolCatRBytes += bytes;
+   setVolCatInfo(false);
+   Unlock_VolCatInfo();
+}
 
 /*
  * Close the device
  */
-void DEVICE::close()
+bool DEVICE::close()
 {
+   bool ok = true;
+
    Dmsg4(40, "close_dev vol=%s fd=%d dev=%p dev=%s\n",
       VolHdr.VolumeName, m_fd, this, print_name());
    offline_or_rewind();
@@ -552,7 +736,7 @@ void DEVICE::close()
    if (!is_open()) {
       Dmsg2(200, "device %s already closed vol=%s\n", print_name(),
          VolHdr.VolumeName);
-      return;                         /* already closed */
+      return true;                    /* already closed */
    }
 
    switch (dev_type) {
@@ -562,12 +746,18 @@ void DEVICE::close()
       unlock_door();
       /* Fall through wanted */
    default:
-      d_close(m_fd);
+      if (d_close(m_fd) != 0) {
+         berrno be;
+         dev_errno = errno;
+         Mmsg2(errmsg, _("Error closing device %s. ERR=%s.\n"),
+               print_name(), be.bstrerror());
+         ok = false;
+      }
       break;
    }
 
-   unmount(1);                        /* do unmount if required */
-
+   unmount(1);                       /* do unmount if required */
+ 
    /* Clean up device packet so it can be reused */
    clear_opened();
 
@@ -589,6 +779,7 @@ void DEVICE::close()
       stop_thread_timer(tid);
       tid = 0;
    }
+   return ok;
 }
 
 /*
@@ -613,70 +804,30 @@ void DEVICE::close_part(DCR * /*dcr*/)
    VolCatInfo = saveVolCatInfo;       /* structure assignment */
 }
 
-/*
- * Mount the device.
+/* 
  * If timeout, wait until the mount command returns 0.
  * If !timeout, try to mount the device only once.
  */
 bool DEVICE::mount(int timeout)
 {
    Dmsg0(190, "Enter mount\n");
-
-   if (is_mounted()) {
-      return true;
-   }
-
-   switch (dev_type) {
-   case B_VTL_DEV:
-   case B_VTAPE_DEV:
-   case B_TAPE_DEV:
-      if (device->mount_command) {
-         return do_tape_mount(1, timeout);
-      }
-      break;
-   case B_FILE_DEV:
-      if (requires_mount() && device->mount_command) {
-         return do_file_mount(1, timeout);
-      }
-      break;
-   default:
-      break;
-   }
-
+   if (!is_mounted() && device->mount_command) {
+      return mount_file(1, timeout);
+   } 
    return true;
 }
 
-/*
- * Unmount the device
+/* 
+ * Unmount the device 
  * If timeout, wait until the unmount command returns 0.
  * If !timeout, try to unmount the device only once.
  */
 bool DEVICE::unmount(int timeout)
 {
    Dmsg0(100, "Enter unmount\n");
-
-   if (!is_mounted()) {
-      return true;
-   }
-
-   switch (dev_type) {
-   case B_VTL_DEV:
-   case B_VTAPE_DEV:
-   case B_TAPE_DEV:
-      if (device->unmount_command) {
-         return do_tape_mount(0, timeout);
-      }
-      break;
-   case B_FILE_DEV:
-   case B_DVD_DEV:
-      if (requires_mount() && device->unmount_command) {
-         return do_file_mount(0, timeout);
-      }
-      break;
-   default:
-      break;
-   }
-
+   if (is_mounted() && requires_mount() && device->unmount_command) {
+      return mount_file(0, timeout);
+   } 
    return true;
 }
 
@@ -813,7 +964,7 @@ uint32_t DEVICE::get_file()
    if (is_dvd() || is_tape()) {
       return file;
    } else {
-      uint64_t bytes = VolCatInfo.VolCatAmetaBytes;
+      uint64_t bytes = VolCatInfo.VolCatAdataBytes + VolCatInfo.VolCatAmetaBytes;
       return (uint32_t)(bytes >> 32);
    }
 }
@@ -823,7 +974,7 @@ uint32_t DEVICE::get_block_num()
    if (is_dvd() || is_tape()) {
       return block_num;
    } else {
-      return  VolCatInfo.VolCatAmetaBlocks;
+      return  VolCatInfo.VolCatAdataBlocks + VolCatInfo.VolCatAmetaBlocks;
    }
 }
 
@@ -898,11 +1049,13 @@ void DEVICE::term(void)
    pthread_cond_destroy(&wait);
    pthread_cond_destroy(&wait_next_vol);
    pthread_mutex_destroy(&spool_mutex);
+   pthread_mutex_destroy(&freespace_mutex);
    if (attached_dcrs) {
       delete attached_dcrs;
       attached_dcrs = NULL;
    }
-   if (device) {
+   /* We let the DEVRES pointer if not our device */
+   if (device && device->dev == this) {
       device->dev = NULL;
    }
    delete this;
@@ -911,6 +1064,35 @@ void DEVICE::term(void)
    }
 }
 
+/* Get freespace values */
+void DEVICE::get_freespace(uint64_t *freeval, uint64_t *totalval)
+{
+   get_os_device_freespace();
+   P(freespace_mutex);
+   if (is_freespace_ok()) {
+      *freeval = free_space;
+      *totalval = total_space;
+   } else {
+      *freeval = *totalval = 0;
+   }
+   V(freespace_mutex);
+}
+
+/* Set freespace values */
+void DEVICE::set_freespace(uint64_t freeval, uint64_t totalval, int errnoval, bool valid)
+{
+   P(freespace_mutex);
+   free_space = freeval;
+   total_space = totalval;
+   free_space_errno = errnoval;
+   if (valid) {
+      set_freespace_ok();
+   } else {
+      clear_freespace_ok();
+   }
+   V(freespace_mutex);
+}
+
 /*
  * This routine initializes the device wait timers
  */
diff --git a/src/stored/dev.h b/src/stored/dev.h
index f773267..ef24f3e 100644
--- a/src/stored/dev.h
+++ b/src/stored/dev.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Definitions for using the Device functions in Bacula
@@ -79,8 +83,8 @@ enum {
    B_FIFO_DEV,
    B_VTAPE_DEV,                       /* change to B_TAPE_DEV after init */
    B_FTP_DEV,
-   B_VTL_DEV,
-   B_VIRTUAL_DEV                      /* Virtual device */
+   B_VTL_DEV,                         /* Virtual tape library device */
+   B_NULL_DEV
 };
 
 /* Generic status bits returned from status_dev() */
@@ -118,7 +122,7 @@ enum {
 #define CAP_CLOSEONPOLL    (1<<18)    /* Close device on polling */
 #define CAP_POSITIONBLOCKS (1<<19)    /* Use block positioning */
 #define CAP_MTIOCGET       (1<<20)    /* Basic support for fileno and blkno */
-#define CAP_REQMOUNT       (1<<21)    /* Require mount/unmount */
+#define CAP_REQMOUNT       (1<<21)    /* Require mount and unmount */
 #define CAP_CHECKLABELS    (1<<22)    /* Check for ANSI/IBM labels */
 #define CAP_BLOCKCHECKSUM  (1<<23)    /* Create/test block checksum */
 
@@ -155,19 +159,28 @@ struct VOLUME_CAT_INFO {
    /* Media info for the current Volume */
    uint64_t VolCatBytes;              /* Total bytes written */
    uint64_t VolCatAmetaBytes;         /* Ameta bytes written */
+   uint64_t VolCatAdataBytes;         /* Adata bytes written */
    uint64_t VolCatPadding;            /* Total padding bytes written */
+   uint64_t VolCatAmetaPadding;       /* Ameta zeros (padding) written */
+   uint64_t VolCatAdataPadding;       /* Adata zeros (padding) written */
    uint32_t VolCatBlocks;             /* Total blocks */
    uint32_t VolCatAmetaBlocks;        /* Ameta blocks */
+   uint32_t VolCatAdataBlocks;        /* Adata blocks */
    uint32_t VolCatWrites;             /* Total writes this volume */
    uint32_t VolCatAmetaWrites;        /* Ameta writes this volume */
+   uint32_t VolCatAdataWrites;        /* Adata writes this volume */
    uint32_t VolCatReads;              /* Total reads this volume */
    uint32_t VolCatAmetaReads;         /* Ameta reads this volume */
+   uint32_t VolCatAdataReads;         /* Adata reads this volume */
    uint64_t VolCatRBytes;             /* Total bytes read */
    uint64_t VolCatAmetaRBytes;        /* Ameta bytes read */
+   uint64_t VolCatAdataRBytes;        /* Adata bytes read */
+   uint64_t VolCatHoleBytes;          /* Total hole bytes */
 
+   uint32_t VolCatHoles;              /* Number of holes */
    uint32_t VolCatJobs;               /* Number of jobs on this Volume */
    uint32_t VolCatFiles;              /* Number of files */
-   uint32_t VolCatParts;              /* Number of parts written */
+   uint32_t VolCatType;               /* Volume drive type */
    uint32_t VolCatMounts;             /* Number of mounts this volume */
    uint32_t VolCatErrors;             /* Number of errors this volume */
    uint32_t VolCatRecycles;           /* Number of recycles this volume */
@@ -207,17 +220,18 @@ private:
    int m_blocked;                     /* set if we must wait (i.e. change tape) */
    int m_count;                       /* Mutex use count -- DEBUG only */
    int m_num_reserved;                /* counter of device reservations */
-   bool m_append_reserve;             /* reserved for append or read in m_num_reserved set */
-   int32_t m_slot;                    /* slot loaded in drive or -1 if none */
    pthread_t m_pid;                   /* Thread that locked -- DEBUG only */
+   int32_t m_slot;                    /* slot loaded in drive or -1 if none */
    bool m_unload;                     /* set when Volume must be unloaded */
    bool m_load;                       /* set when Volume must be loaded */
    bool m_wait;                       /* must wait for device to free volume */
+   bool m_append_reserve;             /* reserved for append or read in m_num_reserved set */
    bthread_mutex_t m_mutex;           /* access control */
    bthread_mutex_t acquire_mutex;     /* mutex for acquire code */
    pthread_mutex_t read_acquire_mutex; /* mutex for acquire read code */
    pthread_mutex_t volcat_mutex;      /* VolCatInfo mutex */
    pthread_mutex_t dcrs_mutex;        /* Attached dcr mutex */
+   pthread_mutex_t freespace_mutex;   /* mutex to compute the freespace */
 
 public:
    DEVICE() {};
@@ -237,14 +251,10 @@ public:
    int mode;                          /* read/write modes */
    int openmode;                      /* parameter passed to open_dev (useful to reopen the device) */
    int dev_type;                      /* device type */
+   bool enabled;                      /* Set when enabled */
    bool autoselect;                   /* Autoselect in autochanger */
    bool read_only;                    /* Device is read only */
    bool initiated;                    /* set when init_dev() called */
-   bool m_shstore;                    /* Shares storage can be used */
-   bool m_shstore_lock;               /* set if shared lock set */
-   bool m_shstore_user_lock;          /* set if user set shared lock */
-   bool m_shstore_register;           /* set if register key set */
-   bool m_shstore_blocked;            /* Set if I am blocked */
    int label_type;                    /* Bacula/ANSI/IBM label types */
    uint32_t drive_index;              /* Autochanger drive index (base 0) */
    POOLMEM *dev_name;                 /* Physical device name */
@@ -275,6 +285,8 @@ public:
    uint32_t num_dvd_parts;            /* number of parts WRITTEN on the DVD */
    /* state ST_FREESPACE_OK is set if free_space is valid */
    uint64_t free_space;               /* current free space on device */
+   uint64_t total_space;              /* current used space on device */
+   uint64_t devno;                    /* device id */
    uint64_t min_free_space;           /* Minimum free disk space */
    int free_space_errno;              /* indicates errno getting freespace */
    bool truncating;                   /* if set, we are currently truncating the DVD */
@@ -320,15 +332,16 @@ public:
    int is_autochanger() const { return capabilities & CAP_AUTOCHANGER; }
    int requires_mount() const { return capabilities & CAP_REQMOUNT; }
    int is_removable() const { return capabilities & CAP_REM; }
-   int is_tape() const { return (dev_type == B_TAPE_DEV ||
+   bool is_tape() const { return (dev_type == B_TAPE_DEV ||
                                  dev_type == B_VTAPE_DEV); }
-   int is_ftp() const { return dev_type == B_FTP_DEV; }
-   int is_file() const { return (dev_type == B_FILE_DEV); }
-   int is_fifo() const { return dev_type == B_FIFO_DEV; }
-   int is_dvd() const  { return dev_type == B_DVD_DEV; }
-   int is_vtl() const  { return dev_type == B_VTL_DEV; }
-   int is_vtape() const  { return dev_type == B_VTAPE_DEV; }
-   int is_open() const { return m_fd >= 0; }
+   bool is_ftp() const { return dev_type == B_FTP_DEV; }
+   bool is_file() const { return (dev_type == B_FILE_DEV); }
+   bool is_null() const { return dev_type == B_NULL_DEV; }
+   bool is_fifo() const { return dev_type == B_FIFO_DEV; }
+   bool is_dvd() const  { return dev_type == B_DVD_DEV; }
+   bool is_vtl() const  { return dev_type == B_VTL_DEV; }
+   bool is_vtape() const  { return dev_type == B_VTAPE_DEV; }
+   bool is_open() const { return m_fd >= 0; }
    int is_offline() const { return state & ST_OFFLINE; }
    int is_labeled() const { return state & ST_LABEL; }
    int is_mounted() const { return state & ST_MOUNTED; }
@@ -382,6 +395,8 @@ public:
    void set_part_spooled(int val) { if (val) state |= ST_PART_SPOOLED; \
           else state &= ~ST_PART_SPOOLED;
    };
+   void get_freespace(uint64_t *freeval, uint64_t *totalval); /* in dev.c */
+   void set_freespace(uint64_t freeval, uint64_t totalval, int errnoval, bool valid); /* in dev.c */
    bool is_volume_to_unload() const { \
       return m_unload && strcmp(VolHdr.VolumeName, UnloadVolName) == 0; };
    void set_load() { m_load = true; };
@@ -422,6 +437,7 @@ public:
    void clearVolCatBytes() {
       VolCatInfo.VolCatBytes = 0;
       VolCatInfo.VolCatAmetaBytes = 0;
+      VolCatInfo.VolCatAdataBytes = 0;
    };
 
    char *getVolCatName() { return VolCatInfo.VolCatName; };
@@ -438,8 +454,6 @@ public:
    void term(void);              /* in dev.c */
    ssize_t read(void *buf, size_t len); /* in dev.c */
    ssize_t write(const void *buf, size_t len);  /* in dev.c */
-   bool mount(int timeout);      /* in dev.c */
-   bool unmount(int timeout);    /* in dev.c */
    void edit_mount_codes(POOL_MEM &omsg, const char *imsg); /* in dev.c */
    bool offline_or_rewind();     /* in dev.c */
    bool eod(DCR *dcr);           /* in dev.c */
@@ -451,6 +465,8 @@ public:
    void clrerror(int func);      /* in dev.c */
    void set_slot(int32_t slot);  /* in dev.c */
    void clear_slot();            /* in dev.c */
+   bool update_freespace();              /* in dev.c */
+   bool get_os_device_freespace();       /* in dev.c */
    void notify_newvol_in_attached_dcrs(const char *VolumeName); /* in dev.c */
    void notify_newfile_in_attached_dcrs();/* in dev.c */
    void attach_dcr_to_dev(DCR *dcr);      /* in acquire.c */
@@ -461,11 +477,14 @@ public:
    void updateVolCatWrites(uint32_t);     /* in dev.c */
    void updateVolCatReads(uint32_t);      /* in dev.c */
    void updateVolCatReadBytes(uint64_t);  /* in dev.c */
+   void updateVolCatPadding(uint64_t);    /* in dev.c */
+   void updateVolCatHoleBytes(uint64_t);  /* in dev.c */
 
    uint32_t get_file();                   /* in dev.c */
    uint32_t get_block_num();              /* in dev.c */
 
    int fd() const { return m_fd; };
+   bool mount_file(int mount, int dottimout);
 
    /* Virtual functions that can be overridden */
    virtual int d_ioctl(int fd, ioctl_req_t request, char *mt_com=NULL);
@@ -478,8 +497,11 @@ public:
    virtual bool rewind(DCR *dcr);
    virtual bool truncate(DCR *dcr);
    virtual void open_device(DCR *dcr, int omode);
-   virtual void close();                 /* in dev.c */
+   virtual bool close();                  /* in dev.c */
    virtual bool open(DCR *dcr, int mode); /* in dev.c */
+   virtual bool mount(int timeout);
+   virtual bool unmount(int timeout);
+
 
    /* These could probably be made tape_dev only */
    virtual bool bsf(int count) { return true; }
@@ -489,7 +511,6 @@ public:
    virtual void unlock_door() { return; }
    virtual bool reposition(DCR *dcr, uint32_t rfile, uint32_t rblock);
 
-
    /*
     * Locking and blocking calls
     */
@@ -527,6 +548,7 @@ public:
    int init_read_acquire_mutex();         /* in lock.c */
    int init_volcat_mutex();               /* in lock.c */
    int init_dcrs_mutex();                 /* in lock.c */
+   int init_freespace_mutex();            /* in lock.c */
    void set_mutex_priorities();           /* in lock.c */
    int next_vol_timedwait(const struct timespec *timeout);  /* in lock.c */
    void dblock(int why);                  /* in lock.c */
@@ -536,17 +558,17 @@ public:
    int blocked() const { return m_blocked; };
    bool is_blocked() const { return m_blocked != BST_NOT_BLOCKED; };
    const char *print_blocked() const;     /* in dev.c */
-   void open_tape_device(DCR *dcr, int omode);    /* in dev.c */
-   void open_file_device(DCR *dcr, int omode);    /* in dev.c */
+   void open_tape_device(DCR *dcr, int omode);   /* in dev.c */
+   void open_file_device(DCR *dcr, int omode);   /* in dev.c */
 
 private:
-   bool do_tape_mount(int mount, int dotimeout);  /* in dev.c */
-   bool do_file_mount(int mount, int dotimeout);  /* in dev.c */
-   void set_mode(int omode);                      /* in dev.c */
+   bool mount_tape(int mount, int dotimeout); /* in dev.c */
+protected:
+   void set_mode(int omode);                     /* in dev.c */
 };
 inline const char *DEVICE::strerror() const { return errmsg; }
 inline const char *DEVICE::archive_name() const { return dev_name; }
-inline const char *DEVICE::print_name() const { return prt_name; }
+inline const char *DEVICE::print_name() const { return NPRT(prt_name); }
 
 
 #define CHECK_BLOCK_NUMBERS    true
@@ -579,6 +601,7 @@ public:
    DEVICE *ameta_dev;                 /* pointer to ameta_dev */
    DEVRES *device;                    /* pointer to device resource */
    DEV_BLOCK *block;                  /* pointer to block */
+   DEV_BLOCK *ameta_block;            /* meta data block */
    DEV_RECORD *rec;                   /* pointer to record */
    pthread_t tid;                     /* Thread running this dcr */
    int spool_fd;                      /* fd if spooling */
@@ -593,6 +616,7 @@ public:
    bool any_volume;                   /* Any OK for dir_find_next... */
    bool attached_to_dev;              /* set when attached to dev */
    bool keep_dcr;                     /* do not free dcr in release_dcr */
+   bool no_mount_request;             /* do not submit any mount request */
    uint32_t VolFirstIndex;            /* First file index this Volume */
    uint32_t VolLastIndex;             /* Last file index this Volume */
    uint32_t FileIndex;                /* Current File Index */
@@ -613,7 +637,9 @@ public:
    VOLUME_CAT_INFO VolCatInfo;        /* Catalog info for desired volume */
 
    /* Methods */
+   void set_no_mount_request() { no_mount_request = true; }; /* Just fail in case of mount request */
    void set_dev(DEVICE *ndev) { dev = ndev; ameta_dev = ndev; };
+   void set_ameta() { dev = ameta_dev; block = ameta_block; };
    void set_dev_locked() { m_dev_locked = true; };
    void set_writing() { m_writing = true; };
    void clear_writing() { m_writing = false; };
@@ -634,6 +660,7 @@ public:
      setVolCatInfo(false);
    };
    char *getVolCatName() { return VolCatInfo.VolCatName; };
+   bool write_final_block_to_device() { return write_block_to_device(true); };
 
    /* Methods in autochanger.c */
    bool is_virtual_autochanger();
@@ -679,7 +706,7 @@ public:
 
    /* Methods in block.c */
    void free_blocks();
-   bool write_block_to_device();
+   bool write_block_to_device(bool final=false);
    bool write_block_to_dev();
    bool read_block_from_device(bool check_block_numbers);
    bool read_block_from_dev(bool check_block_numbers);
@@ -703,4 +730,4 @@ public:
 #endif
 #endif
 
-#endif
+#endif /* __DEV_H */
diff --git a/src/stored/device.c b/src/stored/device.c
index 3743bce..90a11cf 100644
--- a/src/stored/device.c
+++ b/src/stored/device.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -44,17 +48,8 @@
  */
 
 #include "bacula.h"                   /* pull in global headers */
-#ifdef HAVE_SYS_STATVFS_H
-#include <sys/statvfs.h>
-#else
-#define statvfs statfs
-#endif
-/* statvfs.h defines ST_APPEND, which is also used by Bacula */
-#undef ST_APPEND
-
 #include "stored.h"                   /* pull in Storage Deamon headers */
 
-
 /* Forward referenced functions */
 
 /*
@@ -83,6 +78,7 @@ bool fixup_device_block_write_error(DCR *dcr, int retries)
    char PrevVolName[MAX_NAME_LENGTH];
    DEV_BLOCK *label_blk;
    DEV_BLOCK *block;
+   DEV_BLOCK *ameta_block = dcr->ameta_block;
    char b1[30], b2[30];
    time_t wait_time;
    char dt[MAX_TIME_LENGTH];
@@ -114,7 +110,7 @@ bool fixup_device_block_write_error(DCR *dcr, int retries)
    bstrncpy(dev->VolHdr.PrevVolumeName, PrevVolName, sizeof(dev->VolHdr.PrevVolumeName));
 
    label_blk = new_block(dev);
-   dcr->block = label_blk;
+   dcr->ameta_block = dcr->block = label_blk;
 
    /* Inform User about end of medium */
    Jmsg(jcr, M_INFO, 0, _("End of medium on Volume \"%s\" Bytes=%s Blocks=%s at %s.\n"),
@@ -132,6 +128,7 @@ bool fixup_device_block_write_error(DCR *dcr, int retries)
    if (!dcr->mount_next_write_volume()) {
       free_block(label_blk);
       dcr->block = block;
+      dcr->ameta_block = ameta_block;
       dev->Lock();
       goto bail_out;
    }
@@ -159,10 +156,12 @@ bool fixup_device_block_write_error(DCR *dcr, int retries)
         be.bstrerror(dev->dev_errno));
       free_block(label_blk);
       dcr->block = block;
+      dcr->ameta_block = ameta_block;
       goto bail_out;
    }
    free_block(label_blk);
    dcr->block = block;
+   dcr->ameta_block = ameta_block;
 
    /* Clear NewVol now because dir_get_volume_info() already done */
    jcr->dcr->NewVol = false;
@@ -204,12 +203,9 @@ void set_start_vol_position(DCR *dcr)
    DEVICE *dev = dcr->dev;
    /* Set new start position */
    if (dev->is_tape()) {
-      dcr->StartBlock = dev->block_num;
-      dcr->StartFile = dev->file;
+      dcr->StartBlock = dcr->EndBlock = dev->block_num;
+      dcr->StartFile = dcr->EndFile = dev->file;
    } else {
-      /*
-       * Note: we only update the DCR values for blocks
-       */
       dcr->StartBlock = dcr->EndBlock = (uint32_t)dev->file_addr;
       dcr->StartFile  = dcr->EndFile = (uint32_t)(dev->file_addr >> 32);
    }
@@ -314,7 +310,7 @@ bail_out:
 /*
  * Make sure device is open, if not do so
  */
-bool open_dev(DCR *dcr)
+bool open_device(DCR *dcr)
 {
    DEVICE *dev = dcr->dev;
    /* Open device */
@@ -338,96 +334,3 @@ bool open_dev(DCR *dcr)
    }
    return true;
 }
-
-/*
- */
-void DEVICE::updateVolCatBytes(uint64_t bytes)
-{
-   DEVICE *dev;
-   Lock_VolCatInfo();
-   dev = this;
-   dev->VolCatInfo.VolCatAmetaBytes += bytes;
-   dev->VolCatInfo.VolCatBytes += bytes;
-   setVolCatInfo(false);
-   Unlock_VolCatInfo();
-}
-
-void DEVICE::updateVolCatBlocks(uint32_t blocks)
-{
-   DEVICE *dev;
-   Lock_VolCatInfo();
-   dev = this;
-   dev->VolCatInfo.VolCatAmetaBlocks += blocks;
-   dev->VolCatInfo.VolCatBlocks += blocks;
-   setVolCatInfo(false);
-   Unlock_VolCatInfo();
-}
-
-void DEVICE::updateVolCatWrites(uint32_t writes)
-{
-   DEVICE *dev;
-   Lock_VolCatInfo();
-   dev = this;
-   dev->VolCatInfo.VolCatAmetaWrites += writes;
-   dev->VolCatInfo.VolCatWrites += writes;
-   setVolCatInfo(false);
-   Unlock_VolCatInfo();
-}
-
-void DEVICE::updateVolCatReads(uint32_t reads)
-{
-   DEVICE *dev;
-   Lock_VolCatInfo();
-   dev = this;
-   dev->VolCatInfo.VolCatAmetaReads += reads;
-   dev->VolCatInfo.VolCatReads += reads;
-   setVolCatInfo(false);
-   Unlock_VolCatInfo();
-}
-
-void DEVICE::updateVolCatReadBytes(uint64_t bytes)
-{
-   DEVICE *dev;
-   Lock_VolCatInfo();
-   dev = this;
-   dev->VolCatInfo.VolCatAmetaRBytes += bytes;
-   dev->VolCatInfo.VolCatRBytes += bytes;
-   setVolCatInfo(false);
-   Unlock_VolCatInfo();
-}
-
-void DEVICE::set_nospace()
-{
-   state |= ST_NOSPACE;
-}
-
-void DEVICE::clear_nospace()
-{
-   state &= ~ST_NOSPACE;
-}
-
-/* Put device in append mode */
-void DEVICE::set_append()
-{
-   state &= ~(ST_NOSPACE|ST_READ|ST_EOT|ST_EOF|ST_WEOT);  /* remove EOF/EOT flags */
-   state |= ST_APPEND;
-}
-
-/* Clear append mode */
-void DEVICE::clear_append()
-{
-   state &= ~ST_APPEND;
-}
-
-/* Put device in read mode */
-void DEVICE::set_read()
-{
-   state &= ~(ST_APPEND|ST_EOT|ST_EOF|ST_WEOT);  /* remove EOF/EOT flags */
-   state |= ST_READ;
-}
-
-/* Clear read mode */
-void DEVICE::clear_read()
-{
-   state &= ~ST_READ;
-}
diff --git a/src/stored/dircmd.c b/src/stored/dircmd.c
index 0043a61..dee3a03 100644
--- a/src/stored/dircmd.c
+++ b/src/stored/dircmd.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *  This file handles accepting Director Commands
@@ -72,6 +76,8 @@ static bool setdebug_cmd(JCR *jcr);
 static bool cancel_cmd(JCR *cjcr);
 static bool mount_cmd(JCR *jcr);
 static bool unmount_cmd(JCR *jcr);
+static bool enable_cmd(JCR *jcr);
+static bool disable_cmd(JCR *jcr);
 //static bool action_on_purge_cmd(JCR *jcr);
 static bool bootstrap_cmd(JCR *jcr);
 static bool changer_cmd(JCR *sjcr);
@@ -110,6 +116,8 @@ static struct s_cmds cmds[] = {
    {".die",        die_cmd,         0},
    {"label",       label_cmd,       0},     /* label a tape */
    {"mount",       mount_cmd,       0},
+   {"enable",      enable_cmd,       0},
+   {"disable",     disable_cmd,       0},
    {"readlabel",   readlabel_cmd,   0},
    {"release",     release_cmd,     0},
    {"relabel",     relabel_cmd,     0},     /* relabel a tape */
@@ -130,7 +138,7 @@ static struct s_cmds cmds[] = {
  * Connection request. We accept connections either from the
  *  Director or a Client (File daemon).
  *
- * Note, we are running as a seperate thread of the Storage daemon.
+ * Note, we are running as a separate thread of the Storage daemon.
  *  and it is because a Director has made a connection with
  *  us on the "Message" channel.
  *
@@ -147,10 +155,8 @@ void *handle_connection_request(void *arg)
    BSOCK *bs = (BSOCK *)arg;
    JCR *jcr;
    int i;
-   int fd_version, sd_version;
    bool found, quit;
    int bnet_stat = 0;
-   char name[500];
    char tbuf[100];
 
    if (bs->recv() <= 0) {
@@ -160,31 +166,9 @@ void *handle_connection_request(void *arg)
       return NULL;
    }
 
-   /*
-    * Do a sanity check on the message received
-    */
-   if (bs->msglen < 25 || bs->msglen > (int)sizeof(name)) {
-      Pmsg1(000, "<filed: %s", bs->msg);
-      Jmsg2(NULL, M_ERROR, 0, _("Invalid connection from %s. Len=%d\n"), bs->who(), bs->msglen);
-      bmicrosleep(5, 0);   /* make user wait 5 seconds */
-      bs->destroy();
-      return NULL;
-   }
-
-   Dmsg1(100, "Conn: %s", bs->msg);
-   fd_version = 0;
-   sd_version = 0;
-   /*
-    * See if this is a File daemon connection. If so
-    *   call FD handler.
-    */
-   if (sscanf(bs->msg, "Hello Bacula SD: Start Job %127s %d %d", name, &fd_version, &sd_version) == 3 ||
-       sscanf(bs->msg, "Hello FD: Bacula Storage calling Start Job %127s %d", name, &sd_version) == 2 ||
-       sscanf(bs->msg, "Hello Start Job %127s", name) == 1) {
-      Dmsg1(050, "Got a FD connection at %s\n", bstrftimes(tbuf, sizeof(tbuf),
-            (utime_t)time(NULL)));
-      Dmsg1(50, "%s", bs->msg);
-      handle_filed_connection(bs, name, fd_version, sd_version);
+   /* Check for client connection */
+   if (is_client_connection(bs)) {
+      handle_client_connection(bs);
       return NULL;
    }
 
@@ -197,6 +181,7 @@ void *handle_connection_request(void *arg)
    jcr->dir_bsock = bs;               /* save Director bsock */
    jcr->dir_bsock->set_jcr(jcr);
    jcr->dcrs = New(alist(10, not_owned_by_alist));
+   create_jobmedia_queue(jcr);
    /* Initialize FD start condition variable */
    int errstat = pthread_cond_init(&jcr->job_start_wait, NULL);
    if (errstat != 0) {
@@ -208,9 +193,11 @@ void *handle_connection_request(void *arg)
    Dmsg0(1000, "stored in start_job\n");
 
    /*
-    * Authenticate the Director
+    * Validate then authenticate the Director
     */
-   /* We should have: Hello SD: Bacula Director <dirname> calling */
+   if (!validate_dir_hello(jcr)) {
+      goto bail_out;
+   }
    if (!authenticate_director(jcr)) {
       Jmsg(jcr, M_FATAL, 0, _("Unable to authenticate Director\n"));
       goto bail_out;
@@ -255,6 +242,7 @@ void *handle_connection_request(void *arg)
 bail_out:
    generate_daemon_event(jcr, "JobEnd");
    generate_plugin_event(jcr, bsdEventJobEnd);
+   flush_jobmedia_queue(jcr);
    dequeue_messages(jcr);             /* send any queued messages */
    bs->signal(BNET_TERMINATE);
    free_plugins(jcr);                 /* release instantiated plugins */
@@ -290,6 +278,7 @@ static bool die_cmd(JCR *jcr)
 
 /*
  * Get address of client from Director
+ *   This initiates SD Calls Client.
  *   We attempt to connect to the client (an FD or SD) and
  *   authenticate it.
  */
@@ -326,10 +315,12 @@ static bool client_cmd(JCR *jcr)
    }
    Dmsg0(110, "SD connection OK to Client.\n");
 
-   /* Send Hello */
-   cl->fsend("Hello FD: Bacula Storage calling Start Job %s 1\n", jcr->Job);
    jcr->file_bsock = cl;
    jcr->file_bsock->set_jcr(jcr);
+   if (!send_hello_client(jcr, jcr->Job)) {
+      goto bail_out;
+   }
+
    /* Send OK to Director */
    return dir->fsend(OKclient);
 
@@ -400,7 +391,11 @@ static bool storage_cmd(JCR *jcr)
       }
    }
 
-   if (!authenticate_storagedaemon(jcr, Job)) {
+   if (!send_hello_sd(jcr, Job)) {
+      goto bail_out;
+   }
+
+   if (!authenticate_storagedaemon(jcr)) {
       goto bail_out;
    }
    /*
@@ -430,16 +425,16 @@ bail_out:
 static bool setdebug_cmd(JCR *jcr)
 {
    BSOCK *dir = jcr->dir_bsock;
-   int32_t trace_flag, lvl, hangup; /* hangup is ignored right now */
-   int64_t level;
+   int32_t trace_flag, lvl, hangup, blowup;
+   int64_t level, level_tags = 0;
    char options[60];
    char tags[512];
    *tags = *options = 0;
 
    Dmsg1(10, "setdebug_cmd: %s", dir->msg);
 
-   if (sscanf(dir->msg, "setdebug=%ld trace=%ld hangup=%ld options=%55s tags=%511s",
-              &lvl, &trace_flag, &hangup, options, tags) != 5)
+   if (sscanf(dir->msg, "setdebug=%ld trace=%ld hangup=%ld blowup=%ld options=%55s tags=%511s",
+              &lvl, &trace_flag, &hangup, &blowup, options, tags) != 6)
    {
       if (sscanf(dir->msg, "setdebug=%ld trace=%ld", &lvl, &trace_flag) != 2 || lvl < 0) {
          dir->fsend(_("3991 Bad setdebug command: %s\n"), dir->msg);
@@ -448,11 +443,16 @@ static bool setdebug_cmd(JCR *jcr)
    }
    level = lvl;
    set_trace(trace_flag);
+   set_hangup(hangup);
+   set_blowup(blowup);
    set_debug_flags(options);
-   if (!debug_parse_tags(tags, &level)) {
+   if (!debug_parse_tags(tags, &level_tags)) {
       *tags = 0;
    }
-   debug_level = level;
+   if (level >= 0) {
+      debug_level = level;
+   }
+   debug_level_tags = level_tags;
 
    return dir->fsend(OKsetdebug, lvl, trace_flag, options, tags);
 }
@@ -475,6 +475,9 @@ static bool cancel_cmd(JCR *cjcr)
    if (sscanf(dir->msg, "cancel Job=%127s", Job) == 1) {
       status = JS_Canceled;
       reason = "canceled";
+   } else if (sscanf(dir->msg, "stop Job=%127s", Job) == 1) {
+      status = JS_Incomplete;
+      reason = "stopped";
    } else {
       dir->fsend(_("3903 Error scanning cancel command.\n"));
       goto bail_out;
@@ -619,7 +622,6 @@ static void label_volume_if_ok(DCR *dcr, char *oldname,
    int label_status;
    int mode;
    const char *volname = (relabel == 1) ? oldname : newname;
-   char ed1[50];
 
    steal_device_lock(dev, &hold, BST_WRITING_LABEL);
    Dmsg1(100, "Stole device %s lock, writing label.\n", dev->print_name());
@@ -683,9 +685,15 @@ static void label_volume_if_ok(DCR *dcr, char *oldname,
       }
       bstrncpy(dcr->VolumeName, newname, sizeof(dcr->VolumeName));
       /* The following 3000 OK label. string is scanned in ua_label.c */
-      dir->fsend("3000 OK label. VolBytes=%s DVD=%d Volume=\"%s\" Device=%s\n",
-                 edit_uint64(dev->VolCatInfo.VolCatBytes, ed1),
-                 dev->is_dvd()?1:0, newname, dev->print_name());
+      int type;
+      if (dev->dev_type == B_FILE_DEV) {
+         type = dev->dev_type;
+      } else {
+         type = 0;
+      }
+      dir->fsend("3000 OK label. VolBytes=%lld VolABytes=%lld VolType=%d Volume=\"%s\" Device=%s\n",
+                 dev->VolCatInfo.VolCatBytes, dev->VolCatInfo.VolCatAdataBytes,
+                 type, newname, dev->print_name());
       break;
    case VOL_TYPE_ERROR:
       dir->fsend(_("3915 Failed to label Volume: ERR=%s\n"), dev->errmsg);
@@ -695,7 +703,7 @@ static void label_volume_if_ok(DCR *dcr, char *oldname,
       break;
    default:
       dir->fsend(_("3913 Cannot label Volume. "
-"Unknown status %d from read_volume_label()\n"), label_status);
+                   "Unknown status %d from read_volume_label()\n"), label_status);
       break;
    }
 
@@ -796,6 +804,9 @@ static DCR *find_device(JCR *jcr, POOL_MEM &devname,
                if (!device->dev->autoselect) {
                   Dmsg1(100, "Device %s not autoselect skipped.\n", devname.c_str());
                   continue;              /* device is not available */
+               } else if (!device->dev->enabled) {
+                  Dmsg1(100, "Device %s disabled skipped.\n", devname.c_str());
+                  continue;              /* device disabled */
                }
                if ((drive < 0 || drive == (int)device->dev->drive_index) &&
                    (!media_type || strcmp(device->media_type, media_type) ==0)) {
@@ -819,7 +830,6 @@ static DCR *find_device(JCR *jcr, POOL_MEM &devname,
    return dcr;
 }
 
-
 /*
  * Mount command from Director
  */
@@ -829,16 +839,18 @@ static bool mount_cmd(JCR *jcr)
    BSOCK *dir = jcr->dir_bsock;
    DEVICE *dev;
    DCR *dcr;
-   int32_t drive;
-   int32_t slot = 0;
+   int32_t drive;      /* device index */
+   int32_t slot;
    bool ok;
 
+   Dmsg1(100, "%s\n", dir->msg);
    ok = sscanf(dir->msg, "mount %127s drive=%d slot=%d", devname.c_str(),
                &drive, &slot) == 3;
    if (!ok) {
+      slot = 0;
       ok = sscanf(dir->msg, "mount %127s drive=%d", devname.c_str(), &drive) == 2;
    }
-   Dmsg3(100, "ok=%d drive=%d slot=%d\n", ok, drive, slot);
+   Dmsg3(100, "ok=%d device_index=%d slot=%d\n", ok, drive, slot);
    if (ok) {
       dcr = find_device(jcr, devname, NULL, drive);
       if (dcr) {
@@ -979,6 +991,71 @@ static bool mount_cmd(JCR *jcr)
    return true;
 }
 
+/* enable command from Director */
+static bool enable_cmd(JCR *jcr)
+{
+   POOL_MEM devname;
+   BSOCK *dir = jcr->dir_bsock;
+   DEVICE *dev;
+   DCR *dcr;
+   int32_t drive;
+   bool ok;
+
+   ok = sscanf(dir->msg, "enable %127s drive=%d", devname.c_str(),
+               &drive) == 2;
+   Dmsg3(100, "ok=%d device=%s device_index=%d\n", ok, devname.c_str(), drive);
+   if (ok) {
+      dcr = find_device(jcr, devname, NULL, drive);
+      if (dcr) {
+         dev = dcr->dev;
+         dev->Lock();                 /* Use P to avoid indefinite block */
+         dev->enabled = true;
+         dir->fsend(_("3002 Device \"%s\" enabled.\n"), dev->print_name());
+         dev->Unlock();
+         free_dcr(dcr);
+      }
+   } else {
+      /* NB dir->msg gets clobbered in bnet_fsend, so save command */
+      pm_strcpy(jcr->errmsg, dir->msg);
+      dir->fsend(_("3907 Error scanning \"enable\" command: %s\n"), jcr->errmsg);
+   }
+   dir->signal(BNET_EOD);
+   return true;
+}
+
+/* enable command from Director */
+static bool disable_cmd(JCR *jcr)
+{
+   POOL_MEM devname;
+   BSOCK *dir = jcr->dir_bsock;
+   DEVICE *dev;
+   DCR *dcr;
+   int32_t drive;
+   bool ok;
+
+   ok = sscanf(dir->msg, "disable %127s drive=%d", devname.c_str(),
+               &drive) == 2;
+   Dmsg3(100, "ok=%d device=%s device_index=%d\n", ok, devname.c_str(), drive);
+   if (ok) {
+      dcr = find_device(jcr, devname, NULL, drive);
+      if (dcr) {
+         dev = dcr->dev;
+         dev->Lock();
+         dev->enabled = false;
+         dir->fsend(_("3002 Device \"%s\" disabled.\n"), dev->print_name());
+         dev->Unlock();
+         free_dcr(dcr);
+      }
+   } else {
+      /* NB dir->msg gets clobbered in bnet_fsend, so save command */
+      pm_strcpy(jcr->errmsg, dir->msg);
+      dir->fsend(_("3907 Error scanning \"disable\" command: %s\n"), jcr->errmsg);
+   }
+   dir->signal(BNET_EOD);
+   return true;
+}
+
+
 /*
  * unmount command from Director
  */
@@ -1301,7 +1378,7 @@ static bool changer_cmd(JCR *jcr)
       }
    } else {  /* error on scanf */
       pm_strcpy(jcr->errmsg, dir->msg);
-      dir->fsend(_("3908 Error scanning autochanger drives/list/slots command: %s\n"),
+      dir->fsend(_("3909 Error scanning autochanger drives/list/slots command: %s\n"),
          jcr->errmsg);
    }
    dir->signal(BNET_EOD);
diff --git a/src/stored/ebcdic.c b/src/stored/ebcdic.c
index 2e7d4bd..1a4d265 100644
--- a/src/stored/ebcdic.c
+++ b/src/stored/ebcdic.c
@@ -1,22 +1,26 @@
 /*
- * Taken from the public domain ansitape program for
- *   integration into Bacula. KES - Mar 2005
- */
-/*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2006-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
+/*
+ * Taken from the public domain ansitape program for
+ *   integration into Bacula. KES - Mar 2005
+ */
 
 
 /* Mapping of EBCDIC codes to ASCII equivalents. */
diff --git a/src/stored/fd_cmds.c b/src/stored/fd_cmds.c
index e8fcc20..d966250 100644
--- a/src/stored/fd_cmds.c
+++ b/src/stored/fd_cmds.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * This file handles commands from the File daemon.
@@ -81,6 +85,7 @@ static char read_open[]       = "read open session = %127s %ld %ld %ld %ld %ld %
 /* Responses sent to the File daemon */
 static char NO_open[]         = "3901 Error session already open\n";
 static char NOT_opened[]      = "3902 Error session not opened\n";
+static char ERROR_open[]      = "3904 Error open session, bad parameters\n";
 static char OK_end[]          = "3000 OK end\n";
 static char OK_close[]        = "3000 OK close Status = %d\n";
 static char OK_open[]         = "3000 OK open ticket = %d\n";
@@ -121,7 +126,7 @@ void run_job(JCR *jcr)
    Dmsg3(050, "==== JobType=%c run_job=%d sd_client=%d\n", jcr->getJobType(), jcr->JobId, jcr->sd_client);
    if (jcr->is_JobType(JT_BACKUP) && jcr->sd_client) {
       jcr->session_opened = true;
-      Dmsg0(050, "Do: receive for 3000 OK data then append");
+      Dmsg0(050, "Do: receive for 3000 OK data then append\n");
       if (!response(jcr, jcr->file_bsock, "3000 OK data\n", "Append data")) {
          Dmsg1(050, "Expect: 3000 OK data, got: %s", jcr->file_bsock->msg);
          Jmsg0(jcr, M_FATAL, 0, "Append data not accepted\n");
@@ -131,8 +136,8 @@ void run_job(JCR *jcr)
       append_end_session(jcr);
    } else if (jcr->is_JobType(JT_MIGRATE) || jcr->is_JobType(JT_COPY)) {
       jcr->session_opened = true;
-      Dmsg1(050, "Do: read_data_cmd file_bsock=%p\n", jcr->file_bsock);
       read_data_cmd(jcr);
+      Dmsg0(050, "Do: receive for 3000 OK data then read\n");
       if (!response(jcr, jcr->file_bsock, "3000 OK data\n", "Data received")) {
          Dmsg1(050, "Expect 3000 OK data, got: %s", jcr->file_bsock->msg);
          Jmsg0(jcr, M_FATAL, 0, "Read data not accepted\n");
@@ -147,6 +152,7 @@ void run_job(JCR *jcr)
    }
 bail_out:
    jcr->end_time = time(NULL);
+   flush_jobmedia_queue(jcr);
    dequeue_messages(jcr);             /* send any queued messages */
    jcr->setJobStatus(JS_Terminated);
    generate_daemon_event(jcr, "JobEnd");
@@ -245,7 +251,7 @@ static bool append_end_session(JCR *jcr)
 {
    BSOCK *fd = jcr->file_bsock;
 
-   Dmsg1(120, "store<file: %s", fd->msg);
+   Dmsg1(120, ">filed: %s", fd->msg);
    if (!jcr->session_opened) {
       pm_strcpy(jcr->errmsg, _("Attempt to close non-open session.\n"));
       fd->fsend(NOT_opened);
@@ -299,7 +305,6 @@ static bool append_close_session(JCR *jcr)
    Dmsg1(120, ">filed: %s", fd->msg);
 
    fd->signal(BNET_EOD);              /* send EOD to File daemon */
-
    jcr->session_opened = false;
    return true;
 }
@@ -337,7 +342,7 @@ static bool read_open_session(JCR *jcr)
 
    Dmsg1(120, "%s", fd->msg);
    if (jcr->session_opened) {
-      pm_strcpy(jcr->errmsg, _("Attempt to open read on non-open session.\n"));
+      pm_strcpy(jcr->errmsg, _("Attempt to open an already open session.\n"));
       fd->fsend(NO_open);
       return false;
    }
@@ -345,17 +350,17 @@ static bool read_open_session(JCR *jcr)
    if (sscanf(fd->msg, read_open, jcr->read_dcr->VolumeName, &jcr->read_VolSessionId,
          &jcr->read_VolSessionTime, &jcr->read_StartFile, &jcr->read_EndFile,
          &jcr->read_StartBlock, &jcr->read_EndBlock) == 7) {
-      if (jcr->session_opened) {
-         pm_strcpy(jcr->errmsg, _("Attempt to open read on non-open session.\n"));
-         fd->fsend(NOT_opened);
-         return false;
-      }
       Dmsg4(100, "read_open_session got: JobId=%d Vol=%s VolSessId=%ld VolSessT=%ld\n",
          jcr->JobId, jcr->read_dcr->VolumeName, jcr->read_VolSessionId,
          jcr->read_VolSessionTime);
       Dmsg4(100, "  StartF=%ld EndF=%ld StartB=%ld EndB=%ld\n",
          jcr->read_StartFile, jcr->read_EndFile, jcr->read_StartBlock,
          jcr->read_EndBlock);
+
+   } else {
+      pm_strcpy(jcr->errmsg, _("Cannot open session, received bad parameters.\n"));
+      fd->fsend(ERROR_open);
+      return false;
    }
 
    jcr->session_opened = true;
diff --git a/src/stored/file_dev.c b/src/stored/file_dev.c
index e5ad02f..d7166e7 100644
--- a/src/stored/file_dev.c
+++ b/src/stored/file_dev.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -42,7 +46,11 @@ int DEVICE::d_close(int fd)
 
 int DEVICE::d_ioctl(int fd, ioctl_req_t request, char *mt_com)
 {
+#ifdef HAVE_WIN32
+   return -1;
+#else
    return ::ioctl(fd, request, mt_com);
+#endif
 }
 
 ssize_t DEVICE::d_read(int fd, void *buffer, size_t count)
@@ -123,12 +131,12 @@ boffset_t DEVICE::lseek(DCR *dcr, boffset_t offset, int whence)
 }
 
 /*
- * Open a file device. For Aligned type we open both Volumes
+ * Open a file device.
  */
 void DEVICE::open_file_device(DCR *dcr, int omode)
 {
    POOL_MEM archive_name(PM_FNAME);
-   POOL_MEM aligned_name(PM_FNAME);
+   struct stat sp;
 
    get_autochanger_loaded_slot(dcr);
 
@@ -151,10 +159,13 @@ void DEVICE::open_file_device(DCR *dcr, int omode)
          return;
       }
 
-      if (!IsPathSeparator(archive_name.c_str()[strlen(archive_name.c_str())-1])) {
-         pm_strcat(archive_name, "/");
+      /* If not /dev/null concatenate VolumeName */
+      if (!is_null()) {
+         if (!IsPathSeparator(archive_name.c_str()[strlen(archive_name.c_str())-1])) {
+            pm_strcat(archive_name, "/");
+         }
+         pm_strcat(archive_name, getVolCatName());
       }
-      pm_strcat(archive_name, getVolCatName());
    }
 
    mount(1);                          /* do mount if required */
@@ -171,19 +182,25 @@ void DEVICE::open_file_device(DCR *dcr, int omode)
       Mmsg3(errmsg, _("Could not open(%s,%s,0640): ERR=%s\n"),
             archive_name.c_str(), mode_to_str(omode), be.bstrerror());
       Dmsg1(40, "open failed: %s", errmsg);
+   } else {
+      Dmsg2(40, "Did open(%s,%s,0640)\n", archive_name.c_str(), mode_to_str(omode));
    }
    if (m_fd >= 0) {
       dev_errno = 0;
       file = 0;
       file_addr = 0;
+
+      /* Refresh the underline device id */
+      if (fstat(m_fd, &sp) == 0) {
+         devno = sp.st_dev;
+      }
    }
    Dmsg1(100, "open dev: disk fd=%d opened\n", m_fd);
 }
 
 
 /*
- * Truncate a volume.  If this is aligned disk, we
- *  truncate both volumes.
+ * Truncate a volume.
  */
 bool DEVICE::truncate(DCR *dcr) /* We need the DCR for DVD-writing */
 {
@@ -198,61 +215,65 @@ bool DEVICE::truncate(DCR *dcr) /* We need the DCR for DVD-writing */
       /* maybe we should rewind and write and eof ???? */
       return true;                    /* we don't really truncate tapes */
    case B_FILE_DEV:
-      Dmsg1(100, "Truncate fd=%d\n", dev->m_fd);
-      if (ftruncate(dev->m_fd, 0) != 0) {
-         berrno be;
-         Mmsg2(errmsg, _("Unable to truncate device %s. ERR=%s\n"),
-               print_name(), be.bstrerror());
-         return false;
-      }
-
-      /*
-       * Check for a successful ftruncate() and issue a work-around for devices
-       * (mostly cheap NAS) that don't support truncation.
-       * Workaround supplied by Martin Schmid as a solution to bug #1011.
-       * 1. close file
-       * 2. delete file
-       * 3. open new file with same mode
-       * 4. change ownership to original
-       */
-
-      if (fstat(dev->m_fd, &st) != 0) {
-         berrno be;
-         Mmsg2(errmsg, _("Unable to stat device %s. ERR=%s\n"),
-               print_name(), be.bstrerror());
-         return false;
-      }
-
-      if (st.st_size != 0) {             /* ftruncate() didn't work */
-         POOL_MEM archive_name(PM_FNAME);
-
-         pm_strcpy(archive_name, dev_name);
-         if (!IsPathSeparator(archive_name.c_str()[strlen(archive_name.c_str())-1])) {
-            pm_strcat(archive_name, "/");
+      /* Do truncate for 1 or 2 devices */
+      for ( ;; ) {
+         Dmsg1(100, "Truncate fd=%d\n", dev->m_fd);
+         if (ftruncate(dev->m_fd, 0) != 0) {
+            berrno be;
+            Mmsg2(errmsg, _("Unable to truncate device %s. ERR=%s\n"),
+                  print_name(), be.bstrerror());
+            return false;
          }
-         pm_strcat(archive_name, dcr->VolumeName);
-
-         Mmsg2(errmsg, _("Device %s doesn't support ftruncate(). Recreating file %s.\n"),
-               print_name(), archive_name.c_str());
 
-         /* Close file and blow it away */
-         ::close(dev->m_fd);
-         ::unlink(archive_name.c_str());
-
-         /* Recreate the file -- of course, empty */
-         dev->set_mode(CREATE_READ_WRITE);
-         if ((dev->m_fd = ::open(archive_name.c_str(), mode, st.st_mode)) < 0) {
+         /*
+          * Check for a successful ftruncate() and issue a work-around for devices
+          * (mostly cheap NAS) that don't support truncation.
+          * Workaround supplied by Martin Schmid as a solution to bug #1011.
+          * 1. close file
+          * 2. delete file
+          * 3. open new file with same mode
+          * 4. change ownership to original
+          */
+
+         if (fstat(dev->m_fd, &st) != 0) {
             berrno be;
-            dev_errno = errno;
-            Mmsg2(errmsg, _("Could not reopen: %s, ERR=%s\n"), archive_name.c_str(),
-                  be.bstrerror());
-            Dmsg1(40, "reopen failed: %s", errmsg);
-            Emsg0(M_FATAL, 0, errmsg);
+            Mmsg2(errmsg, _("Unable to stat device %s. ERR=%s\n"),
+                  print_name(), be.bstrerror());
             return false;
          }
 
-         /* Reset proper owner */
-         chown(archive_name.c_str(), st.st_uid, st.st_gid);
+         if (st.st_size != 0) {             /* ftruncate() didn't work */
+            POOL_MEM archive_name(PM_FNAME);
+
+            pm_strcpy(archive_name, dev_name);
+            if (!IsPathSeparator(archive_name.c_str()[strlen(archive_name.c_str())-1])) {
+               pm_strcat(archive_name, "/");
+            }
+            pm_strcat(archive_name, dcr->VolumeName);
+
+            Mmsg2(errmsg, _("Device %s doesn't support ftruncate(). Recreating file %s.\n"),
+                  print_name(), archive_name.c_str());
+
+            /* Close file and blow it away */
+            ::close(dev->m_fd);
+            ::unlink(archive_name.c_str());
+
+            /* Recreate the file -- of course, empty */
+            dev->set_mode(CREATE_READ_WRITE);
+            if ((dev->m_fd = ::open(archive_name.c_str(), mode, st.st_mode)) < 0) {
+               berrno be;
+               dev_errno = errno;
+               Mmsg2(errmsg, _("Could not reopen: %s, ERR=%s\n"), archive_name.c_str(),
+                     be.bstrerror());
+               Dmsg1(40, "reopen failed: %s", errmsg);
+               Emsg0(M_FATAL, 0, errmsg);
+               return false;
+            }
+
+            /* Reset proper owner */
+            chown(archive_name.c_str(), st.st_uid, st.st_gid);
+         }
+         break;
       }
       return true;
    }
@@ -263,7 +284,7 @@ bool DEVICE::truncate(DCR *dcr) /* We need the DCR for DVD-writing */
 /*
  * (Un)mount the device (either a FILE or DVD device)
  */
-bool DEVICE::do_file_mount(int mount, int dotimeout)
+bool DEVICE::mount_file(int mount, int dotimeout)
 {
    POOL_MEM ocmd(PM_FNAME);
    POOLMEM *results;
@@ -283,7 +304,7 @@ bool DEVICE::do_file_mount(int mount, int dotimeout)
    clear_freespace_ok();
    edit_mount_codes(ocmd, icmd);
 
-   Dmsg2(100, "do_file_mount: cmd=%s mounted=%d\n", ocmd.c_str(), !!is_mounted());
+   Dmsg2(100, "mount_file: cmd=%s mounted=%d\n", ocmd.c_str(), !!is_mounted());
 
    if (dotimeout) {
       /* Try at most 10 times to (un)mount the device. This should perhaps be configurable. */
@@ -294,7 +315,7 @@ bool DEVICE::do_file_mount(int mount, int dotimeout)
    results = get_memory(4000);
 
    /* If busy retry each second */
-   Dmsg1(100, "do_file_mount run_prog=%s\n", ocmd.c_str());
+   Dmsg1(100, "mount_file run_prog=%s\n", ocmd.c_str());
    while ((status = run_program_full_output(ocmd.c_str(), max_open_wait/2, results)) != 0) {
       /* Doesn't work with internationalization (This is not a problem) */
       if (mount && fnmatch("*is already mounted on*", results, 0) == 0) {
@@ -308,7 +329,7 @@ bool DEVICE::do_file_mount(int mount, int dotimeout)
           * Try to unmount it, then remount it */
          if (mount) {
             Dmsg1(400, "Trying to unmount the device %s...\n", print_name());
-            do_file_mount(0, 0);
+            mount_file(0, 0);
          }
          bmicrosleep(1, 0);
          continue;
@@ -329,7 +350,7 @@ bool DEVICE::do_file_mount(int mount, int dotimeout)
       if (!(dp = opendir(device->mount_point))) {
          berrno be;
          dev_errno = errno;
-         Dmsg3(100, "do_file_mount: failed to open dir %s (dev=%s), ERR=%s\n",
+         Dmsg3(100, "mount_file: failed to open dir %s (dev=%s), ERR=%s\n",
                device->mount_point, print_name(), be.bstrerror());
          goto get_out;
       }
@@ -339,7 +360,7 @@ bool DEVICE::do_file_mount(int mount, int dotimeout)
       while (1) {
          if ((readdir_r(dp, entry, &result) != 0) || (result == NULL)) {
             dev_errno = EIO;
-            Dmsg2(129, "do_file_mount: failed to find suitable file in dir %s (dev=%s)\n",
+            Dmsg2(129, "mount_file: failed to find suitable file in dir %s (dev=%s)\n",
                   device->mount_point, print_name());
             break;
          }
@@ -347,13 +368,13 @@ bool DEVICE::do_file_mount(int mount, int dotimeout)
             count++; /* result->d_name != ., .. or .keep (Gentoo-specific) */
             break;
          } else {
-            Dmsg2(129, "do_file_mount: ignoring %s in %s\n", result->d_name, device->mount_point);
+            Dmsg2(129, "mount_file: ignoring %s in %s\n", result->d_name, device->mount_point);
          }
       }
       free(entry);
       closedir(dp);
 
-      Dmsg1(100, "do_file_mount: got %d files in the mount point (not counting ., .. and .keep)\n", count);
+      Dmsg1(100, "mount_file: got %d files in the mount point (not counting ., .. and .keep)\n", count);
 
       if (count > 0) {
          /* If we got more than ., .. and .keep */
@@ -379,6 +400,7 @@ get_out:
 
    set_mounted(mount);              /* set/clear mounted flag */
    free_pool_memory(results);
+   /* Do not check free space when unmounting */
    Dmsg1(200, "============ mount=%d\n", mount);
    return true;
 }
diff --git a/src/stored/file_dev.h b/src/stored/file_dev.h
index eef61b2..6dcbaee 100644
--- a/src/stored/file_dev.h
+++ b/src/stored/file_dev.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2014-2014 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Inspired by vtape.h
@@ -25,6 +29,7 @@ public:
 
    file_dev() { };
    ~file_dev() { m_fd = -1; };
+// bool mount_file(int mount, int dotimeout);
 };
 
 #endif /* __FILE_DEV_ */
diff --git a/src/stored/hello.c b/src/stored/hello.c
new file mode 100644
index 0000000..f0f3f03
--- /dev/null
+++ b/src/stored/hello.c
@@ -0,0 +1,319 @@
+/*
+   Bacula(R) - The Network Backup Solution
+
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
+
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
+
+   You may use this file and others of this release according to the
+   license defined in the LICENSE file, which includes the Affero General
+   Public License, v3.0 ("AGPLv3") and some additional permissions and
+   terms pursuant to its AGPLv3 Section 7.
+
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
+/*
+ * Hello routines for Storage daemon.
+ *
+ * This file contains all the code relating to reading and writing of
+ *  all Hello commands between the daemons.
+ *
+ *   Written by Kern Sibbald, June 2014
+ *
+ */
+
+
+#include "bacula.h"
+#include "stored.h"
+
+extern STORES *me;               /* our Global resource */
+
+const int dbglvl = 50;
+
+/*
+ * SD_VERSION history
+ *     None prior to 06Aug13
+ *      1         - Skipped
+ *      2         - Skipped
+ *      3 22Feb14 - Added SD->SD with SD_Calls_Client
+ *      4         - Skipped
+ *    305 04Jun15 - Added JobMedia queueing
+ */
+
+#define SD_VERSION 305     /* Community SD version */
+#define FD_VERSION 305     /* Community FD version */
+
+static char hello_sd[]  = "Hello Bacula SD: Start Job %s %d %d\n";
+
+static char Sorry[]     = "3999 No go\n";
+static char OK_hello[]  = "3000 OK Hello %d\n";
+
+/*********************************************************************
+ *
+ *  Validate hello from the Director.
+ *
+ * Returns: true  if Hello is good.
+ *          false if Hello is bad.
+ */
+bool validate_dir_hello(JCR* jcr)
+{
+   POOLMEM *dirname;
+   DIRRES *director = NULL;
+   int dir_version = 0;
+   BSOCK *dir = jcr->dir_bsock;
+
+   if (dir->msglen < 25 || dir->msglen > 500) {
+      Dmsg2(dbglvl, "Bad Hello command from Director at %s. Len=%d.\n",
+            dir->who(), dir->msglen);
+      Jmsg2(jcr, M_FATAL, 0, _("Bad Hello command from Director at %s. Len=%d.\n"),
+            dir->who(), dir->msglen);
+      return false;
+   }
+   dirname = get_pool_memory(PM_MESSAGE);
+   dirname = check_pool_memory_size(dirname, dir->msglen);
+
+   if (sscanf(dir->msg, "Hello SD: Bacula Director %127s calling %d",
+          dirname, &dir_version) != 2 &&
+       sscanf(dir->msg, "Hello SD: Bacula Director %127s calling",
+          dirname) != 1) {
+      dir->msg[100] = 0;
+      Dmsg2(dbglvl, "Bad Hello command from Director at %s: %s\n",
+            dir->who(), dir->msg);
+      Jmsg2(jcr, M_FATAL, 0, _("Bad Hello command from Director at %s: %s\n"),
+            dir->who(), dir->msg);
+      free_pool_memory(dirname);
+      return false;
+   }
+
+   director = NULL;
+   unbash_spaces(dirname);
+   foreach_res(director, R_DIRECTOR) {
+      if (strcasecmp(director->hdr.name, dirname) == 0) {
+         break;
+      }
+   }
+   if (!director) {
+      Dmsg2(dbglvl, "Connection from unknown Director %s at %s rejected.\n",
+            dirname, dir->who());
+      Jmsg2(jcr, M_FATAL, 0, _("Connection from unknown Director %s at %s rejected.\n"
+            "Please see " MANUAL_AUTH_URL " for help.\n"),
+            dirname, dir->who());
+      free_pool_memory(dirname);
+      return false;
+   }
+   jcr->director = director;
+   free_pool_memory(dirname);
+   return true;
+}
+
+/*
+ * After receiving a connection (in dircmd.c) if it is
+ *   from the File daemon, this routine is called.
+ */
+void handle_client_connection(BSOCK *fd)
+{
+   JCR *jcr;
+   int fd_version = 0;
+   int sd_version = 0;
+   char job_name[500];
+   /*
+    * Do a sanity check on the message received
+    */
+   if (fd->msglen < 25 || fd->msglen > (int)sizeof(job_name)) {
+      Pmsg1(000, "<filed: %s", fd->msg);
+      Jmsg2(NULL, M_ERROR, 0, _("Invalid connection from %s. Len=%d\n"), fd->who(), fd->msglen);
+      bmicrosleep(5, 0);   /* make user wait 5 seconds */
+      fd->destroy();
+      return;
+   }
+
+   Dmsg1(100, "Conn: %s", fd->msg);
+   /*
+    * See if this is a File daemon connection. If so
+    *   call FD handler.
+    */
+   if (sscanf(fd->msg, "Hello Bacula SD: Start Job %127s %d %d", job_name, &fd_version, &sd_version) != 3 &&
+       sscanf(fd->msg, "Hello FD: Bacula Storage calling Start Job %127s %d", job_name, &sd_version) != 2 &&
+       sscanf(fd->msg, "Hello Start Job %127s", job_name) != 1) {
+      Jmsg2(NULL, M_ERROR, 0, _("Invalid Hello from %s. Len=%d\n"), fd->who(), fd->msglen);
+      return;
+   }
+
+   if (!(jcr=get_jcr_by_full_name(job_name))) {
+      Jmsg1(NULL, M_FATAL, 0, _("Client connect failed: Job name not found: %s\n"), job_name);
+      Dmsg1(3, "**** Job \"%s\" not found.\n", job_name);
+      fd->destroy();
+      return;
+   }
+
+   /* After this point, we can use bail_out */
+   Dmsg1(100, "Found Client Job %s\n", job_name);
+   if (jcr->authenticated) {
+      Jmsg3(jcr, M_WARNING, 0, _("A Client \"%s\" tried to authenticate for Job %s, "
+                                 "but the Job is already authenticated with \"%s\".\n"),
+            fd->who(), jcr->Job, jcr->file_bsock?jcr->file_bsock->who():"N/A");
+      Dmsg2(050, "Hey!!!! JobId %u Job %s already authenticated.\n",
+         (uint32_t)jcr->JobId, jcr->Job);
+      goto bail_out;
+   }
+
+   fd->set_jcr(jcr);
+   Dmsg2(050, "fd_version=%d sd_version=%d\n", fd_version, sd_version);
+
+   /*
+    * Authenticate the Client (FD or SD)
+    */
+   jcr->lock_auth();     /* Ensure that only one thread is dealing with auth */
+   if (jcr->authenticated) {
+      Jmsg2(jcr, M_WARNING, 0, _("A Client \"%s\" tried to authenticate for Job %s, "
+                                 "but the job is already authenticated.\n"),
+            fd->who(), jcr->Job);
+
+   } else if (!authenticate_filed(jcr, fd, fd_version)) {
+      Dmsg1(50, "Authentication failed Job %s\n", jcr->Job);
+      /* Job not yet started, we can cancel */
+      Jmsg(jcr, M_FATAL, 0, _("Unable to authenticate File daemon\n"));
+
+   } else {
+      Dmsg2(050, "OK Authentication jid=%u Job %s\n", (uint32_t)jcr->JobId, jcr->Job);
+      jcr->file_bsock = fd;
+      jcr->FDVersion = fd_version;
+      jcr->SDVersion = sd_version;
+      jcr->authenticated = true;
+
+      if (sd_version > 0) {
+         jcr->sd_client = true;
+      }
+   }
+   jcr->unlock_auth();
+
+   if (!jcr->authenticated) {
+      jcr->setJobStatus(JS_ErrorTerminated);
+   }
+
+   Dmsg4(050, "=== Auth %s, unblock Job %s jid=%d sd_ver=%d\n",
+         jcr->authenticated?"OK":"KO", job_name, jcr->JobId, sd_version);
+
+bail_out:
+   /* file_bsock might be NULL or a previous BSOCK */
+   if (jcr->file_bsock != fd) {
+      free_bsock(fd);
+   }
+   pthread_cond_signal(&jcr->job_start_wait); /* wake waiting job */
+   free_jcr(jcr);
+   return;
+}
+
+
+bool is_client_connection(BSOCK *bs)
+{
+   return
+      sscanf(bs->msg, "Hello Bacula SD: Start Job ") == 0 ||
+      sscanf(bs->msg, "Hello FD: Bacula Storage calling Start Job ") == 0 ||
+      sscanf(bs->msg, "Hello Start Job ") == 0;
+}
+
+/*
+ * If sd_calls_client, we must read the client's response to
+ *   the hello we previously sent.
+ */
+bool read_client_hello(JCR *jcr)
+{
+   int i;
+   int stat;
+   int fd_version = 0;
+   int sd_version = 0;
+   BSOCK *cl = jcr->file_bsock;
+   char job_name[500];
+
+   /* We connected to Client, so finish work */
+   if (!cl) {
+      Jmsg0(jcr, M_FATAL, 0, _("Client socket not open. Could not connect to Client.\n"));
+      Dmsg0(050, "Client socket not open. Could not connect to Client.\n");
+      return false;
+   }
+   /* Get response to Hello command sent earlier */
+   Dmsg0(050, "Read Hello command from Client\n");
+   for (i=0; i<60; i++) {
+      stat = cl->recv();
+      if (stat <= 0) {
+         bmicrosleep(1, 0);
+      } else {
+         break;
+      }
+   }
+   if (stat <= 0) {
+      berrno be;
+      Jmsg1(jcr, M_FATAL, 0, _("Recv request to Client failed. ERR=%s\n"),
+         be.bstrerror());
+      Dmsg1(050, _("Recv request to Client failed. ERR=%s\n"), be.bstrerror());
+      return false;
+   }
+   Dmsg1(050, ">filed: %s\n", cl->msg);
+   if (sscanf(cl->msg, "Hello Bacula SD: Start Job %127s %d %d", job_name, &fd_version, &sd_version) != 3) {
+      Jmsg1(jcr, M_FATAL, 0, _("Bad Hello from Client: %s.\n"), cl->msg);
+      Dmsg1(050, _("Bad Hello from Client: %s.\n"), cl->msg);
+      return false;
+   }
+   unbash_spaces(job_name);
+   jcr->FDVersion = fd_version;
+   jcr->SDVersion = sd_version;
+   Dmsg1(050, "FDVersion=%d\n", fd_version);
+
+   return true;
+}
+
+/*
+ * Send Hello OK to DIR or FD
+ */
+bool send_hello_ok(BSOCK *bs)
+{
+   return bs->fsend(OK_hello, SD_VERSION);
+}
+
+bool send_sorry(BSOCK *bs)
+{
+   return bs->fsend(Sorry);
+}
+
+/*
+ * We are acting as a client, so send Hello to the SD.
+ */
+bool send_hello_sd(JCR *jcr, char *Job)
+{
+   bool rtn;
+   BSOCK *sd = jcr->store_bsock;
+
+   bash_spaces(Job);
+   rtn = sd->fsend(hello_sd, Job, FD_VERSION, SD_VERSION);
+   unbash_spaces(Job);
+   Dmsg1(100, "Send to SD: %s\n", sd->msg);
+   if (!rtn) {
+      return false;
+   }
+
+   return true;
+}
+
+/*
+ * We are SD so send Hello to client
+ *  Note: later the Client will send us a Hello.
+ */
+bool send_hello_client(JCR *jcr, char *Job)
+{
+   bool rtn;
+   BSOCK *cl = jcr->file_bsock;
+
+   bash_spaces(Job);
+   rtn = cl->fsend("Hello FD: Bacula Storage calling Start Job %s %d\n", Job, SD_VERSION);
+   unbash_spaces(Job);
+   if (!rtn) {
+      return false;
+   }
+   return rtn;
+}
diff --git a/src/stored/job.c b/src/stored/job.c
index 82546db..168c75b 100644
--- a/src/stored/job.c
+++ b/src/stored/job.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *   Job control and execution for Storage Daemon
@@ -63,7 +67,8 @@ bool job_cmd(JCR *jcr)
    BSOCK *dir = jcr->dir_bsock;
    POOL_MEM job_name, client_name, job, fileset_name, fileset_md5;
    int32_t JobType, level, spool_attributes, no_attributes, spool_data;
-   int32_t write_part_after_job, PreferMountedVols, rerunning;
+   int32_t write_part_after_job, PreferMountedVols;
+   int32_t rerunning;
    int32_t is_client;
    int stat;
    JCR *ojcr;
@@ -87,7 +92,7 @@ bool job_cmd(JCR *jcr)
       jcr->setJobStatus(JS_ErrorTerminated);
       return false;
    }
-   jcr->rerunning = (rerunning) ? true : false;
+   jcr->rerunning = rerunning;
    jcr->sd_client = is_client;
    if (is_client) {
       jcr->sd_auth_key = bstrdup(sd_auth_key);
@@ -108,6 +113,11 @@ bool job_cmd(JCR *jcr)
    Dmsg2(800, "Start JobId=%d %p\n", JobId, jcr);
    set_jcr_in_tsd(jcr);
 
+   /*
+    * If job rescheduled because previous was incomplete,
+    * the Resched flag is set and VolSessionId and VolSessionTime
+    * are given to us (same as restarted job).
+    */
    if (!jcr->rerunning) {
       jcr->VolSessionId = newVolSessionId();
       jcr->VolSessionTime = VolSessionTime;
@@ -164,12 +174,6 @@ bool run_cmd(JCR *jcr)
    struct timezone tz;
    struct timespec timeout;
    int errstat = 0;
-   BSOCK *cl;
-   int fd_version = 0;
-   int sd_version = 0;
-   char job_name[500];
-   int i;
-   int stat;
 
    Dsm_check(200);
    Dmsg1(200, "Run_cmd: %s\n", jcr->dir_bsock->msg);
@@ -184,46 +188,14 @@ bool run_cmd(JCR *jcr)
 
    Dmsg2(050, "sd_calls_client=%d sd_client=%d\n", jcr->sd_calls_client, jcr->sd_client);
    if (jcr->sd_calls_client) {
-      /* We connected to Client, so finish work */
-      cl = jcr->file_bsock;
-      if (!cl) {
-         Jmsg0(jcr, M_FATAL, 0, _("Client socket not open. Could not connect to Client.\n"));
-         Dmsg0(050, "Client socket not open. Could not connect to Client.\n");
-         return false;
-      }
-      /* Get response to Hello command sent earlier */
-      Dmsg0(050, "Read Hello command from Client\n");
-      for (i=0; i<60; i++) {
-         stat = cl->recv();
-         if (stat <= 0) {
-            bmicrosleep(1, 0);
-         } else {
-            break;
-         }
-      }
-      if (stat <= 0) {
-         berrno be;
-         Jmsg1(jcr, M_FATAL, 0, _("Recv request to Client failed. ERR=%s\n"),
-            be.bstrerror());
-         Dmsg1(050, _("Recv request to Client failed. ERR=%s\n"), be.bstrerror());
+      if (!read_client_hello(jcr)) {
          return false;
       }
-      Dmsg1(050, "Got from FD: %s\n", cl->msg);
-      if (sscanf(cl->msg, "Hello Bacula SD: Start Job %127s %d %d", job_name, &fd_version, &sd_version) != 3) {
-         Jmsg1(jcr, M_FATAL, 0, _("Bad Hello from Client: %s.\n"), cl->msg);
-         Dmsg1(050, _("Bad Hello from Client: %s.\n"), cl->msg);
-         return false;
-      }
-      unbash_spaces(job_name);
-      jcr->FDVersion = fd_version;
-      jcr->SDVersion = sd_version;
-      Dmsg1(050, "FDVersion=%d\n", fd_version);
-
       /*
        * Authenticate the File daemon
        */
       Dmsg0(050, "=== Authenticate FD\n");
-      if (jcr->authenticated || !authenticate_filed(jcr)) {
+      if (jcr->authenticated || !authenticate_filed(jcr, jcr->file_bsock, jcr->FDVersion)) {
          Dmsg1(050, "Authentication failed Job %s\n", jcr->Job);
          Jmsg(jcr, M_FATAL, 0, _("Unable to authenticate File daemon\n"));
       } else {
@@ -269,63 +241,6 @@ bool run_cmd(JCR *jcr)
    return false;
 }
 
-/*
- * After receiving a connection (in dircmd.c) if it is
- *   from the File daemon, this routine is called.
- */
-void handle_filed_connection(BSOCK *fd, char *job_name, int fd_version,
-        int sd_version)
-{
-   JCR *jcr;
-
-   if (!(jcr=get_jcr_by_full_name(job_name))) {
-      Jmsg1(NULL, M_FATAL, 0, _("FD connect failed: Job name not found: %s\n"), job_name);
-      Dmsg1(3, "**** Job \"%s\" not found.\n", job_name);
-      fd->destroy();
-      return;
-   }
-
-   Dmsg1(100, "Found Filed Job %s\n", job_name);
-
-   if (jcr->authenticated) {
-      Jmsg2(jcr, M_FATAL, 0, _("Hey!!!! JobId %u Job %s already authenticated.\n"),
-         (uint32_t)jcr->JobId, jcr->Job);
-      Dmsg2(050, "Hey!!!! JobId %u Job %s already authenticated.\n",
-         (uint32_t)jcr->JobId, jcr->Job);
-      fd->destroy();
-      free_jcr(jcr);
-      return;
-   }
-
-   jcr->file_bsock = fd;
-   jcr->file_bsock->set_jcr(jcr);
-   jcr->FDVersion = fd_version;
-   jcr->SDVersion = sd_version;
-   Dmsg2(050, "fd_version=%d sd_version=%d\n", fd_version, sd_version);
-
-   /*
-    * Authenticate the File daemon
-    */
-   if (jcr->authenticated || !authenticate_filed(jcr)) {
-      Dmsg1(50, "Authentication failed Job %s\n", jcr->Job);
-      Jmsg(jcr, M_FATAL, 0, _("Unable to authenticate File daemon\n"));
-   } else {
-      jcr->authenticated = true;
-      Dmsg2(050, "OK Authentication jid=%u Job %s\n", (uint32_t)jcr->JobId, jcr->Job);
-   }
-
-   if (!jcr->authenticated) {
-      jcr->setJobStatus(JS_ErrorTerminated);
-   }
-   Dmsg3(050, "=== Auth OK, unblock Job %s jid=%d sd_ver=%d\n", job_name, jcr->JobId, sd_version);
-   if (sd_version > 0) {
-      jcr->sd_client = true;
-   }
-   pthread_cond_signal(&jcr->job_start_wait); /* wake waiting job */
-   free_jcr(jcr);
-   return;
-}
-
 
 #ifdef needed
 /*
@@ -407,6 +322,11 @@ bool query_cmd(JCR *jcr)
 void stored_free_jcr(JCR *jcr)
 {
    Dmsg2(800, "End Job JobId=%u %p\n", jcr->JobId, jcr);
+   if (jcr->jobmedia_queue) {
+      flush_jobmedia_queue(jcr);
+      delete jcr->jobmedia_queue;
+      jcr->jobmedia_queue = NULL;
+   }
    if (jcr->dir_bsock) {
       Dmsg2(800, "Send terminate jid=%d %p\n", jcr->JobId, jcr);
       jcr->dir_bsock->signal(BNET_EOD);
diff --git a/src/stored/label.c b/src/stored/label.c
index 86155f2..cbab189 100644
--- a/src/stored/label.c
+++ b/src/stored/label.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -1107,13 +1111,74 @@ static void dump_session_label(DEV_RECORD *rec, const char *type)
    debug_level = dbl;
 }
 
-void dump_label_record(DEVICE *dev, DEV_RECORD *rec, int verbose)
+static int check_label(SESSION_LABEL *label)
+{
+   int  errors = 0;
+
+   if (label->JobId > 10000000 || label->JobId < 0) {
+      Pmsg0(-1, _("***** ERROR ****** : Found error with the JobId\n"));
+      errors++;
+   }
+
+   if (!errors) {
+      switch (label->JobLevel) {
+      case L_FULL:
+      case L_INCREMENTAL:
+      case L_DIFFERENTIAL:
+      case L_SINCE:
+      case L_VERIFY_CATALOG:
+      case L_VERIFY_INIT:
+      case L_VERIFY_VOLUME_TO_CATALOG:
+      case L_VERIFY_DISK_TO_CATALOG:
+      case L_VERIFY_DATA:
+      case L_BASE:
+      case L_NONE:
+      case L_VIRTUAL_FULL:
+         break;
+      default:
+         Pmsg0(-1, _("***** ERROR ****** : Found error with the JobLevel\n"));
+         errors++;
+      }
+   }
+   if (!errors) {
+      switch (label->JobType) {
+      case JT_BACKUP:
+            case JT_MIGRATED_JOB:
+      case JT_VERIFY:
+      case JT_RESTORE:
+      case JT_CONSOLE:
+      case JT_SYSTEM:
+      case JT_ADMIN:
+      case JT_ARCHIVE:
+      case JT_JOB_COPY:
+      case JT_COPY:
+      case JT_MIGRATE:
+      case JT_SCAN:
+               break;
+      default:
+         Pmsg0(-1, _("***** ERROR ****** : Found error with the JobType\n"));
+         errors++;
+      }
+   }
+   if (!errors) {
+      POOLMEM *err = get_pool_memory(PM_EMSG);
+      if (!is_name_valid(label->Job, &err)) {
+         Pmsg1(-1, _("***** ERROR ****** : Found error with the Job name %s\n"), err);
+         errors++;
+      }
+      free_pool_memory(err);
+   }
+   return errors;
+}
+
+int dump_label_record(DEVICE *dev, DEV_RECORD *rec, int verbose, bool check_err)
 {
    const char *type;
    int64_t dbl;
+   int errors = 0;
 
    if (rec->FileIndex == 0 && rec->VolSessionId == 0 && rec->VolSessionTime == 0) {
-      return;
+      return 0;
    }
    dbl = debug_level;
    debug_level = 1;
@@ -1147,10 +1212,9 @@ void dump_label_record(DEVICE *dev, DEV_RECORD *rec, int verbose)
          unser_volume_label(dev, rec);
          dump_volume_label(dev);
          break;
-      case SOS_LABEL:
-         dump_session_label(rec, type);
-         break;
+
       case EOS_LABEL:
+      case SOS_LABEL:
          dump_session_label(rec, type);
          break;
       case EOM_LABEL:
@@ -1178,6 +1242,9 @@ void dump_label_record(DEVICE *dev, DEV_RECORD *rec, int verbose)
             type, dev->file, dev->block_num, rec->VolSessionId, rec->VolSessionTime, label.JobId);
          Pmsg4(-1, _("   Job=%s Date=%s Level=%c Type=%c\n"),
             label.Job, dt, label.JobLevel, label.JobType);
+         if (check_err) {
+            errors += check_label(&label);
+         }
          break;
       case EOS_LABEL:
          char ed1[30], ed2[30];
@@ -1190,6 +1257,9 @@ void dump_label_record(DEVICE *dev, DEV_RECORD *rec, int verbose)
             edit_uint64_with_commas(label.JobFiles, ed1),
             edit_uint64_with_commas(label.JobBytes, ed2),
             label.JobErrors, (char)label.JobStatus);
+         if (check_err) {
+            errors += check_label(&label);
+         }
          break;
       case EOM_LABEL:
       case PRE_LABEL:
@@ -1204,4 +1274,5 @@ void dump_label_record(DEVICE *dev, DEV_RECORD *rec, int verbose)
       }
    }
    debug_level = dbl;
+   return errors;
 }
diff --git a/src/stored/lock.c b/src/stored/lock.c
index f0459e9..0fea988 100644
--- a/src/stored/lock.c
+++ b/src/stored/lock.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Collection of Bacula Storage daemon locking software
@@ -239,6 +243,7 @@ void DEVICE::dbg_rLock(const char *file, int line, bool locked)
 
 void DEVICE::rLock(bool locked)
 {
+
    if (!locked) {
       Lock();
       m_count++;
@@ -344,6 +349,12 @@ int DEVICE::init_mutex()
    return pthread_mutex_init(&m_mutex, NULL);
 }
 
+/* Mutex around the freespace command */
+int DEVICE::init_freespace_mutex()
+{
+   return pthread_mutex_init(&freespace_mutex, NULL);
+}
+
 /* Write device acquire mutex */
 int DEVICE::init_acquire_mutex()
 {
diff --git a/src/stored/lock.h b/src/stored/lock.h
index 16b47bb..2376ff7 100644
--- a/src/stored/lock.h
+++ b/src/stored/lock.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Definitions for locking and blocking functions in the SD
diff --git a/src/stored/match_bsr.c b/src/stored/match_bsr.c
index 28b08bb..208a9a3 100644
--- a/src/stored/match_bsr.c
+++ b/src/stored/match_bsr.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2002-2014 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *   Match Bootstrap Records (used for restores) against
diff --git a/src/stored/mount.c b/src/stored/mount.c
index fc92b14..0aae19a 100644
--- a/src/stored/mount.c
+++ b/src/stored/mount.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2002-2014 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2002-2015 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -111,8 +115,8 @@ mount_next_vol:
    if (job_canceled(jcr)) {
       goto bail_out;
    }
-   Dmsg3(100, "After find_a_volume. Vol=%s Slot=%d Parts=%d\n",
-         getVolCatName(), VolCatInfo.Slot, VolCatInfo.VolCatParts);
+   Dmsg3(100, "After find_a_volume. Vol=%s Slot=%d VolType=%d\n",
+         getVolCatName(), VolCatInfo.Slot, VolCatInfo.VolCatType);
 
    dev->notify_newvol_in_attached_dcrs(getVolCatName());
 
@@ -134,7 +138,11 @@ mount_next_vol:
    } else {
       autochanger = false;
       VolCatInfo.Slot = 0;
-      ask = retry >= 2;
+      if (dev->is_autochanger() && !VolCatInfo.InChanger) {
+         ask = true;      /* not in changer, do not retry */
+      } else {
+         ask = retry >= 2;
+      }
    }
    Dmsg1(100, "autoload_dev returns %d\n", autochanger);
    /*
@@ -208,11 +216,22 @@ mount_next_vol:
       if (try_autolabel(false) == try_read_vol) {
          break;                       /* created a new volume label */
       }
+
       Jmsg4(jcr, M_WARNING, 0, _("Open of %s device %s Volume \"%s\" failed: ERR=%s\n"),
             dev->print_type(), dev->print_name(), dcr->VolumeName, dev->bstrerror());
-      Dmsg0(100, "set_unload\n");
-      dev->set_unload();              /* force ask sysop */
-      ask = true;
+
+      /* If not removable, Volume is broken. This is a serious issue here. */
+      if(dev->is_file() && !dev->is_removable()) {
+         Dmsg3(40, "Volume \"%s\" not loaded on %s device %s.\n",
+               dcr->VolumeName, dev->print_type(), dev->print_name());
+         mark_volume_in_error();
+
+      } else {
+         Dmsg0(100, "set_unload\n");
+         dev->set_unload();              /* force ask sysop */
+         ask = true;
+      }
+
       Dmsg0(100, "goto mount_next_vol\n");
       goto mount_next_vol;
    }
@@ -409,19 +428,23 @@ int DCR::check_volume_label(bool &ask, bool &autochanger)
       VOLUME_CAT_INFO dcrVolCatInfo, devVolCatInfo;
       char saveVolumeName[MAX_NAME_LENGTH];
 
-      Dmsg2(150, "Vol NAME Error Have=%s, want=%s\n", dev->VolHdr.VolumeName, VolumeName);
+      Dmsg2(40, "Vol NAME Error Have=%s, want=%s\n", dev->VolHdr.VolumeName, VolumeName);
       if (dev->is_volume_to_unload()) {
          ask = true;
          goto check_next_volume;
       }
 
+#ifdef xxx
       /* If not removable, Volume is broken */
       if (!dev->is_removable()) {
-         Jmsg(jcr, M_WARNING, 0, _("Volume \"%s\" not on %s device %s.\n"),
+         Jmsg3(jcr, M_WARNING, 0, _("Volume \"%s\" not loaded on %s device %s.\n"),
+            VolumeName, dev->print_type(), dev->print_name());
+         Dmsg3(40, "Volume \"%s\" not loaded on %s device %s.\n",
             VolumeName, dev->print_type(), dev->print_name());
          mark_volume_in_error();
          goto check_next_volume;
       }
+#endif
 
       /*
        * OK, we got a different volume mounted. First save the
@@ -550,7 +573,7 @@ bool DCR::is_suitable_volume_mounted()
    bstrncpy(VolumeName, dev->VolHdr.VolumeName, sizeof(VolumeName));
    ok = dir_get_volume_info(this, GET_VOL_INFO_FOR_WRITE);
    if (!ok) {
-      Dmsg1(40, "dir_get_volume_info failed: %s\n", jcr->errmsg);
+      Dmsg1(40, "dir_get_volume_info failed: %s", jcr->errmsg);
       dev->set_wait();
    }
    return ok;
@@ -676,9 +699,9 @@ bool DCR::is_eod_valid()
 
       pos = dev->lseek(this, (boffset_t)0, SEEK_END);
       if (dev->VolCatInfo.VolCatAmetaBytes == (uint64_t)pos) {
-            Jmsg(jcr, M_INFO, 0, _("Ready to append to end of Volume \"%s\""
-                 " size=%s\n"), VolumeName,
-                 edit_uint64_with_commas(dev->VolCatInfo.VolCatAmetaBytes, ed1));
+         Jmsg(jcr, M_INFO, 0, _("Ready to append to end of Volume \"%s\""
+              " size=%s\n"), VolumeName,
+              edit_uint64_with_commas(dev->VolCatInfo.VolCatAmetaBytes, ed1));
       } else if ((uint64_t)pos >= dev->VolCatInfo.VolCatAmetaBytes) {
          if ((uint64_t)pos != dev->VolCatInfo.VolCatAmetaBytes) {
             Jmsg(jcr, M_WARNING, 0, _("For Volume \"%s\":\n"
@@ -737,7 +760,7 @@ int DCR::try_autolabel(bool opened)
       return try_default;       /* if polling, don't try to create new labels */
    }
    /* For a tape require it to be opened and read before labeling */
-   if (!opened && dev->is_tape()) {
+   if (!opened && (dev->is_tape() || dev->is_null())) {
       return try_default;
    }
    if (dev->has_cap(CAP_LABEL) && (VolCatInfo.VolCatBytes == 0 ||
@@ -776,16 +799,18 @@ int DCR::try_autolabel(bool opened)
       Jmsg(jcr, M_WARNING, 0, _("%s device %s not configured to autolabel Volumes.\n"),
          dev->print_type(), dev->print_name());
    }
+#ifdef xxx
    /* If not removable, Volume is broken */
    if (!dev->is_removable()) {
-      Jmsg(jcr, M_WARNING, 0, _("Volume \"%s\" not on %s device %s.\n"),
+      Jmsg3(jcr, M_WARNING, 0, _("Volume \"%s\" not loaded on %s device %s.\n"),
          VolumeName, dev->print_type(), dev->print_name());
-      Dmsg3(100, "Volume \"%s\" not on %s device %s.\n",
+      Dmsg3(40, "Volume \"%s\" not loaded on %s device %s.\n",
          VolumeName, dev->print_type(), dev->print_name());
 
       mark_volume_in_error();
       return try_next_vol;
    }
+#endif
    return try_default;
 }
 
@@ -924,6 +949,7 @@ bool mount_next_read_volume(DCR *dcr)
       if (!acquire_device_for_read(dcr)) {
          Jmsg3(jcr, M_FATAL, 0, _("Cannot open %s Dev=%s, Vol=%s for reading.\n"),
             dev->print_type(), dev->print_name(), dcr->VolumeName);
+         jcr->setJobStatus(JS_FatalError); /* Jmsg is not working for *SystemJob* */
          return false;
       }
       return true;                    /* next volume mounted */
diff --git a/src/stored/os.c b/src/stored/os.c
index c726f1d..9f853b8 100644
--- a/src/stored/os.c
+++ b/src/stored/os.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
diff --git a/src/stored/parse_bsr.c b/src/stored/parse_bsr.c
index 1cd2979..69f73c7 100644
--- a/src/stored/parse_bsr.c
+++ b/src/stored/parse_bsr.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2002-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *   Parse a Bootstrap Records (used for restores)
@@ -843,9 +847,11 @@ void dump_bsr(BSR *bsr, bool recurse)
 
 static void free_bsr_item(BSR *bsr)
 {
-   if (bsr) {
-      free_bsr_item(bsr->next);
+   BSR *next;
+   while (bsr) {
+      next = bsr->next;
       free(bsr);
+      bsr = next;
    }
 }
 
@@ -891,15 +897,13 @@ void remove_bsr(BSR *bsr)
 void free_bsr(BSR *bsr)
 {
    BSR *next_bsr;
-
-   if (!bsr) {
-      return;
+   while (bsr) {
+      next_bsr = bsr->next;
+      /* Remove (free) current bsr */
+      remove_bsr(bsr);
+      /* Now get the next one */
+      bsr = next_bsr;
    }
-   next_bsr = bsr->next;
-   /* Remove (free) current bsr */
-   remove_bsr(bsr);
-   /* Now get the next one */
-   free_bsr(next_bsr);
 }
 
 /*****************************************************************
diff --git a/src/stored/protos.h b/src/stored/protos.h
index a0572ac..3b7d36c 100644
--- a/src/stored/protos.h
+++ b/src/stored/protos.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Protypes for stored
@@ -46,13 +50,15 @@ bool    dir_ask_sysop_to_mount_volume(DCR *dcr, bool read_access);
 bool    dir_update_file_attributes(DCR *dcr, DEV_RECORD *rec);
 bool    dir_send_job_status(JCR *jcr);
 bool    dir_create_jobmedia_record(DCR *dcr, bool zero=false);
+void    create_jobmedia_queue(JCR *jcr);
+bool    flush_jobmedia_queue(JCR *jcr);
 bool    dir_update_device(JCR *jcr, DEVICE *dev);
 bool    dir_update_changer(JCR *jcr, AUTOCHANGER *changer);
 
 /* authenticate.c */
-int     authenticate_director(JCR *jcr);
-int     authenticate_filed(JCR *jcr);
-bool    authenticate_storagedaemon(JCR *jcr, char *Job);
+bool    authenticate_director(JCR *jcr);
+int     authenticate_filed(JCR *jcr, BSOCK *fd, int FDVersion);
+bool    authenticate_storagedaemon(JCR *jcr);
 
 /* From autochanger.c */
 bool     init_autochangers();
@@ -84,7 +90,7 @@ bool    check_for_newvol_or_newfile(DCR *dcr);
 void    setup_me();
 void    print_ls_output(const char *fname, const char *link, int type, struct stat *statp);
 JCR    *setup_jcr(const char *name, char *dev_name, BSR *bsr,
-                  const char *VolumeName, bool writing);
+                  const char *VolumeName, bool writing, bool read_dedup_data=true);
 void    display_tape_error_status(JCR *jcr, DEVICE *dev);
 
 
@@ -114,7 +120,7 @@ boffset_t   lseek_dvd(DCR *dcr, boffset_t offset, int whence);
 void    dvd_remove_empty_part(DCR *dcr);
 
 /* From device.c */
-bool     open_dev(DCR *dcr);
+bool     open_device(DCR *dcr);
 bool     first_open_device(DCR *dcr);
 bool     fixup_device_block_write_error(DCR *dcr, int retries=4);
 void     set_start_vol_position(DCR *dcr);
@@ -127,13 +133,22 @@ void     *handle_connection_request(void *arg);
 
 /* From fd_cmds.c */
 void     run_job(JCR *jcr);
+void     do_fd_commands(JCR *jcr);
+bool     do_handle_command(JCR *jcr);
 void     do_client_commands(JCR *jcr);
 
 /* From job.c */
 void     stored_free_jcr(JCR *jcr);
-void     connection_from_filed(void *arg);
-void     handle_filed_connection(BSOCK *fd, char *job_name,
-           int fdversion, int sdversion);
+
+/* From hello.c */
+bool     validate_dir_hello(JCR* jcr);
+bool     send_hello_ok(BSOCK *bs);
+bool     send_sorry(BSOCK *bs);
+bool     send_hello_sd(JCR *jcr, char *Job);
+bool     send_hello_client(JCR *jcr, char *Job);
+bool     read_client_hello(JCR *jcr);
+bool     is_client_connection(BSOCK *bs);
+void     handle_client_connection(BSOCK *fd);
 
 /* From label.c */
 int      read_dev_volume_label(DCR *dcr);
@@ -147,7 +162,7 @@ bool     write_ansi_ibm_labels(DCR *dcr, int type, const char *VolName);
 int      read_ansi_ibm_label(DCR *dcr);
 bool     write_session_label(DCR *dcr, int label);
 void     dump_volume_label(DEVICE *dev);
-void     dump_label_record(DEVICE *dev, DEV_RECORD *rec, int verbose);
+int      dump_label_record(DEVICE *dev, DEV_RECORD *rec, int verbose, bool check_err);
 bool     unser_volume_label(DEVICE *dev, DEV_RECORD *rec);
 bool     unser_session_label(SESSION_LABEL *label, DEV_RECORD *rec);
 bool     write_new_volume_label_to_dev(DCR *dcr, const char *VolName,
@@ -194,6 +209,7 @@ DEV_RECORD *new_record();
 void        free_record(DEV_RECORD *rec);
 void        empty_record(DEV_RECORD *rec);
 uint64_t    get_record_address(DEV_RECORD *rec);
+bool        flush_adata_to_device(DCR *dcr);
 
 /* From read_record.c */
 bool read_records(DCR *dcr,
diff --git a/src/stored/read.c b/src/stored/read.c
index 476b2d4..329cd59 100644
--- a/src/stored/read.c
+++ b/src/stored/read.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Read code for Storage daemon
@@ -27,7 +31,6 @@
 static bool read_record_cb(DCR *dcr, DEV_RECORD *rec);
 static bool mac_record_cb(DCR *dcr, DEV_RECORD *rec);
 
-
 /* Responses sent to the File daemon */
 static char OK_data[]    = "3000 OK data\n";
 static char FD_error[]   = "3000 error\n";
@@ -67,7 +70,11 @@ bool do_read_data(JCR *jcr)
    }
 
    /* Tell File daemon we will send data */
-   fd->fsend(OK_data);
+   if (!jcr->is_ok_data_sent) {
+      /* OK_DATA can have been already sent for copy/migrate by run_job() to avoid dead lock*/
+      fd->fsend(OK_data);
+      jcr->is_ok_data_sent = true;
+   }
 
    jcr->sendJobStatus(JS_Running);
    jcr->run_time = time(NULL);
@@ -104,11 +111,6 @@ bool do_read_data(JCR *jcr)
    return ok;
 }
 
-/*
- * Called here for reading (restore) for each record from read_records()
- *  Returns: true if OK
- *           false if error
- */
 static bool read_record_cb(DCR *dcr, DEV_RECORD *rec)
 {
    JCR *jcr = dcr->jcr;
@@ -116,25 +118,27 @@ static bool read_record_cb(DCR *dcr, DEV_RECORD *rec)
    bool ok = true;
    POOLMEM *save_msg;
    char ec1[50], ec2[50];
+   POOLMEM *wbuf = rec->data;                 /* send buffer */
+   uint32_t wsize = rec->data_len;            /* send size */
 
    if (rec->FileIndex < 0) {
       return true;
    }
+
    Dmsg5(400, "Send to FD: SessId=%u SessTim=%u FI=%s Strm=%s, len=%d\n",
       rec->VolSessionId, rec->VolSessionTime,
       FI_to_ascii(ec1, rec->FileIndex),
       stream_to_ascii(ec2, rec->Stream, rec->FileIndex),
-      rec->data_len);
+      wsize);
 
    /* Send record header to File daemon */
    if (!fd->fsend(rec_header, rec->VolSessionId, rec->VolSessionTime,
-          rec->FileIndex, rec->Stream, rec->data_len)) {
+          rec->FileIndex, rec->Stream, wsize)) {
       Pmsg1(000, _(">filed: Error Hdr=%s\n"), fd->msg);
-      Jmsg1(jcr, M_FATAL, 0, _("Error sending to File daemon. ERR=%s\n"),
+      Jmsg1(jcr, M_FATAL, 0, _("Error sending header to Client. ERR=%s\n"),
          fd->bstrerror());
       return false;
    }
-
    /*
     * For normal migration jobs, FileIndex values are sequential because
     *  we are dealing with one job.  However, for Vbackup (consolidation),
@@ -155,20 +159,32 @@ static bool read_record_cb(DCR *dcr, DEV_RECORD *rec)
       }
    }
 
-   /* Send data record to File daemon */
+   /* Debug code: check if we must hangup */
+   if (get_hangup() > 0 && (jcr->JobFiles > (uint32_t)get_hangup())) {
+      jcr->setJobStatus(JS_Incomplete);
+      Jmsg1(jcr, M_FATAL, 0, "Debug hangup requested after %d files.\n",
+         get_hangup());
+      set_hangup(0);
+      return false;
+   }
+   if (get_blowup() > 0 && (jcr->JobFiles > (uint32_t)get_blowup())) {
+      Jmsg1(jcr, M_ABORT, 0, "Debug blowup() requested after %d files.\n",
+         get_blowup());
+      return false;
+   }
+
    save_msg = fd->msg;          /* save fd message pointer */
-   fd->msg = rec->data;         /* pass data directly to the FD */
-   fd->msglen = rec->data_len;
-   jcr->JobBytes += rec->data_len;   /* increment bytes this job */
-   Dmsg1(400, ">filed: send %d bytes data.\n", fd->msglen);
+   fd->msg = wbuf;
+   fd->msglen = wsize;
+   /* Send data record to File daemon */
+   jcr->JobBytes += wsize;   /* increment bytes this job */
    if (!fd->send()) {
       Pmsg1(000, _("Error sending to FD. ERR=%s\n"), fd->bstrerror());
-      Jmsg1(jcr, M_FATAL, 0, _("Error sending to File daemon. ERR=%s\n"),
+      Jmsg1(jcr, M_FATAL, 0, _("Error sending data to Client. ERR=%s\n"),
          fd->bstrerror());
-
       ok = false;
    }
-   fd->msg = save_msg;                /* restore fd message pointer */
+   fd->msg = save_msg;
    return ok;
 }
 
@@ -187,6 +203,8 @@ static bool mac_record_cb(DCR *dcr, DEV_RECORD *rec)
    POOLMEM *save_msg;
    char ec1[50], ec2[50];
    bool ok = true;
+   POOLMEM *wbuf = rec->data;;                 /* send buffer */
+   uint32_t wsize = rec->data_len;             /* send size */
 
 #ifdef xxx
    Pmsg5(000, "on entry     JobId=%d FI=%s SessId=%d Strm=%s len=%d\n",
@@ -239,14 +257,14 @@ static bool mac_record_cb(DCR *dcr, DEV_RECORD *rec)
 
    if (new_header) {
       new_header = false;
-      Dmsg5(400, "Send header to FD: SessId=%u SessTim=%u FI=%s Strm=%s, len=%d\n",
+      Dmsg5(400, "Send header to FD: SessId=%u SessTim=%u FI=%s Strm=%s, len=%ld\n",
          rec->VolSessionId, rec->VolSessionTime,
          FI_to_ascii(ec1, rec->FileIndex),
          stream_to_ascii(ec2, rec->Stream, rec->FileIndex),
-         rec->data_len);
+         wsize);
 
       /* Send data header to File daemon */
-      if (!fd->fsend("%ld %ld %ld", rec->FileIndex, rec->Stream, rec->data_len)) {
+      if (!fd->fsend("%ld %ld %ld", rec->FileIndex, rec->Stream, wsize)) {
          Pmsg1(000, _(">filed: Error Hdr=%s\n"), fd->msg);
          Jmsg1(jcr, M_FATAL, 0, _("Error sending to File daemon. ERR=%s\n"),
             fd->bstrerror());
@@ -257,9 +275,9 @@ static bool mac_record_cb(DCR *dcr, DEV_RECORD *rec)
    Dmsg1(400, "FI=%d\n", rec->FileIndex);
    /* Send data record to File daemon */
    save_msg = fd->msg;          /* save fd message pointer */
-   fd->msg = rec->data;         /* pass data directly to the FD */
-   fd->msglen = rec->data_len;
-   jcr->JobBytes += rec->data_len;   /* increment bytes this job */
+   fd->msg = wbuf;         /* pass data directly to the FD */
+   fd->msglen = wsize;
+   jcr->JobBytes += wsize;   /* increment bytes this job */
    Dmsg1(400, ">filed: send %d bytes data.\n", fd->msglen);
    if (!fd->send()) {
       Pmsg1(000, _("Error sending to FD. ERR=%s\n"), fd->bstrerror());
diff --git a/src/stored/read_records.c b/src/stored/read_records.c
index 249437e..3987cb0 100644
--- a/src/stored/read_records.c
+++ b/src/stored/read_records.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2002-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -233,6 +237,8 @@ bool read_records(DCR *dcr,
           */
          if (jcr->bsr) {
             rec->match_stat = match_bsr(jcr->bsr, rec, &dev->VolHdr, &sessrec, jcr);
+            Dmsg2(dbglvl, "match_bsr=%d bsr->reposition=%d\n", rec->match_stat,
+               jcr->bsr->reposition);
             if (rec->match_stat == -1) { /* no more possible matches */
                done = true;   /* all items found, stop */
                Dmsg2(dbglvl, "All done=(file:block) %u:%u\n", dev->file, dev->block_num);
@@ -315,6 +321,7 @@ static bool try_repositioning(JCR *jcr, DEV_RECORD *rec, DCR *dcr)
    DEVICE *dev = dcr->dev;
 
    bsr = find_next_bsr(jcr->bsr, dev);
+   Dmsg2(dbglvl, "nextbsr=%p mount_next_volume=%d\n", bsr, jcr->bsr->mount_next_volume);
    if (bsr == NULL && jcr->bsr->mount_next_volume) {
       Dmsg0(dbglvl, "Would mount next volume here\n");
       Dmsg2(dbglvl, "Current postion (file:block) %u:%u\n",
@@ -346,6 +353,7 @@ static bool try_repositioning(JCR *jcr, DEV_RECORD *rec, DCR *dcr)
             dev->file, dev->block_num, file, block);
       dev->reposition(dcr, file, block);
       rec->Block = 0;
+      return true;
    }
    return false;
 }
diff --git a/src/stored/record.c b/src/stored/record.c
deleted file mode 100644
index d60647f..0000000
--- a/src/stored/record.c
+++ /dev/null
@@ -1,695 +0,0 @@
-/*
-   Bacula® - The Network Backup Solution
-
-   Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
-
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
-
-   You may use this file and others of this release according to the
-   license defined in the LICENSE file, which includes the Affero General
-   Public License, v3.0 ("AGPLv3") and some additional permissions and
-   terms pursuant to its AGPLv3 Section 7.
-
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
-/*
- *
- *   record.c -- Volume (tape/disk) record handling functions
- *
- *              Kern Sibbald, April MMI
- *                added BB02 format October MMII
- *
- */
-
-
-#include "bacula.h"
-#include "stored.h"
-
-/*
- * Convert a FileIndex into a printable
- *   ASCII string.  Not reentrant.
- * If the FileIndex is negative, it flags the
- *   record as a Label, otherwise it is simply
- *   the FileIndex of the current file.
- */
-const char *FI_to_ascii(char *buf, int fi)
-{
-   if (fi >= 0) {
-      sprintf(buf, "%d", fi);
-      return buf;
-   }
-   switch (fi) {
-   case PRE_LABEL:
-      return "PRE_LABEL";
-   case VOL_LABEL:
-      return "VOL_LABEL";
-   case EOM_LABEL:
-      return "EOM_LABEL";
-   case SOS_LABEL:
-      return "SOS_LABEL";
-   case EOS_LABEL:
-      return "EOS_LABEL";
-   case EOT_LABEL:
-      return "EOT_LABEL";
-      break;
-   case SOB_LABEL:
-      return "SOB_LABEL";
-      break;
-   case EOB_LABEL:
-      return "EOB_LABEL";
-      break;
-   default:
-     sprintf(buf, _("unknown: %d"), fi);
-     return buf;
-   }
-}
-
-
-/*
- * Convert a Stream ID into a printable
- * ASCII string.  Not reentrant.
-
- * A negative stream number represents
- *   stream data that is continued from a
- *   record in the previous block.
- * If the FileIndex is negative, we are
- *   dealing with a Label, hence the
- *   stream is the JobId.
- */
-const char *stream_to_ascii(char *buf, int stream, int fi)
-{
-
-   if (fi < 0) {
-      sprintf(buf, "%d", stream);
-      return buf;
-   }
-   if (stream < 0) {
-      stream = -stream;
-      stream &= STREAMMASK_TYPE;
-      /* Stream was negative => all are continuation items */
-      switch (stream) {
-      case STREAM_UNIX_ATTRIBUTES:
-         return "contUATTR";
-      case STREAM_FILE_DATA:
-         return "contDATA";
-      case STREAM_WIN32_DATA:
-         return "contWIN32-DATA";
-      case STREAM_WIN32_GZIP_DATA:
-         return "contWIN32-GZIP";
-      case STREAM_WIN32_COMPRESSED_DATA:
-         return "contWIN32-COMPRESSED";
-      case STREAM_MD5_DIGEST:
-         return "contMD5";
-      case STREAM_SHA1_DIGEST:
-         return "contSHA1";
-      case STREAM_GZIP_DATA:
-         return "contGZIP";
-      case STREAM_COMPRESSED_DATA:
-         return "contCOMPRESSED";
-      case STREAM_UNIX_ATTRIBUTES_EX:
-         return "contUNIX-ATTR-EX";
-      case STREAM_RESTORE_OBJECT:
-         return "contRESTORE-OBJECT";
-      case STREAM_SPARSE_DATA:
-         return "contSPARSE-DATA";
-      case STREAM_SPARSE_GZIP_DATA:
-         return "contSPARSE-GZIP";
-      case STREAM_SPARSE_COMPRESSED_DATA:
-         return "contSPARSE-COMPRESSED";
-      case STREAM_PROGRAM_NAMES:
-         return "contPROG-NAMES";
-      case STREAM_PROGRAM_DATA:
-         return "contPROG-DATA";
-      case STREAM_MACOS_FORK_DATA:
-         return "contMACOS-RSRC";
-      case STREAM_HFSPLUS_ATTRIBUTES:
-         return "contHFSPLUS-ATTR";
-      case STREAM_SHA256_DIGEST:
-         return "contSHA256";
-      case STREAM_SHA512_DIGEST:
-         return "contSHA512";
-      case STREAM_SIGNED_DIGEST:
-         return "contSIGNED-DIGEST";
-      case STREAM_ENCRYPTED_SESSION_DATA:
-         return "contENCRYPTED-SESSION-DATA";
-      case STREAM_ENCRYPTED_FILE_DATA:
-         return "contENCRYPTED-FILE";
-      case STREAM_ENCRYPTED_FILE_GZIP_DATA:
-         return "contENCRYPTED-GZIP";
-      case STREAM_ENCRYPTED_FILE_COMPRESSED_DATA:
-         return "contENCRYPTED-COMPRESSED";
-      case STREAM_ENCRYPTED_WIN32_DATA:
-         return "contENCRYPTED-WIN32-DATA";
-      case STREAM_ENCRYPTED_WIN32_GZIP_DATA:
-         return "contENCRYPTED-WIN32-GZIP";
-      case STREAM_ENCRYPTED_WIN32_COMPRESSED_DATA:
-         return "contENCRYPTED-WIN32-COMPRESSED";
-      case STREAM_ENCRYPTED_MACOS_FORK_DATA:
-         return "contENCRYPTED-MACOS-RSRC";
-      case STREAM_PLUGIN_NAME:
-         return "contPLUGIN-NAME";
-
-      default:
-         sprintf(buf, "%d", -stream);
-         return buf;
-      }
-   }
-
-   switch (stream & STREAMMASK_TYPE) {
-   case STREAM_UNIX_ATTRIBUTES:
-      return "UATTR";
-   case STREAM_FILE_DATA:
-      return "DATA";
-   case STREAM_WIN32_DATA:
-      return "WIN32-DATA";
-   case STREAM_WIN32_GZIP_DATA:
-      return "WIN32-GZIP";
-   case STREAM_WIN32_COMPRESSED_DATA:
-      return "WIN32-COMPRESSED";
-   case STREAM_MD5_DIGEST:
-      return "MD5";
-   case STREAM_SHA1_DIGEST:
-      return "SHA1";
-   case STREAM_GZIP_DATA:
-      return "GZIP";
-   case STREAM_COMPRESSED_DATA:
-      return "COMPRESSED";
-   case STREAM_UNIX_ATTRIBUTES_EX:
-      return "UNIX-ATTR-EX";
-   case STREAM_RESTORE_OBJECT:
-      return "RESTORE-OBJECT";
-   case STREAM_SPARSE_DATA:
-      return "SPARSE-DATA";
-   case STREAM_SPARSE_GZIP_DATA:
-      return "SPARSE-GZIP";
-   case STREAM_SPARSE_COMPRESSED_DATA:
-      return "SPARSE-COMPRESSED";
-   case STREAM_PROGRAM_NAMES:
-      return "PROG-NAMES";
-   case STREAM_PROGRAM_DATA:
-      return "PROG-DATA";
-   case STREAM_PLUGIN_NAME:
-      return "PLUGIN-NAME";
-   case STREAM_MACOS_FORK_DATA:
-      return "MACOS-RSRC";
-   case STREAM_HFSPLUS_ATTRIBUTES:
-      return "HFSPLUS-ATTR";
-   case STREAM_SHA256_DIGEST:
-      return "SHA256";
-   case STREAM_SHA512_DIGEST:
-      return "SHA512";
-   case STREAM_SIGNED_DIGEST:
-      return "SIGNED-DIGEST";
-   case STREAM_ENCRYPTED_SESSION_DATA:
-      return "ENCRYPTED-SESSION-DATA";
-   case STREAM_ENCRYPTED_FILE_DATA:
-      return "ENCRYPTED-FILE";
-   case STREAM_ENCRYPTED_FILE_GZIP_DATA:
-      return "ENCRYPTED-GZIP";
-   case STREAM_ENCRYPTED_FILE_COMPRESSED_DATA:
-      return "ENCRYPTED-COMPRESSED";
-   case STREAM_ENCRYPTED_WIN32_DATA:
-      return "ENCRYPTED-WIN32-DATA";
-   case STREAM_ENCRYPTED_WIN32_GZIP_DATA:
-      return "ENCRYPTED-WIN32-GZIP";
-   case STREAM_ENCRYPTED_WIN32_COMPRESSED_DATA:
-      return "ENCRYPTED-WIN32-COMPRESSED";
-   case STREAM_ENCRYPTED_MACOS_FORK_DATA:
-      return "ENCRYPTED-MACOS-RSRC";
-
-      default:
-         sprintf(buf, "%d", stream);
-         return buf;
-      }
-}
-
-/*
- * Return a new record entity
- */
-DEV_RECORD *new_record(void)
-{
-   DEV_RECORD *rec;
-
-   rec = (DEV_RECORD *)get_memory(sizeof(DEV_RECORD));
-   memset(rec, 0, sizeof(DEV_RECORD));
-   rec->data = get_pool_memory(PM_MESSAGE);
-   rec->state = st_none;
-   return rec;
-}
-
-void empty_record(DEV_RECORD *rec)
-{
-   rec->File = rec->Block = 0;
-   rec->VolSessionId = rec->VolSessionTime = 0;
-   rec->FileIndex = rec->Stream = 0;
-   rec->data_len = rec->remainder = 0;
-   rec->state_bits &= ~(REC_PARTIAL_RECORD|REC_BLOCK_EMPTY|REC_NO_MATCH|REC_CONTINUATION);
-   rec->state = st_none;
-}
-
-/*
- * Free the record entity
- *
- */
-void free_record(DEV_RECORD *rec)
-{
-   Dmsg0(950, "Enter free_record.\n");
-   if (rec->data) {
-      free_pool_memory(rec->data);
-   }
-   Dmsg0(950, "Data buf is freed.\n");
-   free_pool_memory((POOLMEM *)rec);
-   Dmsg0(950, "Leave free_record.\n");
-}
-
-static bool write_header_to_block(DEV_BLOCK *block, DEV_RECORD *rec)
-{
-   ser_declare;
-
-   rec->remlen = block->buf_len - block->binbuf;
-   /* Require enough room to write a full header */
-   if (rec->remlen >= WRITE_RECHDR_LENGTH) {
-      ser_begin(block->bufp, WRITE_RECHDR_LENGTH);
-      if (BLOCK_VER == 1) {
-         ser_uint32(rec->VolSessionId);
-         ser_uint32(rec->VolSessionTime);
-      } else {
-         block->VolSessionId = rec->VolSessionId;
-         block->VolSessionTime = rec->VolSessionTime;
-      }
-      ser_int32(rec->FileIndex);
-      ser_int32(rec->Stream);
-      ser_uint32(rec->data_len);
-
-      block->bufp += WRITE_RECHDR_LENGTH;
-      block->binbuf += WRITE_RECHDR_LENGTH;
-      rec->remlen -= WRITE_RECHDR_LENGTH;
-      rec->remainder = rec->data_len;
-      if (rec->FileIndex > 0) {
-         /* If data record, update what we have in this block */
-         if (block->FirstIndex == 0) {
-            block->FirstIndex = rec->FileIndex;
-         }
-         block->LastIndex = rec->FileIndex;
-      }
-   } else {
-      rec->remainder = rec->data_len + WRITE_RECHDR_LENGTH;
-      return false;
-   }
-   return true;
-}
-
-static void write_continue_header_to_block(DEV_BLOCK *block, DEV_RECORD *rec)
-{
-   ser_declare;
-
-   rec->remlen = block->buf_len - block->binbuf;
-   /*
-    * We have unwritten bytes from a previous
-    * time. Presumably we have a new buffer (possibly
-    * containing a volume label), so the new header
-    * should be able to fit in the block -- otherwise we have
-    * an error.  Note, we have to continue splitting the
-    * data record if it is longer than the block.
-    *
-    * First, write the header.
-    *
-    * Every time we write a header and it is a continuation
-    * of a previous partially written record, we store the
-    * Stream as -Stream in the record header.
-    */
-   ser_begin(block->bufp, WRITE_RECHDR_LENGTH);
-   if (BLOCK_VER == 1) {
-      ser_uint32(rec->VolSessionId);
-      ser_uint32(rec->VolSessionTime);
-   } else {
-      block->VolSessionId = rec->VolSessionId;
-      block->VolSessionTime = rec->VolSessionTime;
-   }
-   ser_int32(rec->FileIndex);
-   if (rec->remainder > rec->data_len) {
-      ser_int32(rec->Stream);      /* normal full header */
-      ser_uint32(rec->data_len);
-      rec->remainder = rec->data_len; /* must still do data record */
-   } else {
-      ser_int32(-rec->Stream);     /* mark this as a continuation record */
-      ser_uint32(rec->remainder);  /* bytes to do */
-   }
-
-   /* Require enough room to write a full header */
-   ASSERT(rec->remlen >= WRITE_RECHDR_LENGTH);
-
-   block->bufp += WRITE_RECHDR_LENGTH;
-   block->binbuf += WRITE_RECHDR_LENGTH;
-   rec->remlen -= WRITE_RECHDR_LENGTH;
-   if (rec->FileIndex > 0) {
-      /* If data record, update what we have in this block */
-      if (block->FirstIndex == 0) {
-         block->FirstIndex = rec->FileIndex;
-      }
-      block->LastIndex = rec->FileIndex;
-   }
-}
-
-static bool write_data_to_block(DEV_BLOCK *block, DEV_RECORD *rec)
-{
-   rec->remlen = block->buf_len - block->binbuf;
-   /* Write as much of data as possible */
-   if (rec->remlen >= rec->remainder) {
-      memcpy(block->bufp, rec->data+rec->data_len-rec->remainder,
-             rec->remainder);
-      block->bufp += rec->remainder;
-      block->binbuf += rec->remainder;
-   } else {
-      memcpy(block->bufp, rec->data+rec->data_len-rec->remainder,
-             rec->remlen);
-#ifdef xxxxxSMCHECK
-      if (!sm_check_rtn(__FILE__, __LINE__, False)) {
-         /* We damaged a buffer */
-         Dmsg6(0, "Damaged block FI=%s SessId=%d Strm=%s len=%d\n"
-            "rem=%d remainder=%d\n",
-            FI_to_ascii(buf1, rec->FileIndex), rec->VolSessionId,
-            stream_to_ascii(buf2, rec->Stream, rec->FileIndex), rec->data_len,
-            rec->remlen, rec->remainder);
-         Dmsg5(0, "Damaged block: bufp=%x binbuf=%d buf_len=%d rem=%d moved=%d\n",
-            block->bufp, block->binbuf, block->buf_len, block->buf_len-block->binbuf,
-            rec->remlen);
-         Dmsg2(0, "Damaged block: buf=%x binbuffrombuf=%d \n",
-            block->buf, block->bufp-block->buf);
-         Emsg0(M_ABORT, 0, _("Damaged buffer\n"));
-      }
-#endif
-
-      block->bufp += rec->remlen;
-      block->binbuf += rec->remlen;
-      rec->remainder -= rec->remlen;
-      return false;                /* did partial transfer */
-   }
-   return true;
-}
-
-/*
- * Write a Record to the block
- *
- *  Returns: false means the block could not be written to tape/disk.
- *           true  on success (all bytes written to the block).
- */
-bool DCR::write_record(DEV_RECORD *rec)
-{
-   while (!write_record_to_block(this, rec)) {
-      Dmsg2(850, "!write_record_to_block data_len=%d rem=%d\n", rec->data_len,
-                 rec->remainder);
-      if (!write_block_to_device()) {
-         Dmsg2(90, "Got write_block_to_dev error on device %s. %s\n",
-            dev->print_name(), dev->bstrerror());
-         return false;
-      }
-   }
-   return true;
-}
-
-/*
- * Write a Record to the block
- *
- *  Returns: false on failure (none or partially written)
- *           true  on success (all bytes written)
- *
- *  and remainder returned in packet.
- *
- *  We require enough room for the header, and we deal with
- *  two special cases. 1. Only part of the record may have
- *  been transferred the last time (when remainder is
- *  non-zero), and 2. The remaining bytes to write may not
- *  all fit into the block.
- */
-bool write_record_to_block(DCR *dcr, DEV_RECORD *rec)
-{
-   char buf1[100], buf2[100];
-   DEV_BLOCK *block = dcr->block;
-
-   for ( ;; ) {
-      ASSERT(block->binbuf == (uint32_t)(block->bufp - block->buf));
-      ASSERT(block->buf_len >= block->binbuf);
-
-      Dmsg6(890, "write_record_to_block() FI=%s SessId=%d Strm=%s len=%d\n"
-         "rem=%d remainder=%d\n",
-         FI_to_ascii(buf1, rec->FileIndex), rec->VolSessionId,
-         stream_to_ascii(buf2, rec->Stream, rec->FileIndex), rec->data_len,
-         rec->remlen, rec->remainder);
-
-      switch (rec->state) {
-      case st_none:
-         /* Figure out what to do */
-         rec->state = st_header;
-         continue;              /* go to next state */
-
-      case st_header:
-         /*
-          * Write header
-          *
-          * If rec->remainder is non-zero, we have been called a
-          *  second (or subsequent) time to finish writing a record
-          *  that did not previously fit into the block.
-          */
-          if (!write_header_to_block(block, rec)) {
-             return false;        /* write block then come back here */
-          }
-          rec->state = st_data;  /* after header, now write data */
-          continue;
-
-      /* Write continuation header */
-      case st_header_cont:
-         write_continue_header_to_block(block, rec);
-         rec->state = st_data;
-         if (rec->remlen == 0) {
-            return false;                   /* partial transfer */
-         }
-         continue;
-
-      /* Write normal data */
-      case st_data:
-         /*
-          * Write data
-          *
-          * Part of it may have already been transferred, and we
-          * may not have enough room to transfer the whole this time.
-          */
-         if (rec->remainder > 0) {
-            if (!write_data_to_block(block, rec)) {
-               rec->state = st_header_cont;
-               return false;
-            }
-         }
-         rec->remainder = 0;                /* did whole transfer */
-         rec->state = st_none;
-         return true;
-
-      default:
-         Dmsg0(000, "Something went wrong. Default state.\n");
-         rec->state = st_none;
-         return true;
-      }
-   }
-   return true;
-}
-
-/*
- * Test if we can write whole record to the block
- *
- *  Returns: false on failure
- *           true  on success (all bytes can be written)
- */
-bool can_write_record_to_block(DEV_BLOCK *block, DEV_RECORD *rec)
-{
-   uint32_t remlen;
-
-   remlen = block->buf_len - block->binbuf;
-   if (rec->remainder == 0) {
-      if (remlen >= WRITE_RECHDR_LENGTH) {
-         remlen -= WRITE_RECHDR_LENGTH;
-         rec->remainder = rec->data_len;
-      } else {
-         return false;
-      }
-   } else {
-      return false;
-   }
-   if (rec->remainder > 0 && remlen < rec->remainder) {
-      return false;
-   }
-   return true;
-}
-
-uint64_t get_record_address(DEV_RECORD *rec)
-{
-   return ((uint64_t)rec->File)<<32 | rec->Block;
-}
-
-/*
- * Read a Record from the block
- *  Returns: false if nothing read or if the continuation record does not match.
- *                 In both of these cases, a block read must be done.
- *           true  if at least the record header was read, this
- *                 routine may have to be called again with a new
- *                 block if the entire record was not read.
- */
-bool read_record_from_block(DCR *dcr, DEV_RECORD *rec)
-{
-   ser_declare;
-   uint32_t remlen;
-   uint32_t VolSessionId;
-   uint32_t VolSessionTime;
-   int32_t  FileIndex;
-   int32_t  Stream;
-   uint32_t data_bytes;
-   uint32_t rhl;
-   char buf1[100], buf2[100];
-
-   remlen = dcr->block->binbuf;
-
-   /* Clear state flags */
-   rec->state_bits = 0;
-   if (dcr->block->dev->is_tape()) {
-      rec->state_bits |= REC_ISTAPE;
-   }
-   rec->Block = ((DEVICE *)(dcr->block->dev))->EndBlock;
-   rec->File = ((DEVICE *)(dcr->block->dev))->EndFile;
-
-   /*
-    * Get the header. There is always a full header,
-    * otherwise we find it in the next block.
-    */
-   Dmsg3(450, "Block=%d Ver=%d size=%u\n", dcr->block->BlockNumber, dcr->block->BlockVer,
-         dcr->block->block_len);
-   if (dcr->block->BlockVer == 1) {
-      rhl = RECHDR1_LENGTH;
-   } else {
-      rhl = RECHDR2_LENGTH;
-   }
-   if (remlen >= rhl) {
-      Dmsg4(450, "Enter read_record_block: remlen=%d data_len=%d rem=%d blkver=%d\n",
-            remlen, rec->data_len, rec->remainder, dcr->block->BlockVer);
-
-      unser_begin(dcr->block->bufp, WRITE_RECHDR_LENGTH);
-      if (dcr->block->BlockVer == 1) {
-         unser_uint32(VolSessionId);
-         unser_uint32(VolSessionTime);
-      } else {
-         VolSessionId = dcr->block->VolSessionId;
-         VolSessionTime = dcr->block->VolSessionTime;
-      }
-      unser_int32(FileIndex);
-      unser_int32(Stream);
-      unser_uint32(data_bytes);
-
-      dcr->block->bufp += rhl;
-      dcr->block->binbuf -= rhl;
-      remlen -= rhl;
-
-      /* If we are looking for more (remainder!=0), we reject anything
-       *  where the VolSessionId and VolSessionTime don't agree
-       */
-      if (rec->remainder && (rec->VolSessionId != VolSessionId ||
-                             rec->VolSessionTime != VolSessionTime)) {
-         rec->state_bits |= REC_NO_MATCH;
-         Dmsg0(450, "remainder and VolSession doesn't match\n");
-         return false;             /* This is from some other Session */
-      }
-
-      /* if Stream is negative, it means that this is a continuation
-       * of a previous partially written record.
-       */
-      if (Stream < 0) {               /* continuation record? */
-         Dmsg1(500, "Got negative Stream => continuation. remainder=%d\n",
-            rec->remainder);
-         rec->state_bits |= REC_CONTINUATION;
-         if (!rec->remainder) {       /* if we didn't read previously */
-            rec->data_len = 0;        /* return data as if no continuation */
-         } else if (rec->Stream != -Stream) {
-            rec->state_bits |= REC_NO_MATCH;
-            return false;             /* This is from some other Session */
-         }
-         rec->Stream = -Stream;       /* set correct Stream */
-         rec->maskedStream = rec->Stream & STREAMMASK_TYPE;
-      } else {                        /* Regular record */
-         rec->Stream = Stream;
-         rec->maskedStream = rec->Stream & STREAMMASK_TYPE;
-         rec->data_len = 0;           /* transfer to beginning of data */
-      }
-      rec->VolSessionId = VolSessionId;
-      rec->VolSessionTime = VolSessionTime;
-      rec->FileIndex = FileIndex;
-      if (FileIndex > 0) {
-         if (dcr->block->FirstIndex == 0) {
-            dcr->block->FirstIndex = FileIndex;
-         }
-         dcr->block->LastIndex = FileIndex;
-      }
-
-      Dmsg6(450, "rd_rec_blk() got FI=%s SessId=%d Strm=%s len=%u\n"
-                 "remlen=%d data_len=%d\n",
-         FI_to_ascii(buf1, rec->FileIndex), rec->VolSessionId,
-         stream_to_ascii(buf2, rec->Stream, rec->FileIndex), data_bytes, remlen,
-         rec->data_len);
-   } else {
-      /*
-       * No more records in this block because the number
-       * of remaining bytes are less than a record header
-       * length, so return empty handed, but indicate that
-       * he must read again. By returning, we allow the
-       * higher level routine to fetch the next block and
-       * then reread.
-       */
-      Dmsg0(450, "read_record_block: nothing\n");
-      rec->state_bits |= (REC_NO_HEADER | REC_BLOCK_EMPTY);
-      empty_block(dcr->block);                 /* mark block empty */
-      return false;
-   }
-
-   /* Sanity check */
-   if (data_bytes >= MAX_BLOCK_LENGTH) {
-      /*
-       * Something is wrong, force read of next block, abort
-       *   continuing with this block.
-       */
-      rec->state_bits |= (REC_NO_HEADER | REC_BLOCK_EMPTY);
-      empty_block(dcr->block);
-      Jmsg2(dcr->jcr, M_WARNING, 0, _("Sanity check failed. maxlen=%d datalen=%d. Block discarded.\n"),
-         MAX_BLOCK_LENGTH, data_bytes);
-      return false;
-   }
-
-   rec->data = check_pool_memory_size(rec->data, rec->data_len+data_bytes);
-
-   /*
-    * At this point, we have read the header, now we
-    * must transfer as much of the data record as
-    * possible taking into account: 1. A partial
-    * data record may have previously been transferred,
-    * 2. The current block may not contain the whole data
-    * record.
-    */
-   if (remlen >= data_bytes) {
-      /* Got whole record */
-      memcpy(rec->data+rec->data_len, dcr->block->bufp, data_bytes);
-      dcr->block->bufp += data_bytes;
-      dcr->block->binbuf -= data_bytes;
-      rec->data_len += data_bytes;
-   } else {
-      /* Partial record */
-      memcpy(rec->data+rec->data_len, dcr->block->bufp, remlen);
-      dcr->block->bufp += remlen;
-      dcr->block->binbuf -= remlen;
-      rec->data_len += remlen;
-      rec->remainder = 1;             /* partial record transferred */
-      Dmsg1(450, "read_record_block: partial xfered=%d\n", rec->data_len);
-      rec->state_bits |= (REC_PARTIAL_RECORD | REC_BLOCK_EMPTY);
-      return true;
-   }
-   rec->remainder = 0;
-   Dmsg4(450, "Rtn full rd_rec_blk FI=%s SessId=%d Strm=%s len=%d\n",
-      FI_to_ascii(buf1, rec->FileIndex), rec->VolSessionId,
-      stream_to_ascii(buf2, rec->Stream, rec->FileIndex), rec->data_len);
-   return true;                       /* transferred full record */
-}
diff --git a/src/stored/record.h b/src/stored/record.h
index c8f5273..16fb0f6 100644
--- a/src/stored/record.h
+++ b/src/stored/record.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Record, and label definitions for Bacula
diff --git a/src/stored/record_read.c b/src/stored/record_read.c
index d92fd0e..5e001ce 100644
--- a/src/stored/record_read.c
+++ b/src/stored/record_read.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -19,6 +23,7 @@
  *
  *            Kern Sibbald, April MMI
  *              added BB02 format October MMII
+ *
  */
 
 
@@ -27,9 +32,8 @@
 
 /* Imported subroutines */
 
-
 static const int read_dbglvl = 200;
-static const int dbgep = 250;         /* debug execution path */
+static const int dbgep = 200;         /* debug execution path */
 
 /*
  * Read the header record
@@ -232,9 +236,10 @@ bool read_record_from_block(DCR *dcr,  DEV_RECORD *rec)
    for ( ;; ) {
       switch (rec->rstate) {
       case st_none:
-         dump_block(dcr->block, "st_none");
+         dump_block(dcr->ameta_block, "st_none");
       case st_header:
          Dmsg0(dbgep, "=== rpath 33 st_header\n");
+         dcr->set_ameta();
          rec->remlen = dcr->block->binbuf;
          /* Note read_header sets rec->rstate on return true */
          if (!read_header(dcr, dcr->block, rec)) {  /* sets state */
diff --git a/src/stored/record_util.c b/src/stored/record_util.c
index acac864..e708193 100644
--- a/src/stored/record_util.c
+++ b/src/stored/record_util.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
diff --git a/src/stored/record_write.c b/src/stored/record_write.c
index e078e7f..45799bc 100644
--- a/src/stored/record_write.c
+++ b/src/stored/record_write.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 20xx-2014 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -19,7 +23,6 @@
  *
  *            Kern Sibbald, April MMI
  *              added BB02 format October MMII
- *              added aligned format November MMXII
  *
  */
 
diff --git a/src/stored/reserve.c b/src/stored/reserve.c
index 30719a7..cad831a 100644
--- a/src/stored/reserve.c
+++ b/src/stored/reserve.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *   Drive reservation functions for Storage Daemon
@@ -445,7 +449,8 @@ bool find_suitable_device_for_job(JCR *jcr, RCTX &rctx)
                }
                if (vol->dev->is_autochanger()) {
                   Dmsg1(dbglvl, "vol=%s is in changer\n", vol->vol_name);
-                  if (!is_vol_in_autochanger(rctx, vol) || !vol->dev->autoselect) {
+                  if (!is_vol_in_autochanger(rctx, vol) || !vol->dev->autoselect ||
+                     !vol->dev->enabled) {
                      continue;
                   }
                } else if (strcmp(device_name, vol->dev->device->hdr.name) != 0) {
@@ -648,6 +653,11 @@ static int reserve_device(RCTX &rctx)
               rctx.device_name);
       }
       return -1;  /* no use waiting */
+   } else if (!rctx.device->dev->enabled) {
+      Jmsg(rctx.jcr, M_WARNING, 0, _("\n"
+           "     Device \"%s\" requested by DIR is disabled.\n"),
+              rctx.device_name);
+      return -1;  /* no use waiting */
    }
 
    rctx.suitable_device = true;
diff --git a/src/stored/reserve.h b/src/stored/reserve.h
index 20f7e74..cb51f80 100644
--- a/src/stored/reserve.h
+++ b/src/stored/reserve.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2006-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Definitions for reservation system.
diff --git a/src/stored/scan.c b/src/stored/scan.c
index c2dba1d..e4290b2 100644
--- a/src/stored/scan.c
+++ b/src/stored/scan.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2006-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
diff --git a/src/stored/sd_plugins.c b/src/stored/sd_plugins.c
index 968a69b..58bedc5 100644
--- a/src/stored/sd_plugins.c
+++ b/src/stored/sd_plugins.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Main program to test loading and running Bacula plugins.
@@ -29,7 +33,6 @@ const char *plugin_type = "-sd.so";
 
 /* Forward referenced functions */
 static bRC baculaGetValue(bpContext *ctx, bsdrVariable var, void *value);
-static bRC baculaGetGlobal(bsdrGlobalVariable var, void *value);
 static bRC baculaSetValue(bpContext *ctx, bsdwVariable var, void *value);
 static bRC baculaRegisterEvents(bpContext *ctx, ...);
 static bRC baculaJobMsg(bpContext *ctx, const char *file, int line,
@@ -57,7 +60,6 @@ static bsdFuncs bfuncs = {
    baculaJobMsg,
    baculaDebugMsg,
    baculaEditDeviceCodes,
-   baculaGetGlobal
 };
 
 /*
@@ -94,11 +96,11 @@ int generate_plugin_event(JCR *jcr, bsdEventType eventType, void *value)
    bpContext *plugin_ctx;
    bsdEvent event;
    Plugin *plugin;
-   int i;
+   int i = 0;
    bRC rc = bRC_OK;
 
-   if (!bplugin_list) {
-      Dmsg0(dbglvl, "No bplugin_list: generate_plugin_event ignored.\n");
+   if (!b_plugin_list) {
+      Dmsg0(dbglvl, "No b_plugin_list: generate_plugin_event ignored.\n");
       return bRC_OK;
    }
    if (!jcr) {
@@ -106,8 +108,8 @@ int generate_plugin_event(JCR *jcr, bsdEventType eventType, void *value)
       return bRC_OK;
    }
    if (!jcr->plugin_ctx_list) {
-      Dmsg0(dbglvl, "No plugin_ctx_list: generate_plugin_event ignored.\n");
-      return bRC_OK;                  /* Return if no plugins loaded */
+       Dmsg0(dbglvl, "No plugin_ctx_list: generate_plugin_event ignored.\n");
+       return bRC_OK;                  /* Return if no plugins loaded */
    }
 
    /* Always handle JobEnd and DeviceClose requests */
@@ -127,7 +129,7 @@ int generate_plugin_event(JCR *jcr, bsdEventType eventType, void *value)
 
    Dmsg2(dbglvl, "sd-plugin_ctx_list=%p JobId=%d\n", jcr->plugin_ctx_list, jcr->JobId);
 
-   foreach_alist_index(i, plugin, bplugin_list) {
+   foreach_alist_index(i, plugin, b_plugin_list) {
       plugin_ctx = &plugin_ctx_list[i];
       if (is_plugin_disabled(plugin_ctx)) {
          continue;
@@ -151,13 +153,13 @@ int generate_global_plugin_event(bsdGlobalEventType eventType, void *value)
    int i;
    bRC rc = bRC_OK;
 
-   if (!bplugin_list) {
-      Dmsg0(dbglvl, "No bplugin_list: generate_global_plugin_event ignored.\n");
+   if (!b_plugin_list) {
+      Dmsg0(dbglvl, "No b_plugin_list: generate_global_plugin_event ignored.\n");
       return bRC_OK;
    }
    event.eventType = eventType;
 
-   foreach_alist_index(i, plugin, bplugin_list) {
+   foreach_alist_index(i, plugin, b_plugin_list) {
       if (sdplug_func(plugin)->handleGlobalPluginEvent != NULL) {
          rc = sdplug_func(plugin)->handleGlobalPluginEvent(&event, value);
          if (rc != bRC_OK) {
@@ -201,13 +203,13 @@ void load_sd_plugins(const char *plugin_dir)
       Dmsg0(dbglvl, "No sd plugin dir!\n");
       return;
    }
-   bplugin_list = New(alist(10, not_owned_by_alist));
+   b_plugin_list = New(alist(10, not_owned_by_alist));
    if (!load_plugins((void *)&binfo, (void *)&bfuncs, plugin_dir, plugin_type,
                 is_plugin_compatible)) {
       /* Either none found, or some error */
-      if (bplugin_list->size() == 0) {
-         delete bplugin_list;
-         bplugin_list = NULL;
+      if (b_plugin_list->size() == 0) {
+         delete b_plugin_list;
+         b_plugin_list = NULL;
          Dmsg0(dbglvl, "No plugins loaded\n");
          return;
       }
@@ -216,12 +218,12 @@ void load_sd_plugins(const char *plugin_dir)
     * Verify that the plugin is acceptable, and print information
     *  about it.
     */
-   foreach_alist_index(i, plugin, bplugin_list) {
+   foreach_alist_index(i, plugin, b_plugin_list) {
       Jmsg(NULL, M_INFO, 0, _("Loaded plugin: %s\n"), plugin->file);
       Dmsg1(dbglvl, "Loaded plugin: %s\n", plugin->file);
    }
 
-   Dmsg1(dbglvl, "num plugins=%d\n", bplugin_list->size());
+   Dmsg1(dbglvl, "num plugins=%d\n", b_plugin_list->size());
    dbg_plugin_add_hook(dump_sd_plugin);
 }
 
@@ -277,10 +279,10 @@ static bool is_plugin_compatible(Plugin *plugin)
 void new_plugins(JCR *jcr)
 {
    Plugin *plugin;
-   int i;
+   int i = 0;;
 
    Dmsg0(dbglvl, "=== enter new_plugins ===\n");
-   if (!bplugin_list) {
+   if (!b_plugin_list) {
       Dmsg0(dbglvl, "No sd plugin list!\n");
       return;
    }
@@ -294,7 +296,7 @@ void new_plugins(JCR *jcr)
       return;
    }
 
-   int num = bplugin_list->size();
+   int num = b_plugin_list->size();
 
    Dmsg1(dbglvl, "sd-plugin-list size=%d\n", num);
    if (num == 0) {
@@ -305,7 +307,7 @@ void new_plugins(JCR *jcr)
 
    bpContext *plugin_ctx_list = jcr->plugin_ctx_list;
    Dmsg2(dbglvl, "Instantiate sd-plugin_ctx_list=%p JobId=%d\n", jcr->plugin_ctx_list, jcr->JobId);
-   foreach_alist_index(i, plugin, bplugin_list) {
+   foreach_alist_index(i, plugin, b_plugin_list) {
       /* Start a new instance of each plugin */
       bacula_ctx *b_ctx = (bacula_ctx *)malloc(sizeof(bacula_ctx));
       memset(b_ctx, 0, sizeof(bacula_ctx));
@@ -324,15 +326,15 @@ void new_plugins(JCR *jcr)
 void free_plugins(JCR *jcr)
 {
    Plugin *plugin;
-   int i;
+   int i = 0;
 
-   if (!bplugin_list || !jcr->plugin_ctx_list) {
+   if (!b_plugin_list || !jcr->plugin_ctx_list) {
       return;
    }
 
    bpContext *plugin_ctx_list = (bpContext *)jcr->plugin_ctx_list;
    Dmsg2(dbglvl, "Free instance sd-plugin_ctx_list=%p JobId=%d\n", jcr->plugin_ctx_list, jcr->JobId);
-   foreach_alist_index(i, plugin, bplugin_list) {
+   foreach_alist_index(i, plugin, b_plugin_list) {
       /* Free the plugin instance */
       sdplug_func(plugin)->freePlugin(&plugin_ctx_list[i]);
       free(plugin_ctx_list[i].bContext);     /* free Bacula private context */
@@ -349,19 +351,6 @@ void free_plugins(JCR *jcr)
  * ==============================================================
  */
 
-/* Get a global. No job context */
-static bRC baculaGetGlobal(bsdrGlobalVariable var, void *value)
-{
-   if (!value) {
-      return bRC_Error;
-   }
-   switch (var) {
-   default:
-      break;
-   }
-   return bRC_OK;
-}
-
 
 static bRC baculaGetValue(bpContext *ctx, bsdrVariable var, void *value)
 {
diff --git a/src/stored/sd_plugins.h b/src/stored/sd_plugins.h
index e4ccb01..742f699 100644
--- a/src/stored/sd_plugins.h
+++ b/src/stored/sd_plugins.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Interface definition for Bacula Plugins
@@ -83,11 +87,6 @@ typedef enum {
 } bsdrVariable;
 
 typedef enum {
-  bsdVarDevTypes    = 1
-} bsdrGlobalVariable;
-
-
-typedef enum {
   bsdwVarJobReport  = 1,
   bsdwVarVolumeName = 2,
   bsdwVarPriority   = 3,
@@ -131,7 +130,6 @@ typedef struct s_sdbaculaFuncs {
        int level, const char *fmt, ...);
    char *(*EditDeviceCodes)(DCR *dcr, char *omsg,
        const char *imsg, const char *cmd);
-   bRC (*getBaculaGlobal)(bsdrGlobalVariable var, void *value);
 } bsdFuncs;
 
 /* Bacula Subroutines */
@@ -154,7 +152,7 @@ typedef enum {
 } psdVariable;
 
 
-# define SD_PLUGIN_MAGIC  "*BaculaSDPluginData*"
+#define SD_PLUGIN_MAGIC  "*BaculaSDPluginData*"
 
 #define SD_PLUGIN_INTERFACE_VERSION  ( 12 )
 
diff --git a/src/stored/spool.c b/src/stored/spool.c
index 4306655..3e26fa7 100644
--- a/src/stored/spool.c
+++ b/src/stored/spool.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2004-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *  Spooling code
@@ -222,7 +226,7 @@ static bool despool_data(DCR *dcr, bool commit)
    rdev = (DEVICE *)malloc(sizeof(DEVICE));
    memset(rdev, 0, sizeof(DEVICE));
    rdev->dev_name = get_memory(strlen(spool_name)+1);
-   bstrncpy(rdev->dev_name, spool_name, sizeof(rdev->dev_name));
+   bstrncpy(rdev->dev_name, spool_name, strlen(spool_name)+1);
    rdev->errmsg = get_pool_memory(PM_EMSG);
    *rdev->errmsg = 0;
    rdev->max_block_size = dcr->dev->max_block_size;
@@ -263,6 +267,7 @@ static bool despool_data(DCR *dcr, bool commit)
                dcr->dev->print_name(), dcr->dev->bstrerror());
          Pmsg2(000, "Fatal append error on device %s: ERR=%s\n",
                dcr->dev->print_name(), dcr->dev->bstrerror());
+         /* Force in case Incomplete set */
          jcr->forceJobStatus(JS_FatalError);
       }
       Dmsg3(800, "Write block ok=%d FI=%d LI=%d\n", ok, block->FirstIndex, block->LastIndex);
@@ -271,8 +276,9 @@ static bool despool_data(DCR *dcr, bool commit)
    if (!dir_create_jobmedia_record(dcr)) {
       Jmsg2(jcr, M_FATAL, 0, _("Could not create JobMedia record for Volume=\"%s\" Job=%s\n"),
          dcr->getVolCatName(), jcr->Job);
-      jcr->forceJobStatus(JS_FatalError);
+      jcr->forceJobStatus(JS_FatalError);  /* override any Incomplete */
    }
+   flush_jobmedia_queue(jcr);
    /* Set new file/block parameters for current dcr */
    set_new_file_parameters(dcr);
 
@@ -361,21 +367,21 @@ static int read_block_from_spool_file(DCR *dcr)
          Pmsg2(000, _("Spool read error. Wanted %u bytes, got %d\n"), rlen, stat);
          Jmsg2(jcr, M_FATAL, 0, _("Spool header read error. Wanted %u bytes, got %d\n"), rlen, stat);
       }
-      jcr->forceJobStatus(JS_FatalError);
+      jcr->forceJobStatus(JS_FatalError);  /* override any Incomplete */
       return RB_ERROR;
    }
    rlen = hdr.len;
    if (rlen > block->buf_len) {
       Pmsg2(000, _("Spool block too big. Max %u bytes, got %u\n"), block->buf_len, rlen);
       Jmsg2(jcr, M_FATAL, 0, _("Spool block too big. Max %u bytes, got %u\n"), block->buf_len, rlen);
-      jcr->forceJobStatus(JS_FatalError);
+      jcr->forceJobStatus(JS_FatalError);  /* override any Incomplete */
       return RB_ERROR;
    }
    stat = read(dcr->spool_fd, (char *)block->buf, (size_t)rlen);
    if (stat != (ssize_t)rlen) {
       Pmsg2(000, _("Spool data read error. Wanted %u bytes, got %d\n"), rlen, stat);
       Jmsg2(dcr->jcr, M_FATAL, 0, _("Spool data read error. Wanted %u bytes, got %d\n"), rlen, stat);
-      jcr->forceJobStatus(JS_FatalError);
+      jcr->forceJobStatus(JS_FatalError);  /* override any Incomplete */
       return RB_ERROR;
    }
    /* Setup write pointers */
@@ -482,7 +488,7 @@ static bool write_spool_header(DCR *dcr)
          berrno be;
          Jmsg(jcr, M_FATAL, 0, _("Error writing header to spool file. ERR=%s\n"),
               be.bstrerror());
-         jcr->forceJobStatus(JS_FatalError);
+         jcr->forceJobStatus(JS_FatalError);  /* override any Incomplete */
       }
       if (stat != (ssize_t)sizeof(hdr)) {
          Jmsg(jcr, M_ERROR, 0, _("Error writing header to spool file."
@@ -504,7 +510,7 @@ static bool write_spool_header(DCR *dcr)
          }
          if (!despool_data(dcr, false)) {
             Jmsg(jcr, M_FATAL, 0, _("Fatal despooling error."));
-            jcr->forceJobStatus(JS_FatalError);
+            jcr->forceJobStatus(JS_FatalError);  /* override any Incomplete */
             return false;
          }
          continue;                    /* try again */
@@ -512,7 +518,7 @@ static bool write_spool_header(DCR *dcr)
       return true;
    }
    Jmsg(jcr, M_FATAL, 0, _("Retrying after header spooling error failed.\n"));
-   jcr->forceJobStatus(JS_FatalError);
+   jcr->forceJobStatus(JS_FatalError);  /* override any Incomplete */
    return false;
 }
 
@@ -529,7 +535,7 @@ static bool write_spool_data(DCR *dcr)
          berrno be;
          Jmsg(jcr, M_FATAL, 0, _("Error writing data to spool file. ERR=%s\n"),
               be.bstrerror());
-         jcr->forceJobStatus(JS_FatalError);
+         jcr->forceJobStatus(JS_FatalError);  /* override any Incomplete */
       }
       if (stat != (ssize_t)block->binbuf) {
          /*
@@ -550,7 +556,7 @@ static bool write_spool_data(DCR *dcr)
          }
          if (!despool_data(dcr, false)) {
             Jmsg(jcr, M_FATAL, 0, _("Fatal despooling error."));
-            jcr->forceJobStatus(JS_FatalError);
+            jcr->forceJobStatus(JS_FatalError);  /* override any Incomplete */
             return false;
          }
          if (!write_spool_header(dcr)) {
@@ -561,7 +567,7 @@ static bool write_spool_data(DCR *dcr)
       return true;
    }
    Jmsg(jcr, M_FATAL, 0, _("Retrying after data spooling error failed.\n"));
-   jcr->forceJobStatus(JS_FatalError);
+   jcr->forceJobStatus(JS_FatalError);  /* override any Incomplete */
    return false;
 }
 
@@ -648,7 +654,7 @@ static bool blast_attr_spool_file(JCR *jcr, boffset_t size)
 
    if (jcr->dir_bsock->recv() <= 0) {
       Jmsg(jcr, M_FATAL, 0, _("Network error on BlastAttributes.\n"));
-      jcr->forceJobStatus(JS_FatalError);
+      jcr->forceJobStatus(JS_FatalError);  /* override any Incomplete */
       return false;
    }
 
@@ -660,7 +666,7 @@ static bool blast_attr_spool_file(JCR *jcr, boffset_t size)
 
 bool commit_attribute_spool(JCR *jcr)
 {
-   boffset_t size;
+   boffset_t size, data_end;
    char ec1[30];
    char tbuf[100];
    BSOCK *dir;
@@ -673,15 +679,31 @@ bool commit_attribute_spool(JCR *jcr)
          berrno be;
          Jmsg(jcr, M_FATAL, 0, _("Fseek on attributes file failed: ERR=%s\n"),
               be.bstrerror());
-         jcr->forceJobStatus(JS_FatalError);
+         jcr->forceJobStatus(JS_FatalError);  /* override any Incomplete */
          goto bail_out;
       }
       size = ftello(dir->m_spool_fd);
+      /* For Incomplete Job truncate spool file to last valid data_end if necssary */
+      if (jcr->is_JobStatus(JS_Incomplete)) {
+         data_end = dir->get_last_data_end();
+         if (size > data_end) {
+            if (ftruncate(fileno(dir->m_spool_fd), data_end) != 0) {
+               berrno be;
+               Jmsg(jcr, M_FATAL, 0, _("Truncate on attributes file failed: ERR=%s\n"),
+                    be.bstrerror());
+               jcr->forceJobStatus(JS_FatalError);  /* override any Incomplete */
+               goto bail_out;
+            }
+            Dmsg2(100, "=== Attrib spool truncated from %lld to %lld\n",
+                  size, data_end);
+            size = data_end;
+         }
+      }
       if (size < 0) {
          berrno be;
          Jmsg(jcr, M_FATAL, 0, _("Fseek on attributes file failed: ERR=%s\n"),
               be.bstrerror());
-         jcr->forceJobStatus(JS_FatalError);
+         jcr->forceJobStatus(JS_FatalError);  /* override any Incomplete */
          goto bail_out;
       }
       P(mutex);
@@ -719,7 +741,7 @@ static bool open_attr_spool_file(JCR *jcr, BSOCK *bs)
       berrno be;
       Jmsg(jcr, M_FATAL, 0, _("fopen attr spool file %s failed: ERR=%s\n"), name,
            be.bstrerror());
-      jcr->forceJobStatus(JS_FatalError);
+      jcr->forceJobStatus(JS_FatalError);  /* override any Incomplete */
       free_pool_memory(name);
       return false;
    }
diff --git a/src/stored/status.c b/src/stored/status.c
index 33d47e3..e3612b5 100644
--- a/src/stored/status.c
+++ b/src/stored/status.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2003-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *  This file handles the status command
@@ -24,32 +28,31 @@
 #include "bacula.h"
 #include "stored.h"
 #include "lib/status.h"
+#include "sd_plugins.h"
 
 /* Imported functions */
+extern void dbg_print_plugin(FILE *fp);
 
 /* Imported variables */
 extern BSOCK *filed_chan;
 extern void *start_heap;
 
 /* Static variables */
-static char qstatus[] = ".status %127s\n";
-
 static char OKqstatus[]   = "3000 OK .status\n";
 static char DotStatusJob[] = "JobId=%d JobStatus=%c JobErrors=%d\n";
 
 
 /* Forward referenced functions */
-static void sendit(const char *msg, int len, STATUS_PKT *sp);
 static void sendit(POOL_MEM &msg, int len, STATUS_PKT *sp);
 static void sendit(const char *msg, int len, void *arg);
-
+static void dbg_sendit(const char *msg, int len, void *arg);
 static void send_blocked_status(DEVICE *dev, STATUS_PKT *sp);
 static void send_device_status(DEVICE *dev, STATUS_PKT *sp);
-static void list_terminated_jobs(STATUS_PKT *sp);
 static void list_running_jobs(STATUS_PKT *sp);
 static void list_jobs_waiting_on_reservation(STATUS_PKT *sp);
 static void list_status_header(STATUS_PKT *sp);
-static void list_devices(STATUS_PKT *sp);
+static void list_devices(STATUS_PKT *sp, char *name=NULL);
+static void list_plugins(STATUS_PKT *sp);
 
 /*
  * Status command from Director
@@ -72,7 +75,7 @@ void output_status(STATUS_PKT *sp)
    list_jobs_waiting_on_reservation(sp);
 
    /*
-    * List terminated jobs
+    * List terminated jobs (defined in lib/status.h)
     */
    list_terminated_jobs(sp);
 
@@ -90,8 +93,12 @@ void output_status(STATUS_PKT *sp)
 
 
    list_spool_stats(sendit, (void *)sp);
+
    if (!sp->api) sendit("====\n\n", 6, sp);
 
+   if (chk_dbglvl(10)) {
+      dbg_print_plugin(stdout);
+   }
 }
 
 static void list_resources(STATUS_PKT *sp)
@@ -126,100 +133,150 @@ static find_device(char *devname)
 }
 #endif
 
-static void list_devices(STATUS_PKT *sp)
+
+static void list_one_device(char *name, DEVICE *dev, STATUS_PKT *sp)
 {
-   DEVRES *device;
-   AUTOCHANGER *changer;
-   DEVICE *dev;
    char b1[35], b2[35], b3[35];
    POOL_MEM msg(PM_MESSAGE);
    int len;
    int bpb;
 
-   len = Mmsg(msg, _("\nDevice status:\n"));
-   if (!sp->api) sendit(msg, len, sp);
-
-   foreach_res(changer, R_AUTOCHANGER) {
-      len = Mmsg(msg, _("Autochanger \"%s\" with devices:\n"),
-         changer->hdr.name);
+   if (!dev) {
+      len = Mmsg(msg, _("\nDevice \"%s\" is not open or does not exist.\n"),
+                 name);
       sendit(msg, len, sp);
+      if (!sp->api) sendit("==\n", 4, sp);
+      return;
+   }
 
-      foreach_alist(device, changer->device) {
-         if (device->dev) {
-            len = Mmsg(msg, "   %s\n", device->dev->print_name());
-            sendit(msg, len, sp);
+   if (dev->is_open()) {
+      if (dev->is_labeled()) {
+         len = Mmsg(msg, _("\nDevice %s is %s %s:\n"
+                           "    Volume:      %s\n"
+                           "    Pool:        %s\n"
+                           "    Media type:  %s\n"),
+            dev->print_type(), dev->print_name(),
+            dev->blocked()?_("waiting for"):_("mounted with"),
+            dev->VolHdr.VolumeName,
+            dev->pool_name[0]?dev->pool_name:_("*unknown*"),
+            dev->device->media_type);
+         sendit(msg, len, sp);
+      } else {
+         len = Mmsg(msg, _("\nDevice %s: %s open but no Bacula volume is currently mounted.\n"),
+            dev->print_type(), dev->print_name());
+         sendit(msg, len, sp);
+      }
+      send_blocked_status(dev, sp);
+      if (dev->can_append()) {
+         bpb = dev->VolCatInfo.VolCatBlocks;
+         if (bpb <= 0) {
+            bpb = 1;
+         }
+         bpb = dev->VolCatInfo.VolCatBytes / bpb;
+         len = Mmsg(msg, _("    Total Bytes=%s Blocks=%s Bytes/block=%s\n"),
+            edit_uint64_with_commas(dev->VolCatInfo.VolCatBytes, b1),
+            edit_uint64_with_commas(dev->VolCatInfo.VolCatBlocks, b2),
+            edit_uint64_with_commas(bpb, b3));
+         sendit(msg, len, sp);
+      } else {  /* reading */
+         bpb = dev->VolCatInfo.VolCatReads;
+         if (bpb <= 0) {
+            bpb = 1;
+         }
+         if (dev->VolCatInfo.VolCatRBytes > 0) {
+            bpb = dev->VolCatInfo.VolCatRBytes / bpb;
          } else {
-            len = Mmsg(msg, "   %s\n", device->hdr.name);
-            sendit(msg, len, sp);
+            bpb = 0;
          }
+         len = Mmsg(msg, _("    Total Bytes Read=%s Blocks Read=%s Bytes/block=%s\n"),
+            edit_uint64_with_commas(dev->VolCatInfo.VolCatRBytes, b1),
+            edit_uint64_with_commas(dev->VolCatInfo.VolCatReads, b2),
+            edit_uint64_with_commas(bpb, b3));
+         sendit(msg, len, sp);
       }
-   }
+      len = Mmsg(msg, _("    Positioned at File=%s Block=%s\n"),
+         edit_uint64_with_commas(dev->file, b1),
+         edit_uint64_with_commas(dev->block_num, b2));
+      sendit(msg, len, sp);
 
+   } else {
+      len = Mmsg(msg, _("\nDevice %s: %s is not open.\n"),
+                 dev->print_type(), dev->print_name());
+      sendit(msg, len, sp);
+      send_blocked_status(dev, sp);
+   }
 
-   foreach_res(device, R_DEVICE) {
-      dev = device->dev;
-      if (dev && dev->is_open()) {
-         if (dev->is_labeled()) {
-            len = Mmsg(msg, _("\nDevice %s is %s:\n"
-                              "    Volume:      %s\n"
-                              "    Pool:        %s\n"
-                              "    Media type:  %s\n"),
-               dev->print_name(),
-               dev->blocked()?_("waiting for"):_("mounted with"),
-               dev->VolHdr.VolumeName,
-               dev->pool_name[0]?dev->pool_name:_("*unknown*"),
-               dev->device->media_type);
-            sendit(msg, len, sp);
-         } else {
-            len = Mmsg(msg, _("\nDevice %s open but no Bacula volume is currently mounted.\n"),
-               dev->print_name());
-            sendit(msg, len, sp);
-         }
-         send_blocked_status(dev, sp);
-         if (dev->can_append()) {
-            bpb = dev->VolCatInfo.VolCatBlocks;
-            if (bpb <= 0) {
-               bpb = 1;
-            }
-            bpb = dev->VolCatInfo.VolCatBytes / bpb;
-            len = Mmsg(msg, _("    Total Bytes=%s Blocks=%s Bytes/block=%s\n"),
-               edit_uint64_with_commas(dev->VolCatInfo.VolCatBytes, b1),
-               edit_uint64_with_commas(dev->VolCatInfo.VolCatBlocks, b2),
-               edit_uint64_with_commas(bpb, b3));
-            sendit(msg, len, sp);
-         } else {  /* reading */
-            bpb = dev->VolCatInfo.VolCatReads;
-            if (bpb <= 0) {
-               bpb = 1;
-            }
-            if (dev->VolCatInfo.VolCatRBytes > 0) {
-               bpb = dev->VolCatInfo.VolCatRBytes / bpb;
-            } else {
-               bpb = 0;
-            }
-            len = Mmsg(msg, _("    Total Bytes Read=%s Blocks Read=%s Bytes/block=%s\n"),
-               edit_uint64_with_commas(dev->VolCatInfo.VolCatRBytes, b1),
-               edit_uint64_with_commas(dev->VolCatInfo.VolCatReads, b2),
-               edit_uint64_with_commas(bpb, b3));
-            sendit(msg, len, sp);
-         }
-         len = Mmsg(msg, _("    Positioned at File=%s Block=%s\n"),
-            edit_uint64_with_commas(dev->file, b1),
-            edit_uint64_with_commas(dev->block_num, b2));
+   /* TODO: We need to check with Mount command, maybe we can
+    * display this number only when the device is open.
+    */
+   if (dev->is_file()) {
+      char ed1[50];
+      uint64_t f, t;
+      dev->get_freespace(&f, &t);
+      if (t > 0) {              /* We might not have access to numbers */
+         len = Mmsg(msg, _("    Available Space=%sB\n"),
+                    edit_uint64_with_suffix(f, ed1));
          sendit(msg, len, sp);
+      }
+   }
 
+   if (!sp->api) sendit("==\n", 4, sp);
+}
+
+void _dbg_list_one_device(char *name, DEVICE *dev, const char *file, int line)
+{
+   STATUS_PKT sp;
+   sp.bs = NULL;
+   sp.callback = dbg_sendit;
+   sp.context = NULL;
+   d_msg(file, line, 0, "Called dbg_list_one_device():");
+   list_one_device(name, dev, &sp);
+   send_device_status(dev, &sp);
+}
+
+static void list_one_autochanger(char *name, AUTOCHANGER *changer, STATUS_PKT *sp)
+{
+   int     len;
+   DEVRES *device;
+   POOL_MEM msg(PM_MESSAGE);
+
+   len = Mmsg(msg, _("Autochanger \"%s\" with devices:\n"),
+              changer->hdr.name);
+   sendit(msg, len, sp);
+
+   foreach_alist(device, changer->device) {
+      if (device->dev) {
+         len = Mmsg(msg, "   %s\n", device->dev->print_name());
+         sendit(msg, len, sp);
       } else {
-         if (dev) {
-            len = Mmsg(msg, _("\nDevice %s is not open.\n"), dev->print_name());
-            sendit(msg, len, sp);
-            send_blocked_status(dev, sp);
-        } else {
-            len = Mmsg(msg, _("\nDevice \"%s\" is not open or does not exist.\n"), device->hdr.name);
-            sendit(msg, len, sp);
-         }
+         len = Mmsg(msg, "   %s\n", device->hdr.name);
+         sendit(msg, len, sp);
       }
+   }
+}
 
-      if (!sp->api) sendit("==\n", 4, sp);
+static void list_devices(STATUS_PKT *sp, char *name)
+{
+   int len;
+   DEVRES *device;
+   AUTOCHANGER *changer;
+   POOL_MEM msg(PM_MESSAGE);
+
+   if (!sp->api) {
+      len = Mmsg(msg, _("\nDevice status:\n"));
+      sendit(msg, len, sp);
+   }
+
+   foreach_res(changer, R_AUTOCHANGER) {
+      if (!name || strcmp(changer->hdr.name, name) == 0) {
+         list_one_autochanger(changer->hdr.name, changer, sp);
+      }
+   }
+
+   foreach_res(device, R_DEVICE) {
+      if (!name || strcmp(device->hdr.name, name) == 0) {
+         list_one_device(device->hdr.name, device->dev, sp);
+      }
    }
    if (!sp->api) sendit("====\n\n", 6, sp);
 }
@@ -231,8 +288,8 @@ static void list_status_header(STATUS_PKT *sp)
    POOL_MEM msg(PM_MESSAGE);
    int len;
 
-   len = Mmsg(msg, _("%s Version: %s (%s) %s %s %s\n"),
-              my_name, VERSION, BDATE, HOST_OS, DISTNAME, DISTVER);
+   len = Mmsg(msg, _("%s %sVersion: %s (%s) %s %s %s\n"),
+              my_name, "", VERSION, BDATE, HOST_OS, DISTNAME, DISTVER);
    sendit(msg, len, sp);
 
    bstrftime_nc(dt, sizeof(dt), daemon_start_time);
@@ -251,23 +308,9 @@ static void list_status_header(STATUS_PKT *sp)
    len = Mmsg(msg, " Sizes: boffset_t=%d size_t=%d int32_t=%d int64_t=%d "
               "mode=%d,%d\n",
               (int)sizeof(boffset_t), (int)sizeof(size_t), (int)sizeof(int32_t),
-              (int)sizeof(int64_t), (int)DEVELOPER_MODE, (int)BEEF);
+              (int)sizeof(int64_t), (int)DEVELOPER_MODE, (int)0);
    sendit(msg, len, sp);
-   if (bplugin_list->size() > 0) {
-      Plugin *plugin;
-      int len;
-      pm_strcpy(msg, " Plugin: ");
-      foreach_alist(plugin, bplugin_list) {
-         len = pm_strcat(msg, plugin->file);
-         if (len > 80) {
-            pm_strcat(msg, "\n   ");
-         } else {
-            pm_strcat(msg, " ");
-         }
-      }
-      len = pm_strcat(msg, "\n");
-      sendit(msg.c_str(), len, sp);
-   }
+   list_plugins(sp);
 }
 
 static void send_blocked_status(DEVICE *dev, STATUS_PKT *sp)
@@ -280,6 +323,10 @@ static void send_blocked_status(DEVICE *dev, STATUS_PKT *sp)
       sendit(msg, len, sp);
       return;
    }
+   if (!dev->enabled) {
+      len = Mmsg(msg, _("    Device is disabled. User command.\n"));
+      sendit(msg, len, sp);
+   }
    switch (dev->blocked()) {
    case BST_UNMOUNTED:
       len = Mmsg(msg, _("    Device is BLOCKED. User unmounted.\n"));
@@ -350,7 +397,7 @@ static void send_blocked_status(DEVICE *dev, STATUS_PKT *sp)
    }
 }
 
-static void send_device_status(DEVICE *dev, STATUS_PKT *sp)
+void send_device_status(DEVICE *dev, STATUS_PKT *sp)
 {
    POOL_MEM msg(PM_MESSAGE);
    int len;
@@ -392,11 +439,11 @@ static void send_device_status(DEVICE *dev, STATUS_PKT *sp)
       dev->state & ST_SHORT ? "" : "!",
       dev->state & ST_MOUNTED ? "" : "!");
    sendit(msg, len, sp);
-   len = Mmsg(msg, _("  num_writers=%d reserves=%d block=%d\n"), dev->num_writers,
-              dev->num_reserved(), dev->blocked());
+   len = Mmsg(msg, _("  num_writers=%d reserves=%d block=%d enabled=%d\n"), dev->num_writers,
+              dev->num_reserved(), dev->blocked(), dev->enabled);
    sendit(msg, len, sp);
 
-   len = Mmsg(msg, _("Attached JobsIds: "));
+   len = Mmsg(msg, _("Attached JobIds: "));
    sendit(msg, len, sp);
    dev->Lock();
    dev->Lock_dcrs();
@@ -428,7 +475,8 @@ static void send_device_status(DEVICE *dev, STATUS_PKT *sp)
 static void list_running_jobs(STATUS_PKT *sp)
 {
    bool found = false;
-   int avebps, bps, sec;
+   uint64_t inst_bps, total_bps;
+   int inst_sec, total_sec;
    JCR *jcr;
    DCR *dcr, *rdcr;
    char JobName[MAX_NAME_LENGTH];
@@ -470,7 +518,7 @@ static void list_running_jobs(STATUS_PKT *sp)
                             rdcr->device->device_name);
             sendit(msg, len, sp);
          }
-         if (dcr && dcr->device) {
+         if (dcr && dcr->device && dcr != rdcr) {
             len = Mmsg(msg, _("Writing: %s %s job %s JobId=%d Volume=\"%s\"\n"
                             "    pool=\"%s\" device=%s\n"),
                    job_level_to_str(jcr->getJobLevel()),
@@ -489,24 +537,35 @@ static void list_running_jobs(STATUS_PKT *sp)
          if (jcr->last_time == 0) {
             jcr->last_time = jcr->run_time;
          }
-         sec = now - jcr->last_time;
-         if (sec <= 0) {
-            sec = 1;
+         total_sec = now - jcr->run_time;
+         inst_sec = now - jcr->last_time;
+         if (total_sec <= 0) {
+            total_sec = 1;
+         }
+         if (inst_sec <= 0) {
+            inst_sec = 1;
          }
-         bps = (jcr->JobBytes - jcr->LastJobBytes) / sec;
+         /* Instanteous bps not smoothed */
+         inst_bps = (jcr->JobBytes - jcr->LastJobBytes) / inst_sec;
          if (jcr->LastRate == 0) {
-            jcr->LastRate = bps;
+            jcr->LastRate = inst_bps;
          }
-         avebps = (jcr->LastRate + bps) / 2;
+         /* Smooth the instantaneous bps a bit */
+         inst_bps = (2 * jcr->LastRate + inst_bps) / 3;
+         /* total bps (AveBytes/sec) since start of job */
+         total_bps = jcr->JobBytes / total_sec;
          len = Mmsg(msg, _("    Files=%s Bytes=%s AveBytes/sec=%s LastBytes/sec=%s\n"),
             edit_uint64_with_commas(jcr->JobFiles, b1),
             edit_uint64_with_commas(jcr->JobBytes, b2),
-            edit_uint64_with_commas(avebps, b3),
-            edit_uint64_with_commas(bps, b4));
+            edit_uint64_with_commas(total_bps, b3),
+            edit_uint64_with_commas(inst_bps, b4));
          sendit(msg, len, sp);
-         jcr->LastRate = avebps;
-         jcr->LastJobBytes = jcr->JobBytes;
-         jcr->last_time = now;
+         /* Update only every 10 seconds */
+         if (now - jcr->last_time > 10) {
+            jcr->LastRate = inst_bps;
+            jcr->LastJobBytes = jcr->JobBytes;
+            jcr->last_time = now;
+         }
          found = true;
 #ifdef DEBUG
          if (jcr->file_bsock) {
@@ -551,9 +610,7 @@ static void list_jobs_waiting_on_reservation(STATUS_PKT *sp)
    if (!sp->api) sendit("====\n", 5, sp);
 }
 
-/*
- * Send to Director
- */
+
 static void sendit(const char *msg, int len, void *sp)
 {
    sendit(msg, len, (STATUS_PKT *)sp);
@@ -563,6 +620,7 @@ static void sendit(POOL_MEM &msg, int len, STATUS_PKT *sp)
 {
    BSOCK *bs = sp->bs;
    if (bs) {
+      bs->msg = check_pool_memory_size(bs->msg, len+1);
       memcpy(bs->msg, msg.c_str(), len+1);
       bs->msglen = len+1;
       bs->send();
@@ -571,6 +629,12 @@ static void sendit(POOL_MEM &msg, int len, STATUS_PKT *sp)
    }
 }
 
+static void dbg_sendit(const char *msg, int len, void *sp)
+{
+   if (len > 0) {
+      Dmsg0(-1, msg);
+   }
+}
 
 /*
  * Status command from Director
@@ -593,122 +657,123 @@ bool status_cmd(JCR *jcr)
 bool qstatus_cmd(JCR *jcr)
 {
    BSOCK *dir = jcr->dir_bsock;
-   POOL_MEM cmd;
    JCR *njcr;
    s_last_job* job;
    STATUS_PKT sp;
+   POOLMEM *args = get_pool_memory(PM_MESSAGE);
+   char *argk[MAX_CMD_ARGS];          /* argument keywords */
+   char *argv[MAX_CMD_ARGS];          /* argument values */
+   int argc;                          /* number of arguments */
+   bool ret=true;
+   char *cmd;
+   char *device=NULL;
+   int api = true;
 
    sp.bs = dir;
-   if (sscanf(dir->msg, qstatus, cmd.c_str()) != 1) {
+
+   parse_args(dir->msg, &args, &argc, argk, argv, MAX_CMD_ARGS);
+
+   /* .status xxxx at the minimum */
+   if (argc < 2 || strcmp(argk[0], ".status") != 0) {
       pm_strcpy(jcr->errmsg, dir->msg);
       dir->fsend(_("3900 No arg in .status command: %s\n"), jcr->errmsg);
       dir->signal(BNET_EOD);
       return false;
    }
+
+   cmd = argk[1];
    unbash_spaces(cmd);
 
-   Dmsg1(200, "cmd=%s\n", cmd.c_str());
+   /* The status command can contain some arguments
+    * i=0 => .status
+    * i=1 => [running | current | last | ... ]
+    */
+   for (int i=0 ; i < argc ; i++) {
+      if (!strcmp(argk[i], "device") && argv[i]) {
+         device = argv[i];
+         unbash_spaces(device);
+
+      } else if (!strcmp(argk[i], "api") && argv[i]) {
+         api = atoi(argv[i]);
+
+      } else if (!strcmp(argk[i], "api_opts") && argv[i]) {
+         strncpy(sp.api_opts, argv[i], sizeof(sp.api_opts));;
+      }
+   }
 
-   if (strcasecmp(cmd.c_str(), "current") == 0) {
-      dir->fsend(OKqstatus, cmd.c_str());
+   Dmsg1(100, "cmd=%s\n", cmd);
+
+   if (strcasecmp(cmd, "current") == 0) {
+      dir->fsend(OKqstatus, cmd);
       foreach_jcr(njcr) {
          if (njcr->JobId != 0) {
             dir->fsend(DotStatusJob, njcr->JobId, njcr->JobStatus, njcr->JobErrors);
          }
       }
       endeach_jcr(njcr);
-   } else if (strcasecmp(cmd.c_str(), "last") == 0) {
-      dir->fsend(OKqstatus, cmd.c_str());
+   } else if (strcasecmp(cmd, "last") == 0) {
+      dir->fsend(OKqstatus, cmd);
       if ((last_jobs) && (last_jobs->size() > 0)) {
          job = (s_last_job*)last_jobs->last();
          dir->fsend(DotStatusJob, job->JobId, job->JobStatus, job->Errors);
       }
-   } else if (strcasecmp(cmd.c_str(), "header") == 0) {
-       sp.api = true;
+   } else if (strcasecmp(cmd, "header") == 0) {
+       sp.api = api;
        list_status_header(&sp);
-   } else if (strcasecmp(cmd.c_str(), "running") == 0) {
-       sp.api = true;
+   } else if (strcasecmp(cmd, "running") == 0) {
+       sp.api = api;
        list_running_jobs(&sp);
-   } else if (strcasecmp(cmd.c_str(), "waitreservation") == 0) {
-       sp.api = true;
+   } else if (strcasecmp(cmd, "waitreservation") == 0) {
+       sp.api = api;
        list_jobs_waiting_on_reservation(&sp);
-   } else if (strcasecmp(cmd.c_str(), "devices") == 0) {
-       sp.api = true;
-       list_devices(&sp);
-   } else if (strcasecmp(cmd.c_str(), "volumes") == 0) {
-       sp.api = true;
+   } else if (strcasecmp(cmd, "devices") == 0) {
+       sp.api = api;
+       list_devices(&sp, device);
+   } else if (strcasecmp(cmd, "volumes") == 0) {
+       sp.api = api;
        list_volumes(sendit, &sp);
-   } else if (strcasecmp(cmd.c_str(), "spooling") == 0) {
-       sp.api = true;
+   } else if (strcasecmp(cmd, "spooling") == 0) {
+       sp.api = api;
        list_spool_stats(sendit, &sp);
-   } else if (strcasecmp(cmd.c_str(), "terminated") == 0) {
-       sp.api = true;
-       list_terminated_jobs(&sp);
-   } else if (strcasecmp(cmd.c_str(), "resources") == 0) {
-       sp.api = true;
+   } else if (strcasecmp(cmd, "terminated") == 0) {
+       sp.api = api;
+       list_terminated_jobs(&sp); /* defined in lib/status.h */
+   } else if (strcasecmp(cmd, "resources") == 0) {
+       sp.api = api;
        list_resources(&sp);
    } else {
       pm_strcpy(jcr->errmsg, dir->msg);
       dir->fsend(_("3900 Unknown arg in .status command: %s\n"), jcr->errmsg);
       dir->signal(BNET_EOD);
-      return false;
+      ret = false;
    }
    dir->signal(BNET_EOD);
-   return true;
+   free_pool_memory(args);
+   return ret;
 }
 
-#if defined(HAVE_WIN32)
-int bacstat = 0;
-
-/* Return a one line status for the tray monitor */
-char *bac_status(char *buf, int buf_len)
+static void list_plugins(STATUS_PKT *sp)
 {
-   JCR *njcr;
-   const char *termstat = _("Bacula Storage: Idle");
-   struct s_last_job *job;
-   int stat = 0;                      /* Idle */
-
-   if (!last_jobs) {
-      goto done;
-   }
-   Dmsg0(1000, "Begin bac_status jcr loop.\n");
-   foreach_jcr(njcr) {
-      if (njcr->JobId != 0) {
-         stat = JS_Running;
-         termstat = _("Bacula Storage: Running");
-         break;
-      }
-   }
-   endeach_jcr(njcr);
-
-   if (stat != 0) {
-      goto done;
-   }
-   if (last_jobs->size() > 0) {
-      job = (struct s_last_job *)last_jobs->last();
-      stat = job->JobStatus;
-      switch (job->JobStatus) {
-      case JS_Canceled:
-         termstat = _("Bacula Storage: Last Job Canceled");
-         break;
-      case JS_ErrorTerminated:
-      case JS_FatalError:
-         termstat = _("Bacula Storage: Last Job Failed");
-         break;
-      default:
-         if (job->Errors) {
-            termstat = _("Bacula Storage: Last Job had Warnings");
+   POOL_MEM msg(PM_MESSAGE);
+   if (b_plugin_list->size() > 0) {
+      Plugin *plugin;
+      int len;
+      pm_strcpy(msg, " Plugin: ");
+      foreach_alist(plugin, b_plugin_list) {
+         len = pm_strcat(msg, plugin->file);
+         /* Print plugin version when debug activated */
+         if (debug_level > 0 && plugin->pinfo) {
+            pm_strcat(msg, "(");
+            pm_strcat(msg, NPRT(sdplug_info(plugin)->plugin_version));
+            len = pm_strcat(msg, ")");
+         }
+         if (len > 80) {
+            pm_strcat(msg, "\n   ");
+         } else {
+            pm_strcat(msg, " ");
          }
-         break;
       }
+      len = pm_strcat(msg, "\n");
+      sendit(msg.c_str(), len, sp);
    }
-   Dmsg0(1000, "End bac_status jcr loop.\n");
-done:
-   bacstat = stat;
-   if (buf) {
-      bstrncpy(buf, termstat, buf_len);
-   }
-   return buf;
 }
-
-#endif /* HAVE_WIN32 */
diff --git a/src/stored/stored.c b/src/stored/stored.c
index ab548da..5782088 100644
--- a/src/stored/stored.c
+++ b/src/stored/stored.c
@@ -1,22 +1,26 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Second generation Storage daemon.
  *
- *  Kern Sibbald, MM
+ *  Written by Kern Sibbald, MM
  *
  * It accepts a number of simple commands from the File daemon
  * and acts on them. When a request to append data is made,
@@ -50,6 +54,7 @@ extern "C" void *device_initialization(void *arg);
 char OK_msg[]   = "3000 OK\n";
 char TERM_msg[] = "3999 Terminate\n";
 STORES *me = NULL;                    /* our Global resource */
+
 bool forge_on = false;                /* proceed inspite of I/O errors */
 pthread_mutex_t device_release_mutex = PTHREAD_MUTEX_INITIALIZER;
 pthread_cond_t wait_device_release = PTHREAD_COND_INITIALIZER;
@@ -73,23 +78,23 @@ static CONFIG *config;
 static void usage()
 {
    fprintf(stderr, _(
-PROG_COPYRIGHT
-"\nVersion: %s (%s)\n\n"
-"Usage: bacula-sd [options] [-c config_file] [config_file]\n"
-"        -c <file>   use <file> as configuration file\n"
-"        -d <nn>     set debug level to <nn>\n"
-"        -dt         print timestamp in debug output\n"
-"        -f          run in foreground (for debugging)\n"
-"        -g <group>  set groupid to group\n"
-"        -m          print kaboom output (for debugging)\n"
-"        -p          proceed despite I/O errors\n"
-"        -s          no signals (for debugging)\n"
-"        -t          test - read config and exit\n"
-"        -u <user>   userid to <user>\n"
-"        -v          verbose user messages\n"
-"        -?          print this message.\n"
-"\n"), 2000, VERSION, BDATE);
-
+      PROG_COPYRIGHT
+      "\n%sVersion: %s (%s)\n\n"
+      "Usage: bacula-sd [options] [-c config_file] [config_file]\n"
+      "     -c <file>         use <file> as configuration file\n"
+      "     -d <nn>[,<tags>]  set debug level to <nn>, debug tags to <tags>\n"
+      "     -dt               print timestamp in debug output\n"
+      "     -T                set trace on\n"
+      "     -f                run in foreground (for debugging)\n"
+      "     -g <group>        set groupid to group\n"
+      "     -m                print kaboom output (for debugging)\n"
+      "     -p                proceed despite I/O errors\n"
+      "     -s                no signals (for debugging)\n"
+      "     -t                test - read config and exit\n"
+      "     -u <user>         userid to <user>\n"
+      "     -v                verbose user messages\n"
+      "     -?                print this message.\n"
+      "\n"), 2000, "", VERSION, BDATE);
    exit(1);
 }
 
@@ -130,7 +135,7 @@ int main (int argc, char *argv[])
       Emsg1(M_ABORT, 0, _("Tape block size (%d) is not a power of 2\n"), TAPE_BSIZE);
    }
 
-   while ((ch = getopt(argc, argv, "c:d:fg:mpstu:v?")) != -1) {
+   while ((ch = getopt(argc, argv, "c:d:fg:mpstu:v?T")) != -1) {
       switch (ch) {
       case 'c':                    /* configuration file */
          if (configfile != NULL) {
@@ -143,13 +148,25 @@ int main (int argc, char *argv[])
          if (*optarg == 't') {
             dbg_timestamp = true;
          } else {
+            char *p;
+            /* We probably find a tag list -d 10,sql,bvfs */
+            if ((p = strchr(optarg, ',')) != NULL) {
+               *p = 0;
+            }
             debug_level = atoi(optarg);
             if (debug_level <= 0) {
                debug_level = 1;
             }
+            if (p) {
+               debug_parse_tags(p+1, &debug_level_tags);
+            }
          }
          break;
 
+      case 'T':
+         set_trace(true);
+         break;
+
       case 'f':                    /* run in foreground */
          foreground = true;
          break;
@@ -202,6 +219,11 @@ int main (int argc, char *argv[])
    if (argc)
       usage();
 
+   if (!foreground) {
+      daemon_start();                 /* become daemon */
+      init_stack_dump();              /* pick up new pid */
+   }
+
    if (!no_signals) {
       init_signals(terminate_stored);
    }
@@ -229,10 +251,6 @@ int main (int argc, char *argv[])
 
    my_name_is(0, (char **)NULL, me->hdr.name);     /* Set our real name */
 
-   if (!foreground) {
-      daemon_start();                 /* become daemon */
-      init_stack_dump();              /* pick up new pid */
-   }
 
    create_pid_file(me->pid_directory, "bacula-sd",
                    get_first_port_host_order(me->sdaddrs));
@@ -296,7 +314,6 @@ static int check_resources()
    bool OK = true;
    bool tls_needed;
 
-
    me = (STORES *)GetNextRes(R_STORAGE, NULL);
    if (!me) {
       Jmsg1(NULL, M_ERROR, 0, _("No Storage resource defined in %s. Cannot continue.\n"),
@@ -527,7 +544,6 @@ get_out2:
    free_pool_memory(basename);
 }
 
-
 /*
  * Here we attempt to init and open each device. This is done
  *  once at startup in a separate thread.
@@ -544,6 +560,7 @@ void *device_initialization(void *arg)
 
    pthread_detach(pthread_self());
    jcr = new_jcr(sizeof(JCR), stored_free_jcr);
+   new_plugins(jcr);  /* instantiate plugins */
    jcr->setJobType(JT_SYSTEM);
    /* Initialize FD start condition variable */
    int errstat = pthread_cond_init(&jcr->job_start_wait, NULL);
@@ -563,20 +580,29 @@ void *device_initialization(void *arg)
 
       jcr->dcr = dcr = new_dcr(jcr, NULL, dev);
       generate_plugin_event(jcr, bsdEventDeviceInit, dcr);
-      if (dev->is_autochanger()) {
-         /* If autochanger set slot in dev sturcture */
-         get_autochanger_loaded_slot(dcr);
-      }
 
       if (device->cap_bits & CAP_ALWAYSOPEN) {
+         if (dev->is_autochanger()) {
+            /* If autochanger set slot in dev sturcture */
+            get_autochanger_loaded_slot(dcr);
+         }
          Dmsg1(20, "calling first_open_device %s\n", dev->print_name());
+         if (generate_plugin_event(jcr, bsdEventDeviceOpen, dcr) != bRC_OK) {
+            Jmsg(jcr, M_FATAL, 0, _("generate_plugin_event(bsdEventDeviceOpen) Failed\n"));
+            continue;
+         }
+
          if (!first_open_device(dcr)) {
             Jmsg1(NULL, M_ERROR, 0, _("Could not open device %s\n"), dev->print_name());
             Dmsg1(20, "Could not open device %s\n", dev->print_name());
+            generate_plugin_event(jcr, bsdEventDeviceClose, dcr);
             free_dcr(dcr);
             jcr->dcr = NULL;
             continue;
          }
+      } else {
+         /* If not always open, we don't know what is in the drive */
+         dev->clear_slot();
       }
       if (device->cap_bits & CAP_AUTOMOUNT && dev->is_open()) {
          switch (read_dev_volume_label(dcr)) {
@@ -589,12 +615,15 @@ void *device_initialization(void *arg)
             break;
          }
       }
+
       free_dcr(dcr);
       jcr->dcr = NULL;
    }
+
+
 #ifdef xxx
    if (jcr->dcr) {
-      Dmsg1(000, "free_dcr=%p\n", jcr->dcr);
+      Pmsg1(000, "free_dcr=%p\n", jcr->dcr);
       free_dcr(jcr->dcr);
       jcr->dcr = NULL;
    }
@@ -622,7 +651,7 @@ void terminate_stored(int sig)
    debug_level = 0;                   /* turn off any debug */
    stop_watchdog();
 
-   if (sig == SIGTERM) {              /* normal shutdown request? */
+   if (sig == SIGTERM || sig == SIGINT) { /* normal shutdown request? or ^C */
       /*
        * This is a normal shutdown request. We wiffle through
        *   all open jobs canceling them and trying to wake
@@ -635,6 +664,10 @@ void terminate_stored(int sig)
             free_jcr(jcr);
             continue;                 /* ignore console */
          }
+         if (jcr->dcr) {
+            /* Make sure no device remains locked */
+            generate_plugin_event(jcr, bsdEventDeviceClose, jcr->dcr);
+         }
          jcr->setJobStatus(JS_Canceled);
          fd = jcr->file_bsock;
          if (fd) {
@@ -679,6 +712,7 @@ void terminate_stored(int sig)
    if (server_tid_valid) {
       bnet_stop_thread_server(server_tid);
    }
+
    if (configfile) {
       free(configfile);
       configfile = NULL;
diff --git a/src/stored/stored.conf.in b/src/stored/stored.conf.in
index 6aa82cd..062e206 100644
--- a/src/stored/stored.conf.in
+++ b/src/stored/stored.conf.in
@@ -3,6 +3,9 @@
 #
 #  For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@ @DISTVER@
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 #
 # "Global" Storage daemon configuration specifications
 #
diff --git a/src/stored/stored.h b/src/stored/stored.h
index 7721184..dc4eb5e 100644
--- a/src/stored/stored.h
+++ b/src/stored/stored.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Storage daemon specific defines and includes
diff --git a/src/stored/stored_conf.c b/src/stored/stored_conf.c
index dce408b..3480d73 100644
--- a/src/stored/stored_conf.c
+++ b/src/stored/stored_conf.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Configuration file parser for Bacula Storage daemon
@@ -28,7 +32,6 @@ int32_t r_last  = R_LAST;
 static RES *sres_head[R_LAST - R_FIRST + 1];
 RES **res_head = sres_head;
 
-
 /* We build the current resource here statically,
  * then move it to dynamic memory */
 #if defined(_MSC_VER)
@@ -45,122 +48,131 @@ int32_t res_all_size = sizeof(res_all);
  * information.
  */
 
-/* Globals for the Storage daemon. */
+/*
+ * Globals for the Storage daemon.
+ *  name         handler      value       code   flags  default_value
+ */
 static RES_ITEM store_items[] = {
-   {"name",                  store_name, ITEM(res_store.hdr.name),   0, ITEM_REQUIRED, 0},
-   {"description",           store_str,  ITEM(res_dir.hdr.desc),     0, 0, 0},
-   {"sdaddress",             store_addresses_address,  ITEM(res_store.sdaddrs),     0, ITEM_DEFAULT, 9103},
-   {"sdaddresses",           store_addresses,  ITEM(res_store.sdaddrs), 0, ITEM_DEFAULT, 9103},
-   {"messages",              store_res,  ITEM(res_store.messages),   R_MSGS, 0, 0},
-   {"sdport",                store_addresses_port,  ITEM(res_store.sdaddrs),     0, ITEM_DEFAULT, 9103},
-   {"workingdirectory",      store_dir,  ITEM(res_store.working_directory), 0, ITEM_REQUIRED, 0},
-   {"piddirectory",          store_dir,  ITEM(res_store.pid_directory), 0, ITEM_REQUIRED, 0},
-   {"subsysdirectory",       store_dir,  ITEM(res_store.subsys_directory), 0, 0, 0},
-   {"plugindirectory",       store_dir,  ITEM(res_store.plugin_directory), 0, 0, 0},
-   {"scriptsdirectory",      store_dir,  ITEM(res_store.scripts_directory), 0, 0, 0},
-   {"maximumconcurrentjobs", store_pint32, ITEM(res_store.max_concurrent_jobs), 0, ITEM_DEFAULT, 20},
-   {"heartbeatinterval",     store_time, ITEM(res_store.heartbeat_interval), 0, ITEM_DEFAULT, 0},
-   {"tlsauthenticate",       store_bool,    ITEM(res_store.tls_authenticate), 0, 0, 0},
-   {"tlsenable",             store_bool,    ITEM(res_store.tls_enable), 0, 0, 0},
-   {"tlsrequire",            store_bool,    ITEM(res_store.tls_require), 0, 0, 0},
-   {"tlsverifypeer",         store_bool,    ITEM(res_store.tls_verify_peer), 1, ITEM_DEFAULT, 1},
-   {"tlscacertificatefile",  store_dir,       ITEM(res_store.tls_ca_certfile), 0, 0, 0},
-   {"tlscacertificatedir",   store_dir,       ITEM(res_store.tls_ca_certdir), 0, 0, 0},
-   {"tlscertificate",        store_dir,       ITEM(res_store.tls_certfile), 0, 0, 0},
-   {"tlskey",                store_dir,       ITEM(res_store.tls_keyfile), 0, 0, 0},
-   {"tlsdhfile",             store_dir,       ITEM(res_store.tls_dhfile), 0, 0, 0},
-   {"tlsallowedcn",          store_alist_str, ITEM(res_store.tls_allowed_cns), 0, 0, 0},
-   {"clientconnectwait",     store_time,  ITEM(res_store.client_wait), 0, ITEM_DEFAULT, 30 * 60},
-   {"verid",                 store_str,       ITEM(res_store.verid), 0, 0, 0},
+   {"Name",                  store_name, ITEM(res_store.hdr.name),   0, ITEM_REQUIRED, 0},
+   {"Description",           store_str,  ITEM(res_dir.hdr.desc),     0, 0, 0},
+   {"SdAddress",             store_addresses_address,  ITEM(res_store.sdaddrs),     0, ITEM_DEFAULT, 9103},
+   {"SdAddresses",           store_addresses,  ITEM(res_store.sdaddrs), 0, ITEM_DEFAULT, 9103},
+   {"Messages",              store_res,  ITEM(res_store.messages),   R_MSGS, 0, 0},
+   {"SdPort",                store_addresses_port,  ITEM(res_store.sdaddrs),     0, ITEM_DEFAULT, 9103},
+   {"WorkingDirectory",      store_dir,  ITEM(res_store.working_directory), 0, ITEM_REQUIRED, 0},
+   {"PidDirectory",          store_dir,  ITEM(res_store.pid_directory), 0, ITEM_REQUIRED, 0},
+   {"SubsysDirectory",       store_dir,  ITEM(res_store.subsys_directory), 0, 0, 0},
+   {"PluginDirectory",       store_dir,  ITEM(res_store.plugin_directory), 0, 0, 0},
+   {"ScriptsDirectory",      store_dir,  ITEM(res_store.scripts_directory), 0, 0, 0},
+   {"MaximumConcurrentJobs", store_pint32, ITEM(res_store.max_concurrent_jobs), 0, ITEM_DEFAULT, 20},
+   {"ClientConnectTimeout",  store_time, ITEM(res_store.ClientConnectTimeout), 0, ITEM_DEFAULT, 60 * 30},
+   {"HeartbeatInterval",     store_time, ITEM(res_store.heartbeat_interval), 0, ITEM_DEFAULT, 5 * 60},
+   {"TlsAuthenticate",       store_bool,    ITEM(res_store.tls_authenticate), 0, 0, 0},
+   {"TlsEnable",             store_bool,    ITEM(res_store.tls_enable), 0, 0, 0},
+   {"TlsRequire",            store_bool,    ITEM(res_store.tls_require), 0, 0, 0},
+   {"TlsVerifyPeer",         store_bool,    ITEM(res_store.tls_verify_peer), 1, ITEM_DEFAULT, 1},
+   {"TlsCaCertificateFile",  store_dir,       ITEM(res_store.tls_ca_certfile), 0, 0, 0},
+   {"TlsCaCertificateDir",   store_dir,       ITEM(res_store.tls_ca_certdir), 0, 0, 0},
+   {"TlsCertificate",        store_dir,       ITEM(res_store.tls_certfile), 0, 0, 0},
+   {"TlsKey",                store_dir,       ITEM(res_store.tls_keyfile), 0, 0, 0},
+   {"TlsDhFile",             store_dir,       ITEM(res_store.tls_dhfile), 0, 0, 0},
+   {"TlsAllowedCn",          store_alist_str, ITEM(res_store.tls_allowed_cns), 0, 0, 0},
+   {"ClientConnectWait",     store_time,  ITEM(res_store.client_wait), 0, ITEM_DEFAULT, 30 * 60},
+   {"VerId",                 store_str,   ITEM(res_store.verid), 0, 0, 0},
    {NULL, NULL, {0}, 0, 0, 0}
 };
 
 
 /* Directors that can speak to the Storage daemon */
 static RES_ITEM dir_items[] = {
-   {"name",        store_name,     ITEM(res_dir.hdr.name),   0, ITEM_REQUIRED, 0},
-   {"description", store_str,      ITEM(res_dir.hdr.desc),   0, 0, 0},
-   {"password",    store_password, ITEM(res_dir.password),   0, ITEM_REQUIRED, 0},
-   {"monitor",     store_bool,     ITEM(res_dir.monitor),    0, 0, 0},
-   {"tlsauthenticate",      store_bool,    ITEM(res_dir.tls_authenticate), 0, 0, 0},
-   {"tlsenable",            store_bool,    ITEM(res_dir.tls_enable), 0, 0, 0},
-   {"tlsrequire",           store_bool,    ITEM(res_dir.tls_require), 0, 0, 0},
-   {"tlsverifypeer",        store_bool,    ITEM(res_dir.tls_verify_peer), 1, ITEM_DEFAULT, 1},
-   {"tlscacertificatefile", store_dir,       ITEM(res_dir.tls_ca_certfile), 0, 0, 0},
-   {"tlscacertificatedir",  store_dir,       ITEM(res_dir.tls_ca_certdir), 0, 0, 0},
-   {"tlscertificate",       store_dir,       ITEM(res_dir.tls_certfile), 0, 0, 0},
-   {"tlskey",               store_dir,       ITEM(res_dir.tls_keyfile), 0, 0, 0},
-   {"tlsdhfile",            store_dir,       ITEM(res_dir.tls_dhfile), 0, 0, 0},
-   {"tlsallowedcn",         store_alist_str, ITEM(res_dir.tls_allowed_cns), 0, 0, 0},
+   {"Name",        store_name,     ITEM(res_dir.hdr.name),   0, ITEM_REQUIRED, 0},
+   {"Description", store_str,      ITEM(res_dir.hdr.desc),   0, 0, 0},
+   {"Password",    store_password, ITEM(res_dir.password),   0, ITEM_REQUIRED, 0},
+   {"Monitor",     store_bool,     ITEM(res_dir.monitor),    0, 0, 0},
+   {"TlsAuthenticate",      store_bool,    ITEM(res_dir.tls_authenticate), 0, 0, 0},
+   {"TlsEnable",            store_bool,    ITEM(res_dir.tls_enable), 0, 0, 0},
+   {"TlsRequire",           store_bool,    ITEM(res_dir.tls_require), 0, 0, 0},
+   {"TlsVerifyPeer",        store_bool,    ITEM(res_dir.tls_verify_peer), 1, ITEM_DEFAULT, 1},
+   {"TlsCaCertificateFile", store_dir,       ITEM(res_dir.tls_ca_certfile), 0, 0, 0},
+   {"TlsCaCertificateDir",  store_dir,       ITEM(res_dir.tls_ca_certdir), 0, 0, 0},
+   {"TlsCertificate",       store_dir,       ITEM(res_dir.tls_certfile), 0, 0, 0},
+   {"TlsKey",               store_dir,       ITEM(res_dir.tls_keyfile), 0, 0, 0},
+   {"TlsDhFile",            store_dir,       ITEM(res_dir.tls_dhfile), 0, 0, 0},
+   {"TlsAllowedCn",         store_alist_str, ITEM(res_dir.tls_allowed_cns), 0, 0, 0},
    {NULL, NULL, {0}, 0, 0, 0}
 };
 
 /* Device definition */
 static RES_ITEM dev_items[] = {
-   {"name",                  store_name,   ITEM(res_dev.hdr.name),    0, ITEM_REQUIRED, 0},
-   {"description",           store_str,    ITEM(res_dir.hdr.desc),    0, 0, 0},
-   {"mediatype",             store_strname,ITEM(res_dev.media_type),  0, ITEM_REQUIRED, 0},
-   {"devicetype",            store_devtype,ITEM(res_dev.dev_type),    0, 0, 0},
-   {"archivedevice",         store_strname,ITEM(res_dev.device_name), 0, ITEM_REQUIRED, 0},
-   {"hardwareendoffile",     store_bit,  ITEM(res_dev.cap_bits), CAP_EOF,  ITEM_DEFAULT, 1},
-   {"hardwareendofmedium",   store_bit,  ITEM(res_dev.cap_bits), CAP_EOM,  ITEM_DEFAULT, 1},
-   {"backwardspacerecord",   store_bit,  ITEM(res_dev.cap_bits), CAP_BSR,  ITEM_DEFAULT, 1},
-   {"backwardspacefile",     store_bit,  ITEM(res_dev.cap_bits), CAP_BSF,  ITEM_DEFAULT, 1},
-   {"bsfateom",              store_bit,  ITEM(res_dev.cap_bits), CAP_BSFATEOM, ITEM_DEFAULT, 0},
-   {"twoeof",                store_bit,  ITEM(res_dev.cap_bits), CAP_TWOEOF, ITEM_DEFAULT, 0},
-   {"forwardspacerecord",    store_bit,  ITEM(res_dev.cap_bits), CAP_FSR,  ITEM_DEFAULT, 1},
-   {"forwardspacefile",      store_bit,  ITEM(res_dev.cap_bits), CAP_FSF,  ITEM_DEFAULT, 1},
-   {"fastforwardspacefile",  store_bit,  ITEM(res_dev.cap_bits), CAP_FASTFSF, ITEM_DEFAULT, 1},
-   {"removablemedia",        store_bit,  ITEM(res_dev.cap_bits), CAP_REM,  ITEM_DEFAULT, 1},
-   {"randomaccess",          store_bit,  ITEM(res_dev.cap_bits), CAP_RACCESS, 0, 0},
-   {"automaticmount",        store_bit,  ITEM(res_dev.cap_bits), CAP_AUTOMOUNT,  ITEM_DEFAULT, 0},
-   {"labelmedia",            store_bit,  ITEM(res_dev.cap_bits), CAP_LABEL,      ITEM_DEFAULT, 0},
-   {"alwaysopen",            store_bit,  ITEM(res_dev.cap_bits), CAP_ALWAYSOPEN, ITEM_DEFAULT, 1},
-   {"autochanger",           store_bit,  ITEM(res_dev.cap_bits), CAP_AUTOCHANGER, ITEM_DEFAULT, 0},
-   {"closeonpoll",           store_bit,  ITEM(res_dev.cap_bits), CAP_CLOSEONPOLL, ITEM_DEFAULT, 0},
-   {"blockpositioning",      store_bit,  ITEM(res_dev.cap_bits), CAP_POSITIONBLOCKS, ITEM_DEFAULT, 1},
-   {"usemtiocget",           store_bit,  ITEM(res_dev.cap_bits), CAP_MTIOCGET, ITEM_DEFAULT, 1},
-   {"checklabels",           store_bit,  ITEM(res_dev.cap_bits), CAP_CHECKLABELS, ITEM_DEFAULT, 0},
-   {"requiresmount",         store_bit,  ITEM(res_dev.cap_bits), CAP_REQMOUNT, ITEM_DEFAULT, 0},
-   {"offlineonunmount",      store_bit,  ITEM(res_dev.cap_bits), CAP_OFFLINEUNMOUNT, ITEM_DEFAULT, 0},
-   {"blockchecksum",         store_bit,  ITEM(res_dev.cap_bits), CAP_BLOCKCHECKSUM, ITEM_DEFAULT, 1},
-   {"autoselect",            store_bool, ITEM(res_dev.autoselect), 1, ITEM_DEFAULT, 1},
-   {"readonly",              store_bool, ITEM(res_dev.read_only), 1, ITEM_DEFAULT, 0},
-   {"changerdevice",         store_strname,ITEM(res_dev.changer_name), 0, 0, 0},
-   {"changercommand",        store_strname,ITEM(res_dev.changer_command), 0, 0, 0},
-   {"alertcommand",          store_strname,ITEM(res_dev.alert_command), 0, 0, 0},
-   {"maximumchangerwait",    store_time,   ITEM(res_dev.max_changer_wait), 0, ITEM_DEFAULT, 5 * 60},
-   {"maximumopenwait",       store_time,   ITEM(res_dev.max_open_wait), 0, ITEM_DEFAULT, 5 * 60},
-   {"maximumnetworkbuffersize", store_pint32, ITEM(res_dev.max_network_buffer_size), 0, 0, 0},
-   {"volumepollinterval",    store_time,   ITEM(res_dev.vol_poll_interval), 0, ITEM_DEFAULT, 5 * 60},
-   {"maximumrewindwait",     store_time,   ITEM(res_dev.max_rewind_wait), 0, ITEM_DEFAULT, 5 * 60},
-   {"minimumblocksize",      store_pint32,   ITEM(res_dev.min_block_size), 0, 0, 0},
-   {"maximumblocksize",      store_maxblocksize, ITEM(res_dev.max_block_size), 0, 0, 0},
-   {"maximumvolumesize",     store_size64,   ITEM(res_dev.max_volume_size), 0, 0, 0},
-   {"maximumfilesize",       store_size64,   ITEM(res_dev.max_file_size), 0, ITEM_DEFAULT, 1000000000},
-   {"volumecapacity",        store_size64,   ITEM(res_dev.volume_capacity), 0, 0, 0},
-   {"maximumconcurrentjobs", store_pint32, ITEM(res_dev.max_concurrent_jobs), 0, 0, 0},
-   {"spooldirectory",        store_dir,    ITEM(res_dev.spool_directory), 0, 0, 0},
-   {"maximumspoolsize",      store_size64,   ITEM(res_dev.max_spool_size), 0, 0, 0},
-   {"maximumjobspoolsize",   store_size64,   ITEM(res_dev.max_job_spool_size), 0, 0, 0},
-   {"driveindex",            store_pint32,   ITEM(res_dev.drive_index), 0, 0, 0},
-   {"maximumpartsize",       store_size64,   ITEM(res_dev.max_part_size), 0, ITEM_DEFAULT, 0},
-   {"mountpoint",            store_strname,ITEM(res_dev.mount_point), 0, 0, 0},
-   {"mountcommand",          store_strname,ITEM(res_dev.mount_command), 0, 0, 0},
-   {"unmountcommand",        store_strname,ITEM(res_dev.unmount_command), 0, 0, 0},
-   {"writepartcommand",      store_strname,ITEM(res_dev.write_part_command), 0, 0, 0},
-   {"freespacecommand",      store_strname,ITEM(res_dev.free_space_command), 0, 0, 0},
-   {"labeltype",             store_label,  ITEM(res_dev.label_type), 0, 0, 0},
+   {"Name",                  store_name,   ITEM(res_dev.hdr.name),    0, ITEM_REQUIRED, 0},
+   {"Description",           store_str,    ITEM(res_dir.hdr.desc),    0, 0, 0},
+   {"MediaType",             store_strname,ITEM(res_dev.media_type),  0, ITEM_REQUIRED, 0},
+   {"DeviceType",            store_devtype,ITEM(res_dev.dev_type),    0, 0, 0},
+   {"ArchiveDevice",         store_strname,ITEM(res_dev.device_name), 0, ITEM_REQUIRED, 0},
+   {"HardwareEndOfFile",     store_bit,  ITEM(res_dev.cap_bits), CAP_EOF,  ITEM_DEFAULT, 1},
+   {"HardwareEndOfMedium",   store_bit,  ITEM(res_dev.cap_bits), CAP_EOM,  ITEM_DEFAULT, 1},
+   {"BackwardSpaceRecord",   store_bit,  ITEM(res_dev.cap_bits), CAP_BSR,  ITEM_DEFAULT, 1},
+   {"BackwardSpaceFile",     store_bit,  ITEM(res_dev.cap_bits), CAP_BSF,  ITEM_DEFAULT, 1},
+   {"BsfAtEom",              store_bit,  ITEM(res_dev.cap_bits), CAP_BSFATEOM, ITEM_DEFAULT, 0},
+   {"TwoEof",                store_bit,  ITEM(res_dev.cap_bits), CAP_TWOEOF, ITEM_DEFAULT, 0},
+   {"ForwardSpaceRecord",    store_bit,  ITEM(res_dev.cap_bits), CAP_FSR,  ITEM_DEFAULT, 1},
+   {"ForwardSpaceFile",      store_bit,  ITEM(res_dev.cap_bits), CAP_FSF,  ITEM_DEFAULT, 1},
+   {"FastForwardSpaceFile",  store_bit,  ITEM(res_dev.cap_bits), CAP_FASTFSF, ITEM_DEFAULT, 1},
+   {"RemovableMedia",        store_bit,  ITEM(res_dev.cap_bits), CAP_REM,  ITEM_DEFAULT, 1},
+   {"RandomAccess",          store_bit,  ITEM(res_dev.cap_bits), CAP_RACCESS, 0, 0},
+   {"AutomaticMount",        store_bit,  ITEM(res_dev.cap_bits), CAP_AUTOMOUNT,  ITEM_DEFAULT, 0},
+   {"LabelMedia",            store_bit,  ITEM(res_dev.cap_bits), CAP_LABEL,      ITEM_DEFAULT, 0},
+   {"AlwaysOpen",            store_bit,  ITEM(res_dev.cap_bits), CAP_ALWAYSOPEN, ITEM_DEFAULT, 1},
+   {"Autochanger",           store_bit,  ITEM(res_dev.cap_bits), CAP_AUTOCHANGER, ITEM_DEFAULT, 0},
+   {"CloseOnPoll",           store_bit,  ITEM(res_dev.cap_bits), CAP_CLOSEONPOLL, ITEM_DEFAULT, 0},
+   {"BlockPositioning",      store_bit,  ITEM(res_dev.cap_bits), CAP_POSITIONBLOCKS, ITEM_DEFAULT, 1},
+   {"UseMtiocGet",           store_bit,  ITEM(res_dev.cap_bits), CAP_MTIOCGET, ITEM_DEFAULT, 1},
+   {"CheckLabels",           store_bit,  ITEM(res_dev.cap_bits), CAP_CHECKLABELS, ITEM_DEFAULT, 0},
+   {"RequiresMount",         store_bit,  ITEM(res_dev.cap_bits), CAP_REQMOUNT, ITEM_DEFAULT, 0},
+   {"OfflineOnUnmount",      store_bit,  ITEM(res_dev.cap_bits), CAP_OFFLINEUNMOUNT, ITEM_DEFAULT, 0},
+   {"BlockChecksum",         store_bit,  ITEM(res_dev.cap_bits), CAP_BLOCKCHECKSUM, ITEM_DEFAULT, 1},
+   {"Enabled",               store_bool, ITEM(res_dev.enabled), 0, ITEM_DEFAULT, 1},
+   {"AutoSelect",            store_bool, ITEM(res_dev.autoselect), 0, ITEM_DEFAULT, 1},
+   {"ReadOnly",              store_bool, ITEM(res_dev.read_only), 0, ITEM_DEFAULT, 0},
+   {"ChangerDevice",         store_strname,ITEM(res_dev.changer_name), 0, 0, 0},
+   {"ControlDevice",         store_strname,ITEM(res_dev.control_name), 0, 0, 0},
+   {"ChangerCommand",        store_strname,ITEM(res_dev.changer_command), 0, 0, 0},
+   {"AlertCommand",          store_strname,ITEM(res_dev.alert_command), 0, 0, 0},
+   {"MaximumChangerWait",    store_time,   ITEM(res_dev.max_changer_wait), 0, ITEM_DEFAULT, 5 * 60},
+   {"MaximumOpenWait",       store_time,   ITEM(res_dev.max_open_wait), 0, ITEM_DEFAULT, 5 * 60},
+   {"MaximumNetworkBufferSize", store_pint32, ITEM(res_dev.max_network_buffer_size), 0, 0, 0},
+   {"VolumePollInterval",    store_time,   ITEM(res_dev.vol_poll_interval), 0, ITEM_DEFAULT, 5 * 60},
+   {"MaximumRewindWait",     store_time,   ITEM(res_dev.max_rewind_wait), 0, ITEM_DEFAULT, 5 * 60},
+   {"MinimumBlockSize",      store_size32, ITEM(res_dev.min_block_size), 0, 0, 0},
+   {"MaximumBlockSize",      store_maxblocksize, ITEM(res_dev.max_block_size), 0, 0, 0},
+   {"PaddingSize",           store_size32, ITEM(res_dev.padding_size), 0, ITEM_DEFAULT, 4096},
+   {"FileAlignment",         store_size32, ITEM(res_dev.file_alignment), 0, ITEM_DEFAULT, 4096},
+   {"MaximumVolumeSize",     store_size64, ITEM(res_dev.max_volume_size), 0, 0, 0},
+   {"MaximumFileSize",       store_size64, ITEM(res_dev.max_file_size), 0, ITEM_DEFAULT, 1000000000},
+   {"VolumeCapacity",        store_size64, ITEM(res_dev.volume_capacity), 0, 0, 0},
+   {"MinimumFeeSpace",       store_size64, ITEM(res_dev.min_free_space), 0, ITEM_DEFAULT, 5000000},
+   {"MaximumConcurrentJobs", store_pint32, ITEM(res_dev.max_concurrent_jobs), 0, 0, 0},
+   {"SpoolDirectory",        store_dir,    ITEM(res_dev.spool_directory), 0, 0, 0},
+   {"MaximumSpoolSize",      store_size64, ITEM(res_dev.max_spool_size), 0, 0, 0},
+   {"MaximumJobSpoolSize",   store_size64, ITEM(res_dev.max_job_spool_size), 0, 0, 0},
+   {"DriveIndex",            store_pint32, ITEM(res_dev.drive_index), 0, 0, 0},
+   {"MaximumPartSize",       store_size64, ITEM(res_dev.max_part_size), 0, ITEM_DEFAULT, 0},
+   {"MountPoint",            store_strname,ITEM(res_dev.mount_point), 0, 0, 0},
+   {"MountCommand",          store_strname,ITEM(res_dev.mount_command), 0, 0, 0},
+   {"UnmountCommand",        store_strname,ITEM(res_dev.unmount_command), 0, 0, 0},
+   {"WritePartCommand",      store_strname,ITEM(res_dev.write_part_command), 0, 0, 0},
+   {"FreeSpaceCommand",      store_strname,ITEM(res_dev.free_space_command), 0, 0, 0},
+   {"LabelType",             store_label,  ITEM(res_dev.label_type), 0, 0, 0},
    {NULL, NULL, {0}, 0, 0, 0}
 };
 
 /* Autochanger definition */
 static RES_ITEM changer_items[] = {
-   {"name",              store_name,      ITEM(res_changer.hdr.name),        0, ITEM_REQUIRED, 0},
-   {"description",       store_str,       ITEM(res_changer.hdr.desc),        0, 0, 0},
-   {"device",            store_alist_res, ITEM(res_changer.device),   R_DEVICE, ITEM_REQUIRED, 0},
-   {"changerdevice",     store_strname,   ITEM(res_changer.changer_name),    0, ITEM_REQUIRED, 0},
-   {"changercommand",    store_strname,   ITEM(res_changer.changer_command), 0, ITEM_REQUIRED, 0},
+   {"Name",              store_name,      ITEM(res_changer.hdr.name),        0, ITEM_REQUIRED, 0},
+   {"Description",       store_str,       ITEM(res_changer.hdr.desc),        0, 0, 0},
+   {"Device",            store_alist_res, ITEM(res_changer.device),   R_DEVICE, ITEM_REQUIRED, 0},
+   {"ChangerDevice",     store_strname,   ITEM(res_changer.changer_name),    0, ITEM_REQUIRED, 0},
+   {"ChangerCommand",    store_strname,   ITEM(res_changer.changer_command), 0, ITEM_REQUIRED, 0},
    {NULL, NULL, {0}, 0, 0, 0}
 };
 
@@ -174,11 +186,11 @@ extern RES_ITEM msgs_items[];
 
 /* This is the master resource definition */
 RES_TABLE resources[] = {
-   {"director",      dir_items,     R_DIRECTOR},
-   {"storage",       store_items,   R_STORAGE},
-   {"device",        dev_items,     R_DEVICE},
-   {"messages",      msgs_items,    R_MSGS},
-   {"autochanger",   changer_items, R_AUTOCHANGER},
+   {"Director",      dir_items,     R_DIRECTOR},
+   {"Storage",       store_items,   R_STORAGE},
+   {"Device",        dev_items,     R_DEVICE},
+   {"Messages",      msgs_items,    R_MSGS},
+   {"Autochanger",   changer_items, R_AUTOCHANGER},
    {NULL,            NULL,          0}
 };
 
@@ -187,18 +199,13 @@ RES_TABLE resources[] = {
  *
  *   device type     device code = token
  */
-struct s_kw {
-   const char *name;
-   int32_t token;
-};
-
-static s_kw dev_types[] = {
-   {"file",          B_FILE_DEV},
-   {"tape",          B_TAPE_DEV},
-   {"dvd",           B_DVD_DEV},
-   {"fifo",          B_FIFO_DEV},
-   {"vtl",           B_VTL_DEV},
-   {"vtape",         B_VTAPE_DEV},
+s_kw dev_types[] = {
+   {"File",          B_FILE_DEV},
+   {"Tape",          B_TAPE_DEV},
+   {"Dvd",           B_DVD_DEV},
+   {"Fifo",          B_FIFO_DEV},
+   {"Vtl",           B_VTL_DEV},
+   {"VTape",         B_VTAPE_DEV},
    {NULL,            0}
 };
 
@@ -240,11 +247,10 @@ void store_maxblocksize(LEX *lc, RES_ITEM *item, int index, int pass)
    }
 }
 
-
 /* Dump contents of resource */
-void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fmt, ...), void *sock)
+void dump_resource(int type, RES *rres, void sendit(void *sock, const char *fmt, ...), void *sock)
 {
-   URES *res = (URES *)reshdr;
+   URES *res = (URES *)rres;
    char buf[1000];
    int recurse = 1;
    IPADDR *p;
@@ -286,16 +292,18 @@ void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fm
          res->res_dev.hdr.name,
          res->res_dev.media_type, res->res_dev.device_name,
          res->res_dev.label_type);
-      sendit(sock, "        rew_wait=%" lld " min_bs=%d max_bs=%d chgr_wait=%" lld "\n",
+      sendit(sock, "        rew_wait=%lld min_bs=%d max_bs=%d chgr_wait=%lld\n",
          res->res_dev.max_rewind_wait, res->res_dev.min_block_size,
          res->res_dev.max_block_size, res->res_dev.max_changer_wait);
-      sendit(sock, "        max_jobs=%d max_files=%" lld " max_size=%" lld "\n",
+      sendit(sock, "        max_jobs=%d max_files=%lld max_size=%lld\n",
          res->res_dev.max_volume_jobs, res->res_dev.max_volume_files,
          res->res_dev.max_volume_size);
-      sendit(sock, "        max_file_size=%" lld " capacity=%" lld "\n",
+      sendit(sock, "        min_block_size=%lld max_block_size=%lld\n",
+         res->res_dev.min_block_size, res->res_dev.max_block_size);
+      sendit(sock, "        max_file_size=%lld capacity=%lld\n",
          res->res_dev.max_file_size, res->res_dev.volume_capacity);
       sendit(sock, "        spool_directory=%s\n", NPRT(res->res_dev.spool_directory));
-      sendit(sock, "        max_spool_size=%" lld " max_job_spool_size=%" lld "\n",
+      sendit(sock, "        max_spool_size=%lld max_job_spool_size=%lld\n",
          res->res_dev.max_spool_size, res->res_dev.max_job_spool_size);
       if (res->res_dev.changer_res) {
          sendit(sock, "         changer=%p\n", res->res_dev.changer_res);
@@ -371,8 +379,9 @@ void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fm
       sendit(sock, _("Warning: unknown resource type %d\n"), type);
       break;
    }
-   if (recurse && res->res_dir.hdr.next)
+   if (recurse && res->res_dir.hdr.next) {
       dump_resource(type, (RES *)res->res_dir.hdr.next, sendit, sock);
+   }
 }
 
 /*
@@ -496,6 +505,9 @@ void free_resource(RES *sres, int type)
       if (res->res_dev.device_name) {
          free(res->res_dev.device_name);
       }
+      if (res->res_dev.control_name) {
+         free(res->res_dev.control_name);
+      }
       if (res->res_dev.changer_name) {
          free(res->res_dev.changer_name);
       }
@@ -678,7 +690,7 @@ void save_resource(int type, RES_ITEM *items, int pass)
             last = next;
             if (strcmp(next->name, res->res_dir.hdr.name) == 0) {
                Emsg2(M_ERROR_TERM, 0,
-                  _("Attempt to define second \"%s\" resource named \"%s\" is not permitted.\n"),
+                  _("Attempt to define second %s resource named \"%s\" is not permitted.\n"),
                   resources[rindex].name, res->res_dir.hdr.name);
             }
          }
diff --git a/src/stored/stored_conf.h b/src/stored/stored_conf.h
index 98c2925..a262f1f 100644
--- a/src/stored/stored_conf.h
+++ b/src/stored/stored_conf.h
@@ -1,19 +1,24 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 
+extern s_kw dev_types[];
 
 /*
  * Resource codes -- they must be sequential for indexing
@@ -91,6 +96,7 @@ public:
    alist *tls_allowed_cns;            /* TLS Allowed Clients */
    char *verid;                       /* Custom Id to print in version command */
    TLS_CONTEXT *tls_ctx;              /* Shared TLS Context */
+
 };
 typedef class s_res_store STORES;
 
@@ -117,6 +123,7 @@ public:
    char *spool_directory;             /* Spool file directory */
    uint32_t dev_type;                 /* device type */
    uint32_t label_type;               /* label type */
+   bool enabled;                      /* Set when enabled (default) */
    bool autoselect;                   /* Automatically select from AutoChanger */
    bool read_only;                    /* Drive is read only */
    uint32_t drive_index;              /* Autochanger drive index */
@@ -124,6 +131,8 @@ public:
    utime_t max_changer_wait;          /* Changer timeout */
    utime_t max_rewind_wait;           /* maximum secs to wait for rewind */
    utime_t max_open_wait;             /* maximum secs to wait for open */
+   uint32_t padding_size;             /* adata block padding -- bytes */
+   uint32_t file_alignment;           /* adata file alignment -- bytes */
    uint32_t min_block_size;           /* min block size */
    uint32_t max_block_size;           /* max block size */
    uint32_t max_volume_jobs;          /* max jobs to put on one volume */
diff --git a/src/stored/tape_dev.c b/src/stored/tape_dev.c
index 281b85a..0119ee0 100644
--- a/src/stored/tape_dev.c
+++ b/src/stored/tape_dev.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -895,7 +899,6 @@ bool tape_dev::reposition(DCR *dcr, uint32_t rfile, uint32_t rblock)
    return true;
 }
 
-
 /*
  * Write an end of file on the device
  *   Returns: true on success
@@ -945,9 +948,39 @@ bool DEVICE::weof(int num)
 }
 
 /*
+ * If timeout, wait until the mount command returns 0.
+ * If !timeout, try to mount the device only once.
+ */
+bool tape_dev::mount(int timeout)
+{
+   Dmsg0(190, "Enter tape mount\n");
+
+   if (!is_mounted() && device->mount_command) {
+      return mount_tape(1, timeout);
+   }
+   return true;
+}
+
+/*
+ * Unmount the device
+ * If timeout, wait until the unmount command returns 0.
+ * If !timeout, try to unmount the device only once.
+ */
+bool tape_dev::unmount(int timeout)
+{
+   Dmsg0(100, "Enter tape  unmount\n");
+
+   if (!is_mounted() && requires_mount() && device->unmount_command) {
+      return mount_tape(0, timeout);
+   }
+   return true;
+}
+
+
+/*
  * (Un)mount the device (for tape devices)
  */
-bool DEVICE::do_tape_mount(int mount, int dotimeout)
+bool tape_dev::mount_tape(int mount, int dotimeout)
 {
    POOL_MEM ocmd(PM_FNAME);
    POOLMEM *results;
@@ -964,7 +997,7 @@ bool DEVICE::do_tape_mount(int mount, int dotimeout)
 
    edit_mount_codes(ocmd, icmd);
 
-   Dmsg2(100, "do_tape_mount: cmd=%s mounted=%d\n", ocmd.c_str(), !!is_mounted());
+   Dmsg2(100, "mount_tape: cmd=%s mounted=%d\n", ocmd.c_str(), !!is_mounted());
 
    if (dotimeout) {
       /* Try at most 10 times to (un)mount the device. This should perhaps be configurable. */
@@ -975,7 +1008,7 @@ bool DEVICE::do_tape_mount(int mount, int dotimeout)
    results = get_memory(4000);
 
    /* If busy retry each second */
-   Dmsg1(100, "do_tape_mount run_prog=%s\n", ocmd.c_str());
+   Dmsg1(100, "mount_tape run_prog=%s\n", ocmd.c_str());
    while ((status = run_program_full_output(ocmd.c_str(), max_open_wait/2, results)) != 0) {
       if (tries-- > 0) {
          continue;
diff --git a/src/stored/tape_dev.h b/src/stored/tape_dev.h
index f6e087b..c4dd9ce 100644
--- a/src/stored/tape_dev.h
+++ b/src/stored/tape_dev.h
@@ -1,17 +1,21 @@
-/*
-   Bacula® - The Network Backup Solution
+/*                                                              [vssfs.c] IQ
+   Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2014-2014 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Inspired by vtape.h
@@ -34,6 +38,9 @@ public:
    void lock_door();
    void unlock_door();
    bool reposition(DCR *dcr, uint32_t rfile, uint32_t rblock);
+   bool mount(int timeout);
+   bool unmount(int timeout);
+   bool mount_tape(int mount, int dotimeout);
 };
 
 #endif /* __TAPE_DEV_ */
diff --git a/src/stored/vbackup.c b/src/stored/vbackup.c
index a8ae560..b5715d3 100644
--- a/src/stored/vbackup.c
+++ b/src/stored/vbackup.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2006-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * SD -- vbackup.c --  responsible for doing virtual backup jobs.
@@ -87,7 +91,6 @@ bool do_vbackup(JCR *jcr)
    }
 
    Dmsg2(200, "===== After acquire pos %u:%u\n", jcr->dcr->dev->file, jcr->dcr->dev->block_num);
-
    jcr->sendJobStatus(JS_Running);
 
    begin_data_spool(jcr->dcr);
@@ -98,6 +101,8 @@ bool do_vbackup(JCR *jcr)
    set_start_vol_position(jcr->dcr);
 
    jcr->JobFiles = 0;
+   jcr->dcr->set_ameta();
+   jcr->read_dcr->set_ameta();
    ok = read_records(jcr->read_dcr, record_cb, mount_next_read_volume);
    goto ok_out;
 
@@ -106,19 +111,20 @@ bail_out:
 
 ok_out:
    if (jcr->dcr) {
+      jcr->dcr->set_ameta();
       dev = jcr->dcr->dev;
       Dmsg1(100, "ok=%d\n", ok);
       if (ok || dev->can_write()) {
-         /* Flush out final partial block of this session */
-         if (!jcr->dcr->write_block_to_device()) {
+         /* Flush out final ameta partial block of this session */
+         if (!jcr->dcr->write_final_block_to_device()) {
             Jmsg2(jcr, M_FATAL, 0, _("Fatal append error on device %s: ERR=%s\n"),
                   dev->print_name(), dev->bstrerror());
-            Dmsg0(100, _("Set ok=FALSE after write_block_to_device.\n"));
+            Dmsg0(100, _("Set ok=FALSE after write_final_block_to_device.\n"));
             ok = false;
          }
          Dmsg2(200, "Flush block to device pos %u:%u\n", dev->file, dev->block_num);
       }
-
+      flush_jobmedia_queue(jcr);
       if (!ok) {
          discard_data_spool(jcr->dcr);
       } else {
@@ -140,12 +146,6 @@ ok_out:
             job_elapsed / 3600, job_elapsed % 3600 / 60, job_elapsed % 60,
             edit_uint64_with_suffix(jcr->JobBytes / job_elapsed, ec1));
 
-#ifdef BUILD_DVD
-      if (ok && dev->is_dvd()) {
-         ok = dvd_close_job(jcr->dcr);   /* do DVD cleanup if any */
-      }
-#endif
-
       /* Release the device -- and send final Vol info to DIR */
       release_device(jcr->dcr);
 
@@ -193,16 +193,15 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec)
    JCR *jcr = dcr->jcr;
    DEVICE *dev = jcr->dcr->dev;
    char buf1[100], buf2[100];
+   bool     restoredatap = false;
+   POOLMEM *orgdata = NULL;
+   uint32_t orgdata_len = 0;
+   bool ret = false;
 
-#ifdef xxx
-   Pmsg5(000, "on entry     JobId=%d FI=%s SessId=%d Strm=%s len=%d\n",
-      jcr->JobId,
-      FI_to_ascii(buf1, rec->FileIndex), rec->VolSessionId,
-      stream_to_ascii(buf2, rec->Stream, rec->FileIndex), rec->data_len);
-#endif
    /* If label and not for us, discard it */
    if (rec->FileIndex < 0 && rec->match_stat <= 0) {
-      return true;
+      ret = true;
+      goto bail_out;
    }
    /* We want to write SOS_LABEL and EOS_LABEL discard all others */
    switch (rec->FileIndex) {
@@ -210,7 +209,8 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec)
    case VOL_LABEL:
    case EOT_LABEL:
    case EOM_LABEL:
-      return true;                    /* don't write vol labels */
+      ret = true;                    /* don't write vol labels */
+      goto bail_out;
    }
 
    /*
@@ -244,16 +244,18 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec)
       jcr->JobId,
       FI_to_ascii(buf1, rec->FileIndex), rec->VolSessionId,
       stream_to_ascii(buf2, rec->Stream, rec->FileIndex), rec->data_len);
+
    if (!jcr->dcr->write_record(rec)) {
       Jmsg2(jcr, M_FATAL, 0, _("Fatal append error on device %s: ERR=%s\n"),
             dev->print_name(), dev->bstrerror());
-      return false;
+      goto bail_out;
    }
    /* Restore packet */
    rec->VolSessionId = rec->last_VolSessionId;
    rec->VolSessionTime = rec->last_VolSessionTime;
    if (rec->FileIndex < 0) {
-      return true;                    /* don't send LABELs to Dir */
+      ret = true;                    /* don't send LABELs to Dir */
+      goto bail_out;
    }
    jcr->JobBytes += rec->data_len;   /* increment bytes this job */
    Dmsg5(500, "wrote_record JobId=%d FI=%s SessId=%d Strm=%s len=%d\n",
@@ -262,6 +264,12 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec)
       stream_to_ascii(buf2, rec->Stream, rec->FileIndex), rec->data_len);
 
    send_attrs_to_dir(jcr, rec);
+   ret = true;
 
-   return true;
+bail_out:
+   if (restoredatap) {
+      rec->data = orgdata;
+      rec->data_len = orgdata_len;
+   }
+   return ret;
 }
diff --git a/src/stored/vol_mgr.c b/src/stored/vol_mgr.c
index 31bf14a..0b71154 100644
--- a/src/stored/vol_mgr.c
+++ b/src/stored/vol_mgr.c
@@ -1,22 +1,26 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *   Volume management functions for Storage Daemon
  *
- *   Written by Kern Sibbald, MM
+ *   Kern Sibbald, MM
  *
  *   Split from reserve.c October 2008
  *
@@ -503,26 +507,27 @@ VOLRES *reserve_volume(DCR *dcr, const char *VolumeName)
             if (dev) {
                Jmsg8(jcr, M_WARNING, 0, "Need volume for %s from other drive, "
                   "but swap not possible. Status: reader=%d writers=%d "
-                  "reserves=%d swap=%d vol=%s from dev=%s to %s\n", 
+                  "reserves=%d swap=%d vol=%s from dev=%s to %s\n",
                   dcr->is_writing()?"write":"read",
                   vol->dev->can_read(), vol->dev->num_writers,
                   vol->dev->num_reserved(), vol->is_swapping(),
                   VolumeName, vol->dev->print_name(), dev->print_name());
             }
             if (vol->is_swapping()) {
-               if (vol->dev && vol->dev->swap_dev && dev && dev->swap_dev) {
+               DEVICE *swapdev = dev->swap_dev;
+               if (vol && dev && swapdev) {
                   Mmsg3(jcr->errmsg, _("Volume %s is busy swapping from %s to %s\n"),
-                     vol->vol_name, dev->print_name(), dev->swap_dev->print_name());
+                     NPRT(vol->vol_name), dev->print_name(), swapdev->print_name());
                } else {
                   Mmsg1(jcr->errmsg, _("Volume %s is busy swapping.\n"),
-                     vol->vol_name);
+                     NPRT(vol->vol_name));
                }
             } else if (vol->dev) {
-               Mmsg2(jcr->errmsg, _("%s device %s is busy.\n"), 
+               Mmsg2(jcr->errmsg, _("%s device %s is busy.\n"),
                   vol->dev->print_type(), vol->dev->print_name());
             } else {
                Mmsg1(jcr->errmsg, _("Volume %s is busy swapping.\n"),
-                  vol->vol_name);
+                  NPRT(vol->vol_name));
             }
             debug_list_volumes("failed swap");
             vol = NULL;                  /* device busy */
diff --git a/src/stored/vol_mgr.h b/src/stored/vol_mgr.h
index a065f3f..f492c11 100644
--- a/src/stored/vol_mgr.h
+++ b/src/stored/vol_mgr.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Pulled out of dev.h
diff --git a/src/stored/vtape_dev.c b/src/stored/vtape_dev.c
index d50cc2b..429d4bd 100644
--- a/src/stored/vtape_dev.c
+++ b/src/stored/vtape_dev.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2008-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 
 /*
@@ -436,11 +440,13 @@ int vtape::weof()
    ASSERT(online);
    ASSERT(current_file >= 0);
 
+#if 0
    if (atEOT) {
       errno = ENOSPC;
       current_block = -1;
       return -1;
    }
+#endif
 
    if (!atEOD) {
       truncate_file();             /* nothing after this point */
@@ -882,8 +888,6 @@ int vtape::d_open(const char *pathname, int uflags)
    struct flock lock;
    struct stat statp;
 
-   ASSERT(!m_shstore || (m_shstore_lock && m_shstore_register));
-
    if (stat(pathname, &statp) != 0) {
       fd = -1;
       Dmsg1(dbglevel, "Can't stat on %s\n", pathname);
diff --git a/src/stored/vtape_dev.h b/src/stored/vtape_dev.h
index 98c0940..a53738d 100644
--- a/src/stored/vtape_dev.h
+++ b/src/stored/vtape_dev.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2008-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * vtape.h - Emulate the Linux st (scsi tape) driver on file.
@@ -105,12 +109,12 @@ public:
 class vtape: public DEVICE {
 public:
    int d_open(const char *pathname, int flags) { return -1; }
-   ssize_t d_read(void *buffer, size_t count) { return -1; }
-   ssize_t d_write(const void *buffer, size_t count) { return -1; }
+   ssize_t d_read(int fd, void *buffer, size_t count) { return -1; }
+   ssize_t d_write(int fd, const void *buffer, size_t count) { return -1; }
    int d_close(int) { return -1; }
    int d_ioctl(int fd, ioctl_req_t request, char *mt=NULL) { return -1; }
    boffset_t lseek(DCR *dcr, off_t offset, int whence) { return -1; }
-};
+}; 
 
 #endif  /* USE_VTAPE */
 
diff --git a/src/stored/wait.c b/src/stored/wait.c
index e74c7bc..018ed13 100644
--- a/src/stored/wait.c
+++ b/src/stored/wait.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *  Subroutines to handle waiting for operator intervention
diff --git a/src/streams.h b/src/streams.h
index d85adf7..d1db5b4 100644
--- a/src/streams.h
+++ b/src/streams.h
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /**
  * Stream definitions.  Split from baconfig.h Nov 2010
@@ -36,7 +40,7 @@
 #define STREAMBITS_TYPE               11         /* type bit size */
 #define STREAMMASK_TYPE               (~((~0)<< STREAMBITS_TYPE) << STREAMBASE_TYPE)
 /*
- * Note additional base, bits, and masks can be defined for new
+ * Note additional base, bits, and masks can be defined for new     
  *  ranges or subranges of stream attributes.
  */
 
@@ -85,9 +89,11 @@
 #define STREAM_PLUGIN_NAME                 26    /* Plugin "file" string */
 #define STREAM_PLUGIN_DATA                 27    /* Plugin specific data */
 #define STREAM_RESTORE_OBJECT              28    /* Plugin restore object */
-/* Non GZip compressed streams. Those streams can handle arbitrary compression algorithm data
- * as an additional header is stored at the beginning of the stream.
- * see stream_compressed_header definition for more details.
+/*
+ * Non-gzip compressed streams. Those streams can handle arbitrary 
+ *  compression algorithm data as an additional header is stored 
+ *  at the beginning of the stream. See comp_stream_header definition 
+ *  in ch.h for more details.
  */
 #define STREAM_COMPRESSED_DATA                 29    /* Compressed file data */
 #define STREAM_SPARSE_COMPRESSED_DATA          30    /* Sparse compressed data stream */
@@ -95,7 +101,7 @@
 #define STREAM_ENCRYPTED_FILE_COMPRESSED_DATA  32    /* Encrypted, compressed data */
 #define STREAM_ENCRYPTED_WIN32_COMPRESSED_DATA 33    /* Encrypted, compressed Win32 BackupRead data */
 
-/**
+/*
  * Additional Stream definitions. Once defined these must NEVER
  *   change as they go on the storage media.
  *
@@ -106,76 +112,39 @@
  * different acl streams from 1000 on and the different extended attributes streams from
  * 1999 down. So the two naming spaces grows towards each other.
  */
-#define STREAM_ACL_AIX_TEXT              1000    /* AIX specific string representation from acl_get */
-#define STREAM_ACL_DARWIN_ACCESS_ACL     1001    /* Darwin (OSX) specific acl_t string representation
-                                                  * from acl_to_text (POSIX acl)
-                                                  */
-#define STREAM_ACL_FREEBSD_DEFAULT_ACL   1002    /* FreeBSD specific acl_t string representation
-                                                  * from acl_to_text (POSIX acl) for default acls.
-                                                  */
-#define STREAM_ACL_FREEBSD_ACCESS_ACL    1003    /* FreeBSD specific acl_t string representation
-                                                  * from acl_to_text (POSIX acl) for access acls.
-                                                  */
-#define STREAM_ACL_HPUX_ACL_ENTRY        1004    /* HPUX specific acl_entry string representation
-                                                  * from acltostr (POSIX acl)
-                                                  */
-#define STREAM_ACL_IRIX_DEFAULT_ACL      1005    /* IRIX specific acl_t string representation
-                                                  * from acl_to_text (POSIX acl) for default acls.
-                                                  */
-#define STREAM_ACL_IRIX_ACCESS_ACL       1006    /* IRIX specific acl_t string representation
-                                                  * from acl_to_text (POSIX acl) for access acls.
-                                                  */
-#define STREAM_ACL_LINUX_DEFAULT_ACL     1007    /* Linux specific acl_t string representation
-                                                  * from acl_to_text (POSIX acl) for default acls.
-                                                  */
-#define STREAM_ACL_LINUX_ACCESS_ACL      1008    /* Linux specific acl_t string representation
-                                                  * from acl_to_text (POSIX acl) for access acls.
-                                                  */
-#define STREAM_ACL_TRU64_DEFAULT_ACL     1009    /* Tru64 specific acl_t string representation
-                                                  * from acl_to_text (POSIX acl) for default acls.
-                                                  */
-#define STREAM_ACL_TRU64_DEFAULT_DIR_ACL 1010    /* Tru64 specific acl_t string representation
-                                                  * from acl_to_text (POSIX acl) for default acls.
-                                                  */
-#define STREAM_ACL_TRU64_ACCESS_ACL      1011    /* Tru64 specific acl_t string representation
-                                                  * from acl_to_text (POSIX acl) for access acls.
-                                                  */
-#define STREAM_ACL_SOLARIS_ACLENT        1012    /* Solaris specific aclent_t string representation
-                                                  * from acltotext or acl_totext (POSIX acl)
-                                                  */
-#define STREAM_ACL_SOLARIS_ACE           1013    /* Solaris specific ace_t string representation from
-                                                  * from acl_totext (NFSv4 or ZFS acl)
-                                                  */
-#define STREAM_ACL_AFS_TEXT              1014    /* AFS specific string representation from pioctl */
-
-#define STREAM_ACL_AIX_AIXC              1015    /* AIX specific string representation from
-                                                  * aclx_printStr (POSIX acl)
-                                                  */
-#define STREAM_ACL_AIX_NFS4              1016    /* AIX specific string representation from
-                                                  * aclx_printStr (NFSv4 acl)
-                                                  */
-#define STREAM_ACL_FREEBSD_NFS4_ACL      1017    /* FreeBSD specific acl_t string representation
-                                                  * from acl_to_text (NFSv4 or ZFS acl)
-                                                  */
-#define STREAM_ACL_HURD_DEFAULT_ACL      1018    /* GNU HURD specific acl_t string representation
-                                                  * from acl_to_text (POSIX acl) for default acls.
-                                                  */
-#define STREAM_ACL_HURD_ACCESS_ACL       1019    /* GNU HURD specific acl_t string representation
-                                                  * from acl_to_text (POSIX acl) for access acls.
-                                                  */
-#define STREAM_XATTR_HURD                1989    /* GNU HURD specific extended attributes */
-#define STREAM_XATTR_IRIX                1990    /* IRIX specific extended attributes */
-#define STREAM_XATTR_TRU64               1991    /* TRU64 specific extended attributes */
-#define STREAM_XATTR_AIX                 1992    /* AIX specific extended attributes */
-#define STREAM_XATTR_OPENBSD             1993    /* OpenBSD specific extended attributes */
-#define STREAM_XATTR_SOLARIS_SYS         1994    /* Solaris specific extensible attributes or
-                                                  * otherwise named extended system attributes.
-                                                  */
-#define STREAM_XATTR_SOLARIS             1995    /* Solaris specific extented attributes */
-#define STREAM_XATTR_DARWIN              1996    /* Darwin (OSX) specific extended attributes */
-#define STREAM_XATTR_FREEBSD             1997    /* FreeBSD specific extended attributes */
-#define STREAM_XATTR_LINUX               1998    /* Linux specific extended attributes */
-#define STREAM_XATTR_NETBSD              1999    /* NetBSD specific extended attributes */
+#define STREAM_ACL_AIX_TEXT          1000    /* AIX string of acl_get */
+#define STREAM_ACL_DARWIN_ACCESS     1001    /* Darwin (OSX) acl_t string of acl_to_text (POSIX acl) */
+#define STREAM_ACL_FREEBSD_DEFAULT   1002    /* FreeBSD acl_t string of acl_to_text (POSIX acl) for default acls */
+#define STREAM_ACL_FREEBSD_ACCESS    1003    /* FreeBSD acl_t string of acl_to_text (POSIX acl) for access acls */
+#define STREAM_ACL_HPUX_ACL_ENTRY    1004    /* HPUX acl_entry string of acltostr (POSIX acl) */
+#define STREAM_ACL_IRIX_DEFAULT      1005    /* IRIX acl_t string of acl_to_text (POSIX acl) for default acls */
+#define STREAM_ACL_IRIX_ACCESS       1006    /* IRIX acl_t string of acl_to_text (POSIX acl) for access acls */
+#define STREAM_ACL_LINUX_DEFAULT     1007    /* Linux acl_t string of acl_to_text (POSIX acl) for default acls */
+#define STREAM_ACL_LINUX_ACCESS      1008    /* Linux acl_t string of acl_to_text (POSIX acl) for access acls */
+#define STREAM_ACL_TRU64_DEFAULT     1009    /* Tru64 acl_t string of acl_to_text (POSIX acl) for default acls */
+#define STREAM_ACL_TRU64_DEFAULT_DIR 1010    /* Tru64 acl_t string of acl_to_text (POSIX acl) for default acls */
+#define STREAM_ACL_TRU64_ACCESS      1011    /* Tru64 acl_t string of acl_to_text (POSIX acl) for access acls */
+#define STREAM_ACL_SOLARIS_POSIX     1012    /* Solaris aclent_t string of acltotext or acl_totext (POSIX acl) */
+#define STREAM_ACL_SOLARIS_NFS4      1013    /* Solaris ace_t string of of acl_totext (NFSv4 or ZFS acl) */
+#define STREAM_ACL_AFS_TEXT          1014    /* AFS string of pioctl */
+#define STREAM_ACL_AIX_AIXC          1015    /* AIX string of aclx_printStr (POSIX acl) */
+#define STREAM_ACL_AIX_NFS4          1016    /* AIX string of aclx_printStr (NFSv4 acl) */
+#define STREAM_ACL_FREEBSD_NFS4      1017    /* FreeBSD acl_t string of acl_to_text (NFSv4 or ZFS acl) */
+#define STREAM_ACL_HURD_DEFAULT      1018    /* GNU HURD acl_t string of acl_to_text (POSIX acl) for default acls */
+#define STREAM_ACL_HURD_ACCESS       1019    /* GNU HURD acl_t string of acl_to_text (POSIX acl) for access acls */
+#define STREAM_XATTR_HURD            1989    /* GNU HURD extended attributes */
+#define STREAM_XATTR_IRIX            1990    /* IRIX extended attributes */
+#define STREAM_XATTR_TRU64           1991    /* TRU64 extended attributes */
+#define STREAM_XATTR_AIX             1992    /* AIX extended attributes */
+#define STREAM_XATTR_OPENBSD         1993    /* OpenBSD extended attributes */
+#define STREAM_XATTR_SOLARIS_SYS     1994    /* Solaris extensible attributes or
+                                              * otherwise named extended system attributes.
+                                              */
+#define STREAM_XATTR_SOLARIS         1995    /* Solaris extented attributes */
+#define STREAM_XATTR_DARWIN          1996    /* Darwin (OSX) extended attributes */
+#define STREAM_XATTR_FREEBSD         1997    /* FreeBSD extended attributes */
+#define STREAM_XATTR_LINUX           1998    /* Linux specific attributes */
+#define STREAM_XATTR_NETBSD          1999    /* NetBSD extended attributes */
 
 /* WARNING!!! do not define more than 2047 of these old types */
 
diff --git a/src/tools/Makefile.in b/src/tools/Makefile.in
index 47a5128..bd312cc 100644
--- a/src/tools/Makefile.in
+++ b/src/tools/Makefile.in
@@ -1,4 +1,7 @@
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # Bacula Tools Makefile
 #
 @MCOMMON@
@@ -25,19 +28,19 @@ dummy:
 
 GETTEXT_LIBS = @LIBINTL@
 
-FINDOBJS = testfind.o ../dird/dird_conf.o ../dird/inc_conf.o ../dird/ua_acl.o ../dird/run_conf.o
+FINDOBJS = testfind.o ../dird/dird_conf.o ../dird/inc_conf.o ../dird/run_conf.o ../dird/ua_acl.o
 
 # these are the objects that are changed by the .configure process
 EXTRAOBJS = @OBJLIST@
 
-DIRCONFOBJS = ../dird/dird_conf.o ../dird/ua_acl.o ../dird/run_conf.o ../dird/inc_conf.o
+DIRCONFOBJS = ../dird/dird_conf.o ../dird/run_conf.o ../dird/inc_conf.o ../dird/ua_acl.o
 
 NODIRTOOLS = bsmtp
-DIRTOOLS = bsmtp dbcheck drivetype fstype testfind testls bregex bwild bbatch bregtest bvfs_test ing_test bpluginfo timelimit
+DIRTOOLS = bsmtp dbcheck drivetype fstype testfind testls bregex bwild bbatch bregtest bvfs_test
 TOOLS = $(@DIR_TOOLS@)
 
 INSNODIRTOOLS = bsmtp
-INSDIRTOOLS = bsmtp dbcheck bwild bregex bpluginfo
+INSDIRTOOLS = bsmtp dbcheck bwild bregex
 INSTOOLS = $(INS at DIR_TOOLS@)
 
 .SUFFIXES:	.c .o
@@ -56,6 +59,10 @@ all: Makefile $(TOOLS) gigaslam grow
 bsmtp: Makefile bsmtp.o ../lib/libbac$(DEFAULT_ARCHIVE_TYPE)	    
 	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L../lib -o $@ bsmtp.o -lbac -lm $(DLIB) $(LIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS)
 
+bsnapshot: Makefile bsnapshot.o ../lib/libbac$(DEFAULT_ARCHIVE_TYPE)
+	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L../lib -o $@ bsnapshot.o ../lib/ini$(DEFAULT_OBJECT_TYPE) -lbac -lm $(DLIB) $(LIBS) $(GETTEXT_LIBS)
+
+
 bregtest: Makefile bregtest.o ../lib/libbac$(DEFAULT_ARCHIVE_TYPE)	   
 	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L../lib -o $@ bregtest.o -lbac -lm $(DLIB) $(LIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS)
 
@@ -75,9 +82,6 @@ drivetype: Makefile drivetype.o ../lib/libbac$(DEFAULT_ARCHIVE_TYPE) ../findlib/
 dird_conf.o: ../dird/dird_conf.c
 	$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) $<
 
-ua_acl.o: ../dird/ua_acl.c
-	$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) $<
-
 run_conf.o: ../dird/run_conf.c
 	$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) $<
 
@@ -85,7 +89,7 @@ inc_conf.o: ../dird/inc_conf.c
 	$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) $<
 
 timelimit: timelimit.o
-	${CC} ${DEFS} ${DEBUG} -DHAVE_ERRNO_H -DHAVE_SETITIMER -DHAVE_SIGACTION -c timelimit.c 
+	${CC} ${DEFS} ${DEBUG} -pipe -DHAVE_ERRNO_H -DHAVE_SETITIMER -DHAVE_SIGACTION -c timelimit.c 
 	${CC} -o timelimit timelimit.o
 
 testfind: Makefile ../lib/libbac$(DEFAULT_ARCHIVE_TYPE) ../lib/libbaccfg$(DEFAULT_ARCHIVE_TYPE) \
@@ -115,11 +119,6 @@ bvfs_test: Makefile ../findlib/libbacfind$(DEFAULT_ARCHIVE_TYPE) ../lib/libbac$(
 	$(LIBTOOL_LINK) $(CXX) -g $(LDFLAGS) -L../cats -L. -L../lib -L../findlib -o $@ bvfs_test.o  \
 	  -lbaccats -lbacsql -lbacfind -lbac -lm $(DB_LIBS) $(LIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS)
 
-ing_test: Makefile ../findlib/libbacfind$(DEFAULT_ARCHIVE_TYPE) ../lib/libbac$(DEFAULT_ARCHIVE_TYPE) \
-	  ../cats/libbacsql$(DEFAULT_ARCHIVE_TYPE) ../cats/libbaccats$(DEFAULT_ARCHIVE_TYPE) ing_test.o
-	$(LIBTOOL_LINK) $(CXX) -g $(LDFLAGS) -L../cats -L. -L../lib -L../findlib -o $@ ing_test.o  \
-	  -lbaccats -lbacsql -lbacfind -lbac -lm $(DB_LIBS) $(LIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS)
-
 cats_test.o: cats_test.c
 	echo "Compiling $<"
 	$(NO_ECHO)$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) $<
@@ -129,7 +128,7 @@ cats_test: Makefile ../findlib/libbacfind$(DEFAULT_ARCHIVE_TYPE) ../lib/libbac$(
 	  -lbaccats -lbacsql -lbacfind -lbac -lm $(DB_LIBS) $(LIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS)
 
 gigaslam.o: gigaslam.c
-	$(CXX) $(CFLAGS) -c $<	
+	$(CXX) $(CFLAGS) -c $<
 
 gigaslam: gigaslam.o
 	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -o $@ gigaslam.o
@@ -151,8 +150,8 @@ libtool-clean:
 	@$(RMF) -r .libs _libs
 
 clean:	libtool-clean
-	@$(RMF) bsmtp core core.* a.out *.o *.bak *~ *.intpro *.extpro 1 2 3
-	@$(RMF) $(DIRTOOLS)
+	@$(RMF) core core.* a.out *.o *.bak *~ *.intpro *.extpro 1 2 3
+	@$(RMF) $(DIRTOOLS) gigaslam grow
 
 realclean: clean
 	@$(RMF) tags
@@ -165,18 +164,23 @@ devclean: realclean
 	if test $(srcdir) = .; then $(MAKE) realclean; fi
 	(cd $(srcdir); $(RMF) Makefile)
 
-installall:  $(TOOLS)
-	@for tool in ${TOOLS} ; do \
+install-bsnapshot: bsnapshot
+	$(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) bsnapshot $(DESTDIR)$(sbindir)/bsnapshot
+
+installall:  $(TOOLS) timelimit
+	@for tool in ${TOOLS} timelimit ; do \
 	   $(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) $$tool $(DESTDIR)$(sbindir)/$$tool ; \
 	done
-	chmod 755 $(DESTDIR)$(sbindir)/bsmtp
+#	chattr +i $(DESTDIR)$(sbindir)/bsmtp
+#	chmod 755 $(DESTDIR)$(sbindir)/bsmtp
 
 # Allow non-root execution of bsmtp for non-root Directors
 install: $(INSTOOLS)
 	@for tool in ${INSTOOLS} ; do \
 	   $(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) $$tool $(DESTDIR)$(sbindir)/$$tool ; \
 	done
-	chmod 755 $(DESTDIR)$(sbindir)/bsmtp
+#	chattr +i $(DESTDIR)$(sbindir)/bsmtp
+#	chmod 755 $(DESTDIR)$(sbindir)/bsmtp
 
 uninstall:
 	@for tool in ${INSTOOLS} ; do \
diff --git a/src/tools/assert_macro.h b/src/tools/assert_macro.h
deleted file mode 100644
index 2b4f302..0000000
--- a/src/tools/assert_macro.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
-   Bacula® - The Network Backup Solution
-
-   Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
-
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
-
-   You may use this file and others of this release according to the
-   license defined in the LICENSE file, which includes the Affero General
-   Public License, v3.0 ("AGPLv3") and some additional permissions and
-   terms pursuant to its AGPLv3 Section 7.
-
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
-/**
- * Assertion definitions
- *
- */
-
-
-#ifndef _ASSERT_MACRO_H
-#define _ASSERT_MACRO_H 1
-
-/* Assertions definitions */
-
-/* check valid pointer if not return */
-#ifndef ASSERT_NVAL_RET
-#define ASSERT_NVAL_RET(value) \
-   if ( ! value ){ \
-      return; \
-   }
-#endif
-
-/* check an error if true return */
-#ifndef ASSERT_VAL_RET
-#define ASSERT_VAL_RET(value) \
-   if ( value ){ \
-      return; \
-   }
-#endif
-
-/* check valid pointer with Null return */
-#ifndef ASSERT_NVAL_RET_NULL
-#define ASSERT_NVAL_RET_NULL(value) \
-   if ( ! value ) \
-   { \
-      return NULL; \
-   }
-#endif
-
-/* if value then Null return */
-#ifndef ASSERT_VAL_RET_NULL
-#define ASSERT_VAL_RET_NULL(value) \
-   if ( value ) \
-   { \
-      return NULL; \
-   }
-#endif
-
-/* check valid pointer with int/err return */
-#ifndef ASSERT_NVAL_RET_ONE
-#define ASSERT_NVAL_RET_ONE(value) \
-   if ( ! value ) \
-   { \
-      return 1; \
-   }
-#endif
-
-/* check valid pointer with int/err return */
-#ifndef ASSERT_NVAL_RET_NONE
-#define ASSERT_NVAL_RET_NONE(value) \
-   if ( ! value ) \
-   { \
-      return -1; \
-   }
-#endif
-
-/* check error if not exit with error */
-#ifndef ASSERT_NVAL_EXIT_ONE
-#define ASSERT_NVAL_EXIT_ONE(value) \
-   if ( ! value ){ \
-      exit ( 1 ); \
-   }
-#endif
-
-/* check error if not exit with error */
-#ifndef ASSERT_NVAL_EXIT_E
-#define ASSERT_NVAL_EXIT_E(value,ev) \
-   if ( ! value ){ \
-      exit ( ev ); \
-   }
-#endif
-
-/* check error if not return zero */
-#ifndef ASSERT_NVAL_RET_ZERO
-#define ASSERT_NVAL_RET_ZERO(value) \
-   if ( ! value ){ \
-      return 0; \
-   }
-#endif
-
-/* check error if not return value */
-#ifndef ASSERT_NVAL_RET_V
-#define ASSERT_NVAL_RET_V(value,rv) \
-   if ( ! value ){ \
-      return rv; \
-   }
-#endif
-
-/* checks error value then int/err return */
-#ifndef ASSERT_VAL_RET_ONE
-#define ASSERT_VAL_RET_ONE(value) \
-   if ( value ) \
-   { \
-      return 1; \
-   }
-#endif
-
-/* checks error value then int/err return */
-#ifndef ASSERT_VAL_RET_NONE
-#define ASSERT_VAL_RET_NONE(value) \
-   if ( value ) \
-   { \
-      return -1; \
-   }
-#endif
-
-/* checks error value then exit one */
-#ifndef ASSERT_VAL_EXIT_ONE
-#define ASSERT_VAL_EXIT_ONE(value) \
-   if ( value ) \
-   { \
-      exit (1); \
-   }
-#endif
-
-/* check error if not return zero */
-#ifndef ASSERT_VAL_RET_ZERO
-#define ASSERT_VAL_RET_ZERO(value) \
-   if ( value ){ \
-      return 0; \
-   }
-#endif
-
-/* check error if not return value */
-#ifndef ASSERT_VAL_RET_V
-#define ASSERT_VAL_RET_V(value,rv) \
-   if ( value ){ \
-      return rv; \
-   }
-#endif
-
-#endif /* _ASSERT_MACRO_H */
diff --git a/src/tools/bbatch.c b/src/tools/bbatch.c
index 462547a..9542648 100644
--- a/src/tools/bbatch.c
+++ b/src/tools/bbatch.c
@@ -1,36 +1,38 @@
 /*
- *
- *  Program to test batch mode
- *
- *   Eric Bollengier, March 2007
- *
- *
- *   Version $Id$
- */
-/*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
+/*
+ *
+ *  Program to test batch mode
+ *
+ *   Eric Bollengier, March 2007
+ *
+ */
 
 /*
   to create datafile
-
+ 
   for i in $(seq 10000 99999) ; do
      j=$((($i % 1000) + 555))
      echo "$i;/tmp/totabofds$j/fiddddle${j}$i;xxxLSTATxxxx;xxxxxxxMD5xxxxxx"
   done  > dat1
-
+ 
   or
 
   j=0
@@ -44,14 +46,13 @@
 #include "stored/stored.h"
 #include "findlib/find.h"
 #include "cats/cats.h"
-#include "cats/sql_glue.h"
-
+ 
 /* Forward referenced functions */
 static void *do_batch(void *);
 
 
 /* Local variables */
-static B_DB *db;
+static BDB *db;
 
 static const char *db_name = "bacula";
 static const char *db_user = "bacula";
@@ -64,7 +65,7 @@ static void usage()
 {
    fprintf(stderr, _(
 PROG_COPYRIGHT
-"\nVersion: %s (%s)\n"
+"\n%sVersion: %s (%s)\n"
 "Example : bbatch -w /path/to/workdir -h localhost -f dat1 -f dat -f datx\n"
 " will start 3 thread and load dat1, dat and datx in your catalog\n"
 "See bbatch.c to generate datafile\n\n"
@@ -81,7 +82,7 @@ PROG_COPYRIGHT
 "       -r <jobids>       call restore code with given jobids\n"
 "       -v                verbose\n"
 "       -f <file>         specify data file\n"
-"       -?                print this message\n\n"), 2001, VERSION, BDATE);
+"       -?                print this message\n\n"), 2001, "", VERSION, BDATE);
    exit(1);
 }
 
@@ -105,7 +106,7 @@ int main (int argc, char *argv[])
    textdomain("bacula");
    init_stack_dump();
    lmgr_init_thread();
-
+   
    char **files = (char **) malloc (10 * sizeof(char *));
    int i;
    my_name_is(argc, argv, "bbatch");
@@ -183,7 +184,7 @@ int main (int argc, char *argv[])
       uint64_t nb_file=0;
       btime_t start, end;
       /* To use the -r option, the catalog should already contains records */
-
+      
       if ((db = db_init_database(NULL, NULL, db_name, db_user, db_password,
                                  db_host, 0, NULL, false, disable_batch)) == NULL) {
          Emsg0(M_ERROR_TERM, 0, _("Could not init Bacula database\n"));
@@ -196,9 +197,9 @@ int main (int argc, char *argv[])
       db_get_file_list(NULL, db, restore_list, false, false, list_handler, &nb_file);
       end = get_current_btime();
 
-      Pmsg3(0, _("Computing file list for jobid=%s files=%lld secs=%d\n"),
+      Pmsg3(0, _("Computing file list for jobid=%s files=%lld secs=%d\n"), 
             restore_list, nb_file, (uint32_t)btime_to_unix(end-start));
-
+      
       free(restore_list);
       return 0;
    }
@@ -232,7 +233,7 @@ int main (int argc, char *argv[])
       pm_strcpy(bjcr->fileset_name, "Dummy.fileset.name");
       bjcr->fileset_md5 = get_pool_memory(PM_FNAME);
       pm_strcpy(bjcr->fileset_md5, "Dummy.fileset.md5");
-
+      
       if ((db = db_init_database(NULL, NULL, db_name, db_user, db_password,
                                  db_host, 0, NULL, false, false)) == NULL) {
          Emsg0(M_ERROR_TERM, 0, _("Could not init Bacula database\n"));
@@ -244,7 +245,7 @@ int main (int argc, char *argv[])
       if (verbose) {
          Pmsg2(000, _("Using Database: %s, User: %s\n"), db_name, db_user);
       }
-
+      
       bjcr->db = db;
 
       pthread_create(&thid, NULL, do_batch, bjcr);
@@ -316,12 +317,12 @@ static void *do_batch(void *jcr)
    fclose(fd);
    db_write_batch_file_records(bjcr);
    btime_t end = get_current_btime();
-
+   
    P(mutex);
    char ed1[200], ed2[200];
    printf("\rbegin = %s, end = %s\n", edit_int64(begin, ed1),edit_int64(end, ed2));
    printf("Insert time = %sms\n", edit_int64((end - begin) / 10000, ed1));
-   printf("Create %u files at %.2f/s\n", lineno,
+   printf("Create %u files at %.2f/s\n", lineno, 
           (lineno / ((float)((end - begin) / 1000000))));
    nb--;
    V(mutex);
diff --git a/src/tools/bpluginfo.c b/src/tools/bpluginfo.c
deleted file mode 100644
index 1655bd5..0000000
--- a/src/tools/bpluginfo.c
+++ /dev/null
@@ -1,625 +0,0 @@
-/*
- * Contributed in 2012 by Inteos sp. z o.o.
- *
- * Utility tool display various information about Bacula plugin,
- * including but not limited to:
- * - Name and Author of the plugin
- * - Plugin License
- * - Description
- * - API version
- * - Enabled functions, etc.
- */
-/*
-   Bacula® - The Network Backup Solution
-
-   Copyright (C) 2006-2014 Free Software Foundation Europe e.V.
-
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
-
-   You may use this file and others of this release according to the
-   license defined in the LICENSE file, which includes the Affero General
-   Public License, v3.0 ("AGPLv3") and some additional permissions and
-   terms pursuant to its AGPLv3 Section 7.
-
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
-
-#include <stdio.h>
-#include <unistd.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdint.h>
-#ifndef __WIN32__
-#include <dlfcn.h>
-#endif
-#include "bacula.h"
-#include "../filed/fd_plugins.h"
-#include "../dird/dir_plugins.h"
-// I can't include sd_plugins.h here ...
-#include "../stored/stored.h"
-#include "assert_macro.h"
-
-extern "C" {
-   typedef int (*loadPlugin) (void *binfo, void *bfuncs, void **pinfo,
-               void **pfuncs);
-   typedef int (*unloadPlugin) (void);
-}
-#define DEFAULT_API_VERSION   1
-enum plugintype {
-   DIRPLUGIN,
-   FDPLUGIN,
-   SDPLUGIN,
-   ERRORPLUGIN,
-};
-
-/*
- * pDirInfo
- * pInfo
- * psdInfo
- */
-typedef union _pluginfo pluginfo;
-union _pluginfo {
-   pDirInfo pdirinfo;
-   pInfo pfdinfo;
-   psdInfo psdinfo;
-};
-
-/*
- * pDirFuncs
- * pFuncs
- * psdFuncs
- */
-typedef union _plugfuncs plugfuncs;
-union _plugfuncs {
-   pDirFuncs pdirfuncs;
-   pFuncs pfdfuncs;
-   psdFuncs psdfuncs;
-};
-
-/*
- * bDirFuncs
- * bFuncs
- * bsdFuncs
- */
-/*
- * TODO: change to union
- *
-typedef union _baculafuncs baculafuncs;
-union _baculafuncs {
-   bDirFuncs bdirfuncs;
-   bFuncs bfdfuncs;
-   bsdFuncs bsdfuncs;
-};
-*/
-typedef struct _baculafuncs baculafuncs;
-struct _baculafuncs {
-   uint32_t size;
-   uint32_t version;
-   int (*registerBaculaEvents) (void *ctx, ...);
-   int (*getBaculaValue) (void *ctx, int var, void *value);
-   int (*setBaculaValue) (void *ctx, int var, void *value);
-   int (*JobMessage) (void *ctx, const char *file, int line, int type, int64_t mtime,
-            const char *fmt, ...);
-   int (*DebugMessage) (void *ctx, const char *file, int line, int level,
-         const char *fmt, ...);
-   void *(*baculaMalloc) (void *ctx, const char *file, int line, size_t size);
-   void (*baculaFree) (void *ctx, const char *file, int line, void *mem);
-};
-
-/*
- * bDirInfo
- * bInfo
- * bsdInfo
- */
-typedef union _baculainfos baculainfos;
-union _baculainfos {
-   bDirInfo bdirinfo;
-   bInfo bfdinfo;
-   bsdInfo bsdinfo;
-};
-
-/*
-typedef struct _baculainfos baculainfos;
-struct _baculainfos {
-   uint32_t size;
-   uint32_t version;
-};
-*/
-
-typedef struct _progdata progdata;
-struct _progdata {
-   int verbose;
-   int listinfo;
-   int listfunc;
-   char *pluginfile;
-   void *pluginhandle;
-   int bapiversion;
-   int bplugtype;
-   pluginfo *pinfo;
-   plugfuncs *pfuncs;
-};
-
-/* memory allocation/deallocation */
-#define MALLOC(size) \
-   (char *) bmalloc ( size );
-
-#define ASSERT_MEMORY(m) \
-   if ( m == NULL ){ \
-      printf ( "Error: memory allocation error!\n" ); \
-      exit (10); \
-   }
-
-#define FREE(ptr) \
-   if ( ptr != NULL ){ \
-      bfree ( ptr ); \
-      ptr = NULL; \
-   }
-
-int registerBaculaEvents(void *ctx, ...)
-{
-   return 0;
-};
-
-int getBaculaValue(void *ctx, int var, void *value)
-{
-   return 0;
-};
-
-int setBaculaValue(void *ctx, int var, void *value)
-{
-   return 0;
-};
-
-int DebugMessage(void *ctx, const char *file, int line, int level, const char *fmt, ...)
-{
-#ifdef DEBUGMSG
-   printf("DG: %s:%d %s\n", file, line, fmt);
-#endif
-   return 0;
-};
-
-int JobMessage(void *ctx, const char *file, int line, int type, int64_t mtime,
-          const char *fmt, ...)
-{
-#ifdef DEBUGMSG
-   printf("JM: %s:%d <%d> %s\n", file, line, type, fmt);
-#endif
-   return 0;
-};
-
-void *baculaMalloc(void *ctx, const char *file, int line, size_t size)
-{
-   return MALLOC(size);
-};
-
-void baculaFree(void *ctx, const char *file, int line, void *mem)
-{
-   FREE(mem);
-};
-
-/*
- * displays a short help
- */
-void print_help(int argc, char *argv[])
-{
-
-   printf("\n"
-     "Usage: bpluginfo [options] <plugin_file.so>\n"
-     "       -v          verbose\n"
-     "       -i          list plugin header information only (default)\n"
-     "       -f          list plugin functions information only\n"
-     "       -a <api>    bacula api version (default %d)\n"
-     "       -h          help screen\n" "\n", DEFAULT_API_VERSION);
-}
-
-/* allocates and resets a main program data variable */
-progdata *allocpdata(void)
-{
-
-   progdata *pdata;
-
-   pdata = (progdata *) bmalloc(sizeof(progdata));
-   ASSERT_MEMORY(pdata);
-   memset(pdata, 0, sizeof(progdata));
-
-   return pdata;
-}
-
-/* releases all allocated program data resources */
-void freepdata(progdata * pdata)
-{
-
-   if (pdata->pluginfile) {
-      FREE(pdata->pluginfile);
-   }
-   FREE(pdata);
-}
-
-/*
- * parse execution arguments and fills required pdata structure fields
- *
- * input:
- *    pdata - pointer to program data structure
- *    argc, argv - execution envinroment variables
- * output:
- *    pdata - required structure fields
- *
- * supported options:
- * -v    verbose flag
- * -i    list plugin header info only (default)
- * -f    list implemented functions only
- * -a    bacula api version (default 1)
- * -h    help screen
- */
-void parse_args(progdata * pdata, int argc, char *argv[])
-{
-
-   int i;
-   char *dirtmp;
-   char *progdir;
-   int api;
-   int s;
-
-   if (argc < 2) {
-      /* TODO - add a real help screen */
-      printf("\nNot enough parameters!\n");
-      print_help(argc, argv);
-      exit(1);
-   }
-
-   if (argc > 5) {
-      /* TODO - add a real help screen */
-      printf("\nToo many parameters!\n");
-      print_help(argc, argv);
-      exit(1);
-   }
-
-   for (i = 1; i < argc; i++) {
-      if (strcmp(argv[i], "-h") == 0) {
-         /* help screen */
-         print_help(argc, argv);
-         exit(0);
-      }
-      if (strcmp(argv[i], "-v") == 0) {
-          /* verbose option */
-          pdata->verbose = 1;
-          continue;
-      }
-      if (strcmp(argv[i], "-f") == 0) {
-         /* functions list */
-         pdata->listfunc = 1;
-         continue;
-      }
-      if (strcmp(argv[i], "-i") == 0) {
-         /* header list */
-         pdata->listinfo = 1;
-         continue;
-      }
-      if (strcmp(argv[i], "-a") == 0) {
-         /* bacula api version */
-         if (i < argc - 1) {
-            s = sscanf(argv[i + 1], "%d", &api);
-            if (s == 1) {
-               pdata->bapiversion = api;
-               i++;
-               continue;
-            }
-         }
-         printf("\nAPI version number required!\n");
-         print_help(argc, argv);
-         exit(1);
-      }
-      if (!pdata->pluginfile) {
-          if (argv[i][0] != '/') {
-             dirtmp = MALLOC(PATH_MAX);
-             ASSERT_MEMORY(dirtmp);
-             progdir = MALLOC(PATH_MAX);
-             ASSERT_MEMORY(progdir);
-             dirtmp = getcwd(dirtmp, PATH_MAX);
-
-             strcat(dirtmp, "/");
-             strcat(dirtmp, argv[i]);
-
-             if (realpath(dirtmp, progdir) == NULL) {
-                /* error in resolving path */
-                FREE(progdir);
-                progdir = bstrdup(argv[i]);
-             }
-             pdata->pluginfile = bstrdup(progdir);
-             FREE(dirtmp);
-             FREE(progdir);
-          } else {
-             pdata->pluginfile = bstrdup(argv[i]);
-          }
-    continue;
-      }
-   }
-}
-
-/*
- * checks a plugin type based on a plugin magic string
- *
- * input:
- *    pdata - program data with plugin info structure
- * output:
- *    int - enum plugintype
- */
-int getplugintype(progdata * pdata)
-{
-
-   ASSERT_NVAL_RET_V(pdata, ERRORPLUGIN);
-
-   pluginfo *pinfo = pdata->pinfo;
-
-   ASSERT_NVAL_RET_V(pinfo, ERRORPLUGIN);
-
-   if (pinfo->pdirinfo.plugin_magic &&
-       strcmp(pinfo->pdirinfo.plugin_magic, DIR_PLUGIN_MAGIC) == 0) {
-      return DIRPLUGIN;
-   } else
-      if (pinfo->pfdinfo.plugin_magic &&
-     strcmp(pinfo->pfdinfo.plugin_magic, FD_PLUGIN_MAGIC) == 0) {
-      return FDPLUGIN;
-   } else
-      if (pinfo->psdinfo.plugin_magic &&
-     strcmp(pinfo->psdinfo.plugin_magic, SD_PLUGIN_MAGIC) == 0) {
-      return SDPLUGIN;
-   } else {
-      return ERRORPLUGIN;
-   }
-}
-
-/*
- * prints any available information about a plugin
- *
- * input:
- *    pdata - program data with plugin info structure
- * output:
- *    printed info
- */
-void dump_pluginfo(progdata * pdata)
-{
-
-   ASSERT_NVAL_RET(pdata);
-
-   pluginfo *pinfo = pdata->pinfo;
-
-   ASSERT_NVAL_RET(pinfo);
-
-   plugfuncs *pfuncs = pdata->pfuncs;
-
-   ASSERT_NVAL_RET(pfuncs);
-
-   switch (pdata->bplugtype) {
-   case DIRPLUGIN:
-      printf("\nPlugin type:\t\tBacula Director plugin\n");
-      if (pdata->verbose) {
-         printf("Plugin magic:\t\t%s\n", NPRT(pinfo->pdirinfo.plugin_magic));
-      }
-      printf("Plugin version:\t\t%s\n", pinfo->pdirinfo.plugin_version);
-      printf("Plugin release date:\t%s\n", NPRT(pinfo->pdirinfo.plugin_date));
-      printf("Plugin author:\t\t%s\n", NPRT(pinfo->pdirinfo.plugin_author));
-      printf("Plugin licence:\t\t%s\n", NPRT(pinfo->pdirinfo.plugin_license));
-      printf("Plugin description:\t%s\n", NPRT(pinfo->pdirinfo.plugin_description));
-      printf("Plugin API version:\t%d\n", pinfo->pdirinfo.version);
-      break;
-   case FDPLUGIN:
-      printf("\nPlugin type:\t\tFile Daemon plugin\n");
-      if (pdata->verbose) {
-         printf("Plugin magic:\t\t%s\n", NPRT(pinfo->pfdinfo.plugin_magic));
-      }
-      printf("Plugin version:\t\t%s\n", pinfo->pfdinfo.plugin_version);
-      printf("Plugin release date:\t%s\n", NPRT(pinfo->pfdinfo.plugin_date));
-      printf("Plugin author:\t\t%s\n", NPRT(pinfo->pfdinfo.plugin_author));
-      printf("Plugin licence:\t\t%s\n", NPRT(pinfo->pfdinfo.plugin_license));
-      printf("Plugin description:\t%s\n", NPRT(pinfo->pfdinfo.plugin_description));
-      printf("Plugin API version:\t%d\n", pinfo->pfdinfo.version);
-      break;
-   case SDPLUGIN:
-      printf("\nPlugin type:\t\tBacula Storage plugin\n");
-      if (pdata->verbose) {
-         printf("Plugin magic:\t\t%s\n", NPRT(pinfo->psdinfo.plugin_magic));
-      }
-      printf("Plugin version:\t\t%s\n", pinfo->psdinfo.plugin_version);
-      printf("Plugin release date:\t%s\n", NPRT(pinfo->psdinfo.plugin_date));
-      printf("Plugin author:\t\t%s\n", NPRT(pinfo->psdinfo.plugin_author));
-      printf("Plugin licence:\t\t%s\n", NPRT(pinfo->psdinfo.plugin_license));
-      printf("Plugin description:\t%s\n", NPRT(pinfo->psdinfo.plugin_description));
-      printf("Plugin API version:\t%d\n", pinfo->psdinfo.version);
-      break;
-   default:
-      printf("\nUnknown plugin type or other Error\n\n");
-   }
-}
-
-/*
- * prints any available information about plugin' functions
- *
- * input:
- *    pdata - program data with plugin info structure
- * output:
- *    printed info
- */
-void dump_plugfuncs(progdata * pdata)
-{
-
-   ASSERT_NVAL_RET(pdata);
-
-   plugfuncs *pfuncs = pdata->pfuncs;
-
-   ASSERT_NVAL_RET(pfuncs);
-
-   printf("\nPlugin functions:\n");
-
-   switch (pdata->bplugtype) {
-   case DIRPLUGIN:
-      if (pdata->verbose) {
-          if (pfuncs->pdirfuncs.newPlugin) {
-             printf(" newPlugin()\n");
-          }
-          if (pfuncs->pdirfuncs.freePlugin) {
-             printf(" freePlugin()\n");
-          }
-      }
-      if (pfuncs->pdirfuncs.getPluginValue) {
-         printf(" getPluginValue()\n");
-      }
-      if (pfuncs->pdirfuncs.setPluginValue) {
-         printf(" setPluginValue()\n");
-      }
-      if (pfuncs->pdirfuncs.handlePluginEvent) {
-         printf(" handlePluginEvent()\n");
-      }
-      break;
-   case FDPLUGIN:
-      if (pdata->verbose) {
-          if (pfuncs->pfdfuncs.newPlugin) {
-             printf(" newPlugin()\n");
-          }
-          if (pfuncs->pfdfuncs.freePlugin) {
-             printf(" freePlugin()\n");
-          }
-      }
-      if (pfuncs->pfdfuncs.getPluginValue) {
-         printf(" getPluginValue()\n");
-      }
-      if (pfuncs->pfdfuncs.setPluginValue) {
-         printf(" setPluginValue()\n");
-      }
-      if (pfuncs->pfdfuncs.handlePluginEvent) {
-         printf(" handlePluginEvent()\n");
-      }
-      if (pfuncs->pfdfuncs.startBackupFile) {
-         printf(" startBackupFile()\n");
-      }
-      if (pfuncs->pfdfuncs.endBackupFile) {
-         printf(" endBackupFile()\n");
-      }
-      if (pfuncs->pfdfuncs.startRestoreFile) {
-         printf(" startRestoreFile()\n");
-      }
-      if (pfuncs->pfdfuncs.endRestoreFile) {
-         printf(" endRestoreFile()\n");
-      }
-      if (pfuncs->pfdfuncs.pluginIO) {
-         printf(" pluginIO()\n");
-      }
-      if (pfuncs->pfdfuncs.createFile) {
-         printf(" createFile()\n");
-      }
-      if (pfuncs->pfdfuncs.setFileAttributes) {
-         printf(" setFileAttributes()\n");
-      }
-      if (pfuncs->pfdfuncs.checkFile) {
-         printf(" checkFile()\n");
-      }
-      break;
-   case SDPLUGIN:
-      if (pdata->verbose) {
-          if (pfuncs->psdfuncs.newPlugin) {
-             printf(" newPlugin()\n");
-          }
-          if (pfuncs->psdfuncs.freePlugin) {
-             printf(" freePlugin()\n");
-          }
-      }
-      if (pfuncs->psdfuncs.getPluginValue) {
-         printf(" getPluginValue()\n");
-      }
-      if (pfuncs->psdfuncs.setPluginValue) {
-         printf(" setPluginValue()\n");
-      }
-      if (pfuncs->psdfuncs.handlePluginEvent) {
-         printf(" handlePluginEvent()\n");
-      }
-      break;
-   default:
-      printf("\nUnknown plugin type or other Error\n\n");
-   }
-}
-
-/*
- * input parameters:
- *    argv[0] [options] <plugin_filename.so>
- *
- * exit codes:
- *    0 - success
- *    1 - cannot load a plugin
- *    2 - cannot find a loadPlugin function
- *    3 - cannot find an unloadPlugin function
- *    10 - not enough memory
- */
-int main(int argc, char *argv[])
-{
-
-   progdata *pdata;
-   loadPlugin loadplugfunc;
-   unloadPlugin unloadplugfunc;
-   baculafuncs bfuncs = {
-      sizeof(bfuncs),
-      1,
-      registerBaculaEvents,
-      getBaculaValue,
-      setBaculaValue,
-      JobMessage,
-      DebugMessage,
-      baculaMalloc,
-      baculaFree,
-   };
-   baculainfos binfos;
-
-   pdata = allocpdata();
-   parse_args(pdata, argc, argv);
-
-   binfos.bfdinfo.size = sizeof(binfos);
-   binfos.bfdinfo.version = DEFAULT_API_VERSION;
-
-   pdata->pluginhandle = dlopen(pdata->pluginfile, RTLD_LAZY);
-   if (pdata->pluginhandle == NULL) {
-      printf("\nCannot load a plugin: %s\n\n", dlerror());
-      freepdata(pdata);
-      exit(1);
-   }
-
-   loadplugfunc = (loadPlugin) dlsym(pdata->pluginhandle, "loadPlugin");
-   if (loadplugfunc == NULL) {
-      printf("\nCannot find loadPlugin function: %s\n", dlerror());
-      printf("\nWhether the file is a really Bacula plugin?\n\n");
-      freepdata(pdata);
-      exit(2);
-   }
-
-   unloadplugfunc = (unloadPlugin) dlsym(pdata->pluginhandle, "unloadPlugin");
-   if (unloadplugfunc == NULL) {
-      printf("\nCannot find unloadPlugin function: %s\n", dlerror());
-      printf("\nWhether the file is a really Bacula plugin?\n\n");
-      freepdata(pdata);
-      exit(3);
-   }
-
-   if (pdata->bapiversion > 0) {
-      binfos.bdirinfo.version = pdata->bapiversion;
-   }
-
-   loadplugfunc(&binfos, &bfuncs, (void **)&pdata->pinfo, (void **)&pdata->pfuncs);
-
-   pdata->bplugtype = getplugintype(pdata);
-
-   if (!pdata->listfunc) {
-      dump_pluginfo(pdata);
-   }
-   if ((!pdata->listinfo && pdata->listfunc) || pdata->verbose) {
-      dump_plugfuncs(pdata);
-   }
-   printf("\n");
-
-   unloadplugfunc();
-
-   dlclose(pdata->pluginhandle);
-
-   freepdata(pdata);
-
-   return 0;
-}
diff --git a/src/tools/bregex.c b/src/tools/bregex.c
index ceefa91..0b08934 100644
--- a/src/tools/bregex.c
+++ b/src/tools/bregex.c
@@ -1,24 +1,28 @@
 /*
- * Test program for testing regular expressions.
- *
- *  Kern Sibbald, MMVI
- *
- */
-/*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2006-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
+/*
+ * Test program for testing regular expressions.
+ *
+ *  Kern Sibbald, MMVI
+ *
+ */
 
 #include "bacula.h"
 
@@ -74,7 +78,7 @@ int main(int argc, char *const *argv)
    bool match_only = true;
    int lineno;
    bool no_linenos = false;
-
+   
 
    setlocale(LC_ALL, "");
    bindtextdomain("bacula", LOCALEDIR);
diff --git a/src/tools/bregtest.c b/src/tools/bregtest.c
index 4853d93..d28f0bc 100644
--- a/src/tools/bregtest.c
+++ b/src/tools/bregtest.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2006-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Test program for testing regular expressions.
@@ -112,7 +116,7 @@ int main(int argc, char *const *argv)
 
    alist *list;
    char *p;
-
+   
    list = get_bregexps(expr);
 
    if (!list) {
@@ -141,10 +145,10 @@ int main(int argc, char *const *argv)
    exit(0);
 }
 /*
-  TODO:
+  TODO: 
    - ajout /g
 
-   - tests
+   - tests 
    * test avec /i
    * test avec un sed et faire un diff
    * test avec une boucle pour voir les fuites
diff --git a/src/tools/bsmtp.c b/src/tools/bsmtp.c
index 8e6d4f5..55148d4 100644
--- a/src/tools/bsmtp.c
+++ b/src/tools/bsmtp.c
@@ -1,55 +1,46 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2001-2015 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
-   Derived from a SMTPclient:
-
-  ======== Original copyrights ==========
-
-       SMTPclient -- simple SMTP client
-
-       Copyright (c) 1997 Ralf S. Engelschall, All rights reserved.
-
-       This program is free software; it may be redistributed and/or modified
-       only under the terms of either the Artistic License or the GNU General
-       Public License, which may be found in the SMTP source distribution.
-       Look at the file COPYING.
-
-       This program is distributed in the hope that it will be useful, but
-       WITHOUT ANY WARRANTY; without even the implied warranty of
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-       GNU General Public License for more details.
-
-       ======================================================================
-
-       smtpclient_main.c -- program source
-
-       Based on smtp.c as of August 11, 1995 from
-           W.Z. Venema,
-           Eindhoven University of Technology,
-           Department of Mathematics and Computer Science,
-           Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands.
-
-   =========
-
+   Derived from smtp-orig.c
+
+   AUTHOR(S)
+     W.Z. Venema
+     Eindhoven University of Technology
+     Department of Mathematics and Computer Science
+     Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
+   CREATION DATE
+     Wed Dec 1 14:51:13 MET 1993
+   LAST UPDATE
+     Fri Aug 11 12:29:23 MET DST 1995
+   COPYRIGHT
+     None specified.
 
    Kern Sibbald, July 2001
 
      Note, the original W.Z. Venema smtp.c had no license and no
      copyright.  See:
         http://archives.neohapsis.com/archives/postfix/2000-05/1520.html
+
+    In previous versions, I believed that this code cam from
+     Ralf S. Engelshall's smtpclient_main.c, but in fact 99% was
+     Wietse Venema's code.
  */
 
 #include "bacula.h"
@@ -60,7 +51,6 @@
 #include <lmcons.h>
 #endif
 
-
 #ifndef MAXSTRING
 #define MAXSTRING 254
 #endif
@@ -85,7 +75,7 @@ static char my_hostname[MAXSTRING];
 static bool content_utf8 = false;
 static resolv_type default_resolv_type = RESOLV_PROTO_IPV4;
 
-/*
+/* 
  * Take input that may have names and other stuff and strip
  *  it down to the mail box address ... i.e. what is enclosed
  *  in < >.  Otherwise add < >.
@@ -105,68 +95,71 @@ static char *cleanup_addr(char *addr, char *buf, int buf_len)
          *q++ = *p;
       }
       *q = 0;
-  }
-  Dmsg2(100, "cleanup in=%s out=%s\n", addr, buf);
-  return buf;
+   }
+   Dmsg2(100, "cleanup in=%s out=%s\n", addr, buf);
+   return buf;
 }
 
 /*
- *  examine message from server
+ * get_response - examine message from server
  */
 static void get_response(void)
 {
-    char buf[1000];
-
-    Dmsg0(50, "Calling fgets on read socket rfp.\n");
-    buf[3] = 0;
-    while (fgets(buf, sizeof(buf), rfp)) {
-        int len = strlen(buf);
-        if (len > 0) {
-           buf[len-1] = 0;
-        }
-        if (debug_level >= 10) {
-            fprintf(stderr, "%s <-- %s\n", mailhost, buf);
-        }
-        Dmsg2(10, "%s --> %s\n", mailhost, buf);
-        if (!isdigit((int)buf[0]) || buf[0] > '3') {
-            Pmsg2(0, _("Fatal malformed reply from %s: %s\n"), mailhost, buf);
-            exit(1);
-        }
-        if (buf[3] != '-') {
-            break;
-        }
-    }
-    if (ferror(rfp)) {
-        fprintf(stderr, _("Fatal fgets error: ERR=%s\n"), strerror(errno));
-    }
-    return;
+   char buf[1000];
+
+   Dmsg0(50, "Calling fgets on read socket rfp.\n");
+   buf[3] = 0;
+   while (fgets(buf, sizeof(buf), rfp)) {
+      int len = strlen(buf);
+      if (len > 0) {
+         buf[len-1] = 0;
+      }
+      if (debug_level >= 10) {
+         fprintf(stderr, "%s <-- %s\n", mailhost, buf);
+      }
+      Dmsg2(10, "%s --> %s\n", mailhost, buf);
+      if (!isdigit((int)buf[0]) || buf[0] > '3') {
+         Pmsg2(0, _("Fatal malformed reply from %s: %s\n"), mailhost, buf);
+         exit(1);
+      }
+      if (buf[3] != '-') {
+         break;
+      }
+   }
+   if (ferror(rfp)) {
+      fprintf(stderr, _("Fatal fgets error: ERR=%s\n"), strerror(errno));
+   }
+   return;
 }
 
 /*
- *  say something to server and check the response
+ * chat - say something to server and check the response
  */
 static void chat(const char *fmt, ...)
 {
-    va_list ap;
-
-    va_start(ap, fmt);
-    vfprintf(sfp, fmt, ap);
-    va_end(ap);
-    if (debug_level >= 10) {
-       fprintf(stdout, "%s --> ", my_hostname);
-       va_start(ap, fmt);
-       vfprintf(stdout, fmt, ap);
-       va_end(ap);
-    }
-
-    fflush(sfp);
-    if (debug_level >= 10) {
-       fflush(stdout);
-    }
-    get_response();
-}
+   va_list ap;
+
+   va_start(ap, fmt);
+   vfprintf(sfp, fmt, ap);
+   va_end(ap);
+   if (debug_level >= 10) {
+      fprintf(stdout, "%s --> ", my_hostname);
+      va_start(ap, fmt);
+      vfprintf(stdout, fmt, ap);
+      va_end(ap);
+   }
 
+   /* Send message to server and parse its response. */
+   fflush(sfp);
+   if (debug_level >= 10) {
+      fflush(stdout);
+   }
+   get_response();
+}
 
+/*
+ * usage - explain and bail out
+ */
 static void usage()
 {
    fprintf(stderr,
@@ -274,7 +267,7 @@ int main (int argc, char *argv[])
 #else
    const char *options = "48ac:d:f:h:r:s:l:?";
 #endif
-
+    
    setlocale(LC_ALL, "en_US");
    bindtextdomain("bacula", LOCALEDIR);
    textdomain("bacula");
@@ -382,7 +375,7 @@ int main (int argc, char *argv[])
 
    /*
     *  Find out my own host name for HELO;
-    *  if possible, get the fully qualified domain name
+    *  if possible, get the FQDN - fully qualified domain name
     */
    if (gethostname(my_hostname, sizeof(my_hostname) - 1) < 0) {
       Pmsg1(0, _("Fatal gethostname error: ERR=%s\n"), strerror(errno));
@@ -568,14 +561,14 @@ lookup_host:
 #endif
 
    /*
-    *  Send SMTP headers.  Note, if any of the strings have a <
-    *   in them already, we do not enclose the string in < >, otherwise
-    *   we do.
+    * Send SMTP headers.  Note, if any of the strings have a <
+    *  in them already, we do not enclose the string in < >, otherwise
+    *  we do.
     */
    get_response(); /* banner */
    chat("HELO %s\r\n", my_hostname);
    chat("MAIL FROM:%s\r\n", cleanup_addr(from_addr, buf, sizeof(buf)));
-
+   
    for (i = 0; i < argc; i++) {
       Dmsg1(20, "rcpt to: %s\n", argv[i]);
       chat("RCPT TO:%s\r\n", cleanup_addr(argv[i], buf, sizeof(buf)));
@@ -588,7 +581,7 @@ lookup_host:
    chat("DATA\r\n");
 
    /*
-    *  Send message header
+    * Send header
     */
    fprintf(sfp, "From: %s\r\n", from_addr);
    Dmsg1(10, "From: %s\r\n", from_addr);
@@ -652,7 +645,7 @@ lookup_host:
    fprintf(sfp, "\r\n");
 
    /*
-    *  Send message body
+    * Send message body
     */
    lines = 0;
    while (fgets(buf, sizeof(buf), stdin)) {
@@ -682,9 +675,5 @@ lookup_host:
     */
    chat(".\r\n");
    chat("QUIT\r\n");
-
-   /*
-    *  Go away gracefully ...
-    */
    exit(0);
 }
diff --git a/src/tools/bsnapshot.c b/src/tools/bsnapshot.c
new file mode 100644
index 0000000..6d6b85b
--- /dev/null
+++ b/src/tools/bsnapshot.c
@@ -0,0 +1,1977 @@
+/*
+   Bacula(R) - The Network Backup Solution
+
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2011-2014 Free Software Foundation Europe e.V.
+
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
+
+   You may use this file and others of this release according to the
+   license defined in the LICENSE file, which includes the Affero General
+   Public License, v3.0 ("AGPLv3") and some additional permissions and
+   terms pursuant to its AGPLv3 Section 7.
+
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
+
+#include "bacula.h"
+#include "lib/ini.h"
+
+#ifdef HAVE_SUN_OS
+#include <sys/types.h>
+#include <sys/mkdev.h>          /* Define major() and minor() */
+#endif
+
+#define Dmsg(level,  ...) do { \
+   if (level <= debug_level) { \
+      fprintf(debug, "%s:%d ", __FILE__ , __LINE__);    \
+      fprintf(debug, __VA_ARGS__ );                          \
+   }  \
+ } while (0)
+
+#define Pmsg(level,  ...) do { \
+   if (level <= debug_level) { \
+      fprintf(stderr, "%s:%d ", __FILE__ , __LINE__ ); \
+      fprintf(stderr, __VA_ARGS__ );                   \
+   }  \
+ } while (0)
+
+#define BSNAPSHOT_CONF SYSCONFDIR "/bsnapshot.conf"
+
+static FILE *debug = NULL;
+
+static void usage(const char *msg=NULL)
+{
+   if (msg) {
+      fprintf(stderr, _("ERROR %s\n\n"), msg);
+   }
+
+   fprintf(stderr, _(
+           "Bacula %s (%s)\n\n"
+           "Usage: bsnapshot\n"
+           "   -d level     Set debug level\n"
+           "   -v           Verbose\n"
+           "   -s           Use sudo\n"
+           "   -o logfile   send debug to logfile\n"
+           "   -V volume    volume\n"
+           "   -T type      volume type\n"
+           "   -t           check compatibility\n"
+           "   -c           specify configuration file\n"
+           "\n"), VERSION, LSMDATE);
+   exit(2);
+}
+
+static const char *Months[] = {
+   NULL,
+   "Jan",
+   "Feb",
+   "Mar",
+   "Apr",
+   "Mai",
+   "Jun",
+   "Jul",
+   "Aug",
+   "Sep",
+   "Oct",
+   "Nov",
+   "Dec"
+};
+
+/* Skip leading slash(es) */
+static bool makedir(char *path)
+{
+   char *p = path;
+
+   while (IsPathSeparator(*p)) {
+      p++;
+   }
+   while ((p = first_path_separator(p))) {
+      char save_p;
+      save_p = *p;
+      *p = 0;
+      mkdir(path, 0700);
+      *p = save_p;
+      while (IsPathSeparator(*p)) {
+         p++;
+      }
+   }
+   /* If not having a ending / */
+   if (!IsPathSeparator(path[strlen(path) - 1])) {
+      mkdir(path, 0700);
+   }
+   return true;
+}
+
+/* Strip trailing junk and " */
+void strip_quotes(char *str)
+{
+   strip_trailing_junk(str);
+   for(char *p = str; *p ; p++) {
+      if (*p == '"') {
+         *p = ' ';
+      }
+   }
+}
+
+static void set_trace_file(const char *path)
+{
+   char dt[MAX_TIME_LENGTH];
+   if (debug && debug != stderr) {
+      fclose(debug);
+   }
+   debug = fopen(path, "a");
+   if (!debug) {
+      debug = stderr;
+   } else {
+      Dmsg(10, "Starting bsnapshot %s\n",  
+           bstrftime(dt, MAX_TIME_LENGTH, time(NULL)));
+   }
+}
+
+/* Small function to avoid double // in path name */
+static  void path_concat(POOLMEM *&dest, const char *path1, const char *path2, const char *path3) {
+   int last;
+
+   last = pm_strcpy(dest, path1);
+   last = MAX(last - 1, 0);
+
+   /* Check if the last char of dest is / and the first of path2 is / */
+   if (dest[last] == '/') {
+      if (path2[0] == '/') {
+         dest[last] = 0;
+      }
+   } else {
+      if (path2[0] != '/') {
+         pm_strcat(dest, "/");
+      }
+   }
+
+   last = pm_strcat(dest, path2); 
+   last = MAX(last - 1, 0);
+
+   if (path3) {
+      if (dest[last] == '/') {
+         if (path3[0] == '/') {
+            dest[last] = 0;
+         }
+      } else {
+         if (path3[0] != '/') {
+            pm_strcat(dest, "/");
+         }
+      }
+      pm_strcat(dest, path3);
+   }
+}
+
+static struct ini_items bsnap_cfg[] = {
+ // name                handler          comment  required   default
+ { "trace",             ini_store_str,      "",      0,        NULL},
+ { "debug",             ini_store_int32,    "",      0,        NULL},
+ { "sudo",              ini_store_bool,     "",      0,        NULL},
+ { "disabled",          ini_store_bool,     "",      0,        "no"},
+ { "retry",             ini_store_int32,    "",      0,        "3"},
+ { "lvm_snapshot_size", ini_store_alist_str,"",      0,        NULL},
+ { "skip_volume",       ini_store_alist_str,"",      0,        NULL},
+ { "snapshot_dir",      ini_store_str,      "",      0,        NULL},
+ { "fail_job_on_error", ini_store_bool,     "",      0,        "yes"},
+ { NULL,                NULL,             NULL,      0,        NULL}
+};
+
+class arguments {
+public:
+   char *action;                /* list, create, delete... */
+   char *volume;                /* snapshot device */
+   char *device;                /* original device name */
+   char *name;                  /* snapshot name */
+   char *mountpoint;            /* device mountpoint */
+   char *snapmountpoint;        /* snapshot mountpoint */
+   char *type;                  /* snapshot type */
+   char *fstype;                /* filesystem type */
+   const char *snapdir;         /* .snapshot */
+   const char *sudo;            /* prepend sudo to commands */
+   int  verbose;
+   int  retry;                  /* retry some operations */
+   bool disabled;               /* disabled by config file */
+   bool fail_job_on_error;      /* Fail job on snapshot error */
+   ConfigFile ini;              /* Configuration file */
+   POOL_MEM config_file;        /* Path to a config file */
+
+   arguments():
+      action(getenv("SNAPSHOT_ACTION")),
+      volume(getenv("SNAPSHOT_VOLUME")),
+      device(getenv("SNAPSHOT_DEVICE")),
+      name(  getenv("SNAPSHOT_NAME")),
+      mountpoint(getenv("SNAPSHOT_MOUNTPOINT")),
+      snapmountpoint(getenv("SNAPSHOT_SNAPMOUNTPOINT")),
+      type(  getenv("SNAPSHOT_TYPE")),
+      fstype(getenv("SNAPSHOT_FSTYPE")),
+      snapdir(".snapshots"),
+      sudo(""),
+      verbose(0),
+      retry(3),
+      disabled(false),
+      fail_job_on_error(true)
+   {
+      struct stat sp;
+      ini.register_items(bsnap_cfg, sizeof(struct ini_items));
+
+      if (stat(BSNAPSHOT_CONF, &sp) == 0) {
+         Dmsg(10, "conf=%s\n", BSNAPSHOT_CONF);
+         pm_strcpy(config_file, BSNAPSHOT_CONF);
+      }
+   };
+
+   ~arguments() {
+   };
+
+   bool validate() {
+      int pos;
+      if (!action) {
+         return false;
+      }
+      if (strcmp(config_file.c_str(), "") != 0) {
+         Dmsg(10, "Reading configuration from %s\n", config_file.c_str());
+         if (!ini.parse(config_file.c_str())) {
+            printf("status=1 error=\"Unable to parse %s\"\n",
+                   config_file.c_str());
+            return false;
+         }
+         pos = ini.get_item("debug");
+         if (ini.items[pos].found && debug_level == 0) {
+            debug_level = ini.items[pos].val.int32val;
+         }
+         pos = ini.get_item("trace");
+         if (ini.items[pos].found) {
+            set_trace_file(ini.items[pos].val.strval);
+         }
+         pos = ini.get_item("sudo");
+         if (ini.items[pos].found && ini.items[pos].val.boolval) {
+            sudo = "sudo ";
+         }
+         pos = ini.get_item("snapshot_dir");
+         if (ini.items[pos].found) {
+            snapdir = ini.items[pos].val.strval;
+         }
+         pos = ini.get_item("retry");
+         if (ini.items[pos].found) {
+            retry = ini.items[pos].val.int32val;
+         }
+         pos = ini.get_item("disabled");
+         if (ini.items[pos].found) {
+            disabled = ini.items[pos].val.boolval;
+         }
+         pos = ini.get_item("fail_job_on_error");
+         if (ini.items[pos].found) {
+            fail_job_on_error = ini.items[pos].val.boolval;
+         }
+      }
+      return true;
+   };
+};
+
+class snapshot {
+public:
+   const char *type;            /* snapshot type, btrfs, zfs, etc.. */
+   POOLMEM    *cmd;             /* buffer to edit a command */
+   POOLMEM    *path;            /* buffer to edit volume path */
+   POOLMEM    *fname;           /* used for split_path_and_filename */
+   POOLMEM    *errmsg;          /* buffer to edit error message */
+   arguments  *arg;             /* program argument */
+   int         pnl;             /* path length */
+   int         fnl;             /* fname length */
+
+   snapshot(arguments *a, const char *t):
+      type(t),
+      cmd(get_pool_memory(PM_NAME)),
+      path(get_pool_memory(PM_NAME)),
+      fname(get_pool_memory(PM_NAME)),
+      errmsg(get_pool_memory(PM_NAME)),
+      arg(a),
+      pnl(0),
+      fnl(0)
+   {
+   };
+
+   virtual ~snapshot() {
+      free_pool_memory(cmd);
+      free_pool_memory(path);
+      free_pool_memory(fname);
+      free_pool_memory(errmsg);
+   };
+
+   /* Basically, we check parameters here that are
+    * common to all backends
+    */
+   virtual int mount() {
+      Dmsg(10, "[%s] Doing mount command\n", type);
+      if (!arg->volume || !arg->name || !arg->device || !arg->mountpoint) {
+         Dmsg(10, "volume=%s name=%s device=%s mountpoint=%s\n",
+              NPRT(arg->volume), NPRT(arg->name), 
+              NPRT(arg->device), NPRT(arg->mountpoint)); 
+         return 0;
+      }
+      return 1;
+   };
+
+   virtual int unmount() {
+      Dmsg(10, "[%s] Doing unmount command on %s\n", type, 
+           NPRT(arg->snapmountpoint));
+      if (!arg->snapmountpoint) {
+         Dmsg(10, "snapmountpoint=%s\n", NPRT(arg->snapmountpoint)); 
+         return 0;
+      }
+      return 1;
+   };
+
+   virtual int support() {
+      Dmsg(10, "[%s] Doing support on %s (%s)\n", type, NPRT(arg->mountpoint), 
+           NPRT(arg->device));
+      if (!arg->fstype || !arg->mountpoint || !arg->device) {
+         Dmsg(10, "fstype=%s mountpoint=%s device=%s\n",
+              NPRT(arg->fstype), NPRT(arg->mountpoint), NPRT(arg->device)); 
+         return 0;
+      }
+      return 1;
+   };
+
+   virtual int check() {
+      Dmsg(10, "[%s] Doing check on %s\n", type, NPRT(arg->mountpoint));
+      if (!arg->mountpoint) {
+         Dmsg(10, "mountpoint=%s\n", NPRT(arg->mountpoint)); 
+         return 0;
+      }
+      return 1;
+   };
+
+   virtual int create() {
+      Dmsg(10, "[%s] Doing create %s\n", type, NPRT(arg->mountpoint));
+      if (!arg->mountpoint || !arg->name || !arg->device) {
+         Dmsg(10, "mountpoint=%s name=%s device=%s\n",
+              NPRT(arg->mountpoint), NPRT(arg->name), NPRT(arg->device)); 
+         return 0;
+      }
+      return 1;
+   };
+
+   virtual int del() {
+      Dmsg(10, "[%s] Doing del %s\n", type, NPRT(arg->volume));
+      if (!arg->volume || !arg->name) {
+         Dmsg(10, "volume=%s name=%s\n",
+              NPRT(arg->volume), NPRT(arg->name)); 
+         return 0;
+      }
+      return 1;
+   };
+
+   virtual int list() {
+      Dmsg(10, "[%s] Doing list on %s\n", type, NPRT(arg->device));
+      if (!arg->type || !arg->device || !arg->mountpoint) {
+         return 0;
+      }
+      return 1;
+   };
+
+   virtual int subvolumes() {
+      Dmsg(10, "[%s] Doing subvolumes %s\n", type, NPRT(arg->mountpoint));
+      if (!arg->fstype || !arg->device || !arg->mountpoint) {
+         return 0;
+      }
+      return 1;
+   };
+
+   /* Function used in create() to know if we mark the error as FATAL */
+   int get_error_code() {
+      Dmsg1(0, "get_error_code = %d\n", (int)arg->fail_job_on_error);
+      /* 1 is OK */
+      if (arg->fail_job_on_error) {
+         return 0;           /* Fatal */
+      }
+      return 2;              /* Error */
+   };
+};
+
+/* Structure used to sort subvolumes with btrfs backend */
+struct vols {
+   rblink  link;
+   int64_t id;
+   int     count;
+   char    uuid[MAX_NAME_LENGTH];
+   char    puuid[MAX_NAME_LENGTH];
+   char    otime[MAX_NAME_LENGTH];
+   char    path[1];
+};
+
+int vols_compare_id(void *item1, void *item2)
+{
+   vols *vol1 = (vols *) item1;
+   vols *vol2 = (vols *) item2;
+
+   if (vol1->id > vol2->id) {
+      return 1;
+      
+   } else if (vol1->id < vol2->id) {
+      return -1;
+
+   } else {
+      return 0;
+   }
+}
+
+int vols_compare_uuid(void *item1, void *item2)
+{
+   vols *vol1 = (vols *) item1;
+   vols *vol2 = (vols *) item2;
+
+   return strcmp(vol1->uuid, vol2->uuid);
+}
+
+/* btrfs backend */
+class btrfs: public snapshot {
+public:
+   btrfs(arguments *arg): snapshot(arg, "btrfs")  {};
+
+   /* With BTRFS, the volume is already mounted */
+   int mount() {
+      if (!snapshot::mount()) {
+         return 0;
+      }
+      split_path_and_filename(arg->volume, &path, &pnl, &fname, &fnl);
+      fprintf(stdout, "status=1 snapmountpoint=\"%s\" snapdirectory=\"%s\"\n",
+              arg->volume, path);
+      return 1;
+   };
+
+   int unmount() {
+      if (!snapshot::unmount()) {
+         return 0;
+      }
+      printf("status=1\n");
+      return 1;
+   };
+
+   int support() {
+      if (!snapshot::support()) {
+         return 0;
+      }
+      /* If the fstype is btrfs, snapshots are supported */
+/*
+      Mmsg(cmd, "%sbtrfs filesystem label \"%s\"", arg->sudo, arg->mountpoint);
+      if (run_program(cmd, 60, errmsg)) {
+         printf("status=0 type=btrfs\n");
+         return 0;
+      }
+      Dmsg(0, "output=%s\n", errmsg);
+*/
+      printf("status=1 device=\"%s\" type=btrfs\n", arg->mountpoint);
+      return 1;
+   };
+
+   int check() {
+      if (!snapshot::check()) {
+         return 0;
+      }
+      return 1;
+   };
+
+   int create() {
+      utime_t createdate = 0;
+      char ed1[50];
+      if (!snapshot::create()) {
+         return 0;
+      }
+
+      Mmsg(path, "%s/%s", arg->mountpoint, arg->snapdir);
+      if (!makedir(path)) {
+         printf("status=%d error=\"Unable to create mountpoint directory %s errno=%d\n",
+                get_error_code(),
+                arg->mountpoint, errno);
+         return 0;
+      }
+
+      Dmsg(10, "mountpoint=%s snapdir=%s name=%s\n", arg->mountpoint, arg->snapdir, arg->name);
+      path_concat(path, arg->mountpoint, arg->snapdir, arg->name);
+      Dmsg(10, "path=%s\n", path);
+
+      /* Create the actual btrfs snapshot */
+      Mmsg(cmd, "%sbtrfs subvolume snapshot -r \"%s\" \"%s\"", 
+           arg->sudo, arg->mountpoint, path);
+
+      if (run_program(cmd, 60, errmsg)) {
+         Dmsg(10, "Unable to create snapshot %s %s\n", arg->mountpoint, errmsg);
+         strip_quotes(errmsg);
+         printf("status=%d error=\"Unable to create snapshot %s\"\n",
+                get_error_code(),
+                errmsg);
+         return 0;
+      }
+
+      /* On SLES12 btrfs 3.16, commands on "/" returns "doesn't belong to btrfs mount point" */
+      Mmsg(cmd, "%sbtrfs subvolume show \"%s\"", arg->sudo, path);
+      if (run_program_full_output(cmd, 60, errmsg)) {
+         Dmsg(10, "Unable to display snapshot stats %s %s\n", arg->mountpoint, errmsg);
+
+      } else {
+         /* TODO: Check that btrfs subvolume show is reporting "Creation time:" */
+         char *p = strstr(errmsg, "Creation time:");
+         if (p) {
+            p += strlen("Creation time:");
+            skip_spaces(&p);
+            createdate = str_to_utime(p);
+
+         } else {
+            Dmsg(10, "Unable to find Creation time on %s %s\n", arg->mountpoint, errmsg);
+         }
+      }
+
+      if (!createdate) {
+         createdate = time(NULL);
+      }
+      printf("status=1 volume=\"%s\" createtdate=%s type=btrfs\n", 
+             path, edit_uint64(createdate, ed1));
+      return 1;
+   };
+
+   int del() {
+      if (!snapshot::del()) {
+         return 0;
+      }
+
+      Mmsg(cmd, "%sbtrfs subvolume delete \"%s\"", arg->sudo, arg->volume);
+      if (run_program(cmd, 300, errmsg)) {
+         Dmsg(10, "Unable to delete snapshot %s\n", errmsg);
+         strip_quotes(errmsg);
+         printf("status=0 type=btrfs error=\"%s\"\n", errmsg);
+         return 0;
+      }
+      printf("status=1\n");
+      return 1;
+   };
+
+   /* btrfs subvolume list -u -q -s /tmp/regress/btrfs
+    * ID 259 gen 52 top level 5 parent_uuid - uuid baf4b5d7-28d0-9b4a-856e-36e6fd4fbc96 path .snapshots/aaa
+    */
+   int list() {
+      char *p, *p2, *end, *path;
+      char  id[50], day[50], hour[50];
+      struct vols *v = NULL, *v2;
+      rblist *lst;
+
+      if (!snapshot::list()) {
+         return 0;
+      }
+      Mmsg(cmd, "%sbtrfs subvolume list -u -q -o -s \"%s\"", arg->sudo, arg->mountpoint);
+      if (run_program_full_output(cmd, 300, errmsg)) {
+         Dmsg(10, "Unable to list snapshot %s\n", errmsg);
+         strip_quotes(errmsg);
+         printf("status=0 type=btrfs error=\"%s\"\n", errmsg);
+         return 0;
+      }
+
+      lst = New(rblist(v, &v->link));
+
+      /* ID 259 gen 52 top level 5 parent_uuid - uuid baf4b5d7-28d0-9b4a-856e-36e6fd4fbc96 path .snapshots/aaa */
+      for (p = errmsg; p && *p ;) {
+         Dmsg(20, "getting subvolumes from %s", p);
+
+         /* Replace final \n by \0 to have strstr() happy */
+         end = strchr(p, '\n');
+
+         /* If end=NULL, we are at the end of the buffer (without trailing \n) */
+         if (end) { 
+            *end = 0;
+         }
+
+         /* Each line is supposed to start with "ID", and end with "path" */
+         bool ok = false;
+         if (sscanf(p, "ID %50s ", id) == 1) {              /* We found ID, look for path */
+            p2 = strstr(p, "path ");
+            if (p2) {
+               path = p2 + strlen("path ");
+               v = (struct vols*) malloc(sizeof (vols) + strlen(path) + 1);
+               *v->otime = *v->uuid = *v->puuid = 0;
+               v->id = str_to_int64(id);
+               v->count = 0;
+               strcpy(v->path, path);
+
+               p2 = strstr(p, "otime");
+               if (p2 && sscanf(p2, "otime %50s %50s", day, hour) == 2) {
+                  bsnprintf(v->otime, sizeof(v->otime), "%s %s", day, hour);
+               }
+
+               p2 = strstr(p, "parent_uuid ");
+               if (p2 && sscanf(p2, "parent_uuid %127s", v->puuid) == 1) {
+
+                  p2 = strstr(p, " uuid ");
+                  if (p2 && sscanf(p2, " uuid %127s", v->uuid) == 1) {
+
+                     v2 = (struct vols *)lst->insert(v, vols_compare_uuid);
+                     if (v2 != v) {
+                        v2->count++;
+                        free(v);
+                     }
+                     ok = true;
+                     /* Replace final \n by \0 to have strstr() happy */
+                     Dmsg(10, "puuid=%s uuid=%s path=%s\n", v2->puuid, v2->uuid, v2->path);
+                  } 
+               } 
+            }
+         }
+         if (!ok) {
+            Dmsg(10, "Unable to decode \"%s\" line\n", p);
+         }
+         if (end) {
+            *end = '\n';
+            end++;
+         }
+         /* If end==NULL, we stop */
+         p = end;
+      }
+
+      foreach_rblist(v, lst) {
+         char *name = v->path;
+         int   len = strlen(arg->snapdir);
+         if ((p = strstr(v->path, arg->snapdir))) {
+            name = p + len + ((arg->snapdir[len-1] == '/') ? 0 : 1);
+         }
+         printf("volume=\"%s%s%s\" name=\"%s\" device=\"%s\" createdate=\"%s\" type=\"btrfs\"\n",
+                arg->mountpoint,
+                arg->mountpoint[strlen(arg->mountpoint) - 1] == '/' ? "": "/",
+                v->path,
+                name,
+                arg->mountpoint,
+                v->otime
+            );
+      }
+
+      delete lst;
+      return 1;
+   };
+
+   void scan_subvolumes(char *buf, rblist *lst) {
+      char *p, *end;
+      char  id[50];
+      bool  ok;
+      struct vols *elt1 = NULL, *elt2 = NULL;
+
+      /* btrfs subvolume list /var/lib/pacman/
+       * ID 349 gen 383 top level 5 path test
+       * ID 354 gen 391 cgen 391 top level 5 otime 2014-11-05 17:49:07 path .snapshots/aa
+       */
+      for (p = buf; p && *p ;) {
+         Dmsg(20, "getting subvolumes from %s", p);
+
+         /* Replace final \n by \0 to have strstr() happy */
+         end = strchr(p, '\n');
+         /* If end=NULL, we are at the end of the buffer (without trailing \n) */
+         if (end) { 
+            *end = 0;
+         }
+
+         /* Each line is supposed to start with "ID", and end with "path" */
+         ok = (sscanf(p, "ID %50s ", id) == 1);
+         if (ok) {              /* We found ID, look for path */
+            p = strstr(p, "path ");
+            if (p) {
+               p += strlen("path ");
+
+               elt1 = (struct vols *) malloc(sizeof(struct vols) + strlen(p) + 1);
+               elt1->id = str_to_int64(id);
+               elt1->count = 0;
+               strcpy(elt1->path, p);
+               Dmsg(10, "Found path %s for id %s\n", elt1->path, id);
+               elt2 = (struct vols *)lst->insert(elt1, vols_compare_id);
+               if (elt2 != elt1) {
+                  elt2->count++;
+                  free(elt1);
+               }
+            } else {
+               Dmsg(10, "Unable to find the path in this line\n");
+            }
+
+         } else {
+            Dmsg(10, "Unable to decode %s line\n", p);
+         }
+         if (end) {
+            *end = '\n';
+            end++;
+         }
+         /* If end==NULL, we stop */
+         p = end;
+      } 
+   };
+
+   /* List subvolumes, they may not be listed by mount */
+   int subvolumes() {
+      rblist      *lst;
+      struct stat  sp;
+      struct vols *elt1 = NULL;
+      char   ed1[50];
+
+      Mmsg(cmd, "%sbtrfs subvolume show \"%s\"", arg->sudo, arg->mountpoint);
+      if (run_program_full_output(cmd, 300, errmsg)) {
+         Dmsg(10, "Unable to get information %s\n", errmsg);
+         strip_quotes(errmsg);
+         printf("status=0 type=btrfs error=\"%s\"\n", errmsg);
+         return 0;
+      }
+
+      /* TODO: Very week way to analyse FS */
+      if (!strstr(errmsg, "is btrfs root")) {
+         printf("status=0 type=btrfs error=\"Not btrfs root fs\"\n");
+         return 0;
+      }
+      
+      Mmsg(cmd, "%sbtrfs subvolume list -s \"%s\"", arg->sudo, arg->mountpoint);
+      if (run_program_full_output(cmd, 300, errmsg)) {
+         Dmsg(10, "Unable to list snapshot snapshot %s\n", errmsg);
+         strip_quotes(errmsg);
+         printf("status=0 type=btrfs error=\"%s\"\n", errmsg);
+         return 0;
+      }
+
+      lst = New(rblist(elt1, &elt1->link));
+      scan_subvolumes(errmsg, lst);
+
+      Mmsg(cmd, "%sbtrfs subvolume list \"%s\"", arg->sudo, arg->mountpoint);
+      if (run_program_full_output(cmd, 300, errmsg)) {
+         Dmsg(10, "Unable to list subvolume %s\n", errmsg);
+         strip_quotes(errmsg);
+         printf("status=0 type=btrfs error=\"%s\"\n", errmsg);
+         delete lst;
+         return 0;
+      }
+      scan_subvolumes(errmsg, lst);
+
+      foreach_rblist(elt1, lst) {
+         if (elt1->count > 0) { /* Looks to be a snapshot, we saw two entries */
+            continue;
+         }
+
+         path_concat(path, arg->mountpoint, elt1->path, NULL);
+
+         if (stat(path, &sp) == 0) {
+            printf("dev=%s mountpoint=\"%s\" fstype=btrfs\n", 
+                   edit_uint64(sp.st_dev, ed1), path);
+
+         } else {
+            Dmsg(10, "Unable to stat %s (%s)\n", elt1->path, path);
+         }
+      }
+      delete lst;
+      return 1;
+   };
+};
+
+/* Create pool
+ * zpool create pool /dev/device
+ * zfs create pool/eric
+ * zfs set mountpoint=/mnt test/eric
+ * zfs mount pool/eric
+ */
+/* zfs backend */
+class zfs: public snapshot {
+public:
+   zfs(arguments *arg): snapshot(arg, "zfs")  {
+      arg->snapdir = ".zfs/snapshot";
+   };
+
+   /* With ZFS, the volume is already mounted 
+    * but on linux https://github.com/zfsonlinux/zfs/issues/173
+    * we need to use the mount command.
+    * TODO: Adapt the code for solaris
+    */
+   int mount() {
+      struct stat sp;
+
+      if (!snapshot::mount()) {
+         return 0;
+      }
+
+      path_concat(path, arg->mountpoint, arg->snapdir, arg->name);
+
+      if (stat(path, &sp) != 0) {
+         /* See if we can change the snapdir attribute */
+         Mmsg(cmd, "%szfs set snapdir=visible \"%s\"", arg->sudo, arg->device);
+         if (run_program(cmd, 60, errmsg)) {
+            Dmsg(10, "Unable to change the snapdir attribute %s %s\n", arg->device, errmsg);
+            strip_quotes(errmsg);
+            printf("status=0 error=\"Unable to mount snapshot %s\"\n", errmsg);
+            return 0;
+         }
+         if (stat(path, &sp) != 0) {
+            Dmsg(10, "Unable to get the snapdir %s %s\n", arg->snapdir, arg->device);
+            strip_quotes(errmsg);
+            printf("status=0 error=\"Unable to mount snapshot, no snapdir %s\"\n", arg->snapdir);
+            return 0;
+         }
+      }
+#if 0                           /* On linux, this function is broken for now */
+      makedir(path);
+      Mmsg(cmd, "%smount -t %s \"%s\" \"%s\"", arg->sudo, arg->fstype, arg->volume, path);
+      if (run_program(cmd, 60, errmsg)) {
+         Dmsg(10, "Unable to create mount snapshot %s %s\n", arg->volume, errmsg);
+         strip_quotes(errmsg);
+         printf("status=0 error=\"Unable to mount snapshot %s\"\n", errmsg);
+         return 0;
+      }
+
+#endif
+      fprintf(stdout, "status=1 snapmountpoint=\"%s\" snapdirectory=\"%s/%s\"\n",
+              path, arg->mountpoint, arg->snapdir);
+      return 1;
+   };
+
+   /* No need to unmount something special */
+   int unmount() {
+      printf("status=1\n");
+      return 1;
+   };
+
+   int support() {
+      if (!snapshot::support()) {
+         return 0;
+      }
+      Mmsg(cmd, "%szfs list -H -o name \"%s\"", arg->sudo, arg->mountpoint);
+      if (run_program(cmd, 60, errmsg)) {
+         Dmsg(10, "Unable to get device %s %s\n", arg->mountpoint, errmsg);
+         strip_quotes(errmsg);
+         printf("status=0 error=\"Unable to get device %s\"\n", errmsg);
+         return 0;
+      }
+      strip_trailing_junk(errmsg);
+      /* If the fstype is zfs, snapshots are supported */
+      printf("status=1 device=\"%s\" type=zfs\n", errmsg);
+      return 1;
+   };
+
+   int create() {
+      char ed1[50];
+
+      if (!snapshot::create()) {
+         return 0;
+      }
+
+      Mmsg(path, "%s@%s", arg->device, arg->name);
+
+      /* Create the actual zfs snapshot */
+      Mmsg(cmd, "%szfs snapshot \"%s\"", arg->sudo, path);
+
+      if (run_program(cmd, 60, errmsg)) {
+         Dmsg(10, "Unable to create snapshot %s %s\n", arg->device, errmsg);
+         strip_quotes(errmsg);
+         printf("status=%d error=\"Unable to create snapshot %s\"\n",
+                get_error_code(),
+                errmsg);
+         return 0;
+      }
+
+      Mmsg(cmd, "%szfs get -p creation \"%s\"", arg->sudo, path);
+      if (run_program_full_output(cmd, 60, errmsg)) {
+         Dmsg(10, "Unable to display snapshot stats %s %s\n", arg->device, errmsg);
+         strip_quotes(errmsg);
+         printf("status=%d error=\"Unable to get snapshot info %s\"\n",
+                get_error_code(),
+                errmsg);
+         return 0;
+      } 
+
+      /* TODO: Check that zfs get is reporting "creation" time */
+      Mmsg(cmd, "NAME PROPERTY VALUE SOURCE\n%s creation %%s", path);
+      if (sscanf(errmsg, cmd, ed1) == 1) {
+         Dmsg(10, "Found CreateTDate=%s\n", ed1);
+         printf("status=1 volume=\"%s\" createtdate=%s type=zfs\n", 
+                path, ed1);
+
+      } else {
+         printf("status=1 volume=\"%s\" createtdate=%s type=zfs\n", 
+                path, edit_uint64(time(NULL), ed1));
+      }
+      return 1;
+   };
+
+   int del() {
+      if (!snapshot::del()) {
+         return 0;
+      }
+
+      Mmsg(cmd, "%szfs destroy \"%s\"", arg->sudo, arg->volume);
+      if (run_program(cmd, 300, errmsg)) {
+         Dmsg(10, "Unable to delete snapshot %s\n", errmsg);
+         strip_quotes(errmsg);
+         printf("status=0 type=zfs error=\"%s\"\n", errmsg);
+         return 0;
+      }
+      printf("status=1\n");
+      return 1;
+   };
+
+   /* zfs list -t snapshot 
+    * test/eric at snap1    17K      -    21K  -
+    * test/eric at snap2    17K      -    21K  -
+    * 
+    * it is possible to change fields to display with -o 
+    */
+   int list() {
+      POOL_MEM buf2;
+      if (!snapshot::list()) {
+         return 0;
+      }
+
+      Mmsg(cmd, "%szfs list -t snapshot -H -o name,used,creation", arg->sudo);
+      /* rpool at basezone_snap00   0       Fri Mar  6  9:55 2015  */
+      if (run_program_full_output(cmd, 60, errmsg)) {
+         Dmsg(10, "Unable to list snapshot %s\n", errmsg);
+         strip_quotes(errmsg);
+         printf("status=0 error=\"Unable to list snapshot %s\"\n", errmsg);
+         return 0;
+      }
+
+      int  i = 1, Day, Year, Hour, Min;
+      char DayW[50], Month[50], CreateDate[50];
+      const char *buf[4];
+
+      buf[0] = errmsg;
+      for (char *p = errmsg; p && *p ; p++) {
+         if (*p == '\n') {
+            *p = 0;
+            /* Flush the current one */
+            if (!arg->device || strcmp(arg->device, buf[0]) == 0) {
+
+               if (sscanf(buf[3], "%s %s %d %d:%d %d",
+                          DayW, Month, &Day, &Hour, &Min, &Year) == 6)
+               {
+                  /* Get a clean iso format */
+                  for (int j=1; j <= 12 ; j++) {
+                     if (strcmp(Month, Months[j]) == 0) {
+                        snprintf(Month, sizeof(Month), "%02d", j);
+                     }
+                  }
+                  snprintf(CreateDate, sizeof(CreateDate), "%d-%s-%02d %02d:%02d:00",
+                           Year, Month, Day, Hour, Min);
+                  buf[3] = CreateDate;
+               }
+               printf("volume=\"%s@%s\" name=\"%s\" device=\"%s\" size=\"%s\" "
+                      "createdate=\"%s\" status=1 error=\"\" type=\"zfs\"\n",
+                      buf[0], buf[1], buf[1], buf[0], buf[2], buf[3]);
+            } else {
+               Dmsg(10, "Do not list %s@%s\n", buf[0], buf[1]);
+            }
+
+            i = 1;
+            buf[0] = p+1;
+            buf[1] = buf[2] = buf[3] = "";
+
+         } else if ((*p == '\t' || *p == '@') && i < 4) {
+            buf[i++] = p+1;
+            *p = 0;
+         }
+      }
+
+      return 1;
+   };
+};
+
+/* Structure of the LVS output */
+typedef struct {
+   const char *name;
+   int         pos;
+} Header;
+
+/* -1 is mandatory, -2 is optionnal */
+static Header lvs_header[] = {
+   /* KEEP FIRST */
+   {"Path",  -1},        /* Volume Path: /dev/ubuntu-vg/root */
+   {"DMPath",-2},        /* Device mapper Path /dev/mapper/ubuntu--vg-root */
+   {"LV",    -1},        /* Volume Name: root  */
+   {"Attr",  -1},        /* Attributes:  -wi-ao--- */
+   {"KMaj",  -1},        /* Kernel Major: 252 */
+   {"KMin",  -1},        /* Kernel Minor: 0 */
+   {"LSize", -1},        /* Size (b)  */
+   {"#Seg",  -1},        /* Number of segments */
+   {"Origin",-1},
+   {"OSize", -1},
+   {"Snap%", -1},
+   {"Time",  -1},        /* Creation date  */
+   {NULL,    -1}
+};
+
+static Header vgs_header[] = {
+   /* KEEP FIRST */
+   {"VG",    -1},        /* VG Name: vgroot  */
+   {"VSize", -1},        /* Size */
+   {"VFree", -1},        /* Space left */
+   {"#Ext",  -1},        /* Nb Ext */
+   {"Free",  -1},        /* Nb Ext free */
+   {"Ext",   -1},        /* Ext size */
+   {NULL,    -1}
+};
+
+/* LVM backend, not finished */
+class lvm: public snapshot {
+public:
+   alist *lvs, *vgs;
+   int    lvs_nbelt, vgs_nbelt;
+
+   lvm(arguments *arg):
+     snapshot(arg, "lvm"), lvs(NULL), vgs(NULL), lvs_nbelt(0),
+        vgs_nbelt(0) {};
+
+   ~lvm() {
+      free_header(lvs, lvs_nbelt);
+      free_header(vgs, vgs_nbelt);
+   };
+
+   void free_header(alist *lst, int nbelt) {
+      if (lst) {
+         char **current;
+         /* cleanup at the end */
+         foreach_alist(current, lst) {
+            for (int j=0; j < nbelt ; j++) {
+               Dmsg(50, "current[%d] = %s\n", j, current[j]);
+               free(current[j]);
+            }
+            free(current);
+         }
+         delete lst;
+      }
+   };
+
+   char *get_vg_from_lv_path(char *path, char *vg, int max) {
+      char *p;
+
+      if (!path) {
+         return NULL;
+      }
+
+      /* Make a copy of the path */
+      bstrncpy(vg, path, max);
+      path = vg;
+
+      if (strncmp(path, "/dev/", 5) != 0) {
+         Dmsg(10, "Strange path %s\n", path);
+         return NULL;
+      }
+      path += 5;             /* skip /dev/ */
+
+      /* End the string at the last / */
+      p = strchr(path, '/');
+      if (!p) {
+         Dmsg(10, "Strange end of path %s\n", path);
+         return NULL;
+      }
+      *p = 0;
+
+      return path;
+   };
+
+   /* Report the space available on VG */
+   int64_t get_space_available(char *lv) {
+      char  buf[512];
+      char *vgname = get_vg_from_lv_path(get_lv_value(lv, "Path"), 
+                                         buf, sizeof(buf));
+
+      if (vgname) {
+         char *s = get_vg_value(vgname, "VFree");
+         if (s) {
+            return str_to_int64(s);
+
+         } else {
+            Dmsg(10, "Unable to get VFree\n");
+         }
+
+      } else {
+         Dmsg(10, "Unable to get VG from %s\n", lv);
+      }
+      return -1;
+   };
+
+   /* return vg_ssd-pacman */
+   char *get_lv_from_dm(char *dm, POOLMEM **ret, uint32_t *major, uint32_t *minor) {
+      struct stat sp;
+      char *p, *start;
+      uint32_t maj, min;
+
+      /* Looks to be a device mapper, need to convert the name */
+      if (strncmp(dm, "/dev/dm", strlen("/dev/dm")) != 0) {
+         return NULL;
+      }
+      if (stat(dm, &sp) < 0) {
+         return NULL;
+      }
+
+      Mmsg(cmd, "%sdmsetup ls", arg->sudo);
+      if (run_program_full_output(cmd, 60, errmsg)) {
+         Dmsg(10, "Unable to query dmsetup %s\n", errmsg);
+         return NULL;
+      }
+      /* vg_ssd-pacman-real     (254:1)
+       * vg_ssd-pacman  (254:0)
+       * or
+       * vg_ssd-pacman-real     (254, 1)
+       * vg_ssd-pacman-real     (254, 1)
+       */
+      *ret = check_pool_memory_size(*ret, strlen(errmsg)+1);
+      for (start = p = errmsg; *p ; p++) {
+         if (*p == '\n') {
+            *p = 0;
+            if (sscanf(start, "%s (%d:%d)", *ret, &maj, &min) == 3 ||
+                sscanf(start, "%s (%d, %d)", *ret, &maj, &min) == 3)
+            {
+               if (maj == major(sp.st_rdev) &&
+                   min == minor(sp.st_rdev))
+               {
+                  return *ret;
+               }
+            }
+            start = p+1;
+         }
+      }
+      return NULL;
+   };
+
+   /* The LV path from name or dmpath */
+   char **get_lv(char *lv) {
+      char **elt = NULL, *dm = NULL;
+      int path = get_value_pos(lvs_header, "Path");
+      int dmpath = get_value_pos(lvs_header, "DMPath");
+      int kmaj = get_value_pos(lvs_header, "KMaj");
+      int kmin = get_value_pos(lvs_header, "KMin");
+      uint32_t min = 0, maj = 0;
+      POOLMEM *buf = get_pool_memory(PM_FNAME);
+
+      if (!lv || (path < 0 && dmpath < 0)) {
+         Dmsg(10, "Unable to get LV parameters\n");
+         goto bail_out;
+      }
+
+      dm = get_lv_from_dm(lv, &buf, &maj, &min);
+      Dmsg(50, "%s = get_lv_from_dm(%s, %s, %d, %d)\n", dm, lv, buf, maj, min);
+
+      /* HERE: Need to loop over LVs */
+      foreach_alist(elt, lvs) {
+         if (path > 0 && strcmp(NPRT(elt[path]), lv) == 0) {
+            goto bail_out;
+         }
+
+         if (dmpath > 0 && strcmp(NPRT(elt[dmpath]), lv) == 0) {
+            goto bail_out;
+         }
+
+         /* Try by Minor/Major if comming from device mapper */
+         if ((maj && kmaj && str_to_uint64(elt[kmaj]) == maj) &&
+             (min && kmin && str_to_uint64(elt[kmin]) == min))
+         {
+            goto bail_out;
+         }
+
+         /* Find if /dev/mapper/vg_ssd-pacman matches vg_ssd-pacman */
+         if (dm && dmpath && strlen(elt[dmpath]) > strlen("/dev/mapper/")) {
+            if (strcmp(elt[dmpath] + strlen("/dev/mapper/"), dm) == 0) {
+               goto bail_out;
+            }
+         }
+
+         /* Special case for old LVM where mapper path doesn't exist */
+         if (dmpath < 0 && strncmp("/dev/mapper/", lv, 12) == 0) {
+
+            POOLMEM *buf2 = get_memory(strlen(elt[path])*2+10);
+            pm_strcpy(buf2, "/dev/mapper/");
+
+            char *d = buf2 + 12; /* Skip /dev/mapper/ */
+            bool ret = false;
+
+            /* Keep the same path, but escape - to -- and / to - */
+            for (char *p = elt[path]+5; *p ; p++) {
+               if (*p == '-') {
+                  *d++ = *p;
+               }
+               /* Escape / to - if needed */
+               *d++ = (*p == '/') ? '-' : *p;
+            }
+            *d = 0;
+            ret = (strcmp(buf2, lv) == 0);
+            free_pool_memory(buf2);
+
+            if (ret) {
+               goto bail_out;
+            }
+         }
+      }
+      Dmsg(10, "%s not found in lv list\n", lv);
+      return NULL;              /* not found */
+
+   bail_out:
+      if (buf) {
+         free_pool_memory(buf);
+      }
+      return elt;
+   };
+
+   /* Report LV Size in bytes */
+   int64_t get_lv_size(char *name) {
+      char **elt = get_lv(arg->device);
+      int sp;
+
+      if (!elt) {
+         return -1;
+      }
+
+      sp = get_value_pos(lvs_header, "LSize");
+      /* Check if we have enough space on the VG */
+      return str_to_int64(elt[sp]);
+   };
+
+   char *get_lv_value(char *name, const char *value) {
+      return get_value(lvs_header, lvs_nbelt, lvs, name, value);
+   };
+
+   int get_value_pos(Header *header, const char *value) {
+      for (int i = 0; header[i].name ; i++) {
+         if (strcmp(header[i].name, value) == 0) {
+            return header[i].pos;
+         }
+      }
+      return -1;                /* not found */
+   };
+   
+   /* Return an element value */
+   char *get_value(Header *header, int nbelt, alist *lst,
+                   char *name, const char *value) {
+      char **elt;
+      int    pos = get_value_pos(header, value);
+      int    id  = header[0].pos; /* position name */
+
+      if (pos < 0 || id == -1) {
+         return NULL;
+      }
+      /* Loop over elements we have, and return the value that is asked */
+      foreach_alist(elt, lst) {
+         if (strcmp(NPRT(elt[id]), name) == 0) {
+            return elt[pos];
+         }
+      }
+      return NULL;
+   };
+
+   /* Return a parameter for a VolumeGroup */
+   char *get_vg_value(char *vg, const char *value) {
+      return get_value(vgs_header, vgs_nbelt, vgs, vg, value);
+   };
+
+   /* Get snapshot size, look in config file if needed */
+   int get_lvm_snapshot_size(char *lv) {
+      char *tmp, **elt;
+      uint64_t s, size;
+      int    sp;
+      alist *lst;
+
+      int pos = arg->ini.get_item("lvm_snapshot_size");
+      if (!arg->ini.items[pos].found) {
+         return -1;             /* Nothing specified, stop here */
+      }
+
+      lst = arg->ini.items[pos].val.alistval;
+      if (lst) {
+         /* /dev/ubuntu-vg/root:100M 
+          * /dev/ubuntu-vg/home:10%
+          * /dev/ubuntu-vg/var:200GB
+          */
+         foreach_alist(tmp, lst) {
+            char *p = strchr(tmp, ':');
+
+            /* Check the LV name */
+            if (p && strncmp(tmp, lv, p - tmp) != 0) {
+               continue;
+            }
+
+            /* This is a percent */
+            if (strchr(p+1, '%') != NULL) {
+               Dmsg(10, "Found a %%\n");
+               s = str_to_int64(p+1);
+
+               /* Compute the requested size */
+               sp = get_value_pos(lvs_header, "LSize");
+               elt = get_lv(lv);
+               size = str_to_int64(elt[sp]);
+               return size * (s / 100);
+            }
+
+            /* It might be a size */
+            if (size_to_uint64(p+1, strlen(p+1), &s)) {
+               Dmsg(10, "Found size %ld\n", s);
+               return s;
+            }
+            Dmsg(10, "Unable to use %s\n", tmp);
+            return -1;
+         }
+      }
+      return -1;
+   };
+
+   int create() {
+      char   *name, *ts, buf[128], *lvname;
+      int64_t size, ssize, maxsize;
+      if (!snapshot::create()) {
+         return 0;
+      }
+
+      if (!parse_lvs_output() ||
+          !parse_vgs_output())
+      {
+         printf("status=%d error=\"Unable parse lvs or vgs output\"\n",
+                get_error_code());
+         return 0;
+      }
+
+      path_concat(path, arg->mountpoint, arg->snapdir, arg->name);
+
+      if (!makedir(path)) {
+         printf("status=%d error=\"Unable to create mountpoint directory %s errno=%d\n",
+                get_error_code(),
+                arg->mountpoint, errno);
+         return 0;
+      }
+
+      name = get_lv_value(arg->device, "LV");
+      size = get_lv_size(arg->device);
+      if (size < 0) {
+         printf("status=%d error=\"Unable to get lv size\"\n",
+                get_error_code());
+         return 0;
+      }
+
+      ssize = get_lvm_snapshot_size(arg->device);
+      if (ssize > 0) {
+         size = ssize;
+      } else {
+         size = size / 10;         /* Ask to get 10% */
+      }
+
+      size = (size / 512L) * 512L;
+
+      lvname = get_lv_value(arg->device, "Path");
+      maxsize = get_space_available(lvname);
+      Dmsg(10, "maxsize=%ld size=%ld\n", maxsize, size);
+
+      if (maxsize < 0) {
+         printf("status=%d error=\"Unable to detect maxsize\" type=lvm\n",
+                get_error_code());
+         return 0;
+      }
+
+      if (size > maxsize) {
+         char ed1[50], ed2[50];
+         printf("status=%d error=\"Not enough space left on VG %sB, "
+                "%sB is required\" type=lvm\n",
+                get_error_code(),
+                edit_uint64_with_suffix(maxsize, ed1),
+                edit_uint64_with_suffix(size, ed2));
+         return 0;
+      }
+
+      /* TODO: Need to get the volume name and add the snapshot
+       * name at the end 
+       */
+      Mmsg(cmd, "%slvcreate -s -n \"%s_%s\" -L %lldb \"%s\"", 
+           arg->sudo, name, arg->name, size, arg->device);
+      if (run_program(cmd, 60, errmsg)) {
+         Dmsg(10, "Unable to create snapshot %s %s\n", arg->name, errmsg);
+         strip_quotes(errmsg);
+         printf("status=0 error=\"Unable to create snapshot %s\"\n", errmsg);
+         return 0;
+      }
+      if (!parse_lvs_output()) {
+         Dmsg(10, "Unable to parse lvm output after snapshot creation\n");
+         printf("status=0 error=\"Unable to parse lvs\"\n");
+         return 0;
+      }
+
+      Mmsg(cmd, "%s_%s", arg->device, arg->name);
+      ts = get_lv_value(cmd, "Time");
+      if (!ts) {
+         Dmsg(10, "Unable to find snapshot in lvs output\n");
+         bstrftimes(buf, sizeof(buf), time(NULL));
+         ts = buf;
+      }
+      Dmsg(10, "status=1 volume=\"%s_%s\" createdate=\"%s\" type=lvm\n",
+             arg->device, arg->name, ts);
+      printf("status=1 volume=\"%s_%s\" createdate=\"%s\" type=lvm\n",
+             arg->device, arg->name, ts);
+      return 1;
+   };
+
+   int del() {
+      if (!snapshot::del()) {
+         return 0;
+      }
+      Mmsg(cmd, "%slvremove -f \"%s\"", 
+           arg->sudo, arg->volume);
+
+      if (run_program(cmd, 60, errmsg)) {
+         Dmsg(10, "Unable to delete snapshot %s %s\n", arg->name, errmsg);
+         strip_quotes(errmsg);
+         printf("status=0 error=\"Unable to delete snapshot %s\"\n", errmsg);
+         return 0;
+      }
+
+      printf("status=1\n");
+      return 1;
+   };
+
+   int check() {
+      if (!snapshot::check()) {
+         return 0;
+      }
+      parse_vgs_output();
+      for (int i = 0; vgs_header[i].name ; i++) {
+         if (vgs_header[i].pos == -1) {
+            printf("status=0 error=\"Unable to use output of vgs command."
+                   " %s is missing.\"\n", 
+                   vgs_header[i].name);
+            return 0;
+         }
+      }
+
+      parse_lvs_output();
+      for (int i = 0; lvs_header[i].name ; i++) {
+         if (lvs_header[i].pos == -1) {
+            printf("status=0 error=\"Unable to use output of lvs command."
+                   " %s is missing.\"\n",
+                   lvs_header[i].name);
+            return 0;
+         }
+      }
+      return 1;
+   };
+
+   void strip_double_slashes(char *fname)
+   {
+      char *p = fname;
+      while (p && *p) {
+         p = strpbrk(p, "/\\");
+         if (p != NULL) {
+            if (IsPathSeparator(p[1])) {
+               strcpy(p, p+1);
+            }
+            p++;
+         }
+      }
+   };
+
+   int mount() {
+      if (!snapshot::mount()) {
+         return 0;
+      }
+
+      path_concat(path, arg->mountpoint, arg->snapdir, arg->name);
+
+      if (!makedir(path)) {
+         printf("status=0 error=\"Unable to create mount point %s errno=%d\"\n", 
+                path, errno);
+         return 0;
+      }
+
+      Mmsg(cmd, "%smount -o ro \"%s\" \"%s\"", arg->sudo, arg->volume, path);
+      if (run_program(cmd, 60, errmsg) != 0) {
+         Dmsg(10, "Unable to mount volume. ERR=%s\n", errmsg);
+         strip_quotes(errmsg);
+         printf("status=0 error=\"Unable to mount the device %s\"\n", errmsg);
+         return 0;
+      }
+
+      Dmsg(10, "status=1 snapmountpoint=\"%s\" snapdirectory=\"%s/%s\"\n", 
+            path, arg->mountpoint, arg->snapdir);
+      printf("status=1 snapmountpoint=\"%s\" snapdirectory=\"%s/%s\"\n", 
+             path, arg->mountpoint, arg->snapdir);
+      return 1;
+   };
+
+   int unmount() {
+      int ret, retry = arg->retry;
+
+      if (!snapshot::unmount()) {
+         return 0;
+      }
+
+      Mmsg(cmd, "%sumount \"%s\"", arg->sudo, arg->snapmountpoint);
+      do {
+         ret = run_program(cmd, 60, errmsg);
+         if (ret != 0) {
+            Dmsg(10, "Unable to unmount the directory. ERR=%s\n", errmsg);
+            sleep(3);
+         }
+      } while (ret != 0 && retry-- > 0);
+
+      if (ret != 0) {
+         Dmsg(10, "Unable to mount volume. ERR=%s\n", errmsg);
+         strip_quotes(errmsg);
+         printf("status=0 error=\"Unable to umount the device %s\"\n", errmsg);
+         return 0;
+      }
+
+      retry = arg->retry;
+      do {
+         Dmsg(10, "Trying to delete mountpoint %s\n", arg->snapmountpoint);
+         if ((ret = rmdir(arg->snapmountpoint)) != 0) {
+            sleep(3);
+         }
+      } while (retry-- > 0 && ret != 0);
+
+      if (ret != 0) {
+         berrno be;
+         Dmsg(10, "Unable to delete mountpoint after unmount\n");
+         printf("error=\"Unable to delete mountpoint after unmount errno=%s\"",
+                be.bstrerror(errno));
+      }
+      printf(" status=1\n");
+      return 1;
+   };
+
+   /* TODO: Here we need to check LVM settings */
+   int support() {
+      char **elt;
+      int  mp;
+
+      if (!snapshot::support()) {
+         return 0;
+      }
+      if (!check()) {
+         return 0;
+      }
+
+      elt = get_lv(arg->device);
+
+      if (!elt) {
+         Dmsg(10, "Not detected as LVM\n");
+         printf("status=0 error=\"Not detected as LVM\"\n");
+         return 0;
+      }
+      mp = get_value_pos(lvs_header ,"Path");
+      printf("status=1 device=\"%s\" type=lvm\n", elt[mp]);
+      return 1;
+   };
+
+   /* count the number of column in the output */
+   int count_col(char *l, char sep) {
+      int nb=0;
+      for (char *p = l ; *p ; p++) {
+         if (*p == sep) {
+            nb++;
+         }
+      }
+      return nb;
+   };
+
+   /* Decode the Attr field */
+   int decode_attr(char *l) {
+      /*
+       * Volume  type:  (m)irrored,  (M)irrored  without initial sync,
+       * (o)rigin, (O)rigin  with  merging  snapshot,  (r)aid,  (R)aid
+       * without   initial   sync,   (s)napshot,  merging  (S)napshot,
+       * (p)vmove, (v)irtual, mirror or raid (i)mage, mirror  or  raid
+       * (I)mage out-of-sync, mirror (l)og device, under (c)onversion,
+       * thin (V)olume, (t)hin pool, (T)hin pool data,  raid  or  thin
+       * pool m(e)tadata
+       */
+
+      return 0;
+   };
+
+   bool parse_vgs_output() {
+      Mmsg(cmd, "%svgs -o vg_all --separator=; --units b --nosuffix", arg->sudo);
+      if (vgs) {
+         free_header(vgs, vgs_nbelt);
+         vgs_nbelt=0;
+      }
+      vgs = New(alist(10, not_owned_by_alist));
+      if (!parse_output(cmd, vgs, &vgs_nbelt, vgs_header)) {
+         return false;
+      }
+      return true;
+   };
+
+   bool parse_lvs_output() {
+      Mmsg(cmd, "%slvs -o lv_all --separator=; --units b --nosuffix", arg->sudo);
+      if (lvs) {
+         free_header(lvs, lvs_nbelt);
+         lvs_nbelt=0;
+      }
+      lvs = New(alist(10, not_owned_by_alist));
+      if (!parse_output(cmd, lvs, &lvs_nbelt, lvs_header)) {
+         return false;
+      }
+      return true;
+   };
+
+   /* Function to parse LVM command output */
+   bool parse_output(char *cmd, alist *ret, int *ret_nbelt, Header *hdr) {
+      char *p;
+      int   i=0;
+      int   pos=0;
+      int   nbelt=0;
+      char  buf[2048];          /* Size for a single line */
+      bool  header_done=false;
+
+      if (run_program_full_output(cmd, 60, errmsg)) {
+         strip_quotes(errmsg);
+         Dmsg(10, "Unable to run lvs. ERR=%s\n", errmsg);
+         return false;
+      }
+
+      char **current = NULL;
+
+      for (p = errmsg; *p ; p++) {
+         if (*p == ';') {        /* We have a separator, handle current value */
+            buf[i]=0;
+            if (!header_done) {
+               nbelt++; /* Keep the number of element in the line */
+
+               /* Find if we need this value, and where to store it */
+               for (int j=0; hdr[j].name ; j++) {
+                  if (strcasecmp(buf, hdr[j].name) == 0) {
+                     hdr[j].pos = pos;
+                     break;
+                  }
+               }
+
+            } else {
+               if (pos == 0) {
+                  /* First item, need to allocate new array */
+                  current = (char **)malloc(nbelt * sizeof(char *) + 1);
+                  memset(current, 0, nbelt * sizeof(char *) + 1);
+                  ret->append(current);
+               }
+               /* Keep the current value */
+               current[pos] = bstrdup(buf);
+            }
+            pos++;
+            i = 0;
+         } else if (*p == '\n') {
+            /* We deal with a new line, so the header is done (if in) */
+            header_done = true;
+            i = 0;
+            pos = 0;
+
+         } else if (i < (int)sizeof(buf)) {
+            buf[i++] = *p;
+
+         } else {
+            Dmsg(10, "Output too big !!! %s\n", errmsg);
+            break;
+         }
+      }
+      *ret_nbelt = nbelt;
+      return true;
+   };
+
+   int list() {
+      char **elt, **elt2 = NULL;
+      const char *err = NULL;
+      int    p_attr, p_path, p_origin, p_time, p_size;
+      POOLMEM *p, *f, *d;
+      int    fnl, pnl, status;
+
+      if (!snapshot::list()) {
+         return false;
+      }
+
+      if (!parse_lvs_output()) {
+         return false;
+      }
+
+      p_attr = get_value_pos(lvs_header, "Attr");
+      p_path = get_value_pos(lvs_header, "Path");
+      p_time = get_value_pos(lvs_header, "Time");
+      p_size = get_value_pos(lvs_header, "Snap%");
+      p_origin = get_value_pos(lvs_header, "Origin");
+
+      if (p_time < 0 || p_origin < 0) {
+         printf("status=1 error=\"Unable to get snapshot Origin from lvs command\"\n");
+         return false;
+      }
+
+      p = get_pool_memory(PM_FNAME);
+      f = get_pool_memory(PM_FNAME);
+      d = get_pool_memory(PM_FNAME);
+
+      elt2 = get_lv(arg->device);
+ 
+      /* TODO: We need to get the device name from the mount point */
+      foreach_alist(elt, lvs) {
+         char *attr = elt[p_attr];
+         /* swi-a-s-- */
+         if (attr[0] == 's') {
+            if (attr[4] == 'I') {
+               /* 5  State:  (a)ctive, (s)uspended, (I)nvalid snapshot, invalid (S)uspended
+                *            snapshot, snapshot (m)erge failed, suspended snapshot (M)erge
+                *            failed, mapped (d)evice present without tables, mapped device
+                *            present with (i)nactive table, (X) unknown
+                */
+               status = 0;
+               err = "Invalid snapshot";
+            } else {
+               status = 1;
+               err = "";
+            }
+
+            split_path_and_filename(elt[p_path], &p, &pnl, &f, &fnl);
+            Mmsg(d, "%s%s", p, elt[p_origin]);
+
+            if ((!arg->device || strcmp(arg->device, d) == 0) ||
+                (elt2 && strcmp(elt2[p_path], d) == 0))
+            {
+               /* On LVM, the name is LV_SnapshotName, we can strip the LV_ if we find it */
+               Mmsg(p, "%s_", d); /* /dev/mapper/vg_ssd/test_ */
+               if (strncmp(p, elt[p_path], strlen(p)) == 0) {
+                  pm_strcpy(f, elt[p_path] + strlen(p));/* test_MySnapshot_2020.. => MySnapshot_2020 */
+               }
+
+               printf("volume=\"%s\" device=\"%s\" name=\"%s\" createdate=\"%s\" size=\"%s\" "
+                      "status=%d error=\"%s\" type=lvm\n",
+                      elt[p_path], d, f, elt[p_time], elt[p_size], status, err);
+            }
+         }
+      }
+      free_pool_memory(p);
+      free_pool_memory(f);
+      free_pool_memory(d);
+      return true;
+   };
+};
+
+/* The simulator is using a simple symlink */
+class simulator: public snapshot {
+public:
+   simulator(arguments *arg): snapshot(arg, "simulator") {};
+
+   int mount() {
+      if (!snapshot::mount()) {
+         return 0;
+      }
+      split_path_and_filename(arg->volume, &path, &pnl, &fname, &fnl);
+      printf("status=1 snapmountpoint=\"%s\" snapdirectory=\"%s\"\n",
+             arg->volume, path);
+      return 1;
+   };
+
+   int unmount() {
+      printf("status=1\n");
+      return 1;
+   };
+
+   int support() {
+      if (!snapshot::support()) {
+         return 0;
+      }
+      if (access(arg->mountpoint, W_OK) != 0) {
+         printf("status=0 device=\"%s\" type=simulator "
+                "error=\"Unable to access mountpoint\"\n", 
+                arg->mountpoint);
+         return 0;
+      }
+      printf("status=1 device=\"%s\" type=simulator\n", arg->mountpoint);
+      return 1;
+   };
+
+   int create() {
+      char    ed1[50];
+      utime_t now;
+
+      if (!snapshot::create()) {
+         return 0;
+      }
+      Mmsg(path, "%s/%s", arg->mountpoint, arg->snapdir);
+      makedir(path);
+      now = time(NULL);
+      Mmsg(cmd, "ln -vsf \"%s\" \"%s\"", arg->mountpoint, path);
+      if (run_program(cmd, 60, errmsg)) {
+         Dmsg(10, "Unable to create symlink. ERR=%s\n", errmsg);
+         strip_quotes(errmsg);
+         printf("status=%d error=\"Unable to umount the device %s\"\n",
+                get_error_code(),
+                errmsg);
+      }
+      printf("status=1 volume=\"%s\" createtdate=%s type=simulator\n", 
+             path, edit_uint64(now, ed1));
+      return 1;
+   };
+
+   int del() {
+      int ret;
+      if (!snapshot::del()) {
+         return 0;
+      }
+      ret = unlink(arg->volume);
+      printf("status=%d\n", (ret == 0)? 1 : 0);
+      return 1;
+   };
+};
+
+snapshot *detect_snapshot_backend(arguments *arg)
+{
+   if (arg->type) {
+      if (strcasecmp(arg->type, "btrfs") == 0) {
+         return new btrfs(arg);
+
+      } else if (strcasecmp(arg->type, "lvm") == 0) {
+         return new lvm(arg);
+
+      } else if (strcasecmp(arg->type, "simulator") == 0) {
+         return new simulator(arg);
+
+      } else if (strcasecmp(arg->type, "zfs") == 0) {
+         return new zfs(arg);
+      }
+   }
+   if (arg->fstype) {
+      if (strcasecmp(arg->fstype, "btrfs") == 0) {
+         return new btrfs(arg);
+
+      } else if (strcasecmp(arg->fstype, "tmpfs") == 0) {
+         return new simulator(arg);
+
+      /* TODO: Need to find something smarter here */
+      } else if (strcasecmp(arg->fstype, "ext4") == 0) {
+         return new lvm(arg);
+
+      } else if (strcasecmp(arg->fstype, "xfs") == 0) {
+         return new lvm(arg);
+
+      } else if (strcasecmp(arg->fstype, "ext3") == 0) {
+         return new lvm(arg);
+
+      } else if (strcasecmp(arg->fstype, "zfs") == 0 ||
+                 strcasecmp(arg->fstype, "fuse.zfs") == 0) 
+      {
+         return new zfs(arg);
+      }
+   }
+   Dmsg(10, "Backend not found\n");
+   return NULL;
+}
+
+/* defined in jcr.c */
+void create_jcr_key();
+
+int main(int argc, char **argv)
+{
+   snapshot *snap;
+   arguments arg;
+   char      ch;
+   int       ret=0;
+   struct stat sp;
+
+   set_trace_file("/dev/null");
+   setlocale(LC_ALL, "");
+   setenv("LANG", "C", true);
+   bindtextdomain("bacula", LOCALEDIR);
+   textdomain("bacula");
+   lmgr_init_thread();
+   OSDependentInit();
+   init_stack_dump();
+   my_name_is(argc, argv, "bsnapshot");
+   create_jcr_key();
+
+   while ((ch = getopt(argc, argv, "?d:vc:so:V:T:t")) != -1) {
+      switch (ch) {
+      case 'd':                       /* set debug level */
+         debug_level = atoi(optarg);
+         if (debug_level <= 0) {
+            debug_level = 1;
+         }
+         break;
+
+      case 'v':
+         arg.verbose++;
+         break;
+
+      case 's':                 /* use sudo */
+         arg.sudo = "sudo ";
+         break;
+
+      case 'c':                 /* config file */
+         pm_strcpy(arg.config_file, optarg);
+         if (stat(optarg, &sp) < 0) {
+            Pmsg(000, "Unable to access %s. ERR=%s\n",optarg, strerror(errno));
+            usage(_("Unable to open -p argument for reading"));
+         }
+         break;
+
+      case 'o':                 /* where to send the debug output */
+         set_trace_file(optarg);
+         break;
+
+      case 't':
+         arg.action = (char *)"check";
+         break;
+
+      case 'V':                 /* set volume name */
+         arg.volume = optarg;
+         break;
+
+      case 'T':                 /* device type */
+         arg.type = optarg;
+         break;
+      default:
+         usage();
+      }
+   }
+
+   argc -= optind;
+   argv += optind;
+
+   if (!arg.validate()) {
+      usage();
+   }
+
+   if (arg.disabled) {
+      Dmsg(10, "disabled from config file\n");
+      exit (1);
+   }
+
+   snap = detect_snapshot_backend(&arg);
+
+   if (!snap) {
+      printf("status=0 error=\"Unable to detect snapshot backend\"");
+      exit(0);
+   }
+
+   start_watchdog();
+
+   if (strcasecmp(arg.action, "mount") == 0) {
+      ret = snap->mount();
+
+   } else if (strcasecmp(arg.action, "support") == 0) {
+      ret = snap->support();
+
+   } else if (strcasecmp(arg.action, "create") == 0) {
+      ret = snap->create();
+
+   } else if (strcasecmp(arg.action, "delete") == 0) {
+      ret = snap->del();
+
+   } else if (strcasecmp(arg.action, "subvolumes") == 0) {
+      ret = snap->subvolumes();
+
+   } else if (strcasecmp(arg.action, "list") == 0) {
+      ret = snap->list();
+
+   } else if (strcasecmp(arg.action, "check") == 0) {
+      ret = snap->check();
+
+   } else if (strcasecmp(arg.action, "unmount") == 0) {
+      ret = snap->unmount();
+   }
+
+   delete snap;
+   stop_watchdog();
+   close_memory_pool();
+   lmgr_cleanup_main();
+
+   Dmsg(10, "exit code = %d\n", (ret == 1) ? 0 : 1);
+   return (ret == 1)? 0 : 1;
+}
diff --git a/src/tools/bvfs_test.c b/src/tools/bvfs_test.c
index 1f93e07..b2a7ed0 100644
--- a/src/tools/bvfs_test.c
+++ b/src/tools/bvfs_test.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2009-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -24,12 +28,11 @@
 
 #include "bacula.h"
 #include "cats/cats.h"
-#include "cats/sql_glue.h"
 #include "cats/bvfs.h"
 #include "findlib/find.h"
-
+ 
 /* Local variables */
-static B_DB *db;
+static BDB *db;
 static const char *file = "COPYRIGHT";
 static DBId_t fnid=0;
 static const char *db_name = "regress";
@@ -41,7 +44,7 @@ static void usage()
 {
    fprintf(stderr, _(
 PROG_COPYRIGHT
-"\nVersion: %s (%s)\n"
+"\n%sVersion: %s (%s)\n"
 "       -d <nn>           set debug level to <nn>\n"
 "       -dt               print timestamp in debug output\n"
 "       -n <name>         specify the database name (default bacula)\n"
@@ -55,7 +58,7 @@ PROG_COPYRIGHT
 "       -l <limit>        maximum tuple to fetch\n"
 "       -T                truncate cache table before starting\n"
 "       -v                verbose\n"
-"       -?                print this message\n\n"), 2001, VERSION, BDATE);
+"       -?                print this message\n\n"), 2001, "", VERSION, BDATE);
    exit(1);
 }
 
@@ -73,13 +76,13 @@ static int result_handler(void *ctx, int fields, char **row)
       /* display clean stuffs */
 
       if (bvfs_is_dir(row)) {
-         pm_strcpy(attr->ofname, bvfs_basename_dir(row[BVFS_Name]));
+         pm_strcpy(attr->ofname, bvfs_basename_dir(row[BVFS_Name]));   
       } else {
          /* if we see the requested file, note his filenameid */
          if (bstrcmp(row[BVFS_Name], file)) {
             fnid = str_to_int64(row[BVFS_FilenameId]);
          }
-         pm_strcpy(attr->ofname, row[BVFS_Name]);
+         pm_strcpy(attr->ofname, row[BVFS_Name]);   
       }
       print_ls_output(vfs->get_jcr(), attr);
 
@@ -110,7 +113,7 @@ int main (int argc, char *argv[])
    init_stack_dump();
 
    Dmsg0(0, "Starting bvfs_test tool\n");
-
+   
    my_name_is(argc, argv, "bvfs_test");
    init_msg(NULL, NULL);
 
@@ -197,12 +200,12 @@ int main (int argc, char *argv[])
    bjcr->client_name = get_pool_memory(PM_FNAME);
    pm_strcpy(bjcr->client_name, "Dummy.Client.Name");
    bstrncpy(bjcr->Job, "bvfs_test", sizeof(bjcr->Job));
-
+   
    if ((db = db_init_database(NULL, NULL, db_name, db_user, db_password,
                               db_host, 0, NULL, false, false)) == NULL) {
       Emsg0(M_ERROR_TERM, 0, _("Could not init Bacula database\n"));
    }
-   Dmsg1(0, "db_type=%s\n", db_get_type(db));
+   Dmsg1(0, "db_type=%s\n", db_get_engine_name(db));
 
    if (!db_open_database(NULL, db)) {
       Emsg0(M_ERROR_TERM, 0, db_strerror(db));
@@ -211,7 +214,7 @@ int main (int argc, char *argv[])
    if (verbose) {
       Pmsg2(000, _("Using Database: %s, User: %s\n"), db_name, db_user);
    }
-
+   
    bjcr->db = db;
 
    if (clean) {
@@ -247,7 +250,7 @@ int main (int argc, char *argv[])
       exit (0);
    }
 
-
+   
    Pmsg0(0, "list /\n");
    fs.ch_dir("/");
    fs.ls_special_dirs();
diff --git a/src/tools/bwild.c b/src/tools/bwild.c
index ca5dd66..e523d3f 100644
--- a/src/tools/bwild.c
+++ b/src/tools/bwild.c
@@ -1,24 +1,28 @@
 /*
- * Test program for testing wild card expressions
- *
- *  Kern Sibbald, MMVI
- *
- */
-/*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2006-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
+/*
+ * Test program for testing wild card expressions
+ * 
+ *  Kern Sibbald, MMVI
+ *
+ */
 
 #include "bacula.h"
 #include "lib/fnmatch.h"
@@ -49,7 +53,7 @@ int main(int argc, char *const *argv)
    int lineno;
    bool no_linenos = false;
    int ic = 0;
-
+   
 
    setlocale(LC_ALL, "");
    bindtextdomain("bacula", LOCALEDIR);
diff --git a/src/tools/cats_test.c b/src/tools/cats_test.c
index 9e35076..f204aa0 100644
--- a/src/tools/cats_test.c
+++ b/src/tools/cats_test.c
@@ -1,34 +1,36 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2011-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *  Program to test CATS DB routines
  *
- *
+ *  
  */
 #define _BDB_PRIV_INTERFACE_
 
 #include "bacula.h"
 #include "cats/cats.h"
-#include "cats/bdb_priv.h"
-#include "cats/sql_glue.h"
 #include "cats/bvfs.h"
 #include "findlib/find.h"
-
+ 
 /* Local variables */
-static B_DB *db;
+static BDB *db;
 static const char *file = "COPYRIGHT";
 //static DBId_t fnid=0;
 static const char *db_name = "bacula";
@@ -45,7 +47,7 @@ static void usage()
 {
    fprintf(stderr, _(
 PROG_COPYRIGHT
-"\nVersion: %s (%s)\n"
+"\n%sVersion: %s (%s)\n"
 "       -d <nn>           set debug level to <nn>\n"
 "       -dt               print timestamp in debug output\n"
 "       -n <name>         specify the database name (default bacula)\n"
@@ -58,7 +60,7 @@ PROG_COPYRIGHT
 "       -l <limit>        maximum tuple to fetch\n"
 "       -q                print only errors\n"
 "       -v                verbose\n"
-"       -?                print this message\n\n"), 2011, VERSION, BDATE);
+"       -?                print this message\n\n"), 2011, BDEMO, VERSION, BDATE);
    exit(1);
 }
 
@@ -151,7 +153,7 @@ static void cmp_client(CLIENT_DBR &cr, CLIENT_DBR &cr2)
    ok(!strcmp(cr2.Name, cr.Name),           "  Check Client Name");
    ok(!strcmp(cr2.Uname, cr.Uname),         "  Check Client Uname");
    ok(cr.AutoPrune == cr2.AutoPrune,        "  Check Client Autoprune");
-   ok(cr.JobRetention == cr2.JobRetention,  "  Check Client JobRetention");
+   ok(cr.JobRetention == cr2.JobRetention,  "  Check Client JobRetention");   
    ok(cr.FileRetention == cr2.FileRetention,"  Check Client FileRetention");
 }
 
@@ -227,7 +229,7 @@ int main (int argc, char *argv[])
    pid = getpid();
 
    Pmsg0(0, "Starting cats_test tool" PLINE);
-
+   
    my_name_is(argc, argv, "");
    init_msg(NULL, NULL);
 
@@ -334,7 +336,7 @@ int main (int argc, char *argv[])
    Pmsg1(0, PLINE "Test DB connection \"%s\"" PLINE, db_name);
 
    if (full_test) {
-      db = db_init_database(jcr /* JCR */,
+      db = db_init_database(jcr /* JCR */, 
                    NULL /* dbi driver */,
                    db_name, db_user, db_password, db_address, db_port + 100,
                    NULL /* db_socket */,
@@ -348,7 +350,7 @@ int main (int argc, char *argv[])
       db_close_database(jcr, db);
    }
 
-   db = db_init_database(jcr /* JCR */,
+   db = db_init_database(jcr /* JCR */, 
                 NULL /* dbi driver */,
                 db_name, db_user, db_password, db_address, db_port,
                 NULL /* db_socket */,
@@ -372,9 +374,8 @@ int main (int argc, char *argv[])
 
 
    /* Check if the SQL library is thread-safe */
-   //db_check_backend_thread_safe();
    ok(check_tables_version(jcr, db), "Check table version");
-   ok(db_sql_query(db, "SELECT VersionId FROM Version",
+   ok(db_sql_query(db, "SELECT VersionId FROM Version", 
                    db_int_handler, &j), "SELECT VersionId");
 
    ok(UPDATE_DB(jcr, db, (char*)"UPDATE Version SET VersionId = 1"),
@@ -387,15 +388,15 @@ int main (int argc, char *argv[])
       ok(db_check_max_connections(jcr, db, 1), "Test min Max Connexion");
       nok(db_check_max_connections(jcr, db, 10000), "Test max Max Connexion");
    }
-
+   
    ok(db_open_batch_connexion(jcr, db), "Opening batch connection");
    db_close_database(jcr, jcr->db_batch);
    jcr->db_batch = NULL;
 
    /* ---------------------------------------------------------------- */
-
+   
    uint32_t storageid=0;
-   ok(db_sql_query(db, "SELECT MIN(StorageId) FROM Storage",
+   ok(db_sql_query(db, "SELECT MIN(StorageId) FROM Storage", 
                    db_int_handler, &storageid), "Get StorageId");
    ok(storageid > 0, "Check StorageId");
    if (!storageid) {
@@ -407,7 +408,7 @@ int main (int argc, char *argv[])
    Pmsg0(0, PLINE "Doing Basic SQL tests" PLINE);
    ok(db_sql_query(db, "SELECT 1,2,3,4,5", count_col, &j), "Count 5 rows");
    ok(j == 5, "Check number of columns");
-   ok(db_sql_query(db, "SELECT 1,2,3,4,5,'a','b','c','d','e'",
+   ok(db_sql_query(db, "SELECT 1,2,3,4,5,'a','b','c','d','e'", 
                    count_col, &j), "Count 10 rows");
    ok(j == 10, "Check number of columns");
 
@@ -415,7 +416,7 @@ int main (int argc, char *argv[])
    ok(db_sql_query(db, "SELECT 2", db_int_handler, &j), "Good SELECT query");
    ok(db_sql_query(db, "SELECT 1 FROM Media WHERE VolumeName='missing'",
                    db_int_handler, &j), "Good empty SELECT query");
-
+   
    db_int64_ctx i64;
    i64.value = 0; i64.count = 0;
    ok(db_sql_query(db, "SELECT 1",db_int64_handler, &i64),"db_int64_handler");
@@ -454,10 +455,10 @@ int main (int argc, char *argv[])
    Mmsg(buf, "DELETE FROM %s", temp);
    ok(DELETE_DB(jcr, db, buf), "DELETE query");
    nok(DELETE_DB(jcr, db, buf), "Empty DELETE query"); /* TODO bug ? */
-
+      
    Mmsg(buf, "DELETE FROM aaa%s", temp);
    ok(DELETE_DB(jcr, db, buf), "Bad DELETE query"); /* TODO bug ? */
-
+   
    Mmsg(buf, "DROP TABLE %s", temp);
    ok(QUERY_DB(jcr, db, buf), "DROP query");
    nok(QUERY_DB(jcr, db, buf), "Empty DROP query");
@@ -471,7 +472,7 @@ int main (int argc, char *argv[])
    ok(db_sql_query(db, buf, NULL, NULL), "Inserting quoted string");
 
    /* ---------------------------------------------------------------- */
-   Pmsg0(0, PLINE "Doing Job tests" PLINE);
+   Pmsg0(0, PLINE "Doing Job tests" PLINE);   
 
    JOB_DBR jr, jr2;
    memset(&jr, 0, sizeof(jr));
@@ -479,7 +480,7 @@ int main (int argc, char *argv[])
    jr.JobId = 1;
    ok(db_get_job_record(jcr, db, &jr), "Get Job record for JobId=1");
    ok(jr.JobFiles > 10, "Check number of files");
-
+   
    jr.JobId = (JobId_t)pid;
    Mmsg(buf, "%s-%lld", jr.Job, pid);
    strcpy(jr.Job, buf);
@@ -554,7 +555,7 @@ int main (int argc, char *argv[])
 
    ok(db_get_client_record(jcr, db, &cr2), "Search client by ClientId");
    cmp_client(cr, cr2);
-
+   
    Pmsg0(0, "Search client by Name\n");
    memset(&cr2, 0, sizeof(cr2));
    strcpy(cr2.Name, cr.Name);
@@ -591,7 +592,7 @@ int main (int argc, char *argv[])
    POOL_DBR pr, pr2;
    memset(&pr, 0, sizeof(pr));
    memset(&pr2, 0, sizeof(pr2));
-
+   
    bsnprintf(pr.Name, sizeof(pr.Name), "pool-%lld", pid);
    pr.MaxVols = 10;
    pr.UseOnce = 0;
@@ -610,16 +611,16 @@ int main (int argc, char *argv[])
    pr.RecyclePoolId = 0;
    pr.ScratchPoolId = 0;
    pr.ActionOnPurge = 1;
-
+   
    ok(db_create_pool_record(jcr, db, &pr), "db_create_pool_record()");
    ok(pr.PoolId > 0, "Check PoolId");
-
+   
    pr2.PoolId = pr.PoolId;
    pr.PoolId = 0;
 
    Pmsg0(0, "Search pool by PoolId\n");
    nok(db_create_pool_record(jcr, db, &pr),"Can't create pool twice");
-   ok(db_get_pool_record(jcr, db, &pr2), "Search pool by PoolId");
+   ok(db_get_pool_numvols(jcr, db, &pr2), "Search pool by PoolId");
    cmp_pool(pr, pr2);
 
    pr2.MaxVols++;
@@ -639,7 +640,7 @@ int main (int argc, char *argv[])
    ok(db_update_pool_record(jcr, db, &pr2), "Update Pool record");
    memset(&pr, 0, sizeof(pr));
    pr.PoolId = pr2.PoolId;
-   ok(db_get_pool_record(jcr, db, &pr), "Search pool by PoolId");
+   ok(db_get_pool_numvols(jcr, db, &pr), "Search pool by PoolId");
    cmp_pool(pr, pr2);
 
    ok(db_delete_pool_record(jcr, db, &pr), "Delete Pool");
@@ -649,11 +650,11 @@ int main (int argc, char *argv[])
 
    /* ---------------------------------------------------------------- */
    Pmsg0(0, PLINE "Doing Media tests" PLINE);
-
+   
    MEDIA_DBR mr, mr2;
    memset(&mr, 0, sizeof(mr));
    memset(&mr2, 0, sizeof(mr2));
-
+   
    bsnprintf(mr.VolumeName, sizeof(mr.VolumeName), "media-%lld", pid);
    bsnprintf(mr.MediaType, sizeof(mr.MediaType), "type-%lld", pid);
 
@@ -688,7 +689,7 @@ int main (int argc, char *argv[])
 
    /* ---------------------------------------------------------------- */
    Pmsg0(0, PLINE "Doing ... tests" PLINE);
-
+   
    db_close_database(jcr, db);
    report();
    free_pool_memory(buf);
diff --git a/src/tools/dbcheck.c b/src/tools/dbcheck.c
index 60f3301..5d50e2e 100644
--- a/src/tools/dbcheck.c
+++ b/src/tools/dbcheck.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2002-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -24,7 +28,6 @@
 
 #include "bacula.h"
 #include "cats/cats.h"
-#include "cats/sql_glue.h"
 #include "lib/runscript.h"
 #include "dird/dird_conf.h"
 
@@ -51,7 +54,7 @@ typedef struct s_name_ctx {
  */
 static bool fix = false;
 static bool batch = false;
-static B_DB *db;
+static BDB *db;
 static ID_LIST id_list;
 static NAME_LIST name_list;
 static char buf[20000];
@@ -95,6 +98,8 @@ static int check_idx_handler(void *ctx, int num_fields, char **row);
 static void usage()
 {
    fprintf(stderr,
+PROG_COPYRIGHT
+"\n%sVersion: %s (%s)\n\n"
 "Usage: dbcheck [-c config ] [-B] [-C catalog name] [-d debug_level] <working-directory> <bacula-database> <user> <password> [<dbhost>] [<dbport>]\n"
 "       -b              batch mode\n"
 "       -C              catalog name in the director conf file\n"
@@ -105,7 +110,9 @@ static void usage()
 "       -f              fix inconsistencies\n"
 "       -t              test if client library is thread-safe\n"
 "       -v              verbose\n"
-"       -?              print this message\n\n");
+"       -?              print this message\n"
+"\n", 2002, "", VERSION, BDATE);
+
    exit(1);
 }
 
@@ -280,7 +287,7 @@ int main (int argc, char *argv[])
     * Open database
     */
    db = db_init_database(NULL, NULL, db_name, user, password, dbhost, dbport, NULL, false, false);
-   if (!db_open_database(NULL, db)) {
+   if (!db || !db_open_database(NULL, db)) {
       Emsg1(M_FATAL, 0, "%s", db_strerror(db));
           return 1;
    }
@@ -313,7 +320,7 @@ int main (int argc, char *argv[])
     */
    drop_tmp_idx("idxPIchk", "File");
 
-   db_close_database(NULL, db);
+   if (db) db_close_database(NULL, db);
    close_msg(NULL);
    term_msg();
    lmgr_cleanup_main();
@@ -325,7 +332,7 @@ static void print_catalog_details(CAT *catalog, const char *working_dir)
    POOLMEM *catalog_details = get_pool_memory(PM_MESSAGE);
 
    /*
-    * Instantiate a B_DB class and see what db_type gets assigned to it.
+    * Instantiate a BDB class and see what db_type gets assigned to it.
     */
    db = db_init_database(NULL, catalog->db_driver, catalog->db_name, catalog->db_user,
                          catalog->db_password, catalog->db_address,
@@ -334,7 +341,7 @@ static void print_catalog_details(CAT *catalog, const char *working_dir)
                          catalog->disable_batch_insert);
    if (db) {
       printf("%sdb_type=%s\nworking_dir=%s\n", catalog->display(catalog_details),
-             db->db_get_type(), working_directory);
+             db_get_engine_name(db), working_directory);
       db_close_database(NULL, db);
    }
    free_pool_memory(catalog_details);
@@ -741,7 +748,7 @@ static void eliminate_duplicate_paths()
          /*
           * Get all the Ids of each name
           */
-         db_escape_string(NULL, db, esc_name, name_list.name[i], strlen(name_list.name[i]));
+         db_escape_string(NULL, db,  esc_name, name_list.name[i], strlen(name_list.name[i]));
          bsnprintf(buf, sizeof(buf), "SELECT PathId FROM Path WHERE Path='%s'", esc_name);
          if (verbose > 1) {
             printf("%s\n", buf);
@@ -866,9 +873,9 @@ static void eliminate_orphaned_path_records()
 {
    db_int64_ctx lctx;
    lctx.count=0;
-   db_sql_query(db, "SELECT 1 FROM Job WHERE HasCache=1 LIMIT 1",
+   db_sql_query(db, "SELECT 1 FROM Job WHERE HasCache=1 LIMIT 1", 
                 db_int64_handler, &lctx);
-
+   
    if (lctx.count == 1) {
       printf(_("Pruning orphaned Path entries isn't possible when using BVFS.\n"));
       return;
@@ -1294,7 +1301,7 @@ static void repair_bad_paths()
           * Add trailing slash
           */
          len = pm_strcat(&name, "/");
-         db_escape_string(NULL, db, esc_name, name, len);
+         db_escape_string(NULL, db,  esc_name, name, len);
          bsnprintf(buf, sizeof(buf), "UPDATE Path SET Path='%s' WHERE PathId=%s",
             esc_name, edit_int64(id_list.Id[i], ed1));
          if (verbose > 1) {
diff --git a/src/tools/drivetype.c b/src/tools/drivetype.c
index 3112e37..f62f3f0 100644
--- a/src/tools/drivetype.c
+++ b/src/tools/drivetype.c
@@ -1,26 +1,27 @@
 /*
- * Program for determining drive type
- *
- *   Written by Robert Nelson, June 2006
- *
- *   Version $Id$
- *
- */
-/*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2006-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
+/*
+ * Program for determining drive type
+ *
+ *   Written by Robert Nelson, June 2006
+ */
 
 #include "bacula.h"
 #include "findlib/find.h"
@@ -101,7 +102,7 @@ main (int argc, char *const *argv)
    argv += optind;
 
    OSDependentInit();
-
+ 
    if (argc < 1 && display_all) {
       /* Try all letters */
       for (drive = 'A'; drive <= 'Z'; drive++) {
diff --git a/src/tools/fstype.c b/src/tools/fstype.c
index 3e2e315..150afe6 100644
--- a/src/tools/fstype.c
+++ b/src/tools/fstype.c
@@ -1,30 +1,30 @@
 /*
- * Program for determining file system type
- *
- *   Written by Preben 'Peppe' Guldberg, December MMIV
- *
- *   Version $Id$
- *
- */
-/*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2004-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
+/*
+ * Program for determining file system type
+ *
+ *   Written by Preben 'Peppe' Guldberg, December MMIV
+ */
 
 #include "bacula.h"
 #include "findlib/find.h"
-#include "lib/mntent_cache.h"
 
 static void usage()
 {
@@ -32,22 +32,70 @@ static void usage()
 "\n"
 "Usage: fstype [-v] path ...\n"
 "\n"
-"       Print the file system type a given file/directory is on.\n"
+"       Print the file system type for each file/directory argument given.\n"
 "       The following options are supported:\n"
 "\n"
-"       -v     print both path and file system type.\n"
+"       -l     print all file system types in mtab.\n"
+"       -m     print full entries in mtab.\n"
+"       -v     print both path and file system type of each argument.\n"
 "       -?     print this message.\n"
 "\n"));
 
    exit(1);
 }
 
+struct mtab_item {
+   rblink link;
+   uint64_t dev;
+   char fstype[1];
+};
+
+/* Compare two device types */
+static int compare_mtab_items(void *item1, void *item2)
+{
+   mtab_item *mtab1, *mtab2;
+   mtab1 = (mtab_item *)item1;
+   mtab2 = (mtab_item *)item2;
+   if (mtab1->dev < mtab2->dev) return -1;
+   if (mtab1->dev > mtab2->dev) return 1;
+   return 0;
+}
+
+void print_mtab_item(void *user_ctx, struct stat *st, const char *fstype,
+                      const char *mountpoint, const char *mntopts,
+                      const char *fsname)
+{
+   fprintf(stderr, "dev=%p fstype=%s mountpoint=%s mntopts=%s\n",
+      ((void *)st->st_dev), fstype, mountpoint, mntopts);
+}
 
-int
-main (int argc, char *const *argv)
+void add_mtab_item(void *user_ctx, struct stat *st, const char *fstype,
+                      const char *mountpoint, const char *mntopts,
+                      const char *fsname)
+{
+   rblist *mtab_list = (rblist *)user_ctx;
+   mtab_item *item, *ritem;
+   int len = strlen(fstype) + 1;
+   
+   item = (mtab_item *)malloc(sizeof(mtab_item) + len);
+   item->dev = (uint64_t)st->st_dev;
+   bstrncpy(item->fstype, fstype, len);
+   //fprintf(stderr, "Add dev=%lx fstype=%s\n", item->dev, item->fstype);
+   ritem = (mtab_item *)mtab_list->insert((void *)item, compare_mtab_items);
+   if (ritem != item) {
+      fprintf(stderr, "Problem!! Returned item not equal added item\n");
+   }
+   //fprintf(stderr, "dev=%p fstype=%s mountpoint=%s mntopts=%s\n",
+   //   ((void *)st->st_dev), fstype, mountpoint, mntopts);
+}
+
+
+int main (int argc, char *const *argv)
 {
    char fs[1000];
-   int verbose = 0;
+   bool verbose = false;
+   bool list = false;
+   bool mtab = false;
    int status = 0;
    int ch, i;
 
@@ -55,10 +103,16 @@ main (int argc, char *const *argv)
    bindtextdomain("bacula", LOCALEDIR);
    textdomain("bacula");
 
-   while ((ch = getopt(argc, argv, "v?")) != -1) {
+   while ((ch = getopt(argc, argv, "lmv?")) != -1) {
       switch (ch) {
+         case 'l':
+            list = true;
+            break;
+         case 'm':
+            mtab = true; /* list mtab */
+            break;
          case 'v':
-            verbose = 1;
+            verbose = true;
             break;
          case '?':
          default:
@@ -69,26 +123,51 @@ main (int argc, char *const *argv)
    argc -= optind;
    argv += optind;
 
-   if (argc < 1) {
-      usage();
-   }
 
    OSDependentInit();
 
+   if (mtab) {
+      read_mtab(print_mtab_item, NULL);
+      status = 1;
+      goto get_out;
+   }
+   if (list) {
+      rblist *mtab_list;
+      mtab_item *item;
+      mtab_list = New(rblist());
+      read_mtab(add_mtab_item, mtab_list);
+      fprintf(stderr, "Size of mtab=%d\n", mtab_list->size());
+      foreach_rblist(item, mtab_list) {
+         fprintf(stderr, "Found dev=%lx fstype=%s\n", item->dev, item->fstype);
+      }
+      delete mtab_list;
+      goto get_out;
+   }
+
+   if (argc < 1) {
+      usage();
+   }
    for (i = 0; i < argc; --argc, ++argv) {
-      if (fstype(*argv, fs, sizeof(fs))) {
+      FF_PKT ff_pkt;
+      memset(&ff_pkt, 0, sizeof(ff_pkt));
+      ff_pkt.fname = ff_pkt.link = *argv;
+      if (lstat(ff_pkt.fname, &ff_pkt.statp) != 0) {
+         fprintf(stderr, "lstat of %s failed.\n", ff_pkt.fname);
+         status = 1;
+         break;
+      }
+      if (fstype(&ff_pkt, fs, sizeof(fs))) {
          if (verbose) {
             printf("%s: %s\n", *argv, fs);
          } else {
             puts(fs);
          }
       } else {
-         fprintf(stderr, _("%s: unknown\n"), *argv);
+         fprintf(stderr, _("%s: unknown file system type\n"), *argv);
          status = 1;
       }
    }
 
-   flush_mntent_cache();
-
+get_out:
    exit(status);
 }
diff --git a/src/tools/ing_test.c b/src/tools/ing_test.c
deleted file mode 100644
index b66d532..0000000
--- a/src/tools/ing_test.c
+++ /dev/null
@@ -1,327 +0,0 @@
-/*
-   Bacula® - The Network Backup Solution
-
-   Copyright (C) 2009-2014 Free Software Foundation Europe e.V.
-
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
-
-   You may use this file and others of this release according to the
-   license defined in the LICENSE file, which includes the Affero General
-   Public License, v3.0 ("AGPLv3") and some additional permissions and
-   terms pursuant to its AGPLv3 Section 7.
-
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
-/*
- *
- *  Program to test Ingres DB routines
- *
- *   Stefan Reddig, February 2010
- *
- *   reusing code by
- *   Eric Bollengier, August 2009
- *
- *
- */
-#ifdef needed
-#include "bacula.h"
-#include "cats/cats.h"
-#include "cats/sql_glue.h"
-
-/* Local variables */
-static B_DB *db;
-static const char *file = "COPYRIGHT";
-//static DBId_t fnid=0;
-static const char *db_name = "bacula";
-static const char *db_user = "bacula";
-static const char *db_password = "";
-static const char *db_host = NULL;
-
-static void usage()
-{
-   fprintf(stderr, _(
-PROG_COPYRIGHT
-"\nVersion: %s (%s)\n"
-"       -d <nn>           set debug level to <nn>\n"
-"       -dt               print timestamp in debug output\n"
-"       -n <name>         specify the database name (default bacula)\n"
-"       -u <user>         specify database user name (default bacula)\n"
-"       -P <password      specify database password (default none)\n"
-"       -h <host>         specify database host (default NULL)\n"
-"       -w <working>      specify working directory\n"
-"       -j <jobids>       specify jobids\n"
-"       -p <path>         specify path\n"
-"       -f <file>         specify file\n"
-"       -l <limit>        maximum tuple to fetch\n"
-"       -T                truncate cache table before starting\n"
-"       -v                verbose\n"
-"       -?                print this message\n\n"), 2001, VERSION, BDATE);
-   exit(1);
-}
-
-/*
- * simple handler for debug output of CRUD example
- */
-static int test_handler(void *ctx, int num_fields, char **row)
-{
-   Pmsg2(0, "   Values are %d, %s\n", str_to_int64(row[0]), row[1]);
-   return 0;
-}
-
-/*
- * string handler for debug output of simple SELECT tests
- */
-static int string_handler(void *ctx, int num_fields, char **row)
-{
-   Pmsg1(0, "   Value is >>%s<<\n", row[0]);
-   return 0;
-}
-
-
-/* number of thread started */
-
-int main (int argc, char *argv[])
-{
-   int ch;
-   char *jobids = (char *)"1";
-   char *path=NULL, *client=NULL;
-   uint64_t limit=0;
-   bool clean=false;
-   setlocale(LC_ALL, "");
-   bindtextdomain("bacula", LOCALEDIR);
-   textdomain("bacula");
-   init_stack_dump();
-
-   Dmsg0(0, "Starting ing_test tool\n");
-
-   my_name_is(argc, argv, "ing_test");
-   init_msg(NULL, NULL);
-
-   OSDependentInit();
-
-   while ((ch = getopt(argc, argv, "h:c:l:d:n:P:Su:vf:w:?j:p:f:T")) != -1) {
-      switch (ch) {
-      case 'd':                    /* debug level */
-         if (*optarg == 't') {
-            dbg_timestamp = true;
-         } else {
-            debug_level = atoi(optarg);
-            if (debug_level <= 0) {
-               debug_level = 1;
-            }
-         }
-         break;
-      case 'l':
-         limit = str_to_int64(optarg);
-         break;
-
-      case 'c':
-         client = optarg;
-         break;
-
-      case 'h':
-         db_host = optarg;
-         break;
-
-      case 'n':
-         db_name = optarg;
-         break;
-
-      case 'w':
-         working_directory = optarg;
-         break;
-
-      case 'u':
-         db_user = optarg;
-         break;
-
-      case 'P':
-         db_password = optarg;
-         break;
-
-      case 'v':
-         verbose++;
-         break;
-
-      case 'p':
-         path = optarg;
-         break;
-
-      case 'f':
-         file = optarg;
-         break;
-
-      case 'j':
-         jobids = optarg;
-         break;
-
-      case 'T':
-         clean = true;
-         break;
-
-      case '?':
-      default:
-         usage();
-
-      }
-   }
-   argc -= optind;
-   argv += optind;
-
-   if (argc != 0) {
-      Pmsg0(0, _("Wrong number of arguments: \n"));
-      usage();
-   }
-
-   if ((db = db_init_database(NULL, NULL, db_name, db_user, db_password,
-                              db_host, 0, NULL, false, false)) == NULL) {
-      Emsg0(M_ERROR_TERM, 0, _("Could not init Bacula database\n"));
-   }
-   Dmsg1(0, "db_type=%s\n", db_get_type(db));
-
-   if (!db_open_database(NULL, db)) {
-      Emsg0(M_ERROR_TERM, 0, db_strerror(db));
-   }
-   Dmsg0(200, "Database opened\n");
-   if (verbose) {
-      Pmsg2(000, _("Using Database: %s, User: %s\n"), db_name, db_user);
-   }
-
-   /*
-    * simple CRUD test including create/drop table
-    */
-   Pmsg0(0, "\nsimple CRUD test...\n\n");
-   const char *stmt1[8] = {
-      "CREATE TABLE t1 ( c1 integer, c2 varchar(29))",
-      "INSERT INTO t1 VALUES (1, 'foo')",
-      "SELECT c1,c2 FROM t1",
-      "UPDATE t1 SET c2='bar' WHERE c1=1",
-      "SELECT * FROM t1",
-      "DELETE FROM t1 WHERE c2 LIKE '\%r'",
-      "SELECT * FROM t1",
-      "DROP TABLE t1"
-   };
-   int (*hndl1[8])(void*,int,char**) = {
-      NULL,
-      NULL,
-      test_handler,
-      NULL,
-      test_handler,
-      NULL,
-      test_handler,
-      NULL
-   };
-
-   for (int i=0; i<8; ++i) {
-      Pmsg1(0, "DB-Statement: %s\n",stmt1[i]);
-      if (!db_sql_query(db, stmt1[i], hndl1[i], NULL)) {
-         Emsg0(M_ERROR_TERM, 0, _("Stmt went wrong\n"));
-      }
-   }
-
-
-   /*
-    * simple SELECT tests without tables
-    */
-   Pmsg0(0, "\nsimple SELECT tests without tables...\n\n");
-   const char *stmt2[8] = {
-      "SELECT 'Test of simple SELECT!'",
-      "SELECT 'Test of simple SELECT!' as Text",
-      "SELECT VARCHAR(LENGTH('Test of simple SELECT!'))",
-      "SELECT DBMSINFO('_version')",
-      "SELECT 'This is a ''quoting'' test with single quotes'",
-      "SELECT 'This is a \"quoting\" test with double quotes'",
-      "SELECT null",
-      "SELECT ''"
-   };
-   int (*hndl2[8])(void*,int,char**) = {
-      string_handler,
-      string_handler,
-      string_handler,
-      string_handler,
-      string_handler,
-      string_handler,
-      string_handler,
-      string_handler
-   };
-
-   for (int i=0; i<8; ++i) {
-      Pmsg1(0, "DB-Statement: %s\n",stmt2[i]);
-      if (!db_sql_query(db, stmt2[i], hndl2[i], NULL)) {
-         Emsg0(M_ERROR_TERM, 0, _("Stmt went wrong\n"));
-      }
-   }
-
-   /*
-    * testing aggregates like avg, max, sum
-    */
-   Pmsg0(0, "\ntesting aggregates...\n\n");
-   const char *stmt[11] = {
-      "CREATE TABLE t1 (c1 integer, c2 varchar(29))",
-      "INSERT INTO t1 VALUES (1,'foo')",
-      "INSERT INTO t1 VALUES (2,'bar')",
-      "INSERT INTO t1 VALUES (3,'fun')",
-      "INSERT INTO t1 VALUES (4,'egg')",
-      "SELECT max(c1) from t1",
-      "SELECT sum(c1) from t1",
-      "INSERT INTO t1 VALUES (5,NULL)",
-      "SELECT count(*) from t1",
-      "SELECT count(c2) from t1",
-      "DROP TABLE t1"
-   };
-   int (*hndl[11])(void*,int,char**) = {
-      NULL,
-      NULL,
-      NULL,
-      NULL,
-      NULL,
-      string_handler,
-      string_handler,
-      NULL,
-      string_handler,
-      string_handler,
-      NULL
-   };
-
-   for (int i=0; i<11; ++i) {
-      Pmsg1(0, "DB-Statement: %s\n",stmt[i]);
-      if (!db_sql_query(db, stmt[i], hndl[i], NULL)) {
-         Emsg0(M_ERROR_TERM, 0, _("Stmt went wrong\n"));
-      }
-   }
-
-
-   /*
-    * datatypes test
-    */
-   Pmsg0(0, "\ndatatypes test... (TODO)\n\n");
-
-
-   Dmsg0(200, "DB-Statement: CREATE TABLE for datatypes\n");
-   if (!db_sql_query(db, "CREATE TABLE t2 ("
-     "c1        integer,"
-     "c2        varchar(255),"
-     "c3        char(255)"
-     /* some more datatypes... "c4      ," */
-     ")" , NULL, NULL)) {
-      Emsg0(M_ERROR_TERM, 0, _("CREATE-Stmt went wrong\n"));
-   }
-
-   Dmsg0(200, "DB-Statement: DROP TABLE for datatypes\n");
-   if (!db_sql_query(db, "DROP TABLE t2", NULL, NULL)) {
-      Emsg0(M_ERROR_TERM, 0, _("DROP-Stmt went wrong\n"));
-   }
-
-
-   db_close_database(NULL, db);
-   Dmsg0(200, "Database closed\n");
-
-   return 0;
-}
-#else  /* needed */
-int main (int argc, char *argv[])
-{
-   return 1;
-}
-#endif /* needed */
diff --git a/src/tools/testfind.c b/src/tools/testfind.c
index d19a82a..bcd67a5 100644
--- a/src/tools/testfind.c
+++ b/src/tools/testfind.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Test program for find files
@@ -23,7 +27,6 @@
 #include "bacula.h"
 #include "dird/dird.h"
 #include "findlib/find.h"
-#include "lib/mntent_cache.h"
 #include "ch.h"
 
 #if defined(HAVE_WIN32)
@@ -144,7 +147,7 @@ main (int argc, char *const *argv)
       FILESET *var;
 
       fprintf(stderr, "Valid FileSets:\n");
-
+      
       foreach_res(var, R_FILESET) {
          fprintf(stderr, "    %s\n", var->hdr.name);
       }
@@ -153,7 +156,7 @@ main (int argc, char *const *argv)
    }
 
    ff = init_find_files();
-
+   
    copy_fileset(ff, jcr);
 
    find_files(jcr, ff, print_file, NULL);
@@ -164,7 +167,7 @@ main (int argc, char *const *argv)
       free(config);
       config = NULL;
    }
-
+   
    term_last_jobs_list();
 
    /* Clean up fileset */
@@ -229,8 +232,6 @@ main (int argc, char *const *argv)
      num_files, max_file_len, max_path_len,
      trunc_fname, trunc_path, hard_links);
 
-   flush_mntent_cache();
-
    term_msg();
 
    close_memory_pool();
@@ -239,7 +240,7 @@ main (int argc, char *const *argv)
    exit(0);
 }
 
-static int print_file(JCR *jcr, FF_PKT *ff, bool top_level)
+static int print_file(JCR *jcr, FF_PKT *ff, bool top_level) 
 {
 
    switch (ff->type) {
diff --git a/src/tools/testls.c b/src/tools/testls.c
index ebf1bb3..65fa99a 100644
--- a/src/tools/testls.c
+++ b/src/tools/testls.c
@@ -1,17 +1,21 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
+   Copyright (C) 2000-2015 Kern Sibbald
    Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Test program for listing files during regression testing
@@ -184,7 +188,7 @@ static int count_files(JCR *jcr, FF_PKT *ff, bool top_level)
    return 1;
 }
 
-static int print_file(JCR *jcr, FF_PKT *ff, bool top_level)
+static int print_file(JCR *jcr, FF_PKT *ff, bool top_level) 
 {
 
    switch (ff->type) {
diff --git a/src/tools/timelimit.c b/src/tools/timelimit.c
index c337a18..d1f03fd 100644
--- a/src/tools/timelimit.c
+++ b/src/tools/timelimit.c
@@ -25,6 +25,8 @@
  */
 
 
+#include "../config.h"
+
 /* we hope all OS's have those..*/
 #include <sys/types.h>
 #include <sys/signal.h>
@@ -68,11 +70,15 @@
 #endif /* HAVE_SYSEXITS_H */
 
 #ifndef __unused
-#ifdef __GNUC__
-#define __unused __attribute__((unused))
-#else  /* __GNUC__ */
-#define __unused
-#endif /* __GNUC__ */
+# ifdef __GNUC__
+#  if GCC_VERSION >= 3004
+#   define __unused __attribute__((unused))
+#  else
+#   define __unused
+#  endif
+# else  /* __GNUC__ */
+#  define __unused
+# endif /* __GNUC__ */
 #endif /* __unused */
 
 #ifndef __dead2
diff --git a/src/version.h b/src/version.h
index d0bae63..48265be 100644
--- a/src/version.h
+++ b/src/version.h
@@ -1,52 +1,46 @@
-
+#ifndef VERSION_H
+#define VERSION_H
 #undef  VERSION
-#define VERSION "7.0.5"
-#define BDATE   "28 July 2014"
-#define LSMDATE "28Jul14"
 
-#define PROG_COPYRIGHT "Copyright (C) %d-2014 Free Software Foundation Europe e.V.\n"
-#define BYEAR "2014"       /* year for copyright messages in progs */
+#define COMMUNITY 1      /* Define to create a Windows community binary */
 
-/*
- * Versions of packages needed to build Bacula components
- */
-#define DEPKGS_QT_VERSION  "01Jan13"
-#define DEPKGS_VERSION     "29Feb12"
-#define BQT4_VERSION       "4.8.4"
+/* Note: there can be only *one* VERSION in this file */
+#define VERSION "7.2.0"
+#define BDATE   "14 August 2015"
+#define LSMDATE "14Aug15"
+
+#define RELEASE 1   /* Use ONLY in rpms */
 
+#define PROG_COPYRIGHT "Copyright (C) %d-2015 Kern Sibbald.\n"
+#define BYEAR "2015"       /* year for copyright messages in progs */
 
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2000-2015 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
-
-/* Shared object library versions */
-
-/* Uncomment to overwrite default value from VERSION */
-/* #define LIBBAC_LT_RELEASE     "5.1.0" */
-/* #define LIBBACCFG_LT_RELEASE  "5.1.0" */
-/* #define LIBBACPY_LT_RELEASE   "5.1.0" */
-/* #define LIBBACSQL_LT_RELEASE  "5.1.0" */
-/* #define LIBBACCATS_LT_RELEASE  "5.1.0" */
-/* #define LIBBACFIND_LT_RELEASE "5.1.0" */
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
 
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
 
 /* Debug flags */
 #undef  DEBUG
 #define DEBUG 1
 #define TRACEBACK 1
 #define TRACE_FILE 1
+#define ENTER_LEAVE 1
+//#define FORCE_ALIGNED 1
 
 /* If this is set stdout will not be closed on startup */
 /* #define DEVELOPER 1 */
@@ -67,6 +61,8 @@
 # define SMCHECK
 #endif
 
+#define BEEF 0
+
 /*
  * _USE_LOCKMGR does lock/unlock mutex tracking (dead lock)
  *   it can always be turned on, but we advise to use it only
@@ -119,7 +115,7 @@
  * for more safety, but is 30 times slower than above
  */
 #define SQLITE3_INIT_QUERY "PRAGMA synchronous = NORMAL"
-
+   
 /*
  * This should always be on. It enables data encryption code
  *  providing it is configured.
@@ -140,7 +136,6 @@
 /* #define DEBUG_MEMSET 1 */
 /* #define DEBUG_MUTEX 1 */
 /* #define DEBUG_BLOCK_CHECKSUM 1 */
-#define BEEF 0
 
 /*
  * Set SMALLOC_SANITY_CHECK to zero to turn off, otherwise
@@ -190,3 +185,5 @@
  *  eliminate the comm time sending to the SD.
  */
 /* #define FD_NO_SEND_TEST 1 */
+
+#endif  /* VERSION_H */
diff --git a/technotes b/technotes
deleted file mode 100644
index 2e29d30..0000000
--- a/technotes
+++ /dev/null
@@ -1,3282 +0,0 @@
-              Technical notes for current GIT
-          
-General:
-
-20Jan10
-kes  Make missing plugin during backup fatal.
-18Jan10
-kes  Fix unserial to limit size. Fixes bug submitted by Graham.
-11Jan10
-ebl  Upgrade DB version from 11 to 12.
-08Jan180
-kes  Remove requirement for different storages for migrate, something
-     forgotten, but reminded by Jim Barber.
-06Jan10
-ebl  Add make_catalog_backup.pl script that uses env variables and
-     disk file to pass database password for backup
-ebl  Modify the sql query to get alphabetical order of clients when
-     selecting the most recent backup for a client. Thanks to  
-     Holger Mueller for this suggestion.
-03Jan10
-ebl  Fix initgroups definition on aix >= 5
-27Dec09
-mvw  Plugins are only build when libtool is used
-22Dec09
-ebl  Add bacula_config script for support issues
-ebl  Display a warning message if postgresql client libs <= 8.1 and
-     batch insert is enabled.
-21Dec09
-ebl  if batch insert is turned on when we try to open a connection and 
-     thread safe is not enabled, we M_ABORT Bacula
-ebl  Add dbcheck -t option that test if the current backend is thread-safe
-20Dec09
-kes  Fix old way of detecting thread safe SQL in ./configure
-     We should really phase this out.
-17Dec09
-ebl  LSBize Debian init scripts
-10Dec09
-ebl  Update the lock manager to detect possible race condition
-     on the fly. You can activate it with USE_LOCKMGR_PRIORITY in
-     version.h
-08Dec09
-ebl  Fix bug #1431 about bad reload command.
-     Still an object to free in this case.
-06Dec09
-kes  Fix seg fault in new AllowCompression code
-kes  Add AllowCompression feature that turns off compression in Storage
-     resource.  Submitted by: Steve Polyack <korvus at comcast.net>
-05Dec09
-ebl  Fix #1403 about windows directory attributes not well restored
-03Dec09
-ebl  Remove SQLite2 scripts
-ebl  Apply Arno's patch for check_bacula nagios plugin
-02Dec09
-ebl  Rename bvfs brestore_ table
-01Dec09
-kes  Remove support for SQLite 2
-kes  Fix rpm spec files bug #1420
-kes  Fix include of MySQL libs to use shared object. Fixes bug #1427
-kes  Fix search for libdbd in DBI option. Fixes bug #1422
-kes  Fix RH spec files to use /etc/logwatch instead of /etc/log.d
-     Fixes bug #1428
-23Nov09
-ebl  Apply Lorenzo's MacOSX patches
-16Nov09
-ebl  Add basic completion for restore mode 
-14Nov09
-kes  Fix bug #1367 buy creating an empty query.sql file. The old query.sql
-     file is now in exmaples/sample-query.sql, but is unsupported.
-13Nov09
-ebl  Add .jobs type=B/C/R command to filter jobs listing
-11Nov09
-ebl  Fix basejob code for Mysql
-ebl  Fix segfault in basejob code
-05Nov09
-ebl  Display a message if catalog max_connections setting is too low
-04Nov09
-kes  Apply Victor Hugo dos Santos' Spanish translation patch
-kes  Fix double send of attributes introduced in 84aab...
-kes  Cleanup error handling in SD append to reduce spurious error messages
-ebl  Check pthread_mutex_lock return code in lockmgr
-03Nov09
-kes  Fix bug #1409: increase ls field width for file size from 10 to 12.  
-     At some point we will need to make this totally variable.
-02Nov09
-ebl  Avoid orphan buffers in testls
-01Nov09
-kes  Fix DCR race condition in SD that could lead to seg faults.
-kes  Make many regress tests timeout after 30 mins.
-30Nov09
-kes  Fix Win32 bat so that it runs better.
-kes  Fix seg fault in bat.
-29Nov09
-kes  Make builds stop if any errors.
-kes  Revert James' Win32 make_defs fix -- it builds incorrect def files
-27Oct09
-ebl  Add readline completion support for bconsole. It gives help
-     on all commands, and complete job=, pool=, client=, fileset=, ...
-     It works with --disable-conio and --with-readline=/usr/include/readline
-25Oct09
-mvw  Add support for running tape mount and unmount commands
-23Oct09
-kes  When dequeuing messages, don't allow queuing more, but send them
-     to syslog. Fixes Eric's messages-test regression script.
-kes  Make queuing messages work on jcr local mutex. Improves concurrent
-     throughput.
-20Oct09
-ebl  Add dot functions for bat to list location, mediatype and volstatus
-ebl  Add bat screen to list Media in a table view (permits to search, filter
-     and sort media)
-ebl  Permits update slot(s) and label barcodes slot(s) commands.
-19Oct09
-ebl  Fix typo in disk-changer listall command
-ebl  Fix status slots command when slots are mixed
-18Oct09
-kes  Apply James' fix for some Exchange plugin crashes
-17Oct09
-ebl  Add ActionOnPurge pool parameter starting from Michael Stapelberg work.
-mvw  Fix bug #1361 where device was not unmounted.
-     One big warning however when you now set Requires Mount to yes for a file device
-     you NEED to define a mount and unmount command or the stored will scream.
-16Oct09
-kes  Fix switching read device reported by Nicolae Mihalache <mache at abcpages.com>
-mvw  Merged xattr overhaul which implements the extattr interface for *BSD
-15Oct09
-kes  Fix bug #1391 Job status improperly set due to subtle variable overload problem
-13Oct09
-ebl  Fix #1352 about double free with regexp and big filenames on windows
-11Oct09
-kes  Apply Graham's idea for recovering from disk full by recursing
-     when doing fixup_write_error ...
-kes  Make fix for VirtualFull changing device based on suggestion by
-     Nicolae Mihalache <mache at abcpages.com>
-08Oct09
-ebl  Add listall command to autochanger interface
-ebl  Tweak autochanger screen in bat with new commands
-ebl  Add listall and transfer command to disk-changer and mtx-changer
-05Oct09
-kes  Fix concurrent Job recycle bug #1288
-mvw  Fix logic error in xattr code
-ebl  Apply Andreas's patch to remove ScratchPool ref from bat Media list screen.
-03Oct09
-kes  Add a MaxVolBytes test that create over 100 Vols
-kes  Fix bug #1382 newly created disk volumes -> file not found warning 
-02Oct09
-ebl  Cleanup the console timeout code.
-29Sep09
-kes  Apply console timeout patch from Vitaly Kuznetsov <vitty at altlinux.ru>
-ebl  Remove the inx4 index for SQLite2/3 (FilenameId, PathId) on
-     File table. 
-     It is useless for common usage, and causes performance issues.
-     This index fragments over the time and the update cost grows
-     very quickly. (This index is not present on Mysql schema)
-26Sep09
-kes  Remove gnome-console
-kes  Implement store_size32 and store_size64
-25Sep09
-kes  Fix Alpha ifdefing -- should fix bug #1359
-kes  Add more smtp document -- resolves bug #1376
-22Sep09
-ebl  Remove the file_fp_idx index for Postgresql (FilenameId, PathId) on
-     File table. 
-     It is useless for common usage, and causes performance issues.
-     This index fragments over the time and the update cost grows
-     very quickly. (This index is not present on Mysql schema)
-17Sep09
-kes  Fix seg fault in ignoredir code
-15Sep09
-ebl  Update restore menu 12 explanation
-14Sep09
-ebl  Rename .lsdirs/.lsfiles/.update to .bvfs_xxx
-     to avoid confusion with future commands
-11Sep09
-kes  Set Volume Poll Interval to 5 mins by default.
-kes  Create an inline definition of bigendian().
-kes  Apply Frank's patch to change / to - in cdash tests. 
-     Hopefully it will fix some submit problems.
-10Sep09
-kes  Fix seg fault in SD bug #1371
-09Sep09
-ebl  Fix problem when the top_level contains a Exclude Dir flag.
-ebl  Fix #1370 about the implementation of the "Exclude Dir Containing"
-     option on FD.
-ebl  Fix #1369 about a segfault when using ExcludeDirContaining option
-     before the Options{} block in fileset.
-08Sep09
-ebl  Apply Lorenz fix for minor issues in the osx installer package builder.
-ebl  Fix #1373 about typo in bscan manpages. Thanks to John Goerzen.
-07Sep09
-ebl  Make output of new commands .lsdir/.lsfile more usable.
-kes  Apply Marco's git format-patch patches for bugs #1365 and #1366
-06Sep09
-kes  Increment minor version to avoid future conflict.
-kes  Increase default path/file length to 2048. This should fix
-     bug #1368.  Too bad Mac OS programmers don't respect POSIX
-     standards.
-04Sep09
-kes  Implement BlockChecksum in Device to be able to turn off checksum
-       for performance reasons
-ebl  btape: Add speed command and test drive speed with Bacula blocks
-03Sep09
-ebl  Use MaxFileSize device configuration in btape
-ebl  Make less tweaks in random buffer in btape
-ebl  Fix #1364 and #1363 about compression buffer error.
-01Sep09
-kes  Many debug code fixes in regression scripts
-kes  Update tape tests for hardware certification
-     Add script for doing btape test command 
-     Make btape return error status if test command fails 
-kes  Eliminate xattr.c compiler warning
-31Aug09
-ebl  Prohibit copy and assignment in db_list_ctx.
-mvw  Exclude OSX resource forks from saving using the xattr code
-     Exclude OSX acl data from saving using the xattr code when
-     normal acl mode is also enabled.
-     Make excluding certain xattr in the generic functions somewhat
-     easier for certain OS specific attributes.
-30Aug09
-kes  Fix Win32/64 build
-kes  Fix bug #1355 Director crashes with double free in Accurate SQL query
-ebl  Prohibit copy and assignment in Bvfs.
-28Aug09
-kes  Fix bug #1357 Verify jobs fail when job has zero files
-26Aug09
-kes  Fix possible seg fault in db_get_int_handler in accurate code
-kes  Release orphanned buffers in accurate code.
-25Aug09
-kes  Suppress some error messages generated after cancelling a job.
-     This should reduce some of the unwanted error messages after
-     a job has been canceled as described in bug #1354. However,
-     there are many other places.
-24Aug09
-kes  Apply and commit Lorenz Schori <lo at znerol.ch> patch for OSX
-   * Add platforms/osx/{build,dl,products,tools} to .gitignore
-   * Put configuration files into /Library/Preferences/bacula in order to  
-     simplify access to the for Mac Users without Shell experience and to  
-     prevent loss of configuration after upgrades.
-   * Complete Info.plist in order to prevent Installer.app on 10.4 from  
-     displaying "My Great App" instead of "Bacula File Daemon x.y.z" in the  
-     welcome screen.
-   * Add the README file to platforms/osx
-kes  Confirmation of procedure suggested for upgrading from SQLite2
-     to SQLite3.  This fixes bug #1351.  Procedure is:
-     echo ".dump" | sqlite bacula.db >bacula.sql
-     mv bacula.db bacula.db.old
-     sed -i -e 's%INTEGER UNSIGNED AUTOINCREMENT,%INTEGER,%g' bacula.sql
-     (note: the above only works on Linux systems. On some systems
-      the -i option is not available. Adapt as necessary)
-     sqlite3 bacula.db
-     .quit
-     sqlite3 bacula.db <bacula.sql
-     rm -f bacula.sql
-23Aug09
-ebl  Run job when double-click in Jobs list item
-ebl  Simplify the code to make TableWidget in read-only
-kes  Free Volume in several places. Fixes virtual-changer problem
-     and possibly bug #1346.
-kes  Add SD Volume debug code
-22Aug09
-kes  Don't print different filesystem. Will not descend 
-     message if directory explicitly excluded
-21Aug09
-ebl  Tweak status storage slot command to release db lock just
-     after the usage.
-kes  Rework the bsock.h class to put public structures last
-20Aug09
-kes  Integrate patch for building dmg on OSX from Lorenz Schori <lo at znerol.ch>
-kes  Add commas in num files for estimate command
-19Aug09
-kes  Fix bat crash due to alignment diff in bat and core code
-     In bsock.h, exact reason unknown.
-kes  Ensure timestamp put in SQL log
-15Aug09
-kes  Modify acquire alogrithm so jobs do not block during despooling
-     This can give significantly more parallelism
-ebl  Fix couple of segfault with new ACL/XATTR code
-kes  Apply Marco's branch with jcr structure cleanup
-kes  Apply Marco's branch with new acl/xattr code
-13Aug09
-ebl  update lock manager to display file:line all the time
-kes  Make SD lock tracing work again. Has not worked for some time.
-ebl  bat: Add a re-run button on job info page, that allows to
-          run the selected job with the same properties (level, pool, 
-          etc...)
-ebl  bat: tweak the run job window to make it a bit more sexy
-12Aug09
-kes  Make new big-virtual-changer test. Test concurrency.
-ebl  Add .lsfiles, .lsdirs, .update command to interface user with bvfs object
-10Aug09
-kes  Pull Philipp Storz' bacula.spec changes for OpenSuSE build service
-kes  Implement MaximumConcurrentJobs for SD devices.
-     This should significantly help spread jobs among different drives.
-09Aug09
-kes  Fix bug #1344 show pool displayed wrong variable for maxvolbytes
-kes  Fix compiler warnings in acl and xattr code
-kes  Fix screw up with setting JobLevel and JobType
-kes  Change version
-kes  Apply Marco's acl/xattr rework code
-08Aug09
-ebl  bat: display a Warning icon when having Errors>0 and Status=T
-07Aug09
-ebl  bvfs: Add example to list files versions
-ebl  bvfs: Fix directory listing
-ebl  bvfs: Add limit/offset implementation to save resources on director
-ebl  bvfs: Create cache tables on the fly when using Bvfs object (for testing)
-06Aug09
-ebl  Document FT_DELETED FileIndex=0 special value in database Schema
-ebl  Add a new Bvfs class that implements brestore instant navigation
-     cache inside Bacula. Works for Mysql, Postgresql and Sqlite3
-kes  bat: fix compiler warning for unreferenced argument
-04Aug09
-ebl  bat: Go to the media info panel when double-click on job page or media list
-ebl  bat: cleanup job and mediainfo panel
-03Aug09
-ebl  Add new media info panel to bat
-02Aug09
-kes  Remove old sqlite3 build from bacula.spec
-kes  Move bat from bacula.spec to bacula-bat.spec
-kes  Remove installing gconsole start script from Makefile.in
-01Aug09
-ebl  Add Job Info panel to bat
-30Jul09
-ebl  Add restore from multiple storage functionality with
-     a part of Graham's patch.
-kes  Add 'show disabled' command that lists the disabled jobs.
-kes  Modify enable/disable commands to show only appropriate Jobs.
-29Jul09
-kes  Add ACL check for client in estimate command
-ebl  Change time_t by utime_t in accurate function
-kes  Start reworking 3.0.2 bacula.spec file
-     - Add SuSE build codes
-     - Add depkgs-qt so bat can build on any system
-     - Reorganize defines
-26Jul09
-kes  Tweak RedHat spec files
-24Jul09
-kes  Add format to a fprintf
-kes  Attempt to fix SQLite seg fault problem
-23Jul09
-kes  Fix int/int32_t problem in accurate_add_file 
-     reported by "Eli Shemer" <elish at consist.co.il>
-kes  Remove Qt 4.4 code so it compiles on 4.3 (setHeaderHidden).
-22Jul09
-kes  Apply idea of part of Graham's tidy-bsr-source.patch, but modified
-kes  Fix bug #1337 Console tries to build with SSL when libssl-dev not installed. 
-21Jul09
-kes  Add setJobStatus method to JCR class.
-kes  Modify setJobStatus so cancel has same priority as fatal errors
-20Jul09
-kes  Fix Solaris compiler warning in signal.c
-
-Release version 3.0.2:
-18Jul09
-kes  Fix bat command line input bug
-17Jul09
-ebl  Fix sql query for sqlite on suse10 on copy job
-16Jul09
-ebl  tweak some bat screens
-ebl  Replace info_msg by send_msg in status slots command.
-ebl  Fix #1323 about a problem when mounting a requested volume
-     during a restore.
-15Jul09
-kes  Make CONF::init header and .c file agree about types.
-     Reported by "Eli Shemer" <elish at consist.co.il>
-kes  Fix Win64 build
-kes  Add more example SD Device configurations.
-ebl  Force the client_encoding to SQL_ASCII when database is already
-     using this mode.
-ebl  Fix #1335 about postgresql error message during copy session
-ebl  Cleanup old job records when starting the director 
-     (Created/Running -> Failed)
-14Jul09
-kes  Tweak debug print in accurate
-kes  Apply patch in bug #1315 by McMichaeli that fixes scripts/logwatch
-kes  Add more output when spooling and no space left
-ebl  Fix postgresql driver bug that displayed <NULL> rows from time to time.
-kes  More cleanup of bootstrap
-ebl  Implement the project 'restore' menu: enter a JobId, automatically 
-     select dependents
-ebl  Should fix #1323 about verify accurate jobs and deleted files.
-13Jul09
-kes  Send bootstrap directly from DIR to SD
-kes  Create build scripts for Win64 somewhat equivalent to the Win32 ones.
-10Jul09
-ebl  Print correct JobId in bls, should fix #1331
-kes  Apply python detect patch from Bastian Friedrich <bastian.friedrich at collax.com>
-09Jul09
-kes  Add --with-hostname to ./configure
-mvw  Changed ACL_OTHER into ACL_OTHER_OBJ as IRIX doesn't seem to have
-     ACL_OTHER. Fixes bug #1333
-04Jul09
-mvw  Change checking for acl and xattr support from first file to
-     job level.
-mvw  Call acl and xattr function only when requested for fileset
-     and filed has support for acl or xattr
-mvw  Fix typo introduces by fix for bug #1305
-03Jul09
-ebl  Should fix the first part #1323 about the restore option
-     'List Jobs where a given File is saved' which display deleted files
-02Jul09
-kes  Another fix for bug #1311 to get the correct last_full_time
-ebl  Make estimate command accurate compatible. Should fix #1318
-ebl  Add estimate accurate=yes/no
-ebl  Change the code to check jcr->accurate and not jcr->job->accurate
-01Jul09
-kes  Fix bug #1317 Allow duplicate jobs = no does not work
-kes  Eliminate double job report when do_xxx_init() returns failure
-kes  Add debug code to MaxDiffInterval
-29Jun09
-kes  Change bacula-dir.conf default job name from Client1 to BackupClient1.
-28Jun09
-mvw  Fix missing case for NetBSD xattr restores.
-27Jun09
-kes  Fix Win32 build -- turn off lockmgr and remove lockmgr defs
-25Jun09
-kes  Modify xattr.c and acl.c not to fail the job on errors. This should
-     fix bug #1305.
-23Jun09
-mvw  Fix 2 rather big bugs in the xattr and acl code and fix a small
-     memory leak on a particular code path for Linux xattr/acl handling.
-ebl  Update FileSetId when initializing job.
-ebl  Fix compilation problem with message.c
-ebl  Add '*' when volume is online when displaying volume list in restore. Should
-     complete project 31.
-21Jun09
-kes  Re-fix bug #1311 if MaxDiffInterval exceeded ensure job upgraded
-18Jun09
-kes  Add all Job Types to job_type_to_str() for bat.
-kes  Fix bug #1311 if MaxDiffInterval exceeded ensure job upgraded
-17Jun09
-kes  Fix bug #1305 make errors obtaining acl during backup non-fatal
-kes  Fix bug #1309 inappropriate error message during btape fill command
-kes  Fix bug #1307 AllowHigherDuplicates=no prevents automatic job escalation
-12Jun09
-kes  Remove non-portable code referencing pthread_t fixes bug #1308.
-kes  Create patch that may fix bug #1298 and bug #1304, which causes
-     an SD crash after canceling a job.
-08Jun09
-kes  Attempt to get bat conf file installation to work with DESTDIR
-05uun09
-kes  Improve error messages when a migration sql query is used and correct
-     the problem identified in bug #1303 with starting Job names
-     containing spaces.
-ebl  Fix #1306 about a problem when building the static bconsole
-26May09
-ebl  Apply Steve Polyack patch to add DirSourceAddress and FDSourceAddress
-     directives. That permits to choose the outgoing interface.
-25May09
-mvw  Allow acl and xattr to be explicitly enabled and fail the configure
-     if we are asked to enable acl or xattr support and the OS doesn't support
-     acls or xattrs.
-23May09
-kes  Create Client record in database at startup -- makes bat work better.
-kes  Turn off useless End of file message during restore.
-kes  When doing a tree selection restore, look at the PurgedFiles column
-     in the first JobId, and if non-zero, the Job was purged, so do
-     not do selection.
-kes  Yet another try to get qmake to install bat correctly. It looks
-     like the trick is to have an executable bat file when qmake is
-     run during ./configure.
-21May09
-kes  Add Catalog = all to the default Messages resource.
-19May09
-ebl  Fix #1029 about IPV6/IPV4 address resolution order with help
-     of David Steinn Geirsson.
-kes  During jcr destruction hold jcr_chain lock only for minimum
-     time necessary.  This should fix the SD deadlock in bug #1287.
-18May09
-kes  Simplify messages printed by SD when reserve fails. This
-     should fix bug #1285.
-16May09
-kes  Create archivedir.
-15May09
-kes  Yet another attempt to get qmake to generate valid Makefiles
-     that installs the binaries. It seems to require the binary to
-     exist at qmake time :-(
-14May09
-kes  Apply fix to sql_cmds.c suggested by
-     Ulrich Leodolter <ulrich.leodolter at obvsg.at>
-     which prevents restore by file selection from using
-     Copy jobs.
-kes  Add new nagios_plugin_check_bacula.tgz from
-     Masopust, Christian <christian.masopust at siemens.com>
-kes  Reduce bconsole help to fit in 80 columns
-kes  Add bconsole @help command
-kes  Fix Show FileSet command to handle spaces
-kes  Allow specification of base daemon resource name.
-     --with-basename=<name>
-kes  Fix bat to automatically use installed bat.conf
-kes  bat was not installed even if configured. Fix by working
-     around apparent bug in qmake.
-13May09
-ebl  Turn on lockmanager when using DEVELOPER flag
-07May09
-kes  Fix typo in Solaris acl code.
-kes  Remove junk from configure.in
-06May09
-kes  Update projects file.
-04May09
-kes  Add --with-bsrdir and --with-logdir for placement of Bacula bsr
-     files and Bacula log files.
-
-Release Version 3.0.1:
-29Apr09
-kes  Fix bug #1282 Setting job.Priority in python crashes director by
-     checking if string addr is NULL.  Not tested.
-kes  Fix bug #1281 allow all on restore command line to restore
-     pruned JobIds without prompting.
-28Apr09
-dirk Correct bat Select dialog. Fixes bug #1276.
-kes  Check for job_canceled() in fd_plugin code.
-kes  Update Win32 table creation to have new DB version 11 format
-kes  Remove illegal Options in Exclude of default Win32/64 bacula-dir.conf
-27Apr09
-ebl  Fix bug #1274 where a migration job can be canceled like the
-     original job by the MaxRunTime directive.
-mvw  Added fix for bug #1275 where acl or xattr data is saved for
-     virtual filenames generated by filed plugins.
-26Apr09
-ebl  Remove 'Reposition' message when restoring
-kes  Fix platform scripts not to clean configured files during
-     'make clean' use 'make distclean' to clean everything. Fixes
-     bug #1272.
-kes  Update projects file
-21Apr09
-ebl  Tweak version string to display versionid field at the end
-     and keep fields order.
-16Apr09
-kes  Add additional mysql connection debug code submitted by:
-     Chandranshu <chandranshu at gmail.com>
-14Apr09
-kes  Fix bug #1246 Sometimes access denied with VSS enabled. UCS
-     conversion cache was not properly flushed at the end of a Job.
-kes  Fix bug #1268 Full Max Run Time cancels jobs (when Max Run Time = 0).
-11Apr09
-kes  Modify insertion of read Volumes in SD to be done before the
-     drive reservation. This ensures that a Volume to be read will not
-     be reserved for writing. Significant enhancement.
-
-Release Version 3.0.0
-06Apr09
-kes  Change default plugins dir to /usr/lib.
-05Apr09
-kes  Fix Win32 make clean to clean correctly 
-kes  Cleanup Win installer dialog messages a bit ...
-04Apr09
-kes  Separate object/binaries in Win32 and Win64 builds. More to be done.
-kes  Add bconsole to Win64 installer.
-03Apr09
-kes  Implement more automatic build of Win64 client. Note, there are still
-     lots of warning messages, but it seems to build a correct binary.
-02Apr09
-kes  Enhance Job messages from SD when the FD->SD protocol is incorrect
-     and the SD hangs up. Previously this looked like a comm error.
-mvw  Fixed problem in xattr and acl code trying to send empty acl or xattr
-     streams.
-mvw  Fix for bug #1261 where we send out a null stream when a file only an
-     acl and xattr support is also turned on.
-mvw  Added some warnings to configure when using libtool and static in
-     one configure.
-30Mar09
-ebl  Fix small memory leak in fileregexp bsr code
-29Mar09
-kes  Correct bacula32.def entry point as specified by James.
-kes  Add code to FD plugin driver to make a copy of the plugin
-     filename to be saved to avoid save_file from zaping it.
-28Mar09
-kes  Directly mark all files saved by plugin as being seen for Accurate.
-kes  Add checks on the plugin version and the plugin license. Currently
-     only implemented for FD plugins.
-kes  Add installation of /usr/share/doc/bacula
-kes  Modify plugin checkFile to return bRC_Seen to cause file
-     to remain.  Previously was true/false.
-27Mar09
-kes  Implement installation of bat help files
-     The help files are installed in the htmldoc dir and can be set
-     by --htmldoc=xxx on the ./configure. Default is:
-     /usr/share/doc/bacula/html
-kes  Update projects file
-kes  Apply patch from  Pasi Karkkainen <pasik at iki.fi> that adds
-     Previous Job name to migrate job report.
-26Mar09
-kes  Apply bacula-autoconf-db-m4.patch from Kjetil Torgrim Homme 
-     <kjetilho at linpro.no> that doesn't *require* the static libraries
-     for the SQL database engine. Fixes a build problem if the static
-     libraries are not loaded.
-25Mar09
-ebl  Update Makefiles to compile win64 using 'make WIN64=yes'
-kes  Disable plugin options in ua_run.c
-kes  Added the following to provide solutions to the plugin/Accurate
-     problem -- bug #1236 Cannot restore incremental backups with 
-     the Exchange plugin.
-     - New Bacula read-only variable bVarAccurate -- returns accurate flag
-     - New Bacula write-only variable bVarFileSeen -- marks a file as seen
-     - New plugin entry point -- checkFile that is called at the end
-       of an Accurate job and allows the plugin to mark a file as seen.
-24Mar09
-kes  Temporarly turn off comm timers because it causes bat to seg fault.
-     Must research making SIGUSR2 work with bat and Qt.
-24Mar09
-ebl  Use MTIMEONLY fileset option in accurate check
-23Mar09
-ebl  Tweak code to compile win64 version with mingw
-21Mar09
-Kes  Attempt to correct timing problems with starting bat and obtaining
-     lists. Maintain in_command counter to know when a list is coming.
-20Mar09
-kes  Convert seconds.seq separator into seconds_seq so that Bacula
-     editing of the Job name from the full Job name works. This fixes
-     bug #1255 'variable %n changed'.
-kes  Second half of proposed fix for bug #1227 that does not
-     mark virtual volumes for unloading.
-kes  Proposed fix for bug #1227 Job and labeling new tape.
-
-Beta release 2.5.42-b2
-16Mar09
-kes  Increase timeout for unmounting DVD as suggested by reporter
-     of bug #1250.
-15Mar09
-jh   Fix by James Harper to print error code when attempting to
-     restore two databases (only one is permitted). This responds
-     to bug #1234.
-kes  Apply the nodump patch supplied by Frank Kardel that fixes
-     the NODUMP flag problem. This fixes bug #1221
-kes  Add more output if a user attempts to clone a job but does not
-     uniquely specify the Job name.  This responds to bug #1248 which
-     was not a bug, but improves user feedback.
-14Mar09
-kes  Fix problems with bug #1247 and 64 bit time_t OSes by not 
-     editing (printf) time_t values.
-12Mar09
-kes  Install bacula (start/stop script) in sbindir in addition to
-     scripts dir.
-ebl  Tweak configure to remove bash specific code
-ebl  Remove TCABD reference
-11Mar09
-ebl  Free lock manager in when btape exits
-09Mar09
-kes  Apply patch from bug #1224, which fixes waiting on max Storage
-     jobs during migration.  Submitted by Alexandre Simon.
-kes  On 03Mar08 (a year ago) applied patch from bug #1059 (kardel)
-     to implement the NODUMP flag on FreeBSD.
-07Mar09
-kes  When deleting a Volume by MediaId require the Id to be
-     prefixed by a * to avoid confusing with an integer volume
-     name.
-kes  Prevent bls from printing binary data when a plugin stream
-     encountered. This fixes bug #1238
-kes  Prepare to add JS_Warnings termination status.
-kes  Attempt to resolve bwx-console Win32 crash. Not likely to
-     work.
-06Mar09
-kes  Move src/win32/dll to src/win32/lib, which is much more logical.
-kes  Fix the Win32 build.
-kes  Fix broken casting in src/compat/print.cpp.
-kes  Eliminate jcr Errors and always use jcr JobErrors.  This should
-     ensure that SD and FD errors are correctly reported.  Also add
-     JobErrors to SD returned values. This should fix bug #1242.
-28Feb09
-mvw  Implemented xattr support for Solaris 9 and above and extensible
-     attributes for OpenSolaris.
-mvw  Added some limits to the xattr code so that we don't blow up the
-     filed on big xattrs.
-mvw  Fixed some comments which changed due to xattrs being implemented.
-mvw  Changed xattr support checking in configure to test first for
-     generic solutions and when not found for specific OS functions.
-25Feb09
-mvw  Don't try to copy empty jobs (e.g. with jobbytes == 0)
-     which gives Unable to get Job Volume Parameters errors.
-     Which leads to copying the same job over and over again.
-21Feb09
-kes  Ensure that src/qt-console/.libs is cleaned properly
-20Feb09
-mvw  Use acl_data_len instead of seperate var for length
-     of acl stream.
-ebl  Add database update scripts to updatedb dir
-19Feb09
-ebl  Fix #1226 about bconsole segfault when using readline()
-18Feb09
-kes  Apply Eric's next-beta.patch that enables 64 bit FileIds and
-     adds new columns to the catalog.
-kes  Ensure that libtool directory always cleaned + reduce 
-     unnecessary output during make clean.
-15Feb09
-ebl  Check postgresql database encoding that should be SQL_ASCII
-     and print a warning if it's something else.
-08Feb09
-kes  Free name item in guid_to_name.c when already in list.
-kes  Add more info to error message in ua_tree.c
-05Feb09
-kes  Make re-read last block fatal if block numbers differ by
-     more than one.
-30Jan09
-ebl  Try to disable _FORTIFY_SOURCE by default
-29Jan09
-ebl  Tweak compat.h for new mingw
-28Jan09
-ebl  Add new ScratchPool directive to Pool. Thanks to Graham
-ebl  Turn on db_get_file_list() single SQL because the failure
-     was due to a full FS. And the accurate test fails with the
-     other code.
-27Jan09
-ebl  Fix a bug that doesn't update RecyclePool all the time 
-     during the first startup.
-25Jan09
-kes  Turn off db_get_file_list() giant SQL because if fails on
-     my production machine.
-kes  Fix bat.pro.in so that bat is properly installed rather
-     than just copied.
-24Jan09
-kes  Modify search for .conf file so that if one is given on
-     the command line, it will be used, otherwise it will use
-     the SYSCONF directory.  It will no longer look in the current
-     directory unless explicitly requested on the command line.
-     This fixes bug #1189.
-kes  Fail a job that references a plugin if no Plugin Directory is
-     defined.
-22Jan09
-kes  Fix bug #1211 crash during reload with bad dird.conf file.
-21Jan09
-ebl  Add detection of intptr_t and uintptr_t to configure process
-20Jan09
-ebl  Change some cast to use intptr_t instead of long
-18Jan09
-kes  Apply acl_solaris_update.patch submitted by Marco (thanks).
-kes  Remove configure check for resolv.h -- it is apparently not needed
-     and causes build warnings on FreeBSD.
-kes  Ensure that the installer and newinstaller Makefiles are called
-     during a make clean.
-12Jan09
-kes  Apply Eric's fix for suppressing extended attributes error messages
-     when dealing with deleted files.
-11Jan09
-kes  Add src/win32/newinstaller -- single file installer
-kes  Attempt to explicitly call gmake when needed, or if not found
-     skip the calls.  This should fix the FreeBSD regression/build.
-10Jan09
-kes  Fix bat.pro.in so that bat will install.
-09Jan09
-kes  Add more debug output to VSS init.
-kes  Attempt to correct win32 debug in berrno.
-09Jan09
-kes  Fix bug reported by Dan where make fails in clean of src/win32. 
-07Jan09
-kes  Fix bug #1212, SD is unable to recycle purged volumes. fstat()
-     was broken.
-06Jan09
-ebl  Despool attributes directly from the director if attribute
-     spool file is present
-Beta Release 2.5.28-b1
-05Jan09
-kes  Fix bat install broken by $DESTDIR change.
-02Jan09
-kes  Fix annoying compiler warnings in console/conio.c
-kes  Fix win32 build (depended whether or not ./configure was run).
-28Dec08
-kes  Apply fix suggested by Bruno Friedmann to configure.in to
-     find python2.5
-26Dec08
-kes  Turn on Eric's match_bsr tape block checking code.
-kes  Correct values used for tape block numbers in record.c.
-23Dec08
-ebl  Fix a problem with PoolUncopiedJobs option which was broken
-     by the new JT_JOB_COPY type.
-kes  Fix bug #1206 -- Error: sql_update.c:194, which was probably
-     caused by the user modifying the Bacula DB schema.
-kes  Remove rogue line of C code.
-kes  Fix bug #1208
-
-Beta Release 2.5.16-b1
-20Dec08
-ebl  Work on copy jobs
-     - Add 'list copies' command
-     - Add JT_JOB_COPY type for job copies
-     - Don't allow copy jobs in automatic restore
-     - Promote next copy job as backup when original job is deleted
-kes  Closed bug #1207 -- 2.4.4-b1 strange volume/device handling
-kes  Closed bug #1204 -- Undescriptive help options
-kes  Closed bug #1202 -- Revise documentation
-kes  Closed bug #1178 -- Bat 2.4.3 tries to double-purge volumes 
-     unable to reproduce.
-kes  Closed bug #1166. Fixed by Eric -- Problem canceling job if 
-     client looses connection while being backed up.
-kes  Fixed bug #1200 -- inconsistent auto purge documention
-kes  Fix documentation for Recyling ambiguity. Fixes bug #1200.
-kes  Remove old mmap code from compat.h/cpp
-kes  Update ChangeLog
-kes  Correct typo in Win32 Makefile editing
-kes  Correct typos in debug output.
-kes  Improved error detection in creating bsrs.
-kes  Add debug code to Win32 restore
-19Dec08
-kes  Fix Win32 build.
-ebl  Cleanup director VolParam struct
-18Dec08
-ebl  Replace File:Block in BSR by Address to fix #1190
-16Dec08
-kes  Correct missing return in Darwin code.
-15Dec08
-ebl  Copy joblog after a Copy job
-14Dec08
-kes  Tweak block.c read to more closely simulate write for computing
-     block addresses and turn on disk block testing.
-kes  Implement a crude 'list joblog' mostly for debugging.
-13Dec08
-kes  Fix Migration bug #1206 sql error with NULL FileSetId when no jobs
-     to migrate.
-kes  Fix Migration JobLog bug #1171. Get the JobIds correct.
-12Dec08
-ebl  Fix segfault in bscan when using debug mode
-11Dec08
-kes  Fix configure to do minimum Win32 configure so that make clean
-     works.
-kes  Tweak modify FD header to use %ld instead of %d.
-kes  Remove hand scanning of FD header in SD and use Bacula's
-     sscanf, which is now OS independent.
-kes  Define new object (file/dir) begin and end Volume label records 
-     in SD.
-kes  Use new method of defining XATTR #defines to avoid need for having
-     them in config.h.in
-10Dec08
-ebl  Rename all STREAM_ACL_..._T into STREAM_ACL_..
-09Dec08
-ebl  Add a new lock manager that can detect deadlock situation
-     This new option is activated with a --enable-lockmgr configure
-     option.
-ebl  Add new Director->MaxConsoleConnections directive
-03Dec08
-ebl  Fix bacula-sd hanging after tape gets full + unload 
-02Dec08
-ebl  Remove extra db_lock() in get_prune_list_for_volume()
-ebl  Apply 2.4.3-prune-deadlock.patch that fixes a problem when
-     using Catalog as message backend.
-01Dec08
-kes  Apply Marco's Darwin xattr patches.
-28Nov08
-kes  Fix Win32 build.
-26Nov08
-kes  Apply Marco's Extended attribute support patch.
-kes  Update projects file
-25Nov08
-kes  More changes to ensure that during thread switches the jcr
-     is removed from the TSD.
-kes  Ensure that consoles attach jcr to thread, and that only the
-     thread attached is removed from the TSD.
-24Nov08
-kes  Move definition of FileId_t to bc_types and define it once in the jcr.
-22Nov08
-kes  Remove all time_t from arguments in favor of utime_t, which is
-     machine independent.
-kes  Add more debug to match_bsr.c and use %u for unsigned debug editing.
-20Nov08
-ebl  Apply patch for bug #1182  about Recycle flag
-     that is not updated after a pool change.
-kes  Since the user has been warned, allow console purge command 
-     to purge volumes that are in use. This is a fix for bug
-     #1191 before it was submitted.
-kes  Fix Win32 build to add new sd_plugins.c
-ebl  Apply patch from bug #1175 that reset the Slot and the Inchanger
-     flag in db_make_inchanger_unique().
-ebl  Remove a Emsg() after recieving a Fatal signal that can lock
-     the catalog.
-19Nov08
-kes  Apply patch from bug #1187. It prints an error message if the
-     Maximum Block Size in the SD is too big.  
-kes  Increase Maximum Block Size to 2,000,000 bytes.
-kes  Use doubly linked bsr list so that consumed bsrs may be
-     removed.  Removing not yet implemented.
-18Nov08
-kes  Implement a fix that very likely fixes the undesired volume
-     purge reported by Graham Keeling.
-kes  Implement bsr block level checking for disk files. However,
-     it does not work correctly in accurate tests, and all the
-     migration and copy tests, so it is turned off.
-ebl  Make SD plugins work.
-14Nov08
-ebl  Apply Riccardo's patch to compile bacula+mysql on mandriva
-13Nov08
-ebl  Add more variables accessible through the director plugin
-     interface.
-12Nov08
-ebl  Do work on plugins
-     - fix compilation of the director plugins
-     - add plugin list to status dir output
-     - add director plugin dump after a fatal signal
-ebl  Apply Riccardo's patch that fix some win32 compilation errors 
-     and a bug with bat version browser.
-11Nov08
-ebl  Add Plugin debug after a fatal signal.
-ebl  Add db and rwlock debug after a fatal signal.
-10Nov08
-ebl  Fix maxwaittime to fit documentation, this time is now counted
-     from the job start and group all wait periods.
-ebl  Add tips for postgresql to improve performance when having
-     multiple batch insert at the same time.
-09Nov08
-ebl  Remove extra debug for db lock.
-07Nov08
-kes  Apply Riccardo's second patch that cleans up the #include
-     file order + a few Win32 particularities to make bat work
-     on Win32.
-ebl  Add allow_transactions flag to mysql db backend.
-kes  Apply win32-fixes patch from Riccardo that makes the Win32
-     bat more stable and faster (but still slow).
-06Nov08
-kes  Fix bug with job name duplication if more than 60 jobs created
-     during a minute.
-kes  Correct some bugs of cleanup in SD if the FD connection fails.
-ebl  Add code to get more information after a fatal signal.
-05Nov08
-ebl  Apply Bastian's patch that add spooldata=yes|no option
-     to run command.
-04Nov08
-ebl  Fix bash shell to sh shell in database creation script
-02Nov08
-kes  Fix orphaned jobs (possible deadlock) while pruning.
-kes  Use jcr stored in bsock rather than searching in getmsg.c.
-     This results in about a 5% speed improvement with four
-     concurrent jobs.
-kes  Implement win32_chmod that uses wide characters, if possible,
-     to get and set the file attributes.
-29Oct08
-kes  Apply pane freezing during updates patch from Riccardo Ghetta.
-kes  Rework next_vol and autoprune a bit due to failure in
-     recycle-test.  prune_volumes() now returns no status,
-     but should prune at least one Volume, if possible.
-kes  Modify check_if_volume_valid_or_recyclable to reject a
-     volume with Recycle set off.
-kes  Modify prune_volumes() to continue if volume Recycle is off
-     or if the volume has expired. Add more debug.
-28Oct08
-kes  Fix bug #1046 VolumeToCatalog incorrectly reports mounted 
-     filesystems as missing on the Volume.
-kes  Rewrite the set_jcr_job_status() code to include job status
-     priorities so that more important status changes occur but
-     lower priority status changes will not overwrite something
-     more serious.  This could possibly cause reporting incorrect status
-     reporting in some cases.  More testing is needed to ensure
-     I have the right priorities. This vastly simplifies the previous
-     contorted logic.
-     Verify Diff status should now be correctly reported, whereas it
-     was previously lost.
-kes  Reduce some debug output.
-kes  Apply Joao's patch to SQLite tables to make chars work.
-27Oct08
-ebl  Fix #1175 About update slots that don't reset InChanger flag when 
-     slot is empty.
-ebl  Fix #1173 where prune_volume() returns a volume from the scratch.
-25Oct08
-kes  Remove jobq.c constraint that read and write SD must be
-     different. This may lead to more deadlocks in the SD,
-     but they should be resolved there.
-kes  Ensure that job report is always printed even if job is failed
-     in the director.
-kes  Don't print job report twice for failed VBackup jobs.
-24Oct08
-kes  Fix editing of retention time difference to use 64 bit
-     int instead of 64 bit unsigned. This should permit very
-     long retention periods.
-kes  Implement code to prohibit a write job from appending to  a 
-     Volume that will be used for a read operation.  This is
-     new code and could possibly cause some conflicts.
-23Oct08
-kes  Integrate James Harper's Exchange Win32 plugin patch.
-kes  Apply patch from Marco van Wieringen that implements the new
-     Solaris libsec interface for ACLs so that Bacula can save and
-     restore both the new ACLs and old ACLs.
-kes  Marco's patch also corrects the file dependency generation code
-     so that it works properly both with shared libraries and static
-     libraries.
-kes  Marco's patch also includes a small cleanup of the cats Makefile
-     to remove some references to non-existent files.
-22Oct08
-kes  Modify win32 Makefiles to use full paths in most cases.
-     In particular add MAINDIR environment variable that points
-     to the main Bacula source directory.
-21Oct08
-kes  Add read volume list code to SD -- not yet used.
-kes  Add James' binutils patch
-kes  Split volume management code out of src/stored/reserve.c into
-     a new file vol_mgr.c 
-kes  Modify configure to do an automatic make clean.  This ensures
-     that any changes to ./configure options are handled correctly.
-
-Beta version 2.5.16 release:
-20Oct08
-ebl  Rename JobStat table to JobHistory
-kes  Ensure that only normally terminated jobs are migrated.
-19Oct08
-kes  Add Makefile dependency when using LIBTOOL_LINK so that any
-     change in ./configure options will be accounted for.
-18Oct08
-kes  Fix typo in the ACL patch that I overlooked.
-kes  Apply Marco's libtool include patch.
-17Oct08
-kes  Apply Bastian Friedrich's ACL patch to eliminate ACL
-     errors during restore.
-kes  Minor cleanup of create_restore_volume_list() code.
-kes  Fix typo in console Makefile.in
-16Oct08
-ebl  Fix #1110 about RunScript that can't execute a script with
-     Unicode characters in the path.
-15Oct08
-kes  Apply tray-monitor patch from Bastian Friedrich to make it
-     work with the new FD.
-14Oct08
-kes  Apply cleanup patch from Marco
-kes  Apply patch from  Marco van Wieringen <mvw at planets.elm.net>
-     that implements libtool to create shared objects out of
-     the Bacula libraries.
-kes  Fix tray-monitor so it will speak to new FD.
-ebl  Fix bug with ANSI label when volume name length < 6
-ebl  Fix segfault in debug level > 50 with btape.
-ebl  Remove warning message in btape when command is empty.
-kes  Fix Win32 build to pull in new BACULA define.
-13Oct08
-kes  Change IncludeDir to Exclude Dir Containing.
-kes  Implement code to prohibit ExcludeDirContaining in an
-     Exclude section (same for Plugin and Options).  A bit
-     of a kludge with RES_ITEM2 ...
-ebl  Add field to command list to restrict Runscript console
-     command.
-ebl  Use a separate JCR when running Console command with Runscript.
-ebl  Permit to mark version as Beta in some outputs
-11Oct08
-kes  Add plugin types in jcr.h to reduce need to cast.
-kes  Do better checking of plugin return values.
-kes  Free plugin context after calling pluginFree() as
-     requested by James.
-kes  Allow plugin to call JobMessage with NULL context.
-kes  Do not add plugin to global list if loadPlugin returns error.
-kes  Rework plugin.h a bit to reduce dependence on Bacula.
-10Oct08
-kes  Move generation of bsr file for Virtual Backup to run section
-     so that it is generated just before actually running.
-     Suggested by Graham Keeling.
-09Oct08
-kes  Add malloc and free Bacula entry points for plugins. Increment
-     FD plugin interface version. Create a Bacula plugin context 
-     structure to keep track of whether or not the plugin is disabled.
-kes  Apply FileIndex fix for plugin name stream suggested by James.
-kes  List plugins in FD status report when debug > 0.
-08Oct08
-ebl  Add a new VerId variable that is printed in version command.
-kes  Fix migration SQL not to migrate a job that has not terminated.
-     This is a partial fix to bug #1164.
-kes  Sort JobIds returned from db_accurate_get_jobids() to fix Virtual
-     backup start time bug reported by Graham Keeling.
-08Oct08
-ebl  Fix possible bug in cancel_job() with job that are not
-     yet created.
-07Oct08
-kes  Fix bat build for Win32.
-06Oct08
-kes  Copy plugin link field into ffpkt.
-05Oct08
-kes  Integrate patch from Kjetil Torgrim Homme <kjetilho at linpro.no>
-     It provides FileRegex in bsr files and code to collect regex
-     from the user during restore, an Allow Mixed Priorities feature,
-     and documentation for the above.
-ebl  Remove db Berkeley from configure process
-kes  Do dirty check on hostname (Linux only) and if not resolvable
-     use localhost as default.
-kes  Increase vtape max block to 20GB.
-04Oct08
-kes  Refactor restore code to create a close_previous_stream(). This
-     This may destabilize the source.
-kes  Implement planned startRestoreFile() plugin call.
-ebl  Remove missing Loaded information from status slots storage command.
-ebl  Fix Console command problem that cancels the job
-kes  Add more plugin restore debug code.
-03Oct08
-kes  Fix plugin_bwrite - plugin-blseek mixup pointed out by James.
-kes  Rewrite plugin restore interface a bit to correspond to how Bacula
-     creates and writes to the restored file.
-kes  Add some DebugMessage() calls to the bpipe-fd.c program.
-30Sep08
-kes  Apply Marco van Wieringen's set of patches, cleans up Migration/Copy
-     Implement 'Pool Uncopied Jobs', allow Solaris Compiler to build
-     Bat; allow add and delete in place of mark and unmark.
-kes  Another attempt to fix the endRestoreFile plugin bug noted below.
-29Sep08
-kes  Apply dbi driver patch from Joao.
-kes  Correct a bug in passing the context to the endRestoreFile() plugin command.
-     Bastien Friedrich reported the bug.
-kes  Create plugin instance only when FD job starts.
-kes  Add new FD plugin event: bEventCancelCommand when
-     a cancel command is issued to the FD.
-28Sep08
-kes  Add cmd_plugin flag to jcr so we can globally know if a 
-     command plugin is running.
-kes  If command plugin running, do not attempt (for the moment)
-     to get Win32 extended attributes.
-kes  Ensure that proper Win32 flags are set in bfile packet
-     if plugin_bopen() works on Win32.
-kes  Remove generated src/plugins/fd/Makefile
-27Sep08
-kes  Implement build and install of bpipe-fd.so plugin.
-kes  Rework the interface that passes packets to the plugin
-     so that the packet is started and ended by the packet size.
-     This allows the driver to do a sanity check.
-26Sep08
-kes  Rework the pluginIO Bacula internal code to enable   
-     proper handling of Win32 error codes from GetLastError.
-kes  Apply Joao's patch to regress startover_libdbi.
-25Sep08
-ebl  Add -B option to dbcheck to get catalog information
-kes  Fix Win32 build to include new library function.
-kes  Remove some old reader/writer code.
-kes  Implement ./configure --with-plugindir=xxx
-ebl  Fix the mysql bug in the new accurate code
-kes  Improve plugin debug. Create plugin test.
-kes  Set main thread specific data to INVALID because it
-     has no jcr. This allows debug output to work correctly.
-kes  Add src/plugins/fd/Makefile to ./configure process.
-kes  Make first cut attempt to correct SQL that computes the current
-     Pool usage.  This is to fix bug #1159.
-kes  Do a bunch of plugin cleanups for Win32 and more careful checking
-     of PluginDirectory and whether or not a plugin was found.
-24Sep08
-kes  This code should fix the race condition that leads to a Director
-     crash at job end time when the job list is updated. This was reported
-     in bug #1162.
-kes  Add more plugin documentation and fix include of config.h for
-     Win32 build (I hope).
-22Sep08
-ebl  Revert to htable instead of rblist
-ebl  Cleanup accurate code (remove tcdbm parts) and use red/black
-     tree instead of htable.
-ebl  Use a dedicate DB link to compute and send the accurate list
-     file to the client.
-21Sep08
-kes  Fix compile errors in filed/fd_plugin.c.
-20Sep08
-kes  Remove all double quotes from SQLite creating script and
-     replace by single quotes as suggested by John Huttley.
-18Sep08
-kes  Apply dbcheck patch from Yuri Timofeev <tim4dev at gmail.com>.
-     It significantly improves the performance of dbcheck for
-     MySQL.
-kes  Fix bad debug code call in src/filed/accurate.c
-17Sep08
-kes  Change two Jmsgs in accurate to Dmsg to reduce unnecessary
-     output. Perhaps we really need to implement M_SAVED.
-16Sep08
-kes  Fix bug #1156 FD crash during processing of Accurate data.
-kes  Tweaks to htable code to improved debugging and make names
-     a bit more meaningful.
-15Sep08
-ebl  Remove time_t from update_stats()
-14Sep08
-kes  Modify the license of the example plugin program to allow
-     it to be used by anyone for making a Bacula plugin.
-kes  Make apply_rp_codes() in bpipe-fd.c be static.
-13Sep08
-kes  Remove Encryption and Accurate lines in vbackup output -- not used.
-kes  Fix subtle bug in vbackup by not changing DEV_RECORD packet.
-kes  Add host name to items printed during dump.
-kes  Make Check File Changes default on.
-11Sep08
-kes  Set the default FD timeout to 3 minutes (previously 30).
-kes  Apply Bastian Friedrich's weird spelling correction patch.
-10Sep08
-kes  Always print Verify hash differences. Rename variable to make the
-     code slightly more readable.
-09Sep08
-kes  Correct tests for MaxFullInterval as reported by
-     Ulrich Leodolter <ulrich.leodolter at obvsg.at>..
-kes  Fix MaxDiffInterval code as well.
-kes  Enable Win32 plugin load code in lib.
-kes  Make Verify code that computes disk checksums use the same
-     algorithm as backup when dealing with sparse files.
-kes  Attempt to run VSS on any systems newer than Vista -- should
-     make it work on Windows Server 2008.
-ebl  Change the new statistic implementation. Remove the UseStatistic
-     directive and add a 'update stats [days=...]' command. You can
-     now decide when copy job records from Job table to JobStat.
-     Statistics are much more accurate with this.
-08Sep08
-kes  Fix SQL case problem that may cause the failure of DiskToCatalog
-     in bug #1149.
-kes  First cut adding SD plugins.
-03Sep08
-kes  Add Slot if it is non-zero to writing bsr file after a
-     backup.
-kes  Change a number of bnet_fsend() into class method calls.
-kes  Begin audit of diff of 2.4 branch to trunk code.
-01Sep08
-ebl  Fix the mysql creation script that double-created an 
-     index of the same field on the Media table.
-     Add an index to on VolumeName to the Media table for mysql.
-30Aug08
-kes  Another try at fixing Vbackup. It looks much better this time.
-     Disable file index sanity check in FD with value stored in
-     attributes record because with Vbackup the File Index gets
-     changed, but not the attributes record.
-     Enhance some debug code.
-     Fix handling of re-indexing records that are copied in Vbackup.
-29Aug08
-kes  Made level_to_str() know about Virtual backup.
-kes  Set correct Virtual backup write pool.
-kes  Fix compile warning in new dbcheck port code.
-kes  Fix migration code broken by previous virtual backup fix.
-28Aug08
-kes  Fix problem of Virtual backup not writing a sequential FileIndex.
-kes  Reset Virtual backup time/date to the value from the last backup.
-kes  Ensure that storage name is passed to SD on read.
-kes  Correct a problem with Level and Virtual backup, rework how
-     bsrs are printed in debug to use standard routine.
-kes  Apply patch from Chris in bug #1133 that provides alternate db port
-     support for dbcheck.
-ebl  Remove catalog dependency from bcopy tool.
-ebl  Modify catalog scripts to have an easier packaging integration,
-     using default variables.
-     Make difference between SQLite3 and SQLite in db_get_type()
-27Aug08
-kes  Apply most of changes in a patch from:
-      Michael Stapelberg <michael+bacula at stapelberg.de>
-      that allow the Bacula FD to compile on IRIX 6.5.
-26Aug08
-kes  Apply patch from Bastian Friedrich that accepts a yes on a
-     delete volume command line.
-kes  Attempt to fix bug #1128 InChanger flag cleared during Migration
-     job when reading from one autochanger and writing to another.
-kes  Minor tweaks (copyright dates convert to use method instead of bnet).
-21Aug08
-kes  Fix NULL Volume error when reading (or Migration or VBackup) must switch
-     drives when no tape is mounted.
-18Aug08
-kes  Add additional info to some SD messages.
-kes  Add fix supplied by Martin Simmons for turning off EOL character
-     in new console multi-command code.
-14Aug08
-kes  Fix a Verify InitCatalog problem where in certain cases
-     a garbage filename may be entered in the verification database.  This 
-     fixes bug #1143.
-13Aug08
-kes  Add VSS 64 bit dll entry point in src/win32/filed/vss_generic.cpp
-     sent in by Riyas Yoosuf.
-12Aug08 
-kes  Fix seg fault in Dir during estimate command with no level value
-     given. This fixes bug #1140.
-08Aug08
-kes  Add message to migration job when the target job is already migrated.
-     This closes bug #1129.
-30Jul08
-kes  Fix Win32 build.
-kes  Raise some restore debug levels.
-kes  Replace off_t by boffset_t where ever I found it.
-28Jul08
-kes  Define a machine dependent ioctl request type for use with 
-     vtape_ioctl().
-26Jul08
-kes  When a migration job actually runs, re-check the Job record
-     and skip if the job is already migrated. This should
-     significantly reduce the problems with bug #1129.
-24Jul08
-kes  Set MALLOC_CHECK_=0 in environment before starting Bacula to
-     turn off glibc checks that prevent getting good dumps.
-kes  Implement console 'wait mount' command. Doesn't yet work.
-kes  Implement timeout=nn on console 'wait mount timeout=nn' command.
-kes  Break the do_swapping into do_unload, do_swapping, and
-     do_load.  It is much more logical that way.
-kes  Implement a set_dcr_from_vol subroutine in acquire.c for
-     reading volumes. This allows the dcr to be refreshed after being
-     zapped when the wrong volume is mounted.
-     This should fix bug #1126 -- During multiple tape restore, bacula 
-     does not ask for physical tape change, but rereads same tape
-23Jul08
-kes  Apply patch submitted for bug #1107 with a small modification.
-     This fixes a bug where bcopy copied too many records.
-kes  Make some tweaks to bsmtp based on patch submitted in bug #1124.
-     This fixes bug #1124.
-kes  Make the default bat restore Pool be Any. This fixes bug #1118.
-22Jul08
-kes  Remove debug statement that crashes the SD at the end of
-     a tape during restore. Fixes bug #1125.
-21Jul08
-kes  Implement Win32 bat changes made to Branch-2.4
-20Jul08
-kes  Tweak separator command in console to start disabled and
-     allow defining no separator character.  Also make code a
-     bit more fault tolerant.
-kes  Make btraceback write the traceback to the working directory
-     before attempting to mail it.
-kes  Add a RFC to Projects.
-18Jul08
-kes  Attempt to implement a kludge to make Qt work with bat
-     on Win32.
-kes  Setup rstorage correctly. Virtual backups are working.
-17Jul08
-kes  Move setting JobLevel and JobType into a method, which should
-     allow completing Virtual Backups.
-kes  Fix verify jobs to work again.
-16Jul08
-kes  Virtual Backup tweaks -- it is close to working.
-15Jul08
-kes  Ensure that SD tried to mount a volume not in an autochanger
-     at least once before asking for operator intervention.
-kes  Make SD aware of Virtual Backup jobs.
-kes  Add VirtualFull for bat.
-kes  Changes to get read storage correct for Virtual Backup.
-14Jul08 
-kes  Remove old code from label.c
-kes  Split display_display_info() out of write_bsr_file()
-kes  do_vbackup_init() working -- i.e. bootstrap file built.
-kes  Change Bacula trademark owner from John Walker to Kern Sibbald
-kes  First non-working cut of vbackup
-kes  Correct FD heartbeat code to use volatile variable accessed by
-     two threads.
-kes  Zero thread id with memset if on Win32 in case it is a struct.
-kes  If cannot create JobMedia record, continue to try to write eof
-     and clean up in block.c
-12Jul08
-kes  Add code to interface OpenSSL to new Win32 pthreads code which
-     used a structure for thread_t.
-09Jul08
-ebl  tweak bat for win32 compilation
-08Jul08
-ebl  Remove tokyo cabinet from the source
-ebl  Update configure/autoconf to support berkeley DB
-ebl  Add a sort to db_get_file_list() to improve bsr construction time.
-07Jul08
-kes  Add a mtx-changer.conf file that is not overwritten during
-     an upgrade. It fully configures the mtx-changer script.
-kes  Clear in-use bit on vol when unused while swapping.
-06Jul08
-kes  Remove sleep at end of ./bacula
-kes  Clear hash packet for hardlinked files correctly. This corrects
-     a long standing bug where hardlinked files selected individually
-     would occasionally not be restored.
-05Jul08
-kes  Apply Eric's patch to ensure that autoprune does not return
-     a Volume not in the autochanger unless requested to do so.
-kes  Correct bat restore display of multiple drives. This fixes    
-     bug #1117.
-kes  Do find_a_volume() each time an unload is done. This
-     fixes the failure of maxvol2-test.
-04Jul08
-kes  Add some SD debug code.
-kes  Do find_a_volume() each time an unload is done.
-kes  Apply Joao's DBI patch that adds easier configuration of DBI drivers,
-     and adds --with-db-port to ./configure.
-kes  Use Qmsg() in job.c watchdog callback.
-03Jul08
-kes  Release main control rwlock if ABORTing.
-kes  Make watchdog connect timeout queue messages rather than sending
-     directly to avoid lock conflicts with the real thread.
-kes  Add const char in dbd.c to avoid compiler warnings.
-kes  Fix python compiler string warning. Note, IMO the GNU C++ 
-     compiler guys have made a *very* bad change to their compiler.
-     They now force all strings to be 'const' unless you explicitly
-     cast them, which is extremely ugly and ruins nice code as well
-     as creates a lot of useless work.
-02Jul08
-kes  Fix mtx-changer to detect both versions of Ubuntu (Debian)
-     mt. This fixes bug #1116.
-kes  Add const in python files to reduce compiler warnings.
-     This may have to be backed out because of later compiler
-     strict checking.
-kes  Fix failure of 2drive-concurrent-test. Always read label;
-     clear_unload() only after drive is defined in acquire_for_read().
-27Jun08
-kes  Generally clean up the manual tape loading code. The main
-     conceptual change is that when a volume is marked to be unloaded,
-     its volume name is retained, and it is only marked as unloaded
-     when either the autoloader says it is unloaded or another tape
-     is read on that drive.                                     
-25Jun08
-kes  Add debug code and refactor subroutine in stored/mount.c
-kes  Fix format problem in bscan output reported in bug #1105.
-ebl  Fix get_next_volume_for_append logic with autochanger
-      - use pruned volumes if found
-      - don't reset the inchanger flag after getting a recycled volume
-        or a scratch one
-     Fix recycle_oldest_purged_volume to take InChanger flag in account
-23Jun08
-ebl  Add mmap/unmmap implementation for tokyodbm under win32
-22Jun08
-kes  Make first step toward eliminating globals from config
-     scanning. Also should be a workaround for FORTIFY_SOURCE
-     GNU C bug -- fixes bug #1042.
-21Jun08
-kes  Apply duplicate job tests to restarted jobs.
-kes  Copy more data when restarting a job so that run
-     overrides are kept. This should fix bug #1094.
-20Jun08
-kes  More word alignment cleanup.
-kes  Fix bug where SD did not ask operator if the device could not
-     be opened. Reported by Eric.
-19Jun08
-kes  Add dbuser to DIR conf file (replaces user).
-kes  Add --with-db-password to ./configure
-kes  Fix regress to handle db_password.
-ebl  Add new 'status storage slots' that list autochanger
-     content.
-ebl  Update vtape driver to compile only under Linux.
-ebl  Fix a bug when restoring with a wrong mediatype.
-18Jun08
-kes  Eliminate ints from conf files and structures to avoid
-     word alignment problems
-17Jun08
-kes  Fix bug reported by Scott Barninger where the bacula script
-     refers to scripts in the wrong directory. Needed to meet the
-     requirements of recent FHS location changes.
-ebl  Disable vtape for FreeBSD.
-15Jun08
-ebl  Modify disk-changer to check if slot contains something before
-     loading it.
-14Jun08
-ebl  Fix vtape on win32 and debian.
-ebl  Fix autoselect patch (cause segfault).
-13Jun08
-ebl  Fix autoselect option broken for a while. Fix #1089. Need some
-     work with StorageId to be able to use a particular drive in a 
-     autochanger.
-09Jun08
-ebl  Rename vtape to vtape.
-ebl  Update vtape driver.
-08Jun08
-ebl  Modify vtape driver to avoid sparse file.
-kes  Add make clean of qt-source directory during ./configure
-kes  Store last block number written to tape in DEVICE and
-     use it for testing for correct last block on EOT.
-
-Release Version 2.4.0:
-04Jun08
-kes  Fix Win32 build.
-03Jun08
-kes  Make sure to clear JS_WaitMedia when operator mounts a Volume.
-     This fixes bug #1095.
-31May08
-kes  Add create_postgresql_database.sql to Win32 installer. Should 
-     fix problem reported by Juilio Monteiro.
-kes  Get correct slot when auto unloading a device. This fixes bug
-     #1086.
-30May08
-kes  Fix multiple media restore.
-kes  Make DEVICE Slot private and access it via a method.
-     Allows better control over when it is set and cleared.
-kes  Fix possible seg fault if SQL error.
-28May08
-kes  Add Martin's fixes to argument scanning for the estimate   
-     command. This fixes bug #1093.
-kes  Add debug code to SD.
-kes  Fix renaming a Volume, which used the wrong Volume name.
-26May08
-kes  If operator has rewind tape, print warning, release tape and
-     try once more. If tape is positioned somewhere, something went
-     wrong, so mark the tape in error and try once more. Previously
-     this error was fatal, now it produces an error message.
-kes  Ensure correct volume name displayed during restore
-kes  Ensure that Volume is mounted for restore.
-25May08
-kes  Fix a few more Coverity reported problems.
-24May08
-kes  Apply Allan Black's status dir job count patch.
-ebl  Add information about IMPORT/EXPORT slots in mtx-script.
-kes  Enhance a couple of SD debug messages.
-kes  Tweak unload flag setting and ensure it is set during swap.
-23May08
-ebl  Fix #1091 about bad output in estimate command.
-21May08
-kes  Modify autochanger locking to attempt to avoid race
-     conditions. 
-kes  Make sure device not busy before doing label command.
-kes  Display open() errors except when polling. Previously too
-     many were suppressed.  This should fix bug #1070.
-kes  Fix Win32 reparse points. Bacula will not recurse into any
-     reparse point directory, including mount points, unless the
-     directory is explicitly mentioned at the top level (same as
-     with Unix).  A file that is linked to another file will be
-     backed up -- much as Unix does for hardlinked files.
-     This fixes bug #1041.
-20May08
-kes  Remove double quotes from ChangeLog and ReleaseNotes
-kes  Remove StorageId test when pruning and recycling (Eric's changes).
-kes  Remove old form of locking when getting volumes -- causes deadlock.
-kes  Change bat dirstat layoutWidget to dirstatlayoutWidget to make
-     the name unique and to eliminate compile time error.
-kes  Add accurate.o to Win32 FD Makefile
-19May08
-kes  Fix cats dll build on Win32 after db_update_job_end_record
-     calling sequence change.
-ebl  Switch to tokyo dbm instead of htable in accurate code
-ebl  Include tokyo dbm to bacula source tree
-17May08
-kes  Fix buffer overruns detected by Coverity.
-13May08
-kes  Tweak joblog display.
-12May08
-kes  Implement --without-qwt
-kes  Fix layout of restore tree dialog
-kes  Add configure bat QWT libraries, so that bat can be built
-     with or without the QWT libaries.
-11May08
-ebl  Add dummy tape driver for regression tests.
-kes  Make sure we unload the right slot when swapping.
-10May08
-kes  Add debug times, reduce size of two-pool-changer test 
-08May08
-ebl  Tweak autoconf scripts for vtape
-07May08
-kes  Improve SD reserve debug code.
-kes  Testing an improvement to free up volumes no longer in use.
-03May08
-kes  Rework SD acquire for read to handle autochanger Volume
-     swapping.
-kes  Implement regression that explicitly tests swapping a Volume
-     from one drive to another.
-kes  Enhance disk-changer to detect most error conditions.
-kes  Fix SD code so that it properly swaps a Volume between drives.
-     This fixes bug #1083.
-02May08
-kes  Apply libdbi patch from Joao Freitas for regress and for 
-     Bacula trunk. Regress now works with libdbi. Nice.
-kes  Apply .nobackup patch from bug #1077 submitted by 
-     Edwin Groothuis.
-kes  Apply Bastian Friedrich's patch that adds %p to edit the pool
-     name into jobs cloned via the run directive.
-01May08
-kes  Prevent a Volume that is being swapped from being freed from
-     the volume list. This will most likely fix, at least partially,
-     bug #1083.
-kes  Fix strippath so that it does not get a buffer overrun and crash FD.
-     This fixes bug #1078.
-kes  Remove 50 millisec wait in SD that broke debugger.
-ebl  Add MaxRunSchedTime option that specifies the maximum allowed time 
-     that a job may run, counted from when the job was scheduled.
-ebl  Fix MaxWaitTime option that specifies the maximum allowed time that 
-     a job may block waiting for a resource, counted from when the job starts
-ebl  Rename (add) Max(Incr|Diff|Full)WaitTime to Max(Incr|Diff|Full)RunTime
-kes  Apply patch from bug #1076 by Tullio Andreatta <t.andreatta at troppoavanti.it>
-     that implements multiple commands per line in the console when using 
-     readline. Modify the default to use a semicolon as the command separator.  
-28Apr08
-ebl  Fix SQL query in migration code.
-ebl  Make accurate mode with hash disk pass regression tests
-27Apr08
-ebl  Implement first cut of accurate backup with hash disk.
-19Apr08
-kes  Force unload of volume when wrong volume mounted in SD.
-17Apr08
-kes  Fix bat seg fault at termination.
-kes  Add Bacula generated version to bat about box.
- 
-16Apr08
-kes  Experiment with allowing multiple read jobs.
-kes  Move final volume swapping code to DCR method and
-     call it from acquire_for_read().
-kes  When wrong volume is mounted during read, unload_autochanger.
-15Apr08
-kes  Integrate the libdbi changes from Joao Henrique Freitas
-14Apr08
-kes  Stop searching for Volumes in SD askdir if DIR returns the
-     same volume name twice in a row.
-kes  Close bat console windows first to eliminate error message
-     from the notifier.
-13Apr08
-kes  Tweak the swap Volume from one drive to another code so that
-     it now seems to work.
-kes  Resolve several problems with recycling that broke the new
-     code (these problems are in 2.2.9 as well).
-kes  Remove the volume lock when calling the sysop code.   
-kes  Don't mark a reserved volume with no writers as unused otherwise
-     jobs fail.
-12Apr08
-kes  Rework class structures for VOLRES, DCR, and DEVICE to make
-     the method names a bit more logical, and for more logically
-     handling the responsibilities.
-11Apr08
-kes  Remove redundant code in terminating the scheduler that just
-     causes a seg fault in many cases.
-kes  Cleanup releasing a volume and make it a DCR method.
-kes  Improve algorithm for detecting pre-reserved volume and
-     swapping volumes.
-10Apr08
-kes  Tweak volume swapping code so it works.
-kes  Correct name overloading in mount.c
-kes  Replace released flag in VOLRES with reserved and add access
-     methods for the VOLRES class.
-kes  Prevent volume from being released while being swapped.
-kes  Apply Bastian Friedrich's edit codes patch for the bpipe-fd
-     plugin that add %w (where) and %r (replace flag) editing to
-     the plugin line.
-kes  Apply Bastial Friedrich's edit pool=%p patch for run clone
-     jobs.
-kes  Refactor parts of stored/mount.c
-09Apr08
-ebl  Add sanity checks for VolWriteTime and VolReadTime
-ebl  Take care of bad clock changes while computing VolWriteTime
-     and VolReadTime. This should fix or limit #1066
-kes  Correct error string numbers in dird/catreq.c
-kes  Restructure reserving, acquiring, and mounting volumes. Calls to
-     autochanger are deferred for mount.c -- simplifes the code.
-08Apr08
-kes  Do not prune any running job. It just fails the job.
-kes  Lock the volumes when changing dev->reserved_device and marking
-     the volume unused otherwise the device can get reserved by
-     another job before the volume is released, thus blocking it.
-06Apr08
-kes  Correctly detect Ubuntu systems, and add ubuntu platform directory.
-kes  Fix bug #1063, reuse of freed ptr in list nextvol.
-kes  Release regex compile buffer in filed/job.c
-kes  Add proper type of const char in sql_create.c
-kes  Turn off debug in daemon termination routines
-kes  Move free_volume_list() before devices are freed in stored.c
-kes  Fix reference to uninitalized stack variables in bregex.c. 
-     This should correct bug #1067.
-04Apr08
-kes  Fix possible seg fault in SD when freeing a volume entry.
-03Apr08
-kes  Implement unload_dev() before swap device.
-ebl  Add statistics prunning with option and menu
-kes  Separate unload_dev() from unload_other_device() in autochanger.c
-02Apr08
-kes  Apply patch from bug #1069 that corrects spurious error messages
-     when ACLs enabled on SGI but no ACL exists.
-ebl  Fix small segfault in bacula-sd when debug level is 500
-kes  Modify run_program() and run_program_full_output() to use
-     call by reference for the results string. This corrects a long
-     standing problem where the address of the string may be changed
-     in the subroutine but not in the calling program.
-01Apr08
-kes  Re-enable code to remember last volume mounted on a non-tape
-     Autochanger.
-kes  Add patch supplied in bug #1068 that fixes a SD crash when using
-     a Virtual autochanger.
-kes  Generate correct JobMedia records during spooling/despooling when
-     running concurrent jobs.  Thanks to Tom Ivar Helbekkmo
-     <tih at hamartun.priv.no> for excellent analysis and testing.
-31Mar08
-kes  Tweak hash algorithm for htable using Martin Simmons idea
-     for doing a circular shift.
-kes  Remember what volume is in VTLs (previously turned off for
-     testing).
-kes  Analysis of JobMedia records by Tom Ivar Helbekkmo <tih at hamartun.priv.no>
-     pointed out some problems in creating JobMedia records during
-     spooling with concurrent jobs. Fix the problem by updating the
-     start file position before despooling and generate a jobmedia
-     record at the end of despooling.
-28Mar08
-kes  Fix handling of JobMedia records during spooling and when a
-     Volume is changed without actually writing data to the Volume.
-27Mar08
-kes  Rework certain SD locking based on gdb tracebacks of deadlocks
-     sent by Eric. This code now uses only the volume_lock() rather
-     than the reservations lock when at EOM and acquiring a new
-     volume. 
-kes  Ensure only one exit point in several subroutines.
-26Mar08
-kes  Implement bsock code to permit locking. Use the new code in Verify
-     in the FD to prevent the heartbeat thread from disrupting the Verify
-     data sent to the Dir.
-kes  Modify SD locking to eliminate locking the reservations system from
-     outside the system. Use the volume lock when getting media data
-     and reserving a new volume at end of media.   
-kes  Add Eric's volume_unused() fix to stored.c so that Volumes found
-     when SD starts are not locked into place.
-24Mar08
-kes  Fix error compiling runscript code on 64 bit machines.
-kes  Tweak Win32 mount point code.
-kes  Fix a couple of bugs in the accurate code (bad sscanf, buffer not
-     cleared giving bad file estimate).
-kes  Implement BIG_MALLOC in htable code. Runs 2.5 times faster for
-     5 Million entries.
-22Mar08
-kes  Keep Schedule run lists in order as suggested by
-     Bastian Friedrich.
-21Mar08
-kes  Implement autostart scripts for Debian.
-ebl  Implement upgrade catalog scripts.
-20Mar08
-ebl  Apply jobstat patch for long term statistics. Have to implement
-     purge stats command and upgrade scripts.
-kes  Fix mtx-changer.in for broken Debian mt program.
-19Mar08
-kes  Fix large number of JobMedia records reported by Eric Bollengier.
-18Mar08
-kes  Apply doc fix from bug #1062.
-kes  Resolve crash and improper restore wx-console Win32 restore
-     GUI. Fixes bug #1065.                   
-kes  Update Win32 wxWidgets to latest version.
-kes  Attempt to do correct handling of Win32 mount points. Should
-     fix bug #1046.
-kes  Fix Win32 FD backup/restore memory leak due to improper termination
-     of BackupRead/Write. This fixes bug# 1038.
-16Mar08
-ebl  Reduce memory usage for accurate backup, working only with ctime
-     and mtime. (not all Lstat field) 
-     About 40MB for my Linux system (400.000 files)
-14Mar08
-kes  Add dcr->reserved_volume flag that allows us to release a volume
-     even if it is not vol->released.  This allows maxvol2 to work when
-     Volumes expire and we are already writing to the device (i.e. a
-     volume is pulled out from under us by another job terminating after
-     we reserve the drive).
-13Mar08
-ebl  Permit multiple command/console per runscript definition.
-     RunScript { command = /bin/true ; command = /bin/false ... }
-ebl  Add RunsWhen = AfterVSS to runscript. You can execute a command
-     (restart an application) just after the VSS snapshot on windows.
-kes  Don't zap dcr values during release_volume() as they might
-     have the next Volume to be mounted.
-kes  Fix AIX prototype.
-12Mar08
-kes  Second cut of drive switching during backup.
-11Mar08
-kes  Fix Win32 build.
-kes  Update Win32 version of wxWidgets to most recent version.
-kes  Tweak Copy job details.
-kes  Rework dir_find_next_appendable_volume to make a bit more effort
-     to find a suitable volume before giving up.
-10Mar08
-kes  Make ask_sysop_to_create... to return if waken from wait.
-     This helps get out of blocked conditions.
-kes  Experimental implementation of switch_device in reservations. 
-kes  Implement FD version to allow easier protocol changes.
-kes  Add Plugin Options string -- not yet passed to FD.
-kes  Implement PluginOptions ACL.
-09Mar08
-kes  Attempt to correct problems with restores with autochangers and
-     use counts going negative 
-kes  Rework SD status command and implement API for bat. Implements
-     header, runing waitreservation, devices, volumes, spooling,
-     and terminated status keywords.
-     .status storage=xxx <keyword>
-kes  Clarify TLS error message by adding double quotes around name.
-kes  Simplify SD/FD status code by putting api flag in STATUS_PKT
-kes  Pass jcr to tls routines so debug messages can be handled better.
-kes  Rework jobq resource allocation code, and possibly fix a bug
-     that caused reference counts to get out of sync.
-08Mar08
-kes  Rename fd/dir plugin to use Bacula standard underscore.
-kes  Plugin work -- bring dir up to fd level.
-kes  Start implementation of VTL code
-kes  Fix Win32 build after adding new cats subroutine.
-06Mar08
-kes  First cut at Duplicate Job implementation.
-05Mar08
-kes  Fix bugs in MaxFullInterval and Implement MaxDiffInterval.
-kes  Start PluginOptions string, and refactor a bit of ua_run.c
-ebl  Apply Allan patch that permit to reset recyclepool. 
-04Mar08
-kes  Test patch -- possible fix or improvement for bug #1053
-kes  Refactor FD and SD status commands to permit new API code in
-     SD, and to fix Win32 build.
-kes  Win32 build is now working.
-03Mar08
-kes  Implement 'MaxFullInterval' and start 'MaxDiffInterval' based on
-     some ideas in patch from Scott Bailey.
-kes  Begin implementation of duplicate Job control.
-kes  Fix some of Win32 build after recent additions.
-kes  Apply patch from Frank Kardel that implements 'honor no dump flag',
-     which causes the FD to detect whether or not the OS has the 
-     honor no dump bit (*BSD systems), and if so, to skip backing up
-     any file with this bit set.  The feature is enabled by setting
-     'honor no dump flag = yes' in the Options section of a FileSet.
-28Feb08
-kes  Correct po warning message with datarootdir
-kes  Implement more code in dird.c to put configuration parsing in
-     a class rather than use globals.
-kes  Restructure SD status command for implementation of bat API
-     interface.
-27Feb08
-kes  Suppress incorrect 'Will not descend from x into y' messages.
-kes  Eliminate FORTIFY_CODE=2 bug, and make first cut at removing 
-     daemon globals used by parser.              
-kes  Apply Joao's patch to separate DB_TYPE and DB_PROG in configure.
-26Feb08
-kes  Fix free of plugin_list when none exists.
-25Feb08
-ebl  Apply accurate project patch.
-24Feb08
-ebl  Fix a segfault when using strip_path option. (Use of pm_strcpy
-     on non-mempool object) 
-kes  First cut of converting FD .status to work with bat API.
-     New form is:
-     .status client=XXX header
-     .status client=XXX running
-     .status client=XXX terminated
-kes  Implement first cut of Copy Job.
-kes  Implement Catalog in Pool resource. It overrides catalog specified
-     in the Client resource.
-22Feb08
-kes  Apply patch (with some difficulties) from Joao Henrique Freitas 
-     <joaohf at gmail.com>, which adds support for libdbi as a Bacula
-     database driver.
-kes  Add patch from Martin Schmid scm at apsag.com that checks to see if
-     ftruncate() actually works. In the case of some (cheap) NAS devices,
-     it does not, and so recycling NAS Volumes does not work. The code
-     simply unlink()s the file, then recreates it.  This fixes bug #1011.
-21Feb08
-kes  First incomplete cut of big malloc blocks for htable.
-kes  Tweak plugin code.
-17Feb08
-kes  Plugin debug code + tweak a couple bat dialog layouts
-14Feb08
-kes  Fix creating first JobMedia record during Migration to include
-     proper index. This caused slow restores of migrated jobs.
-kes  Temp fix to plugin name file_index.
-kes  Bacula backed up and restored a MySQL database.
-13Feb08
-kes  Implement plugin restore.
-kes  Implement parsing of db_driver to give db_type index.
-10Feb08
-kes  First cut of plugin restore code.
-kes  Fix bug #1047, which had a heap overrun when stripping certain paths,
-     and do not strip paths on symbolic links.
-kes  Set catalog backup database and user name from values specified on
-     the ./configure line.
-ebl  Fix #1031 about wrong pool source information in job report.
-09Feb08
-kes  Fix Win32 build.
-kes  Remove a redundant jcr argument to find_files, match_files, and
-     find_one_file.
-kes  Implement '.status dir header|scheduled|running|terminated' that
-     prints the requested status section. With the exception of the
-     header, the other reports have fields separated by tabs (\t).
-08Feb08
-kes  Apply patch from Peter Much <pmc at citylink.dinoex.sub.org> that fixes
-     a resource embedded run command to find a since time if no explicit
-     since time was supplied on the command line.
-kes  Apply state-file.patch sent by Allan Black <Allan.Black at btconnect.com>
-     that updates the state file at job termination time in addition to
-     when the daemon terminates.
-05Feb08
-kes  First version where a plugin did a backup.
-     bpipe-fd.so created a backup file, wrote a test
-     string to it, and Bacua could restore this fabricated file.
-02Feb08
-kes  Implement DB Driver = string for the DBI driver.
-kes  Remove all old bdb_xxx.c code.  Add dummy routines to bdb.c
-kes  First cut of code for loading Win32 plugin dlls. Implement
-     dlopen, dlsym, dlclose, and dlerror in src/win32/compat/compat.cpp
-     and implement a dlfcn.h file based on opengroup's definitions of
-     the functions.
-01Feb08
-kes  First cut plugin directives.
-30Jan08
-kes  Apply patch from bug #1049 to prevent stripping the path on a
-     symlink.
-kes  Attempt to fix bug #1047 where stripping a path corrupts the
-     heap. Waiting for feedback.
-kes  Correct the Mount message not to suggest labeling a new tape
-     when doing a restore.  Submitted by email by John Stoffel.
-kes  Attempt to work around gcc FORTIFY_SOURCE bug that crashes the 
-     FD by using casting. Reported in bug #1042.
-28Jan08
-kes  A bit of crypto cleanup.  More later.
-
-Release Version 2.2.8
-25Jan08
-kes  Apply patch from Martin to correct bug #1040, bscan sets existing
-     ClientId to zero.
-kes  Fixed important spelling error in doc -- bug #1045.
-23Jan08
-ebl  Fix bextract to be able to extract non-portable Win32 data to 
-     Unix/Linux clients
-kes  Move initialization of read/write res lock earlier in the code.
-     This fixes the crash with a null conf file. This fixes bug
-     #1030.
-kes  Redefine CURES in lib/parse_conf to be URES and move it all
-     into lib/parse_conf.c -- this responds to bug #1042, but does
-     not fix it. The fix is not to compile with FORTIFY_SOURCE.
-kes  Backport to 2.2.8 fix de-referencing a NULL pointer in the scanner from
-     the trunk SVN. I don't think this was reported as a bug.
-17Jan08
-ebl  Fix a bug during tape initialization with MTSETDRVBUFFER.
-12Jan08
-kes  Fix Win32 build with new .def files and DLL_IMP_EXP ...
-10Jan08
-kes  Add DataDespooling and DataCommitting status (committing is
-     the last despooling).
-kes  Finish implementation of new reservations code noted below.
-08Jan08
-kes  Fix bsnprintf for float point numbers. I broke recently when
-     parameterizing some variables. This fixes bug #1036.
-kes  Undo recent reservations changes ... will apply them later
-     when they work better.
-06Jan08
-ebl  Fixes #1034 which cause mysql to hang the connection after 8h
-ebl  Change default statistics target of filename.name and path.path
-     fields for PostgreSQL. This speeds lookup by indexes. Thanks
-     to Marc Cousin.
-kes  A few more tweaks to new reservation code. Make sure to clear
-     vol released flag when retaking volume. When reading label and
-     label is bad mark volume unused. When recycling, mark volume
-     unused so it can be renamed.
-05Jan08
-kes  Fix reserve_volume() so it doesn't release a volume in use
-     (i.e. a volume entry not marked released). This should be
-     the last part needed to fix bug #1018.
-03Jan08
-kes  Move Heartbeat documentation from Job to Director resource.
-     This fixes bug #1033.
-02Jan08
-kes  Fix existing switch drive SD code to call autochanger to release
-     any old volume. This must be done to keep the autochanger from
-     releasing subsequently newly reserved volumes in doing a close().
-     This should fix bug #1018.
-kes  Fail if attempting to get console input in batch mode. This
-     should help fail RunScript console commands that are incomplete.
-kes  First cut implementing switch_drive() in SD (not actually called).
-31Dec07
-kes  Implement first cut running console commands in a RunScript.
-29Dec07
-ebl  Fixes bug #1028 where 'Selection Type' option was not usable 
-     with JobDefs.
-ebl  Fixes bug #897 and bug #1005 where bacula doesn't display runscript
-     output in error.
-
-Release Version 2.2.7
-24Dec07
-kes  Add new free_tls() entry point so that Win32 builds.
-kes  Fix compile warning in src/lib/util.c
-kes  Fix entry point for edit_job_codes() so that Win32 builds.
-kes  Fix seg fault Frank Sweetser reports in regression testing
-     on his systems. The problem was that the original author of
-     bsnprintf.c did not take into account the side effects of
-     using ++x in the argument to a #define.
-kes  Make SD protocol backward compatible with version 2.2.x.
-19Dec07
-ebl  Fixes bug #1015 where bacula failed to restore acl to a socket
-     because Bacula no longer restores sockets.
-ebl  Always use ignorecase fileset option on win32 FD.
-14Dec07
-kes  Apply patch from  Michael Stapelberg <michael at stapelberg.de>
-     that implements double quoting include names in conf files,
-     and also allows piping input by having the first character 
-     be a vertical bar (|). 
-kes  Apply patch from Bastian Friedrich <bastian.friedrich at collax.com>
-     that implement %f in RunScripts to pass the FileSet name.
-kes  Skip leading | when lex input comes from a pipe as suggested
-     by Michael Stapelberg <michael at stapelberg.de>.
-13Dec07
-kes  Apply patch for bsmtp Win32 daylight savings time fix supplied by
-     Nerijus Baliunas <nerijus at users.sourceforge.net>
-12Dec07
-kes  Implement Plugin Directory and plugin events.
-11Dec07
-kes  Implement a security enhancement: TLS authentication but no       
-     encryption. Enabled by setting 'TLS Authentication = yes'.
-     Note when this is on, TLS encryption is turned OFF!
-10Dec07
-kes  This patch corrects a problem where the maximum concurrent storage
-     jobs counter gets out of sync during restore jobs causing jobs to
-     'wait on max Storage jobs'.  This patch fixes bug #1009.
-03Dec07
-kes  This patch fixes bcopy so that it produces correct Volumes.
-     It fixes bug #1022.
-kes  This patch eliminates spurious output to the console during a VerifyVolume
-     job that contains encrypted data. It fixes bug #1024.
-02Dec07
-kes  This patch prevents the 'status dir' command from trying to use a scratch
-     volume and possibly moving it from one pool to another.  This patch fixes
-     bug #1019.
-01Dec07
-kes  Add new include to postgresql.c suggested by Marc Cousins so
-     that it compiles correctly with pgre version 8.3.
-30Nov07
-kes  Fix --archivedir addition to configure. Replace it with
-     --with-archivedir in configure.in  This fixes the regression       
-     test builds.
-kes  This patch fixes bug #1012 where the job is canceled because
-      of Max Run Time exceeded when the job has not yet started.
-29Nov07
-ebl  Apply Richard Mortimer patch that fixes #1016 when there are more than 
-     one 'part' to write.  Instead of each part being stored on disk, 
-     written to DVD, then deleted from disk, all parts are written to disk,
-     and only the last is written and deleted from disk.
-kes  This patch fixes the status command to include the formating string for
-     JS_AttrInsterting.  It fixes bug #1021.
-kes  This patch should fix the Mac OS X build problem on the latest
-     Darwin, where sys/types.h was not included correctly (apparently
-     due to a change in the Mac headers).  The solution was to explicitly
-     ensure that it is defined for the ./configure.
-     This patch also has a rebuild of configure that includes the Debian
-     qt4 patch to check for qmake-qt4. This patch fixes bug #1020.
-kes  This patch should ensure that queued messages to the console are
-     displayed as soon as possible.  It should fix bug 1007, but has been
-     reported not to work.
-14Nov07
-kes  This patch fixes the infinite loop when trying to increase the
-     maximum number of volumes in a Pool during the add command.
-     This patch fixes bug #1008. 
-
-Release Version 2.2.6
-09Nov07
-db   Remove extra data on estimate command in joblist for bat.
-04Nov07
-kes  Cleanup of code in SD that sets the LastWritten date. This doesn't 
-     really change anything, but is the beginning of doing it *right*.
-     To do it completely right the LastWritten date must be passed to
-     the SD, but it is not yet done.
-kes  Minor tweaks to some bat restore SQL.
-kes  This patch fixes bug #1003 where putting the message output from
-     a Verify job into the catalog results in a recursive loop.  The problem
-     seems to show up only with postgresql (to be verified).
-kes  Correct %x to %p in postgresql debug statement.
-02Nov07
-kes  Fix bug #942 where lots of emails where generated when the heartbeat
-     interval was low and Bacula wanted a different tape from the one in
-     the drive.
-25Oct07
-ebl  Add new SD despooling attributes and Dir inserting attributes 
-     job status codes in the catalog (Status table).
-24Oct07
-ebl  Use qmake-qt4 instead of qmake when available (debian system).
-22Oct07
-kes  Add a security warning to src/cats/make_catalog_backup.in indicating
-     that passing the password via the command line (arg 3) is insecure.
-     This responds to bug #990 (it doesn't fix it).
-19Oct07
-kes  Set default debug_level to zero. This corrects bugs #991 and #993. 
-kes  Fix a crash in bat when it cannot connect to the Director for example
-     if the Director is not running.
-kes  Remove redundant INDEX (JobId) from File table in the trunk.
-     This fixes bug #992.
-kes  Make explicit exception to GPL in LICENSE to permit linking
-     the Win32 FD with Microsoft VSS code.
-kes  Apply the Solaris package patch from 
-     Masopust, Christian <christian.masopust at siemens.com>
-kes  Apply the patch to optionally add a timestamp in the debug output
-     submitted by Mariusz Czulada <manieq at wp.eu>.
-18Oct07
-ebl  Use PQerrorMessage instead of PQresultErrorMessage in postgresql
-     backend (sql_strerror). Fixes bug #989
-16Oct07
-kes  Apply Michael Short's <mdshort at gmail.com> Win32 regress patch.
-     It applied with no problems.
-kes  Add PATH command to SunOS part of mtx-changer.in so that sed and
-     awk are on the path.  
-kes  Redirect stderror to stdin on mt status command in mtx-changer.in
-     since the status is returned on stderr on Solaris.              
-kes  Activate Close button on tray-monitor window. This fixes
-     bug #986.
-kes  Check for NULL item in parse_conf.c before calling it.  In the
-     case of Device, there is no item and this caused a seg fault when
-     Device appears in the conf file.
-kes  Add a #define __CONFIG_H when including config.h in bacula.h. This
-     avoids pulling in config.h multiple times in some new code.
-12Oct07
-kes  Fix spurious warning message printed when creating a volume with
-     a LabelFormat. This fixes bug #976.
-
-Release Version 2.2.5
-09Oct07
-kes  Add JobId in place of Job name in all the Jmsg() output.
-kes  Correct the APP_DESC for the Win32 storage service (remove an e).
-07Oct07
-kes  Make maxvol-test and new more strict maxvol2-test work. 
-kes  Print JobId in all Jmsg() job output.
-06Oct07
-kes  Add new SD despooling attributes and Dir inserting attributes 
-     job status codes.  This fixes bug 961.
-kes  Fix Win32 drive display in bat version browser. Fixes bug #962.
-05Oct07
-kes  Fix doc issue. This fixes bug #963.
-kes  Fix listing performance problems in bat. Pointed out by 
-     Chris Howells.
-kes  Remove old debug code.
-kes  Fix bat code that tests for Win32. This should fix bug #968
-kes  Query 5 list wrong Vol after migration. This fixes bug #960
-04Oct07
-ebl  Fix #969 where user can't change Replace option in restore menu.
-5ASep07
-kes  Save jcr in thread specific data (tsd) for each thread.
-kes  Make Dmsg() print JobId as -%u.
-kes  Make Jmsg, Emsg, and others automatically pickup the jobid
-     for the thread if it exists.
-kes  Remove old reservation debug jid code.
-kes  Remove get_jcr_from_tid() from OpenSSL and tls code.
-ebl  Add an option that permit to specify spool size in job
-     definition. (Applying patches/testing/spoolsize_per_job.patch).
-     You must upgrade SD and DIR at the same time.
-dvl  Add new configuration item --archivedir
-dvl  Adjust regression tests to use tmp not /tmp.  This will allow
-     multiple concurrent runs of the regression tests.
-28Sep07
-kes  Fix race condition that drops final block written to volume.
-     This happens in rare cases with multiple simultaneous jobs 
-     when the Volume fills.  This fixes bug #964.  May be related
-     to bug #935 and possibly #903.
-kes  Eliminate more strerror() and replace with bstrerror().
-kes  Remove BSD getopt and replace with unrestricted IBM version.
-kes  Fix Win32 build for changed calling sequences.
-kes  More tweaks to the mount volume routines to get everything
-     right. Changed variable name from find to have_vol, which is
-     much easier to understand.
-kes  Enhance btimer debug code.
-27Sep07 
-kes  Fix FD->SD authorization failure, which was due to spurious
-     wakeups from a pthread_cond_timedwait().  Simply check the
-     predicate before continuing.  This fixes bug #953.
-kes  Add const char where needed (more to do). Remove temp debug code.
-26Sep07
-kes  Setup SQLite busy handler before doing queries. Fixes bug #967.
-kes  Don't overwrite error message in check_tables_version.
-     Fixes bug #966.
-kes  Unlock batch insert tables with same calls used elsewhere.
-kes  Allow starting 59 jobs a second.
-kes  Make SD session key more random.
-kes  Add retry for SQLite opening db if it fails. Probably helps
-     for bug #967.
-kes  Suppress extra error messages during batch insert failure.
-     Fixes bug #966.
-kes  Add jcr to timer packets so if killed message can be sent to job.
-kes  Add JobId to all Dmsg() output.
-kes  Put some FD auth code on dbglvl rather than fixed.
-kes  Return insert attributes error message in db msg buffer to avoid
-     false error messages. Helps fix bug #966.
-kes  Separate batch init error messages. Probably helps fix bug #966.
-kes  Make SD code that contructs attribute insert check string lengths
-     more carefully.
-kes  If Dir gets an error during inserting attributes, cancel SD.  
-     This reduces unnecessary error messages.
-24Sep07 
-kes  Correct search boolean for getting Volume info
-ebl  Cleanup batch insert code. Probably fixes bug #965.
-kes  Back out one small change to the reservation system (reserving a volume).
-kes  Rework how a Volume is mounted. It is now much more intelligent and
-     will always attempt to use any mounted volume if possible and reduces
-     calls to the Director asking about volumes.
-23Sep07 
-kes  Turn off some code when batch insert not enabled.
-kes  Edit FD name in connect error messages.
-kes  Rework the reservation system to take into account that the Director
-     might give us a Volume that is different from the current one being
-     used, and to ensure that we don't exceed Maximum Volume Jobs.
-     This fixes (mostly) bug #947 '  Maximum Volume Jobs = 1 produces 
-     fatal error with multiple jobs running'
-kes  Add more debug code in reservation system.
-kes  Implement maxvol-test to check bug #947.
-22Sep07 
-kes  Add code to handle tray monitor separated from Win32 FD.
-kes  Fix display of Win32 tray monitor after reboot. Fixes bug #952.
-20Sep07
-kes  Add missed return in fixing verify bug -- trunk only.
-ebl  Fix a command parser issue causing a director segfault.
-kes  Fix ANSI tape labeling. Fix restoring ANSI labeled Volumes. 
-     This fixes bug #954.
-kes  Increase the max block size to 4MB fixes bug #957.
-kes  ERABT if user sets min block size > max block size.  Fixes bug #956.
-kes  Apply 2.2.4-poll-mount fix, that resolves bug #908 where a tape
-     is not properly mounted (recognized) during a poll.
-kes  Apply 2.2.4-verify patch that resolves bug #958.  A Verify catalog
-     Job that has differences reports Verify OK.
-ebl  Fixes #955 bug seg fault in Dir introduced  with regexwhere relocation.
-17Sep07
-ebl  Add an option to operate on all pools with update vol parameters.
-     This complete the project 20. Patch from Nigel Stepp.
-ebl  Add history support to bconsole when using readline.
-     Using Ctrl-D to exit doesn't update .bconsole_history
-kes  Modify new volume algorithm to use max MediaId for generating next
-     volume number rather than the count of Volumes. This should essentially
-     eliminate the failure rate if some volumes were deleted. Bug #921.
-kes  Begin implemention of Optimize Job Scheduling.
-kes  Implement restore callback that Dirk and I agreed on for bat 
-     restore. This fixes bug #928. Restore of backup of zero files fails.
-kes  Fix SQL Catalog logging which broke with new db_escape_string 
-     calling sequence.
-
-Release Version 2.2.4
-14Sep07
-kes  Fix bacula_cats.def for new db_escape_string().
-kes  Increase size of name string when FD making connection to SD.
-     May fix bug #953. FD->SD connection failure.
-13Sep07
-kes  Add code to help Dan debug 2drive-incremental-2disk test.
-kes  Add code to try to fix bug #908.
-kes  Add waits to multiple exit detection code to try to force pid
-     file to always be deleted.
-kes  Restore good dev.tar.gz to rescue set appropriate binary property.
-     This fixes bug #950.
-kes  Fix seg fault in error exit of acquire_for_read after unsuccessfully
-     trying to switch drives by checking for blocking before unblocking.
-     Fixes bug #906.
-kes  Cancel storage daemon in all cases where FD reports error. This
-     should fix virtually all cases of bug #920.
-kes  Fix db_escape_string() for MySQL which did not compile.
-12Sep07
-kes  Fix error message that was clobbered when Dir tells SD it does not
-     have write permission on Volume.  This should fix a minor point
-     in bug #942, but not the main problem.
-kes  Add code to cancel job in SD if FD connection fails. This should
-     fix bug #920.
-kes  Add code in FD exit to prevent loops and a crash on FreeBSD.
-dvl  Pass jcr and db into db_escape_string() to enable better escaping
-     of strings
-kes  Fix migration code to get correct Volume name with multiple volumes 
-     by skipping |.  Fixes bug #936.
-kes  Implement patch supplied by Landon to fix bug #944 where using
-     TLS with bconsole uses 99+% of the CPU.
-kes  Note, you need GTK >= 2.10 to be able to link the Tray Monitor
-     program.
-kes  Move patches into patches directory.
-11Sep07 
-ebl  Fix bug #946 about 'bacula-dir -t' which doesn't works
-     as expected.
-09Sep07 
-ebl  Using 'm' in bconsole will show messages like before,
-     and not memory usage.
-kes  Fix bug #935, and probably also bug #903 where files were not
-     restored. MediaId was not properly set in JobMedia record after
-     a Volume change.
-08Sep07
-kes  Suppress chown and chmod error messages if the FD is not running
-     as root.
-07Sep07
-kes  Apply Martin Simmons' patch that should turn off the new API usage
-     when batch insert is turned off allowing building on older
-     PostgreSQLs.
-kes  Add ./configure search in qwt-qt4 for qwt package
-05Sep07
-kes  Bacula is now free of 3rd party GPL copyrighted code!
-kes  Remove idcache.c 
-kes  Add guid_to_name.c/h which replace idcache.
-kes  Remove enh_fnmatch.c.  Make code that references it use fnmatch.c
-04Sep07
-ebl  Detect if new PosgreSQL batch insert API is present.
-kes  Correct incorrect mempool call causing Director crash. Occurs on
-     systems without va_copy().
-sb   Update spec files for 2.2.1 release
-03Sep07
-kes  Fix memory pool call in ua_output.c. bug #934.
-kes  Replace fnmatch.c and fnmatch.h by modified BSD versions.
-     Add test program to fnmatch.c
-02Sep07
-kes  Integrate patch to README.vc8 from 
-     Hederer Jean-Sébastien <hedererjs at asperience.fr, had to manually
-     edit it to get it into Unix patch format.
-kes  Implement mkpath.c to replace old FSF makepath.c
-01Sep07
-kes  Implement savecwd.h and savecwd.c. Remove FSF versions.
-
-Release Version 2.2.1
-30Aug07
-kes  Update POTFILES.in
-kes  Cleanup a few underquoted AC_DEFUNs in configure   
-kes  Apply patch from Martin Simmons that adds a test for va_copy to
-     ./configure
-29Aug07
-kes  Fix bug #921 by increasing the number of tries to create a new volume
-     from 11 to 100.
-kes  Rework bmsg in ua_output to use va_copy() so that bvsnprintf()
-     can be called multiple times.  Implement a version for machines
-     without va_copy() that gets a big buffer.
-25Aug07
-kes  Integrate more portable zone offset code into bsmtp.c
-     Submitted by Attila Fülöp.
-24Aug07
-kes  Fix bad SD->FD return status reported by 
-     (James Harper) <james.harper at bendigoit.com.au>
-ebl  Fix a bug in read_close_session which return random status
-     thanks to James Harper
-23Aug07
-kes  Fix (hopefully) bug #930 by doing a db_escape_string() on file  
-     and directory names during restore of single file/directories.
-kes  Add sanity checks to .sql command when string is empty. Hopefully
-     that will resolve Dirks Director crash.
-22Aug07 
-kes  Apply patch submitted by Martin Simmons that corrects a seg fault
-     in the bsmtp chat subroutine when debug is >= 10.
-21Aug07
-kes  Fix Director crash when running bat SQL queries.
-kes  Add David's notes on Item 8: Copy pools.
-18Aug07
-kes  Rework projects file to be current and ready for a vote.
-kes  Enhance lex scanner error message.
-17Aug07
-kes  Tweak LICENSE file to mention BSD code.
-kes  Fix bat.pro.in so that it includes the OpenSSL libraries only
-     if specified on the ./configure.
-kes  Add first (not yet tested) cut of bcomm to the qt-console directory.
-     This class is intended to allow us to open a second bsock to the
-     Director while in the restore subdialog.  
-16Aug07
-kes  Fix configure to create bat Makefile before creating dependencies.
-kes  Eliminate the egg files from the tray-monitor. Use gtk calls.
-kes  Add a tooltip to the tray monitor.
-dvl  Set the Director's PID file before dropping privs. This fixes
-     bug #923.
-15Aug07
-kes  Update AUTHORs file
-kes  Increase the default max concurrent jobs to 20 in FD and SD to
-     correspond with the default .conf files.
-kes  Rewrite the Win32 service routines.  This eliminates the 3 copies
-     some different, of the same file created by RN when porting the 
-     Win32 SD and Dir.
-kes  Rearrange some of the Win32 directories and the placement of the files
-     in them.
-kes  Set DEVELOPER flag in version.h
-
-========================================================================
-Release Version 2.2.0
-09Aug07
-kes  Apply a second doc patch from Marc.
-kes  Apply a doc patch from Marc Schiffbauer <marc at schiffbauer.net> that
-     improves the tips section that discusses how to setup multiple
-     simultaneous jobs.
-08Aug07
-kes  Update bat README file.
-kes  Apply patch from Allan Black <Allan.Black at btconnect.com> that     
-     corrects a typo in the Recycle status check in db_find_next_volume().
-     This will probably fix a number of annoying problems with multiple
-     Recycled volumes.
-kes  Modify most of dird/msgchan.c to use bsock class calls rather than
-     bnet calls -- no functionality change.
-07Aug07 
-kes  Modify the Verify output to specify if files are missing on    
-     the Volume(s) or disk.  Fixes confusion in bug #916.
-kes  When more than one Volume is read in a migration job, the last
-     Volume bytes reported are from the last read volume rather than
-     the last written volume. Fixed. This fixes bug #910.
-kes  Fix display of Recycle flag after update volume=foo recycle=yes.
-     It previously printed New Recyle flag is: no. This fixes bug
-     #917.
-06Aug07
-kes  Correct seg fault when switching tape drives during restore.
-kes  Commit uid_gid_name.c (replacement for idcache.c), but will not
-     be used until after 2.2.0 release.
-04Aug07
-kes  Remove fnmatch() in SD that permitted wild card specifications.
-     This fixes bug #914.
-31Jul07
-kes  Fix %g in filename returned by SQL for browse tree reported by
-     Dirk.
-kes  Fix configure so that it puts config.out in the cwd rather than
-     in src/qt-console
-kes  Attempt to fix the locking problem reported by Eric in bug #906.
-kes  Make berrno class to leave errno unchanged after constructor call.
-kes  Make bnet_server use the heap rather than the stack to allocate
-     its socket fd pointers to avoid a crash at termination. Problem
-     reported by Ryan Novosielski and bugs pointed out by Martin Simmons.
-30Jul07 
-kes  Create new depkgs and depkgs-qt separating the qwt out of depkgs
-     and putting it in depkgs-qt along with Qt4.3.
-29Jul07
-kes  Rework code in acquire.c that switches drives for reading when
-     the Media Type does not match. This should fix bug #906
-28Jul07
-ebl  Fix a director segfault during job setup #907
-kes  Correct seg fault in postgresql when first operation returns no
-     rows.  Fixes Dirks File browser problem seg fault with bat.
-25Jul07
-kes  Apply patch from Felix Schwarz <Felix.Schwarz at web.de> that allows
-     building wxconsole on Fedora 7 with wxWidgets 2.8 (it works with
-     2.6 as well).
-24Jul07 
-kes  Implement PopUp YES/NO dialog for bat.
-23Jul07
-ebl  Fix a compilation bug when using #define BACL_WANT_NUMERIC_IDS
-22Jul07
-kes  Correct RunScript to terminate job in FD on failure.
-kes  Change abort_on_error and AbortJobOnError to fail_on_error
-     and FailJobOnError in RunScripts.
-kes  Minor tweaks of code formating in RunScripts, principally to
-     avoid depassing 80 columns.
-21Jul07
-kes  Eliminate one #ifdef Win32 in bsmtp
-kes  Implement grow tool to grow a file for testing very large databases.
-kes  Add big-vol-test to test Bacula seeking with > 5GB.
-Release 2.1.28 beta
-19Jul07
-kes  Modify find_next_volume() to return all values in Media record.
-kes  Ensure that we keep Recycle Pool when moving Scratch volumes.
-
-Release 2.1.28 beta
-18Jul07
-kes  Update Release notes 
-17Jul07
-ebl  fix a bug in get_scratch_volume() report by Andreas Helmcke
-     Warning, in previous beta version, all media get from scratch keep their
-     old retention.
-16Jul07
-kes  Tweaked Win32 installer to remove temp conf files at uninstall time.
-     This should fix bug #842. Made a note to look at removing the temp
-     files at the end of the install.
-kes  Add ability to mount and unmount a file device providing it is
-     marked as being removable and has the appropriate mount and unmount
-     commands defined in the Device resource. This fixes bug #830.
-kes  When applying a storage override, release all previous storage
-     definitions rather than just prepending the new storage.
-     This should prevent a good deal of confusion.
-14Jul07
-kes  Implement ./configure search for qwt libraries.
-13Jul07
-kes  Disable posting the WM_CLOSE message in KillRunningCopy of the 
-     Win32 FD.  This should fix bug #893.
-kes  Remove an unnecessary beep in Win32 init code.
-kes  Update copyright dates in Win32 executable about boxes.
-kes  Replace the FSF copyrighted getopt.c and getopt.h in the Win32
-     code with a BSD getopt.c and getopt.h.
-kes  Remove sched.h from the Win32 compat directory -- not used.
-kes  Remove the Exit menu item from the Win32 tray monitor. If you really
-     need to shut it down, do it through the services panel or the command
-     line.
-kes  Remove some inappropriate Bacula FSFE copyrights.
-ebl  Tweak status client=xxx to be more easy to parse (more like in 2.0.x)
-kes  Fix regress config non-portable test as pointed out by
-     Florian Heigl <florian.heigl at gmail.com>
-kes  Fix PSCMD for HP-UX in configure.in to have proper syntax.
-     as pointed out by Florian Heigl <florian.heigl at gmail.com>
-12Jul07
-kes  Fix missing rctx. prefixes on the Darwin code in src/filed/restore.c
-     Reported by Frank Sweetser.
-
-Release 2.1.26 beta
-12Jul07
-kes  Fix client-only build.
-kes  Integrate client-only fixes for bsys (initgroups) and conio from
-     Sergey Svishchev <svs at ropnet.ru> for the AIX platform.
-kes  Make arguments to get_scratch_volume() in same order as other
-     such calls.
-kes  Rework the prune_volumes() subroutine so that after purging and
-     no volume found in desired pool, it will check for a scratch 
-     volume. This prevents recycling the whole scratch pool.
-kes  Add code to status storage to print boffset_t (largefile support).
-11Jul07
-kes  Move qwt (Graphics libarary for Qt4) to depkgs.
-kes  You now need a --with-qwt=<dir> to be able to build bat.
-kes  Update src/win32/cats/bacula_cats.def to include the new       
-     db_get_query_dbids() call on Win32.
-07Jul07
-kes  Correct a problem when selecting a scratch volume and moving
-     it to another pool that lost some columns.
-kes  Tweak some code in ua_update.c to use POOL_MEM instead of POOLMEM.
-kes  Enhance Autochanger error messages to include Volume and device name.
-kes  Rework prune_volumes() code to take account of InChanger flag,
-     and to handle recycling volumes going to the Scratch pool and
-     current pool because the RecyclePool directive.
-kes  Implement a better and more efficient db_get_query_dbids() to
-     handle creating and passing back a list of DBIds.
-
-Release 2.1.24 beta
-03Jul07
-kes  Start work on new more efficient DBId subroutine. First use
-     will be for recycling volume to Scratch inchanger.
-kes  Increase number of JobIds in pruning from 1000 to 10000. 
-     This to be replaced by above routine.
-kes  Begin implementation of building Qt4 on Win32.
-kes  Correct typo in fix I added for bad TLS shutdown.
-kes  Pull 2.0.3 patches into patches directory.
-kes  Update Release notes.  Include qt-console in line count.
-kes  Update Projects file.
-30Jun07
-kes  Integrate patch from Sergey Svishchev <svs at ropnet.ru> that fixes 
-     bug in migration code where a job that spanned two volumes
-     was migrated twice.
-29Jun07
-kes  Implement new BST_DESPOOLING blocked state. Change from locking
-     during despooling in SD to blocking. This means that other threads
-     can work with the device structure, in particular the reservations
-     system while despooling.
-28Jun07
-kes  Fix return in reservation message queue that missed clearing
-     the jcr lock (implemented 26Jun07 below).
-kes  Rename a number of dev methods to make locking function names
-     a bit clearer.
-kes  Document locking in lock.c. Move lock structures to new file
-     lock.h.
-26Jun07
-kes  Move reservations message lock to lock jcr only this
-     fixes bug #861.
-kes  Move main SD locking code into lock.c (new file).
-kes  Update Win32 build to include lock.c
-
-Release 2.1.22 beta
-26Jun07
-kes  Dirk committed the qwt library code for drawing graphs in bat.
-kes  Tweak install of qwt so that it is integrated with ./configure.
-25Jun07
-kes  Fix HAVE_BATCH_INSERT to be HAVE_BATCH_FILE_INSERT, pointed
-     out by Eric (my typo).
-ebl  Fix configure.in to get batch mode enable
-kes  Return correct string from authenticate.cpp in bat when connecting
-     to Dir.
-kes  Apply patch suggested by Frank Sweetser to fix bug #888 --     
-     spurious line drops when using TLS.  
-kes  Do not file reparse points when restoring a file that already
-     exists -- Win32.
-24Jun07
-kes  Implement Windows reparse points -- similar to directories, but
-     we do not descend into it. This is a first cut. They seem to 
-     be backed up, but restore is not yet tested.
-kes  Remove restore_blocking in tls code when shutting a socket to leave
-     it in blocking mode. Hopefully this will fix the encryption bug  
-     reported by Frank Sweetser.
-kes  When opening a file for backup, tell the OS that we are going to
-     read it sequentially -- optimization.
-kes  Change variable names in authenticate_director() to not conflict
-     with member names in bat. Caused great confusion with compiler,
-     but no warnings.
-23Jun07
-kes  Queue openssl error messages in case of comm problem.
-kes  Do shutdown() call if socket terminated.
-kes  Remove some duplicated code in tls.c
-kes  Move more of the bsock member variables into private and access
-     them with methods.
-kes  Add Frank Sweetser's tls-test to the regression suite.
-22Jun07
-kes  Add Swedish sv.po file
-21Jun07
-kes  Don't print clock skew message in FD if less than 3 seconds diff.
-kes  Add a bit of VSS info to status client.
-kes  Implement a first cut of Vista VSS, using Win2003 code.
-
-Release: 2.1.20 beta
-20Jun07
-kes  Fixed bug #886 (multidrive autochanger: SD doesn't use drive with
-     loaded tape but uses first drive).
-kes  Fixed bug #807 Restore encrypted backup failed on Windows 2003
-     This was indeed a Win32 issue.
-19Jun07 
-kes  Simplify search of autochanger for in-use Volume.  
-kes  Fix exit condition of check for in-use volume.  kes Remove
-     inappropriate my_postgresql_free_result() in db_close()
-     routine.
-kes  Fix bad return in FD when encryption signature not found.
-     Probably caused a crash.
-kes  Inhibit missing encryption signature error messages for 
-     file types where no signature computed.
-kes  Correct inverted check on autochanger in reservation system.
-kes  Tweak debug code in autochanger reservation.
-18Jun07
-kes  Add some additional locking in the cats directory in subroutines
-     that modify packet variables called from batch insert.
-kes  Rework how dcrs are allocated. new_dcr() can now be called
-     with an existing pointer, and it will simply clean it up.
-     This allows the reservation system to test various different
-     devices, and will permit easy device changes.
-kes  A bunch of changes all over to handle new new_dcr() calling
-     sequence.
-kes  Work more on the Volume management in the SD. Remember Volumes
-     for tape drives and for autochangers (even virtual disk changers).
-kes  When looking at the Volume list to reserve a drive, handle 
-     autochanger names correctly by interating through the changer 
-     devices.  Also call the Director to see if a Volume is suitable
-     for the current job.
-kes  Fix some bugs in bscan. Make sure all media records are written.
-     Make sure that valid JobMedia records are written for disk files.
-     Previously they were completely wrong.
-kes  Move source tar files for depkgs-mingw32 to www.bacula.org so
-     that the URLs don't change and so that the developers will all
-     work off the same copy. Rebuild from scrach.
-kes  Upgrade Win32 SQLite3 from 3.3.8 to 3.3.17.
-
-Release: 2.1.18 beta
-16Jun07
-kes  Fix seg fault in FD from incorrect digest size. 
-kes  Fix argument to non-OpenSSL crypto.c subroutine.      
-
-Release: 2.1.16 beta
-16Jun07
-kes  Remove a few malloc()s from the encryption code.
-kes  Use the class calls to bsock in filed/backup.c and restore.c in
-     place of the old bnet_xxx code.
-kes  Implement code that does an on the fly calculation of the  
-     signing digest during restore of encrypted files.  It makes
-     a best guess at the algorithm, and if it is not correct, will
-     then revert to the old code which reads the file after it is
-     restored.
-kes  Implement at least one missing crypto stream in stream_to_ascii()
-kes  Apply patch from William <chowmeined at gmail.com> that fixes bug
-     #877 where a reload with bad syntax causes Dir to exit.
-
-Cut: 2.1.14 beta (not released)
-14Jun07
-kes  Do not free a volume on a tape drive until another volume is
-     mounted and read, or the autochanger unloads the volume.
-     This should help the SD re-use volumes that are already mounted,
-     and should fix bug #886.
-kes  Apply patch from user brettedgar that allows gnome2-console include
-     the OpenSSL libraries, and hence work with SSL.  Fixes bug #885.
-kes  Apply patch from Lucien Weller that fixes day of week calculation
-     because of DST flag problem. Fixes bug #887.
-10Jun07
-kes  Move find_next_appendable_volume() to after acquiring a valid device
-     in reserve.c.  This fixes bug #864 -- confirmed by reporter.
-09Jun07
-kes  Unable to reproduce bug 872. However added additional testing for
-     integer.
-kes  Bug #874 resolved by documenting SQLite limitations.
-kes  Bug #882 resolved by documenting mtx-changer script for new drive code.
-kes  Bug #881 resolved by removing typo in mtx-changer script.
-kes  Made Frank Sweetser's wiki the official Bacula wiki with his
-     approval. Added a link to the wiki on the web page, and implemented
-     a backup from http://paramount.ind.wpi.edu                                          
-08Jun07
-kes  Fix update allfrompool to pass pool name.
-07Jun07
-kes  Convert to pure GPL v2 license.
-kes  Fix sscanf problems reported by Peter Buschman that caused
-     a bus error on Solaris.
-kes  Rework (simplify) the select prompt in bat.
-kes  Move get_jobid_from_tid() into lib and create a 
-     get_jcr_from_tid().
-kes  Use get_jcr_from_tid() to conver all tls Emsg() to Jmsg().  This
-     should definitely fix the problem of lost error messages in the
-     encryption code.
-kes  Remove over zellous addition of FSFE copyright in a few eggxxx files.
-kes  Eliminate tcpd.h from the project. Enclose the #include from the
-     library with extern C ...
-kes  Add print of signal name when a signal is trapped.
-
-Release: 2.1.12 beta
-04Jun07
-kes  Fix a seg fault in the PostgreSQL driver dereferencing a NULL pointer.
-03Jun07
-kes  Implement SQLITE3_INIT_QUERY in version.h that can do an initial
-     query for SQLite3. Use it to set PRAGMA synchronous = OFF. This
-     makes SQLit3 run 30 times faster, though a bit less safe.
-kes  Implement --with-batch-insert in configure and detection of thread
-     safe libraries.  It is on by default, but turned off if no thread
-     safe library (e.g. SQLite 2) is available.
-02Jun07
-kes  Fix Bacula PostgreSQL buffer overruns.
-kes  Do better checking for NULL results returned from PostgreSQL;
-     implement retry for failed queries; clear results buffer after
-     failed query. Hopefully this will correct the PostgreSQL failures.
-01Jun07
-kes  Implement algorithm to handle only one appendable volume with
-     Prefer Mounted Volumes = no.
-kes  Fix a Bacula PostgreSQL bug dereferencing a NULL pointer      
-     returned from a query.
-kes  Make volume lock recursive.
-kes  Implement an additional volume reservation algorithm that
-     starts by considering all reserved volumes then uses the
-     old brute force algorithm of searching the resources to
-     find a suitable device.
-kes  Add new reservations debug code and refine the old code.
-kes  Update the win32/dll/bacula.defs file.
-29May07
-kes  Tweak reservations algorithm to permit a few more cases, i.e.
-     volume reserved, but on different drive, ...
-kes  Enhance SD status to include Pool and Media Type for drive in a
-     more readable format (a bit longer). 
-kes  Fix PostgreSQL double free.
-28May07
-kes  Minor refactoring of restore decryption code.
-kes  Add code to smartall.c to detect double free of a buffer.
-27May07
-kes  Add < > around %r in from field on mail command of bacula-dir.conf.in
-     so that bsmtp will create a correct email address (mailbox only).
-kes  Modify 'memory' command so that the buffers are listed as 'In use'
-     to avoid confusion with Orphaned buffers.
-kes  I reworked the OpenSSL include/lib flags to be handled in     
-     the standard Bacula way, which should fix bug #863 concerning
-     non-standard OpenSSL libraries.
-26May07
-kes  Implement Help Browser window for bat.
-kes  Fix reload bug that reset StorageId to zero.
-25May07
-kes  Fix TLS #ifdefing when TLS turned off.
-kes  Ensure that when labelling a tape with Slot=0 that InChanger
-     is not set.
-kes  Use DISTINCT to make MySQL and PostgreSQL uar_list_temp query        
-     the same.
-kes  Add StartTime to final uar_sel_jobid_temp query so that we can
-     add DISTINCT (required by PostgreSQL).
-kes  Implement BSOCK authenticate_director() method. Eventually will
-     authenicate all daemons.
-kes  Move several more functions into the BSOCK class.
-24May07
-kes  Add code to tell the OS that we no longer need a cached
-     file that we were reading. In findlib/bfile.c.  Also,
-     only cache files that we are reading. Thanks to
-     Tobias Oetiker <tobi at oetiker.ch> for the idea.
-kes  Tweak to bsmtp to eliminate compiler warnings on Win32.
-kes  Implement script to automatically generate cats and dll .def
-     files for Win32 dll.
-kes  Update README.mingw32 to include new .def file generation.
-kes  Correct typo in UTF-8 error message as reported by:
-     jhernandez <julianhernandez at gmail.com>
-kes  Add additional sm_check() code on debug level 1.
-kes  Set default debug level to 1.
-kes  Trap SIGABRT in attempt to get traceback.
-23May07
-kes  Reduce bat connect timeout from 30 to 15 seconds.
-kes  More restructuring and implementing BSOCK class in place of
-     old bnet.c code.
-kes  Remove a few unnecessary malloc() tests in crypto code.
-kes  Turn off crypto calls for > 128 bits in crypto.c if HAVE_SHA2
-     not defined. Bug reported by Allan Black <Allan.Black at btconnect.com>
-kes  Remove duplicate HAVE_CRYPTO definition in config.h.in
-22May07
-kes  Fix Verify InitCatalog mysql_escape_string() trashing memory.
-     Make buffer bigger.
-kes  Fix Verify InitCatalog. The attributes were not pointing to the
-     correct saved location.
-kes  Implement message callback so that GUI is sure to get all
-     daemon messages. Currently displayed in a dialog in bat.
-kes  Ignore SIGUSR2 (Bacula timer) in bat.
-kes  Apply regress patch from bug #859 to allow regress to work 
-     with Solaris compiler.
-21May07
-kes  Begin adding TLS support to bat.
-kes  Apply UTF-8/16 patch from Yves Orton <demerphq at gmail.com> to
-     clean up lex.c and make it more readable.
-20May07
-kes  Move more bnet functions into the BSOCK class.
-kes  Fix tray-monitor by not requiring a timer interval in bnet_connect()
-kes  Complete change of berrno strerror() method to bstrerror() 
-
-Release: 2.1.10 beta
-18May07
-kes  Cleanup incorrect email addresses in bsmtp.
-kes  Make bat display initial messages rather than discard them.
-16May07
-kes  First cut of adding .mod to the run command.    
-kes  Implement auto display of messages in bat.
-kes  Enhanced preferences to allow all Bacula output to be
-     displayed in bat.
-15May07
-kes  Try to make bsmtp date routines more generic.
-kes  Fixed bug #856 autochanger documentation.
-kes  Rework bsmtp date editing for Win32. This fixes bug #854.
-kes  Add new cats entry point so Win32 builds.
-14May07 
-kes  Attempt to fix bsmtp date editing on OSes without %z editing. 
-     Fixes bug #854.
-kes  Do better checking for the MySQL 64 bit libraries looking for both
-     .a and .so libraries.
-kes  Add a kludge for Ubuntu's non-standard locations for MySQL -- allow
-     /usr/include/mysql/mysql.h AND /usr/lib/... rather than /usr/lib/mysql/...
-kes  Require the thread safe version of MySQL during configure. Thanks
-     to Andre Noll for pointing this out.
-kes  Ensure that calls to find_jobids_from_mediaid_list() check count before
-     continuing in migration code.
-kes  Apply implementation of tray-monitor font derived from gnome-console
-     submitted by Andreas Piesk <a.piesk at gmx.net>
-13May07
-kes  Eliminate important memory loss in SQLite
-kes  Fixed the batch insert MySQL thread specific data that was not
-     being freed. See cats/mysql.c:db_thread_cleanup().
-kes  Fix restore before command.
-kes  Convert old hdr.name to name() in a few places.
-kes  Implement update jobid command.
-kes  Return all time_t dates in db_get_job_record()
-kes  Stop watchdog in SD earlier.
-kes  Put Pool just after Storage in please mount message.
-kes  Fix pointer usage bugs in Verify InitCatalog pointed out by
-     Eric.
-12May07
-kes  Update the po files.
-kes  Fix Verify InitCatalog by making it cache attributes.
-11May07
-kes  Change name bacula-bat to bat for man 1 page to correspond to
-     Makefile.
-kes  Check for client and store NULL pointers in status command.  This
-     fixes bug #845.
-kes  Fix non-ssl build so that it works (add JCR *jcr to crypto structures).
-kes  Fix sign extended editing of %p.
-kes  Clean out a little old #ifdefing in cats/mysql.c
-10May07
-kes  If time diff between DIR and FD is more than 600 seconds convert
-     INFO message to WARNING.
-kes  Implement heap size display in status for all daemons.
-kes  Attempt to fix MySQL db open memory loss (not successfull).
-kes  Don't set SIGKILL and SIGSTOP neither can be trapped.
-kes  Eliminate memory loss in MySQL (possibly other SQLs) during
-     Query. This looks like a MySQL but but by doing extra releases,
-     the memory goes away.  This should fix bug #847.
-09May07 
-kes  When backup fails, cancel SD before waiting for sd termination.
-kes  If SD is waiting for FD to connect during cancel, wake up the 
-     thread.
-kes  Fix fsf code so that errno is correctly reported.
-kes  Apply migration patch (with changes) from Sergey Svishchev <svs at ropnet.ru>
-08May07
-kes  Make lack of Pool directive in Job an ERROR_TERM rather than FATAL
-     so that Bacula doesn't later stumble into a seg fault.
-kes  Use the term Restore Client in the restore Job report.
-kes  Merge patch from Sergey Svishchev <svs at ropnet.ru> that preserves 
-     the original job's FileSetId.
-kes  Merge patch from Sergey Svishchev <svs at ropnet.ru> that implements
-     spooling in migration jobs.  Not yet tested.
-kes  Merge patch from Jorj Bauer <jorj at seas.upenn.edu> that implements
-     reading conf file from a pipe.  However, do it with open_bpipe()
-     rather than popen.  Not yet tested.
-07May07 
-kes  Fix an ugly bug where the VolCatBytes were getting updated
-     during a restore.
-kes  Implement bconsole memory command that prints current memory
-     usage, plus smartalloc dump.
-kes  Clarify some error messages in backup, admin, and migrate.
-kes  Shrink label dialog to smaller size.
-kes  Invert Cancel OK buttons on restore to be OK Cancel.
-kes  More strerror() to bstrerror() conversions.
-06May07 
-kes  Start implementing bstrerror() in place of strerror().
-kes  Stripping path -- seems to work.
-04May07
-kes  Prevent door and port files from being restored (mostly
-     Solaris stuff).
-kes  Free an unreleased buffer in compat code.
-kes  Change console Job name from *Console* to -Console- to eliminate
-     Win32 filename problems.  Put Win32 path separator when creating
-     Console file.  This fixes bug #846.
-kes  Change berrno::strerror() to berrno::bstrerror().  Not yet full
-     implemented.
-kes  Pass jcr to crypt_sign_decode because it creates a new SIGNATURE
-     structure.
-kes  Define b_errno_win32 on Linux to be zero so that it can be or'ed in
-     to force Win32 error message.
-03May07
-kes  First cut strip path. The data should be passed to the FD,
-     but nothing is done with it yet.
-kes  Enhance the digest and signature routines in the crypto
-     library to accept a JCR and to use it to print error messages
-     so that they will go in the Job report rather than the daemon's
-     messages.
-kes  Simplify some of the verify signature code.
-kes  Simplify a few of the alternative returns in the signature 
-     code.
-02May07
-ebl  Use only POSIX regex instead of GNU regex in breg.c for
-     File relocation. It fix broken freebsd compilation.
-kes  Convert all other Dir files to use new ua class message 
-     routines for bat.
-kes  Tentative fix for missing digest signature in bug 807.
-kes  Correct handle problem in new win32_ftruncate routine.
-kes  Convert ua_purge.c and ua_update.c to use new ua class
-     message routines for bat.
-29Apr07 
-kes  Correct incorrect installation of LICENSE in Win32 installer.
-kes  Display LICENSE at the beginning of the Win32 install.
-kes  Attempt to correct the need for the png files to be installed 
-     for bat.
-kes  Reapply my bat.conf install script in qt-console. I think I 
-     editted bat.pro instead of bat.pro.in and it was lost.
-kes  Apply CentOS patches someone sent me. Checks for /var/run/subsys,
-     the /var/lock/subsys for subsysdir.  Also corrects typos in the
-     doc.
-28Apr07
-kes  First cut update job.
-kes  Correct configure to include qmake of src/qt-console directory.
-26Apr07
-kes  Make restore job yes/mod/no print in one command so GUI works.
-kes  First cut implementing backup and restore client.
-kes  Correct editing in Verify output that caused a seg fault.
-25Apr07
-kes  Insure that bat.conf is not overwritten during installation.
-kes  Fix important bug in db_sql_query() in mysql.c.  It was introduced
-     while I was implementing migration in March 2006 !
-24Apr07
-ebl  Cleanup file relocation, using char *RegexWhere instead of
-     char *where + bool where_use_regexp
-kes  Update some manpages and add bat manpage.
-kes  Make a first cut at converting bacula.spec.in for bwx-console
-     and bgnome-console.
-kes  Apply patch from John Goerzen to add hostname as fourth argument
-     to make_catalog_backup script.
-kes  Fix typos I introduced into bsmtp.c
-kes  Make pm_strxxx() routines handle input of NULL pointer. This
-     is to protect from NULL pointers returned from SQL databases.
-kes  Correct typo in bacula-sd manpage as pointed out by John Goerzen.
-kes  Add more debug to FIFO code -- fix fifo regression test.
-23Apr07
-kes  Implement posix_fadvise in FD, and for reading spool files in SD.
-kes  Add thread timer to bnet_connect() to break from OS if wait time
-     expires.
-22Apr07
-kes  Update Win32 build to include new files, new symbols, and    
-     renamed files.
-kes  Implement socket level heartbeat (tcp_keepidle)
-ebl  Commit File relocation patch
-kes  Make bat have 'make install' target.
-kes  Warn during install if old gnome-console binary found.
-kes  Warn during install if old wx-console binary found.
-kes  Add -8 option to bsmtp command line to add content type utf-8. 
-     Fixes bug #809. (Character coding problem in bsmtp).
-kes  If < is found in target (from, to, cc) then do not enclose the
-     target in < >  in bsmtp. Fixes bug #772  (malformed address).
-kes  When printing certain items in dbcheck, stop after 300000.
-     Fixes bug #822. (dbcheck loops).
-kes  Incorrect status in Dir after waiting for mount with poll set.
-     Fixes bug #825.
-21Apr07 
-kes  Extend idea of Prefer Mounted Volumes to mean a volume about
-     to be mounted.
-kes  Print waiting to reserve a device every 5 mins.           
-20Apr07
-kes  Don't call close_part in label.c if tape and relabel.
-kes  Don't free volume if busy in close() -- should help with
-     bug 801.
-ebl  Fix #824 RunScript bug (After script could be execute twice)
-     Now, Before Script can use RunsOnSuccess and RunsOnFailure options
-     By default (like before) RunsOnSuccess=true and RunsOnFailure=false
-     Add a regression script to test RunScript
-19Apr07
-kes  Correct usage of MTIOCLRERR ioctl for clearing persistant errors
-     on Solaris.
-18Apr07
-kes  The bgnome-console (gnome-console) and bwx-console (wx-console) are
-     deprecated. No additional bugs will be fixed, and they will be dropped
-     in a future release (probably 2.4.0).
-kes  Change name of wx-console to bwx-console to make it more Bacula
-     unique.
-kes  Change the name of gnome-console to bgnome-console to make it
-     more Bacula unique.
-14Apr07
-kes  Some time in March, a Feature Request with patch from Jorj Bauer
-     <jorj at seas.upenn.edu> was committed by Landon (with my approval).
-     It implements:
-     The ability for the director to validate a Client (FD) CN against
-     an arbitrary set of patterns rather than the hostname, with
-     A new 'TLS Allowed CN' set of directives which are implemented
-     in the Client resource.  Then pattern matching is used in place
-     of hostname matching against the Certificate's CN. As an example, we
-     have certificates which (a) use a local CA, and (b) have a CN of the
-     form client_123.
-kes  Add new/changed entry points to Win32 build
-kes  Create unaccepted-projects for projects that are not accepted.
-kes  Simplify locking in the reservations system.
-kes  Add more debug code in reservations.
-kes  Make sure error condition on reserving a volume is handled correctly.
-kes  Correct handling of volume_in_use.
-kes  Correct handling of initializing a device.
-kes  Move handling of broadcasting releasing a device into release_device().
-kes  Correct attaching dcr to dev so that it is only done if device
-     is properly initiated.
-12Apr07
-kes  Locking debug level tweaks in SD.
-kes  Tweak new Volume code.
-11Apr07
-kes  Add exec external-command [wait-seconds] to bconsole. This
-     executes the external-command.  Note! normally external-command
-     should be enclosed in double quotes.
-kes  Turn the .die command on only if DEVELOPER is defined -- i.e.
-     it should normally be off in a production system.
-10Apr07
-kes  Implement die command for SD so that we can force it to dump.
-kes  Implement SD lock debug code.
-kes  Implement new algorithm for keeping Volume list in SD.  It
-     is now owned by the device.
-04Apr07
-kes  Implement new code for freeing in use volumes that should 
-     resolve if not all, some of the problems of multiple drive
-     tape conflicts described in bug 801.
-03Apr07
-kes  Fix gui/bacula-web/images files in svn.
-kes  Turn on FreeBSD/OpenBSD code to set EOT model on tape.
-02Apr07
-ebl  Fix a bug in batch mode (in string escape)
-kes  Correct migration prune SQL typo that crept in in a    
-     recent 2.1.x change.
-01Apr07
-kes  Move bnet_despool() into class in bsock.c
-kes  Modify job report to include director name and Build OS.
-kes  Move drop root privilege and check_catalog() before fork.
-kes  Add update database scripts (version 9 to 10) to updatedb directory.
-31Mar07
-ebl  Check size and age of each file after its backup to see if
-     it has changed during backup, if 'checkfilechanges' is set.
-     The FD will do an extra check (stat(2)) after
-     each file backup. mtime, ctime and size are compared with
-     'before backup' information. If time or size mismatch, an
-     error message will be generated. You must upgrade FD to use it.
-30Mar07
-kes  Make database name and user configurable
-     --with-db-name=xxx --with-db-user=xxx
-kes  Add back database type to message.c for debugging.
-29Mar07
-kes  Implement dir_sql() which issues an SQL query.
-kes  Modify bat medialist to use dir_sql() and do some minor C++
-     formatting as well as eliminating a number of pointers, simplifing
-     the code.
-28Mar07
-kes  Fix some of the mtx-changer grep commands for tape label readers.
-kes  Convert a number of bsendmsg into the appropriate send/warning/error
-     message class calls.
-kes  Suppress the using database message in the .sql command.
-kes  Correct an incorrect bnet_tls_client prototype -- patch from Martin.
-27Mar07
-kes  Add context menu for floating a window.
-kes  Some minor cleanup and name changes in qt-console
-kes  Add doing mt setblk 0 in Win32 mtx-changer.
-kes  Apply Martin's bug fix to move definition of ENODATA for 
-     FreeBSD to bsock.c
-ebl  Add a BUSY handler to sqlite to be able to use multi_db = 1 with
-     sqlite2 and sqlite3.
-26Mar07
-kes  More pruning cleanup.
-kes  Turn on wait_for_drive by default in mtx-changer.
-kes  Turn on Batch insert code by default as it now passes regression.
-kes  Add ./configure --enable-bat to enable building of Bat.   
-     No install yet though.
-25Mar07
-kes  Implement a new .sql command for bat.
-kes  Implement code to turn off pruning in obtaining the next volume.
-     Pruning is turned off for the status dir command, but turned on
-     for SD requests and for the list nextvolume command.
-24Mar07
-kes  Correct Qmsg() that was not updated correctly when committing a
-     previous change (probably the recent TLS patch).
-23Mar07
-kes  Write new subroutine is_volume_purged() that explicitly checks
-     if the Volume is purged, and if so marks it as such. This should
-     resolve problems reported about needing to mount twice to recycle
-     volumes.
-kes  Rewrite pruning algorithm to do more work in the SQL engine, and
-     to pass a list of JobIds to be deleted to SQL.  Also, minimize the
-     amount of duplicated code.     
-kes  Do volume pruning only for the Media Type desired (reduces pruning time
-     if multiple Media Types are in the same pool).
-kes  Implement more detailed info in the Job report for the Bacula version
-     and architecture.
-kes  Switch from POOLMEM to POOL_MEM (a real class) in ua_prune.c and
-     ua_purge.c.
-ebl  Add bbatch tool to bench database and insert mode.
-     Fix sql quote stuff in batch mode
-     Fix sql stuff for mysql
-22Mar07
-kes  Correct problems with am/pm scheduling. Fixes bug #808.
-kes  Implement new prunning code that prunes up to 1000 jobs at
-     the same time.  The same technique can be applied to a number
-     of other prune/purge subroutines.
-kes  Add an insanity check when starting a new tape job to ensure
-     that the tape position has not been changed. If so fail the
-     job.
-kes  Fix Win32 build for dlls to add the folllowing:
-     src/lib/bsock.c -- new file with new entry points
-     src/lib/dlist.c  -- new entry points
-     src/cats/sql_create.c -- new entry point
-     src/cats/sql_cmds.c -- new DATA item exported
-21Mar07
-ebl  batch mode cleanup bscan-test is ok now.
-kes  Implement SD code to check length of disk volume before appending.
-18Mar07
-kes  Correct return status on db_batch... routines.
-kes  Add call to db_write_batch_file_records() to migration code.
-ebl  Fix AfterJob timing
-kes  Move the checking of the database in initializion of the Director
-     to after we drop privileges.  This avoids the need for both root
-     and bacula access to the DB.
-kes  Correct a misplaced variable definition in src/filed/backup.c
-kes  Correct how the new batch insert db_create_attributes_record()
-     uses the arguments.  Caused a seg fault in bscan.
-kes  Implement lock() and unlock() methods in DEVICE class.
-     Implement block() and set_block(xx) methods in DEVICE class.
-kes  Modify bnet_connect() so that it uses time() to check for the
-     wait time expiring (on some OSes, some system calls may not
-     return immediately).
-kes  Modify Verify to obtain the previous JobId when it is actually
-     running rather than at schedule time (as it was in 1.38.x).     
-kes  Fix src/job.c to handle MaxWaitTime correctly.  This should
-     fix bug #802.
-kes  When checking pid in pid file, continue running if the pid is
-     the same as ours. This occurs on IRIX after a system crash.
-     Fixes bug #797.
-10Mar07
-kes  Extend new GUI API.
-kes  Make the ua structure a class, and implement send_msg(),
-     error_msg(), warning_msg(), and info_msg().
-08Mar07
-kes  Apply fix from for building wx-console on the Mac from
-     bug #798.
-kes  Implement new select mechanism for GUI programs.
-kes  Reorganize initialization of stackedWidgets in bat.
-07Mar07
-kes  Add updated nagios plugin supplied by Christian Masopust.
-05Mar07
-kes  More bat implementation.
-kes  File migrate bug with Pool Occupancy using mediaid instead
-     of jobids.  Fixes bug #795.
-kes  Fix orphaned buffers in filed backup and verify due to
-     crypto buffers not freed during errors.  Fixes bug #789.
-kes  Extend new GUI api code to tree commands.
-kes  Ensure that tree and dot commands check console ACLs.
-kes  Permit marking directory with trailing slash.
-kes  Allow 20 console connections (instead of only 10).
-04Mar07
-kes  Add smartctl call to bacula-sd.conf as an example of getting
-     tape alert info.
-02Mar07
-kes  Modify jobq.c to let simultaneous restore jobs run. This may 
-     cause them to fail if they cannot get a drive.
-kes  Add Client Connect Wait to Storage daemon to permit users to
-     modify the time the SD waits for a FD connection.
-29Feb07
-kes  Correct virtual changer check which was backwards. This caused
-     volumes to be unloaded into slots already occupied.
-28Feb07
-kes  Apply Command ACL filter to JobId list in restore command.
-kes  Correct typeo in var.c patch.
-27Feb07
-kes  Don't let Bacula prune File or Job records for the current Job.
-kes  Fix variable substitution pad + inc bug reported (with patch)
-     in bug #791.
-26Feb07
-kes  Correct SQLite log table index as reported by Luca Berra.
-24Feb07
-ebl  fix fifo stuff, bacula tries to rewind the fifo... Thanks to Andreas
-22Feb07
-kes  Begin implementing new comm signals for API.
-kes  Fix a few places in lib/message.c where the open fd may 
-     not be zeroed.
-kes  Continue implementing lib/bsock.c (real class).  Make jcr,
-     who, host, and port private. There are new methods to access
-     them for non-class use. This required touching a number of files.
-21Feb07
-kes  Add LANG=C to autoconf/randpass so it works with languages other
-     than English.  Fixes bug #788.
-20Feb07
-ebl  Revert ClientRunBeforeJob to old position as in 1.38.X.
-     This fixes bug #780
-     You will not be able to generate Include/Exclude list any more.
-     It will be fixed soon.
-     If you want to use this, you can apply
-     trunk/bacula/patches/testing/clientrunbeforejob_can_generate_include_exclude_list.patch
-19Feb07
-kes  Restore of sockets created false error messages because Bacula
-     no longer restores sockets, but the code was still trying to
-     set the attributes on a non-existent file. Reported by a user.
-ebl  finish RecyclePool feature
-     Media will takes Pool.RecyclePool
-     when moving from Scratch to a Pool or when user will do
-     update volume=xxx frompool
-     To use it, add RecyclePool = aPool to your Pool resource
-        Pool {
-                Name = Default
-                RecyclePool = Scratch
-                ...
-        }
-     TODO: update manual
-kes  Expand new BSOCK class adding signal() and new BNET signals.
-kes  Begin enhancing the dot commands adding a new API function
-     that returns more information and will make it easier
-     to interface to the Director from a program.
-18Feb07
-kes  Make DEVICE fd private. Its new name is m_fd, and can be
-     obtained with dev->fd() outside the class.  This is the
-     first of many DEVICE members to be made private.
-kes  Implement Michael Renner's idea on having a virtual disk
-     changer. I made some minor modifications (e.g. I did not
-     implement the Virtual Changer directive, but simply set
-     the Changer Command to an empty string.
-17Feb07
-kes  Implement a BSOCK send() method that writes the whole record
-     in a single write() request rather than in two.
-ebl  add update volume=xxx recyclepool=yyyy
-     volume takes recyclepool from pool when using update volume=xxx from pool
-16Feb07
-kes  Fix encryption deblocking bug, which caused some restored files
-     to be truncated. This fixes bug #763.
-kes  Add FD event sequence order prepared by Eric -- for RunScripts.
-kes  Fix 12am/pm bug as reported in bug #782 -- scheduler problem.
-13Feb07
-kes  Apply Eric's ClientRunScriptAfter patch to 2.0 and 2.1.
-ebl  Use btime_t instead of uint64_t in media patch.
-11Feb07
-kes  Optimize the use of the database a bit in the Status dir command.
-     Only open it when needed, ensure that if any previous database
-     was opened, it is closed.
-10Feb07
-kes  Correct VolCatBytes bug from media patch.
-kes  Apply patch from bug #612 by Rudolf Cejka to speedup pruning
-     in the case of orphaned records.
-kes  Modify dbcheck to handle orphaned JobMedia, Path, Filename,
-     and File records in 300K chunks to be more efficient. This
-     idea came from Juan Luis Frances (if I remember right).
-kes  Apply Eric's scratch patch that moves a purged Volume to
-     the RecyclePool.  Question: how is RecyclePool set? what
-     happens to the ScratchPool?
-kes  Apply Eric's media patch that collects read/write media
-     times as well as byte counts.  This patch requires a
-     simultaneous upgrade of the DIR and SD.  Note, there
-     should be some way to turn off timing. I'm not sure
-     times are in Bacula units.
-kes  Apply Eric's batch-insert patch.
-09Feb07
-kes  Update projects list.
-08Feb07
-kes  Implement Include/Exclude file lists in FD as dlists using
-     the new dlistString class. This permits efficiently having
-     large include/exclude lists and completes project Item 25.
-kes  Fix dird/ua_cmds.c so that a cancel command checks if the
-     console is authorized to cancel the job.  This fixes bug 
-     #767.
-kes  Modify SD so that the VolCatJobs medium record is updated
-     at the beginning of a Job rather than the end.  This
-     fixes bug #775 where exceeding MaxVolJobs caused jobs
-     to fail.
-kes  Added a mutex around getting and setting Volume information
-     so that multiple simultaneous jobs will single thread.
-07Feb07
-     Switch to using Subversion
-kes  Remove src/pygtk-console/ from configure
-06Feb07
-kes  Delete src/lib/btree.c from win32 build, then add rblist.c
-     plus the entrypoints.
-kes  Apply patch supplied that corrects debug print
-     in canceling jobs for max run time.  Supplied as
-     part of bug #621, which was previously fixed.
-05Feb07
-kes  Test on job_canceled() and sd_msg_thread_done inside
-     loop starting the message thread to avoid a race condition.
-     Fixes bug #771.
-kes  Remove rl_catch_signal from console.c as it conflicted
-     with the header definition. Fixes bug #765.
-ebl  Fixes bug #766 about RunsOnClient = Yes (case sensitive)
-04Feb07
-kes  Clarify some stored/acquire messages to indicate if the
-     problem is with read or append.
-02Feb07
-kes  Fix memory leak with storage ids in cats/sql_get.c
-kes  Terminate watchdog earlier to avoid reference to released
-     memory -- reported by Jason Austin.
-kes  Move closing the database from jobq.c to the director daemon
-     termination routine. This fixes memory leaks for shadow jobs
-     (i.e. migration jobs).
-kes  Free up the unique jobid chain items in migrate.c.  This fixes
-     a memory leak problem.
-kes  Convert some ugly looking for statements to use foreach_alist
-     in findlib/find.c.  This will facilitate converting the structures
-     to use dlist (for large include/exclude lists).
-kes  Fix a bug in the btree.c and btree.h routines, then rename them
-     rblist and add them to be built in src/lib.  Include some new
-     methods written by Rudolf Cejka that make the code more readable
-     (hides some of the ugly casting).
-kes  Add set_next() and set_prev() methods which make the code much more 
-     readable. Also add a new dlistString class that facilitates storing
-     strings in dlists.  To be used in the large include/exclude lists.
-kes  Make some trivial modifications to lib/tree.h that use rblist
-     rather than dlist for storing the tree links. This was suggested
-     by Rudolf Cejka.  The result of this is that the restore tree now
-     uses red-black binary trees rather than simple linked lists. This
-     should give rather dramatic speed improvements for directories
-     contining large numbers of directories/files (more than 10000).
-28Jan07 
-kes  Fix maxruntime bug #621.
-26Jan07
-ebl  Implement the include JobID in spool file name project.
-kes  Reorder projects file in order determined by Jan 2007 vote.
-kes  Implement item #12 on project list -- quick release of FD by
-     the SD.
-kes  Fix open of SQLite3 db where user does not have write permission
-     so that DIR does not crash. Fixes bug #761.
-25Jan07
-kes  Add back missing @ in Win32 Makefile.
-kes  Change 'Device not configured to autolabel' from INFO
-     to WARNING.
-kes  Fix jobq.c to restart failed jobs when Reschedule Times = 0 
-     which should restart an indefinite # of times.
-kes  Fix configure --help to print --with-mysql[=DIR]. Same for
-     other DIR specifications.
-23Jan07
-rn   Fix msvc build problems. Fix bacula.dll exports for msvc build.
-     Fix path quoting in SQLite scripts.
-     Fix problems with SHGetFolderPath.
-19Jan07
-kes  Create patches/2.0.1-restart.patch. Fixes bug #755.
-18Jan07
-kes  Fix Job restart on error bug that promotes an Inc to a Full
-     backup.  This should fix bug #755.
-kes  Add qt-console and first cut of code.
-
-Version 2.0.1
-12Jan07
-kes  Fix Bacula->Documentation link on Win32 to point to index.html
-     instead of bacula.html. Fixed bug #750.
-kes  Return JobId in db_get_job_record() when JobId==0. This should
-     fix bug #741.
-kes  Do not release source pointers when restarting a failed job.
-11Jan07
-kes  Add dynamic dll entry point for SHGetFolderPath to Win32 code.
-     This *should* fix bug #747.
-kes  Modify winbacula.nsi to substitute with g bin_dir_cmd. Should fix
-     bug #742.
-09Jan07
-kes  Modify USTORE constructor to set an empty store_source string, 
-     and don't copy the store_source string in a cancel.  Hopefully
-     this will fix Arno's seg fault, bug #744.
-kes  Add back code to disable conio in configure. Fixes bug #743.
-kes  Correct the Options scanner in the FD to correctly handle  
-     SHA1 option, which was eating the next option.  Reported by    
-     Sebastien Guilbaud.
-kes  Add code to indicate when the SD is spooling, spool wait, and 
-     despooling as requested by Alan Brown.
-
-Version 2.0.0 released: 4 January 2007
diff --git a/src/cats/update_bacula_tables.in b/updatedb/update_bacula_tables.in
similarity index 50%
copy from src/cats/update_bacula_tables.in
copy to updatedb/update_bacula_tables.in
index 334b391..1249077 100755
--- a/src/cats/update_bacula_tables.in
+++ b/updatedb/update_bacula_tables.in
@@ -1,23 +1,14 @@
 #!/bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # This routine alters the appropriately configured
 # Bacula tables for PostgreSQL, Ingres, MySQL, or SQLite.
 #
-#
-#  Bacula® - The Network Backup Solution
-#
-#  Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
-#
-#  The main author of Bacula is Kern Sibbald, with contributions from many
-#  others, a complete list can be found in the file AUTHORS.
-#
-#  You may use this file and others of this release according to the
-#  license defined in the LICENSE file, which includes the Affero General
-#  Public License, v3.0 ("AGPLv3") and some additional permissions and
-#  terms pursuant to its AGPLv3 Section 7.
-#
-#  Bacula® is a registered trademark of Kern Sibbald.
-#
+
+# can be used to change the current user with su
+pre_command="sh -c"
 
 default_db_type=@DEFAULT_DB_TYPE@
 
@@ -39,10 +30,6 @@ if [ $# -gt 0 ]; then
        db_type=$1
        shift
        ;;
-     ingres)
-       db_type=$1
-       shift
-       ;;
      *)
        ;;
    esac
@@ -55,5 +42,9 @@ if [ -z "${db_type}" ]; then
    db_type="${default_db_type}"
 fi
 
+if [ $db_type = postgresql -a "$UID" = 0 ]; then
+    pre_command="su - postgres -c"
+fi
+
 echo "Altering ${db_type} tables"
- at scriptdir@/update_${db_type}_tables $*
+$pre_command "@scriptdir@/update_${db_type}_tables $*"
diff --git a/updatedb/update_bdb_tables_8_to_9 b/updatedb/update_bdb_tables_8_to_9
deleted file mode 100755
index 833f9d9..0000000
--- a/updatedb/update_bdb_tables_8_to_9
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-#
-# Shell script to update bdb tables
-# Nothing to do here.
-#
-echo " "
-bindir=/usr/bin
-
-exit 0
diff --git a/updatedb/update_mysql_tables.in b/updatedb/update_mysql_tables.in
new file mode 100644
index 0000000..a800011
--- /dev/null
+++ b/updatedb/update_mysql_tables.in
@@ -0,0 +1,149 @@
+#!/bin/sh
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+# Shell script to update MySQL tables from Bacula Community version 
+#  5.0.x, 5.2.x, 7.0.x
+#
+echo " "
+echo "This script will update a Bacula MySQL database from version 12-14 to 15"
+echo " "
+echo "Depending on the current version of your catalog, you may have to run this script"
+echo "	multiple times"
+echo " "
+
+bindir=@MYSQL_BINDIR@
+PATH="$bindir:$PATH"
+db_name=@db_name@
+
+ARGS=$*
+
+getVersion()
+{
+    mysql $ARGS -D ${db_name} -e "select VersionId from Version LIMIT 1\G" >/tmp/$$
+    DBVERSION=`sed -n -e 's/^VersionId: \(.*\)$/\1/p' /tmp/$$`
+}
+
+getVersion
+
+if [ "x$DBVERSION" = x ]; then
+    echo
+    echo "Unable to detect database version, you can specify connection information"
+    echo "on the command line."
+    echo "Error. Cannot upgrade this database."
+    exit 1
+fi
+
+if [ "$DBVERSION" -lt 12 -o "$DBVERSION" -gt 14 ] ; then
+    echo " "
+    echo "The existing database is version $DBVERSION !!"
+    echo "This script can only update an existing version 12-14 version 15."
+    echo "Error. Cannot upgrade this database."
+    echo " "
+    exit 1
+fi
+
+# For all versions, we need to create the Index on Media(StorageId)
+# It may fail, but it's not a big problem
+# mysql $* -f <<END-OF-DATA >/dev/null 2> /dev/null
+# CREATE INDEX media_storageid_idx ON Media (StorageId);
+# END-OF-DATA
+
+if [ "$DBVERSION" -eq 12 ] ; then
+    if mysql $* -f <<END-OF-DATA
+USE ${db_name};
+
+CREATE TABLE RestoreObject (
+   RestoreObjectId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
+   ObjectName BLOB NOT NULL,
+   RestoreObject LONGBLOB NOT NULL,
+   PluginName TINYBLOB NOT NULL,
+   ObjectLength INTEGER DEFAULT 0,
+   ObjectFullLength INTEGER DEFAULT 0,
+   ObjectIndex INTEGER DEFAULT 0,
+   ObjectType INTEGER DEFAULT 0,
+   FileIndex INTEGER UNSIGNED DEFAULT 0,
+   JobId INTEGER UNSIGNED NOT NULL REFERENCES Job,
+   ObjectCompression INTEGER DEFAULT 0,
+   PRIMARY KEY(RestoreObjectId),
+   INDEX (JobId)
+);
+
+CREATE INDEX jobhisto_jobid_idx ON JobHisto (JobId);
+UPDATE Version SET VersionId=13;
+
+END-OF-DATA
+    then
+	echo "Update of Bacula MySQL tables from 12 to 13 succeeded."
+	getVersion
+    else
+	echo "Update of Bacula MySQL tables from 12 to 13 failed."
+	exit 1
+    fi
+fi
+
+if [ "$DBVERSION" -eq 13 ] ; then
+    if mysql $* -f <<END-OF-DATA
+USE ${db_name};
+
+ALTER TABLE File ADD COLUMN DeltaSeq smallint default 0;
+UPDATE Version SET VersionId=14;
+
+END-OF-DATA
+    then
+	echo "Update of Bacula MySQL tables from 13 to 14 succeeded."
+	getVersion
+    else
+	echo "Update of Bacula MySQL tables from 13 to 14 failed."
+	exit 1
+    fi
+fi
+
+if [ "$DBVERSION" -eq 14 ] ; then
+    if mysql $* -f <<END-OF-DATA
+USE ${db_name};
+
+INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES
+   ('I', 'Incomplete Job',25);
+ALTER TABLE Media ADD COLUMN VolABytes BIGINT UNSIGNED DEFAULT 0;
+ALTER TABLE Media ADD COLUMN VolAPadding BIGINT UNSIGNED DEFAULT 0;
+ALTER TABLE Media ADD COLUMN VolHoleBytes BIGINT UNSIGNED DEFAULT 0;
+ALTER TABLE Media ADD COLUMN VolHoles INTEGER UNSIGNED DEFAULT 0;
+ALTER TABLE Media CHANGE VolWrites VolWrites BIGINT UNSIGNED;
+
+CREATE TABLE Snapshot (
+  SnapshotId	  INTEGER UNSIGNED AUTO_INCREMENT,
+  Name		  TINYBLOB NOT NULL,
+  JobId 	  INTEGER UNSIGNED DEFAULT 0,
+  FileSetId INTEGER UNSIGNED DEFAULT 0;
+  CreateTDate	  BIGINT   NOT NULL,
+  CreateDate	  DATETIME NOT NULL,
+  ClientId	  INTEGER DEFAULT 0,
+  Volume	  TINYBLOB NOT NULL,
+  Device	  TINYBLOB NOT NULL,
+  Type		  TINYBLOB NOT NULL,
+  Retention	  INTEGER DEFAULT 0,
+  Comment	  BLOB,
+  primary key (SnapshotId)
+);
+
+CREATE UNIQUE INDEX snapshot_idx ON Snapshot (Device(255), Volume(255), Name(255));
+
+CREATE INDEX jobtdate_idx on JobHisto (JobTDate);
+
+UPDATE Version SET VersionId=15;
+END-OF-DATA
+    then
+	echo "Update of Bacula MySQL tables from 14 to 15 succeeded."
+	getVersion
+    else
+	echo "Update of Bacula MySQL tables from 14 to 15 failed."
+	exit 1
+    fi
+fi
+
+
+END-OF-DATA
+
+exit 0
diff --git a/updatedb/update_mysql_tables_10_to_11.in b/updatedb/update_mysql_tables_10_to_11.in
index bfb6390..2d88322 100644
--- a/updatedb/update_mysql_tables_10_to_11.in
+++ b/updatedb/update_mysql_tables_10_to_11.in
@@ -1,5 +1,8 @@
 #!/bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # Shell script to update MySQL tables from version 2.0 to 3.0	
 #
 echo " "
@@ -10,7 +13,9 @@ bindir=@MYSQL_BINDIR@
 PATH="$bindir:$PATH"
 db_name=${db_name:- at db_name@}
 
-if mysql -D ${db_name} $* -f <<END-OF-DATA
+if mysql $* -f <<END-OF-DATA
+USE ${db_name};
+
 -- Fix bad index on Media table
 DROP INDEX inx8 ON Media;
 CREATE UNIQUE INDEX inx8 ON Media (VolumeName(128));
diff --git a/updatedb/update_mysql_tables_11_to_12.in b/updatedb/update_mysql_tables_11_to_12.in
index 1759d73..349839b 100644
--- a/updatedb/update_mysql_tables_11_to_12.in
+++ b/updatedb/update_mysql_tables_11_to_12.in
@@ -1,5 +1,8 @@
 #!/bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # Shell script to update MySQL Community version 3.0.x to 5.0.x
 #
 echo " "
@@ -10,7 +13,7 @@ bindir=@MYSQL_BINDIR@
 PATH="$bindir:$PATH"
 db_name=${db_name:- at db_name@}
 
-mysql -D ${db_name} $* -e "select VersionId from Version\G" >/tmp/$$
+mysql $* -D ${db_name} -e "select VersionId from Version\G" >/tmp/$$
 DBVERSION=`sed -n -e 's/^VersionId: \(.*\)$/\1/p' /tmp/$$`
 if [ $DBVERSION != 11 ] ; then
    echo " "
@@ -21,7 +24,9 @@ if [ $DBVERSION != 11 ] ; then
    exit 1
 fi
 
-if mysql -D ${db_name} $* -f <<END-OF-DATA
+if mysql $* -f <<END-OF-DATA
+USE ${db_name};
+
 ALTER TABLE JobMedia DROP Stripe ;
 ALTER TABLE JobMedia DROP Copy ;
 ALTER TABLE Job ADD COLUMN HasCache tinyint default 0 after HasBase;
diff --git a/updatedb/update_mysql_tables_12_to_14.in b/updatedb/update_mysql_tables_12_to_13.in
similarity index 74%
rename from updatedb/update_mysql_tables_12_to_14.in
rename to updatedb/update_mysql_tables_12_to_13.in
index f392c94..2590e3d 100644
--- a/updatedb/update_mysql_tables_12_to_14.in
+++ b/updatedb/update_mysql_tables_12_to_13.in
@@ -1,27 +1,31 @@
 #!/bin/sh
 #
-# Shell script to update MySQL Community version 5.0.x to 5.2.x
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+# Shell script to update MySQL
 #
 echo " "
-echo "This script will update a Bacula MySQL database from version 12 to 14"
-echo " which is needed to convert from Bacula Community version 5.0.x to 5.2.x"
+echo "This script will update a Bacula MySQL database from version 12 to 13"
+echo " which is needed to convert from Bacula"
 echo " "
 bindir=@MYSQL_BINDIR@
 PATH="$bindir:$PATH"
 db_name=${db_name:- at db_name@}
 
-mysql -D ${db_name} $* -e "select VersionId from Version\G" >/tmp/$$
+mysql $* -D ${db_name} -e "select VersionId from Version\G" >/tmp/$$
 DBVERSION=`sed -n -e 's/^VersionId: \(.*\)$/\1/p' /tmp/$$`
 if [ $DBVERSION != 12 ] ; then
    echo " "
    echo "The existing database is version $DBVERSION !!"
-   echo "This script can only update an existing version 12 database to version 14."
+   echo "This script can only update an existing version 12 database to version 13."
    echo "Error. Cannot upgrade this database."
    echo " "
    exit 1
 fi
 
-if mysql -D ${db_name} $* -f <<END-OF-DATA
+if mysql $* -f <<END-OF-DATA
+USE ${db_name};
 CREATE TABLE RestoreObject (
    RestoreObjectId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
    ObjectName BLOB NOT NULL,
@@ -39,12 +43,7 @@ CREATE TABLE RestoreObject (
 );
 
 CREATE INDEX jobhisto_jobid_idx ON JobHisto (JobId);
-
-ALTER TABLE File ADD COLUMN DeltaSeq smallint default 0;
-
-DELETE FROM Version;
-INSERT INTO Version (VersionId) VALUES (14);
-
+UPDATE Version SET VersionId=13;
 END-OF-DATA
 then
    echo "Update of Bacula MySQL tables succeeded."
diff --git a/updatedb/update_mysql_tables_13_to_14.in b/updatedb/update_mysql_tables_13_to_14.in
new file mode 100644
index 0000000..a51f171
--- /dev/null
+++ b/updatedb/update_mysql_tables_13_to_14.in
@@ -0,0 +1,37 @@
+#!/bin/sh
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+# Shell script to update MySQL
+#
+echo " "
+echo "This script will update a Bacula MySQL database from version 13 to 14"
+echo " which is needed to convert from Bacula"
+echo " "
+bindir=@MYSQL_BINDIR@
+PATH="$bindir:$PATH"
+db_name=${db_name:- at db_name@}
+
+mysql $* -D ${db_name} -e "select VersionId from Version\G" >/tmp/$$
+DBVERSION=`sed -n -e 's/^VersionId: \(.*\)$/\1/p' /tmp/$$`
+if [ $DBVERSION != 13 ] ; then
+   echo " "
+   echo "The existing database is version $DBVERSION !!"
+   echo "This script can only update an existing version 13 database to version 14."
+   echo "Error. Cannot upgrade this database."
+   echo " "
+   exit 1
+fi
+
+if mysql $* -f <<END-OF-DATA
+USE ${db_name};
+ALTER TABLE File ADD COLUMN DeltaSeq smallint default 0;
+UPDATE Version SET VersionId=14;
+END-OF-DATA
+then
+   echo "Update of Bacula MySQL tables succeeded."
+else
+   echo "Update of Bacula MySQL tables failed."
+fi
+exit 0
diff --git a/updatedb/update_mysql_tables_9_to_10.in b/updatedb/update_mysql_tables_9_to_10.in
index 3722819..4e0eec4 100644
--- a/updatedb/update_mysql_tables_9_to_10.in
+++ b/updatedb/update_mysql_tables_9_to_10.in
@@ -1,5 +1,8 @@
 #!/bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # Shell script to update MySQL tables from version 1.38 to 2.0	
 #
 echo " "
diff --git a/updatedb/update_postgresql_tables.in b/updatedb/update_postgresql_tables.in
new file mode 100644
index 0000000..6681046
--- /dev/null
+++ b/updatedb/update_postgresql_tables.in
@@ -0,0 +1,150 @@
+#!/bin/sh
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+# Shell script to update MySQL tables from Bacula Community version 
+#  5.0.x, 5.2.x, 7.0.x
+#
+echo " "
+echo "This script will update a Bacula MySQL database from version 12-14 to 15"
+echo " "
+echo "Depending on the current version of your catalog, you may have to run this script"
+echo "	multiple times"
+echo " "
+
+bindir=@POSTGRESQL_BINDIR@
+PATH="$bindir:$PATH"
+db_name=@db_name@
+
+ARGS=$*
+
+getVersion()
+{
+    DBVERSION=`psql -d ${db_name} -t --pset format=unaligned -c "select VersionId from Version LIMIT 1" $ARGS`
+}
+
+getVersion
+
+if [ "x$DBVERSION" = x ]; then
+    echo
+    echo "Unable to detect database version, you can specify connection information"
+    echo "on the command line."
+    echo "Error. Cannot upgrade this database."
+    exit 1
+fi
+
+if [ "$DBVERSION" -lt 12 -o "$DBVERSION" -gt 14 ] ; then
+    echo " "
+    echo "The existing database is version $DBVERSION !!"
+    echo "This script can only update an existing version 12-14, 1014-1016 database to version 1017."
+    echo "Error. Cannot upgrade this database."
+    echo " "
+    exit 1
+fi
+
+if [ "$DBVERSION" -eq 12 ] ; then
+    # from 5.0
+    if psql -f - -d ${db_name} $* <<END-OF-DATA
+BEGIN; -- Necessary for Bacula core
+CREATE TABLE RestoreObject (
+   RestoreObjectId SERIAL NOT NULL,
+   ObjectName TEXT NOT NULL,
+   RestoreObject BYTEA NOT NULL,
+   PluginName TEXT NOT NULL,
+   ObjectLength INTEGER DEFAULT 0,
+   ObjectFullLength INTEGER DEFAULT 0,
+   ObjectIndex INTEGER DEFAULT 0,
+   ObjectType INTEGER DEFAULT 0,
+   FileIndex INTEGER DEFAULT 0,
+   JobId INTEGER,
+   ObjectCompression INTEGER DEFAULT 0,
+   PRIMARY KEY(RestoreObjectId)
+   );
+
+CREATE INDEX restore_jobid_idx on RestoreObject(JobId);
+UPDATE Version SET VersionId=12;
+
+COMMIT;
+END-OF-DATA
+    then
+	echo "Update of Bacula PostgreSQL tables 12 to 13 succeeded."
+	getVersion
+    else
+	echo "Update of Bacula PostgreSQL tables 12 to 13 failed."
+	exit 1
+    fi
+fi
+
+if [ "$DBVERSION" -eq 13 ] ; then
+    # from 4.0
+    if psql -f - -d ${db_name} $* <<END-OF-DATA
+BEGIN; -- Necessary for Bacula core
+
+ALTER TABLE File ADD COLUMN DeltaSeq smallint default 0;
+
+UPDATE Version SET VersionId=14;
+COMMIT;
+
+-- ANALYSE;
+
+END-OF-DATA
+    then
+	echo "Update of Bacula PostgreSQL tables from 13 to 14 succeeded."
+	getVersion
+    else
+	echo "Update of Bacula PostgreSQL tables failed."
+	exit 1
+    fi
+fi
+
+
+if [ "$DBVERSION" -eq 14 ] ; then
+    # from 5.2
+    if psql -f - -d ${db_name} $* <<END-OF-DATA
+INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES
+   ('I', 'Incomplete Job',25);
+ALTER TABLE Media ADD COLUMN volabytes bigint default 0;
+ALTER TABLE Media ADD COLUMN volapadding bigint default 0;
+ALTER TABLE Media ADD COLUMN volholebytes bigint default 0;
+ALTER TABLE Media ADD COLUMN volholes integer default 0;
+ALTER TABLE Media ALTER VolWrites TYPE BIGINT;
+
+CREATE TABLE Snapshot (
+  SnapshotId	  serial,
+  Name		  text not null,
+  JobId 	  integer default 0,
+  FileSetId	  integer default 0,
+  CreateTDate	  bigint default 0,
+  CreateDate	  timestamp without time zone not null,
+  ClientId	  int default 0,
+  Volume	  text not null,
+  Device	  text not null,
+  Type		  text not null,
+  Retention	  integer default 0,
+  Comment	  text,
+  primary key (SnapshotId)
+);
+
+CREATE UNIQUE INDEX snapshot_idx ON Snapshot (Device text_pattern_ops, 
+					      Volume text_pattern_ops, 
+					      Name text_pattern_ops);
+UPDATE Version SET VersionId=15;
+
+END-OF-DATA
+    then
+	echo "Update of Bacula PostgreSQL tables 14 to 15 succeeded."
+	getVersion
+    else
+	echo "Update of Bacula PostgreSQL tables 14 to 15 failed."
+	exit 1
+    fi
+fi
+
+# For all versions, we need to create the Index on Media(PoolId/StorageId)
+# It may fail, but it's not a big problem
+psql -f - -d ${db_name} $* <<END-OF-DATA
+set client_min_messages = fatal;
+CREATE INDEX media_poolid_idx on Media (PoolId);
+CREATE INDEX media_storageid_idx ON Media (StorageId);
+END-OF-DATA
diff --git a/updatedb/update_postgresql_tables_10_to_11.in b/updatedb/update_postgresql_tables_10_to_11.in
index 1be8033..8a30dbb 100644
--- a/updatedb/update_postgresql_tables_10_to_11.in
+++ b/updatedb/update_postgresql_tables_10_to_11.in
@@ -1,5 +1,8 @@
 #!/bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # Shell script to update PostgreSQL tables from version 2.0.0 to 3.0.0 or higher
 #
 echo " "
diff --git a/updatedb/update_postgresql_tables_11_to_12.in b/updatedb/update_postgresql_tables_11_to_12.in
index e15d817..4a6e982 100644
--- a/updatedb/update_postgresql_tables_11_to_12.in
+++ b/updatedb/update_postgresql_tables_11_to_12.in
@@ -1,5 +1,8 @@
 #!/bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # Shell script to update PostgreSQL tables from Bacula Community version 3.0.x to 5.0.0
 #
 echo " "
diff --git a/updatedb/update_postgresql_tables_12_to_14.in b/updatedb/update_postgresql_tables_12_to_13.in
similarity index 77%
rename from updatedb/update_postgresql_tables_12_to_14.in
rename to updatedb/update_postgresql_tables_12_to_13.in
index d737bcf..47e0809 100644
--- a/updatedb/update_postgresql_tables_12_to_14.in
+++ b/updatedb/update_postgresql_tables_12_to_13.in
@@ -1,22 +1,24 @@
 #!/bin/sh
 #
-# Shell script to update PostgreSQL tables from version 12 to 14
-#  or Bacula Community version 5.0.x to 5.2.x
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+# Shell script to update PostgreSQL tables from Bacula
 #
 echo " "
-echo "This script will update a Bacula PostgreSQL database from version 12 to 14"
-echo "	which is needed to convert from Bacula Community version 5.0.x to 5.2.x"
+echo "This script will update a Bacula PostgreSQL database from version 12 to 13"
+echo "	which is needed to convert from Bacula"
 echo " "
 
 bindir=@POSTGRESQL_BINDIR@
 PATH="$bindir:$PATH"
-db_name=@db_name@
+db_name=${db_name:- at db_name@}
 
 DBVERSION=`psql -d ${db_name} -t --pset format=unaligned -c "select VersionId from Version" $*`
 if [ $DBVERSION != 12 ] ; then
    echo " "
    echo "The existing database is version $DBVERSION !!"
-   echo "This script can only update an existing version 12 database to version 14."
+   echo "This script can only update an existing version 12 database to version 13."
    echo "Error. Cannot upgrade this database."
    echo " "
    exit 1
@@ -38,15 +40,10 @@ CREATE TABLE RestoreObject (
    ObjectCompression INTEGER DEFAULT 0,
    PRIMARY KEY(RestoreObjectId)
    );
-CREATE INDEX restore_jobid_idx on RestoreObject(JobId);
-
-ALTER TABLE File ADD COLUMN DeltaSeq smallint default 0;
 
-UPDATE Version SET VersionId=14;
+CREATE INDEX restore_jobid_idx on RestoreObject(JobId);
+UPDATE Version SET VersionId=13;
 COMMIT;
-
-ANALYSE;
-
 END-OF-DATA
 then
    echo "Update of Bacula PostgreSQL tables succeeded."
diff --git a/updatedb/update_postgresql_tables_13_to_14.in b/updatedb/update_postgresql_tables_13_to_14.in
new file mode 100644
index 0000000..1ffdc21
--- /dev/null
+++ b/updatedb/update_postgresql_tables_13_to_14.in
@@ -0,0 +1,38 @@
+#!/bin/sh
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+# Shell script to update PostgreSQL tables from Bacula
+#
+echo " "
+echo "This script will update a Bacula PostgreSQL database from version 13 to 14"
+echo "	which is needed to convert from Bacula"
+echo " "
+
+bindir=@POSTGRESQL_BINDIR@
+PATH="$bindir:$PATH"
+db_name=${db_name:- at db_name@}
+
+DBVERSION=`psql -d ${db_name} -t --pset format=unaligned -c "select VersionId from Version" $*`
+if [ $DBVERSION != 13 ] ; then
+   echo " "
+   echo "The existing database is version $DBVERSION !!"
+   echo "This script can only update an existing version 13 database to version 14."
+   echo "Error. Cannot upgrade this database."
+   echo " "
+   exit 1
+fi
+
+if psql -f - -d ${db_name} $* <<END-OF-DATA
+BEGIN; -- Necessary for Bacula core
+ALTER TABLE File ADD COLUMN DeltaSeq smallint default 0;
+UPDATE Version SET VersionId=14;
+COMMIT;
+END-OF-DATA
+then
+   echo "Update of Bacula PostgreSQL tables succeeded."
+else
+   echo "Update of Bacula PostgreSQL tables failed."
+fi
+exit 0
diff --git a/updatedb/update_postgresql_tables_9_to_10.in b/updatedb/update_postgresql_tables_9_to_10.in
index d620f29..1cea36b 100644
--- a/updatedb/update_postgresql_tables_9_to_10.in
+++ b/updatedb/update_postgresql_tables_9_to_10.in
@@ -1,5 +1,8 @@
 #!/bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # Shell script to update PostgreSQL tables from version 1.38 to 2.0.0 or higher
 #
 echo " "
diff --git a/updatedb/update_sqlite3_tables.in b/updatedb/update_sqlite3_tables.in
new file mode 100644
index 0000000..0f1f15a
--- /dev/null
+++ b/updatedb/update_sqlite3_tables.in
@@ -0,0 +1,112 @@
+#!/bin/sh
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+# Shell script to update MySQL tables from Bacula Community version 
+#  5.0.x, 5.2.x, 7.0.x
+#
+echo " "
+echo "This script will update a Bacula MySQL database from version 12-14 to 15"
+echo " "
+echo "Depending on the current version of your catalog, you may have to run this script"
+echo "	multiple times"
+echo " "
+
+bindir=@SQLITE_BINDIR@
+PATH="$bindir:$PATH"
+cd @working_dir@
+db_name=@db_name@
+
+DBVERSION=`sqlite3 ${db_name}.db <<END
+SELECT VersionId FROM Version LIMIT 1;
+END
+`
+if [ "$DBVERSION" -lt 12 -o "$DBVERSION" -gt 14 ] ; then
+    echo " "
+    echo "The existing database is version $DBVERSION !!"
+    echo "This script can only update an existing version 12, 13, 14 or 1014 database to version 1015."
+    echo "Error. Cannot upgrade this database."
+    echo " "
+    exit 1
+fi
+
+if [ "$DBVERSION" = 12 ] ; then
+sqlite3 $* ${db_name}.db <<END-OF-DATA
+BEGIN;
+
+CREATE TABLE RestoreObject (
+   RestoreObjectId INTEGER,
+   ObjectName TEXT DEFAULT '',
+   RestoreObject TEXT DEFAULT '',
+   PluginName TEXT DEFAULT '',
+   ObjectLength INTEGER DEFAULT 0,
+   ObjectFullLength INTEGER DEFAULT 0,
+   ObjectIndex INTEGER DEFAULT 0,
+   ObjectType INTEGER DEFAULT 0,
+   FileIndex INTEGER UNSIGNED DEFAULT 0,
+   ObjectCompression INTEGER DEFAULT 0,
+   JobId INTEGER UNSIGNED REFERENCES Job NOT NULL,
+   PRIMARY KEY(RestoreObjectId)
+   );
+CREATE INDEX restore_jobid_idx ON RestoreObject (JobId);
+
+UPDATE Version SET VersionId=13;
+COMMIT;
+
+END-OF-DATA
+DBVERSION=13
+fi
+
+if [ "$DBVERSION" = 13 ] ; then
+
+sqlite3 $* ${db_name}.db <<END-OF-DATA
+BEGIN;
+
+ALTER TABLE File ADD COLUMN DeltaSeq smallint default 0;
+UPDATE Version SET VersionId=14;
+
+COMMIT;
+
+END-OF-DATA
+
+DBVERSION=14
+
+fi
+
+if [ "$DBVERSION" = 14 ] ; then
+    sqlite3 $* ${db_name}.db  <<END-OF-DATA
+INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES
+   ('I', 'Incomplete Job',25);
+ALTER TABLE Media ADD COLUMN VolABytes BIGINT UNSIGNED DEFAULT 0;
+ALTER TABLE Media ADD COLUMN VolAPadding BIGINT UNSIGNED DEFAULT 0;
+ALTER TABLE Media ADD COLUMN VolHoleBytes BIGINT UNSIGNED DEFAULT 0;
+ALTER TABLE Media ADD COLUMN VolHoles INTEGER UNSIGNED DEFAULT 0;
+ALTER TABLE Media CHANGE VolWrites VolWrites BIGINT UNSIGNED;
+
+CREATE TABLE Snapshot (
+  SnapshotId	  INTEGER UNSIGNED AUTO_INCREMENT,
+  Name		  TINYBLOB NOT NULL,
+  JobId 	  INTEGER UNSIGNED DEFAULT 0,
+  FileSetId INTEGER UNSIGNED DEFAULT 0;
+  CreateTDate	  BIGINT   NOT NULL,
+  CreateDate	  DATETIME NOT NULL,
+  ClientId	  INTEGER DEFAULT 0,
+  Volume	  TINYBLOB NOT NULL,
+  Device	  TINYBLOB NOT NULL,
+  Type		  TINYBLOB NOT NULL,
+  Retention	  INTEGER DEFAULT 0,
+  Comment	  BLOB,
+  primary key (SnapshotId)
+);
+
+CREATE UNIQUE INDEX snapshot_idx ON Snapshot (Device(255), Volume(255), Name(255));
+
+CREATE INDEX jobtdate_idx on JobHisto (JobTDate);
+
+UPDATE Version SET VersionId=15;
+END-OF-DATA
+DBVERSION=15
+fi
+
+END-OF-DATA
diff --git a/updatedb/update_sqlite3_tables_10_to_11.in b/updatedb/update_sqlite3_tables_10_to_11.in
index 29f96eb..b67fb33 100644
--- a/updatedb/update_sqlite3_tables_10_to_11.in
+++ b/updatedb/update_sqlite3_tables_10_to_11.in
@@ -1,5 +1,8 @@
 #!/bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # shell script to update SQLite from version 2.0 to 3.0
 #
 echo " "
@@ -85,7 +88,7 @@ CREATE TABLE Pool (
    MaxVolBytes BIGINT UNSIGNED DEFAULT 0,
    AutoPrune TINYINT DEFAULT 0,
    Recycle TINYINT DEFAULT 0,
-   ActionOnPurge     TINYINT    DEFAULT 0,
+   ActionOnPurge     TINYINT	DEFAULT 0,
    PoolType VARCHAR(20) NOT NULL,
    LabelType TINYINT DEFAULT 0,
    LabelFormat VARCHAR(128) NOT NULL,
@@ -142,7 +145,7 @@ CREATE TABLE Media (
    VolStatus VARCHAR(20) NOT NULL,
    Enabled TINYINT DEFAULT 1,
    Recycle TINYINT DEFAULT 0,
-   ActionOnPurge     TINYINT    DEFAULT 0,
+   ActionOnPurge     TINYINT	DEFAULT 0,
    VolRetention BIGINT UNSIGNED DEFAULT 0,
    VolUseDuration BIGINT UNSIGNED DEFAULT 0,
    MaxVolJobs INTEGER UNSIGNED DEFAULT 0,
diff --git a/updatedb/update_sqlite3_tables_11_to_12.in b/updatedb/update_sqlite3_tables_11_to_12.in
index 632913b..6479a5b 100644
--- a/updatedb/update_sqlite3_tables_11_to_12.in
+++ b/updatedb/update_sqlite3_tables_11_to_12.in
@@ -1,5 +1,8 @@
 #!/bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # Shell script to update SQLite3 tables from Bacula Community version 3.0.x to 5.0.0
 #
 echo " "
diff --git a/updatedb/update_sqlite3_tables_12_to_14.in b/updatedb/update_sqlite3_tables_12_to_14.in
deleted file mode 100644
index 2d3cca5..0000000
--- a/updatedb/update_sqlite3_tables_12_to_14.in
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/bin/sh
-#
-# Shell script to update MySQL tables from Bacula Community version 5.0.x to 5.2.x
-#
-echo " "
-echo "This script will update a Bacula MySQL database from version 12 to 14"
-echo "	which is needed to convert from Bacula Community version 5.0.x to 5.2.x"
-echo " "
-
-bindir=@SQLITE_BINDIR@
-PATH="$bindir:$PATH"
-cd @working_dir@
-db_name=@db_name@
-
-DBVERSION=`sqlite3 ${db_name}.db <<END
-select VersionId from Version;
-END
-`
-if [ $DBVERSION != 12 ] ; then
-   echo " "
-   echo "The existing database is version $DBVERSION !!"
-   echo "This script can only update an existing version 12 database to version 14."
-   echo "Error. Cannot upgrade this database."
-   echo " "
-   exit 1
-fi
-
-sqlite3 $* ${db_name}.db <<END-OF-DATA
-BEGIN;
-
-CREATE TABLE RestoreObject (
-   RestoreObjectId INTEGER,
-   ObjectName TEXT DEFAULT '',
-   RestoreObject TEXT DEFAULT '',
-   PluginName TEXT DEFAULT '',
-   ObjectLength INTEGER DEFAULT 0,
-   ObjectFullLength INTEGER DEFAULT 0,
-   ObjectIndex INTEGER DEFAULT 0,
-   ObjectType INTEGER DEFAULT 0,
-   FileIndex INTEGER UNSIGNED DEFAULT 0,
-   ObejctCompression INTEGER DEFAULT 0,
-   JobId INTEGER UNSIGNED REFERENCES Job NOT NULL,
-   PRIMARY KEY(RestoreObjectId)
-   );
-CREATE INDEX restore_jobid_idx ON RestoreObject (JobId);
-
-ALTER TABLE File ADD COLUMN DeltaSeq smallint default 0;
-
-UPDATE Version SET VersionId=14;
-COMMIT;
-
-END-OF-DATA
diff --git a/updatedb/update_sqlite3_tables_9_to_10.in b/updatedb/update_sqlite3_tables_9_to_10.in
index cb813fd..f229382 100644
--- a/updatedb/update_sqlite3_tables_9_to_10.in
+++ b/updatedb/update_sqlite3_tables_9_to_10.in
@@ -1,5 +1,8 @@
 #!/bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # shell script to update SQLite from version 1.38 to 2.0
 #
 echo " "
diff --git a/updatedb/update_sqlite_tables_10_to_11.in b/updatedb/update_sqlite_tables_10_to_11.in
index ba14895..fcbabd3 100644
--- a/updatedb/update_sqlite_tables_10_to_11.in
+++ b/updatedb/update_sqlite_tables_10_to_11.in
@@ -1,5 +1,7 @@
 #!/bin/sh
 #
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
 # shell script to update SQLite from version 2.0 to 3.0
 #
 echo " "
@@ -82,7 +84,7 @@ CREATE TABLE Pool (
    MaxVolBytes BIGINT UNSIGNED DEFAULT 0,
    AutoPrune TINYINT DEFAULT 0,
    Recycle TINYINT DEFAULT 0,
-   ActionOnPurge     TINYINT    DEFAULT 0,
+   ActionOnPurge     TINYINT	DEFAULT 0,
    PoolType VARCHAR(20) NOT NULL,
    LabelType TINYINT DEFAULT 0,
    LabelFormat VARCHAR(128) NOT NULL,
@@ -139,7 +141,7 @@ CREATE TABLE Media (
    VolStatus VARCHAR(20) NOT NULL,
    Enabled TINYINT DEFAULT 1,
    Recycle TINYINT DEFAULT 0,
-   ActionOnPurge     TINYINT    DEFAULT 0,
+   ActionOnPurge     TINYINT	DEFAULT 0,
    VolRetention BIGINT UNSIGNED DEFAULT 0,
    VolUseDuration BIGINT UNSIGNED DEFAULT 0,
    MaxVolJobs INTEGER UNSIGNED DEFAULT 0,
diff --git a/updatedb/update_sqlite_tables_9_to_10.in b/updatedb/update_sqlite_tables_9_to_10.in
index cb813fd..245f077 100644
--- a/updatedb/update_sqlite_tables_9_to_10.in
+++ b/updatedb/update_sqlite_tables_9_to_10.in
@@ -1,5 +1,9 @@
 #!/bin/sh
 #
+# Author: Eric Bollengier, 2009
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # shell script to update SQLite from version 1.38 to 2.0
 #
 echo " "

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-bacula/bacula.git



More information about the pkg-bacula-commits mailing list