Update of /cvsroot/qmailadmin/qmailadmin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30485 Modified Files: Tag: stable-1_2 ChangeLog alias.c auth.c autorespond.c cgi.c command.c dotqmail.c forward.c limits.c mailinglist.c qmailadmin.c qmailadmin.h qmailadminx.h show.c template.c user.c util.c Added Files: Tag: stable-1_2 alias.h auth.h autorespond.h cgi.h command.h dotqmail.h forward.h limits.h mailinglist.h show.h template.h user.h util.h Log Message: major code clean up; added header files, fixed function prototypes/definitions/calls; fixed all compiler warnings Index: limits.c =================================================================== RCS file: /cvsroot/qmailadmin/qmailadmin/limits.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -d -r1.2 -r1.2.2.1 --- limits.c 10 Oct 2003 16:36:24 -0000 1.2 +++ limits.c 20 Nov 2004 01:10:41 -0000 1.2.2.1 @@ -1,6 +1,6 @@ /* * $Id$ - * Copyright (C) 1999-2002 Inter7 Internet Technologies, Inc. + * 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 @@ -17,23 +17,12 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <sys/stat.h> -#include <unistd.h> -#include <pwd.h> -#include <dirent.h> -#include <errno.h> #include "config.h" #include "qmailadmin.h" #include "qmailadminx.h" +#include "limits.h" -#define LIMIT_TOKENS " :\t\r\n" - - -load_limits() +void load_limits() { vget_limits(Domain, &Limits); MaxPopAccounts = Limits.maxpopaccounts; --- NEW FILE: command.h --- /* * $Id: command.h,v 1.1.2.1 2004/11/20 01:10:41 tomcollins Exp $ */ void process_commands(); void setdefaultaccount(); Index: mailinglist.c =================================================================== RCS file: /cvsroot/qmailadmin/qmailadmin/mailinglist.c,v retrieving revision 1.5.2.1 retrieving revision 1.5.2.2 diff -u -d -r1.5.2.1 -r1.5.2.2 --- mailinglist.c 14 Nov 2004 18:05:54 -0000 1.5.2.1 +++ mailinglist.c 20 Nov 2004 01:10:41 -0000 1.5.2.2 @@ -1,6 +1,6 @@ /* * $Id$ - * Copyright (C) 1999-2002 Inter7 Internet Technologies, Inc. + * 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 @@ -23,13 +23,25 @@ #include <string.h> #include <unistd.h> #include <sys/stat.h> +#include <sys/types.h> +#include <sys/wait.h> #include <unistd.h> #include <pwd.h> #include <dirent.h> +#include <errno.h> + +#include <vpopmail.h> + +#include "cgi.h" #include "config.h" +#include "limits.h" +#include "mailinglist.h" +#include "printh.h" #include "qmailadmin.h" #include "qmailadminx.h" -#include <errno.h> +#include "show.h" +#include "template.h" +#include "util.h" char dotqmail_name[MAX_FILE_NAME]; char replyto_addr[256]; @@ -44,7 +56,7 @@ void set_options(); void default_options(); -int show_mailing_lists(char *user, char *dom, time_t mytime) +void show_mailing_lists(char *user, char *dom, time_t mytime) { if ( AdminType!=DOMAIN_ADMIN ) { snprintf (StatusMessage, sizeof(StatusMessage), "%s", get_html_text("142")); @@ -56,25 +68,25 @@ count_mailinglists(); if ( CurMailingLists == 0 ) { snprintf (StatusMessage, sizeof(StatusMessage), "%s", get_html_text("231")); - show_menu(); + show_menu(Username, Domain, Mytime); vclose(); exit(0); } if ( MaxMailingLists == 0 ) { - return(0); + return; } send_template( "show_mailinglist.html" ); } -int show_mailing_list_line(char *user, char* dom, time_t mytime, char *dir) +void show_mailing_list_line(char *user, char* dom, time_t mytime, char *dir) { DIR *mydir; struct dirent *mydirent; FILE *fs; char *addr; char testfn[MAX_FILE_NAME]; - int i,j; + int i; if ( AdminType!=DOMAIN_ADMIN ) { snprintf (StatusMessage, sizeof(StatusMessage), "%s", get_html_text("142")); @@ -83,12 +95,12 @@ } if ( MaxMailingLists == 0 ) { - return(0); + return; } if ( (mydir = opendir(".")) == NULL ) { printf ("<tr><td>%s %d</tr><td>", get_html_text("143"), 1); - return(0); + return; } /* First display the title row */ @@ -134,7 +146,7 @@ closedir(mydir); sort_dosort(); - for (i = 0; addr = sort_get_entry(i); ++i) { + for (i = 0; (addr = sort_get_entry(i)); ++i) { sprintf (testfn, ".qmail-%s-digest-owner", addr); /* convert ':' in addr to '.' */ str_replace (addr, ':', '.'); @@ -184,13 +196,13 @@ } /* mailing list lines on the add user page */ -int show_mailing_list_line2(char *user, char *dom, time_t mytime, char *dir) +void show_mailing_list_line2(char *user, char *dom, time_t mytime, char *dir) { DIR *mydir; struct dirent *mydirent; FILE *fs; char *addr; - int i,j; + int i; int listcount; if ( AdminType!=DOMAIN_ADMIN ) { @@ -200,12 +212,12 @@ } if (*EZMLMDIR == 'n' || MaxMailingLists == 0 ) { - return(0); + return; } if ( (mydir = opendir(".")) == NULL ) { printf ("%s %d<BR>\n", get_html_text("143"), 1); - return(0); + return; } listcount = 0; @@ -231,7 +243,7 @@ /* if there aren't any lists, don't display anything */ if (listcount == 0) { sort_cleanup(); - return 0; + return; } printf ("<hr><table width=100%% cellpadding=1 cellspacing=0 border=0"); @@ -255,8 +267,7 @@ sort_cleanup(); } - -int addmailinglist(void) +void addmailinglist() { if ( AdminType!=DOMAIN_ADMIN ) { snprintf (StatusMessage, sizeof(StatusMessage), "%s", get_html_text("142")); @@ -269,7 +280,7 @@ if ( MaxMailingLists != -1 && CurMailingLists >= MaxMailingLists ) { printf ("%s %d\n", get_html_text("184"), MaxMailingLists); - show_menu(); + show_menu(Username, Domain, Mytime); vclose(); exit(0); } @@ -285,7 +296,7 @@ } -int delmailinglist(void) +void delmailinglist() { if ( AdminType!=DOMAIN_ADMIN ) { snprintf (StatusMessage, sizeof(StatusMessage), "%s", get_html_text("142")); @@ -296,9 +307,8 @@ send_template( "del_mailinglist_confirm.html" ); } -int delmailinglistnow(void) +void delmailinglistnow() { - int pid; DIR *mydir; struct dirent *mydirent; @@ -311,7 +321,7 @@ if ( (mydir = opendir(".")) == NULL ) { printf ("%s %d<BR>\n", get_html_text("143"), 1); printf ("</table>"); - return 0; + return; } /* make dotqmail name */ @@ -327,13 +337,13 @@ /* delete the main .qmail-"list" file */ if ( strcmp(TmpBuf2, mydirent->d_name) == 0 ) { if ( unlink(mydirent->d_name) != 0 ) { - ack(get_html_text("185"), TmpBuf2); + ack("185", TmpBuf2); } /* delete secondary .qmail-"list"-* files */ } else if ( strncmp(TmpBuf3, mydirent->d_name, strlen(TmpBuf3)) == 0 ) { if ( unlink(mydirent->d_name) != 0 ) { - ack(get_html_text("185"), TmpBuf2); + ack("185", TmpBuf2); } } } @@ -346,7 +356,7 @@ count_mailinglists(); snprinth (StatusMessage, sizeof(StatusMessage), "%s %H\n", get_html_text("186"), ActionUser); if ( CurMailingLists == 0 ) { - show_menu(); + show_menu(Username, Domain, Mytime); } else { show_mailing_lists(Username, Domain, Mytime); } @@ -387,7 +397,7 @@ rename (tempfn, realfn); } -ezmlm_make (int newlist) +void ezmlm_make (int newlist) { FILE * file; int pid; @@ -582,20 +592,20 @@ /* update inlocal file */ sprintf(TmpBuf, "%s/%s/inlocal", RealDir, ActionUser); - if (file=fopen(TmpBuf, "w")) { + if ((file=fopen(TmpBuf, "w")) != NULL) { fprintf(file, "%s-%s", Domain, ActionUser); fclose(file); } } -int addmailinglistnow(void) +void addmailinglistnow() { count_mailinglists(); load_limits(); if ( MaxMailingLists != -1 && CurMailingLists >= MaxMailingLists ) { printf ("%s %d\n", get_html_text("184"), MaxMailingLists); - show_menu(); + show_menu(Username, Domain, Mytime); vclose(); exit(0); } @@ -614,12 +624,12 @@ show_mailing_lists(Username, Domain, Mytime); } -int show_list_group_now(int mod) +void show_list_group_now(int mod) { /* mod = 0 for subscribers, 1 for moderators, 2 for digest users */ FILE *fs; - int i,handles[2],pid,a,x,y,z = 0,z1=1,subuser_count = 0; + int handles[2],pid,z = 0,subuser_count = 0; char buf[256]; char *addr; @@ -690,13 +700,13 @@ } else { strcpy(TmpBuf, "dellistusernow"); } - for(z = 0; addr = sort_get_entry(z); ++z) { + for(z = 0; (addr = sort_get_entry(z)); ++z) { printf (" <TR align=center>"); printh (" <TD align=right><A href=\"%s/com/%s?modu=%C&newu=%C&dom=%C&user=%C&time=%d\"><IMG src=\"%s/trash.png\" border=0></A></TD>\n", CGIPATH, TmpBuf, ActionUser, addr, Domain, Username, Mytime, IMAGEURL); printh (" <TD align=left>%H</TD>\n", addr); ++z; - if(addr = sort_get_entry(z)) { + if( (addr = sort_get_entry(z)) ) { printh (" <TD align=right><A href=\"%s/com/%s?modu=%C&newu=%C&dom=%C&user=%C&time=%d\"><IMG src=\"%s/trash.png\" border=0></A></TD>\n", CGIPATH, TmpBuf, ActionUser, addr, Domain, Username, Mytime, IMAGEURL); printh (" <TD align=left>%H</TD>\n", addr); @@ -717,13 +727,7 @@ } } -/* -int show_list_users_now(void) { return show_list_group_now(0); } -int show_list_moderators_now(void) { return show_list_group_now(1); } -int show_list_digest_users_now(void) { return show_list_group_now(2); } -*/ - -int show_list_group(char *template) +void show_list_group(char *template) { if (AdminType != DOMAIN_ADMIN) { snprintf (StatusMessage, sizeof(StatusMessage), "%s", get_html_text("142")); @@ -732,19 +736,13 @@ } if (MaxMailingLists == 0) { - return 0; + return; } send_template(template); } -/* -int show_list_users(void) { return show_list_group("show_subscribers.html"); } -int show_list_digest_users(void) { return show_list_group("show_digest_subscribers.html"); } -int show_list_moderators(void) { return show_list_group("show_moderators.html"); } -*/ - -addlistgroup (char *template) +void addlistgroup (char *template) { if ( AdminType!=DOMAIN_ADMIN ) { snprintf (StatusMessage, sizeof(StatusMessage), "%s", get_html_text("142")); @@ -754,15 +752,14 @@ send_template(template); } -addlistuser() { addlistgroup( "add_listuser.html" ); } -addlistmod() { addlistgroup( "add_listmod.html" ); } -addlistdig() { addlistgroup( "add_listdig.html" ); } +void addlistuser() { addlistgroup( "add_listuser.html" ); } +void addlistmod() { addlistgroup( "add_listmod.html" ); } +void addlistdig() { addlistgroup( "add_listdig.html" ); } -addlistgroupnow (int mod) +void addlistgroupnow (int mod) { // mod = 0 for subscribers, 1 for moderators, 2 for digest subscribers - int i, result; int pid; if ( AdminType!=DOMAIN_ADMIN ) { @@ -817,13 +814,7 @@ exit(0); } -/* -addlistusernow() { addlistgroupnow(0); } -addlistmodnow() { addlistgroupnow(1); } -addlistdignow() { addlistgroupnow(2); } -*/ - -dellistgroup(char *template) +void dellistgroup(char *template) { if ( AdminType!=DOMAIN_ADMIN ) { snprintf (StatusMessage, sizeof(StatusMessage), "%s", get_html_text("142")); @@ -834,13 +825,8 @@ send_template(template); } -dellistuser() { dellistgroup ( "del_listuser.html" ); } -dellistmod() { dellistgroup ( "del_listmod.html" ); } -dellistdig() { dellistgroup ( "del_listdig.html" ); } - -dellistgroupnow(int mod) +void dellistgroupnow(int mod) { - int i; int pid; if ( AdminType!=DOMAIN_ADMIN ) { @@ -880,13 +866,7 @@ exit(0); } -/* -dellistusernow() { dellistgroupnow(0); } -dellistmodnow() { dellistgroupnow(1); } -dellistdignow() { dellistgroupnow(2); } -*/ - -count_mailinglists() +void count_mailinglists() { DIR *mydir; struct dirent *mydirent; @@ -895,7 +875,7 @@ if ( (mydir = opendir(".")) == NULL ) { printf ("%s %d<BR>\n", get_html_text("143"), 1); printf ("</table>"); - return(0); + return; } @@ -918,7 +898,7 @@ } -modmailinglist() +void modmailinglist() { /* name of list to modify is stored in ActionUser */ int i; @@ -978,7 +958,7 @@ } -modmailinglistnow() +void modmailinglistnow() { ezmlm_make(0); @@ -987,7 +967,7 @@ show_mailing_lists(Username, Domain, Mytime); } -build_list_value(char *param, char *color, char *opt1, char *desc1, char *opt2, char *desc2, int checked) +void build_list_value(char *param, char *color, char *opt1, char *desc1, char *opt2, char *desc2, int checked) { printf ("<tr bgcolor=%s>\n", get_color_text(color)); printf (" <td>\n"); @@ -999,7 +979,7 @@ printf ("</tr>\n"); } -build_option_str (char *type, char *param, char *options, char *description) +void build_option_str (char *type, char *param, char *options, char *description) { int selected; char *optptr; @@ -1007,7 +987,7 @@ selected = 1; for (optptr = options; *optptr; optptr++) { - selected = selected && checkopt[*optptr]; + selected = selected && checkopt[(int) *optptr]; } /* selected is now true if all options for this radio button are true */ @@ -1063,7 +1043,7 @@ } // default to false for lowercase letters - for (c = 'a'; c <= 'z'; checkopt[c++] = 0); + for (c = 'a'; c <= 'z'; checkopt[(int) c++] = 0); // figure out some options in the -default file sprintf(TmpBuf, ".qmail-%s-default", dotqmail_name); @@ -1149,7 +1129,7 @@ /* update the uppercase option letters (just the opposite of the lowercase) */ for (c = 'A'; c <= 'Z'; c++) { - checkopt[c] = !checkopt[(c - 'A' + 'a')]; + checkopt[(int) c] = !checkopt[(int) (c - 'A' + 'a')]; } } @@ -1195,15 +1175,15 @@ /* update the uppercase option letters (just the opposite of the lowercase) */ for (c = 'A'; c <= 'Z'; c++) { - checkopt[c] = !checkopt[(c - 'A' + 'a')]; + checkopt[(int) c] = !checkopt[(int) (c - 'A' + 'a')]; } } -show_current_list_values() { +void show_current_list_values() { FILE *fs; int sqlfileok = 0; int usesql = 0; - int i,j; + int i=0,j; char checked1[MAX_BUFF] = ""; char listname[128]; int checked; --- NEW FILE: limits.h --- /* * $Id: limits.h,v 1.1.2.1 2004/11/20 01:10:41 tomcollins Exp $ */ #define LIMIT_TOKENS " :\t\r\n" void load_limits(); --- NEW FILE: mailinglist.h --- /* * $Id: mailinglist.h,v 1.1.2.1 2004/11/20 01:10:41 tomcollins Exp $ */ #include <time.h> void addlistgroup (char *template); void addlistgroupnow (int mod); void addmailinglist(); void addmailinglistnow(); void count_mailinglists(); void dellistgroup(char *template); void dellistgroupnow(int mod); void delmailinglist(); void delmailinglistnow(); void modmailinglist(); void modmailinglistnow(); void show_list_group(char *template); void show_list_group_now(int mod); void show_mailing_lists(char *user, char *dom, time_t mytime); void show_mailing_list_line(char *user, char* dom, time_t mytime, char *dir); void show_mailing_list_line2(char *user, char *dom, time_t mytime, char *dir); void show_list_group_now(int mod); void show_current_list_values(); int get_mailinglist_prefix(char* prefix); Index: command.c =================================================================== RCS file: /cvsroot/qmailadmin/qmailadmin/command.c,v retrieving revision 1.2.2.3 retrieving revision 1.2.2.4 diff -u -d -r1.2.2.3 -r1.2.2.4 --- command.c 14 Nov 2004 18:05:54 -0000 1.2.2.3 +++ command.c 20 Nov 2004 01:10:41 -0000 1.2.2.4 @@ -1,6 +1,6 @@ /* * $Id$ - * Copyright (C) 1999-2002 Inter7 Internet Technologies, Inc. + * 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 @@ -25,39 +25,47 @@ #include <unistd.h> #include <pwd.h> #include <dirent.h> + +#include <vpopmail_config.h> #include <vpopmail.h> #include <vauth.h> + +#include "alias.h" +#include "autorespond.h" +#include "cgi.h" +#include "command.h" +#include "forward.h" +#include "mailinglist.h" +#include "printh.h" #include "qmailadmin.h" #include "qmailadminx.h" -#include <vpopmail_config.h> - - +#include "show.h" +#include "user.h" +#include "util.h" -process_commands() +void process_commands() { - int pid; - if (strcmp(TmpBuf2, "showmenu") == 0 ) { show_menu(Username, Domain, Mytime); } else if (strcmp(TmpBuf2, "showusers") == 0) { GetValue(TmpCGI, Pagenumber, "page=", sizeof(Pagenumber)); GetValue(TmpCGI, SearchUser, "searchuser=", sizeof(SearchUser)); - show_users(Username, Domain, Mytime, TmpBuf2); + show_users(Username, Domain, Mytime); } else if (strcmp(TmpBuf2, "showaliases") == 0) { GetValue(TmpCGI, Pagenumber, "page=", sizeof(Pagenumber)); - show_aliases(Username, Domain, Mytime, TmpBuf2); + show_aliases(); } else if (strcmp(TmpBuf2, "showforwards") == 0) { GetValue(TmpCGI, Pagenumber, "page=", sizeof(Pagenumber)); - show_forwards(Username, Domain, Mytime, TmpBuf2); + show_forwards(Username, Domain, Mytime); } else if (strcmp(TmpBuf2, "showmailinglists") == 0) { - show_mailing_lists(Username, Domain, Mytime, TmpBuf2); + show_mailing_lists(Username, Domain, Mytime); } else if (strcmp(TmpBuf2, "showautoresponders") == 0) { - show_autoresponders(Username, Domain, Mytime, TmpBuf2); + show_autoresponders(Username, Domain, Mytime); } else if (strcmp(TmpBuf2, "adduser") == 0 ) { adduser(); @@ -265,12 +273,10 @@ exit(0); } -setdefaultaccount() +void setdefaultaccount() { struct vqpasswd *pw; FILE *fs; - int i; - int j; if ((pw = vauth_getpw( ActionUser, Domain )) == NULL) { snprinth (StatusMessage, sizeof(StatusMessage), "%s %H@%H", Index: show.c =================================================================== RCS file: /cvsroot/qmailadmin/qmailadmin/show.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -d -r1.2 -r1.2.2.1 --- show.c 10 Oct 2003 16:36:24 -0000 1.2 +++ show.c 20 Nov 2004 01:10:41 -0000 1.2.2.1 @@ -1,6 +1,6 @@ /* * $Id$ - * Copyright (C) 1999-2002 Inter7 Internet Technologies, Inc. + * 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 @@ -17,19 +17,10 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <sys/stat.h> -#include <unistd.h> -#include <pwd.h> -#include <dirent.h> -#include "config.h" -#include "qmailadmin.h" -#include "qmailadminx.h" +#include "template.h" +#include "show.h" -show_menu(user, dom, mytime) +void show_menu(user, dom, mytime) char *user; char *dom; time_t mytime; @@ -37,7 +28,7 @@ send_template( "main_menu.html" ); } -show_login() +void show_login() { send_template( "show_login.html" ); } --- NEW FILE: forward.h --- /* * $Id: forward.h,v 1.1.2.1 2004/11/20 01:10:41 tomcollins Exp $ */ int show_forwards(char *user, char *dom, time_t mytime); void count_forwards(); Index: forward.c =================================================================== RCS file: /cvsroot/qmailadmin/qmailadmin/forward.c,v retrieving revision 1.2.2.3 retrieving revision 1.2.2.4 diff -u -d -r1.2.2.3 -r1.2.2.4 --- forward.c 14 Nov 2004 18:05:54 -0000 1.2.2.3 +++ forward.c 20 Nov 2004 01:10:41 -0000 1.2.2.4 @@ -1,6 +1,6 @@ /* * $Id$ - * Copyright (C) 1999-2002 Inter7 Internet Technologies, Inc. + * 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 @@ -27,13 +27,16 @@ #include <dirent.h> #include <vpopmail.h> #include <vauth.h> +#include "alias.h" #include "config.h" +#include "forward.h" #include "qmailadmin.h" #include "qmailadminx.h" +#include "template.h" +#include "show.h" +#include "util.h" -char* dotqmail_alias_command(char* command); - -int show_forwards(char *user, char *dom, time_t mytime, char *dir) +int show_forwards(char *user, char *dom, time_t mytime) { if (AdminType != DOMAIN_ADMIN) { snprintf (StatusMessage, sizeof(StatusMessage), "%s", get_html_text("142")); @@ -55,12 +58,12 @@ return 0; } -int count_forwards() +void count_forwards() { char *alias_line; - char *alias_name_from_command; char alias_name[MAX_FILE_NAME]; char this_alias[MAX_FILE_NAME]; + char *p1, *p2; int isforward; CurForwards = 0; @@ -71,8 +74,6 @@ strcpy (this_alias, alias_name); if (*alias_line == '#') { CurBlackholes++; } else { - char *p1, *p2; - int isforward; isforward = 1; while (isforward && (alias_line != NULL) && (strcmp (this_alias, alias_name) == 0)) { @@ -91,6 +92,6 @@ } } - return 0; + return; } Index: dotqmail.c =================================================================== RCS file: /cvsroot/qmailadmin/qmailadmin/dotqmail.c,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -u -d -r1.2.2.2 -r1.2.2.3 --- dotqmail.c 23 Feb 2004 18:12:20 -0000 1.2.2.2 +++ dotqmail.c 20 Nov 2004 01:10:41 -0000 1.2.2.3 @@ -1,6 +1,6 @@ /* * $Id$ - * Copyright (C) 1999-2002 Inter7 Internet Technologies + * Copyright (C) 1999-2004 Inter7 Internet Technologies * * 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 @@ -30,6 +30,7 @@ #undef PACKAGE_TARNAME #undef PACKAGE_VERSION #include "config.h" +#include "dotqmail.h" #include "qmailadmin.h" #include "qmailadminx.h" @@ -132,7 +133,6 @@ int dotqmail_cleanup(char *user, char *line) { int exist = 0; - int i; if (dotqmail_open_files(user)) return(1); Index: template.c =================================================================== RCS file: /cvsroot/qmailadmin/qmailadmin/template.c,v retrieving revision 1.7.2.4 retrieving revision 1.7.2.5 diff -u -d -r1.7.2.4 -r1.7.2.5 --- template.c 14 Nov 2004 18:05:55 -0000 1.7.2.4 +++ template.c 20 Nov 2004 01:10:41 -0000 1.7.2.5 @@ -1,6 +1,6 @@ -/* +/* * $Id$ - * Copyright (C) 1999-2002 Inter7 Internet Technologies, Inc. + * 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 @@ -33,10 +33,20 @@ #undef PACKAGE_TARNAME #undef PACKAGE_VERSION #include <vauth.h> -#include "printh.h" + +#include "alias.h" +#include "autorespond.h" +#include "cgi.h" #include "config.h" +#include "forward.h" +#include "limits.h" +#include "mailinglist.h" +#include "printh.h" #include "qmailadmin.h" #include "qmailadminx.h" +#include "template.h" +#include "user.h" +#include "util.h" static char dchar[4]; void check_user_forward_vacation(char newchar); @@ -62,14 +72,13 @@ int send_template_now(char *filename) { FILE *fs; - FILE *fs_qw; int i; int j; int inchar; - int testint; char *tmpstr; struct stat mystat; char qconvert[11]; + char *fmt; char *qnote = " MB"; struct vqpasswd *vpw; char value[MAX_BUFF]; @@ -114,7 +123,12 @@ break; /* found a tag */ - } else if (inchar == '#') { + } else if ((inchar == '#') || (inchar == '%')) { + if (inchar == '#') + fmt = "%H"; + else + fmt = "%C"; + inchar = fgetc(fs); if (inchar < 0) break; @@ -146,9 +160,9 @@ } break; - /* show the lines inside a alias table */ + /* show the lines inside a alias table (not used, see ##d) */ case 'b': - show_dotqmail_lines(Username,Domain,Mytime,RealDir,"alias"); + show_dotqmail_lines(Username,Domain,Mytime); break; /* send the CGIPATH parameter */ @@ -168,7 +182,7 @@ /* show the lines inside a forward table */ case 'd': - show_dotqmail_lines(Username,Domain,Mytime,RealDir,"forward"); + show_dotqmail_lines(Username,Domain,Mytime); break; /* this will be used to parse mod_mailinglist-idx.html */ @@ -191,7 +205,7 @@ alias_line = valias_select (ActionUser, Domain); /* should verify here that alias_line contains "/autorespond " */ - if (alias_line = valias_select_next()) { + if ( (alias_line = valias_select_next()) ) { strcpy (TmpBuf2, alias_line); /* See if it's a Maildir path rather than address */ @@ -213,7 +227,7 @@ upperit(ActionUser); sprintf(TmpBuf, "%s/message", ActionUser); - if ((fs = fopen(TmpBuf, "r")) == NULL) ack("123", 123); + if ((fs = fopen(TmpBuf, "r")) == NULL) ack("150", TmpBuf); fgets( TmpBuf2, sizeof(TmpBuf2), fs); fgets( TmpBuf2, sizeof(TmpBuf2), fs); @@ -242,7 +256,7 @@ /* show the forwards */ case 'f': if (AdminType == DOMAIN_ADMIN) { - show_forwards(Username,Domain,Mytime,RealDir); + show_forwards(Username,Domain,Mytime); } break; @@ -317,7 +331,7 @@ /* show the aliases stuff */ case 'l': if (AdminType == DOMAIN_ADMIN) { - show_aliases(Username,Domain,Mytime,RealDir); + show_aliases(); } break; @@ -341,7 +355,7 @@ /* show the mailing lists */ case 'm': if (AdminType == DOMAIN_ADMIN) { - show_mailing_lists(Username,Domain,Mytime,RealDir); + show_mailing_lists(Username,Domain,Mytime); } break; @@ -416,7 +430,7 @@ /* show the autoresponder stuff */ case 'r': if (AdminType == DOMAIN_ADMIN) { - show_autoresponders(Username,Domain,Mytime,RealDir); + show_autoresponders(Username,Domain,Mytime); } break; @@ -432,7 +446,7 @@ /* send the time parameter */ case 'T': - printf ("%d", Mytime); + printf ("%u", (unsigned int) Mytime); break; /* transmit block? */ @@ -447,7 +461,7 @@ /* show the users */ case 'u': - show_users(Username,Domain,Mytime,RealDir); + show_users(Username,Domain,Mytime); break; /* show version number */ @@ -508,7 +522,8 @@ * then again, with recent changes, the non-admin shouldn't * even get to this page. */ - long diskquota = 0, maxmsg = 0; + long diskquota = 0; + int maxmsg = 0; char path[256]; vpw = vauth_getpw(Username, Domain); @@ -967,7 +982,7 @@ memset(dir, 0, sizeof(dir)); retval = ""; if ( (vpw = vauth_getpw(Username, Domain)) != NULL ) { - sprintf(dir, "%s/" MAILDIR "/%d.qw", vpw->pw_dir, Mytime); + sprintf(dir, "%s/" MAILDIR "/%u.qw", vpw->pw_dir, (unsigned int) Mytime); fs_qw = fopen(dir, "r"); if ( fs_qw != NULL ) { memset(TmpBuf, 0, sizeof(TmpBuf)); --- NEW FILE: user.h --- /* * $Id: user.h,v 1.1.2.1 2004/11/20 01:10:41 tomcollins Exp $ */ void adduser(); void addusernow(); void bounceall(); int call_hooks(char *hook_type, char *p1, char *p2, char *p3, char *p4); void count_users(); void deleteall(); void deluser(); void delusergo(); void delusernow(); int get_catchall(); void moduser(); void modusergo(); void modusernow(); void setremotecatchall(); void setremotecatchallnow(); void show_users(char *Username, char *Domain, time_t Mytime); int show_user_lines(char *user, char *dom, time_t mytime, char *dir); --- NEW FILE: util.h --- /* * $Id: util.h,v 1.1.2.1 2004/11/20 01:10:41 tomcollins Exp $ */ int check_local_user( char *user ); int fixup_local_name( char *addr ); int check_email_addr( char *addr ); 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 ); void upperit( char *instr ); void ack( char *msg, char *extra ); void show_counts(); /* prototypes for sorting functions in util.c */ int sort_init(); int sort_add_entry (char *, char); 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); int quota_to_bytes(char[], char*); //jhopper prototype int quota_to_megabytes(char[], char*); //jhopper prototype --- NEW FILE: show.h --- /* * $Id: show.h,v 1.1.2.1 2004/11/20 01:10:41 tomcollins Exp $ */ #include <time.h> void show_menu(char *, char *, time_t); void show_login(); --- NEW FILE: template.h --- /* * $Id: template.h,v 1.1.2.1 2004/11/20 01:10:41 tomcollins Exp $ */ int send_template(char *actualfile); int send_template_now(char *filename); --- NEW FILE: dotqmail.h --- /* * $Id: dotqmail.h,v 1.1.2.1 2004/11/20 01:10:41 tomcollins Exp $ */ int dotqmail_delete_files(char *user); int dotqmail_add_line(char *user, char *line); int dotqmail_del_line(char *user, 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); #endif --- NEW FILE: cgi.h --- /* * $Id: cgi.h,v 1.1.2.1 2004/11/20 01:10:41 tomcollins Exp $ */ void get_cgi(); int GetValue (char *, char *, char *, int); Index: qmailadmin.h =================================================================== RCS file: /cvsroot/qmailadmin/qmailadmin/qmailadmin.h,v retrieving revision 1.1.1.1.2.2 retrieving revision 1.1.1.1.2.3 diff -u -d -r1.1.1.1.2.2 -r1.1.1.1.2.3 --- qmailadmin.h 11 Nov 2004 07:21:49 -0000 1.1.1.1.2.2 +++ qmailadmin.h 20 Nov 2004 01:10:41 -0000 1.1.1.1.2.3 @@ -1,5 +1,6 @@ /* - * Copyright (C) 1999-2002 Inter7 Internet Technologies, Inc. + * $Id$ + * 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 @@ -16,6 +17,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ +#include <time.h> + /* Some platforms use '.maildir' instead of 'Maildir' as the mail directory * name. Furture versions of Vpopmail might define it. Until then, change * it below. @@ -43,22 +46,12 @@ #define DOMAIN_ADMIN 2 #define USER_ADMIN 3 - #define NUM_SQL_OPTIONS 6 -char *get_html_text( char *index ); -int open_lang( char *lang); - -int quota_to_bytes(char[], char*); //jhopper prototype -int quota_to_megabytes(char[], char*); //jhopper prototype - -/* prototypes for sorting functions in util.c */ -int sort_init(); -int sort_add_entry (char *, char); -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 del_id_files( char *); +void init_globals(); +/* copied from maildirquota.c in vpopmail + * it really needs to get into vpopmail.h somehow + */ +int readuserquota(const char* dir, long *sizep, int *cntp); Index: ChangeLog =================================================================== RCS file: /cvsroot/qmailadmin/qmailadmin/ChangeLog,v retrieving revision 1.15.2.33 retrieving revision 1.15.2.34 diff -u -d -r1.15.2.33 -r1.15.2.34 --- ChangeLog 18 Nov 2004 01:55:41 -0000 1.15.2.33 +++ ChangeLog 20 Nov 2004 01:10:41 -0000 1.15.2.34 @@ -6,6 +6,13 @@ Tom Collins - Remove unnecessary name attributes in SUBMIT buttons. [869292] - configure.in: Compile with all warnings on. + - Add header files: alias.h auth.h autorespond.h cgi.h command.h + dotqmail.h forward.h limits.h mailinglist.h show.h template.h + user.h util.h. + - Modify .c files to use header files, fix function prototypes, + definitions and calls for consistent parameter passing and + return values. + - Modify code to eliminate all compiler warnings. 1.2.4 - released 15-Nov-04 Index: qmailadmin.c =================================================================== RCS file: /cvsroot/qmailadmin/qmailadmin/qmailadmin.c,v retrieving revision 1.6.2.3 retrieving revision 1.6.2.4 diff -u -d -r1.6.2.3 -r1.6.2.4 --- qmailadmin.c 14 Nov 2004 18:05:55 -0000 1.6.2.3 +++ qmailadmin.c 20 Nov 2004 01:10:41 -0000 1.6.2.4 @@ -1,6 +1,6 @@ /* * $Id$ - * Copyright (C) 1999-2002 Inter7 Internet Technologies, Inc. + * 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 @@ -31,12 +31,22 @@ #undef PACKAGE_STRING #undef PACKAGE_TARNAME #undef PACKAGE_VERSION -#include "config.h" -#include "qmailadmin.h" + #include <vpopmail.h> #include <vauth.h> #include <vlimits.h> +#include "auth.h" +#include "cgi.h" +#include "command.h" +#include "config.h" +#include "limits.h" +#include "printh.h" +#include "qmailadmin.h" +#include "show.h" +#include "user.h" +#include "util.h" + char Username[MAX_BUFF]; char Domain[MAX_BUFF]; char Password[MAX_BUFF]; @@ -95,23 +105,15 @@ char RealDir[156]; char Lang[40]; -void del_id_files( char *); - -main(argc,argv) +int main(argc,argv) int argc; char *argv[]; { - const char *u; - const char *p; const char *ip_addr=getenv("REMOTE_ADDR"); const char *x_forward=getenv("HTTP_X_FORWARDED_FOR"); char *pi; int i,j; char *rm; - time_t time1; - time_t time2; - FILE *fs; - int pid; char returnhttp[MAX_BUFF]; char returntext[MAX_BUFF]; @@ -236,7 +238,7 @@ del_id_files( TmpBuf); Mytime = time(NULL); - snprintf (TmpBuf, sizeof(TmpBuf), "%s/" MAILDIR "/%d.qw", pw->pw_dir, Mytime); + snprintf (TmpBuf, sizeof(TmpBuf), "%s/" MAILDIR "/%u.qw", pw->pw_dir, (unsigned int) Mytime); fs = fopen(TmpBuf, "w"); if ( fs == NULL ) { printf ("%s %s<br>\n", get_html_text("144"), TmpBuf); @@ -270,12 +272,12 @@ } show_login(); vclose(); + + return 0; } -init_globals() +void init_globals() { - int i,j; - struct vqpasswd *pw; char *accept_lang; char *langptr, *qptr; int lang_err; @@ -400,7 +402,6 @@ { DIR *mydir; struct dirent *mydirent; - struct stat statbuf; mydir = opendir(dirname); if ( mydir == NULL ) return; --- NEW FILE: alias.h --- /* * $Id: alias.h,v 1.1.2.1 2004/11/20 01:10:41 tomcollins Exp $ */ void adddotqmail(); void adddotqmailnow(); int adddotqmail_shared(char *forwardname, char *dest, int create); void deldotqmail(); void deldotqmailnow(); char* dotqmail_alias_command(char* command); void moddotqmail(); void moddotqmailnow(); int show_aliases(void); void show_dotqmail_lines(char *user, char *dom, time_t mytime); void show_dotqmail_file(char *user); Index: alias.c =================================================================== RCS file: /cvsroot/qmailadmin/qmailadmin/alias.c,v retrieving revision 1.4.2.10 retrieving revision 1.4.2.11 diff -u -d -r1.4.2.10 -r1.4.2.11 --- alias.c 14 Nov 2004 18:05:54 -0000 1.4.2.10 +++ alias.c 20 Nov 2004 01:10:41 -0000 1.4.2.11 @@ -1,6 +1,6 @@ /* * $Id$ - * Copyright (C) 1999-2002 Inter7 Internet Technologies, Inc. + * 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 @@ -17,6 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ +#include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -34,10 +35,17 @@ #undef PACKAGE_TARNAME #undef PACKAGE_VERSION #include <vauth.h> +#include "alias.h" #include "config.h" +#include "forward.h" #include "qmailadmin.h" #include "qmailadminx.h" +#include "dotqmail.h" +#include "limits.h" +#include "util.h" #include "printh.h" +#include "show.h" +#include "template.h" char* dotqmail_alias_command(char* command); int bkscandir(const char *dirname, @@ -70,7 +78,7 @@ struct aliasentry *firstalias = NULL, *curalias = NULL; -add_alias_entry (char *alias_name, char *alias_command) +void add_alias_entry (char *alias_name, char *alias_command) { if (firstalias == NULL) { firstalias = malloc (sizeof(struct aliasentry)); @@ -92,7 +100,7 @@ return temp; } -show_dotqmail_lines(char *user, char *dom, time_t mytime, char *dir) +void show_dotqmail_lines(char *user, char *dom, time_t mytime) { int moreusers=0; DIR *mydir; @@ -107,7 +115,9 @@ int page; struct dirent **namelist; char this_alias[MAX_FILE_NAME]; +#ifdef VALIAS char *alias_line; +#endif struct stat sbuf; if ( AdminType!=DOMAIN_ADMIN ) { @@ -171,7 +181,7 @@ if ( (mydir = opendir(".")) == NULL ) { printf ("<tr><td colspan=\"4\">"); printf ("%s %d</td></tr>", get_html_text("143"), 1); - return(0); + return; } n = bkscandir(".", &namelist, 0, qa_sort); @@ -184,7 +194,7 @@ /* check for ezmlm lists (file is symbolic link) */ memset (&sbuf, 0, sizeof(sbuf)); if (lstat (mydirent->d_name, &sbuf) == 0) { - if (sbuf.st_mode & S_IFLNK == S_IFLNK) continue; + if ((sbuf.st_mode & S_IFLNK) == S_IFLNK) continue; } if ( (fs=fopen(mydirent->d_name,"r"))==NULL) { @@ -335,7 +345,7 @@ * with the edit mode * */ -int show_dotqmail_file(char *user) +void show_dotqmail_file(char *user) { char alias_user[MAX_BUFF]; char *alias_domain; @@ -391,7 +401,7 @@ printf ("<form method=\"post\" name=\"moddotqmail\" action=\"%s/com/moddotqmailnow\">\n", CGIPATH); printh ("<input type=\"hidden\" name=\"user\" value=\"%H\">\n", Username); printh ("<input type=\"hidden\" name=\"dom\" value=\"%H\">\n", Domain); - printf ("<input type=\"hidden\" name=\"time\" value=\"%i\">\n", Mytime); + printf ("<input type=\"hidden\" name=\"time\" value=\"%u\">\n", (unsigned int) Mytime); printh ("<input type=\"hidden\" name=\"modu\" value=\"%H\">\n", user); printh ("<input type=\"hidden\" name=\"linedata\" value=\"%H\">\n", alias_line); printf ("<input type=\"hidden\" name=\"action\" value=\"delentry\">\n"); @@ -413,7 +423,6 @@ int onevalidonly(char *user) { char *alias_line; - char *alias_name_from_command; int lines; lines=0; @@ -427,7 +436,7 @@ return (lines < 2); } -moddotqmail() +void moddotqmail() { if ( AdminType!=DOMAIN_ADMIN ) { snprintf (StatusMessage, sizeof(StatusMessage), "%s", get_html_text("142")); @@ -437,10 +446,8 @@ send_template("mod_dotqmail.html"); } -moddotqmailnow() +void moddotqmailnow() { - struct vqpasswd *pw; - if ( strcmp(ActionUser,"default")==0) { snprintf (StatusMessage, sizeof(StatusMessage), "%s", get_html_text("142")); vclose(); @@ -484,14 +491,14 @@ } } -adddotqmail() +void adddotqmail() { count_forwards(); load_limits(); if ( MaxForwards != -1 && CurForwards >= MaxForwards ) { snprintf (StatusMessage, sizeof(StatusMessage), "%s %d\n", get_html_text("157"), MaxForwards); - show_menu(); + show_menu(Username, Domain, Mytime); vclose(); exit(0); } @@ -499,10 +506,8 @@ } -adddotqmailnow() +void adddotqmailnow() { - struct vqpasswd *pw; - if (AdminType!=DOMAIN_ADMIN && !(AdminType==USER_ADMIN && strcmp(ActionUser, Username)==0)) { snprintf (StatusMessage, sizeof(StatusMessage), "%s", get_html_text("142")); @@ -528,7 +533,7 @@ } else { snprintf (StatusMessage, sizeof(StatusMessage), "%s\n", get_html_text("152")); - show_forwards(Username,Domain,Mytime,RealDir); + show_forwards(Username,Domain,Mytime); } } @@ -588,7 +593,7 @@ return(0); } -deldotqmail() +void deldotqmail() { if ( AdminType!=DOMAIN_ADMIN ) { @@ -600,7 +605,7 @@ } -deldotqmailnow() +void deldotqmailnow() { if (AdminType!=DOMAIN_ADMIN && @@ -633,7 +638,7 @@ if(CurForwards == 0 && CurBlackholes == 0) { show_menu(Username, Domain, Mytime); } else { - show_forwards(Username,Domain,Mytime,RealDir); + show_forwards(Username,Domain,Mytime); } } Index: user.c =================================================================== RCS file: /cvsroot/qmailadmin/qmailadmin/user.c,v retrieving revision 1.11.2.4 retrieving revision 1.11.2.5 diff -u -d -r1.11.2.4 -r1.11.2.5 --- user.c 14 Nov 2004 18:05:55 -0000 1.11.2.4 +++ user.c 20 Nov 2004 01:10:41 -0000 1.11.2.5 @@ -1,6 +1,6 @@ /* * $Id$ - * Copyright (C) 1999-2002 Inter7 Internet Technologies, Inc. + * 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 @@ -22,6 +22,8 @@ #include <string.h> #include <unistd.h> #include <sys/stat.h> +#include <sys/types.h> +#include <sys/wait.h> #include <unistd.h> #include <pwd.h> #include <dirent.h> @@ -32,9 +34,17 @@ #undef PACKAGE_STRING #undef PACKAGE_TARNAME #undef PACKAGE_VERSION +#include "alias.h" +#include "cgi.h" #include "config.h" +#include "limits.h" +#include "printh.h" #include "qmailadmin.h" #include "qmailadminx.h" +#include "show.h" +#include "template.h" +#include "user.h" +#include "util.h" #include "vpopmail.h" #include "vauth.h" @@ -54,9 +64,9 @@ #define HOOK_LISTDELUSER "dellistuser" #endif -int show_users(char *Username, char *Domain, time_t Mytime) +void show_users(char *Username, char *Domain, time_t Mytime) { - if (MaxPopAccounts == 0) return 0; + if (MaxPopAccounts == 0) return; send_template("show_users.html"); } @@ -159,7 +169,8 @@ (AdminType==USER_ADMIN && strcmp(pw->pw_name,Username)==0)))) { if (AdminType==DOMAIN_ADMIN || (AdminType==USER_ADMIN && strcmp(pw->pw_name,Username)==0)) { - long diskquota = 0, maxmsg = 0; + long diskquota = 0; + int maxmsg = 0; /* display account name and user name */ printf ("<tr bgcolor=%s>", get_color_text("000")); @@ -257,7 +268,7 @@ printf ("<form method=\"get\" action=\"%s/com/showusers\">", CGIPATH); printh ("<input type=\"hidden\" name=\"user\" value=\"%H\">", user); printh ("<input type=\"hidden\" name=\"dom\" value=\"%H\">", dom); - printf ("<input type=\"hidden\" name=\"time\" value=\"%d\">", mytime); + printf ("<input type=\"hidden\" name=\"time\" value=\"%u\">", (unsigned int) mytime); printh ("<input type=\"text\" name=\"searchuser\" value=\"%H\"> ", SearchUser); printf ("<input type=\"submit\" value=\"%s\">", get_html_text("204")); printf ("</form>"); @@ -303,7 +314,7 @@ return 0; } -adduser() +void adduser() { count_users(); load_limits(); @@ -317,7 +328,7 @@ if ( MaxPopAccounts != -1 && CurPopAccounts >= MaxPopAccounts ) { snprintf (StatusMessage, sizeof(StatusMessage), "%s %d\n", get_html_text("199"), MaxPopAccounts); - show_menu(); + show_menu(Username, Domain, Mytime); vclose(); exit(0); } @@ -326,7 +337,7 @@ } -moduser() +void moduser() { if (!( AdminType==DOMAIN_ADMIN || (AdminType==USER_ADMIN && strcmp(ActionUser,Username)==0))){ @@ -337,26 +348,25 @@ send_template( "mod_user.html" ); } -addusernow() +void addusernow() { - char pw[50]; int cnt=0, num; char *c_num; char **mailingListNames; char *tmp; char *email; char **arguments; - char tmpstr[MAX_BUFF]; +#ifdef MODIFY_QUOTA char qconvert[11]; +#endif int pid; - int i; - int tmpint; int error; struct vqpasswd *mypw; - char pw_shell[256]; +#ifdef MODIFY_SPAM char spamvalue[50]; static char NewBuf[156]; FILE *fs; +#endif c_num = malloc(MAX_BUFF); email = malloc(128); @@ -375,7 +385,7 @@ if ( MaxPopAccounts != -1 && CurPopAccounts >= MaxPopAccounts ) { snprintf (StatusMessage, sizeof(StatusMessage), "%s %d\n", get_html_text("199"), MaxPopAccounts); - show_menu(); + show_menu(Username, Domain, Mytime); vclose(); exit(0); } @@ -571,18 +581,15 @@ return (0); } -deluser() +void deluser() { send_template( "del_user_confirm.html" ); } -delusergo() +void delusergo() { static char forward[200] = ""; static char forwardto[200] = ""; - FILE *fs; - int i; - struct vqpasswd *pw; if ( AdminType!=DOMAIN_ADMIN ) { snprintf (StatusMessage, sizeof(StatusMessage), "%s", get_html_text("142")); @@ -611,7 +618,7 @@ show_users(Username, Domain, Mytime); } -count_users() +void count_users() { struct vqpasswd *pw; @@ -623,7 +630,7 @@ } } -setremotecatchall() +void setremotecatchall() { send_template("setremotecatchall.html"); } @@ -643,7 +650,7 @@ exit(0); } -setremotecatchallnow() +void setremotecatchallnow() { GetValue(TmpCGI,Newu, "newu=", sizeof(Newu)); @@ -665,7 +672,7 @@ set_qmaildefault ("delete"); } -int get_catchall(void) +int get_catchall() { int i,j; FILE *fs; @@ -704,18 +711,17 @@ return 0; } -modusergo() +void modusergo() { - char crypted[20]; char *tmpstr; - int i; int ret_code; - int password_updated = 0; struct vqpasswd *vpw=NULL; static char box[500]; static char NewBuf[156]; +#ifdef MODIFY_QUOTA char *quotaptr; char qconvert[11]; +#endif int count; FILE *fs; int spam_check = 0; @@ -941,7 +947,7 @@ snprintf(NewBuf,sizeof(NewBuf),"%s/vacation/message", vpw->pw_dir); GetValue(TmpCGI,Message, "vmessage=",sizeof(Message)); - if ( (fs = fopen(NewBuf, "w")) == NULL ) ack("123", 123); + if ( (fs = fopen(NewBuf, "w")) == NULL ) ack("150", NewBuf); fprintf(fs, "From: %s@%s\n", ActionUser,Domain); fprintf(fs, "Subject: %s\n\n", box); fprintf(fs, "%s", Message); Index: autorespond.c =================================================================== RCS file: /cvsroot/qmailadmin/qmailadmin/autorespond.c,v retrieving revision 1.3.2.2 retrieving revision 1.3.2.3 diff -u -d -r1.3.2.2 -r1.3.2.3 --- autorespond.c 14 Nov 2004 18:05:54 -0000 1.3.2.2 +++ autorespond.c 20 Nov 2004 01:10:41 -0000 1.3.2.3 @@ -1,6 +1,6 @@ /* * $Id$ - * Copyright (C) 1999-2002 Inter7 Internet Technologies, Inc. + * 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 @@ -17,6 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ +#include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -27,17 +28,22 @@ #include <dirent.h> #include <vpopmail.h> #include <vauth.h> +#include "autorespond.h" #include "config.h" +#include "limits.h" +#include "printh.h" #include "qmailadmin.h" #include "qmailadminx.h" +#include "show.h" +#include "template.h" +#include "util.h" -show_autoresponders(user,dom,mytime,dir) +void show_autoresponders(user,dom,mytime) char *user; char *dom; time_t mytime; - char *dir; { - if ( MaxAutoResponders == 0 ) return(0); + if ( MaxAutoResponders == 0 ) return; count_autoresponders(); @@ -49,12 +55,12 @@ } } -int show_autorespond_line(char *user, char *dom, time_t mytime, char *dir) +void show_autorespond_line(char *user, char *dom, time_t mytime, char *dir) { char *addr; char alias_name[MAX_FILE_NAME]; char *alias_line; - int i,j; + int i; sort_init(); @@ -68,7 +74,7 @@ sort_dosort(); - for (i = 0; addr = sort_get_entry(i); ++i) { + for (i = 0; (addr = sort_get_entry(i)); ++i) { printf ("<tr>"); printf ("<td align=\"center\">"); @@ -90,7 +96,7 @@ sort_cleanup(); } -addautorespond() +void addautorespond() { if ( AdminType!=DOMAIN_ADMIN ) { @@ -103,7 +109,7 @@ load_limits(); if ( MaxAutoResponders != -1 && CurAutoResponders >= MaxAutoResponders ) { printf ("%s %d\n", get_html_text("158"), MaxAutoResponders); - show_menu(); + show_menu(Username, Domain, Mytime); vclose(); exit(0); } @@ -112,11 +118,9 @@ } -addautorespondnow() +void addautorespondnow() { FILE *fs; - int i; - struct vqpasswd *vpw; if ( AdminType!=DOMAIN_ADMIN ) { snprintf (StatusMessage, sizeof(StatusMessage), "%s", get_html_text("142")); @@ -128,7 +132,7 @@ load_limits(); if ( MaxAutoResponders != -1 && CurAutoResponders >= MaxAutoResponders ) { printf ("%s %d\n", get_html_text("158"), MaxAutoResponders); - show_menu(); + show_menu(Username, Domain, Mytime); vclose(); exit(0); } @@ -179,7 +183,7 @@ * Make the autoresponder message file */ sprintf(TmpBuf, "%s/message", TmpBuf2); - if ( (fs = fopen(TmpBuf, "w")) == NULL ) ack("123", 123); + if ( (fs = fopen(TmpBuf, "w")) == NULL ) ack("150", TmpBuf); fprintf(fs, "From: %s@%s\n", ActionUser,Domain); fprintf(fs, "Subject: %s\n\n", Alias); fprintf(fs, "%s", Message); @@ -193,7 +197,7 @@ show_autoresponders(Username, Domain, Mytime); } -delautorespond() +void delautorespond() { if ( AdminType!=DOMAIN_ADMIN ) { snprintf (StatusMessage, sizeof(StatusMessage), "%s", get_html_text("142")); @@ -203,10 +207,9 @@ send_template( "del_autorespond_confirm.html" ); } -delautorespondnow() +void delautorespondnow() { int i; - int pid; if ( AdminType!=DOMAIN_ADMIN ) { snprintf (StatusMessage, sizeof(StatusMessage), "%s", get_html_text("142")); @@ -240,7 +243,7 @@ } } -modautorespond() +void modautorespond() { if ( AdminType!=DOMAIN_ADMIN ) { snprintf (StatusMessage, sizeof(StatusMessage), "%s", get_html_text("142")); @@ -252,11 +255,9 @@ /* addautorespondnow and modautorespondnow should be merged into a single function */ -modautorespondnow() +void modautorespondnow() { FILE *fs; - int i; - struct vqpasswd *vpw; if ( AdminType!=DOMAIN_ADMIN ) { snprintf (StatusMessage, sizeof(StatusMessage), "%s", get_html_text("142")); @@ -306,7 +307,7 @@ * Make the autoresponder message file */ sprintf(TmpBuf, "%s/message", TmpBuf2); - if ( (fs = fopen(TmpBuf, "w")) == NULL ) ack("123", 123); + if ( (fs = fopen(TmpBuf, "w")) == NULL ) ack("150", TmpBuf); fprintf(fs, "From: %s@%s\n", ActionUser,Domain); fprintf(fs, "Subject: %s\n\n", Alias); fprintf(fs, "%s", Message); @@ -320,7 +321,7 @@ show_autoresponders(Username, Domain, Mytime); } -count_autoresponders() +void count_autoresponders() { char alias_name[MAX_FILE_NAME]; char *alias_line; Index: util.c =================================================================== RCS file: /cvsroot/qmailadmin/qmailadmin/util.c,v retrieving revision 1.4.2.2 retrieving revision 1.4.2.3 diff -u -d -r1.4.2.2 -r1.4.2.3 --- util.c 14 Nov 2004 18:05:55 -0000 1.4.2.2 +++ util.c 20 Nov 2004 01:10:41 -0000 1.4.2.3 @@ -1,6 +1,6 @@ /* * $Id$ - * Copyright (C) 1999-2002 Inter7 Internet Technologies, Inc. + * 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 @@ -25,9 +25,20 @@ #include <unistd.h> #include <pwd.h> #include <dirent.h> +#include <ctype.h> + +#include <vpopmail.h> + +#include "alias.h" +#include "autorespond.h" #include "config.h" +#include "forward.h" +#include "mailinglist.h" #include "qmailadmin.h" #include "qmailadminx.h" +#include "printh.h" +#include "user.h" +#include "util.h" extern FILE *lang_fs; extern FILE *color_table; @@ -72,6 +83,7 @@ } *sort_ptr++ = 0; /* NULL terminator */ memleft -= len; + return 0; } char *sort_get_entry(int index) { @@ -109,7 +121,7 @@ printf ("</td>\n"); } -check_local_user( user ) +int check_local_user( user ) char *user; { struct stat buf; @@ -133,7 +145,7 @@ return(0); } -show_counts() +void show_counts() { count_users(); count_forwards(); @@ -146,7 +158,7 @@ printf ("%s = %d<BR>\n", get_html_text("080"), CurMailingLists); } -check_email_addr( addr ) +int check_email_addr( addr ) char *addr; { char *taddr = addr; @@ -179,7 +191,7 @@ return(0); } -fixup_local_name( addr ) +int fixup_local_name( addr ) char *addr; { char *taddr = addr; @@ -205,17 +217,17 @@ return(0); } -ack(msg, c) +void ack(msg, extra) char *msg; - int c; + char *extra; { - printf ("%s\n", msg); - printf ("</BODY></HTML>\n", msg); + printf ("%s %s\n", get_html_text(msg), extra); + printf ("</BODY></HTML>\n"); vclose(); exit(0); } -upperit( instr ) +void upperit( instr ) char *instr; { while(*instr!=0) { @@ -354,11 +366,10 @@ return value: 0 for success, 1 for failure */ int quota_to_bytes(char returnval[], char *quota) { - char *tmpstr; double tmp; if (quota == NULL) { return 1; } - if (tmp = atof(quota)) { + if ((tmp = atof(quota))) { tmp *= 1048576; sprintf(returnval, "%.0lf", tmp); return 0; @@ -372,7 +383,6 @@ return value: 0 for success, 1 for failure */ int quota_to_megabytes(char *returnval, char *quota) { - char *tmpstr; double tmp; int i; @@ -382,7 +392,7 @@ tmp = atol(quota); /* already in megabytes */ } else if ((quota[i-1] == 'K') || (quota[i-1] == 'k')) { tmp = atol(quota) * 1024; /* convert kilobytes to megabytes */ - } else if (tmp = atol(quota)) { + } else if ((tmp = atol(quota))) { tmp /= 1048576.0; } else { strcpy (returnval, ""); --- NEW FILE: auth.h --- /* * $Id: auth.h,v 1.1.2.1 2004/11/20 01:10:41 tomcollins Exp $ */ void auth_system (const char *ip_addr, struct vqpasswd *pw); void auth_user_domain (const char *ip_addr, struct vqpasswd *pw); void set_admin_type(); Index: qmailadminx.h =================================================================== RCS file: /cvsroot/qmailadmin/qmailadmin/qmailadminx.h,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -d -r1.2.2.1 -r1.2.2.2 --- qmailadminx.h 24 Apr 2004 01:06:40 -0000 1.2.2.1 +++ qmailadminx.h 20 Nov 2004 01:10:41 -0000 1.2.2.2 @@ -1,5 +1,6 @@ /* - * Copyright (C) 1999-2002 Inter7 Internet Technologies, Inc. + * $Id$ + * 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 @@ -15,6 +16,9 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ +#include <sys/types.h> +#include <unistd.h> +#include <stdio.h> #include <vauth.h> #include <vlimits.h> @@ -75,8 +79,4 @@ extern int Gid; extern char RealDir[156]; -extern char *strstart(); -extern char *safe_getenv(); extern char Lang[40]; -void del_id_files( char *); -int open_lang( char *lang); Index: cgi.c =================================================================== RCS file: /cvsroot/qmailadmin/qmailadmin/cgi.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -d -r1.2.2.1 -r1.2.2.2 --- cgi.c 14 Nov 2004 18:05:54 -0000 1.2.2.1 +++ cgi.c 20 Nov 2004 01:10:41 -0000 1.2.2.2 @@ -1,6 +1,6 @@ /* * $Id$ - * Copyright (C) 1999-2002 Inter7 Internet Technologies, Inc. + * 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 @@ -25,11 +25,14 @@ #include <unistd.h> #include <pwd.h> #include <dirent.h> +#include <ctype.h> #include "config.h" #include "qmailadmin.h" #include "qmailadminx.h" +#include "cgi.h" +#include "util.h" -get_cgi() +void get_cgi() { int count; int i,j; @@ -88,8 +91,8 @@ } else if (source[j+1]=='0'&&source[j+2]=='A'){ dest[k] = '\n'; } else { - dest[k] = (CGIValues[source[j+1]]<<4) + - CGIValues[source[j+2]]; + dest[k] = (CGIValues[(int) source[j+1]]<<4) + + CGIValues[(int) source[j+2]]; } j += 2; } else if ( source[j] == '+' ) { --- NEW FILE: autorespond.h --- /* * $Id: autorespond.h,v 1.1.2.1 2004/11/20 01:10:41 tomcollins Exp $ */ #include <time.h> void addautorespond(); void addautorespondnow(); void count_autoresponders(); 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); Index: auth.c =================================================================== RCS file: /cvsroot/qmailadmin/qmailadmin/auth.c,v retrieving revision 1.3.2.3 retrieving revision 1.3.2.4 diff -u -d -r1.3.2.3 -r1.3.2.4 --- auth.c 14 Nov 2004 18:05:54 -0000 1.3.2.3 +++ auth.c 20 Nov 2004 01:10:41 -0000 1.3.2.4 @@ -1,6 +1,6 @@ /* * $Id$ - * Copyright (C) 1999-2002 Inter7 Internet Technologies, Inc. + * 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 @@ -30,11 +30,14 @@ #include "qmailadminx.h" #include <vpopmail.h> #include <vauth.h> +#include "cgi.h" +#include "show.h" +#include "util.h" -extern char *crypt(); +//extern char *crypt(); -auth_system(ip_addr, pw) - char *ip_addr; +void auth_system(ip_addr, pw) + const char *ip_addr; struct vqpasswd *pw; { FILE *fs; @@ -87,8 +90,8 @@ } } -auth_user_domain(ip_addr,pw) - char *ip_addr; +void auth_user_domain(ip_addr,pw) + const char *ip_addr; struct vqpasswd *pw; { FILE *fs; @@ -143,7 +146,7 @@ } -set_admin_type() +void set_admin_type() { struct vqpasswd *vpw=NULL; |