[SCM] Samba Shared Repository - branch v4-0-test updated -
release-4-0-0alpha2-323-g7a66d0e
Stefan Metzmacher
metze at samba.org
Thu Jan 10 15:44:51 GMT 2008
The branch, v4-0-test has been updated
via 7a66d0eff6e2300cc82b4c7585f9c45afcc851a4 (commit)
via 8d77ea379fef5ad4b2718bc8e0620304588c9239 (commit)
via 81fa63dfe6004d916bbe653cbb1b4cbdf5d3d97d (commit)
via 6ac36d6a4b83b9ef794a2022c4d46ed0b69758e9 (commit)
via a0cf47c3359ca5dfab90c1a5831a73b89ff9f027 (commit)
via 7ee3fd43f964d3161c075dae8de73c77de146538 (commit)
via c52d9e6e60e0765e4f793d64e94571b6f6c3f9c7 (commit)
from f9988734bb8a1d823e14b6bff5c4d55d75471f18 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v4-0-test
- Log -----------------------------------------------------------------
commit 7a66d0eff6e2300cc82b4c7585f9c45afcc851a4
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Thu Jan 10 15:36:35 2008 -0600
r26701: ldb: Build and install python modules when possible.
commit 8d77ea379fef5ad4b2718bc8e0620304588c9239
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Thu Jan 10 15:17:26 2008 -0600
r26700: tdb: Build and install Python bindings when possible.
commit 81fa63dfe6004d916bbe653cbb1b4cbdf5d3d97d
Author: Günther Deschner <gd at samba.org>
Date: Wed Jan 9 11:28:53 2008 -0600
r26699: Some minor cosmetics for pidl samba3 server code.
Guenther
commit 6ac36d6a4b83b9ef794a2022c4d46ed0b69758e9
Author: Günther Deschner <gd at samba.org>
Date: Wed Jan 9 10:56:07 2008 -0600
r26698: Prettify samba3 client code a little more.
Guenther
commit a0cf47c3359ca5dfab90c1a5831a73b89ff9f027
Author: Andrew Bartlett <abartlet at samba.org>
Date: Wed Jan 9 05:36:02 2008 -0600
r26697: Leak less memory into the ldb context.
(Trying to chase down memory leaks in provision)
Andrew Bartlett
commit 7ee3fd43f964d3161c075dae8de73c77de146538
Author: Günther Deschner <gd at samba.org>
Date: Tue Jan 8 22:56:44 2008 -0600
r26696: Some more minor pidl samba3 client cosmetics.
Guenther
commit c52d9e6e60e0765e4f793d64e94571b6f6c3f9c7
Author: Günther Deschner <gd at samba.org>
Date: Tue Jan 8 17:02:53 2008 -0600
r26695: Cosmetic fix for pidl generated samba3 client code.
Guenther
-----------------------------------------------------------------------
Summary of changes:
source/dsdb/schema/schema_init.c | 18 +++++-
source/lib/ldb/Makefile.in | 28 +++++++--
source/lib/ldb/configure.ac | 13 ++++
source/lib/tdb/Makefile.in | 24 ++++++--
source/lib/tdb/configure.ac | 10 +++
source/lib/tdb/tdb.py | 2 +-
source/lib/tdb/tdb_wrap.c | 74 +++++++++++++-----------
source/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm | 52 ++++++++++++----
source/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm | 38 ++++++------
9 files changed, 176 insertions(+), 83 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source/dsdb/schema/schema_init.c b/source/dsdb/schema/schema_init.c
index 3dd81fb..6a74639 100644
--- a/source/dsdb/schema/schema_init.c
+++ b/source/dsdb/schema/schema_init.c
@@ -85,24 +85,30 @@ WERROR dsdb_load_oid_mappings_ldb(struct dsdb_schema *schema,
struct prefixMapBlob pfm;
char *schema_info;
- ndr_err = ndr_pull_struct_blob(prefixMap, schema, lp_iconv_convenience(global_loadparm), &pfm,
+ TALLOC_CTX *mem_ctx = talloc_new(schema);
+ W_ERROR_HAVE_NO_MEMORY(mem_ctx);
+
+ ndr_err = ndr_pull_struct_blob(prefixMap, mem_ctx, lp_iconv_convenience(global_loadparm), &pfm,
(ndr_pull_flags_fn_t)ndr_pull_prefixMapBlob);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
NTSTATUS nt_status = ndr_map_error2ntstatus(ndr_err);
+ talloc_free(mem_ctx);
return ntstatus_to_werror(nt_status);
}
if (pfm.version != PREFIX_MAP_VERSION_DSDB) {
+ talloc_free(mem_ctx);
return WERR_FOOBAR;
}
if (schemaInfo->length != 21 && schemaInfo->data[0] == 0xFF) {
+ talloc_free(mem_ctx);
return WERR_FOOBAR;
}
/* append the schema info as last element */
pfm.ctr.dsdb.num_mappings++;
- pfm.ctr.dsdb.mappings = talloc_realloc(schema, pfm.ctr.dsdb.mappings,
+ pfm.ctr.dsdb.mappings = talloc_realloc(mem_ctx, pfm.ctr.dsdb.mappings,
struct drsuapi_DsReplicaOIDMapping,
pfm.ctr.dsdb.num_mappings);
W_ERROR_HAVE_NO_MEMORY(pfm.ctr.dsdb.mappings);
@@ -116,7 +122,8 @@ WERROR dsdb_load_oid_mappings_ldb(struct dsdb_schema *schema,
/* call the drsuapi version */
status = dsdb_load_oid_mappings_drsuapi(schema, &pfm.ctr.dsdb);
- talloc_free(pfm.ctr.dsdb.mappings);
+ talloc_free(mem_ctx);
+
W_ERROR_NOT_OK_RETURN(status);
return WERR_OK;
@@ -1164,6 +1171,8 @@ WERROR dsdb_attach_schema_from_ldif_file(struct ldb_context *ldb, const char *pf
if (!msg) {
goto nomem;
}
+ talloc_steal(mem_ctx, msg);
+ talloc_free(ldif);
prefix_val = ldb_msg_find_ldb_val(msg, "prefixMap");
if (!prefix_val) {
@@ -1200,6 +1209,9 @@ WERROR dsdb_attach_schema_from_ldif_file(struct ldb_context *ldb, const char *pf
goto nomem;
}
+ talloc_steal(mem_ctx, msg);
+ talloc_free(ldif);
+
is_sa = ldb_msg_check_string_attribute(msg, "objectClass", "attributeSchema");
is_sc = ldb_msg_check_string_attribute(msg, "objectClass", "classSchema");
diff --git a/source/lib/ldb/Makefile.in b/source/lib/ldb/Makefile.in
index 4788c02..8be5d11 100644
--- a/source/lib/ldb/Makefile.in
+++ b/source/lib/ldb/Makefile.in
@@ -112,7 +112,8 @@ lib/libldb.$(SHLIBEXT): $(SOLIB)
$(SOLIB): $(OBJS)
$(SHLD) $(SHLD_FLAGS) -o $@ $(OBJS) $(LDFLAGS) $(LIBS) $(TALLOC_LIBS) $(TDB_LIBS) $(LIBDL) $(LDAP_LIBS) @SONAMEFLAG@$(SONAME)
-all: showflags dirs $(OBJS) $(STATICLIB) $(SOLIB) $(BINS) $(EXAMPLES) manpages
+all: showflags dirs $(OBJS) $(STATICLIB) $(SOLIB) $(BINS) $(EXAMPLES) manpages \
+ @PYTHON_BUILD_TARGET@
showflags:
@echo 'ldb will be compiled with flags:'
@@ -212,12 +213,23 @@ valgrindtest: all
installcheck: install test
-install:: all
+install:: all installdirs installheaders installlibs installbin installdoc \
+ @PYTHON_INSTALL_TARGET@
+
+installdirs:
mkdir -p $(DESTDIR)$(includedir) $(DESTDIR)$(libdir) $(DESTDIR)$(bindir) $(DESTDIR)$(libdir)/pkgconfig
+
+installheaders: installdirs
cp $(headers) $(DESTDIR)$(includedir)
+
+installlibs: installdirs
cp $(STATICLIB) $(SOLIB) $(DESTDIR)$(libdir)
- cp $(BINS) $(DESTDIR)$(bindir)
cp ldb.pc $(DESTDIR)$(libdir)/pkgconfig
+
+installbin: installdirs
+ cp $(BINS) $(DESTDIR)$(bindir)
+
+installdocs: installdirs
$(srcdir)/docs/installdocs.sh $(DESTDIR)$(mandir)
gcov:
@@ -234,15 +246,17 @@ etags:
ctags:
ctags `find $(srcdir) -name "*.[ch]"`
-%_wrap.c %.py: %.i
- $(SWIG) -O -Wall -python -keyword $<
+.SUFFIXES: _wrap.c .i
+
+.i_wrap.c:
+ [ "$(SWIG)" == "no" ] || $(SWIG) -O -Wall -python -keyword $<
# Python bindings
-build-python: lib/libldb.$(SHLIBEXT) ldb_wrap.c ldb.py
+build-python: lib/libldb.$(SHLIBEXT) ldb_wrap.c
./setup.py build
install-python: build-python
- ./setup.py install --prefix=$(prefix)
+ ./setup.py install --prefix=$(DESTDIR)$(prefix)
install-swig:
cp ldb.i `$(SWIG) -swiglib`
diff --git a/source/lib/ldb/configure.ac b/source/lib/ldb/configure.ac
index 73966e8..62a840e 100644
--- a/source/lib/ldb/configure.ac
+++ b/source/lib/ldb/configure.ac
@@ -75,6 +75,19 @@ AC_LIBREPLACE_SHLD
AC_LIBREPLACE_SHLD_FLAGS
AC_LIBREPLACE_MDLD
AC_LIBREPLACE_MDLD_FLAGS
+AC_LIBREPLACE_RUNTIME_LIB_PATH_VAR
+
+AC_PATH_PROGS([PYTHON_CONFIG], [python2.6-config python2.5-config python2.4-config python-config])
+
+PYTHON_BUILD_TARGET="build-python"
+PYTHON_INSTALL_TARGET="install-python"
+AC_SUBST(PYTHON_BUILD_TARGET)
+AC_SUBST(PYTHON_INSTALL_TARGET)
+
+if test -z "$PYTHON_CONFIG"; then
+ PYTHON_BUILD_TARGET=""
+ PYTHON_INSTALL_TARGET=""
+fi
m4_include(libldb.m4)
AC_OUTPUT(Makefile ldb.pc)
diff --git a/source/lib/tdb/Makefile.in b/source/lib/tdb/Makefile.in
index a60b9a6..c98d7e0 100644
--- a/source/lib/tdb/Makefile.in
+++ b/source/lib/tdb/Makefile.in
@@ -36,7 +36,7 @@ DIRS = bin common tools
SONAME = libtdb.$(SHLIBEXT).1
SOLIB = libtdb.$(SHLIBEXT).$(PACKAGE_VERSION)
-all: showflags dirs $(PROGS) $(SOLIB) libtdb.a
+all: showflags dirs $(PROGS) $(SOLIB) libtdb.a @PYTHON_BUILD_TARGET@
showflags:
@echo 'tdb will be compiled with flags:'
@@ -55,13 +55,21 @@ showflags:
dirs:
@mkdir -p $(DIRS)
-install: all
+install: all installdirs installbin installheaders installlibs @PYTHON_INSTALL_TARGET@
+
+installdirs:
mkdir -p $(DESTDIR)$(bindir)
mkdir -p $(DESTDIR)$(includedir)
mkdir -p $(DESTDIR)$(libdir)
mkdir -p $(DESTDIR)$(libdir)/pkgconfig
+
+installbin: installdirs
cp $(PROGS) $(DESTDIR)$(bindir)
+
+installheaders: installdirs
cp $(srcdir)/include/tdb.h $(DESTDIR)$(includedir)
+
+installlibs: installdirs
cp tdb.pc $(DESTDIR)$(libdir)/pkgconfig
cp libtdb.a $(SOLIB) $(DESTDIR)$(libdir)
@@ -112,14 +120,16 @@ distclean: clean
realdistclean: distclean
rm -f configure include/config.h.in
-tdb_wrap.c tdb.py: tdb.i
- $(SWIG) -O -Wall -python -keyword tdb.i
+.SUFFIXES: .i _wrap.c
+
+.i_wrap.c:
+ $(SWIG) -O -Wall -python -keyword $<
-build-python: libtdb.$(SHLIBEXT) tdb_wrap.c tdb.py
+build-python: libtdb.$(SHLIBEXT) tdb_wrap.c
./setup.py build
-install-python:
- ./setup.py install --prefix=$(prefix)
+installpython: build-python
+ ./setup.py install --prefix=$(DESTDIR)$(prefix)
check-python: build-python
# FIXME: Should be more portable:
diff --git a/source/lib/tdb/configure.ac b/source/lib/tdb/configure.ac
index 3237d29..5747107 100644
--- a/source/lib/tdb/configure.ac
+++ b/source/lib/tdb/configure.ac
@@ -12,4 +12,14 @@ AC_LD_SHLIBEXT
AC_LIBREPLACE_SHLD
AC_LIBREPLACE_SHLD_FLAGS
m4_include(libtdb.m4)
+AC_PATH_PROGS([PYTHON_CONFIG], [python2.6-config python2.5-config python2.4-config python-config])
+
+PYTHON_BUILD_TARGET="build-python"
+PYTHON_INSTALL_TARGET="install-python"
+AC_SUBST(PYTHON_BUILD_TARGET)
+AC_SUBST(PYTHON_INSTALL_TARGET)
+if test -z "$PYTHON_CONFIG"; then
+ PYTHON_BUILD_TARGET=""
+ PYTHON_INSTALL_TARGET=""
+fi
AC_OUTPUT(Makefile tdb.pc)
diff --git a/source/lib/tdb/tdb.py b/source/lib/tdb/tdb.py
index 0a803ac..0effa3f 100644
--- a/source/lib/tdb/tdb.py
+++ b/source/lib/tdb/tdb.py
@@ -1,5 +1,5 @@
# This file was automatically generated by SWIG (http://www.swig.org).
-# Version 1.3.31
+# Version 1.3.33
#
# Don't modify this file, modify the SWIG interface instead.
diff --git a/source/lib/tdb/tdb_wrap.c b/source/lib/tdb/tdb_wrap.c
index 7e38a97..6a5b7fe 100644
--- a/source/lib/tdb/tdb_wrap.c
+++ b/source/lib/tdb/tdb_wrap.c
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.31
+ * Version 1.3.33
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
@@ -17,14 +17,14 @@
/* template workaround for compilers that cannot correctly implement the C++ standard */
#ifndef SWIGTEMPLATEDISAMBIGUATOR
-# if defined(__SUNPRO_CC)
-# if (__SUNPRO_CC <= 0x560)
-# define SWIGTEMPLATEDISAMBIGUATOR template
-# else
-# define SWIGTEMPLATEDISAMBIGUATOR
-# endif
+# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
+# define SWIGTEMPLATEDISAMBIGUATOR template
+# elif defined(__HP_aCC)
+/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
+/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
+# define SWIGTEMPLATEDISAMBIGUATOR template
# else
-# define SWIGTEMPLATEDISAMBIGUATOR
+# define SWIGTEMPLATEDISAMBIGUATOR
# endif
#endif
@@ -107,6 +107,12 @@
# define _CRT_SECURE_NO_DEPRECATE
#endif
+/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
+#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
+# define _SCL_SECURE_NO_DEPRECATE
+#endif
+
+
/* Python.h has to appear first */
#include <Python.h>
@@ -343,7 +349,7 @@ SWIG_TypeNameComp(const char *f1, const char *l1,
while ((*f2 == ' ') && (f2 != l2)) ++f2;
if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
}
- return (l1 - f1) - (l2 - f2);
+ return (int)((l1 - f1) - (l2 - f2));
}
/*
@@ -1090,14 +1096,14 @@ SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) {
/* Unpack the argument tuple */
SWIGINTERN int
-SWIG_Python_UnpackTuple(PyObject *args, const char *name, int min, int max, PyObject **objs)
+SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs)
{
if (!args) {
if (!min && !max) {
return 1;
} else {
PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none",
- name, (min == max ? "" : "at least "), min);
+ name, (min == max ? "" : "at least "), (int)min);
return 0;
}
}
@@ -1105,14 +1111,14 @@ SWIG_Python_UnpackTuple(PyObject *args, const char *name, int min, int max, PyOb
PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple");
return 0;
} else {
- register int l = PyTuple_GET_SIZE(args);
+ register Py_ssize_t l = PyTuple_GET_SIZE(args);
if (l < min) {
PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
- name, (min == max ? "" : "at least "), min, l);
+ name, (min == max ? "" : "at least "), (int)min, (int)l);
return 0;
} else if (l > max) {
PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
- name, (min == max ? "" : "at most "), max, l);
+ name, (min == max ? "" : "at most "), (int)max, (int)l);
return 0;
} else {
register int i;
@@ -1591,9 +1597,11 @@ _PySwigObject_type(void) {
(unaryfunc)0, /*nb_float*/
(unaryfunc)PySwigObject_oct, /*nb_oct*/
(unaryfunc)PySwigObject_hex, /*nb_hex*/
-#if PY_VERSION_HEX >= 0x02020000
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */
-#elif PY_VERSION_HEX >= 0x02000000
+#if PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */
+#elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */
+#elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */
0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */
#endif
};
@@ -2492,7 +2500,7 @@ static swig_module_info swig_module = {swig_types, 11, 0, 0, 0, 0};
#define SWIG_name "_tdb"
-#define SWIGVERSION 0x010331
+#define SWIGVERSION 0x010333
#define SWIG_VERSION SWIGVERSION
@@ -2596,14 +2604,12 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
#include <limits.h>
-#ifndef LLONG_MIN
-# define LLONG_MIN LONG_LONG_MIN
-#endif
-#ifndef LLONG_MAX
-# define LLONG_MAX LONG_LONG_MAX
-#endif
-#ifndef ULLONG_MAX
-# define ULLONG_MAX ULONG_LONG_MAX
+#if !defined(SWIG_NO_LLONG_MAX)
+# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
+# define LLONG_MAX __LONG_LONG_MAX__
+# define LLONG_MIN (-LLONG_MAX - 1LL)
+# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
+# endif
#endif
@@ -3631,15 +3637,15 @@ static PyMethodDef SwigMethods[] = {
static swig_type_info _swigt__p_TDB_DATA = {"_p_TDB_DATA", "TDB_DATA *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_int = {"_p_int", "int *|mode_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_long_long = {"_p_long_long", "long long *|intmax_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_short = {"_p_short", "short *|int_least16_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_signed_char = {"_p_signed_char", "signed char *|int_fast8_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_int = {"_p_int", "intptr_t *|int *|int_least32_t *|int_fast32_t *|int32_t *|int_fast16_t *|mode_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_long_long = {"_p_long_long", "int_least64_t *|int_fast64_t *|int64_t *|long long *|intmax_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_short = {"_p_short", "short *|int_least16_t *|int16_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_signed_char = {"_p_signed_char", "signed char *|int_least8_t *|int_fast8_t *|int8_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_tdb_context = {"_p_tdb_context", "struct tdb_context *|tdb *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "unsigned char *|uint_fast8_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_unsigned_int = {"_p_unsigned_int", "unsigned int *|uintptr_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_unsigned_long_long = {"_p_unsigned_long_long", "unsigned long long *|uintmax_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_unsigned_short = {"_p_unsigned_short", "unsigned short *|uint_least16_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "unsigned char *|uint_least8_t *|uint_fast8_t *|uint8_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_unsigned_int = {"_p_unsigned_int", "uintptr_t *|uint_least32_t *|uint_fast32_t *|uint32_t *|unsigned int *|uint_fast16_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_unsigned_long_long = {"_p_unsigned_long_long", "uint_least64_t *|uint_fast64_t *|uint64_t *|unsigned long long *|uintmax_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_unsigned_short = {"_p_unsigned_short", "unsigned short *|uint_least16_t *|uint16_t *", 0, 0, (void*)0, 0};
static swig_type_info *swig_type_initial[] = {
&_swigt__p_TDB_DATA,
diff --git a/source/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm b/source/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
index e174f77..b7372a8 100644
--- a/source/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
+++ b/source/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
@@ -2,6 +2,7 @@
# Samba3 client generator for IDL structures
# on top of Samba4 style NDR functions
# Copyright jelmer at samba.org 2005-2006
+# Copyright gd at samba.org 2008
# released under the GNU GPL
package Parse::Pidl::Samba3::ClientNDR;
@@ -23,10 +24,19 @@ $VERSION = '0.01';
sub indent($) { my ($self) = @_; $self->{tabs}.="\t"; }
sub deindent($) { my ($self) = @_; $self->{tabs} = substr($self->{tabs}, 1); }
-sub pidl($$) { my ($self,$txt) = @_; $self->{res} .= "$self->{tabs}$txt\n"; }
+sub pidl($$) { my ($self,$txt) = @_; $self->{res} .= $txt ? "$self->{tabs}$txt\n" : "\n"; }
sub pidl_hdr($$) { my ($self, $txt) = @_; $self->{res_hdr} .= "$txt\n"; }
sub fn_declare($$) { my ($self,$n) = @_; $self->pidl($n); $self->pidl_hdr("$n;"); }
+sub genpad($)
+{
+ my ($s) = @_;
+ my $nt = int((length($s)+1)/8);
+ my $lt = ($nt*8)-1;
+ my $ns = (length($s)-$lt);
+ return "\t"x($nt)." "x($ns);
+}
+
sub new($)
{
my ($class) = shift;
@@ -38,20 +48,23 @@ sub ParseFunction($$$)
{
my ($self, $if, $fn) = @_;
- my $inargs = "";
- my $defargs = "";
+ my $fn_args = "";
my $uif = uc($if);
my $ufn = "NDR_".uc($fn->{NAME});
+ my $fn_str = "NTSTATUS rpccli_$fn->{NAME}";
+ my $pad = genpad($fn_str);
+
+ $fn_args .= "struct rpc_pipe_client *cli,\n" . $pad . "TALLOC_CTX *mem_ctx";
foreach (@{$fn->{ELEMENTS}}) {
- $defargs .= ", " . DeclLong($_);
+ $fn_args .= ",\n" . $pad . DeclLong($_);
}
if (defined($fn->{RETURN_TYPE}) && ($fn->{RETURN_TYPE} eq "WERROR")) {
- $defargs .= ", WERROR *werror";
+ $fn_args .= ",\n" . $pad . "WERROR *werror";
}
- $self->fn_declare("NTSTATUS rpccli_$fn->{NAME}(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx$defargs)");
+ $self->fn_declare("$fn_str($fn_args)");
$self->pidl("{");
$self->indent;
$self->pidl("struct $fn->{NAME} r;");
@@ -62,14 +75,22 @@ sub ParseFunction($$$)
foreach (@{$fn->{ELEMENTS}}) {
if (grep(/in/, @{$_->{DIRECTION}})) {
$self->pidl("r.in.$_->{NAME} = $_->{NAME};");
- }
+ }
}
$self->pidl("");
- $self->pidl("if (DEBUGLEVEL >= 10)");
- $self->pidl("\tNDR_PRINT_IN_DEBUG($fn->{NAME}, &r);");
+ $self->pidl("if (DEBUGLEVEL >= 10) {");
+ $self->indent;
+ $self->pidl("NDR_PRINT_IN_DEBUG($fn->{NAME}, &r);");
+ $self->deindent;
+ $self->pidl("}");
$self->pidl("");
- $self->pidl("status = cli_do_rpc_ndr(cli, mem_ctx, PI_$uif, &ndr_table_$if, $ufn, &r);");
+ $self->pidl("status = cli_do_rpc_ndr(cli,");
+ $self->pidl("\t\t\tmem_ctx,");
+ $self->pidl("\t\t\tPI_$uif,");
+ $self->pidl("\t\t\t&ndr_table_$if,");
+ $self->pidl("\t\t\t$ufn,");
+ $self->pidl("\t\t\t&r);");
$self->pidl("");
$self->pidl("if (!NT_STATUS_IS_OK(status)) {");
@@ -79,11 +100,16 @@ sub ParseFunction($$$)
$self->pidl("}");
$self->pidl("");
- $self->pidl("if (DEBUGLEVEL >= 10)");
- $self->pidl("\tNDR_PRINT_OUT_DEBUG($fn->{NAME}, &r);");
+ $self->pidl("if (DEBUGLEVEL >= 10) {");
+ $self->indent;
+ $self->pidl("NDR_PRINT_OUT_DEBUG($fn->{NAME}, &r);");
+ $self->deindent;
+ $self->pidl("}");
--
Samba Shared Repository
More information about the samba-cvs
mailing list