Wilbert Berendsen
Bob Woodside
Stefaan Eeckels
+ Pascal Jermini
+2002-03-25 [paul] 0.7.4claws40
+
+ * src/account.c
+ src/news.c
+ src/nntp.[ch]
+ src/prefs_account.[ch]
+ enable NNTP over SSL. patch submitted by
+ Pascal Jermini <pascal@infinity.hn.org>
+
2002-03-24 [paul] 0.7.4claws39
* src/prefs_common.c
MICRO_VERSION=4
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=claws39
+EXTRA_VERSION=claws40
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
dnl set $target
ac_prefs->protocol == A_IMAP4 ?
(ac_prefs->ssl_imap ? "IMAP4 (SSL)" : "IMAP4") :
ac_prefs->protocol == A_LOCAL ? "Local" :
- ac_prefs->protocol == A_NNTP ? "NNTP" : "";
+ ac_prefs->protocol == A_NNTP ?
+ (ac_prefs->ssl_nntp ? "NNTP (SSL)" : "NNTP") : "";
#else
text[COL_PROTOCOL] = ac_prefs->protocol == A_POP3 ? "POP3" :
ac_prefs->protocol == A_APOP ? "POP3 (APOP)" :
#include "alertpanel.h"
#define NNTP_PORT 119
+#if USE_SSL
+#define NNTPS_PORT 563
+#endif
static void news_folder_init (Folder *folder,
const gchar *name,
const gchar *path);
+#if USE_SSL
+static Session *news_session_new (const gchar *server,
+ gushort port,
+ const gchar *userid,
+ const gchar *passwd, gboolean use_ssl);
+#else
static Session *news_session_new (const gchar *server,
gushort port,
const gchar *userid,
const gchar *passwd);
+#endif
static gint news_get_article_cmd (NNTPSession *session,
const gchar *cmd,
folder->remove_msg = news_remove_msg;
}
+#if USE_SSL
+static Session *news_session_new(const gchar *server, gushort port,
+ const gchar *userid, const gchar *passwd, gboolean use_ssl)
+#else
static Session *news_session_new(const gchar *server, gushort port,
const gchar *userid, const gchar *passwd)
+#endif
{
gchar buf[NNTPBUFSIZE];
NNTPSession *session;
log_message(_("creating NNTP connection to %s:%d ...\n"), server, port);
if (userid && passwd)
+#if USE_SSL
+ nntp_sock = nntp_open_auth(server, port, buf, userid, passwd, use_ssl);
+#else
nntp_sock = nntp_open_auth(server, port, buf, userid, passwd);
+#endif
else
+#if USE_SSL
+ nntp_sock = nntp_open(server, port, buf, use_ssl);
+#else
nntp_sock = nntp_open(server, port, buf);
+#endif
+
if (nntp_sock == NULL)
return NULL;
PrefsAccount *ac;
const gchar *userid = NULL;
gchar *passwd = NULL;
+ int port;
g_return_val_if_fail(folder != NULL, NULL);
g_return_val_if_fail(folder->account != NULL, NULL);
ac = folder->account;
+
+#if USE_SSL
+ if (ac->set_nntpport) {
+ port = ac->nntpport;
+ } else {
+ port = ac->ssl_nntp ? NNTPS_PORT : NNTP_PORT;
+ }
+#else
+ port = ac->set_nntpport ? ac->nntpport : NNTP_PORT;
+#endif
if (ac->use_nntp_auth && ac->userid && ac->userid[0]) {
userid = ac->userid;
if (ac->passwd && ac->passwd[0])
userid);
}
+#if USE_SSL
session = news_session_new(ac->nntp_server,
- ac->set_nntpport ? ac->nntpport : NNTP_PORT,
+ port,
+ userid, passwd, ac->ssl_nntp);
+#else
+ session = news_session_new(ac->nntp_server,
+ port,
userid, passwd);
+#endif
g_free(passwd);
return session;
#include "intl.h"
#include "nntp.h"
#include "socket.h"
+#include "ssl.h"
#include "utils.h"
static gint verbose = 1;
const gchar *format,
...);
+#if USE_SSL
+NNTPSockInfo *nntp_open(const gchar *server, gushort port, gchar *buf, gboolean use_ssl)
+#else
NNTPSockInfo *nntp_open(const gchar *server, gushort port, gchar *buf)
+#endif
{
SockInfo *sock;
NNTPSockInfo *nntp_sock;
server, port);
return NULL;
}
+
+#if USE_SSL
+ if (use_ssl && !ssl_init_socket(sock)) {
+ sock_close(sock);
+ return NULL;
+ }
+#endif
+
nntp_sock = g_new0(NNTPSockInfo, 1);
nntp_sock->sock = sock;
}
}
+#if USE_SSL
+NNTPSockInfo *nntp_open_auth(const gchar *server, gushort port, gchar *buf,
+ const gchar *userid, const gchar *passwd, gboolean use_ssl)
+#else
NNTPSockInfo *nntp_open_auth(const gchar *server, gushort port, gchar *buf,
const gchar *userid, const gchar *passwd)
+#endif
{
NNTPSockInfo *sock;
+#if USE_SSL
+ sock = nntp_open(server, port, buf, use_ssl);
+#else
sock = nntp_open(server, port, buf);
+#endif
+
if (!sock) return NULL;
sock->userid = g_strdup(userid);
#define NNTPBUFSIZE 8192
+#if USE_SSL
+NNTPSockInfo *nntp_open (const gchar *server,
+ gushort port,
+ gchar *buf,
+ gboolean use_ssl);
+#else
NNTPSockInfo *nntp_open (const gchar *server,
gushort port,
gchar *buf);
+#endif
+
+#if USE_SSL
+NNTPSockInfo *nntp_open_auth (const gchar *server,
+ gushort port,
+ gchar *buf,
+ const gchar *userid,
+ const gchar *passwd,
+ gboolean use_ssl);
+#else
NNTPSockInfo *nntp_open_auth (const gchar *server,
gushort port,
gchar *buf,
const gchar *userid,
const gchar *passwd);
+#endif
void nntp_close (NNTPSockInfo *sock);
gint nntp_group (NNTPSockInfo *sock,
const gchar *group,
GtkWidget *receive_frame;
GtkWidget *pop_chkbtn;
GtkWidget *imap_chkbtn;
+ GtkWidget *nntp_chkbtn;
GtkWidget *send_frame;
GtkWidget *smtp_nossl_radiobtn;
&ssl.pop_chkbtn, prefs_set_data_from_toggle, prefs_set_toggle},
{"ssl_imap", "FALSE", &tmp_ac_prefs.ssl_imap, P_BOOL,
&ssl.imap_chkbtn, prefs_set_data_from_toggle, prefs_set_toggle},
+ {"ssl_nntp", "FALSE", &tmp_ac_prefs.ssl_nntp, P_BOOL,
+ &ssl.nntp_chkbtn, prefs_set_data_from_toggle, prefs_set_toggle},
#endif /* USE_SSL */
/* Advanced */
GtkWidget *vbox2;
GtkWidget *pop_chkbtn;
GtkWidget *imap_chkbtn;
+ GtkWidget *nntp_chkbtn;
GtkWidget *send_frame;
GtkWidget *vbox3;
_("Use SSL for POP3 connection"));
PACK_CHECK_BUTTON (vbox2, imap_chkbtn,
_("Use SSL for IMAP4 connection"));
+ PACK_CHECK_BUTTON (vbox2, nntp_chkbtn,
+ _("Use SSL for NNTP connection"));
PACK_FRAME (vbox1, send_frame, _("Send (SMTP)"));
ssl.receive_frame = receive_frame;
ssl.pop_chkbtn = pop_chkbtn;
ssl.imap_chkbtn = imap_chkbtn;
+ ssl.nntp_chkbtn = nntp_chkbtn;
ssl.send_frame = send_frame;
ssl.smtp_nossl_radiobtn = smtp_nossl_radiobtn;
gtk_widget_set_sensitive(receive.imap_frame, FALSE);
gtk_widget_set_sensitive(receive.recvatgetall_chkbtn, TRUE);
#if USE_SSL
- gtk_widget_set_sensitive(ssl.receive_frame, FALSE);
+ gtk_widget_set_sensitive(ssl.receive_frame, TRUE);
gtk_widget_set_sensitive(ssl.pop_chkbtn, FALSE);
gtk_widget_set_sensitive(ssl.imap_chkbtn, FALSE);
+ gtk_widget_set_sensitive(ssl.nntp_chkbtn, TRUE);
gtk_widget_set_sensitive(ssl.send_frame, FALSE);
#endif
gtk_widget_hide(advanced.popport_hbox);
gtk_widget_set_sensitive(ssl.receive_frame, FALSE);
gtk_widget_set_sensitive(ssl.pop_chkbtn, FALSE);
gtk_widget_set_sensitive(ssl.imap_chkbtn, FALSE);
+ gtk_widget_set_sensitive(ssl.nntp_chkbtn, FALSE);
gtk_widget_set_sensitive(ssl.send_frame, TRUE);
#endif
gtk_widget_hide(advanced.popport_hbox);
gtk_widget_set_sensitive(ssl.receive_frame, TRUE);
gtk_widget_set_sensitive(ssl.pop_chkbtn, FALSE);
gtk_widget_set_sensitive(ssl.imap_chkbtn, TRUE);
+ gtk_widget_set_sensitive(ssl.nntp_chkbtn, FALSE);
gtk_widget_set_sensitive(ssl.send_frame, TRUE);
#endif
gtk_widget_hide(advanced.popport_hbox);
gtk_widget_set_sensitive(ssl.receive_frame, TRUE);
gtk_widget_set_sensitive(ssl.pop_chkbtn, TRUE);
gtk_widget_set_sensitive(ssl.imap_chkbtn, FALSE);
+ gtk_widget_set_sensitive(ssl.nntp_chkbtn, FALSE);
gtk_widget_set_sensitive(ssl.send_frame, TRUE);
#endif
gtk_widget_show(advanced.popport_hbox);
/* SSL */
gboolean ssl_pop;
gboolean ssl_imap;
+ gboolean ssl_nntp;
SSLSMTPType ssl_smtp;
#endif /* USE_SSL */