Revised use of const modifiers
Showing
31 changed files
with
95 additions
and
84 deletions
... | @@ -253,7 +253,7 @@ _gsasl_open (stream_t stream) | ... | @@ -253,7 +253,7 @@ _gsasl_open (stream_t stream) |
253 | } | 253 | } |
254 | 254 | ||
255 | int | 255 | int |
256 | _gsasl_strerror (stream_t stream, char **pstr) | 256 | _gsasl_strerror (stream_t stream, const char **pstr) |
257 | { | 257 | { |
258 | struct _gsasl_stream *s = stream_get_owner (stream); | 258 | struct _gsasl_stream *s = stream_get_owner (stream); |
259 | *pstr = gsasl_strerror (s->last_err); | 259 | *pstr = gsasl_strerror (s->last_err); | ... | ... |
... | @@ -85,7 +85,7 @@ _auth_lb_grow (struct _line_buffer *s, const char *ptr, size_t size) | ... | @@ -85,7 +85,7 @@ _auth_lb_grow (struct _line_buffer *s, const char *ptr, size_t size) |
85 | } | 85 | } |
86 | 86 | ||
87 | int | 87 | int |
88 | _auth_lb_read (struct _line_buffer *s, const char *optr, size_t osize) | 88 | _auth_lb_read (struct _line_buffer *s, char *optr, size_t osize) |
89 | { | 89 | { |
90 | int len; | 90 | int len; |
91 | 91 | ||
... | @@ -103,7 +103,7 @@ _auth_lb_read (struct _line_buffer *s, const char *optr, size_t osize) | ... | @@ -103,7 +103,7 @@ _auth_lb_read (struct _line_buffer *s, const char *optr, size_t osize) |
103 | } | 103 | } |
104 | 104 | ||
105 | int | 105 | int |
106 | _auth_lb_readline (struct _line_buffer *s, const char *ptr, size_t size) | 106 | _auth_lb_readline (struct _line_buffer *s, char *ptr, size_t size) |
107 | { | 107 | { |
108 | char *p = strchr (s->buffer, '\n'); | 108 | char *p = strchr (s->buffer, '\n'); |
109 | 109 | ... | ... |
... | @@ -24,9 +24,8 @@ void _auth_lb_destroy __P((struct _line_buffer **s)); | ... | @@ -24,9 +24,8 @@ void _auth_lb_destroy __P((struct _line_buffer **s)); |
24 | void _auth_lb_drop __P((struct _line_buffer *s)); | 24 | void _auth_lb_drop __P((struct _line_buffer *s)); |
25 | 25 | ||
26 | int _auth_lb_grow __P((struct _line_buffer *s, const char *ptr, size_t size)); | 26 | int _auth_lb_grow __P((struct _line_buffer *s, const char *ptr, size_t size)); |
27 | int _auth_lb_read __P((struct _line_buffer *s, const char *ptr, size_t size)); | 27 | int _auth_lb_read __P((struct _line_buffer *s, char *ptr, size_t size)); |
28 | int _auth_lb_readline __P((struct _line_buffer *s, const char *ptr, | 28 | int _auth_lb_readline __P((struct _line_buffer *s, char *ptr, size_t size)); |
29 | size_t size)); | ||
30 | int _auth_lb_writelines __P((struct _line_buffer *s, const char *iptr, | 29 | int _auth_lb_writelines __P((struct _line_buffer *s, const char *iptr, |
31 | size_t isize, off_t offset, | 30 | size_t isize, off_t offset, |
32 | int (*wr) __PMT ((void *data, char *start, | 31 | int (*wr) __PMT ((void *data, char *start, | ... | ... |
... | @@ -29,7 +29,8 @@ | ... | @@ -29,7 +29,8 @@ |
29 | 29 | ||
30 | 30 | ||
31 | int | 31 | int |
32 | mysql_auth_sql_by_name (struct mu_auth_data **return_data, void *key, | 32 | mysql_auth_sql_by_name (struct mu_auth_data **return_data, |
33 | const void *key, | ||
33 | void *func_data ARG_UNUSED, | 34 | void *func_data ARG_UNUSED, |
34 | void *call_data ARG_UNUSED) | 35 | void *call_data ARG_UNUSED) |
35 | { | 36 | { |
... | @@ -224,7 +225,7 @@ mysql_auth_sql_by_uid (struct mu_auth_data **return_data, void *key, | ... | @@ -224,7 +225,7 @@ mysql_auth_sql_by_uid (struct mu_auth_data **return_data, void *key, |
224 | 225 | ||
225 | int | 226 | int |
226 | mysql_sql_authenticate (struct mu_auth_data **return_data ARG_UNUSED, | 227 | mysql_sql_authenticate (struct mu_auth_data **return_data ARG_UNUSED, |
227 | void *key, | 228 | const void *key, |
228 | void *func_data ARG_UNUSED, void *call_data) | 229 | void *func_data ARG_UNUSED, void *call_data) |
229 | { | 230 | { |
230 | struct mu_auth_data *auth_data = key; | 231 | struct mu_auth_data *auth_data = key; | ... | ... |
... | @@ -102,11 +102,11 @@ static struct pam_conv PAM_conversation = { &mu_pam_conv, NULL }; | ... | @@ -102,11 +102,11 @@ static struct pam_conv PAM_conversation = { &mu_pam_conv, NULL }; |
102 | 102 | ||
103 | int | 103 | int |
104 | mu_authenticate_pam (struct mu_auth_data **return_data ARG_UNUSED, | 104 | mu_authenticate_pam (struct mu_auth_data **return_data ARG_UNUSED, |
105 | void *key, | 105 | const void *key, |
106 | void *func_data ARG_UNUSED, | 106 | void *func_data ARG_UNUSED, |
107 | void *call_data) | 107 | void *call_data) |
108 | { | 108 | { |
109 | struct mu_auth_data *auth_data = key; | 109 | const struct mu_auth_data *auth_data = key; |
110 | char *pass = call_data; | 110 | char *pass = call_data; |
111 | pam_handle_t *pamh; | 111 | pam_handle_t *pamh; |
112 | int pamerror; | 112 | int pamerror; |
... | @@ -164,7 +164,7 @@ struct argp mu_pam_argp = { | ... | @@ -164,7 +164,7 @@ struct argp mu_pam_argp = { |
164 | 164 | ||
165 | int | 165 | int |
166 | mu_authenticate_pam (struct mu_auth_data **return_data ARG_UNUSED, | 166 | mu_authenticate_pam (struct mu_auth_data **return_data ARG_UNUSED, |
167 | void *key ARG_UNUSED, | 167 | const void *key ARG_UNUSED, |
168 | void *func_data ARG_UNUSED, | 168 | void *func_data ARG_UNUSED, |
169 | void *call_data ARG_UNUSED) | 169 | void *call_data ARG_UNUSED) |
170 | { | 170 | { | ... | ... |
... | @@ -136,7 +136,8 @@ pg_auth_common (PGresult *res, char *query_str, struct mu_auth_data **auth) | ... | @@ -136,7 +136,8 @@ pg_auth_common (PGresult *res, char *query_str, struct mu_auth_data **auth) |
136 | } | 136 | } |
137 | 137 | ||
138 | int | 138 | int |
139 | pg_auth_sql_by_name (struct mu_auth_data **return_data, void *key, | 139 | pg_auth_sql_by_name (struct mu_auth_data **return_data, |
140 | const void *key, | ||
140 | void *func_data ARG_UNUSED, | 141 | void *func_data ARG_UNUSED, |
141 | void *call_data ARG_UNUSED) | 142 | void *call_data ARG_UNUSED) |
142 | { | 143 | { |
... | @@ -185,7 +186,8 @@ pg_auth_sql_by_name (struct mu_auth_data **return_data, void *key, | ... | @@ -185,7 +186,8 @@ pg_auth_sql_by_name (struct mu_auth_data **return_data, void *key, |
185 | } | 186 | } |
186 | 187 | ||
187 | int | 188 | int |
188 | pg_auth_sql_by_uid (struct mu_auth_data **return_data, void *key, | 189 | pg_auth_sql_by_uid (struct mu_auth_data **return_data, |
190 | const void *key, | ||
189 | void *func_data ARG_UNUSED, | 191 | void *func_data ARG_UNUSED, |
190 | void *call_data ARG_UNUSED) | 192 | void *call_data ARG_UNUSED) |
191 | { | 193 | { |
... | @@ -235,13 +237,14 @@ pg_auth_sql_by_uid (struct mu_auth_data **return_data, void *key, | ... | @@ -235,13 +237,14 @@ pg_auth_sql_by_uid (struct mu_auth_data **return_data, void *key, |
235 | } | 237 | } |
236 | 238 | ||
237 | int | 239 | int |
238 | pg_sql_authenticate (struct mu_auth_data **return_data ARG_UNUSED, void *key, | 240 | pg_sql_authenticate (struct mu_auth_data **return_data ARG_UNUSED, |
241 | const void *key, | ||
239 | void *func_data ARG_UNUSED, void *call_data) | 242 | void *func_data ARG_UNUSED, void *call_data) |
240 | { | 243 | { |
241 | PGconn *conn; | 244 | PGconn *conn; |
242 | PGresult *res = NULL; | 245 | PGresult *res = NULL; |
243 | 246 | ||
244 | struct mu_auth_data *auth_data = key; | 247 | const struct mu_auth_data *auth_data = key; |
245 | char *pass = call_data; | 248 | char *pass = call_data; |
246 | char *query_str = NULL; | 249 | char *query_str = NULL; |
247 | int rc = 1; | 250 | int rc = 1; | ... | ... |
... | @@ -214,11 +214,14 @@ struct argp mu_sql_argp = { | ... | @@ -214,11 +214,14 @@ struct argp mu_sql_argp = { |
214 | 214 | ||
215 | 215 | ||
216 | # ifdef HAVE_MYSQL | 216 | # ifdef HAVE_MYSQL |
217 | int mysql_auth_sql_by_name __P((struct mu_auth_data **return_data, void *key, | 217 | int mysql_auth_sql_by_name __P((struct mu_auth_data **return_data, |
218 | const void *key, | ||
218 | void *func_data, void *call_data)); | 219 | void *func_data, void *call_data)); |
219 | int mysql_auth_sql_by_uid __P((struct mu_auth_data **return_data, void *key, | 220 | int mysql_auth_sql_by_uid __P((struct mu_auth_data **return_data, |
221 | const void *key, | ||
220 | void *func_data, void *call_data)); | 222 | void *func_data, void *call_data)); |
221 | int mysql_sql_authenticate __P((struct mu_auth_data **return_data, void *key, | 223 | int mysql_sql_authenticate __P((struct mu_auth_data **return_data, |
224 | const void *key, | ||
222 | void *func_data, void *call_data)); | 225 | void *func_data, void *call_data)); |
223 | 226 | ||
224 | # define mu_sql_authenticate mysql_sql_authenticate | 227 | # define mu_sql_authenticate mysql_sql_authenticate | ... | ... |
... | @@ -534,7 +534,7 @@ _tls_open_client (stream_t stream) | ... | @@ -534,7 +534,7 @@ _tls_open_client (stream_t stream) |
534 | } | 534 | } |
535 | 535 | ||
536 | int | 536 | int |
537 | _tls_strerror (stream_t stream, char **pstr) | 537 | _tls_strerror (stream_t stream, const char **pstr) |
538 | { | 538 | { |
539 | struct _tls_stream *s = stream_get_owner (stream); | 539 | struct _tls_stream *s = stream_get_owner (stream); |
540 | *pstr = gnutls_strerror (s->last_err); | 540 | *pstr = gnutls_strerror (s->last_err); | ... | ... |
... | @@ -57,7 +57,7 @@ | ... | @@ -57,7 +57,7 @@ |
57 | static char *site_virtual_pwddir = SITE_VIRTUAL_PWDDIR; | 57 | static char *site_virtual_pwddir = SITE_VIRTUAL_PWDDIR; |
58 | 58 | ||
59 | static struct passwd * | 59 | static struct passwd * |
60 | getpwnam_virtual (char *u) | 60 | getpwnam_virtual (const char *u) |
61 | { | 61 | { |
62 | struct passwd *pw = NULL; | 62 | struct passwd *pw = NULL; |
63 | FILE *pfile; | 63 | FILE *pfile; |
... | @@ -133,7 +133,8 @@ getpwnam_ip_virtual (const char *u) | ... | @@ -133,7 +133,8 @@ getpwnam_ip_virtual (const char *u) |
133 | 133 | ||
134 | /* Virtual domains */ | 134 | /* Virtual domains */ |
135 | static int | 135 | static int |
136 | mu_auth_virt_domain_by_name (struct mu_auth_data **return_data, void *key, | 136 | mu_auth_virt_domain_by_name (struct mu_auth_data **return_data, |
137 | const void *key, | ||
137 | void *unused_func_data, void *unused_call_data) | 138 | void *unused_func_data, void *unused_call_data) |
138 | { | 139 | { |
139 | int rc; | 140 | int rc; |
... | @@ -202,7 +203,7 @@ struct argp mu_virt_argp = { | ... | @@ -202,7 +203,7 @@ struct argp mu_virt_argp = { |
202 | #else | 203 | #else |
203 | static int | 204 | static int |
204 | mu_auth_virt_domain_by_name (struct mu_auth_data **return_data ARG_UNUSED, | 205 | mu_auth_virt_domain_by_name (struct mu_auth_data **return_data ARG_UNUSED, |
205 | void *key ARG_UNUSED, | 206 | const void *key ARG_UNUSED, |
206 | void *func_data ARG_UNUSED, | 207 | void *func_data ARG_UNUSED, |
207 | void *call_data ARG_UNUSED) | 208 | void *call_data ARG_UNUSED) |
208 | { | 209 | { | ... | ... |
... | @@ -58,7 +58,7 @@ main (int argc, char **argv) | ... | @@ -58,7 +58,7 @@ main (int argc, char **argv) |
58 | stream_flush (out); | 58 | stream_flush (out); |
59 | if (rc) | 59 | if (rc) |
60 | { | 60 | { |
61 | char *p; | 61 | const char *p; |
62 | stream_strerror (cvt, &p); | 62 | stream_strerror (cvt, &p); |
63 | fprintf (stderr, "error: %s / %s\n", mu_strerror (rc), p); | 63 | fprintf (stderr, "error: %s / %s\n", mu_strerror (rc), p); |
64 | } | 64 | } | ... | ... |
... | @@ -39,7 +39,7 @@ create_gsasl_stream (stream_t *newstr, stream_t transport, int flags) | ... | @@ -39,7 +39,7 @@ create_gsasl_stream (stream_t *newstr, stream_t transport, int flags) |
39 | 39 | ||
40 | if ((rc = stream_open (*newstr)) != 0) | 40 | if ((rc = stream_open (*newstr)) != 0) |
41 | { | 41 | { |
42 | char *p; | 42 | const char *p; |
43 | if (stream_strerror (*newstr, &p)) | 43 | if (stream_strerror (*newstr, &p)) |
44 | p = mu_strerror (rc); | 44 | p = mu_strerror (rc); |
45 | syslog (LOG_ERR, _("cannot open SASL input stream: %s"), p); | 45 | syslog (LOG_ERR, _("cannot open SASL input stream: %s"), p); |
... | @@ -148,7 +148,6 @@ auth_gsasl_capa_init (int disable) | ... | @@ -148,7 +148,6 @@ auth_gsasl_capa_init (int disable) |
148 | { | 148 | { |
149 | int rc; | 149 | int rc; |
150 | char *listmech, *name, *s; | 150 | char *listmech, *name, *s; |
151 | size_t size; | ||
152 | 151 | ||
153 | rc = gsasl_server_mechlist (ctx, &listmech); | 152 | rc = gsasl_server_mechlist (ctx, &listmech); |
154 | if (rc != GSASL_OK) | 153 | if (rc != GSASL_OK) |
... | @@ -283,9 +282,3 @@ auth_gsasl_init () | ... | @@ -283,9 +282,3 @@ auth_gsasl_init () |
283 | auth_gsasl_capa_init (0); | 282 | auth_gsasl_capa_init (0); |
284 | } | 283 | } |
285 | 284 | ||
286 | wd() | ||
287 | { | ||
288 | int _st=0; | ||
289 | while (_st==0) | ||
290 | _st=_st; | ||
291 | } | ... | ... |
... | @@ -16,6 +16,9 @@ | ... | @@ -16,6 +16,9 @@ |
16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ | 16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ |
17 | 17 | ||
18 | #include "imap4d.h" | 18 | #include "imap4d.h" |
19 | #ifdef WITH_GSASL | ||
20 | # include <mailutils/gsasl.h> | ||
21 | #endif | ||
19 | 22 | ||
20 | mailbox_t mbox; | 23 | mailbox_t mbox; |
21 | char *homedir; | 24 | char *homedir; | ... | ... |
... | @@ -471,7 +471,7 @@ imap4d_readline (void) | ... | @@ -471,7 +471,7 @@ imap4d_readline (void) |
471 | } | 471 | } |
472 | else if (rc) | 472 | else if (rc) |
473 | { | 473 | { |
474 | char *p; | 474 | const char *p; |
475 | if (stream_strerror (istream, &p)) | 475 | if (stream_strerror (istream, &p)) |
476 | p = strerror (errno); | 476 | p = strerror (errno); |
477 | 477 | ||
... | @@ -1141,7 +1141,7 @@ imap4d_init_tls_server () | ... | @@ -1141,7 +1141,7 @@ imap4d_init_tls_server () |
1141 | 1141 | ||
1142 | if (stream_open (stream)) | 1142 | if (stream_open (stream)) |
1143 | { | 1143 | { |
1144 | char *p; | 1144 | const char *p; |
1145 | stream_strerror (stream, &p); | 1145 | stream_strerror (stream, &p); |
1146 | syslog (LOG_ERR, _("cannot open TLS stream: %s"), p); | 1146 | syslog (LOG_ERR, _("cannot open TLS stream: %s"), p); |
1147 | return 0; | 1147 | return 0; | ... | ... |
... | @@ -35,7 +35,7 @@ struct mu_auth_data { | ... | @@ -35,7 +35,7 @@ struct mu_auth_data { |
35 | }; | 35 | }; |
36 | 36 | ||
37 | typedef int (*mu_auth_fp) __P((struct mu_auth_data **data, | 37 | typedef int (*mu_auth_fp) __P((struct mu_auth_data **data, |
38 | void *key, | 38 | const void *key, |
39 | void *func_data, | 39 | void *func_data, |
40 | void *call_data)); | 40 | void *call_data)); |
41 | 41 | ||
... | @@ -52,7 +52,7 @@ struct mu_auth_module { | ... | @@ -52,7 +52,7 @@ struct mu_auth_module { |
52 | 52 | ||
53 | extern int mu_auth_runlist __P((list_t flist, | 53 | extern int mu_auth_runlist __P((list_t flist, |
54 | struct mu_auth_data **return_data, | 54 | struct mu_auth_data **return_data, |
55 | void *key, void *data)); | 55 | const void *key, void *data)); |
56 | extern struct mu_auth_data * | 56 | extern struct mu_auth_data * |
57 | mu_get_auth_by_name __P ((const char *username)); | 57 | mu_get_auth_by_name __P ((const char *username)); |
58 | 58 | ||
... | @@ -63,7 +63,7 @@ extern int | ... | @@ -63,7 +63,7 @@ extern int |
63 | mu_authenticate __P((struct mu_auth_data *auth_data, char *pass)); | 63 | mu_authenticate __P((struct mu_auth_data *auth_data, char *pass)); |
64 | 64 | ||
65 | extern int mu_auth_nosupport __P((struct mu_auth_data **return_data, | 65 | extern int mu_auth_nosupport __P((struct mu_auth_data **return_data, |
66 | void *key, | 66 | const void *key, |
67 | void *func_data, | 67 | void *func_data, |
68 | void *call_data)); | 68 | void *call_data)); |
69 | 69 | ... | ... |
... | @@ -132,8 +132,8 @@ extern int mu_scheme_autodetect_p __P((const char *scheme, const char **path)); | ... | @@ -132,8 +132,8 @@ extern int mu_scheme_autodetect_p __P((const char *scheme, const char **path)); |
132 | extern int mu_fd_wait __P((int fd, int *pflags, struct timeval *tvp)); | 132 | extern int mu_fd_wait __P((int fd, int *pflags, struct timeval *tvp)); |
133 | 133 | ||
134 | extern int mu_decode_filter __P((stream_t *pfilter, stream_t input, | 134 | extern int mu_decode_filter __P((stream_t *pfilter, stream_t input, |
135 | char *filter_type, | 135 | const char *filter_type, |
136 | char *fromcode, char *tocode)); | 136 | const char *fromcode, const char *tocode)); |
137 | 137 | ||
138 | extern enum mu_iconv_fallback_mode mu_default_fallback_mode; | 138 | extern enum mu_iconv_fallback_mode mu_default_fallback_mode; |
139 | extern int mu_set_default_fallback __P((const char *str)); | 139 | extern int mu_set_default_fallback __P((const char *str)); | ... | ... |
... | @@ -144,7 +144,7 @@ extern int stream_set_flush __P ((stream_t, | ... | @@ -144,7 +144,7 @@ extern int stream_set_flush __P ((stream_t, |
144 | int (*_flush) __PMT ((stream_t)), void *owner)); | 144 | int (*_flush) __PMT ((stream_t)), void *owner)); |
145 | 145 | ||
146 | extern int stream_set_strerror __P ((stream_t stream, | 146 | extern int stream_set_strerror __P ((stream_t stream, |
147 | int (*fp) (stream_t, char **), void *owner)); | 147 | int (*fp) (stream_t, const char **), void *owner)); |
148 | 148 | ||
149 | extern int stream_set_wait __P ((stream_t stream, | 149 | extern int stream_set_wait __P ((stream_t stream, |
150 | int (*wait) (stream_t, int *, struct timeval *), void *owner)); | 150 | int (*wait) (stream_t, int *, struct timeval *), void *owner)); |
... | @@ -156,10 +156,10 @@ extern int stream_sequential_readline __P((stream_t stream, | ... | @@ -156,10 +156,10 @@ extern int stream_sequential_readline __P((stream_t stream, |
156 | char *buf, size_t size, size_t *nbytes)); | 156 | char *buf, size_t size, size_t *nbytes)); |
157 | 157 | ||
158 | extern int stream_sequential_write __P((stream_t stream, | 158 | extern int stream_sequential_write __P((stream_t stream, |
159 | char *buf, size_t size)); | 159 | const char *buf, size_t size)); |
160 | extern int stream_seek __P((stream_t stream, off_t off, int whence)); | 160 | extern int stream_seek __P((stream_t stream, off_t off, int whence)); |
161 | 161 | ||
162 | extern int stream_strerror __P((stream_t stream, char **p)); | 162 | extern int stream_strerror __P((stream_t stream, const char **p)); |
163 | 163 | ||
164 | #ifdef __cplusplus | 164 | #ifdef __cplusplus |
165 | } | 165 | } | ... | ... |
... | @@ -51,7 +51,6 @@ mu_scm_mailbox_print (SCM mailbox_smob, SCM port, scm_print_state * pstate) | ... | @@ -51,7 +51,6 @@ mu_scm_mailbox_print (SCM mailbox_smob, SCM port, scm_print_state * pstate) |
51 | struct mu_mailbox *mum = (struct mu_mailbox *) SCM_CDR (mailbox_smob); | 51 | struct mu_mailbox *mum = (struct mu_mailbox *) SCM_CDR (mailbox_smob); |
52 | size_t count = 0; | 52 | size_t count = 0; |
53 | url_t url = NULL; | 53 | url_t url = NULL; |
54 | char *p; | ||
55 | 54 | ||
56 | mailbox_messages_count (mum->mbox, &count); | 55 | mailbox_messages_count (mum->mbox, &count); |
57 | mailbox_get_url (mum->mbox, &url); | 56 | mailbox_get_url (mum->mbox, &url); |
... | @@ -65,7 +64,7 @@ mu_scm_mailbox_print (SCM mailbox_smob, SCM port, scm_print_state * pstate) | ... | @@ -65,7 +64,7 @@ mu_scm_mailbox_print (SCM mailbox_smob, SCM port, scm_print_state * pstate) |
65 | } | 64 | } |
66 | else | 65 | else |
67 | { | 66 | { |
68 | p = url_to_string (url); | 67 | const char *p = url_to_string (url); |
69 | if (p) | 68 | if (p) |
70 | { | 69 | { |
71 | char buf[64]; | 70 | char buf[64]; | ... | ... |
... | @@ -498,7 +498,7 @@ _file_open (stream_t stream) | ... | @@ -498,7 +498,7 @@ _file_open (stream_t stream) |
498 | } | 498 | } |
499 | 499 | ||
500 | int | 500 | int |
501 | _file_strerror (stream_t unused, char **pstr) | 501 | _file_strerror (stream_t unused, const char **pstr) |
502 | { | 502 | { |
503 | *pstr = strerror (errno); | 503 | *pstr = strerror (errno); |
504 | return 0; | 504 | return 0; | ... | ... |
... | @@ -352,7 +352,7 @@ _icvt_read (stream_t stream, char *optr, size_t osize, | ... | @@ -352,7 +352,7 @@ _icvt_read (stream_t stream, char *optr, size_t osize, |
352 | } | 352 | } |
353 | 353 | ||
354 | int | 354 | int |
355 | _icvt_strerror (stream_t stream, char **pstr) | 355 | _icvt_strerror (stream_t stream, const char **pstr) |
356 | { | 356 | { |
357 | struct icvt_stream *s = stream_get_owner (stream); | 357 | struct icvt_stream *s = stream_get_owner (stream); |
358 | switch (s->state) | 358 | switch (s->state) |
... | @@ -369,7 +369,7 @@ _icvt_strerror (stream_t stream, char **pstr) | ... | @@ -369,7 +369,7 @@ _icvt_strerror (stream_t stream, char **pstr) |
369 | case EILSEQ: | 369 | case EILSEQ: |
370 | snprintf (s->errbuf, sizeof s->errbuf, | 370 | snprintf (s->errbuf, sizeof s->errbuf, |
371 | _("Illegal multibyte sequence near %*.*s"), | 371 | _("Illegal multibyte sequence near %*.*s"), |
372 | s->bufpos, s->bufpos, s->buf); | 372 | (int) s->bufpos, (int) s->bufpos, s->buf); |
373 | break; | 373 | break; |
374 | 374 | ||
375 | default: | 375 | default: |
... | @@ -384,7 +384,7 @@ _icvt_strerror (stream_t stream, char **pstr) | ... | @@ -384,7 +384,7 @@ _icvt_strerror (stream_t stream, char **pstr) |
384 | break; | 384 | break; |
385 | 385 | ||
386 | default: | 386 | default: |
387 | *pstr = (char*) mu_strerror (s->ec); | 387 | *pstr = mu_strerror (s->ec); |
388 | } | 388 | } |
389 | 389 | ||
390 | return 0; | 390 | return 0; | ... | ... |
... | @@ -62,7 +62,7 @@ struct _stream | ... | @@ -62,7 +62,7 @@ struct _stream |
62 | int (*_size) __P ((stream_t, off_t *)); | 62 | int (*_size) __P ((stream_t, off_t *)); |
63 | int (*_flush) __P ((stream_t)); | 63 | int (*_flush) __P ((stream_t)); |
64 | int (*_setbufsiz)__P ((stream_t, size_t)); | 64 | int (*_setbufsiz)__P ((stream_t, size_t)); |
65 | int (*_strerror) __P ((stream_t, char **)); | 65 | int (*_strerror) __P ((stream_t, const char **)); |
66 | int (*_wait) __P((stream_t, int *pflags, struct timeval *tvp)); | 66 | int (*_wait) __P((stream_t, int *pflags, struct timeval *tvp)); |
67 | }; | 67 | }; |
68 | 68 | ... | ... |
... | @@ -20,4 +20,5 @@ | ... | @@ -20,4 +20,5 @@ |
20 | #define CURSUF "cur" | 20 | #define CURSUF "cur" |
21 | #define NEWSUF "new" | 21 | #define NEWSUF "new" |
22 | 22 | ||
23 | extern char *maildir_mkfilename __P((char *dir, char *suffix, char *name)); | 23 | extern char *maildir_mkfilename __P((const char *dir, const char *suffix, |
24 | const char *name)); | ... | ... |
... | @@ -62,6 +62,7 @@ | ... | @@ -62,6 +62,7 @@ |
62 | #include <mailutils/url.h> | 62 | #include <mailutils/url.h> |
63 | #include <mailutils/observer.h> | 63 | #include <mailutils/observer.h> |
64 | #include <mailutils/errno.h> | 64 | #include <mailutils/errno.h> |
65 | #include <mailutils/locker.h> | ||
65 | #include <mailbox0.h> | 66 | #include <mailbox0.h> |
66 | #include <registrar0.h> | 67 | #include <registrar0.h> |
67 | #include <amd.h> | 68 | #include <amd.h> |
... | @@ -236,7 +237,7 @@ read_random (void *buf, size_t size) | ... | @@ -236,7 +237,7 @@ read_random (void *buf, size_t size) |
236 | } | 237 | } |
237 | 238 | ||
238 | char * | 239 | char * |
239 | maildir_mkfilename (char *directory, char *suffix, char *name) | 240 | maildir_mkfilename (const char *directory, const char *suffix, const char *name) |
240 | { | 241 | { |
241 | size_t size = strlen (directory) + 1 + strlen (suffix) + 1; | 242 | size_t size = strlen (directory) + 1 + strlen (suffix) + 1; |
242 | char *tmp; | 243 | char *tmp; | ... | ... |
... | @@ -244,7 +244,7 @@ _mapfile_get_transport2 (stream_t stream, mu_transport_t *pin, mu_transport_t *p | ... | @@ -244,7 +244,7 @@ _mapfile_get_transport2 (stream_t stream, mu_transport_t *pin, mu_transport_t *p |
244 | *pout = NULL; | 244 | *pout = NULL; |
245 | 245 | ||
246 | if (pin) | 246 | if (pin) |
247 | *pin = mfs->fd; | 247 | *pin = (mu_transport_t) mfs->fd; |
248 | return 0; | 248 | return 0; |
249 | } | 249 | } |
250 | 250 | ... | ... |
... | @@ -124,7 +124,7 @@ mu_insert_stack_entry (list_t *pflist, struct auth_stack_entry *entry) | ... | @@ -124,7 +124,7 @@ mu_insert_stack_entry (list_t *pflist, struct auth_stack_entry *entry) |
124 | 124 | ||
125 | int | 125 | int |
126 | mu_auth_runlist (list_t flist, struct mu_auth_data **return_data, | 126 | mu_auth_runlist (list_t flist, struct mu_auth_data **return_data, |
127 | void *key, void *data) | 127 | const void *key, void *data) |
128 | { | 128 | { |
129 | int rc = 1; | 129 | int rc = 1; |
130 | iterator_t itr; | 130 | iterator_t itr; |
... | @@ -149,7 +149,7 @@ mu_auth_runlist (list_t flist, struct mu_auth_data **return_data, | ... | @@ -149,7 +149,7 @@ mu_auth_runlist (list_t flist, struct mu_auth_data **return_data, |
149 | 149 | ||
150 | int | 150 | int |
151 | mu_auth_nosupport (struct mu_auth_data **return_data ARG_UNUSED, | 151 | mu_auth_nosupport (struct mu_auth_data **return_data ARG_UNUSED, |
152 | void *key ARG_UNUSED, | 152 | const void *key ARG_UNUSED, |
153 | void *func_data ARG_UNUSED, | 153 | void *func_data ARG_UNUSED, |
154 | void *call_data ARG_UNUSED) | 154 | void *call_data ARG_UNUSED) |
155 | { | 155 | { | ... | ... |
... | @@ -1235,8 +1235,9 @@ mu_set_default_fallback (const char *str) | ... | @@ -1235,8 +1235,9 @@ mu_set_default_fallback (const char *str) |
1235 | } | 1235 | } |
1236 | 1236 | ||
1237 | int | 1237 | int |
1238 | mu_decode_filter (stream_t *pfilter, stream_t input, char *filter_type, | 1238 | mu_decode_filter (stream_t *pfilter, stream_t input, |
1239 | char *fromcode, char *tocode) | 1239 | const char *filter_type, |
1240 | const char *fromcode, const char *tocode) | ||
1240 | { | 1241 | { |
1241 | stream_t filter; | 1242 | stream_t filter; |
1242 | 1243 | ... | ... |
... | @@ -663,7 +663,7 @@ stream_set_flags (stream_t stream, int fl) | ... | @@ -663,7 +663,7 @@ stream_set_flags (stream_t stream, int fl) |
663 | 663 | ||
664 | int | 664 | int |
665 | stream_set_strerror (stream_t stream, | 665 | stream_set_strerror (stream_t stream, |
666 | int (*fp) (stream_t, char **), void *owner) | 666 | int (*fp) (stream_t, const char **), void *owner) |
667 | { | 667 | { |
668 | if (stream == NULL) | 668 | if (stream == NULL) |
669 | return EINVAL; | 669 | return EINVAL; |
... | @@ -716,7 +716,7 @@ stream_sequential_readline (stream_t stream, char *buf, size_t size, | ... | @@ -716,7 +716,7 @@ stream_sequential_readline (stream_t stream, char *buf, size_t size, |
716 | } | 716 | } |
717 | 717 | ||
718 | int | 718 | int |
719 | stream_sequential_write (stream_t stream, char *buf, size_t size) | 719 | stream_sequential_write (stream_t stream, const char *buf, size_t size) |
720 | { | 720 | { |
721 | if (stream == NULL) | 721 | if (stream == NULL) |
722 | return EINVAL; | 722 | return EINVAL; |
... | @@ -780,7 +780,7 @@ stream_wait (stream_t stream, int *pflags, struct timeval *tvp) | ... | @@ -780,7 +780,7 @@ stream_wait (stream_t stream, int *pflags, struct timeval *tvp) |
780 | } | 780 | } |
781 | 781 | ||
782 | int | 782 | int |
783 | stream_strerror (stream_t stream, char **p) | 783 | stream_strerror (stream_t stream, const char **p) |
784 | { | 784 | { |
785 | if (stream == NULL) | 785 | if (stream == NULL) |
786 | return EINVAL; | 786 | return EINVAL; | ... | ... |
... | @@ -44,7 +44,7 @@ | ... | @@ -44,7 +44,7 @@ |
44 | 44 | ||
45 | /* System database */ | 45 | /* System database */ |
46 | static int | 46 | static int |
47 | mu_auth_system (struct mu_auth_data **return_data, struct passwd *pw) | 47 | mu_auth_system (struct mu_auth_data **return_data, const struct passwd *pw) |
48 | { | 48 | { |
49 | char *mailbox_name; | 49 | char *mailbox_name; |
50 | int rc; | 50 | int rc; |
... | @@ -74,7 +74,8 @@ mu_auth_system (struct mu_auth_data **return_data, struct passwd *pw) | ... | @@ -74,7 +74,8 @@ mu_auth_system (struct mu_auth_data **return_data, struct passwd *pw) |
74 | } | 74 | } |
75 | 75 | ||
76 | int | 76 | int |
77 | mu_auth_system_by_name (struct mu_auth_data **return_data, void *key, | 77 | mu_auth_system_by_name (struct mu_auth_data **return_data, |
78 | const void *key, | ||
78 | void *func_data ARG_UNUSED, | 79 | void *func_data ARG_UNUSED, |
79 | void *call_data ARG_UNUSED) | 80 | void *call_data ARG_UNUSED) |
80 | { | 81 | { |
... | @@ -87,7 +88,8 @@ mu_auth_system_by_name (struct mu_auth_data **return_data, void *key, | ... | @@ -87,7 +88,8 @@ mu_auth_system_by_name (struct mu_auth_data **return_data, void *key, |
87 | } | 88 | } |
88 | 89 | ||
89 | static int | 90 | static int |
90 | mu_auth_system_by_uid (struct mu_auth_data **return_data, void *key, | 91 | mu_auth_system_by_uid (struct mu_auth_data **return_data, |
92 | const void *key, | ||
91 | void *func_data ARG_UNUSED, | 93 | void *func_data ARG_UNUSED, |
92 | void *call_data ARG_UNUSED) | 94 | void *call_data ARG_UNUSED) |
93 | { | 95 | { |
... | @@ -101,11 +103,11 @@ mu_auth_system_by_uid (struct mu_auth_data **return_data, void *key, | ... | @@ -101,11 +103,11 @@ mu_auth_system_by_uid (struct mu_auth_data **return_data, void *key, |
101 | 103 | ||
102 | static int | 104 | static int |
103 | mu_authenticate_generic (struct mu_auth_data **return_data ARG_UNUSED, | 105 | mu_authenticate_generic (struct mu_auth_data **return_data ARG_UNUSED, |
104 | void *key, | 106 | const void *key, |
105 | void *func_data ARG_UNUSED, | 107 | void *func_data ARG_UNUSED, |
106 | void *call_data) | 108 | void *call_data) |
107 | { | 109 | { |
108 | struct mu_auth_data *auth_data = key; | 110 | const struct mu_auth_data *auth_data = key; |
109 | char *pass = call_data; | 111 | char *pass = call_data; |
110 | 112 | ||
111 | return !auth_data | 113 | return !auth_data |
... | @@ -116,11 +118,11 @@ mu_authenticate_generic (struct mu_auth_data **return_data ARG_UNUSED, | ... | @@ -116,11 +118,11 @@ mu_authenticate_generic (struct mu_auth_data **return_data ARG_UNUSED, |
116 | /* Called only if generic fails */ | 118 | /* Called only if generic fails */ |
117 | static int | 119 | static int |
118 | mu_authenticate_system (struct mu_auth_data **return_data ARG_UNUSED, | 120 | mu_authenticate_system (struct mu_auth_data **return_data ARG_UNUSED, |
119 | void *key, | 121 | const void *key, |
120 | void *func_data ARG_UNUSED, | 122 | void *func_data ARG_UNUSED, |
121 | void *call_data) | 123 | void *call_data) |
122 | { | 124 | { |
123 | struct mu_auth_data *auth_data = key; | 125 | const struct mu_auth_data *auth_data = key; |
124 | char *pass = call_data; | 126 | char *pass = call_data; |
125 | 127 | ||
126 | #ifdef HAVE_SHADOW_H | 128 | #ifdef HAVE_SHADOW_H | ... | ... |
... | @@ -1787,14 +1787,15 @@ builtin_putaddr (struct mh_machine *mach) | ... | @@ -1787,14 +1787,15 @@ builtin_putaddr (struct mh_machine *mach) |
1787 | static void | 1787 | static void |
1788 | builtin_unre (struct mh_machine *mach) | 1788 | builtin_unre (struct mh_machine *mach) |
1789 | { | 1789 | { |
1790 | char *p; | 1790 | const char *p; |
1791 | int rc = munre_subject (strobj_ptr (&mach->arg_str), &p); | 1791 | int rc = munre_subject (strobj_ptr (&mach->arg_str), &p); |
1792 | if (rc == 0 && p != strobj_ptr (&mach->arg_str)) | 1792 | if (rc == 0 && p != strobj_ptr (&mach->arg_str)) |
1793 | { | 1793 | { |
1794 | p = strdup (p); | 1794 | char *q = strdup (p); /* Create a copy, since strobj_create will |
1795 | destroy p */ | ||
1795 | strobj_free (&mach->arg_str); | 1796 | strobj_free (&mach->arg_str); |
1796 | strobj_create (&mach->arg_str, p); | 1797 | strobj_create (&mach->arg_str, q); |
1797 | free (p); | 1798 | free (q); |
1798 | } | 1799 | } |
1799 | } | 1800 | } |
1800 | 1801 | ... | ... |
... | @@ -407,34 +407,35 @@ mh_expand_name (const char *base, const char *name, int is_folder) | ... | @@ -407,34 +407,35 @@ mh_expand_name (const char *base, const char *name, int is_folder) |
407 | { | 407 | { |
408 | char *tmp = NULL; | 408 | char *tmp = NULL; |
409 | char *p = NULL; | 409 | char *p = NULL; |
410 | char *namep; | ||
410 | 411 | ||
411 | tmp = mu_tilde_expansion (name, "/", NULL); | 412 | tmp = mu_tilde_expansion (name, "/", NULL); |
412 | if (tmp[0] == '+') | 413 | if (tmp[0] == '+') |
413 | name = tmp + 1; | 414 | namep = tmp + 1; |
414 | else if (strncmp (tmp, "../", 3) == 0 || strncmp (tmp, "./", 2) == 0) | 415 | else if (strncmp (tmp, "../", 3) == 0 || strncmp (tmp, "./", 2) == 0) |
415 | { | 416 | { |
416 | char *cwd = mu_getcwd (); | 417 | char *cwd = mu_getcwd (); |
417 | asprintf (&name, "%s/%s", cwd, tmp); | 418 | asprintf (&namep, "%s/%s", cwd, tmp); |
418 | free (cwd); | 419 | free (cwd); |
419 | free (tmp); | 420 | free (tmp); |
420 | tmp = NULL; | 421 | tmp = NULL; |
421 | } | 422 | } |
422 | else | 423 | else |
423 | name = tmp; | 424 | namep = tmp; |
424 | 425 | ||
425 | if (!base) | 426 | if (!base) |
426 | base = mu_path_folder_dir; | 427 | base = mu_path_folder_dir; |
427 | if (is_folder) | 428 | if (is_folder) |
428 | { | 429 | { |
429 | if (name[0] == '/') | 430 | if (namep[0] == '/') |
430 | asprintf (&p, "mh:%s", name); | 431 | asprintf (&p, "mh:%s", namep); |
431 | else | 432 | else |
432 | asprintf (&p, "mh:%s/%s", base, name); | 433 | asprintf (&p, "mh:%s/%s", base, namep); |
433 | } | 434 | } |
434 | else if (name[0] != '/') | 435 | else if (namep[0] != '/') |
435 | asprintf (&p, "%s/%s", base, name); | 436 | asprintf (&p, "%s/%s", base, namep); |
436 | else | 437 | else |
437 | return name; | 438 | return namep; |
438 | 439 | ||
439 | free (tmp); | 440 | free (tmp); |
440 | return p; | 441 | return p; | ... | ... |
... | @@ -500,7 +500,8 @@ static int | ... | @@ -500,7 +500,8 @@ static int |
500 | send (int argc, char **argv) | 500 | send (int argc, char **argv) |
501 | { | 501 | { |
502 | int i, rc; | 502 | int i, rc; |
503 | 503 | char *p; | |
504 | |||
504 | /* Verify all arguments */ | 505 | /* Verify all arguments */ |
505 | for (i = 0; i < argc; i++) | 506 | for (i = 0; i < argc; i++) |
506 | if (check_file (argv[i])) | 507 | if (check_file (argv[i])) |
... | @@ -518,8 +519,9 @@ send (int argc, char **argv) | ... | @@ -518,8 +519,9 @@ send (int argc, char **argv) |
518 | 519 | ||
519 | /* Prepend url specifier to the folder dir. We won't need this | 520 | /* Prepend url specifier to the folder dir. We won't need this |
520 | when the default format becomes configurable */ | 521 | when the default format becomes configurable */ |
521 | asprintf (&mu_path_folder_dir, "mh:%s", mu_path_folder_dir); | 522 | asprintf (&p, "mh:%s", mu_path_folder_dir); |
522 | 523 | mu_path_folder_dir = p; | |
524 | |||
523 | /* Finally, do the work */ | 525 | /* Finally, do the work */ |
524 | rc = list_do (mesg_list, _action_send, NULL); | 526 | rc = list_do (mesg_list, _action_send, NULL); |
525 | return rc; | 527 | return rc; | ... | ... |
... | @@ -161,7 +161,7 @@ pop3d_init_tls_server () | ... | @@ -161,7 +161,7 @@ pop3d_init_tls_server () |
161 | 161 | ||
162 | if (stream_open (stream)) | 162 | if (stream_open (stream)) |
163 | { | 163 | { |
164 | char *p; | 164 | const char *p; |
165 | stream_strerror (stream, &p); | 165 | stream_strerror (stream, &p); |
166 | syslog (LOG_ERR, _("cannot open TLS stream: %s"), p); | 166 | syslog (LOG_ERR, _("cannot open TLS stream: %s"), p); |
167 | return 0; | 167 | return 0; |
... | @@ -220,7 +220,7 @@ pop3d_outf (const char *fmt, ...) | ... | @@ -220,7 +220,7 @@ pop3d_outf (const char *fmt, ...) |
220 | free (buf); | 220 | free (buf); |
221 | if (rc) | 221 | if (rc) |
222 | { | 222 | { |
223 | char *p; | 223 | const char *p; |
224 | 224 | ||
225 | if (stream_strerror (ostream, &p)) | 225 | if (stream_strerror (ostream, &p)) |
226 | p = strerror (errno); | 226 | p = strerror (errno); |
... | @@ -243,7 +243,7 @@ pop3d_readline (char *buffer, size_t size) | ... | @@ -243,7 +243,7 @@ pop3d_readline (char *buffer, size_t size) |
243 | 243 | ||
244 | if (rc) | 244 | if (rc) |
245 | { | 245 | { |
246 | char *p; | 246 | const char *p; |
247 | 247 | ||
248 | if (stream_strerror (ostream, &p)) | 248 | if (stream_strerror (ostream, &p)) |
249 | p = strerror (errno); | 249 | p = strerror (errno); | ... | ... |
-
Please register or sign in to post a comment