mirror of
https://github.com/vanhauser-thc/thc-hydra.git
synced 2025-08-19 04:50:30 -07:00
Merge pull request #822 from mashaz/develop
fix: program stuck when mongodb user is empty
This commit is contained in:
commit
a22c55cdbe
1 changed files with 9 additions and 2 deletions
|
@ -72,10 +72,17 @@ int32_t start_mongodb(int32_t s, char *ip, int32_t port, unsigned char options,
|
||||||
mongoc_log_set_handler(NULL, NULL);
|
mongoc_log_set_handler(NULL, NULL);
|
||||||
bson_init(&q);
|
bson_init(&q);
|
||||||
|
|
||||||
snprintf(uri, sizeof(uri), "mongodb://%s:%s@%s:%d/?authSource=%s", login, pass, hydra_address2string(ip), port, miscptr);
|
if (login[0] == '\0' && pass[0] == '\0') {
|
||||||
|
snprintf(uri, sizeof(uri), "mongodb://%s:%d/?authSource=%s", hydra_address2string(ip), port, miscptr);
|
||||||
|
} else {
|
||||||
|
snprintf(uri, sizeof(uri), "mongodb://%s:%s@%s:%d/?authSource=%s", login, pass, hydra_address2string(ip), port, miscptr);
|
||||||
|
}
|
||||||
|
|
||||||
client = mongoc_client_new(uri);
|
client = mongoc_client_new(uri);
|
||||||
if (!client)
|
if (!client) {
|
||||||
|
hydra_completed_pair_skip();
|
||||||
return 3;
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
mongoc_client_set_appname(client, "hydra");
|
mongoc_client_set_appname(client, "hydra");
|
||||||
collection = mongoc_client_get_collection(client, miscptr, "test");
|
collection = mongoc_client_get_collection(client, miscptr, "test");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue