[PATCH] libsmb: Put the "smb2_lease" struct into idl

Volker Lendecke Volker.Lendecke at SerNet.DE
Wed Jun 11 13:01:31 MDT 2014


Hi!

Review would be appreciated.

Thanks,

Volker

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
-------------- next part --------------
>From e3975f457374a3884eea3e977750ff1b7be5ab19 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Thu, 5 Jun 2014 10:57:36 +0000
Subject: [PATCH] libsmb: Put the "smb2_lease" struct into idl

This will make it easier in the future to NDR_PRINT a lease and
a lease key

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 libcli/smb/smb2_lease.h          | 17 +----------------
 libcli/smb/wscript               |  5 ++++-
 librpc/idl/smb2_lease_struct.idl | 27 +++++++++++++++++++++++++++
 librpc/idl/wscript_build         |  1 +
 librpc/wscript_build             |  6 ++++++
 source4/libcli/raw/interfaces.h  |  1 +
 6 files changed, 40 insertions(+), 17 deletions(-)
 create mode 100644 librpc/idl/smb2_lease_struct.idl

diff --git a/libcli/smb/smb2_lease.h b/libcli/smb/smb2_lease.h
index 73f97ac..ba8178d 100644
--- a/libcli/smb/smb2_lease.h
+++ b/libcli/smb/smb2_lease.h
@@ -23,22 +23,7 @@
 #ifndef _LIBCLI_SMB_SMB2_LEASE_H_
 #define _LIBCLI_SMB_SMB2_LEASE_H_
 
-/*
-  SMB2 lease structure (per MS-SMB2 2.2.13)
-*/
-struct smb2_lease_key {
-	uint64_t data[2];
-};
-
-struct smb2_lease {
-	struct smb2_lease_key lease_key;
-	uint32_t lease_state;
-	uint32_t lease_flags;
-	uint64_t lease_duration; /* should be 0 */
-	/* only for v2 */
-	struct smb2_lease_key parent_lease_key;
-	uint16_t lease_epoch;
-};
+#include "librpc/gen_ndr/smb2_lease_struct.h"
 
 /*
  * Parse a smb2 lease create context. Return -1 on error, buffer.length on
diff --git a/libcli/smb/wscript b/libcli/smb/wscript
index f28b745..17efc97 100755
--- a/libcli/smb/wscript
+++ b/libcli/smb/wscript
@@ -40,7 +40,10 @@ def build(bld):
 		smb2cli_echo.c
                 tstream_smbXcli_np.c
 	''',
-	deps='LIBCRYPTO errors gensec krb5samba smb_transport',
+	deps='''
+                LIBCRYPTO NDR_SMB2_LEASE_STRUCT errors gensec krb5samba
+                smb_transport
+        ''',
 	public_deps='talloc samba-util',
 	private_library=True,
 	public_headers='''
diff --git a/librpc/idl/smb2_lease_struct.idl b/librpc/idl/smb2_lease_struct.idl
new file mode 100644
index 0000000..fe792c9
--- /dev/null
+++ b/librpc/idl/smb2_lease_struct.idl
@@ -0,0 +1,27 @@
+#include "idl_types.h"
+
+/*
+  miscellaneous IDL structures
+*/
+
+[
+	pointer_default(unique)
+]
+interface smb2_lease_struct
+{
+	/*
+	 * SMB2 lease structure (per MS-SMB2 2.2.13)
+	 */
+	typedef [public] struct {
+		hyper data[2];
+	} smb2_lease_key;
+
+	typedef [public] struct {
+		smb2_lease_key lease_key;
+		uint32 lease_state;
+		uint32 lease_flags;
+		uint32 lease_duration;	/* should be 0 */
+		smb2_lease_key parent_lease_key;
+		uint16 lease_epoch;
+	} smb2_lease;
+};
\ No newline at end of file
diff --git a/librpc/idl/wscript_build b/librpc/idl/wscript_build
index d1484af..1bac9a7 100644
--- a/librpc/idl/wscript_build
+++ b/librpc/idl/wscript_build
@@ -11,6 +11,7 @@ bld.SAMBA_PIDL_LIST('PIDL',
                        oxidresolver.idl samr.idl server_id.idl srvsvc.idl winreg.idl dcerpc.idl
                        drsblobs.idl efs.idl frstrans.idl mgmt.idl netlogon.idl
                        notify.idl
+                       smb2_lease_struct.idl
                        policyagent.idl scerpc.idl svcctl.idl wkssvc.idl eventlog6.idl backupkey.idl
                        fsrvp.idl witness.idl''',
                     options='--header --ndr-parser --samba3-ndr-server --server --client --python',
diff --git a/librpc/wscript_build b/librpc/wscript_build
index 393f579..b21619e 100644
--- a/librpc/wscript_build
+++ b/librpc/wscript_build
@@ -353,6 +353,12 @@ bld.SAMBA_SUBSYSTEM('NDR_XATTR',
     public_deps='ndr NDR_SECURITY'
     )
 
+bld.SAMBA_SUBSYSTEM('NDR_SMB2_LEASE_STRUCT',
+    source='gen_ndr/ndr_smb2_lease_struct.c',
+    public_deps='ndr',
+    public_headers='gen_ndr/smb2_lease_struct.h'
+    )
+
 bld.SAMBA_SUBSYSTEM('NDR_SCHANNEL',
     source='ndr/ndr_schannel.c gen_ndr/ndr_schannel.c',
     public_deps='ndr ndr_nbt'
diff --git a/source4/libcli/raw/interfaces.h b/source4/libcli/raw/interfaces.h
index 7bc79ca..12c0377 100644
--- a/source4/libcli/raw/interfaces.h
+++ b/source4/libcli/raw/interfaces.h
@@ -25,6 +25,7 @@
 #include "source4/libcli/raw/smb.h"
 #include "../libcli/smb/smb_common.h"
 #include "librpc/gen_ndr/misc.h" /* for struct GUID */
+#include "librpc/gen_ndr/smb2_lease_struct.h"
 
 /* this structure is just a wrapper for a string, the only reason we
    bother with this is that it allows us to check the length provided
-- 
1.8.1.2



More information about the samba-technical mailing list