A few PAM cleanups

Print header found message only if libraries also found.
Change header guards to pragma once.
Check return value of store_client_password().
This commit is contained in:
Esa Korhonen
2017-08-15 11:16:38 +03:00
parent db8ad7efa8
commit 2784858495
4 changed files with 7 additions and 16 deletions

View File

@ -7,8 +7,8 @@
find_path(PAM_INCLUDE_DIR pam_appl.h PATH_SUFFIXES security) find_path(PAM_INCLUDE_DIR pam_appl.h PATH_SUFFIXES security)
find_library(PAM_LIBRARIES NAMES pam) find_library(PAM_LIBRARIES NAMES pam)
message(STATUS "Found PAM include dirs: ${PAM_INCLUDE_DIR}")
if (PAM_INCLUDE_DIR AND PAM_LIBRARIES) if (PAM_INCLUDE_DIR AND PAM_LIBRARIES)
message(STATUS "Found PAM headers: ${PAM_INCLUDE_DIR}")
message(STATUS "Found PAM: ${PAM_LIBRARIES}") message(STATUS "Found PAM: ${PAM_LIBRARIES}")
set(PAM_FOUND TRUE CACHE INTERNAL "") set(PAM_FOUND TRUE CACHE INTERNAL "")
else() else()

View File

@ -358,8 +358,10 @@ bool PamClientSession::extract(DCB *dcb, GWBUF *buffer)
break; break;
case PAM_AUTH_DATA_SENT: case PAM_AUTH_DATA_SENT:
store_client_password(dcb, buffer); if (store_client_password(dcb, buffer))
{
rval = true; rval = true;
}
break; break;
default: default:

View File

@ -1,3 +1,4 @@
#pragma once
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -14,9 +15,6 @@
/** /**
* Common definitions and includes for PAMBackendAuth * Common definitions and includes for PAMBackendAuth
*/ */
#ifndef PAM_BACKEND_AUTH_HH
#define PAM_BACKEND_AUTH_HH
#define MXS_MODULE_NAME "PAMBackendAuth" #define MXS_MODULE_NAME "PAMBackendAuth"
#include <maxscale/cppdefs.hh> #include <maxscale/cppdefs.hh>
@ -24,6 +22,3 @@
#include <maxscale/buffer.h> #include <maxscale/buffer.h>
#include <maxscale/dcb.h> #include <maxscale/dcb.h>
#include <maxscale/protocol/mysql.h> #include <maxscale/protocol/mysql.h>
#endif /* PAM_BACKEND_AUTH_HH */

View File

@ -1,3 +1,4 @@
#pragma once
/* /*
* Copyright (c) 2016 MariaDB Corporation Ab * Copyright (c) 2016 MariaDB Corporation Ab
* *
@ -10,10 +11,6 @@
* of this software will be governed by version 2 or later of the General * of this software will be governed by version 2 or later of the General
* Public License. * Public License.
*/ */
#ifndef PAMBACKENDSESSION_HH
#define PAMBACKENDSESSION_HH
#include "pam_backend_auth.hh" #include "pam_backend_auth.hh"
#include <stdint.h> #include <stdint.h>
@ -34,6 +31,3 @@ private:
pam_auth_state m_state; /**< Authentication state*/ pam_auth_state m_state; /**< Authentication state*/
uint8_t m_sequence; /**< The next packet seqence number */ uint8_t m_sequence; /**< The next packet seqence number */
}; };
#endif /* PAMBACKENDSESSION_HH */