diff --git a/indimail-x/AliasInLookup.c b/indimail-x/AliasInLookup.c index 2c9e3eab2..49bf05837 100644 --- a/indimail-x/AliasInLookup.c +++ b/indimail-x/AliasInLookup.c @@ -42,10 +42,11 @@ die_nomem() } char * -AliasInLookup(char *email) +AliasInLookup(const char *email) { static stralloc user = {0}, domain = {0}, aliasbuf = {0}; - char *ptr, *real_domain; + char *ptr; + const char *real_domain; #ifdef CLUSTERED_SITE if (sqlOpen_user(email, 1)) diff --git a/indimail-x/AliasInLookup.h b/indimail-x/AliasInLookup.h index 45f59bdd8..7fc9542c2 100644 --- a/indimail-x/AliasInLookup.h +++ b/indimail-x/AliasInLookup.h @@ -7,6 +7,6 @@ #ifndef ALIASINLOOKUP_H #define ALIASINLOOKUP_H -char *AliasInLookup(char *); +char *AliasInLookup(const char *); #endif diff --git a/indimail-x/Check_Login.h b/indimail-x/Check_Login.h index 56695472a..8a259483c 100644 --- a/indimail-x/Check_Login.h +++ b/indimail-x/Check_Login.h @@ -7,6 +7,6 @@ #ifndef CHECK_LOGIN_H #define CHECK_LOGIN_H -int Check_Login(char *, char *, char *); +int Check_Login(const char *, const char *, const char *); #endif diff --git a/indimail-x/CopyEmailFile.c b/indimail-x/CopyEmailFile.c index af717486f..621ad7a66 100644 --- a/indimail-x/CopyEmailFile.c +++ b/indimail-x/CopyEmailFile.c @@ -53,7 +53,7 @@ die_nomem() */ int CopyEmailFile(const char *homedir, char *fname, const char *email, - char *To, char *From, char *Subject, int setDate, + const char *To, const char *From, const char *Subject, int setDate, int copy_method, long message_size) { time_t tm; diff --git a/indimail-x/CopyEmailFile.h b/indimail-x/CopyEmailFile.h index 61d67698a..ddc41c673 100644 --- a/indimail-x/CopyEmailFile.h +++ b/indimail-x/CopyEmailFile.h @@ -7,6 +7,6 @@ #ifndef COPYEMAILFILE_H #define COPYEMAILFILE_H -int CopyEmailFile(const char *, char *, const char *, char *, char *, char *, int, int, long); +int CopyEmailFile(const char *, const char *, const char *, const char *, const char *, const char *, int, int, long); #endif diff --git a/indimail-x/GetPrefix.c b/indimail-x/GetPrefix.c index 5064af8f9..4271ebdd8 100644 --- a/indimail-x/GetPrefix.c +++ b/indimail-x/GetPrefix.c @@ -36,9 +36,10 @@ die_nomem() } char * -GetPrefix(char *user, char *path) +GetPrefix(const char *user, const char *path) { - char *ptr, *suffix_ptr, *base_path; + char *ptr; + const char *base_path, *suffix_ptr; int ch; static stralloc PathPrefix = {0}; @@ -47,7 +48,7 @@ GetPrefix(char *user, char *path) if (path && *path) base_path = path; else - getEnvConfigStr(&base_path, "BASE_PATH", BASE_PATH); + getEnvConfigStr((char **) &base_path, "BASE_PATH", BASE_PATH); ch = tolower(*user); if (ch >= 'a' && ch <= 'e') suffix_ptr = "A2E"; diff --git a/indimail-x/GetPrefix.h b/indimail-x/GetPrefix.h index e2d8debb2..61c5def72 100644 --- a/indimail-x/GetPrefix.h +++ b/indimail-x/GetPrefix.h @@ -7,6 +7,6 @@ #ifndef GETPREFIX_H #define GETPREFIX_H -char *GetPrefix(char *, char *); +char *GetPrefix(const char *, const char *); #endif diff --git a/indimail-x/GetSMTProute.c b/indimail-x/GetSMTProute.c index 63241de67..d9ee59877 100644 --- a/indimail-x/GetSMTProute.c +++ b/indimail-x/GetSMTProute.c @@ -44,7 +44,7 @@ static char sccsid[] = "$Id: GetSMTProute.c,v 1.4 2023-03-20 10:02:16+05:30 #endif int -get_smtp_qmtp_port(char *file, char *domain, int default_port) +get_smtp_qmtp_port(const char *file, const char *domain, int default_port) { static stralloc line = {0}; char inbuf[512]; @@ -132,7 +132,7 @@ get_smtp_qmtp_port(char *file, char *domain, int default_port) * If relay is blank, it means MX lookup should be done */ int -GetSMTProute(char *domain) +GetSMTProute(const char *domain) { char *sysconfdir, *controldir, *routes; int default_port, relative; diff --git a/indimail-x/GetSMTProute.h b/indimail-x/GetSMTProute.h index 338995351..c7270c1fe 100644 --- a/indimail-x/GetSMTProute.h +++ b/indimail-x/GetSMTProute.h @@ -7,6 +7,7 @@ #ifndef GETSMTPROUTE_H #define GETSMTPROUTE_H -int GetSMTProute(char *); +int GetSMTProute(const char *); +int get_smtp_qmtp_port(const char *, const char *, int); #endif diff --git a/indimail-x/Login_Tasks.c b/indimail-x/Login_Tasks.c index 5a6776edc..12fb00717 100644 --- a/indimail-x/Login_Tasks.c +++ b/indimail-x/Login_Tasks.c @@ -77,7 +77,7 @@ static char sccsid[] = "$Id: Login_Tasks.c,v 1.6 2023-04-23 00:29:27+05:30 C #endif int -Login_Tasks(struct passwd *pw, const char *User, char *ServiceType) +Login_Tasks(struct passwd *pw, const char *User, const char *ServiceType) { char *domain, *ptr, *migrateflag, *migrateuser, *postauth; static stralloc fqemail = {0}, Maildir = {0}, tmpbuf = {0}, pwbuf = {0}, @@ -196,7 +196,7 @@ Login_Tasks(struct passwd *pw, const char *User, char *ServiceType) if (!(ptr = env_get("TCPREMOTEIP")) && !(ptr = GetPeerIPaddr())) #endif ptr = "unknown"; - vset_lastauth(pw->pw_name, domain, (char *) ServiceType, ptr, pw->pw_gecos, quota); + vset_lastauth(pw->pw_name, domain, ServiceType, ptr, pw->pw_gecos, quota); #else quota = check_quota(Maildir.s); #ifdef ENABLE_IPV6 @@ -205,7 +205,7 @@ Login_Tasks(struct passwd *pw, const char *User, char *ServiceType) if (!(ptr = env_get("TCPREMOTEIP")) && !(ptr = GetPeerIPaddr())) #endif ptr = "unknown"; - vset_lastauth(pw->pw_name, domain, (char *) ServiceType, ptr, pw->pw_gecos, quota); + vset_lastauth(pw->pw_name, domain, ServiceType, ptr, pw->pw_gecos, quota); #endif /*- USE_MAILDIRQUOTA */ #endif /*- ENABLE_AUTH_LOGGING */ if ((postauth = (char *) env_get("POSTAUTH")) && !access(postauth, X_OK)) { diff --git a/indimail-x/Login_Tasks.h b/indimail-x/Login_Tasks.h index 28a87fa0c..b48aa0a7e 100644 --- a/indimail-x/Login_Tasks.h +++ b/indimail-x/Login_Tasks.h @@ -7,6 +7,6 @@ #ifndef LOGIN_TASKS_H #define LOGIN_TASKS_H -int Login_Tasks(struct passwd *, const char *, char *); +int Login_Tasks(struct passwd *, const char *, const char *); #endif diff --git a/indimail-x/Makefile.am b/indimail-x/Makefile.am index 5df2309a8..cd4d394ea 100644 --- a/indimail-x/Makefile.am +++ b/indimail-x/Makefile.am @@ -207,7 +207,7 @@ noinst_DATA = indimail-permissions.easy indimail-permissions.paranoid \ post_handle_list = vadddomain vadduser vdeldomain vaddaliasdomain vrenamedomain vmoduser vpasswd \ vdeluser vrenameuser -doc_list= ChangeLog FAQ.md README-indimail.md README-ldap.md \ +doc_list= ChangeLog README-indimail.md README-ldap.md \ README-vlimits.md COPYING-indimail MOSTLYCLEANFILES=vcaliasrev myslave controlsync bogofilter-qfe \ diff --git a/indimail-x/ProcessInFifo.c b/indimail-x/ProcessInFifo.c index 8205de238..444da173b 100644 --- a/indimail-x/ProcessInFifo.c +++ b/indimail-x/ProcessInFifo.c @@ -245,7 +245,7 @@ walk_entry(const void *in_data, VISIT x, int level) } char * -in_strdup(char *s) +in_strdup(const char *s) { int i; char *p; @@ -919,8 +919,8 @@ ProcessInFifo(int instNum) static stralloc pwbuf = {0}, host_path = {0}, line = {0}; char tmp[FMT_ULONG], inbuf[512]; char *ptr, *fifoName, *fifo_path, *myFifo, *sysconfdir, *controldir, - *QueryBuf, *email, *remoteip, *local_ip, *cntrl_host, - *real_domain; + *QueryBuf, *email, *remoteip, *local_ip, *cntrl_host; + const char *real_domain; void (*pstat) () = NULL; void *(*search_func) (const void *key, void *const *rootp, int (*compar)(const void *, const void *)); time_t prev_time = 0l; @@ -1354,7 +1354,7 @@ ProcessInFifo(int instNum) case PWD_QUERY: i = str_rchr(email, '@'); if (!email[i]) - getEnvConfigStr(&real_domain, "DEFAULT_DOMAIN", DEFAULT_DOMAIN); + getEnvConfigStr((char **) &real_domain, "DEFAULT_DOMAIN", DEFAULT_DOMAIN); else real_domain = email + i + 1; if (!use_btree || !(in = mk_in_entry(email))) @@ -1490,7 +1490,7 @@ ProcessInFifo(int instNum) if (tcpserver) return (-1); } else - if (bytes > 0 && timeoutwrite(writeTimeout, wfd, real_domain, bytes) == -1) { + if (bytes > 0 && timeoutwrite(writeTimeout, wfd, (char *) real_domain, bytes) == -1) { strerr_warn1("InLookup: write-get_real_domain: ", &strerr_sys); if (tcpserver) return (-1); diff --git a/indimail-x/PwdInLookup.c b/indimail-x/PwdInLookup.c index 38c2c9038..a6d564898 100644 --- a/indimail-x/PwdInLookup.c +++ b/indimail-x/PwdInLookup.c @@ -28,10 +28,10 @@ static char sccsid[] = "$Id: PwdInLookup.c,v 1.1 2019-04-18 07:56:24+05:30 C #endif struct passwd * -PwdInLookup(char *email) +PwdInLookup(const char *email) { static stralloc user = {0}, domain = {0}; - char *real_domain; + const char *real_domain; struct passwd *pw; #ifdef CLUSTERED_SITE diff --git a/indimail-x/PwdInLookup.h b/indimail-x/PwdInLookup.h index ef8799c6c..f1cdd43b8 100644 --- a/indimail-x/PwdInLookup.h +++ b/indimail-x/PwdInLookup.h @@ -13,6 +13,6 @@ #include #endif -struct passwd *PwdInLookup(char *); +struct passwd *PwdInLookup(const char *); #endif diff --git a/indimail-x/RelayInLookup.c b/indimail-x/RelayInLookup.c index 8c1406c0c..16fad9d41 100644 --- a/indimail-x/RelayInLookup.c +++ b/indimail-x/RelayInLookup.c @@ -43,10 +43,10 @@ die_nomem() } int -RelayInLookup(char *mailfrom, char *remoteip) +RelayInLookup(const char *mailfrom, const char *remoteip) { static stralloc user = {0}, domain = {0}, email = {0}; - char *real_domain; + const char *real_domain; int retval; #ifdef CLUSTERED_SITE diff --git a/indimail-x/RelayInLookup.h b/indimail-x/RelayInLookup.h index a3eae5547..3779b3bd6 100644 --- a/indimail-x/RelayInLookup.h +++ b/indimail-x/RelayInLookup.h @@ -7,6 +7,6 @@ #ifndef RELAYINLOOKUP_H #define RELAYINLOOKUP_H -int RelayInLookup(char *, char *); +int RelayInLookup(const char *, const char *); #endif diff --git a/indimail-x/SendWelcomeMail.c b/indimail-x/SendWelcomeMail.c index 81c29c2ef..5e213faea 100644 --- a/indimail-x/SendWelcomeMail.c +++ b/indimail-x/SendWelcomeMail.c @@ -36,7 +36,7 @@ die_nomem() } void -SendWelcomeMail(char *homedir, char *username, char *domain, int inactFlag, char *subject) +SendWelcomeMail(const char *homedir, const char *username, const char *domain, int inactFlag, const char *subject) { static stralloc email = {0}, tmpbuf = {0}, bulkdir = {0}; char *ptr; diff --git a/indimail-x/SendWelcomeMail.h b/indimail-x/SendWelcomeMail.h index 163f1880c..556b8481a 100644 --- a/indimail-x/SendWelcomeMail.h +++ b/indimail-x/SendWelcomeMail.h @@ -7,6 +7,6 @@ #ifndef SENDWELCOMEMAIL_H #define SENDWELCOMEMAIL_H -void SendWelcomeMail(char *, char *, char *, int, char *); +void SendWelcomeMail(const char *, const char *, const char *, int, const char *); #endif diff --git a/indimail-x/SqlServer.c b/indimail-x/SqlServer.c index e3c309d01..ed60728f8 100644 --- a/indimail-x/SqlServer.c +++ b/indimail-x/SqlServer.c @@ -39,7 +39,7 @@ die_nomem() } char * -SqlServer(char *mdahost, char *domain) +SqlServer(const char *mdahost, const char *domain) { DBINFO **rhostsptr; char strnum[FMT_ULONG]; @@ -80,7 +80,7 @@ SqlServer(char *mdahost, char *domain) } char * -MdaServer(char *sqlhost, char *domain) +MdaServer(const char *sqlhost, const char *domain) { DBINFO **rhostsptr; int total; diff --git a/indimail-x/SqlServer.h b/indimail-x/SqlServer.h index dbebf721f..dfc0c761e 100644 --- a/indimail-x/SqlServer.h +++ b/indimail-x/SqlServer.h @@ -7,7 +7,7 @@ #ifndef SQLSERVER_H #define SQLSERVER_H -char *SqlServer(char *, char *); -char *MdaServer(char *, char *); +char *SqlServer(const char *, const char *); +char *MdaServer(const char *, const char *); #endif diff --git a/indimail-x/UserInLookup.c b/indimail-x/UserInLookup.c index 79322c2b9..7e86391ff 100644 --- a/indimail-x/UserInLookup.c +++ b/indimail-x/UserInLookup.c @@ -50,10 +50,10 @@ static char sccsid[] = "$Id: UserInLookup.c,v 1.3 2021-01-26 00:29:14+05:30 * -1: System Error */ int -UserInLookup(char *email) +UserInLookup(const char *email) { static stralloc user = {0}, domain = {0}; - char *real_domain; + const char *real_domain; char strnum1[FMT_ULONG], strnum2[FMT_ULONG]; #ifdef VALIAS int valias_count; diff --git a/indimail-x/UserInLookup.h b/indimail-x/UserInLookup.h index fb95f356c..8722423d1 100644 --- a/indimail-x/UserInLookup.h +++ b/indimail-x/UserInLookup.h @@ -7,6 +7,6 @@ #ifndef USERINLOOKUP_H #define USERINLOOKUP_H -int UserInLookup(char *); +int UserInLookup(const char *); #endif diff --git a/indimail-x/VlimitInLookup.c b/indimail-x/VlimitInLookup.c index e3430e3e3..5b629b770 100644 --- a/indimail-x/VlimitInLookup.c +++ b/indimail-x/VlimitInLookup.c @@ -31,10 +31,10 @@ static char sccsid[] = "$Id: VlimitInLookup.c,v 1.1 2019-04-18 07:56:47+05:3 #include "vlimits.h" int -VlimitInLookup(char *email, struct vlimits *lim) +VlimitInLookup(const char *email, struct vlimits *lim) { static stralloc user = {0}, domain = {0}; - char *real_domain; + const char *real_domain; #ifdef ENABLE_DOMAIN_LIMITS struct vlimits limits; #endif diff --git a/indimail-x/VlimitInLookup.h b/indimail-x/VlimitInLookup.h index b3db73b3b..17f80b093 100644 --- a/indimail-x/VlimitInLookup.h +++ b/indimail-x/VlimitInLookup.h @@ -15,7 +15,7 @@ #include "vlimits.h" #ifdef ENABLE_DOMAIN_LIMITS -int VlimitInLookup(char *, struct vlimits *); +int VlimitInLookup(const char *, struct vlimits *); #endif #endif diff --git a/indimail-x/add_control.c b/indimail-x/add_control.c index cc43b4164..1791c7929 100644 --- a/indimail-x/add_control.c +++ b/indimail-x/add_control.c @@ -37,7 +37,7 @@ die_nomem() } int -add_control(char *domain, char *target) +add_control(const char *domain, const char *target) { int count, relative; static stralloc filename = {0}, tmpstr = {0}; diff --git a/indimail-x/add_control.h b/indimail-x/add_control.h index 8ac99b91e..b7892c768 100644 --- a/indimail-x/add_control.h +++ b/indimail-x/add_control.h @@ -7,6 +7,6 @@ #ifndef ADD_CONTROL_H #define ADD_CONTROL_H -int add_control(char *, char *); +int add_control(const char *, const char *); #endif diff --git a/indimail-x/add_domain_assign.c b/indimail-x/add_domain_assign.c index 146b47f5c..58eb921e8 100644 --- a/indimail-x/add_domain_assign.c +++ b/indimail-x/add_domain_assign.c @@ -57,7 +57,7 @@ die_nomem() * And signal qmail */ int -add_domain_assign(char *domain, char *domain_base_dir, uid_t uid, gid_t gid) +add_domain_assign(const char *domain, const char *domain_base_dir, uid_t uid, gid_t gid) { static stralloc filename = {0}, tmpstr = {0}; int fd; diff --git a/indimail-x/add_domain_assign.h b/indimail-x/add_domain_assign.h index df2a59d9c..1bde47e0f 100644 --- a/indimail-x/add_domain_assign.h +++ b/indimail-x/add_domain_assign.h @@ -13,6 +13,6 @@ #include #endif -int add_domain_assign(char *, char *, uid_t, gid_t); +int add_domain_assign(const char *, const char *, uid_t, gid_t); #endif diff --git a/indimail-x/add_user_assign.c b/indimail-x/add_user_assign.c index cb423e74f..775716ce3 100644 --- a/indimail-x/add_user_assign.c +++ b/indimail-x/add_user_assign.c @@ -43,8 +43,8 @@ die_nomem() _exit(111); } -void -do_assign1(stralloc *s, char *user, char *dir) +static void +do_assign1(stralloc *s, const char *user, const char *dir) { char strnum[FMT_ULONG]; char *ptr; @@ -76,8 +76,8 @@ do_assign1(stralloc *s, char *user, char *dir) return; } -void -do_assign2(stralloc *s, char *user, char *dir) +static void +do_assign2(stralloc *s, const char *user, const char *dir) { char strnum[FMT_ULONG]; char *ptr; @@ -113,7 +113,7 @@ do_assign2(stralloc *s, char *user, char *dir) * add a local user to the users/assign file and compile it */ int -add_user_assign(char *user, char *dir) +add_user_assign(const char *user, const char *dir) { static stralloc filename = {0}, tmpstr1 = {0}, tmpstr2 = {0}; char *assigndir; diff --git a/indimail-x/add_user_assign.h b/indimail-x/add_user_assign.h index f41d9ba71..0dd44dfc2 100644 --- a/indimail-x/add_user_assign.h +++ b/indimail-x/add_user_assign.h @@ -6,5 +6,5 @@ */ #ifndef ADD_USER_ASSIGN_H #define ADD_USER_ASSIGN_H -int add_user_assign(char *, char *dir); +int add_user_assign(const char *, const char *dir); #endif diff --git a/indimail-x/add_vacation.c b/indimail-x/add_vacation.c index 5dc7b3c08..6f9f5f6be 100644 --- a/indimail-x/add_vacation.c +++ b/indimail-x/add_vacation.c @@ -59,7 +59,7 @@ add_vacation(char *email, char *fname) static stralloc tmpbuf = {0}, line = {0}, user = {0}, domain = {0}; uid_t uid; gid_t gid; - char *real_domain; + const char *real_domain; char inbuf[512], outbuf[512]; struct passwd *pw; int err, match, fd1, fd2; diff --git a/indimail-x/addaliasdomain.c b/indimail-x/addaliasdomain.c index 9712f0932..027f569c2 100644 --- a/indimail-x/addaliasdomain.c +++ b/indimail-x/addaliasdomain.c @@ -20,7 +20,6 @@ #include #include #endif -#include "lowerit.h" #include "get_assign.h" #include "is_distributed_domain.h" #include "open_master.h" @@ -41,7 +40,7 @@ die_nomem() } int -addaliasdomain(char *old_domain, char *new_domain) +addaliasdomain(const char *old_domain, const char *new_domain) { static stralloc dirstr = {0}, tmpbuf = {0}; char strnum1[FMT_ULONG], strnum2[FMT_ULONG]; @@ -56,12 +55,10 @@ addaliasdomain(char *old_domain, char *new_domain) } if ((fdsourcedir = open_read(".")) == -1) strerr_die1sys(111, "addaliasdomain: unable to open current directory: "); - lowerit(new_domain); if (get_assign(new_domain, 0, 0, 0)) { strerr_warn3("addaliasdomain: domain ", new_domain, " exists", 0); return (-1); } - lowerit(old_domain); if (!get_assign(old_domain, &dirstr, &uid, &gid)) { strerr_warn3("addaliasdomain: Domain ", old_domain, " does not exist", 0); return (-1); diff --git a/indimail-x/addaliasdomain.h b/indimail-x/addaliasdomain.h index c21db0d25..86851bd62 100644 --- a/indimail-x/addaliasdomain.h +++ b/indimail-x/addaliasdomain.h @@ -7,6 +7,6 @@ #ifndef ADDALIASDOMAIN_H #define ADDALIASDOMAIN_H -int addaliasdomain(char *, char *); +int addaliasdomain(const char *, const char *); #endif diff --git a/indimail-x/addusercntrl.c b/indimail-x/addusercntrl.c index afd0cb79b..f5125760f 100644 --- a/indimail-x/addusercntrl.c +++ b/indimail-x/addusercntrl.c @@ -45,7 +45,7 @@ die_nomem() */ int -addusercntrl(char *user, char *domain, char *hostid, char *pass, int force) +addusercntrl(const char *user, const char *domain, const char *hostid, const char *pass, int force) { static stralloc SqlBuf = {0}; char strnum[FMT_ULONG]; diff --git a/indimail-x/addusercntrl.h b/indimail-x/addusercntrl.h index 24cebbecf..5414d0c8d 100644 --- a/indimail-x/addusercntrl.h +++ b/indimail-x/addusercntrl.h @@ -7,6 +7,6 @@ #ifndef ADDUSERCNTRL_H #define ADDUSERCNTRL_H -int addusercntrl(char *, char *, char *, char *, int); +int addusercntrl(const char *, const char *, const char *, const char *, int); #endif /*- ADDUSERCNTRL_H */ diff --git a/indimail-x/authindi.c b/indimail-x/authindi.c index 20a96ae39..5307aa621 100644 --- a/indimail-x/authindi.c +++ b/indimail-x/authindi.c @@ -191,10 +191,10 @@ next_module(char **argv, char *buf, int offset, int auth_method, char *authstr, } no_return void -exec_local(char **argv, char *userid, char *TheDomain, struct passwd *pw, char *service) +exec_local(char **argv, const char *userid, const char *TheDomain, struct passwd *pw, const char *service) { static stralloc Maildir = {0}, TheUser = {0}, line = {0}; - char *ptr; + const char *ptr; int i, status, fd, match; char inbuf[4096]; struct substdio ssin; @@ -303,7 +303,8 @@ int main(int argc, char **argv) { char *buf, *authstr, *login, *challenge, *response, *cleartxt, *crypt_pass, *ptr, - *real_domain, *service, *auth_type, *auth_data, *mailstore, *pass; + *service, *auth_type, *auth_data, *mailstore, *pass; + const char *real_domain; char *(imapargs[]) = { PREFIX"/sbin/imaplogin", LIBEXECDIR"/imapmodules/authindi", PREFIX"/bin/imapd", "Maildir", 0 }; char *(pop3args[]) = { PREFIX"/sbin/pop3login", LIBEXECDIR"/imapmodules/authindi", diff --git a/indimail-x/autoturn_dir.c b/indimail-x/autoturn_dir.c index 0dd1ab2b6..a2609af3f 100644 --- a/indimail-x/autoturn_dir.c +++ b/indimail-x/autoturn_dir.c @@ -44,7 +44,7 @@ die_nomem() } char * -autoturn_dir(char *domain) +autoturn_dir(const char *domain) { static stralloc filename = {0}, template = {0}, line = {0}; char inbuf[512]; diff --git a/indimail-x/autoturn_dir.h b/indimail-x/autoturn_dir.h index ec613d7aa..e60359275 100644 --- a/indimail-x/autoturn_dir.h +++ b/indimail-x/autoturn_dir.h @@ -7,6 +7,6 @@ #ifndef AUTOTURN_DIR_H #define AUTOTURN_DIR_H -char *autoturn_dir(char *); +char *autoturn_dir(const char *); #endif diff --git a/indimail-x/backfill.c b/indimail-x/backfill.c index 84df046ef..063b6ffed 100644 --- a/indimail-x/backfill.c +++ b/indimail-x/backfill.c @@ -13,10 +13,6 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif - -#ifdef HAVE_CTYPE_H -#include -#endif #ifdef HAVE_UNISTD_H #include #endif @@ -51,7 +47,7 @@ die_nomem() } char * -backfill(char *username, char *domain, char *path, int operation) +backfill(const char *username, const char *domain, const char *path, int operation) { char *filesys_prefix, *ptr = (char *) 0; static stralloc filename = {0}, line = {0}; diff --git a/indimail-x/backfill.h b/indimail-x/backfill.h index 7649f5adc..3e83d515e 100644 --- a/indimail-x/backfill.h +++ b/indimail-x/backfill.h @@ -7,6 +7,6 @@ #ifndef BACKFILL_H #define BACKFILL_H -char *backfill(char *, char *, char *, int); +char *backfill(const char *, const char *, const char *, int); #endif diff --git a/indimail-x/close_big_dir.c b/indimail-x/close_big_dir.c index dd8e6616f..6655c47c4 100644 --- a/indimail-x/close_big_dir.c +++ b/indimail-x/close_big_dir.c @@ -15,7 +15,7 @@ static char sccsid[] = "$Id: close_big_dir.c,v 1.1 2019-04-18 08:25:21+05:30 #endif int -close_big_dir(char *table_name, char *domain, uid_t uid, gid_t gid) +close_big_dir(const char *table_name, const char *domain, uid_t uid, gid_t gid) { return (vwrite_dir_control(table_name, &vdir, domain, uid, gid)); } diff --git a/indimail-x/close_big_dir.h b/indimail-x/close_big_dir.h index 6f13aeb9d..6f822a86d 100644 --- a/indimail-x/close_big_dir.h +++ b/indimail-x/close_big_dir.h @@ -13,6 +13,6 @@ #include #endif -int close_big_dir(char *, char *, uid_t, gid_t); +int close_big_dir(const char *, const char *, uid_t, gid_t); #endif diff --git a/indimail-x/common.c b/indimail-x/common.c index 926299a8c..0a1a0e342 100644 --- a/indimail-x/common.c +++ b/indimail-x/common.c @@ -26,7 +26,7 @@ #include "common.h" void -out(char *prefix, char *str) +out(const char *prefix, const char *str) { if (!str || !*str) return; @@ -36,14 +36,14 @@ out(char *prefix, char *str) } void -flush(char *prefix) +flush(const char *prefix) { if (substdio_flush(subfdout) == -1) strerr_die2sys(111, prefix, ": write: "); } void -errout(char *prefix, char *str) +errout(const char *prefix, const char *str) { if (!str || !*str) return; @@ -53,7 +53,7 @@ errout(char *prefix, char *str) } void -errflush(char *prefix) +errflush(const char *prefix) { if (substdio_flush(subfderr) == -1) strerr_die2sys(111, prefix, ": write: "); diff --git a/indimail-x/common.h b/indimail-x/common.h index a2c34ec9c..7b9f39859 100644 --- a/indimail-x/common.h +++ b/indimail-x/common.h @@ -5,10 +5,10 @@ #endif #include -void out(char *, char *); -void flush(char *); -void errout(char *, char *); -void errflush(char *); +void out(const char *, const char *); +void flush(const char *); +void errout(const char *, const char *); +void errflush(const char *); #ifdef HAVE_STDARG_H int subprintfe(substdio *ss, const char *ident, const char *__restrict __format, ...) __attribute__ ((format (printf, 3, 4))); diff --git a/indimail-x/compat.c b/indimail-x/compat.c index 7ce109a6c..5b04b2c7e 100644 --- a/indimail-x/compat.c +++ b/indimail-x/compat.c @@ -39,7 +39,7 @@ vauth_getpw(char *user, char *domain) char * vget_real_domain(char *domain) { - return (get_real_domain(domain)); + return ((char *) get_real_domain(domain)); } char * diff --git a/indimail-x/dblock.h b/indimail-x/dblock.h index dbfab2511..16866395c 100644 --- a/indimail-x/dblock.h +++ b/indimail-x/dblock.h @@ -7,7 +7,7 @@ #ifndef DBLOCK_H #define DBLOCK_H -int getDbLock(char *, char); -int delDbLock(int, char *, char); -int readPidLock(char *, char); +int getDbLock(const char *, const char); +int delDbLock(int, const char *, char); +int readPidLock(const char *, char); #endif diff --git a/indimail-x/dec_dir_control.c b/indimail-x/dec_dir_control.c index 45af70501..0c3f76bde 100644 --- a/indimail-x/dec_dir_control.c +++ b/indimail-x/dec_dir_control.c @@ -17,9 +17,9 @@ static char sccsid[] = "$Id: dec_dir_control.c,v 1.1 2019-04-18 08:37:44+05: #endif int -dec_dir_control(char *path, char *user, char *domain, uid_t uid, gid_t gid) +dec_dir_control(const char *path, const char *user, const char *domain, uid_t uid, gid_t gid) { - char *ptr; + const char *ptr; if (!(ptr = GetPrefix(user, path))) return (-1); diff --git a/indimail-x/del_control.c b/indimail-x/del_control.c index adfe82c73..e4681daca 100644 --- a/indimail-x/del_control.c +++ b/indimail-x/del_control.c @@ -49,7 +49,7 @@ die_nomem() * delete a domain from the control files */ int -del_control(char *domain) +del_control(const char *domain) { static stralloc filename = {0}, tmp = {0}; char *sysconfdir, *controldir; diff --git a/indimail-x/del_control.h b/indimail-x/del_control.h index 4124c5059..698e11fed 100644 --- a/indimail-x/del_control.h +++ b/indimail-x/del_control.h @@ -7,6 +7,6 @@ #ifndef DEL_CONTROL_H #define DEL_CONTROL_H -int del_control(char *); +int del_control(const char *); #endif diff --git a/indimail-x/del_domain_assign.c b/indimail-x/del_domain_assign.c index a6c1eab13..b3b5a39f4 100644 --- a/indimail-x/del_domain_assign.c +++ b/indimail-x/del_domain_assign.c @@ -45,7 +45,7 @@ die_nomem() * */ int -del_domain_assign(char *domain, char *dir, gid_t uid, gid_t gid) +del_domain_assign(const char *domain, const char *dir, gid_t uid, gid_t gid) { static stralloc tmpstr = {0}, fname = {0}; char strnum1[FMT_ULONG], strnum2[FMT_ULONG]; diff --git a/indimail-x/del_domain_assign.h b/indimail-x/del_domain_assign.h index a11ff77a2..2b0c2e85b 100644 --- a/indimail-x/del_domain_assign.h +++ b/indimail-x/del_domain_assign.h @@ -13,6 +13,6 @@ #include #endif -int del_domain_assign(char *, char *, gid_t, gid_t); +int del_domain_assign(const char *, const char *, gid_t, gid_t); #endif diff --git a/indimail-x/del_user_assign.c b/indimail-x/del_user_assign.c index b9b13d46c..9fb1f4ec7 100644 --- a/indimail-x/del_user_assign.c +++ b/indimail-x/del_user_assign.c @@ -39,7 +39,7 @@ die_nomem() * remove a local user from the users/assign file and recompile */ int -del_user_assign(char *user, char *dir) +del_user_assign(const char *user, const char *dir) { static stralloc tmp1 = {0}, tmp2 = {0}, fname = {0}; char strnum[FMT_ULONG]; diff --git a/indimail-x/del_user_assign.h b/indimail-x/del_user_assign.h index 060431c3f..be7d2570c 100644 --- a/indimail-x/del_user_assign.h +++ b/indimail-x/del_user_assign.h @@ -7,6 +7,6 @@ #ifndef DEL_USER_ASSIGN_H #define DEL_USER_ASSIGN_H -int del_user_assign(char *, char *); +int del_user_assign(const char *, const char *); #endif diff --git a/indimail-x/deldomain.c b/indimail-x/deldomain.c index 3f0e6938c..cdb14b7d5 100644 --- a/indimail-x/deldomain.c +++ b/indimail-x/deldomain.c @@ -44,7 +44,6 @@ #endif #include "variables.h" #include "vlimits.h" -#include "lowerit.h" #include "open_master.h" #include "is_alias_domain.h" #include "sql_deldomain.h" @@ -72,7 +71,7 @@ die_nomem() } int -remove_alias_domain(char *domain, char *alias_domain_file) +remove_alias_domain(const char *domain, const char *alias_domain_file) { int i; uid_t uid; @@ -111,7 +110,7 @@ remove_alias_domain(char *domain, char *alias_domain_file) } int -deldomain(char *domain) +deldomain(const char *domain) { char inbuf[512]; static stralloc Dir = {0}, tmpbuf = {0}, BasePath = {0}, line = {0}; @@ -132,7 +131,6 @@ deldomain(char *domain) strerr_warn1("deldomain: domain name cannot be null", 0); return (-1); } - lowerit(domain); if (use_etrn) { if (!(ptr = autoturn_dir(domain))) { strerr_warn3("deldomain: autoturn domain ", domain, " does not exist", 0); diff --git a/indimail-x/deldomain.h b/indimail-x/deldomain.h index 24260dea0..f87f6ed51 100644 --- a/indimail-x/deldomain.h +++ b/indimail-x/deldomain.h @@ -7,6 +7,6 @@ #ifndef DELDOMAIN_H #define DELDOMAIN_H -int deldomain(char *); +int deldomain(const char *); #endif /*- DELDOMAIN_H */ diff --git a/indimail-x/deluser.c b/indimail-x/deluser.c index d150ff541..c3849834c 100644 --- a/indimail-x/deluser.c +++ b/indimail-x/deluser.c @@ -33,7 +33,6 @@ #include #include #endif -#include "lowerit.h" #include "common.h" #include "get_real_domain.h" #include "get_assign.h" @@ -84,11 +83,12 @@ getch(ch) * indimail to indibak. make the user inactive */ int -deluser(char *user, char *domain, int remove_db) +deluser(const char *user, const char *domain, int remove_db) { struct passwd *passent; static stralloc user_dir = {0}, domain_dir = {0}, tmp = {0}, SqlBuf = {0}; - char *real_domain, *ptr; + const char *real_domain; + char *ptr; char ch; char buf[1]; mdir_t quota; @@ -127,9 +127,6 @@ deluser(char *user, char *domain, int remove_db) } } } - lowerit(user); - if (domain && *domain) - lowerit(domain); if (domain && *domain) { if (!(real_domain = get_real_domain(domain))) { strerr_warn3("deluser: ", domain, " does not exist", 0); diff --git a/indimail-x/deluser.h b/indimail-x/deluser.h index b06a927ef..d0aa4a012 100644 --- a/indimail-x/deluser.h +++ b/indimail-x/deluser.h @@ -7,6 +7,6 @@ #ifndef DELUSER_H #define DELUSER_H -int deluser(char *, char *, int); +int deluser(const char *, const char *, int); #endif diff --git a/indimail-x/delusercntrl.c b/indimail-x/delusercntrl.c index dac181ea6..4855ccb20 100644 --- a/indimail-x/delusercntrl.c +++ b/indimail-x/delusercntrl.c @@ -41,7 +41,7 @@ die_nomem() */ int -delusercntrl(char *user, char *domain, int force) +delusercntrl(const char *user, const char *domain, int force) { static stralloc SqlBuf = {0}; int err; diff --git a/indimail-x/delusercntrl.h b/indimail-x/delusercntrl.h index b12424dcb..527d2f7f9 100644 --- a/indimail-x/delusercntrl.h +++ b/indimail-x/delusercntrl.h @@ -7,6 +7,6 @@ #ifndef DELUSERCNTRL_H #define DELUSERCNTRL_H -int delusercntrl(char *, char *, int); +int delusercntrl(const char *, const char *, int); #endif diff --git a/indimail-x/dir_control.h b/indimail-x/dir_control.h index 64f246b4f..1802cee07 100644 --- a/indimail-x/dir_control.h +++ b/indimail-x/dir_control.h @@ -40,12 +40,12 @@ extern char *rfc_ids[]; void init_dir_control(vdir_type *); char *inc_dir(vdir_type *, int); -int vcreate_dir_control(char *, char *); -int vdel_dir_control(char *); +int vcreate_dir_control(const char *, const char *); +int vdel_dir_control(const char *); int inc_dir_control(vdir_type *, int); -int dec_dir_control(char *, char *, char *, uid_t, gid_t); -int vread_dir_control(char *, vdir_type *, char *); -int vwrite_dir_control(char *, vdir_type *, char *, uid_t, gid_t); -int dec_dir_control(char *, char *, char *, uid_t, gid_t); +int dec_dir_control(const char *, const char *, const char *, uid_t, gid_t); +int vread_dir_control(const char *, vdir_type *, const char *); +int vwrite_dir_control(const char *, vdir_type *, const char *, uid_t, gid_t); +int dec_dir_control(const char *, const char *, const char *, uid_t, gid_t); #endif diff --git a/indimail-x/findhost.c b/indimail-x/findhost.c index 7311b6c17..ffb92b857 100644 --- a/indimail-x/findhost.c +++ b/indimail-x/findhost.c @@ -114,7 +114,7 @@ iclose_cntrl() } int -open_central_db(char *dbhost) +open_central_db(const char *dbhost) { struct substdio ssin; static stralloc host_path = {0}, SqlBuf = {0}; @@ -316,11 +316,12 @@ open_central_db(char *dbhost) * 3 - connect and do not look for '*' */ char * -findhost(char *email, int connect_primarydb) +findhost(const char *email, int connect_primarydb) { static stralloc mailhost = {0}, prevEmail = {0}, user = {0}, domain = {0}, SqlBuf = {0}, hostid = {0}; - char *ptr, *real_domain, *ip_addr; + char *ptr; + const char *real_domain, *ip_addr; int len, port, err, attempt = 0; MYSQL_RES *res; MYSQL_ROW row; diff --git a/indimail-x/findhost.h b/indimail-x/findhost.h index d7598197c..0cd9f845d 100644 --- a/indimail-x/findhost.h +++ b/indimail-x/findhost.h @@ -10,8 +10,8 @@ #include "config.h" #endif -int open_central_db(char *); -char *findhost(char *, int); +int open_central_db(const char *); +char *findhost(const char *, int); #ifdef QUERY_CACHE void findhost_cache(char); #endif diff --git a/indimail-x/findmdahost.c b/indimail-x/findmdahost.c index 4b1d63cac..0ba57d416 100644 --- a/indimail-x/findmdahost.c +++ b/indimail-x/findmdahost.c @@ -41,12 +41,13 @@ static char sccsid[] = "$Id: findmdahost.c,v 1.3 2021-01-26 00:28:43+05:30 C #include char * -findmdahost(char *email, int *total) +findmdahost(const char *email, int *total) { int is_dist, count, port, connect_all, i; static stralloc user = {0}, domain = {0}, mailhost = {0}; char strnum1[FMT_ULONG], strnum2[FMT_ULONG]; - char *real_domain, *ip; + const char *real_domain; + char *ip; DBINFO **rhostsptr; MYSQL **mysqlptr; struct passwd *pw; diff --git a/indimail-x/findmdahost.h b/indimail-x/findmdahost.h index d323b6682..d6269210f 100644 --- a/indimail-x/findmdahost.h +++ b/indimail-x/findmdahost.h @@ -7,6 +7,6 @@ #ifndef FINDMDAHOST_H #define FINDMDAHOST_H -char *findmdahost(char *, int *); +char *findmdahost(const char *, int *); #endif diff --git a/indimail-x/getDbLock.c b/indimail-x/getDbLock.c index 10e872c8c..f0bf00c9b 100644 --- a/indimail-x/getDbLock.c +++ b/indimail-x/getDbLock.c @@ -23,14 +23,14 @@ static char sccsid[] = "$Id: getDbLock.c,v 1.1 2019-04-20 09:18:06+05:30 Cpr #endif static void -die_nomem(char *str) +die_nomem(const char *str) { strerr_warn2(str, ": out of memory", 0); _exit(111); } int -delDbLock(int lockfd, char *filename, char proj) +delDbLock(int lockfd, const char *filename, char proj) { #ifdef FILE_LOCKING if (RemoveLock(filename, proj) == -1) { @@ -44,7 +44,7 @@ delDbLock(int lockfd, char *filename, char proj) } int -getDbLock(char *filename, char proj) +getDbLock(const char *filename, char proj) { #ifdef FILE_LOCKING int lockfd; @@ -68,7 +68,7 @@ getDbLock(char *filename, char proj) } int -readPidLock(char *filename, char proj) +readPidLock(const char *filename, char proj) { static stralloc fname = {0}; int fd; diff --git a/indimail-x/get_Mplexdir.c b/indimail-x/get_Mplexdir.c index 2d0dfba40..a56cd8401 100644 --- a/indimail-x/get_Mplexdir.c +++ b/indimail-x/get_Mplexdir.c @@ -45,7 +45,7 @@ die_nomem() } char * -get_Mplexdir(char *username, char *domain, int creflag, uid_t uid, gid_t gid) +get_Mplexdir(const char *username, const char *domain, int creflag, uid_t uid, gid_t gid) { int ch; static stralloc dirbuf = {0}; diff --git a/indimail-x/get_Mplexdir.h b/indimail-x/get_Mplexdir.h index 731440b45..5cc5edbd2 100644 --- a/indimail-x/get_Mplexdir.h +++ b/indimail-x/get_Mplexdir.h @@ -13,6 +13,6 @@ #include #endif -char *get_Mplexdir(char *, char *, int, uid_t, gid_t); +char *get_Mplexdir(const char *, const char *, int, uid_t, gid_t); #endif diff --git a/indimail-x/get_assign.c b/indimail-x/get_assign.c index b2704ae81..f98d75965 100644 --- a/indimail-x/get_assign.c +++ b/indimail-x/get_assign.c @@ -22,9 +22,6 @@ #ifdef HAVE_SYS_TYPES_H #include #endif -#ifdef HAVE_CTYPE_H -#include -#endif #ifdef HAVE_UNISTD_H #include #endif @@ -63,7 +60,7 @@ die_nomem() } char * -get_assign(char *domain, stralloc *dir, uid_t *uid, gid_t *gid) +get_assign(const char *domain, stralloc *dir, uid_t *uid, gid_t *gid) { int dlen, i, fd; char *s, *ptr, *assigndir, *tmpstr, *tmpbuf; @@ -76,10 +73,6 @@ get_assign(char *domain, stralloc *dir, uid_t *uid, gid_t *gid) if (!domain || !*domain) return ((char *) 0); - for (s = domain; *s; s++) { - if (isupper(*s)) - *s = tolower(*s); - } #ifdef QUERY_CACHE if (_cacheSwitch && env_get("QUERY_CACHE")) { if (in_domain_size && in_domain && in_dir && diff --git a/indimail-x/get_assign.h b/indimail-x/get_assign.h index 68891d968..bb0296a55 100644 --- a/indimail-x/get_assign.h +++ b/indimail-x/get_assign.h @@ -7,7 +7,7 @@ #include #endif -char *get_assign(char *, stralloc *, uid_t *, gid_t *); +char *get_assign(const char *, stralloc *, uid_t *, gid_t *); #ifdef QUERY_CACHE void get_assign_cache(char); #endif diff --git a/indimail-x/get_hashmethod.c b/indimail-x/get_hashmethod.c index dbdf8d697..8b963606c 100644 --- a/indimail-x/get_hashmethod.c +++ b/indimail-x/get_hashmethod.c @@ -58,12 +58,13 @@ get_default_fn() } int -get_hashmethod(char *domain) +get_hashmethod(const char *domain) { struct substdio ssin; static stralloc line = {0}; char inbuf[4096]; - char *ptr, *real_domain; + char *ptr; + const char *real_domain; int match, fd, i, r; static int hash_m = -1; diff --git a/indimail-x/get_hashmethod.h b/indimail-x/get_hashmethod.h index b19d310a1..738816d9d 100644 --- a/indimail-x/get_hashmethod.h +++ b/indimail-x/get_hashmethod.h @@ -4,7 +4,7 @@ #ifndef _GET_HASH_METHOD_H_ #define _GET_HASH_METHOD_H_ -int get_hashmethod(char *); +int get_hashmethod(const char *); char *print_hashmethod(int); #endif diff --git a/indimail-x/get_real_domain.c b/indimail-x/get_real_domain.c index 84b81b2c8..c228c99a6 100644 --- a/indimail-x/get_real_domain.c +++ b/indimail-x/get_real_domain.c @@ -69,7 +69,7 @@ die_nomem() #ifdef CLUSTERED_SITE static char * -is_in_rcpthosts(char *domain) +is_in_rcpthosts(const char *domain) { int fd, match; char inbuf[512]; @@ -186,7 +186,7 @@ is_in_rcpthosts(char *domain) #endif static char * -is_in_env(char *domain, char *envstr) +is_in_env(const char *domain, const char *envstr) { char *ptr, *cptr; int len; @@ -222,8 +222,8 @@ is_in_env(char *domain, char *envstr) return ((char *) 0); } -char * -get_real_domain(char *domain) +const char * +get_real_domain(const char *domain) { static stralloc dir = {0}; char Dir[1024]; diff --git a/indimail-x/get_real_domain.h b/indimail-x/get_real_domain.h index ada7f3b3e..2ad1072c2 100644 --- a/indimail-x/get_real_domain.h +++ b/indimail-x/get_real_domain.h @@ -10,7 +10,7 @@ #include "config.h" #endif -char *get_real_domain(char *); +const char *get_real_domain(const char *); #ifdef QUERY_CACHE void get_real_domain_cache(char); #endif diff --git a/indimail-x/getactualpath.c b/indimail-x/getactualpath.c index f44fdd179..e352ff456 100644 --- a/indimail-x/getactualpath.c +++ b/indimail-x/getactualpath.c @@ -33,7 +33,7 @@ die_nomem() } char * -getactualpath(char *path) +getactualpath(const char *path) { char *ptr; static stralloc pathbuf = {0}; diff --git a/indimail-x/getactualpath.h b/indimail-x/getactualpath.h index 49aee56e2..e9c01d096 100644 --- a/indimail-x/getactualpath.h +++ b/indimail-x/getactualpath.h @@ -7,6 +7,6 @@ #ifndef GETACTUALPATH_H #define GETACTUALPATH_H -char *getactualpath(char *); +char *getactualpath(const char *); #endif diff --git a/indimail-x/iadddomain.c b/indimail-x/iadddomain.c index f8f258cc2..7141fc1aa 100644 --- a/indimail-x/iadddomain.c +++ b/indimail-x/iadddomain.c @@ -92,8 +92,10 @@ iadddomain(char *domain, char *ipaddr, char *dir, uid_t uid, gid_t gid, int chk_ strerr_warn4("adddomain: invalid char ", "'", tmp, "'", 0); return (-1); } - if (isupper((int) *ptr)) - *ptr = tolower(*ptr); + if (isupper((int) *ptr)) { + strerr_warn3("adddomain: domain [", domain, "] has an uppercase character", 0); + return (-1); + } } if ((*(ptr - 1)) == '-') { strerr_warn1("adddomain: Last component cannot be '-'", 0); diff --git a/indimail-x/iadduser.c b/indimail-x/iadduser.c index 9d2700eba..39b1e6870 100644 --- a/indimail-x/iadduser.c +++ b/indimail-x/iadduser.c @@ -122,9 +122,9 @@ die_nomem() * in the 3696 errata. */ int -iadduser(char *username, char *domain, char *mdahost, char *password, - char *gecos, char *quota, int max_users_per_level, int actFlag, - int encrypt_flag, char *scram_passwd) +iadduser(const char *username, const char *domain, const char *mdahost, const char *password, + const char *gecos, char *quota, int max_users_per_level, int actFlag, + int encrypt_flag, const char *scram_passwd) { static stralloc Dir = {0}, Crypted = {0}, tmpbuf = {0}, line = {0}; char estr[2], inbuf[512], strnum[FMT_ULONG]; @@ -146,7 +146,7 @@ iadduser(char *username, char *domain, char *mdahost, char *password, if (*username == '.' || username[ulen - 1] == '.') strerr_die1x(100, "iadduser: Trailing/Leading periods not allowed"); getEnvConfigStr(&allow_chars, "ALLOWCHARS", ALLOWCHARS); - for (ptr = username;*ptr;ptr++) { + for (ptr = (char *) username; *ptr; ptr++) { if (*ptr == ':') strerr_die1x(100, "iadduser: ':' not allowed in names"); if (*ptr == '.' && *(ptr + 1) == '.') @@ -160,16 +160,16 @@ iadduser(char *username, char *domain, char *mdahost, char *password, strerr_die3x(100, "iadduser: [", estr, "] not allowed in local-part See RFC-5322"); } if (isupper((int) *ptr)) - *ptr = tolower((int) *ptr); + strerr_die3x(100, "iadduser: user [", username, "] has an uppercase character"); } if (domain && *domain) { - for (ptr = domain;*ptr;ptr++) { + for (ptr = (char *) domain; *ptr; ptr++) { if (*ptr == ':') { strerr_die1x(100, "iadduser: ':' not allowed in names"); return (-1); } else if (isupper((int) *ptr)) - *ptr = tolower(*ptr); + strerr_die3x(100, "iadduser: domain [", domain, "] has an uppercase character"); } uid_flag = 1; #ifdef CLUSTERED_SITE diff --git a/indimail-x/iadduser.h b/indimail-x/iadduser.h index e9425d7c3..6f7b4f6b7 100644 --- a/indimail-x/iadduser.h +++ b/indimail-x/iadduser.h @@ -16,6 +16,6 @@ #ifndef IADDUSER_H #define IADDUSER_H -int iadduser(char *, char *, char *, char *, char *, char *, int, int, int, char *); +int iadduser(const char *, const char *, const char *, const char *, const char *, const char *, int, int, int, const char *); #endif diff --git a/indimail-x/iauth.c b/indimail-x/iauth.c index d7710dfe5..3037d840a 100644 --- a/indimail-x/iauth.c +++ b/indimail-x/iauth.c @@ -100,10 +100,11 @@ close_connection() struct passwd *_global_pw; static char * -i_auth(char *email, char *service, int *size, int debug) +i_auth(const char *email, const char *service, int *size, int debug) { static stralloc User = {0}, Domain = {0}; - char *real_domain, *crypt_pass; + const char *real_domain; + char *crypt_pass; char strnum[FMT_ULONG]; int i; uid_t uid; @@ -211,7 +212,8 @@ char * i_acctmgmt(char *email, char *service, int *size, int *nitems, int debug) { static stralloc User = {0}, Domain = {0}, SqlBuf = {0}; - char *ptr, *real_domain; + char *ptr; + const char *real_domain; char strnum1[FMT_ULONG], strnum2[FMT_ULONG]; int i, exp_day; static long exp_times[NO_OF_ITEMS]; diff --git a/indimail-x/inc_dir_control.c b/indimail-x/inc_dir_control.c index 96d9bb867..504c781e9 100644 --- a/indimail-x/inc_dir_control.c +++ b/indimail-x/inc_dir_control.c @@ -19,7 +19,7 @@ static char sccsid[] = "$Id: inc_dir_control.c,v 1.1 2019-04-18 08:23:40+05: #endif int -inc_dir_control(vdir_type * vdir, int max_users_per_level) +inc_dir_control(vdir_type *vdir, int max_users_per_level) { int users_per_level, len; diff --git a/indimail-x/indimail.spec.in b/indimail-x/indimail.spec.in index b2a6d3566..7522ee092 100644 --- a/indimail-x/indimail.spec.in +++ b/indimail-x/indimail.spec.in @@ -605,7 +605,6 @@ done %endif %attr(644,root,root) %{shareddir}/doc/ChangeLog-indimail -%attr(644,root,root) %{shareddir}/doc/FAQ.md %attr(644,root,root) %{shareddir}/doc/README-indimail.md %attr(644,root,root) %{shareddir}/doc/README-ldap.md %attr(644,root,root) %{shareddir}/doc/README-vlimits.md diff --git a/indimail-x/indisrvr.c b/indimail-x/indisrvr.c index 5fb77c5cf..24cc77ca4 100644 --- a/indimail-x/indisrvr.c +++ b/indimail-x/indisrvr.c @@ -37,9 +37,6 @@ static char sccsid[] = "$Id: indisrvr.c,v 1.18 2024-05-06 09:29:07+05:30 Cpr #ifdef HAVE_SIGNAL_H #include #endif -#ifdef HAVE_CTYPE_H -#include -#endif #ifdef HAVE_SSL #include #include diff --git a/indimail-x/ipasswd.c b/indimail-x/ipasswd.c index 70996a072..447be6238 100644 --- a/indimail-x/ipasswd.c +++ b/indimail-x/ipasswd.c @@ -32,7 +32,6 @@ #include #include #endif -#include "lowerit.h" #include "iopen.h" #include "iclose.h" #include "sqlOpen_user.h" @@ -59,7 +58,7 @@ die_nomem() * update a users virtual password file entry with a different password */ int -ipasswd(char *username, char *domain, char *password, int encrypt_flag, char *scram_passwd) +ipasswd(const char *username, const char *domain, const char *password, int encrypt_flag, const char *scram_passwd) { struct passwd *pw; char *ptr; @@ -68,8 +67,6 @@ ipasswd(char *username, char *domain, char *password, int encrypt_flag, char *sc static stralloc Dir = {0}, Crypted = {0}, email = {0}; mdir_t quota; - lowerit(username); - lowerit(domain); if (!stralloc_copys(&email, username) || !stralloc_append(&email, "@") || !stralloc_cats(&email, domain) || diff --git a/indimail-x/ipasswd.h b/indimail-x/ipasswd.h index 8171c66d5..1d837617d 100644 --- a/indimail-x/ipasswd.h +++ b/indimail-x/ipasswd.h @@ -10,6 +10,6 @@ #ifndef IPASSWD_H #define IPASSWD_H -int ipasswd(char *, char *, char *, int, char *); +int ipasswd(const char *, const char *, const char *, int, const char *); #endif diff --git a/indimail-x/is_alias_domain.c b/indimail-x/is_alias_domain.c index 72ec38a8b..07f3c6017 100644 --- a/indimail-x/is_alias_domain.c +++ b/indimail-x/is_alias_domain.c @@ -51,7 +51,7 @@ die_nomem() } int -is_alias_domain(char *domain) +is_alias_domain(const char *domain) { int fd, match, t; char inbuf[512]; diff --git a/indimail-x/is_alias_domain.h b/indimail-x/is_alias_domain.h index 74de5ace8..70ccd81db 100644 --- a/indimail-x/is_alias_domain.h +++ b/indimail-x/is_alias_domain.h @@ -8,6 +8,6 @@ #ifndef IS_ALIAS_DOMAIN_H #define IS_ALIAS_DOMAIN_H -int is_alias_domain(char *); +int is_alias_domain(const char *); #endif diff --git a/indimail-x/is_distributed_domain.c b/indimail-x/is_distributed_domain.c index 6fa24b1c2..26a213cb2 100644 --- a/indimail-x/is_distributed_domain.c +++ b/indimail-x/is_distributed_domain.c @@ -42,7 +42,7 @@ die_nomem() } int -is_distributed_domain(char *Domain) +is_distributed_domain(const char *Domain) { static stralloc savedomain = {0}; static int dist_flag; diff --git a/indimail-x/is_distributed_domain.h b/indimail-x/is_distributed_domain.h index d65497c32..4659579ba 100644 --- a/indimail-x/is_distributed_domain.h +++ b/indimail-x/is_distributed_domain.h @@ -11,7 +11,7 @@ #include "config.h" #endif -int is_distributed_domain(char *); +int is_distributed_domain(const char *); #ifdef QUERY_CACHE void is_distributed_domain_cache(char); #endif diff --git a/indimail-x/is_user_present.c b/indimail-x/is_user_present.c index d131ed496..57cd45f53 100644 --- a/indimail-x/is_user_present.c +++ b/indimail-x/is_user_present.c @@ -54,11 +54,11 @@ die_nomem() } int -is_user_present(char *user, char *domain) +is_user_present(const char *user, const char *domain) { int ret; static int is_present; - char *real_domain; + const char *real_domain; MYSQL_RES *res; if (!user || !*user || !domain || !*domain) diff --git a/indimail-x/is_user_present.h b/indimail-x/is_user_present.h index 65e636ac9..350194c4d 100644 --- a/indimail-x/is_user_present.h +++ b/indimail-x/is_user_present.h @@ -4,7 +4,7 @@ #include "config.h" #endif -int is_user_present(char *, char *); +int is_user_present(const char *, const char *); #ifdef QUERY_CACHE void is_user_present_cache(char); #endif diff --git a/indimail-x/limits.c b/indimail-x/limits.c index 9e8c57e4b..b46ed2278 100644 --- a/indimail-x/limits.c +++ b/indimail-x/limits.c @@ -66,7 +66,7 @@ die_nomem(char *str) } int -vget_limits(char *domain, struct vlimits *limits) +vget_limits(const char *domain, struct vlimits *limits) { int err, perm; MYSQL_ROW row; @@ -176,7 +176,7 @@ vget_limits(char *domain, struct vlimits *limits) } int -vdel_limits(char *domain) +vdel_limits(const char *domain) { int err; @@ -214,7 +214,7 @@ vdel_limits(char *domain) } int -vset_limits(char *domain, struct vlimits *limits) +vset_limits(const char *domain, struct vlimits *limits) { int err; char strnum[FMT_ULONG]; diff --git a/indimail-x/lockfile.c b/indimail-x/lockfile.c index aa12b00fc..f8d9fc2bf 100644 --- a/indimail-x/lockfile.c +++ b/indimail-x/lockfile.c @@ -56,7 +56,7 @@ static struct sembuf op_unlock[1] = { static void SigAlarm(); int -lockcreate(char *filename, char proj) +lockcreate(const char *filename, char proj) { key_t key; int semid; @@ -128,7 +128,7 @@ ReleaseLock(int fd) /*- Dummy Function */ int -RemoveLock(char *filename, char proj) +RemoveLock(const char *filename, char proj) { return (0); } @@ -172,7 +172,7 @@ die_nomem() } int -lockcreate(char *filename, char proj) +lockcreate(const char *filename, char proj) { struct stat statbuf; char strnum1[FMT_ULONG], strnum2[FMT_ULONG]; @@ -314,7 +314,7 @@ ReleaseLock(int fd) } int -RemoveLock(char *filename, char proj) +RemoveLock(const char *filename, char proj) { int i; @@ -349,7 +349,7 @@ die_nomem() } int -lockcreate(char *filename, char proj) +lockcreate(const char *filename, char proj) { int fd, i; struct flock fl = {0}; @@ -405,7 +405,7 @@ ReleaseLock(int fd) } int -RemoveLock(char *filename, char proj) +RemoveLock(const char *filename, char proj) { int i; @@ -421,7 +421,7 @@ RemoveLock(char *filename, char proj) } #elif defined(USE_LOCKF) int -lockcreate(char *filename, char proj) +lockcreate(const char *filename, char proj) { int fd, i; @@ -456,7 +456,7 @@ ReleaseLock(int fd) } int -RemoveLock(char *filename, char proj) +RemoveLock(const char *filename, char proj) { int i; diff --git a/indimail-x/lockfile.h b/indimail-x/lockfile.h index 7904cdcef..ca7f0c616 100644 --- a/indimail-x/lockfile.h +++ b/indimail-x/lockfile.h @@ -7,10 +7,10 @@ #ifndef LOCKFILE_H #define LOCKFILE_H -int lockcreate(char *, char); +int lockcreate(const char *, char); int lockremove(int); int get_write_lock(int); int ReleaseLock(int); -int RemoveLock(char *, char); +int RemoveLock(const char *, char); #endif diff --git a/indimail-x/make_user_dir.c b/indimail-x/make_user_dir.c index 766906c35..219331dd0 100644 --- a/indimail-x/make_user_dir.c +++ b/indimail-x/make_user_dir.c @@ -49,7 +49,7 @@ die_nomem() * make the directories if needed */ char * -make_user_dir(char *username, char *domain, uid_t uid, gid_t gid, int users_per_level) +make_user_dir(const char *username, const char *domain, uid_t uid, gid_t gid, int users_per_level) { char *tmpstr, *fname; static stralloc tmp1 = {0}, tmp2 = {0}; diff --git a/indimail-x/make_user_dir.h b/indimail-x/make_user_dir.h index 70b8f4a36..d414b7c15 100644 --- a/indimail-x/make_user_dir.h +++ b/indimail-x/make_user_dir.h @@ -7,6 +7,6 @@ #ifndef MAKE_USER_DIR #define MAKE_USER_DIR -char *make_user_dir(char *, char *, uid_t, gid_t, int); +char *make_user_dir(const char *, const char *, uid_t, gid_t, int); #endif diff --git a/indimail-x/munch_domain.c b/indimail-x/munch_domain.c index 96eaee880..e60ff06c9 100644 --- a/indimail-x/munch_domain.c +++ b/indimail-x/munch_domain.c @@ -27,8 +27,8 @@ die_nomem() _exit(111); } -char * -munch_domain(char *domain) +const char * +munch_domain(const char *domain) { int i; static stralloc tmpbuf = {0}; diff --git a/indimail-x/munch_domain.h b/indimail-x/munch_domain.h index c2b89fefb..d8b1c9e14 100644 --- a/indimail-x/munch_domain.h +++ b/indimail-x/munch_domain.h @@ -7,6 +7,6 @@ #ifndef MUNCH_DOMAIN_H #define MUNCH_DOMAIN_H -char *munch_domain(char *domain); +char *munch_domain(const char *domain); #endif /*- MUNCH_DOMAIN_H */ diff --git a/indimail-x/open_big_dir.c b/indimail-x/open_big_dir.c index bb44ab2f2..20f831c8a 100644 --- a/indimail-x/open_big_dir.c +++ b/indimail-x/open_big_dir.c @@ -15,7 +15,7 @@ static char sccsid[] = "$Id: open_big_dir.c,v 1.1 2019-04-18 08:31:45+05:30 #endif char * -open_big_dir(char *username, char *domain, char *path) +open_big_dir(const char *username, const char *domain, char *path) { char *filesys_prefix; diff --git a/indimail-x/open_big_dir.h b/indimail-x/open_big_dir.h index 2170cf3fc..90f0abb3a 100644 --- a/indimail-x/open_big_dir.h +++ b/indimail-x/open_big_dir.h @@ -7,6 +7,6 @@ #ifndef OPEN_BIG_DIR_H #define OPEN_BIG_DIR_H -char *open_big_dir(char *, char *, char *); +char *open_big_dir(const char *, const char *, const char *); #endif diff --git a/indimail-x/open_smtp_relay.c b/indimail-x/open_smtp_relay.c index 66a0adef4..ed483b867 100644 --- a/indimail-x/open_smtp_relay.c +++ b/indimail-x/open_smtp_relay.c @@ -58,7 +58,8 @@ open_smtp_relay(char *user, char *domain) static stralloc SqlBuf = {0}; int i; char strnum[FMT_ULONG]; - char *ipaddr, *relay_table, *real_domain; + char *ipaddr, *relay_table; + const char *real_domain; #ifdef ENABLE_IPV6 if (!(ipaddr = env_get("TCP6REMOTEIP")) && !(ipaddr = env_get("TCPREMOTEIP"))) diff --git a/indimail-x/parse_quota.c b/indimail-x/parse_quota.c index 28a4ac8c8..0650ef794 100644 --- a/indimail-x/parse_quota.c +++ b/indimail-x/parse_quota.c @@ -42,7 +42,7 @@ die_nomem() } mdir_t -parse_quota(char *quota, mdir_t *count) +parse_quota(const char *quota, mdir_t *count) { static stralloc tmpbuf = {0}; mdir_t per_user_limit; diff --git a/indimail-x/parse_quota.h b/indimail-x/parse_quota.h index 0bf5f28af..00dcff0af 100644 --- a/indimail-x/parse_quota.h +++ b/indimail-x/parse_quota.h @@ -11,6 +11,6 @@ #endif #include "indimail.h" -mdir_t parse_quota(char *, mdir_t *); +mdir_t parse_quota(const char *, mdir_t *); #endif diff --git a/indimail-x/pathToFilesystem.c b/indimail-x/pathToFilesystem.c index e4ac5b5cd..db87f54bc 100644 --- a/indimail-x/pathToFilesystem.c +++ b/indimail-x/pathToFilesystem.c @@ -51,9 +51,9 @@ die_nomem() } char * -pathToFilesystem(char *path) +pathToFilesystem(const char *path) { - char *ptr; + const char *ptr; int pathlen, len; static stralloc tmpbuf = {0}, _path = {0}; #ifdef linux @@ -106,7 +106,7 @@ pathToFilesystem(char *path) if (!access("/proc/self/mounts", F_OK)) fp = setmntent("/proc/self/mounts", "r"); else - if (!access("/proc/mounts", F_OK)) + if (!access("/eroc/mounts", F_OK)) fp = setmntent("/proc/mounts", "r"); else { errno = 2; diff --git a/indimail-x/pathToFilesystem.h b/indimail-x/pathToFilesystem.h index 6d0aed727..1e3114c64 100644 --- a/indimail-x/pathToFilesystem.h +++ b/indimail-x/pathToFilesystem.h @@ -7,6 +7,6 @@ #ifndef PATHTOFILESYSTEM_H #define PATHTOFILESYSTEM_H -char *pathToFilesystem(char *); +char *pathToFilesystem(const char *); #endif diff --git a/indimail-x/relay_select.c b/indimail-x/relay_select.c index 2ad308556..fb70e626f 100644 --- a/indimail-x/relay_select.c +++ b/indimail-x/relay_select.c @@ -42,7 +42,7 @@ die_nomem() } int -relay_select(char *email, char *remoteip) +relay_select(const char *email, const char *remoteip) { static stralloc SqlBuf = {0}; char strnum[FMT_ULONG]; diff --git a/indimail-x/relay_select.h b/indimail-x/relay_select.h index 8624ceac0..e8025be57 100644 --- a/indimail-x/relay_select.h +++ b/indimail-x/relay_select.h @@ -11,7 +11,7 @@ #endif #ifdef POP_AUTH_OPEN_RELAY -int relay_select(char *, char *); +int relay_select(const char *, const char *); #endif #endif diff --git a/indimail-x/remove_line.c b/indimail-x/remove_line.c index e37bd8c3d..72a9bd059 100644 --- a/indimail-x/remove_line.c +++ b/indimail-x/remove_line.c @@ -57,7 +57,7 @@ die_nomem() * 1 if match found */ int -remove_line_int(char *template, char *filename, int once_only, mode_t mode, int partial) +remove_line_int(const char *template, const char *filename, int once_only, mode_t mode, int partial) { struct substdio ssin, ssout; static stralloc fname = {0}, line = {0}; @@ -169,13 +169,13 @@ remove_line_int(char *template, char *filename, int once_only, mode_t mode, int } int -remove_line(char *template, char *filename, int once_only, mode_t mode) +remove_line(const char *template, const char *filename, int once_only, mode_t mode) { return (remove_line_int(template, filename, once_only, mode, 0)); } int -remove_line_p(char *template, char *filename, int once_only, mode_t mode) +remove_line_p(const char *template, const char *filename, int once_only, mode_t mode) { return (remove_line_int(template, filename, once_only, mode, 1)); } diff --git a/indimail-x/remove_line.h b/indimail-x/remove_line.h index 76d328ad7..938adb9ea 100644 --- a/indimail-x/remove_line.h +++ b/indimail-x/remove_line.h @@ -16,7 +16,7 @@ #include #endif -int remove_line(char *, char *, int, mode_t mode); -int remove_line_p(char *, char *, int, mode_t mode); +int remove_line(const char *, const char *, int, mode_t mode); +int remove_line_p(const char *, const char *, int, mode_t mode); #endif diff --git a/indimail-x/renameuser.c b/indimail-x/renameuser.c index 83d8e10e0..0e2ec0af0 100644 --- a/indimail-x/renameuser.c +++ b/indimail-x/renameuser.c @@ -53,7 +53,8 @@ int renameuser(stralloc *oldUser, stralloc *oldDomain, stralloc *newUser, stralloc *newDomain) { static stralloc oldDir = {0}, SqlBuf = {0}; - char *real_domain, *ptr, *enc_pass; + const char *real_domain; + char *ptr, *enc_pass; char strnum1[FMT_ULONG], strnum2[FMT_ULONG]; #ifdef VALIAS static stralloc User = {0}, oldEmail = {0}, newEmail = {0}, tmp_domain = {0}; diff --git a/indimail-x/setuserquota.c b/indimail-x/setuserquota.c index c6d01d489..986eddda9 100644 --- a/indimail-x/setuserquota.c +++ b/indimail-x/setuserquota.c @@ -27,7 +27,6 @@ #include #include #endif -#include "lowerit.h" #include "sql_getpw.h" #include "parse_quota.h" #include "recalc_quota.h" @@ -46,9 +45,9 @@ die_nomem() /*- Update a users quota */ int -setuserquota(char *username, char *domain, char *quota) +setuserquota(const char *username, const char *domain, const char *quota) { - char *domain_ptr; + const char *domain_ptr; char strnum[FMT_ULONG]; static stralloc tmp = {0}; int i; @@ -61,12 +60,10 @@ setuserquota(char *username, char *domain, char *quota) strerr_warn1("setuserquota: username cannot be null", 0); return (-1); } - lowerit(username); if (domain && *domain) domain_ptr = domain; else - getEnvConfigStr(&domain_ptr, "DEFAULT_DOMAIN", DEFAULT_DOMAIN); - lowerit(domain_ptr); + getEnvConfigStr((char **) &domain_ptr, "DEFAULT_DOMAIN", DEFAULT_DOMAIN); if (!str_diffn(quota, "NOQUOTA", 7)) { if (!stralloc_copyb(&tmp, "NOQUOTA", 7) || !stralloc_0(&tmp)) die_nomem(); diff --git a/indimail-x/setuserquota.h b/indimail-x/setuserquota.h index 165f193e4..7b550701b 100644 --- a/indimail-x/setuserquota.h +++ b/indimail-x/setuserquota.h @@ -7,6 +7,6 @@ #ifndef SETUSERQUOTA_H #define SETUSERQUOTA_H -int setuserquota(char *, char *, char *); +int setuserquota(const char *, const char *, const char *); #endif /*- SETUSERQUOTA_H */ diff --git a/indimail-x/smtp_port.c b/indimail-x/smtp_port.c index 15862582d..3b4598e2d 100644 --- a/indimail-x/smtp_port.c +++ b/indimail-x/smtp_port.c @@ -51,10 +51,11 @@ die_nomem() } int -smtp_port(char *srchost, char *domain, char *hostid) +smtp_port(const char *srchost, const char *domain, const char *hostid) { static stralloc Domain = {0}, SqlBuf = {0}; - char *ptr, *srchost_t; + char *ptr; + const char *srchost_t; int i; int default_port; MYSQL_RES *res; diff --git a/indimail-x/smtp_port.h b/indimail-x/smtp_port.h index 2cfd71cc0..620fd9388 100644 --- a/indimail-x/smtp_port.h +++ b/indimail-x/smtp_port.h @@ -7,6 +7,6 @@ #ifndef GET_SMTP_SERVICE_PORT_H #define GET_SMTP_SERVICE_PORT_H -int smtp_port(char *, char *, char *); +int smtp_port(const char *, const char *, const char *); #endif diff --git a/indimail-x/sqlOpen_user.c b/indimail-x/sqlOpen_user.c index aad38521a..ea62c7905 100644 --- a/indimail-x/sqlOpen_user.c +++ b/indimail-x/sqlOpen_user.c @@ -43,12 +43,13 @@ static char sccsid[] = "$Id: sqlOpen_user.c,v 1.3 2021-01-26 00:29:08+05:30 #include "load_mysql.h" int -sqlOpen_user(char *email, int connect_all) +sqlOpen_user(const char *email, int connect_all) { int count, total = 0; static stralloc user = {0}, domain = {0}, mdahost = {0}; char strnum1[FMT_ULONG], strnum2[FMT_ULONG]; - char *ptr, *cptr, *real_domain; + char *ptr, *cptr; + const char *real_domain; DBINFO **rhostsptr; MYSQL **mysqlptr; diff --git a/indimail-x/sqlOpen_user.h b/indimail-x/sqlOpen_user.h index f41f3f74d..723af2b09 100644 --- a/indimail-x/sqlOpen_user.h +++ b/indimail-x/sqlOpen_user.h @@ -7,6 +7,6 @@ #ifndef SQLOPENUSER_H #define SQLOPENUSER_H -int sqlOpen_user(char *, int); +int sqlOpen_user(const char *, int); #endif diff --git a/indimail-x/sql_active.c b/indimail-x/sql_active.c index 03a44ed2e..662b09095 100644 --- a/indimail-x/sql_active.c +++ b/indimail-x/sql_active.c @@ -51,7 +51,7 @@ die_nomem() } int -sql_active(struct passwd *pw, char *domain, int type) +sql_active(struct passwd *pw, const char *domain, int type) { char *table1 = NULL, *table2 = NULL; int row_count, i; diff --git a/indimail-x/sql_active.h b/indimail-x/sql_active.h index b84721f64..1eb6681ba 100644 --- a/indimail-x/sql_active.h +++ b/indimail-x/sql_active.h @@ -13,6 +13,6 @@ #include #endif -int sql_active(struct passwd *, char *, int); +int sql_active(struct passwd *, const char *, int); #endif diff --git a/indimail-x/sql_adddomain.c b/indimail-x/sql_adddomain.c index 7692d9c97..26e50cfc1 100644 --- a/indimail-x/sql_adddomain.c +++ b/indimail-x/sql_adddomain.c @@ -27,7 +27,7 @@ static char sccsid[] = "$Id: sql_adddomain.c,v 1.2 2021-02-23 21:40:48+05:30 #endif int -sql_adddomain(char *domain) +sql_adddomain(const char *domain) { int err; diff --git a/indimail-x/sql_adddomain.h b/indimail-x/sql_adddomain.h index e6e642cac..bbc2fac6f 100644 --- a/indimail-x/sql_adddomain.h +++ b/indimail-x/sql_adddomain.h @@ -7,6 +7,6 @@ #ifndef SQL_ADDDOMAIN_H #define SQL_ADDDOMAIN_H -int sql_adddomain(char *); +int sql_adddomain(const char *); #endif /*- SQL_ADDDOMAIN_H */ diff --git a/indimail-x/sql_adduser.c b/indimail-x/sql_adduser.c index d6d703dbe..b88a865f9 100644 --- a/indimail-x/sql_adduser.c +++ b/indimail-x/sql_adduser.c @@ -55,8 +55,9 @@ die_nomem() } char * -sql_adduser(char *user, char *domain, char *pass, char *gecos, char *dir, - char *Quota, int uid_flag, int actFlag, char *scram) +sql_adduser(const char *user, const char *domain, const char *pass, + const char *gecos, const char *dir, const char *Quota, int uid_flag, + int actFlag, const char *scram) { static stralloc dirbuf = {0}, quota = {0}, dom_dir = {0}, SqlBuf = {0}; char *domstr, *ptr; diff --git a/indimail-x/sql_adduser.h b/indimail-x/sql_adduser.h index 34588fd62..f89a166cb 100644 --- a/indimail-x/sql_adduser.h +++ b/indimail-x/sql_adduser.h @@ -10,6 +10,6 @@ #ifndef SQL_ADDUSER_H #define SQL_ADDUSER_H -char *sql_adduser(char *, char *, char *, char *, char *, char *, int, int, char *); +char *sql_adduser(const char *, const char *, const char *, const char *, const char *, const char *, int, int, const char *); #endif diff --git a/indimail-x/sql_delaliasdomain.c b/indimail-x/sql_delaliasdomain.c index b7bd25206..f0468264c 100644 --- a/indimail-x/sql_delaliasdomain.c +++ b/indimail-x/sql_delaliasdomain.c @@ -36,7 +36,7 @@ die_nomem() } int -sql_delaliasdomain(char *aliasdomain) +sql_delaliasdomain(const char *aliasdomain) { char *mailstore; int i; diff --git a/indimail-x/sql_delaliasdomain.h b/indimail-x/sql_delaliasdomain.h index 870d18ffc..13c244e09 100644 --- a/indimail-x/sql_delaliasdomain.h +++ b/indimail-x/sql_delaliasdomain.h @@ -7,6 +7,6 @@ #ifndef SQL_DELALIASDOMAIN_H #define SQL_DELALIASDOMAIN_H -int sql_delaliasdomain(char *); +int sql_delaliasdomain(const char *); #endif diff --git a/indimail-x/sql_deldomain.c b/indimail-x/sql_deldomain.c index 8a014884b..08d3c78fb 100644 --- a/indimail-x/sql_deldomain.c +++ b/indimail-x/sql_deldomain.c @@ -48,7 +48,7 @@ die_nomem() } static int -do_sql(char *domain, char *table, stralloc *sqlbuf) +do_sql(const char *domain, const char *table, stralloc *sqlbuf) { if (site_size == LARGE_SITE) { if (!stralloc_copyb(sqlbuf, "drop table ", 11) || @@ -72,7 +72,7 @@ do_sql(char *domain, char *table, stralloc *sqlbuf) } int -sql_deldomain(char *domain) +sql_deldomain(const char *domain) { char *tmpstr; struct passwd *pw; diff --git a/indimail-x/sql_deldomain.h b/indimail-x/sql_deldomain.h index beb0c5d3b..0d314069d 100644 --- a/indimail-x/sql_deldomain.h +++ b/indimail-x/sql_deldomain.h @@ -7,6 +7,6 @@ #ifndef SQL_DELDOMAIN_H #define SQL_DELDOMAIN_H -int sql_deldomain(char *); +int sql_deldomain(const char *); #endif /*- SQL_DELDOMAIN_H */ diff --git a/indimail-x/sql_deluser.c b/indimail-x/sql_deluser.c index fec70381f..9a078cad0 100644 --- a/indimail-x/sql_deluser.c +++ b/indimail-x/sql_deluser.c @@ -38,7 +38,7 @@ die_nomem() } static int -do_sql(char *user, char *domain, char *table) +do_sql(const char *user, const char *domain, const char *table) { static stralloc SqlBuf = {0}; @@ -63,9 +63,9 @@ do_sql(char *user, char *domain, char *table) } int -sql_deluser(char *user, char *domain) +sql_deluser(const char *user, const char *domain) { - char *tmpstr; + const char *tmpstr; int err; if ((err = iopen((char *) 0)) != 0) diff --git a/indimail-x/sql_deluser.h b/indimail-x/sql_deluser.h index e49c4cc9b..0bc0a5995 100644 --- a/indimail-x/sql_deluser.h +++ b/indimail-x/sql_deluser.h @@ -7,6 +7,6 @@ #ifndef SQL_DELUSER_H #define SQL_DELUSER_H -int sql_deluser(char *, char *); +int sql_deluser(const char *, const char *); #endif diff --git a/indimail-x/sql_get_realdomain.c b/indimail-x/sql_get_realdomain.c index 345fe6baf..93cbdb6ed 100644 --- a/indimail-x/sql_get_realdomain.c +++ b/indimail-x/sql_get_realdomain.c @@ -40,7 +40,7 @@ die_nomem() } char * -sql_get_realdomain(char *aliasdomain) +sql_get_realdomain(const char *aliasdomain) { static stralloc prevDomainVal = {0}, SqlBuf = {0}, buf = {0}; MYSQL_RES *res; diff --git a/indimail-x/sql_get_realdomain.h b/indimail-x/sql_get_realdomain.h index fc5e84282..98b14c8cd 100644 --- a/indimail-x/sql_get_realdomain.h +++ b/indimail-x/sql_get_realdomain.h @@ -10,7 +10,7 @@ #include "config.h" #endif -char *sql_get_realdomain(char *); +char *sql_get_realdomain(const char *); #ifdef QUERY_CACHE void sql_get_realdomain_cache(char); #endif diff --git a/indimail-x/sql_getall.c b/indimail-x/sql_getall.c index dfd03dd39..d97466dab 100644 --- a/indimail-x/sql_getall.c +++ b/indimail-x/sql_getall.c @@ -49,7 +49,7 @@ die_nomem() } struct passwd * -sql_getall(char *domain, int first, int sortit) +sql_getall(const char *domain, int first, int sortit) { char *domstr; static int more, flag; diff --git a/indimail-x/sql_getall.h b/indimail-x/sql_getall.h index a06078853..dc359f793 100644 --- a/indimail-x/sql_getall.h +++ b/indimail-x/sql_getall.h @@ -7,6 +7,6 @@ #ifndef SQL_GETALL_H #define SQL_GETALL_H -struct passwd *sql_getall(char *, int, int); +struct passwd *sql_getall(const char *, int, int); #endif diff --git a/indimail-x/sql_gethostid.c b/indimail-x/sql_gethostid.c index 91bfc7e02..8e43aafed 100644 --- a/indimail-x/sql_gethostid.c +++ b/indimail-x/sql_gethostid.c @@ -35,10 +35,10 @@ die_nomem() } char * -sql_gethostid(char *ipaddr) +sql_gethostid(const char *ipaddr) { static stralloc hostid = {0}, SqlBuf = {0}; - char *ptr; + const char *ptr; MYSQL_RES *res; MYSQL_ROW row; diff --git a/indimail-x/sql_gethostid.h b/indimail-x/sql_gethostid.h index beb642bd0..e13a95477 100644 --- a/indimail-x/sql_gethostid.h +++ b/indimail-x/sql_gethostid.h @@ -7,6 +7,6 @@ #ifndef SQL_HOSTID_H #define SQL_HOSTID_H -char *sql_gethostid(char *); +char *sql_gethostid(const char *); #endif diff --git a/indimail-x/sql_getpw.c b/indimail-x/sql_getpw.c index 38cf5821c..3ed76be65 100644 --- a/indimail-x/sql_getpw.c +++ b/indimail-x/sql_getpw.c @@ -42,7 +42,7 @@ die_nomem() } static int -do_sql(stralloc *user, char *domain, char *table, MYSQL_RES **res) +do_sql(stralloc *user, const char *domain, const char *table, MYSQL_RES **res) { static stralloc SqlBuf = {0}; int err; @@ -76,9 +76,10 @@ do_sql(stralloc *user, char *domain, char *table, MYSQL_RES **res) } struct passwd * -sql_getpw(char *user, char *domain) +sql_getpw(const char *user, const char *domain) { - char *domstr, *pwstruct, *real_domain, *ptr; + char *domstr, *pwstruct, *ptr; + const char *real_domain; int row_count; MYSQL_RES *res = (MYSQL_RES *) NULL; MYSQL_ROW row; diff --git a/indimail-x/sql_getpw.h b/indimail-x/sql_getpw.h index 72fa5884b..aaaa05ed0 100644 --- a/indimail-x/sql_getpw.h +++ b/indimail-x/sql_getpw.h @@ -13,7 +13,7 @@ #include #endif -struct passwd *sql_getpw(char *, char *); +struct passwd *sql_getpw(const char *, const char *); #ifdef QUERY_CACHE void sql_getpw_cache(char); #endif diff --git a/indimail-x/sql_insertaliasdomain.c b/indimail-x/sql_insertaliasdomain.c index 87cf81df8..5c4f6d871 100644 --- a/indimail-x/sql_insertaliasdomain.c +++ b/indimail-x/sql_insertaliasdomain.c @@ -37,7 +37,7 @@ die_nomem() } int -sql_insertaliasdomain(char *old_domain, char *new_domain) +sql_insertaliasdomain(const char *old_domain, const char *new_domain) { #ifdef CLUSTERED_SITE int err; diff --git a/indimail-x/sql_insertaliasdomain.h b/indimail-x/sql_insertaliasdomain.h index b250816d0..517d1b431 100644 --- a/indimail-x/sql_insertaliasdomain.h +++ b/indimail-x/sql_insertaliasdomain.h @@ -11,7 +11,7 @@ #endif #ifdef CLUSTERED_SITE -int sql_insertaliasdomain(char *, char *); +int sql_insertaliasdomain(const char *, const char *); #endif #endif diff --git a/indimail-x/sql_passwd.c b/indimail-x/sql_passwd.c index 7d381df18..b89e19f45 100644 --- a/indimail-x/sql_passwd.c +++ b/indimail-x/sql_passwd.c @@ -44,7 +44,7 @@ die_nomem() } static int -do_sql(char *user, char *domain, char *pass, char *scram, char *table) +do_sql(const char *user, const char *domain, const char *pass, const char *scram, const char *table) { static stralloc SqlBuf = {0}; @@ -84,7 +84,7 @@ do_sql(char *user, char *domain, char *pass, char *scram, char *table) } int -sql_passwd(char *user, char *domain, char *pass, char *scram) +sql_passwd(const char *user, const char *domain, const char *pass, const char *scram) { char *tmpstr; char strnum1[FMT_ULONG], strnum2[FMT_ULONG]; diff --git a/indimail-x/sql_passwd.h b/indimail-x/sql_passwd.h index 0d6bc6733..c062e98e8 100644 --- a/indimail-x/sql_passwd.h +++ b/indimail-x/sql_passwd.h @@ -10,6 +10,6 @@ #ifndef SQL_PASSWD_H #define SQL_PASSWD_H -int sql_passwd(char *, char *, char *, char *); +int sql_passwd(const char *, const char *, const char *, const char *); #endif diff --git a/indimail-x/sql_setpw.c b/indimail-x/sql_setpw.c index 144936a98..44007d728 100644 --- a/indimail-x/sql_setpw.c +++ b/indimail-x/sql_setpw.c @@ -42,7 +42,7 @@ die_nomem() } static int -do_sql(struct passwd *inpw, char *domain, char *scram, char *table) +do_sql(struct passwd *inpw, const char *domain, const char *scram, const char *table) { static stralloc SqlBuf = {0}; char strnum1[FMT_ULONG]; @@ -93,7 +93,7 @@ do_sql(struct passwd *inpw, char *domain, char *scram, char *table) } int -sql_setpw(struct passwd *inpw, char *domain, char *scram) +sql_setpw(struct passwd *inpw, const char *domain, const char *scram) { char strnum1[FMT_ULONG], strnum2[FMT_ULONG]; struct passwd *pw, *t; diff --git a/indimail-x/sql_setpw.h b/indimail-x/sql_setpw.h index 9346ae66a..cba5fd44b 100644 --- a/indimail-x/sql_setpw.h +++ b/indimail-x/sql_setpw.h @@ -16,6 +16,6 @@ #include #endif -int sql_setpw(struct passwd *, char *, char *); +int sql_setpw(struct passwd *, const char *, const char *); #endif diff --git a/indimail-x/sql_setquota.c b/indimail-x/sql_setquota.c index 0ef7a36d7..367b772f6 100644 --- a/indimail-x/sql_setquota.c +++ b/indimail-x/sql_setquota.c @@ -39,7 +39,7 @@ die_nomem() } static int -do_sql(char *user, char *domain, char *quota, char *table) +do_sql(const char *user, const char *domain, const char *quota, const char *table) { static stralloc SqlBuf = {0}; @@ -66,7 +66,7 @@ do_sql(char *user, char *domain, char *quota, char *table) } int -sql_setquota(char *user, char *domain, char *quota) +sql_setquota(const char *user, const char *domain, const char *quota) { char *tmpstr; unsigned long q1, q2; diff --git a/indimail-x/sql_setquota.h b/indimail-x/sql_setquota.h index e74e94361..f06cbbe56 100644 --- a/indimail-x/sql_setquota.h +++ b/indimail-x/sql_setquota.h @@ -7,6 +7,6 @@ #ifndef SQL_SETQUOTA_H #define SQL_SETQUOTA_H -int sql_setquota(char *, char *, char *); +int sql_setquota(const char *, const char *, const char *); #endif /*- SQL_SETQUOTA_H */ diff --git a/indimail-x/sql_updateflag.c b/indimail-x/sql_updateflag.c index ae6f3d68a..659b123d8 100644 --- a/indimail-x/sql_updateflag.c +++ b/indimail-x/sql_updateflag.c @@ -34,7 +34,7 @@ die_nomem() } static int -do_sql(char *user, char *domain, int flag, char *table) +do_sql(const char *user, const char *domain, int flag, const char *table) { static stralloc SqlBuf = {0}; char strnum[FMT_ULONG]; @@ -71,7 +71,7 @@ do_sql(char *user, char *domain, int flag, char *table) } int -sql_updateflag(char *user, char *domain, int flag) +sql_updateflag(const char *user, const char *domain, int flag) { int err; diff --git a/indimail-x/sql_updateflag.h b/indimail-x/sql_updateflag.h index 588ab9d42..eafe7555a 100644 --- a/indimail-x/sql_updateflag.h +++ b/indimail-x/sql_updateflag.h @@ -7,6 +7,6 @@ #ifndef SQL_UPDATEFLAG_H #define SQL_UPDATEFLAG_H -int sql_updateflag(char *, char *, int); +int sql_updateflag(const char *, const char *, int); #endif diff --git a/indimail-x/update_file.c b/indimail-x/update_file.c index 616e59608..05d34e3f3 100644 --- a/indimail-x/update_file.c +++ b/indimail-x/update_file.c @@ -51,7 +51,7 @@ die_nomem() } int -update_file(char *filename, char *update_line, mode_t mode) +update_file(const char *filename, const char *update_line, mode_t mode) { struct substdio ssin, ssout; int fd1, fd2, i, found = 0, user_assign = 0, match; diff --git a/indimail-x/update_file.h b/indimail-x/update_file.h index 97ff95033..d1ec62b9b 100644 --- a/indimail-x/update_file.h +++ b/indimail-x/update_file.h @@ -13,6 +13,6 @@ #include #endif -int update_file(char *, char *, mode_t); +int update_file(const char *, const char *, mode_t); #endif diff --git a/indimail-x/userinfo.c b/indimail-x/userinfo.c index db02b26a5..5cd6fbc7e 100644 --- a/indimail-x/userinfo.c +++ b/indimail-x/userinfo.c @@ -84,8 +84,8 @@ userinfo(Email, User, Domain, DisplayName, DisplayPasswd, DisplayUid, DisplayLastAuth, DisplayFilter, DisplayAll; { struct passwd *mypw; - char *ptr, *real_domain, *mailstore, *sysconfdir, *controldir, - *passwd_hash = "unknown"; + char *ptr, *mailstore, *sysconfdir, *controldir; + const char *real_domain, *passwd_hash = "unknown"; MYSQL *mptr; #ifdef CLUSTERED_SITE int is_dist = 0; diff --git a/indimail-x/vacation.c b/indimail-x/vacation.c index 210e199ab..15729acb7 100644 --- a/indimail-x/vacation.c +++ b/indimail-x/vacation.c @@ -83,9 +83,16 @@ static stralloc tmpbuf = {0}; int get_options(int argc, char **argv, char **email, char **vacation_file) { + char *ptr; + *email = *vacation_file = 0; - if (optind < argc) + if (optind < argc) { + for (ptr = argv[optind]; *ptr; ptr++) { + if (isupper(*ptr)) + strerr_die4x(100, WARN, "email [", argv[optind], "] has an uppercase character"); + } *email = argv[optind++]; + } if (optind < argc) *vacation_file = argv[optind++]; if (!*email || !*vacation_file) @@ -103,7 +110,7 @@ die_nomem() int getuserinfo(char *username, stralloc *homedir, stralloc *user, stralloc *domain) { - char *real_domain; + const char *real_domain; struct passwd *mypw; parse_email(username, user, domain); diff --git a/indimail-x/vaddaliasdomain.c b/indimail-x/vaddaliasdomain.c index c704e5c70..b19748bbb 100644 --- a/indimail-x/vaddaliasdomain.c +++ b/indimail-x/vaddaliasdomain.c @@ -25,6 +25,9 @@ #ifdef HAVE_PWD_H #include #endif +#ifdef HAVE_CTYPE_H +#include +#endif #ifdef HAVE_QMAIL #include #include @@ -59,6 +62,7 @@ int get_options(int argc, char **argv, char **domain_new, char **domain_old) { int c; + char *ptr; *domain_old = *domain_new = 0; while ((c = getopt(argc, argv, "v")) != opteof) { @@ -80,6 +84,16 @@ get_options(int argc, char **argv, char **domain_new, char **domain_old) strerr_warn2(WARN, usage, 0); return (100); } + for (ptr = *domain_old; *ptr; ptr++) { + if (isupper((int) *ptr)) { + strerr_die4x(100, WARN, "domain [", *domain_old, "] has an uppercase character"); + } + } + for (ptr = *domain_new; *ptr; ptr++) { + if (isupper((int) *ptr)) { + strerr_die4x(100, WARN, "domain [", *domain_new, "] has an uppercase character"); + } + } return (0); } diff --git a/indimail-x/vadddomain.c b/indimail-x/vadddomain.c index 6981b8f37..c25db342a 100644 --- a/indimail-x/vadddomain.c +++ b/indimail-x/vadddomain.c @@ -22,6 +22,9 @@ #ifdef HAVE_PWD_H #include #endif +#ifdef HAVE_CTYPE_H +#include +#endif #ifdef HAVE_QMAIL #include #include @@ -153,6 +156,7 @@ get_options(int argc, char **argv, char **base_path, char **dir_t, char **passwd int c, i, r; struct passwd *mypw; char optstr[51]; + char *ptr; Uid = indimailuid; Gid = indimailgid; @@ -348,8 +352,13 @@ get_options(int argc, char **argv, char **base_path, char **dir_t, char **passwd strerr_die2x(100, WARN, usage); } } - if (optind < argc) + if (optind < argc) { + for (ptr = argv[optind]; *ptr; ptr++) { + if (isupper(*ptr)) + strerr_die4x(100, WARN, "domain [", argv[optind], "] has an uppercase character"); + } *domain = argv[optind++]; + } if (optind < argc) *passwd = argv[optind++]; if (!*domain) diff --git a/indimail-x/vadduser.c b/indimail-x/vadduser.c index 64796c000..58d629699 100644 --- a/indimail-x/vadduser.c +++ b/indimail-x/vadduser.c @@ -21,6 +21,9 @@ #ifdef HAVE_ERRNO_H #include #endif +#ifdef HAVE_CTYPE_H +#include +#endif #ifdef HAVE_QMAIL #include #include @@ -127,7 +130,8 @@ main(int argc, char **argv) int i, j, random, users_per_level = 0, fd, match, encrypt_flag, docram; mdir_t q, c; - char *real_domain, *ptr, *base_argv0, *base_path, *domain_dir; + const char *real_domain; + char *ptr, *base_argv0, *base_path, *domain_dir; static stralloc tmpbuf = {0}, quotaVal = {0}, line = {0}, result = {0}; char strnum1[FMT_ULONG], strnum2[FMT_ULONG], inbuf[512]; uid_t uid, uidtmp; @@ -392,6 +396,7 @@ get_options(int argc, char **argv, char **base_path, int *users_per_level, char **salt) { int c, i, r; + char *ptr; char strnum[FMT_ULONG], optstr[30]; Email.len = Passwd.len = Domain.len = Quota.len = 0; @@ -544,6 +549,10 @@ get_options(int argc, char **argv, char **base_path, int *users_per_level, } if (optind < argc) { + for (ptr = argv[optind]; *ptr; ptr++) { + if (isupper(*ptr)) + strerr_die4x(100, WARN, "email [", argv[optind], "] has an uppercase character"); + } if (!stralloc_copys(&Email, argv[optind++]) || !stralloc_0(&Email)) die_nomem(); Email.len--; diff --git a/indimail-x/valiasCount.c b/indimail-x/valiasCount.c index 2131a5e38..e7cfbc8b9 100644 --- a/indimail-x/valiasCount.c +++ b/indimail-x/valiasCount.c @@ -36,10 +36,10 @@ die_nomem() } long -valiasCount(char *alias, char *domain) +valiasCount(const char *alias, const char *domain) { static stralloc SqlBuf = {0}; - char *real_domain; + const char *real_domain; unsigned long row_count; MYSQL_ROW row; MYSQL_RES *select_res; diff --git a/indimail-x/valiasCount.h b/indimail-x/valiasCount.h index 0f35ad7d3..298ec09a2 100644 --- a/indimail-x/valiasCount.h +++ b/indimail-x/valiasCount.h @@ -11,7 +11,7 @@ #endif #ifdef VALIAS -long valiasCount(char *, char *); +long valiasCount(const char *, const char *); #endif #endif diff --git a/indimail-x/valias_delete.c b/indimail-x/valias_delete.c index b66942f83..be0b22251 100644 --- a/indimail-x/valias_delete.c +++ b/indimail-x/valias_delete.c @@ -42,11 +42,11 @@ die_nomem() } int -valias_delete(char *alias, char *domain, char *alias_line) +valias_delete(const char *alias, const char *domain, const char *alias_line) { int err; static stralloc SqlBuf = {0}; - char *real_domain; + const char *real_domain; if (!domain || !*domain) return (1); diff --git a/indimail-x/valias_delete.h b/indimail-x/valias_delete.h index abafc6002..4bfaa90a8 100644 --- a/indimail-x/valias_delete.h +++ b/indimail-x/valias_delete.h @@ -11,7 +11,7 @@ #endif #ifdef VALIAS -int valias_delete(char *, char *, char *); +int valias_delete(const char *, const char *, const char *); #endif #endif diff --git a/indimail-x/valias_delete_domain.c b/indimail-x/valias_delete_domain.c index fa7641997..2f7a142ca 100644 --- a/indimail-x/valias_delete_domain.c +++ b/indimail-x/valias_delete_domain.c @@ -37,7 +37,7 @@ die_nomem() } int -valias_delete_domain(char *domain) +valias_delete_domain(const char *domain) { int err; static stralloc SqlBuf = {0}; diff --git a/indimail-x/valias_delete_domain.h b/indimail-x/valias_delete_domain.h index 33de27859..aac6060a4 100644 --- a/indimail-x/valias_delete_domain.h +++ b/indimail-x/valias_delete_domain.h @@ -7,6 +7,6 @@ #ifndef VALIAS_DELETE_DOMAIN_H #define VALIAS_DELETE_DOMAIN_H -int valias_delete_domain(char *); +int valias_delete_domain(const char *); #endif diff --git a/indimail-x/valias_insert.c b/indimail-x/valias_insert.c index 527ea00ae..18428c2b6 100644 --- a/indimail-x/valias_insert.c +++ b/indimail-x/valias_insert.c @@ -49,11 +49,11 @@ die_nomem() } int -valias_insert(char *alias, char *domain, char *alias_line, int ignore) +valias_insert(const char *alias, const char *domain, const char *alias_line, int ignore) { int err, i; static stralloc SqlBuf = {0}; - char *real_domain; + const char *real_domain; #ifdef CLUSTERED_SITE char *mailstore, *ptr; static stralloc emailid = {0}; diff --git a/indimail-x/valias_insert.h b/indimail-x/valias_insert.h index 5d6d212bf..a00740c4d 100644 --- a/indimail-x/valias_insert.h +++ b/indimail-x/valias_insert.h @@ -7,6 +7,6 @@ #ifndef VALIAS_INSERT_H #define VALIAS_INSERT_H -int valias_insert(char *, char *, char *, int); +int valias_insert(const char *, const char *, const char *, int); #endif /*- VALIAS_INSERT_H */ diff --git a/indimail-x/valias_select.c b/indimail-x/valias_select.c index 59773f629..728c51c61 100644 --- a/indimail-x/valias_select.c +++ b/indimail-x/valias_select.c @@ -37,9 +37,9 @@ die_nomem() } char * -valias_select(char *alias, char *domain) +valias_select(const char *alias, const char *domain) { - char *real_domain; + const char *real_domain; MYSQL_ROW row; static MYSQL_RES *select_res; @@ -76,7 +76,7 @@ valias_select(char *alias, char *domain) } int -valias_track(char *valias_line, stralloc *alias, stralloc *domain) +valias_track(const char *valias_line, stralloc *alias, stralloc *domain) { int err; MYSQL_ROW row; @@ -124,7 +124,7 @@ valias_select_all(stralloc *alias, stralloc *domain) { int err; static stralloc SqlBuf = {0}; - char *real_domain; + const char *real_domain; MYSQL_ROW row; static MYSQL_RES *res; diff --git a/indimail-x/valias_select.h b/indimail-x/valias_select.h index 416b7a5eb..536fb9426 100644 --- a/indimail-x/valias_select.h +++ b/indimail-x/valias_select.h @@ -13,8 +13,8 @@ #include #endif -char *valias_select(char *, char *); -int valias_track(char*, stralloc *, stralloc *); +char *valias_select(const char *, const char *); +int valias_track(const char*, stralloc *, stralloc *); char *valias_select_all(stralloc *, stralloc *); #endif diff --git a/indimail-x/valias_update.c b/indimail-x/valias_update.c index fef6af01a..a2a425f8a 100644 --- a/indimail-x/valias_update.c +++ b/indimail-x/valias_update.c @@ -43,10 +43,10 @@ die_nomem() } int -valias_update(char *alias, char *domain, char *old_alias_line, char *alias_line) +valias_update(const char *alias, const char *domain, const char *old_alias_line, const char *alias_line) { int err; - char *real_domain; + const char *real_domain; static stralloc SqlBuf = {0}; if (!domain || !*domain) diff --git a/indimail-x/valias_update.h b/indimail-x/valias_update.h index ef2ce6523..5c7a635f2 100644 --- a/indimail-x/valias_update.h +++ b/indimail-x/valias_update.h @@ -7,6 +7,6 @@ #ifndef VALIAS_UPDATE_H #define VALIAS_UPDATE_H -int valias_update(char *, char *, char *, char *); +int valias_update(const char *, const char *, const char *, const char *); #endif diff --git a/indimail-x/valiasinfo.c b/indimail-x/valiasinfo.c index c1b0f877f..46abe7334 100644 --- a/indimail-x/valiasinfo.c +++ b/indimail-x/valiasinfo.c @@ -63,7 +63,7 @@ die_nomem() } int -valiasinfo(char *user, char *domain) +valiasinfo(const char *user, const char *domain) { int flag1, fd, match; static stralloc tmpbuf = {0}, Dir = {0}, line = {0}; diff --git a/indimail-x/valiasinfo.h b/indimail-x/valiasinfo.h index 8122ef14c..f7f6ff375 100644 --- a/indimail-x/valiasinfo.h +++ b/indimail-x/valiasinfo.h @@ -7,6 +7,6 @@ #ifndef VALIASINFO_H #define VALIASINFO_H -int valiasinfo(char *, char *); +int valiasinfo(const char *, const char *); #endif diff --git a/indimail-x/vbulletin.c b/indimail-x/vbulletin.c index 7b9f10a1f..fadf9272c 100644 --- a/indimail-x/vbulletin.c +++ b/indimail-x/vbulletin.c @@ -113,6 +113,7 @@ static int get_options(int argc, char **argv, char **email, char **domain, char **emailFile, char **excludeFile, char **subscriberList) { int c, i; + char *ptr; *email = *domain = *emailFile = *excludeFile = *subscriberList = 0; verbose = 0; @@ -185,10 +186,19 @@ get_options(int argc, char **argv, char **email, char **domain, char **emailFile if (optind < argc) { i = str_chr(argv[optind], '@'); if (argv[optind][i]) { + for (ptr = argv[optind]; *ptr; ptr++) { + if (isupper(*ptr)) + strerr_die4x(100, WARN, "email [", argv[optind], "] has an uppercase character"); + } DeliveryMethod = USER_BULLETIN; *email = argv[optind++]; - } else + } else { + for (ptr = argv[optind]; *ptr; ptr++) { + if (isupper(*ptr)) + strerr_die4x(100, WARN, "domain [", argv[optind], "] has an uppercase character"); + } *domain = argv[optind++]; + } } if (DeliveryMethod == BULK_BULLETIN || DeliveryMethod == DOMAIN_BULLETIN) { if (*excludeFile || *email) { @@ -397,7 +407,8 @@ static int spost(char *EmailOrDomain, int method, char *emailFile, int bulk) { static stralloc bulkdir = {0}, User = {0}, Domain = {0}; - char *ptr, *domain = 0; + char *ptr; + const char *domain = NULL; int i, copy_method; uid_t uid; gid_t gid; diff --git a/indimail-x/vcfilter.c b/indimail-x/vcfilter.c index a344b402b..c537fd1ab 100644 --- a/indimail-x/vcfilter.c +++ b/indimail-x/vcfilter.c @@ -16,6 +16,9 @@ static char sccsid[] = "$Id: vcfilter.c,v 1.7 2023-09-06 18:47:05+05:30 Cpro #ifdef HAVE_UNISTD_H #include #endif +#ifdef HAVE_CTYPE_H +#include +#endif #ifdef HAVE_QMAIL #include #include @@ -269,8 +272,13 @@ get_options(int argc, char **argv, char **email, stralloc *faddr, usage(); return (1); } - if (optind < argc) + if (optind < argc) { + for (ptr = argv[optind]; *ptr; ptr++) { + if (isupper(*ptr)) + strerr_die4x(100, WARN, "email [", argv[optind], "] has an uppercase character"); + } *email = argv[optind++]; + } if (!*email) { strerr_warn1("vcfilter: must supply emailid", 0); usage(); @@ -340,7 +348,8 @@ main(int argc, char **argv) uid_t uid, uidtmp; gid_t gid, gidtmp; struct passwd *pw; - char *real_domain, *emailid, *filter_name, *keyword; + const char *real_domain; + char *emailid, *filter_name, *keyword; char strnum1[FMT_ULONG], strnum2[FMT_ULONG]; static stralloc user = {0}, domain = {0}, folder = {0}, vfilter_file = {0}, faddr = {0}; diff --git a/indimail-x/vcreate_dir_control.c b/indimail-x/vcreate_dir_control.c index ef96ca580..15b38b390 100644 --- a/indimail-x/vcreate_dir_control.c +++ b/indimail-x/vcreate_dir_control.c @@ -37,13 +37,13 @@ die_nomem() } int -vcreate_dir_control(char *filename, char *domain) +vcreate_dir_control(const char *filename, const char *domain) { static stralloc SqlBuf = {0}, tmpbuf = {0}; char strnum[FMT_ULONG]; uid_t uid; gid_t gid; - char *ptr = (char *) 0; + const char *ptr = (char *) 0; if (domain && *domain && !(ptr = get_assign(domain, 0, &uid, &gid))) { strerr_warn2(domain, ": No such domain", 0); diff --git a/indimail-x/vdel_dir_control.c b/indimail-x/vdel_dir_control.c index eb3cbe74f..d59f65bc5 100644 --- a/indimail-x/vdel_dir_control.c +++ b/indimail-x/vdel_dir_control.c @@ -40,10 +40,10 @@ die_nomem() } int -vdel_dir_control(char *domain) +vdel_dir_control(const char *domain) { int err, fd, match; - char *ptr; + const char *ptr; static stralloc SqlBuf = {0}, tmpbuf = {0}, line = {0}; struct substdio ssin; char inbuf[512]; diff --git a/indimail-x/vdeldomain.c b/indimail-x/vdeldomain.c index 8648f79a3..56769bfbb 100644 --- a/indimail-x/vdeldomain.c +++ b/indimail-x/vdeldomain.c @@ -40,6 +40,9 @@ #ifdef HAVE_SYS_SOCKET_H #include #endif +#ifdef HAVE_CTYPE_H +#include +#endif #ifdef HAVE_QMAIL #include #include @@ -89,6 +92,7 @@ int get_options(int argc, char **argv, stralloc *Domain, int *mcd_remove) { int c; + char *ptr; while ((c = getopt(argc, argv, "cTv")) != opteof) { switch (c) @@ -108,6 +112,10 @@ get_options(int argc, char **argv, stralloc *Domain, int *mcd_remove) } } if (optind < argc) { + for (ptr = argv[optind]; *ptr; ptr++) { + if (isupper(*ptr)) + strerr_die4x(100, WARN, "domain [", argv[optind], "] has an uppercase character"); + } if (!stralloc_copys(Domain, argv[optind]) || !stralloc_0(Domain)) die_nomem(); diff --git a/indimail-x/vdelfiles.c b/indimail-x/vdelfiles.c index 13688bb22..a086f2014 100644 --- a/indimail-x/vdelfiles.c +++ b/indimail-x/vdelfiles.c @@ -47,7 +47,7 @@ static char sccsid[] = "$Id: vdelfiles.c,v 1.3 2023-01-22 10:40:03+05:30 Cpr * -1 on failer */ int -vdelfiles(char *dir, char *user, char *domain) +vdelfiles(const char *dir, const char *user, const char *domain) { DIR *entry; struct dirent *dp; diff --git a/indimail-x/vdelfiles.h b/indimail-x/vdelfiles.h index 4a9d90e1f..56175c8fc 100644 --- a/indimail-x/vdelfiles.h +++ b/indimail-x/vdelfiles.h @@ -7,6 +7,6 @@ #ifndef VDELFILES_h #define VDELFILES_h -int vdelfiles(char *, char *, char *); +int vdelfiles(const char *, const char *, const char *); #endif diff --git a/indimail-x/vdelivermail.c b/indimail-x/vdelivermail.c index 82012bd85..69973b1c0 100644 --- a/indimail-x/vdelivermail.c +++ b/indimail-x/vdelivermail.c @@ -165,7 +165,7 @@ get_arguments(int argc, char **argv, char **user, char **domain, char **user_ext *user_ext = _user_ext.s; } #endif - if (!(tmpstr = get_real_domain(*domain))) { + if (!(tmpstr = (char *) get_real_domain(*domain))) { strerr_warn3("vdelivermail: ", "No such domain ", *domain, 0); if (userNotFound) vdl_exit(100); diff --git a/indimail-x/vdeloldusers.c b/indimail-x/vdeloldusers.c index b1e9f89b0..30065ed8b 100644 --- a/indimail-x/vdeloldusers.c +++ b/indimail-x/vdeloldusers.c @@ -40,6 +40,9 @@ static char sccsid[] = "$Id: vdeloldusers.c,v 1.6 2023-01-22 10:40:03+05:30 #ifdef HAVE_SYS_STAT_H #include #endif +#ifdef HAVE_CTYPE_H +#include +#endif #ifdef HAVE_QMAIL #include #include @@ -121,6 +124,10 @@ get_options(int argc, char **argv, char **Domain, int *Age, int *mailAge, switch (c) { case 'd': + for (ptr = optarg; *ptr; ptr++) { + if (isupper(*ptr)) + strerr_die4x(100, WARN, "domain [", optarg, "] has an uppercase character"); + } *Domain = optarg; break; case 's': diff --git a/indimail-x/vdeluser.c b/indimail-x/vdeluser.c index be8d309aa..7eed5e223 100644 --- a/indimail-x/vdeluser.c +++ b/indimail-x/vdeluser.c @@ -31,6 +31,9 @@ #ifdef HAVE_SYS_STAT_H #include #endif +#ifdef HAVE_CTYPE_H +#include +#endif #ifdef HAVE_QMAIL #include #include @@ -71,6 +74,7 @@ int get_options(int argc, char **argv, stralloc *email) { int c; + char *ptr; while ((c = getopt(argc, argv, "v")) != opteof) { switch (c) @@ -85,6 +89,10 @@ get_options(int argc, char **argv, stralloc *email) } if (optind < argc) { + for (ptr = argv[optind]; *ptr; ptr++) { + if (isupper(*ptr)) + strerr_die4x(100, WARN, "email [", argv[optind], "] has an uppercase character"); + } if (!stralloc_copys(email, argv[optind++]) || !stralloc_0(email)) die_nomem(); diff --git a/indimail-x/vdominfo.c b/indimail-x/vdominfo.c index 39e5b9d06..d74305a7f 100644 --- a/indimail-x/vdominfo.c +++ b/indimail-x/vdominfo.c @@ -118,6 +118,7 @@ get_options(int argc, char **argv, int *DisplayName, int *DisplayUid, int *Displ { int c; extern int optind; + char *ptr; *DisplayName = *DisplayUid = *DisplayGid = *DisplayDir = *DisplayBaseDir = *DisplayTotalUsers = *DisplayAliasDomains = 0; @@ -172,6 +173,10 @@ get_options(int argc, char **argv, int *DisplayName, int *DisplayUid, int *Displ } } if (optind < argc) { + for (ptr = argv[optind]; *ptr; ptr++) { + if (isupper(*ptr)) + strerr_die4x(100, WARN, "domain [", argv[optind], "] has an uppercase character"); + } if (!stralloc_copys(Domain, argv[optind++]) || !stralloc_0(Domain)) die_nomem(); @@ -193,7 +198,8 @@ display_domain(char *domain, char *dir, uid_t uid, gid_t gid, int DisplayName, int DisplayTotalUsers, int DisplayAliasDomains) #endif { - char *real_domain, *base_path; + const char *real_domain; + char *base_path; char inbuf[512]; struct substdio ssin; unsigned long total; diff --git a/indimail-x/vfilter.c b/indimail-x/vfilter.c index c1bfaab2d..2d9e24a12 100644 --- a/indimail-x/vfilter.c +++ b/indimail-x/vfilter.c @@ -232,7 +232,8 @@ static int get_options(int argc, char **argv, char **bounce, stralloc *emailid, stralloc *user, stralloc *domain, stralloc *Maildir) { int c, local; - char *tmpstr, *real_domain = 0; + char *tmpstr; + const char *real_domain = 0; static stralloc pwstruct = {0}; struct passwd *pw; @@ -327,8 +328,7 @@ get_options(int argc, char **argv, char **bounce, stralloc *emailid, stralloc *u * */ interactive = 1; - while ((c = getopt(argc, argv, "v")) != opteof) - { + while ((c = getopt(argc, argv, "v")) != opteof) { switch (c) { case 'v': @@ -487,7 +487,8 @@ process_filter(int argc, char **argv, struct header **hptr, char *filterid, int { int i, j, email_len, filter_opt, ret = 0, global_filter = 0, max_header_value; - char *str, *real_domain; + char *str; + const char *real_domain; char **tmp_ptr; static char **header_list; struct header **ptr; @@ -643,8 +644,7 @@ process_filter(int argc, char **argv, struct header **hptr, char *filterid, int break; case 3: /*- Starts with */ for (tmp_ptr = (*ptr)->data; tmp_ptr && *tmp_ptr; tmp_ptr++) { - if (!str_diffn(*tmp_ptr, keyword->s, keyword->len)) - { + if (!str_diffn(*tmp_ptr, keyword->s, keyword->len)) { if (interactive && verbose) { subprintfe(subfdout, "vfilter", "Matched %s Filter No %d Data %s Keyword %s\n", global_filter ? "global" : "local", *filter_no, *tmp_ptr, keyword->s); diff --git a/indimail-x/vget_lastauth.c b/indimail-x/vget_lastauth.c index afb6c3f54..2e0bcd3be 100644 --- a/indimail-x/vget_lastauth.c +++ b/indimail-x/vget_lastauth.c @@ -45,7 +45,7 @@ die_nomem() } time_t -vget_lastauth(struct passwd *pw, char *domain, int type, char *ipaddr) +vget_lastauth(struct passwd *pw, const char *domain, int type, char *ipaddr) { int err, n; time_t tmval1, tmval2; diff --git a/indimail-x/vget_lastauth.h b/indimail-x/vget_lastauth.h index e33810880..6f6d0ef40 100644 --- a/indimail-x/vget_lastauth.h +++ b/indimail-x/vget_lastauth.h @@ -13,6 +13,6 @@ #include #endif -time_t vget_lastauth(struct passwd *, char *, int, char *); +time_t vget_lastauth(struct passwd *, const char *, int, char *); #endif diff --git a/indimail-x/vgroup.c b/indimail-x/vgroup.c index 9346eaa6b..05e8ec83c 100644 --- a/indimail-x/vgroup.c +++ b/indimail-x/vgroup.c @@ -14,6 +14,9 @@ static char sccsid[] = "$Id: vgroup.c,v 1.8 2023-07-17 12:28:44+05:30 Cprogr #ifdef HAVE_UNISTD_H #include #endif +#ifdef HAVE_CTYPE_H +#include +#endif #ifdef HAVE_QMAIL #include #include @@ -100,6 +103,7 @@ get_options(int argc, char **argv, int *option, char **group, char **gecos, { int c, i, r; char optstr[27], strnum[FMT_ULONG]; + char *ptr; *group = *gecos = *member = *old_member = *passwd = *hostid = *mdahost = *quota = 0; @@ -287,9 +291,13 @@ get_options(int argc, char **argv, int *option, char **group, char **gecos, return (1); } } - if (optind < argc) + if (optind < argc) { + for (ptr = argv[optind]; *ptr; ptr++) { + if (isupper(*ptr)) + strerr_die4x(100, WARN, "email [", argv[optind], "] has an uppercase character"); + } *group = argv[optind++]; - else { + } else { strerr_warn2(WARN, usage, 0); return (1); } @@ -320,8 +328,9 @@ die_nomem() } int -addGroup(char *user, char *domain, char *mdahost, char *gecos, - char *passwd, char *quota, int encrypt_flag, char *scram) +addGroup(const char *user, const char *domain, const char *mdahost, + const char *gecos, const char *passwd, const char *quota, + int encrypt_flag, const char *scram) { struct passwd *pw; static stralloc tmpbuf = {0}; @@ -346,7 +355,8 @@ main(int argc, char **argv) static stralloc User = {0}, Domain = {0}, alias_line = {0}, old_alias = {0}, quotaVal = {0}, result = {0}; char *group, *gecos, *member, *old_member, *passwd, *hostid, - *mdahost, *Quota, *real_domain, *ptr; + *mdahost, *Quota, *ptr; + const char *real_domain; char strnum[FMT_ULONG]; mdir_t q; int i, option, ignore = 0, ret = -1, encrypt_flag, random, docram; diff --git a/indimail-x/vlimits.h b/indimail-x/vlimits.h index 54649a723..acc4b2598 100644 --- a/indimail-x/vlimits.h +++ b/indimail-x/vlimits.h @@ -60,9 +60,9 @@ struct vlimits { short perm_defaultquota; }; -int vget_limits(char *, struct vlimits *); -int vdel_limits(char *); -int vset_limits(char *, struct vlimits *); +int vget_limits(const char *, struct vlimits *); +int vdel_limits(const char *); +int vset_limits(const char *, struct vlimits *); int vlimits_get_flag_mask(struct vlimits *); #endif diff --git a/indimail-x/vmake_maildir.c b/indimail-x/vmake_maildir.c index 68435d467..ef8cf382d 100644 --- a/indimail-x/vmake_maildir.c +++ b/indimail-x/vmake_maildir.c @@ -38,7 +38,7 @@ die_nomem() } int -vmake_maildir(char *dir, uid_t uid, gid_t gid, char *domain) +vmake_maildir(char *dir, uid_t uid, gid_t gid, const char *domain) { int i, fd; static stralloc tmp = {0}; diff --git a/indimail-x/vmake_maildir.h b/indimail-x/vmake_maildir.h index d32773a52..bbd1050ef 100644 --- a/indimail-x/vmake_maildir.h +++ b/indimail-x/vmake_maildir.h @@ -7,6 +7,6 @@ #ifndef VMAKE_MAILDIR_H #define VMAKE_MAILDIR_H -int vmake_maildir(char *, uid_t, gid_t, char *); +int vmake_maildir(char *, uid_t, gid_t, const char *); #endif diff --git a/indimail-x/vmoddomain.c b/indimail-x/vmoddomain.c index 28b9b92ac..e1b459656 100644 --- a/indimail-x/vmoddomain.c +++ b/indimail-x/vmoddomain.c @@ -29,6 +29,9 @@ #ifdef HAVE_FCNTL_H #include #endif +#ifdef HAVE_CTYPE_H +#include +#endif #ifdef HAVE_QMAIL #include #include @@ -94,6 +97,7 @@ get_options(int argc, char **argv, int *use_vfilter, int *domain_limits, char **handler, char **domain) { int c; + char *ptr; *use_vfilter = -1; *domain_limits = -1; @@ -123,9 +127,13 @@ get_options(int argc, char **argv, int *use_vfilter, int *domain_limits, usage(); return (1); } else - if (optind < argc) + if (optind < argc) { + for (ptr = argv[optind]; *ptr; ptr++) { + if (isupper(*ptr)) + strerr_die4x(100, WARN, "domain [", argv[optind], "] has an uppercase character"); + } *domain = argv[optind++]; - else { + } else { usage(); return (1); } diff --git a/indimail-x/vmoduser.c b/indimail-x/vmoduser.c index e88aefe09..497acbaef 100644 --- a/indimail-x/vmoduser.c +++ b/indimail-x/vmoduser.c @@ -14,6 +14,9 @@ #ifdef HAVE_PWD_H #include #endif +#ifdef HAVE_CTYPE_H +#include +#endif #ifdef HAVE_QMAIL #include #include @@ -127,6 +130,7 @@ get_options(int argc, char **argv, stralloc *User, stralloc *Email, char **salt, int *iter, int *scram, char **hash, int *eflag) { int c, i, r; + char *ptr; char optstr[56], strnum[FMT_ULONG]; *toggle = *ClearFlags = 0; @@ -319,6 +323,10 @@ get_options(int argc, char **argv, stralloc *User, stralloc *Email, } } if (optind < argc) { + for (ptr = argv[optind]; *ptr; ptr++) { + if (isupper(*ptr)) + strerr_die4x(100, WARN, "email [", argv[optind], "] has an uppercase character"); + } if (!stralloc_copys(Email, argv[optind++]) || !stralloc_0(Email)) die_nomem(); @@ -345,7 +353,8 @@ main(int argc, char **argv) gid_t gid, domaingid; struct passwd PwTmp; struct passwd *pw; - char *real_domain, *ptr, *clear_text, *hash; + const char *real_domain; + char *ptr, *clear_text, *hash; char strnum1[FMT_ULONG], strnum2[FMT_ULONG]; mdir_t quota = 0, ul; #ifdef USE_MAILDIRQUOTA diff --git a/indimail-x/vmoveuserdir.c b/indimail-x/vmoveuserdir.c index 1ce537cba..a140f0cd6 100644 --- a/indimail-x/vmoveuserdir.c +++ b/indimail-x/vmoveuserdir.c @@ -31,6 +31,9 @@ #ifdef HAVE_UNISTD_H #include #endif +#ifdef HAVE_CTYPE_H +#include +#endif #ifdef HAVE_QMAIL #include #include @@ -75,12 +78,11 @@ main(int argc, char **argv) { struct passwd *pw; struct passwd PwTmp; - char *tmpstr, *Domain, *NewDir, *User, *real_domain, *base_argv0; + char *tmpstr, *Domain, *NewDir, *User, *base_argv0; + const char *real_domain; char strnum1[FMT_ULONG], strnum2[FMT_ULONG]; static stralloc OldDir = {0}, Dir = {0}; -#if defined(CLUSTERED_SITE) || defined(VALIAS) char *ptr; -#endif #ifdef VALIAS static stralloc tmp_domain = {0}; #endif @@ -97,6 +99,10 @@ main(int argc, char **argv) strerr_warn1("usage: vmoveuserdir user new_dir", 0); return (1); } + for (ptr = argv[1]; *ptr; ptr++) { + if (isupper(*ptr)) + strerr_die4x(100, WARN, "email [", argv[1], "] has an uppercase character"); + } User = argv[1]; NewDir = argv[2]; i = str_chr(User, '@'); diff --git a/indimail-x/vpasswd.c b/indimail-x/vpasswd.c index a0e2b0229..f52b1c3f8 100644 --- a/indimail-x/vpasswd.c +++ b/indimail-x/vpasswd.c @@ -10,6 +10,9 @@ #ifdef HAVE_PWD_H #include #endif +#ifdef HAVE_CTYPE_H +#include +#endif #ifdef HAVE_QMAIL #include #include @@ -177,8 +180,13 @@ get_options(int argc, char **argv, char **email, char **clear_text, return (1); } } - if (optind < argc) + if (optind < argc) { + for (ptr = argv[optind]; *ptr; ptr++) { + if (isupper(*ptr)) + strerr_die4x(100, WARN, "email [", argv[optind], "] has an uppercase character"); + } *email = argv[optind++]; + } if (*email) { if (optind < argc) *clear_text = argv[optind++]; @@ -207,7 +215,8 @@ int main(int argc, char **argv) { int i, encrypt_flag, docram; - char *real_domain, *ptr, *email, *clear_text, *base_argv0; + const char *real_domain; + char *ptr, *email, *clear_text, *base_argv0; static stralloc user = {0}, domain = {0}, result = {0}; #ifdef HAVE_GSASL #if GSASL_VERSION_MAJOR == 1 && GSASL_VERSION_MINOR > 8 || GSASL_VERSION_MAJOR > 1 diff --git a/indimail-x/vread_dir_control.c b/indimail-x/vread_dir_control.c index 3aeb2702c..f719b4c9b 100644 --- a/indimail-x/vread_dir_control.c +++ b/indimail-x/vread_dir_control.c @@ -51,7 +51,7 @@ die_nomem() } int -vread_dir_control(char *filename, vdir_type *vdir, char *domain) +vread_dir_control(const char *filename, vdir_type *vdir, const char *domain) { int found = 0; static stralloc SqlBuf = {0}; diff --git a/indimail-x/vrenamedomain.c b/indimail-x/vrenamedomain.c index 6edd82d49..cf1370ae3 100644 --- a/indimail-x/vrenamedomain.c +++ b/indimail-x/vrenamedomain.c @@ -38,6 +38,9 @@ #ifdef HAVE_SYS_STAT_H #include #endif +#ifdef HAVE_CTYPE_H +#include +#endif #ifdef HAVE_QMAIL #include #include @@ -100,7 +103,8 @@ main(int argc, char **argv) int fd, i, match; static stralloc OldDir = {0}, NewDir = {0}, TmpDir = {0}, tmpbuf = {0}, line = {0}; - char *real_domain, *ptr, *tmpstr, *base_argv0; + const char *real_domain; + char *ptr, *tmpstr, *base_argv0; struct passwd *pw; struct stat statbuf; char inbuf[4096], outbuf[512], linkbuf[512], @@ -111,6 +115,16 @@ main(int argc, char **argv) strerr_warn1("USAGE: vrenamedomain old_domain_name new_domain_name", 0); return (1); } + for (ptr = argv[1]; *ptr; ptr++) { + if (isupper((int) *ptr)) { + strerr_die4x(100, WARN, "domain [", argv[1], "] has an uppercase character"); + } + } + for (ptr = argv[2]; *ptr; ptr++) { + if (isupper((int) *ptr)) { + strerr_die4x(100, WARN, "domain [", argv[2], "] has an uppercase character"); + } + } if (!get_assign(argv[1], &OldDir, &domainuid, &domaingid)) strerr_die3x(1, WARN, argv[1], ": domain does not exist"); if (!domainuid) diff --git a/indimail-x/vserverinfo.c b/indimail-x/vserverinfo.c index 02abfe94d..b649f6c08 100644 --- a/indimail-x/vserverinfo.c +++ b/indimail-x/vserverinfo.c @@ -16,6 +16,9 @@ #ifdef HAVE_UNISTD_H #include #endif +#ifdef HAVE_CTYPE_H +#include +#endif #ifdef HAVE_QMAIL #include #include @@ -39,11 +42,13 @@ static int display_user, display_passwd, display_database, display_port, display_server, display_mdahost, display_all; static int -get_options(int argc, char **argv, char **mdahost, char **server, char **domain, char **email) +get_options(int argc, char **argv, char **mdahost, char **server, const char **domain, char **email) { int c; + char *ptr; - *email = *mdahost = *server = *domain = (char *) 0; + *email = *mdahost = *server = NULL; + *domain = NULL; display_all = 0; display_user = display_passwd = display_server = display_mdahost = display_port = display_database = 0; while ((c = getopt(argc, argv, "vdsmupPD:M:S:a")) != opteof) { @@ -77,6 +82,10 @@ get_options(int argc, char **argv, char **mdahost, char **server, char **domain, display_database = 1; break; case 'D': + for (ptr = optarg; *ptr; ptr++) { + if (isupper(*ptr)) + strerr_die3x(100, "vserverinfo: domain [", optarg, "] has an uppercase character"); + } *domain = optarg; break; case 'M': @@ -97,9 +106,13 @@ get_options(int argc, char **argv, char **mdahost, char **server, char **domain, && !display_port && !display_database && !display_all) display_all = 1; if ((!*mdahost && !*server) || !*domain) { - if (optind < argc) + if (optind < argc) { + for (ptr = argv[optind]; *ptr; ptr++) { + if (isupper(*ptr)) + strerr_die3x(100, "vserverinfo: email [", argv[optind], "] has an uppercase character"); + } *email = argv[optind++]; - else { + } else { strerr_warn1("usage: vserserverinfo [-upPsmd] [-D domain -M host | -S server] | [email]", 0); return (1); } @@ -112,7 +125,8 @@ main(int argc, char **argv) { DBINFO **rhostsptr; int i, total, found; - char *mdahost, *server, *domain, *email, *mailstore, *real_domain; + char *mdahost, *server, *email, *mailstore; + const char *domain, *real_domain; static stralloc User = {0}, Domain = {0}; if (get_options(argc, argv, &mdahost, &server, &domain, &email)) diff --git a/indimail-x/vset_lastauth.c b/indimail-x/vset_lastauth.c index 6004b70c0..9d37fe82e 100644 --- a/indimail-x/vset_lastauth.c +++ b/indimail-x/vset_lastauth.c @@ -38,7 +38,8 @@ die_nomem() } int -vset_lastauth(char *user, char *domain, char *service, char *remoteip, char *gecos, int quota) +vset_lastauth(const char *user, const char *domain, const char *service, + const char *remoteip, const char *gecos, int quota) { int err, i, j; static stralloc SqlBuf = {0}; diff --git a/indimail-x/vset_lastauth.h b/indimail-x/vset_lastauth.h index 66701b990..f871fc84c 100644 --- a/indimail-x/vset_lastauth.h +++ b/indimail-x/vset_lastauth.h @@ -13,6 +13,6 @@ #include #endif -int vset_lastauth(char *, char *, char *, char *, char *, int); +int vset_lastauth(const char *, const char *, const char *, const char *, const char *, int); #endif diff --git a/indimail-x/vsetuserquota.c b/indimail-x/vsetuserquota.c index cbc8ad70e..13871abc1 100644 --- a/indimail-x/vsetuserquota.c +++ b/indimail-x/vsetuserquota.c @@ -22,6 +22,9 @@ #ifdef HAVE_SYS_TYPES_H #include #endif +#ifdef HAVE_CTYPE_H +#include +#endif #ifdef HAVE_QMAIL #include #include @@ -29,7 +32,6 @@ #include #endif #include "get_indimailuidgid.h" -#include "lowerit.h" #include "parse_email.h" #include "get_real_domain.h" #include "sqlOpen_user.h" @@ -60,6 +62,7 @@ int get_options(int argc, char **argv, char **email, char **quota) { int c; + char *ptr; *email = *quota = 0; while ((c = getopt(argc, argv, "v")) != opteof) { @@ -73,8 +76,13 @@ get_options(int argc, char **argv, char **email, char **quota) return (1); } } - if (optind < argc) + if (optind < argc) { + for (ptr = argv[optind]; *ptr; ptr++) { + if (isupper(*ptr)) + strerr_die4x(100, WARN, "email [", argv[optind], "] has an uppercase character"); + } *email = argv[optind++]; + } if (optind < argc) *quota = argv[optind++]; if (!*email || !*quota) { @@ -98,7 +106,7 @@ main(int argc, char **argv) uid_t uid; gid_t gid; char *email, *quota; - char *real_domain; + const char *real_domain; struct passwd *pw; static stralloc User = {0}, Domain = {0}; #ifdef ENABLE_DOMAIN_LIMITS @@ -117,7 +125,6 @@ main(int argc, char **argv) strerr_die1x(100, "you must be root or indimail to run this program"); if (uid && setuid(0)) strerr_die2sys(111, FATAL, "setuid: "); - lowerit(email); parse_email(email, &User, &Domain); if (!(real_domain = get_real_domain(Domain.s))) { strerr_warn2(Domain.s, ": No such domain", 0); diff --git a/indimail-x/vsmtp_delete_domain.c b/indimail-x/vsmtp_delete_domain.c index 6eb4f800b..ba253571b 100644 --- a/indimail-x/vsmtp_delete_domain.c +++ b/indimail-x/vsmtp_delete_domain.c @@ -34,7 +34,7 @@ die_nomem() } int -vsmtp_delete_domain(char *domain) +vsmtp_delete_domain(const char *domain) { static stralloc SqlBuf = {0}; diff --git a/indimail-x/vsmtp_delete_domain.h b/indimail-x/vsmtp_delete_domain.h index b86200358..1ca01eaab 100644 --- a/indimail-x/vsmtp_delete_domain.h +++ b/indimail-x/vsmtp_delete_domain.h @@ -7,6 +7,6 @@ #ifndef VSMTP_DELETE_DOMAIN_H #define VSMTP_DELETE_DOMAIN_H -int vsmtp_delete_domain(char *); +int vsmtp_delete_domain(const char *); #endif diff --git a/indimail-x/vwrite_dir_control.c b/indimail-x/vwrite_dir_control.c index 9cc4893f9..d79ed4960 100644 --- a/indimail-x/vwrite_dir_control.c +++ b/indimail-x/vwrite_dir_control.c @@ -44,13 +44,14 @@ die_nomem() } int -vwrite_dir_control(char *table_name, vdir_type *vdir, char *domain, uid_t dummy1, gid_t dummy2) +vwrite_dir_control(const char *table_name, vdir_type *vdir, + const char *domain, uid_t dummy1, gid_t dummy2) { static stralloc SqlBuf = {0}, tmpbuf = {0}; char strnum[FMT_ULONG]; uid_t uid = 0; gid_t gid = 0; - char *ptr = (char *) 0; + const char *ptr = (char *) 0; if (domain && *domain && !(ptr = get_assign(domain, 0, &uid, &gid))) { strerr_warn2(domain, ": No such domain", 0); diff --git a/iwebadmin-x/alias.c b/iwebadmin-x/alias.c index 5ddaa668c..161d2e8f3 100644 --- a/iwebadmin-x/alias.c +++ b/iwebadmin-x/alias.c @@ -60,7 +60,7 @@ #include "template.h" #include "common.h" -char *dotqmail_alias_command(char *command); +char *dotqmail_alias_command(const char *command); int show_aliases(void) @@ -85,7 +85,7 @@ struct aliasentry { struct aliasentry *firstalias = (struct aliasentry *) 0, *curalias = (struct aliasentry *) 0; void -add_alias_entry(char *alias_name, char *alias_command) +add_alias_entry(const char *alias_name, char *alias_command) { int len; @@ -132,7 +132,7 @@ int str_casecmpn(char *s1, char *s2, register int n) } void -show_dotqmail_lines(char *user, char *dom, time_t mytime) +show_dotqmail_lines(const char *user, const char *dom, time_t mytime) { int moreusers = 0, stop, i, k, startnumber, len, plen; unsigned int page; @@ -384,7 +384,7 @@ show_dotqmail_lines(char *user, char *dom, time_t mytime) * with the edit mode */ void -show_dotqmail_file(char *user) +show_dotqmail_file(const char *user) { static stralloc alias_user = {0}; char *alias_domain, *alias_name_from_command, *alias_line; @@ -795,7 +795,7 @@ deldotqmailnow() } char * -dotqmail_alias_command(char *line) +dotqmail_alias_command(const char *line) { int len, plen, i; static stralloc user = {0}, command = {0}, dot_qmail = {0}; diff --git a/iwebadmin-x/alias.h b/iwebadmin-x/alias.h index c3d2b4894..9a333cb24 100644 --- a/iwebadmin-x/alias.h +++ b/iwebadmin-x/alias.h @@ -1,5 +1,20 @@ /* * $Id: alias.h,v 1.2 2019-06-03 06:45:55+05:30 Cprogrammer Exp mbhangui $ + * Copyright (C) 1999-2004 Inter7 Internet Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifndef ALIAS_H_H #define ALIAS_H_H @@ -15,11 +30,11 @@ void adddotqmailnow(); int adddotqmail_shared(char *, stralloc *, int); void deldotqmail(); void deldotqmailnow(); -char *dotqmail_alias_command(char *); +char *dotqmail_alias_command(const char *); void moddotqmail(); void moddotqmailnow(); int show_aliases(void); -void show_dotqmail_lines(char *, char *, time_t); -void show_dotqmail_file(char *); +void show_dotqmail_lines(const char *, const char *, time_t); +void show_dotqmail_file(const char *); #endif diff --git a/iwebadmin-x/auth.h b/iwebadmin-x/auth.h index f33b89b73..f9dc8a9ac 100644 --- a/iwebadmin-x/auth.h +++ b/iwebadmin-x/auth.h @@ -1,5 +1,20 @@ /* * $Id: auth.h,v 1.1 2010-04-26 12:07:27+05:30 Cprogrammer Exp mbhangui $ + * Copyright (C) 1999-2004 Inter7 Internet Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ void auth_system(const char *ip_addr, struct passwd *pw); diff --git a/iwebadmin-x/autorespond.c b/iwebadmin-x/autorespond.c index abb29d682..b1f1d9ca7 100644 --- a/iwebadmin-x/autorespond.c +++ b/iwebadmin-x/autorespond.c @@ -49,9 +49,7 @@ #include "common.h" void -show_autoresponders(user, dom, mytime) - char *user, *dom; - time_t mytime; +show_autoresponders(const char *user, const char *dom, time_t mytime) { if (MaxAutoResponders == 0) return; @@ -65,9 +63,9 @@ show_autoresponders(user, dom, mytime) } void -show_autorespond_line(char *user, char *dom, time_t mytime, char *dir) +show_autorespond_line(const char *user, const char *dom, time_t mytime, const char *dir) { - char *addr, *domptr; + const char *addr, *domptr; int i; DIR *mydir; struct dirent *mydirent; diff --git a/iwebadmin-x/autorespond.h b/iwebadmin-x/autorespond.h index 11fb6f69d..2d475298f 100644 --- a/iwebadmin-x/autorespond.h +++ b/iwebadmin-x/autorespond.h @@ -1,5 +1,20 @@ /* * $Id: autorespond.h,v 1.1 2010-04-26 12:07:40+05:30 Cprogrammer Exp mbhangui $ + * Copyright (C) 1999-2004 Inter7 Internet Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #include @@ -11,5 +26,5 @@ void delautorespond(); void delautorespondnow(); void modautorespond(); void modautorespondnow(); -void show_autoresponders(char *user, char *dom, time_t mytime); -void show_autorespond_line(char *user, char *dom, time_t mytime, char *dir); +void show_autoresponders(const char *user, const char *dom, time_t mytime); +void show_autorespond_line(const char *user, const char *dom, time_t mytime, const char *dir); diff --git a/iwebadmin-x/cgi.c b/iwebadmin-x/cgi.c index 11e5957c0..0a57c7a30 100644 --- a/iwebadmin-x/cgi.c +++ b/iwebadmin-x/cgi.c @@ -84,7 +84,7 @@ get_cgi() * copies value of fieldname into dest */ int -GetValue(char *source, stralloc *dest, char *name) +GetValue(const char *source, stralloc *dest, const char *name) { int i, j, k, l, len; char *s; diff --git a/iwebadmin-x/cgi.h b/iwebadmin-x/cgi.h index 9bae58879..c0dce5c29 100644 --- a/iwebadmin-x/cgi.h +++ b/iwebadmin-x/cgi.h @@ -1,5 +1,20 @@ /* * $Id: cgi.h,v 1.2 2019-06-03 06:46:17+05:30 Cprogrammer Exp mbhangui $ + * Copyright (C) 1999-2004 Inter7 Internet Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifndef HAVE_CGI_H #define HAVE_CGI_H @@ -11,6 +26,6 @@ #endif void get_cgi(); -int GetValue(char *, stralloc *, char *); +int GetValue(const char *, stralloc *, const char *); #endif diff --git a/iwebadmin-x/command.c b/iwebadmin-x/command.c index 51fd4b995..ba2da2e54 100644 --- a/iwebadmin-x/command.c +++ b/iwebadmin-x/command.c @@ -53,7 +53,7 @@ #include "common.h" void -process_commands(char *cmmd) +process_commands(const char *cmmd) { static stralloc tmp = {0}; struct passwd *pw; diff --git a/iwebadmin-x/command.h b/iwebadmin-x/command.h index 25f854aee..3d501db26 100644 --- a/iwebadmin-x/command.h +++ b/iwebadmin-x/command.h @@ -1,9 +1,24 @@ /* * $Id: command.h,v 1.3 2023-07-28 22:28:36+05:30 Cprogrammer Exp mbhangui $ + * Copyright (C) 1999-2004 Inter7 Internet Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifndef _COMMAND_H_ #define _COMMAND_H_ -void process_commands(char *); +void process_commands(const char *); void setdefaultaccount(); #endif diff --git a/iwebadmin-x/common.c b/iwebadmin-x/common.c index c458a5803..09b73d542 100644 --- a/iwebadmin-x/common.c +++ b/iwebadmin-x/common.c @@ -1,23 +1,5 @@ /* - * $Log: common.c,v $ - * Revision 1.5 2023-07-28 22:29:02+05:30 Cprogrammer - * added my_exit() function to record source file, line no of exit - * - * Revision 1.4 2022-09-15 23:11:09+05:30 Cprogrammer - * display out of memory error message in die_nomem() - * - * Revision 1.3 2021-03-14 12:47:42+05:30 Cprogrammer - * prevent including mysql.h in indimail.h - * - * Revision 1.2 2020-10-30 12:43:40+05:30 Cprogrammer - * add newline to separate functions - * - * Revision 1.1 2019-06-08 18:15:55+05:30 Cprogrammer - * Initial revision - * - * Revision 1.1 2019-04-14 20:57:45+05:30 Cprogrammer - * Initial revision - * + * $Id: $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -40,7 +22,7 @@ #include "common.h" void -my_exit(substdio *ss, int ret, int line, char *fn) +my_exit(substdio *ss, int ret, int line, const char *fn) { if (ss) { subprintf(ss, "%s: exit at line %d ret=%d\nEnd Time=%ld\n\n", fn, line, ret, time(0)); @@ -69,7 +51,7 @@ set_status_mesg_size(int len) } void -copy_status_mesg(char *str) +copy_status_mesg(const char *str) { if (!stralloc_copys(&StatusMessage, str) || !stralloc_append(&StatusMessage, "\n") || @@ -79,7 +61,7 @@ copy_status_mesg(char *str) } void -out(char *str) +out(const char *str) { if (!str || !*str) return; @@ -96,7 +78,7 @@ flush() } void -errout(char *str) +errout(const char *str) { if (!str || !*str) return; @@ -111,3 +93,25 @@ errflush() if (substdio_flush(subfderr) == -1) iweb_exit(OUTPUT_FAILURE); } + +/* + * $Log: common.c,v $ + * Revision 1.5 2023-07-28 22:29:02+05:30 Cprogrammer + * added my_exit() function to record source file, line no of exit + * + * Revision 1.4 2022-09-15 23:11:09+05:30 Cprogrammer + * display out of memory error message in die_nomem() + * + * Revision 1.3 2021-03-14 12:47:42+05:30 Cprogrammer + * prevent including mysql.h in indimail.h + * + * Revision 1.2 2020-10-30 12:43:40+05:30 Cprogrammer + * add newline to separate functions + * + * Revision 1.1 2019-06-08 18:15:55+05:30 Cprogrammer + * Initial revision + * + * Revision 1.1 2019-04-14 20:57:45+05:30 Cprogrammer + * Initial revision + * + */ diff --git a/iwebadmin-x/common.h b/iwebadmin-x/common.h index 048d24f7c..3443da1c3 100644 --- a/iwebadmin-x/common.h +++ b/iwebadmin-x/common.h @@ -1,3 +1,6 @@ +/* + * $Id: $ + */ #ifndef COMMON_H #define COMMON_H #ifdef HAVE_CONFIG_H @@ -24,14 +27,14 @@ #define SYSTEM_FAILURE 111 /*- SYSTEM_FAILURE */ -void out(char *); +void out(const char *); void flush(void); -void errout(char *); +void errout(const char *); void errflush(void); -void copy_status_mesg(char *); +void copy_status_mesg(const char *); void set_status_mesg_size(int); void die_nomem(); -void my_exit(substdio *, int, int, char *); +void my_exit(substdio *, int, int, const char *); extern substdio *ssdbg; diff --git a/iwebadmin-x/dotqmail.c b/iwebadmin-x/dotqmail.c index 1c2f39a45..472bb82ad 100644 --- a/iwebadmin-x/dotqmail.c +++ b/iwebadmin-x/dotqmail.c @@ -27,20 +27,20 @@ #ifdef VALIAS int -dotqmail_delete_files(char *user) +dotqmail_delete_files(const char *user) { return (!valias_delete(user, Domain.s, 0)); } int -dotqmail_add_line(char *user, char *line) +dotqmail_add_line(const char *user, const char *line) { - return (valias_insert(user, Domain.s, line, 1)); + return (valias_insert(user, Domain.s, (char *) line, 1)); } int -dotqmail_del_line(char *user, char *line) +dotqmail_del_line(const char *user, const char *line) { - return (valias_delete(user, Domain.s, line)); + return (valias_delete(user, Domain.s, (char *) line)); } #endif diff --git a/iwebadmin-x/dotqmail.h b/iwebadmin-x/dotqmail.h index 46924b3c5..56dd4c2ae 100644 --- a/iwebadmin-x/dotqmail.h +++ b/iwebadmin-x/dotqmail.h @@ -1,13 +1,28 @@ /* * $Id: dotqmail.h,v 1.1 2010-04-26 12:07:47+05:30 Cprogrammer Exp mbhangui $ + * Copyright (C) 1999-2004 Inter7 Internet Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -int dotqmail_delete_files(char *user); -int dotqmail_add_line(char *user, char *line); -int dotqmail_del_line(char *user, char *line); +int dotqmail_delete_files(const char *user); +int dotqmail_add_line(const char *user, const char *line); +int dotqmail_del_line(const char *user, const char *line); #ifndef VALIAS -int dotqmail_open_files(char *user); -void dotqmail_close_files(char *user, int keep); -int dotqmail_cleanup(char *user, char *line); -int dotqmail_count(char *user); +int dotqmail_open_files(const char *user); +void dotqmail_close_files(const char *user, int keep); +int dotqmail_cleanup(const char *user, const char *line); +int dotqmail_count(const char *user); #endif diff --git a/iwebadmin-x/forward.c b/iwebadmin-x/forward.c index bfdeab772..e9462fadb 100644 --- a/iwebadmin-x/forward.c +++ b/iwebadmin-x/forward.c @@ -38,7 +38,7 @@ #include "common.h" int -show_forwards(char *user, char *dom, time_t mytime) +show_forwards(const char *user, const char *dom, time_t mytime) { if (AdminType != DOMAIN_ADMIN) { copy_status_mesg(html_text[142]); diff --git a/iwebadmin-x/forward.h b/iwebadmin-x/forward.h index b316a9d64..b1948acc2 100644 --- a/iwebadmin-x/forward.h +++ b/iwebadmin-x/forward.h @@ -1,6 +1,21 @@ /* * $Id: forward.h,v 1.1 2010-04-26 12:07:49+05:30 Cprogrammer Exp mbhangui $ + * Copyright (C) 1999-2004 Inter7 Internet Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -int show_forwards(char *user, char *dom, time_t mytime); +int show_forwards(const char *user, const char *dom, time_t mytime); void count_forwards(); diff --git a/iwebadmin-x/iwebadmin.c b/iwebadmin-x/iwebadmin.c index aa015ba61..e052d036c 100644 --- a/iwebadmin-x/iwebadmin.c +++ b/iwebadmin-x/iwebadmin.c @@ -1,4 +1,5 @@ /* + * $Id: iwebadmin.c,v 1.36 2023-10-24 11:11:57+05:30 Cprogrammer Exp mbhangui $ * Copyright (C) 1999-2004 Inter7 Internet Technologies, Inc. * * This program is free software; you can redistribute it and/or modify @@ -14,8 +15,6 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - * - * $Id: iwebadmin.c,v 1.36 2023-10-24 11:11:57+05:30 Cprogrammer Exp mbhangui $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -782,7 +781,7 @@ init_globals() * This feature sponsored by PinkRoccade Public Sector, Sept 2004 */ void -quickAction(char *username, int action) +quickAction(const char *username, int action) { char *space, *ar, *ez; char *aliasline; diff --git a/iwebadmin-x/iwebadmin.h b/iwebadmin-x/iwebadmin.h index 9fca0cef3..f9a35a193 100644 --- a/iwebadmin-x/iwebadmin.h +++ b/iwebadmin-x/iwebadmin.h @@ -47,7 +47,7 @@ #define ACTION_DELETE 2 void init_globals(); -void quickAction(char *username, int action); +void quickAction(const char *username, int action); void del_id_files(stralloc *); /* diff --git a/iwebadmin-x/limits.h b/iwebadmin-x/limits.h index b4fb47eb5..2973b3a38 100644 --- a/iwebadmin-x/limits.h +++ b/iwebadmin-x/limits.h @@ -1,5 +1,20 @@ /* * $Id: limits.h,v 1.1 2010-04-26 12:07:53+05:30 Cprogrammer Exp mbhangui $ + * Copyright (C) 1999-2004 Inter7 Internet Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #define LIMIT_TOKENS " :\t\r\n" diff --git a/iwebadmin-x/mailinglist.c b/iwebadmin-x/mailinglist.c index 2c5e66643..86381575b 100644 --- a/iwebadmin-x/mailinglist.c +++ b/iwebadmin-x/mailinglist.c @@ -109,7 +109,7 @@ show_mailing_lists() } void -show_mailing_list_line(char *user, char *dom, time_t mytime, char *dir) +show_mailing_list_line(const char *user, const char *dom, time_t mytime, const char *dir) { DIR *mydir; struct dirent *mydirent; @@ -292,7 +292,7 @@ show_mailing_list_line(char *user, char *dom, time_t mytime, char *dir) * mailing list lines on the add user page */ void -show_mailing_list_line2(char *user, char *dom, time_t mytime, char *dir) +show_mailing_list_line2(const char *user, const char *dom, time_t mytime, const char *dir) { DIR *mydir; struct dirent *mydirent; @@ -523,7 +523,7 @@ delmailinglistnow() * Replaces the "Reply-To" line in with . */ void -ezmlm_setreplyto(char *filename, char *newtext) +ezmlm_setreplyto(const char *filename, const char *newtext) { int hfd, tmp_fd, match; static stralloc realfn = {0}, tempfn = {0}, line = {0}; @@ -589,7 +589,9 @@ ezmlm_setreplyto(char *filename, char *newtext) #ifdef ENABLE_MYSQL void -write_mysql(char *mysql_host, char *mysql_socket, char *mysql_user, char *mysql_passwd, char *mysql_database, char *mysql_table) +write_mysql(const char *mysql_host, const char *mysql_socket, + const char *mysql_user, const char *mysql_passwd, + const char *mysql_database, const char *mysql_table) { char outbuf[1024]; int fd; @@ -1111,7 +1113,7 @@ show_list_group_now(int mod) } void -show_list_group(char *template) +show_list_group(const char *template) { if (AdminType != DOMAIN_ADMIN) { out(html_text[142]); @@ -1126,7 +1128,7 @@ show_list_group(char *template) } void -addlistgroup(char *template) +addlistgroup(const char *template) { if (AdminType != DOMAIN_ADMIN) { out(html_text[142]); @@ -1160,7 +1162,7 @@ addlistdig() * returns 0 for success */ int -ezmlm_sub(int mod, char *email) +ezmlm_sub(int mod, const char *email) { int pid; static stralloc subpath = {0}, listpath = {0}; @@ -1274,7 +1276,7 @@ addlistgroupnow(int mod) } void -dellistgroup(char *template) +dellistgroup(const char *template) { if (AdminType != DOMAIN_ADMIN) { out(html_text[142]); @@ -1555,7 +1557,8 @@ modmailinglistnow() } void -build_list_value(char *param, char *color, char *opt1, int desc1, char *opt2, int desc2, int checked) +build_list_value(const char *param, const char *color, const char *opt1, + int desc1, const char *opt2, int desc2, int checked) { out(""); printh("", cgiurl(command), modu); @@ -184,7 +184,7 @@ qmail_button(char *modu, char *command, char *user, char *dom, time_t mytime, ch } int -check_local_user(char *user) +check_local_user(const char *user) { char *ptr; @@ -243,7 +243,7 @@ show_counts() } int -check_indimail_alias(char *addr, stralloc *dest) +check_indimail_alias(const char *addr, stralloc *dest) { static stralloc line = {0}; char inbuf[1024]; @@ -297,7 +297,7 @@ check_indimail_alias(char *addr, stralloc *dest) int check_email_addr(char *addr) { - char *atpos = 0; + const char *atpos = 0; int i, dotpos, len; char allowed_char[] = ".-+=_&"; @@ -354,7 +354,7 @@ fixup_local_name(char *addr) } void -ack(char *msg, char *extra) +ack(const char *msg, const char *extra) { out(get_html_text(msg)); out(" "); @@ -367,8 +367,7 @@ ack(char *msg, char *extra) } void -upperit(instr) - char *instr; +upperit(char *instr) { while (*instr != 0) { if (islower(*instr)) @@ -377,8 +376,8 @@ upperit(instr) } } -char * -safe_getenv(char *var) +const char * +safe_getenv(const char *var) { char *s; @@ -387,12 +386,10 @@ safe_getenv(char *var) return (s); } -char * -strstart(sstr, tstr) - char *sstr; - char *tstr; +const char * +strstart(const char *sstr, const char *tstr) { - char *ret_str; + const char *ret_str; ret_str = sstr; if (!sstr || !tstr) @@ -449,8 +446,8 @@ open_lang(char *lang) return (lang_fd); } -char * -get_html_text(char *index) +const char * +get_html_text(const char *index) { int i; @@ -475,8 +472,8 @@ open_colortable() return (0); } -char * -get_color_text(char *index) +const char * +get_color_text(const char *index) { static stralloc line = {0}; char inbuf[1024]; @@ -516,7 +513,7 @@ get_color_text(char *index) * return value: 0 for success, 1 for failure */ int -quota_to_bytes(char returnval[], char *quota) +quota_to_bytes(char returnval[], const char *quota) { mdir_t tmp; int i; @@ -544,7 +541,7 @@ quota_to_bytes(char returnval[], char *quota) * return value: 0 for success, 1 for failure */ int -quota_to_megabytes(char *returnval, char *quota) +quota_to_megabytes(char returnval[], const char *quota) { mdir_t tmp; int i; @@ -577,7 +574,7 @@ quota_to_megabytes(char *returnval, char *quota) return 0; } void -print_user_index(char *action, int colspan, char *user, char *dom, time_t mytime) +print_user_index(const char *action, int colspan, const char *user, const char *dom, time_t mytime) { #ifdef USER_INDEX int k; @@ -633,7 +630,7 @@ print_user_index(char *action, int colspan, char *user, char *dom, time_t mytime } char * -cgiurl(char *action) +cgiurl(const char *action) { int len, plen; static stralloc url = {0}; diff --git a/iwebadmin-x/util.h b/iwebadmin-x/util.h index 5ef0e5a57..37ceed5a8 100644 --- a/iwebadmin-x/util.h +++ b/iwebadmin-x/util.h @@ -1,36 +1,51 @@ /* * $Id: util.h,v 1.2 2019-06-03 06:48:20+05:30 Cprogrammer Exp mbhangui $ + * Copyright (C) 1999-2004 Inter7 Internet Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #include -int check_local_user(char *user); +int check_local_user(const char *user); int fixup_local_name(char *addr); int check_email_addr(char *addr); -int check_indimail_alias(char *, stralloc *); +int check_indimail_alias(const char *, stralloc *); int open_lang(char *lang); int open_colortable(); -char *strstart(char *sstr, char *tstr); -char *safe_getenv(char *var); -char *get_html_text(char *index); -char *get_color_text(char *index); +const char *strstart(const char *sstr, const char *tstr); +const char *safe_getenv(const char *var); +const char *get_html_text(const char *index); +const char *get_color_text(const char *index); void upperit(char *instr); -void ack(char *msg, char *extra); +void ack(const char *msg, const char *extra); void show_counts(); /* * prototypes for sorting functions in util.c */ int sort_init(); -int sort_add_entry(char *, char); +int sort_add_entry(const char *, char); unsigned char *sort_get_entry(int); void sort_cleanup(); void sort_dosort(); void str_replace(char *, char, char); -void qmail_button(char *modu, char *command, char *user, char *dom, time_t mytime, char *png); +void qmail_button(const char *modu, const char *command, const char *user, const char *dom, time_t mytime, const char *png); -int quota_to_bytes(char[], char *); //jhopper prototype -int quota_to_megabytes(char[], char *); //jhopper prototype +int quota_to_bytes(char[], const char *); //jhopper prototype +int quota_to_megabytes(char[], const char *); //jhopper prototype -void print_user_index(char *action, int colspan, char *user, char *dom, time_t mytime); -char *cgiurl(char *action); +void print_user_index(const char *action, int colspan, const char *user, const char *dom, time_t mytime); +char *cgiurl(const char *action);