/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2008 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
char Job[MAX_NAME_LENGTH];
char MsgType[20];
int type, level;
- JCR *jcr;
+ JCR *jcr = bs->jcr();
char *msg;
for (;;) {
bs->fsend("btime %s\n", edit_uint64(get_current_btime(),ed1));
break;
default:
- Emsg1(M_WARNING, 0, _("bget_dirmsg: unknown bnet signal %d\n"), bs->msglen);
+ Jmsg1(jcr, M_WARNING, 0, _("bget_dirmsg: unknown bnet signal %d\n"), bs->msglen);
return n;
}
continue;
* Try to fulfill it.
*/
if (sscanf(bs->msg, "%020s Job=%127s ", MsgType, Job) != 2) {
- Emsg1(M_ERROR, 0, _("Malformed message: %s\n"), bs->msg);
+ Jmsg1(jcr, M_ERROR, 0, _("Malformed message: %s\n"), bs->msg);
continue;
}
- if (strcmp(Job, "*System*") == 0) {
- jcr = NULL; /* No jcr */
- } else if (!(jcr=get_jcr_by_full_name(Job))) {
- Emsg1(M_ERROR, 0, _("Job not found: %s\n"), bs->msg);
- continue;
- }
- Dmsg1(900, "Getmsg got jcr 0x%x\n", jcr);
/* Skip past "Jmsg Job=nnn" */
if (!(msg=find_msg_start(bs->msg))) {
- Emsg1(M_ERROR, 0, _("Malformed message: %s\n"), bs->msg);
- free_jcr(jcr);
+ Jmsg1(jcr, M_ERROR, 0, _("Malformed message: %s\n"), bs->msg);
continue;
}
if (bs->msg[0] == 'J') { /* Job message */
if (sscanf(bs->msg, "Jmsg Job=%127s type=%d level=%d",
Job, &type, &level) != 3) {
- Emsg1(M_ERROR, 0, _("Malformed message: %s\n"), bs->msg);
- free_jcr(jcr);
+ Jmsg1(jcr, M_ERROR, 0, _("Malformed message: %s\n"), bs->msg);
continue;
}
Dmsg1(900, "Got msg: %s\n", bs->msg);
}
Dmsg1(900, "Dispatch msg: %s", msg);
dispatch_message(jcr, type, level, msg);
- free_jcr(jcr);
continue;
}
/*
if (bs->msg[0] == 'C') { /* Catalog request */
Dmsg2(900, "Catalog req jcr 0x%x: %s", jcr, bs->msg);
catalog_request(jcr, bs);
- Dmsg1(900, "Calling freejcr 0x%x\n", jcr);
- free_jcr(jcr);
continue;
}
if (bs->msg[0] == 'U') { /* SD sending attributes */
Dmsg2(900, "Catalog upd jcr 0x%x: %s", jcr, bs->msg);
catalog_update(jcr, bs);
- Dmsg1(900, "Calling freejcr 0x%x\n", jcr);
- free_jcr(jcr);
continue;
}
if (bs->msg[0] == 'M') { /* Mount request */
Dmsg1(900, "Mount req: %s", bs->msg);
mount_request(jcr, bs, msg);
- free_jcr(jcr);
continue;
}
if (bs->msg[0] == 'S') { /* Status change */
int JobStatus;
char Job[MAX_NAME_LENGTH];
if (sscanf(bs->msg, Job_status, &Job, &JobStatus) == 2) {
- set_jcr_sd_job_status(jcr,JobStatus); /* current status */
+ set_jcr_sd_job_status(jcr, JobStatus); /* current status */
} else {
- Emsg1(M_ERROR, 0, _("Malformed message: %s\n"), bs->msg);
+ Jmsg1(jcr, M_ERROR, 0, _("Malformed message: %s\n"), bs->msg);
}
- free_jcr(jcr);
continue;
}
#ifdef needed