summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2005-06-21 08:05:58 +0000
committerSebastien Helleu <flashcode@flashtux.org>2005-06-21 08:05:58 +0000
commitf4abd0bf59fb8ec6eaded3fde4c52bbec293e388 (patch)
tree3c6c0c274932c54c7fd03846b97e1729d9e8fac6 /src
parentabe7e081478f3c22a0407d08b5a4d059dd7e44f3 (diff)
downloadweechat-f4abd0bf59fb8ec6eaded3fde4c52bbec293e388.zip
Added certificate management in SSL (connection now ok with SSL server)
Diffstat (limited to 'src')
-rw-r--r--src/common/weechat.c7
-rw-r--r--src/common/weechat.h2
-rw-r--r--src/irc/irc-server.c8
-rw-r--r--src/irc/irc.h4
4 files changed, 10 insertions, 11 deletions
diff --git a/src/common/weechat.c b/src/common/weechat.c
index b208d56ea..427408564 100644
--- a/src/common/weechat.c
+++ b/src/common/weechat.c
@@ -75,7 +75,7 @@ char *local_charset = NULL; /* local charset, for example: ISO-8859-1 */
int server_cmd_line; /* at least one server on WeeChat command line */
-gnutls_anon_client_credentials gnutls_anoncred; /* gnutls client credentials */
+gnutls_certificate_credentials gnutls_xcred; /* gnutls client credentials */
/*
@@ -522,7 +522,8 @@ wee_init_vars ()
/* init gnutls */
gnutls_global_init ();
- gnutls_anon_allocate_client_credentials (&gnutls_anoncred);
+ gnutls_certificate_allocate_credentials (&gnutls_xcred);
+ gnutls_certificate_set_x509_trust_file (gnutls_xcred, "ca.pem", GNUTLS_X509_FMT_PEM);
}
/*
@@ -616,7 +617,7 @@ wee_shutdown (int return_code)
if (local_charset)
free (local_charset);
alias_free_all ();
- gnutls_anon_free_client_credentials (gnutls_anoncred);
+ gnutls_certificate_free_credentials (gnutls_xcred);
gnutls_global_deinit();
exit (return_code);
}
diff --git a/src/common/weechat.h b/src/common/weechat.h
index 77ff134ba..58bb85717 100644
--- a/src/common/weechat.h
+++ b/src/common/weechat.h
@@ -108,7 +108,7 @@
extern int quit_weechat;
extern char *weechat_home;
extern char *local_charset;
-extern gnutls_anon_client_credentials gnutls_anoncred;
+extern gnutls_certificate_credentials gnutls_xcred;
extern void wee_log_printf (char *, ...);
extern void wee_dump (int);
diff --git a/src/irc/irc-server.c b/src/irc/irc-server.c
index 3497a724c..0e0c44b0b 100644
--- a/src/irc/irc-server.c
+++ b/src/irc/irc-server.c
@@ -878,8 +878,7 @@ server_connect (t_irc_server *server)
{
int child_pipe[2], set;
pid_t pid;
- const int proto_prio[] = { GNUTLS_TLS1, GNUTLS_SSL3, 0 };
- const int kx_prio[] = { GNUTLS_KX_ANON_DH, 0 };
+ const int cert_type_prio[] = { GNUTLS_CRT_X509, GNUTLS_CRT_OPENPGP, 0 };
irc_display_prefix (server->buffer, PREFIX_INFO);
gui_printf (server->buffer,
@@ -904,9 +903,8 @@ server_connect (t_irc_server *server)
return 0;
}
gnutls_set_default_priority (server->gnutls_sess);
- gnutls_protocol_set_priority (server->gnutls_sess, proto_prio);
- gnutls_kx_set_priority (server->gnutls_sess, kx_prio);
- gnutls_credentials_set (server->gnutls_sess, GNUTLS_CRD_ANON, &gnutls_anoncred);
+ gnutls_certificate_type_set_priority (server->gnutls_sess, cert_type_prio);
+ gnutls_credentials_set (server->gnutls_sess, GNUTLS_CRD_CERTIFICATE, gnutls_xcred);
}
/* create pipe for child process */
diff --git a/src/irc/irc.h b/src/irc/irc.h
index f0d5dc19a..35f61c69e 100644
--- a/src/irc/irc.h
+++ b/src/irc/irc.h
@@ -145,9 +145,9 @@ struct t_irc_server
char *nick3; /* 2nd alternate nickname */
char *username; /* user name */
char *realname; /* real name */
- char *command; /* command to run once connected */
+ char *command; /* command to run once connected */
int command_delay; /* delay after execution of command */
- char *autojoin; /* channels to automatically join */
+ char *autojoin; /* channels to automatically join */
int autorejoin; /* auto rejoin channels when kicked */
char *notify_levels; /* channels notify levels */