[SCM] Samba Shared Repository - branch master updated
Andrew Tridgell
tridge at samba.org
Mon Jun 6 22:08:02 MDT 2011
The branch, master has been updated
via 8acbc3a s4-provision: fixed detection of V4/V6 addresses
via 3ccb72d s4-ipv6: fixed iface_list_same_net() for IPv6
via 64380ff s4-ipv6: fixed DNS handling with new IPv6 code
via 5d7ba30 s4-dsdb: cope with missing backlinks in rpmd handling
via c6252c2 s4-netlogon: force an IPv4 address
via 6a6d4d8 s4-ipv6: fix iface_list_best_ip() for IPv6
from 776598a s3-docs Add documentation for ncalrpc dir
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 8acbc3a17435ef330910993aa40b5ec1e4c1dab2
Author: Andrew Tridgell <tridge at samba.org>
Date: Tue Jun 7 12:55:31 2011 +1000
s4-provision: fixed detection of V4/V6 addresses
Autobuild-User: Andrew Tridgell <tridge at samba.org>
Autobuild-Date: Tue Jun 7 06:07:24 CEST 2011 on sn-devel-104
commit 3ccb72d7496aadbdf35b0aee3b2384466d9dd3b8
Author: Andrew Tridgell <tridge at samba.org>
Date: Tue Jun 7 12:55:09 2011 +1000
s4-ipv6: fixed iface_list_same_net() for IPv6
commit 64380ff050c77b2b67c0fac4ada8650e834c4b4a
Author: Andrew Tridgell <tridge at samba.org>
Date: Tue Jun 7 12:35:10 2011 +1000
s4-ipv6: fixed DNS handling with new IPv6 code
commit 5d7ba305490b5047b4d404353e95c217c8ef7d10
Author: Andrew Tridgell <tridge at samba.org>
Date: Tue Jun 7 10:44:48 2011 +1000
s4-dsdb: cope with missing backlinks in rpmd handling
if backlinks have not propogated correctly in a previous replication
this allows us to recover
commit c6252c2e9d9c43496f1b5ecbf66099979096f66e
Author: Andrew Tridgell <tridge at samba.org>
Date: Mon Jun 6 15:19:16 2011 +1000
s4-netlogon: force an IPv4 address
this interface is currently V4 only, don't try and return a V6 address
in a V4 structure
commit 6a6d4d8884788c1e860bda886d168301623e1ea3
Author: Andrew Tridgell <tridge at samba.org>
Date: Mon Jun 6 15:18:12 2011 +1000
s4-ipv6: fix iface_list_best_ip() for IPv6
return an interface with the same address family as the target
-----------------------------------------------------------------------
Summary of changes:
source4/cldap_server/netlogon.c | 2 +-
source4/dsdb/samdb/ldb_modules/repl_meta_data.c | 11 +++++-
source4/lib/socket/interface.c | 42 ++++++++++++++++++--
source4/libcli/resolve/dns_ex.c | 17 +++++++-
.../scripting/python/samba/provision/__init__.py | 31 +++++++++++++-
5 files changed, 94 insertions(+), 9 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source4/cldap_server/netlogon.c b/source4/cldap_server/netlogon.c
index e950d70..92f7a4a 100644
--- a/source4/cldap_server/netlogon.c
+++ b/source4/cldap_server/netlogon.c
@@ -300,7 +300,7 @@ NTSTATUS fill_netlogon_samlogon_response(struct ldb_context *sam_ctx,
if (src_address) {
pdc_ip = iface_list_best_ip(ifaces, src_address);
} else {
- pdc_ip = iface_list_n_ip(ifaces, 0);
+ pdc_ip = iface_list_first_v4(ifaces);
}
ZERO_STRUCTP(netlogon);
diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
index 90933c4..04311a4 100644
--- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
+++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
@@ -254,7 +254,16 @@ static int replmd_process_backlink(struct ldb_module *module, struct la_backlink
msg->elements[0].flags |= LDB_FLAG_INTERNAL_DISABLE_SINGLE_VALUE_CHECK;
ret = dsdb_module_modify(module, msg, DSDB_FLAG_NEXT_MODULE, parent);
- if (ret != LDB_SUCCESS) {
+ if (ret == LDB_ERR_NO_SUCH_ATTRIBUTE && !bl->active) {
+ /* we allow LDB_ERR_NO_SUCH_ATTRIBUTE as success to
+ cope with possible corruption where the backlink has
+ already been removed */
+ DEBUG(0,("WARNING: backlink from %s already removed from %s - %s\n",
+ ldb_dn_get_linearized(target_dn),
+ ldb_dn_get_linearized(source_dn),
+ ldb_errstring(ldb)));
+ ret = LDB_SUCCESS;
+ } else if (ret != LDB_SUCCESS) {
ldb_asprintf_errstring(ldb, "Failed to %s backlink from %s to %s - %s",
bl->active?"add":"remove",
ldb_dn_get_linearized(source_dn),
diff --git a/source4/lib/socket/interface.c b/source4/lib/socket/interface.c
index 96cee2f..9cb8f5e 100644
--- a/source4/lib/socket/interface.c
+++ b/source4/lib/socket/interface.c
@@ -372,6 +372,23 @@ const char *iface_list_first_v4(struct interface *ifaces)
}
/**
+ return the first IPv6 interface address we have registered
+ **/
+static const char *iface_list_first_v6(struct interface *ifaces)
+{
+ struct interface *i;
+
+#ifdef HAVE_IPV6
+ for (i=ifaces; i; i=i->next) {
+ if (i->ip.ss_family == AF_INET6) {
+ return i->ip_s;
+ }
+ }
+#endif
+ return NULL;
+}
+
+/**
check if an interface is IPv4
**/
bool iface_list_n_is_v4(struct interface *ifaces, int n)
@@ -435,7 +452,12 @@ const char *iface_list_best_ip(struct interface *ifaces, const char *dest)
if (iface) {
return iface->ip_s;
}
- return iface_list_n_ip(ifaces, 0);
+#ifdef HAVE_IPV6
+ if (ss.ss_family == AF_INET6) {
+ return iface_list_first_v6(ifaces);
+ }
+#endif
+ return iface_list_first_v4(ifaces);
}
/**
@@ -459,9 +481,21 @@ bool iface_list_is_local(struct interface *ifaces, const char *dest)
*/
bool iface_list_same_net(const char *ip1, const char *ip2, const char *netmask)
{
- return same_net_v4(interpret_addr2(ip1),
- interpret_addr2(ip2),
- interpret_addr2(netmask));
+ struct sockaddr_storage ip1_ss, ip2_ss, nm_ss;
+
+ if (!interpret_string_addr(&ip1_ss, ip1, AI_NUMERICHOST)) {
+ return false;
+ }
+ if (!interpret_string_addr(&ip2_ss, ip2, AI_NUMERICHOST)) {
+ return false;
+ }
+ if (!interpret_string_addr(&nm_ss, netmask, AI_NUMERICHOST)) {
+ return false;
+ }
+
+ return same_net((struct sockaddr *)&ip1_ss,
+ (struct sockaddr *)&ip2_ss,
+ (struct sockaddr *)&nm_ss);
}
/**
diff --git a/source4/libcli/resolve/dns_ex.c b/source4/libcli/resolve/dns_ex.c
index 069ba82..cb2d2c3 100644
--- a/source4/libcli/resolve/dns_ex.c
+++ b/source4/libcli/resolve/dns_ex.c
@@ -267,7 +267,22 @@ static void run_child_dns_lookup(struct dns_ex_state *state, int fd)
port = state->port;
}
- if (!print_sockaddr_len(addrstr, sizeof(addrstr), (struct sockaddr *)addrs_rr[i]->u.data, addrs_rr[i]->size)) {
+ switch (rr->type) {
+ case rk_ns_t_a:
+ if (inet_ntop(AF_INET, addrs_rr[i]->u.a,
+ addrstr, sizeof(addrstr)) == NULL) {
+ continue;
+ }
+ break;
+#ifdef HAVE_IPV6
+ case rk_ns_t_aaaa:
+ if (inet_ntop(AF_INET6, (struct in6_addr *)addrs_rr[i]->u.data,
+ addrstr, sizeof(addrstr)) == NULL) {
+ continue;
+ }
+ break;
+#endif
+ default:
continue;
}
diff --git a/source4/scripting/python/samba/provision/__init__.py b/source4/scripting/python/samba/provision/__init__.py
index eb6e01f..324e76f 100644
--- a/source4/scripting/python/samba/provision/__init__.py
+++ b/source4/scripting/python/samba/provision/__init__.py
@@ -1465,6 +1465,25 @@ def setsysvolacl(samdb, netlogon, sysvol, gid, domainsid, dnsdomain, domaindn,
set_gpos_acl(sysvol, dnsdomain, domainsid, domaindn, samdb, lp)
+def interface_ips_v4(lp):
+ '''return only IPv4 IPs'''
+ ips = samba.interface_ips(lp, False)
+ ret = []
+ for i in ips:
+ if i.find(':') == -1:
+ ret.append(i)
+ return ret
+
+def interface_ips_v6(lp, linklocal=False):
+ '''return only IPv6 IPs'''
+ ips = samba.interface_ips(lp, False)
+ ret = []
+ for i in ips:
+ if i.find(':') != -1 and (linklocal or i.find('%') == -1):
+ ret.append(i)
+ return ret
+
+
def provision(logger, session_info, credentials, smbconf=None,
targetdir=None, samdb_fill=FILL_FULL, realm=None, rootdn=None,
domaindn=None, schemadn=None, configdn=None, serverdn=None,
@@ -1565,16 +1584,24 @@ def provision(logger, session_info, credentials, smbconf=None,
if hostip is None:
logger.info("Looking up IPv4 addresses")
- hostips = samba.interface_ips(lp, False)
+ hostips = interface_ips_v4(lp)
if len(hostips) == 0:
logger.warning("No external IPv4 address has been found. Using loopback.")
hostip = '127.0.0.1'
else:
hostip = hostips[0]
if len(hostips) > 1:
- logger.warning("More than one IPv4 address found. Using %s.",
+ logger.warning("More than one IPv4 address found. Using %s",
hostip)
+ if hostip6 is None:
+ logger.info("Looking up IPv6 addresses")
+ hostips = interface_ips_v6(lp, linklocal=False)
+ if hostips:
+ hostip6 = hostips[0]
+ if len(hostips) > 1:
+ logger.warning("More than one IPv6 address found. Using %s", hostip6)
+
if serverrole is None:
serverrole = lp.get("server role")
--
Samba Shared Repository
More information about the samba-cvs
mailing list