static char rec_header[] = "rechdr %ld %ld %ld %ld %ld";
/* Forward referenced functions */
-#ifdef needed
-static void print_ls_output(JCR *jcr, char *fname, char *lname, int type, struct stat *statp);
-#endif
/*
dir = jcr->dir_bsock;
set_jcr_job_status(jcr, JS_Running);
- if (!bnet_set_buffer_size(sd, MAX_NETWORK_BUFFER_SIZE, BNET_SETBUF_READ)) {
+ LockRes();
+ CLIENT *client = (CLIENT *)GetNextRes(R_CLIENT, NULL);
+ UnlockRes();
+ uint32_t buf_size;
+ if (client) {
+ buf_size = client->max_network_buffer_size;
+ } else {
+ buf_size = 0; /* use default */
+ }
+ if (!bnet_set_buffer_size(sd, buf_size, BNET_SETBUF_WRITE)) {
set_jcr_job_status(jcr, JS_FatalError);
return;
}
Dmsg1(30, "Got stream data, len=%d\n", sd->msglen);
/* File Attributes stream */
- if (stream == STREAM_UNIX_ATTRIBUTES || stream == STREAM_WIN32_ATTRIBUTES) {
+ switch (stream) {
+ case STREAM_UNIX_ATTRIBUTES:
+ case STREAM_UNIX_ATTRIBUTES_EX:
char *ap, *lp, *fp;
Dmsg0(400, "Stream=Unix Attributes.\n");
Jmsg(jcr, M_FATAL, 0, _("Network error in send to Director: ERR=%s\n"), bnet_strerror(dir));
goto bail_out;
}
+ break;
-
- /* Data stream */
- } else if (stream == STREAM_FILE_DATA || stream == STREAM_SPARSE_DATA) {
-
- /* Do nothing */
-
- /* GZIP data stream */
- } else if (stream == STREAM_GZIP_DATA || stream == STREAM_SPARSE_GZIP_DATA) {
+ /* Data streams to ignore */
+ case STREAM_FILE_DATA:
+ case STREAM_SPARSE_DATA:
+ case STREAM_WIN32_DATA:
+ case STREAM_WIN32_GZIP_DATA:
+ case STREAM_GZIP_DATA:
+ case STREAM_SPARSE_GZIP_DATA:
/* Do nothing */
+ break;
- /* If MD5 stream */
- } else if (stream == STREAM_MD5_SIGNATURE) {
+ case STREAM_MD5_SIGNATURE:
char MD5buf[30];
bin_to_base64(MD5buf, (char *)sd->msg, 16); /* encode 16 bytes */
Dmsg2(400, "send inx=%d MD5=%s\n", jcr->JobFiles, MD5buf);
bnet_fsend(dir, "%d %d %s *MD5-%d*", jcr->JobFiles, STREAM_MD5_SIGNATURE, MD5buf,
jcr->JobFiles);
Dmsg2(20, "bfiled>bdird: MD5 len=%d: msg=%s\n", dir->msglen, dir->msg);
+ break;
- /* If SHA1 stream */
- } else if (stream == STREAM_SHA1_SIGNATURE) {
+ case STREAM_SHA1_SIGNATURE:
char SHA1buf[30];
bin_to_base64(SHA1buf, (char *)sd->msg, 20); /* encode 20 bytes */
Dmsg2(400, "send inx=%d SHA1=%s\n", jcr->JobFiles, SHA1buf);
bnet_fsend(dir, "%d %d %s *SHA1-%d*", jcr->JobFiles, STREAM_SHA1_SIGNATURE,
SHA1buf, jcr->JobFiles);
Dmsg2(20, "bfiled>bdird: SHA1 len=%d: msg=%s\n", dir->msglen, dir->msg);
- } else {
+ break;
+
+ default:
Pmsg2(0, "None of above!!! stream=%d data=%s\n", stream,sd->msg);
- }
- }
+ break;
+ } /* end switch */
+ } /* end while bnet_get */
set_jcr_job_status(jcr, JS_Terminated);
goto ok_out;
bail_out:
set_jcr_job_status(jcr, JS_ErrorTerminated);
+
ok_out:
if (jcr->compress_buf) {
free(jcr->compress_buf);
Dmsg2(050, "End Verify-Vol. Files=%d Bytes=%" lld "\n", jcr->JobFiles,
jcr->JobBytes);
}
-
-extern char *getuser(uid_t uid);
-extern char *getgroup(gid_t gid);
-
-/*
- * Print an ls style message, also send INFO
- */
-#ifdef needed
-static void print_ls_output(JCR *jcr, char *fname, char *lname, int type, struct stat *statp)
-{
- char buf[2000];
- char ec1[30];
- char *p, *f;
- int n;
-
- p = encode_mode(statp->st_mode, buf);
- n = sprintf(p, " %2d ", (uint32_t)statp->st_nlink);
- p += n;
- n = sprintf(p, "%-8.8s %-8.8s", getuser(statp->st_uid), getgroup(statp->st_gid));
- p += n;
- n = sprintf(p, "%8.8s ", edit_uint64(statp->st_size, ec1));
- p += n;
- p = encode_time(statp->st_ctime, p);
- *p++ = ' ';
- *p++ = ' ';
- for (f=fname; *f && (p-buf) < (int)sizeof(buf)-10; )
- *p++ = *f++;
- if (type == FT_LNK) {
- *p++ = ' ';
- *p++ = '-';
- *p++ = '>';
- *p++ = ' ';
- /* Copy link name */
- for (f=lname; *f && (p-buf) < (int)sizeof(buf)-10; )
- *p++ = *f++;
- }
- *p++ = '\n';
- *p = 0;
- Dmsg0(20, buf);
- Jmsg(jcr, M_INFO, 0, "%s", buf);
-}
-#endif