if (sscanf(dir->msg, jobcmd, &JobId, job, job_name, client_name,
&JobType, &level, fileset_name, &no_attributes,
&spool_attributes, fileset_md5) != 10) {
- bnet_fsend(dir, BAD_job, dir->msg);
- Emsg1(M_FATAL, 0, _("Bad Job Command from Director: %s\n"), dir->msg);
+ pm_strcpy(&jcr->errmsg, dir->msg);
+ bnet_fsend(dir, BAD_job, jcr->errmsg);
+ Emsg1(M_FATAL, 0, _("Bad Job Command from Director: %s\n"), jcr->errmsg);
free_memory(job);
free_memory(job_name);
free_memory(client_name);
srandom(tv.tv_usec + tv.tv_sec);
sprintf(auth_key, "%ld", (long)random());
#endif
- makeSessionKey(auth_key, NULL, 1);
+ make_session_key(auth_key, NULL, 1);
bnet_fsend(dir, OKjob, jcr->VolSessionId, jcr->VolSessionTime, auth_key);
Dmsg1(110, ">dird: %s", dir->msg);
jcr->sd_auth_key = bstrdup(auth_key);
+ memset(auth_key, 0, sizeof(auth_key));
/*
* Wait for the device, media, and pool information
*/
if (!use_device_cmd(jcr)) {
set_jcr_job_status(jcr, JS_ErrorTerminated);
+ memset(jcr->sd_auth_key, 0, strlen(jcr->sd_auth_key));
return 0;
}
* expires.
*/
P(jcr->mutex);
- for ( ;!job_cancelled(jcr); ) {
+ for ( ;!job_canceled(jcr); ) {
errstat = pthread_cond_timedwait(&jcr->job_start_wait, &jcr->mutex, &timeout);
if (errstat == 0 || errstat == ETIMEDOUT) {
break;
}
V(jcr->mutex);
- if (jcr->authenticated && !job_cancelled(jcr)) {
+ memset(jcr->sd_auth_key, 0, strlen(jcr->sd_auth_key));
+
+ if (jcr->authenticated && !job_canceled(jcr)) {
run_job(jcr); /* Run the job */
}
return 0;
* This entry point is only called if we have a separate
* Storage Daemon Data port. Otherwise, the connection
* is made to the main port, and if it is a File daemon
- * calling, handl_filed_connection() is called directly.
+ * calling, handle_filed_connection() is called directly.
*/
void connection_from_filed(void *arg)
{
}
Dmsg1(100, "got: %s\n", fd->msg);
- if (sscanf(fd->msg, "Hello Start Job %127s\n", job_name) != 1) {
- Emsg1(M_FATAL, 0, _("Authentication failure: %s\n"), fd->msg);
+ if (fd->msglen < 17 || fd->msglen > 17+127 ||
+ sscanf(fd->msg, "Hello Start Job %127s\n", job_name) != 1) {
+ Emsg1(M_FATAL, 0, _("Bad Hello from FD: %s\n"), fd->msg);
return;
}
handle_filed_connection(fd, job_name);
}
jcr->file_bsock = fd;
- jcr->file_bsock->jcr = (void *)jcr;
+ jcr->file_bsock->jcr = jcr;
Dmsg1(110, "Found Job %s\n", job_name);
P(jcr->mutex);
if (!jcr->authenticated) {
- jcr->JobStatus = JS_ErrorTerminated;
+ set_jcr_job_status(jcr, JS_ErrorTerminated);
}
pthread_cond_signal(&jcr->job_start_wait); /* wake waiting job */
V(jcr->mutex);
UnlockRes();
if (verbose) {
unbash_spaces(dir->msg);
- Jmsg(jcr, M_INFO, 0, _("Failed command: %s\n"), dir->msg);
+ pm_strcpy(&jcr->errmsg, dir->msg);
+ Jmsg(jcr, M_INFO, 0, _("Failed command: %s\n"), jcr->errmsg);
}
Jmsg(jcr, M_FATAL, 0, _("\n"
" Device \"%s\" requested by Dir not found in SD Device resources.\n"),
dev_name);
bnet_fsend(dir, NO_device, dev_name);
} else {
+ unbash_spaces(dir->msg);
+ pm_strcpy(&jcr->errmsg, dir->msg);
if (verbose) {
- unbash_spaces(dir->msg);
- Jmsg(jcr, M_INFO, 0, _("Failed command: %s\n"), dir->msg);
+ Jmsg(jcr, M_INFO, 0, _("Failed command: %s\n"), jcr->errmsg);
}
- Jmsg(jcr, M_FATAL, 0, _("store<dir: Bad Use Device command: %s\n"), dir->msg);
- bnet_fsend(dir, BAD_use, dir->msg);
+ Jmsg(jcr, M_FATAL, 0, _("Bad Use Device command: %s\n"), jcr->errmsg);
+ bnet_fsend(dir, BAD_use, jcr->errmsg);
}
free_memory(dev_name);