From ec7c03a80ff7f17b5b7d098d5fee34ba175fc82f Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 16 Feb 2008 15:40:42 +0100 Subject: Add static header for gencache. (This used to be commit 9a0f6a0012243a74702c723dec808c99c58c772e) --- source4/lib/basic.mk | 6 +-- source4/lib/gencache/gencache.h | 94 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+), 5 deletions(-) create mode 100644 source4/lib/gencache/gencache.h (limited to 'source4/lib') diff --git a/source4/lib/basic.mk b/source4/lib/basic.mk index 8653779044..53eb0d038f 100644 --- a/source4/lib/basic.mk +++ b/source4/lib/basic.mk @@ -18,15 +18,11 @@ include tdr/config.mk include dbwrap/config.mk include crypto/config.mk -################################################ -# Start SUBSYSTEM LIBCOMPRESSION [SUBSYSTEM::LIBCOMPRESSION] OBJ_FILES = compression/mszip.o -# End SUBSYSTEM LIBCOMPRESION -################################################ [SUBSYSTEM::GENCACHE] -PRIVATE_PROTO_HEADER = gencache/gencache.h +PUBLIC_HEADERS = gencache/gencache.h OBJ_FILES = gencache/gencache.o PRIVATE_DEPENDENCIES = TDB_WRAP diff --git a/source4/lib/gencache/gencache.h b/source4/lib/gencache/gencache.h new file mode 100644 index 0000000000..1481676fd9 --- /dev/null +++ b/source4/lib/gencache/gencache.h @@ -0,0 +1,94 @@ +#ifndef __LIB_GENCACHE_GENCACHE_H__ +#define __LIB_GENCACHE_GENCACHE_H__ + +/** + * Cache initialisation function. Opens cache tdb file or creates + * it if does not exist. + * + * @return true on successful initialisation of the cache or + * false on failure + **/ +bool gencache_init(struct loadparm_context *lp_ctx); + +/** + * Cache shutdown function. Closes opened cache tdb file. + * + * @return true on successful closing the cache or + * false on failure during cache shutdown + **/ +bool gencache_shutdown(void); + +/** + * Set an entry in the cache file. If there's no such + * one, then add it. + * + * @param keystr string that represents a key of this entry + * @param value text representation value being cached + * @param timeout time when the value is expired + * + * @retval true when entry is successfuly stored + * @retval false on failure + **/ +bool gencache_set(const char *keystr, const char *value, time_t timeout); + +/** + * Set existing entry to the cache file. + * + * @param keystr string that represents a key of this entry + * @param valstr text representation value being cached + * @param timeout time when the value is expired + * + * @retval true when entry is successfuly set + * @retval false on failure + **/ +bool gencache_set_only(const char *keystr, const char *valstr, time_t timeout); + +/** + * Delete one entry from the cache file. + * + * @param keystr string that represents a key of this entry + * + * @retval true upon successful deletion + * @retval false in case of failure + **/ +bool gencache_del(const char *keystr); + +/** + * Get existing entry from the cache file. + * + * @param keystr string that represents a key of this entry + * @param valstr buffer that is allocated and filled with the entry value + * buffer's disposing must be done outside + * @param timeout pointer to a time_t that is filled with entry's + * timeout + * + * @retval true when entry is successfuly fetched + * @retval false for failure + **/ +bool gencache_get(const char *keystr, char **valstr, time_t *timeout); + +/** + * Iterate through all entries which key matches to specified pattern + * + * @param fn pointer to the function that will be supplied with each single + * matching cache entry (key, value and timeout) as an arguments + * @param data void pointer to an arbitrary data that is passed directly to the fn + * function on each call + * @param keystr_pattern pattern the existing entries' keys are matched to + * + **/ +void gencache_iterate(void (*fn)(const char* key, const char *value, time_t timeout, void* dptr), + void* data, const char* keystr_pattern); + +/******************************************************************** + lock a key +********************************************************************/ +int gencache_lock_entry( const char *key ); + +/******************************************************************** + unlock a key +********************************************************************/ +void gencache_unlock_entry( const char *key ); + +#endif /* __LIB_GENCACHE_GENCACHE_H__ */ + -- cgit From 5214f5a81f3811484ca6aa87cbad30e1aca5aeed Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 16 Feb 2008 15:40:55 +0100 Subject: Allow LDB to be a static library again. (This used to be commit 16fd90d7a99ae8eaf2accf3c8b3ec55b2223f9cd) --- source4/lib/ldb/config.mk | 1 - source4/lib/ldb/ldb_ildap/config.mk | 1 - 2 files changed, 2 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/config.mk b/source4/lib/ldb/config.mk index 75ce89d6cf..9e407fe731 100644 --- a/source4/lib/ldb/config.mk +++ b/source4/lib/ldb/config.mk @@ -128,7 +128,6 @@ PRIVATE_DEPENDENCIES = \ [LIBRARY::LIBLDB] VERSION = 0.0.1 SO_VERSION = 0 -OUTPUT_TYPE = SHARED_LIBRARY CFLAGS = -Ilib/ldb/include PC_FILE = ldb.pc INIT_FUNCTION_TYPE = int (*) (void) diff --git a/source4/lib/ldb/ldb_ildap/config.mk b/source4/lib/ldb/ldb_ildap/config.mk index 01d9ec88ff..4a818ee96c 100644 --- a/source4/lib/ldb/ldb_ildap/config.mk +++ b/source4/lib/ldb/ldb_ildap/config.mk @@ -3,7 +3,6 @@ [MODULE::ldb_ildap] SUBSYSTEM = LIBLDB CFLAGS = -Ilib/ldb/include -OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = LIBTALLOC LIBCLI_LDAP CREDENTIALS INIT_FUNCTION = ldb_ildap_init ALIASES = ldapi ldaps ldap -- cgit From e4af554c5627d8c3e20cc451da092c09f2489295 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 16 Feb 2008 16:02:47 +0100 Subject: Revert "Allow LDB to be a static library again." This reverts commit 16fd90d7a99ae8eaf2accf3c8b3ec55b2223f9cd. (This used to be commit 9166e48944819041ed5db6dbd432fc660660c5ce) --- source4/lib/ldb/config.mk | 1 + source4/lib/ldb/ldb_ildap/config.mk | 1 + 2 files changed, 2 insertions(+) (limited to 'source4/lib') diff --git a/source4/lib/ldb/config.mk b/source4/lib/ldb/config.mk index 9e407fe731..75ce89d6cf 100644 --- a/source4/lib/ldb/config.mk +++ b/source4/lib/ldb/config.mk @@ -128,6 +128,7 @@ PRIVATE_DEPENDENCIES = \ [LIBRARY::LIBLDB] VERSION = 0.0.1 SO_VERSION = 0 +OUTPUT_TYPE = SHARED_LIBRARY CFLAGS = -Ilib/ldb/include PC_FILE = ldb.pc INIT_FUNCTION_TYPE = int (*) (void) diff --git a/source4/lib/ldb/ldb_ildap/config.mk b/source4/lib/ldb/ldb_ildap/config.mk index 4a818ee96c..01d9ec88ff 100644 --- a/source4/lib/ldb/ldb_ildap/config.mk +++ b/source4/lib/ldb/ldb_ildap/config.mk @@ -3,6 +3,7 @@ [MODULE::ldb_ildap] SUBSYSTEM = LIBLDB CFLAGS = -Ilib/ldb/include +OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = LIBTALLOC LIBCLI_LDAP CREDENTIALS INIT_FUNCTION = ldb_ildap_init ALIASES = ldapi ldaps ldap -- cgit From b66ee2ed22754dd44b20c06e573072e328d9a3dd Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 16 Feb 2008 18:38:02 +0100 Subject: Move responsibilities of build.h to makefile. (This used to be commit a43f6d37bce85748e9cf2675e5beced5db26f1c3) --- source4/lib/events/events.c | 6 +++--- source4/lib/ldb/common/ldb_modules.c | 1 - source4/lib/ldb/include/ldb_private.h | 2 ++ source4/lib/registry/interface.c | 1 - source4/lib/registry/local.c | 1 - 5 files changed, 5 insertions(+), 6 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/events/events.c b/source4/lib/events/events.c index 555a5092cc..969abeae46 100644 --- a/source4/lib/events/events.c +++ b/source4/lib/events/events.c @@ -58,9 +58,6 @@ #include "lib/events/events_internal.h" #include "lib/util/dlinklist.h" #include "param/param.h" -#if _SAMBA_BUILD_ -#include "build.h" -#endif struct event_ops_list { struct event_ops_list *next, *prev; @@ -102,6 +99,9 @@ void event_set_default_backend(const char *backend) static void event_backend_init(void) { #if _SAMBA_BUILD_ + NTSTATUS s4_events_standard_init(void); + NTSTATUS s4_events_select_init(void); + NTSTATUS s4_events_epoll_init(void); init_module_fn static_init[] = { STATIC_LIBEVENTS_MODULES }; if (event_backends) return; run_init_functions(static_init); diff --git a/source4/lib/ldb/common/ldb_modules.c b/source4/lib/ldb/common/ldb_modules.c index 18070bdb86..a3bf71d0d8 100644 --- a/source4/lib/ldb/common/ldb_modules.c +++ b/source4/lib/ldb/common/ldb_modules.c @@ -35,7 +35,6 @@ #if (_SAMBA_BUILD_ >= 4) #include "includes.h" -#include "build.h" #endif #define LDB_MODULE_PREFIX "modules:" diff --git a/source4/lib/ldb/include/ldb_private.h b/source4/lib/ldb/include/ldb_private.h index d9f2defdc9..61d5f5148a 100644 --- a/source4/lib/ldb/include/ldb_private.h +++ b/source4/lib/ldb/include/ldb_private.h @@ -173,6 +173,7 @@ int ldb_should_b64_encode(const struct ldb_val *val); int ldb_objectclass_init(void); int ldb_operational_init(void); int ldb_paged_results_init(void); +int ldb_paged_searches_init(void); int ldb_rdn_name_init(void); int ldb_schema_init(void); int ldb_asq_init(void); @@ -180,6 +181,7 @@ int ldb_sort_init(void); int ldb_ldap_init(void); int ldb_ildap_init(void); int ldb_tdb_init(void); +int ldb_skel_init(void); int ldb_sqlite3_init(void); int ldb_match_msg(struct ldb_context *ldb, diff --git a/source4/lib/registry/interface.c b/source4/lib/registry/interface.c index a18fd2c28c..ff3ddf0a35 100644 --- a/source4/lib/registry/interface.c +++ b/source4/lib/registry/interface.c @@ -21,7 +21,6 @@ #include "lib/util/dlinklist.h" #include "lib/registry/registry.h" #include "system/filesys.h" -#include "build.h" /** diff --git a/source4/lib/registry/local.c b/source4/lib/registry/local.c index 3e463100c9..b2cdec9cdf 100644 --- a/source4/lib/registry/local.c +++ b/source4/lib/registry/local.c @@ -22,7 +22,6 @@ #include "lib/util/dlinklist.h" #include "lib/registry/registry.h" #include "system/filesys.h" -#include "build.h" struct reg_key_path { uint32_t predefined_key; -- cgit From 738fd7fd504c3412128cfae4f8f59ac4f212ae0f Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 25 Feb 2008 17:33:28 +0100 Subject: Fix standalone ldb build modules. (This used to be commit 0b133a30a23757cf463ff22dff6372ae5e11d4c7) --- source4/lib/ldb/common/ldb_modules.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/common/ldb_modules.c b/source4/lib/ldb/common/ldb_modules.c index a4e0b94188..af837d2965 100644 --- a/source4/lib/ldb/common/ldb_modules.c +++ b/source4/lib/ldb/common/ldb_modules.c @@ -128,11 +128,11 @@ static struct ops_list_entry { #ifndef STATIC_LIBLDB_MODULES #define STATIC_LIBLDB_MODULES \ - ldb_operational_module_ops, \ - ldb_rdn_name_module_ops, \ - ldb_paged_results_module_ops, \ - ldb_sort_module_ops, \ - ldb_asq_module_ops, \ + &ldb_operational_module_ops, \ + &ldb_rdn_name_module_ops, \ + &ldb_paged_results_module_ops, \ + &ldb_sort_module_ops, \ + &ldb_asq_module_ops, \ NULL #endif -- cgit From b5bd6636907c76f6bb562b62abca78a7aeed83d8 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 25 Feb 2008 20:40:37 +0100 Subject: Fix use of realpath, fix init functions for ldb. (This used to be commit ca510136d2c4cae8f520c76df6aaadb5d412bea1) --- source4/lib/ldb/common/ldb_modules.c | 12 +++++++----- source4/lib/ldb/config.mk | 14 +++++++------- source4/lib/ldb/include/ldb_private.h | 4 +++- 3 files changed, 17 insertions(+), 13 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/common/ldb_modules.c b/source4/lib/ldb/common/ldb_modules.c index af837d2965..ddbe0f23a6 100644 --- a/source4/lib/ldb/common/ldb_modules.c +++ b/source4/lib/ldb/common/ldb_modules.c @@ -125,14 +125,16 @@ static struct ops_list_entry { struct ops_list_entry *next; } *registered_modules = NULL; +#define LDB_MODULE(name) (&ldb_ ## name ## _module_ops) + #ifndef STATIC_LIBLDB_MODULES #define STATIC_LIBLDB_MODULES \ - &ldb_operational_module_ops, \ - &ldb_rdn_name_module_ops, \ - &ldb_paged_results_module_ops, \ - &ldb_sort_module_ops, \ - &ldb_asq_module_ops, \ + LDB_MODULE(operational), \ + LDB_MODULE(rdn_name), \ + LDB_MODULE(paged_results), \ + LDB_MODULE(server_sort), \ + LDB_MODULE(asq), \ NULL #endif diff --git a/source4/lib/ldb/config.mk b/source4/lib/ldb/config.mk index d6980f341a..7d6328fc52 100644 --- a/source4/lib/ldb/config.mk +++ b/source4/lib/ldb/config.mk @@ -3,7 +3,7 @@ [MODULE::ldb_asq] PRIVATE_DEPENDENCIES = LIBTALLOC CFLAGS = -Ilib/ldb/include -INIT_FUNCTION = &ldb_asq_module_ops +INIT_FUNCTION = LDB_MODULE(asq) SUBSYSTEM = LIBLDB OBJ_FILES = \ modules/asq.o @@ -15,7 +15,7 @@ OBJ_FILES = \ [MODULE::ldb_server_sort] PRIVATE_DEPENDENCIES = LIBTALLOC CFLAGS = -Ilib/ldb/include -INIT_FUNCTION = &ldb_server_sort_module_ops +INIT_FUNCTION = LDB_MODULE(server_sort) SUBSYSTEM = LIBLDB OBJ_FILES = \ modules/sort.o @@ -25,7 +25,7 @@ OBJ_FILES = \ ################################################ # Start MODULE ldb_paged_results [MODULE::ldb_paged_results] -INIT_FUNCTION = &ldb_paged_results_module_ops +INIT_FUNCTION = LDB_MODULE(paged_results) CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC SUBSYSTEM = LIBLDB @@ -37,7 +37,7 @@ OBJ_FILES = \ ################################################ # Start MODULE ldb_paged_results [MODULE::ldb_paged_searches] -INIT_FUNCTION = &ldb_paged_searches_module_ops +INIT_FUNCTION = LDB_MODULE(paged_searches) CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC SUBSYSTEM = LIBLDB @@ -52,7 +52,7 @@ OBJ_FILES = \ SUBSYSTEM = LIBLDB CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC -INIT_FUNCTION = &ldb_operational_module_ops +INIT_FUNCTION = LDB_MODULE(operational) OBJ_FILES = \ modules/operational.o # End MODULE ldb_operational @@ -64,7 +64,7 @@ OBJ_FILES = \ SUBSYSTEM = LIBLDB CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC -INIT_FUNCTION = &ldb_rdn_name_module_ops +INIT_FUNCTION = LDB_MODULE(rdn_name) OBJ_FILES = \ modules/rdn_name.o # End MODULE ldb_rdn_name @@ -88,7 +88,7 @@ OBJ_FILES = \ SUBSYSTEM = LIBLDB CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC -INIT_FUNCTION = &ldb_skel_module_ops +INIT_FUNCTION = LDB_MODULE(skel) OBJ_FILES = modules/skel.o # End MODULE ldb_skel ################################################ diff --git a/source4/lib/ldb/include/ldb_private.h b/source4/lib/ldb/include/ldb_private.h index d2dcc675a5..65bdc713db 100644 --- a/source4/lib/ldb/include/ldb_private.h +++ b/source4/lib/ldb/include/ldb_private.h @@ -185,11 +185,13 @@ extern const struct ldb_module_ops ldb_paged_results_module_ops; extern const struct ldb_module_ops ldb_rdn_name_module_ops; extern const struct ldb_module_ops ldb_schema_module_ops; extern const struct ldb_module_ops ldb_asq_module_ops; -extern const struct ldb_module_ops ldb_sort_module_ops; +extern const struct ldb_module_ops ldb_server_sort_module_ops; extern const struct ldb_module_ops ldb_ldap_module_ops; extern const struct ldb_module_ops ldb_ildap_module_ops; extern const struct ldb_module_ops ldb_tdb_module_ops; extern const struct ldb_module_ops ldb_sqlite3_module_ops; +extern const struct ldb_module_ops ldb_wins_ldb_module_ops; +extern const struct ldb_module_ops ldb_ranged_results_module_ops; extern const struct ldb_backend_ops ldb_tdb_backend_ops; extern const struct ldb_backend_ops ldb_sqlite3_backend_ops; -- cgit From f112578843bcc757bf0b2ee56d8bd8d318b53610 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 25 Feb 2008 23:09:56 +0100 Subject: Remove public prototype headers. Generating both public and private prototype headers is tricky with gmake and it's easy to break backwards compatibility for the public API with them. (This used to be commit dee1cb6b08aa0a3e24372e052729121c11280971) --- source4/lib/charset/config.mk | 2 +- source4/lib/tdr/config.mk | 2 +- source4/lib/util/config.mk | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/charset/config.mk b/source4/lib/charset/config.mk index 4f0c80c79d..2dd5b05c94 100644 --- a/source4/lib/charset/config.mk +++ b/source4/lib/charset/config.mk @@ -6,7 +6,7 @@ OBJ_FILES = \ charcnv.o \ util_unistr.o PUBLIC_HEADERS = charset.h -PUBLIC_PROTO_HEADER = charset_proto.h +PRIVATE_PROTO_HEADER = charset_proto.h PUBLIC_DEPENDENCIES = ICONV PRIVATE_DEPENDENCIES = DYNCONFIG # End SUBSYSTEM CHARSET diff --git a/source4/lib/tdr/config.mk b/source4/lib/tdr/config.mk index b8473e5ba8..2d6c30ea50 100644 --- a/source4/lib/tdr/config.mk +++ b/source4/lib/tdr/config.mk @@ -1,6 +1,6 @@ [SUBSYSTEM::TDR] CFLAGS = -Ilib/tdr PUBLIC_HEADERS = tdr.h -PUBLIC_PROTO_HEADER = tdr_proto.h +PRIVATE_PROTO_HEADER = tdr_proto.h PUBLIC_DEPENDENCIES = LIBTALLOC LIBSAMBA-UTIL OBJ_FILES = tdr.o diff --git a/source4/lib/util/config.mk b/source4/lib/util/config.mk index f3e6cd7acf..6a19515708 100644 --- a/source4/lib/util/config.mk +++ b/source4/lib/util/config.mk @@ -34,7 +34,7 @@ PUBLIC_DEPENDENCIES = \ CHARSET EXECINFO [SUBSYSTEM::ASN1_UTIL] -PUBLIC_PROTO_HEADER = asn1_proto.h +PRIVATE_PROTO_HEADER = asn1_proto.h PUBLIC_HEADERS = asn1.h OBJ_FILES = asn1.o @@ -45,7 +45,7 @@ OBJ_FILES = unix_privs.o ################################################ # Start SUBSYSTEM WRAP_XATTR [SUBSYSTEM::WRAP_XATTR] -PUBLIC_PROTO_HEADER = wrap_xattr.h +PRIVATE_PROTO_HEADER = wrap_xattr.h OBJ_FILES = \ wrap_xattr.o PUBLIC_DEPENDENCIES = XATTR @@ -54,13 +54,13 @@ PUBLIC_DEPENDENCIES = XATTR ################################################ [SUBSYSTEM::UTIL_TDB] -PUBLIC_PROTO_HEADER = util_tdb.h +PRIVATE_PROTO_HEADER = util_tdb.h OBJ_FILES = \ util_tdb.o PUBLIC_DEPENDENCIES = LIBTDB [SUBSYSTEM::UTIL_LDB] -PUBLIC_PROTO_HEADER = util_ldb.h +PRIVATE_PROTO_HEADER = util_ldb.h OBJ_FILES = \ util_ldb.o PUBLIC_DEPENDENCIES = LIBLDB -- cgit From 22ef67dd136f0a67885a17be68909643dc97304d Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 26 Feb 2008 01:20:55 +0100 Subject: Fix the build (again). (This used to be commit ef00f6b5817107738dc44367838095896af4e77d) --- source4/lib/ldb/include/ldb_private.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source4/lib') diff --git a/source4/lib/ldb/include/ldb_private.h b/source4/lib/ldb/include/ldb_private.h index 65bdc713db..880aafd593 100644 --- a/source4/lib/ldb/include/ldb_private.h +++ b/source4/lib/ldb/include/ldb_private.h @@ -188,7 +188,11 @@ extern const struct ldb_module_ops ldb_asq_module_ops; extern const struct ldb_module_ops ldb_server_sort_module_ops; extern const struct ldb_module_ops ldb_ldap_module_ops; extern const struct ldb_module_ops ldb_ildap_module_ops; +extern const struct ldb_module_ops ldb_paged_searches_module_ops; extern const struct ldb_module_ops ldb_tdb_module_ops; +extern const struct ldb_module_ops ldb_skel_module_ops; +extern const struct ldb_module_ops ldb_subtree_rename_module_ops; +extern const struct ldb_module_ops ldb_subtree_delete_module_ops; extern const struct ldb_module_ops ldb_sqlite3_module_ops; extern const struct ldb_module_ops ldb_wins_ldb_module_ops; extern const struct ldb_module_ops ldb_ranged_results_module_ops; -- cgit From c8af9559dc44b578d3b49620f690652a1676e9bd Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 26 Feb 2008 15:11:47 +0100 Subject: Move manpage management out of the perl build system. (This used to be commit a660ab262e7202baccf16cb8b2bc47cb8efacc34) --- source4/lib/ldb/config.mk | 8 +++++--- source4/lib/ldb/tools/config.mk | 18 ++++++++++++------ source4/lib/registry/config.mk | 12 ++++++++---- source4/lib/talloc/config.mk | 4 +++- 4 files changed, 28 insertions(+), 14 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/config.mk b/source4/lib/ldb/config.mk index 7d6328fc52..ad202fb34e 100644 --- a/source4/lib/ldb/config.mk +++ b/source4/lib/ldb/config.mk @@ -147,12 +147,13 @@ PUBLIC_DEPENDENCIES = \ LIBTALLOC PRIVATE_DEPENDENCIES = \ SOCKET_WRAPPER -MANPAGE = man/ldb.3 PUBLIC_HEADERS = include/ldb.h include/ldb_errors.h # # End SUBSYSTEM ldb ################################################ +MANPAGES += $(ldbdir)/man/ldb.3 + ################################################ # Start BINARY ldbtest [BINARY::ldbtest] @@ -167,7 +168,6 @@ PRIVATE_DEPENDENCIES = \ # Start BINARY oLschema2ldif [BINARY::oLschema2ldif] INSTALLDIR = BINDIR -MANPAGE = man/oLschema2ldif.1 OBJ_FILES= \ tools/convert.o \ tools/oLschema2ldif.o @@ -176,11 +176,12 @@ PRIVATE_DEPENDENCIES = \ # End BINARY oLschema2ldif ################################################ +MANPAGES += $(ldbdir)/man/oLschema2ldif.1 + ################################################ # Start BINARY ad2oLschema [BINARY::ad2oLschema] INSTALLDIR = BINDIR -MANPAGE = man/ad2oLschema.1 OBJ_FILES= \ tools/convert.o \ tools/ad2oLschema.o @@ -189,6 +190,7 @@ PRIVATE_DEPENDENCIES = \ # End BINARY ad2oLschema ################################################ +MANPAGES += $(ldbdir)/man/ad2oLschema.1 mkinclude tools/config.mk mkinclude ldb_ildap/config.mk diff --git a/source4/lib/ldb/tools/config.mk b/source4/lib/ldb/tools/config.mk index bf6c5f963c..c1c368f336 100644 --- a/source4/lib/ldb/tools/config.mk +++ b/source4/lib/ldb/tools/config.mk @@ -17,10 +17,11 @@ OBJ_FILES = \ ldbadd.o PRIVATE_DEPENDENCIES = \ LIBLDB_CMDLINE LIBCLI_RESOLVE -MANPAGE = ../man/ldbadd.1 # End BINARY ldbadd ################################################ +MANPAGES += $(ldbdir)/../man/ldbadd.1 + ################################################ # Start BINARY ldbdel [BINARY::ldbdel] @@ -29,10 +30,11 @@ OBJ_FILES= \ ldbdel.o PRIVATE_DEPENDENCIES = \ LIBLDB_CMDLINE -MANPAGE = ../man/ldbdel.1 # End BINARY ldbdel ################################################ +MANPAGES += $(ldbdir)/../man/ldbdel.1 + ################################################ # Start BINARY ldbmodify [BINARY::ldbmodify] @@ -41,10 +43,11 @@ OBJ_FILES= \ ldbmodify.o PRIVATE_DEPENDENCIES = \ LIBLDB_CMDLINE -MANPAGE = ../man/ldbmodify.1 # End BINARY ldbmodify ################################################ +MANPAGES += $(ldbdir)/../man/ldbmodify.1 + ################################################ # Start BINARY ldbsearch [BINARY::ldbsearch] @@ -53,10 +56,11 @@ OBJ_FILES= \ ldbsearch.o PRIVATE_DEPENDENCIES = \ LIBLDB_CMDLINE -MANPAGE = ../man/ldbsearch.1 # End BINARY ldbsearch ################################################ +MANPAGES += $(ldbdir)/../man/ldbsearch.1 + ################################################ # Start BINARY ldbedit [BINARY::ldbedit] @@ -65,10 +69,11 @@ OBJ_FILES= \ ldbedit.o PRIVATE_DEPENDENCIES = \ LIBLDB_CMDLINE -MANPAGE = ../man/ldbedit.1 # End BINARY ldbedit ################################################ +MANPAGES += $(ldbdir)/../man/ldbedit.1 + ################################################ # Start BINARY ldbrename [BINARY::ldbrename] @@ -77,8 +82,9 @@ OBJ_FILES= \ ldbrename.o PRIVATE_DEPENDENCIES = \ LIBLDB_CMDLINE -MANPAGE = ../man/ldbrename.1 # End BINARY ldbrename ################################################ +MANPAGES += $(ldbdir)/../man/ldbrename.1 + diff --git a/source4/lib/registry/config.mk b/source4/lib/registry/config.mk index 7a9c8fcff1..af5b1bc301 100644 --- a/source4/lib/registry/config.mk +++ b/source4/lib/registry/config.mk @@ -52,10 +52,11 @@ INSTALLDIR = BINDIR OBJ_FILES = tools/regdiff.o PRIVATE_DEPENDENCIES = \ LIBSAMBA-CONFIG registry LIBPOPT POPT_SAMBA POPT_CREDENTIALS -MANPAGE = man/regdiff.1 # End BINARY regdiff ################################################ +MANPAGES += lib/registry/man/regdiff.1 + ################################################ # Start BINARY regpatch [BINARY::regpatch] @@ -64,10 +65,11 @@ OBJ_FILES = tools/regpatch.o PRIVATE_DEPENDENCIES = \ LIBSAMBA-CONFIG registry LIBPOPT POPT_SAMBA POPT_CREDENTIALS \ registry_common -MANPAGE = man/regpatch.1 # End BINARY regpatch ################################################ +MANPAGES += lib/registry/man/regpatch.1 + ################################################ # Start BINARY regshell [BINARY::regshell] @@ -76,10 +78,11 @@ OBJ_FILES = tools/regshell.o PRIVATE_DEPENDENCIES = \ LIBSAMBA-CONFIG LIBPOPT registry POPT_SAMBA POPT_CREDENTIALS \ SMBREADLINE registry_common -MANPAGE = man/regshell.1 # End BINARY regshell ################################################ +MANPAGES += lib/registry/man/regshell.1 + ################################################ # Start BINARY regtree [BINARY::regtree] @@ -88,10 +91,11 @@ OBJ_FILES = tools/regtree.o PRIVATE_DEPENDENCIES = \ LIBSAMBA-CONFIG LIBPOPT registry POPT_SAMBA POPT_CREDENTIALS \ registry_common -MANPAGE = man/regtree.1 # End BINARY regtree ################################################ +MANPAGES += lib/registry/man/regtree.1 + [SUBSYSTEM::torture_registry] PRIVATE_DEPENDENCIES = registry PRIVATE_PROTO_HEADER = tests/proto.h diff --git a/source4/lib/talloc/config.mk b/source4/lib/talloc/config.mk index af1b590c98..abbad2e613 100644 --- a/source4/lib/talloc/config.mk +++ b/source4/lib/talloc/config.mk @@ -1,6 +1,8 @@ [LIBRARY::LIBTALLOC] OUTPUT_TYPE = STATIC_LIBRARY OBJ_FILES = talloc.o -MANPAGE = talloc.3 CFLAGS = -Ilib/talloc PUBLIC_HEADERS = talloc.h + + +MANPAGES += $(tallocdir)/talloc.3 -- cgit From bfc99f15a1e2407cd5aaa938b97ddaa547660cfc Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 26 Feb 2008 15:19:45 +0100 Subject: Fix manpage paths. (This used to be commit f7d0f0582e8712fd8d005906803de8fe041e875f) --- source4/lib/ldb/tools/config.mk | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/tools/config.mk b/source4/lib/ldb/tools/config.mk index c1c368f336..02ad84ae25 100644 --- a/source4/lib/ldb/tools/config.mk +++ b/source4/lib/ldb/tools/config.mk @@ -20,7 +20,7 @@ PRIVATE_DEPENDENCIES = \ # End BINARY ldbadd ################################################ -MANPAGES += $(ldbdir)/../man/ldbadd.1 +MANPAGES += $(ldbdir)/man/ldbadd.1 ################################################ # Start BINARY ldbdel @@ -33,7 +33,7 @@ PRIVATE_DEPENDENCIES = \ # End BINARY ldbdel ################################################ -MANPAGES += $(ldbdir)/../man/ldbdel.1 +MANPAGES += $(ldbdir)/man/ldbdel.1 ################################################ # Start BINARY ldbmodify @@ -46,7 +46,7 @@ PRIVATE_DEPENDENCIES = \ # End BINARY ldbmodify ################################################ -MANPAGES += $(ldbdir)/../man/ldbmodify.1 +MANPAGES += $(ldbdir)/man/ldbmodify.1 ################################################ # Start BINARY ldbsearch @@ -59,7 +59,7 @@ PRIVATE_DEPENDENCIES = \ # End BINARY ldbsearch ################################################ -MANPAGES += $(ldbdir)/../man/ldbsearch.1 +MANPAGES += $(ldbdir)/man/ldbsearch.1 ################################################ # Start BINARY ldbedit @@ -72,7 +72,7 @@ PRIVATE_DEPENDENCIES = \ # End BINARY ldbedit ################################################ -MANPAGES += $(ldbdir)/../man/ldbedit.1 +MANPAGES += $(ldbdir)/man/ldbedit.1 ################################################ # Start BINARY ldbrename @@ -85,6 +85,6 @@ PRIVATE_DEPENDENCIES = \ # End BINARY ldbrename ################################################ -MANPAGES += $(ldbdir)/../man/ldbrename.1 +MANPAGES += $(ldbdir)/man/ldbrename.1 -- cgit From c5d77a1c2414d930ccbedbe05e124df69242a144 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 26 Feb 2008 17:17:52 +0100 Subject: Move public header accumulation out of the perl code. (This used to be commit 89f7c74924965071981bbe7e05ff69847b0a3a03) --- source4/lib/basic.mk | 12 +++++++++--- source4/lib/charset/config.mk | 4 +++- source4/lib/cmdline/config.mk | 3 ++- source4/lib/events/config.mk | 3 ++- source4/lib/ldb/config.mk | 3 ++- source4/lib/nss_wrapper/config.mk | 3 ++- source4/lib/registry/config.mk | 3 ++- source4/lib/socket_wrapper/config.mk | 3 ++- source4/lib/talloc/config.mk | 2 +- source4/lib/tdb/config.mk | 3 ++- source4/lib/tdr/config.mk | 3 ++- source4/lib/util/config.mk | 22 ++++++++++++---------- 12 files changed, 41 insertions(+), 23 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/basic.mk b/source4/lib/basic.mk index a118636c52..d059bdf49b 100644 --- a/source4/lib/basic.mk +++ b/source4/lib/basic.mk @@ -22,17 +22,23 @@ mkinclude crypto/config.mk OBJ_FILES = compression/mszip.o [SUBSYSTEM::GENCACHE] -PUBLIC_HEADERS = gencache/gencache.h OBJ_FILES = gencache/gencache.o PRIVATE_DEPENDENCIES = TDB_WRAP + +PUBLIC_HEADERS += lib/gencache/gencache.h + [SUBSYSTEM::LDB_WRAP] -PUBLIC_HEADERS = ldb_wrap.h OBJ_FILES = ldb_wrap.o PUBLIC_DEPENDENCIES = LIBLDB PRIVATE_DEPENDENCIES = LDBSAMBA UTIL_LDB + +PUBLIC_HEADERS += lib/ldb_wrap.h + [SUBSYSTEM::TDB_WRAP] -PUBLIC_HEADERS = tdb_wrap.h OBJ_FILES = tdb_wrap.o PUBLIC_DEPENDENCIES = LIBTDB + + +PUBLIC_HEADERS += lib/tdb_wrap.h diff --git a/source4/lib/charset/config.mk b/source4/lib/charset/config.mk index 2dd5b05c94..2766784c52 100644 --- a/source4/lib/charset/config.mk +++ b/source4/lib/charset/config.mk @@ -5,9 +5,11 @@ OBJ_FILES = \ iconv.o \ charcnv.o \ util_unistr.o -PUBLIC_HEADERS = charset.h PRIVATE_PROTO_HEADER = charset_proto.h PUBLIC_DEPENDENCIES = ICONV PRIVATE_DEPENDENCIES = DYNCONFIG # End SUBSYSTEM CHARSET ################################################ + + +PUBLIC_HEADERS += lib/charset/charset.h diff --git a/source4/lib/cmdline/config.mk b/source4/lib/cmdline/config.mk index a1f876d56a..87014d4d53 100644 --- a/source4/lib/cmdline/config.mk +++ b/source4/lib/cmdline/config.mk @@ -4,10 +4,11 @@ OBJ_FILES = credentials.o PUBLIC_DEPENDENCIES = CREDENTIALS LIBPOPT [SUBSYSTEM::POPT_SAMBA] -PUBLIC_HEADERS = popt_common.h OBJ_FILES = popt_common.o PUBLIC_DEPENDENCIES = LIBPOPT +PUBLIC_HEADERS += lib/cmdline/popt_common.h + [SUBSYSTEM::POPT_CREDENTIALS] PRIVATE_PROTO_HEADER = popt_credentials.h OBJ_FILES = popt_credentials.o diff --git a/source4/lib/events/config.mk b/source4/lib/events/config.mk index 910cf3738f..225a23c634 100644 --- a/source4/lib/events/config.mk +++ b/source4/lib/events/config.mk @@ -32,11 +32,12 @@ INIT_FUNCTION = s4_events_standard_init # Start SUBSYSTEM LIBEVENTS [SUBSYSTEM::LIBEVENTS] OBJ_FILES = events.o events_timed.o events_signal.o -PUBLIC_HEADERS = events.h events_internal.h PUBLIC_DEPENDENCIES = LIBTALLOC LIBSAMBA-UTIL # End SUBSYSTEM LIBEVENTS ############################## +PUBLIC_HEADERS += $(addprefix lib/events/, events.h events_internal.h) + [PYTHON::swig_events] SWIG_FILE = events.i PRIVATE_DEPENDENCIES = LIBEVENTS diff --git a/source4/lib/ldb/config.mk b/source4/lib/ldb/config.mk index ad202fb34e..68c3d21fc9 100644 --- a/source4/lib/ldb/config.mk +++ b/source4/lib/ldb/config.mk @@ -147,11 +147,12 @@ PUBLIC_DEPENDENCIES = \ LIBTALLOC PRIVATE_DEPENDENCIES = \ SOCKET_WRAPPER -PUBLIC_HEADERS = include/ldb.h include/ldb_errors.h # # End SUBSYSTEM ldb ################################################ +PUBLIC_HEADERS += $(ldbdir)/include/ldb.h $(ldbdir)/include/ldb_errors.h + MANPAGES += $(ldbdir)/man/ldb.3 ################################################ diff --git a/source4/lib/nss_wrapper/config.mk b/source4/lib/nss_wrapper/config.mk index b46f7c3ee7..81b0ef36fd 100644 --- a/source4/lib/nss_wrapper/config.mk +++ b/source4/lib/nss_wrapper/config.mk @@ -1,7 +1,8 @@ ############################## # Start SUBSYSTEM NSS_WRAPPER [SUBSYSTEM::NSS_WRAPPER] -PUBLIC_HEADERS = nss_wrapper.h OBJ_FILES = nss_wrapper.o # End SUBSYSTEM NSS_WRAPPER ############################## + +PUBLIC_HEADERS += lib/nss_wrapper/nss_wrapper.h diff --git a/source4/lib/registry/config.mk b/source4/lib/registry/config.mk index af5b1bc301..b2d7ce202e 100644 --- a/source4/lib/registry/config.mk +++ b/source4/lib/registry/config.mk @@ -36,10 +36,11 @@ OBJ_FILES = \ PUBLIC_DEPENDENCIES = \ LIBSAMBA-UTIL CHARSET TDR_REGF LIBLDB \ RPC_NDR_WINREG LDB_WRAP -PUBLIC_HEADERS = registry.h hive.h patchfile.h # End MODULE registry_ldb ################################################ +PUBLIC_HEADERS += $(addprefix lib/registry/, registry.h hive.h patchfile.h) + [SUBSYSTEM::registry_common] PUBLIC_DEPENDENCIES = registry OBJ_FILES = tools/common.o diff --git a/source4/lib/socket_wrapper/config.mk b/source4/lib/socket_wrapper/config.mk index 4c5cf94348..cc52a99801 100644 --- a/source4/lib/socket_wrapper/config.mk +++ b/source4/lib/socket_wrapper/config.mk @@ -1,8 +1,9 @@ ############################## # Start SUBSYSTEM SOCKET_WRAPPER [SUBSYSTEM::SOCKET_WRAPPER] -PUBLIC_HEADERS = socket_wrapper.h OBJ_FILES = socket_wrapper.o PRIVATE_DEPENDENCIES = EXT_SOCKET # End SUBSYSTEM SOCKET_WRAPPER ############################## + +PUBLIC_HEADERS += lib/socket_wrapper/socket_wrapper.h diff --git a/source4/lib/talloc/config.mk b/source4/lib/talloc/config.mk index abbad2e613..33241ffac7 100644 --- a/source4/lib/talloc/config.mk +++ b/source4/lib/talloc/config.mk @@ -2,7 +2,7 @@ OUTPUT_TYPE = STATIC_LIBRARY OBJ_FILES = talloc.o CFLAGS = -Ilib/talloc -PUBLIC_HEADERS = talloc.h MANPAGES += $(tallocdir)/talloc.3 +PUBLIC_HEADERS += $(tallocdir)/talloc.h diff --git a/source4/lib/tdb/config.mk b/source4/lib/tdb/config.mk index 89d6af9043..c69804fa13 100644 --- a/source4/lib/tdb/config.mk +++ b/source4/lib/tdb/config.mk @@ -7,11 +7,12 @@ OBJ_FILES = \ common/open.o common/traverse.o common/freelist.o \ common/error.o common/transaction.o CFLAGS = -Ilib/tdb/include -PUBLIC_HEADERS = include/tdb.h # # End SUBSYSTEM ldb ################################################ +PUBLIC_HEADERS += $(tdbdir)/include/tdb.h + ################################################ # Start BINARY tdbtool [BINARY::tdbtool] diff --git a/source4/lib/tdr/config.mk b/source4/lib/tdr/config.mk index 2d6c30ea50..eb3cde9bdf 100644 --- a/source4/lib/tdr/config.mk +++ b/source4/lib/tdr/config.mk @@ -1,6 +1,7 @@ [SUBSYSTEM::TDR] CFLAGS = -Ilib/tdr -PUBLIC_HEADERS = tdr.h PRIVATE_PROTO_HEADER = tdr_proto.h PUBLIC_DEPENDENCIES = LIBTALLOC LIBSAMBA-UTIL OBJ_FILES = tdr.o + +PUBLIC_HEADERS += lib/tdr/tdr.h diff --git a/source4/lib/util/config.mk b/source4/lib/util/config.mk index 6a19515708..16a0357df8 100644 --- a/source4/lib/util/config.mk +++ b/source4/lib/util/config.mk @@ -1,15 +1,6 @@ [SUBSYSTEM::LIBSAMBA-UTIL] #VERSION = 0.0.1 #SO_VERSION = 0 -PUBLIC_HEADERS = util.h \ - attr.h \ - byteorder.h \ - data_blob.h \ - debug.h \ - mutex.h \ - safe_string.h \ - time.h \ - xfile.h OBJ_FILES = xfile.o \ debug.o \ fault.o \ @@ -33,11 +24,22 @@ PUBLIC_DEPENDENCIES = \ SOCKET_WRAPPER EXT_NSL \ CHARSET EXECINFO +PUBLIC_HEADERS += $(addprefix lib/util/, util.h \ + attr.h \ + byteorder.h \ + data_blob.h \ + debug.h \ + mutex.h \ + safe_string.h \ + time.h \ + xfile.h) + [SUBSYSTEM::ASN1_UTIL] PRIVATE_PROTO_HEADER = asn1_proto.h -PUBLIC_HEADERS = asn1.h OBJ_FILES = asn1.o +PUBLIC_HEADERS += lib/util/asn1.h + [SUBSYSTEM::UNIX_PRIVS] PRIVATE_PROTO_HEADER = unix_privs.h OBJ_FILES = unix_privs.o -- cgit From b29d47edcf2767d7f9e9f63332079c6e8e89946c Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 3 Mar 2008 18:25:28 +0100 Subject: Move object file lists to the Makefile. (This used to be commit a7e6d2a1832db388fdafa1279f84c9a8bbfc87d6) --- source4/lib/appweb/config.mk | 16 +++----- source4/lib/basic.mk | 11 +++-- source4/lib/charset/config.mk | 5 +-- source4/lib/cmdline/config.mk | 9 +++-- source4/lib/crypto/config.mk | 21 ++++------ source4/lib/dbwrap/config.mk | 6 +-- source4/lib/events/config.mk | 14 ++++--- source4/lib/ldb-samba/config.mk | 3 +- source4/lib/ldb/config.mk | 78 ++++++++++++++---------------------- source4/lib/ldb/ldb_ildap/config.mk | 3 +- source4/lib/ldb/tools/config.mk | 28 ++++++------- source4/lib/messaging/config.mk | 5 ++- source4/lib/nss_wrapper/config.mk | 2 +- source4/lib/policy/config.mk | 6 ++- source4/lib/popt/config.mk | 8 ++-- source4/lib/registry/config.mk | 42 +++++++++---------- source4/lib/samba3/config.mk | 3 +- source4/lib/socket/config.mk | 21 +++++----- source4/lib/socket_wrapper/config.mk | 3 +- source4/lib/stream/config.mk | 8 +--- source4/lib/talloc/config.mk | 2 +- source4/lib/tdb/config.mk | 25 ++++++------ source4/lib/tdr/config.mk | 3 +- source4/lib/tls/config.mk | 8 +--- source4/lib/util/config.mk | 32 ++++++++------- 25 files changed, 162 insertions(+), 200 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/appweb/config.mk b/source4/lib/appweb/config.mk index df0f81dccb..c0bba35ba5 100644 --- a/source4/lib/appweb/config.mk +++ b/source4/lib/appweb/config.mk @@ -1,31 +1,25 @@ ####################### # Start SUBSYSTEM MPR [SUBSYSTEM::MPR] -OBJ_FILES = \ - mpr/miniMpr.o \ - mpr/var.o # End SUBSYSTEM MPR ####################### +MPR_OBJ_FILES = $(addprefix lib/appweb/mpr/, miniMpr.o var.o) ####################### # Start SUBSYSTEM EJS [SUBSYSTEM::EJS] -OBJ_FILES = \ - ejs/ejsLib.o \ - ejs/ejsLex.o \ - ejs/ejsParser.o \ - ejs/ejsProcs.o PUBLIC_DEPENDENCIES = MPR # End SUBSYSTEM EJS ####################### +EJS_OBJ_FILES = $(addprefix lib/appweb/ejs/, ejsLib.o ejsLex.o ejsParser.o ejsProcs.o) + ####################### # Start SUBSYSTEM ESP [SUBSYSTEM::ESP] -OBJ_FILES = \ - esp/esp.o \ - esp/espProcs.o PUBLIC_DEPENDENCIES = EJS # End SUBSYSTEM ESP ####################### + +ESP_OBJ_FILES = $(addprefix lib/appweb/esp/, esp.o espProcs.o) diff --git a/source4/lib/basic.mk b/source4/lib/basic.mk index d059bdf49b..f6a8731a21 100644 --- a/source4/lib/basic.mk +++ b/source4/lib/basic.mk @@ -19,26 +19,25 @@ mkinclude dbwrap/config.mk mkinclude crypto/config.mk [SUBSYSTEM::LIBCOMPRESSION] -OBJ_FILES = compression/mszip.o + +LIBCOMPRESSION_OBJ_FILES = lib/compression/mszip.o [SUBSYSTEM::GENCACHE] -OBJ_FILES = gencache/gencache.o PRIVATE_DEPENDENCIES = TDB_WRAP +GENCACHE_OBJ_FILES = gencache/gencache.o PUBLIC_HEADERS += lib/gencache/gencache.h [SUBSYSTEM::LDB_WRAP] -OBJ_FILES = ldb_wrap.o PUBLIC_DEPENDENCIES = LIBLDB PRIVATE_DEPENDENCIES = LDBSAMBA UTIL_LDB - +LDB_WRAP_OBJ_FILES = lib/ldb_wrap.o PUBLIC_HEADERS += lib/ldb_wrap.h [SUBSYSTEM::TDB_WRAP] -OBJ_FILES = tdb_wrap.o PUBLIC_DEPENDENCIES = LIBTDB - +TDB_WRAP_OBJ_FILES = lib/tdb_wrap.o PUBLIC_HEADERS += lib/tdb_wrap.h diff --git a/source4/lib/charset/config.mk b/source4/lib/charset/config.mk index 2766784c52..e5e5bd4560 100644 --- a/source4/lib/charset/config.mk +++ b/source4/lib/charset/config.mk @@ -1,15 +1,12 @@ ################################################ # Start SUBSYSTEM CHARSET [SUBSYSTEM::CHARSET] -OBJ_FILES = \ - iconv.o \ - charcnv.o \ - util_unistr.o PRIVATE_PROTO_HEADER = charset_proto.h PUBLIC_DEPENDENCIES = ICONV PRIVATE_DEPENDENCIES = DYNCONFIG # End SUBSYSTEM CHARSET ################################################ +CHARSET_OBJ_FILES = $(addprefix lib/charset/, iconv.o charcnv.o util_unistr.o) PUBLIC_HEADERS += lib/charset/charset.h diff --git a/source4/lib/cmdline/config.mk b/source4/lib/cmdline/config.mk index 87014d4d53..f8a971a063 100644 --- a/source4/lib/cmdline/config.mk +++ b/source4/lib/cmdline/config.mk @@ -1,16 +1,19 @@ [SUBSYSTEM::LIBCMDLINE_CREDENTIALS] PRIVATE_PROTO_HEADER = credentials.h -OBJ_FILES = credentials.o PUBLIC_DEPENDENCIES = CREDENTIALS LIBPOPT +LIBCMDLINE_CREDENTIALS_OBJ_FILES = lib/cmdline/credentials.o + [SUBSYSTEM::POPT_SAMBA] -OBJ_FILES = popt_common.o PUBLIC_DEPENDENCIES = LIBPOPT +POPT_SAMBA_OBJ_FILES = lib/cmdline/popt_common.o + PUBLIC_HEADERS += lib/cmdline/popt_common.h [SUBSYSTEM::POPT_CREDENTIALS] PRIVATE_PROTO_HEADER = popt_credentials.h -OBJ_FILES = popt_credentials.o PUBLIC_DEPENDENCIES = CREDENTIALS LIBCMDLINE_CREDENTIALS LIBPOPT PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL + +POPT_CREDENTIALS_OBJ_FILES = lib/cmdline/popt_credentials.o diff --git a/source4/lib/crypto/config.mk b/source4/lib/crypto/config.mk index f7a8d20604..82dbe4a4cb 100644 --- a/source4/lib/crypto/config.mk +++ b/source4/lib/crypto/config.mk @@ -1,26 +1,19 @@ ############################## # Start SUBSYSTEM LIBCRYPTO [SUBSYSTEM::LIBCRYPTO] -OBJ_FILES = \ - crc32.o \ - md5.o \ - hmacmd5.o \ - md4.o \ - arcfour.o \ - sha1.o \ - hmacsha1.o # End SUBSYSTEM LIBCRYPTO ############################## +LIBCRYPTO_OBJ_FILES = $(addprefix lib/crypto/, \ + crc32.o md5.o hmacmd5.o md4.o \ + arcfour.o sha1.o hmacsha1.o) + + [MODULE::TORTURE_LIBCRYPTO] -OBJ_FILES = \ - md4test.o \ - md5test.o \ - hmacmd5test.o \ - sha1test.o \ - hmacsha1test.o SUBSYSTEM = torture PRIVATE_DEPENDENCIES = LIBCRYPTO PRIVATE_PROTO_HEADER = test_proto.h +TORTURE_LIBCRYPTO_OBJ_FILES = $(addprefix lib/crypto/, \ + md4test.o md5test.o hmacmd5test.o sha1test.o hmacsha1test.o) diff --git a/source4/lib/dbwrap/config.mk b/source4/lib/dbwrap/config.mk index 01ce4ddd8e..9038873d32 100644 --- a/source4/lib/dbwrap/config.mk +++ b/source4/lib/dbwrap/config.mk @@ -1,6 +1,6 @@ [SUBSYSTEM::LIBDBWRAP] -OBJ_FILES = dbwrap.o \ - dbwrap_tdb.o \ - dbwrap_ctdb.o PUBLIC_DEPENDENCIES = \ LIBTDB ctdb + +LIBDBWRAP_OBJ_FILES = $(addprefix lib/dbwrap/, dbwrap.o dbwrap_tdb.o dbwrap_ctdb.o) + diff --git a/source4/lib/events/config.mk b/source4/lib/events/config.mk index 225a23c634..ba06c2f673 100644 --- a/source4/lib/events/config.mk +++ b/source4/lib/events/config.mk @@ -1,41 +1,45 @@ ############################## [MODULE::EVENTS_AIO] -OBJ_FILES = events_aio.o PRIVATE_DEPENDENCIES = LIBAIO_LINUX SUBSYSTEM = LIBEVENTS INIT_FUNCTION = s4_events_aio_init ############################## +EVENTS_AIO_OBJ_FILES = lib/events/events_aio.o + ############################## [MODULE::EVENTS_EPOLL] -OBJ_FILES = events_epoll.o SUBSYSTEM = LIBEVENTS INIT_FUNCTION = s4_events_epoll_init ############################## +EVENTS_EPOLL_OBJ_FILES = lib/events/events_epoll.o + ############################## [MODULE::EVENTS_SELECT] -OBJ_FILES = events_select.o SUBSYSTEM = LIBEVENTS INIT_FUNCTION = s4_events_select_init ############################## +EVENTS_SELECT_OBJ_FILES = lib/events/events_select.o + ############################## [MODULE::EVENTS_STANDARD] -OBJ_FILES = events_standard.o SUBSYSTEM = LIBEVENTS INIT_FUNCTION = s4_events_standard_init ############################## +EVENTS_STANDARD_OBJ_FILES = lib/events/events_standard.o ############################## # Start SUBSYSTEM LIBEVENTS [SUBSYSTEM::LIBEVENTS] -OBJ_FILES = events.o events_timed.o events_signal.o PUBLIC_DEPENDENCIES = LIBTALLOC LIBSAMBA-UTIL # End SUBSYSTEM LIBEVENTS ############################## +LIBEVENTS_OBJ_FILES = $(addprefix lib/events/, events.o events_timed.o events_signal.o) + PUBLIC_HEADERS += $(addprefix lib/events/, events.h events_internal.h) [PYTHON::swig_events] diff --git a/source4/lib/ldb-samba/config.mk b/source4/lib/ldb-samba/config.mk index fa3ac46021..6a0b842fff 100644 --- a/source4/lib/ldb-samba/config.mk +++ b/source4/lib/ldb-samba/config.mk @@ -4,9 +4,8 @@ PUBLIC_DEPENDENCIES = LIBLDB PRIVATE_PROTO_HEADER = ldif_handlers.h PRIVATE_DEPENDENCIES = LIBSECURITY SAMDB_SCHEMA LIBNDR NDR_MISC -OBJ_FILES = \ - ldif_handlers.o # End SUBSYSTEM LDBSAMBA ################################################ +LDBSAMBA_OBJ_FILES = lib/ldb-samba/ldif_handlers.o diff --git a/source4/lib/ldb/config.mk b/source4/lib/ldb/config.mk index 68c3d21fc9..c33d930ee3 100644 --- a/source4/lib/ldb/config.mk +++ b/source4/lib/ldb/config.mk @@ -5,8 +5,8 @@ PRIVATE_DEPENDENCIES = LIBTALLOC CFLAGS = -Ilib/ldb/include INIT_FUNCTION = LDB_MODULE(asq) SUBSYSTEM = LIBLDB -OBJ_FILES = \ - modules/asq.o + +LDB_ASQ_OBJ_FILES = lib/ldb/modules/asq.o # End MODULE ldb_asq ################################################ @@ -17,10 +17,10 @@ PRIVATE_DEPENDENCIES = LIBTALLOC CFLAGS = -Ilib/ldb/include INIT_FUNCTION = LDB_MODULE(server_sort) SUBSYSTEM = LIBLDB -OBJ_FILES = \ - modules/sort.o + # End MODULE ldb_sort ################################################ +ldb_server_sort_OBJ_FILES = lib/ldb/modules/sort.o ################################################ # Start MODULE ldb_paged_results @@ -29,11 +29,11 @@ INIT_FUNCTION = LDB_MODULE(paged_results) CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC SUBSYSTEM = LIBLDB -OBJ_FILES = \ - modules/paged_results.o # End MODULE ldb_paged_results ################################################ +ldb_pages_results_OBJ_FILES = lib/ldb/modules/paged_results.o + ################################################ # Start MODULE ldb_paged_results [MODULE::ldb_paged_searches] @@ -41,11 +41,11 @@ INIT_FUNCTION = LDB_MODULE(paged_searches) CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC SUBSYSTEM = LIBLDB -OBJ_FILES = \ - modules/paged_searches.o # End MODULE ldb_paged_results ################################################ +ldb_paged_searches_OBJ_FILES = lib/ldb/modules/paged_searches.o + ################################################ # Start MODULE ldb_operational [MODULE::ldb_operational] @@ -53,11 +53,11 @@ SUBSYSTEM = LIBLDB CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC INIT_FUNCTION = LDB_MODULE(operational) -OBJ_FILES = \ - modules/operational.o # End MODULE ldb_operational ################################################ +ldb_operational_OBJ_FILES = lib/ldb/modules/operational.o + ################################################ # Start MODULE ldb_rdn_name [MODULE::ldb_rdn_name] @@ -65,23 +65,21 @@ SUBSYSTEM = LIBLDB CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC INIT_FUNCTION = LDB_MODULE(rdn_name) -OBJ_FILES = \ - modules/rdn_name.o # End MODULE ldb_rdn_name ################################################ +ldb_rdn_name_OBJ_FILES = lib/ldb/modules/rdn_name.o + ################################################ # Start MODULE ldb_map [SUBSYSTEM::ldb_map] PRIVATE_DEPENDENCIES = LIBTALLOC CFLAGS = -Ilib/ldb/include -Ilib/ldb/ldb_map -OBJ_FILES = \ - ldb_map/ldb_map_inbound.o \ - ldb_map/ldb_map_outbound.o \ - ldb_map/ldb_map.o # End MODULE ldb_map ################################################ +ldb_map_OBJ_FILES = $(addprefix lib/ldb/ldb_map/, ldb_map_inbound.o ldb_map_outbound.o ldb_map.o) + ################################################ # Start MODULE ldb_skel [MODULE::ldb_skel] @@ -89,38 +87,35 @@ SUBSYSTEM = LIBLDB CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC INIT_FUNCTION = LDB_MODULE(skel) -OBJ_FILES = modules/skel.o # End MODULE ldb_skel ################################################ +ldb_skel_OBJ_FILES = lib/ldb/modules/skel.o + ################################################ # Start MODULE ldb_sqlite3 [MODULE::ldb_sqlite3] SUBSYSTEM = LIBLDB CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC SQLITE3 LIBTALLOC -OBJ_FILES = \ - ldb_sqlite3/ldb_sqlite3.o # End MODULE ldb_sqlite3 ################################################ +ldb_sqlite3_OBJ_FILES = lib/ldb/ldb_sqlite3/ldb_sqlite3.o + ################################################ # Start MODULE ldb_tdb [MODULE::ldb_tdb] SUBSYSTEM = LIBLDB CFLAGS = -Ilib/ldb/include -Ilib/ldb/ldb_tdb -OBJ_FILES = \ - ldb_tdb/ldb_tdb.o \ - ldb_tdb/ldb_search.o \ - ldb_tdb/ldb_pack.o \ - ldb_tdb/ldb_index.o \ - ldb_tdb/ldb_cache.o \ - ldb_tdb/ldb_tdb_wrap.o PRIVATE_DEPENDENCIES = \ LIBTDB LIBTALLOC # End MODULE ldb_tdb ################################################ +ldb_tdb_OBJ_FILES = $(addprefix lib/ldb/ldb_tdb/, ldb_tdb.o ldb_search.o ldb_pack.o ldb_index.o ldb_cache.o ldb_tdb_wrap.o) + + ################################################ # Start SUBSYSTEM ldb [LIBRARY::LIBLDB] @@ -129,20 +124,6 @@ SO_VERSION = 0 CFLAGS = -Ilib/ldb/include PC_FILE = ldb.pc INIT_FUNCTION_TYPE = extern const struct ldb_module_ops -OBJ_FILES = \ - common/ldb.o \ - common/ldb_ldif.o \ - common/ldb_parse.o \ - common/ldb_msg.o \ - common/ldb_utf8.o \ - common/ldb_debug.o \ - common/ldb_modules.o \ - common/ldb_match.o \ - common/ldb_attributes.o \ - common/attrib_handlers.o \ - common/ldb_dn.o \ - common/ldb_controls.o \ - common/qsort.o PUBLIC_DEPENDENCIES = \ LIBTALLOC PRIVATE_DEPENDENCIES = \ @@ -151,6 +132,8 @@ PRIVATE_DEPENDENCIES = \ # End SUBSYSTEM ldb ################################################ +LIBLDB_OBJ_FILES = $(addprefix lib/ldb/common/, ldb.o ldb_ldif.o ldb_parse.o ldb_msg.o ldb_utf8.o ldb_debug.o ldb_modules.o ldb_match.o ldb_attributes.o attrib_handlers.o ldb_dn.o ldb_controls.o qsort.o) + PUBLIC_HEADERS += $(ldbdir)/include/ldb.h $(ldbdir)/include/ldb_errors.h MANPAGES += $(ldbdir)/man/ldb.3 @@ -158,39 +141,38 @@ MANPAGES += $(ldbdir)/man/ldb.3 ################################################ # Start BINARY ldbtest [BINARY::ldbtest] -OBJ_FILES= \ - tools/ldbtest.o PRIVATE_DEPENDENCIES = \ LIBLDB_CMDLINE # End BINARY ldbtest ################################################ +ldbtest_OBJ_FILES = lib/ldb/tools/ldbtest.o + ################################################ # Start BINARY oLschema2ldif [BINARY::oLschema2ldif] INSTALLDIR = BINDIR -OBJ_FILES= \ - tools/convert.o \ - tools/oLschema2ldif.o PRIVATE_DEPENDENCIES = \ LIBLDB_CMDLINE # End BINARY oLschema2ldif ################################################ + +oLschema2ldif_OBJ_FILES = $(addprefix lib/ldb/tools/, convert.o oLschema2ldif.o) + MANPAGES += $(ldbdir)/man/oLschema2ldif.1 ################################################ # Start BINARY ad2oLschema [BINARY::ad2oLschema] INSTALLDIR = BINDIR -OBJ_FILES= \ - tools/convert.o \ - tools/ad2oLschema.o PRIVATE_DEPENDENCIES = \ LIBLDB_CMDLINE # End BINARY ad2oLschema ################################################ +ad2oLschema_OBJ_FILES = $(addprefix lib/ldb/tools/, convert.o ad2oLschema.o) + MANPAGES += $(ldbdir)/man/ad2oLschema.1 mkinclude tools/config.mk diff --git a/source4/lib/ldb/ldb_ildap/config.mk b/source4/lib/ldb/ldb_ildap/config.mk index 3062dc886f..1b534645b6 100644 --- a/source4/lib/ldb/ldb_ildap/config.mk +++ b/source4/lib/ldb/ldb_ildap/config.mk @@ -6,9 +6,8 @@ CFLAGS = -Ilib/ldb/include OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = LIBTALLOC LIBCLI_LDAP CREDENTIALS ALIASES = ldapi ldaps ldap -OBJ_FILES = \ - ldb_ildap.o # End MODULE ldb_ildap ################################################ +ldb_ildap_OBJ_FILES = lib/ldb/ldb_ildap/ldb_ildap.o diff --git a/source4/lib/ldb/tools/config.mk b/source4/lib/ldb/tools/config.mk index 02ad84ae25..6729636434 100644 --- a/source4/lib/ldb/tools/config.mk +++ b/source4/lib/ldb/tools/config.mk @@ -2,89 +2,89 @@ # Start SUBSYSTEM LIBLDB_CMDLINE [SUBSYSTEM::LIBLDB_CMDLINE] CFLAGS = -Ilib/ldb -Ilib/ldb/include -OBJ_FILES= \ - cmdline.o PUBLIC_DEPENDENCIES = LIBLDB LIBPOPT PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL POPT_SAMBA POPT_CREDENTIALS gensec # End SUBSYSTEM LIBLDB_CMDLINE ################################################ +LIBLDB_CMDLINE_OBJ_FILES = lib/ldb/tools/cmdline.o + ################################################ # Start BINARY ldbadd [BINARY::ldbadd] INSTALLDIR = BINDIR -OBJ_FILES = \ - ldbadd.o PRIVATE_DEPENDENCIES = \ LIBLDB_CMDLINE LIBCLI_RESOLVE # End BINARY ldbadd ################################################ + +ldbadd_OBJ_FILES = lib/ldb/tools/ldbadd.o + MANPAGES += $(ldbdir)/man/ldbadd.1 ################################################ # Start BINARY ldbdel [BINARY::ldbdel] INSTALLDIR = BINDIR -OBJ_FILES= \ - ldbdel.o PRIVATE_DEPENDENCIES = \ LIBLDB_CMDLINE # End BINARY ldbdel ################################################ +ldbdel_OBJ_FILES = lib/ldb/tools/ldbdel.o + MANPAGES += $(ldbdir)/man/ldbdel.1 ################################################ # Start BINARY ldbmodify [BINARY::ldbmodify] INSTALLDIR = BINDIR -OBJ_FILES= \ - ldbmodify.o PRIVATE_DEPENDENCIES = \ LIBLDB_CMDLINE # End BINARY ldbmodify ################################################ +ldbmodify_OBJ_FILES = lib/ldb/tools/ldbmodify.o MANPAGES += $(ldbdir)/man/ldbmodify.1 ################################################ # Start BINARY ldbsearch [BINARY::ldbsearch] INSTALLDIR = BINDIR -OBJ_FILES= \ - ldbsearch.o PRIVATE_DEPENDENCIES = \ LIBLDB_CMDLINE # End BINARY ldbsearch ################################################ +ldbsearch_OBJ_FILES = lib/ldb/tools/ldbsearch.o + MANPAGES += $(ldbdir)/man/ldbsearch.1 ################################################ # Start BINARY ldbedit [BINARY::ldbedit] INSTALLDIR = BINDIR -OBJ_FILES= \ - ldbedit.o PRIVATE_DEPENDENCIES = \ LIBLDB_CMDLINE # End BINARY ldbedit ################################################ +ldbedit_OBJ_FILES = lib/ldb/tools/ldbedit.o + MANPAGES += $(ldbdir)/man/ldbedit.1 ################################################ # Start BINARY ldbrename [BINARY::ldbrename] INSTALLDIR = BINDIR -OBJ_FILES= \ - ldbrename.o PRIVATE_DEPENDENCIES = \ LIBLDB_CMDLINE # End BINARY ldbrename ################################################ +ldbrename_OBJ_FILES = lib/ldb/tools/ldbrename.o + MANPAGES += $(ldbdir)/man/ldbrename.1 diff --git a/source4/lib/messaging/config.mk b/source4/lib/messaging/config.mk index 3fec9c0c90..0a0097bdf3 100644 --- a/source4/lib/messaging/config.mk +++ b/source4/lib/messaging/config.mk @@ -2,8 +2,6 @@ ################################################ # Start SUBSYSTEM MESSAGING [SUBSYSTEM::MESSAGING] -OBJ_FILES = \ - messaging.o PUBLIC_DEPENDENCIES = \ LIBSAMBA-UTIL \ TDB_WRAP \ @@ -14,3 +12,6 @@ PUBLIC_DEPENDENCIES = \ LIBNDR # End SUBSYSTEM MESSAGING ################################################ + + +MESSAGING_OBJ_FILES = lib/messaging/messaging.o diff --git a/source4/lib/nss_wrapper/config.mk b/source4/lib/nss_wrapper/config.mk index 81b0ef36fd..61f6392008 100644 --- a/source4/lib/nss_wrapper/config.mk +++ b/source4/lib/nss_wrapper/config.mk @@ -1,8 +1,8 @@ ############################## # Start SUBSYSTEM NSS_WRAPPER [SUBSYSTEM::NSS_WRAPPER] -OBJ_FILES = nss_wrapper.o # End SUBSYSTEM NSS_WRAPPER ############################## PUBLIC_HEADERS += lib/nss_wrapper/nss_wrapper.h +NSS_WRAPPER_OBJ_FILES = lib/nss_wrapper/nss_wrapper.o diff --git a/source4/lib/policy/config.mk b/source4/lib/policy/config.mk index aae98b86b2..d6d229e943 100644 --- a/source4/lib/policy/config.mk +++ b/source4/lib/policy/config.mk @@ -1,12 +1,14 @@ [SUBSYSTEM::LIBPOLICY] CFLAGS = -Iheimdal/lib/roken -OBJ_FILES = lex.o parse_adm.o PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL LIBSAMBA-CONFIG LIBTALLOC CHARSET +LIBPOLICY_OBJ_FILES = lib/policy/lex.o lib/policy/parse_adm.o + lib/policy/lex.l: lib/policy/parse_adm.h lib/policy/parse_adm.h: lib/policy/parse_adm.c [BINARY::dumpadm] -OBJ_FILES = dumpadm.o PRIVATE_DEPENDENCIES = LIBPOLICY LIBPOPT LIBSAMBA-CONFIG LIBTALLOC LIBSAMBA-UTIL CHARSET + +dumpadmin_OBJ_FILES = lib/policy/dumpadm.o diff --git a/source4/lib/popt/config.mk b/source4/lib/popt/config.mk index ad218517b3..86d440ac78 100644 --- a/source4/lib/popt/config.mk +++ b/source4/lib/popt/config.mk @@ -1,7 +1,5 @@ [SUBSYSTEM::LIBPOPT] -OBJ_FILES = findme.o \ - popt.o \ - poptconfig.o \ - popthelp.o \ - poptparse.o CFLAGS = -Ilib/popt + +LIBPOPT_OBJ_FILES = $(addprefix lib/popt/, findme.o popt.o poptconfig.o popthelp.o poptparse.o) + diff --git a/source4/lib/registry/config.mk b/source4/lib/registry/config.mk index b2d7ce202e..728d64d552 100644 --- a/source4/lib/registry/config.mk +++ b/source4/lib/registry/config.mk @@ -1,6 +1,7 @@ [SUBSYSTEM::TDR_REGF] PUBLIC_DEPENDENCIES = TDR -OBJ_FILES = tdr_regf.o + +TDR_REGF_OBJ_FILES = lib/registry/tdr_regf.o # Special support for external builddirs lib/registry/regf.c: lib/registry/tdr_regf.c @@ -20,91 +21,84 @@ clean:: VERSION = 0.0.1 PC_FILE = registry.pc SO_VERSION = 0 -OBJ_FILES = \ - interface.o \ - util.o \ - samba.o \ - patchfile_dotreg.o \ - patchfile_preg.o \ - patchfile.o \ - regf.o \ - hive.o \ - local.o \ - ldb.o \ - dir.o \ - rpc.o PUBLIC_DEPENDENCIES = \ LIBSAMBA-UTIL CHARSET TDR_REGF LIBLDB \ RPC_NDR_WINREG LDB_WRAP # End MODULE registry_ldb ################################################ +registry_OBJ_FILES = $(addprefix lib/registry/, interface.o util.o samba.o \ + patchfile_dotreg.o patchfile_preg.o patchfile.o regf.o \ + hive.o local.o ldb.o dir.o rpc.o) + PUBLIC_HEADERS += $(addprefix lib/registry/, registry.h hive.h patchfile.h) [SUBSYSTEM::registry_common] PUBLIC_DEPENDENCIES = registry -OBJ_FILES = tools/common.o PRIVATE_PROTO_HEADER = tools/common.h +registry_common_OBJ_FILES = lib/registry/tools/common.o + ################################################ # Start BINARY regdiff [BINARY::regdiff] INSTALLDIR = BINDIR -OBJ_FILES = tools/regdiff.o PRIVATE_DEPENDENCIES = \ LIBSAMBA-CONFIG registry LIBPOPT POPT_SAMBA POPT_CREDENTIALS # End BINARY regdiff ################################################ +regdiff_OBJ_FILES = lib/registry/tools/regdiff.o + MANPAGES += lib/registry/man/regdiff.1 ################################################ # Start BINARY regpatch [BINARY::regpatch] INSTALLDIR = BINDIR -OBJ_FILES = tools/regpatch.o PRIVATE_DEPENDENCIES = \ LIBSAMBA-CONFIG registry LIBPOPT POPT_SAMBA POPT_CREDENTIALS \ registry_common # End BINARY regpatch ################################################ +regpatch_OBJ_FILES = lib/registry/tools/regpatch.o + MANPAGES += lib/registry/man/regpatch.1 ################################################ # Start BINARY regshell [BINARY::regshell] INSTALLDIR = BINDIR -OBJ_FILES = tools/regshell.o PRIVATE_DEPENDENCIES = \ LIBSAMBA-CONFIG LIBPOPT registry POPT_SAMBA POPT_CREDENTIALS \ SMBREADLINE registry_common # End BINARY regshell ################################################ +regshell_OBJ_FILES = lib/registry/tools/regshell.o + MANPAGES += lib/registry/man/regshell.1 ################################################ # Start BINARY regtree [BINARY::regtree] INSTALLDIR = BINDIR -OBJ_FILES = tools/regtree.o PRIVATE_DEPENDENCIES = \ LIBSAMBA-CONFIG LIBPOPT registry POPT_SAMBA POPT_CREDENTIALS \ registry_common # End BINARY regtree ################################################ +regtree_OBJ_FILES = lib/registry/tools/regtree.o + MANPAGES += lib/registry/man/regtree.1 [SUBSYSTEM::torture_registry] PRIVATE_DEPENDENCIES = registry PRIVATE_PROTO_HEADER = tests/proto.h -OBJ_FILES = \ - tests/generic.o \ - tests/hive.o \ - tests/diff.o \ - tests/registry.o + +torture_registry_OBJ_FILES = $(addprefix lib/registry/tests/, generic.o hive.o diff.o registry.o) [PYTHON::swig_registry] PUBLIC_DEPENDENCIES = registry diff --git a/source4/lib/samba3/config.mk b/source4/lib/samba3/config.mk index 2d129c5f8c..d33b38cab0 100644 --- a/source4/lib/samba3/config.mk +++ b/source4/lib/samba3/config.mk @@ -2,7 +2,8 @@ # Start SUBSYSTEM LIBSAMBA3 [SUBSYSTEM::SMBPASSWD] PRIVATE_PROTO_HEADER = samba3_smbpasswd_proto.h -OBJ_FILES = smbpasswd.o PRIVATE_DEPENDENCIES = CHARSET LIBSAMBA-UTIL # End SUBSYSTEM LIBSAMBA3 ################################################ + +SMBPASSWD_OBJ_FILES = lib/samba3/smbpasswd.o diff --git a/source4/lib/socket/config.mk b/source4/lib/socket/config.mk index 5a7a62d8ae..354b1b5198 100644 --- a/source4/lib/socket/config.mk +++ b/source4/lib/socket/config.mk @@ -2,44 +2,41 @@ # Start SUBSYSTEM LIBNETIF [SUBSYSTEM::LIBNETIF] PRIVATE_PROTO_HEADER = netif_proto.h -OBJ_FILES = \ - interface.o \ - netif.o PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL EXT_SOCKET EXT_NSL # End SUBSYSTEM LIBNETIF ############################## +LIBNETIF_OBJ_FILES = $(addprefix lib/socket/, interface.o netif.o) + ################################################ # Start MODULE socket_ip [MODULE::socket_ip] SUBSYSTEM = samba-socket OUTPUT_TYPE = MERGED_OBJ -OBJ_FILES = \ - socket_ip.o PRIVATE_DEPENDENCIES = EXT_SOCKET EXT_NSL LIBSAMBA-ERRORS # End MODULE socket_ip ################################################ +socket_ip_OBJ_FILES = lib/socket/socket_ip.o + ################################################ # Start MODULE socket_unix [MODULE::socket_unix] SUBSYSTEM = samba-socket OUTPUT_TYPE = MERGED_OBJ -OBJ_FILES = \ - socket_unix.o PRIVATE_DEPENDENCIES = EXT_SOCKET EXT_NSL # End MODULE socket_unix ################################################ +socket_unix_OBJ_FILES = lib/socket/socket_unix.o + ################################################ # Start SUBSYSTEM SOCKET [SUBSYSTEM::samba-socket] -OBJ_FILES = \ - socket.o \ - access.o \ - connect_multi.o \ - connect.o PUBLIC_DEPENDENCIES = LIBTALLOC PRIVATE_DEPENDENCIES = SOCKET_WRAPPER LIBCLI_COMPOSITE LIBCLI_RESOLVE # End SUBSYSTEM SOCKET ################################################ + +samba-socket_OBJ_FILES = $(addprefix lib/socket/, socket.o access.o connect_multi.o connect.o) + diff --git a/source4/lib/socket_wrapper/config.mk b/source4/lib/socket_wrapper/config.mk index cc52a99801..99ff5c7bd1 100644 --- a/source4/lib/socket_wrapper/config.mk +++ b/source4/lib/socket_wrapper/config.mk @@ -1,9 +1,10 @@ ############################## # Start SUBSYSTEM SOCKET_WRAPPER [SUBSYSTEM::SOCKET_WRAPPER] -OBJ_FILES = socket_wrapper.o PRIVATE_DEPENDENCIES = EXT_SOCKET # End SUBSYSTEM SOCKET_WRAPPER ############################## PUBLIC_HEADERS += lib/socket_wrapper/socket_wrapper.h + +SOCKET_WRAPPER_OBJ_FILES = lib/socket/socket_wrapper.o diff --git a/source4/lib/stream/config.mk b/source4/lib/stream/config.mk index 39e7bc739d..52c8525483 100644 --- a/source4/lib/stream/config.mk +++ b/source4/lib/stream/config.mk @@ -1,8 +1,4 @@ - -################################################ -# Start SUBSYSTEM LIBPACKET [SUBSYSTEM::LIBPACKET] -OBJ_FILES = packet.o PRIVATE_DEPENDENCIES = LIBTLS -# End SUBSYSTEM LIBPACKET -################################################ + +LIBPACKET_OBJ_FILES = lib/stream/packet.o diff --git a/source4/lib/talloc/config.mk b/source4/lib/talloc/config.mk index 33241ffac7..b65cb4ccf6 100644 --- a/source4/lib/talloc/config.mk +++ b/source4/lib/talloc/config.mk @@ -1,8 +1,8 @@ [LIBRARY::LIBTALLOC] OUTPUT_TYPE = STATIC_LIBRARY -OBJ_FILES = talloc.o CFLAGS = -Ilib/talloc +LIBTALLOC_OBJ_FILES = lib/talloc/talloc.o MANPAGES += $(tallocdir)/talloc.3 PUBLIC_HEADERS += $(tallocdir)/talloc.h diff --git a/source4/lib/tdb/config.mk b/source4/lib/tdb/config.mk index c69804fa13..fd39074f50 100644 --- a/source4/lib/tdb/config.mk +++ b/source4/lib/tdb/config.mk @@ -2,57 +2,58 @@ # Start SUBSYSTEM LIBTDB [LIBRARY::LIBTDB] OUTPUT_TYPE = STATIC_LIBRARY -OBJ_FILES = \ - common/tdb.o common/dump.o common/io.o common/lock.o \ - common/open.o common/traverse.o common/freelist.o \ - common/error.o common/transaction.o CFLAGS = -Ilib/tdb/include # # End SUBSYSTEM ldb ################################################ +LIBTDB_OBJ_FILES = $(addprefix lib/tdb/common/, \ + tdb.o dump.o io.o lock.o \ + open.o traverse.o freelist.o \ + error.o transaction.o) + PUBLIC_HEADERS += $(tdbdir)/include/tdb.h ################################################ # Start BINARY tdbtool [BINARY::tdbtool] INSTALLDIR = BINDIR -OBJ_FILES= \ - tools/tdbtool.o PRIVATE_DEPENDENCIES = \ LIBTDB # End BINARY tdbtool ################################################ +tdbtool_OBJ_FILES = lib/tdb/tools/tdbtool.o + ################################################ # Start BINARY tdbtorture [BINARY::tdbtorture] INSTALLDIR = BINDIR -OBJ_FILES= \ - tools/tdbtorture.o PRIVATE_DEPENDENCIES = \ LIBTDB # End BINARY tdbtorture ################################################ +tdbtorture_OBJ_FILES = lib/tdb/tools/tdbtorture.o + ################################################ # Start BINARY tdbdump [BINARY::tdbdump] INSTALLDIR = BINDIR -OBJ_FILES= \ - tools/tdbdump.o PRIVATE_DEPENDENCIES = \ LIBTDB # End BINARY tdbdump ################################################ +tdbdump_OBJ_FILES = lib/tdb/tools/tdbdump.o + ################################################ # Start BINARY tdbbackup [BINARY::tdbbackup] INSTALLDIR = BINDIR -OBJ_FILES= \ - tools/tdbbackup.o PRIVATE_DEPENDENCIES = \ LIBTDB # End BINARY tdbbackup ################################################ + +tdbbackup_OBJ_FILES = lib/tdb/tools/tdbbackup.o diff --git a/source4/lib/tdr/config.mk b/source4/lib/tdr/config.mk index eb3cde9bdf..3e05f6c30c 100644 --- a/source4/lib/tdr/config.mk +++ b/source4/lib/tdr/config.mk @@ -2,6 +2,7 @@ CFLAGS = -Ilib/tdr PRIVATE_PROTO_HEADER = tdr_proto.h PUBLIC_DEPENDENCIES = LIBTALLOC LIBSAMBA-UTIL -OBJ_FILES = tdr.o + +TDR_OBJ_FILES = lib/tdr/tdr.o PUBLIC_HEADERS += lib/tdr/tdr.h diff --git a/source4/lib/tls/config.mk b/source4/lib/tls/config.mk index f75c613e73..a92321f59f 100644 --- a/source4/lib/tls/config.mk +++ b/source4/lib/tls/config.mk @@ -1,11 +1,7 @@ ################################################ # Start SUBSYSTEM LIBTLS [SUBSYSTEM::LIBTLS] -OBJ_FILES = \ - tls.o \ - tlscert.o PUBLIC_DEPENDENCIES = \ LIBTALLOC GNUTLS LIBSAMBA-CONFIG samba-socket -# -# End SUBSYSTEM LIBTLS -################################################ + +LIBTLS_OBJ_FILES = lib/tls/tls.o lib/tls/tlscert.o diff --git a/source4/lib/util/config.mk b/source4/lib/util/config.mk index 16a0357df8..c0c19c2529 100644 --- a/source4/lib/util/config.mk +++ b/source4/lib/util/config.mk @@ -1,7 +1,13 @@ [SUBSYSTEM::LIBSAMBA-UTIL] #VERSION = 0.0.1 #SO_VERSION = 0 -OBJ_FILES = xfile.o \ +PUBLIC_DEPENDENCIES = \ + LIBTALLOC LIBCRYPTO \ + SOCKET_WRAPPER EXT_NSL \ + CHARSET EXECINFO + +LIBSAMBA-UTIL_OBJ_FILES = $(addprefix lib/util/, \ + xfile.o \ debug.o \ fault.o \ signal.o \ @@ -18,11 +24,7 @@ OBJ_FILES = xfile.o \ ms_fnmatch.o \ mutex.o \ idtree.o \ - become_daemon.o -PUBLIC_DEPENDENCIES = \ - LIBTALLOC LIBCRYPTO \ - SOCKET_WRAPPER EXT_NSL \ - CHARSET EXECINFO + become_daemon.o) PUBLIC_HEADERS += $(addprefix lib/util/, util.h \ attr.h \ @@ -36,33 +38,35 @@ PUBLIC_HEADERS += $(addprefix lib/util/, util.h \ [SUBSYSTEM::ASN1_UTIL] PRIVATE_PROTO_HEADER = asn1_proto.h -OBJ_FILES = asn1.o + +ASN1_UTIL_OBJ_FILES = lib/util/asn1.o PUBLIC_HEADERS += lib/util/asn1.h [SUBSYSTEM::UNIX_PRIVS] PRIVATE_PROTO_HEADER = unix_privs.h -OBJ_FILES = unix_privs.o + +UNIX_PRIVS_OBJ_FILES = lib/util/unix_privs.o ################################################ # Start SUBSYSTEM WRAP_XATTR [SUBSYSTEM::WRAP_XATTR] PRIVATE_PROTO_HEADER = wrap_xattr.h -OBJ_FILES = \ - wrap_xattr.o PUBLIC_DEPENDENCIES = XATTR # # End SUBSYSTEM WRAP_XATTR ################################################ +WRAP_XATTR_OBJ_FILES = lib/util/wrap_xattr.o + [SUBSYSTEM::UTIL_TDB] PRIVATE_PROTO_HEADER = util_tdb.h -OBJ_FILES = \ - util_tdb.o PUBLIC_DEPENDENCIES = LIBTDB +UTIL_TDB_OBJ_FILES = lib/util/util_tdb.o + [SUBSYSTEM::UTIL_LDB] PRIVATE_PROTO_HEADER = util_ldb.h -OBJ_FILES = \ - util_ldb.o PUBLIC_DEPENDENCIES = LIBLDB + +UTIL_LDB_OBJ_FILES = lib/util/util_ldb.o -- cgit From 2d1c06c5781600a0efcf9becd3e2773dbbbf2cc7 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 4 Mar 2008 00:43:24 +0100 Subject: Fix includes. (This used to be commit 99e61dade2bd9ae2a5dfe17f766528012c09e46c) --- source4/lib/events/config.mk | 2 ++ source4/lib/ldb/python.mk | 2 ++ source4/lib/registry/config.mk | 1 + source4/lib/tdb/python.mk | 2 ++ 4 files changed, 7 insertions(+) (limited to 'source4/lib') diff --git a/source4/lib/events/config.mk b/source4/lib/events/config.mk index ba06c2f673..e5a1316c47 100644 --- a/source4/lib/events/config.mk +++ b/source4/lib/events/config.mk @@ -45,3 +45,5 @@ PUBLIC_HEADERS += $(addprefix lib/events/, events.h events_internal.h) [PYTHON::swig_events] SWIG_FILE = events.i PRIVATE_DEPENDENCIES = LIBEVENTS + +swig_events_OBJ_FILES = lib/events/events_wrap.o diff --git a/source4/lib/ldb/python.mk b/source4/lib/ldb/python.mk index bbd4c1c5eb..448cc3ed60 100644 --- a/source4/lib/ldb/python.mk +++ b/source4/lib/ldb/python.mk @@ -2,3 +2,5 @@ PUBLIC_DEPENDENCIES = LIBLDB CFLAGS = -Ilib/ldb/include SWIG_FILE = ldb.i + +swig_ldb_OBJ_FILES = lib/ldb/ldb_wrap.o diff --git a/source4/lib/registry/config.mk b/source4/lib/registry/config.mk index 728d64d552..544201ad53 100644 --- a/source4/lib/registry/config.mk +++ b/source4/lib/registry/config.mk @@ -104,3 +104,4 @@ torture_registry_OBJ_FILES = $(addprefix lib/registry/tests/, generic.o hive.o d PUBLIC_DEPENDENCIES = registry SWIG_FILE = registry.i +swig_registry_OBJ_FILES = lib/registry/registry_wrap.o diff --git a/source4/lib/tdb/python.mk b/source4/lib/tdb/python.mk index 23b01c120c..2d61545b7f 100644 --- a/source4/lib/tdb/python.mk +++ b/source4/lib/tdb/python.mk @@ -1,3 +1,5 @@ [PYTHON::swig_tdb] SWIG_FILE = tdb.i PUBLIC_DEPENDENCIES = LIBTDB DYNCONFIG + +swig_tdb_OBJ_FILES = lib/tdb/tdb_wrap.o -- cgit From e018501ca8e3e12e52557eafa66d104fe65088ae Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 4 Mar 2008 01:26:19 +0100 Subject: Fix some paths. (This used to be commit bb16e51e60df296fa7b89eeeba6b80908099dda6) --- source4/lib/socket_wrapper/config.mk | 2 +- source4/lib/util/config.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/socket_wrapper/config.mk b/source4/lib/socket_wrapper/config.mk index 99ff5c7bd1..f7e874d8e2 100644 --- a/source4/lib/socket_wrapper/config.mk +++ b/source4/lib/socket_wrapper/config.mk @@ -7,4 +7,4 @@ PRIVATE_DEPENDENCIES = EXT_SOCKET PUBLIC_HEADERS += lib/socket_wrapper/socket_wrapper.h -SOCKET_WRAPPER_OBJ_FILES = lib/socket/socket_wrapper.o +SOCKET_WRAPPER_OBJ_FILES = lib/socket_wrapper/socket_wrapper.o diff --git a/source4/lib/util/config.mk b/source4/lib/util/config.mk index c0c19c2529..85394513cd 100644 --- a/source4/lib/util/config.mk +++ b/source4/lib/util/config.mk @@ -4,7 +4,7 @@ PUBLIC_DEPENDENCIES = \ LIBTALLOC LIBCRYPTO \ SOCKET_WRAPPER EXT_NSL \ - CHARSET EXECINFO + CHARSET EXECINFO DYNCONFIG LIBSAMBA-UTIL_OBJ_FILES = $(addprefix lib/util/, \ xfile.o \ -- cgit From a69acf7cb96bf41bafce303a2cf21c31f1366328 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 4 Mar 2008 01:37:18 +0100 Subject: Deal with subsystems with no settings, several other minor fixes. (This used to be commit 10cf48591e8d6bfb750a6ff187f04ea24a1f8cd7) --- source4/lib/policy/config.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/policy/config.mk b/source4/lib/policy/config.mk index d6d229e943..70fb289189 100644 --- a/source4/lib/policy/config.mk +++ b/source4/lib/policy/config.mk @@ -11,4 +11,4 @@ lib/policy/parse_adm.h: lib/policy/parse_adm.c [BINARY::dumpadm] PRIVATE_DEPENDENCIES = LIBPOLICY LIBPOPT LIBSAMBA-CONFIG LIBTALLOC LIBSAMBA-UTIL CHARSET -dumpadmin_OBJ_FILES = lib/policy/dumpadm.o +dumpadm_OBJ_FILES = lib/policy/dumpadm.o -- cgit From c20e91d0fdae882b002eae7a288f12add5f3454b Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 4 Mar 2008 10:30:14 +0100 Subject: Fix syntax. (This used to be commit 9bc22a4cd39a96d757be844d0f32a8042d233612) --- source4/lib/ldb/config.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/config.mk b/source4/lib/ldb/config.mk index c33d930ee3..377cfaf566 100644 --- a/source4/lib/ldb/config.mk +++ b/source4/lib/ldb/config.mk @@ -6,7 +6,7 @@ CFLAGS = -Ilib/ldb/include INIT_FUNCTION = LDB_MODULE(asq) SUBSYSTEM = LIBLDB -LDB_ASQ_OBJ_FILES = lib/ldb/modules/asq.o +ldb_asq_OBJ_FILES = lib/ldb/modules/asq.o # End MODULE ldb_asq ################################################ @@ -32,7 +32,7 @@ SUBSYSTEM = LIBLDB # End MODULE ldb_paged_results ################################################ -ldb_pages_results_OBJ_FILES = lib/ldb/modules/paged_results.o +ldb_paged_results_OBJ_FILES = lib/ldb/modules/paged_results.o ################################################ # Start MODULE ldb_paged_results -- cgit From 2bf39edc9d0abf3306bd25b9c40d88aceb029be7 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 8 Mar 2008 15:28:12 +0100 Subject: Push SOVERSION and VERSION out of perl code. (This used to be commit 0ba8ac6a14c62ff9edfe9f0bf43b8a7406b85291) --- source4/lib/ldb/config.mk | 5 +++-- source4/lib/registry/config.mk | 5 +++-- source4/lib/util/config.mk | 2 -- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/config.mk b/source4/lib/ldb/config.mk index 377cfaf566..02763f08a5 100644 --- a/source4/lib/ldb/config.mk +++ b/source4/lib/ldb/config.mk @@ -119,8 +119,6 @@ ldb_tdb_OBJ_FILES = $(addprefix lib/ldb/ldb_tdb/, ldb_tdb.o ldb_search.o ldb_pac ################################################ # Start SUBSYSTEM ldb [LIBRARY::LIBLDB] -VERSION = 0.0.1 -SO_VERSION = 0 CFLAGS = -Ilib/ldb/include PC_FILE = ldb.pc INIT_FUNCTION_TYPE = extern const struct ldb_module_ops @@ -132,6 +130,9 @@ PRIVATE_DEPENDENCIES = \ # End SUBSYSTEM ldb ################################################ +LIBLDB_VERSION = 0.0.1 +LIBLDB_SOVERSION = 0 + LIBLDB_OBJ_FILES = $(addprefix lib/ldb/common/, ldb.o ldb_ldif.o ldb_parse.o ldb_msg.o ldb_utf8.o ldb_debug.o ldb_modules.o ldb_match.o ldb_attributes.o attrib_handlers.o ldb_dn.o ldb_controls.o qsort.o) PUBLIC_HEADERS += $(ldbdir)/include/ldb.h $(ldbdir)/include/ldb_errors.h diff --git a/source4/lib/registry/config.mk b/source4/lib/registry/config.mk index 544201ad53..72882bca93 100644 --- a/source4/lib/registry/config.mk +++ b/source4/lib/registry/config.mk @@ -18,15 +18,16 @@ clean:: ################################################ # Start SUBSYSTEM registry [LIBRARY::registry] -VERSION = 0.0.1 PC_FILE = registry.pc -SO_VERSION = 0 PUBLIC_DEPENDENCIES = \ LIBSAMBA-UTIL CHARSET TDR_REGF LIBLDB \ RPC_NDR_WINREG LDB_WRAP # End MODULE registry_ldb ################################################ +registry_VERSION = 0.0.1 +registry_SOVERSION = 0 + registry_OBJ_FILES = $(addprefix lib/registry/, interface.o util.o samba.o \ patchfile_dotreg.o patchfile_preg.o patchfile.o regf.o \ hive.o local.o ldb.o dir.o rpc.o) diff --git a/source4/lib/util/config.mk b/source4/lib/util/config.mk index 85394513cd..b0978ca5f5 100644 --- a/source4/lib/util/config.mk +++ b/source4/lib/util/config.mk @@ -1,6 +1,4 @@ [SUBSYSTEM::LIBSAMBA-UTIL] -#VERSION = 0.0.1 -#SO_VERSION = 0 PUBLIC_DEPENDENCIES = \ LIBTALLOC LIBCRYPTO \ SOCKET_WRAPPER EXT_NSL \ -- cgit From e3f6a9a0d4232d7ff41d2085641f35a0bf7b229f Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 9 Mar 2008 02:53:54 +0100 Subject: Move PC_FILE out of the perl code. (This used to be commit ca8d4260ada9f74ebc406714ca70d20be09b194b) --- source4/lib/ldb/config.mk | 3 ++- source4/lib/registry/config.mk | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/config.mk b/source4/lib/ldb/config.mk index 02763f08a5..23e2ef71dd 100644 --- a/source4/lib/ldb/config.mk +++ b/source4/lib/ldb/config.mk @@ -120,12 +120,13 @@ ldb_tdb_OBJ_FILES = $(addprefix lib/ldb/ldb_tdb/, ldb_tdb.o ldb_search.o ldb_pac # Start SUBSYSTEM ldb [LIBRARY::LIBLDB] CFLAGS = -Ilib/ldb/include -PC_FILE = ldb.pc INIT_FUNCTION_TYPE = extern const struct ldb_module_ops PUBLIC_DEPENDENCIES = \ LIBTALLOC PRIVATE_DEPENDENCIES = \ SOCKET_WRAPPER + +PC_FILES += $(ldbdir)/ldb.pc # # End SUBSYSTEM ldb ################################################ diff --git a/source4/lib/registry/config.mk b/source4/lib/registry/config.mk index 72882bca93..16e9c62c57 100644 --- a/source4/lib/registry/config.mk +++ b/source4/lib/registry/config.mk @@ -18,13 +18,14 @@ clean:: ################################################ # Start SUBSYSTEM registry [LIBRARY::registry] -PC_FILE = registry.pc PUBLIC_DEPENDENCIES = \ LIBSAMBA-UTIL CHARSET TDR_REGF LIBLDB \ RPC_NDR_WINREG LDB_WRAP # End MODULE registry_ldb ################################################ +PC_FILES += lib/registry/registry.pc + registry_VERSION = 0.0.1 registry_SOVERSION = 0 -- cgit From 8ed6f6d5a825c8b0e8d66d30877a91a96fe6e7a4 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 11 Apr 2008 00:43:23 +0200 Subject: Return SAM ldb context and loadparm context as part of C provision result. (This used to be commit a3e1b835656470f1a80f0fa69f53a9df849baee3) --- source4/lib/ldb/ldb.i | 8 ++++ source4/lib/ldb/ldb.py | 4 +- source4/lib/ldb/ldb_wrap.c | 107 +++++++++++++++++++++++++++++++-------------- 3 files changed, 85 insertions(+), 34 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/ldb.i b/source4/lib/ldb/ldb.i index e01a1107d2..6b94f19cb5 100644 --- a/source4/lib/ldb/ldb.i +++ b/source4/lib/ldb/ldb.i @@ -251,6 +251,14 @@ fail: #ifdef SWIGPYTHON %{ +struct ldb_context *ldb_context_from_py_object(PyObject *py_obj) +{ + struct ldb_context *ldb_ctx; + if (SWIG_ConvertPtr(py_obj, (void *)&ldb_ctx, SWIGTYPE_p_ldb_context, 0 | 0 ) < 0) + return NULL; + return ldb_ctx; +} + int ldb_dn_from_pyobject(TALLOC_CTX *mem_ctx, PyObject *object, struct ldb_context *ldb_ctx, ldb_dn **dn) { diff --git a/source4/lib/ldb/ldb.py b/source4/lib/ldb/ldb.py index 0bcfd36779..b148782c63 100644 --- a/source4/lib/ldb/ldb.py +++ b/source4/lib/ldb/ldb.py @@ -1,5 +1,5 @@ # This file was automatically generated by SWIG (http://www.swig.org). -# Version 1.3.33 +# Version 1.3.35 # # Don't modify this file, modify the SWIG interface instead. @@ -99,7 +99,7 @@ Dn_swigregister(Dn) class ldb_msg_element(object): thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') - def __init__(self): raise AttributeError, "No constructor defined" + def __init__(self, *args, **kwargs): raise AttributeError, "No constructor defined" __repr__ = _swig_repr __swig_destroy__ = _ldb.delete_ldb_msg_element def __getitem__(self, i): diff --git a/source4/lib/ldb/ldb_wrap.c b/source4/lib/ldb/ldb_wrap.c index 082c6d9cad..390652eebe 100644 --- a/source4/lib/ldb/ldb_wrap.c +++ b/source4/lib/ldb/ldb_wrap.c @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 1.3.33 + * Version 1.3.35 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make @@ -126,7 +126,7 @@ /* This should only be incremented when either the layout of swig_type_info changes, or for whatever reason, the runtime changes incompatibly */ -#define SWIG_RUNTIME_VERSION "3" +#define SWIG_RUNTIME_VERSION "4" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE @@ -161,6 +161,7 @@ /* Flags for pointer conversions */ #define SWIG_POINTER_DISOWN 0x1 +#define SWIG_CAST_NEW_MEMORY 0x2 /* Flags for new pointer objects */ #define SWIG_POINTER_OWN 0x1 @@ -301,10 +302,10 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) { extern "C" { #endif -typedef void *(*swig_converter_func)(void *); +typedef void *(*swig_converter_func)(void *, int *); typedef struct swig_type_info *(*swig_dycast_func)(void **); -/* Structure to store inforomation on one type */ +/* Structure to store information on one type */ typedef struct swig_type_info { const char *name; /* mangled name of this type */ const char *str; /* human readable name of this type */ @@ -431,8 +432,8 @@ SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) { Cast a pointer up an inheritance hierarchy */ SWIGRUNTIMEINLINE void * -SWIG_TypeCast(swig_cast_info *ty, void *ptr) { - return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr); +SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { + return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); } /* @@ -856,7 +857,7 @@ SWIG_Python_AddErrorMsg(const char* mesg) Py_DECREF(old_str); Py_DECREF(value); } else { - PyErr_Format(PyExc_RuntimeError, mesg); + PyErr_SetString(PyExc_RuntimeError, mesg); } } @@ -1416,7 +1417,7 @@ PySwigObject_dealloc(PyObject *v) { PySwigObject *sobj = (PySwigObject *) v; PyObject *next = sobj->next; - if (sobj->own) { + if (sobj->own == SWIG_POINTER_OWN) { swig_type_info *ty = sobj->ty; PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0; PyObject *destroy = data ? data->destroy : 0; @@ -1434,12 +1435,13 @@ PySwigObject_dealloc(PyObject *v) res = ((*meth)(mself, v)); } Py_XDECREF(res); - } else { - const char *name = SWIG_TypePrettyName(ty); + } #if !defined(SWIG_PYTHON_SILENT_MEMLEAK) - printf("swig/python detected a memory leak of type '%s', no destructor found.\n", name); -#endif + else { + const char *name = SWIG_TypePrettyName(ty); + printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown")); } +#endif } Py_XDECREF(next); PyObject_DEL(v); @@ -1944,7 +1946,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) SWIGRUNTIME int SWIG_Python_AcquirePtr(PyObject *obj, int own) { - if (own) { + if (own == SWIG_POINTER_OWN) { PySwigObject *sobj = SWIG_Python_GetSwigThis(obj); if (sobj) { int oldown = sobj->own; @@ -1965,6 +1967,8 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int return SWIG_OK; } else { PySwigObject *sobj = SWIG_Python_GetSwigThis(obj); + if (own) + *own = 0; while (sobj) { void *vptr = sobj->ptr; if (ty) { @@ -1978,7 +1982,15 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int if (!tc) { sobj = (PySwigObject *)sobj->next; } else { - if (ptr) *ptr = SWIG_TypeCast(tc,vptr); + if (ptr) { + int newmemory = 0; + *ptr = SWIG_TypeCast(tc,vptr,&newmemory); + if (newmemory == SWIG_CAST_NEW_MEMORY) { + assert(own); + if (own) + *own = *own | SWIG_CAST_NEW_MEMORY; + } + } break; } } @@ -1988,7 +2000,8 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int } } if (sobj) { - if (own) *own = sobj->own; + if (own) + *own = *own | sobj->own; if (flags & SWIG_POINTER_DISOWN) { sobj->own = 0; } @@ -2053,8 +2066,13 @@ SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) { } if (ty) { swig_cast_info *tc = SWIG_TypeCheck(desc,ty); - if (!tc) return SWIG_ERROR; - *ptr = SWIG_TypeCast(tc,vptr); + if (tc) { + int newmemory = 0; + *ptr = SWIG_TypeCast(tc,vptr,&newmemory); + assert(!newmemory); /* newmemory handling not yet implemented */ + } else { + return SWIG_ERROR; + } } else { *ptr = vptr; } @@ -2471,7 +2489,7 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) #define SWIGTYPE_p_ldb_module_ops swig_types[9] #define SWIGTYPE_p_ldb_result swig_types[10] #define SWIGTYPE_p_ldb_val swig_types[11] -#define SWIGTYPE_p_long swig_types[12] +#define SWIGTYPE_p_long_long swig_types[12] #define SWIGTYPE_p_p_char swig_types[13] #define SWIGTYPE_p_p_ldb_control swig_types[14] #define SWIGTYPE_p_p_ldb_result swig_types[15] @@ -2480,10 +2498,11 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) #define SWIGTYPE_p_unsigned_char swig_types[18] #define SWIGTYPE_p_unsigned_int swig_types[19] #define SWIGTYPE_p_unsigned_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 SWIGTYPE_p_unsigned_long_long swig_types[21] +#define SWIGTYPE_p_unsigned_short swig_types[22] +#define SWIGTYPE_p_void swig_types[23] +static swig_type_info *swig_types[25]; +static swig_module_info swig_module = {swig_types, 24, 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) @@ -2515,7 +2534,7 @@ static swig_module_info swig_module = {swig_types, 23, 0, 0, 0, 0}; #define SWIG_name "_ldb" -#define SWIGVERSION 0x010333 +#define SWIGVERSION 0x010335 #define SWIG_VERSION SWIGVERSION @@ -2706,6 +2725,14 @@ SWIGINTERN ldb_dn *ldb_dn___add__(ldb_dn *self,ldb_dn *other){ return ret; } +struct ldb_context *ldb_context_from_py_object(PyObject *py_obj) +{ + struct ldb_context *ldb_ctx; + if (SWIG_ConvertPtr(py_obj, (void *)&ldb_ctx, SWIGTYPE_p_ldb_context, 0 | 0 ) < 0) + return NULL; + return ldb_ctx; +} + int ldb_dn_from_pyobject(TALLOC_CTX *mem_ctx, PyObject *object, struct ldb_context *ldb_ctx, ldb_dn **dn) { @@ -4193,7 +4220,10 @@ check_1: } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'Message___setitem__'.\n Possible C/C++ prototypes are:\n"" __setitem__(ldb_msg *,char const *,ldb_msg_element *)\n"" __setitem__(ldb_msg *,char const *,PyObject *)\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'Message___setitem__'.\n" + " Possible C/C++ prototypes are:\n" + " __setitem__(ldb_msg *,char const *,ldb_msg_element *)\n" + " __setitem__(ldb_msg *,char const *,PyObject *)\n"); return NULL; } @@ -5711,7 +5741,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_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", "int *|int_least32_t *|int32_t *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_int = {"_p_int", "intptr_t *|int *|int_least32_t *|int_fast32_t *|int32_t *|int_fast16_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_ldb_context = {"_p_ldb_context", "struct ldb_context *|ldb *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_ldb_dn = {"_p_ldb_dn", "struct ldb_dn *|ldb_dn *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_ldb_ldif = {"_p_ldb_ldif", "struct ldb_ldif *|ldb_ldif *", 0, 0, (void*)0, 0}; @@ -5720,15 +5750,16 @@ static swig_type_info _swigt__p_ldb_message_element = {"_p_ldb_message_element", static swig_type_info _swigt__p_ldb_module_ops = {"_p_ldb_module_ops", "struct ldb_module_ops *", 0, 0, (void*)0, 0}; 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_ldb_val = {"_p_ldb_val", "struct ldb_val *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_long = {"_p_long", "intptr_t *|int_least64_t *|int_fast32_t *|int_fast64_t *|int64_t *|long *|int_fast16_t *|intmax_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_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}; static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "unsigned char *|uint_least8_t *|uint_fast8_t *|uint8_t *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_unsigned_int = {"_p_unsigned_int", "uint_least32_t *|uint32_t *|unsigned int *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_unsigned_long = {"_p_unsigned_long", "uintptr_t *|uint_least64_t *|uint_fast32_t *|uint_fast64_t *|uint64_t *|unsigned long *|time_t *|uint_fast16_t *|uintmax_t *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_unsigned_int = {"_p_unsigned_int", "uintptr_t *|uint_least32_t *|uint_fast32_t *|uint32_t *|unsigned int *|uint_fast16_t *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_unsigned_long = {"_p_unsigned_long", "unsigned long *|time_t *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_unsigned_long_long = {"_p_unsigned_long_long", "uint_least64_t *|uint_fast64_t *|uint64_t *|unsigned long long *|uintmax_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_unsigned_short = {"_p_unsigned_short", "unsigned short *|uint_least16_t *|uint16_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_void = {"_p_void", "void *", 0, 0, (void*)0, 0}; @@ -5745,7 +5776,7 @@ static swig_type_info *swig_type_initial[] = { &_swigt__p_ldb_module_ops, &_swigt__p_ldb_result, &_swigt__p_ldb_val, - &_swigt__p_long, + &_swigt__p_long_long, &_swigt__p_p_char, &_swigt__p_p_ldb_control, &_swigt__p_p_ldb_result, @@ -5754,6 +5785,7 @@ static swig_type_info *swig_type_initial[] = { &_swigt__p_unsigned_char, &_swigt__p_unsigned_int, &_swigt__p_unsigned_long, + &_swigt__p_unsigned_long_long, &_swigt__p_unsigned_short, &_swigt__p_void, }; @@ -5770,7 +5802,7 @@ static swig_cast_info _swigc__p_ldb_message_element[] = { {&_swigt__p_ldb_messa static swig_cast_info _swigc__p_ldb_module_ops[] = { {&_swigt__p_ldb_module_ops, 0, 0, 0},{0, 0, 0, 0}}; 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_ldb_val[] = { {&_swigt__p_ldb_val, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_long[] = { {&_swigt__p_long, 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}}; @@ -5779,6 +5811,7 @@ static swig_cast_info _swigc__p_signed_char[] = { {&_swigt__p_signed_char, 0, 0 static swig_cast_info _swigc__p_unsigned_char[] = { {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_unsigned_int[] = { {&_swigt__p_unsigned_int, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_unsigned_long[] = { {&_swigt__p_unsigned_long, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_unsigned_long_long[] = { {&_swigt__p_unsigned_long_long, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_unsigned_short[] = { {&_swigt__p_unsigned_short, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}}; @@ -5795,7 +5828,7 @@ static swig_cast_info *swig_cast_initial[] = { _swigc__p_ldb_module_ops, _swigc__p_ldb_result, _swigc__p_ldb_val, - _swigc__p_long, + _swigc__p_long_long, _swigc__p_p_char, _swigc__p_p_ldb_control, _swigc__p_p_ldb_result, @@ -5804,6 +5837,7 @@ static swig_cast_info *swig_cast_initial[] = { _swigc__p_unsigned_char, _swigc__p_unsigned_int, _swigc__p_unsigned_long, + _swigc__p_unsigned_long_long, _swigc__p_unsigned_short, _swigc__p_void, }; @@ -5874,7 +5908,7 @@ SWIGRUNTIME void SWIG_InitializeModule(void *clientdata) { size_t i; swig_module_info *module_head, *iter; - int found; + int found, init; clientdata = clientdata; @@ -5884,6 +5918,9 @@ SWIG_InitializeModule(void *clientdata) { swig_module.type_initial = swig_type_initial; swig_module.cast_initial = swig_cast_initial; swig_module.next = &swig_module; + init = 1; + } else { + init = 0; } /* Try and load any already created modules */ @@ -5912,6 +5949,12 @@ SWIG_InitializeModule(void *clientdata) { module_head->next = &swig_module; } + /* When multiple interpeters are used, a module could have already been initialized in + a different interpreter, but not yet have a pointer in this interpreter. + In this case, we do not want to continue adding types... everything should be + set up already */ + if (init == 0) return; + /* Now work on filling in swig_module.types */ #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: size %d\n", swig_module.size); -- cgit From 225a65da2d3c675dba8bd2330dd56f949e21fa4b Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 13 Apr 2008 21:31:06 +0200 Subject: Attempt to fix get_value() test on sparc machines. (This used to be commit 10102d80d0f78777a69f6b3b1e5606d7d56b7254) --- source4/lib/registry/tests/hive.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/registry/tests/hive.c b/source4/lib/registry/tests/hive.c index 70b0241b04..a16736c761 100644 --- a/source4/lib/registry/tests/hive.c +++ b/source4/lib/registry/tests/hive.c @@ -220,7 +220,7 @@ static bool test_get_value(struct torture_context *tctx, const void *test_data) torture_assert_int_equal(tctx, value.length, 4, "value length"); torture_assert_int_equal(tctx, type, REG_DWORD, "value type"); - torture_assert_int_equal(tctx, data, IVAL(value.data, 0), + torture_assert_mem_equal(tctx, &data, value.data, sizeof(uint32_t), "value data"); return true; -- cgit From ae553dfcecdd605658dea73ccb6e577b059f478c Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 13 Apr 2008 21:33:59 +0200 Subject: Use new torture_assert_mem_equal. (This used to be commit b6319b64d7ef9c58f771f338317d4d525d39a8f2) --- source4/lib/registry/tests/registry.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/registry/tests/registry.c b/source4/lib/registry/tests/registry.c index e5e34c11e0..1780b4e772 100644 --- a/source4/lib/registry/tests/registry.c +++ b/source4/lib/registry/tests/registry.c @@ -428,7 +428,7 @@ static bool test_get_value(struct torture_context *tctx, void *_data) torture_assert_werr_ok(tctx, error, "getting value"); torture_assert_int_equal(tctx, 4, data.length, "value length ok"); - torture_assert(tctx, memcmp(data.data, &value, 4) == 0, + torture_assert_mem_equal(tctx, data.data, &value, 4, "value content ok"); torture_assert_int_equal(tctx, REG_DWORD, type, "value type"); -- cgit From 148d3b170ae00d4001fa011450c7238052d32ae2 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 13 Apr 2008 22:00:36 +0200 Subject: Use torture_assert_mem_equal() in a couple more places. (This used to be commit e2c3fab9d1bf0482c15a115e7d373562ffe50b29) --- source4/lib/registry/tests/registry.c | 2 +- source4/lib/socket/testsuite.c | 6 +++--- source4/lib/util/tests/file.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/registry/tests/registry.c b/source4/lib/registry/tests/registry.c index 1780b4e772..b19a6abffb 100644 --- a/source4/lib/registry/tests/registry.c +++ b/source4/lib/registry/tests/registry.c @@ -496,7 +496,7 @@ static bool test_list_values(struct torture_context *tctx, void *_data) torture_assert_str_equal(tctx, name, "bar", "value name"); torture_assert_int_equal(tctx, 4, data.length, "value length"); - torture_assert(tctx, memcmp(data.data, &value, 4) == 0, + torture_assert_mem_equal(tctx, data.data, &value, 4, "value content"); torture_assert_int_equal(tctx, REG_DWORD, type, "value type"); diff --git a/source4/lib/socket/testsuite.c b/source4/lib/socket/testsuite.c index 6d4d81a884..813412c7bc 100644 --- a/source4/lib/socket/testsuite.c +++ b/source4/lib/socket/testsuite.c @@ -86,7 +86,7 @@ static bool test_udp(struct torture_context *tctx) torture_assert_int_equal(tctx, nread, size, "Unexpected recvfrom size"); - torture_assert(tctx, memcmp(blob2.data, blob.data, size) == 0, + torture_assert_mem_equal(tctx, blob2.data, blob.data, size, "Bad data in recvfrom"); generate_random_buffer(blob.data, blob.length); @@ -104,7 +104,7 @@ static bool test_udp(struct torture_context *tctx) torture_assert_int_equal(tctx, from_addr->port, srv_addr->port, "Unexpected recvfrom port"); - torture_assert(tctx, memcmp(blob2.data, blob.data, size) == 0, + torture_assert_mem_equal(tctx, blob2.data, blob.data, size, "Bad data in recvfrom"); talloc_free(sock1); @@ -181,7 +181,7 @@ static bool test_tcp(struct torture_context *tctx) torture_assert_int_equal(tctx, nread, size, "Unexpected recvfrom size"); - torture_assert(tctx, memcmp(blob2.data, blob.data, size) == 0, + torture_assert_mem_equal(tctx, blob2.data, blob.data, size, "Bad data in recv"); return true; } diff --git a/source4/lib/util/tests/file.c b/source4/lib/util/tests/file.c index fe87293671..3377e833dc 100644 --- a/source4/lib/util/tests/file.c +++ b/source4/lib/util/tests/file.c @@ -45,9 +45,9 @@ static bool test_file_load_save(struct torture_context *tctx) data = file_load(TEST_FILENAME, &len, mem_ctx); torture_assert(tctx, data, "loading file"); - torture_assert(tctx, len == strlen(TEST_DATA), "Length"); + torture_assert_int_equal(tctx, len, strlen(TEST_DATA), "Length"); - torture_assert(tctx, memcmp(data, TEST_DATA, len) == 0, "Contents"); + torture_assert_mem_equal(tctx, data, TEST_DATA, len, "Contents"); unlink(TEST_FILENAME); return true; -- cgit From f78bc8c489b02b521e9ecbdbdc72d160c6911b6b Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 14 Apr 2008 11:54:50 +0200 Subject: Remove prototypes from build.h in preparation of removing build.h altogether. (This used to be commit dbeab2a9cdee4e5f69afeb2603ba29cbed56debd) --- source4/lib/events/events.c | 3 +++ source4/lib/ldb/common/ldb_modules.c | 12 +++++++----- source4/lib/ldb/include/ldb_private.h | 6 ++++++ 3 files changed, 16 insertions(+), 5 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/events/events.c b/source4/lib/events/events.c index 555a5092cc..5d43a91161 100644 --- a/source4/lib/events/events.c +++ b/source4/lib/events/events.c @@ -102,6 +102,9 @@ void event_set_default_backend(const char *backend) static void event_backend_init(void) { #if _SAMBA_BUILD_ + NTSTATUS s4_events_standard_init(void); + NTSTATUS s4_events_select_init(void); + NTSTATUS s4_events_epoll_init(void); init_module_fn static_init[] = { STATIC_LIBEVENTS_MODULES }; if (event_backends) return; run_init_functions(static_init); diff --git a/source4/lib/ldb/common/ldb_modules.c b/source4/lib/ldb/common/ldb_modules.c index 34e0afbf93..eece9af5f7 100644 --- a/source4/lib/ldb/common/ldb_modules.c +++ b/source4/lib/ldb/common/ldb_modules.c @@ -126,14 +126,16 @@ static struct ops_list_entry { struct ops_list_entry *next; } *registered_modules = NULL; +#define LDB_MODULE(name) (&ldb_ ## name ## _module_ops) + #ifndef STATIC_LIBLDB_MODULES #define STATIC_LIBLDB_MODULES \ - &ldb_operational_module_ops, \ - &ldb_rdn_name_module_ops, \ - &ldb_paged_results_module_ops, \ - &ldb_server_sort_module_ops, \ - &ldb_asq_module_ops, \ + LDB_MODULE(operational), \ + LDB_MODULE(rdn_name), \ + LDB_MODULE(paged_results), \ + LDB_MODULE(server_sort), \ + LDB_MODULE(asq), \ NULL #endif diff --git a/source4/lib/ldb/include/ldb_private.h b/source4/lib/ldb/include/ldb_private.h index 0ffba9d99b..ea8533bc38 100644 --- a/source4/lib/ldb/include/ldb_private.h +++ b/source4/lib/ldb/include/ldb_private.h @@ -188,8 +188,14 @@ extern const struct ldb_module_ops ldb_asq_module_ops; extern const struct ldb_module_ops ldb_server_sort_module_ops; extern const struct ldb_module_ops ldb_ldap_module_ops; extern const struct ldb_module_ops ldb_ildap_module_ops; +extern const struct ldb_module_ops ldb_paged_searches_module_ops; extern const struct ldb_module_ops ldb_tdb_module_ops; +extern const struct ldb_module_ops ldb_skel_module_ops; +extern const struct ldb_module_ops ldb_subtree_rename_module_ops; +extern const struct ldb_module_ops ldb_subtree_delete_module_ops; extern const struct ldb_module_ops ldb_sqlite3_module_ops; +extern const struct ldb_module_ops ldb_wins_ldb_module_ops; +extern const struct ldb_module_ops ldb_ranged_results_module_ops; extern const struct ldb_backend_ops ldb_tdb_backend_ops; extern const struct ldb_backend_ops ldb_sqlite3_backend_ops; -- cgit From 212644b5a1107ad81e5ce3bc3118c8983d3f2a86 Mon Sep 17 00:00:00 2001 From: Wilco Baan Hofman Date: Mon, 14 Apr 2008 12:48:25 +0200 Subject: Attempt to fix the patchfile_preg backend for big endian machines. Update some functions to properly state what is not supported (yet). Registry .reg uses UCS-2, not UTF-16. (This used to be commit 664a035dd9fc6e3b50a771baa98f8d79360cc4c1) --- source4/lib/registry/patchfile_dotreg.c | 2 +- source4/lib/registry/patchfile_preg.c | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/registry/patchfile_dotreg.c b/source4/lib/registry/patchfile_dotreg.c index 59f4044713..5aa7e2bab7 100644 --- a/source4/lib/registry/patchfile_dotreg.c +++ b/source4/lib/registry/patchfile_dotreg.c @@ -20,7 +20,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* FIXME Newer .REG files, created by Windows XP and above use unicode UTF-16 */ +/* FIXME Newer .REG files, created by Windows XP and above use unicode UCS-2 */ #include "includes.h" #include "lib/registry/registry.h" diff --git a/source4/lib/registry/patchfile_preg.c b/source4/lib/registry/patchfile_preg.c index 0fa367bfcb..5216a04c8b 100644 --- a/source4/lib/registry/patchfile_preg.c +++ b/source4/lib/registry/patchfile_preg.c @@ -42,30 +42,30 @@ static WERROR preg_read_utf16(struct smb_iconv_convenience *ic, int fd, char *c) /* FIXME These functions need to be implemented */ static WERROR reg_preg_diff_add_key(void *_data, const char *key_name) { - return WERR_OK; + return WERR_NOT_SUPPORTED; } static WERROR reg_preg_diff_del_key(void *_data, const char *key_name) { - return WERR_OK; + return WERR_NOT_SUPPORTED; } static WERROR reg_preg_diff_set_value(void *_data, const char *key_name, const char *value_name, uint32_t value_type, DATA_BLOB value_data) { - return WERR_OK; + return WERR_NOT_SUPPORTED; } static WERROR reg_preg_diff_del_value(void *_data, const char *key_name, const char *value_name) { - return WERR_OK; + return WERR_NOT_SUPPORTED; } static WERROR reg_preg_diff_del_all_values(void *_data, const char *key_name) { - return WERR_OK; + return WERR_NOT_SUPPORTED; } static WERROR reg_preg_diff_done(void *_data) @@ -149,6 +149,8 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd, ret = WERR_GENERAL_FAILURE; goto cleanup; } + preg_header.version = IVAL(&preg_header.version, 0); + if (strncmp(preg_header.hdr, "PReg", 4) != 0) { DEBUG(0, ("This file is not a valid preg registry file\n")); ret = WERR_GENERAL_FAILURE; @@ -193,6 +195,8 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd, ret = WERR_GENERAL_FAILURE; goto cleanup; } + value_type = IVAL(&value_type, 0); + /* Read past delimiter */ buf_ptr = buf; if (!(W_ERROR_IS_OK(preg_read_utf16(iconv_convenience, fd, buf_ptr)) && -- cgit From 97e09c2f877779ca6d55684d33b1a24b8a280e51 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 14 Apr 2008 16:45:38 +0200 Subject: lib/events: fix missing prototype of s4_events_aio_init() metze (This used to be commit 8dca5b9bbb8706a98ad9a15f1b479be497dd44e7) --- source4/lib/events/events.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/lib') diff --git a/source4/lib/events/events.c b/source4/lib/events/events.c index 5d43a91161..568aadc31e 100644 --- a/source4/lib/events/events.c +++ b/source4/lib/events/events.c @@ -105,6 +105,7 @@ static void event_backend_init(void) NTSTATUS s4_events_standard_init(void); NTSTATUS s4_events_select_init(void); NTSTATUS s4_events_epoll_init(void); + NTSTATUS s4_events_aio_init(void); init_module_fn static_init[] = { STATIC_LIBEVENTS_MODULES }; if (event_backends) return; run_init_functions(static_init); -- cgit From ffc5cbfe803326a1c3bf55684717af910d091c5a Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 14 Apr 2008 16:53:00 +0200 Subject: Move object files lists to makefile rather than smb_build. (This used to be commit 5628d58990144463fd87f8c847c9384ac2193681) --- source4/lib/appweb/config.mk | 16 +++++--------- source4/lib/basic.mk | 13 +++++------ source4/lib/charset/config.mk | 5 +---- source4/lib/cmdline/config.mk | 9 +++++--- source4/lib/crypto/config.mk | 21 ++++++------------ source4/lib/dbwrap/config.mk | 6 +++--- source4/lib/events/config.mk | 16 +++++++++----- source4/lib/ldb-samba/config.mk | 3 +-- source4/lib/ldb/ldb_ildap/config.mk | 3 +-- source4/lib/ldb/python.mk | 2 ++ source4/lib/ldb/tools/config.mk | 28 ++++++++++++------------ source4/lib/messaging/config.mk | 5 +++-- source4/lib/policy/config.mk | 6 ++++-- source4/lib/popt/config.mk | 8 +++---- source4/lib/registry/config.mk | 43 ++++++++++++++++--------------------- 15 files changed, 87 insertions(+), 97 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/appweb/config.mk b/source4/lib/appweb/config.mk index df0f81dccb..c0bba35ba5 100644 --- a/source4/lib/appweb/config.mk +++ b/source4/lib/appweb/config.mk @@ -1,31 +1,25 @@ ####################### # Start SUBSYSTEM MPR [SUBSYSTEM::MPR] -OBJ_FILES = \ - mpr/miniMpr.o \ - mpr/var.o # End SUBSYSTEM MPR ####################### +MPR_OBJ_FILES = $(addprefix lib/appweb/mpr/, miniMpr.o var.o) ####################### # Start SUBSYSTEM EJS [SUBSYSTEM::EJS] -OBJ_FILES = \ - ejs/ejsLib.o \ - ejs/ejsLex.o \ - ejs/ejsParser.o \ - ejs/ejsProcs.o PUBLIC_DEPENDENCIES = MPR # End SUBSYSTEM EJS ####################### +EJS_OBJ_FILES = $(addprefix lib/appweb/ejs/, ejsLib.o ejsLex.o ejsParser.o ejsProcs.o) + ####################### # Start SUBSYSTEM ESP [SUBSYSTEM::ESP] -OBJ_FILES = \ - esp/esp.o \ - esp/espProcs.o PUBLIC_DEPENDENCIES = EJS # End SUBSYSTEM ESP ####################### + +ESP_OBJ_FILES = $(addprefix lib/appweb/esp/, esp.o espProcs.o) diff --git a/source4/lib/basic.mk b/source4/lib/basic.mk index d6e90928b0..a02151282c 100644 --- a/source4/lib/basic.mk +++ b/source4/lib/basic.mk @@ -19,26 +19,27 @@ mkinclude dbwrap/config.mk mkinclude crypto/config.mk [SUBSYSTEM::LIBCOMPRESSION] -OBJ_FILES = compression/mszip.o + +LIBCOMPRESSION_OBJ_FILES = lib/compression/mszip.o [SUBSYSTEM::GENCACHE] -OBJ_FILES = gencache/gencache.o PRIVATE_DEPENDENCIES = TDB_WRAP +GENCACHE_OBJ_FILES = gencache/gencache.o # PUBLIC_HEADERS += lib/gencache/gencache.h [SUBSYSTEM::LDB_WRAP] -OBJ_FILES = ldb_wrap.o PUBLIC_DEPENDENCIES = LIBLDB PRIVATE_DEPENDENCIES = LDBSAMBA UTIL_LDB - +LDB_WRAP_OBJ_FILES = lib/ldb_wrap.o PUBLIC_HEADERS += lib/ldb_wrap.h [SUBSYSTEM::TDB_WRAP] -OBJ_FILES = tdb_wrap.o PUBLIC_DEPENDENCIES = LIBTDB - +TDB_WRAP_OBJ_FILES = lib/tdb_wrap.o PUBLIC_HEADERS += lib/tdb_wrap.h + +SMBREADLINE_OBJ_LIST = $(SMBREADLINE_OBJ_FILES) diff --git a/source4/lib/charset/config.mk b/source4/lib/charset/config.mk index 2766784c52..e5e5bd4560 100644 --- a/source4/lib/charset/config.mk +++ b/source4/lib/charset/config.mk @@ -1,15 +1,12 @@ ################################################ # Start SUBSYSTEM CHARSET [SUBSYSTEM::CHARSET] -OBJ_FILES = \ - iconv.o \ - charcnv.o \ - util_unistr.o PRIVATE_PROTO_HEADER = charset_proto.h PUBLIC_DEPENDENCIES = ICONV PRIVATE_DEPENDENCIES = DYNCONFIG # End SUBSYSTEM CHARSET ################################################ +CHARSET_OBJ_FILES = $(addprefix lib/charset/, iconv.o charcnv.o util_unistr.o) PUBLIC_HEADERS += lib/charset/charset.h diff --git a/source4/lib/cmdline/config.mk b/source4/lib/cmdline/config.mk index 87014d4d53..f8a971a063 100644 --- a/source4/lib/cmdline/config.mk +++ b/source4/lib/cmdline/config.mk @@ -1,16 +1,19 @@ [SUBSYSTEM::LIBCMDLINE_CREDENTIALS] PRIVATE_PROTO_HEADER = credentials.h -OBJ_FILES = credentials.o PUBLIC_DEPENDENCIES = CREDENTIALS LIBPOPT +LIBCMDLINE_CREDENTIALS_OBJ_FILES = lib/cmdline/credentials.o + [SUBSYSTEM::POPT_SAMBA] -OBJ_FILES = popt_common.o PUBLIC_DEPENDENCIES = LIBPOPT +POPT_SAMBA_OBJ_FILES = lib/cmdline/popt_common.o + PUBLIC_HEADERS += lib/cmdline/popt_common.h [SUBSYSTEM::POPT_CREDENTIALS] PRIVATE_PROTO_HEADER = popt_credentials.h -OBJ_FILES = popt_credentials.o PUBLIC_DEPENDENCIES = CREDENTIALS LIBCMDLINE_CREDENTIALS LIBPOPT PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL + +POPT_CREDENTIALS_OBJ_FILES = lib/cmdline/popt_credentials.o diff --git a/source4/lib/crypto/config.mk b/source4/lib/crypto/config.mk index f7a8d20604..82dbe4a4cb 100644 --- a/source4/lib/crypto/config.mk +++ b/source4/lib/crypto/config.mk @@ -1,26 +1,19 @@ ############################## # Start SUBSYSTEM LIBCRYPTO [SUBSYSTEM::LIBCRYPTO] -OBJ_FILES = \ - crc32.o \ - md5.o \ - hmacmd5.o \ - md4.o \ - arcfour.o \ - sha1.o \ - hmacsha1.o # End SUBSYSTEM LIBCRYPTO ############################## +LIBCRYPTO_OBJ_FILES = $(addprefix lib/crypto/, \ + crc32.o md5.o hmacmd5.o md4.o \ + arcfour.o sha1.o hmacsha1.o) + + [MODULE::TORTURE_LIBCRYPTO] -OBJ_FILES = \ - md4test.o \ - md5test.o \ - hmacmd5test.o \ - sha1test.o \ - hmacsha1test.o SUBSYSTEM = torture PRIVATE_DEPENDENCIES = LIBCRYPTO PRIVATE_PROTO_HEADER = test_proto.h +TORTURE_LIBCRYPTO_OBJ_FILES = $(addprefix lib/crypto/, \ + md4test.o md5test.o hmacmd5test.o sha1test.o hmacsha1test.o) diff --git a/source4/lib/dbwrap/config.mk b/source4/lib/dbwrap/config.mk index 01ce4ddd8e..9038873d32 100644 --- a/source4/lib/dbwrap/config.mk +++ b/source4/lib/dbwrap/config.mk @@ -1,6 +1,6 @@ [SUBSYSTEM::LIBDBWRAP] -OBJ_FILES = dbwrap.o \ - dbwrap_tdb.o \ - dbwrap_ctdb.o PUBLIC_DEPENDENCIES = \ LIBTDB ctdb + +LIBDBWRAP_OBJ_FILES = $(addprefix lib/dbwrap/, dbwrap.o dbwrap_tdb.o dbwrap_ctdb.o) + diff --git a/source4/lib/events/config.mk b/source4/lib/events/config.mk index 225a23c634..e5a1316c47 100644 --- a/source4/lib/events/config.mk +++ b/source4/lib/events/config.mk @@ -1,43 +1,49 @@ ############################## [MODULE::EVENTS_AIO] -OBJ_FILES = events_aio.o PRIVATE_DEPENDENCIES = LIBAIO_LINUX SUBSYSTEM = LIBEVENTS INIT_FUNCTION = s4_events_aio_init ############################## +EVENTS_AIO_OBJ_FILES = lib/events/events_aio.o + ############################## [MODULE::EVENTS_EPOLL] -OBJ_FILES = events_epoll.o SUBSYSTEM = LIBEVENTS INIT_FUNCTION = s4_events_epoll_init ############################## +EVENTS_EPOLL_OBJ_FILES = lib/events/events_epoll.o + ############################## [MODULE::EVENTS_SELECT] -OBJ_FILES = events_select.o SUBSYSTEM = LIBEVENTS INIT_FUNCTION = s4_events_select_init ############################## +EVENTS_SELECT_OBJ_FILES = lib/events/events_select.o + ############################## [MODULE::EVENTS_STANDARD] -OBJ_FILES = events_standard.o SUBSYSTEM = LIBEVENTS INIT_FUNCTION = s4_events_standard_init ############################## +EVENTS_STANDARD_OBJ_FILES = lib/events/events_standard.o ############################## # Start SUBSYSTEM LIBEVENTS [SUBSYSTEM::LIBEVENTS] -OBJ_FILES = events.o events_timed.o events_signal.o PUBLIC_DEPENDENCIES = LIBTALLOC LIBSAMBA-UTIL # End SUBSYSTEM LIBEVENTS ############################## +LIBEVENTS_OBJ_FILES = $(addprefix lib/events/, events.o events_timed.o events_signal.o) + PUBLIC_HEADERS += $(addprefix lib/events/, events.h events_internal.h) [PYTHON::swig_events] SWIG_FILE = events.i PRIVATE_DEPENDENCIES = LIBEVENTS + +swig_events_OBJ_FILES = lib/events/events_wrap.o diff --git a/source4/lib/ldb-samba/config.mk b/source4/lib/ldb-samba/config.mk index fa3ac46021..6a0b842fff 100644 --- a/source4/lib/ldb-samba/config.mk +++ b/source4/lib/ldb-samba/config.mk @@ -4,9 +4,8 @@ PUBLIC_DEPENDENCIES = LIBLDB PRIVATE_PROTO_HEADER = ldif_handlers.h PRIVATE_DEPENDENCIES = LIBSECURITY SAMDB_SCHEMA LIBNDR NDR_MISC -OBJ_FILES = \ - ldif_handlers.o # End SUBSYSTEM LDBSAMBA ################################################ +LDBSAMBA_OBJ_FILES = lib/ldb-samba/ldif_handlers.o diff --git a/source4/lib/ldb/ldb_ildap/config.mk b/source4/lib/ldb/ldb_ildap/config.mk index 3062dc886f..1b534645b6 100644 --- a/source4/lib/ldb/ldb_ildap/config.mk +++ b/source4/lib/ldb/ldb_ildap/config.mk @@ -6,9 +6,8 @@ CFLAGS = -Ilib/ldb/include OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = LIBTALLOC LIBCLI_LDAP CREDENTIALS ALIASES = ldapi ldaps ldap -OBJ_FILES = \ - ldb_ildap.o # End MODULE ldb_ildap ################################################ +ldb_ildap_OBJ_FILES = lib/ldb/ldb_ildap/ldb_ildap.o diff --git a/source4/lib/ldb/python.mk b/source4/lib/ldb/python.mk index bbd4c1c5eb..448cc3ed60 100644 --- a/source4/lib/ldb/python.mk +++ b/source4/lib/ldb/python.mk @@ -2,3 +2,5 @@ PUBLIC_DEPENDENCIES = LIBLDB CFLAGS = -Ilib/ldb/include SWIG_FILE = ldb.i + +swig_ldb_OBJ_FILES = lib/ldb/ldb_wrap.o diff --git a/source4/lib/ldb/tools/config.mk b/source4/lib/ldb/tools/config.mk index 02ad84ae25..6729636434 100644 --- a/source4/lib/ldb/tools/config.mk +++ b/source4/lib/ldb/tools/config.mk @@ -2,89 +2,89 @@ # Start SUBSYSTEM LIBLDB_CMDLINE [SUBSYSTEM::LIBLDB_CMDLINE] CFLAGS = -Ilib/ldb -Ilib/ldb/include -OBJ_FILES= \ - cmdline.o PUBLIC_DEPENDENCIES = LIBLDB LIBPOPT PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL POPT_SAMBA POPT_CREDENTIALS gensec # End SUBSYSTEM LIBLDB_CMDLINE ################################################ +LIBLDB_CMDLINE_OBJ_FILES = lib/ldb/tools/cmdline.o + ################################################ # Start BINARY ldbadd [BINARY::ldbadd] INSTALLDIR = BINDIR -OBJ_FILES = \ - ldbadd.o PRIVATE_DEPENDENCIES = \ LIBLDB_CMDLINE LIBCLI_RESOLVE # End BINARY ldbadd ################################################ + +ldbadd_OBJ_FILES = lib/ldb/tools/ldbadd.o + MANPAGES += $(ldbdir)/man/ldbadd.1 ################################################ # Start BINARY ldbdel [BINARY::ldbdel] INSTALLDIR = BINDIR -OBJ_FILES= \ - ldbdel.o PRIVATE_DEPENDENCIES = \ LIBLDB_CMDLINE # End BINARY ldbdel ################################################ +ldbdel_OBJ_FILES = lib/ldb/tools/ldbdel.o + MANPAGES += $(ldbdir)/man/ldbdel.1 ################################################ # Start BINARY ldbmodify [BINARY::ldbmodify] INSTALLDIR = BINDIR -OBJ_FILES= \ - ldbmodify.o PRIVATE_DEPENDENCIES = \ LIBLDB_CMDLINE # End BINARY ldbmodify ################################################ +ldbmodify_OBJ_FILES = lib/ldb/tools/ldbmodify.o MANPAGES += $(ldbdir)/man/ldbmodify.1 ################################################ # Start BINARY ldbsearch [BINARY::ldbsearch] INSTALLDIR = BINDIR -OBJ_FILES= \ - ldbsearch.o PRIVATE_DEPENDENCIES = \ LIBLDB_CMDLINE # End BINARY ldbsearch ################################################ +ldbsearch_OBJ_FILES = lib/ldb/tools/ldbsearch.o + MANPAGES += $(ldbdir)/man/ldbsearch.1 ################################################ # Start BINARY ldbedit [BINARY::ldbedit] INSTALLDIR = BINDIR -OBJ_FILES= \ - ldbedit.o PRIVATE_DEPENDENCIES = \ LIBLDB_CMDLINE # End BINARY ldbedit ################################################ +ldbedit_OBJ_FILES = lib/ldb/tools/ldbedit.o + MANPAGES += $(ldbdir)/man/ldbedit.1 ################################################ # Start BINARY ldbrename [BINARY::ldbrename] INSTALLDIR = BINDIR -OBJ_FILES= \ - ldbrename.o PRIVATE_DEPENDENCIES = \ LIBLDB_CMDLINE # End BINARY ldbrename ################################################ +ldbrename_OBJ_FILES = lib/ldb/tools/ldbrename.o + MANPAGES += $(ldbdir)/man/ldbrename.1 diff --git a/source4/lib/messaging/config.mk b/source4/lib/messaging/config.mk index 3fec9c0c90..0a0097bdf3 100644 --- a/source4/lib/messaging/config.mk +++ b/source4/lib/messaging/config.mk @@ -2,8 +2,6 @@ ################################################ # Start SUBSYSTEM MESSAGING [SUBSYSTEM::MESSAGING] -OBJ_FILES = \ - messaging.o PUBLIC_DEPENDENCIES = \ LIBSAMBA-UTIL \ TDB_WRAP \ @@ -14,3 +12,6 @@ PUBLIC_DEPENDENCIES = \ LIBNDR # End SUBSYSTEM MESSAGING ################################################ + + +MESSAGING_OBJ_FILES = lib/messaging/messaging.o diff --git a/source4/lib/policy/config.mk b/source4/lib/policy/config.mk index 6763884b48..9a8e60bfbe 100644 --- a/source4/lib/policy/config.mk +++ b/source4/lib/policy/config.mk @@ -1,12 +1,14 @@ [SUBSYSTEM::LIBPOLICY] CFLAGS = -Iheimdal/lib/roken -OBJ_FILES = lex.o parse_adm.o PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL LIBSAMBA-HOSTCONFIG LIBTALLOC CHARSET +LIBPOLICY_OBJ_FILES = lib/policy/lex.o lib/policy/parse_adm.o + lib/policy/lex.l: lib/policy/parse_adm.h lib/policy/parse_adm.h: lib/policy/parse_adm.c [BINARY::dumpadm] -OBJ_FILES = dumpadm.o PRIVATE_DEPENDENCIES = LIBPOLICY LIBPOPT LIBSAMBA-HOSTCONFIG LIBTALLOC LIBSAMBA-UTIL CHARSET + +dumpadm_OBJ_FILES = lib/policy/dumpadm.o diff --git a/source4/lib/popt/config.mk b/source4/lib/popt/config.mk index ad218517b3..86d440ac78 100644 --- a/source4/lib/popt/config.mk +++ b/source4/lib/popt/config.mk @@ -1,7 +1,5 @@ [SUBSYSTEM::LIBPOPT] -OBJ_FILES = findme.o \ - popt.o \ - poptconfig.o \ - popthelp.o \ - poptparse.o CFLAGS = -Ilib/popt + +LIBPOPT_OBJ_FILES = $(addprefix lib/popt/, findme.o popt.o poptconfig.o popthelp.o poptparse.o) + diff --git a/source4/lib/registry/config.mk b/source4/lib/registry/config.mk index 77b4ece552..affc11d31c 100644 --- a/source4/lib/registry/config.mk +++ b/source4/lib/registry/config.mk @@ -1,6 +1,7 @@ [SUBSYSTEM::TDR_REGF] PUBLIC_DEPENDENCIES = TDR -OBJ_FILES = tdr_regf.o + +TDR_REGF_OBJ_FILES = lib/registry/tdr_regf.o # Special support for external builddirs lib/registry/regf.c: lib/registry/tdr_regf.c @@ -20,93 +21,87 @@ clean:: VERSION = 0.0.1 PC_FILE = registry.pc SO_VERSION = 0 -OBJ_FILES = \ - interface.o \ - util.o \ - samba.o \ - patchfile_dotreg.o \ - patchfile_preg.o \ - patchfile.o \ - regf.o \ - hive.o \ - local.o \ - ldb.o \ - dir.o \ - rpc.o PUBLIC_DEPENDENCIES = \ LIBSAMBA-UTIL CHARSET TDR_REGF LIBLDB \ RPC_NDR_WINREG LDB_WRAP # End MODULE registry_ldb ################################################ +registry_OBJ_FILES = $(addprefix lib/registry/, interface.o util.o samba.o \ + patchfile_dotreg.o patchfile_preg.o patchfile.o regf.o \ + hive.o local.o ldb.o dir.o rpc.o) + PUBLIC_HEADERS += lib/registry/registry.h [SUBSYSTEM::registry_common] PUBLIC_DEPENDENCIES = registry -OBJ_FILES = tools/common.o PRIVATE_PROTO_HEADER = tools/common.h +registry_common_OBJ_FILES = lib/registry/tools/common.o + ################################################ # Start BINARY regdiff [BINARY::regdiff] INSTALLDIR = BINDIR -OBJ_FILES = tools/regdiff.o PRIVATE_DEPENDENCIES = \ LIBSAMBA-HOSTCONFIG registry LIBPOPT POPT_SAMBA POPT_CREDENTIALS # End BINARY regdiff ################################################ +regdiff_OBJ_FILES = lib/registry/tools/regdiff.o + MANPAGES += lib/registry/man/regdiff.1 ################################################ # Start BINARY regpatch [BINARY::regpatch] INSTALLDIR = BINDIR -OBJ_FILES = tools/regpatch.o PRIVATE_DEPENDENCIES = \ LIBSAMBA-HOSTCONFIG registry LIBPOPT POPT_SAMBA POPT_CREDENTIALS \ registry_common # End BINARY regpatch ################################################ +regpatch_OBJ_FILES = lib/registry/tools/regpatch.o + MANPAGES += lib/registry/man/regpatch.1 ################################################ # Start BINARY regshell [BINARY::regshell] INSTALLDIR = BINDIR -OBJ_FILES = tools/regshell.o PRIVATE_DEPENDENCIES = \ LIBSAMBA-HOSTCONFIG LIBPOPT registry POPT_SAMBA POPT_CREDENTIALS \ SMBREADLINE registry_common # End BINARY regshell ################################################ +regshell_OBJ_FILES = lib/registry/tools/regshell.o + MANPAGES += lib/registry/man/regshell.1 ################################################ # Start BINARY regtree [BINARY::regtree] INSTALLDIR = BINDIR -OBJ_FILES = tools/regtree.o PRIVATE_DEPENDENCIES = \ LIBSAMBA-HOSTCONFIG LIBPOPT registry POPT_SAMBA POPT_CREDENTIALS \ registry_common # End BINARY regtree ################################################ +regtree_OBJ_FILES = lib/registry/tools/regtree.o + MANPAGES += lib/registry/man/regtree.1 [SUBSYSTEM::torture_registry] PRIVATE_DEPENDENCIES = registry PRIVATE_PROTO_HEADER = tests/proto.h -OBJ_FILES = \ - tests/generic.o \ - tests/hive.o \ - tests/diff.o \ - tests/registry.o + +torture_registry_OBJ_FILES = $(addprefix lib/registry/tests/, generic.o hive.o diff.o registry.o) [PYTHON::swig_registry] PUBLIC_DEPENDENCIES = registry SWIG_FILE = registry.i +swig_registry_OBJ_FILES = lib/registry/registry_wrap.o -- cgit From e9017ba418202b4b191c5a9ad4a96857558ce606 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 14 Apr 2008 17:22:58 +0200 Subject: Use _OBJ_FILES variables in a couple more places. (This used to be commit 92856d5054106894b65cd1a1b5119c0facfc4cff) --- source4/lib/ldb/config.mk | 78 ++++++++++++++---------------------- source4/lib/nss_wrapper/config.mk | 3 +- source4/lib/samba3/config.mk | 3 +- source4/lib/socket/config.mk | 21 +++++----- source4/lib/socket_wrapper/config.mk | 3 +- source4/lib/stream/config.mk | 8 +--- source4/lib/talloc/config.mk | 5 ++- source4/lib/tdb/config.mk | 25 ++++++------ source4/lib/tdb/python.mk | 2 + source4/lib/tdr/config.mk | 3 +- source4/lib/tls/config.mk | 10 +---- source4/lib/util/config.mk | 32 ++++++++------- 12 files changed, 87 insertions(+), 106 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/config.mk b/source4/lib/ldb/config.mk index 81fd1e9b95..f526a8ce1f 100644 --- a/source4/lib/ldb/config.mk +++ b/source4/lib/ldb/config.mk @@ -5,8 +5,8 @@ PRIVATE_DEPENDENCIES = LIBTALLOC CFLAGS = -Ilib/ldb/include INIT_FUNCTION = &ldb_asq_module_ops SUBSYSTEM = LIBLDB -OBJ_FILES = \ - modules/asq.o + +ldb_asq_OBJ_FILES = lib/ldb/modules/asq.o # End MODULE ldb_asq ################################################ @@ -17,10 +17,10 @@ PRIVATE_DEPENDENCIES = LIBTALLOC CFLAGS = -Ilib/ldb/include INIT_FUNCTION = &ldb_server_sort_module_ops SUBSYSTEM = LIBLDB -OBJ_FILES = \ - modules/sort.o + # End MODULE ldb_sort ################################################ +ldb_server_sort_OBJ_FILES = lib/ldb/modules/sort.o ################################################ # Start MODULE ldb_paged_results @@ -29,11 +29,11 @@ INIT_FUNCTION = &ldb_paged_results_module_ops CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC SUBSYSTEM = LIBLDB -OBJ_FILES = \ - modules/paged_results.o # End MODULE ldb_paged_results ################################################ +ldb_paged_results_OBJ_FILES = lib/ldb/modules/paged_results.o + ################################################ # Start MODULE ldb_paged_results [MODULE::ldb_paged_searches] @@ -41,11 +41,11 @@ INIT_FUNCTION = &ldb_paged_searches_module_ops CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC SUBSYSTEM = LIBLDB -OBJ_FILES = \ - modules/paged_searches.o # End MODULE ldb_paged_results ################################################ +ldb_paged_searches_OBJ_FILES = lib/ldb/modules/paged_searches.o + ################################################ # Start MODULE ldb_operational [MODULE::ldb_operational] @@ -53,11 +53,11 @@ SUBSYSTEM = LIBLDB CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC INIT_FUNCTION = &ldb_operational_module_ops -OBJ_FILES = \ - modules/operational.o # End MODULE ldb_operational ################################################ +ldb_operational_OBJ_FILES = lib/ldb/modules/operational.o + ################################################ # Start MODULE ldb_rdn_name [MODULE::ldb_rdn_name] @@ -65,23 +65,21 @@ SUBSYSTEM = LIBLDB CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC INIT_FUNCTION = &ldb_rdn_name_module_ops -OBJ_FILES = \ - modules/rdn_name.o # End MODULE ldb_rdn_name ################################################ +ldb_rdn_name_OBJ_FILES = lib/ldb/modules/rdn_name.o + ################################################ # Start MODULE ldb_map [SUBSYSTEM::ldb_map] PRIVATE_DEPENDENCIES = LIBTALLOC CFLAGS = -Ilib/ldb/include -Ilib/ldb/ldb_map -OBJ_FILES = \ - ldb_map/ldb_map_inbound.o \ - ldb_map/ldb_map_outbound.o \ - ldb_map/ldb_map.o # End MODULE ldb_map ################################################ +ldb_map_OBJ_FILES = $(addprefix lib/ldb/ldb_map/, ldb_map_inbound.o ldb_map_outbound.o ldb_map.o) + ################################################ # Start MODULE ldb_skel [MODULE::ldb_skel] @@ -89,38 +87,35 @@ SUBSYSTEM = LIBLDB CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC INIT_FUNCTION = &ldb_skel_module_ops -OBJ_FILES = modules/skel.o # End MODULE ldb_skel ################################################ +ldb_skel_OBJ_FILES = lib/ldb/modules/skel.o + ################################################ # Start MODULE ldb_sqlite3 [MODULE::ldb_sqlite3] SUBSYSTEM = LIBLDB CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC SQLITE3 LIBTALLOC -OBJ_FILES = \ - ldb_sqlite3/ldb_sqlite3.o # End MODULE ldb_sqlite3 ################################################ +ldb_sqlite3_OBJ_FILES = lib/ldb/ldb_sqlite3/ldb_sqlite3.o + ################################################ # Start MODULE ldb_tdb [MODULE::ldb_tdb] SUBSYSTEM = LIBLDB CFLAGS = -Ilib/ldb/include -Ilib/ldb/ldb_tdb -OBJ_FILES = \ - ldb_tdb/ldb_tdb.o \ - ldb_tdb/ldb_search.o \ - ldb_tdb/ldb_pack.o \ - ldb_tdb/ldb_index.o \ - ldb_tdb/ldb_cache.o \ - ldb_tdb/ldb_tdb_wrap.o PRIVATE_DEPENDENCIES = \ LIBTDB LIBTALLOC # End MODULE ldb_tdb ################################################ +ldb_tdb_OBJ_FILES = $(addprefix lib/ldb/ldb_tdb/, ldb_tdb.o ldb_search.o ldb_pack.o ldb_index.o ldb_cache.o ldb_tdb_wrap.o) + + ################################################ # Start SUBSYSTEM ldb [LIBRARY::LIBLDB] @@ -129,20 +124,6 @@ SO_VERSION = 0 CFLAGS = -Ilib/ldb/include PC_FILE = ldb.pc INIT_FUNCTION_TYPE = extern const struct ldb_module_ops -OBJ_FILES = \ - common/ldb.o \ - common/ldb_ldif.o \ - common/ldb_parse.o \ - common/ldb_msg.o \ - common/ldb_utf8.o \ - common/ldb_debug.o \ - common/ldb_modules.o \ - common/ldb_match.o \ - common/ldb_attributes.o \ - common/attrib_handlers.o \ - common/ldb_dn.o \ - common/ldb_controls.o \ - common/qsort.o PUBLIC_DEPENDENCIES = \ LIBTALLOC PRIVATE_DEPENDENCIES = \ @@ -151,6 +132,8 @@ PRIVATE_DEPENDENCIES = \ # End SUBSYSTEM ldb ################################################ +LIBLDB_OBJ_FILES = $(addprefix lib/ldb/common/, ldb.o ldb_ldif.o ldb_parse.o ldb_msg.o ldb_utf8.o ldb_debug.o ldb_modules.o ldb_match.o ldb_attributes.o attrib_handlers.o ldb_dn.o ldb_controls.o qsort.o) + PUBLIC_HEADERS += $(ldbdir)/include/ldb.h $(ldbdir)/include/ldb_errors.h MANPAGES += $(ldbdir)/man/ldb.3 @@ -158,39 +141,38 @@ MANPAGES += $(ldbdir)/man/ldb.3 ################################################ # Start BINARY ldbtest [BINARY::ldbtest] -OBJ_FILES= \ - tools/ldbtest.o PRIVATE_DEPENDENCIES = \ LIBLDB_CMDLINE # End BINARY ldbtest ################################################ +ldbtest_OBJ_FILES = lib/ldb/tools/ldbtest.o + ################################################ # Start BINARY oLschema2ldif [BINARY::oLschema2ldif] INSTALLDIR = BINDIR -OBJ_FILES= \ - tools/convert.o \ - tools/oLschema2ldif.o PRIVATE_DEPENDENCIES = \ LIBLDB_CMDLINE # End BINARY oLschema2ldif ################################################ + +oLschema2ldif_OBJ_FILES = $(addprefix lib/ldb/tools/, convert.o oLschema2ldif.o) + MANPAGES += $(ldbdir)/man/oLschema2ldif.1 ################################################ # Start BINARY ad2oLschema [BINARY::ad2oLschema] INSTALLDIR = BINDIR -OBJ_FILES= \ - tools/convert.o \ - tools/ad2oLschema.o PRIVATE_DEPENDENCIES = \ LIBLDB_CMDLINE # End BINARY ad2oLschema ################################################ +ad2oLschema_OBJ_FILES = $(addprefix lib/ldb/tools/, convert.o ad2oLschema.o) + MANPAGES += $(ldbdir)/man/ad2oLschema.1 mkinclude tools/config.mk diff --git a/source4/lib/nss_wrapper/config.mk b/source4/lib/nss_wrapper/config.mk index 03c10acc7a..5f136a465d 100644 --- a/source4/lib/nss_wrapper/config.mk +++ b/source4/lib/nss_wrapper/config.mk @@ -1,6 +1,7 @@ ############################## # Start SUBSYSTEM NSS_WRAPPER [SUBSYSTEM::NSS_WRAPPER] -OBJ_FILES = nss_wrapper.o # End SUBSYSTEM NSS_WRAPPER ############################## + +NSS_WRAPPER_OBJ_FILES = lib/nss_wrapper/nss_wrapper.o diff --git a/source4/lib/samba3/config.mk b/source4/lib/samba3/config.mk index 2d129c5f8c..d33b38cab0 100644 --- a/source4/lib/samba3/config.mk +++ b/source4/lib/samba3/config.mk @@ -2,7 +2,8 @@ # Start SUBSYSTEM LIBSAMBA3 [SUBSYSTEM::SMBPASSWD] PRIVATE_PROTO_HEADER = samba3_smbpasswd_proto.h -OBJ_FILES = smbpasswd.o PRIVATE_DEPENDENCIES = CHARSET LIBSAMBA-UTIL # End SUBSYSTEM LIBSAMBA3 ################################################ + +SMBPASSWD_OBJ_FILES = lib/samba3/smbpasswd.o diff --git a/source4/lib/socket/config.mk b/source4/lib/socket/config.mk index 777882f6e0..2400190175 100644 --- a/source4/lib/socket/config.mk +++ b/source4/lib/socket/config.mk @@ -2,44 +2,41 @@ # Start SUBSYSTEM LIBNETIF [SUBSYSTEM::LIBNETIF] PRIVATE_PROTO_HEADER = netif_proto.h -OBJ_FILES = \ - interface.o \ - netif.o PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL LIBREPLACE_NETWORK # End SUBSYSTEM LIBNETIF ############################## +LIBNETIF_OBJ_FILES = $(addprefix lib/socket/, interface.o netif.o) + ################################################ # Start MODULE socket_ip [MODULE::socket_ip] SUBSYSTEM = samba-socket OUTPUT_TYPE = MERGED_OBJ -OBJ_FILES = \ - socket_ip.o PRIVATE_DEPENDENCIES = LIBSAMBA-ERRORS LIBREPLACE_NETWORK # End MODULE socket_ip ################################################ +socket_ip_OBJ_FILES = lib/socket/socket_ip.o + ################################################ # Start MODULE socket_unix [MODULE::socket_unix] SUBSYSTEM = samba-socket OUTPUT_TYPE = MERGED_OBJ -OBJ_FILES = \ - socket_unix.o PRIVATE_DEPENDENCIES = LIBREPLACE_NETWORK # End MODULE socket_unix ################################################ +socket_unix_OBJ_FILES = lib/socket/socket_unix.o + ################################################ # Start SUBSYSTEM SOCKET [SUBSYSTEM::samba-socket] -OBJ_FILES = \ - socket.o \ - access.o \ - connect_multi.o \ - connect.o PUBLIC_DEPENDENCIES = LIBTALLOC PRIVATE_DEPENDENCIES = SOCKET_WRAPPER LIBCLI_COMPOSITE LIBCLI_RESOLVE # End SUBSYSTEM SOCKET ################################################ + +samba-socket_OBJ_FILES = $(addprefix lib/socket/, socket.o access.o connect_multi.o connect.o) + diff --git a/source4/lib/socket_wrapper/config.mk b/source4/lib/socket_wrapper/config.mk index 902692d9be..2067d988cb 100644 --- a/source4/lib/socket_wrapper/config.mk +++ b/source4/lib/socket_wrapper/config.mk @@ -1,7 +1,8 @@ ############################## # Start SUBSYSTEM SOCKET_WRAPPER [SUBSYSTEM::SOCKET_WRAPPER] -OBJ_FILES = socket_wrapper.o PRIVATE_DEPENDENCIES = LIBREPLACE_NETWORK # End SUBSYSTEM SOCKET_WRAPPER ############################## + +SOCKET_WRAPPER_OBJ_FILES = lib/socket_wrapper/socket_wrapper.o diff --git a/source4/lib/stream/config.mk b/source4/lib/stream/config.mk index 39e7bc739d..52c8525483 100644 --- a/source4/lib/stream/config.mk +++ b/source4/lib/stream/config.mk @@ -1,8 +1,4 @@ - -################################################ -# Start SUBSYSTEM LIBPACKET [SUBSYSTEM::LIBPACKET] -OBJ_FILES = packet.o PRIVATE_DEPENDENCIES = LIBTLS -# End SUBSYSTEM LIBPACKET -################################################ + +LIBPACKET_OBJ_FILES = lib/stream/packet.o diff --git a/source4/lib/talloc/config.mk b/source4/lib/talloc/config.mk index 42f8b38815..84848ae77a 100644 --- a/source4/lib/talloc/config.mk +++ b/source4/lib/talloc/config.mk @@ -1,4 +1,7 @@ [LIBRARY::LIBTALLOC] OUTPUT_TYPE = STATIC_LIBRARY -OBJ_FILES = talloc.o CFLAGS = -Ilib/talloc + +LIBTALLOC_OBJ_FILES = lib/talloc/talloc.o + +MANPAGES += $(tallocdir)/talloc.3 diff --git a/source4/lib/tdb/config.mk b/source4/lib/tdb/config.mk index 76342dc8fa..b9a8f80dda 100644 --- a/source4/lib/tdb/config.mk +++ b/source4/lib/tdb/config.mk @@ -2,55 +2,56 @@ # Start SUBSYSTEM LIBTDB [LIBRARY::LIBTDB] OUTPUT_TYPE = STATIC_LIBRARY -OBJ_FILES = \ - common/tdb.o common/dump.o common/io.o common/lock.o \ - common/open.o common/traverse.o common/freelist.o \ - common/error.o common/transaction.o CFLAGS = -Ilib/tdb/include # # End SUBSYSTEM ldb ################################################ +LIBTDB_OBJ_FILES = $(addprefix lib/tdb/common/, \ + tdb.o dump.o io.o lock.o \ + open.o traverse.o freelist.o \ + error.o transaction.o) + ################################################ # Start BINARY tdbtool [BINARY::tdbtool] INSTALLDIR = BINDIR -OBJ_FILES= \ - tools/tdbtool.o PRIVATE_DEPENDENCIES = \ LIBTDB # End BINARY tdbtool ################################################ +tdbtool_OBJ_FILES = lib/tdb/tools/tdbtool.o + ################################################ # Start BINARY tdbtorture [BINARY::tdbtorture] INSTALLDIR = BINDIR -OBJ_FILES= \ - tools/tdbtorture.o PRIVATE_DEPENDENCIES = \ LIBTDB # End BINARY tdbtorture ################################################ +tdbtorture_OBJ_FILES = lib/tdb/tools/tdbtorture.o + ################################################ # Start BINARY tdbdump [BINARY::tdbdump] INSTALLDIR = BINDIR -OBJ_FILES= \ - tools/tdbdump.o PRIVATE_DEPENDENCIES = \ LIBTDB # End BINARY tdbdump ################################################ +tdbdump_OBJ_FILES = lib/tdb/tools/tdbdump.o + ################################################ # Start BINARY tdbbackup [BINARY::tdbbackup] INSTALLDIR = BINDIR -OBJ_FILES= \ - tools/tdbbackup.o PRIVATE_DEPENDENCIES = \ LIBTDB # End BINARY tdbbackup ################################################ + +tdbbackup_OBJ_FILES = lib/tdb/tools/tdbbackup.o diff --git a/source4/lib/tdb/python.mk b/source4/lib/tdb/python.mk index 23b01c120c..2d61545b7f 100644 --- a/source4/lib/tdb/python.mk +++ b/source4/lib/tdb/python.mk @@ -1,3 +1,5 @@ [PYTHON::swig_tdb] SWIG_FILE = tdb.i PUBLIC_DEPENDENCIES = LIBTDB DYNCONFIG + +swig_tdb_OBJ_FILES = lib/tdb/tdb_wrap.o diff --git a/source4/lib/tdr/config.mk b/source4/lib/tdr/config.mk index eb3cde9bdf..3e05f6c30c 100644 --- a/source4/lib/tdr/config.mk +++ b/source4/lib/tdr/config.mk @@ -2,6 +2,7 @@ CFLAGS = -Ilib/tdr PRIVATE_PROTO_HEADER = tdr_proto.h PUBLIC_DEPENDENCIES = LIBTALLOC LIBSAMBA-UTIL -OBJ_FILES = tdr.o + +TDR_OBJ_FILES = lib/tdr/tdr.o PUBLIC_HEADERS += lib/tdr/tdr.h diff --git a/source4/lib/tls/config.mk b/source4/lib/tls/config.mk index 8e8330f709..e2d7cd517a 100644 --- a/source4/lib/tls/config.mk +++ b/source4/lib/tls/config.mk @@ -1,11 +1,5 @@ -################################################ -# Start SUBSYSTEM LIBTLS [SUBSYSTEM::LIBTLS] -OBJ_FILES = \ - tls.o \ - tlscert.o PUBLIC_DEPENDENCIES = \ LIBTALLOC GNUTLS LIBSAMBA-HOSTCONFIG samba-socket -# -# End SUBSYSTEM LIBTLS -################################################ + +LIBTLS_OBJ_FILES = lib/tls/tls.o lib/tls/tlscert.o diff --git a/source4/lib/util/config.mk b/source4/lib/util/config.mk index 0bf0692193..fff489d62c 100644 --- a/source4/lib/util/config.mk +++ b/source4/lib/util/config.mk @@ -1,7 +1,13 @@ [SUBSYSTEM::LIBSAMBA-UTIL] #VERSION = 0.0.1 #SO_VERSION = 0 -OBJ_FILES = xfile.o \ +PUBLIC_DEPENDENCIES = \ + LIBTALLOC LIBCRYPTO \ + SOCKET_WRAPPER LIBREPLACE_NETWORK \ + CHARSET EXECINFO + +LIBSAMBA-UTIL_OBJ_FILES = $(addprefix lib/util/, \ + xfile.o \ debug.o \ fault.o \ signal.o \ @@ -19,11 +25,7 @@ OBJ_FILES = xfile.o \ mutex.o \ idtree.o \ become_daemon.o \ - params.o -PUBLIC_DEPENDENCIES = \ - LIBTALLOC LIBCRYPTO \ - SOCKET_WRAPPER LIBREPLACE_NETWORK \ - CHARSET EXECINFO + params.o) PUBLIC_HEADERS += $(addprefix lib/util/, util.h \ attr.h \ @@ -38,31 +40,31 @@ PUBLIC_HEADERS += $(addprefix lib/util/, util.h \ [SUBSYSTEM::ASN1_UTIL] PRIVATE_PROTO_HEADER = asn1_proto.h -OBJ_FILES = asn1.o -# PUBLIC_HEADERS += lib/util/asn1.h +ASN1_UTIL_OBJ_FILES = lib/util/asn1.o [SUBSYSTEM::UNIX_PRIVS] PRIVATE_PROTO_HEADER = unix_privs.h -OBJ_FILES = unix_privs.o + +UNIX_PRIVS_OBJ_FILES = lib/util/unix_privs.o ################################################ # Start SUBSYSTEM WRAP_XATTR [SUBSYSTEM::WRAP_XATTR] -OBJ_FILES = \ - wrap_xattr.o PUBLIC_DEPENDENCIES = XATTR # # End SUBSYSTEM WRAP_XATTR ################################################ +WRAP_XATTR_OBJ_FILES = lib/util/wrap_xattr.o + [SUBSYSTEM::UTIL_TDB] PRIVATE_PROTO_HEADER = util_tdb.h -OBJ_FILES = \ - util_tdb.o PUBLIC_DEPENDENCIES = LIBTDB +UTIL_TDB_OBJ_FILES = lib/util/util_tdb.o + [SUBSYSTEM::UTIL_LDB] -OBJ_FILES = \ - util_ldb.o PUBLIC_DEPENDENCIES = LIBLDB + +UTIL_LDB_OBJ_FILES = lib/util/util_ldb.o -- cgit From 12147fca2b3acd37eb20db82996714320cd4e9b2 Mon Sep 17 00:00:00 2001 From: Wilco Baan Hofman Date: Mon, 14 Apr 2008 22:52:51 +0200 Subject: Add support for security descriptors. Also patched the regf backend to support this. Did not touch the ldb, dir and rpc backends yet. (This used to be commit c4626f21a898da27a051f2c67f8fd73f55d4fc7d) --- source4/lib/registry/hive.c | 18 ++++++++++ source4/lib/registry/interface.c | 23 +++---------- source4/lib/registry/local.c | 16 +++++++++ source4/lib/registry/regf.c | 64 +++++++++++++++++++++++++++++------ source4/lib/registry/registry.h | 21 +++++++----- source4/lib/registry/tests/hive.c | 56 +++++++++++++++++++++++++++++- source4/lib/registry/tests/registry.c | 8 ++--- 7 files changed, 164 insertions(+), 42 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/registry/hive.c b/source4/lib/registry/hive.c index 2a9b1a59ce..3bb5b566c9 100644 --- a/source4/lib/registry/hive.c +++ b/source4/lib/registry/hive.c @@ -143,6 +143,24 @@ WERROR hive_get_value_by_index(TALLOC_CTX *mem_ctx, return key->ops->enum_value(mem_ctx, key, idx, name, type, data); } +WERROR hive_get_sec_desc(TALLOC_CTX *mem_ctx, + struct hive_key *key, + struct security_descriptor **security) +{ + if (key->ops->get_sec_desc == NULL) + return WERR_NOT_SUPPORTED; + + return key->ops->get_sec_desc(mem_ctx, key, security); +} + +WERROR hive_set_sec_desc(struct hive_key *key, + const struct security_descriptor *security) +{ + if (key->ops->set_sec_desc == NULL) + return WERR_NOT_SUPPORTED; + + return key->ops->set_sec_desc(key, security); +} WERROR hive_key_del_value(struct hive_key *key, const char *name) { diff --git a/source4/lib/registry/interface.c b/source4/lib/registry/interface.c index a18fd2c28c..06b002859d 100644 --- a/source4/lib/registry/interface.c +++ b/source4/lib/registry/interface.c @@ -249,10 +249,10 @@ _PUBLIC_ WERROR reg_get_sec_desc(TALLOC_CTX *ctx, return WERR_INVALID_PARAM; /* A 'real' set function has preference */ - if (key->context->ops->get_security == NULL) + if (key->context->ops->get_sec_desc == NULL) return WERR_NOT_SUPPORTED; - return key->context->ops->get_security(ctx, key, secdesc); + return key->context->ops->get_sec_desc(ctx, key, secdesc); } /** @@ -283,27 +283,14 @@ _PUBLIC_ WERROR reg_key_flush(struct registry_key *key) return key->context->ops->flush_key(key); } -_PUBLIC_ WERROR reg_get_security(TALLOC_CTX *mem_ctx, - const struct registry_key *key, - struct security_descriptor **security) -{ - if (key == NULL) - return WERR_INVALID_PARAM; - - if (key->context->ops->get_security == NULL) - return WERR_NOT_SUPPORTED; - - return key->context->ops->get_security(mem_ctx, key, security); -} - -_PUBLIC_ WERROR reg_set_security(struct registry_key *key, +_PUBLIC_ WERROR reg_set_sec_desc(struct registry_key *key, struct security_descriptor *security) { if (key == NULL) return WERR_INVALID_PARAM; - if (key->context->ops->set_security == NULL) + if (key->context->ops->set_sec_desc == NULL) return WERR_NOT_SUPPORTED; - return key->context->ops->set_security(key, security); + return key->context->ops->set_sec_desc(key, security); } diff --git a/source4/lib/registry/local.c b/source4/lib/registry/local.c index 5bf2d86588..da381cfbff 100644 --- a/source4/lib/registry/local.c +++ b/source4/lib/registry/local.c @@ -278,7 +278,21 @@ static WERROR local_get_key_info(TALLOC_CTX *mem_ctx, last_change_time, max_subkeynamelen, max_valnamelen, max_valbufsize); } +static WERROR local_get_sec_desc(TALLOC_CTX *mem_ctx, + const struct registry_key *key, + struct security_descriptor **security) +{ + const struct local_key *local = (const struct local_key *)key; + return hive_get_sec_desc(mem_ctx, local->hive_key, security); +} +static WERROR local_set_sec_desc(struct registry_key *key, + const struct security_descriptor *security) +{ + const struct local_key *local = (const struct local_key *)key; + + return hive_set_sec_desc(local->hive_key, security); +} const static struct registry_operations local_ops = { .name = "local", .open_key = local_open_key, @@ -292,6 +306,8 @@ const static struct registry_operations local_ops = { .delete_value = local_delete_value, .flush_key = local_flush_key, .get_key_info = local_get_key_info, + .get_sec_desc = local_get_sec_desc, + .set_sec_desc = local_set_sec_desc, }; WERROR reg_open_local(TALLOC_CTX *mem_ctx, struct registry_context **ctx, diff --git a/source4/lib/registry/regf.c b/source4/lib/registry/regf.c index 46ccca922b..57a895aa00 100644 --- a/source4/lib/registry/regf.c +++ b/source4/lib/registry/regf.c @@ -25,6 +25,8 @@ #include "librpc/gen_ndr/winreg.h" #include "param/param.h" #include "lib/registry/registry.h" +#include "libcli/security/security.h" + static struct hive_operations reg_backend_regf; @@ -1915,9 +1917,12 @@ WERROR reg_create_regf_file(TALLOC_CTX *parent_ctx, { struct regf_data *regf; struct regf_hdr *regf_hdr; - int i; struct nk_block nk; + struct sk_block sk; WERROR error; + DATA_BLOB data; + struct security_descriptor *sd; + uint32_t sk_offset; regf = (struct regf_data *)talloc_zero(NULL, struct regf_data); @@ -1945,20 +1950,17 @@ WERROR reg_create_regf_file(TALLOC_CTX *parent_ctx, regf_hdr->version.minor = minor_version; regf_hdr->last_block = 0x1000; /* Block size */ regf_hdr->description = talloc_strdup(regf_hdr, - "registry created by Samba 4"); + "Registry created by Samba 4"); W_ERROR_HAVE_NO_MEMORY(regf_hdr->description); regf_hdr->chksum = 0; regf->header = regf_hdr; - i = 0; /* Create all hbin blocks */ regf->hbins = talloc_array(regf, struct hbin_block *, 1); W_ERROR_HAVE_NO_MEMORY(regf->hbins); regf->hbins[0] = NULL; - regf_hdr->data_offset = -1; /* FIXME */ - nk.header = "nk"; nk.type = REG_SUB_KEY; unix_to_nt_time(&nk.last_change, time(NULL)); @@ -1971,27 +1973,67 @@ WERROR reg_create_regf_file(TALLOC_CTX *parent_ctx, nk.num_values = 0; nk.values_offset = -1; memset(nk.unk3, 0, 5); - nk.clsname_offset = -1; /* FIXME: fill in */ + nk.clsname_offset = -1; nk.clsname_length = 0; - nk.key_name = ""; + nk.sk_offset = 0x80; + nk.key_name = "SambaRootKey"; + + /* + * It should be noted that changing the key_name to something shorter + * creates a shorter nk block, which makes the position of the sk block + * change. All Windows registries I've seen have the sk at 0x80. + * I therefore recommend that our regf files share that offset -- Wilco + */ + + /* Create a security descriptor. */ + sd = security_descriptor_dacl_create(regf, + 0, + NULL, NULL, + SID_NT_AUTHENTICATED_USERS, + SEC_ACE_TYPE_ACCESS_ALLOWED, + SEC_GENERIC_ALL, + SEC_ACE_FLAG_OBJECT_INHERIT, + NULL); + + /* Push the security descriptor to a blob */ + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_push_struct_blob(&data, regf, NULL, + sd, (ndr_push_flags_fn_t)ndr_push_security_descriptor))) { + DEBUG(0, ("Unable to push security descriptor\n")); + return WERR_GENERAL_FAILURE; + } - nk.sk_offset = -1; /* FIXME: fill in */ + ZERO_STRUCT(sk); + sk.header = "sk"; + sk.prev_offset = 0x80; + sk.next_offset = 0x80; + sk.ref_cnt = 1; + sk.rec_size = data.length; + sk.sec_desc = data.data; /* Store the new nk key */ regf->header->data_offset = hbin_store_tdr(regf, (tdr_push_fn_t)tdr_push_nk_block, &nk); + /* Store the sk block */ + sk_offset = hbin_store_tdr(regf, + (tdr_push_fn_t) tdr_push_sk_block, + &sk); + if (sk_offset != 0x80) { + DEBUG(0, ("Error storing sk block, should be at 0x80, stored at 0x%x\n", nk.sk_offset)); + return WERR_GENERAL_FAILURE; + } + *key = (struct hive_key *)regf_get_key(parent_ctx, regf, regf->header->data_offset); - /* We can drop our own reference now that *key will have created one */ - talloc_free(regf); - error = regf_save_hbin(regf); if (!W_ERROR_IS_OK(error)) { return error; } + + /* We can drop our own reference now that *key will have created one */ + talloc_free(regf); return WERR_OK; } diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index a86294bf46..1348d1121f 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -184,6 +184,12 @@ WERROR hive_get_value_by_index(TALLOC_CTX *mem_ctx, struct hive_key *key, uint32_t idx, const char **name, uint32_t *type, DATA_BLOB *data); +WERROR hive_get_sec_desc(TALLOC_CTX *mem_ctx, + struct hive_key *key, + struct security_descriptor **security); + +WERROR hive_set_sec_desc(struct hive_key *key, + const struct security_descriptor *security); WERROR hive_key_del_value(struct hive_key *key, const char *name); @@ -311,11 +317,11 @@ struct registry_operations { uint32_t *type, DATA_BLOB *data); - WERROR (*get_security) (TALLOC_CTX *mem_ctx, + WERROR (*get_sec_desc) (TALLOC_CTX *mem_ctx, const struct registry_key *key, struct security_descriptor **security); - WERROR (*set_security) (struct registry_key *key, + WERROR (*set_sec_desc) (struct registry_key *key, const struct security_descriptor *security); WERROR (*load_key) (struct registry_key *key, @@ -461,12 +467,8 @@ struct registry_key *reg_import_hive_key(struct registry_context *ctx, struct hive_key *hive, uint32_t predef_key, const char **elements); -WERROR reg_get_security(TALLOC_CTX *mem_ctx, - const struct registry_key *key, - struct security_descriptor **security); - -WERROR reg_set_security(struct registry_key *key, - struct security_descriptor *security); +WERROR reg_set_sec_desc(struct registry_key *key, + const struct security_descriptor *security); struct reg_diff_callbacks { WERROR (*add_key) (void *callback_data, const char *key_name); @@ -490,6 +492,9 @@ WERROR reg_dotreg_diff_save(TALLOC_CTX *ctx, const char *filename, struct smb_iconv_convenience *iconv_convenience, struct reg_diff_callbacks **callbacks, void **callback_data); +WERROR reg_preg_diff_save(TALLOC_CTX *ctx, const char *filename, + struct reg_diff_callbacks **callbacks, + void **callback_data); WERROR reg_generate_diff_key(struct registry_key *oldkey, struct registry_key *newkey, const char *path, diff --git a/source4/lib/registry/tests/hive.c b/source4/lib/registry/tests/hive.c index a16736c761..4fe7f66c03 100644 --- a/source4/lib/registry/tests/hive.c +++ b/source4/lib/registry/tests/hive.c @@ -26,6 +26,7 @@ #include "librpc/gen_ndr/winreg.h" #include "system/filesys.h" #include "param/param.h" +#include "libcli/security/security.h" static bool test_del_nonexistant_key(struct torture_context *tctx, const void *test_data) @@ -297,6 +298,57 @@ static bool test_list_values(struct torture_context *tctx, return true; } +static bool test_hive_security(struct torture_context *tctx, const void *_data) +{ + struct hive_key *subkey = NULL; + const struct hive_key *root = _data; + WERROR error; + struct security_descriptor *osd, *nsd; + + osd = security_descriptor_dacl_create(tctx, + 0, + NULL, NULL, + SID_NT_AUTHENTICATED_USERS, + SEC_ACE_TYPE_ACCESS_ALLOWED, + SEC_GENERIC_ALL, + SEC_ACE_FLAG_OBJECT_INHERIT, + NULL); + + + error = hive_key_add_name(tctx, root, "SecurityKey", NULL, + osd, &subkey); + torture_assert_werr_ok(tctx, error, "hive_key_add_name"); + + error = hive_get_sec_desc(tctx, subkey, &nsd); + torture_assert_werr_ok (tctx, error, "getting security descriptor"); + + torture_assert(tctx, security_descriptor_equal(osd, nsd), + "security descriptor changed!"); + + /* Create a fresh security descriptor */ + talloc_free(osd); + osd = security_descriptor_dacl_create(tctx, + 0, + NULL, NULL, + SID_NT_AUTHENTICATED_USERS, + SEC_ACE_TYPE_ACCESS_ALLOWED, + SEC_GENERIC_ALL, + SEC_ACE_FLAG_OBJECT_INHERIT, + NULL); + + error = hive_set_sec_desc(subkey, osd); + torture_assert_werr_ok(tctx, error, "setting security descriptor"); + + printf("The second one is done.\n"); + error = hive_get_sec_desc(tctx, subkey, &nsd); + torture_assert_werr_ok (tctx, error, "getting security descriptor"); + + torture_assert(tctx, security_descriptor_equal(osd, nsd), + "security descriptor changed!"); + + return true; +} + static void tcase_add_tests(struct torture_tcase *tcase) { torture_tcase_add_simple_test_const(tcase, "del_nonexistant_key", @@ -324,6 +376,8 @@ static void tcase_add_tests(struct torture_tcase *tcase) test_del_key); torture_tcase_add_simple_test_const(tcase, "del_value", test_del_value); + torture_tcase_add_simple_test_const(tcase, "check hive security", + test_hive_security); } static bool hive_setup_dir(struct torture_context *tctx, void **data) @@ -381,7 +435,7 @@ static bool hive_setup_regf(struct torture_context *tctx, void **data) char *dirname; NTSTATUS status; - status = torture_temp_dir(tctx, "hive-dir", &dirname); + status = torture_temp_dir(tctx, "hive-regf", &dirname); if (!NT_STATUS_IS_OK(status)) return false; diff --git a/source4/lib/registry/tests/registry.c b/source4/lib/registry/tests/registry.c index b19a6abffb..97c1190a68 100644 --- a/source4/lib/registry/tests/registry.c +++ b/source4/lib/registry/tests/registry.c @@ -387,11 +387,11 @@ static bool test_security(struct torture_context *tctx, void *_data) SEC_ACE_FLAG_OBJECT_INHERIT, NULL); - error = reg_set_security(subkey, osd); - torture_assert_werr_ok(tctx, error, "setting security"); + error = reg_set_sec_desc(subkey, osd); + torture_assert_werr_ok(tctx, error, "setting security descriptor"); - error = reg_get_security(tctx, subkey, &nsd); - torture_assert_werr_ok (tctx, error, "setting security"); + error = reg_get_sec_desc(tctx, subkey, &nsd); + torture_assert_werr_ok (tctx, error, "getting security descriptor"); torture_assert(tctx, security_descriptor_equal(osd, nsd), "security descriptor changed!"); -- cgit From a31b6607f22f6b3e1b354db2f9f611b299a2f7ae Mon Sep 17 00:00:00 2001 From: Wilco Baan Hofman Date: Mon, 14 Apr 2008 22:56:14 +0200 Subject: Remove debug stuff. (This used to be commit 7ba2e5dc5b6d82457c298f7ecdb6baea43f04854) --- source4/lib/registry/tests/hive.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/registry/tests/hive.c b/source4/lib/registry/tests/hive.c index 4fe7f66c03..474704b517 100644 --- a/source4/lib/registry/tests/hive.c +++ b/source4/lib/registry/tests/hive.c @@ -339,7 +339,6 @@ static bool test_hive_security(struct torture_context *tctx, const void *_data) error = hive_set_sec_desc(subkey, osd); torture_assert_werr_ok(tctx, error, "setting security descriptor"); - printf("The second one is done.\n"); error = hive_get_sec_desc(tctx, subkey, &nsd); torture_assert_werr_ok (tctx, error, "getting security descriptor"); -- cgit From 08baea013b73607df0c86f24506912c7e6af6f7e Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 15 Apr 2008 02:25:16 +0200 Subject: Move SOVERSION, VERSION and PC_FILE out of smb_build but use make variables directly instead. (This used to be commit 9d0ae012b0b463278cd054d06788aa998acc2da2) --- source4/lib/ldb/config.mk | 8 +++++--- source4/lib/registry/config.mk | 8 +++++--- source4/lib/util/config.mk | 2 -- 3 files changed, 10 insertions(+), 8 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/config.mk b/source4/lib/ldb/config.mk index f526a8ce1f..25219eb8b0 100644 --- a/source4/lib/ldb/config.mk +++ b/source4/lib/ldb/config.mk @@ -119,19 +119,21 @@ ldb_tdb_OBJ_FILES = $(addprefix lib/ldb/ldb_tdb/, ldb_tdb.o ldb_search.o ldb_pac ################################################ # Start SUBSYSTEM ldb [LIBRARY::LIBLDB] -VERSION = 0.0.1 -SO_VERSION = 0 CFLAGS = -Ilib/ldb/include -PC_FILE = ldb.pc INIT_FUNCTION_TYPE = extern const struct ldb_module_ops PUBLIC_DEPENDENCIES = \ LIBTALLOC PRIVATE_DEPENDENCIES = \ SOCKET_WRAPPER + +PC_FILES += $(ldbdir)/ldb.pc # # End SUBSYSTEM ldb ################################################ +LIBLDB_VERSION = 0.0.1 +LIBLDB_SOVERSION = 0 + LIBLDB_OBJ_FILES = $(addprefix lib/ldb/common/, ldb.o ldb_ldif.o ldb_parse.o ldb_msg.o ldb_utf8.o ldb_debug.o ldb_modules.o ldb_match.o ldb_attributes.o attrib_handlers.o ldb_dn.o ldb_controls.o qsort.o) PUBLIC_HEADERS += $(ldbdir)/include/ldb.h $(ldbdir)/include/ldb_errors.h diff --git a/source4/lib/registry/config.mk b/source4/lib/registry/config.mk index affc11d31c..ce19d8512e 100644 --- a/source4/lib/registry/config.mk +++ b/source4/lib/registry/config.mk @@ -18,15 +18,17 @@ clean:: ################################################ # Start SUBSYSTEM registry [LIBRARY::registry] -VERSION = 0.0.1 -PC_FILE = registry.pc -SO_VERSION = 0 PUBLIC_DEPENDENCIES = \ LIBSAMBA-UTIL CHARSET TDR_REGF LIBLDB \ RPC_NDR_WINREG LDB_WRAP # End MODULE registry_ldb ################################################ +PC_FILES += lib/registry/registry.pc + +registry_VERSION = 0.0.1 +registry_SOVERSION = 0 + registry_OBJ_FILES = $(addprefix lib/registry/, interface.o util.o samba.o \ patchfile_dotreg.o patchfile_preg.o patchfile.o regf.o \ hive.o local.o ldb.o dir.o rpc.o) diff --git a/source4/lib/util/config.mk b/source4/lib/util/config.mk index fff489d62c..5a4b831ed5 100644 --- a/source4/lib/util/config.mk +++ b/source4/lib/util/config.mk @@ -1,6 +1,4 @@ [SUBSYSTEM::LIBSAMBA-UTIL] -#VERSION = 0.0.1 -#SO_VERSION = 0 PUBLIC_DEPENDENCIES = \ LIBTALLOC LIBCRYPTO \ SOCKET_WRAPPER LIBREPLACE_NETWORK \ -- cgit From 0b8d2b3cb779463a1e24039300ac2669862f9b64 Mon Sep 17 00:00:00 2001 From: Wilco Baan Hofman Date: Tue, 15 Apr 2008 11:52:33 +0200 Subject: Fixed the patchfile tests and tidy up the patchfile backends. (This used to be commit 6e9b1e35a269af2eda79356c1525f5413656d648) --- source4/lib/registry/patchfile.c | 4 +- source4/lib/registry/patchfile_dotreg.c | 8 +- source4/lib/registry/patchfile_preg.c | 10 +- source4/lib/registry/registry.h | 4 + source4/lib/registry/tests/diff.c | 232 +++++++++++++++++++++++++++++--- 5 files changed, 226 insertions(+), 32 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/registry/patchfile.c b/source4/lib/registry/patchfile.c index 15e3a158f2..eaeef341bb 100644 --- a/source4/lib/registry/patchfile.c +++ b/source4/lib/registry/patchfile.c @@ -45,7 +45,7 @@ WERROR reg_generate_diff_key(struct registry_key *oldkey, void *callback_data) { int i; - struct registry_key *t1, *t2; + struct registry_key *t1 = NULL, *t2 = NULL; char *tmppath; const char *keyname1; WERROR error, error1, error2; @@ -295,7 +295,7 @@ _PUBLIC_ WERROR reg_diff_load(const char *filename, /* Reset position in file */ lseek(fd, 0, SEEK_SET); -#if 0 +#if 0 /* These backends are not supported yet. */ if (strncmp(hdr, "CREG", 4) == 0) { /* Must be a W9x CREG Config.pol file */ return reg_creg_diff_load(diff, fd); diff --git a/source4/lib/registry/patchfile_dotreg.c b/source4/lib/registry/patchfile_dotreg.c index 5aa7e2bab7..1bc9c60753 100644 --- a/source4/lib/registry/patchfile_dotreg.c +++ b/source4/lib/registry/patchfile_dotreg.c @@ -3,7 +3,7 @@ Reading .REG files Copyright (C) Jelmer Vernooij 2004-2007 - Copyright (C) Wilco Baan Hofman 2006 + Copyright (C) Wilco Baan Hofman 2006-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 @@ -112,8 +112,8 @@ _PUBLIC_ WERROR reg_dotreg_diff_save(TALLOC_CTX *ctx, const char *filename, data->iconv_convenience = iconv_convenience; if (filename) { - data->fd = open(filename, O_CREAT, 0755); - if (data->fd == -1) { + data->fd = open(filename, O_CREAT|O_WRONLY, 0755); + if (data->fd < 0) { DEBUG(0, ("Unable to open %s\n", filename)); return WERR_BADFILE; } @@ -121,7 +121,7 @@ _PUBLIC_ WERROR reg_dotreg_diff_save(TALLOC_CTX *ctx, const char *filename, data->fd = STDOUT_FILENO; } - fdprintf(data->fd, "%s\n", HEADER_STRING); + fdprintf(data->fd, "%s\n\n", HEADER_STRING); *callbacks = talloc(ctx, struct reg_diff_callbacks); diff --git a/source4/lib/registry/patchfile_preg.c b/source4/lib/registry/patchfile_preg.c index 5216a04c8b..a28096517c 100644 --- a/source4/lib/registry/patchfile_preg.c +++ b/source4/lib/registry/patchfile_preg.c @@ -2,7 +2,7 @@ Unix SMB/CIFS implementation. Reading Registry.pol PReg registry files - Copyright (C) Wilco Baan Hofman 2006 + Copyright (C) Wilco Baan Hofman 2006-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 @@ -71,7 +71,7 @@ static WERROR reg_preg_diff_del_all_values(void *_data, const char *key_name) static WERROR reg_preg_diff_done(void *_data) { struct preg_data *data = (struct preg_data *)_data; - + close(data->fd); talloc_free(data); return WERR_OK; @@ -95,15 +95,15 @@ _PUBLIC_ WERROR reg_preg_diff_save(TALLOC_CTX *ctx, const char *filename, *callback_data = data; if (filename) { - data->fd = open(filename, O_CREAT, 0755); - if (data->fd == -1) { + data->fd = open(filename, O_CREAT|O_WRONLY, 0755); + if (data->fd < 0) { DEBUG(0, ("Unable to open %s\n", filename)); return WERR_BADFILE; } } else { data->fd = STDOUT_FILENO; } - snprintf(preg_header.hdr, 4, "PReg"); + memcpy(preg_header.hdr, "PReg", 4); SIVAL(&preg_header, 4, 1); write(data->fd, (uint8_t *)&preg_header,8); diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index 1348d1121f..573379aff5 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -500,6 +500,10 @@ WERROR reg_generate_diff_key(struct registry_key *oldkey, const char *path, const struct reg_diff_callbacks *callbacks, void *callback_data); +WERROR reg_diff_load(const char *filename, + struct smb_iconv_convenience *iconv_convenience, + const struct reg_diff_callbacks *callbacks, + void *callback_data); diff --git a/source4/lib/registry/tests/diff.c b/source4/lib/registry/tests/diff.c index 690f71fcf7..da62342124 100644 --- a/source4/lib/registry/tests/diff.c +++ b/source4/lib/registry/tests/diff.c @@ -4,6 +4,7 @@ local testing of registry diff functionality Copyright (C) Jelmer Vernooij 2007 + Copyright (C) Wilco Baan Hofman 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 @@ -24,27 +25,79 @@ #include "torture/torture.h" #include "librpc/gen_ndr/winreg.h" -static bool test_generate_diff(struct torture_context *test) +struct diff_tcase_data { + struct registry_context *r1_ctx; + struct registry_context *r2_ctx; + struct reg_diff_callbacks *callbacks; + void *callback_data; + char *tempdir; + char *filename; +}; + +static bool test_generate_diff(struct torture_context *tctx, void *tcase_data) { /* WERROR reg_generate_diff(struct registry_context *ctx1, struct registry_context *ctx2, const struct reg_diff_callbacks *callbacks, void *callback_data) */ + WERROR error; + struct diff_tcase_data *td = tcase_data; + + error = reg_generate_diff(td->r1_ctx, td->r2_ctx, + td->callbacks, + td->callback_data); + torture_assert_werr_ok(tctx, error, "reg_generate_diff"); + return true; } - -static bool test_diff_load(struct torture_context *test) +#if 0 +static bool test_diff_load(struct torture_context *tctx, void *tcase_data) { - /* WERROR reg_diff_load(const char *filename, const struct reg_diff_callbacks *callbacks, void *callback_data) */ + struct diff_tcase_data *td = tcase_data; + struct smb_iconv_convenience *iconv_convenience; + struct reg_diff_callbacks *callbacks; + void *data; + WERROR error; + + iconv_convenience = smb_iconv_convenience_init(tctx, "CP850", "UTF-8", 1); + + + error = reg_diff_load(td->filename, iconv_convenience, callbacks, data); + torture_assert_werr_ok(tctx, error, "reg_diff_load"); return true; } - -static bool test_diff_apply(struct torture_context *test) +#endif +static bool test_diff_apply(struct torture_context *tctx, void *tcase_data) { - /* _PUBLIC_ WERROR reg_diff_apply (const char *filename, struct registry_context *ctx) */ + struct diff_tcase_data *td = tcase_data; + struct registry_key *key; + WERROR error; + + error = reg_diff_apply(td->r1_ctx, td->filename); + torture_assert_werr_ok(tctx, error, "reg_diff_apply"); + + error = td->r1_ctx->ops->get_predefined_key(td->r1_ctx, HKEY_LOCAL_MACHINE, &key); + torture_assert_werr_ok(tctx, error, "Opening HKEY_LOCAL_MACHINE failed"); + + /* If this generates an error it could be that the apply doesn't work, + * but also that the reg_generate_diff didn't work. */ + error = td->r1_ctx->ops->open_key(td->r1_ctx, key, "Software", &key); + torture_assert_werr_ok(tctx, error, "Opening HKLM\\Software failed"); + error = td->r1_ctx->ops->open_key(td->r1_ctx, key, "Microsoft", &key); + torture_assert_werr_ok(tctx, error, "Opening HKLM\\Software\\Microsoft failed"); + error = td->r1_ctx->ops->open_key(td->r1_ctx, key, "Windows", &key); + torture_assert_werr_ok(tctx, error, "Opening HKLM\\..\\Microsoft\\Windows failed"); + error = td->r1_ctx->ops->open_key(td->r1_ctx, key, "CurrentVersion", &key); + torture_assert_werr_ok(tctx, error, "Opening HKLM\\..\\Windows\\CurrentVersion failed"); + error = td->r1_ctx->ops->open_key(td->r1_ctx, key, "Policies", &key); + torture_assert_werr_ok(tctx, error, "Opening HKLM\\..\\CurrentVersion\\Policies failed"); + error = td->r1_ctx->ops->open_key(td->r1_ctx, key, "Explorer", &key); + torture_assert_werr_ok(tctx, error, "Opening HKLM\\..\\Policies\\Explorer failed"); + + return true; } @@ -58,7 +111,7 @@ static WERROR test_add_key(void *callback_data, const char *key_name) return WERR_OK; } -static bool test_generate_diff_key_add(struct torture_context *test) +static bool test_generate_diff_key_add(struct torture_context *tctx, void *tcase_data) { struct reg_diff_callbacks cb; struct registry_key rk; @@ -69,15 +122,15 @@ static bool test_generate_diff_key_add(struct torture_context *test) cb.add_key = test_add_key; - if (W_ERROR_IS_OK(reg_generate_diff_key(&rk, NULL, "bla", &cb, test))) + if (W_ERROR_IS_OK(reg_generate_diff_key(&rk, NULL, "bla", &cb, tctx))) return false; - torture_assert_str_equal(test, added_key, "bla", "key added"); + torture_assert_str_equal(tctx, added_key, "bla", "key added"); return true; } -static bool test_generate_diff_key_null(struct torture_context *test) +static bool test_generate_diff_key_null(struct torture_context *tctx, void *tcase_data) { struct reg_diff_callbacks cb; @@ -88,19 +141,156 @@ static bool test_generate_diff_key_null(struct torture_context *test) return true; } +static void tcase_add_tests (struct torture_tcase *tcase) +{ + torture_tcase_add_simple_test(tcase, "test_generate_diff_key_add", + test_generate_diff_key_add); + torture_tcase_add_simple_test(tcase, "test_generate_diff_key_null", + test_generate_diff_key_null); + torture_tcase_add_simple_test(tcase, "test_generate_diff", + test_generate_diff); + torture_tcase_add_simple_test(tcase, "test_diff_apply", + test_diff_apply); +/* torture_tcase_add_simple_test(tcase, "test_diff_load", + test_diff_load); +*/ +} + +static bool diff_setup_tcase(struct torture_context *tctx, void **data) +{ + struct registry_context *r1_ctx, *r2_ctx; + WERROR error; + NTSTATUS status; + struct hive_key *r1_hklm, *r1_hkcu; + struct hive_key *r2_hklm, *r2_hkcu; + const char *filename; + struct diff_tcase_data *td; + struct registry_key *key, *newkey; + DATA_BLOB blob; + + td = talloc(tctx, struct diff_tcase_data); + + /* Create two registry contexts */ + error = reg_open_local(tctx, &r1_ctx, NULL, NULL); + torture_assert_werr_ok(tctx, error, "Opening registry 1 for patch tests failed"); + + error = reg_open_local(tctx, &r2_ctx, NULL, NULL); + torture_assert_werr_ok(tctx, error, "Opening registry 2 for patch tests failed"); + + /* Create temp directory */ + status = torture_temp_dir(tctx, "patchfile", &td->tempdir); + torture_assert_ntstatus_ok(tctx, status, "Creating temp dir failed"); + + /* Create and mount HKLM and HKCU hives for registry 1 */ + filename = talloc_asprintf(tctx, "%s/r1_local_machine.ldb", td->tempdir); + error = reg_open_ldb_file(tctx, filename, NULL, NULL, tctx->lp_ctx, &r1_hklm); + torture_assert_werr_ok(tctx, error, "Opening local machine file failed"); + + error = reg_mount_hive(r1_ctx, r1_hklm, HKEY_LOCAL_MACHINE, NULL); + torture_assert_werr_ok(tctx, error, "Mounting hive failed"); + + filename = talloc_asprintf(tctx, "%s/r1_current_user.ldb", td->tempdir); + error = reg_open_ldb_file(tctx, filename, NULL, NULL, tctx->lp_ctx, &r1_hkcu); + torture_assert_werr_ok(tctx, error, "Opening current user file failed"); + + error = reg_mount_hive(r1_ctx, r1_hkcu, HKEY_CURRENT_USER, NULL); + torture_assert_werr_ok(tctx, error, "Mounting hive failed"); + + /* Create and mount HKLM and HKCU hives for registry 2 */ + filename = talloc_asprintf(tctx, "%s/r2_local_machine.ldb", td->tempdir); + error = reg_open_ldb_file(tctx, filename, NULL, NULL, tctx->lp_ctx, &r2_hklm); + torture_assert_werr_ok(tctx, error, "Opening local machine file failed"); + + error = reg_mount_hive(r2_ctx, r2_hklm, HKEY_LOCAL_MACHINE, NULL); + torture_assert_werr_ok(tctx, error, "Mounting hive failed"); + + filename = talloc_asprintf(tctx, "%s/r2_current_user.ldb", td->tempdir); + error = reg_open_ldb_file(tctx, filename, NULL, NULL, tctx->lp_ctx, &r2_hkcu); + torture_assert_werr_ok(tctx, error, "Opening current user file failed"); + + error = reg_mount_hive(r2_ctx, r2_hkcu, HKEY_CURRENT_USER, NULL); + torture_assert_werr_ok(tctx, error, "Mounting hive failed"); + + error = r1_ctx->ops->get_predefined_key(r2_ctx, HKEY_LOCAL_MACHINE, &key); + torture_assert_werr_ok(tctx, error, "Opening HKEY_LOCAL_MACHINE failed"); + error = r1_ctx->ops->create_key(r2_ctx, key, "Software", NULL, NULL, &newkey); + torture_assert_werr_ok(tctx, error, "Creating HKLM\\Sofware failed"); + error = r1_ctx->ops->create_key(r2_ctx, newkey, "Microsoft", NULL, NULL, &newkey); + torture_assert_werr_ok(tctx, error, "Creating HKLM\\Software\\Microsoft failed"); + error = r1_ctx->ops->create_key(r2_ctx, newkey, "Windows", NULL, NULL, &newkey); + torture_assert_werr_ok(tctx, error, "Creating HKLM\\Software\\Microsoft\\Windows failed"); + error = r1_ctx->ops->create_key(r2_ctx, newkey, "CurrentVersion", NULL, NULL, &newkey); + torture_assert_werr_ok(tctx, error, "Creating HKLM\\..\\Windows\\CurrentVersion failed"); + error = r1_ctx->ops->create_key(r2_ctx, newkey, "Policies", NULL, NULL, &newkey); + torture_assert_werr_ok(tctx, error, "Creating HKLM\\..\\CurrentVersion\\Policies failed"); + error = r1_ctx->ops->create_key(r2_ctx, newkey, "Explorer", NULL, NULL, &newkey); + torture_assert_werr_ok(tctx, error, "Creating HKLM\\..\\Policies\\Explorer failed"); + + blob.data = (void *)talloc(r2_ctx, uint32_t); + SIVAL(blob.data, 0, 0x03ffffff); + blob.length = sizeof(uint32_t); + r1_ctx->ops->set_value(newkey, "NoDrives", REG_DWORD, blob); + + /* Set test case data */ + td->r1_ctx = r1_ctx; + td->r2_ctx = r2_ctx; + + *data = td; + + return true; +} + +static bool diff_setup_preg_tcase (struct torture_context *tctx, void **data) +{ + struct diff_tcase_data *td; + WERROR error; + + diff_setup_tcase(tctx, data); + td = *data; + + td->filename = talloc_asprintf(tctx, "%s/test.pol", td->tempdir); + error = reg_preg_diff_save(tctx, td->filename, &td->callbacks, &td->callback_data); + torture_assert_werr_ok(tctx, error, "reg_preg_diff_save"); + + return true; +} + +static bool diff_setup_dotreg_tcase (struct torture_context *tctx, void **data) +{ + struct diff_tcase_data *td; + struct smb_iconv_convenience *iconv_convenience; + WERROR error; + + diff_setup_tcase(tctx, data); + td = *data; + + iconv_convenience = smb_iconv_convenience_init(tctx, "CP850", "UTF-8", 1); + + td->filename = talloc_asprintf(tctx, "%s/test.reg", td->tempdir); + error = reg_dotreg_diff_save(tctx, td->filename, iconv_convenience, &td->callbacks, &td->callback_data); + torture_assert_werr_ok(tctx, error, "reg_dotreg_diff_save"); + + return true; +} +static bool diff_teardown_tcase (struct torture_context *tctx, void *data) +{ + /* Done is called by generate_diff itself! */ + + return true; +} struct torture_suite *torture_registry_diff(TALLOC_CTX *mem_ctx) { + struct torture_tcase *tcase; struct torture_suite *suite = torture_suite_create(mem_ctx, "DIFF"); - torture_suite_add_simple_test(suite, "test_generate_diff_key_add", - test_generate_diff_key_add); - torture_suite_add_simple_test(suite, "test_generate_diff_key_null", - test_generate_diff_key_null); - torture_suite_add_simple_test(suite, "test_diff_apply", - test_diff_apply); - torture_suite_add_simple_test(suite, "test_generate_diff", - test_generate_diff); - torture_suite_add_simple_test(suite, "test_diff_load", - test_diff_load); + + tcase = torture_suite_add_tcase(suite, "PReg"); + torture_tcase_set_fixture(tcase, diff_setup_preg_tcase, diff_teardown_tcase); + tcase_add_tests(tcase); + + tcase = torture_suite_add_tcase(suite, "dotreg"); + torture_tcase_set_fixture(tcase, diff_setup_dotreg_tcase, diff_teardown_tcase); + tcase_add_tests(tcase); + return suite; } -- cgit From 5e687d79533684949deb9bd9bc86f88eab4ae310 Mon Sep 17 00:00:00 2001 From: Wilco Baan Hofman Date: Tue, 15 Apr 2008 19:57:29 +0200 Subject: Fix PReg write support. Add tests for patch files (.REG and PReg). (This used to be commit 497977c36c621a4820be51cbcb7b78eac1e292b7) --- source4/lib/registry/patchfile.c | 23 ++++++++++- source4/lib/registry/patchfile_preg.c | 72 ++++++++++++++++++++++++++++++----- source4/lib/registry/registry.h | 1 + source4/lib/registry/tests/diff.c | 19 +++++---- 4 files changed, 97 insertions(+), 18 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/registry/patchfile.c b/source4/lib/registry/patchfile.c index eaeef341bb..0ede3106f0 100644 --- a/source4/lib/registry/patchfile.c +++ b/source4/lib/registry/patchfile.c @@ -320,12 +320,33 @@ static WERROR reg_diff_apply_add_key(void *_ctx, const char *key_name) { struct registry_context *ctx = (struct registry_context *)_ctx; struct registry_key *tmp; + char *buf, *buf_ptr; WERROR error; + /* Recursively create the path */ + buf = talloc_strdup(ctx, key_name); + buf_ptr = buf; + + while (*buf_ptr++ != '\0' ) { + if (*buf_ptr == '\\') { + *buf_ptr = '\0'; + error = reg_key_add_abs(ctx, ctx, buf, 0, NULL, &tmp); + + if (!W_ERROR_EQUAL(error, WERR_ALREADY_EXISTS) && + !W_ERROR_IS_OK(error)) { + DEBUG(0, ("Error adding new key '%s': %s\n", + key_name, win_errstr(error))); + return error; + } + *buf_ptr++ = '\\'; + } + } + + /* Add the key */ error = reg_key_add_abs(ctx, ctx, key_name, 0, NULL, &tmp); if (!W_ERROR_EQUAL(error, WERR_ALREADY_EXISTS) && - !W_ERROR_IS_OK(error)) { + !W_ERROR_IS_OK(error)) { DEBUG(0, ("Error adding new key '%s': %s\n", key_name, win_errstr(error))); return error; diff --git a/source4/lib/registry/patchfile_preg.c b/source4/lib/registry/patchfile_preg.c index a28096517c..ea41a9e21b 100644 --- a/source4/lib/registry/patchfile_preg.c +++ b/source4/lib/registry/patchfile_preg.c @@ -23,9 +23,12 @@ #include "lib/registry/registry.h" #include "system/filesys.h" #include "param/param.h" +#include "librpc/gen_ndr/winreg.h" struct preg_data { int fd; + TALLOC_CTX *ctx; + struct smb_iconv_convenience *ic; }; static WERROR preg_read_utf16(struct smb_iconv_convenience *ic, int fd, char *c) @@ -38,25 +41,69 @@ static WERROR preg_read_utf16(struct smb_iconv_convenience *ic, int fd, char *c) push_codepoint(ic, c, v); return WERR_OK; } - -/* FIXME These functions need to be implemented */ -static WERROR reg_preg_diff_add_key(void *_data, const char *key_name) +static WERROR preg_write_utf16(struct smb_iconv_convenience *ic, int fd, const char *string) { - return WERR_NOT_SUPPORTED; + codepoint_t v; + uint16_t i; + size_t size; + + for (i = 0; i < strlen(string); i+=size) { + v = next_codepoint(ic, &string[i], &size); + if (write(fd, &v, 2) < 2) { + return WERR_GENERAL_FAILURE; + } + } + return WERR_OK; } - -static WERROR reg_preg_diff_del_key(void *_data, const char *key_name) +/* PReg does not support adding keys. */ +static WERROR reg_preg_diff_add_key(void *_data, const char *key_name) { - return WERR_NOT_SUPPORTED; + return WERR_OK; } static WERROR reg_preg_diff_set_value(void *_data, const char *key_name, const char *value_name, uint32_t value_type, DATA_BLOB value_data) { - return WERR_NOT_SUPPORTED; + struct preg_data *data = _data; + uint32_t buf; + + preg_write_utf16(data->ic, data->fd, "["); + preg_write_utf16(data->ic, data->fd, key_name); + preg_write_utf16(data->ic, data->fd, ";"); + preg_write_utf16(data->ic, data->fd, value_name); + preg_write_utf16(data->ic, data->fd, ";"); + SIVAL(&buf, 0, value_type); + write(data->fd, &buf, sizeof(uint32_t)); + preg_write_utf16(data->ic, data->fd, ";"); + SIVAL(&buf, 0, value_data.length); + write(data->fd, &buf, sizeof(uint32_t)); + preg_write_utf16(data->ic, data->fd, ";"); + write(data->fd, value_data.data, value_data.length); + preg_write_utf16(data->ic, data->fd, "]"); + + return WERR_OK; } +static WERROR reg_preg_diff_del_key(void *_data, const char *key_name) +{ + struct preg_data *data = _data; + char *parent_name; + DATA_BLOB blob; + + parent_name = talloc_strndup(data->ctx, key_name, strrchr(key_name, '\\')-key_name); + blob.data = (void *)talloc_strndup(data->ctx, key_name, + strlen(key_name)-(strrchr(key_name, '\\')-key_name)); + blob.length = strlen((char *)blob.data)+1; + + + /* FIXME: These values should be accumulated to be written at done(). */ + reg_preg_diff_set_value(_data, parent_name, "**DeleteKeys", REG_SZ, blob); + + return WERR_OK; +} + +/* FIXME These functions need to be implemented */ static WERROR reg_preg_diff_del_value(void *_data, const char *key_name, const char *value_name) { @@ -81,6 +128,7 @@ static WERROR reg_preg_diff_done(void *_data) * Save registry diff */ _PUBLIC_ WERROR reg_preg_diff_save(TALLOC_CTX *ctx, const char *filename, + struct smb_iconv_convenience *ic, struct reg_diff_callbacks **callbacks, void **callback_data) { @@ -103,10 +151,14 @@ _PUBLIC_ WERROR reg_preg_diff_save(TALLOC_CTX *ctx, const char *filename, } else { data->fd = STDOUT_FILENO; } + memcpy(preg_header.hdr, "PReg", 4); SIVAL(&preg_header, 4, 1); write(data->fd, (uint8_t *)&preg_header,8); + data->ctx = ctx; + data->ic = ic; + *callbacks = talloc(ctx, struct reg_diff_callbacks); (*callbacks)->add_key = reg_preg_diff_add_key; @@ -179,7 +231,8 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd, *buf_ptr != ';' && buf_ptr-buf < buf_size) { buf_ptr++; } - key = talloc_asprintf(mem_ctx, "\\%s", buf); + buf[buf_ptr-buf] = '\0'; + key = talloc_strdup(mem_ctx, buf); /* Get the name */ buf_ptr = buf; @@ -187,6 +240,7 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd, *buf_ptr != ';' && buf_ptr-buf < buf_size) { buf_ptr++; } + buf[buf_ptr-buf] = '\0'; value_name = talloc_strdup(mem_ctx, buf); /* Get the type */ diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index 573379aff5..6a98a60633 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -493,6 +493,7 @@ WERROR reg_dotreg_diff_save(TALLOC_CTX *ctx, const char *filename, struct reg_diff_callbacks **callbacks, void **callback_data); WERROR reg_preg_diff_save(TALLOC_CTX *ctx, const char *filename, + struct smb_iconv_convenience *ic, struct reg_diff_callbacks **callbacks, void **callback_data); WERROR reg_generate_diff_key(struct registry_key *oldkey, diff --git a/source4/lib/registry/tests/diff.c b/source4/lib/registry/tests/diff.c index da62342124..4bd868ea51 100644 --- a/source4/lib/registry/tests/diff.c +++ b/source4/lib/registry/tests/diff.c @@ -24,6 +24,7 @@ #include "lib/registry/registry.h" #include "torture/torture.h" #include "librpc/gen_ndr/winreg.h" +#include "param/param.h" struct diff_tcase_data { struct registry_context *r1_ctx; @@ -56,13 +57,12 @@ static bool test_generate_diff(struct torture_context *tctx, void *tcase_data) static bool test_diff_load(struct torture_context *tctx, void *tcase_data) { struct diff_tcase_data *td = tcase_data; - struct smb_iconv_convenience *iconv_convenience; + struct smb_iconv_convenience *ic; struct reg_diff_callbacks *callbacks; void *data; WERROR error; - iconv_convenience = smb_iconv_convenience_init(tctx, "CP850", "UTF-8", 1); - + ic = lp_iconv_convenience(tctx->lp_ctx); error = reg_diff_load(td->filename, iconv_convenience, callbacks, data); torture_assert_werr_ok(tctx, error, "reg_diff_load"); @@ -244,13 +244,16 @@ static bool diff_setup_tcase(struct torture_context *tctx, void **data) static bool diff_setup_preg_tcase (struct torture_context *tctx, void **data) { struct diff_tcase_data *td; + struct smb_iconv_convenience *ic; WERROR error; diff_setup_tcase(tctx, data); td = *data; - + + ic = lp_iconv_convenience(tctx->lp_ctx); + td->filename = talloc_asprintf(tctx, "%s/test.pol", td->tempdir); - error = reg_preg_diff_save(tctx, td->filename, &td->callbacks, &td->callback_data); + error = reg_preg_diff_save(tctx, td->filename, ic, &td->callbacks, &td->callback_data); torture_assert_werr_ok(tctx, error, "reg_preg_diff_save"); return true; @@ -259,16 +262,16 @@ static bool diff_setup_preg_tcase (struct torture_context *tctx, void **data) static bool diff_setup_dotreg_tcase (struct torture_context *tctx, void **data) { struct diff_tcase_data *td; - struct smb_iconv_convenience *iconv_convenience; + struct smb_iconv_convenience *ic; WERROR error; diff_setup_tcase(tctx, data); td = *data; - iconv_convenience = smb_iconv_convenience_init(tctx, "CP850", "UTF-8", 1); + ic = lp_iconv_convenience(tctx->lp_ctx); td->filename = talloc_asprintf(tctx, "%s/test.reg", td->tempdir); - error = reg_dotreg_diff_save(tctx, td->filename, iconv_convenience, &td->callbacks, &td->callback_data); + error = reg_dotreg_diff_save(tctx, td->filename, ic, &td->callbacks, &td->callback_data); torture_assert_werr_ok(tctx, error, "reg_dotreg_diff_save"); return true; -- cgit From 439f75f522d241aa78f06572c47ff6b871289793 Mon Sep 17 00:00:00 2001 From: Wilco Baan Hofman Date: Tue, 15 Apr 2008 21:35:59 +0200 Subject: More patchfile fixes. Write support should work now. (This used to be commit cc38f2f086b92bbe65bd6e7f4e03fdf7f21ef2f6) --- source4/lib/registry/patchfile_preg.c | 27 ++++++++++++++++++++------- source4/lib/registry/tests/diff.c | 22 +++++++++++++++------- 2 files changed, 35 insertions(+), 14 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/registry/patchfile_preg.c b/source4/lib/registry/patchfile_preg.c index ea41a9e21b..c2bc8d10b3 100644 --- a/source4/lib/registry/patchfile_preg.c +++ b/source4/lib/registry/patchfile_preg.c @@ -92,27 +92,40 @@ static WERROR reg_preg_diff_del_key(void *_data, const char *key_name) DATA_BLOB blob; parent_name = talloc_strndup(data->ctx, key_name, strrchr(key_name, '\\')-key_name); - blob.data = (void *)talloc_strndup(data->ctx, key_name, + blob.data = (void *)talloc_strndup(data->ctx, key_name+(strrchr(key_name, '\\')-key_name)+1, strlen(key_name)-(strrchr(key_name, '\\')-key_name)); blob.length = strlen((char *)blob.data)+1; /* FIXME: These values should be accumulated to be written at done(). */ - reg_preg_diff_set_value(_data, parent_name, "**DeleteKeys", REG_SZ, blob); - - return WERR_OK; + return reg_preg_diff_set_value(data, parent_name, "**DeleteKeys", REG_SZ, blob); } -/* FIXME These functions need to be implemented */ static WERROR reg_preg_diff_del_value(void *_data, const char *key_name, const char *value_name) { - return WERR_NOT_SUPPORTED; + struct preg_data *data = _data; + char *val; + DATA_BLOB blob; + + val = talloc_asprintf(data->ctx, "**Del.%s", value_name); + + blob.data = (void *)talloc(data->ctx, uint32_t); + *(uint32_t *)blob.data = 0; + blob.length = 4; + return reg_preg_diff_set_value(data, key_name, val, REG_DWORD, blob); } static WERROR reg_preg_diff_del_all_values(void *_data, const char *key_name) { - return WERR_NOT_SUPPORTED; + struct preg_data *data = _data; + DATA_BLOB blob; + + blob.data = (void *)talloc(data->ctx, uint32_t); + *(uint32_t *)blob.data = 0; + blob.length = 4; + + return reg_preg_diff_set_value(data, key_name, "**DelVals.", REG_DWORD, blob); } static WERROR reg_preg_diff_done(void *_data) diff --git a/source4/lib/registry/tests/diff.c b/source4/lib/registry/tests/diff.c index 4bd868ea51..492f4de0b5 100644 --- a/source4/lib/registry/tests/diff.c +++ b/source4/lib/registry/tests/diff.c @@ -211,21 +211,29 @@ static bool diff_setup_tcase(struct torture_context *tctx, void **data) error = reg_mount_hive(r2_ctx, r2_hkcu, HKEY_CURRENT_USER, NULL); torture_assert_werr_ok(tctx, error, "Mounting hive failed"); - error = r1_ctx->ops->get_predefined_key(r2_ctx, HKEY_LOCAL_MACHINE, &key); + error = r1_ctx->ops->get_predefined_key(r1_ctx, HKEY_CURRENT_USER, &key); + torture_assert_werr_ok(tctx, error, "Opening HKEY_CURRENT_USER failed"); + error = r1_ctx->ops->create_key(r1_ctx, key, "Network", NULL, NULL, &newkey); + torture_assert_werr_ok(tctx, error, "Opening HKCU\\Network failed"); + error = r1_ctx->ops->create_key(r1_ctx, newkey, "L", NULL, NULL, &newkey); + torture_assert_werr_ok(tctx, error, "Opening HKCU\\Network\\L failed"); + + error = r2_ctx->ops->get_predefined_key(r2_ctx, HKEY_LOCAL_MACHINE, &key); torture_assert_werr_ok(tctx, error, "Opening HKEY_LOCAL_MACHINE failed"); - error = r1_ctx->ops->create_key(r2_ctx, key, "Software", NULL, NULL, &newkey); + error = r2_ctx->ops->create_key(r2_ctx, key, "Software", NULL, NULL, &newkey); torture_assert_werr_ok(tctx, error, "Creating HKLM\\Sofware failed"); - error = r1_ctx->ops->create_key(r2_ctx, newkey, "Microsoft", NULL, NULL, &newkey); + error = r2_ctx->ops->create_key(r2_ctx, newkey, "Microsoft", NULL, NULL, &newkey); torture_assert_werr_ok(tctx, error, "Creating HKLM\\Software\\Microsoft failed"); - error = r1_ctx->ops->create_key(r2_ctx, newkey, "Windows", NULL, NULL, &newkey); + error = r2_ctx->ops->create_key(r2_ctx, newkey, "Windows", NULL, NULL, &newkey); torture_assert_werr_ok(tctx, error, "Creating HKLM\\Software\\Microsoft\\Windows failed"); - error = r1_ctx->ops->create_key(r2_ctx, newkey, "CurrentVersion", NULL, NULL, &newkey); + error = r2_ctx->ops->create_key(r2_ctx, newkey, "CurrentVersion", NULL, NULL, &newkey); torture_assert_werr_ok(tctx, error, "Creating HKLM\\..\\Windows\\CurrentVersion failed"); - error = r1_ctx->ops->create_key(r2_ctx, newkey, "Policies", NULL, NULL, &newkey); + error = r2_ctx->ops->create_key(r2_ctx, newkey, "Policies", NULL, NULL, &newkey); torture_assert_werr_ok(tctx, error, "Creating HKLM\\..\\CurrentVersion\\Policies failed"); - error = r1_ctx->ops->create_key(r2_ctx, newkey, "Explorer", NULL, NULL, &newkey); + error = r2_ctx->ops->create_key(r2_ctx, newkey, "Explorer", NULL, NULL, &newkey); torture_assert_werr_ok(tctx, error, "Creating HKLM\\..\\Policies\\Explorer failed"); + blob.data = (void *)talloc(r2_ctx, uint32_t); SIVAL(blob.data, 0, 0x03ffffff); blob.length = sizeof(uint32_t); -- cgit From f01c377bc039b776ded213f455cdb79d682ae7b2 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 15 Apr 2008 22:08:31 +0200 Subject: Fix formatting, remove unused function. (This used to be commit 6ec206ba58777395b2d1251680b21648f4c0f78e) --- source4/lib/registry/tests/diff.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/registry/tests/diff.c b/source4/lib/registry/tests/diff.c index 492f4de0b5..c7726545f6 100644 --- a/source4/lib/registry/tests/diff.c +++ b/source4/lib/registry/tests/diff.c @@ -37,11 +37,6 @@ struct diff_tcase_data { static bool test_generate_diff(struct torture_context *tctx, void *tcase_data) { - /* WERROR reg_generate_diff(struct registry_context *ctx1, - struct registry_context *ctx2, - const struct reg_diff_callbacks *callbacks, - void *callback_data) - */ WERROR error; struct diff_tcase_data *td = tcase_data; @@ -97,8 +92,6 @@ static bool test_diff_apply(struct torture_context *tctx, void *tcase_data) error = td->r1_ctx->ops->open_key(td->r1_ctx, key, "Explorer", &key); torture_assert_werr_ok(tctx, error, "Opening HKLM\\..\\Policies\\Explorer failed"); - - return true; } @@ -141,6 +134,7 @@ static bool test_generate_diff_key_null(struct torture_context *tctx, void *tcas return true; } + static void tcase_add_tests (struct torture_tcase *tcase) { torture_tcase_add_simple_test(tcase, "test_generate_diff_key_add", @@ -284,23 +278,18 @@ static bool diff_setup_dotreg_tcase (struct torture_context *tctx, void **data) return true; } -static bool diff_teardown_tcase (struct torture_context *tctx, void *data) -{ - /* Done is called by generate_diff itself! */ - return true; -} struct torture_suite *torture_registry_diff(TALLOC_CTX *mem_ctx) { struct torture_tcase *tcase; struct torture_suite *suite = torture_suite_create(mem_ctx, "DIFF"); tcase = torture_suite_add_tcase(suite, "PReg"); - torture_tcase_set_fixture(tcase, diff_setup_preg_tcase, diff_teardown_tcase); + torture_tcase_set_fixture(tcase, diff_setup_preg_tcase, NULL); tcase_add_tests(tcase); tcase = torture_suite_add_tcase(suite, "dotreg"); - torture_tcase_set_fixture(tcase, diff_setup_dotreg_tcase, diff_teardown_tcase); + torture_tcase_set_fixture(tcase, diff_setup_dotreg_tcase, NULL); tcase_add_tests(tcase); return suite; -- cgit From fd01b27edd5a83306f4ce567e31d43641dd003b8 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 15 Apr 2008 22:19:05 +0200 Subject: Fix const. (This used to be commit b74fc23825a54eb101b413ee76b21ee605dfb16c) --- source4/lib/registry/interface.c | 2 +- source4/lib/registry/patchfile_preg.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/registry/interface.c b/source4/lib/registry/interface.c index 06b002859d..0678af5237 100644 --- a/source4/lib/registry/interface.c +++ b/source4/lib/registry/interface.c @@ -284,7 +284,7 @@ _PUBLIC_ WERROR reg_key_flush(struct registry_key *key) } _PUBLIC_ WERROR reg_set_sec_desc(struct registry_key *key, - struct security_descriptor *security) + const struct security_descriptor *security) { if (key == NULL) return WERR_INVALID_PARAM; diff --git a/source4/lib/registry/patchfile_preg.c b/source4/lib/registry/patchfile_preg.c index c2bc8d10b3..bb46495c19 100644 --- a/source4/lib/registry/patchfile_preg.c +++ b/source4/lib/registry/patchfile_preg.c @@ -165,7 +165,7 @@ _PUBLIC_ WERROR reg_preg_diff_save(TALLOC_CTX *ctx, const char *filename, data->fd = STDOUT_FILENO; } - memcpy(preg_header.hdr, "PReg", 4); + strncpy(preg_header.hdr, "PReg", 4); SIVAL(&preg_header, 4, 1); write(data->fd, (uint8_t *)&preg_header,8); -- cgit From 2ef07ad551d398c39a595494aaa083a932ef79aa Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 16 Apr 2008 01:32:54 +0200 Subject: Remove unused arguments from reg_open_local(). (This used to be commit fee7ea7080ec40182efc6ffe57b267444eb9389a) --- source4/lib/registry/local.c | 9 +-- source4/lib/registry/registry.h | 4 +- source4/lib/registry/registry.i | 4 +- source4/lib/registry/registry.py | 2 +- source4/lib/registry/registry_wrap.c | 107 +++++++++++++++++----------------- source4/lib/registry/samba.c | 2 +- source4/lib/registry/tests/registry.c | 2 +- source4/lib/registry/tools/common.c | 2 +- source4/lib/registry/tools/regdiff.c | 2 +- 9 files changed, 63 insertions(+), 71 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/registry/local.c b/source4/lib/registry/local.c index 5bf2d86588..903bbb0b80 100644 --- a/source4/lib/registry/local.c +++ b/source4/lib/registry/local.c @@ -37,9 +37,6 @@ struct registry_local { struct hive_key *key; struct mountpoint *prev, *next; } *mountpoints; - - struct auth_session_info *session_info; - struct cli_credentials *credentials; }; struct local_key { @@ -294,9 +291,7 @@ const static struct registry_operations local_ops = { .get_key_info = local_get_key_info, }; -WERROR reg_open_local(TALLOC_CTX *mem_ctx, struct registry_context **ctx, - struct auth_session_info *session_info, - struct cli_credentials *credentials) +WERROR reg_open_local(TALLOC_CTX *mem_ctx, struct registry_context **ctx) { struct registry_local *ret = talloc_zero(mem_ctx, struct registry_local); @@ -304,8 +299,6 @@ WERROR reg_open_local(TALLOC_CTX *mem_ctx, struct registry_context **ctx, W_ERROR_HAVE_NO_MEMORY(ret); ret->ops = &local_ops; - ret->session_info = session_info; - ret->credentials = credentials; *ctx = (struct registry_context *)ret; diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index a86294bf46..d4c4a89c20 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -355,9 +355,7 @@ struct loadparm_context; * Open the locally defined registry. */ WERROR reg_open_local(TALLOC_CTX *mem_ctx, - struct registry_context **ctx, - struct auth_session_info *session_info, - struct cli_credentials *credentials); + struct registry_context **ctx); WERROR reg_open_samba(TALLOC_CTX *mem_ctx, struct registry_context **ctx, diff --git a/source4/lib/registry/registry.i b/source4/lib/registry/registry.i index 8ab402d57d..1b3c1c281a 100644 --- a/source4/lib/registry/registry.i +++ b/source4/lib/registry/registry.i @@ -57,9 +57,7 @@ const char *str_regtype(int type); } %rename(Registry) reg_open_local; -WERROR reg_open_local(TALLOC_CTX *parent_ctx, struct registry_context **ctx, - struct auth_session_info *session_info, - struct cli_credentials *credentials); +WERROR reg_open_local(TALLOC_CTX *parent_ctx, struct registry_context **ctx); %typemap(in,noblock=1) const char ** { /* Check if is a list */ diff --git a/source4/lib/registry/registry.py b/source4/lib/registry/registry.py index bf8ac60498..9dab309f33 100644 --- a/source4/lib/registry/registry.py +++ b/source4/lib/registry/registry.py @@ -1,5 +1,5 @@ # This file was automatically generated by SWIG (http://www.swig.org). -# Version 1.3.33 +# Version 1.3.35 # # Don't modify this file, modify the SWIG interface instead. diff --git a/source4/lib/registry/registry_wrap.c b/source4/lib/registry/registry_wrap.c index da09ecbe08..4879b2e144 100644 --- a/source4/lib/registry/registry_wrap.c +++ b/source4/lib/registry/registry_wrap.c @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 1.3.33 + * Version 1.3.35 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make @@ -126,7 +126,7 @@ /* This should only be incremented when either the layout of swig_type_info changes, or for whatever reason, the runtime changes incompatibly */ -#define SWIG_RUNTIME_VERSION "3" +#define SWIG_RUNTIME_VERSION "4" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE @@ -161,6 +161,7 @@ /* Flags for pointer conversions */ #define SWIG_POINTER_DISOWN 0x1 +#define SWIG_CAST_NEW_MEMORY 0x2 /* Flags for new pointer objects */ #define SWIG_POINTER_OWN 0x1 @@ -301,10 +302,10 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) { extern "C" { #endif -typedef void *(*swig_converter_func)(void *); +typedef void *(*swig_converter_func)(void *, int *); typedef struct swig_type_info *(*swig_dycast_func)(void **); -/* Structure to store inforomation on one type */ +/* Structure to store information on one type */ typedef struct swig_type_info { const char *name; /* mangled name of this type */ const char *str; /* human readable name of this type */ @@ -431,8 +432,8 @@ SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) { Cast a pointer up an inheritance hierarchy */ SWIGRUNTIMEINLINE void * -SWIG_TypeCast(swig_cast_info *ty, void *ptr) { - return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr); +SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { + return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); } /* @@ -856,7 +857,7 @@ SWIG_Python_AddErrorMsg(const char* mesg) Py_DECREF(old_str); Py_DECREF(value); } else { - PyErr_Format(PyExc_RuntimeError, mesg); + PyErr_SetString(PyExc_RuntimeError, mesg); } } @@ -1416,7 +1417,7 @@ PySwigObject_dealloc(PyObject *v) { PySwigObject *sobj = (PySwigObject *) v; PyObject *next = sobj->next; - if (sobj->own) { + if (sobj->own == SWIG_POINTER_OWN) { swig_type_info *ty = sobj->ty; PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0; PyObject *destroy = data ? data->destroy : 0; @@ -1434,12 +1435,13 @@ PySwigObject_dealloc(PyObject *v) res = ((*meth)(mself, v)); } Py_XDECREF(res); - } else { - const char *name = SWIG_TypePrettyName(ty); + } #if !defined(SWIG_PYTHON_SILENT_MEMLEAK) - printf("swig/python detected a memory leak of type '%s', no destructor found.\n", name); -#endif + else { + const char *name = SWIG_TypePrettyName(ty); + printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown")); } +#endif } Py_XDECREF(next); PyObject_DEL(v); @@ -1944,7 +1946,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) SWIGRUNTIME int SWIG_Python_AcquirePtr(PyObject *obj, int own) { - if (own) { + if (own == SWIG_POINTER_OWN) { PySwigObject *sobj = SWIG_Python_GetSwigThis(obj); if (sobj) { int oldown = sobj->own; @@ -1965,6 +1967,8 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int return SWIG_OK; } else { PySwigObject *sobj = SWIG_Python_GetSwigThis(obj); + if (own) + *own = 0; while (sobj) { void *vptr = sobj->ptr; if (ty) { @@ -1978,7 +1982,15 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int if (!tc) { sobj = (PySwigObject *)sobj->next; } else { - if (ptr) *ptr = SWIG_TypeCast(tc,vptr); + if (ptr) { + int newmemory = 0; + *ptr = SWIG_TypeCast(tc,vptr,&newmemory); + if (newmemory == SWIG_CAST_NEW_MEMORY) { + assert(own); + if (own) + *own = *own | SWIG_CAST_NEW_MEMORY; + } + } break; } } @@ -1988,7 +2000,8 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int } } if (sobj) { - if (own) *own = sobj->own; + if (own) + *own = *own | sobj->own; if (flags & SWIG_POINTER_DISOWN) { sobj->own = 0; } @@ -2053,8 +2066,13 @@ SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) { } if (ty) { swig_cast_info *tc = SWIG_TypeCheck(desc,ty); - if (!tc) return SWIG_ERROR; - *ptr = SWIG_TypeCast(tc,vptr); + if (tc) { + int newmemory = 0; + *ptr = SWIG_TypeCast(tc,vptr,&newmemory); + assert(!newmemory); /* newmemory handling not yet implemented */ + } else { + return SWIG_ERROR; + } } else { *ptr = vptr; } @@ -2514,7 +2532,7 @@ static swig_module_info swig_module = {swig_types, 25, 0, 0, 0, 0}; #define SWIG_name "_registry" -#define SWIGVERSION 0x010333 +#define SWIGVERSION 0x010335 #define SWIG_VERSION SWIGVERSION @@ -2910,44 +2928,17 @@ fail: } -SWIGINTERN PyObject *_wrap_Registry(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_Registry(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; TALLOC_CTX *arg1 = (TALLOC_CTX *) 0 ; struct registry_context **arg2 = (struct registry_context **) 0 ; - struct auth_session_info *arg3 = (struct auth_session_info *) 0 ; - struct cli_credentials *arg4 = (struct cli_credentials *) 0 ; WERROR result; struct registry_context *tmp2 ; - void *argp3 = 0 ; - int res3 = 0 ; - void *argp4 = 0 ; - int res4 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char * kwnames[] = { - (char *) "session_info",(char *) "credentials", NULL - }; - arg3 = NULL; - arg4 = NULL; arg1 = NULL; arg2 = &tmp2; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OO:Registry",kwnames,&obj0,&obj1)) SWIG_fail; - if (obj0) { - res3 = SWIG_ConvertPtr(obj0, &argp3,SWIGTYPE_p_auth_session_info, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Registry" "', argument " "3"" of type '" "struct auth_session_info *""'"); - } - arg3 = (struct auth_session_info *)(argp3); - } - if (obj1) { - res4 = SWIG_ConvertPtr(obj1, &argp4,SWIGTYPE_p_cli_credentials, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "Registry" "', argument " "4"" of type '" "struct cli_credentials *""'"); - } - arg4 = (struct cli_credentials *)(argp4); - } - result = reg_open_local(arg1,arg2,arg3,arg4); + if (!SWIG_Python_UnpackTuple(args,"Registry",0,0,0)) SWIG_fail; + result = reg_open_local(arg1,arg2); if (!W_ERROR_IS_OK(result)) { PyObject *obj = Py_BuildValue((char *)"(i,s)", W_ERROR_V(result), win_errstr(result)); PyErr_SetObject(PyExc_RuntimeError, obj); @@ -3410,7 +3401,10 @@ check_1: } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'reg_mount_hive'.\n Possible C/C++ prototypes are:\n"" mount_hive(reg *,struct hive_key *,uint32_t,char const **)\n"" mount_hive(reg *,struct hive_key *,char const *)\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'reg_mount_hive'.\n" + " Possible C/C++ prototypes are:\n" + " mount_hive(reg *,struct hive_key *,uint32_t,char const **)\n" + " mount_hive(reg *,struct hive_key *,char const *)\n"); return NULL; } @@ -3420,7 +3414,7 @@ SWIGINTERN PyObject *_wrap_new_reg(PyObject *SWIGUNUSEDPARM(self), PyObject *arg reg *result = 0 ; if (!SWIG_Python_UnpackTuple(args,"new_reg",0,0,0)) SWIG_fail; - result = (reg *)(reg *) calloc(1, sizeof(reg)); + result = (reg *)calloc(1, sizeof(reg)); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_registry_context, SWIG_POINTER_NEW | 0 ); return resultobj; fail: @@ -3765,7 +3759,7 @@ fail: static PyMethodDef SwigMethods[] = { { (char *)"reg_get_predef_name", (PyCFunction) _wrap_reg_get_predef_name, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"str_regtype", (PyCFunction) _wrap_str_regtype, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"Registry", (PyCFunction) _wrap_Registry, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"Registry", (PyCFunction)_wrap_Registry, METH_NOARGS, NULL}, { (char *)"reg_get_predefined_key_by_name", (PyCFunction) _wrap_reg_get_predefined_key_by_name, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"reg_key_del_abs", (PyCFunction) _wrap_reg_key_del_abs, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"reg_get_predefined_key", (PyCFunction) _wrap_reg_get_predefined_key, METH_VARARGS | METH_KEYWORDS, NULL}, @@ -3962,7 +3956,7 @@ SWIGRUNTIME void SWIG_InitializeModule(void *clientdata) { size_t i; swig_module_info *module_head, *iter; - int found; + int found, init; clientdata = clientdata; @@ -3972,6 +3966,9 @@ SWIG_InitializeModule(void *clientdata) { swig_module.type_initial = swig_type_initial; swig_module.cast_initial = swig_cast_initial; swig_module.next = &swig_module; + init = 1; + } else { + init = 0; } /* Try and load any already created modules */ @@ -4000,6 +3997,12 @@ SWIG_InitializeModule(void *clientdata) { module_head->next = &swig_module; } + /* When multiple interpeters are used, a module could have already been initialized in + a different interpreter, but not yet have a pointer in this interpreter. + In this case, we do not want to continue adding types... everything should be + set up already */ + if (init == 0) return; + /* Now work on filling in swig_module.types */ #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: size %d\n", swig_module.size); diff --git a/source4/lib/registry/samba.c b/source4/lib/registry/samba.c index 599385e73c..59693dde8e 100644 --- a/source4/lib/registry/samba.c +++ b/source4/lib/registry/samba.c @@ -61,7 +61,7 @@ _PUBLIC_ WERROR reg_open_samba(TALLOC_CTX *mem_ctx, { WERROR result; - result = reg_open_local(mem_ctx, ctx, session_info, credentials); + result = reg_open_local(mem_ctx, ctx); if (!W_ERROR_IS_OK(result)) { return result; } diff --git a/source4/lib/registry/tests/registry.c b/source4/lib/registry/tests/registry.c index b19a6abffb..33512a0c8c 100644 --- a/source4/lib/registry/tests/registry.c +++ b/source4/lib/registry/tests/registry.c @@ -517,7 +517,7 @@ static bool setup_local_registry(struct torture_context *tctx, void **data) struct hive_key *hive_key; const char *filename; - error = reg_open_local(tctx, &rctx, NULL, NULL); + error = reg_open_local(tctx, &rctx); torture_assert_werr_ok(tctx, error, "Opening local registry failed"); status = torture_temp_dir(tctx, "registry-local", &tempdir); diff --git a/source4/lib/registry/tools/common.c b/source4/lib/registry/tools/common.c index cec0f8b906..52f3c6f551 100644 --- a/source4/lib/registry/tools/common.c +++ b/source4/lib/registry/tools/common.c @@ -57,7 +57,7 @@ struct registry_key *reg_common_open_file(const char *path, return NULL; } - error = reg_open_local(NULL, &h, NULL, creds); + error = reg_open_local(NULL, &h); if (!W_ERROR_IS_OK(error)) { fprintf(stderr, "Unable to initialize local registry: %s\n", win_errstr(error)); diff --git a/source4/lib/registry/tools/regdiff.c b/source4/lib/registry/tools/regdiff.c index c94380efd2..69fcfc2493 100644 --- a/source4/lib/registry/tools/regdiff.c +++ b/source4/lib/registry/tools/regdiff.c @@ -48,7 +48,7 @@ static struct registry_context *open_backend(poptContext pc, remote_host, NULL); break; case REG_NULL: - error = reg_open_local(NULL, &ctx, NULL, cmdline_credentials); + error = reg_open_local(NULL, &ctx); break; } -- cgit From 8eaf64b47b775a9f71ae6052d5199e5c8a697226 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 16 Apr 2008 09:02:12 +0200 Subject: Now that we don't create a new event context, don't free it. This previously would free the torture provided global event context. Andrew Bartlett (This used to be commit 664f2fc49f32a081f14638571ee0db01a7863347) --- source4/lib/messaging/tests/messaging.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/messaging/tests/messaging.c b/source4/lib/messaging/tests/messaging.c index 45b573518c..f66b3a5b43 100644 --- a/source4/lib/messaging/tests/messaging.c +++ b/source4/lib/messaging/tests/messaging.c @@ -134,7 +134,6 @@ static bool test_ping_speed(struct torture_context *tctx) talloc_free(msg_client_ctx); talloc_free(msg_server_ctx); - talloc_free(ev); return true; } -- cgit From 68b2d9372f8b0450eea7ac4601fc1315192d878f Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 16 Apr 2008 14:41:42 +0200 Subject: Remove policy library - it's now in a separate git repository. (This used to be commit 9b364bf390524fa34db1b3d7e6f875a6b8f35f24) --- source4/lib/basic.mk | 1 - source4/lib/policy/adm.h | 47 - source4/lib/policy/config.mk | 14 - source4/lib/policy/dumpadm.c | 54 -- source4/lib/policy/lex.c | 2085 ---------------------------------------- source4/lib/policy/lex.l | 142 --- source4/lib/policy/parse_adm.c | 1726 --------------------------------- source4/lib/policy/parse_adm.h | 135 --- source4/lib/policy/parse_adm.y | 138 --- 9 files changed, 4342 deletions(-) delete mode 100644 source4/lib/policy/adm.h delete mode 100644 source4/lib/policy/config.mk delete mode 100644 source4/lib/policy/dumpadm.c delete mode 100644 source4/lib/policy/lex.c delete mode 100644 source4/lib/policy/lex.l delete mode 100644 source4/lib/policy/parse_adm.c delete mode 100644 source4/lib/policy/parse_adm.h delete mode 100644 source4/lib/policy/parse_adm.y (limited to 'source4/lib') diff --git a/source4/lib/basic.mk b/source4/lib/basic.mk index a02151282c..71acb94492 100644 --- a/source4/lib/basic.mk +++ b/source4/lib/basic.mk @@ -5,7 +5,6 @@ mkinclude charset/config.mk mkinclude ldb-samba/config.mk mkinclude tls/config.mk mkinclude registry/config.mk -mkinclude policy/config.mk mkinclude messaging/config.mk mkinclude events/config.mk mkinclude cmdline/config.mk diff --git a/source4/lib/policy/adm.h b/source4/lib/policy/adm.h deleted file mode 100644 index c541ced6ff..0000000000 --- a/source4/lib/policy/adm.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - Unix SMB/CIFS implementation. - Copyright (C) 2006 Wilco Baan Hofman - Copyright (C) 2006 Jelmer Vernooij - - 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, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#ifndef __ADM_H__ -#define __ADM_H__ - -struct adm_file { - struct adm_class *classes; -}; - -struct adm_class { - struct adm_category *categories; -}; - -struct adm_category { - struct adm_category *subcategories; - struct adm_policy *policies; -}; - -struct adm_policy { - struct adm_part *parts; -}; - -struct adm_part { - int dummy; -}; - -struct adm_file *adm_read_file(const char *); - -#endif /* __ADM_H__ */ diff --git a/source4/lib/policy/config.mk b/source4/lib/policy/config.mk deleted file mode 100644 index 9a8e60bfbe..0000000000 --- a/source4/lib/policy/config.mk +++ /dev/null @@ -1,14 +0,0 @@ -[SUBSYSTEM::LIBPOLICY] -CFLAGS = -Iheimdal/lib/roken -PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL LIBSAMBA-HOSTCONFIG LIBTALLOC CHARSET - -LIBPOLICY_OBJ_FILES = lib/policy/lex.o lib/policy/parse_adm.o - -lib/policy/lex.l: lib/policy/parse_adm.h - -lib/policy/parse_adm.h: lib/policy/parse_adm.c - -[BINARY::dumpadm] -PRIVATE_DEPENDENCIES = LIBPOLICY LIBPOPT LIBSAMBA-HOSTCONFIG LIBTALLOC LIBSAMBA-UTIL CHARSET - -dumpadm_OBJ_FILES = lib/policy/dumpadm.o diff --git a/source4/lib/policy/dumpadm.c b/source4/lib/policy/dumpadm.c deleted file mode 100644 index 2ed5abf111..0000000000 --- a/source4/lib/policy/dumpadm.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - Unix SMB/CIFS implementation. - Copyright (C) 2006 Wilco Baan Hofman - Copyright (C) 2006 Jelmer Vernooij - - 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, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include "includes.h" -#include "lib/popt/popt.h" -#include "lib/policy/adm.h" - -int main(int argc, char **argv) -{ - bool ret = true; - poptContext pc; - struct poptOption long_options[] = { - POPT_AUTOHELP - { 0, 0, 0, 0 } - }; - - pc = poptGetContext(argv[0], argc, (const char **)argv, long_options, 0); - - poptSetOtherOptionHelp(pc, " ..."); - - while ((poptGetNextOpt(pc) != -1)) - - if(!poptPeekArg(pc)) { - poptPrintUsage(pc, stderr, 0); - exit(1); - } - - while (poptPeekArg(pc)) { - const char *name = poptGetArg(pc); - - adm_read_file(name); - } - - poptFreeContext(pc); - - return ret; -} diff --git a/source4/lib/policy/lex.c b/source4/lib/policy/lex.c deleted file mode 100644 index 6d524445c9..0000000000 --- a/source4/lib/policy/lex.c +++ /dev/null @@ -1,2085 +0,0 @@ -#include "config.h" - -#line 3 "lex.yy.c" - -#define YY_INT_ALIGNED short int - -/* A lexical scanner generated by flex */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 33 -#if YY_FLEX_SUBMINOR_VERSION > 0 -#define FLEX_BETA -#endif - -/* First, we deal with platform-specific or compiler-specific issues. */ - -/* begin standard C headers. */ -#include -#include -#include -#include - -/* end standard C headers. */ - -/* flex integer type definitions */ - -#ifndef FLEXINT_H -#define FLEXINT_H - -/* C99 systems have . Non-C99 systems may or may not. */ - -#if __STDC_VERSION__ >= 199901L - -/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, - * if you want the limit (max/min) macros for int types. - */ -#ifndef __STDC_LIMIT_MACROS -#define __STDC_LIMIT_MACROS 1 -#endif - -#include -typedef int8_t flex_int8_t; -typedef uint8_t flex_uint8_t; -typedef int16_t flex_int16_t; -typedef uint16_t flex_uint16_t; -typedef int32_t flex_int32_t; -typedef uint32_t flex_uint32_t; -#else -typedef signed char flex_int8_t; -typedef short int flex_int16_t; -typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; -typedef unsigned short int flex_uint16_t; -typedef unsigned int flex_uint32_t; -#endif /* ! C99 */ - -/* Limits of integral types. */ -#ifndef INT8_MIN -#define INT8_MIN (-128) -#endif -#ifndef INT16_MIN -#define INT16_MIN (-32767-1) -#endif -#ifndef INT32_MIN -#define INT32_MIN (-2147483647-1) -#endif -#ifndef INT8_MAX -#define INT8_MAX (127) -#endif -#ifndef INT16_MAX -#define INT16_MAX (32767) -#endif -#ifndef INT32_MAX -#define INT32_MAX (2147483647) -#endif -#ifndef UINT8_MAX -#define UINT8_MAX (255U) -#endif -#ifndef UINT16_MAX -#define UINT16_MAX (65535U) -#endif -#ifndef UINT32_MAX -#define UINT32_MAX (4294967295U) -#endif - -#endif /* ! FLEXINT_H */ - -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -#if __STDC__ - -#define YY_USE_CONST - -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN (yy_start) = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START (((yy_start) - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart(yyin ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#ifndef YY_BUF_SIZE -#define YY_BUF_SIZE 16384 -#endif - -/* The state buf must be large enough to hold one state per character in the main buffer. - */ -#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) - -#ifndef YY_TYPEDEF_YY_BUFFER_STATE -#define YY_TYPEDEF_YY_BUFFER_STATE -typedef struct yy_buffer_state *YY_BUFFER_STATE; -#endif - -extern int yyleng; - -extern FILE *yyin, *yyout; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - - #define YY_LESS_LINENO(n) - -/* Return all but the first "n" matched characters back to the input stream. */ -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - *yy_cp = (yy_hold_char); \ - YY_RESTORE_YY_MORE_OFFSET \ - (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) - -#define unput(c) yyunput( c, (yytext_ptr) ) - -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ - -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef unsigned int yy_size_t; -#endif - -#ifndef YY_STRUCT_YY_BUFFER_STATE -#define YY_STRUCT_YY_BUFFER_STATE -struct yy_buffer_state - { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - int yy_bs_lineno; /**< The line count. */ - int yy_bs_column; /**< The column count. */ - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; - -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - - }; -#endif /* !YY_STRUCT_YY_BUFFER_STATE */ - -/* Stack of input buffers. */ -static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ -static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - * - * Returns the top of the stack, or NULL. - */ -#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ - ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ - : NULL) - -/* Same as previous macro, but useful when we know that the buffer stack is not - * NULL or when we need an lvalue. For internal use only. - */ -#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] - -/* yy_hold_char holds the character lost when yytext is formed. */ -static char yy_hold_char; -static int yy_n_chars; /* number of characters read into yy_ch_buf */ -int yyleng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; -static int yy_init = 0; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; - -void yyrestart (FILE *input_file ); -void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); -void yy_delete_buffer (YY_BUFFER_STATE b ); -void yy_flush_buffer (YY_BUFFER_STATE b ); -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); -void yypop_buffer_state (void ); - -static void yyensure_buffer_stack (void ); -static void yy_load_buffer_state (void ); -static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); - -#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) - -YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); -YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); - -void *yyalloc (yy_size_t ); -void *yyrealloc (void *,yy_size_t ); -void yyfree (void * ); - -#define yy_new_buffer yy_create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! YY_CURRENT_BUFFER ){ \ - yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! YY_CURRENT_BUFFER ){\ - yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) - -/* Begin user sect3 */ - -typedef unsigned char YY_CHAR; - -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 - -static yy_state_type yy_get_previous_state (void ); -static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); -static int yy_get_next_buffer (void ); -static void yy_fatal_error (yyconst char msg[] ); - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - (yytext_ptr) = yy_bp; \ - yyleng = (size_t) (yy_cp - yy_bp); \ - (yy_hold_char) = *yy_cp; \ - *yy_cp = '\0'; \ - (yy_c_buf_p) = yy_cp; - -#define YY_NUM_RULES 38 -#define YY_END_OF_BUFFER 39 -/* This struct is not used in this scanner, - but its presence is necessary. */ -struct yy_trans_info - { - flex_int32_t yy_verify; - flex_int32_t yy_nxt; - }; -static yyconst flex_int16_t yy_accept[185] = - { 0, - 0, 0, 39, 38, 34, 35, 38, 38, 31, 38, - 29, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 38, 34, 0, 0, - 31, 0, 36, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 0, 33, 37, - 32, 32, 32, 32, 32, 32, 32, 32, 9, 32, - 32, 32, 32, 15, 14, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 0, 33, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 16, - - 32, 18, 32, 32, 21, 32, 23, 24, 32, 0, - 32, 32, 32, 4, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 25, 0, 32, 32, - 32, 32, 5, 32, 32, 32, 32, 32, 32, 32, - 19, 32, 32, 32, 32, 0, 32, 32, 32, 6, - 32, 32, 10, 32, 12, 13, 17, 32, 32, 32, - 32, 27, 0, 32, 2, 3, 32, 8, 11, 20, - 32, 32, 28, 0, 32, 32, 22, 26, 30, 1, - 32, 32, 7, 0 - } ; - -static yyconst flex_int32_t yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 4, 5, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 6, 1, 1, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 1, 8, 1, - 9, 1, 1, 1, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 34, 19, - 35, 36, 37, 1, 6, 1, 19, 19, 19, 19, - - 19, 19, 38, 19, 39, 19, 19, 19, 19, 40, - 19, 19, 19, 41, 42, 43, 19, 19, 19, 19, - 19, 19, 36, 1, 36, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; - -static yyconst flex_int32_t yy_meta[44] = - { 0, - 1, 1, 2, 1, 1, 3, 3, 1, 1, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 1, 5, 1, 4, 4, 4, - 4, 4, 4 - } ; - -static yyconst flex_int16_t yy_base[190] = - { 0, - 0, 0, 213, 214, 210, 214, 207, 0, 203, 206, - 214, 196, 0, 34, 31, 33, 178, 192, 39, 37, - 38, 191, 29, 190, 175, 192, 159, 198, 0, 196, - 191, 194, 214, 0, 167, 166, 180, 183, 48, 168, - 173, 177, 164, 174, 153, 38, 163, 163, 162, 156, - 161, 155, 162, 154, 145, 163, 155, 132, 0, 214, - 156, 159, 160, 143, 160, 155, 143, 138, 0, 145, - 143, 141, 146, 0, 0, 148, 147, 131, 141, 128, - 134, 131, 126, 127, 123, 111, 0, 127, 134, 129, - 120, 117, 117, 132, 115, 133, 121, 131, 122, 0, - - 112, 0, 126, 119, 0, 112, 0, 0, 121, 95, - 110, 108, 120, 0, 109, 115, 104, 113, 108, 107, - 102, 100, 104, 87, 93, 92, 29, 78, 96, 89, - 91, 85, 0, 81, 79, 88, 82, 95, 94, 95, - 0, 92, 76, 94, 45, 65, 84, 67, 67, 0, - 76, 69, 0, 68, 0, 0, 0, 83, 81, 72, - 78, 0, 50, 63, 0, 0, 69, 0, 0, 0, - 76, 74, 0, 50, 44, 52, 0, 0, 214, 0, - 37, 35, 0, 214, 71, 76, 79, 57, 82 - } ; - -static yyconst flex_int16_t yy_def[190] = - { 0, - 184, 1, 184, 184, 184, 184, 184, 185, 184, 186, - 184, 187, 187, 187, 187, 187, 187, 187, 187, 187, - 187, 187, 187, 187, 187, 187, 184, 184, 188, 185, - 184, 186, 184, 187, 187, 187, 187, 187, 187, 187, - 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, - 187, 187, 187, 187, 187, 187, 187, 184, 189, 184, - 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, - 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, - 187, 187, 187, 187, 187, 184, 189, 187, 187, 187, - 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, - - 187, 187, 187, 187, 187, 187, 187, 187, 187, 184, - 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, - 187, 187, 187, 187, 187, 187, 187, 184, 187, 187, - 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, - 187, 187, 187, 187, 187, 184, 187, 187, 187, 187, - 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, - 187, 187, 184, 187, 187, 187, 187, 187, 187, 187, - 187, 187, 187, 184, 187, 187, 187, 187, 184, 187, - 187, 187, 187, 0, 184, 184, 184, 184, 184 - } ; - -static yyconst flex_int16_t yy_nxt[258] = - { 0, - 4, 5, 6, 7, 8, 4, 9, 10, 11, 12, - 13, 14, 15, 16, 13, 13, 13, 17, 13, 18, - 13, 19, 20, 13, 21, 13, 22, 23, 24, 25, - 26, 13, 13, 13, 27, 13, 4, 13, 13, 13, - 13, 13, 13, 36, 39, 41, 48, 50, 46, 73, - 37, 144, 145, 53, 38, 42, 47, 40, 54, 161, - 59, 51, 65, 183, 182, 43, 49, 162, 66, 181, - 74, 30, 180, 30, 30, 30, 32, 32, 32, 32, - 32, 34, 34, 34, 87, 87, 179, 178, 177, 176, - 175, 174, 173, 172, 171, 170, 169, 168, 167, 166, - - 165, 164, 163, 160, 159, 158, 157, 156, 155, 154, - 153, 152, 151, 150, 149, 148, 147, 146, 143, 142, - 141, 140, 139, 138, 137, 136, 135, 134, 133, 132, - 131, 130, 129, 128, 127, 126, 125, 124, 123, 122, - 121, 120, 119, 118, 117, 116, 115, 114, 113, 112, - 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, - 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, - 91, 90, 89, 88, 86, 85, 84, 83, 82, 81, - 80, 79, 78, 77, 76, 75, 72, 71, 70, 69, - 68, 67, 64, 63, 62, 61, 33, 31, 60, 28, - - 58, 57, 56, 55, 52, 45, 44, 35, 33, 31, - 29, 28, 184, 3, 184, 184, 184, 184, 184, 184, - 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, - 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, - 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, - 184, 184, 184, 184, 184, 184, 184 - } ; - -static yyconst flex_int16_t yy_chk[258] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 14, 15, 16, 20, 21, 19, 46, - 14, 127, 127, 23, 14, 16, 19, 15, 23, 145, - 188, 21, 39, 182, 181, 16, 20, 145, 39, 176, - 46, 185, 175, 185, 185, 185, 186, 186, 186, 186, - 186, 187, 187, 187, 189, 189, 174, 172, 171, 167, - 164, 163, 161, 160, 159, 158, 154, 152, 151, 149, - - 148, 147, 146, 144, 143, 142, 140, 139, 138, 137, - 136, 135, 134, 132, 131, 130, 129, 128, 126, 125, - 124, 123, 122, 121, 120, 119, 118, 117, 116, 115, - 113, 112, 111, 110, 109, 106, 104, 103, 101, 99, - 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, - 88, 86, 85, 84, 83, 82, 81, 80, 79, 78, - 77, 76, 73, 72, 71, 70, 68, 67, 66, 65, - 64, 63, 62, 61, 58, 57, 56, 55, 54, 53, - 52, 51, 50, 49, 48, 47, 45, 44, 43, 42, - 41, 40, 38, 37, 36, 35, 32, 31, 30, 28, - - 27, 26, 25, 24, 22, 18, 17, 12, 10, 9, - 7, 5, 3, 184, 184, 184, 184, 184, 184, 184, - 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, - 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, - 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, - 184, 184, 184, 184, 184, 184, 184 - } ; - -static yy_state_type yy_last_accepting_state; -static char *yy_last_accepting_cpos; - -extern int yy_flex_debug; -int yy_flex_debug = 0; - -/* The intent behind this definition is that it'll catch - * any uses of REJECT which flex missed. - */ -#define REJECT reject_used_but_not_detected -#define yymore() yymore_used_but_not_detected -#define YY_MORE_ADJ 0 -#define YY_RESTORE_YY_MORE_OFFSET -char *yytext; -#line 1 "lex.l" -/* - Unix SMB/CIFS implementation. - Copyright (C) 2006 Wilco Baan Hofman - Copyright (C) 2006 Jelmer Vernooij - - 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, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ -#line 23 "lex.l" -#include "includes.h" -#include "lib/policy/parse_adm.h" -#include "param/param.h" -void error_message (const char *format, ...); -int yyparse (void); - -static int lineno = 1; -static bool utf16 = false; - -#define YY_INPUT(buf,result,max_size) \ -{ \ - if (utf16) { \ - uint16_t v; \ - if (fread(&v, 2, 1, yyin) < 1) \ - result = YY_NULL; \ - else \ - result = push_codepoint(lp_iconv_convenience(global_loadparm), buf, v); \ - } else { \ - int c = getc(yyin); \ - result = (c == EOF) ? YY_NULL : (buf[0] = c, 1); \ - } \ -} - -#line 610 "lex.yy.c" - -#define INITIAL 0 - -#ifndef YY_NO_UNISTD_H -/* Special case for "unistd.h", since it is non-ANSI. We include it way - * down here because we want the user's section 1 to have been scanned first. - * The user has a chance to override it with an option. - */ -#include -#endif - -#ifndef YY_EXTRA_TYPE -#define YY_EXTRA_TYPE void * -#endif - -static int yy_init_globals (void ); - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int yywrap (void ); -#else -extern int yywrap (void ); -#endif -#endif - - static void yyunput (int c,char *buf_ptr ); - -#ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ); -#endif - -#ifndef YY_NO_INPUT - -#ifdef __cplusplus -static int yyinput (void ); -#else -static int input (void ); -#endif - -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#define YY_READ_BUF_SIZE 8192 -#endif - -/* Copy whatever the last rule matched to the standard output. */ -#ifndef ECHO -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ - if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ - { \ - int c = '*'; \ - size_t n; \ - for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else \ - { \ - errno=0; \ - while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ - { \ - if( errno != EINTR) \ - { \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - break; \ - } \ - errno=0; \ - clearerr(yyin); \ - } \ - }\ -\ - -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -#endif - -/* end tables serialization structures and prototypes */ - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL_IS_OURS 1 - -extern int yylex (void); - -#define YY_DECL int yylex (void) -#endif /* !YY_DECL */ - -/* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK break; -#endif - -#define YY_RULE_SETUP \ - YY_USER_ACTION - -/** The main scanner function which does all the work. - */ -YY_DECL -{ - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; - -#line 47 "lex.l" - - -#line 766 "lex.yy.c" - - if ( !(yy_init) ) - { - (yy_init) = 1; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! (yy_start) ) - (yy_start) = 1; /* first start state */ - - if ( ! yyin ) - yyin = stdin; - - if ( ! yyout ) - yyout = stdout; - - if ( ! YY_CURRENT_BUFFER ) { - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); - } - - yy_load_buffer_state( ); - } - - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = (yy_c_buf_p); - - /* Support of yytext. */ - *yy_cp = (yy_hold_char); - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - - yy_current_state = (yy_start); -yy_match: - do - { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 185 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 214 ); - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - yy_act = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - -do_action: /* This label is used only to access EOF actions. */ - - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = (yy_hold_char); - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - goto yy_find_action; - -case 1: -YY_RULE_SETUP -#line 49 "lex.l" -{ return ACTIONLIST; } - YY_BREAK -case 2: -YY_RULE_SETUP -#line 50 "lex.l" -{ return CATEGORY; } - YY_BREAK -case 3: -YY_RULE_SETUP -#line 51 "lex.l" -{ return CHECKBOX; } - YY_BREAK -case 4: -YY_RULE_SETUP -#line 52 "lex.l" -{ return CLASS; } - YY_BREAK -case 5: -YY_RULE_SETUP -#line 53 "lex.l" -{ return DEL; } - YY_BREAK -case 6: -YY_RULE_SETUP -#line 54 "lex.l" -{ return DEFAULT; } - YY_BREAK -case 7: -YY_RULE_SETUP -#line 55 "lex.l" -{ return DROPDOWNLIST; } - YY_BREAK -case 8: -YY_RULE_SETUP -#line 56 "lex.l" -{ return EDITTEXT; } - YY_BREAK -case 9: -YY_RULE_SETUP -#line 57 "lex.l" -{ return END; } - YY_BREAK -case 10: -YY_RULE_SETUP -#line 58 "lex.l" -{ return EXPLAIN; } - YY_BREAK -case 11: -YY_RULE_SETUP -#line 59 "lex.l" -{ return ITEMLIST; } - YY_BREAK -case 12: -YY_RULE_SETUP -#line 60 "lex.l" -{ return KEYNAME; } - YY_BREAK -case 13: -YY_RULE_SETUP -#line 61 "lex.l" -{ return CLASS_MACHINE; } - YY_BREAK -case 14: -YY_RULE_SETUP -#line 62 "lex.l" -{ return MINIMUM; } - YY_BREAK -case 15: -YY_RULE_SETUP -#line 63 "lex.l" -{ return MAXIMUM; } - YY_BREAK -case 16: -YY_RULE_SETUP -#line 64 "lex.l" -{ return NAME; } - YY_BREAK -case 17: -YY_RULE_SETUP -#line 65 "lex.l" -{ return NUMERIC; } - YY_BREAK -case 18: -YY_RULE_SETUP -#line 66 "lex.l" -{ return PART; } - YY_BREAK -case 19: -YY_RULE_SETUP -#line 67 "lex.l" -{ return POLICY; } - YY_BREAK -case 20: -YY_RULE_SETUP -#line 68 "lex.l" -{ return REQUIRED; } - YY_BREAK -case 21: -YY_RULE_SETUP -#line 69 "lex.l" -{ return SPIN; } - YY_BREAK -case 22: -YY_RULE_SETUP -#line 70 "lex.l" -{ return SUPPORTED; } - YY_BREAK -case 23: -YY_RULE_SETUP -#line 71 "lex.l" -{ return TEXT; } - YY_BREAK -case 24: -YY_RULE_SETUP -#line 72 "lex.l" -{ return CLASS_USER; } - YY_BREAK -case 25: -YY_RULE_SETUP -#line 73 "lex.l" -{ return VALUE; } - YY_BREAK -case 26: -YY_RULE_SETUP -#line 74 "lex.l" -{ return VALUENAME; } - YY_BREAK -case 27: -YY_RULE_SETUP -#line 75 "lex.l" -{ return VALUEON; } - YY_BREAK -case 28: -YY_RULE_SETUP -#line 76 "lex.l" -{ return VALUEOFF; } - YY_BREAK -case 29: -YY_RULE_SETUP -#line 77 "lex.l" -{ return EQUALS; } - YY_BREAK -case 30: -YY_RULE_SETUP -#line 78 "lex.l" -{ return STRINGSSECTION; } - YY_BREAK -case 31: -YY_RULE_SETUP -#line 80 "lex.l" -{ - char *e, *y = yytext; - yylval.integer = strtol((const char *)yytext, &e, 0); - if(e == y) - error_message("malformed constant (%s)", yytext); - else - return INTEGER; - } - YY_BREAK -case 32: -YY_RULE_SETUP -#line 89 "lex.l" -{ - yylval.text = strdup ((const char *)yytext); - return LITERAL; - } - YY_BREAK -case 33: -YY_RULE_SETUP -#line 94 "lex.l" -{ - yylval.text = strdup ((const char *)yytext); - return LOOKUPLITERAL; - } - YY_BREAK -case 34: -YY_RULE_SETUP -#line 98 "lex.l" - - YY_BREAK -case 35: -/* rule 35 can match eol */ -YY_RULE_SETUP -#line 99 "lex.l" -{ lineno++; } - YY_BREAK -case 36: -/* rule 36 can match eol */ -YY_RULE_SETUP -#line 100 "lex.l" -{ lineno++; } - YY_BREAK -case 37: -/* rule 37 can match eol */ -YY_RULE_SETUP -#line 101 "lex.l" -{ lineno++; yylval.text = strdup((const char *)yytext); return LITERAL; } - YY_BREAK -case 38: -YY_RULE_SETUP -#line 102 "lex.l" -ECHO; - YY_BREAK -#line 1055 "lex.yy.c" -case YY_STATE_EOF(INITIAL): - yyterminate(); - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = (yy_hold_char); - YY_RESTORE_YY_MORE_OFFSET - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between YY_CURRENT_BUFFER and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++(yy_c_buf_p); - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = (yy_c_buf_p); - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_END_OF_FILE: - { - (yy_did_buffer_switch_on_eof) = 0; - - if ( yywrap( ) ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = - (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - (yy_c_buf_p) = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ -} /* end of yylex */ - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ -static int yy_get_next_buffer (void) -{ - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = (yytext_ptr); - register int number_to_move, i; - int ret_val; - - if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; - - else - { - int num_to_read = - YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER; - - int yy_c_buf_p_offset = - (int) ((yy_c_buf_p) - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - - number_to_move - 1; - - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - (yy_n_chars), (size_t) num_to_read ); - - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - if ( (yy_n_chars) == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart(yyin ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - (yy_n_chars) += number_to_move; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - - (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; - - return ret_val; -} - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - - static yy_state_type yy_get_previous_state (void) -{ - register yy_state_type yy_current_state; - register char *yy_cp; - - yy_current_state = (yy_start); - - for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) - { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 185 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - } - - return yy_current_state; -} - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) -{ - register int yy_is_jam; - register char *yy_cp = (yy_c_buf_p); - - register YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 185 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 184); - - return yy_is_jam ? 0 : yy_current_state; -} - - static void yyunput (int c, register char * yy_bp ) -{ - register char *yy_cp; - - yy_cp = (yy_c_buf_p); - - /* undo effects of setting up yytext */ - *yy_cp = (yy_hold_char); - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = (yy_n_chars) + 2; - register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - register char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; -} - -#ifndef YY_NO_INPUT -#ifdef __cplusplus - static int yyinput (void) -#else - static int input (void) -#endif - -{ - int c; - - *(yy_c_buf_p) = (yy_hold_char); - - if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - /* This was really a NUL. */ - *(yy_c_buf_p) = '\0'; - - else - { /* need more input */ - int offset = (yy_c_buf_p) - (yytext_ptr); - ++(yy_c_buf_p); - - switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - yyrestart(yyin ); - - /*FALLTHROUGH*/ - - case EOB_ACT_END_OF_FILE: - { - if ( yywrap( ) ) - return EOF; - - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = (yytext_ptr) + offset; - break; - } - } - } - - c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve yytext */ - (yy_hold_char) = *++(yy_c_buf_p); - - return c; -} -#endif /* ifndef YY_NO_INPUT */ - -/** Immediately switch to a different input stream. - * @param input_file A readable stream. - * - * @note This function does not reset the start condition to @c INITIAL . - */ - void yyrestart (FILE * input_file ) -{ - - if ( ! YY_CURRENT_BUFFER ){ - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); - } - - yy_init_buffer(YY_CURRENT_BUFFER,input_file ); - yy_load_buffer_state( ); -} - -/** Switch to a different input buffer. - * @param new_buffer The new input buffer. - * - */ - void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) -{ - - /* TODO. We should be able to replace this entire function body - * with - * yypop_buffer_state(); - * yypush_buffer_state(new_buffer); - */ - yyensure_buffer_stack (); - if ( YY_CURRENT_BUFFER == new_buffer ) - return; - - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - YY_CURRENT_BUFFER_LVALUE = new_buffer; - yy_load_buffer_state( ); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - (yy_did_buffer_switch_on_eof) = 1; -} - -static void yy_load_buffer_state (void) -{ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; - (yy_hold_char) = *(yy_c_buf_p); -} - -/** Allocate and initialize an input buffer state. - * @param file A readable stream. - * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. - * - * @return the allocated buffer state. - */ - YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) -{ - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_is_our_buffer = 1; - - yy_init_buffer(b,file ); - - return b; -} - -/** Destroy the buffer. - * @param b a buffer created with yy_create_buffer() - * - */ - void yy_delete_buffer (YY_BUFFER_STATE b ) -{ - - if ( ! b ) - return; - - if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ - YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yyfree((void *) b->yy_ch_buf ); - - yyfree((void *) b ); -} - -#ifndef __cplusplus -extern int isatty (int ); -#endif /* __cplusplus */ - -/* Initializes or reinitializes a buffer. - * This function is sometimes called more than once on the same buffer, - * such as during a yyrestart() or at EOF. - */ - static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) - -{ - int oerrno = errno; - - yy_flush_buffer(b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - - /* If b is the current buffer, then yy_init_buffer was _probably_ - * called from yyrestart() or through yy_get_next_buffer. - * In that case, we don't want to reset the lineno or column. - */ - if (b != YY_CURRENT_BUFFER){ - b->yy_bs_lineno = 1; - b->yy_bs_column = 0; - } - - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; - - errno = oerrno; -} - -/** Discard all buffered characters. On the next scan, YY_INPUT will be called. - * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. - * - */ - void yy_flush_buffer (YY_BUFFER_STATE b ) -{ - if ( ! b ) - return; - - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == YY_CURRENT_BUFFER ) - yy_load_buffer_state( ); -} - -/** Pushes the new state onto the stack. The new state becomes - * the current state. This function will allocate the stack - * if necessary. - * @param new_buffer The new state. - * - */ -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) -{ - if (new_buffer == NULL) - return; - - yyensure_buffer_stack(); - - /* This block is copied from yy_switch_to_buffer. */ - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - /* Only push if top exists. Otherwise, replace top. */ - if (YY_CURRENT_BUFFER) - (yy_buffer_stack_top)++; - YY_CURRENT_BUFFER_LVALUE = new_buffer; - - /* copied from yy_switch_to_buffer. */ - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; -} - -/** Removes and deletes the top of the stack, if present. - * The next element becomes the new top. - * - */ -void yypop_buffer_state (void) -{ - if (!YY_CURRENT_BUFFER) - return; - - yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - if ((yy_buffer_stack_top) > 0) - --(yy_buffer_stack_top); - - if (YY_CURRENT_BUFFER) { - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; - } -} - -/* Allocates the stack if it does not exist. - * Guarantees space for at least one push. - */ -static void yyensure_buffer_stack (void) -{ - int num_to_alloc; - - if (!(yy_buffer_stack)) { - - /* First allocation is just for 2 elements, since we don't know if this - * scanner will even need a stack. We use 2 instead of 1 to avoid an - * immediate realloc on the next call. - */ - num_to_alloc = 1; - (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc - (num_to_alloc * sizeof(struct yy_buffer_state*) - ); - - memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - - (yy_buffer_stack_max) = num_to_alloc; - (yy_buffer_stack_top) = 0; - return; - } - - if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ - - /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; - - num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc - ((yy_buffer_stack), - num_to_alloc * sizeof(struct yy_buffer_state*) - ); - - /* zero only the new slots.*/ - memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); - (yy_buffer_stack_max) = num_to_alloc; - } -} - -/** Setup the input buffer state to scan directly from a user-specified character buffer. - * @param base the character buffer - * @param size the size in bytes of the character buffer - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) -{ - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - yy_switch_to_buffer(b ); - - return b; -} - -/** Setup the input buffer state to scan a string. The next call to yylex() will - * scan from a @e copy of @a str. - * @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 - * yy_scan_bytes() instead. - */ -YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) -{ - - return yy_scan_bytes(yystr,strlen(yystr) ); -} - -/** Setup the input buffer state to scan the given bytes. The next call to yylex() will - * scan from a @e copy of @a bytes. - * @param bytes the byte buffer to scan - * @param len the number of bytes in the buffer pointed to by @a bytes. - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) -{ - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char *) yyalloc(n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < _yybytes_len; ++i ) - buf[i] = yybytes[i]; - - buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - - b = yy_scan_buffer(buf,n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; -} - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -static void yy_fatal_error (yyconst char* msg ) -{ - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); -} - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - yytext[yyleng] = (yy_hold_char); \ - (yy_c_buf_p) = yytext + yyless_macro_arg; \ - (yy_hold_char) = *(yy_c_buf_p); \ - *(yy_c_buf_p) = '\0'; \ - yyleng = yyless_macro_arg; \ - } \ - while ( 0 ) - -/* Accessor methods (get/set functions) to struct members. */ - -/** Get the current line number. - * - */ -int yyget_lineno (void) -{ - - return yylineno; -} - -/** Get the input stream. - * - */ -FILE *yyget_in (void) -{ - return yyin; -} - -/** Get the output stream. - * - */ -FILE *yyget_out (void) -{ - return yyout; -} - -/** Get the length of the current token. - * - */ -int yyget_leng (void) -{ - return yyleng; -} - -/** Get the current token. - * - */ - -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. - * - * @see yy_switch_to_buffer - */ -void yyset_in (FILE * in_str ) -{ - yyin = in_str ; -} - -void yyset_out (FILE * out_str ) -{ - yyout = out_str ; -} - -int yyget_debug (void) -{ - return yy_flex_debug; -} - -void yyset_debug (int bdebug ) -{ - yy_flex_debug = bdebug ; -} - -static int yy_init_globals (void) -{ - /* Initialization is the same as for the non-reentrant scanner. - * This function is called from yylex_destroy(), so don't allocate here. - */ - - (yy_buffer_stack) = 0; - (yy_buffer_stack_top) = 0; - (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = (char *) 0; - (yy_init) = 0; - (yy_start) = 0; - -/* Defined in main.c */ -#ifdef YY_STDINIT - yyin = stdin; - yyout = stdout; -#else - yyin = (FILE *) 0; - yyout = (FILE *) 0; -#endif - - /* For future reference: Set errno on error, since we are called by - * yylex_init() - */ - return 0; -} - -/* yylex_destroy is for both reentrant and non-reentrant scanners. */ -int yylex_destroy (void) -{ - - /* Pop the buffer stack, destroying each element. */ - while(YY_CURRENT_BUFFER){ - yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - yypop_buffer_state(); - } - - /* Destroy the stack itself. */ - yyfree((yy_buffer_stack) ); - (yy_buffer_stack) = NULL; - - /* Reset the globals. This is important in a non-reentrant scanner so the next time - * yylex() is called, initialization will occur. */ - yy_init_globals( ); - - return 0; -} - -/* - * Internal utility routines. - */ - -#ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) -{ - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; -} -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * s ) -{ - register int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; -} -#endif - -void *yyalloc (yy_size_t size ) -{ - return (void *) malloc( size ); -} - -void *yyrealloc (void * ptr, yy_size_t size ) -{ - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); -} - -void yyfree (void * ptr ) -{ - free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ -} - -#define YYTABLES_NAME "yytables" - -#line 102 "lex.l" - - - -#ifndef yywrap /* XXX */ -int -yywrap () -{ - return 1; -} -#endif - - -void -error_message (const char *format, ...) -{ - va_list args; - - va_start (args, format); - fprintf (stderr, "%d:", lineno); - vfprintf (stderr, format, args); - va_end (args); -} - -struct adm_file *adm_read_file(const char *file) -{ - uint8_t c[2]; - yyin = fopen(file, "r"); - if (yyin == NULL) - return NULL; - - c[0] = getc(yyin); - c[1] = getc(yyin); - if (c[0] == 0xff && c[1] == 0xfe) { - utf16 = true; - } else { - rewind(yyin); - } - - yyparse(); - - return NULL; /* FIXME */ -} - diff --git a/source4/lib/policy/lex.l b/source4/lib/policy/lex.l deleted file mode 100644 index dc1f0aa34e..0000000000 --- a/source4/lib/policy/lex.l +++ /dev/null @@ -1,142 +0,0 @@ -/* - Unix SMB/CIFS implementation. - Copyright (C) 2006 Wilco Baan Hofman - Copyright (C) 2006 Jelmer Vernooij - - 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, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - - -%{ -#include "includes.h" -#include "lib/policy/parse_adm.h" -void error_message (const char *format, ...); -int yyparse (void); - -static int lineno = 1; -static bool utf16 = false; - -#define YY_INPUT(buf,result,max_size) \ -{ \ - if (utf16) { \ - uint16_t v; \ - if (fread(&v, 2, 1, yyin) < 1) \ - result = YY_NULL; \ - else \ - result = push_codepoint(buf, v); \ - } else { \ - int c = getc(yyin); \ - result = (c == EOF) ? YY_NULL : (buf[0] = c, 1); \ - } \ -} - -%} - -%% - -ACTIONLIST { return ACTIONLIST; } -CATEGORY { return CATEGORY; } -CHECKBOX { return CHECKBOX; } -CLASS { return CLASS; } -DELETE { return DEL; } -DEFAULT { return DEFAULT; } -DROPDOWNLIST { return DROPDOWNLIST; } -EDITTEXT { return EDITTEXT; } -END { return END; } -EXPLAIN { return EXPLAIN; } -ITEMLIST { return ITEMLIST; } -KEYNAME { return KEYNAME; } -MACHINE { return CLASS_MACHINE; } -MIN { return MINIMUM; } -MAX { return MAXIMUM; } -NAME { return NAME; } -NUMERIC { return NUMERIC; } -PART { return PART; } -POLICY { return POLICY; } -REQUIRED { return REQUIRED; } -SPIN { return SPIN; } -SUPPORTED { return SUPPORTED; } -TEXT { return TEXT; } -USER { return CLASS_USER; } -VALUE { return VALUE; } -VALUENAME { return VALUENAME; } -VALUEON { return VALUEON; } -VALUEOFF { return VALUEOFF; } -= { return EQUALS; } -\[strings\] { return STRINGSSECTION; } - -[0-9]+ { - char *e, *y = yytext; - yylval.integer = strtol((const char *)yytext, &e, 0); - if(e == y) - error_message("malformed constant (%s)", yytext); - else - return INTEGER; - } - -[A-Za-z\\{}][{}\-\\A-Za-z0-9_]* { - yylval.text = strdup ((const char *)yytext); - return LITERAL; - } - -"!!"[A-Za-z][-A-Za-z0-9_]* { - yylval.text = strdup ((const char *)yytext); - return LOOKUPLITERAL; - } -[ \t]+ -\n { lineno++; } -;[^\n]*\n { lineno++; } -\"([^\n]+)\n { lineno++; yylval.text = strdup((const char *)yytext); return LITERAL; } -%% - -#ifndef yywrap /* XXX */ -int -yywrap () -{ - return 1; -} -#endif - - -void -error_message (const char *format, ...) -{ - va_list args; - - va_start (args, format); - fprintf (stderr, "%d:", lineno); - vfprintf (stderr, format, args); - va_end (args); -} - -struct adm_file *adm_read_file(const char *file) -{ - uint8_t c[2]; - yyin = fopen(file, "r"); - if (yyin == NULL) - return NULL; - - c[0] = getc(yyin); - c[1] = getc(yyin); - if (c[0] == 0xff && c[1] == 0xfe) { - utf16 = true; - } else { - rewind(yyin); - } - - yyparse(); - - return NULL; /* FIXME */ -} diff --git a/source4/lib/policy/parse_adm.c b/source4/lib/policy/parse_adm.c deleted file mode 100644 index c68e2db814..0000000000 --- a/source4/lib/policy/parse_adm.c +++ /dev/null @@ -1,1726 +0,0 @@ -/* A Bison parser, made by GNU Bison 2.3. */ - -/* Skeleton implementation for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. - - 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 2, 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, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -/* C LALR(1) parser skeleton written by Richard Stallman, by - simplifying the original so-called "semantic" parser. */ - -/* All symbols defined below should begin with yy or YY, to avoid - infringing on user name space. This should be done even for local - variables, as they might otherwise be expanded by user macros. - There are some unavoidable exceptions within include files to - define necessary library symbols; they are noted "INFRINGES ON - USER NAME SPACE" below. */ - -/* Identify Bison output. */ -#define YYBISON 1 - -/* Bison version. */ -#define YYBISON_VERSION "2.3" - -/* Skeleton name. */ -#define YYSKELETON_NAME "yacc.c" - -/* Pure parsers. */ -#define YYPURE 0 - -/* Using locations. */ -#define YYLSP_NEEDED 0 - - - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - CATEGORY = 258, - CLASS = 259, - CLASS_USER = 260, - CLASS_MACHINE = 261, - POLICY = 262, - KEYNAME = 263, - EXPLAIN = 264, - VALUENAME = 265, - VALUEON = 266, - VALUEOFF = 267, - PART = 268, - ITEMLIST = 269, - NAME = 270, - VALUE = 271, - NUMERIC = 272, - EDITTEXT = 273, - TEXT = 274, - DROPDOWNLIST = 275, - CHECKBOX = 276, - MINIMUM = 277, - MAXIMUM = 278, - DEFAULT = 279, - END = 280, - ACTIONLIST = 281, - DEL = 282, - SUPPORTED = 283, - LITERAL = 284, - INTEGER = 285, - LOOKUPLITERAL = 286, - CLIENTEXT = 287, - REQUIRED = 288, - NOSORT = 289, - SPIN = 290, - EQUALS = 291, - STRINGSSECTION = 292 - }; -#endif -/* Tokens. */ -#define CATEGORY 258 -#define CLASS 259 -#define CLASS_USER 260 -#define CLASS_MACHINE 261 -#define POLICY 262 -#define KEYNAME 263 -#define EXPLAIN 264 -#define VALUENAME 265 -#define VALUEON 266 -#define VALUEOFF 267 -#define PART 268 -#define ITEMLIST 269 -#define NAME 270 -#define VALUE 271 -#define NUMERIC 272 -#define EDITTEXT 273 -#define TEXT 274 -#define DROPDOWNLIST 275 -#define CHECKBOX 276 -#define MINIMUM 277 -#define MAXIMUM 278 -#define DEFAULT 279 -#define END 280 -#define ACTIONLIST 281 -#define DEL 282 -#define SUPPORTED 283 -#define LITERAL 284 -#define INTEGER 285 -#define LOOKUPLITERAL 286 -#define CLIENTEXT 287 -#define REQUIRED 288 -#define NOSORT 289 -#define SPIN 290 -#define EQUALS 291 -#define STRINGSSECTION 292 - - - - -/* Copy the first part of user declarations. */ -#line 24 "lib/policy/parse_adm.y" - -#include "config.h" -void error_message (const char *format, ...); -int yyparse (void); -void yyerror (const char *s); -extern int yylex (void); - - - -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif - -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 0 -#endif - -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -# define YYTOKEN_TABLE 0 -#endif - -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -#line 33 "lib/policy/parse_adm.y" -{ - char *text; - int integer; -} -/* Line 187 of yacc.c. */ -#line 184 "lib/policy/parse_adm.y" - YYSTYPE; -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 -#endif - - - -/* Copy the second part of user declarations. */ - - -/* Line 216 of yacc.c. */ -#line 197 "lib/policy/parse_adm.y" - -#ifdef short -# undef short -#endif - -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; -#else -typedef unsigned char yytype_uint8; -#endif - -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; -#elif (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -typedef signed char yytype_int8; -#else -typedef short int yytype_int8; -#endif - -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; -#else -typedef unsigned short int yytype_uint16; -#endif - -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; -#else -typedef short int yytype_int16; -#endif - -#ifndef YYSIZE_T -# ifdef __SIZE_TYPE__ -# define YYSIZE_T __SIZE_TYPE__ -# elif defined size_t -# define YYSIZE_T size_t -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# else -# define YYSIZE_T unsigned int -# endif -#endif - -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) - -#ifndef YY_ -# if YYENABLE_NLS -# if ENABLE_NLS -# include /* INFRINGES ON USER NAME SPACE */ -# define YY_(msgid) dgettext ("bison-runtime", msgid) -# endif -# endif -# ifndef YY_ -# define YY_(msgid) msgid -# endif -#endif - -/* Suppress unused-variable warnings by "using" E. */ -#if ! defined lint || defined __GNUC__ -# define YYUSE(e) ((void) (e)) -#else -# define YYUSE(e) /* empty */ -#endif - -/* Identity function, used to suppress warnings about constant conditions. */ -#ifndef lint -# define YYID(n) (n) -#else -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static int -YYID (int i) -#else -static int -YYID (i) - int i; -#endif -{ - return i; -} -#endif - -#if ! defined yyoverflow || YYERROR_VERBOSE - -/* The parser invokes alloca or malloc; define the necessary symbols. */ - -# ifdef YYSTACK_USE_ALLOCA -# if YYSTACK_USE_ALLOCA -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca -# elif defined __BUILTIN_VA_ARG_INCR -# include /* INFRINGES ON USER NAME SPACE */ -# elif defined _AIX -# define YYSTACK_ALLOC __alloca -# elif defined _MSC_VER -# include /* INFRINGES ON USER NAME SPACE */ -# define alloca _alloca -# else -# define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -# include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 -# endif -# endif -# endif -# endif -# endif - -# ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) -# ifndef YYSTACK_ALLOC_MAXIMUM - /* The OS might guarantee only one guard page at the bottom of the stack, - and a page size can be as small as 4096 bytes. So we cannot safely - invoke alloca (N) if N exceeds 4096. Use a slightly smaller number - to allow for a few compiler-allocated temporary stack slots. */ -# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ -# endif -# else -# define YYSTACK_ALLOC YYMALLOC -# define YYSTACK_FREE YYFREE -# ifndef YYSTACK_ALLOC_MAXIMUM -# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM -# endif -# if (defined __cplusplus && ! defined _STDLIB_H \ - && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) -# include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 -# endif -# endif -# ifndef YYMALLOC -# define YYMALLOC malloc -# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# ifndef YYFREE -# define YYFREE free -# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -void free (void *); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# endif -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ - - -#if (! defined yyoverflow \ - && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) - -/* A type that is properly aligned for any stack member. */ -union yyalloc -{ - yytype_int16 yyss; - YYSTYPE yyvs; - }; - -/* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) - -/* The size of an array large to enough to hold all stacks, each with - N elements. */ -# define YYSTACK_BYTES(N) \ - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ - + YYSTACK_GAP_MAXIMUM) - -/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) -# else -# define YYCOPY(To, From, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ - while (YYID (0)) -# endif -# endif - -/* Relocate STACK from its old location to the new one. The - local variables YYSIZE and YYSTACKSIZE give the old and new number of - elements in the stack, and YYPTR gives the new location of the - stack. Advance YYPTR to a properly aligned location for the next - stack. */ -# define YYSTACK_RELOCATE(Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (YYID (0)) - -#endif - -/* YYFINAL -- State number of the termination state. */ -#define YYFINAL 8 -/* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 112 - -/* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 38 -/* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 38 -/* YYNRULES -- Number of rules. */ -#define YYNRULES 78 -/* YYNRULES -- Number of states. */ -#define YYNSTATES 119 - -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ -#define YYUNDEFTOK 2 -#define YYMAXUTOK 292 - -#define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) - -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ -static const yytype_uint8 yytranslate[] = -{ - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37 -}; - -#if YYDEBUG -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in - YYRHS. */ -static const yytype_uint8 yyprhs[] = -{ - 0, 0, 3, 6, 7, 10, 14, 16, 18, 19, - 22, 24, 26, 32, 34, 36, 38, 40, 43, 44, - 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, - 70, 73, 74, 76, 78, 80, 82, 84, 91, 94, - 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, - 117, 118, 121, 124, 127, 130, 132, 135, 138, 141, - 144, 147, 152, 155, 158, 160, 162, 164, 166, 167, - 170, 173, 178, 181, 184, 185, 189, 192, 193 -}; - -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int8 yyrhs[] = -{ - 39, 0, -1, 40, 75, -1, -1, 41, 40, -1, - 4, 42, 43, -1, 5, -1, 6, -1, -1, 45, - 43, -1, 29, -1, 31, -1, 3, 44, 47, 25, - 3, -1, 59, -1, 45, -1, 48, -1, 64, -1, - 46, 47, -1, -1, 7, 44, 50, 25, 7, -1, - 59, -1, 64, -1, 63, -1, 61, -1, 62, -1, - 56, -1, 57, -1, 58, -1, 70, -1, 52, -1, - 49, 50, -1, -1, 17, -1, 18, -1, 19, -1, - 20, -1, 21, -1, 13, 44, 51, 55, 25, 13, - -1, 35, 30, -1, 64, -1, 63, -1, 61, -1, - 62, -1, 56, -1, 57, -1, 58, -1, 65, -1, - 33, -1, 53, -1, 54, 55, -1, -1, 22, 30, - -1, 23, 30, -1, 24, 30, -1, 9, 44, -1, - 27, -1, 17, 30, -1, 11, 60, -1, 12, 60, - -1, 10, 44, -1, 8, 44, -1, 14, 69, 25, - 14, -1, 15, 44, -1, 16, 60, -1, 66, -1, - 67, -1, 24, -1, 71, -1, -1, 68, 69, -1, - 28, 44, -1, 26, 72, 25, 26, -1, 63, 72, - -1, 67, 72, -1, -1, 29, 36, 29, -1, 73, - 74, -1, -1, 37, 74, -1 -}; - -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const yytype_uint8 yyrline[] = -{ - 0, 71, 71, 73, 73, 75, 76, 76, 78, 78, - 80, 80, 82, 84, 84, 84, 84, 85, 85, 87, - 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, - 89, 89, 91, 91, 91, 91, 91, 93, 95, 97, - 97, 97, 97, 97, 97, 97, 97, 97, 97, 98, - 98, 100, 101, 102, 104, 105, 105, 107, 108, 110, - 111, 113, 114, 115, 117, 117, 117, 117, 118, 118, - 120, 122, 123, 123, 123, 125, 126, 126, 127 -}; -#endif - -#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE -/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ -static const char *const yytname[] = -{ - "$end", "error", "$undefined", "CATEGORY", "CLASS", "CLASS_USER", - "CLASS_MACHINE", "POLICY", "KEYNAME", "EXPLAIN", "VALUENAME", "VALUEON", - "VALUEOFF", "PART", "ITEMLIST", "NAME", "VALUE", "NUMERIC", "EDITTEXT", - "TEXT", "DROPDOWNLIST", "CHECKBOX", "MINIMUM", "MAXIMUM", "DEFAULT", - "END", "ACTIONLIST", "DEL", "SUPPORTED", "LITERAL", "INTEGER", - "LOOKUPLITERAL", "CLIENTEXT", "REQUIRED", "NOSORT", "SPIN", "EQUALS", - "STRINGSSECTION", "$accept", "admfile", "classes", "class", "classvalue", - "categories", "string", "category", "categoryitem", "categoryitems", - "policy", "policyitem", "policyitems", "valuetype", "part", "spin", - "partitem", "partitems", "min", "max", "defaultvalue", "explain", - "value", "valueon", "valueoff", "valuename", "keyname", "itemlist", - "itemname", "itemvalue", "item", "items", "supported", "actionlist", - "actions", "variable", "variables", "strings", 0 -}; -#endif - -# ifdef YYPRINT -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to - token YYLEX-NUM. */ -static const yytype_uint16 yytoknum[] = -{ - 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292 -}; -# endif - -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = -{ - 0, 38, 39, 40, 40, 41, 42, 42, 43, 43, - 44, 44, 45, 46, 46, 46, 46, 47, 47, 48, - 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, - 50, 50, 51, 51, 51, 51, 51, 52, 53, 54, - 54, 54, 54, 54, 54, 54, 54, 54, 54, 55, - 55, 56, 57, 58, 59, 60, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 68, 68, 68, 69, 69, - 70, 71, 72, 72, 72, 73, 74, 74, 75 -}; - -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = -{ - 0, 2, 2, 0, 2, 3, 1, 1, 0, 2, - 1, 1, 5, 1, 1, 1, 1, 2, 0, 5, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 0, 1, 1, 1, 1, 1, 6, 2, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, - 0, 2, 2, 2, 2, 1, 2, 2, 2, 2, - 2, 4, 2, 2, 1, 1, 1, 1, 0, 2, - 2, 4, 2, 2, 0, 3, 2, 0, 2 -}; - -/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state - STATE-NUM when YYTABLE doesn't specify something else to do. Zero - means the default is an error. */ -static const yytype_uint8 yydefact[] = -{ - 3, 0, 0, 0, 3, 6, 7, 8, 1, 77, - 2, 4, 0, 5, 8, 0, 77, 78, 10, 11, - 18, 9, 0, 76, 0, 0, 0, 14, 18, 0, - 15, 13, 16, 75, 31, 60, 54, 17, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 31, 0, 29, - 25, 26, 27, 20, 23, 24, 22, 21, 28, 12, - 59, 0, 55, 57, 58, 0, 51, 52, 53, 70, - 30, 0, 56, 32, 33, 34, 35, 36, 50, 19, - 68, 47, 0, 48, 50, 0, 43, 44, 45, 41, - 42, 40, 39, 46, 0, 0, 66, 74, 64, 65, - 68, 0, 67, 38, 49, 0, 62, 63, 74, 74, - 0, 69, 0, 37, 72, 73, 0, 61, 71 -}; - -/* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int8 yydefgoto[] = -{ - -1, 2, 3, 4, 7, 13, 20, 14, 28, 29, - 30, 47, 48, 78, 49, 83, 84, 85, 50, 51, - 52, 31, 63, 54, 55, 108, 32, 93, 98, 109, - 100, 101, 58, 102, 110, 16, 17, 10 -}; - -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -#define YYPACT_NINF -61 -static const yytype_int8 yypact[] = -{ - 30, 46, 36, 12, 30, -61, -61, 70, -61, 10, - -61, -61, -22, -61, 70, 45, 10, -61, -61, -61, - 55, -61, 53, -61, -22, -22, -22, -61, 55, 58, - -61, -61, -61, -61, 19, -61, -61, -61, 81, -22, - 6, 6, -22, 56, 57, 60, -22, 19, 63, -61, - -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, - -61, 61, -61, -61, -61, 59, -61, -61, -61, -61, - -61, 78, -61, -61, -61, -61, -61, -61, 2, -61, - 29, -61, 62, -61, 2, 64, -61, -61, -61, -61, - -61, -61, -61, -61, -22, 6, -61, -5, -61, -61, - 29, 68, -61, -61, -61, 82, -61, -61, -5, -5, - 69, -61, 83, -61, -61, -61, 72, -61, -61 -}; - -/* YYPGOTO[NTERM-NUM]. */ -static const yytype_int8 yypgoto[] = -{ - -61, -61, 92, -61, -61, 85, -24, 18, -61, 73, - -61, -61, 65, -61, -61, -61, -61, 16, -19, -18, - -17, -26, -38, -10, -9, -30, -28, -61, -61, -60, - -61, 3, -61, -61, -37, -61, 86, -61 -}; - -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule which - number is the opposite. If zero, do what YYDEFACT says. - If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -1 -static const yytype_uint8 yytable[] = -{ - 34, 35, 36, 64, 56, 39, 57, 18, 53, 19, - 25, 95, 39, 40, 41, 60, 80, 56, 65, 57, - 99, 53, 69, 61, 43, 44, 45, 25, 26, 39, - 40, 41, 42, 62, 1, 81, 8, 82, 27, 15, - 99, 43, 44, 45, 94, 95, 27, 46, 91, 9, - 92, 5, 6, 96, 91, 97, 92, 107, 12, 86, - 87, 88, 24, 25, 26, 86, 87, 88, 89, 90, - 106, 114, 115, 12, 89, 90, 73, 74, 75, 76, - 77, 22, 33, 38, 59, 79, 66, 67, 71, 105, - 68, 72, 103, 112, 116, 113, 11, 117, 118, 21, - 104, 37, 23, 111, 0, 0, 0, 0, 0, 0, - 0, 0, 70 -}; - -static const yytype_int8 yycheck[] = -{ - 24, 25, 26, 41, 34, 10, 34, 29, 34, 31, - 8, 16, 10, 11, 12, 39, 14, 47, 42, 47, - 80, 47, 46, 17, 22, 23, 24, 8, 9, 10, - 11, 12, 13, 27, 4, 33, 0, 35, 20, 29, - 100, 22, 23, 24, 15, 16, 28, 28, 78, 37, - 78, 5, 6, 24, 84, 26, 84, 95, 3, 78, - 78, 78, 7, 8, 9, 84, 84, 84, 78, 78, - 94, 108, 109, 3, 84, 84, 17, 18, 19, 20, - 21, 36, 29, 25, 3, 7, 30, 30, 25, 25, - 30, 30, 30, 25, 25, 13, 4, 14, 26, 14, - 84, 28, 16, 100, -1, -1, -1, -1, -1, -1, - -1, -1, 47 -}; - -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = -{ - 0, 4, 39, 40, 41, 5, 6, 42, 0, 37, - 75, 40, 3, 43, 45, 29, 73, 74, 29, 31, - 44, 43, 36, 74, 7, 8, 9, 45, 46, 47, - 48, 59, 64, 29, 44, 44, 44, 47, 25, 10, - 11, 12, 13, 22, 23, 24, 28, 49, 50, 52, - 56, 57, 58, 59, 61, 62, 63, 64, 70, 3, - 44, 17, 27, 60, 60, 44, 30, 30, 30, 44, - 50, 25, 30, 17, 18, 19, 20, 21, 51, 7, - 14, 33, 35, 53, 54, 55, 56, 57, 58, 61, - 62, 63, 64, 65, 15, 16, 24, 26, 66, 67, - 68, 69, 71, 30, 55, 25, 44, 60, 63, 67, - 72, 69, 25, 13, 72, 72, 25, 14, 26 -}; - -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 - -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab - - -/* Like YYERROR except do call yyerror. This remains here temporarily - to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ - -#define YYFAIL goto yyerrlab - -#define YYRECOVERING() (!!yyerrstatus) - -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - yytoken = YYTRANSLATE (yychar); \ - YYPOPSTACK (1); \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (YYID (0)) - - -#define YYTERROR 1 -#define YYERRCODE 256 - - -/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ - -#define YYRHSLOC(Rhs, K) ((Rhs)[K]) -#ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (YYID (N)) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ - while (YYID (0)) -#endif - - -/* YY_LOCATION_PRINT -- Print the location on the stream. - This macro was not mandated originally: define only if we know - we won't break user code: when these are the locations we know. */ - -#ifndef YY_LOCATION_PRINT -# if YYLTYPE_IS_TRIVIAL -# define YY_LOCATION_PRINT(File, Loc) \ - fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) -# else -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -# endif -#endif - - -/* YYLEX -- calling `yylex' with the right arguments. */ - -#ifdef YYLEX_PARAM -# define YYLEX yylex (YYLEX_PARAM) -#else -# define YYLEX yylex () -#endif - -/* Enable debugging if requested. */ -#if YYDEBUG - -# ifndef YYFPRINTF -# include /* INFRINGES ON USER NAME SPACE */ -# define YYFPRINTF fprintf -# endif - -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (YYID (0)) - -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (YYID (0)) - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_value_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif -{ - if (!yyvaluep) - return; -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# else - YYUSE (yyoutput); -# endif - switch (yytype) - { - default: - break; - } -} - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif -{ - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); - - yy_symbol_value_print (yyoutput, yytype, yyvaluep); - YYFPRINTF (yyoutput, ")"); -} - -/*------------------------------------------------------------------. -| yy_stack_print -- Print the state stack from its BOTTOM up to its | -| TOP (included). | -`------------------------------------------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) -#else -static void -yy_stack_print (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; -#endif -{ - YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); - YYFPRINTF (stderr, "\n"); -} - -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (YYID (0)) - - -/*------------------------------------------------. -| Report that the YYRULE is going to be reduced. | -`------------------------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_reduce_print (YYSTYPE *yyvsp, int yyrule) -#else -static void -yy_reduce_print (yyvsp, yyrule) - YYSTYPE *yyvsp; - int yyrule; -#endif -{ - int yynrhs = yyr2[yyrule]; - int yyi; - unsigned long int yylno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); - /* The symbols being reduced. */ - for (yyi = 0; yyi < yynrhs; yyi++) - { - fprintf (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], - &(yyvsp[(yyi + 1) - (yynrhs)]) - ); - fprintf (stderr, "\n"); - } -} - -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyvsp, Rule); \ -} while (YYID (0)) - -/* Nonzero means print parse trace. It is left uninitialized so that - multiple parsers can coexist. */ -int yydebug; -#else /* !YYDEBUG */ -# define YYDPRINTF(Args) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) -# define YY_STACK_PRINT(Bottom, Top) -# define YY_REDUCE_PRINT(Rule) -#endif /* !YYDEBUG */ - - -/* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH -# define YYINITDEPTH 200 -#endif - -/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only - if the built-in stack extension method is used). - - Do not make this value too large; the results are undefined if - YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) - evaluated with infinite-precision integer arithmetic. */ - -#ifndef YYMAXDEPTH -# define YYMAXDEPTH 10000 -#endif - - - -#if YYERROR_VERBOSE - -# ifndef yystrlen -# if defined __GLIBC__ && defined _STRING_H -# define yystrlen strlen -# else -/* Return the length of YYSTR. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static YYSIZE_T -yystrlen (const char *yystr) -#else -static YYSIZE_T -yystrlen (yystr) - const char *yystr; -#endif -{ - YYSIZE_T yylen; - for (yylen = 0; yystr[yylen]; yylen++) - continue; - return yylen; -} -# endif -# endif - -# ifndef yystpcpy -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -# define yystpcpy stpcpy -# else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static char * -yystpcpy (char *yydest, const char *yysrc) -#else -static char * -yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -#endif -{ - char *yyd = yydest; - const char *yys = yysrc; - - while ((*yyd++ = *yys++) != '\0') - continue; - - return yyd - 1; -} -# endif -# endif - -# ifndef yytnamerr -/* Copy to YYRES the contents of YYSTR after stripping away unnecessary - quotes and backslashes, so that it's suitable for yyerror. The - heuristic is that double-quoting is unnecessary unless the string - contains an apostrophe, a comma, or backslash (other than - backslash-backslash). YYSTR is taken from yytname. If YYRES is - null, do not copy; instead, return the length of what the result - would have been. */ -static YYSIZE_T -yytnamerr (char *yyres, const char *yystr) -{ - if (*yystr == '"') - { - YYSIZE_T yyn = 0; - char const *yyp = yystr; - - for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } - do_not_strip_quotes: ; - } - - if (! yyres) - return yystrlen (yystr); - - return yystpcpy (yyres, yystr) - yyres; -} -# endif - -/* Copy into YYRESULT an error message about the unexpected token - YYCHAR while in state YYSTATE. Return the number of bytes copied, - including the terminating null byte. If YYRESULT is null, do not - copy anything; just return the number of bytes that would be - copied. As a special case, return 0 if an ordinary "syntax error" - message will do. Return YYSIZE_MAXIMUM if overflow occurs during - size calculation. */ -static YYSIZE_T -yysyntax_error (char *yyresult, int yystate, int yychar) -{ - int yyn = yypact[yystate]; - - if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) - return 0; - else - { - int yytype = YYTRANSLATE (yychar); - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - int yysize_overflow = 0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - int yyx; - -# if 0 - /* This is so xgettext sees the translatable formats that are - constructed on the fly. */ - YY_("syntax error, unexpected %s"); - YY_("syntax error, unexpected %s, expecting %s"); - YY_("syntax error, unexpected %s, expecting %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); -# endif - char *yyfmt; - char const *yyf; - static char const yyunexpected[] = "syntax error, unexpected %s"; - static char const yyexpecting[] = ", expecting %s"; - static char const yyor[] = " or %s"; - char yyformat[sizeof yyunexpected - + sizeof yyexpecting - 1 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) - * (sizeof yyor - 1))]; - char const *yyprefix = yyexpecting; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 1; - - yyarg[0] = yytname[yytype]; - yyfmt = yystpcpy (yyformat, yyunexpected); - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - yyfmt = yystpcpy (yyfmt, yyprefix); - yyprefix = yyor; - } - - yyf = YY_(yyformat); - yysize1 = yysize + yystrlen (yyf); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - - if (yysize_overflow) - return YYSIZE_MAXIMUM; - - if (yyresult) - { - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - char *yyp = yyresult; - int yyi = 0; - while ((*yyp = *yyf) != '\0') - { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyf += 2; - } - else - { - yyp++; - yyf++; - } - } - } - return yysize; - } -} -#endif /* YYERROR_VERBOSE */ - - -/*-----------------------------------------------. -| Release the memory associated to this symbol. | -`-----------------------------------------------*/ - -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) -#else -static void -yydestruct (yymsg, yytype, yyvaluep) - const char *yymsg; - int yytype; - YYSTYPE *yyvaluep; -#endif -{ - YYUSE (yyvaluep); - - if (!yymsg) - yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - - switch (yytype) - { - - default: - break; - } -} - - -/* Prevent warnings from -Wmissing-prototypes. */ - -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int yyparse (void *YYPARSE_PARAM); -#else -int yyparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -int yyparse (void); -#else -int yyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ - - - -/* The look-ahead symbol. */ -int yychar; - -/* The semantic value of the look-ahead symbol. */ -YYSTYPE yylval; - -/* Number of syntax errors so far. */ -int yynerrs; - - - -/*----------. -| yyparse. | -`----------*/ - -#ifdef YYPARSE_PARAM -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void *YYPARSE_PARAM) -#else -int -yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -#endif -#else /* ! YYPARSE_PARAM */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void) -#else -int -yyparse () - -#endif -#endif -{ - - int yystate; - int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; - - - -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) - - YYSIZE_T yystacksize = YYINITDEPTH; - - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - - - /* The number of symbols on the RHS of the reduced rule. - Keep to zero when no symbol should be popped. */ - int yylen = 0; - - YYDPRINTF ((stderr, "Starting parse\n")); - - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ - - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. - The wasted elements are never initialized. */ - - yyssp = yyss; - yyvsp = yyvs; - - goto yysetstate; - -/*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | -`------------------------------------------------------------*/ - yynewstate: - /* In all cases, when you get here, the value and location stacks - have just been pushed. So pushing a state here evens the stacks. */ - yyssp++; - - yysetstate: - *yyssp = yystate; - - if (yyss + yystacksize - 1 <= yyssp) - { - /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; - -#ifdef yyoverflow - { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; - - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - - &yystacksize); - - yyss = yyss1; - yyvs = yyvs1; - } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else - /* Extend the stack our own way. */ - if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; - yystacksize *= 2; - if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; - - { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - -# undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); - } -# endif -#endif /* no yyoverflow */ - - yyssp = yyss + yysize - 1; - yyvsp = yyvs + yysize - 1; - - - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); - - if (yyss + yystacksize - 1 <= yyssp) - YYABORT; - } - - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - - goto yybackup; - -/*-----------. -| yybackup. | -`-----------*/ -yybackup: - - /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ - - /* First try to decide what to do without reference to look-ahead token. */ - yyn = yypact[yystate]; - if (yyn == YYPACT_NINF) - goto yydefault; - - /* Not known => get a look-ahead token if don't already have one. */ - - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ - if (yychar == YYEMPTY) - { - YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; - } - - if (yychar <= YYEOF) - { - yychar = yytoken = YYEOF; - YYDPRINTF ((stderr, "Now at end of input.\n")); - } - else - { - yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); - } - - /* If the proper action on seeing token YYTOKEN is to reduce or to - detect an error, take that action. */ - yyn += yytoken; - if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) - goto yydefault; - yyn = yytable[yyn]; - if (yyn <= 0) - { - if (yyn == 0 || yyn == YYTABLE_NINF) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; - } - - if (yyn == YYFINAL) - YYACCEPT; - - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; - - /* Shift the look-ahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the shifted token unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; - - yystate = yyn; - *++yyvsp = yylval; - - goto yynewstate; - - -/*-----------------------------------------------------------. -| yydefault -- do the default action for the current state. | -`-----------------------------------------------------------*/ -yydefault: - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; - goto yyreduce; - - -/*-----------------------------. -| yyreduce -- Do a reduction. | -`-----------------------------*/ -yyreduce: - /* yyn is the number of a rule to reduce with. */ - yylen = yyr2[yyn]; - - /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. - - Otherwise, the following line sets YYVAL to garbage. - This behavior is undocumented and Bison - users should not rely upon it. Assigning to YYVAL - unconditionally makes the parser a bit smaller, and it avoids a - GCC warning that YYVAL may be used uninitialized. */ - yyval = yyvsp[1-yylen]; - - - YY_REDUCE_PRINT (yyn); - switch (yyn) - { - -/* Line 1267 of yacc.c. */ -#line 1502 "lib/policy/parse_adm.y" - default: break; - } - YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); - - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - - *++yyvsp = yyval; - - - /* Now `shift' the result of the reduction. Determine what state - that goes to, based on the state we popped back to and the rule - number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTOKENS]; - - goto yynewstate; - - -/*------------------------------------. -| yyerrlab -- here on detecting error | -`------------------------------------*/ -yyerrlab: - /* If not already recovering from an error, report this error. */ - if (!yyerrstatus) - { - ++yynerrs; -#if ! YYERROR_VERBOSE - yyerror (YY_("syntax error")); -#else - { - YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); - if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) - { - YYSIZE_T yyalloc = 2 * yysize; - if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) - yyalloc = YYSTACK_ALLOC_MAXIMUM; - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yyalloc); - if (yymsg) - yymsg_alloc = yyalloc; - else - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - } - } - - if (0 < yysize && yysize <= yymsg_alloc) - { - (void) yysyntax_error (yymsg, yystate, yychar); - yyerror (yymsg); - } - else - { - yyerror (YY_("syntax error")); - if (yysize != 0) - goto yyexhaustedlab; - } - } -#endif - } - - - - if (yyerrstatus == 3) - { - /* If just tried and failed to reuse look-ahead token after an - error, discard it. */ - - if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } - else - { - yydestruct ("Error: discarding", - yytoken, &yylval); - yychar = YYEMPTY; - } - } - - /* Else will try to reuse look-ahead token after shifting the error - token. */ - goto yyerrlab1; - - -/*---------------------------------------------------. -| yyerrorlab -- error raised explicitly by YYERROR. | -`---------------------------------------------------*/ -yyerrorlab: - - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; - - /* Do not reclaim the symbols of the rule which action triggered - this YYERROR. */ - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - yystate = *yyssp; - goto yyerrlab1; - - -/*-------------------------------------------------------------. -| yyerrlab1 -- common code for both syntax error and YYERROR. | -`-------------------------------------------------------------*/ -yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ - - for (;;) - { - yyn = yypact[yystate]; - if (yyn != YYPACT_NINF) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } - - /* Pop the current state because it cannot handle the error token. */ - if (yyssp == yyss) - YYABORT; - - - yydestruct ("Error: popping", - yystos[yystate], yyvsp); - YYPOPSTACK (1); - yystate = *yyssp; - YY_STACK_PRINT (yyss, yyssp); - } - - if (yyn == YYFINAL) - YYACCEPT; - - *++yyvsp = yylval; - - - /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); - - yystate = yyn; - goto yynewstate; - - -/*-------------------------------------. -| yyacceptlab -- YYACCEPT comes here. | -`-------------------------------------*/ -yyacceptlab: - yyresult = 0; - goto yyreturn; - -/*-----------------------------------. -| yyabortlab -- YYABORT comes here. | -`-----------------------------------*/ -yyabortlab: - yyresult = 1; - goto yyreturn; - -#ifndef yyoverflow -/*-------------------------------------------------. -| yyexhaustedlab -- memory exhaustion comes here. | -`-------------------------------------------------*/ -yyexhaustedlab: - yyerror (YY_("memory exhausted")); - yyresult = 2; - /* Fall through. */ -#endif - -yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); - /* Do not reclaim the symbols of the rule which action triggered - this YYABORT or YYACCEPT. */ - YYPOPSTACK (yylen); - YY_STACK_PRINT (yyss, yyssp); - while (yyssp != yyss) - { - yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); - YYPOPSTACK (1); - } -#ifndef yyoverflow - if (yyss != yyssa) - YYSTACK_FREE (yyss); -#endif -#if YYERROR_VERBOSE - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); -#endif - /* Make sure YYID is used. */ - return YYID (yyresult); -} - - -#line 129 "lib/policy/parse_adm.y" - - -void -yyerror (const char *s) -{ - error_message ("%s\n", s); -} - - - - diff --git a/source4/lib/policy/parse_adm.h b/source4/lib/policy/parse_adm.h deleted file mode 100644 index 372e4b9680..0000000000 --- a/source4/lib/policy/parse_adm.h +++ /dev/null @@ -1,135 +0,0 @@ -/* A Bison parser, made by GNU Bison 2.3. */ - -/* Skeleton interface for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. - - 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 2, 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, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - CATEGORY = 258, - CLASS = 259, - CLASS_USER = 260, - CLASS_MACHINE = 261, - POLICY = 262, - KEYNAME = 263, - EXPLAIN = 264, - VALUENAME = 265, - VALUEON = 266, - VALUEOFF = 267, - PART = 268, - ITEMLIST = 269, - NAME = 270, - VALUE = 271, - NUMERIC = 272, - EDITTEXT = 273, - TEXT = 274, - DROPDOWNLIST = 275, - CHECKBOX = 276, - MINIMUM = 277, - MAXIMUM = 278, - DEFAULT = 279, - END = 280, - ACTIONLIST = 281, - DEL = 282, - SUPPORTED = 283, - LITERAL = 284, - INTEGER = 285, - LOOKUPLITERAL = 286, - CLIENTEXT = 287, - REQUIRED = 288, - NOSORT = 289, - SPIN = 290, - EQUALS = 291, - STRINGSSECTION = 292 - }; -#endif -/* Tokens. */ -#define CATEGORY 258 -#define CLASS 259 -#define CLASS_USER 260 -#define CLASS_MACHINE 261 -#define POLICY 262 -#define KEYNAME 263 -#define EXPLAIN 264 -#define VALUENAME 265 -#define VALUEON 266 -#define VALUEOFF 267 -#define PART 268 -#define ITEMLIST 269 -#define NAME 270 -#define VALUE 271 -#define NUMERIC 272 -#define EDITTEXT 273 -#define TEXT 274 -#define DROPDOWNLIST 275 -#define CHECKBOX 276 -#define MINIMUM 277 -#define MAXIMUM 278 -#define DEFAULT 279 -#define END 280 -#define ACTIONLIST 281 -#define DEL 282 -#define SUPPORTED 283 -#define LITERAL 284 -#define INTEGER 285 -#define LOOKUPLITERAL 286 -#define CLIENTEXT 287 -#define REQUIRED 288 -#define NOSORT 289 -#define SPIN 290 -#define EQUALS 291 -#define STRINGSSECTION 292 - - - - -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -#line 33 "lib/policy/parse_adm.y" -{ - char *text; - int integer; -} -/* Line 1489 of yacc.c. */ -#line 128 "lib/policy/parse_adm.y" - YYSTYPE; -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 -#endif - -extern YYSTYPE yylval; - diff --git a/source4/lib/policy/parse_adm.y b/source4/lib/policy/parse_adm.y deleted file mode 100644 index 23c5e7730e..0000000000 --- a/source4/lib/policy/parse_adm.y +++ /dev/null @@ -1,138 +0,0 @@ -/* - Unix SMB/CIFS implementation. - Copyright (C) 2006 Wilco Baan Hofman - Copyright (C) 2006 Jelmer Vernooij - - 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, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - For more information on the .ADM file format: - http://msdn2.microsoft.com/en-us/library/aa372405.aspx -*/ - -%{ -#include "config.h" -void error_message (const char *format, ...); -int yyparse (void); -void yyerror (const char *s); -extern int yylex (void); - -%} - -%union { - char *text; - int integer; -} - -%token CATEGORY -%token CLASS -%token CLASS_USER -%token CLASS_MACHINE -%token POLICY -%token KEYNAME -%token EXPLAIN -%token VALUENAME -%token VALUEON VALUEOFF -%token PART -%token ITEMLIST -%token NAME -%token VALUE -%token NUMERIC EDITTEXT TEXT DROPDOWNLIST CHECKBOX -%token MINIMUM MAXIMUM DEFAULT -%token END -%token ACTIONLIST -%token DEL -%token SUPPORTED -%token LITERAL -%token INTEGER -%token LOOKUPLITERAL -%token CLIENTEXT -%token REQUIRED -%token NOSORT -%token SPIN -%token EQUALS -%token STRINGSSECTION - -%start admfile - -%% - -admfile: classes strings; - -classes: /* empty */ | class classes; - -class: CLASS classvalue categories; -classvalue: CLASS_USER|CLASS_MACHINE; - -categories: /* empty */ | category categories; - -string: LITERAL | LOOKUPLITERAL; - -category: CATEGORY string categoryitems END CATEGORY; - -categoryitem: explain | category | policy | keyname; -categoryitems: categoryitem categoryitems | /* empty */ ; - -policy: POLICY string policyitems END POLICY; -policyitem: explain | keyname | valuename | valueon | valueoff | min | max | defaultvalue | supported | part; -policyitems: policyitem policyitems | /* empty */; - -valuetype: NUMERIC | EDITTEXT | TEXT | DROPDOWNLIST | CHECKBOX; - -part: PART string valuetype partitems END PART; - -spin: SPIN INTEGER; - -partitem: keyname | valuename | valueon | valueoff | min | max | defaultvalue | itemlist | REQUIRED | spin; -partitems: partitem partitems | /* empty */; - -min: MINIMUM INTEGER; -max: MAXIMUM INTEGER; -defaultvalue: DEFAULT INTEGER; - -explain: EXPLAIN string; -value: DEL | NUMERIC INTEGER; - -valueon: VALUEON value; -valueoff: VALUEOFF value; - -valuename: VALUENAME string; -keyname: KEYNAME string; - -itemlist: ITEMLIST items END ITEMLIST; -itemname: NAME string; -itemvalue: VALUE value; - -item: itemname | itemvalue | DEFAULT | actionlist; -items: /* empty */ | item items; - -supported: SUPPORTED string; - -actionlist: ACTIONLIST actions END ACTIONLIST; -actions: valuename actions | itemvalue actions | /* empty */; - -variable: LITERAL EQUALS LITERAL; -variables: variable variables | /* empty */; -strings: STRINGSSECTION variables; - -%% - -void -yyerror (const char *s) -{ - error_message ("%s\n", s); -} - - - -- cgit From bbb826bdac54e3fec3426fe6d8e23790abbbc44f Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 17 Apr 2008 01:37:42 +0200 Subject: Add convenience function for getting at event context from ejs code. (This used to be commit b659e83cd6b627dd0ae04064bccff7220a5bd1ce) --- source4/lib/appweb/mpr/miniMpr.c | 6 ++++++ source4/lib/appweb/mpr/miniMpr.h | 2 ++ 2 files changed, 8 insertions(+) (limited to 'source4/lib') diff --git a/source4/lib/appweb/mpr/miniMpr.c b/source4/lib/appweb/mpr/miniMpr.c index 52b23608aa..381815eb23 100644 --- a/source4/lib/appweb/mpr/miniMpr.c +++ b/source4/lib/appweb/mpr/miniMpr.c @@ -31,6 +31,7 @@ #include "miniMpr.h" #include "param/param.h" +#include "lib/events/events.h" /************************************ Code ************************************/ #if !BLD_APPWEB @@ -50,6 +51,11 @@ void *mprMemCtx(void) return mpr_ctx; } +struct event_context *mprEventCtx(void) +{ + return event_context_find(mprMemCtx()); +} + /* return the loadparm context being used for all ejs variables */ struct loadparm_context *mprLpCtx(void) { diff --git a/source4/lib/appweb/mpr/miniMpr.h b/source4/lib/appweb/mpr/miniMpr.h index 15ce30c8df..2b8ff0af6a 100644 --- a/source4/lib/appweb/mpr/miniMpr.h +++ b/source4/lib/appweb/mpr/miniMpr.h @@ -274,6 +274,8 @@ extern void mprSetCtx(void *ctx); extern void *mprMemCtx(void); struct loadparm_context; extern struct loadparm_context *mprLpCtx(void); +struct event_context; +extern struct event_context *mprEventCtx(void); /* This function needs to be provided by anyone using ejs */ void ejs_exception(const char *reason); -- cgit From 0236a50c114bdd53527b7dc0acd81925607621c2 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 17 Apr 2008 11:22:23 +0200 Subject: Skip strcmp() on 2 NULL pointers. Andrew Bartlett (This used to be commit 7b9a647ebbbe9ec9e1b82b42e3a8916396f91273) --- source4/lib/talloc/testsuite.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/talloc/testsuite.c b/source4/lib/talloc/testsuite.c index fedbda95aa..3f06eee566 100644 --- a/source4/lib/talloc/testsuite.c +++ b/source4/lib/talloc/testsuite.c @@ -48,7 +48,8 @@ static double timeval_elapsed(struct timeval *tv) } #define torture_assert_str_equal(test, arg1, arg2, desc) \ - if (strcmp(arg1, arg2)) { \ + if (arg1 == NULL && arg2 == NULL) { \ + } else if (strcmp(arg1, arg2)) { \ printf("failure: %s [\n%s: Expected %s, got %s: %s\n]\n", \ test, __location__, arg1, arg2, desc); \ return false; \ -- cgit From 21fc7673780aa1d7c0caab7b17ff9171238913ba Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 17 Apr 2008 12:23:44 +0200 Subject: Specify event_context to ldb_wrap_connect explicitly. (This used to be commit b4e1ae07a284c044704322446c94351c2decff91) --- source4/lib/ldb_wrap.c | 9 +- source4/lib/ldb_wrap.h | 2 + source4/lib/registry/hive.c | 3 +- source4/lib/registry/ldb.c | 3 +- source4/lib/registry/registry.h | 4 + source4/lib/registry/registry.i | 5 + source4/lib/registry/registry.py | 1 + source4/lib/registry/registry_wrap.c | 170 +++++++++++++++++++++------------- source4/lib/registry/samba.c | 14 +-- source4/lib/registry/tests/hive.c | 2 +- source4/lib/registry/tests/registry.c | 2 +- source4/lib/registry/tools/common.c | 9 +- source4/lib/registry/tools/regdiff.c | 10 +- source4/lib/registry/tools/regpatch.c | 6 +- source4/lib/registry/tools/regshell.c | 7 +- source4/lib/registry/tools/regtree.c | 7 +- 16 files changed, 164 insertions(+), 90 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb_wrap.c b/source4/lib/ldb_wrap.c index 71ba37b479..b71adcbca2 100644 --- a/source4/lib/ldb_wrap.c +++ b/source4/lib/ldb_wrap.c @@ -94,6 +94,7 @@ static int ldb_wrap_destructor(struct ldb_context *ldb) TODO: We need an error_string parameter */ struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx, + struct event_context *ev, struct loadparm_context *lp_ctx, const char *url, struct auth_session_info *session_info, @@ -103,7 +104,6 @@ struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx, { struct ldb_context *ldb; int ret; - struct event_context *ev; char *real_url = NULL; size_t *startup_blocks; @@ -115,10 +115,9 @@ struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx, ldb_set_modules_dir(ldb, talloc_asprintf(ldb, "%s/ldb", lp_modulesdir(lp_ctx))); - /* we want to use the existing event context if possible. This - relies on the fact that in smbd, everything is a child of - the main event_context */ - ev = event_context_find(ldb); + if (ev == NULL) { + ev = event_context_find(mem_ctx); + } if (ldb_set_opaque(ldb, "EventContext", ev)) { talloc_free(ldb); diff --git a/source4/lib/ldb_wrap.h b/source4/lib/ldb_wrap.h index d3ff04b880..e626b6ef8a 100644 --- a/source4/lib/ldb_wrap.h +++ b/source4/lib/ldb_wrap.h @@ -27,10 +27,12 @@ struct ldb_message; struct ldb_dn; struct cli_credentials; struct loadparm_context; +struct event_context; char *wrap_casefold(void *context, void *mem_ctx, const char *s); struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx, + struct event_context *ev, struct loadparm_context *lp_ctx, const char *url, struct auth_session_info *session_info, diff --git a/source4/lib/registry/hive.c b/source4/lib/registry/hive.c index 2a9b1a59ce..4a2309faee 100644 --- a/source4/lib/registry/hive.c +++ b/source4/lib/registry/hive.c @@ -28,6 +28,7 @@ _PUBLIC_ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location, struct auth_session_info *session_info, struct cli_credentials *credentials, + struct event_context *ev_ctx, struct loadparm_context *lp_ctx, struct hive_key **root) { @@ -57,7 +58,7 @@ _PUBLIC_ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location, } else if (!strncmp(peek, "TDB file", 8)) { close(fd); return reg_open_ldb_file(parent_ctx, location, session_info, - credentials, lp_ctx, root); + credentials, ev_ctx, lp_ctx, root); } return WERR_BADFILE; diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c index a764ca6235..a8a9ed597e 100644 --- a/source4/lib/registry/ldb.c +++ b/source4/lib/registry/ldb.c @@ -357,6 +357,7 @@ static WERROR ldb_open_key(TALLOC_CTX *mem_ctx, const struct hive_key *h, WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location, struct auth_session_info *session_info, struct cli_credentials *credentials, + struct event_context *ev_ctx, struct loadparm_context *lp_ctx, struct hive_key **k) { @@ -367,7 +368,7 @@ WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location, if (location == NULL) return WERR_INVALID_PARAM; - wrap = ldb_wrap_connect(parent_ctx, lp_ctx, + wrap = ldb_wrap_connect(parent_ctx, ev_ctx, lp_ctx, location, session_info, credentials, 0, NULL); if (wrap == NULL) { diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index d4c4a89c20..9c0f66b6d6 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -149,10 +149,12 @@ struct hive_operations { struct cli_credentials; struct auth_session_info; +struct event_context; WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location, struct auth_session_info *session_info, struct cli_credentials *credentials, + struct event_context *ev_ctx, struct loadparm_context *lp_ctx, struct hive_key **root); WERROR hive_key_get_info(TALLOC_CTX *mem_ctx, const struct hive_key *key, @@ -199,6 +201,7 @@ WERROR reg_open_regf_file(TALLOC_CTX *parent_ctx, WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location, struct auth_session_info *session_info, struct cli_credentials *credentials, + struct event_context *ev_ctx, struct loadparm_context *lp_ctx, struct hive_key **k); @@ -359,6 +362,7 @@ WERROR reg_open_local(TALLOC_CTX *mem_ctx, WERROR reg_open_samba(TALLOC_CTX *mem_ctx, struct registry_context **ctx, + struct event_context *ev_ctx, struct loadparm_context *lp_ctx, struct auth_session_info *session_info, struct cli_credentials *credentials); diff --git a/source4/lib/registry/registry.i b/source4/lib/registry/registry.i index 1b3c1c281a..5ffee4bb3d 100644 --- a/source4/lib/registry/registry.i +++ b/source4/lib/registry/registry.i @@ -26,6 +26,7 @@ #include "includes.h" #include "registry.h" #include "param/param.h" +#include "events/events.h" typedef struct registry_context reg; typedef struct hive_key hive_key; @@ -41,6 +42,7 @@ typedef struct hive_key hive_key; %import "../../auth/credentials/credentials.i" %import "../../libcli/util/errors.i" %import "../../param/param.i" +%import "../events/events.i" /* Utility functions */ @@ -132,6 +134,7 @@ typedef struct registry_context { WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location, struct auth_session_info *session_info, struct cli_credentials *credentials, + struct event_context *ev_ctx, struct loadparm_context *lp_ctx, struct hive_key **root); @@ -139,6 +142,7 @@ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location, WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location, struct auth_session_info *session_info, struct cli_credentials *credentials, + struct event_context *ev_ctx, struct loadparm_context *lp_ctx, struct hive_key **k); @@ -165,6 +169,7 @@ typedef struct hive_key { WERROR reg_open_samba(TALLOC_CTX *mem_ctx, struct registry_context **ctx, + struct event_context *ev_ctx, struct loadparm_context *lp_ctx, struct auth_session_info *session_info, struct cli_credentials *credentials); diff --git a/source4/lib/registry/registry.py b/source4/lib/registry/registry.py index 9dab309f33..cb20d6039d 100644 --- a/source4/lib/registry/registry.py +++ b/source4/lib/registry/registry.py @@ -59,6 +59,7 @@ def _swig_setattr_nondynamic_method(set): import credentials import param +import events reg_get_predef_name = _registry.reg_get_predef_name str_regtype = _registry.str_regtype Registry = _registry.Registry diff --git a/source4/lib/registry/registry_wrap.c b/source4/lib/registry/registry_wrap.c index 4879b2e144..d9b85ee937 100644 --- a/source4/lib/registry/registry_wrap.c +++ b/source4/lib/registry/registry_wrap.c @@ -2478,29 +2478,30 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) #define SWIGTYPE_p_auth_session_info swig_types[1] #define SWIGTYPE_p_char swig_types[2] #define SWIGTYPE_p_cli_credentials swig_types[3] -#define SWIGTYPE_p_hive_key swig_types[4] -#define SWIGTYPE_p_int swig_types[5] -#define SWIGTYPE_p_loadparm_context swig_types[6] -#define SWIGTYPE_p_loadparm_service swig_types[7] -#define SWIGTYPE_p_long_long swig_types[8] -#define SWIGTYPE_p_p_char swig_types[9] -#define SWIGTYPE_p_p_hive_key swig_types[10] -#define SWIGTYPE_p_p_registry_context swig_types[11] -#define SWIGTYPE_p_p_registry_key swig_types[12] -#define SWIGTYPE_p_param_context swig_types[13] -#define SWIGTYPE_p_param_opt swig_types[14] -#define SWIGTYPE_p_param_section swig_types[15] -#define SWIGTYPE_p_reg_diff_callbacks swig_types[16] -#define SWIGTYPE_p_registry_context swig_types[17] -#define SWIGTYPE_p_registry_key swig_types[18] -#define SWIGTYPE_p_short swig_types[19] -#define SWIGTYPE_p_signed_char swig_types[20] -#define SWIGTYPE_p_unsigned_char swig_types[21] -#define SWIGTYPE_p_unsigned_int swig_types[22] -#define SWIGTYPE_p_unsigned_long_long swig_types[23] -#define SWIGTYPE_p_unsigned_short swig_types[24] -static swig_type_info *swig_types[26]; -static swig_module_info swig_module = {swig_types, 25, 0, 0, 0, 0}; +#define SWIGTYPE_p_event_context swig_types[4] +#define SWIGTYPE_p_hive_key swig_types[5] +#define SWIGTYPE_p_int swig_types[6] +#define SWIGTYPE_p_loadparm_context swig_types[7] +#define SWIGTYPE_p_loadparm_service swig_types[8] +#define SWIGTYPE_p_long_long swig_types[9] +#define SWIGTYPE_p_p_char swig_types[10] +#define SWIGTYPE_p_p_hive_key swig_types[11] +#define SWIGTYPE_p_p_registry_context swig_types[12] +#define SWIGTYPE_p_p_registry_key swig_types[13] +#define SWIGTYPE_p_param_context swig_types[14] +#define SWIGTYPE_p_param_opt swig_types[15] +#define SWIGTYPE_p_param_section swig_types[16] +#define SWIGTYPE_p_reg_diff_callbacks swig_types[17] +#define SWIGTYPE_p_registry_context swig_types[18] +#define SWIGTYPE_p_registry_key swig_types[19] +#define SWIGTYPE_p_short swig_types[20] +#define SWIGTYPE_p_signed_char swig_types[21] +#define SWIGTYPE_p_unsigned_char swig_types[22] +#define SWIGTYPE_p_unsigned_int swig_types[23] +#define SWIGTYPE_p_unsigned_long_long swig_types[24] +#define SWIGTYPE_p_unsigned_short swig_types[25] +static swig_type_info *swig_types[27]; +static swig_module_info swig_module = {swig_types, 26, 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) @@ -2547,6 +2548,7 @@ static swig_module_info swig_module = {swig_types, 25, 0, 0, 0, 0}; #include "includes.h" #include "registry.h" #include "param/param.h" +#include "events/events.h" typedef struct registry_context reg; typedef struct hive_key hive_key; @@ -3462,8 +3464,9 @@ SWIGINTERN PyObject *_wrap_hive_key(PyObject *SWIGUNUSEDPARM(self), PyObject *ar char *arg2 = (char *) 0 ; struct auth_session_info *arg3 = (struct auth_session_info *) 0 ; struct cli_credentials *arg4 = (struct cli_credentials *) 0 ; - struct loadparm_context *arg5 = (struct loadparm_context *) 0 ; - struct hive_key **arg6 = (struct hive_key **) 0 ; + struct event_context *arg5 = (struct event_context *) 0 ; + struct loadparm_context *arg6 = (struct loadparm_context *) 0 ; + struct hive_key **arg7 = (struct hive_key **) 0 ; WERROR result; int res2 ; char *buf2 = 0 ; @@ -3474,21 +3477,25 @@ SWIGINTERN PyObject *_wrap_hive_key(PyObject *SWIGUNUSEDPARM(self), PyObject *ar int res4 = 0 ; void *argp5 = 0 ; int res5 = 0 ; - struct hive_key *tmp6 ; + void *argp6 = 0 ; + int res6 = 0 ; + struct hive_key *tmp7 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; char * kwnames[] = { - (char *) "location",(char *) "session_info",(char *) "credentials",(char *) "lp_ctx", NULL + (char *) "location",(char *) "session_info",(char *) "credentials",(char *) "ev_ctx",(char *) "lp_ctx", NULL }; arg3 = NULL; arg4 = NULL; - arg5 = loadparm_init(NULL); + arg5 = event_context_init(NULL); + arg6 = loadparm_init(NULL); arg1 = NULL; - arg6 = &tmp6; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OOO:hive_key",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail; + arg7 = &tmp7; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OOOO:hive_key",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; res2 = SWIG_AsCharPtrAndSize(obj0, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "hive_key" "', argument " "2"" of type '" "char const *""'"); @@ -3509,13 +3516,20 @@ SWIGINTERN PyObject *_wrap_hive_key(PyObject *SWIGUNUSEDPARM(self), PyObject *ar arg4 = (struct cli_credentials *)(argp4); } if (obj3) { - res5 = SWIG_ConvertPtr(obj3, &argp5,SWIGTYPE_p_loadparm_context, 0 | 0 ); + res5 = SWIG_ConvertPtr(obj3, &argp5,SWIGTYPE_p_event_context, 0 | 0 ); if (!SWIG_IsOK(res5)) { - SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "hive_key" "', argument " "5"" of type '" "struct loadparm_context *""'"); + SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "hive_key" "', argument " "5"" of type '" "struct event_context *""'"); } - arg5 = (struct loadparm_context *)(argp5); + arg5 = (struct event_context *)(argp5); } - result = reg_open_hive(arg1,(char const *)arg2,arg3,arg4,arg5,arg6); + if (obj4) { + res6 = SWIG_ConvertPtr(obj4, &argp6,SWIGTYPE_p_loadparm_context, 0 | 0 ); + if (!SWIG_IsOK(res6)) { + SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "hive_key" "', argument " "6"" of type '" "struct loadparm_context *""'"); + } + arg6 = (struct loadparm_context *)(argp6); + } + result = reg_open_hive(arg1,(char const *)arg2,arg3,arg4,arg5,arg6,arg7); if (!W_ERROR_IS_OK(result)) { PyObject *obj = Py_BuildValue((char *)"(i,s)", W_ERROR_V(result), win_errstr(result)); PyErr_SetObject(PyExc_RuntimeError, obj); @@ -3524,7 +3538,7 @@ SWIGINTERN PyObject *_wrap_hive_key(PyObject *SWIGUNUSEDPARM(self), PyObject *ar resultobj = Py_None; } Py_XDECREF(resultobj); - resultobj = SWIG_NewPointerObj(*arg6, SWIGTYPE_p_hive_key, 0); + resultobj = SWIG_NewPointerObj(*arg7, SWIGTYPE_p_hive_key, 0); if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return resultobj; fail: @@ -3539,8 +3553,9 @@ SWIGINTERN PyObject *_wrap_open_ldb(PyObject *SWIGUNUSEDPARM(self), PyObject *ar char *arg2 = (char *) 0 ; struct auth_session_info *arg3 = (struct auth_session_info *) 0 ; struct cli_credentials *arg4 = (struct cli_credentials *) 0 ; - struct loadparm_context *arg5 = (struct loadparm_context *) 0 ; - struct hive_key **arg6 = (struct hive_key **) 0 ; + struct event_context *arg5 = (struct event_context *) 0 ; + struct loadparm_context *arg6 = (struct loadparm_context *) 0 ; + struct hive_key **arg7 = (struct hive_key **) 0 ; WERROR result; int res2 ; char *buf2 = 0 ; @@ -3551,21 +3566,25 @@ SWIGINTERN PyObject *_wrap_open_ldb(PyObject *SWIGUNUSEDPARM(self), PyObject *ar int res4 = 0 ; void *argp5 = 0 ; int res5 = 0 ; - struct hive_key *tmp6 ; + void *argp6 = 0 ; + int res6 = 0 ; + struct hive_key *tmp7 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; char * kwnames[] = { - (char *) "location",(char *) "session_info",(char *) "credentials",(char *) "lp_ctx", NULL + (char *) "location",(char *) "session_info",(char *) "credentials",(char *) "ev_ctx",(char *) "lp_ctx", NULL }; arg3 = NULL; arg4 = NULL; - arg5 = loadparm_init(NULL); + arg5 = event_context_init(NULL); + arg6 = loadparm_init(NULL); arg1 = NULL; - arg6 = &tmp6; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OOO:open_ldb",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail; + arg7 = &tmp7; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OOOO:open_ldb",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; res2 = SWIG_AsCharPtrAndSize(obj0, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "open_ldb" "', argument " "2"" of type '" "char const *""'"); @@ -3586,13 +3605,20 @@ SWIGINTERN PyObject *_wrap_open_ldb(PyObject *SWIGUNUSEDPARM(self), PyObject *ar arg4 = (struct cli_credentials *)(argp4); } if (obj3) { - res5 = SWIG_ConvertPtr(obj3, &argp5,SWIGTYPE_p_loadparm_context, 0 | 0 ); + res5 = SWIG_ConvertPtr(obj3, &argp5,SWIGTYPE_p_event_context, 0 | 0 ); if (!SWIG_IsOK(res5)) { - SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "open_ldb" "', argument " "5"" of type '" "struct loadparm_context *""'"); + SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "open_ldb" "', argument " "5"" of type '" "struct event_context *""'"); } - arg5 = (struct loadparm_context *)(argp5); + arg5 = (struct event_context *)(argp5); } - result = reg_open_ldb_file(arg1,(char const *)arg2,arg3,arg4,arg5,arg6); + if (obj4) { + res6 = SWIG_ConvertPtr(obj4, &argp6,SWIGTYPE_p_loadparm_context, 0 | 0 ); + if (!SWIG_IsOK(res6)) { + SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "open_ldb" "', argument " "6"" of type '" "struct loadparm_context *""'"); + } + arg6 = (struct loadparm_context *)(argp6); + } + result = reg_open_ldb_file(arg1,(char const *)arg2,arg3,arg4,arg5,arg6,arg7); if (!W_ERROR_IS_OK(result)) { PyObject *obj = Py_BuildValue((char *)"(i,s)", W_ERROR_V(result), win_errstr(result)); PyErr_SetObject(PyExc_RuntimeError, obj); @@ -3601,7 +3627,7 @@ SWIGINTERN PyObject *_wrap_open_ldb(PyObject *SWIGUNUSEDPARM(self), PyObject *ar resultobj = Py_None; } Py_XDECREF(resultobj); - resultobj = SWIG_NewPointerObj(*arg6, SWIGTYPE_p_hive_key, 0); + resultobj = SWIG_NewPointerObj(*arg7, SWIGTYPE_p_hive_key, 0); if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return resultobj; fail: @@ -3696,9 +3722,10 @@ SWIGINTERN PyObject *_wrap_open_samba(PyObject *SWIGUNUSEDPARM(self), PyObject * PyObject *resultobj = 0; TALLOC_CTX *arg1 = (TALLOC_CTX *) 0 ; struct registry_context **arg2 = (struct registry_context **) 0 ; - struct loadparm_context *arg3 = (struct loadparm_context *) 0 ; - struct auth_session_info *arg4 = (struct auth_session_info *) 0 ; - struct cli_credentials *arg5 = (struct cli_credentials *) 0 ; + struct event_context *arg3 = (struct event_context *) 0 ; + struct loadparm_context *arg4 = (struct loadparm_context *) 0 ; + struct auth_session_info *arg5 = (struct auth_session_info *) 0 ; + struct cli_credentials *arg6 = (struct cli_credentials *) 0 ; WERROR result; struct registry_context *tmp2 ; void *argp3 = 0 ; @@ -3707,41 +3734,52 @@ SWIGINTERN PyObject *_wrap_open_samba(PyObject *SWIGUNUSEDPARM(self), PyObject * int res4 = 0 ; void *argp5 = 0 ; int res5 = 0 ; + void *argp6 = 0 ; + int res6 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; char * kwnames[] = { - (char *) "lp_ctx",(char *) "session_info",(char *) "credentials", NULL + (char *) "ev_ctx",(char *) "lp_ctx",(char *) "session_info",(char *) "credentials", NULL }; - arg3 = loadparm_init(NULL); - arg4 = NULL; + arg3 = event_context_init(NULL); + arg4 = loadparm_init(NULL); arg5 = NULL; + arg6 = NULL; arg1 = NULL; arg2 = &tmp2; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OOO:open_samba",kwnames,&obj0,&obj1,&obj2)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OOOO:open_samba",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail; if (obj0) { - res3 = SWIG_ConvertPtr(obj0, &argp3,SWIGTYPE_p_loadparm_context, 0 | 0 ); + res3 = SWIG_ConvertPtr(obj0, &argp3,SWIGTYPE_p_event_context, 0 | 0 ); if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "open_samba" "', argument " "3"" of type '" "struct loadparm_context *""'"); + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "open_samba" "', argument " "3"" of type '" "struct event_context *""'"); } - arg3 = (struct loadparm_context *)(argp3); + arg3 = (struct event_context *)(argp3); } if (obj1) { - res4 = SWIG_ConvertPtr(obj1, &argp4,SWIGTYPE_p_auth_session_info, 0 | 0 ); + res4 = SWIG_ConvertPtr(obj1, &argp4,SWIGTYPE_p_loadparm_context, 0 | 0 ); if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "open_samba" "', argument " "4"" of type '" "struct auth_session_info *""'"); + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "open_samba" "', argument " "4"" of type '" "struct loadparm_context *""'"); } - arg4 = (struct auth_session_info *)(argp4); + arg4 = (struct loadparm_context *)(argp4); } if (obj2) { - res5 = SWIG_ConvertPtr(obj2, &argp5,SWIGTYPE_p_cli_credentials, 0 | 0 ); + res5 = SWIG_ConvertPtr(obj2, &argp5,SWIGTYPE_p_auth_session_info, 0 | 0 ); if (!SWIG_IsOK(res5)) { - SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "open_samba" "', argument " "5"" of type '" "struct cli_credentials *""'"); + SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "open_samba" "', argument " "5"" of type '" "struct auth_session_info *""'"); + } + arg5 = (struct auth_session_info *)(argp5); + } + if (obj3) { + res6 = SWIG_ConvertPtr(obj3, &argp6,SWIGTYPE_p_cli_credentials, 0 | 0 ); + if (!SWIG_IsOK(res6)) { + SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "open_samba" "', argument " "6"" of type '" "struct cli_credentials *""'"); } - arg5 = (struct cli_credentials *)(argp5); + arg6 = (struct cli_credentials *)(argp6); } - result = reg_open_samba(arg1,arg2,arg3,arg4,arg5); + result = reg_open_samba(arg1,arg2,arg3,arg4,arg5,arg6); if (!W_ERROR_IS_OK(result)) { PyObject *obj = Py_BuildValue((char *)"(i,s)", W_ERROR_V(result), win_errstr(result)); PyErr_SetObject(PyExc_RuntimeError, obj); @@ -3786,6 +3824,7 @@ static swig_type_info _swigt__p_TALLOC_CTX = {"_p_TALLOC_CTX", "TALLOC_CTX *", 0 static swig_type_info _swigt__p_auth_session_info = {"_p_auth_session_info", "struct auth_session_info *", 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 *|cli_credentials *", 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_hive_key = {"_p_hive_key", "struct hive_key *", 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_loadparm_context = {"_p_loadparm_context", "struct loadparm_context *|loadparm_context *", 0, 0, (void*)0, 0}; @@ -3813,6 +3852,7 @@ static swig_type_info *swig_type_initial[] = { &_swigt__p_auth_session_info, &_swigt__p_char, &_swigt__p_cli_credentials, + &_swigt__p_event_context, &_swigt__p_hive_key, &_swigt__p_int, &_swigt__p_loadparm_context, @@ -3840,6 +3880,7 @@ static swig_cast_info _swigc__p_TALLOC_CTX[] = { {&_swigt__p_TALLOC_CTX, 0, 0, static swig_cast_info _swigc__p_auth_session_info[] = { {&_swigt__p_auth_session_info, 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_cli_credentials[] = { {&_swigt__p_cli_credentials, 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_hive_key[] = { {&_swigt__p_hive_key, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_int[] = { {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_loadparm_context[] = { {&_swigt__p_loadparm_context, 0, 0, 0},{0, 0, 0, 0}}; @@ -3867,6 +3908,7 @@ static swig_cast_info *swig_cast_initial[] = { _swigc__p_auth_session_info, _swigc__p_char, _swigc__p_cli_credentials, + _swigc__p_event_context, _swigc__p_hive_key, _swigc__p_int, _swigc__p_loadparm_context, diff --git a/source4/lib/registry/samba.c b/source4/lib/registry/samba.c index 59693dde8e..84a8112f17 100644 --- a/source4/lib/registry/samba.c +++ b/source4/lib/registry/samba.c @@ -26,6 +26,7 @@ */ static WERROR mount_samba_hive(struct registry_context *ctx, + struct event_context *event_ctx, struct loadparm_context *lp_ctx, struct auth_session_info *auth_info, struct cli_credentials *creds, @@ -40,11 +41,11 @@ static WERROR mount_samba_hive(struct registry_context *ctx, lp_private_dir(lp_ctx), name); - error = reg_open_hive(ctx, location, auth_info, creds, lp_ctx, &hive); + error = reg_open_hive(ctx, location, auth_info, creds, event_ctx, lp_ctx, &hive); if (W_ERROR_EQUAL(error, WERR_BADFILE)) error = reg_open_ldb_file(ctx, location, auth_info, - creds, lp_ctx, &hive); + creds, event_ctx, lp_ctx, &hive); if (!W_ERROR_IS_OK(error)) return error; @@ -55,6 +56,7 @@ static WERROR mount_samba_hive(struct registry_context *ctx, _PUBLIC_ WERROR reg_open_samba(TALLOC_CTX *mem_ctx, struct registry_context **ctx, + struct event_context *ev_ctx, struct loadparm_context *lp_ctx, struct auth_session_info *session_info, struct cli_credentials *credentials) @@ -66,18 +68,18 @@ _PUBLIC_ WERROR reg_open_samba(TALLOC_CTX *mem_ctx, return result; } - mount_samba_hive(*ctx, lp_ctx, session_info, credentials, + mount_samba_hive(*ctx, ev_ctx, lp_ctx, session_info, credentials, "hklm", HKEY_LOCAL_MACHINE); - mount_samba_hive(*ctx, lp_ctx, session_info, credentials, + mount_samba_hive(*ctx, ev_ctx, lp_ctx, session_info, credentials, "hkcr", HKEY_CLASSES_ROOT); /* FIXME: Should be mounted from NTUSER.DAT in the home directory of the * current user */ - mount_samba_hive(*ctx, lp_ctx, session_info, credentials, + mount_samba_hive(*ctx, ev_ctx, lp_ctx, session_info, credentials, "hkcu", HKEY_CURRENT_USER); - mount_samba_hive(*ctx, lp_ctx, session_info, credentials, + mount_samba_hive(*ctx, ev_ctx, lp_ctx, session_info, credentials, "hku", HKEY_USERS); /* FIXME: Different hive backend for HKEY_CLASSES_ROOT: merged view of HKEY_LOCAL_MACHINE\Software\Classes diff --git a/source4/lib/registry/tests/hive.c b/source4/lib/registry/tests/hive.c index a16736c761..83abdd793d 100644 --- a/source4/lib/registry/tests/hive.c +++ b/source4/lib/registry/tests/hive.c @@ -363,7 +363,7 @@ static bool hive_setup_ldb(struct torture_context *tctx, void **data) rmdir(dirname); - error = reg_open_ldb_file(tctx, dirname, NULL, NULL, tctx->lp_ctx, &key); + error = reg_open_ldb_file(tctx, dirname, NULL, NULL, tctx->ev, tctx->lp_ctx, &key); if (!W_ERROR_IS_OK(error)) { fprintf(stderr, "Unable to initialize ldb hive\n"); return false; diff --git a/source4/lib/registry/tests/registry.c b/source4/lib/registry/tests/registry.c index 33512a0c8c..ec7873a111 100644 --- a/source4/lib/registry/tests/registry.c +++ b/source4/lib/registry/tests/registry.c @@ -524,7 +524,7 @@ static bool setup_local_registry(struct torture_context *tctx, void **data) torture_assert_ntstatus_ok(tctx, status, "Creating temp dir failed"); filename = talloc_asprintf(tctx, "%s/classes_root.ldb", tempdir); - error = reg_open_ldb_file(tctx, filename, NULL, NULL, tctx->lp_ctx, &hive_key); + error = reg_open_ldb_file(tctx, filename, NULL, NULL, tctx->ev, tctx->lp_ctx, &hive_key); torture_assert_werr_ok(tctx, error, "Opening classes_root file failed"); error = reg_mount_hive(rctx, hive_key, HKEY_CLASSES_ROOT, NULL); diff --git a/source4/lib/registry/tools/common.c b/source4/lib/registry/tools/common.c index 52f3c6f551..3ea780de60 100644 --- a/source4/lib/registry/tools/common.c +++ b/source4/lib/registry/tools/common.c @@ -42,6 +42,7 @@ struct registry_context *reg_common_open_remote(const char *remote, } struct registry_key *reg_common_open_file(const char *path, + struct event_context *ev_ctx, struct loadparm_context *lp_ctx, struct cli_credentials *creds) { @@ -49,7 +50,7 @@ struct registry_key *reg_common_open_file(const char *path, struct registry_context *h = NULL; WERROR error; - error = reg_open_hive(NULL, path, NULL, creds, lp_ctx, &hive_root); + error = reg_open_hive(NULL, path, NULL, creds, ev_ctx, lp_ctx, &hive_root); if(!W_ERROR_IS_OK(error)) { fprintf(stderr, "Unable to open '%s': %s \n", @@ -67,12 +68,14 @@ struct registry_key *reg_common_open_file(const char *path, return reg_import_hive_key(h, hive_root, -1, NULL); } -struct registry_context *reg_common_open_local(struct cli_credentials *creds, struct loadparm_context *lp_ctx) +struct registry_context *reg_common_open_local(struct cli_credentials *creds, + struct event_context *ev_ctx, + struct loadparm_context *lp_ctx) { WERROR error; struct registry_context *h = NULL; - error = reg_open_samba(NULL, &h, lp_ctx, NULL, creds); + error = reg_open_samba(NULL, &h, ev_ctx, lp_ctx, NULL, creds); if(!W_ERROR_IS_OK(error)) { fprintf(stderr, "Unable to open local registry:%s \n", diff --git a/source4/lib/registry/tools/regdiff.c b/source4/lib/registry/tools/regdiff.c index 69fcfc2493..9b49799bed 100644 --- a/source4/lib/registry/tools/regdiff.c +++ b/source4/lib/registry/tools/regdiff.c @@ -29,6 +29,7 @@ enum reg_backend { REG_UNKNOWN, REG_LOCAL, REG_REMOTE, REG_NULL }; static struct registry_context *open_backend(poptContext pc, + struct event_context *ev_ctx, struct loadparm_context *lp_ctx, enum reg_backend backend, const char *remote_host) @@ -41,7 +42,7 @@ static struct registry_context *open_backend(poptContext pc, poptPrintUsage(pc, stderr, 0); return NULL; case REG_LOCAL: - error = reg_open_samba(NULL, &ctx, lp_ctx, NULL, cmdline_credentials); + error = reg_open_samba(NULL, &ctx, ev_ctx, lp_ctx, NULL, cmdline_credentials); break; case REG_REMOTE: error = reg_open_remote(&ctx, NULL, cmdline_credentials, lp_ctx, @@ -82,6 +83,7 @@ int main(int argc, const char **argv) }; TALLOC_CTX *ctx; void *callback_data; + struct event_context *ev_ctx; struct reg_diff_callbacks *callbacks; ctx = talloc_init("regdiff"); @@ -116,11 +118,13 @@ int main(int argc, const char **argv) } - h1 = open_backend(pc, cmdline_lp_ctx, backend1, remote1); + ev_ctx = event_context_init(NULL); + + h1 = open_backend(pc, ev_ctx, cmdline_lp_ctx, backend1, remote1); if (h1 == NULL) return 1; - h2 = open_backend(pc, cmdline_lp_ctx, backend2, remote2); + h2 = open_backend(pc, ev_ctx, cmdline_lp_ctx, backend2, remote2); if (h2 == NULL) return 1; diff --git a/source4/lib/registry/tools/regpatch.c b/source4/lib/registry/tools/regpatch.c index 98443e6456..9285459d85 100644 --- a/source4/lib/registry/tools/regpatch.c +++ b/source4/lib/registry/tools/regpatch.c @@ -24,6 +24,7 @@ #include "lib/cmdline/popt_common.h" #include "lib/registry/tools/common.h" #include "param/param.h" +#include "events/events.h" int main(int argc, char **argv) { @@ -33,6 +34,7 @@ int main(int argc, char **argv) struct registry_context *h; const char *file = NULL; const char *remote = NULL; + struct event_context *ev; struct poptOption long_options[] = { POPT_AUTOHELP {"remote", 'R', POPT_ARG_STRING, &remote, 0, "connect to specified remote server", NULL}, @@ -47,10 +49,12 @@ int main(int argc, char **argv) while((opt = poptGetNextOpt(pc)) != -1) { } + ev = event_context_init(NULL); + if (remote) { h = reg_common_open_remote (remote, cmdline_lp_ctx, cmdline_credentials); } else { - h = reg_common_open_local (cmdline_credentials, cmdline_lp_ctx); + h = reg_common_open_local (cmdline_credentials, ev, cmdline_lp_ctx); } if (h == NULL) diff --git a/source4/lib/registry/tools/regshell.c b/source4/lib/registry/tools/regshell.c index 58f64cb049..80eafcc4a2 100644 --- a/source4/lib/registry/tools/regshell.c +++ b/source4/lib/registry/tools/regshell.c @@ -498,6 +498,7 @@ int main(int argc, char **argv) poptContext pc; const char *remote = NULL; struct regshell_context *ctx; + struct event_context *ev_ctx; bool ret = true; struct poptOption long_options[] = { POPT_AUTOHELP @@ -516,17 +517,19 @@ int main(int argc, char **argv) ctx = talloc_zero(NULL, struct regshell_context); + ev_ctx = event_context_init(ctx); + if (remote != NULL) { ctx->registry = reg_common_open_remote(remote, cmdline_lp_ctx, cmdline_credentials); } else if (file != NULL) { - ctx->current = reg_common_open_file(file, cmdline_lp_ctx, cmdline_credentials); + ctx->current = reg_common_open_file(file, ev_ctx, cmdline_lp_ctx, cmdline_credentials); if (ctx->current == NULL) return 1; ctx->registry = ctx->current->context; ctx->path = talloc_strdup(ctx, ""); } else { - ctx->registry = reg_common_open_local(cmdline_credentials, cmdline_lp_ctx); + ctx->registry = reg_common_open_local(cmdline_credentials, ev_ctx, cmdline_lp_ctx); } if (ctx->registry == NULL) diff --git a/source4/lib/registry/tools/regtree.c b/source4/lib/registry/tools/regtree.c index 424d3515e0..440399f764 100644 --- a/source4/lib/registry/tools/regtree.c +++ b/source4/lib/registry/tools/regtree.c @@ -109,6 +109,7 @@ int main(int argc, char **argv) poptContext pc; struct registry_context *h = NULL; struct registry_key *start_key = NULL; + struct event_context *ev_ctx; WERROR error; bool fullpath = false, no_values = false; struct poptOption long_options[] = { @@ -128,12 +129,14 @@ int main(int argc, char **argv) while((opt = poptGetNextOpt(pc)) != -1) { } + ev_ctx = event_context_init(NULL); + if (remote != NULL) { h = reg_common_open_remote(remote, cmdline_lp_ctx, cmdline_credentials); } else if (file != NULL) { - start_key = reg_common_open_file(file, cmdline_lp_ctx, cmdline_credentials); + start_key = reg_common_open_file(file, ev_ctx, cmdline_lp_ctx, cmdline_credentials); } else { - h = reg_common_open_local(cmdline_credentials, cmdline_lp_ctx); + h = reg_common_open_local(cmdline_credentials, ev_ctx, cmdline_lp_ctx); } if (h == NULL && start_key == NULL) -- cgit From 107ab090e23dfc517bc74bb553315cd3528e1f7d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 17 Apr 2008 14:47:07 +0200 Subject: use uintptr_t instead of intptr_t where appropriate (This used to be commit d62f2bcc85c13605c133db250e0a86d2d6ccc481) --- source4/lib/ldb/ldb_tdb/ldb_index.c | 4 ++-- source4/lib/replace/libreplace_cc.m4 | 3 ++- source4/lib/replace/replace.c | 2 +- source4/lib/replace/replace.h | 2 +- source4/lib/util/util.h | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/ldb_tdb/ldb_index.c b/source4/lib/ldb/ldb_tdb/ldb_index.c index d8776f48e2..1b6d9feed6 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_index.c +++ b/source4/lib/ldb/ldb_tdb/ldb_index.c @@ -545,7 +545,7 @@ static int ltdb_index_dn_one(struct ldb_module *module, /* the attribute is indexed. Pull the list of DNs that match the search criterion */ - val.data = (uint8_t *)((intptr_t)ldb_dn_get_casefold(parent_dn)); + val.data = (uint8_t *)((uintptr_t)ldb_dn_get_casefold(parent_dn)); val.length = strlen((char *)val.data); key = ltdb_index_key(ldb, LTDB_IDXONE, &val); if (!key) { @@ -1140,7 +1140,7 @@ int ltdb_index_one(struct ldb_module *module, const struct ldb_message *msg, int return LDB_ERR_OPERATIONS_ERROR; } - val.data = (uint8_t *)((intptr_t)ldb_dn_get_casefold(pdn)); + val.data = (uint8_t *)((uintptr_t)ldb_dn_get_casefold(pdn)); if (val.data == NULL) { talloc_free(pdn); return LDB_ERR_OPERATIONS_ERROR; diff --git a/source4/lib/replace/libreplace_cc.m4 b/source4/lib/replace/libreplace_cc.m4 index bf5056838d..0ce0958a96 100644 --- a/source4/lib/replace/libreplace_cc.m4 +++ b/source4/lib/replace/libreplace_cc.m4 @@ -132,7 +132,8 @@ AC_CHECK_SIZEOF(off_t) AC_CHECK_SIZEOF(size_t) AC_CHECK_SIZEOF(ssize_t) -AC_CHECK_TYPE(intptr_t, unsigned long long) +AC_CHECK_TYPE(intptr_t, long long) +AC_CHECK_TYPE(uintptr_t, unsigned long long) AC_CHECK_TYPE(ptrdiff_t, unsigned long long) if test x"$ac_cv_type_long_long" != x"yes";then diff --git a/source4/lib/replace/replace.c b/source4/lib/replace/replace.c index 6930f9b079..443da2ab24 100644 --- a/source4/lib/replace/replace.c +++ b/source4/lib/replace/replace.c @@ -458,7 +458,7 @@ char *rep_strcasestr(const char *haystack, const char *needle) for (s=haystack;*s;s++) { if (toupper(*needle) == toupper(*s) && strncasecmp(s, needle, nlen) == 0) { - return (char *)((intptr_t)s); + return (char *)((uintptr_t)s); } } return NULL; diff --git a/source4/lib/replace/replace.h b/source4/lib/replace/replace.h index 5fe79394eb..bf95169352 100644 --- a/source4/lib/replace/replace.h +++ b/source4/lib/replace/replace.h @@ -499,7 +499,7 @@ typedef int bool; Also, please call this via the discard_const_p() macro interface, as that makes the return type safe. */ -#define discard_const(ptr) ((void *)((intptr_t)(ptr))) +#define discard_const(ptr) ((void *)((uintptr_t)(ptr))) /** Type-safe version of discard_const */ #define discard_const_p(type, ptr) ((type *)discard_const(ptr)) diff --git a/source4/lib/util/util.h b/source4/lib/util/util.h index 3bf6b98d2f..ffe83c14b2 100644 --- a/source4/lib/util/util.h +++ b/source4/lib/util/util.h @@ -64,7 +64,7 @@ extern const char *panic_action; makes the return type safe. */ #ifndef discard_const -#define discard_const(ptr) ((void *)((intptr_t)(ptr))) +#define discard_const(ptr) ((void *)((uintptr_t)(ptr))) #endif /** Type-safe version of discard_const */ -- cgit From e739fe91cfdbb7c8a792c4bdc6c5f18603507fc6 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 17 Apr 2008 15:54:22 +0200 Subject: Fix bug in registry test on big-endian machines. Andrew Bartlett (This used to be commit c74c67c38383b43efd707934e8c457b757e49db1) --- source4/lib/registry/tests/hive.c | 35 ++++++++++++++++++++++------------- source4/lib/registry/tests/registry.c | 16 ++++++++++------ 2 files changed, 32 insertions(+), 19 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/registry/tests/hive.c b/source4/lib/registry/tests/hive.c index 83abdd793d..29f7e685c1 100644 --- a/source4/lib/registry/tests/hive.c +++ b/source4/lib/registry/tests/hive.c @@ -68,14 +68,15 @@ static bool test_keyinfo_nums(struct torture_context *tctx, void *test_data) struct hive_key *root = (struct hive_key *)test_data; WERROR error; struct hive_key *subkey; - uint32_t data = 42; + char data[4]; + SIVAL(data, 0, 42); error = hive_key_add_name(tctx, root, "Nested Keyll", NULL, NULL, &subkey); torture_assert_werr_ok(tctx, error, "hive_key_add_name"); error = hive_key_set_value(root, "Answer", REG_DWORD, - data_blob_talloc(tctx, &data, sizeof(data))); + data_blob_talloc(tctx, data, sizeof(data))); torture_assert_werr_ok(tctx, error, "hive_key_set_value"); /* This is a new backend. There should be no subkeys and no @@ -119,7 +120,8 @@ static bool test_del_recursive(struct torture_context *tctx, struct hive_key *subkey2; const struct hive_key *root = (const struct hive_key *)test_data; TALLOC_CTX *mem_ctx = tctx; - uint32_t data = 42; + char data[4]; + SIVAL(data, 0, 42); /* Create a new key under the root */ error = hive_key_add_name(mem_ctx, root, "Parent Key", NULL, @@ -133,7 +135,7 @@ static bool test_del_recursive(struct torture_context *tctx, /* Create a new value under "Child Key" */ error = hive_key_set_value(subkey2, "Answer Recursive", REG_DWORD, - data_blob_talloc(mem_ctx, &data, sizeof(data))); + data_blob_talloc(mem_ctx, data, sizeof(data))); torture_assert_werr_ok(tctx, error, "hive_key_set_value"); /* Deleting "Parent Key" will also delete "Child Key" and the value. */ @@ -179,14 +181,15 @@ static bool test_set_value(struct torture_context *tctx, struct hive_key *subkey; const struct hive_key *root = (const struct hive_key *)test_data; TALLOC_CTX *mem_ctx = tctx; - uint32_t data = 42; + char data[4]; + SIVAL(data, 0, 42); error = hive_key_add_name(mem_ctx, root, "YA Nested Key", NULL, NULL, &subkey); torture_assert_werr_ok(tctx, error, "hive_key_add_name"); error = hive_key_set_value(subkey, "Answer", REG_DWORD, - data_blob_talloc(mem_ctx, &data, sizeof(data))); + data_blob_talloc(mem_ctx, data, sizeof(data))); torture_assert_werr_ok(tctx, error, "hive_key_set_value"); return true; @@ -198,10 +201,12 @@ static bool test_get_value(struct torture_context *tctx, const void *test_data) struct hive_key *subkey; const struct hive_key *root = (const struct hive_key *)test_data; TALLOC_CTX *mem_ctx = tctx; - uint32_t data = 42; + char data[4]; uint32_t type; DATA_BLOB value; + SIVAL(data, 0, 42); + error = hive_key_add_name(mem_ctx, root, "EYA Nested Key", NULL, NULL, &subkey); torture_assert_werr_ok(tctx, error, "hive_key_add_name"); @@ -211,7 +216,7 @@ static bool test_get_value(struct torture_context *tctx, const void *test_data) "getting missing value"); error = hive_key_set_value(subkey, "Answer", REG_DWORD, - data_blob_talloc(mem_ctx, &data, sizeof(data))); + data_blob_talloc(mem_ctx, data, sizeof(data))); torture_assert_werr_ok(tctx, error, "hive_key_set_value"); error = hive_get_value(mem_ctx, subkey, "Answer", &type, &value); @@ -232,16 +237,18 @@ static bool test_del_value(struct torture_context *tctx, const void *test_data) struct hive_key *subkey; const struct hive_key *root = (const struct hive_key *)test_data; TALLOC_CTX *mem_ctx = tctx; - uint32_t data = 42; + char data[4]; uint32_t type; DATA_BLOB value; + SIVAL(data, 0, 42); + error = hive_key_add_name(mem_ctx, root, "EEYA Nested Key", NULL, NULL, &subkey); torture_assert_werr_ok(tctx, error, "hive_key_add_name"); error = hive_key_set_value(subkey, "Answer", REG_DWORD, - data_blob_talloc(mem_ctx, &data, sizeof(data))); + data_blob_talloc(mem_ctx, data, sizeof(data))); torture_assert_werr_ok(tctx, error, "hive_key_set_value"); error = hive_key_del_value(subkey, "Answer"); @@ -264,17 +271,19 @@ static bool test_list_values(struct torture_context *tctx, struct hive_key *subkey; const struct hive_key *root = (const struct hive_key *)test_data; TALLOC_CTX *mem_ctx = tctx; - uint32_t data = 42; + char data[4]; uint32_t type; DATA_BLOB value; const char *name; + int data_val = 42; + SIVAL(data, 0, data_val); error = hive_key_add_name(mem_ctx, root, "AYAYA Nested Key", NULL, NULL, &subkey); torture_assert_werr_ok(tctx, error, "hive_key_add_name"); error = hive_key_set_value(subkey, "Answer", REG_DWORD, - data_blob_talloc(mem_ctx, &data, sizeof(data))); + data_blob_talloc(mem_ctx, data, sizeof(data))); torture_assert_werr_ok(tctx, error, "hive_key_set_value"); error = hive_get_value_by_index(mem_ctx, subkey, 0, &name, @@ -287,7 +296,7 @@ static bool test_list_values(struct torture_context *tctx, torture_assert_int_equal(tctx, type, REG_DWORD, "value type"); - torture_assert_int_equal(tctx, data, IVAL(value.data, 0), "value data"); + torture_assert_int_equal(tctx, data_val, IVAL(value.data, 0), "value data"); error = hive_get_value_by_index(mem_ctx, subkey, 1, &name, &type, &value); diff --git a/source4/lib/registry/tests/registry.c b/source4/lib/registry/tests/registry.c index ec7873a111..ac812823b2 100644 --- a/source4/lib/registry/tests/registry.c +++ b/source4/lib/registry/tests/registry.c @@ -281,7 +281,8 @@ static bool test_query_key_nums(struct torture_context *tctx, void *_data) struct registry_key *root, *subkey1, *subkey2; WERROR error; uint32_t num_subkeys, num_values; - uint32_t data = 42; + char data[4]; + SIVAL(data, 0, 42); if (!create_test_key(tctx, rctx, "Berlin", &root, &subkey1)) return false; @@ -353,13 +354,15 @@ static bool test_set_value(struct torture_context *tctx, void *_data) struct registry_context *rctx = (struct registry_context *)_data; struct registry_key *subkey = NULL, *root; WERROR error; - uint32_t data = 42; + char data[4]; + + SIVAL(data, 0, 42); if (!create_test_key(tctx, rctx, "Dusseldorf", &root, &subkey)) return false; error = reg_val_set(subkey, "Answer", REG_DWORD, - data_blob_talloc(tctx, &data, sizeof(data))); + data_blob_talloc(tctx, data, sizeof(data))); torture_assert_werr_ok (tctx, error, "setting value"); return true; @@ -408,8 +411,9 @@ static bool test_get_value(struct torture_context *tctx, void *_data) struct registry_key *subkey = NULL, *root; WERROR error; DATA_BLOB data; - uint32_t value = 42; + char value[4]; uint32_t type; + SIVAL(value, 0, 42); if (!create_test_key(tctx, rctx, "Duisburg", &root, &subkey)) return false; @@ -420,7 +424,7 @@ static bool test_get_value(struct torture_context *tctx, void *_data) "getting missing value"); error = reg_val_set(subkey, __FUNCTION__, REG_DWORD, - data_blob_talloc(tctx, &value, 4)); + data_blob_talloc(tctx, value, sizeof(value))); torture_assert_werr_ok(tctx, error, "setting value"); error = reg_key_get_value_by_name(tctx, subkey, __FUNCTION__, &type, @@ -428,7 +432,7 @@ static bool test_get_value(struct torture_context *tctx, void *_data) torture_assert_werr_ok(tctx, error, "getting value"); torture_assert_int_equal(tctx, 4, data.length, "value length ok"); - torture_assert_mem_equal(tctx, data.data, &value, 4, + torture_assert_mem_equal(tctx, data.data, value, 4, "value content ok"); torture_assert_int_equal(tctx, REG_DWORD, type, "value type"); -- cgit From 8582063e9120932e598afbba00d0257e5e9a428f Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 17 Apr 2008 16:38:53 +0200 Subject: More work to avoid endian bugs in registry tests. Andrew Bartlett (This used to be commit 500544f4127d4042ab5ea8e3800156246982c297) --- source4/lib/registry/tests/registry.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/registry/tests/registry.c b/source4/lib/registry/tests/registry.c index ac812823b2..7fad219752 100644 --- a/source4/lib/registry/tests/registry.c +++ b/source4/lib/registry/tests/registry.c @@ -448,8 +448,9 @@ static bool test_del_value(struct torture_context *tctx, void *_data) struct registry_key *subkey = NULL, *root; WERROR error; DATA_BLOB data; - uint32_t value = 42; uint32_t type; + char value[4]; + SIVAL(value, 0, 42); if (!create_test_key(tctx, rctx, "Warschau", &root, &subkey)) return false; @@ -460,7 +461,7 @@ static bool test_del_value(struct torture_context *tctx, void *_data) "getting missing value"); error = reg_val_set(subkey, __FUNCTION__, REG_DWORD, - data_blob_talloc(tctx, &value, 4)); + data_blob_talloc(tctx, value, sizeof(value))); torture_assert_werr_ok (tctx, error, "setting value"); error = reg_del_value(subkey, __FUNCTION__); @@ -483,15 +484,16 @@ static bool test_list_values(struct torture_context *tctx, void *_data) struct registry_key *subkey = NULL, *root; WERROR error; DATA_BLOB data; - uint32_t value = 42; uint32_t type; const char *name; + char value[4]; + SIVAL(value, 0, 42); if (!create_test_key(tctx, rctx, "Bonn", &root, &subkey)) return false; error = reg_val_set(subkey, "bar", REG_DWORD, - data_blob_talloc(tctx, &value, 4)); + data_blob_talloc(tctx, value, sizeof(val))); torture_assert_werr_ok (tctx, error, "setting value"); error = reg_key_get_value_by_index(tctx, subkey, 0, &name, @@ -500,7 +502,7 @@ static bool test_list_values(struct torture_context *tctx, void *_data) torture_assert_str_equal(tctx, name, "bar", "value name"); torture_assert_int_equal(tctx, 4, data.length, "value length"); - torture_assert_mem_equal(tctx, data.data, &value, 4, + torture_assert_mem_equal(tctx, data.data, &value, sizeof(value), "value content"); torture_assert_int_equal(tctx, REG_DWORD, type, "value type"); -- cgit From d0525ff0c2c9ae6d7e39c0fda1d4ab956763b585 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 17 Apr 2008 16:44:55 +0200 Subject: Fix typo (This used to be commit ba6546504505f19abaa5aa35fe3e469ddfd3d619) --- source4/lib/registry/tests/registry.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/registry/tests/registry.c b/source4/lib/registry/tests/registry.c index 7fad219752..85b68ac8a2 100644 --- a/source4/lib/registry/tests/registry.c +++ b/source4/lib/registry/tests/registry.c @@ -493,7 +493,7 @@ static bool test_list_values(struct torture_context *tctx, void *_data) return false; error = reg_val_set(subkey, "bar", REG_DWORD, - data_blob_talloc(tctx, value, sizeof(val))); + data_blob_talloc(tctx, value, sizeof(value))); torture_assert_werr_ok (tctx, error, "setting value"); error = reg_key_get_value_by_index(tctx, subkey, 0, &name, -- cgit From c9a12fa55d63e4bccb5b453186022dae1da39032 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 17 Apr 2008 18:40:56 +0200 Subject: More endian fixes in the registry (This used to be commit b26662be196a84237543eb90d6e08809489df3a9) --- source4/lib/registry/tests/registry.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/registry/tests/registry.c b/source4/lib/registry/tests/registry.c index 85b68ac8a2..661d7c2c69 100644 --- a/source4/lib/registry/tests/registry.c +++ b/source4/lib/registry/tests/registry.c @@ -431,9 +431,9 @@ static bool test_get_value(struct torture_context *tctx, void *_data) &data); torture_assert_werr_ok(tctx, error, "getting value"); - torture_assert_int_equal(tctx, 4, data.length, "value length ok"); - torture_assert_mem_equal(tctx, data.data, value, 4, - "value content ok"); + torture_assert_int_equal(tctx, sizeof(value), data.length, "value length ok"); + torture_assert_mem_equal(tctx, data.data, value, sizeof(value), + "value content ok"); torture_assert_int_equal(tctx, REG_DWORD, type, "value type"); return true; @@ -501,8 +501,8 @@ static bool test_list_values(struct torture_context *tctx, void *_data) torture_assert_werr_ok(tctx, error, "getting value"); torture_assert_str_equal(tctx, name, "bar", "value name"); - torture_assert_int_equal(tctx, 4, data.length, "value length"); - torture_assert_mem_equal(tctx, data.data, &value, sizeof(value), + torture_assert_int_equal(tctx, sizeof(value), data.length, "value length"); + torture_assert_mem_equal(tctx, data.data, value, sizeof(value), "value content"); torture_assert_int_equal(tctx, REG_DWORD, type, "value type"); -- cgit From 4e83011f72ba3df387512755a17760b42a7bf2f2 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 21 Apr 2008 17:58:23 -0400 Subject: Remove more event_context_init() uses from function calls within deep down the code. Make sure we pass around the event_context where we need it instead. All test but a few python ones fail. Jelmer promised to fix them. (This used to be commit 3045d391626fba169aa26be52174883e18d323e9) --- source4/lib/events/events.c | 2 ++ source4/lib/ldb/ldb_ildap/ldb_ildap.c | 16 ++++++++++++++-- source4/lib/ldb_wrap.c | 2 +- source4/lib/messaging/messaging.c | 8 ++++---- source4/lib/socket/testsuite.c | 2 +- 5 files changed, 22 insertions(+), 8 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/events/events.c b/source4/lib/events/events.c index 568aadc31e..252af4443d 100644 --- a/source4/lib/events/events.c +++ b/source4/lib/events/events.c @@ -207,6 +207,8 @@ struct event_context *event_context_init_byname(TALLOC_CTX *mem_ctx, const char */ struct event_context *event_context_init(TALLOC_CTX *mem_ctx) { + DEBUG(0, ("New event context requested. Parent: [%s:%p]\n", + mem_ctx?talloc_get_name(mem_ctx):"NULL", mem_ctx)); return event_context_init_byname(mem_ctx, NULL); } diff --git a/source4/lib/ldb/ldb_ildap/ldb_ildap.c b/source4/lib/ldb/ldb_ildap/ldb_ildap.c index 79958a86eb..6b50b2f5eb 100644 --- a/source4/lib/ldb/ldb_ildap/ldb_ildap.c +++ b/source4/lib/ldb/ldb_ildap/ldb_ildap.c @@ -737,6 +737,7 @@ static int ildb_connect(struct ldb_context *ldb, const char *url, struct ildb_private *ildb; NTSTATUS status; struct cli_credentials *creds; + struct event_context *event_ctx; module = talloc(ldb, struct ldb_module); if (!module) { @@ -756,8 +757,19 @@ static int ildb_connect(struct ldb_context *ldb, const char *url, } module->private_data = ildb; ildb->module = module; - ildb->ldap = ldap4_new_connection(ildb, ldb_get_opaque(ldb, "loadparm"), - ldb_get_opaque(ldb, "EventContext")); + + event_ctx = ldb_get_opaque(ldb, "EventContext"); + + /* FIXME: We must make the event context an explicit parameter, but we + * need to build the events library separately first. Hack a new event + * context so that CMD line utilities work until we have libevents for + * standalone builds ready */ + if (event_ctx == NULL) { + event_ctx = event_context_init(NULL); + } + + ildb->ldap = ldap4_new_connection(ildb, ldb_get_opaque(ldb, "loadparm"), + event_ctx); if (!ildb->ldap) { ldb_oom(ldb); goto failed; diff --git a/source4/lib/ldb_wrap.c b/source4/lib/ldb_wrap.c index b71adcbca2..b564976524 100644 --- a/source4/lib/ldb_wrap.c +++ b/source4/lib/ldb_wrap.c @@ -116,7 +116,7 @@ struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx, talloc_asprintf(ldb, "%s/ldb", lp_modulesdir(lp_ctx))); if (ev == NULL) { - ev = event_context_find(mem_ctx); + return NULL; } if (ldb_set_opaque(ldb, "EventContext", ev)) { diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c index 29d6e00247..19284461ee 100644 --- a/source4/lib/messaging/messaging.c +++ b/source4/lib/messaging/messaging.c @@ -544,6 +544,10 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx, NTSTATUS status; struct socket_address *path; + if (ev == NULL) { + return NULL; + } + msg = talloc_zero(mem_ctx, struct messaging_context); if (msg == NULL) { return NULL; @@ -556,10 +560,6 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx, return NULL; } - if (ev == NULL) { - ev = event_context_init(msg); - } - /* create the messaging directory if needed */ mkdir(dir, 0700); diff --git a/source4/lib/socket/testsuite.c b/source4/lib/socket/testsuite.c index 813412c7bc..2c25d8f491 100644 --- a/source4/lib/socket/testsuite.c +++ b/source4/lib/socket/testsuite.c @@ -124,7 +124,7 @@ static bool test_tcp(struct torture_context *tctx) DATA_BLOB blob, blob2; size_t sent, nread; TALLOC_CTX *mem_ctx = tctx; - struct event_context *ev = event_context_init(mem_ctx); + struct event_context *ev = tctx->ev; struct interface *ifaces; status = socket_create("ip", SOCKET_TYPE_STREAM, &sock1, 0); -- cgit From 89cac520d047581fc11c7d4a20e0508a2005c154 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Tue, 22 Apr 2008 16:37:27 -0400 Subject: Remove temporary debug statement (This used to be commit 10780e638af8afc3ffa261255200779aea732694) --- source4/lib/events/events.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/events/events.c b/source4/lib/events/events.c index 252af4443d..568aadc31e 100644 --- a/source4/lib/events/events.c +++ b/source4/lib/events/events.c @@ -207,8 +207,6 @@ struct event_context *event_context_init_byname(TALLOC_CTX *mem_ctx, const char */ struct event_context *event_context_init(TALLOC_CTX *mem_ctx) { - DEBUG(0, ("New event context requested. Parent: [%s:%p]\n", - mem_ctx?talloc_get_name(mem_ctx):"NULL", mem_ctx)); return event_context_init_byname(mem_ctx, NULL); } -- cgit From 1e973565b6c0cb738b25a2d9439d5acb441701f4 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 27 Apr 2008 14:02:46 +0100 Subject: Move subunit infrastructure code into lib/torture. (This used to be commit 5b44d8121de7735d69e6238a1442aff034a8ebd3) --- source4/lib/basic.mk | 1 + source4/lib/crypto/sha1test.c | 2 +- source4/lib/torture/config.mk | 11 + source4/lib/torture/torture.c | 579 ++++++++++++++++++++++++++++++++++++++++++ source4/lib/torture/torture.h | 396 +++++++++++++++++++++++++++++ source4/lib/util/tests/str.c | 2 +- 6 files changed, 989 insertions(+), 2 deletions(-) create mode 100644 source4/lib/torture/config.mk create mode 100644 source4/lib/torture/torture.c create mode 100644 source4/lib/torture/torture.h (limited to 'source4/lib') diff --git a/source4/lib/basic.mk b/source4/lib/basic.mk index 71acb94492..e7e0ba80c4 100644 --- a/source4/lib/basic.mk +++ b/source4/lib/basic.mk @@ -16,6 +16,7 @@ mkinclude util/config.mk mkinclude tdr/config.mk mkinclude dbwrap/config.mk mkinclude crypto/config.mk +mkinclude torture/config.mk [SUBSYSTEM::LIBCOMPRESSION] diff --git a/source4/lib/crypto/sha1test.c b/source4/lib/crypto/sha1test.c index 0e943bd74d..7777764277 100644 --- a/source4/lib/crypto/sha1test.c +++ b/source4/lib/crypto/sha1test.c @@ -17,7 +17,7 @@ */ #include "includes.h" -#include "torture/ui.h" +#include "torture/torture.h" #include "lib/crypto/crypto.h" diff --git a/source4/lib/torture/config.mk b/source4/lib/torture/config.mk new file mode 100644 index 0000000000..e981ee0c99 --- /dev/null +++ b/source4/lib/torture/config.mk @@ -0,0 +1,11 @@ +# TORTURE subsystem +[LIBRARY::torture] +PUBLIC_DEPENDENCIES = \ + LIBSAMBA-HOSTCONFIG \ + LIBSAMBA-UTIL \ + LIBTALLOC + +PC_FILES += lib/torture/torture.pc +torture_OBJ_FILES = $(addprefix lib/torture/, torture.o) + +PUBLIC_HEADERS += lib/torture/torture.h diff --git a/source4/lib/torture/torture.c b/source4/lib/torture/torture.c new file mode 100644 index 0000000000..3f2c7848aa --- /dev/null +++ b/source4/lib/torture/torture.c @@ -0,0 +1,579 @@ +/* + Unix SMB/CIFS implementation. + SMB torture UI functions + + Copyright (C) Jelmer Vernooij 2006 + + 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 . +*/ + +#include "includes.h" +#include "torture/torture.h" +#include "lib/util/dlinklist.h" +#include "param/param.h" +#include "system/filesys.h" +#include "auth/credentials/credentials.h" +#include "lib/cmdline/popt_common.h" + +struct torture_context *torture_context_init(struct event_context *event_ctx, + const struct torture_ui_ops *ui_ops) +{ + struct torture_context *torture = talloc_zero(event_ctx, + struct torture_context); + torture->ui_ops = ui_ops; + torture->returncode = true; + torture->ev = event_ctx; + + if (ui_ops->init) + ui_ops->init(torture); + + return torture; +} + +/** + create a temporary directory. +*/ +_PUBLIC_ NTSTATUS torture_temp_dir(struct torture_context *tctx, + const char *prefix, + char **tempdir) +{ + SMB_ASSERT(tctx->outputdir != NULL); + + *tempdir = talloc_asprintf(tctx, "%s/%s.XXXXXX", tctx->outputdir, + prefix); + NT_STATUS_HAVE_NO_MEMORY(*tempdir); + + if (mkdtemp(*tempdir) == NULL) { + return map_nt_error_from_unix(errno); + } + + return NT_STATUS_OK; +} + +void torture_comment(struct torture_context *context, const char *comment, ...) +{ + va_list ap; + char *tmp; + + if (!context->ui_ops->comment) + return; + + va_start(ap, comment); + tmp = talloc_vasprintf(context, comment, ap); + + context->ui_ops->comment(context, tmp); + + talloc_free(tmp); +} + +void torture_warning(struct torture_context *context, const char *comment, ...) +{ + va_list ap; + char *tmp; + + if (!context->ui_ops->warning) + return; + + va_start(ap, comment); + tmp = talloc_vasprintf(context, comment, ap); + + context->ui_ops->warning(context, tmp); + + talloc_free(tmp); +} + +void torture_result(struct torture_context *context, + enum torture_result result, const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + + if (context->last_reason) { + torture_warning(context, "%s", context->last_reason); + talloc_free(context->last_reason); + } + + context->last_result = result; + context->last_reason = talloc_vasprintf(context, fmt, ap); + va_end(ap); +} + +struct torture_suite *torture_suite_create(TALLOC_CTX *ctx, const char *name) +{ + struct torture_suite *suite = talloc_zero(ctx, struct torture_suite); + + suite->name = talloc_strdup(suite, name); + suite->testcases = NULL; + suite->children = NULL; + + return suite; +} + +void torture_tcase_set_fixture(struct torture_tcase *tcase, + bool (*setup) (struct torture_context *, void **), + bool (*teardown) (struct torture_context *, void *)) +{ + tcase->setup = setup; + tcase->teardown = teardown; +} + +static bool wrap_test_with_testcase_const(struct torture_context *torture_ctx, + struct torture_tcase *tcase, + struct torture_test *test) +{ + bool (*fn) (struct torture_context *, + const void *tcase_data, + const void *test_data); + + fn = test->fn; + + return fn(torture_ctx, tcase->data, test->data); +} + +struct torture_test *torture_tcase_add_test_const(struct torture_tcase *tcase, + const char *name, + bool (*run) (struct torture_context *, const void *tcase_data, + const void *test_data), + const void *data) +{ + struct torture_test *test = talloc(tcase, struct torture_test); + + test->name = talloc_strdup(test, name); + test->description = NULL; + test->run = wrap_test_with_testcase_const; + test->fn = run; + test->dangerous = false; + test->data = data; + + DLIST_ADD_END(tcase->tests, test, struct torture_test *); + + return test; +} + + +bool torture_suite_init_tcase(struct torture_suite *suite, + struct torture_tcase *tcase, + const char *name) +{ + tcase->name = talloc_strdup(tcase, name); + tcase->description = NULL; + tcase->setup = NULL; + tcase->teardown = NULL; + tcase->fixture_persistent = true; + tcase->tests = NULL; + + DLIST_ADD_END(suite->testcases, tcase, struct torture_tcase *); + + return true; +} + + +struct torture_tcase *torture_suite_add_tcase(struct torture_suite *suite, + const char *name) +{ + struct torture_tcase *tcase = talloc(suite, struct torture_tcase); + + if (!torture_suite_init_tcase(suite, tcase, name)) + return NULL; + + return tcase; +} + +bool torture_run_suite(struct torture_context *context, + struct torture_suite *suite) +{ + bool ret = true; + struct torture_tcase *tcase; + struct torture_suite *tsuite; + char *old_testname; + + context->level++; + if (context->ui_ops->suite_start) + context->ui_ops->suite_start(context, suite); + + old_testname = context->active_testname; + if (old_testname != NULL) + context->active_testname = talloc_asprintf(context, "%s-%s", + old_testname, suite->name); + else + context->active_testname = talloc_strdup(context, suite->name); + + for (tcase = suite->testcases; tcase; tcase = tcase->next) { + ret &= torture_run_tcase(context, tcase); + } + + for (tsuite = suite->children; tsuite; tsuite = tsuite->next) { + ret &= torture_run_suite(context, tsuite); + } + + talloc_free(context->active_testname); + context->active_testname = old_testname; + + if (context->ui_ops->suite_finish) + context->ui_ops->suite_finish(context, suite); + + context->level--; + + return ret; +} + +void torture_ui_test_start(struct torture_context *context, + struct torture_tcase *tcase, + struct torture_test *test) +{ + if (context->ui_ops->test_start) + context->ui_ops->test_start(context, tcase, test); +} + +int str_list_match(const char *name, char **list) +{ + int i, ret = 0; + if (list == NULL) + return 0; + + for (i = 0; list[i]; i++) { + if (gen_fnmatch(list[i], name) == 0) + ret++; + } + return ret; +} + +void torture_ui_test_result(struct torture_context *context, + enum torture_result result, + const char *comment) +{ + if (context->ui_ops->test_result) + context->ui_ops->test_result(context, result, comment); + + if (result == TORTURE_ERROR || result == TORTURE_FAIL) + context->returncode = false; +} + +static bool internal_torture_run_test(struct torture_context *context, + struct torture_tcase *tcase, + struct torture_test *test, + bool already_setup) +{ + bool success; + char *old_testname; + + if (tcase == NULL || strcmp(test->name, tcase->name) != 0) { + old_testname = context->active_testname; + context->active_testname = talloc_asprintf(context, "%s-%s", old_testname, test->name); + } + + context->active_tcase = tcase; + context->active_test = test; + + torture_ui_test_start(context, tcase, test); + + context->last_reason = NULL; + context->last_result = TORTURE_OK; + + if (!already_setup && tcase->setup && + !tcase->setup(context, &(tcase->data))) { + if (context->last_reason == NULL) + context->last_reason = talloc_strdup(context, "Setup failure"); + context->last_result = TORTURE_ERROR; + success = false; + } else if (test->dangerous && + !torture_setting_bool(context, "dangerous", false)) { + context->last_result = TORTURE_SKIP; + context->last_reason = talloc_asprintf(context, + "disabled %s - enable dangerous tests to use", test->name); + success = true; + } else { + success = test->run(context, tcase, test); + + if (!success && context->last_result == TORTURE_OK) { + if (context->last_reason == NULL) + context->last_reason = talloc_strdup(context, "Unknown error/failure"); + context->last_result = TORTURE_ERROR; + } + } + + if (!already_setup && tcase->teardown && !tcase->teardown(context, tcase->data)) { + if (context->last_reason == NULL) + context->last_reason = talloc_strdup(context, "Setup failure"); + context->last_result = TORTURE_ERROR; + success = false; + } + + torture_ui_test_result(context, context->last_result, + context->last_reason); + + talloc_free(context->last_reason); + + if (tcase == NULL || strcmp(test->name, tcase->name) != 0) { + talloc_free(context->active_testname); + context->active_testname = old_testname; + } + context->active_test = NULL; + context->active_tcase = NULL; + + return success; +} + +bool torture_run_tcase(struct torture_context *context, + struct torture_tcase *tcase) +{ + bool ret = true; + char *old_testname; + struct torture_test *test; + + context->level++; + + context->active_tcase = tcase; + if (context->ui_ops->tcase_start) + context->ui_ops->tcase_start(context, tcase); + + if (tcase->fixture_persistent && tcase->setup + && !tcase->setup(context, &tcase->data)) { + /* FIXME: Use torture ui ops for reporting this error */ + fprintf(stderr, "Setup failed: "); + if (context->last_reason != NULL) + fprintf(stderr, "%s", context->last_reason); + fprintf(stderr, "\n"); + ret = false; + goto done; + } + + old_testname = context->active_testname; + context->active_testname = talloc_asprintf(context, "%s-%s", + old_testname, tcase->name); + for (test = tcase->tests; test; test = test->next) { + ret &= internal_torture_run_test(context, tcase, test, + tcase->fixture_persistent); + } + talloc_free(context->active_testname); + context->active_testname = old_testname; + + if (tcase->fixture_persistent && tcase->teardown && + !tcase->teardown(context, tcase->data)) + ret = false; + +done: + context->active_tcase = NULL; + + if (context->ui_ops->tcase_finish) + context->ui_ops->tcase_finish(context, tcase); + + context->level--; + + return ret; +} + +bool torture_run_test(struct torture_context *context, + struct torture_tcase *tcase, + struct torture_test *test) +{ + return internal_torture_run_test(context, tcase, test, false); +} + +int torture_setting_int(struct torture_context *test, const char *name, + int default_value) +{ + return lp_parm_int(test->lp_ctx, NULL, "torture", name, default_value); +} + +double torture_setting_double(struct torture_context *test, const char *name, + double default_value) +{ + return lp_parm_double(test->lp_ctx, NULL, "torture", name, default_value); +} + +bool torture_setting_bool(struct torture_context *test, const char *name, + bool default_value) +{ + return lp_parm_bool(test->lp_ctx, NULL, "torture", name, default_value); +} + +const char *torture_setting_string(struct torture_context *test, + const char *name, + const char *default_value) +{ + const char *ret; + + SMB_ASSERT(test != NULL); + SMB_ASSERT(test->lp_ctx != NULL); + + ret = lp_parm_string(test->lp_ctx, NULL, "torture", name); + + if (ret == NULL) + return default_value; + + return ret; +} + +static bool wrap_test_with_simple_tcase_const ( + struct torture_context *torture_ctx, + struct torture_tcase *tcase, + struct torture_test *test) +{ + bool (*fn) (struct torture_context *, const void *tcase_data); + + fn = test->fn; + + return fn(torture_ctx, test->data); +} + +struct torture_tcase *torture_suite_add_simple_tcase_const( + struct torture_suite *suite, const char *name, + bool (*run) (struct torture_context *test, const void *), + const void *data) +{ + struct torture_tcase *tcase; + struct torture_test *test; + + tcase = torture_suite_add_tcase(suite, name); + + test = talloc(tcase, struct torture_test); + + test->name = talloc_strdup(test, name); + test->description = NULL; + test->run = wrap_test_with_simple_tcase_const; + test->fn = run; + test->data = data; + test->dangerous = false; + + DLIST_ADD_END(tcase->tests, test, struct torture_test *); + + return tcase; +} + +static bool wrap_simple_test(struct torture_context *torture_ctx, + struct torture_tcase *tcase, + struct torture_test *test) +{ + bool (*fn) (struct torture_context *); + + fn = test->fn; + + return fn(torture_ctx); +} + +struct torture_tcase *torture_suite_add_simple_test( + struct torture_suite *suite, + const char *name, + bool (*run) (struct torture_context *test)) +{ + struct torture_test *test; + struct torture_tcase *tcase; + + tcase = torture_suite_add_tcase(suite, name); + + test = talloc(tcase, struct torture_test); + + test->name = talloc_strdup(test, name); + test->description = NULL; + test->run = wrap_simple_test; + test->fn = run; + test->dangerous = false; + + DLIST_ADD_END(tcase->tests, test, struct torture_test *); + + return tcase; +} + +bool torture_suite_add_suite(struct torture_suite *suite, + struct torture_suite *child) +{ + if (child == NULL) + return false; + + DLIST_ADD_END(suite->children, child, struct torture_suite *); + + /* FIXME: Check for duplicates and return false if the + * added suite already exists as a child */ + + return true; +} + + +struct torture_suite *torture_find_suite(struct torture_suite *parent, + const char *name) +{ + struct torture_suite *child; + + for (child = parent->children; child; child = child->next) + if (!strcmp(child->name, name)) + return child; + + return NULL; +} + +static bool wrap_test_with_simple_test_const(struct torture_context *torture_ctx, + struct torture_tcase *tcase, + struct torture_test *test) +{ + bool (*fn) (struct torture_context *, const void *tcase_data); + + fn = test->fn; + + return fn(torture_ctx, tcase->data); +} + +struct torture_test *torture_tcase_add_simple_test_const( + struct torture_tcase *tcase, + const char *name, + bool (*run) (struct torture_context *test, + const void *tcase_data)) +{ + struct torture_test *test; + + test = talloc(tcase, struct torture_test); + + test->name = talloc_strdup(test, name); + test->description = NULL; + test->run = wrap_test_with_simple_test_const; + test->fn = run; + test->data = NULL; + test->dangerous = false; + + DLIST_ADD_END(tcase->tests, test, struct torture_test *); + + return test; +} + +static bool wrap_test_with_simple_test(struct torture_context *torture_ctx, + struct torture_tcase *tcase, + struct torture_test *test) +{ + bool (*fn) (struct torture_context *, void *tcase_data); + + fn = test->fn; + + return fn(torture_ctx, tcase->data); +} + +struct torture_test *torture_tcase_add_simple_test(struct torture_tcase *tcase, + const char *name, + bool (*run) (struct torture_context *test, void *tcase_data)) +{ + struct torture_test *test; + + test = talloc(tcase, struct torture_test); + + test->name = talloc_strdup(test, name); + test->description = NULL; + test->run = wrap_test_with_simple_test; + test->fn = run; + test->data = NULL; + test->dangerous = false; + + DLIST_ADD_END(tcase->tests, test, struct torture_test *); + + return test; +} diff --git a/source4/lib/torture/torture.h b/source4/lib/torture/torture.h new file mode 100644 index 0000000000..15b04c2397 --- /dev/null +++ b/source4/lib/torture/torture.h @@ -0,0 +1,396 @@ +/* + Unix SMB/CIFS implementation. + SMB torture UI functions + + Copyright (C) Jelmer Vernooij 2006 + + 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 . +*/ + +#ifndef __TORTURE_UI_H__ +#define __TORTURE_UI_H__ + +struct torture_test; +struct torture_context; +struct torture_suite; +struct torture_tcase; + +enum torture_result { + TORTURE_OK=0, + TORTURE_FAIL=1, + TORTURE_ERROR=2, + TORTURE_SKIP=3 +}; + +/* + * These callbacks should be implemented by any backend that wishes + * to listen to reports from the torture tests. + */ +struct torture_ui_ops +{ + void (*init) (struct torture_context *); + void (*comment) (struct torture_context *, const char *); + void (*warning) (struct torture_context *, const char *); + void (*suite_start) (struct torture_context *, struct torture_suite *); + void (*suite_finish) (struct torture_context *, struct torture_suite *); + void (*tcase_start) (struct torture_context *, struct torture_tcase *); + void (*tcase_finish) (struct torture_context *, struct torture_tcase *); + void (*test_start) (struct torture_context *, + struct torture_tcase *, + struct torture_test *); + void (*test_result) (struct torture_context *, + enum torture_result, const char *reason); +}; + +void torture_ui_test_start(struct torture_context *context, + struct torture_tcase *tcase, + struct torture_test *test); + +void torture_ui_test_result(struct torture_context *context, + enum torture_result result, + const char *comment); + +/* + * Holds information about a specific run of the testsuite. + * The data in this structure should be considered private to + * the torture tests and should only be used directly by the torture + * code and the ui backends. + * + * Torture tests should instead call the torture_*() macros and functions + * specified below. + */ + +struct torture_context +{ + const struct torture_ui_ops *ui_ops; + void *ui_data; + + char *active_testname; + struct torture_test *active_test; + struct torture_tcase *active_tcase; + + bool quiet; /* Whether tests should avoid writing output to stdout */ + + enum torture_result last_result; + char *last_reason; + + bool returncode; + + const char *outputdir; + int level; + struct event_context *ev; + + struct loadparm_context *lp_ctx; +}; + +/* + * Describes a particular torture test + */ +struct torture_test { + const char *name; + const char *description; + bool dangerous; + /* Function to call to run this test */ + bool (*run) (struct torture_context *torture_ctx, + struct torture_tcase *tcase, + struct torture_test *test); + + struct torture_test *prev, *next; + + /* Pointer to the actual test function. This is run by the + * run() function above. */ + void *fn; + const void *data; +}; + +/* + * Describes a particular test case. + */ +struct torture_tcase { + const char *name; + const char *description; + bool (*setup) (struct torture_context *tcase, void **data); + bool (*teardown) (struct torture_context *tcase, void *data); + bool fixture_persistent; + void *data; + struct torture_test *tests; + struct torture_tcase *prev, *next; +}; + +struct torture_suite +{ + const char *name; + const char *description; + struct torture_tcase *testcases; + struct torture_suite *children; + + /* Pointers to siblings of this torture suite */ + struct torture_suite *prev, *next; +}; + +/** Create a new torture suite */ +struct torture_suite *torture_suite_create(TALLOC_CTX *mem_ctx, + const char *name); + +/** Change the setup and teardown functions for a testcase */ +void torture_tcase_set_fixture(struct torture_tcase *tcase, + bool (*setup) (struct torture_context *, void **), + bool (*teardown) (struct torture_context *, void *)); + +/* Add another test to run for a particular testcase */ +struct torture_test *torture_tcase_add_test_const(struct torture_tcase *tcase, + const char *name, + bool (*run) (struct torture_context *test, + const void *tcase_data, const void *test_data), + const void *test_data); + +/* Add a testcase to a testsuite */ +struct torture_tcase *torture_suite_add_tcase(struct torture_suite *suite, + const char *name); + +/* Convenience wrapper that adds a testcase against only one + * test will be run */ +struct torture_tcase *torture_suite_add_simple_tcase_const( + struct torture_suite *suite, + const char *name, + bool (*run) (struct torture_context *test, + const void *test_data), + const void *data); + +/* Convenience function that adds a test which only + * gets the test case data */ +struct torture_test *torture_tcase_add_simple_test_const( + struct torture_tcase *tcase, + const char *name, + bool (*run) (struct torture_context *test, + const void *tcase_data)); + +/* Convenience wrapper that adds a test that doesn't need any + * testcase data */ +struct torture_tcase *torture_suite_add_simple_test( + struct torture_suite *suite, + const char *name, + bool (*run) (struct torture_context *test)); + +/* Add a child testsuite to an existing testsuite */ +bool torture_suite_add_suite(struct torture_suite *suite, + struct torture_suite *child); + +/* Run the specified testsuite recursively */ +bool torture_run_suite(struct torture_context *context, + struct torture_suite *suite); + +/* Run the specified testcase */ +bool torture_run_tcase(struct torture_context *context, + struct torture_tcase *tcase); + +/* Run the specified test */ +bool torture_run_test(struct torture_context *context, + struct torture_tcase *tcase, + struct torture_test *test); + +void torture_comment(struct torture_context *test, const char *comment, ...) PRINTF_ATTRIBUTE(2,3); +void torture_warning(struct torture_context *test, const char *comment, ...) PRINTF_ATTRIBUTE(2,3); +void torture_result(struct torture_context *test, + enum torture_result, const char *reason, ...) PRINTF_ATTRIBUTE(3,4); + +#define torture_assert(torture_ctx,expr,cmt) \ + if (!(expr)) { \ + torture_result(torture_ctx, TORTURE_FAIL, __location__": Expression `%s' failed: %s", __STRING(expr), cmt); \ + return false; \ + } + +#define torture_assert_werr_equal(torture_ctx, got, expected, cmt) \ + do { WERROR __got = got, __expected = expected; \ + if (!W_ERROR_EQUAL(__got, __expected)) { \ + torture_result(torture_ctx, TORTURE_FAIL, __location__": "#got" was %s, expected %s: %s", win_errstr(__got), win_errstr(__expected), cmt); \ + return false; \ + } \ + } while (0) + +#define torture_assert_ntstatus_equal(torture_ctx,got,expected,cmt) \ + do { NTSTATUS __got = got, __expected = expected; \ + if (!NT_STATUS_EQUAL(__got, __expected)) { \ + torture_result(torture_ctx, TORTURE_FAIL, __location__": "#got" was %s, expected %s: %s", nt_errstr(__got), nt_errstr(__expected), cmt); \ + return false; \ + }\ + } while(0) + +#define torture_assert_ndr_err_equal(torture_ctx,got,expected,cmt) \ + do { enum ndr_err_code __got = got, __expected = expected; \ + if (__got != __expected) { \ + torture_result(torture_ctx, TORTURE_FAIL, __location__": "#got" was %d, expected %d (%s): %s", __got, __expected, __STRING(expected), cmt); \ + return false; \ + }\ + } while(0) + +#define torture_assert_casestr_equal(torture_ctx,got,expected,cmt) \ + do { const char *__got = (got), *__expected = (expected); \ + if (!strequal(__got, __expected)) { \ + torture_result(torture_ctx, TORTURE_FAIL, __location__": "#got" was %s, expected %s: %s", __got, __expected, cmt); \ + return false; \ + } \ + } while(0) + +#define torture_assert_str_equal(torture_ctx,got,expected,cmt)\ + do { const char *__got = (got), *__expected = (expected); \ + if (strcmp_safe(__got, __expected) != 0) { \ + torture_result(torture_ctx, TORTURE_FAIL, \ + __location__": "#got" was %s, expected %s: %s", \ + __got, __expected, cmt); \ + return false; \ + } \ + } while(0) + +#define torture_assert_mem_equal(torture_ctx,got,expected,len,cmt)\ + do { const void *__got = (got), *__expected = (expected); \ + if (memcmp(__got, __expected, len) != 0) { \ + torture_result(torture_ctx, TORTURE_FAIL, \ + __location__": "#got" of len %d did not match"#expected": %s", len, cmt); \ + return false; \ + } \ + } while(0) + +#define torture_assert_file_contains_text(torture_ctx,filename,expected,cmt)\ + do { \ + char *__got; \ + const char *__expected = (expected); \ + size_t __size; \ + __got = file_load(filename, &__size, torture_ctx); \ + if (__got == NULL) { \ + torture_result(torture_ctx, TORTURE_FAIL, \ + __location__": unable to open %s: %s\n", \ + filename, cmt); \ + return false; \ + } \ + \ + if (strcmp_safe(__got, __expected) != 0) { \ + torture_result(torture_ctx, TORTURE_FAIL, \ + __location__": %s contained:\n%sExpected: %s%s\n", \ + filename, __got, __expected, cmt); \ + talloc_free(__got); \ + return false; \ + } \ + talloc_free(__got); \ + } while(0) + +#define torture_assert_file_contains(torture_ctx,filename,expected,cmt)\ + do { const char *__got, *__expected = (expected); \ + size_t __size; \ + __got = file_load(filename, *size, torture_ctx); \ + if (strcmp_safe(__got, __expected) != 0) { \ + torture_result(torture_ctx, TORTURE_FAIL, \ + __location__": %s contained:\n%sExpected: %s%s\n", \ + __got, __expected, cmt); \ + talloc_free(__got); \ + return false; \ + } \ + talloc_free(__got); \ + } while(0) + +#define torture_assert_int_equal(torture_ctx,got,expected,cmt)\ + do { int __got = (got), __expected = (expected); \ + if (__got != __expected) { \ + torture_result(torture_ctx, TORTURE_FAIL, \ + __location__": "#got" was %d, expected %d: %s", \ + __got, __expected, cmt); \ + return false; \ + } \ + } while(0) + +#define torture_assert_u64_equal(torture_ctx,got,expected,cmt)\ + do { uint64_t __got = (got), __expected = (expected); \ + if (__got != __expected) { \ + torture_result(torture_ctx, TORTURE_FAIL, \ + __location__": "#got" was %llu, expected %llu: %s", \ + (unsigned long long)__got, (unsigned long long)__expected, cmt); \ + return false; \ + } \ + } while(0) + +#define torture_assert_errno_equal(torture_ctx,expected,cmt)\ + do { int __expected = (expected); \ + if (errno != __expected) { \ + torture_result(torture_ctx, TORTURE_FAIL, \ + __location__": errno was %d (%s), expected %d: %s: %s", \ + errno, strerror(errno), __expected, \ + strerror(__expected), cmt); \ + return false; \ + } \ + } while(0) + + + +#define torture_skip(torture_ctx,cmt) do {\ + torture_result(torture_ctx, TORTURE_SKIP, __location__": %s", cmt);\ + return true; \ + } while(0) +#define torture_fail(torture_ctx,cmt) do {\ + torture_result(torture_ctx, TORTURE_FAIL, __location__": %s", cmt);\ + return false; \ + } while (0) +#define torture_fail_goto(torture_ctx,label,cmt) do {\ + torture_result(torture_ctx, TORTURE_FAIL, __location__": %s", cmt);\ + goto label; \ + } while (0) + +#define torture_out stderr + +/* Convenience macros */ +#define torture_assert_ntstatus_ok(torture_ctx,expr,cmt) \ + torture_assert_ntstatus_equal(torture_ctx,expr,NT_STATUS_OK,cmt) + +#define torture_assert_werr_ok(torture_ctx,expr,cmt) \ + torture_assert_werr_equal(torture_ctx,expr,WERR_OK,cmt) + +#define torture_assert_ndr_success(torture_ctx,expr,cmt) \ + torture_assert_ndr_err_equal(torture_ctx,expr,NDR_ERR_SUCCESS,cmt) + +/* Getting settings */ +const char *torture_setting_string(struct torture_context *test, \ + const char *name, + const char *default_value); + +int torture_setting_int(struct torture_context *test, + const char *name, + int default_value); + +double torture_setting_double(struct torture_context *test, + const char *name, + double default_value); + +bool torture_setting_bool(struct torture_context *test, + const char *name, + bool default_value); + +struct torture_suite *torture_find_suite(struct torture_suite *parent, + const char *name); + +NTSTATUS torture_temp_dir(struct torture_context *tctx, + const char *prefix, + char **tempdir); + +struct torture_test *torture_tcase_add_simple_test(struct torture_tcase *tcase, + const char *name, + bool (*run) (struct torture_context *test, void *tcase_data)); + + +bool torture_suite_init_tcase(struct torture_suite *suite, + struct torture_tcase *tcase, + const char *name); + +struct torture_context *torture_context_init(struct event_context *event_ctx, + const struct torture_ui_ops *ui_ops); + +#endif /* __TORTURE_UI_H__ */ diff --git a/source4/lib/util/tests/str.c b/source4/lib/util/tests/str.c index a219ef0891..3bd6a02fdc 100644 --- a/source4/lib/util/tests/str.c +++ b/source4/lib/util/tests/str.c @@ -20,7 +20,7 @@ */ #include "includes.h" -#include "torture/ui.h" +#include "torture/torture.h" static bool test_string_sub_simple(struct torture_context *tctx) { -- cgit From 410115bb6b8e9674c9779fc9bc5d1cb7022bebcf Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 6 May 2008 11:02:40 +1000 Subject: Cope with an empty mapping file in ad2oLschema (This used to be commit 5f36a605a9accfba1125bbae0e79bb14b936173c) --- source4/lib/ldb/tools/ad2oLschema.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/tools/ad2oLschema.c b/source4/lib/ldb/tools/ad2oLschema.c index 67b16dd06e..0a89656fa2 100644 --- a/source4/lib/ldb/tools/ad2oLschema.c +++ b/source4/lib/ldb/tools/ad2oLschema.c @@ -429,7 +429,7 @@ static struct schema_conv process_convert(struct ldb_context *ldb, enum convert_ /* We might have been asked to remap this oid, * due to a conflict, or lack of * implementation */ - for (j=0; syntax_oid && oid_map[j].old_oid; j++) { + for (j=0; syntax_oid && oid_map && oid_map[j].old_oid; j++) { if (strcasecmp(syntax_oid, oid_map[j].old_oid) == 0) { syntax_oid = oid_map[j].new_oid; break; @@ -494,7 +494,7 @@ static struct schema_conv process_convert(struct ldb_context *ldb, enum convert_ } /* We might have been asked to remap this oid, due to a conflict */ - for (j=0; oid_map[j].old_oid; j++) { + for (j=0; oid_map && oid_map[j].old_oid; j++) { if (strcasecmp(oid, oid_map[j].old_oid) == 0) { oid = oid_map[j].new_oid; break; -- cgit From f51a79889c769f0a30eef5bd8a486e08c6bbdad2 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 6 May 2008 12:38:55 +0200 Subject: libreplace: check how portable utimes() and futimes() are metze (This used to be commit 8798ce3c744025b94973784dcb44d099427ef190) --- source4/lib/replace/system/config.m4 | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/lib') diff --git a/source4/lib/replace/system/config.m4 b/source4/lib/replace/system/config.m4 index 66c2bd652a..ae26bb5590 100644 --- a/source4/lib/replace/system/config.m4 +++ b/source4/lib/replace/system/config.m4 @@ -9,6 +9,7 @@ AC_CHECK_HEADERS(sys/select.h) # time AC_CHECK_HEADERS(sys/time.h utime.h) AC_HEADER_TIME +AC_CHECK_FUNCS(utime utimes futimes) # wait AC_HEADER_SYS_WAIT -- cgit From bbf4ce91462598cee1eebfb94a773194e56a7ff8 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 7 May 2008 13:10:31 +0200 Subject: libreplace: always provide utime() and utimes() I'd like to also provide futimes(), but it seems that some systems doesn't support a it at kernel level. If someone knows how to write a portable replacement for futimes() please tell me... metze (This used to be commit a9604fe4a323dccb537cf02ea7594437b4995803) --- source4/lib/replace/README | 2 + source4/lib/replace/replace.c | 27 +++++++ source4/lib/replace/replace.h | 10 +++ source4/lib/replace/system/config.m4 | 2 +- source4/lib/replace/system/time.h | 15 ++++ source4/lib/replace/test/testsuite.c | 145 +++++++++++++++++++++++++++++++++++ 6 files changed, 200 insertions(+), 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/replace/README b/source4/lib/replace/README index 43f7b08572..4d94317c4b 100644 --- a/source4/lib/replace/README +++ b/source4/lib/replace/README @@ -62,6 +62,8 @@ getnameinfo gai_strerror getifaddrs freeifaddrs +utime +utimes Types: bool diff --git a/source4/lib/replace/replace.c b/source4/lib/replace/replace.c index 443da2ab24..2c3f14c2df 100644 --- a/source4/lib/replace/replace.c +++ b/source4/lib/replace/replace.c @@ -584,3 +584,30 @@ int rep_unsetenv(const char *name) return 0; } #endif + +#ifndef HAVE_UTIME +int rep_utime(const char *filename, const struct utimbuf *buf) +{ + errno = ENOSYS; + return -1; +} +#endif + +#ifndef HAVE_UTIMES +int rep_utimes(const char *filename, const struct timeval tv[2]) +{ + struct utimbuf u; + + u.actime = tv[0].tv_sec; + if (tv[0].tv_usec > 500000) { + u.actime += 1; + } + + u.modtime = tv[1].tv_sec; + if (tv[1].tv_usec > 500000) { + u.modtime += 1; + } + + return utime(filename, &u); +} +#endif diff --git a/source4/lib/replace/replace.h b/source4/lib/replace/replace.h index bf95169352..c69ea6cdac 100644 --- a/source4/lib/replace/replace.h +++ b/source4/lib/replace/replace.h @@ -101,6 +101,16 @@ void *rep_memmove(void *dest,const void *src,int size); /* prototype is in "system/time.h" */ #endif +#ifndef HAVE_UTIME +#define utime rep_utime +/* prototype is in "system/time.h" */ +#endif + +#ifndef HAVE_UTIMES +#define utimes rep_utimes +/* prototype is in "system/time.h" */ +#endif + #ifndef HAVE_STRLCPY #define strlcpy rep_strlcpy size_t rep_strlcpy(char *d, const char *s, size_t bufsize); diff --git a/source4/lib/replace/system/config.m4 b/source4/lib/replace/system/config.m4 index ae26bb5590..5c9b53d5c5 100644 --- a/source4/lib/replace/system/config.m4 +++ b/source4/lib/replace/system/config.m4 @@ -9,7 +9,7 @@ AC_CHECK_HEADERS(sys/select.h) # time AC_CHECK_HEADERS(sys/time.h utime.h) AC_HEADER_TIME -AC_CHECK_FUNCS(utime utimes futimes) +AC_CHECK_FUNCS(utime utimes) # wait AC_HEADER_SYS_WAIT diff --git a/source4/lib/replace/system/time.h b/source4/lib/replace/system/time.h index 036812ab8f..4abf295d1a 100644 --- a/source4/lib/replace/system/time.h +++ b/source4/lib/replace/system/time.h @@ -39,6 +39,11 @@ #ifdef HAVE_UTIME_H #include +#else +struct utimbuf { + time_t actime; /* access time */ + time_t modtime; /* modification time */ +}; #endif #ifndef HAVE_MKTIME @@ -51,4 +56,14 @@ time_t rep_mktime(struct tm *t); time_t rep_timegm(struct tm *tm); #endif +#ifndef HAVE_UTIME +/* define is in "replace.h" */ +int rep_utime(const char *filename, const struct utimbuf *buf); +#endif + +#ifndef HAVE_UTIMES +/* define is in "replace.h" */ +int rep_utimes(const char *filename, const struct timeval tv[2]); +#endif + #endif diff --git a/source4/lib/replace/test/testsuite.c b/source4/lib/replace/test/testsuite.c index b538360365..1e8290906e 100644 --- a/source4/lib/replace/test/testsuite.c +++ b/source4/lib/replace/test/testsuite.c @@ -872,6 +872,149 @@ static int test_getifaddrs(void) return true; } +static int test_utime(void) +{ + struct utimbuf u; + struct stat st1, st2, st3; + int fd; + + printf("test: utime\n"); + unlink(TESTFILE); + + fd = open(TESTFILE, O_RDWR|O_CREAT, 0600); + if (fd == -1) { + printf("failure: utime [\n" + "creating '%s' failed - %s\n]\n", + TESTFILE, strerror(errno)); + return false; + } + + if (fstat(fd, &st1) != 0) { + printf("failure: utime [\n" + "fstat (1) failed - %s\n]\n", + strerror(errno)); + return false; + } + + u.actime = st1.st_atime + 300; + u.modtime = st1.st_mtime - 300; + if (utime(TESTFILE, &u) != 0) { + printf("failure: utime [\n" + "utime(&u) failed - %s\n]\n", + strerror(errno)); + return false; + } + + if (fstat(fd, &st2) != 0) { + printf("failure: utime [\n" + "fstat (2) failed - %s\n]\n", + strerror(errno)); + return false; + } + + if (utime(TESTFILE, NULL) != 0) { + printf("failure: utime [\n" + "utime(NULL) failed - %s\n]\n", + strerror(errno)); + return false; + } + + if (fstat(fd, &st3) != 0) { + printf("failure: utime [\n" + "fstat (3) failed - %s\n]\n", + strerror(errno)); + return false; + } + +#define CMP_VAL(a,c,b) do { \ + if (a c b) { \ + printf("failure: utime [\n" \ + "%s: %s(%d) %s %s(%d)\n]\n", \ + __location__, \ + #a, (int)a, #c, #b, (int)b); \ + return false; \ + } \ +} while(0) +#define EQUAL_VAL(a,b) CMP_VAL(a,!=,b) +#define GREATER_VAL(a,b) CMP_VAL(a,<=,b) +#define LESSER_VAL(a,b) CMP_VAL(a,>=,b) + + EQUAL_VAL(st2.st_atime, st1.st_atime + 300); + EQUAL_VAL(st2.st_mtime, st1.st_mtime - 300); + LESSER_VAL(st3.st_atime, st2.st_atime); + GREATER_VAL(st3.st_mtime, st2.st_mtime); + +#undef CMP_VAL +#undef EQUAL_VAL +#undef GREATER_VAL +#undef LESSER_VAL + + unlink(TESTFILE); + printf("success: utime\n"); + return true; +} + +static int test_utimes(void) +{ + struct timeval tv[2]; + struct stat st1, st2; + int fd; + + printf("test: utimes\n"); + unlink(TESTFILE); + + fd = open(TESTFILE, O_RDWR|O_CREAT, 0600); + if (fd == -1) { + printf("failure: utimes [\n" + "creating '%s' failed - %s\n]\n", + TESTFILE, strerror(errno)); + return false; + } + + if (fstat(fd, &st1) != 0) { + printf("failure: utimes [\n" + "fstat (1) failed - %s\n]\n", + strerror(errno)); + return false; + } + + ZERO_STRUCT(tv); + tv[0].tv_sec = st1.st_atime + 300; + tv[1].tv_sec = st1.st_mtime - 300; + if (utimes(TESTFILE, tv) != 0) { + printf("failure: utimes [\n" + "utimes(tv) failed - %s\n]\n", + strerror(errno)); + return false; + } + + if (fstat(fd, &st2) != 0) { + printf("failure: utimes [\n" + "fstat (2) failed - %s\n]\n", + strerror(errno)); + return false; + } + +#define EQUAL_VAL(a,b) do { \ + if (a != b) { \ + printf("failure: utimes [\n" \ + "%s: %s(%d) != %s(%d)\n]\n", \ + __location__, \ + #a, (int)a, #b, (int)b); \ + return false; \ + } \ +} while(0) + + EQUAL_VAL(st2.st_atime, st1.st_atime + 300); + EQUAL_VAL(st2.st_mtime, st1.st_mtime - 300); + +#undef EQUAL_VAL + + unlink(TESTFILE); + printf("success: utimes\n"); + return true; +} + struct torture_context; bool torture_local_replace(struct torture_context *ctx) { @@ -920,6 +1063,8 @@ bool torture_local_replace(struct torture_context *ctx) ret &= test_socketpair(); ret &= test_strptime(); ret &= test_getifaddrs(); + ret &= test_utime(); + ret &= test_utimes(); return ret; } -- cgit From a0c6043c34abe5451e5de55791fc274e113504af Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 7 May 2008 16:50:19 +0200 Subject: libreplace: split out network checks into a AC_LIBREPLACE_NETWORK_CHECKS macro Note: moving it out of AC_LIBREPLACE_BROKEN_CHECKS will be the next step metze (This used to be commit 55a904b1d7aeca849d450e371b18afca5b0c6218) --- source4/lib/replace/libreplace.m4 | 65 +--------------------------- source4/lib/replace/libreplace_network.m4 | 71 +++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 63 deletions(-) create mode 100644 source4/lib/replace/libreplace_network.m4 (limited to 'source4/lib') diff --git a/source4/lib/replace/libreplace.m4 b/source4/lib/replace/libreplace.m4 index 8e17258918..1eba93792b 100644 --- a/source4/lib/replace/libreplace.m4 +++ b/source4/lib/replace/libreplace.m4 @@ -96,65 +96,10 @@ fi AC_CHECK_HEADERS(sys/syslog.h syslog.h) AC_CHECK_HEADERS(sys/time.h time.h) AC_CHECK_HEADERS(stdarg.h vararg.h) -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 -AC_CACHE_CHECK([for usable net/if.h],libreplace_cv_USABLE_NET_IF_H,[ - AC_COMPILE_IFELSE([AC_LANG_SOURCE([ - AC_INCLUDES_DEFAULT - #if HAVE_SYS_SOCKET_H - # include - #endif - #include - int main(void) {return 0;}])], - [libreplace_cv_USABLE_NET_IF_H=yes], - [libreplace_cv_USABLE_NET_IF_H=no] - ) -]) -if test x"$libreplace_cv_USABLE_NET_IF_H" = x"yes";then - AC_DEFINE(HAVE_NET_IF_H, 1, usability of net/if.h) -fi - -AC_HAVE_TYPE([socklen_t],[#include ]) -AC_HAVE_TYPE([sa_family_t],[#include ]) -AC_HAVE_TYPE([struct addrinfo], [#include ]) -AC_HAVE_TYPE([struct sockaddr], [#include ]) -AC_HAVE_TYPE([struct sockaddr_storage], [ -#include -#include -#include -]) -AC_HAVE_TYPE([struct sockaddr_in6], [ -#include -#include -#include -]) - -if test x"$ac_cv_type_struct_sockaddr_storage" = x"yes"; then -AC_CHECK_MEMBER(struct sockaddr_storage.ss_family, - AC_DEFINE(HAVE_SS_FAMILY, 1, [Defined if struct sockaddr_storage has ss_family field]),, - [ -#include -#include -#include - ]) - -if test x"$ac_cv_member_struct_sockaddr_storage_ss_family" != x"yes"; then -AC_CHECK_MEMBER(struct sockaddr_storage.__ss_family, - AC_DEFINE(HAVE___SS_FAMILY, 1, [Defined if struct sockaddr_storage has __ss_family field]),, - [ -#include -#include -#include - ]) -fi -fi - AC_CHECK_FUNCS(seteuid setresuid setegid setresgid chroot bzero strerror) AC_CHECK_FUNCS(vsyslog setlinebuf mktime ftruncate chsize rename) AC_CHECK_FUNCS(waitpid strlcpy strlcat initgroups memmove strdup) @@ -326,19 +271,12 @@ m4_include(getpass.m4) m4_include(strptime.m4) m4_include(win32.m4) m4_include(timegm.m4) -m4_include(socket.m4) -m4_include(inet_ntop.m4) -m4_include(inet_pton.m4) -m4_include(inet_aton.m4) -m4_include(inet_ntoa.m4) -m4_include(getaddrinfo.m4) m4_include(repdir.m4) -m4_include(getifaddrs.m4) -m4_include(socketpair.m4) AC_CHECK_FUNCS([syslog printf memset memcpy],,[AC_MSG_ERROR([Required function not found])]) echo "LIBREPLACE_BROKEN_CHECKS: END" +AC_LIBREPLACE_NETWORK_CHECKS ]) dnl end AC_LIBREPLACE_BROKEN_CHECKS AC_DEFUN_ONCE(AC__LIBREPLACE_ALL_CHECKS_START, @@ -361,5 +299,6 @@ CFLAGS="$CFLAGS -I$libreplacedir" m4_include(libreplace_cc.m4) m4_include(libreplace_ld.m4) +m4_include(libreplace_network.m4) m4_include(libreplace_macros.m4) m4_include(autoconf-2.60.m4) diff --git a/source4/lib/replace/libreplace_network.m4 b/source4/lib/replace/libreplace_network.m4 new file mode 100644 index 0000000000..7702702799 --- /dev/null +++ b/source4/lib/replace/libreplace_network.m4 @@ -0,0 +1,71 @@ +AC_DEFUN_ONCE(AC_LIBREPLACE_NETWORK_CHECKS, +[ +echo "LIBREPLACE_NETWORK_CHECKS: START" + +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) + +dnl we need to check that net/if.h really can be used, to cope with hpux +dnl where including it always fails +AC_CACHE_CHECK([for usable net/if.h],libreplace_cv_USABLE_NET_IF_H,[ + AC_COMPILE_IFELSE([AC_LANG_SOURCE([ + AC_INCLUDES_DEFAULT + #if HAVE_SYS_SOCKET_H + # include + #endif + #include + int main(void) {return 0;}])], + [libreplace_cv_USABLE_NET_IF_H=yes], + [libreplace_cv_USABLE_NET_IF_H=no] + ) +]) +if test x"$libreplace_cv_USABLE_NET_IF_H" = x"yes";then + AC_DEFINE(HAVE_NET_IF_H, 1, usability of net/if.h) +fi + +AC_HAVE_TYPE([socklen_t],[#include ]) +AC_HAVE_TYPE([sa_family_t],[#include ]) +AC_HAVE_TYPE([struct addrinfo], [#include ]) +AC_HAVE_TYPE([struct sockaddr], [#include ]) +AC_HAVE_TYPE([struct sockaddr_storage], [ +#include +#include +#include +]) +AC_HAVE_TYPE([struct sockaddr_in6], [ +#include +#include +#include +]) + +if test x"$ac_cv_type_struct_sockaddr_storage" = x"yes"; then +AC_CHECK_MEMBER(struct sockaddr_storage.ss_family, + AC_DEFINE(HAVE_SS_FAMILY, 1, [Defined if struct sockaddr_storage has ss_family field]),, + [ +#include +#include +#include + ]) + +if test x"$ac_cv_member_struct_sockaddr_storage_ss_family" != x"yes"; then +AC_CHECK_MEMBER(struct sockaddr_storage.__ss_family, + AC_DEFINE(HAVE___SS_FAMILY, 1, [Defined if struct sockaddr_storage has __ss_family field]),, + [ +#include +#include +#include + ]) +fi +fi + +m4_include(socket.m4) +m4_include(inet_ntop.m4) +m4_include(inet_pton.m4) +m4_include(inet_aton.m4) +m4_include(inet_ntoa.m4) +m4_include(getaddrinfo.m4) +m4_include(getifaddrs.m4) +m4_include(socketpair.m4) + +echo "LIBREPLACE_NETWORK_CHECKS: END" +]) dnl end AC_LIBREPLACE_NETWORK_CHECKS -- cgit From 63da424e8124a9def5d46f769804be661b059aab Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 7 May 2008 17:15:36 +0200 Subject: libreplace: use AC_LIBREPLACE_NETWORK_CHECKS only for samba metze (This used to be commit 3451b54bf7f5e37a589ec261d28c2a8b6f9788ed) --- source4/lib/replace/libreplace.m4 | 1 - source4/lib/replace/samba.m4 | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/replace/libreplace.m4 b/source4/lib/replace/libreplace.m4 index 1eba93792b..2b33d97989 100644 --- a/source4/lib/replace/libreplace.m4 +++ b/source4/lib/replace/libreplace.m4 @@ -276,7 +276,6 @@ m4_include(repdir.m4) AC_CHECK_FUNCS([syslog printf memset memcpy],,[AC_MSG_ERROR([Required function not found])]) echo "LIBREPLACE_BROKEN_CHECKS: END" -AC_LIBREPLACE_NETWORK_CHECKS ]) dnl end AC_LIBREPLACE_BROKEN_CHECKS AC_DEFUN_ONCE(AC__LIBREPLACE_ALL_CHECKS_START, diff --git a/source4/lib/replace/samba.m4 b/source4/lib/replace/samba.m4 index 7984ef31db..07c4d38887 100644 --- a/source4/lib/replace/samba.m4 +++ b/source4/lib/replace/samba.m4 @@ -1,4 +1,5 @@ AC_LIBREPLACE_BROKEN_CHECKS +AC_LIBREPLACE_NETWORK_CHECKS SMB_EXT_LIB(LIBREPLACE_EXT, [${LIBDL}]) SMB_ENABLE(LIBREPLACE_EXT) -- cgit From 10a208fc4f8de6fdd20e5906f9fc6915124f6f83 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 7 May 2008 17:38:41 +0200 Subject: libreplace: also use AC_LIBREPLACE_NETWORK_CHECKS for the standalone build metze (This used to be commit 04f4523ed032946b8f0e74ac6f7458010159e3bb) --- source4/lib/replace/configure.ac | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/lib') diff --git a/source4/lib/replace/configure.ac b/source4/lib/replace/configure.ac index 02dc08bf72..81997e09b7 100644 --- a/source4/lib/replace/configure.ac +++ b/source4/lib/replace/configure.ac @@ -6,6 +6,7 @@ AC_CONFIG_HEADER(config.h) CFLAGS="$CFLAGS -I$srcdir" AC_LIBREPLACE_ALL_CHECKS +AC_LIBREPLACE_NETWORK_CHECKS if test "$ac_cv_prog_gcc" = yes; then CFLAGS="$CFLAGS -Wall" -- cgit From 4aba4d38c7cc1df4520df7f052d7d3c039597ed2 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 8 May 2008 11:56:32 +0200 Subject: Fix link flags for ldb and tdb Python modules. (This used to be commit 787a32fdef9d761d64839f489cca0b0684f9a9fd) --- source4/lib/ldb/ldb.mk | 2 +- source4/lib/tdb/tdb.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/ldb.mk b/source4/lib/ldb/ldb.mk index cc920178bc..58ce598d06 100644 --- a/source4/lib/ldb/ldb.mk +++ b/source4/lib/ldb/ldb.mk @@ -71,7 +71,7 @@ ldb_wrap.o: $(ldbdir)/ldb_wrap.c $(CC) $(PICFLAG) -c $(ldbdir)/ldb_wrap.c $(CFLAGS) `$(PYTHON_CONFIG) --cflags` _ldb.$(SHLIBEXT): $(LIBS) ldb_wrap.o - $(SHLD) $(SHLD_FLAGS) -o _ldb.$(SHLIBEXT) ldb_wrap.o $(LIB_FLAGS) + $(SHLD) $(SHLD_FLAGS) -o _ldb.$(SHLIBEXT) ldb_wrap.o $(LIB_FLAGS) `$(PYTHON_CONFIG) --ldflagsb` install-python:: build-python mkdir -p $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(0, prefix='$(prefix)')"` \ diff --git a/source4/lib/tdb/tdb.mk b/source4/lib/tdb/tdb.mk index 0e53927366..c91b1289cb 100644 --- a/source4/lib/tdb/tdb.mk +++ b/source4/lib/tdb/tdb.mk @@ -39,7 +39,7 @@ tdb_wrap.o: $(tdbdir)/tdb_wrap.c $(CC) $(PICFLAG) -c $(tdbdir)/tdb_wrap.c $(CFLAGS) `$(PYTHON_CONFIG) --cflags` _tdb.$(SHLIBEXT): libtdb.$(SHLIBEXT) tdb_wrap.o - $(SHLD) $(SHLD_FLAGS) -o $@ tdb_wrap.o -L. -ltdb `$(PYTHON_CONFIG) --libs` + $(SHLD) $(SHLD_FLAGS) -o $@ tdb_wrap.o -L. -ltdb `$(PYTHON_CONFIG) --ldflags` install:: installdirs installbin installheaders installlibs \ $(PYTHON_INSTALL_TARGET) -- cgit From c68589a5dcefc2cd337449d343019271192fc11a Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 8 May 2008 12:40:56 +0200 Subject: Fix typo. (This used to be commit 1def988ef28de85b3f97172bdbf935a4fec4dec3) --- source4/lib/ldb/ldb.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/ldb.mk b/source4/lib/ldb/ldb.mk index 58ce598d06..df11e9d2ab 100644 --- a/source4/lib/ldb/ldb.mk +++ b/source4/lib/ldb/ldb.mk @@ -71,7 +71,7 @@ ldb_wrap.o: $(ldbdir)/ldb_wrap.c $(CC) $(PICFLAG) -c $(ldbdir)/ldb_wrap.c $(CFLAGS) `$(PYTHON_CONFIG) --cflags` _ldb.$(SHLIBEXT): $(LIBS) ldb_wrap.o - $(SHLD) $(SHLD_FLAGS) -o _ldb.$(SHLIBEXT) ldb_wrap.o $(LIB_FLAGS) `$(PYTHON_CONFIG) --ldflagsb` + $(SHLD) $(SHLD_FLAGS) -o _ldb.$(SHLIBEXT) ldb_wrap.o $(LIB_FLAGS) `$(PYTHON_CONFIG) --ldflags` install-python:: build-python mkdir -p $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(0, prefix='$(prefix)')"` \ -- cgit From b3e1d69dcd58a72851b2efefd83ade377c9d2e85 Mon Sep 17 00:00:00 2001 From: William Jojo Date: Thu, 8 May 2008 12:41:57 +0200 Subject: Add undefined symbol flag for AIX. (This used to be commit dabdf24e86f038e3afc67532fa5bf60a37992161) --- source4/lib/replace/libreplace_ld.m4 | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source4/lib') diff --git a/source4/lib/replace/libreplace_ld.m4 b/source4/lib/replace/libreplace_ld.m4 index f0d10c1e3e..0d0356055c 100644 --- a/source4/lib/replace/libreplace_ld.m4 +++ b/source4/lib/replace/libreplace_ld.m4 @@ -270,6 +270,10 @@ AC_DEFUN([AC_LIBREPLACE_LD_SHLIB_ALLOW_UNDEF_FLAG], *darwin*) LD_SHLIB_ALLOW_UNDEF_FLAG="-undefined dynamic_lookup" ;; + *aix*) + LD_SHLIB_ALLOW_UNDEF_FLAG="--Wl,-bnoentry" + ;; + ; esac AC_SUBST(LD_SHLIB_ALLOW_UNDEF_FLAG) -- cgit From ca6ac11b46a75bf02cf873c6aedb4f85af227168 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 8 May 2008 13:43:45 +0200 Subject: Fix typo. (This used to be commit bd089818a3182698dfe85039c1b2e22d8c2835bb) --- source4/lib/replace/libreplace_ld.m4 | 1 - 1 file changed, 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/replace/libreplace_ld.m4 b/source4/lib/replace/libreplace_ld.m4 index 0d0356055c..9995d69bbc 100644 --- a/source4/lib/replace/libreplace_ld.m4 +++ b/source4/lib/replace/libreplace_ld.m4 @@ -273,7 +273,6 @@ AC_DEFUN([AC_LIBREPLACE_LD_SHLIB_ALLOW_UNDEF_FLAG], *aix*) LD_SHLIB_ALLOW_UNDEF_FLAG="--Wl,-bnoentry" ;; - ; esac AC_SUBST(LD_SHLIB_ALLOW_UNDEF_FLAG) -- cgit From d0096e90ba9d8aa6b339022bac194e57ae0a2b7a Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 10 May 2008 00:46:25 +0200 Subject: Fix installation of pidl perl files, torture pc file. (This used to be commit 32da606e3759026c2744f853cd8948333ed0579c) --- source4/lib/torture/config.mk | 3 +++ source4/lib/torture/torture.pc.in | 12 ++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 source4/lib/torture/torture.pc.in (limited to 'source4/lib') diff --git a/source4/lib/torture/config.mk b/source4/lib/torture/config.mk index e981ee0c99..15c64786c5 100644 --- a/source4/lib/torture/config.mk +++ b/source4/lib/torture/config.mk @@ -5,6 +5,9 @@ PUBLIC_DEPENDENCIES = \ LIBSAMBA-UTIL \ LIBTALLOC +TORTURE_VERSION = 0.0.1 +TORTURE_SO_VERSION = 0 + PC_FILES += lib/torture/torture.pc torture_OBJ_FILES = $(addprefix lib/torture/, torture.o) diff --git a/source4/lib/torture/torture.pc.in b/source4/lib/torture/torture.pc.in new file mode 100644 index 0000000000..6582816cb5 --- /dev/null +++ b/source4/lib/torture/torture.pc.in @@ -0,0 +1,12 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ +modulesdir=${prefix}/modules/torture + +Name: torture +Description: Samba torture (test) suite +Requires: talloc +Version: 0.0.1 +Libs: -L${libdir} -ltorture +Cflags: -I${includedir} -DHAVE_IMMEDIATE_STRUCTURES=1 -- cgit From bc4eacb5d89ca8dca123e2d6bd6eba47ed93b771 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 10 May 2008 14:26:08 +0200 Subject: Fix case. (This used to be commit a90971ea0c43ce3b42b95aef5973139576b51959) --- source4/lib/torture/config.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/torture/config.mk b/source4/lib/torture/config.mk index 15c64786c5..638f0d940c 100644 --- a/source4/lib/torture/config.mk +++ b/source4/lib/torture/config.mk @@ -5,8 +5,8 @@ PUBLIC_DEPENDENCIES = \ LIBSAMBA-UTIL \ LIBTALLOC -TORTURE_VERSION = 0.0.1 -TORTURE_SO_VERSION = 0 +torture_VERSION = 0.0.1 +torture_SO_VERSION = 0 PC_FILES += lib/torture/torture.pc torture_OBJ_FILES = $(addprefix lib/torture/, torture.o) -- cgit From 778681e10a80ce25e23c708b41958c61cbce2545 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 10 May 2008 22:30:00 +0200 Subject: Fix soversion for libtorture and libsamba-hostconfig. (This used to be commit 1f698b96c7962a453f037815c9160cd8d7dde3f6) --- source4/lib/torture/config.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/torture/config.mk b/source4/lib/torture/config.mk index 638f0d940c..888e285e95 100644 --- a/source4/lib/torture/config.mk +++ b/source4/lib/torture/config.mk @@ -6,7 +6,7 @@ PUBLIC_DEPENDENCIES = \ LIBTALLOC torture_VERSION = 0.0.1 -torture_SO_VERSION = 0 +torture_SOVERSION = 0 PC_FILES += lib/torture/torture.pc torture_OBJ_FILES = $(addprefix lib/torture/, torture.o) -- cgit From 670122d724ff190d886a8eca86b6eeff64592708 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 10 May 2008 23:46:51 +0200 Subject: Fix torture module initializion. (This used to be commit d5bf4e9065303b54421a6f35b213a22f062d27d4) --- source4/lib/crypto/config.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/crypto/config.mk b/source4/lib/crypto/config.mk index 82dbe4a4cb..8e0cba17f0 100644 --- a/source4/lib/crypto/config.mk +++ b/source4/lib/crypto/config.mk @@ -10,7 +10,7 @@ LIBCRYPTO_OBJ_FILES = $(addprefix lib/crypto/, \ [MODULE::TORTURE_LIBCRYPTO] -SUBSYSTEM = torture +SUBSYSTEM = smbtorture PRIVATE_DEPENDENCIES = LIBCRYPTO PRIVATE_PROTO_HEADER = test_proto.h -- cgit From b48e2e4c4103e7b6065bce61af39f09ebfb83af2 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 11 May 2008 02:15:32 +0200 Subject: Merge ldb_map into LIBLDB. (This used to be commit 4d7925f953bc9d1fcffb4a4dd268b763c18ceae6) --- source4/lib/ldb/config.mk | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/config.mk b/source4/lib/ldb/config.mk index 23e2ef71dd..e8852980f6 100644 --- a/source4/lib/ldb/config.mk +++ b/source4/lib/ldb/config.mk @@ -70,16 +70,10 @@ INIT_FUNCTION = LDB_MODULE(rdn_name) ldb_rdn_name_OBJ_FILES = lib/ldb/modules/rdn_name.o -################################################ -# Start MODULE ldb_map -[SUBSYSTEM::ldb_map] -PRIVATE_DEPENDENCIES = LIBTALLOC -CFLAGS = -Ilib/ldb/include -Ilib/ldb/ldb_map -# End MODULE ldb_map -################################################ - ldb_map_OBJ_FILES = $(addprefix lib/ldb/ldb_map/, ldb_map_inbound.o ldb_map_outbound.o ldb_map.o) +$(ldb_map_OBJ_FILES): CFLAGS+=-Ilib/ldb/ldb_map + ################################################ # Start MODULE ldb_skel [MODULE::ldb_skel] @@ -134,7 +128,7 @@ PC_FILES += $(ldbdir)/ldb.pc LIBLDB_VERSION = 0.0.1 LIBLDB_SOVERSION = 0 -LIBLDB_OBJ_FILES = $(addprefix lib/ldb/common/, ldb.o ldb_ldif.o ldb_parse.o ldb_msg.o ldb_utf8.o ldb_debug.o ldb_modules.o ldb_match.o ldb_attributes.o attrib_handlers.o ldb_dn.o ldb_controls.o qsort.o) +LIBLDB_OBJ_FILES = $(addprefix lib/ldb/common/, ldb.o ldb_ldif.o ldb_parse.o ldb_msg.o ldb_utf8.o ldb_debug.o ldb_modules.o ldb_match.o ldb_attributes.o attrib_handlers.o ldb_dn.o ldb_controls.o qsort.o) $(ldb_map_OBJ_FILES) PUBLIC_HEADERS += $(ldbdir)/include/ldb.h $(ldbdir)/include/ldb_errors.h -- cgit From 348109e6887865cf9d58bcd5aa8be5974abe33fd Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 11 May 2008 03:31:38 +0200 Subject: Fix dependency on loadparm. (This used to be commit 018ee187ffbfd77aa0d5f5da6c3512ea6b37a746) --- source4/lib/events/config.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/events/config.mk b/source4/lib/events/config.mk index e5a1316c47..058ce7f793 100644 --- a/source4/lib/events/config.mk +++ b/source4/lib/events/config.mk @@ -44,6 +44,6 @@ PUBLIC_HEADERS += $(addprefix lib/events/, events.h events_internal.h) [PYTHON::swig_events] SWIG_FILE = events.i -PRIVATE_DEPENDENCIES = LIBEVENTS +PRIVATE_DEPENDENCIES = LIBEVENTS LIBSAMBA-HOSTCONFIG swig_events_OBJ_FILES = lib/events/events_wrap.o -- cgit From 451febf89d2c6bfc52c030c9838370ec49ff22dd Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 11 May 2008 05:17:29 +0200 Subject: Avoid installing non-public header. (This used to be commit bec87e1878841764104b98f05b34a72a98c8dd71) --- source4/lib/nss_wrapper/config.mk | 1 - 1 file changed, 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/nss_wrapper/config.mk b/source4/lib/nss_wrapper/config.mk index 61f6392008..5f136a465d 100644 --- a/source4/lib/nss_wrapper/config.mk +++ b/source4/lib/nss_wrapper/config.mk @@ -4,5 +4,4 @@ # End SUBSYSTEM NSS_WRAPPER ############################## -PUBLIC_HEADERS += lib/nss_wrapper/nss_wrapper.h NSS_WRAPPER_OBJ_FILES = lib/nss_wrapper/nss_wrapper.o -- cgit From babdcc6135e6d3a91a9ddeae0555652026f09344 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 11 May 2008 05:29:20 +0200 Subject: Use system python rather than smbpython. (This used to be commit d3df51cd01e53383dcc05923d248db03bc6f62e9) --- source4/lib/ldb/tests/python/ldap.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source4/lib') diff --git a/source4/lib/ldb/tests/python/ldap.py b/source4/lib/ldb/tests/python/ldap.py index ead5796b7b..7cbe6e5e7d 100755 --- a/source4/lib/ldb/tests/python/ldap.py +++ b/source4/lib/ldb/tests/python/ldap.py @@ -6,6 +6,8 @@ import getopt import optparse import sys +sys.path.append("bin/python") + import samba.getopt as options from auth import system_session -- cgit From 3ed49cd2aef333f9939dff59fc24ae4aee79c7e0 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 11 May 2008 05:49:07 +0200 Subject: Avoid unnecessary headers in lib/torture. (This used to be commit 43c18ba5cf0f709c4a7bd686d5e6bf613227b61d) --- source4/lib/torture/torture.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/torture/torture.c b/source4/lib/torture/torture.c index 3f2c7848aa..33959ded16 100644 --- a/source4/lib/torture/torture.c +++ b/source4/lib/torture/torture.c @@ -23,8 +23,6 @@ #include "lib/util/dlinklist.h" #include "param/param.h" #include "system/filesys.h" -#include "auth/credentials/credentials.h" -#include "lib/cmdline/popt_common.h" struct torture_context *torture_context_init(struct event_context *event_ctx, const struct torture_ui_ops *ui_ops) -- cgit From 88533f35dd21345143216d420a8972a5421969a4 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 8 May 2008 09:56:10 +0200 Subject: libreplace: merge socket.m4 into libreplace_network.m4 metze (This used to be commit c70eba87dbbac6c2c1e68c343cdd410577c1686f) --- source4/lib/replace/libreplace_network.m4 | 41 ++++++++++++++++++++++++++++++- source4/lib/replace/socket.m4 | 39 ----------------------------- 2 files changed, 40 insertions(+), 40 deletions(-) delete mode 100644 source4/lib/replace/socket.m4 (limited to 'source4/lib') diff --git a/source4/lib/replace/libreplace_network.m4 b/source4/lib/replace/libreplace_network.m4 index 7702702799..209d418be6 100644 --- a/source4/lib/replace/libreplace_network.m4 +++ b/source4/lib/replace/libreplace_network.m4 @@ -58,7 +58,46 @@ AC_CHECK_MEMBER(struct sockaddr_storage.__ss_family, fi fi -m4_include(socket.m4) +dnl The following test is roughl taken from the cvs sources. +dnl +dnl If we can't find connect, try looking in -lsocket, -lnsl, and -linet. +dnl The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has +dnl libsocket.so which has a bad implementation of gethostbyname (it +dnl only looks in /etc/hosts), so we only look for -lsocket if we need +dnl it. +AC_CHECK_FUNCS(connect) +if test x"$ac_cv_func_connect" = x"no"; then + AC_CHECK_LIB_EXT(nsl_s, LIBREPLACE_NETWORK_LIBS, connect) + AC_CHECK_LIB_EXT(nsl, LIBREPLACE_NETWORK_LIBS, connect) + AC_CHECK_LIB_EXT(socket, LIBREPLACE_NETWORK_LIBS, connect) + AC_CHECK_LIB_EXT(inet, LIBREPLACE_NETWORK_LIBS, connect) + dnl We can't just call AC_CHECK_FUNCS(connect) here, + dnl because the value has been cached. + if test x"$ac_cv_lib_ext_nsl_s_connect" = x"yes" || + test x"$ac_cv_lib_ext_nsl_connect" = x"yes" || + test x"$ac_cv_lib_ext_socket_connect" = x"yes" || + test x"$ac_cv_lib_ext_inet_connect" = x"yes" + then + AC_DEFINE(HAVE_CONNECT,1,[Whether the system has connect()]) + fi +fi + +AC_CHECK_FUNCS(gethostbyname) +if test x"$ac_cv_func_gethostbyname" = x"no"; then + AC_CHECK_LIB_EXT(nsl_s, LIBREPLACE_NETWORK_LIBS, gethostbyname) + AC_CHECK_LIB_EXT(nsl, LIBREPLACE_NETWORK_LIBS, gethostbyname) + AC_CHECK_LIB_EXT(socket, LIBREPLACE_NETWORK_LIBS, gethostbyname) + dnl We can't just call AC_CHECK_FUNCS(gethostbyname) here, + dnl because the value has been cached. + if test x"$ac_cv_lib_ext_nsl_s_gethostbyname" = x"yes" || + test x"$ac_cv_lib_ext_nsl_gethostbyname" = x"yes" || + test x"$ac_cv_lib_ext_socket_gethostbyname" = x"yes" + then + AC_DEFINE(HAVE_GETHOSTBYNAME,1, + [Whether the system has gethostbyname()]) + fi +fi + m4_include(inet_ntop.m4) m4_include(inet_pton.m4) m4_include(inet_aton.m4) diff --git a/source4/lib/replace/socket.m4 b/source4/lib/replace/socket.m4 deleted file mode 100644 index 984f81f15f..0000000000 --- a/source4/lib/replace/socket.m4 +++ /dev/null @@ -1,39 +0,0 @@ -dnl The following test is roughl taken from the cvs sources. -dnl -dnl If we can't find connect, try looking in -lsocket, -lnsl, and -linet. -dnl The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has -dnl libsocket.so which has a bad implementation of gethostbyname (it -dnl only looks in /etc/hosts), so we only look for -lsocket if we need -dnl it. -AC_CHECK_FUNCS(connect) -if test x"$ac_cv_func_connect" = x"no"; then - AC_CHECK_LIB_EXT(nsl_s, LIBREPLACE_NETWORK_LIBS, connect) - AC_CHECK_LIB_EXT(nsl, LIBREPLACE_NETWORK_LIBS, connect) - AC_CHECK_LIB_EXT(socket, LIBREPLACE_NETWORK_LIBS, connect) - AC_CHECK_LIB_EXT(inet, LIBREPLACE_NETWORK_LIBS, connect) - dnl We can't just call AC_CHECK_FUNCS(connect) here, - dnl because the value has been cached. - if test x"$ac_cv_lib_ext_nsl_s_connect" = x"yes" || - test x"$ac_cv_lib_ext_nsl_connect" = x"yes" || - test x"$ac_cv_lib_ext_socket_connect" = x"yes" || - test x"$ac_cv_lib_ext_inet_connect" = x"yes" - then - AC_DEFINE(HAVE_CONNECT,1,[Whether the system has connect()]) - fi -fi - -AC_CHECK_FUNCS(gethostbyname) -if test x"$ac_cv_func_gethostbyname" = x"no"; then - AC_CHECK_LIB_EXT(nsl_s, LIBREPLACE_NETWORK_LIBS, gethostbyname) - AC_CHECK_LIB_EXT(nsl, LIBREPLACE_NETWORK_LIBS, gethostbyname) - AC_CHECK_LIB_EXT(socket, LIBREPLACE_NETWORK_LIBS, gethostbyname) - dnl We can't just call AC_CHECK_FUNCS(gethostbyname) here, - dnl because the value has been cached. - if test x"$ac_cv_lib_ext_nsl_s_gethostbyname" = x"yes" || - test x"$ac_cv_lib_ext_nsl_gethostbyname" = x"yes" || - test x"$ac_cv_lib_ext_socket_gethostbyname" = x"yes" - then - AC_DEFINE(HAVE_GETHOSTBYNAME,1, - [Whether the system has gethostbyname()]) - fi -fi -- cgit From 41eaffe653b244e0fb66d16bad0899c5f51aa9e4 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 8 May 2008 09:58:07 +0200 Subject: libreplace: merge inet_ntoa.m4 into libreplace_network.m4 metze (This used to be commit 82e826253b6d18832931dbb5c1dda009889bf9e0) --- source4/lib/replace/inet_ntoa.m4 | 19 ------------------- source4/lib/replace/libreplace_network.m4 | 21 ++++++++++++++++++++- 2 files changed, 20 insertions(+), 20 deletions(-) delete mode 100644 source4/lib/replace/inet_ntoa.m4 (limited to 'source4/lib') diff --git a/source4/lib/replace/inet_ntoa.m4 b/source4/lib/replace/inet_ntoa.m4 deleted file mode 100644 index 5aaa9350c5..0000000000 --- a/source4/lib/replace/inet_ntoa.m4 +++ /dev/null @@ -1,19 +0,0 @@ -AC_CHECK_FUNCS(inet_ntoa,[],[LIBREPLACEOBJ="${LIBREPLACEOBJ} inet_ntoa.o"]) - -AC_CACHE_CHECK([for broken inet_ntoa],libreplace_cv_REPLACE_INET_NTOA,[ -AC_TRY_RUN([ -#include -#include -#include -#include -#ifdef HAVE_ARPA_INET_H -#include -#endif -main() { struct in_addr ip; ip.s_addr = 0x12345678; -if (strcmp(inet_ntoa(ip),"18.52.86.120") && - strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); } -exit(1);}], - libreplace_cv_REPLACE_INET_NTOA=yes,libreplace_cv_REPLACE_INET_NTOA=no,libreplace_cv_REPLACE_INET_NTOA=cross)]) -if test x"$libreplace_cv_REPLACE_INET_NTOA" = x"yes"; then - AC_DEFINE(REPLACE_INET_NTOA,1,[Whether inet_ntoa should be replaced]) -fi diff --git a/source4/lib/replace/libreplace_network.m4 b/source4/lib/replace/libreplace_network.m4 index 209d418be6..35aa3ede7c 100644 --- a/source4/lib/replace/libreplace_network.m4 +++ b/source4/lib/replace/libreplace_network.m4 @@ -98,10 +98,29 @@ if test x"$ac_cv_func_gethostbyname" = x"no"; then fi fi +AC_CHECK_FUNCS(inet_ntoa,[],[LIBREPLACEOBJ="${LIBREPLACEOBJ} inet_ntoa.o"]) + +AC_CACHE_CHECK([for broken inet_ntoa],libreplace_cv_REPLACE_INET_NTOA,[ +AC_TRY_RUN([ +#include +#include +#include +#include +#ifdef HAVE_ARPA_INET_H +#include +#endif +main() { struct in_addr ip; ip.s_addr = 0x12345678; +if (strcmp(inet_ntoa(ip),"18.52.86.120") && + strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); } +exit(1);}], + libreplace_cv_REPLACE_INET_NTOA=yes,libreplace_cv_REPLACE_INET_NTOA=no,libreplace_cv_REPLACE_INET_NTOA=cross)]) +if test x"$libreplace_cv_REPLACE_INET_NTOA" = x"yes"; then + AC_DEFINE(REPLACE_INET_NTOA,1,[Whether inet_ntoa should be replaced]) +fi + m4_include(inet_ntop.m4) m4_include(inet_pton.m4) m4_include(inet_aton.m4) -m4_include(inet_ntoa.m4) m4_include(getaddrinfo.m4) m4_include(getifaddrs.m4) m4_include(socketpair.m4) -- cgit From b6b96be0c21a0efc19962b2a0b6610835aa3f93d Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 8 May 2008 09:59:16 +0200 Subject: libreplace: merge inet_aton.m4 into libreplace_network.m4 metze (This used to be commit fba00736c870f449c0eee32fe0d7b0d539dca51f) --- source4/lib/replace/inet_aton.m4 | 1 - source4/lib/replace/libreplace_network.m4 | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 source4/lib/replace/inet_aton.m4 (limited to 'source4/lib') diff --git a/source4/lib/replace/inet_aton.m4 b/source4/lib/replace/inet_aton.m4 deleted file mode 100644 index 853688ef6b..0000000000 --- a/source4/lib/replace/inet_aton.m4 +++ /dev/null @@ -1 +0,0 @@ -AC_CHECK_FUNCS(inet_aton,[],[LIBREPLACEOBJ="${LIBREPLACEOBJ} inet_aton.o"]) diff --git a/source4/lib/replace/libreplace_network.m4 b/source4/lib/replace/libreplace_network.m4 index 35aa3ede7c..66c8192a1e 100644 --- a/source4/lib/replace/libreplace_network.m4 +++ b/source4/lib/replace/libreplace_network.m4 @@ -118,9 +118,10 @@ if test x"$libreplace_cv_REPLACE_INET_NTOA" = x"yes"; then AC_DEFINE(REPLACE_INET_NTOA,1,[Whether inet_ntoa should be replaced]) fi +AC_CHECK_FUNCS(inet_aton,[],[LIBREPLACEOBJ="${LIBREPLACEOBJ} inet_aton.o"]) + m4_include(inet_ntop.m4) m4_include(inet_pton.m4) -m4_include(inet_aton.m4) m4_include(getaddrinfo.m4) m4_include(getifaddrs.m4) m4_include(socketpair.m4) -- cgit From 8408101e248587f9f3614fb4f9a644bfdf7abd49 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 8 May 2008 10:00:58 +0200 Subject: libreplace: merge inet_ntop.m4 into libreplace_network.m4 metze (This used to be commit 223ef6c08efb52251d0a772bb0c481b2803cf0ce) --- source4/lib/replace/inet_ntop.m4 | 1 - source4/lib/replace/libreplace_network.m4 | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 source4/lib/replace/inet_ntop.m4 (limited to 'source4/lib') diff --git a/source4/lib/replace/inet_ntop.m4 b/source4/lib/replace/inet_ntop.m4 deleted file mode 100644 index 6f39056f1d..0000000000 --- a/source4/lib/replace/inet_ntop.m4 +++ /dev/null @@ -1 +0,0 @@ -AC_CHECK_FUNCS(inet_ntop,[],[LIBREPLACEOBJ="${LIBREPLACEOBJ} inet_ntop.o"]) diff --git a/source4/lib/replace/libreplace_network.m4 b/source4/lib/replace/libreplace_network.m4 index 66c8192a1e..7ee7519e7e 100644 --- a/source4/lib/replace/libreplace_network.m4 +++ b/source4/lib/replace/libreplace_network.m4 @@ -120,7 +120,8 @@ fi AC_CHECK_FUNCS(inet_aton,[],[LIBREPLACEOBJ="${LIBREPLACEOBJ} inet_aton.o"]) -m4_include(inet_ntop.m4) +AC_CHECK_FUNCS(inet_ntop,[],[LIBREPLACEOBJ="${LIBREPLACEOBJ} inet_ntop.o"]) + m4_include(inet_pton.m4) m4_include(getaddrinfo.m4) m4_include(getifaddrs.m4) -- cgit From 1155c2f457bfc807abf4f798bb5940fc84994dca Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 8 May 2008 10:02:21 +0200 Subject: libreplace: merge inet_pton.m4 into libreplace_network.m4 metze (This used to be commit 3a70274c908e31453942b442351eab8423c1a53d) --- source4/lib/replace/inet_pton.m4 | 1 - source4/lib/replace/libreplace_network.m4 | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 source4/lib/replace/inet_pton.m4 (limited to 'source4/lib') diff --git a/source4/lib/replace/inet_pton.m4 b/source4/lib/replace/inet_pton.m4 deleted file mode 100644 index 51de9275d0..0000000000 --- a/source4/lib/replace/inet_pton.m4 +++ /dev/null @@ -1 +0,0 @@ -AC_CHECK_FUNCS(inet_pton,[],[LIBREPLACEOBJ="${LIBREPLACEOBJ} inet_pton.o"]) diff --git a/source4/lib/replace/libreplace_network.m4 b/source4/lib/replace/libreplace_network.m4 index 7ee7519e7e..25ededb027 100644 --- a/source4/lib/replace/libreplace_network.m4 +++ b/source4/lib/replace/libreplace_network.m4 @@ -122,7 +122,8 @@ AC_CHECK_FUNCS(inet_aton,[],[LIBREPLACEOBJ="${LIBREPLACEOBJ} inet_aton.o"]) AC_CHECK_FUNCS(inet_ntop,[],[LIBREPLACEOBJ="${LIBREPLACEOBJ} inet_ntop.o"]) -m4_include(inet_pton.m4) +AC_CHECK_FUNCS(inet_pton,[],[LIBREPLACEOBJ="${LIBREPLACEOBJ} inet_pton.o"]) + m4_include(getaddrinfo.m4) m4_include(getifaddrs.m4) m4_include(socketpair.m4) -- cgit From 254641d3f21d54927e46304c3fb091909f2c5ba3 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 8 May 2008 10:04:51 +0200 Subject: libreplace: merge socketpair.m4 into libreplace_network.m4 metze (This used to be commit f9f8f93adcc7161ebb18f5a0bf28c73d951a15ad) --- source4/lib/replace/libreplace_network.m4 | 3 ++- source4/lib/replace/socketpair.m4 | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 source4/lib/replace/socketpair.m4 (limited to 'source4/lib') diff --git a/source4/lib/replace/libreplace_network.m4 b/source4/lib/replace/libreplace_network.m4 index 25ededb027..87f6153e90 100644 --- a/source4/lib/replace/libreplace_network.m4 +++ b/source4/lib/replace/libreplace_network.m4 @@ -98,6 +98,8 @@ if test x"$ac_cv_func_gethostbyname" = x"no"; then fi fi +AC_CHECK_FUNCS(socketpair,[],[LIBREPLACEOBJ="${LIBREPLACEOBJ} socketpair.o"]) + AC_CHECK_FUNCS(inet_ntoa,[],[LIBREPLACEOBJ="${LIBREPLACEOBJ} inet_ntoa.o"]) AC_CACHE_CHECK([for broken inet_ntoa],libreplace_cv_REPLACE_INET_NTOA,[ @@ -126,7 +128,6 @@ AC_CHECK_FUNCS(inet_pton,[],[LIBREPLACEOBJ="${LIBREPLACEOBJ} inet_pton.o"]) m4_include(getaddrinfo.m4) m4_include(getifaddrs.m4) -m4_include(socketpair.m4) echo "LIBREPLACE_NETWORK_CHECKS: END" ]) dnl end AC_LIBREPLACE_NETWORK_CHECKS diff --git a/source4/lib/replace/socketpair.m4 b/source4/lib/replace/socketpair.m4 deleted file mode 100644 index 7088334cda..0000000000 --- a/source4/lib/replace/socketpair.m4 +++ /dev/null @@ -1 +0,0 @@ -AC_CHECK_FUNCS(socketpair,[],[LIBREPLACEOBJ="${LIBREPLACEOBJ} socketpair.o"]) -- cgit From 108443ace5ca4198a319c0b3619b530afd337594 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 8 May 2008 10:06:39 +0200 Subject: libreplace: merge getaddrinfo.m4 into libreplace_network.m4 metze (This used to be commit 64591d064dc3da6074f0f7539911a6e433d9cc43) --- source4/lib/replace/getaddrinfo.m4 | 32 ----------------------------- source4/lib/replace/libreplace_network.m4 | 34 ++++++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 33 deletions(-) delete mode 100644 source4/lib/replace/getaddrinfo.m4 (limited to 'source4/lib') diff --git a/source4/lib/replace/getaddrinfo.m4 b/source4/lib/replace/getaddrinfo.m4 deleted file mode 100644 index bc6e69ea56..0000000000 --- a/source4/lib/replace/getaddrinfo.m4 +++ /dev/null @@ -1,32 +0,0 @@ -dnl test for getaddrinfo/getnameinfo -AC_CACHE_CHECK([for getaddrinfo],libreplace_cv_HAVE_GETADDRINFO,[ -AC_TRY_LINK([ -#include -#if STDC_HEADERS -#include -#include -#endif -#include -#include ], -[ -struct sockaddr sa; -struct addrinfo *ai = NULL; -int ret = getaddrinfo(NULL, NULL, NULL, &ai); -if (ret != 0) { - const char *es = gai_strerror(ret); -} -freeaddrinfo(ai); -ret = getnameinfo(&sa, sizeof(sa), - NULL, 0, - NULL, 0, 0); - -], -libreplace_cv_HAVE_GETADDRINFO=yes,libreplace_cv_HAVE_GETADDRINFO=no)]) -if test x"$libreplace_cv_HAVE_GETADDRINFO" = x"yes"; then - AC_DEFINE(HAVE_GETADDRINFO,1,[Whether the system has getaddrinfo]) - AC_DEFINE(HAVE_GETNAMEINFO,1,[Whether the system has getnameinfo]) - AC_DEFINE(HAVE_FREEADDRINFO,1,[Whether the system has freeaddrinfo]) - AC_DEFINE(HAVE_GAI_STRERROR,1,[Whether the system has gai_strerror]) -else - LIBREPLACEOBJ="${LIBREPLACEOBJ} getaddrinfo.o" -fi diff --git a/source4/lib/replace/libreplace_network.m4 b/source4/lib/replace/libreplace_network.m4 index 87f6153e90..ff41056891 100644 --- a/source4/lib/replace/libreplace_network.m4 +++ b/source4/lib/replace/libreplace_network.m4 @@ -126,7 +126,39 @@ AC_CHECK_FUNCS(inet_ntop,[],[LIBREPLACEOBJ="${LIBREPLACEOBJ} inet_ntop.o"]) AC_CHECK_FUNCS(inet_pton,[],[LIBREPLACEOBJ="${LIBREPLACEOBJ} inet_pton.o"]) -m4_include(getaddrinfo.m4) +dnl test for getaddrinfo/getnameinfo +AC_CACHE_CHECK([for getaddrinfo],libreplace_cv_HAVE_GETADDRINFO,[ +AC_TRY_LINK([ +#include +#if STDC_HEADERS +#include +#include +#endif +#include +#include ], +[ +struct sockaddr sa; +struct addrinfo *ai = NULL; +int ret = getaddrinfo(NULL, NULL, NULL, &ai); +if (ret != 0) { + const char *es = gai_strerror(ret); +} +freeaddrinfo(ai); +ret = getnameinfo(&sa, sizeof(sa), + NULL, 0, + NULL, 0, 0); + +], +libreplace_cv_HAVE_GETADDRINFO=yes,libreplace_cv_HAVE_GETADDRINFO=no)]) +if test x"$libreplace_cv_HAVE_GETADDRINFO" = x"yes"; then + AC_DEFINE(HAVE_GETADDRINFO,1,[Whether the system has getaddrinfo]) + AC_DEFINE(HAVE_GETNAMEINFO,1,[Whether the system has getnameinfo]) + AC_DEFINE(HAVE_FREEADDRINFO,1,[Whether the system has freeaddrinfo]) + AC_DEFINE(HAVE_GAI_STRERROR,1,[Whether the system has gai_strerror]) +else + LIBREPLACEOBJ="${LIBREPLACEOBJ} getaddrinfo.o" +fi + m4_include(getifaddrs.m4) echo "LIBREPLACE_NETWORK_CHECKS: END" -- cgit From 0301064c6576af0ba5e8acd051758086cc45f082 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 8 May 2008 10:08:42 +0200 Subject: libreplace: merge getifaddrs.m4 into libreplace_network.m4 metze (This used to be commit 0234d397fefee8e1d0dcd3402f748c2251021c90) --- source4/lib/replace/getifaddrs.m4 | 128 ------------------------------ source4/lib/replace/libreplace_network.m4 | 128 +++++++++++++++++++++++++++++- 2 files changed, 127 insertions(+), 129 deletions(-) delete mode 100644 source4/lib/replace/getifaddrs.m4 (limited to 'source4/lib') diff --git a/source4/lib/replace/getifaddrs.m4 b/source4/lib/replace/getifaddrs.m4 deleted file mode 100644 index 927bc677db..0000000000 --- a/source4/lib/replace/getifaddrs.m4 +++ /dev/null @@ -1,128 +0,0 @@ -AC_CHECK_HEADERS([ifaddrs.h]) - -dnl Used when getifaddrs is not available -AC_CHECK_MEMBERS([struct sockaddr.sa_len], - [AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Whether struct sockaddr has a sa_len member])], - [], - [#include ]) - -dnl test for getifaddrs and freeifaddrs -AC_CACHE_CHECK([for getifaddrs and freeifaddrs],libreplace_cv_HAVE_GETIFADDRS,[ -AC_TRY_COMPILE([ -#include -#if STDC_HEADERS -#include -#include -#endif -#include -#include -#include -#include -#include ], -[ -struct ifaddrs *ifp = NULL; -int ret = getifaddrs (&ifp); -freeifaddrs(ifp); -], -libreplace_cv_HAVE_GETIFADDRS=yes,libreplace_cv_HAVE_GETIFADDRS=no)]) -if test x"$libreplace_cv_HAVE_GETIFADDRS" = x"yes"; then - AC_DEFINE(HAVE_GETIFADDRS,1,[Whether the system has getifaddrs]) - AC_DEFINE(HAVE_FREEIFADDRS,1,[Whether the system has freeifaddrs]) - AC_DEFINE(HAVE_STRUCT_IFADDRS,1,[Whether struct ifaddrs is available]) -fi - -################## -# look for a method of finding the list of network interfaces -# -# This tests need LIBS="${LIBREPLACE_NETWORK_LIBS}" -# -old_LIBS=$LIBS -LIBS="${LIBREPLACE_NETWORK_LIBS}" -SAVE_CPPFLAGS="$CPPFLAGS" -CPPFLAGS="$CPPFLAGS -I$libreplacedir" -iface=no; -################## -# look for a method of finding the list of network interfaces -iface=no; -AC_CACHE_CHECK([for iface getifaddrs],libreplace_cv_HAVE_IFACE_GETIFADDRS,[ -AC_TRY_RUN([ -#define HAVE_IFACE_GETIFADDRS 1 -#define NO_CONFIG_H 1 -#define AUTOCONF_TEST 1 -#define SOCKET_WRAPPER_NOT_REPLACE -#include "$libreplacedir/replace.c" -#include "$libreplacedir/inet_ntop.c" -#include "$libreplacedir/snprintf.c" -#include "$libreplacedir/getifaddrs.c" -#define getifaddrs_test main -#include "$libreplacedir/test/getifaddrs.c"], - libreplace_cv_HAVE_IFACE_GETIFADDRS=yes,libreplace_cv_HAVE_IFACE_GETIFADDRS=no,libreplace_cv_HAVE_IFACE_GETIFADDRS=cross)]) -if test x"$libreplace_cv_HAVE_IFACE_GETIFADDRS" = x"yes"; then - iface=yes;AC_DEFINE(HAVE_IFACE_GETIFADDRS,1,[Whether iface getifaddrs is available]) -else - LIBREPLACEOBJ="${LIBREPLACEOBJ} getifaddrs.o" -fi - - -if test $iface = no; then -AC_CACHE_CHECK([for iface AIX],libreplace_cv_HAVE_IFACE_AIX,[ -AC_TRY_RUN([ -#define HAVE_IFACE_AIX 1 -#define NO_CONFIG_H 1 -#define AUTOCONF_TEST 1 -#undef _XOPEN_SOURCE_EXTENDED -#define SOCKET_WRAPPER_NOT_REPLACE -#include "$libreplacedir/replace.c" -#include "$libreplacedir/inet_ntop.c" -#include "$libreplacedir/snprintf.c" -#include "$libreplacedir/getifaddrs.c" -#define getifaddrs_test main -#include "$libreplacedir/test/getifaddrs.c"], - libreplace_cv_HAVE_IFACE_AIX=yes,libreplace_cv_HAVE_IFACE_AIX=no,libreplace_cv_HAVE_IFACE_AIX=cross)]) -if test x"$libreplace_cv_HAVE_IFACE_AIX" = x"yes"; then - iface=yes;AC_DEFINE(HAVE_IFACE_AIX,1,[Whether iface AIX is available]) -fi -fi - - -if test $iface = no; then -AC_CACHE_CHECK([for iface ifconf],libreplace_cv_HAVE_IFACE_IFCONF,[ -AC_TRY_RUN([ -#define HAVE_IFACE_IFCONF 1 -#define NO_CONFIG_H 1 -#define AUTOCONF_TEST 1 -#define SOCKET_WRAPPER_NOT_REPLACE -#include "$libreplacedir/replace.c" -#include "$libreplacedir/inet_ntop.c" -#include "$libreplacedir/snprintf.c" -#include "$libreplacedir/getifaddrs.c" -#define getifaddrs_test main -#include "$libreplacedir/test/getifaddrs.c"], - libreplace_cv_HAVE_IFACE_IFCONF=yes,libreplace_cv_HAVE_IFACE_IFCONF=no,libreplace_cv_HAVE_IFACE_IFCONF=cross)]) -if test x"$libreplace_cv_HAVE_IFACE_IFCONF" = x"yes"; then - iface=yes;AC_DEFINE(HAVE_IFACE_IFCONF,1,[Whether iface ifconf is available]) -fi -fi - -if test $iface = no; then -AC_CACHE_CHECK([for iface ifreq],libreplace_cv_HAVE_IFACE_IFREQ,[ -AC_TRY_RUN([ -#define HAVE_IFACE_IFREQ 1 -#define NO_CONFIG_H 1 -#define AUTOCONF_TEST 1 -#define SOCKET_WRAPPER_NOT_REPLACE -#include "$libreplacedir/replace.c" -#include "$libreplacedir/inet_ntop.c" -#include "$libreplacedir/snprintf.c" -#include "$libreplacedir/getifaddrs.c" -#define getifaddrs_test main -#include "$libreplacedir/test/getifaddrs.c"], - libreplace_cv_HAVE_IFACE_IFREQ=yes,libreplace_cv_HAVE_IFACE_IFREQ=no,libreplace_cv_HAVE_IFACE_IFREQ=cross)]) -if test x"$libreplace_cv_HAVE_IFACE_IFREQ" = x"yes"; then - iface=yes;AC_DEFINE(HAVE_IFACE_IFREQ,1,[Whether iface ifreq is available]) -fi -fi - -LIBS=$old_LIBS -CPPFLAGS="$SAVE_CPPFLAGS" - diff --git a/source4/lib/replace/libreplace_network.m4 b/source4/lib/replace/libreplace_network.m4 index ff41056891..5ff699b36a 100644 --- a/source4/lib/replace/libreplace_network.m4 +++ b/source4/lib/replace/libreplace_network.m4 @@ -159,7 +159,133 @@ else LIBREPLACEOBJ="${LIBREPLACEOBJ} getaddrinfo.o" fi -m4_include(getifaddrs.m4) +AC_CHECK_HEADERS([ifaddrs.h]) + +dnl Used when getifaddrs is not available +AC_CHECK_MEMBERS([struct sockaddr.sa_len], + [AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Whether struct sockaddr has a sa_len member])], + [], + [#include ]) + +dnl test for getifaddrs and freeifaddrs +AC_CACHE_CHECK([for getifaddrs and freeifaddrs],libreplace_cv_HAVE_GETIFADDRS,[ +AC_TRY_COMPILE([ +#include +#if STDC_HEADERS +#include +#include +#endif +#include +#include +#include +#include +#include ], +[ +struct ifaddrs *ifp = NULL; +int ret = getifaddrs (&ifp); +freeifaddrs(ifp); +], +libreplace_cv_HAVE_GETIFADDRS=yes,libreplace_cv_HAVE_GETIFADDRS=no)]) +if test x"$libreplace_cv_HAVE_GETIFADDRS" = x"yes"; then + AC_DEFINE(HAVE_GETIFADDRS,1,[Whether the system has getifaddrs]) + AC_DEFINE(HAVE_FREEIFADDRS,1,[Whether the system has freeifaddrs]) + AC_DEFINE(HAVE_STRUCT_IFADDRS,1,[Whether struct ifaddrs is available]) +fi + +################## +# look for a method of finding the list of network interfaces +# +# This tests need LIBS="${LIBREPLACE_NETWORK_LIBS}" +# +old_LIBS=$LIBS +LIBS="${LIBREPLACE_NETWORK_LIBS}" +SAVE_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS -I$libreplacedir" +iface=no; +################## +# look for a method of finding the list of network interfaces +iface=no; +AC_CACHE_CHECK([for iface getifaddrs],libreplace_cv_HAVE_IFACE_GETIFADDRS,[ +AC_TRY_RUN([ +#define HAVE_IFACE_GETIFADDRS 1 +#define NO_CONFIG_H 1 +#define AUTOCONF_TEST 1 +#define SOCKET_WRAPPER_NOT_REPLACE +#include "$libreplacedir/replace.c" +#include "$libreplacedir/inet_ntop.c" +#include "$libreplacedir/snprintf.c" +#include "$libreplacedir/getifaddrs.c" +#define getifaddrs_test main +#include "$libreplacedir/test/getifaddrs.c"], + libreplace_cv_HAVE_IFACE_GETIFADDRS=yes,libreplace_cv_HAVE_IFACE_GETIFADDRS=no,libreplace_cv_HAVE_IFACE_GETIFADDRS=cross)]) +if test x"$libreplace_cv_HAVE_IFACE_GETIFADDRS" = x"yes"; then + iface=yes;AC_DEFINE(HAVE_IFACE_GETIFADDRS,1,[Whether iface getifaddrs is available]) +else + LIBREPLACEOBJ="${LIBREPLACEOBJ} getifaddrs.o" +fi + + +if test $iface = no; then +AC_CACHE_CHECK([for iface AIX],libreplace_cv_HAVE_IFACE_AIX,[ +AC_TRY_RUN([ +#define HAVE_IFACE_AIX 1 +#define NO_CONFIG_H 1 +#define AUTOCONF_TEST 1 +#undef _XOPEN_SOURCE_EXTENDED +#define SOCKET_WRAPPER_NOT_REPLACE +#include "$libreplacedir/replace.c" +#include "$libreplacedir/inet_ntop.c" +#include "$libreplacedir/snprintf.c" +#include "$libreplacedir/getifaddrs.c" +#define getifaddrs_test main +#include "$libreplacedir/test/getifaddrs.c"], + libreplace_cv_HAVE_IFACE_AIX=yes,libreplace_cv_HAVE_IFACE_AIX=no,libreplace_cv_HAVE_IFACE_AIX=cross)]) +if test x"$libreplace_cv_HAVE_IFACE_AIX" = x"yes"; then + iface=yes;AC_DEFINE(HAVE_IFACE_AIX,1,[Whether iface AIX is available]) +fi +fi + + +if test $iface = no; then +AC_CACHE_CHECK([for iface ifconf],libreplace_cv_HAVE_IFACE_IFCONF,[ +AC_TRY_RUN([ +#define HAVE_IFACE_IFCONF 1 +#define NO_CONFIG_H 1 +#define AUTOCONF_TEST 1 +#define SOCKET_WRAPPER_NOT_REPLACE +#include "$libreplacedir/replace.c" +#include "$libreplacedir/inet_ntop.c" +#include "$libreplacedir/snprintf.c" +#include "$libreplacedir/getifaddrs.c" +#define getifaddrs_test main +#include "$libreplacedir/test/getifaddrs.c"], + libreplace_cv_HAVE_IFACE_IFCONF=yes,libreplace_cv_HAVE_IFACE_IFCONF=no,libreplace_cv_HAVE_IFACE_IFCONF=cross)]) +if test x"$libreplace_cv_HAVE_IFACE_IFCONF" = x"yes"; then + iface=yes;AC_DEFINE(HAVE_IFACE_IFCONF,1,[Whether iface ifconf is available]) +fi +fi + +if test $iface = no; then +AC_CACHE_CHECK([for iface ifreq],libreplace_cv_HAVE_IFACE_IFREQ,[ +AC_TRY_RUN([ +#define HAVE_IFACE_IFREQ 1 +#define NO_CONFIG_H 1 +#define AUTOCONF_TEST 1 +#define SOCKET_WRAPPER_NOT_REPLACE +#include "$libreplacedir/replace.c" +#include "$libreplacedir/inet_ntop.c" +#include "$libreplacedir/snprintf.c" +#include "$libreplacedir/getifaddrs.c" +#define getifaddrs_test main +#include "$libreplacedir/test/getifaddrs.c"], + libreplace_cv_HAVE_IFACE_IFREQ=yes,libreplace_cv_HAVE_IFACE_IFREQ=no,libreplace_cv_HAVE_IFACE_IFREQ=cross)]) +if test x"$libreplace_cv_HAVE_IFACE_IFREQ" = x"yes"; then + iface=yes;AC_DEFINE(HAVE_IFACE_IFREQ,1,[Whether iface ifreq is available]) +fi +fi + +LIBS=$old_LIBS +CPPFLAGS="$SAVE_CPPFLAGS" echo "LIBREPLACE_NETWORK_CHECKS: END" ]) dnl end AC_LIBREPLACE_NETWORK_CHECKS -- cgit From c9b617ce3a4f17497273b90a021209d3eb466a60 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 8 May 2008 10:27:23 +0200 Subject: libreplace: include inet_ntoa.o when the system one is broken metze (This used to be commit 67845d3471711d24069636d0d4032f9d53748334) --- source4/lib/replace/libreplace_network.m4 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/replace/libreplace_network.m4 b/source4/lib/replace/libreplace_network.m4 index 5ff699b36a..6d10313e47 100644 --- a/source4/lib/replace/libreplace_network.m4 +++ b/source4/lib/replace/libreplace_network.m4 @@ -100,8 +100,6 @@ fi AC_CHECK_FUNCS(socketpair,[],[LIBREPLACEOBJ="${LIBREPLACEOBJ} socketpair.o"]) -AC_CHECK_FUNCS(inet_ntoa,[],[LIBREPLACEOBJ="${LIBREPLACEOBJ} inet_ntoa.o"]) - AC_CACHE_CHECK([for broken inet_ntoa],libreplace_cv_REPLACE_INET_NTOA,[ AC_TRY_RUN([ #include @@ -116,8 +114,11 @@ if (strcmp(inet_ntoa(ip),"18.52.86.120") && strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); } exit(1);}], libreplace_cv_REPLACE_INET_NTOA=yes,libreplace_cv_REPLACE_INET_NTOA=no,libreplace_cv_REPLACE_INET_NTOA=cross)]) + +AC_CHECK_FUNCS(inet_ntoa,[],[libreplace_cv_REPLACE_INET_NTOA=yes]) if test x"$libreplace_cv_REPLACE_INET_NTOA" = x"yes"; then AC_DEFINE(REPLACE_INET_NTOA,1,[Whether inet_ntoa should be replaced]) + LIBREPLACEOBJ="${LIBREPLACEOBJ} inet_ntoa.o" fi AC_CHECK_FUNCS(inet_aton,[],[LIBREPLACEOBJ="${LIBREPLACEOBJ} inet_aton.o"]) -- cgit From 6353e83dc27132a47966302a68b8e4934bce442c Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 8 May 2008 10:32:19 +0200 Subject: libreplace: export LIBREPLACE_NETWORK_OBJS and LIBREPLACE_NETWORK_LIBS vars metze (This used to be commit aa7ef1af746319a3d771decd0ec03dabe8b8ad28) --- source4/lib/replace/libreplace_network.m4 | 35 ++++++++++++++++--------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/replace/libreplace_network.m4 b/source4/lib/replace/libreplace_network.m4 index 6d10313e47..f1657d9f79 100644 --- a/source4/lib/replace/libreplace_network.m4 +++ b/source4/lib/replace/libreplace_network.m4 @@ -2,6 +2,9 @@ AC_DEFUN_ONCE(AC_LIBREPLACE_NETWORK_CHECKS, [ echo "LIBREPLACE_NETWORK_CHECKS: START" +LIBREPLACE_NETWORK_OBJS="" +LIBREPLACE_NETWORK_LIBS="" + 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) @@ -98,7 +101,13 @@ if test x"$ac_cv_func_gethostbyname" = x"no"; then fi fi -AC_CHECK_FUNCS(socketpair,[],[LIBREPLACEOBJ="${LIBREPLACEOBJ} socketpair.o"]) +# The following tests need LIBS="${LIBREPLACE_NETWORK_LIBS}" +old_LIBS=$LIBS +LIBS="${LIBREPLACE_NETWORK_LIBS}" +SAVE_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS -I$libreplacedir" + +AC_CHECK_FUNCS(socketpair,[],[LIBREPLACE_NETWORK_OBJS="${LIBREPLACE_NETWORK_OBJS} socketpair.o"]) AC_CACHE_CHECK([for broken inet_ntoa],libreplace_cv_REPLACE_INET_NTOA,[ AC_TRY_RUN([ @@ -118,14 +127,14 @@ exit(1);}], AC_CHECK_FUNCS(inet_ntoa,[],[libreplace_cv_REPLACE_INET_NTOA=yes]) if test x"$libreplace_cv_REPLACE_INET_NTOA" = x"yes"; then AC_DEFINE(REPLACE_INET_NTOA,1,[Whether inet_ntoa should be replaced]) - LIBREPLACEOBJ="${LIBREPLACEOBJ} inet_ntoa.o" + LIBREPLACE_NETWORK_OBJS="${LIBREPLACE_NETWORK_OBJS} inet_ntoa.o" fi -AC_CHECK_FUNCS(inet_aton,[],[LIBREPLACEOBJ="${LIBREPLACEOBJ} inet_aton.o"]) +AC_CHECK_FUNCS(inet_aton,[],[LIBREPLACE_NETWORK_OBJS="${LIBREPLACE_NETWORK_OBJS} inet_aton.o"]) -AC_CHECK_FUNCS(inet_ntop,[],[LIBREPLACEOBJ="${LIBREPLACEOBJ} inet_ntop.o"]) +AC_CHECK_FUNCS(inet_ntop,[],[LIBREPLACE_NETWORK_OBJS="${LIBREPLACE_NETWORK_OBJS} inet_ntop.o"]) -AC_CHECK_FUNCS(inet_pton,[],[LIBREPLACEOBJ="${LIBREPLACEOBJ} inet_pton.o"]) +AC_CHECK_FUNCS(inet_pton,[],[LIBREPLACE_NETWORK_OBJS="${LIBREPLACE_NETWORK_OBJS} inet_pton.o"]) dnl test for getaddrinfo/getnameinfo AC_CACHE_CHECK([for getaddrinfo],libreplace_cv_HAVE_GETADDRINFO,[ @@ -157,7 +166,7 @@ if test x"$libreplace_cv_HAVE_GETADDRINFO" = x"yes"; then AC_DEFINE(HAVE_FREEADDRINFO,1,[Whether the system has freeaddrinfo]) AC_DEFINE(HAVE_GAI_STRERROR,1,[Whether the system has gai_strerror]) else - LIBREPLACEOBJ="${LIBREPLACEOBJ} getaddrinfo.o" + LIBREPLACE_NETWORK_OBJS="${LIBREPLACE_NETWORK_OBJS} getaddrinfo.o" fi AC_CHECK_HEADERS([ifaddrs.h]) @@ -193,16 +202,6 @@ if test x"$libreplace_cv_HAVE_GETIFADDRS" = x"yes"; then AC_DEFINE(HAVE_STRUCT_IFADDRS,1,[Whether struct ifaddrs is available]) fi -################## -# look for a method of finding the list of network interfaces -# -# This tests need LIBS="${LIBREPLACE_NETWORK_LIBS}" -# -old_LIBS=$LIBS -LIBS="${LIBREPLACE_NETWORK_LIBS}" -SAVE_CPPFLAGS="$CPPFLAGS" -CPPFLAGS="$CPPFLAGS -I$libreplacedir" -iface=no; ################## # look for a method of finding the list of network interfaces iface=no; @@ -222,7 +221,7 @@ AC_TRY_RUN([ if test x"$libreplace_cv_HAVE_IFACE_GETIFADDRS" = x"yes"; then iface=yes;AC_DEFINE(HAVE_IFACE_GETIFADDRS,1,[Whether iface getifaddrs is available]) else - LIBREPLACEOBJ="${LIBREPLACEOBJ} getifaddrs.o" + LIBREPLACE_NETWORK_OBJS="${LIBREPLACE_NETWORK_OBJS} getifaddrs.o" fi @@ -288,5 +287,7 @@ fi LIBS=$old_LIBS CPPFLAGS="$SAVE_CPPFLAGS" +LIBREPLACEOBJ="${LIBREPLACEOBJ} ${LIBREPLACE_NETWORK_OBJS}" + echo "LIBREPLACE_NETWORK_CHECKS: END" ]) dnl end AC_LIBREPLACE_NETWORK_CHECKS -- cgit From dd01174d092eec9bb3bb6b680786f8b9f3b4668f Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 8 May 2008 10:39:41 +0200 Subject: libreplace: make sure system/network.h is only used when AC_LIBREPLACE_NETWORK_CHECKS was used metze (This used to be commit 3fddd36e119f73a5021370450f9687ef9d252bab) --- source4/lib/replace/libreplace_network.m4 | 1 + source4/lib/replace/system/network.h | 4 ++++ 2 files changed, 5 insertions(+) (limited to 'source4/lib') diff --git a/source4/lib/replace/libreplace_network.m4 b/source4/lib/replace/libreplace_network.m4 index f1657d9f79..56c603a155 100644 --- a/source4/lib/replace/libreplace_network.m4 +++ b/source4/lib/replace/libreplace_network.m4 @@ -2,6 +2,7 @@ AC_DEFUN_ONCE(AC_LIBREPLACE_NETWORK_CHECKS, [ echo "LIBREPLACE_NETWORK_CHECKS: START" +AC_DEFINE(LIBREPLACE_NETWORK_CHECKS, 1, [LIBREPLACE_NETWORK_CHECKS were used]) LIBREPLACE_NETWORK_OBJS="" LIBREPLACE_NETWORK_LIBS="" diff --git a/source4/lib/replace/system/network.h b/source4/lib/replace/system/network.h index a5fb813aa1..077892a54e 100644 --- a/source4/lib/replace/system/network.h +++ b/source4/lib/replace/system/network.h @@ -27,6 +27,10 @@ */ +#ifndef LIBREPLACE_NETWORK_CHECKS +#error "AC_LIBREPLACE_NETWORK_CHECKS missing in configure" +#endif + #ifdef HAVE_SYS_SOCKET_H #include #endif -- cgit From 0e4ae88d3856869a5bb327ed26e155f22bdffc09 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 8 May 2008 11:01:09 +0200 Subject: libreplace: try to fix the build on HP-UX which has if_nametoindex() in -lipv6 metze (This used to be commit da2179ee5d5b6094ab63a9d9d6a8d59893937087) --- source4/lib/replace/libreplace_network.m4 | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'source4/lib') diff --git a/source4/lib/replace/libreplace_network.m4 b/source4/lib/replace/libreplace_network.m4 index 56c603a155..5ab71f160a 100644 --- a/source4/lib/replace/libreplace_network.m4 +++ b/source4/lib/replace/libreplace_network.m4 @@ -102,6 +102,19 @@ if test x"$ac_cv_func_gethostbyname" = x"no"; then fi fi +dnl HP-UX has if_nametoindex in -lipv6 +AC_CHECK_FUNCS(if_nametoindex) +if test x"$ac_cv_func_if_nametoindex" = x"no"; then + AC_CHECK_LIB_EXT(ipv6, LIBREPLACE_NETWORK_LIBS, if_nametoindex) + dnl We can't just call AC_CHECK_FUNCS(if_nametoindex) here, + dnl because the value has been cached. + if test x"$ac_cv_lib_ext_ipv6_if_nametoindex" = x"yes" + then + AC_DEFINE(HAVE_IF_NAMETOINDEX, 1, + [Whether the system has if_nametoindex()]) + fi +fi + # The following tests need LIBS="${LIBREPLACE_NETWORK_LIBS}" old_LIBS=$LIBS LIBS="${LIBREPLACE_NETWORK_LIBS}" -- cgit From 136f369b23946698c9fcfd217444ddc0614cde85 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Thu, 24 Apr 2008 17:28:30 -0400 Subject: Make it possible to build libevents standalone. (This used to be commit 10415bb738d51afdebbfeae976923e086805ae84) --- source4/lib/events/Makefile.in | 66 ++++++++++++++++++ source4/lib/events/autogen.sh | 17 +++++ source4/lib/events/config.mk | 11 ++- source4/lib/events/configure.ac | 35 ++++++++++ source4/lib/events/events.c | 14 ++-- source4/lib/events/events.i | 2 +- source4/lib/events/events.mk | 59 ++++++++++++++++ source4/lib/events/events.pc.in | 11 +++ source4/lib/events/events_epoll.c | 15 ++-- source4/lib/events/events_select.c | 13 +++- source4/lib/events/events_signal.c | 13 ++-- source4/lib/events/events_standard.c | 11 ++- source4/lib/events/events_timed.c | 11 ++- source4/lib/events/events_util.c | 129 +++++++++++++++++++++++++++++++++++ source4/lib/events/events_util.h | 123 +++++++++++++++++++++++++++++++++ source4/lib/events/events_wrap.c | 2 +- source4/lib/events/libevents.m4 | 21 +++++- 17 files changed, 527 insertions(+), 26 deletions(-) create mode 100644 source4/lib/events/Makefile.in create mode 100755 source4/lib/events/autogen.sh create mode 100644 source4/lib/events/configure.ac create mode 100644 source4/lib/events/events.mk create mode 100644 source4/lib/events/events.pc.in create mode 100644 source4/lib/events/events_util.c create mode 100644 source4/lib/events/events_util.h (limited to 'source4/lib') diff --git a/source4/lib/events/Makefile.in b/source4/lib/events/Makefile.in new file mode 100644 index 0000000000..0a0df9bef9 --- /dev/null +++ b/source4/lib/events/Makefile.in @@ -0,0 +1,66 @@ +#!gmake +# +# Makefile for tdb directory +# + +CC = @CC@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +includedir = @includedir@ +libdir = @libdir@ +VPATH = @srcdir@:@tallocdir@:@libreplacedir@ +srcdir = @srcdir@ +builddir = @builddir@ +CPPFLAGS = @CPPFLAGS@ -I$(srcdir)/include -Iinclude -I. +LDFLAGS = @LDFLAGS@ +EXEEXT = @EXEEXT@ +SHLD = @SHLD@ +SHLD_FLAGS = @SHLD_FLAGS@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PICFLAG = @PICFLAG@ +SHLIBEXT = @SHLIBEXT@ +SWIG = swig +PYTHON = @PYTHON@ +PYTHON_CONFIG = @PYTHON_CONFIG@ +PYTHON_BUILD_TARGET = @PYTHON_BUILD_TARGET@ +PYTHON_INSTALL_TARGET = @PYTHON_INSTALL_TARGET@ +PYTHON_CHECK_TARGET = @PYTHON_CHECK_TARGET@ +LIB_PATH_VAR = @LIB_PATH_VAR@ +eventsdir = @eventsdir@ +tallocdir = @tallocdir@ + +TALLOC_LIBS = @TALLOC_LIBS@ +TALLOC_CFLAGS = @TALLOC_CFLAGS@ +TALLOC_OBJ = @TALLOC_OBJ@ + +CFLAGS = $(CPPFLAGS) $(TALLOC_CFLAGS) @CFLAGS@ + +EVENTS_OBJ = @EVENTS_OBJ@ $(TALLOC_OBJ) @LIBREPLACEOBJ@ + +default: all + +include $(eventsdir)/events.mk +include $(eventsdir)/rules.mk + +all:: showflags dirs $(PROGS) $(LIBEVENTS_SOLIB) libevents.a $(PYTHON_BUILD_TARGET) + +install:: all +$(LIBEVENTS_SOLIB): $(EVENTS_OBJ) + $(SHLD) $(SHLD_FLAGS) -o $@ $(EVENTS_OBJ) $(TALLOC_LIBS) @SONAMEFLAG@$(LIBEVENTS_SONAME) + +check: test + +test:: $(PYTHON_CHECK_TARGET) +installcheck:: test install + +clean:: + rm -f *.o *.a */*.o + rm -f $(TALLOC_OBJ) + +distclean:: clean + rm -f config.log config.status include/config.h config.cache + rm -f Makefile + +realdistclean:: distclean + rm -f configure include/config.h.in diff --git a/source4/lib/events/autogen.sh b/source4/lib/events/autogen.sh new file mode 100755 index 0000000000..b13a4b685d --- /dev/null +++ b/source4/lib/events/autogen.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +rm -rf autom4te.cache +rm -f configure config.h.in + +IPATHS="-I libreplace -I lib/replace -I ../libreplace -I ../replace" +IPATHS="$IPATHS -I lib/talloc -I talloc -I ../talloc" +autoconf $IPATHS || exit 1 +autoheader $IPATHS || exit 1 + +rm -rf autom4te.cache + +swig -O -Wall -python -keyword events.i # Ignore errors for now + +echo "Now run ./configure and then make." +exit 0 + diff --git a/source4/lib/events/config.mk b/source4/lib/events/config.mk index 058ce7f793..34c24f76f5 100644 --- a/source4/lib/events/config.mk +++ b/source4/lib/events/config.mk @@ -1,3 +1,13 @@ +################################################ +# Start SUBSYSTEM LIBEVENTS +[LIBRARY::LIBEVENTS] +PUBLIC_DEPENDENCIES = LIBTALLOC +OUTPUT_TYPE = STATIC_LIBRARY +CFLAGS = -Ilib/events +# +# End SUBSYSTEM LIBEVENTS +################################################ + ############################## [MODULE::EVENTS_AIO] PRIVATE_DEPENDENCIES = LIBAIO_LINUX @@ -34,7 +44,6 @@ EVENTS_STANDARD_OBJ_FILES = lib/events/events_standard.o ############################## # Start SUBSYSTEM LIBEVENTS [SUBSYSTEM::LIBEVENTS] -PUBLIC_DEPENDENCIES = LIBTALLOC LIBSAMBA-UTIL # End SUBSYSTEM LIBEVENTS ############################## diff --git a/source4/lib/events/configure.ac b/source4/lib/events/configure.ac new file mode 100644 index 0000000000..4eb3575aac --- /dev/null +++ b/source4/lib/events/configure.ac @@ -0,0 +1,35 @@ +AC_PREREQ(2.50) +AC_DEFUN([SMB_MODULE_DEFAULT], [echo -n ""]) +AC_DEFUN([SMB_LIBRARY_ENABLE], [echo -n ""]) +AC_DEFUN([SMB_ENABLE], [echo -n ""]) +AC_INIT(events, 1.0.0) +AC_CONFIG_SRCDIR([events.c]) +AC_CONFIG_HEADER(config.h) +AC_LIBREPLACE_ALL_CHECKS +AC_LIBREPLACE_NETWORK_CHECKS + +m4_include(libtalloc.m4) + +AC_LD_EXPORT_DYNAMIC +AC_LD_SONAMEFLAG +AC_LD_PICFLAG +AC_LD_SHLIBEXT +AC_LIBREPLACE_SHLD +AC_LIBREPLACE_SHLD_FLAGS +AC_LIBREPLACE_RUNTIME_LIB_PATH_VAR +m4_include(libevents.m4) +AC_PATH_PROGS([PYTHON_CONFIG], [python2.6-config python2.5-config python2.4-config python-config]) +AC_PATH_PROGS([PYTHON], [python2.6 python2.5 python2.4 python]) + +PYTHON_BUILD_TARGET="build-python" +PYTHON_INSTALL_TARGET="install-python" +PYTHON_CHECK_TARGET="check-python" +AC_SUBST(PYTHON_BUILD_TARGET) +AC_SUBST(PYTHON_INSTALL_TARGET) +AC_SUBST(PYTHON_CHECK_TARGET) +if test -z "$PYTHON_CONFIG"; then + PYTHON_BUILD_TARGET="" + PYTHON_INSTALL_TARGET="" + PYTHON_CHECK_TARGET="" +fi +AC_OUTPUT(Makefile events.pc) diff --git a/source4/lib/events/events.c b/source4/lib/events/events.c index 6f45db512a..ccc62b4c83 100644 --- a/source4/lib/events/events.c +++ b/source4/lib/events/events.c @@ -52,12 +52,16 @@ forever. */ - +#if _SAMBA_BUILD_ #include "includes.h" -#include "lib/events/events.h" -#include "lib/events/events_internal.h" #include "lib/util/dlinklist.h" #include "param/param.h" +#else +#include "replace.h" +#include "events_util.h" +#endif +#include "events.h" +#include "events_internal.h" struct event_ops_list { struct event_ops_list *next, *prev; @@ -204,6 +208,8 @@ struct event_context *event_context_init_byname(TALLOC_CTX *mem_ctx, const char */ struct event_context *event_context_init(TALLOC_CTX *mem_ctx) { + DEBUG(0, ("New event context requested. Parent: [%s:%p]\n", + mem_ctx?talloc_get_name(mem_ctx):"NULL", mem_ctx)); return event_context_init_byname(mem_ctx, NULL); } @@ -283,7 +289,7 @@ struct signal_event *event_add_signal(struct event_context *ev, TALLOC_CTX *mem_ /* do a single event loop using the events defined in ev */ -_PUBLIC_ int event_loop_once(struct event_context *ev) +int event_loop_once(struct event_context *ev) { return ev->ops->loop_once(ev); } diff --git a/source4/lib/events/events.i b/source4/lib/events/events.i index 263605b176..c16d482efc 100644 --- a/source4/lib/events/events.i +++ b/source4/lib/events/events.i @@ -21,7 +21,7 @@ %import "../talloc/talloc.i"; %{ -#include "lib/events/events.h" +#include "events.h" typedef struct event_context event; %} diff --git a/source4/lib/events/events.mk b/source4/lib/events/events.mk new file mode 100644 index 0000000000..64d3fcb9fd --- /dev/null +++ b/source4/lib/events/events.mk @@ -0,0 +1,59 @@ +dirs:: + @mkdir -p lib + +LIBEVENTS_SONAME = libevents.$(SHLIBEXT).0 +LIBEVENTS_SOLIB = libevents.$(SHLIBEXT).$(PACKAGE_VERSION) + +LIBEVENTS = libevents.a + +clean:: + rm -f $(LIBEVENTS_SONAME) $(LIBEVENTS_SOLIB) libevents.a libevents.$(SHLIBEXT) + rm -f events.pc + +build-python:: _libevents.$(SHLIBEXT) + +events_wrap.o: $(eventsdir)/events_wrap.c + $(CC) $(PICFLAG) -c $(eventsdir)/events_wrap.c $(CFLAGS) `$(PYTHON_CONFIG) --cflags` + +_libevents.$(SHLIBEXT): libevents.$(SHLIBEXT) events_wrap.o + $(SHLD) $(SHLD_FLAGS) -o $@ events_wrap.o -L. -levents `$(PYTHON_CONFIG) --libs` + +install:: installdirs installbin installheaders installlibs \ + $(PYTHON_INSTALL_TARGET) + +install-python:: build-python + mkdir -p $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(0, prefix='$(prefix)')"` \ + $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(1, prefix='$(prefix)')"` + cp $(eventsdir)/events.py $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(0, prefix='$(prefix)')"` + cp _libevents.$(SHLIBEXT) $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(1, prefix='$(prefix)')"` + +check-python:: build-python + $(LIB_PATH_VAR)=. PYTHONPATH=".:$(eventsdir)" $(PYTHON) $(eventsdir)/python/tests/simple.py + +install-swig:: + mkdir -p $(DESTDIR)`$(SWIG) -swiglib` + cp events.i $(DESTDIR)`$(SWIG) -swiglib` + +clean:: + rm -f _libevents.$(SHLIBEXT) + +installdirs:: + mkdir -p $(DESTDIR)$(includedir) + mkdir -p $(DESTDIR)$(libdir) + mkdir -p $(DESTDIR)$(libdir)/pkgconfig + +installheaders:: installdirs + cp $(srcdir)/events.h $(DESTDIR)$(includedir) + +installlibs:: all installdirs + cp events.pc $(DESTDIR)$(libdir)/pkgconfig + cp libevents.a $(LIBEVENTS_SOLIB) $(DESTDIR)$(libdir) + +libevents.a: $(EVENTS_OBJ) + ar -rv libevents.a $(EVENTS_OBJ) + +libevents.$(SHLIBEXT): $(LIBEVENTS_SOLIB) + ln -fs $< $@ + +$(LIBEVENTS_SONAME): $(LIBEVENTS_SOLIB) + ln -fs $< $@ diff --git a/source4/lib/events/events.pc.in b/source4/lib/events/events.pc.in new file mode 100644 index 0000000000..4a4c012d73 --- /dev/null +++ b/source4/lib/events/events.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: events +Description: An event system library +Version: @PACKAGE_VERSION@ +Libs: -L${libdir} -levents +Cflags: -I${includedir} +URL: http://samba.org/ diff --git a/source4/lib/events/events_epoll.c b/source4/lib/events/events_epoll.c index 109027eb1a..07e66154fc 100644 --- a/source4/lib/events/events_epoll.c +++ b/source4/lib/events/events_epoll.c @@ -20,12 +20,17 @@ along with this program. If not, see . */ +#if _SAMBA_BUILD_ #include "includes.h" +#include "lib/util/dlinklist.h" +#else +#include "replace.h" +#include "events_util.h" +#endif #include "system/filesys.h" #include "system/network.h" -#include "lib/util/dlinklist.h" -#include "lib/events/events.h" -#include "lib/events/events_internal.h" +#include "events.h" +#include "events_internal.h" #include struct epoll_event_context { @@ -56,9 +61,11 @@ struct epoll_event_context { called when a epoll call fails, and we should fallback to using select */ -_NORETURN_ static void epoll_panic(struct epoll_event_context *epoll_ev, const char *reason) +static void epoll_panic(struct epoll_event_context *epoll_ev, const char *reason) { +#if _SAMBA_BUILD_ DEBUG(0,("%s (%s) - calling abort()\n", reason, strerror(errno))); +#endif abort(); } diff --git a/source4/lib/events/events_select.c b/source4/lib/events/events_select.c index f4b7e4e5eb..16fff71e4a 100644 --- a/source4/lib/events/events_select.c +++ b/source4/lib/events/events_select.c @@ -23,12 +23,17 @@ */ +#if _SAMBA_BUILD_ #include "includes.h" +#include "lib/util/dlinklist.h" +#else +#include "replace.h" +#include "events_util.h" +#endif #include "system/filesys.h" #include "system/select.h" -#include "lib/util/dlinklist.h" -#include "lib/events/events.h" -#include "lib/events/events_internal.h" +#include "events.h" +#include "events_internal.h" struct select_event_context { /* a pointer back to the generic event_context */ @@ -216,7 +221,9 @@ static int select_event_loop_select(struct select_event_context *select_ev, stru made readable and that should have removed the event, so this must be a bug. This is a fatal error. */ +#if _SAMBA_BUILD_ DEBUG(0,("ERROR: EBADF on select_event_loop_once\n")); +#endif select_ev->exit_code = EBADF; return -1; } diff --git a/source4/lib/events/events_signal.c b/source4/lib/events/events_signal.c index c0771cbe01..7128612fb0 100644 --- a/source4/lib/events/events_signal.c +++ b/source4/lib/events/events_signal.c @@ -19,13 +19,18 @@ along with this program. If not, see . */ +#if _SAMBA_BUILD_ #include "includes.h" +#include "lib/util/dlinklist.h" +#else +#include +#include "replace.h" +#include "events_util.h" +#endif #include "system/filesys.h" #include "system/select.h" -#include "system/wait.h" -#include "lib/util/dlinklist.h" -#include "lib/events/events.h" -#include "lib/events/events_internal.h" +#include "events.h" +#include "events_internal.h" #define NUM_SIGNALS 64 diff --git a/source4/lib/events/events_standard.c b/source4/lib/events/events_standard.c index 7b945b154d..4e41c42206 100644 --- a/source4/lib/events/events_standard.c +++ b/source4/lib/events/events_standard.c @@ -27,13 +27,18 @@ at runtime we fallback to select() */ +#if _SAMBA_BUILD_ #include "includes.h" +#include "lib/util/dlinklist.h" +#else +#include "replace.h" +#include "events_util.h" +#endif #include "system/filesys.h" #include "system/network.h" #include "system/select.h" /* needed for HAVE_EVENTS_EPOLL */ -#include "lib/util/dlinklist.h" -#include "lib/events/events.h" -#include "lib/events/events_internal.h" +#include "events.h" +#include "events_internal.h" struct std_event_context { /* a pointer back to the generic event_context */ diff --git a/source4/lib/events/events_timed.c b/source4/lib/events/events_timed.c index 389c2cbbb7..79e4cde795 100644 --- a/source4/lib/events/events_timed.c +++ b/source4/lib/events/events_timed.c @@ -20,12 +20,17 @@ along with this program. If not, see . */ +#if _SAMBA_BUILD_ #include "includes.h" +#include "lib/util/dlinklist.h" +#else +#include "replace.h" +#include "events_util.h" +#endif #include "system/filesys.h" #include "system/select.h" -#include "lib/util/dlinklist.h" -#include "lib/events/events.h" -#include "lib/events/events_internal.h" +#include "events.h" +#include "events_internal.h" /* destroy a timed event diff --git a/source4/lib/events/events_util.c b/source4/lib/events/events_util.c new file mode 100644 index 0000000000..74e11473f3 --- /dev/null +++ b/source4/lib/events/events_util.c @@ -0,0 +1,129 @@ +/* + Unix SMB/CIFS implementation. + + Copyright (C) Andrew Tridgell 2005 + Copyright (C) Jelmer Vernooij 2005 + + 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 . +*/ + +#include "replace.h" +#include "talloc.h" + +/** + return the number of elements in a string list +*/ +static size_t str_list_length(const char **list) +{ + size_t ret; + for (ret=0;list && list[ret];ret++) /* noop */ ; + return ret; +} + +/** + add an entry to a string list +*/ +const char **str_list_add(const char **list, const char *s) +{ + size_t len = str_list_length(list); + const char **ret; + + ret = talloc_realloc(NULL, list, const char *, len+2); + if (ret == NULL) return NULL; + + ret[len] = talloc_strdup(ret, s); + if (ret[len] == NULL) return NULL; + + ret[len+1] = NULL; + + return ret; +} + +/** + compare two timeval structures. + Return -1 if tv1 < tv2 + Return 0 if tv1 == tv2 + Return 1 if tv1 > tv2 +*/ +static int timeval_compare(const struct timeval *tv1, const struct timeval *tv2) +{ + if (tv1->tv_sec > tv2->tv_sec) return 1; + if (tv1->tv_sec < tv2->tv_sec) return -1; + if (tv1->tv_usec > tv2->tv_usec) return 1; + if (tv1->tv_usec < tv2->tv_usec) return -1; + return 0; +} + +/** + return a zero timeval +*/ +struct timeval timeval_zero(void) +{ + struct timeval tv; + tv.tv_sec = 0; + tv.tv_usec = 0; + return tv; +} + +/** + return true if a timeval is zero +*/ +bool timeval_is_zero(const struct timeval *tv) +{ + return tv->tv_sec == 0 && tv->tv_usec == 0; +} + +/** + return a timeval for the current time +*/ +struct timeval timeval_current(void) +{ + struct timeval tv; + GetTimeOfDay(&tv); + return tv; +} + +/** + return a timeval struct with the given elements +*/ +struct timeval timeval_set(uint32_t secs, uint32_t usecs) +{ + struct timeval tv; + tv.tv_sec = secs; + tv.tv_usec = usecs; + return tv; +} + +/** + return the difference between two timevals as a timeval + if tv1 comes after tv2, then return a zero timeval + (this is *tv2 - *tv1) +*/ +struct timeval timeval_until(const struct timeval *tv1, + const struct timeval *tv2) +{ + struct timeval t; + if (timeval_compare(tv1, tv2) >= 0) { + return timeval_zero(); + } + t.tv_sec = tv2->tv_sec - tv1->tv_sec; + if (tv1->tv_usec > tv2->tv_usec) { + t.tv_sec--; + t.tv_usec = 1000000 - (tv1->tv_usec - tv2->tv_usec); + } else { + t.tv_usec = tv2->tv_usec - tv1->tv_usec; + } + return t; +} + diff --git a/source4/lib/events/events_util.h b/source4/lib/events/events_util.h new file mode 100644 index 0000000000..401df891a5 --- /dev/null +++ b/source4/lib/events/events_util.h @@ -0,0 +1,123 @@ +/* + Unix SMB/CIFS implementation. + + Copyright (C) Andrew Tridgell 1998-2005 + Copyright (C) Jelmer Vernooij 2005 + + 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 . +*/ + +/* To use these macros you must have a structure containing a next and + prev pointer */ + +#ifndef _DLINKLIST_H +#define _DLINKLIST_H + + +/* hook into the front of the list */ +#define DLIST_ADD(list, p) \ +do { \ + if (!(list)) { \ + (list) = (p); \ + (p)->next = (p)->prev = NULL; \ + } else { \ + (list)->prev = (p); \ + (p)->next = (list); \ + (p)->prev = NULL; \ + (list) = (p); \ + }\ +} while (0) + +/* remove an element from a list - element doesn't have to be in list. */ +#define DLIST_REMOVE(list, p) \ +do { \ + if ((p) == (list)) { \ + (list) = (p)->next; \ + if (list) (list)->prev = NULL; \ + } else { \ + if ((p)->prev) (p)->prev->next = (p)->next; \ + if ((p)->next) (p)->next->prev = (p)->prev; \ + } \ + if ((p) != (list)) (p)->next = (p)->prev = NULL; \ +} while (0) + +/* promote an element to the top of the list */ +#define DLIST_PROMOTE(list, p) \ +do { \ + DLIST_REMOVE(list, p); \ + DLIST_ADD(list, p); \ +} while (0) + +/* hook into the end of the list - needs a tmp pointer */ +#define DLIST_ADD_END(list, p, type) \ +do { \ + if (!(list)) { \ + (list) = (p); \ + (p)->next = (p)->prev = NULL; \ + } else { \ + type tmp; \ + for (tmp = (list); tmp->next; tmp = tmp->next) ; \ + tmp->next = (p); \ + (p)->next = NULL; \ + (p)->prev = tmp; \ + } \ +} while (0) + +/* insert 'p' after the given element 'el' in a list. If el is NULL then + this is the same as a DLIST_ADD() */ +#define DLIST_ADD_AFTER(list, p, el) \ +do { \ + if (!(list) || !(el)) { \ + DLIST_ADD(list, p); \ + } else { \ + p->prev = el; \ + p->next = el->next; \ + el->next = p; \ + if (p->next) p->next->prev = p; \ + }\ +} while (0) + +/* demote an element to the end of the list, needs a tmp pointer */ +#define DLIST_DEMOTE(list, p, tmp) \ +do { \ + DLIST_REMOVE(list, p); \ + DLIST_ADD_END(list, p, tmp); \ +} while (0) + +/* concatenate two lists - putting all elements of the 2nd list at the + end of the first list */ +#define DLIST_CONCATENATE(list1, list2, type) \ +do { \ + if (!(list1)) { \ + (list1) = (list2); \ + } else { \ + type tmp; \ + for (tmp = (list1); tmp->next; tmp = tmp->next) ; \ + tmp->next = (list2); \ + if (list2) { \ + (list2)->prev = tmp; \ + } \ + } \ +} while (0) + +#endif /* _DLINKLIST_H */ + +const char **str_list_add(const char **list, const char *s); +struct timeval timeval_zero(void); +bool timeval_is_zero(const struct timeval *tv); +struct timeval timeval_current(void); +struct timeval timeval_set(uint32_t secs, uint32_t usecs); +struct timeval timeval_until(const struct timeval *tv1, + const struct timeval *tv2); + diff --git a/source4/lib/events/events_wrap.c b/source4/lib/events/events_wrap.c index b220d320cf..9dbbb08734 100644 --- a/source4/lib/events/events_wrap.c +++ b/source4/lib/events/events_wrap.c @@ -2501,7 +2501,7 @@ static swig_module_info swig_module = {swig_types, 4, 0, 0, 0, 0}; #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) -#include "lib/events/events.h" +#include "events.h" typedef struct event_context event; SWIGINTERN event *new_event(TALLOC_CTX *mem_ctx){ return event_context_init(mem_ctx); } diff --git a/source4/lib/events/libevents.m4 b/source4/lib/events/libevents.m4 index 99a47dcc54..483ab861fb 100644 --- a/source4/lib/events/libevents.m4 +++ b/source4/lib/events/libevents.m4 @@ -1,11 +1,28 @@ -EVENTS_OBJ="lib/events/events.o lib/events/events_select.o lib/events/events_signal.o lib/events/events_timed.o lib/events/events_standard.o" +dnl find the events sources. This is meant to work both for +dnl standalone builds, and builds of packages using libevents +eventsdir="" +eventspaths="$srcdir $srcdir/lib/events $srcdir/events $srcdir/../events" +for d in $eventspaths; do + if test -f "$d/events.c"; then + eventsdir="$d" + AC_SUBST(eventsdir) + break; + fi +done +if test x"$eventsdir" = "x"; then + AC_MSG_ERROR([cannot find libevents source in $eventspaths]) +fi + +EVENTS_OBJ="events.o events_select.o events_signal.o events_timed.o events_standard.o events_util.o" +AC_SUBST(LIBREPLACEOBJ) AC_CHECK_HEADERS(sys/epoll.h) AC_CHECK_FUNCS(epoll_create) if test x"$ac_cv_header_sys_epoll_h" = x"yes" -a x"$ac_cv_func_epoll_create" = x"yes"; then - EVENTS_OBJ="$EVENTS_OBJ lib/events/events_epoll.o" + EVENTS_OBJ="$EVENTS_OBJ events_epoll.o" AC_DEFINE(HAVE_EVENTS_EPOLL, 1, [Whether epoll available]) fi AC_SUBST(EVENTS_OBJ) + -- cgit From 3b6042e192f7196b73ec4f3ef948e26cff5f4055 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 14 May 2008 15:19:43 +0200 Subject: lib/events: system/network.h isn't needed metze (This used to be commit 59faf3bf670140784d5698bbdc8b86afe8e188ec) --- source4/lib/events/configure.ac | 1 - source4/lib/events/events_aio.c | 1 - source4/lib/events/events_epoll.c | 1 - source4/lib/events/events_standard.c | 1 - 4 files changed, 4 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/events/configure.ac b/source4/lib/events/configure.ac index 4eb3575aac..afae82d7c0 100644 --- a/source4/lib/events/configure.ac +++ b/source4/lib/events/configure.ac @@ -6,7 +6,6 @@ AC_INIT(events, 1.0.0) AC_CONFIG_SRCDIR([events.c]) AC_CONFIG_HEADER(config.h) AC_LIBREPLACE_ALL_CHECKS -AC_LIBREPLACE_NETWORK_CHECKS m4_include(libtalloc.m4) diff --git a/source4/lib/events/events_aio.c b/source4/lib/events/events_aio.c index a0417384e0..b1343efd14 100644 --- a/source4/lib/events/events_aio.c +++ b/source4/lib/events/events_aio.c @@ -32,7 +32,6 @@ #include "includes.h" #include "system/filesys.h" -#include "system/network.h" #include "lib/util/dlinklist.h" #include "lib/events/events.h" #include "lib/events/events_internal.h" diff --git a/source4/lib/events/events_epoll.c b/source4/lib/events/events_epoll.c index 07e66154fc..7316f0f31f 100644 --- a/source4/lib/events/events_epoll.c +++ b/source4/lib/events/events_epoll.c @@ -28,7 +28,6 @@ #include "events_util.h" #endif #include "system/filesys.h" -#include "system/network.h" #include "events.h" #include "events_internal.h" #include diff --git a/source4/lib/events/events_standard.c b/source4/lib/events/events_standard.c index 4e41c42206..017ebc02f2 100644 --- a/source4/lib/events/events_standard.c +++ b/source4/lib/events/events_standard.c @@ -35,7 +35,6 @@ #include "events_util.h" #endif #include "system/filesys.h" -#include "system/network.h" #include "system/select.h" /* needed for HAVE_EVENTS_EPOLL */ #include "events.h" #include "events_internal.h" -- cgit From d5d9476c351d49882efcf3faf805ffaabd2e0df4 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 14 May 2008 17:28:42 +0200 Subject: Revert "lib/events: system/network.h isn't needed" Somehow this breaks 'make test'... This reverts commit 59faf3bf670140784d5698bbdc8b86afe8e188ec. metze (This used to be commit ece9df0875a32f76af5af913b6a6cdd8eacf0280) --- source4/lib/events/configure.ac | 1 + source4/lib/events/events_aio.c | 1 + source4/lib/events/events_epoll.c | 1 + source4/lib/events/events_standard.c | 1 + 4 files changed, 4 insertions(+) (limited to 'source4/lib') diff --git a/source4/lib/events/configure.ac b/source4/lib/events/configure.ac index afae82d7c0..4eb3575aac 100644 --- a/source4/lib/events/configure.ac +++ b/source4/lib/events/configure.ac @@ -6,6 +6,7 @@ AC_INIT(events, 1.0.0) AC_CONFIG_SRCDIR([events.c]) AC_CONFIG_HEADER(config.h) AC_LIBREPLACE_ALL_CHECKS +AC_LIBREPLACE_NETWORK_CHECKS m4_include(libtalloc.m4) diff --git a/source4/lib/events/events_aio.c b/source4/lib/events/events_aio.c index b1343efd14..a0417384e0 100644 --- a/source4/lib/events/events_aio.c +++ b/source4/lib/events/events_aio.c @@ -32,6 +32,7 @@ #include "includes.h" #include "system/filesys.h" +#include "system/network.h" #include "lib/util/dlinklist.h" #include "lib/events/events.h" #include "lib/events/events_internal.h" diff --git a/source4/lib/events/events_epoll.c b/source4/lib/events/events_epoll.c index 7316f0f31f..07e66154fc 100644 --- a/source4/lib/events/events_epoll.c +++ b/source4/lib/events/events_epoll.c @@ -28,6 +28,7 @@ #include "events_util.h" #endif #include "system/filesys.h" +#include "system/network.h" #include "events.h" #include "events_internal.h" #include diff --git a/source4/lib/events/events_standard.c b/source4/lib/events/events_standard.c index 017ebc02f2..4e41c42206 100644 --- a/source4/lib/events/events_standard.c +++ b/source4/lib/events/events_standard.c @@ -35,6 +35,7 @@ #include "events_util.h" #endif #include "system/filesys.h" +#include "system/network.h" #include "system/select.h" /* needed for HAVE_EVENTS_EPOLL */ #include "events.h" #include "events_internal.h" -- cgit From a620882e15c1b33c1eb5a0d4d1a8d8c890cc23df Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 15 May 2008 18:09:56 +0200 Subject: Fix an uninitialized variable warning (This used to be commit b3d024676426000380ad86a2a4b83e7b21478978) --- source4/lib/ldb_wrap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb_wrap.c b/source4/lib/ldb_wrap.c index b564976524..f47d0d5d39 100644 --- a/source4/lib/ldb_wrap.c +++ b/source4/lib/ldb_wrap.c @@ -44,7 +44,7 @@ static void ldb_wrap_debug(void *context, enum ldb_debug_level level, static void ldb_wrap_debug(void *context, enum ldb_debug_level level, const char *fmt, va_list ap) { - int samba_level; + int samba_level = -1; char *s = NULL; switch (level) { case LDB_DEBUG_FATAL: -- cgit From 335813c735153dd3f1bbeb102a876d51c22943c8 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 16 May 2008 12:13:11 +0200 Subject: lib/socket: remove unused configure check for HAVE_WORKING_AF_LOCAL metze (This used to be commit 1c7905cfb4c77edeb24ac612a544e777cf49e184) --- source4/lib/socket/config.m4 | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/socket/config.m4 b/source4/lib/socket/config.m4 index b40002b321..e5ae9ecc77 100644 --- a/source4/lib/socket/config.m4 +++ b/source4/lib/socket/config.m4 @@ -31,16 +31,6 @@ if test x"$samba_cv_unixsocket" = x"yes"; then AC_DEFINE(HAVE_UNIXSOCKET,1,[If we need to build with unixscoket support]) fi -AC_CACHE_CHECK([for AF_LOCAL socket support], samba_cv_HAVE_WORKING_AF_LOCAL, [ -AC_TRY_RUN([#include "${srcdir-.}/build/tests/unixsock.c"], - samba_cv_HAVE_WORKING_AF_LOCAL=yes, - samba_cv_HAVE_WORKING_AF_LOCAL=no, - samba_cv_HAVE_WORKING_AF_LOCAL=cross)]) -if test x"$samba_cv_HAVE_WORKING_AF_LOCAL" != xno -then - AC_DEFINE(HAVE_WORKING_AF_LOCAL, 1, [Define if you have working AF_LOCAL sockets]) -fi - dnl test for ipv6 using the gethostbyname2() function. That should be sufficient dnl for now AC_CHECK_FUNCS(gethostbyname2, have_ipv6=true, have_ipv6=false) -- cgit From a65e5994ad9ecc2a70f24a5080a1c311d22ed2be Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 16 May 2008 12:29:21 +0200 Subject: lib/replace: add checks for HAVE_SOCK_SIN_LEN and HAVE_UNIXSOCKET Moved from the samba specific locations metze (This used to be commit e674128ee2f11596f358ed46104c9d25eb2f754f) --- source4/lib/replace/libreplace_network.m4 | 40 +++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'source4/lib') diff --git a/source4/lib/replace/libreplace_network.m4 b/source4/lib/replace/libreplace_network.m4 index 5ab71f160a..d29c13196d 100644 --- a/source4/lib/replace/libreplace_network.m4 +++ b/source4/lib/replace/libreplace_network.m4 @@ -62,6 +62,46 @@ AC_CHECK_MEMBER(struct sockaddr_storage.__ss_family, fi fi +AC_CACHE_CHECK([for sin_len in sock],libreplace_cv_HAVE_SOCK_SIN_LEN,[ + AC_TRY_COMPILE( + [ +#include +#include +#include + ],[ +struct sockaddr_in sock; sock.sin_len = sizeof(sock); + ],[ + libreplace_cv_HAVE_SOCK_SIN_LEN=yes + ],[ + libreplace_cv_HAVE_SOCK_SIN_LEN=no + ]) +]) +if test x"$libreplace_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then + AC_DEFINE(HAVE_SOCK_SIN_LEN,1,[Whether the sockaddr_in struct has a sin_len property]) +fi + +############################################ +# check for unix domain sockets +AC_CACHE_CHECK([for unix domain sockets],libreplace_cv_HAVE_UNIXSOCKET,[ + AC_TRY_COMPILE([ +#include +#include +#include +#include +#include + ],[ +struct sockaddr_un sunaddr; +sunaddr.sun_family = AF_UNIX; + ],[ + libreplace_cv_HAVE_UNIXSOCKET=yes + ],[ + libreplace_cv_HAVE_UNIXSOCKET=no + ]) +]) +if test x"$libreplace_cv_HAVE_UNIXSOCKET" = x"yes"; then + AC_DEFINE(HAVE_UNIXSOCKET,1,[If we need to build with unixscoket support]) +fi + dnl The following test is roughl taken from the cvs sources. dnl dnl If we can't find connect, try looking in -lsocket, -lnsl, and -linet. -- cgit From c7c9aa7e7a2d941486fb21fd15e57653cc8b14e0 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 16 May 2008 12:30:49 +0200 Subject: lib/socket: remove unused configure checks for HAVE_SOCK_SIN_LEN and HAVE_UNIXSOCKET and rely on libreplace metze (This used to be commit 5de605bb2ef88a1f3e61c64e557c7f069d0f6dad) --- source4/lib/socket/config.m4 | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/socket/config.m4 b/source4/lib/socket/config.m4 index e5ae9ecc77..871c57f97c 100644 --- a/source4/lib/socket/config.m4 +++ b/source4/lib/socket/config.m4 @@ -1,34 +1,12 @@ AC_CHECK_FUNCS(writev) AC_CHECK_FUNCS(readv) -AC_CACHE_CHECK([for sin_len in sock],samba_cv_HAVE_SOCK_SIN_LEN,[ -AC_TRY_COMPILE([#include -#include -#include ], -[struct sockaddr_in sock; sock.sin_len = sizeof(sock);], -samba_cv_HAVE_SOCK_SIN_LEN=yes,samba_cv_HAVE_SOCK_SIN_LEN=no)]) -if test x"$samba_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then - AC_DEFINE(HAVE_SOCK_SIN_LEN,1,[Whether the sockaddr_in struct has a sin_len property]) -fi - ############################################ # check for unix domain sockets -AC_CACHE_CHECK([for unix domain sockets],samba_cv_unixsocket, [ - AC_TRY_COMPILE([ -#include -#include -#include -#include -#include ], -[ - struct sockaddr_un sunaddr; - sunaddr.sun_family = AF_UNIX; -], - samba_cv_unixsocket=yes,samba_cv_unixsocket=no)]) +# done by AC_LIBREPLACE_NETWORK_CHECKS SMB_ENABLE(socket_unix, NO) -if test x"$samba_cv_unixsocket" = x"yes"; then - SMB_ENABLE(socket_unix, YES) - AC_DEFINE(HAVE_UNIXSOCKET,1,[If we need to build with unixscoket support]) +if test x"$libreplace_cv_HAVE_UNIXSOCKET" = x"yes"; then + SMB_ENABLE(socket_unix, YES) fi dnl test for ipv6 using the gethostbyname2() function. That should be sufficient -- cgit From 097b5ae7633d2f89abe9f89202a8af1438b590cd Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 16 May 2008 12:46:10 +0200 Subject: lib/replace: move sys/sockio.h and sys/un.h checks into AC_LIBREPLACE_NETWORK_CHECKS metze (This used to be commit 7f26a5425e706a97cc07c5139b3fea4fde9e4020) --- source4/lib/replace/libreplace.m4 | 1 - source4/lib/replace/libreplace_network.m4 | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/replace/libreplace.m4 b/source4/lib/replace/libreplace.m4 index 2b33d97989..6a85ff5a82 100644 --- a/source4/lib/replace/libreplace.m4 +++ b/source4/lib/replace/libreplace.m4 @@ -96,7 +96,6 @@ fi AC_CHECK_HEADERS(sys/syslog.h syslog.h) AC_CHECK_HEADERS(sys/time.h time.h) AC_CHECK_HEADERS(stdarg.h vararg.h) -AC_CHECK_HEADERS(sys/sockio.h sys/un.h) AC_CHECK_HEADERS(sys/mount.h mntent.h) AC_CHECK_HEADERS(stropts.h) diff --git a/source4/lib/replace/libreplace_network.m4 b/source4/lib/replace/libreplace_network.m4 index d29c13196d..f2d177b165 100644 --- a/source4/lib/replace/libreplace_network.m4 +++ b/source4/lib/replace/libreplace_network.m4 @@ -8,6 +8,7 @@ LIBREPLACE_NETWORK_LIBS="" 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) dnl we need to check that net/if.h really can be used, to cope with hpux dnl where including it always fails -- cgit From 6a319288697c9fd6fba10d7363797f9076f993ce Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 18 May 2008 19:56:17 +0200 Subject: Use variables for source directory in a couple more places. (This used to be commit 28f4a8bc2c9b4158e74e1284ff9df068388c3b3d) --- source4/lib/basic.mk | 20 -------------------- 1 file changed, 20 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/basic.mk b/source4/lib/basic.mk index e7e0ba80c4..110f8fe08b 100644 --- a/source4/lib/basic.mk +++ b/source4/lib/basic.mk @@ -1,23 +1,3 @@ -# LIB BASIC subsystem -mkinclude samba3/config.mk -mkinclude socket/config.mk -mkinclude charset/config.mk -mkinclude ldb-samba/config.mk -mkinclude tls/config.mk -mkinclude registry/config.mk -mkinclude messaging/config.mk -mkinclude events/config.mk -mkinclude cmdline/config.mk -mkinclude socket_wrapper/config.mk -mkinclude nss_wrapper/config.mk -mkinclude appweb/config.mk -mkinclude stream/config.mk -mkinclude util/config.mk -mkinclude tdr/config.mk -mkinclude dbwrap/config.mk -mkinclude crypto/config.mk -mkinclude torture/config.mk - [SUBSYSTEM::LIBCOMPRESSION] LIBCOMPRESSION_OBJ_FILES = lib/compression/mszip.o -- cgit From 333c169529a3f64a28fcaff1056069867fd56a90 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 18 May 2008 20:30:46 +0200 Subject: Use variables for source directory in remaining subsystems. (This used to be commit 6b6b2196a8a8d9e741f5c399185ded7a16938da0) --- source4/lib/appweb/config.mk | 6 +++--- source4/lib/basic.mk | 14 ++++++------ source4/lib/charset/config.mk | 4 ++-- source4/lib/cmdline/config.mk | 8 +++---- source4/lib/crypto/config.mk | 4 ++-- source4/lib/dbwrap/config.mk | 2 +- source4/lib/events/config.mk | 14 ++++++------ source4/lib/ldb-samba/config.mk | 2 +- source4/lib/messaging/config.mk | 3 +-- source4/lib/nss_wrapper/config.mk | 2 +- source4/lib/registry/config.mk | 42 ++++++++++++++++++------------------ source4/lib/socket/config.mk | 8 +++---- source4/lib/socket_wrapper/config.mk | 2 +- source4/lib/stream/config.mk | 2 +- source4/lib/tdr/config.mk | 4 ++-- source4/lib/tls/config.mk | 2 +- source4/lib/torture/config.mk | 6 +++--- source4/lib/util/config.mk | 14 ++++++------ 18 files changed, 69 insertions(+), 70 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/appweb/config.mk b/source4/lib/appweb/config.mk index c0bba35ba5..4d27b69fb5 100644 --- a/source4/lib/appweb/config.mk +++ b/source4/lib/appweb/config.mk @@ -4,7 +4,7 @@ # End SUBSYSTEM MPR ####################### -MPR_OBJ_FILES = $(addprefix lib/appweb/mpr/, miniMpr.o var.o) +MPR_OBJ_FILES = $(addprefix $(appwebsrcdir)/mpr/, miniMpr.o var.o) ####################### # Start SUBSYSTEM EJS @@ -13,7 +13,7 @@ PUBLIC_DEPENDENCIES = MPR # End SUBSYSTEM EJS ####################### -EJS_OBJ_FILES = $(addprefix lib/appweb/ejs/, ejsLib.o ejsLex.o ejsParser.o ejsProcs.o) +EJS_OBJ_FILES = $(addprefix $(appwebsrcdir)/ejs/, ejsLib.o ejsLex.o ejsParser.o ejsProcs.o) ####################### # Start SUBSYSTEM ESP @@ -22,4 +22,4 @@ PUBLIC_DEPENDENCIES = EJS # End SUBSYSTEM ESP ####################### -ESP_OBJ_FILES = $(addprefix lib/appweb/esp/, esp.o espProcs.o) +ESP_OBJ_FILES = $(addprefix $(appwebsrcdir)/esp/, esp.o espProcs.o) diff --git a/source4/lib/basic.mk b/source4/lib/basic.mk index 110f8fe08b..b86df5dc9f 100644 --- a/source4/lib/basic.mk +++ b/source4/lib/basic.mk @@ -1,25 +1,25 @@ [SUBSYSTEM::LIBCOMPRESSION] -LIBCOMPRESSION_OBJ_FILES = lib/compression/mszip.o +LIBCOMPRESSION_OBJ_FILES = $(libcompressionsrcdir)/mszip.o [SUBSYSTEM::GENCACHE] PRIVATE_DEPENDENCIES = TDB_WRAP -GENCACHE_OBJ_FILES = gencache/gencache.o +GENCACHE_OBJ_FILES = $(libgencachesrcdir)/gencache.o -# PUBLIC_HEADERS += lib/gencache/gencache.h +# PUBLIC_HEADERS += $(libgencachesrcdir)/gencache.h [SUBSYSTEM::LDB_WRAP] PUBLIC_DEPENDENCIES = LIBLDB PRIVATE_DEPENDENCIES = LDBSAMBA UTIL_LDB -LDB_WRAP_OBJ_FILES = lib/ldb_wrap.o -PUBLIC_HEADERS += lib/ldb_wrap.h +LDB_WRAP_OBJ_FILES = $(libsrcdir)/ldb_wrap.o +PUBLIC_HEADERS += $(libsrcdir)/ldb_wrap.h [SUBSYSTEM::TDB_WRAP] PUBLIC_DEPENDENCIES = LIBTDB -TDB_WRAP_OBJ_FILES = lib/tdb_wrap.o -PUBLIC_HEADERS += lib/tdb_wrap.h +TDB_WRAP_OBJ_FILES = $(libsrcdir)/tdb_wrap.o +PUBLIC_HEADERS += $(libsrcdir)/tdb_wrap.h SMBREADLINE_OBJ_LIST = $(SMBREADLINE_OBJ_FILES) diff --git a/source4/lib/charset/config.mk b/source4/lib/charset/config.mk index e5e5bd4560..d5367beb25 100644 --- a/source4/lib/charset/config.mk +++ b/source4/lib/charset/config.mk @@ -7,6 +7,6 @@ PRIVATE_DEPENDENCIES = DYNCONFIG # End SUBSYSTEM CHARSET ################################################ -CHARSET_OBJ_FILES = $(addprefix lib/charset/, iconv.o charcnv.o util_unistr.o) +CHARSET_OBJ_FILES = $(addprefix $(libcharsetsrcdir)/, iconv.o charcnv.o util_unistr.o) -PUBLIC_HEADERS += lib/charset/charset.h +PUBLIC_HEADERS += $(libcharsetsrcdir)/charset.h diff --git a/source4/lib/cmdline/config.mk b/source4/lib/cmdline/config.mk index f8a971a063..823cc6708c 100644 --- a/source4/lib/cmdline/config.mk +++ b/source4/lib/cmdline/config.mk @@ -2,18 +2,18 @@ PRIVATE_PROTO_HEADER = credentials.h PUBLIC_DEPENDENCIES = CREDENTIALS LIBPOPT -LIBCMDLINE_CREDENTIALS_OBJ_FILES = lib/cmdline/credentials.o +LIBCMDLINE_CREDENTIALS_OBJ_FILES = $(libcmdlinesrcdir)/credentials.o [SUBSYSTEM::POPT_SAMBA] PUBLIC_DEPENDENCIES = LIBPOPT -POPT_SAMBA_OBJ_FILES = lib/cmdline/popt_common.o +POPT_SAMBA_OBJ_FILES = $(libcmdlinesrcdir)/popt_common.o -PUBLIC_HEADERS += lib/cmdline/popt_common.h +PUBLIC_HEADERS += $(libcmdlinesrcdir)/popt_common.h [SUBSYSTEM::POPT_CREDENTIALS] PRIVATE_PROTO_HEADER = popt_credentials.h PUBLIC_DEPENDENCIES = CREDENTIALS LIBCMDLINE_CREDENTIALS LIBPOPT PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL -POPT_CREDENTIALS_OBJ_FILES = lib/cmdline/popt_credentials.o +POPT_CREDENTIALS_OBJ_FILES = $(libcmdlinesrcdir)/popt_credentials.o diff --git a/source4/lib/crypto/config.mk b/source4/lib/crypto/config.mk index 8e0cba17f0..4a4de6316d 100644 --- a/source4/lib/crypto/config.mk +++ b/source4/lib/crypto/config.mk @@ -4,7 +4,7 @@ # End SUBSYSTEM LIBCRYPTO ############################## -LIBCRYPTO_OBJ_FILES = $(addprefix lib/crypto/, \ +LIBCRYPTO_OBJ_FILES = $(addprefix $(libcryptosrcdir)/, \ crc32.o md5.o hmacmd5.o md4.o \ arcfour.o sha1.o hmacsha1.o) @@ -14,6 +14,6 @@ SUBSYSTEM = smbtorture PRIVATE_DEPENDENCIES = LIBCRYPTO PRIVATE_PROTO_HEADER = test_proto.h -TORTURE_LIBCRYPTO_OBJ_FILES = $(addprefix lib/crypto/, \ +TORTURE_LIBCRYPTO_OBJ_FILES = $(addprefix $(libcryptosrcdir)/, \ md4test.o md5test.o hmacmd5test.o sha1test.o hmacsha1test.o) diff --git a/source4/lib/dbwrap/config.mk b/source4/lib/dbwrap/config.mk index 9038873d32..34e2629b16 100644 --- a/source4/lib/dbwrap/config.mk +++ b/source4/lib/dbwrap/config.mk @@ -2,5 +2,5 @@ PUBLIC_DEPENDENCIES = \ LIBTDB ctdb -LIBDBWRAP_OBJ_FILES = $(addprefix lib/dbwrap/, dbwrap.o dbwrap_tdb.o dbwrap_ctdb.o) +LIBDBWRAP_OBJ_FILES = $(addprefix $(libdbwrapsrcdir)/, dbwrap.o dbwrap_tdb.o dbwrap_ctdb.o) diff --git a/source4/lib/events/config.mk b/source4/lib/events/config.mk index 34c24f76f5..3a20770427 100644 --- a/source4/lib/events/config.mk +++ b/source4/lib/events/config.mk @@ -15,7 +15,7 @@ SUBSYSTEM = LIBEVENTS INIT_FUNCTION = s4_events_aio_init ############################## -EVENTS_AIO_OBJ_FILES = lib/events/events_aio.o +EVENTS_AIO_OBJ_FILES = $(libeventssrcdir)/events_aio.o ############################## [MODULE::EVENTS_EPOLL] @@ -23,7 +23,7 @@ SUBSYSTEM = LIBEVENTS INIT_FUNCTION = s4_events_epoll_init ############################## -EVENTS_EPOLL_OBJ_FILES = lib/events/events_epoll.o +EVENTS_EPOLL_OBJ_FILES = $(libeventssrcdir)/events_epoll.o ############################## [MODULE::EVENTS_SELECT] @@ -31,7 +31,7 @@ SUBSYSTEM = LIBEVENTS INIT_FUNCTION = s4_events_select_init ############################## -EVENTS_SELECT_OBJ_FILES = lib/events/events_select.o +EVENTS_SELECT_OBJ_FILES = $(libeventssrcdir)/events_select.o ############################## [MODULE::EVENTS_STANDARD] @@ -39,7 +39,7 @@ SUBSYSTEM = LIBEVENTS INIT_FUNCTION = s4_events_standard_init ############################## -EVENTS_STANDARD_OBJ_FILES = lib/events/events_standard.o +EVENTS_STANDARD_OBJ_FILES = $(libeventssrcdir)/events_standard.o ############################## # Start SUBSYSTEM LIBEVENTS @@ -47,12 +47,12 @@ EVENTS_STANDARD_OBJ_FILES = lib/events/events_standard.o # End SUBSYSTEM LIBEVENTS ############################## -LIBEVENTS_OBJ_FILES = $(addprefix lib/events/, events.o events_timed.o events_signal.o) +LIBEVENTS_OBJ_FILES = $(addprefix $(libeventssrcdir)/, events.o events_timed.o events_signal.o) -PUBLIC_HEADERS += $(addprefix lib/events/, events.h events_internal.h) +PUBLIC_HEADERS += $(addprefix $(libeventssrcdir)/, events.h events_internal.h) [PYTHON::swig_events] SWIG_FILE = events.i PRIVATE_DEPENDENCIES = LIBEVENTS LIBSAMBA-HOSTCONFIG -swig_events_OBJ_FILES = lib/events/events_wrap.o +swig_events_OBJ_FILES = $(libeventssrcdir)/events_wrap.o diff --git a/source4/lib/ldb-samba/config.mk b/source4/lib/ldb-samba/config.mk index 6a0b842fff..96eead1551 100644 --- a/source4/lib/ldb-samba/config.mk +++ b/source4/lib/ldb-samba/config.mk @@ -7,5 +7,5 @@ PRIVATE_DEPENDENCIES = LIBSECURITY SAMDB_SCHEMA LIBNDR NDR_MISC # End SUBSYSTEM LDBSAMBA ################################################ -LDBSAMBA_OBJ_FILES = lib/ldb-samba/ldif_handlers.o +LDBSAMBA_OBJ_FILES = $(ldb_sambasrcdir)/ldif_handlers.o diff --git a/source4/lib/messaging/config.mk b/source4/lib/messaging/config.mk index 0a0097bdf3..eaf7e3581e 100644 --- a/source4/lib/messaging/config.mk +++ b/source4/lib/messaging/config.mk @@ -13,5 +13,4 @@ PUBLIC_DEPENDENCIES = \ # End SUBSYSTEM MESSAGING ################################################ - -MESSAGING_OBJ_FILES = lib/messaging/messaging.o +MESSAGING_OBJ_FILES = $(libmessagingsrcdir)/messaging.o diff --git a/source4/lib/nss_wrapper/config.mk b/source4/lib/nss_wrapper/config.mk index 5f136a465d..015fbe511c 100644 --- a/source4/lib/nss_wrapper/config.mk +++ b/source4/lib/nss_wrapper/config.mk @@ -4,4 +4,4 @@ # End SUBSYSTEM NSS_WRAPPER ############################## -NSS_WRAPPER_OBJ_FILES = lib/nss_wrapper/nss_wrapper.o +NSS_WRAPPER_OBJ_FILES = $(nsswrappersrcdir)/nss_wrapper.o diff --git a/source4/lib/registry/config.mk b/source4/lib/registry/config.mk index ce19d8512e..fcfbd0437f 100644 --- a/source4/lib/registry/config.mk +++ b/source4/lib/registry/config.mk @@ -1,19 +1,19 @@ [SUBSYSTEM::TDR_REGF] PUBLIC_DEPENDENCIES = TDR -TDR_REGF_OBJ_FILES = lib/registry/tdr_regf.o +TDR_REGF_OBJ_FILES = $(libregistrysrcdir)/tdr_regf.o # Special support for external builddirs -lib/registry/regf.c: lib/registry/tdr_regf.c -$(srcdir)/lib/registry/regf.c: lib/registry/tdr_regf.c -lib/registry/tdr_regf.h: lib/registry/tdr_regf.c -lib/registry/tdr_regf.c: $(srcdir)/lib/registry/regf.idl +$(libregistrysrcdir)/regf.c: $(libregistrysrcdir)/tdr_regf.c +$(srcdir)/$(libregistrysrcdir)/regf.c: $(libregistrysrcdir)/tdr_regf.c +$(libregistrysrcdir)/tdr_regf.h: $(libregistrysrcdir)/tdr_regf.c +$(libregistrysrcdir)/tdr_regf.c: $(srcdir)/$(libregistrysrcdir)/regf.idl @CPP="$(CPP)" srcdir="$(srcdir)" $(PERL) $(srcdir)/pidl/pidl $(PIDL_ARGS) \ --header --outputdir=lib/registry \ - --tdr-parser -- $(srcdir)/lib/registry/regf.idl + --tdr-parser -- $(srcdir)/$(libregistrysrcdir)/regf.idl clean:: - @-rm -f lib/registry/regf.h lib/registry/tdr_regf* + @-rm -f $(libregistrysrcdir)/regf.h $(libregistrysrcdir)/tdr_regf* ################################################ # Start SUBSYSTEM registry @@ -24,22 +24,22 @@ PUBLIC_DEPENDENCIES = \ # End MODULE registry_ldb ################################################ -PC_FILES += lib/registry/registry.pc +PC_FILES += $(libregistrysrcdir)/registry.pc registry_VERSION = 0.0.1 registry_SOVERSION = 0 -registry_OBJ_FILES = $(addprefix lib/registry/, interface.o util.o samba.o \ +registry_OBJ_FILES = $(addprefix $(libregistrysrcdir)/, interface.o util.o samba.o \ patchfile_dotreg.o patchfile_preg.o patchfile.o regf.o \ hive.o local.o ldb.o dir.o rpc.o) -PUBLIC_HEADERS += lib/registry/registry.h +PUBLIC_HEADERS += $(libregistrysrcdir)/registry.h [SUBSYSTEM::registry_common] PUBLIC_DEPENDENCIES = registry PRIVATE_PROTO_HEADER = tools/common.h -registry_common_OBJ_FILES = lib/registry/tools/common.o +registry_common_OBJ_FILES = $(libregistrysrcdir)/tools/common.o ################################################ # Start BINARY regdiff @@ -50,9 +50,9 @@ PRIVATE_DEPENDENCIES = \ # End BINARY regdiff ################################################ -regdiff_OBJ_FILES = lib/registry/tools/regdiff.o +regdiff_OBJ_FILES = $(libregistrysrcdir)/tools/regdiff.o -MANPAGES += lib/registry/man/regdiff.1 +MANPAGES += $(libregistrysrcdir)/man/regdiff.1 ################################################ # Start BINARY regpatch @@ -64,9 +64,9 @@ PRIVATE_DEPENDENCIES = \ # End BINARY regpatch ################################################ -regpatch_OBJ_FILES = lib/registry/tools/regpatch.o +regpatch_OBJ_FILES = $(libregistrysrcdir)/tools/regpatch.o -MANPAGES += lib/registry/man/regpatch.1 +MANPAGES += $(libregistrysrcdir)/man/regpatch.1 ################################################ # Start BINARY regshell @@ -78,9 +78,9 @@ PRIVATE_DEPENDENCIES = \ # End BINARY regshell ################################################ -regshell_OBJ_FILES = lib/registry/tools/regshell.o +regshell_OBJ_FILES = $(libregistrysrcdir)/tools/regshell.o -MANPAGES += lib/registry/man/regshell.1 +MANPAGES += $(libregistrysrcdir)/man/regshell.1 ################################################ # Start BINARY regtree @@ -92,18 +92,18 @@ PRIVATE_DEPENDENCIES = \ # End BINARY regtree ################################################ -regtree_OBJ_FILES = lib/registry/tools/regtree.o +regtree_OBJ_FILES = $(libregistrysrcdir)/tools/regtree.o -MANPAGES += lib/registry/man/regtree.1 +MANPAGES += $(libregistrysrcdir)/man/regtree.1 [SUBSYSTEM::torture_registry] PRIVATE_DEPENDENCIES = registry PRIVATE_PROTO_HEADER = tests/proto.h -torture_registry_OBJ_FILES = $(addprefix lib/registry/tests/, generic.o hive.o diff.o registry.o) +torture_registry_OBJ_FILES = $(addprefix $(libregistrysrcdir)/tests/, generic.o hive.o diff.o registry.o) [PYTHON::swig_registry] PUBLIC_DEPENDENCIES = registry SWIG_FILE = registry.i -swig_registry_OBJ_FILES = lib/registry/registry_wrap.o +swig_registry_OBJ_FILES = $(libregistrysrcdir)/registry_wrap.o diff --git a/source4/lib/socket/config.mk b/source4/lib/socket/config.mk index 2400190175..ebcd19b3c6 100644 --- a/source4/lib/socket/config.mk +++ b/source4/lib/socket/config.mk @@ -6,7 +6,7 @@ PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL LIBREPLACE_NETWORK # End SUBSYSTEM LIBNETIF ############################## -LIBNETIF_OBJ_FILES = $(addprefix lib/socket/, interface.o netif.o) +LIBNETIF_OBJ_FILES = $(addprefix $(libsocketsrcdir)/, interface.o netif.o) ################################################ # Start MODULE socket_ip @@ -17,7 +17,7 @@ PRIVATE_DEPENDENCIES = LIBSAMBA-ERRORS LIBREPLACE_NETWORK # End MODULE socket_ip ################################################ -socket_ip_OBJ_FILES = lib/socket/socket_ip.o +socket_ip_OBJ_FILES = $(libsocketsrcdir)/socket_ip.o ################################################ # Start MODULE socket_unix @@ -28,7 +28,7 @@ PRIVATE_DEPENDENCIES = LIBREPLACE_NETWORK # End MODULE socket_unix ################################################ -socket_unix_OBJ_FILES = lib/socket/socket_unix.o +socket_unix_OBJ_FILES = $(libsocketsrcdir)/socket_unix.o ################################################ # Start SUBSYSTEM SOCKET @@ -38,5 +38,5 @@ PRIVATE_DEPENDENCIES = SOCKET_WRAPPER LIBCLI_COMPOSITE LIBCLI_RESOLVE # End SUBSYSTEM SOCKET ################################################ -samba-socket_OBJ_FILES = $(addprefix lib/socket/, socket.o access.o connect_multi.o connect.o) +samba-socket_OBJ_FILES = $(addprefix $(libsocketsrcdir)/, socket.o access.o connect_multi.o connect.o) diff --git a/source4/lib/socket_wrapper/config.mk b/source4/lib/socket_wrapper/config.mk index 2067d988cb..60cfb3209a 100644 --- a/source4/lib/socket_wrapper/config.mk +++ b/source4/lib/socket_wrapper/config.mk @@ -5,4 +5,4 @@ PRIVATE_DEPENDENCIES = LIBREPLACE_NETWORK # End SUBSYSTEM SOCKET_WRAPPER ############################## -SOCKET_WRAPPER_OBJ_FILES = lib/socket_wrapper/socket_wrapper.o +SOCKET_WRAPPER_OBJ_FILES = $(socketwrappersrcdir)/socket_wrapper.o diff --git a/source4/lib/stream/config.mk b/source4/lib/stream/config.mk index 52c8525483..56d117e7bd 100644 --- a/source4/lib/stream/config.mk +++ b/source4/lib/stream/config.mk @@ -1,4 +1,4 @@ [SUBSYSTEM::LIBPACKET] PRIVATE_DEPENDENCIES = LIBTLS -LIBPACKET_OBJ_FILES = lib/stream/packet.o +LIBPACKET_OBJ_FILES = $(libstreamsrcdir)/packet.o diff --git a/source4/lib/tdr/config.mk b/source4/lib/tdr/config.mk index 3e05f6c30c..c641ec9713 100644 --- a/source4/lib/tdr/config.mk +++ b/source4/lib/tdr/config.mk @@ -3,6 +3,6 @@ CFLAGS = -Ilib/tdr PRIVATE_PROTO_HEADER = tdr_proto.h PUBLIC_DEPENDENCIES = LIBTALLOC LIBSAMBA-UTIL -TDR_OBJ_FILES = lib/tdr/tdr.o +TDR_OBJ_FILES = $(libtdrsrcdir)/tdr.o -PUBLIC_HEADERS += lib/tdr/tdr.h +PUBLIC_HEADERS += $(libtdrsrcdir)/tdr.h diff --git a/source4/lib/tls/config.mk b/source4/lib/tls/config.mk index e2d7cd517a..e01f79ce10 100644 --- a/source4/lib/tls/config.mk +++ b/source4/lib/tls/config.mk @@ -2,4 +2,4 @@ PUBLIC_DEPENDENCIES = \ LIBTALLOC GNUTLS LIBSAMBA-HOSTCONFIG samba-socket -LIBTLS_OBJ_FILES = lib/tls/tls.o lib/tls/tlscert.o +LIBTLS_OBJ_FILES = $(addprefix $(libtlssrcdir)/, tls.o tlscert.o) diff --git a/source4/lib/torture/config.mk b/source4/lib/torture/config.mk index 888e285e95..49e7b1a171 100644 --- a/source4/lib/torture/config.mk +++ b/source4/lib/torture/config.mk @@ -8,7 +8,7 @@ PUBLIC_DEPENDENCIES = \ torture_VERSION = 0.0.1 torture_SOVERSION = 0 -PC_FILES += lib/torture/torture.pc -torture_OBJ_FILES = $(addprefix lib/torture/, torture.o) +PC_FILES += $(libtorturesrcdir)/torture.pc +torture_OBJ_FILES = $(addprefix $(libtorturesrcdir)/, torture.o) -PUBLIC_HEADERS += lib/torture/torture.h +PUBLIC_HEADERS += $(libtorturesrcdir)/torture.h diff --git a/source4/lib/util/config.mk b/source4/lib/util/config.mk index 5a4b831ed5..2c8d7e5f4d 100644 --- a/source4/lib/util/config.mk +++ b/source4/lib/util/config.mk @@ -4,7 +4,7 @@ PUBLIC_DEPENDENCIES = \ SOCKET_WRAPPER LIBREPLACE_NETWORK \ CHARSET EXECINFO -LIBSAMBA-UTIL_OBJ_FILES = $(addprefix lib/util/, \ +LIBSAMBA-UTIL_OBJ_FILES = $(addprefix $(libutilsrcdir)/, \ xfile.o \ debug.o \ fault.o \ @@ -25,7 +25,7 @@ LIBSAMBA-UTIL_OBJ_FILES = $(addprefix lib/util/, \ become_daemon.o \ params.o) -PUBLIC_HEADERS += $(addprefix lib/util/, util.h \ +PUBLIC_HEADERS += $(addprefix $(libutilsrcdir)/, util.h \ attr.h \ byteorder.h \ data_blob.h \ @@ -39,12 +39,12 @@ PUBLIC_HEADERS += $(addprefix lib/util/, util.h \ [SUBSYSTEM::ASN1_UTIL] PRIVATE_PROTO_HEADER = asn1_proto.h -ASN1_UTIL_OBJ_FILES = lib/util/asn1.o +ASN1_UTIL_OBJ_FILES = $(libutilsrcdir)/asn1.o [SUBSYSTEM::UNIX_PRIVS] PRIVATE_PROTO_HEADER = unix_privs.h -UNIX_PRIVS_OBJ_FILES = lib/util/unix_privs.o +UNIX_PRIVS_OBJ_FILES = $(libutilsrcdir)/unix_privs.o ################################################ # Start SUBSYSTEM WRAP_XATTR @@ -54,15 +54,15 @@ PUBLIC_DEPENDENCIES = XATTR # End SUBSYSTEM WRAP_XATTR ################################################ -WRAP_XATTR_OBJ_FILES = lib/util/wrap_xattr.o +WRAP_XATTR_OBJ_FILES = $(libutilsrcdir)/wrap_xattr.o [SUBSYSTEM::UTIL_TDB] PRIVATE_PROTO_HEADER = util_tdb.h PUBLIC_DEPENDENCIES = LIBTDB -UTIL_TDB_OBJ_FILES = lib/util/util_tdb.o +UTIL_TDB_OBJ_FILES = $(libutilsrcdir)/util_tdb.o [SUBSYSTEM::UTIL_LDB] PUBLIC_DEPENDENCIES = LIBLDB -UTIL_LDB_OBJ_FILES = lib/util/util_ldb.o +UTIL_LDB_OBJ_FILES = $(libutilsrcdir)/util_ldb.o -- cgit From dc114f8c5acbcffe2f7114083f3e058f17fb4fa2 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 18 May 2008 21:09:04 +0200 Subject: Avoid smb_build for prototype headers in some places. (This used to be commit 4876c4efbbafb4e0afa3554cd9f748ab591a2927) --- source4/lib/charset/config.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/charset/config.mk b/source4/lib/charset/config.mk index d5367beb25..64c240a46a 100644 --- a/source4/lib/charset/config.mk +++ b/source4/lib/charset/config.mk @@ -1,7 +1,6 @@ ################################################ # Start SUBSYSTEM CHARSET [SUBSYSTEM::CHARSET] -PRIVATE_PROTO_HEADER = charset_proto.h PUBLIC_DEPENDENCIES = ICONV PRIVATE_DEPENDENCIES = DYNCONFIG # End SUBSYSTEM CHARSET @@ -10,3 +9,5 @@ PRIVATE_DEPENDENCIES = DYNCONFIG CHARSET_OBJ_FILES = $(addprefix $(libcharsetsrcdir)/, iconv.o charcnv.o util_unistr.o) PUBLIC_HEADERS += $(libcharsetsrcdir)/charset.h + +PRIVATE_PROTO_HEADER = charset_proto.h -- cgit From 4c8756f147f8b9a2806fd76e4cb06bb99d391516 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 18 May 2008 22:30:08 +0200 Subject: Create prototype headers from Makefile directory, without smb_build in the middle. (This used to be commit f4a77b96f9c17d853348b70794026e5b9e384942) --- source4/lib/charset/config.mk | 2 +- source4/lib/cmdline/config.mk | 6 ++++-- source4/lib/crypto/config.mk | 2 +- source4/lib/ldb-samba/config.mk | 2 +- source4/lib/registry/config.mk | 6 ++++-- source4/lib/samba3/config.mk | 5 +++-- source4/lib/socket/config.mk | 3 ++- source4/lib/tdr/config.mk | 3 ++- source4/lib/util/config.mk | 9 ++++++--- 9 files changed, 24 insertions(+), 14 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/charset/config.mk b/source4/lib/charset/config.mk index 64c240a46a..9e37b5f0a6 100644 --- a/source4/lib/charset/config.mk +++ b/source4/lib/charset/config.mk @@ -10,4 +10,4 @@ CHARSET_OBJ_FILES = $(addprefix $(libcharsetsrcdir)/, iconv.o charcnv.o util_uni PUBLIC_HEADERS += $(libcharsetsrcdir)/charset.h -PRIVATE_PROTO_HEADER = charset_proto.h +$(call proto_header_template,$(libcharsetsrcdir)/charset_proto.h,$(CHARSET_OBJ_FILES:.o=.c)) diff --git a/source4/lib/cmdline/config.mk b/source4/lib/cmdline/config.mk index 823cc6708c..12c071fa03 100644 --- a/source4/lib/cmdline/config.mk +++ b/source4/lib/cmdline/config.mk @@ -1,9 +1,10 @@ [SUBSYSTEM::LIBCMDLINE_CREDENTIALS] -PRIVATE_PROTO_HEADER = credentials.h PUBLIC_DEPENDENCIES = CREDENTIALS LIBPOPT LIBCMDLINE_CREDENTIALS_OBJ_FILES = $(libcmdlinesrcdir)/credentials.o +$(call proto_header_template,$(libcmdlinesrcdir)/credentials.h,$(LIBCMDLINE_CREDENTIALS_OBJ_FILES:.o=.c)) + [SUBSYSTEM::POPT_SAMBA] PUBLIC_DEPENDENCIES = LIBPOPT @@ -12,8 +13,9 @@ POPT_SAMBA_OBJ_FILES = $(libcmdlinesrcdir)/popt_common.o PUBLIC_HEADERS += $(libcmdlinesrcdir)/popt_common.h [SUBSYSTEM::POPT_CREDENTIALS] -PRIVATE_PROTO_HEADER = popt_credentials.h PUBLIC_DEPENDENCIES = CREDENTIALS LIBCMDLINE_CREDENTIALS LIBPOPT PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL POPT_CREDENTIALS_OBJ_FILES = $(libcmdlinesrcdir)/popt_credentials.o + +$(call proto_header_template,$(libcmdlinesrcdir)/popt_credentials.h,$(POPT_CREDENTIALS_OBJ_FILES:.o=.c)) diff --git a/source4/lib/crypto/config.mk b/source4/lib/crypto/config.mk index 4a4de6316d..ca2e9c8e2a 100644 --- a/source4/lib/crypto/config.mk +++ b/source4/lib/crypto/config.mk @@ -12,8 +12,8 @@ LIBCRYPTO_OBJ_FILES = $(addprefix $(libcryptosrcdir)/, \ [MODULE::TORTURE_LIBCRYPTO] SUBSYSTEM = smbtorture PRIVATE_DEPENDENCIES = LIBCRYPTO -PRIVATE_PROTO_HEADER = test_proto.h TORTURE_LIBCRYPTO_OBJ_FILES = $(addprefix $(libcryptosrcdir)/, \ md4test.o md5test.o hmacmd5test.o sha1test.o hmacsha1test.o) +$(call proto_header_template,$(libcryptosrcdir)/test_proto.h,$(TORTURE_LIBCRYPTO_OBJ_FILES)) diff --git a/source4/lib/ldb-samba/config.mk b/source4/lib/ldb-samba/config.mk index 96eead1551..5e8048ecb4 100644 --- a/source4/lib/ldb-samba/config.mk +++ b/source4/lib/ldb-samba/config.mk @@ -2,10 +2,10 @@ # Start SUBSYSTEM LDBSAMBA [SUBSYSTEM::LDBSAMBA] PUBLIC_DEPENDENCIES = LIBLDB -PRIVATE_PROTO_HEADER = ldif_handlers.h PRIVATE_DEPENDENCIES = LIBSECURITY SAMDB_SCHEMA LIBNDR NDR_MISC # End SUBSYSTEM LDBSAMBA ################################################ LDBSAMBA_OBJ_FILES = $(ldb_sambasrcdir)/ldif_handlers.o +$(call proto_header_template,$(ldb_sambasrcdir)/ldif_handlers.h,$(LDBSAMBA_OBJ_FILES)) diff --git a/source4/lib/registry/config.mk b/source4/lib/registry/config.mk index fcfbd0437f..8c6a76fb19 100644 --- a/source4/lib/registry/config.mk +++ b/source4/lib/registry/config.mk @@ -37,10 +37,11 @@ PUBLIC_HEADERS += $(libregistrysrcdir)/registry.h [SUBSYSTEM::registry_common] PUBLIC_DEPENDENCIES = registry -PRIVATE_PROTO_HEADER = tools/common.h registry_common_OBJ_FILES = $(libregistrysrcdir)/tools/common.o +$(call proto_header_template,$(libregistrysrcdir)/tools/common.h,$(registry_common_OBJ_FILES:.o=.c)) + ################################################ # Start BINARY regdiff [BINARY::regdiff] @@ -98,10 +99,11 @@ MANPAGES += $(libregistrysrcdir)/man/regtree.1 [SUBSYSTEM::torture_registry] PRIVATE_DEPENDENCIES = registry -PRIVATE_PROTO_HEADER = tests/proto.h torture_registry_OBJ_FILES = $(addprefix $(libregistrysrcdir)/tests/, generic.o hive.o diff.o registry.o) +$(call proto_header_template,$(libregistrysrcdir)/tests/proto.h,$(torture_registry_OBJ_FILES:.o=.c)) + [PYTHON::swig_registry] PUBLIC_DEPENDENCIES = registry SWIG_FILE = registry.i diff --git a/source4/lib/samba3/config.mk b/source4/lib/samba3/config.mk index d33b38cab0..05fb9a5b01 100644 --- a/source4/lib/samba3/config.mk +++ b/source4/lib/samba3/config.mk @@ -1,9 +1,10 @@ ################################################ # Start SUBSYSTEM LIBSAMBA3 [SUBSYSTEM::SMBPASSWD] -PRIVATE_PROTO_HEADER = samba3_smbpasswd_proto.h PRIVATE_DEPENDENCIES = CHARSET LIBSAMBA-UTIL # End SUBSYSTEM LIBSAMBA3 ################################################ -SMBPASSWD_OBJ_FILES = lib/samba3/smbpasswd.o +SMBPASSWD_OBJ_FILES = $(libsrcdir)/samba3/smbpasswd.o + +$(call proto_header_template,$(libsrcdir)/samba3_smbpasswd_proto.h,$(SMBPASSWD_OBJ_FILES:.o=.c)) diff --git a/source4/lib/socket/config.mk b/source4/lib/socket/config.mk index ebcd19b3c6..9cbdd21614 100644 --- a/source4/lib/socket/config.mk +++ b/source4/lib/socket/config.mk @@ -1,13 +1,14 @@ ############################## # Start SUBSYSTEM LIBNETIF [SUBSYSTEM::LIBNETIF] -PRIVATE_PROTO_HEADER = netif_proto.h PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL LIBREPLACE_NETWORK # End SUBSYSTEM LIBNETIF ############################## LIBNETIF_OBJ_FILES = $(addprefix $(libsocketsrcdir)/, interface.o netif.o) +$(call proto_header_template,$(libsocketsrcdir)/netif_proto.h,$(LIBNETIF_OBJ_FILES:.o=.c)) + ################################################ # Start MODULE socket_ip [MODULE::socket_ip] diff --git a/source4/lib/tdr/config.mk b/source4/lib/tdr/config.mk index c641ec9713..5419d12fa2 100644 --- a/source4/lib/tdr/config.mk +++ b/source4/lib/tdr/config.mk @@ -1,8 +1,9 @@ [SUBSYSTEM::TDR] CFLAGS = -Ilib/tdr -PRIVATE_PROTO_HEADER = tdr_proto.h PUBLIC_DEPENDENCIES = LIBTALLOC LIBSAMBA-UTIL TDR_OBJ_FILES = $(libtdrsrcdir)/tdr.o +$(call proto_header_template,$(libtdrsrcdir)/tdr_proto.h,$(TDR_OBJ_FILES:.o=.c)) + PUBLIC_HEADERS += $(libtdrsrcdir)/tdr.h diff --git a/source4/lib/util/config.mk b/source4/lib/util/config.mk index 2c8d7e5f4d..e365082178 100644 --- a/source4/lib/util/config.mk +++ b/source4/lib/util/config.mk @@ -37,15 +37,17 @@ PUBLIC_HEADERS += $(addprefix $(libutilsrcdir)/, util.h \ xfile.h) [SUBSYSTEM::ASN1_UTIL] -PRIVATE_PROTO_HEADER = asn1_proto.h ASN1_UTIL_OBJ_FILES = $(libutilsrcdir)/asn1.o +$(call proto_header_template,$(libutilsrcdir)/asn1_proto.h,$(ASN1_UTIL_OBJ_FILES:.o=.c)) + [SUBSYSTEM::UNIX_PRIVS] -PRIVATE_PROTO_HEADER = unix_privs.h UNIX_PRIVS_OBJ_FILES = $(libutilsrcdir)/unix_privs.o +$(call proto_header_template,$(libutilsrcdir)/unix_privs.h,$(UNIX_PRIVS_OBJ_FILES:.o=.c)) + ################################################ # Start SUBSYSTEM WRAP_XATTR [SUBSYSTEM::WRAP_XATTR] @@ -57,11 +59,12 @@ PUBLIC_DEPENDENCIES = XATTR WRAP_XATTR_OBJ_FILES = $(libutilsrcdir)/wrap_xattr.o [SUBSYSTEM::UTIL_TDB] -PRIVATE_PROTO_HEADER = util_tdb.h PUBLIC_DEPENDENCIES = LIBTDB UTIL_TDB_OBJ_FILES = $(libutilsrcdir)/util_tdb.o +$(call proto_header_template,$(libutilsrcdir)/util_tdb.h,$(UTIL_TDB_OBJ_FILES)) + [SUBSYSTEM::UTIL_LDB] PUBLIC_DEPENDENCIES = LIBLDB -- cgit From 4c70cda986c86fe536327321d04c29eca81b6409 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 18 May 2008 23:02:47 +0200 Subject: Fix a couple (well, little more than that..) of typos. (This used to be commit a6b52119940a900fb0de3864b8bca94e2965cc24) --- source4/lib/charset/config.mk | 2 +- source4/lib/cmdline/config.mk | 4 ++-- source4/lib/crypto/config.mk | 2 +- source4/lib/ldb-samba/config.mk | 2 +- source4/lib/registry/config.mk | 4 ++-- source4/lib/samba3/config.mk | 2 +- source4/lib/socket/config.mk | 2 +- source4/lib/tdr/config.mk | 2 +- source4/lib/util/config.mk | 6 +++--- 9 files changed, 13 insertions(+), 13 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/charset/config.mk b/source4/lib/charset/config.mk index 9e37b5f0a6..12c2f5f321 100644 --- a/source4/lib/charset/config.mk +++ b/source4/lib/charset/config.mk @@ -10,4 +10,4 @@ CHARSET_OBJ_FILES = $(addprefix $(libcharsetsrcdir)/, iconv.o charcnv.o util_uni PUBLIC_HEADERS += $(libcharsetsrcdir)/charset.h -$(call proto_header_template,$(libcharsetsrcdir)/charset_proto.h,$(CHARSET_OBJ_FILES:.o=.c)) +$(eval $(call proto_header_template,$(libcharsetsrcdir)/charset_proto.h,$(CHARSET_OBJ_FILES:.o=.c))) diff --git a/source4/lib/cmdline/config.mk b/source4/lib/cmdline/config.mk index 12c071fa03..4434ff3701 100644 --- a/source4/lib/cmdline/config.mk +++ b/source4/lib/cmdline/config.mk @@ -3,7 +3,7 @@ PUBLIC_DEPENDENCIES = CREDENTIALS LIBPOPT LIBCMDLINE_CREDENTIALS_OBJ_FILES = $(libcmdlinesrcdir)/credentials.o -$(call proto_header_template,$(libcmdlinesrcdir)/credentials.h,$(LIBCMDLINE_CREDENTIALS_OBJ_FILES:.o=.c)) +$(eval $(call proto_header_template,$(libcmdlinesrcdir)/credentials.h,$(LIBCMDLINE_CREDENTIALS_OBJ_FILES:.o=.c))) [SUBSYSTEM::POPT_SAMBA] PUBLIC_DEPENDENCIES = LIBPOPT @@ -18,4 +18,4 @@ PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL POPT_CREDENTIALS_OBJ_FILES = $(libcmdlinesrcdir)/popt_credentials.o -$(call proto_header_template,$(libcmdlinesrcdir)/popt_credentials.h,$(POPT_CREDENTIALS_OBJ_FILES:.o=.c)) +$(eval $(call proto_header_template,$(libcmdlinesrcdir)/popt_credentials.h,$(POPT_CREDENTIALS_OBJ_FILES:.o=.c))) diff --git a/source4/lib/crypto/config.mk b/source4/lib/crypto/config.mk index ca2e9c8e2a..6fef525dbf 100644 --- a/source4/lib/crypto/config.mk +++ b/source4/lib/crypto/config.mk @@ -16,4 +16,4 @@ PRIVATE_DEPENDENCIES = LIBCRYPTO TORTURE_LIBCRYPTO_OBJ_FILES = $(addprefix $(libcryptosrcdir)/, \ md4test.o md5test.o hmacmd5test.o sha1test.o hmacsha1test.o) -$(call proto_header_template,$(libcryptosrcdir)/test_proto.h,$(TORTURE_LIBCRYPTO_OBJ_FILES)) +$(eval $(call proto_header_template,$(libcryptosrcdir)/test_proto.h,$(TORTURE_LIBCRYPTO_OBJ_FILES))) diff --git a/source4/lib/ldb-samba/config.mk b/source4/lib/ldb-samba/config.mk index 5e8048ecb4..ac071c9e10 100644 --- a/source4/lib/ldb-samba/config.mk +++ b/source4/lib/ldb-samba/config.mk @@ -7,5 +7,5 @@ PRIVATE_DEPENDENCIES = LIBSECURITY SAMDB_SCHEMA LIBNDR NDR_MISC ################################################ LDBSAMBA_OBJ_FILES = $(ldb_sambasrcdir)/ldif_handlers.o -$(call proto_header_template,$(ldb_sambasrcdir)/ldif_handlers.h,$(LDBSAMBA_OBJ_FILES)) +$(eval $(call proto_header_template,$(ldb_sambasrcdir)/ldif_handlers.h,$(LDBSAMBA_OBJ_FILES))) diff --git a/source4/lib/registry/config.mk b/source4/lib/registry/config.mk index 8c6a76fb19..c0ad613c52 100644 --- a/source4/lib/registry/config.mk +++ b/source4/lib/registry/config.mk @@ -40,7 +40,7 @@ PUBLIC_DEPENDENCIES = registry registry_common_OBJ_FILES = $(libregistrysrcdir)/tools/common.o -$(call proto_header_template,$(libregistrysrcdir)/tools/common.h,$(registry_common_OBJ_FILES:.o=.c)) +$(eval $(call proto_header_template,$(libregistrysrcdir)/tools/common.h,$(registry_common_OBJ_FILES:.o=.c))) ################################################ # Start BINARY regdiff @@ -102,7 +102,7 @@ PRIVATE_DEPENDENCIES = registry torture_registry_OBJ_FILES = $(addprefix $(libregistrysrcdir)/tests/, generic.o hive.o diff.o registry.o) -$(call proto_header_template,$(libregistrysrcdir)/tests/proto.h,$(torture_registry_OBJ_FILES:.o=.c)) +$(eval $(call proto_header_template,$(libregistrysrcdir)/tests/proto.h,$(torture_registry_OBJ_FILES:.o=.c))) [PYTHON::swig_registry] PUBLIC_DEPENDENCIES = registry diff --git a/source4/lib/samba3/config.mk b/source4/lib/samba3/config.mk index 05fb9a5b01..9665a8cbba 100644 --- a/source4/lib/samba3/config.mk +++ b/source4/lib/samba3/config.mk @@ -7,4 +7,4 @@ PRIVATE_DEPENDENCIES = CHARSET LIBSAMBA-UTIL SMBPASSWD_OBJ_FILES = $(libsrcdir)/samba3/smbpasswd.o -$(call proto_header_template,$(libsrcdir)/samba3_smbpasswd_proto.h,$(SMBPASSWD_OBJ_FILES:.o=.c)) +$(eval $(call proto_header_template,$(libsrcdir)/samba3_smbpasswd_proto.h,$(SMBPASSWD_OBJ_FILES:.o=.c))) diff --git a/source4/lib/socket/config.mk b/source4/lib/socket/config.mk index 9cbdd21614..18aa806e41 100644 --- a/source4/lib/socket/config.mk +++ b/source4/lib/socket/config.mk @@ -7,7 +7,7 @@ PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL LIBREPLACE_NETWORK LIBNETIF_OBJ_FILES = $(addprefix $(libsocketsrcdir)/, interface.o netif.o) -$(call proto_header_template,$(libsocketsrcdir)/netif_proto.h,$(LIBNETIF_OBJ_FILES:.o=.c)) +$(eval $(call proto_header_template,$(libsocketsrcdir)/netif_proto.h,$(LIBNETIF_OBJ_FILES:.o=.c))) ################################################ # Start MODULE socket_ip diff --git a/source4/lib/tdr/config.mk b/source4/lib/tdr/config.mk index 5419d12fa2..07506ec647 100644 --- a/source4/lib/tdr/config.mk +++ b/source4/lib/tdr/config.mk @@ -4,6 +4,6 @@ PUBLIC_DEPENDENCIES = LIBTALLOC LIBSAMBA-UTIL TDR_OBJ_FILES = $(libtdrsrcdir)/tdr.o -$(call proto_header_template,$(libtdrsrcdir)/tdr_proto.h,$(TDR_OBJ_FILES:.o=.c)) +$(eval $(call proto_header_template,$(libtdrsrcdir)/tdr_proto.h,$(TDR_OBJ_FILES:.o=.c))) PUBLIC_HEADERS += $(libtdrsrcdir)/tdr.h diff --git a/source4/lib/util/config.mk b/source4/lib/util/config.mk index e365082178..e9b8b38614 100644 --- a/source4/lib/util/config.mk +++ b/source4/lib/util/config.mk @@ -40,13 +40,13 @@ PUBLIC_HEADERS += $(addprefix $(libutilsrcdir)/, util.h \ ASN1_UTIL_OBJ_FILES = $(libutilsrcdir)/asn1.o -$(call proto_header_template,$(libutilsrcdir)/asn1_proto.h,$(ASN1_UTIL_OBJ_FILES:.o=.c)) +$(eval $(call proto_header_template,$(libutilsrcdir)/asn1_proto.h,$(ASN1_UTIL_OBJ_FILES:.o=.c))) [SUBSYSTEM::UNIX_PRIVS] UNIX_PRIVS_OBJ_FILES = $(libutilsrcdir)/unix_privs.o -$(call proto_header_template,$(libutilsrcdir)/unix_privs.h,$(UNIX_PRIVS_OBJ_FILES:.o=.c)) +$(eval $(call proto_header_template,$(libutilsrcdir)/unix_privs.h,$(UNIX_PRIVS_OBJ_FILES:.o=.c))) ################################################ # Start SUBSYSTEM WRAP_XATTR @@ -63,7 +63,7 @@ PUBLIC_DEPENDENCIES = LIBTDB UTIL_TDB_OBJ_FILES = $(libutilsrcdir)/util_tdb.o -$(call proto_header_template,$(libutilsrcdir)/util_tdb.h,$(UTIL_TDB_OBJ_FILES)) +$(eval $(call proto_header_template,$(libutilsrcdir)/util_tdb.h,$(UTIL_TDB_OBJ_FILES))) [SUBSYSTEM::UTIL_LDB] PUBLIC_DEPENDENCIES = LIBLDB -- cgit From 60ae8f06574c74261643f469e6be2a945fd90880 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 18 May 2008 23:40:23 +0200 Subject: Fix a bunch of dependencies. (This used to be commit a63f458462d207d215a6e4ef8e480b0c8daedf6a) --- source4/lib/crypto/config.mk | 2 +- source4/lib/ldb-samba/config.mk | 2 +- source4/lib/samba3/config.mk | 2 +- source4/lib/util/config.mk | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/crypto/config.mk b/source4/lib/crypto/config.mk index 6fef525dbf..b9a7f7cb9e 100644 --- a/source4/lib/crypto/config.mk +++ b/source4/lib/crypto/config.mk @@ -16,4 +16,4 @@ PRIVATE_DEPENDENCIES = LIBCRYPTO TORTURE_LIBCRYPTO_OBJ_FILES = $(addprefix $(libcryptosrcdir)/, \ md4test.o md5test.o hmacmd5test.o sha1test.o hmacsha1test.o) -$(eval $(call proto_header_template,$(libcryptosrcdir)/test_proto.h,$(TORTURE_LIBCRYPTO_OBJ_FILES))) +$(eval $(call proto_header_template,$(libcryptosrcdir)/test_proto.h,$(TORTURE_LIBCRYPTO_OBJ_FILES:.o=.c))) diff --git a/source4/lib/ldb-samba/config.mk b/source4/lib/ldb-samba/config.mk index ac071c9e10..84007f3833 100644 --- a/source4/lib/ldb-samba/config.mk +++ b/source4/lib/ldb-samba/config.mk @@ -7,5 +7,5 @@ PRIVATE_DEPENDENCIES = LIBSECURITY SAMDB_SCHEMA LIBNDR NDR_MISC ################################################ LDBSAMBA_OBJ_FILES = $(ldb_sambasrcdir)/ldif_handlers.o -$(eval $(call proto_header_template,$(ldb_sambasrcdir)/ldif_handlers.h,$(LDBSAMBA_OBJ_FILES))) +$(eval $(call proto_header_template,$(ldb_sambasrcdir)/ldif_handlers.h,$(LDBSAMBA_OBJ_FILES:.o=.c))) diff --git a/source4/lib/samba3/config.mk b/source4/lib/samba3/config.mk index 9665a8cbba..e089149393 100644 --- a/source4/lib/samba3/config.mk +++ b/source4/lib/samba3/config.mk @@ -7,4 +7,4 @@ PRIVATE_DEPENDENCIES = CHARSET LIBSAMBA-UTIL SMBPASSWD_OBJ_FILES = $(libsrcdir)/samba3/smbpasswd.o -$(eval $(call proto_header_template,$(libsrcdir)/samba3_smbpasswd_proto.h,$(SMBPASSWD_OBJ_FILES:.o=.c))) +$(eval $(call proto_header_template,$(libsrcdir)/samba3/samba3_smbpasswd_proto.h,$(SMBPASSWD_OBJ_FILES:.o=.c))) diff --git a/source4/lib/util/config.mk b/source4/lib/util/config.mk index e9b8b38614..925713a53c 100644 --- a/source4/lib/util/config.mk +++ b/source4/lib/util/config.mk @@ -63,7 +63,7 @@ PUBLIC_DEPENDENCIES = LIBTDB UTIL_TDB_OBJ_FILES = $(libutilsrcdir)/util_tdb.o -$(eval $(call proto_header_template,$(libutilsrcdir)/util_tdb.h,$(UTIL_TDB_OBJ_FILES))) +$(eval $(call proto_header_template,$(libutilsrcdir)/util_tdb.h,$(UTIL_TDB_OBJ_FILES:.o=.c))) [SUBSYSTEM::UTIL_LDB] PUBLIC_DEPENDENCIES = LIBLDB -- cgit From d817b435342956295f0a31b91203d1a63ae12063 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 19 May 2008 15:53:09 +0200 Subject: Fix a memleak in irpc_remove_name First, even when length==0 tdb_fetch might return something. Second, for some weird reason there might be less data than necessary for a single server id. (This used to be commit 49b04ca7aadf264e500d83bc8d3cb5173a86184e) --- source4/lib/messaging/messaging.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source4/lib') diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c index 19284461ee..e7b654894f 100644 --- a/source4/lib/messaging/messaging.c +++ b/source4/lib/messaging/messaging.c @@ -1085,8 +1085,14 @@ void irpc_remove_name(struct messaging_context *msg_ctx, const char *name) return; } rec = tdb_fetch_bystring(t->tdb, name); + if (rec.dptr == NULL) { + tdb_unlock_bystring(t->tdb, name); + talloc_free(t); + return; + } count = rec.dsize / sizeof(struct server_id); if (count == 0) { + free(rec.dptr); tdb_unlock_bystring(t->tdb, name); talloc_free(t); return; -- cgit From ae4611909609b8a0466938171812f10974dc054a Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 19 May 2008 23:07:04 +0200 Subject: Add __repr__ implementations for ldb.Message, ldb.MessageElement and ldb.Dn. (This used to be commit b9119c0f0f524d43ff09825dffb24a5e77a240f4) --- source4/lib/ldb/ldb.i | 50 ++++++++++++++++++++++++++++++---- source4/lib/ldb/ldb.py | 30 +++++++++++++++++++-- source4/lib/ldb/ldb_wrap.c | 54 ++++++++++++++++++++++++++++++------- source4/lib/ldb/tests/python/api.py | 38 +++++++++++++++++++++++++- 4 files changed, 155 insertions(+), 17 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/ldb.i b/source4/lib/ldb/ldb.i index 6b94f19cb5..75482011fb 100644 --- a/source4/lib/ldb/ldb.i +++ b/source4/lib/ldb/ldb.i @@ -229,6 +229,14 @@ fail: return ldb_dn_canonical_ex_string($self, $self); } #ifdef SWIGPYTHON + char *__repr__(void) + { + char *dn = ldb_dn_get_linearized($self), *ret; + asprintf(&ret, "Dn('%s')", dn); + talloc_free(dn); + return ret; + } + ldb_dn *__add__(ldb_dn *other) { ldb_dn *ret = ldb_dn_copy(NULL, $self); @@ -376,6 +384,9 @@ typedef struct ldb_message_element { raise KeyError("no such value") return ret + def __repr__(self): + return "MessageElement([%s])" % (",".join(repr(x) for x in self.__set__())) + def __eq__(self, other): if (len(self) == 1 and self.get(0) == other): return True @@ -400,17 +411,22 @@ typedef struct ldb_message_element { else $result = SWIG_NewPointerObj($1, SWIGTYPE_p_ldb_message_element, 0); } -%rename(__getitem__) ldb_message::find_element; //%typemap(out) ldb_msg_element *; %inline { PyObject *ldb_msg_list_elements(ldb_msg *msg) { - int i; - PyObject *obj = PyList_New(msg->num_elements); - for (i = 0; i < msg->num_elements; i++) - PyList_SetItem(obj, i, PyString_FromString(msg->elements[i].name)); + int i, j = 0; + PyObject *obj = PyList_New(msg->num_elements+(msg->dn != NULL?1:0)); + if (msg->dn != NULL) { + PyList_SetItem(obj, j, PyString_FromString("dn")); + j++; + } + for (i = 0; i < msg->num_elements; i++) { + PyList_SetItem(obj, j, PyString_FromString(msg->elements[i].name)); + j++; + } return obj; } } @@ -466,6 +482,28 @@ typedef struct ldb_message { } #endif void remove_attr(const char *name); +%pythoncode { + def get(self, key, default=None): + if key == "dn": + return self.dn + return self.find_element(key) + + def __getitem__(self, key): + ret = self.get(key, None) + if ret is None: + raise KeyError("No such element") + return ret + + def iteritems(self): + for k in self.keys(): + yield k, self[k] + + def items(self): + return list(self.iteritems()) + + def __repr__(self): + return "Message(%s)" % repr(dict(self.iteritems())) +} } } ldb_msg; @@ -753,6 +791,8 @@ typedef struct ldb_context { def search(self, base=None, scope=SCOPE_DEFAULT, expression=None, attrs=None, controls=None): + if not (attrs is None or isinstance(attrs, list)): + raise TypeError("attributes not a list") parsed_controls = None if controls is not None: parsed_controls = self.parse_control_strings(controls) diff --git a/source4/lib/ldb/ldb.py b/source4/lib/ldb/ldb.py index b148782c63..60644d352c 100644 --- a/source4/lib/ldb/ldb.py +++ b/source4/lib/ldb/ldb.py @@ -68,7 +68,6 @@ CHANGETYPE_MODIFY = _ldb.CHANGETYPE_MODIFY ldb_val_to_py_object = _ldb.ldb_val_to_py_object class Dn(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): _ldb.Dn_swiginit(self,_ldb.new_Dn(*args, **kwargs)) __swig_destroy__ = _ldb.delete_Dn @@ -93,6 +92,7 @@ Dn.add_child = new_instancemethod(_ldb.Dn_add_child,None,Dn) Dn.add_base = new_instancemethod(_ldb.Dn_add_base,None,Dn) Dn.canonical_str = new_instancemethod(_ldb.Dn_canonical_str,None,Dn) Dn.canonical_ex_str = new_instancemethod(_ldb.Dn_canonical_ex_str,None,Dn) +Dn.__repr__ = new_instancemethod(_ldb.Dn___repr__,None,Dn) Dn.__add__ = new_instancemethod(_ldb.Dn___add__,None,Dn) Dn_swigregister = _ldb.Dn_swigregister Dn_swigregister(Dn) @@ -108,6 +108,9 @@ class ldb_msg_element(object): raise KeyError("no such value") return ret + def __repr__(self): + return "MessageElement([%s])" % (",".join(repr(x) for x in self.__set__())) + def __eq__(self, other): if (len(self) == 1 and self.get(0) == other): return True @@ -139,7 +142,28 @@ class Message(object): def __init__(self, *args, **kwargs): _ldb.Message_swiginit(self,_ldb.new_Message(*args, **kwargs)) __swig_destroy__ = _ldb.delete_Message -Message.__getitem__ = new_instancemethod(_ldb.Message___getitem__,None,Message) + def get(self, key, default=None): + if key == "dn": + return self.dn + return self.find_element(key) + + def __getitem__(self, key): + ret = self.get(key, None) + if ret is None: + raise KeyError("No such element") + return ret + + def iteritems(self): + for k in self.keys(): + yield k, self[k] + + def items(self): + return list(self.iteritems()) + + def __repr__(self): + return "Message(%s)" % repr(dict(self.iteritems())) + +Message.find_element = new_instancemethod(_ldb.Message_find_element,None,Message) Message.__setitem__ = new_instancemethod(_ldb.Message___setitem__,None,Message) Message.__len__ = new_instancemethod(_ldb.Message___len__,None,Message) Message.keys = new_instancemethod(_ldb.Message_keys,None,Message) @@ -202,6 +226,8 @@ class Ldb(object): def search(self, base=None, scope=SCOPE_DEFAULT, expression=None, attrs=None, controls=None): + if not (attrs is None or isinstance(attrs, list)): + raise TypeError("attributes not a list") parsed_controls = None if controls is not None: parsed_controls = self.parse_control_strings(controls) diff --git a/source4/lib/ldb/ldb_wrap.c b/source4/lib/ldb/ldb_wrap.c index 390652eebe..f13ed4dc3b 100644 --- a/source4/lib/ldb/ldb_wrap.c +++ b/source4/lib/ldb/ldb_wrap.c @@ -2719,6 +2719,12 @@ SWIGINTERN char const *ldb_dn_canonical_str(ldb_dn *self){ SWIGINTERN char const *ldb_dn_canonical_ex_str(ldb_dn *self){ return ldb_dn_canonical_ex_string(self, self); } +SWIGINTERN char *ldb_dn___repr__(ldb_dn *self){ + char *dn = ldb_dn_get_linearized(self), *ret; + asprintf(&ret, "Dn('%s')", dn); + talloc_free(dn); + return ret; + } SWIGINTERN ldb_dn *ldb_dn___add__(ldb_dn *self,ldb_dn *other){ ldb_dn *ret = ldb_dn_copy(NULL, self); ldb_dn_add_child(ret, other); @@ -2970,10 +2976,16 @@ SWIGINTERN void delete_ldb_msg_element(ldb_msg_element *self){ talloc_free(self) PyObject *ldb_msg_list_elements(ldb_msg *msg) { - int i; - PyObject *obj = PyList_New(msg->num_elements); - for (i = 0; i < msg->num_elements; i++) - PyList_SetItem(obj, i, PyString_FromString(msg->elements[i].name)); + int i, j = 0; + PyObject *obj = PyList_New(msg->num_elements+(msg->dn != NULL?1:0)); + if (msg->dn != NULL) { + PyList_SetItem(obj, j, PyString_FromString("dn")); + j++; + } + for (i = 0; i < msg->num_elements; i++) { + PyList_SetItem(obj, j, PyString_FromString(msg->elements[i].name)); + j++; + } return obj; } @@ -3678,6 +3690,29 @@ fail: } +SWIGINTERN PyObject *_wrap_Dn___repr__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ldb_dn *arg1 = (ldb_dn *) 0 ; + char *result = 0 ; + 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_dn, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Dn___repr__" "', argument " "1"" of type '" "ldb_dn *""'"); + } + arg1 = (ldb_dn *)(argp1); + result = (char *)ldb_dn___repr__(arg1); + resultobj = SWIG_FromCharPtr((const char *)result); + return resultobj; +fail: + return NULL; +} + + SWIGINTERN PyObject *_wrap_Dn___add__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; ldb_dn *arg1 = (ldb_dn *) 0 ; @@ -4074,7 +4109,7 @@ fail: } -SWIGINTERN PyObject *_wrap_Message___getitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_Message_find_element(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; ldb_msg *arg1 = (ldb_msg *) 0 ; char *arg2 = (char *) 0 ; @@ -4090,15 +4125,15 @@ SWIGINTERN PyObject *_wrap_Message___getitem__(PyObject *SWIGUNUSEDPARM(self), P (char *) "self",(char *) "name", NULL }; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Message___getitem__",kwnames,&obj0,&obj1)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Message_find_element",kwnames,&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_message, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Message___getitem__" "', argument " "1"" of type '" "ldb_msg *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Message_find_element" "', argument " "1"" of type '" "ldb_msg *""'"); } arg1 = (ldb_msg *)(argp1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Message___getitem__" "', argument " "2"" of type '" "char const *""'"); + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Message_find_element" "', argument " "2"" of type '" "char const *""'"); } arg2 = (char *)(buf2); if (arg1 == NULL) @@ -5673,6 +5708,7 @@ static PyMethodDef SwigMethods[] = { { (char *)"Dn_add_base", (PyCFunction) _wrap_Dn_add_base, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Dn_canonical_str", (PyCFunction)_wrap_Dn_canonical_str, METH_O, NULL}, { (char *)"Dn_canonical_ex_str", (PyCFunction)_wrap_Dn_canonical_ex_str, METH_O, NULL}, + { (char *)"Dn___repr__", (PyCFunction)_wrap_Dn___repr__, METH_O, NULL}, { (char *)"Dn___add__", (PyCFunction) _wrap_Dn___add__, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Dn_swigregister", Dn_swigregister, METH_VARARGS, NULL}, { (char *)"Dn_swiginit", Dn_swiginit, METH_VARARGS, NULL}, @@ -5689,7 +5725,7 @@ static PyMethodDef SwigMethods[] = { { (char *)"Message_dn_get", (PyCFunction)_wrap_Message_dn_get, METH_O, NULL}, { (char *)"new_Message", (PyCFunction) _wrap_new_Message, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"delete_Message", (PyCFunction)_wrap_delete_Message, METH_O, NULL}, - { (char *)"Message___getitem__", (PyCFunction) _wrap_Message___getitem__, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"Message_find_element", (PyCFunction) _wrap_Message_find_element, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Message___setitem__", _wrap_Message___setitem__, METH_VARARGS, NULL}, { (char *)"Message___len__", (PyCFunction)_wrap_Message___len__, METH_O, NULL}, { (char *)"Message_keys", (PyCFunction)_wrap_Message_keys, METH_O, NULL}, diff --git a/source4/lib/ldb/tests/python/api.py b/source4/lib/ldb/tests/python/api.py index 5f3f727b5d..6f073f79a8 100755 --- a/source4/lib/ldb/tests/python/api.py +++ b/source4/lib/ldb/tests/python/api.py @@ -60,6 +60,10 @@ class SimpleLdb(unittest.TestCase): l = ldb.Ldb("foo.tdb") self.assertEquals(len(l.search("", ldb.SCOPE_SUBTREE, "(dc=*)", ["dc"])), 0) + def test_search_attr_string(self): + l = ldb.Ldb("foo.tdb") + self.assertRaises(TypeError, l.search, attrs="dc") + def test_opaque(self): l = ldb.Ldb("foo.tdb") l.set_opaque("my_opaque", l) @@ -257,6 +261,10 @@ class DnTests(unittest.TestCase): x = ldb.Dn(self.ldb, "dc=foo,bar=bloe") self.assertEquals(x.__str__(), "dc=foo,bar=bloe") + def test_repr(self): + x = ldb.Dn(self.ldb, "dc=foo,bla=blie") + self.assertEquals(x.__repr__(), "Dn('dc=foo,bla=blie')") + def test_get_casefold(self): x = ldb.Dn(self.ldb, "dc=foo,bar=bloe") self.assertEquals(x.get_casefold(), "DC=FOO,BAR=bloe") @@ -347,6 +355,16 @@ class LdbMsgTests(unittest.TestCase): self.msg = ldb.Message(ldb.Dn(ldb.Ldb(), "dc=foo")) self.assertEquals("dc=foo", str(self.msg.dn)) + def test_iter_items(self): + self.assertEquals(0, len(self.msg.items())) + self.msg.dn = ldb.Dn(ldb.Ldb("foo.tdb"), "dc=foo") + self.assertEquals(1, len(self.msg.items())) + + def test_repr(self): + self.msg.dn = ldb.Dn(ldb.Ldb("foo.tdb"), "dc=foo") + self.msg["dc"] = "foo" + self.assertEquals("Message({'dn': Dn('dc=foo'), 'dc': MessageElement(['foo'])})", repr(self.msg)) + def test_len(self): self.assertEquals(0, len(self.msg)) @@ -374,14 +392,26 @@ class LdbMsgTests(unittest.TestCase): self.assertEquals(["bar"], list(self.msg["foo"])) def test_keys(self): + self.msg.dn = ldb.Dn(ldb.Ldb("foo.tdb"), "@BASEINFO") self.msg["foo"] = ["bla"] self.msg["bar"] = ["bla"] - self.assertEquals(["foo", "bar"], self.msg.keys()) + self.assertEquals(["dn", "foo", "bar"], self.msg.keys()) def test_dn(self): self.msg.dn = ldb.Dn(ldb.Ldb("foo.tdb"), "@BASEINFO") self.assertEquals("@BASEINFO", self.msg.dn.__str__()) + def test_get_dn(self): + self.msg.dn = ldb.Dn(ldb.Ldb("foo.tdb"), "@BASEINFO") + self.assertEquals("@BASEINFO", self.msg.get("dn").__str__()) + + def test_get_other(self): + self.msg["foo"] = ["bar"] + self.assertEquals("bar", self.msg.get("foo")[0]) + + def test_get_unknown(self): + self.assertRaises(KeyError, self.msg.get, "lalalala") + class MessageElementTests(unittest.TestCase): def test_cmp_element(self): @@ -395,6 +425,12 @@ class MessageElementTests(unittest.TestCase): x = ldb.MessageElement(["foo"]) self.assertEquals(["foo"], list(x)) + def test_repr(self): + x = ldb.MessageElement(["foo"]) + self.assertEquals("MessageElement(['foo'])", repr(x)) + x = ldb.MessageElement(["foo", "bla"]) + self.assertEquals("MessageElement(['foo','bla'])", repr(x)) + def test_get_item(self): x = ldb.MessageElement(["foo", "bar"]) self.assertEquals("foo", x[0]) -- cgit From 43a22c9b4a7868a740e2de417f50702209d2aced Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 19 May 2008 23:12:13 +0200 Subject: Add __repr__ implementation for Ldb. (This used to be commit 5607aea07f66f09fd5b33842d07d2fbbf44d13e7) --- source4/lib/ldb/ldb.i | 6 ++++++ source4/lib/ldb/ldb.py | 2 +- source4/lib/ldb/ldb_wrap.c | 32 ++++++++++++++++++++++++++++++++ source4/lib/ldb/tests/python/api.py | 4 ++++ 4 files changed, 43 insertions(+), 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/ldb.i b/source4/lib/ldb/ldb.i index 75482011fb..18e981f7be 100644 --- a/source4/lib/ldb/ldb.i +++ b/source4/lib/ldb/ldb.i @@ -781,6 +781,12 @@ typedef struct ldb_context { return PyObject_GetIter(list); } + char *__repr__(void) + { + char *ret; + asprintf(&ret, "", ret); + return ret; + } #endif } %pythoncode { diff --git a/source4/lib/ldb/ldb.py b/source4/lib/ldb/ldb.py index 60644d352c..e9f4055fbf 100644 --- a/source4/lib/ldb/ldb.py +++ b/source4/lib/ldb/ldb.py @@ -215,7 +215,6 @@ LDB_ERR_AFFECTS_MULTIPLE_DSAS = _ldb.LDB_ERR_AFFECTS_MULTIPLE_DSAS LDB_ERR_OTHER = _ldb.LDB_ERR_OTHER class Ldb(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): _ldb.Ldb_swiginit(self,_ldb.new_Ldb(*args, **kwargs)) __swig_destroy__ = _ldb.delete_Ldb @@ -260,6 +259,7 @@ Ldb.schema_attribute_add = new_instancemethod(_ldb.Ldb_schema_attribute_add,None Ldb.setup_wellknown_attributes = new_instancemethod(_ldb.Ldb_setup_wellknown_attributes,None,Ldb) Ldb.__contains__ = new_instancemethod(_ldb.Ldb___contains__,None,Ldb) Ldb.parse_ldif = new_instancemethod(_ldb.Ldb_parse_ldif,None,Ldb) +Ldb.__repr__ = new_instancemethod(_ldb.Ldb___repr__,None,Ldb) Ldb_swigregister = _ldb.Ldb_swigregister Ldb_swigregister(Ldb) diff --git a/source4/lib/ldb/ldb_wrap.c b/source4/lib/ldb/ldb_wrap.c index f13ed4dc3b..d787266416 100644 --- a/source4/lib/ldb/ldb_wrap.c +++ b/source4/lib/ldb/ldb_wrap.c @@ -3200,6 +3200,11 @@ SWIGINTERN PyObject *ldb_parse_ldif(ldb *self,char const *s){ } return PyObject_GetIter(list); } +SWIGINTERN char *ldb___repr__(ldb *self){ + char *ret; + asprintf(&ret, "", ret); + return ret; + } static char *timestring(time_t t) { @@ -5573,6 +5578,32 @@ fail: } +SWIGINTERN PyObject *_wrap_Ldb___repr__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ldb *arg1 = (ldb *) 0 ; + char *result = 0 ; + 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_context, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb___repr__" "', argument " "1"" of type '" "ldb *""'"); + } + arg1 = (ldb *)(argp1); + if (arg1 == NULL) + SWIG_exception(SWIG_ValueError, + "ldb context must be non-NULL"); + result = (char *)ldb___repr__(arg1); + resultobj = SWIG_FromCharPtr((const char *)result); + return resultobj; +fail: + return NULL; +} + + SWIGINTERN PyObject *Ldb_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL; @@ -5762,6 +5793,7 @@ static PyMethodDef SwigMethods[] = { { (char *)"Ldb_setup_wellknown_attributes", (PyCFunction)_wrap_Ldb_setup_wellknown_attributes, METH_O, NULL}, { (char *)"Ldb___contains__", (PyCFunction) _wrap_Ldb___contains__, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Ldb_parse_ldif", (PyCFunction) _wrap_Ldb_parse_ldif, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"Ldb___repr__", (PyCFunction)_wrap_Ldb___repr__, METH_O, NULL}, { (char *)"Ldb_swigregister", Ldb_swigregister, METH_VARARGS, NULL}, { (char *)"Ldb_swiginit", Ldb_swiginit, METH_VARARGS, NULL}, { (char *)"valid_attr_name", (PyCFunction) _wrap_valid_attr_name, METH_VARARGS | METH_KEYWORDS, NULL}, diff --git a/source4/lib/ldb/tests/python/api.py b/source4/lib/ldb/tests/python/api.py index 6f073f79a8..1ae3fde744 100755 --- a/source4/lib/ldb/tests/python/api.py +++ b/source4/lib/ldb/tests/python/api.py @@ -36,6 +36,10 @@ class SimpleLdb(unittest.TestCase): x = ldb.Ldb() x.connect("foo.tdb") + def test_repr(self): + x = ldb.Ldb() + self.assertTrue(repr(x).startswith(" Date: Mon, 19 May 2008 23:36:11 +0200 Subject: Fix dependency. (This used to be commit d8fe782dc200907e0364c623e187c51f4d44edb2) --- source4/lib/tdb/tdb.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/tdb/tdb.mk b/source4/lib/tdb/tdb.mk index c91b1289cb..fa8db6d34c 100644 --- a/source4/lib/tdb/tdb.mk +++ b/source4/lib/tdb/tdb.mk @@ -50,7 +50,7 @@ install-python:: build-python cp $(tdbdir)/tdb.py $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(0, prefix='$(prefix)')"` cp _tdb.$(SHLIBEXT) $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(1, prefix='$(prefix)')"` -check-python:: build-python +check-python:: build-python $(TDB_SONAME) $(LIB_PATH_VAR)=. PYTHONPATH=".:$(tdbdir)" $(PYTHON) $(tdbdir)/python/tests/simple.py install-swig:: -- cgit From 1b4b8d5e78e553c759c16c1605b610498fddf77b Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 19 May 2008 23:36:33 +0200 Subject: Add __repr__ implementation for Tdb. (This used to be commit 205699ed663a3c6d27695dee25bf26978615b475) --- source4/lib/tdb/python/tests/simple.py | 7 ++-- source4/lib/tdb/tdb.i | 4 +-- source4/lib/tdb/tdb.py | 8 ++--- source4/lib/tdb/tdb_wrap.c | 65 ++++++++++++++++++++++++---------- 4 files changed, 57 insertions(+), 27 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/tdb/python/tests/simple.py b/source4/lib/tdb/python/tests/simple.py index 94407b6398..7147718c91 100644 --- a/source4/lib/tdb/python/tests/simple.py +++ b/source4/lib/tdb/python/tests/simple.py @@ -3,8 +3,8 @@ # Note that this tests the interface of the Python bindings # It does not test tdb itself. # -# Copyright (C) 2007 Jelmer Vernooij -# Published under the GNU LGPL +# Copyright (C) 2007-2008 Jelmer Vernooij +# Published under the GNU LGPLv3 or later import tdb from unittest import TestCase @@ -25,6 +25,9 @@ class SimpleTdbTests(TestCase): def tearDown(self): del self.tdb + def test_repr(self): + self.assertTrue(repr(self.tdb).startswith("Tdb('")) + def test_lockall(self): self.tdb.lock_all() diff --git a/source4/lib/tdb/tdb.i b/source4/lib/tdb/tdb.i index c82d2d0a6d..704f0facc6 100644 --- a/source4/lib/tdb/tdb.i +++ b/source4/lib/tdb/tdb.i @@ -182,8 +182,8 @@ typedef struct tdb_context { } %pythoncode { - def __str__(self): - return self.name() + def __repr__(self): + return "Tdb('%s')" % self.name() # Random access to keys, values def __getitem__(self, key): diff --git a/source4/lib/tdb/tdb.py b/source4/lib/tdb/tdb.py index 0effa3ff98..eb76ca6459 100644 --- a/source4/lib/tdb/tdb.py +++ b/source4/lib/tdb/tdb.py @@ -1,5 +1,5 @@ # This file was automatically generated by SWIG (http://www.swig.org). -# Version 1.3.33 +# Version 1.3.35 # # Don't modify this file, modify the SWIG interface instead. @@ -80,11 +80,11 @@ TDB_ERR_EINVAL = _tdb.TDB_ERR_EINVAL TDB_ERR_RDONLY = _tdb.TDB_ERR_RDONLY class tdb(object): thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') - def __init__(self): raise AttributeError, "No constructor defined" + def __init__(self, *args, **kwargs): raise AttributeError, "No constructor defined" __repr__ = _swig_repr __swig_destroy__ = _tdb.delete_tdb - def __str__(self): - return self.name() + def __repr__(self): + return "Tdb('%s')" % self.name() def __getitem__(self, key): diff --git a/source4/lib/tdb/tdb_wrap.c b/source4/lib/tdb/tdb_wrap.c index 6a5b7feffc..f36d569937 100644 --- a/source4/lib/tdb/tdb_wrap.c +++ b/source4/lib/tdb/tdb_wrap.c @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 1.3.33 + * Version 1.3.35 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make @@ -126,7 +126,7 @@ /* This should only be incremented when either the layout of swig_type_info changes, or for whatever reason, the runtime changes incompatibly */ -#define SWIG_RUNTIME_VERSION "3" +#define SWIG_RUNTIME_VERSION "4" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE @@ -161,6 +161,7 @@ /* Flags for pointer conversions */ #define SWIG_POINTER_DISOWN 0x1 +#define SWIG_CAST_NEW_MEMORY 0x2 /* Flags for new pointer objects */ #define SWIG_POINTER_OWN 0x1 @@ -301,10 +302,10 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) { extern "C" { #endif -typedef void *(*swig_converter_func)(void *); +typedef void *(*swig_converter_func)(void *, int *); typedef struct swig_type_info *(*swig_dycast_func)(void **); -/* Structure to store inforomation on one type */ +/* Structure to store information on one type */ typedef struct swig_type_info { const char *name; /* mangled name of this type */ const char *str; /* human readable name of this type */ @@ -431,8 +432,8 @@ SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) { Cast a pointer up an inheritance hierarchy */ SWIGRUNTIMEINLINE void * -SWIG_TypeCast(swig_cast_info *ty, void *ptr) { - return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr); +SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { + return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); } /* @@ -856,7 +857,7 @@ SWIG_Python_AddErrorMsg(const char* mesg) Py_DECREF(old_str); Py_DECREF(value); } else { - PyErr_Format(PyExc_RuntimeError, mesg); + PyErr_SetString(PyExc_RuntimeError, mesg); } } @@ -1416,7 +1417,7 @@ PySwigObject_dealloc(PyObject *v) { PySwigObject *sobj = (PySwigObject *) v; PyObject *next = sobj->next; - if (sobj->own) { + if (sobj->own == SWIG_POINTER_OWN) { swig_type_info *ty = sobj->ty; PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0; PyObject *destroy = data ? data->destroy : 0; @@ -1434,12 +1435,13 @@ PySwigObject_dealloc(PyObject *v) res = ((*meth)(mself, v)); } Py_XDECREF(res); - } else { - const char *name = SWIG_TypePrettyName(ty); + } #if !defined(SWIG_PYTHON_SILENT_MEMLEAK) - printf("swig/python detected a memory leak of type '%s', no destructor found.\n", name); -#endif + else { + const char *name = SWIG_TypePrettyName(ty); + printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown")); } +#endif } Py_XDECREF(next); PyObject_DEL(v); @@ -1944,7 +1946,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) SWIGRUNTIME int SWIG_Python_AcquirePtr(PyObject *obj, int own) { - if (own) { + if (own == SWIG_POINTER_OWN) { PySwigObject *sobj = SWIG_Python_GetSwigThis(obj); if (sobj) { int oldown = sobj->own; @@ -1965,6 +1967,8 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int return SWIG_OK; } else { PySwigObject *sobj = SWIG_Python_GetSwigThis(obj); + if (own) + *own = 0; while (sobj) { void *vptr = sobj->ptr; if (ty) { @@ -1978,7 +1982,15 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int if (!tc) { sobj = (PySwigObject *)sobj->next; } else { - if (ptr) *ptr = SWIG_TypeCast(tc,vptr); + if (ptr) { + int newmemory = 0; + *ptr = SWIG_TypeCast(tc,vptr,&newmemory); + if (newmemory == SWIG_CAST_NEW_MEMORY) { + assert(own); + if (own) + *own = *own | SWIG_CAST_NEW_MEMORY; + } + } break; } } @@ -1988,7 +2000,8 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int } } if (sobj) { - if (own) *own = sobj->own; + if (own) + *own = *own | sobj->own; if (flags & SWIG_POINTER_DISOWN) { sobj->own = 0; } @@ -2053,8 +2066,13 @@ SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) { } if (ty) { swig_cast_info *tc = SWIG_TypeCheck(desc,ty); - if (!tc) return SWIG_ERROR; - *ptr = SWIG_TypeCast(tc,vptr); + if (tc) { + int newmemory = 0; + *ptr = SWIG_TypeCast(tc,vptr,&newmemory); + assert(!newmemory); /* newmemory handling not yet implemented */ + } else { + return SWIG_ERROR; + } } else { *ptr = vptr; } @@ -2500,7 +2518,7 @@ static swig_module_info swig_module = {swig_types, 11, 0, 0, 0, 0}; #define SWIG_name "_tdb" -#define SWIGVERSION 0x010333 +#define SWIGVERSION 0x010335 #define SWIG_VERSION SWIGVERSION @@ -3753,7 +3771,7 @@ SWIGRUNTIME void SWIG_InitializeModule(void *clientdata) { size_t i; swig_module_info *module_head, *iter; - int found; + int found, init; clientdata = clientdata; @@ -3763,6 +3781,9 @@ SWIG_InitializeModule(void *clientdata) { swig_module.type_initial = swig_type_initial; swig_module.cast_initial = swig_cast_initial; swig_module.next = &swig_module; + init = 1; + } else { + init = 0; } /* Try and load any already created modules */ @@ -3791,6 +3812,12 @@ SWIG_InitializeModule(void *clientdata) { module_head->next = &swig_module; } + /* When multiple interpeters are used, a module could have already been initialized in + a different interpreter, but not yet have a pointer in this interpreter. + In this case, we do not want to continue adding types... everything should be + set up already */ + if (init == 0) return; + /* Now work on filling in swig_module.types */ #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: size %d\n", swig_module.size); -- cgit From 7015b7840c0e8bc85c77de2442b46a8c71449163 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 20 May 2008 01:52:11 +0200 Subject: Update tdb version number. (This used to be commit eae17ae8ecdcb83fdb756189a9d5609a192371a4) --- source4/lib/tdb/configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/tdb/configure.ac b/source4/lib/tdb/configure.ac index 9b16a82c33..eaf70d30b4 100644 --- a/source4/lib/tdb/configure.ac +++ b/source4/lib/tdb/configure.ac @@ -2,7 +2,7 @@ AC_PREREQ(2.50) AC_DEFUN([SMB_MODULE_DEFAULT], [echo -n ""]) AC_DEFUN([SMB_LIBRARY_ENABLE], [echo -n ""]) AC_DEFUN([SMB_ENABLE], [echo -n ""]) -AC_INIT(tdb, 1.1.1) +AC_INIT(tdb, 1.1.2) AC_CONFIG_SRCDIR([common/tdb.c]) AC_CONFIG_HEADER(include/config.h) AC_LIBREPLACE_ALL_CHECKS -- cgit From 9a975a868e949e61cb011422363cd07b4ec0ce43 Mon Sep 17 00:00:00 2001 From: James Peach Date: Tue, 20 May 2008 10:54:45 -0700 Subject: smbtorture: Add RAW-BENCH-TCON benchmark. Add a simple test to benchmark the rate at which a server can accept new tree connections. You can tune the length of time to run the benchmark for and the number of parallel connections to make. (This used to be commit ea3f4b93057e85c4ea516cc77dd0f293016d520c) --- source4/lib/util/time.c | 2 +- source4/lib/util/time.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/util/time.c b/source4/lib/util/time.c index a181885806..978d73cc0a 100644 --- a/source4/lib/util/time.c +++ b/source4/lib/util/time.c @@ -376,7 +376,7 @@ _PUBLIC_ NTTIME pull_nttime(uint8_t *base, uint16_t offset) /** return (tv1 - tv2) in microseconds */ -_PUBLIC_ int64_t usec_time_diff(struct timeval *tv1, struct timeval *tv2) +_PUBLIC_ int64_t usec_time_diff(const struct timeval *tv1, const struct timeval *tv2) { int64_t sec_diff = tv1->tv_sec - tv2->tv_sec; return (sec_diff * 1000000) + (int64_t)(tv1->tv_usec - tv2->tv_usec); diff --git a/source4/lib/util/time.h b/source4/lib/util/time.h index 1ab976ca78..e4008c5782 100644 --- a/source4/lib/util/time.h +++ b/source4/lib/util/time.h @@ -127,7 +127,7 @@ _PUBLIC_ NTTIME nttime_from_string(const char *s); /** return (tv1 - tv2) in microseconds */ -_PUBLIC_ int64_t usec_time_diff(struct timeval *tv1, struct timeval *tv2); +_PUBLIC_ int64_t usec_time_diff(const struct timeval *tv1, const struct timeval *tv2); /** return a zero timeval -- cgit From aa7e4b8e9cafaa5139b5111aa8ca042e6b6f65f4 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 20 May 2008 21:54:36 +0200 Subject: Fix nesting tdb_traverse in a transaction Calling tdb_traverse inside a transaction led to the transaction lock being held indefinitely. This was caused by the tdb_transaction_lock/unlock inside tdb_traverse: The transaction code holds the global lock at offset TRANSACTION_LOCK. The call to tdb_transaction_lock does nothing because the transaction_lock is already being held. tdb_transaction_unlock inside tdb_wrap resets tdb->have_transaction_lock but does not release the kernel-level fcntl lock. transaction_commit later on does not release that fcntl lock either, because tdb->have_transaction_lock was already reset by tdb_transaction(). This patch does fix that problem for me. An alternative would be to make tdb->have_transaction_lock a counter that can cope with proper nesting, maybe in other places as well. Volker (This used to be commit 89543005fe2e4934b3c560c937d49304a32a7fc2) --- source4/lib/tdb/common/traverse.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/tdb/common/traverse.c b/source4/lib/tdb/common/traverse.c index 07b0c23858..5a31742e7b 100644 --- a/source4/lib/tdb/common/traverse.c +++ b/source4/lib/tdb/common/traverse.c @@ -232,20 +232,25 @@ int tdb_traverse(struct tdb_context *tdb, { struct tdb_traverse_lock tl = { NULL, 0, 0, F_WRLCK }; int ret; + int in_transaction = (tdb->transaction != NULL); if (tdb->read_only || tdb->traverse_read) { return tdb_traverse_read(tdb, fn, private_data); } - if (tdb_transaction_lock(tdb, F_WRLCK)) { - return -1; + if (!in_transaction) { + if (tdb_transaction_lock(tdb, F_WRLCK)) { + return -1; + } } tdb->traverse_write++; ret = tdb_traverse_internal(tdb, fn, private_data, &tl); tdb->traverse_write--; - tdb_transaction_unlock(tdb); + if (!in_transaction) { + tdb_transaction_unlock(tdb); + } return ret; } -- cgit From 6d4424cd45333c3029b0272528485dd2b3f8e620 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 20 May 2008 14:18:58 -0700 Subject: Convert in_transaction to a bool. Add the same fix Volker used for tdb_traverse() to tdb_traverse_read(). Jeremy. (This used to be commit e05ec3047c4fe0cc2e09a812830fc835dc35abea) --- source4/lib/tdb/common/traverse.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/tdb/common/traverse.c b/source4/lib/tdb/common/traverse.c index 5a31742e7b..69c81e6e98 100644 --- a/source4/lib/tdb/common/traverse.c +++ b/source4/lib/tdb/common/traverse.c @@ -204,18 +204,23 @@ int tdb_traverse_read(struct tdb_context *tdb, { struct tdb_traverse_lock tl = { NULL, 0, 0, F_RDLCK }; int ret; + bool in_transaction = (tdb->transaction != NULL); /* we need to get a read lock on the transaction lock here to cope with the lock ordering semantics of solaris10 */ - if (tdb_transaction_lock(tdb, F_RDLCK)) { - return -1; + if (!in_transaction) { + if (tdb_transaction_lock(tdb, F_RDLCK)) { + return -1; + } } tdb->traverse_read++; ret = tdb_traverse_internal(tdb, fn, private_data, &tl); tdb->traverse_read--; - tdb_transaction_unlock(tdb); + if (!in_transaction) { + tdb_transaction_unlock(tdb); + } return ret; } @@ -232,7 +237,7 @@ int tdb_traverse(struct tdb_context *tdb, { struct tdb_traverse_lock tl = { NULL, 0, 0, F_WRLCK }; int ret; - int in_transaction = (tdb->transaction != NULL); + bool in_transaction = (tdb->transaction != NULL); if (tdb->read_only || tdb->traverse_read) { return tdb_traverse_read(tdb, fn, private_data); -- cgit From 721332411aac09b096f6add77c7c59c0a300ba1c Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 21 May 2008 14:29:05 +0200 Subject: Regenerate with newer version of swig. (This used to be commit 034c68bea934db87bce13a750c17fb1bd2bbe3b6) --- source4/lib/events/events.py | 2 +- source4/lib/events/events_wrap.c | 65 ++++++++++++++++++++++++++++------------ 2 files changed, 47 insertions(+), 20 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/events/events.py b/source4/lib/events/events.py index d8f70f6319..237726897d 100644 --- a/source4/lib/events/events.py +++ b/source4/lib/events/events.py @@ -1,5 +1,5 @@ # This file was automatically generated by SWIG (http://www.swig.org). -# Version 1.3.33 +# Version 1.3.35 # # Don't modify this file, modify the SWIG interface instead. diff --git a/source4/lib/events/events_wrap.c b/source4/lib/events/events_wrap.c index 9dbbb08734..727485dfdb 100644 --- a/source4/lib/events/events_wrap.c +++ b/source4/lib/events/events_wrap.c @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 1.3.33 + * Version 1.3.35 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make @@ -126,7 +126,7 @@ /* This should only be incremented when either the layout of swig_type_info changes, or for whatever reason, the runtime changes incompatibly */ -#define SWIG_RUNTIME_VERSION "3" +#define SWIG_RUNTIME_VERSION "4" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE @@ -161,6 +161,7 @@ /* Flags for pointer conversions */ #define SWIG_POINTER_DISOWN 0x1 +#define SWIG_CAST_NEW_MEMORY 0x2 /* Flags for new pointer objects */ #define SWIG_POINTER_OWN 0x1 @@ -301,10 +302,10 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) { extern "C" { #endif -typedef void *(*swig_converter_func)(void *); +typedef void *(*swig_converter_func)(void *, int *); typedef struct swig_type_info *(*swig_dycast_func)(void **); -/* Structure to store inforomation on one type */ +/* Structure to store information on one type */ typedef struct swig_type_info { const char *name; /* mangled name of this type */ const char *str; /* human readable name of this type */ @@ -431,8 +432,8 @@ SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) { Cast a pointer up an inheritance hierarchy */ SWIGRUNTIMEINLINE void * -SWIG_TypeCast(swig_cast_info *ty, void *ptr) { - return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr); +SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { + return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); } /* @@ -856,7 +857,7 @@ SWIG_Python_AddErrorMsg(const char* mesg) Py_DECREF(old_str); Py_DECREF(value); } else { - PyErr_Format(PyExc_RuntimeError, mesg); + PyErr_SetString(PyExc_RuntimeError, mesg); } } @@ -1416,7 +1417,7 @@ PySwigObject_dealloc(PyObject *v) { PySwigObject *sobj = (PySwigObject *) v; PyObject *next = sobj->next; - if (sobj->own) { + if (sobj->own == SWIG_POINTER_OWN) { swig_type_info *ty = sobj->ty; PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0; PyObject *destroy = data ? data->destroy : 0; @@ -1434,12 +1435,13 @@ PySwigObject_dealloc(PyObject *v) res = ((*meth)(mself, v)); } Py_XDECREF(res); - } else { - const char *name = SWIG_TypePrettyName(ty); + } #if !defined(SWIG_PYTHON_SILENT_MEMLEAK) - printf("swig/python detected a memory leak of type '%s', no destructor found.\n", name); -#endif + else { + const char *name = SWIG_TypePrettyName(ty); + printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown")); } +#endif } Py_XDECREF(next); PyObject_DEL(v); @@ -1944,7 +1946,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) SWIGRUNTIME int SWIG_Python_AcquirePtr(PyObject *obj, int own) { - if (own) { + if (own == SWIG_POINTER_OWN) { PySwigObject *sobj = SWIG_Python_GetSwigThis(obj); if (sobj) { int oldown = sobj->own; @@ -1965,6 +1967,8 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int return SWIG_OK; } else { PySwigObject *sobj = SWIG_Python_GetSwigThis(obj); + if (own) + *own = 0; while (sobj) { void *vptr = sobj->ptr; if (ty) { @@ -1978,7 +1982,15 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int if (!tc) { sobj = (PySwigObject *)sobj->next; } else { - if (ptr) *ptr = SWIG_TypeCast(tc,vptr); + if (ptr) { + int newmemory = 0; + *ptr = SWIG_TypeCast(tc,vptr,&newmemory); + if (newmemory == SWIG_CAST_NEW_MEMORY) { + assert(own); + if (own) + *own = *own | SWIG_CAST_NEW_MEMORY; + } + } break; } } @@ -1988,7 +2000,8 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int } } if (sobj) { - if (own) *own = sobj->own; + if (own) + *own = *own | sobj->own; if (flags & SWIG_POINTER_DISOWN) { sobj->own = 0; } @@ -2053,8 +2066,13 @@ SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) { } if (ty) { swig_cast_info *tc = SWIG_TypeCheck(desc,ty); - if (!tc) return SWIG_ERROR; - *ptr = SWIG_TypeCast(tc,vptr); + if (tc) { + int newmemory = 0; + *ptr = SWIG_TypeCast(tc,vptr,&newmemory); + assert(!newmemory); /* newmemory handling not yet implemented */ + } else { + return SWIG_ERROR; + } } else { *ptr = vptr; } @@ -2493,7 +2511,7 @@ static swig_module_info swig_module = {swig_types, 4, 0, 0, 0, 0}; #define SWIG_name "_events" -#define SWIGVERSION 0x010333 +#define SWIGVERSION 0x010335 #define SWIG_VERSION SWIGVERSION @@ -2860,7 +2878,7 @@ SWIGRUNTIME void SWIG_InitializeModule(void *clientdata) { size_t i; swig_module_info *module_head, *iter; - int found; + int found, init; clientdata = clientdata; @@ -2870,6 +2888,9 @@ SWIG_InitializeModule(void *clientdata) { swig_module.type_initial = swig_type_initial; swig_module.cast_initial = swig_cast_initial; swig_module.next = &swig_module; + init = 1; + } else { + init = 0; } /* Try and load any already created modules */ @@ -2898,6 +2919,12 @@ SWIG_InitializeModule(void *clientdata) { module_head->next = &swig_module; } + /* When multiple interpeters are used, a module could have already been initialized in + a different interpreter, but not yet have a pointer in this interpreter. + In this case, we do not want to continue adding types... everything should be + set up already */ + if (init == 0) return; + /* Now work on filling in swig_module.types */ #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: size %d\n", swig_module.size); -- cgit From 2914b0ca04355f6f175b603a1de6030b20ce0830 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 21 May 2008 21:24:48 +0200 Subject: Remove support for .py files from smb_build - deal with it only in the makefiles. (This used to be commit b865249efaa58d0fc87fa25491fda3b970af81c3) --- source4/lib/events/config.mk | 2 ++ source4/lib/ldb/python.mk | 2 ++ source4/lib/registry/config.mk | 2 ++ source4/lib/tdb/python.mk | 2 ++ 4 files changed, 8 insertions(+) (limited to 'source4/lib') diff --git a/source4/lib/events/config.mk b/source4/lib/events/config.mk index 3a20770427..e4b5f40571 100644 --- a/source4/lib/events/config.mk +++ b/source4/lib/events/config.mk @@ -56,3 +56,5 @@ SWIG_FILE = events.i PRIVATE_DEPENDENCIES = LIBEVENTS LIBSAMBA-HOSTCONFIG swig_events_OBJ_FILES = $(libeventssrcdir)/events_wrap.o + +$(eval $(call python_py_module_template,events.py,$(libeventssrcdir)/events.py)) diff --git a/source4/lib/ldb/python.mk b/source4/lib/ldb/python.mk index 448cc3ed60..aeafb830d6 100644 --- a/source4/lib/ldb/python.mk +++ b/source4/lib/ldb/python.mk @@ -4,3 +4,5 @@ CFLAGS = -Ilib/ldb/include SWIG_FILE = ldb.i swig_ldb_OBJ_FILES = lib/ldb/ldb_wrap.o + +$(eval $(call python_py_module_template,ldb.py,lib/ldb/ldb.py)) diff --git a/source4/lib/registry/config.mk b/source4/lib/registry/config.mk index c0ad613c52..bb939be0c5 100644 --- a/source4/lib/registry/config.mk +++ b/source4/lib/registry/config.mk @@ -109,3 +109,5 @@ PUBLIC_DEPENDENCIES = registry SWIG_FILE = registry.i swig_registry_OBJ_FILES = $(libregistrysrcdir)/registry_wrap.o + +$(eval $(call python_py_module_template,registry.py,lib/registry/registry.py)) diff --git a/source4/lib/tdb/python.mk b/source4/lib/tdb/python.mk index 2d61545b7f..51074c8576 100644 --- a/source4/lib/tdb/python.mk +++ b/source4/lib/tdb/python.mk @@ -3,3 +3,5 @@ SWIG_FILE = tdb.i PUBLIC_DEPENDENCIES = LIBTDB DYNCONFIG swig_tdb_OBJ_FILES = lib/tdb/tdb_wrap.o + +$(eval $(call python_py_module_template,tdb.py,lib/tdb/tdb.py)) -- cgit From e029dfe9eac32c35ed34eb12927aa6a0b5af31f1 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 21 May 2008 21:27:45 +0200 Subject: libreplace: add test for HAVE_IPV6 Samba can later just check libreplace_cv_HAVE_IPV6 = yes. metze (This used to be commit e835e7eebcc064ce0813814796828f15ad112fbd) --- source4/lib/replace/libreplace_network.m4 | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'source4/lib') diff --git a/source4/lib/replace/libreplace_network.m4 b/source4/lib/replace/libreplace_network.m4 index f2d177b165..6cde6b9e0c 100644 --- a/source4/lib/replace/libreplace_network.m4 +++ b/source4/lib/replace/libreplace_network.m4 @@ -339,6 +339,35 @@ if test x"$libreplace_cv_HAVE_IFACE_IFREQ" = x"yes"; then fi fi +dnl test for ipv6 +AC_CACHE_CHECK([for ipv6 support],libreplace_cv_HAVE_IPV6,[ + AC_TRY_COMPILE([ +#include /* for NULL */ +#include +#include +#include + ], + [ +struct sockaddr_storage sa_store; +struct addrinfo *ai = NULL; +struct in6_addr in6addr; +int idx = if_nametoindex("iface1"); +int s = socket(AF_INET6, SOCK_STREAM, 0); +int ret = getaddrinfo(NULL, NULL, NULL, &ai); +if (ret != 0) { + const char *es = gai_strerror(ret); +} +freeaddrinfo(ai); + ],[ + libreplace_cv_HAVE_IPV6=yes + ],[ + libreplace_cv_HAVE_IPV6=no + ]) +]) +if test x"$libreplace_cv_HAVE_IPV6" = x"yes"; then + AC_DEFINE(HAVE_IPV6,1,[Whether the system has IPv6 support]) +fi + LIBS=$old_LIBS CPPFLAGS="$SAVE_CPPFLAGS" -- cgit From 334de182f47932cbe59b0519bc38a44985055cc7 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 21 May 2008 21:28:59 +0200 Subject: lib/socket: use HAVE_IPV6 test from LIBREPLACE_NETWORK_CHECKS metze (This used to be commit 76be51d3a08e2239a137b8abe3f2df722f69ddb2) --- source4/lib/socket/config.m4 | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/socket/config.m4 b/source4/lib/socket/config.m4 index 871c57f97c..9c0072dd8b 100644 --- a/source4/lib/socket/config.m4 +++ b/source4/lib/socket/config.m4 @@ -1,5 +1,6 @@ AC_CHECK_FUNCS(writev) AC_CHECK_FUNCS(readv) +AC_CHECK_FUNCS(gethostbyname2) ############################################ # check for unix domain sockets @@ -9,17 +10,10 @@ if test x"$libreplace_cv_HAVE_UNIXSOCKET" = x"yes"; then SMB_ENABLE(socket_unix, YES) fi -dnl test for ipv6 using the gethostbyname2() function. That should be sufficient -dnl for now -AC_CHECK_FUNCS(gethostbyname2, have_ipv6=true, have_ipv6=false) +############################################ +# check for ipv6 +# done by AC_LIBREPLACE_NETWORK_CHECKS SMB_ENABLE(socket_ipv6, NO) -if $have_ipv6 = true; then +if test x"$libreplace_cv_HAVE_IPV6" = x"yes"; then SMB_ENABLE(socket_ipv6, YES) - AC_DEFINE(HAVE_IPV6,1,[Whether the system has ipv6 support]) fi -dnl don't build ipv6 by default, unless the above test enables it, or -dnl the configure uses --with-static-modules=socket_ipv6 - - - - -- cgit From 82bcf967b79321706cd19c759ea54c4465fe0d96 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 21 May 2008 21:32:53 +0200 Subject: Move CFLAGS overrides for SWIG modules to Makefile. (This used to be commit 58665a8a8e4b10435aebbf2c95b6a8e50db232d6) --- source4/lib/events/config.mk | 2 ++ source4/lib/ldb/python.mk | 2 ++ source4/lib/registry/config.mk | 2 ++ source4/lib/tdb/python.mk | 3 +++ 4 files changed, 9 insertions(+) (limited to 'source4/lib') diff --git a/source4/lib/events/config.mk b/source4/lib/events/config.mk index e4b5f40571..3e5a5e2a2f 100644 --- a/source4/lib/events/config.mk +++ b/source4/lib/events/config.mk @@ -58,3 +58,5 @@ PRIVATE_DEPENDENCIES = LIBEVENTS LIBSAMBA-HOSTCONFIG swig_events_OBJ_FILES = $(libeventssrcdir)/events_wrap.o $(eval $(call python_py_module_template,events.py,$(libeventssrcdir)/events.py)) + +$(swig_events_OBJ_FILES): CFLAGS+="$(CFLAG_NO_UNUSED_MACROS) $(CFLAG_NO_CAST_QUAL)" diff --git a/source4/lib/ldb/python.mk b/source4/lib/ldb/python.mk index aeafb830d6..77af5d6183 100644 --- a/source4/lib/ldb/python.mk +++ b/source4/lib/ldb/python.mk @@ -6,3 +6,5 @@ SWIG_FILE = ldb.i swig_ldb_OBJ_FILES = lib/ldb/ldb_wrap.o $(eval $(call python_py_module_template,ldb.py,lib/ldb/ldb.py)) + +$(swig_ldb_OBJ_FILES): CFLAGS+="$(CFLAG_NO_UNUSED_MACROS) $(CFLAG_NO_CAST_QUAL)" diff --git a/source4/lib/registry/config.mk b/source4/lib/registry/config.mk index bb939be0c5..077d96ab30 100644 --- a/source4/lib/registry/config.mk +++ b/source4/lib/registry/config.mk @@ -111,3 +111,5 @@ SWIG_FILE = registry.i swig_registry_OBJ_FILES = $(libregistrysrcdir)/registry_wrap.o $(eval $(call python_py_module_template,registry.py,lib/registry/registry.py)) + +$(swig_registry_OBJ_FILES): CFLAGS+="$(CFLAG_NO_UNUSED_MACROS) $(CFLAG_NO_CAST_QUAL)" diff --git a/source4/lib/tdb/python.mk b/source4/lib/tdb/python.mk index 51074c8576..1be237186f 100644 --- a/source4/lib/tdb/python.mk +++ b/source4/lib/tdb/python.mk @@ -5,3 +5,6 @@ PUBLIC_DEPENDENCIES = LIBTDB DYNCONFIG swig_tdb_OBJ_FILES = lib/tdb/tdb_wrap.o $(eval $(call python_py_module_template,tdb.py,lib/tdb/tdb.py)) + +$(swig_tdb_OBJ_FILES): CFLAGS+="$(CFLAG_NO_UNUSED_MACROS) $(CFLAG_NO_CAST_QUAL)" + -- cgit From b1fc7bab111fcef7f546e821f24c175bdec6865a Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 21 May 2008 21:50:56 +0200 Subject: Move some python files into the samba package. (This used to be commit ed38c668cdbe10966e46bad97301122eea8001d0) --- source4/lib/events/config.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/events/config.mk b/source4/lib/events/config.mk index 3e5a5e2a2f..22c54b86ed 100644 --- a/source4/lib/events/config.mk +++ b/source4/lib/events/config.mk @@ -57,6 +57,6 @@ PRIVATE_DEPENDENCIES = LIBEVENTS LIBSAMBA-HOSTCONFIG swig_events_OBJ_FILES = $(libeventssrcdir)/events_wrap.o -$(eval $(call python_py_module_template,events.py,$(libeventssrcdir)/events.py)) +$(eval $(call python_py_module_template,samba/events.py,$(libeventssrcdir)/events.py)) $(swig_events_OBJ_FILES): CFLAGS+="$(CFLAG_NO_UNUSED_MACROS) $(CFLAG_NO_CAST_QUAL)" -- cgit From 49706ab19bd3ffd6125639e6a7753b2350cf54e1 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 21 May 2008 23:59:34 +0200 Subject: Move more modules inside of the samba package. (This used to be commit 9b39e99f48266a54ed0b8890c2efde218b4b118a) --- source4/lib/events/config.mk | 2 +- source4/lib/ldb/python.mk | 2 +- source4/lib/ldb/tests/python/ldap.py | 4 ++-- source4/lib/registry/config.mk | 4 ++-- source4/lib/registry/tests/bindings.py | 2 +- source4/lib/tdb/python.mk | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/events/config.mk b/source4/lib/events/config.mk index 22c54b86ed..ca47f0d1c4 100644 --- a/source4/lib/events/config.mk +++ b/source4/lib/events/config.mk @@ -52,7 +52,7 @@ LIBEVENTS_OBJ_FILES = $(addprefix $(libeventssrcdir)/, events.o events_timed.o e PUBLIC_HEADERS += $(addprefix $(libeventssrcdir)/, events.h events_internal.h) [PYTHON::swig_events] -SWIG_FILE = events.i +LIBRARY_REALNAME = samba/_events.$(SHLIBEXT) PRIVATE_DEPENDENCIES = LIBEVENTS LIBSAMBA-HOSTCONFIG swig_events_OBJ_FILES = $(libeventssrcdir)/events_wrap.o diff --git a/source4/lib/ldb/python.mk b/source4/lib/ldb/python.mk index 77af5d6183..7b430f4e2f 100644 --- a/source4/lib/ldb/python.mk +++ b/source4/lib/ldb/python.mk @@ -1,7 +1,7 @@ [PYTHON::swig_ldb] +LIBRARY_REALNAME = _ldb.$(SHLIBEXT) PUBLIC_DEPENDENCIES = LIBLDB CFLAGS = -Ilib/ldb/include -SWIG_FILE = ldb.i swig_ldb_OBJ_FILES = lib/ldb/ldb_wrap.o diff --git a/source4/lib/ldb/tests/python/ldap.py b/source4/lib/ldb/tests/python/ldap.py index 7cbe6e5e7d..c76222c207 100755 --- a/source4/lib/ldb/tests/python/ldap.py +++ b/source4/lib/ldb/tests/python/ldap.py @@ -10,14 +10,14 @@ sys.path.append("bin/python") import samba.getopt as options -from auth import system_session +from samba.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, LDB_ERR_OTHER) from samba import Ldb from subunit import SubunitTestRunner -import param +from samba import param import unittest parser = optparse.OptionParser("ldap [options] ") diff --git a/source4/lib/registry/config.mk b/source4/lib/registry/config.mk index 077d96ab30..90618ffc31 100644 --- a/source4/lib/registry/config.mk +++ b/source4/lib/registry/config.mk @@ -105,11 +105,11 @@ torture_registry_OBJ_FILES = $(addprefix $(libregistrysrcdir)/tests/, generic.o $(eval $(call proto_header_template,$(libregistrysrcdir)/tests/proto.h,$(torture_registry_OBJ_FILES:.o=.c))) [PYTHON::swig_registry] +LIBRARY_REALNAME = samba/_registry.$(SHLIBEXT) PUBLIC_DEPENDENCIES = registry -SWIG_FILE = registry.i swig_registry_OBJ_FILES = $(libregistrysrcdir)/registry_wrap.o -$(eval $(call python_py_module_template,registry.py,lib/registry/registry.py)) +$(eval $(call python_py_module_template,samba/registry.py,lib/registry/registry.py)) $(swig_registry_OBJ_FILES): CFLAGS+="$(CFLAG_NO_UNUSED_MACROS) $(CFLAG_NO_CAST_QUAL)" diff --git a/source4/lib/registry/tests/bindings.py b/source4/lib/registry/tests/bindings.py index 314cf778a1..1fb5c70b70 100644 --- a/source4/lib/registry/tests/bindings.py +++ b/source4/lib/registry/tests/bindings.py @@ -19,7 +19,7 @@ import os import unittest -import registry +from samba import registry import samba.tests class HelperTests(unittest.TestCase): diff --git a/source4/lib/tdb/python.mk b/source4/lib/tdb/python.mk index 1be237186f..e71a60f233 100644 --- a/source4/lib/tdb/python.mk +++ b/source4/lib/tdb/python.mk @@ -1,5 +1,5 @@ [PYTHON::swig_tdb] -SWIG_FILE = tdb.i +LIBRARY_REALNAME = _tdb.$(SHLIBEXT) PUBLIC_DEPENDENCIES = LIBTDB DYNCONFIG swig_tdb_OBJ_FILES = lib/tdb/tdb_wrap.o -- cgit From 6b3e2c308ac4fb97a89e84b58136efc842ed4f0f Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 22 May 2008 01:17:30 +0200 Subject: Fix events test. (This used to be commit 0fae6f11081cff7846319175cfec95fa3911571c) --- source4/lib/events/tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/events/tests.py b/source4/lib/events/tests.py index b14f7e6250..006426207e 100644 --- a/source4/lib/events/tests.py +++ b/source4/lib/events/tests.py @@ -17,7 +17,7 @@ # along with this program. If not, see . # -import events +from samba import events import unittest # Just test the bindings are there and that calling them doesn't crash -- cgit From 5ce59419a07c8e147daf51b77ffe2117f3d6a505 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 22 May 2008 02:13:26 +0200 Subject: Fix CFLAGS for SWIG files. (This used to be commit 8ee4f075046e0b181ec8a4ac1eaf3ea5621a56bf) --- source4/lib/events/config.mk | 2 +- source4/lib/ldb/python.mk | 2 +- source4/lib/registry/config.mk | 2 +- source4/lib/tdb/python.mk | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/events/config.mk b/source4/lib/events/config.mk index ca47f0d1c4..9d579807c8 100644 --- a/source4/lib/events/config.mk +++ b/source4/lib/events/config.mk @@ -59,4 +59,4 @@ swig_events_OBJ_FILES = $(libeventssrcdir)/events_wrap.o $(eval $(call python_py_module_template,samba/events.py,$(libeventssrcdir)/events.py)) -$(swig_events_OBJ_FILES): CFLAGS+="$(CFLAG_NO_UNUSED_MACROS) $(CFLAG_NO_CAST_QUAL)" +$(swig_events_OBJ_FILES): CFLAGS+=$(CFLAG_NO_UNUSED_MACROS) $(CFLAG_NO_CAST_QUAL) diff --git a/source4/lib/ldb/python.mk b/source4/lib/ldb/python.mk index 7b430f4e2f..89aba8f276 100644 --- a/source4/lib/ldb/python.mk +++ b/source4/lib/ldb/python.mk @@ -7,4 +7,4 @@ swig_ldb_OBJ_FILES = lib/ldb/ldb_wrap.o $(eval $(call python_py_module_template,ldb.py,lib/ldb/ldb.py)) -$(swig_ldb_OBJ_FILES): CFLAGS+="$(CFLAG_NO_UNUSED_MACROS) $(CFLAG_NO_CAST_QUAL)" +$(swig_ldb_OBJ_FILES): CFLAGS+=$(CFLAG_NO_UNUSED_MACROS) $(CFLAG_NO_CAST_QUAL) diff --git a/source4/lib/registry/config.mk b/source4/lib/registry/config.mk index 90618ffc31..44adc53524 100644 --- a/source4/lib/registry/config.mk +++ b/source4/lib/registry/config.mk @@ -112,4 +112,4 @@ swig_registry_OBJ_FILES = $(libregistrysrcdir)/registry_wrap.o $(eval $(call python_py_module_template,samba/registry.py,lib/registry/registry.py)) -$(swig_registry_OBJ_FILES): CFLAGS+="$(CFLAG_NO_UNUSED_MACROS) $(CFLAG_NO_CAST_QUAL)" +$(swig_registry_OBJ_FILES): CFLAGS+=$(CFLAG_NO_UNUSED_MACROS) $(CFLAG_NO_CAST_QUAL) diff --git a/source4/lib/tdb/python.mk b/source4/lib/tdb/python.mk index e71a60f233..83336e7b41 100644 --- a/source4/lib/tdb/python.mk +++ b/source4/lib/tdb/python.mk @@ -6,5 +6,5 @@ swig_tdb_OBJ_FILES = lib/tdb/tdb_wrap.o $(eval $(call python_py_module_template,tdb.py,lib/tdb/tdb.py)) -$(swig_tdb_OBJ_FILES): CFLAGS+="$(CFLAG_NO_UNUSED_MACROS) $(CFLAG_NO_CAST_QUAL)" +$(swig_tdb_OBJ_FILES): CFLAGS+=$(CFLAG_NO_UNUSED_MACROS) $(CFLAG_NO_CAST_QUAL) -- cgit From 5ab27ba7f0facbad4ba14b4246bc47e05b5da347 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 22 May 2008 15:00:19 +0200 Subject: libreplace: we need to use AC_TRY_LINK() to make sure HAVE_IPV6 is correctly detected metze (This used to be commit 84b5652d3e5766521436e4c7d59615b08b2bb198) --- source4/lib/replace/libreplace_network.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/replace/libreplace_network.m4 b/source4/lib/replace/libreplace_network.m4 index 6cde6b9e0c..4edb55c03a 100644 --- a/source4/lib/replace/libreplace_network.m4 +++ b/source4/lib/replace/libreplace_network.m4 @@ -341,7 +341,7 @@ fi dnl test for ipv6 AC_CACHE_CHECK([for ipv6 support],libreplace_cv_HAVE_IPV6,[ - AC_TRY_COMPILE([ + AC_TRY_LINK([ #include /* for NULL */ #include #include -- cgit From 505cea9d4c9ae3b7baf401fd543500041c20f93d Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 22 May 2008 16:50:33 +0200 Subject: Add some docstrings to ldb python module, fix MessageElement name. (This used to be commit 717283331f8a1ebd80e7ec52d9bfe709f869ec86) --- source4/lib/ldb/ldb.i | 93 ++++++++++++--- source4/lib/ldb/ldb.py | 189 ++++++++++++++++++++++++++--- source4/lib/ldb/ldb_wrap.c | 292 ++++++++++++++++++++++++++++----------------- 3 files changed, 430 insertions(+), 144 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/ldb.i b/source4/lib/ldb/ldb.i index 18e981f7be..6a807a7dde 100644 --- a/source4/lib/ldb/ldb.i +++ b/source4/lib/ldb/ldb.i @@ -40,7 +40,7 @@ typedef struct ldb_message ldb_msg; typedef struct ldb_context ldb; typedef struct ldb_dn ldb_dn; typedef struct ldb_ldif ldb_ldif; -typedef struct ldb_message_element ldb_msg_element; +typedef struct ldb_message_element ldb_message_element; typedef int ldb_error; typedef int ldb_int_error; @@ -210,21 +210,35 @@ fail: return ret; } ~ldb_dn() { talloc_free($self); } + %feature("docstring") validate "S.validate() -> bool\n" \ + "Validate DN is correct."; bool validate(); const char *get_casefold(); const char *get_linearized(); ldb_dn *parent() { return ldb_dn_get_parent(NULL, $self); } int compare(ldb_dn *other); bool is_valid(); + %feature("docstring") is_special "S.is_special() -> bool\n" \ + "Check whether this is a special LDB DN."; bool is_special(); + %feature("docstring") is_null "S.is_null() -> bool\n" \ + "Check whether this is a null DN."; bool is_null(); bool check_special(const char *name); int get_comp_num(); + %feature("docstring") add_child "S.add_child(dn) -> None\n" \ + "Add a child DN to this DN."; bool add_child(ldb_dn *child); + %feature("docstring") add_base "S.add_base(dn) -> None\n" \ + "Add a base DN to this DN."; bool add_base(ldb_dn *base); + %feature("docstring") canonical_str "S.canonical_str() -> string\n" \ + "Canonical version of this DN (like a posix path)."; const char *canonical_str() { return ldb_dn_canonical_string($self, $self); } + %feature("docstring") canonical_ex_str "S.canonical_ex_str() -> string\n" \ + "Canonical version of this DN (like a posix path, with terminating newline)."; const char *canonical_ex_str() { return ldb_dn_canonical_ex_string($self, $self); } @@ -289,7 +303,7 @@ int ldb_dn_from_pyobject(TALLOC_CTX *mem_ctx, PyObject *object, return ret; } -ldb_msg_element *ldb_msg_element_from_pyobject(TALLOC_CTX *mem_ctx, +ldb_message_element *ldb_msg_element_from_pyobject(TALLOC_CTX *mem_ctx, PyObject *set_obj, int flags, const char *attr_name) { @@ -320,7 +334,7 @@ ldb_msg_element *ldb_msg_element_from_pyobject(TALLOC_CTX *mem_ctx, } PyObject *ldb_msg_element_to_set(struct ldb_context *ldb_ctx, - ldb_msg_element *me) + ldb_message_element *me) { int i; PyObject *result; @@ -339,9 +353,10 @@ PyObject *ldb_msg_element_to_set(struct ldb_context *ldb_ctx, %} #endif +int ldb_msg_element_compare(ldb_message_element *, ldb_message_element *); /* ldb_message_element */ -%rename(__cmp__) ldb_message_element::compare; -%rename(MessageElement) ldb_msg_element; +%rename(MessageElement) ldb_message_element; +%rename(ldb_message_element_compare) ldb_msg_element_compare; typedef struct ldb_message_element { %extend { #ifdef SWIGPYTHON @@ -355,7 +370,7 @@ typedef struct ldb_message_element { return ldb_msg_element_to_set(NULL, $self); } - ldb_msg_element(PyObject *set_obj, int flags=0, const char *name = NULL) + ldb_message_element(PyObject *set_obj, int flags=0, const char *name = NULL) { return ldb_msg_element_from_pyobject(NULL, set_obj, flags, name); } @@ -374,8 +389,8 @@ typedef struct ldb_message_element { return ldb_val_to_py_object(NULL, $self, &$self->values[i]); } - ~ldb_msg_element() { talloc_free($self); } - int compare(ldb_msg_element *); + ~ldb_message_element() { talloc_free($self); } + %rename(__cmp__) ldb_msg_element_compare; } %pythoncode { def __getitem__(self, i): @@ -398,21 +413,19 @@ typedef struct ldb_message_element { return False return True } -} ldb_msg_element; +} ldb_message_element; /* ldb_message */ %rename(Message) ldb_message; #ifdef SWIGPYTHON %rename(__delitem__) ldb_message::remove_attr; -%typemap(out) ldb_msg_element * { +%typemap(out) ldb_message_element * { if ($1 == NULL) PyErr_SetString(PyExc_KeyError, "no such element"); else $result = SWIG_NewPointerObj($1, SWIGTYPE_p_ldb_message_element, 0); } -//%typemap(out) ldb_msg_element *; - %inline { PyObject *ldb_msg_list_elements(ldb_msg *msg) @@ -443,10 +456,10 @@ typedef struct ldb_message { return ret; } ~ldb_msg() { talloc_free($self); } - ldb_msg_element *find_element(const char *name); + ldb_message_element *find_element(const char *name); #ifdef SWIGPYTHON - void __setitem__(const char *attr_name, ldb_msg_element *val) + void __setitem__(const char *attr_name, ldb_message_element *val) { struct ldb_message_element *el; @@ -613,7 +626,7 @@ PyObject *PyExc_LdbError; %typemap(in,numinputs=1) ldb_msg *add_msg { Py_ssize_t dict_pos, msg_pos; - ldb_msg_element *msgel; + ldb_message_element *msgel; PyObject *key, *value; if (PyDict_Check($input)) { @@ -660,6 +673,8 @@ typedef struct ldb_context { %extend { ldb(void) { return ldb_init(NULL); } + %feature("docstring") connect "S.connect(url,flags=0,options=None) -> None\n" \ + "Connect to a LDB URL."; ldb_error connect(const char *url, unsigned int flags = 0, const char *options[] = NULL); @@ -707,11 +722,19 @@ typedef struct ldb_context { return ret; } + %feature("docstring") delete "S.delete(dn) -> None\n" \ + "Remove an entry."; ldb_error delete(ldb_dn *dn); + %feature("docstring") rename "S.rename(old_dn, new_dn) -> None\n" \ + "Rename an entry."; ldb_error rename(ldb_dn *olddn, ldb_dn *newdn); struct ldb_control **parse_control_strings(TALLOC_CTX *mem_ctx, const char * const*control_strings); + %feature("docstring") add "S.add(message) -> None\n" \ + "Add an entry."; ldb_error add(ldb_msg *add_msg); + %feature("docstring") modify "S.modify(message) -> None\n" \ + "Modify an entry."; ldb_error modify(ldb_msg *message); ldb_dn *get_config_basedn(); ldb_dn *get_root_basedn(); @@ -747,20 +770,36 @@ typedef struct ldb_context { } const char *errstring(); + %feature("docstring") set_create_perms "S.set_create_perms(mode) -> None\n" \ + "Set mode to use when creating new LDB files."; void set_create_perms(unsigned int perms); + %feature("docstring") set_modules_dir "S.set_modules_dir(path) -> None\n" \ + "Set path LDB should search for modules"; void set_modules_dir(const char *path); ldb_error set_debug(void (*debug)(void *context, enum ldb_debug_level level, const char *fmt, va_list ap), void *context); + %feature("docstring") set_opaque "S.set_opaque(name, value) -> None\n" \ + "Set an opaque value on this LDB connection. \n" + ":note: Passing incorrect values may cause crashes."; ldb_error set_opaque(const char *name, void *value); + %feature("docstring") get_opaque "S.get_opaque(name) -> value\n" \ + "Get an opaque value set on this LDB connection. \n" + ":note: The returned value may not be useful in Python."; void *get_opaque(const char *name); + %feature("docstring") transaction_start "S.transaction_start() -> None\n" \ + "Start a new transaction."; ldb_error transaction_start(); + %feature("docstring") transaction_commit "S.transaction_commit() -> None\n" \ + "Commit currently active transaction."; ldb_error transaction_commit(); + %feature("docstring") transaction_commit "S.transaction_cancel() -> None\n" \ + "Cancel currently active transaction."; ldb_error transaction_cancel(); void schema_attribute_remove(const char *name); ldb_error schema_attribute_add(const char *attribute, unsigned flags, const char *syntax); - ldb_error setup_wellknown_attributes(void); - + ldb_error setup_wellknown_attributes(void); + #ifdef SWIGPYTHON %typemap(in,numinputs=0,noblock=1) struct ldb_result **result_as_bool (struct ldb_result *tmp) { $1 = &tmp; } %typemap(argout,noblock=1) struct ldb_result **result_as_bool { $result = ((*$1)->count > 0)?Py_True:Py_False; } @@ -771,6 +810,9 @@ typedef struct ldb_context { result_as_bool); } + %feature("docstring") parse_ldif "S.parse_ldif(ldif) -> iter(messages)\n" \ + "Parse a string formatted using LDIF."; + PyObject *parse_ldif(const char *s) { PyObject *list = PyList_New(0); @@ -791,12 +833,25 @@ typedef struct ldb_context { } %pythoncode { def __init__(self, url=None, flags=0, options=None): + """Create a new LDB object. + + Will also connect to the specified URL if one was given. + """ _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): + """Search in a database. + + :param base: Optional base DN to search + :param scope: Search scope (SCOPE_BASE, SCOPE_ONELEVEL or SCOPE_SUBTREE) + :param expression: Optional search expression + :param attrs: Attributes to return (defaults to all) + :param controls: Optional list of controls + :return: Iterator over Message objects + """ if not (attrs is None or isinstance(attrs, list)): raise TypeError("attributes not a list") parsed_controls = None @@ -816,6 +871,8 @@ typedef struct ldb_context { %nodefault Dn; %rename(valid_attr_name) ldb_valid_attr_name; +%feature("docstring") ldb_valid_attr_name "S.valid_attr_name(name) -> bool\n" + "Check whether the supplied name is a valid attribute name."; int ldb_valid_attr_name(const char *s); typedef unsigned long time_t; @@ -839,5 +896,7 @@ time_t ldb_string_to_time(const char *s); $1->name = (char *)PyObject_GetAttrString($input, (char *)"name"); } +%feature("docstring") ldb_register_module "S.register_module(module) -> None\n" + "Register a LDB module."; %rename(register_module) ldb_register_module; ldb_int_error ldb_register_module(const struct ldb_module_ops *); diff --git a/source4/lib/ldb/ldb.py b/source4/lib/ldb/ldb.py index e9f4055fbf..0149f05429 100644 --- a/source4/lib/ldb/ldb.py +++ b/source4/lib/ldb/ldb.py @@ -71,6 +71,55 @@ class Dn(object): def __init__(self, *args, **kwargs): _ldb.Dn_swiginit(self,_ldb.new_Dn(*args, **kwargs)) __swig_destroy__ = _ldb.delete_Dn + def validate(*args, **kwargs): + """ + S.validate() -> bool + Validate DN is correct. + """ + return _ldb.Dn_validate(*args, **kwargs) + + def is_special(*args, **kwargs): + """ + S.is_special() -> bool + Check whether this is a special LDB DN. + """ + return _ldb.Dn_is_special(*args, **kwargs) + + def is_null(*args, **kwargs): + """ + S.is_null() -> bool + Check whether this is a null DN. + """ + return _ldb.Dn_is_null(*args, **kwargs) + + def add_child(*args, **kwargs): + """ + S.add_child(dn) -> None + Add a child DN to this DN. + """ + return _ldb.Dn_add_child(*args, **kwargs) + + def add_base(*args, **kwargs): + """ + S.add_base(dn) -> None + Add a base DN to this DN. + """ + return _ldb.Dn_add_base(*args, **kwargs) + + def canonical_str(*args, **kwargs): + """ + S.canonical_str() -> string + Canonical version of this DN (like a posix path). + """ + return _ldb.Dn_canonical_str(*args, **kwargs) + + def canonical_ex_str(*args, **kwargs): + """ + S.canonical_ex_str() -> string + Canonical version of this DN (like a posix path, with terminating newline). + """ + return _ldb.Dn_canonical_ex_str(*args, **kwargs) + def __eq__(self, other): if isinstance(other, self.__class__): return self.__cmp__(other) == 0 @@ -97,11 +146,13 @@ Dn.__add__ = new_instancemethod(_ldb.Dn___add__,None,Dn) Dn_swigregister = _ldb.Dn_swigregister Dn_swigregister(Dn) -class ldb_msg_element(object): +ldb_msg_element_compare = _ldb.ldb_msg_element_compare +class MessageElement(object): thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') - def __init__(self, *args, **kwargs): raise AttributeError, "No constructor defined" __repr__ = _swig_repr - __swig_destroy__ = _ldb.delete_ldb_msg_element + def __init__(self, *args, **kwargs): + _ldb.MessageElement_swiginit(self,_ldb.new_MessageElement(*args, **kwargs)) + __swig_destroy__ = _ldb.delete_MessageElement def __getitem__(self, i): ret = self.get(i) if ret is None: @@ -122,17 +173,12 @@ class ldb_msg_element(object): 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) - -def MessageElement(*args, **kwargs): - val = _ldb.new_MessageElement(*args, **kwargs) - return val +MessageElement.__iter__ = new_instancemethod(_ldb.MessageElement___iter__,None,MessageElement) +MessageElement.__set__ = new_instancemethod(_ldb.MessageElement___set__,None,MessageElement) +MessageElement.__len__ = new_instancemethod(_ldb.MessageElement___len__,None,MessageElement) +MessageElement.get = new_instancemethod(_ldb.MessageElement_get,None,MessageElement) +MessageElement_swigregister = _ldb.MessageElement_swigregister +MessageElement_swigregister(MessageElement) ldb_msg_list_elements = _ldb.ldb_msg_list_elements class Message(object): @@ -217,14 +263,113 @@ class Ldb(object): thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): _ldb.Ldb_swiginit(self,_ldb.new_Ldb(*args, **kwargs)) + def connect(*args, **kwargs): + """ + S.connect(url,flags=0,options=None) -> None + Connect to a LDB URL. + """ + return _ldb.Ldb_connect(*args, **kwargs) + __swig_destroy__ = _ldb.delete_Ldb + def delete(*args, **kwargs): + """ + S.delete(dn) -> None + Remove an entry. + """ + return _ldb.Ldb_delete(*args, **kwargs) + + def rename(*args, **kwargs): + """ + S.rename(old_dn, new_dn) -> None + Rename an entry. + """ + return _ldb.Ldb_rename(*args, **kwargs) + + def add(*args, **kwargs): + """ + S.add(message) -> None + Add an entry. + """ + return _ldb.Ldb_add(*args, **kwargs) + + def modify(*args, **kwargs): + """ + S.modify(message) -> None + Modify an entry. + """ + return _ldb.Ldb_modify(*args, **kwargs) + + def set_create_perms(*args, **kwargs): + """ + S.set_create_perms(mode) -> None + Set mode to use when creating new LDB files. + """ + return _ldb.Ldb_set_create_perms(*args, **kwargs) + + def set_modules_dir(*args, **kwargs): + """ + S.set_modules_dir(path) -> None + Set path LDB should search for modules + """ + return _ldb.Ldb_set_modules_dir(*args, **kwargs) + + def set_opaque(*args, **kwargs): + """ + S.set_opaque(name, value) -> None + Set an opaque value on this LDB connection. + :note: Passing incorrect values may cause crashes. + """ + return _ldb.Ldb_set_opaque(*args, **kwargs) + + def get_opaque(*args, **kwargs): + """ + S.get_opaque(name) -> value + Get an opaque value set on this LDB connection. + :note: The returned value may not be useful in Python. + """ + return _ldb.Ldb_get_opaque(*args, **kwargs) + + def transaction_start(*args, **kwargs): + """ + S.transaction_start() -> None + Start a new transaction. + """ + return _ldb.Ldb_transaction_start(*args, **kwargs) + + def transaction_commit(*args, **kwargs): + """ + S.transaction_commit() -> None + Commit currently active transaction. + """ + return _ldb.Ldb_transaction_commit(*args, **kwargs) + + def parse_ldif(*args, **kwargs): + """ + S.parse_ldif(ldif) -> iter(messages) + Parse a string formatted using LDIF. + """ + return _ldb.Ldb_parse_ldif(*args, **kwargs) + def __init__(self, url=None, flags=0, options=None): + """Create a new LDB object. + + Will also connect to the specified URL if one was given. + """ _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): + """Search in a database. + + :param base: Optional base DN to search + :param scope: Search scope (SCOPE_BASE, SCOPE_ONELEVEL or SCOPE_SUBTREE) + :param expression: Optional search expression + :param attrs: Attributes to return (defaults to all) + :param controls: Optional list of controls + :return: Iterator over Message objects + """ if not (attrs is None or isinstance(attrs, list)): raise TypeError("attributes not a list") parsed_controls = None @@ -263,9 +408,21 @@ Ldb.__repr__ = new_instancemethod(_ldb.Ldb___repr__,None,Ldb) Ldb_swigregister = _ldb.Ldb_swigregister Ldb_swigregister(Ldb) -valid_attr_name = _ldb.valid_attr_name + +def valid_attr_name(*args, **kwargs): + """ + S.valid_attr_name(name) -> bool + Check whether the supplied name is a valid attribute name. + """ + return _ldb.valid_attr_name(*args, **kwargs) timestring = _ldb.timestring string_to_time = _ldb.string_to_time -register_module = _ldb.register_module + +def register_module(*args, **kwargs): + """ + S.register_module(module) -> None + Register a LDB module. + """ + return _ldb.register_module(*args, **kwargs) diff --git a/source4/lib/ldb/ldb_wrap.c b/source4/lib/ldb/ldb_wrap.c index d787266416..bfd507a8f2 100644 --- a/source4/lib/ldb/ldb_wrap.c +++ b/source4/lib/ldb/ldb_wrap.c @@ -2554,7 +2554,7 @@ typedef struct ldb_message ldb_msg; typedef struct ldb_context ldb; typedef struct ldb_dn ldb_dn; typedef struct ldb_ldif ldb_ldif; -typedef struct ldb_message_element ldb_msg_element; +typedef struct ldb_message_element ldb_message_element; typedef int ldb_error; typedef int ldb_int_error; @@ -2761,7 +2761,7 @@ int ldb_dn_from_pyobject(TALLOC_CTX *mem_ctx, PyObject *object, return ret; } -ldb_msg_element *ldb_msg_element_from_pyobject(TALLOC_CTX *mem_ctx, +ldb_message_element *ldb_msg_element_from_pyobject(TALLOC_CTX *mem_ctx, PyObject *set_obj, int flags, const char *attr_name) { @@ -2792,7 +2792,7 @@ ldb_msg_element *ldb_msg_element_from_pyobject(TALLOC_CTX *mem_ctx, } PyObject *ldb_msg_element_to_set(struct ldb_context *ldb_ctx, - ldb_msg_element *me) + ldb_message_element *me) { int i; PyObject *result; @@ -2809,10 +2809,10 @@ PyObject *ldb_msg_element_to_set(struct ldb_context *ldb_ctx, } -SWIGINTERN PyObject *ldb_msg_element___iter__(ldb_msg_element *self){ +SWIGINTERN PyObject *ldb_message_element___iter__(ldb_message_element *self){ return PyObject_GetIter(ldb_msg_element_to_set(NULL, self)); } -SWIGINTERN PyObject *ldb_msg_element___set__(ldb_msg_element *self){ +SWIGINTERN PyObject *ldb_message_element___set__(ldb_message_element *self){ return ldb_msg_element_to_set(NULL, self); } @@ -2960,19 +2960,19 @@ SWIG_AsVal_int (PyObject * obj, int *val) return res; } -SWIGINTERN ldb_msg_element *new_ldb_msg_element(PyObject *set_obj,int flags,char const *name){ +SWIGINTERN ldb_message_element *new_ldb_message_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){ +SWIGINTERN int ldb_message_element___len__(ldb_message_element *self){ return self->num_values; } -SWIGINTERN PyObject *ldb_msg_element_get(ldb_msg_element *self,int i){ +SWIGINTERN PyObject *ldb_message_element_get(ldb_message_element *self,int i){ if (i < 0 || i >= self->num_values) return Py_None; return ldb_val_to_py_object(NULL, self, &self->values[i]); } -SWIGINTERN void delete_ldb_msg_element(ldb_msg_element *self){ talloc_free(self); } +SWIGINTERN void delete_ldb_message_element(ldb_message_element *self){ talloc_free(self); } PyObject *ldb_msg_list_elements(ldb_msg *msg) { @@ -2995,7 +2995,7 @@ SWIGINTERN ldb_msg *new_ldb_msg(ldb_dn *dn){ return ret; } SWIGINTERN void delete_ldb_msg(ldb_msg *self){ talloc_free(self); } -SWIGINTERN void ldb_msg___setitem____SWIG_0(ldb_msg *self,char const *attr_name,ldb_msg_element *val){ +SWIGINTERN void ldb_msg___setitem____SWIG_0(ldb_msg *self,char const *attr_name,ldb_message_element *val){ struct ldb_message_element *el; ldb_msg_remove_attr(self, attr_name); @@ -3763,9 +3763,43 @@ SWIGINTERN PyObject *Dn_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) return SWIG_Python_InitShadowInstance(args); } -SWIGINTERN PyObject *_wrap_ldb_msg_element___iter__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_ldb_msg_element_compare(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; - ldb_msg_element *arg1 = (ldb_msg_element *) 0 ; + ldb_message_element *arg1 = (ldb_message_element *) 0 ; + ldb_message_element *arg2 = (ldb_message_element *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + char * kwnames[] = { + (char *)"arg1",(char *)"arg2", NULL + }; + + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ldb_msg_element_compare",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_compare" "', argument " "1"" of type '" "ldb_message_element *""'"); + } + arg1 = (ldb_message_element *)(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_ldb_message_element, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ldb_msg_element_compare" "', argument " "2"" of type '" "ldb_message_element *""'"); + } + arg2 = (ldb_message_element *)(argp2); + result = (int)ldb_msg_element_compare(arg1,arg2); + resultobj = SWIG_From_int((int)(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_MessageElement___iter__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ldb_message_element *arg1 = (ldb_message_element *) 0 ; PyObject *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -3775,10 +3809,10 @@ SWIGINTERN PyObject *_wrap_ldb_msg_element___iter__(PyObject *SWIGUNUSEDPARM(sel 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___iter__" "', argument " "1"" of type '" "ldb_msg_element *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MessageElement___iter__" "', argument " "1"" of type '" "ldb_message_element *""'"); } - arg1 = (ldb_msg_element *)(argp1); - result = (PyObject *)ldb_msg_element___iter__(arg1); + arg1 = (ldb_message_element *)(argp1); + result = (PyObject *)ldb_message_element___iter__(arg1); resultobj = result; return resultobj; fail: @@ -3786,9 +3820,9 @@ fail: } -SWIGINTERN PyObject *_wrap_ldb_msg_element___set__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_MessageElement___set__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; - ldb_msg_element *arg1 = (ldb_msg_element *) 0 ; + ldb_message_element *arg1 = (ldb_message_element *) 0 ; PyObject *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -3798,10 +3832,10 @@ SWIGINTERN PyObject *_wrap_ldb_msg_element___set__(PyObject *SWIGUNUSEDPARM(self 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___set__" "', argument " "1"" of type '" "ldb_msg_element *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MessageElement___set__" "', argument " "1"" of type '" "ldb_message_element *""'"); } - arg1 = (ldb_msg_element *)(argp1); - result = (PyObject *)ldb_msg_element___set__(arg1); + arg1 = (ldb_message_element *)(argp1); + result = (PyObject *)ldb_message_element___set__(arg1); resultobj = result; return resultobj; fail: @@ -3814,7 +3848,7 @@ SWIGINTERN PyObject *_wrap_new_MessageElement(PyObject *SWIGUNUSEDPARM(self), Py PyObject *arg1 = (PyObject *) 0 ; int arg2 = (int) 0 ; char *arg3 = (char *) NULL ; - ldb_msg_element *result = 0 ; + ldb_message_element *result = 0 ; int val2 ; int ecode2 = 0 ; int res3 ; @@ -3843,8 +3877,8 @@ SWIGINTERN PyObject *_wrap_new_MessageElement(PyObject *SWIGUNUSEDPARM(self), Py } arg3 = (char *)(buf3); } - result = (ldb_msg_element *)new_ldb_msg_element(arg1,arg2,(char const *)arg3); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ldb_message_element, SWIG_POINTER_OWN | 0 ); + result = (ldb_message_element *)new_ldb_message_element(arg1,arg2,(char const *)arg3); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ldb_message_element, SWIG_POINTER_NEW | 0 ); if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); return resultobj; fail: @@ -3853,9 +3887,9 @@ fail: } -SWIGINTERN PyObject *_wrap_ldb_msg_element___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_MessageElement___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; - ldb_msg_element *arg1 = (ldb_msg_element *) 0 ; + ldb_message_element *arg1 = (ldb_message_element *) 0 ; int result; void *argp1 = 0 ; int res1 = 0 ; @@ -3865,10 +3899,10 @@ SWIGINTERN PyObject *_wrap_ldb_msg_element___len__(PyObject *SWIGUNUSEDPARM(self 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 *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MessageElement___len__" "', argument " "1"" of type '" "ldb_message_element *""'"); } - arg1 = (ldb_msg_element *)(argp1); - result = (int)ldb_msg_element___len__(arg1); + arg1 = (ldb_message_element *)(argp1); + result = (int)ldb_message_element___len__(arg1); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: @@ -3876,9 +3910,9 @@ fail: } -SWIGINTERN PyObject *_wrap_ldb_msg_element_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_MessageElement_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; - ldb_msg_element *arg1 = (ldb_msg_element *) 0 ; + ldb_message_element *arg1 = (ldb_message_element *) 0 ; int arg2 ; PyObject *result = 0 ; void *argp1 = 0 ; @@ -3891,18 +3925,18 @@ SWIGINTERN PyObject *_wrap_ldb_msg_element_get(PyObject *SWIGUNUSEDPARM(self), P (char *) "self",(char *) "i", NULL }; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ldb_msg_element_get",kwnames,&obj0,&obj1)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:MessageElement_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 *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MessageElement_get" "', argument " "1"" of type '" "ldb_message_element *""'"); } - arg1 = (ldb_msg_element *)(argp1); + arg1 = (ldb_message_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""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "MessageElement_get" "', argument " "2"" of type '" "int""'"); } arg2 = (int)(val2); - result = (PyObject *)ldb_msg_element_get(arg1,arg2); + result = (PyObject *)ldb_message_element_get(arg1,arg2); resultobj = result; return resultobj; fail: @@ -3910,9 +3944,9 @@ fail: } -SWIGINTERN PyObject *_wrap_delete_ldb_msg_element(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_delete_MessageElement(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; - ldb_msg_element *arg1 = (ldb_msg_element *) 0 ; + ldb_message_element *arg1 = (ldb_message_element *) 0 ; void *argp1 = 0 ; int res1 = 0 ; PyObject *swig_obj[1] ; @@ -3921,10 +3955,10 @@ SWIGINTERN PyObject *_wrap_delete_ldb_msg_element(PyObject *SWIGUNUSEDPARM(self) swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_message_element, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_ldb_msg_element" "', argument " "1"" of type '" "ldb_msg_element *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_MessageElement" "', argument " "1"" of type '" "ldb_message_element *""'"); } - arg1 = (ldb_msg_element *)(argp1); - delete_ldb_msg_element(arg1); + arg1 = (ldb_message_element *)(argp1); + delete_ldb_message_element(arg1); resultobj = SWIG_Py_Void(); return resultobj; @@ -3933,47 +3967,17 @@ fail: } -SWIGINTERN PyObject *_wrap_ldb_msg_element___cmp__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { - PyObject *resultobj = 0; - ldb_msg_element *arg1 = (ldb_msg_element *) 0 ; - ldb_msg_element *arg2 = (ldb_msg_element *) 0 ; - int result; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char * kwnames[] = { - (char *) "self",(char *)"arg2", NULL - }; - - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ldb_msg_element___cmp__",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___cmp__" "', argument " "1"" of type '" "ldb_msg_element *""'"); - } - arg1 = (ldb_msg_element *)(argp1); - res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_ldb_message_element, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ldb_msg_element___cmp__" "', argument " "2"" of type '" "ldb_msg_element *""'"); - } - arg2 = (ldb_msg_element *)(argp2); - result = (int)ldb_msg_element_compare(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *ldb_msg_element_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *MessageElement_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_ldb_message_element, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } +SWIGINTERN PyObject *MessageElement_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + return SWIG_Python_InitShadowInstance(args); +} + SWIGINTERN PyObject *_wrap_ldb_msg_list_elements(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; ldb_msg *arg1 = (ldb_msg *) 0 ; @@ -4118,7 +4122,7 @@ SWIGINTERN PyObject *_wrap_Message_find_element(PyObject *SWIGUNUSEDPARM(self), PyObject *resultobj = 0; ldb_msg *arg1 = (ldb_msg *) 0 ; char *arg2 = (char *) 0 ; - ldb_msg_element *result = 0 ; + ldb_message_element *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -4144,7 +4148,7 @@ SWIGINTERN PyObject *_wrap_Message_find_element(PyObject *SWIGUNUSEDPARM(self), if (arg1 == NULL) SWIG_exception(SWIG_ValueError, "Message can not be None"); - result = (ldb_msg_element *)ldb_msg_find_element(arg1,(char const *)arg2); + result = (ldb_message_element *)ldb_msg_find_element(arg1,(char const *)arg2); { if (result == NULL) PyErr_SetString(PyExc_KeyError, "no such element"); @@ -4163,7 +4167,7 @@ SWIGINTERN PyObject *_wrap_Message___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM( PyObject *resultobj = 0; ldb_msg *arg1 = (ldb_msg *) 0 ; char *arg2 = (char *) 0 ; - ldb_msg_element *arg3 = (ldb_msg_element *) 0 ; + ldb_message_element *arg3 = (ldb_message_element *) 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -4185,9 +4189,9 @@ SWIGINTERN PyObject *_wrap_Message___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM( arg2 = (char *)(buf2); res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_ldb_message_element, 0 | 0 ); if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Message___setitem__" "', argument " "3"" of type '" "ldb_msg_element *""'"); + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Message___setitem__" "', argument " "3"" of type '" "ldb_message_element *""'"); } - arg3 = (ldb_msg_element *)(argp3); + arg3 = (ldb_message_element *)(argp3); if (arg1 == NULL) SWIG_exception(SWIG_ValueError, "Message can not be None"); @@ -4262,7 +4266,7 @@ check_1: fail: SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'Message___setitem__'.\n" " Possible C/C++ prototypes are:\n" - " __setitem__(ldb_msg *,char const *,ldb_msg_element *)\n" + " __setitem__(ldb_msg *,char const *,ldb_message_element *)\n" " __setitem__(ldb_msg *,char const *,PyObject *)\n"); return NULL; } @@ -4787,7 +4791,7 @@ SWIGINTERN PyObject *_wrap_Ldb_add(PyObject *SWIGUNUSEDPARM(self), PyObject *arg arg1 = (ldb *)(argp1); { Py_ssize_t dict_pos, msg_pos; - ldb_msg_element *msgel; + ldb_message_element *msgel; PyObject *key, *value; if (PyDict_Check(obj1)) { @@ -5725,32 +5729,54 @@ static PyMethodDef SwigMethods[] = { { (char *)"ldb_val_to_py_object", (PyCFunction) _wrap_ldb_val_to_py_object, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"new_Dn", (PyCFunction) _wrap_new_Dn, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"delete_Dn", (PyCFunction)_wrap_delete_Dn, METH_O, NULL}, - { (char *)"Dn_validate", (PyCFunction)_wrap_Dn_validate, METH_O, NULL}, + { (char *)"Dn_validate", (PyCFunction)_wrap_Dn_validate, METH_O, (char *)"\n" + "S.validate() -> bool\n" + "Validate DN is correct.\n" + ""}, { (char *)"Dn_get_casefold", (PyCFunction)_wrap_Dn_get_casefold, METH_O, NULL}, { (char *)"Dn___str__", (PyCFunction)_wrap_Dn___str__, METH_O, NULL}, { (char *)"Dn_parent", (PyCFunction)_wrap_Dn_parent, METH_O, NULL}, { (char *)"Dn___cmp__", (PyCFunction) _wrap_Dn___cmp__, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Dn_is_valid", (PyCFunction)_wrap_Dn_is_valid, METH_O, NULL}, - { (char *)"Dn_is_special", (PyCFunction)_wrap_Dn_is_special, METH_O, NULL}, - { (char *)"Dn_is_null", (PyCFunction)_wrap_Dn_is_null, METH_O, NULL}, + { (char *)"Dn_is_special", (PyCFunction)_wrap_Dn_is_special, METH_O, (char *)"\n" + "S.is_special() -> bool\n" + "Check whether this is a special LDB DN.\n" + ""}, + { (char *)"Dn_is_null", (PyCFunction)_wrap_Dn_is_null, METH_O, (char *)"\n" + "S.is_null() -> bool\n" + "Check whether this is a null DN.\n" + ""}, { (char *)"Dn_check_special", (PyCFunction) _wrap_Dn_check_special, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Dn___len__", (PyCFunction)_wrap_Dn___len__, METH_O, NULL}, - { (char *)"Dn_add_child", (PyCFunction) _wrap_Dn_add_child, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"Dn_add_base", (PyCFunction) _wrap_Dn_add_base, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"Dn_canonical_str", (PyCFunction)_wrap_Dn_canonical_str, METH_O, NULL}, - { (char *)"Dn_canonical_ex_str", (PyCFunction)_wrap_Dn_canonical_ex_str, METH_O, NULL}, + { (char *)"Dn_add_child", (PyCFunction) _wrap_Dn_add_child, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.add_child(dn) -> None\n" + "Add a child DN to this DN.\n" + ""}, + { (char *)"Dn_add_base", (PyCFunction) _wrap_Dn_add_base, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.add_base(dn) -> None\n" + "Add a base DN to this DN.\n" + ""}, + { (char *)"Dn_canonical_str", (PyCFunction)_wrap_Dn_canonical_str, METH_O, (char *)"\n" + "S.canonical_str() -> string\n" + "Canonical version of this DN (like a posix path).\n" + ""}, + { (char *)"Dn_canonical_ex_str", (PyCFunction)_wrap_Dn_canonical_ex_str, METH_O, (char *)"\n" + "S.canonical_ex_str() -> string\n" + "Canonical version of this DN (like a posix path, with terminating newline).\n" + ""}, { (char *)"Dn___repr__", (PyCFunction)_wrap_Dn___repr__, METH_O, NULL}, { (char *)"Dn___add__", (PyCFunction) _wrap_Dn___add__, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Dn_swigregister", Dn_swigregister, METH_VARARGS, NULL}, { (char *)"Dn_swiginit", Dn_swiginit, METH_VARARGS, NULL}, - { (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 *)"ldb_msg_element_compare", (PyCFunction) _wrap_ldb_msg_element_compare, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"MessageElement___iter__", (PyCFunction)_wrap_MessageElement___iter__, METH_O, NULL}, + { (char *)"MessageElement___set__", (PyCFunction)_wrap_MessageElement___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}, + { (char *)"MessageElement___len__", (PyCFunction)_wrap_MessageElement___len__, METH_O, NULL}, + { (char *)"MessageElement_get", (PyCFunction) _wrap_MessageElement_get, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"delete_MessageElement", (PyCFunction)_wrap_delete_MessageElement, METH_O, NULL}, + { (char *)"MessageElement_swigregister", MessageElement_swigregister, METH_VARARGS, NULL}, + { (char *)"MessageElement_swiginit", MessageElement_swiginit, METH_VARARGS, NULL}, { (char *)"ldb_msg_list_elements", (PyCFunction) _wrap_ldb_msg_list_elements, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Message_dn_set", _wrap_Message_dn_set, METH_VARARGS, NULL}, { (char *)"Message_dn_get", (PyCFunction)_wrap_Message_dn_get, METH_O, NULL}, @@ -5766,40 +5792,84 @@ static PyMethodDef SwigMethods[] = { { (char *)"Message_swiginit", Message_swiginit, METH_VARARGS, NULL}, { (char *)"ldb_ldif_to_pyobject", (PyCFunction) _wrap_ldb_ldif_to_pyobject, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"new_Ldb", (PyCFunction)_wrap_new_Ldb, METH_NOARGS, NULL}, - { (char *)"Ldb_connect", (PyCFunction) _wrap_Ldb_connect, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"Ldb_connect", (PyCFunction) _wrap_Ldb_connect, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.connect(url,flags=0,options=None) -> None\n" + "Connect to a LDB URL.\n" + ""}, { (char *)"delete_Ldb", (PyCFunction)_wrap_delete_Ldb, METH_O, 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_delete", (PyCFunction) _wrap_Ldb_delete, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.delete(dn) -> None\n" + "Remove an entry.\n" + ""}, + { (char *)"Ldb_rename", (PyCFunction) _wrap_Ldb_rename, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.rename(old_dn, new_dn) -> None\n" + "Rename an entry.\n" + ""}, { (char *)"Ldb_parse_control_strings", (PyCFunction) _wrap_Ldb_parse_control_strings, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"Ldb_add", (PyCFunction) _wrap_Ldb_add, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"Ldb_modify", (PyCFunction) _wrap_Ldb_modify, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"Ldb_add", (PyCFunction) _wrap_Ldb_add, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.add(message) -> None\n" + "Add an entry.\n" + ""}, + { (char *)"Ldb_modify", (PyCFunction) _wrap_Ldb_modify, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.modify(message) -> None\n" + "Modify an entry.\n" + ""}, { (char *)"Ldb_get_config_basedn", (PyCFunction)_wrap_Ldb_get_config_basedn, METH_O, NULL}, { (char *)"Ldb_get_root_basedn", (PyCFunction)_wrap_Ldb_get_root_basedn, METH_O, NULL}, { (char *)"Ldb_get_schema_basedn", (PyCFunction)_wrap_Ldb_get_schema_basedn, METH_O, NULL}, { (char *)"Ldb_get_default_basedn", (PyCFunction)_wrap_Ldb_get_default_basedn, METH_O, NULL}, { (char *)"Ldb_schema_format_value", (PyCFunction) _wrap_Ldb_schema_format_value, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Ldb_errstring", (PyCFunction)_wrap_Ldb_errstring, METH_O, NULL}, - { (char *)"Ldb_set_create_perms", (PyCFunction) _wrap_Ldb_set_create_perms, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"Ldb_set_modules_dir", (PyCFunction) _wrap_Ldb_set_modules_dir, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"Ldb_set_create_perms", (PyCFunction) _wrap_Ldb_set_create_perms, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.set_create_perms(mode) -> None\n" + "Set mode to use when creating new LDB files.\n" + ""}, + { (char *)"Ldb_set_modules_dir", (PyCFunction) _wrap_Ldb_set_modules_dir, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.set_modules_dir(path) -> None\n" + "Set path LDB should search for modules\n" + ""}, { (char *)"Ldb_set_debug", (PyCFunction) _wrap_Ldb_set_debug, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"Ldb_set_opaque", (PyCFunction) _wrap_Ldb_set_opaque, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"Ldb_get_opaque", (PyCFunction) _wrap_Ldb_get_opaque, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"Ldb_transaction_start", (PyCFunction)_wrap_Ldb_transaction_start, METH_O, NULL}, - { (char *)"Ldb_transaction_commit", (PyCFunction)_wrap_Ldb_transaction_commit, METH_O, NULL}, + { (char *)"Ldb_set_opaque", (PyCFunction) _wrap_Ldb_set_opaque, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.set_opaque(name, value) -> None\n" + "Set an opaque value on this LDB connection. \n" + ":note: Passing incorrect values may cause crashes.\n" + ""}, + { (char *)"Ldb_get_opaque", (PyCFunction) _wrap_Ldb_get_opaque, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.get_opaque(name) -> value\n" + "Get an opaque value set on this LDB connection. \n" + ":note: The returned value may not be useful in Python.\n" + ""}, + { (char *)"Ldb_transaction_start", (PyCFunction)_wrap_Ldb_transaction_start, METH_O, (char *)"\n" + "S.transaction_start() -> None\n" + "Start a new transaction.\n" + ""}, + { (char *)"Ldb_transaction_commit", (PyCFunction)_wrap_Ldb_transaction_commit, METH_O, (char *)"\n" + "S.transaction_commit() -> None\n" + "Commit currently active transaction.\n" + ""}, { (char *)"Ldb_transaction_cancel", (PyCFunction)_wrap_Ldb_transaction_cancel, METH_O, NULL}, { (char *)"Ldb_schema_attribute_remove", (PyCFunction) _wrap_Ldb_schema_attribute_remove, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Ldb_schema_attribute_add", (PyCFunction) _wrap_Ldb_schema_attribute_add, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Ldb_setup_wellknown_attributes", (PyCFunction)_wrap_Ldb_setup_wellknown_attributes, METH_O, NULL}, { (char *)"Ldb___contains__", (PyCFunction) _wrap_Ldb___contains__, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"Ldb_parse_ldif", (PyCFunction) _wrap_Ldb_parse_ldif, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"Ldb_parse_ldif", (PyCFunction) _wrap_Ldb_parse_ldif, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.parse_ldif(ldif) -> iter(messages)\n" + "Parse a string formatted using LDIF.\n" + ""}, { (char *)"Ldb___repr__", (PyCFunction)_wrap_Ldb___repr__, METH_O, NULL}, { (char *)"Ldb_swigregister", Ldb_swigregister, METH_VARARGS, NULL}, { (char *)"Ldb_swiginit", Ldb_swiginit, METH_VARARGS, NULL}, - { (char *)"valid_attr_name", (PyCFunction) _wrap_valid_attr_name, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"valid_attr_name", (PyCFunction) _wrap_valid_attr_name, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.valid_attr_name(name) -> bool\n" + "Check whether the supplied name is a valid attribute name.\n" + ""}, { (char *)"timestring", (PyCFunction) _wrap_timestring, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"string_to_time", (PyCFunction) _wrap_string_to_time, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"register_module", (PyCFunction) _wrap_register_module, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"register_module", (PyCFunction) _wrap_register_module, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.register_module(module) -> None\n" + "Register a LDB module.\n" + ""}, { NULL, NULL, 0, NULL } }; @@ -5814,7 +5884,7 @@ static swig_type_info _swigt__p_ldb_context = {"_p_ldb_context", "struct ldb_con static swig_type_info _swigt__p_ldb_dn = {"_p_ldb_dn", "struct ldb_dn *|ldb_dn *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_ldb_ldif = {"_p_ldb_ldif", "struct ldb_ldif *|ldb_ldif *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_ldb_message = {"_p_ldb_message", "ldb_msg *|struct ldb_message *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_ldb_message_element = {"_p_ldb_message_element", "struct ldb_message_element *|ldb_msg_element *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_ldb_message_element = {"_p_ldb_message_element", "struct ldb_message_element *|ldb_message_element *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_ldb_module_ops = {"_p_ldb_module_ops", "struct ldb_module_ops *", 0, 0, (void*)0, 0}; 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_ldb_val = {"_p_ldb_val", "struct ldb_val *", 0, 0, (void*)0, 0}; -- cgit From fb2d69a140c123ff78df113532d4ead21f3362c3 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 22 May 2008 17:02:31 +0200 Subject: Add more docstrings in the ldb python module. (This used to be commit a649a010670ee2c0d155aa62654841cf1f2bab8f) --- source4/lib/ldb/ldb.i | 14 +++++++++++++- source4/lib/ldb/ldb.py | 21 ++++++++++++++++++++- source4/lib/ldb/ldb_wrap.c | 14 ++++++++++---- 3 files changed, 43 insertions(+), 6 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/ldb.i b/source4/lib/ldb/ldb.i index 6a807a7dde..38a928ffb1 100644 --- a/source4/lib/ldb/ldb.i +++ b/source4/lib/ldb/ldb.i @@ -194,6 +194,7 @@ PyObject *ldb_val_to_py_object(struct ldb_context *ldb_ctx, %rename(__cmp__) ldb_dn::compare; %rename(__len__) ldb_dn::get_comp_num; %rename(Dn) ldb_dn; +%feature("docstring") ldb_dn "A LDB distinguished name."; typedef struct ldb_dn { %extend { ldb_dn(ldb *ldb_ctx, const char *str) @@ -356,6 +357,7 @@ PyObject *ldb_msg_element_to_set(struct ldb_context *ldb_ctx, int ldb_msg_element_compare(ldb_message_element *, ldb_message_element *); /* ldb_message_element */ %rename(MessageElement) ldb_message_element; +%feature("docstring") ldb_message_element "Message element."; %rename(ldb_message_element_compare) ldb_msg_element_compare; typedef struct ldb_message_element { %extend { @@ -417,6 +419,7 @@ typedef struct ldb_message_element { /* ldb_message */ +%feature("docstring") ldb_message "Message."; %rename(Message) ldb_message; #ifdef SWIGPYTHON %rename(__delitem__) ldb_message::remove_attr; @@ -613,6 +616,7 @@ PyObject *PyExc_LdbError; } %rename(Ldb) ldb_context; +%feature("docstring") ldb_context "Connection to a LDB database."; %typemap(in,noblock=1) struct ldb_dn * { if (ldb_dn_from_pyobject(NULL, $input, arg1, &$1) != 0) { @@ -776,6 +780,9 @@ typedef struct ldb_context { %feature("docstring") set_modules_dir "S.set_modules_dir(path) -> None\n" \ "Set path LDB should search for modules"; void set_modules_dir(const char *path); + %feature("docstring") set_debug "S.set_debug(callback) -> None\n" \ + "Set callback for LDB debug messages.\n" \ + "The callback should accept a debug level and debug text."; ldb_error set_debug(void (*debug)(void *context, enum ldb_debug_level level, const char *fmt, va_list ap), void *context); @@ -793,7 +800,7 @@ typedef struct ldb_context { %feature("docstring") transaction_commit "S.transaction_commit() -> None\n" \ "Commit currently active transaction."; ldb_error transaction_commit(); - %feature("docstring") transaction_commit "S.transaction_cancel() -> None\n" \ + %feature("docstring") transaction_cancel "S.transaction_cancel() -> None\n" \ "Cancel currently active transaction."; ldb_error transaction_cancel(); void schema_attribute_remove(const char *name); @@ -877,6 +884,9 @@ int ldb_valid_attr_name(const char *s); typedef unsigned long time_t; +%feature("docstring") timestring "S.timestring(int) -> string\n" + "Generate a LDAP time string from a UNIX timestamp"; + %inline %{ static char *timestring(time_t t) { @@ -888,6 +898,8 @@ static char *timestring(time_t t) %} %rename(string_to_time) ldb_string_to_time; +%feature("docstring") string_to_time "S.string_to_time(string) -> int\n" + "Parse a LDAP time string into a UNIX timestamp."; time_t ldb_string_to_time(const char *s); %typemap(in,noblock=1) const struct ldb_module_ops * { diff --git a/source4/lib/ldb/ldb.py b/source4/lib/ldb/ldb.py index 0149f05429..56f34c8605 100644 --- a/source4/lib/ldb/ldb.py +++ b/source4/lib/ldb/ldb.py @@ -67,8 +67,10 @@ CHANGETYPE_DELETE = _ldb.CHANGETYPE_DELETE CHANGETYPE_MODIFY = _ldb.CHANGETYPE_MODIFY ldb_val_to_py_object = _ldb.ldb_val_to_py_object class Dn(object): + """A LDB Distinguished name.""" thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): + """A LDB Distinguished name.""" _ldb.Dn_swiginit(self,_ldb.new_Dn(*args, **kwargs)) __swig_destroy__ = _ldb.delete_Dn def validate(*args, **kwargs): @@ -148,9 +150,11 @@ Dn_swigregister(Dn) ldb_msg_element_compare = _ldb.ldb_msg_element_compare class MessageElement(object): + """A message element.""" 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): + """A message element.""" _ldb.MessageElement_swiginit(self,_ldb.new_MessageElement(*args, **kwargs)) __swig_destroy__ = _ldb.delete_MessageElement def __getitem__(self, i): @@ -182,6 +186,7 @@ MessageElement_swigregister(MessageElement) ldb_msg_list_elements = _ldb.ldb_msg_list_elements class Message(object): + """A LDB message.""" thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr dn = _swig_property(_ldb.Message_dn_get, _ldb.Message_dn_set) @@ -260,6 +265,7 @@ LDB_ERR_OBJECT_CLASS_MODS_PROHIBITED = _ldb.LDB_ERR_OBJECT_CLASS_MODS_PROHIBITED LDB_ERR_AFFECTS_MULTIPLE_DSAS = _ldb.LDB_ERR_AFFECTS_MULTIPLE_DSAS LDB_ERR_OTHER = _ldb.LDB_ERR_OTHER class Ldb(object): + """A connection to a LDB database.""" thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): _ldb.Ldb_swiginit(self,_ldb.new_Ldb(*args, **kwargs)) @@ -343,6 +349,13 @@ class Ldb(object): """ return _ldb.Ldb_transaction_commit(*args, **kwargs) + def transaction_cancel(*args, **kwargs): + """ + S.transaction_cancel() -> None + Cancel currently active transaction. + """ + return _ldb.Ldb_transaction_cancel(*args, **kwargs) + def parse_ldif(*args, **kwargs): """ S.parse_ldif(ldif) -> iter(messages) @@ -415,7 +428,13 @@ def valid_attr_name(*args, **kwargs): Check whether the supplied name is a valid attribute name. """ return _ldb.valid_attr_name(*args, **kwargs) -timestring = _ldb.timestring + +def timestring(*args, **kwargs): + """ + S.timestring(int) -> string + Generate a LDAP time string from a UNIX timestamp + """ + return _ldb.timestring(*args, **kwargs) string_to_time = _ldb.string_to_time def register_module(*args, **kwargs): diff --git a/source4/lib/ldb/ldb_wrap.c b/source4/lib/ldb/ldb_wrap.c index bfd507a8f2..95b71547ef 100644 --- a/source4/lib/ldb/ldb_wrap.c +++ b/source4/lib/ldb/ldb_wrap.c @@ -5727,7 +5727,7 @@ fail: static PyMethodDef SwigMethods[] = { { (char *)"ldb_val_to_py_object", (PyCFunction) _wrap_ldb_val_to_py_object, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"new_Dn", (PyCFunction) _wrap_new_Dn, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"new_Dn", (PyCFunction) _wrap_new_Dn, METH_VARARGS | METH_KEYWORDS, (char *)"A LDB Distinguished name."}, { (char *)"delete_Dn", (PyCFunction)_wrap_delete_Dn, METH_O, NULL}, { (char *)"Dn_validate", (PyCFunction)_wrap_Dn_validate, METH_O, (char *)"\n" "S.validate() -> bool\n" @@ -5771,7 +5771,7 @@ static PyMethodDef SwigMethods[] = { { (char *)"ldb_msg_element_compare", (PyCFunction) _wrap_ldb_msg_element_compare, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"MessageElement___iter__", (PyCFunction)_wrap_MessageElement___iter__, METH_O, NULL}, { (char *)"MessageElement___set__", (PyCFunction)_wrap_MessageElement___set__, METH_O, NULL}, - { (char *)"new_MessageElement", (PyCFunction) _wrap_new_MessageElement, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"new_MessageElement", (PyCFunction) _wrap_new_MessageElement, METH_VARARGS | METH_KEYWORDS, (char *)"A message element."}, { (char *)"MessageElement___len__", (PyCFunction)_wrap_MessageElement___len__, METH_O, NULL}, { (char *)"MessageElement_get", (PyCFunction) _wrap_MessageElement_get, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"delete_MessageElement", (PyCFunction)_wrap_delete_MessageElement, METH_O, NULL}, @@ -5848,7 +5848,10 @@ static PyMethodDef SwigMethods[] = { "S.transaction_commit() -> None\n" "Commit currently active transaction.\n" ""}, - { (char *)"Ldb_transaction_cancel", (PyCFunction)_wrap_Ldb_transaction_cancel, METH_O, NULL}, + { (char *)"Ldb_transaction_cancel", (PyCFunction)_wrap_Ldb_transaction_cancel, METH_O, (char *)"\n" + "S.transaction_cancel() -> None\n" + "Cancel currently active transaction.\n" + ""}, { (char *)"Ldb_schema_attribute_remove", (PyCFunction) _wrap_Ldb_schema_attribute_remove, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Ldb_schema_attribute_add", (PyCFunction) _wrap_Ldb_schema_attribute_add, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Ldb_setup_wellknown_attributes", (PyCFunction)_wrap_Ldb_setup_wellknown_attributes, METH_O, NULL}, @@ -5864,7 +5867,10 @@ static PyMethodDef SwigMethods[] = { "S.valid_attr_name(name) -> bool\n" "Check whether the supplied name is a valid attribute name.\n" ""}, - { (char *)"timestring", (PyCFunction) _wrap_timestring, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"timestring", (PyCFunction) _wrap_timestring, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.timestring(int) -> string\n" + "Generate a LDAP time string from a UNIX timestamp\n" + ""}, { (char *)"string_to_time", (PyCFunction) _wrap_string_to_time, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"register_module", (PyCFunction) _wrap_register_module, METH_VARARGS | METH_KEYWORDS, (char *)"\n" "S.register_module(module) -> None\n" -- cgit From 9893651c0237c9dba43aadfb8f5f68be74bbfd6c Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 22 May 2008 17:15:00 +0200 Subject: Add module docstring, docstrings for constructors. (This used to be commit 67d738d6e65476263a2b7c236a57fe2b0a2dfe32) --- source4/lib/ldb/ldb.i | 12 ++++++++++-- source4/lib/ldb/ldb.py | 42 +++++++++++++++++++++++++++++++++++------- source4/lib/ldb/ldb_wrap.c | 23 ++++++++++++++++++----- 3 files changed, 63 insertions(+), 14 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/ldb.i b/source4/lib/ldb/ldb.i index 38a928ffb1..2c5b7535b5 100644 --- a/source4/lib/ldb/ldb.i +++ b/source4/lib/ldb/ldb.i @@ -25,7 +25,11 @@ License along with this library; if not, see . */ -%module ldb +%define DOCSTRING +"An interface to LDB, a LDAP-like API that can either to talk an embedded database (TDB-based) or a standards-compliant LDAP server." +%enddef + +%module(docstring=DOCSTRING) ldb %{ @@ -197,6 +201,8 @@ PyObject *ldb_val_to_py_object(struct ldb_context *ldb_ctx, %feature("docstring") ldb_dn "A LDB distinguished name."; typedef struct ldb_dn { %extend { + %feature("docstring") ldb_dn "S.__init__(ldb, string)\n" \ + "Create a new DN."; ldb_dn(ldb *ldb_ctx, const char *str) { ldb_dn *ret = ldb_dn_new(ldb_ctx, ldb_ctx, str); @@ -216,6 +222,8 @@ fail: bool validate(); const char *get_casefold(); const char *get_linearized(); + %feature("docstring") parent "S.parent() -> dn\n" \ + "Get the parent for this DN."; ldb_dn *parent() { return ldb_dn_get_parent(NULL, $self); } int compare(ldb_dn *other); bool is_valid(); @@ -898,7 +906,7 @@ static char *timestring(time_t t) %} %rename(string_to_time) ldb_string_to_time; -%feature("docstring") string_to_time "S.string_to_time(string) -> int\n" +%feature("docstring") ldb_string_to_time "S.string_to_time(string) -> int\n" "Parse a LDAP time string into a UNIX timestamp."; time_t ldb_string_to_time(const char *s); diff --git a/source4/lib/ldb/ldb.py b/source4/lib/ldb/ldb.py index 56f34c8605..e458398b0b 100644 --- a/source4/lib/ldb/ldb.py +++ b/source4/lib/ldb/ldb.py @@ -3,6 +3,10 @@ # # Don't modify this file, modify the SWIG interface instead. +""" +An interface to LDB, a LDAP-like API that can either to talk an embedded database (TDB-based) or a standards-compliant LDAP server. +""" + import _ldb import new new_instancemethod = new.instancemethod @@ -67,10 +71,13 @@ CHANGETYPE_DELETE = _ldb.CHANGETYPE_DELETE CHANGETYPE_MODIFY = _ldb.CHANGETYPE_MODIFY ldb_val_to_py_object = _ldb.ldb_val_to_py_object class Dn(object): - """A LDB Distinguished name.""" + """A LDB distinguished name.""" thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): - """A LDB Distinguished name.""" + """ + S.__init__(ldb, string) + Create a new DN. + """ _ldb.Dn_swiginit(self,_ldb.new_Dn(*args, **kwargs)) __swig_destroy__ = _ldb.delete_Dn def validate(*args, **kwargs): @@ -80,6 +87,13 @@ class Dn(object): """ return _ldb.Dn_validate(*args, **kwargs) + def parent(*args, **kwargs): + """ + S.parent() -> dn + Get the parent for this DN. + """ + return _ldb.Dn_parent(*args, **kwargs) + def is_special(*args, **kwargs): """ S.is_special() -> bool @@ -150,11 +164,11 @@ Dn_swigregister(Dn) ldb_msg_element_compare = _ldb.ldb_msg_element_compare class MessageElement(object): - """A message element.""" + """Message element.""" 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): - """A message element.""" + """Message element.""" _ldb.MessageElement_swiginit(self,_ldb.new_MessageElement(*args, **kwargs)) __swig_destroy__ = _ldb.delete_MessageElement def __getitem__(self, i): @@ -186,7 +200,7 @@ MessageElement_swigregister(MessageElement) ldb_msg_list_elements = _ldb.ldb_msg_list_elements class Message(object): - """A LDB message.""" + """Message.""" thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr dn = _swig_property(_ldb.Message_dn_get, _ldb.Message_dn_set) @@ -265,7 +279,7 @@ LDB_ERR_OBJECT_CLASS_MODS_PROHIBITED = _ldb.LDB_ERR_OBJECT_CLASS_MODS_PROHIBITED LDB_ERR_AFFECTS_MULTIPLE_DSAS = _ldb.LDB_ERR_AFFECTS_MULTIPLE_DSAS LDB_ERR_OTHER = _ldb.LDB_ERR_OTHER class Ldb(object): - """A connection to a LDB database.""" + """Connection to a LDB database.""" thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): _ldb.Ldb_swiginit(self,_ldb.new_Ldb(*args, **kwargs)) @@ -319,6 +333,14 @@ class Ldb(object): """ return _ldb.Ldb_set_modules_dir(*args, **kwargs) + def set_debug(*args, **kwargs): + """ + S.set_debug(callback) -> None + Set callback for LDB debug messages. + The callback should accept a debug level and debug text. + """ + return _ldb.Ldb_set_debug(*args, **kwargs) + def set_opaque(*args, **kwargs): """ S.set_opaque(name, value) -> None @@ -435,7 +457,13 @@ def timestring(*args, **kwargs): Generate a LDAP time string from a UNIX timestamp """ return _ldb.timestring(*args, **kwargs) -string_to_time = _ldb.string_to_time + +def string_to_time(*args, **kwargs): + """ + S.string_to_time(string) -> int + Parse a LDAP time string into a UNIX timestamp. + """ + return _ldb.string_to_time(*args, **kwargs) def register_module(*args, **kwargs): """ diff --git a/source4/lib/ldb/ldb_wrap.c b/source4/lib/ldb/ldb_wrap.c index 95b71547ef..01d683245e 100644 --- a/source4/lib/ldb/ldb_wrap.c +++ b/source4/lib/ldb/ldb_wrap.c @@ -5727,7 +5727,10 @@ fail: static PyMethodDef SwigMethods[] = { { (char *)"ldb_val_to_py_object", (PyCFunction) _wrap_ldb_val_to_py_object, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"new_Dn", (PyCFunction) _wrap_new_Dn, METH_VARARGS | METH_KEYWORDS, (char *)"A LDB Distinguished name."}, + { (char *)"new_Dn", (PyCFunction) _wrap_new_Dn, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.__init__(ldb, string)\n" + "Create a new DN.\n" + ""}, { (char *)"delete_Dn", (PyCFunction)_wrap_delete_Dn, METH_O, NULL}, { (char *)"Dn_validate", (PyCFunction)_wrap_Dn_validate, METH_O, (char *)"\n" "S.validate() -> bool\n" @@ -5735,7 +5738,10 @@ static PyMethodDef SwigMethods[] = { ""}, { (char *)"Dn_get_casefold", (PyCFunction)_wrap_Dn_get_casefold, METH_O, NULL}, { (char *)"Dn___str__", (PyCFunction)_wrap_Dn___str__, METH_O, NULL}, - { (char *)"Dn_parent", (PyCFunction)_wrap_Dn_parent, METH_O, NULL}, + { (char *)"Dn_parent", (PyCFunction)_wrap_Dn_parent, METH_O, (char *)"\n" + "S.parent() -> dn\n" + "Get the parent for this DN.\n" + ""}, { (char *)"Dn___cmp__", (PyCFunction) _wrap_Dn___cmp__, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Dn_is_valid", (PyCFunction)_wrap_Dn_is_valid, METH_O, NULL}, { (char *)"Dn_is_special", (PyCFunction)_wrap_Dn_is_special, METH_O, (char *)"\n" @@ -5771,7 +5777,7 @@ static PyMethodDef SwigMethods[] = { { (char *)"ldb_msg_element_compare", (PyCFunction) _wrap_ldb_msg_element_compare, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"MessageElement___iter__", (PyCFunction)_wrap_MessageElement___iter__, METH_O, NULL}, { (char *)"MessageElement___set__", (PyCFunction)_wrap_MessageElement___set__, METH_O, NULL}, - { (char *)"new_MessageElement", (PyCFunction) _wrap_new_MessageElement, METH_VARARGS | METH_KEYWORDS, (char *)"A message element."}, + { (char *)"new_MessageElement", (PyCFunction) _wrap_new_MessageElement, METH_VARARGS | METH_KEYWORDS, (char *)"Message element."}, { (char *)"MessageElement___len__", (PyCFunction)_wrap_MessageElement___len__, METH_O, NULL}, { (char *)"MessageElement_get", (PyCFunction) _wrap_MessageElement_get, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"delete_MessageElement", (PyCFunction)_wrap_delete_MessageElement, METH_O, NULL}, @@ -5829,7 +5835,11 @@ static PyMethodDef SwigMethods[] = { "S.set_modules_dir(path) -> None\n" "Set path LDB should search for modules\n" ""}, - { (char *)"Ldb_set_debug", (PyCFunction) _wrap_Ldb_set_debug, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"Ldb_set_debug", (PyCFunction) _wrap_Ldb_set_debug, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.set_debug(callback) -> None\n" + "Set callback for LDB debug messages.\n" + "The callback should accept a debug level and debug text.\n" + ""}, { (char *)"Ldb_set_opaque", (PyCFunction) _wrap_Ldb_set_opaque, METH_VARARGS | METH_KEYWORDS, (char *)"\n" "S.set_opaque(name, value) -> None\n" "Set an opaque value on this LDB connection. \n" @@ -5871,7 +5881,10 @@ static PyMethodDef SwigMethods[] = { "S.timestring(int) -> string\n" "Generate a LDAP time string from a UNIX timestamp\n" ""}, - { (char *)"string_to_time", (PyCFunction) _wrap_string_to_time, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"string_to_time", (PyCFunction) _wrap_string_to_time, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.string_to_time(string) -> int\n" + "Parse a LDAP time string into a UNIX timestamp.\n" + ""}, { (char *)"register_module", (PyCFunction) _wrap_register_module, METH_VARARGS | METH_KEYWORDS, (char *)"\n" "S.register_module(module) -> None\n" "Register a LDB module.\n" -- cgit From 66762985e78f6f717658489b6618cb515ca6db71 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 22 May 2008 17:26:55 +0200 Subject: Add some docstrings to tdb. (This used to be commit 3563d62663c36ff267011f1f6f9b256be21c32fb) --- source4/lib/tdb/tdb.i | 43 ++++++++- source4/lib/tdb/tdb.py | 180 ++++++++++++++++++++++++++++++------- source4/lib/tdb/tdb_wrap.c | 218 +++++++++++++++++++++++++++------------------ 3 files changed, 319 insertions(+), 122 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/tdb/tdb.i b/source4/lib/tdb/tdb.i index 704f0facc6..5f23568170 100644 --- a/source4/lib/tdb/tdb.i +++ b/source4/lib/tdb/tdb.i @@ -24,7 +24,11 @@ License along with this library; if not, see . */ -%module tdb +%define DOCSTRING +"TDB is a simple key-value database similar to GDBM that supports multiple writers." +%enddef + +%module(docstring=DOCSTRING) tdb %{ @@ -138,7 +142,8 @@ enum TDB_ERROR { $1 = TDB_REPLACE; } -%rename(Tdb) tdb; +%rename(Tdb) tdb_context; +%feature("docstring") tdb_context "A TDB file."; %typemap(out,noblock=1) tdb * { /* Throw an IOError exception from errno if tdb_open() returns NULL */ if ($1 == NULL) { @@ -150,34 +155,68 @@ enum TDB_ERROR { typedef struct tdb_context { %extend { + %feature("docstring") tdb "S.__init__(name,hash_size=0,tdb_flags=TDB_DEFAULT,flags=O_RDWR,mode=0600)\n" + "Open a TDB file."; tdb(const char *name, int hash_size, int tdb_flags, int flags, mode_t mode) { return tdb_open(name, hash_size, tdb_flags, flags, mode); } enum TDB_ERROR error(); ~tdb() { tdb_close($self); } + %feature("docstring") close "S.close() -> None\n" + "Close the TDB file."; int close(); int append(TDB_DATA key, TDB_DATA new_dbuf); + %feature("docstring") errorstr "S.errorstr() -> errorstring\n" + "Obtain last error message."; const char *errorstr(); %rename(get) fetch; + %feature("docstring") fetch "S.fetch(key) -> value\n" + "Fetch a value."; TDB_DATA fetch(TDB_DATA key); + %feature("docstring") delete "S.delete(key) -> None\n" + "Delete an entry."; int delete(TDB_DATA key); + %feature("docstring") store "S.store(key, value, flag=TDB_REPLACE) -> None\n" + "Store an entry."; int store(TDB_DATA key, TDB_DATA dbuf, int flag); int exists(TDB_DATA key); + %feature("docstring") firstkey "S.firstkey() -> data\n" + "Return the first key in this database."; TDB_DATA firstkey(); + %feature("docstring") nextkey "S.nextkey(prev) -> data\n" + "Return the next key in this database."; TDB_DATA nextkey(TDB_DATA key); + %feature("docstring") lockall "S.lockall() -> bool"; int lockall(); + %feature("docstring") unlockall "S.unlockall() -> bool"; int unlockall(); + %feature("docstring") unlockall "S.lockall_read() -> bool"; int lockall_read(); + %feature("docstring") unlockall "S.unlockall_read() -> bool"; int unlockall_read(); + %feature("docstring") reopen "S.reopen() -> bool\n" + "Reopen this file."; int reopen(); + %feature("docstring") transaction_start "S.transaction_start() -> None\n" + "Start a new transaction."; int transaction_start(); + %feature("docstring") transaction_commit "S.transaction_commit() -> None\n" + "Commit the currently active transaction."; int transaction_commit(); + %feature("docstring") transaction_cancel "S.transaction_cancel() -> None\n" + "Cancel the currently active transaction."; int transaction_cancel(); int transaction_recover(); + %feature("docstring") hash_size "S.hash_size() -> int"; int hash_size(); + %feature("docstring") map_size "S.map_size() -> int"; size_t map_size(); + %feature("docstring") get_flags "S.get_flags() -> int"; int get_flags(); + %feature("docstring") set_max_dead "S.set_max_dead(int) -> None"; void set_max_dead(int max_dead); + %feature("docstring") name "S.name() -> path\n" \ + "Return filename of this TDB file."; const char *name(); } diff --git a/source4/lib/tdb/tdb.py b/source4/lib/tdb/tdb.py index eb76ca6459..a8c1d06e0d 100644 --- a/source4/lib/tdb/tdb.py +++ b/source4/lib/tdb/tdb.py @@ -3,6 +3,10 @@ # # Don't modify this file, modify the SWIG interface instead. +""" +TDB is a simple key-value database similar to GDBM that supports multiple writers. +""" + import _tdb import new new_instancemethod = new.instancemethod @@ -78,11 +82,125 @@ TDB_ERR_LOCK_TIMEOUT = _tdb.TDB_ERR_LOCK_TIMEOUT TDB_ERR_NOEXIST = _tdb.TDB_ERR_NOEXIST TDB_ERR_EINVAL = _tdb.TDB_ERR_EINVAL TDB_ERR_RDONLY = _tdb.TDB_ERR_RDONLY -class tdb(object): +class Tdb(object): + """A TDB file.""" thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') - def __init__(self, *args, **kwargs): raise AttributeError, "No constructor defined" __repr__ = _swig_repr - __swig_destroy__ = _tdb.delete_tdb + def __init__(self, *args, **kwargs): + """ + S.__init__(name,hash_size=0,tdb_flags=TDB_DEFAULT,flags=O_RDWR,mode=0600) + Open a TDB file. + """ + _tdb.Tdb_swiginit(self,_tdb.new_Tdb(*args, **kwargs)) + __swig_destroy__ = _tdb.delete_Tdb + def close(*args, **kwargs): + """ + S.close() -> None + Close the TDB file. + """ + return _tdb.Tdb_close(*args, **kwargs) + + def errorstr(*args, **kwargs): + """ + S.errorstr() -> errorstring + Obtain last error message. + """ + return _tdb.Tdb_errorstr(*args, **kwargs) + + def get(*args, **kwargs): + """ + S.fetch(key) -> value + Fetch a value. + """ + return _tdb.Tdb_get(*args, **kwargs) + + def delete(*args, **kwargs): + """ + S.delete(key) -> None + Delete an entry. + """ + return _tdb.Tdb_delete(*args, **kwargs) + + def store(*args, **kwargs): + """ + S.store(key, value, flag=TDB_REPLACE) -> None + Store an entry. + """ + return _tdb.Tdb_store(*args, **kwargs) + + def firstkey(*args, **kwargs): + """ + S.firstkey() -> data + Return the first key in this database. + """ + return _tdb.Tdb_firstkey(*args, **kwargs) + + def nextkey(*args, **kwargs): + """ + S.nextkey(prev) -> data + Return the next key in this database. + """ + return _tdb.Tdb_nextkey(*args, **kwargs) + + def lock_all(*args, **kwargs): + """S.lockall() -> bool""" + return _tdb.Tdb_lock_all(*args, **kwargs) + + def unlock_all(*args, **kwargs): + """S.unlockall() -> bool""" + return _tdb.Tdb_unlock_all(*args, **kwargs) + + def reopen(*args, **kwargs): + """ + S.reopen() -> bool + Reopen this file. + """ + return _tdb.Tdb_reopen(*args, **kwargs) + + def transaction_start(*args, **kwargs): + """ + S.transaction_start() -> None + Start a new transaction. + """ + return _tdb.Tdb_transaction_start(*args, **kwargs) + + def transaction_commit(*args, **kwargs): + """ + S.transaction_commit() -> None + Commit the currently active transaction. + """ + return _tdb.Tdb_transaction_commit(*args, **kwargs) + + def transaction_cancel(*args, **kwargs): + """ + S.transaction_cancel() -> None + Cancel the currently active transaction. + """ + return _tdb.Tdb_transaction_cancel(*args, **kwargs) + + def hash_size(*args, **kwargs): + """S.hash_size() -> int""" + return _tdb.Tdb_hash_size(*args, **kwargs) + + def map_size(*args, **kwargs): + """S.map_size() -> int""" + return _tdb.Tdb_map_size(*args, **kwargs) + + def get_flags(*args, **kwargs): + """S.get_flags() -> int""" + return _tdb.Tdb_get_flags(*args, **kwargs) + + def set_max_dead(*args, **kwargs): + """S.set_max_dead(int) -> None""" + return _tdb.Tdb_set_max_dead(*args, **kwargs) + + def name(*args, **kwargs): + """ + S.name() -> path + Return filename of this TDB file. + """ + return _tdb.Tdb_name(*args, **kwargs) + def __repr__(self): return "Tdb('%s')" % self.name() @@ -178,36 +296,32 @@ class tdb(object): -tdb.error = new_instancemethod(_tdb.tdb_error,None,tdb) -tdb.close = new_instancemethod(_tdb.tdb_close,None,tdb) -tdb.append = new_instancemethod(_tdb.tdb_append,None,tdb) -tdb.errorstr = new_instancemethod(_tdb.tdb_errorstr,None,tdb) -tdb.get = new_instancemethod(_tdb.tdb_get,None,tdb) -tdb.delete = new_instancemethod(_tdb.tdb_delete,None,tdb) -tdb.store = new_instancemethod(_tdb.tdb_store,None,tdb) -tdb.exists = new_instancemethod(_tdb.tdb_exists,None,tdb) -tdb.firstkey = new_instancemethod(_tdb.tdb_firstkey,None,tdb) -tdb.nextkey = new_instancemethod(_tdb.tdb_nextkey,None,tdb) -tdb.lock_all = new_instancemethod(_tdb.tdb_lock_all,None,tdb) -tdb.unlock_all = new_instancemethod(_tdb.tdb_unlock_all,None,tdb) -tdb.read_lock_all = new_instancemethod(_tdb.tdb_read_lock_all,None,tdb) -tdb.read_unlock_all = new_instancemethod(_tdb.tdb_read_unlock_all,None,tdb) -tdb.reopen = new_instancemethod(_tdb.tdb_reopen,None,tdb) -tdb.transaction_start = new_instancemethod(_tdb.tdb_transaction_start,None,tdb) -tdb.transaction_commit = new_instancemethod(_tdb.tdb_transaction_commit,None,tdb) -tdb.transaction_cancel = new_instancemethod(_tdb.tdb_transaction_cancel,None,tdb) -tdb.transaction_recover = new_instancemethod(_tdb.tdb_transaction_recover,None,tdb) -tdb.hash_size = new_instancemethod(_tdb.tdb_hash_size,None,tdb) -tdb.map_size = new_instancemethod(_tdb.tdb_map_size,None,tdb) -tdb.get_flags = new_instancemethod(_tdb.tdb_get_flags,None,tdb) -tdb.set_max_dead = new_instancemethod(_tdb.tdb_set_max_dead,None,tdb) -tdb.name = new_instancemethod(_tdb.tdb_name,None,tdb) -tdb_swigregister = _tdb.tdb_swigregister -tdb_swigregister(tdb) - -def Tdb(*args, **kwargs): - val = _tdb.new_Tdb(*args, **kwargs) - return val +Tdb.error = new_instancemethod(_tdb.Tdb_error,None,Tdb) +Tdb.close = new_instancemethod(_tdb.Tdb_close,None,Tdb) +Tdb.append = new_instancemethod(_tdb.Tdb_append,None,Tdb) +Tdb.errorstr = new_instancemethod(_tdb.Tdb_errorstr,None,Tdb) +Tdb.get = new_instancemethod(_tdb.Tdb_get,None,Tdb) +Tdb.delete = new_instancemethod(_tdb.Tdb_delete,None,Tdb) +Tdb.store = new_instancemethod(_tdb.Tdb_store,None,Tdb) +Tdb.exists = new_instancemethod(_tdb.Tdb_exists,None,Tdb) +Tdb.firstkey = new_instancemethod(_tdb.Tdb_firstkey,None,Tdb) +Tdb.nextkey = new_instancemethod(_tdb.Tdb_nextkey,None,Tdb) +Tdb.lock_all = new_instancemethod(_tdb.Tdb_lock_all,None,Tdb) +Tdb.unlock_all = new_instancemethod(_tdb.Tdb_unlock_all,None,Tdb) +Tdb.read_lock_all = new_instancemethod(_tdb.Tdb_read_lock_all,None,Tdb) +Tdb.read_unlock_all = new_instancemethod(_tdb.Tdb_read_unlock_all,None,Tdb) +Tdb.reopen = new_instancemethod(_tdb.Tdb_reopen,None,Tdb) +Tdb.transaction_start = new_instancemethod(_tdb.Tdb_transaction_start,None,Tdb) +Tdb.transaction_commit = new_instancemethod(_tdb.Tdb_transaction_commit,None,Tdb) +Tdb.transaction_cancel = new_instancemethod(_tdb.Tdb_transaction_cancel,None,Tdb) +Tdb.transaction_recover = new_instancemethod(_tdb.Tdb_transaction_recover,None,Tdb) +Tdb.hash_size = new_instancemethod(_tdb.Tdb_hash_size,None,Tdb) +Tdb.map_size = new_instancemethod(_tdb.Tdb_map_size,None,Tdb) +Tdb.get_flags = new_instancemethod(_tdb.Tdb_get_flags,None,Tdb) +Tdb.set_max_dead = new_instancemethod(_tdb.Tdb_set_max_dead,None,Tdb) +Tdb.name = new_instancemethod(_tdb.Tdb_name,None,Tdb) +Tdb_swigregister = _tdb.Tdb_swigregister +Tdb_swigregister(Tdb) diff --git a/source4/lib/tdb/tdb_wrap.c b/source4/lib/tdb/tdb_wrap.c index f36d569937..27da552d33 100644 --- a/source4/lib/tdb/tdb_wrap.c +++ b/source4/lib/tdb/tdb_wrap.c @@ -2892,7 +2892,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_error(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Tdb_error(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; enum TDB_ERROR result; @@ -2904,7 +2904,7 @@ SWIGINTERN PyObject *_wrap_tdb_error(PyObject *SWIGUNUSEDPARM(self), PyObject *a swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_error" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_error" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); result = (enum TDB_ERROR)tdb_error(arg1); @@ -2915,7 +2915,7 @@ fail: } -SWIGINTERN PyObject *_wrap_delete_tdb(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_delete_Tdb(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; void *argp1 = 0 ; @@ -2926,7 +2926,7 @@ SWIGINTERN PyObject *_wrap_delete_tdb(PyObject *SWIGUNUSEDPARM(self), PyObject * swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_tdb" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Tdb" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); delete_tdb(arg1); @@ -2938,7 +2938,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_close(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Tdb_close(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; int result; @@ -2950,7 +2950,7 @@ SWIGINTERN PyObject *_wrap_tdb_close(PyObject *SWIGUNUSEDPARM(self), PyObject *a swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_close" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_close" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); result = (int)tdb_close(arg1); @@ -2961,7 +2961,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_Tdb_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; TDB_DATA arg2 ; @@ -2976,10 +2976,10 @@ SWIGINTERN PyObject *_wrap_tdb_append(PyObject *SWIGUNUSEDPARM(self), PyObject * (char *) "self",(char *) "key",(char *) "new_dbuf", NULL }; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:tdb_append",kwnames,&obj0,&obj1,&obj2)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:Tdb_append",kwnames,&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_append" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_append" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); if (obj1 == Py_None) { @@ -3010,7 +3010,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_errorstr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Tdb_errorstr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; char *result = 0 ; @@ -3022,7 +3022,7 @@ SWIGINTERN PyObject *_wrap_tdb_errorstr(PyObject *SWIGUNUSEDPARM(self), PyObject swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_errorstr" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_errorstr" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); result = (char *)tdb_errorstr(arg1); @@ -3033,7 +3033,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_Tdb_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; TDB_DATA arg2 ; @@ -3046,10 +3046,10 @@ SWIGINTERN PyObject *_wrap_tdb_get(PyObject *SWIGUNUSEDPARM(self), PyObject *arg (char *) "self",(char *) "key", NULL }; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:tdb_get",kwnames,&obj0,&obj1)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Tdb_get",kwnames,&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_get" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_get" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); if (obj1 == Py_None) { @@ -3075,7 +3075,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_delete(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_Tdb_delete(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; TDB_DATA arg2 ; @@ -3088,10 +3088,10 @@ SWIGINTERN PyObject *_wrap_tdb_delete(PyObject *SWIGUNUSEDPARM(self), PyObject * (char *) "self",(char *) "key", NULL }; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:tdb_delete",kwnames,&obj0,&obj1)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Tdb_delete",kwnames,&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_delete" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_delete" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); if (obj1 == Py_None) { @@ -3112,7 +3112,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_store(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_Tdb_store(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; TDB_DATA arg2 ; @@ -3132,10 +3132,10 @@ SWIGINTERN PyObject *_wrap_tdb_store(PyObject *SWIGUNUSEDPARM(self), PyObject *a }; arg4 = TDB_REPLACE; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|O:tdb_store",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|O:Tdb_store",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_store" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_store" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); if (obj1 == Py_None) { @@ -3161,7 +3161,7 @@ SWIGINTERN PyObject *_wrap_tdb_store(PyObject *SWIGUNUSEDPARM(self), PyObject *a if (obj3) { ecode4 = SWIG_AsVal_int(obj3, &val4); if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "tdb_store" "', argument " "4"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Tdb_store" "', argument " "4"" of type '" "int""'"); } arg4 = (int)(val4); } @@ -3173,7 +3173,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_exists(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_Tdb_exists(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; TDB_DATA arg2 ; @@ -3186,10 +3186,10 @@ SWIGINTERN PyObject *_wrap_tdb_exists(PyObject *SWIGUNUSEDPARM(self), PyObject * (char *) "self",(char *) "key", NULL }; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:tdb_exists",kwnames,&obj0,&obj1)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Tdb_exists",kwnames,&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_exists" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_exists" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); if (obj1 == Py_None) { @@ -3210,7 +3210,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_firstkey(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Tdb_firstkey(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; TDB_DATA result; @@ -3222,7 +3222,7 @@ SWIGINTERN PyObject *_wrap_tdb_firstkey(PyObject *SWIGUNUSEDPARM(self), PyObject swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_firstkey" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_firstkey" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); result = tdb_firstkey(arg1); @@ -3238,7 +3238,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_nextkey(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_Tdb_nextkey(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; TDB_DATA arg2 ; @@ -3251,10 +3251,10 @@ SWIGINTERN PyObject *_wrap_tdb_nextkey(PyObject *SWIGUNUSEDPARM(self), PyObject (char *) "self",(char *) "key", NULL }; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:tdb_nextkey",kwnames,&obj0,&obj1)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Tdb_nextkey",kwnames,&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_nextkey" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_nextkey" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); if (obj1 == Py_None) { @@ -3280,7 +3280,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_lock_all(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Tdb_lock_all(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; int result; @@ -3292,7 +3292,7 @@ SWIGINTERN PyObject *_wrap_tdb_lock_all(PyObject *SWIGUNUSEDPARM(self), PyObject swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_lock_all" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_lock_all" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); result = (int)tdb_lockall(arg1); @@ -3303,7 +3303,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_unlock_all(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Tdb_unlock_all(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; int result; @@ -3315,7 +3315,7 @@ SWIGINTERN PyObject *_wrap_tdb_unlock_all(PyObject *SWIGUNUSEDPARM(self), PyObje swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_unlock_all" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_unlock_all" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); result = (int)tdb_unlockall(arg1); @@ -3326,7 +3326,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_read_lock_all(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Tdb_read_lock_all(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; int result; @@ -3338,7 +3338,7 @@ SWIGINTERN PyObject *_wrap_tdb_read_lock_all(PyObject *SWIGUNUSEDPARM(self), PyO swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_read_lock_all" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_read_lock_all" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); result = (int)tdb_lockall_read(arg1); @@ -3349,7 +3349,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_read_unlock_all(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Tdb_read_unlock_all(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; int result; @@ -3361,7 +3361,7 @@ SWIGINTERN PyObject *_wrap_tdb_read_unlock_all(PyObject *SWIGUNUSEDPARM(self), P swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_read_unlock_all" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_read_unlock_all" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); result = (int)tdb_unlockall_read(arg1); @@ -3372,7 +3372,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_reopen(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Tdb_reopen(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; int result; @@ -3384,7 +3384,7 @@ SWIGINTERN PyObject *_wrap_tdb_reopen(PyObject *SWIGUNUSEDPARM(self), PyObject * swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_reopen" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_reopen" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); result = (int)tdb_reopen(arg1); @@ -3395,7 +3395,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_transaction_start(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Tdb_transaction_start(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; int result; @@ -3407,7 +3407,7 @@ SWIGINTERN PyObject *_wrap_tdb_transaction_start(PyObject *SWIGUNUSEDPARM(self), swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_transaction_start" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_transaction_start" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); result = (int)tdb_transaction_start(arg1); @@ -3418,7 +3418,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_transaction_commit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Tdb_transaction_commit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; int result; @@ -3430,7 +3430,7 @@ SWIGINTERN PyObject *_wrap_tdb_transaction_commit(PyObject *SWIGUNUSEDPARM(self) swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_transaction_commit" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_transaction_commit" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); result = (int)tdb_transaction_commit(arg1); @@ -3441,7 +3441,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_transaction_cancel(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Tdb_transaction_cancel(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; int result; @@ -3453,7 +3453,7 @@ SWIGINTERN PyObject *_wrap_tdb_transaction_cancel(PyObject *SWIGUNUSEDPARM(self) swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_transaction_cancel" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_transaction_cancel" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); result = (int)tdb_transaction_cancel(arg1); @@ -3464,7 +3464,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_transaction_recover(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Tdb_transaction_recover(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; int result; @@ -3476,7 +3476,7 @@ SWIGINTERN PyObject *_wrap_tdb_transaction_recover(PyObject *SWIGUNUSEDPARM(self swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_transaction_recover" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_transaction_recover" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); result = (int)tdb_transaction_recover(arg1); @@ -3487,7 +3487,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_hash_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Tdb_hash_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; int result; @@ -3499,7 +3499,7 @@ SWIGINTERN PyObject *_wrap_tdb_hash_size(PyObject *SWIGUNUSEDPARM(self), PyObjec swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_hash_size" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_hash_size" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); result = (int)tdb_hash_size(arg1); @@ -3510,7 +3510,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_map_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Tdb_map_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; size_t result; @@ -3522,7 +3522,7 @@ SWIGINTERN PyObject *_wrap_tdb_map_size(PyObject *SWIGUNUSEDPARM(self), PyObject swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_map_size" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_map_size" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); result = tdb_map_size(arg1); @@ -3533,7 +3533,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_get_flags(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Tdb_get_flags(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; int result; @@ -3545,7 +3545,7 @@ SWIGINTERN PyObject *_wrap_tdb_get_flags(PyObject *SWIGUNUSEDPARM(self), PyObjec swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_get_flags" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_get_flags" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); result = (int)tdb_get_flags(arg1); @@ -3556,7 +3556,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_set_max_dead(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_Tdb_set_max_dead(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; int arg2 ; @@ -3570,15 +3570,15 @@ SWIGINTERN PyObject *_wrap_tdb_set_max_dead(PyObject *SWIGUNUSEDPARM(self), PyOb (char *) "self",(char *) "max_dead", NULL }; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:tdb_set_max_dead",kwnames,&obj0,&obj1)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Tdb_set_max_dead",kwnames,&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_set_max_dead" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_set_max_dead" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); ecode2 = SWIG_AsVal_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "tdb_set_max_dead" "', argument " "2"" of type '" "int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Tdb_set_max_dead" "', argument " "2"" of type '" "int""'"); } arg2 = (int)(val2); tdb_set_max_dead(arg1,arg2); @@ -3589,7 +3589,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_name(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Tdb_name(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; char *result = 0 ; @@ -3601,7 +3601,7 @@ SWIGINTERN PyObject *_wrap_tdb_name(PyObject *SWIGUNUSEDPARM(self), PyObject *ar swig_obj[0] = args; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_name" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_name" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); result = (char *)tdb_name(arg1); @@ -3612,41 +3612,85 @@ fail: } -SWIGINTERN PyObject *tdb_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *Tdb_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_tdb_context, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } +SWIGINTERN PyObject *Tdb_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + return SWIG_Python_InitShadowInstance(args); +} + static PyMethodDef SwigMethods[] = { - { (char *)"new_Tdb", (PyCFunction) _wrap_new_Tdb, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"tdb_error", (PyCFunction)_wrap_tdb_error, METH_O, NULL}, - { (char *)"delete_tdb", (PyCFunction)_wrap_delete_tdb, METH_O, NULL}, - { (char *)"tdb_close", (PyCFunction)_wrap_tdb_close, METH_O, NULL}, - { (char *)"tdb_append", (PyCFunction) _wrap_tdb_append, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"tdb_errorstr", (PyCFunction)_wrap_tdb_errorstr, METH_O, NULL}, - { (char *)"tdb_get", (PyCFunction) _wrap_tdb_get, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"tdb_delete", (PyCFunction) _wrap_tdb_delete, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"tdb_store", (PyCFunction) _wrap_tdb_store, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"tdb_exists", (PyCFunction) _wrap_tdb_exists, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"tdb_firstkey", (PyCFunction)_wrap_tdb_firstkey, METH_O, NULL}, - { (char *)"tdb_nextkey", (PyCFunction) _wrap_tdb_nextkey, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"tdb_lock_all", (PyCFunction)_wrap_tdb_lock_all, METH_O, NULL}, - { (char *)"tdb_unlock_all", (PyCFunction)_wrap_tdb_unlock_all, METH_O, NULL}, - { (char *)"tdb_read_lock_all", (PyCFunction)_wrap_tdb_read_lock_all, METH_O, NULL}, - { (char *)"tdb_read_unlock_all", (PyCFunction)_wrap_tdb_read_unlock_all, METH_O, NULL}, - { (char *)"tdb_reopen", (PyCFunction)_wrap_tdb_reopen, METH_O, NULL}, - { (char *)"tdb_transaction_start", (PyCFunction)_wrap_tdb_transaction_start, METH_O, NULL}, - { (char *)"tdb_transaction_commit", (PyCFunction)_wrap_tdb_transaction_commit, METH_O, NULL}, - { (char *)"tdb_transaction_cancel", (PyCFunction)_wrap_tdb_transaction_cancel, METH_O, NULL}, - { (char *)"tdb_transaction_recover", (PyCFunction)_wrap_tdb_transaction_recover, METH_O, NULL}, - { (char *)"tdb_hash_size", (PyCFunction)_wrap_tdb_hash_size, METH_O, NULL}, - { (char *)"tdb_map_size", (PyCFunction)_wrap_tdb_map_size, METH_O, NULL}, - { (char *)"tdb_get_flags", (PyCFunction)_wrap_tdb_get_flags, METH_O, NULL}, - { (char *)"tdb_set_max_dead", (PyCFunction) _wrap_tdb_set_max_dead, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"tdb_name", (PyCFunction)_wrap_tdb_name, METH_O, NULL}, - { (char *)"tdb_swigregister", tdb_swigregister, METH_VARARGS, NULL}, + { (char *)"new_Tdb", (PyCFunction) _wrap_new_Tdb, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.__init__(name,hash_size=0,tdb_flags=TDB_DEFAULT,flags=O_RDWR,mode=0600)\n" + "Open a TDB file.\n" + ""}, + { (char *)"Tdb_error", (PyCFunction)_wrap_Tdb_error, METH_O, NULL}, + { (char *)"delete_Tdb", (PyCFunction)_wrap_delete_Tdb, METH_O, NULL}, + { (char *)"Tdb_close", (PyCFunction)_wrap_Tdb_close, METH_O, (char *)"\n" + "S.close() -> None\n" + "Close the TDB file.\n" + ""}, + { (char *)"Tdb_append", (PyCFunction) _wrap_Tdb_append, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"Tdb_errorstr", (PyCFunction)_wrap_Tdb_errorstr, METH_O, (char *)"\n" + "S.errorstr() -> errorstring\n" + "Obtain last error message.\n" + ""}, + { (char *)"Tdb_get", (PyCFunction) _wrap_Tdb_get, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.fetch(key) -> value\n" + "Fetch a value.\n" + ""}, + { (char *)"Tdb_delete", (PyCFunction) _wrap_Tdb_delete, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.delete(key) -> None\n" + "Delete an entry.\n" + ""}, + { (char *)"Tdb_store", (PyCFunction) _wrap_Tdb_store, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.store(key, value, flag=TDB_REPLACE) -> None\n" + "Store an entry.\n" + ""}, + { (char *)"Tdb_exists", (PyCFunction) _wrap_Tdb_exists, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"Tdb_firstkey", (PyCFunction)_wrap_Tdb_firstkey, METH_O, (char *)"\n" + "S.firstkey() -> data\n" + "Return the first key in this database.\n" + ""}, + { (char *)"Tdb_nextkey", (PyCFunction) _wrap_Tdb_nextkey, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.nextkey(prev) -> data\n" + "Return the next key in this database.\n" + ""}, + { (char *)"Tdb_lock_all", (PyCFunction)_wrap_Tdb_lock_all, METH_O, (char *)"S.lockall() -> bool"}, + { (char *)"Tdb_unlock_all", (PyCFunction)_wrap_Tdb_unlock_all, METH_O, (char *)"S.unlockall() -> bool"}, + { (char *)"Tdb_read_lock_all", (PyCFunction)_wrap_Tdb_read_lock_all, METH_O, NULL}, + { (char *)"Tdb_read_unlock_all", (PyCFunction)_wrap_Tdb_read_unlock_all, METH_O, NULL}, + { (char *)"Tdb_reopen", (PyCFunction)_wrap_Tdb_reopen, METH_O, (char *)"\n" + "S.reopen() -> bool\n" + "Reopen this file.\n" + ""}, + { (char *)"Tdb_transaction_start", (PyCFunction)_wrap_Tdb_transaction_start, METH_O, (char *)"\n" + "S.transaction_start() -> None\n" + "Start a new transaction.\n" + ""}, + { (char *)"Tdb_transaction_commit", (PyCFunction)_wrap_Tdb_transaction_commit, METH_O, (char *)"\n" + "S.transaction_commit() -> None\n" + "Commit the currently active transaction.\n" + ""}, + { (char *)"Tdb_transaction_cancel", (PyCFunction)_wrap_Tdb_transaction_cancel, METH_O, (char *)"\n" + "S.transaction_cancel() -> None\n" + "Cancel the currently active transaction.\n" + ""}, + { (char *)"Tdb_transaction_recover", (PyCFunction)_wrap_Tdb_transaction_recover, METH_O, NULL}, + { (char *)"Tdb_hash_size", (PyCFunction)_wrap_Tdb_hash_size, METH_O, (char *)"S.hash_size() -> int"}, + { (char *)"Tdb_map_size", (PyCFunction)_wrap_Tdb_map_size, METH_O, (char *)"S.map_size() -> int"}, + { (char *)"Tdb_get_flags", (PyCFunction)_wrap_Tdb_get_flags, METH_O, (char *)"S.get_flags() -> int"}, + { (char *)"Tdb_set_max_dead", (PyCFunction) _wrap_Tdb_set_max_dead, METH_VARARGS | METH_KEYWORDS, (char *)"S.set_max_dead(int) -> None"}, + { (char *)"Tdb_name", (PyCFunction)_wrap_Tdb_name, METH_O, (char *)"\n" + "S.name() -> path\n" + "Return filename of this TDB file.\n" + ""}, + { (char *)"Tdb_swigregister", Tdb_swigregister, METH_VARARGS, NULL}, + { (char *)"Tdb_swiginit", Tdb_swiginit, METH_VARARGS, NULL}, { NULL, NULL, 0, NULL } }; -- cgit From c401aa93573460f10256218a6a1902839b17b884 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 22 May 2008 17:42:18 +0200 Subject: Use restructuredText formatting for docstrings. (This used to be commit 0cc58decd74d20f3d7dff93ddef1c8bce4d49ad0) --- source4/lib/ldb/ldb.i | 4 ++++ source4/lib/ldb/ldb.py | 2 ++ 2 files changed, 6 insertions(+) (limited to 'source4/lib') diff --git a/source4/lib/ldb/ldb.i b/source4/lib/ldb/ldb.i index 2c5b7535b5..21bee63ea8 100644 --- a/source4/lib/ldb/ldb.i +++ b/source4/lib/ldb/ldb.i @@ -920,3 +920,7 @@ time_t ldb_string_to_time(const char *s); "Register a LDB module."; %rename(register_module) ldb_register_module; ldb_int_error ldb_register_module(const struct ldb_module_ops *); + +%pythoncode { +__docformat__ = "restructuredText" +} diff --git a/source4/lib/ldb/ldb.py b/source4/lib/ldb/ldb.py index e458398b0b..03869799c2 100644 --- a/source4/lib/ldb/ldb.py +++ b/source4/lib/ldb/ldb.py @@ -471,5 +471,7 @@ def register_module(*args, **kwargs): Register a LDB module. """ return _ldb.register_module(*args, **kwargs) +__docformat__ = "restructuredText" + -- cgit From 985d6d8dddd1e9ff1328575e068338ad43211643 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 22 May 2008 18:24:10 +0200 Subject: add more docstrings to registry python module (This used to be commit 606f92db874c139ba532df53a87cc5b826215d9e) --- source4/lib/registry/registry.i | 24 +++++++++++++++ source4/lib/registry/registry.py | 60 +++++++++++++++++++++++++++++++++--- source4/lib/registry/registry_wrap.c | 30 ++++++++++++------ 3 files changed, 100 insertions(+), 14 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/registry/registry.i b/source4/lib/registry/registry.i index 5ffee4bb3d..7dd02b344c 100644 --- a/source4/lib/registry/registry.i +++ b/source4/lib/registry/registry.i @@ -93,11 +93,20 @@ WERROR reg_open_local(TALLOC_CTX *parent_ctx, struct registry_context **ctx); typedef struct registry_context { %extend { + %feature("docstring") get_predefined_key_by_name "S.get_predefined_key_by_name(name) -> key\n" + "Find a predefined key by name"; WERROR get_predefined_key_by_name(const char *name, struct registry_key **key); + %feature("docstring") key_del_abs "S.key_del_abs(name) -> None\n" + "Delete a key by absolute path."; WERROR key_del_abs(const char *path); + %feature("docstring") get_predefined_key "S.get_predefined_key(hkey_id) -> key\n" + "Find a predefined key by id"; WERROR get_predefined_key(uint32_t hkey_id, struct registry_key **key); + %feature("docstring") diff_apply "S.diff_apply(filename) -> None\n" + "Apply the diff from the specified file"; + WERROR diff_apply(const char *filename); WERROR generate_diff(struct registry_context *ctx2, const struct reg_diff_callbacks *callbacks, void *callback_data); @@ -106,6 +115,8 @@ typedef struct registry_context { const char **elements=NULL); struct registry_key *import_hive_key(struct hive_key *hive, uint32_t predef_key, const char **elements); + %feature("docstring") mount_hive "S.mount_hive(key, predef_name) -> None\n" + "Mount the specified key at the specified path."; WERROR mount_hive(struct hive_key *key, const char *predef_name) { int i; @@ -130,6 +141,7 @@ typedef struct registry_context { $result = SWIG_NewPointerObj(*$1, SWIGTYPE_p_hive_key, 0); } +%feature("docstring") reg_open_hive "S.__init__(location, session_info=None, credentials=None, loadparm_context=None)"; %rename(hive_key) reg_open_hive; WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location, struct auth_session_info *session_info, @@ -138,6 +150,7 @@ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location, struct loadparm_context *lp_ctx, struct hive_key **root); +%feature("docstring") reg_open_ldb_file "open_ldb(location, session_info=None, credentials=None, loadparm_context=None) -> key"; %rename(open_ldb) reg_open_ldb_file; WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location, struct auth_session_info *session_info, @@ -146,10 +159,12 @@ WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location, struct loadparm_context *lp_ctx, struct hive_key **k); +%feature("docstring") reg_create_directory "create_dir(location) -> key"; %rename(create_dir) reg_create_directory; WERROR reg_create_directory(TALLOC_CTX *parent_ctx, const char *location, struct hive_key **key); +%feature("docstring") reg_open_directory "open_dir(location) -> key"; %rename(open_dir) reg_open_directory; WERROR reg_open_directory(TALLOC_CTX *parent_ctx, const char *location, struct hive_key **key); @@ -158,15 +173,24 @@ WERROR reg_open_directory(TALLOC_CTX *parent_ctx, typedef struct hive_key { %extend { + %feature("docstring") del "S.del(name) -> None\n" + "Delete a subkey"; WERROR del(const char *name); + %feature("docstring") flush "S.flush() -> None\n" + "Flush this key to disk"; WERROR flush(void); + %feature("docstring") del_value "S.del_value(name) -> None\n" + "Delete a value"; WERROR del_value(const char *name); + %feature("docstring") set_value "S.set_value(name, type, data) -> None\n" + "Set a value"; WERROR set_value(const char *name, uint32_t type, const DATA_BLOB data); } } hive_key; %rename(open_samba) reg_open_samba; +%feature("docstring") reg_open_samba "open_samba() -> reg"; WERROR reg_open_samba(TALLOC_CTX *mem_ctx, struct registry_context **ctx, struct event_context *ev_ctx, diff --git a/source4/lib/registry/registry.py b/source4/lib/registry/registry.py index cb20d6039d..4c6e735414 100644 --- a/source4/lib/registry/registry.py +++ b/source4/lib/registry/registry.py @@ -66,6 +66,41 @@ Registry = _registry.Registry class reg(object): thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr + def get_predefined_key_by_name(*args, **kwargs): + """ + S.get_predefined_key_by_name(name) -> key + Find a predefined key by name + """ + return _registry.reg_get_predefined_key_by_name(*args, **kwargs) + + def key_del_abs(*args, **kwargs): + """ + S.key_del_abs(name) -> None + Delete a key by absolute path. + """ + return _registry.reg_key_del_abs(*args, **kwargs) + + def get_predefined_key(*args, **kwargs): + """ + S.get_predefined_key(hkey_id) -> key + Find a predefined key by id + """ + return _registry.reg_get_predefined_key(*args, **kwargs) + + def diff_apply(*args, **kwargs): + """ + S.diff_apply(filename) -> None + Apply the diff from the specified file + """ + return _registry.reg_diff_apply(*args, **kwargs) + + def mount_hive(*args): + """ + S.mount_hive(key, predef_name) -> None + Mount the specified key at the specified path. + """ + return _registry.reg_mount_hive(*args) + def __init__(self, *args, **kwargs): _registry.reg_swiginit(self,_registry.new_reg(*args, **kwargs)) __swig_destroy__ = _registry.delete_reg @@ -79,11 +114,26 @@ reg.mount_hive = new_instancemethod(_registry.reg_mount_hive,None,reg) reg_swigregister = _registry.reg_swigregister reg_swigregister(reg) -hive_key = _registry.hive_key -open_ldb = _registry.open_ldb -create_dir = _registry.create_dir -open_dir = _registry.open_dir -open_samba = _registry.open_samba + +def hive_key(*args, **kwargs): + """S.__init__(location, session_info=None, credentials=None, loadparm_context=None)""" + return _registry.hive_key(*args, **kwargs) + +def open_ldb(*args, **kwargs): + """open_ldb(location, session_info=None, credentials=None, loadparm_context=None) -> key""" + return _registry.open_ldb(*args, **kwargs) + +def create_dir(*args, **kwargs): + """create_dir(location) -> key""" + return _registry.create_dir(*args, **kwargs) + +def open_dir(*args, **kwargs): + """open_dir(location) -> key""" + return _registry.open_dir(*args, **kwargs) + +def open_samba(*args, **kwargs): + """open_samba() -> reg""" + return _registry.open_samba(*args, **kwargs) HKEY_CLASSES_ROOT = _registry.HKEY_CLASSES_ROOT HKEY_CURRENT_USER = _registry.HKEY_CURRENT_USER HKEY_LOCAL_MACHINE = _registry.HKEY_LOCAL_MACHINE diff --git a/source4/lib/registry/registry_wrap.c b/source4/lib/registry/registry_wrap.c index d9b85ee937..b066e42b41 100644 --- a/source4/lib/registry/registry_wrap.c +++ b/source4/lib/registry/registry_wrap.c @@ -3798,10 +3798,22 @@ static PyMethodDef SwigMethods[] = { { (char *)"reg_get_predef_name", (PyCFunction) _wrap_reg_get_predef_name, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"str_regtype", (PyCFunction) _wrap_str_regtype, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Registry", (PyCFunction)_wrap_Registry, METH_NOARGS, NULL}, - { (char *)"reg_get_predefined_key_by_name", (PyCFunction) _wrap_reg_get_predefined_key_by_name, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"reg_key_del_abs", (PyCFunction) _wrap_reg_key_del_abs, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"reg_get_predefined_key", (PyCFunction) _wrap_reg_get_predefined_key, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"reg_diff_apply", (PyCFunction) _wrap_reg_diff_apply, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"reg_get_predefined_key_by_name", (PyCFunction) _wrap_reg_get_predefined_key_by_name, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.get_predefined_key_by_name(name) -> key\n" + "Find a predefined key by name\n" + ""}, + { (char *)"reg_key_del_abs", (PyCFunction) _wrap_reg_key_del_abs, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.key_del_abs(name) -> None\n" + "Delete a key by absolute path.\n" + ""}, + { (char *)"reg_get_predefined_key", (PyCFunction) _wrap_reg_get_predefined_key, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.get_predefined_key(hkey_id) -> key\n" + "Find a predefined key by id\n" + ""}, + { (char *)"reg_diff_apply", (PyCFunction) _wrap_reg_diff_apply, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.diff_apply(filename) -> None\n" + "Apply the diff from the specified file\n" + ""}, { (char *)"reg_generate_diff", (PyCFunction) _wrap_reg_generate_diff, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"reg_import_hive_key", (PyCFunction) _wrap_reg_import_hive_key, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"reg_mount_hive", _wrap_reg_mount_hive, METH_VARARGS, NULL}, @@ -3809,11 +3821,11 @@ static PyMethodDef SwigMethods[] = { { (char *)"delete_reg", (PyCFunction)_wrap_delete_reg, METH_O, NULL}, { (char *)"reg_swigregister", reg_swigregister, METH_VARARGS, NULL}, { (char *)"reg_swiginit", reg_swiginit, METH_VARARGS, NULL}, - { (char *)"hive_key", (PyCFunction) _wrap_hive_key, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"open_ldb", (PyCFunction) _wrap_open_ldb, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"create_dir", (PyCFunction) _wrap_create_dir, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"open_dir", (PyCFunction) _wrap_open_dir, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"open_samba", (PyCFunction) _wrap_open_samba, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"hive_key", (PyCFunction) _wrap_hive_key, METH_VARARGS | METH_KEYWORDS, (char *)"S.__init__(location, session_info=None, credentials=None, loadparm_context=None)"}, + { (char *)"open_ldb", (PyCFunction) _wrap_open_ldb, METH_VARARGS | METH_KEYWORDS, (char *)"open_ldb(location, session_info=None, credentials=None, loadparm_context=None) -> key"}, + { (char *)"create_dir", (PyCFunction) _wrap_create_dir, METH_VARARGS | METH_KEYWORDS, (char *)"create_dir(location) -> key"}, + { (char *)"open_dir", (PyCFunction) _wrap_open_dir, METH_VARARGS | METH_KEYWORDS, (char *)"open_dir(location) -> key"}, + { (char *)"open_samba", (PyCFunction) _wrap_open_samba, METH_VARARGS | METH_KEYWORDS, (char *)"open_samba() -> reg"}, { NULL, NULL, 0, NULL } }; -- cgit From 37d000d052795063f63a321835d60de55389c1bd Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 22 May 2008 18:47:18 +0200 Subject: Add docstrings to events python module. (This used to be commit 7d43d2c7c91c86246b9bb2ae7eda050079767e7a) --- source4/lib/events/events.i | 5 +++++ source4/lib/events/events.py | 19 +++++++++++++++++-- source4/lib/events/events_wrap.c | 10 +++++----- 3 files changed, 27 insertions(+), 7 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/events/events.i b/source4/lib/events/events.i index c16d482efc..7de8aec79d 100644 --- a/source4/lib/events/events.i +++ b/source4/lib/events/events.i @@ -27,8 +27,11 @@ typedef struct event_context event; typedef struct event_context { %extend { + %feature("docstring") event "S.__init__()"; event(TALLOC_CTX *mem_ctx) { return event_context_init(mem_ctx); } + %feature("docstring") loop_once "S.loop_once() -> int"; int loop_once(void); + %feature("docstring") loop_wait "S.loop_wait() -> int"; int loop_wait(void); } } event; @@ -44,6 +47,8 @@ typedef struct event_context { struct event_context *event_context_init_byname(TALLOC_CTX *mem_ctx, const char *name); +%feature("docstring") event_backend_list "event_backend_list() -> list"; const char **event_backend_list(TALLOC_CTX *mem_ctx); +%feature("docstring") event_set_default_backend "event_set_default_backend(name) -> None"; %rename(set_default_backend) event_set_default_backend; void event_set_default_backend(const char *backend); diff --git a/source4/lib/events/events.py b/source4/lib/events/events.py index 237726897d..264e0b7cdf 100644 --- a/source4/lib/events/events.py +++ b/source4/lib/events/events.py @@ -61,7 +61,16 @@ class event(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): + """S.__init__()""" _events.event_swiginit(self,_events.new_event(*args, **kwargs)) + def loop_once(*args, **kwargs): + """S.loop_once() -> int""" + return _events.event_loop_once(*args, **kwargs) + + def loop_wait(*args, **kwargs): + """S.loop_wait() -> int""" + return _events.event_loop_wait(*args, **kwargs) + __swig_destroy__ = _events.delete_event event.loop_once = new_instancemethod(_events.event_loop_once,None,event) event.loop_wait = new_instancemethod(_events.event_loop_wait,None,event) @@ -69,7 +78,13 @@ event_swigregister = _events.event_swigregister event_swigregister(event) event_context_init_byname = _events.event_context_init_byname -event_backend_list = _events.event_backend_list -set_default_backend = _events.set_default_backend + +def event_backend_list(*args): + """event_backend_list() -> list""" + return _events.event_backend_list(*args) + +def set_default_backend(*args, **kwargs): + """event_set_default_backend(name) -> None""" + return _events.set_default_backend(*args, **kwargs) diff --git a/source4/lib/events/events_wrap.c b/source4/lib/events/events_wrap.c index 727485dfdb..ccaeab7ad6 100644 --- a/source4/lib/events/events_wrap.c +++ b/source4/lib/events/events_wrap.c @@ -2773,15 +2773,15 @@ fail: static PyMethodDef SwigMethods[] = { - { (char *)"new_event", (PyCFunction)_wrap_new_event, METH_NOARGS, NULL}, - { (char *)"event_loop_once", (PyCFunction)_wrap_event_loop_once, METH_O, NULL}, - { (char *)"event_loop_wait", (PyCFunction)_wrap_event_loop_wait, METH_O, NULL}, + { (char *)"new_event", (PyCFunction)_wrap_new_event, METH_NOARGS, (char *)"S.__init__()"}, + { (char *)"event_loop_once", (PyCFunction)_wrap_event_loop_once, METH_O, (char *)"S.loop_once() -> int"}, + { (char *)"event_loop_wait", (PyCFunction)_wrap_event_loop_wait, METH_O, (char *)"S.loop_wait() -> int"}, { (char *)"delete_event", (PyCFunction)_wrap_delete_event, METH_O, NULL}, { (char *)"event_swigregister", event_swigregister, METH_VARARGS, NULL}, { (char *)"event_swiginit", event_swiginit, METH_VARARGS, NULL}, { (char *)"event_context_init_byname", (PyCFunction) _wrap_event_context_init_byname, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"event_backend_list", (PyCFunction)_wrap_event_backend_list, METH_NOARGS, NULL}, - { (char *)"set_default_backend", (PyCFunction) _wrap_set_default_backend, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"event_backend_list", (PyCFunction)_wrap_event_backend_list, METH_NOARGS, (char *)"event_backend_list() -> list"}, + { (char *)"set_default_backend", (PyCFunction) _wrap_set_default_backend, METH_VARARGS | METH_KEYWORDS, (char *)"event_set_default_backend(name) -> None"}, { NULL, NULL, 0, NULL } }; -- cgit From 564b6ed025bdfbd93876e084e9f3dd1a6774fa5c Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 23 May 2008 04:07:42 +0200 Subject: Add proper implementation of MessageElement.__cmp__. (This used to be commit 076e2cc356978ac313fcfdf8d8243f4ed1d629b0) --- source4/lib/ldb/ldb.i | 8 +++++--- source4/lib/ldb/ldb.py | 2 +- source4/lib/ldb/ldb_wrap.c | 17 ++++++++++------- 3 files changed, 16 insertions(+), 11 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/ldb.i b/source4/lib/ldb/ldb.i index 21bee63ea8..061d13a2dd 100644 --- a/source4/lib/ldb/ldb.i +++ b/source4/lib/ldb/ldb.i @@ -362,14 +362,17 @@ PyObject *ldb_msg_element_to_set(struct ldb_context *ldb_ctx, %} #endif -int ldb_msg_element_compare(ldb_message_element *, ldb_message_element *); /* ldb_message_element */ %rename(MessageElement) ldb_message_element; %feature("docstring") ldb_message_element "Message element."; -%rename(ldb_message_element_compare) ldb_msg_element_compare; typedef struct ldb_message_element { %extend { #ifdef SWIGPYTHON + int __cmp__(ldb_message_element *other) + { + return ldb_msg_element_compare($self, other); + } + PyObject *__iter__(void) { return PyObject_GetIter(ldb_msg_element_to_set(NULL, $self)); @@ -400,7 +403,6 @@ typedef struct ldb_message_element { } ~ldb_message_element() { talloc_free($self); } - %rename(__cmp__) ldb_msg_element_compare; } %pythoncode { def __getitem__(self, i): diff --git a/source4/lib/ldb/ldb.py b/source4/lib/ldb/ldb.py index 03869799c2..ae2c187367 100644 --- a/source4/lib/ldb/ldb.py +++ b/source4/lib/ldb/ldb.py @@ -162,7 +162,6 @@ Dn.__add__ = new_instancemethod(_ldb.Dn___add__,None,Dn) Dn_swigregister = _ldb.Dn_swigregister Dn_swigregister(Dn) -ldb_msg_element_compare = _ldb.ldb_msg_element_compare class MessageElement(object): """Message element.""" thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') @@ -191,6 +190,7 @@ class MessageElement(object): return False return True +MessageElement.__cmp__ = new_instancemethod(_ldb.MessageElement___cmp__,None,MessageElement) MessageElement.__iter__ = new_instancemethod(_ldb.MessageElement___iter__,None,MessageElement) MessageElement.__set__ = new_instancemethod(_ldb.MessageElement___set__,None,MessageElement) MessageElement.__len__ = new_instancemethod(_ldb.MessageElement___len__,None,MessageElement) diff --git a/source4/lib/ldb/ldb_wrap.c b/source4/lib/ldb/ldb_wrap.c index 01d683245e..744033cbf6 100644 --- a/source4/lib/ldb/ldb_wrap.c +++ b/source4/lib/ldb/ldb_wrap.c @@ -2809,6 +2809,9 @@ PyObject *ldb_msg_element_to_set(struct ldb_context *ldb_ctx, } +SWIGINTERN int ldb_message_element___cmp__(ldb_message_element *self,ldb_message_element *other){ + return ldb_msg_element_compare(self, other); + } SWIGINTERN PyObject *ldb_message_element___iter__(ldb_message_element *self){ return PyObject_GetIter(ldb_msg_element_to_set(NULL, self)); } @@ -3763,7 +3766,7 @@ SWIGINTERN PyObject *Dn_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) return SWIG_Python_InitShadowInstance(args); } -SWIGINTERN PyObject *_wrap_ldb_msg_element_compare(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_MessageElement___cmp__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; ldb_message_element *arg1 = (ldb_message_element *) 0 ; ldb_message_element *arg2 = (ldb_message_element *) 0 ; @@ -3775,21 +3778,21 @@ SWIGINTERN PyObject *_wrap_ldb_msg_element_compare(PyObject *SWIGUNUSEDPARM(self PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; char * kwnames[] = { - (char *)"arg1",(char *)"arg2", NULL + (char *) "self",(char *) "other", NULL }; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ldb_msg_element_compare",kwnames,&obj0,&obj1)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:MessageElement___cmp__",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_compare" "', argument " "1"" of type '" "ldb_message_element *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MessageElement___cmp__" "', argument " "1"" of type '" "ldb_message_element *""'"); } arg1 = (ldb_message_element *)(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_ldb_message_element, 0 | 0 ); if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ldb_msg_element_compare" "', argument " "2"" of type '" "ldb_message_element *""'"); + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "MessageElement___cmp__" "', argument " "2"" of type '" "ldb_message_element *""'"); } arg2 = (ldb_message_element *)(argp2); - result = (int)ldb_msg_element_compare(arg1,arg2); + result = (int)ldb_message_element___cmp__(arg1,arg2); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: @@ -5774,7 +5777,7 @@ static PyMethodDef SwigMethods[] = { { (char *)"Dn___add__", (PyCFunction) _wrap_Dn___add__, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Dn_swigregister", Dn_swigregister, METH_VARARGS, NULL}, { (char *)"Dn_swiginit", Dn_swiginit, METH_VARARGS, NULL}, - { (char *)"ldb_msg_element_compare", (PyCFunction) _wrap_ldb_msg_element_compare, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"MessageElement___cmp__", (PyCFunction) _wrap_MessageElement___cmp__, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"MessageElement___iter__", (PyCFunction)_wrap_MessageElement___iter__, METH_O, NULL}, { (char *)"MessageElement___set__", (PyCFunction)_wrap_MessageElement___set__, METH_O, NULL}, { (char *)"new_MessageElement", (PyCFunction) _wrap_new_MessageElement, METH_VARARGS | METH_KEYWORDS, (char *)"Message element."}, -- cgit From a255c9399518419b1028abac09fb9e0c1d572403 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 23 May 2008 16:17:58 +0200 Subject: Cope with new event context parameter in API and removed parameters to reg_open_local(). (This used to be commit 0d5752c940360a0ceb5e23cd6f71cbc61271137a) --- source4/lib/registry/tests/diff.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/registry/tests/diff.c b/source4/lib/registry/tests/diff.c index c7726545f6..44ea090527 100644 --- a/source4/lib/registry/tests/diff.c +++ b/source4/lib/registry/tests/diff.c @@ -165,10 +165,10 @@ static bool diff_setup_tcase(struct torture_context *tctx, void **data) td = talloc(tctx, struct diff_tcase_data); /* Create two registry contexts */ - error = reg_open_local(tctx, &r1_ctx, NULL, NULL); + error = reg_open_local(tctx, &r1_ctx); torture_assert_werr_ok(tctx, error, "Opening registry 1 for patch tests failed"); - error = reg_open_local(tctx, &r2_ctx, NULL, NULL); + error = reg_open_local(tctx, &r2_ctx); torture_assert_werr_ok(tctx, error, "Opening registry 2 for patch tests failed"); /* Create temp directory */ @@ -177,14 +177,14 @@ static bool diff_setup_tcase(struct torture_context *tctx, void **data) /* Create and mount HKLM and HKCU hives for registry 1 */ filename = talloc_asprintf(tctx, "%s/r1_local_machine.ldb", td->tempdir); - error = reg_open_ldb_file(tctx, filename, NULL, NULL, tctx->lp_ctx, &r1_hklm); + error = reg_open_ldb_file(tctx, filename, NULL, NULL, tctx->ev, tctx->lp_ctx, &r1_hklm); torture_assert_werr_ok(tctx, error, "Opening local machine file failed"); error = reg_mount_hive(r1_ctx, r1_hklm, HKEY_LOCAL_MACHINE, NULL); torture_assert_werr_ok(tctx, error, "Mounting hive failed"); filename = talloc_asprintf(tctx, "%s/r1_current_user.ldb", td->tempdir); - error = reg_open_ldb_file(tctx, filename, NULL, NULL, tctx->lp_ctx, &r1_hkcu); + error = reg_open_ldb_file(tctx, filename, NULL, NULL, tctx->ev, tctx->lp_ctx, &r1_hkcu); torture_assert_werr_ok(tctx, error, "Opening current user file failed"); error = reg_mount_hive(r1_ctx, r1_hkcu, HKEY_CURRENT_USER, NULL); @@ -192,14 +192,14 @@ static bool diff_setup_tcase(struct torture_context *tctx, void **data) /* Create and mount HKLM and HKCU hives for registry 2 */ filename = talloc_asprintf(tctx, "%s/r2_local_machine.ldb", td->tempdir); - error = reg_open_ldb_file(tctx, filename, NULL, NULL, tctx->lp_ctx, &r2_hklm); + error = reg_open_ldb_file(tctx, filename, NULL, NULL, tctx->ev, tctx->lp_ctx, &r2_hklm); torture_assert_werr_ok(tctx, error, "Opening local machine file failed"); error = reg_mount_hive(r2_ctx, r2_hklm, HKEY_LOCAL_MACHINE, NULL); torture_assert_werr_ok(tctx, error, "Mounting hive failed"); filename = talloc_asprintf(tctx, "%s/r2_current_user.ldb", td->tempdir); - error = reg_open_ldb_file(tctx, filename, NULL, NULL, tctx->lp_ctx, &r2_hkcu); + error = reg_open_ldb_file(tctx, filename, NULL, NULL, tctx->ev, tctx->lp_ctx, &r2_hkcu); torture_assert_werr_ok(tctx, error, "Opening current user file failed"); error = reg_mount_hive(r2_ctx, r2_hkcu, HKEY_CURRENT_USER, NULL); -- cgit