Browse Source

- add group functionality to read content from specified sections
of the mysql config to the db_mysql module, db_url examples:
* mysql://user:pass@[group]host:port/db or
* mysql://user:pass@[group]/db or
* mysql://[group]/db
- existing functionality is not changed, this is backward compatible
- check usernames for NULL before comparing in DB API, otherwise
it would segfault when only a group name is specified
- patch from Andreas Granig, agranig at sipwise dot com, closes #1815631


git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@5413 689a6050-402a-0410-94f2-e92a70836424

Henning Westerholt 16 years ago
parent
commit
c0a18f4fd1
1 changed files with 5 additions and 1 deletions
  1. 5 1
      lib/srdb1/db_id.c

+ 5 - 1
lib/srdb1/db_id.c

@@ -262,7 +262,11 @@ unsigned char cmp_db_id(const struct db_id* id1, const struct db_id* id2)
 	if (id1->port != id2->port) return 0;
 
 	if (strcmp(id1->scheme, id2->scheme)) return 0;
-	if (strcmp(id1->username, id2->username)) return 0;
+	if (id1->username!=0 && id2->username!=0) {
+		if (strcmp(id1->username, id2->username)) return 0;
+	} else {
+		if (id1->username!=0 || id2->username!=0) return 0;
+	}
 	if (id1->password!=0 && id2->password!=0) {
 		if(strcmp(id1->password, id2->password)) return 0;
 	} else {