static bool crypto_session_start(JCR *jcr);
static void crypto_session_end(JCR *jcr);
static bool crypto_session_send(JCR *jcr, BSOCK *sd);
+static void close_vss_backup_session(JCR *jcr);
/**
* Find all the requested files and send them
jcr->xattr_data->nr_errors);
}
+ close_vss_backup_session(jcr);
+
accurate_finish(jcr); /* send deleted or base file list to SD */
stop_heartbeat_monitor(jcr);
sm_check(__FILE__, __LINE__, true);
}
}
+
+static void close_vss_backup_session(JCR *jcr)
+{
+#if defined(WIN32_VSS)
+ /* STOP VSS ON WIN32 */
+ /* tell vss to close the backup session */
+ if (jcr->VSS) {
+ if (g_pVSSClient->CloseBackup()) {
+ /* inform user about writer states */
+ for (int i=0; i<(int)g_pVSSClient->GetWriterCount(); i++) {
+ int msg_type = M_INFO;
+ if (g_pVSSClient->GetWriterState(i) < 1) {
+ msg_type = M_WARNING;
+ jcr->JobErrors++;
+ }
+ Jmsg(jcr, msg_type, 0, _("VSS Writer (BackupComplete): %s\n"), g_pVSSClient->GetWriterInfo(i));
+ }
+ }
+ }
+#endif
+}
if (plug_func(plugin)->startBackupFile(jcr->plugin_ctx, &sp) != bRC_OK) {
goto bail_out;
}
- if (sp.type == 0 || sp.fname == NULL) {
- Jmsg1(jcr, M_FATAL, 0, _("Command plugin \"%s\" returned bad startBackupFile packet.\n"),
+ if (sp.type == 0) {
+ Jmsg1(jcr, M_FATAL, 0, _("Command plugin \"%s\": no type in startBackupFile packet.\n"),
cmd);
goto bail_out;
}
* Copy fname and link because save_file() zaps them. This
* avoids zaping the plugin's strings.
*/
- pm_strcpy(fname, sp.fname);
- pm_strcpy(link, sp.link);
- ff_pkt->fname = fname.c_str();
- ff_pkt->link = link.c_str();
ff_pkt->type = sp.type;
if (sp.type == FT_RESTORE_FIRST) {
+ if (!sp.object_name) {
+ Jmsg1(jcr, M_FATAL, 0, _("Command plugin \"%s\": no object_name in startBackupFile packet.\n"),
+ cmd);
+ goto bail_out;
+ }
+ pm_strcpy(fname, sp.object_name);
+ ff_pkt->fname = fname.c_str();
ff_pkt->LinkFI = sp.index; /* restore object index */
ff_pkt->object = sp.object;
ff_pkt->object_len = sp.object_len;
+ } else {
+ if (!sp.fname) {
+ Jmsg1(jcr, M_FATAL, 0, _("Command plugin \"%s\": no fname in startBackupFile packet.\n"),
+ cmd);
+ goto bail_out;
+ }
+ pm_strcpy(fname, sp.fname);
+ pm_strcpy(link, sp.link);
+ ff_pkt->fname = fname.c_str();
+ ff_pkt->link = link.c_str();
}
+
memcpy(&ff_pkt->statp, &sp.statp, sizeof(ff_pkt->statp));
Dmsg2(dbglvl, "startBackup returned type=%d, fname=%s\n", sp.type, sp.fname);
if (sp.object) {
uint32_t flags; /* Bacula internal flags */
bool portable; /* set if data format is portable */
char *cmd; /* command */
+ char *object_name; /* Object name to create */
char *object; /* restore object data to save */
int32_t object_len; /* restore object length */
int32_t index; /* restore object index */
cleanup:
#if defined(WIN32_VSS)
- /* STOP VSS ON WIN32 */
- /* tell vss to close the backup session */
if (jcr->VSS) {
- if (g_pVSSClient->CloseBackup()) {
- /* inform user about writer states */
- for (int i=0; i<(int)g_pVSSClient->GetWriterCount(); i++) {
- int msg_type = M_INFO;
- if (g_pVSSClient->GetWriterState(i) < 1) {
- msg_type = M_WARNING;
- jcr->JobErrors++;
- }
- Jmsg(jcr, msg_type, 0, _("VSS Writer (BackupComplete): %s\n"), g_pVSSClient->GetWriterInfo(i));
- }
- }
Win32ConvCleanupCache();
V(vss_mutex);
}
return bRC_Error;
}
time_t now = time(NULL);
- sp->fname = (char *)"james.xml";
+ sp->object_name = (char *)"james.xml";
sp->object = (char *)"This is test data for the restore object.";
sp->object_len = strlen(sp->object);
sp->index = 2;