From: Henne Vogelsang <hvogel@opensuse.org>
To: mlmmj@mlmmj.org
Subject: [PATCH] access log handling
Date: Thu, 25 Jan 2007 13:53:42 +0000 [thread overview]
Message-ID: <20070125135342.GD20540@suse.de> (raw)
[-- 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) {
next reply other threads:[~2007-01-25 13:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-25 13:53 Henne Vogelsang [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-02-20 22:52 [PATCH] access log handling Morten K. Poulsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070125135342.GD20540@suse.de \
--to=hvogel@opensuse.org \
--cc=mlmmj@mlmmj.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox