UCS Bug: https://forge.univention.org/bugzilla/show_bug.cgi?id=39466 Make it possible to exclude interfaces for the automatic IP registration. This is for example needed to exlude the docker interface. It can be used on an UCS system in the following way: ucr set samba/register/exclude/interfaces="docker0 foobar0" diff -Nur samba-4.3.0~rc3.orig/debian/patches//96_dnsupdate_exclude_interfaces.patch samba-4.3.0~rc3/debian/patches//96_dnsupdate_exclude_interfaces.patch --- samba-4.3.0~rc3.orig/debian/patches//96_dnsupdate_exclude_interfaces.patch 1970-01-01 01:00:00.000000000 +0100 +++ samba-4.3.0~rc3/debian/patches//96_dnsupdate_exclude_interfaces.patch 2015-10-03 22:54:50.025121926 +0200 @@ -0,0 +1,55 @@ +UCS Bug: https://forge.univention.org/bugzilla/show_bug.cgi?id=39466 + +Make it possible to exclude interfaces for the automatic IP registration. This is for example needed to exlude the docker interface. + +It can be used on an UCS system in the following way: + ucr set samba/register/exclude/interfaces="docker0 foobar0" + +--- a/source4/scripting/bin/samba_dnsupdate 2015-10-03 16:46:45.064834000 -0400 ++++ b/source4/scripting/bin/samba_dnsupdate 2015-10-03 16:46:17.704834000 -0400 +@@ -23,6 +23,7 @@ + import fcntl + import sys + import tempfile ++import netifaces + import subprocess + + # ensure we get messages out immediately, so they get in the samba logs, +@@ -46,6 +48,7 @@ + from samba.auth import system_session + from samba.samdb import SamDB + from samba.dcerpc import netlogon, winbind ++from univention.config_registry import ConfigRegistry + + samba.ensure_third_party_module("dns", "dnspython") + import dns.resolver +@@ -89,6 +92,29 @@ + all_interfaces = False + + IPs = samba.interface_ips(lp, all_interfaces) ++ ++def get_ip_address(ifname): ++ if not ifname in netifaces.interfaces(): ++ return ++ ifaddrs = netifaces.ifaddresses(ifname) ++ addr = [] ++ addr.expand([x['addr'] for x in ifaddrs.get(netifaces.AF_INET,[])]) ++ addr.expand([x['addr'] for x in ifaddrs.get(netifaces.AF_INET6,[])]) ++ return addr ++ ++ucr = ConfigRegistry() ++ucr.load() ++exclude_interfaces = ucr.get('samba/register/exclude/interfaces') ++if exclude_interfaces: ++ if opts.verbose: ++ print 'Exclude the following interfaces: %s' % exclude_interfaces ++ for exclude_interface in exclude_interfaces.split(' '): ++ exclude_ips = get_ip_address(exclude_interface) ++ if exclude_ips: ++ IPs = [ip for ip in IPs if ip not in exclude_ips] ++ if opts.verbose: ++ print 'Exclude the following IP addresses: %s' % (exclude_ips,) ++ + if opts.local: + nsupdate_cmd = ['nsupdate','-l'] + opts.nocreds = True diff -Nuar samba-4.2.0~alpha1.orig/debian/patches/series samba-4.2.0~alpha1/debian/patches/series --- samba-4.2.0~alpha1.orig/debian/patches/series 2014-08-14 00:16:55.000000000 +0200 +++ samba-4.2.0~alpha1/debian/patches/series 2014-08-14 00:17:19.000000000 +0200 @@ -10000,0 +10000,1 @@ +96_dnsupdate_exclude_interfaces.patch