blob: e83a683fb0ae21ae461d503b70946dcf93408adf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
#define BITLBEE_CORE
#include "bitlbee.h"
GList *auth_init(const char *backend)
{
GList *gl = NULL;
int ok = backend ? 0 : 1;
return ok ? gl : NULL;
}
storage_status_t auth_check_pass(irc_t *irc, const char *nick, const char *password)
{
GList *gl;
storage_status_t status = storage_check_pass(irc, nick, password);
if (status == STORAGE_CHECK_BACKEND) {
for (gl = global.auth; gl; gl = gl->next) {
auth_backend_t *be = gl->data;
if (!strcmp(be->name, irc->auth_backend)) {
status = be->check_pass(nick, password);
break;
}
}
} else if (status == STORAGE_NO_SUCH_USER && global.conf->auth_backend) {
for (gl = global.auth; gl; gl = gl->next) {
auth_backend_t *be = gl->data;
if (!strcmp(be->name, global.conf->auth_backend)) {
status = be->check_pass(nick, password);
/* Save the user so storage_load will pick them up, similar to
* what the register command would do */
if (status == STORAGE_OK) {
irc->auth_backend = g_strdup(global.conf->auth_backend);
storage_save(irc, (char *)password, 0);
}
break;
}
}
}
if (status == STORAGE_OK) {
irc_setpass(irc, password);
}
return status;
}
|