Skip to content

Commit

Permalink
rebase master: corrected some merge errors
Browse files Browse the repository at this point in the history
  • Loading branch information
franku committed Sep 20, 2018
1 parent d5d4bd1 commit 3ad1933
Show file tree
Hide file tree
Showing 13 changed files with 50 additions and 77 deletions.
2 changes: 1 addition & 1 deletion core/src/console/CMakeLists.txt
Expand Up @@ -18,7 +18,7 @@
# 02110-1301, USA.


SET (BCONSSRCS auth_pam.cc console_conf.cc console_globals.cc)
SET (BCONSSRCS auth_pam.cc console_conf.cc console_globals.cc console_output.cc)
IF(HAVE_WIN32)
LIST(APPEND BCONSSRCS ../win32/console/consoleres.rc)
ENDIF()
Expand Down
10 changes: 5 additions & 5 deletions core/src/console/console_conf.cc
Expand Up @@ -253,17 +253,17 @@ static bool SaveResource(int type, ResourceItem *items, int pass)
if (pass == 2) {
switch (type) {
case R_CONSOLE:
if ((res = (UnionOfResources *)GetResWithName(R_CONSOLE, res_all.res_cons.name())) == NULL) {
if ((res = (UnionOfResources *)my_config->GetResWithName(R_CONSOLE, res_all.res_cons.name())) == NULL) {
Emsg1(M_ABORT, 0, _("Cannot find Console resource %s\n"), res_all.res_cons.name());
} else {
res->res_cons.tls_cert.AllowedCns = res_all.res_cons.tls_cert.AllowedCns;
res->res_cons.tls_cert.allowed_certificate_common_names_ = res_all.res_cons.tls_cert.allowed_certificate_common_names_;
}
break;
case R_DIRECTOR:
if ((res = (UnionOfResources *)GetResWithName(R_DIRECTOR, res_all.res_dir.name())) == NULL) {
if ((res = (UnionOfResources *)my_config->GetResWithName(R_DIRECTOR, res_all.res_dir.name())) == NULL) {
Emsg1(M_ABORT, 0, _("Cannot find Director resource %s\n"), res_all.res_dir.name());
} else {
res->res_dir.tls_cert.AllowedCns = res_all.res_dir.tls_cert.AllowedCns;
res->res_dir.tls_cert.allowed_certificate_common_names_ = res_all.res_dir.tls_cert.allowed_certificate_common_names_;
}
break;
default:
Expand Down Expand Up @@ -306,7 +306,7 @@ static bool SaveResource(int type, ResourceItem *items, int pass)
}
}
last->next = (CommonResourceHeader *)res;
Dmsg2(90, "Inserting %s res: %s\n", res_to_str(type), res->res_dir.name());
Dmsg2(90, "Inserting %s res: %s\n", my_config->res_to_str(type), res->res_dir.name());
}
}
return (error == 0);
Expand Down
2 changes: 1 addition & 1 deletion core/src/console/console_output.cc
Expand Up @@ -23,7 +23,7 @@

#include <stdarg.h>

#include "bareos.h"
#include "include/bareos.h"

static FILE *output_file_ = stdout;
static bool teeout_enabled_ = false;
Expand Down
2 changes: 1 addition & 1 deletion core/src/dird/CMakeLists.txt
Expand Up @@ -48,7 +48,7 @@ IF(HAVE_WIN32)
)
ENDIF()

include_directories(${PAM_INCLUDE_DIRS}
include_directories(${PAM_INCLUDE_DIRS})

set(DBCHKSRCS dbcheck.cc dird_conf.cc dird_globals.cc ua_acl.cc ua_audit.cc run_conf.cc inc_conf.cc)
IF(HAVE_WIN32)
Expand Down
4 changes: 2 additions & 2 deletions core/src/dird/auth_pam.cc
Expand Up @@ -24,8 +24,8 @@
#include <cstring>
#include <security/pam_appl.h>

#include "bareos.h"
#include "ua.h"
#include "include/bareos.h"
#include "dird/ua.h"

static const int debuglevel = 200;

Expand Down
4 changes: 2 additions & 2 deletions core/src/dird/dird_conf.cc
Expand Up @@ -1322,7 +1322,7 @@ bool ValidateResource(int res_type, ResourceItem *items, BareosResource *res)
if (!BitIsSet(i, res->hdr.item_present)) {
Jmsg(NULL, M_ERROR, 0,
_("\"%s\" directive in %s \"%s\" resource is required, but not found.\n"),
items[i].name, res_to_str(res_type), res->name());
items[i].name, my_config->res_to_str(res_type), res->name());
return false;
}
}
Expand All @@ -1331,7 +1331,7 @@ bool ValidateResource(int res_type, ResourceItem *items, BareosResource *res)
* If this triggers, take a look at lib/parse_conf.h
*/
if (i >= MAX_RES_ITEMS) {
Emsg1(M_ERROR, 0, _("Too many items in %s resource\n"), res_to_str(res_type));
Emsg1(M_ERROR, 0, _("Too many items in %s resource\n"), my_config->res_to_str(res_type));
return false;
}
}
Expand Down
17 changes: 17 additions & 0 deletions core/src/dird/ua.cc
Expand Up @@ -23,6 +23,9 @@

#include "include/jcr.h"
#include "dird/ua_output.h"
#include "dird/dird_conf.h"

namespace directordaemon {

UaContext::UaContext()
: UA_sock(nullptr)
Expand Down Expand Up @@ -113,3 +116,17 @@ void FreeUaContext(UaContext *ua)
}
free(ua);
}

RunContext::RunContext()
{
memset(this, 0, sizeof(RunContext));
store = new UnifiedStorageResource;
}

RunContext::~RunContext()
{
if (store) {
delete store;
}
}
} /* namespace directordaemon */
17 changes: 8 additions & 9 deletions core/src/dird/ua.h
Expand Up @@ -31,26 +31,26 @@
#ifndef BAREOS_DIRD_UA_H_
#define BAREOS_DIRD_UA_H_ 1

namespace directordaemon {
#include "include/bareos.h"

class UaContext;
class BareosSocket;
class JobControlRecord;
class BareosDb;
class BareosDb;
class BareosDb;
class guid_list;

namespace directordaemon {

class CatalogResource;
class ConsoleResource;
class guid_list;
class PoolResource;
class StorageResource;
class StorageResource;
class ClientResource;
class JobResource;
class FilesetResource;
class ScheduleResource;
class RestoreBootstrapRecord;
struct ua_cmdstruct;
class UnifiedStorageResource;

class UaContext {
public:
Expand Down Expand Up @@ -248,9 +248,8 @@ class RunContext {
/*
* Methods
*/
RunContext() { memset(this, 0, sizeof(RunContext));
store = new UnifiedStorageResource; }
~RunContext() { delete store; }
RunContext();
~RunContext();
};

} /* namespace directordaemon */
Expand Down
3 changes: 3 additions & 0 deletions core/src/dird/ua_cmdstruct.h
Expand Up @@ -22,6 +22,8 @@
#ifndef BAREOS_DIRD_UA_COMMANDSTRUCT_H_
#define BAREOS_DIRD_UA_COMMANDSTRUCT_H_

namespace directordaemon {

struct ua_cmdstruct {
const char *key; /**< Command */
bool (*func)(UaContext *ua, const char *cmd); /**< Handler */
Expand All @@ -31,4 +33,5 @@ struct ua_cmdstruct {
const bool audit_event; /**< Log an audit event when this Command is executed */
};

} /* namespace directordaemon */
#endif /* BAREOS_DIRD_UA_COMMANDSTRUCT_H_ */
2 changes: 2 additions & 0 deletions core/src/dird/ua_output.h
Expand Up @@ -24,6 +24,8 @@

namespace directordaemon {

class RunResource;

void bsendmsg(void *ua_ctx, const char *fmt, ...);
of_filter_state filterit(void *ctx, void *data, of_filter_tuple *tuple);
bool printit(void *ctx, const char *msg);
Expand Down
52 changes: 0 additions & 52 deletions core/src/dird/ua_server.cc
Expand Up @@ -146,56 +146,4 @@ void *HandleUserAgentClientRequest(BareosSocket *user_agent_socket)

return NULL;
}

/**
* Create a UaContext for a Job that is running so that
* it can the User Agent routines and
* to ensure that the Job gets the proper output.
* This is a sort of mini-kludge, and should be
* unified at some point.
*/
UaContext *new_ua_context(JobControlRecord *jcr)
{
UaContext *ua;

ua = (UaContext *)malloc(sizeof(UaContext));
memset(ua, 0, sizeof(UaContext));
ua->jcr = jcr;
ua->db = jcr->db;
ua->cmd = GetPoolMemory(PM_FNAME);
ua->args = GetPoolMemory(PM_FNAME);
ua->errmsg = GetPoolMemory(PM_FNAME);
ua->verbose = true;
ua->automount = true;
ua->send = New(OutputFormatter(printit, ua, filterit, ua));

return ua;
}

void FreeUaContext(UaContext *ua)
{
if (ua->guid) {
FreeGuidList(ua->guid);
}
if (ua->cmd) {
FreePoolMemory(ua->cmd);
}
if (ua->args) {
FreePoolMemory(ua->args);
}
if (ua->errmsg) {
FreePoolMemory(ua->errmsg);
}
if (ua->prompt) {
free(ua->prompt);
}
if (ua->send) {
delete ua->send;
}
if (ua->UA_sock) {
ua->UA_sock->close();
ua->UA_sock = NULL;
}
free(ua);
}
} /* namespace directordaemon */
10 changes: 7 additions & 3 deletions core/src/lib/CMakeLists.txt
Expand Up @@ -56,7 +56,7 @@ set (BAREOS_SRCS address_conf.cc alist.cc attr.cc attribs.cc base64.cc
queue.cc rblist.cc runscript.cc rwlock.cc scan.cc scsi_crypto.cc scsi_lli.cc
sellist.cc serial.cc sha1.cc signal.cc smartall.cc tls.cc
tls_gnutls.cc tls_conf_base.cc tls_conf_psk.cc tls_conf_cert.cc tls_openssl.cc
tls_openssl_crl.cc tls_openssl_private.cc tree.cc util.cc var.cc watchdog.cc
tls_openssl_crl.cc tls_openssl_private.cc tree.cc util.cc var.cc watchdog.cc
workq.cc)

IF(HAVE_WIN32)
Expand All @@ -70,12 +70,16 @@ ELSE()
scsi_tapealert.cc)
ENDIF()

set (BAREOSCFG_SRCS ini.cc lex.cc parse_bsr.cc res.cc parse_conf.cc
res.cc qualified_resource_name_type_converter.cc)
LIST(APPEND BAREOS_SRCS ${BAREOSCFG_SRCS})

add_library(bareos SHARED ${BAREOS_SRCS})

target_link_libraries(bareos
${OPENSSL_LIBRARIES} ${PTHREAD_LIBRARIES} ${FASTLZ_LIBRARIES} ${ZLIB_LIBRARIES}
${ACL_LIBRARIES} ${LZO2_LIBRARIES} ${CAP_LIBRARIES} ${WRAP_LIBRARIES}
${CAM_LIBRARIES} ${WINDOWS_LIBRARIES} ${JANSSON_LIBRARIES})
${ACL_LIBRARIES} ${LZO2_LIBRARIES} ${CAP_LIBRARIES} ${WRAP_LIBRARIES}
${CAM_LIBRARIES} ${WINDOWS_LIBRARIES} ${JANSSON_LIBRARIES})

INSTALL(TARGETS bareos DESTINATION ${libdir})

Expand Down
2 changes: 1 addition & 1 deletion core/src/lib/unittests/CMakeLists.txt
Expand Up @@ -79,7 +79,7 @@ target_link_libraries(test_bsock
${JANSSON_LIBRARIES}
${GTEST_LIBRARIES}
${GTEST_MAIN_LIBRARIES}
)
${PAM_LIBRARIES})

add_test(NAME test_bsock
COMMAND test_bsock
Expand Down

0 comments on commit 3ad1933

Please sign in to comment.