[SCM] Samba Shared Repository - branch master updated

Günther Deschner gd at samba.org
Fri Oct 21 07:53:03 MDT 2011


The branch, master has been updated
       via  80741d9 libcli: remove unneeded com_err.h and fix the build here.
       via  bba114a s3-waf: only compile common.c in netapi examples code once.
       via  81435bf s3-netapi: use NetApiBufferAllocate() for returned buffer in getdc calls.
       via  23fea38 s3-netapi: fix missing include in examples code.
      from  75d146d libcli/smb: move smb_seal.c to the toplevel

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


- Log -----------------------------------------------------------------
commit 80741d98d802aa4f1c9747d9478e0a932ab531df
Author: Günther Deschner <gd at samba.org>
Date:   Fri Oct 21 14:15:54 2011 +0200

    libcli: remove unneeded com_err.h and fix the build here.
    
    Guenther
    
    Autobuild-User: Günther Deschner <gd at samba.org>
    Autobuild-Date: Fri Oct 21 15:52:36 CEST 2011 on sn-devel-104

commit bba114af6e180fb23cba541bd90c0b139cb1f592
Author: Günther Deschner <gd at samba.org>
Date:   Fri Oct 21 11:31:57 2011 +0200

    s3-waf: only compile common.c in netapi examples code once.
    
    Guenther

commit 81435bf26bf1081eeff0f1a06f40478c87e6dcb4
Author: Günther Deschner <gd at samba.org>
Date:   Fri Oct 21 11:06:14 2011 +0200

    s3-netapi: use NetApiBufferAllocate() for returned buffer in getdc calls.
    
    Guenther

commit 23fea38debb7e4362511b4002a6b2c5e125c36f7
Author: Günther Deschner <gd at samba.org>
Date:   Fri Oct 21 11:05:37 2011 +0200

    s3-netapi: fix missing include in examples code.
    
    Guenther

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

Summary of changes:
 libcli/smb/smb_seal.h                     |    4 ---
 source3/lib/netapi/examples/common.c      |    2 +
 source3/lib/netapi/examples/wscript_build |   10 +++++++-
 source3/lib/netapi/getdc.c                |   32 +++++++++++++++++++++++++++-
 4 files changed, 40 insertions(+), 8 deletions(-)


Changeset truncated at 500 lines:

diff --git a/libcli/smb/smb_seal.h b/libcli/smb/smb_seal.h
index fcee205..9f9a806 100644
--- a/libcli/smb/smb_seal.h
+++ b/libcli/smb/smb_seal.h
@@ -28,10 +28,6 @@
 #include <gssapi.h>
 #endif
 
-#if HAVE_COM_ERR_H
-#include <com_err.h>
-#endif
-
 /* Transport encryption state. */
 enum smb_trans_enc_type {
 		SMB_TRANS_ENC_NTLM
diff --git a/source3/lib/netapi/examples/common.c b/source3/lib/netapi/examples/common.c
index 74e2861..bdc8669 100644
--- a/source3/lib/netapi/examples/common.c
+++ b/source3/lib/netapi/examples/common.c
@@ -6,6 +6,8 @@
 #include <popt.h>
 #include <netapi.h>
 
+#include "common.h"
+
 void popt_common_callback(poptContext con,
 			 enum poptCallbackReason reason,
 			 const struct poptOption *opt,
diff --git a/source3/lib/netapi/examples/wscript_build b/source3/lib/netapi/examples/wscript_build
index 26f4e76..a445467 100644
--- a/source3/lib/netapi/examples/wscript_build
+++ b/source3/lib/netapi/examples/wscript_build
@@ -56,9 +56,15 @@ names = [
     ("netlogon", "netlogon_control2"),
     ("netlogon", "nltest")]
 
+
+bld.SAMBA_SUBSYSTEM('LIBNETAPI_EXAMPLES_COMMON',
+                    source='common.c',
+                    deps='netapi popt',
+                    vars=locals())
+
 for pattern in names:
     (subdir, name) = pattern
     bld.SAMBA_BINARY('%s/%s' % (subdir, name),
-                     source='%s/%s.c common.c' % (subdir, name),
-                     deps='netapi popt',
+                     source='%s/%s.c' % (subdir, name),
+                     deps='netapi popt LIBNETAPI_EXAMPLES_COMMON',
                      install=False)
diff --git a/source3/lib/netapi/getdc.c b/source3/lib/netapi/getdc.c
index e753dea..3b26d46 100644
--- a/source3/lib/netapi/getdc.c
+++ b/source3/lib/netapi/getdc.c
@@ -43,6 +43,8 @@ WERROR NetGetDCName_r(struct libnetapi_ctx *ctx,
 	NTSTATUS status;
 	WERROR werr;
 	struct dcerpc_binding_handle *b;
+	const char *dcname;
+	void *buffer;
 
 	werr = libnetapi_get_binding_handle(ctx, r->in.server_name,
 					    &ndr_table_netlogon.syntax_id,
@@ -54,12 +56,24 @@ WERROR NetGetDCName_r(struct libnetapi_ctx *ctx,
 	status = dcerpc_netr_GetDcName(b, talloc_tos(),
 				       r->in.server_name,
 				       r->in.domain_name,
-				       (const char **)r->out.buffer,
+				       &dcname,
 				       &werr);
 
 	if (!NT_STATUS_IS_OK(status)) {
 		werr = ntstatus_to_werror(status);
+		goto done;
+	}
+
+	if (!W_ERROR_IS_OK(werr)) {
+		goto done;
+	}
+
+	if (NetApiBufferAllocate(strlen_m_term(dcname), &buffer)) {
+		werr = WERR_NOMEM;
+		goto done;
 	}
+	memcpy(buffer, dcname, strlen_m_term(dcname));
+	*r->out.buffer = buffer;
  done:
 
 	return werr;
@@ -83,6 +97,8 @@ WERROR NetGetAnyDCName_r(struct libnetapi_ctx *ctx,
 	NTSTATUS status;
 	WERROR werr;
 	struct dcerpc_binding_handle *b;
+	const char *dcname;
+	void *buffer;
 
 	werr = libnetapi_get_binding_handle(ctx, r->in.server_name,
 					    &ndr_table_netlogon.syntax_id,
@@ -94,12 +110,24 @@ WERROR NetGetAnyDCName_r(struct libnetapi_ctx *ctx,
 	status = dcerpc_netr_GetAnyDCName(b, talloc_tos(),
 					  r->in.server_name,
 					  r->in.domain_name,
-					  (const char **)r->out.buffer,
+					  &dcname,
 					  &werr);
 	if (!NT_STATUS_IS_OK(status)) {
 		werr = ntstatus_to_werror(status);
 		goto done;
 	}
+
+	if (!W_ERROR_IS_OK(werr)) {
+		goto done;
+	}
+
+	if (NetApiBufferAllocate(strlen_m_term(dcname), &buffer)) {
+		werr = WERR_NOMEM;
+		goto done;
+	}
+	memcpy(buffer, dcname, strlen_m_term(dcname));
+	*r->out.buffer = buffer;
+
  done:
 
 	return werr;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list