2 Bacula(R) - The Network Backup Solution
4 Copyright (C) 2000-2018 Kern Sibbald
6 The original author of Bacula is Kern Sibbald, with contributions
7 from many others, a complete list can be found in the file AUTHORS.
9 You may use this file and others of this release according to the
10 license defined in the LICENSE file, which includes the Affero General
11 Public License, v3.0 ("AGPLv3") and some additional permissions and
12 terms pursuant to its AGPLv3 Section 7.
14 This notice must be preserved when any source code is
15 conveyed and/or propagated.
17 Bacula(R) is a registered trademark of Kern Sibbald.
20 * Written by James Harper, July 2010
22 * Used only in "old Exchange plugin" now deprecated.
25 #include "exchange-fd.h"
27 root_node_t::root_node_t(char *name) : node_t(name, NODE_TYPE_ROOT)
32 root_node_t::~root_node_t()
37 root_node_t::startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp)
42 _DebugMessage(100, "startBackupNode_ROOT state = %d\n", state);
46 if (strcmp(PLUGIN_PATH_PREFIX_BASE, name) != 0)
48 _JobMessage(M_FATAL, "Invalid backup path specified, must start with '/" PLUGIN_PATH_PREFIX_BASE "/'\n");
52 // check that service_node == NULL
53 service_node = new service_node_t(bstrdup(context->path_bits[level + 1]), this);
57 context->current_node = service_node;
61 sp->fname = full_path;
63 sp->statp.st_mode = 0700 | S_IFDIR;
64 sp->statp.st_ctime = now;
65 sp->statp.st_mtime = now;
66 sp->statp.st_atime = now;
67 sp->statp.st_size = 0;
73 _JobMessage(M_FATAL, "startBackupFile: invalid internal state %d", state);
80 root_node_t::endBackupFile(exchange_fd_context_t *context)
84 _DebugMessage(100, "endBackupNode_ROOT state = %d\n", state);
90 // free service_node here?
98 _JobMessage(M_FATAL, "endBackupFile: invalid internal state %d", state);
106 root_node_t::createFile(exchange_fd_context_t *context, struct restore_pkt *rp)
108 _DebugMessage(0, "createFile_ROOT state = %d\n", state);
111 if (strcmp(name, PLUGIN_PATH_PREFIX_BASE) != 0) {
112 _JobMessage(M_FATAL, "Invalid restore path specified, must start with '/" PLUGIN_PATH_PREFIX_BASE "/'\n");
116 service_node = new service_node_t(bstrdup(context->path_bits[level + 1]), this);
117 context->current_node = service_node;
120 rp->create_status = CF_CREATED;
125 rp->create_status = CF_SKIP;
131 _JobMessage(M_FATAL, "createFile: invalid internal state %d", state);
138 root_node_t::endRestoreFile(exchange_fd_context_t *context)
140 _DebugMessage(0, "endRestoreFile_ROOT state = %d\n", state);
143 safe_delete(service_node);
151 _JobMessage(M_FATAL, "endRestore: invalid internal state %d", state);