Commit dc0dbafe dc0dbafe6fbd3560a4140e98777fb58bc433e92f by Sergey Poznyakoff

Bugfix

* libproto/pop/pop3_stream.c (_pop3_event_cb)
(mu_pop3_filter_create): Fix buffer size manipulation.
* libmu_auth/tls.c: Protect gnutls debugging code with
DEBUG_TLS.
1 parent 4af4860e
...@@ -115,7 +115,7 @@ mu_check_tls_environment (void) ...@@ -115,7 +115,7 @@ mu_check_tls_environment (void)
115 115
116 int mu_tls_enable = 0; 116 int mu_tls_enable = 0;
117 117
118 #if 0 118 #ifdef DEBUG_TLS
119 void 119 void
120 _mu_gtls_logger(int level, const char *text) 120 _mu_gtls_logger(int level, const char *text)
121 { 121 {
...@@ -128,7 +128,7 @@ mu_init_tls_libs (void) ...@@ -128,7 +128,7 @@ mu_init_tls_libs (void)
128 { 128 {
129 if (mu_tls_module_config.enable && !mu_tls_enable) 129 if (mu_tls_module_config.enable && !mu_tls_enable)
130 mu_tls_enable = !gnutls_global_init (); /* Returns 1 on success */ 130 mu_tls_enable = !gnutls_global_init (); /* Returns 1 on success */
131 #if 0 131 #ifdef DEBUG_TLS
132 gnutls_global_set_log_function (_mu_gtls_logger); 132 gnutls_global_set_log_function (_mu_gtls_logger);
133 gnutls_global_set_log_level (110); 133 gnutls_global_set_log_level (110);
134 #endif 134 #endif
......
...@@ -56,7 +56,8 @@ _pop3_event_cb (mu_stream_t str, int ev, int flags) ...@@ -56,7 +56,8 @@ _pop3_event_cb (mu_stream_t str, int ev, int flags)
56 56
57 if (sp->flags & _POP3F_CHBUF) 57 if (sp->flags & _POP3F_CHBUF)
58 { 58 {
59 mu_stream_ioctl (str, MU_IOCTL_SET_TRANSPORT_BUFFER, 59 mu_stream_ioctl (sp->pop3->carrier,
60 MU_IOCTL_SET_TRANSPORT_BUFFER,
60 &sp->oldbuf); 61 &sp->oldbuf);
61 sp->flags = _POP3F_DONE; 62 sp->flags = _POP3F_DONE;
62 } 63 }
...@@ -73,27 +74,24 @@ mu_pop3_filter_create (mu_stream_t *pstream, mu_stream_t stream) ...@@ -73,27 +74,24 @@ mu_pop3_filter_create (mu_stream_t *pstream, mu_stream_t stream)
73 MU_STREAM_READ | MU_STREAM_AUTOCLOSE); 74 MU_STREAM_READ | MU_STREAM_AUTOCLOSE);
74 if (rc == 0) 75 if (rc == 0)
75 { 76 {
77 struct mu_pop3_stream *sp = (struct mu_pop3_stream *) stream;
76 mu_stream_t str = *pstream; 78 mu_stream_t str = *pstream;
77 mu_transport_t trans[2];
78 79
79 str->event_cb = _pop3_event_cb; 80 str->event_cb = _pop3_event_cb;
80 str->event_mask = _MU_STR_EOF; 81 str->event_mask = _MU_STR_EOF;
81 82
82 if (mu_stream_ioctl (str, MU_IOCTL_GET_TRANSPORT, trans) == 0) 83 sp->oldbuf.type = MU_TRANSPORT_OUTPUT;
84 if (mu_stream_ioctl (sp->pop3->carrier, MU_IOCTL_GET_TRANSPORT_BUFFER,
85 &sp->oldbuf) == 0)
83 { 86 {
84 struct mu_pop3_stream *sp = (struct mu_pop3_stream *) trans[0]; 87 struct mu_buffer_query newbuf;
85 if (mu_stream_ioctl (stream, MU_IOCTL_GET_TRANSPORT_BUFFER, 88
86 &sp->oldbuf) == 0) 89 sp->flags |= _POP3F_CHBUF;
87 { 90 newbuf.type = MU_TRANSPORT_OUTPUT;
88 struct mu_buffer_query newbuf; 91 newbuf.buftype = mu_buffer_full;
89 92 newbuf.bufsize = 64*1024;
90 sp->flags |= _POP3F_CHBUF; 93 mu_stream_ioctl (sp->pop3->carrier, MU_IOCTL_SET_TRANSPORT_BUFFER,
91 newbuf.type = MU_TRANSPORT_OUTPUT; 94 &newbuf);
92 newbuf.buftype = mu_buffer_full;
93 newbuf.bufsize = 64*1024;
94 mu_stream_ioctl (str, MU_IOCTL_SET_TRANSPORT_BUFFER,
95 &newbuf);
96 }
97 } 95 }
98 } 96 }
99 return rc; 97 return rc;
......