From dave at badgers-in-foil.co.uk Thu Jun 12 22:06:54 2003
From: dave at badgers-in-foil.co.uk (David Holroyd)
Date: Thu, 12 Jun 2003 22:06:54 +0000
Subject: [cvsspam-devel] The CVSspam-development list
Message-ID: <20030612220654.GA15470@vhost.badgers-in-foil.co.uk>
This list is a forum for public discussion of the CVSspam project,
hosted at,
http://www.badgers-in-foil.co.uk/projects/cvsspam/
Send us an email to report a bug, suggest an improvement or contribute
code of your own to CVSspam.
List administrator,
David Holroyd
From Aaron.Korver at Fiserv.com Tue Jun 24 15:10:12 2003
From: Aaron.Korver at Fiserv.com (Korver, Aaron)
Date: Tue, 24 Jun 2003 10:10:12 -0500
Subject: [cvsspam-devel] New development ideas
Message-ID: <0205C50D41B7D611AEA50002A537CEC2215C49@DES10MS01>
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C33A62.B5B01E10
Content-Type: text/plain;
charset="iso-8859-1"
In similar fashion to activitymail I wanted to add a parameter (-f --from)
to the command that takes the ${USER} variable. This variable is recognized
by cvs and will be replaced with the name of the user who is commiting the
file. The reason for doing this is so that the e-mail messages have the
correct aliased user in the from field.
A little background, at my company I admin the CVS server, all developers
have access to the repository via a pserver connection. However, there is
just one Linux user named cvsUser. Then, in the passwd file I have aliased
all of our users to this one Linux user. Thus, all emails come from
cvsUser.
After looking at activitymail I saw that they pass in the ${USER} in the
loginfo script and that it gets resolved correctly. So here is what I've
done to start implementing this.
Changes marked with a +
cvsspam.rb changes----
opts = GetoptLong.new(
[ "--to", "-t", GetoptLong::REQUIRED_ARGUMENT ],
[ "--config", "-c", GetoptLong::REQUIRED_ARGUMENT ],
+ [ "--from", "-f", GetoptLong::REQUIRED_ARGUMENT ],
[ "--debug", "-d", GetoptLong::NO_ARGUMENT ]
)
opts.each do |opt, arg|
$recipients << arg if opt=="--to"
$config = arg if opt=="--config"
$debug = true if opt=="--debug"
+ $userfrom << arg if opt=="--from"
end
........
if ENV['REMOTE_HOST']
# TODO: I think this will always be an IP address. If a hostname is
# possible, it may need encoding of some kind,
mail.puts("X-Originating-IP: [#{ENV['REMOTE_HOST']}]")
end
+ mail.puts("From: #{$userfrom.join(',')}")
collect_diffs.rb changes-----
opts = GetoptLong.new(
[ "--to", "-t", GetoptLong::REQUIRED_ARGUMENT ],
[ "--config", "-c", GetoptLong::REQUIRED_ARGUMENT ],
+ [ "--from", "-f", GetoptLong::REQUIRED_ARGUMENT ],
[ "--debug", "-d", GetoptLong::NO_ARGUMENT ]
)
# arguments to pass though to 'cvsspam.rb'
$passthoughArgs = Array.new
opts.each do |opt, arg|
+ if ["--to", "--config", "--from"].include?(opt)
$passthoughArgs << opt << arg
end
if ["--debug"].include?(opt)
$passthoughArgs << opt
end
$config = arg if opt=="--config"
$debug = true if opt == "--debug"
end
Sorry that it's not in diff format. Anyway, I tested this straight from the
command line and it works great. The problem is that when I stick it into
the loginfo file as a parameter it comes back as an empty string. Thus, I'm
looking for any ideas on how to fix this and get that ${USER} variable to be
passed through. It has been stumping me since it seems to work fine from
the command line on the server, but remotely it doesn't.
Cheers.
Aaron Korver
------_=_NextPart_001_01C33A62.B5B01E10
Content-Type: text/html;
charset="iso-8859-1"
In similar fashion
to activitymail I wanted to add a parameter (-f --from) to the command that
takes the ${USER} variable. This variable is recognized by cvs and will be
replaced with the name of the user who is commiting the file. The reason
for doing this is so that the e-mail messages have the correct aliased user in
the from field.
A little background,
at my company I admin the CVS server, all developers have access to the
repository via a pserver connection. However, there is just one Linux user
named cvsUser. Then, in the passwd file I have aliased all of our
users to this one Linux user. Thus, all emails come from cvsUser.
After looking at
activitymail I saw that they pass in the ${USER} in the loginfo script and that
it gets resolved correctly. So here is what I've done to start
implementing this.
Changes marked with
a +
cvsspam.rb changes----
opts = GetoptLong.new(
[
"--to", "-t", GetoptLong::REQUIRED_ARGUMENT ],
[ "--config", "-c", GetoptLong::REQUIRED_ARGUMENT ],
+ [ "--from", "-f",
GetoptLong::REQUIRED_ARGUMENT ],
[ "--debug", "-d",
GetoptLong::NO_ARGUMENT ]
)
opts.each do |opt, arg|
$recipients
<< arg if opt=="--to"
$config = arg if opt=="--config"
$debug = true if opt=="--debug"
+
$userfrom << arg if opt=="--from"
end
........
if
ENV['REMOTE_HOST']
# TODO: I think this will always be an
IP address. If a hostname is
# possible, it may need
encoding of some kind,
mail.puts("X-Originating-IP:
[#{ENV['REMOTE_HOST']}]")
end
+ mail.puts("From:
#{$userfrom.join(',')}")
collect_diffs.rb
changes-----
opts =
GetoptLong.new(
[ "--to", "-t",
GetoptLong::REQUIRED_ARGUMENT ],
[ "--config", "-c",
GetoptLong::REQUIRED_ARGUMENT ],
+ [ "--from", "-f",
GetoptLong::REQUIRED_ARGUMENT ],
[ "--debug", "-d",
GetoptLong::NO_ARGUMENT ]
)
# arguments to pass
though to 'cvsspam.rb'
$passthoughArgs = Array.new
opts.each do |opt,
arg|
+ if ["--to", "--config",
"--from"].include?(opt)
$passthoughArgs << opt
<< arg
end
if
["--debug"].include?(opt)
$passthoughArgs <<
opt
end
$config = arg if opt=="--config"
$debug =
true if opt == "--debug"
end
Sorry that it's not in diff format. Anyway, I tested
this straight from the command line and it works great. The problem is
that when I stick it into the loginfo file as a parameter it comes back as an
empty string. Thus, I'm looking for any ideas on how to fix this and get
that ${USER} variable to be passed through. It has been stumping me since
it seems to work fine from the command line on the server, but remotely it
doesn't.
Cheers.
Aaron Korver
------_=_NextPart_001_01C33A62.B5B01E10--
From dave at badgers-in-foil.co.uk Tue Jun 24 16:33:52 2003
From: dave at badgers-in-foil.co.uk (David Holroyd)
Date: Tue, 24 Jun 2003 16:33:52 +0000
Subject: [cvsspam-devel] New development ideas
In-Reply-To: <0205C50D41B7D611AEA50002A537CEC2215C49@DES10MS01>
References: <0205C50D41B7D611AEA50002A537CEC2215C49@DES10MS01>
Message-ID: <20030624163351.GD28850@vhost.badgers-in-foil.co.uk>
On Tue, Jun 24, 2003 at 10:10:12AM -0500, Korver, Aaron wrote:
...
> After looking at activitymail I saw that they pass in the ${USER} in the
> loginfo script and that it gets resolved correctly. So here is what I've
> done to start implementing this.
Looks great, though I don't think we need to allow for multiple From
addresses ;)
> Sorry that it's not in diff format. Anyway, I tested this straight from the
> command line and it works great. The problem is that when I stick it into
> the loginfo file as a parameter it comes back as an empty string. Thus, I'm
> looking for any ideas on how to fix this and get that ${USER} variable to be
> passed through. It has been stumping me since it seems to work fine from
> the command line on the server, but remotely it doesn't.
I'll try to have a play with that and see if I can work out what's going
on. Until I get the chance to do that...
- Try changing the loginfo entry to just 'echo "USER is ${USER}"' and
see what appears on your console when you commit
- I think the recipient list is initialised with an Array.new, I don't
see similar initialisation of the $from variable, so using '<<' on it
might not work as expected?
dave
From dave at badgers-in-foil.co.uk Tue Jun 24 23:40:58 2003
From: dave at badgers-in-foil.co.uk (David Holroyd)
Date: Tue, 24 Jun 2003 23:40:58 +0000
Subject: [cvsspam-devel] New development ideas
In-Reply-To: <20030624163351.GD28850@vhost.badgers-in-foil.co.uk>
References: <0205C50D41B7D611AEA50002A537CEC2215C49@DES10MS01> <20030624163351.GD28850@vhost.badgers-in-foil.co.uk>
Message-ID: <20030624234058.GA7855@vhost.badgers-in-foil.co.uk>
--PEIAKu/WMn1b1Hv9
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
On Tue, Jun 24, 2003 at 04:33:52PM +0000, David Holroyd wrote:
> On Tue, Jun 24, 2003 at 10:10:12AM -0500, Korver, Aaron wrote:
> > Sorry that it's not in diff format. Anyway, I tested this straight from the
> > command line and it works great. The problem is that when I stick it into
> > the loginfo file as a parameter it comes back as an empty string. Thus, I'm
> > looking for any ideas on how to fix this and get that ${USER} variable to be
> > passed through. It has been stumping me since it seems to work fine from
> > the command line on the server, but remotely it doesn't.
>
> I'll try to have a play with that and see if I can work out what's going
> on.
Try the attached patch (I can supply the full file if you prefer). If it
works for you, I'll probably include this functionality in the next version.
Thanks for the suggestion,
dave
--PEIAKu/WMn1b1Hv9
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="allow_from_address-patch.diff"
Index: cvsspam.rb
===================================================================
RCS file: /var/lib/cvs/cvsspam/cvsspam.rb,v
retrieving revision 1.26
diff -u -r1.26 cvsspam.rb
--- cvsspam.rb 23 Jun 2003 01:10:41 -0000 1.26
+++ cvsspam.rb 24 Jun 2003 23:37:31 -0000
@@ -844,21 +844,25 @@
$task_keywords = ['TODO', 'FIXME']
$bugzillaURL = nil
$jiraURL = nil
+$from_address = nil
require 'getoptlong'
opts = GetoptLong.new(
[ "--to", "-t", GetoptLong::REQUIRED_ARGUMENT ],
[ "--config", "-c", GetoptLong::REQUIRED_ARGUMENT ],
- [ "--debug", "-d", GetoptLong::NO_ARGUMENT ]
+ [ "--debug", "-d", GetoptLong::NO_ARGUMENT ],
+ [ "--from", "-u", GetoptLong::REQUIRED_ARGUMENT ]
)
opts.each do |opt, arg|
$recipients << arg if opt=="--to"
$config = arg if opt=="--config"
$debug = true if opt=="--debug"
+ $from_address = arg if opt=="--from"
end
+puts "from addres: #{$from_address}";
if ARGV.length != 1
if ARGV.length > 1
@@ -967,6 +985,7 @@
IO.popen("#{$sendmail_prog} -t", "w") do |mail|
mail.puts("To: #{$recipients.join(',')}")
encoder.encode_header(mail, "Subject", mailSubject)
+ mail.puts("From: #{$from_address}") if $from_address
mail.puts("MIME-Version: 1.0")
mail.puts("Content-Type: text/html" + ($charset.nil? ? "" : "; charset=\"#{$charset}\""))
if ENV['REMOTE_HOST']
Index: collect_diffs.rb
===================================================================
RCS file: /var/lib/cvs/cvsspam/collect_diffs.rb,v
retrieving revision 1.11
diff -u -r1.11 collect_diffs.rb
--- collect_diffs.rb 15 Jun 2003 23:20:06 -0000 1.11
+++ collect_diffs.rb 24 Jun 2003 23:39:00 -0000
@@ -258,13 +258,14 @@
opts = GetoptLong.new(
[ "--to", "-t", GetoptLong::REQUIRED_ARGUMENT ],
[ "--config", "-c", GetoptLong::REQUIRED_ARGUMENT ],
- [ "--debug", "-d", GetoptLong::NO_ARGUMENT ]
+ [ "--debug", "-d", GetoptLong::NO_ARGUMENT ],
+ [ "--from", "-u", GetoptLong::REQUIRED_ARGUMENT ]
)
# arguments to pass though to 'cvsspam.rb'
$passthoughArgs = Array.new
opts.each do |opt, arg|
- if ["--to", "--config"].include?(opt)
+ if ["--to", "--config", "--from"].include?(opt)
$passthoughArgs << opt << arg
end
if ["--debug"].include?(opt)
--PEIAKu/WMn1b1Hv9--
From Aaron.Korver at Fiserv.com Wed Jun 25 14:37:13 2003
From: Aaron.Korver at Fiserv.com (Korver, Aaron)
Date: Wed, 25 Jun 2003 09:37:13 -0500
Subject: [cvsspam-devel] Yippee it works!
Message-ID: <0205C50D41B7D611AEA50002A537CEC2215C4F@DES10MS01>
Very cool David, it works nicely now. No more complaining from the people
here that they have to actually go to the website to see who did the
commit!! :-)
I think that for my first time coding in Ruby that I came pretty close..LOL.
Hmm....what functionality to add next?? Oh and please do add this in the
next version, I think it would be a nice to have.
Two more things,
First, is the link on the website for the archives supposed to show stuff
yet? Because it pulls up a blank page for me.
Second, I choose the digest for the mailing list, and it had a hard time
with my e-mail since I'm sent it in HTML. This message is just plain text
so maybe it will handle it better.
Cheers
Aaron Korver
From dave at badgers-in-foil.co.uk Wed Jun 25 15:09:56 2003
From: dave at badgers-in-foil.co.uk (David Holroyd)
Date: Wed, 25 Jun 2003 15:09:56 +0000
Subject: [cvsspam-devel] Yippee it works!
In-Reply-To: <0205C50D41B7D611AEA50002A537CEC2215C4F@DES10MS01>
References: <0205C50D41B7D611AEA50002A537CEC2215C4F@DES10MS01>
Message-ID: <20030625150956.GA20886@vhost.badgers-in-foil.co.uk>
On Wed, Jun 25, 2003 at 09:37:13AM -0500, Korver, Aaron wrote:
> I think that for my first time coding in Ruby that I came pretty close..LOL.
...and the tangle of code to be read to get there; ieee!
> Hmm....what functionality to add next?? Oh and please do add this in the
> next version, I think it would be a nice to have.
I've commited that change.
Something to think about: There's a file, CVSROOT/users, that can be
used to configure email addresses on a per-user basis (it's used by the
cvs notify functions). I think that this info should also be used if
available, though I've not worked out the details yet. Do you use this
file at your site?
Also, I think I'll include some code for adding filenames to the mail
subjects -- something you asked about before. (Don't want that myself,
but I aim to please ;) I need play with some code I was given.
> Two more things,
> First, is the link on the website for the archives supposed to show stuff
> yet? Because it pulls up a blank page for me.
In my efforts to prevent people's email addresses appearing on the web,
I seem to have broken the archiver (add /2003-June/ to the end of the URL
and you'll see the very-last post, but that's it). I'll try and fix soon.
> Second, I choose the digest for the mailing list, and it had a hard time
> with my e-mail since I'm sent it in HTML. This message is just plain text
> so maybe it will handle it better.
I'm just using the version of Mailman in Debian/stable. I think later
releases of Mailman have better MIME support, but I don't want to
upgrade unless it causes bigger problems.
dave
From dave at badgers-in-foil.co.uk Wed Jun 25 22:22:18 2003
From: dave at badgers-in-foil.co.uk (David Holroyd)
Date: Wed, 25 Jun 2003 22:22:18 +0000
Subject: [cvsspam-devel] Yippee it works!
In-Reply-To: <20030625150956.GA20886@vhost.badgers-in-foil.co.uk>
References: <0205C50D41B7D611AEA50002A537CEC2215C4F@DES10MS01> <20030625150956.GA20886@vhost.badgers-in-foil.co.uk>
Message-ID: <20030625222218.GA27250@vhost.badgers-in-foil.co.uk>
On Wed, Jun 25, 2003 at 03:09:56PM +0000, David Holroyd wrote:
> On Wed, Jun 25, 2003 at 09:37:13AM -0500, Korver, Aaron wrote:
> > First, is the link on the website for the archives supposed to show stuff
> > yet? Because it pulls up a blank page for me.
>
> In my efforts to prevent people's email addresses appearing on the web,
> I seem to have broken the archiver (add /2003-June/ to the end of the URL
> and you'll see the very-last post, but that's it). I'll try and fix soon.
The list's mbox was missing. No idea why. I've recreated it from my
personal copes of the messages and rebuilt the archive.
dave