Fix a few typos introduced in last commit + case sensitivity due to dirty LDAP entries

This commit is contained in:
Timothée Floure 2018-06-28 17:53:31 +02:00
parent cc21e41d4a
commit ddf8cb7f78

View file

@ -50,21 +50,21 @@ def main
if (match.size > 0) if (match.size > 0)
entry = match.first entry = match.first
members = entry.uniquemember.map do |dn| members = entry.uniquemember.map do |dn|
/mail=([^,]+),/.match(dn).values_at(1).first /mail=([^,]+),/.match(dn).values_at(1).first.downcase
end end
puts "OK" puts "OK"
puts "Found #{entry.dn} with #{members.size} members" puts "Found #{entry.dn} with #{members.size} members"
print "Searchin mlmmj... " print "Searchin mlmmj... "
mlmmj_list_binary = conf["mlmmj"]["list_binary"]
mlmmj_basepath = conf["mlmmj"]["basepath"]
list = "#{mlmmj_basepath}/#{cn}@#{domain}"
if (File.executable?(mlmmj_list_binary)) if (File.executable?(mlmmj_list_binary))
mlmmj_list_binary = conf["mlmmj"]["list_binary"]
mlmmj_basepath = conf["mlmmj"]["basepath"]
list = "#{mlmmj_basepath}/#{cn}@#{domain}"
raw = %x(#{mlmmj_list_binary} -L #{list} -s) raw = %x(#{mlmmj_list_binary} -L #{list} -s)
if ($?.exitstatus == 0) if ($?.exitstatus == 0)
purs "OK" puts "OK"
subscribers = raw.split("\n") subscribers = raw.split("\n")
puts "Found #{cn}@#{domain} with #{subscribers.size} subscribers" puts "Found #{cn}@#{domain} with #{subscribers.size} subscribers"
print "\n" print "\n"
@ -75,7 +75,7 @@ def main
if (subscribers.include?(m)) if (subscribers.include?(m))
subscribers.delete(m) subscribers.delete(m)
else else
puts "Adding #{m}... " print "Adding #{m}... "
mlmmj_sub_binary = conf["mlmmj"]["sub_binary"] mlmmj_sub_binary = conf["mlmmj"]["sub_binary"]
%x(#{mlmmj_sub_binary} -L #{list} -a #{m} -q -f -s) %x(#{mlmmj_sub_binary} -L #{list} -a #{m} -q -f -s)
if ($?.exitstatus == 0) if ($?.exitstatus == 0)
@ -88,9 +88,9 @@ def main
# Remove remaining "subcribers" (= they did not match with members) # Remove remaining "subcribers" (= they did not match with members)
subscribers.each do |s| subscribers.each do |s|
puts "Removing #{s}... " print "Removing #{s}... "
mlmmj_unsub_binary = conf["mlmmj"]["unsub_binary"] mlmmj_unsub_binary = conf["mlmmj"]["unsub_binary"]
%x(#{mlmmj_unsub_binary} -L #{list} -a #{m} -q -s) %x(#{mlmmj_unsub_binary} -L #{list} -a #{s} -q -s)
if ($?.exitstatus == 0) if ($?.exitstatus == 0)
puts "OK" puts "OK"
else else