diff --git a/core/src/console/CMakeLists.txt b/core/src/console/CMakeLists.txt index bd10ec4cca0..d9f8d5730b0 100644 --- a/core/src/console/CMakeLists.txt +++ b/core/src/console/CMakeLists.txt @@ -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) diff --git a/core/src/console/console.cc b/core/src/console/console.cc index ad6066f6d67..7b1aff5ff7d 100644 --- a/core/src/console/console.cc +++ b/core/src/console/console.cc @@ -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" @@ -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"); diff --git a/core/src/dird/CMakeLists.txt b/core/src/dird/CMakeLists.txt index 265f0efd7b2..96e261d0bd4 100644 --- a/core/src/dird/CMakeLists.txt +++ b/core/src/dird/CMakeLists.txt @@ -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 @@ -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) @@ -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}) diff --git a/core/src/dird/ua_server.cc b/core/src/dird/ua_server.cc index 9629a40efd4..6eb8476badb 100644 --- a/core/src/dird/ua_server.cc +++ b/core/src/dird/ua_server.cc @@ -87,6 +87,7 @@ void *HandleUserAgentClientRequest(BareosSocket *user_agent_socket) bool success = AuthenticateUserAgent(ua); +#ifndef HAVE_WIN32 if (success) { std::string username; if (ua->cons) { @@ -94,6 +95,7 @@ void *HandleUserAgentClientRequest(BareosSocket *user_agent_socket) success = PamAuthenticateUseragent(ua->UA_sock, username); } } +#endif /* !HAVE_WIN32 */ if (!success) { ua->quit = true; diff --git a/core/src/lib/unittests/CMakeLists.txt b/core/src/lib/unittests/CMakeLists.txt index 12b1cb4ac86..a87965aad32 100644 --- a/core/src/lib/unittests/CMakeLists.txt +++ b/core/src/lib/unittests/CMakeLists.txt @@ -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 @@ -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