[SCM] Samba Shared Repository - branch master updated
Kai Blin
kai at samba.org
Sun Sep 25 01:16:02 MDT 2011
The branch, master has been updated
via b567694 addns: Remove unused empty header file
via b02bbf2 net: Don't register link local addresses with DNS
via 7466612 addns: Allow creating AAAA records during updates
via 8eb80a9 libcli/smb: Get rid of set but unused variable
from 649bfc4 s4 winbind: Don't drop workgroup name for getpw*
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit b567694bb0ee6aa233f639efd6ac495c44e2e172
Author: Kai Blin <kai at samba.org>
Date: Sat Sep 24 22:40:43 2011 -0700
addns: Remove unused empty header file
Autobuild-User: Kai Blin <kai at samba.org>
Autobuild-Date: Sun Sep 25 09:15:09 CEST 2011 on sn-devel-104
commit b02bbf237cfd36cd736cefc78f1e3ba3278dc7bf
Author: Kai Blin <kai at samba.org>
Date: Sat Sep 24 18:18:14 2011 -0700
net: Don't register link local addresses with DNS
commit 7466612392272e70c60114fc035b62b16f6194aa
Author: Kai Blin <kai at samba.org>
Date: Sat Sep 24 18:17:11 2011 -0700
addns: Allow creating AAAA records during updates
commit 8eb80a9d832e08bb356507a870522b0b7180a10a
Author: Kai Blin <kai at samba.org>
Date: Sat Sep 24 18:28:52 2011 -0700
libcli/smb: Get rid of set but unused variable
-----------------------------------------------------------------------
Summary of changes:
lib/addns/addns.h | 30 --------------------
lib/addns/dns.h | 4 +++
lib/addns/dnsrecord.c | 60 ++++++++++++++++++++++++++++++++++++++---
lib/util/util_net.c | 23 +++++++++++++++
lib/util/util_net.h | 1 +
libcli/smb/smb2_create_blob.c | 4 ++-
source3/Makefile.in | 1 -
source3/utils/net_dns.c | 5 +++
8 files changed, 92 insertions(+), 36 deletions(-)
delete mode 100644 lib/addns/addns.h
Changeset truncated at 500 lines:
diff --git a/lib/addns/addns.h b/lib/addns/addns.h
deleted file mode 100644
index 6ef9329..0000000
--- a/lib/addns/addns.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- Public Interface file for Linux DNS client library implementation
-
- Copyright (C) 2006 Krishna Ganugapati <krishnag at centeris.com>
- Copyright (C) 2006 Gerald Carter <jerry at samba.org>
-
- ** NOTE! The following LGPL license applies to the libaddns
- ** library. This does NOT imply that all of Samba is released
- ** under the LGPL
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _ADDNS_H
-#define _ADDNS_H
-
-
-#endif /* _ADDNS_H */
-
diff --git a/lib/addns/dns.h b/lib/addns/dns.h
index 6ccdbb6..d98a27e 100644
--- a/lib/addns/dns.h
+++ b/lib/addns/dns.h
@@ -205,6 +205,7 @@
#define QTYPE_MD 3
#define QTYPE_CNAME 5
#define QTYPE_SOA 6
+#define QTYPE_AAAA 28
#define QTYPE_ANY 255
#define QTYPE_TKEY 249
#define QTYPE_TSIG 250
@@ -408,6 +409,9 @@ DNS_ERROR dns_create_name_not_in_use_record(TALLOC_CTX *mem_ctx,
DNS_ERROR dns_create_a_record(TALLOC_CTX *mem_ctx, const char *host,
uint32 ttl, const struct sockaddr_storage *pss,
struct dns_rrec **prec);
+DNS_ERROR dns_create_aaaa_record(TALLOC_CTX *mem_ctx, const char *host,
+ uint32 ttl, const struct sockaddr_storage *pss,
+ struct dns_rrec **prec);
DNS_ERROR dns_unmarshall_tkey_record(TALLOC_CTX *mem_ctx, struct dns_rrec *rec,
struct dns_tkey_record **ptkey);
DNS_ERROR dns_create_tsig_record(TALLOC_CTX *mem_ctx, const char *keyname,
diff --git a/lib/addns/dnsrecord.c b/lib/addns/dnsrecord.c
index 2240d08..045fd46 100644
--- a/lib/addns/dnsrecord.c
+++ b/lib/addns/dnsrecord.c
@@ -127,8 +127,7 @@ DNS_ERROR dns_create_a_record(TALLOC_CTX *mem_ctx, const char *host,
struct in_addr ip;
if (pss->ss_family != AF_INET) {
- /* Silently ignore this. */
- return ERROR_DNS_SUCCESS;
+ return ERROR_DNS_INVALID_PARAMETER;
}
ip = ((const struct sockaddr_in *)pss)->sin_addr;
@@ -147,13 +146,54 @@ DNS_ERROR dns_create_a_record(TALLOC_CTX *mem_ctx, const char *host,
return err;
}
+DNS_ERROR dns_create_aaaa_record(TALLOC_CTX *mem_ctx, const char *host,
+ uint32 ttl, const struct sockaddr_storage *pss,
+ struct dns_rrec **prec)
+{
+#ifdef HAVE_IPV6
+ uint8 *data;
+ DNS_ERROR err;
+ struct in6_addr ip6;
+
+ if (pss->ss_family != AF_INET6) {
+ return ERROR_DNS_INVALID_PARAMETER;
+ }
+
+ ip6 = ((const struct sockaddr_in6 *)pss)->sin6_addr;
+ if (!(data = (uint8 *)talloc_memdup(mem_ctx, (const void *)&ip6.s6_addr,
+ sizeof(ip6.s6_addr)))) {
+ return ERROR_DNS_NO_MEMORY;
+ }
+
+ err = dns_create_rrec(mem_ctx, host, QTYPE_AAAA, DNS_CLASS_IN, ttl,
+ sizeof(ip6.s6_addr), data, prec);
+
+ if (!ERR_DNS_IS_OK(err)) {
+ TALLOC_FREE(data);
+ }
+
+ return err;
+#else
+ return ERROR_DNS_INVALID_PARAMETER;
+#endif
+}
+
DNS_ERROR dns_create_name_in_use_record(TALLOC_CTX *mem_ctx,
const char *name,
const struct sockaddr_storage *ss,
struct dns_rrec **prec)
{
if (ss != NULL) {
- return dns_create_a_record(mem_ctx, name, 0, ss, prec);
+ switch (ss->ss_family) {
+ case AF_INET:
+ return dns_create_a_record(mem_ctx, name, 0, ss, prec);
+#ifdef HAVE_IPV6
+ case AF_INET6:
+ return dns_create_aaaa_record(mem_ctx, name, 0, ss, prec);
+#endif
+ default:
+ return ERROR_DNS_INVALID_PARAMETER;
+ }
}
return dns_create_rrec(mem_ctx, name, QTYPE_ANY, DNS_CLASS_IN, 0, 0,
@@ -404,7 +444,19 @@ DNS_ERROR dns_create_update_request(TALLOC_CTX *mem_ctx,
*/
for ( i=0; i<num_addrs; i++ ) {
- err = dns_create_a_record(req, hostname, 3600, &ss_addrs[i], &rec);
+
+ switch(ss_addrs[i].ss_family) {
+ case AF_INET:
+ err = dns_create_a_record(req, hostname, 3600, &ss_addrs[i], &rec);
+ break;
+#ifdef HAVE_IPV6
+ case AF_INET6:
+ err = dns_create_aaaa_record(req, hostname, 3600, &ss_addrs[i], &rec);
+ break;
+#endif
+ default:
+ continue;
+ }
if (!ERR_DNS_IS_OK(err))
goto error;
diff --git a/lib/util/util_net.c b/lib/util/util_net.c
index 23d25ac..139c9d4 100644
--- a/lib/util/util_net.c
+++ b/lib/util/util_net.c
@@ -432,6 +432,29 @@ void zero_ip_v4(struct in_addr *ip)
ZERO_STRUCTP(ip);
}
+bool is_linklocal_addr(const struct sockaddr_storage *pss)
+{
+#ifdef HAVE_IPV6
+ if (pss->ss_family == AF_INET6) {
+ const struct in6_addr *pin6 =
+ &((const struct sockaddr_in6 *)pss)->sin6_addr;
+ return IN6_IS_ADDR_LINKLOCAL(pin6);
+ }
+#endif
+ if (pss->ss_family == AF_INET) {
+ const struct in_addr *pin =
+ &((const struct sockaddr_in *)pss)->sin_addr;
+ struct in_addr ll_addr;
+ struct in_addr mask_addr;
+
+ /* 169.254.0.0/16, is link local, see RFC 3927 */
+ ll_addr.s_addr = 0xa9fe0000;
+ mask_addr.s_addr = 0xffff0000;
+ return same_net_v4(*pin, ll_addr, mask_addr);
+ }
+ return false;
+}
+
/**
* Convert an IPv4 struct in_addr to a struct sockaddr_storage.
*/
diff --git a/lib/util/util_net.h b/lib/util/util_net.h
index fc2776a..215a657 100644
--- a/lib/util/util_net.h
+++ b/lib/util/util_net.h
@@ -74,6 +74,7 @@ bool is_loopback_ip_v4(struct in_addr ip);
bool is_loopback_addr(const struct sockaddr *pss);
bool is_zero_addr(const struct sockaddr_storage *pss);
void zero_ip_v4(struct in_addr *ip);
+bool is_linklocal_addr(const struct sockaddr_storage *pss);
/**
Interpret an internet address or name into an IP address in 4 byte form.
**/
diff --git a/libcli/smb/smb2_create_blob.c b/libcli/smb/smb2_create_blob.c
index 31c67e9..9724823 100644
--- a/libcli/smb/smb2_create_blob.c
+++ b/libcli/smb/smb2_create_blob.c
@@ -41,7 +41,7 @@ NTSTATUS smb2_create_blob_parse(TALLOC_CTX *mem_ctx, const DATA_BLOB buffer,
while (remaining > 0) {
uint32_t next;
uint32_t name_offset, name_length;
- uint32_t reserved, data_offset;
+ uint32_t data_offset;
uint32_t data_length;
char *tag;
DATA_BLOB b;
@@ -53,7 +53,9 @@ NTSTATUS smb2_create_blob_parse(TALLOC_CTX *mem_ctx, const DATA_BLOB buffer,
next = IVAL(data, 0);
name_offset = SVAL(data, 4);
name_length = SVAL(data, 6);
+#if 0
reserved = SVAL(data, 8);
+#endif
data_offset = SVAL(data, 10);
data_length = IVAL(data, 12);
diff --git a/source3/Makefile.in b/source3/Makefile.in
index 0796bc6..bddde78 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -2345,7 +2345,6 @@ LIBADDNS_SHARED_TARGET_SONAME=@LIBADDNS_SHARED_TARGET_SOVER@
LIBADDNS_STATIC_TARGET=@LIBADDNS_STATIC_TARGET@
LIBADDNS=@LIBADDNS_STATIC@ @LIBADDNS_SHARED@
#LIBADDNS_SYMS=$(srcdir)/exports/libaddns. at SYMSEXT@
-LIBADDNS_HEADERS=$(srcdir)/../lib/addns/addns.h
$(LIBADDNS_SHARED_TARGET_SONAME): $(BINARY_PREREQS) $(LIBADDNS_OBJ) $(LIBTALLOC)
@echo Linking shared library $@
diff --git a/source3/utils/net_dns.c b/source3/utils/net_dns.c
index 5fbdc0a..f146f29 100644
--- a/source3/utils/net_dns.c
+++ b/source3/utils/net_dns.c
@@ -170,6 +170,11 @@ int get_my_ip_address( struct sockaddr_storage **pp_ss )
continue;
}
+ /* Don't register link-local addresses */
+ if (is_linklocal_addr(nic_sa_storage)) {
+ continue;
+ }
+
memcpy(&list[count++], nic_sa_storage, sizeof(struct sockaddr_storage));
}
*pp_ss = list;
--
Samba Shared Repository
More information about the samba-cvs
mailing list