[SCM] Samba Shared Repository - branch master updated

Günther Deschner gd at samba.org
Mon Nov 22 04:32:01 MST 2010


The branch, master has been updated
       via  f01360e s3-net: use dns_errstr() when dns commands fail.
       via  9df126d libaddns: add dns_errstr().
       via  f28b207 s3-waf: move build rules into libaddns directory.
      from  2ac5ced Avoid the use of PyAPI_DATA, which is for internal Python API's.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit f01360efadceeb693aefdf34c78c4ba40c033d53
Author: Günther Deschner <gd at samba.org>
Date:   Fri Nov 19 13:36:22 2010 +0100

    s3-net: use dns_errstr() when dns commands fail.
    
    Guenther
    
    Autobuild-User: Günther Deschner <gd at samba.org>
    Autobuild-Date: Mon Nov 22 12:31:33 CET 2010 on sn-devel-104

commit 9df126d324618ae44ec32da4ebcd5b2c566cf72c
Author: Günther Deschner <gd at samba.org>
Date:   Fri Nov 19 13:34:18 2010 +0100

    libaddns: add dns_errstr().
    
    Guenther

commit f28b2073b8ca119605658244d5be00542ad47223
Author: Günther Deschner <gd at samba.org>
Date:   Fri Nov 19 13:33:06 2010 +0100

    s3-waf: move build rules into libaddns directory.
    
    Guenther

-----------------------------------------------------------------------

Summary of changes:
 source3/Makefile.in            |    2 +-
 source3/libaddns/dns.h         |    1 +
 source3/libaddns/error.c       |   59 ++++++++++++++++++++++++++++++++++++++++
 source3/libaddns/wscript_build |    7 +++++
 source3/utils/net_ads.c        |    5 +++-
 source3/wscript_build          |   11 +-------
 6 files changed, 73 insertions(+), 12 deletions(-)
 create mode 100644 source3/libaddns/error.c
 create mode 100644 source3/libaddns/wscript_build


Changeset truncated at 500 lines:

diff --git a/source3/Makefile.in b/source3/Makefile.in
index 60361e7..faeb3e7 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -497,7 +497,7 @@ PARAM_OBJ = $(PARAM_WITHOUT_REG_OBJ) $(PARAM_REG_ADD_OBJ)
 KRBCLIENT_OBJ = libads/kerberos.o libads/ads_status.o
 
 LIBADDNS_OBJ0 = libaddns/dnsrecord.o libaddns/dnsutils.o  libaddns/dnssock.o \
-	       libaddns/dnsgss.o libaddns/dnsmarshall.o
+	       libaddns/dnsgss.o libaddns/dnsmarshall.o libaddns/error.o
 LIBADDNS_OBJ = $(LIBADDNS_OBJ0) $(SOCKET_WRAPPER_OBJ)
 
 GPEXT_OBJ = ../libgpo/gpext/gpext.o @GPEXT_STATIC@
diff --git a/source3/libaddns/dns.h b/source3/libaddns/dns.h
index 72cba07..29f1ed3 100644
--- a/source3/libaddns/dns.h
+++ b/source3/libaddns/dns.h
@@ -517,6 +517,7 @@ DNS_ERROR dns_unmarshall_update_request(TALLOC_CTX *mem_ctx,
 struct dns_request *dns_update2request(struct dns_update_request *update);
 struct dns_update_request *dns_request2update(struct dns_request *request);
 uint16 dns_response_code(uint16 flags);
+const char *dns_errstr(DNS_ERROR err);
 
 /* from dnsgss.c */
 
diff --git a/source3/libaddns/error.c b/source3/libaddns/error.c
new file mode 100644
index 0000000..361388c
--- /dev/null
+++ b/source3/libaddns/error.c
@@ -0,0 +1,59 @@
+/*
+  Linux DNS client library implementation
+  Copyright (C) 2010 Guenther Deschner
+
+     ** 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/>.
+*/
+
+#include "dns.h"
+#include "dnserr.h"
+
+typedef struct {
+	const char *dns_errstr;
+	DNS_ERROR dns_errcode;
+} dns_err_code_struct;
+
+static const dns_err_code_struct dns_errs[] =
+{
+	{ "ERROR_DNS_SUCCESS", ERROR_DNS_SUCCESS },
+	{ "ERROR_DNS_RECORD_NOT_FOUND", ERROR_DNS_RECORD_NOT_FOUND },
+	{ "ERROR_DNS_BAD_RESPONSE", ERROR_DNS_BAD_RESPONSE },
+	{ "ERROR_DNS_INVALID_PARAMETER", ERROR_DNS_INVALID_PARAMETER },
+	{ "ERROR_DNS_NO_MEMORY", ERROR_DNS_NO_MEMORY },
+	{ "ERROR_DNS_INVALID_NAME_SERVER", ERROR_DNS_INVALID_NAME_SERVER },
+	{ "ERROR_DNS_CONNECTION_FAILED", ERROR_DNS_CONNECTION_FAILED },
+	{ "ERROR_DNS_GSS_ERROR", ERROR_DNS_GSS_ERROR },
+	{ "ERROR_DNS_INVALID_NAME", ERROR_DNS_INVALID_NAME },
+	{ "ERROR_DNS_INVALID_MESSAGE", ERROR_DNS_INVALID_MESSAGE },
+	{ "ERROR_DNS_SOCKET_ERROR", ERROR_DNS_SOCKET_ERROR },
+	{ "ERROR_DNS_UPDATE_FAILED", ERROR_DNS_UPDATE_FAILED },
+	{ NULL, ERROR_DNS_SUCCESS },
+};
+
+const char *dns_errstr(DNS_ERROR err)
+{
+	int i;
+
+	for (i=0; dns_errs[i].dns_errstr != NULL; i++) {
+		if (ERR_DNS_EQUAL(err, dns_errs[i].dns_errcode)) {
+			return dns_errs[i].dns_errstr;
+		}
+	}
+
+	return NULL;
+}
diff --git a/source3/libaddns/wscript_build b/source3/libaddns/wscript_build
new file mode 100644
index 0000000..c4c83a9
--- /dev/null
+++ b/source3/libaddns/wscript_build
@@ -0,0 +1,7 @@
+#!/usr/bin/env python
+
+bld.SAMBA_LIBRARY('libaddns',
+                   source='dnsrecord.c dnsutils.c dnssock.c dnsgss.c dnsmarshall.c error.c',
+                   public_deps='talloc krb5 k5crypto com_err gssapi gssapi_krb5',
+                   private_library=True,
+                   vars=locals())
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c
index bc83a3d..1d617c0 100644
--- a/source3/utils/net_ads.c
+++ b/source3/utils/net_ads.c
@@ -1198,6 +1198,8 @@ static NTSTATUS net_update_dns_internal(TALLOC_CTX *ctx, ADS_STRUCT *ads,
 
 	dns_err = DoDNSUpdate(dns_server, dnsdomain, machine_name, addrs, num_addrs);
 	if (!ERR_DNS_IS_OK(dns_err)) {
+		d_printf(_("DNS Update for %s failed: %s\n"),
+			machine_name, dns_errstr(dns_err));
 		status = NT_STATUS_UNSUCCESSFUL;
 	}
 
@@ -1511,7 +1513,8 @@ static int net_ads_dns_gethostbyname(struct net_context *c, int argc, const char
 
 	err = do_gethostbyname(argv[0], argv[1]);
 
-	d_printf(_("do_gethostbyname returned %d\n"), ERROR_DNS_V(err));
+	d_printf(_("do_gethostbyname returned %s (%d)\n"),
+		dns_errstr(err), ERROR_DNS_V(err));
 #endif
 	return 0;
 }
diff --git a/source3/wscript_build b/source3/wscript_build
index 308fae1..56d7198 100644
--- a/source3/wscript_build
+++ b/source3/wscript_build
@@ -183,10 +183,6 @@ PARAM_WITHOUT_REG_SRC = '''param/loadparm.c param/util.c param/loadparm_server_r
 
 KRBCLIENT_SRC = '''libads/kerberos.c libads/ads_status.c'''
 
-LIBADDNS_SRC0 = '''libaddns/dnsrecord.c libaddns/dnsutils.c  libaddns/dnssock.c
-               libaddns/dnsgss.c libaddns/dnsmarshall.c'''
-LIBADDNS_SRC = '''${LIBADDNS_SRC0}'''
-
 LIBGPO_SRC0 = '''../libgpo/gpo_ldap.c ../libgpo/gpo_ini.c ../libgpo/gpo_util.c
               ../libgpo/gpo_fetch.c libgpo/gpo_filesync.c ../libgpo/gpo_sec.c
               libgpo/gpo_reg.c'''
@@ -927,12 +923,6 @@ bld.SAMBA_LIBRARY('smbsharemodes',
                     private_library=True,
                     vars=locals())
 
-bld.SAMBA_LIBRARY('libaddns',
-                    source=LIBADDNS_SRC,
-                    public_deps='talloc krb5 k5crypto com_err gssapi gssapi_krb5',
-                    private_library=True,
-                    vars=locals())
-
 bld.SAMBA_SUBSYSTEM('LIBMSRPC',
                     source='${LIBMSRPC_SRC}',
                     deps='ndr NDR_SECURITY NDR_DCERPC NDR_SCHANNEL',
@@ -1510,6 +1500,7 @@ bld.RECURSE('winbindd')
 bld.RECURSE('libgpo/gpext')
 bld.RECURSE('pam_smbpass')
 bld.RECURSE('rpc_server')
+bld.RECURSE('libaddns')
 
 bld.ENFORCE_GROUP_ORDERING()
 bld.CHECK_PROJECT_RULES()


-- 
Samba Shared Repository


More information about the samba-cvs mailing list