static bool already_here = false;
if (already_here) { /* avoid recursive temination problems */
+ bmicrosleep(2, 0); /* yield */
exit(1);
}
already_here = true;
generate_daemon_event(NULL, "Exit");
write_state_file(director->working_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
delete_pid_file(director->pid_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
-// signal(SIGCHLD, SIG_IGN); /* don't worry about children now */
term_scheduler();
term_job_server();
if (runjob) {
/*
* Now send JobId and authorization key
*/
- bnet_fsend(fd, jobcmd, edit_int64(jcr->JobId, ed1), jcr->Job, jcr->VolSessionId,
+ fd->fsend(jobcmd, edit_int64(jcr->JobId, ed1), jcr->Job, jcr->VolSessionId,
jcr->VolSessionTime, jcr->sd_auth_key);
+ if (debug_level == 3) {
+ Dmsg1(000, ">filed: %s", fd->msg);
+ }
if (strcmp(jcr->sd_auth_key, "dummy") != 0) {
memset(jcr->sd_auth_key, 0, strlen(jcr->sd_auth_key));
}
Dmsg1(100, ">stored: %s\n", sd->msg);
if (bget_dirmsg(sd) > 0) {
Dmsg1(100, "<stored: %s", sd->msg);
+ if (debug_level == 3) {
+ Dmsg1(000, "<stored: %s", sd->msg);
+ }
if (sscanf(sd->msg, OKjob, &jcr->VolSessionId,
&jcr->VolSessionTime, &auth_key) != 3) {
Dmsg1(100, "BadJob=%s\n", sd->msg);
}
/* Respond to SD challenge */
+ if (debug_level == 3) {
+ Dmsg1(000, "sd_auth_key=%s\n", jcr->sd_auth_key);
+ }
auth_success = cram_md5_respond(sd, jcr->sd_auth_key, &tls_remote_need, &compatible);
if (job_canceled(jcr)) {
auth_success = false; /* force quick exit */
auth_fatal:
/* Destroy session key */
memset(jcr->sd_auth_key, 0, strlen(jcr->sd_auth_key));
+ if (debug_level == 3) {
+ Dmsg0(000, "zap sd_auth_key\n");
+ }
stop_bsock_timer(tid);
/* Single thread all failures to avoid DOS */
if (!auth_success) {
static bool already_here = false;
if (already_here) {
+ bmicrosleep(2, 0); /* yield */
exit(1); /* prevent loops */
}
already_here = true;
}
debug_level = level;
set_trace(trace_flag);
- return bnet_fsend(dir, OKsetdebug, level);
+ return dir->fsend(OKsetdebug, level);
}
if (sscanf(dir->msg, estimatecmd, &jcr->listing) != 1) {
pm_strcpy(jcr->errmsg, dir->msg);
Jmsg(jcr, M_FATAL, 0, _("Bad estimate command: %s"), jcr->errmsg);
- bnet_fsend(dir, _("2992 Bad estimate command.\n"));
+ dir->fsend(_("2992 Bad estimate command.\n"));
return 0;
}
make_estimate(jcr);
- bnet_fsend(dir, OKest, jcr->num_files_examined,
+ dir->fsend(OKest, jcr->num_files_examined,
edit_uint64_with_commas(jcr->JobBytes, ed2));
bnet_sig(dir, BNET_EOD);
return 1;
POOLMEM *sd_auth_key;
sd_auth_key = get_memory(dir->msglen);
+ if (debug_level == 3) {
+ Dmsg1(000, "<dird: %s", dir->msg);
+ }
if (sscanf(dir->msg, jobcmd, &jcr->JobId, jcr->Job,
&jcr->VolSessionId, &jcr->VolSessionTime,
sd_auth_key) != 5) {
return 0;
}
jcr->sd_auth_key = bstrdup(sd_auth_key);
+ if (debug_level == 3) {
+ Dmsg1(000, "sd_auth_key=%s\n", jcr->sd_auth_key);
+ }
free_pool_memory(sd_auth_key);
Dmsg2(120, "JobId=%d Auth=%s\n", jcr->JobId, jcr->sd_auth_key);
- return bnet_fsend(dir, OKjob, VERSION, LSMDATE, HOST_OS, DISTNAME, DISTVER);
+ return dir->fsend(OKjob, VERSION, LSMDATE, HOST_OS, DISTNAME, DISTVER);
}
static int runbefore_cmd(JCR *jcr)
if (sscanf(dir->msg, runbefore, cmd) != 1) {
pm_strcpy(jcr->errmsg, dir->msg);
Jmsg1(jcr, M_FATAL, 0, _("Bad RunBeforeJob command: %s\n"), jcr->errmsg);
- bnet_fsend(dir, _("2905 Bad RunBeforeJob command.\n"));
+ dir->fsend(_("2905 Bad RunBeforeJob command.\n"));
free_memory(cmd);
return 0;
}
-/*
- * Authenticate caller
- *
- * Kern Sibbald, October 2000
- *
- * Version $Id$
- *
- */
/*
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.
(FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
Switzerland, email:ftf@fsfeurope.org.
*/
+/*
+ * Authenticate caller
+ *
+ * Kern Sibbald, October 2000
+ *
+ * Version $Id$
+ *
+ */
+
#include "bacula.h"
#include "stored.h"
/* Timeout Hello after 5 mins */
btimer_t *tid = start_bsock_timer(fd, AUTH_TIMEOUT);
/* Challenge FD */
+ if (debug_level == 3) {
+ Pmsg1(000, "sd_auth_key=%s\n", jcr->sd_auth_key);
+ }
auth_success = cram_md5_challenge(fd, jcr->sd_auth_key, tls_local_need, compatible);
if (auth_success) {
/* Respond to his challenge */
/* Clean up device packet so it can be reused */
clear_opened();
- state &= ~(ST_LABEL|ST_READ|ST_APPEND|ST_EOT|ST_WEOT|ST_EOF);
+ state &= ~(ST_LABEL|ST_READ|ST_APPEND|ST_EOT|ST_WEOT|ST_EOF|
+ ST_MOUNTED|ST_MEDIA|ST_SHORT|ST_FREESPACE_OK|ST_PART_SPOOLED);
label_type = B_BACULA_LABEL;
file = block_num = 0;
file_size = 0;
&write_part_after_job, &PreferMountedVols);
if (stat != 13) {
pm_strcpy(jcr->errmsg, dir->msg);
- bnet_fsend(dir, BAD_job, stat, jcr->errmsg);
+ dir->fsend(BAD_job, stat, jcr->errmsg);
Dmsg1(100, ">dird: %s", dir->msg);
set_jcr_job_status(jcr, JS_ErrorTerminated);
return false;
* Pass back an authorization key for the File daemon
*/
make_session_key(auth_key, NULL, 1);
- bnet_fsend(dir, OKjob, jcr->VolSessionId, jcr->VolSessionTime, auth_key);
+ dir->fsend(OKjob, jcr->VolSessionId, jcr->VolSessionTime, auth_key);
+ if (debug_level == 3) {
+ Dmsg1(000, ">dird: %s", dir->msg);
+ }
Dmsg1(100, ">dird: %s", dir->msg);
jcr->sd_auth_key = bstrdup(auth_key);
memset(auth_key, 0, sizeof(auth_key));
}
V(mutex);
+ if (debug_level == 3) {
+ Dmsg0(000, "Zap sd_auth_key\n");
+ }
memset(jcr->sd_auth_key, 0, strlen(jcr->sd_auth_key));
if (jcr->authenticated && !job_canceled(jcr)) {
}
ok = dir_update_device(jcr, device->dev);
if (ok) {
- ok = bnet_fsend(dir, OK_query);
+ ok = dir->fsend(OK_query);
} else {
- bnet_fsend(dir, NO_query);
+ dir->fsend(NO_query);
}
return ok;
}
}
ok = dir_update_changer(jcr, changer);
if (ok) {
- ok = bnet_fsend(dir, OK_query);
+ ok = dir->fsend(OK_query);
} else {
- bnet_fsend(dir, NO_query);
+ dir->fsend(NO_query);
}
return ok;
}
/* If we get here, the device/autochanger was not found */
unbash_spaces(dir->msg);
pm_strcpy(jcr->errmsg, dir->msg);
- bnet_fsend(dir, NO_device, dev_name.c_str());
+ dir->fsend(NO_device, dev_name.c_str());
Dmsg1(100, ">dird: %s\n", dir->msg);
} else {
unbash_spaces(dir->msg);
pm_strcpy(jcr->errmsg, dir->msg);
- bnet_fsend(dir, BAD_query, jcr->errmsg);
+ dir->fsend(BAD_query, jcr->errmsg);
Dmsg1(100, ">dird: %s\n", dir->msg);
}
{
Dmsg1(900, "stored_free_jcr JobId=%u\n", jcr->JobId);
if (jcr->file_bsock) {
- bnet_close(jcr->file_bsock);
+ jcr->file_bsock->close();
jcr->file_bsock = NULL;
}
if (jcr->job_name) {
JCR *jcr;
if (in_here) { /* prevent loops */
+ bmicrosleep(2, 0); /* yield */
exit(1);
}
in_here = true;
General:
13Sep07
+kes Add code to help Dan debug 2drive-incremental-2disk test.
+kes Add code to try to fix bug #908.
+kes Add waits to multiple exit detection code to try to force pid
+ file to always be deleted.
+kes Restore good dev.tar.gz to rescue set appropriate binary property.
+ This fixes bug #950.
kes Fix seg fault in error exit of acquire_for_read after unsuccessfully
trying to switch drives by checking for blocking before unblocking.
Fixes bug #906.