static int create_fileset_record(B_DB *db, FILESET_DBR *fsr);
static int create_jobmedia_record(B_DB *db, JCR *jcr);
static JCR *create_jcr(JOB_DBR *jr, DEV_RECORD *rec, uint32_t JobId);
-static int update_MD5_record(B_DB *db, char *MD5buf, DEV_RECORD *rec);
+static int update_SIG_record(B_DB *db, char *SIGbuf, DEV_RECORD *rec, int type);
/* Global variables */
static void usage()
{
fprintf(stderr, _(
-"\nVersion: " VERSION " (" DATE ")\n\n"
+"\nVersion: " VERSION " (" BDATE ")\n\n"
"Usage: bscan [-d debug_level] <bacula-archive>\n"
" -b bootstrap specify a bootstrap file\n"
" -c <file> specify configuration file\n"
}
strcat(lname, lp); /* "save" link name */
if (verbose > 1) {
- decode_stat(ap, &statp);
+ uint32_t LinkFI;
+ decode_stat(ap, &statp, &LinkFI);
print_ls_output(fname, lname, type, &statp);
}
mjcr = get_jcr_by_session(rec->VolSessionId, rec->VolSessionTime);
} else if (rec->Stream == STREAM_MD5_SIGNATURE) {
- char MD5buf[30];
+ char MD5buf[50];
bin_to_base64(MD5buf, (char *)rec->data, 16); /* encode 16 bytes */
if (verbose > 1) {
Pmsg1(000, _("Got MD5 record: %s\n"), MD5buf);
}
- update_MD5_record(db, MD5buf, rec);
+ update_SIG_record(db, MD5buf, rec, MD5_SIG);
+
+ } else if (rec->Stream == STREAM_SHA1_SIGNATURE) {
+ char SIGbuf[50];
+ bin_to_base64(SIGbuf, (char *)rec->data, 20); /* encode 20 bytes */
+ if (verbose > 1) {
+ Pmsg1(000, _("Got SHA1 record: %s\n"), SIGbuf);
+ }
+ update_SIG_record(db, SIGbuf, rec, SHA1_SIG);
+
} else if (rec->Stream == STREAM_PROGRAM_NAMES) {
if (verbose) {
}
/*
- * Simulate the database call that updates the MD5 record
+ * Simulate the database call that updates the MD5/SHA1 record
*/
-static int update_MD5_record(B_DB *db, char *MD5buf, DEV_RECORD *rec)
+static int update_SIG_record(B_DB *db, char *SIGbuf, DEV_RECORD *rec, int type)
{
JCR *mjcr;
mjcr = get_jcr_by_session(rec->VolSessionId, rec->VolSessionTime);
if (!mjcr) {
if (mr.VolJobs > 0) {
- Pmsg2(000, _("Could not find SessId=%d SessTime=%d for MD5 record.\n"),
+ Pmsg2(000, _("Could not find SessId=%d SessTime=%d for MD5/SHA1 record.\n"),
rec->VolSessionId, rec->VolSessionTime);
} else {
ignored_msgs++;
return 1;
}
- if (!db_add_MD5_to_file_record(bjcr, db, mjcr->FileId, MD5buf)) {
- Pmsg1(0, _("Could not add MD5 to File record. ERR=%s\n"), db_strerror(db));
+ if (!db_add_SIG_to_file_record(bjcr, db, mjcr->FileId, SIGbuf, type)) {
+ Pmsg1(0, _("Could not add MD5/SHA1 to File record. ERR=%s\n"), db_strerror(db));
free_jcr(mjcr);
return 0;
}
if (verbose > 1) {
- Pmsg0(000, _("Updated MD5 record\n"));
+ Pmsg0(000, _("Updated MD5/SHA1 record\n"));
}
free_jcr(mjcr);
return 1;