char *data = msg.c_str();
POOL_MEM buf(PM_MESSAGE);
char *input;
- char *passwd;
// the command is encoded as a first char of the message
switch (dir->msg[0]){
pm_strcpy(buf, NULL);
}
#else
- passwd = getpass(data);
- bstrncpy(buf.c_str(), passwd, buf.size());
+ bstrncpy(buf.c_str(), getpass(data), buf.size());
#endif
#if defined(DEVELOPER)
} else {
sz = get_resource_size(resinx + r_first);
if (sz < 0) {
- Dmsg1(0, "Unknown resource type %d\n", resinx);
+ Dmsg1(10, "Unknown resource type %d\n", resinx);
continue;
}
/* Static variables */
static char *configfile = NULL;
static BSOCK *UA_sock = NULL;
-static DIRRES *dir = NULL;
-static CONRES *cons = NULL;
static FILE *output = stdout;
static bool teeout = false; /* output to output and stdout */
static bool teein = false; /* input to output and stdout */
static bool no_conio = false;
static int timeout = 0;
static int argc;
-static int numdir;
static POOLMEM *args;
static char *argk[MAX_CMD_ARGS];
static char *argv[MAX_CMD_ARGS];
{
int numcon=0, numdir=0;
int i=0, item=0;
- BSOCK *UA_sock;
+ BSOCK *UA;
DIRRES *dir = NULL;
CONRES *cons = NULL;
}
if (dir == NULL) { /* prompt for director */
- UA_sock = new_bsock();
+ UA = new_bsock();
try_again:
sendit(_("Available Directors:\n"));
LockRes();
}
UnlockRes();
if (get_cmd(stdin, _("Select Director by entering a number: "),
- UA_sock, 600) < 0)
+ UA, 600) < 0)
{
(void)WSACleanup(); /* Cleanup Windows sockets */
return 0;
}
- if (!is_a_number(UA_sock->msg)) {
+ if (!is_a_number(UA->msg)) {
senditf(_("%s is not a number. You must enter a number between "
"1 and %d\n"),
- UA_sock->msg, numdir);
+ UA->msg, numdir);
goto try_again;
}
- item = atoi(UA_sock->msg);
+ item = atoi(UA->msg);
if (item < 0 || item > numdir) {
senditf(_("You must enter a number between 1 and %d\n"), numdir);
goto try_again;
}
- free_bsock(UA_sock);
+ free_bsock(UA);
LockRes();
for (i=0; i<item; i++) {
dir = (DIRRES *)GetNextRes(R_DIRECTOR, (RES *)dir);
bool test_config = false;
utime_t heart_beat;
bool avoid_getpass = false;
+ DIRRES *dir = NULL;
+ CONRES *cons = NULL;
setlocale(LC_ALL, "");
bindtextdomain("bacula", LOCALEDIR);
bool OK = true;
DIRRES *director;
bool tls_needed;
+ int numdir = 0;
LockRes();
- numdir = 0;
foreach_res(director, R_DIRECTOR) {
numdir++;
*/
static int putfilecmd(FILE *input, BSOCK *UA_sock)
{
- int i = 0;
const char *key = "putfile";
const char *fname;
FILE *fp;
/* Just read the file and send it to the director */
while (!feof(fp)) {
- i = fread(UA_sock->msg, 1, sizeof_pool_memory(UA_sock->msg) - 1, fp);
+ int i = fread(UA_sock->msg, 1, sizeof_pool_memory(UA_sock->msg) - 1, fp);
if (i > 0) {
UA_sock->msg[i] = 0;
UA_sock->msglen = i;
sz = get_resource_size(resinx + r_first);
if (sz < 0) {
- Dmsg1(0, "Unknown resource type %d\n", resinx);
+ Dmsg1(10, "Unknown resource type %d\n", resinx);
continue;
}
#include "bacula.h"
#include "dird.h"
-#define dbglvl 0
+#define dbglvl 50
/* Get hash type from the string length */
static const char *hash_get_type(int len)
case 65:
return "SHA256";
default:
- Dmsg1(0, "Unknown hash len %d\n", len);
+ Dmsg1(dbglvl, "Unknown hash len %d\n", len);
return NULL;
}
}
pr->MaxVols = pool->max_volumes;
pr->NumVols = 0;
} else { /* update pool */
- if (pr->MaxVols != pool->max_volumes) {
- pr->MaxVols = pool->max_volumes;
- }
+ pr->MaxVols = pool->max_volumes;
if (pr->MaxVols != 0 && pr->MaxVols < pr->NumVols) {
pr->MaxVols = pr->NumVols;
}
pr->MaxVolJobs = pool->MaxVolJobs;
pr->MaxVolFiles = pool->MaxVolFiles;
pr->MaxVolBytes = pool->MaxVolBytes;
- pr->MaxPoolBytes = pool->MaxPoolBytes;
pr->AutoPrune = pool->AutoPrune;
pr->ActionOnPurge = pool->action_on_purge;
- pr->Recycle = pool->Recycle;
pr->MaxPoolBytes = pool->MaxPoolBytes;
if (pool->label_format) {
bstrncpy(pr->LabelFormat, pool->label_format, sizeof(pr->LabelFormat));
bool *copies)
{
bool fnid_found=false;
- *fnid=0;
*client=NULL;
- *versions=false;
- *copies=false;
+ if (copies) {
+ *copies=false;
+ }
+ if (fnid) {
+ *fnid=0;
+ }
+ if (versions) {
+ *versions=false;
+ }
for (int i=1; i<ua->argc; i++) {
if (fnid && strcasecmp(ua->argk[i], NT_("fnid")) == 0) {
drive, sd);
}
} else {
- Dmsg1(0, "Can't find MediaId=%lu\n", mr.MediaId);
+ Dmsg1(10, "Can't find MediaId=%lu\n", mr.MediaId);
}
}
"skipping new parts. Current sequence is %d\n"),
row[1], node->delta_seq);
- Dmsg3(0, "Something is wrong with Delta, skip it "
+ Dmsg3(50, "Something is wrong with Delta, skip it "
"fname=%s d1=%d d2=%d\n", row[1], node->delta_seq, delta_seq);
}
return 0;
sz = get_resource_size(resinx + r_first);
if (sz < 0) {
- Dmsg1(0, "Unknown resource type %d\n", resinx);
+ Dmsg1(10, "Unknown resource type %d\n", resinx);
continue;
}
if (chk_dbglvl(DT_SNAPSHOT|100)) {
for (i = 0; env[i] ; i++) {
- Dmsg1(0, "%s\n", env[i]);
+ Dmsg1(DT_SNAPSHOT|100, "%s\n", env[i]);
}
}
OK = !jcr->is_canceled();
break;
case -1:
- Dmsg1(0, "Bad call to select ERR=%d\n", errno);
+ Dmsg1(10, "Bad call to select ERR=%d\n", errno);
OK = false;
break;
default:
default:
Jmsg(jcr, M_WARNING, 0, _("Unknown stream=%d ignored. This shouldn't happen!\n"),
rds->stream);
- Dmsg2(0, "Unknown stream=%d data=%s\n", rds->stream, rds->content);
+ Dmsg2(50, "Unknown stream=%d data=%s\n", rds->stream, rds->content);
break;
}
if (rds->content) {
}
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, bmsg->rbuf);
+ Dmsg2(50, "Unknown stream=%d data=%s\n", rctx.stream, bmsg->rbuf);
break;
} /* end switch(stream) */
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));
+ Dmsg2(10, "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));
+ Dmsg2(10, "Unable to open %s ERR=%s\n", dst, be.bstrerror(errno));
goto bail_out;
}
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));
+ Dmsg3(10, "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));
+ Dmsg2(10, "Unable to close %s properly. ERR=%s\n", dst, be.bstrerror(errno));
return -1;
}
/* Success! */
{
if (scan_string(line, "Events: code=%127s daemon=%127s ref=%llx type=%127s source=%127s text=",
EventsCode, EventsDaemon, &EventsRef, EventsType, EventsSource) != 5) {
- Dmsg1(0, "Malformed Audit message [%s]\n", line);
+ Dmsg1(50, "Malformed Audit message [%s]\n", line);
return false; /* invalid format */
}
unbash_spaces(EventsSource);
}
if ((script->when & SCRIPT_AtJobCompletion) && (when & SCRIPT_AtJobCompletion)) {
- Dmsg1(0, "AtJobCompletion jobstatus=%c\n", jcr->JobStatus);
+ Dmsg1(200, "AtJobCompletion jobstatus=%c\n", jcr->JobStatus);
if ((script->on_success &&
(jcr->JobStatus == JS_Terminated || jcr->JobStatus == JS_Warnings))
|| (script->on_failure &&
free_volume(dev);
/* Store new Volume name */
q = dev->VolHdr.VolumeName;
- for (int i=0; *p != ' ' && i < 6; i++) {
+ for (int j=0; *p != ' ' && j < 6; j++) {
*q++ = *p++;
}
*q = 0;
DEVICE *dev = dcr->dev;
JCR *jcr = dcr->jcr;
const char *old_vol_name;
- int slot;
uint32_t timeout = dcr->device->max_changer_wait;
bool ok = true;
if (loaded > 0) {
POOL_MEM results(PM_MESSAGE);
POOLMEM *changer = get_pool_memory(PM_FNAME);
+ int slot;
Jmsg(jcr, M_INFO, 0,
_("3307 Issuing autochanger \"unload Volume %s, Slot %d, Drive %d\" command.\n"),
old_vol_name, loaded, dev->drive_index);
DEVRES *device;
int retries = 0; /* wait for device retries */
int loaded;
- int i;
if (!changer || !changer->device) {
return false;
* The above fails to loop through all devices. It is
* probably a compiler bug.
*/
- for (i=0; i < changer->device->size(); i++) {
+ for (int i=0; i < changer->device->size(); i++) {
device = (DEVRES *)changer->device->get(i);
dev = device->dev;
if (!dev) {
str = NPRT(dcr->device->control_name);
break;
case 'd':
- sprintf(add, "%d", dcr->dev->drive_index);
+ sprintf(add, "%u", dcr->dev->drive_index);
str = add;
break;
case 'o':
if (scan_string(fd->msg, "testnetwork bytes=%lld rtt=%lld bw=%lld", &nb, &nbrtt, &bandwidth) != 3) {
if (scan_string(fd->msg, "testnetwork bytes=%lld", &nb) != 1) {
- Dmsg1(0, "Invalid command %s\n", fd->msg);
+ Dmsg1(50, "Invalid command %s\n", fd->msg);
return false;
}
}
working(NULL),
statp(), /* will be zero initialized */
xtrabackupconf(NULL),
+ backup_binary(NULL),
+ stream_binary(NULL),
bpipe(NULL)
{
};