-
Notifications
You must be signed in to change notification settings - Fork 1
/
newbox-0.80
51 lines (45 loc) · 1.86 KB
/
newbox-0.80
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
The following script allows POP3 users to create up to four
sub-mailboxes. It goes into .qmail-newbox-default. All they have to
do is send mail to $USER-newbox-BOXNAME. The subject and body of the
mail are ignored. A similar script to delete a mailbox could be
written, but it not safe since anyone can forge mail.
This script goes along with the patch to checkpassword included below.
It allows POP3 users to log in using a sub-mailbox name
(e.g. nelson-qmail) and their usual password.
|if [ "X$SENDER" != "X$USER@$HOST" ]; then echo "Sorry, only $USER@$HOST can create mailboxes"; exit 1; fi
|if [ `ls -d Maildir-*|wc -l` -ge 4 ]; then echo "Sorry, no more than four mailboxes per user"; exit 1; fi
|if [ -f "Maildir-$EXT2" ]; then echo "Sorry, a plain file named Maildir-$EXT2 already exists"; exit 1; fi
|if [ -d "Maildir-$EXT2/new" ]; then echo "Sorry, Maildir named Maildir-$EXT2 already exists"; exit 1; fi
|maildirmake "Maildir-$EXT2" && echo "./Maildir-$EXT2/">.qmail-$EXT2 && chmod 644 .qmail-$EXT2
|(echo "Subject: new mailbox";echo "To: $USER";echo "";echo "Your mailbox, $USER-$EXT2@$HOST, has been created") | qmail-inject -h
--- checkpassword.c.orig Sun Jan 17 16:04:23 1999
+++ checkpassword.c Sun Jan 17 16:03:43 1999
@@ -68,6 +68,7 @@
char **argv;
{
char *login;
+ char *ext;
char *password;
char *encrypted;
int r;
@@ -96,6 +97,22 @@
password = up + i;
if (i == uplen) _exit(2);
while (up[i++]) if (i == uplen) _exit(2);
+ /* beginning of addition by rnn */
+ ext = login;
+ while(*ext && *ext != '-') ext++;
+ if (*ext)
+ {
+ char *newarg;
+
+ *ext++ = 0;
+ newarg = (char *) malloc(strlen(argv[argc-1]) + 1 + strlen(ext) + 1);
+ if (!newarg) _exit(111);
+ strcpy(newarg, argv[argc-1]);
+ strcat(newarg, "-");
+ strcat(newarg, ext);
+ argv[argc-1] = newarg;
+ }
+ /* end of addition by rnn */
doit(login);