[vchkpw] Problem adjusting vpopmail.c in 5.4.4

2004-06-09 Thread Christopher Tarricone
I am currently upgrading from 5.3.30 to 5.4.4. Everything worked great
except a little piece of custom code that I use for SPAM filtering. It saves
me from having to run maildirmake after every user is added. Everything
compiles and installs nicely, however when I do a ./vadduser [EMAIL PROTECTED]
I get
foo/
Maildir/
new/
cur/
tmp/

What I was hoping for was:
foo/
Maildir/
courierimapsubscribed
new/
cur/
tmp/
.JunkMail/
new/
cur/
tmp/


I have included the source for what I am doing currently and have done in
the past. Any help would be appreciated.


At line 2389 I add (my e-mail client wrapped some lines):

if (mkdir(.JunkMail,VPOPMAIL_DIR_MODE) == -1) { chdir(calling_dir);
return(-1); }
if (chdir(.JunkMail) == -1) { chdir(calling_dir); return(-1); }
if (mkdir(cur,VPOPMAIL_DIR_MODE) == -1) { chdir(calling_dir); return(-1);
}
if (mkdir(new,VPOPMAIL_DIR_MODE) == -1) { chdir(calling_dir); return(-1);
}
if (mkdir(tmp,VPOPMAIL_DIR_MODE) == -1) { chdir(calling_dir); return(-1);
}
chdir(..);

if ( (fs = fopen(courierimapsubscribed, w+))==NULL) {
   free(courierimapsubscribed);
   return(0);
   printf (Error creating IMAP subscribe file.\n);
} else {
   fprintf(fs, INBOX.Sent\n);
   fprintf(fs, INBOX.Trash\n);
   fprintf(fs, INBOX.Drafts\n);
   fprintf(fs, INBOX.JunkMail\n);
   fclose(fs);
}



I this currently works under 5.3.30 in the form of:

* BEGIN:  Create .JunkMail IMAP folder and IMAP subscribe file */
 if (mkdir(.JunkMail,VPOPMAIL_DIR_MODE) == -1){
   chdir(tmpbuf); free(tmpbuf); free(tmpdir);
   printf(make_user_dir: error 3\n);
   return(NULL);
 }

 if (chdir(.JunkMail) == -1) {
   chdir(tmpbuf); free(tmpbuf); free(tmpdir);
   printf(make_user_dir: error 4\n);
   return(NULL);
 }

 if (mkdir(cur,VPOPMAIL_DIR_MODE) == -1) {
   chdir(tmpbuf); free(tmpbuf); free(tmpdir);
   printf(make_user_dir: error 5\n);
   return(NULL);
 }

 if (mkdir(new,VPOPMAIL_DIR_MODE) == -1) {
   chdir(tmpbuf); free(tmpbuf); free(tmpdir);
   printf(make_user_dir: error 6\n);
   return(NULL);
 }

 if (mkdir(tmp,VPOPMAIL_DIR_MODE) == -1) {
   chdir(tmpbuf); free(tmpbuf); free(tmpdir);
   printf(make_user_dir: error 7\n);
   return(NULL);
 }

 chdir(..);
 
 if ( (fs = fopen(courierimapsubscribed, w+))==NULL) {
   free(courierimapsubscribed);
   return(0);
   printf (Error creating IMAP subscribe file.\n);
 } else {
   fprintf(fs, INBOX.Sent\n);
   fprintf(fs, INBOX.Trash\n);
   fprintf(fs, INBOX.Drafts\n);
   fprintf(fs, INBOX.JunkMail\n);
   fclose(fs);
 }
/* END:  Create .JunkMail IMAP folder and IMAP subscribe file */



junkmail.diff.txt
Description: Mac BinHex archive


Re: [vchkpw] Problem adjusting vpopmail.c in 5.4.4

2004-06-09 Thread Tom Collins
On Jun 9, 2004, at 8:24 AM, Christopher Tarricone wrote:
What I was hoping for was:
foo/
Maildir/
courierimapsubscribed
new/
cur/
tmp/
.JunkMail/
new/
cur/
tmp/
I have included the source for what I am doing currently and have done 
in
the past. Any help would be appreciated.
It's even easier now.
Look in the source for this:
 const char *dirnames[] = {Maildir, Maildir/new, Maildir/cur,
Maildir/tmp};
And update it like so:
 const char *dirnames[] = {Maildir, Maildir/new, Maildir/cur,
Maildir/tmp, .JunkMail, .JunkMail/new, .JunkMail/cur,
.JunkMail/tmp};
The courierimapsubscribed code should work as included -- consider 
removing the chdir though so you don't mess up the rest of the code.

Also take a look at http://vpopmail.sf.net/. in the patches section I 
think there's code to copy a skeleton directory for new users.

--
Tom Collins  -  [EMAIL PROTECTED]
QmailAdmin: http://qmailadmin.sf.net/  Vpopmail: http://vpopmail.sf.net/
Info on the Sniffter hand-held Network Tester: http://sniffter.com/


RE: [vchkpw] Problem adjusting vpopmail.c in 5.4.4

2004-06-09 Thread Roger Lipscombe
Tom Collins wrote:
 Also take a look at http://vpopmail.sf.net/. in the patches
 section I
 think there's code to copy a skeleton directory for new users.

Ah, that'd be useful: I currently have a script that wraps vadduser, rather
than hacking on the source, so this'd make more sense.

Cheers,
Roger.



Re: [vchkpw] Problem adjusting vpopmail.c in 5.4.4

2004-06-09 Thread Christopher Tarricone
 On Jun 9, 2004, at 8:24 AM, Christopher Tarricone wrote:
 What I was hoping for was:
 foo/
 Maildir/
 courierimapsubscribed
 new/
 cur/
 tmp/
 .JunkMail/
 new/
 cur/
 tmp/
 
 
 I have included the source for what I am doing currently and have done
 in
 the past. Any help would be appreciated.
 
 It's even easier now.
 
 Look in the source for this:
 
 const char *dirnames[] = {Maildir, Maildir/new, Maildir/cur,
Maildir/tmp};
 
 And update it like so:
 
 const char *dirnames[] = {Maildir, Maildir/new, Maildir/cur,
Maildir/tmp, .JunkMail, .JunkMail/new, .JunkMail/cur,
.JunkMail/tmp};
 
 The courierimapsubscribed code should work as included -- consider
 removing the chdir though so you don't mess up the rest of the code.
 
 Also take a look at http://vpopmail.sf.net/. in the patches section I
 think there's code to copy a skeleton directory for new users.
 
 --
 Tom Collins  -  [EMAIL PROTECTED]
 QmailAdmin: http://qmailadmin.sf.net/  Vpopmail: http://vpopmail.sf.net/
 Info on the Sniffter hand-held Network Tester: http://sniffter.com/
 


That did it!!! Thank you


 



Re: [vchkpw] Problem adjusting vpopmail.c in 5.4.4

2004-06-09 Thread Christopher Tarricone
 Tom Collins wrote:
 Also take a look at http://vpopmail.sf.net/. in the patches
 section I
 think there's code to copy a skeleton directory for new users.
 
 Ah, that'd be useful: I currently have a script that wraps vadduser, rather
 than hacking on the source, so this'd make more sense.
 
 Cheers,
 Roger.
 
 

Here is the working diff



junkmail.diff.txt
Description: Mac BinHex archive