Skip to content

Commit

Permalink
pam: removed pam from win32 build
Browse files Browse the repository at this point in the history
  • Loading branch information
franku committed Sep 20, 2018
1 parent 3ad1933 commit f1bb1ca
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 12 deletions.
4 changes: 3 additions & 1 deletion core/src/console/CMakeLists.txt
Expand Up @@ -18,9 +18,11 @@
# 02110-1301, USA.


SET (BCONSSRCS auth_pam.cc console_conf.cc console_globals.cc console_output.cc)
SET (BCONSSRCS console_conf.cc console_globals.cc console_output.cc)
IF(HAVE_WIN32)
LIST(APPEND BCONSSRCS ../win32/console/consoleres.rc)
ELSE()
LIST(APPEND BCONSSRCS auth_pam.cc)
ENDIF()

add_executable(bconsole console.cc)
Expand Down
14 changes: 9 additions & 5 deletions core/src/console/console.cc
Expand Up @@ -31,7 +31,9 @@
#include "include/bareos.h"
#include "console/console_conf.h"
#include "console/console_globals.h"
#if !defined(HAVE_WIN32)
#include "console/auth_pam.h"
#endif
#include "console/console_output.h"
#include "include/jcr.h"
#include "lib/bnet.h"
Expand Down Expand Up @@ -1083,14 +1085,16 @@ int main(int argc, char *argv[])

ConsoleOutput(errmsg);

#if !defined(HAVE_WIN32)
if (console_resource) { /* not for root console */
if (director_resource && director_resource->use_pam_authentication) {
if (!ConsolePamAuthenticate(stdin, UA_sock)) {
TerminateConsole(0);
return 1;
}
if (director_resource && director_resource->use_pam_authentication) {
if (!ConsolePamAuthenticate(stdin, UA_sock)) {
TerminateConsole(0);
return 1;
}
}
}
#endif /* !HAVE_WIN32 */

Dmsg0(40, "Opened connection with Director daemon\n");

Expand Down
10 changes: 8 additions & 2 deletions core/src/dird/CMakeLists.txt
Expand Up @@ -21,7 +21,7 @@
set(DIRDSRCS dird.cc)

#DIRD_OBJECTS_SRCS also used in a separate library for unittests
set(DIRD_OBJECTS_SRCS admin.cc archive.cc authenticate.cc auth_pam.cc autoprune.cc backup.cc bsr.cc catreq.cc
set(DIRD_OBJECTS_SRCS admin.cc archive.cc authenticate.cc autoprune.cc backup.cc bsr.cc catreq.cc
consolidate.cc dird_globals.cc dir_plugins.cc dird_conf.cc expand.cc fd_cmds.cc
getmsg.cc inc_conf.cc job.cc jobq.cc migrate.cc mountreq.cc msgchan.cc
ndmp_dma_storage.cc
Expand All @@ -38,6 +38,8 @@ set(DIRD_OBJECTS_SRCS admin.cc archive.cc authenticate.cc auth_pam.cc autoprune.
vbackup.cc verify.cc)
IF(HAVE_WIN32)
LIST(APPEND DIRD_OBJECTS_SRCS ../win32/dird/dirdres.rc)
ELSE()
LIST(APPEND DIRD_OBJECTS_SRCS auth_pam.cc)
ENDIF()

IF(HAVE_WIN32)
Expand Down Expand Up @@ -80,7 +82,11 @@ IF(HAVE_WIN32)
)
ENDIF()

target_link_libraries(bareos-dir ${BAREOS_DIR_LIBRARIES} ${PAM_LIBRARIES})
IF(HAVE_WIN32)
target_link_libraries(bareos-dir ${BAREOS_DIR_LIBRARIES})
ELSE()
target_link_libraries(bareos-dir ${BAREOS_DIR_LIBRARIES} ${PAM_LIBRARIES})
ENDIF()


add_executable(bareos-dbcheck ${DBCHKSRCS})
Expand Down
2 changes: 2 additions & 0 deletions core/src/dird/ua_server.cc
Expand Up @@ -87,13 +87,15 @@ void *HandleUserAgentClientRequest(BareosSocket *user_agent_socket)

bool success = AuthenticateUserAgent(ua);

#ifndef HAVE_WIN32
if (success) {
std::string username;
if (ua->cons) {
username = ua->cons->name();
success = PamAuthenticateUseragent(ua->UA_sock, username);
}
}
#endif /* !HAVE_WIN32 */

if (!success) {
ua->quit = true;
Expand Down
13 changes: 9 additions & 4 deletions core/src/lib/unittests/CMakeLists.txt
Expand Up @@ -64,8 +64,7 @@ add_executable(test_bsock
bsock_cert_verify_common_names_test.cc
create_resource.cc
)

target_link_libraries(test_bsock
set(LINK_LIBRARIES
stored_objects
dird_objects
console_objects
Expand All @@ -78,8 +77,14 @@ target_link_libraries(test_bsock
${NDMP_LIBS}
${JANSSON_LIBRARIES}
${GTEST_LIBRARIES}
${GTEST_MAIN_LIBRARIES}
${PAM_LIBRARIES})
${GTEST_MAIN_LIBRARIES})

IF(NOT HAVE_WIN32)
LIST(APPEND LINK_LIBRARIES ${PAM_LIBRARIES})
ENDIF()

target_link_libraries(test_bsock
${LINK_LIBRARIES})

add_test(NAME test_bsock
COMMAND test_bsock
Expand Down

0 comments on commit f1bb1ca

Please sign in to comment.