]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/dird/verify.c
More on barcodes
[bacula/bacula] / bacula / src / dird / verify.c
1 /*
2  *
3  *   Bacula Director -- verify.c -- responsible for running file verification
4  *
5  *     Kern Sibbald, October MM
6  *
7  *    This routine is run as a separate thread.  There may be more
8  *    work to be done to make it totally reentrant!!!!
9  * 
10  * Current implementation is Catalog verification only (i.e. no
11  *  verification versus tape).
12  *
13  *  Basic tasks done here:
14  *     Open DB
15  *     Open connection with File daemon and pass him commands
16  *       to do the verify.
17  *     When the File daemon sends the attributes, compare them to
18  *       what is in the DB.
19  *
20  *   Version $Id$
21  */
22
23 /*
24    Copyright (C) 2000-2003 Kern Sibbald and John Walker
25
26    This program is free software; you can redistribute it and/or
27    modify it under the terms of the GNU General Public License as
28    published by the Free Software Foundation; either version 2 of
29    the License, or (at your option) any later version.
30
31    This program is distributed in the hope that it will be useful,
32    but WITHOUT ANY WARRANTY; without even the implied warranty of
33    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
34    General Public License for more details.
35
36    You should have received a copy of the GNU General Public
37    License along with this program; if not, write to the Free
38    Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
39    MA 02111-1307, USA.
40
41  */
42
43 #include "bacula.h"
44 #include "dird.h"
45 #include "findlib/find.h"
46
47 /* Imported Global Variables */
48 extern int debug_level;
49
50 /* Commands sent to File daemon */
51 static char verifycmd[]    = "verify level=%s\n";
52 static char storaddr[]     = "storage address=%s port=%d\n";
53 static char sessioncmd[]   = "session %s %ld %ld %ld %ld %ld %ld\n";  
54
55 /* Responses received from File daemon */
56 static char OKverify[]    = "2000 OK verify\n";
57 static char OKstore[]     = "2000 OK storage\n";
58 static char OKsession[]   = "2000 OK session\n";
59
60 /* Forward referenced functions */
61 static void verify_cleanup(JCR *jcr, int TermCode);
62 static void prt_fname(JCR *jcr);
63 static int missing_handler(void *ctx, int num_fields, char **row);
64
65 /* 
66  * Do a verification of the specified files against the Catlaog
67  *    
68  *  Returns:  0 on failure
69  *            1 on success
70  */
71 int do_verify(JCR *jcr) 
72 {
73    char *level;
74    BSOCK   *fd;
75    JOB_DBR jr;
76    JobId_t JobId = 0;
77
78    if (!get_or_create_client_record(jcr)) {
79       goto bail_out;
80    }
81
82    Dmsg1(9, "bdird: created client %s record\n", jcr->client->hdr.name);
83
84    /* If we are doing a verify from the catalog,
85     * we must look up the time and date of the
86     * last full verify.
87     */
88    if (jcr->JobLevel == L_VERIFY_CATALOG || jcr->JobLevel == L_VERIFY_VOLUME_TO_CATALOG) {
89       memcpy(&jr, &(jcr->jr), sizeof(jr));
90       if (!db_find_last_jobid(jcr, jcr->db, &jr)) {
91          Jmsg(jcr, M_FATAL, 0, _(
92               "Unable to find JobId of previous InitCatalog Job.\n"
93               "Please run a Verify with Level=InitCatalog before\n"
94               "running the current Job.\n"));
95          goto bail_out;
96       }
97       JobId = jr.JobId;
98       Dmsg1(20, "Last full id=%d\n", JobId);
99    } 
100
101    jcr->jr.JobId = jcr->JobId;
102    jcr->jr.StartTime = jcr->start_time;
103    jcr->jr.Level = jcr->JobLevel;
104    if (!db_update_job_start_record(jcr, jcr->db, &jcr->jr)) {
105       Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db));
106       goto bail_out;
107    }
108
109    if (!jcr->fname) {
110       jcr->fname = (char *) get_pool_memory(PM_FNAME);
111    }
112
113    jcr->jr.JobId = JobId;      /* save target JobId */
114
115    /* Print Job Start message */
116    Jmsg(jcr, M_INFO, 0, _("Start Verify JobId %d Job=%s\n"),
117       jcr->JobId, jcr->Job);
118
119    if (jcr->JobLevel == L_VERIFY_CATALOG || jcr->JobLevel == L_VERIFY_VOLUME_TO_CATALOG) {
120       memset(&jr, 0, sizeof(jr));
121       jr.JobId = JobId;
122       if (!db_get_job_record(jcr, jcr->db, &jr)) {
123          Jmsg(jcr, M_FATAL, 0, _("Could not get job record. %s"), db_strerror(jcr->db));
124          goto bail_out;
125       }
126       if (jr.JobStatus != 'T') {
127          Jmsg(jcr, M_FATAL, 0, _("Last Job %d did not terminate normally. JobStatus=%c\n"),
128             JobId, jr.JobStatus);
129          goto bail_out;
130       }
131       Jmsg(jcr, M_INFO, 0, _("Verifying against JobId=%d Job=%s\n"),
132          JobId, jr.Job); 
133    }
134
135    /* 
136     * If we are verifing a Volume, we need the Storage
137     *   daemon, so open a connection, otherwise, just
138     *   create a dummy authorization key (passed to
139     *   File daemon but not used).
140     */
141    if (jcr->JobLevel == L_VERIFY_VOLUME_TO_CATALOG) {
142       /*
143        * Now find the Volumes we will need for the Verify 
144        */
145       jcr->VolumeName[0] = 0;
146       if (!db_get_job_volume_names(jcr, jcr->db, jr.JobId, &jcr->VolumeName) ||
147            jcr->VolumeName[0] == 0) {
148          Jmsg(jcr, M_FATAL, 0, _("Cannot find Volume Name for verify JobId=%d. %s"), 
149             jr.JobId, db_strerror(jcr->db));
150          goto bail_out;
151       }
152       Dmsg1(20, "Got job Volume Names: %s\n", jcr->VolumeName);
153       /*
154        * Start conversation with Storage daemon  
155        */
156       set_jcr_job_status(jcr, JS_Blocked);
157       if (!connect_to_storage_daemon(jcr, 10, SDConnectTimeout, 1)) {
158          goto bail_out;
159       }
160       /*
161        * Now start a job with the Storage daemon
162        */
163       if (!start_storage_daemon_job(jcr)) {
164          goto bail_out;
165       }
166       /*
167        * Now start a Storage daemon message thread
168        */
169       if (!start_storage_daemon_message_thread(jcr)) {
170          goto bail_out;
171       }
172       Dmsg0(50, "Storage daemon connection OK\n");
173    } else {
174       jcr->sd_auth_key = bstrdup("dummy");    /* dummy Storage daemon key */
175    }
176    /*
177     * OK, now connect to the File daemon
178     *  and ask him for the files.
179     */
180    set_jcr_job_status(jcr, JS_Blocked);
181    if (!connect_to_file_daemon(jcr, 10, FDConnectTimeout, 1)) {
182       goto bail_out;
183    }
184
185    set_jcr_job_status(jcr, JS_Running);
186    fd = jcr->file_bsock;
187
188    Dmsg0(30, ">filed: Send include list\n");
189    if (!send_include_list(jcr)) {
190       goto bail_out;
191    }
192
193    Dmsg0(30, ">filed: Send exclude list\n");
194    if (!send_exclude_list(jcr)) {
195       goto bail_out;
196    }
197
198    /* 
199     * Send Level command to File daemon, as well
200     *   as the Storage address if appropriate.
201     */
202    switch (jcr->JobLevel) {
203       case L_VERIFY_INIT:
204          level = "init";
205          break;
206       case L_VERIFY_CATALOG:
207          level = "catalog";
208          break;
209       case L_VERIFY_VOLUME_TO_CATALOG:
210          /* 
211           * send Storage daemon address to the File daemon
212           */
213          if (jcr->store->SDDport == 0) {
214             jcr->store->SDDport = jcr->store->SDport;
215          }
216          bnet_fsend(fd, storaddr, jcr->store->address, jcr->store->SDDport);
217          if (!response(fd, OKstore, "Storage", 1)) {
218             goto bail_out;
219          }
220          /*
221           * Pass the VolSessionId, VolSessionTime, Start and
222           * end File and Blocks on the session command.
223           */
224          bnet_fsend(fd, sessioncmd, 
225                    jcr->VolumeName,
226                    jr.VolSessionId, jr.VolSessionTime, 
227                    jr.StartFile, jr.EndFile, jr.StartBlock, 
228                    jr.EndBlock);
229          if (!response(fd, OKsession, "Session", 1)) {
230             goto bail_out;
231          }
232          level = "volume";
233          break;
234       case L_VERIFY_DATA:
235          level = "data";
236          break;
237       default:
238          Jmsg1(jcr, M_FATAL, 0, _("Unimplemented save level %d\n"), jcr->JobLevel);
239          goto bail_out;
240    }
241
242    /* 
243     * Send verify command/level to File daemon
244     */
245    bnet_fsend(fd, verifycmd, level);
246    if (!response(fd, OKverify, "Verify", 1)) {
247       goto bail_out;
248    }
249
250    /*
251     * Now get data back from File daemon and
252     *  compare it to the catalog or store it in the
253     *  catalog depending on the run type.
254     */
255    /* Compare to catalog */
256    switch (jcr->JobLevel) { 
257    case L_VERIFY_CATALOG:
258       Dmsg0(10, "Verify level=catalog\n");
259       get_attributes_and_compare_to_catalog(jcr, JobId);
260       break;
261
262    case L_VERIFY_VOLUME_TO_CATALOG:
263       int stat;
264       Dmsg0(10, "Verify level=volume\n");
265       get_attributes_and_compare_to_catalog(jcr, JobId);
266       stat = jcr->JobStatus;
267       set_jcr_job_status(jcr, JS_WaitSD);
268       wait_for_storage_daemon_termination(jcr);
269       /* If we terminate normally, use SD term code, else, use ours */
270       if (stat == JS_Terminated) {
271          set_jcr_job_status(jcr, jcr->SDJobStatus);
272       } else {
273          set_jcr_job_status(jcr, stat);
274       }
275       break;
276
277    case L_VERIFY_INIT:
278       /* Build catalog */
279       Dmsg0(10, "Verify level=init\n");
280       get_attributes_and_put_in_catalog(jcr);
281       break;
282
283    default:
284       Jmsg1(jcr, M_FATAL, 0, _("Unimplemented verify level %d\n"), jcr->JobLevel);
285       goto bail_out;
286    }
287
288    verify_cleanup(jcr, jcr->JobStatus);
289    return 1;
290
291 bail_out:
292    verify_cleanup(jcr, JS_ErrorTerminated);
293    return 0;
294 }
295
296 /*
297  * Release resources allocated during backup.
298  *
299  */
300 static void verify_cleanup(JCR *jcr, int TermCode)
301 {
302    char sdt[50], edt[50];
303    char ec1[30];
304    char term_code[100];
305    char *term_msg;
306    int msg_type;
307    JobId_t JobId;
308
309    Dmsg0(100, "Enter verify_cleanup()\n");
310
311    JobId = jcr->jr.JobId;
312    set_jcr_job_status(jcr, TermCode);
313
314    update_job_end_record(jcr);
315
316    msg_type = M_INFO;                 /* by default INFO message */
317    switch (TermCode) {
318       case JS_Terminated:
319          term_msg = _("Verify OK");
320          break;
321       case JS_ErrorTerminated:
322          term_msg = _("*** Verify Error ***"); 
323          msg_type = M_ERROR;          /* Generate error message */
324          break;
325       case JS_Canceled:
326          term_msg = _("Verify Canceled");
327          break;
328       case JS_Differences:
329          term_msg = _("Verify Differences");
330          break;
331       default:
332          term_msg = term_code;
333          sprintf(term_code, _("Inappropriate term code: %c\n"), TermCode);
334          break;
335    }
336    bstrftime(sdt, sizeof(sdt), jcr->jr.StartTime);
337    bstrftime(edt, sizeof(edt), jcr->jr.EndTime);
338
339    Jmsg(jcr, msg_type, 0, _("Bacula " VERSION " (" LSMDATE "): %s\n\
340 JobId:                  %d\n\
341 Job:                    %s\n\
342 FileSet:                %s\n\
343 Verify Level:           %s\n\
344 Client:                 %s\n\
345 Start time:             %s\n\
346 End time:               %s\n\
347 Files Examined:         %s\n\
348 Termination:            %s\n\n"),
349         edt,
350         jcr->jr.JobId,
351         jcr->jr.Job,
352         jcr->fileset->hdr.name,
353         level_to_str(jcr->JobLevel),
354         jcr->client->hdr.name,
355         sdt,
356         edt,
357         edit_uint64_with_commas(jcr->JobFiles, ec1),
358         term_msg);
359
360    Dmsg0(100, "Leave verify_cleanup()\n");
361    if (jcr->fname) {
362       free_memory(jcr->fname);
363       jcr->fname = NULL;
364    }
365 }
366
367 /*
368  * This routine is called only during a Verify
369  */
370 int get_attributes_and_compare_to_catalog(JCR *jcr, JobId_t JobId)
371 {
372    BSOCK   *fd;
373    int n, len;
374    FILE_DBR fdbr;
375    struct stat statf;                 /* file stat */
376    struct stat statc;                 /* catalog stat */
377    int stat = JS_Terminated;
378    char buf[MAXSTRING];
379    POOLMEM *fname = get_pool_memory(PM_MESSAGE);
380    int do_SIG = NO_SIG;
381    long file_index = 0;
382
383    memset(&fdbr, 0, sizeof(FILE_DBR));
384    fd = jcr->file_bsock;
385    fdbr.JobId = JobId;
386    jcr->FileIndex = 0;
387    
388    Dmsg0(20, "bdird: waiting to receive file attributes\n");
389    /*
390     * Get Attributes and Signature from File daemon
391     * We expect:
392     *   FileIndex
393     *   Stream
394     *   Options or SIG (MD5/SHA1)
395     *   Filename
396     *   Attributes
397     *   Link name  ???
398     */
399    while ((n=bget_msg(fd, 0)) >= 0 && !job_canceled(jcr)) {
400       int stream;
401       char *attr, *p, *fn;
402       char Opts_SIG[MAXSTRING];        /* Verify Opts or MD5/SHA1 signature */
403
404       fname = check_pool_memory_size(fname, fd->msglen);
405       jcr->fname = check_pool_memory_size(jcr->fname, fd->msglen);
406       Dmsg1(400, "Atts+SIG=%s\n", fd->msg);
407       if ((len = sscanf(fd->msg, "%ld %d %100s", &file_index, &stream, 
408             fname)) != 3) {
409          Jmsg3(jcr, M_FATAL, 0, _("bird<filed: bad attributes, expected 3 fields got %d\n\
410  mslen=%d msg=%s\n"), len, fd->msglen, fd->msg);
411          goto bail_out;
412       }
413       /*
414        * We read the Options or Signature into fname                                
415        *  to prevent overrun, now copy it to proper location.
416        */
417       bstrncpy(Opts_SIG, fname, sizeof(Opts_SIG));
418       p = fd->msg;
419       skip_nonspaces(&p);             /* skip FileIndex */
420       skip_spaces(&p);
421       skip_nonspaces(&p);             /* skip Stream */
422       skip_spaces(&p);
423       skip_nonspaces(&p);             /* skip Opts_SIG */   
424       p++;                            /* skip space */
425       fn = fname;
426       while (*p != 0) {
427          *fn++ = *p++;                /* copy filename */
428       }
429       *fn = *p++;                     /* term filename and point to attribs */
430       attr = p;
431       /*
432        * Got attributes stream, decode it
433        */
434       if (stream == STREAM_UNIX_ATTRIBUTES || stream == STREAM_WIN32_ATTRIBUTES) {
435          uint32_t LinkFIf, LinkFIc;
436          Dmsg2(400, "file_index=%d attr=%s\n", file_index, attr);
437          jcr->JobFiles++;
438          jcr->FileIndex = file_index;    /* remember attribute file_index */
439          decode_stat(attr, &statf, &LinkFIf);  /* decode file stat packet */
440          do_SIG = NO_SIG;
441          jcr->fn_printed = FALSE;
442          strcpy(jcr->fname, fname);  /* move filename into JCR */
443
444          Dmsg2(040, "dird<filed: stream=%d %s\n", stream, jcr->fname);
445          Dmsg1(020, "dird<filed: attr=%s\n", attr);
446
447          /* 
448           * Find equivalent record in the database 
449           */
450          fdbr.FileId = 0;
451          if (!db_get_file_attributes_record(jcr, jcr->db, jcr->fname, &fdbr)) {
452             Jmsg(jcr, M_INFO, 0, _("New file: %s\n"), jcr->fname);
453             Dmsg1(020, _("File not in catalog: %s\n"), jcr->fname);
454             stat = JS_Differences;
455             continue;
456          } else {
457             /* 
458              * mark file record as visited by stuffing the
459              * current JobId, which is unique, into the MarkId field.
460              */
461             db_mark_file_record(jcr, jcr->db, fdbr.FileId, jcr->JobId);
462          }
463
464          Dmsg3(400, "Found %s in catalog. inx=%d Opts=%s\n", jcr->fname, 
465             file_index, Opts_SIG);
466          decode_stat(fdbr.LStat, &statc, &LinkFIc); /* decode catalog stat */
467          /*
468           * Loop over options supplied by user and verify the
469           * fields he requests.
470           */
471          for (p=Opts_SIG; *p; p++) {
472             char ed1[30], ed2[30];
473             switch (*p) {
474             case 'i':                /* compare INODEs */
475                if (statc.st_ino != statf.st_ino) {
476                   prt_fname(jcr);
477                   Jmsg(jcr, M_INFO, 0, _("      st_ino   differ. Cat: %s File: %s\n"), 
478                      edit_uint64((uint64_t)statc.st_ino, ed1),
479                      edit_uint64((uint64_t)statf.st_ino, ed2));
480                   stat = JS_Differences;
481                }
482                break;
483             case 'p':                /* permissions bits */
484                if (statc.st_mode != statf.st_mode) {
485                   prt_fname(jcr);
486                   Jmsg(jcr, M_INFO, 0, _("      st_mode  differ. Cat: %x File: %x\n"), 
487                      (uint32_t)statc.st_mode, (uint32_t)statf.st_mode);
488                   stat = JS_Differences;
489                }
490                break;
491             case 'n':                /* number of links */
492                if (statc.st_nlink != statf.st_nlink) {
493                   prt_fname(jcr);
494                   Jmsg(jcr, M_INFO, 0, _("      st_nlink differ. Cat: %d File: %d\n"), 
495                      (uint32_t)statc.st_nlink, (uint32_t)statf.st_nlink);
496                   stat = JS_Differences;
497                }
498                break;
499             case 'u':                /* user id */
500                if (statc.st_uid != statf.st_uid) {
501                   prt_fname(jcr);
502                   Jmsg(jcr, M_INFO, 0, _("      st_uid   differ. Cat: %u File: %u\n"), 
503                      (uint32_t)statc.st_uid, (uint32_t)statf.st_uid);
504                   stat = JS_Differences;
505                }
506                break;
507             case 'g':                /* group id */
508                if (statc.st_gid != statf.st_gid) {
509                   prt_fname(jcr);
510                   Jmsg(jcr, M_INFO, 0, _("      st_gid   differ. Cat: %u File: %u\n"), 
511                      (uint32_t)statc.st_gid, (uint32_t)statf.st_gid);
512                   stat = JS_Differences;
513                }
514                break;
515             case 's':                /* size */
516                if (statc.st_size != statf.st_size) {
517                   prt_fname(jcr);
518                   Jmsg(jcr, M_INFO, 0, _("      st_size  differ. Cat: %s File: %s\n"), 
519                      edit_uint64((uint64_t)statc.st_size, ed1),
520                      edit_uint64((uint64_t)statf.st_size, ed2));
521                   stat = JS_Differences;
522                }
523                break;
524             case 'a':                /* access time */
525                if (statc.st_atime != statf.st_atime) {
526                   prt_fname(jcr);
527                   Jmsg(jcr, M_INFO, 0, _("      st_atime differs\n"));
528                   stat = JS_Differences;
529                }
530                break;
531             case 'm':
532                if (statc.st_mtime != statf.st_mtime) {
533                   prt_fname(jcr);
534                   Jmsg(jcr, M_INFO, 0, _("      st_mtime differs\n"));
535                   stat = JS_Differences;
536                }
537                break;
538             case 'c':                /* ctime */
539                if (statc.st_ctime != statf.st_ctime) {
540                   prt_fname(jcr);
541                   Jmsg(jcr, M_INFO, 0, _("      st_ctime differs\n"));
542                   stat = JS_Differences;
543                }
544                break;
545             case 'd':                /* file size decrease */
546                if (statc.st_size > statf.st_size) {
547                   prt_fname(jcr);
548                   Jmsg(jcr, M_INFO, 0, _("      st_size  decrease. Cat: %s File: %s\n"), 
549                      edit_uint64((uint64_t)statc.st_size, ed1),
550                      edit_uint64((uint64_t)statf.st_size, ed2));
551                   stat = JS_Differences;
552                }
553                break;
554             case '5':                /* compare MD5 */
555                Dmsg1(500, "set Do_MD5 for %s\n", jcr->fname);
556                do_SIG = MD5_SIG;
557                break;
558             case '1':                 /* compare SHA1 */
559                do_SIG = SHA1_SIG;
560                break;
561             case ':':
562             case 'V':
563             default:
564                break;
565             }
566          }
567       /*
568        * Got SIG Signature from Storage daemon
569        *  It came across in the Opts_SIG field.
570        */
571       } else if (stream == STREAM_MD5_SIGNATURE || stream == STREAM_SHA1_SIGNATURE) {
572          Dmsg2(400, "stream=SIG inx=%d SIG=%s\n", file_index, Opts_SIG);
573          /* 
574           * When ever we get a signature is MUST have been
575           * preceded by an attributes record, which sets attr_file_index
576           */
577          if (jcr->FileIndex != (uint32_t)file_index) {
578             Jmsg2(jcr, M_FATAL, 0, _("MD5/SHA1 index %d not same as attributes %d\n"),
579                file_index, jcr->FileIndex);
580             goto bail_out;
581          } 
582          if (do_SIG) {
583             db_escape_string(buf, Opts_SIG, strlen(Opts_SIG));
584             if (strcmp(buf, fdbr.SIG) != 0) {
585                prt_fname(jcr);
586                if (debug_level >= 10) {
587                   Jmsg(jcr, M_INFO, 0, _("      %s not same. File=%s Cat=%s\n"), 
588                        stream==STREAM_MD5_SIGNATURE?"MD5":"SHA1", buf, fdbr.SIG);
589                } else {
590                   Jmsg(jcr, M_INFO, 0, _("      %s differs.\n"), 
591                        stream==STREAM_MD5_SIGNATURE?"MD5":"SHA1");
592                }
593                stat = JS_Differences;
594             }
595             do_SIG = FALSE;
596          }
597       }
598       jcr->JobFiles = file_index;
599    } 
600    if (is_bnet_error(fd)) {
601       Jmsg2(jcr, M_FATAL, 0, _("bdird<filed: bad attributes from filed n=%d : %s\n"),
602                         n, strerror(errno));
603       goto bail_out;
604    }
605
606    /* Now find all the files that are missing -- i.e. all files in
607     *  the database where the MarkedId != current JobId
608     */
609    jcr->fn_printed = FALSE;
610    sprintf(buf, 
611 "SELECT Path.Path,Filename.Name FROM File,Path,Filename "
612 "WHERE File.JobId=%d "
613 "AND File.MarkedId!=%d AND File.PathId=Path.PathId "
614 "AND File.FilenameId=Filename.FilenameId", 
615       JobId, jcr->JobId);
616    /* missing_handler is called for each file found */
617    db_sql_query(jcr->db, buf, missing_handler, (void *)jcr);
618    if (jcr->fn_printed) {
619       stat = JS_Differences;
620    }
621    free_pool_memory(fname);
622    set_jcr_job_status(jcr, stat);
623    return 1;
624     
625 bail_out:
626    free_pool_memory(fname);
627    set_jcr_job_status(jcr, JS_ErrorTerminated);
628    return 0;
629 }
630
631 /*
632  * We are called here for each record that matches the above
633  *  SQL query -- that is for each file contained in the Catalog
634  *  that was not marked earlier. This means that the file in
635  *  question is a missing file (in the Catalog but on on Disk).
636  */
637 static int missing_handler(void *ctx, int num_fields, char **row)
638 {
639    JCR *jcr = (JCR *)ctx;
640
641    if (!jcr->fn_printed) {
642       Jmsg(jcr, M_INFO, 0, "\n");
643       Jmsg(jcr, M_INFO, 0, _("The following files are missing:\n"));
644       jcr->fn_printed = TRUE;
645    }
646    Jmsg(jcr, M_INFO, 0, "      %s%s\n", row[0]?row[0]:"", row[1]?row[1]:"");
647    return 0;
648 }
649
650
651 /* 
652  * Print filename for verify
653  */
654 static void prt_fname(JCR *jcr)
655 {
656    if (!jcr->fn_printed) {
657       Jmsg(jcr, M_INFO, 0, _("File: %s\n"), jcr->fname);
658       jcr->fn_printed = TRUE;
659    }
660 }