Re: [vchkpw] disable quota support entirely

2003-09-27 Thread X-Istence
Notes: untested as i dont have a box to test this on. It does compile properly, i suggest first testing it, and then using it on a production server. 
This should basically do what you asked for :)

diff:
Breached# diff vdelivermail.c /usr/home/main/public_html/random/vdelivermail.c
475a476
/* quota section removed for the purpose that we dont want it to drop any email at all
533a535,537
Close the comments section removing the entire quota */



vdelivermail.c:
/*
* Copyright (C) 1999-2002 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 files */
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include "config.h"
#include "vpopmail.h"
#include "vauth.h"
#include "maildirquota.h"
#ifdef MAKE_SEEKABLE
#include "seek.h"
#endif
/* Globals */
#define AUTH_SIZE 300
char TheUser[AUTH_SIZE];
char TheUserFull[AUTH_SIZE];
char TheDomain[AUTH_SIZE];
char TheDomainDir[AUTH_SIZE];
uid_t TheDomainUid;
gid_t TheDomainGid;
char TheDir[AUTH_SIZE];
char CurrentDir[AUTH_SIZE];
char DeliveredTo[AUTH_SIZE];
struct vqpasswd *vpw;
off_t message_size = 0;
char bounce[AUTH_SIZE];
int CurrentQuotaSizeFd;
#ifdef QMAIL_EXT
/* the User with '-' and following chars out if any */
char TheUserExt[AUTH_SIZE]; 
#endif

#define FILE_SIZE 156
char hostname[FILE_SIZE];
char loop_buf[FILE_SIZE];
#define MSG_BUF_SIZE 5000
char msgbuf[MSG_BUF_SIZE];
#define BUFF_SIZE 300
int fdm;
static char *binqqargs[4];
char *maildir_to_email(char *maildir);
#define QUOTA_WARN_PERCENT 90

/* from qmail's wait.h for run_command() */
#define wait_exitcode(w) ((w) >> 8)
/* Forward declarations */
int process_valias(void);
int is_delete(char *deliverto);
int is_bounce(char *deliverto);
void get_arguments(int argc, char **argv);
off_t get_message_size();
int deliver_mail(char *address, char *quota);
int check_forward_deliver(char *dir);
off_t count_dir(char *dir_name);
int is_looping( char *address );
void run_command(char *prog);
void checkuser(void);
void usernotfound(void);
int is_loop_match( char *dt, char *address);
int deliver_quota_warning(const char *dir, const char *q);
static char local_file[156];
static char local_file_new[156];
/* 
* The email message comes in on file descriptor 0 - stanard in
* The user to deliver the email to is in the EXT environment variable
* The domain to deliver the email to is in the HOST environment variable
*/
int main(int argc, char **argv)
{
   /* get the arguments to the program and setup things */
   get_arguments(argc, argv);

#ifdef VALIAS
   /* process valiases if configured */
   if ( process_valias() == 1 ) {
   printf("vdelivermail: valiases processed\n");
   vexit(0);
   /* if the database is down, deferr */
   } else if ( verrori == VA_NO_AUTH_CONNECTION ) {
   vexit(111);
   }
#endif

   /* get the user from vpopmail database */
   if ((vpw=vauth_getpw(TheUser, TheDomain)) != NULL ) {
   checkuser();
   } 

#ifdef QMAIL_EXT
   /* try and find user that matches the QmailEXT address if: no user found,
* and the QmailEXT address is different, meaning there was an extension 
*/
   else if ( strncmp(TheUser, TheUserExt, AUTH_SIZE) != 0 ) {
   /* get the user from vpopmail database */
   if ((vpw=vauth_getpw(TheUserExt, TheDomain)) != NULL ) {
   checkuser();
   } else {
   usernotfound();
   }
   }
#endif

  /* Additions by Steve Fulton - [EMAIL PROTECTED] 
   * - added error code handling for error codes generated by Autoresponder
   * 99 = deliver mail
   * 100 = bounce mail
   */ 

   else if ( verrori == 100) 
	vexit(100);	

   else if ( verrori == 99) 
	vexit(0);

  /* End of additions by Steve Fulton */

   else {
   if ( verrori != 0 ) {
   vexit(111);
   }
   usernotfound();
   } 

   /* exit successfully and have qmail delete the email */
   return(vexit(0));
   
}

/* 
* Get the command line arguments and the environment variables.
* Force addresses to be lower case and set the default domain
*/
void get_arguments(int argc, char **argv)
{
char *tmpstr; 
int i;

   if (argc != 3) {
   printf("vdelivermail: invalid syntax in .qmail-default file\n");
   /* exit with temporary error */
   vexit(111);
   }
   /* get the last parameter in the .qmail-default fil

Re: [vchkpw] disable quota support entirely

2003-09-27 Thread X-Istence
Jeremy Kister wrote:

I need to disable vpopmail's quota support entirely -- can someone make a
parameter for compile time ?
the maildir++ support is not working correctly in my environment, so I do
not want vpopmail to ever send a quota warning message to the user, nor ever
bounce email, nor keep track of the maildir size.
but I do want to have the "supposed-to-be" quota in the vpasswd file,
because I want qmailadmin to read "2.00 / 15.00" instead of "2.00 /
unlimited" (or such).
I have written my own quota checking program, if anyone is interested,
located at http://www.jeremykister.com/jeremy/code/perl/mailquota.pl


Jeremy Kister
www.jeremykister.com
Argus:  The World's Most Advanced Monitoring Software:
http://argus.tcp4me.com
 

I would think this would require vdelivermail to be edited. I dont know 
if i can make this a compile time parameter, but i sure could check the 
source and remove where it checks the amount of space used. You would 
then have to remove the old file, and put this one in place.

Jan-Willem Regeer