Tim Landscheidt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/148917

Change subject: Tools: Fix and simplify exim redirectors
......................................................................

Tools: Fix and simplify exim redirectors

Currently, the exim redirectors misbehave in two cases:

- Wrapped LDIF output is not handled, so for example (rather
  hypothetical) mail addresses longer than 70+ characters could get
  mangled, and

- nested service groups are not resolved.

This change fixes those and streamlines the process by inter alia:

- Simplifying regular expressions,

- using the existing newlines as mail address separators instead of
  converting them to commata, and

- resolving usernames only one level deep and letting exim resolve
  further where needed.

Change-Id: I3f9618f39f1e65a90bfb2f8846b7b8641e9c467f
---
M modules/toollabs/files/localuser
M modules/toollabs/files/maintainers
2 files changed, 4 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/17/148917/1

diff --git a/modules/toollabs/files/localuser b/modules/toollabs/files/localuser
index 1a8ba28..bdf3fd4 100755
--- a/modules/toollabs/files/localuser
+++ b/modules/toollabs/files/localuser
@@ -1,12 +1,8 @@
-#! /bin/bash
+#!/bin/bash
 #
 # THIS FILE IS MAINTAINED BY PUPPET
 # source: modules/toollabs/files/localuser
 # from:   toollabs::mailrelay
 #
 
-echo $(
-  /usr/bin/ldapsearch -LLL -x -b "uid=$1,ou=people,dc=wikimedia,dc=org" mail |
-       /bin/sed -ne '/^mail: \(.*\)/{;s//\1,/;p;}'
-) | sed -e 's/,\s*$//'
-
+/usr/bin/ldapsearch -b "uid=$1,ou=people,dc=wikimedia,dc=org" -LLL -o 
ldif-wrap=no -x mail | /bin/sed -ne 's/^mail: //p;'
diff --git a/modules/toollabs/files/maintainers 
b/modules/toollabs/files/maintainers
index 2847104..1d50cfa 100755
--- a/modules/toollabs/files/maintainers
+++ b/modules/toollabs/files/maintainers
@@ -1,20 +1,8 @@
-#! /bin/bash
+#!/bin/bash
 #
 # THIS FILE IS MAINTAINED BY PUPPET
 # source: modules/toollabs/files/maintainers
 # from:   toollabs::mailrelay
 #
 
-# FIXME: For nested service groups, this returns only the addresses of
-# users who are direct members of the service group queried, but not
-# of those who are members of the related service groups.  This should
-# be replaced by a proper recursive query with protections against
-# circular loops, etc.
-
-echo $(
-  (/usr/bin/ldapsearch -LLL -x -b "cn=$1,ou=servicegroups,dc=wikimedia,dc=org" 
member|grep member:|grep -v '^member: uid=\(local-\|tools\.\)'|while read x dn
-  do
-    /usr/bin/ldapsearch -LLL -x -b "$dn" mail
-  done) |
-  /bin/sed -ne '/^mail: \(.*\)/{;s//\1,/;p;}'
-) | sed -e 's/,\s*$//'
+/usr/bin/ldapsearch -b "cn=$1,ou=servicegroups,dc=wikimedia,dc=org" -LLL -o 
ldif-wrap=no -x member | sed -ne 's/^member: 
uid=\(.*\),ou=people,\(ou=servicegroups,\)\?dc=wikimedia,dc=org$/\1/p;'

-- 
To view, visit https://gerrit.wikimedia.org/r/148917
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3f9618f39f1e65a90bfb2f8846b7b8641e9c467f
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Tim Landscheidt <t...@tim-landscheidt.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to