/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2009 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2010 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
*
* Kern Sibbald, March MM
*
- * Version $Id$
- *
*/
#include "bacula.h"
static void crypto_session_end(JCR *jcr);
static bool crypto_session_send(JCR *jcr, BSOCK *sd);
-/*
+/**
* Find all the requested files and send them
* to the Storage daemon.
*
}
jcr->buf_size = sd->msglen;
- /* Adjust for compression so that output buffer is
+ /**
+ * Adjust for compression so that output buffer is
* 12 bytes + 0.1% larger than input buffer plus 18 bytes.
* This gives a bit extra plus room for the sparse addr if any.
* Note, we adjust the read size to be smaller so that the
{
crypto_cipher_t cipher = CRYPTO_CIPHER_AES_128_CBC;
- /*
+ /**
* Create encryption session data and a cached, DER-encoded session data
* structure. We use a single session key for each backup, so we'll encode
* the session data only once.
}
-/*
+/**
* Called here by find() for each file included.
* This is a callback. The original is find_files() above.
*
/* Digests and encryption are only useful if there's file data */
if (has_file_data) {
- /*
+ /**
* Setup for digest handling. If this fails, the digest will be set to NULL
* and not used. Note, the digest (file hash) can be any one of the four
* algorithms below.
stream_to_ascii(digest_stream));
}
- /*
+ /**
* Set up signature digest handling. If this fails, the signature digest
* will be set to NULL and not used.
*/
return rtnstat;
}
-/*
+/**
* Send data read from an already open file descriptor.
*
* We return 1 on sucess and 0 on errors.
wbuf = jcr->compress_buf; /* compressed output here */
cipher_input = (uint8_t *)jcr->compress_buf; /* encrypt compressed data */
- /*
+ /**
* Only change zlib parameters if there is no pending operation.
* This should never happen as deflatereset is called after each
* deflate.
goto err;
}
- /*
+ /**
* Grow the crypto buffer, if necessary.
* crypto_cipher_update() will buffer up to (cipher_block_size - 1).
* We grow crypto_buf to the maximum number of blocks that
wbuf = jcr->crypto.crypto_buf; /* Encrypted, possibly compressed output here. */
}
- /*
+ /**
* Send Data header to Storage daemon
* <file-index> <stream> <info>
*/
}
Dmsg1(300, ">stored: datahdr %s\n", sd->msg);
- /*
+ /**
* Make space at beginning of buffer for fileAddr because this
* same buffer will be used for writing if compression is off.
*/
rsize = (rsize/512) * 512;
#endif
- /*
+ /**
* Read the file data
*/
while ((sd->msglen=(uint32_t)bread(&ff_pkt->bfd, rbuf, rsize)) > 0) {
cipher_input_len = compress_len;
}
#endif
- /*
+ /**
* Note, here we prepend the current record length to the beginning
* of the encrypted data. This is because both sparse and compression
* restore handling want records returned to them with exactly the
return true;
}
-/*
+/**
* Do in place strip of path
*/
static bool do_strip(int count, char *in)
return stripped==count && numsep>count;
}
-/*
+/**
* If requested strip leading components of the path so that we can
* save file as if it came from a subdirectory. This is most useful
* for dealing with snapshots, by removing the snapshot directory, or
sm_check(__FILE__, __LINE__, true);
}
- /*
+ /**
* Strip path. If it doesn't succeed put it back. If
* it does, and there is a different link string,
* attempt to strip the link. If it fails, back them
unstrip_path(ff_pkt);
goto rtn;
}
- /* Strip links but not symlinks */
+ /** Strip links but not symlinks */
if (ff_pkt->type != FT_LNK && ff_pkt->fname != ff_pkt->link) {
if (!do_strip(ff_pkt->strip_path, ff_pkt->link)) {
unstrip_path(ff_pkt);
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2009 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2010 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
*
* Kern Sibbald, October MM
*
- * Version $Id$
- *
*/
#include "bacula.h"
static int enable_vss = 0;
#endif
-/*
+/**
* As Windows saves ACLs as part of the standard backup stream
* we just pretend here that is has implicit acl support.
*/
int monitoraccess; /* specify if monitors have access to this function */
};
-/*
+/**
* The following are the recognized commands from the Director.
*/
static struct s_cmds cmds[] = {
static char read_data[] = "read data %d\n";
static char read_close[] = "read close session %d\n";
-/*
+/**
* Accept requests from a Director
*
* NOTE! We are running as a separate thread
return NULL;
}
-/*
+/**
* Hello from Director he must identify himself and provide his
* password.
*/
return 1;
}
-/*
+/**
* Cancel a Job
*/
static int cancel_cmd(JCR *jcr)
}
-/*
+/**
* Set debug level as requested by the Director
*
*/
return 1;
}
-/*
+/**
* Get JobId and Storage Daemon Authorization key from Director
*/
static int job_cmd(JCR *jcr)
}
-/*
+/**
* Add fname to include/exclude fileset list. First check for
* | and < and if necessary perform command.
*/
return;
}
- /*
+ /**
* The switch tests the code for validity.
* The subcode is always good if it is a space, otherwise we must confirm.
* We set state to state_error first assuming the subcode is invalid,
}
-/*
+/**
* As an optimization, we should do this during
* "compile" time in filed/job.c, and keep only a bit mask
* and the Verify options.
}
-/*
+/**
* Director is passing his Fileset
*/
static int fileset_cmd(JCR *jcr)
static pthread_mutex_t bsr_mutex = PTHREAD_MUTEX_INITIALIZER;
static uint32_t bsr_uniq = 0;
-/*
+/**
* The Director sends us the bootstrap file, which
* we will in turn pass to the SD.
+ * Deprecated. The bsr is now sent directly from the
+ * Director to the SD.
*/
static int bootstrap_cmd(JCR *jcr)
{
}
-/*
+/**
* Get backup level from Director
*
*/
return 0;
}
-/*
+/**
* Get session parameters from Director -- this is for a Restore command
+ * This is deprecated. It is now passed via the bsr.
*/
static int session_cmd(JCR *jcr)
{
jcr->store_bsock = NULL;
}
- /* We can be contacting multiple storage daemons.
+ /**
+ * We can be contacting multiple storage daemons.
* So, make sure that any old jcr->sd_auth_key is cleaned up.
*/
if (jcr->sd_auth_key) {
jcr->sd_auth_key = bstrdup(key);
}
-/*
+/**
* Get address of storage daemon from Director
*
*/
Dmsg1(100, "StorageCmd: %s", dir->msg);
sd_auth_key.check_size(dir->msglen);
if (sscanf(dir->msg, storaddr, &jcr->stored_addr, &stored_port,
- &enable_ssl, sd_auth_key.c_str()) != 4)
- {
+ &enable_ssl, sd_auth_key.c_str()) != 4) {
if (sscanf(dir->msg, storaddr_v1, &jcr->stored_addr,
- &stored_port, &enable_ssl) != 3)
- {
+ &stored_port, &enable_ssl) != 3) {
pm_strcpy(jcr->errmsg, dir->msg);
Jmsg(jcr, M_FATAL, 0, _("Bad storage command: %s"), jcr->errmsg);
goto bail_out;
}
-/*
+/**
* Do a backup.
*/
static int backup_cmd(JCR *jcr)
}
#endif
- /*
+ /**
* Validate some options given to the backup make sense for the compiled in
* options of this filed.
*/
dir->fsend(OKbackup);
Dmsg1(110, "filed>dird: %s", dir->msg);
- /*
+ /**
* Send Append Open Session to Storage daemon
*/
sd->fsend(append_open);
Dmsg1(110, ">stored: %s", sd->msg);
- /*
+ /**
* Expect to receive back the Ticket number
*/
if (bget_msg(sd) >= 0) {
goto cleanup;
}
- /*
+ /**
* Send Append data command to Storage daemon
*/
sd->fsend(append_data, jcr->Ticket);
Dmsg1(110, ">stored: %s", sd->msg);
- /*
+ /**
* Expect to get OK data
*/
Dmsg1(110, "<stored: %s", sd->msg);
}
#endif
- /*
+ /**
* Send Files to Storage daemon
*/
Dmsg1(110, "begin blast ff=%p\n", (FF_PKT *)jcr->ff);
bnet_suppress_error_messages(sd, 1);
goto cleanup; /* bail out now */
}
- /*
+ /**
* Expect to get response to append_data from Storage daemon
*/
if (!response(jcr, sd, OK_append, "Append Data")) {
goto cleanup;
}
- /*
+ /**
* Send Append End Data to Storage daemon
*/
sd->fsend(append_end, jcr->Ticket);
goto cleanup;
}
- /*
+ /**
* Send Append Close to Storage daemon
*/
sd->fsend(append_close, jcr->Ticket);
return 0; /* return and stop command loop */
}
-/*
+/**
* Do a Verify for Director
*
*/
return 0; /* return and terminate command loop */
}
-/*
+/**
* Do a Restore for Director
*
*/
int prefix_links;
char replace;
- /*
+ /**
* Scan WHERE (base directory for restore) from command
*/
Dmsg0(150, "restore command\n");
set_jcr_job_status(jcr, JS_Running);
- /*
+ /**
* Do restore of files and data
*/
start_dir_heartbeat(jcr);
bnet_suppress_error_messages(sd, 1);
}
- /*
+ /**
* Send Close session command to Storage daemon
*/
sd->fsend(read_close, jcr->Ticket);
return 1;
}
-/*
+/**
* Destroy the Job Control Record and associated
* resources (sockets).
*/
return;
}
-/*
+/**
* Get response from Storage daemon to a command we
* sent. Check that the response is OK.
*