From 077be74be72994e4a42b09f65b0a3442647f2de2 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 13 Nov 2004 10:34:17 +0000 Subject: [PATCH] - Fix web page links for new manual. - Grant postgresql permission to cdimages. - Correct crash after list nextvol list media bug 160 git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1686 91ce42f0-d328-0410-95d8-f526ca767f89 --- .../src/cats/grant_postgresql_privileges.in | 1 + bacula/src/dird/ua_output.c | 106 +++++++++--------- bacula/src/version.h | 4 +- 3 files changed, 56 insertions(+), 55 deletions(-) diff --git a/bacula/src/cats/grant_postgresql_privileges.in b/bacula/src/cats/grant_postgresql_privileges.in index 1a3b9dbb04..02c18fb8e5 100644 --- a/bacula/src/cats/grant_postgresql_privileges.in +++ b/bacula/src/cats/grant_postgresql_privileges.in @@ -23,6 +23,7 @@ grant all on path to ${USER}; grant all on filename to ${USER}; grant all on counters to ${USER}; grant all on version to ${USER}; +grant all on cdimages to ${USER}; -- for sequences on those tables diff --git a/bacula/src/dird/ua_output.c b/bacula/src/dird/ua_output.c index 9a1f11d2f2..69ea42d1fa 100644 --- a/bacula/src/dird/ua_output.c +++ b/bacula/src/dird/ua_output.c @@ -42,11 +42,11 @@ extern int console_msg_pending; extern FILE *con_fd; extern brwlock_t con_lock; - /* Imported functions */ /* Forward referenced functions */ static int do_list_cmd(UAContext *ua, const char *cmd, e_list_type llist); +static bool list_nextvol(UAContext *ua); /* * Turn auto display of console messages on/off @@ -401,58 +401,7 @@ static int do_list_cmd(UAContext *ua, const char *cmd, e_list_type llist) /* List next volume */ } else if (strcasecmp(ua->argk[i], _("nextvol")) == 0 || strcasecmp(ua->argk[i], _("nextvolume")) == 0) { - JOB *job; - JCR *jcr = ua->jcr; - POOL *pool; - RUN *run; - time_t runtime; - bool found = false; - - i = find_arg_with_value(ua, "job"); - if (i <= 0) { - if ((job = select_job_resource(ua)) == NULL) { - return 1; - } - } else { - job = (JOB *)GetResWithName(R_JOB, ua->argv[i]); - if (!job) { - Jmsg(jcr, M_ERROR, 0, _("%s is not a job name.\n"), ua->argv[i]); - if ((job = select_job_resource(ua)) == NULL) { - return 1; - } - } - } - for (run=NULL; (run = find_next_run(run, job, runtime)); ) { - pool = run ? run->pool : NULL; - if (!complete_jcr_for_job(jcr, job, pool)) { - return 1; - } - - if (!find_next_volume_for_append(jcr, &mr, 0)) { - bsendmsg(ua, _("Could not find next Volume.\n")); - if (jcr->db) { - db_close_database(jcr, jcr->db); - jcr->db = NULL; - } - return 1; - } else { - bsendmsg(ua, _("The next Volume to be used by Job \"%s\" will be %s\n"), - job->hdr.name, mr.VolumeName); - found = true; - } - if (jcr->db) { - db_close_database(jcr, jcr->db); - jcr->db = NULL; - } - } - if (jcr->db) { - db_close_database(jcr, jcr->db); - jcr->db = NULL; - } - if (!found) { - bsendmsg(ua, _("Could not find next Volume.\n")); - } - return 1; + list_nextvol(ua); } else { bsendmsg(ua, _("Unknown list keyword: %s\n"), NPRT(ua->argk[i])); } @@ -460,6 +409,57 @@ static int do_list_cmd(UAContext *ua, const char *cmd, e_list_type llist) return 1; } +static bool list_nextvol(UAContext *ua) +{ + JOB *job; + JCR *jcr = ua->jcr; + POOL *pool; + RUN *run; + time_t runtime; + bool found = false; + MEDIA_DBR mr; + + memset(&mr, 0, sizeof(mr)); + int i = find_arg_with_value(ua, "job"); + if (i <= 0) { + if ((job = select_job_resource(ua)) == NULL) { + return false; + } + } else { + job = (JOB *)GetResWithName(R_JOB, ua->argv[i]); + if (!job) { + Jmsg(jcr, M_ERROR, 0, _("%s is not a job name.\n"), ua->argv[i]); + if ((job = select_job_resource(ua)) == NULL) { + return false; + } + } + } + for (run=NULL; (run = find_next_run(run, job, runtime)); ) { + pool = run ? run->pool : NULL; + if (!complete_jcr_for_job(jcr, job, pool)) { + return false; + } + + if (!find_next_volume_for_append(jcr, &mr, 0)) { + bsendmsg(ua, _("Could not find next Volume.\n")); + } else { + bsendmsg(ua, _("The next Volume to be used by Job \"%s\" will be %s\n"), + job->hdr.name, mr.VolumeName); + found = true; + } + if (jcr->db && jcr->db != ua->db) { + db_close_database(jcr, jcr->db); + jcr->db = NULL; + } + } + if (!found) { + bsendmsg(ua, _("Could not find next Volume.\n")); + return false; + } + return true; +} + + /* * For a given job, we examine all his run records * to see if it is scheduled today or tomorrow. diff --git a/bacula/src/version.h b/bacula/src/version.h index 99c81fd563..72635fce82 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -1,8 +1,8 @@ /* */ #undef VERSION #define VERSION "1.37.1" -#define BDATE "10 November 2004" -#define LSMDATE "10Nov04" +#define BDATE "12 November 2004" +#define LSMDATE "12Nov04" /* Debug flags */ #undef DEBUG -- 2.39.5