Lines 59-64
Link Here
|
59 |
|
59 |
|
60 |
gboolean safe_mode; |
60 |
gboolean safe_mode; |
61 |
LogTemplateOptions template_options; |
61 |
LogTemplateOptions template_options; |
|
|
62 |
|
63 |
gchar *user; |
64 |
gchar *password; |
65 |
|
62 |
time_t last_msg_stamp; |
66 |
time_t last_msg_stamp; |
63 |
|
67 |
|
64 |
ValuePairs *vp; |
68 |
ValuePairs *vp; |
Lines 76-81
Link Here
|
76 |
/* |
80 |
/* |
77 |
* Configuration |
81 |
* Configuration |
78 |
*/ |
82 |
*/ |
|
|
83 |
|
84 |
void |
85 |
afmongodb_dd_set_user(LogDriver *d, const gchar *user) |
86 |
{ |
87 |
MongoDBDestDriver *self = (MongoDBDestDriver *)d; |
88 |
|
89 |
g_free(self->user); |
90 |
self->user = g_strdup(user); |
91 |
} |
92 |
|
93 |
void |
94 |
afmongodb_dd_set_password(LogDriver *d, const gchar *password) |
95 |
{ |
96 |
MongoDBDestDriver *self = (MongoDBDestDriver *)d; |
97 |
|
98 |
g_free(self->password); |
99 |
self->password = g_strdup(password); |
100 |
} |
101 |
|
79 |
void |
102 |
void |
80 |
afmongodb_dd_set_host(LogDriver *d, const gchar *host) |
103 |
afmongodb_dd_set_host(LogDriver *d, const gchar *host) |
81 |
{ |
104 |
{ |
Lines 260-265
Link Here
|
260 |
g_free(host); |
283 |
g_free(host); |
261 |
} |
284 |
} |
262 |
|
285 |
|
|
|
286 |
if (self->user || self->password) |
287 |
{ |
288 |
if (!self->user || !self->password) |
289 |
{ |
290 |
msg_error("Neither the username, nor the password can be empty", NULL); |
291 |
return FALSE; |
292 |
} |
293 |
|
294 |
if (!mongo_sync_cmd_authenticate (self->conn, self->db, |
295 |
self->user, self->password)) |
296 |
{ |
297 |
msg_error("MongoDB authentication failed", NULL); |
298 |
return FALSE; |
299 |
} |
300 |
} |
301 |
|
263 |
return TRUE; |
302 |
return TRUE; |
264 |
} |
303 |
} |
265 |
|
304 |
|
Lines 578-583
Link Here
|
578 |
|
617 |
|
579 |
g_free(self->db); |
618 |
g_free(self->db); |
580 |
g_free(self->coll); |
619 |
g_free(self->coll); |
|
|
620 |
g_free(self->user); |
621 |
g_free(self->password); |
581 |
g_free(self->address); |
622 |
g_free(self->address); |
582 |
string_list_free(self->servers); |
623 |
string_list_free(self->servers); |
583 |
if (self->vp) |
624 |
if (self->vp) |