aboutsummaryrefslogtreecommitdiffstats
path: root/patches
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem.moulin@fripost.org>2012-09-22 16:43:38 +0200
committerGuilhem Moulin <guilhem.moulin@fripost.org>2012-09-24 15:13:14 +0200
commit4239920246a5123644fd7a778b467aa371f990e6 (patch)
tree0113d4df774bb04b23a712dc47317d6bb30cf5e0 /patches
parent8d76ab3fcff608c82d5c43ad87ec8988b69478b3 (diff)
Custom patches for the list managers.
Diffstat (limited to 'patches')
-rw-r--r--patches/mailman.patch76
-rw-r--r--patches/schleuder.patch99
-rw-r--r--patches/webschleuder.patch160
3 files changed, 335 insertions, 0 deletions
diff --git a/patches/mailman.patch b/patches/mailman.patch
new file mode 100644
index 0000000..1688e69
--- /dev/null
+++ b/patches/mailman.patch
@@ -0,0 +1,76 @@
+diff -u mailman/Mailman/HTMLFormatter.py vhost/Mailman/HTMLFormatter.py
+--- mailman/Mailman/HTMLFormatter.py
++++ vhost/Mailman/HTMLFormatter.py
+@@ -382,7 +382,8 @@
+ d = {
+ '<mm-mailman-footer>' : self.GetMailmanFooter(),
+ '<mm-list-name>' : self.real_name,
+- '<mm-email-user>' : self._internal_name,
++ '<mm-email-user>' : self.local_part,
++ '<mm-complete-name>' : self.internal_name(),
+ '<mm-list-description>' : Utils.websafe(self.description),
+ '<mm-list-info>' :
+ '<!---->' + BR.join(self.info.split(NL)) + '<!---->',
+diff -u mailman/Mailman/MailList.py vhost/Mailman/MailList.py
+--- mailman/Mailman/MailList.py
++++ vhost/Mailman/MailList.py
+@@ -253,7 +253,7 @@
+ # Using "local_part" here works for both site wide lists on
+ # the default url host and for vhost lists on the vhost url host.
+ return Utils.ScriptURL(scriptname, self.web_page_url, absolute) + \
+- '/' + self.local_part
++ '/' + self._internal_name
+
+ def GetOptionsURL(self, user, obscure=0, absolute=0):
+ url = self.GetScriptURL('options', absolute)
+diff -u mailman/Mailman/Archiver/Archiver.py vhost/Mailman/Archiver/Archiver.py
+--- mailman/Mailman/Archiver/Archiver.py
++++ vhost/Mailman/Archiver/Archiver.py
+@@ -162,7 +162,7 @@
+ if hostname == mm_cfg.DEFAULT_URL_HOST:
+- fullname = self.local_part
++ fullname = self._internal_name
+ else:
+- fullname = os.path.join(hostname, self.local_part)
++ fullname = os.path.join(hostname, self._internal_name)
+ url = mm_cfg.PUBLIC_ARCHIVE_URL % {
+ 'listname': fullname,
+ 'hostname': hostname
+diff -u mailman/Mailman/Handlers/Decorate.py vhost/Mailman/Handlers/Decorate.py
+--- mailman/Mailman/Handlers/Decorate.py
++++ vhost/Mailman/Handlers/Decorate.py
+@@ -221,7 +221,7 @@
+ d = SafeDict({'real_name' : mlist.real_name,
+ 'list_name' : mlist.local_part,
+ # For backwards compatibility
+- '_internal_name': mlist.local_part,
++ '_internal_name': mlist._internal_name,
+ 'host_name' : mlist.host_name,
+ 'web_page_url' : mlist.web_page_url,
+ 'description' : mlist.description,
+diff -u lib/bin/postfix-to-mailman.py vhost/bin/postfix-to-mailman.py
+--- mailman/bin/postfix-to-mailman.py
++++ vhost/bin/postfix-to-mailman.py
+@@ -111,6 +111,11 @@
+ 'mailman_destination_recipient_limit=1 '
+ 'in main.cf?')
+ sys.exit(EX_USAGE)
++ try:
++ l,d = local.split('#',2)
++ local = '%s@%s' % (l,d)
++ except ValueError:
++ l,d = local, None
+
+ # Redirect required addresses to
+ if local in ('postmaster', 'abuse', 'mailer-daemon'):
+@@ -140,8 +145,9 @@
+ '-subscribe',
+ '-unsubscribe',
+ ):
+- if local.endswith(ext):
+- mlist = local[:-len(ext)]
++ if l.endswith(ext):
++ mlist = l[:-len(ext)]
++ if d: mlist = '%s@%s' % (mlist,d)
+ func = ext[1:]
+ break
diff --git a/patches/schleuder.patch b/patches/schleuder.patch
new file mode 100644
index 0000000..c9b6799
--- /dev/null
+++ b/patches/schleuder.patch
@@ -0,0 +1,99 @@
+diff -u usr/bin/schleuder dev/bin/schleuder
+--- usr/bin/schleuder
++++ usr/dev/schleuder
+@@ -44,8 +44,12 @@
+ arg = ARGV.shift
+ if arg == '-test'
+ process_test(ARGV)
+- elsif arg =~ /[A-Za-z0-9]+/
+- process_list(arg.gsub(/-(sendkey|bounces)$/, ''))
++ elsif arg =~ /[A-Za-z0-9]+/
++ l,d = arg.split('#')
++ l = l.gsub(/-(sendkey|bounce)$/, '')
++ list = l
++ list += '@' + d unless d.nil?
++ process_list(list)
+ else
+ usage
+ end
+diff -u usr/bin/schleuder-newlist dev/bin/schleuder-newlist
+--- usr/bin/schleuder-newlist
++++ dev/bin/schleuder-newlist
+@@ -128,17 +128,19 @@
+ end
+
+ # Verify init member
+- Schleuder.log.debug "Verifying init member..."
+- list_initmember = ListCreator::verify_emailvar(
+- args[:list_initmember] || '',
+- interactive,
+- "Email address of the lists' initial member"
+- )
+- list_initmemberkey = ListCreator::verify_filevar(
+- args[:list_initmemberkey] || '',
+- interactive,
+- "the public key of the lists' initial member"
+- )
++ unless args[:list_initmember].nil? and args[:list_initmemberkey].nil? and !interactive
++ Schleuder.log.debug "Verifying init member..."
++ list_initmember = ListCreator::verify_emailvar(
++ args[:list_initmember],
++ interactive,
++ "Email address of the lists' initial member"
++ )
++ list_initmemberkey = ListCreator::verify_filevar(
++ args[:list_initmemberkey],
++ interactive,
++ "the public key of the lists' initial member"
++ )
++ end
+ Schleuder.log.debug "Arguments verified..."
+
+ Schleuder.log.debug "Initialize list..."
+@@ -162,10 +164,8 @@
+ Schleuder.log.debug "Import list's keypair..."
+ ListCreator::import_keypair(list,list_privatekeyfile,list_publickeyfile)
+ end
+- if (list_initmember != 'none' and list_initmemberkey != 'none') then
+- Schleuder.log.debug "Add initmember to list..."
+- ListCreator::add_init_member(list,list_initmember,list_initmemberkey)
+- end
++ Schleuder.log.debug "Add initmember to list..."
++ ListCreator::add_init_member(list,list_initmember,list_initmemberkey)
+ # store the config
+ Schleuder.log.debug "Store list config..."
+ list.config = list.config
+@@ -185,8 +185,12 @@
+ end
+
+ def self.add_init_member(list,list_initmember,list_initmemberkey)
+- Schleuder::Crypt.new(list.config.gpg_password).add_key_from_file(list_initmemberkey)
+- list.members = Array.new(1,Schleuder::Member.new({ :email => list_initmember }))
++ if list_initmember.nil?
++ list.members = Array.new
++ else
++ Schleuder::Crypt.new(list.config.gpg_password).add_key_from_file(list_initmemberkey) unless list_initmemberkey.nil?
++ list.members = Array.new(1,Schleuder::Member.new({ :email => list_initmember }))
++ end
+ end
+
+ def self.verify_strvar(var,interactive,question)
+diff -u usr/lib/ruby/1.8/schleuder/list.rb dev/lib/ruby/1.8/schleuder/list.rb
+--- usr/lib/ruby/1.8/schleuder/list.rb
++++ dev/lib/ruby/1.8/schleuder/list.rb
+@@ -31,12 +31,13 @@
+ file = File.join(@listdir, Schleuder.config.lists_memberfile)
+ @log.debug("reading #{file}")
+ @_members = []
+- YAML::load_file(file).each do |h|
++ yaml = YAML::load_file(file)
++ yaml.each do |h|
+ unless h.kind_of? Schleuder::Member
+ h = Schleuder::Member.new(h)
+ end
+ @_members << h
+- end
++ end unless yaml.nil?
+ end
+ @_members
+ end
diff --git a/patches/webschleuder.patch b/patches/webschleuder.patch
new file mode 100644
index 0000000..397a17d
--- /dev/null
+++ b/patches/webschleuder.patch
@@ -0,0 +1,160 @@
+diff --git a/contrib/enable_webschleuder.rb b/contrib/enable_webschleuder.rb
+old mode 100644
+new mode 100755
+index 32e20c6..f72dd94
+--- a/contrib/enable_webschleuder.rb
++++ b/contrib/enable_webschleuder.rb
+@@ -40,17 +40,18 @@ class EnableWebschleuder
+
+ def self.usage
+ puts "Usage:
+-#{File.basename($0)} listname password (-encrypted) (-override)"
++#{File.basename($0)} listname [-encrypted] [-override]"
+ exit 1
+ end
+ end
+
+ listname = ARGV.shift
+-password = ARGV.shift
+-EnableWebschleuder.usage unless listname and password
++EnableWebschleuder.usage unless listname
+ encrypted = override = false
+ while nextarg = ARGV.shift
+ encrypted = (nextarg == '-encrypted') unless encrypted
+ override = (nextarg == '-override') unless override
+ end
+-EnableWebschleuder.enable(listname,password,encrypted,override)
++print "Password for list" + listname + '' if STDIN.fcntl(Fcntl::F_GETFL, 0) != 0
++password = gets
++EnableWebschleuder.enable(listname,password.chomp,encrypted,override)
+diff --git a/webschleuder.rb b/webschleuder.rb
+index c90db2f..6259836 100755
+--- a/webschleuder.rb
++++ b/webschleuder.rb
+@@ -23,8 +23,8 @@ require 'webschleuder/errors'
+
+
+ module Webschleuder
+- set :secret, Webschleuder::Models::WebConfig.loadconfig.session_secret
+ include Camping::Session
++ secret Webschleuder::Models::WebConfig.loadconfig.session_secret
+
+ def r404(path)
+ "Sorry, but I can't find #{path}."
+diff --git a/webschleuder/controllers.rb b/webschleuder/controllers.rb
+index c84348c..4e85625 100755
+--- a/webschleuder/controllers.rb
++++ b/webschleuder/controllers.rb
+@@ -21,7 +21,7 @@ module Webschleuder::Controllers
+ end
+ end
+
+- class Login < R '/([^/]*)/login'
++ class Login < R '/schleuder/([^/]*)/login'
+ def get(listname)
+ prepare
+ @myself = self
+@@ -48,7 +48,7 @@ module Webschleuder::Controllers
+ end
+ end
+
+- class Logout < R '/([^/]*)/logout'
++ class Logout < R '/schleuder/([^/]*)/logout'
+ def get(listname)
+ return unless authenticate
+ $list = nil
+@@ -60,7 +60,7 @@ module Webschleuder::Controllers
+ end
+ end
+
+- class ListIndex < R '/([^/?]+)'
++ class ListIndex < R '/schleuder/([^/?]+)'
+ def get(listname)
+ return unless authenticate
+ @myself = self
+@@ -69,7 +69,7 @@ module Webschleuder::Controllers
+ end
+ end
+
+- class Index < R '/'
++ class Index < R '/schleuder/'
+ def get()
+ prepare
+ # catch get-params from startpage-jumpform
+@@ -83,7 +83,7 @@ module Webschleuder::Controllers
+ end
+ end
+
+- class Users < R '/([^/]*)/users'
++ class Users < R '/schleuder/([^/]*)/users'
+ def get(listname)
+ return unless authenticate
+ @users = User.loadusers
+@@ -123,7 +123,7 @@ module Webschleuder::Controllers
+ end
+ end
+
+- class Listconfig < R '/([^/]*)/listconfig'
++ class Listconfig < R '/schleuder/([^/]*)/listconfig'
+ def get(listname)
+ return unless authenticate
+ @config = SchleuderConfig.loadlistconfig
+@@ -162,7 +162,7 @@ module Webschleuder::Controllers
+ end
+ end
+
+- class Keys < R '/([^/]*)/keys', '/([^/]*)/keys/([^/]*)', '/([^/]*)/keys/([^/]*)/(.*)'
++ class Keys < R '/schleuder/([^/]*)/keys', '/schleuder/([^/]*)/keys/([^/]*)', '/schleuder/([^/]*)/keys/([^/]*)/(.*)'
+ def get(listname, action=nil, keyid=nil)
+ return unless authenticate
+ case action
+@@ -238,7 +238,7 @@ module Webschleuder::Controllers
+ end
+ end
+
+- class Password < R '/([^/]*)/password'
++ class Password < R '/schleuder/([^/]*)/password'
+
+ def get(listname)
+ return unless authenticate
+diff --git a/webschleuder/helpers.rb b/webschleuder/helpers.rb
+index 3aafedc..2f619cd 100755
+--- a/webschleuder/helpers.rb
++++ b/webschleuder/helpers.rb
+@@ -1,3 +1,4 @@
++require "rack/utils"
+ module Webschleuder::Helpers
+
+ def prepare
+@@ -7,16 +8,14 @@ module Webschleuder::Helpers
+ # TODO: further input parsing (against XSS etc.)
+ #
+ # what does the request look like?
+- request = @env['REQUEST_URI'].split('/')
+- # throw away first element as it is empty
+- request.shift
++ request = @env['REQUEST_URI'].gsub(/^\/schleuder\//,'').split('/')
+
+ $appconf = Webschleuder::Models::SchleuderConfig.loadconfig
+ $webappconf = Webschleuder::Models::WebConfig.loadconfig
+
+ @state.flash = {:info => [], :error => []} unless @state.flash.is_a?Hash
+
+- listname = request.first || ''
++ listname = Rack::Utils.unescape(request.first || '')
+ listdir = File.join($appconf.lists_dir, listname)
+
+ if !listname.empty? and File.directory?(listdir)
+diff --git a/webschleuder/webschleuder_config.rb b/webschleuder/webschleuder_config.rb
+index 08f595b..b89004f 100644
+--- a/webschleuder/webschleuder_config.rb
++++ b/webschleuder/webschleuder_config.rb
+@@ -47,7 +47,7 @@ module Webschleuder
+ private
+
+ def _write(data,filename)
+- if File.open(filename, 'w') { |f| f << data }
++ if File.open(filename, File::WRONLY|File::CREAT, 0600) { |f| f << data }
+ true
+ else
+ false