Parcourir la source

- check for null passwords (on some OS strcmp crashes) - reported by Edgar Barbosa
- tbd: the other attributes in db url has to be investigated if they are optional or not


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

Daniel-Constantin Mierla il y a 19 ans
Parent
commit
850c6f956e
1 fichiers modifiés avec 5 ajouts et 1 suppressions
  1. 5 1
      lib/srdb1/db_id.c

+ 5 - 1
lib/srdb1/db_id.c

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