}
}
- /* If we still do not have a jcr,
- * throw up a list and ask the user to select one.
- */
- if (!jcr) {
+ if (jcr) {
+ if (jcr->job && !acl_access_ok(ua, Job_ACL, jcr->job->name())) {
+ bsendmsg(ua, _("Unauthorized command from this console.\n"));
+ return 1;
+ }
+ } else {
+ /*
+ * If we still do not have a jcr,
+ * throw up a list and ask the user to select one.
+ */
char buf[1000];
/* Count Jobs running */
foreach_jcr(jcr) {
if (jcr->JobId == 0) { /* this is us */
continue;
}
+ if (!acl_access_ok(ua, Job_ACL, jcr->job->name())) {
+ continue; /* skip not authorized */
+ }
njobs++;
}
endeach_jcr(jcr);
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2002-2006 Free Software Foundation Europe e.V.
+ Copyright (C) 2002-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.
if (jcr->NumWriteVolumes == 0) {
jcr->NumWriteVolumes = 1;
}
+ dev->VolCatInfo.VolCatJobs++; /* increment number of jobs on vol */
+ dir_update_volume_info(dcr, false); /* send Volume info to Director */
P(dev->mutex);
if (dcr->reserved_device) {
dev->reserved_device--;
}
if (!dev->at_weot()) {
dev->VolCatInfo.VolCatFiles = dev->file; /* set number of files */
- dev->VolCatInfo.VolCatJobs++; /* increment number of jobs */
/* Note! do volume update before close, which zaps VolCatInfo */
Dmsg0(100, "dir_update_vol_info. Release0\n");
dir_update_volume_info(dcr, false); /* send Volume info to Director */
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2006 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-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.
static char OK_create[] = "1000 OK CreateJobMedia\n";
+static pthread_mutex_t vol_info_mutex = PTHREAD_MUTEX_INITIALIZER;
+
#ifdef needed
static char Device_update[] = "DevUpd Job=%s device=%s "
* and
* dir_find_next_appendable_volume()
*
+ * NOTE!!! All calls to this routine must be protected by
+ * locking vol_info_mutex before calling it so that
+ * we don't have one thread modifying the parameters
+ * and another reading them.
+ *
* Returns: true on success and vol info in dcr->VolCatInfo
* false on failure
*/
JCR *jcr = dcr->jcr;
BSOCK *dir = jcr->dir_bsock;
+ P(vol_info_mutex);
bstrncpy(dcr->VolCatInfo.VolCatName, dcr->VolumeName, sizeof(dcr->VolCatInfo.VolCatName));
bash_spaces(dcr->VolCatInfo.VolCatName);
bnet_fsend(dir, Get_Vol_Info, jcr->Job, dcr->VolCatInfo.VolCatName,
Dmsg1(100, ">dird: %s", dir->msg);
unbash_spaces(dcr->VolCatInfo.VolCatName);
bool ok = do_get_volume_info(dcr);
+ V(vol_info_mutex);
return ok;
}
* drive, so we continue looking for a not in use Volume.
*/
lock_reservations();
+ P(vol_info_mutex);
for (int vol_index=1; vol_index < 20; vol_index++) {
bash_spaces(dcr->media_type);
bash_spaces(dcr->pool_name);
if (found) {
Dmsg0(400, "dir_find_next_appendable_volume return true\n");
new_volume(dcr, dcr->VolumeName); /* reserve volume */
+ V(vol_info_mutex);
unlock_reservations();
return true;
}
dcr->VolumeName[0] = 0;
+ V(vol_info_mutex);
unlock_reservations();
return false;
}
VOLUME_CAT_INFO *vol = &dev->VolCatInfo;
char ed1[50], ed2[50], ed3[50], ed4[50], ed5[50];
int InChanger;
+ bool ok = false;
POOL_MEM VolumeName;
/* If system job, do not update catalog */
return false;
}
+ /* Lock during Volume update */
+ P(vol_info_mutex);
Dmsg1(100, "Update cat VolFiles=%d\n", dev->file);
/* Just labeled or relabeled the tape */
if (label) {
Jmsg(jcr, M_FATAL, 0, "%s", jcr->errmsg);
Dmsg2(100, _("Didn't get vol info vol=%s: ERR=%s"),
vol->VolCatName, jcr->errmsg);
- return false;
+ goto bail_out;
}
Dmsg1(420, "get_volume_info(): %s", dir->msg);
/* Update dev Volume info in case something changed (e.g. expired) */
dev->VolCatInfo = dcr->VolCatInfo;
- return true;
+ ok = true;
+
+bail_out:
+ V(vol_info_mutex);
+ return ok;
}
/*
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2001-2006 Free Software Foundation Europe e.V.
+ Copyright (C) 2001-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.
}
bstrncpy(dev->VolCatInfo.VolCatStatus, "Full", sizeof(dev->VolCatInfo.VolCatStatus));
dev->VolCatInfo.VolCatFiles = dev->file; /* set number of files */
- dev->VolCatInfo.VolCatJobs++; /* increment number of jobs */
if (dev->is_dvd()) {
if (!dvd_write_part(dcr)) { /* write last part */
}
P(dev->mutex); /* lock again */
+ dev->VolCatInfo.VolCatJobs++; /* increment number of jobs on vol */
+ dir_update_volume_info(dcr, false); /* send Volume info to Director */
+
Jmsg(jcr, M_INFO, 0, _("New volume \"%s\" mounted on device %s at %s.\n"),
dcr->VolumeName, dev->print_name(), bstrftime(dt, sizeof(dt), time(NULL)));
#undef VERSION
#define VERSION "2.1.2"
-#define BDATE "07 February 2007"
-#define LSMDATE "07Feb07"
+#define BDATE "08 February 2007"
+#define LSMDATE "08Feb07"
#define PROG_COPYRIGHT "Copyright (C) %d-2007 Free Software Foundation Europe e.V.\n"
#define BYEAR "2007" /* year for copyright messages in progs */
Technical notes on version 2.1
General:
+08Feb07
+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