Commit 6e835d05 6e835d05151eb2f9523d34611e6f5b04b50780bf by Sergey Poznyakoff

Minor changes.

* guimb/main.c (main_sym): Remove const qualifier.
* imap4d/imap4d.h (util_getfullpath): 1st arg is const.
* imap4d/util.c: Likewise.
* include/mailutils/guile.h (mu_guile_load): 1st arg is const.
* include/mailutils/sql.h (mu_sql_get_field): 3rd arg is const.
* libmu_auth/radius.c: Cleanup trailing whitespace.
* libmu_scm/mu_guile.c (mu_guile_load): 1st arg is const.
(struct load_closure): Filename is const. All uses updated.
* mailbox/monitor.c (RWLOCK_TRYRDLOCK, RWLOCK_TRYWRLOCK): Remove
[!WITH_PTHREAD] (RWLOCK_DESTROY): Empty define.
* mailbox/mutil.c (mu_aget_user_email_domain): Minor fix.
* sql/sql.c (mu_sql_get_field): 3rd arg is const.
1 parent 558a5b14
...@@ -146,7 +146,7 @@ static const char *guimb_argp_capa[] = { ...@@ -146,7 +146,7 @@ static const char *guimb_argp_capa[] = {
146 NULL 146 NULL
147 }; 147 };
148 148
149 const char *main_sym = "mailutils-main"; 149 char *main_sym = "mailutils-main";
150 150
151 int 151 int
152 main (int argc, char *argv[]) 152 main (int argc, char *argv[])
......
...@@ -338,7 +338,7 @@ extern int util_finish (struct imap4d_command *, int, const char *, ...) ...@@ -338,7 +338,7 @@ extern int util_finish (struct imap4d_command *, int, const char *, ...)
338 extern int util_getstate (void); 338 extern int util_getstate (void);
339 extern int util_do_command (imap4d_tokbuf_t); 339 extern int util_do_command (imap4d_tokbuf_t);
340 extern char *util_tilde_expansion (const char *, const char *); 340 extern char *util_tilde_expansion (const char *, const char *);
341 extern char *util_getfullpath (char *, const char *); 341 extern char *util_getfullpath (const char *, const char *);
342 extern int util_msgset (char *, size_t **, int *, int); 342 extern int util_msgset (char *, size_t **, int *, int);
343 extern int util_upper (char *); 343 extern int util_upper (char *);
344 extern struct imap4d_command *util_getcommand (char *, 344 extern struct imap4d_command *util_getcommand (char *,
......
...@@ -36,7 +36,7 @@ util_tilde_expansion (const char *ref, const char *delim) ...@@ -36,7 +36,7 @@ util_tilde_expansion (const char *ref, const char *delim)
36 /* Get the absolute path. */ 36 /* Get the absolute path. */
37 /* NOTE: Path is allocated and must be free()d by the caller. */ 37 /* NOTE: Path is allocated and must be free()d by the caller. */
38 char * 38 char *
39 util_getfullpath (char *name, const char *delim) 39 util_getfullpath (const char *name, const char *delim)
40 { 40 {
41 char *p = util_tilde_expansion (name, delim); 41 char *p = util_tilde_expansion (name, delim);
42 if (*p != delim[0]) 42 if (*p != delim[0])
......
...@@ -74,9 +74,9 @@ extern void mu_scm_mutil_init (void); ...@@ -74,9 +74,9 @@ extern void mu_scm_mutil_init (void);
74 SCM mu_scm_make_debug_port (mu_debug_t debug, mu_log_level_t level); 74 SCM mu_scm_make_debug_port (mu_debug_t debug, mu_log_level_t level);
75 void mu_scm_debug_port_init (void); 75 void mu_scm_debug_port_init (void);
76 76
77 77
78 extern void mu_guile_init (int debug); 78 extern void mu_guile_init (int debug);
79 extern int mu_guile_load (char *filename, int argc, char **argv); 79 extern int mu_guile_load (const char *filename, int argc, char **argv);
80 extern int mu_guile_eval (const char *string); 80 extern int mu_guile_eval (const char *string);
81 extern int mu_guile_mailbox_apply (mu_mailbox_t mbx, char *funcname); 81 extern int mu_guile_mailbox_apply (mu_mailbox_t mbx, char *funcname);
82 extern int mu_guile_message_apply (mu_message_t msg, char *funcname); 82 extern int mu_guile_message_apply (mu_message_t msg, char *funcname);
...@@ -84,9 +84,9 @@ extern int mu_guile_message_apply (mu_message_t msg, char *funcname); ...@@ -84,9 +84,9 @@ extern int mu_guile_message_apply (mu_message_t msg, char *funcname);
84 extern int mu_guile_safe_exec (SCM (*handler) (void *data), void *data, 84 extern int mu_guile_safe_exec (SCM (*handler) (void *data), void *data,
85 SCM *result); 85 SCM *result);
86 extern int mu_guile_safe_proc_call (SCM proc, SCM arglist, SCM *presult); 86 extern int mu_guile_safe_proc_call (SCM proc, SCM arglist, SCM *presult);
87 87
88 #ifdef __cplusplus 88 #ifdef __cplusplus
89 } 89 }
90 #endif 90 #endif
91 91
92 #endif 92 #endif
......
1 /* GNU Mailutils -- a suite of utilities for electronic mail 1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc. 2 Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
3 3
4 This library is free software; you can redistribute it and/or 4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public 5 modify it under the terms of the GNU Lesser General Public
...@@ -33,7 +33,7 @@ struct mu_sql_module_config ...@@ -33,7 +33,7 @@ struct mu_sql_module_config
33 char *getpwnam_query; 33 char *getpwnam_query;
34 char *getpass_query; 34 char *getpass_query;
35 char *getpwuid_query; 35 char *getpwuid_query;
36 char *host; 36 char *host;
37 char *user; 37 char *user;
38 char *passwd; 38 char *passwd;
39 char *db; 39 char *db;
...@@ -51,7 +51,7 @@ struct mu_internal_sql_config ...@@ -51,7 +51,7 @@ struct mu_internal_sql_config
51 char *getpwnam_query; 51 char *getpwnam_query;
52 char *getpass_query; 52 char *getpass_query;
53 char *getpwuid_query; 53 char *getpwuid_query;
54 char *host; 54 char *host;
55 char *user; 55 char *user;
56 char *passwd; 56 char *passwd;
57 char *db; 57 char *db;
...@@ -64,7 +64,7 @@ struct mu_internal_sql_config ...@@ -64,7 +64,7 @@ struct mu_internal_sql_config
64 extern struct mu_internal_sql_config mu_sql_module_config; 64 extern struct mu_internal_sql_config mu_sql_module_config;
65 65
66 /* Loadable Modules Support */ 66 /* Loadable Modules Support */
67 #define __s_cat2__(a,b) a ## b 67 #define __s_cat2__(a,b) a ## b
68 #define __s_cat3__(a,b,c) a ## b ## c 68 #define __s_cat3__(a,b,c) a ## b ## c
69 #define RDL_EXPORT(module,name) __s_cat3__(module,_LTX_,name) 69 #define RDL_EXPORT(module,name) __s_cat3__(module,_LTX_,name)
70 70
...@@ -107,7 +107,7 @@ struct mu_sql_dispatch ...@@ -107,7 +107,7 @@ struct mu_sql_dispatch
107 { 107 {
108 char *name; 108 char *name;
109 int port; 109 int port;
110 110
111 int (*init) (mu_sql_connection_t conn); 111 int (*init) (mu_sql_connection_t conn);
112 int (*destroy) (mu_sql_connection_t conn); 112 int (*destroy) (mu_sql_connection_t conn);
113 113
...@@ -117,7 +117,7 @@ struct mu_sql_dispatch ...@@ -117,7 +117,7 @@ struct mu_sql_dispatch
117 int (*query) (mu_sql_connection_t conn, char *query); 117 int (*query) (mu_sql_connection_t conn, char *query);
118 int (*store_result) (mu_sql_connection_t conn); 118 int (*store_result) (mu_sql_connection_t conn);
119 int (*release_result) (mu_sql_connection_t conn); 119 int (*release_result) (mu_sql_connection_t conn);
120 120
121 int (*num_tuples) (mu_sql_connection_t conn, size_t *np); 121 int (*num_tuples) (mu_sql_connection_t conn, size_t *np);
122 int (*num_columns) (mu_sql_connection_t conn, size_t *np); 122 int (*num_columns) (mu_sql_connection_t conn, size_t *np);
123 123
...@@ -126,7 +126,7 @@ struct mu_sql_dispatch ...@@ -126,7 +126,7 @@ struct mu_sql_dispatch
126 126
127 int (*get_field_number) (mu_sql_connection_t conn, const char *fname, 127 int (*get_field_number) (mu_sql_connection_t conn, const char *fname,
128 size_t *fno); 128 size_t *fno);
129 129
130 const char *(*errstr) (mu_sql_connection_t conn); 130 const char *(*errstr) (mu_sql_connection_t conn);
131 }; 131 };
132 132
...@@ -151,7 +151,7 @@ int mu_sql_num_columns (mu_sql_connection_t conn, size_t *np); ...@@ -151,7 +151,7 @@ int mu_sql_num_columns (mu_sql_connection_t conn, size_t *np);
151 151
152 int mu_sql_get_column (mu_sql_connection_t conn, size_t nrow, size_t ncol, 152 int mu_sql_get_column (mu_sql_connection_t conn, size_t nrow, size_t ncol,
153 char **pdata); 153 char **pdata);
154 int mu_sql_get_field (mu_sql_connection_t conn, size_t nrow, char *fname, 154 int mu_sql_get_field (mu_sql_connection_t conn, size_t nrow, const char *fname,
155 char **pdata); 155 char **pdata);
156 156
157 const char *mu_sql_strerror (mu_sql_connection_t conn); 157 const char *mu_sql_strerror (mu_sql_connection_t conn);
......
...@@ -50,13 +50,13 @@ ...@@ -50,13 +50,13 @@
50 50
51 static int radius_auth_enabled; 51 static int radius_auth_enabled;
52 52
53 static int MU_User_Name; 53 static int MU_User_Name;
54 static int MU_UID; 54 static int MU_UID;
55 static int MU_GID; 55 static int MU_GID;
56 static int MU_GECOS; 56 static int MU_GECOS;
57 static int MU_Dir; 57 static int MU_Dir;
58 static int MU_Shell; 58 static int MU_Shell;
59 static int MU_Mailbox; 59 static int MU_Mailbox;
60 60
61 static grad_avp_t *auth_request; 61 static grad_avp_t *auth_request;
62 static grad_avp_t *getpwnam_request; 62 static grad_avp_t *getpwnam_request;
...@@ -78,8 +78,8 @@ get_attribute (int *pattr, char *name) ...@@ -78,8 +78,8 @@ get_attribute (int *pattr, char *name)
78 78
79 enum parse_state 79 enum parse_state
80 { 80 {
81 state_lhs, 81 state_lhs,
82 state_op, 82 state_op,
83 state_rhs, 83 state_rhs,
84 state_delim 84 state_delim
85 }; 85 };
...@@ -97,7 +97,7 @@ parse_pairlist (grad_avp_t **plist, char *input) ...@@ -97,7 +97,7 @@ parse_pairlist (grad_avp_t **plist, char *input)
97 97
98 if (!input) 98 if (!input)
99 return 1; 99 return 1;
100 100
101 if ((rc = mu_argcv_get (input, ",", NULL, &argc, &argv))) 101 if ((rc = mu_argcv_get (input, ",", NULL, &argc, &argv)))
102 { 102 {
103 mu_error (_("Cannot parse input `%s': %s"), input, mu_strerror (rc)); 103 mu_error (_("Cannot parse input `%s': %s"), input, mu_strerror (rc));
...@@ -106,23 +106,23 @@ parse_pairlist (grad_avp_t **plist, char *input) ...@@ -106,23 +106,23 @@ parse_pairlist (grad_avp_t **plist, char *input)
106 106
107 loc.file = "<configuration>"; /*FIXME*/ 107 loc.file = "<configuration>"; /*FIXME*/
108 loc.line = 0; 108 loc.line = 0;
109 109
110 for (i = 0, state = state_lhs; i < argc; i++) 110 for (i = 0, state = state_lhs; i < argc; i++)
111 { 111 {
112 grad_avp_t *pair; 112 grad_avp_t *pair;
113 113
114 switch (state) 114 switch (state)
115 { 115 {
116 case state_lhs: 116 case state_lhs:
117 name = argv[i]; 117 name = argv[i];
118 state = state_op; 118 state = state_op;
119 break; 119 break;
120 120
121 case state_op: 121 case state_op:
122 op = argv[i]; 122 op = argv[i];
123 state = state_rhs; 123 state = state_rhs;
124 break; 124 break;
125 125
126 case state_rhs: 126 case state_rhs:
127 loc.line = i; /* Just to keep track of error location */ 127 loc.line = i; /* Just to keep track of error location */
128 pair = grad_create_pair (&loc, name, grad_operator_equal, argv[i]); 128 pair = grad_create_pair (&loc, name, grad_operator_equal, argv[i]);
...@@ -150,7 +150,7 @@ parse_pairlist (grad_avp_t **plist, char *input) ...@@ -150,7 +150,7 @@ parse_pairlist (grad_avp_t **plist, char *input)
150 mu_error (_("malformed radius A/V list")); 150 mu_error (_("malformed radius A/V list"));
151 return 1; 151 return 1;
152 } 152 }
153 153
154 mu_argcv_free (argc, argv); 154 mu_argcv_free (argc, argv);
155 return 0; 155 return 0;
156 } 156 }
...@@ -205,13 +205,13 @@ mu_radius_module_init (enum mu_gocs_op op, void *data) ...@@ -205,13 +205,13 @@ mu_radius_module_init (enum mu_gocs_op op, void *data)
205 return 0; 205 return 0;
206 if (!NEED_RADIUS_P (cfg)) 206 if (!NEED_RADIUS_P (cfg))
207 return 0; 207 return 0;
208 208
209 grad_set_logger (mu_grad_logger); 209 grad_set_logger (mu_grad_logger);
210 grad_config_dir = grad_estrdup (cfg->config_dir); 210 grad_config_dir = grad_estrdup (cfg->config_dir);
211 211
212 grad_path_init (); 212 grad_path_init ();
213 srand (time (NULL) + getpid ()); 213 srand (time (NULL) + getpid ());
214 214
215 if (grad_dict_init ()) 215 if (grad_dict_init ())
216 { 216 {
217 mu_error (_("Cannot read radius dictionaries")); 217 mu_error (_("Cannot read radius dictionaries"));
...@@ -227,7 +227,7 @@ mu_radius_module_init (enum mu_gocs_op op, void *data) ...@@ -227,7 +227,7 @@ mu_radius_module_init (enum mu_gocs_op op, void *data)
227 || get_attribute (&MU_Shell, "MU-Shell") 227 || get_attribute (&MU_Shell, "MU-Shell")
228 || get_attribute (&MU_Mailbox, "MU-Mailbox")) 228 || get_attribute (&MU_Mailbox, "MU-Mailbox"))
229 return 1; 229 return 1;
230 230
231 /* Parse saved requests */ 231 /* Parse saved requests */
232 if (parse_pairlist (&auth_request, cfg->auth_request) 232 if (parse_pairlist (&auth_request, cfg->auth_request)
233 || parse_pairlist (&getpwnam_request, cfg->getpwnam_request) 233 || parse_pairlist (&getpwnam_request, cfg->getpwnam_request)
...@@ -236,7 +236,7 @@ mu_radius_module_init (enum mu_gocs_op op, void *data) ...@@ -236,7 +236,7 @@ mu_radius_module_init (enum mu_gocs_op op, void *data)
236 236
237 radius_auth_enabled = 1; 237 radius_auth_enabled = 1;
238 return 0; 238 return 0;
239 } 239 }
240 240
241 static char * 241 static char *
242 _expand_query (const char *query, const char *ustr, const char *passwd) 242 _expand_query (const char *query, const char *ustr, const char *passwd)
...@@ -244,7 +244,7 @@ _expand_query (const char *query, const char *ustr, const char *passwd) ...@@ -244,7 +244,7 @@ _expand_query (const char *query, const char *ustr, const char *passwd)
244 int rc; 244 int rc;
245 mu_vartab_t vtab; 245 mu_vartab_t vtab;
246 char *str, *ret; 246 char *str, *ret;
247 247
248 if (!query) 248 if (!query)
249 return NULL; 249 return NULL;
250 250
...@@ -254,7 +254,7 @@ _expand_query (const char *query, const char *ustr, const char *passwd) ...@@ -254,7 +254,7 @@ _expand_query (const char *query, const char *ustr, const char *passwd)
254 mu_vartab_define (vtab, "user", ustr, 1); 254 mu_vartab_define (vtab, "user", ustr, 1);
255 mu_vartab_define (vtab, "u", ustr, 1); 255 mu_vartab_define (vtab, "u", ustr, 1);
256 } 256 }
257 257
258 if (passwd) 258 if (passwd)
259 { 259 {
260 mu_vartab_define (vtab, "passwd", passwd, 1); 260 mu_vartab_define (vtab, "passwd", passwd, 1);
...@@ -325,7 +325,7 @@ decode_reply (grad_request_t *reply, const char *user_name, char *password, ...@@ -325,7 +325,7 @@ decode_reply (grad_request_t *reply, const char *user_name, char *password,
325 { 325 {
326 grad_avp_t *p; 326 grad_avp_t *p;
327 int rc; 327 int rc;
328 328
329 uid_t uid = -1; 329 uid_t uid = -1;
330 gid_t gid = -1; 330 gid_t gid = -1;
331 char *gecos = "RADIUS User"; 331 char *gecos = "RADIUS User";
...@@ -345,7 +345,7 @@ decode_reply (grad_request_t *reply, const char *user_name, char *password, ...@@ -345,7 +345,7 @@ decode_reply (grad_request_t *reply, const char *user_name, char *password,
345 mu_error (_("Radius did not return UID for `%s'"), user_name); 345 mu_error (_("Radius did not return UID for `%s'"), user_name);
346 return -1; 346 return -1;
347 } 347 }
348 348
349 p = grad_avl_find (reply->avlist, MU_GID); 349 p = grad_avl_find (reply->avlist, MU_GID);
350 if (p) 350 if (p)
351 gid = p->avp_lvalue; 351 gid = p->avp_lvalue;
...@@ -354,11 +354,11 @@ decode_reply (grad_request_t *reply, const char *user_name, char *password, ...@@ -354,11 +354,11 @@ decode_reply (grad_request_t *reply, const char *user_name, char *password,
354 mu_error (_("Radius did not return GID for `%s'"), user_name); 354 mu_error (_("Radius did not return GID for `%s'"), user_name);
355 return -1; 355 return -1;
356 } 356 }
357 357
358 p = grad_avl_find (reply->avlist, MU_GECOS); 358 p = grad_avl_find (reply->avlist, MU_GECOS);
359 if (p) 359 if (p)
360 gecos = p->avp_strvalue; 360 gecos = p->avp_strvalue;
361 361
362 p = grad_avl_find (reply->avlist, MU_Dir); 362 p = grad_avl_find (reply->avlist, MU_Dir);
363 if (p) 363 if (p)
364 dir = strdup (p->avp_strvalue); 364 dir = strdup (p->avp_strvalue);
...@@ -369,13 +369,13 @@ decode_reply (grad_request_t *reply, const char *user_name, char *password, ...@@ -369,13 +369,13 @@ decode_reply (grad_request_t *reply, const char *user_name, char *password,
369 return 1; 369 return 1;
370 strcat (strcpy (dir, DEFAULT_HOME_PREFIX), user_name); 370 strcat (strcpy (dir, DEFAULT_HOME_PREFIX), user_name);
371 } 371 }
372 372
373 p = grad_avl_find (reply->avlist, MU_Shell); 373 p = grad_avl_find (reply->avlist, MU_Shell);
374 if (p) 374 if (p)
375 shell = p->avp_strvalue; 375 shell = p->avp_strvalue;
376 else 376 else
377 shell = DEFAULT_SHELL; 377 shell = DEFAULT_SHELL;
378 378
379 p = grad_avl_find (reply->avlist, MU_Mailbox); 379 p = grad_avl_find (reply->avlist, MU_Mailbox);
380 if (p) 380 if (p)
381 mailbox = strdup (p->avp_strvalue); 381 mailbox = strdup (p->avp_strvalue);
...@@ -385,7 +385,7 @@ decode_reply (grad_request_t *reply, const char *user_name, char *password, ...@@ -385,7 +385,7 @@ decode_reply (grad_request_t *reply, const char *user_name, char *password,
385 if (rc) 385 if (rc)
386 return rc; 386 return rc;
387 } 387 }
388 388
389 rc = mu_auth_data_alloc (return_data, 389 rc = mu_auth_data_alloc (return_data,
390 user_name, 390 user_name,
391 password, 391 password,
...@@ -396,7 +396,7 @@ decode_reply (grad_request_t *reply, const char *user_name, char *password, ...@@ -396,7 +396,7 @@ decode_reply (grad_request_t *reply, const char *user_name, char *password,
396 shell, 396 shell,
397 mailbox, 397 mailbox,
398 1); 398 1);
399 399
400 free (dir); 400 free (dir);
401 free (mailbox); 401 free (mailbox);
402 return rc; 402 return rc;
...@@ -413,13 +413,13 @@ mu_radius_authenticate (struct mu_auth_data **return_data MU_ARG_UNUSED, ...@@ -413,13 +413,13 @@ mu_radius_authenticate (struct mu_auth_data **return_data MU_ARG_UNUSED,
413 413
414 if (!radius_auth_enabled) 414 if (!radius_auth_enabled)
415 return ENOSYS; 415 return ENOSYS;
416 416
417 if (!auth_request) 417 if (!auth_request)
418 { 418 {
419 mu_error (_("radius request for auth is not specified")); 419 mu_error (_("radius request for auth is not specified"));
420 return EINVAL; 420 return EINVAL;
421 } 421 }
422 422
423 reply = send_request (auth_request, RT_ACCESS_REQUEST, 423 reply = send_request (auth_request, RT_ACCESS_REQUEST,
424 auth_data->name, (char*) call_data); 424 auth_data->name, (char*) call_data);
425 if (!reply) 425 if (!reply)
...@@ -435,7 +435,7 @@ mu_radius_authenticate (struct mu_auth_data **return_data MU_ARG_UNUSED, ...@@ -435,7 +435,7 @@ mu_radius_authenticate (struct mu_auth_data **return_data MU_ARG_UNUSED,
435 default: 435 default:
436 rc = MU_ERR_AUTH_FAILURE; 436 rc = MU_ERR_AUTH_FAILURE;
437 } 437 }
438 438
439 grad_request_free (reply); 439 grad_request_free (reply);
440 440
441 return rc; 441 return rc;
...@@ -448,7 +448,7 @@ mu_auth_radius_user_by_name (struct mu_auth_data **return_data, ...@@ -448,7 +448,7 @@ mu_auth_radius_user_by_name (struct mu_auth_data **return_data,
448 { 448 {
449 int rc = MU_ERR_AUTH_FAILURE; 449 int rc = MU_ERR_AUTH_FAILURE;
450 grad_request_t *reply; 450 grad_request_t *reply;
451 451
452 if (!radius_auth_enabled) 452 if (!radius_auth_enabled)
453 return ENOSYS; 453 return ENOSYS;
454 454
...@@ -457,7 +457,7 @@ mu_auth_radius_user_by_name (struct mu_auth_data **return_data, ...@@ -457,7 +457,7 @@ mu_auth_radius_user_by_name (struct mu_auth_data **return_data,
457 mu_error (_("radius request for getpwnam is not specified")); 457 mu_error (_("radius request for getpwnam is not specified"));
458 return MU_ERR_FAILURE; 458 return MU_ERR_FAILURE;
459 } 459 }
460 460
461 reply = send_request (getpwnam_request, RT_ACCESS_REQUEST, key, NULL); 461 reply = send_request (getpwnam_request, RT_ACCESS_REQUEST, key, NULL);
462 if (!reply) 462 if (!reply)
463 { 463 {
...@@ -472,7 +472,7 @@ mu_auth_radius_user_by_name (struct mu_auth_data **return_data, ...@@ -472,7 +472,7 @@ mu_auth_radius_user_by_name (struct mu_auth_data **return_data,
472 grad_request_code_to_name (reply->code)); 472 grad_request_code_to_name (reply->code));
473 else 473 else
474 rc = decode_reply (reply, key, "x", return_data); 474 rc = decode_reply (reply, key, "x", return_data);
475 475
476 grad_request_free (reply); 476 grad_request_free (reply);
477 } 477 }
478 return rc; 478 return rc;
...@@ -486,7 +486,7 @@ mu_auth_radius_user_by_uid (struct mu_auth_data **return_data, ...@@ -486,7 +486,7 @@ mu_auth_radius_user_by_uid (struct mu_auth_data **return_data,
486 int rc = MU_ERR_AUTH_FAILURE; 486 int rc = MU_ERR_AUTH_FAILURE;
487 grad_request_t *reply; 487 grad_request_t *reply;
488 char uidstr[64]; 488 char uidstr[64];
489 489
490 if (!radius_auth_enabled) 490 if (!radius_auth_enabled)
491 return ENOSYS; 491 return ENOSYS;
492 492
...@@ -498,7 +498,7 @@ mu_auth_radius_user_by_uid (struct mu_auth_data **return_data, ...@@ -498,7 +498,7 @@ mu_auth_radius_user_by_uid (struct mu_auth_data **return_data,
498 mu_error (_("radius request for getpwuid is not specified")); 498 mu_error (_("radius request for getpwuid is not specified"));
499 return MU_ERR_FAILURE; 499 return MU_ERR_FAILURE;
500 } 500 }
501 501
502 snprintf (uidstr, sizeof (uidstr), "%u", *(uid_t*)key); 502 snprintf (uidstr, sizeof (uidstr), "%u", *(uid_t*)key);
503 reply = send_request (getpwuid_request, RT_ACCESS_REQUEST, uidstr, NULL); 503 reply = send_request (getpwuid_request, RT_ACCESS_REQUEST, uidstr, NULL);
504 if (!reply) 504 if (!reply)
...@@ -559,4 +559,3 @@ struct mu_auth_module mu_auth_radius_module = { ...@@ -559,4 +559,3 @@ struct mu_auth_module mu_auth_radius_module = {
559 mu_auth_radius_user_by_uid, 559 mu_auth_radius_user_by_uid,
560 NULL 560 NULL
561 }; 561 };
562
......
...@@ -51,7 +51,7 @@ mu_guile_safe_exec (SCM (*handler) (void *data), void *data, SCM *result) ...@@ -51,7 +51,7 @@ mu_guile_safe_exec (SCM (*handler) (void *data), void *data, SCM *result)
51 { 51 {
52 jmp_buf jmp_env; 52 jmp_buf jmp_env;
53 struct scheme_exec_data ed; 53 struct scheme_exec_data ed;
54 54
55 if (setjmp (jmp_env)) 55 if (setjmp (jmp_env))
56 return 1; 56 return 1;
57 ed.handler = handler; 57 ed.handler = handler;
...@@ -85,10 +85,10 @@ mu_guile_safe_proc_call (SCM proc, SCM arglist, SCM *presult) ...@@ -85,10 +85,10 @@ mu_guile_safe_proc_call (SCM proc, SCM arglist, SCM *presult)
85 { 85 {
86 jmp_buf jmp_env; 86 jmp_buf jmp_env;
87 SCM cell, result; 87 SCM cell, result;
88 88
89 if (setjmp (jmp_env)) 89 if (setjmp (jmp_env))
90 return 1; 90 return 1;
91 91
92 cell = scm_cons (proc, arglist); 92 cell = scm_cons (proc, arglist);
93 result = scm_internal_lazy_catch (SCM_BOOL_T, 93 result = scm_internal_lazy_catch (SCM_BOOL_T,
94 eval_catch_body, cell, 94 eval_catch_body, cell,
...@@ -119,7 +119,7 @@ mu_guile_init (int debug) ...@@ -119,7 +119,7 @@ mu_guile_init (int debug)
119 119
120 struct load_closure 120 struct load_closure
121 { 121 {
122 char *filename; 122 const char *filename;
123 int argc; 123 int argc;
124 char **argv; 124 char **argv;
125 }; 125 };
...@@ -128,14 +128,14 @@ static SCM ...@@ -128,14 +128,14 @@ static SCM
128 load_path_handler (void *data) 128 load_path_handler (void *data)
129 { 129 {
130 struct load_closure *lp = data; 130 struct load_closure *lp = data;
131 131
132 scm_set_program_arguments (lp->argc, lp->argv, lp->filename); 132 scm_set_program_arguments (lp->argc, lp->argv, (char*)lp->filename);
133 scm_primitive_load (scm_makfrom0str (lp->filename)); 133 scm_primitive_load (scm_makfrom0str (lp->filename));
134 return SCM_UNDEFINED; 134 return SCM_UNDEFINED;
135 } 135 }
136 136
137 int 137 int
138 mu_guile_load (char *filename, int argc, char **argv) 138 mu_guile_load (const char *filename, int argc, char **argv)
139 { 139 {
140 struct load_closure lc; 140 struct load_closure lc;
141 lc.filename = filename; 141 lc.filename = filename;
...@@ -161,7 +161,7 @@ mu_guile_eval (const char *string) ...@@ -161,7 +161,7 @@ mu_guile_eval (const char *string)
161 161
162 /* See comment on this function in mu_mailbox.c */ 162 /* See comment on this function in mu_mailbox.c */
163 extern SCM mu_scm_mailbox_create0 (mu_mailbox_t mbox, int noclose); 163 extern SCM mu_scm_mailbox_create0 (mu_mailbox_t mbox, int noclose);
164 164
165 int 165 int
166 mu_guile_mailbox_apply (mu_mailbox_t mbx, char *funcname) 166 mu_guile_mailbox_apply (mu_mailbox_t mbx, char *funcname)
167 { 167 {
......
...@@ -42,7 +42,7 @@ pthread_mutex_t monitor_lock = PTHREAD_MUTEX_INITIALIZER; ...@@ -42,7 +42,7 @@ pthread_mutex_t monitor_lock = PTHREAD_MUTEX_INITIALIZER;
42 # define STATIC_UNLOCK(m) pthread_mutex_unlock(m) 42 # define STATIC_UNLOCK(m) pthread_mutex_unlock(m)
43 #else 43 #else
44 # define STATIC_LOCK(m) 0 44 # define STATIC_LOCK(m) 0
45 # define STATIC_UNLOCK(m) 45 # define STATIC_UNLOCK(m)
46 int monitor_lock; 46 int monitor_lock;
47 #endif 47 #endif
48 48
...@@ -212,29 +212,23 @@ mu_monitor_notify (mu_monitor_t monitor MU_ARG_UNUSED) ...@@ -212,29 +212,23 @@ mu_monitor_notify (mu_monitor_t monitor MU_ARG_UNUSED)
212 # define RWLOCK_INIT(rwl, attr) pthread_rwlock_init (rwl, attr) 212 # define RWLOCK_INIT(rwl, attr) pthread_rwlock_init (rwl, attr)
213 # define RWLOCK_DESTROY(rwl) pthread_rwlock_destroy (rwl) 213 # define RWLOCK_DESTROY(rwl) pthread_rwlock_destroy (rwl)
214 # define RWLOCK_RDLOCK(rwl) pthread_rwlock_rdlock (rwl) 214 # define RWLOCK_RDLOCK(rwl) pthread_rwlock_rdlock (rwl)
215 # define RWLOCK_TRYRDLOCK(rwl) pthread_rwlock_tryrdlock (rwl)
216 # define RWLOCK_WRLOCK(rwl) pthread_rwlock_wrlock (rwl) 215 # define RWLOCK_WRLOCK(rwl) pthread_rwlock_wrlock (rwl)
217 # define RWLOCK_TRYWRLOCK(rwl) pthread_rwlock_trywrlock (rwl)
218 # define RWLOCK_UNLOCK(rwl) pthread_rwlock_unlock (rwl) 216 # define RWLOCK_UNLOCK(rwl) pthread_rwlock_unlock (rwl)
219 # else 217 # else
220 # define RWLOCK_INIT(rwl, attr) pthread_mutex_init (rwl, attr) 218 # define RWLOCK_INIT(rwl, attr) pthread_mutex_init (rwl, attr)
221 # define RWLOCK_DESTROY(rwl) pthread_mutex_destroy (rwl) 219 # define RWLOCK_DESTROY(rwl) pthread_mutex_destroy (rwl)
222 # define RWLOCK_RDLOCK(rwl) pthread_mutex_lock (rwl) 220 # define RWLOCK_RDLOCK(rwl) pthread_mutex_lock (rwl)
223 # define RWLOCK_TRYRDLOCK(rwl) pthread_mutex_trylock (rwl)
224 # define RWLOCK_WRLOCK(rwl) pthread_mutex_lock (rwl) 221 # define RWLOCK_WRLOCK(rwl) pthread_mutex_lock (rwl)
225 # define RWLOCK_TRYWRLOCK(rwl) pthread_mutex_trylock (rwl)
226 # define RWLOCK_UNLOCK(rwl) pthread_mutex_unlock (rwl) 222 # define RWLOCK_UNLOCK(rwl) pthread_mutex_unlock (rwl)
227 # endif 223 # endif
228 #else 224 #else
229 # define RWLOCK_INIT(rwl, attr) 0 225 # define RWLOCK_INIT(rwl, attr) 0
230 # define RWLOCK_DESTROY(rwl) 0 226 # define RWLOCK_DESTROY(rwl)
231 # define RWLOCK_RDLOCK(rwl) 0 227 # define RWLOCK_RDLOCK(rwl) 0
232 # define RWLOCK_TRYRDLOCK(rwl) 0
233 # define RWLOCK_WRLOCK(rwl) 0 228 # define RWLOCK_WRLOCK(rwl) 0
234 # define RWLOCK_TRYWRLOCK(rwl) 0
235 # define RWLOCK_UNLOCK(rwl) 0 229 # define RWLOCK_UNLOCK(rwl) 0
236 # define flockfile(arg) 0 230 # define flockfile(arg)
237 # define funlockfile(arg) 0 231 # define funlockfile(arg)
238 #endif 232 #endif
239 233
240 234
......
...@@ -437,7 +437,7 @@ mu_aget_user_email_domain (char **pdomain) ...@@ -437,7 +437,7 @@ mu_aget_user_email_domain (char **pdomain)
437 if (status) 437 if (status)
438 return status; 438 return status;
439 if (domain == NULL) 439 if (domain == NULL)
440 *pdomain = domain; 440 *pdomain = NULL;
441 else 441 else
442 { 442 {
443 *pdomain = strdup (domain); 443 *pdomain = strdup (domain);
......
1 /* GNU Mailutils -- a suite of utilities for electronic mail 1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc. 2 Copyright (C) 2004, 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
3 3
4 This library is free software; you can redistribute it and/or 4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public 5 modify it under the terms of the GNU Lesser General Public
...@@ -56,7 +56,7 @@ add_disptab (mu_sql_dispatch_t *tab) ...@@ -56,7 +56,7 @@ add_disptab (mu_sql_dispatch_t *tab)
56 if (sql_disptab_next == sql_disptab_size) 56 if (sql_disptab_next == sql_disptab_size)
57 { 57 {
58 mu_sql_dispatch_t **tmp; 58 mu_sql_dispatch_t **tmp;
59 59
60 tmp = realloc (sql_disptab, sql_disptab_size + 4); 60 tmp = realloc (sql_disptab, sql_disptab_size + 4);
61 if (!tmp) 61 if (!tmp)
62 return ENOMEM; 62 return ENOMEM;
...@@ -73,7 +73,7 @@ mu_sql_interface_index (char *name) ...@@ -73,7 +73,7 @@ mu_sql_interface_index (char *name)
73 { 73 {
74 int i; 74 int i;
75 //mu_sql_dispatch_t *tab; 75 //mu_sql_dispatch_t *tab;
76 76
77 init_disptab (); 77 init_disptab ();
78 for (i = 1; i < sql_disptab_next; i++) 78 for (i = 1; i < sql_disptab_next; i++)
79 if (sql_disptab[i] && (!name || strcmp (sql_disptab[i]->name, name) == 0)) 79 if (sql_disptab[i] && (!name || strcmp (sql_disptab[i]->name, name) == 0))
...@@ -81,7 +81,7 @@ mu_sql_interface_index (char *name) ...@@ -81,7 +81,7 @@ mu_sql_interface_index (char *name)
81 /* FIXME: For dynamic loading 81 /* FIXME: For dynamic loading
82 if (name && mu_sql_load_ext (name, "dispatch_tab", &tab)) 82 if (name && mu_sql_load_ext (name, "dispatch_tab", &tab))
83 return add_disptab (tab); 83 return add_disptab (tab);
84 */ 84 */
85 return 0; 85 return 0;
86 } 86 }
87 87
...@@ -116,7 +116,7 @@ mu_sql_connection_init (mu_sql_connection_t *pconn, int interface, ...@@ -116,7 +116,7 @@ mu_sql_connection_init (mu_sql_connection_t *pconn, int interface,
116 { 116 {
117 static mu_sql_dispatch_t *tab; 117 static mu_sql_dispatch_t *tab;
118 mu_sql_connection_t conn; 118 mu_sql_connection_t conn;
119 119
120 tab = get_sql_entry (interface); 120 tab = get_sql_entry (interface);
121 if (!tab) 121 if (!tab)
122 return MU_ERR_NO_INTERFACE; 122 return MU_ERR_NO_INTERFACE;
...@@ -161,7 +161,7 @@ int ...@@ -161,7 +161,7 @@ int
161 mu_sql_connect (mu_sql_connection_t conn) 161 mu_sql_connect (mu_sql_connection_t conn)
162 { 162 {
163 int rc; 163 int rc;
164 164
165 if (!conn) 165 if (!conn)
166 return EINVAL; 166 return EINVAL;
167 167
...@@ -173,7 +173,7 @@ mu_sql_connect (mu_sql_connection_t conn) ...@@ -173,7 +173,7 @@ mu_sql_connect (mu_sql_connection_t conn)
173 case mu_sql_connected: 173 case mu_sql_connected:
174 case mu_sql_query_run: 174 case mu_sql_query_run:
175 return MU_ERR_DB_ALREADY_CONNECTED; 175 return MU_ERR_DB_ALREADY_CONNECTED;
176 176
177 case mu_sql_result_available: 177 case mu_sql_result_available:
178 return MU_ERR_RESULT_NOT_RELEASED; 178 return MU_ERR_RESULT_NOT_RELEASED;
179 } 179 }
...@@ -187,7 +187,7 @@ int ...@@ -187,7 +187,7 @@ int
187 mu_sql_disconnect (mu_sql_connection_t conn) 187 mu_sql_disconnect (mu_sql_connection_t conn)
188 { 188 {
189 int rc; 189 int rc;
190 190
191 if (!conn) 191 if (!conn)
192 return EINVAL; 192 return EINVAL;
193 193
...@@ -199,7 +199,7 @@ mu_sql_disconnect (mu_sql_connection_t conn) ...@@ -199,7 +199,7 @@ mu_sql_disconnect (mu_sql_connection_t conn)
199 case mu_sql_connected: 199 case mu_sql_connected:
200 case mu_sql_query_run: 200 case mu_sql_query_run:
201 break; 201 break;
202 202
203 case mu_sql_result_available: 203 case mu_sql_result_available:
204 return MU_ERR_RESULT_NOT_RELEASED; 204 return MU_ERR_RESULT_NOT_RELEASED;
205 } 205 }
...@@ -229,7 +229,7 @@ mu_sql_query (mu_sql_connection_t conn, char *query) ...@@ -229,7 +229,7 @@ mu_sql_query (mu_sql_connection_t conn, char *query)
229 case mu_sql_result_available: 229 case mu_sql_result_available:
230 return MU_ERR_RESULT_NOT_RELEASED; 230 return MU_ERR_RESULT_NOT_RELEASED;
231 } 231 }
232 232
233 rc = SQL_F (conn, query) (conn, query); 233 rc = SQL_F (conn, query) (conn, query);
234 if (rc == 0) 234 if (rc == 0)
235 conn->state = mu_sql_query_run; 235 conn->state = mu_sql_query_run;
...@@ -240,7 +240,7 @@ int ...@@ -240,7 +240,7 @@ int
240 mu_sql_store_result (mu_sql_connection_t conn) 240 mu_sql_store_result (mu_sql_connection_t conn)
241 { 241 {
242 int rc; 242 int rc;
243 243
244 if (!conn) 244 if (!conn)
245 return EINVAL; 245 return EINVAL;
246 246
...@@ -251,14 +251,14 @@ mu_sql_store_result (mu_sql_connection_t conn) ...@@ -251,14 +251,14 @@ mu_sql_store_result (mu_sql_connection_t conn)
251 251
252 case mu_sql_connected: 252 case mu_sql_connected:
253 return MU_ERR_NO_QUERY; 253 return MU_ERR_NO_QUERY;
254 254
255 case mu_sql_query_run: 255 case mu_sql_query_run:
256 break; 256 break;
257 257
258 case mu_sql_result_available: 258 case mu_sql_result_available:
259 return MU_ERR_RESULT_NOT_RELEASED; 259 return MU_ERR_RESULT_NOT_RELEASED;
260 } 260 }
261 261
262 rc = SQL_F (conn, store_result) (conn); 262 rc = SQL_F (conn, store_result) (conn);
263 if (rc == 0) 263 if (rc == 0)
264 conn->state = mu_sql_result_available; 264 conn->state = mu_sql_result_available;
...@@ -269,7 +269,7 @@ int ...@@ -269,7 +269,7 @@ int
269 mu_sql_release_result (mu_sql_connection_t conn) 269 mu_sql_release_result (mu_sql_connection_t conn)
270 { 270 {
271 int rc; 271 int rc;
272 272
273 if (!conn) 273 if (!conn)
274 return EINVAL; 274 return EINVAL;
275 275
...@@ -280,14 +280,14 @@ mu_sql_release_result (mu_sql_connection_t conn) ...@@ -280,14 +280,14 @@ mu_sql_release_result (mu_sql_connection_t conn)
280 280
281 case mu_sql_connected: 281 case mu_sql_connected:
282 return MU_ERR_NO_QUERY; 282 return MU_ERR_NO_QUERY;
283 283
284 case mu_sql_query_run: 284 case mu_sql_query_run:
285 return MU_ERR_NO_RESULT; 285 return MU_ERR_NO_RESULT;
286 286
287 case mu_sql_result_available: 287 case mu_sql_result_available:
288 break; 288 break;
289 } 289 }
290 290
291 rc = SQL_F (conn, release_result) (conn); 291 rc = SQL_F (conn, release_result) (conn);
292 if (rc == 0) 292 if (rc == 0)
293 conn->state = mu_sql_connected; 293 conn->state = mu_sql_connected;
...@@ -307,7 +307,7 @@ mu_sql_num_tuples (mu_sql_connection_t conn, size_t *np) ...@@ -307,7 +307,7 @@ mu_sql_num_tuples (mu_sql_connection_t conn, size_t *np)
307 307
308 case mu_sql_connected: 308 case mu_sql_connected:
309 return MU_ERR_NO_QUERY; 309 return MU_ERR_NO_QUERY;
310 310
311 case mu_sql_query_run: 311 case mu_sql_query_run:
312 return MU_ERR_NO_RESULT; 312 return MU_ERR_NO_RESULT;
313 313
...@@ -330,7 +330,7 @@ mu_sql_num_columns (mu_sql_connection_t conn, size_t *np) ...@@ -330,7 +330,7 @@ mu_sql_num_columns (mu_sql_connection_t conn, size_t *np)
330 330
331 case mu_sql_connected: 331 case mu_sql_connected:
332 return MU_ERR_NO_QUERY; 332 return MU_ERR_NO_QUERY;
333 333
334 case mu_sql_query_run: 334 case mu_sql_query_run:
335 return MU_ERR_NO_RESULT; 335 return MU_ERR_NO_RESULT;
336 336
...@@ -339,7 +339,7 @@ mu_sql_num_columns (mu_sql_connection_t conn, size_t *np) ...@@ -339,7 +339,7 @@ mu_sql_num_columns (mu_sql_connection_t conn, size_t *np)
339 } 339 }
340 return SQL_F (conn, num_columns) (conn, np); 340 return SQL_F (conn, num_columns) (conn, np);
341 } 341 }
342 342
343 343
344 int 344 int
345 mu_sql_get_column (mu_sql_connection_t conn, size_t nrow, size_t ncol, 345 mu_sql_get_column (mu_sql_connection_t conn, size_t nrow, size_t ncol,
...@@ -354,7 +354,7 @@ mu_sql_get_column (mu_sql_connection_t conn, size_t nrow, size_t ncol, ...@@ -354,7 +354,7 @@ mu_sql_get_column (mu_sql_connection_t conn, size_t nrow, size_t ncol,
354 354
355 case mu_sql_connected: 355 case mu_sql_connected:
356 return MU_ERR_NO_QUERY; 356 return MU_ERR_NO_QUERY;
357 357
358 case mu_sql_query_run: 358 case mu_sql_query_run:
359 return MU_ERR_NO_RESULT; 359 return MU_ERR_NO_RESULT;
360 360
...@@ -365,12 +365,12 @@ mu_sql_get_column (mu_sql_connection_t conn, size_t nrow, size_t ncol, ...@@ -365,12 +365,12 @@ mu_sql_get_column (mu_sql_connection_t conn, size_t nrow, size_t ncol,
365 } 365 }
366 366
367 int 367 int
368 mu_sql_get_field (mu_sql_connection_t conn, size_t nrow, char *fname, 368 mu_sql_get_field (mu_sql_connection_t conn, size_t nrow, const char *fname,
369 char **pdata) 369 char **pdata)
370 { 370 {
371 int rc; 371 int rc;
372 size_t fno; 372 size_t fno;
373 373
374 if (!conn) 374 if (!conn)
375 return EINVAL; 375 return EINVAL;
376 376
...@@ -381,7 +381,7 @@ mu_sql_get_field (mu_sql_connection_t conn, size_t nrow, char *fname, ...@@ -381,7 +381,7 @@ mu_sql_get_field (mu_sql_connection_t conn, size_t nrow, char *fname,
381 381
382 case mu_sql_connected: 382 case mu_sql_connected:
383 return MU_ERR_NO_QUERY; 383 return MU_ERR_NO_QUERY;
384 384
385 case mu_sql_query_run: 385 case mu_sql_query_run:
386 return MU_ERR_NO_RESULT; 386 return MU_ERR_NO_RESULT;
387 387
...@@ -402,4 +402,3 @@ mu_sql_strerror (mu_sql_connection_t conn) ...@@ -402,4 +402,3 @@ mu_sql_strerror (mu_sql_connection_t conn)
402 return strerror (EINVAL); 402 return strerror (EINVAL);
403 return SQL_F (conn, errstr) (conn); 403 return SQL_F (conn, errstr) (conn);
404 } 404 }
405
......