Permalink
Browse files

partial POSIX compliance cleanup #967

  • Loading branch information...
pjstevns committed Apr 14, 2012
1 parent 2da7411 commit e3343d94704cd69a6c69a2ad1d5f24e6a6c3a6de
Showing with 2,042 additions and 2,060 deletions.
  1. +1 −1 INSTALL
  2. +1 −1 README
  3. +20 −20 src/auth.h
  4. +23 −23 src/authmodule.c
  5. +21 −21 src/authmodule.h
  6. +22 −22 src/clientbase.c
  7. +14 −14 src/clientbase.h
  8. +13 −13 src/clientsession.c
  9. +11 −7 src/clientsession.h
  10. +104 −104 src/dbmail-imapsession.c
  11. +18 −18 src/dbmail-imapsession.h
  12. +73 −73 src/dbmail-mailbox.c
  13. +9 −9 src/dbmail-mailbox.h
  14. +108 −108 src/dbmail-message.c
  15. +9 −11 src/dbmail-message.h
  16. +40 −40 src/dbmail-user.c
  17. +14 −14 src/dbmail-user.h
  18. +1 −0 src/dbmail.h.in
  19. +79 −113 src/dbmailtypes.h
  20. +28 −28 src/dm_acl.c
  21. +9 −8 src/dm_acl.h
  22. +10 −10 src/dm_cache.c
  23. +4 −4 src/dm_cache.h
  24. +2 −2 src/dm_capa.c
  25. +3 −3 src/dm_capa.h
  26. +1 −1 src/dm_cidr.c
  27. +3 −3 src/dm_cidr.h
  28. +54 −54 src/dm_config.c
  29. +8 −8 src/dm_config.h
  30. +1 −1 src/dm_cram.c
  31. +3 −3 src/dm_cram.h
  32. +250 −250 src/dm_db.c
  33. +67 −67 src/dm_db.h
  34. +12 −12 src/dm_debug.c
  35. +6 −6 src/dm_debug.h
  36. +1 −1 src/dm_digest.c
  37. +2 −3 src/dm_digest.h
  38. +25 −25 src/dm_dsn.c
  39. +13 −12 src/dm_dsn.h
  40. +18 −18 src/dm_http.c
  41. +1 −1 src/dm_http.h
  42. +1 −1 src/dm_iconv.c
  43. +5 −5 src/dm_iconv.h
  44. +8 −8 src/dm_list.c
  45. +3 −3 src/dm_list.h
  46. +48 −48 src/dm_mailboxstate.c
  47. +14 −14 src/dm_mailboxstate.h
  48. +2 −5 src/dm_match.h
  49. +1 −1 src/dm_memblock.c
  50. +1 −1 src/dm_memblock.h
  51. +17 −17 src/dm_misc.c
  52. +13 −13 src/dm_misc.h
  53. +71 −34 src/dm_quota.c
  54. +10 −43 src/dm_quota.h
  55. +9 −9 src/dm_request.c
  56. +2 −2 src/dm_request.h
  57. +22 −22 src/dm_sievescript.c
  58. +16 −16 src/dm_sievescript.h
  59. +1 −1 src/dm_sset.c
  60. +3 −3 src/dm_sset.h
  61. +3 −3 src/dm_tls.c
  62. +3 −3 src/dm_tls.h
  63. +10 −10 src/export.c
  64. +2 −2 src/httpd.c
  65. +6 −6 src/imap4.c
  66. +78 −88 src/imapcommands.c
  67. +3 −3 src/imapcommands.h
  68. +3 −3 src/imapd.c
  69. +18 −18 src/lmtp.c
  70. +2 −2 src/lmtp.h
  71. +2 −2 src/lmtpd.c
  72. +8 −8 src/main.c
  73. +28 −28 src/maintenance.c
  74. +62 −62 src/modules/authldap.c
  75. +33 −33 src/modules/authsql.c
  76. +8 −8 src/modules/sortnull.c
  77. +19 −19 src/modules/sortsieve.c
  78. +64 −43 src/pop3.c
  79. +3 −3 src/pop3d.c
  80. +23 −23 src/server.c
  81. +9 −9 src/server.h
  82. +17 −17 src/sievecmd.c
  83. +11 −11 src/sort.h
  84. +12 −12 src/sortmodule.c
  85. +11 −11 src/sortmodule.h
  86. +17 −17 src/timsieve.c
  87. +2 −2 src/timsieved.c
  88. +2 −2 src/user.c
  89. +1 −1 test/check_dbmail.h
  90. +9 −9 test/check_dbmail_auth.c
  91. +1 −1 test/check_dbmail_capa.c
  92. +5 −5 test/check_dbmail_common.c
  93. +77 −77 test/check_dbmail_db.c
  94. +57 −57 test/check_dbmail_deliver.c
  95. +12 −12 test/check_dbmail_dsn.c
  96. +17 −17 test/check_dbmail_imapd.c
  97. +1 −1 test/check_dbmail_list.c
  98. +17 −17 test/check_dbmail_mailbox.c
  99. +8 −8 test/check_dbmail_mailboxstate.c
  100. +1 −1 test/check_dbmail_memblock.c
  101. +7 −7 test/check_dbmail_message.c
  102. +1 −1 test/check_dbmail_misc.c
  103. +1 −1 test/check_dbmail_server.c
  104. +1 −1 test/check_dbmail_sset.c
  105. +13 −13 test/check_dbmail_user.c
  106. +5 −5 test/check_dbmail_util.c
View
@@ -1,6 +1,6 @@
/*
(c) 2000-2004 IC&S, The Netherlands
(c) 2004-2011 NFG Net Facilities Group BV, The Netherlands, support@nfg.nl
(c) 2004-2012 NFG Net Facilities Group BV, The Netherlands, support@nfg.nl
FIXME: this information is somewhat outdated
TODO:
View
2 README
@@ -1,6 +1,6 @@
/*
(c) 2000-2005 IC&S, The Netherlands
(c) 2004-2011 NFG Net Facilities Group BV, The Netherlands, support@nfg.nl
(c) 2004-2012 NFG Net Facilities Group BV, The Netherlands, support@nfg.nl
*/
What is it?
View
@@ -26,8 +26,8 @@
* \author (c) 2000-2003 IC&S
*/
#ifndef _DBMAIL_AUTH_H
#define _DBMAIL_AUTH_H
#ifndef DM_AUTH_H
#define DM_AUTH_H
#include "dbmail.h"
@@ -63,7 +63,7 @@ int auth_disconnect(void);
* - 0 if user not found
* - 1 otherwise
*/
int auth_user_exists(const char *username, /*@out@*/ u64_t * user_idnr);
int auth_user_exists(const char *username, /*@out@*/ uint64_t * user_idnr);
/**
* \brief get username for a user_idnr
@@ -73,7 +73,7 @@ int auth_user_exists(const char *username, /*@out@*/ u64_t * user_idnr);
* - username otherwise
* \attention caller should free username string
*/
char *auth_get_userid(u64_t user_idnr);
char *auth_get_userid(uint64_t user_idnr);
/**
* \brief checks if a user_idnr exists
@@ -83,7 +83,7 @@ char *auth_get_userid(u64_t user_idnr);
* - 1 if user doesn't exist
* - -1 if something went wrong
*/
int auth_check_userid(u64_t user_idnr);
int auth_check_userid(uint64_t user_idnr);
/**
@@ -113,7 +113,7 @@ GList * auth_get_known_aliases(void);
* - -1 on error
* - 1 on success
*/
int auth_getclientid(u64_t user_idnr, u64_t * client_idnr);
int auth_getclientid(uint64_t user_idnr, uint64_t * client_idnr);
/**
* \brief get the maximum mail size for a user
@@ -126,7 +126,7 @@ int auth_getclientid(u64_t user_idnr, u64_t * client_idnr);
* maxmail_size of 0.
* - 1 otherwise
*/
int auth_getmaxmailsize(u64_t user_idnr, u64_t * maxmail_size);
int auth_getmaxmailsize(uint64_t user_idnr, uint64_t * maxmail_size);
/**
* \brief returns a string describing the encryption used for the
@@ -138,7 +138,7 @@ int auth_getmaxmailsize(u64_t user_idnr, u64_t * maxmail_size);
* \return
* - NULL if error
*/
char *auth_getencryption(u64_t user_idnr);
char *auth_getencryption(uint64_t user_idnr);
/**
* \brief as auth_check_user() but adds the numeric ID of the user found to
@@ -165,7 +165,7 @@ int auth_check_user_ext(const char *username, GList **userids, GList **fwds, int
* - 1 on success
*/
int auth_adduser(const char *username, const char *password, const char *enctype,
u64_t clientid, u64_t maxmail, u64_t * user_idnr);
uint64_t clientid, uint64_t maxmail, uint64_t * user_idnr);
/**
* \brief delete user from the database. Does not delete the user's email!
* \param username name of user to be deleted
@@ -183,7 +183,7 @@ int auth_delete_user(const char *username);
* - -1 on failure
* - 0 on success
*/
int auth_change_username(u64_t user_idnr, const char *new_name);
int auth_change_username(uint64_t user_idnr, const char *new_name);
/**
* \brief change a users password
* \param user_idnr
@@ -193,7 +193,7 @@ int auth_change_username(u64_t user_idnr, const char *new_name);
* - -1 on failure
* - 0 on success
*/
int auth_change_password(u64_t user_idnr,
int auth_change_password(uint64_t user_idnr,
const char *new_pass, const char *enctype);
/**
* \brief change a users client id
@@ -203,7 +203,7 @@ int auth_change_password(u64_t user_idnr,
* - -1 on failure
* - 0 on success
*/
int auth_change_clientid(u64_t user_idnr, u64_t new_cid);
int auth_change_clientid(uint64_t user_idnr, uint64_t new_cid);
/**
* \brief change a user's mailbox size (maxmailsize)
* \param user_idnr
@@ -212,19 +212,19 @@ int auth_change_clientid(u64_t user_idnr, u64_t new_cid);
* - -1 on failure
* - 0 on success
*/
int auth_change_mailboxsize(u64_t user_idnr, u64_t new_size);
int auth_change_mailboxsize(uint64_t user_idnr, uint64_t new_size);
/**
* \brief try to validate a user (used for login to server).
* \param username
* \param password
* \param user_idnr will hold the user_idnr after return. Must be a pointer
* to a valid u64_t variable on call.
* to a valid uint64_t variable on call.
* \return
* - -1 on error
* - 0 if not validated
* - 1 if OK
*/
int auth_validate(clientbase_t *ci, const char *username, const char *password, u64_t * user_idnr);
int auth_validate(ClientBase_T *ci, const char *username, const char *password, uint64_t * user_idnr);
/**
* \brief try tp validate a user using md5 hash
@@ -236,7 +236,7 @@ int auth_validate(clientbase_t *ci, const char *username, const char *password,
* - 0 if not validated
* - user_idrn if OK
*/
u64_t auth_md5_validate(clientbase_t *ci, char *username, unsigned char *md5_apop_he,
uint64_t auth_md5_validate(ClientBase_T *ci, char *username, unsigned char *md5_apop_he,
char *apop_stamp);
/**
@@ -259,7 +259,7 @@ char *auth_get_deliver_from_alias(const char *alias);
* - -1 on database failure
* - 0 on success
*/
GList * auth_get_user_aliases(u64_t user_idnr);
GList * auth_get_user_aliases(uint64_t user_idnr);
/**
* \brief get a list of forwards associated with an external alias
* \param alias the alias
@@ -280,7 +280,7 @@ GList * auth_get_aliases_ext(const char *alias);
* - 0 on success
* - 1 if alias already exists for given user
*/
int auth_addalias(u64_t user_idnr, const char *alias, u64_t clientid);
int auth_addalias(uint64_t user_idnr, const char *alias, uint64_t clientid);
/**
* \brief add an alias to deliver to an extern address
* \param alias the alias
@@ -292,7 +292,7 @@ int auth_addalias(u64_t user_idnr, const char *alias, u64_t clientid);
* - 1 if deliver_to already exists for given alias
*/
int auth_addalias_ext(const char *alias, const char *deliver_to,
u64_t clientid);
uint64_t clientid);
/**
* \brief remove alias for user
* \param user_idnr user id
@@ -301,7 +301,7 @@ int auth_addalias_ext(const char *alias, const char *deliver_to,
* - -1 on failure
* - 0 on success
*/
int auth_removealias(u64_t user_idnr, const char *alias);
int auth_removealias(uint64_t user_idnr, const char *alias);
/**
* \brief remove external delivery address for an alias
* \param alias the alias
View
@@ -12,7 +12,7 @@
static auth_func_t *auth = NULL;
extern db_param_t _db_params;
extern DBParam_T db_params;
/* Returns:
* 1 on modules unsupported
@@ -34,19 +34,19 @@ int auth_load_driver(void)
auth = g_new0(auth_func_t,1);
if (strcasecmp(_db_params.authdriver, "SQL") == 0)
if (strcasecmp(db_params.authdriver, "SQL") == 0)
driver = "auth_sql";
else if (strcasecmp(_db_params.authdriver, "LDAP") == 0)
else if (strcasecmp(db_params.authdriver, "LDAP") == 0)
driver = "auth_ldap";
else
TRACE(TRACE_EMERG, "unsupported driver: %s, please choose from SQL or LDAP",
_db_params.authdriver);
db_params.authdriver);
field_t library_dir;
Field_T library_dir;
config_get_value("library_directory", "DBMAIL", library_dir);
if (strlen(library_dir) == 0) {
TRACE(TRACE_DEBUG, "no value for library_directory, using default [%s]", DEFAULT_LIBRARY_DIR);
snprintf(library_dir, sizeof(field_t), "%s", DEFAULT_LIBRARY_DIR);
snprintf(library_dir, sizeof(Field_T), "%s", DEFAULT_LIBRARY_DIR);
} else {
TRACE(TRACE_DEBUG, "library_directory is [%s]", library_dir);
}
@@ -126,55 +126,55 @@ int auth_disconnect(void)
return 0;
}
int auth_user_exists(const char *username, u64_t * user_idnr)
int auth_user_exists(const char *username, uint64_t * user_idnr)
{ return auth->user_exists(username, user_idnr); }
char *auth_get_userid(u64_t user_idnr)
char *auth_get_userid(uint64_t user_idnr)
{ return auth->get_userid(user_idnr); }
int auth_check_userid(u64_t user_idnr)
int auth_check_userid(uint64_t user_idnr)
{ return auth->check_userid(user_idnr); }
GList * auth_get_known_users(void)
{ return auth->get_known_users(); }
GList * auth_get_known_aliases(void)
{ return auth->get_known_aliases(); }
int auth_getclientid(u64_t user_idnr, u64_t * client_idnr)
int auth_getclientid(uint64_t user_idnr, uint64_t * client_idnr)
{ return auth->getclientid(user_idnr, client_idnr); }
int auth_getmaxmailsize(u64_t user_idnr, u64_t * maxmail_size)
int auth_getmaxmailsize(uint64_t user_idnr, uint64_t * maxmail_size)
{ return auth->getmaxmailsize(user_idnr, maxmail_size); }
char *auth_getencryption(u64_t user_idnr)
char *auth_getencryption(uint64_t user_idnr)
{ return auth->getencryption(user_idnr); }
int auth_check_user_ext(const char *username, GList **userids, GList **fwds, int checks)
{ return auth->check_user_ext(username, userids, fwds, checks); }
int auth_adduser(const char *username, const char *password, const char *enctype,
u64_t clientid, u64_t maxmail, u64_t * user_idnr)
uint64_t clientid, uint64_t maxmail, uint64_t * user_idnr)
{ return auth->adduser(username, password, enctype,
clientid, maxmail, user_idnr); }
int auth_delete_user(const char *username)
{ return auth->delete_user(username); }
int auth_change_username(u64_t user_idnr, const char *new_name)
int auth_change_username(uint64_t user_idnr, const char *new_name)
{ return auth->change_username(user_idnr, new_name); }
int auth_change_password(u64_t user_idnr,
int auth_change_password(uint64_t user_idnr,
const char *new_pass, const char *enctype)
{ return auth->change_password(user_idnr, new_pass, enctype); }
int auth_change_clientid(u64_t user_idnr, u64_t new_cid)
int auth_change_clientid(uint64_t user_idnr, uint64_t new_cid)
{ return auth->change_clientid(user_idnr, new_cid); }
int auth_change_mailboxsize(u64_t user_idnr, u64_t new_size)
int auth_change_mailboxsize(uint64_t user_idnr, uint64_t new_size)
{ return auth->change_mailboxsize(user_idnr, new_size); }
int auth_validate(clientbase_t *ci, const char *username, const char *password, u64_t * user_idnr)
int auth_validate(ClientBase_T *ci, const char *username, const char *password, uint64_t * user_idnr)
{ return auth->validate(ci, username, password, user_idnr); }
u64_t auth_md5_validate(clientbase_t *ci, char *username,
uint64_t auth_md5_validate(ClientBase_T *ci, char *username,
unsigned char *md5_apop_he, char *apop_stamp)
{ return auth->md5_validate(ci, username,
md5_apop_he, apop_stamp); }
GList * auth_get_user_aliases(u64_t user_idnr)
GList * auth_get_user_aliases(uint64_t user_idnr)
{ return auth->get_user_aliases(user_idnr); }
GList * auth_get_aliases_ext(const char *alias)
{ return auth->get_aliases_ext(alias); }
int auth_addalias(u64_t user_idnr, const char *alias, u64_t clientid)
int auth_addalias(uint64_t user_idnr, const char *alias, uint64_t clientid)
{ return auth->addalias(user_idnr, alias, clientid); }
int auth_addalias_ext(const char *alias, const char *deliver_to,
u64_t clientid)
uint64_t clientid)
{ return auth->addalias_ext(alias, deliver_to, clientid); }
int auth_removealias(u64_t user_idnr, const char *alias)
int auth_removealias(uint64_t user_idnr, const char *alias)
{ return auth->removealias(user_idnr, alias); }
int auth_removealias_ext(const char *alias, const char *deliver_to)
{ return auth->removealias_ext(alias, deliver_to); }
View
@@ -6,43 +6,43 @@
* (c) 2005 Aaron Stone <aaron@serendipity.cx>
*/
#ifndef AUTHMODULE_H
#define AUTHMODULE_H
#ifndef DM_AUTHMODULE_H
#define DM_AUTHMODULE_H
/* Prototypes must match with those in auth.h
* and in the authentication drivers. */
typedef struct {
int (* connect)(void);
int (* disconnect)(void);
int (* user_exists)(const char *username, u64_t * user_idnr);
char * (* get_userid)(u64_t user_idnr);
int (* check_userid)(u64_t user_idnr);
int (* user_exists)(const char *username, uint64_t * user_idnr);
char * (* get_userid)(uint64_t user_idnr);
int (* check_userid)(uint64_t user_idnr);
GList * (* get_known_users)(void);
GList * (* get_known_aliases)(void);
int (* getclientid)(u64_t user_idnr, u64_t * client_idnr);
int (* getmaxmailsize)(u64_t user_idnr, u64_t * maxmail_size);
char * (* getencryption)(u64_t user_idnr);
int (* getclientid)(uint64_t user_idnr, uint64_t * client_idnr);
int (* getmaxmailsize)(uint64_t user_idnr, uint64_t * maxmail_size);
char * (* getencryption)(uint64_t user_idnr);
int (* check_user_ext)(const char *username, GList **userids, GList **fwds, int checks);
int (* adduser)(const char *username, const char *password, const char *enctype,
u64_t clientid, u64_t maxmail, u64_t * user_idnr);
uint64_t clientid, uint64_t maxmail, uint64_t * user_idnr);
int (* delete_user)(const char *username);
int (* change_username)(u64_t user_idnr, const char *new_name);
int (* change_password)(u64_t user_idnr,
int (* change_username)(uint64_t user_idnr, const char *new_name);
int (* change_password)(uint64_t user_idnr,
const char *new_pass, const char *enctype);
int (* change_clientid)(u64_t user_idnr, u64_t new_cid);
int (* change_mailboxsize)(u64_t user_idnr, u64_t new_size);
int (* validate)(clientbase_t *ci, char *username, char *password, u64_t * user_idnr);
u64_t (* md5_validate)(clientbase_t *ci, char *username,
int (* change_clientid)(uint64_t user_idnr, uint64_t new_cid);
int (* change_mailboxsize)(uint64_t user_idnr, uint64_t new_size);
int (* validate)(ClientBase_T *ci, char *username, char *password, uint64_t * user_idnr);
uint64_t (* md5_validate)(ClientBase_T *ci, char *username,
unsigned char *md5_apop_he, char *apop_stamp);
int (* get_users_from_clientid)(u64_t client_id,
u64_t ** user_ids, unsigned *num_users);
int (* get_users_from_clientid)(uint64_t client_id,
uint64_t ** user_ids, unsigned *num_users);
char * (* get_deliver_from_alias)(const char *alias);
GList * (* get_user_aliases)(u64_t user_idnr);
GList * (* get_user_aliases)(uint64_t user_idnr);
GList * (* get_aliases_ext)(const char *alias);
int (* addalias)(u64_t user_idnr, const char *alias, u64_t clientid);
int (* addalias)(uint64_t user_idnr, const char *alias, uint64_t clientid);
int (* addalias_ext)(const char *alias, const char *deliver_to,
u64_t clientid);
int (* removealias)(u64_t user_idnr, const char *alias);
uint64_t clientid);
int (* removealias)(uint64_t user_idnr, const char *alias);
int (* removealias_ext)(const char *alias, const char *deliver_to);
gboolean (*requires_shadow_user)(void);
} auth_func_t;
Oops, something went wrong.

0 comments on commit e3343d9

Please sign in to comment.