summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-01-22 16:39:56 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-01-22 16:39:56 +0100
commit4075a2ba982ea56ff925e0a33839f0760fd71911 (patch)
tree87d87734257f814b7960a843e54455c447f34a9e
parent24da29746998de1001d18871dcbe8d37643667d5 (diff)
parent35c68316442808a135aafa864d19592108a4d879 (diff)
downloadsamba-4075a2ba982ea56ff925e0a33839f0760fd71911.tar.gz
samba-4075a2ba982ea56ff925e0a33839f0760fd71911.tar.bz2
samba-4075a2ba982ea56ff925e0a33839f0760fd71911.zip
Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into v4-0-python
(This used to be commit 2f57e25f8f692889d9e057e13256f8a24c5ec10c)
-rw-r--r--.gitignore16
-rw-r--r--howto.txt59
-rw-r--r--source4/VERSION2
-rw-r--r--source4/auth/credentials/credentials.i17
-rw-r--r--source4/auth/credentials/credentials_wrap.c16
-rw-r--r--source4/auth/gensec/spnego_parse.c2
-rw-r--r--source4/auth/kerberos/gssapi_parse.c2
-rw-r--r--source4/build/m4/env.m417
-rw-r--r--source4/build/m4/public.m411
-rw-r--r--source4/build/smb_build/config_mk.pm4
-rw-r--r--source4/build/smb_build/makefile.pm21
-rw-r--r--source4/dsdb/samdb/ldb_modules/config.mk26
-rw-r--r--source4/dsdb/samdb/ldb_modules/instancetype.c128
-rw-r--r--source4/dsdb/samdb/ldb_modules/linked_attributes.c92
-rw-r--r--source4/dsdb/samdb/ldb_modules/normalise.c166
-rw-r--r--source4/dsdb/samdb/ldb_modules/objectclass.c4
-rw-r--r--source4/dsdb/samdb/ldb_modules/partition.c54
-rw-r--r--source4/dsdb/samdb/ldb_modules/samba3sam.c2
-rw-r--r--source4/dsdb/samdb/ldb_modules/simple_ldap_map.c23
-rw-r--r--source4/dsdb/samdb/samdb.c2
-rw-r--r--source4/headermap.txt4
-rw-r--r--source4/heimdal/lib/com_err/lex.c32
-rw-r--r--source4/heimdal_build/config.mk4
-rw-r--r--source4/ldap_server/ldap_server.c2
-rw-r--r--source4/lib/ldb/include/ldb.h2
-rw-r--r--source4/lib/ldb/ldb.i122
-rw-r--r--source4/lib/ldb/ldb.py39
-rw-r--r--source4/lib/ldb/ldb_map/ldb_map.c80
-rw-r--r--source4/lib/ldb/ldb_map/ldb_map.h4
-rw-r--r--source4/lib/ldb/ldb_wrap.c309
-rw-r--r--source4/lib/ldb/python.mk5
-rwxr-xr-xsource4/lib/ldb/tests/python/api.py47
-rwxr-xr-xsource4/lib/ldb/tests/python/ldap.py534
-rw-r--r--source4/lib/ldb/tools/ldbsearch.c24
-rw-r--r--source4/lib/nss_wrapper/config.mk5
-rw-r--r--source4/lib/policy/config.mk2
-rw-r--r--source4/lib/registry/dir.c6
-rw-r--r--source4/lib/registry/hive.c2
-rw-r--r--source4/lib/registry/ldb.c109
-rw-r--r--source4/lib/registry/local.c2
-rw-r--r--source4/lib/registry/patchfile.c20
-rw-r--r--source4/lib/registry/regf.c24
-rw-r--r--source4/lib/registry/samba.c2
-rw-r--r--source4/lib/registry/tests/hive.c10
-rw-r--r--source4/lib/registry/tests/registry.c20
-rw-r--r--source4/lib/replace/getpass.m410
-rw-r--r--source4/lib/replace/libreplace.m41
-rw-r--r--source4/lib/replace/libreplace_ld.m42
-rw-r--r--source4/lib/replace/replace.c2
-rw-r--r--source4/lib/replace/replace.h8
-rw-r--r--source4/lib/replace/system/config.m425
-rw-r--r--source4/lib/replace/system/network.h4
-rw-r--r--source4/lib/replace/system/passwd.h4
-rw-r--r--source4/lib/samba3/config.mk5
-rw-r--r--source4/lib/socket_wrapper/config.mk5
-rw-r--r--source4/lib/tdb/common/freelist.c186
-rw-r--r--source4/lib/tdb/common/io.c20
-rw-r--r--source4/lib/tdb/common/lock.c7
-rw-r--r--source4/lib/tdb/common/open.c17
-rw-r--r--source4/lib/tdb/common/tdb.c77
-rw-r--r--source4/lib/tdb/common/tdb_private.h9
-rw-r--r--source4/lib/tdb/common/transaction.c409
-rw-r--r--source4/lib/tdb/common/traverse.c6
-rw-r--r--source4/lib/tdb/docs/README3
-rw-r--r--source4/lib/tdb/include/tdb.h10
-rw-r--r--source4/lib/tdb/python/tdbdump.py12
-rw-r--r--source4/lib/tdb/tools/tdbtool.c2
-rw-r--r--source4/lib/tdr/config.mk5
-rw-r--r--source4/lib/util/asn1.c (renamed from source4/libcli/util/asn1.c)2
-rw-r--r--source4/lib/util/asn1.h (renamed from source4/libcli/util/asn_1.h)2
-rw-r--r--source4/lib/util/config.mk5
-rw-r--r--source4/libcli/cldap/cldap.h2
-rw-r--r--source4/libcli/config.mk32
-rw-r--r--source4/libcli/ldap/ldap.c2
-rw-r--r--source4/libcli/ldap/ldap_client.c2
-rw-r--r--source4/libcli/ldap/ldap_controls.c2
-rw-r--r--source4/libcli/swig/libcli_nbt.i1
-rw-r--r--source4/libcli/swig/libcli_nbt.py117
-rw-r--r--source4/libcli/swig/libcli_nbt_wrap.c375
-rw-r--r--source4/libcli/swig/libcli_smb.i3
-rw-r--r--source4/libcli/swig/libcli_smb.py11
-rw-r--r--source4/libcli/swig/libcli_smb_wrap.c229
-rw-r--r--source4/libnet/config.mk5
-rw-r--r--source4/libnet/libnet_join.c9
-rw-r--r--source4/libnet/net_wrap.c2
-rw-r--r--source4/librpc/config.mk58
-rw-r--r--source4/librpc/idl/drsblobs.idl6
-rw-r--r--source4/librpc/idl/drsuapi.idl2
-rw-r--r--source4/librpc/idl/lsa.idl42
-rw-r--r--source4/librpc/idl/mgmt.idl2
-rw-r--r--source4/librpc/idl/nbt.idl4
-rw-r--r--source4/librpc/idl/netlogon.idl6
-rw-r--r--source4/librpc/idl/samr.idl4
-rw-r--r--source4/librpc/idl/spoolss.idl2
-rw-r--r--source4/librpc/idl/srvsvc.idl4
-rw-r--r--source4/librpc/idl/svcctl.idl1
-rw-r--r--source4/librpc/idl/winbind.idl4
-rw-r--r--source4/librpc/idl/winreg.idl2
-rw-r--r--source4/librpc/idl/wkssvc.idl2
-rw-r--r--source4/librpc/ndr/ndr_compression.c4
-rw-r--r--source4/librpc/ndr/ndr_drsuapi.c2
-rw-r--r--source4/librpc/rpc/dcerpc.i5
-rw-r--r--source4/librpc/rpc/dcerpc.py28
-rw-r--r--source4/librpc/rpc/dcerpc_wrap.c953
-rw-r--r--source4/nsswitch/config.mk5
-rw-r--r--source4/nsswitch/wbinfo.c1
-rw-r--r--source4/ntptr/config.mk2
-rw-r--r--source4/ntvfs/config.mk5
-rw-r--r--source4/param/config.mk5
-rw-r--r--source4/param/param.i21
-rw-r--r--source4/param/param_wrap.c20
-rw-r--r--source4/pidl/MANIFEST2
-rw-r--r--source4/pidl/META.yml18
-rw-r--r--source4/pidl/README1
-rw-r--r--source4/pidl/TODO1
-rw-r--r--source4/pidl/idl.yp38
-rw-r--r--source4/pidl/lib/Parse/Pidl.pm2
-rw-r--r--source4/pidl/lib/Parse/Pidl/CUtil.pm39
-rw-r--r--source4/pidl/lib/Parse/Pidl/Compat.pm7
-rw-r--r--source4/pidl/lib/Parse/Pidl/IDL.pm2186
-rw-r--r--source4/pidl/lib/Parse/Pidl/NDR.pm35
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm4
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm6
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4.pm1
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm41
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/Header.pm135
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm111
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/Python.pm882
-rw-r--r--source4/pidl/lib/Parse/Pidl/Typelist.pm50
-rwxr-xr-xsource4/pidl/pidl43
-rw-r--r--source4/pidl/smb_interfaces.pm1272
-rw-r--r--source4/pidl/smb_interfaces.yp233
-rwxr-xr-xsource4/pidl/tests/cutil.pl21
-rwxr-xr-xsource4/pidl/tests/header.pl54
-rwxr-xr-xsource4/pidl/tests/ndr.pl17
-rwxr-xr-xsource4/pidl/tests/parse_idl.pl34
-rwxr-xr-xsource4/pidl/tests/samba-ejs.pl13
-rwxr-xr-xsource4/pidl/tests/samba-ndr.pl51
-rwxr-xr-xsource4/pidl/tests/samba3-cli.pl71
-rw-r--r--source4/pidl/tests/samba3-srv.pl18
-rwxr-xr-xsource4/pidl/tests/typelist.pl8
-rw-r--r--source4/rpc_server/netlogon/dcerpc_netlogon.c9
-rw-r--r--source4/rpc_server/samr/dcesrv_samr.c3
-rw-r--r--source4/samba4-skip1
-rwxr-xr-xsource4/script/mkversion.sh94
-rw-r--r--source4/scripting/bin/epdump.py24
-rwxr-xr-x[-rw-r--r--]source4/scripting/bin/winreg.py133
-rw-r--r--source4/scripting/ejs/config.mk12
-rw-r--r--source4/scripting/ejs/ejsnet/net_user.c8
-rw-r--r--source4/scripting/libjs/provision.js52
-rw-r--r--source4/scripting/python/STATUS26
-rw-r--r--source4/scripting/python/config.m472
-rw-r--r--source4/scripting/python/config.mk12
-rw-r--r--source4/scripting/python/modules.c13
-rw-r--r--source4/scripting/python/pyrpc.h29
-rw-r--r--source4/scripting/python/pytalloc.c45
-rw-r--r--source4/scripting/python/pytalloc.h51
-rw-r--r--source4/scripting/python/samba/__init__.py14
-rw-r--r--source4/scripting/python/samba/provision.py40
-rw-r--r--source4/scripting/python/samba/samdb.py4
-rw-r--r--source4/scripting/python/samba/tests/dcerpc/__init__.py0
-rw-r--r--source4/scripting/python/samba/tests/dcerpc/registry.py50
-rw-r--r--source4/scripting/python/samba/tests/dcerpc/rpcecho.py44
-rw-r--r--source4/scripting/python/samba/tests/dcerpc/sam.py28
-rw-r--r--source4/scripting/python/uuidmodule.c8
-rw-r--r--source4/selftest/README17
-rwxr-xr-xsource4/selftest/samba4_tests.sh5
-rwxr-xr-xsource4/selftest/selftest.pl9
-rw-r--r--source4/selftest/target/Samba3.pm (renamed from source4/selftest/env/Samba3.pm)0
-rw-r--r--source4/selftest/target/Samba4.pm (renamed from source4/selftest/env/Samba4.pm)8
-rw-r--r--source4/selftest/target/Windows.pm (renamed from source4/selftest/env/Windows.pm)0
-rw-r--r--source4/setup/display_specifiers.ldif11
-rw-r--r--source4/setup/fedorads-partitions.ldif2
-rwxr-xr-xsource4/setup/provision10
-rwxr-xr-xsource4/setup/provision-backend13
-rw-r--r--source4/setup/provision.ldif19
-rwxr-xr-xsource4/setup/provision.py10
-rw-r--r--source4/setup/provision_basedn.ldif1
-rw-r--r--source4/setup/provision_computers_modify.ldif3
-rw-r--r--source4/setup/provision_configuration.ldif24
-rw-r--r--source4/setup/provision_configuration_basedn.ldif1
-rw-r--r--source4/setup/provision_configuration_basedn_modify.ldif9
-rw-r--r--source4/setup/provision_schema_basedn.ldif1
-rw-r--r--source4/setup/provision_schema_basedn_modify.ldif6
-rw-r--r--source4/setup/provision_self_join.ldif6
-rw-r--r--source4/setup/provision_templates.ldif2
-rw-r--r--source4/setup/provision_users.ldif28
-rw-r--r--source4/setup/provision_users_modify.ldif3
-rw-r--r--source4/setup/schema-map-fedora-ds-1.02
-rw-r--r--source4/setup/schema_samba4.ldif20
-rw-r--r--source4/setup/slapd.conf12
-rw-r--r--source4/smbd/config.mk6
-rw-r--r--source4/smbd/process_model.mk9
-rw-r--r--source4/torture/gentest.c4
-rw-r--r--source4/torture/libnet/libnet.c4
-rw-r--r--source4/torture/raw/streams.c13
-rw-r--r--source4/torture/rpc/netlogon.c9
-rw-r--r--source4/torture/rpc/samba3rpc.c2
-rwxr-xr-xtestprogs/blackbox/test_ldb.sh7
-rwxr-xr-xtestprogs/blackbox/test_smbclient.sh2
-rwxr-xr-xtestprogs/ejs/ldap.js7
201 files changed, 5375 insertions, 5970 deletions
diff --git a/.gitignore b/.gitignore
index 8af28d01af..9ed0334ea1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+source/test-results
source/lib/gencache/gencache.h
source/lib/ldb/bin
*.pc
@@ -7,6 +8,7 @@ autom4te.cache
*.x
*.hd
*.ho
+*.pyc
Makefile
configure
source/bin/*
@@ -65,6 +67,7 @@ source/lib/util/pidfile.h
source/lib/util/unix_privs.h
source/lib/util/util_proto.h
source/lib/util/wrap_xattr.h
+source/lib/util/asn1_proto.h
source/libcli/finddcs.h
source/libcli/libcli_proto.h
source/libcli/auth/proto.h
@@ -77,7 +80,6 @@ source/libcli/resolve/proto.h
source/libcli/security/proto.h
source/libcli/smb2/smb2_proto.h
source/libcli/smb_composite/proto.h
-source/libcli/util/asn1_proto.h
source/libcli/util/clilsa.h
source/libcli/util/proto.h
source/libcli/wrepl/winsrepl_proto.h
@@ -179,3 +181,15 @@ source/lib/registry/tools/common.h
source/librpc/ndr/ndr_table.h
source/rpc_server/lsa/proto.h
source/torture/winbind/proto.h
+*~
+source/auth/auth_sam_reply.h
+source/auth/session_proto.h
+source/auth/system_session_proto.h
+source/dsdb/common/proto.h
+source/dsdb/schema/proto.h
+source/lib/crypto/test_proto.h
+source/lib/registry/tests/proto.h
+source/lib/util/apidocs
+source/lib/util/util_ldb.h
+source/libcli/ldap/ldap_ndr.h
+source/libcli/resolve/lp_proto.h
diff --git a/howto.txt b/howto.txt
index 7b10b5960a..654ad658c8 100644
--- a/howto.txt
+++ b/howto.txt
@@ -1,9 +1,8 @@
Samba4 developer howto
-----------------------
+======================
tridge@samba.org, December 2004
-
A more up to date version of this howto can be found in the wiki
at http://wiki.samba.org/index.php/Samba4/HOWTO.
@@ -12,31 +11,32 @@ server. This is aimed at developers who are already familiar with
Samba3 and wish to participate in Samba4 development. This is not
aimed at production use of Samba4.
+.. contents::
Step 1: download Samba4
-----------------------
There are 2 methods of doing this:
- method 1: "rsync -avz samba.org::ftp/unpacked/samba4 ."
+ method 1: "rsync -avz samba.org::ftp/unpacked/samba_4_0_test/ samba4"
- method 2: "svn co svn://svnanon.samba.org/samba/branches/SAMBA_4_0 samba4"
+ method 2: "git clone git://git.samba.org/samba.git samba4; cd samba4; git checkout v4-0-test; cd .."
both methods will create a directory called "samba4" in the current
-directory. If you don't have rsync or svn then install one of them.
+directory. If you don't have rsync or git then install one of them.
Since only released versions of Samba contain a pregenerated configure script,
-you will have to generate it by hand:
+you will have to generate it by hand::
$ cd samba4/source
$ ./autogen.sh
-Note that the above rsync command will give you a checked out svn
-repository. So if you also have svn you can update it to the latest
-version at some future date using:
+Note that the above rsync command will give you a checked out git
+repository. So if you also have git you can update it to the latest
+version at some future date using::
$ cd samba4
- $ svn up
+ $ git pull origin v4-0-test
Step 2: compile Samba4
----------------------
@@ -46,7 +46,7 @@ Recommended optional development libraries:
- gnutls
- readline
-Run this:
+Run this::
$ cd samba4/source
$ ./configure
@@ -61,6 +61,8 @@ Step 3: install Samba4
Run this as a user who have permission to write to the install
directory (defaults to /usr/local/samba). Use --prefix option to
configure above to change this.
+
+::
# make install
@@ -73,6 +75,8 @@ binary is installed in a directory listed in your PATH environment variable.
It is presumed it's available just like any other commands from your shell.
Must be run as a user with permission to write to the install directory.
+::
+
# cd source
# ./setup/provision --realm=YOUR.REALM --domain=YOURDOM \
# --adminpass=SOMEPASSWORD --server-role='domain controller'
@@ -89,7 +93,7 @@ Step 5: Create a simple smb.conf
The provisioning will create a very simple smb.conf with no shares by
default. You will need to update it to add at least one share. For
-example:
+example::
[test]
path = /data/test
@@ -100,7 +104,7 @@ Step 6: starting Samba4
-----------------------
The simplest is to just run "smbd", but as a developer you may find
-the following more useful:
+the following more useful::
# smbd -i -M single
@@ -119,11 +123,13 @@ in your $PATH. Make sure you run the right version!
Step 7: testing Samba4
----------------------
-try these commands:
+try these commands::
- $ smbclient //localhost/test -Uadministrator%SOMEPASSWORD
- or
- $ ./script/tests/test_posix.sh //localhost/test administrator SOMEPASSWORD
+ $ smbclient //localhost/test -Uadministrator%SOMEPASSWORD
+
+or::
+
+ $ ./script/tests/test_posix.sh //localhost/test administrator SOMEPASSWORD
NOTE about filesystem support
@@ -133,23 +139,23 @@ To use the advanced features of Samba4 you need a filesystem that
supports both the "user" and "system" xattr namespaces.
If you run Linux with a 2.6 kernel and ext3 this means you need to
-include the option "user_xattr" in your /etc/fstab. For example:
+include the option "user_xattr" in your /etc/fstab. For example::
-/dev/hda3 /home ext3 user_xattr 1 1
+ /dev/hda3 /home ext3 user_xattr 1 1
You also need to compile your kernel with the XATTR and SECURITY
-options for your filesystem. For ext3 that means you need:
+options for your filesystem. For ext3 that means you need::
CONFIG_EXT3_FS_XATTR=y
CONFIG_EXT3_FS_SECURITY=y
If you are running a Linux 2.6 kernel with CONFIG_IKCONFIG_PROC
-defined you can check this with the following command:
+defined you can check this with the following command::
$ zgrep CONFIG_EXT3_FS /proc/config.gz
If you don't have a filesystem with xattr support, then you can
-simulate it by using the option:
+simulate it by using the option::
posix:eadb = /usr/local/samba/eadb.tdb
@@ -161,7 +167,7 @@ Testing your filesystem
-----------------------
To test your filesystem support, install the 'attr' package and run
-the following 4 commands as root:
+the following 4 commands as root::
# touch test.txt
# setfattr -n user.test -v test test.txt
@@ -169,11 +175,11 @@ the following 4 commands as root:
# getfattr -d test.txt
# getfattr -n security.test -d test.txt
-You should see output like this:
+You should see output like this::
# file: test.txt
user.test="test"
-
+
# file: test.txt
security.test="test2"
@@ -184,4 +190,5 @@ with the right options.
If you get any "Operation not permitted" errors then it probably means
you didn't try the test as root.
-
+..
+ vim: ft=rest
diff --git a/source4/VERSION b/source4/VERSION
index 2f5f7009de..29ff51638e 100644
--- a/source4/VERSION
+++ b/source4/VERSION
@@ -89,7 +89,7 @@ SAMBA_VERSION_RC_RELEASE=
# e.g. SAMBA_VERSION_IS_SVN_SNAPSHOT=yes #
# -> "3.0.0-SVN-build-199" #
########################################################
-SAMBA_VERSION_IS_SVN_SNAPSHOT=yes
+SAMBA_VERSION_IS_GIT_SNAPSHOT=yes
########################################################
# This is for specifying a release nickname #
diff --git a/source4/auth/credentials/credentials.i b/source4/auth/credentials/credentials.i
index 8f09ff4b18..ee09b43a75 100644
--- a/source4/auth/credentials/credentials.i
+++ b/source4/auth/credentials/credentials.i
@@ -95,3 +95,20 @@ typedef struct cli_credentials {
bool wrong_password(void);
}
} cli_credentials;
+
+%{
+struct cli_credentials *cli_credentials_from_py_object(PyObject *py_obj)
+{
+ struct cli_credentials *ret;
+
+ if (py_obj == Py_None) {
+ return cli_credentials_init_anon(NULL);
+ }
+
+ if (SWIG_ConvertPtr(py_obj, (void *)&ret, SWIGTYPE_p_cli_credentials, 0 | 0 ) < 0) {
+ return NULL;
+ }
+ return ret;
+}
+
+%}
diff --git a/source4/auth/credentials/credentials_wrap.c b/source4/auth/credentials/credentials_wrap.c
index ebf7162c5b..146a81abaf 100644
--- a/source4/auth/credentials/credentials_wrap.c
+++ b/source4/auth/credentials/credentials_wrap.c
@@ -2774,6 +2774,22 @@ SWIGINTERNINLINE PyObject*
}
SWIGINTERN void delete_cli_credentials(cli_credentials *self){ talloc_free(self); }
+
+struct cli_credentials *cli_credentials_from_py_object(PyObject *py_obj)
+{
+ struct cli_credentials *ret;
+
+ if (py_obj == Py_None) {
+ return cli_credentials_init_anon(NULL);
+ }
+
+ if (SWIG_ConvertPtr(py_obj, (void *)&ret, SWIGTYPE_p_cli_credentials, 0 | 0 ) < 0) {
+ return NULL;
+ }
+ return ret;
+}
+
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/source4/auth/gensec/spnego_parse.c b/source4/auth/gensec/spnego_parse.c
index 37f4f12278..8012a83ba8 100644
--- a/source4/auth/gensec/spnego_parse.c
+++ b/source4/auth/gensec/spnego_parse.c
@@ -23,7 +23,7 @@
#include "includes.h"
#include "auth/gensec/spnego.h"
#include "auth/gensec/gensec.h"
-#include "libcli/util/asn_1.h"
+#include "lib/util/asn1.h"
static bool read_negTokenInit(struct asn1_data *asn1, TALLOC_CTX *mem_ctx,
struct spnego_negTokenInit *token)
diff --git a/source4/auth/kerberos/gssapi_parse.c b/source4/auth/kerberos/gssapi_parse.c
index 4b1b178238..77e907d3fa 100644
--- a/source4/auth/kerberos/gssapi_parse.c
+++ b/source4/auth/kerberos/gssapi_parse.c
@@ -22,7 +22,7 @@
*/
#include "includes.h"
-#include "libcli/util/asn_1.h"
+#include "lib/util/asn1.h"
#include "auth/gensec/gensec.h"
/*
diff --git a/source4/build/m4/env.m4 b/source4/build/m4/env.m4
index 7556f16ce2..9510a8ee0d 100644
--- a/source4/build/m4/env.m4
+++ b/source4/build/m4/env.m4
@@ -19,9 +19,20 @@ AC_SUBST(datarootdir)
SMB_VERSION_STRING=`cat ${srcdir}/version.h | grep 'SAMBA_VERSION_OFFICIAL_STRING' | cut -d '"' -f2`
echo "SAMBA VERSION: ${SMB_VERSION_STRING}"
-SAMBA_VERSION_SVN_REVISION=`cat ${srcdir}/version.h | grep 'SAMBA_VERSION_SVN_REVISION' | cut -d ' ' -f3-`
-if test -n "${SAMBA_VERSION_SVN_REVISION}";then
- echo "BUILD REVISION: ${SAMBA_VERSION_SVN_REVISION}"
+SAMBA_VERSION_GIT_COMMIT_FULLREV=`cat ${srcdir}/version.h | grep 'SAMBA_VERSION_GIT_COMMIT_FULLREV' | cut -d ' ' -f3- | cut -d '"' -f2`
+if test -n "${SAMBA_VERSION_GIT_COMMIT_FULLREV}";then
+ echo "BUILD COMMIT REVISION: ${SAMBA_VERSION_GIT_COMMIT_FULLREV}"
+fi
+SAMBA_VERSION_GIT_COMMIT_DATE=`cat ${srcdir}/version.h | grep 'SAMBA_VERSION_GIT_COMMIT_DATE' | cut -d ' ' -f3-`
+if test -n "${SAMBA_VERSION_GIT_COMMIT_DATE}";then
+ echo "BUILD COMMIT DATE: ${SAMBA_VERSION_GIT_COMMIT_DATE}"
+fi
+SAMBA_VERSION_GIT_COMMIT_TIME=`cat ${srcdir}/version.h | grep 'SAMBA_VERSION_GIT_COMMIT_TIME' | cut -d ' ' -f3-`
+if test -n "${SAMBA_VERSION_GIT_COMMIT_TIME}";then
+ echo "BUILD COMMIT TIME: ${SAMBA_VERSION_GIT_COMMIT_TIME}"
+
+ # just to keep the build-farm gui happy for now...
+ echo "BUILD REVISION: ${SAMBA_VERSION_GIT_COMMIT_TIME}"
fi
m4_include(build/m4/check_path.m4)
diff --git a/source4/build/m4/public.m4 b/source4/build/m4/public.m4
index 9e82e6aaf1..6d693eaeee 100644
--- a/source4/build/m4/public.m4
+++ b/source4/build/m4/public.m4
@@ -8,7 +8,7 @@ dnl SMB_SUBSYSTEM(name,obj_files,required_subsystems)
dnl
dnl SMB_EXT_LIB_FROM_PKGCONFIG(name,pkg-config name,[ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
dnl
-dnl SMB_EXT_LIB(name,libs,cflags,cppflags,ldflags)
+dnl SMB_EXT_LIB(name,libs,cflags,cppflags,ldflags,pcname)
dnl
dnl SMB_ENABLE(name,default_build)
dnl
@@ -34,7 +34,7 @@ ENABLE = YES
"
])
-dnl SMB_LIBRARY(name,description,obj_files,required_subsystems,version,so_version,cflags,ldflags)
+dnl SMB_LIBRARY(name,description,obj_files,required_subsystems,version,so_version,cflags,ldflags,pcname)
AC_DEFUN([SMB_LIBRARY],
[
SMB_INFO_LIBRARIES="$SMB_INFO_LIBRARIES
@@ -48,6 +48,7 @@ VERSION = $5
SO_VERSION = $6
CFLAGS = $7
LDFLAGS = $8
+PC_NAME = $9
ENABLE = YES
# End Library $1
###################################
@@ -93,7 +94,8 @@ AC_DEFUN([SMB_EXT_LIB_FROM_PKGCONFIG],
[`$PKG_CONFIG --libs-only-l '$2'`],
[`$PKG_CONFIG --cflags-only-other '$2'`],
[`$PKG_CONFIG --cflags-only-I '$2'`],
- [`$PKG_CONFIG --libs-only-other '$2'` `$PKG_CONFIG --libs-only-L '$2'`])
+ [`$PKG_CONFIG --libs-only-other '$2'` `$PKG_CONFIG --libs-only-L '$2'`],
+ [ $2 ])
ac_cv_$1_found=yes
else
@@ -125,7 +127,7 @@ include $1
"
])
-dnl SMB_EXT_LIB(name,libs,cflags,cppflags,ldflags)
+dnl SMB_EXT_LIB(name,libs,cflags,cppflags,ldflags,pcname)
AC_DEFUN([SMB_EXT_LIB],
[
@@ -137,6 +139,7 @@ LIBS = $2
CFLAGS = $3
CPPFLAGS = $4
LDFLAGS = $5
+PC_NAME = $6
# End Ext Lib $1
###################################
"
diff --git a/source4/build/smb_build/config_mk.pm b/source4/build/smb_build/config_mk.pm
index 7ad6600a8c..d07660ba1d 100644
--- a/source4/build/smb_build/config_mk.pm
+++ b/source4/build/smb_build/config_mk.pm
@@ -18,6 +18,7 @@ my $section_types = {
"CFLAGS" => "list",
"CPPFLAGS" => "list",
"LDFLAGS" => "list",
+ "PC_NAME" => "string",
},
"PYTHON" => {
SWIG_FILE => "string",
@@ -26,6 +27,7 @@ my $section_types = {
"OBJ_FILES" => "list",
"ENABLE" => "bool",
"LDFLAGS" => "list",
+ "CFLAGS" => "list",
},
"SUBSYSTEM" => {
"OBJ_FILES" => "list",
@@ -87,6 +89,8 @@ my $section_types = {
"VERSION" => "string",
"SO_VERSION" => "string",
"LIBRARY_REALNAME" => "string",
+
+ "PC_NAME" => "string",
"INIT_FUNCTION_TYPE" => "string",
"INIT_FUNCTION_SENTINEL" => "string",
diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm
index 0e7771c3f2..7e715b47eb 100644
--- a/source4/build/smb_build/makefile.pm
+++ b/source4/build/smb_build/makefile.pm
@@ -27,6 +27,7 @@ sub new($$$)
$self->{torture_progs} = [];
$self->{static_libs} = [];
$self->{python_dsos} = [];
+ $self->{python_pys} = [];
$self->{shared_libs} = [];
$self->{installable_shared_libs} = [];
$self->{headers} = [];
@@ -345,7 +346,7 @@ sub SharedModule($$)
push(@{$self->{all_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST)");
- if (defined($ctx->{INIT_FUNCTION})) {
+ if (defined($ctx->{INIT_FUNCTION}) and $ctx->{TYPE} ne "PYTHON") {
my $init_fn = $ctx->{INIT_FUNCTION_TYPE};
$init_fn =~ s/\(\*\)/init_module/;
my $proto_fn = $ctx->{INIT_FUNCTION_TYPE};
@@ -539,7 +540,7 @@ sub PythonFiles($$)
$self->output("$target: $source\n" .
"\tmkdir -p \$(builddir)/bin/python\n" .
"\tcp $source \$@\n\n");
- push (@{$self->{python_dsos}}, $target);
+ push (@{$self->{python_pys}}, $target);
}
}
@@ -569,24 +570,21 @@ sub PkgConfig($$$)
my $pubs;
my $privs;
my $privlibs;
+ my $publibs = "";
if (defined($ctx->{PUBLIC_DEPENDENCIES})) {
foreach (@{$ctx->{PUBLIC_DEPENDENCIES}}) {
next if ($other->{$_}->{ENABLE} eq "NO");
- if ($other->{$_}->{TYPE} eq "EXT_LIB") {
+ if (defined($other->{$_}->{PC_NAME})) {
+ $pubs .= "$other->{$_}->{PC_NAME} ";
+ } elsif ($other->{$_}->{TYPE} eq "EXT_LIB") {
my $e = $other->{$_};
-
my $ldflags = join(" ", @{$e->{LDFLAGS}});
$ldflags .= " " unless $ldflags eq "";
my $libs = join(" ", @{$e->{LIBS}});
$libs .= " " unless $libs eq "";
- $pubs .= $ldflags.$libs;
- } elsif ($other->{$_}->{TYPE} eq "LIBRARY") {
- s/^LIB//g;
- $_ = lc($_);
-
- $pubs .= "$_ ";
+ $publibs .= $ldflags.$libs;
} else {
s/^LIB//g;
$_ = lc($_);
@@ -625,7 +623,7 @@ sub PkgConfig($$$)
smb_build::env::PkgConfig($self,
$path,
$link_name,
- "-L\${libdir} -l$link_name",
+ "-L\${libdir} -l$link_name $publibs",
$privlibs,
"",
"$ctx->{VERSION}",
@@ -714,6 +712,7 @@ sub write($$)
$self->output("STATIC_LIBS = " . array2oneperline($self->{static_libs}) . "\n");
$self->output("SHARED_LIBS = " . array2oneperline($self->{shared_libs}) . "\n");
$self->output("PYTHON_DSOS = " . array2oneperline($self->{python_dsos}) . "\n");
+ $self->output("PYTHON_PYS = " . array2oneperline($self->{python_pys}) . "\n");
$self->output("INSTALLABLE_SHARED_LIBS = " . array2oneperline($self->{installable_shared_libs}) . "\n");
$self->output("PUBLIC_HEADERS = " . array2oneperline($self->{headers}) . "\n");
$self->output("PC_FILES = " . array2oneperline($self->{pc_files}) . "\n");
diff --git a/source4/dsdb/samdb/ldb_modules/config.mk b/source4/dsdb/samdb/ldb_modules/config.mk
index 95bb7de06c..dc407fbd8a 100644
--- a/source4/dsdb/samdb/ldb_modules/config.mk
+++ b/source4/dsdb/samdb/ldb_modules/config.mk
@@ -320,3 +320,29 @@ OBJ_FILES = \
# End MODULE ldb_anr
################################################
+################################################
+# Start MODULE ldb_normalise
+[MODULE::ldb_normalise]
+INIT_FUNCTION = ldb_normalise_init
+CFLAGS = -Ilib/ldb/include
+OUTPUT_TYPE = SHARED_LIBRARY
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBSAMBA-UTIL SAMDB
+SUBSYSTEM = LIBLDB
+OBJ_FILES = \
+ normalise.o
+# End MODULE ldb_normalise
+################################################
+
+################################################
+# Start MODULE ldb_instancetype
+[MODULE::ldb_instancetype]
+INIT_FUNCTION = ldb_instancetype_init
+CFLAGS = -Ilib/ldb/include
+OUTPUT_TYPE = SHARED_LIBRARY
+PRIVATE_DEPENDENCIES = LIBTALLOC
+SUBSYSTEM = LIBLDB
+OBJ_FILES = \
+ instancetype.o
+# End MODULE ldb_instancetype
+################################################
+
diff --git a/source4/dsdb/samdb/ldb_modules/instancetype.c b/source4/dsdb/samdb/ldb_modules/instancetype.c
new file mode 100644
index 0000000000..064c28ec65
--- /dev/null
+++ b/source4/dsdb/samdb/ldb_modules/instancetype.c
@@ -0,0 +1,128 @@
+/*
+ ldb database library
+
+ Copyright (C) Simo Sorce 2004-2006
+ Copyright (C) Andrew Bartlett <abartlet@samba.org> 2005
+ Copyright (C) Andrew Tridgell 2005
+ Copyright (C) Stefan Metzmacher <metze@samba.org> 2007
+
+ ** NOTE! The following LGPL license applies to the ldb
+ ** 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 3 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/>.
+*/
+
+/*
+ * Name: ldb
+ *
+ * Component: ldb instancetype module
+ *
+ * Description: add an instanceType onto every new record
+ *
+ * Author: Andrew Bartlett
+ */
+
+#include "includes.h"
+#include "ldb/include/ldb_includes.h"
+#include "librpc/gen_ndr/ndr_misc.h"
+#include "param/param.h"
+#include "dsdb/samdb/samdb.h"
+#include "dsdb/common/flags.h"
+
+/* add_record: add instancetype attribute */
+static int instancetype_add(struct ldb_module *module, struct ldb_request *req)
+{
+ struct ldb_request *down_req;
+ struct ldb_message *msg;
+ uint32_t instance_type;
+ int ret;
+ const struct ldb_control *partition_ctrl;
+ const struct dsdb_control_current_partition *partition;
+
+
+ ldb_debug(module->ldb, LDB_DEBUG_TRACE, "instancetype_add_record\n");
+
+ /* do not manipulate our control entries */
+ if (ldb_dn_is_special(req->op.add.message->dn)) {
+ return ldb_next_request(module, req);
+ }
+
+ partition_ctrl = ldb_request_get_control(req, DSDB_CONTROL_CURRENT_PARTITION_OID);
+ if (!partition_ctrl) {
+ ldb_debug_set(module->ldb, LDB_DEBUG_FATAL,
+ "instancetype_add: no current partition control found");
+ return LDB_ERR_CONSTRAINT_VIOLATION;
+ }
+
+ partition = talloc_get_type(partition_ctrl->data,
+ struct dsdb_control_current_partition);
+ SMB_ASSERT(partition && partition->version == DSDB_CONTROL_CURRENT_PARTITION_VERSION);
+
+ down_req = talloc(req, struct ldb_request);
+ if (down_req == NULL) {
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+
+ *down_req = *req;
+
+ /* we have to copy the message as the caller might have it as a const */
+ down_req->op.add.message = msg = ldb_msg_copy_shallow(down_req, req->op.add.message);
+ if (msg == NULL) {
+ talloc_free(down_req);
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+
+ /*
+ * TODO: calculate correct instance type
+ */
+ instance_type = INSTANCE_TYPE_WRITE;
+ if (ldb_dn_compare(partition->dn, msg->dn) == 0) {
+ instance_type |= INSTANCE_TYPE_IS_NC_HEAD;
+ if (ldb_dn_compare(msg->dn, samdb_base_dn(module->ldb)) != 0) {
+ instance_type |= INSTANCE_TYPE_NC_ABOVE;
+ }
+ }
+
+ ret = ldb_msg_add_fmt(msg, "instanceType", "%u", instance_type);
+ if (ret != LDB_SUCCESS) {
+ talloc_free(down_req);
+ ldb_oom(module->ldb);
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+
+ ldb_set_timeout_from_prev_req(module->ldb, req, down_req);
+
+ /* go on with the call chain */
+ ret = ldb_next_request(module, down_req);
+
+ /* do not free down_req as the call results may be linked to it,
+ * it will be freed when the upper level request get freed */
+ if (ret == LDB_SUCCESS) {
+ req->handle = down_req->handle;
+ }
+
+ return ret;
+}
+
+static const struct ldb_module_ops instancetype_ops = {
+ .name = "instancetype",
+ .add = instancetype_add,
+};
+
+
+int ldb_instancetype_init(void)
+{
+ return ldb_register_module(&instancetype_ops);
+}
diff --git a/source4/dsdb/samdb/ldb_modules/linked_attributes.c b/source4/dsdb/samdb/ldb_modules/linked_attributes.c
index 803d24e34e..b3fdffe566 100644
--- a/source4/dsdb/samdb/ldb_modules/linked_attributes.c
+++ b/source4/dsdb/samdb/ldb_modules/linked_attributes.c
@@ -279,6 +279,27 @@ static int linked_attributes_add(struct ldb_module *module, struct ldb_request *
return setup_modifies(module->ldb, ac, ac, req->op.add.message, NULL, req->op.add.message->dn);
}
+struct merge {
+ struct ldb_dn *dn;
+ bool add;
+ bool ignore;
+};
+
+static int merge_cmp(struct merge *merge1, struct merge *merge2) {
+ int ret;
+ ret = ldb_dn_compare(merge1->dn, merge2->dn);
+ if (ret == 0) {
+ if (merge1->add == merge2->add) {
+ return 0;
+ }
+ if (merge1->add == true) {
+ return 1;
+ }
+ return -1;
+ }
+ return ret;
+}
+
static int linked_attributes_mod_replace_search_callback(struct ldb_context *ldb, void *context, struct ldb_reply *ares)
{
struct replace_context *ac2 = talloc_get_type(context, struct replace_context);
@@ -296,16 +317,63 @@ static int linked_attributes_mod_replace_search_callback(struct ldb_context *ldb
/* See if this element already exists */
if (search_el) {
- int ret;
+
+ struct merge *merged_list = NULL;
+
+ int ret, size = 0, i;
struct ldb_message *msg = ldb_msg_new(ac);
if (!msg) {
ldb_oom(ac->module->ldb);
return LDB_ERR_OPERATIONS_ERROR;
}
- /* Lazy option: Delete and add the elements on all members */
- msg->num_elements = 1;
- msg->elements = search_el;
+ /* Add all the existing elements, marking as 'proposed for delete' by setting .add = false */
+ for (i=0; i < search_el->num_values; i++) {
+ merged_list = talloc_realloc(ares, merged_list, struct merge, size + 1);
+ merged_list[size].dn = ldb_dn_new(merged_list, ldb, (char *)search_el->values[i].data);
+ merged_list[size].add = false;
+ merged_list[size].ignore = false;
+ size++;
+ }
+
+ /* Add all the new replacement elements, marking as 'proposed for add' by setting .add = true */
+ for (i=0; i < ac2->el->num_values; i++) {
+ merged_list = talloc_realloc(ares, merged_list, struct merge, size + 1);
+ merged_list[size].dn = ldb_dn_new(merged_list, ldb, (char *)ac2->el->values[i].data);
+ merged_list[size].add = true;
+ merged_list[size].ignore = false;
+ size++;
+ }
+
+ /* Sort the list, so we can pick out an add and delete for the same DN, and eliminate them */
+ qsort(merged_list, size,
+ sizeof(*merged_list),
+ (comparison_fn_t)merge_cmp);
+
+ /* Now things are sorted, it is trivial to mark pairs of DNs as 'ignore' */
+ for (i=0; i + 1 < size; i++) {
+ if (ldb_dn_compare(merged_list[i].dn,
+ merged_list[i+1].dn) == 0
+ /* Fortunetly the sort also sorts 'add == false' first */
+ && merged_list[i].add == false
+ && merged_list[i+1].add == true) {
+
+ /* Mark as ignore, so we include neither in the actual operations */
+ merged_list[i].ignore = true;
+ merged_list[i+1].ignore = true;
+ }
+ }
+
+ /* Arrange to delete anything the search found that we don't re-add */
+ for (i=0; i < size; i++) {
+ if (merged_list[i].ignore == false
+ && merged_list[i].add == false) {
+ ldb_msg_add_steal_string(msg, search_el->name,
+ ldb_dn_get_linearized(merged_list[i].dn));
+ }
+ }
+
+ /* The DN to set on the linked attributes is the original DN of the modify message */
msg->dn = ac->orig_req->op.mod.message->dn;
ret = setup_modifies(ac->module->ldb, ac2, ac, msg, ares->message->dn, NULL);
@@ -313,13 +381,21 @@ static int linked_attributes_mod_replace_search_callback(struct ldb_context *ldb
return ret;
}
- msg->elements = ac2->el;
+ /* Now add links for all the actually new elements */
+ for (i=0; i < size; i++) {
+ if (merged_list[i].ignore == false && merged_list[i].add == true) {
+ ldb_msg_add_steal_string(msg, search_el->name,
+ ldb_dn_get_linearized(merged_list[i].dn));
+ }
+ }
ret = setup_modifies(ac->module->ldb, ac2, ac, msg, NULL, ares->message->dn);
if (ret != LDB_SUCCESS) {
return ret;
}
+ talloc_free(merged_list);
+
} else {
/* Looks like it doesn't exist, process like an 'add' */
struct ldb_message *msg = ldb_msg_new(ac);
@@ -411,6 +487,7 @@ static int linked_attributes_modify(struct ldb_module *module, struct ldb_reques
return LDB_ERR_OBJECT_CLASS_VIOLATION;
}
+ /* Replace with new set of values */
if (((el->flags & LDB_FLAG_MOD_MASK) == LDB_FLAG_MOD_REPLACE)
&& el->num_values > 0) {
struct replace_context *ac2 = talloc(ac, struct replace_context);
@@ -461,6 +538,8 @@ static int linked_attributes_modify(struct ldb_module *module, struct ldb_reques
}
continue;
+
+ /* Delete all values case */
} else if (((el->flags & LDB_FLAG_MOD_MASK) & (LDB_FLAG_MOD_DELETE|LDB_FLAG_MOD_REPLACE))
&& el->num_values == 0) {
const char **attrs = talloc_array(ac, const char *, 2);
@@ -508,7 +587,8 @@ static int linked_attributes_modify(struct ldb_module *module, struct ldb_reques
continue;
}
- /* Prepare the modify (mod element) on the targets */
+
+ /* Prepare the modify (mod element) on the targets, for a normal modify request */
/* For each value being moded, we need to setup the modify */
for (j=0; j < el->num_values; j++) {
diff --git a/source4/dsdb/samdb/ldb_modules/normalise.c b/source4/dsdb/samdb/ldb_modules/normalise.c
new file mode 100644
index 0000000000..efc9bb29e8
--- /dev/null
+++ b/source4/dsdb/samdb/ldb_modules/normalise.c
@@ -0,0 +1,166 @@
+/*
+ ldb database library
+
+ Copyright (C) Amdrew Bartlett <abartlet@samba.org> 2007-2008
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/*
+ * Name: ldb
+ *
+ * Component: ldb normalisation module
+ *
+ * Description: module to ensure all DNs and attribute names are normalised
+ *
+ * Author: Andrew Bartlett
+ */
+
+#include "includes.h"
+#include "ldb/include/ldb.h"
+#include "ldb/include/ldb_errors.h"
+#include "ldb/include/ldb_private.h"
+#include "dsdb/samdb/samdb.h"
+
+/* Fix up the DN to be in the standard form, taking particular care to match the parent DN
+
+ This should mean that if the parent is:
+ CN=Users,DC=samba,DC=example,DC=com
+ and a proposed child is
+ cn=Admins ,cn=USERS,dc=Samba,dc=example,dc=COM
+
+ The resulting DN should be:
+
+ CN=Admins,CN=Users,DC=samba,DC=example,DC=com
+
+ */
+static int fix_dn(struct ldb_dn *dn)
+{
+ int i, ret;
+ char *upper_rdn_attr;
+
+ for (i=0; i < ldb_dn_get_comp_num(dn); i++) {
+ /* We need the attribute name in upper case */
+ upper_rdn_attr = strupper_talloc(dn,
+ ldb_dn_get_component_name(dn, i));
+ if (!upper_rdn_attr) {
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+
+ /* And replace it with CN=foo (we need the attribute in upper case */
+ ret = ldb_dn_set_component(dn, i, upper_rdn_attr,
+ *ldb_dn_get_component_val(dn, i));
+ talloc_free(upper_rdn_attr);
+ if (ret != LDB_SUCCESS) {
+ return ret;
+ }
+ }
+ return LDB_SUCCESS;
+}
+
+static int normalise_search_callback(struct ldb_context *ldb, void *context, struct ldb_reply *ares)
+{
+ const struct dsdb_schema *schema = dsdb_get_schema(ldb);
+ struct ldb_request *orig_req = talloc_get_type(context, struct ldb_request);
+ TALLOC_CTX *mem_ctx;
+ int i, j, ret;
+
+ /* Only entries are interesting, and we handle the case of the parent seperatly */
+ if (ares->type != LDB_REPLY_ENTRY) {
+ return orig_req->callback(ldb, orig_req->context, ares);
+ }
+
+ if (!schema) {
+ return orig_req->callback(ldb, orig_req->context, ares);
+ }
+
+ mem_ctx = talloc_new(ares);
+ if (!mem_ctx) {
+ ldb_oom(ldb);
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+
+ /* OK, we have one of *many* search results passing by here,
+ * but we should get them one at a time */
+
+ ret = fix_dn(ares->message->dn);
+ if (ret != LDB_SUCCESS) {
+ talloc_free(mem_ctx);
+ return ret;
+ }
+
+ for (i = 0; i < ares->message->num_elements; i++) {
+ const struct dsdb_attribute *attribute = dsdb_attribute_by_lDAPDisplayName(schema, ares->message->elements[i].name);
+ if (!attribute) {
+ continue;
+ }
+ if ((strcmp(attribute->attributeSyntax_oid, "2.5.5.1") != 0) &&
+ (strcmp(attribute->attributeSyntax_oid, "2.5.5.7") != 0)) {
+ continue;
+ }
+ for (j = 0; j < ares->message->elements[i].num_values; j++) {
+ const char *dn_str;
+ struct ldb_dn *dn = ldb_dn_new(mem_ctx, ldb, (const char *)ares->message->elements[i].values[j].data);
+ if (!dn) {
+ talloc_free(mem_ctx);
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+ ret = fix_dn(ares->message->dn);
+ if (ret != LDB_SUCCESS) {
+ talloc_free(mem_ctx);
+ return ret;
+ }
+ dn_str = talloc_steal(ares->message->elements[i].values, ldb_dn_get_linearized(dn));
+ ares->message->elements[i].values[j] = data_blob_string_const(dn_str);
+ talloc_free(dn);
+ }
+ }
+ talloc_free(mem_ctx);
+ return orig_req->callback(ldb, orig_req->context, ares);
+}
+
+/* search */
+static int normalise_search(struct ldb_module *module, struct ldb_request *req)
+{
+ int ret;
+ struct ldb_request *down_req = talloc(req, struct ldb_request);
+ if (!down_req) {
+ ldb_oom(module->ldb);
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+
+ *down_req = *req;
+ down_req->context = req;
+ down_req->callback = normalise_search_callback;
+
+ ret = ldb_next_request(module, down_req);
+
+ /* do not free down_req as the call results may be linked to it,
+ * it will be freed when the upper level request get freed */
+ if (ret == LDB_SUCCESS) {
+ req->handle = down_req->handle;
+ }
+ return ret;
+}
+
+
+static const struct ldb_module_ops normalise_ops = {
+ .name = "normalise",
+ .search = normalise_search,
+};
+
+int ldb_normalise_init(void)
+{
+ return ldb_register_module(&normalise_ops);
+}
diff --git a/source4/dsdb/samdb/ldb_modules/objectclass.c b/source4/dsdb/samdb/ldb_modules/objectclass.c
index d3beedc689..737475ca78 100644
--- a/source4/dsdb/samdb/ldb_modules/objectclass.c
+++ b/source4/dsdb/samdb/ldb_modules/objectclass.c
@@ -532,6 +532,10 @@ static int objectclass_do_add(struct ldb_handle *h)
ldb_msg_add_string(msg, "objectCategory",
current->objectclass->defaultObjectCategory);
}
+ if (!ldb_msg_find_element(msg, "showInAdvancedViewOnly") && (current->objectclass->defaultHidingValue == true)) {
+ ldb_msg_add_string(msg, "showInAdvancedViewOnly",
+ "TRUE");
+ }
if (!ldb_msg_find_element(msg, "nTSecurityDescriptor")) {
DATA_BLOB *sd = get_sd(ac->module, mem_ctx, current->objectclass);
ldb_msg_add_steal_value(msg, "nTSecurityDescriptor", sd);
diff --git a/source4/dsdb/samdb/ldb_modules/partition.c b/source4/dsdb/samdb/ldb_modules/partition.c
index 4586810d96..61b64441a7 100644
--- a/source4/dsdb/samdb/ldb_modules/partition.c
+++ b/source4/dsdb/samdb/ldb_modules/partition.c
@@ -169,13 +169,12 @@ static int partition_other_callback(struct ldb_context *ldb, void *context, stru
}
-static int partition_send_request(struct partition_context *ac, struct ldb_control *remove_control,
+static int partition_send_request(struct partition_context *ac,
struct dsdb_control_current_partition *partition)
{
int ret;
struct ldb_module *backend;
struct ldb_request *req;
- struct ldb_control **saved_controls;
if (partition) {
backend = make_module_for_next_request(ac, ac->module->ldb, partition->module);
@@ -225,12 +224,6 @@ static int partition_send_request(struct partition_context *ac, struct ldb_contr
req->context = ac;
}
- /* Remove a control, so we don't confuse a backend server */
- if (remove_control && !save_controls(remove_control, req, &saved_controls)) {
- ldb_oom(ac->module->ldb);
- return LDB_ERR_OPERATIONS_ERROR;
- }
-
if (partition) {
ret = ldb_request_add_control(req, DSDB_CONTROL_CURRENT_PARTITION_OID, false, partition);
if (ret != LDB_SUCCESS) {
@@ -253,18 +246,17 @@ static int partition_send_request(struct partition_context *ac, struct ldb_contr
*/
static int partition_send_all(struct ldb_module *module,
struct partition_context *ac,
- struct ldb_control *remove_control,
struct ldb_request *req)
{
int i;
struct partition_private_data *data = talloc_get_type(module->private_data,
struct partition_private_data);
- int ret = partition_send_request(ac, remove_control, NULL);
+ int ret = partition_send_request(ac, NULL);
if (ret != LDB_SUCCESS) {
return ret;
}
for (i=0; data && data->partitions && data->partitions[i]; i++) {
- ret = partition_send_request(ac, remove_control, data->partitions[i]);
+ ret = partition_send_request(ac, data->partitions[i]);
if (ret != LDB_SUCCESS) {
return ret;
}
@@ -297,7 +289,7 @@ static int partition_replicate(struct ldb_module *module, struct ldb_request *re
return LDB_ERR_OPERATIONS_ERROR;
}
- return partition_send_all(module, ac, NULL, req);
+ return partition_send_all(module, ac, req);
}
}
}
@@ -314,6 +306,7 @@ static int partition_replicate(struct ldb_module *module, struct ldb_request *re
* TODO: we should maybe return an error here
* if it's not a special dn
*/
+
return ldb_next_request(module, req);
}
@@ -334,6 +327,8 @@ static int partition_replicate(struct ldb_module *module, struct ldb_request *re
/* search */
static int partition_search(struct ldb_module *module, struct ldb_request *req)
{
+ struct ldb_control **saved_controls;
+
/* Find backend */
struct partition_private_data *data = talloc_get_type(module->private_data,
struct partition_private_data);
@@ -342,19 +337,34 @@ static int partition_search(struct ldb_module *module, struct ldb_request *req)
/* (later) consider if we should be searching multiple
* partitions (for 'invisible' partition behaviour */
struct ldb_control *search_control = ldb_request_get_control(req, LDB_CONTROL_SEARCH_OPTIONS_OID);
+ struct ldb_control *domain_scope_control = ldb_request_get_control(req, LDB_CONTROL_DOMAIN_SCOPE_OID);
struct ldb_search_options_control *search_options = NULL;
if (search_control) {
search_options = talloc_get_type(search_control->data, struct ldb_search_options_control);
}
+ /* Remove the domain_scope control, so we don't confuse a backend server */
+ if (domain_scope_control && !save_controls(domain_scope_control, req, &saved_controls)) {
+ ldb_oom(module->ldb);
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+
+ /* TODO:
+ Generate referrals (look for a partition under this DN) if we don't have the above control specified
+ */
+
if (search_options && (search_options->search_options & LDB_SEARCH_OPTION_PHANTOM_ROOT)) {
int ret, i;
struct partition_context *ac;
- struct ldb_control *remove_control = NULL;
if ((search_options->search_options & ~LDB_SEARCH_OPTION_PHANTOM_ROOT) == 0) {
/* We have processed this flag, so we are done with this control now */
- remove_control = search_control;
+
+ /* Remove search control, so we don't confuse a backend server */
+ if (search_control && !save_controls(search_control, req, &saved_controls)) {
+ ldb_oom(module->ldb);
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
}
ac = partition_init_handle(req, module);
if (!ac) {
@@ -363,12 +373,12 @@ static int partition_search(struct ldb_module *module, struct ldb_request *req)
/* Search from the base DN */
if (!req->op.search.base || ldb_dn_is_null(req->op.search.base)) {
- return partition_send_all(module, ac, remove_control, req);
+ return partition_send_all(module, ac, req);
}
for (i=0; data && data->partitions && data->partitions[i]; i++) {
/* Find all partitions under the search base */
if (ldb_dn_compare_base(req->op.search.base, data->partitions[i]->dn) == 0) {
- ret = partition_send_request(ac, remove_control, data->partitions[i]);
+ ret = partition_send_request(ac, data->partitions[i]);
if (ret != LDB_SUCCESS) {
return ret;
}
@@ -384,6 +394,16 @@ static int partition_search(struct ldb_module *module, struct ldb_request *req)
return LDB_SUCCESS;
} else {
/* Handle this like all other requests */
+ if (search_control && (search_options->search_options & ~LDB_SEARCH_OPTION_PHANTOM_ROOT) == 0) {
+ /* We have processed this flag, so we are done with this control now */
+
+ /* Remove search control, so we don't confuse a backend server */
+ if (search_control && !save_controls(search_control, req, &saved_controls)) {
+ ldb_oom(module->ldb);
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+ }
+
return partition_replicate(module, req, req->op.search.base);
}
}
@@ -693,7 +713,7 @@ static int partition_extended(struct ldb_module *module, struct ldb_request *req
return LDB_ERR_OPERATIONS_ERROR;
}
- return partition_send_all(module, ac, NULL, req);
+ return partition_send_all(module, ac, req);
}
static int sort_compare(void *void1,
diff --git a/source4/dsdb/samdb/ldb_modules/samba3sam.c b/source4/dsdb/samdb/ldb_modules/samba3sam.c
index 0bfc9a3dae..3a666b5380 100644
--- a/source4/dsdb/samdb/ldb_modules/samba3sam.c
+++ b/source4/dsdb/samdb/ldb_modules/samba3sam.c
@@ -918,7 +918,7 @@ static int samba3sam_init(struct ldb_module *module)
{
int ret;
- ret = ldb_map_init(module, samba3_attributes, samba3_objectclasses, NULL, "samba3sam");
+ ret = ldb_map_init(module, samba3_attributes, samba3_objectclasses, NULL, NULL, "samba3sam");
if (ret != LDB_SUCCESS)
return ret;
diff --git a/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c b/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c
index 91001d43d7..acf2fd622c 100644
--- a/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c
+++ b/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c
@@ -376,15 +376,6 @@ static const struct ldb_map_attribute entryuuid_attributes[] =
}
},
{
- .local_name = "dn",
- .type = MAP_RENAME,
- .u = {
- .rename = {
- .remote_name = "entryDN"
- }
- }
- },
- {
.local_name = "groupType",
.type = MAP_CONVERT,
.u = {
@@ -457,6 +448,7 @@ static const char * const entryuuid_wildcard_attributes[] = {
"whenChanged",
"usnCreated",
"usnChanged",
+ "memberOf",
NULL
};
@@ -534,15 +526,6 @@ static const struct ldb_map_attribute nsuniqueid_attributes[] =
}
},
{
- .local_name = "dn",
- .type = MAP_RENAME,
- .u = {
- .rename = {
- .remote_name = "entryDN"
- }
- }
- },
- {
.local_name = "groupType",
.type = MAP_CONVERT,
.u = {
@@ -685,7 +668,7 @@ static int entryuuid_init(struct ldb_module *module)
struct map_private *map_private;
struct entryuuid_private *entryuuid_private;
- ret = ldb_map_init(module, entryuuid_attributes, entryuuid_objectclasses, entryuuid_wildcard_attributes, NULL);
+ ret = ldb_map_init(module, entryuuid_attributes, entryuuid_objectclasses, entryuuid_wildcard_attributes, "extensibleObject", NULL);
if (ret != LDB_SUCCESS)
return ret;
@@ -706,7 +689,7 @@ static int nsuniqueid_init(struct ldb_module *module)
struct map_private *map_private;
struct entryuuid_private *entryuuid_private;
- ret = ldb_map_init(module, nsuniqueid_attributes, NULL, nsuniqueid_wildcard_attributes, NULL);
+ ret = ldb_map_init(module, nsuniqueid_attributes, NULL, nsuniqueid_wildcard_attributes, "extensibleObject", NULL);
if (ret != LDB_SUCCESS)
return ret;
diff --git a/source4/dsdb/samdb/samdb.c b/source4/dsdb/samdb/samdb.c
index b042d1d3b7..c11eea1757 100644
--- a/source4/dsdb/samdb/samdb.c
+++ b/source4/dsdb/samdb/samdb.c
@@ -134,7 +134,7 @@ int samdb_copy_template(struct ldb_context *ldb,
}
/* pull the template record */
- ret = ldb_search(templates_ldb, basedn, LDB_SCOPE_BASE, "(dn=*)", NULL, &res);
+ ret = ldb_search(templates_ldb, basedn, LDB_SCOPE_BASE, "distinguishedName=*", NULL, &res);
talloc_free(basedn);
if (ret != LDB_SUCCESS) {
*errstring = talloc_steal(msg, ldb_errstring(templates_ldb));
diff --git a/source4/headermap.txt b/source4/headermap.txt
index 6ace20519f..acbe81328e 100644
--- a/source4/headermap.txt
+++ b/source4/headermap.txt
@@ -103,8 +103,8 @@ dsdb/samdb/samdb_proto.h: samdb/proto.h
dsdb/schema/schema.h: samdb/schema.h
dsdb/schema/proto.h: samdb/schema_proto.h
dsdb/common/proto.h: samdb/common_proto.h
-libcli/util/asn_1.h: samba/asn1.h
-libcli/util/asn1_proto.h: samba/asn1/proto.h
+lib/util/asn1.h: samba/asn1.h
+lib/util/asn1_proto.h: samba/asn1/proto.h
libcli/util/error.h: core/error.h
libcli/util/proto.h: core/error_proto.h
lib/tdb_wrap.h: tdb_wrap.h
diff --git a/source4/heimdal/lib/com_err/lex.c b/source4/heimdal/lib/com_err/lex.c
index 77e79d4eae..7a85b302a1 100644
--- a/source4/heimdal/lib/com_err/lex.c
+++ b/source4/heimdal/lib/com_err/lex.c
@@ -343,6 +343,9 @@ FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
typedef int yy_state_type;
extern int yylineno;
+
+int yylineno = 1;
+
extern char *yytext;
#define yytext_ptr yytext
@@ -530,7 +533,7 @@ static int getstring(void);
#undef ECHO
-#line 533 "heimdal/lib/com_err/lex.c"
+#line 536 "heimdal/lib/com_err/lex.c"
#define INITIAL 0
@@ -685,7 +688,7 @@ YY_DECL
#line 59 "lex.l"
-#line 688 "heimdal/lib/com_err/lex.c"
+#line 691 "heimdal/lib/com_err/lex.c"
if ( !(yy_init) )
{
@@ -849,7 +852,7 @@ YY_RULE_SETUP
#line 75 "lex.l"
ECHO;
YY_BREAK
-#line 852 "heimdal/lib/com_err/lex.c"
+#line 855 "heimdal/lib/com_err/lex.c"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1080,7 +1083,7 @@ static int yy_get_next_buffer (void)
/* Read in more data. */
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
- (yy_n_chars), num_to_read );
+ (yy_n_chars), (size_t) num_to_read );
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
}
@@ -1581,7 +1584,7 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
/** Setup the input buffer state to scan a string. The next call to yylex() will
* scan from a @e copy of @a str.
- * @param str a NUL-terminated string to scan
+ * @param yystr a NUL-terminated string to scan
*
* @return the newly allocated buffer state object.
* @note If you want to scan bytes that may contain NUL values, then use
@@ -1659,6 +1662,15 @@ static void yy_fatal_error (yyconst char* msg )
/* Accessor methods (get/set functions) to struct members. */
+/** Get the current line number.
+ *
+ */
+int yyget_lineno (void)
+{
+
+ return yylineno;
+}
+
/** Get the input stream.
*
*/
@@ -1692,6 +1704,16 @@ char *yyget_text (void)
return yytext;
}
+/** Set the current line number.
+ * @param line_number
+ *
+ */
+void yyset_lineno (int line_number )
+{
+
+ yylineno = line_number;
+}
+
/** Set the input stream. This does not discard the current
* input buffer.
* @param in_str A readable stream.
diff --git a/source4/heimdal_build/config.mk b/source4/heimdal_build/config.mk
index b534c9bc9f..604516ccf6 100644
--- a/source4/heimdal_build/config.mk
+++ b/source4/heimdal_build/config.mk
@@ -543,9 +543,7 @@ clean::
#######################
# Start SUBSYSTEM HEIMDAL
-[LIBRARY::HEIMDAL]
-VERSION = 0.0.1
-SO_VERSION = 0
+[SUBSYSTEM::HEIMDAL]
CFLAGS = -Iheimdal_build
OBJ_FILES = ../heimdal/lib/vers/print_version.o
PUBLIC_DEPENDENCIES = \
diff --git a/source4/ldap_server/ldap_server.c b/source4/ldap_server/ldap_server.c
index fcc9435ead..8380775c28 100644
--- a/source4/ldap_server/ldap_server.c
+++ b/source4/ldap_server/ldap_server.c
@@ -27,7 +27,7 @@
#include "auth/credentials/credentials.h"
#include "librpc/gen_ndr/ndr_samr.h"
#include "lib/util/dlinklist.h"
-#include "libcli/util/asn_1.h"
+#include "lib/util/asn1.h"
#include "ldap_server/ldap_server.h"
#include "smbd/service_task.h"
#include "smbd/service_stream.h"
diff --git a/source4/lib/ldb/include/ldb.h b/source4/lib/ldb/include/ldb.h
index e2ff8c6f98..2e54920c17 100644
--- a/source4/lib/ldb/include/ldb.h
+++ b/source4/lib/ldb/include/ldb.h
@@ -705,7 +705,7 @@ struct ldb_handle {
struct ldb_search {
struct ldb_dn *base;
enum ldb_scope scope;
- const struct ldb_parse_tree *tree;
+ struct ldb_parse_tree *tree;
const char * const *attrs;
struct ldb_result *res;
};
diff --git a/source4/lib/ldb/ldb.i b/source4/lib/ldb/ldb.i
index 57cb6b5f47..560142eb6d 100644
--- a/source4/lib/ldb/ldb.i
+++ b/source4/lib/ldb/ldb.i
@@ -50,6 +50,15 @@ typedef int ldb_error;
%include "exception.i"
%import "stdint.i"
+/* Don't expose talloc contexts in Python code. Python does reference
+ counting for us, so just create a new top-level talloc context.
+ */
+%typemap(in, numinputs=0, noblock=1) TALLOC_CTX * {
+ $1 = NULL;
+}
+
+
+
%constant int SCOPE_DEFAULT = LDB_SCOPE_DEFAULT;
%constant int SCOPE_BASE = LDB_SCOPE_BASE;
%constant int SCOPE_ONELEVEL = LDB_SCOPE_ONELEVEL;
@@ -115,7 +124,7 @@ typedef int ldb_error;
}
}
-%typemap(in,noblock=1,numinputs=1) const char * const *attrs {
+%typemap(in,noblock=1,numinputs=1) const char * const *NULL_STR_LIST {
if ($input == Py_None) {
$1 = NULL;
} else if (PySequence_Check($input)) {
@@ -129,9 +138,13 @@ typedef int ldb_error;
}
}
-%typemap(freearg,noblock=1) const char * const *attrs {
+%typemap(freearg,noblock=1) const char * const *NULL_STR_LIST {
talloc_free($1);
}
+
+%apply const char * const *NULL_STR_LIST { const char * const *attrs }
+%apply const char * const *NULL_STR_LIST { const char * const *control_strings }
+
#endif
%types(struct ldb_result *);
@@ -188,6 +201,14 @@ fail:
/* FIXME: implement __getslice__ */
#endif
+ %pythoncode {
+ def __eq__(self, other):
+ if isinstance(other, self.__class__):
+ return self.__cmp__(other) == 0
+ if isinstance(other, str):
+ return str(self) == other
+ return False
+ }
}
} ldb_dn;
@@ -278,18 +299,43 @@ typedef struct ldb_message_element {
{
return ldb_msg_element_from_pyobject(NULL, set_obj, flags, name);
}
+
+ int __len__()
+ {
+ return $self->num_values;
+ }
#endif
+
+ PyObject *get(int i)
+ {
+ if (i < 0 || i >= $self->num_values)
+ return Py_None;
+
+ return PyString_FromStringAndSize(
+ (const char *)$self->values[i].data,
+ $self->values[i].length);
+ }
+
~ldb_msg_element() { talloc_free($self); }
int compare(ldb_msg_element *);
}
%pythoncode {
+ def __getitem__(self, i):
+ ret = self.get(i)
+ if ret is None:
+ raise KeyError("no such value")
+ return ret
+
def __eq__(self, other):
- if (isinstance(other, str) and
- len(set(self)) == 1 and
- set(self).pop() == other):
+ if (len(self) == 1 and self.get(0) == other):
return True
- return self.__cmp__(other) == 0
-
+ if isinstance(other, self.__class__):
+ return self.__cmp__(other) == 0
+ o = iter(other)
+ for i in range(len(self)):
+ if self.get(i) != o.next():
+ return False
+ return True
}
} ldb_msg_element;
@@ -447,6 +493,14 @@ PyObject *PyExc_LdbError;
$result = Py_None;
};
+%typemap(out,noblock=1) struct ldb_control ** {
+ if ($1 == NULL) {
+ PyErr_SetObject(PyExc_LdbError, Py_BuildValue((char *)"(s)", ldb_errstring(arg1)));
+ SWIG_fail;
+ }
+ $result = SWIG_NewPointerObj($1, $1_descriptor, 0);
+}
+
%rename(Ldb) ldb_context;
%typemap(in,noblock=1) struct ldb_dn * {
@@ -468,13 +522,53 @@ typedef struct ldb_context {
const char *options[] = NULL);
~ldb() { talloc_free($self); }
- ldb_error search(ldb_dn *base = NULL,
+ ldb_error search_ex(TALLOC_CTX *mem_ctx,
+ ldb_dn *base = NULL,
enum ldb_scope scope = LDB_SCOPE_DEFAULT,
const char *expression = NULL,
- const char * const *attrs = NULL,
- struct ldb_result **OUT);
+ const char *const *attrs = NULL,
+ struct ldb_control **controls = NULL,
+ struct ldb_result **OUT) {
+ int ret;
+ struct ldb_result *res;
+ struct ldb_request *req;
+ res = talloc_zero(mem_ctx, struct ldb_result);
+ if (!res) {
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+
+ ret = ldb_build_search_req(&req, $self, mem_ctx,
+ base?base:ldb_get_default_basedn($self),
+ scope,
+ expression,
+ attrs,
+ controls,
+ res,
+ ldb_search_default_callback);
+
+ if (ret != LDB_SUCCESS) {
+ talloc_free(res);
+ return ret;
+ }
+
+ ldb_set_timeout($self, req, 0); /* use default timeout */
+
+ ret = ldb_request($self, req);
+
+ if (ret == LDB_SUCCESS) {
+ ret = ldb_wait(req->handle, LDB_WAIT_ALL);
+ }
+
+ talloc_free(req);
+
+ *OUT = res;
+ return ret;
+ }
+
ldb_error delete(ldb_dn *dn);
ldb_error rename(ldb_dn *olddn, ldb_dn *newdn);
+ struct ldb_control **parse_control_strings(TALLOC_CTX *mem_ctx,
+ const char * const*control_strings);
ldb_error add(ldb_msg *add_msg);
ldb_error add(PyObject *py_msg)
{
@@ -567,6 +661,14 @@ typedef struct ldb_context {
_ldb.Ldb_swiginit(self,_ldb.new_Ldb())
if url is not None:
self.connect(url, flags, options)
+
+ def search(self, base=None, scope=SCOPE_DEFAULT, expression=None,
+ attrs=None, controls=None):
+ parsed_controls = None
+ if controls is not None:
+ parsed_controls = self.parse_control_strings(controls)
+ return self.search_ex(base, scope, expression, attrs,
+ parsed_controls)
}
} ldb;
diff --git a/source4/lib/ldb/ldb.py b/source4/lib/ldb/ldb.py
index ebf8f6025a..ab2a68a4b3 100644
--- a/source4/lib/ldb/ldb.py
+++ b/source4/lib/ldb/ldb.py
@@ -71,6 +71,13 @@ class Dn(object):
def __init__(self, *args, **kwargs):
_ldb.Dn_swiginit(self,_ldb.new_Dn(*args, **kwargs))
__swig_destroy__ = _ldb.delete_Dn
+ def __eq__(self, other):
+ if isinstance(other, self.__class__):
+ return self.__cmp__(other) == 0
+ if isinstance(other, str):
+ return str(self) == other
+ return False
+
Dn.validate = new_instancemethod(_ldb.Dn_validate,None,Dn)
Dn.get_casefold = new_instancemethod(_ldb.Dn_get_casefold,None,Dn)
Dn.__str__ = new_instancemethod(_ldb.Dn___str__,None,Dn)
@@ -94,16 +101,27 @@ class ldb_msg_element(object):
def __init__(self): raise AttributeError, "No constructor defined"
__repr__ = _swig_repr
__swig_destroy__ = _ldb.delete_ldb_msg_element
+ def __getitem__(self, i):
+ ret = self.get(i)
+ if ret is None:
+ raise KeyError("no such value")
+ return ret
+
def __eq__(self, other):
- if (isinstance(other, str) and
- len(set(self)) == 1 and
- set(self).pop() == other):
+ if (len(self) == 1 and self.get(0) == other):
return True
- return self.__cmp__(other) == 0
-
+ if isinstance(other, self.__class__):
+ return self.__cmp__(other) == 0
+ o = iter(other)
+ for i in range(len(self)):
+ if self.get(i) != o.next():
+ return False
+ return True
ldb_msg_element.__iter__ = new_instancemethod(_ldb.ldb_msg_element___iter__,None,ldb_msg_element)
ldb_msg_element.__set__ = new_instancemethod(_ldb.ldb_msg_element___set__,None,ldb_msg_element)
+ldb_msg_element.__len__ = new_instancemethod(_ldb.ldb_msg_element___len__,None,ldb_msg_element)
+ldb_msg_element.get = new_instancemethod(_ldb.ldb_msg_element_get,None,ldb_msg_element)
ldb_msg_element.__cmp__ = new_instancemethod(_ldb.ldb_msg_element___cmp__,None,ldb_msg_element)
ldb_msg_element_swigregister = _ldb.ldb_msg_element_swigregister
ldb_msg_element_swigregister(ldb_msg_element)
@@ -181,10 +199,19 @@ class Ldb(object):
if url is not None:
self.connect(url, flags, options)
+ def search(self, base=None, scope=SCOPE_DEFAULT, expression=None,
+ attrs=None, controls=None):
+ parsed_controls = None
+ if controls is not None:
+ parsed_controls = self.parse_control_strings(controls)
+ return self.search_ex(base, scope, expression, attrs,
+ parsed_controls)
+
Ldb.connect = new_instancemethod(_ldb.Ldb_connect,None,Ldb)
-Ldb.search = new_instancemethod(_ldb.Ldb_search,None,Ldb)
+Ldb.search_ex = new_instancemethod(_ldb.Ldb_search_ex,None,Ldb)
Ldb.delete = new_instancemethod(_ldb.Ldb_delete,None,Ldb)
Ldb.rename = new_instancemethod(_ldb.Ldb_rename,None,Ldb)
+Ldb.parse_control_strings = new_instancemethod(_ldb.Ldb_parse_control_strings,None,Ldb)
Ldb.add = new_instancemethod(_ldb.Ldb_add,None,Ldb)
Ldb.modify = new_instancemethod(_ldb.Ldb_modify,None,Ldb)
Ldb.get_config_basedn = new_instancemethod(_ldb.Ldb_get_config_basedn,None,Ldb)
diff --git a/source4/lib/ldb/ldb_map/ldb_map.c b/source4/lib/ldb/ldb_map/ldb_map.c
index 39df427c2c..9582f36130 100644
--- a/source4/lib/ldb/ldb_map/ldb_map.c
+++ b/source4/lib/ldb/ldb_map/ldb_map.c
@@ -737,6 +737,7 @@ static struct ldb_val map_objectclass_convert_local(struct ldb_module *module, v
/* Generate a remote message with a mapped objectClass. */
static void map_objectclass_generate_remote(struct ldb_module *module, const char *local_attr, const struct ldb_message *old, struct ldb_message *remote, struct ldb_message *local)
{
+ const struct ldb_map_context *data = map_get_context(module);
struct ldb_message_element *el, *oc;
struct ldb_val val;
bool found_extensibleObject = false;
@@ -770,16 +771,16 @@ static void map_objectclass_generate_remote(struct ldb_module *module, const cha
/* Convert all local objectClasses */
for (i = 0; i < el->num_values - 1; i++) {
el->values[i] = map_objectclass_convert_local(module, el->values, &oc->values[i]);
- if (ldb_attr_cmp((char *)el->values[i].data, "extensibleObject") == 0) {
+ if (ldb_attr_cmp((char *)el->values[i].data, data->add_objectclass) == 0) {
found_extensibleObject = true;
}
}
if (!found_extensibleObject) {
- val.data = (uint8_t *)talloc_strdup(el->values, "extensibleObject");
+ val.data = (uint8_t *)talloc_strdup(el->values, data->add_objectclass);
val.length = strlen((char *)val.data);
- /* Append additional objectClass "extensibleObject" */
+ /* Append additional objectClass data->add_objectclass */
el->values[i] = val;
} else {
el->num_values--;
@@ -860,6 +861,19 @@ static struct ldb_message_element *map_objectclass_generate_local(struct ldb_mod
return el;
}
+static const struct ldb_map_attribute objectclass_convert_map = {
+ .local_name = "objectClass",
+ .type = MAP_CONVERT,
+ .u = {
+ .convert = {
+ .remote_name = "objectClass",
+ .convert_local = map_objectclass_convert_local,
+ .convert_remote = map_objectclass_convert_remote,
+ },
+ },
+};
+
+
/* Mappings for searches on objectClass= assuming a one-to-one
* mapping. Needed because this is a generate operator for the
* add/modify code */
@@ -867,19 +881,7 @@ static int map_objectclass_convert_operator(struct ldb_module *module, void *mem
struct ldb_parse_tree **new, const struct ldb_parse_tree *tree)
{
- static const struct ldb_map_attribute objectclass_map = {
- .local_name = "objectClass",
- .type = MAP_CONVERT,
- .u = {
- .convert = {
- .remote_name = "objectClass",
- .convert_local = map_objectclass_convert_local,
- .convert_remote = map_objectclass_convert_remote,
- },
- },
- };
-
- return map_subtree_collect_remote_simple(module, mem_ctx, new, tree, &objectclass_map);
+ return map_subtree_collect_remote_simple(module, mem_ctx, new, tree, &objectclass_convert_map);
}
/* Auxiliary request construction
@@ -1222,22 +1224,24 @@ static const struct ldb_map_attribute builtin_attribute_maps[] = {
},
},
{
- .local_name = "objectClass",
- .type = MAP_GENERATE,
- .convert_operator = map_objectclass_convert_operator,
- .u = {
- .generate = {
- .remote_names = { "objectClass", NULL },
- .generate_local = map_objectclass_generate_local,
- .generate_remote = map_objectclass_generate_remote,
- },
- },
- },
- {
.local_name = NULL,
}
};
+static const struct ldb_map_attribute objectclass_attribute_map = {
+ .local_name = "objectClass",
+ .type = MAP_GENERATE,
+ .convert_operator = map_objectclass_convert_operator,
+ .u = {
+ .generate = {
+ .remote_names = { "objectClass", NULL },
+ .generate_local = map_objectclass_generate_local,
+ .generate_remote = map_objectclass_generate_remote,
+ },
+ },
+};
+
+
/* Find the special 'MAP_DN_NAME' record and store local and remote
* base DNs in private data. */
static int map_init_dns(struct ldb_module *module, struct ldb_map_context *data, const char *name)
@@ -1302,7 +1306,7 @@ static int map_init_maps(struct ldb_module *module, struct ldb_map_context *data
for (j = 0; builtin_attribute_maps[j].local_name; j++) /* noop */ ;
/* Store list of attribute maps */
- data->attribute_maps = talloc_array(data, struct ldb_map_attribute, i+j+1);
+ data->attribute_maps = talloc_array(data, struct ldb_map_attribute, i+j+2);
if (data->attribute_maps == NULL) {
map_oom(module);
return LDB_ERR_OPERATIONS_ERROR;
@@ -1320,6 +1324,15 @@ static int map_init_maps(struct ldb_module *module, struct ldb_map_context *data
last++;
}
+ if (data->add_objectclass) {
+ /* ObjectClass one is very last, if required */
+ data->attribute_maps[last] = objectclass_attribute_map;
+ last++;
+ } else if (ocls) {
+ data->attribute_maps[last] = objectclass_convert_map;
+ last++;
+ }
+
/* Ensure 'local_name == NULL' for the last entry */
memset(&data->attribute_maps[last], 0, sizeof(struct ldb_map_attribute));
@@ -1339,9 +1352,10 @@ _PUBLIC_ struct ldb_module_ops ldb_map_get_ops(void)
/* Initialize global private data. */
_PUBLIC_ int ldb_map_init(struct ldb_module *module, const struct ldb_map_attribute *attrs,
- const struct ldb_map_objectclass *ocls,
- const char * const *wildcard_attributes,
- const char *name)
+ const struct ldb_map_objectclass *ocls,
+ const char * const *wildcard_attributes,
+ const char *add_objectclass,
+ const char *name)
{
struct map_private *data;
int ret;
@@ -1368,6 +1382,8 @@ _PUBLIC_ int ldb_map_init(struct ldb_module *module, const struct ldb_map_attrib
return ret;
}
+ data->context->add_objectclass = add_objectclass;
+
/* Store list of attribute and objectClass maps */
ret = map_init_maps(module, data->context, attrs, ocls, wildcard_attributes);
if (ret != LDB_SUCCESS) {
diff --git a/source4/lib/ldb/ldb_map/ldb_map.h b/source4/lib/ldb/ldb_map/ldb_map.h
index 7fe9c223b8..ef4da4e654 100644
--- a/source4/lib/ldb/ldb_map/ldb_map.h
+++ b/source4/lib/ldb/ldb_map/ldb_map.h
@@ -134,6 +134,9 @@ struct ldb_map_context {
* to any wildcard search */
const char * const *wildcard_attributes;
+ /* ObjectClass (if any) to be added to remote attributes on add */
+ const char *add_objectclass;
+
/* struct ldb_context *mapped_ldb; */
struct ldb_dn *local_base_dn;
struct ldb_dn *remote_base_dn;
@@ -149,6 +152,7 @@ struct map_private {
int ldb_map_init(struct ldb_module *module, const struct ldb_map_attribute *attrs,
const struct ldb_map_objectclass *ocls,
const char * const *wildcard_attributes,
+ const char *add_objectclass,
const char *name);
/* get copy of map_ops */
diff --git a/source4/lib/ldb/ldb_wrap.c b/source4/lib/ldb/ldb_wrap.c
index 7368d7f058..c833246ead 100644
--- a/source4/lib/ldb/ldb_wrap.c
+++ b/source4/lib/ldb/ldb_wrap.c
@@ -2459,29 +2459,31 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags)
/* -------- TYPES TABLE (BEGIN) -------- */
-#define SWIGTYPE_p_char swig_types[0]
-#define SWIGTYPE_p_f_p_void_enum_ldb_debug_level_p_q_const__char_va_list__void swig_types[1]
-#define SWIGTYPE_p_int swig_types[2]
-#define SWIGTYPE_p_ldb_context swig_types[3]
-#define SWIGTYPE_p_ldb_dn swig_types[4]
-#define SWIGTYPE_p_ldb_ldif swig_types[5]
-#define SWIGTYPE_p_ldb_message swig_types[6]
-#define SWIGTYPE_p_ldb_message_element swig_types[7]
-#define SWIGTYPE_p_ldb_module_ops swig_types[8]
-#define SWIGTYPE_p_ldb_result swig_types[9]
-#define SWIGTYPE_p_long_long swig_types[10]
-#define SWIGTYPE_p_p_char swig_types[11]
-#define SWIGTYPE_p_p_ldb_result swig_types[12]
-#define SWIGTYPE_p_short swig_types[13]
-#define SWIGTYPE_p_signed_char swig_types[14]
-#define SWIGTYPE_p_unsigned_char swig_types[15]
-#define SWIGTYPE_p_unsigned_int swig_types[16]
-#define SWIGTYPE_p_unsigned_long swig_types[17]
-#define SWIGTYPE_p_unsigned_long_long swig_types[18]
-#define SWIGTYPE_p_unsigned_short swig_types[19]
-#define SWIGTYPE_p_void swig_types[20]
-static swig_type_info *swig_types[22];
-static swig_module_info swig_module = {swig_types, 21, 0, 0, 0, 0};
+#define SWIGTYPE_p_TALLOC_CTX swig_types[0]
+#define SWIGTYPE_p_char swig_types[1]
+#define SWIGTYPE_p_f_p_void_enum_ldb_debug_level_p_q_const__char_va_list__void swig_types[2]
+#define SWIGTYPE_p_int swig_types[3]
+#define SWIGTYPE_p_ldb_context swig_types[4]
+#define SWIGTYPE_p_ldb_dn swig_types[5]
+#define SWIGTYPE_p_ldb_ldif swig_types[6]
+#define SWIGTYPE_p_ldb_message swig_types[7]
+#define SWIGTYPE_p_ldb_message_element swig_types[8]
+#define SWIGTYPE_p_ldb_module_ops swig_types[9]
+#define SWIGTYPE_p_ldb_result swig_types[10]
+#define SWIGTYPE_p_long_long swig_types[11]
+#define SWIGTYPE_p_p_char swig_types[12]
+#define SWIGTYPE_p_p_ldb_control swig_types[13]
+#define SWIGTYPE_p_p_ldb_result swig_types[14]
+#define SWIGTYPE_p_short swig_types[15]
+#define SWIGTYPE_p_signed_char swig_types[16]
+#define SWIGTYPE_p_unsigned_char swig_types[17]
+#define SWIGTYPE_p_unsigned_int swig_types[18]
+#define SWIGTYPE_p_unsigned_long swig_types[19]
+#define SWIGTYPE_p_unsigned_long_long swig_types[20]
+#define SWIGTYPE_p_unsigned_short swig_types[21]
+#define SWIGTYPE_p_void swig_types[22]
+static swig_type_info *swig_types[24];
+static swig_module_info swig_module = {swig_types, 23, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
@@ -2889,6 +2891,17 @@ SWIG_AsVal_int (PyObject * obj, int *val)
SWIGINTERN ldb_msg_element *new_ldb_msg_element(PyObject *set_obj,int flags,char const *name){
return ldb_msg_element_from_pyobject(NULL, set_obj, flags, name);
}
+SWIGINTERN int ldb_msg_element___len__(ldb_msg_element *self){
+ return self->num_values;
+ }
+SWIGINTERN PyObject *ldb_msg_element_get(ldb_msg_element *self,int i){
+ if (i < 0 || i >= self->num_values)
+ return Py_None;
+
+ return PyString_FromStringAndSize(
+ (const char *)self->values[i].data,
+ self->values[i].length);
+ }
SWIGINTERN void delete_ldb_msg_element(ldb_msg_element *self){ talloc_free(self); }
PyObject *ldb_msg_list_elements(ldb_msg *msg)
@@ -3034,6 +3047,42 @@ SWIG_AsVal_unsigned_SS_int (PyObject * obj, unsigned int *val)
}
SWIGINTERN void delete_ldb(ldb *self){ talloc_free(self); }
+SWIGINTERN ldb_error ldb_search_ex(ldb *self,TALLOC_CTX *mem_ctx,ldb_dn *base,enum ldb_scope scope,char const *expression,char const *const *attrs,struct ldb_control **controls,struct ldb_result **OUT){
+ int ret;
+ struct ldb_result *res;
+ struct ldb_request *req;
+ res = talloc_zero(mem_ctx, struct ldb_result);
+ if (!res) {
+ return 1;
+ }
+
+ ret = ldb_build_search_req(&req, self, mem_ctx,
+ base?base:ldb_get_default_basedn(self),
+ scope,
+ expression,
+ attrs,
+ controls,
+ res,
+ ldb_search_default_callback);
+
+ if (ret != 0) {
+ talloc_free(res);
+ return ret;
+ }
+
+ ldb_set_timeout(self, req, 0); /* use default timeout */
+
+ ret = ldb_request(self, req);
+
+ if (ret == 0) {
+ ret = ldb_wait(req->handle, LDB_WAIT_ALL);
+ }
+
+ talloc_free(req);
+
+ *OUT = res;
+ return ret;
+ }
SWIGINTERN ldb_error ldb_add__SWIG_1(ldb *self,PyObject *py_msg){
ldb_error ret;
int dict_pos, msg_pos;
@@ -3671,6 +3720,63 @@ fail:
}
+SWIGINTERN PyObject *_wrap_ldb_msg_element___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ ldb_msg_element *arg1 = (ldb_msg_element *) 0 ;
+ int result;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ PyObject *swig_obj[1] ;
+
+ if (!args) SWIG_fail;
+ swig_obj[0] = args;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_message_element, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ldb_msg_element___len__" "', argument " "1"" of type '" "ldb_msg_element *""'");
+ }
+ arg1 = (ldb_msg_element *)(argp1);
+ result = (int)ldb_msg_element___len__(arg1);
+ resultobj = SWIG_From_int((int)(result));
+ return resultobj;
+fail:
+ return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_ldb_msg_element_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
+ PyObject *resultobj = 0;
+ ldb_msg_element *arg1 = (ldb_msg_element *) 0 ;
+ int arg2 ;
+ PyObject *result = 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int val2 ;
+ int ecode2 = 0 ;
+ PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
+ char * kwnames[] = {
+ (char *) "self",(char *) "i", NULL
+ };
+
+ if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ldb_msg_element_get",kwnames,&obj0,&obj1)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_message_element, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ldb_msg_element_get" "', argument " "1"" of type '" "ldb_msg_element *""'");
+ }
+ arg1 = (ldb_msg_element *)(argp1);
+ ecode2 = SWIG_AsVal_int(obj1, &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ldb_msg_element_get" "', argument " "2"" of type '" "int""'");
+ }
+ arg2 = (int)(val2);
+ result = (PyObject *)ldb_msg_element_get(arg1,arg2);
+ resultobj = result;
+ return resultobj;
+fail:
+ return NULL;
+}
+
+
SWIGINTERN PyObject *_wrap_delete_ldb_msg_element(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
ldb_msg_element *arg1 = (ldb_msg_element *) 0 ;
@@ -4284,95 +4390,108 @@ fail:
}
-SWIGINTERN PyObject *_wrap_Ldb_search(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
+SWIGINTERN PyObject *_wrap_Ldb_search_ex(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
PyObject *resultobj = 0;
ldb *arg1 = (ldb *) 0 ;
- ldb_dn *arg2 = (ldb_dn *) NULL ;
- enum ldb_scope arg3 = (enum ldb_scope) LDB_SCOPE_DEFAULT ;
- char *arg4 = (char *) NULL ;
- char **arg5 = (char **) NULL ;
- struct ldb_result **arg6 = (struct ldb_result **) 0 ;
+ TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ;
+ ldb_dn *arg3 = (ldb_dn *) NULL ;
+ enum ldb_scope arg4 = (enum ldb_scope) LDB_SCOPE_DEFAULT ;
+ char *arg5 = (char *) NULL ;
+ char **arg6 = (char **) NULL ;
+ struct ldb_control **arg7 = (struct ldb_control **) NULL ;
+ struct ldb_result **arg8 = (struct ldb_result **) 0 ;
ldb_error result;
void *argp1 = 0 ;
int res1 = 0 ;
- int val3 ;
- int ecode3 = 0 ;
- int res4 ;
- char *buf4 = 0 ;
- int alloc4 = 0 ;
- struct ldb_result *temp_ldb_result6 ;
- int i6 ;
+ int val4 ;
+ int ecode4 = 0 ;
+ int res5 ;
+ char *buf5 = 0 ;
+ int alloc5 = 0 ;
+ void *argp7 = 0 ;
+ int res7 = 0 ;
+ struct ldb_result *temp_ldb_result8 ;
+ int i8 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
PyObject * obj3 = 0 ;
PyObject * obj4 = 0 ;
+ PyObject * obj5 = 0 ;
char * kwnames[] = {
- (char *) "self",(char *) "base",(char *) "scope",(char *) "expression",(char *) "attrs", NULL
+ (char *) "self",(char *) "base",(char *) "scope",(char *) "expression",(char *) "attrs",(char *) "controls", NULL
};
- arg6 = &temp_ldb_result6;
- if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OOOO:Ldb_search",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
+ arg2 = NULL;
+ arg8 = &temp_ldb_result8;
+ if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OOOOO:Ldb_search_ex",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_context, 0 | 0 );
if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_search" "', argument " "1"" of type '" "ldb *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_search_ex" "', argument " "1"" of type '" "ldb *""'");
}
arg1 = (ldb *)(argp1);
if (obj1) {
- if (ldb_dn_from_pyobject(NULL, obj1, arg1, &arg2) != 0) {
+ if (ldb_dn_from_pyobject(NULL, obj1, arg1, &arg3) != 0) {
SWIG_fail;
}
}
if (obj2) {
- ecode3 = SWIG_AsVal_int(obj2, &val3);
- if (!SWIG_IsOK(ecode3)) {
- SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Ldb_search" "', argument " "3"" of type '" "enum ldb_scope""'");
+ ecode4 = SWIG_AsVal_int(obj2, &val4);
+ if (!SWIG_IsOK(ecode4)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Ldb_search_ex" "', argument " "4"" of type '" "enum ldb_scope""'");
}
- arg3 = (enum ldb_scope)(val3);
+ arg4 = (enum ldb_scope)(val4);
}
if (obj3) {
- res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
- if (!SWIG_IsOK(res4)) {
- SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "Ldb_search" "', argument " "4"" of type '" "char const *""'");
+ res5 = SWIG_AsCharPtrAndSize(obj3, &buf5, NULL, &alloc5);
+ if (!SWIG_IsOK(res5)) {
+ SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "Ldb_search_ex" "', argument " "5"" of type '" "char const *""'");
}
- arg4 = (char *)(buf4);
+ arg5 = (char *)(buf5);
}
if (obj4) {
if (obj4 == Py_None) {
- arg5 = NULL;
+ arg6 = NULL;
} else if (PySequence_Check(obj4)) {
int i;
- arg5 = talloc_array(NULL, char *, PySequence_Size(obj4)+1);
+ arg6 = talloc_array(NULL, char *, PySequence_Size(obj4)+1);
for(i = 0; i < PySequence_Size(obj4); i++)
- arg5[i] = PyString_AsString(PySequence_GetItem(obj4, i));
- arg5[i] = NULL;
+ arg6[i] = PyString_AsString(PySequence_GetItem(obj4, i));
+ arg6[i] = NULL;
} else {
SWIG_exception(SWIG_TypeError, "expected sequence");
}
}
+ if (obj5) {
+ res7 = SWIG_ConvertPtr(obj5, &argp7,SWIGTYPE_p_p_ldb_control, 0 | 0 );
+ if (!SWIG_IsOK(res7)) {
+ SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "Ldb_search_ex" "', argument " "7"" of type '" "struct ldb_control **""'");
+ }
+ arg7 = (struct ldb_control **)(argp7);
+ }
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
- result = ldb_search(arg1,arg2,arg3,(char const *)arg4,(char const *const *)arg5,arg6);
+ result = ldb_search_ex(arg1,arg2,arg3,arg4,(char const *)arg5,(char const *const *)arg6,arg7,arg8);
if (result != 0) {
PyErr_SetObject(PyExc_LdbError, Py_BuildValue((char *)"(i,s)", result, ldb_strerror(result)));
SWIG_fail;
}
resultobj = Py_None;
- resultobj = PyList_New((*arg6)->count);
- for (i6 = 0; i6 < (*arg6)->count; i6++) {
- PyList_SetItem(resultobj, i6,
- SWIG_NewPointerObj((*arg6)->msgs[i6], SWIGTYPE_p_ldb_message, 0)
+ resultobj = PyList_New((*arg8)->count);
+ for (i8 = 0; i8 < (*arg8)->count; i8++) {
+ PyList_SetItem(resultobj, i8,
+ SWIG_NewPointerObj((*arg8)->msgs[i8], SWIGTYPE_p_ldb_message, 0)
);
}
- talloc_free(arg2);
- if (alloc4 == SWIG_NEWOBJ) free((char*)buf4);
- talloc_free(arg5);
+ talloc_free(arg3);
+ if (alloc5 == SWIG_NEWOBJ) free((char*)buf5);
+ talloc_free(arg6);
return resultobj;
fail:
- talloc_free(arg2);
- if (alloc4 == SWIG_NEWOBJ) free((char*)buf4);
- talloc_free(arg5);
+ talloc_free(arg3);
+ if (alloc5 == SWIG_NEWOBJ) free((char*)buf5);
+ talloc_free(arg6);
return NULL;
}
@@ -4462,6 +4581,55 @@ fail:
}
+SWIGINTERN PyObject *_wrap_Ldb_parse_control_strings(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
+ PyObject *resultobj = 0;
+ ldb *arg1 = (ldb *) 0 ;
+ TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ;
+ char **arg3 = (char **) 0 ;
+ struct ldb_control **result = 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
+ char * kwnames[] = {
+ (char *) "self",(char *) "control_strings", NULL
+ };
+
+ arg2 = NULL;
+ if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Ldb_parse_control_strings",kwnames,&obj0,&obj1)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_context, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_parse_control_strings" "', argument " "1"" of type '" "ldb *""'");
+ }
+ arg1 = (ldb *)(argp1);
+ if (obj1 == Py_None) {
+ arg3 = NULL;
+ } else if (PySequence_Check(obj1)) {
+ int i;
+ arg3 = talloc_array(NULL, char *, PySequence_Size(obj1)+1);
+ for(i = 0; i < PySequence_Size(obj1); i++)
+ arg3[i] = PyString_AsString(PySequence_GetItem(obj1, i));
+ arg3[i] = NULL;
+ } else {
+ SWIG_exception(SWIG_TypeError, "expected sequence");
+ }
+ if (arg1 == NULL)
+ SWIG_exception(SWIG_ValueError,
+ "ldb context must be non-NULL");
+ result = (struct ldb_control **)ldb_parse_control_strings(arg1,arg2,(char const *const *)arg3);
+ if (result == NULL) {
+ PyErr_SetObject(PyExc_LdbError, Py_BuildValue((char *)"(s)", ldb_errstring(arg1)));
+ SWIG_fail;
+ }
+ resultobj = SWIG_NewPointerObj(result, SWIGTYPE_p_p_ldb_control, 0);
+ talloc_free(arg3);
+ return resultobj;
+fail:
+ talloc_free(arg3);
+ return NULL;
+}
+
+
SWIGINTERN PyObject *_wrap_Ldb_add__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) {
PyObject *resultobj = 0;
ldb *arg1 = (ldb *) 0 ;
@@ -5254,6 +5422,8 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"ldb_msg_element___iter__", (PyCFunction)_wrap_ldb_msg_element___iter__, METH_O, NULL},
{ (char *)"ldb_msg_element___set__", (PyCFunction)_wrap_ldb_msg_element___set__, METH_O, NULL},
{ (char *)"new_MessageElement", (PyCFunction) _wrap_new_MessageElement, METH_VARARGS | METH_KEYWORDS, NULL},
+ { (char *)"ldb_msg_element___len__", (PyCFunction)_wrap_ldb_msg_element___len__, METH_O, NULL},
+ { (char *)"ldb_msg_element_get", (PyCFunction) _wrap_ldb_msg_element_get, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"delete_ldb_msg_element", (PyCFunction)_wrap_delete_ldb_msg_element, METH_O, NULL},
{ (char *)"ldb_msg_element___cmp__", (PyCFunction) _wrap_ldb_msg_element___cmp__, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"ldb_msg_element_swigregister", ldb_msg_element_swigregister, METH_VARARGS, NULL},
@@ -5274,9 +5444,10 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"new_Ldb", (PyCFunction)_wrap_new_Ldb, METH_NOARGS, NULL},
{ (char *)"Ldb_connect", (PyCFunction) _wrap_Ldb_connect, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"delete_Ldb", (PyCFunction)_wrap_delete_Ldb, METH_O, NULL},
- { (char *)"Ldb_search", (PyCFunction) _wrap_Ldb_search, METH_VARARGS | METH_KEYWORDS, NULL},
+ { (char *)"Ldb_search_ex", (PyCFunction) _wrap_Ldb_search_ex, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"Ldb_delete", (PyCFunction) _wrap_Ldb_delete, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"Ldb_rename", (PyCFunction) _wrap_Ldb_rename, METH_VARARGS | METH_KEYWORDS, NULL},
+ { (char *)"Ldb_parse_control_strings", (PyCFunction) _wrap_Ldb_parse_control_strings, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"Ldb_add", _wrap_Ldb_add, METH_VARARGS, NULL},
{ (char *)"Ldb_modify", (PyCFunction) _wrap_Ldb_modify, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"Ldb_get_config_basedn", (PyCFunction)_wrap_Ldb_get_config_basedn, METH_O, NULL},
@@ -5306,6 +5477,7 @@ static PyMethodDef SwigMethods[] = {
/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
+static swig_type_info _swigt__p_TALLOC_CTX = {"_p_TALLOC_CTX", "TALLOC_CTX *", 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_f_p_void_enum_ldb_debug_level_p_q_const__char_va_list__void = {"_p_f_p_void_enum_ldb_debug_level_p_q_const__char_va_list__void", "void (*)(void *,enum ldb_debug_level,char const *,va_list)", 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 *", 0, 0, (void*)0, 0};
@@ -5318,6 +5490,7 @@ static swig_type_info _swigt__p_ldb_module_ops = {"_p_ldb_module_ops", "struct l
static swig_type_info _swigt__p_ldb_result = {"_p_ldb_result", "struct ldb_result *", 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_p_char = {"_p_p_char", "char **", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_p_ldb_control = {"_p_p_ldb_control", "struct ldb_control **", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_p_ldb_result = {"_p_p_ldb_result", "struct ldb_result **", 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};
@@ -5329,6 +5502,7 @@ static swig_type_info _swigt__p_unsigned_short = {"_p_unsigned_short", "unsigned
static swig_type_info _swigt__p_void = {"_p_void", "void *", 0, 0, (void*)0, 0};
static swig_type_info *swig_type_initial[] = {
+ &_swigt__p_TALLOC_CTX,
&_swigt__p_char,
&_swigt__p_f_p_void_enum_ldb_debug_level_p_q_const__char_va_list__void,
&_swigt__p_int,
@@ -5341,6 +5515,7 @@ static swig_type_info *swig_type_initial[] = {
&_swigt__p_ldb_result,
&_swigt__p_long_long,
&_swigt__p_p_char,
+ &_swigt__p_p_ldb_control,
&_swigt__p_p_ldb_result,
&_swigt__p_short,
&_swigt__p_signed_char,
@@ -5352,6 +5527,7 @@ static swig_type_info *swig_type_initial[] = {
&_swigt__p_void,
};
+static swig_cast_info _swigc__p_TALLOC_CTX[] = { {&_swigt__p_TALLOC_CTX, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_f_p_void_enum_ldb_debug_level_p_q_const__char_va_list__void[] = { {&_swigt__p_f_p_void_enum_ldb_debug_level_p_q_const__char_va_list__void, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_int[] = { {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
@@ -5364,6 +5540,7 @@ static swig_cast_info _swigc__p_ldb_module_ops[] = { {&_swigt__p_ldb_module_ops
static swig_cast_info _swigc__p_ldb_result[] = { {&_swigt__p_ldb_result, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_long_long[] = { {&_swigt__p_long_long, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_p_char[] = { {&_swigt__p_p_char, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_p_ldb_control[] = { {&_swigt__p_p_ldb_control, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_p_ldb_result[] = { {&_swigt__p_p_ldb_result, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_short[] = { {&_swigt__p_short, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_signed_char[] = { {&_swigt__p_signed_char, 0, 0, 0},{0, 0, 0, 0}};
@@ -5375,6 +5552,7 @@ static swig_cast_info _swigc__p_unsigned_short[] = { {&_swigt__p_unsigned_short
static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info *swig_cast_initial[] = {
+ _swigc__p_TALLOC_CTX,
_swigc__p_char,
_swigc__p_f_p_void_enum_ldb_debug_level_p_q_const__char_va_list__void,
_swigc__p_int,
@@ -5387,6 +5565,7 @@ static swig_cast_info *swig_cast_initial[] = {
_swigc__p_ldb_result,
_swigc__p_long_long,
_swigc__p_p_char,
+ _swigc__p_p_ldb_control,
_swigc__p_p_ldb_result,
_swigc__p_short,
_swigc__p_signed_char,
diff --git a/source4/lib/ldb/python.mk b/source4/lib/ldb/python.mk
index f81c2e3e16..bbd4c1c5eb 100644
--- a/source4/lib/ldb/python.mk
+++ b/source4/lib/ldb/python.mk
@@ -1,7 +1,4 @@
-#######################
-# Start LIBRARY swig_ldb
[PYTHON::swig_ldb]
PUBLIC_DEPENDENCIES = LIBLDB
+CFLAGS = -Ilib/ldb/include
SWIG_FILE = ldb.i
-# End LIBRARY swig_ldb
-#######################
diff --git a/source4/lib/ldb/tests/python/api.py b/source4/lib/ldb/tests/python/api.py
index d9dfce8718..d5346c30b0 100755
--- a/source4/lib/ldb/tests/python/api.py
+++ b/source4/lib/ldb/tests/python/api.py
@@ -48,6 +48,10 @@ class SimpleLdb(unittest.TestCase):
l = ldb.Ldb("foo.tdb")
self.assertEquals(len(l.search()), 1)
+ def test_search_controls(self):
+ l = ldb.Ldb("foo.tdb")
+ self.assertEquals(len(l.search(controls=["paged_results:1:5"])), 1)
+
def test_search_attrs(self):
l = ldb.Ldb("foo.tdb")
self.assertEquals(len(l.search(ldb.Dn(l, ""), ldb.SCOPE_SUBTREE, "(dc=*)", ["dc"])), 0)
@@ -62,6 +66,11 @@ class SimpleLdb(unittest.TestCase):
self.assertTrue(l.get_opaque("my_opaque") is not None)
self.assertEquals(None, l.get_opaque("unknown"))
+ def test_parse_control_strings(self):
+ l = ldb.Ldb("foo.tdb")
+ self.assertRaises(ldb.LdbError, l.parse_control_strings, ["foo", "bar"])
+ self.assertTrue(l.parse_control_strings(["paged_results:1:5"]) is not None)
+
def test_search_scope_base(self):
l = ldb.Ldb("foo.tdb")
self.assertEquals(len(l.search(ldb.Dn(l, "dc=foo"),
@@ -162,54 +171,54 @@ class SimpleLdb(unittest.TestCase):
def test_modify_delete(self):
l = ldb.Ldb("foo.tdb")
m = ldb.Message()
- m.dn = ldb.Dn(l, "dc=modify")
+ m.dn = ldb.Dn(l, "dc=modifydelete")
m["bla"] = ["1234"]
l.add(m)
rm = l.search(m.dn)[0]
self.assertEquals(["1234"], list(rm["bla"]))
try:
m = ldb.Message()
- m.dn = ldb.Dn(l, "dc=modify")
+ m.dn = ldb.Dn(l, "dc=modifydelete")
m["bla"] = ldb.MessageElement([], ldb.CHANGETYPE_DELETE, "bla")
l.modify(m)
rm = l.search(m.dn)[0]
self.assertEquals(1, len(rm))
finally:
- l.delete(ldb.Dn(l, "dc=modify"))
+ l.delete(ldb.Dn(l, "dc=modifydelete"))
def test_modify_add(self):
l = ldb.Ldb("foo.tdb")
m = ldb.Message()
- m.dn = ldb.Dn(l, "dc=modify")
+ m.dn = ldb.Dn(l, "dc=add")
m["bla"] = ["1234"]
l.add(m)
try:
m = ldb.Message()
- m.dn = ldb.Dn(l, "dc=modify")
+ m.dn = ldb.Dn(l, "dc=add")
m["bla"] = ldb.MessageElement(["456"], ldb.CHANGETYPE_ADD, "bla")
l.modify(m)
rm = l.search(m.dn)[0]
self.assertEquals(2, len(rm))
self.assertEquals(["1234", "456"], list(rm["bla"]))
finally:
- l.delete(ldb.Dn(l, "dc=modify"))
+ l.delete(ldb.Dn(l, "dc=add"))
def test_modify_modify(self):
l = ldb.Ldb("foo.tdb")
m = ldb.Message()
- m.dn = ldb.Dn(l, "dc=modify")
+ m.dn = ldb.Dn(l, "dc=modify2")
m["bla"] = ["1234", "456"]
l.add(m)
try:
m = ldb.Message()
- m.dn = ldb.Dn(l, "dc=modify")
+ m.dn = ldb.Dn(l, "dc=modify2")
m["bla"] = ldb.MessageElement(["456"], ldb.CHANGETYPE_MODIFY, "bla")
l.modify(m)
rm = l.search(m.dn)[0]
self.assertEquals(2, len(rm))
self.assertEquals(["1234"], list(rm["bla"]))
finally:
- l.delete(ldb.Dn(l, "dc=modify"))
+ l.delete(ldb.Dn(l, "dc=modify2"))
def test_transaction_commit(self):
l = ldb.Ldb("foo.tdb")
@@ -240,6 +249,10 @@ class DnTests(unittest.TestCase):
def setUp(self):
self.ldb = ldb.Ldb("foo.tdb")
+ def test_eq_str(self):
+ x = ldb.Dn(self.ldb, "dc=foo,bar=bloe")
+ self.assertEquals("dc=foo,bar=bloe", x)
+
def test_str(self):
x = ldb.Dn(self.ldb, "dc=foo,bar=bloe")
self.assertEquals(x.__str__(), "dc=foo,bar=bloe")
@@ -382,6 +395,22 @@ class MessageElementTests(unittest.TestCase):
x = ldb.MessageElement(["foo"])
self.assertEquals(["foo"], list(x))
+ def test_get_item(self):
+ x = ldb.MessageElement(["foo", "bar"])
+ self.assertEquals("foo", x[0])
+ self.assertEquals("bar", x[1])
+ self.assertRaises(KeyError, lambda: x[-1])
+
+ def test_len(self):
+ x = ldb.MessageElement(["foo", "bar"])
+ self.assertEquals(2, len(x))
+
+ def test_eq(self):
+ x = ldb.MessageElement(["foo", "bar"])
+ self.assertEquals(["foo", "bar"], x)
+ x = ldb.MessageElement(["foo"])
+ self.assertEquals("foo", x)
+
class ExampleModule:
name = "example"
diff --git a/source4/lib/ldb/tests/python/ldap.py b/source4/lib/ldb/tests/python/ldap.py
index 3f70ef9b43..01b66a3890 100755
--- a/source4/lib/ldb/tests/python/ldap.py
+++ b/source4/lib/ldb/tests/python/ldap.py
@@ -11,6 +11,10 @@ sys.path.append("scripting/python")
import samba.getopt as options
from auth import system_session
+from ldb import (SCOPE_SUBTREE, SCOPE_ONELEVEL, SCOPE_BASE, LdbError,
+ LDB_ERR_NO_SUCH_OBJECT, LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS,
+ LDB_ERR_ENTRY_ALREADY_EXISTS, LDB_ERR_UNWILLING_TO_PERFORM,
+ LDB_ERR_NOT_ALLOWED_ON_NON_LEAF)
from samba import Ldb
import param
@@ -33,14 +37,21 @@ lp = param.LoadParm()
if opts.configfile:
lp.load(opts.configfile)
+def delete_force(ldb, dn):
+ try:
+ ldb.delete(dn)
+ except LdbError, (num, _):
+ if num != LDB_ERR_NO_SUCH_OBJECT:
+ assert False
+
def assertEquals(a1, a2):
- assert a1 == a2
+ assert a1 == a2, "Expected %r == %r" % (a1, a2)
def basic_tests(ldb, gc_ldb, base_dn, configuration_dn, schema_dn):
print "Running basic tests"
- ldb.delete("cn=ldaptestuser,cn=users," + base_dn)
- ldb.delete("cn=ldaptestgroup,cn=users," + base_dn)
+ delete_force(ldb, "cn=ldaptestuser,cn=users," + base_dn)
+ delete_force(ldb, "cn=ldaptestgroup,cn=users," + base_dn)
print "Testing group add with invalid member"
try:
@@ -48,8 +59,9 @@ def basic_tests(ldb, gc_ldb, base_dn, configuration_dn, schema_dn):
"dn": "cn=ldaptestgroup,cn=uSers," + base_dn,
"objectclass": "group",
"member": "cn=ldaptestuser,cn=useRs," + base_dn})
- except LdbError, (num, _):
- assert error == 32 # LDAP_NO_SUCH_OBJECT
+ except LdbError, (num, _):
+ if num != LDB_ERR_NO_SUCH_OBJECT:
+ assert False
else:
assert False
@@ -113,8 +125,7 @@ servicePrincipalName: host/ldaptest2computer
servicePrincipalName: cifs/ldaptest2computer
""")
except LdbError, (num, msg):
- #LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS
- assert num == 20, "Expected error LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS, got : %s" % msg
+ assert num == LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS
ldb.modify_ldif("""
dn: cn=ldaptest2computer,cn=computers,""" + base_dn + """
@@ -131,7 +142,7 @@ add: servicePrincipalName
servicePrincipalName: host/ldaptest2computer
""")
except LdbError, (num, msg):
- assert num == 20, "Expected error LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS, got :" + msg
+ assert num == LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS
print "Testing ranged results"
ldb.modify_ldif("""
@@ -176,59 +187,53 @@ servicePrincipalName: host/ldaptest2computer28
servicePrincipalName: host/ldaptest2computer29
""")
- res = ldb.search(base_dn, expression="(cn=ldaptest2computer))", scope=ldb.SCOPE_SUBTREE,
+ res = ldb.search(base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE,
attrs=["servicePrincipalName;range=0-*"])
assert len(res) == 1, "Could not find (cn=ldaptest2computer)"
-# print res[0]["servicePrincipalName;range=0-*"].length
- assertEquals(res[0]["servicePrincipalName;range=0-*"].length, 30)
+ #print len(res[0]["servicePrincipalName;range=0-*"])
+ assertEquals(len(res[0]["servicePrincipalName;range=0-*"]), 30)
- attrs = ["servicePrincipalName;range=0-19"]
- res = ldb.search("(cn=ldaptest2computer))", base_dn, ldb.SCOPE_SUBTREE, attrs)
+ res = ldb.search(base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName;range=0-19"])
assert len(res) == 1, "Could not find (cn=ldaptest2computer)"
# print res[0]["servicePrincipalName;range=0-19"].length
- assertEquals(res[0]["servicePrincipalName;range=0-19"].length, 20)
+ assertEquals(len(res[0]["servicePrincipalName;range=0-19"]), 20)
- attrs = ["servicePrincipalName;range=0-30"]
- res = ldb.search("(cn=ldaptest2computer))", base_dn, ldb.SCOPE_SUBTREE, attrs)
+
+ res = ldb.search(base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName;range=0-30"])
assert len(res) == 1, "Could not find (cn=ldaptest2computer)"
- assertEquals(res[0]["servicePrincipalName;range=0-*"].length, 30)
+ assertEquals(len(res[0]["servicePrincipalName;range=0-*"]), 30)
- attrs = ["servicePrincipalName;range=0-40"]
- res = ldb.search("(cn=ldaptest2computer))", base_dn, ldb.SCOPE_SUBTREE, attrs)
+ res = ldb.search(base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName;range=0-40"])
assert len(res) == 1, "Could not find (cn=ldaptest2computer)"
- assertEquals(res[0]["servicePrincipalName;range=0-*"].length, 30)
+ assertEquals(len(res[0]["servicePrincipalName;range=0-*"]), 30)
- attrs = ["servicePrincipalName;range=30-40"]
- res = ldb.search("(cn=ldaptest2computer))", base_dn, ldb.SCOPE_SUBTREE, attrs)
+ res = ldb.search(base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName;range=30-40"])
assert len(res) == 1, "Could not find (cn=ldaptest2computer)"
- assertEquals(res[0]["servicePrincipalName;range=30-*"].length, 0)
+ assertEquals(len(res[0]["servicePrincipalName;range=30-*"]), 0)
- attrs = ["servicePrincipalName;range=10-40"]
- res = ldb.search("(cn=ldaptest2computer))", base_dn, ldb.SCOPE_SUBTREE, attrs)
+
+ res = ldb.search(base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName;range=10-40"])
assert len(res) == 1, "Could not find (cn=ldaptest2computer)"
- assertEquals(res[0]["servicePrincipalName;range=10-*"].length, 20)
+ assertEquals(len(res[0]["servicePrincipalName;range=10-*"]), 20)
# pos_11 = res[0]["servicePrincipalName;range=10-*"][18]
- attrs = ["servicePrincipalName;range=11-40"]
- res = ldb.search("(cn=ldaptest2computer))", base_dn, ldb.SCOPE_SUBTREE, attrs)
+ res = ldb.search(base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName;range=11-40"])
assert len(res) == 1, "Could not find (cn=ldaptest2computer)"
- assertEquals(res[0]["servicePrincipalName;range=11-*"].length, 19)
+ assertEquals(len(res[0]["servicePrincipalName;range=11-*"]), 19)
# print res[0]["servicePrincipalName;range=11-*"][18]
# print pos_11
# assertEquals((res[0]["servicePrincipalName;range=11-*"][18]), pos_11)
- attrs = ["servicePrincipalName;range=11-15"]
- res = ldb.search("(cn=ldaptest2computer))", base_dn, ldb.SCOPE_SUBTREE, attrs)
+ res = ldb.search(base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName;range=11-15"])
assert len(res) == 1, "Could not find (cn=ldaptest2computer)"
- assertEquals(res[0]["servicePrincipalName;range=11-15"].length, 5)
+ assertEquals(len(res[0]["servicePrincipalName;range=11-15"]), 5)
# assertEquals(res[0]["servicePrincipalName;range=11-15"][4], pos_11)
- attrs = ["servicePrincipalName"]
- res = ldb.search("(cn=ldaptest2computer))", base_dn, ldb.SCOPE_SUBTREE, attrs)
+ res = ldb.search(base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName"])
assert len(res) == 1, "Could not find (cn=ldaptest2computer)"
# print res[0]["servicePrincipalName"][18]
# print pos_11
- assertEquals(res[0]["servicePrincipalName"].length, 30)
+ assertEquals(len(res[0]["servicePrincipalName"]), 30)
# assertEquals(res[0]["servicePrincipalName"][18], pos_11)
try:
@@ -249,79 +254,79 @@ servicePrincipalName: host/ldaptest2computer29
print "Testing Ambigious Name Resolution"
# Testing ldb.search for (&(anr=ldap testy)(objectClass=user))
- res = ldb.search("(&(anr=ldap testy)(objectClass=user))")
+ res = ldb.search(expression="(&(anr=ldap testy)(objectClass=user))")
assert len(res) == 3, "Could not find (&(anr=ldap testy)(objectClass=user))"
# Testing ldb.search for (&(anr=testy ldap)(objectClass=user))
- res = ldb.search("(&(anr=testy ldap)(objectClass=user))")
+ res = ldb.search(expression="(&(anr=testy ldap)(objectClass=user))")
assert len(res) == 2, "Found only %d for (&(anr=testy ldap)(objectClass=user))" % len(res)
# Testing ldb.search for (&(anr=ldap)(objectClass=user))
- res = ldb.search("(&(anr=ldap)(objectClass=user))")
+ res = ldb.search(expression="(&(anr=ldap)(objectClass=user))")
assert len(res) == 4, "Found only %d for (&(anr=ldap)(objectClass=user))" % len(res)
# Testing ldb.search for (&(anr==ldap)(objectClass=user))
- res = ldb.search("(&(anr==ldap)(objectClass=user))")
+ res = ldb.search(expression="(&(anr==ldap)(objectClass=user))")
assert len(res) == 1, "Could not find (&(anr==ldap)(objectClass=user)). Found only %d for (&(anr=ldap)(objectClass=user))" % len(res)
- assertEquals(res[0].dn, ("CN=ldaptestuser,CN=Users," + base_dn))
- assertEquals(res[0].cn, "ldaptestuser")
- assertEquals(res[0].name, "ldaptestuser")
+ assertEquals(str(res[0].dn), ("CN=ldaptestuser,CN=Users," + base_dn))
+ assertEquals(res[0]["cn"][0], "ldaptestuser")
+ assertEquals(res[0]["name"], "ldaptestuser")
# Testing ldb.search for (&(anr=testy)(objectClass=user))
- res = ldb.search("(&(anr=testy)(objectClass=user))")
+ res = ldb.search(expression="(&(anr=testy)(objectClass=user))")
assert len(res) == 2, "Found only %d for (&(anr=testy)(objectClass=user))" % len(res)
# Testing ldb.search for (&(anr=ldap testy)(objectClass=user))
- res = ldb.search("(&(anr=testy ldap)(objectClass=user))")
+ res = ldb.search(expression="(&(anr=testy ldap)(objectClass=user))")
assert len(res) == 2, "Found only %d for (&(anr=ldap testy)(objectClass=user))" % len(res)
# Testing ldb.search for (&(anr==ldap testy)(objectClass=user))
- res = ldb.search("(&(anr==testy ldap)(objectClass=user))")
+ res = ldb.search(expression="(&(anr==testy ldap)(objectClass=user))")
assert len(res) == 1, "Found only %d for (&(anr==ldap testy)(objectClass=user))" % len(res)
- assertEquals(res[0].dn, ("CN=ldaptestuser,CN=Users," + base_dn))
- assertEquals(res[0].cn, "ldaptestuser")
- assertEquals(res[0].name, "ldaptestuser")
+ assertEquals(str(res[0].dn), ("CN=ldaptestuser,CN=Users," + base_dn))
+ assertEquals(res[0]["cn"][0], "ldaptestuser")
+ assertEquals(res[0]["name"][0], "ldaptestuser")
# Testing ldb.search for (&(anr==testy ldap)(objectClass=user))
- res = ldb.search("(&(anr==testy ldap)(objectClass=user))")
+ res = ldb.search(expression="(&(anr==testy ldap)(objectClass=user))")
assert len(res) == 1, "Could not find (&(anr==testy ldap)(objectClass=user))"
- assertEquals(res[0].dn, ("CN=ldaptestuser,CN=Users," + base_dn))
- assertEquals(res[0].cn, "ldaptestuser")
- assertEquals(res[0].name, "ldaptestuser")
+ assertEquals(str(res[0].dn), ("CN=ldaptestuser,CN=Users," + base_dn))
+ assertEquals(res[0]["cn"][0], "ldaptestuser")
+ assertEquals(res[0]["name"][0], "ldaptestuser")
# Testing ldb.search for (&(anr=testy ldap user)(objectClass=user))
- res = ldb.search("(&(anr=testy ldap user)(objectClass=user))")
+ res = ldb.search(expression="(&(anr=testy ldap user)(objectClass=user))")
assert len(res) == 1, "Could not find (&(anr=testy ldap user)(objectClass=user))"
- assertEquals(res[0].dn, ("CN=ldaptestuser2,CN=Users," + base_dn))
- assertEquals(res[0].cn, "ldaptestuser2")
- assertEquals(res[0].name, "ldaptestuser2")
+ assertEquals(str(res[0].dn), ("CN=ldaptestuser2,CN=Users," + base_dn))
+ assertEquals(res[0]["cn"], "ldaptestuser2")
+ assertEquals(res[0]["name"], "ldaptestuser2")
# Testing ldb.search for (&(anr==testy ldap user2)(objectClass=user))
- res = ldb.search("(&(anr==testy ldap user2)(objectClass=user))")
+ res = ldb.search(expression="(&(anr==testy ldap user2)(objectClass=user))")
assert len(res) == 1, "Could not find (&(anr==testy ldap user2)(objectClass=user))"
- assertEquals(res[0].dn, ("CN=ldaptestuser2,CN=Users," + base_dn))
- assertEquals(res[0].cn, "ldaptestuser2")
- assertEquals(res[0].name, "ldaptestuser2")
+ assertEquals(str(res[0].dn), ("CN=ldaptestuser2,CN=Users," + base_dn))
+ assertEquals(res[0]["cn"], "ldaptestuser2")
+ assertEquals(res[0]["name"], "ldaptestuser2")
# Testing ldb.search for (&(anr==ldap user2)(objectClass=user))
- res = ldb.search("(&(anr==ldap user2)(objectClass=user))")
+ res = ldb.search(expression="(&(anr==ldap user2)(objectClass=user))")
assert len(res) == 1, "Could not find (&(anr==ldap user2)(objectClass=user))"
- assertEquals(res[0].dn, ("CN=ldaptestuser2,CN=Users," + base_dn))
- assertEquals(res[0].cn, "ldaptestuser2")
- assertEquals(res[0].name, "ldaptestuser2")
+ assertEquals(str(res[0].dn), ("CN=ldaptestuser2,CN=Users," + base_dn))
+ assertEquals(res[0]["cn"], "ldaptestuser2")
+ assertEquals(res[0]["name"], "ldaptestuser2")
# Testing ldb.search for (&(anr==not ldap user2)(objectClass=user))
- res = ldb.search("(&(anr==not ldap user2)(objectClass=user))")
+ res = ldb.search(expression="(&(anr==not ldap user2)(objectClass=user))")
assert len(res) == 0, "Must not find (&(anr==not ldap user2)(objectClass=user))"
# Testing ldb.search for (&(anr=not ldap user2)(objectClass=user))
- res = ldb.search("(&(anr=not ldap user2)(objectClass=user))")
+ res = ldb.search(expression="(&(anr=not ldap user2)(objectClass=user))")
assert len(res) == 0, "Must not find (&(anr=not ldap user2)(objectClass=user))"
print "Testing Group Modifies"
@@ -333,7 +338,7 @@ member: cn=ldaptestuser2,cn=users,""" + base_dn + """
member: cn=ldaptestcomputer,cn=computers,""" + base_dn + """
""")
- ldb.delete("cn=ldaptestuser3,cn=users," + base_dn)
+ delete_force(ldb, "cn=ldaptestuser3,cn=users," + base_dn)
print "Testing adding non-existent user to a group"
try:
@@ -344,7 +349,7 @@ add: member
member: cn=ldaptestuser3,cn=users,""" + base_dn + """
""")
except LdbError, (num, _):
- assert num == 32
+ assert num == LDB_ERR_NO_SUCH_OBJECT
else:
assert False
@@ -354,22 +359,21 @@ member: cn=ldaptestuser3,cn=users,""" + base_dn + """
ldb.rename("cn=ldaptestuser3,cn=users," + base_dn, "cn=ldaptestuser3,cn=users," + base_dn)
- ok = ldb.rename("cn=ldaptestuser3,cn=users," + base_dn, "cn=ldaptestUSER3,cn=users," + base_dn)
+ ldb.rename("cn=ldaptestuser3,cn=users," + base_dn, "cn=ldaptestUSER3,cn=users," + base_dn)
print "Testing ldb.search for (&(cn=ldaptestuser3)(objectClass=user))"
- res = ldb.search("(&(cn=ldaptestuser3)(objectClass=user))")
+ res = ldb.search(expression="(&(cn=ldaptestuser3)(objectClass=user))")
assert len(res) == 1, "Could not find (&(cn=ldaptestuser3)(objectClass=user))"
- assertEquals(res[0].dn, ("CN=ldaptestUSER3,CN=Users," + base_dn))
- assertEquals(res[0].cn, "ldaptestUSER3")
- assertEquals(res[0].name, "ldaptestUSER3")
+ assertEquals(str(res[0].dn), ("CN=ldaptestUSER3,CN=Users," + base_dn))
+ assertEquals(res[0]["cn"], "ldaptestUSER3")
+ assertEquals(res[0]["name"], "ldaptestUSER3")
# This is a Samba special, and does not exist in real AD
# print "Testing ldb.search for (dn=CN=ldaptestUSER3,CN=Users," + base_dn + ")"
# res = ldb.search("(dn=CN=ldaptestUSER3,CN=Users," + base_dn + ")")
# if (res.error != 0 || len(res) != 1) {
# print "Could not find (dn=CN=ldaptestUSER3,CN=Users," + base_dn + ")"
-# assertEquals(res.error, 0)
# assertEquals(len(res), 1)
# }
# assertEquals(res[0].dn, ("CN=ldaptestUSER3,CN=Users," + base_dn))
@@ -377,11 +381,11 @@ member: cn=ldaptestuser3,cn=users,""" + base_dn + """
# assertEquals(res[0].name, "ldaptestUSER3")
print "Testing ldb.search for (distinguishedName=CN=ldaptestUSER3,CN=Users," + base_dn + ")"
- res = ldb.search("(distinguishedName=CN=ldaptestUSER3,CN=Users," + base_dn + ")")
+ res = ldb.search(expression="(distinguishedName=CN=ldaptestUSER3,CN=Users," + base_dn + ")")
assert len(res) == 1, "Could not find (dn=CN=ldaptestUSER3,CN=Users," + base_dn + ")"
- assertEquals(res[0].dn, ("CN=ldaptestUSER3,CN=Users," + base_dn))
- assertEquals(res[0].cn, "ldaptestUSER3")
- assertEquals(res[0].name, "ldaptestUSER3")
+ assertEquals(str(res[0].dn), ("CN=ldaptestUSER3,CN=Users," + base_dn))
+ assertEquals(res[0]["cn"], "ldaptestUSER3")
+ assertEquals(res[0]["name"], "ldaptestUSER3")
# ensure we cannot add it again
try:
@@ -389,7 +393,7 @@ member: cn=ldaptestuser3,cn=users,""" + base_dn + """
"objectClass": ["person", "user"],
"cn": "LDAPtestUSER3"})
except LdbError, (num, _):
- assert num == 68 #LDB_ERR_ENTRY_ALREADY_EXISTS
+ assert num == LDB_ERR_ENTRY_ALREADY_EXISTS
else:
assert False
@@ -397,12 +401,15 @@ member: cn=ldaptestuser3,cn=users,""" + base_dn + """
ldb.rename("cn=ldaptestuser3,cn=users," + base_dn, "cn=ldaptestuser2,cn=users," + base_dn)
# ensure we cannnot rename it twice
- ok = ldb.rename("cn=ldaptestuser3,cn=users," + base_dn, "cn=ldaptestuser2,cn=users," + base_dn)
-#LDB_ERR_NO_SUCH_OBJECT
- assertEquals(ok.error, 32)
+ try:
+ ldb.rename("cn=ldaptestuser3,cn=users," + base_dn, "cn=ldaptestuser2,cn=users," + base_dn)
+ except LdbError, (num, _):
+ assert num == LDB_ERR_NO_SUCH_OBJECT
+ else:
+ assert False
# ensure can now use that name
- ok = ldb.add({"dn": "cn=ldaptestuser3,cn=users," + base_dn,
+ ldb.add({"dn": "cn=ldaptestuser3,cn=users," + base_dn,
"objectClass": ["person", "user"],
"cn": "LDAPtestUSER3"})
@@ -410,12 +417,11 @@ member: cn=ldaptestuser3,cn=users,""" + base_dn + """
try:
ldb.rename("cn=ldaptestuser2,cn=users," + base_dn, "cn=ldaptestuser3,cn=users," + base_dn)
except LdbError, (num, _):
- assert num == 68 #LDB_ERR_ENTRY_ALREADY_EXISTS
+ assert num == LDB_ERR_ENTRY_ALREADY_EXISTS
else:
assert False
- assertEquals(ok.error, 68)
try:
- ok = ldb.rename("cn=ldaptestuser3,cn=users," + base_dn, "cn=ldaptestuser3,cn=configuration," + base_dn)
+ ldb.rename("cn=ldaptestuser3,cn=users," + base_dn, "cn=ldaptestuser3,cn=configuration," + base_dn)
except LdbError, (num, _):
assert num in (71, 64)
else:
@@ -425,13 +431,14 @@ member: cn=ldaptestuser3,cn=users,""" + base_dn + """
ldb.delete("cn=ldaptestuser5,cn=users," + base_dn)
- ldb.delete("cn=ldaptestgroup2,cn=users," + base_dn)
+ delete_force(ldb, "cn=ldaptestgroup2,cn=users," + base_dn)
ldb.rename("cn=ldaptestgroup,cn=users," + base_dn, "cn=ldaptestgroup2,cn=users," + base_dn)
print "Testing subtree Renames"
- ldb.add({"dn": "cn=ldaptestcontainer," + base_dn, "objectClass": "container"})
+ ldb.add({"dn": "cn=ldaptestcontainer," + base_dn,
+ "objectClass": "container"})
try:
ldb.add({"dn": "CN=ldaptestuser4,CN=ldaptestcontainer," + base_dn,
@@ -454,41 +461,43 @@ member: cn=ldaptestuser4,cn=ldaptestcontainer,""" + base_dn + """
ldb.rename("CN=ldaptestcontainer," + base_dn, "CN=ldaptestcontainer2," + base_dn)
print "Testing ldb.search for (&(cn=ldaptestuser4)(objectClass=user))"
- res = ldb.search("(&(cn=ldaptestuser4)(objectClass=user))")
+ res = ldb.search(expression="(&(cn=ldaptestuser4)(objectClass=user))")
assert len(res) == 1, "Could not find (&(cn=ldaptestuser4)(objectClass=user))"
print "Testing subtree ldb.search for (&(cn=ldaptestuser4)(objectClass=user)) in (just renamed from) cn=ldaptestcontainer," + base_dn
try:
- res = ldb.search("(&(cn=ldaptestuser4)(objectClass=user))", "cn=ldaptestcontainer," + base_dn, ldb.SCOPE_SUBTREE)
+ ldb.search("cn=ldaptestcontainer," + base_dn,
+ expression="(&(cn=ldaptestuser4)(objectClass=user))",
+ scope=SCOPE_SUBTREE)
except LdbError, (num, _):
- assert num == 32
+ assert num == LDB_ERR_NO_SUCH_OBJECT
else:
assert False
print "Testing one-level ldb.search for (&(cn=ldaptestuser4)(objectClass=user)) in (just renamed from) cn=ldaptestcontainer," + base_dn
try:
- res = ldb.search("(&(cn=ldaptestuser4)(objectClass=user))", "cn=ldaptestcontainer," + base_dn, ldb.SCOPE_ONELEVEL)
+ res = ldb.search("cn=ldaptestcontainer," + base_dn, expression="(&(cn=ldaptestuser4)(objectClass=user))", scope=SCOPE_ONELEVEL)
except LdbError, (num, _):
- assert num == 32
+ assert num == LDB_ERR_NO_SUCH_OBJECT
else:
assert False
print "Testing ldb.search for (&(cn=ldaptestuser4)(objectClass=user)) in renamed container"
- res = ldb.search("(&(cn=ldaptestuser4)(objectClass=user))", "cn=ldaptestcontainer2," + base_dn, ldb.SCOPE_SUBTREE)
+ res = ldb.search("cn=ldaptestcontainer2," + base_dn, expression="(&(cn=ldaptestuser4)(objectClass=user))", scope=SCOPE_SUBTREE)
assert len(res) == 1, "Could not find (&(cn=ldaptestuser4)(objectClass=user)) under cn=ldaptestcontainer2," + base_dn
- assertEquals(res[0].dn, ("CN=ldaptestuser4,CN=ldaptestcontainer2," + base_dn))
- assertEquals(strupper(res[0].memberOf[0]), strupper(("CN=ldaptestgroup2,CN=Users," + base_dn)))
+ assertEquals(str(res[0].dn), ("CN=ldaptestuser4,CN=ldaptestcontainer2," + base_dn))
+ assertEquals(res[0]["memberOf"][0].upper(), ("CN=ldaptestgroup2,CN=Users," + base_dn).upper())
print "Testing ldb.search for (&(member=CN=ldaptestuser4,CN=ldaptestcontainer2," + base_dn + ")(objectclass=group)) to check subtree renames and linked attributes"
- res = ldb.search("(&(member=CN=ldaptestuser4,CN=ldaptestcontainer2," + base_dn + ")(objectclass=group))", base_dn, ldb.SCOPE_SUBTREE)
+ res = ldb.search(base_dn, expression="(&(member=CN=ldaptestuser4,CN=ldaptestcontainer2," + base_dn + ")(objectclass=group))", scope=SCOPE_SUBTREE)
assert len(res) == 1, "Could not find (&(member=CN=ldaptestuser4,CN=ldaptestcontainer2," + base_dn + ")(objectclass=group)), perhaps linked attributes are not conistant with subtree renames?"
print "Testing ldb.rename (into itself) of cn=ldaptestcontainer2," + base_dn + " to cn=ldaptestcontainer,cn=ldaptestcontainer2," + base_dn
try:
- ok = ldb.rename("cn=ldaptestcontainer2," + base_dn, "cn=ldaptestcontainer,cn=ldaptestcontainer2," + base_dn)
+ ldb.rename("cn=ldaptestcontainer2," + base_dn, "cn=ldaptestcontainer,cn=ldaptestcontainer2," + base_dn)
except LdbError, (num, _):
- assert num != 53 # LDAP_UNWILLING_TO_PERFORM
+ assert num == LDB_ERR_UNWILLING_TO_PERFORM
else:
assert False
@@ -502,25 +511,25 @@ member: cn=ldaptestuser4,cn=ldaptestcontainer,""" + base_dn + """
print "Testing delete (should fail, not a leaf node) of renamed cn=ldaptestcontainer2," + base_dn
try:
- ok = ldb.delete("cn=ldaptestcontainer2," + base_dn)
+ ldb.delete("cn=ldaptestcontainer2," + base_dn)
except LdbError, (num, _):
- assert num == 66
+ assert num == LDB_ERR_NOT_ALLOWED_ON_NON_LEAF
else:
assert False
print "Testing base ldb.search for CN=ldaptestuser4,CN=ldaptestcontainer2," + base_dn
- res = ldb.search("(objectclass=*)", ("CN=ldaptestuser4,CN=ldaptestcontainer2," + base_dn), ldb.SCOPE_BASE)
+ res = ldb.search(expression="(objectclass=*)", base=("CN=ldaptestuser4,CN=ldaptestcontainer2," + base_dn), scope=SCOPE_BASE)
assert len(res) == 1
- res = ldb.search("(cn=ldaptestuser40)", ("CN=ldaptestuser4,CN=ldaptestcontainer2," + base_dn), ldb.SCOPE_BASE)
+ res = ldb.search(expression="(cn=ldaptestuser40)", base=("CN=ldaptestuser4,CN=ldaptestcontainer2," + base_dn), scope=SCOPE_BASE)
assert len(res) == 0
print "Testing one-level ldb.search for (&(cn=ldaptestuser4)(objectClass=user)) in cn=ldaptestcontainer2," + base_dn
- res = ldb.search("(&(cn=ldaptestuser4)(objectClass=user))", "cn=ldaptestcontainer2," + base_dn, ldb.SCOPE_ONELEVEL)
- assert len(res) == 0
+ res = ldb.search(expression="(&(cn=ldaptestuser4)(objectClass=user))", base="cn=ldaptestcontainer2," + base_dn, scope=SCOPE_ONELEVEL)
+ # FIXME: assert len(res) == 0
print "Testing one-level ldb.search for (&(cn=ldaptestuser4)(objectClass=user)) in cn=ldaptestcontainer2," + base_dn
- res = ldb.search("(&(cn=ldaptestuser4)(objectClass=user))", "cn=ldaptestcontainer2," + base_dn, ldb.SCOPE_SUBTREE)
- assert len(res) == 0
+ res = ldb.search(expression="(&(cn=ldaptestuser4)(objectClass=user))", base="cn=ldaptestcontainer2," + base_dn, scope=SCOPE_SUBTREE)
+ #FIXME: assert len(res) == 0
print "Testing delete of subtree renamed "+("CN=ldaptestuser4,CN=ldaptestcontainer2," + base_dn)
ldb.delete(("CN=ldaptestuser4,CN=ldaptestcontainer2," + base_dn))
@@ -541,172 +550,155 @@ member: cn=ldaptestuser4,cn=ldaptestcontainer,""" + base_dn + """
"objectClass": "user"})
print "Testing ldb.search for (&(cn=ldaptestuser)(objectClass=user))"
- res = ldb.search("(&(cn=ldaptestuser)(objectClass=user))")
+ res = ldb.search(expression="(&(cn=ldaptestuser)(objectClass=user))")
assert len(res) == 1, "Could not find (&(cn=ldaptestuser)(objectClass=user))"
- assertEquals(res[0].dn, ("CN=ldaptestuser,CN=Users," + base_dn))
- assertEquals(res[0].cn, "ldaptestuser")
- assertEquals(res[0].name, "ldaptestuser")
- assertEquals(res[0].objectClass[0], "top")
- assertEquals(res[0].objectClass[1], "person")
- assertEquals(res[0].objectClass[2], "organizationalPerson")
- assertEquals(res[0].objectClass[3], "user")
- assert(res[0].objectGUID != undefined)
- assert(res[0].whenCreated != undefined)
- assertEquals(res[0].objectCategory, ("CN=Person,CN=Schema,CN=Configuration," + base_dn))
- assertEquals(res[0].sAMAccountType, 805306368)
+ assertEquals(str(res[0].dn), ("CN=ldaptestuser,CN=Users," + base_dn))
+ assertEquals(res[0]["cn"], "ldaptestuser")
+ assertEquals(res[0]["name"], "ldaptestuser")
+ assertEquals(res[0]["objectClass"], ["top", "person", "organizationalPerson", "user"])
+ assert("objectGUID" in res[0])
+ assert("whenCreated" in res[0])
+ assertEquals(res[0]["objectCategory"], ("CN=Person,CN=Schema,CN=Configuration," + base_dn))
+ assertEquals(int(res[0]["sAMAccountType"][0]), 805306368)
# assertEquals(res[0].userAccountControl, 546)
- assertEquals(res[0].memberOf[0], ("CN=ldaptestgroup2,CN=Users," + base_dn))
- assertEquals(res[0].memberOf.length, 1)
+ assertEquals(res[0]["memberOf"][0], ("CN=ldaptestgroup2,CN=Users," + base_dn))
+ assertEquals(len(res[0]["memberOf"]), 1)
print "Testing ldb.search for (&(cn=ldaptestuser)(objectCategory=cn=person,cn=schema,cn=configuration," + base_dn + "))"
- res2 = ldb.search("(&(cn=ldaptestuser)(objectCategory=cn=person,cn=schema,cn=configuration," + base_dn + "))")
+ res2 = ldb.search(expression="(&(cn=ldaptestuser)(objectCategory=cn=person,cn=schema,cn=configuration," + base_dn + "))")
assert len(res2) == 1, "Could not find (&(cn=ldaptestuser)(objectCategory=cn=person,cn=schema,cn=configuration," + base_dn + "))"
- assertEquals(res[0].dn, res2.msgs[0].dn)
+ assertEquals(res[0].dn, res2[0].dn)
print "Testing ldb.search for (&(cn=ldaptestuser)(objectCategory=PerSon))"
- res3 = ldb.search("(&(cn=ldaptestuser)(objectCategory=PerSon))")
+ res3 = ldb.search(expression="(&(cn=ldaptestuser)(objectCategory=PerSon))")
assert len(res3) == 1, "Could not find (&(cn=ldaptestuser)(objectCategory=PerSon)): matched " + len(res3)
- assertEquals(res[0].dn, res3.msgs[0].dn)
+ assertEquals(res[0].dn, res3[0].dn)
if gc_ldb is not None:
print "Testing ldb.search for (&(cn=ldaptestuser)(objectCategory=PerSon)) in Global Catalog"
- res3gc = gc_ldb.search("(&(cn=ldaptestuser)(objectCategory=PerSon))")
+ res3gc = gc_ldb.search(expression="(&(cn=ldaptestuser)(objectCategory=PerSon))")
assert len(res3gc) == 1
- assertEquals(res[0].dn, res3gc.msgs[0].dn)
+ assertEquals(res[0].dn, res3gc[0].dn)
print "Testing ldb.search for (&(cn=ldaptestuser)(objectCategory=PerSon)) in with 'phantom root' control"
- attrs = ["cn"]
- controls = ["search_options:1:2"]
- res3control = gc_ldb.search("(&(cn=ldaptestuser)(objectCategory=PerSon))", base_dn, ldb.SCOPE_SUBTREE, attrs, controls)
+
+ res3control = gc_ldb.search(base_dn, expression="(&(cn=ldaptestuser)(objectCategory=PerSon))", scope=SCOPE_SUBTREE, attrs=["cn"], controls=["search_options:1:2"])
assert len(res3control) == 1, "Could not find (&(cn=ldaptestuser)(objectCategory=PerSon)) in Global Catalog"
- assertEquals(res[0].dn, res3control.msgs[0].dn)
+ assertEquals(res[0].dn, res3control[0].dn)
ldb.delete(res[0].dn)
print "Testing ldb.search for (&(cn=ldaptestcomputer)(objectClass=user))"
- res = ldb.search("(&(cn=ldaptestcomputer)(objectClass=user))")
+ res = ldb.search(expression="(&(cn=ldaptestcomputer)(objectClass=user))")
assert len(res) == 1, "Could not find (&(cn=ldaptestuser)(objectClass=user))"
- assertEquals(res[0].dn, ("CN=ldaptestcomputer,CN=Computers," + base_dn))
- assertEquals(res[0].cn, "ldaptestcomputer")
- assertEquals(res[0].name, "ldaptestcomputer")
- assertEquals(res[0].objectClass[0], "top")
- assertEquals(res[0].objectClass[1], "person")
- assertEquals(res[0].objectClass[2], "organizationalPerson")
- assertEquals(res[0].objectClass[3], "user")
- assertEquals(res[0].objectClass[4], "computer")
- assert(res[0].objectGUID != undefined)
- assert(res[0].whenCreated != undefined)
- assertEquals(res[0].objectCategory, ("CN=Computer,CN=Schema,CN=Configuration," + base_dn))
- assertEquals(res[0].primaryGroupID, 513)
+ assertEquals(str(res[0].dn), ("CN=ldaptestcomputer,CN=Computers," + base_dn))
+ assertEquals(res[0]["cn"], "ldaptestcomputer")
+ assertEquals(res[0]["name"], "ldaptestcomputer")
+ assertEquals(res[0]["objectClass"], ["top", "person", "organizationalPerson", "user", "computer"])
+ assert("objectGUID" in res[0])
+ assert("whenCreated" in res[0])
+ assertEquals(res[0]["objectCategory"], ("CN=Computer,CN=Schema,CN=Configuration," + base_dn))
+ assertEquals(int(res[0]["primaryGroupID"][0]), 513)
# assertEquals(res[0].sAMAccountType, 805306368)
# assertEquals(res[0].userAccountControl, 546)
- assertEquals(res[0].memberOf[0], ("CN=ldaptestgroup2,CN=Users," + base_dn))
- assertEquals(res[0].memberOf.length, 1)
+ assertEquals(res[0]["memberOf"][0], "CN=ldaptestgroup2,CN=Users," + base_dn)
+ assertEquals(len(res[0]["memberOf"]), 1)
print "Testing ldb.search for (&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + base_dn + "))"
- res2 = ldb.search("(&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + base_dn + "))")
+ res2 = ldb.search(expression="(&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + base_dn + "))")
assert len(res2) == 1, "Could not find (&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + base_dn + "))"
- assertEquals(res[0].dn, res2.msgs[0].dn)
+ assertEquals(res[0].dn, res2[0].dn)
if gc_ldb is not None:
print "Testing ldb.search for (&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + base_dn + ")) in Global Catlog"
- res2gc = gc_ldb.search("(&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + base_dn + "))")
+ res2gc = gc_ldb.search(expression="(&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + base_dn + "))")
assert len(res2gc) == 1, "Could not find (&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + base_dn + ")) in Global Catlog"
- assertEquals(res[0].dn, res2gc.msgs[0].dn)
+ assertEquals(res[0].dn, res2gc[0].dn)
print "Testing ldb.search for (&(cn=ldaptestcomputer)(objectCategory=compuTER))"
- res3 = ldb.search("(&(cn=ldaptestcomputer)(objectCategory=compuTER))")
+ res3 = ldb.search(expression="(&(cn=ldaptestcomputer)(objectCategory=compuTER))")
assert len(res3) == 1, "Could not find (&(cn=ldaptestcomputer)(objectCategory=compuTER))"
- assertEquals(res[0].dn, res3.msgs[0].dn)
+ assertEquals(res[0].dn, res3[0].dn)
if gc_ldb is not None:
print "Testing ldb.search for (&(cn=ldaptestcomputer)(objectCategory=compuTER)) in Global Catalog"
- res3gc = gc_ldb.search("(&(cn=ldaptestcomputer)(objectCategory=compuTER))")
+ res3gc = gc_ldb.search(expression="(&(cn=ldaptestcomputer)(objectCategory=compuTER))")
assert len(res3gc) == 1, "Could not find (&(cn=ldaptestcomputer)(objectCategory=compuTER)) in Global Catalog"
- assertEquals(res[0].dn, res3gc.msgs[0].dn)
+ assertEquals(res[0].dn, res3gc[0].dn)
print "Testing ldb.search for (&(cn=ldaptestcomp*r)(objectCategory=compuTER))"
- res4 = ldb.search("(&(cn=ldaptestcomp*r)(objectCategory=compuTER))")
+ res4 = ldb.search(expression="(&(cn=ldaptestcomp*r)(objectCategory=compuTER))")
assert len(res4) == 1, "Could not find (&(cn=ldaptestcomp*r)(objectCategory=compuTER))"
- assertEquals(res[0].dn, res4.msgs[0].dn)
+ assertEquals(res[0].dn, res4[0].dn)
print "Testing ldb.search for (&(cn=ldaptestcomput*)(objectCategory=compuTER))"
- res5 = ldb.search("(&(cn=ldaptestcomput*)(objectCategory=compuTER))")
+ res5 = ldb.search(expression="(&(cn=ldaptestcomput*)(objectCategory=compuTER))")
assert len(res5) == 1, "Could not find (&(cn=ldaptestcomput*)(objectCategory=compuTER))"
- assertEquals(res[0].dn, res5.msgs[0].dn)
+ assertEquals(res[0].dn, res5[0].dn)
print "Testing ldb.search for (&(cn=*daptestcomputer)(objectCategory=compuTER))"
- res6 = ldb.search("(&(cn=*daptestcomputer)(objectCategory=compuTER))")
+ res6 = ldb.search(expression="(&(cn=*daptestcomputer)(objectCategory=compuTER))")
assert len(res6) == 1, "Could not find (&(cn=*daptestcomputer)(objectCategory=compuTER))"
- assertEquals(res[0].dn, res6.msgs[0].dn)
+ assertEquals(res[0].dn, res6[0].dn)
ldb.delete(res[0].dn)
print "Testing ldb.search for (&(cn=ldaptest2computer)(objectClass=user))"
- res = ldb.search("(&(cn=ldaptest2computer)(objectClass=user))")
+ res = ldb.search(expression="(&(cn=ldaptest2computer)(objectClass=user))")
assert len(res) == 1, "Could not find (&(cn=ldaptest2computer)(objectClass=user))"
assertEquals(res[0].dn, ("CN=ldaptest2computer,CN=Computers," + base_dn))
- assertEquals(res[0].cn, "ldaptest2computer")
- assertEquals(res[0].name, "ldaptest2computer")
- assertEquals(res[0].objectClass[0], "top")
- assertEquals(res[0].objectClass[1], "person")
- assertEquals(res[0].objectClass[2], "organizationalPerson")
- assertEquals(res[0].objectClass[3], "user")
- assertEquals(res[0].objectClass[4], "computer")
- assert(res[0].objectGUID != undefined)
- assert(res[0].whenCreated != undefined)
- assertEquals(res[0].objectCategory, "cn=Computer,cn=Schema,cn=Configuration," + base_dn)
- assertEquals(res[0].sAMAccountType, 805306369)
+ assertEquals(res[0]["cn"], "ldaptest2computer")
+ assertEquals(res[0]["name"], "ldaptest2computer")
+ assertEquals(res[0]["objectClass"], ["top", "person", "organizationalPerson", "user", "computer"])
+ assert("objectGUID" in res[0])
+ assert("whenCreated" in res[0])
+ assertEquals(res[0]["objectCategory"][0], "CN=Computer,CN=Schema,CN=Configuration," + base_dn)
+ assertEquals(int(res[0]["sAMAccountType"][0]), 805306369)
# assertEquals(res[0].userAccountControl, 4098)
ldb.delete(res[0].dn)
attrs = ["cn", "name", "objectClass", "objectGUID", "whenCreated", "nTSecurityDescriptor", "memberOf"]
print "Testing ldb.search for (&(cn=ldaptestUSer2)(objectClass=user))"
- res = ldb.search(base_dn, "(&(cn=ldaptestUSer2)(objectClass=user))", ldb.SCOPE_SUBTREE, attrs)
+ res = ldb.search(base_dn, expression="(&(cn=ldaptestUSer2)(objectClass=user))", scope=SCOPE_SUBTREE, attrs=attrs)
assert len(res) == 1, "Could not find (&(cn=ldaptestUSer2)(objectClass=user))"
assertEquals(res[0].dn, ("CN=ldaptestuser2,CN=Users," + base_dn))
- assertEquals(res[0].cn, "ldaptestuser2")
- assertEquals(res[0].name, "ldaptestuser2")
- assertEquals(res[0].objectClass[0], "top")
- assertEquals(res[0].objectClass[1], "person")
- assertEquals(res[0].objectClass[2], "organizationalPerson")
- assertEquals(res[0].objectClass[3], "user")
- assert(res[0].objectGUID != undefined)
- assert(res[0].whenCreated != undefined)
- assert(res[0].nTSecurityDescriptor != undefined)
- assertEquals(res[0].memberOf[0], ("CN=ldaptestgroup2,CN=Users," + base_dn))
+ assertEquals(res[0]["cn"], "ldaptestuser2")
+ assertEquals(res[0]["name"], "ldaptestuser2")
+ assertEquals(res[0]["objectClass"], ["top", "person", "organizationalPerson", "user"])
+ assert("objectGUID" in res[0])
+ assert("whenCreated" in res[0])
+ assert("nTSecurityDescriptor" in res[0])
+ assertEquals(res[0]["memberOf"][0], ("CN=ldaptestgroup2,CN=Users," + base_dn))
attrs = ["cn", "name", "objectClass", "objectGUID", "whenCreated", "nTSecurityDescriptor", "member"]
print "Testing ldb.search for (&(cn=ldaptestgroup2)(objectClass=group))"
- res = ldb.search("(&(cn=ldaptestgroup2)(objectClass=group))", base_dn, ldb.SCOPE_SUBTREE, attrs)
+ res = ldb.search(base_dn, expression="(&(cn=ldaptestgroup2)(objectClass=group))", scope=SCOPE_SUBTREE, attrs=attrs)
assert len(res) == 1, "Could not find (&(cn=ldaptestgroup2)(objectClass=group))"
assertEquals(res[0].dn, ("CN=ldaptestgroup2,CN=Users," + base_dn))
- assertEquals(res[0].cn, "ldaptestgroup2")
- assertEquals(res[0].name, "ldaptestgroup2")
- assertEquals(res[0].objectClass[0], "top")
- assertEquals(res[0].objectClass[1], "group")
- assert(res[0].objectGUID != undefined)
- assert(res[0].whenCreated != undefined)
- assert(res[0].nTSecurityDescriptor != undefined)
- assertEquals(res[0].member[0], ("CN=ldaptestuser2,CN=Users," + base_dn))
- assertEquals(res[0].member.length, 1)
+ assertEquals(res[0]["cn"], "ldaptestgroup2")
+ assertEquals(res[0]["name"], "ldaptestgroup2")
+ assertEquals(res[0]["objectClass"], ["top", "group"])
+ assert("objectGuid" not in res[0])
+ assert("whenCreated" in res[0])
+ assert("nTSecurityDescriptor" in res[0])
+ assertEquals(res[0]["member"], ["CN=ldaptestuser2,CN=Users," + base_dn])
ldb.modify_ldif("""
dn: cn=ldaptestgroup2,cn=users,""" + base_dn + """
@@ -752,41 +744,38 @@ delete: member
member: CN=ldaptestutf8user èùéìòà,CN=Users,""" + base_dn + """
""")
- res = ldb.search("(&(cn=ldaptestgroup2)(objectClass=group))", base_dn, ldb.SCOPE_SUBTREE, attrs)
- assert len(res) != 1, "Could not find (&(cn=ldaptestgroup2)(objectClass=group))"
+ res = ldb.search(base_dn, expression="(&(cn=ldaptestgroup2)(objectClass=group))", scope=SCOPE_SUBTREE, attrs=attrs)
+ assert len(res) == 1, "Could not find (&(cn=ldaptestgroup2)(objectClass=group))"
assertEquals(res[0].dn, ("CN=ldaptestgroup2,CN=Users," + base_dn))
- assertEquals(res[0].member[0], ("CN=ldaptestuser2,CN=Users," + base_dn))
- assertEquals(res[0].member.length, 1)
+ assertEquals(res[0]["member"][0], ("CN=ldaptestuser2,CN=Users," + base_dn))
+ assertEquals(len(res[0]["member"]), 1)
ldb.delete(("CN=ldaptestuser2,CN=Users," + base_dn))
attrs = ["cn", "name", "objectClass", "objectGUID", "whenCreated", "nTSecurityDescriptor", "member"]
print "Testing ldb.search for (&(cn=ldaptestgroup2)(objectClass=group)) to check linked delete"
- res = ldb.search("(&(cn=ldaptestgroup2)(objectClass=group))", base_dn, ldb.SCOPE_SUBTREE, attrs)
- assert len(res) != 1, "Could not find (&(cn=ldaptestgroup2)(objectClass=group)) to check linked delete"
+ res = ldb.search(base_dn, expression="(&(cn=ldaptestgroup2)(objectClass=group))", scope=SCOPE_SUBTREE, attrs=attrs)
+ assert len(res) == 1, "Could not find (&(cn=ldaptestgroup2)(objectClass=group)) to check linked delete"
assertEquals(res[0].dn, ("CN=ldaptestgroup2,CN=Users," + base_dn))
- assertEquals(res[0].member, undefined)
+ assert("member" not in res[0])
print "Testing ldb.search for (&(cn=ldaptestutf8user ÈÙÉÌÒÀ)(objectClass=user))"
- res = ldb.search("(&(cn=ldaptestutf8user ÈÙÉÌÒÀ)(objectClass=user))")
+ res = ldb.search(expression="(&(cn=ldaptestutf8user ÈÙÉÌÒÀ)(objectClass=user))")
assert len(res) == 1, "Could not find (&(cn=ldaptestutf8user ÈÙÉÌÒÀ)(objectClass=user))"
assertEquals(res[0].dn, ("CN=ldaptestutf8user èùéìòà,CN=Users," + base_dn))
- assertEquals(res[0].cn, "ldaptestutf8user èùéìòà")
- assertEquals(res[0].name, "ldaptestutf8user èùéìòà")
- assertEquals(res[0].objectClass[0], "top")
- assertEquals(res[0].objectClass[1], "person")
- assertEquals(res[0].objectClass[2], "organizationalPerson")
- assertEquals(res[0].objectClass[3], "user")
- assert(res[0].objectGUID != undefined)
- assert(res[0].whenCreated != undefined)
+ assertEquals(res[0]["cn"], "ldaptestutf8user èùéìòà")
+ assertEquals(res[0]["name"], "ldaptestutf8user èùéìòà")
+ assertEquals(res[0]["objectClass"], ["top", "person", "organizationalPerson", "user"])
+ assert("objectGUID" in res[0])
+ assert("whenCreated" in res[0])
ldb.delete(res[0].dn)
print "Testing ldb.search for (&(cn=ldaptestutf8user2*)(objectClass=user))"
- res = ldb.search("(&(cn=ldaptestutf8user2*)(objectClass=user))")
+ res = ldb.search(expression="(&(cn=ldaptestutf8user2*)(objectClass=user))")
assert len(res) == 1, "Could not find (&(cn=ldaptestutf8user2*)(objectClass=user))"
ldb.delete(res[0].dn)
@@ -794,174 +783,127 @@ member: CN=ldaptestutf8user èùéìòà,CN=Users,""" + base_dn + """
ldb.delete(("CN=ldaptestgroup2,CN=Users," + base_dn))
print "Testing ldb.search for (&(cn=ldaptestutf8user2 ÈÙÉÌÒÀ)(objectClass=user))"
- res = ldb.search("(&(cn=ldaptestutf8user ÈÙÉÌÒÀ)(objectClass=user))")
+ res = ldb.search(expression="(&(cn=ldaptestutf8user ÈÙÉÌÒÀ)(objectClass=user))")
- assert len(res) == 1, "Could not find (expect space collapse, win2k3 fails) (&(cn=ldaptestutf8user2 ÈÙÉÌÒÀ)(objectClass=user))"
+ #FIXME: assert len(res) == 1, "Could not find (expect space collapse, win2k3 fails) (&(cn=ldaptestutf8user2 ÈÙÉÌÒÀ)(objectClass=user))"
print "Testing that we can't get at the configuration DN from the main search base"
- attrs = ["cn"]
- res = ldb.search("objectClass=crossRef", base_dn, ldb.SCOPE_SUBTREE, attrs)
- assertEquals(res.error, 0)
+ res = ldb.search(base_dn, expression="objectClass=crossRef", scope=SCOPE_SUBTREE, attrs=["cn"])
assert len(res) == 0, "Got configuration DN " + res[0].dn + " which should not be able to be seen from main search base"
assertEquals(len(res), 0)
print "Testing that we can get at the configuration DN from the main search base on the LDAP port with the 'phantom root' search_options control"
- attrs = ["cn"]
- controls = ["search_options:1:2"]
- res = ldb.search("objectClass=crossRef", base_dn, ldb.SCOPE_SUBTREE, attrs, controls)
- assertEquals(res.error, 0)
+ res = ldb.search(base_dn, expression="objectClass=crossRef", scope=SCOPE_SUBTREE, attrs=["cn"], controls=["search_options:1:2"])
assert(len(res) > 0)
if gc_ldb is not None:
print "Testing that we can get at the configuration DN from the main search base on the GC port with the search_options control == 0"
- attrs = ["cn"]
- controls = ["search_options:1:0"]
- res = gc_ldb.search("objectClass=crossRef", base_dn, gc_ldb.SCOPE_SUBTREE, attrs, controls)
- assertEquals(res.error, 0)
+
+ res = gc_ldb.search(base_dn, expression="objectClass=crossRef", scope=SCOPE_SUBTREE, attrs=["cn"], controls=["search_options:1:0"])
assert(len(res) > 0)
print "Testing that we do find configuration elements in the global catlog"
- attrs = ["cn"]
- res = gc_ldb.search("objectClass=crossRef", base_dn, ldb.SCOPE_SUBTREE, attrs)
- assertEquals(res.error, 0)
+ res = gc_ldb.search(base_dn, expression="objectClass=crossRef", scope=SCOPE_SUBTREE, attrs=["cn"])
assert (len(res) > 0)
print "Testing that we do find configuration elements and user elements at the same time"
- attrs = ["cn"]
- res = gc_ldb.search("(|(objectClass=crossRef)(objectClass=person))", base_dn, ldb.SCOPE_SUBTREE, attrs)
- assertEquals(res.error, 0)
+ res = gc_ldb.search(base_dn, expression="(|(objectClass=crossRef)(objectClass=person))", scope=SCOPE_SUBTREE, attrs=["cn"])
assert (len(res) > 0)
print "Testing that we do find configuration elements in the global catlog, with the configuration basedn"
- attrs = ["cn"]
- res = gc_ldb.search("objectClass=crossRef", configuration_dn, ldb.SCOPE_SUBTREE, attrs)
- assertEquals(res.error, 0)
+ res = gc_ldb.search(configuration_dn, expression="objectClass=crossRef", scope=SCOPE_SUBTREE, attrs=["cn"])
assert (len(res) > 0)
print "Testing that we can get at the configuration DN on the main LDAP port"
- attrs = ["cn"]
- res = ldb.search("objectClass=crossRef", configuration_dn, ldb.SCOPE_SUBTREE, attrs)
- assertEquals(res.error, 0)
+ res = ldb.search(configuration_dn, expression="objectClass=crossRef", scope=SCOPE_SUBTREE, attrs=["cn"])
assert (len(res) > 0)
print "Testing objectCategory canonacolisation"
- attrs = ["cn"]
- res = ldb.search("objectCategory=ntDsDSA", configuration_dn, ldb.SCOPE_SUBTREE, attrs)
- assertEquals(res.error, 0)
+ res = ldb.search(configuration_dn, expression="objectCategory=ntDsDSA", scope=SCOPE_SUBTREE, attrs=["cn"])
assert len(res) > 0, "Didn't find any records with objectCategory=ntDsDSA"
assert(len(res) != 0)
- attrs = ["cn"]
- res = ldb.search("objectCategory=CN=ntDs-DSA," + schema_dn, configuration_dn, ldb.SCOPE_SUBTREE, attrs)
- assertEquals(res.error, 0)
+ res = ldb.search(configuration_dn, expression="objectCategory=CN=ntDs-DSA," + schema_dn, scope=SCOPE_SUBTREE, attrs=["cn"])
assert len(res) > 0, "Didn't find any records with objectCategory=CN=ntDs-DSA," + schema_dn
assert(len(res) != 0)
print "Testing objectClass attribute order on "+ base_dn
- attrs = ["objectClass"]
- res = ldb.search("objectClass=domain", base_dn, ldb.SCOPE_BASE, attrs)
- assertEquals(res.error, 0)
+ res = ldb.search(expression="objectClass=domain", base=base_dn,
+ scope=SCOPE_BASE, attrs=["objectClass"])
assertEquals(len(res), 1)
- assertEquals(res[0].objectClass[0], "top")
- assertEquals(res[0].objectClass[1], "domain")
- assertEquals(res[0].objectClass[2], "domainDNS")
+ assertEquals(res[0]["objectClass"], ["top", "domain", "domainDNS"])
# check enumeration
- attrs = ["cn"]
print "Testing ldb.search for objectCategory=person"
- res = ldb.search("objectCategory=person", base_dn, ldb.SCOPE_SUBTREE, attrs)
- assertEquals(res.error, 0)
+ res = ldb.search(base_dn, expression="objectCategory=person", scope=SCOPE_SUBTREE, attrs=["cn"])
assert(len(res) > 0)
- attrs = ["cn"]
- controls = ["domain_scope:1"]
print "Testing ldb.search for objectCategory=person with domain scope control"
- res = ldb.search("objectCategory=person", base_dn, ldb.SCOPE_SUBTREE, attrs, controls)
- assertEquals(res.error, 0)
+ res = ldb.search(base_dn, expression="objectCategory=person", scope=SCOPE_SUBTREE, attrs=["cn"], controls=["domain_scope:1"])
assert(len(res) > 0)
- attrs = ["cn"]
print "Testing ldb.search for objectCategory=user"
- res = ldb.search("objectCategory=user", base_dn, ldb.SCOPE_SUBTREE, attrs)
- assertEquals(res.error, 0)
+ res = ldb.search(base_dn, expression="objectCategory=user", scope=SCOPE_SUBTREE, attrs=["cn"])
assert(len(res) > 0)
- attrs = ["cn"]
- controls = ["domain_scope:1"]
+
print "Testing ldb.search for objectCategory=user with domain scope control"
- res = ldb.search("objectCategory=user", base_dn, ldb.SCOPE_SUBTREE, attrs, controls)
- assertEquals(res.error, 0)
+ res = ldb.search(base_dn, expression="objectCategory=user", scope=SCOPE_SUBTREE, attrs=["cn"], controls=["domain_scope:1"])
assert(len(res) > 0)
- attrs = ["cn"]
print "Testing ldb.search for objectCategory=group"
- res = ldb.search("objectCategory=group", base_dn, ldb.SCOPE_SUBTREE, attrs)
- assertEquals(res.error, 0)
+ res = ldb.search(base_dn, expression="objectCategory=group", scope=SCOPE_SUBTREE, attrs=["cn"])
assert(len(res) > 0)
- attrs = ["cn"]
- controls = ["domain_scope:1"]
print "Testing ldb.search for objectCategory=group with domain scope control"
- res = ldb.search("objectCategory=group", base_dn, ldb.SCOPE_SUBTREE, attrs, controls)
- assertEquals(res.error, 0)
+ res = ldb.search(base_dn, expression="objectCategory=group", scope=SCOPE_SUBTREE, attrs=["cn"], controls=["domain_scope:1"])
assert(len(res) > 0)
def basedn_tests(ldb, gc_ldb):
print "Testing for all rootDSE attributes"
- attrs = []
- res = ldb.search("", "", ldb.SCOPE_BASE, attrs)
- assertEquals(res.error, 0)
+ res = ldb.search(scope=SCOPE_BASE, attrs=[])
assertEquals(len(res), 1)
print "Testing for highestCommittedUSN"
- attrs = ["highestCommittedUSN"]
- res = ldb.search("", "", ldb.SCOPE_BASE, attrs)
- assertEquals(res.error, 0)
+ res = ldb.search("", scope=SCOPE_BASE, attrs=["highestCommittedUSN"])
assertEquals(len(res), 1)
- assert(res[0].highestCommittedUSN != undefined)
- assert(res[0].highestCommittedUSN != 0)
+ assert(int(res[0]["highestCommittedUSN"][0]) != 0)
print "Testing for netlogon via LDAP"
- attrs = ["netlogon"]
- res = ldb.search("", "", ldb.SCOPE_BASE, attrs)
- assertEquals(res.error, 0)
+ res = ldb.search("", scope=SCOPE_BASE, attrs=["netlogon"])
assertEquals(len(res), 0)
print "Testing for netlogon and highestCommittedUSN via LDAP"
- attrs = ["netlogon", "highestCommittedUSN"]
- res = ldb.search("", "", ldb.SCOPE_BASE, attrs)
- assertEquals(res.error, 0)
+ res = ldb.search("", scope=SCOPE_BASE,
+ attrs=["netlogon", "highestCommittedUSN"])
assertEquals(len(res), 0)
+
def find_basedn(ldb):
- attrs = ["defaultNamingContext"]
- res = ldb.search("", "", ldb.SCOPE_BASE, attrs)
- assertEquals(res.error, 0)
+ res = ldb.search(base="", expression="", scope=SCOPE_BASE,
+ attrs=["defaultNamingContext"])
assertEquals(len(res), 1)
- return res[0].defaultNamingContext
+ return res[0]["defaultNamingContext"][0]
+
def find_configurationdn(ldb):
- attrs = ["configurationNamingContext"]
- res = ldb.search("", "", ldb.SCOPE_BASE, attrs)
- assertEquals(res.error, 0)
+ res = ldb.search(base="", expression="", scope=SCOPE_BASE, attrs=["configurationNamingContext"])
assertEquals(len(res), 1)
- return res[0].configurationNamingContext
+ return res[0]["configurationNamingContext"][0]
+
def find_schemadn(ldb):
- res = ldb.search("", "", ldb.SCOPE_BASE, attrs=["schemaNamingContext"])
- assertEquals(res.error, 0)
+ res = ldb.search(base="", expression="", scope=SCOPE_BASE, attrs=["schemaNamingContext"])
assertEquals(len(res), 1)
- return res[0].schemaNamingContext
+ return res[0]["schemaNamingContext"][0]
if not "://" in host:
host = "ldap://%s" % host
-ldb = Ldb(host, credentials=creds, session_info=system_session(),
- lp=lp)
+ldb = Ldb(host, credentials=creds, session_info=system_session(), lp=lp)
base_dn = find_basedn(ldb)
-
configuration_dn = find_configurationdn(ldb)
schema_dn = find_schemadn(ldb)
diff --git a/source4/lib/ldb/tools/ldbsearch.c b/source4/lib/ldb/tools/ldbsearch.c
index c33cba1d77..24ceb30963 100644
--- a/source4/lib/ldb/tools/ldbsearch.c
+++ b/source4/lib/ldb/tools/ldbsearch.c
@@ -61,6 +61,7 @@ struct search_context {
int sort;
int num_stored;
struct ldb_message **store;
+ int refs_stored;
char **refs_store;
int entries;
@@ -87,15 +88,15 @@ static int store_message(struct ldb_message *msg, struct search_context *sctx) {
static int store_referral(char *referral, struct search_context *sctx) {
- sctx->refs_store = talloc_realloc(sctx, sctx->refs_store, char *, sctx->refs + 2);
+ sctx->refs_store = talloc_realloc(sctx, sctx->refs_store, char *, sctx->refs_stored + 2);
if (!sctx->refs_store) {
fprintf(stderr, "talloc_realloc failed while storing referrals\n");
return -1;
}
- sctx->refs_store[sctx->refs] = talloc_move(sctx->refs_store, &referral);
- sctx->refs++;
- sctx->refs_store[sctx->refs] = NULL;
+ sctx->refs_store[sctx->refs_stored] = talloc_move(sctx->refs_store, &referral);
+ sctx->refs_stored++;
+ sctx->refs_store[sctx->refs_stored] = NULL;
return 0;
}
@@ -199,6 +200,7 @@ static int do_search(struct ldb_context *ldb,
sctx->sort = options->sorted;
sctx->num_stored = 0;
+ sctx->refs_stored = 0;
sctx->store = NULL;
sctx->req_ctrls = ldb_parse_control_strings(ldb, sctx, (const char **)options->controls);
if (options->controls != NULL && sctx->req_ctrls== NULL) {
@@ -241,22 +243,18 @@ again:
if (sctx->pending)
goto again;
- if (sctx->sort && sctx->num_stored != 0) {
+ if (sctx->sort && (sctx->num_stored != 0 || sctx->refs != 0)) {
int i;
- ldb_qsort(sctx->store, ret, sizeof(struct ldb_message *),
- ldb, (ldb_qsort_cmp_fn_t)do_compare_msg);
-
- if (ret != 0) {
- fprintf(stderr, "An error occurred while sorting messages\n");
- exit(1);
+ if (sctx->num_stored) {
+ ldb_qsort(sctx->store, sctx->num_stored, sizeof(struct ldb_message *),
+ ldb, (ldb_qsort_cmp_fn_t)do_compare_msg);
}
-
for (i = 0; i < sctx->num_stored; i++) {
display_message(ldb, sctx->store[i], sctx);
}
- for (i = 0; i < sctx->refs; i++) {
+ for (i = 0; i < sctx->refs_stored; i++) {
display_referral(sctx->refs_store[i], sctx);
}
}
diff --git a/source4/lib/nss_wrapper/config.mk b/source4/lib/nss_wrapper/config.mk
index 9751d2bf73..b46f7c3ee7 100644
--- a/source4/lib/nss_wrapper/config.mk
+++ b/source4/lib/nss_wrapper/config.mk
@@ -1,9 +1,6 @@
##############################
# Start SUBSYSTEM NSS_WRAPPER
-[LIBRARY::NSS_WRAPPER]
-VERSION = 0.0.1
-SO_VERSION = 0
-DESCRIPTION = Wrapper library for testing nss calls without being root
+[SUBSYSTEM::NSS_WRAPPER]
PUBLIC_HEADERS = nss_wrapper.h
OBJ_FILES = nss_wrapper.o
# End SUBSYSTEM NSS_WRAPPER
diff --git a/source4/lib/policy/config.mk b/source4/lib/policy/config.mk
index f404d58377..aae98b86b2 100644
--- a/source4/lib/policy/config.mk
+++ b/source4/lib/policy/config.mk
@@ -1,4 +1,4 @@
-[LIBRARY::LIBPOLICY]
+[SUBSYSTEM::LIBPOLICY]
CFLAGS = -Iheimdal/lib/roken
OBJ_FILES = lex.o parse_adm.o
PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL LIBSAMBA-CONFIG LIBTALLOC CHARSET
diff --git a/source4/lib/registry/dir.c b/source4/lib/registry/dir.c
index a13e3753b7..27cae8c490 100644
--- a/source4/lib/registry/dir.c
+++ b/source4/lib/registry/dir.c
@@ -64,7 +64,7 @@ static WERROR reg_dir_del_key(const struct hive_key *k, const char *name)
if (rmdir(child) == 0)
ret = WERR_OK;
else if (errno == ENOENT)
- ret = WERR_NOT_FOUND;
+ ret = WERR_BADFILE;
else
ret = WERR_GENERAL_FAILURE;
@@ -282,7 +282,7 @@ static WERROR reg_dir_get_value(TALLOC_CTX *mem_ctx,
contents = file_load(path, &size, mem_ctx);
talloc_free(path);
if (contents == NULL)
- return WERR_NOT_FOUND;
+ return WERR_BADFILE;
if (type != NULL)
*type = 4; /* FIXME */
@@ -339,7 +339,7 @@ static WERROR reg_dir_del_value (struct hive_key *key, const char *name)
if (unlink(path) < 0) {
talloc_free(path);
if (errno == ENOENT)
- return WERR_NOT_FOUND;
+ return WERR_BADFILE;
return WERR_GENERAL_FAILURE;
}
talloc_free(path);
diff --git a/source4/lib/registry/hive.c b/source4/lib/registry/hive.c
index bbe510772c..5d56a30b3e 100644
--- a/source4/lib/registry/hive.c
+++ b/source4/lib/registry/hive.c
@@ -41,7 +41,7 @@ _PUBLIC_ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location,
fd = open(location, O_RDWR);
if (fd == -1) {
if (errno == ENOENT)
- return WERR_NOT_FOUND;
+ return WERR_BADFILE;
return WERR_BADFILE;
}
diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c
index 259315cc39..262859f64b 100644
--- a/source4/lib/registry/ldb.c
+++ b/source4/lib/registry/ldb.c
@@ -111,6 +111,15 @@ static struct ldb_message *reg_ldb_pack_value(struct ldb_context *ctx,
return msg;
}
+static char *reg_ldb_escape(TALLOC_CTX *mem_ctx, const char *value)
+{
+ struct ldb_val val;
+
+ val.data = discard_const_p(uint8_t, value);
+ val.length = strlen(value);
+
+ return ldb_dn_escape_value(mem_ctx, val);
+}
static int reg_close_ldb_key(struct ldb_key_data *key)
{
@@ -159,7 +168,13 @@ static struct ldb_dn *reg_path_to_ldb(TALLOC_CTX *mem_ctx,
else keyname = mypath;
if(strlen(keyname)) {
- ldb_dn_add_base_fmt(ret, "key=%s", keyname);
+ if (!ldb_dn_add_base_fmt(ret, "key=%s",
+ reg_ldb_escape(local_ctx,
+ keyname)))
+ {
+ talloc_free(local_ctx);
+ return NULL;
+ }
}
if(begin) {
@@ -293,7 +308,7 @@ static WERROR ldb_get_value(TALLOC_CTX *mem_ctx, struct hive_key *k,
}
if (res->count == 0)
- return WERR_NOT_FOUND;
+ return WERR_BADFILE;
reg_ldb_unpack_value(mem_ctx, res->msgs[0], NULL, data_type, data);
@@ -322,7 +337,7 @@ static WERROR ldb_open_key(TALLOC_CTX *mem_ctx, const struct hive_key *h,
DEBUG(3, ("Key '%s' not found\n",
ldb_dn_get_linearized(ldap_path)));
talloc_free(res);
- return WERR_NOT_FOUND;
+ return WERR_BADFILE;
}
newkd = talloc_zero(mem_ctx, struct ldb_key_data);
@@ -385,7 +400,7 @@ static WERROR ldb_add_key(TALLOC_CTX *mem_ctx, const struct hive_key *parent,
struct security_descriptor *sd,
struct hive_key **newkey)
{
- const struct ldb_key_data *parentkd = (const struct ldb_key_data *)parent;
+ struct ldb_key_data *parentkd = (const struct ldb_key_data *)parent;
struct ldb_message *msg;
struct ldb_key_data *newkd;
int ret;
@@ -400,8 +415,12 @@ static WERROR ldb_add_key(TALLOC_CTX *mem_ctx, const struct hive_key *parent,
talloc_strdup(mem_ctx, classname));
ret = ldb_add(parentkd->ldb, msg);
- if (ret < 0) {
- DEBUG(1, ("ldb_msg_add: %s\n", ldb_errstring(parentkd->ldb)));
+ if (ret == LDB_ERR_ENTRY_ALREADY_EXISTS) {
+ return WERR_ALREADY_EXISTS;
+ }
+
+ if (ret != LDB_SUCCESS) {
+ DEBUG(1, ("ldb_add: %s\n", ldb_errstring(parentkd->ldb)));
return WERR_FOOBAR;
}
@@ -414,29 +433,37 @@ static WERROR ldb_add_key(TALLOC_CTX *mem_ctx, const struct hive_key *parent,
*newkey = (struct hive_key *)newkd;
+ /* reset cache */
+ talloc_free(parentkd->subkeys);
+ parentkd->subkeys = NULL;
+
return WERR_OK;
}
-static WERROR ldb_del_key(const struct hive_key *key, const char *child)
+static WERROR ldb_del_key(const struct hive_key *key, const char *name)
{
int ret;
struct ldb_key_data *parentkd = talloc_get_type(key, struct ldb_key_data);
- struct ldb_dn *childdn;
+ struct ldb_dn *ldap_path;
+ TALLOC_CTX *mem_ctx = talloc_init("ldb_del_key");
- childdn = ldb_dn_copy(parentkd->ldb, parentkd->dn);
- ldb_dn_add_child_fmt(childdn, "key=%s", child);
+ ldap_path = reg_path_to_ldb(mem_ctx, key, name, NULL);
- ret = ldb_delete(parentkd->ldb, childdn);
+ ret = ldb_delete(parentkd->ldb, ldap_path);
- talloc_free(childdn);
+ talloc_free(mem_ctx);
if (ret == LDB_ERR_NO_SUCH_OBJECT) {
- return WERR_NOT_FOUND;
- } else if (ret < 0) {
+ return WERR_BADFILE;
+ } else if (ret != LDB_SUCCESS) {
DEBUG(1, ("ldb_del_key: %s\n", ldb_errstring(parentkd->ldb)));
return WERR_FOOBAR;
}
+ /* reset cache */
+ talloc_free(parentkd->subkeys);
+ parentkd->subkeys = NULL;
+
return WERR_OK;
}
@@ -447,19 +474,28 @@ static WERROR ldb_del_value (struct hive_key *key, const char *child)
struct ldb_dn *childdn;
childdn = ldb_dn_copy(kd->ldb, kd->dn);
- ldb_dn_add_child_fmt(childdn, "value=%s", child);
+ if (!ldb_dn_add_child_fmt(childdn, "value=%s",
+ reg_ldb_escape(childdn, child)))
+ {
+ talloc_free(childdn);
+ return WERR_FOOBAR;
+ }
ret = ldb_delete(kd->ldb, childdn);
talloc_free(childdn);
if (ret == LDB_ERR_NO_SUCH_OBJECT) {
- return WERR_NOT_FOUND;
- } else if (ret < 0) {
+ return WERR_BADFILE;
+ } else if (ret != LDB_SUCCESS) {
DEBUG(1, ("ldb_del_value: %s\n", ldb_errstring(kd->ldb)));
return WERR_FOOBAR;
}
+ /* reset cache */
+ talloc_free(kd->values);
+ kd->values = NULL;
+
return WERR_OK;
}
@@ -475,18 +511,32 @@ static WERROR ldb_set_value(struct hive_key *parent,
msg = reg_ldb_pack_value(kd->ldb, mem_ctx, name, type, data);
msg->dn = ldb_dn_copy(msg, kd->dn);
- ldb_dn_add_child_fmt(msg->dn, "value=%s", name);
+ if (!ldb_dn_add_child_fmt(msg->dn, "value=%s",
+ reg_ldb_escape(mem_ctx, name)))
+ {
+ talloc_free(mem_ctx);
+ return WERR_FOOBAR;
+ }
ret = ldb_add(kd->ldb, msg);
- if (ret < 0) {
- ret = ldb_modify(kd->ldb, msg);
- if (ret < 0) {
- DEBUG(1, ("ldb_msg_add: %s\n", ldb_errstring(kd->ldb)));
- talloc_free(mem_ctx);
- return WERR_FOOBAR;
+ if (ret == LDB_ERR_ENTRY_ALREADY_EXISTS) {
+ int i;
+ for (i = 0; i < msg->num_elements; i++) {
+ msg->elements[i].flags = LDB_FLAG_MOD_REPLACE;
}
+ ret = ldb_modify(kd->ldb, msg);
+ }
+
+ if (ret != LDB_SUCCESS) {
+ DEBUG(1, ("ldb_msg_add: %s\n", ldb_errstring(kd->ldb)));
+ talloc_free(mem_ctx);
+ return WERR_FOOBAR;
}
+ /* reset cache */
+ talloc_free(kd->values);
+ kd->values = NULL;
+
talloc_free(mem_ctx);
return WERR_OK;
}
@@ -503,17 +553,23 @@ static WERROR ldb_get_key_info(TALLOC_CTX *mem_ctx,
{
struct ldb_key_data *kd = talloc_get_type(key, struct ldb_key_data);
+ if (kd->subkeys == NULL) {
+ W_ERROR_NOT_OK_RETURN(cache_subkeys(kd));
+ }
+
+ if (kd->values == NULL) {
+ W_ERROR_NOT_OK_RETURN(cache_values(kd));
+ }
+
/* FIXME */
if (classname != NULL)
*classname = NULL;
if (num_subkeys != NULL) {
- W_ERROR_NOT_OK_RETURN(cache_subkeys(kd));
*num_subkeys = kd->subkey_count;
}
if (num_values != NULL) {
- W_ERROR_NOT_OK_RETURN(cache_values(kd));
*num_values = kd->value_count;
}
@@ -523,7 +579,6 @@ static WERROR ldb_get_key_info(TALLOC_CTX *mem_ctx,
if (max_subkeynamelen != NULL) {
int i;
struct ldb_message_element *el;
- W_ERROR_NOT_OK_RETURN(cache_subkeys(kd));
*max_subkeynamelen = 0;
diff --git a/source4/lib/registry/local.c b/source4/lib/registry/local.c
index fa59f25596..3e463100c9 100644
--- a/source4/lib/registry/local.c
+++ b/source4/lib/registry/local.c
@@ -140,7 +140,7 @@ WERROR local_get_predefined_key(struct registry_context *ctx,
}
if (mp == NULL)
- return WERR_NOT_FOUND;
+ return WERR_BADFILE;
*key = reg_import_hive_key(ctx, mp->key,
mp->path.predefined_key,
diff --git a/source4/lib/registry/patchfile.c b/source4/lib/registry/patchfile.c
index b6ad7dfb10..fa1367bbd2 100644
--- a/source4/lib/registry/patchfile.c
+++ b/source4/lib/registry/patchfile.c
@@ -82,11 +82,11 @@ WERROR reg_generate_diff_key(struct registry_key *oldkey,
if (W_ERROR_IS_OK(error2))
continue;
} else {
- error2 = WERR_DEST_NOT_FOUND;
+ error2 = WERR_BADFILE;
t2 = NULL;
}
- if (!W_ERROR_EQUAL(error2, WERR_DEST_NOT_FOUND)) {
+ if (!W_ERROR_EQUAL(error2, WERR_BADFILE)) {
DEBUG(0, ("Error occured while getting subkey by name: %s\n",
win_errstr(error2)));
talloc_free(mem_ctx);
@@ -132,10 +132,10 @@ WERROR reg_generate_diff_key(struct registry_key *oldkey,
continue;
} else {
t1 = NULL;
- error2 = WERR_DEST_NOT_FOUND;
+ error2 = WERR_BADFILE;
}
- if (!W_ERROR_EQUAL(error2, WERR_DEST_NOT_FOUND)) {
+ if (!W_ERROR_EQUAL(error2, WERR_BADFILE)) {
DEBUG(0, ("Error occured while getting subkey by name: %s\n",
win_errstr(error2)));
talloc_free(mem_ctx);
@@ -174,10 +174,10 @@ WERROR reg_generate_diff_key(struct registry_key *oldkey,
name, &type2,
&contents2);
} else
- error2 = WERR_DEST_NOT_FOUND;
+ error2 = WERR_BADFILE;
if(!W_ERROR_IS_OK(error2) &&
- !W_ERROR_EQUAL(error2, WERR_DEST_NOT_FOUND)) {
+ !W_ERROR_EQUAL(error2, WERR_BADFILE)) {
DEBUG(0, ("Error occured while getting value by name: %s\n",
win_errstr(error2)));
talloc_free(mem_ctx);
@@ -210,7 +210,7 @@ WERROR reg_generate_diff_key(struct registry_key *oldkey,
if (W_ERROR_IS_OK(error2))
continue;
- if (!W_ERROR_EQUAL(error2, WERR_DEST_NOT_FOUND)) {
+ if (!W_ERROR_EQUAL(error2, WERR_BADFILE)) {
DEBUG(0, ("Error occured while getting value by name: %s\n",
win_errstr(error2)));
return error2;
@@ -238,14 +238,14 @@ _PUBLIC_ WERROR reg_generate_diff(struct registry_context *ctx1,
struct registry_key *r1 = NULL, *r2 = NULL;
error = reg_get_predefined_key(ctx1, i, &r1);
if (!W_ERROR_IS_OK(error) &&
- !W_ERROR_EQUAL(error, WERR_NOT_FOUND)) {
+ !W_ERROR_EQUAL(error, WERR_BADFILE)) {
DEBUG(0, ("Unable to open hive %s for backend 1\n",
reg_get_predef_name(i)));
}
error = reg_get_predefined_key(ctx2, i, &r2);
if (!W_ERROR_IS_OK(error) &&
- !W_ERROR_EQUAL(error, WERR_NOT_FOUND)) {
+ !W_ERROR_EQUAL(error, WERR_BADFILE)) {
DEBUG(0, ("Unable to open hive %s for backend 2\n",
reg_get_predef_name(i)));
}
@@ -356,7 +356,7 @@ static WERROR reg_diff_apply_set_value(void *_ctx, const char *path,
/* Open key */
error = reg_open_key_abs(ctx, ctx, path, &tmp);
- if (W_ERROR_EQUAL(error, WERR_DEST_NOT_FOUND)) {
+ if (W_ERROR_EQUAL(error, WERR_BADFILE)) {
DEBUG(0, ("Error opening key '%s'\n", path));
return error;
}
diff --git a/source4/lib/registry/regf.c b/source4/lib/registry/regf.c
index 9b126cc808..15b60745f0 100644
--- a/source4/lib/registry/regf.c
+++ b/source4/lib/registry/regf.c
@@ -575,7 +575,7 @@ static WERROR regf_get_value_by_name(TALLOC_CTX *mem_ctx,
}
if (W_ERROR_EQUAL(error, WERR_NO_MORE_ITEMS))
- return WERR_NOT_FOUND;
+ return WERR_BADFILE;
return error;
}
@@ -870,7 +870,7 @@ static WERROR regf_get_subkey_by_name(TALLOC_CTX *ctx,
break;
}
if (key_off == 0)
- return WERR_NOT_FOUND;
+ return WERR_BADFILE;
} else if (!strncmp((char *)data.data, "lf", 2)) {
struct lf_block lf;
struct tdr_pull *pull = tdr_pull_init(ctx, private_data->hive->iconv_convenience);
@@ -905,7 +905,7 @@ static WERROR regf_get_subkey_by_name(TALLOC_CTX *ctx,
break;
}
if (key_off == 0)
- return WERR_NOT_FOUND;
+ return WERR_BADFILE;
} else if (!strncmp((char *)data.data, "lh", 2)) {
struct lh_block lh;
struct tdr_pull *pull = tdr_pull_init(ctx, private_data->hive->iconv_convenience);
@@ -942,7 +942,7 @@ static WERROR regf_get_subkey_by_name(TALLOC_CTX *ctx,
break;
}
if (key_off == 0)
- return WERR_NOT_FOUND;
+ return WERR_BADFILE;
} else if (!strncmp((char *)data.data, "ri", 2)) {
struct ri_block ri;
struct tdr_pull *pull = tdr_pull_init(ctx, private_data->hive->iconv_convenience);
@@ -1022,7 +1022,7 @@ static WERROR regf_get_subkey_by_name(TALLOC_CTX *ctx,
}
talloc_free(pull);
if (!key_off)
- return WERR_NOT_FOUND;
+ return WERR_BADFILE;
} else {
DEBUG(0, ("Unknown subkey list type.\n"));
return WERR_GENERAL_FAILURE;
@@ -1419,7 +1419,7 @@ static WERROR regf_sl_del_entry(struct regf_data *regf, uint32_t list_offset,
}
if (!found_offset) {
DEBUG(2, ("Subkey not found\n"));
- return WERR_NOT_FOUND;
+ return WERR_BADFILE;
}
li.key_count--;
@@ -1464,7 +1464,7 @@ static WERROR regf_sl_del_entry(struct regf_data *regf, uint32_t list_offset,
}
if (!found_offset) {
DEBUG(2, ("Subkey not found\n"));
- return WERR_NOT_FOUND;
+ return WERR_BADFILE;
}
lf.key_count--;
@@ -1510,7 +1510,7 @@ static WERROR regf_sl_del_entry(struct regf_data *regf, uint32_t list_offset,
}
if (!found_offset) {
DEBUG(0, ("Subkey not found\n"));
- return WERR_NOT_FOUND;
+ return WERR_BADFILE;
}
lh.key_count--;
@@ -1548,7 +1548,7 @@ static WERROR regf_del_value (struct hive_key *key, const char *name)
uint32_t i;
if (nk->values_offset == -1) {
- return WERR_NOT_FOUND;
+ return WERR_BADFILE;
}
values = hbin_get(regf, nk->values_offset);
@@ -1572,7 +1572,7 @@ static WERROR regf_del_value (struct hive_key *key, const char *name)
}
}
if (!found_offset) {
- return WERR_NOT_FOUND;
+ return WERR_BADFILE;
} else {
nk->num_values--;
values.length = (nk->num_values)*4;
@@ -1608,14 +1608,14 @@ static WERROR regf_del_key(const struct hive_key *parent, const char *name)
if (parent_nk->subkeys_offset == -1) {
DEBUG(4, ("Subkey list is empty, this key cannot contain subkeys.\n"));
- return WERR_NOT_FOUND;
+ return WERR_BADFILE;
}
/* Find the key */
if (!W_ERROR_IS_OK(regf_get_subkey_by_name(parent_nk, parent, name,
(struct hive_key **)&key))) {
DEBUG(2, ("Key '%s' not found\n", name));
- return WERR_NOT_FOUND;
+ return WERR_BADFILE;
}
if (key->nk->subkeys_offset != -1 ||
diff --git a/source4/lib/registry/samba.c b/source4/lib/registry/samba.c
index 02f3363bab..599385e73c 100644
--- a/source4/lib/registry/samba.c
+++ b/source4/lib/registry/samba.c
@@ -42,7 +42,7 @@ static WERROR mount_samba_hive(struct registry_context *ctx,
error = reg_open_hive(ctx, location, auth_info, creds, lp_ctx, &hive);
- if (W_ERROR_EQUAL(error, WERR_NOT_FOUND))
+ if (W_ERROR_EQUAL(error, WERR_BADFILE))
error = reg_open_ldb_file(ctx, location, auth_info,
creds, lp_ctx, &hive);
diff --git a/source4/lib/registry/tests/hive.c b/source4/lib/registry/tests/hive.c
index 22b4785222..4d27e83a74 100644
--- a/source4/lib/registry/tests/hive.c
+++ b/source4/lib/registry/tests/hive.c
@@ -31,7 +31,7 @@ static bool test_del_nonexistant_key(struct torture_context *tctx,
{
const struct hive_key *root = (const struct hive_key *)test_data;
WERROR error = hive_key_del(root, "bla");
- torture_assert_werr_equal(tctx, error, WERR_NOT_FOUND,
+ torture_assert_werr_equal(tctx, error, WERR_BADFILE,
"invalid return code");
return true;
@@ -134,7 +134,7 @@ static bool test_del_key(struct torture_context *tctx, const void *test_data)
torture_assert_werr_ok(tctx, error, "reg_key_del");
error = hive_key_del(root, "Nested Key");
- torture_assert_werr_equal(tctx, error, WERR_NOT_FOUND, "reg_key_del");
+ torture_assert_werr_equal(tctx, error, WERR_BADFILE, "reg_key_del");
return true;
}
@@ -174,7 +174,7 @@ static bool test_get_value(struct torture_context *tctx, const void *test_data)
torture_assert_werr_ok(tctx, error, "hive_key_add_name");
error = hive_get_value(mem_ctx, subkey, "Answer", &type, &value);
- torture_assert_werr_equal(tctx, error, WERR_NOT_FOUND,
+ torture_assert_werr_equal(tctx, error, WERR_BADFILE,
"getting missing value");
error = hive_key_set_value(subkey, "Answer", REG_DWORD,
@@ -215,10 +215,10 @@ static bool test_del_value(struct torture_context *tctx, const void *test_data)
torture_assert_werr_ok(tctx, error, "deleting value");
error = hive_get_value(mem_ctx, subkey, "Answer", &type, &value);
- torture_assert_werr_equal(tctx, error, WERR_NOT_FOUND, "getting value");
+ torture_assert_werr_equal(tctx, error, WERR_BADFILE, "getting value");
error = hive_key_del_value(subkey, "Answer");
- torture_assert_werr_equal(tctx, error, WERR_NOT_FOUND,
+ torture_assert_werr_equal(tctx, error, WERR_BADFILE,
"deleting value");
return true;
diff --git a/source4/lib/registry/tests/registry.c b/source4/lib/registry/tests/registry.c
index 75fbe1cbea..7d14b3a412 100644
--- a/source4/lib/registry/tests/registry.c
+++ b/source4/lib/registry/tests/registry.c
@@ -53,7 +53,7 @@ static bool test_get_predefined_unknown(struct torture_context *tctx,
WERROR error;
error = reg_get_predefined_key(rctx, 1337, &root);
- torture_assert_werr_equal(tctx, error, WERR_NOT_FOUND,
+ torture_assert_werr_equal(tctx, error, WERR_BADFILE,
"getting predefined key failed");
return true;
}
@@ -195,16 +195,16 @@ static bool test_del_key(struct torture_context *tctx, void *_data)
torture_assert_werr_ok(tctx, error,
"getting predefined key failed");
- error = reg_key_add_name(rctx, root, "Hamburg", NULL, NULL, &newkey);
+ error = reg_key_add_name(rctx, root, "Polen", NULL, NULL, &newkey);
torture_assert_werr_ok(tctx, error, "Creating key return code");
torture_assert(tctx, newkey != NULL, "Creating new key");
- error = reg_key_del(root, "Hamburg");
+ error = reg_key_del(root, "Polen");
torture_assert_werr_ok(tctx, error, "Delete key");
- error = reg_key_del(root, "Hamburg");
- torture_assert_werr_equal(tctx, error, WERR_NOT_FOUND,
+ error = reg_key_del(root, "Polen");
+ torture_assert_werr_equal(tctx, error, WERR_BADFILE,
"Delete missing key");
return true;
@@ -239,7 +239,7 @@ static bool test_flush_key(struct torture_context *tctx, void *_data)
struct registry_key *root, *subkey;
WERROR error;
- if (!create_test_key(tctx, rctx, "Munchen", &root, &subkey))
+ if (!create_test_key(tctx, rctx, "Bremen", &root, &subkey))
return false;
error = reg_key_flush(subkey);
@@ -416,7 +416,7 @@ static bool test_get_value(struct torture_context *tctx, void *_data)
error = reg_key_get_value_by_name(tctx, subkey, __FUNCTION__, &type,
&data);
- torture_assert_werr_equal(tctx, error, WERR_NOT_FOUND,
+ torture_assert_werr_equal(tctx, error, WERR_BADFILE,
"getting missing value");
error = reg_val_set(subkey, __FUNCTION__, REG_DWORD,
@@ -447,12 +447,12 @@ static bool test_del_value(struct torture_context *tctx, void *_data)
uint32_t value = 42;
uint32_t type;
- if (!create_test_key(tctx, rctx, "Duisburg", &root, &subkey))
+ if (!create_test_key(tctx, rctx, "Warschau", &root, &subkey))
return false;
error = reg_key_get_value_by_name(tctx, subkey, __FUNCTION__, &type,
&data);
- torture_assert_werr_equal(tctx, error, WERR_NOT_FOUND,
+ torture_assert_werr_equal(tctx, error, WERR_BADFILE,
"getting missing value");
error = reg_val_set(subkey, __FUNCTION__, REG_DWORD,
@@ -464,7 +464,7 @@ static bool test_del_value(struct torture_context *tctx, void *_data)
error = reg_key_get_value_by_name(tctx, subkey, __FUNCTION__,
&type, &data);
- torture_assert_werr_equal(tctx, error, WERR_NOT_FOUND,
+ torture_assert_werr_equal(tctx, error, WERR_BADFILE,
"getting missing value");
return true;
diff --git a/source4/lib/replace/getpass.m4 b/source4/lib/replace/getpass.m4
index 17dfdf7bf5..c4da9aae59 100644
--- a/source4/lib/replace/getpass.m4
+++ b/source4/lib/replace/getpass.m4
@@ -1,3 +1,11 @@
+AC_CHECK_FUNC(getpass, samba_cv_HAVE_GETPASS=yes)
+AC_CHECK_FUNC(getpassphrase, samba_cv_HAVE_GETPASSPHRASE=yes)
+if test x"$samba_cv_HAVE_GETPASS" = x"yes" -a x"$samba_cv_HAVE_GETPASSPHRASE" = x"yes"; then
+ AC_DEFINE(REPLACE_GETPASS_BY_GETPASSPHRASE, 1, [getpass returns <9 chars where getpassphrase returns <265 chars])
+ AC_DEFINE(REPLACE_GETPASS,1,[Whether getpass should be replaced])
+ LIBREPLACEOBJ="${LIBREPLACEOBJ} getpass.o"
+else
+
AC_CACHE_CHECK([whether getpass should be replaced],samba_cv_REPLACE_GETPASS,[
SAVE_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I$libreplacedir/"
@@ -12,3 +20,5 @@ if test x"$samba_cv_REPLACE_GETPASS" = x"yes"; then
AC_DEFINE(REPLACE_GETPASS,1,[Whether getpass should be replaced])
LIBREPLACEOBJ="${LIBREPLACEOBJ} getpass.o"
fi
+
+fi
diff --git a/source4/lib/replace/libreplace.m4 b/source4/lib/replace/libreplace.m4
index a577285639..6d1d6b8afc 100644
--- a/source4/lib/replace/libreplace.m4
+++ b/source4/lib/replace/libreplace.m4
@@ -100,6 +100,7 @@ AC_CHECK_HEADERS(sys/socket.h netinet/in.h netdb.h arpa/inet.h)
AC_CHECK_HEADERS(netinet/ip.h netinet/tcp.h netinet/in_systm.h netinet/in_ip.h)
AC_CHECK_HEADERS(sys/sockio.h sys/un.h)
AC_CHECK_HEADERS(sys/mount.h mntent.h)
+AC_CHECK_HEADERS(stropts.h)
dnl we need to check that net/if.h really can be used, to cope with hpux
dnl where including it always fails
diff --git a/source4/lib/replace/libreplace_ld.m4 b/source4/lib/replace/libreplace_ld.m4
index cb8e21434e..2aec698967 100644
--- a/source4/lib/replace/libreplace_ld.m4
+++ b/source4/lib/replace/libreplace_ld.m4
@@ -265,7 +265,7 @@ AC_DEFUN([AC_LIBREPLACE_LD_SHLIB_ALLOW_UNDEF_FLAG],
LD_SHLIB_ALLOW_UNDEF_FLAG="-Wl,--allow-shlib-undefined"
;;
*osf*)
- LD_SHLIB_ALLOW_UNDEF_FLAG="-expect_unresolved '*'"
+ LD_SHLIB_ALLOW_UNDEF_FLAG="-Wl,-expect_unresolved,\"*\""
;;
*darwin*)
LD_SHLIB_ALLOW_UNDEF_FLAG="-undefined dynamic_lookup"
diff --git a/source4/lib/replace/replace.c b/source4/lib/replace/replace.c
index cec158be31..b2a240e8ab 100644
--- a/source4/lib/replace/replace.c
+++ b/source4/lib/replace/replace.c
@@ -218,7 +218,7 @@ long nap(long milliseconds) {
#ifndef HAVE_MEMMOVE
/*******************************************************************
safely copies memory, ensuring no overlap problems.
-this is only used if the machine does not have it's own memmove().
+this is only used if the machine does not have its own memmove().
this is not the fastest algorithm in town, but it will do for our
needs.
********************************************************************/
diff --git a/source4/lib/replace/replace.h b/source4/lib/replace/replace.h
index f8a89a7213..3f91544e97 100644
--- a/source4/lib/replace/replace.h
+++ b/source4/lib/replace/replace.h
@@ -546,4 +546,12 @@ typedef int bool;
#define QSORT_CAST (int (*)(const void *, const void *))
#endif
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
+#ifndef MAX_DNS_NAME_LENGTH
+#define MAX_DNS_NAME_LENGTH 256 /* Actually 255 but +1 for terminating null. */
+#endif
+
#endif /* _LIBREPLACE_REPLACE_H */
diff --git a/source4/lib/replace/system/config.m4 b/source4/lib/replace/system/config.m4
index 799187af7d..1c05733126 100644
--- a/source4/lib/replace/system/config.m4
+++ b/source4/lib/replace/system/config.m4
@@ -73,6 +73,18 @@ AC_VERIFY_C_PROTOTYPE([struct passwd *getpwent_r(struct passwd *src, char *buf,
#include <unistd.h>
#include <pwd.h>
])
+AC_VERIFY_C_PROTOTYPE([struct passwd *getpwent_r(struct passwd *src, char *buf, size_t buflen)],
+ [
+ #ifndef HAVE_GETPWENT_R_DECL
+ #error missing getpwent_r prototype
+ #endif
+ return NULL;
+ ],[
+ AC_DEFINE(SOLARIS_GETPWENT_R, 1, [getpwent_r irix (similar to solaris) function prototype])
+ ],[],[
+ #include <unistd.h>
+ #include <pwd.h>
+ ])
AC_CHECK_FUNCS(getgrnam_r getgrgid_r getgrent_r)
AC_HAVE_DECL(getgrent_r, [
#include <unistd.h>
@@ -91,6 +103,19 @@ AC_VERIFY_C_PROTOTYPE([struct group *getgrent_r(struct group *src, char *buf, in
#include <grp.h>
])
+AC_VERIFY_C_PROTOTYPE([struct group *getgrent_r(struct group *src, char *buf, size_t buflen)],
+ [
+ #ifndef HAVE_GETGRENT_R_DECL
+ #error missing getgrent_r prototype
+ #endif
+ return NULL;
+ ],[
+ AC_DEFINE(SOLARIS_GETGRENT_R, 1, [getgrent_r irix (similar to solaris) function prototype])
+ ],[],[
+ #include <unistd.h>
+ #include <grp.h>
+ ])
+
# locale
AC_CHECK_HEADERS(ctype.h locale.h)
diff --git a/source4/lib/replace/system/network.h b/source4/lib/replace/system/network.h
index e2fad5f686..53bef66d48 100644
--- a/source4/lib/replace/system/network.h
+++ b/source4/lib/replace/system/network.h
@@ -79,6 +79,10 @@
#include <sys/ioctl.h>
#endif
+#ifdef HAVE_STROPTS_H
+#include <stropts.h>
+#endif
+
#ifdef REPLACE_INET_NTOA
/* define is in "replace.h" */
char *rep_inet_ntoa(struct in_addr ip);
diff --git a/source4/lib/replace/system/passwd.h b/source4/lib/replace/system/passwd.h
index 36fca7b4f8..cad3197ccb 100644
--- a/source4/lib/replace/system/passwd.h
+++ b/source4/lib/replace/system/passwd.h
@@ -68,9 +68,13 @@
#endif
#ifdef REPLACE_GETPASS
+#if defined(REPLACE_GETPASS_BY_GETPASSPHRASE)
+#define getpass(prompt) getpassphrase(prompt)
+#else
#define getpass(prompt) rep_getpass(prompt)
char *rep_getpass(const char *prompt);
#endif
+#endif
#ifndef NGROUPS_MAX
#define NGROUPS_MAX 32 /* Guess... */
diff --git a/source4/lib/samba3/config.mk b/source4/lib/samba3/config.mk
index 76f1ce5096..705bdd4002 100644
--- a/source4/lib/samba3/config.mk
+++ b/source4/lib/samba3/config.mk
@@ -1,9 +1,6 @@
################################################
# Start SUBSYSTEM LIBSAMBA3
-[LIBRARY::LIBSAMBA3]
-VERSION = 0.0.1
-SO_VERSION = 0
-DESCRIPTION = Library for reading Samba3 data files
+[SUBSYSTEM::LIBSAMBA3]
PRIVATE_PROTO_HEADER = samba3_proto.h
PUBLIC_HEADERS = samba3.h
OBJ_FILES = tdbsam.o policy.o \
diff --git a/source4/lib/socket_wrapper/config.mk b/source4/lib/socket_wrapper/config.mk
index 9e194230dc..4c5cf94348 100644
--- a/source4/lib/socket_wrapper/config.mk
+++ b/source4/lib/socket_wrapper/config.mk
@@ -1,9 +1,6 @@
##############################
# Start SUBSYSTEM SOCKET_WRAPPER
-[LIBRARY::SOCKET_WRAPPER]
-VERSION = 0.0.1
-SO_VERSION = 0
-DESCRIPTION = Wrapper library for testing TCP/IP connections using Unix Sockets
+[SUBSYSTEM::SOCKET_WRAPPER]
PUBLIC_HEADERS = socket_wrapper.h
OBJ_FILES = socket_wrapper.o
PRIVATE_DEPENDENCIES = EXT_SOCKET
diff --git a/source4/lib/tdb/common/freelist.c b/source4/lib/tdb/common/freelist.c
index b109643f23..2f2a4c379b 100644
--- a/source4/lib/tdb/common/freelist.c
+++ b/source4/lib/tdb/common/freelist.c
@@ -27,6 +27,12 @@
#include "tdb_private.h"
+/* 'right' merges can involve O(n^2) cost when combined with a
+ traverse, so they are disabled until we find a way to do them in
+ O(1) time
+*/
+#define USE_RIGHT_MERGES 0
+
/* read a freelist record and check for simple errors */
int tdb_rec_free_read(struct tdb_context *tdb, tdb_off_t off, struct list_struct *rec)
{
@@ -56,7 +62,7 @@ int tdb_rec_free_read(struct tdb_context *tdb, tdb_off_t off, struct list_struct
}
-
+#if USE_RIGHT_MERGES
/* Remove an element from the freelist. Must have alloc lock. */
static int remove_from_freelist(struct tdb_context *tdb, tdb_off_t off, tdb_off_t next)
{
@@ -75,6 +81,7 @@ static int remove_from_freelist(struct tdb_context *tdb, tdb_off_t off, tdb_off_
TDB_LOG((tdb, TDB_DEBUG_FATAL,"remove_from_freelist: not on list at off=%d\n", off));
return TDB_ERRCODE(TDB_ERR_CORRUPT, -1);
}
+#endif
/* update a record tailer (must hold allocation lock) */
@@ -93,8 +100,6 @@ static int update_tailer(struct tdb_context *tdb, tdb_off_t offset,
neccessary. */
int tdb_free(struct tdb_context *tdb, tdb_off_t offset, struct list_struct *rec)
{
- tdb_off_t right, left;
-
/* Allocation and tailer lock */
if (tdb_lock(tdb, -1, F_WRLCK) != 0)
return -1;
@@ -105,9 +110,10 @@ int tdb_free(struct tdb_context *tdb, tdb_off_t offset, struct list_struct *rec)
goto fail;
}
+#if USE_RIGHT_MERGES
/* Look right first (I'm an Australian, dammit) */
- right = offset + sizeof(*rec) + rec->rec_len;
- if (right + sizeof(*rec) <= tdb->map_size) {
+ if (offset + sizeof(*rec) + rec->rec_len + sizeof(*rec) <= tdb->map_size) {
+ tdb_off_t right = offset + sizeof(*rec) + rec->rec_len;
struct list_struct r;
if (tdb->methods->tdb_read(tdb, right, &r, sizeof(r), DOCONV()) == -1) {
@@ -122,13 +128,18 @@ int tdb_free(struct tdb_context *tdb, tdb_off_t offset, struct list_struct *rec)
goto left;
}
rec->rec_len += sizeof(r) + r.rec_len;
+ if (update_tailer(tdb, offset, rec) == -1) {
+ TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_free: update_tailer failed at %u\n", offset));
+ goto fail;
+ }
}
}
-
left:
+#endif
+
/* Look left */
- left = offset - sizeof(tdb_off_t);
- if (left > TDB_DATA_START(tdb->header.hash_size)) {
+ if (offset - sizeof(tdb_off_t) > TDB_DATA_START(tdb->header.hash_size)) {
+ tdb_off_t left = offset - sizeof(tdb_off_t);
struct list_struct l;
tdb_off_t leftsize;
@@ -145,7 +156,12 @@ left:
left = offset - leftsize;
- /* Now read in record */
+ if (leftsize > offset ||
+ left < TDB_DATA_START(tdb->header.hash_size)) {
+ goto update;
+ }
+
+ /* Now read in the left record */
if (tdb->methods->tdb_read(tdb, left, &l, sizeof(l), DOCONV()) == -1) {
TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_free: left read failed at %u (%u)\n", left, leftsize));
goto update;
@@ -153,21 +169,24 @@ left:
/* If it's free, expand to include it. */
if (l.magic == TDB_FREE_MAGIC) {
- if (remove_from_freelist(tdb, left, l.next) == -1) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_free: left free failed at %u\n", left));
- goto update;
- } else {
- offset = left;
- rec->rec_len += leftsize;
+ /* we now merge the new record into the left record, rather than the other
+ way around. This makes the operation O(1) instead of O(n). This change
+ prevents traverse from being O(n^2) after a lot of deletes */
+ l.rec_len += sizeof(*rec) + rec->rec_len;
+ if (tdb_rec_write(tdb, left, &l) == -1) {
+ TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_free: update_left failed at %u\n", left));
+ goto fail;
+ }
+ if (update_tailer(tdb, left, &l) == -1) {
+ TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_free: update_tailer failed at %u\n", offset));
+ goto fail;
}
+ tdb_unlock(tdb, -1, F_WRLCK);
+ return 0;
}
}
update:
- if (update_tailer(tdb, offset, rec) == -1) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_free: update_tailer failed at %u\n", offset));
- goto fail;
- }
/* Now, prepend to free list */
rec->magic = TDB_FREE_MAGIC;
@@ -189,62 +208,61 @@ update:
}
+
/*
the core of tdb_allocate - called when we have decided which
free list entry to use
+
+ Note that we try to allocate by grabbing data from the end of an existing record,
+ not the beginning. This is so the left merge in a free is more likely to be
+ able to free up the record without fragmentation
*/
-static tdb_off_t tdb_allocate_ofs(struct tdb_context *tdb, tdb_len_t length, tdb_off_t rec_ptr,
- struct list_struct *rec, tdb_off_t last_ptr)
+static tdb_off_t tdb_allocate_ofs(struct tdb_context *tdb,
+ tdb_len_t length, tdb_off_t rec_ptr,
+ struct list_struct *rec, tdb_off_t last_ptr)
{
- struct list_struct newrec;
- tdb_off_t newrec_ptr;
+#define MIN_REC_SIZE (sizeof(struct list_struct) + sizeof(tdb_off_t) + 8)
- memset(&newrec, '\0', sizeof(newrec));
+ if (rec->rec_len < length + MIN_REC_SIZE) {
+ /* we have to grab the whole record */
- /* found it - now possibly split it up */
- if (rec->rec_len > length + MIN_REC_SIZE) {
- /* Length of left piece */
- length = TDB_ALIGN(length, TDB_ALIGNMENT);
-
- /* Right piece to go on free list */
- newrec.rec_len = rec->rec_len - (sizeof(*rec) + length);
- newrec_ptr = rec_ptr + sizeof(*rec) + length;
-
- /* And left record is shortened */
- rec->rec_len = length;
- } else {
- newrec_ptr = 0;
+ /* unlink it from the previous record */
+ if (tdb_ofs_write(tdb, last_ptr, &rec->next) == -1) {
+ return 0;
+ }
+
+ /* mark it not free */
+ rec->magic = TDB_MAGIC;
+ if (tdb_rec_write(tdb, rec_ptr, rec) == -1) {
+ return 0;
+ }
+ return rec_ptr;
+ }
+
+ /* we're going to just shorten the existing record */
+ rec->rec_len -= (length + sizeof(*rec));
+ if (tdb_rec_write(tdb, rec_ptr, rec) == -1) {
+ return 0;
}
-
- /* Remove allocated record from the free list */
- if (tdb_ofs_write(tdb, last_ptr, &rec->next) == -1) {
+ if (update_tailer(tdb, rec_ptr, rec) == -1) {
return 0;
}
-
- /* Update header: do this before we drop alloc
- lock, otherwise tdb_free() might try to
- merge with us, thinking we're free.
- (Thanks Jeremy Allison). */
+
+ /* and setup the new record */
+ rec_ptr += sizeof(*rec) + rec->rec_len;
+
+ memset(rec, '\0', sizeof(*rec));
+ rec->rec_len = length;
rec->magic = TDB_MAGIC;
+
if (tdb_rec_write(tdb, rec_ptr, rec) == -1) {
return 0;
}
-
- /* Did we create new block? */
- if (newrec_ptr) {
- /* Update allocated record tailer (we
- shortened it). */
- if (update_tailer(tdb, rec_ptr, rec) == -1) {
- return 0;
- }
-
- /* Free new record */
- if (tdb_free(tdb, newrec_ptr, &newrec) == -1) {
- return 0;
- }
+
+ if (update_tailer(tdb, rec_ptr, rec) == -1) {
+ return 0;
}
-
- /* all done - return the new record offset */
+
return rec_ptr;
}
@@ -261,12 +279,14 @@ tdb_off_t tdb_allocate(struct tdb_context *tdb, tdb_len_t length, struct list_st
tdb_off_t rec_ptr, last_ptr;
tdb_len_t rec_len;
} bestfit;
+ float multiplier = 1.0;
if (tdb_lock(tdb, -1, F_WRLCK) == -1)
return 0;
/* Extra bytes required for tailer */
length += sizeof(tdb_off_t);
+ length = TDB_ALIGN(length, TDB_ALIGNMENT);
again:
last_ptr = FREELIST_TOP;
@@ -295,18 +315,27 @@ tdb_off_t tdb_allocate(struct tdb_context *tdb, tdb_len_t length, struct list_st
bestfit.rec_len = rec->rec_len;
bestfit.rec_ptr = rec_ptr;
bestfit.last_ptr = last_ptr;
- /* consider a fit to be good enough if
- we aren't wasting more than half
- the space */
- if (bestfit.rec_len < 2*length) {
- break;
- }
}
}
/* move to the next record */
last_ptr = rec_ptr;
rec_ptr = rec->next;
+
+ /* if we've found a record that is big enough, then
+ stop searching if its also not too big. The
+ definition of 'too big' changes as we scan
+ through */
+ if (bestfit.rec_len > 0 &&
+ bestfit.rec_len < length * multiplier) {
+ break;
+ }
+
+ /* this multiplier means we only extremely rarely
+ search more than 50 or so records. At 50 records we
+ accept records up to 11 times larger than what we
+ want */
+ multiplier *= 1.05;
}
if (bestfit.rec_ptr != 0) {
@@ -314,7 +343,8 @@ tdb_off_t tdb_allocate(struct tdb_context *tdb, tdb_len_t length, struct list_st
goto fail;
}
- newrec_ptr = tdb_allocate_ofs(tdb, length, bestfit.rec_ptr, rec, bestfit.last_ptr);
+ newrec_ptr = tdb_allocate_ofs(tdb, length, bestfit.rec_ptr,
+ rec, bestfit.last_ptr);
tdb_unlock(tdb, -1, F_WRLCK);
return newrec_ptr;
}
@@ -328,3 +358,25 @@ tdb_off_t tdb_allocate(struct tdb_context *tdb, tdb_len_t length, struct list_st
return 0;
}
+
+
+/*
+ return the size of the freelist - used to decide if we should repack
+*/
+int tdb_freelist_size(struct tdb_context *tdb)
+{
+ tdb_off_t ptr;
+ int count=0;
+
+ if (tdb_lock(tdb, -1, F_RDLCK) == -1) {
+ return -1;
+ }
+
+ ptr = FREELIST_TOP;
+ while (tdb_ofs_read(tdb, ptr, &ptr) == 0 && ptr != 0) {
+ count++;
+ }
+
+ tdb_unlock(tdb, -1, F_RDLCK);
+ return count;
+}
diff --git a/source4/lib/tdb/common/io.c b/source4/lib/tdb/common/io.c
index 8ab0768883..172ab69d8c 100644
--- a/source4/lib/tdb/common/io.c
+++ b/source4/lib/tdb/common/io.c
@@ -101,8 +101,8 @@ static int tdb_write(struct tdb_context *tdb, tdb_off_t off,
off+written);
}
if (written == -1) {
- /* Ensure ecode is set for log fn. */
- tdb->ecode = TDB_ERR_IO;
+ /* Ensure ecode is set for log fn. */
+ tdb->ecode = TDB_ERR_IO;
TDB_LOG((tdb, TDB_DEBUG_FATAL,"tdb_write failed at %d "
"len=%d (%s)\n", off, len, strerror(errno)));
return TDB_ERRCODE(TDB_ERR_IO, -1);
@@ -111,8 +111,8 @@ static int tdb_write(struct tdb_context *tdb, tdb_off_t off,
"write %d bytes at %d in two attempts\n",
len, off));
errno = ENOSPC;
- return TDB_ERRCODE(TDB_ERR_IO, -1);
- }
+ return TDB_ERRCODE(TDB_ERR_IO, -1);
+ }
}
return 0;
}
@@ -230,7 +230,7 @@ void tdb_mmap(struct tdb_context *tdb)
says to use for mmap expansion */
static int tdb_expand_file(struct tdb_context *tdb, tdb_off_t size, tdb_off_t addition)
{
- char buf[1024];
+ char buf[8192];
if (tdb->read_only || tdb->traverse_read) {
tdb->ecode = TDB_ERR_RDONLY;
@@ -294,7 +294,7 @@ static int tdb_expand_file(struct tdb_context *tdb, tdb_off_t size, tdb_off_t ad
int tdb_expand(struct tdb_context *tdb, tdb_off_t size)
{
struct list_struct rec;
- tdb_off_t offset;
+ tdb_off_t offset, new_size;
if (tdb_lock(tdb, -1, F_WRLCK) == -1) {
TDB_LOG((tdb, TDB_DEBUG_ERROR, "lock failed in tdb_expand\n"));
@@ -304,9 +304,11 @@ int tdb_expand(struct tdb_context *tdb, tdb_off_t size)
/* must know about any previous expansions by another process */
tdb->methods->tdb_oob(tdb, tdb->map_size + 1, 1);
- /* always make room for at least 10 more records, and round
- the database up to a multiple of the page size */
- size = TDB_ALIGN(tdb->map_size + size*10, tdb->page_size) - tdb->map_size;
+ /* always make room for at least 100 more records, and at
+ least 25% more space. Round the database up to a multiple
+ of the page size */
+ new_size = MAX(tdb->map_size + size*100, tdb->map_size * 1.25);
+ size = TDB_ALIGN(new_size, tdb->page_size) - tdb->map_size;
if (!(tdb->flags & TDB_INTERNAL))
tdb_munmap(tdb);
diff --git a/source4/lib/tdb/common/lock.c b/source4/lib/tdb/common/lock.c
index e3fe888c46..f156c0fa7b 100644
--- a/source4/lib/tdb/common/lock.c
+++ b/source4/lib/tdb/common/lock.c
@@ -505,6 +505,9 @@ int tdb_chainunlock_read(struct tdb_context *tdb, TDB_DATA key)
/* record lock stops delete underneath */
int tdb_lock_record(struct tdb_context *tdb, tdb_off_t off)
{
+ if (tdb->global_lock.count) {
+ return 0;
+ }
return off ? tdb->methods->tdb_brlock(tdb, off, F_RDLCK, F_SETLKW, 0, 1) : 0;
}
@@ -537,6 +540,10 @@ int tdb_unlock_record(struct tdb_context *tdb, tdb_off_t off)
struct tdb_traverse_lock *i;
uint32_t count = 0;
+ if (tdb->global_lock.count) {
+ return 0;
+ }
+
if (off == 0)
return 0;
for (i = &tdb->travlocks; i; i = i->next)
diff --git a/source4/lib/tdb/common/open.c b/source4/lib/tdb/common/open.c
index 0bd1c91a5e..b19e4cea29 100644
--- a/source4/lib/tdb/common/open.c
+++ b/source4/lib/tdb/common/open.c
@@ -35,7 +35,7 @@ static struct tdb_context *tdbs = NULL;
static unsigned int default_tdb_hash(TDB_DATA *key)
{
uint32_t value; /* Used to compute the hash value. */
- uint32_t i; /* Used to cycle through random values. */
+ uint32_t i; /* Used to cycle through random values. */
/* Set the initial value from the key size. */
for (value = 0x238F13AF * key->dsize, i=0; i < key->dsize; i++)
@@ -90,7 +90,7 @@ static int tdb_new_database(struct tdb_context *tdb, int hash_size)
size -= written;
written = write(tdb->fd, newdb+written, size);
if (written == size) {
- ret = 0;
+ ret = 0;
} else if (written >= 0) {
/* a second incomplete write - we give up.
* guessing the errno... */
@@ -152,6 +152,7 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags,
int rev = 0, locked = 0;
unsigned char *vp;
uint32_t vertest;
+ unsigned v;
if (!(tdb = (struct tdb_context *)calloc(1, sizeof *tdb))) {
/* Can't log this */
@@ -178,9 +179,7 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags,
tdb->page_size = 0x2000;
}
- if (open_flags & TDB_VOLATILE) {
- tdb->max_dead_records = 5;
- }
+ tdb->max_dead_records = (tdb_flags & TDB_VOLATILE) ? 5 : 0;
if ((open_flags & O_ACCMODE) == O_WRONLY) {
TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_open_ex: can't open tdb %s write-only\n",
@@ -215,6 +214,10 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags,
goto fail; /* errno set by open(2) */
}
+ /* on exec, don't inherit the fd */
+ v = fcntl(tdb->fd, F_GETFD, 0);
+ fcntl(tdb->fd, F_SETFD, v | FD_CLOEXEC);
+
/* ensure there is only one process initialising at once */
if (tdb->methods->tdb_brlock(tdb, GLOBAL_LOCK, F_WRLCK, F_SETLKW, 0, 1) == -1) {
TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_open_ex: failed to get global lock on %s: %s\n",
@@ -224,6 +227,7 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags,
/* we need to zero database if we are the only one with it open */
if ((tdb_flags & TDB_CLEAR_IF_FIRST) &&
+ (!tdb->read_only) &&
(locked = (tdb->methods->tdb_brlock(tdb, ACTIVE_LOCK, F_WRLCK, F_SETLK, 0, 1) == 0))) {
open_flags |= O_CREAT;
if (ftruncate(tdb->fd, 0) == -1) {
@@ -242,7 +246,7 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags,
/* its not a valid database - possibly initialise it */
if (!(open_flags & O_CREAT) || tdb_new_database(tdb, hash_size) == -1) {
if (errno == 0) {
- errno = EIO; /* ie bad format or something */
+ errno = EIO; /* ie bad format or something */
}
goto fail;
}
@@ -283,7 +287,6 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags,
tdb->map_size = st.st_size;
tdb->device = st.st_dev;
tdb->inode = st.st_ino;
- tdb->max_dead_records = 0;
tdb_mmap(tdb);
if (locked) {
if (tdb->methods->tdb_brlock(tdb, ACTIVE_LOCK, F_UNLCK, F_SETLK, 0, 1) == -1) {
diff --git a/source4/lib/tdb/common/tdb.c b/source4/lib/tdb/common/tdb.c
index 0e9d1dbd74..ea5d9ccc60 100644
--- a/source4/lib/tdb/common/tdb.c
+++ b/source4/lib/tdb/common/tdb.c
@@ -102,8 +102,7 @@ static tdb_off_t tdb_find(struct tdb_context *tdb, TDB_DATA key, uint32_t hash,
}
/* As tdb_find, but if you succeed, keep the lock */
-tdb_off_t tdb_find_lock_hash(struct tdb_context *tdb, TDB_DATA key,
- uint32_t hash, int locktype,
+tdb_off_t tdb_find_lock_hash(struct tdb_context *tdb, TDB_DATA key, uint32_t hash, int locktype,
struct list_struct *rec)
{
uint32_t rec_ptr;
@@ -237,14 +236,15 @@ int tdb_exists(struct tdb_context *tdb, TDB_DATA key)
}
/* actually delete an entry in the database given the offset */
-int tdb_do_delete(struct tdb_context *tdb, tdb_off_t rec_ptr, struct list_struct*rec)
+int tdb_do_delete(struct tdb_context *tdb, tdb_off_t rec_ptr, struct list_struct *rec)
{
tdb_off_t last_ptr, i;
struct list_struct lastrec;
if (tdb->read_only || tdb->traverse_read) return -1;
- if (tdb_write_lock_record(tdb, rec_ptr) == -1) {
+ if (tdb->traverse_write != 0 ||
+ tdb_write_lock_record(tdb, rec_ptr) == -1) {
/* Someone traversing here: mark it as dead */
rec->magic = TDB_DEAD_MAGIC;
return tdb_rec_write(tdb, rec_ptr, rec);
@@ -666,6 +666,16 @@ int tdb_get_flags(struct tdb_context *tdb)
return tdb->flags;
}
+void tdb_add_flags(struct tdb_context *tdb, unsigned flags)
+{
+ tdb->flags |= flags;
+}
+
+void tdb_remove_flags(struct tdb_context *tdb, unsigned flags)
+{
+ tdb->flags &= ~flags;
+}
+
/*
enable sequence number handling on an open tdb
@@ -674,3 +684,62 @@ void tdb_enable_seqnum(struct tdb_context *tdb)
{
tdb->flags |= TDB_SEQNUM;
}
+
+
+/*
+ wipe the entire database, deleting all records. This can be done
+ very fast by using a global lock. The entire data portion of the
+ file becomes a single entry in the freelist.
+ */
+int tdb_wipe_all(struct tdb_context *tdb)
+{
+ int i;
+ tdb_off_t offset = 0;
+ ssize_t data_len;
+
+ if (tdb_lockall(tdb) != 0) {
+ return -1;
+ }
+
+ /* wipe the hashes */
+ for (i=0;i<tdb->header.hash_size;i++) {
+ if (tdb_ofs_write(tdb, TDB_HASH_TOP(i), &offset) == -1) {
+ TDB_LOG((tdb, TDB_DEBUG_FATAL,"tdb_wipe_all: failed to write hash %d\n", i));
+ goto failed;
+ }
+ }
+
+ /* wipe the freelist */
+ if (tdb_ofs_write(tdb, FREELIST_TOP, &offset) == -1) {
+ TDB_LOG((tdb, TDB_DEBUG_FATAL,"tdb_wipe_all: failed to write freelist\n"));
+ goto failed;
+ }
+
+ if (tdb_ofs_write(tdb, TDB_RECOVERY_HEAD, &offset) == -1) {
+ TDB_LOG((tdb, TDB_DEBUG_FATAL,"tdb_wipe_all: failed to write recovery head\n"));
+ goto failed;
+ }
+
+ /* add all the rest of the file to the freelist */
+ data_len = (tdb->map_size - TDB_DATA_START(tdb->header.hash_size)) - sizeof(struct list_struct);
+ if (data_len > 0) {
+ struct list_struct rec;
+ memset(&rec,'\0',sizeof(rec));
+ rec.rec_len = data_len;
+ if (tdb_free(tdb, TDB_DATA_START(tdb->header.hash_size), &rec) == -1) {
+ TDB_LOG((tdb, TDB_DEBUG_FATAL,"tdb_wipe_all: failed to add free record\n"));
+ goto failed;
+ }
+ }
+
+ if (tdb_unlockall(tdb) != 0) {
+ TDB_LOG((tdb, TDB_DEBUG_FATAL,"tdb_wipe_all: failed to unlock\n"));
+ goto failed;
+ }
+
+ return 0;
+
+failed:
+ tdb_unlockall(tdb);
+ return -1;
+}
diff --git a/source4/lib/tdb/common/tdb_private.h b/source4/lib/tdb/common/tdb_private.h
index 00bd0eb537..ffac89ff0e 100644
--- a/source4/lib/tdb/common/tdb_private.h
+++ b/source4/lib/tdb/common/tdb_private.h
@@ -38,6 +38,10 @@
typedef uint32_t tdb_len_t;
typedef uint32_t tdb_off_t;
+#ifndef offsetof
+#define offsetof(t,f) ((unsigned int)&((t *)0)->f)
+#endif
+
#define TDB_MAGIC_FOOD "TDB file\n"
#define TDB_VERSION (0x26011967 + 6)
#define TDB_MAGIC (0x26011999U)
@@ -45,7 +49,6 @@ typedef uint32_t tdb_off_t;
#define TDB_DEAD_MAGIC (0xFEE1DEAD)
#define TDB_RECOVERY_MAGIC (0xf53bc0e7U)
#define TDB_ALIGNMENT 4
-#define MIN_REC_SIZE (2*sizeof(struct list_struct) + TDB_ALIGNMENT)
#define DEFAULT_HASH_SIZE 131
#define FREELIST_TOP (sizeof(struct tdb_header))
#define TDB_ALIGN(x,a) (((x) + (a)-1) & ~((a)-1))
@@ -54,7 +57,7 @@ typedef uint32_t tdb_off_t;
#define TDB_BAD_MAGIC(r) ((r)->magic != TDB_MAGIC && !TDB_DEAD(r))
#define TDB_HASH_TOP(hash) (FREELIST_TOP + (BUCKET(hash)+1)*sizeof(tdb_off_t))
#define TDB_HASHTABLE_SIZE(tdb) ((tdb->header.hash_size+1)*sizeof(tdb_off_t))
-#define TDB_DATA_START(hash_size) TDB_HASH_TOP(hash_size-1)
+#define TDB_DATA_START(hash_size) (TDB_HASH_TOP(hash_size-1) + sizeof(tdb_off_t))
#define TDB_RECOVERY_HEAD offsetof(struct tdb_header, recovery_start)
#define TDB_SEQNUM_OFS offsetof(struct tdb_header, sequence_number)
#define TDB_PAD_BYTE 0x42
@@ -144,6 +147,7 @@ struct tdb_context {
tdb_len_t map_size; /* how much space has been mapped */
int read_only; /* opened read-only */
int traverse_read; /* read-only traversal */
+ int traverse_write; /* read-write traversal */
struct tdb_lock_type global_lock;
int num_lockrecs;
struct tdb_lock_type *lockrecs; /* only real locks, all with count>0 */
@@ -173,6 +177,7 @@ struct tdb_context {
int tdb_munmap(struct tdb_context *tdb);
void tdb_mmap(struct tdb_context *tdb);
int tdb_lock(struct tdb_context *tdb, int list, int ltype);
+int tdb_lock_nonblock(struct tdb_context *tdb, int list, int ltype);
int tdb_unlock(struct tdb_context *tdb, int list, int ltype);
int tdb_brlock(struct tdb_context *tdb, tdb_off_t offset, int rw_type, int lck_type, int probe, size_t len);
int tdb_transaction_lock(struct tdb_context *tdb, int ltype);
diff --git a/source4/lib/tdb/common/transaction.c b/source4/lib/tdb/common/transaction.c
index 7eaacf7a16..c3e7a4e2c0 100644
--- a/source4/lib/tdb/common/transaction.c
+++ b/source4/lib/tdb/common/transaction.c
@@ -87,12 +87,6 @@
*/
-struct tdb_transaction_el {
- struct tdb_transaction_el *next, *prev;
- tdb_off_t offset;
- tdb_len_t length;
- unsigned char *data;
-};
/*
hold the context of any current transaction
@@ -105,12 +99,12 @@ struct tdb_transaction {
/* the original io methods - used to do IOs to the real db */
const struct tdb_methods *io_methods;
- /* the list of transaction elements. We use a doubly linked
- list with a last pointer to allow us to keep the list
- ordered, with first element at the front of the list. It
- needs to be doubly linked as the read/write traversals need
- to be backwards, while the commit needs to be forwards */
- struct tdb_transaction_el *elements, *elements_last;
+ /* the list of transaction blocks. When a block is first
+ written to, it gets created in this list */
+ uint8_t **blocks;
+ uint32_t num_blocks;
+ uint32_t block_size; /* bytes in each block */
+ uint32_t last_block_size; /* number of valid bytes in the last block */
/* non-zero when an internal transaction error has
occurred. All write operations will then fail until the
@@ -134,52 +128,48 @@ struct tdb_transaction {
static int transaction_read(struct tdb_context *tdb, tdb_off_t off, void *buf,
tdb_len_t len, int cv)
{
- struct tdb_transaction_el *el;
-
- /* we need to walk the list backwards to get the most recent data */
- for (el=tdb->transaction->elements_last;el;el=el->prev) {
- tdb_len_t partial;
+ uint32_t blk;
- if (off+len <= el->offset) {
- continue;
- }
- if (off >= el->offset + el->length) {
- continue;
+ /* break it down into block sized ops */
+ while (len + (off % tdb->transaction->block_size) > tdb->transaction->block_size) {
+ tdb_len_t len2 = tdb->transaction->block_size - (off % tdb->transaction->block_size);
+ if (transaction_read(tdb, off, buf, len2, cv) != 0) {
+ return -1;
}
+ len -= len2;
+ off += len2;
+ buf = (void *)(len2 + (char *)buf);
+ }
- /* an overlapping read - needs to be split into up to
- 2 reads and a memcpy */
- if (off < el->offset) {
- partial = el->offset - off;
- if (transaction_read(tdb, off, buf, partial, cv) != 0) {
- goto fail;
- }
- len -= partial;
- off += partial;
- buf = (void *)(partial + (char *)buf);
- }
- if (off + len <= el->offset + el->length) {
- partial = len;
- } else {
- partial = el->offset + el->length - off;
- }
- memcpy(buf, el->data + (off - el->offset), partial);
- if (cv) {
- tdb_convert(buf, len);
- }
- len -= partial;
- off += partial;
- buf = (void *)(partial + (char *)buf);
-
- if (len != 0 && transaction_read(tdb, off, buf, len, cv) != 0) {
+ if (len == 0) {
+ return 0;
+ }
+
+ blk = off / tdb->transaction->block_size;
+
+ /* see if we have it in the block list */
+ if (tdb->transaction->num_blocks <= blk ||
+ tdb->transaction->blocks[blk] == NULL) {
+ /* nope, do a real read */
+ if (tdb->transaction->io_methods->tdb_read(tdb, off, buf, len, cv) != 0) {
goto fail;
}
-
return 0;
}
- /* its not in the transaction elements - do a real read */
- return tdb->transaction->io_methods->tdb_read(tdb, off, buf, len, cv);
+ /* it is in the block list. Now check for the last block */
+ if (blk == tdb->transaction->num_blocks-1) {
+ if (len > tdb->transaction->last_block_size) {
+ goto fail;
+ }
+ }
+
+ /* now copy it out of this block */
+ memcpy(buf, tdb->transaction->blocks[blk] + (off % tdb->transaction->block_size), len);
+ if (cv) {
+ tdb_convert(buf, len);
+ }
+ return 0;
fail:
TDB_LOG((tdb, TDB_DEBUG_FATAL, "transaction_read: failed at off=%d len=%d\n", off, len));
@@ -195,12 +185,8 @@ fail:
static int transaction_write(struct tdb_context *tdb, tdb_off_t off,
const void *buf, tdb_len_t len)
{
- struct tdb_transaction_el *el, *best_el=NULL;
+ uint32_t blk;
- if (len == 0) {
- return 0;
- }
-
/* if the write is to a hash head, then update the transaction
hash heads */
if (len == sizeof(tdb_off_t) && off >= FREELIST_TOP &&
@@ -209,110 +195,142 @@ static int transaction_write(struct tdb_context *tdb, tdb_off_t off,
memcpy(&tdb->transaction->hash_heads[chain], buf, len);
}
- /* first see if we can replace an existing entry */
- for (el=tdb->transaction->elements_last;el;el=el->prev) {
- tdb_len_t partial;
-
- if (best_el == NULL && off == el->offset+el->length) {
- best_el = el;
- }
-
- if (off+len <= el->offset) {
- continue;
+ /* break it up into block sized chunks */
+ while (len + (off % tdb->transaction->block_size) > tdb->transaction->block_size) {
+ tdb_len_t len2 = tdb->transaction->block_size - (off % tdb->transaction->block_size);
+ if (transaction_write(tdb, off, buf, len2) != 0) {
+ return -1;
}
- if (off >= el->offset + el->length) {
- continue;
+ len -= len2;
+ off += len2;
+ if (buf != NULL) {
+ buf = (const void *)(len2 + (const char *)buf);
}
+ }
- /* an overlapping write - needs to be split into up to
- 2 writes and a memcpy */
- if (off < el->offset) {
- partial = el->offset - off;
- if (transaction_write(tdb, off, buf, partial) != 0) {
- goto fail;
- }
- len -= partial;
- off += partial;
- buf = (const void *)(partial + (const char *)buf);
- }
- if (off + len <= el->offset + el->length) {
- partial = len;
+ if (len == 0) {
+ return 0;
+ }
+
+ blk = off / tdb->transaction->block_size;
+ off = off % tdb->transaction->block_size;
+
+ if (tdb->transaction->num_blocks <= blk) {
+ uint8_t **new_blocks;
+ /* expand the blocks array */
+ if (tdb->transaction->blocks == NULL) {
+ new_blocks = (uint8_t **)malloc(
+ (blk+1)*sizeof(uint8_t *));
} else {
- partial = el->offset + el->length - off;
+ new_blocks = (uint8_t **)realloc(
+ tdb->transaction->blocks,
+ (blk+1)*sizeof(uint8_t *));
}
- memcpy(el->data + (off - el->offset), buf, partial);
- len -= partial;
- off += partial;
- buf = (const void *)(partial + (const char *)buf);
-
- if (len != 0 && transaction_write(tdb, off, buf, len) != 0) {
+ if (new_blocks == NULL) {
+ tdb->ecode = TDB_ERR_OOM;
goto fail;
}
-
- return 0;
+ memset(&new_blocks[tdb->transaction->num_blocks], 0,
+ (1+(blk - tdb->transaction->num_blocks))*sizeof(uint8_t *));
+ tdb->transaction->blocks = new_blocks;
+ tdb->transaction->num_blocks = blk+1;
+ tdb->transaction->last_block_size = 0;
}
- /* see if we can append the new entry to an existing entry */
- if (best_el && best_el->offset + best_el->length == off &&
- (off+len < tdb->transaction->old_map_size ||
- off > tdb->transaction->old_map_size)) {
- unsigned char *data = best_el->data;
- el = best_el;
- el->data = (unsigned char *)realloc(el->data,
- el->length + len);
- if (el->data == NULL) {
+ /* allocate and fill a block? */
+ if (tdb->transaction->blocks[blk] == NULL) {
+ tdb->transaction->blocks[blk] = (uint8_t *)calloc(tdb->transaction->block_size, 1);
+ if (tdb->transaction->blocks[blk] == NULL) {
tdb->ecode = TDB_ERR_OOM;
tdb->transaction->transaction_error = 1;
- el->data = data;
- return -1;
+ return -1;
}
- if (buf) {
- memcpy(el->data + el->length, buf, len);
- } else {
- memset(el->data + el->length, TDB_PAD_BYTE, len);
+ if (tdb->transaction->old_map_size > blk * tdb->transaction->block_size) {
+ tdb_len_t len2 = tdb->transaction->block_size;
+ if (len2 + (blk * tdb->transaction->block_size) > tdb->transaction->old_map_size) {
+ len2 = tdb->transaction->old_map_size - (blk * tdb->transaction->block_size);
+ }
+ if (tdb->transaction->io_methods->tdb_read(tdb, blk * tdb->transaction->block_size,
+ tdb->transaction->blocks[blk],
+ len2, 0) != 0) {
+ SAFE_FREE(tdb->transaction->blocks[blk]);
+ tdb->ecode = TDB_ERR_IO;
+ goto fail;
+ }
+ if (blk == tdb->transaction->num_blocks-1) {
+ tdb->transaction->last_block_size = len2;
+ }
}
- el->length += len;
- return 0;
- }
-
- /* add a new entry at the end of the list */
- el = (struct tdb_transaction_el *)malloc(sizeof(*el));
- if (el == NULL) {
- tdb->ecode = TDB_ERR_OOM;
- tdb->transaction->transaction_error = 1;
- return -1;
- }
- el->next = NULL;
- el->prev = tdb->transaction->elements_last;
- el->offset = off;
- el->length = len;
- el->data = (unsigned char *)malloc(len);
- if (el->data == NULL) {
- free(el);
- tdb->ecode = TDB_ERR_OOM;
- tdb->transaction->transaction_error = 1;
- return -1;
}
- if (buf) {
- memcpy(el->data, buf, len);
+
+ /* overwrite part of an existing block */
+ if (buf == NULL) {
+ memset(tdb->transaction->blocks[blk] + off, 0, len);
} else {
- memset(el->data, TDB_PAD_BYTE, len);
+ memcpy(tdb->transaction->blocks[blk] + off, buf, len);
}
- if (el->prev) {
- el->prev->next = el;
- } else {
- tdb->transaction->elements = el;
+ if (blk == tdb->transaction->num_blocks-1) {
+ if (len + off > tdb->transaction->last_block_size) {
+ tdb->transaction->last_block_size = len + off;
+ }
}
- tdb->transaction->elements_last = el;
+
return 0;
fail:
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "transaction_write: failed at off=%d len=%d\n", off, len));
- tdb->ecode = TDB_ERR_IO;
+ TDB_LOG((tdb, TDB_DEBUG_FATAL, "transaction_write: failed at off=%d len=%d\n",
+ (blk*tdb->transaction->block_size) + off, len));
tdb->transaction->transaction_error = 1;
return -1;
}
+
+/*
+ write while in a transaction - this varient never expands the transaction blocks, it only
+ updates existing blocks. This means it cannot change the recovery size
+*/
+static int transaction_write_existing(struct tdb_context *tdb, tdb_off_t off,
+ const void *buf, tdb_len_t len)
+{
+ uint32_t blk;
+
+ /* break it up into block sized chunks */
+ while (len + (off % tdb->transaction->block_size) > tdb->transaction->block_size) {
+ tdb_len_t len2 = tdb->transaction->block_size - (off % tdb->transaction->block_size);
+ if (transaction_write_existing(tdb, off, buf, len2) != 0) {
+ return -1;
+ }
+ len -= len2;
+ off += len2;
+ if (buf != NULL) {
+ buf = (const void *)(len2 + (const char *)buf);
+ }
+ }
+
+ if (len == 0) {
+ return 0;
+ }
+
+ blk = off / tdb->transaction->block_size;
+ off = off % tdb->transaction->block_size;
+
+ if (tdb->transaction->num_blocks <= blk ||
+ tdb->transaction->blocks[blk] == NULL) {
+ return 0;
+ }
+
+ if (blk == tdb->transaction->num_blocks-1 &&
+ off + len > tdb->transaction->last_block_size) {
+ len = tdb->transaction->last_block_size - off;
+ }
+
+ /* overwrite part of an existing block */
+ memcpy(tdb->transaction->blocks[blk] + off, buf, len);
+
+ return 0;
+}
+
+
/*
accelerated hash chain head search, using the cached hash heads
*/
@@ -419,10 +437,14 @@ int tdb_transaction_start(struct tdb_context *tdb)
return -1;
}
+ /* a page at a time seems like a reasonable compromise between compactness and efficiency */
+ tdb->transaction->block_size = tdb->page_size;
+
/* get the transaction write lock. This is a blocking lock. As
discussed with Volker, there are a number of ways we could
make this async, which we will probably do in the future */
if (tdb_transaction_lock(tdb, F_WRLCK) == -1) {
+ SAFE_FREE(tdb->transaction->blocks);
SAFE_FREE(tdb->transaction);
return -1;
}
@@ -460,21 +482,12 @@ int tdb_transaction_start(struct tdb_context *tdb)
tdb->transaction->io_methods = tdb->methods;
tdb->methods = &transaction_methods;
- /* by calling this transaction write here, we ensure that we don't grow the
- transaction linked list due to hash table updates */
- if (transaction_write(tdb, FREELIST_TOP, tdb->transaction->hash_heads,
- TDB_HASHTABLE_SIZE(tdb)) != 0) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_start: failed to prime hash table\n"));
- tdb->ecode = TDB_ERR_IO;
- tdb->methods = tdb->transaction->io_methods;
- goto fail;
- }
-
return 0;
fail:
tdb_brlock(tdb, FREELIST_TOP, F_UNLCK, F_SETLKW, 0, 0);
tdb_transaction_unlock(tdb);
+ SAFE_FREE(tdb->transaction->blocks);
SAFE_FREE(tdb->transaction->hash_heads);
SAFE_FREE(tdb->transaction);
return -1;
@@ -486,6 +499,8 @@ fail:
*/
int tdb_transaction_cancel(struct tdb_context *tdb)
{
+ int i;
+
if (tdb->transaction == NULL) {
TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_transaction_cancel: no transaction\n"));
return -1;
@@ -499,13 +514,13 @@ int tdb_transaction_cancel(struct tdb_context *tdb)
tdb->map_size = tdb->transaction->old_map_size;
- /* free all the transaction elements */
- while (tdb->transaction->elements) {
- struct tdb_transaction_el *el = tdb->transaction->elements;
- tdb->transaction->elements = el->next;
- free(el->data);
- free(el);
+ /* free all the transaction blocks */
+ for (i=0;i<tdb->transaction->num_blocks;i++) {
+ if (tdb->transaction->blocks[i] != NULL) {
+ free(tdb->transaction->blocks[i]);
+ }
}
+ SAFE_FREE(tdb->transaction->blocks);
/* remove any global lock created during the transaction */
if (tdb->global_lock.count != 0) {
@@ -515,7 +530,6 @@ int tdb_transaction_cancel(struct tdb_context *tdb)
/* remove any locks created during the transaction */
if (tdb->num_locks != 0) {
- int i;
for (i=0;i<tdb->num_lockrecs;i++) {
tdb_brlock(tdb,FREELIST_TOP+4*tdb->lockrecs[i].list,
F_UNLCK,F_SETLKW, 0, 1);
@@ -567,16 +581,24 @@ static int transaction_sync(struct tdb_context *tdb, tdb_off_t offset, tdb_len_t
*/
static tdb_len_t tdb_recovery_size(struct tdb_context *tdb)
{
- struct tdb_transaction_el *el;
tdb_len_t recovery_size = 0;
+ int i;
recovery_size = sizeof(uint32_t);
- for (el=tdb->transaction->elements;el;el=el->next) {
- if (el->offset >= tdb->transaction->old_map_size) {
+ for (i=0;i<tdb->transaction->num_blocks;i++) {
+ if (i * tdb->transaction->block_size >= tdb->transaction->old_map_size) {
+ break;
+ }
+ if (tdb->transaction->blocks[i] == NULL) {
continue;
}
- recovery_size += 2*sizeof(tdb_off_t) + el->length;
- }
+ recovery_size += 2*sizeof(tdb_off_t);
+ if (i == tdb->transaction->num_blocks-1) {
+ recovery_size += tdb->transaction->last_block_size;
+ } else {
+ recovery_size += tdb->transaction->block_size;
+ }
+ }
return recovery_size;
}
@@ -658,6 +680,10 @@ static int tdb_recovery_allocate(struct tdb_context *tdb,
TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_recovery_allocate: failed to write recovery head\n"));
return -1;
}
+ if (transaction_write_existing(tdb, TDB_RECOVERY_HEAD, &recovery_head, sizeof(tdb_off_t)) == -1) {
+ TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_recovery_allocate: failed to write recovery head\n"));
+ return -1;
+ }
return 0;
}
@@ -669,7 +695,6 @@ static int tdb_recovery_allocate(struct tdb_context *tdb,
static int transaction_setup_recovery(struct tdb_context *tdb,
tdb_off_t *magic_offset)
{
- struct tdb_transaction_el *el;
tdb_len_t recovery_size;
unsigned char *data, *p;
const struct tdb_methods *methods = tdb->transaction->io_methods;
@@ -677,6 +702,7 @@ static int transaction_setup_recovery(struct tdb_context *tdb,
tdb_off_t recovery_offset, recovery_max_size;
tdb_off_t old_map_size = tdb->transaction->old_map_size;
uint32_t magic, tailer;
+ int i;
/*
check that the recovery area has enough space
@@ -704,30 +730,43 @@ static int transaction_setup_recovery(struct tdb_context *tdb,
/* build the recovery data into a single blob to allow us to do a single
large write, which should be more efficient */
p = data + sizeof(*rec);
- for (el=tdb->transaction->elements;el;el=el->next) {
- if (el->offset >= old_map_size) {
+ for (i=0;i<tdb->transaction->num_blocks;i++) {
+ tdb_off_t offset;
+ tdb_len_t length;
+
+ if (tdb->transaction->blocks[i] == NULL) {
+ continue;
+ }
+
+ offset = i * tdb->transaction->block_size;
+ length = tdb->transaction->block_size;
+ if (i == tdb->transaction->num_blocks-1) {
+ length = tdb->transaction->last_block_size;
+ }
+
+ if (offset >= old_map_size) {
continue;
}
- if (el->offset + el->length > tdb->transaction->old_map_size) {
+ if (offset + length > tdb->transaction->old_map_size) {
TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_setup_recovery: transaction data over new region boundary\n"));
free(data);
tdb->ecode = TDB_ERR_CORRUPT;
return -1;
}
- memcpy(p, &el->offset, 4);
- memcpy(p+4, &el->length, 4);
+ memcpy(p, &offset, 4);
+ memcpy(p+4, &length, 4);
if (DOCONV()) {
tdb_convert(p, 8);
}
/* the recovery area contains the old data, not the
new data, so we have to call the original tdb_read
method to get it */
- if (methods->tdb_read(tdb, el->offset, p + 8, el->length, 0) != 0) {
+ if (methods->tdb_read(tdb, offset, p + 8, length, 0) != 0) {
free(data);
tdb->ecode = TDB_ERR_IO;
return -1;
}
- p += 8 + el->length;
+ p += 8 + length;
}
/* and the tailer */
@@ -742,6 +781,12 @@ static int transaction_setup_recovery(struct tdb_context *tdb,
tdb->ecode = TDB_ERR_IO;
return -1;
}
+ if (transaction_write_existing(tdb, recovery_offset, data, sizeof(*rec) + recovery_size) == -1) {
+ TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_setup_recovery: failed to write secondary recovery data\n"));
+ free(data);
+ tdb->ecode = TDB_ERR_IO;
+ return -1;
+ }
/* as we don't have ordered writes, we have to sync the recovery
data before we update the magic to indicate that the recovery
@@ -763,6 +808,11 @@ static int transaction_setup_recovery(struct tdb_context *tdb,
tdb->ecode = TDB_ERR_IO;
return -1;
}
+ if (transaction_write_existing(tdb, *magic_offset, &magic, sizeof(magic)) == -1) {
+ TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_setup_recovery: failed to write secondary recovery magic\n"));
+ tdb->ecode = TDB_ERR_IO;
+ return -1;
+ }
/* ensure the recovery magic marker is on disk */
if (transaction_sync(tdb, *magic_offset, sizeof(magic)) == -1) {
@@ -780,6 +830,7 @@ int tdb_transaction_commit(struct tdb_context *tdb)
const struct tdb_methods *methods;
tdb_off_t magic_offset = 0;
uint32_t zero = 0;
+ int i;
if (tdb->transaction == NULL) {
TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_transaction_commit: no transaction\n"));
@@ -793,13 +844,14 @@ int tdb_transaction_commit(struct tdb_context *tdb)
return -1;
}
+
if (tdb->transaction->nesting != 0) {
tdb->transaction->nesting--;
return 0;
}
/* check for a null transaction */
- if (tdb->transaction->elements == NULL) {
+ if (tdb->transaction->blocks == NULL) {
tdb_transaction_cancel(tdb);
return 0;
}
@@ -858,10 +910,21 @@ int tdb_transaction_commit(struct tdb_context *tdb)
}
/* perform all the writes */
- while (tdb->transaction->elements) {
- struct tdb_transaction_el *el = tdb->transaction->elements;
+ for (i=0;i<tdb->transaction->num_blocks;i++) {
+ tdb_off_t offset;
+ tdb_len_t length;
+
+ if (tdb->transaction->blocks[i] == NULL) {
+ continue;
+ }
- if (methods->tdb_write(tdb, el->offset, el->data, el->length) == -1) {
+ offset = i * tdb->transaction->block_size;
+ length = tdb->transaction->block_size;
+ if (i == tdb->transaction->num_blocks-1) {
+ length = tdb->transaction->last_block_size;
+ }
+
+ if (methods->tdb_write(tdb, offset, tdb->transaction->blocks[i], length) == -1) {
TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_commit: write failed during commit\n"));
/* we've overwritten part of the data and
@@ -876,11 +939,12 @@ int tdb_transaction_commit(struct tdb_context *tdb)
TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_commit: write failed\n"));
return -1;
}
- tdb->transaction->elements = el->next;
- free(el->data);
- free(el);
+ SAFE_FREE(tdb->transaction->blocks[i]);
}
+ SAFE_FREE(tdb->transaction->blocks);
+ tdb->transaction->num_blocks = 0;
+
if (!(tdb->flags & TDB_NOSYNC)) {
/* ensure the new data is on disk */
if (transaction_sync(tdb, 0, tdb->map_size) == -1) {
@@ -919,6 +983,7 @@ int tdb_transaction_commit(struct tdb_context *tdb)
/* use a transaction cancel to free memory and remove the
transaction locks */
tdb_transaction_cancel(tdb);
+
return 0;
}
diff --git a/source4/lib/tdb/common/traverse.c b/source4/lib/tdb/common/traverse.c
index 6fc576a55a..07b0c23858 100644
--- a/source4/lib/tdb/common/traverse.c
+++ b/source4/lib/tdb/common/traverse.c
@@ -223,6 +223,9 @@ int tdb_traverse_read(struct tdb_context *tdb,
/*
a write style traverse - needs to get the transaction lock to
prevent deadlocks
+
+ WARNING: The data buffer given to the callback fn does NOT meet the
+ alignment restrictions malloc gives you.
*/
int tdb_traverse(struct tdb_context *tdb,
tdb_traverse_func fn, void *private_data)
@@ -238,7 +241,9 @@ int tdb_traverse(struct tdb_context *tdb,
return -1;
}
+ tdb->traverse_write++;
ret = tdb_traverse_internal(tdb, fn, private_data, &tl);
+ tdb->traverse_write--;
tdb_transaction_unlock(tdb);
@@ -330,3 +335,4 @@ TDB_DATA tdb_nextkey(struct tdb_context *tdb, TDB_DATA oldkey)
TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_nextkey: WARNING tdb_unlock failed!\n"));
return key;
}
+
diff --git a/source4/lib/tdb/docs/README b/source4/lib/tdb/docs/README
index b31ce36ab1..63fcf5e049 100644
--- a/source4/lib/tdb/docs/README
+++ b/source4/lib/tdb/docs/README
@@ -130,6 +130,9 @@ int tdb_traverse(TDB_CONTEXT *tdb, int (*fn)(TDB_CONTEXT *tdb,
a non-zero return value from fn() indicates that the traversal
should stop. Traversal callbacks may not start transactions.
+ WARNING: The data buffer given to the callback fn does NOT meet the
+ alignment restrictions malloc gives you.
+
----------------------------------------------------------------------
int tdb_traverse_read(TDB_CONTEXT *tdb, int (*fn)(TDB_CONTEXT *tdb,
TDB_DATA key, TDB_DATA dbuf, void *state), void *state);
diff --git a/source4/lib/tdb/include/tdb.h b/source4/lib/tdb/include/tdb.h
index 7de4c419a8..0008085de5 100644
--- a/source4/lib/tdb/include/tdb.h
+++ b/source4/lib/tdb/include/tdb.h
@@ -32,9 +32,9 @@ extern "C" {
/* flags to tdb_store() */
-#define TDB_REPLACE 1
-#define TDB_INSERT 2
-#define TDB_MODIFY 3
+#define TDB_REPLACE 1 /* Unused */
+#define TDB_INSERT 2 /* Don't overwrite an existing entry */
+#define TDB_MODIFY 3 /* Don't create an existing entry */
/* flags for tdb_open() */
#define TDB_DEFAULT 0 /* just a readability place holder */
@@ -135,6 +135,8 @@ int tdb_get_seqnum(struct tdb_context *tdb);
int tdb_hash_size(struct tdb_context *tdb);
size_t tdb_map_size(struct tdb_context *tdb);
int tdb_get_flags(struct tdb_context *tdb);
+void tdb_add_flags(struct tdb_context *tdb, unsigned flag);
+void tdb_remove_flags(struct tdb_context *tdb, unsigned flag);
void tdb_enable_seqnum(struct tdb_context *tdb);
void tdb_increment_seqnum_nonblock(struct tdb_context *tdb);
@@ -153,6 +155,8 @@ void tdb_setalarm_sigptr(struct tdb_context *tdb, volatile sig_atomic_t *sigptr)
void tdb_dump_all(struct tdb_context *tdb);
int tdb_printfreelist(struct tdb_context *tdb);
int tdb_validate_freelist(struct tdb_context *tdb, int *pnum_entries);
+int tdb_wipe_all(struct tdb_context *tdb);
+int tdb_freelist_size(struct tdb_context *tdb);
extern TDB_DATA tdb_null;
diff --git a/source4/lib/tdb/python/tdbdump.py b/source4/lib/tdb/python/tdbdump.py
new file mode 100644
index 0000000000..d759d771c8
--- /dev/null
+++ b/source4/lib/tdb/python/tdbdump.py
@@ -0,0 +1,12 @@
+#!/usr/bin/python
+# Trivial reimplementation of tdbdump in Python
+
+import tdb, sys
+
+if len(sys.argv) < 2:
+ print "Usage: tdbdump.py <tdb-file>"
+ sys.exit(1)
+
+db = tdb.Tdb(sys.argv[1])
+for (k, v) in db.iteritems():
+ print "{\nkey(%d) = %r\ndata(%d) = %r\n}" % (len(k), k, len(v), v)
diff --git a/source4/lib/tdb/tools/tdbtool.c b/source4/lib/tdb/tools/tdbtool.c
index 79435a3571..d104ccd7c4 100644
--- a/source4/lib/tdb/tools/tdbtool.c
+++ b/source4/lib/tdb/tools/tdbtool.c
@@ -135,7 +135,7 @@ static void print_data(const char *buf,int len)
if (len<=0) return;
printf("[%03X] ",i);
for (i=0;i<len;) {
- printf("%02X ",(int)buf[i]);
+ printf("%02X ",(int)((unsigned char)buf[i]));
i++;
if (i%8 == 0) printf(" ");
if (i%16 == 0) {
diff --git a/source4/lib/tdr/config.mk b/source4/lib/tdr/config.mk
index f0e24c54b4..b8473e5ba8 100644
--- a/source4/lib/tdr/config.mk
+++ b/source4/lib/tdr/config.mk
@@ -1,9 +1,6 @@
-[LIBRARY::TDR]
+[SUBSYSTEM::TDR]
CFLAGS = -Ilib/tdr
PUBLIC_HEADERS = tdr.h
-VERSION = 0.0.1
-SO_VERSION = 0
-DESCRIPTION = Simple marshall/unmarshall library
PUBLIC_PROTO_HEADER = tdr_proto.h
PUBLIC_DEPENDENCIES = LIBTALLOC LIBSAMBA-UTIL
OBJ_FILES = tdr.o
diff --git a/source4/libcli/util/asn1.c b/source4/lib/util/asn1.c
index aad55382d9..4756c0640d 100644
--- a/source4/libcli/util/asn1.c
+++ b/source4/lib/util/asn1.c
@@ -18,7 +18,7 @@
*/
#include "includes.h"
-#include "libcli/util/asn_1.h"
+#include "lib/util/asn1.h"
/* allocate an asn1 structure */
struct asn1_data *asn1_init(TALLOC_CTX *mem_ctx)
diff --git a/source4/libcli/util/asn_1.h b/source4/lib/util/asn1.h
index 612a8a932f..34aa1e2cb9 100644
--- a/source4/libcli/util/asn_1.h
+++ b/source4/lib/util/asn1.h
@@ -49,6 +49,6 @@ struct asn1_data {
#define ASN1_MAX_OIDS 20
-#include "libcli/util/asn1_proto.h"
+#include "lib/util/asn1_proto.h"
#endif /* _ASN_1_H */
diff --git a/source4/lib/util/config.mk b/source4/lib/util/config.mk
index 01ad14aa95..53a55bf7af 100644
--- a/source4/lib/util/config.mk
+++ b/source4/lib/util/config.mk
@@ -34,6 +34,11 @@ PUBLIC_DEPENDENCIES = \
SOCKET_WRAPPER EXT_NSL \
CHARSET EXECINFO
+[SUBSYSTEM::ASN1_UTIL]
+PUBLIC_PROTO_HEADER = asn1_proto.h
+PUBLIC_HEADERS = asn1.h
+OBJ_FILES = asn1.o
+
[SUBSYSTEM::UNIX_PRIVS]
PRIVATE_PROTO_HEADER = unix_privs.h
OBJ_FILES = unix_privs.o
diff --git a/source4/libcli/cldap/cldap.h b/source4/libcli/cldap/cldap.h
index 8aa98f0331..7a222e0652 100644
--- a/source4/libcli/cldap/cldap.h
+++ b/source4/libcli/cldap/cldap.h
@@ -19,7 +19,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "libcli/util/asn_1.h"
+#include "lib/util/asn1.h"
#include "librpc/gen_ndr/nbt.h"
struct ldap_message;
diff --git a/source4/libcli/config.mk b/source4/libcli/config.mk
index adb51c6c9a..a538d607bb 100644
--- a/source4/libcli/config.mk
+++ b/source4/libcli/config.mk
@@ -8,11 +8,6 @@ OBJ_FILES = util/doserr.o \
util/errormap.o \
util/nterr.o \
-[SUBSYSTEM::ASN1_UTIL]
-PUBLIC_PROTO_HEADER = util/asn1_proto.h
-PUBLIC_HEADERS = util/asn_1.h
-OBJ_FILES = util/asn1.o
-
[SUBSYSTEM::LIBCLI_LSA]
PRIVATE_PROTO_HEADER = util/clilsa.h
OBJ_FILES = util/clilsa.o
@@ -55,17 +50,13 @@ OBJ_FILES = \
PUBLIC_DEPENDENCIES = LIBNDR NDR_NBT LIBCLI_COMPOSITE LIBEVENTS \
NDR_SECURITY samba-socket LIBSAMBA-UTIL
-[LIBRARY::swig_libcli_nbt]
-LIBRARY_REALNAME = swig/_libcli_nbt.$(SHLIBEXT)
-OBJ_FILES = swig/libcli_nbt_wrap.o
+[PYTHON::python_libcli_nbt]
+SWIG_FILE = swig/libcli_nbt.i
PUBLIC_DEPENDENCIES = LIBCLI_NBT DYNCONFIG LIBSAMBA-CONFIG
-ENABLE = NO
-[LIBRARY::swig_libcli_smb]
-LIBRARY_REALNAME = swig/_libcli_smb.$(SHLIBEXT)
-OBJ_FILES = swig/libcli_smb_wrap.o
+[PYTHON::python_libcli_smb]
+SWIG_FILE = swig/libcli_smb.i
PUBLIC_DEPENDENCIES = LIBCLI_SMB DYNCONFIG LIBSAMBA-CONFIG
-ENABLE = NO
[SUBSYSTEM::LIBCLI_DGRAM]
OBJ_FILES = \
@@ -76,20 +67,14 @@ OBJ_FILES = \
dgram/browse.o
PUBLIC_DEPENDENCIES = LIBCLI_NBT LIBNDR LIBCLI_RESOLVE
-[LIBRARY::LIBCLI_CLDAP]
-VERSION = 0.0.1
-SO_VERSION = 0
-DESCRIPTION = CLDAP client library
+[SUBSYSTEM::LIBCLI_CLDAP]
OBJ_FILES = cldap/cldap.o
PUBLIC_HEADERS = cldap/cldap.h
PUBLIC_DEPENDENCIES = LIBCLI_LDAP
PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL LIBLDB
-[LIBRARY::LIBCLI_WREPL]
+[SUBSYSTEM::LIBCLI_WREPL]
PRIVATE_PROTO_HEADER = wrepl/winsrepl_proto.h
-VERSION = 0.0.1
-SO_VERSION = 0
-DESCRIPTION = WINS Replication client library
OBJ_FILES = \
wrepl/winsrepl.o
PUBLIC_DEPENDENCIES = NDR_WINSREPL samba-socket LIBCLI_RESOLVE LIBEVENTS \
@@ -117,12 +102,9 @@ OBJ_FILES = \
finddcs.o
PUBLIC_DEPENDENCIES = LIBCLI_NBT MESSAGING
-[LIBRARY::LIBCLI_SMB]
+[SUBSYSTEM::LIBCLI_SMB]
PUBLIC_HEADERS = libcli.h
PUBLIC_PROTO_HEADER = libcli_proto.h
-VERSION = 0.0.1
-SO_VERSION = 0
-DESCRIPTION = SMB/CIFS client library
OBJ_FILES = clireadwrite.o \
cliconnect.o \
clifile.o \
diff --git a/source4/libcli/ldap/ldap.c b/source4/libcli/ldap/ldap.c
index 586f2fa653..00a0631753 100644
--- a/source4/libcli/ldap/ldap.c
+++ b/source4/libcli/ldap/ldap.c
@@ -23,7 +23,7 @@
*/
#include "includes.h"
-#include "libcli/util/asn_1.h"
+#include "lib/util/asn1.h"
#include "libcli/ldap/ldap.h"
diff --git a/source4/libcli/ldap/ldap_client.c b/source4/libcli/ldap/ldap_client.c
index 6b8a7a3f28..d99851ee15 100644
--- a/source4/libcli/ldap/ldap_client.c
+++ b/source4/libcli/ldap/ldap_client.c
@@ -23,7 +23,7 @@
*/
#include "includes.h"
-#include "libcli/util/asn_1.h"
+#include "lib/util/asn1.h"
#include "lib/util/dlinklist.h"
#include "lib/events/events.h"
#include "lib/socket/socket.h"
diff --git a/source4/libcli/ldap/ldap_controls.c b/source4/libcli/ldap/ldap_controls.c
index 34e5cccf75..3b94580033 100644
--- a/source4/libcli/ldap/ldap_controls.c
+++ b/source4/libcli/ldap/ldap_controls.c
@@ -20,7 +20,7 @@
*/
#include "includes.h"
-#include "libcli/util/asn_1.h"
+#include "lib/util/asn1.h"
#include "libcli/ldap/ldap.h"
#include "lib/ldb/include/ldb.h"
diff --git a/source4/libcli/swig/libcli_nbt.i b/source4/libcli/swig/libcli_nbt.i
index 6fd85c2b8c..827230b113 100644
--- a/source4/libcli/swig/libcli_nbt.i
+++ b/source4/libcli/swig/libcli_nbt.i
@@ -31,6 +31,7 @@
#include "lib/talloc/talloc.h"
#include "libcli/nbt/libnbt.h"
#include "param/param.h"
+#include "lib/events/events.h"
/* Undo strcpy safety macro as it's used by swig )-: */
diff --git a/source4/libcli/swig/libcli_nbt.py b/source4/libcli/swig/libcli_nbt.py
index 938ab382f6..b49e240bc2 100644
--- a/source4/libcli/swig/libcli_nbt.py
+++ b/source4/libcli/swig/libcli_nbt.py
@@ -2,7 +2,6 @@
# Version 1.3.33
#
# Don't modify this file, modify the SWIG interface instead.
-# This file is compatible with both classic and new-style classes.
import _libcli_nbt
import new
@@ -48,6 +47,16 @@ except AttributeError:
del types
+def _swig_setattr_nondynamic_method(set):
+ def set_attr(self,name,value):
+ if (name == "thisown"): return self.this.own(value)
+ if hasattr(self,name) or (name == "this"):
+ set(self,name,value)
+ else:
+ raise AttributeError("You cannot add attributes to %s" % self)
+ return set_attr
+
+
import events
nbt_name_socket_init = _libcli_nbt.nbt_name_socket_init
NBT_NAME_CLIENT = _libcli_nbt.NBT_NAME_CLIENT
@@ -58,106 +67,54 @@ NBT_NAME_PDC = _libcli_nbt.NBT_NAME_PDC
NBT_NAME_LOGON = _libcli_nbt.NBT_NAME_LOGON
NBT_NAME_MASTER = _libcli_nbt.NBT_NAME_MASTER
NBT_NAME_BROWSER = _libcli_nbt.NBT_NAME_BROWSER
-class nbt_name(_object):
- __swig_setmethods__ = {}
- __setattr__ = lambda self, name, value: _swig_setattr(self, nbt_name, name, value)
- __swig_getmethods__ = {}
- __getattr__ = lambda self, name: _swig_getattr(self, nbt_name, name)
+class nbt_name(object):
+ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
- __swig_setmethods__["name"] = _libcli_nbt.nbt_name_name_set
- __swig_getmethods__["name"] = _libcli_nbt.nbt_name_name_get
- if _newclass:name = _swig_property(_libcli_nbt.nbt_name_name_get, _libcli_nbt.nbt_name_name_set)
- __swig_setmethods__["scope"] = _libcli_nbt.nbt_name_scope_set
- __swig_getmethods__["scope"] = _libcli_nbt.nbt_name_scope_get
- if _newclass:scope = _swig_property(_libcli_nbt.nbt_name_scope_get, _libcli_nbt.nbt_name_scope_set)
- __swig_setmethods__["type"] = _libcli_nbt.nbt_name_type_set
- __swig_getmethods__["type"] = _libcli_nbt.nbt_name_type_get
- if _newclass:type = _swig_property(_libcli_nbt.nbt_name_type_get, _libcli_nbt.nbt_name_type_set)
+ name = _swig_property(_libcli_nbt.nbt_name_name_get, _libcli_nbt.nbt_name_name_set)
+ scope = _swig_property(_libcli_nbt.nbt_name_scope_get, _libcli_nbt.nbt_name_scope_set)
+ type = _swig_property(_libcli_nbt.nbt_name_type_get, _libcli_nbt.nbt_name_type_set)
def __init__(self, *args, **kwargs):
- this = _libcli_nbt.new_nbt_name(*args, **kwargs)
- try: self.this.append(this)
- except: self.this = this
+ _libcli_nbt.nbt_name_swiginit(self,_libcli_nbt.new_nbt_name(*args, **kwargs))
__swig_destroy__ = _libcli_nbt.delete_nbt_name
- __del__ = lambda self : None;
nbt_name_swigregister = _libcli_nbt.nbt_name_swigregister
nbt_name_swigregister(nbt_name)
-class nbt_name_query(_object):
- __swig_setmethods__ = {}
- __setattr__ = lambda self, name, value: _swig_setattr(self, nbt_name_query, name, value)
- __swig_getmethods__ = {}
- __getattr__ = lambda self, name: _swig_getattr(self, nbt_name_query, name)
+class nbt_name_query(object):
+ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
- __swig_getmethods__["data_out"] = _libcli_nbt.nbt_name_query_data_out_get
- if _newclass:data_out = _swig_property(_libcli_nbt.nbt_name_query_data_out_get)
- __swig_getmethods__["data_in"] = _libcli_nbt.nbt_name_query_data_in_get
- if _newclass:data_in = _swig_property(_libcli_nbt.nbt_name_query_data_in_get)
+ data_out = _swig_property(_libcli_nbt.nbt_name_query_data_out_get)
+ data_in = _swig_property(_libcli_nbt.nbt_name_query_data_in_get)
def __init__(self, *args, **kwargs):
- this = _libcli_nbt.new_nbt_name_query(*args, **kwargs)
- try: self.this.append(this)
- except: self.this = this
+ _libcli_nbt.nbt_name_query_swiginit(self,_libcli_nbt.new_nbt_name_query(*args, **kwargs))
__swig_destroy__ = _libcli_nbt.delete_nbt_name_query
- __del__ = lambda self : None;
nbt_name_query_swigregister = _libcli_nbt.nbt_name_query_swigregister
nbt_name_query_swigregister(nbt_name_query)
-class nbt_name_query_out(_object):
- __swig_setmethods__ = {}
- __setattr__ = lambda self, name, value: _swig_setattr(self, nbt_name_query_out, name, value)
- __swig_getmethods__ = {}
- __getattr__ = lambda self, name: _swig_getattr(self, nbt_name_query_out, name)
+class nbt_name_query_out(object):
+ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
- __swig_setmethods__["reply_from"] = _libcli_nbt.nbt_name_query_out_reply_from_set
- __swig_getmethods__["reply_from"] = _libcli_nbt.nbt_name_query_out_reply_from_get
- if _newclass:reply_from = _swig_property(_libcli_nbt.nbt_name_query_out_reply_from_get, _libcli_nbt.nbt_name_query_out_reply_from_set)
- __swig_setmethods__["name"] = _libcli_nbt.nbt_name_query_out_name_set
- __swig_getmethods__["name"] = _libcli_nbt.nbt_name_query_out_name_get
- if _newclass:name = _swig_property(_libcli_nbt.nbt_name_query_out_name_get, _libcli_nbt.nbt_name_query_out_name_set)
- __swig_setmethods__["num_addrs"] = _libcli_nbt.nbt_name_query_out_num_addrs_set
- __swig_getmethods__["num_addrs"] = _libcli_nbt.nbt_name_query_out_num_addrs_get
- if _newclass:num_addrs = _swig_property(_libcli_nbt.nbt_name_query_out_num_addrs_get, _libcli_nbt.nbt_name_query_out_num_addrs_set)
- __swig_setmethods__["reply_addrs"] = _libcli_nbt.nbt_name_query_out_reply_addrs_set
- __swig_getmethods__["reply_addrs"] = _libcli_nbt.nbt_name_query_out_reply_addrs_get
- if _newclass:reply_addrs = _swig_property(_libcli_nbt.nbt_name_query_out_reply_addrs_get, _libcli_nbt.nbt_name_query_out_reply_addrs_set)
+ reply_from = _swig_property(_libcli_nbt.nbt_name_query_out_reply_from_get, _libcli_nbt.nbt_name_query_out_reply_from_set)
+ name = _swig_property(_libcli_nbt.nbt_name_query_out_name_get, _libcli_nbt.nbt_name_query_out_name_set)
+ num_addrs = _swig_property(_libcli_nbt.nbt_name_query_out_num_addrs_get, _libcli_nbt.nbt_name_query_out_num_addrs_set)
+ reply_addrs = _swig_property(_libcli_nbt.nbt_name_query_out_reply_addrs_get, _libcli_nbt.nbt_name_query_out_reply_addrs_set)
def __init__(self, *args, **kwargs):
- this = _libcli_nbt.new_nbt_name_query_out(*args, **kwargs)
- try: self.this.append(this)
- except: self.this = this
+ _libcli_nbt.nbt_name_query_out_swiginit(self,_libcli_nbt.new_nbt_name_query_out(*args, **kwargs))
__swig_destroy__ = _libcli_nbt.delete_nbt_name_query_out
- __del__ = lambda self : None;
nbt_name_query_out_swigregister = _libcli_nbt.nbt_name_query_out_swigregister
nbt_name_query_out_swigregister(nbt_name_query_out)
-class nbt_name_query_in(_object):
- __swig_setmethods__ = {}
- __setattr__ = lambda self, name, value: _swig_setattr(self, nbt_name_query_in, name, value)
- __swig_getmethods__ = {}
- __getattr__ = lambda self, name: _swig_getattr(self, nbt_name_query_in, name)
+class nbt_name_query_in(object):
+ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
- __swig_setmethods__["name"] = _libcli_nbt.nbt_name_query_in_name_set
- __swig_getmethods__["name"] = _libcli_nbt.nbt_name_query_in_name_get
- if _newclass:name = _swig_property(_libcli_nbt.nbt_name_query_in_name_get, _libcli_nbt.nbt_name_query_in_name_set)
- __swig_setmethods__["dest_addr"] = _libcli_nbt.nbt_name_query_in_dest_addr_set
- __swig_getmethods__["dest_addr"] = _libcli_nbt.nbt_name_query_in_dest_addr_get
- if _newclass:dest_addr = _swig_property(_libcli_nbt.nbt_name_query_in_dest_addr_get, _libcli_nbt.nbt_name_query_in_dest_addr_set)
- __swig_setmethods__["broadcast"] = _libcli_nbt.nbt_name_query_in_broadcast_set
- __swig_getmethods__["broadcast"] = _libcli_nbt.nbt_name_query_in_broadcast_get
- if _newclass:broadcast = _swig_property(_libcli_nbt.nbt_name_query_in_broadcast_get, _libcli_nbt.nbt_name_query_in_broadcast_set)
- __swig_setmethods__["wins_lookup"] = _libcli_nbt.nbt_name_query_in_wins_lookup_set
- __swig_getmethods__["wins_lookup"] = _libcli_nbt.nbt_name_query_in_wins_lookup_get
- if _newclass:wins_lookup = _swig_property(_libcli_nbt.nbt_name_query_in_wins_lookup_get, _libcli_nbt.nbt_name_query_in_wins_lookup_set)
- __swig_setmethods__["timeout"] = _libcli_nbt.nbt_name_query_in_timeout_set
- __swig_getmethods__["timeout"] = _libcli_nbt.nbt_name_query_in_timeout_get
- if _newclass:timeout = _swig_property(_libcli_nbt.nbt_name_query_in_timeout_get, _libcli_nbt.nbt_name_query_in_timeout_set)
- __swig_setmethods__["retries"] = _libcli_nbt.nbt_name_query_in_retries_set
- __swig_getmethods__["retries"] = _libcli_nbt.nbt_name_query_in_retries_get
- if _newclass:retries = _swig_property(_libcli_nbt.nbt_name_query_in_retries_get, _libcli_nbt.nbt_name_query_in_retries_set)
+ name = _swig_property(_libcli_nbt.nbt_name_query_in_name_get, _libcli_nbt.nbt_name_query_in_name_set)
+ dest_addr = _swig_property(_libcli_nbt.nbt_name_query_in_dest_addr_get, _libcli_nbt.nbt_name_query_in_dest_addr_set)
+ broadcast = _swig_property(_libcli_nbt.nbt_name_query_in_broadcast_get, _libcli_nbt.nbt_name_query_in_broadcast_set)
+ wins_lookup = _swig_property(_libcli_nbt.nbt_name_query_in_wins_lookup_get, _libcli_nbt.nbt_name_query_in_wins_lookup_set)
+ timeout = _swig_property(_libcli_nbt.nbt_name_query_in_timeout_get, _libcli_nbt.nbt_name_query_in_timeout_set)
+ retries = _swig_property(_libcli_nbt.nbt_name_query_in_retries_get, _libcli_nbt.nbt_name_query_in_retries_set)
def __init__(self, *args, **kwargs):
- this = _libcli_nbt.new_nbt_name_query_in(*args, **kwargs)
- try: self.this.append(this)
- except: self.this = this
+ _libcli_nbt.nbt_name_query_in_swiginit(self,_libcli_nbt.new_nbt_name_query_in(*args, **kwargs))
__swig_destroy__ = _libcli_nbt.delete_nbt_name_query_in
- __del__ = lambda self : None;
nbt_name_query_in_swigregister = _libcli_nbt.nbt_name_query_in_swigregister
nbt_name_query_in_swigregister(nbt_name_query_in)
diff --git a/source4/libcli/swig/libcli_nbt_wrap.c b/source4/libcli/swig/libcli_nbt_wrap.c
index 149e63884a..6c1b501359 100644
--- a/source4/libcli/swig/libcli_nbt_wrap.c
+++ b/source4/libcli/swig/libcli_nbt_wrap.c
@@ -9,7 +9,7 @@
* ----------------------------------------------------------------------------- */
#define SWIGPYTHON
-#define SWIG_PYTHON_DIRECTOR_NO_VTABLE
+#define SWIG_PYTHON_NO_BUILD_NONE
/* -----------------------------------------------------------------------------
* This section contains generic SWIG labels for method/variable
* declarations/attributes, and other compiler dependent labels.
@@ -2485,6 +2485,19 @@ static swig_module_info swig_module = {swig_types, 17, 0, 0, 0, 0};
# error "This python version requires swig to be run with the '-classic' option"
# endif
#endif
+#if (PY_VERSION_HEX <= 0x02020000)
+# error "This python version requires swig to be run with the '-nomodern' option"
+#endif
+#if (PY_VERSION_HEX <= 0x02020000)
+# error "This python version requires swig to be run with the '-nomodernargs' option"
+#endif
+#ifndef METH_O
+# error "This python version requires swig to be run with the '-nofastunpack' option"
+#endif
+#ifdef SWIG_TypeQuery
+# undef SWIG_TypeQuery
+#endif
+#define SWIG_TypeQuery SWIG_Python_TypeQuery
/*-----------------------------------------------
@(target):= _libcli_nbt.so
@@ -2506,6 +2519,7 @@ static swig_module_info swig_module = {swig_types, 17, 0, 0, 0, 0};
#include "lib/talloc/talloc.h"
#include "libcli/nbt/libnbt.h"
#include "param/param.h"
+#include "lib/events/events.h"
/* Undo strcpy safety macro as it's used by swig )-: */
@@ -2912,12 +2926,8 @@ SWIGINTERN PyObject *_wrap_nbt_name_socket_init(PyObject *SWIGUNUSEDPARM(self),
(char *) "event_ctx", NULL
};
- {
- arg2 = event_context_init(NULL);
- }
- {
- arg1 = NULL;
- }
+ arg2 = event_context_init(NULL);
+ arg1 = NULL;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:nbt_name_socket_init",kwnames,&obj0)) SWIG_fail;
if (obj0) {
res2 = SWIG_ConvertPtr(obj0, &argp2,SWIGTYPE_p_event_context, 0 | 0 );
@@ -2943,16 +2953,15 @@ SWIGINTERN PyObject *_wrap_nbt_name_name_set(PyObject *SWIGUNUSEDPARM(self), PyO
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
+ PyObject *swig_obj[2] ;
- if (!PyArg_ParseTuple(args,(char *)"OO:nbt_name_name_set",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name, 0 | 0 );
+ if (!SWIG_Python_UnpackTuple(args,"nbt_name_name_set",2,2,swig_obj)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_name_set" "', argument " "1"" of type '" "struct nbt_name *""'");
}
arg1 = (struct nbt_name *)(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "nbt_name_name_set" "', argument " "2"" of type '" "char const *""'");
}
@@ -2978,10 +2987,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_name_get(PyObject *SWIGUNUSEDPARM(self), PyO
char *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
- PyObject * obj0 = 0 ;
+ PyObject *swig_obj[1] ;
- if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_name_get",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name, 0 | 0 );
+ if (!args) SWIG_fail;
+ swig_obj[0] = args;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_name_get" "', argument " "1"" of type '" "struct nbt_name *""'");
}
@@ -3003,16 +3013,15 @@ SWIGINTERN PyObject *_wrap_nbt_name_scope_set(PyObject *SWIGUNUSEDPARM(self), Py
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
+ PyObject *swig_obj[2] ;
- if (!PyArg_ParseTuple(args,(char *)"OO:nbt_name_scope_set",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name, 0 | 0 );
+ if (!SWIG_Python_UnpackTuple(args,"nbt_name_scope_set",2,2,swig_obj)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_scope_set" "', argument " "1"" of type '" "struct nbt_name *""'");
}
arg1 = (struct nbt_name *)(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "nbt_name_scope_set" "', argument " "2"" of type '" "char const *""'");
}
@@ -3038,10 +3047,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_scope_get(PyObject *SWIGUNUSEDPARM(self), Py
char *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
- PyObject * obj0 = 0 ;
+ PyObject *swig_obj[1] ;
- if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_scope_get",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name, 0 | 0 );
+ if (!args) SWIG_fail;
+ swig_obj[0] = args;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_scope_get" "', argument " "1"" of type '" "struct nbt_name *""'");
}
@@ -3062,16 +3072,15 @@ SWIGINTERN PyObject *_wrap_nbt_name_type_set(PyObject *SWIGUNUSEDPARM(self), PyO
int res1 = 0 ;
int val2 ;
int ecode2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
+ PyObject *swig_obj[2] ;
- if (!PyArg_ParseTuple(args,(char *)"OO:nbt_name_type_set",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name, 0 | 0 );
+ if (!SWIG_Python_UnpackTuple(args,"nbt_name_type_set",2,2,swig_obj)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_type_set" "', argument " "1"" of type '" "struct nbt_name *""'");
}
arg1 = (struct nbt_name *)(argp1);
- ecode2 = SWIG_AsVal_int(obj1, &val2);
+ ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "nbt_name_type_set" "', argument " "2"" of type '" "enum nbt_name_type""'");
}
@@ -3091,10 +3100,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_type_get(PyObject *SWIGUNUSEDPARM(self), PyO
enum nbt_name_type result;
void *argp1 = 0 ;
int res1 = 0 ;
- PyObject * obj0 = 0 ;
+ PyObject *swig_obj[1] ;
- if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_type_get",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name, 0 | 0 );
+ if (!args) SWIG_fail;
+ swig_obj[0] = args;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_type_get" "', argument " "1"" of type '" "struct nbt_name *""'");
}
@@ -3111,7 +3121,7 @@ SWIGINTERN PyObject *_wrap_new_nbt_name(PyObject *SWIGUNUSEDPARM(self), PyObject
PyObject *resultobj = 0;
struct nbt_name *result = 0 ;
- if (!PyArg_ParseTuple(args,(char *)":new_nbt_name")) SWIG_fail;
+ if (!SWIG_Python_UnpackTuple(args,"new_nbt_name",0,0,0)) SWIG_fail;
result = (struct nbt_name *)(struct nbt_name *) calloc(1, sizeof(struct nbt_name));
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nbt_name, SWIG_POINTER_NEW | 0 );
return resultobj;
@@ -3125,10 +3135,11 @@ SWIGINTERN PyObject *_wrap_delete_nbt_name(PyObject *SWIGUNUSEDPARM(self), PyObj
struct nbt_name *arg1 = (struct nbt_name *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
- PyObject * obj0 = 0 ;
+ PyObject *swig_obj[1] ;
- if (!PyArg_ParseTuple(args,(char *)"O:delete_nbt_name",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name, SWIG_POINTER_DISOWN | 0 );
+ if (!args) SWIG_fail;
+ swig_obj[0] = args;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name, SWIG_POINTER_DISOWN | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_nbt_name" "', argument " "1"" of type '" "struct nbt_name *""'");
}
@@ -3144,21 +3155,26 @@ fail:
SWIGINTERN PyObject *nbt_name_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *obj;
- if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
+ if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
SWIG_TypeNewClientData(SWIGTYPE_p_nbt_name, SWIG_NewClientData(obj));
return SWIG_Py_Void();
}
+SWIGINTERN PyObject *nbt_name_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ return SWIG_Python_InitShadowInstance(args);
+}
+
SWIGINTERN PyObject *_wrap_nbt_name_query_data_out_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
struct nbt_name_query *arg1 = (struct nbt_name_query *) 0 ;
nbt_name_query_out *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
- PyObject * obj0 = 0 ;
+ PyObject *swig_obj[1] ;
- if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_query_data_out_get",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query, 0 | 0 );
+ if (!args) SWIG_fail;
+ swig_obj[0] = args;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_data_out_get" "', argument " "1"" of type '" "struct nbt_name_query *""'");
}
@@ -3177,10 +3193,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_data_in_get(PyObject *SWIGUNUSEDPARM(s
nbt_name_query_in *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
- PyObject * obj0 = 0 ;
+ PyObject *swig_obj[1] ;
- if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_query_data_in_get",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query, 0 | 0 );
+ if (!args) SWIG_fail;
+ swig_obj[0] = args;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_data_in_get" "', argument " "1"" of type '" "struct nbt_name_query *""'");
}
@@ -3197,7 +3214,7 @@ SWIGINTERN PyObject *_wrap_new_nbt_name_query(PyObject *SWIGUNUSEDPARM(self), Py
PyObject *resultobj = 0;
struct nbt_name_query *result = 0 ;
- if (!PyArg_ParseTuple(args,(char *)":new_nbt_name_query")) SWIG_fail;
+ if (!SWIG_Python_UnpackTuple(args,"new_nbt_name_query",0,0,0)) SWIG_fail;
result = (struct nbt_name_query *)(struct nbt_name_query *) calloc(1, sizeof(struct nbt_name_query));
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nbt_name_query, SWIG_POINTER_NEW | 0 );
return resultobj;
@@ -3211,10 +3228,11 @@ SWIGINTERN PyObject *_wrap_delete_nbt_name_query(PyObject *SWIGUNUSEDPARM(self),
struct nbt_name_query *arg1 = (struct nbt_name_query *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
- PyObject * obj0 = 0 ;
+ PyObject *swig_obj[1] ;
- if (!PyArg_ParseTuple(args,(char *)"O:delete_nbt_name_query",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query, SWIG_POINTER_DISOWN | 0 );
+ if (!args) SWIG_fail;
+ swig_obj[0] = args;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query, SWIG_POINTER_DISOWN | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_nbt_name_query" "', argument " "1"" of type '" "struct nbt_name_query *""'");
}
@@ -3230,11 +3248,15 @@ fail:
SWIGINTERN PyObject *nbt_name_query_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *obj;
- if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
+ if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
SWIG_TypeNewClientData(SWIGTYPE_p_nbt_name_query, SWIG_NewClientData(obj));
return SWIG_Py_Void();
}
+SWIGINTERN PyObject *nbt_name_query_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ return SWIG_Python_InitShadowInstance(args);
+}
+
SWIGINTERN PyObject *_wrap_nbt_name_query_out_reply_from_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
nbt_name_query_out *arg1 = (nbt_name_query_out *) 0 ;
@@ -3244,16 +3266,15 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_out_reply_from_set(PyObject *SWIGUNUSE
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
+ PyObject *swig_obj[2] ;
- if (!PyArg_ParseTuple(args,(char *)"OO:nbt_name_query_out_reply_from_set",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 );
+ if (!SWIG_Python_UnpackTuple(args,"nbt_name_query_out_reply_from_set",2,2,swig_obj)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_out_reply_from_set" "', argument " "1"" of type '" "nbt_name_query_out *""'");
}
arg1 = (nbt_name_query_out *)(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "nbt_name_query_out_reply_from_set" "', argument " "2"" of type '" "char const *""'");
}
@@ -3279,10 +3300,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_out_reply_from_get(PyObject *SWIGUNUSE
char *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
- PyObject * obj0 = 0 ;
+ PyObject *swig_obj[1] ;
- if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_query_out_reply_from_get",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 );
+ if (!args) SWIG_fail;
+ swig_obj[0] = args;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_out_reply_from_get" "', argument " "1"" of type '" "nbt_name_query_out *""'");
}
@@ -3303,16 +3325,15 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_out_name_set(PyObject *SWIGUNUSEDPARM(
int res1 = 0 ;
void *argp2 = 0 ;
int res2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
+ PyObject *swig_obj[2] ;
- if (!PyArg_ParseTuple(args,(char *)"OO:nbt_name_query_out_name_set",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 );
+ if (!SWIG_Python_UnpackTuple(args,"nbt_name_query_out_name_set",2,2,swig_obj)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_out_name_set" "', argument " "1"" of type '" "nbt_name_query_out *""'");
}
arg1 = (nbt_name_query_out *)(argp1);
- res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_nbt_name, 0 | 0 );
+ res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_nbt_name, 0 | 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "nbt_name_query_out_name_set" "', argument " "2"" of type '" "struct nbt_name *""'");
}
@@ -3332,10 +3353,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_out_name_get(PyObject *SWIGUNUSEDPARM(
struct nbt_name *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
- PyObject * obj0 = 0 ;
+ PyObject *swig_obj[1] ;
- if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_query_out_name_get",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 );
+ if (!args) SWIG_fail;
+ swig_obj[0] = args;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_out_name_get" "', argument " "1"" of type '" "nbt_name_query_out *""'");
}
@@ -3356,16 +3378,15 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_out_num_addrs_set(PyObject *SWIGUNUSED
int res1 = 0 ;
short val2 ;
int ecode2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
+ PyObject *swig_obj[2] ;
- if (!PyArg_ParseTuple(args,(char *)"OO:nbt_name_query_out_num_addrs_set",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 );
+ if (!SWIG_Python_UnpackTuple(args,"nbt_name_query_out_num_addrs_set",2,2,swig_obj)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_out_num_addrs_set" "', argument " "1"" of type '" "nbt_name_query_out *""'");
}
arg1 = (nbt_name_query_out *)(argp1);
- ecode2 = SWIG_AsVal_short(obj1, &val2);
+ ecode2 = SWIG_AsVal_short(swig_obj[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "nbt_name_query_out_num_addrs_set" "', argument " "2"" of type '" "int16_t""'");
}
@@ -3385,10 +3406,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_out_num_addrs_get(PyObject *SWIGUNUSED
int16_t result;
void *argp1 = 0 ;
int res1 = 0 ;
- PyObject * obj0 = 0 ;
+ PyObject *swig_obj[1] ;
- if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_query_out_num_addrs_get",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 );
+ if (!args) SWIG_fail;
+ swig_obj[0] = args;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_out_num_addrs_get" "', argument " "1"" of type '" "nbt_name_query_out *""'");
}
@@ -3409,16 +3431,15 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_out_reply_addrs_set(PyObject *SWIGUNUS
int res1 = 0 ;
void *argp2 = 0 ;
int res2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
+ PyObject *swig_obj[2] ;
- if (!PyArg_ParseTuple(args,(char *)"OO:nbt_name_query_out_reply_addrs_set",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 );
+ if (!SWIG_Python_UnpackTuple(args,"nbt_name_query_out_reply_addrs_set",2,2,swig_obj)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_out_reply_addrs_set" "', argument " "1"" of type '" "nbt_name_query_out *""'");
}
arg1 = (nbt_name_query_out *)(argp1);
- res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_p_char, 0 | 0 );
+ res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_p_char, 0 | 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "nbt_name_query_out_reply_addrs_set" "', argument " "2"" of type '" "char const **""'");
}
@@ -3438,10 +3459,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_out_reply_addrs_get(PyObject *SWIGUNUS
char **result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
- PyObject * obj0 = 0 ;
+ PyObject *swig_obj[1] ;
- if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_query_out_reply_addrs_get",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 );
+ if (!args) SWIG_fail;
+ swig_obj[0] = args;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_out_reply_addrs_get" "', argument " "1"" of type '" "nbt_name_query_out *""'");
}
@@ -3458,7 +3480,7 @@ SWIGINTERN PyObject *_wrap_new_nbt_name_query_out(PyObject *SWIGUNUSEDPARM(self)
PyObject *resultobj = 0;
nbt_name_query_out *result = 0 ;
- if (!PyArg_ParseTuple(args,(char *)":new_nbt_name_query_out")) SWIG_fail;
+ if (!SWIG_Python_UnpackTuple(args,"new_nbt_name_query_out",0,0,0)) SWIG_fail;
result = (nbt_name_query_out *)(nbt_name_query_out *) calloc(1, sizeof(nbt_name_query_out));
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nbt_name_query_out, SWIG_POINTER_NEW | 0 );
return resultobj;
@@ -3472,10 +3494,11 @@ SWIGINTERN PyObject *_wrap_delete_nbt_name_query_out(PyObject *SWIGUNUSEDPARM(se
nbt_name_query_out *arg1 = (nbt_name_query_out *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
- PyObject * obj0 = 0 ;
+ PyObject *swig_obj[1] ;
- if (!PyArg_ParseTuple(args,(char *)"O:delete_nbt_name_query_out",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_out, SWIG_POINTER_DISOWN | 0 );
+ if (!args) SWIG_fail;
+ swig_obj[0] = args;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_out, SWIG_POINTER_DISOWN | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_nbt_name_query_out" "', argument " "1"" of type '" "nbt_name_query_out *""'");
}
@@ -3491,11 +3514,15 @@ fail:
SWIGINTERN PyObject *nbt_name_query_out_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *obj;
- if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
+ if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
SWIG_TypeNewClientData(SWIGTYPE_p_nbt_name_query_out, SWIG_NewClientData(obj));
return SWIG_Py_Void();
}
+SWIGINTERN PyObject *nbt_name_query_out_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ return SWIG_Python_InitShadowInstance(args);
+}
+
SWIGINTERN PyObject *_wrap_nbt_name_query_in_name_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
nbt_name_query_in *arg1 = (nbt_name_query_in *) 0 ;
@@ -3504,16 +3531,15 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_in_name_set(PyObject *SWIGUNUSEDPARM(s
int res1 = 0 ;
void *argp2 = 0 ;
int res2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
+ PyObject *swig_obj[2] ;
- if (!PyArg_ParseTuple(args,(char *)"OO:nbt_name_query_in_name_set",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 );
+ if (!SWIG_Python_UnpackTuple(args,"nbt_name_query_in_name_set",2,2,swig_obj)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_in_name_set" "', argument " "1"" of type '" "nbt_name_query_in *""'");
}
arg1 = (nbt_name_query_in *)(argp1);
- res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_nbt_name, 0 | 0 );
+ res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_nbt_name, 0 | 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "nbt_name_query_in_name_set" "', argument " "2"" of type '" "struct nbt_name *""'");
}
@@ -3533,10 +3559,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_in_name_get(PyObject *SWIGUNUSEDPARM(s
struct nbt_name *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
- PyObject * obj0 = 0 ;
+ PyObject *swig_obj[1] ;
- if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_query_in_name_get",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 );
+ if (!args) SWIG_fail;
+ swig_obj[0] = args;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_in_name_get" "', argument " "1"" of type '" "nbt_name_query_in *""'");
}
@@ -3558,16 +3585,15 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_in_dest_addr_set(PyObject *SWIGUNUSEDP
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
+ PyObject *swig_obj[2] ;
- if (!PyArg_ParseTuple(args,(char *)"OO:nbt_name_query_in_dest_addr_set",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 );
+ if (!SWIG_Python_UnpackTuple(args,"nbt_name_query_in_dest_addr_set",2,2,swig_obj)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_in_dest_addr_set" "', argument " "1"" of type '" "nbt_name_query_in *""'");
}
arg1 = (nbt_name_query_in *)(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "nbt_name_query_in_dest_addr_set" "', argument " "2"" of type '" "char const *""'");
}
@@ -3593,10 +3619,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_in_dest_addr_get(PyObject *SWIGUNUSEDP
char *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
- PyObject * obj0 = 0 ;
+ PyObject *swig_obj[1] ;
- if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_query_in_dest_addr_get",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 );
+ if (!args) SWIG_fail;
+ swig_obj[0] = args;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_in_dest_addr_get" "', argument " "1"" of type '" "nbt_name_query_in *""'");
}
@@ -3617,16 +3644,15 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_in_broadcast_set(PyObject *SWIGUNUSEDP
int res1 = 0 ;
bool val2 ;
int ecode2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
+ PyObject *swig_obj[2] ;
- if (!PyArg_ParseTuple(args,(char *)"OO:nbt_name_query_in_broadcast_set",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 );
+ if (!SWIG_Python_UnpackTuple(args,"nbt_name_query_in_broadcast_set",2,2,swig_obj)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_in_broadcast_set" "', argument " "1"" of type '" "nbt_name_query_in *""'");
}
arg1 = (nbt_name_query_in *)(argp1);
- ecode2 = SWIG_AsVal_bool(obj1, &val2);
+ ecode2 = SWIG_AsVal_bool(swig_obj[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "nbt_name_query_in_broadcast_set" "', argument " "2"" of type '" "bool""'");
}
@@ -3646,10 +3672,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_in_broadcast_get(PyObject *SWIGUNUSEDP
bool result;
void *argp1 = 0 ;
int res1 = 0 ;
- PyObject * obj0 = 0 ;
+ PyObject *swig_obj[1] ;
- if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_query_in_broadcast_get",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 );
+ if (!args) SWIG_fail;
+ swig_obj[0] = args;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_in_broadcast_get" "', argument " "1"" of type '" "nbt_name_query_in *""'");
}
@@ -3670,16 +3697,15 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_in_wins_lookup_set(PyObject *SWIGUNUSE
int res1 = 0 ;
bool val2 ;
int ecode2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
+ PyObject *swig_obj[2] ;
- if (!PyArg_ParseTuple(args,(char *)"OO:nbt_name_query_in_wins_lookup_set",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 );
+ if (!SWIG_Python_UnpackTuple(args,"nbt_name_query_in_wins_lookup_set",2,2,swig_obj)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_in_wins_lookup_set" "', argument " "1"" of type '" "nbt_name_query_in *""'");
}
arg1 = (nbt_name_query_in *)(argp1);
- ecode2 = SWIG_AsVal_bool(obj1, &val2);
+ ecode2 = SWIG_AsVal_bool(swig_obj[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "nbt_name_query_in_wins_lookup_set" "', argument " "2"" of type '" "bool""'");
}
@@ -3699,10 +3725,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_in_wins_lookup_get(PyObject *SWIGUNUSE
bool result;
void *argp1 = 0 ;
int res1 = 0 ;
- PyObject * obj0 = 0 ;
+ PyObject *swig_obj[1] ;
- if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_query_in_wins_lookup_get",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 );
+ if (!args) SWIG_fail;
+ swig_obj[0] = args;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_in_wins_lookup_get" "', argument " "1"" of type '" "nbt_name_query_in *""'");
}
@@ -3723,16 +3750,15 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_in_timeout_set(PyObject *SWIGUNUSEDPAR
int res1 = 0 ;
int val2 ;
int ecode2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
+ PyObject *swig_obj[2] ;
- if (!PyArg_ParseTuple(args,(char *)"OO:nbt_name_query_in_timeout_set",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 );
+ if (!SWIG_Python_UnpackTuple(args,"nbt_name_query_in_timeout_set",2,2,swig_obj)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_in_timeout_set" "', argument " "1"" of type '" "nbt_name_query_in *""'");
}
arg1 = (nbt_name_query_in *)(argp1);
- ecode2 = SWIG_AsVal_int(obj1, &val2);
+ ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "nbt_name_query_in_timeout_set" "', argument " "2"" of type '" "int""'");
}
@@ -3752,10 +3778,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_in_timeout_get(PyObject *SWIGUNUSEDPAR
int result;
void *argp1 = 0 ;
int res1 = 0 ;
- PyObject * obj0 = 0 ;
+ PyObject *swig_obj[1] ;
- if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_query_in_timeout_get",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 );
+ if (!args) SWIG_fail;
+ swig_obj[0] = args;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_in_timeout_get" "', argument " "1"" of type '" "nbt_name_query_in *""'");
}
@@ -3776,16 +3803,15 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_in_retries_set(PyObject *SWIGUNUSEDPAR
int res1 = 0 ;
int val2 ;
int ecode2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
+ PyObject *swig_obj[2] ;
- if (!PyArg_ParseTuple(args,(char *)"OO:nbt_name_query_in_retries_set",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 );
+ if (!SWIG_Python_UnpackTuple(args,"nbt_name_query_in_retries_set",2,2,swig_obj)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_in_retries_set" "', argument " "1"" of type '" "nbt_name_query_in *""'");
}
arg1 = (nbt_name_query_in *)(argp1);
- ecode2 = SWIG_AsVal_int(obj1, &val2);
+ ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "nbt_name_query_in_retries_set" "', argument " "2"" of type '" "int""'");
}
@@ -3805,10 +3831,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_in_retries_get(PyObject *SWIGUNUSEDPAR
int result;
void *argp1 = 0 ;
int res1 = 0 ;
- PyObject * obj0 = 0 ;
+ PyObject *swig_obj[1] ;
- if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_query_in_retries_get",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 );
+ if (!args) SWIG_fail;
+ swig_obj[0] = args;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_in_retries_get" "', argument " "1"" of type '" "nbt_name_query_in *""'");
}
@@ -3825,7 +3852,7 @@ SWIGINTERN PyObject *_wrap_new_nbt_name_query_in(PyObject *SWIGUNUSEDPARM(self),
PyObject *resultobj = 0;
nbt_name_query_in *result = 0 ;
- if (!PyArg_ParseTuple(args,(char *)":new_nbt_name_query_in")) SWIG_fail;
+ if (!SWIG_Python_UnpackTuple(args,"new_nbt_name_query_in",0,0,0)) SWIG_fail;
result = (nbt_name_query_in *)(nbt_name_query_in *) calloc(1, sizeof(nbt_name_query_in));
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nbt_name_query_in, SWIG_POINTER_NEW | 0 );
return resultobj;
@@ -3839,10 +3866,11 @@ SWIGINTERN PyObject *_wrap_delete_nbt_name_query_in(PyObject *SWIGUNUSEDPARM(sel
nbt_name_query_in *arg1 = (nbt_name_query_in *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
- PyObject * obj0 = 0 ;
+ PyObject *swig_obj[1] ;
- if (!PyArg_ParseTuple(args,(char *)"O:delete_nbt_name_query_in",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_in, SWIG_POINTER_DISOWN | 0 );
+ if (!args) SWIG_fail;
+ swig_obj[0] = args;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_in, SWIG_POINTER_DISOWN | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_nbt_name_query_in" "', argument " "1"" of type '" "nbt_name_query_in *""'");
}
@@ -3858,11 +3886,15 @@ fail:
SWIGINTERN PyObject *nbt_name_query_in_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *obj;
- if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
+ if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
SWIG_TypeNewClientData(SWIGTYPE_p_nbt_name_query_in, SWIG_NewClientData(obj));
return SWIG_Py_Void();
}
+SWIGINTERN PyObject *nbt_name_query_in_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ return SWIG_Python_InitShadowInstance(args);
+}
+
SWIGINTERN PyObject *_wrap_new_char_ptr_array(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
PyObject *resultobj = 0;
size_t arg1 ;
@@ -4007,9 +4039,7 @@ SWIGINTERN PyObject *_wrap_do_nbt_name_query(PyObject *SWIGUNUSEDPARM(self), PyO
(char *) "nbtsock",(char *) "io", NULL
};
- {
- arg2 = NULL;
- }
+ arg2 = NULL;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:do_nbt_name_query",kwnames,&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_socket, 0 | 0 );
if (!SWIG_IsOK(res1)) {
@@ -4022,13 +4052,12 @@ SWIGINTERN PyObject *_wrap_do_nbt_name_query(PyObject *SWIGUNUSEDPARM(self), PyO
}
arg3 = (struct nbt_name_query *)(argp3);
result = do_nbt_name_query(arg1,arg2,arg3);
- {
- if (NT_STATUS_IS_ERR(result)) {
- PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, nt_errstr(result));
- PyErr_SetObject(PyExc_RuntimeError, obj);
- } else if (resultobj == NULL) {
- resultobj = Py_None;
- }
+ if (NT_STATUS_IS_ERR(result)) {
+ PyObject *obj = Py_BuildValue((char *)"(i,s)", (&result)->v, nt_errstr(result));
+ PyErr_SetObject(PyExc_RuntimeError, obj);
+ SWIG_fail;
+ } else if (resultobj == NULL) {
+ resultobj = Py_None;
}
return resultobj;
fail:
@@ -4039,45 +4068,49 @@ fail:
static PyMethodDef SwigMethods[] = {
{ (char *)"nbt_name_socket_init", (PyCFunction) _wrap_nbt_name_socket_init, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"nbt_name_name_set", _wrap_nbt_name_name_set, METH_VARARGS, NULL},
- { (char *)"nbt_name_name_get", _wrap_nbt_name_name_get, METH_VARARGS, NULL},
+ { (char *)"nbt_name_name_get", (PyCFunction)_wrap_nbt_name_name_get, METH_O, NULL},
{ (char *)"nbt_name_scope_set", _wrap_nbt_name_scope_set, METH_VARARGS, NULL},
- { (char *)"nbt_name_scope_get", _wrap_nbt_name_scope_get, METH_VARARGS, NULL},
+ { (char *)"nbt_name_scope_get", (PyCFunction)_wrap_nbt_name_scope_get, METH_O, NULL},
{ (char *)"nbt_name_type_set", _wrap_nbt_name_type_set, METH_VARARGS, NULL},
- { (char *)"nbt_name_type_get", _wrap_nbt_name_type_get, METH_VARARGS, NULL},
- { (char *)"new_nbt_name", _wrap_new_nbt_name, METH_VARARGS, NULL},
- { (char *)"delete_nbt_name", _wrap_delete_nbt_name, METH_VARARGS, NULL},
+ { (char *)"nbt_name_type_get", (PyCFunction)_wrap_nbt_name_type_get, METH_O, NULL},
+ { (char *)"new_nbt_name", (PyCFunction)_wrap_new_nbt_name, METH_NOARGS, NULL},
+ { (char *)"delete_nbt_name", (PyCFunction)_wrap_delete_nbt_name, METH_O, NULL},
{ (char *)"nbt_name_swigregister", nbt_name_swigregister, METH_VARARGS, NULL},
- { (char *)"nbt_name_query_data_out_get", _wrap_nbt_name_query_data_out_get, METH_VARARGS, NULL},
- { (char *)"nbt_name_query_data_in_get", _wrap_nbt_name_query_data_in_get, METH_VARARGS, NULL},
- { (char *)"new_nbt_name_query", _wrap_new_nbt_name_query, METH_VARARGS, NULL},
- { (char *)"delete_nbt_name_query", _wrap_delete_nbt_name_query, METH_VARARGS, NULL},
+ { (char *)"nbt_name_swiginit", nbt_name_swiginit, METH_VARARGS, NULL},
+ { (char *)"nbt_name_query_data_out_get", (PyCFunction)_wrap_nbt_name_query_data_out_get, METH_O, NULL},
+ { (char *)"nbt_name_query_data_in_get", (PyCFunction)_wrap_nbt_name_query_data_in_get, METH_O, NULL},
+ { (char *)"new_nbt_name_query", (PyCFunction)_wrap_new_nbt_name_query, METH_NOARGS, NULL},
+ { (char *)"delete_nbt_name_query", (PyCFunction)_wrap_delete_nbt_name_query, METH_O, NULL},
{ (char *)"nbt_name_query_swigregister", nbt_name_query_swigregister, METH_VARARGS, NULL},
+ { (char *)"nbt_name_query_swiginit", nbt_name_query_swiginit, METH_VARARGS, NULL},
{ (char *)"nbt_name_query_out_reply_from_set", _wrap_nbt_name_query_out_reply_from_set, METH_VARARGS, NULL},
- { (char *)"nbt_name_query_out_reply_from_get", _wrap_nbt_name_query_out_reply_from_get, METH_VARARGS, NULL},
+ { (char *)"nbt_name_query_out_reply_from_get", (PyCFunction)_wrap_nbt_name_query_out_reply_from_get, METH_O, NULL},
{ (char *)"nbt_name_query_out_name_set", _wrap_nbt_name_query_out_name_set, METH_VARARGS, NULL},
- { (char *)"nbt_name_query_out_name_get", _wrap_nbt_name_query_out_name_get, METH_VARARGS, NULL},
+ { (char *)"nbt_name_query_out_name_get", (PyCFunction)_wrap_nbt_name_query_out_name_get, METH_O, NULL},
{ (char *)"nbt_name_query_out_num_addrs_set", _wrap_nbt_name_query_out_num_addrs_set, METH_VARARGS, NULL},
- { (char *)"nbt_name_query_out_num_addrs_get", _wrap_nbt_name_query_out_num_addrs_get, METH_VARARGS, NULL},
+ { (char *)"nbt_name_query_out_num_addrs_get", (PyCFunction)_wrap_nbt_name_query_out_num_addrs_get, METH_O, NULL},
{ (char *)"nbt_name_query_out_reply_addrs_set", _wrap_nbt_name_query_out_reply_addrs_set, METH_VARARGS, NULL},
- { (char *)"nbt_name_query_out_reply_addrs_get", _wrap_nbt_name_query_out_reply_addrs_get, METH_VARARGS, NULL},
- { (char *)"new_nbt_name_query_out", _wrap_new_nbt_name_query_out, METH_VARARGS, NULL},
- { (char *)"delete_nbt_name_query_out", _wrap_delete_nbt_name_query_out, METH_VARARGS, NULL},
+ { (char *)"nbt_name_query_out_reply_addrs_get", (PyCFunction)_wrap_nbt_name_query_out_reply_addrs_get, METH_O, NULL},
+ { (char *)"new_nbt_name_query_out", (PyCFunction)_wrap_new_nbt_name_query_out, METH_NOARGS, NULL},
+ { (char *)"delete_nbt_name_query_out", (PyCFunction)_wrap_delete_nbt_name_query_out, METH_O, NULL},
{ (char *)"nbt_name_query_out_swigregister", nbt_name_query_out_swigregister, METH_VARARGS, NULL},
+ { (char *)"nbt_name_query_out_swiginit", nbt_name_query_out_swiginit, METH_VARARGS, NULL},
{ (char *)"nbt_name_query_in_name_set", _wrap_nbt_name_query_in_name_set, METH_VARARGS, NULL},
- { (char *)"nbt_name_query_in_name_get", _wrap_nbt_name_query_in_name_get, METH_VARARGS, NULL},
+ { (char *)"nbt_name_query_in_name_get", (PyCFunction)_wrap_nbt_name_query_in_name_get, METH_O, NULL},
{ (char *)"nbt_name_query_in_dest_addr_set", _wrap_nbt_name_query_in_dest_addr_set, METH_VARARGS, NULL},
- { (char *)"nbt_name_query_in_dest_addr_get", _wrap_nbt_name_query_in_dest_addr_get, METH_VARARGS, NULL},
+ { (char *)"nbt_name_query_in_dest_addr_get", (PyCFunction)_wrap_nbt_name_query_in_dest_addr_get, METH_O, NULL},
{ (char *)"nbt_name_query_in_broadcast_set", _wrap_nbt_name_query_in_broadcast_set, METH_VARARGS, NULL},
- { (char *)"nbt_name_query_in_broadcast_get", _wrap_nbt_name_query_in_broadcast_get, METH_VARARGS, NULL},
+ { (char *)"nbt_name_query_in_broadcast_get", (PyCFunction)_wrap_nbt_name_query_in_broadcast_get, METH_O, NULL},
{ (char *)"nbt_name_query_in_wins_lookup_set", _wrap_nbt_name_query_in_wins_lookup_set, METH_VARARGS, NULL},
- { (char *)"nbt_name_query_in_wins_lookup_get", _wrap_nbt_name_query_in_wins_lookup_get, METH_VARARGS, NULL},
+ { (char *)"nbt_name_query_in_wins_lookup_get", (PyCFunction)_wrap_nbt_name_query_in_wins_lookup_get, METH_O, NULL},
{ (char *)"nbt_name_query_in_timeout_set", _wrap_nbt_name_query_in_timeout_set, METH_VARARGS, NULL},
- { (char *)"nbt_name_query_in_timeout_get", _wrap_nbt_name_query_in_timeout_get, METH_VARARGS, NULL},
+ { (char *)"nbt_name_query_in_timeout_get", (PyCFunction)_wrap_nbt_name_query_in_timeout_get, METH_O, NULL},
{ (char *)"nbt_name_query_in_retries_set", _wrap_nbt_name_query_in_retries_set, METH_VARARGS, NULL},
- { (char *)"nbt_name_query_in_retries_get", _wrap_nbt_name_query_in_retries_get, METH_VARARGS, NULL},
- { (char *)"new_nbt_name_query_in", _wrap_new_nbt_name_query_in, METH_VARARGS, NULL},
- { (char *)"delete_nbt_name_query_in", _wrap_delete_nbt_name_query_in, METH_VARARGS, NULL},
+ { (char *)"nbt_name_query_in_retries_get", (PyCFunction)_wrap_nbt_name_query_in_retries_get, METH_O, NULL},
+ { (char *)"new_nbt_name_query_in", (PyCFunction)_wrap_new_nbt_name_query_in, METH_NOARGS, NULL},
+ { (char *)"delete_nbt_name_query_in", (PyCFunction)_wrap_delete_nbt_name_query_in, METH_O, NULL},
{ (char *)"nbt_name_query_in_swigregister", nbt_name_query_in_swigregister, METH_VARARGS, NULL},
+ { (char *)"nbt_name_query_in_swiginit", nbt_name_query_in_swiginit, METH_VARARGS, NULL},
{ (char *)"new_char_ptr_array", (PyCFunction) _wrap_new_char_ptr_array, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"delete_char_ptr_array", (PyCFunction) _wrap_delete_char_ptr_array, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"char_ptr_array_getitem", (PyCFunction) _wrap_char_ptr_array_getitem, METH_VARARGS | METH_KEYWORDS, NULL},
@@ -4091,7 +4124,7 @@ static PyMethodDef SwigMethods[] = {
static swig_type_info _swigt__p_TALLOC_CTX = {"_p_TALLOC_CTX", "TALLOC_CTX *", 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_event_context = {"_p_event_context", "struct event_context *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_event_context = {"_p_event_context", "struct event_context *|event *", 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 *", 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_nbt_name = {"_p_nbt_name", "struct nbt_name *|nbt_name *", 0, 0, (void*)0, 0};
diff --git a/source4/libcli/swig/libcli_smb.i b/source4/libcli/swig/libcli_smb.i
index 32e043b2c6..4125bcf5a9 100644
--- a/source4/libcli/swig/libcli_smb.i
+++ b/source4/libcli/swig/libcli_smb.i
@@ -9,8 +9,9 @@
#include "libcli/raw/libcliraw.h"
%}
-struct smbcli_socket *smbcli_sock_connect_byname(const char *host, int port,
+struct smbcli_socket *smbcli_sock_connect_byname(const char *host, const char **ports,
TALLOC_CTX *mem_ctx,
+ struct resolve_context *resolve_ctx,
struct event_context *event_ctx);
void smbcli_sock_dead(struct smbcli_socket *sock);
diff --git a/source4/libcli/swig/libcli_smb.py b/source4/libcli/swig/libcli_smb.py
index 466a04b9eb..80c4040237 100644
--- a/source4/libcli/swig/libcli_smb.py
+++ b/source4/libcli/swig/libcli_smb.py
@@ -2,7 +2,6 @@
# Version 1.3.33
#
# Don't modify this file, modify the SWIG interface instead.
-# This file is compatible with both classic and new-style classes.
import _libcli_smb
import new
@@ -48,6 +47,16 @@ except AttributeError:
del types
+def _swig_setattr_nondynamic_method(set):
+ def set_attr(self,name,value):
+ if (name == "thisown"): return self.this.own(value)
+ if hasattr(self,name) or (name == "this"):
+ set(self,name,value)
+ else:
+ raise AttributeError("You cannot add attributes to %s" % self)
+ return set_attr
+
+
import events
smbcli_sock_connect_byname = _libcli_smb.smbcli_sock_connect_byname
smbcli_sock_dead = _libcli_smb.smbcli_sock_dead
diff --git a/source4/libcli/swig/libcli_smb_wrap.c b/source4/libcli/swig/libcli_smb_wrap.c
index 313bcfeed3..8b71f2c3be 100644
--- a/source4/libcli/swig/libcli_smb_wrap.c
+++ b/source4/libcli/swig/libcli_smb_wrap.c
@@ -9,7 +9,7 @@
* ----------------------------------------------------------------------------- */
#define SWIGPYTHON
-#define SWIG_PYTHON_DIRECTOR_NO_VTABLE
+#define SWIG_PYTHON_NO_BUILD_NONE
/* -----------------------------------------------------------------------------
* This section contains generic SWIG labels for method/variable
* declarations/attributes, and other compiler dependent labels.
@@ -2459,9 +2459,11 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags)
#define SWIGTYPE_p_TALLOC_CTX swig_types[0]
#define SWIGTYPE_p_char swig_types[1]
#define SWIGTYPE_p_event_context swig_types[2]
-#define SWIGTYPE_p_smbcli_socket swig_types[3]
-static swig_type_info *swig_types[5];
-static swig_module_info swig_module = {swig_types, 4, 0, 0, 0, 0};
+#define SWIGTYPE_p_p_char swig_types[3]
+#define SWIGTYPE_p_resolve_context swig_types[4]
+#define SWIGTYPE_p_smbcli_socket swig_types[5]
+static swig_type_info *swig_types[7];
+static swig_module_info swig_module = {swig_types, 6, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
@@ -2472,6 +2474,19 @@ static swig_module_info swig_module = {swig_types, 4, 0, 0, 0, 0};
# error "This python version requires swig to be run with the '-classic' option"
# endif
#endif
+#if (PY_VERSION_HEX <= 0x02020000)
+# error "This python version requires swig to be run with the '-nomodern' option"
+#endif
+#if (PY_VERSION_HEX <= 0x02020000)
+# error "This python version requires swig to be run with the '-nomodernargs' option"
+#endif
+#ifndef METH_O
+# error "This python version requires swig to be run with the '-nofastunpack' option"
+#endif
+#ifdef SWIG_TypeQuery
+# undef SWIG_TypeQuery
+#endif
+#define SWIG_TypeQuery SWIG_Python_TypeQuery
/*-----------------------------------------------
@(target):= _libcli_smb.so
@@ -2560,200 +2575,60 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
-
-#include <limits.h>
-#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
-
-
-SWIGINTERN int
-SWIG_AsVal_double (PyObject *obj, double *val)
-{
- int res = SWIG_TypeError;
- if (PyFloat_Check(obj)) {
- if (val) *val = PyFloat_AsDouble(obj);
- return SWIG_OK;
- } else if (PyInt_Check(obj)) {
- if (val) *val = PyInt_AsLong(obj);
- return SWIG_OK;
- } else if (PyLong_Check(obj)) {
- double v = PyLong_AsDouble(obj);
- if (!PyErr_Occurred()) {
- if (val) *val = v;
- return SWIG_OK;
- } else {
- PyErr_Clear();
- }
- }
-#ifdef SWIG_PYTHON_CAST_MODE
- {
- int dispatch = 0;
- double d = PyFloat_AsDouble(obj);
- if (!PyErr_Occurred()) {
- if (val) *val = d;
- return SWIG_AddCast(SWIG_OK);
- } else {
- PyErr_Clear();
- }
- if (!dispatch) {
- long v = PyLong_AsLong(obj);
- if (!PyErr_Occurred()) {
- if (val) *val = v;
- return SWIG_AddCast(SWIG_AddCast(SWIG_OK));
- } else {
- PyErr_Clear();
- }
- }
- }
-#endif
- return res;
-}
-
-
-#include <float.h>
-
-
-#include <math.h>
-
-
-SWIGINTERNINLINE int
-SWIG_CanCastAsInteger(double *d, double min, double max) {
- double x = *d;
- if ((min <= x && x <= max)) {
- double fx = floor(x);
- double cx = ceil(x);
- double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */
- if ((errno == EDOM) || (errno == ERANGE)) {
- errno = 0;
- } else {
- double summ, reps, diff;
- if (rd < x) {
- diff = x - rd;
- } else if (rd > x) {
- diff = rd - x;
- } else {
- return 1;
- }
- summ = rd + x;
- reps = diff/summ;
- if (reps < 8*DBL_EPSILON) {
- *d = rd;
- return 1;
- }
- }
- }
- return 0;
-}
-
-
-SWIGINTERN int
-SWIG_AsVal_long (PyObject *obj, long* val)
-{
- if (PyInt_Check(obj)) {
- if (val) *val = PyInt_AsLong(obj);
- return SWIG_OK;
- } else if (PyLong_Check(obj)) {
- long v = PyLong_AsLong(obj);
- if (!PyErr_Occurred()) {
- if (val) *val = v;
- return SWIG_OK;
- } else {
- PyErr_Clear();
- }
- }
-#ifdef SWIG_PYTHON_CAST_MODE
- {
- int dispatch = 0;
- long v = PyInt_AsLong(obj);
- if (!PyErr_Occurred()) {
- if (val) *val = v;
- return SWIG_AddCast(SWIG_OK);
- } else {
- PyErr_Clear();
- }
- if (!dispatch) {
- double d;
- int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d));
- if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
- if (val) *val = (long)(d);
- return res;
- }
- }
- }
-#endif
- return SWIG_TypeError;
-}
-
-
-SWIGINTERN int
-SWIG_AsVal_int (PyObject * obj, int *val)
-{
- long v;
- int res = SWIG_AsVal_long (obj, &v);
- if (SWIG_IsOK(res)) {
- if ((v < INT_MIN || v > INT_MAX)) {
- return SWIG_OverflowError;
- } else {
- if (val) *val = (int)(v);
- }
- }
- return res;
-}
-
#ifdef __cplusplus
extern "C" {
#endif
SWIGINTERN PyObject *_wrap_smbcli_sock_connect_byname(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
PyObject *resultobj = 0;
char *arg1 = (char *) 0 ;
- int arg2 ;
+ char **arg2 = (char **) 0 ;
TALLOC_CTX *arg3 = (TALLOC_CTX *) 0 ;
- struct event_context *arg4 = (struct event_context *) 0 ;
+ struct resolve_context *arg4 = (struct resolve_context *) 0 ;
+ struct event_context *arg5 = (struct event_context *) 0 ;
struct smbcli_socket *result = 0 ;
int res1 ;
char *buf1 = 0 ;
int alloc1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
+ void *argp2 = 0 ;
+ int res2 = 0 ;
void *argp4 = 0 ;
int res4 = 0 ;
+ void *argp5 = 0 ;
+ int res5 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
+ PyObject * obj3 = 0 ;
char * kwnames[] = {
- (char *) "host",(char *) "port",(char *) "event_ctx", NULL
+ (char *) "host",(char *) "ports",(char *) "resolve_ctx",(char *) "event_ctx", NULL
};
- {
- arg4 = event_context_init(NULL);
- }
- {
- arg3 = NULL;
- }
- if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO|O:smbcli_sock_connect_byname",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
+ arg5 = event_context_init(NULL);
+ arg3 = NULL;
+ if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|O:smbcli_sock_connect_byname",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "smbcli_sock_connect_byname" "', argument " "1"" of type '" "char const *""'");
}
arg1 = (char *)(buf1);
- ecode2 = SWIG_AsVal_int(obj1, &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "smbcli_sock_connect_byname" "', argument " "2"" of type '" "int""'");
- }
- arg2 = (int)(val2);
- if (obj2) {
- res4 = SWIG_ConvertPtr(obj2, &argp4,SWIGTYPE_p_event_context, 0 | 0 );
- if (!SWIG_IsOK(res4)) {
- SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "smbcli_sock_connect_byname" "', argument " "4"" of type '" "struct event_context *""'");
+ res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_p_char, 0 | 0 );
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "smbcli_sock_connect_byname" "', argument " "2"" of type '" "char const **""'");
+ }
+ arg2 = (char **)(argp2);
+ res4 = SWIG_ConvertPtr(obj2, &argp4,SWIGTYPE_p_resolve_context, 0 | 0 );
+ if (!SWIG_IsOK(res4)) {
+ SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "smbcli_sock_connect_byname" "', argument " "4"" of type '" "struct resolve_context *""'");
+ }
+ arg4 = (struct resolve_context *)(argp4);
+ if (obj3) {
+ res5 = SWIG_ConvertPtr(obj3, &argp5,SWIGTYPE_p_event_context, 0 | 0 );
+ if (!SWIG_IsOK(res5)) {
+ SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "smbcli_sock_connect_byname" "', argument " "5"" of type '" "struct event_context *""'");
}
- arg4 = (struct event_context *)(argp4);
+ arg5 = (struct event_context *)(argp5);
}
- result = (struct smbcli_socket *)smbcli_sock_connect_byname((char const *)arg1,arg2,arg3,arg4);
+ result = (struct smbcli_socket *)smbcli_sock_connect_byname((char const *)arg1,(char const **)arg2,arg3,arg4,arg5);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_smbcli_socket, 0 | 0 );
if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
return resultobj;
@@ -2798,25 +2673,33 @@ static PyMethodDef SwigMethods[] = {
static swig_type_info _swigt__p_TALLOC_CTX = {"_p_TALLOC_CTX", "TALLOC_CTX *", 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_event_context = {"_p_event_context", "struct event_context *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_event_context = {"_p_event_context", "struct event_context *|event *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_p_char = {"_p_p_char", "char **", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_resolve_context = {"_p_resolve_context", "struct resolve_context *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_smbcli_socket = {"_p_smbcli_socket", "struct smbcli_socket *", 0, 0, (void*)0, 0};
static swig_type_info *swig_type_initial[] = {
&_swigt__p_TALLOC_CTX,
&_swigt__p_char,
&_swigt__p_event_context,
+ &_swigt__p_p_char,
+ &_swigt__p_resolve_context,
&_swigt__p_smbcli_socket,
};
static swig_cast_info _swigc__p_TALLOC_CTX[] = { {&_swigt__p_TALLOC_CTX, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_event_context[] = { {&_swigt__p_event_context, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_p_char[] = { {&_swigt__p_p_char, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_resolve_context[] = { {&_swigt__p_resolve_context, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_smbcli_socket[] = { {&_swigt__p_smbcli_socket, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info *swig_cast_initial[] = {
_swigc__p_TALLOC_CTX,
_swigc__p_char,
_swigc__p_event_context,
+ _swigc__p_p_char,
+ _swigc__p_resolve_context,
_swigc__p_smbcli_socket,
};
diff --git a/source4/libnet/config.mk b/source4/libnet/config.mk
index aadd3b88d0..9041ff5a23 100644
--- a/source4/libnet/config.mk
+++ b/source4/libnet/config.mk
@@ -1,7 +1,4 @@
-[LIBRARY::LIBSAMBA-NET]
-VERSION = 0.0.1
-SO_VERSION = 0
-DESCRIPTION = Convenient high level access to Samba management interfaces
+[SUBSYSTEM::LIBSAMBA-NET]
PRIVATE_PROTO_HEADER = libnet_proto.h
PUBLIC_HEADERS = libnet.h libnet_join.h libnet_lookup.h libnet_passwd.h \
libnet_rpc.h libnet_share.h libnet_time.h \
diff --git a/source4/libnet/libnet_join.c b/source4/libnet/libnet_join.c
index 8297172a58..22134518d6 100644
--- a/source4/libnet/libnet_join.c
+++ b/source4/libnet/libnet_join.c
@@ -1064,7 +1064,7 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx,
return NT_STATUS_INTERNAL_DB_CORRUPTION;
} else {
const struct ldb_val *private_keytab;
- const struct ldb_val *krb5_keytab;
+ const struct ldb_val *krb5_main_keytab;
const struct ldb_val *prior_secret;
const struct ldb_val *prior_modified_time;
int i;
@@ -1125,9 +1125,10 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx,
return NT_STATUS_NO_MEMORY;
}
}
- krb5_keytab = ldb_msg_find_ldb_val(msgs[0], "krb5Keytab");
- if (krb5_keytab) {
- rtn = samdb_msg_set_value(ldb, tmp_mem, msg, "krb5Keytab", krb5_keytab);
+ krb5_main_keytab = ldb_msg_find_ldb_val(msgs[0], "krb5Keytab");
+ if (krb5_main_keytab) {
+ rtn = samdb_msg_set_value(ldb, tmp_mem, msg,
+ "krb5Keytab", krb5_main_keytab);
if (rtn == -1) {
r->out.error_string = NULL;
talloc_free(tmp_mem);
diff --git a/source4/libnet/net_wrap.c b/source4/libnet/net_wrap.c
index b1d2a8f306..a4e27c151c 100644
--- a/source4/libnet/net_wrap.c
+++ b/source4/libnet/net_wrap.c
@@ -3996,7 +3996,7 @@ static PyMethodDef SwigMethods[] = {
static swig_type_info _swigt__p_TALLOC_CTX = {"_p_TALLOC_CTX", "TALLOC_CTX *", 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_cli_credentials = {"_p_cli_credentials", "struct cli_credentials *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_event_context = {"_p_event_context", "struct event_context *|event_context *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_event_context = {"_p_event_context", "struct event_context *|event *", 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 *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_ldb_context = {"_p_ldb_context", "struct ldb_context *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_libnet_AddShare = {"_p_libnet_AddShare", "struct libnet_AddShare *", 0, 0, (void*)0, 0};
diff --git a/source4/librpc/config.mk b/source4/librpc/config.mk
index debfbb6869..4d4167ba04 100644
--- a/source4/librpc/config.mk
+++ b/source4/librpc/config.mk
@@ -36,10 +36,7 @@ MANPAGE = tools/ndrdump.1
################################################
# Start SUBSYSTEM NDR_COMPRESSION
-[LIBRARY::NDR_COMPRESSION]
-VERSION = 0.0.1
-SO_VERSION = 0
-DESCRIPTION = NDR support for compressed subcontexts
+[SUBSYSTEM::NDR_COMPRESSION]
PRIVATE_PROTO_HEADER = ndr/ndr_compression.h
OBJ_FILES = \
ndr/ndr_compression.o
@@ -370,13 +367,10 @@ OBJ_FILES = gen_ndr/ndr_svcctl_c.o
PUBLIC_HEADERS = gen_ndr/ndr_svcctl_c.h
PUBLIC_DEPENDENCIES = dcerpc NDR_SVCCTL
-[LIBRARY::dcerpc_atsvc]
+[SUBSYSTEM::dcerpc_atsvc]
OBJ_FILES = gen_ndr/ndr_atsvc_c.o
PUBLIC_HEADERS = gen_ndr/ndr_atsvc_c.h
PUBLIC_DEPENDENCIES = dcerpc NDR_ATSVC
-VERSION = 0.0.1
-SO_VERSION = 0
-DESCRIPTION = DCE/RPC client library - ATSVC
[SUBSYSTEM::RPC_NDR_EVENTLOG]
OBJ_FILES = gen_ndr/ndr_eventlog_c.o
@@ -410,12 +404,9 @@ PUBLIC_DEPENDENCIES = dcerpc NDR_WINREG
OBJ_FILES = gen_ndr/ndr_initshutdown_c.o
PUBLIC_DEPENDENCIES = dcerpc NDR_INITSHUTDOWN
-[LIBRARY::dcerpc_mgmt]
+[SUBSYSTEM::dcerpc_mgmt]
OBJ_FILES = gen_ndr/ndr_mgmt_c.o
PRIVATE_DEPENDENCIES = NDR_MGMT
-VERSION = 0.0.1
-SO_VERSION = 0
-DESCRIPTION = DCE/RPC client library - MGMT
[SUBSYSTEM::RPC_NDR_PROTECTED_STORAGE]
OBJ_FILES = gen_ndr/ndr_protected_storage_c.o
@@ -597,4 +588,45 @@ PUBLIC_DEPENDENCIES = LIBCLI_SMB NDR_MISC LIBSAMBA-UTIL LIBSAMBA-CONFIG dcerpc_s
[PYTHON::python_echo]
OBJ_FILES = gen_ndr/py_echo.o
-PRIVATE_DEPENDENCIES = NDR_ECHO
+PRIVATE_DEPENDENCIES = RPC_NDR_ECHO
+
+[PYTHON::python_winreg]
+OBJ_FILES = gen_ndr/py_winreg.o
+PRIVATE_DEPENDENCIES = RPC_NDR_WINREG python_misc
+
+[PYTHON::python_dcerpc_misc]
+OBJ_FILES = gen_ndr/py_misc.o
+
+[PYTHON::python_initshutdown]
+OBJ_FILES = gen_ndr/py_initshutdown.o
+PRIVATE_DEPENDENCIES = RPC_NDR_INITSHUTDOWN
+
+[PYTHON::python_epmapper]
+OBJ_FILES = gen_ndr/py_epmapper.o
+
+[PYTHON::python_mgmt]
+OBJ_FILES = gen_ndr/py_mgmt.o
+PRIVATE_DEPENDENCIES = dcerpc_mgmt
+
+[PYTHON::python_atsvc]
+OBJ_FILES = gen_ndr/py_atsvc.o
+PRIVATE_DEPENDENCIES = dcerpc_atsvc
+
+[PYTHON::python_samr]
+OBJ_FILES = gen_ndr/py_samr.o
+PRIVATE_DEPENDENCIES = dcerpc_samr
+
+[PYTHON::python_svcctl]
+OBJ_FILES = gen_ndr/py_svcctl.o
+PRIVATE_DEPENDENCIES = RPC_NDR_SVCCTL
+
+[PYTHON::python_lsa]
+OBJ_FILES = gen_ndr/py_lsa.o
+PRIVATE_DEPENDENCIES = RPC_NDR_LSA
+
+[PYTHON::python_wkssvc]
+OBJ_FILES = gen_ndr/py_wkssvc.o
+PRIVATE_DEPENDENCIES = RPC_NDR_WKSSVC
+
+[PYTHON::python_dcerpc_security]
+OBJ_FILES = gen_ndr/py_security.o
diff --git a/source4/librpc/idl/drsblobs.idl b/source4/librpc/idl/drsblobs.idl
index f690e39ca4..1e80597f4a 100644
--- a/source4/librpc/idl/drsblobs.idl
+++ b/source4/librpc/idl/drsblobs.idl
@@ -9,9 +9,9 @@ import "drsuapi.idl";
helpstring("Active Directory Replication LDAP Blobs")
]
interface drsblobs {
- declare bitmap drsuapi_DsReplicaSyncOptions;
- declare bitmap drsuapi_DsReplicaNeighbourFlags;
- declare [v1_enum] enum drsuapi_DsAttributeId;
+ typedef bitmap drsuapi_DsReplicaSyncOptions drsuapi_DsReplicaSyncOptions;
+ typedef bitmap drsuapi_DsReplicaNeighbourFlags drsuapi_DsReplicaNeighbourFlags;
+ typedef [v1_enum] enum drsuapi_DsAttributeId drsuapi_DsAttributeId;
/*
* replPropertyMetaData
diff --git a/source4/librpc/idl/drsuapi.idl b/source4/librpc/idl/drsuapi.idl
index e8fbc85f29..f298b7e321 100644
--- a/source4/librpc/idl/drsuapi.idl
+++ b/source4/librpc/idl/drsuapi.idl
@@ -13,7 +13,7 @@ import "security.idl", "misc.idl", "samr.idl";
]
interface drsuapi
{
- declare bitmap samr_GroupAttrs;
+ typedef bitmap samr_GroupAttrs samr_GroupAttrs;
/*****************/
/* Function 0x00 */
diff --git a/source4/librpc/idl/lsa.idl b/source4/librpc/idl/lsa.idl
index b692139fc8..8d26ec0aad 100644
--- a/source4/librpc/idl/lsa.idl
+++ b/source4/librpc/idl/lsa.idl
@@ -13,7 +13,7 @@ import "security.idl";
helpstring("Local Security Authority")
] interface lsarpc
{
- declare bitmap security_secinfo;
+ typedef bitmap security_secinfo security_secinfo;
typedef [public,noejs] struct {
[value(2*strlen_m(string))] uint16 length;
@@ -138,9 +138,29 @@ import "security.idl";
uint32 unknown;
} lsa_AuditLogInfo;
+ typedef [v1_enum] enum {
+ LSA_AUDIT_POLICY_NONE=0,
+ LSA_AUDIT_POLICY_SUCCESS=1,
+ LSA_AUDIT_POLICY_FAILURE=2,
+ LSA_AUDIT_POLICY_ALL=(LSA_AUDIT_POLICY_SUCCESS|LSA_AUDIT_POLICY_FAILURE),
+ LSA_AUDIT_POLICY_CLEAR=4
+ } lsa_PolicyAuditPolicy;
+
+ typedef enum {
+ LSA_AUDIT_CATEGORY_SYSTEM = 0,
+ LSA_AUDIT_CATEGORY_LOGON = 1,
+ LSA_AUDIT_CATEGORY_FILE_AND_OBJECT_ACCESS = 2,
+ LSA_AUDIT_CATEGORY_USE_OF_USER_RIGHTS = 3,
+ LSA_AUDIT_CATEGORY_PROCCESS_TRACKING = 4,
+ LSA_AUDIT_CATEGORY_SECURITY_POLICY_CHANGES = 5,
+ LSA_AUDIT_CATEGORY_ACCOUNT_MANAGEMENT = 6,
+ LSA_AUDIT_CATEGORY_DIRECTORY_SERVICE_ACCESS = 7, /* only in win2k/2k3 */
+ LSA_AUDIT_CATEGORY_ACCOUNT_LOGON = 8 /* only in win2k/2k3 */
+ } lsa_PolicyAuditEventType;
+
typedef struct {
uint32 auditing_mode;
- [size_is(count)] uint32 *settings;
+ [size_is(count)] lsa_PolicyAuditPolicy *settings;
uint32 count;
} lsa_AuditEventsInfo;
@@ -214,7 +234,7 @@ import "security.idl";
LSA_POLICY_INFO_AUDIT_FULL_SET=10,
LSA_POLICY_INFO_AUDIT_FULL_QUERY=11,
LSA_POLICY_INFO_DNS=12
- } lsaPolicyInfo;
+ } lsa_PolicyInfo;
typedef [switch_type(uint16)] union {
[case(LSA_POLICY_INFO_AUDIT_LOG)] lsa_AuditLogInfo audit_log;
@@ -233,13 +253,17 @@ import "security.idl";
NTSTATUS lsa_QueryInfoPolicy (
[in] policy_handle *handle,
- [in] uint16 level,
+ [in] lsa_PolicyInfo level,
[out,unique,switch_is(level)] lsa_PolicyInformation *info
);
/******************/
/* Function: 0x08 */
- NTSTATUS lsa_SetInfoPolicy ();
+ NTSTATUS lsa_SetInfoPolicy (
+ [in] policy_handle *handle,
+ [in] lsa_PolicyInfo level,
+ [in,switch_is(level)] lsa_PolicyInformation *info
+ );
/******************/
/* Function: 0x09 */
@@ -722,12 +746,16 @@ import "security.idl";
NTSTATUS lsa_QueryInfoPolicy2(
[in] policy_handle *handle,
- [in] uint16 level,
+ [in] lsa_PolicyInfo level,
[out,unique,switch_is(level)] lsa_PolicyInformation *info
);
/* Function 0x2f */
- NTSTATUS lsa_SetInfoPolicy2();
+ NTSTATUS lsa_SetInfoPolicy2(
+ [in] policy_handle *handle,
+ [in] lsa_PolicyInfo level,
+ [in,switch_is(level)] lsa_PolicyInformation *info
+ );
/**********************/
/* Function 0x30 */
diff --git a/source4/librpc/idl/mgmt.idl b/source4/librpc/idl/mgmt.idl
index 60d1ebdc85..35857f26cd 100644
--- a/source4/librpc/idl/mgmt.idl
+++ b/source4/librpc/idl/mgmt.idl
@@ -2,6 +2,8 @@
dcerpc remote management interface
*/
+import "misc.idl";
+
[
uuid("afa8bd80-7d8a-11c9-bef4-08002b102989"),
version(1.0),
diff --git a/source4/librpc/idl/nbt.idl b/source4/librpc/idl/nbt.idl
index 609f84c993..d4c2bf1ad0 100644
--- a/source4/librpc/idl/nbt.idl
+++ b/source4/librpc/idl/nbt.idl
@@ -418,7 +418,7 @@ interface nbt
uint16 lm20_token;
} nbt_netlogon_response_from_pdc2;
- declare enum netr_SamDatabaseID;
+ typedef enum netr_SamDatabaseID netr_SamDatabaseID;
/* announce change to UAS or SAM */
typedef struct {
@@ -592,7 +592,7 @@ interface nbt
/* \MAILSLOT\BROWSE mailslot requests */
/* for details see http://ubiqx.org/cifs/Browsing.html */
/********************************************************/
- declare bitmap svcctl_ServerType;
+ typedef bitmap svcctl_ServerType svcctl_ServerType;
typedef [enum8bit] enum {
HostAnnouncement = 1,
diff --git a/source4/librpc/idl/netlogon.idl b/source4/librpc/idl/netlogon.idl
index 96aab3a807..dcbb647ba0 100644
--- a/source4/librpc/idl/netlogon.idl
+++ b/source4/librpc/idl/netlogon.idl
@@ -18,7 +18,7 @@ import "lsa.idl", "samr.idl", "security.idl", "nbt.idl";
interface netlogon
{
- declare bitmap samr_AcctFlags;
+ typedef bitmap samr_AcctFlags samr_AcctFlags;
/*****************/
/* Function 0x00 */
@@ -278,7 +278,7 @@ interface netlogon
/*****************/
/* Function 0x05 */
- declare enum netr_SchannelType;
+ typedef enum netr_SchannelType netr_SchannelType;
NTSTATUS netr_ServerAuthenticate(
[in,string,charset(UTF16)] uint16 *server_name,
@@ -306,7 +306,7 @@ interface netlogon
/*****************/
/* Function 0x07 */
- declare enum netr_SamDatabaseID;
+ typedef enum netr_SamDatabaseID netr_SamDatabaseID;
typedef struct {
[string,charset(UTF16)] uint16 *account_name;
diff --git a/source4/librpc/idl/samr.idl b/source4/librpc/idl/samr.idl
index f008637e99..b6d2b9f941 100644
--- a/source4/librpc/idl/samr.idl
+++ b/source4/librpc/idl/samr.idl
@@ -16,7 +16,7 @@ import "misc.idl", "lsa.idl", "security.idl";
pointer_default_top(unique)
] interface samr
{
- declare bitmap security_secinfo;
+ typedef bitmap security_secinfo security_secinfo;
/* account control (acct_flags) bits */
typedef [public,bitmap32bit] bitmap {
@@ -1240,7 +1240,7 @@ import "misc.idl", "lsa.idl", "security.idl";
/************************/
/* Function 0x3f */
- declare enum samr_RejectReason;
+ typedef enum samr_RejectReason samr_RejectReason;
typedef struct {
samr_RejectReason reason;
diff --git a/source4/librpc/idl/spoolss.idl b/source4/librpc/idl/spoolss.idl
index 9c26b14892..7d40861a52 100644
--- a/source4/librpc/idl/spoolss.idl
+++ b/source4/librpc/idl/spoolss.idl
@@ -14,7 +14,7 @@ import "security.idl", "winreg.idl";
helper("librpc/ndr/ndr_spoolss_buf.h")
] interface spoolss
{
- declare [v1_enum] enum winreg_Type;
+ typedef [v1_enum] enum winreg_Type winreg_Type;
typedef struct {
uint16 year;
uint16 month;
diff --git a/source4/librpc/idl/srvsvc.idl b/source4/librpc/idl/srvsvc.idl
index 8fb539086a..c3f0bd51a7 100644
--- a/source4/librpc/idl/srvsvc.idl
+++ b/source4/librpc/idl/srvsvc.idl
@@ -13,8 +13,8 @@ import "security.idl", "svcctl.idl";
helpstring("Server Service")
] interface srvsvc
{
- declare bitmap svcctl_ServerType;
- declare bitmap security_secinfo;
+ typedef bitmap svcctl_ServerType svcctl_ServerType;
+ typedef bitmap security_secinfo security_secinfo;
/**************************/
/* srvsvc_NetCharDev */
diff --git a/source4/librpc/idl/svcctl.idl b/source4/librpc/idl/svcctl.idl
index 2fbdb71e74..d9f8233a0e 100644
--- a/source4/librpc/idl/svcctl.idl
+++ b/source4/librpc/idl/svcctl.idl
@@ -4,6 +4,7 @@
svcctl interface definitions
*/
+import "misc.idl";
[ uuid("367abb81-9844-35f1-ad32-98f038001003"),
version(2.0),
pointer_default(unique),
diff --git a/source4/librpc/idl/winbind.idl b/source4/librpc/idl/winbind.idl
index 222ac0d6c0..29649c0ea7 100644
--- a/source4/librpc/idl/winbind.idl
+++ b/source4/librpc/idl/winbind.idl
@@ -13,8 +13,8 @@ import "netlogon.idl";
]
interface winbind
{
- declare [switch_type(uint16)] union netr_LogonLevel;
- declare [switch_type(uint16)] union netr_Validation;
+ typedef [switch_type(uint16)] union netr_LogonLevel netr_LogonLevel;
+ typedef [switch_type(uint16)] union netr_Validation netr_Validation;
/* a call to get runtime informations */
void winbind_information(/* TODO */);
diff --git a/source4/librpc/idl/winreg.idl b/source4/librpc/idl/winreg.idl
index 5d0085c969..fc734b7403 100644
--- a/source4/librpc/idl/winreg.idl
+++ b/source4/librpc/idl/winreg.idl
@@ -13,7 +13,7 @@ import "lsa.idl", "initshutdown.idl", "security.idl";
helpstring("Remote Registry Service")
] interface winreg
{
- declare bitmap security_secinfo;
+ typedef bitmap security_secinfo security_secinfo;
typedef [bitmap32bit] bitmap {
KEY_QUERY_VALUE = 0x00001,
diff --git a/source4/librpc/idl/wkssvc.idl b/source4/librpc/idl/wkssvc.idl
index dfb18e7ea8..9829379eef 100644
--- a/source4/librpc/idl/wkssvc.idl
+++ b/source4/librpc/idl/wkssvc.idl
@@ -14,7 +14,7 @@ import "srvsvc.idl", "lsa.idl";
endpoint("ncacn_np:[\\pipe\\wkssvc]","ncacn_ip_tcp:","ncalrpc:")
] interface wkssvc
{
- declare [v1_enum] enum srvsvc_PlatformId;
+ typedef [v1_enum] enum srvsvc_PlatformId srvsvc_PlatformId;
#define BOOL uint32
diff --git a/source4/librpc/ndr/ndr_compression.c b/source4/librpc/ndr/ndr_compression.c
index 310f8c4ce4..86a5a2560e 100644
--- a/source4/librpc/ndr/ndr_compression.c
+++ b/source4/librpc/ndr/ndr_compression.c
@@ -112,6 +112,8 @@ static enum ndr_err_code ndr_pull_compression_mszip(struct ndr_pull *subndr,
comndr->data_size = uncompressed.length;
comndr->offset = 0;
+ comndr->iconv_convenience = talloc_reference(comndr, subndr->iconv_convenience);
+
NDR_CHECK(ndr_pull_uint32(comndr, NDR_SCALARS, &payload_header[0]));
NDR_CHECK(ndr_pull_uint32(comndr, NDR_SCALARS, &payload_header[1]));
NDR_CHECK(ndr_pull_uint32(comndr, NDR_SCALARS, &payload_header[2]));
@@ -215,6 +217,8 @@ static enum ndr_err_code ndr_pull_compression_xpress(struct ndr_pull *subndr,
comndr->data_size = uncompressed.length;
comndr->offset = 0;
+ comndr->iconv_convenience = talloc_reference(comndr, subndr->iconv_convenience);
+
*_comndr = comndr;
return NDR_ERR_SUCCESS;
}
diff --git a/source4/librpc/ndr/ndr_drsuapi.c b/source4/librpc/ndr/ndr_drsuapi.c
index dedcb0601d..9f755ffaab 100644
--- a/source4/librpc/ndr/ndr_drsuapi.c
+++ b/source4/librpc/ndr/ndr_drsuapi.c
@@ -23,7 +23,7 @@
#include "includes.h"
#include "librpc/gen_ndr/ndr_drsuapi.h"
#include "librpc/gen_ndr/ndr_misc.h"
-#include "libcli/util/asn_1.h"
+#include "lib/util/asn1.h"
void ndr_print_drsuapi_DsReplicaObjectListItem(struct ndr_print *ndr, const char *name,
const struct drsuapi_DsReplicaObjectListItem *r)
diff --git a/source4/librpc/rpc/dcerpc.i b/source4/librpc/rpc/dcerpc.i
index 4128092a41..f958d82e2e 100644
--- a/source4/librpc/rpc/dcerpc.i
+++ b/source4/librpc/rpc/dcerpc.i
@@ -36,13 +36,14 @@
#include "includes.h"
#include "dynconfig.h"
#include "librpc/rpc/dcerpc.h"
+#include "param/param.h"
#undef strcpy
%}
-%include "../../lib/talloc/talloc.i"
-%include "../../auth/credentials/credentials.i"
+%import "../../lib/talloc/talloc.i"
+%import "../../auth/credentials/credentials.i"
%typemap(in,noblock=1, numinputs=0) struct dcerpc_pipe **OUT (struct dcerpc_pipe *temp_dcerpc_pipe) {
$1 = &temp_dcerpc_pipe;
diff --git a/source4/librpc/rpc/dcerpc.py b/source4/librpc/rpc/dcerpc.py
index 71661ef7fa..7e4d82d7c4 100644
--- a/source4/librpc/rpc/dcerpc.py
+++ b/source4/librpc/rpc/dcerpc.py
@@ -57,34 +57,8 @@ def _swig_setattr_nondynamic_method(set):
return set_attr
+import credentials
import param
-class Credentials(object):
- thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
- __repr__ = _swig_repr
- def __init__(self, *args, **kwargs):
- _dcerpc.Credentials_swiginit(self,_dcerpc.new_Credentials(*args, **kwargs))
- __swig_destroy__ = _dcerpc.delete_Credentials
-Credentials.get_username = new_instancemethod(_dcerpc.Credentials_get_username,None,Credentials)
-Credentials.set_username = new_instancemethod(_dcerpc.Credentials_set_username,None,Credentials)
-Credentials.get_password = new_instancemethod(_dcerpc.Credentials_get_password,None,Credentials)
-Credentials.set_password = new_instancemethod(_dcerpc.Credentials_set_password,None,Credentials)
-Credentials.get_domain = new_instancemethod(_dcerpc.Credentials_get_domain,None,Credentials)
-Credentials.set_domain = new_instancemethod(_dcerpc.Credentials_set_domain,None,Credentials)
-Credentials.get_realm = new_instancemethod(_dcerpc.Credentials_get_realm,None,Credentials)
-Credentials.set_realm = new_instancemethod(_dcerpc.Credentials_set_realm,None,Credentials)
-Credentials.parse_string = new_instancemethod(_dcerpc.Credentials_parse_string,None,Credentials)
-Credentials.get_bind_dn = new_instancemethod(_dcerpc.Credentials_get_bind_dn,None,Credentials)
-Credentials.set_bind_dn = new_instancemethod(_dcerpc.Credentials_set_bind_dn,None,Credentials)
-Credentials.get_workstation = new_instancemethod(_dcerpc.Credentials_get_workstation,None,Credentials)
-Credentials.set_workstation = new_instancemethod(_dcerpc.Credentials_set_workstation,None,Credentials)
-Credentials.guess = new_instancemethod(_dcerpc.Credentials_guess,None,Credentials)
-Credentials.is_anonymous = new_instancemethod(_dcerpc.Credentials_is_anonymous,None,Credentials)
-Credentials.get_nt_hash = new_instancemethod(_dcerpc.Credentials_get_nt_hash,None,Credentials)
-Credentials.authentication_requested = new_instancemethod(_dcerpc.Credentials_authentication_requested,None,Credentials)
-Credentials.wrong_password = new_instancemethod(_dcerpc.Credentials_wrong_password,None,Credentials)
-Credentials_swigregister = _dcerpc.Credentials_swigregister
-Credentials_swigregister(Credentials)
-
pipe_connect = _dcerpc.pipe_connect
dcerpc_server_name = _dcerpc.dcerpc_server_name
diff --git a/source4/librpc/rpc/dcerpc_wrap.c b/source4/librpc/rpc/dcerpc_wrap.c
index 5be702b1bb..bae41c2c22 100644
--- a/source4/librpc/rpc/dcerpc_wrap.c
+++ b/source4/librpc/rpc/dcerpc_wrap.c
@@ -2529,27 +2529,11 @@ static swig_module_info swig_module = {swig_types, 21, 0, 0, 0, 0};
#include "includes.h"
#include "dynconfig.h"
#include "librpc/rpc/dcerpc.h"
-
-#undef strcpy
-
-
-
-
-/* Include headers */
-#include <stdint.h>
-#include <stdbool.h>
-
-#include "includes.h"
-#include "auth/credentials/credentials.h"
#include "param/param.h"
-typedef struct cli_credentials cli_credentials;
+#undef strcpy
-#include "librpc/gen_ndr/samr.h" /* for struct samr_Password */
-SWIGINTERN cli_credentials *new_cli_credentials(){
- return cli_credentials_init(NULL);
- }
SWIGINTERN swig_type_info*
SWIG_pchar_descriptor(void)
@@ -2564,30 +2548,6 @@ SWIG_pchar_descriptor(void)
}
-SWIGINTERNINLINE PyObject *
-SWIG_FromCharPtrAndSize(const char* carray, size_t size)
-{
- if (carray) {
- if (size > INT_MAX) {
- swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
- return pchar_descriptor ?
- SWIG_NewPointerObj((char *)(carray), pchar_descriptor, 0) : SWIG_Py_Void();
- } else {
- return PyString_FromStringAndSize(carray, (int)(size));
- }
- } else {
- return SWIG_Py_Void();
- }
-}
-
-
-SWIGINTERNINLINE PyObject *
-SWIG_FromCharPtr(const char *cptr)
-{
- return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
-}
-
-
SWIGINTERN int
SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
{
@@ -2643,893 +2603,32 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
-#include <limits.h>
-#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
-
-
-SWIGINTERN int
-SWIG_AsVal_double (PyObject *obj, double *val)
-{
- int res = SWIG_TypeError;
- if (PyFloat_Check(obj)) {
- if (val) *val = PyFloat_AsDouble(obj);
- return SWIG_OK;
- } else if (PyInt_Check(obj)) {
- if (val) *val = PyInt_AsLong(obj);
- return SWIG_OK;
- } else if (PyLong_Check(obj)) {
- double v = PyLong_AsDouble(obj);
- if (!PyErr_Occurred()) {
- if (val) *val = v;
- return SWIG_OK;
- } else {
- PyErr_Clear();
- }
- }
-#ifdef SWIG_PYTHON_CAST_MODE
- {
- int dispatch = 0;
- double d = PyFloat_AsDouble(obj);
- if (!PyErr_Occurred()) {
- if (val) *val = d;
- return SWIG_AddCast(SWIG_OK);
- } else {
- PyErr_Clear();
- }
- if (!dispatch) {
- long v = PyLong_AsLong(obj);
- if (!PyErr_Occurred()) {
- if (val) *val = v;
- return SWIG_AddCast(SWIG_AddCast(SWIG_OK));
- } else {
- PyErr_Clear();
- }
- }
- }
-#endif
- return res;
-}
-
-
-#include <float.h>
-
-
-#include <math.h>
-
-
-SWIGINTERNINLINE int
-SWIG_CanCastAsInteger(double *d, double min, double max) {
- double x = *d;
- if ((min <= x && x <= max)) {
- double fx = floor(x);
- double cx = ceil(x);
- double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */
- if ((errno == EDOM) || (errno == ERANGE)) {
- errno = 0;
- } else {
- double summ, reps, diff;
- if (rd < x) {
- diff = x - rd;
- } else if (rd > x) {
- diff = rd - x;
- } else {
- return 1;
- }
- summ = rd + x;
- reps = diff/summ;
- if (reps < 8*DBL_EPSILON) {
- *d = rd;
- return 1;
- }
- }
- }
- return 0;
-}
-
-
-SWIGINTERN int
-SWIG_AsVal_long (PyObject *obj, long* val)
+SWIGINTERNINLINE PyObject *
+SWIG_FromCharPtrAndSize(const char* carray, size_t size)
{
- if (PyInt_Check(obj)) {
- if (val) *val = PyInt_AsLong(obj);
- return SWIG_OK;
- } else if (PyLong_Check(obj)) {
- long v = PyLong_AsLong(obj);
- if (!PyErr_Occurred()) {
- if (val) *val = v;
- return SWIG_OK;
- } else {
- PyErr_Clear();
- }
- }
-#ifdef SWIG_PYTHON_CAST_MODE
- {
- int dispatch = 0;
- long v = PyInt_AsLong(obj);
- if (!PyErr_Occurred()) {
- if (val) *val = v;
- return SWIG_AddCast(SWIG_OK);
+ if (carray) {
+ if (size > INT_MAX) {
+ swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
+ return pchar_descriptor ?
+ SWIG_NewPointerObj((char *)(carray), pchar_descriptor, 0) : SWIG_Py_Void();
} else {
- PyErr_Clear();
- }
- if (!dispatch) {
- double d;
- int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d));
- if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
- if (val) *val = (long)(d);
- return res;
- }
+ return PyString_FromStringAndSize(carray, (int)(size));
}
+ } else {
+ return SWIG_Py_Void();
}
-#endif
- return SWIG_TypeError;
}
-SWIGINTERN int
-SWIG_AsVal_int (PyObject * obj, int *val)
-{
- long v;
- int res = SWIG_AsVal_long (obj, &v);
- if (SWIG_IsOK(res)) {
- if ((v < INT_MIN || v > INT_MAX)) {
- return SWIG_OverflowError;
- } else {
- if (val) *val = (int)(v);
- }
- }
- return res;
-}
-
-
-SWIGINTERNINLINE PyObject*
- SWIG_From_bool (bool value)
-{
- return PyBool_FromLong(value ? 1 : 0);
+SWIGINTERNINLINE PyObject *
+SWIG_FromCharPtr(const char *cptr)
+{
+ return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
}
-SWIGINTERN void delete_cli_credentials(cli_credentials *self){ talloc_free(self); }
#ifdef __cplusplus
extern "C" {
#endif
-SWIGINTERN PyObject *_wrap_new_Credentials(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- cli_credentials *result = 0 ;
-
- if (!SWIG_Python_UnpackTuple(args,"new_Credentials",0,0,0)) SWIG_fail;
- result = (cli_credentials *)new_cli_credentials();
- resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_cli_credentials, SWIG_POINTER_NEW | 0 );
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Credentials_get_username(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
- PyObject *resultobj = 0;
- cli_credentials *arg1 = (cli_credentials *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
- char * kwnames[] = {
- (char *) "self", NULL
- };
-
- arg1 = NULL;
- if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:Credentials_get_username",kwnames,&obj0)) SWIG_fail;
- if (obj0) {
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Credentials_get_username" "', argument " "1"" of type '" "cli_credentials *""'");
- }
- arg1 = (cli_credentials *)(argp1);
- }
- result = (char *)cli_credentials_get_username(arg1);
- resultobj = SWIG_FromCharPtr((const char *)result);
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Credentials_set_username(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
- PyObject *resultobj = 0;
- cli_credentials *arg1 = (cli_credentials *) 0 ;
- char *arg2 = (char *) 0 ;
- enum credentials_obtained arg3 = (enum credentials_obtained) CRED_SPECIFIED ;
- bool result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int val3 ;
- int ecode3 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
- char * kwnames[] = {
- (char *) "self",(char *) "value",(char *)"arg3", NULL
- };
-
- arg1 = NULL;
- if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OOO:Credentials_set_username",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
- if (obj0) {
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Credentials_set_username" "', argument " "1"" of type '" "cli_credentials *""'");
- }
- arg1 = (cli_credentials *)(argp1);
- }
- if (obj1) {
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Credentials_set_username" "', argument " "2"" of type '" "char const *""'");
- }
- arg2 = (char *)(buf2);
- }
- if (obj2) {
- ecode3 = SWIG_AsVal_int(obj2, &val3);
- if (!SWIG_IsOK(ecode3)) {
- SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Credentials_set_username" "', argument " "3"" of type '" "enum credentials_obtained""'");
- }
- arg3 = (enum credentials_obtained)(val3);
- }
- result = (bool)cli_credentials_set_username(arg1,(char const *)arg2,arg3);
- resultobj = SWIG_From_bool((bool)(result));
- if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Credentials_get_password(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
- PyObject *resultobj = 0;
- cli_credentials *arg1 = (cli_credentials *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
- char * kwnames[] = {
- (char *) "self", NULL
- };
-
- arg1 = NULL;
- if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:Credentials_get_password",kwnames,&obj0)) SWIG_fail;
- if (obj0) {
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Credentials_get_password" "', argument " "1"" of type '" "cli_credentials *""'");
- }
- arg1 = (cli_credentials *)(argp1);
- }
- result = (char *)cli_credentials_get_password(arg1);
- resultobj = SWIG_FromCharPtr((const char *)result);
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Credentials_set_password(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
- PyObject *resultobj = 0;
- cli_credentials *arg1 = (cli_credentials *) 0 ;
- char *arg2 = (char *) 0 ;
- enum credentials_obtained arg3 = (enum credentials_obtained) CRED_SPECIFIED ;
- bool result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int val3 ;
- int ecode3 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
- char * kwnames[] = {
- (char *) "self",(char *) "val",(char *)"arg3", NULL
- };
-
- arg1 = NULL;
- if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OOO:Credentials_set_password",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
- if (obj0) {
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Credentials_set_password" "', argument " "1"" of type '" "cli_credentials *""'");
- }
- arg1 = (cli_credentials *)(argp1);
- }
- if (obj1) {
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Credentials_set_password" "', argument " "2"" of type '" "char const *""'");
- }
- arg2 = (char *)(buf2);
- }
- if (obj2) {
- ecode3 = SWIG_AsVal_int(obj2, &val3);
- if (!SWIG_IsOK(ecode3)) {
- SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Credentials_set_password" "', argument " "3"" of type '" "enum credentials_obtained""'");
- }
- arg3 = (enum credentials_obtained)(val3);
- }
- result = (bool)cli_credentials_set_password(arg1,(char const *)arg2,arg3);
- resultobj = SWIG_From_bool((bool)(result));
- if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Credentials_get_domain(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
- PyObject *resultobj = 0;
- cli_credentials *arg1 = (cli_credentials *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
- char * kwnames[] = {
- (char *) "self", NULL
- };
-
- arg1 = NULL;
- if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:Credentials_get_domain",kwnames,&obj0)) SWIG_fail;
- if (obj0) {
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Credentials_get_domain" "', argument " "1"" of type '" "cli_credentials *""'");
- }
- arg1 = (cli_credentials *)(argp1);
- }
- result = (char *)cli_credentials_get_domain(arg1);
- resultobj = SWIG_FromCharPtr((const char *)result);
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Credentials_set_domain(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
- PyObject *resultobj = 0;
- cli_credentials *arg1 = (cli_credentials *) 0 ;
- char *arg2 = (char *) 0 ;
- enum credentials_obtained arg3 = (enum credentials_obtained) CRED_SPECIFIED ;
- bool result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int val3 ;
- int ecode3 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
- char * kwnames[] = {
- (char *) "self",(char *) "val",(char *)"arg3", NULL
- };
-
- arg1 = NULL;
- if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OOO:Credentials_set_domain",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
- if (obj0) {
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Credentials_set_domain" "', argument " "1"" of type '" "cli_credentials *""'");
- }
- arg1 = (cli_credentials *)(argp1);
- }
- if (obj1) {
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Credentials_set_domain" "', argument " "2"" of type '" "char const *""'");
- }
- arg2 = (char *)(buf2);
- }
- if (obj2) {
- ecode3 = SWIG_AsVal_int(obj2, &val3);
- if (!SWIG_IsOK(ecode3)) {
- SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Credentials_set_domain" "', argument " "3"" of type '" "enum credentials_obtained""'");
- }
- arg3 = (enum credentials_obtained)(val3);
- }
- result = (bool)cli_credentials_set_domain(arg1,(char const *)arg2,arg3);
- resultobj = SWIG_From_bool((bool)(result));
- if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Credentials_get_realm(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
- PyObject *resultobj = 0;
- cli_credentials *arg1 = (cli_credentials *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
- char * kwnames[] = {
- (char *) "self", NULL
- };
-
- arg1 = NULL;
- if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:Credentials_get_realm",kwnames,&obj0)) SWIG_fail;
- if (obj0) {
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Credentials_get_realm" "', argument " "1"" of type '" "cli_credentials *""'");
- }
- arg1 = (cli_credentials *)(argp1);
- }
- result = (char *)cli_credentials_get_realm(arg1);
- resultobj = SWIG_FromCharPtr((const char *)result);
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Credentials_set_realm(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
- PyObject *resultobj = 0;
- cli_credentials *arg1 = (cli_credentials *) 0 ;
- char *arg2 = (char *) 0 ;
- enum credentials_obtained arg3 = (enum credentials_obtained) CRED_SPECIFIED ;
- bool result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int val3 ;
- int ecode3 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
- char * kwnames[] = {
- (char *) "self",(char *) "val",(char *)"arg3", NULL
- };
-
- arg1 = NULL;
- if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OOO:Credentials_set_realm",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
- if (obj0) {
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Credentials_set_realm" "', argument " "1"" of type '" "cli_credentials *""'");
- }
- arg1 = (cli_credentials *)(argp1);
- }
- if (obj1) {
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Credentials_set_realm" "', argument " "2"" of type '" "char const *""'");
- }
- arg2 = (char *)(buf2);
- }
- if (obj2) {
- ecode3 = SWIG_AsVal_int(obj2, &val3);
- if (!SWIG_IsOK(ecode3)) {
- SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Credentials_set_realm" "', argument " "3"" of type '" "enum credentials_obtained""'");
- }
- arg3 = (enum credentials_obtained)(val3);
- }
- result = (bool)cli_credentials_set_realm(arg1,(char const *)arg2,arg3);
- resultobj = SWIG_From_bool((bool)(result));
- if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Credentials_parse_string(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
- PyObject *resultobj = 0;
- cli_credentials *arg1 = (cli_credentials *) 0 ;
- char *arg2 = (char *) 0 ;
- enum credentials_obtained arg3 = (enum credentials_obtained) CRED_SPECIFIED ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int val3 ;
- int ecode3 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
- char * kwnames[] = {
- (char *) "self",(char *) "text",(char *)"arg3", NULL
- };
-
- arg1 = NULL;
- if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OOO:Credentials_parse_string",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
- if (obj0) {
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Credentials_parse_string" "', argument " "1"" of type '" "cli_credentials *""'");
- }
- arg1 = (cli_credentials *)(argp1);
- }
- if (obj1) {
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Credentials_parse_string" "', argument " "2"" of type '" "char const *""'");
- }
- arg2 = (char *)(buf2);
- }
- if (obj2) {
- ecode3 = SWIG_AsVal_int(obj2, &val3);
- if (!SWIG_IsOK(ecode3)) {
- SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Credentials_parse_string" "', argument " "3"" of type '" "enum credentials_obtained""'");
- }
- arg3 = (enum credentials_obtained)(val3);
- }
- cli_credentials_parse_string(arg1,(char const *)arg2,arg3);
- resultobj = SWIG_Py_Void();
- if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Credentials_get_bind_dn(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
- PyObject *resultobj = 0;
- cli_credentials *arg1 = (cli_credentials *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
- char * kwnames[] = {
- (char *) "self", NULL
- };
-
- arg1 = NULL;
- if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:Credentials_get_bind_dn",kwnames,&obj0)) SWIG_fail;
- if (obj0) {
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Credentials_get_bind_dn" "', argument " "1"" of type '" "cli_credentials *""'");
- }
- arg1 = (cli_credentials *)(argp1);
- }
- result = (char *)cli_credentials_get_bind_dn(arg1);
- resultobj = SWIG_FromCharPtr((const char *)result);
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Credentials_set_bind_dn(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
- PyObject *resultobj = 0;
- cli_credentials *arg1 = (cli_credentials *) 0 ;
- char *arg2 = (char *) 0 ;
- bool result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- char * kwnames[] = {
- (char *) "self",(char *) "bind_dn", NULL
- };
-
- arg1 = NULL;
- if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OO:Credentials_set_bind_dn",kwnames,&obj0,&obj1)) SWIG_fail;
- if (obj0) {
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Credentials_set_bind_dn" "', argument " "1"" of type '" "cli_credentials *""'");
- }
- arg1 = (cli_credentials *)(argp1);
- }
- if (obj1) {
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Credentials_set_bind_dn" "', argument " "2"" of type '" "char const *""'");
- }
- arg2 = (char *)(buf2);
- }
- result = (bool)cli_credentials_set_bind_dn(arg1,(char const *)arg2);
- resultobj = SWIG_From_bool((bool)(result));
- if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Credentials_get_workstation(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
- PyObject *resultobj = 0;
- cli_credentials *arg1 = (cli_credentials *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
- char * kwnames[] = {
- (char *) "self", NULL
- };
-
- arg1 = NULL;
- if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:Credentials_get_workstation",kwnames,&obj0)) SWIG_fail;
- if (obj0) {
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Credentials_get_workstation" "', argument " "1"" of type '" "cli_credentials *""'");
- }
- arg1 = (cli_credentials *)(argp1);
- }
- result = (char *)cli_credentials_get_workstation(arg1);
- resultobj = SWIG_FromCharPtr((const char *)result);
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Credentials_set_workstation(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
- PyObject *resultobj = 0;
- cli_credentials *arg1 = (cli_credentials *) 0 ;
- char *arg2 = (char *) 0 ;
- enum credentials_obtained arg3 = (enum credentials_obtained) CRED_SPECIFIED ;
- bool result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int val3 ;
- int ecode3 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
- char * kwnames[] = {
- (char *) "self",(char *) "workstation",(char *) "obtained", NULL
- };
-
- arg1 = NULL;
- if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OOO:Credentials_set_workstation",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
- if (obj0) {
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Credentials_set_workstation" "', argument " "1"" of type '" "cli_credentials *""'");
- }
- arg1 = (cli_credentials *)(argp1);
- }
- if (obj1) {
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Credentials_set_workstation" "', argument " "2"" of type '" "char const *""'");
- }
- arg2 = (char *)(buf2);
- }
- if (obj2) {
- ecode3 = SWIG_AsVal_int(obj2, &val3);
- if (!SWIG_IsOK(ecode3)) {
- SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Credentials_set_workstation" "', argument " "3"" of type '" "enum credentials_obtained""'");
- }
- arg3 = (enum credentials_obtained)(val3);
- }
- result = (bool)cli_credentials_set_workstation(arg1,(char const *)arg2,arg3);
- resultobj = SWIG_From_bool((bool)(result));
- if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Credentials_guess(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
- PyObject *resultobj = 0;
- cli_credentials *arg1 = (cli_credentials *) 0 ;
- struct loadparm_context *arg2 = (struct loadparm_context *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- void *argp2 = 0 ;
- int res2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- char * kwnames[] = {
- (char *) "self",(char *) "lp_ctx", NULL
- };
-
- arg1 = NULL;
- arg2 = loadparm_init(NULL);
- if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OO:Credentials_guess",kwnames,&obj0,&obj1)) SWIG_fail;
- if (obj0) {
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Credentials_guess" "', argument " "1"" of type '" "cli_credentials *""'");
- }
- arg1 = (cli_credentials *)(argp1);
- }
- if (obj1) {
- res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_loadparm_context, 0 | 0 );
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Credentials_guess" "', argument " "2"" of type '" "struct loadparm_context *""'");
- }
- arg2 = (struct loadparm_context *)(argp2);
- }
- cli_credentials_guess(arg1,arg2);
- resultobj = SWIG_Py_Void();
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Credentials_is_anonymous(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
- PyObject *resultobj = 0;
- cli_credentials *arg1 = (cli_credentials *) 0 ;
- bool result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
- char * kwnames[] = {
- (char *) "self", NULL
- };
-
- arg1 = NULL;
- if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:Credentials_is_anonymous",kwnames,&obj0)) SWIG_fail;
- if (obj0) {
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Credentials_is_anonymous" "', argument " "1"" of type '" "cli_credentials *""'");
- }
- arg1 = (cli_credentials *)(argp1);
- }
- result = (bool)cli_credentials_is_anonymous(arg1);
- resultobj = SWIG_From_bool((bool)(result));
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Credentials_get_nt_hash(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
- PyObject *resultobj = 0;
- cli_credentials *arg1 = (cli_credentials *) 0 ;
- TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ;
- struct samr_Password *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
- char * kwnames[] = {
- (char *) "self", NULL
- };
-
- arg1 = NULL;
- arg2 = NULL;
- if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:Credentials_get_nt_hash",kwnames,&obj0)) SWIG_fail;
- if (obj0) {
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Credentials_get_nt_hash" "', argument " "1"" of type '" "cli_credentials *""'");
- }
- arg1 = (cli_credentials *)(argp1);
- }
- result = (struct samr_Password *)cli_credentials_get_nt_hash(arg1,arg2);
- resultobj = PyString_FromStringAndSize((char *)result->hash, 16);
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Credentials_authentication_requested(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
- PyObject *resultobj = 0;
- cli_credentials *arg1 = (cli_credentials *) 0 ;
- bool result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
- char * kwnames[] = {
- (char *) "self", NULL
- };
-
- arg1 = NULL;
- if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:Credentials_authentication_requested",kwnames,&obj0)) SWIG_fail;
- if (obj0) {
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Credentials_authentication_requested" "', argument " "1"" of type '" "cli_credentials *""'");
- }
- arg1 = (cli_credentials *)(argp1);
- }
- result = (bool)cli_credentials_authentication_requested(arg1);
- resultobj = SWIG_From_bool((bool)(result));
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Credentials_wrong_password(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
- PyObject *resultobj = 0;
- cli_credentials *arg1 = (cli_credentials *) 0 ;
- bool result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
- char * kwnames[] = {
- (char *) "self", NULL
- };
-
- arg1 = NULL;
- if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:Credentials_wrong_password",kwnames,&obj0)) SWIG_fail;
- if (obj0) {
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Credentials_wrong_password" "', argument " "1"" of type '" "cli_credentials *""'");
- }
- arg1 = (cli_credentials *)(argp1);
- }
- result = (bool)cli_credentials_wrong_password(arg1);
- resultobj = SWIG_From_bool((bool)(result));
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_delete_Credentials(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
- PyObject *resultobj = 0;
- cli_credentials *arg1 = (cli_credentials *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
- char * kwnames[] = {
- (char *) "self", NULL
- };
-
- arg1 = NULL;
- if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:delete_Credentials",kwnames,&obj0)) SWIG_fail;
- if (obj0) {
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, SWIG_POINTER_DISOWN | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Credentials" "', argument " "1"" of type '" "cli_credentials *""'");
- }
- arg1 = (cli_credentials *)(argp1);
- }
- delete_cli_credentials(arg1);
-
- resultobj = SWIG_Py_Void();
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *Credentials_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *obj;
- if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
- SWIG_TypeNewClientData(SWIGTYPE_p_cli_credentials, SWIG_NewClientData(obj));
- return SWIG_Py_Void();
-}
-
-SWIGINTERN PyObject *Credentials_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- return SWIG_Python_InitShadowInstance(args);
-}
-
SWIGINTERN PyObject *_wrap_pipe_connect(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
PyObject *resultobj = 0;
TALLOC_CTX *arg1 = (TALLOC_CTX *) 0 ;
@@ -3647,28 +2746,6 @@ fail:
static PyMethodDef SwigMethods[] = {
- { (char *)"new_Credentials", (PyCFunction)_wrap_new_Credentials, METH_NOARGS, NULL},
- { (char *)"Credentials_get_username", (PyCFunction) _wrap_Credentials_get_username, METH_VARARGS | METH_KEYWORDS, NULL},
- { (char *)"Credentials_set_username", (PyCFunction) _wrap_Credentials_set_username, METH_VARARGS | METH_KEYWORDS, NULL},
- { (char *)"Credentials_get_password", (PyCFunction) _wrap_Credentials_get_password, METH_VARARGS | METH_KEYWORDS, NULL},
- { (char *)"Credentials_set_password", (PyCFunction) _wrap_Credentials_set_password, METH_VARARGS | METH_KEYWORDS, NULL},
- { (char *)"Credentials_get_domain", (PyCFunction) _wrap_Credentials_get_domain, METH_VARARGS | METH_KEYWORDS, NULL},
- { (char *)"Credentials_set_domain", (PyCFunction) _wrap_Credentials_set_domain, METH_VARARGS | METH_KEYWORDS, NULL},
- { (char *)"Credentials_get_realm", (PyCFunction) _wrap_Credentials_get_realm, METH_VARARGS | METH_KEYWORDS, NULL},
- { (char *)"Credentials_set_realm", (PyCFunction) _wrap_Credentials_set_realm, METH_VARARGS | METH_KEYWORDS, NULL},
- { (char *)"Credentials_parse_string", (PyCFunction) _wrap_Credentials_parse_string, METH_VARARGS | METH_KEYWORDS, NULL},
- { (char *)"Credentials_get_bind_dn", (PyCFunction) _wrap_Credentials_get_bind_dn, METH_VARARGS | METH_KEYWORDS, NULL},
- { (char *)"Credentials_set_bind_dn", (PyCFunction) _wrap_Credentials_set_bind_dn, METH_VARARGS | METH_KEYWORDS, NULL},
- { (char *)"Credentials_get_workstation", (PyCFunction) _wrap_Credentials_get_workstation, METH_VARARGS | METH_KEYWORDS, NULL},
- { (char *)"Credentials_set_workstation", (PyCFunction) _wrap_Credentials_set_workstation, METH_VARARGS | METH_KEYWORDS, NULL},
- { (char *)"Credentials_guess", (PyCFunction) _wrap_Credentials_guess, METH_VARARGS | METH_KEYWORDS, NULL},
- { (char *)"Credentials_is_anonymous", (PyCFunction) _wrap_Credentials_is_anonymous, METH_VARARGS | METH_KEYWORDS, NULL},
- { (char *)"Credentials_get_nt_hash", (PyCFunction) _wrap_Credentials_get_nt_hash, METH_VARARGS | METH_KEYWORDS, NULL},
- { (char *)"Credentials_authentication_requested", (PyCFunction) _wrap_Credentials_authentication_requested, METH_VARARGS | METH_KEYWORDS, NULL},
- { (char *)"Credentials_wrong_password", (PyCFunction) _wrap_Credentials_wrong_password, METH_VARARGS | METH_KEYWORDS, NULL},
- { (char *)"delete_Credentials", (PyCFunction) _wrap_delete_Credentials, METH_VARARGS | METH_KEYWORDS, NULL},
- { (char *)"Credentials_swigregister", Credentials_swigregister, METH_VARARGS, NULL},
- { (char *)"Credentials_swiginit", Credentials_swiginit, METH_VARARGS, NULL},
{ (char *)"pipe_connect", (PyCFunction) _wrap_pipe_connect, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"dcerpc_server_name", (PyCFunction) _wrap_dcerpc_server_name, METH_VARARGS | METH_KEYWORDS, NULL},
{ NULL, NULL, 0, NULL }
diff --git a/source4/nsswitch/config.mk b/source4/nsswitch/config.mk
index 8982024516..621939256c 100644
--- a/source4/nsswitch/config.mk
+++ b/source4/nsswitch/config.mk
@@ -1,7 +1,4 @@
-[LIBRARY::LIBWINBIND-CLIENT]
-VERSION = 0.0.1
-SO_VERSION = 0
-DESCRIPTION = Client library for communicating with winbind
+[SUBSYSTEM::LIBWINBIND-CLIENT]
OBJ_FILES = wb_common.o
PRIVATE_DEPENDENCIES = SOCKET_WRAPPER
diff --git a/source4/nsswitch/wbinfo.c b/source4/nsswitch/wbinfo.c
index 144c279279..b2748833e6 100644
--- a/source4/nsswitch/wbinfo.c
+++ b/source4/nsswitch/wbinfo.c
@@ -653,6 +653,7 @@ static const char *sid_type_lookup(enum lsa_SidType r)
case SID_NAME_DELETED: return "SID_NAME_DELETED"; break;
case SID_NAME_INVALID: return "SID_NAME_INVALID"; break;
case SID_NAME_UNKNOWN: return "SID_NAME_UNKNOWN"; break;
+ case SID_NAME_COMPUTER: return "SID_NAME_COMPUTER"; break;
}
return "Invalid sid type\n";
}
diff --git a/source4/ntptr/config.mk b/source4/ntptr/config.mk
index 38a582291f..4c1f46ff17 100644
--- a/source4/ntptr/config.mk
+++ b/source4/ntptr/config.mk
@@ -14,7 +14,7 @@ PRIVATE_DEPENDENCIES = \
################################################
# Start SUBSYSTEM ntptr
-[LIBRARY::ntptr]
+[SUBSYSTEM::ntptr]
PRIVATE_PROTO_HEADER = ntptr_proto.h
OBJ_FILES = \
ntptr_base.o \
diff --git a/source4/ntvfs/config.mk b/source4/ntvfs/config.mk
index ae8d5d9b4a..017614b7be 100644
--- a/source4/ntvfs/config.mk
+++ b/source4/ntvfs/config.mk
@@ -79,11 +79,8 @@ OBJ_FILES = \
################################################
# Start SUBSYSTEM NTVFS
-[LIBRARY::ntvfs]
+[SUBSYSTEM::ntvfs]
PUBLIC_HEADERS = ntvfs.h
-VERSION = 0.0.1
-SO_VERSION = 0
-DESCRIPTION = Virtual File System with NTFS semantics
PRIVATE_PROTO_HEADER = ntvfs_proto.h
OBJ_FILES = \
ntvfs_base.o \
diff --git a/source4/param/config.mk b/source4/param/config.mk
index b28f6639c0..f7d5d03d43 100644
--- a/source4/param/config.mk
+++ b/source4/param/config.mk
@@ -14,10 +14,7 @@ PUBLIC_HEADERS = param.h
#################################
# Start SUBSYSTEM share
-[LIBRARY::share]
-VERSION = 0.0.1
-SO_VERSION = 0
-DESCRIPTION = Services Configuration Library
+[SUBSYSTEM::share]
PUBLIC_HEADERS = share.h
PUBLIC_PROTO_HEADER = share_proto.h
OBJ_FILES = share.o
diff --git a/source4/param/param.i b/source4/param/param.i
index 353fa3ced6..eeecb0e5b9 100644
--- a/source4/param/param.i
+++ b/source4/param/param.i
@@ -290,3 +290,24 @@ typedef struct param_section {
%rename(default_config) global_loadparm;
struct loadparm_context *global_loadparm;
+
+%{
+
+struct loadparm_context *lp_from_py_object(PyObject *py_obj)
+{
+ struct loadparm_context *lp_ctx;
+ if (PyString_Check(py_obj)) {
+ lp_ctx = loadparm_init(NULL);
+ if (!lp_load(lp_ctx, PyString_AsString(py_obj))) {
+ talloc_free(lp_ctx);
+ return NULL;
+ }
+ return lp_ctx;
+ }
+
+ if (SWIG_ConvertPtr(py_obj, (void *)&lp_ctx, SWIGTYPE_p_loadparm_context, 0 | 0 ) < 0)
+ return NULL;
+ return lp_ctx;
+}
+
+%}
diff --git a/source4/param/param_wrap.c b/source4/param/param_wrap.c
index ca9fbb77b8..d8be725c5e 100644
--- a/source4/param/param_wrap.c
+++ b/source4/param/param_wrap.c
@@ -2760,6 +2760,26 @@ SWIGINTERN char const *param_opt___str__(param_opt *self){ return self->value; }
SWIGINTERN void delete_param_opt(param_opt *self){ talloc_free(self); }
SWIGINTERN struct param_opt *param_section_first_parameter(param_section *self){ return self->parameters; }
SWIGINTERN struct param_opt *param_section_next_parameter(param_section *self,struct param_opt *s){ return s->next; }
+
+
+struct loadparm_context *lp_from_py_object(PyObject *py_obj)
+{
+ struct loadparm_context *lp_ctx;
+ if (PyString_Check(py_obj)) {
+ lp_ctx = loadparm_init(NULL);
+ if (!lp_load(lp_ctx, PyString_AsString(py_obj))) {
+ talloc_free(lp_ctx);
+ return NULL;
+ }
+ return lp_ctx;
+ }
+
+ if (SWIG_ConvertPtr(py_obj, (void *)&lp_ctx, SWIGTYPE_p_loadparm_context, 0 | 0 ) < 0)
+ return NULL;
+ return lp_ctx;
+}
+
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/source4/pidl/MANIFEST b/source4/pidl/MANIFEST
index 7f30c3ab54..051c5d2b19 100644
--- a/source4/pidl/MANIFEST
+++ b/source4/pidl/MANIFEST
@@ -40,4 +40,4 @@ idl.yp
TODO
README
pidl
-META.yml Module meta-data (added by MakeMaker)
+META.yml
diff --git a/source4/pidl/META.yml b/source4/pidl/META.yml
new file mode 100644
index 0000000000..4822b50f09
--- /dev/null
+++ b/source4/pidl/META.yml
@@ -0,0 +1,18 @@
+name: Parse-Pidl
+abstract: Generate parsers / DCE/RPC-clients from IDL
+author:
+ - Andrew Tridgell <tridge@samba.org>
+ - Jelmer Vernooij <jelmer@samba.org>
+ - Stefan Metzmacher <metze@samba.org>
+ - Tim Potter <tpot@samba.org>
+license: gplv3
+installdirs: site
+homepage: http://www.samba.org/
+bugtracker: http://bugzilla.samba.org/
+requires:
+ Parse::Yapp: 0
+recommends:
+ Data::Dumper: 0
+meta-spec:
+ version: 1.3
+ url: http://module-build.sourceforge.net/META-spec-v1.3.html
diff --git a/source4/pidl/README b/source4/pidl/README
index 5bf7752da9..d678387282 100644
--- a/source4/pidl/README
+++ b/source4/pidl/README
@@ -40,6 +40,7 @@ Parse::Pidl::Samba4::NDR::Server - Generates server side implementation in C
Parse::Pidl::Samba4::TDR - Parser generator for the "Trivial Data Representation"
Parse::Pidl::Samba4::Template - Generates stubs in C for server implementation
Parse::Pidl::Samba4::EJS - Generates bindings for Embedded JavaScript (EJS)
+Parse::Pidl::Samba4::Python - Generates bindings for Python
-- Samba COM / DCOM --
Parse::Pidl::Samba4::COM::Proxy - Generates proxy object for DCOM (client-side)
diff --git a/source4/pidl/TODO b/source4/pidl/TODO
index 487d51d11e..f1cca0ab23 100644
--- a/source4/pidl/TODO
+++ b/source4/pidl/TODO
@@ -6,7 +6,6 @@
- compatibility mode for generating MIDL-readable data:
- strip out pidl-specific properties
-- remove declare in favor of typedef
- make bitmap an optional attribute on enum
- support nested elements
- support typedefs properly (e.g. allow "typedef void **bla;")
diff --git a/source4/pidl/idl.yp b/source4/pidl/idl.yp
index c372569a75..d2543c580c 100644
--- a/source4/pidl/idl.yp
+++ b/source4/pidl/idl.yp
@@ -93,7 +93,7 @@ definitions:
;
-definition: function | const | typedef | declare | typedecl
+definition: function | const | typedef | typedecl
;
const: 'const' identifier pointers identifier '=' anytext ';'
@@ -132,40 +132,6 @@ function: property_list type identifier '(' element_list2 ')' ';'
}}
;
-declare: 'declare' decl_type identifier';'
- {{
- "TYPE" => "DECLARE",
- "NAME" => $_[3],
- "DATA" => $_[2],
- "FILE" => $_[0]->YYData->{FILE},
- "LINE" => $_[0]->YYData->{LINE},
- }}
-;
-
-decl_type: decl_enum | decl_bitmap | decl_union
-;
-
-decl_enum: property_list 'enum'
- {{
- "TYPE" => "ENUM",
- "PROPERTIES" => $_[1]
- }}
-;
-
-decl_bitmap: property_list 'bitmap'
- {{
- "TYPE" => "BITMAP",
- "PROPERTIES" => $_[1]
- }}
-;
-
-decl_union: property_list 'union'
- {{
- "TYPE" => "UNION",
- "PROPERTIES" => $_[1]
- }}
-;
-
typedef: property_list 'typedef' type identifier array_len ';'
{{
"TYPE" => "TYPEDEF",
@@ -476,7 +442,7 @@ again:
if (s/^([\w_]+)//) {
$parser->YYData->{LAST_TOKEN} = $1;
if ($1 =~
- /^(coclass|interface|const|typedef|declare|union|cpp_quote
+ /^(coclass|interface|const|typedef|union|cpp_quote
|struct|enum|bitmap|void|unsigned|signed|import|include
|importlib)$/x) {
return $1;
diff --git a/source4/pidl/lib/Parse/Pidl.pm b/source4/pidl/lib/Parse/Pidl.pm
index 0c6e0e5727..c2c9463d03 100644
--- a/source4/pidl/lib/Parse/Pidl.pm
+++ b/source4/pidl/lib/Parse/Pidl.pm
@@ -9,7 +9,7 @@ package Parse::Pidl;
require Exporter;
@ISA = qw(Exporter);
-@EXPORT_OK = qw(warning error fatal);
+@EXPORT_OK = qw(warning error fatal $VERSION);
use strict;
diff --git a/source4/pidl/lib/Parse/Pidl/CUtil.pm b/source4/pidl/lib/Parse/Pidl/CUtil.pm
new file mode 100644
index 0000000000..bd7b16812c
--- /dev/null
+++ b/source4/pidl/lib/Parse/Pidl/CUtil.pm
@@ -0,0 +1,39 @@
+###################################################
+# C utility functions for pidl
+# Copyright jelmer@samba.org 2005-2007
+# released under the GNU GPL
+package Parse::Pidl::CUtil;
+
+require Exporter;
+@ISA = qw(Exporter);
+@EXPORT = qw(get_pointer_to get_value_of);
+use vars qw($VERSION);
+$VERSION = '0.01';
+
+use strict;
+
+sub get_pointer_to($)
+{
+ my $var_name = shift;
+
+ if ($var_name =~ /^\*(.*)$/) {
+ return $1;
+ } elsif ($var_name =~ /^\&(.*)$/) {
+ return "&($var_name)";
+ } else {
+ return "&$var_name";
+ }
+}
+
+sub get_value_of($)
+{
+ my $var_name = shift;
+
+ if ($var_name =~ /^\&(.*)$/) {
+ return $1;
+ } else {
+ return "*$var_name";
+ }
+}
+
+1;
diff --git a/source4/pidl/lib/Parse/Pidl/Compat.pm b/source4/pidl/lib/Parse/Pidl/Compat.pm
index f1241ef341..7939bb2df2 100644
--- a/source4/pidl/lib/Parse/Pidl/Compat.pm
+++ b/source4/pidl/lib/Parse/Pidl/Compat.pm
@@ -152,13 +152,6 @@ sub CheckInterface($)
$if->{PROPERTIES}->{pointer_default_top} ne "ref") {
warning($if, "pointer_default_top() is pidl-specific");
}
-
- foreach my $x (@{$if->{DATA}}) {
- if ($x->{TYPE} eq "DECLARE") {
- warning($if, "the declare keyword is pidl-specific");
- next;
- }
- }
}
sub Check($)
diff --git a/source4/pidl/lib/Parse/Pidl/IDL.pm b/source4/pidl/lib/Parse/Pidl/IDL.pm
index e9155e4e00..35e1d7bcd7 100644
--- a/source4/pidl/lib/Parse/Pidl/IDL.pm
+++ b/source4/pidl/lib/Parse/Pidl/IDL.pm
@@ -38,7 +38,7 @@ sub new {
"import" => 7,
"include" => 13
},
- DEFAULT => -91,
+ DEFAULT => -83,
GOTOS => {
'cpp_quote' => 11,
'importlib' => 10,
@@ -124,7 +124,7 @@ sub new {
}
},
{#State 16
- DEFAULT => -124
+ DEFAULT => -116
},
{#State 17
DEFAULT => -11
@@ -184,7 +184,7 @@ sub new {
}
},
{#State 26
- DEFAULT => -120
+ DEFAULT => -112
},
{#State 27
ACTIONS => {
@@ -206,10 +206,10 @@ sub new {
ACTIONS => {
"(" => 40
},
- DEFAULT => -95
+ DEFAULT => -87
},
{#State 31
- DEFAULT => -93
+ DEFAULT => -85
},
{#State 32
DEFAULT => -8
@@ -231,10 +231,9 @@ sub new {
},
{#State 37
ACTIONS => {
- "declare" => 49,
- "const" => 53
+ "const" => 51
},
- DEFAULT => -91,
+ DEFAULT => -83,
GOTOS => {
'typedecl' => 42,
'function' => 43,
@@ -243,12 +242,11 @@ sub new {
'definition' => 48,
'property_list' => 47,
'usertype' => 46,
- 'const' => 52,
- 'declare' => 51,
- 'struct' => 50,
- 'typedef' => 55,
- 'enum' => 54,
- 'union' => 56
+ 'const' => 50,
+ 'struct' => 49,
+ 'typedef' => 53,
+ 'enum' => 52,
+ 'union' => 54
}
},
{#State 38
@@ -257,1539 +255,1482 @@ sub new {
},
GOTOS => {
'identifier' => 30,
- 'property' => 57
+ 'property' => 55
}
},
{#State 39
- DEFAULT => -92
+ DEFAULT => -84
},
{#State 40
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'text' => 63,
- 'listtext' => 59,
- 'anytext' => 58,
- 'constant' => 60
+ 'identifier' => 60,
+ 'text' => 61,
+ 'listtext' => 57,
+ 'anytext' => 56,
+ 'constant' => 58
}
},
{#State 41
ACTIONS => {
- "}" => 64,
- "interface" => 65
+ "}" => 62,
+ "interface" => 63
}
},
{#State 42
- DEFAULT => -24
+ DEFAULT => -23
},
{#State 43
DEFAULT => -20
},
{#State 44
- DEFAULT => -39
+ DEFAULT => -31
},
{#State 45
ACTIONS => {
- "}" => 66,
- "declare" => 49,
- "const" => 53
+ "}" => 64,
+ "const" => 51
},
- DEFAULT => -91,
+ DEFAULT => -83,
GOTOS => {
'typedecl' => 42,
'function' => 43,
'bitmap' => 44,
- 'definition' => 67,
+ 'definition' => 65,
'property_list' => 47,
'usertype' => 46,
- 'const' => 52,
- 'struct' => 50,
- 'declare' => 51,
- 'typedef' => 55,
- 'enum' => 54,
- 'union' => 56
+ 'struct' => 49,
+ 'const' => 50,
+ 'typedef' => 53,
+ 'enum' => 52,
+ 'union' => 54
}
},
{#State 46
ACTIONS => {
- ";" => 68
+ ";" => 66
}
},
{#State 47
ACTIONS => {
- "typedef" => 69,
+ "typedef" => 67,
'IDENTIFIER' => 26,
- "signed" => 77,
- "union" => 70,
- "enum" => 79,
- "bitmap" => 80,
- 'void' => 71,
- "unsigned" => 81,
+ "signed" => 75,
+ "union" => 68,
+ "enum" => 77,
+ "bitmap" => 78,
+ 'void' => 69,
+ "unsigned" => 79,
"[" => 20,
- "struct" => 76
+ "struct" => 74
},
GOTOS => {
- 'existingtype' => 78,
+ 'existingtype' => 76,
'bitmap' => 44,
- 'usertype' => 73,
- 'property_list' => 72,
- 'identifier' => 74,
- 'struct' => 50,
- 'enum' => 54,
- 'type' => 82,
- 'union' => 56,
- 'sign' => 75
+ 'usertype' => 71,
+ 'property_list' => 70,
+ 'identifier' => 72,
+ 'struct' => 49,
+ 'enum' => 52,
+ 'type' => 80,
+ 'union' => 54,
+ 'sign' => 73
}
},
{#State 48
DEFAULT => -18
},
{#State 49
- DEFAULT => -91,
- GOTOS => {
- 'decl_enum' => 84,
- 'decl_bitmap' => 85,
- 'decl_type' => 87,
- 'decl_union' => 86,
- 'property_list' => 83
- }
+ DEFAULT => -28
},
{#State 50
- DEFAULT => -36
- },
- {#State 51
- DEFAULT => -23
- },
- {#State 52
DEFAULT => -21
},
- {#State 53
+ {#State 51
ACTIONS => {
'IDENTIFIER' => 26
},
GOTOS => {
- 'identifier' => 88
+ 'identifier' => 81
}
},
+ {#State 52
+ DEFAULT => -30
+ },
+ {#State 53
+ DEFAULT => -22
+ },
{#State 54
- DEFAULT => -38
+ DEFAULT => -29
},
{#State 55
- DEFAULT => -22
+ DEFAULT => -86
},
{#State 56
- DEFAULT => -37
+ ACTIONS => {
+ "-" => 83,
+ ":" => 82,
+ "<" => 84,
+ "+" => 86,
+ "~" => 85,
+ "*" => 87,
+ "?" => 88,
+ "{" => 89,
+ "&" => 90,
+ "/" => 91,
+ "=" => 92,
+ "(" => 93,
+ "|" => 94,
+ "." => 95,
+ ">" => 96
+ },
+ DEFAULT => -89
},
{#State 57
- DEFAULT => -94
+ ACTIONS => {
+ "," => 97,
+ ")" => 98
+ }
},
{#State 58
- ACTIONS => {
- "-" => 90,
- ":" => 89,
- "<" => 91,
- "+" => 93,
- "~" => 92,
- "*" => 94,
- "?" => 95,
- "{" => 96,
- "&" => 97,
- "/" => 98,
- "=" => 99,
- "(" => 100,
- "|" => 101,
- "." => 102,
- ">" => 103
- },
- DEFAULT => -97
+ DEFAULT => -95
},
{#State 59
- ACTIONS => {
- "," => 104,
- ")" => 105
- }
+ DEFAULT => -115
},
{#State 60
- DEFAULT => -103
+ DEFAULT => -94
},
{#State 61
- DEFAULT => -123
+ DEFAULT => -96
},
{#State 62
- DEFAULT => -102
- },
- {#State 63
- DEFAULT => -104
- },
- {#State 64
ACTIONS => {
- ";" => 106
+ ";" => 99
},
- DEFAULT => -125,
+ DEFAULT => -117,
GOTOS => {
- 'optional_semicolon' => 107
+ 'optional_semicolon' => 100
}
},
- {#State 65
+ {#State 63
ACTIONS => {
'IDENTIFIER' => 26
},
GOTOS => {
- 'identifier' => 108
+ 'identifier' => 101
}
},
- {#State 66
+ {#State 64
ACTIONS => {
- ";" => 106
+ ";" => 99
},
- DEFAULT => -125,
+ DEFAULT => -117,
GOTOS => {
- 'optional_semicolon' => 109
+ 'optional_semicolon' => 102
}
},
- {#State 67
+ {#State 65
DEFAULT => -19
},
- {#State 68
- DEFAULT => -40
+ {#State 66
+ DEFAULT => -32
},
- {#State 69
+ {#State 67
ACTIONS => {
'IDENTIFIER' => 26,
- "signed" => 77,
- 'void' => 71,
- "unsigned" => 81
+ "signed" => 75,
+ 'void' => 69,
+ "unsigned" => 79
},
- DEFAULT => -91,
+ DEFAULT => -83,
GOTOS => {
- 'existingtype' => 78,
+ 'existingtype' => 76,
'bitmap' => 44,
- 'usertype' => 73,
- 'property_list' => 72,
- 'identifier' => 74,
- 'struct' => 50,
- 'enum' => 54,
- 'type' => 110,
- 'union' => 56,
- 'sign' => 75
+ 'usertype' => 71,
+ 'property_list' => 70,
+ 'identifier' => 72,
+ 'struct' => 49,
+ 'enum' => 52,
+ 'type' => 103,
+ 'union' => 54,
+ 'sign' => 73
}
},
- {#State 70
+ {#State 68
ACTIONS => {
- 'IDENTIFIER' => 111
+ 'IDENTIFIER' => 104
},
- DEFAULT => -122,
+ DEFAULT => -114,
GOTOS => {
- 'optional_identifier' => 112
+ 'optional_identifier' => 105
}
},
- {#State 71
- DEFAULT => -47
+ {#State 69
+ DEFAULT => -39
},
- {#State 72
+ {#State 70
ACTIONS => {
- "union" => 70,
- "enum" => 79,
- "bitmap" => 80,
+ "union" => 68,
+ "enum" => 77,
+ "bitmap" => 78,
"[" => 20,
- "struct" => 76
+ "struct" => 74
}
},
- {#State 73
- DEFAULT => -45
+ {#State 71
+ DEFAULT => -37
},
- {#State 74
- DEFAULT => -44
+ {#State 72
+ DEFAULT => -36
},
- {#State 75
+ {#State 73
ACTIONS => {
'IDENTIFIER' => 26
},
GOTOS => {
- 'identifier' => 113
+ 'identifier' => 106
}
},
- {#State 76
+ {#State 74
ACTIONS => {
- 'IDENTIFIER' => 111
+ 'IDENTIFIER' => 104
},
- DEFAULT => -122,
+ DEFAULT => -114,
GOTOS => {
- 'optional_identifier' => 114
+ 'optional_identifier' => 107
}
},
- {#State 77
- DEFAULT => -41
- },
- {#State 78
- DEFAULT => -46
+ {#State 75
+ DEFAULT => -33
},
- {#State 79
- ACTIONS => {
- 'IDENTIFIER' => 111
- },
- DEFAULT => -122,
- GOTOS => {
- 'optional_identifier' => 115
- }
+ {#State 76
+ DEFAULT => -38
},
- {#State 80
+ {#State 77
ACTIONS => {
- 'IDENTIFIER' => 111
+ 'IDENTIFIER' => 104
},
- DEFAULT => -122,
+ DEFAULT => -114,
GOTOS => {
- 'optional_identifier' => 116
+ 'optional_identifier' => 108
}
},
- {#State 81
- DEFAULT => -42
- },
- {#State 82
+ {#State 78
ACTIONS => {
- 'IDENTIFIER' => 26
+ 'IDENTIFIER' => 104
},
+ DEFAULT => -114,
GOTOS => {
- 'identifier' => 117
- }
- },
- {#State 83
- ACTIONS => {
- "union" => 118,
- "enum" => 119,
- "bitmap" => 120,
- "[" => 20
+ 'optional_identifier' => 109
}
},
- {#State 84
- DEFAULT => -29
- },
- {#State 85
- DEFAULT => -30
- },
- {#State 86
- DEFAULT => -31
+ {#State 79
+ DEFAULT => -34
},
- {#State 87
+ {#State 80
ACTIONS => {
'IDENTIFIER' => 26
},
GOTOS => {
- 'identifier' => 121
+ 'identifier' => 110
}
},
- {#State 88
- DEFAULT => -80,
+ {#State 81
+ DEFAULT => -72,
GOTOS => {
- 'pointers' => 122
+ 'pointers' => 111
}
},
- {#State 89
+ {#State 82
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 123,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 112,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 90
+ {#State 83
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 124,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 113,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 91
+ {#State 84
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 125,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 114,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 92
+ {#State 85
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 126,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 115,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 93
+ {#State 86
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 127,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 116,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 94
+ {#State 87
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 128,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 117,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 95
+ {#State 88
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 129,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 118,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 96
+ {#State 89
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 130,
- 'text' => 63,
- 'constant' => 60,
- 'commalisttext' => 131
+ 'identifier' => 60,
+ 'anytext' => 119,
+ 'text' => 61,
+ 'constant' => 58,
+ 'commalisttext' => 120
}
},
- {#State 97
+ {#State 90
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 132,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 121,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 98
+ {#State 91
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 133,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 122,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 99
+ {#State 92
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 134,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 123,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 100
+ {#State 93
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 130,
- 'text' => 63,
- 'constant' => 60,
- 'commalisttext' => 135
+ 'identifier' => 60,
+ 'anytext' => 119,
+ 'text' => 61,
+ 'constant' => 58,
+ 'commalisttext' => 124
}
},
- {#State 101
+ {#State 94
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 136,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 125,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 102
+ {#State 95
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 137,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 126,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 103
+ {#State 96
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 138,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 127,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 104
+ {#State 97
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 139,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 128,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 105
- DEFAULT => -96
+ {#State 98
+ DEFAULT => -88
},
- {#State 106
- DEFAULT => -126
+ {#State 99
+ DEFAULT => -118
},
- {#State 107
+ {#State 100
DEFAULT => -13
},
- {#State 108
+ {#State 101
ACTIONS => {
- ";" => 140
+ ";" => 129
}
},
- {#State 109
+ {#State 102
DEFAULT => -16
},
- {#State 110
+ {#State 103
ACTIONS => {
'IDENTIFIER' => 26
},
GOTOS => {
- 'identifier' => 141
+ 'identifier' => 130
}
},
- {#State 111
- DEFAULT => -121
+ {#State 104
+ DEFAULT => -113
},
- {#State 112
+ {#State 105
ACTIONS => {
- "{" => 143
+ "{" => 132
},
- DEFAULT => -76,
+ DEFAULT => -68,
GOTOS => {
- 'union_body' => 144,
- 'opt_union_body' => 142
+ 'union_body' => 133,
+ 'opt_union_body' => 131
}
},
- {#State 113
- DEFAULT => -43
+ {#State 106
+ DEFAULT => -35
},
- {#State 114
+ {#State 107
ACTIONS => {
- "{" => 146
+ "{" => 135
},
- DEFAULT => -66,
+ DEFAULT => -58,
GOTOS => {
- 'struct_body' => 145,
- 'opt_struct_body' => 147
+ 'struct_body' => 134,
+ 'opt_struct_body' => 136
}
},
- {#State 115
+ {#State 108
ACTIONS => {
- "{" => 148
+ "{" => 137
},
- DEFAULT => -49,
+ DEFAULT => -41,
GOTOS => {
- 'opt_enum_body' => 150,
- 'enum_body' => 149
+ 'opt_enum_body' => 139,
+ 'enum_body' => 138
}
},
- {#State 116
+ {#State 109
ACTIONS => {
- "{" => 152
+ "{" => 141
},
- DEFAULT => -57,
+ DEFAULT => -49,
GOTOS => {
- 'bitmap_body' => 153,
- 'opt_bitmap_body' => 151
+ 'bitmap_body' => 142,
+ 'opt_bitmap_body' => 140
}
},
- {#State 117
- ACTIONS => {
- "(" => 154
- }
- },
- {#State 118
- DEFAULT => -34
- },
- {#State 119
- DEFAULT => -32
- },
- {#State 120
- DEFAULT => -33
- },
- {#State 121
+ {#State 110
ACTIONS => {
- ";" => 155
+ "(" => 143
}
},
- {#State 122
+ {#State 111
ACTIONS => {
'IDENTIFIER' => 26,
- "*" => 157
+ "*" => 145
},
GOTOS => {
- 'identifier' => 156
+ 'identifier' => 144
}
},
- {#State 123
- ACTIONS => {
- "-" => 90,
- ":" => 89,
- "<" => 91,
- "+" => 93,
- "~" => 92,
- "*" => 94,
- "?" => 95,
- "{" => 96,
- "&" => 97,
- "/" => 98,
- "=" => 99,
- "(" => 100,
- "|" => 101,
- "." => 102,
- ">" => 103
- },
- DEFAULT => -114
- },
- {#State 124
+ {#State 112
ACTIONS => {
- ":" => 89,
- "<" => 91,
- "~" => 92,
- "?" => 95,
- "{" => 96,
- "=" => 99
+ "-" => 83,
+ ":" => 82,
+ "<" => 84,
+ "+" => 86,
+ "~" => 85,
+ "*" => 87,
+ "?" => 88,
+ "{" => 89,
+ "&" => 90,
+ "/" => 91,
+ "=" => 92,
+ "(" => 93,
+ "|" => 94,
+ "." => 95,
+ ">" => 96
},
- DEFAULT => -105
+ DEFAULT => -106
},
- {#State 125
+ {#State 113
ACTIONS => {
- "-" => 90,
- ":" => 89,
- "<" => 91,
- "+" => 93,
- "~" => 92,
- "*" => 94,
- "?" => 95,
- "{" => 96,
- "&" => 97,
- "/" => 98,
- "=" => 99,
- "(" => 100,
- "|" => 101,
- "." => 102,
- ">" => 103
+ ":" => 82,
+ "<" => 84,
+ "~" => 85,
+ "?" => 88,
+ "{" => 89,
+ "=" => 92
},
- DEFAULT => -109
+ DEFAULT => -97
},
- {#State 126
+ {#State 114
ACTIONS => {
- "-" => 90,
- ":" => 89,
- "<" => 91,
- "+" => 93,
- "~" => 92,
- "*" => 94,
- "?" => 95,
- "{" => 96,
- "&" => 97,
- "/" => 98,
- "=" => 99,
- "(" => 100,
- "|" => 101,
- "." => 102,
- ">" => 103
- },
- DEFAULT => -117
+ "-" => 83,
+ ":" => 82,
+ "<" => 84,
+ "+" => 86,
+ "~" => 85,
+ "*" => 87,
+ "?" => 88,
+ "{" => 89,
+ "&" => 90,
+ "/" => 91,
+ "=" => 92,
+ "(" => 93,
+ "|" => 94,
+ "." => 95,
+ ">" => 96
+ },
+ DEFAULT => -101
},
- {#State 127
+ {#State 115
ACTIONS => {
- ":" => 89,
- "<" => 91,
- "~" => 92,
- "?" => 95,
- "{" => 96,
- "=" => 99
+ "-" => 83,
+ ":" => 82,
+ "<" => 84,
+ "+" => 86,
+ "~" => 85,
+ "*" => 87,
+ "?" => 88,
+ "{" => 89,
+ "&" => 90,
+ "/" => 91,
+ "=" => 92,
+ "(" => 93,
+ "|" => 94,
+ "." => 95,
+ ">" => 96
},
- DEFAULT => -116
+ DEFAULT => -109
},
- {#State 128
+ {#State 116
ACTIONS => {
- ":" => 89,
- "<" => 91,
- "~" => 92,
- "?" => 95,
- "{" => 96,
- "=" => 99
+ ":" => 82,
+ "<" => 84,
+ "~" => 85,
+ "?" => 88,
+ "{" => 89,
+ "=" => 92
},
- DEFAULT => -107
+ DEFAULT => -108
},
- {#State 129
+ {#State 117
ACTIONS => {
- "-" => 90,
- ":" => 89,
- "<" => 91,
- "+" => 93,
- "~" => 92,
- "*" => 94,
- "?" => 95,
- "{" => 96,
- "&" => 97,
- "/" => 98,
- "=" => 99,
- "(" => 100,
- "|" => 101,
- "." => 102,
- ">" => 103
+ ":" => 82,
+ "<" => 84,
+ "~" => 85,
+ "?" => 88,
+ "{" => 89,
+ "=" => 92
},
- DEFAULT => -113
+ DEFAULT => -99
},
- {#State 130
+ {#State 118
ACTIONS => {
- "-" => 90,
- ":" => 89,
- "<" => 91,
- "+" => 93,
- "~" => 92,
- "*" => 94,
- "?" => 95,
- "{" => 96,
- "&" => 97,
- "/" => 98,
- "=" => 99,
- "(" => 100,
- "|" => 101,
- "." => 102,
- ">" => 103
+ "-" => 83,
+ ":" => 82,
+ "<" => 84,
+ "+" => 86,
+ "~" => 85,
+ "*" => 87,
+ "?" => 88,
+ "{" => 89,
+ "&" => 90,
+ "/" => 91,
+ "=" => 92,
+ "(" => 93,
+ "|" => 94,
+ "." => 95,
+ ">" => 96
},
- DEFAULT => -99
+ DEFAULT => -105
},
- {#State 131
+ {#State 119
ACTIONS => {
- "}" => 158,
- "," => 159
+ "-" => 83,
+ ":" => 82,
+ "<" => 84,
+ "+" => 86,
+ "~" => 85,
+ "*" => 87,
+ "?" => 88,
+ "{" => 89,
+ "&" => 90,
+ "/" => 91,
+ "=" => 92,
+ "(" => 93,
+ "|" => 94,
+ "." => 95,
+ ">" => 96
+ },
+ DEFAULT => -91
+ },
+ {#State 120
+ ACTIONS => {
+ "}" => 146,
+ "," => 147
}
},
- {#State 132
+ {#State 121
ACTIONS => {
- ":" => 89,
- "<" => 91,
- "~" => 92,
- "?" => 95,
- "{" => 96,
- "=" => 99
+ ":" => 82,
+ "<" => 84,
+ "~" => 85,
+ "?" => 88,
+ "{" => 89,
+ "=" => 92
},
- DEFAULT => -111
+ DEFAULT => -103
},
- {#State 133
+ {#State 122
ACTIONS => {
- ":" => 89,
- "<" => 91,
- "~" => 92,
- "?" => 95,
- "{" => 96,
- "=" => 99
+ ":" => 82,
+ "<" => 84,
+ "~" => 85,
+ "?" => 88,
+ "{" => 89,
+ "=" => 92
},
- DEFAULT => -112
+ DEFAULT => -104
},
- {#State 134
+ {#State 123
ACTIONS => {
- "-" => 90,
- ":" => 89,
- "<" => 91,
- "+" => 93,
- "~" => 92,
- "*" => 94,
- "?" => 95,
- "{" => 96,
- "&" => 97,
- "/" => 98,
- "=" => 99,
- "(" => 100,
- "|" => 101,
- "." => 102,
- ">" => 103
+ "-" => 83,
+ ":" => 82,
+ "<" => 84,
+ "+" => 86,
+ "~" => 85,
+ "*" => 87,
+ "?" => 88,
+ "{" => 89,
+ "&" => 90,
+ "/" => 91,
+ "=" => 92,
+ "(" => 93,
+ "|" => 94,
+ "." => 95,
+ ">" => 96
},
- DEFAULT => -115
+ DEFAULT => -107
},
- {#State 135
+ {#State 124
ACTIONS => {
- "," => 159,
- ")" => 160
+ "," => 147,
+ ")" => 148
}
},
- {#State 136
+ {#State 125
ACTIONS => {
- ":" => 89,
- "<" => 91,
- "~" => 92,
- "?" => 95,
- "{" => 96,
- "=" => 99
+ ":" => 82,
+ "<" => 84,
+ "~" => 85,
+ "?" => 88,
+ "{" => 89,
+ "=" => 92
},
- DEFAULT => -110
+ DEFAULT => -102
},
- {#State 137
+ {#State 126
ACTIONS => {
- ":" => 89,
- "<" => 91,
- "~" => 92,
- "?" => 95,
- "{" => 96,
- "=" => 99
+ ":" => 82,
+ "<" => 84,
+ "~" => 85,
+ "?" => 88,
+ "{" => 89,
+ "=" => 92
},
- DEFAULT => -106
+ DEFAULT => -98
},
- {#State 138
+ {#State 127
ACTIONS => {
- ":" => 89,
- "<" => 91,
- "~" => 92,
- "?" => 95,
- "{" => 96,
- "=" => 99
+ ":" => 82,
+ "<" => 84,
+ "~" => 85,
+ "?" => 88,
+ "{" => 89,
+ "=" => 92
},
- DEFAULT => -108
+ DEFAULT => -100
},
- {#State 139
+ {#State 128
ACTIONS => {
- "-" => 90,
- ":" => 89,
- "<" => 91,
- "+" => 93,
- "~" => 92,
- "*" => 94,
- "?" => 95,
- "{" => 96,
- "&" => 97,
- "/" => 98,
- "=" => 99,
- "(" => 100,
- "|" => 101,
- "." => 102,
- ">" => 103
+ "-" => 83,
+ ":" => 82,
+ "<" => 84,
+ "+" => 86,
+ "~" => 85,
+ "*" => 87,
+ "?" => 88,
+ "{" => 89,
+ "&" => 90,
+ "/" => 91,
+ "=" => 92,
+ "(" => 93,
+ "|" => 94,
+ "." => 95,
+ ">" => 96
},
- DEFAULT => -98
+ DEFAULT => -90
},
- {#State 140
+ {#State 129
DEFAULT => -15
},
- {#State 141
+ {#State 130
ACTIONS => {
- "[" => 161
+ "[" => 149
},
- DEFAULT => -88,
+ DEFAULT => -80,
GOTOS => {
- 'array_len' => 162
+ 'array_len' => 150
}
},
- {#State 142
- DEFAULT => -78
+ {#State 131
+ DEFAULT => -70
},
- {#State 143
- DEFAULT => -73,
+ {#State 132
+ DEFAULT => -65,
GOTOS => {
- 'union_elements' => 163
+ 'union_elements' => 151
}
},
- {#State 144
- DEFAULT => -77
+ {#State 133
+ DEFAULT => -69
},
- {#State 145
- DEFAULT => -67
+ {#State 134
+ DEFAULT => -59
},
- {#State 146
- DEFAULT => -82,
+ {#State 135
+ DEFAULT => -74,
GOTOS => {
- 'element_list1' => 164
+ 'element_list1' => 152
}
},
- {#State 147
- DEFAULT => -68
+ {#State 136
+ DEFAULT => -60
},
- {#State 148
+ {#State 137
ACTIONS => {
'IDENTIFIER' => 26
},
GOTOS => {
- 'identifier' => 165,
- 'enum_element' => 166,
- 'enum_elements' => 167
+ 'identifier' => 153,
+ 'enum_element' => 154,
+ 'enum_elements' => 155
}
},
- {#State 149
- DEFAULT => -50
+ {#State 138
+ DEFAULT => -42
},
- {#State 150
- DEFAULT => -51
+ {#State 139
+ DEFAULT => -43
},
- {#State 151
- DEFAULT => -59
+ {#State 140
+ DEFAULT => -51
},
- {#State 152
+ {#State 141
ACTIONS => {
'IDENTIFIER' => 26
},
- DEFAULT => -62,
+ DEFAULT => -54,
GOTOS => {
- 'identifier' => 170,
- 'bitmap_element' => 169,
- 'bitmap_elements' => 168,
- 'opt_bitmap_elements' => 171
+ 'identifier' => 158,
+ 'bitmap_element' => 157,
+ 'bitmap_elements' => 156,
+ 'opt_bitmap_elements' => 159
}
},
- {#State 153
- DEFAULT => -58
+ {#State 142
+ DEFAULT => -50
},
- {#State 154
+ {#State 143
ACTIONS => {
- "," => -84,
- "void" => 175,
- ")" => -84
+ "," => -76,
+ "void" => 163,
+ ")" => -76
},
- DEFAULT => -91,
+ DEFAULT => -83,
GOTOS => {
- 'base_element' => 172,
- 'element_list2' => 174,
- 'property_list' => 173
+ 'base_element' => 160,
+ 'element_list2' => 162,
+ 'property_list' => 161
}
},
- {#State 155
- DEFAULT => -28
- },
- {#State 156
+ {#State 144
ACTIONS => {
- "[" => 161,
- "=" => 177
+ "[" => 149,
+ "=" => 165
},
GOTOS => {
- 'array_len' => 176
+ 'array_len' => 164
}
},
- {#State 157
- DEFAULT => -81
+ {#State 145
+ DEFAULT => -73
},
- {#State 158
+ {#State 146
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 178,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 166,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 159
+ {#State 147
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 179,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 167,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 160
+ {#State 148
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 180,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 168,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 161
+ {#State 149
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
- "]" => 181,
+ "]" => 169,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 182,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 170,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 162
+ {#State 150
ACTIONS => {
- ";" => 183
+ ";" => 171
}
},
- {#State 163
+ {#State 151
ACTIONS => {
- "}" => 184
+ "}" => 172
},
- DEFAULT => -91,
+ DEFAULT => -83,
GOTOS => {
- 'optional_base_element' => 186,
- 'property_list' => 185
+ 'optional_base_element' => 174,
+ 'property_list' => 173
}
},
- {#State 164
+ {#State 152
ACTIONS => {
- "}" => 187
+ "}" => 175
},
- DEFAULT => -91,
+ DEFAULT => -83,
GOTOS => {
- 'base_element' => 188,
- 'property_list' => 173
+ 'base_element' => 176,
+ 'property_list' => 161
}
},
- {#State 165
+ {#State 153
ACTIONS => {
- "=" => 189
+ "=" => 177
},
- DEFAULT => -54
+ DEFAULT => -46
},
- {#State 166
- DEFAULT => -52
+ {#State 154
+ DEFAULT => -44
},
- {#State 167
+ {#State 155
ACTIONS => {
- "}" => 190,
- "," => 191
+ "}" => 178,
+ "," => 179
}
},
- {#State 168
+ {#State 156
ACTIONS => {
- "," => 192
+ "," => 180
},
- DEFAULT => -63
+ DEFAULT => -55
},
- {#State 169
- DEFAULT => -60
+ {#State 157
+ DEFAULT => -52
},
- {#State 170
+ {#State 158
ACTIONS => {
- "=" => 193
+ "=" => 181
}
},
- {#State 171
+ {#State 159
ACTIONS => {
- "}" => 194
+ "}" => 182
}
},
- {#State 172
- DEFAULT => -86
+ {#State 160
+ DEFAULT => -78
},
- {#State 173
+ {#State 161
ACTIONS => {
'IDENTIFIER' => 26,
- "signed" => 77,
- 'void' => 71,
- "unsigned" => 81,
+ "signed" => 75,
+ 'void' => 69,
+ "unsigned" => 79,
"[" => 20
},
- DEFAULT => -91,
+ DEFAULT => -83,
GOTOS => {
- 'existingtype' => 78,
+ 'existingtype' => 76,
'bitmap' => 44,
- 'usertype' => 73,
- 'property_list' => 72,
- 'identifier' => 74,
- 'struct' => 50,
- 'enum' => 54,
- 'type' => 195,
- 'union' => 56,
- 'sign' => 75
+ 'usertype' => 71,
+ 'property_list' => 70,
+ 'identifier' => 72,
+ 'struct' => 49,
+ 'enum' => 52,
+ 'type' => 183,
+ 'union' => 54,
+ 'sign' => 73
}
},
- {#State 174
+ {#State 162
ACTIONS => {
- "," => 196,
- ")" => 197
+ "," => 184,
+ ")" => 185
}
},
- {#State 175
- DEFAULT => -85
+ {#State 163
+ DEFAULT => -77
},
- {#State 176
+ {#State 164
ACTIONS => {
- "=" => 198
+ "=" => 186
}
},
- {#State 177
+ {#State 165
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 199,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 187,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 178
+ {#State 166
ACTIONS => {
- "-" => 90,
- ":" => 89,
- "<" => 91,
- "+" => 93,
- "~" => 92,
- "*" => 94,
- "?" => 95,
- "{" => 96,
- "&" => 97,
- "/" => 98,
- "=" => 99,
- "(" => 100,
- "|" => 101,
- "." => 102,
- ">" => 103
- },
- DEFAULT => -119
+ "-" => 83,
+ ":" => 82,
+ "<" => 84,
+ "+" => 86,
+ "~" => 85,
+ "*" => 87,
+ "?" => 88,
+ "{" => 89,
+ "&" => 90,
+ "/" => 91,
+ "=" => 92,
+ "(" => 93,
+ "|" => 94,
+ "." => 95,
+ ">" => 96
+ },
+ DEFAULT => -111
},
- {#State 179
+ {#State 167
ACTIONS => {
- "-" => 90,
- ":" => 89,
- "<" => 91,
- "+" => 93,
- "~" => 92,
- "*" => 94,
- "?" => 95,
- "{" => 96,
- "&" => 97,
- "/" => 98,
- "=" => 99,
- "(" => 100,
- "|" => 101,
- "." => 102,
- ">" => 103
+ "-" => 83,
+ ":" => 82,
+ "<" => 84,
+ "+" => 86,
+ "~" => 85,
+ "*" => 87,
+ "?" => 88,
+ "{" => 89,
+ "&" => 90,
+ "/" => 91,
+ "=" => 92,
+ "(" => 93,
+ "|" => 94,
+ "." => 95,
+ ">" => 96
},
- DEFAULT => -100
+ DEFAULT => -92
},
- {#State 180
+ {#State 168
ACTIONS => {
- ":" => 89,
- "<" => 91,
- "~" => 92,
- "?" => 95,
- "{" => 96,
- "=" => 99
+ ":" => 82,
+ "<" => 84,
+ "~" => 85,
+ "?" => 88,
+ "{" => 89,
+ "=" => 92
},
- DEFAULT => -118
+ DEFAULT => -110
},
- {#State 181
+ {#State 169
ACTIONS => {
- "[" => 161
+ "[" => 149
},
- DEFAULT => -88,
+ DEFAULT => -80,
GOTOS => {
- 'array_len' => 200
+ 'array_len' => 188
}
},
- {#State 182
+ {#State 170
ACTIONS => {
- "-" => 90,
- ":" => 89,
- "?" => 95,
- "<" => 91,
- "+" => 93,
- "~" => 92,
- "&" => 97,
- "{" => 96,
- "/" => 98,
- "=" => 99,
- "|" => 101,
- "(" => 100,
- "*" => 94,
- "." => 102,
- "]" => 201,
- ">" => 103
+ "-" => 83,
+ ":" => 82,
+ "?" => 88,
+ "<" => 84,
+ "+" => 86,
+ "~" => 85,
+ "&" => 90,
+ "{" => 89,
+ "/" => 91,
+ "=" => 92,
+ "|" => 94,
+ "(" => 93,
+ "*" => 87,
+ "." => 95,
+ "]" => 189,
+ ">" => 96
}
},
- {#State 183
- DEFAULT => -35
+ {#State 171
+ DEFAULT => -27
},
- {#State 184
- DEFAULT => -75
+ {#State 172
+ DEFAULT => -67
},
- {#State 185
+ {#State 173
ACTIONS => {
"[" => 20
},
- DEFAULT => -91,
+ DEFAULT => -83,
GOTOS => {
- 'base_or_empty' => 202,
- 'base_element' => 203,
- 'empty_element' => 204,
- 'property_list' => 205
+ 'base_or_empty' => 190,
+ 'base_element' => 191,
+ 'empty_element' => 192,
+ 'property_list' => 193
}
},
- {#State 186
- DEFAULT => -74
+ {#State 174
+ DEFAULT => -66
},
- {#State 187
- DEFAULT => -65
+ {#State 175
+ DEFAULT => -57
},
- {#State 188
+ {#State 176
ACTIONS => {
- ";" => 206
+ ";" => 194
}
},
- {#State 189
+ {#State 177
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 207,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 195,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 190
- DEFAULT => -48
+ {#State 178
+ DEFAULT => -40
},
- {#State 191
+ {#State 179
ACTIONS => {
'IDENTIFIER' => 26
},
GOTOS => {
- 'identifier' => 165,
- 'enum_element' => 208
+ 'identifier' => 153,
+ 'enum_element' => 196
}
},
- {#State 192
+ {#State 180
ACTIONS => {
'IDENTIFIER' => 26
},
GOTOS => {
- 'identifier' => 170,
- 'bitmap_element' => 209
+ 'identifier' => 158,
+ 'bitmap_element' => 197
}
},
- {#State 193
+ {#State 181
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 210,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 198,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 194
- DEFAULT => -56
+ {#State 182
+ DEFAULT => -48
},
- {#State 195
- DEFAULT => -80,
+ {#State 183
+ DEFAULT => -72,
GOTOS => {
- 'pointers' => 211
+ 'pointers' => 199
}
},
- {#State 196
- DEFAULT => -91,
+ {#State 184
+ DEFAULT => -83,
GOTOS => {
- 'base_element' => 212,
- 'property_list' => 173
+ 'base_element' => 200,
+ 'property_list' => 161
}
},
- {#State 197
+ {#State 185
ACTIONS => {
- ";" => 213
+ ";" => 201
}
},
- {#State 198
+ {#State 186
ACTIONS => {
- 'CONSTANT' => 61,
+ 'CONSTANT' => 59,
'TEXT' => 16,
'IDENTIFIER' => 26
},
- DEFAULT => -101,
+ DEFAULT => -93,
GOTOS => {
- 'identifier' => 62,
- 'anytext' => 214,
- 'text' => 63,
- 'constant' => 60
+ 'identifier' => 60,
+ 'anytext' => 202,
+ 'text' => 61,
+ 'constant' => 58
}
},
- {#State 199
+ {#State 187
ACTIONS => {
- "-" => 90,
- ":" => 89,
- "?" => 95,
- "<" => 91,
- ";" => 215,
- "+" => 93,
- "~" => 92,
- "&" => 97,
- "{" => 96,
- "/" => 98,
- "=" => 99,
- "|" => 101,
- "(" => 100,
- "*" => 94,
- "." => 102,
- ">" => 103
+ "-" => 83,
+ ":" => 82,
+ "?" => 88,
+ "<" => 84,
+ ";" => 203,
+ "+" => 86,
+ "~" => 85,
+ "&" => 90,
+ "{" => 89,
+ "/" => 91,
+ "=" => 92,
+ "|" => 94,
+ "(" => 93,
+ "*" => 87,
+ "." => 95,
+ ">" => 96
}
},
- {#State 200
- DEFAULT => -89
+ {#State 188
+ DEFAULT => -81
},
- {#State 201
+ {#State 189
ACTIONS => {
- "[" => 161
+ "[" => 149
},
- DEFAULT => -88,
+ DEFAULT => -80,
GOTOS => {
- 'array_len' => 216
+ 'array_len' => 204
}
},
- {#State 202
- DEFAULT => -72
+ {#State 190
+ DEFAULT => -64
},
- {#State 203
+ {#State 191
ACTIONS => {
- ";" => 217
+ ";" => 205
}
},
- {#State 204
- DEFAULT => -71
+ {#State 192
+ DEFAULT => -63
},
- {#State 205
+ {#State 193
ACTIONS => {
'IDENTIFIER' => 26,
- "signed" => 77,
- ";" => 218,
- 'void' => 71,
- "unsigned" => 81,
+ "signed" => 75,
+ ";" => 206,
+ 'void' => 69,
+ "unsigned" => 79,
"[" => 20
},
- DEFAULT => -91,
+ DEFAULT => -83,
GOTOS => {
- 'existingtype' => 78,
+ 'existingtype' => 76,
'bitmap' => 44,
- 'usertype' => 73,
- 'property_list' => 72,
- 'identifier' => 74,
- 'struct' => 50,
- 'enum' => 54,
- 'type' => 195,
- 'union' => 56,
- 'sign' => 75
+ 'usertype' => 71,
+ 'property_list' => 70,
+ 'identifier' => 72,
+ 'struct' => 49,
+ 'enum' => 52,
+ 'type' => 183,
+ 'union' => 54,
+ 'sign' => 73
}
},
- {#State 206
- DEFAULT => -83
+ {#State 194
+ DEFAULT => -75
},
- {#State 207
+ {#State 195
ACTIONS => {
- "-" => 90,
- ":" => 89,
- "<" => 91,
- "+" => 93,
- "~" => 92,
- "*" => 94,
- "?" => 95,
- "{" => 96,
- "&" => 97,
- "/" => 98,
- "=" => 99,
- "(" => 100,
- "|" => 101,
- "." => 102,
- ">" => 103
+ "-" => 83,
+ ":" => 82,
+ "<" => 84,
+ "+" => 86,
+ "~" => 85,
+ "*" => 87,
+ "?" => 88,
+ "{" => 89,
+ "&" => 90,
+ "/" => 91,
+ "=" => 92,
+ "(" => 93,
+ "|" => 94,
+ "." => 95,
+ ">" => 96
},
- DEFAULT => -55
+ DEFAULT => -47
},
- {#State 208
- DEFAULT => -53
+ {#State 196
+ DEFAULT => -45
},
- {#State 209
- DEFAULT => -61
+ {#State 197
+ DEFAULT => -53
},
- {#State 210
- ACTIONS => {
- "-" => 90,
- ":" => 89,
- "<" => 91,
- "+" => 93,
- "~" => 92,
- "*" => 94,
- "?" => 95,
- "{" => 96,
- "&" => 97,
- "/" => 98,
- "=" => 99,
- "(" => 100,
- "|" => 101,
- "." => 102,
- ">" => 103
+ {#State 198
+ ACTIONS => {
+ "-" => 83,
+ ":" => 82,
+ "<" => 84,
+ "+" => 86,
+ "~" => 85,
+ "*" => 87,
+ "?" => 88,
+ "{" => 89,
+ "&" => 90,
+ "/" => 91,
+ "=" => 92,
+ "(" => 93,
+ "|" => 94,
+ "." => 95,
+ ">" => 96
},
- DEFAULT => -64
+ DEFAULT => -56
},
- {#State 211
+ {#State 199
ACTIONS => {
'IDENTIFIER' => 26,
- "*" => 157
+ "*" => 145
},
GOTOS => {
- 'identifier' => 219
+ 'identifier' => 207
}
},
- {#State 212
- DEFAULT => -87
+ {#State 200
+ DEFAULT => -79
},
- {#State 213
- DEFAULT => -27
+ {#State 201
+ DEFAULT => -26
},
- {#State 214
- ACTIONS => {
- "-" => 90,
- ":" => 89,
- "?" => 95,
- "<" => 91,
- ";" => 220,
- "+" => 93,
- "~" => 92,
- "&" => 97,
- "{" => 96,
- "/" => 98,
- "=" => 99,
- "|" => 101,
- "(" => 100,
- "*" => 94,
- "." => 102,
- ">" => 103
- }
- },
- {#State 215
- DEFAULT => -25
+ {#State 202
+ ACTIONS => {
+ "-" => 83,
+ ":" => 82,
+ "?" => 88,
+ "<" => 84,
+ ";" => 208,
+ "+" => 86,
+ "~" => 85,
+ "&" => 90,
+ "{" => 89,
+ "/" => 91,
+ "=" => 92,
+ "|" => 94,
+ "(" => 93,
+ "*" => 87,
+ "." => 95,
+ ">" => 96
+ }
},
- {#State 216
- DEFAULT => -90
+ {#State 203
+ DEFAULT => -24
},
- {#State 217
- DEFAULT => -70
+ {#State 204
+ DEFAULT => -82
},
- {#State 218
- DEFAULT => -69
+ {#State 205
+ DEFAULT => -62
+ },
+ {#State 206
+ DEFAULT => -61
},
- {#State 219
+ {#State 207
ACTIONS => {
- "[" => 161
+ "[" => 149
},
- DEFAULT => -88,
+ DEFAULT => -80,
GOTOS => {
- 'array_len' => 221
+ 'array_len' => 209
}
},
- {#State 220
- DEFAULT => -26
+ {#State 208
+ DEFAULT => -25
},
- {#State 221
- DEFAULT => -79
+ {#State 209
+ DEFAULT => -71
}
],
yyrules =>
@@ -1952,9 +1893,6 @@ sub
'definition', 1, undef
],
[#Rule 24
- 'definition', 1, undef
- ],
- [#Rule 25
'const', 7,
sub
#line 100 "idl.yp"
@@ -1968,7 +1906,7 @@ sub
"LINE" => $_[0]->YYData->{LINE},
}}
],
- [#Rule 26
+ [#Rule 25
'const', 8,
sub
#line 110 "idl.yp"
@@ -1983,7 +1921,7 @@ sub
"LINE" => $_[0]->YYData->{LINE},
}}
],
- [#Rule 27
+ [#Rule 26
'function', 7,
sub
#line 124 "idl.yp"
@@ -1997,58 +1935,10 @@ sub
"LINE" => $_[0]->YYData->{LINE},
}}
],
- [#Rule 28
- 'declare', 4,
-sub
-#line 136 "idl.yp"
-{{
- "TYPE" => "DECLARE",
- "NAME" => $_[3],
- "DATA" => $_[2],
- "FILE" => $_[0]->YYData->{FILE},
- "LINE" => $_[0]->YYData->{LINE},
- }}
- ],
- [#Rule 29
- 'decl_type', 1, undef
- ],
- [#Rule 30
- 'decl_type', 1, undef
- ],
- [#Rule 31
- 'decl_type', 1, undef
- ],
- [#Rule 32
- 'decl_enum', 2,
-sub
-#line 149 "idl.yp"
-{{
- "TYPE" => "ENUM",
- "PROPERTIES" => $_[1]
- }}
- ],
- [#Rule 33
- 'decl_bitmap', 2,
-sub
-#line 156 "idl.yp"
-{{
- "TYPE" => "BITMAP",
- "PROPERTIES" => $_[1]
- }}
- ],
- [#Rule 34
- 'decl_union', 2,
-sub
-#line 163 "idl.yp"
-{{
- "TYPE" => "UNION",
- "PROPERTIES" => $_[1]
- }}
- ],
- [#Rule 35
+ [#Rule 27
'typedef', 6,
sub
-#line 170 "idl.yp"
+#line 136 "idl.yp"
{{
"TYPE" => "TYPEDEF",
"PROPERTIES" => $_[1],
@@ -2059,67 +1949,67 @@ sub
"LINE" => $_[0]->YYData->{LINE},
}}
],
- [#Rule 36
+ [#Rule 28
'usertype', 1, undef
],
- [#Rule 37
+ [#Rule 29
'usertype', 1, undef
],
- [#Rule 38
+ [#Rule 30
'usertype', 1, undef
],
- [#Rule 39
+ [#Rule 31
'usertype', 1, undef
],
- [#Rule 40
+ [#Rule 32
'typedecl', 2,
sub
-#line 183 "idl.yp"
+#line 149 "idl.yp"
{ $_[1] }
],
- [#Rule 41
+ [#Rule 33
'sign', 1, undef
],
- [#Rule 42
+ [#Rule 34
'sign', 1, undef
],
- [#Rule 43
+ [#Rule 35
'existingtype', 2,
sub
-#line 188 "idl.yp"
+#line 154 "idl.yp"
{ ($_[1]?$_[1]:"signed") ." $_[2]" }
],
- [#Rule 44
+ [#Rule 36
'existingtype', 1, undef
],
- [#Rule 45
+ [#Rule 37
'type', 1, undef
],
- [#Rule 46
+ [#Rule 38
'type', 1, undef
],
- [#Rule 47
+ [#Rule 39
'type', 1,
sub
-#line 192 "idl.yp"
+#line 158 "idl.yp"
{ "void" }
],
- [#Rule 48
+ [#Rule 40
'enum_body', 3,
sub
-#line 194 "idl.yp"
+#line 160 "idl.yp"
{ $_[2] }
],
- [#Rule 49
+ [#Rule 41
'opt_enum_body', 0, undef
],
- [#Rule 50
+ [#Rule 42
'opt_enum_body', 1, undef
],
- [#Rule 51
+ [#Rule 43
'enum', 4,
sub
-#line 197 "idl.yp"
+#line 163 "idl.yp"
{{
"TYPE" => "ENUM",
"PROPERTIES" => $_[1],
@@ -2127,43 +2017,43 @@ sub
"ELEMENTS" => $_[4]
}}
],
- [#Rule 52
+ [#Rule 44
'enum_elements', 1,
sub
-#line 206 "idl.yp"
+#line 172 "idl.yp"
{ [ $_[1] ] }
],
- [#Rule 53
+ [#Rule 45
'enum_elements', 3,
sub
-#line 207 "idl.yp"
+#line 173 "idl.yp"
{ push(@{$_[1]}, $_[3]); $_[1] }
],
- [#Rule 54
+ [#Rule 46
'enum_element', 1, undef
],
- [#Rule 55
+ [#Rule 47
'enum_element', 3,
sub
-#line 211 "idl.yp"
+#line 177 "idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 56
+ [#Rule 48
'bitmap_body', 3,
sub
-#line 214 "idl.yp"
+#line 180 "idl.yp"
{ $_[2] }
],
- [#Rule 57
+ [#Rule 49
'opt_bitmap_body', 0, undef
],
- [#Rule 58
+ [#Rule 50
'opt_bitmap_body', 1, undef
],
- [#Rule 59
+ [#Rule 51
'bitmap', 4,
sub
-#line 217 "idl.yp"
+#line 183 "idl.yp"
{{
"TYPE" => "BITMAP",
"PROPERTIES" => $_[1],
@@ -2171,46 +2061,46 @@ sub
"ELEMENTS" => $_[4]
}}
],
- [#Rule 60
+ [#Rule 52
'bitmap_elements', 1,
sub
-#line 226 "idl.yp"
+#line 192 "idl.yp"
{ [ $_[1] ] }
],
- [#Rule 61
+ [#Rule 53
'bitmap_elements', 3,
sub
-#line 227 "idl.yp"
+#line 193 "idl.yp"
{ push(@{$_[1]}, $_[3]); $_[1] }
],
- [#Rule 62
+ [#Rule 54
'opt_bitmap_elements', 0, undef
],
- [#Rule 63
+ [#Rule 55
'opt_bitmap_elements', 1, undef
],
- [#Rule 64
+ [#Rule 56
'bitmap_element', 3,
sub
-#line 232 "idl.yp"
+#line 198 "idl.yp"
{ "$_[1] ( $_[3] )" }
],
- [#Rule 65
+ [#Rule 57
'struct_body', 3,
sub
-#line 235 "idl.yp"
+#line 201 "idl.yp"
{ $_[2] }
],
- [#Rule 66
+ [#Rule 58
'opt_struct_body', 0, undef
],
- [#Rule 67
+ [#Rule 59
'opt_struct_body', 1, undef
],
- [#Rule 68
+ [#Rule 60
'struct', 4,
sub
-#line 239 "idl.yp"
+#line 205 "idl.yp"
{{
"TYPE" => "STRUCT",
"PROPERTIES" => $_[1],
@@ -2218,10 +2108,10 @@ sub
"ELEMENTS" => $_[4]
}}
],
- [#Rule 69
+ [#Rule 61
'empty_element', 2,
sub
-#line 248 "idl.yp"
+#line 214 "idl.yp"
{{
"NAME" => "",
"TYPE" => "EMPTY",
@@ -2232,43 +2122,43 @@ sub
"LINE" => $_[0]->YYData->{LINE},
}}
],
- [#Rule 70
+ [#Rule 62
'base_or_empty', 2, undef
],
- [#Rule 71
+ [#Rule 63
'base_or_empty', 1, undef
],
- [#Rule 72
+ [#Rule 64
'optional_base_element', 2,
sub
-#line 262 "idl.yp"
+#line 228 "idl.yp"
{ $_[2]->{PROPERTIES} = FlattenHash([$_[1],$_[2]->{PROPERTIES}]); $_[2] }
],
- [#Rule 73
+ [#Rule 65
'union_elements', 0, undef
],
- [#Rule 74
+ [#Rule 66
'union_elements', 2,
sub
-#line 267 "idl.yp"
+#line 233 "idl.yp"
{ push(@{$_[1]}, $_[2]); $_[1] }
],
- [#Rule 75
+ [#Rule 67
'union_body', 3,
sub
-#line 270 "idl.yp"
+#line 236 "idl.yp"
{ $_[2] }
],
- [#Rule 76
+ [#Rule 68
'opt_union_body', 0, undef
],
- [#Rule 77
+ [#Rule 69
'opt_union_body', 1, undef
],
- [#Rule 78
+ [#Rule 70
'union', 4,
sub
-#line 274 "idl.yp"
+#line 240 "idl.yp"
{{
"TYPE" => "UNION",
"PROPERTIES" => $_[1],
@@ -2276,10 +2166,10 @@ sub
"ELEMENTS" => $_[4]
}}
],
- [#Rule 79
+ [#Rule 71
'base_element', 5,
sub
-#line 283 "idl.yp"
+#line 249 "idl.yp"
{{
"NAME" => $_[4],
"TYPE" => $_[2],
@@ -2290,241 +2180,241 @@ sub
"LINE" => $_[0]->YYData->{LINE},
}}
],
- [#Rule 80
+ [#Rule 72
'pointers', 0,
sub
-#line 297 "idl.yp"
+#line 263 "idl.yp"
{ 0 }
],
- [#Rule 81
+ [#Rule 73
'pointers', 2,
sub
-#line 298 "idl.yp"
+#line 264 "idl.yp"
{ $_[1]+1 }
],
- [#Rule 82
+ [#Rule 74
'element_list1', 0,
sub
-#line 302 "idl.yp"
+#line 268 "idl.yp"
{ [] }
],
- [#Rule 83
+ [#Rule 75
'element_list1', 3,
sub
-#line 303 "idl.yp"
+#line 269 "idl.yp"
{ push(@{$_[1]}, $_[2]); $_[1] }
],
- [#Rule 84
+ [#Rule 76
'element_list2', 0, undef
],
- [#Rule 85
+ [#Rule 77
'element_list2', 1, undef
],
- [#Rule 86
+ [#Rule 78
'element_list2', 1,
sub
-#line 309 "idl.yp"
+#line 275 "idl.yp"
{ [ $_[1] ] }
],
- [#Rule 87
+ [#Rule 79
'element_list2', 3,
sub
-#line 310 "idl.yp"
+#line 276 "idl.yp"
{ push(@{$_[1]}, $_[3]); $_[1] }
],
- [#Rule 88
+ [#Rule 80
'array_len', 0, undef
],
- [#Rule 89
+ [#Rule 81
'array_len', 3,
sub
-#line 315 "idl.yp"
+#line 281 "idl.yp"
{ push(@{$_[3]}, "*"); $_[3] }
],
- [#Rule 90
+ [#Rule 82
'array_len', 4,
sub
-#line 316 "idl.yp"
+#line 282 "idl.yp"
{ push(@{$_[4]}, "$_[2]"); $_[4] }
],
- [#Rule 91
+ [#Rule 83
'property_list', 0, undef
],
- [#Rule 92
+ [#Rule 84
'property_list', 4,
sub
-#line 322 "idl.yp"
+#line 288 "idl.yp"
{ FlattenHash([$_[1],$_[3]]); }
],
- [#Rule 93
+ [#Rule 85
'properties', 1,
sub
-#line 325 "idl.yp"
+#line 291 "idl.yp"
{ $_[1] }
],
- [#Rule 94
+ [#Rule 86
'properties', 3,
sub
-#line 326 "idl.yp"
+#line 292 "idl.yp"
{ FlattenHash([$_[1], $_[3]]); }
],
- [#Rule 95
+ [#Rule 87
'property', 1,
sub
-#line 329 "idl.yp"
+#line 295 "idl.yp"
{{ "$_[1]" => "1" }}
],
- [#Rule 96
+ [#Rule 88
'property', 4,
sub
-#line 330 "idl.yp"
+#line 296 "idl.yp"
{{ "$_[1]" => "$_[3]" }}
],
- [#Rule 97
+ [#Rule 89
'listtext', 1, undef
],
- [#Rule 98
+ [#Rule 90
'listtext', 3,
sub
-#line 335 "idl.yp"
+#line 301 "idl.yp"
{ "$_[1] $_[3]" }
],
- [#Rule 99
+ [#Rule 91
'commalisttext', 1, undef
],
- [#Rule 100
+ [#Rule 92
'commalisttext', 3,
sub
-#line 340 "idl.yp"
+#line 306 "idl.yp"
{ "$_[1],$_[3]" }
],
- [#Rule 101
+ [#Rule 93
'anytext', 0,
sub
-#line 344 "idl.yp"
+#line 310 "idl.yp"
{ "" }
],
- [#Rule 102
+ [#Rule 94
'anytext', 1, undef
],
- [#Rule 103
+ [#Rule 95
'anytext', 1, undef
],
- [#Rule 104
+ [#Rule 96
'anytext', 1, undef
],
- [#Rule 105
+ [#Rule 97
'anytext', 3,
sub
-#line 346 "idl.yp"
+#line 312 "idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 106
+ [#Rule 98
'anytext', 3,
sub
-#line 347 "idl.yp"
+#line 313 "idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 107
+ [#Rule 99
'anytext', 3,
sub
-#line 348 "idl.yp"
+#line 314 "idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 108
+ [#Rule 100
'anytext', 3,
sub
-#line 349 "idl.yp"
+#line 315 "idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 109
+ [#Rule 101
'anytext', 3,
sub
-#line 350 "idl.yp"
+#line 316 "idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 110
+ [#Rule 102
'anytext', 3,
sub
-#line 351 "idl.yp"
+#line 317 "idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 111
+ [#Rule 103
'anytext', 3,
sub
-#line 352 "idl.yp"
+#line 318 "idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 112
+ [#Rule 104
'anytext', 3,
sub
-#line 353 "idl.yp"
+#line 319 "idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 113
+ [#Rule 105
'anytext', 3,
sub
-#line 354 "idl.yp"
+#line 320 "idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 114
+ [#Rule 106
'anytext', 3,
sub
-#line 355 "idl.yp"
+#line 321 "idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 115
+ [#Rule 107
'anytext', 3,
sub
-#line 356 "idl.yp"
+#line 322 "idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 116
+ [#Rule 108
'anytext', 3,
sub
-#line 357 "idl.yp"
+#line 323 "idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 117
+ [#Rule 109
'anytext', 3,
sub
-#line 358 "idl.yp"
+#line 324 "idl.yp"
{ "$_[1]$_[2]$_[3]" }
],
- [#Rule 118
+ [#Rule 110
'anytext', 5,
sub
-#line 359 "idl.yp"
+#line 325 "idl.yp"
{ "$_[1]$_[2]$_[3]$_[4]$_[5]" }
],
- [#Rule 119
+ [#Rule 111
'anytext', 5,
sub
-#line 360 "idl.yp"
+#line 326 "idl.yp"
{ "$_[1]$_[2]$_[3]$_[4]$_[5]" }
],
- [#Rule 120
+ [#Rule 112
'identifier', 1, undef
],
- [#Rule 121
+ [#Rule 113
'optional_identifier', 1, undef
],
- [#Rule 122
+ [#Rule 114
'optional_identifier', 0, undef
],
- [#Rule 123
+ [#Rule 115
'constant', 1, undef
],
- [#Rule 124
+ [#Rule 116
'text', 1,
sub
-#line 374 "idl.yp"
+#line 340 "idl.yp"
{ "\"$_[1]\"" }
],
- [#Rule 125
+ [#Rule 117
'optional_semicolon', 0, undef
],
- [#Rule 126
+ [#Rule 118
'optional_semicolon', 1, undef
]
],
@@ -2532,7 +2422,7 @@ sub
bless($self,$class);
}
-#line 385 "idl.yp"
+#line 351 "idl.yp"
use Parse::Pidl qw(error);
@@ -2627,7 +2517,7 @@ again:
if (s/^([\w_]+)//) {
$parser->YYData->{LAST_TOKEN} = $1;
if ($1 =~
- /^(coclass|interface|const|typedef|declare|union|cpp_quote
+ /^(coclass|interface|const|typedef|union|cpp_quote
|struct|enum|bitmap|void|unsigned|signed|import|include
|importlib)$/x) {
return $1;
diff --git a/source4/pidl/lib/Parse/Pidl/NDR.pm b/source4/pidl/lib/Parse/Pidl/NDR.pm
index f624d2bdc0..fc6bfe4c96 100644
--- a/source4/pidl/lib/Parse/Pidl/NDR.pm
+++ b/source4/pidl/lib/Parse/Pidl/NDR.pm
@@ -35,7 +35,7 @@ use vars qw($VERSION);
$VERSION = '0.01';
@ISA = qw(Exporter);
@EXPORT = qw(GetPrevLevel GetNextLevel ContainsDeferred ContainsString);
-@EXPORT_OK = qw(GetElementLevelTable ParseElement ValidElement align_type mapToScalar ParseType can_contain_deferred);
+@EXPORT_OK = qw(GetElementLevelTable ParseElement ValidElement align_type mapToScalar ParseType can_contain_deferred is_charset_array);
use strict;
use Parse::Pidl qw(warning fatal);
@@ -287,8 +287,6 @@ sub can_contain_deferred($)
return 0 if (Parse::Pidl::Typelist::is_scalar($type));
- return 1 if ($type->{TYPE} eq "DECLARE"); # assume the worst
-
return can_contain_deferred($type->{DATA}) if ($type->{TYPE} eq "TYPEDEF");
return 0 unless defined($type->{ELEMENTS});
@@ -354,21 +352,25 @@ sub align_type($)
return $scalar_alignment->{$e->{NAME}};
}
+ return 0 if ($e eq "EMPTY");
+
unless (hasType($e)) {
# it must be an external type - all we can do is guess
- # print "Warning: assuming alignment of unknown type '$e' is 4\n";
+ # warning($e, "assuming alignment of unknown type '$e' is 4");
return 4;
}
my $dt = getType($e);
- if ($dt->{TYPE} eq "TYPEDEF" or $dt->{TYPE} eq "DECLARE") {
+ if ($dt->{TYPE} eq "TYPEDEF") {
return align_type($dt->{DATA});
} elsif ($dt->{TYPE} eq "ENUM") {
return align_type(Parse::Pidl::Typelist::enum_type_fn($dt));
} elsif ($dt->{TYPE} eq "BITMAP") {
return align_type(Parse::Pidl::Typelist::bitmap_type_fn($dt));
} elsif (($dt->{TYPE} eq "STRUCT") or ($dt->{TYPE} eq "UNION")) {
+ # Struct/union without body: assume 4
+ return 4 unless (defined($dt->{ELEMENTS}));
return find_largest_alignment($dt);
}
@@ -631,7 +633,7 @@ sub FindNestedTypes($$)
sub FindNestedTypes($$);
my ($l, $t) = @_;
- return if not defined($t->{ELEMENTS});
+ return unless defined($t->{ELEMENTS});
return if ($t->{TYPE} eq "ENUM");
return if ($t->{TYPE} eq "BITMAP");
@@ -650,7 +652,6 @@ sub ParseInterface($)
my @consts = ();
my @functions = ();
my @endpoints;
- my @declares = ();
my $opnum = 0;
my $version;
@@ -667,9 +668,7 @@ sub ParseInterface($)
}
foreach my $d (@{$idl->{DATA}}) {
- if ($d->{TYPE} eq "DECLARE") {
- push (@declares, $d);
- } elsif ($d->{TYPE} eq "FUNCTION") {
+ if ($d->{TYPE} eq "FUNCTION") {
push (@functions, ParseFunction($idl, $d, \$opnum));
} elsif ($d->{TYPE} eq "CONST") {
push (@consts, ParseConst($idl, $d));
@@ -701,7 +700,6 @@ sub ParseInterface($)
FUNCTIONS => \@functions,
CONSTS => \@consts,
TYPES => \@types,
- DECLARES => \@declares,
ENDPOINTS => \@endpoints
};
}
@@ -1183,4 +1181,19 @@ sub Validate($)
}
}
+sub is_charset_array($$)
+{
+ my ($e,$l) = @_;
+
+ return 0 if ($l->{TYPE} ne "ARRAY");
+
+ my $nl = GetNextLevel($e,$l);
+
+ return 0 unless ($nl->{TYPE} eq "DATA");
+
+ return has_property($e, "charset");
+}
+
+
+
1;
diff --git a/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm b/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
index b7372a802a..86b8951026 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
@@ -9,7 +9,7 @@ package Parse::Pidl::Samba3::ClientNDR;
use Exporter;
@ISA = qw(Exporter);
-@EXPORT_OK = qw(GenerateFunctionInEnv ParseFunction $res $res_hdr);
+@EXPORT_OK = qw(ParseFunction $res $res_hdr);
use strict;
use Parse::Pidl qw(fatal warning);
@@ -17,7 +17,7 @@ use Parse::Pidl::Typelist qw(hasType getType mapTypeName scalar_is_reference);
use Parse::Pidl::Util qw(has_property is_constant ParseExpr);
use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel ContainsDeferred);
use Parse::Pidl::Samba4 qw(DeclLong);
-use Parse::Pidl::Samba4::NDR::Parser qw(GenerateFunctionInEnv);
+use Parse::Pidl::Samba4::Header qw(GenerateFunctionInEnv);
use vars qw($VERSION);
$VERSION = '0.01';
diff --git a/source4/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm b/source4/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm
index 47312bc83d..ca9e7d15db 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm
@@ -6,13 +6,17 @@
package Parse::Pidl::Samba3::ServerNDR;
+use Exporter;
+@ISA = qw(Exporter);
+@EXPORT_OK = qw(DeclLevel);
+
use strict;
use Parse::Pidl qw(warning fatal);
use Parse::Pidl::Typelist qw(mapTypeName scalar_is_reference);
use Parse::Pidl::Util qw(ParseExpr has_property is_constant);
use Parse::Pidl::NDR qw(GetNextLevel);
use Parse::Pidl::Samba4 qw(ElementStars DeclLong);
-use Parse::Pidl::Samba4::NDR::Parser qw(GenerateFunctionOutEnv);
+use Parse::Pidl::Samba4::Header qw(GenerateFunctionOutEnv);
use vars qw($VERSION);
$VERSION = '0.01';
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4.pm b/source4/pidl/lib/Parse/Pidl/Samba4.pm
index 5848543a60..d42e01cdb0 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4.pm
@@ -12,6 +12,7 @@ require Exporter;
use Parse::Pidl::Util qw(has_property is_constant);
use Parse::Pidl::NDR qw(GetNextLevel);
use Parse::Pidl::Typelist qw(mapTypeName scalar_is_reference);
+use Parse::Pidl qw(fatal);
use strict;
use vars qw($VERSION);
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm b/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm
index 2e9bc0953c..efb3f2858d 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm
@@ -8,13 +8,14 @@ package Parse::Pidl::Samba4::EJS;
use Exporter;
@ISA = qw(Exporter);
-@EXPORT_OK = qw(get_pointer_to get_value_of check_null_pointer fn_declare TypeFunctionName);
+@EXPORT_OK = qw(check_null_pointer fn_declare TypeFunctionName);
use strict;
-use Parse::Pidl::Typelist;
+use Parse::Pidl::Typelist qw(typeHasBody);
+use Parse::Pidl::CUtil qw(get_pointer_to get_value_of);
use Parse::Pidl::Util qw(has_property ParseExpr);
use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel);
-use Parse::Pidl::Samba4::NDR::Parser qw(GenerateStructEnv GenerateFunctionInEnv
+use Parse::Pidl::Samba4::Header qw(GenerateStructEnv GenerateFunctionInEnv
GenerateFunctionOutEnv);
use vars qw($VERSION);
@@ -54,30 +55,6 @@ sub deindent($)
$self->{tabs} = substr($self->{tabs}, 0, -1);
}
-sub get_pointer_to($)
-{
- my $var_name = shift;
-
- if ($var_name =~ /^\*(.*)$/) {
- return $1;
- } elsif ($var_name =~ /^\&(.*)$/) {
- return "&($var_name)";
- } else {
- return "&$var_name";
- }
-}
-
-sub get_value_of($)
-{
- my $var_name = shift;
-
- if ($var_name =~ /^\&(.*)$/) {
- return $1;
- } else {
- return "*$var_name";
- }
-}
-
#####################################################################
# check that a variable we get from ParseExpr isn't a null pointer
sub check_null_pointer($$)
@@ -297,6 +274,7 @@ sub EjsUnionPull($$$)
sub EjsEnumConstant($$)
{
my ($self, $d) = @_;
+ return unless (defined($d->{ELEMENTS}));
my $v = 0;
foreach my $e (@{$d->{ELEMENTS}}) {
my $el = $e;
@@ -595,6 +573,7 @@ sub EjsEnumPush($$$)
sub EjsBitmapPush($$$)
{
my ($self, $d, $varname) = @_;
+ return unless (defined($d->{ELEMENTS}));
my $type_fn = $d->{BASE_TYPE};
# put the bitmap elements in the constants array
foreach my $e (@{$d->{ELEMENTS}}) {
@@ -733,6 +712,7 @@ sub EjsInterface($$$)
$self->pidl_hdr("\n");
foreach my $d (@{$interface->{TYPES}}) {
+ next unless (typeHasBody($d));
($needed->{TypeFunctionName("ejs_push", $d)}) && $self->EjsTypePushFunction($d, $d->{NAME});
($needed->{TypeFunctionName("ejs_pull", $d)}) && $self->EjsTypePullFunction($d, $d->{NAME});
}
@@ -846,8 +826,9 @@ sub NeededType($$$)
NeededType($t->{DATA}, $needed, $req) if ($t->{TYPE} eq "TYPEDEF");
- return if (($t->{TYPE} ne "STRUCT") and
- ($t->{TYPE} ne "UNION"));
+ return unless (($t->{TYPE} eq "STRUCT") or ($t->{TYPE} eq "UNION"));
+
+ return unless(typeHasBody($t));
foreach (@{$t->{ELEMENTS}}) {
next if (has_property($_, "subcontext")); #FIXME: Support subcontexts
@@ -883,7 +864,7 @@ sub TypeFunctionName($$)
my ($prefix, $t) = @_;
return "$prefix\_$t->{NAME}" if (ref($t) eq "HASH" and
- ($t->{TYPE} eq "TYPEDEF" or $t->{TYPE} eq "DECLARE"));
+ $t->{TYPE} eq "TYPEDEF");
return "$prefix\_$t->{TYPE}_$t->{NAME}" if (ref($t) eq "HASH");
return "$prefix\_$t";
}
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/Header.pm b/source4/pidl/lib/Parse/Pidl/Samba4/Header.pm
index 7a6ffa46d6..2b3a9df80f 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/Header.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/Header.pm
@@ -6,10 +6,15 @@
package Parse::Pidl::Samba4::Header;
+require Exporter;
+
+@ISA = qw(Exporter);
+@EXPORT_OK = qw(GenerateFunctionInEnv GenerateFunctionOutEnv EnvSubstituteValue GenerateStructEnv);
+
use strict;
use Parse::Pidl qw(fatal);
use Parse::Pidl::Typelist qw(mapTypeName scalar_is_reference);
-use Parse::Pidl::Util qw(has_property is_constant unmake_str);
+use Parse::Pidl::Util qw(has_property is_constant unmake_str ParseExpr);
use Parse::Pidl::Samba4 qw(is_intree ElementStars ArrayBrackets choose_header);
use vars qw($VERSION);
@@ -107,47 +112,49 @@ sub HeaderEnum($$)
my($enum,$name) = @_;
my $first = 1;
- pidl "#ifndef USE_UINT_ENUMS\n";
- pidl "enum $name {\n";
- $tab_depth++;
+ pidl "enum $name";
if (defined($enum->{ELEMENTS})) {
+ pidl "\n#ifndef USE_UINT_ENUMS\n";
+ pidl " {\n";
+ $tab_depth++;
foreach my $e (@{$enum->{ELEMENTS}}) {
unless ($first) { pidl ",\n"; }
$first = 0;
pidl tabs();
pidl $e;
}
- }
- pidl "\n";
- $tab_depth--;
- pidl "}\n";
- pidl "#else\n";
- my $count = 0;
- pidl "enum $name { __donnot_use_enum_$name=0x7FFFFFFF}\n";
- my $with_val = 0;
- my $without_val = 0;
- if (defined($enum->{ELEMENTS})) {
- foreach my $e (@{$enum->{ELEMENTS}}) {
- my $t = "$e";
- my $name;
- my $value;
- if ($t =~ /(.*)=(.*)/) {
- $name = $1;
- $value = $2;
- $with_val = 1;
- fatal($e->{ORIGINAL}, "you can't mix enum member with values and without values!")
- unless ($without_val == 0);
- } else {
- $name = $t;
- $value = $count++;
- $without_val = 1;
- fatal($e->{ORIGINAL}, "you can't mix enum member with values and without values!")
- unless ($with_val == 0);
+ pidl "\n";
+ $tab_depth--;
+ pidl "}";
+ pidl "\n";
+ pidl "#else\n";
+ my $count = 0;
+ my $with_val = 0;
+ my $without_val = 0;
+ if (defined($enum->{ELEMENTS})) {
+ pidl " { __donnot_use_enum_$name=0x7FFFFFFF}\n";
+ foreach my $e (@{$enum->{ELEMENTS}}) {
+ my $t = "$e";
+ my $name;
+ my $value;
+ if ($t =~ /(.*)=(.*)/) {
+ $name = $1;
+ $value = $2;
+ $with_val = 1;
+ fatal($e->{ORIGINAL}, "you can't mix enum member with values and without values!")
+ unless ($without_val == 0);
+ } else {
+ $name = $t;
+ $value = $count++;
+ $without_val = 1;
+ fatal($e->{ORIGINAL}, "you can't mix enum member with values and without values!")
+ unless ($with_val == 0);
+ }
+ pidl "#define $name ( $value )\n";
}
- pidl "#define $name ( $value )\n";
}
+ pidl "#endif\n";
}
- pidl "#endif\n";
}
#####################################################################
@@ -215,7 +222,7 @@ sub HeaderType($$$)
sub HeaderTypedef($)
{
my($typedef) = shift;
- HeaderType($typedef, $typedef->{DATA}, $typedef->{NAME});
+ HeaderType($typedef, $typedef->{DATA}, $typedef->{NAME}) if defined ($typedef->{DATA});
}
#####################################################################
@@ -404,4 +411,66 @@ sub Parse($)
return $res;
}
+sub GenerateStructEnv($$)
+{
+ my ($x, $v) = @_;
+ my %env;
+
+ foreach my $e (@{$x->{ELEMENTS}}) {
+ $env{$e->{NAME}} = "$v->$e->{NAME}";
+ }
+
+ $env{"this"} = $v;
+
+ return \%env;
+}
+
+sub EnvSubstituteValue($$)
+{
+ my ($env,$s) = @_;
+
+ # Substitute the value() values in the env
+ foreach my $e (@{$s->{ELEMENTS}}) {
+ next unless (defined(my $v = has_property($e, "value")));
+
+ $env->{$e->{NAME}} = ParseExpr($v, $env, $e);
+ }
+
+ return $env;
+}
+
+sub GenerateFunctionInEnv($;$)
+{
+ my ($fn, $base) = @_;
+ my %env;
+
+ $base = "r->" unless defined($base);
+
+ foreach my $e (@{$fn->{ELEMENTS}}) {
+ if (grep (/in/, @{$e->{DIRECTION}})) {
+ $env{$e->{NAME}} = $base."in.$e->{NAME}";
+ }
+ }
+
+ return \%env;
+}
+
+sub GenerateFunctionOutEnv($;$)
+{
+ my ($fn, $base) = @_;
+ my %env;
+
+ $base = "r->" unless defined($base);
+
+ foreach my $e (@{$fn->{ELEMENTS}}) {
+ if (grep (/out/, @{$e->{DIRECTION}})) {
+ $env{$e->{NAME}} = $base."out.$e->{NAME}";
+ } elsif (grep (/in/, @{$e->{DIRECTION}})) {
+ $env{$e->{NAME}} = $base."in.$e->{NAME}";
+ }
+ }
+
+ return \%env;
+}
+
1;
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index c9b48b017c..02d3a80992 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -9,13 +9,15 @@ package Parse::Pidl::Samba4::NDR::Parser;
require Exporter;
@ISA = qw(Exporter);
-@EXPORT_OK = qw(check_null_pointer GenerateFunctionInEnv GenerateFunctionOutEnv EnvSubstituteValue GenerateStructEnv NeededFunction NeededElement NeededType $res NeededInterface TypeFunctionName ParseElementPrint);
+@EXPORT_OK = qw(check_null_pointer NeededFunction NeededElement NeededType $res NeededInterface TypeFunctionName ParseElementPrint);
use strict;
-use Parse::Pidl::Typelist qw(hasType getType mapTypeName);
+use Parse::Pidl::Typelist qw(hasType getType mapTypeName typeHasBody);
use Parse::Pidl::Util qw(has_property ParseExpr ParseExprExt print_uuid);
-use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel ContainsDeferred);
+use Parse::Pidl::CUtil qw(get_pointer_to get_value_of);
+use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel ContainsDeferred is_charset_array);
use Parse::Pidl::Samba4 qw(is_intree choose_header);
+use Parse::Pidl::Samba4::Header qw(GenerateFunctionInEnv GenerateFunctionOutEnv EnvSubstituteValue GenerateStructEnv);
use Parse::Pidl qw(warning);
use vars qw($VERSION);
@@ -76,42 +78,6 @@ sub has_fast_array($$)
return ($t->{NAME} eq "uint8") or ($t->{NAME} eq "string");
}
-sub is_charset_array($$)
-{
- my ($e,$l) = @_;
-
- return 0 if ($l->{TYPE} ne "ARRAY");
-
- my $nl = GetNextLevel($e,$l);
-
- return 0 unless ($nl->{TYPE} eq "DATA");
-
- return has_property($e, "charset");
-}
-
-sub get_pointer_to($)
-{
- my $var_name = shift;
-
- if ($var_name =~ /^\*(.*)$/) {
- return $1;
- } elsif ($var_name =~ /^\&(.*)$/) {
- return "&($var_name)";
- } else {
- return "&$var_name";
- }
-}
-
-sub get_value_of($)
-{
- my $var_name = shift;
-
- if ($var_name =~ /^\&(.*)$/) {
- return $1;
- } else {
- return "*$var_name";
- }
-}
####################################
# pidl() is our basic output routine
@@ -215,68 +181,6 @@ sub end_flags($$)
}
}
-sub GenerateStructEnv($$)
-{
- my ($x, $v) = @_;
- my %env;
-
- foreach my $e (@{$x->{ELEMENTS}}) {
- $env{$e->{NAME}} = "$v->$e->{NAME}";
- }
-
- $env{"this"} = $v;
-
- return \%env;
-}
-
-sub EnvSubstituteValue($$)
-{
- my ($env,$s) = @_;
-
- # Substitute the value() values in the env
- foreach my $e (@{$s->{ELEMENTS}}) {
- next unless (defined(my $v = has_property($e, "value")));
-
- $env->{$e->{NAME}} = ParseExpr($v, $env, $e);
- }
-
- return $env;
-}
-
-sub GenerateFunctionInEnv($;$)
-{
- my ($fn, $base) = @_;
- my %env;
-
- $base = "r->" unless defined($base);
-
- foreach my $e (@{$fn->{ELEMENTS}}) {
- if (grep (/in/, @{$e->{DIRECTION}})) {
- $env{$e->{NAME}} = $base."in.$e->{NAME}";
- }
- }
-
- return \%env;
-}
-
-sub GenerateFunctionOutEnv($;$)
-{
- my ($fn, $base) = @_;
- my %env;
-
- $base = "r->" unless defined($base);
-
- foreach my $e (@{$fn->{ELEMENTS}}) {
- if (grep (/out/, @{$e->{DIRECTION}})) {
- $env{$e->{NAME}} = $base."out.$e->{NAME}";
- } elsif (grep (/in/, @{$e->{DIRECTION}})) {
- $env{$e->{NAME}} = $base."in.$e->{NAME}";
- }
- }
-
- return \%env;
-}
-
#####################################################################
# parse the data of an array - push side
sub ParseArrayPushHeader($$$$$$)
@@ -2565,6 +2469,8 @@ sub ParseInterface($$$)
# Typedefs
foreach my $d (@{$interface->{TYPES}}) {
+ next unless(typeHasBody($d));
+
($needed->{TypeFunctionName("ndr_push", $d)}) && $self->ParseTypePushFunction($d, "r");
($needed->{TypeFunctionName("ndr_pull", $d)}) && $self->ParseTypePullFunction($d, "r");
($needed->{TypeFunctionName("ndr_print", $d)}) && $self->ParseTypePrintFunction($d, "r");
@@ -2708,6 +2614,7 @@ sub NeededType($$$)
NeededType($t->{DATA}, $needed, $req) if ($t->{TYPE} eq "TYPEDEF");
if ($t->{TYPE} eq "STRUCT" or $t->{TYPE} eq "UNION") {
+ return unless defined($t->{ELEMENTS});
for my $e (@{$t->{ELEMENTS}}) {
$e->{PARENT} = $t;
if (has_property($e, "compression")) {
@@ -2745,7 +2652,7 @@ sub TypeFunctionName($$)
my ($prefix, $t) = @_;
return "$prefix\_$t->{NAME}" if (ref($t) eq "HASH" and
- ($t->{TYPE} eq "TYPEDEF" or $t->{TYPE} eq "DECLARE"));
+ $t->{TYPE} eq "TYPEDEF");
return "$prefix\_$t->{TYPE}_$t->{NAME}" if (ref($t) eq "HASH");
return "$prefix\_$t";
}
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm
index 8effff9d5e..2475925377 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm
@@ -1,6 +1,6 @@
###################################################
# Python function wrapper generator
-# Copyright jelmer@samba.org 2007
+# Copyright jelmer@samba.org 2007-2008
# released under the GNU GPL
package Parse::Pidl::Samba4::Python;
@@ -9,15 +9,19 @@ use Exporter;
@ISA = qw(Exporter);
use strict;
-use Parse::Pidl::Typelist;
+use Parse::Pidl::Typelist qw(hasType resolveType getType mapTypeName expandAlias);
use Parse::Pidl::Util qw(has_property ParseExpr);
+use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel ContainsDeferred is_charset_array);
+use Parse::Pidl::CUtil qw(get_value_of get_pointer_to);
+use Parse::Pidl::Samba4::Header qw(GenerateFunctionInEnv GenerateFunctionOutEnv EnvSubstituteValue GenerateStructEnv);
use vars qw($VERSION);
$VERSION = '0.01';
sub new($) {
my ($class) = @_;
- my $self = { res => "", res_hdr => "", tabs => "", constants => {}};
+ my $self = { res => "", res_hdr => "", tabs => "", constants => {},
+ module_methods => []};
bless($self, $class);
}
@@ -63,121 +67,371 @@ sub Import
sub Const($$)
{
my ($self, $const) = @_;
- $self->{constants}->{$const->{NAME}} = [$const->{DATA}->{TYPE}, $const->{VALUE}];
+ $self->register_constant($const->{NAME}, $const->{DTYPE}, $const->{VALUE});
}
-sub FromTypeToPythonFunction($$)
+sub register_constant($$$$)
{
- my ($self, $type) = @_;
+ my ($self, $name, $type, $value) = @_;
- #FIXME
+ $self->{constants}->{$name} = [$type, $value];
}
-sub FromPythonToTypeFunction($$)
+sub EnumAndBitmapConsts($$$)
{
- my ($self, $type) = @_;
+ my ($self, $name, $d) = @_;
- #FIXME
+ return unless (defined($d->{ELEMENTS}));
+
+ foreach my $e (@{$d->{ELEMENTS}}) {
+ $e =~ /^([A-Za-z0-9_]+)/;
+ my $cname = $1;
+
+ $self->register_constant($cname, $d, $cname);
+ }
}
-sub TypeConstructor($$)
+sub FromUnionToPythonFunction($$$$)
{
- my ($self, $type) = @_;
+ my ($self, $mem_ctx, $type, $switch, $name) = @_;
+
+ $self->pidl("PyObject *ret;");
+ $self->pidl("");
- $self->pidl("staticforward PyTypeObject $type->{NAME}_ObjectType;");
- $self->pidl("typedef struct {");
+ $self->pidl("switch ($switch) {");
$self->indent;
- $self->pidl("PyObject_HEAD");
- $self->pidl("void *object;"); # FIXME: Use real type rather than void
+
+ foreach my $e (@{$type->{ELEMENTS}}) {
+ $self->pidl("$e->{CASE}:");
+
+ $self->indent;
+
+ if ($e->{NAME}) {
+ $self->ConvertObjectToPython($mem_ctx, {}, $e, "$name->$e->{NAME}", "ret");
+ } else {
+ $self->pidl("ret = Py_None;");
+ }
+
+ $self->pidl("return ret;");
+ $self->pidl("");
+
+ $self->deindent;
+ }
+
$self->deindent;
- $self->pidl("} $type->{NAME}_Object;");
+ $self->pidl("}");
- $self->pidl("");
+ $self->pidl("PyErr_SetString(PyExc_TypeError, \"unknown union level\");");
+ $self->pidl("return NULL;");
+}
- $self->pidl("static PyObject *py_$type->{NAME}_getattr(PyTypeObject *obj, char *name)");
- $self->pidl("{");
+sub FromPythonToUnionFunction($$$$$)
+{
+ my ($self, $type, $typename, $switch, $mem_ctx, $name) = @_;
+
+ my $has_default = 0;
+
+ $self->pidl("$typename *ret = talloc_zero($mem_ctx, $typename);");
+
+ $self->pidl("switch ($switch) {");
$self->indent;
- $self->pidl("return Py_None;");
+
+ foreach my $e (@{$type->{ELEMENTS}}) {
+ $self->pidl("$e->{CASE}:");
+ if ($e->{CASE} eq "default") { $has_default = 1; }
+ $self->indent;
+ if ($e->{NAME}) {
+ $self->ConvertObjectFromPython({}, $mem_ctx, $e, $name, "ret->$e->{NAME}", "talloc_free(ret); return NULL;");
+ }
+ $self->pidl("break;");
+ $self->deindent;
+ $self->pidl("");
+ }
+
+ if (!$has_default) {
+ $self->pidl("default:");
+ $self->indent;
+ $self->pidl("PyErr_SetString(PyExc_TypeError, \"invalid union level value\");");
+ $self->pidl("talloc_free(ret);");
+ $self->pidl("ret = NULL;");
+ $self->deindent;
+ }
+
$self->deindent;
$self->pidl("}");
$self->pidl("");
+ $self->pidl("return ret;");
+}
+
+sub PythonStruct($$$$)
+{
+ my ($self, $name, $cname, $d) = @_;
+
+ my $env = GenerateStructEnv($d, "object");
+
+ $self->pidl("");
- $self->pidl("static void py_$type->{NAME}_dealloc(PyObject* self)");
+ $self->pidl("static PyObject *py_$name\_getattr(PyObject *obj, char *name)");
$self->pidl("{");
$self->indent;
- $self->pidl("$type->{NAME}_Object *obj = ($type->{NAME}_Object *)self;");
- $self->pidl("talloc_free(obj->object);");
- $self->pidl("PyObject_Del(self);");
+ if ($#{$d->{ELEMENTS}} > -1) {
+ $self->pidl("$cname *object = py_talloc_get_ptr(obj);");
+ foreach my $e (@{$d->{ELEMENTS}}) {
+ $self->pidl("if (!strcmp(name, \"$e->{NAME}\")) {");
+ my $varname = "object->$e->{NAME}";
+ $self->indent;
+ $self->pidl("PyObject *py_$e->{NAME};");
+ $self->ConvertObjectToPython("py_talloc_get_mem_ctx(obj)", $env, $e, $varname, "py_$e->{NAME}");
+ $self->pidl("return py_$e->{NAME};");
+ $self->deindent;
+ $self->pidl("}");
+ }
+ }
+ $self->pidl("PyErr_SetString(PyExc_AttributeError, \"no such attribute\");");
+ $self->pidl("return NULL;");
$self->deindent;
$self->pidl("}");
$self->pidl("");
- $self->pidl("static PyObject *py_$type->{NAME}_setattr(PyTypeObject *obj, char *name, PyObject *value)");
+ $self->pidl("static int py_$name\_setattr(PyObject *py_obj, char *name, PyObject *value)");
$self->pidl("{");
$self->indent;
- $self->pidl("return Py_None;");
+ if ($#{$d->{ELEMENTS}} > -1) {
+ $self->pidl("$cname *object = py_talloc_get_ptr(py_obj);");
+ my $mem_ctx = "py_talloc_get_mem_ctx(py_obj)";
+ foreach my $e (@{$d->{ELEMENTS}}) {
+ $self->pidl("if (!strcmp(name, \"$e->{NAME}\")) {");
+ my $varname = "object->$e->{NAME}";
+ $self->indent;
+ my $l = $e->{LEVELS}[0];
+ my $nl = GetNextLevel($e, $l);
+ if ($l->{TYPE} eq "POINTER" and
+ not ($nl->{TYPE} eq "ARRAY" and ($nl->{IS_FIXED} or is_charset_array($e, $nl))) and
+ not ($nl->{TYPE} eq "DATA" and Parse::Pidl::Typelist::scalar_is_reference($nl->{DATA_TYPE}))) {
+ $self->pidl("talloc_free($varname);");
+ }
+ $self->ConvertObjectFromPython($env, $mem_ctx, $e, "value", $varname, "return -1;");
+ $self->pidl("return 0;");
+ $self->deindent;
+ $self->pidl("}");
+ }
+ }
+ $self->pidl("PyErr_SetString(PyExc_AttributeError, \"no such attribute\");");
+ $self->pidl("return -1;");
$self->deindent;
$self->pidl("}");
$self->pidl("");
- $self->pidl("static PyTypeObject $type->{NAME}_ObjectType = {");
+ $self->pidl_hdr("PyAPI_DATA(PyTypeObject) $name\_Type;\n");
+ $self->pidl_hdr("#define $name\_Check(op) PyObject_TypeCheck(op, &$name\_Type)\n");
+ $self->pidl_hdr("#define $name\_CheckExact(op) ((op)->ob_type == &$name\_Type)\n");
+ $self->pidl_hdr("\n");
+ $self->pidl("PyTypeObject $name\_Type = {");
$self->indent;
$self->pidl("PyObject_HEAD_INIT(NULL) 0,");
- $self->pidl(".tp_name = \"$type->{NAME}\",");
- $self->pidl(".tp_basicsize = sizeof($type->{NAME}_Object),");
- $self->pidl(".tp_dealloc = (destructor)py_$type->{NAME}_dealloc,");
- $self->pidl(".tp_getattr = (getattrfunc)py_$type->{NAME}_getattr,");
- $self->pidl(".tp_setattr = (setattrfunc)py_$type->{NAME}_setattr,");
+ $self->pidl(".tp_name = \"$name\",");
+ $self->pidl(".tp_basicsize = sizeof(py_talloc_Object),");
+ $self->pidl(".tp_dealloc = py_talloc_dealloc,");
+ $self->pidl(".tp_getattr = py_$name\_getattr,");
+ $self->pidl(".tp_setattr = py_$name\_setattr,");
+ $self->pidl(".tp_repr = py_talloc_default_repr,");
$self->deindent;
$self->pidl("};");
$self->pidl("");
- $self->pidl("static PyObject *py_$type->{NAME}(PyObject *self, PyObject *args)");
+ my $py_fnname = "py_$name";
+ $self->pidl("static PyObject *$py_fnname(PyObject *self, PyObject *args)");
$self->pidl("{");
$self->indent;
- $self->pidl("$type->{NAME}\_Object *ret;");
- $self->pidl("ret = PyObject_New($type->{NAME}_Object, &$type->{NAME}_ObjectType);");
- $self->pidl("return (PyObject *) ret;");
+ $self->pidl("$cname *ret = talloc_zero(NULL, $cname);");
+ $self->pidl("return py_talloc_import(&$name\_Type, ret);");
$self->deindent;
$self->pidl("}");
$self->pidl("");
+
+ return $py_fnname;
}
sub PythonFunction($$$)
{
my ($self, $fn, $iface) = @_;
- $self->pidl("static PyObject *py_$fn->{NAME}(PyObject *self, PyObject *args)");
+ $self->pidl("static PyObject *py_$fn->{NAME}(PyObject *self, PyObject *args, PyObject *kwargs)");
$self->pidl("{");
$self->indent;
$self->pidl("$iface\_InterfaceObject *iface = ($iface\_InterfaceObject *)self;");
$self->pidl("NTSTATUS status;");
+ $self->pidl("TALLOC_CTX *mem_ctx = talloc_new(NULL);");
+ $self->pidl("struct $fn->{NAME} *r = talloc_zero(mem_ctx, struct $fn->{NAME});");
+ $self->pidl("PyObject *result = Py_None;");
+
+ my $env = GenerateFunctionInEnv($fn, "r->");
+ my $result_size = 0;
+
+ my $args_format = "";
+ my $args_string = "";
+ my $args_names = "";
+
+ foreach my $e (@{$fn->{ELEMENTS}}) {
+ $self->pidl("PyObject *py_$e->{NAME};");
+ if (grep(/out/,@{$e->{DIRECTION}})) {
+ $result_size++;
+ }
+ if (grep(/in/,@{$e->{DIRECTION}})) {
+ $args_format .= "O";
+ $args_string .= ", &py_$e->{NAME}";
+ $args_names .= "\"$e->{NAME}\", ";
+ }
+ }
+ $self->pidl("const char *kwnames[] = {");
+ $self->indent;
+ $self->pidl($args_names . "NULL");
+ $self->deindent;
+ $self->pidl("};");
+
$self->pidl("");
- # FIXME
- $self->handle_ntstatus("status", "NULL");
- $self->pidl("return Py_None;");
+ $self->pidl("if (!PyArg_ParseTupleAndKeywords(args, kwargs, \"$args_format:$fn->{NAME}\", discard_const_p(char *, kwnames)$args_string)) {");
+ $self->indent;
+ $self->pidl("return NULL;");
+ $self->deindent;
+ $self->pidl("}");
+
+ if ($fn->{RETURN_TYPE}) {
+ $result_size++ unless ($fn->{RETURN_TYPE} eq "WERROR" or $fn->{RETURN_TYPE} eq "NTSTATUS");
+ }
+
+ foreach my $e (@{$fn->{ELEMENTS}}) {
+ if (grep(/in/,@{$e->{DIRECTION}})) {
+ $self->ConvertObjectFromPython($env, "mem_ctx", $e, "py_$e->{NAME}", "r->in.$e->{NAME}", "talloc_free(mem_ctx); return NULL;");
+ }
+ }
+ $self->pidl("status = dcerpc_$fn->{NAME}(iface->pipe, mem_ctx, r);");
+ $self->handle_ntstatus("status", "NULL", "mem_ctx");
+
+ $env = GenerateFunctionOutEnv($fn, "r->");
+ my $i = 0;
+
+ if ($result_size > 1) {
+ $self->pidl("result = PyTuple_New($result_size);");
+ }
+
+ foreach my $e (@{$fn->{ELEMENTS}}) {
+ my $py_name = "py_$e->{NAME}";
+ if (grep(/out/,@{$e->{DIRECTION}})) {
+ $self->ConvertObjectToPython("r", $env, $e, "r->out.$e->{NAME}", $py_name);
+ if ($result_size > 1) {
+ $self->pidl("PyTuple_SetItem(result, $i, $py_name);");
+ $i++;
+ } else {
+ $self->pidl("result = $py_name;");
+ }
+ }
+ }
+
+ if (defined($fn->{RETURN_TYPE}) and $fn->{RETURN_TYPE} eq "NTSTATUS") {
+ $self->handle_ntstatus("r->out.result", "NULL", "mem_ctx");
+ } elsif (defined($fn->{RETURN_TYPE}) and $fn->{RETURN_TYPE} eq "WERROR") {
+ $self->handle_werror("r->out.result", "NULL", "mem_ctx");
+ } elsif (defined($fn->{RETURN_TYPE})) {
+ my $conv = $self->ConvertObjectToPythonData("r", $fn->{RETURN_TYPE}, "r->out.result");
+ if ($result_size > 1) {
+ $self->pidl("PyTuple_SetItem(result, $i, $conv);");
+ } else {
+ $self->pidl("result = $conv;");
+ }
+ }
+
+ $self->pidl("talloc_free(mem_ctx);");
+ $self->pidl("return result;");
+ $self->deindent;
+ $self->pidl("}");
+ $self->pidl("");
+}
+
+sub handle_werror($$$$)
+{
+ my ($self, $var, $retval, $mem_ctx) = @_;
+
+ $self->pidl("if (!W_ERROR_IS_OK($var)) {");
+ $self->indent;
+ $self->pidl("PyErr_SetString(PyExc_RuntimeError, win_errstr($var));");
+ $self->pidl("talloc_free($mem_ctx);") if ($mem_ctx);
+ $self->pidl("return $retval;");
$self->deindent;
$self->pidl("}");
$self->pidl("");
}
-sub handle_ntstatus($$$)
+sub handle_ntstatus($$$$)
{
- my ($self, $var, $retval) = @_;
+ my ($self, $var, $retval, $mem_ctx) = @_;
$self->pidl("if (NT_STATUS_IS_ERR($var)) {");
$self->indent;
$self->pidl("PyErr_SetString(PyExc_RuntimeError, nt_errstr($var));");
+ $self->pidl("talloc_free($mem_ctx);") if ($mem_ctx);
$self->pidl("return $retval;");
$self->deindent;
$self->pidl("}");
$self->pidl("");
}
-sub Interface($$)
+sub PythonType($$$)
{
- my($self,$interface) = @_;
+ my ($self, $d, $interface, $basename) = @_;
+
+ my $actual_ctype = $d;
+ if ($actual_ctype->{TYPE} eq "TYPEDEF") {
+ $actual_ctype = $actual_ctype->{DATA};
+ }
+
+ if ($actual_ctype->{TYPE} eq "STRUCT") {
+ my $py_fnname;
+ if ($d->{TYPE} eq "STRUCT") {
+ $py_fnname = $self->PythonStruct($d->{NAME}, mapTypeName($d), $d);
+ } else {
+ $py_fnname = $self->PythonStruct($d->{NAME}, mapTypeName($d), $d->{DATA});
+ }
+
+ my $fn_name = $d->{NAME};
+
+ $fn_name =~ s/^$interface->{NAME}_//;
+ $fn_name =~ s/^$basename\_//;
+
+ $self->register_module_method($fn_name, $py_fnname, "METH_NOARGS", "NULL");
+ }
+
+ if ($d->{TYPE} eq "ENUM" or $d->{TYPE} eq "BITMAP") {
+ $self->EnumAndBitmapConsts($d->{NAME}, $d);
+ }
+
+ if ($d->{TYPE} eq "TYPEDEF" and ($d->{DATA}->{TYPE} eq "ENUM" or $d->{DATA}->{TYPE} eq "BITMAP")) {
+ $self->EnumAndBitmapConsts($d->{NAME}, $d->{DATA});
+ }
+
+ if ($actual_ctype->{TYPE} eq "UNION" and defined($actual_ctype->{ELEMENTS})) {
+ $self->pidl("PyObject *py_import_$d->{NAME}(TALLOC_CTX *mem_ctx, int level, " .mapTypeName($d) . " *in)");
+ $self->pidl("{");
+ $self->indent;
+ $self->FromUnionToPythonFunction("mem_ctx", $actual_ctype, "level", "in") if ($actual_ctype->{TYPE} eq "UNION");
+ $self->deindent;
+ $self->pidl("}");
+ $self->pidl("");
+
+ $self->pidl(mapTypeName($d) . " *py_export_$d->{NAME}(TALLOC_CTX *mem_ctx, int level, PyObject *in)");
+ $self->pidl("{");
+ $self->indent;
+ $self->FromPythonToUnionFunction($actual_ctype, mapTypeName($d), "level", "mem_ctx", "in") if ($actual_ctype->{TYPE} eq "UNION");
+ $self->deindent;
+ $self->pidl("}");
+ $self->pidl("");
+ }
+}
+
+sub Interface($$$)
+{
+ my($self,$interface,$basename) = @_;
$self->pidl_hdr("#ifndef _HEADER_PYTHON_$interface->{NAME}\n");
$self->pidl_hdr("#define _HEADER_PYTHON_$interface->{NAME}\n\n");
@@ -186,108 +440,454 @@ sub Interface($$)
$self->Const($_) foreach (@{$interface->{CONSTS}});
- foreach (@{$interface->{TYPES}}) {
- $self->FromTypeToPythonFunction($_);
- $self->FromPythonToTypeFunction($_);
- $self->TypeConstructor($_);
+ foreach my $d (@{$interface->{TYPES}}) {
+ next if has_property($d, "nopython");
+
+ $self->PythonType($d, $interface, $basename);
}
- $self->pidl("staticforward PyTypeObject $interface->{NAME}_InterfaceType;");
- $self->pidl("typedef struct {");
- $self->indent;
- $self->pidl("PyObject_HEAD");
- $self->pidl("struct dcerpc_pipe *pipe;");
- $self->deindent;
- $self->pidl("} $interface->{NAME}_InterfaceObject;");
+ if (defined $interface->{PROPERTIES}->{uuid}) {
+ $self->pidl_hdr("PyAPI_DATA(PyTypeObject) $interface->{NAME}_InterfaceType;\n");
+ $self->pidl("typedef struct {");
+ $self->indent;
+ $self->pidl("PyObject_HEAD");
+ $self->pidl("struct dcerpc_pipe *pipe;");
+ $self->deindent;
+ $self->pidl("} $interface->{NAME}_InterfaceObject;");
- $self->pidl("");
+ $self->pidl("");
- foreach my $d (@{$interface->{FUNCTIONS}}) {
- next if not defined($d->{OPNUM});
- next if has_property($d, "nopython");
+ foreach my $d (@{$interface->{FUNCTIONS}}) {
+ next if not defined($d->{OPNUM});
+ next if has_property($d, "nopython");
+
+ $self->PythonFunction($d, $interface->{NAME});
+ }
+
+ $self->pidl("static PyMethodDef interface_$interface->{NAME}\_methods[] = {");
+ $self->indent;
+ foreach my $d (@{$interface->{FUNCTIONS}}) {
+ next if not defined($d->{OPNUM});
+ next if has_property($d, "nopython");
- $self->PythonFunction($d, $interface->{NAME});
+ my $fn_name = $d->{NAME};
+
+ $fn_name =~ s/^$interface->{NAME}_//;
+ $fn_name =~ s/^$basename\_//;
+
+ $self->pidl("{ \"$fn_name\", (PyCFunction)py_$d->{NAME}, METH_VARARGS|METH_KEYWORDS, NULL },");
+ }
+ $self->pidl("{ NULL, NULL, 0, NULL }");
+ $self->deindent;
+ $self->pidl("};");
+ $self->pidl("");
+
+ $self->pidl("static void interface_$interface->{NAME}_dealloc(PyObject* self)");
+ $self->pidl("{");
+ $self->indent;
+ $self->pidl("$interface->{NAME}_InterfaceObject *interface = ($interface->{NAME}_InterfaceObject *)self;");
+ $self->pidl("talloc_free(interface->pipe);");
+ $self->pidl("PyObject_Del(self);");
+ $self->deindent;
+ $self->pidl("}");
+ $self->pidl("");
+
+ $self->pidl("static PyObject *interface_$interface->{NAME}_getattr(PyObject *obj, char *name)");
+ $self->pidl("{");
+ $self->indent;
+ $self->pidl("return Py_FindMethod(interface_$interface->{NAME}\_methods, obj, name);");
+ $self->deindent;
+ $self->pidl("}");
+
+ $self->pidl("");
+
+ $self->pidl("PyTypeObject $interface->{NAME}_InterfaceType = {");
+ $self->indent;
+ $self->pidl("PyObject_HEAD_INIT(NULL) 0,");
+ $self->pidl(".tp_name = \"$interface->{NAME}\",");
+ $self->pidl(".tp_basicsize = sizeof($interface->{NAME}_InterfaceObject),");
+ $self->pidl(".tp_dealloc = interface_$interface->{NAME}_dealloc,");
+ $self->pidl(".tp_getattr = interface_$interface->{NAME}_getattr,");
+ $self->deindent;
+ $self->pidl("};");
+
+ $self->pidl("");
+
+ $self->register_module_method($interface->{NAME}, "interface_$interface->{NAME}", "METH_VARARGS|METH_KEYWORDS", "NULL");
+ $self->pidl("static PyObject *interface_$interface->{NAME}(PyObject *self, PyObject *args, PyObject *kwargs)");
+ $self->pidl("{");
+ $self->indent;
+ $self->pidl("$interface->{NAME}_InterfaceObject *ret;");
+ $self->pidl("const char *binding_string;");
+ $self->pidl("struct cli_credentials *credentials;");
+ $self->pidl("struct loadparm_context *lp_ctx = NULL;");
+ $self->pidl("PyObject *py_lp_ctx = NULL, *py_credentials = Py_None;");
+ $self->pidl("TALLOC_CTX *mem_ctx = NULL;");
+ $self->pidl("NTSTATUS status;");
+ $self->pidl("");
+ $self->pidl("const char *kwnames[] = {");
+ $self->indent;
+ $self->pidl("\"binding\", \"lp_ctx\", \"credentials\", NULL");
+ $self->deindent;
+ $self->pidl("};");
+ $self->pidl("extern struct loadparm_context *lp_from_py_object(PyObject *py_obj);");
+ $self->pidl("extern struct cli_credentials *cli_credentials_from_py_object(PyObject *py_obj);");
+ $self->pidl("");
+ $self->pidl("if (!PyArg_ParseTupleAndKeywords(args, kwargs, \"sO|O:$interface->{NAME}\", discard_const_p(char *, kwnames), &binding_string, &py_lp_ctx, &py_credentials)) {");
+ $self->indent;
+ $self->pidl("return NULL;");
+ $self->deindent;
+ $self->pidl("}");
+ $self->pidl("");
+ $self->pidl("if (py_lp_ctx != NULL) {");
+ $self->indent;
+ $self->pidl("lp_ctx = lp_from_py_object(py_lp_ctx);");
+ $self->pidl("if (lp_ctx == NULL) {");
+ $self->indent;
+ $self->pidl("PyErr_SetString(PyExc_TypeError, \"Expected loadparm context\");");
+ $self->pidl("return NULL;");
+ $self->deindent;
+ $self->pidl("}");
+ $self->deindent;
+ $self->pidl("}");
+ $self->pidl("");
+
+ $self->pidl("credentials = cli_credentials_from_py_object(py_credentials);");
+ $self->pidl("if (credentials == NULL) {");
+ $self->indent;
+ $self->pidl("PyErr_SetString(PyExc_TypeError, \"Expected credentials\");");
+ $self->pidl("return NULL;");
+ $self->deindent;
+ $self->pidl("}");
+
+ $self->pidl("ret = PyObject_New($interface->{NAME}_InterfaceObject, &$interface->{NAME}_InterfaceType);");
+ $self->pidl("");
+
+ $self->pidl("status = dcerpc_pipe_connect(NULL, &ret->pipe, binding_string, ");
+ $self->pidl(" &ndr_table_$interface->{NAME}, credentials, NULL, lp_ctx);");
+ $self->handle_ntstatus("status", "NULL", "mem_ctx");
+
+ $self->pidl("ret->pipe->conn->flags |= DCERPC_NDR_REF_ALLOC;");
+
+ $self->pidl("return (PyObject *)ret;");
+ $self->deindent;
+ $self->pidl("}");
+
+ $self->pidl("");
}
- $self->pidl("static PyMethodDef interface_$interface->{NAME}\_methods[] = {");
- $self->indent;
- foreach my $d (@{$interface->{FUNCTIONS}}) {
- next if not defined($d->{OPNUM});
- next if has_property($d, "nopython");
+ $self->pidl_hdr("\n");
+ $self->pidl_hdr("#endif /* _HEADER_NDR_$interface->{NAME} */\n");
+}
- my $fn_name = $d->{NAME};
+sub register_module_method($$$$$)
+{
+ my ($self, $fn_name, $pyfn_name, $flags, $doc) = @_;
- $fn_name =~ s/^$interface->{NAME}_//;
+ push (@{$self->{module_methods}}, [$fn_name, $pyfn_name, $flags, $doc])
+}
- $self->pidl("{ \"$fn_name\", (PyCFunction)py_$d->{NAME}, METH_VARARGS|METH_KEYWORDS, NULL },");
+sub assign($$$)
+{
+ my ($self, $dest, $src) = @_;
+ if ($dest =~ /^\&/) {
+ $self->pidl("memcpy($dest, $src, sizeof(" . get_value_of($dest) . "));");
+ } else {
+ $self->pidl("$dest = $src;");
}
- $self->pidl("{ NULL, NULL, 0, NULL }");
- $self->deindent;
- $self->pidl("};");
- $self->pidl("");
+}
- $self->pidl("static void interface_$interface->{NAME}_dealloc(PyObject* self)");
- $self->pidl("{");
- $self->indent;
- $self->pidl("$interface->{NAME}_InterfaceObject *interface = ($interface->{NAME}_InterfaceObject *)self;");
- $self->pidl("talloc_free(interface->pipe);");
- $self->pidl("PyObject_Del(self);");
- $self->deindent;
- $self->pidl("}");
- $self->pidl("");
+sub ConvertObjectFromPythonData($$$$$$)
+{
+ my ($self, $mem_ctx, $cvar, $ctype, $target, $fail) = @_;
- $self->pidl("static PyObject *interface_$interface->{NAME}_getattr(PyTypeObject *obj, char *name)");
- $self->pidl("{");
- $self->indent;
- $self->pidl("return Py_FindMethod(interface_$interface->{NAME}\_methods, (PyObject *)obj, name);");
- $self->deindent;
- $self->pidl("}");
+ die("undef type for $cvar") unless(defined($ctype));
- $self->pidl("");
+ $ctype = resolveType($ctype);
- $self->pidl("static PyTypeObject $interface->{NAME}_InterfaceType = {");
- $self->indent;
- $self->pidl("PyObject_HEAD_INIT(NULL) 0,");
- $self->pidl(".tp_name = \"$interface->{NAME}\",");
- $self->pidl(".tp_basicsize = sizeof($interface->{NAME}_InterfaceObject),");
- $self->pidl(".tp_dealloc = interface_$interface->{NAME}_dealloc,");
- $self->pidl(".tp_getattr = interface_$interface->{NAME}_getattr,");
- $self->deindent;
- $self->pidl("};");
+ my $actual_ctype = $ctype;
+ if ($ctype->{TYPE} eq "TYPEDEF") {
+ $actual_ctype = $ctype->{DATA};
+ }
- $self->pidl("");
+ if ($actual_ctype->{TYPE} eq "ENUM" or $actual_ctype->{TYPE} eq "BITMAP" or
+ $actual_ctype->{TYPE} eq "SCALAR" and (
+ expandAlias($actual_ctype->{NAME}) =~ /^(u?int[0-9]*|hyper|NTTIME|time_t|NTTIME_hyper|NTTIME_1sec|dlong|udlong|udlongr)$/)) {
+ $self->pidl("PY_CHECK_TYPE(PyInt, $cvar, $fail);");
+ $self->pidl("$target = PyInt_AsLong($cvar);");
+ return;
+ }
- $self->pidl("static PyObject *interface_$interface->{NAME}(PyObject *self, PyObject *args)");
- $self->pidl("{");
- $self->indent;
- $self->pidl("$interface->{NAME}_InterfaceObject *ret;");
- $self->pidl("const char *binding_string;");
- $self->pidl("struct cli_credentials *credentials;");
- $self->pidl("struct loadparm_context *lp_ctx;");
- $self->pidl("NTSTATUS status;");
- $self->pidl("");
+ if ($actual_ctype->{TYPE} eq "STRUCT") {
+ $self->pidl("PY_CHECK_TYPE($ctype->{NAME}, $cvar, $fail);");
+ $self->assign($target, "py_talloc_get_ptr($cvar)");
+ return;
+ }
- # FIXME: Arguments: binding string, credentials, loadparm context
- $self->pidl("ret = PyObject_New($interface->{NAME}_InterfaceObject, &$interface->{NAME}_InterfaceType);");
- $self->pidl("");
+ if ($actual_ctype->{TYPE} eq "SCALAR" and $actual_ctype->{NAME} eq "DATA_BLOB") {
+ $self->pidl("$target = data_blob_talloc($mem_ctx, PyString_AsString($cvar), PyString_Size($cvar));");
+ return;
+ }
- $self->pidl("status = dcerpc_pipe_connect(NULL, &ret->pipe, binding_string, ");
- $self->pidl(" &ndr_table_$interface->{NAME}, credentials, NULL, lp_ctx);");
- $self->handle_ntstatus("status", "NULL");
+ if ($actual_ctype->{TYPE} eq "SCALAR" and
+ ($actual_ctype->{NAME} eq "string" or $actual_ctype->{NAME} eq "nbt_string" or $actual_ctype->{NAME} eq "nbt_name" or $actual_ctype->{NAME} eq "wrepl_nbt_name")) {
+ $self->pidl("$target = talloc_strdup($mem_ctx, PyString_AsString($cvar));");
+ return;
+ }
- $self->pidl("return (PyObject *)ret;");
- $self->deindent;
- $self->pidl("}");
+ if ($actual_ctype->{TYPE} eq "SCALAR" and $actual_ctype->{NAME} eq "ipv4address") {
+ $self->pidl("$target = PyString_AsString($cvar);");
+ return;
+ }
+
+
+ if ($actual_ctype->{TYPE} eq "SCALAR" and $actual_ctype->{NAME} eq "NTSTATUS") {
+ $self->pidl("$target = NT_STATUS(PyInt_AsLong($cvar));");
+ return;
+ }
+
+ if ($actual_ctype->{TYPE} eq "SCALAR" and $actual_ctype->{NAME} eq "WERROR") {
+ $self->pidl("$target = W_ERROR(PyInt_AsLong($cvar));");
+ return;
+ }
+
+ if ($actual_ctype->{TYPE} eq "SCALAR" and $actual_ctype->{NAME} eq "string_array") {
+ $self->pidl("$target = PyCObject_AsVoidPtr($cvar);");
+ return;
+ }
+
+ if ($actual_ctype->{TYPE} eq "SCALAR" and $actual_ctype->{NAME} eq "pointer") {
+ $self->assign($target, "PyCObject_AsVoidPtr($cvar)");
+ return;
+ }
+
+ die("unknown type ".mapTypeName($ctype) . ": $cvar");
+
+}
+
+sub ConvertObjectFromPythonLevel($$$$$$$$)
+{
+ my ($self, $env, $mem_ctx, $py_var, $e, $l, $var_name, $fail) = @_;
+ my $nl = GetNextLevel($e, $l);
+
+ if ($l->{TYPE} eq "POINTER") {
+ if ($nl->{TYPE} eq "DATA" and Parse::Pidl::Typelist::scalar_is_reference($nl->{DATA_TYPE})) {
+ $self->ConvertObjectFromPythonLevel($env, $mem_ctx, $py_var, $e, $nl, $var_name, $fail);
+ return;
+ }
+ if ($l->{POINTER_TYPE} ne "ref") {
+ $self->pidl("if ($py_var == Py_None) {");
+ $self->indent;
+ $self->pidl("$var_name = NULL;");
+ $self->deindent;
+ $self->pidl("} else {");
+ $self->indent;
+ }
+ $self->pidl("$var_name = talloc_ptrtype($mem_ctx, $var_name);");
+ $self->ConvertObjectFromPythonLevel($env, $mem_ctx, $py_var, $e, $nl, get_value_of($var_name), $fail);
+ if ($l->{POINTER_TYPE} ne "ref") {
+ $self->deindent;
+ $self->pidl("}");
+ }
+ } elsif ($l->{TYPE} eq "ARRAY") {
+ my $pl = GetPrevLevel($e, $l);
+ if ($pl && $pl->{TYPE} eq "POINTER") {
+ $var_name = get_pointer_to($var_name);
+ }
+
+ if (is_charset_array($e, $l)) {
+ $self->pidl("PY_CHECK_TYPE(PyUnicode, $py_var, $fail);");
+ # FIXME: Use Unix charset setting rather than utf-8
+ $self->pidl($var_name . " = PyString_AsString(PyUnicode_AsEncodedString($py_var, \"utf-8\", \"ignore\"));");
+ } else {
+ my $counter = "$e->{NAME}_cntr_$l->{LEVEL_INDEX}";
+ $self->pidl("PY_CHECK_TYPE(PyList, $py_var, $fail);");
+ $self->pidl("{");
+ $self->indent;
+ $self->pidl("int $counter;");
+ if (!$l->{IS_FIXED}) {
+ $self->pidl("$var_name = talloc_array_ptrtype($mem_ctx, $var_name, PyList_Size($py_var));");
+ }
+ $self->pidl("for ($counter = 0; $counter < PyList_Size($py_var); $counter++) {");
+ $self->indent;
+ $self->ConvertObjectFromPythonLevel($env, $var_name, "PyList_GetItem($py_var, $counter)", $e, GetNextLevel($e, $l), $var_name."[$counter]", $fail);
+ $self->deindent;
+ $self->pidl("}");
+ $self->deindent;
+ $self->pidl("}");
+ }
+ } elsif ($l->{TYPE} eq "DATA") {
+
+ if (not Parse::Pidl::Typelist::is_scalar($l->{DATA_TYPE})) {
+ $var_name = get_pointer_to($var_name);
+ }
+ $self->ConvertObjectFromPythonData($mem_ctx, $py_var, $l->{DATA_TYPE}, $var_name, $fail);
+ } elsif ($l->{TYPE} eq "SWITCH") {
+ $var_name = get_pointer_to($var_name);
+ my $switch = ParseExpr($l->{SWITCH_IS}, $env, $e);
+ $self->assign($var_name, "py_export_" . GetNextLevel($e, $l)->{DATA_TYPE} . "($mem_ctx, $switch, $py_var)");
+ } elsif ($l->{TYPE} eq "SUBCONTEXT") {
+ $self->ConvertObjectFromPythonLevel($env, $mem_ctx, $py_var, $e, GetNextLevel($e, $l), $var_name, $fail);
+ } else {
+ die("unknown level type $l->{TYPE}");
+ }
+}
+
+sub ConvertObjectFromPython($$$$$$$)
+{
+ my ($self, $env, $mem_ctx, $ctype, $cvar, $target, $fail) = @_;
+
+ $self->ConvertObjectFromPythonLevel($env, $mem_ctx, $cvar, $ctype, $ctype->{LEVELS}[0], $target, $fail);
+}
+
+sub ConvertScalarToPython($$$)
+{
+ my ($self, $ctypename, $cvar) = @_;
+
+ die("expected string for $cvar, not $ctypename") if (ref($ctypename) eq "HASH");
+
+ $ctypename = expandAlias($ctypename);
+
+ if ($ctypename =~ /^(char|u?int[0-9]*|hyper|dlong|udlong|udlongr|time_t|NTTIME_hyper|NTTIME|NTTIME_1sec)$/) {
+ return "PyInt_FromLong($cvar)";
+ }
+
+ if ($ctypename eq "DATA_BLOB") {
+ return "PyString_FromStringAndSize((char *)($cvar).data, ($cvar).length)";
+ }
+
+ if ($ctypename eq "NTSTATUS") {
+ return "PyInt_FromLong(NT_STATUS_V($cvar))";
+ }
+
+ if ($ctypename eq "WERROR") {
+ return "PyInt_FromLong(W_ERROR_V($cvar))";
+ }
+
+ if (($ctypename eq "string" or $ctypename eq "nbt_string" or $ctypename eq "nbt_name" or $ctypename eq "wrepl_nbt_name")) {
+ return "PyString_FromString($cvar)";
+ }
+
+ # Not yet supported
+ if ($ctypename eq "string_array") { return "PyCObject_FromVoidPtr($cvar)"; }
+ if ($ctypename eq "ipv4address") { return "PyString_FromString($cvar)"; }
+ if ($ctypename eq "pointer") {
+ return "PyCObject_FromVoidPtr($cvar, talloc_free)";
+ }
+
+ die("Unknown scalar type $ctypename");
+}
+
+sub ConvertObjectToPythonData($$$$$)
+{
+ my ($self, $mem_ctx, $ctype, $cvar) = @_;
+
+ die("undef type for $cvar") unless(defined($ctype));
+
+ $ctype = resolveType($ctype);
+
+ my $actual_ctype = $ctype;
+ if ($ctype->{TYPE} eq "TYPEDEF") {
+ $actual_ctype = $ctype->{DATA};
+ }
- $self->pidl("");
+ if ($actual_ctype->{TYPE} eq "ENUM") {
+ return $self->ConvertScalarToPython(Parse::Pidl::Typelist::enum_type_fn($actual_ctype), $cvar);
+ } elsif ($actual_ctype->{TYPE} eq "BITMAP") {
+ return $self->ConvertScalarToPython(Parse::Pidl::Typelist::bitmap_type_fn($actual_ctype), $cvar);
+ } elsif ($actual_ctype->{TYPE} eq "SCALAR") {
+ return $self->ConvertScalarToPython($actual_ctype->{NAME}, $cvar);
+ } elsif ($actual_ctype->{TYPE} eq "STRUCT") {
+ return "py_talloc_import_ex(&$ctype->{NAME}_Type, $mem_ctx, $cvar)";
+ }
- $self->pidl_hdr("\n");
- $self->pidl_hdr("#endif /* _HEADER_NDR_$interface->{NAME} */\n");
+ die("unknown type ".mapTypeName($ctype) . ": $cvar");
}
-sub Parse($$$$)
+sub ConvertObjectToPythonLevel($$$$$)
{
- my($self,$basename,$ndr,$hdr) = @_;
+ my ($self, $mem_ctx, $env, $e, $l, $var_name, $py_var) = @_;
+ my $nl = GetNextLevel($e, $l);
+
+ if ($l->{TYPE} eq "POINTER") {
+ if ($nl->{TYPE} eq "DATA" and Parse::Pidl::Typelist::scalar_is_reference($nl->{DATA_TYPE})) {
+ $self->ConvertObjectToPythonLevel($var_name, $env, $e, $nl, $var_name, $py_var);
+ return;
+ }
+ if ($l->{POINTER_TYPE} ne "ref") {
+ $self->pidl("if ($var_name == NULL) {");
+ $self->indent;
+ $self->pidl("$py_var = Py_None;");
+ $self->deindent;
+ $self->pidl("} else {");
+ $self->indent;
+ }
+ $self->ConvertObjectToPythonLevel($var_name, $env, $e, $nl, get_value_of($var_name), $py_var);
+ if ($l->{POINTER_TYPE} ne "ref") {
+ $self->deindent;
+ $self->pidl("}");
+ }
+ } elsif ($l->{TYPE} eq "ARRAY") {
+ if (is_charset_array($e, $l)) {
+ $var_name = get_pointer_to($var_name);
+ # FIXME: Use Unix charset setting rather than utf-8
+ $self->pidl("$py_var = PyUnicode_Decode($var_name, strlen($var_name), \"utf-8\", \"ignore\");");
+ } else {
+ my $pl = GetPrevLevel($e, $l);
+ if ($pl && $pl->{TYPE} eq "POINTER") {
+ $var_name = get_pointer_to($var_name);
+ }
+
+ die("No SIZE_IS for array $var_name") unless (defined($l->{SIZE_IS}));
+ my $length = $l->{SIZE_IS};
+ if (defined($l->{LENGTH_IS})) {
+ $length = $l->{LENGTH_IS};
+ }
+
+ $length = ParseExpr($length, $env, $e);
+ $self->pidl("$py_var = PyList_New($length);");
+ $self->pidl("{");
+ $self->indent;
+ my $counter = "$e->{NAME}_cntr_$l->{LEVEL_INDEX}";
+ $self->pidl("int $counter;");
+ $self->pidl("for ($counter = 0; $counter < $length; $counter++) {");
+ $self->indent;
+ my $member_var = "py_$e->{NAME}_$l->{LEVEL_INDEX}";
+ $self->pidl("PyObject *$member_var;");
+ $self->ConvertObjectToPythonLevel($var_name, $env, $e, GetNextLevel($e, $l), $var_name."[$counter]", $member_var);
+ $self->pidl("PyList_SetItem($py_var, $counter, $member_var);");
+ $self->deindent;
+ $self->pidl("}");
+ $self->deindent;
+ $self->pidl("}");
+ }
+ } elsif ($l->{TYPE} eq "SWITCH") {
+ $var_name = get_pointer_to($var_name);
+ my $switch = ParseExpr($l->{SWITCH_IS}, $env, $e);
+ $self->pidl("$py_var = py_import_" . GetNextLevel($e, $l)->{DATA_TYPE} . "($mem_ctx, $switch, $var_name);");
+ } elsif ($l->{TYPE} eq "DATA") {
+ if (not Parse::Pidl::Typelist::is_scalar($l->{DATA_TYPE})) {
+ $var_name = get_pointer_to($var_name);
+ }
+ my $conv = $self->ConvertObjectToPythonData($mem_ctx, $l->{DATA_TYPE}, $var_name);
+ $self->pidl("$py_var = $conv;");
+ } elsif ($l->{TYPE} eq "SUBCONTEXT") {
+ $self->ConvertObjectToPythonLevel($mem_ctx, $env, $e, GetNextLevel($e, $l), $var_name, $py_var);
+ } else {
+ die("Unknown level type $l->{TYPE} $var_name");
+ }
+}
+
+sub ConvertObjectToPython($$$$$$)
+{
+ my ($self, $mem_ctx, $env, $ctype, $cvar, $py_var) = @_;
+
+ $self->ConvertObjectToPythonLevel($mem_ctx, $env, $ctype, $ctype->{LEVELS}[0], $cvar, $py_var);
+}
+
+sub Parse($$$$$)
+{
+ my($self,$basename,$ndr,$ndr_hdr,$hdr) = @_;
my $py_hdr = $hdr;
$py_hdr =~ s/ndr_([^\/]+)$/py_$1/g;
@@ -299,33 +899,24 @@ sub Parse($$$$)
#include \"includes.h\"
#include <Python.h>
#include \"librpc/rpc/dcerpc.h\"
+#include \"scripting/python/pytalloc.h\"
+#include \"scripting/python/pyrpc.h\"
#include \"$hdr\"
+#include \"$ndr_hdr\"
#include \"$py_hdr\"
");
foreach my $x (@$ndr) {
- ($x->{TYPE} eq "INTERFACE") && $self->Interface($x);
($x->{TYPE} eq "IMPORT") && $self->Import(@{$x->{PATHS}});
+ ($x->{TYPE} eq "INTERFACE") && $self->Interface($x, $basename);
}
$self->pidl("static PyMethodDef $basename\_methods[] = {");
$self->indent;
- foreach my $x (@$ndr) {
- next if ($x->{TYPE} ne "INTERFACE");
- $self->pidl("{ \"$x->{NAME}\", (PyCFunction)interface_$x->{NAME}, METH_VARARGS|METH_KEYWORDS, NULL },");
-
- foreach my $d (@{$x->{TYPES}}) {
- next if has_property($d, "nopython");
- next if ($d->{TYPE} eq "ENUM" or $d->{TYPE} eq "BITMAP");
-
- my $fn_name = $d->{NAME};
-
- $fn_name =~ s/^$x->{NAME}_//;
- $fn_name =~ s/^$basename\_//;
-
- $self->pidl("{ \"$fn_name\", (PyCFunction)py_$d->{NAME}, METH_VARARGS|METH_KEYWORDS, NULL },");
- }
+ foreach (@{$self->{module_methods}}) {
+ my ($fn_name, $pyfn_name, $flags, $doc) = @$_;
+ $self->pidl("{ \"$fn_name\", (PyCFunction)$pyfn_name, $flags, $doc },");
}
$self->pidl("{ NULL, NULL, 0, NULL }");
@@ -339,9 +930,18 @@ sub Parse($$$$)
$self->indent;
$self->pidl("PyObject *m;");
$self->pidl("m = Py_InitModule(\"$basename\", $basename\_methods);");
- foreach (keys %{$self->{constants}}) {
- # FIXME: Handle non-string constants
- $self->pidl("PyModule_AddObject(m, \"$_\", PyString_FromString(" . $self->{constants}->{$_}->[1] . "));");
+ foreach my $name (keys %{$self->{constants}}) {
+ my $py_obj;
+ my ($ctype, $cvar) = @{$self->{constants}->{$name}};
+ if ($cvar =~ /^[0-9]+$/ or $cvar =~ /^0x[0-9a-fA-F]+$/) {
+ $py_obj = "PyInt_FromLong($cvar)";
+ } elsif ($cvar =~ /^".*"$/) {
+ $py_obj = "PyString_FromString($cvar)";
+ } else {
+ $py_obj = $self->ConvertObjectToPythonData("NULL", expandAlias($ctype), $cvar);
+ }
+
+ $self->pidl("PyModule_AddObject(m, \"$name\", $py_obj);");
}
$self->deindent;
$self->pidl("}");
diff --git a/source4/pidl/lib/Parse/Pidl/Typelist.pm b/source4/pidl/lib/Parse/Pidl/Typelist.pm
index b2069c784b..8ba1ae47af 100644
--- a/source4/pidl/lib/Parse/Pidl/Typelist.pm
+++ b/source4/pidl/lib/Parse/Pidl/Typelist.pm
@@ -7,9 +7,9 @@ package Parse::Pidl::Typelist;
require Exporter;
@ISA = qw(Exporter);
-@EXPORT_OK = qw(hasType getType mapTypeName scalar_is_reference expandAlias
+@EXPORT_OK = qw(hasType getType resolveType mapTypeName scalar_is_reference expandAlias
mapScalarType addType typeIs is_scalar enum_type_fn
- bitmap_type_fn mapType
+ bitmap_type_fn mapType typeHasBody
);
use vars qw($VERSION);
$VERSION = '0.01';
@@ -59,6 +59,7 @@ my %aliases = (
"boolean8" => "uint8",
"boolean32" => "uint32",
"DWORD" => "uint32",
+ "uint" => "uint32",
"int" => "int32",
"WORD" => "uint16",
"char" => "uint8",
@@ -95,6 +96,20 @@ sub addType($)
$types{$t->{NAME}} = $t;
}
+sub resolveType($)
+{
+ my ($ctype) = @_;
+
+ if (not hasType($ctype)) {
+ # assume struct typedef
+ return { TYPE => "TYPEDEF", NAME => $ctype, DATA => { TYPE => "STRUCT" } };
+ } else {
+ return getType($ctype);
+ }
+
+ return $ctype;
+}
+
sub getType($)
{
my $t = shift;
@@ -135,11 +150,12 @@ sub is_scalar($)
sub is_scalar($);
my $type = shift;
- return 1 if (ref($type) eq "HASH" and $type->{TYPE} eq "SCALAR");
+ return 1 if (ref($type) eq "HASH" and
+ ($type->{TYPE} eq "SCALAR" or $type->{TYPE} eq "ENUM" or
+ $type->{TYPE} eq "BITMAP"));
if (my $dt = getType($type)) {
- return is_scalar($dt->{DATA}) if ($dt->{TYPE} eq "TYPEDEF" or
- $dt->{TYPE} eq "DECLARE");
+ return is_scalar($dt->{DATA}) if ($dt->{TYPE} eq "TYPEDEF");
return 1 if ($dt->{TYPE} eq "SCALAR" or $dt->{TYPE} eq "ENUM" or
$dt->{TYPE} eq "BITMAP");
}
@@ -150,7 +166,7 @@ sub is_scalar($)
sub scalar_is_reference($)
{
my $name = shift;
-
+
return 1 if (grep(/^$name$/, @reference_scalars));
return 0;
}
@@ -208,13 +224,25 @@ sub bitmap_type_fn($)
return "uint32";
}
+sub typeHasBody($)
+{
+ sub typeHasBody($);
+ my ($e) = @_;
+
+ if ($e->{TYPE} eq "TYPEDEF") {
+ return 0 unless(defined($e->{DATA}));
+ return typeHasBody($e->{DATA});
+ }
+
+ return defined($e->{ELEMENTS});
+}
+
sub mapType($$)
{
sub mapType($$);
my ($t, $n) = @_;
return mapType($t->{DATA}, $n) if ($t->{TYPE} eq "TYPEDEF");
- return mapType($t->{DATA}, $n) if ($t->{TYPE} eq "DECLARE");
return mapScalarType($n) if ($t->{TYPE} eq "SCALAR");
return "enum $n" if ($t->{TYPE} eq "ENUM");
return "struct $n" if ($t->{TYPE} eq "STRUCT");
@@ -240,7 +268,7 @@ sub mapTypeName($)
sub LoadIdl($)
{
- my $idl = shift;
+ my ($idl) = @_;
foreach my $x (@{$idl}) {
next if $x->{TYPE} ne "INTERFACE";
@@ -248,7 +276,6 @@ sub LoadIdl($)
foreach my $y (@{$x->{DATA}}) {
addType($y) if (
$y->{TYPE} eq "TYPEDEF"
- or $y->{TYPE} eq "DECLARE"
or $y->{TYPE} eq "UNION"
or $y->{TYPE} eq "STRUCT"
or $y->{TYPE} eq "ENUM"
@@ -257,6 +284,11 @@ sub LoadIdl($)
}
}
+sub GenerateTypeLib()
+{
+ return Parse::Pidl::Util::MyDumper(\%types);
+}
+
RegisterScalars();
1;
diff --git a/source4/pidl/pidl b/source4/pidl/pidl
index 4395df2020..220d62cd71 100755
--- a/source4/pidl/pidl
+++ b/source4/pidl/pidl
@@ -17,7 +17,7 @@ pidl - An IDL compiler written in Perl
pidl --help
-pidl [--outputdir[=OUTNAME]] [--includedir DIR...] [--parse-idl-tree] [--dump-idl-tree] [--dump-ndr-tree] [--header[=OUTPUT]] [--ejs[=OUTPUT]] [--python[=OUTPUT]] [--swig[=OUTPUT]] [--ndr-parser[=OUTPUT]] [--client] [--server] [--warn-compat] [--quiet] [--verbose] [--template] [--ws-parser[=OUTPUT]] [--diff] [--dump-idl] [--tdr-parser[=OUTPUT]] [--samba3-ndr-client[=OUTPUT]] [--samba3-ndr-server[=OUTPUT]] [<idlfile>.idl]...
+pidl [--outputdir[=OUTNAME]] [--includedir DIR...] [--parse-idl-tree] [--dump-idl-tree] [--dump-ndr-tree] [--header[=OUTPUT]] [--ejs[=OUTPUT]] [--python[=OUTPUT]] [--swig[=OUTPUT]] [--ndr-parser[=OUTPUT]] [--client] [--server] [--warn-compat] [--quiet] [--verbose] [--template] [--ws-parser[=OUTPUT]] [--diff] [--dump-idl] [--tdr-parser[=OUTPUT]] [--samba3-ndr-client[=OUTPUT]] [--samba3-ndr-server[=OUTPUT]] [--typelib=[OUTPUT]] [<idlfile>.idl]...
=head1 DESCRIPTION
@@ -52,6 +52,10 @@ both marshalling/unmarshalling and debugging purposes).
=item I<--help>
Show list of available options.
+
+=item I<--version>
+
+Show pidl version
=item I<--outputdir OUTNAME>
@@ -88,6 +92,10 @@ Generate a C file and C header containing TDR parsers. The filename for
the parser defaults to tdr_OUTNAME.c. The header filename will be the
parser filename with the extension changed from .c to .h.
+=item I<--typelib>
+
+Write type information to the specified file.
+
=item I<--server>
Generate boilerplate for the RPC server that implements
@@ -399,7 +407,7 @@ use lib "$RealBin";
use lib "$RealBin/lib";
use Getopt::Long;
use File::Basename;
-use Parse::Pidl;
+use Parse::Pidl qw ( $VERSION );
use Parse::Pidl::Util;
#####################################################################
@@ -449,6 +457,7 @@ sub FileSave($$)
my(@opt_incdirs) = ();
my($opt_help) = 0;
+my($opt_version) = 0;
my($opt_parse_idl_tree) = 0;
my($opt_dump_idl_tree);
my($opt_dump_ndr_tree);
@@ -462,6 +471,7 @@ my($opt_samba3_ndr_client);
my($opt_samba3_ndr_server);
my($opt_template) = 0;
my($opt_client);
+my($opt_typelib);
my($opt_server);
my($opt_ndr_parser);
my($opt_tdr_parser);
@@ -478,7 +488,9 @@ my($opt_warn_compat) = 0;
# display help text
sub ShowHelp()
{
-print "perl IDL parser and code generator
+print "perl IDL parser and code generator\n";
+ShowVersion();
+print"
Copyright (C) Andrew Tridgell <tridge\@samba.org>
Copyright (C) Jelmer Vernooij <jelmer\@samba.org>
@@ -486,6 +498,7 @@ Usage: $Script [options] [--] <idlfile> [<idlfile>...]
Generic Options:
--help this help page
+ --version show pidl version
--outputdir=OUTDIR put output in OUTDIR/ [.]
--warn-compat warn about incompatibility with other compilers
--quiet be quiet
@@ -498,6 +511,7 @@ Debugging:
--dump-ndr-tree[=FILE] dump internal NDR data tree to file [BASENAME.ndr]
--dump-idl regenerate IDL file
--diff run diff on original IDL and dumped output
+ --typelib print type information
Samba 4 output:
--header[=OUTFILE] create generic header file [BASENAME.h]
@@ -522,9 +536,17 @@ Wireshark parsers:
exit(0);
}
+#########################################
+# Display version
+sub ShowVersion()
+{
+ print "perl IDL version $VERSION\n";
+}
+
# main program
my $result = GetOptions (
'help|h|?' => \$opt_help,
+ 'version' => \$opt_version,
'outputdir=s' => \$opt_outputdir,
'dump-idl' => \$opt_dump_idl,
'dump-idl-tree:s' => \$opt_dump_idl_tree,
@@ -534,6 +556,7 @@ my $result = GetOptions (
'samba3-ndr-server:s' => \$opt_samba3_ndr_server,
'header:s' => \$opt_header,
'server:s' => \$opt_server,
+ 'typelib:s' => \$opt_typelib,
'tdr-parser:s' => \$opt_tdr_parser,
'template' => \$opt_template,
'ndr-parser:s' => \$opt_ndr_parser,
@@ -558,6 +581,11 @@ if ($opt_help) {
exit(0);
}
+if ($opt_version) {
+ ShowVersion();
+ exit(0);
+}
+
sub process_file($)
{
my $idl_file = shift;
@@ -664,7 +692,8 @@ sub process_file($)
if (defined($opt_python)) {
require Parse::Pidl::Samba4::Python;
my $generator = new Parse::Pidl::Samba4::Python();
- my ($hdr,$prsr) = $generator->Parse($basename, $ndr, $h_filename);
+ my ($hdr,$prsr) = $generator->Parse($basename, $ndr,
+ "$outputdir/ndr_$basename\_c.h", $h_filename);
FileSave("$outputdir/py_$basename.c", $prsr);
FileSave("$outputdir/py_$basename.h", $hdr);
}
@@ -711,6 +740,12 @@ sub process_file($)
FileSave($tdr_header, $hdr);
}
+ if (defined($opt_typelib)) {
+ my $typelib = ($opt_typelib or "$outputdir/$basename.tlb");
+ require Parse::Pidl::Typelist;
+ FileSave($typelib, Parse::Pidl::Typelist::GenerateTypeLib());
+ }
+
if ($opt_template) {
require Parse::Pidl::Samba4::Template;
print Parse::Pidl::Samba4::Template::Parse($pidl);
diff --git a/source4/pidl/smb_interfaces.pm b/source4/pidl/smb_interfaces.pm
deleted file mode 100644
index c9cc4495b1..0000000000
--- a/source4/pidl/smb_interfaces.pm
+++ /dev/null
@@ -1,1272 +0,0 @@
-####################################################################
-#
-# This file was generated using Parse::Yapp version 1.05.
-#
-# Don't edit this file, use source file instead.
-#
-# ANY CHANGE MADE HERE WILL BE LOST !
-#
-####################################################################
-package smb_interfaces;
-use vars qw ( @ISA );
-use strict;
-
-@ISA= qw ( Parse::Yapp::Driver );
-#Included Parse/Yapp/Driver.pm file----------------------------------------
-{
-#
-# Module Parse::Yapp::Driver
-#
-# This module is part of the Parse::Yapp package available on your
-# nearest CPAN
-#
-# Any use of this module in a standalone parser make the included
-# text under the same copyright as the Parse::Yapp module itself.
-#
-# This notice should remain unchanged.
-#
-# (c) Copyright 1998-2001 Francois Desarmenien, all rights reserved.
-# (see the pod text in Parse::Yapp module for use and distribution rights)
-#
-
-package Parse::Yapp::Driver;
-
-require 5.004;
-
-use strict;
-
-use vars qw ( $VERSION $COMPATIBLE $FILENAME );
-
-$VERSION = '1.05';
-$COMPATIBLE = '0.07';
-$FILENAME=__FILE__;
-
-use Carp;
-
-#Known parameters, all starting with YY (leading YY will be discarded)
-my(%params)=(YYLEX => 'CODE', 'YYERROR' => 'CODE', YYVERSION => '',
- YYRULES => 'ARRAY', YYSTATES => 'ARRAY', YYDEBUG => '');
-#Mandatory parameters
-my(@params)=('LEX','RULES','STATES');
-
-sub new {
- my($class)=shift;
- my($errst,$nberr,$token,$value,$check,$dotpos);
- my($self)={ ERROR => \&_Error,
- ERRST => \$errst,
- NBERR => \$nberr,
- TOKEN => \$token,
- VALUE => \$value,
- DOTPOS => \$dotpos,
- STACK => [],
- DEBUG => 0,
- CHECK => \$check };
-
- _CheckParams( [], \%params, \@_, $self );
-
- exists($$self{VERSION})
- and $$self{VERSION} < $COMPATIBLE
- and croak "Yapp driver version $VERSION ".
- "incompatible with version $$self{VERSION}:\n".
- "Please recompile parser module.";
-
- ref($class)
- and $class=ref($class);
-
- bless($self,$class);
-}
-
-sub YYParse {
- my($self)=shift;
- my($retval);
-
- _CheckParams( \@params, \%params, \@_, $self );
-
- if($$self{DEBUG}) {
- _DBLoad();
- $retval = eval '$self->_DBParse()';#Do not create stab entry on compile
- $@ and die $@;
- }
- else {
- $retval = $self->_Parse();
- }
- $retval
-}
-
-sub YYData {
- my($self)=shift;
-
- exists($$self{USER})
- or $$self{USER}={};
-
- $$self{USER};
-
-}
-
-sub YYErrok {
- my($self)=shift;
-
- ${$$self{ERRST}}=0;
- undef;
-}
-
-sub YYNberr {
- my($self)=shift;
-
- ${$$self{NBERR}};
-}
-
-sub YYRecovering {
- my($self)=shift;
-
- ${$$self{ERRST}} != 0;
-}
-
-sub YYAbort {
- my($self)=shift;
-
- ${$$self{CHECK}}='ABORT';
- undef;
-}
-
-sub YYAccept {
- my($self)=shift;
-
- ${$$self{CHECK}}='ACCEPT';
- undef;
-}
-
-sub YYError {
- my($self)=shift;
-
- ${$$self{CHECK}}='ERROR';
- undef;
-}
-
-sub YYSemval {
- my($self)=shift;
- my($index)= $_[0] - ${$$self{DOTPOS}} - 1;
-
- $index < 0
- and -$index <= @{$$self{STACK}}
- and return $$self{STACK}[$index][1];
-
- undef; #Invalid index
-}
-
-sub YYCurtok {
- my($self)=shift;
-
- @_
- and ${$$self{TOKEN}}=$_[0];
- ${$$self{TOKEN}};
-}
-
-sub YYCurval {
- my($self)=shift;
-
- @_
- and ${$$self{VALUE}}=$_[0];
- ${$$self{VALUE}};
-}
-
-sub YYExpect {
- my($self)=shift;
-
- keys %{$self->{STATES}[$self->{STACK}[-1][0]]{ACTIONS}}
-}
-
-sub YYLexer {
- my($self)=shift;
-
- $$self{LEX};
-}
-
-
-#################
-# Private stuff #
-#################
-
-
-sub _CheckParams {
- my($mandatory,$checklist,$inarray,$outhash)=@_;
- my($prm,$value);
- my($prmlst)={};
-
- while(($prm,$value)=splice(@$inarray,0,2)) {
- $prm=uc($prm);
- exists($$checklist{$prm})
- or croak("Unknow parameter '$prm'");
- ref($value) eq $$checklist{$prm}
- or croak("Invalid value for parameter '$prm'");
- $prm=unpack('@2A*',$prm);
- $$outhash{$prm}=$value;
- }
- for (@$mandatory) {
- exists($$outhash{$_})
- or croak("Missing mandatory parameter '".lc($_)."'");
- }
-}
-
-sub _Error {
- print "Parse error.\n";
-}
-
-sub _DBLoad {
- {
- no strict 'refs';
-
- exists(${__PACKAGE__.'::'}{_DBParse})#Already loaded ?
- and return;
- }
- my($fname)=__FILE__;
- my(@drv);
- open(DRV,"<$fname") or die "Report this as a BUG: Cannot open $fname";
- while(<DRV>) {
- /^\s*sub\s+_Parse\s*{\s*$/ .. /^\s*}\s*#\s*_Parse\s*$/
- and do {
- s/^#DBG>//;
- push(@drv,$_);
- }
- }
- close(DRV);
-
- $drv[0]=~s/_P/_DBP/;
- eval join('',@drv);
-}
-
-#Note that for loading debugging version of the driver,
-#this file will be parsed from 'sub _Parse' up to '}#_Parse' inclusive.
-#So, DO NOT remove comment at end of sub !!!
-sub _Parse {
- my($self)=shift;
-
- my($rules,$states,$lex,$error)
- = @$self{ 'RULES', 'STATES', 'LEX', 'ERROR' };
- my($errstatus,$nberror,$token,$value,$stack,$check,$dotpos)
- = @$self{ 'ERRST', 'NBERR', 'TOKEN', 'VALUE', 'STACK', 'CHECK', 'DOTPOS' };
-
-#DBG> my($debug)=$$self{DEBUG};
-#DBG> my($dbgerror)=0;
-
-#DBG> my($ShowCurToken) = sub {
-#DBG> my($tok)='>';
-#DBG> for (split('',$$token)) {
-#DBG> $tok.= (ord($_) < 32 or ord($_) > 126)
-#DBG> ? sprintf('<%02X>',ord($_))
-#DBG> : $_;
-#DBG> }
-#DBG> $tok.='<';
-#DBG> };
-
- $$errstatus=0;
- $$nberror=0;
- ($$token,$$value)=(undef,undef);
- @$stack=( [ 0, undef ] );
- $$check='';
-
- while(1) {
- my($actions,$act,$stateno);
-
- $stateno=$$stack[-1][0];
- $actions=$$states[$stateno];
-
-#DBG> print STDERR ('-' x 40),"\n";
-#DBG> $debug & 0x2
-#DBG> and print STDERR "In state $stateno:\n";
-#DBG> $debug & 0x08
-#DBG> and print STDERR "Stack:[".
-#DBG> join(',',map { $$_[0] } @$stack).
-#DBG> "]\n";
-
-
- if (exists($$actions{ACTIONS})) {
-
- defined($$token)
- or do {
- ($$token,$$value)=&$lex($self);
-#DBG> $debug & 0x01
-#DBG> and print STDERR "Need token. Got ".&$ShowCurToken."\n";
- };
-
- $act= exists($$actions{ACTIONS}{$$token})
- ? $$actions{ACTIONS}{$$token}
- : exists($$actions{DEFAULT})
- ? $$actions{DEFAULT}
- : undef;
- }
- else {
- $act=$$actions{DEFAULT};
-#DBG> $debug & 0x01
-#DBG> and print STDERR "Don't need token.\n";
- }
-
- defined($act)
- and do {
-
- $act > 0
- and do { #shift
-
-#DBG> $debug & 0x04
-#DBG> and print STDERR "Shift and go to state $act.\n";
-
- $$errstatus
- and do {
- --$$errstatus;
-
-#DBG> $debug & 0x10
-#DBG> and $dbgerror
-#DBG> and $$errstatus == 0
-#DBG> and do {
-#DBG> print STDERR "**End of Error recovery.\n";
-#DBG> $dbgerror=0;
-#DBG> };
- };
-
-
- push(@$stack,[ $act, $$value ]);
-
- $$token ne '' #Don't eat the eof
- and $$token=$$value=undef;
- next;
- };
-
- #reduce
- my($lhs,$len,$code,@sempar,$semval);
- ($lhs,$len,$code)=@{$$rules[-$act]};
-
-#DBG> $debug & 0x04
-#DBG> and $act
-#DBG> and print STDERR "Reduce using rule ".-$act." ($lhs,$len): ";
-
- $act
- or $self->YYAccept();
-
- $$dotpos=$len;
-
- unpack('A1',$lhs) eq '@' #In line rule
- and do {
- $lhs =~ /^\@[0-9]+\-([0-9]+)$/
- or die "In line rule name '$lhs' ill formed: ".
- "report it as a BUG.\n";
- $$dotpos = $1;
- };
-
- @sempar = $$dotpos
- ? map { $$_[1] } @$stack[ -$$dotpos .. -1 ]
- : ();
-
- $semval = $code ? &$code( $self, @sempar )
- : @sempar ? $sempar[0] : undef;
-
- splice(@$stack,-$len,$len);
-
- $$check eq 'ACCEPT'
- and do {
-
-#DBG> $debug & 0x04
-#DBG> and print STDERR "Accept.\n";
-
- return($semval);
- };
-
- $$check eq 'ABORT'
- and do {
-
-#DBG> $debug & 0x04
-#DBG> and print STDERR "Abort.\n";
-
- return(undef);
-
- };
-
-#DBG> $debug & 0x04
-#DBG> and print STDERR "Back to state $$stack[-1][0], then ";
-
- $$check eq 'ERROR'
- or do {
-#DBG> $debug & 0x04
-#DBG> and print STDERR
-#DBG> "go to state $$states[$$stack[-1][0]]{GOTOS}{$lhs}.\n";
-
-#DBG> $debug & 0x10
-#DBG> and $dbgerror
-#DBG> and $$errstatus == 0
-#DBG> and do {
-#DBG> print STDERR "**End of Error recovery.\n";
-#DBG> $dbgerror=0;
-#DBG> };
-
- push(@$stack,
- [ $$states[$$stack[-1][0]]{GOTOS}{$lhs}, $semval ]);
- $$check='';
- next;
- };
-
-#DBG> $debug & 0x04
-#DBG> and print STDERR "Forced Error recovery.\n";
-
- $$check='';
-
- };
-
- #Error
- $$errstatus
- or do {
-
- $$errstatus = 1;
- &$error($self);
- $$errstatus # if 0, then YYErrok has been called
- or next; # so continue parsing
-
-#DBG> $debug & 0x10
-#DBG> and do {
-#DBG> print STDERR "**Entering Error recovery.\n";
-#DBG> ++$dbgerror;
-#DBG> };
-
- ++$$nberror;
-
- };
-
- $$errstatus == 3 #The next token is not valid: discard it
- and do {
- $$token eq '' # End of input: no hope
- and do {
-#DBG> $debug & 0x10
-#DBG> and print STDERR "**At eof: aborting.\n";
- return(undef);
- };
-
-#DBG> $debug & 0x10
-#DBG> and print STDERR "**Dicard invalid token ".&$ShowCurToken.".\n";
-
- $$token=$$value=undef;
- };
-
- $$errstatus=3;
-
- while( @$stack
- and ( not exists($$states[$$stack[-1][0]]{ACTIONS})
- or not exists($$states[$$stack[-1][0]]{ACTIONS}{error})
- or $$states[$$stack[-1][0]]{ACTIONS}{error} <= 0)) {
-
-#DBG> $debug & 0x10
-#DBG> and print STDERR "**Pop state $$stack[-1][0].\n";
-
- pop(@$stack);
- }
-
- @$stack
- or do {
-
-#DBG> $debug & 0x10
-#DBG> and print STDERR "**No state left on stack: aborting.\n";
-
- return(undef);
- };
-
- #shift the error token
-
-#DBG> $debug & 0x10
-#DBG> and print STDERR "**Shift \$error token and go to state ".
-#DBG> $$states[$$stack[-1][0]]{ACTIONS}{error}.
-#DBG> ".\n";
-
- push(@$stack, [ $$states[$$stack[-1][0]]{ACTIONS}{error}, undef ]);
-
- }
-
- #never reached
- croak("Error in driver logic. Please, report it as a BUG");
-
-}#_Parse
-#DO NOT remove comment
-
-1;
-
-}
-#End of include--------------------------------------------------
-
-
-
-
-sub new {
- my($class)=shift;
- ref($class)
- and $class=ref($class);
-
- my($self)=$class->SUPER::new( yyversion => '1.05',
- yystates =>
-[
- {#State 0
- ACTIONS => {
- 'UNION' => 5,
- 'ENUM' => 1,
- 'TYPEDEF' => 7,
- 'STRUCT' => 2
- },
- GOTOS => {
- 'struct' => 6,
- 'enum' => 9,
- 'typedef' => 8,
- 'union' => 10,
- 'definitions' => 3,
- 'definition' => 4
- }
- },
- {#State 1
- ACTIONS => {
- 'IDENTIFIER' => 11
- }
- },
- {#State 2
- ACTIONS => {
- 'IDENTIFIER' => 12
- },
- DEFAULT => -33,
- GOTOS => {
- 'optional_identifier' => 13
- }
- },
- {#State 3
- ACTIONS => {
- '' => 14,
- 'UNION' => 5,
- 'ENUM' => 1,
- 'TYPEDEF' => 7,
- 'STRUCT' => 2
- },
- GOTOS => {
- 'struct' => 6,
- 'typedef' => 8,
- 'enum' => 9,
- 'union' => 10,
- 'definition' => 15
- }
- },
- {#State 4
- DEFAULT => -1
- },
- {#State 5
- ACTIONS => {
- 'IDENTIFIER' => 12
- },
- DEFAULT => -33,
- GOTOS => {
- 'optional_identifier' => 16
- }
- },
- {#State 6
- DEFAULT => -3
- },
- {#State 7
- ACTIONS => {
- 'STRUCT' => 17
- }
- },
- {#State 8
- DEFAULT => -5
- },
- {#State 9
- DEFAULT => -6
- },
- {#State 10
- DEFAULT => -4
- },
- {#State 11
- ACTIONS => {
- "{" => 18
- }
- },
- {#State 12
- DEFAULT => -32
- },
- {#State 13
- ACTIONS => {
- "{" => 19
- }
- },
- {#State 14
- DEFAULT => 0
- },
- {#State 15
- DEFAULT => -2
- },
- {#State 16
- ACTIONS => {
- "{" => 20
- }
- },
- {#State 17
- ACTIONS => {
- "{" => 21
- }
- },
- {#State 18
- ACTIONS => {
- 'IDENTIFIER' => 22
- },
- GOTOS => {
- 'enum_identifiers' => 23,
- 'enum_identifier' => 24
- }
- },
- {#State 19
- DEFAULT => -15,
- GOTOS => {
- 'elements' => 25
- }
- },
- {#State 20
- DEFAULT => -15,
- GOTOS => {
- 'elements' => 26
- }
- },
- {#State 21
- DEFAULT => -15,
- GOTOS => {
- 'elements' => 27
- }
- },
- {#State 22
- ACTIONS => {
- "=" => 28
- },
- DEFAULT => -13
- },
- {#State 23
- ACTIONS => {
- "}" => 29,
- "," => 30
- }
- },
- {#State 24
- DEFAULT => -11
- },
- {#State 25
- ACTIONS => {
- "}" => 31,
- 'UNION' => 37,
- 'IDENTIFIER' => 33,
- 'ENUM' => 32,
- 'STRUCT' => 35,
- 'CONST' => 34
- },
- GOTOS => {
- 'struct' => 38,
- 'type' => 39,
- 'union' => 40,
- 'element' => 36
- }
- },
- {#State 26
- ACTIONS => {
- "}" => 41,
- 'UNION' => 37,
- 'IDENTIFIER' => 33,
- 'ENUM' => 32,
- 'STRUCT' => 35,
- 'CONST' => 34
- },
- GOTOS => {
- 'struct' => 38,
- 'type' => 39,
- 'union' => 40,
- 'element' => 36
- }
- },
- {#State 27
- ACTIONS => {
- "}" => 42,
- 'UNION' => 37,
- 'IDENTIFIER' => 33,
- 'ENUM' => 32,
- 'STRUCT' => 35,
- 'CONST' => 34
- },
- GOTOS => {
- 'struct' => 38,
- 'type' => 39,
- 'union' => 40,
- 'element' => 36
- }
- },
- {#State 28
- ACTIONS => {
- 'IDENTIFIER' => 43
- }
- },
- {#State 29
- ACTIONS => {
- ";" => 44
- }
- },
- {#State 30
- ACTIONS => {
- 'IDENTIFIER' => 22
- },
- GOTOS => {
- 'enum_identifier' => 45
- }
- },
- {#State 31
- DEFAULT => -28,
- GOTOS => {
- 'pointers' => 46
- }
- },
- {#State 32
- ACTIONS => {
- 'IDENTIFIER' => 47
- }
- },
- {#State 33
- DEFAULT => -26
- },
- {#State 34
- ACTIONS => {
- 'IDENTIFIER' => 33,
- 'ENUM' => 32
- },
- GOTOS => {
- 'type' => 48
- }
- },
- {#State 35
- ACTIONS => {
- 'IDENTIFIER' => 49
- },
- DEFAULT => -33,
- GOTOS => {
- 'optional_identifier' => 13
- }
- },
- {#State 36
- DEFAULT => -16
- },
- {#State 37
- ACTIONS => {
- 'IDENTIFIER' => 50
- },
- DEFAULT => -33,
- GOTOS => {
- 'optional_identifier' => 16
- }
- },
- {#State 38
- DEFAULT => -18
- },
- {#State 39
- DEFAULT => -28,
- GOTOS => {
- 'pointers' => 51
- }
- },
- {#State 40
- DEFAULT => -19
- },
- {#State 41
- DEFAULT => -28,
- GOTOS => {
- 'pointers' => 52
- }
- },
- {#State 42
- ACTIONS => {
- 'IDENTIFIER' => 12
- },
- DEFAULT => -33,
- GOTOS => {
- 'optional_identifier' => 53
- }
- },
- {#State 43
- DEFAULT => -14
- },
- {#State 44
- DEFAULT => -10
- },
- {#State 45
- DEFAULT => -12
- },
- {#State 46
- ACTIONS => {
- 'IDENTIFIER' => 12,
- "*" => 55
- },
- DEFAULT => -33,
- GOTOS => {
- 'optional_identifier' => 54,
- 'optional_identifiers' => 56
- }
- },
- {#State 47
- DEFAULT => -27
- },
- {#State 48
- DEFAULT => -28,
- GOTOS => {
- 'pointers' => 57
- }
- },
- {#State 49
- ACTIONS => {
- "{" => -32
- },
- DEFAULT => -28,
- GOTOS => {
- 'pointers' => 58
- }
- },
- {#State 50
- ACTIONS => {
- "{" => -32
- },
- DEFAULT => -28,
- GOTOS => {
- 'pointers' => 59
- }
- },
- {#State 51
- ACTIONS => {
- 'IDENTIFIER' => 60,
- "*" => 55
- }
- },
- {#State 52
- ACTIONS => {
- 'IDENTIFIER' => 12,
- "*" => 55
- },
- DEFAULT => -33,
- GOTOS => {
- 'optional_identifier' => 61
- }
- },
- {#State 53
- ACTIONS => {
- ";" => 62
- }
- },
- {#State 54
- DEFAULT => -30
- },
- {#State 55
- DEFAULT => -29
- },
- {#State 56
- ACTIONS => {
- ";" => 63,
- "," => 64
- }
- },
- {#State 57
- ACTIONS => {
- 'IDENTIFIER' => 65,
- "*" => 55
- }
- },
- {#State 58
- ACTIONS => {
- 'IDENTIFIER' => 66,
- "*" => 55
- }
- },
- {#State 59
- ACTIONS => {
- 'IDENTIFIER' => 67,
- "*" => 55
- }
- },
- {#State 60
- ACTIONS => {
- "[" => 69
- },
- DEFAULT => -24,
- GOTOS => {
- 'array' => 68
- }
- },
- {#State 61
- ACTIONS => {
- ";" => 70
- }
- },
- {#State 62
- DEFAULT => -9
- },
- {#State 63
- DEFAULT => -7
- },
- {#State 64
- ACTIONS => {
- 'IDENTIFIER' => 12
- },
- DEFAULT => -33,
- GOTOS => {
- 'optional_identifier' => 71
- }
- },
- {#State 65
- ACTIONS => {
- "[" => 69
- },
- DEFAULT => -24,
- GOTOS => {
- 'array' => 72
- }
- },
- {#State 66
- ACTIONS => {
- ";" => 73
- }
- },
- {#State 67
- ACTIONS => {
- ";" => 74
- }
- },
- {#State 68
- ACTIONS => {
- ";" => 75
- }
- },
- {#State 69
- ACTIONS => {
- 'CONSTANT' => 76
- }
- },
- {#State 70
- DEFAULT => -8
- },
- {#State 71
- DEFAULT => -31
- },
- {#State 72
- ACTIONS => {
- ";" => 77
- }
- },
- {#State 73
- DEFAULT => -20
- },
- {#State 74
- DEFAULT => -21
- },
- {#State 75
- DEFAULT => -23
- },
- {#State 76
- ACTIONS => {
- "]" => 78
- }
- },
- {#State 77
- DEFAULT => -22
- },
- {#State 78
- DEFAULT => -25
- }
-],
- yyrules =>
-[
- [#Rule 0
- '$start', 2, undef
- ],
- [#Rule 1
- 'definitions', 1,
-sub
-#line 14 "build/pidl/smb_interfaces.yp"
-{ [$_[1]] }
- ],
- [#Rule 2
- 'definitions', 2,
-sub
-#line 15 "build/pidl/smb_interfaces.yp"
-{ push(@{$_[1]}, $_[2]); $_[1] }
- ],
- [#Rule 3
- 'definition', 1, undef
- ],
- [#Rule 4
- 'definition', 1, undef
- ],
- [#Rule 5
- 'definition', 1, undef
- ],
- [#Rule 6
- 'definition', 1, undef
- ],
- [#Rule 7
- 'struct', 8,
-sub
-#line 26 "build/pidl/smb_interfaces.yp"
-{
- {
- "NAME" => $_[7],
- "STRUCT_NAME" => $_[2],
- "TYPE" => "struct",
- "DATA" => $_[4],
- }
- }
- ],
- [#Rule 8
- 'union', 8,
-sub
-#line 38 "build/pidl/smb_interfaces.yp"
-{
- {
- "NAME" => $_[7],
- "UNION_NAME" => $_[2],
- "TYPE" => "union",
- "DATA" => $_[4],
- }
- }
- ],
- [#Rule 9
- 'typedef', 7, undef
- ],
- [#Rule 10
- 'enum', 6, undef
- ],
- [#Rule 11
- 'enum_identifiers', 1, undef
- ],
- [#Rule 12
- 'enum_identifiers', 3, undef
- ],
- [#Rule 13
- 'enum_identifier', 1, undef
- ],
- [#Rule 14
- 'enum_identifier', 3, undef
- ],
- [#Rule 15
- 'elements', 0, undef
- ],
- [#Rule 16
- 'elements', 2,
-sub
-#line 65 "build/pidl/smb_interfaces.yp"
-{ push(@{$_[1]}, $_[2]); $_[1] }
- ],
- [#Rule 17
- 'element', 0, undef
- ],
- [#Rule 18
- 'element', 1, undef
- ],
- [#Rule 19
- 'element', 1, undef
- ],
- [#Rule 20
- 'element', 5,
-sub
-#line 72 "build/pidl/smb_interfaces.yp"
-{{
- "NAME" => [$_[2]],
- "POINTERS" => $_[3],
- "TYPE" => "struct $_[2]",
- }}
- ],
- [#Rule 21
- 'element', 5,
-sub
-#line 78 "build/pidl/smb_interfaces.yp"
-{{
- "NAME" => $_[2],
- "POINTERS" => $_[3],
- "TYPE" => "union $_[2]",
- }}
- ],
- [#Rule 22
- 'element', 6,
-sub
-#line 84 "build/pidl/smb_interfaces.yp"
-{{
- "NAME" => [$_[4]],
- "TYPE" => $_[2],
- "POINTERS" => $_[3],
- }}
- ],
- [#Rule 23
- 'element', 5,
-sub
-#line 90 "build/pidl/smb_interfaces.yp"
-{{
- "NAME" => [$_[3]],
- "TYPE" => $_[1],
- "POINTERS" => $_[2],
- "ARRAY_LENGTH" => $_[4]
- }}
- ],
- [#Rule 24
- 'array', 0, undef
- ],
- [#Rule 25
- 'array', 3,
-sub
-#line 99 "build/pidl/smb_interfaces.yp"
-{ int($_[2]) }
- ],
- [#Rule 26
- 'type', 1, undef
- ],
- [#Rule 27
- 'type', 2,
-sub
-#line 104 "build/pidl/smb_interfaces.yp"
-{ "enum $_[2]" }
- ],
- [#Rule 28
- 'pointers', 0, undef
- ],
- [#Rule 29
- 'pointers', 2,
-sub
-#line 109 "build/pidl/smb_interfaces.yp"
-{ $_[1]+1 }
- ],
- [#Rule 30
- 'optional_identifiers', 1,
-sub
-#line 112 "build/pidl/smb_interfaces.yp"
-{ [$_[1]] }
- ],
- [#Rule 31
- 'optional_identifiers', 3,
-sub
-#line 113 "build/pidl/smb_interfaces.yp"
-{ push(@{$_[1]}, $_[3]); $_[1] }
- ],
- [#Rule 32
- 'optional_identifier', 1, undef
- ],
- [#Rule 33
- 'optional_identifier', 0, undef
- ]
-],
- @_);
- bless($self,$class);
-}
-
-#line 119 "build/pidl/smb_interfaces.yp"
-
-
-#####################################################################
-# traverse a perl data structure removing any empty arrays or
-# hashes and any hash elements that map to undef
-sub CleanData($)
-{
- sub CleanData($);
- my($v) = shift;
- if (ref($v) eq "ARRAY") {
- foreach my $i (0 .. $#{$v}) {
- CleanData($v->[$i]);
- if (ref($v->[$i]) eq "ARRAY" && $#{$v->[$i]}==-1) {
- $v->[$i] = undef;
- next;
- }
- }
- # this removes any undefined elements from the array
- @{$v} = grep { defined $_ } @{$v};
- } elsif (ref($v) eq "HASH") {
- foreach my $x (keys %{$v}) {
- CleanData($v->{$x});
- if (!defined $v->{$x}) { delete($v->{$x}); next; }
- if (ref($v->{$x}) eq "ARRAY" && $#{$v->{$x}}==-1) { delete($v->{$x}); next; }
- }
- }
- return $v;
-}
-
-sub _Error {
- if (exists $_[0]->YYData->{ERRMSG}) {
- print $_[0]->YYData->{ERRMSG};
- delete $_[0]->YYData->{ERRMSG};
- return;
- };
- my $line = $_[0]->YYData->{LINE};
- my $last_token = $_[0]->YYData->{LAST_TOKEN};
- my $file = $_[0]->YYData->{INPUT_FILENAME};
-
- print "$file:$line: Syntax error near '$last_token'\n";
-}
-
-sub _Lexer($)
-{
- my($parser)=shift;
-
- $parser->YYData->{INPUT} or return('',undef);
-
-again:
- $parser->YYData->{INPUT} =~ s/^[ \t]*//;
-
- for ($parser->YYData->{INPUT}) {
- if (/^\#/) {
- if (s/^\# (\d+) \"(.*?)\"( \d+|)//) {
- $parser->YYData->{LINE} = $1-1;
- $parser->YYData->{INPUT_FILENAME} = $2;
- goto again;
- }
- if (s/^\#line (\d+) \"(.*?)\"( \d+|)//) {
- $parser->YYData->{LINE} = $1-1;
- $parser->YYData->{INPUT_FILENAME} = $2;
- goto again;
- }
- if (s/^(\#.*)$//m) {
- goto again;
- }
- }
- if (s/^(\n)//) {
- $parser->YYData->{LINE}++;
- goto again;
- }
- if (s/^\"(.*?)\"//) {
- $parser->YYData->{LAST_TOKEN} = $1;
- return('TEXT',$1);
- }
- if (s/^(\d+)(\W|$)/$2/) {
- $parser->YYData->{LAST_TOKEN} = $1;
- return('CONSTANT',$1);
- }
- if (s/^([\w_]+)//) {
- $parser->YYData->{LAST_TOKEN} = $1;
- if ($1 =~
- /^(const|typedef|union|struct|enum)$/x) {
- return uc($1);
- }
- return('IDENTIFIER',$1);
- }
- if (s/^(.)//s) {
- $parser->YYData->{LAST_TOKEN} = $1;
- return($1,$1);
- }
- }
-}
-
-sub parse($$)
-{
- my ($self,$filename) = @_;
-
- my $saved_delim = $/;
- undef $/;
- my $cpp = $ENV{CPP};
- if (! defined $cpp) {
- $cpp = "cpp"
- }
- my $data = `$cpp -D__PIDL__ -xc $filename`;
- $/ = $saved_delim;
-
- $self->YYData->{INPUT} = $data;
- $self->YYData->{LINE} = 0;
- $self->YYData->{LAST_TOKEN} = "NONE";
-
- my $idl = $self->YYParse( yylex => \&_Lexer, yyerror => \&_Error );
-
- return CleanData($idl);
-}
-
-1;
diff --git a/source4/pidl/smb_interfaces.yp b/source4/pidl/smb_interfaces.yp
deleted file mode 100644
index f8c34eacdc..0000000000
--- a/source4/pidl/smb_interfaces.yp
+++ /dev/null
@@ -1,233 +0,0 @@
-########################
-# Parse::Yapp parser for a C header file that contains only structures
-# or unions.
-
-# Copyright (C) 2005, Tim Potter <tpot@samba.org> released under the
-# GNU GPL version 2 or later
-
-################
-# grammar
-
-%%
-
-definitions:
- definition { [$_[1]] }
- | definitions definition { push(@{$_[1]}, $_[2]); $_[1] }
-;
-
-definition:
- struct
- | union
- | typedef
- | enum
-;
-
-struct: STRUCT optional_identifier '{' elements '}' pointers optional_identifiers ';'
- {
- {
- "NAME" => $_[7],
- "STRUCT_NAME" => $_[2],
- "TYPE" => "struct",
- "DATA" => $_[4],
- }
- }
-;
-
-union:
- UNION optional_identifier '{' elements '}' pointers optional_identifier ';'
- {
- {
- "NAME" => $_[7],
- "UNION_NAME" => $_[2],
- "TYPE" => "union",
- "DATA" => $_[4],
- }
- }
-;
-
-typedef:
- TYPEDEF STRUCT '{' elements '}' optional_identifier ';'
-;
-
-enum:
- ENUM IDENTIFIER '{' enum_identifiers '}' ';'
-;
-
-enum_identifiers: enum_identifier
- | enum_identifiers ',' enum_identifier
-;
-
-enum_identifier: IDENTIFIER
- | IDENTIFIER '=' IDENTIFIER
-;
-
-elements: #empty
- | elements element { push(@{$_[1]}, $_[2]); $_[1] }
-;
-
-element:
- | struct
- | union
- | STRUCT IDENTIFIER pointers IDENTIFIER ';'
- {{
- "NAME" => [$_[2]],
- "POINTERS" => $_[3],
- "TYPE" => "struct $_[2]",
- }}
- | UNION IDENTIFIER pointers IDENTIFIER ';'
- {{
- "NAME" => $_[2],
- "POINTERS" => $_[3],
- "TYPE" => "union $_[2]",
- }}
- | CONST type pointers IDENTIFIER array ';'
- {{
- "NAME" => [$_[4]],
- "TYPE" => $_[2],
- "POINTERS" => $_[3],
- }}
- | type pointers IDENTIFIER array ';'
- {{
- "NAME" => [$_[3]],
- "TYPE" => $_[1],
- "POINTERS" => $_[2],
- "ARRAY_LENGTH" => $_[4]
- }}
-;
-
-array: #empty
- | '[' CONSTANT ']' { int($_[2]) }
-;
-
-type: IDENTIFIER
- | ENUM IDENTIFIER
- { "enum $_[2]" }
-;
-
-pointers:
- #empty { 0 }
- | pointers '*' { $_[1]+1 }
-;
-
-optional_identifiers: optional_identifier { [$_[1]] }
- | optional_identifiers ',' optional_identifier { push(@{$_[1]}, $_[3]); $_[1] }
-;
-
-optional_identifier: IDENTIFIER | #empty { undef }
-;
-
-%%
-
-#####################################################################
-# traverse a perl data structure removing any empty arrays or
-# hashes and any hash elements that map to undef
-sub CleanData($)
-{
- sub CleanData($);
- my($v) = shift;
- if (ref($v) eq "ARRAY") {
- foreach my $i (0 .. $#{$v}) {
- CleanData($v->[$i]);
- if (ref($v->[$i]) eq "ARRAY" && $#{$v->[$i]}==-1) {
- $v->[$i] = undef;
- next;
- }
- }
- # this removes any undefined elements from the array
- @{$v} = grep { defined $_ } @{$v};
- } elsif (ref($v) eq "HASH") {
- foreach my $x (keys %{$v}) {
- CleanData($v->{$x});
- if (!defined $v->{$x}) { delete($v->{$x}); next; }
- if (ref($v->{$x}) eq "ARRAY" && $#{$v->{$x}}==-1) { delete($v->{$x}); next; }
- }
- }
- return $v;
-}
-
-sub _Error {
- if (exists $_[0]->YYData->{ERRMSG}) {
- print $_[0]->YYData->{ERRMSG};
- delete $_[0]->YYData->{ERRMSG};
- return;
- };
- my $line = $_[0]->YYData->{LINE};
- my $last_token = $_[0]->YYData->{LAST_TOKEN};
- my $file = $_[0]->YYData->{INPUT_FILENAME};
-
- print "$file:$line: Syntax error near '$last_token'\n";
-}
-
-sub _Lexer($)
-{
- my($parser)=shift;
-
- $parser->YYData->{INPUT} or return('',undef);
-
-again:
- $parser->YYData->{INPUT} =~ s/^[ \t]*//;
-
- for ($parser->YYData->{INPUT}) {
- if (/^\#/) {
- if (s/^\# (\d+) \"(.*?)\"( \d+|)//) {
- $parser->YYData->{LINE} = $1-1;
- $parser->YYData->{INPUT_FILENAME} = $2;
- goto again;
- }
- if (s/^\#line (\d+) \"(.*?)\"( \d+|)//) {
- $parser->YYData->{LINE} = $1-1;
- $parser->YYData->{INPUT_FILENAME} = $2;
- goto again;
- }
- if (s/^(\#.*)$//m) {
- goto again;
- }
- }
- if (s/^(\n)//) {
- $parser->YYData->{LINE}++;
- goto again;
- }
- if (s/^\"(.*?)\"//) {
- $parser->YYData->{LAST_TOKEN} = $1;
- return('TEXT',$1);
- }
- if (s/^(\d+)(\W|$)/$2/) {
- $parser->YYData->{LAST_TOKEN} = $1;
- return('CONSTANT',$1);
- }
- if (s/^([\w_]+)//) {
- $parser->YYData->{LAST_TOKEN} = $1;
- if ($1 =~
- /^(const|typedef|union|struct|enum)$/x) {
- return uc($1);
- }
- return('IDENTIFIER',$1);
- }
- if (s/^(.)//s) {
- $parser->YYData->{LAST_TOKEN} = $1;
- return($1,$1);
- }
- }
-}
-
-sub parse($$)
-{
- my ($self,$filename) = @_;
-
- my $saved_delim = $/;
- undef $/;
- my $cpp = $ENV{CPP};
- if (! defined $cpp) {
- $cpp = "cpp"
- }
- my $data = `$cpp -D__PIDL__ -xc $filename`;
- $/ = $saved_delim;
-
- $self->YYData->{INPUT} = $data;
- $self->YYData->{LINE} = 0;
- $self->YYData->{LAST_TOKEN} = "NONE";
-
- my $idl = $self->YYParse( yylex => \&_Lexer, yyerror => \&_Error );
-
- return CleanData($idl);
-}
diff --git a/source4/pidl/tests/cutil.pl b/source4/pidl/tests/cutil.pl
new file mode 100755
index 0000000000..78c8bce45e
--- /dev/null
+++ b/source4/pidl/tests/cutil.pl
@@ -0,0 +1,21 @@
+#!/usr/bin/perl
+# (C) 2007 Jelmer Vernooij <jelmer@samba.org>
+# Published under the GNU General Public License
+use strict;
+use warnings;
+
+use Test::More tests => 7;
+use FindBin qw($RealBin);
+use lib "$RealBin";
+use Util;
+use Parse::Pidl::Util qw(MyDumper);
+use Parse::Pidl::CUtil qw(get_pointer_to get_value_of);
+
+is("&foo", get_pointer_to("foo"));
+is("&(&foo)", get_pointer_to(get_pointer_to("foo")));
+is("*foo", get_pointer_to("**foo"));
+is("foo", get_pointer_to("*foo"));
+
+is("foo", get_value_of("&foo"));
+is("*foo", get_value_of("foo"));
+is("**foo", get_value_of("*foo"));
diff --git a/source4/pidl/tests/header.pl b/source4/pidl/tests/header.pl
index 8d0dccf507..db59484444 100755
--- a/source4/pidl/tests/header.pl
+++ b/source4/pidl/tests/header.pl
@@ -4,12 +4,14 @@
use strict;
use warnings;
-use Test::More tests => 16;
+use Test::More tests => 27;
use FindBin qw($RealBin);
use lib "$RealBin";
use Util;
use Parse::Pidl::Util qw(MyDumper);
-use Parse::Pidl::Samba4::Header;
+use Parse::Pidl::Samba4::Header qw(
+ GenerateFunctionInEnv GenerateFunctionOutEnv GenerateStructEnv
+ EnvSubstituteValue);
use Parse::Pidl::IDL qw(parse_string);
use Parse::Pidl::NDR;
@@ -56,3 +58,51 @@ like(parse_idl("interface p { typedef struct x { int p; } x; };"),
like(parse_idl("cpp_quote(\"some-foo\")"),
qr/some-foo/sm, "cpp quote");
+
+# Make sure GenerateFunctionInEnv and GenerateFunctionOutEnv work
+my $fn = { ELEMENTS => [ { DIRECTION => ["in"], NAME => "foo" } ] };
+is_deeply({ "foo" => "r->in.foo" }, GenerateFunctionInEnv($fn));
+
+$fn = { ELEMENTS => [ { DIRECTION => ["out"], NAME => "foo" } ] };
+is_deeply({ "foo" => "r->out.foo" }, GenerateFunctionOutEnv($fn));
+
+$fn = { ELEMENTS => [ { DIRECTION => ["out", "in"], NAME => "foo" } ] };
+is_deeply({ "foo" => "r->in.foo" }, GenerateFunctionInEnv($fn));
+
+$fn = { ELEMENTS => [ { DIRECTION => ["out", "in"], NAME => "foo" } ] };
+is_deeply({ "foo" => "r->out.foo" }, GenerateFunctionOutEnv($fn));
+
+$fn = { ELEMENTS => [ { DIRECTION => ["in"], NAME => "foo" } ] };
+is_deeply({ "foo" => "r->in.foo" }, GenerateFunctionOutEnv($fn));
+
+$fn = { ELEMENTS => [ { DIRECTION => ["out"], NAME => "foo" } ] };
+is_deeply({ }, GenerateFunctionInEnv($fn));
+
+$fn = { ELEMENTS => [ { NAME => "foo" }, { NAME => "bar" } ] };
+is_deeply({ foo => "r->foo", bar => "r->bar", this => "r" },
+ GenerateStructEnv($fn, "r"));
+
+$fn = { ELEMENTS => [ { NAME => "foo" }, { NAME => "bar" } ] };
+is_deeply({ foo => "some->complex.variable->foo",
+ bar => "some->complex.variable->bar",
+ this => "some->complex.variable" },
+ GenerateStructEnv($fn, "some->complex.variable"));
+
+$fn = { ELEMENTS => [ { NAME => "foo", PROPERTIES => { value => 3 }} ] };
+
+my $env = GenerateStructEnv($fn, "r");
+EnvSubstituteValue($env, $fn);
+is_deeply($env, { foo => 3, this => "r" });
+
+$fn = { ELEMENTS => [ { NAME => "foo" }, { NAME => "bar" } ] };
+$env = GenerateStructEnv($fn, "r");
+EnvSubstituteValue($env, $fn);
+is_deeply($env, { foo => 'r->foo', bar => 'r->bar', this => "r" });
+
+$fn = { ELEMENTS => [ { NAME => "foo", PROPERTIES => { value => 0 }} ] };
+
+$env = GenerateStructEnv($fn, "r");
+EnvSubstituteValue($env, $fn);
+is_deeply($env, { foo => 0, this => "r" });
+
+
diff --git a/source4/pidl/tests/ndr.pl b/source4/pidl/tests/ndr.pl
index 1512f19d52..7fcc7ef40e 100755
--- a/source4/pidl/tests/ndr.pl
+++ b/source4/pidl/tests/ndr.pl
@@ -4,7 +4,7 @@
use strict;
use warnings;
-use Test::More tests => 34;
+use Test::More tests => 40;
use FindBin qw($RealBin);
use lib "$RealBin";
use Util;
@@ -212,9 +212,16 @@ is(align_type({ TYPE => "STRUCT", "NAME" => "bla",
ELEMENTS => [ { TYPE => "uint16" } ] }), 4);
is(align_type({ TYPE => "STRUCT",
ELEMENTS => [ { TYPE => "hyper" } ] }), 8);
-is(align_type({ TYPE => "DECLARE", DATA => {
+is(align_type({ TYPE => "TYPEDEF", DATA => {
TYPE => "STRUCT",
ELEMENTS => [ { TYPE => "hyper" } ] }}), 8);
+# typedef of struct without body
+is(align_type({ TYPE => "TYPEDEF", DATA => {
+ TYPE => "STRUCT", ELEMENTS => undef }}), 4);
+# struct without body
+is(align_type({ TYPE => "STRUCT", ELEMENTS => undef }), 4);
+# empty struct
+is(align_type({ TYPE => "STRUCT", ELEMENTS => [] }), 1);
is(align_type({ TYPE => "STRUCT", "NAME" => "bla",
ELEMENTS => [ { TYPE => "uint8" } ] }), 4);
@@ -268,3 +275,9 @@ ok(not can_contain_deferred({ TYPE => "TYPEDEF",
ELEMENTS => [ { TYPE => "uint32" } ]}}));
ok(can_contain_deferred({ TYPE => "STRUCT",
ELEMENTS => [ { TYPE => "someunknowntype" } ]}));
+# Make sure the elements for a enum without body aren't filled in
+ok(not defined(ParseType({TYPE => "ENUM", NAME => "foo" }, "ref")->{ELEMENTS}));
+# Make sure the elements for a bitmap without body aren't filled in
+ok(not defined(ParseType({TYPE => "BITMAP", NAME => "foo" }, "ref")->{ELEMENTS}));
+# Make sure the elements for a union without body aren't filled in
+ok(not defined(ParseType({TYPE => "UNION", NAME => "foo" }, "ref")->{ELEMENTS}));
diff --git a/source4/pidl/tests/parse_idl.pl b/source4/pidl/tests/parse_idl.pl
index 96c7b2adc8..9d43ddccc7 100755
--- a/source4/pidl/tests/parse_idl.pl
+++ b/source4/pidl/tests/parse_idl.pl
@@ -4,7 +4,7 @@
# Published under the GNU General Public License
use strict;
-use Test::More tests => 65 * 2 + 3;
+use Test::More tests => 65 * 2 + 7;
use FindBin qw($RealBin);
use lib "$RealBin";
use Util qw(test_errors);
@@ -129,4 +129,36 @@ is_deeply($x,
[ { 'FILE' => '<quote>', 'DATA' => '"foobar"',
'TYPE' => 'CPP_QUOTE', 'LINE' => 0 } ]);
+# A typedef of a struct without body
+$x = Parse::Pidl::IDL::parse_string("interface foo { typedef struct x y; }", "<foo>");
+is_deeply($x,
+ [ { 'FILE' => '<foo>', 'NAME' => 'foo', 'DATA' => [
+ { 'FILE' => '<foo>', 'LINE' => 0, 'NAME' => 'y', 'TYPE' => 'TYPEDEF', DATA => {
+ TYPE => 'STRUCT', NAME => 'x' } } ],
+ 'TYPE' => 'INTERFACE', 'LINE' => 0 } ]);
+
+# A typedef of a struct with empty body
+$x = Parse::Pidl::IDL::parse_string("interface foo { typedef struct {} y; }", "<foo>");
+
+is_deeply($x,
+ [ { 'FILE' => '<foo>', 'NAME' => 'foo', 'DATA' => [
+ { 'FILE' => '<foo>', 'LINE' => 0, 'NAME' => 'y', 'TYPE' => 'TYPEDEF', DATA => { TYPE => 'STRUCT', ELEMENTS => [] } } ],
+ 'TYPE' => 'INTERFACE', 'LINE' => 0 } ]);
+
+# A typedef of a bitmap with no body
+$x = Parse::Pidl::IDL::parse_string("interface foo { typedef bitmap x y; }", "<foo>");
+
+is_deeply($x,
+ [ { 'FILE' => '<foo>', 'NAME' => 'foo', 'DATA' => [
+ { 'FILE' => '<foo>', 'LINE' => 0, 'NAME' => 'y', 'TYPE' => 'TYPEDEF', DATA => { TYPE => 'BITMAP', NAME => 'x' } } ],
+ 'TYPE' => 'INTERFACE', 'LINE' => 0 } ]);
+
+
+# A typedef of a union with no body
+$x = Parse::Pidl::IDL::parse_string("interface foo { typedef union x y; }", "<foo>");
+
+is_deeply($x,
+ [ { 'FILE' => '<foo>', 'NAME' => 'foo', 'DATA' => [
+ { 'FILE' => '<foo>', 'LINE' => 0, 'NAME' => 'y', 'TYPE' => 'TYPEDEF', DATA => { TYPE => 'UNION', NAME => 'x' } } ],
+ 'TYPE' => 'INTERFACE', 'LINE' => 0 } ]);
diff --git a/source4/pidl/tests/samba-ejs.pl b/source4/pidl/tests/samba-ejs.pl
index adc00e224f..094d37a103 100755
--- a/source4/pidl/tests/samba-ejs.pl
+++ b/source4/pidl/tests/samba-ejs.pl
@@ -4,23 +4,14 @@
use strict;
use warnings;
-use Test::More tests => 17;
+use Test::More tests => 10;
use FindBin qw($RealBin);
use lib "$RealBin";
use Util;
use Parse::Pidl::Util qw(MyDumper);
-use Parse::Pidl::Samba4::EJS qw(get_pointer_to get_value_of check_null_pointer
+use Parse::Pidl::Samba4::EJS qw(check_null_pointer
fn_declare TypeFunctionName);
-is("&foo", get_pointer_to("foo"));
-is("&(&foo)", get_pointer_to(get_pointer_to("foo")));
-is("*foo", get_pointer_to("**foo"));
-is("foo", get_pointer_to("*foo"));
-
-is("foo", get_value_of("&foo"));
-is("*foo", get_value_of("foo"));
-is("**foo", get_value_of("*foo"));
-
my $ejs = new Parse::Pidl::Samba4::EJS();
$ejs->check_null_pointer("bla");
diff --git a/source4/pidl/tests/samba-ndr.pl b/source4/pidl/tests/samba-ndr.pl
index 05c3c1c0df..a14111961f 100755
--- a/source4/pidl/tests/samba-ndr.pl
+++ b/source4/pidl/tests/samba-ndr.pl
@@ -4,15 +4,14 @@
use strict;
use warnings;
-use Test::More tests => 41;
+use Test::More tests => 30;
use FindBin qw($RealBin);
use lib "$RealBin";
use Util;
use strict;
use Parse::Pidl::Util qw(MyDumper);
use Parse::Pidl::Samba4::NDR::Parser qw(check_null_pointer
- GenerateFunctionInEnv GenerateFunctionOutEnv GenerateStructEnv
- EnvSubstituteValue NeededFunction NeededElement NeededType
+ NeededFunction NeededElement NeededType
NeededInterface TypeFunctionName ParseElementPrint);
my $output;
@@ -138,52 +137,6 @@ test_warnings("nofile:2: unknown dereferenced expression `r->in.bla'\n",
is($output, "if (r->in.bla == NULL) return;");
-# Make sure GenerateFunctionInEnv and GenerateFunctionOutEnv work
-$fn = { ELEMENTS => [ { DIRECTION => ["in"], NAME => "foo" } ] };
-is_deeply({ "foo" => "r->in.foo" }, GenerateFunctionInEnv($fn));
-
-$fn = { ELEMENTS => [ { DIRECTION => ["out"], NAME => "foo" } ] };
-is_deeply({ "foo" => "r->out.foo" }, GenerateFunctionOutEnv($fn));
-
-$fn = { ELEMENTS => [ { DIRECTION => ["out", "in"], NAME => "foo" } ] };
-is_deeply({ "foo" => "r->in.foo" }, GenerateFunctionInEnv($fn));
-
-$fn = { ELEMENTS => [ { DIRECTION => ["out", "in"], NAME => "foo" } ] };
-is_deeply({ "foo" => "r->out.foo" }, GenerateFunctionOutEnv($fn));
-
-$fn = { ELEMENTS => [ { DIRECTION => ["in"], NAME => "foo" } ] };
-is_deeply({ "foo" => "r->in.foo" }, GenerateFunctionOutEnv($fn));
-
-$fn = { ELEMENTS => [ { DIRECTION => ["out"], NAME => "foo" } ] };
-is_deeply({ }, GenerateFunctionInEnv($fn));
-
-$fn = { ELEMENTS => [ { NAME => "foo" }, { NAME => "bar" } ] };
-is_deeply({ foo => "r->foo", bar => "r->bar", this => "r" },
- GenerateStructEnv($fn, "r"));
-
-$fn = { ELEMENTS => [ { NAME => "foo" }, { NAME => "bar" } ] };
-is_deeply({ foo => "some->complex.variable->foo",
- bar => "some->complex.variable->bar",
- this => "some->complex.variable" },
- GenerateStructEnv($fn, "some->complex.variable"));
-
-$fn = { ELEMENTS => [ { NAME => "foo", PROPERTIES => { value => 3 }} ] };
-
-my $env = GenerateStructEnv($fn, "r");
-EnvSubstituteValue($env, $fn);
-is_deeply($env, { foo => 3, this => "r" });
-
-$fn = { ELEMENTS => [ { NAME => "foo" }, { NAME => "bar" } ] };
-$env = GenerateStructEnv($fn, "r");
-EnvSubstituteValue($env, $fn);
-is_deeply($env, { foo => 'r->foo', bar => 'r->bar', this => "r" });
-
-$fn = { ELEMENTS => [ { NAME => "foo", PROPERTIES => { value => 0 }} ] };
-
-$env = GenerateStructEnv($fn, "r");
-EnvSubstituteValue($env, $fn);
-is_deeply($env, { foo => 0, this => "r" });
-
my $needed = {};
NeededElement({ TYPE => "foo", REPRESENTATION_TYPE => "foo" }, "pull", $needed);
is_deeply($needed, { ndr_pull_foo => 1 });
diff --git a/source4/pidl/tests/samba3-cli.pl b/source4/pidl/tests/samba3-cli.pl
index 5086300e46..f5b51b7d34 100755
--- a/source4/pidl/tests/samba3-cli.pl
+++ b/source4/pidl/tests/samba3-cli.pl
@@ -10,7 +10,7 @@ use lib "$RealBin";
use Util;
use Parse::Pidl::Util qw(MyDumper);
use Parse::Pidl::Samba3::ClientNDR qw(ParseFunction);
-use Parse::Pidl::Samba4::NDR::Parser qw(GenerateFunctionInEnv GenerateFunctionOutEnv);
+use Parse::Pidl::Samba4::Header qw(GenerateFunctionInEnv GenerateFunctionOutEnv);
# Make sure GenerateFunctionInEnv and GenerateFunctionOutEnv work
my $fn = { ELEMENTS => [ { DIRECTION => ["in"], NAME => "foo" } ] };
@@ -29,31 +29,40 @@ my $x = new Parse::Pidl::Samba3::ClientNDR();
$fn = { NAME => "bar", ELEMENTS => [ ] };
$x->ParseFunction("foo", $fn);
-is($x->{res}, "NTSTATUS rpccli_bar(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+is($x->{res},
+"NTSTATUS rpccli_bar(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx)
{
\tstruct bar r;
\tNTSTATUS status;
-\t
+
\t/* In parameters */
-\t
-\tif (DEBUGLEVEL >= 10)
+
+\tif (DEBUGLEVEL >= 10) {
\t\tNDR_PRINT_IN_DEBUG(bar, &r);
-\t
-\tstatus = cli_do_rpc_ndr(cli, mem_ctx, PI_FOO, &ndr_table_foo, NDR_BAR, &r);
-\t
+\t}
+
+ status = cli_do_rpc_ndr(cli,
+ mem_ctx,
+ PI_FOO,
+ &ndr_table_foo,
+ NDR_BAR,
+ &r);
+
\tif (!NT_STATUS_IS_OK(status)) {
\t\treturn status;
\t}
-\t
-\tif (DEBUGLEVEL >= 10)
+
+\tif (DEBUGLEVEL >= 10) {
\t\tNDR_PRINT_OUT_DEBUG(bar, &r);
-\t
+\t}
+
\tif (NT_STATUS_IS_ERR(status)) {
\t\treturn status;
\t}
-\t
+
\t/* Return variables */
-\t
+
\t/* Return result */
\treturn NT_STATUS_OK;
}
@@ -64,36 +73,46 @@ $x = new Parse::Pidl::Samba3::ClientNDR();
$fn = { NAME => "bar", ELEMENTS => [ ], RETURN_TYPE => "WERROR" };
$x->ParseFunction("foo", $fn);
-is($x->{res}, "NTSTATUS rpccli_bar(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+is($x->{res},
+"NTSTATUS rpccli_bar(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx,
+ WERROR *werror)
{
\tstruct bar r;
\tNTSTATUS status;
-\t
+
\t/* In parameters */
-\t
-\tif (DEBUGLEVEL >= 10)
+
+\tif (DEBUGLEVEL >= 10) {
\t\tNDR_PRINT_IN_DEBUG(bar, &r);
-\t
-\tstatus = cli_do_rpc_ndr(cli, mem_ctx, PI_FOO, &ndr_table_foo, NDR_BAR, &r);
-\t
+\t}
+
+ status = cli_do_rpc_ndr(cli,
+ mem_ctx,
+ PI_FOO,
+ &ndr_table_foo,
+ NDR_BAR,
+ &r);
+
\tif (!NT_STATUS_IS_OK(status)) {
\t\treturn status;
\t}
-\t
-\tif (DEBUGLEVEL >= 10)
+
+\tif (DEBUGLEVEL >= 10) {
\t\tNDR_PRINT_OUT_DEBUG(bar, &r);
-\t
+\t}
+
\tif (NT_STATUS_IS_ERR(status)) {
\t\treturn status;
\t}
-\t
+
\t/* Return variables */
-\t
+
\t/* Return result */
\tif (werror) {
\t\t*werror = r.out.result;
\t}
-\t
+
\treturn werror_to_ntstatus(r.out.result);
}
diff --git a/source4/pidl/tests/samba3-srv.pl b/source4/pidl/tests/samba3-srv.pl
new file mode 100644
index 0000000000..d1e2bc9545
--- /dev/null
+++ b/source4/pidl/tests/samba3-srv.pl
@@ -0,0 +1,18 @@
+#!/usr/bin/perl
+# (C) 2008 Jelmer Vernooij <jelmer@samba.org>
+# Published under the GNU General Public License
+use strict;
+use warnings;
+
+use Test::More tests => 1;
+use FindBin qw($RealBin);
+use lib "$RealBin";
+use Util;
+use Parse::Pidl::Util qw(MyDumper has_property);
+use Parse::Pidl::Samba3::ServerNDR qw(DeclLevel);
+
+my $l = { TYPE => "DATA", DATA_TYPE => "uint32" };
+my $e = { FILE => "foo", LINE => 0, PROPERTIES => { }, TYPE => "uint32",
+ LEVELS => [ $l ] };
+
+is("uint32_t", DeclLevel($e, 0));
diff --git a/source4/pidl/tests/typelist.pl b/source4/pidl/tests/typelist.pl
index c5c409a525..54f4d34586 100755
--- a/source4/pidl/tests/typelist.pl
+++ b/source4/pidl/tests/typelist.pl
@@ -4,11 +4,11 @@
use strict;
use warnings;
-use Test::More tests => 53;
+use Test::More tests => 54;
use FindBin qw($RealBin);
use lib "$RealBin";
use Util;
-use Parse::Pidl::Typelist qw(hasType getType mapTypeName expandAlias
+use Parse::Pidl::Typelist qw(hasType typeHasBody getType mapTypeName expandAlias
mapScalarType addType typeIs is_scalar scalar_is_reference
enum_type_fn bitmap_type_fn mapType);
@@ -56,7 +56,6 @@ is(1, is_scalar({TYPE => "ENUM"}));
is(0, is_scalar({TYPE => "STRUCT"}));
is(1, is_scalar({TYPE => "TYPEDEF", DATA => {TYPE => "ENUM" }}));
is(1, is_scalar("mytypedef"));
-is(1, is_scalar({TYPE => "DECLARE", DATA => {TYPE => "ENUM" }}));
is(1, scalar_is_reference("string"));
is(0, scalar_is_reference("uint32"));
@@ -81,3 +80,6 @@ is("uint32_t", mapType({TYPE => "TYPEDEF", DATA => {TYPE => "SCALAR"}}, "uint32"
is("void", mapTypeName(undef));
is("uint32_t", mapTypeName("uint32"));
is("int32_t", mapTypeName("int"));
+
+ok(not typeHasBody({TYPE => "TYPEDEF", DATA => { TYPE => "STRUCT" }}));
+ok(typeHasBody({TYPE => "TYPEDEF", DATA => { TYPE => "STRUCT", ELEMENTS => [] }}));
diff --git a/source4/rpc_server/netlogon/dcerpc_netlogon.c b/source4/rpc_server/netlogon/dcerpc_netlogon.c
index 1ef50cd96f..3d9262b995 100644
--- a/source4/rpc_server/netlogon/dcerpc_netlogon.c
+++ b/source4/rpc_server/netlogon/dcerpc_netlogon.c
@@ -669,7 +669,8 @@ static NTSTATUS dcesrv_netr_DatabaseDeltas(struct dcesrv_call_state *dce_call, T
static NTSTATUS dcesrv_netr_DatabaseSync(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
struct netr_DatabaseSync *r)
{
- DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
+ /* win2k3 native mode returns "NOT IMPLEMENTED" for this call */
+ return NT_STATUS_NOT_IMPLEMENTED;
}
@@ -741,7 +742,8 @@ static WERROR dcesrv_netr_LogonControl2(struct dcesrv_call_state *dce_call, TALL
static NTSTATUS dcesrv_netr_DatabaseSync2(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
struct netr_DatabaseSync2 *r)
{
- DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
+ /* win2k3 native mode returns "NOT IMPLEMENTED" for this call */
+ return NT_STATUS_NOT_IMPLEMENTED;
}
@@ -867,6 +869,9 @@ static NTSTATUS fill_domain_trust_info(TALLOC_CTX *mem_ctx,
/*
netr_LogonGetDomainInfo
this is called as part of the ADS domain logon procedure.
+
+ It has an important role in convaying details about the client, such
+ as Operating System, Version, Service Pack etc.
*/
static NTSTATUS dcesrv_netr_LogonGetDomainInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
struct netr_LogonGetDomainInfo *r)
diff --git a/source4/rpc_server/samr/dcesrv_samr.c b/source4/rpc_server/samr/dcesrv_samr.c
index 03f3601257..760d774f2e 100644
--- a/source4/rpc_server/samr/dcesrv_samr.c
+++ b/source4/rpc_server/samr/dcesrv_samr.c
@@ -2910,6 +2910,9 @@ static NTSTATUS dcesrv_samr_DeleteUser(struct dcesrv_call_state *dce_call, TALLO
ret = ldb_delete(a_state->sam_ctx, a_state->account_dn);
if (ret != 0) {
+ DEBUG(1, ("Failed to delete user: %s: %s\n",
+ ldb_dn_get_linearized(a_state->account_dn),
+ ldb_errstring(a_state->sam_ctx)));
return NT_STATUS_UNSUCCESSFUL;
}
diff --git a/source4/samba4-skip b/source4/samba4-skip
index 99c1799a7a..8ce9c4f9cc 100644
--- a/source4/samba4-skip
+++ b/source4/samba4-skip
@@ -49,5 +49,4 @@ RPC-FRSAPI # Not provided by Samba 4
^samba4.NET-API-BECOME-DC.*$ # Fails
WINBIND # FIXME: This should not be skipped
NSS-TEST # Fails
-samba4.ldap.python # Conversion from EJS not yet finished
samba4.samba3sam.python # Conversion from EJS not yet finished
diff --git a/source4/script/mkversion.sh b/source4/script/mkversion.sh
index 828f67d71b..b6d82f8797 100755
--- a/source4/script/mkversion.sh
+++ b/source4/script/mkversion.sh
@@ -24,7 +24,7 @@ SAMBA_VERSION_ALPHA_RELEASE=`sed -n 's/^SAMBA_VERSION_ALPHA_RELEASE=//p' $SOURCE
SAMBA_VERSION_PRE_RELEASE=`sed -n 's/^SAMBA_VERSION_PRE_RELEASE=//p' $SOURCE_DIR$VERSION_FILE`
SAMBA_VERSION_RC_RELEASE=`sed -n 's/^SAMBA_VERSION_RC_RELEASE=//p' $SOURCE_DIR$VERSION_FILE`
-SAMBA_VERSION_IS_SVN_SNAPSHOT=`sed -n 's/^SAMBA_VERSION_IS_SVN_SNAPSHOT=//p' $SOURCE_DIR$VERSION_FILE`
+SAMBA_VERSION_IS_GIT_SNAPSHOT=`sed -n 's/^SAMBA_VERSION_IS_GIT_SNAPSHOT=//p' $SOURCE_DIR$VERSION_FILE`
SAMBA_VERSION_RELEASE_NICKNAME=`sed -n 's/^SAMBA_VERSION_RELEASE_NICKNAME=//p' $SOURCE_DIR$VERSION_FILE`
@@ -67,95 +67,35 @@ elif test -n "${SAMBA_VERSION_RC_RELEASE}";then
fi
##
-## SVN revision number?
+## GIT commit details
##
-if test x"${SAMBA_VERSION_IS_SVN_SNAPSHOT}" = x"yes";then
+if test x"${SAMBA_VERSION_IS_GIT_SNAPSHOT}" = x"yes";then
_SAVE_LANG=${LANG}
- LANG=""
+ LANG="C"
HAVEVER="no"
- if test x"${HAVEVER}" != x"yes";then
- HAVESVN=no
- SVN_INFO=`svn info ${SOURCE_DIR} 2>/dev/null`
- TMP_REVISION=`echo -e "${SVN_INFO}" | grep 'Last Changed Rev.*:' |sed -e 's/Last Changed Rev.*: \([0-9]*\).*/\1/'`
- if test -n "$TMP_REVISION"; then
- HAVESVN=yes
- HAVEVER=yes
- fi
- fi
-
- if test x"${HAVEVER}" != x"yes";then
- HAVESVK=no
- SVK_INFO=`svk info ${SOURCE_DIR} 2>/dev/null`
- TMP_REVISION=`echo -e "${SVK_INFO}" | grep 'Last Changed Rev.*:' |sed -e 's/Last Changed Rev.*: \([0-9]*\).*/\1/'`
- if test -n "$TMP_REVISION"; then
- HAVESVK=yes
- HAVEVER=yes
- fi
- TMP_MIRRORED_REVISION=`echo -e "${SVK_INFO}" | grep 'Mirrored From:.*samba\.org.*' |sed -e 's/Mirrored From: .* Rev\..* \([0-9]*\).*/\1/'`
- fi
-
- if test x"${HAVEVER}" != x"yes" -a -d "${SOURCE_DIR}../.bzr";then
- HAVEBZR=no
- BZR_INFO=`bzr version-info --check-clean ${SOURCE_DIR} 2>/dev/null`
- TMP_REVISION=`echo -e "${BZR_INFO}" | grep 'revno:' |sed -e 's/revno: \([0-9]*\).*/\1/'`
- if test -n "$TMP_REVISION"; then
- HAVEBZR=yes
- HAVEVER=yes
- fi
- TMP_MIRRORED_REVISION=`echo -e "${BZR_INFO}" | grep 'revision-id: svn-v1:.*@0c0555d6-39d7-0310-84fc-f1cc0bd64818' |sed -e 's/revision-id: svn-v1:\([0-9]*\)@0c0555d6-39d7-0310-84fc-f1cc0bd64818.*/\1/'`
- TMP_BRANCH_NICK=`echo -e "${BZR_INFO}" | grep 'branch-nick:' |sed -e 's/branch-nick: \(.*\)$/\1/'`
- TMP_CLEAN_TREE=`echo -e "${BZR_INFO}" | grep 'clean:' |sed -e 's/clean: \([a-zA-Z]*\).*/\1/'`
- fi
-
if test x"${HAVEVER}" != x"yes" -a -d "${SOURCE_DIR}../.git";then
HAVEGIT=no
- GIT_INFO=`git show --abbrev-commit HEAD 2>/dev/null`
- TMP_REVISION=`echo -e "${GIT_INFO}" | sed 1q | grep 'commit ' | sed -e 's/commit \([0-9a-f]*\).*/\1/'`
- if test -n "$TMP_REVISION";then
+ GIT_INFO=`git show --pretty=format:"%h%n%ct%n%H%n%cd" --stat HEAD 2>/dev/null`
+ GIT_COMMIT_ABBREV=`echo -e "${GIT_INFO}" | sed -n 1p`
+ GIT_COMMIT_TIME=`echo -e "${GIT_INFO}" | sed -n 2p`
+ GIT_COMMIT_FULLREV=`echo -e "${GIT_INFO}" | sed -n 3p`
+ GIT_COMMIT_DATE=`echo -e "${GIT_INFO}" | sed -n 4p`
+ if test -n "${GIT_COMMIT_ABBREV}";then
HAVEGIT=yes
HAVEVER=yes
fi
- TMP_MIRRORED_REVISION=`echo -e "${GIT_INFO}" | grep 'git-svn-id' |sed -e 's#^[ ^t]*git-svn-id: svn+ssh://svn.samba.org/data/svn/samba/branches/\(SAMBA_[34]_[0-9]\(_[0-9]\+\)\?@[0-9]*\).*#\1#'`
fi
-
-
- if test x"${HAVESVN}" = x"yes";then
- SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING}-SVN-build-${TMP_REVISION}"
- echo "#define SAMBA_VERSION_SVN_REVISION ${TMP_REVISION}" >> $OUTPUT_FILE
- elif test x"${HAVESVK}" = x"yes";then
- if test -n "$TMP_MIRRORED_REVISION"; then
- TMP_SVK_REVISION_STR="${TMP_REVISION}-${USER}@${HOSTNAME}-[SVN-${TMP_MIRRORED_REVISION}]"
- else
- TMP_SVK_REVISION_STR="${TMP_REVISION}-${USER}@${HOSTNAME}"
- fi
- SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING}-SVK-build-${TMP_SVK_REVISION_STR}"
- elif test x"${HAVEBZR}" = x"yes";then
- TMP_BZR_REVISION_STR="${TMP_REVISION}"
- if test -n "$TMP_BRANCH_NICK"; then
- TMP_BZR_REVISION_STR="${TMP_BZR_REVISION_STR}${TMP_MOD_STR}@${TMP_BRANCH_NICK}"
- fi
-
- if test -n "$TMP_MIRRORED_REVISION"; then
- TMP_BZR_REVISION_STR="${TMP_BZR_REVISION_STR}-[SVN-${TMP_MIRRORED_REVISION}]"
- fi
-
- if test x"$TMP_CLEAN_TREE" != x"True"; then
- TMP_BZR_REVISION_STR="${TMP_BZR_REVISION_STR}-[modified]"
- fi
-
- SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING}-BZR-${TMP_BZR_REVISION_STR}"
- elif test x"${HAVEGIT}" = x"yes";then
- TMP_GIT_REVISION_STR="${TMP_REVISION}"
-
- if test -n "$TMP_MIRRORED_REVISION"; then
- TMP_GIT_REVISION_STR="${TMP_GIT_REVISION_STR}-[SVN-${TMP_MIRRORED_REVISION}]"
- fi
+ if test x"${HAVEGIT}" = x"yes";then
+ SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING}-GIT-${GIT_COMMIT_ABBREV}"
- SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING}-GIT-${TMP_GIT_REVISION_STR}"
+ echo "#define SAMBA_VERSION_GIT_COMMIT_ABBREV \"${GIT_COMMIT_ABBREV}\"" >> $OUTPUT_FILE
+ echo "#define SAMBA_VERSION_GIT_COMMIT_TIME ${GIT_COMMIT_TIME}" >> $OUTPUT_FILE
+ echo "#define SAMBA_VERSION_GIT_COMMIT_FULLREV \"${GIT_COMMIT_FULLREV}\"" >> $OUTPUT_FILE
+ echo "#define SAMBA_VERSION_GIT_COMMIT_DATE \"${GIT_COMMIT_DATE}\"" >> $OUTPUT_FILE
else
- SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING}-SVN-build-UNKNOWN"
+ SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING}-GIT-UNKNOWN"
fi
LANG=${_SAVE_LANG}
fi
diff --git a/source4/scripting/bin/epdump.py b/source4/scripting/bin/epdump.py
new file mode 100644
index 0000000000..15dee33774
--- /dev/null
+++ b/source4/scripting/bin/epdump.py
@@ -0,0 +1,24 @@
+#!/usr/bin/python
+
+# Unix SMB/CIFS implementation.
+# Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2008
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+import sys
+
+if len(sys.argv) < 2:
+ print "Usage: %s <binding-string>" % sys.argv[0]
+ sys.exit(1)
diff --git a/source4/scripting/bin/winreg.py b/source4/scripting/bin/winreg.py
index 6cdc3a5898..f68f2d12f2 100644..100755
--- a/source4/scripting/bin/winreg.py
+++ b/source4/scripting/bin/winreg.py
@@ -7,87 +7,76 @@
#
import sys
+import winreg
+import optparse
+import samba.getopt as options
-options = GetOptions(ARGV,
- "POPT_AUTOHELP",
- "POPT_COMMON_SAMBA",
- "POPT_COMMON_CREDENTIALS",
- "createkey=s")
-if (options == undefined) {
- print "Failed to parse options"
- sys.exit(-1)
+parser = optparse.OptionParser("%s <BINDING> [path]" % sys.argv[0])
+parser.add_option_group(options.SambaOptions(parser))
+parser.add_option("--createkey", type="string", metavar="KEYNAME",
+ help="create a key")
-if len(sys.argv < 2:
- print "Usage: %s <BINDING> [path]" % sys.argv[0]
- sys.exit(-1)
+opts, args = parser.parse_args()
-binding = options.ARGV[0]
-reg = winregObj()
+if len(args) < 1:
+ parser.print_usage()
+ sys.exit(-1)
+
+binding = args[0]
print "Connecting to " + binding
-status = reg.connect(binding)
-if (status.is_ok != true) {
- print("Failed to connect to " + binding + " - " + status.errstr + "\n")
- return -1
-}
+conn = winreg.winreg(binding, opts.configfile)
-def list_values(path):
- list = reg.enum_values(path)
- if (list == undefined) {
- return
- }
- for (i=0;i<list.length;i++) {
- v = list[i]
- printf("\ttype=%-30s size=%4d '%s'\n", reg.typestring(v.type), v.size, v.name)
- if (v.type == reg.REG_SZ || v.type == reg.REG_EXPAND_SZ) {
- printf("\t\t'%s'\n", v.value)
- }
- if (v.type == reg.REG_MULTI_SZ) {
- for (j in v.value) {
- printf("\t\t'%s'\n", v.value[j])
- }
- }
- if (v.type == reg.REG_DWORD || v.type == reg.REG_DWORD_BIG_ENDIAN) {
- printf("\t\t0x%08x (%d)\n", v.value, v.value)
- }
- if (v.type == reg.REG_QWORD) {
- printf("\t\t0x%llx (%lld)\n", v.value, v.value)
- }
- }
+def list_values(key):
+ (num_values, max_valnamelen, max_valbufsize) = conn.QueryInfoKey(key, winreg.String())[4:8]
+ for i in range(num_values):
+ name = winreg.StringBuf()
+ name.size = max_valnamelen
+ (name, type, data, _, data_len) = conn.EnumValue(key, i, name, 0, "", max_valbufsize, 0)
+ print "\ttype=%-30s size=%4d '%s'" % type, len, name
+ if type in (winreg.REG_SZ, winreg.REG_EXPAND_SZ):
+ print "\t\t'%s'" % data
+# if (v.type == reg.REG_MULTI_SZ) {
+# for (j in v.value) {
+# printf("\t\t'%s'\n", v.value[j])
+# }
+# }
+# if (v.type == reg.REG_DWORD || v.type == reg.REG_DWORD_BIG_ENDIAN) {
+# printf("\t\t0x%08x (%d)\n", v.value, v.value)
+# }
+# if (v.type == reg.REG_QWORD) {
+# printf("\t\t0x%llx (%lld)\n", v.value, v.value)
+# }
-def list_path(path):
- count = 0
- list = reg.enum_path(path)
- if (list == undefined) {
- println("Unable to list " + path)
- return 0
- }
- list_values(path)
- count = count + list.length
- for (i=0;i<list.length;i++) {
- if (path) {
- npath = path + "\\" + list[i]
- } else {
- npath = list[i]
- }
- println(npath)
- count = count + list_path(npath)
- }
- return count
+def list_path(key, path):
+ count = 0
+ (num_subkeys, max_subkeylen, max_subkeysize) = conn.QueryInfoKey(key, winreg.String())[1:4]
+ for i in range(num_subkeys):
+ name = winreg.StringBuf()
+ name.size = max_subkeysize
+ keyclass = winreg.StringBuf()
+ keyclass.size = max_subkeysize
+ (name, _, _) = conn.EnumKey(key, i, name, keyclass=keyclass, last_changed_time=None)[0]
+ subkey = conn.OpenKey(key, name, 0, winreg.KEY_QUERY_VALUE | winreg.KEY_ENUMERATE_SUB_KEYS)
+ count += list_path(subkey, "%s\\%s" % (path, name))
+ list_values(subkey)
+ return count
-if len(sys.argv) > 2:
- root = sys.argv[2]
+if len(args) > 1:
+ root = args[1]
else:
- root = ''
+ root = "HKLM"
-if options.createkey:
- try:
- reg.create_key("HKLM\\SOFTWARE", options.createkey)
- except:
- print "Failed to create key"
+if opts.createkey:
+ reg.create_key("HKLM\\SOFTWARE", opt.createkey)
else:
- printf("Listing registry tree '%s'\n", root)
- count = list_path(root)
+ print "Listing registry tree '%s'" % root
+ try:
+ root_key = getattr(conn, "Open%s" % root)(None, winreg.KEY_QUERY_VALUE | winreg.KEY_ENUMERATE_SUB_KEYS)
+ except AttributeError:
+ print "Unknown root key name %s" % root
+ sys.exit(1)
+ count = list_path(root_key, root)
if count == 0:
- println("No entries found")
- sys.exit(1)
+ print "No entries found"
+ sys.exit(1)
diff --git a/source4/scripting/ejs/config.mk b/source4/scripting/ejs/config.mk
index 8b680ba973..656ecdae16 100644
--- a/source4/scripting/ejs/config.mk
+++ b/source4/scripting/ejs/config.mk
@@ -1,10 +1,6 @@
-#######################
-# Start LIBRARY EJSRPC
[SUBSYSTEM::EJSRPC]
OBJ_FILES = \
ejsrpc.o
-# End SUBSYSTEM EJSRPC
-#######################
[MODULE::smbcalls_config]
OBJ_FILES = smbcalls_config.o
@@ -79,11 +75,7 @@ INIT_FUNCTION = smb_setup_ejs_system
include ejsnet/config.mk
-#######################
-# Start LIBRARY smbcalls
-[LIBRARY::smbcalls]
-SO_VERSION = 0
-VERSION = 0.0.1
+[SUBSYSTEM::smbcalls]
PRIVATE_PROTO_HEADER = proto.h
OBJ_FILES = \
smbcalls.o \
@@ -101,8 +93,6 @@ PRIVATE_DEPENDENCIES = \
CREDENTIALS POPT_CREDENTIALS POPT_SAMBA \
dcerpc \
NDR_TABLE
-# End SUBSYSTEM smbcalls
-#######################
#######################
# Start BINARY SMBSCRIPT
diff --git a/source4/scripting/ejs/ejsnet/net_user.c b/source4/scripting/ejs/ejsnet/net_user.c
index 34524cc0fa..57e538d3b4 100644
--- a/source4/scripting/ejs/ejsnet/net_user.c
+++ b/source4/scripting/ejs/ejsnet/net_user.c
@@ -195,9 +195,9 @@ static int ejs_net_deleteuser(MprVarHandle eid, int argc, char **argv)
ejsSetErrorMsg(eid, "ctx property returns null pointer");
goto done;
}
-
+
/* domain where the account is to be deleted */
- userman_domain = (struct libnet_context *)mprGetThisPtr(eid, "domain");
+ userman_domain = mprGetThisPtr(eid, "domain");
if (!userman_domain) {
ejsSetErrorMsg(eid, "domain property returns null pointer");
goto done;
@@ -258,9 +258,9 @@ static int ejs_net_userinfo(MprVarHandle eid, int argc, char **argv)
ejsSetErrorMsg(eid, "ctx property returns null pointer");
goto done;
}
-
+
/* domain where the user account is to be queried */
- userman_domain = (struct libnet_context *)mprGetThisPtr(eid, "domain");
+ userman_domain = mprGetThisPtr(eid, "domain");
if (userman_domain == NULL) {
ejsSetErrorMsg(eid, "domain property returns null pointer");
return -1;
diff --git a/source4/scripting/libjs/provision.js b/source4/scripting/libjs/provision.js
index 0da02ae276..0cca49dec9 100644
--- a/source4/scripting/libjs/provision.js
+++ b/source4/scripting/libjs/provision.js
@@ -170,7 +170,7 @@ function ldb_erase(info, ldb)
/* and the rest */
attrs = new Array("dn");
var basedn = "";
- var res = ldb.search("(&(|(objectclass=*)(dn=*))(!(dn=@BASEINFO)))", basedn, ldb.SCOPE_SUBTREE, attrs);
+ var res = ldb.search("(&(|(objectclass=*)(distinguishedName=*))(!(distinguishedName=@BASEINFO)))", basedn, ldb.SCOPE_SUBTREE, attrs);
var i;
if (res.error != 0) {
ldb_delete(info, ldb);
@@ -180,7 +180,7 @@ function ldb_erase(info, ldb)
ldb.del(res.msgs[i].dn);
}
- var res = ldb.search("(&(|(objectclass=*)(dn=*))(!(dn=@BASEINFO)))", basedn, ldb.SCOPE_SUBTREE, attrs);
+ var res = ldb.search("(&(|(objectclass=*)(distinguishedName=*))(!(distinguishedName=@BASEINFO)))", basedn, ldb.SCOPE_SUBTREE, attrs);
if (res.error != 0 || res.msgs.length != 0) {
ldb_delete(info, ldb);
return;
@@ -207,8 +207,8 @@ function ldb_erase_partitions(info, ldb, ldapbackend)
return;
}
for (j=0; j<res.msgs[0].namingContexts.length; j++) {
- var anything = "(|(objectclass=*)(dn=*))";
- var attrs = new Array("dn");
+ var anything = "(|(objectclass=*)(distinguishedName=*))";
+ var attrs = new Array("distinguishedName");
var basedn = res.msgs[0].namingContexts[j];
var k;
var previous_remaining = 1;
@@ -398,9 +398,6 @@ function provision_default_paths(subobj)
paths.named_conf = lp.get("private dir") + "/named.conf";
paths.winsdb = "wins.ldb";
paths.ldapdir = lp.get("private dir") + "/ldap";
- paths.ldap_basedn_ldif = paths.ldapdir + "/" + dnsdomain + ".ldif";
- paths.ldap_config_basedn_ldif = paths.ldapdir + "/" + dnsdomain + "-config.ldif";
- paths.ldap_schema_basedn_ldif = paths.ldapdir + "/" + dnsdomain + "-schema.ldif";
paths.s4_ldapi_socket = lp.get("private dir") + "/ldapi";
paths.phpldapadminconfig = lp.get("private dir") + "/phpldapadmin-config.php";
@@ -866,6 +863,12 @@ function provision_schema(subobj, message, tmp_schema_path, paths)
/* This will erase anything in the tmp db */
var samdb = open_ldb(info, tmp_schema_path, true);
+ message("Setting up sam.ldb attributes\n");
+ setup_add_ldif("provision_init.ldif", info, samdb, false);
+
+ message("Setting up sam.ldb rootDSE\n");
+ setup_add_ldif("provision_rootdse_add.ldif", info, samdb, false);
+
message("Adding schema container (permitted to fail)\n");
var add_ok = setup_add_ldif("provision_schema_basedn.ldif", info, samdb, true);
message("Modifying schema container\n");
@@ -934,34 +937,6 @@ function provision_dns(subobj, message, paths, session_info, credentials)
message("Please install the zone located in " + paths.dns + " into your DNS server. A sample BIND configuration snippit is at " + paths.named_conf + "\n");
}
-/* Write out a DNS zone file, from the info in the current database */
-function provision_ldapbase(subobj, message, paths)
-{
- var ok = provision_fix_subobj(subobj, paths);
- assert(ok);
-
- message("Setting up LDAP base entry: " + subobj.DOMAINDN + " \n");
- var rdns = split(",", subobj.DOMAINDN);
- subobj.EXTENSIBLEOBJECT = "objectClass: extensibleObject";
-
- subobj.RDN_DC = substr(rdns[0], strlen("DC="));
-
- sys.mkdir(paths.ldapdir, 0700);
-
- setup_file("provision_basedn.ldif",
- message, paths.ldap_basedn_ldif,
- subobj);
-
- setup_file("provision_configuration_basedn.ldif",
- message, paths.ldap_config_basedn_ldif,
- subobj);
-
- setup_file("provision_schema_basedn.ldif",
- message, paths.ldap_schema_basedn_ldif,
- subobj);
-
-}
-
/*
guess reasonably default options for provisioning
@@ -1038,14 +1013,13 @@ function provision_guess()
subobj.DOMAINDN_LDB = "users.ldb";
subobj.CONFIGDN_LDB = "configuration.ldb";
subobj.SCHEMADN_LDB = "schema.ldb";
- subobj.DOMAINDN_MOD = "pdc_fsmo,password_hash";
- subobj.CONFIGDN_MOD = "naming_fsmo";
- subobj.SCHEMADN_MOD = "schema_fsmo";
+ subobj.DOMAINDN_MOD = "pdc_fsmo,password_hash,instancetype";
+ subobj.CONFIGDN_MOD = "naming_fsmo,instancetype";
+ subobj.SCHEMADN_MOD = "schema_fsmo,instancetype";
subobj.DOMAINDN_MOD2 = ",objectguid";
subobj.CONFIGDN_MOD2 = ",objectguid";
subobj.SCHEMADN_MOD2 = ",objectguid";
- subobj.EXTENSIBLEOBJECT = "# no objectClass: extensibleObject for local ldb";
subobj.ACI = "# no aci for local ldb";
return subobj;
diff --git a/source4/scripting/python/STATUS b/source4/scripting/python/STATUS
index c82275fff8..6e6475bfde 100644
--- a/source4/scripting/python/STATUS
+++ b/source4/scripting/python/STATUS
@@ -1,23 +1,15 @@
-dsdb/samdb/ldb_modules/tests/samba3sam.py
-lib/ldb/tests/python/ldap.py
-provisioning in LDAP mode
-SWAT
+dsdb/samdb/ldb_modules/tests/samba3sam.py: Fix remaining failing tests
+lib/ldb/tests/python/ldap.py: Fix remaining 3 FIXME's
+provisioning in LDAP mode(TEST_LDAP=yes PROVISION_PYTHON=yes make test)
command-line vampire
provisioning: combine some of the python dictionaries
-hierarchy
-DCE/RPC bindings
- - pidl:
- Parse::Pidl::Samba::Python
- - wrap struct/bitmap/enum/union types
- - __ndr_pack__/__ndr_unpack__ members
- Parse::Pidl::Samba::NDR::Python
- - pidl generated client fns
- - one class per interface
- - AddOne()
-
- - scripting/bin/smbstatus.py
- - scripting/bin/winreg.py
+finish scripting/bin/smbstatus.py
not important before making Python the default:
+- hierarchy (rename samr -> dcerpc.samr, misc -> samba.misc, etc)
- scripting/python/samba/upgrade.py
- install python modules into system
+- SWAT
+- __ndr_pack__/__ndr_unpack__ members for the NDR struct bindings
+- generate docstrings in DCE/RPC bindings
+- eliminate some variables from the python interface because they can be induced
diff --git a/source4/scripting/python/config.m4 b/source4/scripting/python/config.m4
index 348f9197f7..908efd1588 100644
--- a/source4/scripting/python/config.m4
+++ b/source4/scripting/python/config.m4
@@ -13,6 +13,32 @@ if test -z "$PYTHON"; then
AC_MSG_WARN([No python found])
fi
+AC_DEFUN([TRY_LINK_PYTHON],
+[
+ if test $working_python = no; then
+ ac_save_LIBS="$LIBS"
+ ac_save_CFLAGS="$CFLAGS"
+ LIBS="$LIBS $1"
+ CFLAGS="$CFLAGS $2"
+
+ AC_TRY_LINK([
+ #include <Python.h>
+ #include <stdlib.h>
+ ],[
+ Py_InitModule(NULL, NULL);
+ ],[
+ PYTHON_LDFLAGS="$1"
+ PYTHON_CFLAGS="$2"
+ working_python=yes
+ ])
+ LIBS="$ac_save_LIBS"
+ CFLAGS="$ac_save_CFLAGS"
+ fi
+])
+
+dnl assume no working python
+working_python=no
+
if test -z "$PYTHON_VERSION"; then
AC_PATH_PROGS([PYTHON_CONFIG], [python2.6-config python2.5-config python2.4-config python-config])
else
@@ -20,50 +46,28 @@ else
fi
if test -z "$PYTHON_CONFIG"; then
- working_python=no
AC_MSG_WARN([No python-config found])
else
- working_python=yes
- PYTHON_LDFLAGS=`$PYTHON_CONFIG --ldflags`
- PYTHON_CFLAGS=`$PYTHON_CONFIG --cflags`
+ TRY_LINK_PYTHON([`$PYTHON_CONFIG --ldflags`], [`$PYTHON_CONFIG --includes`])
+ TRY_LINK_PYTHON([`$PYTHON_CONFIG --ldflags`], [`$PYTHON_CONFIG --cflags`])
fi
-if test $working_python = no && test x$PYTHON != x
+if test x$PYTHON != x
then
- PYTHON_CFLAGS=`$PYTHON -c "from distutils import sysconfig; print '-I%s -I%s %s' % (sysconfig.get_python_inc(), sysconfig.get_python_inc(plat_specific=True), sysconfig.get_config_var('CFLAGS'))"`
- PYTHON_LDFLAGS=`$PYTHON -c "from distutils import sysconfig; print '%s %s -lpython%s -L%s' % (sysconfig.get_config_var('LIBS'), sysconfig.get_config_var('SYSLIBS'), sysconfig.get_config_var('VERSION'), sysconfig.get_config_var('LIBPL'))"`
- working_python=yes
+ DISTUTILS_CFLAGS=`$PYTHON -c "from distutils import sysconfig; print '-I%s -I%s %s' % (sysconfig.get_python_inc(), sysconfig.get_python_inc(plat_specific=True), sysconfig.get_config_var('CFLAGS'))"`
+ DISTUTILS_LDFLAGS=`$PYTHON -c "from distutils import sysconfig; print '%s %s -lpython%s -L%s' % (sysconfig.get_config_var('LIBS'), sysconfig.get_config_var('SYSLIBS'), sysconfig.get_config_var('VERSION'), sysconfig.get_config_var('LIBPL'))"`
+ TRY_LINK_PYTHON($DISTUTILS_LDFLAGS, $DISTUTILS_CFLAGS)
fi
SMB_EXT_LIB(EXT_LIB_PYTHON, [$PYTHON_LDFLAGS], [$PYTHON_CFLAGS])
AC_MSG_CHECKING(working python module support)
-if test x$working_python = xyes
-then
- ac_save_LIBS="$LIBS"
- ac_save_CFLAGS="$CFLAGS"
- LIBS="$LIBS $PYTHON_LDFLAGS"
- CFLAGS="$CFLAGS $PYTHON_CFLAGS"
-
- AC_TRY_LINK([
- #include <Python.h>
- #include <stdlib.h>
- ],[
- Py_InitModule(NULL, NULL);
- ],[
- SMB_ENABLE(EXT_LIB_PYTHON,YES)
- SMB_ENABLE(smbpython,YES)
- SMB_ENABLE(LIBPYTHON,YES)
- AC_MSG_RESULT([yes])
- ],[
- SMB_ENABLE(EXT_LIB_PYTHON,NO)
- SMB_ENABLE(LIBPYTHON,NO)
- SMB_ENABLE(smbpython,NO)
- AC_MSG_RESULT([no])
- ])
-
- LIBS="$ac_save_LIBS"
- CFLAGS="$ac_save_CFLAGS"
+if test $working_python = yes; then
+ SMB_ENABLE(EXT_LIB_PYTHON,YES)
+ SMB_ENABLE(smbpython,YES)
+ SMB_ENABLE(LIBPYTHON,YES)
+ AC_MSG_RESULT([yes])
else
AC_MSG_ERROR([Python not found. Please install Python 2.x and its development headers/libraries.])
fi
+
diff --git a/source4/scripting/python/config.mk b/source4/scripting/python/config.mk
index cfd179aff5..450da0e90a 100644
--- a/source4/scripting/python/config.mk
+++ b/source4/scripting/python/config.mk
@@ -5,7 +5,7 @@ OBJ_FILES = smbpython.o
[SUBSYSTEM::LIBPYTHON]
PUBLIC_DEPENDENCIES = EXT_LIB_PYTHON
INIT_FUNCTION_SENTINEL = { NULL, NULL }
-OBJ_FILES = modules.o
+OBJ_FILES = modules.o pytalloc.o
[PYTHON::python_uuid]
PRIVATE_DEPENDENCIES = LIBNDR
@@ -16,7 +16,7 @@ PRIVATE_DEPENDENCIES = LIBNDR LIBLDB SAMDB CREDENTIALS
SWIG_FILE = misc.i
# Swig extensions
-swig: pythonmods
+swig:: pythonmods
.SUFFIXES: _wrap.c .i
@@ -28,13 +28,19 @@ realdistclean::
@-rm -f bin/python/*
# FIXME: Remove _wrap.c files
-pythonmods: $(PYTHON_DSOS)
+pythonmods:: $(PYTHON_DSOS) $(PYTHON_PYS)
PYDOCTOR_MODULES=bin/python/ldb.py bin/python/auth.py bin/python/credentials.py bin/python/registry.py bin/python/tdb.py bin/python/security.py bin/python/events.py bin/python/net.py
pydoctor:: pythonmods
LD_LIBRARY_PATH=bin/shared PYTHONPATH=bin/python pydoctor --make-html --docformat=restructuredtext --add-package scripting/python/samba/ $(addprefix --add-module , $(PYDOCTOR_MODULES))
+installpython:: pythonmods
+ @$(SHELL) $(srcdir)/script/installpython.sh \
+ $(INSTALLPERMS) \
+ $(DESTDIR)$(PYTHONDIR) \
+ scripting/python bin/python
+
clean::
@echo "Removing python modules"
@rm -f bin/python/*
diff --git a/source4/scripting/python/modules.c b/source4/scripting/python/modules.c
index 55df51d881..fff981e941 100644
--- a/source4/scripting/python/modules.c
+++ b/source4/scripting/python/modules.c
@@ -35,6 +35,19 @@ extern void init_events(void);
extern void inituuid(void);
extern void init_net(void);
extern void initecho(void);
+extern void initwinreg(void);
+extern void initepmapper(void);
+extern void initinitshutdown(void);
+static void initdcerpc_misc(void) {}
+extern void initmgmt(void);
+extern void initatsvc(void);
+extern void initsamr(void);
+static void initdcerpc_security(void) {}
+extern void initlsa(void);
+extern void initsvcctl(void);
+extern void initwkssvc(void);
+extern void init_libcli_nbt(void);
+extern void init_libcli_smb(void);
static struct _inittab py_modules[] = { STATIC_LIBPYTHON_MODULES };
diff --git a/source4/scripting/python/pyrpc.h b/source4/scripting/python/pyrpc.h
new file mode 100644
index 0000000000..5390c6923d
--- /dev/null
+++ b/source4/scripting/python/pyrpc.h
@@ -0,0 +1,29 @@
+/*
+ Unix SMB/CIFS implementation.
+ Samba utility functions
+ Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2008
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#define PY_CHECK_TYPE(type, var, fail) \
+ if (!type ## _Check(var)) {\
+ PyErr_Format(PyExc_TypeError, "Expected type %s", type ## _Type.tp_name); \
+ fail; \
+ }
+
+#define dom_sid2_Type dom_sid_Type
+#define dom_sid28_Type dom_sid_Type
+#define dom_sid2_Check dom_sid_Check
+#define dom_sid28_Check dom_sid28_Check
diff --git a/source4/scripting/python/pytalloc.c b/source4/scripting/python/pytalloc.c
new file mode 100644
index 0000000000..d8d3efe69c
--- /dev/null
+++ b/source4/scripting/python/pytalloc.c
@@ -0,0 +1,45 @@
+/*
+ Unix SMB/CIFS implementation.
+ Python/Talloc glue
+ Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2008
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "scripting/python/pytalloc.h"
+
+void py_talloc_dealloc(PyObject* self)
+{
+ py_talloc_Object *obj = (py_talloc_Object *)self;
+ talloc_free(obj->talloc_ctx);
+ PyObject_Del(self);
+}
+
+PyObject *py_talloc_import_ex(PyTypeObject *py_type, TALLOC_CTX *mem_ctx,
+ void *ptr)
+{
+ py_talloc_Object *ret = PyObject_New(py_talloc_Object, py_type);
+ ret->talloc_ctx = talloc_reference(NULL, mem_ctx);
+ ret->ptr = ptr;
+ return (PyObject *)ret;
+}
+
+PyObject *py_talloc_default_repr(PyObject *py_obj)
+{
+ py_talloc_Object *obj = (py_talloc_Object *)py_obj;
+
+ return PyString_FromFormat("<talloc: %s>",
+ talloc_get_name(obj->talloc_ctx));
+}
diff --git a/source4/scripting/python/pytalloc.h b/source4/scripting/python/pytalloc.h
new file mode 100644
index 0000000000..aad5840a67
--- /dev/null
+++ b/source4/scripting/python/pytalloc.h
@@ -0,0 +1,51 @@
+/*
+ Unix SMB/CIFS implementation.
+ Samba utility functions
+ Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2008
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _PY_TALLOC_H_
+#define _PY_TALLOC_H_
+
+#include <Python.h>
+
+typedef struct {
+ PyObject_HEAD
+ TALLOC_CTX *talloc_ctx;
+ void *ptr;
+} py_talloc_Object;
+
+/* Deallocate a py_talloc_Object */
+void py_talloc_dealloc(PyObject* self);
+
+/* Retrieve the pointer for a py_talloc_object. Like talloc_get_type()
+ * but for py_talloc_Objects. */
+
+/* FIXME: Call PyErr_SetString(PyExc_TypeError, "expected " __STR(type) ")
+ * when talloc_get_type() returns NULL. */
+#define py_talloc_get_type(py_obj, type) \
+ talloc_get_type(py_talloc_get_ptr(py_obj), type)
+
+#define py_talloc_get_ptr(py_obj) ((py_talloc_Object *)py_obj)->ptr
+#define py_talloc_get_mem_ctx(py_obj) ((py_talloc_Object *)py_obj)->talloc_ctx
+
+PyObject *py_talloc_import_ex(PyTypeObject *py_type, TALLOC_CTX *mem_ctx, void *ptr);
+#define py_talloc_import(py_type, talloc_ptr) py_talloc_import_ex(py_type, talloc_ptr, talloc_ptr)
+
+/* Sane default implementation of reprfunc. */
+PyObject *py_talloc_default_repr(PyObject *py_obj);
+
+#endif /* _PY_TALLOC_H_ */
diff --git a/source4/scripting/python/samba/__init__.py b/source4/scripting/python/samba/__init__.py
index e0b9e1d410..483929661d 100644
--- a/source4/scripting/python/samba/__init__.py
+++ b/source4/scripting/python/samba/__init__.py
@@ -112,28 +112,28 @@ class Ldb(ldb.Ldb):
for attr in ["@INDEXLIST", "@ATTRIBUTES", "@SUBCLASSES", "@MODULES",
"@OPTIONS", "@PARTITION", "@KLUDGEACL"]:
try:
- self.delete(ldb.Dn(self, attr))
+ self.delete(attr)
except ldb.LdbError, (LDB_ERR_NO_SUCH_OBJECT, _):
# Ignore missing dn errors
pass
- basedn = ldb.Dn(self, "")
+ basedn = ""
# and the rest
for msg in self.search(basedn, ldb.SCOPE_SUBTREE,
- "(&(|(objectclass=*)(dn=*))(!(dn=@BASEINFO)))",
- ["dn"]):
+ "(&(|(objectclass=*)(distinguishedName=*))(!(distinguishedName=@BASEINFO)))",
+ ["distinguishedName"]):
try:
self.delete(msg.dn)
except ldb.LdbError, (LDB_ERR_NO_SUCH_OBJECT, _):
# Ignor eno such object errors
pass
- res = self.search(basedn, ldb.SCOPE_SUBTREE, "(&(|(objectclass=*)(dn=*))(!(dn=@BASEINFO)))", ["dn"])
+ res = self.search(basedn, ldb.SCOPE_SUBTREE, "(&(|(objectclass=*)(distinguishedName=*))(!(distinguishedName=@BASEINFO)))", ["distinguishedName"])
assert len(res) == 0
def erase_partitions(self):
"""Erase an ldb, removing all records."""
- res = self.search(ldb.Dn(self, ""), ldb.SCOPE_BASE, "(objectClass=*)",
+ res = self.search("", ldb.SCOPE_BASE, "(objectClass=*)",
["namingContexts"])
assert len(res) == 1
if not "namingContexts" in res[0]:
@@ -145,7 +145,7 @@ class Ldb(ldb.Ldb):
k = 0
while ++k < 10 and (previous_remaining != current_remaining):
# and the rest
- res2 = self.search(ldb.Dn(self, basedn), ldb.SCOPE_SUBTREE, "(|(objectclass=*)(dn=*))", ["dn"])
+ res2 = self.search(basedn, ldb.SCOPE_SUBTREE, "(|(objectclass=*)(distinguishedName=*))", ["distinguishedName"])
previous_remaining = current_remaining
current_remaining = len(res2)
for msg in res2:
diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py
index db3749f721..d59cea121e 100644
--- a/source4/scripting/python/samba/provision.py
+++ b/source4/scripting/python/samba/provision.py
@@ -20,7 +20,7 @@ import samba
from samba import Ldb, substitute_var, valid_netbios_name
from samba.samdb import SamDB
import security
-from ldb import Dn, SCOPE_SUBTREE, SCOPE_ONELEVEL, SCOPE_BASE, LdbError, \
+from ldb import SCOPE_SUBTREE, SCOPE_ONELEVEL, SCOPE_BASE, LdbError, \
LDB_ERR_NO_SUCH_OBJECT, timestring, CHANGETYPE_MODIFY, CHANGETYPE_NONE
"""Functions for setting up a Samba configuration."""
@@ -64,7 +64,7 @@ def install_ok(lp, session_info, credentials):
return False
ldb = Ldb(lp.get("sam database"), session_info=session_info,
credentials=credentials, lp=lp)
- if len(ldb.search(ldb.Dn("(cn=Administrator)"))) != 1:
+ if len(ldb.search("(cn=Administrator)")) != 1:
return False
return True
@@ -180,12 +180,6 @@ def provision_paths_from_lp(lp, dnsdomain):
paths.dns_keytab = os.path.join(private_dir, "dns.keytab")
paths.dns = os.path.join(private_dir, dnsdomain + ".zone")
paths.winsdb = os.path.join(private_dir, "wins.ldb")
- paths.ldap_basedn_ldif = os.path.join(private_dir,
- dnsdomain + ".ldif")
- paths.ldap_config_basedn_ldif = os.path.join(private_dir,
- dnsdomain + "-config.ldif")
- paths.ldap_schema_basedn_ldif = os.path.join(private_dir,
- dnsdomain + "-schema.ldif")
paths.s4_ldapi_path = os.path.join(private_dir, "ldapi")
paths.phpldapadminconfig = os.path.join(private_dir,
"phpldapadmin-config.php")
@@ -465,7 +459,6 @@ def setup_samdb(path, setup_path, session_info, credentials, lp,
setup_add_ldif(samdb, setup_path("provision_basedn.ldif"), {
"DOMAINDN": domaindn,
"ACI": aci,
- "EXTENSIBLEOBJECT": "# no objectClass: extensibleObject for local ldb",
"RDN_DC": rdn_dc,
})
@@ -766,9 +759,9 @@ def provision(lp, setup_dir, message, blank, paths, session_info,
samdb = SamDB(paths.samdb, session_info=session_info,
credentials=credentials, lp=lp)
- domainguid = samdb.searchone(Dn(samdb, domaindn), "objectGUID")
+ domainguid = samdb.searchone(domaindn, "objectGUID")
assert isinstance(domainguid, str)
- hostguid = samdb.searchone(Dn(samdb, domaindn), "objectGUID",
+ hostguid = samdb.searchone(domaindn, "objectGUID",
expression="(&(objectClass=computer)(cn=%s))" % hostname,
scope=SCOPE_SUBTREE)
assert isinstance(hostguid, str)
@@ -823,31 +816,6 @@ def create_zone_file(path, setup_path, samdb, dnsdomain, domaindn,
})
-def provision_ldapbase(setup_dir, message, paths):
- """Write out a DNS zone file, from the info in the current database."""
- message("Setting up LDAP base entry: %s" % domaindn)
- rdns = domaindn.split(",")
-
- rdn_dc = rdns[0][len("DC="):]
-
- def setup_path(file):
- return os.path.join(setup_dir, file)
-
- setup_file(setup_path("provision_basedn.ldif"),
- paths.ldap_basedn_ldif)
-
- setup_file(setup_path("provision_configuration_basedn.ldif"),
- paths.ldap_config_basedn_ldif)
-
- setup_file(setup_path("provision_schema_basedn.ldif"),
- paths.ldap_schema_basedn_ldif, {
- "SCHEMADN": schemadn,
- "ACI": "# no aci for local ldb",
- "EXTENSIBLEOBJECT": "objectClass: extensibleObject"})
-
- message("Please install the LDIF located in " + paths.ldap_basedn_ldif + ", " + paths.ldap_config_basedn_ldif + " and " + paths.ldap_schema_basedn_ldif + " into your LDAP server, and re-run with --ldap-backend=ldap://my.ldap.server")
-
-
def load_schema(setup_path, samdb, schemadn, netbiosname, configdn):
"""Load schema.
diff --git a/source4/scripting/python/samba/samdb.py b/source4/scripting/python/samba/samdb.py
index 2af56d8d8e..353eaee198 100644
--- a/source4/scripting/python/samba/samdb.py
+++ b/source4/scripting/python/samba/samdb.py
@@ -60,7 +60,7 @@ description: %s
:param sid: SID of the NT-side of the mapping.
:param unixname: Unix name to map to.
"""
- res = self.search(ldb.Dn(self, domaindn), ldb.SCOPE_SUBTREE,
+ res = self.search(domaindn, ldb.SCOPE_SUBTREE,
"objectSid=%s" % sid, ["dn"])
assert len(res) == 1, "Failed to find record for objectSid %s" % sid
@@ -103,7 +103,7 @@ userAccountControl: %u
res = self.search("", SCOPE_BASE, "defaultNamingContext=*",
["defaultNamingContext"])
assert(len(res) == 1 and res[0].defaultNamingContext is not None)
- domain_dn = res[0].defaultNamingContext
+ domain_dn = res[0]["defaultNamingContext"][0]
assert(domain_dn is not None)
dom_users = self.searchone(domain_dn, "dn", "name=Domain Users")
assert(dom_users is not None)
diff --git a/source4/scripting/python/samba/tests/dcerpc/__init__.py b/source4/scripting/python/samba/tests/dcerpc/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/source4/scripting/python/samba/tests/dcerpc/__init__.py
diff --git a/source4/scripting/python/samba/tests/dcerpc/registry.py b/source4/scripting/python/samba/tests/dcerpc/registry.py
new file mode 100644
index 0000000000..f3f0b0fb1a
--- /dev/null
+++ b/source4/scripting/python/samba/tests/dcerpc/registry.py
@@ -0,0 +1,50 @@
+#!/usr/bin/python
+
+# Unix SMB/CIFS implementation.
+# Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2008
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+import winreg
+from param import LoadParm
+import unittest
+
+class WinregTests(unittest.TestCase):
+ def setUp(self):
+ lp_ctx = LoadParm()
+ lp_ctx.load("st/client/client.conf")
+ self.conn = winreg.winreg("ncalrpc:", lp_ctx)
+
+ def get_hklm(self):
+ return self.conn.OpenHKLM(None,
+ winreg.KEY_QUERY_VALUE | winreg.KEY_ENUMERATE_SUB_KEYS)
+
+ def test_hklm(self):
+ handle = self.conn.OpenHKLM(None,
+ winreg.KEY_QUERY_VALUE | winreg.KEY_ENUMERATE_SUB_KEYS)
+ self.conn.CloseKey(handle)
+
+ def test_getversion(self):
+ handle = self.get_hklm()
+ version = self.conn.GetVersion(handle)
+ self.assertEquals(int, version.__class__)
+ self.conn.CloseKey(handle)
+
+ def test_getkeyinfo(self):
+ handle = self.conn.OpenHKLM(None,
+ winreg.KEY_QUERY_VALUE | winreg.KEY_ENUMERATE_SUB_KEYS)
+ x = self.conn.QueryInfoKey(handle, winreg.String())
+ self.assertEquals(9, len(x)) # should return a 9-tuple
+ self.conn.CloseKey(handle)
diff --git a/source4/scripting/python/samba/tests/dcerpc/rpcecho.py b/source4/scripting/python/samba/tests/dcerpc/rpcecho.py
new file mode 100644
index 0000000000..52c2bb8c72
--- /dev/null
+++ b/source4/scripting/python/samba/tests/dcerpc/rpcecho.py
@@ -0,0 +1,44 @@
+#!/usr/bin/python
+
+# Unix SMB/CIFS implementation.
+# Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2008
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+import echo
+from param import LoadParm
+import unittest
+
+class RpcEchoTests(unittest.TestCase):
+ def setUp(self):
+ lp_ctx = LoadParm()
+ lp_ctx.load("st/client/client.conf")
+ self.conn = echo.rpcecho("ncalrpc:", lp_ctx)
+
+ def test_addone(self):
+ self.assertEquals(2, self.conn.AddOne(1))
+
+ def test_echodata(self):
+ self.assertEquals([1,2,3], self.conn.EchoData(3, [1, 2, 3]))
+
+ def test_call(self):
+ self.assertEquals(u"foobar", self.conn.TestCall(u"foobar"))
+
+ def test_surrounding(self):
+ surrounding_struct = echo.Surrounding()
+ surrounding_struct.x = 4
+ surrounding_struct.surrounding = [1,2,3,4]
+ y = self.conn.TestSurrounding(surrounding_struct)
+ self.assertEquals(8 * [0], y.surrounding)
diff --git a/source4/scripting/python/samba/tests/dcerpc/sam.py b/source4/scripting/python/samba/tests/dcerpc/sam.py
new file mode 100644
index 0000000000..50caaf2348
--- /dev/null
+++ b/source4/scripting/python/samba/tests/dcerpc/sam.py
@@ -0,0 +1,28 @@
+#!/usr/bin/python
+
+# Unix SMB/CIFS implementation.
+# Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2008
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+import samr
+import unittest
+
+class SamrTests(unittest.TestCase):
+ def setUp(self):
+ self.conn = samr.samr("ncalrpc:", "st/client/client.conf")
+
+ def test_connect5(self):
+ (level, info, handle) = self.conn.Connect5(None, 0, 1, samr.ConnectInfo1())
diff --git a/source4/scripting/python/uuidmodule.c b/source4/scripting/python/uuidmodule.c
index 02c929d4a5..e05b286dd0 100644
--- a/source4/scripting/python/uuidmodule.c
+++ b/source4/scripting/python/uuidmodule.c
@@ -18,7 +18,7 @@
*/
#include "includes.h"
-#include "Python.h"
+#include <Python.h>
#include "librpc/ndr/libndr.h"
static PyObject *uuid_random(PyObject *self, PyObject *args)
@@ -47,11 +47,9 @@ static PyMethodDef methods[] = {
{ NULL, NULL }
};
-PyDoc_STRVAR(param_doc, "UUID helper routines");
-
-PyMODINIT_FUNC inituuid(void)
+void inituuid(void)
{
- PyObject *mod = Py_InitModule3((char *)"uuid", methods, param_doc);
+ PyObject *mod = Py_InitModule3((char *)"uuid", methods, "UUID helper routines");
if (mod == NULL)
return;
}
diff --git a/source4/selftest/README b/source4/selftest/README
index a0afda3d19..3250f32ec7 100644
--- a/source4/selftest/README
+++ b/source4/selftest/README
@@ -1,6 +1,23 @@
+# vim: ft=rst
+
This directory contains test scripts that are useful for running a
bunch of tests all at once.
+===============
+Available tests
+===============
+The available tests are obtained from a script, usually
+selftest/samba{3,4}_tests.sh. This script should for each test output
+the name of the test, the command to run and the environment that should be
+provided.
+
+============
+Environments
+============
+Tests often need to run against a server with particular things set up,
+a "environment". This environment is provided by the test "target": Samba 3,
+Samba 4 or Windows.
+
The following environments are currently available:
- none: No server set up, no variables set.
diff --git a/source4/selftest/samba4_tests.sh b/source4/selftest/samba4_tests.sh
index 290c06fa6a..2068a971ca 100755
--- a/source4/selftest/samba4_tests.sh
+++ b/source4/selftest/samba4_tests.sh
@@ -320,9 +320,12 @@ then
plantest "samba.python" none $SUBUNITRUN samba.tests
plantest "provision.python" none $SUBUNITRUN samba.tests.provision
plantest "samba3.python" none $SUBUNITRUN samba.tests.samba3
+ plantest "samr.python" dc $SUBUNITRUN samba.tests.dcerpc.sam
plantest "events.python" none PYTHONPATH="$PYTHONPATH:lib/events" $SUBUNITRUN tests
plantest "samba3sam.python" none PYTHONPATH="$PYTHONPATH:dsdb/samdb/ldb_modules/tests" $SUBUNITRUN samba3sam
- plantest "ldap.python" dc $PYTHON $samba4srcdir/lib/ldb/tests/python/ldap.py \$SERVER -U\$USERNAME%\$PASSWORD
+ plantest "rpcecho.python" dc $SUBUNITRUN samba.tests.dcerpc.rpcecho
+ plantest "winreg.python" dc $SUBUNITRUN samba.tests.dcerpc.registry
+ plantest "ldap.python" dc $PYTHON $samba4srcdir/lib/ldb/tests/python/ldap.py $CONFIGURATION \$SERVER -U\$USERNAME%\$PASSWORD -W \$DOMAIN
plantest "blackbox.samba3dump" none $PYTHON scripting/bin/samba3dump $samba4srcdir/../testdata/samba3
rm -rf $PREFIX/upgrade
plantest "blackbox.upgrade" none $PYTHON setup/upgrade.py $CONFIGURATION --targetdir=$PREFIX/upgrade ../testdata/samba3 ../testdata/samba3/smb.conf
diff --git a/source4/selftest/selftest.pl b/source4/selftest/selftest.pl
index 96409558b1..004332a1fc 100755
--- a/source4/selftest/selftest.pl
+++ b/source4/selftest/selftest.pl
@@ -67,7 +67,7 @@ these tests will be counted as successes, successes will be counted as failures.
The format for the file is, one entry per line:
-TESTSUITE-NAME/TEST-NAME
+TESTSUITE-NAME.TEST-NAME
The reason for a test can also be specified, by adding a hash sign (#) and the reason
after the test name.
@@ -130,9 +130,6 @@ use POSIX;
use Cwd qw(abs_path);
use lib "$RealBin";
use Subunit qw(parse_results);
-use env::Samba3;
-use env::Samba4;
-use env::Windows;
use SocketWrapper;
my $opt_help = 0;
@@ -429,17 +426,20 @@ my $testenv_default = "none";
if ($opt_target eq "samba4") {
$testenv_default = "member";
+ require target::Samba4;
$target = new Samba4($opt_bindir or "$srcdir/bin", $ldap, "$srcdir/setup");
} elsif ($opt_target eq "samba3") {
if ($opt_socket_wrapper and `$opt_bindir/smbd -b | grep SOCKET_WRAPPER` eq "") {
die("You must include --enable-socket-wrapper when compiling Samba in order to execute 'make test'. Exiting....");
}
$testenv_default = "dc";
+ require target::Samba3;
$target = new Samba3($opt_bindir);
} elsif ($opt_target eq "win") {
die("Windows tests will not run with socket wrapper enabled.")
if ($opt_socket_wrapper);
$testenv_default = "dc";
+ require target::Windows;
$target = new Windows();
}
@@ -741,7 +741,6 @@ sub teardown_env($)
delete $running_envs{$envname};
}
-
if ($opt_no_lazy_setup) {
setup_env($_) foreach (keys %required_envs);
}
diff --git a/source4/selftest/env/Samba3.pm b/source4/selftest/target/Samba3.pm
index b0c4eb22bd..b0c4eb22bd 100644
--- a/source4/selftest/env/Samba3.pm
+++ b/source4/selftest/target/Samba3.pm
diff --git a/source4/selftest/env/Samba4.pm b/source4/selftest/target/Samba4.pm
index aacf3c3802..fba0f6a6f8 100644
--- a/source4/selftest/env/Samba4.pm
+++ b/source4/selftest/target/Samba4.pm
@@ -244,6 +244,7 @@ sub mk_openldap($$$)
modulepath $olroot/libexec/openldap
moduleload syncprov
moduleload memberof
+moduleload refint
";
close(CONF);
}
@@ -255,6 +256,7 @@ modulepath $olroot/libexec/openldap
moduleload back_hdb
moduleload syncprov
moduleload memberof
+moduleload refint
";
close(CONF);
}
@@ -266,6 +268,7 @@ moduleload memberof
moduleload back_hdb
moduleload syncprov
moduleload memberof
+moduleload refint
";
close(CONF);
}
@@ -278,6 +281,7 @@ modulepath /usr/lib/ldap
moduleload back_hdb
moduleload syncprov
moduleload memberof
+moduleload refint
";
close(CONF);
}
@@ -289,6 +293,7 @@ moduleload memberof
modulepath /usr/lib/openldap
moduleload syncprov
moduleload memberof
+moduleload refint
";
close(CONF);
}
@@ -300,6 +305,7 @@ moduleload memberof
modulepath /usr/lib64/openldap
moduleload syncprov
moduleload memberof
+moduleload refint
";
close(CONF);
}
@@ -712,7 +718,7 @@ nogroup:x:65534:nobody
} elsif ($self->{ldap} eq "fedora-ds") {
($ret->{FEDORA_DS_DIR}, $ret->{FEDORA_DS_PIDFILE}) = $self->mk_fedora_ds($ldapdir, $configuration) or die("Unable to create fedora ds directories");
push (@provision_options, "--ldap-module=nsuniqueid");
- push (@provision_options, "--aci=aci:: KHRhcmdldGF0dHIgPSAiKiIpICh2ZXJzaW9uIDMuMDthY2wgImZ1bGwgYWNjZXNzIHRvIGFsbCBieSBhbGwiO2FsbG93IChhbGwpKHVzZXJkbiA9ICJsZGFwOi8vL2FueW9uZSIpOykK");
+ push (@provision_options, "'--aci=aci:: KHRhcmdldGF0dHIgPSAiKiIpICh2ZXJzaW9uIDMuMDthY2wgImZ1bGwgYWNjZXNzIHRvIGFsbCBieSBhbGwiO2FsbG93IChhbGwpKHVzZXJkbiA9ICJsZGFwOi8vL2FueW9uZSIpOykK'");
}
$self->slapd_start($ret) or
diff --git a/source4/selftest/env/Windows.pm b/source4/selftest/target/Windows.pm
index d0c90d7f7b..d0c90d7f7b 100644
--- a/source4/selftest/env/Windows.pm
+++ b/source4/selftest/target/Windows.pm
diff --git a/source4/setup/display_specifiers.ldif b/source4/setup/display_specifiers.ldif
index b76955a0cb..7d6633244d 100644
--- a/source4/setup/display_specifiers.ldif
+++ b/source4/setup/display_specifiers.ldif
@@ -1,22 +1,16 @@
dn: CN=DisplaySpecifiers,${CONFIGDN}
objectClass: top
objectClass: container
-showInAdvancedViewOnly: TRUE
-instanceType: 4
dn: CN=409,CN=DisplaySpecifiers,${CONFIGDN}
objectClass: top
objectClass: container
cn: 409
-name: 409
-instanceType: 4
-showInAdvancedViewOnly: TRUE
dn: CN=user-Display,CN=409,CN=DisplaySpecifiers,${CONFIGDN}
objectClass: top
objectClass: displaySpecifier
cn: user-Display
-name: user-Display
contextMenu: 0,{62AE1F9A-126A-11D0-A14B-0800361B1103}
adminPropertyPages: 9,{FA3E1D55-16DF-446d-872E-BD04D4F39C93}
adminPropertyPages: 8,{0910dd01-df8c-11d1-ae27-00c04fa35813}
@@ -35,7 +29,6 @@ dn: CN=group-Display,CN=409,CN=DisplaySpecifiers,${CONFIGDN}
objectClass: top
objectClass: displaySpecifier
cn: group-Display
-name: group-Display
contextMenu: 0,{62AE1F9A-126A-11D0-A14B-0800361B1103}
adminPropertyPages: 4,{4E40F770-369C-11d0-8922-00A024AB2DBB}
adminPropertyPages: 3,{6dfe6488-a212-11d0-bcd5-00c04fd8d5b6}
@@ -63,7 +56,6 @@ dn: CN=computer-Display,CN=409,CN=DisplaySpecifiers,${CONFIGDN}
objectClass: top
objectClass: displaySpecifier
cn: computer-Display
-name: computer-Display
contextMenu: 0,{62AE1F9A-126A-11D0-A14B-0800361B1103}
adminPropertyPages: 10,{0F65B1BF-740F-11d1-BBE6-0060081692B3}
adminPropertyPages: 7,{B52C1E50-1DD2-11D1-BC43-00C04FC31FD3}
@@ -81,7 +73,6 @@ dn: CN=organizationalUnit-Display,CN=409,CN=DisplaySpecifiers,${CONFIGDN}
objectClass: top
objectClass: displaySpecifier
cn: organizationalUnit-Display
-name: organizationalUnit-Display
contextMenu: 0,{62AE1F9A-126A-11D0-A14B-0800361B1103}
adminPropertyPages: 6,{FA3E1D55-16DF-446d-872E-BD04D4F39C93}
adminPropertyPages: 5,{4E40F770-369C-11d0-8922-00A024AB2DBB}
@@ -97,7 +88,6 @@ dn: CN=container-Display,CN=409,CN=DisplaySpecifiers,${CONFIGDN}
objectClass: top
objectClass: displaySpecifier
cn: container-Display
-name: container-Display
contextMenu: 0,{62AE1F9A-126A-11D0-A14B-0800361B1103}
adminPropertyPages: 3,{4E40F770-369C-11d0-8922-00A024AB2DBB}
adminPropertyPages: 2,{6dfe6488-a212-11d0-bcd5-00c04fd8d5b6}
@@ -112,7 +102,6 @@ dn: CN=default-Display,CN=409,CN=DisplaySpecifiers,${CONFIGDN}
objectClass: top
objectClass: displaySpecifier
cn: default-Display
-name: default-Display
adminPropertyPages: 3,{4E40F770-369C-11d0-8922-00A024AB2DBB}
adminPropertyPages: 2,{6dfe6488-a212-11d0-bcd5-00c04fd8d5b6}
adminPropertyPages: 1,{6384e23e-736d-11d1-bd0d-00c04fd8d5b6}
diff --git a/source4/setup/fedorads-partitions.ldif b/source4/setup/fedorads-partitions.ldif
index 12855f9c70..571fb599b9 100644
--- a/source4/setup/fedorads-partitions.ldif
+++ b/source4/setup/fedorads-partitions.ldif
@@ -7,6 +7,7 @@ nsslapd-backend: configData
cn: ${CONFIGDN}
dn: cn=configData,cn=ldbm database,cn=plugins,cn=config
+objectclass: top
objectclass: extensibleObject
objectclass: nsBackendInstance
nsslapd-suffix: ${CONFIGDN}
@@ -21,6 +22,7 @@ nsslapd-backend: schemaData
cn: ${SCHEMADN}
dn: cn=schemaData,cn=ldbm database,cn=plugins,cn=config
+objectclass: top
objectclass: extensibleObject
objectclass: nsBackendInstance
nsslapd-suffix: ${SCHEMADN}
diff --git a/source4/setup/provision b/source4/setup/provision
index 161698ccf4..8b24c51040 100755
--- a/source4/setup/provision
+++ b/source4/setup/provision
@@ -123,7 +123,6 @@ for (r in options) {
}
var blank = (options["blank"] != undefined);
-var ldapbase = (options["ldap-base"] != undefined);
var ldapbackend = (options["ldap-backend"] != undefined);
var ldapmodule = (options["ldap-module"] != undefined);
var partitions_only = (options["partitions-only"] != undefined);
@@ -141,7 +140,7 @@ if (ldapbackend) {
subobj.LDAPBACKEND = subobj.LDAPI_URI;
}
if (!ldapmodule) {
- subobj.LDAPMODULE = "entryuuid";
+ subobj.LDAPMODULE = "normalise,entryuuid";
subobj.TDB_MODULES_LIST = "";
}
subobj.DOMAINDN_LDB = subobj.LDAPBACKEND;
@@ -161,10 +160,7 @@ var system_session = system_session();
var creds = options.get_credentials();
message("Provisioning for %s in realm %s\n", subobj.DOMAIN, subobj.REALM);
message("Using administrator password: %s\n", subobj.ADMINPASS);
-if (ldapbase) {
- provision_ldapbase(subobj, message, paths);
- message("Please install the LDIF located in " + paths.ldap_basedn_ldif + ", " + paths.ldap_config_basedn_ldif + " and " + paths.ldap_schema_basedn_ldif + " into your LDAP server, and re-run with --ldap-backend=ldap://my.ldap.server\n");
-} else if (partitions_only) {
+if (partitions_only) {
provision_become_dc(subobj, message, false, paths, system_session);
} else {
provision(subobj, message, blank, paths, system_session, creds, ldapbackend);
@@ -188,7 +184,7 @@ if (ldapbase) {
message("--ldap-backend='%s' \\\n", subobj.LDAPBACKEND);
}
if (ldapmodule) {
- message("--ldap-mdoule='%s' \\\n", + subobj.LDAPMODULE);
+ message("--ldap-module='%s' \\\n", + subobj.LDAPMODULE);
}
message("--aci='" + subobj.ACI + "' \\\n")
}
diff --git a/source4/setup/provision-backend b/source4/setup/provision-backend
index 66555c4e19..abd1b9a875 100755
--- a/source4/setup/provision-backend
+++ b/source4/setup/provision-backend
@@ -101,7 +101,7 @@ var backend_schema;
var slapd_command;
if (options["ldap-backend-type"] == "fedora-ds") {
mapping = "schema-map-fedora-ds-1.0";
- backend_schema = "backend-schema.ldif";
+ backend_schema = "99_ad.ldif";
if (options["ldap-backend-port"] != undefined) {
message("Will listen on TCP port " + options["ldap-backend-port"] + "\n");
subobj.SERVERPORT="ServerPort = " + options["ldap-backend-port"];
@@ -114,9 +114,8 @@ if (options["ldap-backend-type"] == "fedora-ds") {
slapd_command = "(see documentation)";
} else if (options["ldap-backend-type"] == "openldap") {
- provision_ldapbase(subobj, message, paths);
mapping = "schema-map-openldap-2.3";
- backend_schema = "99_ad.ldif";
+ backend_schema = "backend-schema.schema";
setup_file("slapd.conf", message, subobj.LDAPDIR + "/slapd.conf", subobj);
setup_file("modules.conf", message, subobj.LDAPDIR + "/modules.conf", subobj);
sys.mkdir(subobj.LDAPDIR + "/db", 0700);
@@ -151,10 +150,12 @@ if (options["ldap-backend-type"] == "fedora-ds") {
var res = ldb.search("(&(&(linkID=*)(!(linkID:1.2.840.113556.1.4.803:=1)))(objectclass=attributeSchema))", subobj.SCHEMADN, ldb.SCOPE_SUBTREE, attrs);
assert(res.error == 0);
var memberof_config = "";
+ var refint_attributes = "";
for (i=0; i < res.msgs.length; i++) {
searchone(ldb, subobj.DOMAINDN, "(&(objectClass=computer)(cn=" + subobj.NETBIOSNAME + "))", "objectGUID");
var target = searchone(ldb, subobj.SCHEMADN, "(&(objectclass=attributeSchema)(linkID=" + (res.msgs[i].linkID + 1) + "))", "lDAPDisplayName");
if (target != undefined) {
+ refint_attributes = refint_attributes + " " + target + " " + res.msgs[i].lDAPDisplayName;
memberof_config = memberof_config + "overlay memberof
memberof-dangling error
memberof-refint TRUE
@@ -166,6 +167,12 @@ memberof-dangling-error 32
";
}
}
+
+ memberof_config = memberof_config + "
+overlay refint
+refint_attributes" + refint_attributes + "
+";
+
ok = sys.file_save(subobj.LDAPDIR + "/memberof.conf", memberof_config);
if (!ok) {
message("failed to create file: " + f + "\n");
diff --git a/source4/setup/provision.ldif b/source4/setup/provision.ldif
index c6b07c5751..3fb9361d0b 100644
--- a/source4/setup/provision.ldif
+++ b/source4/setup/provision.ldif
@@ -3,28 +3,24 @@ objectClass: top
objectClass: organizationalUnit
cn: Domain Controllers
description: Default container for domain controllers
-instanceType: 4
-showInAdvancedViewOnly: FALSE
systemFlags: 2348810240
isCriticalSystemObject: TRUE
+showInAdvancedViewOnly: FALSE
dn: CN=ForeignSecurityPrincipals,${DOMAINDN}
objectClass: top
objectClass: container
cn: ForeignSecurityPrincipals
description: Default container for security identifiers (SIDs) associated with objects from external, trusted domains
-instanceType: 4
-showInAdvancedViewOnly: FALSE
systemFlags: 2348810240
isCriticalSystemObject: TRUE
+showInAdvancedViewOnly: FALSE
dn: CN=System,${DOMAINDN}
objectClass: top
objectClass: container
cn: System
description: Builtin system settings
-instanceType: 4
-showInAdvancedViewOnly: TRUE
systemFlags: 2348810240
isCriticalSystemObject: TRUE
@@ -32,8 +28,6 @@ dn: CN=RID Manager$,CN=System,${DOMAINDN}
objectclass: top
objectclass: rIDManager
cn: RID Manager$
-instanceType: 4
-showInAdvancedViewOnly: TRUE
systemFlags: 2348810240
isCriticalSystemObject: TRUE
fSMORoleOwner: CN=NTDS Settings,CN=${NETBIOSNAME},CN=Servers,CN=${DEFAULTSITE},CN=Sites,${CONFIGDN}
@@ -43,23 +37,17 @@ dn: CN=DomainUpdates,CN=System,${DOMAINDN}
objectClass: top
objectClass: container
cn: DomainUpdates
-instanceType: 4
-showInAdvancedViewOnly: TRUE
dn: CN=Windows2003Update,CN=DomainUpdates,CN=System,${DOMAINDN}
objectClass: top
objectClass: container
cn: Windows2003Update
-instanceType: 4
-showInAdvancedViewOnly: TRUE
revision: 8
dn: CN=Infrastructure,${DOMAINDN}
objectclass: top
objectclass: infrastructureUpdate
cn: Infrastructure
-instanceType: 4
-showInAdvancedViewOnly: TRUE
systemFlags: 2348810240
isCriticalSystemObject: TRUE
fSMORoleOwner: CN=NTDS Settings,CN=${NETBIOSNAME},CN=Servers,CN=${DEFAULTSITE},CN=Sites,${CONFIGDN}
@@ -68,8 +56,6 @@ dn: CN=Builtin,${DOMAINDN}
objectClass: top
objectClass: builtinDomain
cn: Builtin
-instanceType: 4
-showInAdvancedViewOnly: FALSE
forceLogoff: 9223372036854775808
lockoutDuration: -18000000000
lockOutObservationWindow: -18000000000
@@ -86,6 +72,7 @@ serverState: 1
uASCompat: 1
modifiedCount: 1
isCriticalSystemObject: TRUE
+showInAdvancedViewOnly: FALSE
dn: CN=Policies,CN=System,${DOMAINDN}
objectClass: top
diff --git a/source4/setup/provision.py b/source4/setup/provision.py
index e166d5f3dd..88015ce0a3 100755
--- a/source4/setup/provision.py
+++ b/source4/setup/provision.py
@@ -34,7 +34,7 @@ from auth import system_session
import samba.getopt as options
import param
from samba.provision import (provision,
- provision_paths_from_lp, provision_ldapbase)
+ provision_paths_from_lp)
parser = optparse.OptionParser("provision [options]")
parser.add_option_group(options.SambaOptions(parser))
@@ -81,9 +81,6 @@ parser.add_option("--users", type="string", metavar="GROUPNAME",
parser.add_option("--quiet", help="Be quiet", action="store_true")
parser.add_option("--blank", action="store_true",
help="do not add users or groups, just the structure")
-parser.add_option("--ldap-base",
- help="output only an LDIF file, suitable for creating an LDAP baseDN",
- action="store_true")
parser.add_option("--ldap-backend", type="string", metavar="LDAPSERVER",
help="LDAP server to use for this provision")
parser.add_option("--ldap-module=", type="string", metavar="MODULE",
@@ -152,10 +149,7 @@ creds = credopts.get_credentials()
setup_dir = opts.setupdir
if setup_dir is None:
setup_dir = "setup"
-if opts.ldap_base:
- provision_ldapbase(setup_dir, message, paths)
- message("Please install the LDIF located in %s, %s and into your LDAP server, and re-run with --ldap-backend=ldap://my.ldap.server" % (paths.ldap_basedn_ldif, paths.ldap_config_basedn_ldif, paths.ldap_schema_basedn_ldif))
-elif opts.partitions_only:
+if opts.partitions_only:
provision_become_dc(setup_dir, message, False,
paths, lp, system_session(), creds)
else:
diff --git a/source4/setup/provision_basedn.ldif b/source4/setup/provision_basedn.ldif
index 234c1f9e8f..3c7537f013 100644
--- a/source4/setup/provision_basedn.ldif
+++ b/source4/setup/provision_basedn.ldif
@@ -5,7 +5,6 @@ dn: ${DOMAINDN}
objectClass: top
objectClass: domain
objectClass: domainDNS
-${EXTENSIBLEOBJECT}
${ACI}
dc: ${RDN_DC}
diff --git a/source4/setup/provision_computers_modify.ldif b/source4/setup/provision_computers_modify.ldif
index b7502e5107..3bb4074d42 100644
--- a/source4/setup/provision_computers_modify.ldif
+++ b/source4/setup/provision_computers_modify.ldif
@@ -3,9 +3,6 @@ changetype: modify
replace: description
description: Default container for upgraded computer accounts
-
-replace: instanceType
-instanceType: 4
--
replace: showInAdvancedViewOnly
showInAdvancedViewOnly: FALSE
-
diff --git a/source4/setup/provision_configuration.ldif b/source4/setup/provision_configuration.ldif
index 050f110d9a..0fe90b0739 100644
--- a/source4/setup/provision_configuration.ldif
+++ b/source4/setup/provision_configuration.ldif
@@ -5,8 +5,6 @@ dn: CN=Partitions,${CONFIGDN}
objectClass: top
objectClass: crossRefContainer
cn: Partitions
-instanceType: 4
-showInAdvancedViewOnly: TRUE
systemFlags: 2147483648
msDS-Behavior-Version: 0
fSMORoleOwner: CN=NTDS Settings,CN=${NETBIOSNAME},CN=Servers,CN=${DEFAULTSITE},CN=Sites,${CONFIGDN}
@@ -15,8 +13,6 @@ dn: CN=Enterprise Configuration,CN=Partitions,${CONFIGDN}
objectClass: top
objectClass: crossRef
cn: Enterprise Configuration
-instanceType: 4
-showInAdvancedViewOnly: TRUE
systemFlags: 1
nCName: ${CONFIGDN}
dnsRoot: ${DNSDOMAIN}
@@ -25,8 +21,6 @@ dn: CN=Enterprise Schema,CN=Partitions,${CONFIGDN}
objectClass: top
objectClass: crossRef
cn: Enterprise Schema
-instanceType: 4
-showInAdvancedViewOnly: TRUE
systemFlags: 1
nCName: ${SCHEMADN}
dnsRoot: ${DNSDOMAIN}
@@ -35,8 +29,6 @@ dn: CN=${DOMAIN},CN=Partitions,${CONFIGDN}
objectClass: top
objectClass: crossRef
cn: ${DOMAIN}
-instanceType: 4
-showInAdvancedViewOnly: TRUE
systemFlags: 3
nCName: ${DOMAINDN}
nETBIOSName: ${DOMAIN}
@@ -46,62 +38,46 @@ dn: CN=Sites,${CONFIGDN}
objectClass: top
objectClass: sitesContainer
cn: Sites
-instanceType: 4
-showInAdvancedViewOnly: TRUE
systemFlags: 2181038080
dn: CN=${DEFAULTSITE},CN=Sites,${CONFIGDN}
objectClass: top
objectClass: site
cn: ${DEFAULTSITE}
-instanceType: 4
-showInAdvancedViewOnly: TRUE
systemFlags: 2181038080
dn: CN=Servers,CN=${DEFAULTSITE},CN=Sites,${CONFIGDN}
objectClass: top
objectClass: serversContainer
cn: Servers
-instanceType: 4
-showInAdvancedViewOnly: TRUE
systemFlags: 2181038080
dn: CN=Services,${CONFIGDN}
objectClass: top
objectClass: container
cn: Services
-instanceType: 4
-showInAdvancedViewOnly: TRUE
systemFlags: 2147483648
dn: CN=Windows NT,CN=Services,${CONFIGDN}
objectClass: top
objectClass: container
cn: Windows NT
-instanceType: 4
-showInAdvancedViewOnly: TRUE
dn: CN=Directory Service,CN=Windows NT,CN=Services,${CONFIGDN}
objectClass: top
objectClass: nTDSService
cn: Directory Service
-instanceType: 4
-showInAdvancedViewOnly: TRUE
sPNMappings: host=ldap,dns,cifs,http
dn: CN=Query-Policies,CN=Directory Service,CN=Windows NT,CN=Services,${CONFIGDN}
objectClass: top
objectClass: container
cn: Query-Policies
-instanceType: 4
-showInAdvancedViewOnly: TRUE
dn: CN=Default Query Policy,CN=Query-Policies,CN=Directory Service,CN=Windows NT,CN=Services,${CONFIGDN}
objectClass: top
objectClass: queryPolicy
cn: Default Query Policy
-instanceType: 4
-showInAdvancedViewOnly: TRUE
lDAPAdminLimits: MaxValRange=1500
lDAPAdminLimits: MaxReceiveBuffer=10485760
lDAPAdminLimits: MaxDatagramRecv=4096
diff --git a/source4/setup/provision_configuration_basedn.ldif b/source4/setup/provision_configuration_basedn.ldif
index df1e1b19ba..575f8faa0a 100644
--- a/source4/setup/provision_configuration_basedn.ldif
+++ b/source4/setup/provision_configuration_basedn.ldif
@@ -4,6 +4,5 @@
dn: ${CONFIGDN}
objectClass: top
objectClass: configuration
-${EXTENSIBLEOBJECT}
${ACI}
cn: Configuration
diff --git a/source4/setup/provision_configuration_basedn_modify.ldif b/source4/setup/provision_configuration_basedn_modify.ldif
index 46ba4e9649..9b87e1cead 100644
--- a/source4/setup/provision_configuration_basedn_modify.ldif
+++ b/source4/setup/provision_configuration_basedn_modify.ldif
@@ -3,14 +3,5 @@
###############################
dn: ${CONFIGDN}
changetype: modify
-replace: instanceType
-instanceType: 13
--
-replace: showInAdvancedViewOnly
-showInAdvancedViewOnly: TRUE
--
-replace: objectCategory
-objectCategory: CN=Configuration,${SCHEMADN}
--
replace: subRefs
subRefs: ${SCHEMADN}
diff --git a/source4/setup/provision_schema_basedn.ldif b/source4/setup/provision_schema_basedn.ldif
index 7b4f599072..fbfd4c09d6 100644
--- a/source4/setup/provision_schema_basedn.ldif
+++ b/source4/setup/provision_schema_basedn.ldif
@@ -4,6 +4,5 @@
dn: ${SCHEMADN}
objectClass: top
objectClass: dMD
-${EXTENSIBLEOBJECT}
${ACI}
cn: Schema
diff --git a/source4/setup/provision_schema_basedn_modify.ldif b/source4/setup/provision_schema_basedn_modify.ldif
index 92c5cf1ace..4e690376d7 100644
--- a/source4/setup/provision_schema_basedn_modify.ldif
+++ b/source4/setup/provision_schema_basedn_modify.ldif
@@ -3,12 +3,6 @@
###############################
dn: ${SCHEMADN}
changetype: modify
-replace: instanceType
-instanceType: 13
--
-replace: showInAdvancedViewOnly
-showInAdvancedViewOnly: TRUE
--
replace: fSMORoleOwner
fSMORoleOwner: CN=NTDS Settings,CN=${NETBIOSNAME},CN=Servers,CN=${DEFAULTSITE},CN=Sites,${CONFIGDN}
-
diff --git a/source4/setup/provision_self_join.ldif b/source4/setup/provision_self_join.ldif
index 06230e8d00..58669660f4 100644
--- a/source4/setup/provision_self_join.ldif
+++ b/source4/setup/provision_self_join.ldif
@@ -30,7 +30,6 @@ objectClass: organizationalPerson
objectClass: user
cn: dns
description: DNS Service Account
-showInAdvancedViewOnly: TRUE
userAccountControl: 514
accountExpires: 9223372036854775807
sAMAccountName: dns
@@ -38,13 +37,12 @@ sAMAccountType: 805306368
servicePrincipalName: DNS/${DNSDOMAIN}
isCriticalSystemObject: TRUE
sambaPassword:: ${DNSPASS_B64}
+showInAdvancedViewOnly: TRUE
dn: CN=${NETBIOSNAME},CN=Servers,CN=${DEFAULTSITE},CN=Sites,${CONFIGDN}
objectClass: top
objectClass: server
cn: ${NETBIOSNAME}
-instanceType: 4
-showInAdvancedViewOnly: TRUE
systemFlags: 1375731712
dNSHostName: ${DNSNAME}
serverReference: CN=${NETBIOSNAME},OU=Domain Controllers,${DOMAINDN}
@@ -55,8 +53,6 @@ objectClass: applicationSettings
objectClass: nTDSDSA
cn: NTDS Settings
options: 1
-instanceType: 4
-showInAdvancedViewOnly: TRUE
systemFlags: 33554432
dMDLocation: ${SCHEMADN}
invocationId: ${INVOCATIONID}
diff --git a/source4/setup/provision_templates.ldif b/source4/setup/provision_templates.ldif
index 8797efaf98..fafedc6966 100644
--- a/source4/setup/provision_templates.ldif
+++ b/source4/setup/provision_templates.ldif
@@ -66,12 +66,10 @@ sAMAccountType: 268435456
#
# dn: CN=TemplateAlias,CN=Templates
# cn: TemplateAlias
-# instanceType: 4
# groupType: -2147483644
# sAMAccountType: 268435456
dn: CN=TemplateForeignSecurityPrincipal,CN=Templates
-showInAdvancedViewOnly: TRUE
dn: CN=TemplateSecret,CN=Templates
diff --git a/source4/setup/provision_users.ldif b/source4/setup/provision_users.ldif
index 7c1a438d8e..05fde15974 100644
--- a/source4/setup/provision_users.ldif
+++ b/source4/setup/provision_users.ldif
@@ -134,7 +134,6 @@ objectClass: top
objectClass: group
cn: RAS and IAS Servers
description: Servers in this group can access remote access properties of users
-instanceType: 4
objectSid: ${DOMAINSID}-553
sAMAccountName: RAS and IAS Servers
sAMAccountType: 536870912
@@ -307,7 +306,6 @@ objectClass: top
objectClass: group
cn: Server Operators
description: Members can administer domain servers
-instanceType: 4
objectSid: S-1-5-32-549
adminCount: 1
sAMAccountName: Server Operators
@@ -327,7 +325,6 @@ objectClass: top
objectClass: group
cn: Account Operators
description: Members can administer domain user and group accounts
-instanceType: 4
objectSid: S-1-5-32-548
adminCount: 1
sAMAccountName: Account Operators
@@ -404,173 +401,148 @@ objectClass: top
objectClass: container
cn: WellKnown Security Principals
systemFlags: 2147483648
-showInAdvancedViewOnly: TRUE
dn: CN=Anonymous Logon,CN=WellKnown Security Principals,${CONFIGDN}
objectClass: top
objectClass: foreignSecurityPrincipal
cn: Anonymous Logon
objectSid: S-1-5-7
-showInAdvancedViewOnly: TRUE
dn: CN=Authenticated Users,CN=WellKnown Security Principals,${CONFIGDN}
objectClass: top
objectClass: foreignSecurityPrincipal
cn: Authenticated Users
objectSid: S-1-5-11
-showInAdvancedViewOnly: TRUE
dn: CN=Batch,CN=WellKnown Security Principals,${CONFIGDN}
objectClass: top
objectClass: foreignSecurityPrincipal
cn: Batch
objectSid: S-1-5-3
-showInAdvancedViewOnly: TRUE
dn: CN=Creator Group,CN=WellKnown Security Principals,${CONFIGDN}
objectClass: top
objectClass: foreignSecurityPrincipal
cn: Creator Group
objectSid: S-1-3-1
-showInAdvancedViewOnly: TRUE
dn: CN=Creator Owner,CN=WellKnown Security Principals,${CONFIGDN}
objectClass: top
objectClass: foreignSecurityPrincipal
cn: Creator Owner
objectSid: S-1-3-0
-showInAdvancedViewOnly: TRUE
dn: CN=Dialup,CN=WellKnown Security Principals,${CONFIGDN}
objectClass: top
objectClass: foreignSecurityPrincipal
cn: Dialup
objectSid: S-1-5-1
-showInAdvancedViewOnly: TRUE
dn: CN=Digest Authentication,CN=WellKnown Security Principals,${CONFIGDN}
objectClass: top
objectClass: foreignSecurityPrincipal
cn: Digest Authentication
objectSid: S-1-5-64-21
-showInAdvancedViewOnly: TRUE
dn: CN=Enterprise Domain Controllers,CN=WellKnown Security Principals,${CONFIGDN}
objectClass: top
objectClass: foreignSecurityPrincipal
cn: Enterprise Domain Controllers
objectSid: S-1-5-9
-showInAdvancedViewOnly: TRUE
dn: CN=Everyone,CN=WellKnown Security Principals,${CONFIGDN}
objectClass: top
objectClass: foreignSecurityPrincipal
cn: Everyone
objectSid: S-1-1-0
-showInAdvancedViewOnly: TRUE
dn: CN=Interactive,CN=WellKnown Security Principals,${CONFIGDN}
objectClass: top
objectClass: foreignSecurityPrincipal
cn: Interactive
objectSid: S-1-5-4
-showInAdvancedViewOnly: TRUE
dn: CN=Local Service,CN=WellKnown Security Principals,${CONFIGDN}
objectClass: top
objectClass: foreignSecurityPrincipal
cn: Local Service
objectSid: S-1-5-19
-showInAdvancedViewOnly: TRUE
dn: CN=Network,CN=WellKnown Security Principals,${CONFIGDN}
objectClass: top
objectClass: foreignSecurityPrincipal
cn: Network
objectSid: S-1-5-2
-showInAdvancedViewOnly: TRUE
dn: CN=Network Service,CN=WellKnown Security Principals,${CONFIGDN}
objectClass: top
objectClass: foreignSecurityPrincipal
cn: Network Service
objectSid: S-1-5-20
-showInAdvancedViewOnly: TRUE
dn: CN=NTLM Authentication,CN=WellKnown Security Principals,${CONFIGDN}
objectClass: top
objectClass: foreignSecurityPrincipal
cn: NTLM Authentication
objectSid: S-1-5-64-10
-showInAdvancedViewOnly: TRUE
dn: CN=Other Organization,CN=WellKnown Security Principals,${CONFIGDN}
objectClass: top
objectClass: foreignSecurityPrincipal
cn: Other Organization
objectSid: S-1-5-1000
-showInAdvancedViewOnly: TRUE
dn: CN=Proxy,CN=WellKnown Security Principals,${CONFIGDN}
objectClass: top
objectClass: foreignSecurityPrincipal
cn: Proxy
objectSid: S-1-5-8
-showInAdvancedViewOnly: TRUE
dn: CN=Remote Interactive Logon,CN=WellKnown Security Principals,${CONFIGDN}
objectClass: top
objectClass: foreignSecurityPrincipal
cn: Remote Interactive Logon
objectSid: S-1-5-14
-showInAdvancedViewOnly: TRUE
dn: CN=Restricted,CN=WellKnown Security Principals,${CONFIGDN}
objectClass: top
objectClass: foreignSecurityPrincipal
cn: Restricted
objectSid: S-1-5-12
-showInAdvancedViewOnly: TRUE
dn: CN=SChannel Authentication,CN=WellKnown Security Principals,${CONFIGDN}
objectClass: top
objectClass: foreignSecurityPrincipal
cn: SChannel Authentication
objectSid: S-1-5-64-14
-showInAdvancedViewOnly: TRUE
dn: CN=Self,CN=WellKnown Security Principals,${CONFIGDN}
objectClass: top
objectClass: foreignSecurityPrincipal
cn: Self
objectSid: S-1-5-10
-showInAdvancedViewOnly: TRUE
dn: CN=Service,CN=WellKnown Security Principals,${CONFIGDN}
objectClass: top
objectClass: foreignSecurityPrincipal
cn: Service
objectSid: S-1-5-6
-showInAdvancedViewOnly: TRUE
dn: CN=Terminal Server User,CN=WellKnown Security Principals,${CONFIGDN}
objectClass: top
objectClass: foreignSecurityPrincipal
cn: Terminal Server User
objectSid: S-1-5-13
-showInAdvancedViewOnly: TRUE
dn: CN=This Organization,CN=WellKnown Security Principals,${CONFIGDN}
objectClass: top
objectClass: foreignSecurityPrincipal
cn: This Organization
objectSid: S-1-5-15
-showInAdvancedViewOnly: TRUE
dn: CN=Well-Known-Security-Id-System,CN=WellKnown Security Principals,${CONFIGDN}
objectClass: top
objectClass: foreignSecurityPrincipal
cn: Well-Known-Security-Id-System
objectSid: S-1-5-18
-showInAdvancedViewOnly: TRUE
diff --git a/source4/setup/provision_users_modify.ldif b/source4/setup/provision_users_modify.ldif
index 42dff07080..06954c44f0 100644
--- a/source4/setup/provision_users_modify.ldif
+++ b/source4/setup/provision_users_modify.ldif
@@ -3,9 +3,6 @@ changetype: modify
replace: description
description: Default container for upgraded user accounts
-
-replace: instanceType
-instanceType: 4
--
replace: showInAdvancedViewOnly
showInAdvancedViewOnly: FALSE
-
diff --git a/source4/setup/schema-map-fedora-ds-1.0 b/source4/setup/schema-map-fedora-ds-1.0
index 7419a8d7b8..86f8c0b726 100644
--- a/source4/setup/schema-map-fedora-ds-1.0
+++ b/source4/setup/schema-map-fedora-ds-1.0
@@ -14,6 +14,8 @@ dITContentRules
top
#This shouldn't make it to the ldap server
sambaPassword
+#This should be provided by the LDAP server, only in our schema to permit provision
+aci
#Skip ObjectClasses
#MiddleName has a conflicting OID
2.16.840.1.113730.3.1.34:1.3.6.1.4.1.7165.4.255.1
diff --git a/source4/setup/schema_samba4.ldif b/source4/setup/schema_samba4.ldif
index a9f79f1635..8bd1705468 100644
--- a/source4/setup/schema_samba4.ldif
+++ b/source4/setup/schema_samba4.ldif
@@ -174,3 +174,23 @@ oMSyntax: 20
#Allocated: (objectClasses) samba4ObjectClasses: 1.3.6.1.4.1.7165.4.255.5
#Allocated: (ditContentRules) samba4DitContentRules: 1.3.6.1.4.1.7165.4.255.6
#Allocated: (attributeTypes) samba4AttributeTypes: 1.3.6.1.4.1.7165.4.255.7
+
+
+#
+# Fedora DS uses this attribute, and we need to set it via our module stack
+#
+dn: CN=aci,${SCHEMADN}
+cn: aci
+name: aci
+objectClass: top
+objectClass: attributeSchema
+lDAPDisplayName: aci
+isSingleValued: TRUE
+systemFlags: 16
+systemOnly: FALSE
+schemaIDGUID: d8e6c1fa-db08-4f26-a53b-23c414aac92d
+adminDisplayName: aci
+attributeID: 1.3.6.1.4.1.7165.4.1.11
+attributeSyntax: 2.5.5.4
+oMSyntax: 20
+
diff --git a/source4/setup/slapd.conf b/source4/setup/slapd.conf
index e4e86eece9..83f4da3359 100644
--- a/source4/setup/slapd.conf
+++ b/source4/setup/slapd.conf
@@ -34,6 +34,12 @@ index lDAPDisplayName eq
index subClassOf eq
index cn eq
+#syncprov is stable in OpenLDAP 2.3, and available in 2.2.
+#We only need this for the contextCSN attribute anyway....
+overlay syncprov
+syncprov-checkpoint 100 10
+syncprov-sessionlog 100
+
database hdb
suffix ${CONFIGDN}
directory ${LDAPDIR}/db/config
@@ -48,6 +54,12 @@ index dnsRoot eq
index nETBIOSName eq
index cn eq
+#syncprov is stable in OpenLDAP 2.3, and available in 2.2.
+#We only need this for the contextCSN attribute anyway....
+overlay syncprov
+syncprov-checkpoint 100 10
+syncprov-sessionlog 100
+
database hdb
suffix ${DOMAINDN}
rootdn ${LDAPMANAGERDN}
diff --git a/source4/smbd/config.mk b/source4/smbd/config.mk
index ea0df63f32..c4d1070992 100644
--- a/source4/smbd/config.mk
+++ b/source4/smbd/config.mk
@@ -10,9 +10,7 @@ PRIVATE_DEPENDENCIES = \
# End MODULE server_auth
################################################
-#######################
-# Start SUBSERVICE
-[LIBRARY::service]
+[SUBSYSTEM::service]
PRIVATE_PROTO_HEADER = service_proto.h
OBJ_FILES = \
service.o \
@@ -20,8 +18,6 @@ OBJ_FILES = \
service_task.o
PRIVATE_DEPENDENCIES = \
MESSAGING samba-socket
-# End SUBSYSTEM SERVER
-#######################
[SUBSYSTEM::PIDFILE]
OBJ_FILES = pidfile.o
diff --git a/source4/smbd/process_model.mk b/source4/smbd/process_model.mk
index 4d927a640c..d6b7698e74 100644
--- a/source4/smbd/process_model.mk
+++ b/source4/smbd/process_model.mk
@@ -32,15 +32,8 @@ PRIVATE_DEPENDENCIES = PTHREAD
# End MODULE process_model_thread
################################################
-################################################
-# Start SUBSYSTEM process_model
-[LIBRARY::process_model]
-VERSION = 0.0.1
-SO_VERSION = 0
+[SUBSYSTEM::process_model]
PRIVATE_PROTO_HEADER = process_model_proto.h
OBJ_FILES = \
process_model.o
PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL LIBSAMBA-CONFIG
-#
-# End SUBSYSTEM process_model
-################################################
diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c
index c9e36b7e4e..d50393baf0 100644
--- a/source4/torture/gentest.c
+++ b/source4/torture/gentest.c
@@ -1637,7 +1637,8 @@ static bool cmp_fileinfo(int instance,
case RAW_FILEINFO_UNIX_BASIC:
case RAW_FILEINFO_UNIX_LINK:
case RAW_FILEINFO_SMB2_ALL_EAS:
- case RAW_FILEINFO_SMB2_ALL_INFORMATION:
+ case RAW_FILEINFO_SMB2_ALL_INFORMATION:
+ case RAW_FILEINFO_UNIX_INFO2:
break;
}
@@ -1775,6 +1776,7 @@ static void gen_setfileinfo(int instance, union smb_setfileinfo *info)
case RAW_SFILEINFO_1032:
case RAW_SFILEINFO_1039:
case RAW_SFILEINFO_1040:
+ case RAW_SFILEINFO_UNIX_INFO2:
/* Untested */
break;
}
diff --git a/source4/torture/libnet/libnet.c b/source4/torture/libnet/libnet.c
index 261012edae..3a75ffcae3 100644
--- a/source4/torture/libnet/libnet.c
+++ b/source4/torture/libnet/libnet.c
@@ -19,6 +19,10 @@
#include "includes.h"
#include "torture/torture.h"
+#include "librpc/rpc/dcerpc.h"
+#include "librpc/gen_ndr/security.h"
+#include "librpc/gen_ndr/lsa.h"
+#include "libnet/composite.h"
#include "torture/libnet/proto.h"
NTSTATUS torture_net_init(void)
diff --git a/source4/torture/raw/streams.c b/source4/torture/raw/streams.c
index bbc0bcae82..ca6b488af5 100644
--- a/source4/torture/raw/streams.c
+++ b/source4/torture/raw/streams.c
@@ -490,9 +490,16 @@ static bool test_stream_delete(struct torture_context *tctx,
status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo);
CHECK_STATUS(status, NT_STATUS_DELETE_PENDING);
- finfo.generic.in.file.path = sname1;
- status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo);
- CHECK_STATUS(status, NT_STATUS_DELETE_PENDING);
+ if (!torture_setting_bool(tctx, "samba3", false)) {
+
+ /*
+ * S3 doesn't do this yet
+ */
+
+ finfo.generic.in.file.path = sname1;
+ status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo);
+ CHECK_STATUS(status, NT_STATUS_DELETE_PENDING);
+ }
/*
* fd-based qfileinfo on the stream still works, the stream does not
diff --git a/source4/torture/rpc/netlogon.c b/source4/torture/rpc/netlogon.c
index 74bc3a2bf7..a13172b695 100644
--- a/source4/torture/rpc/netlogon.c
+++ b/source4/torture/rpc/netlogon.c
@@ -647,6 +647,10 @@ static bool test_DatabaseSync(struct torture_context *tctx,
if (NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES))
break;
+ /* Native mode servers don't do this */
+ if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_SUPPORTED)) {
+ return true;
+ }
torture_assert_ntstatus_ok(tctx, status, "DatabaseSync");
if (!creds_client_check(creds, &r.out.return_authenticator.cred)) {
@@ -968,6 +972,11 @@ static bool test_DatabaseSync2(struct torture_context *tctx,
if (NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES))
break;
+ /* Native mode servers don't do this */
+ if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_SUPPORTED)) {
+ return true;
+ }
+
torture_assert_ntstatus_ok(tctx, status, "DatabaseSync2");
if (!creds_client_check(creds, &r.out.return_authenticator.cred)) {
diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c
index 3b96140fb2..b08cd05bdb 100644
--- a/source4/torture/rpc/samba3rpc.c
+++ b/source4/torture/rpc/samba3rpc.c
@@ -529,7 +529,7 @@ static bool create_user(TALLOC_CTX *mem_ctx, struct smbcli_state *cli,
username, domain_name, &samr_pipe, &wks_handle,
user_sid);
if (!NT_STATUS_IS_OK(status)) {
- d_printf("get_wks_handle failed: %s\n", nt_errstr(status));
+ d_printf("get_usr_handle failed: %s\n", nt_errstr(status));
goto done;
}
diff --git a/testprogs/blackbox/test_ldb.sh b/testprogs/blackbox/test_ldb.sh
index e35d3547d9..4067a7fc43 100755
--- a/testprogs/blackbox/test_ldb.sh
+++ b/testprogs/blackbox/test_ldb.sh
@@ -108,5 +108,12 @@ echo "Search Options Control Query test returned 0 items"
failed=`expr $failed + 1`
fi
+echo "Test Search Options Control with Domain Scope Control"
+nentries=`bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=search_options:1:2,domain_scope:1 '(objectclass=crossRef)' | grep crossRef | wc -l`
+if [ $nentries -lt 1 ]; then
+echo "Search Options Control Query test returned 0 items"
+failed=`expr $failed + 1`
+fi
+
exit $failed
diff --git a/testprogs/blackbox/test_smbclient.sh b/testprogs/blackbox/test_smbclient.sh
index bd3df0b254..a803d83363 100755
--- a/testprogs/blackbox/test_smbclient.sh
+++ b/testprogs/blackbox/test_smbclient.sh
@@ -144,7 +144,7 @@ testit "Test login with PASSWD" $VALGRIND $smbclient -c 'ls' $CONFIGURATION //$S
oldUSER=$USER
USER="$USERNAME"
export USER
-testit "Test login with USER and PASSWD" $VALGRIND $smbclient -c 'ls' $CONFIGURATION //$SERVER/tmp -W "$DOMAIN" || failed=`expr $failed + 1`
+testit "Test login with USER and PASSWD" $VALGRIND $smbclient -k no -c 'ls' $CONFIGURATION //$SERVER/tmp -W "$DOMAIN" || failed=`expr $failed + 1`
PASSWD=
export PASSWD
unset PASSWD
diff --git a/testprogs/ejs/ldap.js b/testprogs/ejs/ldap.js
index c03dbe9ce2..836b726ad9 100755
--- a/testprogs/ejs/ldap.js
+++ b/testprogs/ejs/ldap.js
@@ -30,7 +30,12 @@ function basic_tests(ldb, gc_ldb, base_dn, configuration_dn, schema_dn)
println("Running basic tests");
ldb.del("cn=ldaptestuser,cn=users," + base_dn);
-
+ ldb.del("cn=ldaptestuser2,cn=users," + base_dn);
+ ldb.del("cn=ldaptestuser3,cn=users," + base_dn);
+ ldb.del("cn=ldaptestuser4,cn=users," + base_dn);
+ ldb.del("cn=ldaptestuser5,cn=users," + base_dn);
+ ldb.del("CN=ldaptestuser4,CN=ldaptestcontainer2," + base_dn);
+ ldb.del("CN=ldaptestcontainer2," + base_dn);
ldb.del("cn=ldaptestgroup,cn=users," + base_dn);
println("Testing group add with invalid member");