Commit b376cadf authored by Guillaume BIENKOWSKI's avatar Guillaume BIENKOWSKI

Add SOCI auth db backend. Have to be tested yet in testing environment.

parent 4bab04b5
......@@ -39,6 +39,7 @@ option(ENABLE_BOOSTLOG "" YES)
option(ENABLE_DATEHANDLER "" NO)
option(ENABLE_DOC "" YES)
option(ENABLE_ODB "" YES)
option(ENABLE_SOCI "" YES)
option(ENABLE_ODB_MYSQL "" YES)
option(ENABLE_MONOTONIC_CLOCK_REGISTRATIONS "" NO)
option(ENABLE_ODBC "Build ODBC support" YES)
......@@ -139,7 +140,7 @@ if(ENABLE_ODBC)
if(NOT ODBC_SQL_HEADERS)
message(FATAL_ERROR "ODBC Mysql headers not found.")
else()
message(STATUS "ODBCK Mysql ${ODBC_SQL_HEADERS}")
message(STATUS "ODBC Mysql ${ODBC_SQL_HEADERS}")
endif()
# check that odbc_config gives us a correct library path
......@@ -209,6 +210,11 @@ if(ENABLE_PRESENCE)
endif()
endif()
if(ENABLE_SOCI)
find_package(Soci REQUIRED COMPONENTS mysql)
find_path(SOCI_MYSQL_INCLUDES NAMES mysql.h PATH_SUFFIXES mysql)
endif()
# Boost checks
set(BOOST_COMPONENTS )
if(ENABLE_BOOSTLOG)
......
......@@ -11,6 +11,7 @@
#cmakedefine ENABLE_ODBC 1
#cmakedefine ENABLE_REDIS 1
#cmakedefine ENABLE_XSD 1
#cmakedefine ENABLE_SOCI 1
#cmakedefine HAVE_DATEHANDLER 1
#cmakedefine HAVE_ARC4RANDOM 1
......
......@@ -205,6 +205,12 @@ if(ENABLE_PUSHNOTIFICATION)
list(APPEND FLEXISIP_INCLUDES ${Boost_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIRS})
endif()
if(ENABLE_SOCI)
list(APPEND FLEXISIP_SOURCES authdb-soci.cc)
list(APPEND FLEXISIP_LIBS ${SOCI_LIBRARY})
list(APPEND FLEXISIP_INCLUDES ${SOCI_INCLUDE_DIRS} ${SOCI_MYSQL_INCLUDES})
endif()
message(STATUS "Flexisip LIBS : ${FLEXISIP_LIBS}")
message(STATUS "Flexisip INCLUDES : ${FLEXISIP_INCLUDES}")
message(STATUS "Flexisip DEPENDENCIES : ${FLEXISIP_DEPENDENCIES}")
......
......@@ -53,6 +53,10 @@ AuthDb* AuthDb::get() {
#if ENABLE_ODBC
} else if (impl == "odbc") {
sUnique = new OdbcAuthDb();
#endif
#if ENABLE_SOCI
} else if( impl == "soci") {
sUnique = new SociAuthDB();
#endif
}
}
......
......@@ -147,4 +147,28 @@ public:
#endif /* ENABLE_ODBC */
#if ENABLE_SOCI
#include "soci.h"
#include "mysql/soci-mysql.h"
class SociAuthDB : public AuthDb {
virtual ~SociAuthDB();
public:
SociAuthDB();
void setConnectionParameters(const string& domain, const string &request);
virtual void getPasswordFromBackend(su_root_t *root, const std::string& id, const std::string& domain, const std::string& authid, AuthDbListener *listener);
private:
void getPasswordWithPool(su_root_t* root, const std::string &id, const std::string &domain, const std::string &authid, AuthDbListener *listener);
size_t poolSize;
soci::connection_pool *pool;
std::string connection_string;
std::string backend;
std::string get_password_request;
};
#endif /* ENABLE_SOCI */
#endif
......@@ -282,7 +282,7 @@ public:
{ StringList, "trusted-hosts", "List of whitespace separated IP which will not be challenged.", "" },
{ String, "db-implementation", "Database backend implementation [odbc,file,fixed].", "fixed" },
{ String, "db-implementation", "Database backend implementation [odbc,soci,file,fixed].", "fixed" },
{ String, "datasource", "Odbc connection string to use for connecting to database. "
"ex1: DSN=myodbc3; where 'myodbc3' is the datasource name. "
......@@ -318,6 +318,7 @@ public:
"This MUST not be used for production as it is a real security hole.", "false" },
{ Boolean, "disable-qop-auth", "Disable the QOP authentication method. Default is to use it, use this flag to disable it if needed.", "false" },
config_item_end
};
mc->addChildrenValues(items);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment