mirror of
https://github.com/irssi/irssi.git
synced 2026-08-17 15:42:26 +02:00
SASL support
The only supported methods are PLAIN and EXTERNAL, the latter is untested as of
now.
The code gets the values from the keys named sasl_{mechanism,username,password}
specified for each chatnet.
This commit is contained in:
parent
762c1d7f2c
commit
b8d3301d34
10 changed files with 200 additions and 5 deletions
|
|
@ -28,6 +28,7 @@
|
|||
#include "irc-chatnets.h"
|
||||
#include "irc-servers-setup.h"
|
||||
#include "irc-servers.h"
|
||||
#include "sasl.h"
|
||||
|
||||
/* Fill information to connection from server setup record */
|
||||
static void sig_server_setup_fill_reconn(IRC_SERVER_CONNECT_REC *conn,
|
||||
|
|
@ -79,6 +80,29 @@ static void sig_server_setup_fill_chatnet(IRC_SERVER_CONNECT_REC *conn,
|
|||
conn->cmd_queue_speed = ircnet->cmd_queue_speed;
|
||||
if (ircnet->max_query_chans > 0)
|
||||
conn->max_query_chans = ircnet->max_query_chans;
|
||||
|
||||
/* Validate the SASL parameters filled by sig_chatnet_read() */
|
||||
conn->sasl_mechanism = SASL_MECHANISM_NONE;
|
||||
|
||||
if (ircnet->sasl_mechanism != NULL) {
|
||||
if (!g_ascii_strcasecmp(ircnet->sasl_mechanism, "plain")) {
|
||||
/* The PLAIN method needs both the username and the password */
|
||||
if (ircnet->sasl_username != NULL && *ircnet->sasl_username &&
|
||||
ircnet->sasl_password != NULL && *ircnet->sasl_password) {
|
||||
conn->sasl_mechanism = SASL_MECHANISM_PLAIN;
|
||||
conn->sasl_username = ircnet->sasl_username;
|
||||
conn->sasl_password = ircnet->sasl_password;
|
||||
} else
|
||||
g_warning("The fields sasl_username and sasl_password are either undefined or empty");
|
||||
}
|
||||
else if (!g_ascii_strcasecmp(ircnet->sasl_mechanism, "external")) {
|
||||
conn->sasl_mechanism = SASL_MECHANISM_EXTERNAL;
|
||||
conn->sasl_username = NULL;
|
||||
conn->sasl_password = NULL;
|
||||
}
|
||||
else
|
||||
g_warning("Unsupported SASL mechanism \"%s\" selected", ircnet->sasl_mechanism);
|
||||
}
|
||||
}
|
||||
|
||||
static void init_userinfo(void)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue