mirror of
https://github.com/coturn/coturn.git
synced 2025-10-25 04:51:04 +02:00
make SQLite optional
This commit is contained in:
parent
9c8743e002
commit
924fa29c5e
@ -80,7 +80,7 @@ Commands:
|
|||||||
|
|
||||||
Options with required values:
|
Options with required values:
|
||||||
|
|
||||||
-b, --db, --userdb SQLite user database file name (default - ~/turndb).
|
-b, --db, --userdb SQLite user database file name (default - /var/db/turndb).
|
||||||
See the same option in the turnserver section.
|
See the same option in the turnserver section.
|
||||||
-e, --psql-userdb PostgreSQL user database connection string.
|
-e, --psql-userdb PostgreSQL user database connection string.
|
||||||
See the --psql-userdb option in the turnserver section.
|
See the --psql-userdb option in the turnserver section.
|
||||||
@ -170,7 +170,7 @@ to see the man page.
|
|||||||
|
|
||||||
/etc/turnserver.conf
|
/etc/turnserver.conf
|
||||||
|
|
||||||
~/turndb
|
/var/db/turndb
|
||||||
|
|
||||||
/usr/local/etc/turnserver.conf
|
/usr/local/etc/turnserver.conf
|
||||||
|
|
||||||
|
|||||||
@ -81,7 +81,7 @@ Config file settings:
|
|||||||
|
|
||||||
User database settings:
|
User database settings:
|
||||||
|
|
||||||
-b, --db, --userdb SQLite user database file name (default - ~/turndb).
|
-b, --db, --userdb SQLite user database file name (default - /var/db/turndb).
|
||||||
|
|
||||||
-e, --psql-userdb User database connection string for PostgreSQL.
|
-e, --psql-userdb User database connection string for PostgreSQL.
|
||||||
This database can be used for long-term and short-term
|
This database can be used for long-term and short-term
|
||||||
@ -716,7 +716,7 @@ For the user database, the turnserver has the following options:
|
|||||||
Obviously, only a few users can be set that way, and their credentials are fixed
|
Obviously, only a few users can be set that way, and their credentials are fixed
|
||||||
for the turnserver process lifetime.
|
for the turnserver process lifetime.
|
||||||
|
|
||||||
2) Users can be stored in SQLite DB. The default SQLite database file is ~/turndb.
|
2) Users can be stored in SQLite DB. The default SQLite database file is /var/db/turndb.
|
||||||
|
|
||||||
3) Users can be stored in PostgreSQL database, if the turnserver was compiled with PostgreSQL
|
3) Users can be stored in PostgreSQL database, if the turnserver was compiled with PostgreSQL
|
||||||
support. Each time turnserver checks user credentials, it reads the database (asynchronously,
|
support. Each time turnserver checks user credentials, it reads the database (asynchronously,
|
||||||
@ -841,7 +841,7 @@ FILES
|
|||||||
|
|
||||||
/etc/turnserver.conf
|
/etc/turnserver.conf
|
||||||
|
|
||||||
~/turndb
|
/var/db/turndb
|
||||||
|
|
||||||
/usr/local/etc/turnserver.conf
|
/usr/local/etc/turnserver.conf
|
||||||
|
|
||||||
|
|||||||
@ -251,7 +251,7 @@ FILES
|
|||||||
|
|
||||||
/etc/turnserver.conf
|
/etc/turnserver.conf
|
||||||
|
|
||||||
~/turndb
|
/var/db/turndb
|
||||||
|
|
||||||
/usr/local/etc/turnserver.conf
|
/usr/local/etc/turnserver.conf
|
||||||
|
|
||||||
|
|||||||
53
configure
vendored
53
configure
vendored
@ -959,32 +959,6 @@ else
|
|||||||
TURN_NO_GCM="-DTURN_NO_GCM"
|
TURN_NO_GCM="-DTURN_NO_GCM"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
###########################
|
|
||||||
# Test SQLite setup
|
|
||||||
###########################
|
|
||||||
|
|
||||||
testlib sqlite3
|
|
||||||
ER=$?
|
|
||||||
if ! [ ${ER} -eq 0 ] ; then
|
|
||||||
${ECHO_CMD} "SQLite library found."
|
|
||||||
else
|
|
||||||
${ECHO_CMD} "ERROR: SQLite3 development library cannot be found."
|
|
||||||
cleanup
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
testsqlite_comp
|
|
||||||
ER=$?
|
|
||||||
if ! [ ${ER} -eq 0 ] ; then
|
|
||||||
${ECHO_CMD} "SQLite development found."
|
|
||||||
else
|
|
||||||
${ECHO_CMD} "ERROR: SQLite development libraries are not installed properly in required location."
|
|
||||||
${ECHO_CMD} "See the INSTALL file."
|
|
||||||
${ECHO_CMD} "Abort."
|
|
||||||
cleanup
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
###########################
|
###########################
|
||||||
# Test Libevent2 setup
|
# Test Libevent2 setup
|
||||||
###########################
|
###########################
|
||||||
@ -1055,6 +1029,31 @@ else
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
###########################
|
||||||
|
# Test SQLite setup
|
||||||
|
###########################
|
||||||
|
|
||||||
|
if [ -z "${TURN_NO_SQLITE}" ] ; then
|
||||||
|
|
||||||
|
testlib sqlite3
|
||||||
|
ER=$?
|
||||||
|
if ! [ ${ER} -eq 0 ] ; then
|
||||||
|
${ECHO_CMD} "SQLite library found."
|
||||||
|
else
|
||||||
|
${ECHO_CMD} "SQLite3 development library cannot be found."
|
||||||
|
TURN_NO_SQLITE="-DTURN_NO_SQLITE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
testsqlite_comp
|
||||||
|
ER=$?
|
||||||
|
if ! [ ${ER} -eq 0 ] ; then
|
||||||
|
${ECHO_CMD} "SQLite development found."
|
||||||
|
else
|
||||||
|
${ECHO_CMD} "SQLite development libraries are not installed properly in required location."
|
||||||
|
TURN_NO_SQLITE="-DTURN_NO_SQLITE"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
###########################
|
###########################
|
||||||
# Test PostgreSQL
|
# Test PostgreSQL
|
||||||
###########################
|
###########################
|
||||||
@ -1178,7 +1177,7 @@ ${ECHO_CMD} "LDFLAGS += ${OSLIBS}" >> Makefile
|
|||||||
${ECHO_CMD} "DBLIBS += ${DBLIBS}" >> Makefile
|
${ECHO_CMD} "DBLIBS += ${DBLIBS}" >> Makefile
|
||||||
${ECHO_CMD} "CFLAGS += ${OSCFLAGS}" >> Makefile
|
${ECHO_CMD} "CFLAGS += ${OSCFLAGS}" >> Makefile
|
||||||
${ECHO_CMD} "CPPFLAGS = ${CPPFLAGS}" >> Makefile
|
${ECHO_CMD} "CPPFLAGS = ${CPPFLAGS}" >> Makefile
|
||||||
${ECHO_CMD} "DBCFLAGS += ${DBCFLAGS} ${TURN_NO_PQ} ${TURN_NO_MYSQL} ${TURN_NO_MONGO} ${TURN_NO_HIREDIS}" >> Makefile
|
${ECHO_CMD} "DBCFLAGS += ${DBCFLAGS} ${TURN_NO_PQ} ${TURN_NO_MYSQL} ${TURN_NO_SQLITE} ${TURN_NO_MONGO} ${TURN_NO_HIREDIS}" >> Makefile
|
||||||
${ECHO_CMD} "#" >> Makefile
|
${ECHO_CMD} "#" >> Makefile
|
||||||
${ECHO_CMD} "PORTNAME = ${PORTNAME}" >> Makefile
|
${ECHO_CMD} "PORTNAME = ${PORTNAME}" >> Makefile
|
||||||
${ECHO_CMD} "PREFIX = ${PREFIX}" >> Makefile
|
${ECHO_CMD} "PREFIX = ${PREFIX}" >> Makefile
|
||||||
|
|||||||
@ -250,9 +250,9 @@
|
|||||||
|
|
||||||
# SQLite database file name.
|
# SQLite database file name.
|
||||||
#
|
#
|
||||||
# Default file name is ~/turndb (turndb in the process' home directory).
|
# Default file name is /var/db/turndb (turndb in the process' home directory).
|
||||||
#
|
#
|
||||||
#userdb=~/turndb
|
#userdb=/var/db/turndb
|
||||||
|
|
||||||
# PostgreSQL database connection string in the case that we are using PostgreSQL
|
# PostgreSQL database connection string in the case that we are using PostgreSQL
|
||||||
# as the user database.
|
# as the user database.
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
.\" Text automatically generated by txt2man
|
.\" Text automatically generated by txt2man
|
||||||
.TH TURN 1 "16 November 2014" "" ""
|
.TH TURN 1 "19 November 2014" "" ""
|
||||||
.SH GENERAL INFORMATION
|
.SH GENERAL INFORMATION
|
||||||
|
|
||||||
\fIturnadmin\fP is a TURN administration tool. This tool can be used to manage
|
\fIturnadmin\fP is a TURN administration tool. This tool can be used to manage
|
||||||
@ -132,7 +132,7 @@ Options with required values:
|
|||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB\-b\fP, \fB\-\-db\fP, \fB\-\-userdb\fP
|
\fB\-b\fP, \fB\-\-db\fP, \fB\-\-userdb\fP
|
||||||
SQLite user database file name (default \- ~/turndb).
|
SQLite user database file name (default \- /var/db/turndb).
|
||||||
See the same option in the \fIturnserver\fP section.
|
See the same option in the \fIturnserver\fP section.
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
@ -261,7 +261,7 @@ to see the man page.
|
|||||||
|
|
||||||
/etc/turnserver.conf
|
/etc/turnserver.conf
|
||||||
.PP
|
.PP
|
||||||
~/turndb
|
/var/db/turndb
|
||||||
.PP
|
.PP
|
||||||
/usr/local/etc/turnserver.conf
|
/usr/local/etc/turnserver.conf
|
||||||
.PP
|
.PP
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
.\" Text automatically generated by txt2man
|
.\" Text automatically generated by txt2man
|
||||||
.TH TURN 1 "16 November 2014" "" ""
|
.TH TURN 1 "19 November 2014" "" ""
|
||||||
.SH GENERAL INFORMATION
|
.SH GENERAL INFORMATION
|
||||||
|
|
||||||
The \fBTURN Server\fP project contains the source code of a TURN server and TURN client
|
The \fBTURN Server\fP project contains the source code of a TURN server and TURN client
|
||||||
@ -132,7 +132,7 @@ User database settings:
|
|||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB\-b\fP, \fB\-\-db\fP, \fB\-\-userdb\fP
|
\fB\-b\fP, \fB\-\-db\fP, \fB\-\-userdb\fP
|
||||||
SQLite user database file name (default \- ~/turndb).
|
SQLite user database file name (default \- /var/db/turndb).
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
\fB\-e\fP, \fB\-\-psql\-userdb\fP
|
\fB\-e\fP, \fB\-\-psql\-userdb\fP
|
||||||
@ -971,7 +971,7 @@ Users can be set in the command line, with multiple \fB\-u\fP or \fB\-\-user\fP
|
|||||||
Obviously, only a few users can be set that way, and their credentials are fixed
|
Obviously, only a few users can be set that way, and their credentials are fixed
|
||||||
for the \fIturnserver\fP process lifetime.
|
for the \fIturnserver\fP process lifetime.
|
||||||
.IP 2) 4
|
.IP 2) 4
|
||||||
Users can be stored in SQLite DB. The default SQLite database file is ~/turndb.
|
Users can be stored in SQLite DB. The default SQLite database file is /var/db/turndb.
|
||||||
.IP 3) 4
|
.IP 3) 4
|
||||||
Users can be stored in PostgreSQL database, if the \fIturnserver\fP was compiled with PostgreSQL
|
Users can be stored in PostgreSQL database, if the \fIturnserver\fP was compiled with PostgreSQL
|
||||||
support. Each time \fIturnserver\fP checks user credentials, it reads the database (asynchronously,
|
support. Each time \fIturnserver\fP checks user credentials, it reads the database (asynchronously,
|
||||||
@ -1096,7 +1096,7 @@ it would affect the performance.
|
|||||||
|
|
||||||
/etc/turnserver.conf
|
/etc/turnserver.conf
|
||||||
.PP
|
.PP
|
||||||
~/turndb
|
/var/db/turndb
|
||||||
.PP
|
.PP
|
||||||
/usr/local/etc/turnserver.conf
|
/usr/local/etc/turnserver.conf
|
||||||
.PP
|
.PP
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
.\" Text automatically generated by txt2man
|
.\" Text automatically generated by txt2man
|
||||||
.TH TURN 1 "16 November 2014" "" ""
|
.TH TURN 1 "19 November 2014" "" ""
|
||||||
.SH GENERAL INFORMATION
|
.SH GENERAL INFORMATION
|
||||||
|
|
||||||
A set of turnutils_* programs provides some utility functionality to be used
|
A set of turnutils_* programs provides some utility functionality to be used
|
||||||
@ -374,7 +374,7 @@ to see the man page.
|
|||||||
|
|
||||||
/etc/turnserver.conf
|
/etc/turnserver.conf
|
||||||
.PP
|
.PP
|
||||||
~/turndb
|
/var/db/turndb
|
||||||
.PP
|
.PP
|
||||||
/usr/local/etc/turnserver.conf
|
/usr/local/etc/turnserver.conf
|
||||||
.PP
|
.PP
|
||||||
|
|||||||
@ -32,6 +32,8 @@
|
|||||||
#include "../mainrelay.h"
|
#include "../mainrelay.h"
|
||||||
#include "dbd_sqlite.h"
|
#include "dbd_sqlite.h"
|
||||||
|
|
||||||
|
#if !defined(TURN_NO_SQLITE)
|
||||||
|
|
||||||
#include <sqlite3.h>
|
#include <sqlite3.h>
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -124,7 +126,12 @@ static sqlite3 * get_sqlite_connection(void) {
|
|||||||
int rc = sqlite3_open(pud->userdb, &sqliteconnection);
|
int rc = sqlite3_open(pud->userdb, &sqliteconnection);
|
||||||
if(!sqliteconnection || (rc != SQLITE_OK)) {
|
if(!sqliteconnection || (rc != SQLITE_OK)) {
|
||||||
const char* errmsg = sqlite3_errmsg(sqliteconnection);
|
const char* errmsg = sqlite3_errmsg(sqliteconnection);
|
||||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "Cannot open SQLite DB connection: <%s>, runtime error: %s\n",pud->userdb,errmsg);
|
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "Cannot open SQLite DB connection: <%s>, runtime error:\n %s\n (If your intention is to use a database for the TURN server, then\n check the TURN server process / file / DB directory permissions and\n re-start the TURN server)\n",pud->userdb,errmsg);
|
||||||
|
if(sqliteconnection) {
|
||||||
|
sqlite3_close(sqliteconnection);
|
||||||
|
sqliteconnection=NULL;
|
||||||
|
}
|
||||||
|
turn_params.default_users_db.userdb_type = TURN_USERDB_TYPE_UNKNOWN;
|
||||||
} else if(!donot_print_connection_success){
|
} else if(!donot_print_connection_success){
|
||||||
init_sqlite_database(sqliteconnection);
|
init_sqlite_database(sqliteconnection);
|
||||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "SQLite DB connection success: %s\n",pud->userdb);
|
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "SQLite DB connection success: %s\n",pud->userdb);
|
||||||
@ -923,8 +930,12 @@ static turn_dbdriver_t driver = {
|
|||||||
&sqlite_list_oauth_keys
|
&sqlite_list_oauth_keys
|
||||||
};
|
};
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////
|
||||||
|
|
||||||
turn_dbdriver_t * get_sqlite_dbdriver(void) {
|
turn_dbdriver_t * get_sqlite_dbdriver(void) {
|
||||||
return &driver;
|
return &driver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
@ -60,12 +60,19 @@ persistent_users_db_t * get_persistent_users_db(void) {
|
|||||||
return &(turn_params.default_users_db.persistent_users_db);
|
return &(turn_params.default_users_db.persistent_users_db);
|
||||||
}
|
}
|
||||||
|
|
||||||
turn_dbdriver_t * get_dbdriver() {
|
turn_dbdriver_t * get_dbdriver()
|
||||||
|
{
|
||||||
|
|
||||||
|
if (turn_params.default_users_db.userdb_type == TURN_USERDB_TYPE_UNKNOWN)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if (!_driver) {
|
if (!_driver) {
|
||||||
switch(turn_params.default_users_db.userdb_type) {
|
switch (turn_params.default_users_db.userdb_type){
|
||||||
|
#if !defined(TURN_NO_SQLITE)
|
||||||
case TURN_USERDB_TYPE_SQLITE:
|
case TURN_USERDB_TYPE_SQLITE:
|
||||||
_driver = get_sqlite_dbdriver();
|
_driver = get_sqlite_dbdriver();
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
#if !defined(TURN_NO_PQ)
|
#if !defined(TURN_NO_PQ)
|
||||||
case TURN_USERDB_TYPE_PQ:
|
case TURN_USERDB_TYPE_PQ:
|
||||||
_driver = get_pgsql_dbdriver();
|
_driver = get_pgsql_dbdriver();
|
||||||
|
|||||||
@ -412,7 +412,9 @@ static char Usage[] = "Usage: turnserver [options]\n"
|
|||||||
" Total bytes-per-second bandwidth the TURN server is allowed to allocate\n"
|
" Total bytes-per-second bandwidth the TURN server is allowed to allocate\n"
|
||||||
" for the sessions, combined (input and output network streams are treated separately).\n"
|
" for the sessions, combined (input and output network streams are treated separately).\n"
|
||||||
" -c <filename> Configuration file name (default - turnserver.conf).\n"
|
" -c <filename> Configuration file name (default - turnserver.conf).\n"
|
||||||
" -b, , --db, --userdb <filename> SQLite database file name (default - ~/turndb).\n"
|
#if !defined(TURN_NO_SQLITE)
|
||||||
|
" -b, , --db, --userdb <filename> SQLite database file name (default - /var/db/turndb).\n"
|
||||||
|
#endif
|
||||||
#if !defined(TURN_NO_PQ)
|
#if !defined(TURN_NO_PQ)
|
||||||
" -e, --psql-userdb, --sql-userdb <conn-string> PostgreSQL database connection string, if used (default - empty, no PostreSQL DB used).\n"
|
" -e, --psql-userdb, --sql-userdb <conn-string> PostgreSQL database connection string, if used (default - empty, no PostreSQL DB used).\n"
|
||||||
" This database can be used for long-term and short-term credentials mechanisms,\n"
|
" This database can be used for long-term and short-term credentials mechanisms,\n"
|
||||||
@ -584,7 +586,9 @@ static char AdminUsage[] = "Usage: turnadmin [command] [options]\n"
|
|||||||
" -g, --set-realm-option Set realm params: max-bps, total-quota, user-quota.\n"
|
" -g, --set-realm-option Set realm params: max-bps, total-quota, user-quota.\n"
|
||||||
" -G, --list-realm-options List realm params.\n"
|
" -G, --list-realm-options List realm params.\n"
|
||||||
"\nOptions with mandatory values:\n\n"
|
"\nOptions with mandatory values:\n\n"
|
||||||
" -b, --db, --userdb SQLite database file, default value is ~/turndb.\n"
|
#if !defined(TURN_NO_SQLITE)
|
||||||
|
" -b, --db, --userdb SQLite database file, default value is /var/db/turndb.\n"
|
||||||
|
#endif
|
||||||
#if !defined(TURN_NO_PQ)
|
#if !defined(TURN_NO_PQ)
|
||||||
" -e, --psql-userdb, --sql-userdb PostgreSQL user database connection string, if PostgreSQL DB is used.\n"
|
" -e, --psql-userdb, --sql-userdb PostgreSQL user database connection string, if PostgreSQL DB is used.\n"
|
||||||
#endif
|
#endif
|
||||||
@ -600,7 +604,7 @@ static char AdminUsage[] = "Usage: turnadmin [command] [options]\n"
|
|||||||
" -u, --user Username\n"
|
" -u, --user Username\n"
|
||||||
" -r, --realm Realm for long-term mechanism only\n"
|
" -r, --realm Realm for long-term mechanism only\n"
|
||||||
" -p, --password Password\n"
|
" -p, --password Password\n"
|
||||||
#if !defined(TURN_NO_PQ) || !defined(TURN_NO_MYSQL) || !defined(TURN_NO_MONGO) || !defined(TURN_NO_HIREDIS)
|
#if !defined(TURN_NO_SQLITE) || !defined(TURN_NO_PQ) || !defined(TURN_NO_MYSQL) || !defined(TURN_NO_MONGO) || !defined(TURN_NO_HIREDIS)
|
||||||
" -o, --origin Origin\n"
|
" -o, --origin Origin\n"
|
||||||
#endif
|
#endif
|
||||||
" -H, --sha256 Use SHA256 digest function to be used for the message integrity.\n"
|
" -H, --sha256 Use SHA256 digest function to be used for the message integrity.\n"
|
||||||
@ -714,8 +718,10 @@ static const struct myoption long_options[] = {
|
|||||||
{ "st-cred-mech", optional_argument, NULL, 'A' },
|
{ "st-cred-mech", optional_argument, NULL, 'A' },
|
||||||
{ "no-auth", optional_argument, NULL, 'z' },
|
{ "no-auth", optional_argument, NULL, 'z' },
|
||||||
{ "user", required_argument, NULL, 'u' },
|
{ "user", required_argument, NULL, 'u' },
|
||||||
|
#if !defined(TURN_NO_SQLITE)
|
||||||
{ "userdb", required_argument, NULL, 'b' },
|
{ "userdb", required_argument, NULL, 'b' },
|
||||||
{ "db", required_argument, NULL, 'b' },
|
{ "db", required_argument, NULL, 'b' },
|
||||||
|
#endif
|
||||||
#if !defined(TURN_NO_PQ)
|
#if !defined(TURN_NO_PQ)
|
||||||
{ "psql-userdb", required_argument, NULL, 'e' },
|
{ "psql-userdb", required_argument, NULL, 'e' },
|
||||||
{ "sql-userdb", required_argument, NULL, 'e' },
|
{ "sql-userdb", required_argument, NULL, 'e' },
|
||||||
@ -810,8 +816,10 @@ static const struct myoption admin_long_options[] = {
|
|||||||
{ "delete-all-secrets", no_argument, NULL, DEL_ALL_AUTH_SECRETS_OPT },
|
{ "delete-all-secrets", no_argument, NULL, DEL_ALL_AUTH_SECRETS_OPT },
|
||||||
{ "add-st", no_argument, NULL, 'A' },
|
{ "add-st", no_argument, NULL, 'A' },
|
||||||
{ "delete-st", no_argument, NULL, 'D' },
|
{ "delete-st", no_argument, NULL, 'D' },
|
||||||
|
#if !defined(TURN_NO_SQLITE)
|
||||||
{ "userdb", required_argument, NULL, 'b' },
|
{ "userdb", required_argument, NULL, 'b' },
|
||||||
{ "db", required_argument, NULL, 'b' },
|
{ "db", required_argument, NULL, 'b' },
|
||||||
|
#endif
|
||||||
#if !defined(TURN_NO_PQ)
|
#if !defined(TURN_NO_PQ)
|
||||||
{ "psql-userdb", required_argument, NULL, 'e' },
|
{ "psql-userdb", required_argument, NULL, 'e' },
|
||||||
{ "sql-userdb", required_argument, NULL, 'e' },
|
{ "sql-userdb", required_argument, NULL, 'e' },
|
||||||
@ -1104,10 +1112,12 @@ static void set_option(int c, char *value)
|
|||||||
case 'u':
|
case 'u':
|
||||||
add_user_account(value,0);
|
add_user_account(value,0);
|
||||||
break;
|
break;
|
||||||
|
#if !defined(TURN_NO_SQLITE)
|
||||||
case 'b':
|
case 'b':
|
||||||
STRCPY(turn_params.default_users_db.persistent_users_db.userdb, value);
|
STRCPY(turn_params.default_users_db.persistent_users_db.userdb, value);
|
||||||
turn_params.default_users_db.userdb_type = TURN_USERDB_TYPE_SQLITE;
|
turn_params.default_users_db.userdb_type = TURN_USERDB_TYPE_SQLITE;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
#if !defined(TURN_NO_PQ)
|
#if !defined(TURN_NO_PQ)
|
||||||
case 'e':
|
case 'e':
|
||||||
STRCPY(turn_params.default_users_db.persistent_users_db.userdb, value);
|
STRCPY(turn_params.default_users_db.persistent_users_db.userdb, value);
|
||||||
@ -1469,10 +1479,12 @@ static int adminmain(int argc, char **argv)
|
|||||||
case DEL_ALL_AUTH_SECRETS_OPT:
|
case DEL_ALL_AUTH_SECRETS_OPT:
|
||||||
ct = TA_DEL_SECRET;
|
ct = TA_DEL_SECRET;
|
||||||
break;
|
break;
|
||||||
|
#if !defined(TURN_NO_SQLITE)
|
||||||
case 'b':
|
case 'b':
|
||||||
STRCPY(turn_params.default_users_db.persistent_users_db.userdb,optarg);
|
STRCPY(turn_params.default_users_db.persistent_users_db.userdb,optarg);
|
||||||
turn_params.default_users_db.userdb_type = TURN_USERDB_TYPE_SQLITE;
|
turn_params.default_users_db.userdb_type = TURN_USERDB_TYPE_SQLITE;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
#if !defined(TURN_NO_PQ)
|
#if !defined(TURN_NO_PQ)
|
||||||
case 'e':
|
case 'e':
|
||||||
STRCPY(turn_params.default_users_db.persistent_users_db.userdb,optarg);
|
STRCPY(turn_params.default_users_db.persistent_users_db.userdb,optarg);
|
||||||
@ -1587,8 +1599,9 @@ static void print_features(unsigned long mfn)
|
|||||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "AEAD supported\n");
|
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "AEAD supported\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(TURN_NO_SQLITE)
|
||||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "SQLite supported\n");
|
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "SQLite supported\n");
|
||||||
|
#endif
|
||||||
#if !defined(TURN_NO_HIREDIS)
|
#if !defined(TURN_NO_HIREDIS)
|
||||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "Redis supported\n");
|
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "Redis supported\n");
|
||||||
#else
|
#else
|
||||||
|
|||||||
@ -781,9 +781,11 @@ static void cli_print_configuration(struct cli_session* cs)
|
|||||||
|
|
||||||
if(turn_params.default_users_db.persistent_users_db.userdb[0]) {
|
if(turn_params.default_users_db.persistent_users_db.userdb[0]) {
|
||||||
switch(turn_params.default_users_db.userdb_type) {
|
switch(turn_params.default_users_db.userdb_type) {
|
||||||
|
#if !defined(TURN_NO_SQLITE)
|
||||||
case TURN_USERDB_TYPE_SQLITE:
|
case TURN_USERDB_TYPE_SQLITE:
|
||||||
cli_print_str(cs,"SQLite","DB type",0);
|
cli_print_str(cs,"SQLite","DB type",0);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
#if !defined(TURN_NO_PQ)
|
#if !defined(TURN_NO_PQ)
|
||||||
case TURN_USERDB_TYPE_PQ:
|
case TURN_USERDB_TYPE_PQ:
|
||||||
cli_print_str(cs,"Postgres","DB type",0);
|
cli_print_str(cs,"Postgres","DB type",0);
|
||||||
|
|||||||
@ -48,7 +48,7 @@ extern "C" {
|
|||||||
|
|
||||||
//////////// Defines //////////////////////////////
|
//////////// Defines //////////////////////////////
|
||||||
|
|
||||||
#define DEFAULT_USERDB_FILE ("~/turndb")
|
#define DEFAULT_USERDB_FILE ("/var/db/turndb")
|
||||||
|
|
||||||
#define AUTH_SECRET_SIZE (512)
|
#define AUTH_SECRET_SIZE (512)
|
||||||
|
|
||||||
@ -100,7 +100,12 @@ struct auth_message {
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum _TURN_USERDB_TYPE {
|
enum _TURN_USERDB_TYPE {
|
||||||
|
#if !defined(TURN_NO_SQLITE)
|
||||||
|
TURN_USERDB_TYPE_UNKNOWN=-1,
|
||||||
TURN_USERDB_TYPE_SQLITE=0
|
TURN_USERDB_TYPE_SQLITE=0
|
||||||
|
#else
|
||||||
|
TURN_USERDB_TYPE_UNKNOWN=0
|
||||||
|
#endif
|
||||||
#if !defined(TURN_NO_PQ)
|
#if !defined(TURN_NO_PQ)
|
||||||
,TURN_USERDB_TYPE_PQ
|
,TURN_USERDB_TYPE_PQ
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user