/* Responses received from File daemon */
-static char OKinc[] = "2000 OK include\n";
-static char OKexc[] = "2000 OK exclude\n";
-static char OKjob[] = "2000 OK Job";
+static char OKinc[] = "2000 OK include\n";
+static char OKexc[] = "2000 OK exclude\n";
+static char OKjob[] = "2000 OK Job";
+static char OKbootstrap[] = "2000 OK bootstrap\n";
/* Forward referenced functions */
set_jcr_job_status(jcr, JS_ErrorTerminated);
return 0;
} else {
- /***** ***FIXME***** update Client Uname */
+ CLIENT_DBR cr;
+ memset(&cr, 0, sizeof(cr));
+ bstrncpy(cr.Name, jcr->client->hdr.name, sizeof(cr.Name));
+ cr.AutoPrune = jcr->client->AutoPrune;
+ cr.FileRetention = jcr->client->FileRetention;
+ cr.JobRetention = jcr->client->JobRetention;
+ bstrncpy(cr.Uname, fd->msg+strlen(OKjob)+1, sizeof(cr.Uname));
+ if (!db_update_client_record(jcr, jcr->db, &cr)) {
+ Jmsg(jcr, M_WARNING, 0, _("Error updating Client record. ERR=%s\n"),
+ db_strerror(jcr->db));
+ }
}
} else {
- Jmsg(jcr, M_FATAL, 0, _("<filed: bad response to JobId command: %s\n"),
+ Jmsg(jcr, M_FATAL, 0, _("FD gave bad response to JobId command: %s\n"),
bnet_strerror(fd));
set_jcr_job_status(jcr, JS_ErrorTerminated);
return 0;
/*
- * Send either an Included or an Excluded list
+ * Send either an Included or an Excluded list to FD
*/
static int send_list(JCR *jcr, int list)
{
}
for (int j=0; j<ie->num_names; j++) {
p = ie->name_list[j];
- switch (*p++) {
+ switch (*p) {
case '|':
fd->msg = edit_job_codes(jcr, fd->msg, p, "");
bpipe = open_bpipe(fd->msg, 0, "r");
}
break;
case '<':
+ p++; /* skip over < */
if ((ffd = fopen(p, "r")) == NULL) {
Jmsg(jcr, M_FATAL, 0, _("Cannot open %s file: %s. ERR=%s\n"),
list==INC_LIST?"included":"excluded", p, strerror(errno));
}
fclose(ffd);
break;
+ case '\\':
+ p++; /* skip over \ */
+ /* Note, fall through wanted */
default:
if (ie->num_opts) {
pm_strcpy(&fd->msg, ie->opts_list[0]->opts);
} else {
pm_strcpy(&fd->msg, "0 ");
}
- pm_strcat(&fd->msg, ie->name_list[j]);
+ pm_strcat(&fd->msg, p);
Dmsg1(100, "Inc/Exc name=%s\n", fd->msg);
fd->msglen = strlen(fd->msg);
if (!bnet_send(fd)) {
}
bnet_sig(fd, BNET_EOD); /* end of data */
if (list == INC_LIST) {
- if (!response(fd, OKinc, "Include")) {
+ if (!response(jcr, fd, OKinc, "Include", DISPLAY_ERROR)) {
goto bail_out;
}
- } else if (!response(fd, OKexc, "Exclude")) {
+ } else if (!response(jcr, fd, OKexc, "Exclude", DISPLAY_ERROR)) {
goto bail_out;
}
return 1;
}
+/*
+ * Send bootstrap file if any to the File daemon.
+ * This is used for restore and verify VolumeToCatalog
+ */
+int send_bootstrap_file(JCR *jcr)
+{
+ FILE *bs;
+ char buf[1000];
+ BSOCK *fd = jcr->file_bsock;
+ char *bootstrap = "bootstrap\n";
+
+ Dmsg1(400, "send_bootstrap_file: %s\n", jcr->RestoreBootstrap);
+ if (!jcr->RestoreBootstrap) {
+ return 1;
+ }
+ bs = fopen(jcr->RestoreBootstrap, "r");
+ if (!bs) {
+ Jmsg(jcr, M_FATAL, 0, _("Could not open bootstrap file %s: ERR=%s\n"),
+ jcr->RestoreBootstrap, strerror(errno));
+ set_jcr_job_status(jcr, JS_ErrorTerminated);
+ return 0;
+ }
+ strcpy(fd->msg, bootstrap);
+ fd->msglen = strlen(fd->msg);
+ bnet_send(fd);
+ while (fgets(buf, sizeof(buf), bs)) {
+ fd->msglen = Mmsg(&fd->msg, "%s", buf);
+ bnet_send(fd);
+ }
+ bnet_sig(fd, BNET_EOD);
+ fclose(bs);
+ if (!response(jcr, fd, OKbootstrap, "Bootstrap", DISPLAY_ERROR)) {
+ set_jcr_job_status(jcr, JS_ErrorTerminated);
+ return 0;
+ }
+ return 1;
+}
+
+
/*
* Read the attributes from the File daemon for
* a Verify job and store them in the catalog.
Dmsg0(120, "bdird: waiting to receive file attributes\n");
/* Pickup file attributes and signature */
- while (!fd->errors && (n = bget_msg(fd, 0)) > 0) {
+ while (!fd->errors && (n = bget_dirmsg(fd)) > 0) {
/*****FIXME****** improve error handling to stop only on
* really fatal problems, or the number of errors is too
*fn = *p++; /* term filename and point to attribs */
attr = p;
- if (stream == STREAM_UNIX_ATTRIBUTES || stream == STREAM_WIN32_ATTRIBUTES) {
+ if (stream == STREAM_UNIX_ATTRIBUTES || stream == STREAM_UNIX_ATTRIBUTES_EX) {
jcr->JobFiles++;
jcr->FileIndex = file_index;
ar.attr = attr;