From 579e741615cf2747f8b883bc3275671c06b9885f Mon Sep 17 00:00:00 2001 From: Philipp Storz Date: Tue, 6 Dec 2016 14:33:40 +0100 Subject: [PATCH 01/10] Fix coverity error 1386593: printf_arg_mismatch As "my_timezone" is of type "long int", we should use "labs" instead of "abs" which will then also match the %ld formatstring. --- src/tools/bsmtp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/bsmtp.c b/src/tools/bsmtp.c index fa9d992b27f..83ef7d5054d 100644 --- a/src/tools/bsmtp.c +++ b/src/tools/bsmtp.c @@ -242,7 +242,7 @@ static void get_date_string(char *buf, int buf_len) my_timezone = tz_offset(now, tm); strftime(buf, buf_len, "%a, %d %b %Y %H:%M:%S", &tm); - snprintf(tzbuf, sizeof(tzbuf), " %+2.2ld%2.2ld", -my_timezone / 60, abs(my_timezone) % 60); + snprintf(tzbuf, sizeof(tzbuf), " %+2.2ld%2.2ld", -my_timezone / 60, labs(my_timezone) % 60); strcat(buf, tzbuf); /* add +0100 */ strftime(tzbuf, sizeof(tzbuf), " (%Z)", &tm); strcat(buf, tzbuf); /* add (CEST) */ From fc8bbe7d46c512a2a07f12518cb23e7a59b8e1e4 Mon Sep 17 00:00:00 2001 From: Joerg Steffens Date: Mon, 12 Dec 2016 19:01:44 +0100 Subject: [PATCH 02/10] Fix some compile issues Fixes some problems that did occur when trying to compile Bareos for Solaris. --- autoconf/bareos/os.m4 | 2 +- autoconf/configure.in | 4 ++-- debian/univention-bareos.preinst | 2 +- scripts/git-info.sh | 2 +- src/dird/ua.h | 2 +- src/plugins/filed/Makefile.in | 6 ++++-- src/stored/backends/Makefile.in | 10 +++++----- 7 files changed, 15 insertions(+), 13 deletions(-) diff --git a/autoconf/bareos/os.m4 b/autoconf/bareos/os.m4 index 48b6a59c627..8f8e4c871a2 100644 --- a/autoconf/bareos/os.m4 +++ b/autoconf/bareos/os.m4 @@ -342,7 +342,7 @@ if test "x$OBS_DISTRIBUTION" != "x" then echo "obsdistname set to $OBS_DISTRIBUTION" else - if test -e /.build.log; then + if test -f /.build.log; then OBS_PROJECT=`grep 'Building bareos for project' /.build.log | cut -d' ' -f10 | sed "s#'##g"` OBS_DISTRIBUTION=`grep 'Building bareos for project' /.build.log | cut -d' ' -f12 | sed "s#'##g"` OBS_ARCH=`grep 'Building bareos for project' /.build.log | cut -d' ' -f14 | sed "s#'##g"` diff --git a/autoconf/configure.in b/autoconf/configure.in index b4f8b0f7bda..e48f550fdb7 100644 --- a/autoconf/configure.in +++ b/autoconf/configure.in @@ -947,7 +947,7 @@ AC_ARG_WITH(python, PYTHON_LIBS= if test "$withval" != "no"; then if test "$withval" = "yes"; then - if test -e /usr/bin/python-config ; then + if test -f /usr/bin/python-config ; then PYTHON_INC=`/usr/bin/python-config --includes` PYTHON_LIBS=`/usr/bin/python-config --libs` else @@ -980,7 +980,7 @@ AC_ARG_WITH(python, fi fi else - if test -e $withval/bin/python-config ; then + if test -f $withval/bin/python-config ; then PYTHON_INC=`$withval/bin/python-config --includes` PYTHON_LIBS=`$withval/bin/python-config --libs` elif test -f $withval/Python.h; then diff --git a/debian/univention-bareos.preinst b/debian/univention-bareos.preinst index b3591538421..462367cea73 100644 --- a/debian/univention-bareos.preinst +++ b/debian/univention-bareos.preinst @@ -1,7 +1,7 @@ #!/bin/sh if [ "$1" = "install" ]; then - test -e /usr/lib/univention-install/63univention-bareos-uninstall.uinst && rm /usr/lib/univention-install/63univention-bareos-uninstall.uinst + test -f /usr/lib/univention-install/63univention-bareos-uninstall.uinst && rm /usr/lib/univention-install/63univention-bareos-uninstall.uinst fi # dh_installdeb will replace this with shell code automatically diff --git a/scripts/git-info.sh b/scripts/git-info.sh index 2b6117fdb30..318acf719a2 100755 --- a/scripts/git-info.sh +++ b/scripts/git-info.sh @@ -25,7 +25,7 @@ git_branch_info() TRACKING_BRANCH=`git config branch.$LOCAL_BRANCH.merge` TRACKING_REMOTE=`git config branch.$LOCAL_BRANCH.remote` # remove credentials from url - REMOTE_URL=`git config remote.$TRACKING_REMOTE.url | sed -r "s|(http[s]://).*@|\1|"` + REMOTE_URL=`git config remote.$TRACKING_REMOTE.url | sed "s|\(http[s]://\).*@|\1|"` printf "remote_url=$REMOTE_URL\n" # OBS return always "master" therefore disabled diff --git a/src/dird/ua.h b/src/dird/ua.h index c2c85f37c6b..a335d8e7dbb 100644 --- a/src/dird/ua.h +++ b/src/dird/ua.h @@ -90,7 +90,7 @@ class UAContext { int rcode_to_acltype(int rcode); void log_audit_event_acl_failure(int acl, const char *item); void log_audit_event_acl_success(int acl, const char *item); - void set_command_definition(ua_cmdstruct *cmd) { cmddef = cmd; } + void set_command_definition(ua_cmdstruct *cmdstruct) { cmddef = cmdstruct; } public: /* diff --git a/src/plugins/filed/Makefile.in b/src/plugins/filed/Makefile.in index 9ce1a8ce785..2f181e03ba2 100644 --- a/src/plugins/filed/Makefile.in +++ b/src/plugins/filed/Makefile.in @@ -102,13 +102,15 @@ install: all CONF=`echo $$plugin | sed 's/\(.*\)-fd.la$$/\1-conf.d/'`; \ if [ -d "$$CONF" ]; then \ for i in `find "$$CONF/" \( -name "*.conf" -o -name "*.conf.example" \) -print | cut -d'/' -f2-`; do \ - $(INSTALL_CONFIG) -D $$CONF/$$i ${DESTDIR}${confdir}/$$i; \ + $(MKDIR) `dirname ${DESTDIR}${confdir}/$$i`; \ + $(INSTALL_CONFIG) $$CONF/$$i ${DESTDIR}${confdir}/$$i; \ done; \ fi; \ if [ "$$plugin" = "python-fd.la" ]; then \ $(CP) *.py *.py.template $(DESTDIR)$(plugindir); \ for i in `find python-ldap-conf.d/ \( -name "*.conf" -o -name "*.conf.example" \) -print | cut -d'/' -f2-`; do \ - $(INSTALL_CONFIG) -D python-ldap-conf.d/$$i ${DESTDIR}${confdir}/$$i; \ + $(MKDIR) `dirname ${DESTDIR}${confdir}/$$i`; \ + $(INSTALL_CONFIG) python-ldap-conf.d/$$i ${DESTDIR}${confdir}/$$i; \ done; \ fi; \ done diff --git a/src/stored/backends/Makefile.in b/src/stored/backends/Makefile.in index c7e80443dc3..dba7da8c074 100644 --- a/src/stored/backends/Makefile.in +++ b/src/stored/backends/Makefile.in @@ -75,7 +75,7 @@ STORED_RESTYPES = autochanger device director ndmp messages storage .c.lo: @echo "Compiling $<" $(NO_ECHO)$(LIBTOOL_COMPILE) $(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) $(INCLUDES) $(DINCLUDE) $(CXXFLAGS) $< - if [ -e "$(@:.lo=.d)" ]; then $(MKDIR) $(CONF_EXTRA_DIR); $(CP) -r $(@:.lo=.d)/. $(CONF_EXTRA_DIR)/.; fi + if [ -d "$(@:.lo=.d)" ]; then $(MKDIR) $(CONF_EXTRA_DIR); $(CP) -r $(@:.lo=.d)/. $(CONF_EXTRA_DIR)/.; fi $(ELASTO_LOBJS): @echo "Compiling $(@:.lo=.c)" @@ -84,12 +84,12 @@ $(ELASTO_LOBJS): $(CHEPHFS_LOBJS): @echo "Compiling $(@:.lo=.c)" $(NO_ECHO)$(LIBTOOL_COMPILE) $(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) $(INCLUDES) $(CEPHFS_INC) $(DINCLUDE) $(CXXFLAGS) $(@:.lo=.c) - if [ -e "$(@:.lo=.d)" ]; then $(MKDIR) $(CONF_EXTRA_DIR); $(CP) -r $(@:.lo=.d)/. $(CONF_EXTRA_DIR)/.; fi + if [ -d "$(@:.lo=.d)" ]; then $(MKDIR) $(CONF_EXTRA_DIR); $(CP) -r $(@:.lo=.d)/. $(CONF_EXTRA_DIR)/.; fi $(GFAPI_LOBJS): @echo "Compiling $(@:.lo=.c)" $(NO_ECHO)$(LIBTOOL_COMPILE) $(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) $(INCLUDES) $(GLUSTER_INC) $(DINCLUDE) $(CXXFLAGS) $(@:.lo=.c) - if [ -e "$(@:.lo=.d)" ]; then $(MKDIR) $(CONF_EXTRA_DIR); $(CP) -r $(@:.lo=.d)/. $(CONF_EXTRA_DIR)/.; fi + if [ -d "$(@:.lo=.d)" ]; then $(MKDIR) $(CONF_EXTRA_DIR); $(CP) -r $(@:.lo=.d)/. $(CONF_EXTRA_DIR)/.; fi $(OBJECT_LOBJS): @echo "Compiling $(@:.lo=.c)" @@ -98,7 +98,7 @@ $(OBJECT_LOBJS): $(RADOS_LOBJS): @echo "Compiling $(@:.lo=.c)" $(NO_ECHO)$(LIBTOOL_COMPILE) $(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) $(INCLUDES) $(RADOS_INC) $(DINCLUDE) $(CXXFLAGS) $(@:.lo=.c) - if [ -e "$(@:.lo=.d)" ]; then $(MKDIR) $(CONF_EXTRA_DIR); $(CP) -r $(@:.lo=.d)/. $(CONF_EXTRA_DIR)/.; fi + if [ -d "$(@:.lo=.d)" ]; then $(MKDIR) $(CONF_EXTRA_DIR); $(CP) -r $(@:.lo=.d)/. $(CONF_EXTRA_DIR)/.; fi #------------------------------------------------------------------------- all: Makefile $(BUILD_BACKENDS) @@ -186,7 +186,7 @@ install-config: $(MKDIR) $$DESTCONFDIR; \ for RESTYPE in $(STORED_RESTYPES); do \ for f in $$SRCCONFDIR/$$RESTYPE/*.conf $$SRCCONFDIR/$$RESTYPE/*.conf.example; do \ - if test -e "$$f"; then \ + if test -f "$$f"; then \ RESDIR="$$DESTCONFDIR/$$RESTYPE"; \ $(MKDIR) "$$RESDIR"; \ RES=`basename "$$f"`; \ From 94fc1a83ef140877e01ed030ef5688b93f6ff014 Mon Sep 17 00:00:00 2001 From: Stephan Duehr Date: Wed, 21 Dec 2016 17:03:19 +0100 Subject: [PATCH 03/10] dbcheck: No interactive questions in batch mode When run in batch mode (-b) and verbose (-v), bareos-dbcheck no longer asks interactive questions. Also added some stdout flushing so that output will be also visible when piping the output to tee. --- src/dird/dbcheck.c | 71 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 65 insertions(+), 6 deletions(-) diff --git a/src/dird/dbcheck.c b/src/dird/dbcheck.c index 5c153c52bf3..c0babeabbb1 100644 --- a/src/dird/dbcheck.c +++ b/src/dird/dbcheck.c @@ -94,7 +94,7 @@ static void eliminate_restore_records(); static void repair_bad_paths(); static void repair_bad_filenames(); static void do_interactive_mode(); -static bool yes_no(const char *prompt); +static bool yes_no(const char *prompt, bool batchvalue = false); static bool check_idx(const char *col_name); static bool create_tmp_idx(const char *idx_name, const char *table_name, const char *col_name); @@ -104,10 +104,10 @@ static int check_idx_handler(void *ctx, int num_fields, char **row); static void usage() { fprintf(stderr, -"Usage: dbcheck [ options ] [] []\n" +"Usage: bareos-dbcheck [ options ] [] []\n" " -b batch mode\n" " -B print catalog configuration and exit\n" -" -c Director configuration filename\n" +" -c Director configuration filename or configuration directory (e.g. /etc/bareos)\n" " -C catalog name in the director configuration file\n" " -d set debug level to \n" " -dt print a timestamp in debug output\n" @@ -693,6 +693,7 @@ static void eliminate_duplicate_filenames() char esc_name[5000]; printf(_("Checking for duplicate Filename entries.\n")); + fflush(stdout); /* * Make list of duplicated names @@ -704,6 +705,7 @@ static void eliminate_duplicate_filenames() exit(1); } printf(_("Found %d duplicate Filename records.\n"), name_list.num_ids); + fflush(stdout); if (name_list.num_ids && verbose && yes_no(_("Print the list? (yes/no): "))) { print_name_list(&name_list); } @@ -748,6 +750,7 @@ static void eliminate_duplicate_filenames() db_sql_query(db, buf, NULL, NULL); } } + fflush(stdout); } free_name_list(&name_list); } @@ -758,6 +761,7 @@ static void eliminate_duplicate_paths() char esc_name[5000]; printf(_("Checking for duplicate Path entries.\n")); + fflush(stdout); /* * Make list of duplicated names @@ -769,6 +773,7 @@ static void eliminate_duplicate_paths() exit(1); } printf(_("Found %d duplicate Path records.\n"), name_list.num_ids); + fflush(stdout); if (name_list.num_ids && verbose && yes_no(_("Print them? (yes/no): "))) { print_name_list(&name_list); } @@ -812,6 +817,7 @@ static void eliminate_duplicate_paths() db_sql_query(db, buf, NULL, NULL); } } + fflush(stdout); } free_name_list(&name_list); } @@ -823,6 +829,7 @@ static void eliminate_orphaned_jobmedia_records() "WHERE Job.JobId IS NULL LIMIT 300000"; printf(_("Checking for orphaned JobMedia entries.\n")); + fflush(stdout); if (!make_id_list(query, &id_list)) { exit(1); } @@ -857,6 +864,7 @@ static void eliminate_orphaned_jobmedia_records() exit(1); } } + fflush(stdout); } static void eliminate_orphaned_file_records() @@ -869,6 +877,7 @@ static void eliminate_orphaned_file_records() if (verbose > 1) { printf("%s\n", query); } + fflush(stdout); if (!make_id_list(query, &id_list)) { exit(1); } @@ -902,6 +911,7 @@ static void eliminate_orphaned_file_records() exit(1); } } + fflush(stdout); } static void eliminate_orphaned_path_records() @@ -913,6 +923,7 @@ static void eliminate_orphaned_path_records() if (lctx.count == 1) { printf(_("Pruning orphaned Path entries isn't possible when using BVFS.\n")); + fflush(stdout); return; } @@ -921,7 +932,7 @@ static void eliminate_orphaned_path_records() * Check the existence of the required "one column" index */ if (!check_idx("PathId")) { - if (yes_no(_("Create temporary index? (yes/no): "))) { + if (yes_no(_("Create temporary index? (yes/no): "), true)) { /* * create temporary index PathId */ @@ -937,6 +948,7 @@ static void eliminate_orphaned_path_records() if (verbose > 1) { printf("%s\n", query); } + fflush(stdout); if (!make_id_list(query, &id_list)) { exit(1); } @@ -945,6 +957,7 @@ static void eliminate_orphaned_path_records() */ while (id_list.num_ids != 0) { printf(_("Found %d orphaned Path records.\n"), id_list.num_ids); + fflush(stdout); if (id_list.num_ids && verbose && yes_no(_("Print them? (yes/no): "))) { for (int i=0; i < id_list.num_ids; i++) { char ed1[50]; @@ -952,12 +965,14 @@ static void eliminate_orphaned_path_records() edit_int64(id_list.Id[i], ed1)); db_sql_query(db, buf, print_name_handler, NULL); } + fflush(stdout); } if (quit) { return; } if (fix && id_list.num_ids > 0) { printf(_("Deleting %d orphaned Path records.\n"), id_list.num_ids); + fflush(stdout); delete_id_list("DELETE FROM Path WHERE PathId=%s", &id_list); } else { break; /* get out if not updating db */ @@ -979,7 +994,7 @@ static void eliminate_orphaned_filename_records() * Check the existence of the required "one column" index */ if (!check_idx("FilenameId") ) { - if (yes_no(_("Create temporary index? (yes/no): "))) { + if (yes_no(_("Create temporary index? (yes/no): "), true)) { /* * Create temporary index FilenameId */ @@ -995,6 +1010,7 @@ static void eliminate_orphaned_filename_records() if (verbose > 1) { printf("%s\n", query); } + fflush(stdout); if (!make_id_list(query, &id_list)) { exit(1); } @@ -1003,6 +1019,7 @@ static void eliminate_orphaned_filename_records() */ while (id_list.num_ids != 0) { printf(_("Found %d orphaned Filename records.\n"), id_list.num_ids); + fflush(stdout); if (id_list.num_ids && verbose && yes_no(_("Print them? (yes/no): "))) { for (int i=0; i < id_list.num_ids; i++) { char ed1[50]; @@ -1016,6 +1033,7 @@ static void eliminate_orphaned_filename_records() } if (fix && id_list.num_ids > 0) { printf(_("Deleting %d orphaned Filename records.\n"), id_list.num_ids); + fflush(stdout); delete_id_list("DELETE FROM Filename WHERE FilenameId=%s", &id_list); } else { break; /* get out if not updating db */ @@ -1042,10 +1060,12 @@ static void eliminate_orphaned_fileset_records() if (verbose > 1) { printf("%s\n", query); } + fflush(stdout); if (!make_id_list(query, &id_list)) { exit(1); } printf(_("Found %d orphaned FileSet records.\n"), id_list.num_ids); + fflush(stdout); if (id_list.num_ids && verbose && yes_no(_("Print them? (yes/no): "))) { for (int i=0; i < id_list.num_ids; i++) { char ed1[50]; @@ -1055,12 +1075,14 @@ static void eliminate_orphaned_fileset_records() printf("%s\n", db_strerror(db)); } } + fflush(stdout); } if (quit) { return; } if (fix && id_list.num_ids > 0) { printf(_("Deleting %d orphaned FileSet records.\n"), id_list.num_ids); + fflush(stdout); delete_id_list("DELETE FROM FileSet WHERE FileSetId=%s", &id_list); } } @@ -1084,6 +1106,7 @@ static void eliminate_orphaned_client_records() if (verbose > 1) { printf("%s\n", query); } + fflush(stdout); if (!make_id_list(query, &id_list)) { exit(1); } @@ -1097,12 +1120,14 @@ static void eliminate_orphaned_client_records() printf("%s\n", db_strerror(db)); } } + fflush(stdout); } if (quit) { return; } if (fix && id_list.num_ids > 0) { printf(_("Deleting %d orphaned Client records.\n"), id_list.num_ids); + fflush(stdout); delete_id_list("DELETE FROM Client WHERE ClientId=%s", &id_list); } } @@ -1126,10 +1151,12 @@ static void eliminate_orphaned_job_records() if (verbose > 1) { printf("%s\n", query); } + fflush(stdout); if (!make_id_list(query, &id_list)) { exit(1); } printf(_("Found %d orphaned Job records.\n"), id_list.num_ids); + fflush(stdout); if (id_list.num_ids && verbose && yes_no(_("Print them? (yes/no): "))) { for (int i=0; i < id_list.num_ids; i++) { char ed1[50]; @@ -1139,16 +1166,20 @@ static void eliminate_orphaned_job_records() printf("%s\n", db_strerror(db)); } } + fflush(stdout); } if (quit) { return; } if (fix && id_list.num_ids > 0) { printf(_("Deleting %d orphaned Job records.\n"), id_list.num_ids); + fflush(stdout); delete_id_list("DELETE FROM Job WHERE JobId=%s", &id_list); printf(_("Deleting JobMedia records of orphaned Job records.\n")); + fflush(stdout); delete_id_list("DELETE FROM JobMedia WHERE JobId=%s", &id_list); printf(_("Deleting Log records of orphaned Job records.\n")); + fflush(stdout); delete_id_list("DELETE FROM Log WHERE JobId=%s", &id_list); } } @@ -1163,6 +1194,7 @@ static void eliminate_admin_records() if (verbose > 1) { printf("%s\n", query); } + fflush(stdout); if (!make_id_list(query, &id_list)) { exit(1); } @@ -1176,12 +1208,14 @@ static void eliminate_admin_records() printf("%s\n", db_strerror(db)); } } + fflush(stdout); } if (quit) { return; } if (fix && id_list.num_ids > 0) { printf(_("Deleting %d Admin Job records.\n"), id_list.num_ids); + fflush(stdout); delete_id_list("DELETE FROM Job WHERE JobId=%s", &id_list); } } @@ -1196,6 +1230,7 @@ static void eliminate_restore_records() if (verbose > 1) { printf("%s\n", query); } + fflush(stdout); if (!make_id_list(query, &id_list)) { exit(1); } @@ -1209,12 +1244,14 @@ static void eliminate_restore_records() printf("%s\n", db_strerror(db)); } } + fflush(stdout); } if (quit) { return; } if (fix && id_list.num_ids > 0) { printf(_("Deleting %d Restore Job records.\n"), id_list.num_ids); + fflush(stdout); delete_id_list("DELETE FROM Job WHERE JobId=%s", &id_list); } } @@ -1230,6 +1267,7 @@ static void repair_bad_filenames() if (verbose > 1) { printf("%s\n", query); } + fflush(stdout); if (!make_id_list(query, &id_list)) { exit(1); } @@ -1244,6 +1282,7 @@ static void repair_bad_filenames() printf("%s\n", db_strerror(db)); } } + fflush(stdout); } if (quit) { return; @@ -1252,6 +1291,7 @@ static void repair_bad_filenames() POOLMEM *name = get_pool_memory(PM_FNAME); char esc_name[5000]; printf(_("Reparing %d bad Filename records.\n"), id_list.num_ids); + fflush(stdout); for (i=0; i < id_list.num_ids; i++) { int len; char ed1[50]; @@ -1284,6 +1324,7 @@ static void repair_bad_filenames() } free_pool_memory(name); } + fflush(stdout); } static void repair_bad_paths() @@ -1297,10 +1338,12 @@ static void repair_bad_paths() if (verbose > 1) { printf("%s\n", query); } + fflush(stdout); if (!make_id_list(query, &id_list)) { exit(1); } printf(_("Found %d bad Path records.\n"), id_list.num_ids); + fflush(stdout); if (id_list.num_ids && verbose && yes_no(_("Print them? (yes/no): "))) { for (i=0; i < id_list.num_ids; i++) { char ed1[50]; @@ -1310,6 +1353,7 @@ static void repair_bad_paths() printf("%s\n", db_strerror(db)); } } + fflush(stdout); } if (quit) { return; @@ -1318,6 +1362,7 @@ static void repair_bad_paths() POOLMEM *name = get_pool_memory(PM_FNAME); char esc_name[5000]; printf(_("Reparing %d bad Filename records.\n"), id_list.num_ids); + fflush(stdout); for (i=0; i < id_list.num_ids; i++) { int len; char ed1[50]; @@ -1344,6 +1389,7 @@ static void repair_bad_paths() } db_sql_query(db, buf, NULL, NULL); } + fflush(stdout); free_pool_memory(name); } } @@ -1356,6 +1402,7 @@ static char *get_cmd(const char *prompt) static char cmd[1000]; printf("%s", prompt); + fflush(stdout); if (fgets(cmd, sizeof(cmd), stdin) == NULL) { printf("\n"); quit = true; @@ -1365,9 +1412,15 @@ static char *get_cmd(const char *prompt) return cmd; } -static bool yes_no(const char *prompt) +static bool yes_no(const char *prompt, bool batchvalue/* = true*/) { char *cmd; + /* + * return the batchvalue if batch operation is set + */ + if (batch) { + return batchvalue; + } cmd = get_cmd(prompt); if (!cmd) { quit = true; @@ -1447,6 +1500,7 @@ static bool check_idx(const char *col_name) memset(&idx_list, 0, sizeof(idx_list)); if (!db_sql_query(db, query, check_idx_handler, (void *)col_name)) { printf("%s\n", db_strerror(db)); + fflush(stdout); } for (i = 0; (idx_list[i].key_name != NULL) && (i < (MAXIDX - 1)) ; i++) { /* @@ -1466,6 +1520,7 @@ static bool check_idx(const char *col_name) } else { printf(_("Note. Index over the %s column not found, that can greatly slow down dbcheck.\n"), col_name); } + fflush(stdout); return found; default: return true; @@ -1480,6 +1535,7 @@ static bool create_tmp_idx(const char *idx_name, const char *table_name, { idx_tmp_name = NULL; printf(_("Create temporary index... This may take some time!\n")); + fflush(stdout); bsnprintf(buf, sizeof(buf), "CREATE INDEX %s ON %s (%s)", idx_name, table_name, col_name); if (verbose) { printf("%s\n", buf); @@ -1493,6 +1549,7 @@ static bool create_tmp_idx(const char *idx_name, const char *table_name, printf("%s\n", db_strerror(db)); return false; } + fflush(stdout); return true; } @@ -1503,6 +1560,7 @@ static bool drop_tmp_idx(const char *idx_name, const char *table_name) { if (idx_tmp_name != NULL) { printf(_("Drop temporary index.\n")); + fflush(stdout); bsnprintf(buf, sizeof(buf), "DROP INDEX %s ON %s", idx_name, table_name); if (verbose) { printf("%s\n", buf); @@ -1515,6 +1573,7 @@ static bool drop_tmp_idx(const char *idx_name, const char *table_name) printf(_("Temporary index %s deleted.\n"), idx_tmp_name); } } + fflush(stdout); } idx_tmp_name = NULL; return true; From 2aa5608981956864aa1ecf691dd80c27170fdeac Mon Sep 17 00:00:00 2001 From: Philipp Storz Date: Mon, 2 Jan 2017 18:08:43 +0100 Subject: [PATCH 04/10] windows installer : "Open Bareos websites" --- platforms/win32/winbareos.nsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platforms/win32/winbareos.nsi b/platforms/win32/winbareos.nsi index 694edc247c5..fef30790c4d 100644 --- a/platforms/win32/winbareos.nsi +++ b/platforms/win32/winbareos.nsi @@ -185,7 +185,7 @@ FunctionEnd !define MUI_FINISHPAGE_RUN #!define MUI_FINISHPAGE_RUN_NOTCHECKED -!define MUI_FINISHPAGE_RUN_TEXT "open Bareos websites" +!define MUI_FINISHPAGE_RUN_TEXT "Open Bareos websites" !define MUI_FINISHPAGE_RUN_FUNCTION "LaunchLink" !insertmacro MUI_PAGE_FINISH From 5fc043d6626e541c31e7f99a502daba8c48d8d9c Mon Sep 17 00:00:00 2001 From: Joerg Steffens Date: Fri, 30 Dec 2016 16:25:05 +0100 Subject: [PATCH 05/10] UCS: reduce settings in the generic job template Remove some settings that are set to defaults anyway. This prevents problems when updating from earilier version, as the "Linux All" fileset has been renamed to "LinuxAll". --- platforms/univention/job-generic.template | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platforms/univention/job-generic.template b/platforms/univention/job-generic.template index 2f02c2dc2ef..d432b215e65 100644 --- a/platforms/univention/job-generic.template +++ b/platforms/univention/job-generic.template @@ -8,7 +8,7 @@ Job { Name = "Backup-${client_name}" Client = "${client_name}-fd" JobDefs = "DefaultJob" - FileSet = "LinuxAll" - Schedule = "WeeklyCycle" + #FileSet = "LinuxAll" + #Schedule = "WeeklyCycle" Enabled = "${enable}" } From 810b56283ccd9b14768d3b3ff61dd44cb1730f35 Mon Sep 17 00:00:00 2001 From: Joerg Steffens Date: Fri, 6 Jan 2017 11:59:24 +0100 Subject: [PATCH 06/10] UCS: added legacy bareos-webui profile While this profile will not be used by fresh installation, updated old installation might refer to this file. Where also the CommandACL is adapted to the requirements of bareos-webui >= 16.2. --- debian/univention-bareos.install.in | 1 + ...ivention-bareos.univention-config-registry | 3 +++ .../bareos/bareos-dir.d/webui-profiles.conf | 21 +++++++++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 platforms/univention/conffiles/etc/bareos/bareos-dir.d/webui-profiles.conf diff --git a/debian/univention-bareos.install.in b/debian/univention-bareos.install.in index e6940d8c857..d31eb6f9a20 100644 --- a/debian/univention-bareos.install.in +++ b/debian/univention-bareos.install.in @@ -10,6 +10,7 @@ /etc/univention/templates/scripts/etc/bareos/bareos-dir.d/pool/Differential.conf /etc/univention/templates/scripts/etc/bareos/bareos-dir.d/pool/Full.conf /etc/univention/templates/scripts/etc/bareos/bareos-dir.d/pool/Incremental.conf +/etc/univention/templates/scripts/etc/bareos/bareos-dir.d/webui-profiles.conf /usr/lib/univention-directory-listener/system/univention-bareos.py /usr/lib/univention-install/62univention-bareos.inst /usr/lib/univention-uninstall/63univention-bareos.uinst diff --git a/debian/univention-bareos.univention-config-registry b/debian/univention-bareos.univention-config-registry index bcc37739539..cef66d78dd7 100644 --- a/debian/univention-bareos.univention-config-registry +++ b/debian/univention-bareos.univention-config-registry @@ -31,6 +31,9 @@ File: etc/bareos/bareos-dir.d/pool/Incremental.conf Variables: bareos/max_incr_volume_bytes Variables: bareos/max_incr_volumes +Type: file +File: etc/bareos/bareos-dir.d/webui-profiles.conf + Type: file File: etc/bareos/bareos-sd.d/device/FileStorage.conf Variables: bareos/filestorage diff --git a/platforms/univention/conffiles/etc/bareos/bareos-dir.d/webui-profiles.conf b/platforms/univention/conffiles/etc/bareos/bareos-dir.d/webui-profiles.conf new file mode 100644 index 00000000000..f528a827f72 --- /dev/null +++ b/platforms/univention/conffiles/etc/bareos/bareos-dir.d/webui-profiles.conf @@ -0,0 +1,21 @@ +@%@UCRWARNING=# @%@ + +# +# bareos-webui profile resource. +# Deprecated, only used when updating from bareos-15.2. +# Fresh installation of bareos >= 16.2 will use +# /etc/bareos/bareos-dir.d/profile/webui-admin.conf (profile name: webui-admin). +# +Profile { + Name = webui + CommandACL = !.bvfs_clear_cache, !.exit, !.sql, !configure, !create, !delete, !purge, !prune, !sqlquery, !umount, !unmount, *all* + Job ACL = *all* + Schedule ACL = *all* + Catalog ACL = *all* + Pool ACL = *all* + Storage ACL = *all* + Client ACL = *all* + FileSet ACL = *all* + Where ACL = *all* +} + From 1230b193f3309008134d35ea5fa467353c29bbcb Mon Sep 17 00:00:00 2001 From: Joerg Steffens Date: Fri, 6 Jan 2017 12:05:46 +0100 Subject: [PATCH 07/10] UCS: do not include the ini file in the AppCenter package --- platforms/univention/Makefile.in | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/platforms/univention/Makefile.in b/platforms/univention/Makefile.in index 3f27a9356ad..4f7a7dd685e 100644 --- a/platforms/univention/Makefile.in +++ b/platforms/univention/Makefile.in @@ -16,7 +16,10 @@ all: # remove autoconf template files find ../../conffiles/ -name "*.in" -exec rm {} \; @$(MKDIR) ../../AppCenter/ - $(INSTALL_DATA) AppCenter/univention-bareos.ini ../../AppCenter/ + # Univention advices not to include the ini file any longer, + # to prevent to new settings added by Univention gets overwritten. + # Instead the settings should be done manually on the AppCenter Management interface. + #$(INSTALL_DATA) AppCenter/univention-bareos.ini ../../AppCenter/ $(INSTALL_DATA) AppCenter/LICENSE_AGREEMENT ../../AppCenter/ $(INSTALL_DATA) AppCenter/README ../../AppCenter/ $(INSTALL_DATA) AppCenter/README_DE ../../AppCenter/ From 9b5d689d7e10abd5bdb188f054d255688315be16 Mon Sep 17 00:00:00 2001 From: Joerg Steffens Date: Fri, 13 Jan 2017 11:46:19 +0100 Subject: [PATCH 08/10] UCS: cleanup license popup --- platforms/univention/AppCenter/LICENSE_AGREEMENT.in | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/platforms/univention/AppCenter/LICENSE_AGREEMENT.in b/platforms/univention/AppCenter/LICENSE_AGREEMENT.in index e5512aeb737..8a5c74d5b9a 100644 --- a/platforms/univention/AppCenter/LICENSE_AGREEMENT.in +++ b/platforms/univention/AppCenter/LICENSE_AGREEMENT.in @@ -5,7 +5,7 @@ Copyright (C) 2000-2012 Free Software Foundation Europe e.V. - Copyright (C) 2013-2015 Bareos GmbH & Co. KG + Copyright (C) 2013-2017 Bareos GmbH & Co. KG @@ -26,6 +26,7 @@ along with this program. If not, see http://www.gnu.org/licenses/

- See full license text at https://github.com/bareos/bareos/blob/master/LICENSE + Some parts of the code are licensed under other permissive licenses. + See the full license text.

From 977e9560c8d09697ae09bf60692e2afd883b9352 Mon Sep 17 00:00:00 2001 From: Philipp Storz Date: Mon, 23 Jan 2017 23:15:29 +0100 Subject: [PATCH 09/10] Build: Bump version number --- configure | 24 +++++++++++------------ platforms/win32/mingw-debugsrc-devel.spec | 4 ++-- platforms/win32/winbareos-nsi.spec | 2 +- platforms/win32/winbareos.nsi | 2 +- platforms/win32/winbareos32.spec | 2 +- platforms/win32/winbareos64.spec | 2 +- src/include/version.h | 24 +++++++++++------------ 7 files changed, 30 insertions(+), 30 deletions(-) diff --git a/configure b/configure index 00de70d7fb9..7badda2de82 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for bareos 16.2.4. +# Generated by GNU Autoconf 2.69 for bareos 16.2.5. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -587,8 +587,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='bareos' PACKAGE_TARNAME='bareos' -PACKAGE_VERSION='16.2.4' -PACKAGE_STRING='bareos 16.2.4' +PACKAGE_VERSION='16.2.5' +PACKAGE_STRING='bareos 16.2.5' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1652,7 +1652,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 bareos 16.2.4 to adapt to many kinds of systems. +\`configure' configures bareos 16.2.5 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1721,7 +1721,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of bareos 16.2.4:";; + short | recursive ) echo "Configuration of bareos 16.2.5:";; esac cat <<\_ACEOF @@ -1956,7 +1956,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -bareos configure 16.2.4 +bareos configure 16.2.5 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2911,7 +2911,7 @@ 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 bareos $as_me 16.2.4, which was +It was created by bareos $as_me 16.2.5, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -18030,7 +18030,7 @@ if test "x$OBS_DISTRIBUTION" != "x" then echo "obsdistname set to $OBS_DISTRIBUTION" else - if test -e /.build.log; then + if test -f /.build.log; then OBS_PROJECT=`grep 'Building bareos for project' /.build.log | cut -d' ' -f10 | sed "s#'##g"` OBS_DISTRIBUTION=`grep 'Building bareos for project' /.build.log | cut -d' ' -f12 | sed "s#'##g"` OBS_ARCH=`grep 'Building bareos for project' /.build.log | cut -d' ' -f14 | sed "s#'##g"` @@ -23735,7 +23735,7 @@ if test "${with_python+set}" = set; then : PYTHON_LIBS= if test "$withval" != "no"; then if test "$withval" = "yes"; then - if test -e /usr/bin/python-config ; then + if test -f /usr/bin/python-config ; then PYTHON_INC=`/usr/bin/python-config --includes` PYTHON_LIBS=`/usr/bin/python-config --libs` else @@ -23769,7 +23769,7 @@ $as_echo "no" >&6; } fi fi else - if test -e $withval/bin/python-config ; then + if test -f $withval/bin/python-config ; then PYTHON_INC=`$withval/bin/python-config --includes` PYTHON_LIBS=`$withval/bin/python-config --libs` elif test -f $withval/Python.h; then @@ -34347,7 +34347,7 @@ 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 bareos $as_me 16.2.4, which was +This file was extended by bareos $as_me 16.2.5, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -34413,7 +34413,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -bareos config.status 16.2.4 +bareos config.status 16.2.5 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/platforms/win32/mingw-debugsrc-devel.spec b/platforms/win32/mingw-debugsrc-devel.spec index 3a3cc6f1973..492c9f14ce8 100644 --- a/platforms/win32/mingw-debugsrc-devel.spec +++ b/platforms/win32/mingw-debugsrc-devel.spec @@ -1,7 +1,7 @@ # # spec file for package mingw-debugsrc-devel # -# Copyright (c) 2014-2015 Bareos GmbH & Co. KG +# Copyright (c) 2014-2017 Bareos GmbH & Co. KG # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ #!BuildIgnore: post-build-checks Name: mingw-debugsrc-devel -Version: 16.2.4 +Version: 16.2.5 Release: 0 Summary: bareos License: LGPLv2+ diff --git a/platforms/win32/winbareos-nsi.spec b/platforms/win32/winbareos-nsi.spec index 7fb8ca68238..644cd3ca753 100644 --- a/platforms/win32/winbareos-nsi.spec +++ b/platforms/win32/winbareos-nsi.spec @@ -19,7 +19,7 @@ #!BuildIgnore: post-build-checks Name: winbareos-nsi -Version: 16.2.4 +Version: 16.2.5 Release: 0 Summary: Bareos Windows NSI package License: LGPLv2+ diff --git a/platforms/win32/winbareos.nsi b/platforms/win32/winbareos.nsi index fef30790c4d..40c4cd6739c 100644 --- a/platforms/win32/winbareos.nsi +++ b/platforms/win32/winbareos.nsi @@ -1,7 +1,7 @@ ; ; BAREOS - Backup Archiving REcovery Open Sourced ; -; Copyright (C) 2012-2016 Bareos GmbH & Co. KG +; Copyright (C) 2012-2017 Bareos GmbH & Co. KG ; ; 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 diff --git a/platforms/win32/winbareos32.spec b/platforms/win32/winbareos32.spec index b67c1822cad..9591a1c755f 100644 --- a/platforms/win32/winbareos32.spec +++ b/platforms/win32/winbareos32.spec @@ -23,7 +23,7 @@ %define bareos_configs bareos-dir.d/ bareos-fd.d/ bareos-sd.d/ tray-monitor.d/ bconsole.conf bat.conf Name: %{mingw}-winbareos -Version: 16.2.4 +Version: 16.2.5 Release: 0 Summary: Bareos build for Windows License: LGPLv2+ diff --git a/platforms/win32/winbareos64.spec b/platforms/win32/winbareos64.spec index db031319e5f..5cc52e05bc4 100644 --- a/platforms/win32/winbareos64.spec +++ b/platforms/win32/winbareos64.spec @@ -23,7 +23,7 @@ %define bareos_configs bareos-dir.d/ bareos-fd.d/ bareos-sd.d/ tray-monitor.d/ bconsole.conf bat.conf Name: %{mingw}-winbareos -Version: 16.2.4 +Version: 16.2.5 Release: 0 Summary: Bareos build for Windows License: LGPLv2+ diff --git a/src/include/version.h b/src/include/version.h index 42b1358f035..98e3ecddf33 100644 --- a/src/include/version.h +++ b/src/include/version.h @@ -1,11 +1,11 @@ #undef VERSION -#define VERSION "16.2.4" -#define BDATE "01 July 2016" -#define LSMDATE "01Jul16" +#define VERSION "16.2.5" +#define BDATE "23 January 2017" +#define LSMDATE "23Jan17" #define PROG_COPYRIGHT "Copyright (C) %d-2012 Free Software Foundation Europe e.V.\n" \ - "Copyright (C) 2013-2016 Bareos GmbH & Co. KG\n" -#define BYEAR "2016" /* year for copyright messages in progs */ + "Copyright (C) 2013-2017 Bareos GmbH & Co. KG\n" +#define BYEAR "2017" /* year for copyright messages in progs */ /* BAREOSĀ® - Backup Archiving REcovery Open Sourced @@ -31,13 +31,13 @@ /* Shared object library versions */ /* Uncomment to overwrite default value from VERSION */ -/* #define LIBBAREOS_LT_RELEASE "16.2.4" */ -/* #define LIBBAREOSCFG_LT_RELEASE "16.2.4" */ -/* #define LIBBAREOSSQL_LT_RELEASE "16.2.4" */ -/* #define LIBBAREOSCATS_LT_RELEASE "16.2.4" */ -/* #define LIBBAREOSNDMP_LT_RELEASE "16.2.4" */ -/* #define LIBBAREOSLMDB_LT_RELEASE "16.2.4" */ -/* #define LIBBAREOSSD_LT_RELEASE "16.2.4" */ +/* #define LIBBAREOS_LT_RELEASE "16.2.5" */ +/* #define LIBBAREOSCFG_LT_RELEASE "16.2.5" */ +/* #define LIBBAREOSSQL_LT_RELEASE "16.2.5" */ +/* #define LIBBAREOSCATS_LT_RELEASE "16.2.5" */ +/* #define LIBBAREOSNDMP_LT_RELEASE "16.2.5" */ +/* #define LIBBAREOSLMDB_LT_RELEASE "16.2.5" */ +/* #define LIBBAREOSSD_LT_RELEASE "16.2.5" */ /* Debug flags */ #undef DEBUG From 96a28a31484750fbe8aa8886c49d523932b0d74b Mon Sep 17 00:00:00 2001 From: Joerg Steffens Date: Wed, 25 Jan 2017 18:16:04 +0100 Subject: [PATCH 10/10] client initiated connection: fixes json output for "status dir" --- src/dird/ua_status.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/dird/ua_status.c b/src/dird/ua_status.c index fe9ff9df513..1c2bc7abaa0 100644 --- a/src/dird/ua_status.c +++ b/src/dird/ua_status.c @@ -3,7 +3,7 @@ Copyright (C) 2001-2012 Free Software Foundation Europe e.V. Copyright (C) 2011-2012 Planets Communications B.V. - Copyright (C) 2013-2013 Bareos GmbH & Co. KG + Copyright (C) 2013-2017 Bareos GmbH & Co. KG 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 @@ -1276,16 +1276,18 @@ static void list_connected_clients(UAContext *ua) connections = get_client_connections()->get_as_alist(); ua->send->decoration("%-20s%-20s%-20s%-40s\n", "Connect time", "Protocol", "Authenticated", "Name"); ua->send->decoration("%-20s%-20s%-20s%-20s%-20s\n", separator, separator, separator, separator, separator); + ua->send->array_start("client-connection"); foreach_alist(connection, connections) { - ua->send->object_start("client-connection"); + ua->send->object_start(); bstrftime_nc(dt, sizeof(dt), connection->connect_time()); ua->send->object_key_value("connect_time", dt, "%-20s"); ua->send->object_key_value("protocol_version", connection->protocol_version(), "%-20d"); ua->send->object_key_value("authenticated", connection->authenticated(), "%-20d"); ua->send->object_key_value("name", connection->name(), "%-40s"); - ua->send->object_end("client-connection"); + ua->send->object_end(); ua->send->decoration("\n"); } + ua->send->array_end("client-connection"); } static void content_send_info_api(UAContext *ua, char type, int Slot, char *vol_name)