PATCH: adding new remote imap mailbox no longer segvs
- From: James McPherson - TSG Engineer <James McPherson Sun COM>
- To: balsa-list gnome org
- Subject: PATCH: adding new remote imap mailbox no longer segvs
- Date: Thu, 18 Oct 2001 16:34:39 +1000
Hi - I tracked down the bug which affects the user's ability to add
a new remote imap mailbox. The problem was in two files: libbalsa/mailbox_imap.c
and src/mailbox-conf.c (context diffs against stock 1.2.0 attached).
Basically, src/mailbox-conf.c was calling libbalsa_mailbox_imap_set_path after
calling libbalsa_mailbox_imap_set_host, and since the mailbox path was a null
pointer therefore libbalsa_mailbox_imap_update_url was dying. badly.
The fix - put the call to libbalsa_mailbox_imap_set_path before
libbalsa_mailbox_imap_set_host, and then remove the call to
libbalsa_mailbox_imap_update_url from the function
libbalsa_mailbox_imap_set_path
cheers,
James C. McPherson
--
Technical Support Specialist 828 Pacific Highway
APAC Customer Care Centre Gordon NSW
Sun Microsystems Australia 2072
Failfast panic: those controlling voices in my head have
stopped telling me what to do.....
*** mailbox_imap.c Tue Sep 18 23:28:58 2001
--- mailbox_imap.c.new Thu Oct 18 15:42:05 2001
***************
*** 126,132 ****
libbalsa_mailbox_imap_init(LibBalsaMailboxImap * mailbox)
{
LibBalsaMailboxRemote *remote;
! mailbox->path = NULL;
mailbox->auth_type = AuthCram; /* reasonable default */
remote = LIBBALSA_MAILBOX_REMOTE(mailbox);
--- 126,132 ----
libbalsa_mailbox_imap_init(LibBalsaMailboxImap * mailbox)
{
LibBalsaMailboxRemote *remote;
! mailbox->path = NULL; /* set here, and not really set anywhere else!!!! */
mailbox->auth_type = AuthCram; /* reasonable default */
remote = LIBBALSA_MAILBOX_REMOTE(mailbox);
***************
*** 198,204 ****
{
LibBalsaServer* s = LIBBALSA_MAILBOX_REMOTE_SERVER(mailbox);
g_free(LIBBALSA_MAILBOX(mailbox)->url);
! LIBBALSA_MAILBOX(mailbox)->url = g_strdup_printf("imap%s://%s:%i/%s",
#ifdef USE_SSL
s->use_ssl ? "s" : "",
#else
--- 198,209 ----
{
LibBalsaServer* s = LIBBALSA_MAILBOX_REMOTE_SERVER(mailbox);
g_free(LIBBALSA_MAILBOX(mailbox)->url);
!
! fprintf (stderr,"\n");
! fprintf (stderr,"libbalsa/mailbox_imap.c:libbalsa_mailbox_imap_update_url: mailbox->path = %s\n",mailbox->path);
! fprintf (stderr,"\n");
!
! LIBBALSA_MAILBOX(mailbox)->url = g_strdup_printf("imap%s://%s:%d/%s",
#ifdef USE_SSL
s->use_ssl ? "s" : "",
#else
***************
*** 226,232 ****
--- 231,248 ----
g_return_if_fail(mailbox);
g_free(mailbox->path);
mailbox->path = g_strdup(path);
+
+ /*
+ * James.McPherson@Sun.COM 18 October 2001
+ * if we call this ...imap_update_url(mailbox) before the host field is set then we
+ * die in libbalsa_mailbox_imap_update_url with a null host rather than null path.
+ * somewhat chicken vs egg situation!
+ * so if we ignore the ...imap_update_url(mailbox) let's see how we go.....
+ */
+
+ /*
libbalsa_mailbox_imap_update_url(mailbox);
+ */
g_return_if_fail(LIBBALSA_MAILBOX_REMOTE_SERVER(mailbox));
server_settings_changed(LIBBALSA_MAILBOX_REMOTE_SERVER(mailbox),
*** mailbox-conf.c Fri Aug 24 07:24:37 2001
--- mailbox-conf.c.new Thu Oct 18 15:40:54 2001
***************
*** 591,596 ****
--- 591,607 ----
libbalsa_server_set_password(LIBBALSA_MAILBOX_REMOTE_SERVER(mailbox),
gtk_entry_get_text(GTK_ENTRY
(mcw->mb_data.imap.password)));
+
+ */
+ * inserted here by James.McPherson@Sun.COM because calling it after
+ * libbalsa_server_set_host results in segv due to the mailbox's path still being set to NULL
+ * 18 October 2001
+ */
+
+ libbalsa_mailbox_imap_set_path(mailbox,
+ (path == NULL || path[0] == '\0')
+ ? "INBOX" : path);
+
libbalsa_server_set_host(LIBBALSA_MAILBOX_REMOTE_SERVER(mailbox),
gtk_entry_get_text(GTK_ENTRY
(mcw->mb_data.imap.server)),
***************
*** 604,613 ****
gtk_signal_connect(GTK_OBJECT(LIBBALSA_MAILBOX_REMOTE_SERVER(mailbox)),
"get-password", GTK_SIGNAL_FUNC(ask_password),
mailbox);
-
- libbalsa_mailbox_imap_set_path(mailbox,
- (path == NULL || path[0] == '\0')
- ? "INBOX" : path);
g_free(path);
}
--- 615,620 ----
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]