leaks in vchkpw.c

2000-10-27 Thread Brian Kolaci


In the file vchkpw.c:

around line 386, in the function "host_in_locals(domain)"

There's a memory and file pointer leak.

OLD:

int host_in_locals(domain)
 char *domain;
{
 int i;
char *tmpbuf;
FILE *fs;

tmpbuf = malloc(slen(QMAILDIR) + 18 );

sprintf(tmpbuf, "%s/control/locals", QMAILDIR);
fs = fopen(tmpbuf,"r");
if ( fs == NULL ) {
return(0);
}

while( fgets(tmpbuf,200,fs) != NULL ) {
for(i=0;tmpbuf[i]!=0;++i) if (tmpbuf[i]=='\n') tmpbuf[i]=0;
if ( sstrcmp( domain, tmpbuf ) == 0 ) {
return(1);
}
if ( sstrcmp(domain, "localhost") == 0 
 strstr(domain,"localhost") != NULL ) {
return(1);
}
}

fclose(fs);
return(0);
}


NEW:

int host_in_locals(domain)
 char *domain;
{
 int i;
char *tmpbuf;
FILE *fs;

tmpbuf = malloc(slen(QMAILDIR) + 18 );

sprintf(tmpbuf, "%s/control/locals", QMAILDIR);
fs = fopen(tmpbuf,"r");
if ( fs == NULL ) {
free(tmpbuf);
return(0);
}

while( fgets(tmpbuf,200,fs) != NULL ) {
for(i=0;tmpbuf[i]!=0;++i) if (tmpbuf[i]=='\n') tmpbuf[i]=0;
if ( sstrcmp( domain, tmpbuf ) == 0 ) {
free(tmpbuf);
fclose(fs);
return(1);
}
if ( sstrcmp(domain, "localhost") == 0 
 strstr(domain,"localhost") != NULL ) {
free(tmpbuf);
fclose(fs);
return(1);
}
}

free(tmpbuf);
fclose(fs);
return(0);
}




Backing up email for user ??

2000-10-27 Thread Simon Hung



Dear All,

 I would like to know, is there a way 
to backing up user email in vpopmail ? I'm using Qmail + vpopmail + 
courier-imap,Our userwon't erase any old mail, and keep mail for 2 
years. Due to the lack of storage spaces, can I backup all user email between a 
time period and just keep the lastest mail for 6 Months ??

 Or, do you have any better approach 
for me ?

Best Rgds,
Simon Hung