/*
* Close a bfd check that we are at the expected file offset.
- * Makes some code in set_attributes().
+ * Makes use of some code from set_attributes().
*/
static int bclose_chksize(JCR *jcr, BFILE *bfd, boffset_t osize)
{
deallocate_fork_cipher(rctx);
}
- set_attributes(jcr, attr, &rctx.bfd);
+ if (jcr->plugin) {
+ plugin_set_attributes(jcr, attr, &rctx.bfd);
+ } else {
+ set_attributes(jcr, attr, &rctx.bfd);
+ }
extract = false;
/* Verify the cryptographic signature, if any */
bclose(&rctx.bfd);
}
+ /* TODO: manage deleted files */
+ if (rctx.type == FT_DELETED) { /* deleted file */
+ continue;
+ }
+
/*
* Unpack attributes and do sanity check them
*/
build_attr_output_fnames(jcr, attr);
/*
- * Now determine if we are extracting or not.
+ * Try to actually create the file, which returns a status telling
+ * us if we need to extract or not.
*/
jcr->num_files_examined++;
extract = false;
- stat = create_file(jcr, attr, &rctx.bfd, jcr->replace);
+ if (jcr->plugin) {
+ stat = plugin_create_file(jcr, attr, &rctx.bfd, jcr->replace);
+ } else {
+ stat = create_file(jcr, attr, &rctx.bfd, jcr->replace);
+ }
Dmsg2(30, "Outfile=%s create_file stat=%d\n", attr->ofname, stat);
switch (stat) {
case CF_ERROR:
}
if (!extract) {
/* set attributes now because file will not be extracted */
- set_attributes(jcr, attr, &rctx.bfd);
+ if (jcr->plugin) {
+ plugin_set_attributes(jcr, attr, &rctx.bfd);
+ } else {
+ set_attributes(jcr, attr, &rctx.bfd);
+ }
}
break;
}
}
break;
+ case STREAM_PLUGIN_NAME:
+ Dmsg1(000, "restore stream_plugin_name=%s\n", sd->msg);
+ plugin_name_stream(jcr, sd->msg);
+ break;
+
default:
/* If extracting, wierd stream (not 1 or 2), close output file anyway */
if (extract) {
deallocate_cipher(rctx);
deallocate_fork_cipher(rctx);
- set_attributes(jcr, attr, &rctx.bfd);
+ if (jcr->plugin) {
+ plugin_set_attributes(jcr, attr, &rctx.bfd);
+ } else {
+ set_attributes(jcr, attr, &rctx.bfd);
+ }
/* Verify the cryptographic signature if any */
rctx.type = attr->type;
deallocate_cipher(rctx);
deallocate_fork_cipher(rctx);
- set_attributes(jcr, attr, &rctx.bfd);
+ if (jcr->plugin) {
+ plugin_set_attributes(jcr, attr, &rctx.bfd);
+ } else {
+ set_attributes(jcr, attr, &rctx.bfd);
+ }
/* Verify the cryptographic signature on the last file, if any */
rctx.type = attr->type;
}
#endif
-static int do_file_digest(FF_PKT *ff_pkt, void *pkt, bool top_level)
+static int do_file_digest(JCR *jcr, FF_PKT *ff_pkt, bool top_level)
{
- JCR *jcr = (JCR *)pkt;
Dmsg1(50, "do_file_digest jcr=%p\n", jcr);
return (digest_file(jcr, ff_pkt, jcr->crypto.digest));
}
/* Checksum the entire file */
/* Make sure we don't modify JobBytes by saving and restoring it */
saved_bytes = jcr->JobBytes;
- if (find_one_file(jcr, jcr->ff, do_file_digest, jcr, jcr->last_fname, (dev_t)-1, 1) != 0) {
+ if (find_one_file(jcr, jcr->ff, do_file_digest, jcr->last_fname, (dev_t)-1, 1) != 0) {
Jmsg(jcr, M_ERROR, 0, _("Digest one file failed for file: %s\n"),
jcr->last_fname);
jcr->JobBytes = saved_bytes;
* packet length may be re-read by unser_crypto_packet_len() */
cipher_ctx->packet_len = 0;
}
-
return wsize;
}