* [PATCH] access log handling
@ 2007-01-25 13:53 Henne Vogelsang
0 siblings, 0 replies; 2+ messages in thread
From: Henne Vogelsang @ 2007-01-25 13:53 UTC (permalink / raw)
To: mlmmj
[-- Attachment #1: Type: text/plain, Size: 667 bytes --]
Hi peepz,
i would like to move logging about access rules to the operation log. I
think this is clearly mlm related and has nothing to do with the mail
setup. A usecase for me is that i can expose the operation log to
listowners via a webfrontend. I wouldnt be comfortable doing that with
the systems mail log.
Also i cleaned up my previous additions to the log string. There was a
bug so that it always printed rule #0 and the from was not included
(which makes it a pita to find out why a specific user/mail was denied
access).
Patch attached.
Henne
--
Henne Vogelsang, Teamlead Core Services
"Rules change. The Game remains the same."
- Omar (The Wire)
[-- Attachment #2: mlmmj-log.patch --]
[-- Type: text/x-patch, Size: 1451 bytes --]
--- src/mlmmj-process.c
+++ src/mlmmj-process.c
@@ -64,6 +64,7 @@
regex_t regexp;
unsigned int not;
enum action act;
+ char* str;
struct rule_list *next;
};
@@ -167,7 +168,7 @@
}
-static enum action do_access(struct strlist *rule_strs, struct strlist *hdrs)
+static enum action do_access(struct strlist *rule_strs, struct strlist *hdrs, const char* from, const char *listdir)
{
int i;
unsigned int match;
@@ -189,7 +190,7 @@
new_rule->next = head;
head = new_rule;
- rule_ptr = rule_strs->strs[i];
+ new_rule->str = rule_ptr = rule_strs->strs[i];
if (strncmp(rule_ptr, "allow", 5) == 0) {
rule_ptr += 5;
new_rule->act = ALLOW;
@@ -284,8 +285,9 @@
break;
}
- log_error(LOG_ARGS, "A mail was %s by rule #%d",
- logstr, rule_nr);
+ log_oper(listdir, OPLOGFNAME, "mlmmj-process: access "
+ "A mail with header \"%s\" from %s was %s by rule #%d \"%s\"",
+ hdrs->strs[i], from, logstr, rule_nr, rule->str);
ret = rule->act;
free_rules(head);
return ret;
@@ -812,7 +814,7 @@
enum action accret;
/* Don't send a mail about denial to the list, but silently
* discard and exit. Also do this in case it's turned off */
- accret = do_access(access_rules, &allheaders);
+ accret = do_access(access_rules, &allheaders, fromemails.emaillist[0], listdir);
if (accret == DENY) {
if ((strcasecmp(listaddr, fromemails.emaillist[0]) ==
0) || noaccessdenymails) {
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] access log handling
@ 2007-02-20 22:52 Morten K. Poulsen
0 siblings, 0 replies; 2+ messages in thread
From: Morten K. Poulsen @ 2007-02-20 22:52 UTC (permalink / raw)
To: mlmmj
Hi Henne,
Henne Vogelsang <hvogel@opensuse.org> wrote:
> i would like to move logging about access rules to the operation log. I
> think this is clearly mlm related and has nothing to do with the mail
> setup. A usecase for me is that i can expose the operation log to
> listowners via a webfrontend. I wouldnt be comfortable doing that with
> the systems mail log.
I agree.
> Patch attached.
When I looked at your patch (and do_access()) I realised that the code
was over-engineered (shame on me), so I simplified it a lot. I also
added even more logging. Now it logs every action taken by do_access()
in the operation log and errors are also logged in the mail log.
http://mlmmj.mmj.dk/~mortenp/patch-mlmmj-1.2.13-access.diff
Morten
--
Morten K. Poulsen <morten@afdelingp.dk>
http://www.afdelingp.dk/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-02-20 22:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-25 13:53 [PATCH] access log handling Henne Vogelsang
-- strict thread matches above, loose matches on Subject: below --
2007-02-20 22:52 Morten K. Poulsen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.