Commits

Aristarkh Zagorodnikov committed d115404

Better authentication error message

Comments (0)

Files changed (1)

gridfs/mod_gridfs.cpp

 				mongo::DBClientBase& client = connection->conn();
 				if (config->username != 0 && config->password != 0)
 				{
+					const std::string& username = *config->username;
 					std::string errmsg;
-					if (!client.auth(database, *config->username, *config->password, errmsg))
+					if (!client.auth(database, username, *config->password, errmsg))
 					{
 						connection->done();
-						ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, request, "mod_gridfs: Authentication failed. %s", errmsg.c_str());
+						ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, request, "mod_gridfs: Failed to authenticate user '%s' with database '%s': %s.", 
+							username.c_str(), database.c_str(), errmsg.c_str());
 						return HTTP_INTERNAL_SERVER_ERROR;
 					}
 				}