-
Notifications
You must be signed in to change notification settings - Fork 154
/
deliver-notify-zephyr.patch
94 lines (87 loc) · 3 KB
/
deliver-notify-zephyr.patch
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
This is a patch to deliver to make zephyr notifications more verbose.
Naturally it requires zephyr. It sends zephyrs to everyone on the acl.
Please note that if you're at a large site (like us) your zephyr servers
will have problems with this patch due to the constant zephyrgrams going
out.
I have lost the name of the author for this patch; my apologies to this
person.
*** deliver.c.orig Wed Jun 11 12:43:44 1997
--- deliver.c Wed Jun 11 15:08:41 1997
***************
*** 597,603 ****
else if (notifyptr &&
(!strncasecmp(buf, "from:", 5) ||
!strncasecmp(buf, "subject:", 8) ||
! !strncasecmp(buf, "to:", 3))) {
if (!*notifyptr) *notifyptr = xstrdup(buf);
else {
*notifyptr =
--- 597,604 ----
else if (notifyptr &&
(!strncasecmp(buf, "from:", 5) ||
!strncasecmp(buf, "subject:", 8) ||
! !strncasecmp(buf, "to:", 3) ||
! !strncasecmp(buf, "cc:", 3))) {
if (!*notifyptr) *notifyptr = xstrdup(buf);
else {
*notifyptr =
***************
*** 682,687 ****
--- 683,689 ----
{
int r;
struct mailbox mailbox;
+ char *mbxacl=(char *)0;
char namebuf[MAX_MAILBOX_PATH];
char notifybuf[MAX_MAILBOX_PATH];
char *submailbox = 0;
***************
*** 740,755 ****
prot_rewind(msg);
r = append_fromstream(&mailbox, msg, size, time(0), flag, nflags,
user);
mailbox_close(&mailbox);
}
if (!r && user) {
! strcpy(notifybuf, "INBOX");
! if (submailbox) {
! strcat(notifybuf, ".");
! strcat(notifybuf, submailbox);
}
! notify(user, notifybuf, notifyheader ? notifyheader : "");
}
if (!r && dupelim && id) markdelivered(id, user ? namebuf : mailboxname);
--- 742,776 ----
prot_rewind(msg);
r = append_fromstream(&mailbox, msg, size, time(0), flag, nflags,
user);
+ mbxacl=strdup(mailbox.acl);
mailbox_close(&mailbox);
}
if (!r && user) {
! struct auth_state *auth_anyone;
! char *anyone="anyone";
! char *pseudouser;
! int amr;
!
! anyone=auth_canonifyid(anyone);
! auth_anyone=auth_newstate(anyone,(char*)0);
!
! amr=acl_myrights(auth_anyone,mbxacl);
! if (amr & ACL_READ) {
! strcpy(notifybuf, user);
! pseudouser=strdup("");
! } else {
! strcpy(notifybuf, "INBOX");
! if (submailbox) {
! strcat(notifybuf, ".");
! strcat(notifybuf, submailbox);
! }
! pseudouser=strdup(user);
}
! notify(pseudouser, notifybuf, notifyheader ? notifyheader : "");
! auth_freestate(auth_anyone);
! free(pseudouser);
! free(mbxacl);
}
if (!r && dupelim && id) markdelivered(id, user ? namebuf : mailboxname);