mom040267 11 سال پیش
والد
کامیت
a549c8b36f
3فایلهای تغییر یافته به همراه49 افزوده شده و 18 حذف شده
  1. 2 2
      ChangeLog
  2. 16 16
      INSTALL
  3. 31 0
      src/apps/relay/dbdrivers/dbd_sqlite.c

+ 2 - 2
ChangeLog

@@ -1,8 +1,8 @@
 11/10/2014 Oleg Moskalenko <[email protected]>
 Version 4.3.1.1 'Tolomei':
-	- TLS connection procedure improved in uclient test program.
-	- Flat-file user database is no longer supported.
 	- SQLite supported as the default user database.
+	- Support of the flat-file user database removed.
+	- TLS connection procedure improved in uclient test program.
 	
 11/07/2014 Oleg Moskalenko <[email protected]>
 Version 4.2.3.1 'Monza':

+ 16 - 16
INSTALL

@@ -761,9 +761,9 @@ database, or you can do that manually with psql.
 
 Fill in users, for example:
 
-  Shared secret for the TURN REST API:
+  Shared secret for the TURN REST API (realm north.gov):
   
-  $ bin/turnadmin -s logen -b "/var/db/turndb"
+  $ bin/turnadmin -s logen -r north.gov -b "/var/db/turndb"
   
   Long-term credentials mechanism:
   
@@ -775,8 +775,8 @@ Fill in users, for example:
   
   Short-term credentials mechanism:
    
-  $ bin/turnadmin -A -b "/var/db/turndb" -u gorst -r north.gov -p hero
-  $ bin/turnadmin -A -b "/var/db/turndb" -u ninefingers -r north.gov -p youhavetoberealistic 
+  $ bin/turnadmin -A -b "/var/db/turndb" -u gorst -p hero
+  $ bin/turnadmin -A -b "/var/db/turndb" -u ninefingers -p youhavetoberealistic 
 
 XV. PostgreSQL setup
 
@@ -885,9 +885,9 @@ database, or you can do that manually with psql.
 
 Fill in users, for example:
 
-  Shared secret for the TURN REST API:
+  Shared secret for the TURN REST API (realm north.gov):
   
-  $ bin/turnadmin -s logen -e "host=localhost dbname=coturn user=turn password=turn"
+  $ bin/turnadmin -s logen -r north.gov -e "host=localhost dbname=coturn user=turn password=turn"
   
   Long-term credentials mechanism:
   
@@ -899,8 +899,8 @@ Fill in users, for example:
   
   Short-term credentials mechanism:
    
-  $ bin/turnadmin -A -e "host=localhost dbname=coturn user=turn password=turn" -u gorst -r north.gov -p hero
-  $ bin/turnadmin -A -e "host=localhost dbname=coturn user=turn password=turn" -u ninefingers -r north.gov -p youhavetoberealistic 
+  $ bin/turnadmin -A -e "host=localhost dbname=coturn user=turn password=turn" -u gorst -p hero
+  $ bin/turnadmin -A -e "host=localhost dbname=coturn user=turn password=turn" -u ninefingers -p youhavetoberealistic 
 
 XVI. MySQL (MariaDB) setup
 
@@ -940,9 +940,9 @@ the root account.
   
 6) Fill in users, for example:
 
-  Shared secret for the TURN REST API:
+  Shared secret for the TURN REST API (realm north.gov):
   
-  $ bin/turnadmin -s logen -M "host=localhost dbname=coturn user=turn password=turn"
+  $ bin/turnadmin -s logen -r north.gov -M "host=localhost dbname=coturn user=turn password=turn"
   
   Long-term credentials mechanism:
   
@@ -954,8 +954,8 @@ the root account.
   
   Short-term credentials mechanism:
    
-  $ bin/turnadmin -A -M "host=localhost dbname=coturn user=turn password=turn" -u gorst -r north.gov -p hero
-  $ bin/turnadmin -A -M "host=localhost dbname=coturn user=turn password=turn" -u ninefingers -r north.gov -p youhavetoberealistic 
+  $ bin/turnadmin -A -M "host=localhost dbname=coturn user=turn password=turn" -u gorst -p hero
+  $ bin/turnadmin -A -M "host=localhost dbname=coturn user=turn password=turn" -u ninefingers -p youhavetoberealistic 
 
 7) Now we can use mysql in the turnserver.
 
@@ -1069,9 +1069,9 @@ tcp-keepalive 60
 
 Redis TURN admin commands:
 
-  Shared secret for the TURN REST API:
+  Shared secret for the TURN REST API (realm north.gov):
   
-  $ bin/turnadmin -s logen -N "host=localhost dbname=2 user=turn password=turn"
+  $ bin/turnadmin -s logen -r north.gov -N "host=localhost dbname=2 user=turn password=turn"
   
   Long-term credentials mechanism:
   
@@ -1083,8 +1083,8 @@ Redis TURN admin commands:
   
   Short-term credentials mechanism:
    
-  $ bin/turnadmin -A -N "host=localhost dbname=2 user=turn password=turn" -u gorst -r north.gov -p hero
-  $ bin/turnadmin -A -N "host=localhost dbname=2 user=turn password=turn" -u ninefingers -r north.gov -p youhavetoberealistic 
+  $ bin/turnadmin -A -N "host=localhost dbname=2 user=turn password=turn" -u gorst -p hero
+  $ bin/turnadmin -A -N "host=localhost dbname=2 user=turn password=turn" -u ninefingers -p youhavetoberealistic 
   
 See the file testredisdbsetup.sh for the data structure examples.
 

+ 31 - 0
src/apps/relay/dbdrivers/dbd_sqlite.c

@@ -290,6 +290,8 @@ static int sqlite_list_oauth_keys(void) {
 	oauth_key_data_raw key_;
 	oauth_key_data_raw *key=&key_;
 
+	donot_print_connection_success=1;
+
 	int ret = -1;
 
 	char statement[TURN_LONG_STRING_SIZE];
@@ -347,6 +349,9 @@ static int sqlite_set_user_key(u08bits *usname, u08bits *realm, const char *key)
 	char statement[TURN_LONG_STRING_SIZE];
 	sqlite3_stmt *st = NULL;
 	int rc = 0;
+
+	donot_print_connection_success=1;
+
 	sqlite3 *sqliteconnection = get_sqlite_connection();
 	if (sqliteconnection) {
 
@@ -371,6 +376,9 @@ static int sqlite_set_oauth_key(oauth_key_data_raw *key)
 	char statement[TURN_LONG_STRING_SIZE];
 	sqlite3_stmt *st = NULL;
 	int rc = 0;
+
+	donot_print_connection_success=1;
+
 	sqlite3 *sqliteconnection = get_sqlite_connection();
 	if (sqliteconnection) {
 		snprintf(
@@ -398,6 +406,9 @@ static int sqlite_set_user_pwd(u08bits *usname, st_password_t pwd)
 	char statement[TURN_LONG_STRING_SIZE];
 	sqlite3_stmt *st = NULL;
 	int rc = 0;
+
+	donot_print_connection_success=1;
+
 	sqlite3 *sqliteconnection = get_sqlite_connection();
 	if (sqliteconnection) {
 		snprintf(statement, sizeof(statement), "insert or replace into turnusers_st values('%s','%s')", usname, pwd);
@@ -419,6 +430,9 @@ static int sqlite_del_user(u08bits *usname, int is_st, u08bits *realm)
 	char statement[TURN_LONG_STRING_SIZE];
 	sqlite3_stmt *st = NULL;
 	int rc = 0;
+
+	donot_print_connection_success=1;
+
 	sqlite3 *sqliteconnection = get_sqlite_connection();
 	if (sqliteconnection) {
 		if (is_st) {
@@ -444,6 +458,9 @@ static int sqlite_del_oauth_key(const u08bits *kid)
 	char statement[TURN_LONG_STRING_SIZE];
 	sqlite3_stmt *st = NULL;
 	int rc = 0;
+
+	donot_print_connection_success=1;
+
 	sqlite3 *sqliteconnection = get_sqlite_connection();
 	if (sqliteconnection) {
 		snprintf(statement, sizeof(statement), "delete from oauth_key where kid = '%s'", (const char*) kid);
@@ -467,6 +484,9 @@ static int sqlite_list_users(int is_st, u08bits *realm)
 	char statement[TURN_LONG_STRING_SIZE];
 	sqlite3_stmt *st = NULL;
 	int rc = 0;
+
+	donot_print_connection_success=1;
+
 	sqlite3 *sqliteconnection = get_sqlite_connection();
 	if (sqliteconnection) {
 		if (is_st) {
@@ -547,6 +567,7 @@ static int sqlite_del_secret(u08bits *secret, u08bits *realm)
 	char statement[TURN_LONG_STRING_SIZE];
 	sqlite3_stmt *st = NULL;
 	int rc = 0;
+
 	sqlite3 *sqliteconnection = get_sqlite_connection();
 	if (sqliteconnection) {
 		if(!secret || (secret[0]==0))
@@ -573,6 +594,7 @@ static int sqlite_set_secret(u08bits *secret, u08bits *realm)
 	char statement[TURN_LONG_STRING_SIZE];
 	sqlite3_stmt *st = NULL;
 	int rc = 0;
+
 	sqlite3 *sqliteconnection = get_sqlite_connection();
 	if (sqliteconnection) {
 	  snprintf(statement,sizeof(statement),"insert or replace into turn_secret (realm,value) values('%s','%s')",realm,secret);
@@ -594,6 +616,8 @@ static int sqlite_add_origin(u08bits *origin, u08bits *realm)
 	char statement[TURN_LONG_STRING_SIZE];
 	sqlite3_stmt *st = NULL;
 	int rc = 0;
+	donot_print_connection_success=1;
+
 	sqlite3 *sqliteconnection = get_sqlite_connection();
 	if(sqliteconnection) {
 		snprintf(statement,sizeof(statement),"insert or replace into turn_origin_to_realm (origin,realm) values('%s','%s')",origin,realm);
@@ -615,6 +639,8 @@ static int sqlite_del_origin(u08bits *origin)
 	char statement[TURN_LONG_STRING_SIZE];
 	sqlite3_stmt *st = NULL;
 	int rc = 0;
+	donot_print_connection_success=1;
+
 	sqlite3 *sqliteconnection = get_sqlite_connection();
 	if(sqliteconnection) {
 		snprintf(statement,sizeof(statement),"delete from turn_origin_to_realm where origin='%s'",origin);
@@ -637,6 +663,7 @@ static int sqlite_list_origins(u08bits *realm)
 	char statement[TURN_LONG_STRING_SIZE];
 	sqlite3_stmt *st = NULL;
 	int rc = 0;
+
 	sqlite3 *sqliteconnection = get_sqlite_connection();
 	if (sqliteconnection) {
 		if (realm && realm[0]) {
@@ -680,6 +707,8 @@ static int sqlite_set_realm_option_one(u08bits *realm, unsigned long value, cons
 	char statement[TURN_LONG_STRING_SIZE];
 	sqlite3_stmt *st = NULL;
 	int rc = 0;
+	donot_print_connection_success=1;
+
 	sqlite3 *sqliteconnection = get_sqlite_connection();
 	if(sqliteconnection) {
 		if(value>0) {
@@ -704,6 +733,7 @@ static int sqlite_list_realm_options(u08bits *realm)
 	char statement[TURN_LONG_STRING_SIZE];
 	sqlite3_stmt *st = NULL;
 	int rc = 0;
+
 	sqlite3 *sqliteconnection = get_sqlite_connection();
 	if (sqliteconnection) {
 		if (realm && realm[0]) {
@@ -751,6 +781,7 @@ static void sqlite_auth_ping(void * rch)
 static int sqlite_get_ip_list(const char *kind, ip_range_list_t * list)
 {
 	int ret = -1;
+
 	sqlite3 *sqliteconnection = get_sqlite_connection();
 	if (sqliteconnection) {
 		char statement[TURN_LONG_STRING_SIZE];