From c764791100079ed447c07ca6b99d33f9695255c3 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 4 Apr 2008 12:25:19 +1100 Subject: Clean up provision and rootdse module to hard-code less stuff. In particular, allow for the server DN to be in a different site (possible outcome of a DRS replication). Andrew Bartlett (This used to be commit 9ee4e39fe178317f42fd9a0adceea24b55dfe0f1) --- source4/dsdb/samdb/ldb_modules/rootdse.c | 8 ++++++ source4/scripting/python/samba/provision.py | 42 ++++++++++++++--------------- source4/setup/provision_rootdse_add.ldif | 5 ++-- 3 files changed, 31 insertions(+), 24 deletions(-) diff --git a/source4/dsdb/samdb/ldb_modules/rootdse.c b/source4/dsdb/samdb/ldb_modules/rootdse.c index 3235b24ef9..50f333d095 100644 --- a/source4/dsdb/samdb/ldb_modules/rootdse.c +++ b/source4/dsdb/samdb/ldb_modules/rootdse.c @@ -26,6 +26,7 @@ #include "lib/ldb/include/ldb_private.h" #include "system/time.h" #include "dsdb/samdb/samdb.h" +#include "version.h" struct private_data { int num_controls; @@ -202,6 +203,13 @@ static int rootdse_add_dynamic(struct ldb_module *module, struct ldb_message *ms } } + if (schema && do_attribute_explicit(attrs, "vendorVersion")) { + if (ldb_msg_add_fmt(msg, "vendorVersion", + "%s", SAMBA_VERSION_STRING) != 0) { + goto failed; + } + } + /* TODO: lots more dynamic attributes should be added here */ return LDB_SUCCESS; diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py index 6917aa1a54..02460070b4 100644 --- a/source4/scripting/python/samba/provision.py +++ b/source4/scripting/python/samba/provision.py @@ -265,7 +265,8 @@ def provision_paths_from_lp(lp, dnsdomain): return paths def guess_names(lp=None, hostname=None, domain=None, dnsdomain=None, serverrole=None, - rootdn=None, domaindn=None, configdn=None, schemadn=None, sitename=None): + rootdn=None, domaindn=None, configdn=None, schemadn=None, serverdn=None, + sitename=None): if hostname is None: hostname = socket.gethostname().split(".")[0].lower() @@ -332,6 +333,7 @@ def guess_names(lp=None, hostname=None, domain=None, dnsdomain=None, serverrole= names.netbiosname = netbiosname names.hostname = hostname names.sitename = sitename + names.serverdn = "CN=%s,CN=Servers,CN=%s,CN=Sites,%s" % (netbiosname, sitename, configdn) return names @@ -543,9 +545,7 @@ def setup_samdb_partitions(samdb_path, setup_path, message, lp, session_info, samdb.load_ldif_file_add(setup_path("provision_init.ldif")) message("Setting up sam.ldb rootDSE") - setup_samdb_rootdse(samdb, setup_path, names.schemadn, names.domaindn, names.hostname, - names.dnsdomain, names.realm, names.rootdn, names.configdn, names.netbiosname, - names.sitename) + setup_samdb_rootdse(samdb, setup_path, names) if erase: message("Erasing data from partitions") @@ -656,25 +656,22 @@ def setup_idmapdb(path, setup_path, session_info, credentials, lp): idmap_ldb.load_ldif_file_add(setup_path("idmap_init.ldif")) return idmap_ldb -def setup_samdb_rootdse(samdb, setup_path, schemadn, domaindn, hostname, - dnsdomain, realm, rootdn, configdn, netbiosname, - sitename): +def setup_samdb_rootdse(samdb, setup_path, names): """Setup the SamDB rootdse. :param samdb: Sam Database handle :param setup_path: Obtain setup path """ setup_add_ldif(samdb, setup_path("provision_rootdse_add.ldif"), { - "SCHEMADN": schemadn, - "NETBIOSNAME": netbiosname, - "DNSDOMAIN": dnsdomain, - "DEFAULTSITE": sitename, - "REALM": realm, - "DNSNAME": "%s.%s" % (hostname, dnsdomain), - "DOMAINDN": domaindn, - "ROOTDN": rootdn, - "CONFIGDN": configdn, - "VERSION": samba.version(), + "SCHEMADN": names.schemadn, + "NETBIOSNAME": names.netbiosname, + "DNSDOMAIN": names.dnsdomain, + "REALM": names.realm, + "DNSNAME": "%s.%s" % (names.hostname, names.dnsdomain), + "DOMAINDN": names.domaindn, + "ROOTDN": names.rootdn, + "CONFIGDN": names.configdn, + "SERVERDN": names.serverdn, }) @@ -879,7 +876,8 @@ FILL_DRS = "DRS" def provision(setup_dir, message, session_info, credentials, smbconf=None, targetdir=None, samdb_fill=FILL_FULL, realm=None, - rootdn=None, domaindn=None, schemadn=None, configdn=None, + rootdn=None, domaindn=None, schemadn=None, configdn=None, + serverdn=None, domain=None, hostname=None, hostip=None, hostip6=None, domainsid=None, adminpass=None, krbtgtpass=None, domainguid=None, policyguid=None, invocationid=None, machinepass=None, @@ -932,7 +930,8 @@ def provision(setup_dir, message, session_info, names = guess_names(lp=lp, hostname=hostname, domain=domain, dnsdomain=realm, serverrole=serverrole, sitename=sitename, - rootdn=rootdn, domaindn=domaindn, configdn=configdn, schemadn=schemadn) + rootdn=rootdn, domaindn=domaindn, configdn=configdn, schemadn=schemadn, + serverdn=serverdn) paths = provision_paths_from_lp(lp, names.dnsdomain) @@ -1064,12 +1063,13 @@ def provision(setup_dir, message, session_info, def provision_become_dc(setup_dir=None, smbconf=None, targetdir=None, realm=None, rootdn=None, domaindn=None, schemadn=None, configdn=None, + serverdn=None, domain=None, hostname=None, domainsid=None, adminpass=None, krbtgtpass=None, domainguid=None, policyguid=None, invocationid=None, machinepass=None, dnspass=None, root=None, nobody=None, nogroup=None, users=None, wheel=None, backup=None, aci=None, serverrole=None, - ldap_backend=None, ldap_backend_type=None, sitename=DEFAULTSITE): + ldap_backend=None, ldap_backend_type=None, sitename=None): def message(text): """print a message if quiet is not set.""" @@ -1077,7 +1077,7 @@ def provision_become_dc(setup_dir=None, provision(setup_dir, message, system_session(), None, smbconf=smbconf, targetdir=targetdir, samdb_fill=FILL_DRS, realm=realm, - rootdn=rootdn, domaindn=domaindn, schemadn=schemadn, configdn=configdn, + rootdn=rootdn, domaindn=domaindn, schemadn=schemadn, configdn=configdn, serverdn=serverdn, domain=domain, hostname=hostname, hostip="127.0.0.1", domainsid=domainsid, machinepass=machinepass, serverrole="domain controller", sitename=sitename); diff --git a/source4/setup/provision_rootdse_add.ldif b/source4/setup/provision_rootdse_add.ldif index 9f19796ec6..14e0d71df6 100644 --- a/source4/setup/provision_rootdse_add.ldif +++ b/source4/setup/provision_rootdse_add.ldif @@ -1,7 +1,7 @@ # the rootDSE module looks in this record for its base data dn: @ROOTDSE subschemaSubentry: CN=Aggregate,${SCHEMADN} -dsServiceName: CN=NTDS Settings,CN=${NETBIOSNAME},CN=Servers,CN=${DEFAULTSITE},CN=Sites,${CONFIGDN} +dsServiceName: CN=NTDS Settings,${SERVERDN} defaultNamingContext: ${DOMAINDN} rootDomainNamingContext: ${ROOTDN} configurationNamingContext: ${CONFIGDN} @@ -9,10 +9,9 @@ schemaNamingContext: ${SCHEMADN} supportedLDAPVersion: 3 dnsHostName: ${DNSNAME} ldapServiceName: ${DNSDOMAIN}:${NETBIOSNAME}$@${REALM} -serverName: CN=${NETBIOSNAME},CN=Servers,CN=${DEFAULTSITE},CN=Sites,${CONFIGDN} +serverName: ${SERVERDN} domainFunctionality: 0 forestFunctionality: 0 domainControllerFunctionality: 2 isSynchronized: FALSE vendorName: Samba Team (http://samba.org) -vendorVersion: ${VERSION} -- cgit From 9f96f39ca095a5f450f673e607a72efed504fdad Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 4 Apr 2008 12:55:45 +1100 Subject: Pass discovered server DN down to provision. This uses the new 'serverdn' argument added to provision in the previous commit. Andrew Bartlett (This used to be commit 74480c7de76069701246eb5b7acc5858b84d106c) --- source4/torture/libnet/libnet_BecomeDC.c | 1 + source4/torture/rpc/testjoin.c | 8 ++++++++ source4/torture/util.h | 1 + source4/torture/util_provision.c | 4 ++++ 4 files changed, 14 insertions(+) diff --git a/source4/torture/libnet/libnet_BecomeDC.c b/source4/torture/libnet/libnet_BecomeDC.c index 3f8edd40e8..f8699fe06a 100644 --- a/source4/torture/libnet/libnet_BecomeDC.c +++ b/source4/torture/libnet/libnet_BecomeDC.c @@ -84,6 +84,7 @@ static NTSTATUS test_become_dc_prepare_db(void *private_data, settings.netbios_name = p->dest_dsa->netbios_name; settings.realm = torture_join_dom_dns_name(s->tj); settings.domain = torture_join_dom_netbios_name(s->tj); + settings.server_dn_str = torture_join_server_dn_str(s->tj); settings.machine_password = cli_credentials_get_password(s->machine_account); settings.targetdir = s->targetdir; diff --git a/source4/torture/rpc/testjoin.c b/source4/torture/rpc/testjoin.c index 02f04946d6..892886c08c 100644 --- a/source4/torture/rpc/testjoin.c +++ b/source4/torture/rpc/testjoin.c @@ -553,6 +553,14 @@ const char *torture_join_dom_dns_name(struct test_join *join) return join->dom_dns_name; } +const char *torture_join_server_dn_str(struct test_join *join) +{ + if (join->libnet_r) { + return join->libnet_r->out.server_dn_str; + } + return NULL; +} + #if 0 /* Left as the documentation of the join process, but see new implementation in libnet_become_dc.c */ struct test_join_ads_dc { diff --git a/source4/torture/util.h b/source4/torture/util.h index 477a828120..72f97e4766 100644 --- a/source4/torture/util.h +++ b/source4/torture/util.h @@ -27,6 +27,7 @@ struct provision_settings { const char *domain_dn_str; const char *config_dn_str; const char *schema_dn_str; + const char *server_dn_str; const struct GUID *invocation_id; const char *netbios_name; const char *host_ip; diff --git a/source4/torture/util_provision.c b/source4/torture/util_provision.c index cce8e18fdc..3167a37cdf 100644 --- a/source4/torture/util_provision.c +++ b/source4/torture/util_provision.c @@ -105,6 +105,10 @@ NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, PyDict_SetItemString(parameters, "configdn", PyString_FromString(settings->config_dn_str)); + if (settings->server_dn_str) + PyDict_SetItemString(parameters, "serverdn", + PyString_FromString(settings->server_dn_str)); + if (settings->site_name) PyDict_SetItemString(parameters, "sitename", PyString_FromString(settings->site_name)); -- cgit From 184c53d180fac49e572f1ad86ce2adf6ca3a5247 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 4 Apr 2008 17:20:32 +0200 Subject: Don't install talloc manpage from samba, it's already installed from the standalone talloc build. (This used to be commit 7bfda828952eab7f165190cbfd804e28780406c9) --- source4/lib/talloc/config.mk | 3 --- 1 file changed, 3 deletions(-) diff --git a/source4/lib/talloc/config.mk b/source4/lib/talloc/config.mk index 3eab90b9ae..42f8b38815 100644 --- a/source4/lib/talloc/config.mk +++ b/source4/lib/talloc/config.mk @@ -2,6 +2,3 @@ OUTPUT_TYPE = STATIC_LIBRARY OBJ_FILES = talloc.o CFLAGS = -Ilib/talloc - - -MANPAGES += $(tallocdir)/talloc.3 -- cgit From 7672cdfe94f5fda1e354084a9da9790dad4c74f0 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 4 Apr 2008 17:25:20 +0200 Subject: Avoid installing unused header file. (This used to be commit eba5d8b4ce391f56877d5498004edbee8ddc4c33) --- source4/librpc/config.mk | 2 -- 1 file changed, 2 deletions(-) diff --git a/source4/librpc/config.mk b/source4/librpc/config.mk index e53e512bc6..23ad66274a 100644 --- a/source4/librpc/config.mk +++ b/source4/librpc/config.mk @@ -286,8 +286,6 @@ PUBLIC_DEPENDENCIES = LIBNDR NDR_NBT OBJ_FILES = gen_ndr/ndr_winbind.o PUBLIC_DEPENDENCIES = LIBNDR NDR_NETLOGON -PUBLIC_HEADERS += librpc/gen_ndr/winbind.h - librpc/idl-deps: ./librpc/idl-deps.pl librpc/idl/*.idl >$@ -- cgit From cb1af202be8bd4bdfe5d4864b9d4e70de1a3e516 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 4 Apr 2008 17:28:32 +0200 Subject: Don't install libevents for now, just its headers. It is already part of other libs, and only used as part of those libs. (This used to be commit c96a68b7b7792d30b7b1a0167a0cbf6fe285993c) --- source4/lib/events/config.mk | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/source4/lib/events/config.mk b/source4/lib/events/config.mk index 1e402f80d6..225a23c634 100644 --- a/source4/lib/events/config.mk +++ b/source4/lib/events/config.mk @@ -30,11 +30,9 @@ INIT_FUNCTION = s4_events_standard_init ############################## # Start SUBSYSTEM LIBEVENTS -[LIBRARY::LIBEVENTS] +[SUBSYSTEM::LIBEVENTS] OBJ_FILES = events.o events_timed.o events_signal.o PUBLIC_DEPENDENCIES = LIBTALLOC LIBSAMBA-UTIL -SO_VERSION = 0 -VERSION = 0.0.1 # End SUBSYSTEM LIBEVENTS ############################## -- cgit From 4c449fe95f20676553b04a6028310191b4a2a32a Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 5 Apr 2008 21:39:26 +1100 Subject: Extend credentials python API to include set_machine_account. Andrew Bartlett (This used to be commit 88b7a3980c7be90ea0099a3ecf08ad00fa89ea1a) --- source4/auth/credentials/credentials.i | 2 + source4/auth/credentials/credentials.py | 1 + source4/auth/credentials/credentials_files.c | 2 +- source4/auth/credentials/credentials_wrap.c | 102 +++++++++++++++++++-------- 4 files changed, 78 insertions(+), 29 deletions(-) diff --git a/source4/auth/credentials/credentials.i b/source4/auth/credentials/credentials.i index 0a604cf002..152d2e673c 100644 --- a/source4/auth/credentials/credentials.i +++ b/source4/auth/credentials/credentials.i @@ -95,6 +95,8 @@ typedef struct cli_credentials { bool set_workstation(const char *workstation, enum credentials_obtained obtained=CRED_SPECIFIED); + NTSTATUS set_machine_account(struct loadparm_context *lp_ctx); + void guess(struct loadparm_context *lp_ctx); bool is_anonymous(void); diff --git a/source4/auth/credentials/credentials.py b/source4/auth/credentials/credentials.py index 2b40fbeead..ba0000dcda 100644 --- a/source4/auth/credentials/credentials.py +++ b/source4/auth/credentials/credentials.py @@ -82,6 +82,7 @@ Credentials.set_bind_dn = new_instancemethod(_credentials.Credentials_set_bind_d Credentials.set_anonymous = new_instancemethod(_credentials.Credentials_set_anonymous,None,Credentials) Credentials.get_workstation = new_instancemethod(_credentials.Credentials_get_workstation,None,Credentials) Credentials.set_workstation = new_instancemethod(_credentials.Credentials_set_workstation,None,Credentials) +Credentials.set_machine_account = new_instancemethod(_credentials.Credentials_set_machine_account,None,Credentials) Credentials.guess = new_instancemethod(_credentials.Credentials_guess,None,Credentials) Credentials.is_anonymous = new_instancemethod(_credentials.Credentials_is_anonymous,None,Credentials) Credentials.get_nt_hash = new_instancemethod(_credentials.Credentials_get_nt_hash,None,Credentials) diff --git a/source4/auth/credentials/credentials_files.c b/source4/auth/credentials/credentials_files.c index 8bcbc65575..1bbdf8a5ad 100644 --- a/source4/auth/credentials/credentials_files.c +++ b/source4/auth/credentials/credentials_files.c @@ -327,7 +327,7 @@ _PUBLIC_ NTSTATUS cli_credentials_set_secrets(struct cli_credentials *cred, * @retval NTSTATUS error detailing any failure */ _PUBLIC_ NTSTATUS cli_credentials_set_machine_account(struct cli_credentials *cred, - struct loadparm_context *lp_ctx) + struct loadparm_context *lp_ctx) { char *filter; /* Bleh, nasty recursion issues: We are setting a machine diff --git a/source4/auth/credentials/credentials_wrap.c b/source4/auth/credentials/credentials_wrap.c index 909233aaff..6c99802b09 100644 --- a/source4/auth/credentials/credentials_wrap.c +++ b/source4/auth/credentials/credentials_wrap.c @@ -2456,24 +2456,25 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) /* -------- TYPES TABLE (BEGIN) -------- */ -#define SWIGTYPE_p_TALLOC_CTX swig_types[0] -#define SWIGTYPE_p_char swig_types[1] -#define SWIGTYPE_p_cli_credentials swig_types[2] -#define SWIGTYPE_p_int swig_types[3] -#define SWIGTYPE_p_loadparm_context swig_types[4] -#define SWIGTYPE_p_loadparm_service swig_types[5] -#define SWIGTYPE_p_long swig_types[6] -#define SWIGTYPE_p_param_context swig_types[7] -#define SWIGTYPE_p_param_opt swig_types[8] -#define SWIGTYPE_p_param_section swig_types[9] -#define SWIGTYPE_p_short swig_types[10] -#define SWIGTYPE_p_signed_char swig_types[11] -#define SWIGTYPE_p_unsigned_char swig_types[12] -#define SWIGTYPE_p_unsigned_int swig_types[13] -#define SWIGTYPE_p_unsigned_long swig_types[14] -#define SWIGTYPE_p_unsigned_short swig_types[15] -static swig_type_info *swig_types[17]; -static swig_module_info swig_module = {swig_types, 16, 0, 0, 0, 0}; +#define SWIGTYPE_p_NTSTATUS swig_types[0] +#define SWIGTYPE_p_TALLOC_CTX swig_types[1] +#define SWIGTYPE_p_char swig_types[2] +#define SWIGTYPE_p_cli_credentials swig_types[3] +#define SWIGTYPE_p_int swig_types[4] +#define SWIGTYPE_p_loadparm_context swig_types[5] +#define SWIGTYPE_p_loadparm_service swig_types[6] +#define SWIGTYPE_p_long_long swig_types[7] +#define SWIGTYPE_p_param_context swig_types[8] +#define SWIGTYPE_p_param_opt swig_types[9] +#define SWIGTYPE_p_param_section swig_types[10] +#define SWIGTYPE_p_short swig_types[11] +#define SWIGTYPE_p_signed_char swig_types[12] +#define SWIGTYPE_p_unsigned_char swig_types[13] +#define SWIGTYPE_p_unsigned_int swig_types[14] +#define SWIGTYPE_p_unsigned_long_long swig_types[15] +#define SWIGTYPE_p_unsigned_short swig_types[16] +static swig_type_info *swig_types[18]; +static swig_module_info swig_module = {swig_types, 17, 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) @@ -3409,6 +3410,46 @@ fail: } +SWIGINTERN PyObject *_wrap_Credentials_set_machine_account(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + cli_credentials *arg1 = (cli_credentials *) 0 ; + struct loadparm_context *arg2 = (struct loadparm_context *) 0 ; + NTSTATUS result; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + char * kwnames[] = { + (char *) "self",(char *) "lp_ctx", NULL + }; + + arg1 = NULL; + arg2 = loadparm_init(NULL); + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OO:Credentials_set_machine_account",kwnames,&obj0,&obj1)) SWIG_fail; + if (obj0) { + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Credentials_set_machine_account" "', argument " "1"" of type '" "cli_credentials *""'"); + } + arg1 = (cli_credentials *)(argp1); + } + if (obj1) { + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_loadparm_context, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Credentials_set_machine_account" "', argument " "2"" of type '" "struct loadparm_context *""'"); + } + arg2 = (struct loadparm_context *)(argp2); + } + result = cli_credentials_set_machine_account(arg1,arg2); + resultobj = SWIG_NewPointerObj((NTSTATUS *)memcpy((NTSTATUS *)malloc(sizeof(NTSTATUS)),&result,sizeof(NTSTATUS)), SWIGTYPE_p_NTSTATUS, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + SWIGINTERN PyObject *_wrap_Credentials_guess(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; cli_credentials *arg1 = (cli_credentials *) 0 ; @@ -3646,6 +3687,7 @@ static PyMethodDef SwigMethods[] = { { (char *)"Credentials_set_anonymous", (PyCFunction) _wrap_Credentials_set_anonymous, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Credentials_get_workstation", (PyCFunction) _wrap_Credentials_get_workstation, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Credentials_set_workstation", (PyCFunction) _wrap_Credentials_set_workstation, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"Credentials_set_machine_account", (PyCFunction) _wrap_Credentials_set_machine_account, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Credentials_guess", (PyCFunction) _wrap_Credentials_guess, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Credentials_is_anonymous", (PyCFunction) _wrap_Credentials_is_anonymous, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Credentials_get_nt_hash", (PyCFunction) _wrap_Credentials_get_nt_hash, METH_VARARGS | METH_KEYWORDS, NULL}, @@ -3661,31 +3703,33 @@ static PyMethodDef SwigMethods[] = { /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ +static swig_type_info _swigt__p_NTSTATUS = {"_p_NTSTATUS", "NTSTATUS *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_TALLOC_CTX = {"_p_TALLOC_CTX", "TALLOC_CTX *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_cli_credentials = {"_p_cli_credentials", "struct cli_credentials *|cli_credentials *", 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_loadparm_context = {"_p_loadparm_context", "struct loadparm_context *|loadparm_context *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_loadparm_service = {"_p_loadparm_service", "struct loadparm_service *|loadparm_service *", 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_param_context = {"_p_param_context", "struct param_context *|param *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_param_opt = {"_p_param_opt", "struct param_opt *|param_opt *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_param_section = {"_p_param_section", "struct param_section *|param_section *", 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 *|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_long = {"_p_unsigned_long_long", "uint_least64_t *|uint_fast64_t *|uint64_t *|unsigned long long *|uintmax_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_unsigned_short = {"_p_unsigned_short", "unsigned short *|uint_least16_t *|uint16_t *", 0, 0, (void*)0, 0}; static swig_type_info *swig_type_initial[] = { + &_swigt__p_NTSTATUS, &_swigt__p_TALLOC_CTX, &_swigt__p_char, &_swigt__p_cli_credentials, &_swigt__p_int, &_swigt__p_loadparm_context, &_swigt__p_loadparm_service, - &_swigt__p_long, + &_swigt__p_long_long, &_swigt__p_param_context, &_swigt__p_param_opt, &_swigt__p_param_section, @@ -3693,17 +3737,18 @@ static swig_type_info *swig_type_initial[] = { &_swigt__p_signed_char, &_swigt__p_unsigned_char, &_swigt__p_unsigned_int, - &_swigt__p_unsigned_long, + &_swigt__p_unsigned_long_long, &_swigt__p_unsigned_short, }; +static swig_cast_info _swigc__p_NTSTATUS[] = { {&_swigt__p_NTSTATUS, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_TALLOC_CTX[] = { {&_swigt__p_TALLOC_CTX, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_cli_credentials[] = { {&_swigt__p_cli_credentials, 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}}; static swig_cast_info _swigc__p_loadparm_service[] = { {&_swigt__p_loadparm_service, 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_param_context[] = { {&_swigt__p_param_context, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_param_opt[] = { {&_swigt__p_param_opt, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_param_section[] = { {&_swigt__p_param_section, 0, 0, 0},{0, 0, 0, 0}}; @@ -3711,17 +3756,18 @@ static swig_cast_info _swigc__p_short[] = { {&_swigt__p_short, 0, 0, 0},{0, 0, static swig_cast_info _swigc__p_signed_char[] = { {&_swigt__p_signed_char, 0, 0, 0},{0, 0, 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 *swig_cast_initial[] = { + _swigc__p_NTSTATUS, _swigc__p_TALLOC_CTX, _swigc__p_char, _swigc__p_cli_credentials, _swigc__p_int, _swigc__p_loadparm_context, _swigc__p_loadparm_service, - _swigc__p_long, + _swigc__p_long_long, _swigc__p_param_context, _swigc__p_param_opt, _swigc__p_param_section, @@ -3729,7 +3775,7 @@ static swig_cast_info *swig_cast_initial[] = { _swigc__p_signed_char, _swigc__p_unsigned_char, _swigc__p_unsigned_int, - _swigc__p_unsigned_long, + _swigc__p_unsigned_long_long, _swigc__p_unsigned_short, }; -- cgit From 8db14bf26b96f47b8f937f6016d18d947b68467e Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 8 Apr 2008 05:16:07 +0200 Subject: Add manually written Python binding for libnet_Join. (This used to be commit 374654b43d9f9e8381991cedc433ce410a914f7a) --- source4/libnet/config.mk | 6 +- source4/libnet/net.i | 73 - source4/libnet/net.py | 103 - source4/libnet/net_wrap.c | 4711 ------------------------------------ source4/libnet/py_net.c | 77 + source4/scripting/python/modules.c | 1 + 6 files changed, 81 insertions(+), 4890 deletions(-) delete mode 100644 source4/libnet/net.i delete mode 100644 source4/libnet/net.py delete mode 100644 source4/libnet/net_wrap.c create mode 100644 source4/libnet/py_net.c diff --git a/source4/libnet/config.mk b/source4/libnet/config.mk index 00af6b37f2..11b8bdf928 100644 --- a/source4/libnet/config.mk +++ b/source4/libnet/config.mk @@ -31,6 +31,6 @@ PUBLIC_DEPENDENCIES = CREDENTIALS dcerpc dcerpc_samr RPC_NDR_LSA RPC_NDR_SRVSVC # userinfo.h userman.h) -[PYTHON::swig_net] -PRIVATE_DEPENDENCIES = LIBSAMBA-NET -SWIG_FILE = net.i +[PYTHON::python_net] +PRIVATE_DEPENDENCIES = LIBSAMBA-NET LIBPYTHON +OBJ_FILES = py_net.o diff --git a/source4/libnet/net.i b/source4/libnet/net.i deleted file mode 100644 index aad008939f..0000000000 --- a/source4/libnet/net.i +++ /dev/null @@ -1,73 +0,0 @@ -/* - Unix SMB/CIFS implementation. - Copyright (C) Jelmer Vernooij 2007 - - 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 . -*/ - -%module(package="samba.net") net - -%{ -#include "includes.h" -#include "libnet/libnet.h" -#include "lib/events/events.h" -#include "param/param.h" -typedef struct libnet_context libnet; -%} - -%import "../libcli/util/errors.i" -%import "../lib/events/events.i" -%import "../lib/talloc/talloc.i" -%import "../param/param.i" - -%talloctype(libnet_context); - -typedef struct libnet_context { - struct cli_credentials *cred; - %extend { - libnet(struct event_context *ev, struct loadparm_context *lp_ctx) { - return libnet_context_init(ev, lp_ctx); - } - NTSTATUS samsync_ldb(TALLOC_CTX *mem_ctx, struct libnet_samsync_ldb *r); - NTSTATUS DomainList(TALLOC_CTX *mem_ctx, struct libnet_DomainList *io); - NTSTATUS DomainClose(TALLOC_CTX *mem_ctx, struct libnet_DomainClose *io); - NTSTATUS DomainOpen(TALLOC_CTX *mem_ctx, struct libnet_DomainOpen *io); - NTSTATUS LookupName(TALLOC_CTX *mem_ctx, struct libnet_LookupName *io); - NTSTATUS LookupDCs(TALLOC_CTX *mem_ctx, struct libnet_LookupDCs *io); - NTSTATUS LookupHost(TALLOC_CTX *mem_ctx, struct libnet_Lookup *io); - NTSTATUS Lookup(TALLOC_CTX *mem_ctx, struct libnet_Lookup *io); - NTSTATUS ListShares(TALLOC_CTX *mem_ctx, struct libnet_ListShares *r); - NTSTATUS AddShare(TALLOC_CTX *mem_ctx, struct libnet_AddShare *r); - NTSTATUS DelShare(TALLOC_CTX *mem_ctx, struct libnet_DelShare *r); - NTSTATUS GroupList(TALLOC_CTX *mem_ctx, struct libnet_GroupList *io); - NTSTATUS GroupInfo(TALLOC_CTX *mem_ctx, struct libnet_GroupInfo *io); - NTSTATUS UserList(TALLOC_CTX *mem_ctx, struct libnet_UserList *r); - NTSTATUS UserInfo(TALLOC_CTX *mem_ctx, struct libnet_UserInfo *r); - NTSTATUS ModifyUser(TALLOC_CTX *mem_ctx, struct libnet_ModifyUser *r); - NTSTATUS DeleteUser(TALLOC_CTX *mem_ctx, struct libnet_DeleteUser *r); - NTSTATUS CreateUser(TALLOC_CTX *mem_ctx, struct libnet_CreateUser *r); - NTSTATUS SamDump_keytab(TALLOC_CTX *mem_ctx, struct libnet_SamDump_keytab *r); - NTSTATUS SamDump(TALLOC_CTX *mem_ctx, struct libnet_SamDump *r); - NTSTATUS SamSync_netlogon(TALLOC_CTX *mem_ctx, struct libnet_SamSync *r); - NTSTATUS UnbecomeDC(TALLOC_CTX *mem_ctx, struct libnet_UnbecomeDC *r); - NTSTATUS BecomeDC(TALLOC_CTX *mem_ctx, struct libnet_BecomeDC *r); - NTSTATUS JoinSite(struct ldb_context *remote_ldb, struct libnet_JoinDomain *libnet_r); - NTSTATUS JoinDomain(TALLOC_CTX *mem_ctx, struct libnet_JoinDomain *r); - NTSTATUS Join(TALLOC_CTX *mem_ctx, struct libnet_Join *r); - NTSTATUS RpcConnect(TALLOC_CTX *mem_ctx, struct libnet_RpcConnect *r); - NTSTATUS RemoteTOD(TALLOC_CTX *mem_ctx, union libnet_RemoteTOD *r); - NTSTATUS ChangePassword(TALLOC_CTX *mem_ctx, union libnet_ChangePassword *r); - NTSTATUS SetPassword(TALLOC_CTX *mem_ctx, union libnet_SetPassword *r); - } -} libnet; diff --git a/source4/libnet/net.py b/source4/libnet/net.py deleted file mode 100644 index ae659b8449..0000000000 --- a/source4/libnet/net.py +++ /dev/null @@ -1,103 +0,0 @@ -# This file was automatically generated by SWIG (http://www.swig.org). -# Version 1.3.33 -# -# Don't modify this file, modify the SWIG interface instead. - -import _net -import new -new_instancemethod = new.instancemethod -try: - _swig_property = property -except NameError: - pass # Python < 2.2 doesn't have 'property'. -def _swig_setattr_nondynamic(self,class_type,name,value,static=1): - if (name == "thisown"): return self.this.own(value) - if (name == "this"): - if type(value).__name__ == 'PySwigObject': - self.__dict__[name] = value - return - method = class_type.__swig_setmethods__.get(name,None) - if method: return method(self,value) - if (not static) or hasattr(self,name): - self.__dict__[name] = value - else: - raise AttributeError("You cannot add attributes to %s" % self) - -def _swig_setattr(self,class_type,name,value): - return _swig_setattr_nondynamic(self,class_type,name,value,0) - -def _swig_getattr(self,class_type,name): - if (name == "thisown"): return self.this.own() - method = class_type.__swig_getmethods__.get(name,None) - if method: return method(self) - raise AttributeError,name - -def _swig_repr(self): - try: strthis = "proxy of " + self.this.__repr__() - except: strthis = "" - return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) - -import types -try: - _object = types.ObjectType - _newclass = 1 -except AttributeError: - class _object : pass - _newclass = 0 -del types - - -def _swig_setattr_nondynamic_method(set): - def set_attr(self,name,value): - if (name == "thisown"): return self.this.own(value) - if hasattr(self,name) or (name == "this"): - set(self,name,value) - else: - raise AttributeError("You cannot add attributes to %s" % self) - return set_attr - - -import events -import param -class libnet(object): - thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') - __repr__ = _swig_repr - cred = _swig_property(_net.libnet_cred_get, _net.libnet_cred_set) - def __init__(self, *args, **kwargs): - _net.libnet_swiginit(self,_net.new_libnet(*args, **kwargs)) - __swig_destroy__ = _net.delete_libnet -libnet.samsync_ldb = new_instancemethod(_net.libnet_samsync_ldb,None,libnet) -libnet.DomainList = new_instancemethod(_net.libnet_DomainList,None,libnet) -libnet.DomainClose = new_instancemethod(_net.libnet_DomainClose,None,libnet) -libnet.DomainOpen = new_instancemethod(_net.libnet_DomainOpen,None,libnet) -libnet.LookupName = new_instancemethod(_net.libnet_LookupName,None,libnet) -libnet.LookupDCs = new_instancemethod(_net.libnet_LookupDCs,None,libnet) -libnet.LookupHost = new_instancemethod(_net.libnet_LookupHost,None,libnet) -libnet.Lookup = new_instancemethod(_net.libnet_Lookup,None,libnet) -libnet.ListShares = new_instancemethod(_net.libnet_ListShares,None,libnet) -libnet.AddShare = new_instancemethod(_net.libnet_AddShare,None,libnet) -libnet.DelShare = new_instancemethod(_net.libnet_DelShare,None,libnet) -libnet.GroupList = new_instancemethod(_net.libnet_GroupList,None,libnet) -libnet.GroupInfo = new_instancemethod(_net.libnet_GroupInfo,None,libnet) -libnet.UserList = new_instancemethod(_net.libnet_UserList,None,libnet) -libnet.UserInfo = new_instancemethod(_net.libnet_UserInfo,None,libnet) -libnet.ModifyUser = new_instancemethod(_net.libnet_ModifyUser,None,libnet) -libnet.DeleteUser = new_instancemethod(_net.libnet_DeleteUser,None,libnet) -libnet.CreateUser = new_instancemethod(_net.libnet_CreateUser,None,libnet) -libnet.SamDump_keytab = new_instancemethod(_net.libnet_SamDump_keytab,None,libnet) -libnet.SamDump = new_instancemethod(_net.libnet_SamDump,None,libnet) -libnet.SamSync_netlogon = new_instancemethod(_net.libnet_SamSync_netlogon,None,libnet) -libnet.UnbecomeDC = new_instancemethod(_net.libnet_UnbecomeDC,None,libnet) -libnet.BecomeDC = new_instancemethod(_net.libnet_BecomeDC,None,libnet) -libnet.JoinSite = new_instancemethod(_net.libnet_JoinSite,None,libnet) -libnet.JoinDomain = new_instancemethod(_net.libnet_JoinDomain,None,libnet) -libnet.Join = new_instancemethod(_net.libnet_Join,None,libnet) -libnet.RpcConnect = new_instancemethod(_net.libnet_RpcConnect,None,libnet) -libnet.RemoteTOD = new_instancemethod(_net.libnet_RemoteTOD,None,libnet) -libnet.ChangePassword = new_instancemethod(_net.libnet_ChangePassword,None,libnet) -libnet.SetPassword = new_instancemethod(_net.libnet_SetPassword,None,libnet) -libnet_swigregister = _net.libnet_swigregister -libnet_swigregister(libnet) - - - diff --git a/source4/libnet/net_wrap.c b/source4/libnet/net_wrap.c deleted file mode 100644 index 29b30a87c2..0000000000 --- a/source4/libnet/net_wrap.c +++ /dev/null @@ -1,4711 +0,0 @@ -/* ---------------------------------------------------------------------------- - * This file was automatically generated by SWIG (http://www.swig.org). - * Version 1.3.33 - * - * This file is not intended to be easily readable and contains a number of - * coding conventions designed to improve portability and efficiency. Do not make - * changes to this file unless you know what you are doing--modify the SWIG - * interface file instead. - * ----------------------------------------------------------------------------- */ - -#define SWIGPYTHON -#define SWIG_PYTHON_NO_BUILD_NONE -/* ----------------------------------------------------------------------------- - * This section contains generic SWIG labels for method/variable - * declarations/attributes, and other compiler dependent labels. - * ----------------------------------------------------------------------------- */ - -/* template workaround for compilers that cannot correctly implement the C++ standard */ -#ifndef SWIGTEMPLATEDISAMBIGUATOR -# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) -# define SWIGTEMPLATEDISAMBIGUATOR template -# elif defined(__HP_aCC) -/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ -/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ -# define SWIGTEMPLATEDISAMBIGUATOR template -# else -# define SWIGTEMPLATEDISAMBIGUATOR -# endif -#endif - -/* inline attribute */ -#ifndef SWIGINLINE -# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) -# define SWIGINLINE inline -# else -# define SWIGINLINE -# endif -#endif - -/* attribute recognised by some compilers to avoid 'unused' warnings */ -#ifndef SWIGUNUSED -# if defined(__GNUC__) -# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define SWIGUNUSED __attribute__ ((__unused__)) -# else -# define SWIGUNUSED -# endif -# elif defined(__ICC) -# define SWIGUNUSED __attribute__ ((__unused__)) -# else -# define SWIGUNUSED -# endif -#endif - -#ifndef SWIGUNUSEDPARM -# ifdef __cplusplus -# define SWIGUNUSEDPARM(p) -# else -# define SWIGUNUSEDPARM(p) p SWIGUNUSED -# endif -#endif - -/* internal SWIG method */ -#ifndef SWIGINTERN -# define SWIGINTERN static SWIGUNUSED -#endif - -/* internal inline SWIG method */ -#ifndef SWIGINTERNINLINE -# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE -#endif - -/* exporting methods */ -#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) -# ifndef GCC_HASCLASSVISIBILITY -# define GCC_HASCLASSVISIBILITY -# endif -#endif - -#ifndef SWIGEXPORT -# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) -# if defined(STATIC_LINKED) -# define SWIGEXPORT -# else -# define SWIGEXPORT __declspec(dllexport) -# endif -# else -# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) -# define SWIGEXPORT __attribute__ ((visibility("default"))) -# else -# define SWIGEXPORT -# endif -# endif -#endif - -/* calling conventions for Windows */ -#ifndef SWIGSTDCALL -# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) -# define SWIGSTDCALL __stdcall -# else -# define SWIGSTDCALL -# endif -#endif - -/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ -#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) -# define _CRT_SECURE_NO_DEPRECATE -#endif - -/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ -#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) -# define _SCL_SECURE_NO_DEPRECATE -#endif - - - -/* Python.h has to appear first */ -#include - -/* ----------------------------------------------------------------------------- - * swigrun.swg - * - * This file contains generic CAPI SWIG runtime support for pointer - * type checking. - * ----------------------------------------------------------------------------- */ - -/* 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_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ -#ifdef SWIG_TYPE_TABLE -# define SWIG_QUOTE_STRING(x) #x -# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) -# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) -#else -# define SWIG_TYPE_TABLE_NAME -#endif - -/* - You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for - creating a static or dynamic library from the swig runtime code. - In 99.9% of the cases, swig just needs to declare them as 'static'. - - But only do this if is strictly necessary, ie, if you have problems - with your compiler or so. -*/ - -#ifndef SWIGRUNTIME -# define SWIGRUNTIME SWIGINTERN -#endif - -#ifndef SWIGRUNTIMEINLINE -# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE -#endif - -/* Generic buffer size */ -#ifndef SWIG_BUFFER_SIZE -# define SWIG_BUFFER_SIZE 1024 -#endif - -/* Flags for pointer conversions */ -#define SWIG_POINTER_DISOWN 0x1 - -/* Flags for new pointer objects */ -#define SWIG_POINTER_OWN 0x1 - - -/* - Flags/methods for returning states. - - The swig conversion methods, as ConvertPtr, return and integer - that tells if the conversion was successful or not. And if not, - an error code can be returned (see swigerrors.swg for the codes). - - Use the following macros/flags to set or process the returning - states. - - In old swig versions, you usually write code as: - - if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) { - // success code - } else { - //fail code - } - - Now you can be more explicit as: - - int res = SWIG_ConvertPtr(obj,vptr,ty.flags); - if (SWIG_IsOK(res)) { - // success code - } else { - // fail code - } - - that seems to be the same, but now you can also do - - Type *ptr; - int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags); - if (SWIG_IsOK(res)) { - // success code - if (SWIG_IsNewObj(res) { - ... - delete *ptr; - } else { - ... - } - } else { - // fail code - } - - I.e., now SWIG_ConvertPtr can return new objects and you can - identify the case and take care of the deallocation. Of course that - requires also to SWIG_ConvertPtr to return new result values, as - - int SWIG_ConvertPtr(obj, ptr,...) { - if () { - if () { - *ptr = ; - return SWIG_NEWOBJ; - } else { - *ptr = ; - return SWIG_OLDOBJ; - } - } else { - return SWIG_BADOBJ; - } - } - - Of course, returning the plain '0(success)/-1(fail)' still works, but you can be - more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the - swig errors code. - - Finally, if the SWIG_CASTRANK_MODE is enabled, the result code - allows to return the 'cast rank', for example, if you have this - - int food(double) - int fooi(int); - - and you call - - food(1) // cast rank '1' (1 -> 1.0) - fooi(1) // cast rank '0' - - just use the SWIG_AddCast()/SWIG_CheckState() - - - */ -#define SWIG_OK (0) -#define SWIG_ERROR (-1) -#define SWIG_IsOK(r) (r >= 0) -#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) - -/* The CastRankLimit says how many bits are used for the cast rank */ -#define SWIG_CASTRANKLIMIT (1 << 8) -/* The NewMask denotes the object was created (using new/malloc) */ -#define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1) -/* The TmpMask is for in/out typemaps that use temporal objects */ -#define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1) -/* Simple returning values */ -#define SWIG_BADOBJ (SWIG_ERROR) -#define SWIG_OLDOBJ (SWIG_OK) -#define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK) -#define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK) -/* Check, add and del mask methods */ -#define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r) -#define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r) -#define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK)) -#define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r) -#define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r) -#define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK)) - - -/* Cast-Rank Mode */ -#if defined(SWIG_CASTRANK_MODE) -# ifndef SWIG_TypeRank -# define SWIG_TypeRank unsigned long -# endif -# ifndef SWIG_MAXCASTRANK /* Default cast allowed */ -# define SWIG_MAXCASTRANK (2) -# endif -# define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1) -# define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK) -SWIGINTERNINLINE int SWIG_AddCast(int r) { - return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r; -} -SWIGINTERNINLINE int SWIG_CheckState(int r) { - return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; -} -#else /* no cast-rank mode */ -# define SWIG_AddCast -# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) -#endif - - - - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef void *(*swig_converter_func)(void *); -typedef struct swig_type_info *(*swig_dycast_func)(void **); - -/* Structure to store inforomation 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 */ - swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ - struct swig_cast_info *cast; /* linked list of types that can cast into this type */ - void *clientdata; /* language specific type data */ - int owndata; /* flag if the structure owns the clientdata */ -} swig_type_info; - -/* Structure to store a type and conversion function used for casting */ -typedef struct swig_cast_info { - swig_type_info *type; /* pointer to type that is equivalent to this type */ - swig_converter_func converter; /* function to cast the void pointers */ - struct swig_cast_info *next; /* pointer to next cast in linked list */ - struct swig_cast_info *prev; /* pointer to the previous cast */ -} swig_cast_info; - -/* Structure used to store module information - * Each module generates one structure like this, and the runtime collects - * all of these structures and stores them in a circularly linked list.*/ -typedef struct swig_module_info { - swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ - size_t size; /* Number of types in this module */ - struct swig_module_info *next; /* Pointer to next element in circularly linked list */ - swig_type_info **type_initial; /* Array of initially generated type structures */ - swig_cast_info **cast_initial; /* Array of initially generated casting structures */ - void *clientdata; /* Language specific module data */ -} swig_module_info; - -/* - Compare two type names skipping the space characters, therefore - "char*" == "char *" and "Class" == "Class", etc. - - Return 0 when the two name types are equivalent, as in - strncmp, but skipping ' '. -*/ -SWIGRUNTIME int -SWIG_TypeNameComp(const char *f1, const char *l1, - const char *f2, const char *l2) { - for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { - while ((*f1 == ' ') && (f1 != l1)) ++f1; - while ((*f2 == ' ') && (f2 != l2)) ++f2; - if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1; - } - return (int)((l1 - f1) - (l2 - f2)); -} - -/* - Check type equivalence in a name list like ||... - Return 0 if not equal, 1 if equal -*/ -SWIGRUNTIME int -SWIG_TypeEquiv(const char *nb, const char *tb) { - int equiv = 0; - const char* te = tb + strlen(tb); - const char* ne = nb; - while (!equiv && *ne) { - for (nb = ne; *ne; ++ne) { - if (*ne == '|') break; - } - equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; - if (*ne) ++ne; - } - return equiv; -} - -/* - Check type equivalence in a name list like ||... - Return 0 if equal, -1 if nb < tb, 1 if nb > tb -*/ -SWIGRUNTIME int -SWIG_TypeCompare(const char *nb, const char *tb) { - int equiv = 0; - const char* te = tb + strlen(tb); - const char* ne = nb; - while (!equiv && *ne) { - for (nb = ne; *ne; ++ne) { - if (*ne == '|') break; - } - equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; - if (*ne) ++ne; - } - return equiv; -} - - -/* think of this as a c++ template<> or a scheme macro */ -#define SWIG_TypeCheck_Template(comparison, ty) \ - if (ty) { \ - swig_cast_info *iter = ty->cast; \ - while (iter) { \ - if (comparison) { \ - if (iter == ty->cast) return iter; \ - /* Move iter to the top of the linked list */ \ - iter->prev->next = iter->next; \ - if (iter->next) \ - iter->next->prev = iter->prev; \ - iter->next = ty->cast; \ - iter->prev = 0; \ - if (ty->cast) ty->cast->prev = iter; \ - ty->cast = iter; \ - return iter; \ - } \ - iter = iter->next; \ - } \ - } \ - return 0 - -/* - Check the typename -*/ -SWIGRUNTIME swig_cast_info * -SWIG_TypeCheck(const char *c, swig_type_info *ty) { - SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty); -} - -/* Same as previous function, except strcmp is replaced with a pointer comparison */ -SWIGRUNTIME swig_cast_info * -SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) { - SWIG_TypeCheck_Template(iter->type == from, 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); -} - -/* - Dynamic pointer casting. Down an inheritance hierarchy -*/ -SWIGRUNTIME swig_type_info * -SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { - swig_type_info *lastty = ty; - if (!ty || !ty->dcast) return ty; - while (ty && (ty->dcast)) { - ty = (*ty->dcast)(ptr); - if (ty) lastty = ty; - } - return lastty; -} - -/* - Return the name associated with this type -*/ -SWIGRUNTIMEINLINE const char * -SWIG_TypeName(const swig_type_info *ty) { - return ty->name; -} - -/* - Return the pretty name associated with this type, - that is an unmangled type name in a form presentable to the user. -*/ -SWIGRUNTIME const char * -SWIG_TypePrettyName(const swig_type_info *type) { - /* The "str" field contains the equivalent pretty names of the - type, separated by vertical-bar characters. We choose - to print the last name, as it is often (?) the most - specific. */ - if (!type) return NULL; - if (type->str != NULL) { - const char *last_name = type->str; - const char *s; - for (s = type->str; *s; s++) - if (*s == '|') last_name = s+1; - return last_name; - } - else - return type->name; -} - -/* - Set the clientdata field for a type -*/ -SWIGRUNTIME void -SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { - swig_cast_info *cast = ti->cast; - /* if (ti->clientdata == clientdata) return; */ - ti->clientdata = clientdata; - - while (cast) { - if (!cast->converter) { - swig_type_info *tc = cast->type; - if (!tc->clientdata) { - SWIG_TypeClientData(tc, clientdata); - } - } - cast = cast->next; - } -} -SWIGRUNTIME void -SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { - SWIG_TypeClientData(ti, clientdata); - ti->owndata = 1; -} - -/* - Search for a swig_type_info structure only by mangled name - Search is a O(log #types) - - We start searching at module start, and finish searching when start == end. - Note: if start == end at the beginning of the function, we go all the way around - the circular list. -*/ -SWIGRUNTIME swig_type_info * -SWIG_MangledTypeQueryModule(swig_module_info *start, - swig_module_info *end, - const char *name) { - swig_module_info *iter = start; - do { - if (iter->size) { - register size_t l = 0; - register size_t r = iter->size - 1; - do { - /* since l+r >= 0, we can (>> 1) instead (/ 2) */ - register size_t i = (l + r) >> 1; - const char *iname = iter->types[i]->name; - if (iname) { - register int compare = strcmp(name, iname); - if (compare == 0) { - return iter->types[i]; - } else if (compare < 0) { - if (i) { - r = i - 1; - } else { - break; - } - } else if (compare > 0) { - l = i + 1; - } - } else { - break; /* should never happen */ - } - } while (l <= r); - } - iter = iter->next; - } while (iter != end); - return 0; -} - -/* - Search for a swig_type_info structure for either a mangled name or a human readable name. - It first searches the mangled names of the types, which is a O(log #types) - If a type is not found it then searches the human readable names, which is O(#types). - - We start searching at module start, and finish searching when start == end. - Note: if start == end at the beginning of the function, we go all the way around - the circular list. -*/ -SWIGRUNTIME swig_type_info * -SWIG_TypeQueryModule(swig_module_info *start, - swig_module_info *end, - const char *name) { - /* STEP 1: Search the name field using binary search */ - swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); - if (ret) { - return ret; - } else { - /* STEP 2: If the type hasn't been found, do a complete search - of the str field (the human readable name) */ - swig_module_info *iter = start; - do { - register size_t i = 0; - for (; i < iter->size; ++i) { - if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) - return iter->types[i]; - } - iter = iter->next; - } while (iter != end); - } - - /* neither found a match */ - return 0; -} - -/* - Pack binary data into a string -*/ -SWIGRUNTIME char * -SWIG_PackData(char *c, void *ptr, size_t sz) { - static const char hex[17] = "0123456789abcdef"; - register const unsigned char *u = (unsigned char *) ptr; - register const unsigned char *eu = u + sz; - for (; u != eu; ++u) { - register unsigned char uu = *u; - *(c++) = hex[(uu & 0xf0) >> 4]; - *(c++) = hex[uu & 0xf]; - } - return c; -} - -/* - Unpack binary data from a string -*/ -SWIGRUNTIME const char * -SWIG_UnpackData(const char *c, void *ptr, size_t sz) { - register unsigned char *u = (unsigned char *) ptr; - register const unsigned char *eu = u + sz; - for (; u != eu; ++u) { - register char d = *(c++); - register unsigned char uu; - if ((d >= '0') && (d <= '9')) - uu = ((d - '0') << 4); - else if ((d >= 'a') && (d <= 'f')) - uu = ((d - ('a'-10)) << 4); - else - return (char *) 0; - d = *(c++); - if ((d >= '0') && (d <= '9')) - uu |= (d - '0'); - else if ((d >= 'a') && (d <= 'f')) - uu |= (d - ('a'-10)); - else - return (char *) 0; - *u = uu; - } - return c; -} - -/* - Pack 'void *' into a string buffer. -*/ -SWIGRUNTIME char * -SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { - char *r = buff; - if ((2*sizeof(void *) + 2) > bsz) return 0; - *(r++) = '_'; - r = SWIG_PackData(r,&ptr,sizeof(void *)); - if (strlen(name) + 1 > (bsz - (r - buff))) return 0; - strcpy(r,name); - return buff; -} - -SWIGRUNTIME const char * -SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { - if (*c != '_') { - if (strcmp(c,"NULL") == 0) { - *ptr = (void *) 0; - return name; - } else { - return 0; - } - } - return SWIG_UnpackData(++c,ptr,sizeof(void *)); -} - -SWIGRUNTIME char * -SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { - char *r = buff; - size_t lname = (name ? strlen(name) : 0); - if ((2*sz + 2 + lname) > bsz) return 0; - *(r++) = '_'; - r = SWIG_PackData(r,ptr,sz); - if (lname) { - strncpy(r,name,lname+1); - } else { - *r = 0; - } - return buff; -} - -SWIGRUNTIME const char * -SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { - if (*c != '_') { - if (strcmp(c,"NULL") == 0) { - memset(ptr,0,sz); - return name; - } else { - return 0; - } - } - return SWIG_UnpackData(++c,ptr,sz); -} - -#ifdef __cplusplus -} -#endif - -/* Errors in SWIG */ -#define SWIG_UnknownError -1 -#define SWIG_IOError -2 -#define SWIG_RuntimeError -3 -#define SWIG_IndexError -4 -#define SWIG_TypeError -5 -#define SWIG_DivisionByZero -6 -#define SWIG_OverflowError -7 -#define SWIG_SyntaxError -8 -#define SWIG_ValueError -9 -#define SWIG_SystemError -10 -#define SWIG_AttributeError -11 -#define SWIG_MemoryError -12 -#define SWIG_NullReferenceError -13 - - - - -/* Add PyOS_snprintf for old Pythons */ -#if PY_VERSION_HEX < 0x02020000 -# if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM) -# define PyOS_snprintf _snprintf -# else -# define PyOS_snprintf snprintf -# endif -#endif - -/* A crude PyString_FromFormat implementation for old Pythons */ -#if PY_VERSION_HEX < 0x02020000 - -#ifndef SWIG_PYBUFFER_SIZE -# define SWIG_PYBUFFER_SIZE 1024 -#endif - -static PyObject * -PyString_FromFormat(const char *fmt, ...) { - va_list ap; - char buf[SWIG_PYBUFFER_SIZE * 2]; - int res; - va_start(ap, fmt); - res = vsnprintf(buf, sizeof(buf), fmt, ap); - va_end(ap); - return (res < 0 || res >= (int)sizeof(buf)) ? 0 : PyString_FromString(buf); -} -#endif - -/* Add PyObject_Del for old Pythons */ -#if PY_VERSION_HEX < 0x01060000 -# define PyObject_Del(op) PyMem_DEL((op)) -#endif -#ifndef PyObject_DEL -# define PyObject_DEL PyObject_Del -#endif - -/* A crude PyExc_StopIteration exception for old Pythons */ -#if PY_VERSION_HEX < 0x02020000 -# ifndef PyExc_StopIteration -# define PyExc_StopIteration PyExc_RuntimeError -# endif -# ifndef PyObject_GenericGetAttr -# define PyObject_GenericGetAttr 0 -# endif -#endif -/* Py_NotImplemented is defined in 2.1 and up. */ -#if PY_VERSION_HEX < 0x02010000 -# ifndef Py_NotImplemented -# define Py_NotImplemented PyExc_RuntimeError -# endif -#endif - - -/* A crude PyString_AsStringAndSize implementation for old Pythons */ -#if PY_VERSION_HEX < 0x02010000 -# ifndef PyString_AsStringAndSize -# define PyString_AsStringAndSize(obj, s, len) {*s = PyString_AsString(obj); *len = *s ? strlen(*s) : 0;} -# endif -#endif - -/* PySequence_Size for old Pythons */ -#if PY_VERSION_HEX < 0x02000000 -# ifndef PySequence_Size -# define PySequence_Size PySequence_Length -# endif -#endif - - -/* PyBool_FromLong for old Pythons */ -#if PY_VERSION_HEX < 0x02030000 -static -PyObject *PyBool_FromLong(long ok) -{ - PyObject *result = ok ? Py_True : Py_False; - Py_INCREF(result); - return result; -} -#endif - -/* Py_ssize_t for old Pythons */ -/* This code is as recommended by: */ -/* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */ -#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) -typedef int Py_ssize_t; -# define PY_SSIZE_T_MAX INT_MAX -# define PY_SSIZE_T_MIN INT_MIN -#endif - -/* ----------------------------------------------------------------------------- - * error manipulation - * ----------------------------------------------------------------------------- */ - -SWIGRUNTIME PyObject* -SWIG_Python_ErrorType(int code) { - PyObject* type = 0; - switch(code) { - case SWIG_MemoryError: - type = PyExc_MemoryError; - break; - case SWIG_IOError: - type = PyExc_IOError; - break; - case SWIG_RuntimeError: - type = PyExc_RuntimeError; - break; - case SWIG_IndexError: - type = PyExc_IndexError; - break; - case SWIG_TypeError: - type = PyExc_TypeError; - break; - case SWIG_DivisionByZero: - type = PyExc_ZeroDivisionError; - break; - case SWIG_OverflowError: - type = PyExc_OverflowError; - break; - case SWIG_SyntaxError: - type = PyExc_SyntaxError; - break; - case SWIG_ValueError: - type = PyExc_ValueError; - break; - case SWIG_SystemError: - type = PyExc_SystemError; - break; - case SWIG_AttributeError: - type = PyExc_AttributeError; - break; - default: - type = PyExc_RuntimeError; - } - return type; -} - - -SWIGRUNTIME void -SWIG_Python_AddErrorMsg(const char* mesg) -{ - PyObject *type = 0; - PyObject *value = 0; - PyObject *traceback = 0; - - if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback); - if (value) { - PyObject *old_str = PyObject_Str(value); - PyErr_Clear(); - Py_XINCREF(type); - PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg); - Py_DECREF(old_str); - Py_DECREF(value); - } else { - PyErr_Format(PyExc_RuntimeError, mesg); - } -} - - - -#if defined(SWIG_PYTHON_NO_THREADS) -# if defined(SWIG_PYTHON_THREADS) -# undef SWIG_PYTHON_THREADS -# endif -#endif -#if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */ -# if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL) -# if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */ -# define SWIG_PYTHON_USE_GIL -# endif -# endif -# if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */ -# ifndef SWIG_PYTHON_INITIALIZE_THREADS -# define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads() -# endif -# ifdef __cplusplus /* C++ code */ - class SWIG_Python_Thread_Block { - bool status; - PyGILState_STATE state; - public: - void end() { if (status) { PyGILState_Release(state); status = false;} } - SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {} - ~SWIG_Python_Thread_Block() { end(); } - }; - class SWIG_Python_Thread_Allow { - bool status; - PyThreadState *save; - public: - void end() { if (status) { PyEval_RestoreThread(save); status = false; }} - SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {} - ~SWIG_Python_Thread_Allow() { end(); } - }; -# define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block -# define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end() -# define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow -# define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end() -# else /* C code */ -# define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure() -# define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block) -# define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread() -# define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow) -# endif -# else /* Old thread way, not implemented, user must provide it */ -# if !defined(SWIG_PYTHON_INITIALIZE_THREADS) -# define SWIG_PYTHON_INITIALIZE_THREADS -# endif -# if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK) -# define SWIG_PYTHON_THREAD_BEGIN_BLOCK -# endif -# if !defined(SWIG_PYTHON_THREAD_END_BLOCK) -# define SWIG_PYTHON_THREAD_END_BLOCK -# endif -# if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW) -# define SWIG_PYTHON_THREAD_BEGIN_ALLOW -# endif -# if !defined(SWIG_PYTHON_THREAD_END_ALLOW) -# define SWIG_PYTHON_THREAD_END_ALLOW -# endif -# endif -#else /* No thread support */ -# define SWIG_PYTHON_INITIALIZE_THREADS -# define SWIG_PYTHON_THREAD_BEGIN_BLOCK -# define SWIG_PYTHON_THREAD_END_BLOCK -# define SWIG_PYTHON_THREAD_BEGIN_ALLOW -# define SWIG_PYTHON_THREAD_END_ALLOW -#endif - -/* ----------------------------------------------------------------------------- - * Python API portion that goes into the runtime - * ----------------------------------------------------------------------------- */ - -#ifdef __cplusplus -extern "C" { -#if 0 -} /* cc-mode */ -#endif -#endif - -/* ----------------------------------------------------------------------------- - * Constant declarations - * ----------------------------------------------------------------------------- */ - -/* Constant Types */ -#define SWIG_PY_POINTER 4 -#define SWIG_PY_BINARY 5 - -/* Constant information structure */ -typedef struct swig_const_info { - int type; - char *name; - long lvalue; - double dvalue; - void *pvalue; - swig_type_info **ptype; -} swig_const_info; - -#ifdef __cplusplus -#if 0 -{ /* cc-mode */ -#endif -} -#endif - - -/* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * - * pyrun.swg - * - * This file contains the runtime support for Python modules - * and includes code for managing global variables and pointer - * type checking. - * - * ----------------------------------------------------------------------------- */ - -/* Common SWIG API */ - -/* for raw pointers */ -#define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0) -#define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags) -#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own) -#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(ptr, type, flags) -#define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty) -#define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src) -#define swig_owntype int - -/* for raw packed data */ -#define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) -#define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) - -/* for class or struct pointers */ -#define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags) -#define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags) - -/* for C or C++ function pointers */ -#define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type) -#define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(ptr, type, 0) - -/* for C++ member pointers, ie, member methods */ -#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) -#define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) - - -/* Runtime API */ - -#define SWIG_GetModule(clientdata) SWIG_Python_GetModule() -#define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer) -#define SWIG_NewClientData(obj) PySwigClientData_New(obj) - -#define SWIG_SetErrorObj SWIG_Python_SetErrorObj -#define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg -#define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) -#define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) -#define SWIG_fail goto fail - - -/* Runtime API implementation */ - -/* Error manipulation */ - -SWIGINTERN void -SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) { - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - PyErr_SetObject(errtype, obj); - Py_DECREF(obj); - SWIG_PYTHON_THREAD_END_BLOCK; -} - -SWIGINTERN void -SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) { - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - PyErr_SetString(errtype, (char *) msg); - SWIG_PYTHON_THREAD_END_BLOCK; -} - -#define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj) - -/* Set a constant value */ - -SWIGINTERN void -SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { - PyDict_SetItemString(d, (char*) name, obj); - Py_DECREF(obj); -} - -/* Append a value to the result obj */ - -SWIGINTERN PyObject* -SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) { -#if !defined(SWIG_PYTHON_OUTPUT_TUPLE) - if (!result) { - result = obj; - } else if (result == Py_None) { - Py_DECREF(result); - result = obj; - } else { - if (!PyList_Check(result)) { - PyObject *o2 = result; - result = PyList_New(1); - PyList_SetItem(result, 0, o2); - } - PyList_Append(result,obj); - Py_DECREF(obj); - } - return result; -#else - PyObject* o2; - PyObject* o3; - if (!result) { - result = obj; - } else if (result == Py_None) { - Py_DECREF(result); - result = obj; - } else { - if (!PyTuple_Check(result)) { - o2 = result; - result = PyTuple_New(1); - PyTuple_SET_ITEM(result, 0, o2); - } - o3 = PyTuple_New(1); - PyTuple_SET_ITEM(o3, 0, obj); - o2 = result; - result = PySequence_Concat(o2, o3); - Py_DECREF(o2); - Py_DECREF(o3); - } - return result; -#endif -} - -/* Unpack the argument tuple */ - -SWIGINTERN int -SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs) -{ - if (!args) { - if (!min && !max) { - return 1; - } else { - PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", - name, (min == max ? "" : "at least "), (int)min); - return 0; - } - } - if (!PyTuple_Check(args)) { - PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple"); - return 0; - } else { - register Py_ssize_t l = PyTuple_GET_SIZE(args); - if (l < min) { - PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", - name, (min == max ? "" : "at least "), (int)min, (int)l); - return 0; - } else if (l > max) { - PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", - name, (min == max ? "" : "at most "), (int)max, (int)l); - return 0; - } else { - register int i; - for (i = 0; i < l; ++i) { - objs[i] = PyTuple_GET_ITEM(args, i); - } - for (; l < max; ++l) { - objs[l] = 0; - } - return i + 1; - } - } -} - -/* A functor is a function object with one single object argument */ -#if PY_VERSION_HEX >= 0x02020000 -#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL); -#else -#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunction(functor, "O", obj); -#endif - -/* - Helper for static pointer initialization for both C and C++ code, for example - static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...); -*/ -#ifdef __cplusplus -#define SWIG_STATIC_POINTER(var) var -#else -#define SWIG_STATIC_POINTER(var) var = 0; if (!var) var -#endif - -/* ----------------------------------------------------------------------------- - * Pointer declarations - * ----------------------------------------------------------------------------- */ - -/* Flags for new pointer objects */ -#define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1) -#define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN) - -#define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1) - -#ifdef __cplusplus -extern "C" { -#if 0 -} /* cc-mode */ -#endif -#endif - -/* How to access Py_None */ -#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) -# ifndef SWIG_PYTHON_NO_BUILD_NONE -# ifndef SWIG_PYTHON_BUILD_NONE -# define SWIG_PYTHON_BUILD_NONE -# endif -# endif -#endif - -#ifdef SWIG_PYTHON_BUILD_NONE -# ifdef Py_None -# undef Py_None -# define Py_None SWIG_Py_None() -# endif -SWIGRUNTIMEINLINE PyObject * -_SWIG_Py_None(void) -{ - PyObject *none = Py_BuildValue((char*)""); - Py_DECREF(none); - return none; -} -SWIGRUNTIME PyObject * -SWIG_Py_None(void) -{ - static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None(); - return none; -} -#endif - -/* The python void return value */ - -SWIGRUNTIMEINLINE PyObject * -SWIG_Py_Void(void) -{ - PyObject *none = Py_None; - Py_INCREF(none); - return none; -} - -/* PySwigClientData */ - -typedef struct { - PyObject *klass; - PyObject *newraw; - PyObject *newargs; - PyObject *destroy; - int delargs; - int implicitconv; -} PySwigClientData; - -SWIGRUNTIMEINLINE int -SWIG_Python_CheckImplicit(swig_type_info *ty) -{ - PySwigClientData *data = (PySwigClientData *)ty->clientdata; - return data ? data->implicitconv : 0; -} - -SWIGRUNTIMEINLINE PyObject * -SWIG_Python_ExceptionType(swig_type_info *desc) { - PySwigClientData *data = desc ? (PySwigClientData *) desc->clientdata : 0; - PyObject *klass = data ? data->klass : 0; - return (klass ? klass : PyExc_RuntimeError); -} - - -SWIGRUNTIME PySwigClientData * -PySwigClientData_New(PyObject* obj) -{ - if (!obj) { - return 0; - } else { - PySwigClientData *data = (PySwigClientData *)malloc(sizeof(PySwigClientData)); - /* the klass element */ - data->klass = obj; - Py_INCREF(data->klass); - /* the newraw method and newargs arguments used to create a new raw instance */ - if (PyClass_Check(obj)) { - data->newraw = 0; - data->newargs = obj; - Py_INCREF(obj); - } else { -#if (PY_VERSION_HEX < 0x02020000) - data->newraw = 0; -#else - data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__"); -#endif - if (data->newraw) { - Py_INCREF(data->newraw); - data->newargs = PyTuple_New(1); - PyTuple_SetItem(data->newargs, 0, obj); - } else { - data->newargs = obj; - } - Py_INCREF(data->newargs); - } - /* the destroy method, aka as the C++ delete method */ - data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__"); - if (PyErr_Occurred()) { - PyErr_Clear(); - data->destroy = 0; - } - if (data->destroy) { - int flags; - Py_INCREF(data->destroy); - flags = PyCFunction_GET_FLAGS(data->destroy); -#ifdef METH_O - data->delargs = !(flags & (METH_O)); -#else - data->delargs = 0; -#endif - } else { - data->delargs = 0; - } - data->implicitconv = 0; - return data; - } -} - -SWIGRUNTIME void -PySwigClientData_Del(PySwigClientData* data) -{ - Py_XDECREF(data->newraw); - Py_XDECREF(data->newargs); - Py_XDECREF(data->destroy); -} - -/* =============== PySwigObject =====================*/ - -typedef struct { - PyObject_HEAD - void *ptr; - swig_type_info *ty; - int own; - PyObject *next; -} PySwigObject; - -SWIGRUNTIME PyObject * -PySwigObject_long(PySwigObject *v) -{ - return PyLong_FromVoidPtr(v->ptr); -} - -SWIGRUNTIME PyObject * -PySwigObject_format(const char* fmt, PySwigObject *v) -{ - PyObject *res = NULL; - PyObject *args = PyTuple_New(1); - if (args) { - if (PyTuple_SetItem(args, 0, PySwigObject_long(v)) == 0) { - PyObject *ofmt = PyString_FromString(fmt); - if (ofmt) { - res = PyString_Format(ofmt,args); - Py_DECREF(ofmt); - } - Py_DECREF(args); - } - } - return res; -} - -SWIGRUNTIME PyObject * -PySwigObject_oct(PySwigObject *v) -{ - return PySwigObject_format("%o",v); -} - -SWIGRUNTIME PyObject * -PySwigObject_hex(PySwigObject *v) -{ - return PySwigObject_format("%x",v); -} - -SWIGRUNTIME PyObject * -#ifdef METH_NOARGS -PySwigObject_repr(PySwigObject *v) -#else -PySwigObject_repr(PySwigObject *v, PyObject *args) -#endif -{ - const char *name = SWIG_TypePrettyName(v->ty); - PyObject *hex = PySwigObject_hex(v); - PyObject *repr = PyString_FromFormat("", name, PyString_AsString(hex)); - Py_DECREF(hex); - if (v->next) { -#ifdef METH_NOARGS - PyObject *nrep = PySwigObject_repr((PySwigObject *)v->next); -#else - PyObject *nrep = PySwigObject_repr((PySwigObject *)v->next, args); -#endif - PyString_ConcatAndDel(&repr,nrep); - } - return repr; -} - -SWIGRUNTIME int -PySwigObject_print(PySwigObject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) -{ -#ifdef METH_NOARGS - PyObject *repr = PySwigObject_repr(v); -#else - PyObject *repr = PySwigObject_repr(v, NULL); -#endif - if (repr) { - fputs(PyString_AsString(repr), fp); - Py_DECREF(repr); - return 0; - } else { - return 1; - } -} - -SWIGRUNTIME PyObject * -PySwigObject_str(PySwigObject *v) -{ - char result[SWIG_BUFFER_SIZE]; - return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ? - PyString_FromString(result) : 0; -} - -SWIGRUNTIME int -PySwigObject_compare(PySwigObject *v, PySwigObject *w) -{ - void *i = v->ptr; - void *j = w->ptr; - return (i < j) ? -1 : ((i > j) ? 1 : 0); -} - -SWIGRUNTIME PyTypeObject* _PySwigObject_type(void); - -SWIGRUNTIME PyTypeObject* -PySwigObject_type(void) { - static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigObject_type(); - return type; -} - -SWIGRUNTIMEINLINE int -PySwigObject_Check(PyObject *op) { - return ((op)->ob_type == PySwigObject_type()) - || (strcmp((op)->ob_type->tp_name,"PySwigObject") == 0); -} - -SWIGRUNTIME PyObject * -PySwigObject_New(void *ptr, swig_type_info *ty, int own); - -SWIGRUNTIME void -PySwigObject_dealloc(PyObject *v) -{ - PySwigObject *sobj = (PySwigObject *) v; - PyObject *next = sobj->next; - if (sobj->own) { - swig_type_info *ty = sobj->ty; - PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0; - PyObject *destroy = data ? data->destroy : 0; - if (destroy) { - /* destroy is always a VARARGS method */ - PyObject *res; - if (data->delargs) { - /* we need to create a temporal object to carry the destroy operation */ - PyObject *tmp = PySwigObject_New(sobj->ptr, ty, 0); - res = SWIG_Python_CallFunctor(destroy, tmp); - Py_DECREF(tmp); - } else { - PyCFunction meth = PyCFunction_GET_FUNCTION(destroy); - PyObject *mself = PyCFunction_GET_SELF(destroy); - 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 - } - } - Py_XDECREF(next); - PyObject_DEL(v); -} - -SWIGRUNTIME PyObject* -PySwigObject_append(PyObject* v, PyObject* next) -{ - PySwigObject *sobj = (PySwigObject *) v; -#ifndef METH_O - PyObject *tmp = 0; - if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL; - next = tmp; -#endif - if (!PySwigObject_Check(next)) { - return NULL; - } - sobj->next = next; - Py_INCREF(next); - return SWIG_Py_Void(); -} - -SWIGRUNTIME PyObject* -#ifdef METH_NOARGS -PySwigObject_next(PyObject* v) -#else -PySwigObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) -#endif -{ - PySwigObject *sobj = (PySwigObject *) v; - if (sobj->next) { - Py_INCREF(sobj->next); - return sobj->next; - } else { - return SWIG_Py_Void(); - } -} - -SWIGINTERN PyObject* -#ifdef METH_NOARGS -PySwigObject_disown(PyObject *v) -#else -PySwigObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) -#endif -{ - PySwigObject *sobj = (PySwigObject *)v; - sobj->own = 0; - return SWIG_Py_Void(); -} - -SWIGINTERN PyObject* -#ifdef METH_NOARGS -PySwigObject_acquire(PyObject *v) -#else -PySwigObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) -#endif -{ - PySwigObject *sobj = (PySwigObject *)v; - sobj->own = SWIG_POINTER_OWN; - return SWIG_Py_Void(); -} - -SWIGINTERN PyObject* -PySwigObject_own(PyObject *v, PyObject *args) -{ - PyObject *val = 0; -#if (PY_VERSION_HEX < 0x02020000) - if (!PyArg_ParseTuple(args,(char *)"|O:own",&val)) -#else - if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val)) -#endif - { - return NULL; - } - else - { - PySwigObject *sobj = (PySwigObject *)v; - PyObject *obj = PyBool_FromLong(sobj->own); - if (val) { -#ifdef METH_NOARGS - if (PyObject_IsTrue(val)) { - PySwigObject_acquire(v); - } else { - PySwigObject_disown(v); - } -#else - if (PyObject_IsTrue(val)) { - PySwigObject_acquire(v,args); - } else { - PySwigObject_disown(v,args); - } -#endif - } - return obj; - } -} - -#ifdef METH_O -static PyMethodDef -swigobject_methods[] = { - {(char *)"disown", (PyCFunction)PySwigObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"}, - {(char *)"acquire", (PyCFunction)PySwigObject_acquire, METH_NOARGS, (char *)"aquires ownership of the pointer"}, - {(char *)"own", (PyCFunction)PySwigObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, - {(char *)"append", (PyCFunction)PySwigObject_append, METH_O, (char *)"appends another 'this' object"}, - {(char *)"next", (PyCFunction)PySwigObject_next, METH_NOARGS, (char *)"returns the next 'this' object"}, - {(char *)"__repr__",(PyCFunction)PySwigObject_repr, METH_NOARGS, (char *)"returns object representation"}, - {0, 0, 0, 0} -}; -#else -static PyMethodDef -swigobject_methods[] = { - {(char *)"disown", (PyCFunction)PySwigObject_disown, METH_VARARGS, (char *)"releases ownership of the pointer"}, - {(char *)"acquire", (PyCFunction)PySwigObject_acquire, METH_VARARGS, (char *)"aquires ownership of the pointer"}, - {(char *)"own", (PyCFunction)PySwigObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, - {(char *)"append", (PyCFunction)PySwigObject_append, METH_VARARGS, (char *)"appends another 'this' object"}, - {(char *)"next", (PyCFunction)PySwigObject_next, METH_VARARGS, (char *)"returns the next 'this' object"}, - {(char *)"__repr__",(PyCFunction)PySwigObject_repr, METH_VARARGS, (char *)"returns object representation"}, - {0, 0, 0, 0} -}; -#endif - -#if PY_VERSION_HEX < 0x02020000 -SWIGINTERN PyObject * -PySwigObject_getattr(PySwigObject *sobj,char *name) -{ - return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name); -} -#endif - -SWIGRUNTIME PyTypeObject* -_PySwigObject_type(void) { - static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer"; - - static PyNumberMethods PySwigObject_as_number = { - (binaryfunc)0, /*nb_add*/ - (binaryfunc)0, /*nb_subtract*/ - (binaryfunc)0, /*nb_multiply*/ - (binaryfunc)0, /*nb_divide*/ - (binaryfunc)0, /*nb_remainder*/ - (binaryfunc)0, /*nb_divmod*/ - (ternaryfunc)0,/*nb_power*/ - (unaryfunc)0, /*nb_negative*/ - (unaryfunc)0, /*nb_positive*/ - (unaryfunc)0, /*nb_absolute*/ - (inquiry)0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - (coercion)0, /*nb_coerce*/ - (unaryfunc)PySwigObject_long, /*nb_int*/ - (unaryfunc)PySwigObject_long, /*nb_long*/ - (unaryfunc)0, /*nb_float*/ - (unaryfunc)PySwigObject_oct, /*nb_oct*/ - (unaryfunc)PySwigObject_hex, /*nb_hex*/ -#if PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */ -#elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */ -#elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */ - 0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */ -#endif - }; - - static PyTypeObject pyswigobject_type; - static int type_init = 0; - if (!type_init) { - const PyTypeObject tmp - = { - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ - (char *)"PySwigObject", /* tp_name */ - sizeof(PySwigObject), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)PySwigObject_dealloc, /* tp_dealloc */ - (printfunc)PySwigObject_print, /* tp_print */ -#if PY_VERSION_HEX < 0x02020000 - (getattrfunc)PySwigObject_getattr, /* tp_getattr */ -#else - (getattrfunc)0, /* tp_getattr */ -#endif - (setattrfunc)0, /* tp_setattr */ - (cmpfunc)PySwigObject_compare, /* tp_compare */ - (reprfunc)PySwigObject_repr, /* tp_repr */ - &PySwigObject_as_number, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - (hashfunc)0, /* tp_hash */ - (ternaryfunc)0, /* tp_call */ - (reprfunc)PySwigObject_str, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - swigobject_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ -#if PY_VERSION_HEX >= 0x02020000 - 0, /* tp_iter */ - 0, /* tp_iternext */ - swigobject_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ - 0, /* tp_free */ - 0, /* tp_is_gc */ - 0, /* tp_bases */ - 0, /* tp_mro */ - 0, /* tp_cache */ - 0, /* tp_subclasses */ - 0, /* tp_weaklist */ -#endif -#if PY_VERSION_HEX >= 0x02030000 - 0, /* tp_del */ -#endif -#ifdef COUNT_ALLOCS - 0,0,0,0 /* tp_alloc -> tp_next */ -#endif - }; - pyswigobject_type = tmp; - pyswigobject_type.ob_type = &PyType_Type; - type_init = 1; - } - return &pyswigobject_type; -} - -SWIGRUNTIME PyObject * -PySwigObject_New(void *ptr, swig_type_info *ty, int own) -{ - PySwigObject *sobj = PyObject_NEW(PySwigObject, PySwigObject_type()); - if (sobj) { - sobj->ptr = ptr; - sobj->ty = ty; - sobj->own = own; - sobj->next = 0; - } - return (PyObject *)sobj; -} - -/* ----------------------------------------------------------------------------- - * Implements a simple Swig Packed type, and use it instead of string - * ----------------------------------------------------------------------------- */ - -typedef struct { - PyObject_HEAD - void *pack; - swig_type_info *ty; - size_t size; -} PySwigPacked; - -SWIGRUNTIME int -PySwigPacked_print(PySwigPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags)) -{ - char result[SWIG_BUFFER_SIZE]; - fputs("pack, v->size, 0, sizeof(result))) { - fputs("at ", fp); - fputs(result, fp); - } - fputs(v->ty->name,fp); - fputs(">", fp); - return 0; -} - -SWIGRUNTIME PyObject * -PySwigPacked_repr(PySwigPacked *v) -{ - char result[SWIG_BUFFER_SIZE]; - if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) { - return PyString_FromFormat("", result, v->ty->name); - } else { - return PyString_FromFormat("", v->ty->name); - } -} - -SWIGRUNTIME PyObject * -PySwigPacked_str(PySwigPacked *v) -{ - char result[SWIG_BUFFER_SIZE]; - if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){ - return PyString_FromFormat("%s%s", result, v->ty->name); - } else { - return PyString_FromString(v->ty->name); - } -} - -SWIGRUNTIME int -PySwigPacked_compare(PySwigPacked *v, PySwigPacked *w) -{ - size_t i = v->size; - size_t j = w->size; - int s = (i < j) ? -1 : ((i > j) ? 1 : 0); - return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size); -} - -SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void); - -SWIGRUNTIME PyTypeObject* -PySwigPacked_type(void) { - static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigPacked_type(); - return type; -} - -SWIGRUNTIMEINLINE int -PySwigPacked_Check(PyObject *op) { - return ((op)->ob_type == _PySwigPacked_type()) - || (strcmp((op)->ob_type->tp_name,"PySwigPacked") == 0); -} - -SWIGRUNTIME void -PySwigPacked_dealloc(PyObject *v) -{ - if (PySwigPacked_Check(v)) { - PySwigPacked *sobj = (PySwigPacked *) v; - free(sobj->pack); - } - PyObject_DEL(v); -} - -SWIGRUNTIME PyTypeObject* -_PySwigPacked_type(void) { - static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer"; - static PyTypeObject pyswigpacked_type; - static int type_init = 0; - if (!type_init) { - const PyTypeObject tmp - = { - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ - (char *)"PySwigPacked", /* tp_name */ - sizeof(PySwigPacked), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)PySwigPacked_dealloc, /* tp_dealloc */ - (printfunc)PySwigPacked_print, /* tp_print */ - (getattrfunc)0, /* tp_getattr */ - (setattrfunc)0, /* tp_setattr */ - (cmpfunc)PySwigPacked_compare, /* tp_compare */ - (reprfunc)PySwigPacked_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - (hashfunc)0, /* tp_hash */ - (ternaryfunc)0, /* tp_call */ - (reprfunc)PySwigPacked_str, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - swigpacked_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ -#if PY_VERSION_HEX >= 0x02020000 - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ - 0, /* tp_free */ - 0, /* tp_is_gc */ - 0, /* tp_bases */ - 0, /* tp_mro */ - 0, /* tp_cache */ - 0, /* tp_subclasses */ - 0, /* tp_weaklist */ -#endif -#if PY_VERSION_HEX >= 0x02030000 - 0, /* tp_del */ -#endif -#ifdef COUNT_ALLOCS - 0,0,0,0 /* tp_alloc -> tp_next */ -#endif - }; - pyswigpacked_type = tmp; - pyswigpacked_type.ob_type = &PyType_Type; - type_init = 1; - } - return &pyswigpacked_type; -} - -SWIGRUNTIME PyObject * -PySwigPacked_New(void *ptr, size_t size, swig_type_info *ty) -{ - PySwigPacked *sobj = PyObject_NEW(PySwigPacked, PySwigPacked_type()); - if (sobj) { - void *pack = malloc(size); - if (pack) { - memcpy(pack, ptr, size); - sobj->pack = pack; - sobj->ty = ty; - sobj->size = size; - } else { - PyObject_DEL((PyObject *) sobj); - sobj = 0; - } - } - return (PyObject *) sobj; -} - -SWIGRUNTIME swig_type_info * -PySwigPacked_UnpackData(PyObject *obj, void *ptr, size_t size) -{ - if (PySwigPacked_Check(obj)) { - PySwigPacked *sobj = (PySwigPacked *)obj; - if (sobj->size != size) return 0; - memcpy(ptr, sobj->pack, size); - return sobj->ty; - } else { - return 0; - } -} - -/* ----------------------------------------------------------------------------- - * pointers/data manipulation - * ----------------------------------------------------------------------------- */ - -SWIGRUNTIMEINLINE PyObject * -_SWIG_This(void) -{ - return PyString_FromString("this"); -} - -SWIGRUNTIME PyObject * -SWIG_This(void) -{ - static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This(); - return swig_this; -} - -/* #define SWIG_PYTHON_SLOW_GETSET_THIS */ - -SWIGRUNTIME PySwigObject * -SWIG_Python_GetSwigThis(PyObject *pyobj) -{ - if (PySwigObject_Check(pyobj)) { - return (PySwigObject *) pyobj; - } else { - PyObject *obj = 0; -#if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000)) - if (PyInstance_Check(pyobj)) { - obj = _PyInstance_Lookup(pyobj, SWIG_This()); - } else { - PyObject **dictptr = _PyObject_GetDictPtr(pyobj); - if (dictptr != NULL) { - PyObject *dict = *dictptr; - obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0; - } else { -#ifdef PyWeakref_CheckProxy - if (PyWeakref_CheckProxy(pyobj)) { - PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); - return wobj ? SWIG_Python_GetSwigThis(wobj) : 0; - } -#endif - obj = PyObject_GetAttr(pyobj,SWIG_This()); - if (obj) { - Py_DECREF(obj); - } else { - if (PyErr_Occurred()) PyErr_Clear(); - return 0; - } - } - } -#else - obj = PyObject_GetAttr(pyobj,SWIG_This()); - if (obj) { - Py_DECREF(obj); - } else { - if (PyErr_Occurred()) PyErr_Clear(); - return 0; - } -#endif - if (obj && !PySwigObject_Check(obj)) { - /* a PyObject is called 'this', try to get the 'real this' - PySwigObject from it */ - return SWIG_Python_GetSwigThis(obj); - } - return (PySwigObject *)obj; - } -} - -/* Acquire a pointer value */ - -SWIGRUNTIME int -SWIG_Python_AcquirePtr(PyObject *obj, int own) { - if (own) { - PySwigObject *sobj = SWIG_Python_GetSwigThis(obj); - if (sobj) { - int oldown = sobj->own; - sobj->own = own; - return oldown; - } - } - return 0; -} - -/* Convert a pointer value */ - -SWIGRUNTIME int -SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) { - if (!obj) return SWIG_ERROR; - if (obj == Py_None) { - if (ptr) *ptr = 0; - return SWIG_OK; - } else { - PySwigObject *sobj = SWIG_Python_GetSwigThis(obj); - while (sobj) { - void *vptr = sobj->ptr; - if (ty) { - swig_type_info *to = sobj->ty; - if (to == ty) { - /* no type cast needed */ - if (ptr) *ptr = vptr; - break; - } else { - swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); - if (!tc) { - sobj = (PySwigObject *)sobj->next; - } else { - if (ptr) *ptr = SWIG_TypeCast(tc,vptr); - break; - } - } - } else { - if (ptr) *ptr = vptr; - break; - } - } - if (sobj) { - if (own) *own = sobj->own; - if (flags & SWIG_POINTER_DISOWN) { - sobj->own = 0; - } - return SWIG_OK; - } else { - int res = SWIG_ERROR; - if (flags & SWIG_POINTER_IMPLICIT_CONV) { - PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0; - if (data && !data->implicitconv) { - PyObject *klass = data->klass; - if (klass) { - PyObject *impconv; - data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/ - impconv = SWIG_Python_CallFunctor(klass, obj); - data->implicitconv = 0; - if (PyErr_Occurred()) { - PyErr_Clear(); - impconv = 0; - } - if (impconv) { - PySwigObject *iobj = SWIG_Python_GetSwigThis(impconv); - if (iobj) { - void *vptr; - res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0); - if (SWIG_IsOK(res)) { - if (ptr) { - *ptr = vptr; - /* transfer the ownership to 'ptr' */ - iobj->own = 0; - res = SWIG_AddCast(res); - res = SWIG_AddNewMask(res); - } else { - res = SWIG_AddCast(res); - } - } - } - Py_DECREF(impconv); - } - } - } - } - return res; - } - } -} - -/* Convert a function ptr value */ - -SWIGRUNTIME int -SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) { - if (!PyCFunction_Check(obj)) { - return SWIG_ConvertPtr(obj, ptr, ty, 0); - } else { - void *vptr = 0; - - /* here we get the method pointer for callbacks */ - const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc); - const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0; - if (desc) { - desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0; - if (!desc) return SWIG_ERROR; - } - if (ty) { - swig_cast_info *tc = SWIG_TypeCheck(desc,ty); - if (!tc) return SWIG_ERROR; - *ptr = SWIG_TypeCast(tc,vptr); - } else { - *ptr = vptr; - } - return SWIG_OK; - } -} - -/* Convert a packed value value */ - -SWIGRUNTIME int -SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) { - swig_type_info *to = PySwigPacked_UnpackData(obj, ptr, sz); - if (!to) return SWIG_ERROR; - if (ty) { - if (to != ty) { - /* check type cast? */ - swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); - if (!tc) return SWIG_ERROR; - } - } - return SWIG_OK; -} - -/* ----------------------------------------------------------------------------- - * Create a new pointer object - * ----------------------------------------------------------------------------- */ - -/* - Create a new instance object, whitout calling __init__, and set the - 'this' attribute. -*/ - -SWIGRUNTIME PyObject* -SWIG_Python_NewShadowInstance(PySwigClientData *data, PyObject *swig_this) -{ -#if (PY_VERSION_HEX >= 0x02020000) - PyObject *inst = 0; - PyObject *newraw = data->newraw; - if (newraw) { - inst = PyObject_Call(newraw, data->newargs, NULL); - if (inst) { -#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS) - PyObject **dictptr = _PyObject_GetDictPtr(inst); - if (dictptr != NULL) { - PyObject *dict = *dictptr; - if (dict == NULL) { - dict = PyDict_New(); - *dictptr = dict; - PyDict_SetItem(dict, SWIG_This(), swig_this); - } - } -#else - PyObject *key = SWIG_This(); - PyObject_SetAttr(inst, key, swig_this); -#endif - } - } else { - PyObject *dict = PyDict_New(); - PyDict_SetItem(dict, SWIG_This(), swig_this); - inst = PyInstance_NewRaw(data->newargs, dict); - Py_DECREF(dict); - } - return inst; -#else -#if (PY_VERSION_HEX >= 0x02010000) - PyObject *inst; - PyObject *dict = PyDict_New(); - PyDict_SetItem(dict, SWIG_This(), swig_this); - inst = PyInstance_NewRaw(data->newargs, dict); - Py_DECREF(dict); - return (PyObject *) inst; -#else - PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type); - if (inst == NULL) { - return NULL; - } - inst->in_class = (PyClassObject *)data->newargs; - Py_INCREF(inst->in_class); - inst->in_dict = PyDict_New(); - if (inst->in_dict == NULL) { - Py_DECREF(inst); - return NULL; - } -#ifdef Py_TPFLAGS_HAVE_WEAKREFS - inst->in_weakreflist = NULL; -#endif -#ifdef Py_TPFLAGS_GC - PyObject_GC_Init(inst); -#endif - PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this); - return (PyObject *) inst; -#endif -#endif -} - -SWIGRUNTIME void -SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this) -{ - PyObject *dict; -#if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS) - PyObject **dictptr = _PyObject_GetDictPtr(inst); - if (dictptr != NULL) { - dict = *dictptr; - if (dict == NULL) { - dict = PyDict_New(); - *dictptr = dict; - } - PyDict_SetItem(dict, SWIG_This(), swig_this); - return; - } -#endif - dict = PyObject_GetAttrString(inst, (char*)"__dict__"); - PyDict_SetItem(dict, SWIG_This(), swig_this); - Py_DECREF(dict); -} - - -SWIGINTERN PyObject * -SWIG_Python_InitShadowInstance(PyObject *args) { - PyObject *obj[2]; - if (!SWIG_Python_UnpackTuple(args,(char*)"swiginit", 2, 2, obj)) { - return NULL; - } else { - PySwigObject *sthis = SWIG_Python_GetSwigThis(obj[0]); - if (sthis) { - PySwigObject_append((PyObject*) sthis, obj[1]); - } else { - SWIG_Python_SetSwigThis(obj[0], obj[1]); - } - return SWIG_Py_Void(); - } -} - -/* Create a new pointer object */ - -SWIGRUNTIME PyObject * -SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int flags) { - if (!ptr) { - return SWIG_Py_Void(); - } else { - int own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0; - PyObject *robj = PySwigObject_New(ptr, type, own); - PySwigClientData *clientdata = type ? (PySwigClientData *)(type->clientdata) : 0; - if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) { - PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj); - if (inst) { - Py_DECREF(robj); - robj = inst; - } - } - return robj; - } -} - -/* Create a new packed object */ - -SWIGRUNTIMEINLINE PyObject * -SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) { - return ptr ? PySwigPacked_New((void *) ptr, sz, type) : SWIG_Py_Void(); -} - -/* -----------------------------------------------------------------------------* - * Get type list - * -----------------------------------------------------------------------------*/ - -#ifdef SWIG_LINK_RUNTIME -void *SWIG_ReturnGlobalTypeList(void *); -#endif - -SWIGRUNTIME swig_module_info * -SWIG_Python_GetModule(void) { - static void *type_pointer = (void *)0; - /* first check if module already created */ - if (!type_pointer) { -#ifdef SWIG_LINK_RUNTIME - type_pointer = SWIG_ReturnGlobalTypeList((void *)0); -#else - type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, - (char*)"type_pointer" SWIG_TYPE_TABLE_NAME); - if (PyErr_Occurred()) { - PyErr_Clear(); - type_pointer = (void *)0; - } -#endif - } - return (swig_module_info *) type_pointer; -} - -#if PY_MAJOR_VERSION < 2 -/* PyModule_AddObject function was introduced in Python 2.0. The following function - is copied out of Python/modsupport.c in python version 2.3.4 */ -SWIGINTERN int -PyModule_AddObject(PyObject *m, char *name, PyObject *o) -{ - PyObject *dict; - if (!PyModule_Check(m)) { - PyErr_SetString(PyExc_TypeError, - "PyModule_AddObject() needs module as first arg"); - return SWIG_ERROR; - } - if (!o) { - PyErr_SetString(PyExc_TypeError, - "PyModule_AddObject() needs non-NULL value"); - return SWIG_ERROR; - } - - dict = PyModule_GetDict(m); - if (dict == NULL) { - /* Internal error -- modules must have a dict! */ - PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__", - PyModule_GetName(m)); - return SWIG_ERROR; - } - if (PyDict_SetItemString(dict, name, o)) - return SWIG_ERROR; - Py_DECREF(o); - return SWIG_OK; -} -#endif - -SWIGRUNTIME void -SWIG_Python_DestroyModule(void *vptr) -{ - swig_module_info *swig_module = (swig_module_info *) vptr; - swig_type_info **types = swig_module->types; - size_t i; - for (i =0; i < swig_module->size; ++i) { - swig_type_info *ty = types[i]; - if (ty->owndata) { - PySwigClientData *data = (PySwigClientData *) ty->clientdata; - if (data) PySwigClientData_Del(data); - } - } - Py_DECREF(SWIG_This()); -} - -SWIGRUNTIME void -SWIG_Python_SetModule(swig_module_info *swig_module) { - static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };/* Sentinel */ - - PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, - swig_empty_runtime_method_table); - PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule); - if (pointer && module) { - PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer); - } else { - Py_XDECREF(pointer); - } -} - -/* The python cached type query */ -SWIGRUNTIME PyObject * -SWIG_Python_TypeCache(void) { - static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New(); - return cache; -} - -SWIGRUNTIME swig_type_info * -SWIG_Python_TypeQuery(const char *type) -{ - PyObject *cache = SWIG_Python_TypeCache(); - PyObject *key = PyString_FromString(type); - PyObject *obj = PyDict_GetItem(cache, key); - swig_type_info *descriptor; - if (obj) { - descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj); - } else { - swig_module_info *swig_module = SWIG_Python_GetModule(); - descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); - if (descriptor) { - obj = PyCObject_FromVoidPtr(descriptor, NULL); - PyDict_SetItem(cache, key, obj); - Py_DECREF(obj); - } - } - Py_DECREF(key); - return descriptor; -} - -/* - For backward compatibility only -*/ -#define SWIG_POINTER_EXCEPTION 0 -#define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg) -#define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags) - -SWIGRUNTIME int -SWIG_Python_AddErrMesg(const char* mesg, int infront) -{ - if (PyErr_Occurred()) { - PyObject *type = 0; - PyObject *value = 0; - PyObject *traceback = 0; - PyErr_Fetch(&type, &value, &traceback); - if (value) { - PyObject *old_str = PyObject_Str(value); - Py_XINCREF(type); - PyErr_Clear(); - if (infront) { - PyErr_Format(type, "%s %s", mesg, PyString_AsString(old_str)); - } else { - PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg); - } - Py_DECREF(old_str); - } - return 1; - } else { - return 0; - } -} - -SWIGRUNTIME int -SWIG_Python_ArgFail(int argnum) -{ - if (PyErr_Occurred()) { - /* add information about failing argument */ - char mesg[256]; - PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum); - return SWIG_Python_AddErrMesg(mesg, 1); - } else { - return 0; - } -} - -SWIGRUNTIMEINLINE const char * -PySwigObject_GetDesc(PyObject *self) -{ - PySwigObject *v = (PySwigObject *)self; - swig_type_info *ty = v ? v->ty : 0; - return ty ? ty->str : (char*)""; -} - -SWIGRUNTIME void -SWIG_Python_TypeError(const char *type, PyObject *obj) -{ - if (type) { -#if defined(SWIG_COBJECT_TYPES) - if (obj && PySwigObject_Check(obj)) { - const char *otype = (const char *) PySwigObject_GetDesc(obj); - if (otype) { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'PySwigObject(%s)' is received", - type, otype); - return; - } - } else -#endif - { - const char *otype = (obj ? obj->ob_type->tp_name : 0); - if (otype) { - PyObject *str = PyObject_Str(obj); - const char *cstr = str ? PyString_AsString(str) : 0; - if (cstr) { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", - type, otype, cstr); - } else { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", - type, otype); - } - Py_XDECREF(str); - return; - } - } - PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); - } else { - PyErr_Format(PyExc_TypeError, "unexpected type is received"); - } -} - - -/* Convert a pointer value, signal an exception on a type mismatch */ -SWIGRUNTIME void * -SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) { - void *result; - if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) { - PyErr_Clear(); - if (flags & SWIG_POINTER_EXCEPTION) { - SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj); - SWIG_Python_ArgFail(argnum); - } - } - return result; -} - - -#ifdef __cplusplus -#if 0 -{ /* cc-mode */ -#endif -} -#endif - - - -#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) - -#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else - - - -/* -------- TYPES TABLE (BEGIN) -------- */ - -#define SWIGTYPE_p_TALLOC_CTX swig_types[0] -#define SWIGTYPE_p_char swig_types[1] -#define SWIGTYPE_p_cli_credentials swig_types[2] -#define SWIGTYPE_p_event_context swig_types[3] -#define SWIGTYPE_p_int swig_types[4] -#define SWIGTYPE_p_ldb_context swig_types[5] -#define SWIGTYPE_p_libnet_AddShare swig_types[6] -#define SWIGTYPE_p_libnet_BecomeDC swig_types[7] -#define SWIGTYPE_p_libnet_ChangePassword swig_types[8] -#define SWIGTYPE_p_libnet_CreateUser swig_types[9] -#define SWIGTYPE_p_libnet_DelShare swig_types[10] -#define SWIGTYPE_p_libnet_DeleteUser swig_types[11] -#define SWIGTYPE_p_libnet_DomainClose swig_types[12] -#define SWIGTYPE_p_libnet_DomainList swig_types[13] -#define SWIGTYPE_p_libnet_DomainOpen swig_types[14] -#define SWIGTYPE_p_libnet_GroupInfo swig_types[15] -#define SWIGTYPE_p_libnet_GroupList swig_types[16] -#define SWIGTYPE_p_libnet_Join swig_types[17] -#define SWIGTYPE_p_libnet_JoinDomain swig_types[18] -#define SWIGTYPE_p_libnet_ListShares swig_types[19] -#define SWIGTYPE_p_libnet_Lookup swig_types[20] -#define SWIGTYPE_p_libnet_LookupDCs swig_types[21] -#define SWIGTYPE_p_libnet_LookupName swig_types[22] -#define SWIGTYPE_p_libnet_ModifyUser swig_types[23] -#define SWIGTYPE_p_libnet_RemoteTOD swig_types[24] -#define SWIGTYPE_p_libnet_RpcConnect swig_types[25] -#define SWIGTYPE_p_libnet_SamDump swig_types[26] -#define SWIGTYPE_p_libnet_SamDump_keytab swig_types[27] -#define SWIGTYPE_p_libnet_SamSync swig_types[28] -#define SWIGTYPE_p_libnet_SetPassword swig_types[29] -#define SWIGTYPE_p_libnet_UnbecomeDC swig_types[30] -#define SWIGTYPE_p_libnet_UserInfo swig_types[31] -#define SWIGTYPE_p_libnet_UserList swig_types[32] -#define SWIGTYPE_p_libnet_context swig_types[33] -#define SWIGTYPE_p_libnet_samsync_ldb swig_types[34] -#define SWIGTYPE_p_loadparm_context swig_types[35] -#define SWIGTYPE_p_loadparm_service swig_types[36] -#define SWIGTYPE_p_long_long swig_types[37] -#define SWIGTYPE_p_param_context swig_types[38] -#define SWIGTYPE_p_param_opt swig_types[39] -#define SWIGTYPE_p_param_section swig_types[40] -#define SWIGTYPE_p_short swig_types[41] -#define SWIGTYPE_p_signed_char swig_types[42] -#define SWIGTYPE_p_unsigned_char swig_types[43] -#define SWIGTYPE_p_unsigned_int swig_types[44] -#define SWIGTYPE_p_unsigned_long_long swig_types[45] -#define SWIGTYPE_p_unsigned_short swig_types[46] -static swig_type_info *swig_types[48]; -static swig_module_info swig_module = {swig_types, 47, 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) - -/* -------- TYPES TABLE (END) -------- */ - -#if (PY_VERSION_HEX <= 0x02000000) -# if !defined(SWIG_PYTHON_CLASSIC) -# error "This python version requires swig to be run with the '-classic' option" -# endif -#endif -#if (PY_VERSION_HEX <= 0x02020000) -# error "This python version requires swig to be run with the '-nomodern' option" -#endif -#if (PY_VERSION_HEX <= 0x02020000) -# error "This python version requires swig to be run with the '-nomodernargs' option" -#endif -#ifndef METH_O -# error "This python version requires swig to be run with the '-nofastunpack' option" -#endif -#ifdef SWIG_TypeQuery -# undef SWIG_TypeQuery -#endif -#define SWIG_TypeQuery SWIG_Python_TypeQuery - -/*----------------------------------------------- - @(target):= _net.so - ------------------------------------------------*/ -#define SWIG_init init_net - -#define SWIG_name "_net" - -#define SWIGVERSION 0x010333 -#define SWIG_VERSION SWIGVERSION - - -#define SWIG_as_voidptr(a) (void *)((const void *)(a)) -#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) - - -#include "includes.h" -#include "libnet/libnet.h" -#include "lib/events/events.h" -#include "param/param.h" -typedef struct libnet_context libnet; - -SWIGINTERN libnet *new_libnet(struct event_context *ev,struct loadparm_context *lp_ctx){ - return libnet_context_init(ev, lp_ctx); - } -#ifdef __cplusplus -extern "C" { -#endif -SWIGINTERN PyObject *_wrap_libnet_cred_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - libnet *arg1 = (libnet *) 0 ; - struct cli_credentials *arg2 = (struct cli_credentials *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args,"libnet_cred_set",2,2,swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_libnet_context, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_cred_set" "', argument " "1"" of type '" "libnet *""'"); - } - arg1 = (libnet *)(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_cli_credentials, SWIG_POINTER_DISOWN | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "libnet_cred_set" "', argument " "2"" of type '" "struct cli_credentials *""'"); - } - arg2 = (struct cli_credentials *)(argp2); - if (arg1) (arg1)->cred = arg2; - - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_libnet_cred_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - libnet *arg1 = (libnet *) 0 ; - struct cli_credentials *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_libnet_context, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_cred_get" "', argument " "1"" of type '" "libnet *""'"); - } - arg1 = (libnet *)(argp1); - result = (struct cli_credentials *) ((arg1)->cred); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_cli_credentials, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_libnet(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { - PyObject *resultobj = 0; - struct event_context *arg1 = (struct event_context *) 0 ; - struct loadparm_context *arg2 = (struct loadparm_context *) 0 ; - libnet *result = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char * kwnames[] = { - (char *) "ev",(char *) "lp_ctx", NULL - }; - - arg1 = event_context_init(NULL); - arg2 = loadparm_init(NULL); - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OO:new_libnet",kwnames,&obj0,&obj1)) SWIG_fail; - if (obj0) { - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_event_context, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_libnet" "', argument " "1"" of type '" "struct event_context *""'"); - } - arg1 = (struct event_context *)(argp1); - } - if (obj1) { - res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_loadparm_context, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_libnet" "', argument " "2"" of type '" "struct loadparm_context *""'"); - } - arg2 = (struct loadparm_context *)(argp2); - } - result = (libnet *)new_libnet(arg1,arg2); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_libnet_context, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_libnet_samsync_ldb(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { - PyObject *resultobj = 0; - libnet *arg1 = (libnet *) 0 ; - TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ; - struct libnet_samsync_ldb *arg3 = (struct libnet_samsync_ldb *) 0 ; - NTSTATUS result; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char * kwnames[] = { - (char *) "self",(char *) "r", NULL - }; - - arg2 = NULL; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_samsync_ldb",kwnames,&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_samsync_ldb" "', argument " "1"" of type '" "libnet *""'"); - } - arg1 = (libnet *)(argp1); - res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_samsync_ldb, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_samsync_ldb" "', argument " "3"" of type '" "struct libnet_samsync_ldb *""'"); - } - arg3 = (struct libnet_samsync_ldb *)(argp3); - result = libnet_samsync_ldb(arg1,arg2,arg3); - if (NT_STATUS_IS_ERR(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); - SWIG_fail; - } else if (resultobj == NULL) { - resultobj = Py_None; - } - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_libnet_DomainList(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { - PyObject *resultobj = 0; - libnet *arg1 = (libnet *) 0 ; - TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ; - struct libnet_DomainList *arg3 = (struct libnet_DomainList *) 0 ; - NTSTATUS result; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char * kwnames[] = { - (char *) "self",(char *) "io", NULL - }; - - arg2 = NULL; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_DomainList",kwnames,&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_DomainList" "', argument " "1"" of type '" "libnet *""'"); - } - arg1 = (libnet *)(argp1); - res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_DomainList, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_DomainList" "', argument " "3"" of type '" "struct libnet_DomainList *""'"); - } - arg3 = (struct libnet_DomainList *)(argp3); - result = libnet_DomainList(arg1,arg2,arg3); - if (NT_STATUS_IS_ERR(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); - SWIG_fail; - } else if (resultobj == NULL) { - resultobj = Py_None; - } - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_libnet_DomainClose(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { - PyObject *resultobj = 0; - libnet *arg1 = (libnet *) 0 ; - TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ; - struct libnet_DomainClose *arg3 = (struct libnet_DomainClose *) 0 ; - NTSTATUS result; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char * kwnames[] = { - (char *) "self",(char *) "io", NULL - }; - - arg2 = NULL; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_DomainClose",kwnames,&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_DomainClose" "', argument " "1"" of type '" "libnet *""'"); - } - arg1 = (libnet *)(argp1); - res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_DomainClose, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_DomainClose" "', argument " "3"" of type '" "struct libnet_DomainClose *""'"); - } - arg3 = (struct libnet_DomainClose *)(argp3); - result = libnet_DomainClose(arg1,arg2,arg3); - if (NT_STATUS_IS_ERR(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); - SWIG_fail; - } else if (resultobj == NULL) { - resultobj = Py_None; - } - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_libnet_DomainOpen(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { - PyObject *resultobj = 0; - libnet *arg1 = (libnet *) 0 ; - TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ; - struct libnet_DomainOpen *arg3 = (struct libnet_DomainOpen *) 0 ; - NTSTATUS result; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char * kwnames[] = { - (char *) "self",(char *) "io", NULL - }; - - arg2 = NULL; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_DomainOpen",kwnames,&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_DomainOpen" "', argument " "1"" of type '" "libnet *""'"); - } - arg1 = (libnet *)(argp1); - res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_DomainOpen, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_DomainOpen" "', argument " "3"" of type '" "struct libnet_DomainOpen *""'"); - } - arg3 = (struct libnet_DomainOpen *)(argp3); - result = libnet_DomainOpen(arg1,arg2,arg3); - if (NT_STATUS_IS_ERR(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); - SWIG_fail; - } else if (resultobj == NULL) { - resultobj = Py_None; - } - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_libnet_LookupName(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { - PyObject *resultobj = 0; - libnet *arg1 = (libnet *) 0 ; - TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ; - struct libnet_LookupName *arg3 = (struct libnet_LookupName *) 0 ; - NTSTATUS result; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char * kwnames[] = { - (char *) "self",(char *) "io", NULL - }; - - arg2 = NULL; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_LookupName",kwnames,&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_LookupName" "', argument " "1"" of type '" "libnet *""'"); - } - arg1 = (libnet *)(argp1); - res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_LookupName, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_LookupName" "', argument " "3"" of type '" "struct libnet_LookupName *""'"); - } - arg3 = (struct libnet_LookupName *)(argp3); - result = libnet_LookupName(arg1,arg2,arg3); - if (NT_STATUS_IS_ERR(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); - SWIG_fail; - } else if (resultobj == NULL) { - resultobj = Py_None; - } - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_libnet_LookupDCs(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { - PyObject *resultobj = 0; - libnet *arg1 = (libnet *) 0 ; - TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ; - struct libnet_LookupDCs *arg3 = (struct libnet_LookupDCs *) 0 ; - NTSTATUS result; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char * kwnames[] = { - (char *) "self",(char *) "io", NULL - }; - - arg2 = NULL; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_LookupDCs",kwnames,&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_LookupDCs" "', argument " "1"" of type '" "libnet *""'"); - } - arg1 = (libnet *)(argp1); - res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_LookupDCs, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_LookupDCs" "', argument " "3"" of type '" "struct libnet_LookupDCs *""'"); - } - arg3 = (struct libnet_LookupDCs *)(argp3); - result = libnet_LookupDCs(arg1,arg2,arg3); - if (NT_STATUS_IS_ERR(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); - SWIG_fail; - } else if (resultobj == NULL) { - resultobj = Py_None; - } - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_libnet_LookupHost(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { - PyObject *resultobj = 0; - libnet *arg1 = (libnet *) 0 ; - TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ; - struct libnet_Lookup *arg3 = (struct libnet_Lookup *) 0 ; - NTSTATUS result; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char * kwnames[] = { - (char *) "self",(char *) "io", NULL - }; - - arg2 = NULL; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_LookupHost",kwnames,&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_LookupHost" "', argument " "1"" of type '" "libnet *""'"); - } - arg1 = (libnet *)(argp1); - res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_Lookup, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_LookupHost" "', argument " "3"" of type '" "struct libnet_Lookup *""'"); - } - arg3 = (struct libnet_Lookup *)(argp3); - result = libnet_LookupHost(arg1,arg2,arg3); - if (NT_STATUS_IS_ERR(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); - SWIG_fail; - } else if (resultobj == NULL) { - resultobj = Py_None; - } - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_libnet_Lookup(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { - PyObject *resultobj = 0; - libnet *arg1 = (libnet *) 0 ; - TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ; - struct libnet_Lookup *arg3 = (struct libnet_Lookup *) 0 ; - NTSTATUS result; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char * kwnames[] = { - (char *) "self",(char *) "io", NULL - }; - - arg2 = NULL; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_Lookup",kwnames,&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_Lookup" "', argument " "1"" of type '" "libnet *""'"); - } - arg1 = (libnet *)(argp1); - res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_Lookup, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_Lookup" "', argument " "3"" of type '" "struct libnet_Lookup *""'"); - } - arg3 = (struct libnet_Lookup *)(argp3); - result = libnet_Lookup(arg1,arg2,arg3); - if (NT_STATUS_IS_ERR(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); - SWIG_fail; - } else if (resultobj == NULL) { - resultobj = Py_None; - } - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_libnet_ListShares(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { - PyObject *resultobj = 0; - libnet *arg1 = (libnet *) 0 ; - TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ; - struct libnet_ListShares *arg3 = (struct libnet_ListShares *) 0 ; - NTSTATUS result; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char * kwnames[] = { - (char *) "self",(char *) "r", NULL - }; - - arg2 = NULL; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_ListShares",kwnames,&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_ListShares" "', argument " "1"" of type '" "libnet *""'"); - } - arg1 = (libnet *)(argp1); - res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_ListShares, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_ListShares" "', argument " "3"" of type '" "struct libnet_ListShares *""'"); - } - arg3 = (struct libnet_ListShares *)(argp3); - result = libnet_ListShares(arg1,arg2,arg3); - if (NT_STATUS_IS_ERR(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); - SWIG_fail; - } else if (resultobj == NULL) { - resultobj = Py_None; - } - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_libnet_AddShare(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { - PyObject *resultobj = 0; - libnet *arg1 = (libnet *) 0 ; - TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ; - struct libnet_AddShare *arg3 = (struct libnet_AddShare *) 0 ; - NTSTATUS result; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char * kwnames[] = { - (char *) "self",(char *) "r", NULL - }; - - arg2 = NULL; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_AddShare",kwnames,&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_AddShare" "', argument " "1"" of type '" "libnet *""'"); - } - arg1 = (libnet *)(argp1); - res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_AddShare, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_AddShare" "', argument " "3"" of type '" "struct libnet_AddShare *""'"); - } - arg3 = (struct libnet_AddShare *)(argp3); - result = libnet_AddShare(arg1,arg2,arg3); - if (NT_STATUS_IS_ERR(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); - SWIG_fail; - } else if (resultobj == NULL) { - resultobj = Py_None; - } - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_libnet_DelShare(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { - PyObject *resultobj = 0; - libnet *arg1 = (libnet *) 0 ; - TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ; - struct libnet_DelShare *arg3 = (struct libnet_DelShare *) 0 ; - NTSTATUS result; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char * kwnames[] = { - (char *) "self",(char *) "r", NULL - }; - - arg2 = NULL; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_DelShare",kwnames,&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_DelShare" "', argument " "1"" of type '" "libnet *""'"); - } - arg1 = (libnet *)(argp1); - res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_DelShare, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_DelShare" "', argument " "3"" of type '" "struct libnet_DelShare *""'"); - } - arg3 = (struct libnet_DelShare *)(argp3); - result = libnet_DelShare(arg1,arg2,arg3); - if (NT_STATUS_IS_ERR(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); - SWIG_fail; - } else if (resultobj == NULL) { - resultobj = Py_None; - } - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_libnet_GroupList(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { - PyObject *resultobj = 0; - libnet *arg1 = (libnet *) 0 ; - TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ; - struct libnet_GroupList *arg3 = (struct libnet_GroupList *) 0 ; - NTSTATUS result; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char * kwnames[] = { - (char *) "self",(char *) "io", NULL - }; - - arg2 = NULL; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_GroupList",kwnames,&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_GroupList" "', argument " "1"" of type '" "libnet *""'"); - } - arg1 = (libnet *)(argp1); - res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_GroupList, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_GroupList" "', argument " "3"" of type '" "struct libnet_GroupList *""'"); - } - arg3 = (struct libnet_GroupList *)(argp3); - result = libnet_GroupList(arg1,arg2,arg3); - if (NT_STATUS_IS_ERR(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); - SWIG_fail; - } else if (resultobj == NULL) { - resultobj = Py_None; - } - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_libnet_GroupInfo(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { - PyObject *resultobj = 0; - libnet *arg1 = (libnet *) 0 ; - TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ; - struct libnet_GroupInfo *arg3 = (struct libnet_GroupInfo *) 0 ; - NTSTATUS result; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char * kwnames[] = { - (char *) "self",(char *) "io", NULL - }; - - arg2 = NULL; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_GroupInfo",kwnames,&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_GroupInfo" "', argument " "1"" of type '" "libnet *""'"); - } - arg1 = (libnet *)(argp1); - res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_GroupInfo, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_GroupInfo" "', argument " "3"" of type '" "struct libnet_GroupInfo *""'"); - } - arg3 = (struct libnet_GroupInfo *)(argp3); - result = libnet_GroupInfo(arg1,arg2,arg3); - if (NT_STATUS_IS_ERR(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); - SWIG_fail; - } else if (resultobj == NULL) { - resultobj = Py_None; - } - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_libnet_UserList(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { - PyObject *resultobj = 0; - libnet *arg1 = (libnet *) 0 ; - TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ; - struct libnet_UserList *arg3 = (struct libnet_UserList *) 0 ; - NTSTATUS result; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char * kwnames[] = { - (char *) "self",(char *) "r", NULL - }; - - arg2 = NULL; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_UserList",kwnames,&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_UserList" "', argument " "1"" of type '" "libnet *""'"); - } - arg1 = (libnet *)(argp1); - res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_UserList, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_UserList" "', argument " "3"" of type '" "struct libnet_UserList *""'"); - } - arg3 = (struct libnet_UserList *)(argp3); - result = libnet_UserList(arg1,arg2,arg3); - if (NT_STATUS_IS_ERR(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); - SWIG_fail; - } else if (resultobj == NULL) { - resultobj = Py_None; - } - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_libnet_UserInfo(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { - PyObject *resultobj = 0; - libnet *arg1 = (libnet *) 0 ; - TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ; - struct libnet_UserInfo *arg3 = (struct libnet_UserInfo *) 0 ; - NTSTATUS result; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char * kwnames[] = { - (char *) "self",(char *) "r", NULL - }; - - arg2 = NULL; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_UserInfo",kwnames,&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_UserInfo" "', argument " "1"" of type '" "libnet *""'"); - } - arg1 = (libnet *)(argp1); - res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_UserInfo, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_UserInfo" "', argument " "3"" of type '" "struct libnet_UserInfo *""'"); - } - arg3 = (struct libnet_UserInfo *)(argp3); - result = libnet_UserInfo(arg1,arg2,arg3); - if (NT_STATUS_IS_ERR(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); - SWIG_fail; - } else if (resultobj == NULL) { - resultobj = Py_None; - } - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_libnet_ModifyUser(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { - PyObject *resultobj = 0; - libnet *arg1 = (libnet *) 0 ; - TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ; - struct libnet_ModifyUser *arg3 = (struct libnet_ModifyUser *) 0 ; - NTSTATUS result; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char * kwnames[] = { - (char *) "self",(char *) "r", NULL - }; - - arg2 = NULL; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_ModifyUser",kwnames,&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_ModifyUser" "', argument " "1"" of type '" "libnet *""'"); - } - arg1 = (libnet *)(argp1); - res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_ModifyUser, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_ModifyUser" "', argument " "3"" of type '" "struct libnet_ModifyUser *""'"); - } - arg3 = (struct libnet_ModifyUser *)(argp3); - result = libnet_ModifyUser(arg1,arg2,arg3); - if (NT_STATUS_IS_ERR(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); - SWIG_fail; - } else if (resultobj == NULL) { - resultobj = Py_None; - } - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_libnet_DeleteUser(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { - PyObject *resultobj = 0; - libnet *arg1 = (libnet *) 0 ; - TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ; - struct libnet_DeleteUser *arg3 = (struct libnet_DeleteUser *) 0 ; - NTSTATUS result; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char * kwnames[] = { - (char *) "self",(char *) "r", NULL - }; - - arg2 = NULL; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_DeleteUser",kwnames,&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_DeleteUser" "', argument " "1"" of type '" "libnet *""'"); - } - arg1 = (libnet *)(argp1); - res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_DeleteUser, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_DeleteUser" "', argument " "3"" of type '" "struct libnet_DeleteUser *""'"); - } - arg3 = (struct libnet_DeleteUser *)(argp3); - result = libnet_DeleteUser(arg1,arg2,arg3); - if (NT_STATUS_IS_ERR(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); - SWIG_fail; - } else if (resultobj == NULL) { - resultobj = Py_None; - } - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_libnet_CreateUser(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { - PyObject *resultobj = 0; - libnet *arg1 = (libnet *) 0 ; - TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ; - struct libnet_CreateUser *arg3 = (struct libnet_CreateUser *) 0 ; - NTSTATUS result; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char * kwnames[] = { - (char *) "self",(char *) "r", NULL - }; - - arg2 = NULL; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_CreateUser",kwnames,&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_CreateUser" "', argument " "1"" of type '" "libnet *""'"); - } - arg1 = (libnet *)(argp1); - res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_CreateUser, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_CreateUser" "', argument " "3"" of type '" "struct libnet_CreateUser *""'"); - } - arg3 = (struct libnet_CreateUser *)(argp3); - result = libnet_CreateUser(arg1,arg2,arg3); - if (NT_STATUS_IS_ERR(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); - SWIG_fail; - } else if (resultobj == NULL) { - resultobj = Py_None; - } - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_libnet_SamDump_keytab(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { - PyObject *resultobj = 0; - libnet *arg1 = (libnet *) 0 ; - TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ; - struct libnet_SamDump_keytab *arg3 = (struct libnet_SamDump_keytab *) 0 ; - NTSTATUS result; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char * kwnames[] = { - (char *) "self",(char *) "r", NULL - }; - - arg2 = NULL; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_SamDump_keytab",kwnames,&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_SamDump_keytab" "', argument " "1"" of type '" "libnet *""'"); - } - arg1 = (libnet *)(argp1); - res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_SamDump_keytab, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_SamDump_keytab" "', argument " "3"" of type '" "struct libnet_SamDump_keytab *""'"); - } - arg3 = (struct libnet_SamDump_keytab *)(argp3); - result = libnet_SamDump_keytab(arg1,arg2,arg3); - if (NT_STATUS_IS_ERR(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); - SWIG_fail; - } else if (resultobj == NULL) { - resultobj = Py_None; - } - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_libnet_SamDump(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { - PyObject *resultobj = 0; - libnet *arg1 = (libnet *) 0 ; - TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ; - struct libnet_SamDump *arg3 = (struct libnet_SamDump *) 0 ; - NTSTATUS result; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char * kwnames[] = { - (char *) "self",(char *) "r", NULL - }; - - arg2 = NULL; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_SamDump",kwnames,&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_SamDump" "', argument " "1"" of type '" "libnet *""'"); - } - arg1 = (libnet *)(argp1); - res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_SamDump, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_SamDump" "', argument " "3"" of type '" "struct libnet_SamDump *""'"); - } - arg3 = (struct libnet_SamDump *)(argp3); - result = libnet_SamDump(arg1,arg2,arg3); - if (NT_STATUS_IS_ERR(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); - SWIG_fail; - } else if (resultobj == NULL) { - resultobj = Py_None; - } - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_libnet_SamSync_netlogon(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { - PyObject *resultobj = 0; - libnet *arg1 = (libnet *) 0 ; - TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ; - struct libnet_SamSync *arg3 = (struct libnet_SamSync *) 0 ; - NTSTATUS result; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char * kwnames[] = { - (char *) "self",(char *) "r", NULL - }; - - arg2 = NULL; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_SamSync_netlogon",kwnames,&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_SamSync_netlogon" "', argument " "1"" of type '" "libnet *""'"); - } - arg1 = (libnet *)(argp1); - res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_SamSync, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_SamSync_netlogon" "', argument " "3"" of type '" "struct libnet_SamSync *""'"); - } - arg3 = (struct libnet_SamSync *)(argp3); - result = libnet_SamSync_netlogon(arg1,arg2,arg3); - if (NT_STATUS_IS_ERR(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); - SWIG_fail; - } else if (resultobj == NULL) { - resultobj = Py_None; - } - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_libnet_UnbecomeDC(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { - PyObject *resultobj = 0; - libnet *arg1 = (libnet *) 0 ; - TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ; - struct libnet_UnbecomeDC *arg3 = (struct libnet_UnbecomeDC *) 0 ; - NTSTATUS result; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char * kwnames[] = { - (char *) "self",(char *) "r", NULL - }; - - arg2 = NULL; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_UnbecomeDC",kwnames,&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_UnbecomeDC" "', argument " "1"" of type '" "libnet *""'"); - } - arg1 = (libnet *)(argp1); - res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_UnbecomeDC, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_UnbecomeDC" "', argument " "3"" of type '" "struct libnet_UnbecomeDC *""'"); - } - arg3 = (struct libnet_UnbecomeDC *)(argp3); - result = libnet_UnbecomeDC(arg1,arg2,arg3); - if (NT_STATUS_IS_ERR(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); - SWIG_fail; - } else if (resultobj == NULL) { - resultobj = Py_None; - } - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_libnet_BecomeDC(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { - PyObject *resultobj = 0; - libnet *arg1 = (libnet *) 0 ; - TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ; - struct libnet_BecomeDC *arg3 = (struct libnet_BecomeDC *) 0 ; - NTSTATUS result; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char * kwnames[] = { - (char *) "self",(char *) "r", NULL - }; - - arg2 = NULL; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_BecomeDC",kwnames,&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_BecomeDC" "', argument " "1"" of type '" "libnet *""'"); - } - arg1 = (libnet *)(argp1); - res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_BecomeDC, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_BecomeDC" "', argument " "3"" of type '" "struct libnet_BecomeDC *""'"); - } - arg3 = (struct libnet_BecomeDC *)(argp3); - result = libnet_BecomeDC(arg1,arg2,arg3); - if (NT_STATUS_IS_ERR(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); - SWIG_fail; - } else if (resultobj == NULL) { - resultobj = Py_None; - } - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_libnet_JoinSite(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { - PyObject *resultobj = 0; - libnet *arg1 = (libnet *) 0 ; - struct ldb_context *arg2 = (struct ldb_context *) 0 ; - struct libnet_JoinDomain *arg3 = (struct libnet_JoinDomain *) 0 ; - NTSTATUS result; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - char * kwnames[] = { - (char *) "self",(char *) "remote_ldb",(char *) "libnet_r", NULL - }; - - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:libnet_JoinSite",kwnames,&obj0,&obj1,&obj2)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_JoinSite" "', argument " "1"" of type '" "libnet *""'"); - } - arg1 = (libnet *)(argp1); - res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_ldb_context, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "libnet_JoinSite" "', argument " "2"" of type '" "struct ldb_context *""'"); - } - arg2 = (struct ldb_context *)(argp2); - res3 = SWIG_ConvertPtr(obj2, &argp3,SWIGTYPE_p_libnet_JoinDomain, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_JoinSite" "', argument " "3"" of type '" "struct libnet_JoinDomain *""'"); - } - arg3 = (struct libnet_JoinDomain *)(argp3); - result = libnet_JoinSite(arg1,arg2,arg3); - if (NT_STATUS_IS_ERR(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); - SWIG_fail; - } else if (resultobj == NULL) { - resultobj = Py_None; - } - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_libnet_JoinDomain(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { - PyObject *resultobj = 0; - libnet *arg1 = (libnet *) 0 ; - TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ; - struct libnet_JoinDomain *arg3 = (struct libnet_JoinDomain *) 0 ; - NTSTATUS result; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char * kwnames[] = { - (char *) "self",(char *) "r", NULL - }; - - arg2 = NULL; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_JoinDomain",kwnames,&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_JoinDomain" "', argument " "1"" of type '" "libnet *""'"); - } - arg1 = (libnet *)(argp1); - res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_JoinDomain, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_JoinDomain" "', argument " "3"" of type '" "struct libnet_JoinDomain *""'"); - } - arg3 = (struct libnet_JoinDomain *)(argp3); - result = libnet_JoinDomain(arg1,arg2,arg3); - if (NT_STATUS_IS_ERR(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); - SWIG_fail; - } else if (resultobj == NULL) { - resultobj = Py_None; - } - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_libnet_Join(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { - PyObject *resultobj = 0; - libnet *arg1 = (libnet *) 0 ; - TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ; - struct libnet_Join *arg3 = (struct libnet_Join *) 0 ; - NTSTATUS result; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char * kwnames[] = { - (char *) "self",(char *) "r", NULL - }; - - arg2 = NULL; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_Join",kwnames,&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_Join" "', argument " "1"" of type '" "libnet *""'"); - } - arg1 = (libnet *)(argp1); - res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_Join, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_Join" "', argument " "3"" of type '" "struct libnet_Join *""'"); - } - arg3 = (struct libnet_Join *)(argp3); - result = libnet_Join(arg1,arg2,arg3); - if (NT_STATUS_IS_ERR(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); - SWIG_fail; - } else if (resultobj == NULL) { - resultobj = Py_None; - } - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_libnet_RpcConnect(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { - PyObject *resultobj = 0; - libnet *arg1 = (libnet *) 0 ; - TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ; - struct libnet_RpcConnect *arg3 = (struct libnet_RpcConnect *) 0 ; - NTSTATUS result; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char * kwnames[] = { - (char *) "self",(char *) "r", NULL - }; - - arg2 = NULL; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_RpcConnect",kwnames,&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_RpcConnect" "', argument " "1"" of type '" "libnet *""'"); - } - arg1 = (libnet *)(argp1); - res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_RpcConnect, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_RpcConnect" "', argument " "3"" of type '" "struct libnet_RpcConnect *""'"); - } - arg3 = (struct libnet_RpcConnect *)(argp3); - result = libnet_RpcConnect(arg1,arg2,arg3); - if (NT_STATUS_IS_ERR(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); - SWIG_fail; - } else if (resultobj == NULL) { - resultobj = Py_None; - } - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_libnet_RemoteTOD(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { - PyObject *resultobj = 0; - libnet *arg1 = (libnet *) 0 ; - TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ; - union libnet_RemoteTOD *arg3 = (union libnet_RemoteTOD *) 0 ; - NTSTATUS result; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char * kwnames[] = { - (char *) "self",(char *) "r", NULL - }; - - arg2 = NULL; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_RemoteTOD",kwnames,&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_RemoteTOD" "', argument " "1"" of type '" "libnet *""'"); - } - arg1 = (libnet *)(argp1); - res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_RemoteTOD, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_RemoteTOD" "', argument " "3"" of type '" "union libnet_RemoteTOD *""'"); - } - arg3 = (union libnet_RemoteTOD *)(argp3); - result = libnet_RemoteTOD(arg1,arg2,arg3); - if (NT_STATUS_IS_ERR(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); - SWIG_fail; - } else if (resultobj == NULL) { - resultobj = Py_None; - } - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_libnet_ChangePassword(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { - PyObject *resultobj = 0; - libnet *arg1 = (libnet *) 0 ; - TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ; - union libnet_ChangePassword *arg3 = (union libnet_ChangePassword *) 0 ; - NTSTATUS result; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char * kwnames[] = { - (char *) "self",(char *) "r", NULL - }; - - arg2 = NULL; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_ChangePassword",kwnames,&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_ChangePassword" "', argument " "1"" of type '" "libnet *""'"); - } - arg1 = (libnet *)(argp1); - res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_ChangePassword, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_ChangePassword" "', argument " "3"" of type '" "union libnet_ChangePassword *""'"); - } - arg3 = (union libnet_ChangePassword *)(argp3); - result = libnet_ChangePassword(arg1,arg2,arg3); - if (NT_STATUS_IS_ERR(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); - SWIG_fail; - } else if (resultobj == NULL) { - resultobj = Py_None; - } - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_libnet_SetPassword(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { - PyObject *resultobj = 0; - libnet *arg1 = (libnet *) 0 ; - TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ; - union libnet_SetPassword *arg3 = (union libnet_SetPassword *) 0 ; - NTSTATUS result; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char * kwnames[] = { - (char *) "self",(char *) "r", NULL - }; - - arg2 = NULL; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_SetPassword",kwnames,&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_SetPassword" "', argument " "1"" of type '" "libnet *""'"); - } - arg1 = (libnet *)(argp1); - res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_SetPassword, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_SetPassword" "', argument " "3"" of type '" "union libnet_SetPassword *""'"); - } - arg3 = (union libnet_SetPassword *)(argp3); - result = libnet_SetPassword(arg1,arg2,arg3); - if (NT_STATUS_IS_ERR(result)) { - PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); - SWIG_fail; - } else if (resultobj == NULL) { - resultobj = Py_None; - } - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_delete_libnet(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - libnet *arg1 = (libnet *) 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_libnet_context, SWIG_POINTER_DISOWN | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_libnet" "', argument " "1"" of type '" "libnet *""'"); - } - arg1 = (libnet *)(argp1); - free((char *) arg1); - - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *libnet_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *obj; - if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL; - SWIG_TypeNewClientData(SWIGTYPE_p_libnet_context, SWIG_NewClientData(obj)); - return SWIG_Py_Void(); -} - -SWIGINTERN PyObject *libnet_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - return SWIG_Python_InitShadowInstance(args); -} - -static PyMethodDef SwigMethods[] = { - { (char *)"libnet_cred_set", _wrap_libnet_cred_set, METH_VARARGS, NULL}, - { (char *)"libnet_cred_get", (PyCFunction)_wrap_libnet_cred_get, METH_O, NULL}, - { (char *)"new_libnet", (PyCFunction) _wrap_new_libnet, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"libnet_samsync_ldb", (PyCFunction) _wrap_libnet_samsync_ldb, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"libnet_DomainList", (PyCFunction) _wrap_libnet_DomainList, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"libnet_DomainClose", (PyCFunction) _wrap_libnet_DomainClose, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"libnet_DomainOpen", (PyCFunction) _wrap_libnet_DomainOpen, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"libnet_LookupName", (PyCFunction) _wrap_libnet_LookupName, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"libnet_LookupDCs", (PyCFunction) _wrap_libnet_LookupDCs, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"libnet_LookupHost", (PyCFunction) _wrap_libnet_LookupHost, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"libnet_Lookup", (PyCFunction) _wrap_libnet_Lookup, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"libnet_ListShares", (PyCFunction) _wrap_libnet_ListShares, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"libnet_AddShare", (PyCFunction) _wrap_libnet_AddShare, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"libnet_DelShare", (PyCFunction) _wrap_libnet_DelShare, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"libnet_GroupList", (PyCFunction) _wrap_libnet_GroupList, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"libnet_GroupInfo", (PyCFunction) _wrap_libnet_GroupInfo, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"libnet_UserList", (PyCFunction) _wrap_libnet_UserList, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"libnet_UserInfo", (PyCFunction) _wrap_libnet_UserInfo, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"libnet_ModifyUser", (PyCFunction) _wrap_libnet_ModifyUser, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"libnet_DeleteUser", (PyCFunction) _wrap_libnet_DeleteUser, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"libnet_CreateUser", (PyCFunction) _wrap_libnet_CreateUser, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"libnet_SamDump_keytab", (PyCFunction) _wrap_libnet_SamDump_keytab, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"libnet_SamDump", (PyCFunction) _wrap_libnet_SamDump, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"libnet_SamSync_netlogon", (PyCFunction) _wrap_libnet_SamSync_netlogon, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"libnet_UnbecomeDC", (PyCFunction) _wrap_libnet_UnbecomeDC, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"libnet_BecomeDC", (PyCFunction) _wrap_libnet_BecomeDC, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"libnet_JoinSite", (PyCFunction) _wrap_libnet_JoinSite, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"libnet_JoinDomain", (PyCFunction) _wrap_libnet_JoinDomain, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"libnet_Join", (PyCFunction) _wrap_libnet_Join, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"libnet_RpcConnect", (PyCFunction) _wrap_libnet_RpcConnect, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"libnet_RemoteTOD", (PyCFunction) _wrap_libnet_RemoteTOD, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"libnet_ChangePassword", (PyCFunction) _wrap_libnet_ChangePassword, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"libnet_SetPassword", (PyCFunction) _wrap_libnet_SetPassword, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"delete_libnet", (PyCFunction)_wrap_delete_libnet, METH_O, NULL}, - { (char *)"libnet_swigregister", libnet_swigregister, METH_VARARGS, NULL}, - { (char *)"libnet_swiginit", libnet_swiginit, METH_VARARGS, NULL}, - { NULL, NULL, 0, NULL } -}; - - -/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ - -static swig_type_info _swigt__p_TALLOC_CTX = {"_p_TALLOC_CTX", "TALLOC_CTX *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_cli_credentials = {"_p_cli_credentials", "struct cli_credentials *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_event_context = {"_p_event_context", "struct event_context *|event *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_int = {"_p_int", "intptr_t *|int *|int_least32_t *|int_fast32_t *|int32_t *|int_fast16_t *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_ldb_context = {"_p_ldb_context", "struct ldb_context *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_libnet_AddShare = {"_p_libnet_AddShare", "struct libnet_AddShare *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_libnet_BecomeDC = {"_p_libnet_BecomeDC", "struct libnet_BecomeDC *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_libnet_ChangePassword = {"_p_libnet_ChangePassword", "union libnet_ChangePassword *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_libnet_CreateUser = {"_p_libnet_CreateUser", "struct libnet_CreateUser *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_libnet_DelShare = {"_p_libnet_DelShare", "struct libnet_DelShare *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_libnet_DeleteUser = {"_p_libnet_DeleteUser", "struct libnet_DeleteUser *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_libnet_DomainClose = {"_p_libnet_DomainClose", "struct libnet_DomainClose *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_libnet_DomainList = {"_p_libnet_DomainList", "struct libnet_DomainList *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_libnet_DomainOpen = {"_p_libnet_DomainOpen", "struct libnet_DomainOpen *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_libnet_GroupInfo = {"_p_libnet_GroupInfo", "struct libnet_GroupInfo *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_libnet_GroupList = {"_p_libnet_GroupList", "struct libnet_GroupList *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_libnet_Join = {"_p_libnet_Join", "struct libnet_Join *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_libnet_JoinDomain = {"_p_libnet_JoinDomain", "struct libnet_JoinDomain *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_libnet_ListShares = {"_p_libnet_ListShares", "struct libnet_ListShares *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_libnet_Lookup = {"_p_libnet_Lookup", "struct libnet_Lookup *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_libnet_LookupDCs = {"_p_libnet_LookupDCs", "struct libnet_LookupDCs *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_libnet_LookupName = {"_p_libnet_LookupName", "struct libnet_LookupName *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_libnet_ModifyUser = {"_p_libnet_ModifyUser", "struct libnet_ModifyUser *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_libnet_RemoteTOD = {"_p_libnet_RemoteTOD", "union libnet_RemoteTOD *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_libnet_RpcConnect = {"_p_libnet_RpcConnect", "struct libnet_RpcConnect *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_libnet_SamDump = {"_p_libnet_SamDump", "struct libnet_SamDump *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_libnet_SamDump_keytab = {"_p_libnet_SamDump_keytab", "struct libnet_SamDump_keytab *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_libnet_SamSync = {"_p_libnet_SamSync", "struct libnet_SamSync *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_libnet_SetPassword = {"_p_libnet_SetPassword", "union libnet_SetPassword *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_libnet_UnbecomeDC = {"_p_libnet_UnbecomeDC", "struct libnet_UnbecomeDC *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_libnet_UserInfo = {"_p_libnet_UserInfo", "struct libnet_UserInfo *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_libnet_UserList = {"_p_libnet_UserList", "struct libnet_UserList *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_libnet_context = {"_p_libnet_context", "struct libnet_context *|libnet *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_libnet_samsync_ldb = {"_p_libnet_samsync_ldb", "struct libnet_samsync_ldb *", 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}; -static swig_type_info _swigt__p_loadparm_service = {"_p_loadparm_service", "struct loadparm_service *|loadparm_service *", 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_param_context = {"_p_param_context", "struct param_context *|param *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_param_opt = {"_p_param_opt", "struct param_opt *|param_opt *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_param_section = {"_p_param_section", "struct param_section *|param_section *", 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", "uintptr_t *|uint_least32_t *|uint_fast32_t *|uint32_t *|unsigned int *|uint_fast16_t *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_unsigned_long_long = {"_p_unsigned_long_long", "uint_least64_t *|uint_fast64_t *|uint64_t *|unsigned long long *|uintmax_t *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_unsigned_short = {"_p_unsigned_short", "unsigned short *|uint_least16_t *|uint16_t *", 0, 0, (void*)0, 0}; - -static swig_type_info *swig_type_initial[] = { - &_swigt__p_TALLOC_CTX, - &_swigt__p_char, - &_swigt__p_cli_credentials, - &_swigt__p_event_context, - &_swigt__p_int, - &_swigt__p_ldb_context, - &_swigt__p_libnet_AddShare, - &_swigt__p_libnet_BecomeDC, - &_swigt__p_libnet_ChangePassword, - &_swigt__p_libnet_CreateUser, - &_swigt__p_libnet_DelShare, - &_swigt__p_libnet_DeleteUser, - &_swigt__p_libnet_DomainClose, - &_swigt__p_libnet_DomainList, - &_swigt__p_libnet_DomainOpen, - &_swigt__p_libnet_GroupInfo, - &_swigt__p_libnet_GroupList, - &_swigt__p_libnet_Join, - &_swigt__p_libnet_JoinDomain, - &_swigt__p_libnet_ListShares, - &_swigt__p_libnet_Lookup, - &_swigt__p_libnet_LookupDCs, - &_swigt__p_libnet_LookupName, - &_swigt__p_libnet_ModifyUser, - &_swigt__p_libnet_RemoteTOD, - &_swigt__p_libnet_RpcConnect, - &_swigt__p_libnet_SamDump, - &_swigt__p_libnet_SamDump_keytab, - &_swigt__p_libnet_SamSync, - &_swigt__p_libnet_SetPassword, - &_swigt__p_libnet_UnbecomeDC, - &_swigt__p_libnet_UserInfo, - &_swigt__p_libnet_UserList, - &_swigt__p_libnet_context, - &_swigt__p_libnet_samsync_ldb, - &_swigt__p_loadparm_context, - &_swigt__p_loadparm_service, - &_swigt__p_long_long, - &_swigt__p_param_context, - &_swigt__p_param_opt, - &_swigt__p_param_section, - &_swigt__p_short, - &_swigt__p_signed_char, - &_swigt__p_unsigned_char, - &_swigt__p_unsigned_int, - &_swigt__p_unsigned_long_long, - &_swigt__p_unsigned_short, -}; - -static swig_cast_info _swigc__p_TALLOC_CTX[] = { {&_swigt__p_TALLOC_CTX, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_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_int[] = { {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_ldb_context[] = { {&_swigt__p_ldb_context, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_libnet_AddShare[] = { {&_swigt__p_libnet_AddShare, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_libnet_BecomeDC[] = { {&_swigt__p_libnet_BecomeDC, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_libnet_ChangePassword[] = { {&_swigt__p_libnet_ChangePassword, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_libnet_CreateUser[] = { {&_swigt__p_libnet_CreateUser, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_libnet_DelShare[] = { {&_swigt__p_libnet_DelShare, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_libnet_DeleteUser[] = { {&_swigt__p_libnet_DeleteUser, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_libnet_DomainClose[] = { {&_swigt__p_libnet_DomainClose, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_libnet_DomainList[] = { {&_swigt__p_libnet_DomainList, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_libnet_DomainOpen[] = { {&_swigt__p_libnet_DomainOpen, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_libnet_GroupInfo[] = { {&_swigt__p_libnet_GroupInfo, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_libnet_GroupList[] = { {&_swigt__p_libnet_GroupList, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_libnet_Join[] = { {&_swigt__p_libnet_Join, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_libnet_JoinDomain[] = { {&_swigt__p_libnet_JoinDomain, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_libnet_ListShares[] = { {&_swigt__p_libnet_ListShares, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_libnet_Lookup[] = { {&_swigt__p_libnet_Lookup, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_libnet_LookupDCs[] = { {&_swigt__p_libnet_LookupDCs, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_libnet_LookupName[] = { {&_swigt__p_libnet_LookupName, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_libnet_ModifyUser[] = { {&_swigt__p_libnet_ModifyUser, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_libnet_RemoteTOD[] = { {&_swigt__p_libnet_RemoteTOD, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_libnet_RpcConnect[] = { {&_swigt__p_libnet_RpcConnect, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_libnet_SamDump[] = { {&_swigt__p_libnet_SamDump, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_libnet_SamDump_keytab[] = { {&_swigt__p_libnet_SamDump_keytab, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_libnet_SamSync[] = { {&_swigt__p_libnet_SamSync, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_libnet_SetPassword[] = { {&_swigt__p_libnet_SetPassword, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_libnet_UnbecomeDC[] = { {&_swigt__p_libnet_UnbecomeDC, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_libnet_UserInfo[] = { {&_swigt__p_libnet_UserInfo, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_libnet_UserList[] = { {&_swigt__p_libnet_UserList, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_libnet_context[] = { {&_swigt__p_libnet_context, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_libnet_samsync_ldb[] = { {&_swigt__p_libnet_samsync_ldb, 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}}; -static swig_cast_info _swigc__p_loadparm_service[] = { {&_swigt__p_loadparm_service, 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_param_context[] = { {&_swigt__p_param_context, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_param_opt[] = { {&_swigt__p_param_opt, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_param_section[] = { {&_swigt__p_param_section, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_short[] = { {&_swigt__p_short, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_signed_char[] = { {&_swigt__p_signed_char, 0, 0, 0},{0, 0, 0, 0}}; -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_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 *swig_cast_initial[] = { - _swigc__p_TALLOC_CTX, - _swigc__p_char, - _swigc__p_cli_credentials, - _swigc__p_event_context, - _swigc__p_int, - _swigc__p_ldb_context, - _swigc__p_libnet_AddShare, - _swigc__p_libnet_BecomeDC, - _swigc__p_libnet_ChangePassword, - _swigc__p_libnet_CreateUser, - _swigc__p_libnet_DelShare, - _swigc__p_libnet_DeleteUser, - _swigc__p_libnet_DomainClose, - _swigc__p_libnet_DomainList, - _swigc__p_libnet_DomainOpen, - _swigc__p_libnet_GroupInfo, - _swigc__p_libnet_GroupList, - _swigc__p_libnet_Join, - _swigc__p_libnet_JoinDomain, - _swigc__p_libnet_ListShares, - _swigc__p_libnet_Lookup, - _swigc__p_libnet_LookupDCs, - _swigc__p_libnet_LookupName, - _swigc__p_libnet_ModifyUser, - _swigc__p_libnet_RemoteTOD, - _swigc__p_libnet_RpcConnect, - _swigc__p_libnet_SamDump, - _swigc__p_libnet_SamDump_keytab, - _swigc__p_libnet_SamSync, - _swigc__p_libnet_SetPassword, - _swigc__p_libnet_UnbecomeDC, - _swigc__p_libnet_UserInfo, - _swigc__p_libnet_UserList, - _swigc__p_libnet_context, - _swigc__p_libnet_samsync_ldb, - _swigc__p_loadparm_context, - _swigc__p_loadparm_service, - _swigc__p_long_long, - _swigc__p_param_context, - _swigc__p_param_opt, - _swigc__p_param_section, - _swigc__p_short, - _swigc__p_signed_char, - _swigc__p_unsigned_char, - _swigc__p_unsigned_int, - _swigc__p_unsigned_long_long, - _swigc__p_unsigned_short, -}; - - -/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ - -static swig_const_info swig_const_table[] = { -{0, 0, 0, 0.0, 0, 0}}; - -#ifdef __cplusplus -} -#endif -/* ----------------------------------------------------------------------------- - * Type initialization: - * This problem is tough by the requirement that no dynamic - * memory is used. Also, since swig_type_info structures store pointers to - * swig_cast_info structures and swig_cast_info structures store pointers back - * to swig_type_info structures, we need some lookup code at initialization. - * The idea is that swig generates all the structures that are needed. - * The runtime then collects these partially filled structures. - * The SWIG_InitializeModule function takes these initial arrays out of - * swig_module, and does all the lookup, filling in the swig_module.types - * array with the correct data and linking the correct swig_cast_info - * structures together. - * - * The generated swig_type_info structures are assigned staticly to an initial - * array. We just loop through that array, and handle each type individually. - * First we lookup if this type has been already loaded, and if so, use the - * loaded structure instead of the generated one. Then we have to fill in the - * cast linked list. The cast data is initially stored in something like a - * two-dimensional array. Each row corresponds to a type (there are the same - * number of rows as there are in the swig_type_initial array). Each entry in - * a column is one of the swig_cast_info structures for that type. - * The cast_initial array is actually an array of arrays, because each row has - * a variable number of columns. So to actually build the cast linked list, - * we find the array of casts associated with the type, and loop through it - * adding the casts to the list. The one last trick we need to do is making - * sure the type pointer in the swig_cast_info struct is correct. - * - * First off, we lookup the cast->type name to see if it is already loaded. - * There are three cases to handle: - * 1) If the cast->type has already been loaded AND the type we are adding - * casting info to has not been loaded (it is in this module), THEN we - * replace the cast->type pointer with the type pointer that has already - * been loaded. - * 2) If BOTH types (the one we are adding casting info to, and the - * cast->type) are loaded, THEN the cast info has already been loaded by - * the previous module so we just ignore it. - * 3) Finally, if cast->type has not already been loaded, then we add that - * swig_cast_info to the linked list (because the cast->type) pointer will - * be correct. - * ----------------------------------------------------------------------------- */ - -#ifdef __cplusplus -extern "C" { -#if 0 -} /* c-mode */ -#endif -#endif - -#if 0 -#define SWIGRUNTIME_DEBUG -#endif - - -SWIGRUNTIME void -SWIG_InitializeModule(void *clientdata) { - size_t i; - swig_module_info *module_head, *iter; - int found; - - clientdata = clientdata; - - /* check to see if the circular list has been setup, if not, set it up */ - if (swig_module.next==0) { - /* Initialize the swig_module */ - swig_module.type_initial = swig_type_initial; - swig_module.cast_initial = swig_cast_initial; - swig_module.next = &swig_module; - } - - /* Try and load any already created modules */ - module_head = SWIG_GetModule(clientdata); - if (!module_head) { - /* This is the first module loaded for this interpreter */ - /* so set the swig module into the interpreter */ - SWIG_SetModule(clientdata, &swig_module); - module_head = &swig_module; - } else { - /* the interpreter has loaded a SWIG module, but has it loaded this one? */ - found=0; - iter=module_head; - do { - if (iter==&swig_module) { - found=1; - break; - } - iter=iter->next; - } while (iter!= module_head); - - /* if the is found in the list, then all is done and we may leave */ - if (found) return; - /* otherwise we must add out module into the list */ - swig_module.next = module_head->next; - module_head->next = &swig_module; - } - - /* Now work on filling in swig_module.types */ -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: size %d\n", swig_module.size); -#endif - for (i = 0; i < swig_module.size; ++i) { - swig_type_info *type = 0; - swig_type_info *ret; - swig_cast_info *cast; - -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); -#endif - - /* if there is another module already loaded */ - if (swig_module.next != &swig_module) { - type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); - } - if (type) { - /* Overwrite clientdata field */ -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: found type %s\n", type->name); -#endif - if (swig_module.type_initial[i]->clientdata) { - type->clientdata = swig_module.type_initial[i]->clientdata; -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name); -#endif - } - } else { - type = swig_module.type_initial[i]; - } - - /* Insert casting types */ - cast = swig_module.cast_initial[i]; - while (cast->type) { - /* Don't need to add information already in the list */ - ret = 0; -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); -#endif - if (swig_module.next != &swig_module) { - ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); -#ifdef SWIGRUNTIME_DEBUG - if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); -#endif - } - if (ret) { - if (type == swig_module.type_initial[i]) { -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: skip old type %s\n", ret->name); -#endif - cast->type = ret; - ret = 0; - } else { - /* Check for casting already in the list */ - swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); -#ifdef SWIGRUNTIME_DEBUG - if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); -#endif - if (!ocast) ret = 0; - } - } - - if (!ret) { -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); -#endif - if (type->cast) { - type->cast->prev = cast; - cast->next = type->cast; - } - type->cast = cast; - } - cast++; - } - /* Set entry in modules->types array equal to the type */ - swig_module.types[i] = type; - } - swig_module.types[i] = 0; - -#ifdef SWIGRUNTIME_DEBUG - printf("**** SWIG_InitializeModule: Cast List ******\n"); - for (i = 0; i < swig_module.size; ++i) { - int j = 0; - swig_cast_info *cast = swig_module.cast_initial[i]; - printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); - while (cast->type) { - printf("SWIG_InitializeModule: cast type %s\n", cast->type->name); - cast++; - ++j; - } - printf("---- Total casts: %d\n",j); - } - printf("**** SWIG_InitializeModule: Cast List ******\n"); -#endif -} - -/* This function will propagate the clientdata field of type to -* any new swig_type_info structures that have been added into the list -* of equivalent types. It is like calling -* SWIG_TypeClientData(type, clientdata) a second time. -*/ -SWIGRUNTIME void -SWIG_PropagateClientData(void) { - size_t i; - swig_cast_info *equiv; - static int init_run = 0; - - if (init_run) return; - init_run = 1; - - for (i = 0; i < swig_module.size; i++) { - if (swig_module.types[i]->clientdata) { - equiv = swig_module.types[i]->cast; - while (equiv) { - if (!equiv->converter) { - if (equiv->type && !equiv->type->clientdata) - SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); - } - equiv = equiv->next; - } - } - } -} - -#ifdef __cplusplus -#if 0 -{ - /* c-mode */ -#endif -} -#endif - - - -#ifdef __cplusplus -extern "C" { -#endif - - /* Python-specific SWIG API */ -#define SWIG_newvarlink() SWIG_Python_newvarlink() -#define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr) -#define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants) - - /* ----------------------------------------------------------------------------- - * global variable support code. - * ----------------------------------------------------------------------------- */ - - typedef struct swig_globalvar { - char *name; /* Name of global variable */ - PyObject *(*get_attr)(void); /* Return the current value */ - int (*set_attr)(PyObject *); /* Set the value */ - struct swig_globalvar *next; - } swig_globalvar; - - typedef struct swig_varlinkobject { - PyObject_HEAD - swig_globalvar *vars; - } swig_varlinkobject; - - SWIGINTERN PyObject * - swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) { - return PyString_FromString(""); - } - - SWIGINTERN PyObject * - swig_varlink_str(swig_varlinkobject *v) { - PyObject *str = PyString_FromString("("); - swig_globalvar *var; - for (var = v->vars; var; var=var->next) { - PyString_ConcatAndDel(&str,PyString_FromString(var->name)); - if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", ")); - } - PyString_ConcatAndDel(&str,PyString_FromString(")")); - return str; - } - - SWIGINTERN int - swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { - PyObject *str = swig_varlink_str(v); - fprintf(fp,"Swig global variables "); - fprintf(fp,"%s\n", PyString_AsString(str)); - Py_DECREF(str); - return 0; - } - - SWIGINTERN void - swig_varlink_dealloc(swig_varlinkobject *v) { - swig_globalvar *var = v->vars; - while (var) { - swig_globalvar *n = var->next; - free(var->name); - free(var); - var = n; - } - } - - SWIGINTERN PyObject * - swig_varlink_getattr(swig_varlinkobject *v, char *n) { - PyObject *res = NULL; - swig_globalvar *var = v->vars; - while (var) { - if (strcmp(var->name,n) == 0) { - res = (*var->get_attr)(); - break; - } - var = var->next; - } - if (res == NULL && !PyErr_Occurred()) { - PyErr_SetString(PyExc_NameError,"Unknown C global variable"); - } - return res; - } - - SWIGINTERN int - swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) { - int res = 1; - swig_globalvar *var = v->vars; - while (var) { - if (strcmp(var->name,n) == 0) { - res = (*var->set_attr)(p); - break; - } - var = var->next; - } - if (res == 1 && !PyErr_Occurred()) { - PyErr_SetString(PyExc_NameError,"Unknown C global variable"); - } - return res; - } - - SWIGINTERN PyTypeObject* - swig_varlink_type(void) { - static char varlink__doc__[] = "Swig var link object"; - static PyTypeObject varlink_type; - static int type_init = 0; - if (!type_init) { - const PyTypeObject tmp - = { - PyObject_HEAD_INIT(NULL) - 0, /* Number of items in variable part (ob_size) */ - (char *)"swigvarlink", /* Type name (tp_name) */ - sizeof(swig_varlinkobject), /* Basic size (tp_basicsize) */ - 0, /* Itemsize (tp_itemsize) */ - (destructor) swig_varlink_dealloc, /* Deallocator (tp_dealloc) */ - (printfunc) swig_varlink_print, /* Print (tp_print) */ - (getattrfunc) swig_varlink_getattr, /* get attr (tp_getattr) */ - (setattrfunc) swig_varlink_setattr, /* Set attr (tp_setattr) */ - 0, /* tp_compare */ - (reprfunc) swig_varlink_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - (reprfunc)swig_varlink_str, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - 0, /* tp_flags */ - varlink__doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ -#if PY_VERSION_HEX >= 0x02020000 - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */ -#endif -#if PY_VERSION_HEX >= 0x02030000 - 0, /* tp_del */ -#endif -#ifdef COUNT_ALLOCS - 0,0,0,0 /* tp_alloc -> tp_next */ -#endif - }; - varlink_type = tmp; - varlink_type.ob_type = &PyType_Type; - type_init = 1; - } - return &varlink_type; - } - - /* Create a variable linking object for use later */ - SWIGINTERN PyObject * - SWIG_Python_newvarlink(void) { - swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type()); - if (result) { - result->vars = 0; - } - return ((PyObject*) result); - } - - SWIGINTERN void - SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) { - swig_varlinkobject *v = (swig_varlinkobject *) p; - swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar)); - if (gv) { - size_t size = strlen(name)+1; - gv->name = (char *)malloc(size); - if (gv->name) { - strncpy(gv->name,name,size); - gv->get_attr = get_attr; - gv->set_attr = set_attr; - gv->next = v->vars; - } - } - v->vars = gv; - } - - SWIGINTERN PyObject * - SWIG_globals(void) { - static PyObject *_SWIG_globals = 0; - if (!_SWIG_globals) _SWIG_globals = SWIG_newvarlink(); - return _SWIG_globals; - } - - /* ----------------------------------------------------------------------------- - * constants/methods manipulation - * ----------------------------------------------------------------------------- */ - - /* Install Constants */ - SWIGINTERN void - SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) { - PyObject *obj = 0; - size_t i; - for (i = 0; constants[i].type; ++i) { - switch(constants[i].type) { - case SWIG_PY_POINTER: - obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0); - break; - case SWIG_PY_BINARY: - obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype)); - break; - default: - obj = 0; - break; - } - if (obj) { - PyDict_SetItemString(d, constants[i].name, obj); - Py_DECREF(obj); - } - } - } - - /* -----------------------------------------------------------------------------*/ - /* Fix SwigMethods to carry the callback ptrs when needed */ - /* -----------------------------------------------------------------------------*/ - - SWIGINTERN void - SWIG_Python_FixMethods(PyMethodDef *methods, - swig_const_info *const_table, - swig_type_info **types, - swig_type_info **types_initial) { - size_t i; - for (i = 0; methods[i].ml_name; ++i) { - const char *c = methods[i].ml_doc; - if (c && (c = strstr(c, "swig_ptr: "))) { - int j; - swig_const_info *ci = 0; - const char *name = c + 10; - for (j = 0; const_table[j].type; ++j) { - if (strncmp(const_table[j].name, name, - strlen(const_table[j].name)) == 0) { - ci = &(const_table[j]); - break; - } - } - if (ci) { - size_t shift = (ci->ptype) - types; - swig_type_info *ty = types_initial[shift]; - size_t ldoc = (c - methods[i].ml_doc); - size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; - char *ndoc = (char*)malloc(ldoc + lptr + 10); - if (ndoc) { - char *buff = ndoc; - void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; - if (ptr) { - strncpy(buff, methods[i].ml_doc, ldoc); - buff += ldoc; - strncpy(buff, "swig_ptr: ", 10); - buff += 10; - SWIG_PackVoidPtr(buff, ptr, ty->name, lptr); - methods[i].ml_doc = ndoc; - } - } - } - } - } - } - -#ifdef __cplusplus -} -#endif - -/* -----------------------------------------------------------------------------* - * Partial Init method - * -----------------------------------------------------------------------------*/ - -#ifdef __cplusplus -extern "C" -#endif -SWIGEXPORT void SWIG_init(void) { - PyObject *m, *d; - - /* Fix SwigMethods to carry the callback ptrs when needed */ - SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); - - m = Py_InitModule((char *) SWIG_name, SwigMethods); - d = PyModule_GetDict(m); - - SWIG_InitializeModule(0); - SWIG_InstallConstants(d,swig_const_table); - - -} - diff --git a/source4/libnet/py_net.c b/source4/libnet/py_net.c new file mode 100644 index 0000000000..2fcbc5d156 --- /dev/null +++ b/source4/libnet/py_net.c @@ -0,0 +1,77 @@ +/* + Unix SMB/CIFS implementation. + Samba utility functions + Copyright (C) Jelmer Vernooij 2008 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "includes.h" +#include +#include "libnet.h" +#include "param/param.h" +#include "libcli/security/security.h" + +struct libnet_context *py_net_ctx(PyObject *obj) +{ + /* FIXME: Use obj */ + return libnet_context_init(NULL, global_loadparm); +} + +static PyObject *py_net_join(PyObject *cls, PyObject *args, PyObject *kwargs) +{ + struct libnet_Join r; + NTSTATUS status; + PyObject *result; + TALLOC_CTX *mem_ctx; + struct libnet_context *libnet_ctx; + const char *kwnames[] = { "domain_name", "netbios_name", "join_type", "level", NULL }; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ssii:Join", discard_const_p(char *, kwnames), + &r.in.domain_name, &r.in.netbios_name, + &r.in.join_type, &r.in.level)) + return NULL; + + mem_ctx = talloc_new(NULL); + + libnet_ctx = py_net_ctx(cls); + + status = libnet_Join(libnet_ctx, mem_ctx, &r); + if (NT_STATUS_IS_ERR(status)) { + PyErr_SetString(PyExc_RuntimeError, r.out.error_string); + talloc_free(mem_ctx); + return NULL; + } + + result = Py_BuildValue("sss", r.out.join_password, + dom_sid_string(mem_ctx, r.out.domain_sid), + r.out.domain_name); + + talloc_free(mem_ctx); + + if (result == NULL) + return NULL; + + return result; +} + +static struct PyMethodDef net_methods[] = { + {"Join", (PyCFunction)py_net_join, METH_VARARGS|METH_KEYWORDS}, + {NULL } +}; + +void initnet(void) +{ + Py_InitModule("net", net_methods); +} diff --git a/source4/scripting/python/modules.c b/source4/scripting/python/modules.c index ba85994636..6cd975c1a9 100644 --- a/source4/scripting/python/modules.c +++ b/source4/scripting/python/modules.c @@ -42,6 +42,7 @@ extern void initepmapper(void); extern void initinitshutdown(void); static void initdcerpc_misc(void) {} extern void initmgmt(void); +extern void initnet(void); extern void initatsvc(void); extern void initsamr(void); static void initdcerpc_security(void) {} -- cgit From 3f2e403a8672323517e9a5efc4026d58f22fe75b Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 8 Apr 2008 17:26:55 +1000 Subject: Rework talloc hirarchy for C provision setup. This seems to fix (or sweep under the covers) a crash in this code. Andrew Bartlett (This used to be commit 2fcddfe583f9833cea80d02e08ac12dd1f91742c) --- source4/torture/local/torture.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/source4/torture/local/torture.c b/source4/torture/local/torture.c index bb6e21ed4f..9bd60d9620 100644 --- a/source4/torture/local/torture.c +++ b/source4/torture/local/torture.c @@ -42,27 +42,28 @@ static bool test_tempdir(struct torture_context *tctx) static bool test_provision(struct torture_context *tctx) { NTSTATUS status; - struct provision_settings settings; - char *location = NULL; - torture_assert_ntstatus_ok(tctx, torture_temp_dir(tctx, "torture_provision", &location), + struct provision_settings *settings = talloc(tctx, struct provision_settings); + char *targetdir = NULL; + + torture_assert_ntstatus_ok(tctx, torture_temp_dir(tctx, "torture_provision", &targetdir), "torture_temp_dir should return NT_STATUS_OK" ); + settings->targetdir = talloc_steal(settings, targetdir); - settings.dns_name = "example.com"; - settings.site_name = "SOME-SITE-NAME"; - settings.root_dn_str = "DC=EXAMPLE,DC=COM"; - settings.domain_dn_str = "DC=EXAMPLE,DC=COM"; - settings.config_dn_str = NULL; - settings.schema_dn_str = NULL; - settings.invocation_id = NULL; - settings.netbios_name = "FOO"; - settings.realm = "EXAMPLE.COM"; - settings.domain = "EXAMPLE"; - settings.ntds_guid = NULL; - settings.ntds_dn_str = NULL; - settings.machine_password = "geheim"; - settings.targetdir = location; + settings->dns_name = "example.com"; + settings->site_name = "SOME-SITE-NAME"; + settings->root_dn_str = "DC=EXAMPLE,DC=COM"; + settings->domain_dn_str = "DC=EXAMPLE,DC=COM"; + settings->config_dn_str = NULL; + settings->schema_dn_str = NULL; + settings->invocation_id = NULL; + settings->netbios_name = "FOO"; + settings->realm = "EXAMPLE.COM"; + settings->domain = "EXAMPLE"; + settings->ntds_guid = NULL; + settings->ntds_dn_str = NULL; + settings->machine_password = "geheim"; - status = provision_bare(tctx, tctx->lp_ctx, &settings); + status = provision_bare(settings, tctx->lp_ctx, settings); torture_assert_ntstatus_ok(tctx, status, "provision"); -- cgit From b2805c50eecddfa4cbd0945e713567eddce05895 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 8 Apr 2008 17:28:25 +1000 Subject: Re-add support for the --ldap-backend-port option to provision-backend This option allows Fedora DS multi-master replication to work. I've tried to update the wiki and scripts to the largely consistant with each other. Andrew Bartlett (This used to be commit 42393c830733b2cc99ebccdafe944fcf3d82734f) --- source4/scripting/python/samba/provision.py | 42 ++++++++++++++++++++--------- source4/selftest/target/Samba4.pm | 5 ---- source4/setup/provision-backend | 15 ++++++----- 3 files changed, 37 insertions(+), 25 deletions(-) diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py index 02460070b4..80dcd522df 100644 --- a/source4/scripting/python/samba/provision.py +++ b/source4/scripting/python/samba/provision.py @@ -288,7 +288,7 @@ def guess_names(lp=None, hostname=None, domain=None, dnsdomain=None, serverrole= if lp.get("realm").upper() != realm: raise Exception("realm '%s' in %s must match chosen realm '%s'" % - (lp.get("realm"), smbconf, realm)) + (lp.get("realm"), lp.configfile(), realm)) dnsdomain = dnsdomain.lower() @@ -1045,8 +1045,8 @@ def provision(setup_dir, message, session_info, message("Please install the phpLDAPadmin configuration located at %s into /etc/phpldapadmin/config.php" % paths.phpldapadminconfig) - message("Once the above files are installed, your server will be ready to use") - message("Server Type: %s" % serverrole) + message("Once the above files are installed, your Samba4 server will be ready to use") + message("Server Role: %s" % serverrole) message("Hostname: %s" % names.hostname) message("NetBIOS Domain: %s" % names.domain) message("DNS Domain: %s" % names.dnsdomain) @@ -1096,7 +1096,7 @@ def provision_backend(setup_dir=None, message=None, smbconf=None, targetdir=None, realm=None, rootdn=None, domaindn=None, schemadn=None, configdn=None, domain=None, hostname=None, adminpass=None, root=None, serverrole=None, - ldap_backend_type=None): + ldap_backend_type=None, ldap_backend_port=None): def setup_path(file): return os.path.join(setup_dir, file) @@ -1144,7 +1144,12 @@ def provision_backend(setup_dir=None, message=None, {"SCHEMADN": names.schemadn}) if ldap_backend_type == "fedora-ds": - setup_file(setup_path("fedora-ds.inf"), paths.fedoradsinf, + if ldap_backend_port is not None: + serverport = "ServerPort=%d" % ldap_backend_port + else: + serverport = "" + + setup_file(setup_path("fedorads.inf"), paths.fedoradsinf, {"ROOT": root, "HOSTNAME": hostname, "DNSDOMAIN": names.dnsdomain, @@ -1152,19 +1157,18 @@ def provision_backend(setup_dir=None, message=None, "DOMAINDN": names.domaindn, "LDAPMANAGERDN": names.ldapmanagerdn, "LDAPMANAGERPASS": adminpass, - "SERVERPORT": ""}) + "SERVERPORT": serverport}) - setup_file(setup_path("fedora-partitions.ldif"), paths.fedoradspartitions, + setup_file(setup_path("fedorads-partitions.ldif"), paths.fedoradspartitions, {"CONFIGDN": names.configdn, "SCHEMADN": names.schemadn, }) - setup_file(setup_path("fedora-partitions.ldif"), paths.fedoradspartitions, - {"CONFIGDN": names.configdn, - "SCHEMADN": names.schemadn, - }) mapping = "schema-map-fedora-ds-1.0" backend_schema = "99_ad.ldif" + + slapdcommand="Initailise Fedora DS with: setup-ds.pl --file=%s" % paths.fedoradsinf + elif ldap_backend_type == "openldap": attrs = ["linkID", "lDAPDisplayName"] res = schemadb.search(expression="(&(&(linkID=*)(!(linkID:1.2.840.113556.1.4.803:=1)))(objectclass=attributeSchema))", base=names.schemadn, scope=SCOPE_SUBTREE, attrs=attrs); @@ -1215,14 +1219,26 @@ refint_attributes""" + refint_attributes + "\n"; ldapi_uri = "ldapi://" + urllib.quote(os.path.join(paths.private_dir, "ldap", "ldapi"), safe="") - message("Start slapd with: slapd -f " + paths.ldapdir + "/slapd.conf -h " + ldapi_uri) - + if ldap_backend_port is not None: + server_port_string = " -h ldap://0.0.0.0:%d" % ldap_backend_port + else: + server_port_string = "" + slapdcommand="Start slapd with: slapd -f " + paths.ldapdir + "/slapd.conf -h " + ldapi_uri + server_port_string schema_command = "bin/ad2oLschema --option=convert:target=" + ldap_backend_type + " -I " + setup_path(mapping) + " -H tdb://" + schemadb_path + " -O " + os.path.join(paths.ldapdir, backend_schema); os.system(schema_command) + message("Your %s Backend for Samba4 is now configured, and is ready to be started" % ( ldap_backend_type) ) + message("Server Role: %s" % serverrole) + message("Hostname: %s" % names.hostname) + message("DNS Domain: %s" % names.dnsdomain) + message("Base DN: %s" % names.domaindn) + message("LDAP admin DN: %s" % names.ldapmanagerdn) + message("LDAP admin password: %s" % adminpass) + message(slapdcommand) + def create_phpldapadmin_config(path, setup_path, ldapi_uri): """Create a PHP LDAP admin configuration file. diff --git a/source4/selftest/target/Samba4.pm b/source4/selftest/target/Samba4.pm index 262c8035f6..552f6535af 100644 --- a/source4/selftest/target/Samba4.pm +++ b/source4/selftest/target/Samba4.pm @@ -201,8 +201,6 @@ sub mk_fedora_ds($$$) my $pidfile = "$fedora_ds_dir/logs/slapd-samba4.pid"; - system("$self->{bindir}/ad2oLschema $configuration -H $ldapdir/schema-tmp.ldb --option=convert:target=fedora-ds -I $self->{setupdir}/schema-map-fedora-ds-1.0 -O $ldapdir/99_ad.ldif >&2") == 0 or die("schema conversion for Fedora DS failed"); - my $dir = getcwd(); chdir "$ENV{FEDORA_DS_ROOT}/bin" || die; if (system("perl $ENV{FEDORA_DS_ROOT}/sbin/setup-ds.pl --silent --file=$fedora_ds_inf >&2") != 0) { @@ -222,9 +220,6 @@ sub mk_openldap($$$) my $pidfile = "$ldapdir/slapd.pid"; my $modconf = "$ldapdir/modules.conf"; - #This uses the backend provision we just did, to read out the schema - system("$self->{bindir}/ad2oLschema $configuration --option=convert:target=openldap -H $ldapdir/schema-tmp.ldb -I $self->{setupdir}/schema-map-openldap-2.3 -O $ldapdir/backend-schema.schema >&2") == 0 or die("schema conversion for OpenLDAP failed"); - my $oldpath = $ENV{PATH}; my $olpath = ""; my $olroot = ""; diff --git a/source4/setup/provision-backend b/source4/setup/provision-backend index ada6dcef8d..4f222c467a 100755 --- a/source4/setup/provision-backend +++ b/source4/setup/provision-backend @@ -54,6 +54,8 @@ parser.add_option("--quiet", help="Be quiet", action="store_true") parser.add_option("--ldap-backend-type", type="choice", metavar="LDAP-BACKEND-TYPE", help="LDB mapping module to use for the LDAP backend", choices=["fedora-ds", "openldap"]) +parser.add_option("--ldap-backend-port", type="int", metavar="PORT", + help="TCP Port LDAP server should listen to (default ldapi only)") parser.add_option("--server-role", type="choice", metavar="ROLE", choices=["domain controller", "dc", "member server", "member", "standalone"], help="Set server role to provision for (default standalone)") @@ -89,10 +91,9 @@ if setup_dir is None: setup_dir = "setup" provision_backend(setup_dir=setup_dir, message=message, smbconf=smbconf, targetdir=opts.targetdir, - realm=opts.realm, domain=opts.domain, - hostname=opts.host_name, - adminpass=opts.ldap_manager_pass, - root=opts.root, serverrole=server_role, - ldap_backend_type=opts.ldap_backend_type) - -message("All OK") + realm=opts.realm, domain=opts.domain, + hostname=opts.host_name, + adminpass=opts.ldap_manager_pass, + root=opts.root, serverrole=server_role, + ldap_backend_type=opts.ldap_backend_type, + ldap_backend_port=opts.ldap_backend_port) -- cgit From 8dd6f735bc6ff65a364ac65572529e8abf6f130a Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 8 Apr 2008 13:31:07 +0200 Subject: Set VENDORPREFIX rather than PREFIX to try to fix installation on some buildfarm hosts. (This used to be commit 2d9bb0db6c9e1e9b68844f2eede00fd249466cbb) --- source4/pidl/config.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source4/pidl/config.mk b/source4/pidl/config.mk index 0d36473ade..cdc3843d28 100644 --- a/source4/pidl/config.mk +++ b/source4/pidl/config.mk @@ -5,7 +5,7 @@ pidl-testcov: pidl/Makefile cd pidl && cover -test installpidl:: pidl/Makefile - $(MAKE) -C pidl install_vendor PREFIX=$(prefix) + $(MAKE) -C pidl install_vendor VENDORPREFIX=$(prefix) ifeq ($(HAVE_PERL_EXTUTILS_MAKEMAKER),1) install:: installpidl -- cgit From 5db62a16ff9b784c11c704b8083da9bf6e736f08 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 8 Apr 2008 14:19:26 +0200 Subject: Array lengths can be obtained from Python objects so remove them from the Python API. (This used to be commit 652810ff46c6db9034e930d0fb018a02ee385f15) --- source4/pidl/lib/Parse/Pidl/Samba4/Python.pm | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm index c04324e992..5d514c5f09 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm @@ -272,7 +272,21 @@ sub PythonFunctionBody($$$) my $signature = "S.$prettyname("; + my %metadata_args = (); + + sub get_var($) { my $x = shift; $x =~ s/\*//g; return $x; } + + # Determine arguments that are metadata for other arguments (size_is/length_is) + foreach my $e (@{$fn->{ELEMENTS}}) { + if (has_property($e, "length_is")) { + $metadata_args{get_var($e->{PROPERTIES}->{length_is})} = $e->{NAME}; + } elsif (has_property($e, "size_is")) { + $metadata_args{get_var($e->{PROPERTIES}->{size_is})} = $e->{NAME}; + } + } + foreach my $e (@{$fn->{ELEMENTS}}) { + next if ($metadata_args{$e->{NAME}}); $self->pidl("PyObject *py_$e->{NAME};"); if (grep(/out/,@{$e->{DIRECTION}})) { $result_size++; @@ -307,7 +321,16 @@ sub PythonFunctionBody($$$) } foreach my $e (@{$fn->{ELEMENTS}}) { - if (grep(/in/,@{$e->{DIRECTION}})) { + next unless (grep(/in/,@{$e->{DIRECTION}})); + if ($metadata_args{$e->{NAME}}) { + my $val = "PyList_Size(py_".$metadata_args{$e->{NAME}}.")"; + if ($e->{LEVELS}[0]->{TYPE} eq "POINTER") { + $self->pidl("r->in.$e->{NAME} = talloc_ptrtype(mem_ctx, r->in.$e->{NAME});"); + $self->pidl("*r->in.$e->{NAME} = $val;"); + } else { + $self->pidl("r->in.$e->{NAME} = PyList_Size(py_".$metadata_args{$e->{NAME}}.");"); + } + } else { $self->ConvertObjectFromPython($env, "mem_ctx", $e, "py_$e->{NAME}", "r->in.$e->{NAME}", "talloc_free(mem_ctx); return NULL;"); } } @@ -325,6 +348,7 @@ sub PythonFunctionBody($$$) } foreach my $e (@{$fn->{ELEMENTS}}) { + next if ($metadata_args{$e->{NAME}}); my $py_name = "py_$e->{NAME}"; if (grep(/out/,@{$e->{DIRECTION}})) { $self->ConvertObjectToPython("r", $env, $e, "r->out.$e->{NAME}", $py_name); -- cgit From 90c8841beff1fe8c492670811aacd3b92e296912 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 8 Apr 2008 14:56:09 +0200 Subject: Fix bug handling size arguments in a direction without actual data. (This used to be commit 169d505e9e2285aedc21547e44986b8b841b8e37) --- source4/pidl/lib/Parse/Pidl/Samba4/Python.pm | 33 ++++++++++++++++++---------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm index 5d514c5f09..2ab61e3246 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm @@ -272,21 +272,28 @@ sub PythonFunctionBody($$$) my $signature = "S.$prettyname("; - my %metadata_args = (); + my $metadata_args = { in => {}, out => {} }; sub get_var($) { my $x = shift; $x =~ s/\*//g; return $x; } # Determine arguments that are metadata for other arguments (size_is/length_is) foreach my $e (@{$fn->{ELEMENTS}}) { - if (has_property($e, "length_is")) { - $metadata_args{get_var($e->{PROPERTIES}->{length_is})} = $e->{NAME}; - } elsif (has_property($e, "size_is")) { - $metadata_args{get_var($e->{PROPERTIES}->{size_is})} = $e->{NAME}; + foreach my $dir (@{$e->{DIRECTION}}) { + my $main = undef; + if (has_property($e, "length_is")) { + $main = get_var($e->{PROPERTIES}->{length_is}); + } elsif (has_property($e, "size_is")) { + $main = get_var($e->{PROPERTIES}->{size_is}); + } + if ($main) { + $metadata_args->{$dir}->{$main} = $e->{NAME}; + } } } foreach my $e (@{$fn->{ELEMENTS}}) { - next if ($metadata_args{$e->{NAME}}); + next if (($metadata_args->{in}->{$e->{NAME}} and grep(/in/, @{$e->{DIRECTION}})) or + ($metadata_args->{out}->{$e->{NAME}}) and grep(/out/, @{$e->{DIRECTION}})); $self->pidl("PyObject *py_$e->{NAME};"); if (grep(/out/,@{$e->{DIRECTION}})) { $result_size++; @@ -315,23 +322,27 @@ sub PythonFunctionBody($$$) $self->pidl("return NULL;"); $self->deindent; $self->pidl("}"); + $self->pidl(""); if ($fn->{RETURN_TYPE}) { $result_size++ unless ($fn->{RETURN_TYPE} eq "WERROR" or $fn->{RETURN_TYPE} eq "NTSTATUS"); } + my $fail = "talloc_free(mem_ctx); return NULL;"; foreach my $e (@{$fn->{ELEMENTS}}) { next unless (grep(/in/,@{$e->{DIRECTION}})); - if ($metadata_args{$e->{NAME}}) { - my $val = "PyList_Size(py_".$metadata_args{$e->{NAME}}.")"; + if ($metadata_args->{in}->{$e->{NAME}}) { + my $py_var = "py_".$metadata_args->{in}->{$e->{NAME}}; + $self->pidl("PY_CHECK_TYPE(PyList, $py_var, $fail);"); + my $val = "PyList_Size($py_var)"; if ($e->{LEVELS}[0]->{TYPE} eq "POINTER") { $self->pidl("r->in.$e->{NAME} = talloc_ptrtype(mem_ctx, r->in.$e->{NAME});"); $self->pidl("*r->in.$e->{NAME} = $val;"); } else { - $self->pidl("r->in.$e->{NAME} = PyList_Size(py_".$metadata_args{$e->{NAME}}.");"); + $self->pidl("r->in.$e->{NAME} = $val;"); } } else { - $self->ConvertObjectFromPython($env, "mem_ctx", $e, "py_$e->{NAME}", "r->in.$e->{NAME}", "talloc_free(mem_ctx); return NULL;"); + $self->ConvertObjectFromPython($env, "mem_ctx", $e, "py_$e->{NAME}", "r->in.$e->{NAME}", $fail); } } $self->pidl("status = dcerpc_$fn->{NAME}(iface->pipe, mem_ctx, r);"); @@ -348,7 +359,7 @@ sub PythonFunctionBody($$$) } foreach my $e (@{$fn->{ELEMENTS}}) { - next if ($metadata_args{$e->{NAME}}); + next if ($metadata_args->{out}->{$e->{NAME}}); my $py_name = "py_$e->{NAME}"; if (grep(/out/,@{$e->{DIRECTION}})) { $self->ConvertObjectToPython("r", $env, $e, "r->out.$e->{NAME}", $py_name); -- cgit From ad823b04dab468379c7b42a8b849bb8a310cfb69 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 8 Apr 2008 14:58:38 +0200 Subject: Remove length arguments, add tests for unixinfo.GidToSid and unixinfo.UidToSid. (This used to be commit cae61e32e5b61a02c2986b74bd1d7e58460b1e80) --- source4/scripting/python/samba/tests/dcerpc/rpcecho.py | 2 +- source4/scripting/python/samba/tests/dcerpc/unix.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/source4/scripting/python/samba/tests/dcerpc/rpcecho.py b/source4/scripting/python/samba/tests/dcerpc/rpcecho.py index 8c1a8bec71..484af9490c 100644 --- a/source4/scripting/python/samba/tests/dcerpc/rpcecho.py +++ b/source4/scripting/python/samba/tests/dcerpc/rpcecho.py @@ -30,7 +30,7 @@ class RpcEchoTests(unittest.TestCase): self.assertEquals(2, self.conn.AddOne(1)) def test_echodata(self): - self.assertEquals([1,2,3], self.conn.EchoData(3, [1, 2, 3])) + self.assertEquals([1,2,3], self.conn.EchoData([1, 2, 3])) def test_call(self): self.assertEquals(u"foobar", self.conn.TestCall(u"foobar")) diff --git a/source4/scripting/python/samba/tests/dcerpc/unix.py b/source4/scripting/python/samba/tests/dcerpc/unix.py index 99c84c08da..b2577ec898 100644 --- a/source4/scripting/python/samba/tests/dcerpc/unix.py +++ b/source4/scripting/python/samba/tests/dcerpc/unix.py @@ -26,5 +26,11 @@ class UnixinfoTests(unittest.TestCase): self.conn = unixinfo.unixinfo("ncalrpc:", get_loadparm()) def test_getpwuid(self): - (count, infos) = self.conn.GetPWUid(1, [0]) - self.assertEquals(1, len(infos)) + infos = self.conn.GetPWUid(range(512)) + self.assertEquals(512, len(infos)) + + def test_gidtosid(self): + self.conn.GidToSid(1000) + + def test_uidtosid(self): + self.conn.UidToSid(1000) -- cgit From 66b529029a6d15d9d2f8cac8f863de618509a95e Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 8 Apr 2008 15:18:24 +0200 Subject: Clearer names for singleton return types. (This used to be commit 19d0560464304f79224a946278105edafb285453) --- source4/pidl/lib/Parse/Pidl/Samba4/Python.pm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm index 2ab61e3246..acaea99f6d 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm @@ -369,7 +369,7 @@ sub PythonFunctionBody($$$) $signature .= "$e->{NAME}, "; } else { $self->pidl("result = $py_name;"); - $signature .= "result"; + $signature .= $e->{NAME}; } } } @@ -382,11 +382,10 @@ sub PythonFunctionBody($$$) my $conv = $self->ConvertObjectToPythonData("r", $fn->{RETURN_TYPE}, "r->out.result"); if ($result_size > 1) { $self->pidl("PyTuple_SetItem(result, $i, $conv);"); - $signature .= "result"; } else { $self->pidl("result = $conv;"); - $signature .= "result"; } + $signature .= "result"; } if (substr($signature, -2) eq ", ") { -- cgit From edb3a83a069d39e123f18de098cfaab6deb16729 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 8 Apr 2008 10:25:51 +0200 Subject: BASE-DELAYWRITE: use timeval_* and make it possible to spefic the writetime update delay metze (This used to be commit 751ab2992afd13548af6e67a03d3ced566cb136f) --- source4/torture/basic/delaywrite.c | 265 +++++++++++++++++++++++-------------- 1 file changed, 164 insertions(+), 101 deletions(-) diff --git a/source4/torture/basic/delaywrite.c b/source4/torture/basic/delaywrite.c index e3d63c09ec..bc1cdbca96 100644 --- a/source4/torture/basic/delaywrite.c +++ b/source4/torture/basic/delaywrite.c @@ -40,7 +40,12 @@ static bool test_delayed_write_update(struct torture_context *tctx, struct smbcl int fnum1 = -1; bool ret = true; ssize_t written; - time_t t; + struct timeval start; + struct timeval end; + int used_delay = torture_setting_int(tctx, "writetimeupdatedelay", 2000000); + int normal_delay = 2000000; + double sec = ((double)used_delay) / ((double)normal_delay); + int msec = 1000 * sec; if (!torture_setup_dir(cli, BASEDIR)) { return false; @@ -68,7 +73,7 @@ static bool test_delayed_write_update(struct torture_context *tctx, struct smbcl /* 3 second delay to ensure we get past any 2 second time granularity (older systems may have that) */ - sleep(3); + msleep(3 * msec); written = smbcli_write(cli->tree, fnum1, 0, "x", 0, 1); @@ -78,9 +83,9 @@ static bool test_delayed_write_update(struct torture_context *tctx, struct smbcl return false; } - t = time(NULL); - - while (time(NULL) < t+120) { + start = timeval_current(); + end = timeval_add(&start, (120*sec), 0); + while (!timeval_expired(&end)) { status = smb_raw_fileinfo(cli->tree, tctx, &finfo2); if (!NT_STATUS_IS_OK(status)) { @@ -91,20 +96,22 @@ static bool test_delayed_write_update(struct torture_context *tctx, struct smbcl torture_comment(tctx, "write time %s\n", nt_time_string(tctx, finfo2.basic_info.out.write_time)); if (finfo1.basic_info.out.write_time != finfo2.basic_info.out.write_time) { - int diff = time(NULL) - t; - if (diff < 2) { - torture_comment(tctx, "Server updated write_time after %d seconds (wrong!)\n", - diff); + double diff = timeval_elapsed(&start); + if (diff < (2 * sec * 0.75)) { /* 0.75 to cope with vmware timing */ + torture_comment(tctx, "Server updated write_time after %.2f seconds" + "(1 sec == %.2f)(wrong!)\n", + diff, sec); ret = false; break; } - torture_comment(tctx, "Server updated write_time after %d seconds (correct)\n", - diff); + torture_comment(tctx, "Server updated write_time after %.2f seconds" + "(1 sec == %.2f)(correct)\n", + diff, sec); break; } - sleep(1); fflush(stdout); + msleep(1 * msec); } if (finfo1.basic_info.out.write_time == finfo2.basic_info.out.write_time) { @@ -135,7 +142,12 @@ static bool test_delayed_write_update2(struct torture_context *tctx, struct smbc int fnum2 = -1; bool ret = true; ssize_t written; - time_t t; + struct timeval start; + struct timeval end; + int used_delay = torture_setting_int(tctx, "writetimeupdatedelay", 2000000); + int normal_delay = 2000000; + double sec = ((double)used_delay) / ((double)normal_delay); + int msec = 1000 * sec; union smb_flush flsh; if (!torture_setup_dir(cli, BASEDIR)) { @@ -164,7 +176,7 @@ static bool test_delayed_write_update2(struct torture_context *tctx, struct smbc /* 3 second delay to ensure we get past any 2 second time granularity (older systems may have that) */ - sleep(3); + msleep(3 * msec); { /* Try using setfileinfo instead of write to update write time. */ @@ -251,12 +263,11 @@ static bool test_delayed_write_update2(struct torture_context *tctx, struct smbc return false; } - t = time(NULL); - /* Once the time was set using setfileinfo then it stays set - writes don't have any effect. But make sure. */ - - while (time(NULL) < t+15) { + start = timeval_current(); + end = timeval_add(&start, (15*sec), 0); + while (!timeval_expired(&end)) { status = smb_raw_fileinfo(cli->tree, tctx, &finfo2); if (!NT_STATUS_IS_OK(status)) { @@ -267,13 +278,15 @@ static bool test_delayed_write_update2(struct torture_context *tctx, struct smbc torture_comment(tctx, "write time %s\n", nt_time_string(tctx, finfo2.basic_info.out.write_time)); if (finfo1.basic_info.out.write_time != finfo2.basic_info.out.write_time) { - torture_comment(tctx, "Server updated write_time after %d seconds (wrong!)\n", - (int)(time(NULL) - t)); + double diff = timeval_elapsed(&start); + torture_comment(tctx, "Server updated write_time after %.2f seconds" + "(1sec == %.2f) (wrong!)\n", + diff, sec); ret = false; break; } - sleep(1); fflush(stdout); + msleep(1 * msec); } if (finfo1.basic_info.out.write_time == finfo2.basic_info.out.write_time) { @@ -339,12 +352,11 @@ static bool test_delayed_write_update2(struct torture_context *tctx, struct smbc ret = false; } - t = time(NULL); - /* Once the time was set using setfileinfo then it stays set - writes don't have any effect. But make sure. */ - - while (time(NULL) < t+15) { + start = timeval_current(); + end = timeval_add(&start, (15*sec), 0); + while (!timeval_expired(&end)) { status = smb_raw_fileinfo(cli->tree, tctx, &finfo2); if (!NT_STATUS_IS_OK(status)) { @@ -355,13 +367,15 @@ static bool test_delayed_write_update2(struct torture_context *tctx, struct smbc torture_comment(tctx, "write time %s\n", nt_time_string(tctx, finfo2.basic_info.out.write_time)); if (finfo1.basic_info.out.write_time != finfo2.basic_info.out.write_time) { - torture_comment(tctx, "Server updated write_time after %d seconds (wrong!)\n", - (int)(time(NULL) - t)); + double diff = timeval_elapsed(&start); + torture_comment(tctx, "Server updated write_time after %.2f seconds " + "(1sec == %.2f) (wrong!)\n", + diff, sec); ret = false; break; } - sleep(1); fflush(stdout); + msleep(1 * msec); } if (finfo1.basic_info.out.write_time == finfo2.basic_info.out.write_time) { @@ -393,7 +407,7 @@ static bool test_delayed_write_update2(struct torture_context *tctx, struct smbc torture_comment(tctx, "Second open initial write time %s\n", nt_time_string(tctx, finfo1.basic_info.out.write_time)); - sleep(10); + msleep(10 * msec); torture_comment(tctx, "Doing a 10 byte write to extend the file to see if this changes the last write time.\n"); written = smbcli_write(cli->tree, fnum1, 0, "0123456789", 31, 10); @@ -420,11 +434,10 @@ static bool test_delayed_write_update2(struct torture_context *tctx, struct smbc ret = false; } - t = time(NULL); - /* Now the write time should be updated again */ - - while (time(NULL) < t+15) { + start = timeval_current(); + end = timeval_add(&start, (15*sec), 0); + while (!timeval_expired(&end)) { status = smb_raw_fileinfo(cli->tree, tctx, &finfo2); if (!NT_STATUS_IS_OK(status)) { @@ -435,20 +448,22 @@ static bool test_delayed_write_update2(struct torture_context *tctx, struct smbc torture_comment(tctx, "write time %s\n", nt_time_string(tctx, finfo2.basic_info.out.write_time)); if (finfo1.basic_info.out.write_time != finfo2.basic_info.out.write_time) { - int diff = time(NULL) - t; - if (diff < 2) { - torture_comment(tctx, "Server updated write_time after %d seconds (wrong!)\n", - diff); + double diff = timeval_elapsed(&start); + if (diff < (2 * sec * 0.75)) { /* 0.75 to cope with vmware timing */ + torture_comment(tctx, "Server updated write_time after %.2f seconds" + "(1sec == %.2f) (wrong!)\n", + diff, sec); ret = false; break; } - torture_comment(tctx, "Server updated write_time after %d seconds (correct)\n", - diff); + torture_comment(tctx, "Server updated write_time after %.2f seconds" + "(1sec == %.2f) (correct)\n", + diff, sec); break; } - sleep(1); fflush(stdout); + msleep(1*msec); } if (finfo1.basic_info.out.write_time == finfo2.basic_info.out.write_time) { @@ -490,6 +505,10 @@ static bool test_finfo_after_write(struct torture_context *tctx, struct smbcli_s int fnum2; bool ret = true; ssize_t written; + int used_delay = torture_setting_int(tctx, "writetimeupdatedelay", 2000000); + int normal_delay = 2000000; + double sec = ((double)used_delay) / ((double)normal_delay); + int msec = 1000 * sec; if (!torture_setup_dir(cli, BASEDIR)) { return false; @@ -513,7 +532,7 @@ static bool test_finfo_after_write(struct torture_context *tctx, struct smbcli_s goto done; } - msleep(1000); + msleep(1 * msec); written = smbcli_write(cli->tree, fnum1, 0, "x", 0, 1); @@ -616,9 +635,9 @@ static bool test_finfo_after_write(struct torture_context *tctx, struct smbcli_s NTTIME g = (given).basic_info.out.write_time; \ NTTIME c = (correct).basic_info.out.write_time; \ if (g cmp c) { \ - torture_result(tctx, TORTURE_FAIL, __location__": wrong write_time (%s)%s %s (%s)%s", \ - #given, nt_time_string(tctx, g), \ - #cmp, #correct, nt_time_string(tctx, c)); \ + torture_result(tctx, TORTURE_FAIL, __location__": wrong write_time (%s)%s(%llu) %s (%s)%s(%llu)", \ + #given, nt_time_string(tctx, g), (unsigned long long)g, \ + #cmp, #correct, nt_time_string(tctx, c), (unsigned long long)c); \ ret = false; \ goto done; \ } \ @@ -724,7 +743,12 @@ static bool test_delayed_write_update3(struct torture_context *tctx, int fnum1 = -1; bool ret = true; ssize_t written; - time_t t; + struct timeval start; + struct timeval end; + int used_delay = torture_setting_int(tctx, "writetimeupdatedelay", 2000000); + int normal_delay = 2000000; + double sec = ((double)used_delay) / ((double)normal_delay); + int msec = 1000 * sec; if (!torture_setup_dir(cli, BASEDIR)) { return false; @@ -760,8 +784,9 @@ static bool test_delayed_write_update3(struct torture_context *tctx, * calcuated from the first write * (but expect upto 5 seconds extra time for a busy server) */ - t = time(NULL); - while (time(NULL) < t+7) { + start = timeval_current(); + end = timeval_add(&start, 7 * sec, 0); + while (!timeval_expired(&end)) { /* do a write */ torture_comment(tctx, "Do a write on the file handle\n"); written = smbcli_write(cli->tree, fnum1, 0, "x", 0, 1); @@ -774,26 +799,29 @@ static bool test_delayed_write_update3(struct torture_context *tctx, GET_INFO_FILE(finfo1); if (finfo1.basic_info.out.write_time > finfo0.basic_info.out.write_time) { - int diff = time(NULL) - t; - if (diff < 2) { - torture_comment(tctx, "Server updated write_time after %d seconds (wrong!)\n", - diff); + double diff = timeval_elapsed(&start); + if (diff < (2 * sec * 0.75)) { /* 0.75 to cope with vmware timing */ + torture_comment(tctx, "Server updated write_time after %.2f seconds " + "(1sec == %.2f) (wrong!)\n", + diff, sec); ret = false; break; } - torture_comment(tctx, "Server updated write_time after %d seconds (correct)\n", - diff); + torture_comment(tctx, "Server updated write_time after %.2f seconds " + "(1sec == %.2f) (correct)\n", + diff, sec); break; } - msleep(500); + msleep(0.5 * msec); } GET_INFO_BOTH(finfo1,pinfo1); /* sure any further write doesn't update the write time */ - t = time(NULL); - while (time(NULL) < t+15) { + start = timeval_current(); + end = timeval_add(&start, 15 * sec, 0); + while (!timeval_expired(&end)) { /* do a write */ torture_comment(tctx, "Do a write on the file handle\n"); written = smbcli_write(cli->tree, fnum1, 0, "x", 0, 1); @@ -806,12 +834,14 @@ static bool test_delayed_write_update3(struct torture_context *tctx, GET_INFO_BOTH(finfo2,pinfo2); if (finfo2.basic_info.out.write_time > finfo1.basic_info.out.write_time) { - torture_comment(tctx, "Server updated write_time after %d seconds (wrong!)\n", - (int)(time(NULL) - t)); + double diff = timeval_elapsed(&start); + torture_comment(tctx, "Server updated write_time after %.2f seconds " + "(1sec == %.2f) (wrong!)\n", + diff, sec); ret = false; break; } - msleep(2000); + msleep(2 * msec); } GET_INFO_BOTH(finfo2,pinfo2); @@ -821,7 +851,7 @@ static bool test_delayed_write_update3(struct torture_context *tctx, } /* sleep */ - msleep(5000); + msleep(5 * msec); GET_INFO_BOTH(finfo3,pinfo3); COMPARE_WRITE_TIME_EQUAL(finfo3, finfo2); @@ -860,7 +890,12 @@ static bool test_delayed_write_update4(struct torture_context *tctx, int fnum1 = -1; bool ret = true; ssize_t written; - time_t t; + struct timeval start; + struct timeval end; + int used_delay = torture_setting_int(tctx, "writetimeupdatedelay", 2000000); + int normal_delay = 2000000; + double sec = ((double)used_delay) / ((double)normal_delay); + int msec = 1000 * sec; if (!torture_setup_dir(cli, BASEDIR)) { return false; @@ -892,7 +927,7 @@ static bool test_delayed_write_update4(struct torture_context *tctx, GET_INFO_BOTH(finfo0,pinfo0); /* sleep a bit */ - msleep(5000); + msleep(5 * msec); /* do a write */ torture_comment(tctx, "Do a write on the file handle\n"); @@ -911,32 +946,36 @@ static bool test_delayed_write_update4(struct torture_context *tctx, * calcuated from the first write * (but expect upto 3 seconds extra time for a busy server) */ - t = time(NULL); - while (time(NULL) < t+5) { + start = timeval_current(); + end = timeval_add(&start, 5 * sec, 0); + while (!timeval_expired(&end)) { /* get the times after the first write */ GET_INFO_FILE(finfo1); if (finfo1.basic_info.out.write_time > finfo0.basic_info.out.write_time) { - int diff = time(NULL) - t; - if (diff < 2) { - torture_comment(tctx, "Server updated write_time after %d seconds (wrong!)\n", - diff); + double diff = timeval_elapsed(&start); + if (diff < (2 * sec * 0.75)) { /* 0.75 to cope with vmware timing */ + torture_comment(tctx, "Server updated write_time after %.2f seconds " + "(1sec == %.2f) (wrong!)\n", + diff, sec); ret = false; break; } - torture_comment(tctx, "Server updated write_time after %d seconds (correct)\n", - diff); + torture_comment(tctx, "Server updated write_time after %.2f seconds " + "(1sec == %.2f) (correct)\n", + diff, sec); break; } - msleep(500); + msleep(0.5 * msec); } GET_INFO_BOTH(finfo1,pinfo1); /* sure any further write doesn't update the write time */ - t = time(NULL); - while (time(NULL) < t+15) { + start = timeval_current(); + end = timeval_add(&start, 15 * sec, 0); + while (!timeval_expired(&end)) { /* do a write */ torture_comment(tctx, "Do a write on the file handle\n"); written = smbcli_write(cli->tree, fnum1, 0, "x", 0, 1); @@ -949,12 +988,14 @@ static bool test_delayed_write_update4(struct torture_context *tctx, GET_INFO_BOTH(finfo2,pinfo2); if (finfo2.basic_info.out.write_time > finfo1.basic_info.out.write_time) { - torture_comment(tctx, "Server updated write_time after %d seconds (wrong!)\n", - (int)(time(NULL) - t)); + double diff = timeval_elapsed(&start); + torture_comment(tctx, "Server updated write_time after %.2f seconds " + "(1sec == %.2f) (wrong!)\n", + diff, sec); ret = false; break; } - msleep(2000); + msleep(2 * msec); } GET_INFO_BOTH(finfo2,pinfo2); @@ -964,7 +1005,7 @@ static bool test_delayed_write_update4(struct torture_context *tctx, } /* sleep */ - msleep(5000); + msleep(5 * msec); GET_INFO_BOTH(finfo3,pinfo3); COMPARE_WRITE_TIME_EQUAL(finfo3, finfo2); @@ -1003,7 +1044,12 @@ static bool test_delayed_write_update5(struct torture_context *tctx, int fnum1 = -1; bool ret = true; ssize_t written; - time_t t; + struct timeval start; + struct timeval end; + int used_delay = torture_setting_int(tctx, "writetimeupdatedelay", 2000000); + int normal_delay = 2000000; + double sec = ((double)used_delay) / ((double)normal_delay); + int msec = 1000 * sec; if (!torture_setup_dir(cli, BASEDIR)) { return false; @@ -1059,19 +1105,22 @@ static bool test_delayed_write_update5(struct torture_context *tctx, COMPARE_WRITE_TIME_LESS(finfo2, finfo1); /* make sure the 2 second delay from the first write are canceled */ - t = time(NULL); - while (time(NULL) < t+15) { + start = timeval_current(); + end = timeval_add(&start, 15 * sec, 0); + while (!timeval_expired(&end)) { /* get the times after the first write */ GET_INFO_BOTH(finfo3,pinfo3); if (finfo3.basic_info.out.write_time > finfo2.basic_info.out.write_time) { - torture_comment(tctx, "Server updated write_time after %d seconds (wrong!)\n", - (int)(time(NULL) - t)); + double diff = timeval_elapsed(&start); + torture_comment(tctx, "Server updated write_time after %.2f seconds " + "(1sec == %.2f) (wrong!)\n", + diff, sec); ret = false; break; } - msleep(2000); + msleep(2 * msec); } GET_INFO_BOTH(finfo3,pinfo3); @@ -1081,8 +1130,9 @@ static bool test_delayed_write_update5(struct torture_context *tctx, } /* sure any further write doesn't update the write time */ - t = time(NULL); - while (time(NULL) < t+15) { + start = timeval_current(); + end = timeval_add(&start, 15 * sec, 0); + while (!timeval_expired(&end)) { /* do a write */ torture_comment(tctx, "Do a write on the file handle\n"); written = smbcli_write(cli->tree, fnum1, 0, "x", 0, 1); @@ -1095,12 +1145,14 @@ static bool test_delayed_write_update5(struct torture_context *tctx, GET_INFO_BOTH(finfo4,pinfo4); if (finfo4.basic_info.out.write_time > finfo3.basic_info.out.write_time) { - torture_comment(tctx, "Server updated write_time after %d seconds (wrong!)\n", - (int)(time(NULL) - t)); + double diff = timeval_elapsed(&start); + torture_comment(tctx, "Server updated write_time after %.2f seconds " + "(1sec == %.2f) (wrong!)\n", + diff, sec); ret = false; break; } - msleep(2000); + msleep(2 * msec); } GET_INFO_BOTH(finfo4,pinfo4); @@ -1110,7 +1162,7 @@ static bool test_delayed_write_update5(struct torture_context *tctx, } /* sleep */ - msleep(5000); + msleep(5 * msec); GET_INFO_BOTH(finfo5,pinfo5); COMPARE_WRITE_TIME_EQUAL(finfo5, finfo4); @@ -1149,7 +1201,12 @@ static bool test_delayed_write_update6(struct torture_context *tctx, int fnum2 = -1; bool ret = true; ssize_t written; - time_t t; + struct timeval start; + struct timeval end; + int used_delay = torture_setting_int(tctx, "writetimeupdatedelay", 2000000); + int normal_delay = 2000000; + double sec = ((double)used_delay) / ((double)normal_delay); + int msec = 1000 * sec; bool first = true; if (!torture_setup_dir(cli, BASEDIR)) { @@ -1217,19 +1274,22 @@ again: COMPARE_WRITE_TIME_LESS(finfo2, finfo1); /* make sure the 2 second delay from the first write are canceled */ - t = time(NULL); - while (time(NULL) < t+15) { + start = timeval_current(); + end = timeval_add(&start, 15 * sec, 0); + while (!timeval_expired(&end)) { /* get the times after the first write */ GET_INFO_BOTH(finfo3,pinfo3); if (finfo3.basic_info.out.write_time > finfo2.basic_info.out.write_time) { - torture_comment(tctx, "Server updated write_time after %d seconds (wrong!)\n", - (int)(time(NULL) - t)); + double diff = timeval_elapsed(&start); + torture_comment(tctx, "Server updated write_time after %.2f seconds " + "(1sec == %.2f) (wrong!)\n", + diff, sec); ret = false; break; } - msleep(2000); + msleep(2 * msec); } GET_INFO_BOTH(finfo3,pinfo3); @@ -1239,8 +1299,9 @@ again: } /* sure any further write doesn't update the write time */ - t = time(NULL); - while (time(NULL) < t+15) { + start = timeval_current(); + end = timeval_add(&start, 15 * sec, 0); + while (!timeval_expired(&end)) { /* do a write */ torture_comment(tctx, "Do a write on the file handle\n"); written = smbcli_write(cli->tree, fnum1, 0, "x", 0, 1); @@ -1253,12 +1314,14 @@ again: GET_INFO_BOTH(finfo4,pinfo4); if (finfo4.basic_info.out.write_time > finfo3.basic_info.out.write_time) { - torture_comment(tctx, "Server updated write_time after %d seconds (wrong!)\n", - (int)(time(NULL) - t)); + double diff = timeval_elapsed(&start); + torture_comment(tctx, "Server updated write_time after %.2f seconds " + "(1sec == %.2f) (wrong!)\n", + diff, sec); ret = false; break; } - msleep(2000); + msleep(2 * msec); } GET_INFO_BOTH(finfo4,pinfo4); @@ -1268,7 +1331,7 @@ again: } /* sleep */ - msleep(5000); + msleep(5 * msec); GET_INFO_BOTH(finfo5,pinfo5); COMPARE_WRITE_TIME_EQUAL(finfo5, finfo4); -- cgit From 4677ac6e70769bcc7f0c8bacdf000cdeb8c8089f Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 8 Apr 2008 19:04:44 +0200 Subject: BASE-DELAYWRITE: be more friendly to filesystems without high resolution timestamps metze (This used to be commit 9c18cf670889c9eb8c12b505c3b9ce5f9a516839) --- source4/torture/basic/delaywrite.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/source4/torture/basic/delaywrite.c b/source4/torture/basic/delaywrite.c index bc1cdbca96..84adfef61a 100644 --- a/source4/torture/basic/delaywrite.c +++ b/source4/torture/basic/delaywrite.c @@ -632,9 +632,20 @@ static bool test_finfo_after_write(struct torture_context *tctx, struct smbcli_s } #define COMPARE_WRITE_TIME_CMP(given, correct, cmp) do { \ + uint64_t r = 10*1000*1000; \ NTTIME g = (given).basic_info.out.write_time; \ + NTTIME gr = (g / r) * r; \ NTTIME c = (correct).basic_info.out.write_time; \ - if (g cmp c) { \ + NTTIME cr = (c / r) * r; \ + bool strict = torture_setting_bool(tctx, "strict mode", false); \ + bool err = false; \ + if (strict && (g cmp c)) { \ + err = true; \ + } else if (gr cmp cr) { \ + /* handle filesystem without high resolution timestamps */ \ + err = true; \ + } \ + if (err) { \ torture_result(tctx, TORTURE_FAIL, __location__": wrong write_time (%s)%s(%llu) %s (%s)%s(%llu)", \ #given, nt_time_string(tctx, g), (unsigned long long)g, \ #cmp, #correct, nt_time_string(tctx, c), (unsigned long long)c); \ -- cgit From 82c7872639d48a2791e409f8cd014978c4aa352f Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 9 Apr 2008 03:23:13 +0200 Subject: Move provision C bindings to param/. (This used to be commit 7d45ed0c3ebc57f7131603f768f8e022d7139530) --- source4/param/config.mk | 4 + source4/param/provision.c | 129 ++++++++++++++++++++++++++++++ source4/param/provision.h | 45 +++++++++++ source4/torture/config.mk | 4 +- source4/torture/libnet/libnet_BecomeDC.c | 1 + source4/torture/local/torture.c | 1 + source4/torture/util.h | 23 ------ source4/torture/util_provision.c | 130 ------------------------------- 8 files changed, 182 insertions(+), 155 deletions(-) create mode 100644 source4/param/provision.c create mode 100644 source4/param/provision.h delete mode 100644 source4/torture/util_provision.c diff --git a/source4/param/config.mk b/source4/param/config.mk index eee22cf1b8..064c293fa4 100644 --- a/source4/param/config.mk +++ b/source4/param/config.mk @@ -12,6 +12,10 @@ PRIVATE_PROTO_HEADER = proto.h PUBLIC_HEADERS += param/param.h +[SUBSYSTEM::PROVISION] +OBJ_FILES = provision.o +PRIVATE_DEPENDENCIES = LIBPYTHON + ################################# # Start SUBSYSTEM share [SUBSYSTEM::share] diff --git a/source4/param/provision.c b/source4/param/provision.c new file mode 100644 index 0000000000..5d1f01c59a --- /dev/null +++ b/source4/param/provision.c @@ -0,0 +1,129 @@ +/* + Unix SMB/CIFS implementation. + Samba utility functions + Copyright (C) Jelmer Vernooij 2008 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "includes.h" +#include "auth/auth.h" +#include "lib/ldb_wrap.h" +#include "libcli/raw/libcliraw.h" +#include "librpc/ndr/libndr.h" + +#include "param/param.h" +#include "param/provision.h" +#include +#include "scripting/python/modules.h" + +NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, + struct provision_settings *settings) +{ + PyObject *provision_mod, *provision_dict, *provision_fn, *result, *parameters; + + DEBUG(0,("Provision for Become-DC test using python\n")); + + py_load_samba_modules(); + Py_Initialize(); + py_update_path("bin"); /* FIXME: Can't assume this is always the case */ + + provision_mod = PyImport_Import(PyString_FromString("samba.provision")); + + if (provision_mod == NULL) { + PyErr_Print(); + DEBUG(0, ("Unable to import provision Python module.\n")); + return NT_STATUS_UNSUCCESSFUL; + } + + provision_dict = PyModule_GetDict(provision_mod); + + if (provision_dict == NULL) { + DEBUG(0, ("Unable to get dictionary for provision module\n")); + return NT_STATUS_UNSUCCESSFUL; + } + + provision_fn = PyDict_GetItemString(provision_dict, "provision_become_dc"); + if (provision_fn == NULL) { + PyErr_Print(); + DEBUG(0, ("Unable to get provision_become_dc function\n")); + return NT_STATUS_UNSUCCESSFUL; + } + + DEBUG(0,("New Server[%s] in Site[%s]\n", settings->dns_name, + settings->site_name)); + + DEBUG(0,("DSA Instance [%s]\n" + "\tobjectGUID[%s]\n" + "\tinvocationId[%s]\n", + settings->ntds_dn_str, + settings->ntds_guid == NULL?"None":GUID_string(mem_ctx, settings->ntds_guid), + settings->invocation_id == NULL?"None":GUID_string(mem_ctx, settings->invocation_id))); + + DEBUG(0,("Pathes under targetdir[%s]\n", + settings->targetdir)); + parameters = PyDict_New(); + + PyDict_SetItemString(parameters, "rootdn", + PyString_FromString(settings->root_dn_str)); + if (settings->targetdir != NULL) + PyDict_SetItemString(parameters, "targetdir", + PyString_FromString(settings->targetdir)); + PyDict_SetItemString(parameters, "setup_dir", + PyString_FromString("setup")); + PyDict_SetItemString(parameters, "hostname", + PyString_FromString(settings->netbios_name)); + PyDict_SetItemString(parameters, "domain", + PyString_FromString(settings->domain)); + PyDict_SetItemString(parameters, "realm", + PyString_FromString(settings->realm)); + if (settings->root_dn_str) + PyDict_SetItemString(parameters, "rootdn", + PyString_FromString(settings->root_dn_str)); + + if (settings->domain_dn_str) + PyDict_SetItemString(parameters, "domaindn", + PyString_FromString(settings->domain_dn_str)); + + if (settings->schema_dn_str) + PyDict_SetItemString(parameters, "schemadn", + PyString_FromString(settings->schema_dn_str)); + + if (settings->config_dn_str) + PyDict_SetItemString(parameters, "configdn", + PyString_FromString(settings->config_dn_str)); + + if (settings->server_dn_str) + PyDict_SetItemString(parameters, "serverdn", + PyString_FromString(settings->server_dn_str)); + + if (settings->site_name) + PyDict_SetItemString(parameters, "sitename", + PyString_FromString(settings->site_name)); + + PyDict_SetItemString(parameters, "machinepass", + PyString_FromString(settings->machine_password)); + + result = PyEval_CallObjectWithKeywords(provision_fn, NULL, parameters); + + Py_DECREF(parameters); + + if (result == NULL) { + PyErr_Print(); + PyErr_Clear(); + return NT_STATUS_UNSUCCESSFUL; + } + + return NT_STATUS_OK; +} diff --git a/source4/param/provision.h b/source4/param/provision.h new file mode 100644 index 0000000000..323159d417 --- /dev/null +++ b/source4/param/provision.h @@ -0,0 +1,45 @@ +/* + Unix SMB/CIFS implementation. + Samba utility functions + Copyright (C) Jelmer Vernooij 2008 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef _PROVISION_H_ +#define _PROVISION_H_ + +struct provision_settings { + const char *dns_name; + const char *site_name; + const char *root_dn_str; + const char *domain_dn_str; + const char *config_dn_str; + const char *schema_dn_str; + const char *server_dn_str; + const struct GUID *invocation_id; + const char *netbios_name; + const char *host_ip; + const char *realm; + const char *domain; + const struct GUID *ntds_guid; + const char *ntds_dn_str; + const char *machine_password; + const char *targetdir; +}; + +NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, + struct provision_settings *settings); + +#endif /* _PROVISION_H_ */ diff --git a/source4/torture/config.mk b/source4/torture/config.mk index 1d09d74f99..7acb1e0792 100644 --- a/source4/torture/config.mk +++ b/source4/torture/config.mk @@ -16,8 +16,8 @@ PUBLIC_DEPENDENCIES = \ PUBLIC_HEADERS += torture/torture.h torture/ui.h [SUBSYSTEM::TORTURE_UTIL] -OBJ_FILES = util_smb.o util_provision.o -PRIVATE_DEPENDENCIES = LIBCLI_RAW LIBPYTHON smbcalls +OBJ_FILES = util_smb.o +PRIVATE_DEPENDENCIES = LIBCLI_RAW LIBPYTHON smbcalls PROVISION PUBLIC_DEPENDENCIES = POPT_CREDENTIALS ################################# diff --git a/source4/torture/libnet/libnet_BecomeDC.c b/source4/torture/libnet/libnet_BecomeDC.c index f8699fe06a..bb5e8fe061 100644 --- a/source4/torture/libnet/libnet_BecomeDC.c +++ b/source4/torture/libnet/libnet_BecomeDC.c @@ -38,6 +38,7 @@ #include "auth/auth.h" #include "param/param.h" #include "torture/util.h" +#include "param/provision.h" struct test_become_dc_state { struct libnet_context *ctx; diff --git a/source4/torture/local/torture.c b/source4/torture/local/torture.c index 9bd60d9620..718bd38aad 100644 --- a/source4/torture/local/torture.c +++ b/source4/torture/local/torture.c @@ -25,6 +25,7 @@ #include "lib/events/events.h" #include "libcli/raw/libcliraw.h" #include "torture/util.h" +#include "param/provision.h" static bool test_tempdir(struct torture_context *tctx) { diff --git a/source4/torture/util.h b/source4/torture/util.h index 72f97e4766..1009fcf9f1 100644 --- a/source4/torture/util.h +++ b/source4/torture/util.h @@ -20,29 +20,6 @@ #ifndef _TORTURE_PROVISION_H_ #define _TORTURE_PROVISION_H_ -struct provision_settings { - const char *dns_name; - const char *site_name; - const char *root_dn_str; - const char *domain_dn_str; - const char *config_dn_str; - const char *schema_dn_str; - const char *server_dn_str; - const struct GUID *invocation_id; - const char *netbios_name; - const char *host_ip; - const char *realm; - const char *domain; - const struct GUID *ntds_guid; - const char *ntds_dn_str; - const char *machine_password; - const char *targetdir; -}; - -NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, - struct provision_settings *settings); - - /** setup a directory ready for a test */ diff --git a/source4/torture/util_provision.c b/source4/torture/util_provision.c deleted file mode 100644 index 3167a37cdf..0000000000 --- a/source4/torture/util_provision.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - Unix SMB/CIFS implementation. - Samba utility functions - Copyright (C) Jelmer Vernooij 2008 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#include "includes.h" -#include "auth/auth.h" -#include "lib/ldb_wrap.h" -#include "torture/torture.h" -#include "libcli/raw/libcliraw.h" -#include "torture/util.h" -#include "librpc/ndr/libndr.h" - -#include "param/param.h" -#include -#include "scripting/python/modules.h" - -NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, - struct provision_settings *settings) -{ - PyObject *provision_mod, *provision_dict, *provision_fn, *result, *parameters; - - DEBUG(0,("Provision for Become-DC test using python\n")); - - py_load_samba_modules(); - Py_Initialize(); - py_update_path("bin"); /* FIXME: Can't assume this is always the case */ - - provision_mod = PyImport_Import(PyString_FromString("samba.provision")); - - if (provision_mod == NULL) { - PyErr_Print(); - DEBUG(0, ("Unable to import provision Python module.\n")); - return NT_STATUS_UNSUCCESSFUL; - } - - provision_dict = PyModule_GetDict(provision_mod); - - if (provision_dict == NULL) { - DEBUG(0, ("Unable to get dictionary for provision module\n")); - return NT_STATUS_UNSUCCESSFUL; - } - - provision_fn = PyDict_GetItemString(provision_dict, "provision_become_dc"); - if (provision_fn == NULL) { - PyErr_Print(); - DEBUG(0, ("Unable to get provision_become_dc function\n")); - return NT_STATUS_UNSUCCESSFUL; - } - - DEBUG(0,("New Server[%s] in Site[%s]\n", settings->dns_name, - settings->site_name)); - - DEBUG(0,("DSA Instance [%s]\n" - "\tobjectGUID[%s]\n" - "\tinvocationId[%s]\n", - settings->ntds_dn_str, - settings->ntds_guid == NULL?"None":GUID_string(mem_ctx, settings->ntds_guid), - settings->invocation_id == NULL?"None":GUID_string(mem_ctx, settings->invocation_id))); - - DEBUG(0,("Pathes under targetdir[%s]\n", - settings->targetdir)); - parameters = PyDict_New(); - - PyDict_SetItemString(parameters, "rootdn", - PyString_FromString(settings->root_dn_str)); - if (settings->targetdir != NULL) - PyDict_SetItemString(parameters, "targetdir", - PyString_FromString(settings->targetdir)); - PyDict_SetItemString(parameters, "setup_dir", - PyString_FromString("setup")); - PyDict_SetItemString(parameters, "hostname", - PyString_FromString(settings->netbios_name)); - PyDict_SetItemString(parameters, "domain", - PyString_FromString(settings->domain)); - PyDict_SetItemString(parameters, "realm", - PyString_FromString(settings->realm)); - if (settings->root_dn_str) - PyDict_SetItemString(parameters, "rootdn", - PyString_FromString(settings->root_dn_str)); - - if (settings->domain_dn_str) - PyDict_SetItemString(parameters, "domaindn", - PyString_FromString(settings->domain_dn_str)); - - if (settings->schema_dn_str) - PyDict_SetItemString(parameters, "schemadn", - PyString_FromString(settings->schema_dn_str)); - - if (settings->config_dn_str) - PyDict_SetItemString(parameters, "configdn", - PyString_FromString(settings->config_dn_str)); - - if (settings->server_dn_str) - PyDict_SetItemString(parameters, "serverdn", - PyString_FromString(settings->server_dn_str)); - - if (settings->site_name) - PyDict_SetItemString(parameters, "sitename", - PyString_FromString(settings->site_name)); - - PyDict_SetItemString(parameters, "machinepass", - PyString_FromString(settings->machine_password)); - - result = PyEval_CallObjectWithKeywords(provision_fn, NULL, parameters); - - Py_DECREF(parameters); - - if (result == NULL) { - PyErr_Print(); - PyErr_Clear(); - return NT_STATUS_UNSUCCESSFUL; - } - - return NT_STATUS_OK; -} -- cgit From ac10ac62c1e9b64280f3566425af08210d57bb04 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 9 Apr 2008 03:51:41 +0200 Subject: Add docstring, PEP8. (This used to be commit f8cac3735c9a19baa313c4b61abee144da303ce1) --- source4/scripting/python/samba/provision.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py index 80dcd522df..c9cdcdb768 100644 --- a/source4/scripting/python/samba/provision.py +++ b/source4/scripting/python/samba/provision.py @@ -264,9 +264,11 @@ def provision_paths_from_lp(lp, dnsdomain): return paths + def guess_names(lp=None, hostname=None, domain=None, dnsdomain=None, serverrole=None, rootdn=None, domaindn=None, configdn=None, schemadn=None, serverdn=None, sitename=None): + """Guess configuration settings to use.""" if hostname is None: hostname = socket.gethostname().split(".")[0].lower() @@ -400,6 +402,7 @@ def load_or_make_smbconf(smbconf, setup_path, hostname, domain, realm, serverrol return lp + def setup_name_mappings(samdb, idmap, sid, domaindn, root_uid, nobody_uid, users_gid, wheel_gid): """setup reasonable name mappings for sam names to unix names. @@ -425,6 +428,7 @@ def setup_name_mappings(samdb, idmap, sid, domaindn, root_uid, nobody_uid, idmap.setup_name_mapping(sid + "-500", idmap.TYPE_UID, root_uid) idmap.setup_name_mapping(sid + "-513", idmap.TYPE_GID, users_gid) + def setup_samdb_partitions(samdb_path, setup_path, message, lp, session_info, credentials, names, serverrole, ldap_backend=None, @@ -637,6 +641,7 @@ def setup_registry(path, setup_path, session_info, credentials, lp): assert os.path.exists(provision_reg) reg.diff_apply(provision_reg) + def setup_idmapdb(path, setup_path, session_info, credentials, lp): """Setup the idmap database. @@ -656,6 +661,7 @@ def setup_idmapdb(path, setup_path, session_info, credentials, lp): idmap_ldb.load_ldif_file_add(setup_path("idmap_init.ldif")) return idmap_ldb + def setup_samdb_rootdse(samdb, setup_path, names): """Setup the SamDB rootdse. @@ -1060,6 +1066,7 @@ def provision(setup_dir, message, session_info, result.samdb = samdb return result + def provision_become_dc(setup_dir=None, smbconf=None, targetdir=None, realm=None, rootdn=None, domaindn=None, schemadn=None, configdn=None, @@ -1081,7 +1088,11 @@ def provision_become_dc(setup_dir=None, domain=domain, hostname=hostname, hostip="127.0.0.1", domainsid=domainsid, machinepass=machinepass, serverrole="domain controller", sitename=sitename); -def setup_db_config(setup_path, file, dbdir): +def setup_db_config(setup_path, dbdir): + """Setup a Berkeley database. + + :param setup_path: Setup path function. + :param dbdir: Database directory.""" if not os.path.isdir(os.path.join(dbdir, "bdb-logs")): os.makedirs(os.path.join(dbdir, "bdb-logs"), 0700); if not os.path.isdir(os.path.join(dbdir, "tmp")): @@ -1211,12 +1222,11 @@ refint_attributes""" + refint_attributes + "\n"; setup_file(setup_path("modules.conf"), paths.modulesconf, {"REALM": names.realm}) - setup_db_config(setup_path, file, os.path.join(paths.ldapdir, "db", "user")) - setup_db_config(setup_path, file, os.path.join(paths.ldapdir, "db", "config")) - setup_db_config(setup_path, file, os.path.join(paths.ldapdir, "db", "schema")) + setup_db_config(setup_path, file, os.path.join(paths.ldapdir, "user")) + setup_db_config(setup_path, file, os.path.join(paths.ldapdir, "config")) + setup_db_config(setup_path, file, os.path.join(paths.ldapdir, "schema")) mapping = "schema-map-openldap-2.3" backend_schema = "backend-schema.schema" - ldapi_uri = "ldapi://" + urllib.quote(os.path.join(paths.private_dir, "ldap", "ldapi"), safe="") if ldap_backend_port is not None: -- cgit From 2f8ac9a4221e4b7731422bd2ce05e59b5d75fb0a Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 9 Apr 2008 12:02:11 +1000 Subject: Start implementation of real 'net vampire' code. This will use DRS Replication (metze's thesis work) and possibly samsync, and will work outside the smbtorture process. Andrew Bartlett (This used to be commit 02a33165ca700f71cf09680ded35c87aa2e88552) --- source4/libnet/config.mk | 1 + source4/libnet/libnet.h | 1 + source4/libnet/libnet_samsync.c | 399 +++++++++++++++++ source4/libnet/libnet_samsync.h | 84 ++++ source4/libnet/libnet_vampire.c | 943 ++++++++++++++++++++++++++-------------- source4/libnet/libnet_vampire.h | 67 +-- 6 files changed, 1120 insertions(+), 375 deletions(-) create mode 100644 source4/libnet/libnet_samsync.c create mode 100644 source4/libnet/libnet_samsync.h diff --git a/source4/libnet/config.mk b/source4/libnet/config.mk index 00af6b37f2..f7325c0c28 100644 --- a/source4/libnet/config.mk +++ b/source4/libnet/config.mk @@ -10,6 +10,7 @@ OBJ_FILES = \ libnet_become_dc.o \ libnet_unbecome_dc.o \ libnet_vampire.o \ + libnet_samsync.o \ libnet_samdump.o \ libnet_samdump_keytab.o \ libnet_samsync_ldb.o \ diff --git a/source4/libnet/libnet.h b/source4/libnet/libnet.h index 015661a074..b65a13ce37 100644 --- a/source4/libnet/libnet.h +++ b/source4/libnet/libnet.h @@ -68,6 +68,7 @@ struct libnet_context { #include "libnet/libnet_site.h" #include "libnet/libnet_become_dc.h" #include "libnet/libnet_unbecome_dc.h" +#include "libnet/libnet_samsync.h" #include "libnet/libnet_vampire.h" #include "libnet/libnet_user.h" #include "libnet/libnet_group.h" diff --git a/source4/libnet/libnet_samsync.c b/source4/libnet/libnet_samsync.c new file mode 100644 index 0000000000..0f82d98673 --- /dev/null +++ b/source4/libnet/libnet_samsync.c @@ -0,0 +1,399 @@ +/* + Unix SMB/CIFS implementation. + + Extract the user/system database from a remote SamSync server + + Copyright (C) Andrew Bartlett 2004-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 "includes.h" +#include "libnet/libnet.h" +#include "libcli/auth/libcli_auth.h" +#include "auth/gensec/gensec.h" +#include "auth/credentials/credentials.h" +#include "auth/gensec/schannel_proto.h" +#include "librpc/gen_ndr/ndr_netlogon.h" +#include "librpc/gen_ndr/ndr_netlogon_c.h" +#include "param/param.h" + + +/** + * Decrypt and extract the user's passwords. + * + * The writes decrypted (no longer 'RID encrypted' or arcfour encrypted) passwords back into the structure + */ +static NTSTATUS fix_user(TALLOC_CTX *mem_ctx, + struct creds_CredentialState *creds, + bool rid_crypt, + enum netr_SamDatabaseID database, + struct netr_DELTA_ENUM *delta, + char **error_string) +{ + + uint32_t rid = delta->delta_id_union.rid; + struct netr_DELTA_USER *user = delta->delta_union.user; + struct samr_Password lm_hash; + struct samr_Password nt_hash; + const char *username = user->account_name.string; + + if (rid_crypt) { + if (user->lm_password_present) { + sam_rid_crypt(rid, user->lmpassword.hash, lm_hash.hash, 0); + user->lmpassword = lm_hash; + } + + if (user->nt_password_present) { + sam_rid_crypt(rid, user->ntpassword.hash, nt_hash.hash, 0); + user->ntpassword = nt_hash; + } + } + + if (user->user_private_info.SensitiveData) { + DATA_BLOB data; + struct netr_USER_KEYS keys; + enum ndr_err_code ndr_err; + data.data = user->user_private_info.SensitiveData; + data.length = user->user_private_info.DataLength; + creds_arcfour_crypt(creds, data.data, data.length); + user->user_private_info.SensitiveData = data.data; + user->user_private_info.DataLength = data.length; + + ndr_err = ndr_pull_struct_blob(&data, mem_ctx, NULL, &keys, (ndr_pull_flags_fn_t)ndr_pull_netr_USER_KEYS); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + *error_string = talloc_asprintf(mem_ctx, "Failed to parse Sensitive Data for %s:", username); + dump_data(10, data.data, data.length); + return ndr_map_error2ntstatus(ndr_err); + } + + if (keys.keys.keys2.lmpassword.length == 16) { + if (rid_crypt) { + sam_rid_crypt(rid, keys.keys.keys2.lmpassword.pwd.hash, lm_hash.hash, 0); + user->lmpassword = lm_hash; + } else { + user->lmpassword = keys.keys.keys2.lmpassword.pwd; + } + user->lm_password_present = true; + } + if (keys.keys.keys2.ntpassword.length == 16) { + if (rid_crypt) { + sam_rid_crypt(rid, keys.keys.keys2.ntpassword.pwd.hash, nt_hash.hash, 0); + user->ntpassword = nt_hash; + } else { + user->ntpassword = keys.keys.keys2.ntpassword.pwd; + } + user->nt_password_present = true; + } + /* TODO: rid decrypt history fields */ + } + return NT_STATUS_OK; +} + +/** + * Decrypt and extract the secrets + * + * The writes decrypted secrets back into the structure + */ +static NTSTATUS fix_secret(TALLOC_CTX *mem_ctx, + struct creds_CredentialState *creds, + enum netr_SamDatabaseID database, + struct netr_DELTA_ENUM *delta, + char **error_string) +{ + struct netr_DELTA_SECRET *secret = delta->delta_union.secret; + creds_arcfour_crypt(creds, secret->current_cipher.cipher_data, + secret->current_cipher.maxlen); + + creds_arcfour_crypt(creds, secret->old_cipher.cipher_data, + secret->old_cipher.maxlen); + + return NT_STATUS_OK; +} + +/** + * Fix up the delta, dealing with encryption issues so that the final + * callback need only do the printing or application logic + */ + +static NTSTATUS fix_delta(TALLOC_CTX *mem_ctx, + struct creds_CredentialState *creds, + bool rid_crypt, + enum netr_SamDatabaseID database, + struct netr_DELTA_ENUM *delta, + char **error_string) +{ + NTSTATUS nt_status = NT_STATUS_OK; + *error_string = NULL; + switch (delta->delta_type) { + case NETR_DELTA_USER: + { + nt_status = fix_user(mem_ctx, + creds, + rid_crypt, + database, + delta, + error_string); + break; + } + case NETR_DELTA_SECRET: + { + nt_status = fix_secret(mem_ctx, + creds, + database, + delta, + error_string); + break; + } + default: + break; + } + return nt_status; +} + +NTSTATUS libnet_SamSync_netlogon(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, struct libnet_SamSync *r) +{ + NTSTATUS nt_status, dbsync_nt_status; + TALLOC_CTX *samsync_ctx, *loop_ctx, *delta_ctx; + struct creds_CredentialState *creds; + struct netr_DatabaseSync dbsync; + struct cli_credentials *machine_account; + struct dcerpc_pipe *p; + struct libnet_context *machine_net_ctx; + struct libnet_RpcConnect *c; + struct libnet_SamSync_state *state; + const enum netr_SamDatabaseID database_ids[] = {SAM_DATABASE_DOMAIN, SAM_DATABASE_BUILTIN, SAM_DATABASE_PRIVS}; + int i; + + samsync_ctx = talloc_named(mem_ctx, 0, "SamSync top context"); + + if (!r->in.machine_account) { + machine_account = cli_credentials_init(samsync_ctx); + if (!machine_account) { + talloc_free(samsync_ctx); + return NT_STATUS_NO_MEMORY; + } + cli_credentials_set_conf(machine_account, ctx->lp_ctx); + nt_status = cli_credentials_set_machine_account(machine_account, ctx->lp_ctx); + if (!NT_STATUS_IS_OK(nt_status)) { + r->out.error_string = talloc_strdup(mem_ctx, "Could not obtain machine account password - are we joined to the domain?"); + talloc_free(samsync_ctx); + return nt_status; + } + } else { + machine_account = r->in.machine_account; + } + + /* We cannot do this unless we are a BDC. Check, before we get odd errors later */ + if (cli_credentials_get_secure_channel_type(machine_account) != SEC_CHAN_BDC) { + r->out.error_string + = talloc_asprintf(mem_ctx, + "Our join to domain %s is not as a BDC (%d), please rejoin as a BDC", + cli_credentials_get_domain(machine_account), + cli_credentials_get_secure_channel_type(machine_account)); + talloc_free(samsync_ctx); + return NT_STATUS_CANT_ACCESS_DOMAIN_INFO; + } + + c = talloc(samsync_ctx, struct libnet_RpcConnect); + if (!c) { + r->out.error_string = NULL; + talloc_free(samsync_ctx); + return NT_STATUS_NO_MEMORY; + } + + c->level = LIBNET_RPC_CONNECT_DC_INFO; + if (r->in.binding_string) { + c->in.binding = r->in.binding_string; + c->in.name = NULL; + } else { + c->in.binding = NULL; + c->in.name = cli_credentials_get_domain(machine_account); + } + + /* prepare connect to the NETLOGON pipe of PDC */ + c->in.dcerpc_iface = &ndr_table_netlogon; + + /* We must do this as the machine, not as any command-line + * user. So we override the credentials in the + * libnet_context */ + machine_net_ctx = talloc(samsync_ctx, struct libnet_context); + if (!machine_net_ctx) { + r->out.error_string = NULL; + talloc_free(samsync_ctx); + return NT_STATUS_NO_MEMORY; + } + *machine_net_ctx = *ctx; + machine_net_ctx->cred = machine_account; + + /* connect to the NETLOGON pipe of the PDC */ + nt_status = libnet_RpcConnect(machine_net_ctx, samsync_ctx, c); + if (!NT_STATUS_IS_OK(nt_status)) { + if (r->in.binding_string) { + r->out.error_string = talloc_asprintf(mem_ctx, + "Connection to NETLOGON pipe of DC %s failed: %s", + r->in.binding_string, c->out.error_string); + } else { + r->out.error_string = talloc_asprintf(mem_ctx, + "Connection to NETLOGON pipe of DC for %s failed: %s", + c->in.name, c->out.error_string); + } + talloc_free(samsync_ctx); + return nt_status; + } + + /* This makes a new pipe, on which we can do schannel. We + * should do this in the RpcConnect code, but the abstaction + * layers do not suit yet */ + + nt_status = dcerpc_secondary_connection(c->out.dcerpc_pipe, &p, + c->out.dcerpc_pipe->binding); + + if (!NT_STATUS_IS_OK(nt_status)) { + r->out.error_string = talloc_asprintf(mem_ctx, + "Secondary connection to NETLOGON pipe of DC %s failed: %s", + dcerpc_server_name(p), nt_errstr(nt_status)); + talloc_free(samsync_ctx); + return nt_status; + } + + nt_status = dcerpc_bind_auth_schannel(samsync_ctx, p, &ndr_table_netlogon, + machine_account, ctx->lp_ctx, DCERPC_AUTH_LEVEL_PRIVACY); + + if (!NT_STATUS_IS_OK(nt_status)) { + r->out.error_string = talloc_asprintf(mem_ctx, + "SCHANNEL authentication to NETLOGON pipe of DC %s failed: %s", + dcerpc_server_name(p), nt_errstr(nt_status)); + talloc_free(samsync_ctx); + return nt_status; + } + + state = talloc(samsync_ctx, struct libnet_SamSync_state); + if (!state) { + r->out.error_string = NULL; + talloc_free(samsync_ctx); + return nt_status; + } + + state->domain_name = c->out.domain_name; + state->domain_sid = c->out.domain_sid; + state->realm = c->out.realm; + state->domain_guid = c->out.guid; + state->machine_net_ctx = machine_net_ctx; + state->netlogon_pipe = p; + + /* initialise the callback layer. It may wish to contact the + * server with ldap, now we know the name */ + + if (r->in.init_fn) { + char *error_string; + nt_status = r->in.init_fn(samsync_ctx, + r->in.fn_ctx, + state, + &error_string); + if (!NT_STATUS_IS_OK(nt_status)) { + r->out.error_string = talloc_steal(mem_ctx, error_string); + talloc_free(samsync_ctx); + return nt_status; + } + } + + /* get NETLOGON credentials */ + + nt_status = dcerpc_schannel_creds(p->conn->security_state.generic_state, samsync_ctx, &creds); + if (!NT_STATUS_IS_OK(nt_status)) { + r->out.error_string = talloc_strdup(mem_ctx, "Could not obtain NETLOGON credentials from DCERPC/GENSEC layer"); + talloc_free(samsync_ctx); + return nt_status; + } + + /* Setup details for the synchronisation */ + dbsync.in.logon_server = talloc_asprintf(samsync_ctx, "\\\\%s", dcerpc_server_name(p)); + dbsync.in.computername = cli_credentials_get_workstation(machine_account); + dbsync.in.preferredmaximumlength = (uint32_t)-1; + ZERO_STRUCT(dbsync.in.return_authenticator); + + for (i=0;i< ARRAY_SIZE(database_ids); i++) { + dbsync.in.sync_context = 0; + dbsync.in.database_id = database_ids[i]; + + do { + int d; + loop_ctx = talloc_named(samsync_ctx, 0, "DatabaseSync loop context"); + creds_client_authenticator(creds, &dbsync.in.credential); + + dbsync_nt_status = dcerpc_netr_DatabaseSync(p, loop_ctx, &dbsync); + if (!NT_STATUS_IS_OK(dbsync_nt_status) && + !NT_STATUS_EQUAL(dbsync_nt_status, STATUS_MORE_ENTRIES)) { + r->out.error_string = talloc_asprintf(mem_ctx, "DatabaseSync failed - %s", nt_errstr(nt_status)); + talloc_free(samsync_ctx); + return nt_status; + } + + if (!creds_client_check(creds, &dbsync.out.return_authenticator.cred)) { + r->out.error_string = talloc_strdup(mem_ctx, "Credential chaining on incoming DatabaseSync failed"); + talloc_free(samsync_ctx); + return NT_STATUS_ACCESS_DENIED; + } + + dbsync.in.sync_context = dbsync.out.sync_context; + + /* For every single remote 'delta' entry: */ + for (d=0; d < dbsync.out.delta_enum_array->num_deltas; d++) { + char *error_string = NULL; + delta_ctx = talloc_named(loop_ctx, 0, "DatabaseSync delta context"); + /* 'Fix' elements, by decrypting and + * de-obfuscating the data */ + nt_status = fix_delta(delta_ctx, + creds, + r->in.rid_crypt, + dbsync.in.database_id, + &dbsync.out.delta_enum_array->delta_enum[d], + &error_string); + if (!NT_STATUS_IS_OK(nt_status)) { + r->out.error_string = talloc_steal(mem_ctx, error_string); + talloc_free(samsync_ctx); + return nt_status; + } + + /* Now call the callback. This will + * do something like print the data or + * write to an ldb */ + nt_status = r->in.delta_fn(delta_ctx, + r->in.fn_ctx, + dbsync.in.database_id, + &dbsync.out.delta_enum_array->delta_enum[d], + &error_string); + if (!NT_STATUS_IS_OK(nt_status)) { + r->out.error_string = talloc_steal(mem_ctx, error_string); + talloc_free(samsync_ctx); + return nt_status; + } + talloc_free(delta_ctx); + } + talloc_free(loop_ctx); + } while (NT_STATUS_EQUAL(dbsync_nt_status, STATUS_MORE_ENTRIES)); + + if (!NT_STATUS_IS_OK(dbsync_nt_status)) { + r->out.error_string = talloc_asprintf(mem_ctx, "libnet_SamSync_netlogon failed: unexpected inconsistancy. Should not get error %s here", nt_errstr(nt_status)); + talloc_free(samsync_ctx); + return dbsync_nt_status; + } + nt_status = NT_STATUS_OK; + } + talloc_free(samsync_ctx); + return nt_status; +} + diff --git a/source4/libnet/libnet_samsync.h b/source4/libnet/libnet_samsync.h new file mode 100644 index 0000000000..d2ac30fe14 --- /dev/null +++ b/source4/libnet/libnet_samsync.h @@ -0,0 +1,84 @@ +/* + Unix SMB/CIFS implementation. + + Copyright (C) Andrew Bartlett 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 "librpc/gen_ndr/netlogon.h" + +struct libnet_SamSync_state { + struct libnet_context *machine_net_ctx; + struct dcerpc_pipe *netlogon_pipe; + const char *domain_name; + const struct dom_sid *domain_sid; + const char *realm; + struct GUID *domain_guid; +}; + +/* struct and enum for doing a remote domain vampire dump */ +struct libnet_SamSync { + struct { + const char *binding_string; + bool rid_crypt; + NTSTATUS (*init_fn)(TALLOC_CTX *mem_ctx, + void *private, + struct libnet_SamSync_state *samsync_state, + char **error_string); + NTSTATUS (*delta_fn)(TALLOC_CTX *mem_ctx, + void *private, + enum netr_SamDatabaseID database, + struct netr_DELTA_ENUM *delta, + char **error_string); + void *fn_ctx; + struct cli_credentials *machine_account; + } in; + struct { + const char *error_string; + } out; +}; + +struct libnet_SamDump { + struct { + const char *binding_string; + struct cli_credentials *machine_account; + } in; + struct { + const char *error_string; + } out; +}; + +struct libnet_SamDump_keytab { + struct { + const char *binding_string; + const char *keytab_name; + struct cli_credentials *machine_account; + } in; + struct { + const char *error_string; + } out; +}; + +struct libnet_samsync_ldb { + struct { + const char *binding_string; + struct cli_credentials *machine_account; + struct auth_session_info *session_info; + } in; + struct { + const char *error_string; + } out; +}; + diff --git a/source4/libnet/libnet_vampire.c b/source4/libnet/libnet_vampire.c index 0f82d98673..cd9167f541 100644 --- a/source4/libnet/libnet_vampire.c +++ b/source4/libnet/libnet_vampire.c @@ -1,9 +1,11 @@ /* Unix SMB/CIFS implementation. - Extract the user/system database from a remote SamSync server + Extract the user/system database from a remote server - Copyright (C) Andrew Bartlett 2004-2005 + Copyright (C) Stefan Metzmacher 2004-2006 + Copyright (C) Brad Henry 2005 + Copyright (C) Andrew Bartlett 2005-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 @@ -22,378 +24,683 @@ #include "includes.h" #include "libnet/libnet.h" -#include "libcli/auth/libcli_auth.h" -#include "auth/gensec/gensec.h" -#include "auth/credentials/credentials.h" -#include "auth/gensec/schannel_proto.h" -#include "librpc/gen_ndr/ndr_netlogon.h" -#include "librpc/gen_ndr/ndr_netlogon_c.h" +#include "lib/events/events.h" +#include "dsdb/samdb/samdb.h" +#include "lib/util/dlinklist.h" +#include "lib/ldb/include/ldb.h" +#include "lib/ldb/include/ldb_errors.h" +#include "librpc/ndr/libndr.h" +#include "librpc/gen_ndr/ndr_drsuapi.h" +#include "librpc/gen_ndr/ndr_drsblobs.h" +#include "librpc/gen_ndr/ndr_misc.h" +#include "system/time.h" +#include "lib/ldb_wrap.h" +#include "auth/auth.h" #include "param/param.h" +/* +List of tasks vampire.py must perform: +- Domain Join + - but don't write the secrets.ldb + - results for this should be enough to handle the provision +- if vampire method is samsync + - Provision using these results + - do we still want to support this NT4 technology? +- Start samsync with libnet code + - provision in the callback +- Write out the secrets database, using the code from libnet_Join + +*/ +struct vampire_state { + struct libnet_context *ctx; + const char *netbios_name; + struct libnet_JoinDomain *join; + struct cli_credentials *machine_account; + struct dsdb_schema *self_made_schema; + const struct dsdb_schema *schema; + + struct ldb_context *ldb; -/** - * Decrypt and extract the user's passwords. - * - * The writes decrypted (no longer 'RID encrypted' or arcfour encrypted) passwords back into the structure - */ -static NTSTATUS fix_user(TALLOC_CTX *mem_ctx, - struct creds_CredentialState *creds, - bool rid_crypt, - enum netr_SamDatabaseID database, - struct netr_DELTA_ENUM *delta, - char **error_string) + struct { + uint32_t object_count; + struct drsuapi_DsReplicaObjectListItemEx *first_object; + struct drsuapi_DsReplicaObjectListItemEx *last_object; + } schema_part; + + const char *targetdir; + + struct loadparm_context *lp_ctx; +}; + +static NTSTATUS vampire_prepare_db(void *private_data, + const struct libnet_BecomeDC_PrepareDB *p) { + struct vampire_state *s = talloc_get_type(private_data, struct vampire_state); + struct provision_settings settings; + NTSTATUS status; + bool ok; + struct loadparm_context *lp_ctx = loadparm_init(s); + char *smbconf; + + if (!lp_ctx) { + return NT_STATUS_NO_MEMORY; + } - uint32_t rid = delta->delta_id_union.rid; - struct netr_DELTA_USER *user = delta->delta_union.user; - struct samr_Password lm_hash; - struct samr_Password nt_hash; - const char *username = user->account_name.string; + settings.site_name = p->dest_dsa->site_name; + settings.root_dn_str = p->forest->root_dn_str; + settings.domain_dn_str = p->domain->dn_str; + settings.config_dn_str = p->forest->config_dn_str; + settings.schema_dn_str = p->forest->schema_dn_str; + settings.netbios_name = p->dest_dsa->netbios_name; + settings.realm = s->join->out.realm; + settings.domain = s->join->out.domain; + settings.server_dn_str = p->dest_dsa->server_dn_str; + settings.machine_password = generate_random_str(s, 16); + settings.targetdir = s->targetdir; + + status = provision_bare(s, s->lp_ctx, &settings); + + smbconf = talloc_asprintf(lp_ctx, "%s/%s", s->targetdir, "/etc/smb.conf"); - if (rid_crypt) { - if (user->lm_password_present) { - sam_rid_crypt(rid, user->lmpassword.hash, lm_hash.hash, 0); - user->lmpassword = lm_hash; - } - - if (user->nt_password_present) { - sam_rid_crypt(rid, user->ntpassword.hash, nt_hash.hash, 0); - user->ntpassword = nt_hash; - } + ok = lp_load(lp_ctx, smbconf); + if (!ok) { + DEBUG(0,("Failed load freshly generated smb.conf '%s'\n", smbconf)); + return NT_STATUS_INVALID_PARAMETER; } - if (user->user_private_info.SensitiveData) { - DATA_BLOB data; - struct netr_USER_KEYS keys; - enum ndr_err_code ndr_err; - data.data = user->user_private_info.SensitiveData; - data.length = user->user_private_info.DataLength; - creds_arcfour_crypt(creds, data.data, data.length); - user->user_private_info.SensitiveData = data.data; - user->user_private_info.DataLength = data.length; - - ndr_err = ndr_pull_struct_blob(&data, mem_ctx, NULL, &keys, (ndr_pull_flags_fn_t)ndr_pull_netr_USER_KEYS); - if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { - *error_string = talloc_asprintf(mem_ctx, "Failed to parse Sensitive Data for %s:", username); - dump_data(10, data.data, data.length); - return ndr_map_error2ntstatus(ndr_err); + s->ldb = samdb_connect(s, lp_ctx, + system_session(s, lp_ctx)); + if (!s->ldb) { + DEBUG(0,("Failed to open '%s'\n", lp_sam_url(lp_ctx))); + return NT_STATUS_INTERNAL_DB_ERROR; + } + + /* We must set these up to ensure the replMetaData is written correctly, before our NTDS Settings entry is replicated */ + ok = samdb_set_ntds_invocation_id(s->ldb, &p->dest_dsa->invocation_id); + if (!ok) { + DEBUG(0,("Failed to set cached ntds invocationId\n")); + return NT_STATUS_FOOBAR; + } + ok = samdb_set_ntds_objectGUID(s->ldb, &p->dest_dsa->ntds_guid); + if (!ok) { + DEBUG(0,("Failed to set cached ntds objectGUID\n")); + return NT_STATUS_FOOBAR; + } + + s->lp_ctx = lp_ctx; + + return NT_STATUS_OK; + + +} + +static NTSTATUS vampire_check_options(void *private_data, + const struct libnet_BecomeDC_CheckOptions *o) +{ + struct vampire_state *s = talloc_get_type(private_data, struct vampire_state); + + DEBUG(0,("Become DC [%s] of Domain[%s]/[%s]\n", + s->netbios_name, + o->domain->netbios_name, o->domain->dns_name)); + + DEBUG(0,("Promotion Partner is Server[%s] from Site[%s]\n", + o->source_dsa->dns_name, o->source_dsa->site_name)); + + DEBUG(0,("Options:crossRef behavior_version[%u]\n" + "\tschema object_version[%u]\n" + "\tdomain behavior_version[%u]\n" + "\tdomain w2k3_update_revision[%u]\n", + o->forest->crossref_behavior_version, + o->forest->schema_object_version, + o->domain->behavior_version, + o->domain->w2k3_update_revision)); + + return NT_STATUS_OK; +} + +static NTSTATUS vampire_apply_schema(struct vampire_state *s, + const struct libnet_BecomeDC_StoreChunk *c) +{ + WERROR status; + const struct drsuapi_DsReplicaOIDMapping_Ctr *mapping_ctr; + uint32_t total_object_count; + uint32_t object_count; + struct drsuapi_DsReplicaObjectListItemEx *first_object; + struct drsuapi_DsReplicaObjectListItemEx *cur; + uint32_t linked_attributes_count; + struct drsuapi_DsReplicaLinkedAttribute *linked_attributes; + const struct drsuapi_DsReplicaCursor2CtrEx *uptodateness_vector; + struct dsdb_extended_replicated_objects *objs; + struct repsFromTo1 *s_dsa; + char *tmp_dns_name; + struct ldb_message *msg; + struct ldb_val prefixMap_val; + struct ldb_message_element *prefixMap_el; + struct ldb_val schemaInfo_val; + uint32_t i; + int ret; + bool ok; + + DEBUG(0,("Analyze and apply schema objects\n")); + + s_dsa = talloc_zero(s, struct repsFromTo1); + NT_STATUS_HAVE_NO_MEMORY(s_dsa); + s_dsa->other_info = talloc(s_dsa, struct repsFromTo1OtherInfo); + NT_STATUS_HAVE_NO_MEMORY(s_dsa->other_info); + + switch (c->ctr_level) { + case 1: + mapping_ctr = &c->ctr1->mapping_ctr; + total_object_count = c->ctr1->total_object_count; + object_count = s->schema_part.object_count; + first_object = s->schema_part.first_object; + linked_attributes_count = 0; + linked_attributes = NULL; + s_dsa->highwatermark = c->ctr1->new_highwatermark; + s_dsa->source_dsa_obj_guid = c->ctr1->source_dsa_guid; + s_dsa->source_dsa_invocation_id = c->ctr1->source_dsa_invocation_id; + uptodateness_vector = NULL; /* TODO: map it */ + break; + case 6: + mapping_ctr = &c->ctr6->mapping_ctr; + total_object_count = c->ctr6->total_object_count; + object_count = s->schema_part.object_count; + first_object = s->schema_part.first_object; + linked_attributes_count = 0; /* TODO: ! */ + linked_attributes = NULL; /* TODO: ! */; + s_dsa->highwatermark = c->ctr6->new_highwatermark; + s_dsa->source_dsa_obj_guid = c->ctr6->source_dsa_guid; + s_dsa->source_dsa_invocation_id = c->ctr6->source_dsa_invocation_id; + uptodateness_vector = c->ctr6->uptodateness_vector; + break; + default: + return NT_STATUS_INVALID_PARAMETER; + } + + s_dsa->replica_flags = DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE + | DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP + | DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS; + memset(s_dsa->schedule, 0x11, sizeof(s_dsa->schedule)); + + tmp_dns_name = GUID_string(s_dsa->other_info, &s_dsa->source_dsa_obj_guid); + NT_STATUS_HAVE_NO_MEMORY(tmp_dns_name); + tmp_dns_name = talloc_asprintf_append_buffer(tmp_dns_name, "._msdcs.%s", c->forest->dns_name); + NT_STATUS_HAVE_NO_MEMORY(tmp_dns_name); + s_dsa->other_info->dns_name = tmp_dns_name; + + for (cur = first_object; cur; cur = cur->next_object) { + bool is_attr = false; + bool is_class = false; + + for (i=0; i < cur->object.attribute_ctr.num_attributes; i++) { + struct drsuapi_DsReplicaAttribute *a; + uint32_t j; + const char *oid = NULL; + + a = &cur->object.attribute_ctr.attributes[i]; + status = dsdb_map_int2oid(s->self_made_schema, a->attid, s, &oid); + if (!W_ERROR_IS_OK(status)) { + return werror_to_ntstatus(status); + } + + switch (a->attid) { + case DRSUAPI_ATTRIBUTE_objectClass: + for (j=0; j < a->value_ctr.num_values; j++) { + uint32_t val = 0xFFFFFFFF; + + if (a->value_ctr.values[i].blob + && a->value_ctr.values[i].blob->length == 4) { + val = IVAL(a->value_ctr.values[i].blob->data,0); + } + + if (val == DRSUAPI_OBJECTCLASS_attributeSchema) { + is_attr = true; + } + if (val == DRSUAPI_OBJECTCLASS_classSchema) { + is_class = true; + } + } + + break; + default: + break; + } } - if (keys.keys.keys2.lmpassword.length == 16) { - if (rid_crypt) { - sam_rid_crypt(rid, keys.keys.keys2.lmpassword.pwd.hash, lm_hash.hash, 0); - user->lmpassword = lm_hash; - } else { - user->lmpassword = keys.keys.keys2.lmpassword.pwd; + if (is_attr) { + struct dsdb_attribute *sa; + + sa = talloc_zero(s->self_made_schema, struct dsdb_attribute); + NT_STATUS_HAVE_NO_MEMORY(sa); + + status = dsdb_attribute_from_drsuapi(s->self_made_schema, &cur->object, s, sa); + if (!W_ERROR_IS_OK(status)) { + return werror_to_ntstatus(status); } - user->lm_password_present = true; + + DLIST_ADD_END(s->self_made_schema->attributes, sa, struct dsdb_attribute *); } - if (keys.keys.keys2.ntpassword.length == 16) { - if (rid_crypt) { - sam_rid_crypt(rid, keys.keys.keys2.ntpassword.pwd.hash, nt_hash.hash, 0); - user->ntpassword = nt_hash; - } else { - user->ntpassword = keys.keys.keys2.ntpassword.pwd; + + if (is_class) { + struct dsdb_class *sc; + + sc = talloc_zero(s->self_made_schema, struct dsdb_class); + NT_STATUS_HAVE_NO_MEMORY(sc); + + status = dsdb_class_from_drsuapi(s->self_made_schema, &cur->object, s, sc); + if (!W_ERROR_IS_OK(status)) { + return werror_to_ntstatus(status); } - user->nt_password_present = true; + + DLIST_ADD_END(s->self_made_schema->classes, sc, struct dsdb_class *); } - /* TODO: rid decrypt history fields */ } - return NT_STATUS_OK; -} -/** - * Decrypt and extract the secrets - * - * The writes decrypted secrets back into the structure - */ -static NTSTATUS fix_secret(TALLOC_CTX *mem_ctx, - struct creds_CredentialState *creds, - enum netr_SamDatabaseID database, - struct netr_DELTA_ENUM *delta, - char **error_string) -{ - struct netr_DELTA_SECRET *secret = delta->delta_union.secret; - creds_arcfour_crypt(creds, secret->current_cipher.cipher_data, - secret->current_cipher.maxlen); + /* attach the schema to the ldb */ + ret = dsdb_set_schema(s->ldb, s->self_made_schema); + if (ret != LDB_SUCCESS) { + return NT_STATUS_FOOBAR; + } + /* we don't want to access the self made schema anymore */ + s->self_made_schema = NULL; + s->schema = dsdb_get_schema(s->ldb); + + status = dsdb_extended_replicated_objects_commit(s->ldb, + c->partition->nc.dn, + mapping_ctr, + object_count, + first_object, + linked_attributes_count, + linked_attributes, + s_dsa, + uptodateness_vector, + c->gensec_skey, + s, &objs); + if (!W_ERROR_IS_OK(status)) { + DEBUG(0,("Failed to commit objects: %s\n", win_errstr(status))); + return werror_to_ntstatus(status); + } - creds_arcfour_crypt(creds, secret->old_cipher.cipher_data, - secret->old_cipher.maxlen); + if (lp_parm_bool(s->lp_ctx, NULL, "become dc", "dump objects", false)) { + for (i=0; i < objs->num_objects; i++) { + struct ldb_ldif ldif; + fprintf(stdout, "#\n"); + ldif.changetype = LDB_CHANGETYPE_NONE; + ldif.msg = objs->objects[i].msg; + ldb_ldif_write_file(s->ldb, stdout, &ldif); + NDR_PRINT_DEBUG(replPropertyMetaDataBlob, objs->objects[i].meta_data); + } + } + + msg = ldb_msg_new(objs); + NT_STATUS_HAVE_NO_MEMORY(msg); + msg->dn = objs->partition_dn; + + status = dsdb_get_oid_mappings_ldb(s->schema, msg, &prefixMap_val, &schemaInfo_val); + if (!W_ERROR_IS_OK(status)) { + DEBUG(0,("Failed dsdb_get_oid_mappings_ldb(%s)\n", win_errstr(status))); + return werror_to_ntstatus(status); + } + + /* we only add prefixMap here, because schemaInfo is a replicated attribute and already applied */ + ret = ldb_msg_add_value(msg, "prefixMap", &prefixMap_val, &prefixMap_el); + if (ret != LDB_SUCCESS) { + return NT_STATUS_FOOBAR; + } + prefixMap_el->flags = LDB_FLAG_MOD_REPLACE; + + ret = ldb_modify(s->ldb, msg); + if (ret != LDB_SUCCESS) { + DEBUG(0,("Failed to add prefixMap and schemaInfo %s\n", ldb_strerror(ret))); + return NT_STATUS_FOOBAR; + } + + talloc_free(s_dsa); + talloc_free(objs); + + /* reopen the ldb */ + talloc_free(s->ldb); /* this also free's the s->schema, because dsdb_set_schema() steals it */ + s->schema = NULL; + + DEBUG(0,("Reopen the SAM LDB with system credentials and a already stored schema\n")); + s->ldb = samdb_connect(s, s->lp_ctx, + system_session(s, s->lp_ctx)); + if (!s->ldb) { + DEBUG(0,("Failed to reopen sam.ldb\n")); + return NT_STATUS_INTERNAL_DB_ERROR; + } + + /* We must set these up to ensure the replMetaData is written correctly, before our NTDS Settings entry is replicated */ + ok = samdb_set_ntds_invocation_id(s->ldb, &c->dest_dsa->invocation_id); + if (!ok) { + DEBUG(0,("Failed to set cached ntds invocationId\n")); + return NT_STATUS_FOOBAR; + } + ok = samdb_set_ntds_objectGUID(s->ldb, &c->dest_dsa->ntds_guid); + if (!ok) { + DEBUG(0,("Failed to set cached ntds objectGUID\n")); + return NT_STATUS_FOOBAR; + } + + s->schema = dsdb_get_schema(s->ldb); + if (!s->schema) { + DEBUG(0,("Failed to get loaded dsdb_schema\n")); + return NT_STATUS_FOOBAR; + } return NT_STATUS_OK; } -/** - * Fix up the delta, dealing with encryption issues so that the final - * callback need only do the printing or application logic - */ - -static NTSTATUS fix_delta(TALLOC_CTX *mem_ctx, - struct creds_CredentialState *creds, - bool rid_crypt, - enum netr_SamDatabaseID database, - struct netr_DELTA_ENUM *delta, - char **error_string) +static NTSTATUS vampire_schema_chunk(void *private_data, + const struct libnet_BecomeDC_StoreChunk *c) { - NTSTATUS nt_status = NT_STATUS_OK; - *error_string = NULL; - switch (delta->delta_type) { - case NETR_DELTA_USER: - { - nt_status = fix_user(mem_ctx, - creds, - rid_crypt, - database, - delta, - error_string); + struct vampire_state *s = talloc_get_type(private_data, struct vampire_state); + WERROR status; + const struct drsuapi_DsReplicaOIDMapping_Ctr *mapping_ctr; + uint32_t total_object_count; + uint32_t object_count; + struct drsuapi_DsReplicaObjectListItemEx *first_object; + struct drsuapi_DsReplicaObjectListItemEx *cur; + + switch (c->ctr_level) { + case 1: + mapping_ctr = &c->ctr1->mapping_ctr; + total_object_count = c->ctr1->total_object_count; + object_count = c->ctr1->object_count; + first_object = c->ctr1->first_object; break; - } - case NETR_DELTA_SECRET: - { - nt_status = fix_secret(mem_ctx, - creds, - database, - delta, - error_string); + case 6: + mapping_ctr = &c->ctr6->mapping_ctr; + total_object_count = c->ctr6->total_object_count; + object_count = c->ctr6->object_count; + first_object = c->ctr6->first_object; break; - } default: - break; + return NT_STATUS_INVALID_PARAMETER; } - return nt_status; -} -NTSTATUS libnet_SamSync_netlogon(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, struct libnet_SamSync *r) -{ - NTSTATUS nt_status, dbsync_nt_status; - TALLOC_CTX *samsync_ctx, *loop_ctx, *delta_ctx; - struct creds_CredentialState *creds; - struct netr_DatabaseSync dbsync; - struct cli_credentials *machine_account; - struct dcerpc_pipe *p; - struct libnet_context *machine_net_ctx; - struct libnet_RpcConnect *c; - struct libnet_SamSync_state *state; - const enum netr_SamDatabaseID database_ids[] = {SAM_DATABASE_DOMAIN, SAM_DATABASE_BUILTIN, SAM_DATABASE_PRIVS}; - int i; - - samsync_ctx = talloc_named(mem_ctx, 0, "SamSync top context"); - - if (!r->in.machine_account) { - machine_account = cli_credentials_init(samsync_ctx); - if (!machine_account) { - talloc_free(samsync_ctx); - return NT_STATUS_NO_MEMORY; + if (total_object_count) { + DEBUG(0,("Schema-DN[%s] objects[%u/%u]\n", + c->partition->nc.dn, object_count, total_object_count)); + } else { + DEBUG(0,("Schema-DN[%s] objects[%u]\n", + c->partition->nc.dn, object_count)); + } + + if (!s->schema) { + s->self_made_schema = dsdb_new_schema(s, lp_iconv_convenience(s->lp_ctx)); + + NT_STATUS_HAVE_NO_MEMORY(s->self_made_schema); + + status = dsdb_load_oid_mappings_drsuapi(s->self_made_schema, mapping_ctr); + if (!W_ERROR_IS_OK(status)) { + return werror_to_ntstatus(status); } - cli_credentials_set_conf(machine_account, ctx->lp_ctx); - nt_status = cli_credentials_set_machine_account(machine_account, ctx->lp_ctx); - if (!NT_STATUS_IS_OK(nt_status)) { - r->out.error_string = talloc_strdup(mem_ctx, "Could not obtain machine account password - are we joined to the domain?"); - talloc_free(samsync_ctx); - return nt_status; + + s->schema = s->self_made_schema; + } else { + status = dsdb_verify_oid_mappings_drsuapi(s->schema, mapping_ctr); + if (!W_ERROR_IS_OK(status)) { + return werror_to_ntstatus(status); } + } + + if (!s->schema_part.first_object) { + s->schema_part.object_count = object_count; + s->schema_part.first_object = talloc_steal(s, first_object); } else { - machine_account = r->in.machine_account; + s->schema_part.object_count += object_count; + s->schema_part.last_object->next_object = talloc_steal(s->schema_part.last_object, + first_object); } + for (cur = first_object; cur->next_object; cur = cur->next_object) {} + s->schema_part.last_object = cur; - /* We cannot do this unless we are a BDC. Check, before we get odd errors later */ - if (cli_credentials_get_secure_channel_type(machine_account) != SEC_CHAN_BDC) { - r->out.error_string - = talloc_asprintf(mem_ctx, - "Our join to domain %s is not as a BDC (%d), please rejoin as a BDC", - cli_credentials_get_domain(machine_account), - cli_credentials_get_secure_channel_type(machine_account)); - talloc_free(samsync_ctx); - return NT_STATUS_CANT_ACCESS_DOMAIN_INFO; + if (c->partition->highwatermark.tmp_highest_usn == c->partition->highwatermark.highest_usn) { + return vampire_apply_schema(s, c); } - c = talloc(samsync_ctx, struct libnet_RpcConnect); - if (!c) { - r->out.error_string = NULL; - talloc_free(samsync_ctx); - return NT_STATUS_NO_MEMORY; + return NT_STATUS_OK; +} + +static NTSTATUS vampire_store_chunk(void *private_data, + const struct libnet_BecomeDC_StoreChunk *c) +{ + struct vampire_state *s = talloc_get_type(private_data, struct vampire_state); + WERROR status; + const struct drsuapi_DsReplicaOIDMapping_Ctr *mapping_ctr; + uint32_t total_object_count; + uint32_t object_count; + struct drsuapi_DsReplicaObjectListItemEx *first_object; + uint32_t linked_attributes_count; + struct drsuapi_DsReplicaLinkedAttribute *linked_attributes; + const struct drsuapi_DsReplicaCursor2CtrEx *uptodateness_vector; + struct dsdb_extended_replicated_objects *objs; + struct repsFromTo1 *s_dsa; + char *tmp_dns_name; + uint32_t i; + + s_dsa = talloc_zero(s, struct repsFromTo1); + NT_STATUS_HAVE_NO_MEMORY(s_dsa); + s_dsa->other_info = talloc(s_dsa, struct repsFromTo1OtherInfo); + NT_STATUS_HAVE_NO_MEMORY(s_dsa->other_info); + + switch (c->ctr_level) { + case 1: + mapping_ctr = &c->ctr1->mapping_ctr; + total_object_count = c->ctr1->total_object_count; + object_count = c->ctr1->object_count; + first_object = c->ctr1->first_object; + linked_attributes_count = 0; + linked_attributes = NULL; + s_dsa->highwatermark = c->ctr1->new_highwatermark; + s_dsa->source_dsa_obj_guid = c->ctr1->source_dsa_guid; + s_dsa->source_dsa_invocation_id = c->ctr1->source_dsa_invocation_id; + uptodateness_vector = NULL; /* TODO: map it */ + break; + case 6: + mapping_ctr = &c->ctr6->mapping_ctr; + total_object_count = c->ctr6->total_object_count; + object_count = c->ctr6->object_count; + first_object = c->ctr6->first_object; + linked_attributes_count = c->ctr6->linked_attributes_count; + linked_attributes = c->ctr6->linked_attributes; + s_dsa->highwatermark = c->ctr6->new_highwatermark; + s_dsa->source_dsa_obj_guid = c->ctr6->source_dsa_guid; + s_dsa->source_dsa_invocation_id = c->ctr6->source_dsa_invocation_id; + uptodateness_vector = c->ctr6->uptodateness_vector; + break; + default: + return NT_STATUS_INVALID_PARAMETER; } - c->level = LIBNET_RPC_CONNECT_DC_INFO; - if (r->in.binding_string) { - c->in.binding = r->in.binding_string; - c->in.name = NULL; + s_dsa->replica_flags = DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE + | DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP + | DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS; + memset(s_dsa->schedule, 0x11, sizeof(s_dsa->schedule)); + + tmp_dns_name = GUID_string(s_dsa->other_info, &s_dsa->source_dsa_obj_guid); + NT_STATUS_HAVE_NO_MEMORY(tmp_dns_name); + tmp_dns_name = talloc_asprintf_append_buffer(tmp_dns_name, "._msdcs.%s", c->forest->dns_name); + NT_STATUS_HAVE_NO_MEMORY(tmp_dns_name); + s_dsa->other_info->dns_name = tmp_dns_name; + + if (total_object_count) { + DEBUG(0,("Partition[%s] objects[%u/%u]\n", + c->partition->nc.dn, object_count, total_object_count)); } else { - c->in.binding = NULL; - c->in.name = cli_credentials_get_domain(machine_account); + DEBUG(0,("Partition[%s] objects[%u]\n", + c->partition->nc.dn, object_count)); } - - /* prepare connect to the NETLOGON pipe of PDC */ - c->in.dcerpc_iface = &ndr_table_netlogon; - - /* We must do this as the machine, not as any command-line - * user. So we override the credentials in the - * libnet_context */ - machine_net_ctx = talloc(samsync_ctx, struct libnet_context); - if (!machine_net_ctx) { - r->out.error_string = NULL; - talloc_free(samsync_ctx); - return NT_STATUS_NO_MEMORY; + + status = dsdb_extended_replicated_objects_commit(s->ldb, + c->partition->nc.dn, + mapping_ctr, + object_count, + first_object, + linked_attributes_count, + linked_attributes, + s_dsa, + uptodateness_vector, + c->gensec_skey, + s, &objs); + if (!W_ERROR_IS_OK(status)) { + DEBUG(0,("Failed to commit objects: %s\n", win_errstr(status))); + return werror_to_ntstatus(status); } - *machine_net_ctx = *ctx; - machine_net_ctx->cred = machine_account; - - /* connect to the NETLOGON pipe of the PDC */ - nt_status = libnet_RpcConnect(machine_net_ctx, samsync_ctx, c); - if (!NT_STATUS_IS_OK(nt_status)) { - if (r->in.binding_string) { - r->out.error_string = talloc_asprintf(mem_ctx, - "Connection to NETLOGON pipe of DC %s failed: %s", - r->in.binding_string, c->out.error_string); - } else { - r->out.error_string = talloc_asprintf(mem_ctx, - "Connection to NETLOGON pipe of DC for %s failed: %s", - c->in.name, c->out.error_string); + + if (lp_parm_bool(s->lp_ctx, NULL, "become dc", "dump objects", false)) { + for (i=0; i < objs->num_objects; i++) { + struct ldb_ldif ldif; + fprintf(stdout, "#\n"); + ldif.changetype = LDB_CHANGETYPE_NONE; + ldif.msg = objs->objects[i].msg; + ldb_ldif_write_file(s->ldb, stdout, &ldif); + NDR_PRINT_DEBUG(replPropertyMetaDataBlob, objs->objects[i].meta_data); } - talloc_free(samsync_ctx); - return nt_status; } + talloc_free(s_dsa); + talloc_free(objs); - /* This makes a new pipe, on which we can do schannel. We - * should do this in the RpcConnect code, but the abstaction - * layers do not suit yet */ + for (i=0; i < linked_attributes_count; i++) { + const struct dsdb_attribute *sa; - nt_status = dcerpc_secondary_connection(c->out.dcerpc_pipe, &p, - c->out.dcerpc_pipe->binding); + if (!linked_attributes[i].identifier) { + return NT_STATUS_FOOBAR; + } - if (!NT_STATUS_IS_OK(nt_status)) { - r->out.error_string = talloc_asprintf(mem_ctx, - "Secondary connection to NETLOGON pipe of DC %s failed: %s", - dcerpc_server_name(p), nt_errstr(nt_status)); - talloc_free(samsync_ctx); - return nt_status; - } + if (!linked_attributes[i].value.blob) { + return NT_STATUS_FOOBAR; + } - nt_status = dcerpc_bind_auth_schannel(samsync_ctx, p, &ndr_table_netlogon, - machine_account, ctx->lp_ctx, DCERPC_AUTH_LEVEL_PRIVACY); + sa = dsdb_attribute_by_attributeID_id(s->schema, + linked_attributes[i].attid); + if (!sa) { + return NT_STATUS_FOOBAR; + } - if (!NT_STATUS_IS_OK(nt_status)) { - r->out.error_string = talloc_asprintf(mem_ctx, - "SCHANNEL authentication to NETLOGON pipe of DC %s failed: %s", - dcerpc_server_name(p), nt_errstr(nt_status)); - talloc_free(samsync_ctx); - return nt_status; + if (lp_parm_bool(s->lp_ctx, NULL, "become dc", "dump objects", false)) { + DEBUG(0,("# %s\n", sa->lDAPDisplayName)); + NDR_PRINT_DEBUG(drsuapi_DsReplicaLinkedAttribute, &linked_attributes[i]); + dump_data(0, + linked_attributes[i].value.blob->data, + linked_attributes[i].value.blob->length); + } } - state = talloc(samsync_ctx, struct libnet_SamSync_state); - if (!state) { - r->out.error_string = NULL; - talloc_free(samsync_ctx); - return nt_status; - } - - state->domain_name = c->out.domain_name; - state->domain_sid = c->out.domain_sid; - state->realm = c->out.realm; - state->domain_guid = c->out.guid; - state->machine_net_ctx = machine_net_ctx; - state->netlogon_pipe = p; - - /* initialise the callback layer. It may wish to contact the - * server with ldap, now we know the name */ + return NT_STATUS_OK; +} + +NTSTATUS libnet_vampire(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, + struct libnet_vampire *r) +{ + struct libnet_JoinDomain *join; + struct libnet_BecomeDC b; + struct libnet_UnbecomeDC u; + struct vampire_state *s; + struct ldb_message *msg; + int ldb_ret; + uint32_t i; + NTSTATUS status; + + const char *account_name; + const char *netbios_name; - if (r->in.init_fn) { - char *error_string; - nt_status = r->in.init_fn(samsync_ctx, - r->in.fn_ctx, - state, - &error_string); - if (!NT_STATUS_IS_OK(nt_status)) { - r->out.error_string = talloc_steal(mem_ctx, error_string); - talloc_free(samsync_ctx); - return nt_status; + r->out.error_string = NULL; + + s = talloc_zero(mem_ctx , struct vampire_state); + if (!s) { + return NT_STATUS_NO_MEMORY; + } + + join = talloc_zero(s, struct libnet_JoinDomain); + if (!join) { + return NT_STATUS_NO_MEMORY; + } + + if (r->in.netbios_name != NULL) { + netbios_name = r->in.netbios_name; + } else { + netbios_name = talloc_reference(join, lp_netbios_name(ctx->lp_ctx)); + if (!netbios_name) { + r->out.error_string = NULL; + talloc_free(s); + return NT_STATUS_NO_MEMORY; } } - /* get NETLOGON credentials */ + account_name = talloc_asprintf(join, "%s$", netbios_name); + if (!account_name) { + r->out.error_string = NULL; + talloc_free(s); + return NT_STATUS_NO_MEMORY; + } + + join->in.domain_name = r->in.domain_name; + join->in.account_name = account_name; + join->in.netbios_name = netbios_name; + join->in.level = LIBNET_JOINDOMAIN_AUTOMATIC; + join->in.acct_type = ACB_WSTRUST; + join->in.recreate_account = false; + status = libnet_JoinDomain(ctx, join, join); + if (!NT_STATUS_IS_OK(status)) { + r->out.error_string = talloc_steal(mem_ctx, join->out.error_string); + talloc_free(s); + return status; + } + + s->join = join; + + ZERO_STRUCT(b); + b.in.domain_dns_name = join->out.realm; + b.in.domain_netbios_name = join->out.domain_name; + b.in.domain_sid = join->out.domain_sid; + b.in.source_dsa_address = join->out.samr_binding->host; + b.in.dest_dsa_netbios_name = netbios_name; + + b.in.callbacks.private_data = s; + b.in.callbacks.check_options = vampire_check_options; + b.in.callbacks.prepare_db = vampire_prepare_db; + b.in.callbacks.schema_chunk = vampire_schema_chunk; + b.in.callbacks.config_chunk = vampire_store_chunk; + b.in.callbacks.domain_chunk = vampire_store_chunk; + + status = libnet_BecomeDC(s->ctx, s, &b); + if (!NT_STATUS_IS_OK(status)) { + printf("libnet_BecomeDC() failed - %s\n", nt_errstr(status)); + talloc_free(s); + return status; + } - nt_status = dcerpc_schannel_creds(p->conn->security_state.generic_state, samsync_ctx, &creds); - if (!NT_STATUS_IS_OK(nt_status)) { - r->out.error_string = talloc_strdup(mem_ctx, "Could not obtain NETLOGON credentials from DCERPC/GENSEC layer"); - talloc_free(samsync_ctx); - return nt_status; + msg = ldb_msg_new(s); + if (!msg) { + printf("ldb_msg_new() failed\n"); + talloc_free(s); + return NT_STATUS_NO_MEMORY; + } + msg->dn = ldb_dn_new(msg, s->ldb, "@ROOTDSE"); + if (!msg->dn) { + printf("ldb_msg_new(@ROOTDSE) failed\n"); + talloc_free(s); + return NT_STATUS_NO_MEMORY; } - /* Setup details for the synchronisation */ - dbsync.in.logon_server = talloc_asprintf(samsync_ctx, "\\\\%s", dcerpc_server_name(p)); - dbsync.in.computername = cli_credentials_get_workstation(machine_account); - dbsync.in.preferredmaximumlength = (uint32_t)-1; - ZERO_STRUCT(dbsync.in.return_authenticator); + ldb_ret = ldb_msg_add_string(msg, "isSynchronized", "TRUE"); + if (ldb_ret != LDB_SUCCESS) { + printf("ldb_msg_add_string(msg, isSynchronized, TRUE) failed: %d\n", ldb_ret); + talloc_free(s); + return NT_STATUS_NO_MEMORY; + } - for (i=0;i< ARRAY_SIZE(database_ids); i++) { - dbsync.in.sync_context = 0; - dbsync.in.database_id = database_ids[i]; - - do { - int d; - loop_ctx = talloc_named(samsync_ctx, 0, "DatabaseSync loop context"); - creds_client_authenticator(creds, &dbsync.in.credential); - - dbsync_nt_status = dcerpc_netr_DatabaseSync(p, loop_ctx, &dbsync); - if (!NT_STATUS_IS_OK(dbsync_nt_status) && - !NT_STATUS_EQUAL(dbsync_nt_status, STATUS_MORE_ENTRIES)) { - r->out.error_string = talloc_asprintf(mem_ctx, "DatabaseSync failed - %s", nt_errstr(nt_status)); - talloc_free(samsync_ctx); - return nt_status; - } - - if (!creds_client_check(creds, &dbsync.out.return_authenticator.cred)) { - r->out.error_string = talloc_strdup(mem_ctx, "Credential chaining on incoming DatabaseSync failed"); - talloc_free(samsync_ctx); - return NT_STATUS_ACCESS_DENIED; - } - - dbsync.in.sync_context = dbsync.out.sync_context; - - /* For every single remote 'delta' entry: */ - for (d=0; d < dbsync.out.delta_enum_array->num_deltas; d++) { - char *error_string = NULL; - delta_ctx = talloc_named(loop_ctx, 0, "DatabaseSync delta context"); - /* 'Fix' elements, by decrypting and - * de-obfuscating the data */ - nt_status = fix_delta(delta_ctx, - creds, - r->in.rid_crypt, - dbsync.in.database_id, - &dbsync.out.delta_enum_array->delta_enum[d], - &error_string); - if (!NT_STATUS_IS_OK(nt_status)) { - r->out.error_string = talloc_steal(mem_ctx, error_string); - talloc_free(samsync_ctx); - return nt_status; - } + for (i=0; i < msg->num_elements; i++) { + msg->elements[i].flags = LDB_FLAG_MOD_REPLACE; + } - /* Now call the callback. This will - * do something like print the data or - * write to an ldb */ - nt_status = r->in.delta_fn(delta_ctx, - r->in.fn_ctx, - dbsync.in.database_id, - &dbsync.out.delta_enum_array->delta_enum[d], - &error_string); - if (!NT_STATUS_IS_OK(nt_status)) { - r->out.error_string = talloc_steal(mem_ctx, error_string); - talloc_free(samsync_ctx); - return nt_status; - } - talloc_free(delta_ctx); - } - talloc_free(loop_ctx); - } while (NT_STATUS_EQUAL(dbsync_nt_status, STATUS_MORE_ENTRIES)); - - if (!NT_STATUS_IS_OK(dbsync_nt_status)) { - r->out.error_string = talloc_asprintf(mem_ctx, "libnet_SamSync_netlogon failed: unexpected inconsistancy. Should not get error %s here", nt_errstr(nt_status)); - talloc_free(samsync_ctx); - return dbsync_nt_status; - } - nt_status = NT_STATUS_OK; + printf("mark ROOTDSE with isSynchronized=TRUE\n"); + ldb_ret = ldb_modify(s->ldb, msg); + if (ldb_ret != LDB_SUCCESS) { + printf("ldb_modify() failed: %d\n", ldb_ret); + talloc_free(s); + return NT_STATUS_INTERNAL_DB_ERROR; } - talloc_free(samsync_ctx); - return nt_status; } - diff --git a/source4/libnet/libnet_vampire.h b/source4/libnet/libnet_vampire.h index d2ac30fe14..af461139ff 100644 --- a/source4/libnet/libnet_vampire.h +++ b/source4/libnet/libnet_vampire.h @@ -1,7 +1,9 @@ /* Unix SMB/CIFS implementation. - + + Copyright (C) Stefan Metzmacher 2004 Copyright (C) Andrew Bartlett 2005 + Copyright (C) Brad Henry 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 @@ -17,68 +19,19 @@ along with this program. If not, see . */ -#include "librpc/gen_ndr/netlogon.h" - -struct libnet_SamSync_state { - struct libnet_context *machine_net_ctx; - struct dcerpc_pipe *netlogon_pipe; - const char *domain_name; - const struct dom_sid *domain_sid; - const char *realm; - struct GUID *domain_guid; -}; - -/* struct and enum for doing a remote domain vampire dump */ -struct libnet_SamSync { - struct { - const char *binding_string; - bool rid_crypt; - NTSTATUS (*init_fn)(TALLOC_CTX *mem_ctx, - void *private, - struct libnet_SamSync_state *samsync_state, - char **error_string); - NTSTATUS (*delta_fn)(TALLOC_CTX *mem_ctx, - void *private, - enum netr_SamDatabaseID database, - struct netr_DELTA_ENUM *delta, - char **error_string); - void *fn_ctx; - struct cli_credentials *machine_account; - } in; - struct { - const char *error_string; - } out; -}; - -struct libnet_SamDump { - struct { - const char *binding_string; - struct cli_credentials *machine_account; - } in; - struct { - const char *error_string; - } out; -}; +#ifndef __LIBNET_VAMPIRE_H__ +#define __LIBNET_VAMPIRE_H__ -struct libnet_SamDump_keytab { +struct libnet_vampire { struct { - const char *binding_string; - const char *keytab_name; - struct cli_credentials *machine_account; + const char *domain_name; + const char *netbios_name; } in; + struct { const char *error_string; } out; }; -struct libnet_samsync_ldb { - struct { - const char *binding_string; - struct cli_credentials *machine_account; - struct auth_session_info *session_info; - } in; - struct { - const char *error_string; - } out; -}; +#endif /* __LIBNET_VAMPIRE_H__ */ -- cgit From e8a3621a8fdf4b76dc64edcd391b71eb4e63adfd Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 9 Apr 2008 14:51:22 +1000 Subject: Be consistant in using ${SEVERDN}. This ensures we don't fall out of sync with the provision scripts. Andrew Bartlett (This used to be commit 566c60b4649e2b94bf467993acd4bf72c7368e5a) --- source4/setup/provision.ldif | 4 ++-- source4/setup/provision_basedn_modify.ldif | 2 +- source4/setup/provision_configuration.ldif | 2 +- source4/setup/provision_schema_basedn_modify.ldif | 2 +- source4/setup/provision_self_join.ldif | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/source4/setup/provision.ldif b/source4/setup/provision.ldif index 37b6bdaa60..2f734e83b2 100644 --- a/source4/setup/provision.ldif +++ b/source4/setup/provision.ldif @@ -30,7 +30,7 @@ objectclass: rIDManager cn: RID Manager$ systemFlags: 2348810240 isCriticalSystemObject: TRUE -fSMORoleOwner: CN=NTDS Settings,CN=${NETBIOSNAME},CN=Servers,CN=${DEFAULTSITE},CN=Sites,${CONFIGDN} +fSMORoleOwner: CN=NTDS Settings,${SERVERDN} rIDAvailablePool: 4611686014132423217 dn: CN=DomainUpdates,CN=System,${DOMAINDN} @@ -50,7 +50,7 @@ objectclass: infrastructureUpdate cn: Infrastructure systemFlags: 2348810240 isCriticalSystemObject: TRUE -fSMORoleOwner: CN=NTDS Settings,CN=${NETBIOSNAME},CN=Servers,CN=${DEFAULTSITE},CN=Sites,${CONFIGDN} +fSMORoleOwner: CN=NTDS Settings,${SERVERDN} dn: CN=Builtin,${DOMAINDN} objectClass: top diff --git a/source4/setup/provision_basedn_modify.ldif b/source4/setup/provision_basedn_modify.ldif index dadfda720e..f5e1bb5add 100644 --- a/source4/setup/provision_basedn_modify.ldif +++ b/source4/setup/provision_basedn_modify.ldif @@ -65,7 +65,7 @@ replace: objectCategory objectCategory: CN=Domain-DNS,${SCHEMADN} - replace: fSMORoleOwner -fSMORoleOwner: CN=NTDS Settings,CN=${NETBIOSNAME},CN=Servers,CN=${DEFAULTSITE},CN=Sites,${CONFIGDN} +fSMORoleOwner: CN=NTDS Settings,${SERVERDN} - replace: isCriticalSystemObject isCriticalSystemObject: TRUE diff --git a/source4/setup/provision_configuration.ldif b/source4/setup/provision_configuration.ldif index 0fe90b0739..2a7357d7ad 100644 --- a/source4/setup/provision_configuration.ldif +++ b/source4/setup/provision_configuration.ldif @@ -7,7 +7,7 @@ objectClass: crossRefContainer cn: Partitions systemFlags: 2147483648 msDS-Behavior-Version: 0 -fSMORoleOwner: CN=NTDS Settings,CN=${NETBIOSNAME},CN=Servers,CN=${DEFAULTSITE},CN=Sites,${CONFIGDN} +fSMORoleOwner: CN=NTDS Settings,${SERVERDN} dn: CN=Enterprise Configuration,CN=Partitions,${CONFIGDN} objectClass: top diff --git a/source4/setup/provision_schema_basedn_modify.ldif b/source4/setup/provision_schema_basedn_modify.ldif index 4e690376d7..4e8267a303 100644 --- a/source4/setup/provision_schema_basedn_modify.ldif +++ b/source4/setup/provision_schema_basedn_modify.ldif @@ -4,7 +4,7 @@ dn: ${SCHEMADN} changetype: modify replace: fSMORoleOwner -fSMORoleOwner: CN=NTDS Settings,CN=${NETBIOSNAME},CN=Servers,CN=${DEFAULTSITE},CN=Sites,${CONFIGDN} +fSMORoleOwner: CN=NTDS Settings,${SERVERDN} - replace: objectVersion objectVersion: 30 diff --git a/source4/setup/provision_self_join.ldif b/source4/setup/provision_self_join.ldif index a0cfa7eb23..c91e2f4c19 100644 --- a/source4/setup/provision_self_join.ldif +++ b/source4/setup/provision_self_join.ldif @@ -36,7 +36,7 @@ isCriticalSystemObject: TRUE sambaPassword:: ${DNSPASS_B64} showInAdvancedViewOnly: TRUE -dn: CN=${NETBIOSNAME},CN=Servers,CN=${DEFAULTSITE},CN=Sites,${CONFIGDN} +dn: ${SERVERDN} objectClass: top objectClass: server cn: ${NETBIOSNAME} @@ -44,7 +44,7 @@ systemFlags: 1375731712 dNSHostName: ${DNSNAME} serverReference: CN=${NETBIOSNAME},OU=Domain Controllers,${DOMAINDN} -dn: CN=NTDS Settings,CN=${NETBIOSNAME},CN=Servers,CN=${DEFAULTSITE},CN=Sites,${CONFIGDN} +dn: CN=NTDS Settings,${SERVERDN} objectClass: top objectClass: applicationSettings objectClass: nTDSDSA -- cgit From 3f990fdf7c8735d3cf34d7407bd844b1c268e23f Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 9 Apr 2008 14:55:01 +1000 Subject: Remove dns_name element This is only used in the DEBUG() message, so let's remove it. Andrew Bartlett (This used to be commit 5ebb64bdad7e80ee81d6b9d84d77c03fb9237eee) --- source4/param/provision.c | 4 ++-- source4/param/provision.h | 1 - source4/torture/libnet/libnet_BecomeDC.c | 1 - 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/source4/param/provision.c b/source4/param/provision.c index 5d1f01c59a..a15993ffc8 100644 --- a/source4/param/provision.c +++ b/source4/param/provision.c @@ -61,8 +61,8 @@ NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, return NT_STATUS_UNSUCCESSFUL; } - DEBUG(0,("New Server[%s] in Site[%s]\n", settings->dns_name, - settings->site_name)); + DEBUG(0,("New Server in Site[%s]\n", + settings->site_name)); DEBUG(0,("DSA Instance [%s]\n" "\tobjectGUID[%s]\n" diff --git a/source4/param/provision.h b/source4/param/provision.h index 323159d417..38a66966c8 100644 --- a/source4/param/provision.h +++ b/source4/param/provision.h @@ -21,7 +21,6 @@ #define _PROVISION_H_ struct provision_settings { - const char *dns_name; const char *site_name; const char *root_dn_str; const char *domain_dn_str; diff --git a/source4/torture/libnet/libnet_BecomeDC.c b/source4/torture/libnet/libnet_BecomeDC.c index bb5e8fe061..07dd0ddd81 100644 --- a/source4/torture/libnet/libnet_BecomeDC.c +++ b/source4/torture/libnet/libnet_BecomeDC.c @@ -76,7 +76,6 @@ static NTSTATUS test_become_dc_prepare_db(void *private_data, return NT_STATUS_NO_MEMORY; } - settings.dns_name = p->dest_dsa->dns_name; settings.site_name = p->dest_dsa->site_name; settings.root_dn_str = p->forest->root_dn_str; settings.domain_dn_str = p->domain->dn_str; -- cgit From 29b25a1b043b1564a25765d553f3950cd5edb782 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 9 Apr 2008 14:56:24 +1000 Subject: Factor out filling in the secrets database. This allows the vampire code to start with a join, but fill in the secrets only when the process is compleated. Andrew Bartlett (This used to be commit c90751040e941d10234131852815e1cec1a54efe) --- source4/libnet/libnet_join.c | 196 +++++++++++++++++++++++++------------------ source4/libnet/libnet_join.h | 17 ++++ 2 files changed, 133 insertions(+), 80 deletions(-) diff --git a/source4/libnet/libnet_join.c b/source4/libnet/libnet_join.c index 22134518d6..4549cd6e93 100644 --- a/source4/libnet/libnet_join.c +++ b/source4/libnet/libnet_join.c @@ -839,13 +839,11 @@ NTSTATUS libnet_JoinDomain(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, stru return status; } -static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx, - TALLOC_CTX *mem_ctx, - struct libnet_Join *r) +NTSTATUS libnet_set_join_secrets(struct libnet_context *ctx, + TALLOC_CTX *mem_ctx, + struct libnet_set_join_secrets *r) { - NTSTATUS status; TALLOC_CTX *tmp_mem; - struct libnet_JoinDomain *r2; int ret, rtn; struct ldb_context *ldb; struct ldb_dn *base_dn; @@ -860,56 +858,13 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx, "privateKeytab", NULL }; - uint32_t acct_type = 0; - const char *account_name; - const char *netbios_name; - - r->out.error_string = NULL; tmp_mem = talloc_new(mem_ctx); if (!tmp_mem) { return NT_STATUS_NO_MEMORY; } - r2 = talloc(tmp_mem, struct libnet_JoinDomain); - if (!r2) { - r->out.error_string = NULL; - talloc_free(tmp_mem); - return NT_STATUS_NO_MEMORY; - } - - if (r->in.join_type == SEC_CHAN_BDC) { - acct_type = ACB_SVRTRUST; - } else if (r->in.join_type == SEC_CHAN_WKSTA) { - acct_type = ACB_WSTRUST; - } else { - r->out.error_string = NULL; - talloc_free(tmp_mem); - return NT_STATUS_INVALID_PARAMETER; - } - - if (r->in.netbios_name != NULL) { - netbios_name = r->in.netbios_name; - } else { - netbios_name = talloc_reference(tmp_mem, lp_netbios_name(ctx->lp_ctx)); - if (!netbios_name) { - r->out.error_string = NULL; - talloc_free(tmp_mem); - return NT_STATUS_NO_MEMORY; - } - } - - account_name = talloc_asprintf(tmp_mem, "%s$", netbios_name); - if (!account_name) { - r->out.error_string = NULL; - talloc_free(tmp_mem); - return NT_STATUS_NO_MEMORY; - } - - /* - * Local secrets are stored in secrets.ldb - * open it to make sure we can write the info into it after the join - */ + /* Open the secrets database */ ldb = secrets_db_connect(tmp_mem, ctx->lp_ctx); if (!ldb) { r->out.error_string @@ -919,23 +874,6 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx, return NT_STATUS_CANT_ACCESS_DOMAIN_INFO; } - /* - * join the domain - */ - ZERO_STRUCTP(r2); - r2->in.domain_name = r->in.domain_name; - r2->in.account_name = account_name; - r2->in.netbios_name = netbios_name; - r2->in.level = LIBNET_JOINDOMAIN_AUTOMATIC; - r2->in.acct_type = acct_type; - r2->in.recreate_account = false; - status = libnet_JoinDomain(ctx, r2, r2); - if (!NT_STATUS_IS_OK(status)) { - r->out.error_string = talloc_steal(mem_ctx, r2->out.error_string); - talloc_free(tmp_mem); - return status; - } - /* * now prepare the record for secrets.ldb */ @@ -961,21 +899,21 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx, } msg->dn = ldb_dn_copy(tmp_mem, base_dn); - if ( ! ldb_dn_add_child_fmt(msg->dn, "flatname=%s", r2->out.domain_name)) { + if ( ! ldb_dn_add_child_fmt(msg->dn, "flatname=%s", r->in.domain_name)) { r->out.error_string = NULL; talloc_free(tmp_mem); return NT_STATUS_NO_MEMORY; } - rtn = samdb_msg_add_string(ldb, tmp_mem, msg, "flatname", r2->out.domain_name); + rtn = samdb_msg_add_string(ldb, tmp_mem, msg, "flatname", r->in.domain_name); if (rtn == -1) { r->out.error_string = NULL; talloc_free(tmp_mem); return NT_STATUS_NO_MEMORY; } - if (r2->out.realm) { - rtn = samdb_msg_add_string(ldb, tmp_mem, msg, "realm", r2->out.realm); + if (r->in.realm) { + rtn = samdb_msg_add_string(ldb, tmp_mem, msg, "realm", r->in.realm); if (rtn == -1) { r->out.error_string = NULL; talloc_free(tmp_mem); @@ -997,14 +935,14 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx, return NT_STATUS_NO_MEMORY; } - rtn = samdb_msg_add_string(ldb, tmp_mem, msg, "secret", r2->out.join_password); + rtn = samdb_msg_add_string(ldb, tmp_mem, msg, "secret", r->in.join_password); if (rtn == -1) { r->out.error_string = NULL; talloc_free(tmp_mem); return NT_STATUS_NO_MEMORY; } - rtn = samdb_msg_add_string(ldb, tmp_mem, msg, "samAccountName", r2->in.account_name); + rtn = samdb_msg_add_string(ldb, tmp_mem, msg, "samAccountName", r->in.account_name); if (rtn == -1) { r->out.error_string = NULL; talloc_free(tmp_mem); @@ -1018,9 +956,9 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx, return NT_STATUS_NO_MEMORY; } - if (r2->out.kvno) { + if (r->in.kvno) { rtn = samdb_msg_add_uint(ldb, tmp_mem, msg, "msDS-KeyVersionNumber", - r2->out.kvno); + r->in.kvno); if (rtn == -1) { r->out.error_string = NULL; talloc_free(tmp_mem); @@ -1028,9 +966,9 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx, } } - if (r2->out.domain_sid) { + if (r->in.domain_sid) { rtn = samdb_msg_add_dom_sid(ldb, tmp_mem, msg, "objectSid", - r2->out.domain_sid); + r->in.domain_sid); if (rtn == -1) { r->out.error_string = NULL; talloc_free(tmp_mem); @@ -1047,7 +985,7 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx, tmp_mem, base_dn, &msgs, attrs, "(|" SECRETS_PRIMARY_DOMAIN_FILTER "(realm=%s))", - r2->out.domain_name, r2->out.realm); + r->in.domain_name, r->in.realm); if (ret == 0) { rtn = samdb_msg_set_string(ldb, tmp_mem, msg, "secretsKeytab", "secrets.keytab"); if (rtn == -1) { @@ -1059,7 +997,7 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx, r->out.error_string = talloc_asprintf(mem_ctx, "Search for domain: %s and realm: %s failed: %s", - r2->out.domain_name, r2->out.realm, ldb_errstring(ldb)); + r->in.domain_name, r->in.realm, ldb_errstring(ldb)); talloc_free(tmp_mem); return NT_STATUS_INTERNAL_DB_CORRUPTION; } else { @@ -1082,7 +1020,7 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx, return NT_STATUS_NO_MEMORY; } } - rtn = samdb_msg_set_string(ldb, tmp_mem, msg, "secret", r2->out.join_password); + rtn = samdb_msg_set_string(ldb, tmp_mem, msg, "secret", r->in.join_password); if (rtn == -1) { r->out.error_string = NULL; talloc_free(tmp_mem); @@ -1101,7 +1039,7 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx, } } - rtn = samdb_msg_set_string(ldb, tmp_mem, msg, "samAccountName", r2->in.account_name); + rtn = samdb_msg_set_string(ldb, tmp_mem, msg, "samAccountName", r->in.account_name); if (rtn == -1) { r->out.error_string = NULL; talloc_free(tmp_mem); @@ -1146,6 +1084,104 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx, return NT_STATUS_INTERNAL_DB_CORRUPTION; } + return NT_STATUS_OK; +} + +static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx, + TALLOC_CTX *mem_ctx, + struct libnet_Join *r) +{ + NTSTATUS status; + TALLOC_CTX *tmp_mem; + struct libnet_JoinDomain *r2; + struct libnet_set_join_secrets *r3; + uint32_t acct_type = 0; + const char *account_name; + const char *netbios_name; + + r->out.error_string = NULL; + + tmp_mem = talloc_new(mem_ctx); + if (!tmp_mem) { + return NT_STATUS_NO_MEMORY; + } + + r2 = talloc(tmp_mem, struct libnet_JoinDomain); + if (!r2) { + r->out.error_string = NULL; + talloc_free(tmp_mem); + return NT_STATUS_NO_MEMORY; + } + + if (r->in.join_type == SEC_CHAN_BDC) { + acct_type = ACB_SVRTRUST; + } else if (r->in.join_type == SEC_CHAN_WKSTA) { + acct_type = ACB_WSTRUST; + } else { + r->out.error_string = NULL; + talloc_free(tmp_mem); + return NT_STATUS_INVALID_PARAMETER; + } + + if (r->in.netbios_name != NULL) { + netbios_name = r->in.netbios_name; + } else { + netbios_name = talloc_reference(tmp_mem, lp_netbios_name(ctx->lp_ctx)); + if (!netbios_name) { + r->out.error_string = NULL; + talloc_free(tmp_mem); + return NT_STATUS_NO_MEMORY; + } + } + + account_name = talloc_asprintf(tmp_mem, "%s$", netbios_name); + if (!account_name) { + r->out.error_string = NULL; + talloc_free(tmp_mem); + return NT_STATUS_NO_MEMORY; + } + + /* + * join the domain + */ + ZERO_STRUCTP(r2); + r2->in.domain_name = r->in.domain_name; + r2->in.account_name = account_name; + r2->in.netbios_name = netbios_name; + r2->in.level = LIBNET_JOINDOMAIN_AUTOMATIC; + r2->in.acct_type = acct_type; + r2->in.recreate_account = false; + status = libnet_JoinDomain(ctx, r2, r2); + if (!NT_STATUS_IS_OK(status)) { + r->out.error_string = talloc_steal(mem_ctx, r2->out.error_string); + talloc_free(tmp_mem); + return status; + } + + r3 = talloc(tmp_mem, struct libnet_set_join_secrets); + if (!r3) { + r->out.error_string = NULL; + talloc_free(tmp_mem); + return NT_STATUS_NO_MEMORY; + } + + ZERO_STRUCTP(r3); + r3->in.domain_name = r2->out.domain_name; + r3->in.realm = r2->out.realm; + r3->in.account_name = account_name; + r3->in.netbios_name = netbios_name; + r3->in.join_type = r->in.join_type; + r3->in.join_password = r2->out.join_password; + r3->in.kvno = r2->out.kvno; + r3->in.domain_sid = r2->out.domain_sid; + + status = libnet_set_join_secrets(ctx, r3, r3); + if (!NT_STATUS_IS_OK(status)) { + r->out.error_string = talloc_steal(mem_ctx, r3->out.error_string); + talloc_free(tmp_mem); + return status; + } + /* move all out parameter to the callers TALLOC_CTX */ r->out.error_string = NULL; r->out.join_password = r2->out.join_password; diff --git a/source4/libnet/libnet_join.h b/source4/libnet/libnet_join.h index 6da4564cb3..79884130d8 100644 --- a/source4/libnet/libnet_join.h +++ b/source4/libnet/libnet_join.h @@ -79,5 +79,22 @@ struct libnet_Join { } out; }; +struct libnet_set_join_secrets { + struct { + const char *domain_name; + const char *realm; + const char *netbios_name; + const char *account_name; + enum netr_SchannelType join_type; + const char *join_password; + int kvno; + struct dom_sid *domain_sid; + } in; + + struct { + const char *error_string; + } out; +}; + #endif /* __LIBNET_JOIN_H__ */ -- cgit From 9d2948f4bd5f196904d27c67bf4f0baf7eaefcb0 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 9 Apr 2008 14:57:57 +1000 Subject: Don't fill in the secrets DB unless we make the entries. Leave filling in (we still initialise it) the secrets DB for the join or vampire code. Andrew Bartlett (This used to be commit c93208c13ce91b334eadf0ea02fa41354e761e97) --- source4/scripting/python/samba/provision.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py index c9cdcdb768..7b4fdb772c 100644 --- a/source4/scripting/python/samba/provision.py +++ b/source4/scripting/python/samba/provision.py @@ -1011,13 +1011,6 @@ def provision(setup_dir, message, session_info, os.makedirs(os.path.join(policy_path, "User"), 0755) if not os.path.isdir(paths.netlogon): os.makedirs(paths.netlogon, 0755) - secrets_ldb = Ldb(paths.secrets, session_info=session_info, - credentials=credentials, lp=lp) - secretsdb_become_dc(secrets_ldb, setup_path, domain=domain, realm=names.realm, - netbiosname=names.netbiosname, domainsid=domainsid, - keytab_path=paths.keytab, samdb_url=paths.samdb, - dns_keytab_path=paths.dns_keytab, dnspass=dnspass, - machinepass=machinepass, dnsdomain=names.dnsdomain) if samdb_fill == FILL_FULL: setup_name_mappings(samdb, idmap, str(domainsid), names.domaindn, @@ -1029,6 +1022,14 @@ def provision(setup_dir, message, session_info, # Only make a zone file on the first DC, it should be replicated with DNS replication if serverrole == "domain controller": + secrets_ldb = Ldb(paths.secrets, session_info=session_info, + credentials=credentials, lp=lp) + secretsdb_become_dc(secrets_ldb, setup_path, domain=domain, realm=names.realm, + netbiosname=names.netbiosname, domainsid=domainsid, + keytab_path=paths.keytab, samdb_url=paths.samdb, + dns_keytab_path=paths.dns_keytab, dnspass=dnspass, + machinepass=machinepass, dnsdomain=names.dnsdomain) + samdb = SamDB(paths.samdb, session_info=session_info, credentials=credentials, lp=lp) -- cgit From 8a982108a4f115e350c4246276f2ec886934c7fe Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 9 Apr 2008 14:59:32 +1000 Subject: Link the new vampire code togeather. This adds in the newly attached secrets handling, as well as an interface to the command line 'net' tool. Andrew Bartlett (This used to be commit 1282e3c39479aa580124206814b493370d10690a) --- source4/libnet/config.mk | 1 + source4/libnet/libnet_vampire.c | 50 ++++++++++++++++++++++-------- source4/libnet/libnet_vampire.h | 5 ++- source4/utils/net/net.c | 3 +- source4/utils/net/net_join.c | 67 +++++++++++++++++++++++++++++++++++++++++ source4/utils/net/net_vampire.c | 2 +- 6 files changed, 113 insertions(+), 15 deletions(-) diff --git a/source4/libnet/config.mk b/source4/libnet/config.mk index 0890941398..231d67cf35 100644 --- a/source4/libnet/config.mk +++ b/source4/libnet/config.mk @@ -1,5 +1,6 @@ [SUBSYSTEM::LIBSAMBA-NET] PRIVATE_PROTO_HEADER = libnet_proto.h +PRIVATE_DEPENDENCIES = PROVISION OBJ_FILES = \ libnet.o \ libnet_passwd.o \ diff --git a/source4/libnet/libnet_vampire.c b/source4/libnet/libnet_vampire.c index cd9167f541..476b97954f 100644 --- a/source4/libnet/libnet_vampire.c +++ b/source4/libnet/libnet_vampire.c @@ -37,6 +37,7 @@ #include "lib/ldb_wrap.h" #include "auth/auth.h" #include "param/param.h" +#include "param/provision.h" /* List of tasks vampire.py must perform: @@ -52,7 +53,6 @@ List of tasks vampire.py must perform: */ struct vampire_state { - struct libnet_context *ctx; const char *netbios_name; struct libnet_JoinDomain *join; struct cli_credentials *machine_account; @@ -93,7 +93,7 @@ static NTSTATUS vampire_prepare_db(void *private_data, settings.schema_dn_str = p->forest->schema_dn_str; settings.netbios_name = p->dest_dsa->netbios_name; settings.realm = s->join->out.realm; - settings.domain = s->join->out.domain; + settings.domain = s->join->out.domain_name; settings.server_dn_str = p->dest_dsa->server_dn_str; settings.machine_password = generate_random_str(s, 16); settings.targetdir = s->targetdir; @@ -115,18 +115,13 @@ static NTSTATUS vampire_prepare_db(void *private_data, return NT_STATUS_INTERNAL_DB_ERROR; } - /* We must set these up to ensure the replMetaData is written correctly, before our NTDS Settings entry is replicated */ + /* We must set these up to ensure the replMetaData is written correctly, + before our NTDS Settings entry is replicated */ ok = samdb_set_ntds_invocation_id(s->ldb, &p->dest_dsa->invocation_id); if (!ok) { DEBUG(0,("Failed to set cached ntds invocationId\n")); return NT_STATUS_FOOBAR; } - ok = samdb_set_ntds_objectGUID(s->ldb, &p->dest_dsa->ntds_guid); - if (!ok) { - DEBUG(0,("Failed to set cached ntds objectGUID\n")); - return NT_STATUS_FOOBAR; - } - s->lp_ctx = lp_ctx; return NT_STATUS_OK; @@ -591,10 +586,11 @@ static NTSTATUS vampire_store_chunk(void *private_data, return NT_STATUS_OK; } -NTSTATUS libnet_vampire(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, - struct libnet_vampire *r) +NTSTATUS libnet_Vampire(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, + struct libnet_Vampire *r) { struct libnet_JoinDomain *join; + struct libnet_set_join_secrets *set_secrets; struct libnet_BecomeDC b; struct libnet_UnbecomeDC u; struct vampire_state *s; @@ -651,6 +647,8 @@ NTSTATUS libnet_vampire(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, s->join = join; + s->targetdir = r->in.targetdir; + ZERO_STRUCT(b); b.in.domain_dns_name = join->out.realm; b.in.domain_netbios_name = join->out.domain_name; @@ -665,7 +663,7 @@ NTSTATUS libnet_vampire(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, b.in.callbacks.config_chunk = vampire_store_chunk; b.in.callbacks.domain_chunk = vampire_store_chunk; - status = libnet_BecomeDC(s->ctx, s, &b); + status = libnet_BecomeDC(ctx, s, &b); if (!NT_STATUS_IS_OK(status)) { printf("libnet_BecomeDC() failed - %s\n", nt_errstr(status)); talloc_free(s); @@ -703,4 +701,32 @@ NTSTATUS libnet_vampire(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, talloc_free(s); return NT_STATUS_INTERNAL_DB_ERROR; } + + set_secrets = talloc_zero(s, struct libnet_set_join_secrets); + if (!set_secrets) { + return NT_STATUS_NO_MEMORY; + } + + set_secrets->in.domain_name = join->out.domain_name; + set_secrets->in.realm = join->out.realm; + set_secrets->in.account_name = account_name; + set_secrets->in.netbios_name = netbios_name; + set_secrets->in.join_type = SEC_CHAN_BDC; + set_secrets->in.join_password = join->out.join_password; + set_secrets->in.kvno = join->out.kvno; + set_secrets->in.domain_sid = join->out.domain_sid; + + status = libnet_set_join_secrets(ctx, set_secrets, set_secrets); + if (!NT_STATUS_IS_OK(status)) { + r->out.error_string = talloc_steal(mem_ctx, set_secrets->out.error_string); + talloc_free(s); + return status; + } + + r->out.domain_name = talloc_steal(r, join->out.domain_name); + r->out.domain_sid = talloc_steal(r, join->out.domain_sid); + talloc_free(s); + + return NT_STATUS_OK; + } diff --git a/source4/libnet/libnet_vampire.h b/source4/libnet/libnet_vampire.h index af461139ff..5e0c7594b2 100644 --- a/source4/libnet/libnet_vampire.h +++ b/source4/libnet/libnet_vampire.h @@ -22,13 +22,16 @@ #ifndef __LIBNET_VAMPIRE_H__ #define __LIBNET_VAMPIRE_H__ -struct libnet_vampire { +struct libnet_Vampire { struct { const char *domain_name; const char *netbios_name; + const char *targetdir; } in; struct { + struct dom_sid *domain_sid; + const char *domain_name; const char *error_string; } out; }; diff --git a/source4/utils/net/net.c b/source4/utils/net/net.c index e0865c4416..c908ea6279 100644 --- a/source4/utils/net/net.c +++ b/source4/utils/net/net.c @@ -102,7 +102,8 @@ static const struct net_functable net_functable[] = { {"time", "get remote server's time\n", net_time, net_time_usage}, {"join", "join a domain\n", net_join, net_join_usage}, {"samdump", "dump the sam of a domain\n", net_samdump, net_samdump_usage}, - {"samsync", "synchronise into the local ldb the sam of a domain\n", net_samsync_ldb, net_samsync_ldb_usage}, + {"vampire", "join and syncronise an AD domain onto the local server\n", net_vampire, net_vampire_usage}, + {"samsync", "synchronise into the local ldb the sam of an NT4 domain\n", net_samsync_ldb, net_samsync_ldb_usage}, {"user", "manage user accounts\n", net_user, net_user_usage}, {NULL, NULL, NULL, NULL} }; diff --git a/source4/utils/net/net_join.c b/source4/utils/net/net_join.c index 08a4fbd4a1..abdcbf6027 100644 --- a/source4/utils/net/net_join.c +++ b/source4/utils/net/net_join.c @@ -100,3 +100,70 @@ int net_join_help(struct net_context *ctx, int argc, const char **argv) d_printf("Joins domain as either member or backup domain controller.\n"); return 0; } + +int net_vampire(struct net_context *ctx, int argc, const char **argv) +{ + NTSTATUS status; + struct libnet_context *libnetctx; + struct libnet_Vampire *r; + char *tmp, *targetdir = NULL; + const char *domain_name; + + switch (argc) { + case 0: /* no args -> fail */ + return net_vampire_usage(ctx, argc, argv); + case 1: /* only DOMAIN */ + tmp = talloc_strdup(ctx->mem_ctx, argv[0]); + break; + case 2: /* domain and target dir */ + tmp = talloc_strdup(ctx->mem_ctx, argv[0]); + targetdir = talloc_strdup(ctx->mem_ctx, argv[1]); + break; + default: /* too many args -> fail */ + return net_vampire_usage(ctx, argc, argv); + } + + domain_name = tmp; + + libnetctx = libnet_context_init(NULL, ctx->lp_ctx); + if (!libnetctx) { + return -1; + } + libnetctx->cred = ctx->credentials; + r = talloc(ctx->mem_ctx, struct libnet_Vampire); + if (!r) { + return -1; + } + /* prepare parameters for the vampire */ + r->in.netbios_name = lp_netbios_name(ctx->lp_ctx); + r->in.domain_name = domain_name; + r->in.targetdir = targetdir; + r->out.error_string = NULL; + + /* do the domain vampire */ + status = libnet_Vampire(libnetctx, r, r); + + if (!NT_STATUS_IS_OK(status)) { + d_fprintf(stderr, "Vampire of domain failed: %s\n", + r->out.error_string ? r->out.error_string : nt_errstr(status)); + talloc_free(r); + talloc_free(libnetctx); + return -1; + } + d_printf("Vampired domain %s (%s)\n", r->out.domain_name, dom_sid_string(ctx->mem_ctx, r->out.domain_sid)); + + talloc_free(libnetctx); + return 0; +} + +int net_vampire_usage(struct net_context *ctx, int argc, const char **argv) +{ + d_printf("net vampire [options]\n"); + return 0; +} + +int net_vampire_help(struct net_context *ctx, int argc, const char **argv) +{ + d_printf("Vampires domain as either member or backup domain controller.\n"); + return 0; +} diff --git a/source4/utils/net/net_vampire.c b/source4/utils/net/net_vampire.c index c798112d7b..4f6371d617 100644 --- a/source4/utils/net/net_vampire.c +++ b/source4/utils/net/net_vampire.c @@ -169,7 +169,7 @@ int net_samsync_ldb(struct net_context *ctx, int argc, const char **argv) int net_samsync_ldb_usage(struct net_context *ctx, int argc, const char **argv) { - d_printf("net samsync_ldb\n"); + d_printf("net samsync\n"); return 0; } -- cgit From b202b6e7d45cebd9b34c8d319e75f423291b30a0 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 9 Apr 2008 15:32:49 +1000 Subject: Fix up provision to specify SERVERDN in more places. Andrew Bartlett (This used to be commit d01d542502f25d6c731204ecb3d33720a1706581) --- source4/scripting/python/samba/provision.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py index 7b4fdb772c..ff76681c13 100644 --- a/source4/scripting/python/samba/provision.py +++ b/source4/scripting/python/samba/provision.py @@ -690,6 +690,7 @@ def setup_self_join(samdb, names, "CONFIGDN": names.configdn, "SCHEMADN": names.schemadn, "DOMAINDN": names.domaindn, + "SERVERDN": names.serverdn, "INVOCATIONID": invocationid, "NETBIOSNAME": names.netbiosname, "DEFAULTSITE": names.sitename, @@ -773,6 +774,7 @@ def setup_samdb(path, setup_path, session_info, credentials, lp, "NETBIOSNAME": names.netbiosname, "DEFAULTSITE": names.sitename, "CONFIGDN": names.configdn, + "SERVERDN": names.serverdn, "POLICYGUID": policyguid, "DOMAINDN": names.domaindn, "DOMAINGUID_MOD": domainguid_mod, @@ -803,6 +805,7 @@ def setup_samdb(path, setup_path, session_info, credentials, lp, "NETBIOSNAME": names.netbiosname, "DEFAULTSITE": names.sitename, "CONFIGDN": names.configdn, + "SERVERDN": names.serverdn }) message("Setting up sam.ldb Samba4 schema") @@ -821,6 +824,7 @@ def setup_samdb(path, setup_path, session_info, credentials, lp, "DOMAIN": names.domain, "SCHEMADN": names.schemadn, "DOMAINDN": names.domaindn, + "SERVERDN": names.serverdn }) message("Setting up display specifiers") @@ -845,6 +849,7 @@ def setup_samdb(path, setup_path, session_info, credentials, lp, "NETBIOSNAME": names.netbiosname, "DEFAULTSITE": names.sitename, "CONFIGDN": names.configdn, + "SERVERDN": names.serverdn }) if fill == FILL_FULL: -- cgit From a45f33f277e4fa1288808c75a5fbb5e50c835b60 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 9 Apr 2008 17:14:01 +0200 Subject: Fix so version of hostconfig library. (This used to be commit 62322f302fc92703cce1142bad17349987341cb6) --- source4/param/config.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source4/param/config.mk b/source4/param/config.mk index 064c293fa4..b4182480a9 100644 --- a/source4/param/config.mk +++ b/source4/param/config.mk @@ -1,6 +1,6 @@ [LIBRARY::LIBSAMBA-HOSTCONFIG] VERSION = 0.0.1 -SO_VERSION = 1 +SO_VERSION = 0 OBJ_FILES = loadparm.o \ generic.o \ util.o \ -- cgit From 12840597c856a6521ee088a5c96e8ffdd1716252 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 9 Apr 2008 17:43:37 +0200 Subject: No longer install unused smbscript binary. (This used to be commit ca0e373e57eb225a1f5d96813e9ea9ccee971b96) --- source4/scripting/ejs/config.mk | 1 - 1 file changed, 1 deletion(-) diff --git a/source4/scripting/ejs/config.mk b/source4/scripting/ejs/config.mk index 33a4ac915f..ea64d24eea 100644 --- a/source4/scripting/ejs/config.mk +++ b/source4/scripting/ejs/config.mk @@ -90,7 +90,6 @@ PRIVATE_DEPENDENCIES = \ ####################### # Start BINARY SMBSCRIPT [BINARY::smbscript] -INSTALLDIR = BINDIR OBJ_FILES = \ smbscript.o PRIVATE_DEPENDENCIES = EJS LIBSAMBA-UTIL smbcalls LIBSAMBA-HOSTCONFIG -- cgit From 55809f5029788892919bd7f6ec305ae9df858038 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Wed, 9 Apr 2008 17:11:57 -0400 Subject: Make sure we do not reference req after it has been freed (This used to be commit a13f64bf54afc22516d1f6a786dfec67389cb754) --- source4/libcli/cldap/cldap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source4/libcli/cldap/cldap.c b/source4/libcli/cldap/cldap.c index d10eeb8ffd..d9910285d9 100644 --- a/source4/libcli/cldap/cldap.c +++ b/source4/libcli/cldap/cldap.c @@ -601,8 +601,11 @@ NTSTATUS cldap_netlogon_recv(struct cldap_request *req, NTSTATUS status; enum ndr_err_code ndr_err; struct cldap_search search; + struct cldap_socket *cldap; DATA_BLOB *data; + cldap = req->cldap; + status = cldap_search_recv(req, mem_ctx, &search); if (!NT_STATUS_IS_OK(status)) { return status; @@ -620,7 +623,7 @@ NTSTATUS cldap_netlogon_recv(struct cldap_request *req, data = search.out.response->attributes[0].values; ndr_err = ndr_pull_union_blob_all(data, mem_ctx, - req->cldap->iconv_convenience, + cldap->iconv_convenience, &io->out.netlogon, io->in.version & 0xF, (ndr_pull_flags_fn_t)ndr_pull_nbt_cldap_netlogon); -- cgit From ad8e3e41923e20d401294eccd4da028e0f40c904 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 10 Apr 2008 05:23:17 +0200 Subject: Add infrastructure for returning ProvisionResult in C provision code. (This used to be commit 98c3d34eb233be284e8c8994cca337be25c72968) --- source4/param/provision.c | 11 +++++++---- source4/param/provision.h | 8 +++++++- source4/scripting/python/samba/provision.py | 2 +- source4/torture/local/torture.c | 6 +++++- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/source4/param/provision.c b/source4/param/provision.c index 5d1f01c59a..41b062883c 100644 --- a/source4/param/provision.c +++ b/source4/param/provision.c @@ -29,9 +29,10 @@ #include "scripting/python/modules.h" NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, - struct provision_settings *settings) + struct provision_settings *settings, + struct provision_result *result) { - PyObject *provision_mod, *provision_dict, *provision_fn, *result, *parameters; + PyObject *provision_mod, *provision_dict, *provision_fn, *py_result, *parameters; DEBUG(0,("Provision for Become-DC test using python\n")); @@ -115,15 +116,17 @@ NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, PyDict_SetItemString(parameters, "machinepass", PyString_FromString(settings->machine_password)); - result = PyEval_CallObjectWithKeywords(provision_fn, NULL, parameters); + py_result = PyEval_CallObjectWithKeywords(provision_fn, NULL, parameters); Py_DECREF(parameters); - if (result == NULL) { + if (py_result == NULL) { PyErr_Print(); PyErr_Clear(); return NT_STATUS_UNSUCCESSFUL; } + result->domaindn = talloc_strdup(mem_ctx, PyString_AsString(PyObject_GetAttrString(py_result, "domaindn"))); + return NT_STATUS_OK; } diff --git a/source4/param/provision.h b/source4/param/provision.h index 323159d417..e739053d50 100644 --- a/source4/param/provision.h +++ b/source4/param/provision.h @@ -39,7 +39,13 @@ struct provision_settings { const char *targetdir; }; +/* FIXME: Rename this to hostconfig ? */ +struct provision_result { + const char *domaindn; +}; + NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, - struct provision_settings *settings); + struct provision_settings *settings, + struct provision_result *result); #endif /* _PROVISION_H_ */ diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py index c9cdcdb768..ccf67a0b4a 100644 --- a/source4/scripting/python/samba/provision.py +++ b/source4/scripting/python/samba/provision.py @@ -1082,7 +1082,7 @@ def provision_become_dc(setup_dir=None, """print a message if quiet is not set.""" print text - provision(setup_dir, message, system_session(), None, + return provision(setup_dir, message, system_session(), None, smbconf=smbconf, targetdir=targetdir, samdb_fill=FILL_DRS, realm=realm, rootdn=rootdn, domaindn=domaindn, schemadn=schemadn, configdn=configdn, serverdn=serverdn, domain=domain, hostname=hostname, hostip="127.0.0.1", domainsid=domainsid, machinepass=machinepass, serverrole="domain controller", sitename=sitename); diff --git a/source4/torture/local/torture.c b/source4/torture/local/torture.c index 718bd38aad..17d83456d5 100644 --- a/source4/torture/local/torture.c +++ b/source4/torture/local/torture.c @@ -44,6 +44,7 @@ static bool test_provision(struct torture_context *tctx) { NTSTATUS status; struct provision_settings *settings = talloc(tctx, struct provision_settings); + struct provision_result result; char *targetdir = NULL; torture_assert_ntstatus_ok(tctx, torture_temp_dir(tctx, "torture_provision", &targetdir), @@ -64,10 +65,13 @@ static bool test_provision(struct torture_context *tctx) settings->ntds_dn_str = NULL; settings->machine_password = "geheim"; - status = provision_bare(settings, tctx->lp_ctx, settings); + status = provision_bare(settings, tctx->lp_ctx, settings, &result); torture_assert_ntstatus_ok(tctx, status, "provision"); + torture_assert_str_equal(tctx, result.domaindn, "DC=EXAMPLE,DC=COM", + "domaindn incorrect"); + return true; } -- cgit From 574bf79f3bdaff50f902cb68d456c4672f3092be Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 10 Apr 2008 06:07:46 +0200 Subject: Fix extra argument to provision_bare(). (This used to be commit 623f64a1a782086728a325e21e3dfb40c64871b7) --- source4/torture/libnet/libnet_BecomeDC.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source4/torture/libnet/libnet_BecomeDC.c b/source4/torture/libnet/libnet_BecomeDC.c index bb5e8fe061..a9a7773649 100644 --- a/source4/torture/libnet/libnet_BecomeDC.c +++ b/source4/torture/libnet/libnet_BecomeDC.c @@ -67,6 +67,7 @@ static NTSTATUS test_become_dc_prepare_db(void *private_data, { struct test_become_dc_state *s = talloc_get_type(private_data, struct test_become_dc_state); struct provision_settings settings; + struct provision_result result; NTSTATUS status; bool ok; struct loadparm_context *lp_ctx = loadparm_init(s); @@ -89,7 +90,7 @@ static NTSTATUS test_become_dc_prepare_db(void *private_data, settings.machine_password = cli_credentials_get_password(s->machine_account); settings.targetdir = s->targetdir; - status = provision_bare(s, s->lp_ctx, &settings); + status = provision_bare(s, s->lp_ctx, &settings, &result); smbconf = talloc_asprintf(lp_ctx, "%s/%s", s->targetdir, "/etc/smb.conf"); -- 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 +++++++++++++++++++++++++++++++-------------- source4/param/provision.c | 7 +++ source4/param/provision.h | 2 + 5 files changed, 94 insertions(+), 34 deletions(-) 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); diff --git a/source4/param/provision.c b/source4/param/provision.c index 41b062883c..e55d984e55 100644 --- a/source4/param/provision.c +++ b/source4/param/provision.c @@ -32,6 +32,8 @@ NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, struct provision_settings *settings, struct provision_result *result) { + extern struct loadparm_context *lp_from_py_object(PyObject *py_obj); + struct ldb_context *ldb_context_from_py_object(PyObject *py_obj); PyObject *provision_mod, *provision_dict, *provision_fn, *py_result, *parameters; DEBUG(0,("Provision for Become-DC test using python\n")); @@ -128,5 +130,10 @@ NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, result->domaindn = talloc_strdup(mem_ctx, PyString_AsString(PyObject_GetAttrString(py_result, "domaindn"))); + /* FIXME paths */ + /* FIXME samdb */ + result->lp_ctx = lp_from_py_object(PyObject_GetAttrString(py_result, "lp")); + result->samdb = ldb_context_from_py_object(PyObject_GetAttrString(py_result, "samdb")); + return NT_STATUS_OK; } diff --git a/source4/param/provision.h b/source4/param/provision.h index e739053d50..6b5bc798df 100644 --- a/source4/param/provision.h +++ b/source4/param/provision.h @@ -42,6 +42,8 @@ struct provision_settings { /* FIXME: Rename this to hostconfig ? */ struct provision_result { const char *domaindn; + struct ldb_context *samdb; + struct loadparm_context *lp_ctx; }; NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, -- cgit From 9198a519bea19a4d9f863fde5fb3aa23f60b5c88 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 11 Apr 2008 11:09:34 +1000 Subject: Set a netbios name into provision, and zero the rest. Remove dns_name initialisation. Andrew Bartlett (This used to be commit e77ab2fbd1836bc2f9c7b2a819b06ddccf1fa78f) --- source4/torture/local/torture.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source4/torture/local/torture.c b/source4/torture/local/torture.c index 718bd38aad..83c531124d 100644 --- a/source4/torture/local/torture.c +++ b/source4/torture/local/torture.c @@ -43,14 +43,13 @@ static bool test_tempdir(struct torture_context *tctx) static bool test_provision(struct torture_context *tctx) { NTSTATUS status; - struct provision_settings *settings = talloc(tctx, struct provision_settings); + struct provision_settings *settings = talloc_zero(tctx, struct provision_settings); char *targetdir = NULL; torture_assert_ntstatus_ok(tctx, torture_temp_dir(tctx, "torture_provision", &targetdir), "torture_temp_dir should return NT_STATUS_OK" ); settings->targetdir = talloc_steal(settings, targetdir); - settings->dns_name = "example.com"; settings->site_name = "SOME-SITE-NAME"; settings->root_dn_str = "DC=EXAMPLE,DC=COM"; settings->domain_dn_str = "DC=EXAMPLE,DC=COM"; @@ -60,6 +59,7 @@ static bool test_provision(struct torture_context *tctx) settings->netbios_name = "FOO"; settings->realm = "EXAMPLE.COM"; settings->domain = "EXAMPLE"; + settings->netbios_name = "torture"; settings->ntds_guid = NULL; settings->ntds_dn_str = NULL; settings->machine_password = "geheim"; -- cgit From 3d01c8eb6d4a9da9dc3dde9edb4057b534655e1d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 11 Apr 2008 14:12:34 +1000 Subject: Fixed a crash bug in unixuid module on failed ID mapping We need to intialise *ids regardless of the status of the call, as the IDL specifies that the out[] array always exists. If we don't initialise out then we get a segv when a id mapping fails. This still doesn't explain why the idmapping is failing, but at least the client now gets NT_STATUS_NONE_MAPPED rather than a crashed server. (This used to be commit 4449ce381aca25e7f510a2f24b43c3a81e870032) --- source4/winbind/wb_sids2xids.c | 10 ++++------ source4/winbind/wb_xids2sids.c | 10 ++++------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/source4/winbind/wb_sids2xids.c b/source4/winbind/wb_sids2xids.c index 302b915ff5..6b89caf465 100644 --- a/source4/winbind/wb_sids2xids.c +++ b/source4/winbind/wb_sids2xids.c @@ -67,15 +67,13 @@ NTSTATUS wb_sids2xids_recv(struct composite_context *ctx, struct id_mapping **ids) { NTSTATUS status = composite_wait(ctx); + struct sids2xids_state *state = talloc_get_type(ctx->private_data, + struct sids2xids_state); DEBUG(5, ("wb_sids2xids_recv called\n")); - if (NT_STATUS_IS_OK(status)) { - struct sids2xids_state *state = - talloc_get_type(ctx->private_data, - struct sids2xids_state); - *ids = state->ids; - } + *ids = state->ids; + talloc_free(ctx); return status; } diff --git a/source4/winbind/wb_xids2sids.c b/source4/winbind/wb_xids2sids.c index 1be394d276..a1cf2667ff 100644 --- a/source4/winbind/wb_xids2sids.c +++ b/source4/winbind/wb_xids2sids.c @@ -67,15 +67,13 @@ NTSTATUS wb_xids2sids_recv(struct composite_context *ctx, struct id_mapping **ids) { NTSTATUS status = composite_wait(ctx); + struct xids2sids_state *state = talloc_get_type(ctx->private_data, + struct xids2sids_state); DEBUG(5, ("wb_xids2sids_recv called.\n")); - if (NT_STATUS_IS_OK(status)) { - struct xids2sids_state *state = - talloc_get_type(ctx->private_data, - struct xids2sids_state); - *ids = state->ids; - } + *ids = state->ids; + talloc_free(ctx); return status; } -- cgit From 393007315d56d72cd4ebccc204da703b27eb968b Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 11 Apr 2008 19:04:43 +1000 Subject: Far less cryptic traceback when you have an existing smb.conf When the user has an existing smb.conf, but no [netlogon] or [sysvol] share, the provision script would trigger a traceback. While we still need to abort in this situation, we do so now with a useful error. Andrew Bartlett (This used to be commit 10a8b7ea487f9725f69b02c4dd9cf5e1f67a23ab) --- source4/scripting/python/samba/provision.py | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py index 16b1eb2156..4f264b6fc9 100644 --- a/source4/scripting/python/samba/provision.py +++ b/source4/scripting/python/samba/provision.py @@ -87,6 +87,7 @@ class ProvisionNames: self.domain = None self.hostname = None self.sitename = None + self.smbconf = None class ProvisionResult: def __init__(self): @@ -262,6 +263,8 @@ def provision_paths_from_lp(lp, dnsdomain): paths.netlogon = lp.get("path", "netlogon") + paths.smbconf = lp.configfile() + return paths @@ -1009,12 +1012,24 @@ def provision(setup_dir, message, session_info, ldap_backend_type=ldap_backend_type) if lp.get("server role") == "domain controller": - policy_path = os.path.join(paths.sysvol, names.dnsdomain, "Policies", - "{" + policyguid + "}") - os.makedirs(policy_path, 0755) - os.makedirs(os.path.join(policy_path, "Machine"), 0755) - os.makedirs(os.path.join(policy_path, "User"), 0755) - if not os.path.isdir(paths.netlogon): + if paths.netlogon is None: + message("Existing smb.conf does not have a [netlogon] share, but you are configuring a DC.") + message("Please either remove %s or see the template at %s" % + ( paths.smbconf, setup_path("provision.smb.conf.dc"))) + assert(paths.netlogon is not None) + + if paths.sysvol is None: + message("Existing smb.conf does not have a [sysvol] share, but you are configuring a DC.") + message("Please either remove %s or see the template at %s" % + (paths.smbconf, setup_path("provision.smb.conf.dc"))) + assert(paths.sysvol is not None) + + policy_path = os.path.join(paths.sysvol, names.dnsdomain, "Policies", + "{" + policyguid + "}") + os.makedirs(policy_path, 0755) + os.makedirs(os.path.join(policy_path, "Machine"), 0755) + os.makedirs(os.path.join(policy_path, "User"), 0755) + if not os.path.isdir(paths.netlogon): os.makedirs(paths.netlogon, 0755) if samdb_fill == FILL_FULL: -- cgit From a1a3089199d9ad523e63148a5a2afcca8db39bdf Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 11 Apr 2008 19:15:24 +1000 Subject: Use the python-provided ldb and lp_ctx pointers in libnet_vampire.c By using the already open smb.conf and sam.ldb, we not only avoid overhead, but also remove the risk we could touch a different database. Andrew Bartlett (This used to be commit 38634183a074556c8dfdcb6affc60f4bcc15a3f0) --- source4/libnet/libnet_vampire.c | 35 ++++++----------------------------- 1 file changed, 6 insertions(+), 29 deletions(-) diff --git a/source4/libnet/libnet_vampire.c b/source4/libnet/libnet_vampire.c index 476b97954f..9d32088fe6 100644 --- a/source4/libnet/libnet_vampire.c +++ b/source4/libnet/libnet_vampire.c @@ -77,14 +77,8 @@ static NTSTATUS vampire_prepare_db(void *private_data, { struct vampire_state *s = talloc_get_type(private_data, struct vampire_state); struct provision_settings settings; + struct provision_result result; NTSTATUS status; - bool ok; - struct loadparm_context *lp_ctx = loadparm_init(s); - char *smbconf; - - if (!lp_ctx) { - return NT_STATUS_NO_MEMORY; - } settings.site_name = p->dest_dsa->site_name; settings.root_dn_str = p->forest->root_dn_str; @@ -98,31 +92,14 @@ static NTSTATUS vampire_prepare_db(void *private_data, settings.machine_password = generate_random_str(s, 16); settings.targetdir = s->targetdir; - status = provision_bare(s, s->lp_ctx, &settings); - - smbconf = talloc_asprintf(lp_ctx, "%s/%s", s->targetdir, "/etc/smb.conf"); + status = provision_bare(s, s->lp_ctx, &settings, &result); - ok = lp_load(lp_ctx, smbconf); - if (!ok) { - DEBUG(0,("Failed load freshly generated smb.conf '%s'\n", smbconf)); - return NT_STATUS_INVALID_PARAMETER; + if (!NT_STATUS_IS_OK(status)) { + return status; } - s->ldb = samdb_connect(s, lp_ctx, - system_session(s, lp_ctx)); - if (!s->ldb) { - DEBUG(0,("Failed to open '%s'\n", lp_sam_url(lp_ctx))); - return NT_STATUS_INTERNAL_DB_ERROR; - } - - /* We must set these up to ensure the replMetaData is written correctly, - before our NTDS Settings entry is replicated */ - ok = samdb_set_ntds_invocation_id(s->ldb, &p->dest_dsa->invocation_id); - if (!ok) { - DEBUG(0,("Failed to set cached ntds invocationId\n")); - return NT_STATUS_FOOBAR; - } - s->lp_ctx = lp_ctx; + s->ldb = result.samdb; + s->lp_ctx = result.lp_ctx; return NT_STATUS_OK; -- cgit From e44f0e7b75a15e61427a6520999d0d79b78e9d2a Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 11 Apr 2008 19:33:52 +1000 Subject: Don't reopen the sam.ldb again Andrew Bartlett (This used to be commit b51b8a2d846284de4dff736fc18cf747c188de96) --- source4/scripting/python/samba/provision.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py index 4f264b6fc9..a8d188e7a3 100644 --- a/source4/scripting/python/samba/provision.py +++ b/source4/scripting/python/samba/provision.py @@ -741,8 +741,6 @@ def setup_samdb(path, setup_path, session_info, credentials, lp, return samdb message("Pre-loading the Samba 4 and AD schema") - samdb = SamDB(path, session_info=session_info, - credentials=credentials, lp=lp) samdb.set_domain_sid(domainsid) if serverrole == "domain controller": samdb.set_invocation_id(invocationid) -- cgit From c82e9c9f6dce7968d807a2b58527a86134026168 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 11 Apr 2008 19:35:15 +1000 Subject: Don't specify the ntds_guid to the C -> python provision interface This paramter was not used anyway. Andrew Bartlett (This used to be commit 6875e6823f7a1fe9066bff4dffcab658a17d3b8c) --- source4/param/provision.c | 2 -- source4/param/provision.h | 1 - source4/torture/local/torture.c | 1 - 3 files changed, 4 deletions(-) diff --git a/source4/param/provision.c b/source4/param/provision.c index d9b2dd899d..70ef618b6e 100644 --- a/source4/param/provision.c +++ b/source4/param/provision.c @@ -68,10 +68,8 @@ NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, settings->site_name)); DEBUG(0,("DSA Instance [%s]\n" - "\tobjectGUID[%s]\n" "\tinvocationId[%s]\n", settings->ntds_dn_str, - settings->ntds_guid == NULL?"None":GUID_string(mem_ctx, settings->ntds_guid), settings->invocation_id == NULL?"None":GUID_string(mem_ctx, settings->invocation_id))); DEBUG(0,("Pathes under targetdir[%s]\n", diff --git a/source4/param/provision.h b/source4/param/provision.h index df95549272..af9685d292 100644 --- a/source4/param/provision.h +++ b/source4/param/provision.h @@ -32,7 +32,6 @@ struct provision_settings { const char *host_ip; const char *realm; const char *domain; - const struct GUID *ntds_guid; const char *ntds_dn_str; const char *machine_password; const char *targetdir; diff --git a/source4/torture/local/torture.c b/source4/torture/local/torture.c index b48b191be6..7935f6cc35 100644 --- a/source4/torture/local/torture.c +++ b/source4/torture/local/torture.c @@ -61,7 +61,6 @@ static bool test_provision(struct torture_context *tctx) settings->realm = "EXAMPLE.COM"; settings->domain = "EXAMPLE"; settings->netbios_name = "torture"; - settings->ntds_guid = NULL; settings->ntds_dn_str = NULL; settings->machine_password = "geheim"; -- cgit From 6a7acf3952af5ecf2fe7d44a07a54d887ed7596c Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 11 Apr 2008 19:37:23 +1000 Subject: Reuse the lp_ctx and samdb returned by the python provision. Apply the same fix as in libnet_vampire in the old DRS test code. Andrew Bartlett (This used to be commit 34adb0e0bb1b3c340d7098e7a3d12f73f798d0e7) --- source4/torture/libnet/libnet_BecomeDC.c | 38 ++------------------------------ 1 file changed, 2 insertions(+), 36 deletions(-) diff --git a/source4/torture/libnet/libnet_BecomeDC.c b/source4/torture/libnet/libnet_BecomeDC.c index 3305a814f5..4d57a84582 100644 --- a/source4/torture/libnet/libnet_BecomeDC.c +++ b/source4/torture/libnet/libnet_BecomeDC.c @@ -69,13 +69,6 @@ static NTSTATUS test_become_dc_prepare_db(void *private_data, struct provision_settings settings; struct provision_result result; NTSTATUS status; - bool ok; - struct loadparm_context *lp_ctx = loadparm_init(s); - char *smbconf; - - if (!lp_ctx) { - return NT_STATUS_NO_MEMORY; - } settings.site_name = p->dest_dsa->site_name; settings.root_dn_str = p->forest->root_dn_str; @@ -91,35 +84,8 @@ static NTSTATUS test_become_dc_prepare_db(void *private_data, status = provision_bare(s, s->lp_ctx, &settings, &result); - smbconf = talloc_asprintf(lp_ctx, "%s/%s", s->targetdir, "/etc/smb.conf"); - - ok = lp_load(lp_ctx, smbconf); - if (!ok) { - DEBUG(0,("Failed load freshly generated smb.conf '%s'\n", smbconf)); - return NT_STATUS_INVALID_PARAMETER; - } - - s->ldb = ldb_wrap_connect(s, lp_ctx, lp_sam_url(lp_ctx), - system_session(s, lp_ctx), - NULL, 0, NULL); - if (!s->ldb) { - DEBUG(0,("Failed to open '%s'\n", lp_sam_url(lp_ctx))); - return NT_STATUS_INTERNAL_DB_ERROR; - } - - ok = samdb_set_ntds_invocation_id(s->ldb, &p->dest_dsa->invocation_id); - if (!ok) { - DEBUG(0,("Failed to set cached ntds invocationId\n")); - return NT_STATUS_FOOBAR; - } - ok = samdb_set_ntds_objectGUID(s->ldb, &p->dest_dsa->ntds_guid); - if (!ok) { - DEBUG(0,("Failed to set cached ntds objectGUID\n")); - return NT_STATUS_FOOBAR; - } - - s->lp_ctx = lp_ctx; - + s->ldb = result.samdb; + s->lp_ctx = result.lp_ctx; return NT_STATUS_OK; -- cgit From 6b013c90fda01974ac0c27ac035ce78958276aad Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 11 Apr 2008 19:38:36 +1000 Subject: Actually test the different 'fill levels' in the provision process. This should cover a few more codepaths in the provision script. Andrew Bartlett (This used to be commit 75c8dc6c6f3134bb78356630f24617aaeb869344) --- source4/setup/tests/blackbox_provision.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source4/setup/tests/blackbox_provision.sh b/source4/setup/tests/blackbox_provision.sh index 75d4fcfcb4..4db226778c 100755 --- a/source4/setup/tests/blackbox_provision.sh +++ b/source4/setup/tests/blackbox_provision.sh @@ -31,6 +31,8 @@ testit "simple-default" $PYTHON ./setup/provision $CONFIGURATION --domain=FOO -- testit "simple-dc" $PYTHON ./setup/provision $CONFIGURATION --server-role="dc" --domain=FOO --realm=foo.example.com --domain-sid=S-1-5-21-4177067393-1453636373-93818738 --targetdir=$PREFIX/simple-dc testit "simple-member" $PYTHON ./setup/provision $CONFIGURATION --server-role="member" --domain=FOO --realm=foo.example.com --targetdir=$PREFIX/simple-member testit "simple-standalone" $PYTHON ./setup/provision $CONFIGURATION --server-role="standalone" --domain=FOO --realm=foo.example.com --targetdir=$PREFIX/simple-standalone +testit "blank-dc" $PYTHON ./setup/provision $CONFIGURATION --server-role="dc" --domain=FOO --realm=foo.example.com --domain-sid=S-1-5-21-4177067393-1453636373-93818738 --targetdir=$PREFIX/simple-dc --blank +testit "partitions-only-dc" $PYTHON ./setup/provision $CONFIGURATION --server-role="dc" --domain=FOO --realm=foo.example.com --domain-sid=S-1-5-21-4177067393-1453636373-93818738 --targetdir=$PREFIX/simple-dc --partitions-only reprovision() { $PYTHON ./setup/provision $CONFIGURATION --domain=FOO --realm=foo.example.com --targetdir="$PREFIX/reprovision" -- 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 +- source4/torture/ui.h | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) 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; diff --git a/source4/torture/ui.h b/source4/torture/ui.h index 6645d9b012..ec4a658d74 100644 --- a/source4/torture/ui.h +++ b/source4/torture/ui.h @@ -253,6 +253,15 @@ void torture_result(struct torture_context *test, } \ } 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; \ -- 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(-) 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 ++-- source4/torture/auth/ntlmssp.c | 4 ++-- source4/torture/basic/base.c | 2 +- source4/torture/ndr/netlogon.c | 8 ++++---- 6 files changed, 13 insertions(+), 13 deletions(-) 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; diff --git a/source4/torture/auth/ntlmssp.c b/source4/torture/auth/ntlmssp.c index 9366de986a..917a24ad59 100644 --- a/source4/torture/auth/ntlmssp.c +++ b/source4/torture/auth/ntlmssp.c @@ -69,7 +69,7 @@ static bool torture_ntlmssp_self_check(struct torture_context *tctx) torture_assert_int_equal(tctx, sig.length, expected_sig.length, "Wrong sig length"); - torture_assert(tctx, 0 == memcmp(sig.data, expected_sig.data, sig.length), + torture_assert_mem_equal(tctx, sig.data, expected_sig.data, sig.length, "data mismatch"); torture_assert_ntstatus_equal(tctx, @@ -123,7 +123,7 @@ static bool torture_ntlmssp_self_check(struct torture_context *tctx) torture_assert_int_equal(tctx, sig.length, expected_sig.length, "Wrong sig length"); - torture_assert(tctx, 0 == memcmp(sig.data+8, expected_sig.data+8, sig.length-8), + torture_assert_mem_equal(tctx, sig.data+8, expected_sig.data+8, sig.length-8, "data mismatch"); torture_assert_ntstatus_equal(tctx, diff --git a/source4/torture/basic/base.c b/source4/torture/basic/base.c index ac71d14116..3a3a7c2fd5 100644 --- a/source4/torture/basic/base.c +++ b/source4/torture/basic/base.c @@ -590,7 +590,7 @@ static bool rw_torture2(struct torture_context *tctx, break; } - torture_assert(tctx, memcmp(buf_rd, buf, buf_size) == 0, + torture_assert_mem_equal(tctx, buf_rd, buf, buf_size, "read/write compare failed\n"); } diff --git a/source4/torture/ndr/netlogon.c b/source4/torture/ndr/netlogon.c index 2f01a9d009..f498335bda 100644 --- a/source4/torture/ndr/netlogon.c +++ b/source4/torture/ndr/netlogon.c @@ -46,7 +46,7 @@ static bool netrserverauthenticate3_in_check(struct torture_context *tctx, torture_assert_int_equal(tctx, r->in.secure_channel_type, 2, "secure channel type"); torture_assert_str_equal(tctx, r->in.computer_name, "NATIVE-2K", "computer name"); torture_assert_int_equal(tctx, *r->in.negotiate_flags, 0x6007ffff, "negotiate flags"); - torture_assert(tctx, memcmp(cred_expected, r->in.credentials->data, 8) == 0, "credentials"); + torture_assert_mem_equal(tctx, cred_expected, r->in.credentials->data, 8, "credentials"); return true; } @@ -59,7 +59,7 @@ static bool netrserverauthenticate3_out_check(struct torture_context *tctx, struct netr_ServerAuthenticate3 *r) { uint8_t cred_expected[8] = { 0x22, 0x0c, 0x86, 0x8a, 0xe9, 0x92, 0x93, 0xc9 }; - torture_assert(tctx, memcmp(cred_expected, r->out.credentials->data, 8) == 0, "credentials"); + torture_assert_mem_equal(tctx, cred_expected, r->out.credentials->data, 8, "credentials"); torture_assert_int_equal(tctx, *r->out.negotiate_flags, 0x6007ffff, "negotiate flags"); torture_assert_int_equal(tctx, *r->out.rid, 0x454, "rid"); torture_assert_ntstatus_ok(tctx, r->out.result, "return code"); @@ -85,7 +85,7 @@ static bool netrserverreqchallenge_in_check(struct torture_context *tctx, uint8_t cred_expected[8] = { 0xa3, 0x2c, 0xa2, 0x95, 0x40, 0xcc, 0xb7, 0xbb }; torture_assert_str_equal(tctx, r->in.server_name, "\\\\NATIVE-DC.NATIVE.BASE", "server name"); torture_assert_str_equal(tctx, r->in.computer_name, "NATIVE-2K", "account name"); - torture_assert(tctx, memcmp(cred_expected, r->in.credentials->data, 8) == 0, "credentials"); + torture_assert_mem_equal(tctx, cred_expected, r->in.credentials->data, 8, "credentials"); return true; } @@ -98,7 +98,7 @@ static bool netrserverreqchallenge_out_check(struct torture_context *tctx, struct netr_ServerReqChallenge *r) { uint8_t cred_expected[8] = { 0x22, 0xfc, 0xc1, 0x17, 0xc0, 0xae, 0x27, 0x8e }; - torture_assert(tctx, memcmp(cred_expected, r->out.credentials->data, 8) == 0, "credentials"); + torture_assert_mem_equal(tctx, cred_expected, r->out.credentials->data, 8, "credentials"); torture_assert_ntstatus_ok(tctx, r->out.result, "return code"); return true; -- cgit From 2bb20aa8a8ff1170fd4d2a349a421990b0d7c235 Mon Sep 17 00:00:00 2001 From: James Peach Date: Sun, 13 Apr 2008 14:09:09 -0700 Subject: smb_build: Make sure LIBRARY_SONAME is never uninitialized. (This used to be commit 2b8cf1b2a447711d123c563dfbd9a54941155267) --- source4/build/smb_build/makefile.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm index fb3ac561fa..2470fa1459 100644 --- a/source4/build/smb_build/makefile.pm +++ b/source4/build/smb_build/makefile.pm @@ -220,6 +220,10 @@ sub SharedLibrary($$) { my ($self,$ctx) = @_; + if (!defined($ctx->{LIBRARY_SONAME})) { + $ctx->{LIBRARY_SONAME} = ""; + } + $self->output("SHARED_LIBS += $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}\n") if (defined($ctx->{SO_VERSION})); $self->_prepare_list($ctx, "DEPEND_LIST"); -- cgit From 6abdaefb0f726d1b45b7eb698a88bfe8e354743a Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 14 Apr 2008 11:30:10 +0200 Subject: show what type of idmapping has failed (This used to be commit 8a222419528153b889cb1a7eae09a155f196b9b5) --- source4/winbind/idmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source4/winbind/idmap.c b/source4/winbind/idmap.c index 92ac41f1d2..0c729825db 100644 --- a/source4/winbind/idmap.c +++ b/source4/winbind/idmap.c @@ -654,7 +654,7 @@ NTSTATUS idmap_xids_to_sids(struct idmap_context *idmap_ctx, &id[i].sid); } if (!NT_STATUS_IS_OK(id[i].status)) { - DEBUG(1, ("idmapping failed for id[%d]\n", i)); + DEBUG(1, ("idmapping xid_to_sid failed for id[%d]\n", i)); error_count++; } } @@ -699,7 +699,7 @@ NTSTATUS idmap_sids_to_xids(struct idmap_context *idmap_ctx, &id[i].unixid); } if (!NT_STATUS_IS_OK(id[i].status)) { - DEBUG(1, ("idmapping failed for id[%d]\n", i)); + DEBUG(1, ("idmapping sid_to_xid failed for id[%d]\n", i)); error_count++; } } -- cgit From 275f32ae2df333c089343dd20fc4efee1bed2b7b Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 14 Apr 2008 11:31:17 +0200 Subject: fill in unknown fields in SMB2 READ call (This used to be commit 9b686c138037f613da15168d0722786e00f023e5) --- source4/libcli/raw/interfaces.h | 18 +++++++++++++----- source4/libcli/smb2/read.c | 13 +++++++++---- source4/ntvfs/ntvfs_generic.c | 3 ++- source4/smb_server/smb2/fileio.c | 10 +++++++--- 4 files changed, 31 insertions(+), 13 deletions(-) diff --git a/source4/libcli/raw/interfaces.h b/source4/libcli/raw/interfaces.h index 3965c58204..61441b2cdc 100644 --- a/source4/libcli/raw/interfaces.h +++ b/source4/libcli/raw/interfaces.h @@ -1706,19 +1706,27 @@ union smb_read { /* static body buffer 48 (0x30) bytes */ /* uint16_t buffer_code; 0x31 = 0x30 + 1 */ - uint16_t _pad; + uint8_t _pad; + uint8_t reserved; uint32_t length; uint64_t offset; /* struct smb2_handle handle; */ - uint64_t unknown1; /* 0x0000000000000000 */ - uint64_t unknown2; /* 0x0000000000000000 */ + uint32_t min_count; + uint32_t channel; + uint32_t remaining; + /* the docs give no indication of what + these channel variables are for */ + uint16_t channel_offset; + uint16_t channel_length; } in; struct { /* static body buffer 16 (0x10) bytes */ /* uint16_t buffer_code; 0x11 = 0x10 + 1 */ - /* uint16_t data_ofs; */ + /* uint8_t data_ofs; */ + /* uint8_t reserved; */ /* uint32_t data_size; */ - uint64_t unknown1; /* 0x0000000000000000 */ + uint32_t remaining; + uint32_t reserved; /* dynamic body */ DATA_BLOB data; diff --git a/source4/libcli/smb2/read.c b/source4/libcli/smb2/read.c index b61f918481..9d40e32a4d 100644 --- a/source4/libcli/smb2/read.c +++ b/source4/libcli/smb2/read.c @@ -33,12 +33,16 @@ struct smb2_request *smb2_read_send(struct smb2_tree *tree, struct smb2_read *io req = smb2_request_init_tree(tree, SMB2_OP_READ, 0x30, true, 0); if (req == NULL) return NULL; - SSVAL(req->out.body, 0x02, 0); /* pad */ + SCVAL(req->out.body, 0x02, 0); /* pad */ + SCVAL(req->out.body, 0x03, 0); /* reserved */ SIVAL(req->out.body, 0x04, io->in.length); SBVAL(req->out.body, 0x08, io->in.offset); smb2_push_handle(req->out.body+0x10, &io->in.file.handle); - SBVAL(req->out.body, 0x20, io->in.unknown1); - SBVAL(req->out.body, 0x28, io->in.unknown2); + SIVAL(req->out.body, 0x20, io->in.min_count); + SIVAL(req->out.body, 0x24, io->in.channel); + SIVAL(req->out.body, 0x28, io->in.remaining); + SSVAL(req->out.body, 0x2C, io->in.channel_offset); + SSVAL(req->out.body, 0x2E, io->in.channel_length); smb2_transport_send(req); @@ -67,7 +71,8 @@ NTSTATUS smb2_read_recv(struct smb2_request *req, return status; } - io->out.unknown1 = BVAL(req->in.body, 0x08); + io->out.remaining = IVAL(req->in.body, 0x08); + io->out.reserved = IVAL(req->in.body, 0x0C); return smb2_request_destroy(req); } diff --git a/source4/ntvfs/ntvfs_generic.c b/source4/ntvfs/ntvfs_generic.c index e1a86c07c0..fee3269eaf 100644 --- a/source4/ntvfs/ntvfs_generic.c +++ b/source4/ntvfs/ntvfs_generic.c @@ -1214,7 +1214,8 @@ static NTSTATUS ntvfs_map_read_finish(struct ntvfs_module_context *ntvfs, break; case RAW_READ_SMB2: rd->smb2.out.data.length= rd2->generic.out.nread; - rd->smb2.out.unknown1 = 0; + rd->smb2.out.remaining = 0; + rd->smb2.out.reserved = 0; break; default: return NT_STATUS_INVALID_LEVEL; diff --git a/source4/smb_server/smb2/fileio.c b/source4/smb_server/smb2/fileio.c index 0e3df56b42..8f8b4e771c 100644 --- a/source4/smb_server/smb2/fileio.c +++ b/source4/smb_server/smb2/fileio.c @@ -167,7 +167,8 @@ static void smb2srv_read_send(struct ntvfs_request *ntvfs) /* TODO: avoid the memcpy */ SMB2SRV_CHECK(smb2_push_o16s32_blob(&req->out, 0x02, io->smb2.out.data)); - SBVAL(req->out.body, 0x08, io->smb2.out.unknown1); + SIVAL(req->out.body, 0x08, io->smb2.out.remaining); + SIVAL(req->out.body, 0x0C, io->smb2.out.reserved); smb2srv_send_reply(req); } @@ -185,8 +186,11 @@ void smb2srv_read_recv(struct smb2srv_request *req) io->smb2.in.length = IVAL(req->in.body, 0x04); io->smb2.in.offset = BVAL(req->in.body, 0x08); io->smb2.in.file.ntvfs = smb2srv_pull_handle(req, req->in.body, 0x10); - io->smb2.in.unknown1 = BVAL(req->in.body, 0x20); - io->smb2.in.unknown2 = BVAL(req->in.body, 0x28); + io->smb2.in.min_count = IVAL(req->in.body, 0x20); + io->smb2.in.channel = IVAL(req->in.body, 0x24); + io->smb2.in.remaining = IVAL(req->in.body, 0x28); + io->smb2.in.channel_offset = SVAL(req->in.body, 0x2C); + io->smb2.in.channel_length = SVAL(req->in.body, 0x2E); SMB2SRV_CHECK_FILE_HANDLE(io->smb2.in.file.ntvfs); -- cgit From 434e625e45a03889596999eb4301bb54128c31a9 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 14 Apr 2008 11:48:43 +0200 Subject: Add in a way to get at the private_path() function from python Andrew Bartlett (This used to be commit 416d2e3a5233f0c243e45857cfda5126c34ac265) --- source4/scripting/python/misc.i | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source4/scripting/python/misc.i b/source4/scripting/python/misc.i index e04e6a6906..6fa3bc93e3 100644 --- a/source4/scripting/python/misc.i +++ b/source4/scripting/python/misc.i @@ -78,3 +78,8 @@ bool dsdb_set_ntds_invocation_id(struct ldb_context *ldb, const char *guid) return samdb_set_ntds_invocation_id(ldb, &invocation_id_in); } %} + +char *private_path(TALLOC_CTX* mem_ctx, + struct loadparm_context *lp_ctx, + const char *name); + -- cgit From 5a37b3fc5d42beffaf4bdca70b1f0c5f80f92280 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 14 Apr 2008 11:51:02 +0200 Subject: Fix newuser and setpassword scripts, and port to idmap. The new idmap world does not use the unixUser any more, so we need to set up the entry (if wanted) in the idmap database. Users without a backing unix user will get an allocated uid by idmap later. Andrew Bartlett (This used to be commit 8bd8bc1475ddf22d4702dcd17028a9043a5e629f) --- source4/scripting/python/samba/idmap.py | 7 +++++++ source4/scripting/python/samba/samdb.py | 28 +++++++++++++++++++++++++++- source4/setup/newuser | 10 ++-------- source4/setup/setpassword | 8 ++++---- source4/setup/tests/blackbox_provision.sh | 7 +++++-- 5 files changed, 45 insertions(+), 15 deletions(-) diff --git a/source4/scripting/python/samba/idmap.py b/source4/scripting/python/samba/idmap.py index 355565968a..16efcd0470 100644 --- a/source4/scripting/python/samba/idmap.py +++ b/source4/scripting/python/samba/idmap.py @@ -21,6 +21,7 @@ """Convenience functions for using the idmap database.""" import samba +import misc import ldb class IDmapDB(samba.Ldb): @@ -37,11 +38,17 @@ class IDmapDB(samba.Ldb): :param url: URL of the database. """ + self.lp = lp + super(IDmapDB, self).__init__(session_info=session_info, credentials=credentials, modules_dir=modules_dir, lp=lp) if url: self.connect(url) + else: + self.connect(lp.get("idmap database")) + def connect(self, url): + super(IDmapDB, self).connect(misc.private_path(self.lp, url)) def setup_name_mapping(self, sid, type, unixid): """Setup a mapping between a sam name and a unix name. diff --git a/source4/scripting/python/samba/samdb.py b/source4/scripting/python/samba/samdb.py index bc3eef7879..198d1e9f5c 100644 --- a/source4/scripting/python/samba/samdb.py +++ b/source4/scripting/python/samba/samdb.py @@ -25,20 +25,29 @@ import samba import misc import ldb +from samba.idmap import IDmapDB +import pwd class SamDB(samba.Ldb): """The SAM database.""" + def __init__(self, url=None, session_info=None, credentials=None, modules_dir=None, lp=None): """Open the Sam Database. :param url: URL of the database. """ + self.lp = lp super(SamDB, self).__init__(session_info=session_info, credentials=credentials, modules_dir=modules_dir, lp=lp) assert misc.dsdb_set_global_schema(self) == 0 if url: self.connect(url) + else: + self.connect(lp.get("sam database")) + + def connect(self, url): + super(SamDB, self).connect(misc.private_path(self.lp, url)) def add_foreign(self, domaindn, sid, desc): """Add a foreign security principle.""" @@ -101,10 +110,27 @@ userAccountControl: %u # now the real work self.add({"dn": user_dn, "sAMAccountName": username, - "unixName": unixname, "sambaPassword": password, "objectClass": "user"}) + res = self.search(user_dn, scope=ldb.SCOPE_BASE, + expression="objectclass=*", + attrs=["objectSid"]) + assert(len(res) == 1) + user_sid = self.schema_format_value("objectSid", res[0]["objectSid"][0]) + + + try: + idmap = IDmapDB(lp=self.lp) + + user = pwd.getpwnam(unixname) + # setup ID mapping for this UID + + idmap.setup_name_mapping(user_sid, idmap.TYPE_UID, user[2]) + + except KeyError: + pass + # modify the userAccountControl to remove the disabled bit self.enable_account(user_dn) self.transaction_commit() diff --git a/source4/setup/newuser b/source4/setup/newuser index f622058a5d..04a5440ee1 100755 --- a/source4/setup/newuser +++ b/source4/setup/newuser @@ -45,15 +45,9 @@ else: if opts.unixname is None: opts.unixname = username -try: - pwd.getpwnam(opts.unixname) -except KeyError: - print "ERROR: Unix user '%s' does not exist" % opts.unixname - sys.exit(1) - -creds = credopts.get_credentials() - lp = sambaopts.get_loadparm() +creds = credopts.get_credentials(lp) + samdb = SamDB(url=lp.get("sam database"), session_info=system_session(), credentials=creds, lp=lp) samdb.newuser(username, opts.unixname, password) diff --git a/source4/setup/setpassword b/source4/setup/setpassword index 31b2f73a25..977a6a5ee8 100644 --- a/source4/setup/setpassword +++ b/source4/setup/setpassword @@ -36,7 +36,7 @@ if len(args) == 0: parser.print_usage() sys.exit(1) -password = opts.password; +password = opts.newpassword; if password is None: password = getpass("New Password: ") @@ -47,12 +47,12 @@ if filter is None: if username is None: print "Either username or --filter must be specified" - filter = "(&(objectclass=user)(samAccountName=" + username + "))" + filter = "(&(objectclass=user)(samAccountName=%s))" % (username) -creds = credopts.get_credentials() - lp = sambaopts.get_loadparm() +creds = credopts.get_credentials(lp) + samdb = SamDB(url=lp.get("sam database"), session_info=system_session(), credentials=creds, lp=lp) samdb.setpassword(filter, password) diff --git a/source4/setup/tests/blackbox_provision.sh b/source4/setup/tests/blackbox_provision.sh index 4db226778c..19f37cef2d 100755 --- a/source4/setup/tests/blackbox_provision.sh +++ b/source4/setup/tests/blackbox_provision.sh @@ -31,8 +31,11 @@ testit "simple-default" $PYTHON ./setup/provision $CONFIGURATION --domain=FOO -- testit "simple-dc" $PYTHON ./setup/provision $CONFIGURATION --server-role="dc" --domain=FOO --realm=foo.example.com --domain-sid=S-1-5-21-4177067393-1453636373-93818738 --targetdir=$PREFIX/simple-dc testit "simple-member" $PYTHON ./setup/provision $CONFIGURATION --server-role="member" --domain=FOO --realm=foo.example.com --targetdir=$PREFIX/simple-member testit "simple-standalone" $PYTHON ./setup/provision $CONFIGURATION --server-role="standalone" --domain=FOO --realm=foo.example.com --targetdir=$PREFIX/simple-standalone -testit "blank-dc" $PYTHON ./setup/provision $CONFIGURATION --server-role="dc" --domain=FOO --realm=foo.example.com --domain-sid=S-1-5-21-4177067393-1453636373-93818738 --targetdir=$PREFIX/simple-dc --blank -testit "partitions-only-dc" $PYTHON ./setup/provision $CONFIGURATION --server-role="dc" --domain=FOO --realm=foo.example.com --domain-sid=S-1-5-21-4177067393-1453636373-93818738 --targetdir=$PREFIX/simple-dc --partitions-only +testit "blank-dc" $PYTHON ./setup/provision $CONFIGURATION --server-role="dc" --domain=FOO --realm=foo.example.com --domain-sid=S-1-5-21-4177067393-1453636373-93818738 --targetdir=$PREFIX/blank-dc --blank +testit "partitions-only-dc" $PYTHON ./setup/provision $CONFIGURATION --server-role="dc" --domain=FOO --realm=foo.example.com --domain-sid=S-1-5-21-4177067393-1453636373-93818738 --targetdir=$PREFIX/partitions-only-dc --partitions-only + +testit "newuser" $PYTHON ./setup/newuser --configfile=$PREFIX/simple-dc/etc/smb.conf testuser testpass +testit "setpassword" $PYTHON ./setup/setpassword --configfile=$PREFIX/simple-dc/etc/smb.conf testuser --newpassword=testpass reprovision() { $PYTHON ./setup/provision $CONFIGURATION --domain=FOO --realm=foo.example.com --targetdir="$PREFIX/reprovision" -- cgit From ca78fa8cae96099055a6ae7a0963c2b2789f2b87 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 14 Apr 2008 11:53:28 +0200 Subject: Re-run SWIG (This used to be commit 2f8010582607ad7389cac3de4945ea0ee46941b3) --- source4/scripting/python/misc.py | 1 + source4/scripting/python/misc_wrap.c | 45 ++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/source4/scripting/python/misc.py b/source4/scripting/python/misc.py index 2fc7fe37e7..f1da4c687a 100644 --- a/source4/scripting/python/misc.py +++ b/source4/scripting/python/misc.py @@ -71,5 +71,6 @@ version = _misc.version dsdb_set_global_schema = _misc.dsdb_set_global_schema ldb_register_samba_handlers = _misc.ldb_register_samba_handlers dsdb_set_ntds_invocation_id = _misc.dsdb_set_ntds_invocation_id +private_path = _misc.private_path diff --git a/source4/scripting/python/misc_wrap.c b/source4/scripting/python/misc_wrap.c index 579d1f379f..4944515d15 100644 --- a/source4/scripting/python/misc_wrap.c +++ b/source4/scripting/python/misc_wrap.c @@ -3153,6 +3153,50 @@ fail: } +SWIGINTERN PyObject *_wrap_private_path(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + TALLOC_CTX *arg1 = (TALLOC_CTX *) 0 ; + struct loadparm_context *arg2 = (struct loadparm_context *) 0 ; + char *arg3 = (char *) 0 ; + char *result = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + char * kwnames[] = { + (char *) "lp_ctx",(char *) "name", NULL + }; + + arg2 = loadparm_init(NULL); + arg1 = NULL; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OO:private_path",kwnames,&obj0,&obj1)) SWIG_fail; + if (obj0) { + res2 = SWIG_ConvertPtr(obj0, &argp2,SWIGTYPE_p_loadparm_context, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "private_path" "', argument " "2"" of type '" "struct loadparm_context *""'"); + } + arg2 = (struct loadparm_context *)(argp2); + } + if (obj1) { + res3 = SWIG_AsCharPtrAndSize(obj1, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "private_path" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = (char *)(buf3); + } + result = (char *)private_path(arg1,arg2,(char const *)arg3); + resultobj = SWIG_FromCharPtr((const char *)result); + if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); + return resultobj; +fail: + if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); + return NULL; +} + + static PyMethodDef SwigMethods[] = { { (char *)"random_password", (PyCFunction) _wrap_random_password, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"ldb_set_credentials", (PyCFunction) _wrap_ldb_set_credentials, METH_VARARGS | METH_KEYWORDS, NULL}, @@ -3164,6 +3208,7 @@ static PyMethodDef SwigMethods[] = { { (char *)"dsdb_set_global_schema", (PyCFunction) _wrap_dsdb_set_global_schema, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"ldb_register_samba_handlers", (PyCFunction) _wrap_ldb_register_samba_handlers, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"dsdb_set_ntds_invocation_id", (PyCFunction) _wrap_dsdb_set_ntds_invocation_id, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"private_path", (PyCFunction) _wrap_private_path, METH_VARARGS | METH_KEYWORDS, NULL}, { NULL, NULL, 0, NULL } }; -- 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/auth/auth.c | 5 +++++ source4/auth/gensec/gensec.c | 6 ++++++ source4/build/smb_build/header.pm | 11 ----------- source4/cldap_server/netlogon.c | 2 +- source4/lib/events/events.c | 3 +++ source4/lib/ldb/common/ldb_modules.c | 12 +++++++----- source4/lib/ldb/include/ldb_private.h | 6 ++++++ source4/ntptr/ntptr_base.c | 1 + source4/ntvfs/ntvfs_base.c | 10 ++++++++++ source4/ntvfs/sysdep/sys_lease.c | 1 + source4/ntvfs/sysdep/sys_notify.c | 1 + source4/param/share.c | 2 ++ source4/rpc_server/service_rpc.c | 12 ++++++++++++ source4/scripting/ejs/smbcalls.c | 26 ++++++++++++++++++++++++++ source4/smbd/process_model.c | 3 +++ source4/smbd/server.c | 12 ++++++++++++ source4/torture/torture.c | 12 ++++++++++++ 17 files changed, 108 insertions(+), 17 deletions(-) diff --git a/source4/auth/auth.c b/source4/auth/auth.c index af3796a70d..6c86cf2d7c 100644 --- a/source4/auth/auth.c +++ b/source4/auth/auth.c @@ -516,6 +516,11 @@ const struct auth_critical_sizes *auth_interface_version(void) _PUBLIC_ NTSTATUS auth_init(void) { static bool initialized = false; + extern NTSTATUS auth_developer_init(void); + extern NTSTATUS auth_winbind_init(void); + extern NTSTATUS auth_anonymous_init(void); + extern NTSTATUS auth_unix_init(void); + extern NTSTATUS auth_sam_init(void); init_module_fn static_init[] = { STATIC_auth_MODULES }; diff --git a/source4/auth/gensec/gensec.c b/source4/auth/gensec/gensec.c index 59c19b96ab..59ad15740e 100644 --- a/source4/auth/gensec/gensec.c +++ b/source4/auth/gensec/gensec.c @@ -1268,6 +1268,12 @@ static int sort_gensec(struct gensec_security_ops **gs1, struct gensec_security_ _PUBLIC_ NTSTATUS gensec_init(struct loadparm_context *lp_ctx) { static bool initialized = false; + extern NTSTATUS gensec_sasl_init(void); + extern NTSTATUS gensec_krb5_init(void); + extern NTSTATUS gensec_schannel_init(void); + extern NTSTATUS gensec_spnego_init(void); + extern NTSTATUS gensec_gssapi_init(void); + extern NTSTATUS gensec_ntlmssp_init(void); init_module_fn static_init[] = { STATIC_gensec_MODULES }; init_module_fn *shared_init; diff --git a/source4/build/smb_build/header.pm b/source4/build/smb_build/header.pm index c2bdbaf4c8..ffac5e2601 100644 --- a/source4/build/smb_build/header.pm +++ b/source4/build/smb_build/header.pm @@ -42,17 +42,6 @@ sub _prepare_build_h($) $DEFINE->{VAL} = "\\\n"; foreach (@{$key->{INIT_FUNCTIONS}}) { $DEFINE->{VAL} .= "\t$_, \\\n"; - unless (/{/) { - my $fn = $key->{INIT_FUNCTION_TYPE}; - my $n = $_; - if ($fn =~ /\(\*\)/) { - $fn =~ s/\(\*\)/$n/; - $output .= "$fn;\n"; - } else { - $n =~ s/\&//; - $output .= "$fn $n;\n"; - } - } } $DEFINE->{VAL} .= "\t$key->{INIT_FUNCTION_SENTINEL} \n"; diff --git a/source4/cldap_server/netlogon.c b/source4/cldap_server/netlogon.c index 32a71e43af..a524a6f8bd 100644 --- a/source4/cldap_server/netlogon.c +++ b/source4/cldap_server/netlogon.c @@ -20,7 +20,6 @@ */ #include "includes.h" -#include "libcli/ldap/ldap_ndr.h" #include "lib/ldb/include/ldb.h" #include "lib/ldb/include/ldb_errors.h" #include "lib/events/events.h" @@ -28,6 +27,7 @@ #include "smbd/service_task.h" #include "cldap_server/cldap_server.h" #include "librpc/gen_ndr/ndr_misc.h" +#include "libcli/ldap/ldap_ndr.h" #include "dsdb/samdb/samdb.h" #include "auth/auth.h" #include "ldb_wrap.h" 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; diff --git a/source4/ntptr/ntptr_base.c b/source4/ntptr/ntptr_base.c index 26e192d64b..0000337cb0 100644 --- a/source4/ntptr/ntptr_base.c +++ b/source4/ntptr/ntptr_base.c @@ -71,6 +71,7 @@ NTSTATUS ntptr_register(const void *_ops) NTSTATUS ntptr_init(struct loadparm_context *lp_ctx) { + extern NTSTATUS ntptr_simple_ldb_init(void); init_module_fn static_init[] = { STATIC_ntptr_MODULES }; init_module_fn *shared_init = load_samba_modules(NULL, lp_ctx, "ntptr"); diff --git a/source4/ntvfs/ntvfs_base.c b/source4/ntvfs/ntvfs_base.c index 51faa44372..8f574fa96b 100644 --- a/source4/ntvfs/ntvfs_base.c +++ b/source4/ntvfs/ntvfs_base.c @@ -204,6 +204,16 @@ NTSTATUS ntvfs_init_connection(TALLOC_CTX *mem_ctx, struct share_config *scfg, e NTSTATUS ntvfs_init(struct loadparm_context *lp_ctx) { static bool initialized = false; + extern NTSTATUS ntvfs_posix_init(void); + extern NTSTATUS ntvfs_cifs_init(void); + extern NTSTATUS ntvfs_nbench_init(void); + extern NTSTATUS ntvfs_unixuid_init(void); + extern NTSTATUS ntvfs_ipc_init(void); + extern NTSTATUS pvfs_acl_nfs4_init(void); + extern NTSTATUS pvfs_acl_xattr_init(void); + extern NTSTATUS ntvfs_print_init(void); + extern NTSTATUS ntvfs_simple_init(void); + extern NTSTATUS ntvfs_cifs_posix_init(void); init_module_fn static_init[] = { STATIC_ntvfs_MODULES }; init_module_fn *shared_init; diff --git a/source4/ntvfs/sysdep/sys_lease.c b/source4/ntvfs/sysdep/sys_lease.c index 28dd27a708..b8a165aa51 100644 --- a/source4/ntvfs/sysdep/sys_lease.c +++ b/source4/ntvfs/sysdep/sys_lease.c @@ -112,6 +112,7 @@ _PUBLIC_ NTSTATUS sys_lease_register(const struct sys_lease_ops *backend) _PUBLIC_ NTSTATUS sys_lease_init(void) { static bool initialized = false; + extern NTSTATUS sys_lease_linux_init(void); init_module_fn static_init[] = { STATIC_sys_lease_MODULES }; diff --git a/source4/ntvfs/sysdep/sys_notify.c b/source4/ntvfs/sysdep/sys_notify.c index 84ba745f5b..eb5cc3793f 100644 --- a/source4/ntvfs/sysdep/sys_notify.c +++ b/source4/ntvfs/sysdep/sys_notify.c @@ -124,6 +124,7 @@ _PUBLIC_ NTSTATUS sys_notify_register(struct sys_notify_backend *backend) _PUBLIC_ NTSTATUS sys_notify_init(void) { static bool initialized = false; + extern NTSTATUS sys_notify_inotify_init(void); init_module_fn static_init[] = { STATIC_sys_notify_MODULES }; diff --git a/source4/param/share.c b/source4/param/share.c index bc2999b03d..51134d8970 100644 --- a/source4/param/share.c +++ b/source4/param/share.c @@ -146,6 +146,8 @@ NTSTATUS share_get_context_by_name(TALLOC_CTX *mem_ctx, const char *backend_name */ NTSTATUS share_init(void) { + extern NTSTATUS share_ldb_init(void); + extern NTSTATUS share_classic_init(void); init_module_fn static_init[] = { STATIC_share_MODULES }; run_init_functions(static_init); diff --git a/source4/rpc_server/service_rpc.c b/source4/rpc_server/service_rpc.c index ddcf1c2a99..e81b8cd0aa 100644 --- a/source4/rpc_server/service_rpc.c +++ b/source4/rpc_server/service_rpc.c @@ -459,6 +459,18 @@ failed: NTSTATUS server_service_rpc_init(void) { + extern NTSTATUS dcerpc_server_wkssvc_init(void); + extern NTSTATUS dcerpc_server_drsuapi_init(void); + extern NTSTATUS dcerpc_server_winreg_init(void); + extern NTSTATUS dcerpc_server_spoolss_init(void); + extern NTSTATUS dcerpc_server_epmapper_init(void); + extern NTSTATUS dcerpc_server_srvsvc_init(void); + extern NTSTATUS dcerpc_server_netlogon_init(void); + extern NTSTATUS dcerpc_server_rpcecho_init(void); + extern NTSTATUS dcerpc_server_unixinfo_init(void); + extern NTSTATUS dcerpc_server_samr_init(void); + extern NTSTATUS dcerpc_server_remote_init(void); + extern NTSTATUS dcerpc_server_lsa_init(void); init_module_fn static_init[] = { STATIC_dcerpc_server_MODULES }; init_module_fn *shared_init = load_samba_modules(NULL, global_loadparm, "dcerpc_server"); diff --git a/source4/scripting/ejs/smbcalls.c b/source4/scripting/ejs/smbcalls.c index 63a80e17db..b1a2f6a37b 100644 --- a/source4/scripting/ejs/smbcalls.c +++ b/source4/scripting/ejs/smbcalls.c @@ -173,6 +173,32 @@ _PUBLIC_ void ejs_exception(const char *reason) */ void smb_setup_ejs_functions(void (*exception_handler)(const char *)) { + extern NTSTATUS ejs_init_security(void); + extern NTSTATUS ejs_init_initshutdown(void); + extern NTSTATUS smb_setup_ejs_reg(void); + extern NTSTATUS smb_setup_ejs_string(void); + extern NTSTATUS ejs_init_lsarpc(void); + extern NTSTATUS ejs_init_rpcecho(void); + extern NTSTATUS ejs_init_winreg(void); + extern NTSTATUS smb_setup_ejs_random(void); + extern NTSTATUS smb_setup_ejs_config(void); + extern NTSTATUS ejs_init_misc(void); + extern NTSTATUS ejs_init_netdfs(void); + extern NTSTATUS smb_setup_ejs_datablob(void); + extern NTSTATUS smb_setup_ejs_auth(void); + extern NTSTATUS smb_setup_ejs_nss(void); + extern NTSTATUS ejs_init_samr(void); + extern NTSTATUS ejs_init_wkssvc(void); + extern NTSTATUS smb_setup_ejs_system(void); + extern NTSTATUS smb_setup_ejs_ldb(void); + extern NTSTATUS ejs_init_svcctl(void); + extern NTSTATUS smb_setup_ejs_nbt(void); + extern NTSTATUS smb_setup_ejs_net(void); + extern NTSTATUS ejs_init_srvsvc(void); + extern NTSTATUS ejs_init_netlogon(void); + extern NTSTATUS ejs_init_drsuapi(void); + extern NTSTATUS ejs_init_irpc(void); + extern NTSTATUS ejs_init_eventlog(void); init_module_fn static_init[] = { STATIC_smbcalls_MODULES }; init_module_fn *shared_init; diff --git a/source4/smbd/process_model.c b/source4/smbd/process_model.c index fcbe2d9872..2cb551a520 100644 --- a/source4/smbd/process_model.c +++ b/source4/smbd/process_model.c @@ -82,6 +82,9 @@ _PUBLIC_ NTSTATUS register_process_model(const void *_ops) _PUBLIC_ NTSTATUS process_model_init(struct loadparm_context *lp_ctx) { + extern NTSTATUS process_model_standard_init(void); + extern NTSTATUS process_model_prefork_init(void); + extern NTSTATUS process_model_single_init(void); init_module_fn static_init[] = { STATIC_process_model_MODULES }; init_module_fn *shared_init = load_samba_modules(NULL, lp_ctx, "process_model"); diff --git a/source4/smbd/server.c b/source4/smbd/server.c index d6e2fb19e4..3f6cb48013 100644 --- a/source4/smbd/server.c +++ b/source4/smbd/server.c @@ -187,6 +187,18 @@ static int binary_smbd_main(const char *binary_name, int argc, const char *argv[ bool opt_interactive = false; int opt; poptContext pc; + extern NTSTATUS server_service_wrepl_init(void); + extern NTSTATUS server_service_kdc_init(void); + extern NTSTATUS server_service_ldap_init(void); + extern NTSTATUS server_service_web_init(void); + extern NTSTATUS server_service_ldap_init(void); + extern NTSTATUS server_service_winbind_init(void); + extern NTSTATUS server_service_nbtd_init(void); + extern NTSTATUS server_service_auth_init(void); + extern NTSTATUS server_service_cldapd_init(void); + extern NTSTATUS server_service_smb_init(void); + extern NTSTATUS server_service_drepl_init(void); + extern NTSTATUS server_service_rpc_init(void); init_module_fn static_init[] = { STATIC_service_MODULES }; init_module_fn *shared_init; struct event_context *event_ctx; diff --git a/source4/torture/torture.c b/source4/torture/torture.c index ea8efaa8c3..8a41b72249 100644 --- a/source4/torture/torture.c +++ b/source4/torture/torture.c @@ -48,6 +48,18 @@ bool torture_register_suite(struct torture_suite *suite) _PUBLIC_ int torture_init(void) { + extern NTSTATUS torture_base_init(void); + extern NTSTATUS torture_ldap_init(void); + extern NTSTATUS torture_local_init(void); + extern NTSTATUS torture_nbt_init(void); + extern NTSTATUS torture_nbench_init(void); + extern NTSTATUS torture_rap_init(void); + extern NTSTATUS torture_rpc_init(void); + extern NTSTATUS torture_smb2_init(void); + extern NTSTATUS torture_net_init(void); + extern NTSTATUS torture_raw_init(void); + extern NTSTATUS torture_unix_init(void); + extern NTSTATUS torture_winbind_init(void); init_module_fn static_init[] = { STATIC_torture_MODULES }; init_module_fn *shared_init = load_samba_modules(NULL, cmdline_lp_ctx, "torture"); -- cgit From f800cf250f079ab1e1bc1051c34d1d1061187447 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 14 Apr 2008 14:51:57 +0200 Subject: Move standard make compilation rules to build/make. (This used to be commit ceda3312a98b069d0711f3cb33de3ae71e91ebaa) --- source4/Makefile | 26 +++- source4/build/make/lex_compile.sh | 51 +++++++ source4/build/make/python.mk | 58 ++++++++ source4/build/make/rules.mk | 288 +++++++++++++++++++++++++++++++++++++ source4/build/make/yacc_compile.sh | 43 ++++++ source4/dynconfig.mk | 3 +- source4/rules.mk | 191 ------------------------ source4/script/lex_compile.sh | 51 ------- source4/script/yacc_compile.sh | 43 ------ source4/scripting/python/config.mk | 17 +-- 10 files changed, 466 insertions(+), 305 deletions(-) create mode 100755 source4/build/make/lex_compile.sh create mode 100644 source4/build/make/python.mk create mode 100644 source4/build/make/rules.mk create mode 100755 source4/build/make/yacc_compile.sh delete mode 100644 source4/rules.mk delete mode 100755 source4/script/lex_compile.sh delete mode 100755 source4/script/yacc_compile.sh diff --git a/source4/Makefile b/source4/Makefile index ab3ef47fed..8c74b4899d 100644 --- a/source4/Makefile +++ b/source4/Makefile @@ -19,6 +19,25 @@ BNLD_FLAGS = $(LDFLAGS) $(SYS_LDFLAGS) HOSTCC_FLAGS = -D_SAMBA_HOSTCC_ $(CFLAGS) HOSTLD_FLAGS = $(LDFLAGS) $(SYS_LDFLAGS) +$(srcdir)/version.h: $(srcdir)/VERSION + @$(SHELL) script/mkversion.sh VERSION $(srcdir)/version.h $(srcdir)/ + +.DEFAULT_GOAL := all + +ifneq ($(automatic_deps),yes) +ALL_PREDEP = proto +.NOTPARALLEL: +endif + +regen_version:: + @$(SHELL) script/mkversion.sh VERSION $(srcdir)/version.h $(srcdir)/ + +clean_pch:: + @echo "Removing precompiled headers" + @-rm -f include/includes.h.gch + +pch:: clean_pch include/includes.h.gch + .DEFAULT_GOAL := all ifneq ($(automatic_dependencies),yes) @@ -26,9 +45,12 @@ ALL_PREDEP = proto .NOTPARALLEL: endif -include rules.mk +include build/make/rules.mk +include build/make/python.mk include data.mk +BINARIES += $(BIN_PROGS) $(SBIN_PROGS) + DEP_FILES = $(patsubst %.ho,%.hd,$(patsubst %.o,%.d,$(ALL_OBJS))) \ include/includes.d @@ -55,7 +77,7 @@ endif DEFAULT_HEADERS = $(srcdir)/lib/util/dlinklist.h \ $(srcdir)/version.h -binaries:: +binaries:: $(BINARIES) libraries:: $(STATIC_LIBS) $(SHARED_LIBS) modules:: $(PLUGINS) headers:: $(PUBLIC_HEADERS) $(DEFAULT_HEADERS) diff --git a/source4/build/make/lex_compile.sh b/source4/build/make/lex_compile.sh new file mode 100755 index 0000000000..9bba7257b1 --- /dev/null +++ b/source4/build/make/lex_compile.sh @@ -0,0 +1,51 @@ +#!/bin/sh + +LEX="$1" +SRC="$2" +DEST="$3" +shift 3 +ARGS="$*" + +dir=`dirname $SRC` +file=`basename $SRC` +base=`basename $SRC .l` +if [ -z "$LEX" ]; then + # if $DEST is more recent than $SRC, we can just touch + # otherwise we touch but print out warnings + if [ -r $DEST ]; then + if [ x`find $SRC -newer $DEST -print` = x$SRC ]; then + echo "warning: lex not found - cannot generate $SRC => $DEST" >&2 + echo "warning: lex not found - only updating the timestamp of $DEST" >&2 + fi + touch $DEST; + exit; + fi + echo "error: lex not found - cannot generate $SRC => $DEST" >&2 + exit 1; +fi +# if $DEST is more recent than $SRC, we can just touch +if [ -r $DEST ]; then + if [ x`find $SRC -newer $DEST -print` != x$SRC ]; then + touch $DEST; + exit; + fi +fi +TOP=`pwd` +if cd $dir && $LEX $ARGS $file; then + if [ -r $base.yy.c ];then + # we must guarantee that config.h comes first + echo "#include \"config.h\"" > $base.c + sed -e "s|$base\.yy\.c|$DEST|" $base.yy.c >> $base.c + rm -f $base.yy.c + elif [ -r $base.c ];then + # we must guarantee that config.h comes first + mv $base.c $base.c.tmp + echo "#include \"config.h\"" > $base.c + sed -e "s|$base\.yy\.c|$DEST|" $base.c.tmp >> $base.c + rm -f $base.c.tmp + elif [ ! -r base.c ]; then + echo "$base.c nor $base.yy.c generated." + exit 1 + fi +fi +cd $TOP diff --git a/source4/build/make/python.mk b/source4/build/make/python.mk new file mode 100644 index 0000000000..57bf0169fe --- /dev/null +++ b/source4/build/make/python.mk @@ -0,0 +1,58 @@ +pythonbuilddir = $(builddir)/bin/python + +# Install Python +# Arguments: Module path +define python_module_template + +installpython:: $$(pythonbuilddir)/$(1) ; + cp $$< $$(DESTDIR)$$(PYTHONDIR)/$(1) + +uninstallpython:: + rm -f $$(DESTDIR)$$(PYTHONDIR)/$(1) ; + +pythonmods:: $$(pythonbuilddir)/$(1) ; + +endef + +define python_py_module_template + +$$(pythonbuilddir)/$(1): $(2) ; + mkdir -p $$(@D) + cp $$< $$@ + +$(call python_module_template,$(1)) + +endef + +# Python C module +# Arguments: Module path, object files +define python_c_module_template + +$$(pythonbuilddir)/$(1): $(2) ; + @echo Linking $$@ + @mkdir -p $$(@D) + @$$(MDLD) $$(LDFLAGS) $$(MDLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) $(3) + +$(call python_module_template,$(1)) +endef + +# Swig extensions +swig:: pythonmods + +.SUFFIXES: _wrap.c .i + +.i_wrap.c: + [ "$(SWIG)" == "no" ] || $(SWIG) -O -Wall -I$(srcdir)/scripting/swig -python -keyword $< + +realdistclean:: + @echo "Removing SWIG output files" + # FIXME: Remove _wrap.c files + +pythonmods:: + +clean:: + @echo "Removing python modules" + @rm -rf $(pythonbuilddir) + +pydoctor:: pythonmods + LD_LIBRARY_PATH=bin/shared PYTHONPATH=$(pythonbuilddir) pydoctor --project-name=Samba --project-url=http://www.samba.org --make-html --docformat=restructuredtext --add-package $(pythonbuilddir)/samba diff --git a/source4/build/make/rules.mk b/source4/build/make/rules.mk new file mode 100644 index 0000000000..faefb4e323 --- /dev/null +++ b/source4/build/make/rules.mk @@ -0,0 +1,288 @@ +# Rules file for Samba 4 +# This relies on GNU make. +# +# Dependencies command +DEPENDS = $(CC) -M -MG -MP -MT $(<:.c=.o) -MT $@ \ + $(CFLAGS) $(CPPFLAGS) $< -o $@ +# Dependencies for host objects +HDEPENDS = $(CC) -M -MG -MP -MT $(<:.c=.ho) -MT $@ \ + $(HOSTCC_FLAGS) $(CPPFLAGS) $< -o $@ +# Dependencies for precompiled headers +PCHDEPENDS = $(CC) -M -MG -MT include/includes.h.gch -MT $@ \ + $(CFLAGS) $(CPPFLAGS) $< -o $@ + +# Run a static analysis checker +CHECK = $(CC_CHECKER) $(CFLAGS) $(PICFLAG) $(CPPLAGS) -c $< -o $@ + +# Run the configured compiler +COMPILE = $(CC) $(CFLAGS) $(PICFLAG) \ + $(CPPFLAGS) \ + -c $< -o $@ + +# Run the compiler for the build host +HCOMPILE = $(HOSTCC) $(HOSTCC_FLAGS) $(CPPFLAGS) -c $< -o $@ + +# Precompile headers +PCHCOMPILE = @$(CC) -Ilib/replace \ + $(CFLAGS) $(PICFLAG) $(CPPFLAGS) -c $< -o $@ + +# Partial linking +PARTLINK = @$(PROG_LD) -r + +make_utility_dir = $(srcdir)/build/make/ + +include/config.h: + @echo "include/config.h not present" + @echo "You need to rerun ./autogen.sh and ./configure" + @/bin/false + +pch:: + +clean:: clean_pch + @echo Removing objects + @-find . -name '*.o' -exec rm -f '{}' \; + @echo Removing hostcc objects + @-find . -name '*.ho' -exec rm -f '{}' \; + @echo Removing binaries + @-rm -f $(BIN_PROGS) $(SBIN_PROGS) $(BINARIES) $(TORTURE_PROGS) + @echo Removing libraries + @-rm -f $(STATIC_LIBS) $(SHARED_LIBS) + @-rm -f bin/static/*.a bin/shared/*.$(SHLIBEXT) bin/mergedobj/*.o + @echo Removing modules + @-rm -f bin/modules/*/*.$(SHLIBEXT) + @-rm -f bin/*_init_module.c + @echo Removing dummy targets + @-rm -f bin/.*_* + @echo Removing generated files + @-rm -f bin/*_init_module.c + @-rm -rf librpc/gen_* + @echo Removing proto headers + @-rm -f $(PROTO_HEADERS) + +distclean:: clean + -rm -f include/config.h include/config_tmp.h include/build.h + -rm -f data.mk + -rm -f config.status + -rm -f config.log config.cache + -rm -f config.pm config.mk + -rm -f $(PC_FILES) + +removebackup:: + -rm -f *.bak *~ */*.bak */*~ */*/*.bak */*/*~ */*/*/*.bak */*/*/*~ + +realdistclean:: distclean removebackup + -rm -f include/config_tmp.h.in + -rm -f version.h + -rm -f configure + -rm -f $(MANPAGES) + +check:: test + +unused_macros: + $(srcdir)/script/find_unused_macros.pl `find . -name "*.[ch]"` | sort + +# Create a static library +%.a: + @echo Linking $@ + @rm -f $@ + @mkdir -p $(@D) + @$(STLD) $(STLD_FLAGS) $@ $^ + +############################################################################### +# Templates +############################################################################### + +# Partially link +# Arguments: target object file, source object files +define partial_link_template +$(1): $(2) ; + @echo Partially linking $$@ + @mkdir -p $$(@D) + $$(PARTLINK) -o $$@ $$^ +endef + +# Link a binary +# Arguments: target file, depends, flags +define binary_link_template +$(1): $(2) ; + @echo Linking $$@ + @$$(BNLD) $$(BNLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) $(3) +endef + +# Link a host-machine binary +# Arguments: target file, depends, flags +define host_binary_link_template +$(1): $(2) ; + @echo Linking $$@ + @$$(HOSTLD) $$(HOSTLD_FLAGS) -L$${builddir}/bin/static -o $$@ $$(INSTALL_LINK_FLAGS) $(3) +endef + +# Create a prototype header +# Arguments: header file, c files +define proto_header_template +$(1): $(2) ; + @echo "Creating $$@" + @$$(PERL) $$(srcdir)/script/mkproto.pl --srcdir=$$(srcdir) --builddir=$$(builddir) --public=/dev/null --private=$$@ $$^ +endef + +# Shared module +# Arguments: Target, dependencies, objects +define shared_module_template + +$(1): $(2) ; + @echo Linking $$@ + @mkdir -p $$(@D) + @$$(MDLD) $$(LDFLAGS) $$(MDLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) $(3) + +endef + +# Shared library +# Arguments: Target, dependencies, link flags, soname +define shared_library_template +$(1): $(2) + @echo Linking $$@ + @mkdir -p $$(@D) + @$$(SHLD) $$(LDFLAGS) $$(SHLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) \ + $(3) \ + $$(if $$(SONAMEFLAG), $$(SONAMEFLAG)$(notdir $(4))) + +ifneq ($(notdir $(1)),$(notdir $(4))) +$(4): $(1) + @echo "Creating symbolic link for $$@" + @ln -fs $$(&2;\ + echo "$(HCOMPILE)" 1>&2;\ + $(HCOMPILE) >/dev/null 2>&1 + +.h.h.gch: + @echo "Precompiling $<" + @$(PCHCOMPILE) + +.y.c: + @echo "Building $< with $(YACC)" + @-$(make_utility_dir)/yacc_compile.sh "$(YACC)" "$<" "$@" + +.l.c: + @echo "Building $< with $(LEX)" + @-$(make_utility_dir)/script/lex_compile.sh "$(LEX)" "$<" "$@" + +%.a: + @echo Linking $@ + @rm -f $@ + @mkdir -p $(@D) + @$(STLD) $(STLD_FLAGS) $@ $^ + + +DOCBOOK_MANPAGE_URL = http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl + +.1.xml.1: + $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $< + +.3.xml.3: + $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $< + +.5.xml.5: + $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $< + +.7.xml.7: + $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $< + +.8.xml.8: + $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $< + +dist:: idl_full manpages configure distclean + +configure: + ./autogen.sh + +showflags:: + @echo 'Samba will be compiled with flags:' + @echo ' CPP = $(CPP)' + @echo ' CPPFLAGS = $(CPPFLAGS)' + @echo ' CC = $(CC)' + @echo ' CFLAGS = $(CFLAGS)' + @echo ' PICFLAG = $(PICFLAG)' + @echo ' BNLD = $(BNLD)' + @echo ' BNLD_FLAGS = $(BNLD_FLAGS)' + @echo ' STLD = $(STLD)' + @echo ' STLD_FLAGS = $(STLD_FLAGS)' + @echo ' SHLD = $(SHLD)' + @echo ' SHLD_FLAGS = $(SHLD_FLAGS)' + @echo ' MDLD = $(MDLD)' + @echo ' MDLD_FLAGS = $(MDLD_FLAGS)' + @echo ' SHLIBEXT = $(SHLIBEXT)' + +etags: + etags `find $(srcdir) -name "*.[ch]"` + +ctags: + ctags `find $(srcdir) -name "*.[ch]"` diff --git a/source4/build/make/yacc_compile.sh b/source4/build/make/yacc_compile.sh new file mode 100755 index 0000000000..a56a51da0a --- /dev/null +++ b/source4/build/make/yacc_compile.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +YACC="$1" +SRC="$2" +DEST="$3" + +dir=`dirname $SRC` +file=`basename $SRC` +base=`basename $SRC .y` +if [ -z "$YACC" ]; then + # if $DEST is more recent than $SRC, we can just touch + # otherwise we touch but print out warnings + if [ -r $DEST ]; then + if [ x`find $SRC -newer $DEST -print` = x$SRC ]; then + echo "warning: yacc not found - cannot generate $SRC => $DEST" >&2 + echo "warning: yacc not found - only updating the timestamp of $DEST" >&2 + fi + touch $DEST; + exit; + fi + echo "error: yacc not found - cannot generate $SRC => $DEST" >&2 + exit 1; +fi +# if $DEST is more recent than $SRC, we can just touch +if [ -r $DEST ]; then + if [ x`find $SRC -newer $DEST -print` != x$SRC ]; then + touch $DEST; + exit; + fi +fi +TOP=`pwd` +if cd $dir && $YACC -d $file; then + if [ -r y.tab.h -a -r y.tab.c ];then + #echo "info: move files" + sed -e "/^#/!b" -e "s|y\.tab\.h|$SRC|" -e "s|\"$base.y|\"$SRC|" y.tab.h > $base.h + sed -e "s|y\.tab\.c|$SRC|" -e "s|\"$base.y|\"$SRC|" y.tab.c > $base.c + rm -f y.tab.c y.tab.h + elif [ ! -r $base.h -a ! -r $base.c]; then + echo "$base.h nor $base.c generated." + exit 1 + fi +fi +cd $TOP diff --git a/source4/dynconfig.mk b/source4/dynconfig.mk index aa0565cd7a..ba9c5467ba 100644 --- a/source4/dynconfig.mk +++ b/source4/dynconfig.mk @@ -21,5 +21,4 @@ PATH_FLAGS = -DCONFIGFILE=\"$(CONFIGFILE)\" \ dynconfig.o: dynconfig.c Makefile @echo Compiling $< - @$(CC) $(CFLAGS) $(CPPFLAGS) $(PICFLAG) \ - $(PATH_FLAGS) -c $< -o $@ + @$(CC) $(CFLAGS) $(CPPFLAGS) $(PICFLAG) $(PATH_FLAGS) -c $< -o $@ diff --git a/source4/rules.mk b/source4/rules.mk deleted file mode 100644 index 5f91f8132e..0000000000 --- a/source4/rules.mk +++ /dev/null @@ -1,191 +0,0 @@ -# Dependencies command -DEPENDS = $(CC) -M -MG -MP -MT $(<:.c=.o) -MT $@ \ - $(CFLAGS) $(CPPFLAGS) $< -o $@ -# Dependencies for host objects -HDEPENDS = $(CC) -M -MG -MP -MT $(<:.c=.ho) -MT $@ \ - $(HOSTCC_FLAGS) $(CPPFLAGS) $< -o $@ -# Dependencies for precompiled headers -PCHDEPENDS = $(CC) -M -MG -MT include/includes.h.gch -MT $@ \ - $(CFLAGS) $(CPPFLAGS) $< -o $@ - -# Run a static analysis checker -CHECK = $(CC_CHECKER) $(CFLAGS) $(PICFLAG) $(CPPLAGS) -c $< -o $@ - -# Run the configured compiler -COMPILE = $(CC) $(CFLAGS) $(PICFLAG) \ - $(CPPFLAGS) \ - -c $< -o $@ - -# Run the compiler for the build host -HCOMPILE = $(HOSTCC) $(HOSTCC_FLAGS) $(CPPFLAGS) -c $< -o $@ - -# Precompile headers -PCHCOMPILE = @$(CC) -Ilib/replace \ - $(CFLAGS) $(PICFLAG) $(CPPFLAGS) -c $< -o $@ - -# Partial linking -PARTLINK = @$(PROG_LD) -r - -include/config.h: - @echo "include/config.h not present" - @echo "You need to rerun ./autogen.sh and ./configure" - @/bin/false - -$(srcdir)/version.h: $(srcdir)/VERSION - @$(SHELL) script/mkversion.sh VERSION $(srcdir)/version.h $(srcdir)/ - -regen_version:: - @$(SHELL) script/mkversion.sh VERSION $(srcdir)/version.h $(srcdir)/ - -clean_pch:: - @echo "Removing precompiled headers" - @-rm -f include/includes.h.gch - -pch:: clean_pch include/includes.h.gch - -clean:: clean_pch - @echo Removing objects - @-find . -name '*.o' -exec rm -f '{}' \; - @echo Removing hostcc objects - @-find . -name '*.ho' -exec rm -f '{}' \; - @echo Removing binaries - @-rm -f $(BIN_PROGS) $(SBIN_PROGS) $(BINARIES) $(TORTURE_PROGS) - @echo Removing libraries - @-rm -f $(STATIC_LIBRARIES) $(SHARED_LIBRARIES) - @-rm -f bin/static/*.a bin/shared/*.$(SHLIBEXT) bin/mergedobj/*.o - @echo Removing modules - @-rm -f bin/modules/*/*.$(SHLIBEXT) - @-rm -f bin/*_init_module.c - @echo Removing dummy targets - @-rm -f bin/.*_* - @echo Removing generated files - @-rm -f bin/*_init_module.c - @-rm -rf librpc/gen_* - @echo Removing proto headers - @-rm -f $(PROTO_HEADERS) - -distclean:: clean - -rm -f include/config.h include/config_tmp.h include/build.h - -rm -f data.mk - -rm -f config.status - -rm -f config.log config.cache - -rm -f config.pm config.mk - -rm -f $(PC_FILES) - -removebackup:: - -rm -f *.bak *~ */*.bak */*~ */*/*.bak */*/*~ */*/*/*.bak */*/*/*~ - -realdistclean:: distclean removebackup - -rm -f include/config_tmp.h.in - -rm -f version.h - -rm -f configure - -rm -f $(MANPAGES) - -check:: test - -unused_macros: - $(srcdir)/script/find_unused_macros.pl `find . -name "*.[ch]"` | sort - -# Create a static library -%.a: - @echo Linking $@ - @rm -f $@ - @mkdir -p $(@D) - @$(STLD) $(STLD_FLAGS) $@ $^ - -############################################################################### -# File types -############################################################################### - -.SUFFIXES: .x .c .et .y .l .d .o .h .h.gch .a .$(SHLIBEXT) .1 .1.xml .3 .3.xml .5 .5.xml .7 .7.xml .8 .8.xml .ho .idl .hd - -.c.d: - @echo "Generating dependencies for $<" - @$(DEPENDS) - -.c.hd: - @echo "Generating host-compiler dependencies for $<" - @$(HDEPENDS) - -include/includes.d: include/includes.h - @echo "Generating dependencies for $<" - @$(PCHDEPENDS) - -.c.o: - @if test -n "$(CC_CHECKER)"; then \ - echo "Checking $< with '$(CC_CHECKER)'"; \ - $(CHECK) ; \ - fi - @echo "Compiling $<" - @-mkdir -p `dirname $@` - @$(COMPILE) && exit 0 ; \ - echo "The following command failed:" 1>&2;\ - $(COMPILE) >/dev/null 2>&1 - - -# echo "$(COMPILE)" 1>&2;\ - -.c.ho: - @echo "Compiling $< with host compiler" - @-mkdir -p `dirname $@` - @$(HCOMPILE) && exit 0;\ - echo "The following command failed:" 1>&2;\ - echo "$(HCOMPILE)" 1>&2;\ - $(HCOMPILE) >/dev/null 2>&1 - -.h.h.gch: - @echo "Precompiling $<" - @$(PCHCOMPILE) - -.y.c: - @echo "Building $< with $(YACC)" - @-$(srcdir)/script/yacc_compile.sh "$(YACC)" "$<" "$@" - -.l.c: - @echo "Building $< with $(LEX)" - @-$(srcdir)/script/lex_compile.sh "$(LEX)" "$<" "$@" - -DOCBOOK_MANPAGE_URL = http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl - -.1.xml.1: - $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $< - -.3.xml.3: - $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $< - -.5.xml.5: - $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $< - -.7.xml.7: - $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $< - -.8.xml.8: - $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $< - -dist:: idl_full manpages configure distclean - -configure: - ./autogen.sh - -showflags:: - @echo 'Samba will be compiled with flags:' - @echo ' CPP = $(CPP)' - @echo ' CPPFLAGS = $(CPPFLAGS)' - @echo ' CC = $(CC)' - @echo ' CFLAGS = $(CFLAGS)' - @echo ' PICFLAG = $(PICFLAG)' - @echo ' BNLD = $(BNLD)' - @echo ' BNLD_FLAGS = $(BNLD_FLAGS)' - @echo ' STLD = $(STLD)' - @echo ' STLD_FLAGS = $(STLD_FLAGS)' - @echo ' SHLD = $(SHLD)' - @echo ' SHLD_FLAGS = $(SHLD_FLAGS)' - @echo ' MDLD = $(MDLD)' - @echo ' MDLD_FLAGS = $(MDLD_FLAGS)' - @echo ' SHLIBEXT = $(SHLIBEXT)' - -etags: - etags `find $(srcdir) -name "*.[ch]"` - -ctags: - ctags `find $(srcdir) -name "*.[ch]"` diff --git a/source4/script/lex_compile.sh b/source4/script/lex_compile.sh deleted file mode 100755 index 9bba7257b1..0000000000 --- a/source4/script/lex_compile.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/sh - -LEX="$1" -SRC="$2" -DEST="$3" -shift 3 -ARGS="$*" - -dir=`dirname $SRC` -file=`basename $SRC` -base=`basename $SRC .l` -if [ -z "$LEX" ]; then - # if $DEST is more recent than $SRC, we can just touch - # otherwise we touch but print out warnings - if [ -r $DEST ]; then - if [ x`find $SRC -newer $DEST -print` = x$SRC ]; then - echo "warning: lex not found - cannot generate $SRC => $DEST" >&2 - echo "warning: lex not found - only updating the timestamp of $DEST" >&2 - fi - touch $DEST; - exit; - fi - echo "error: lex not found - cannot generate $SRC => $DEST" >&2 - exit 1; -fi -# if $DEST is more recent than $SRC, we can just touch -if [ -r $DEST ]; then - if [ x`find $SRC -newer $DEST -print` != x$SRC ]; then - touch $DEST; - exit; - fi -fi -TOP=`pwd` -if cd $dir && $LEX $ARGS $file; then - if [ -r $base.yy.c ];then - # we must guarantee that config.h comes first - echo "#include \"config.h\"" > $base.c - sed -e "s|$base\.yy\.c|$DEST|" $base.yy.c >> $base.c - rm -f $base.yy.c - elif [ -r $base.c ];then - # we must guarantee that config.h comes first - mv $base.c $base.c.tmp - echo "#include \"config.h\"" > $base.c - sed -e "s|$base\.yy\.c|$DEST|" $base.c.tmp >> $base.c - rm -f $base.c.tmp - elif [ ! -r base.c ]; then - echo "$base.c nor $base.yy.c generated." - exit 1 - fi -fi -cd $TOP diff --git a/source4/script/yacc_compile.sh b/source4/script/yacc_compile.sh deleted file mode 100755 index a56a51da0a..0000000000 --- a/source4/script/yacc_compile.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh - -YACC="$1" -SRC="$2" -DEST="$3" - -dir=`dirname $SRC` -file=`basename $SRC` -base=`basename $SRC .y` -if [ -z "$YACC" ]; then - # if $DEST is more recent than $SRC, we can just touch - # otherwise we touch but print out warnings - if [ -r $DEST ]; then - if [ x`find $SRC -newer $DEST -print` = x$SRC ]; then - echo "warning: yacc not found - cannot generate $SRC => $DEST" >&2 - echo "warning: yacc not found - only updating the timestamp of $DEST" >&2 - fi - touch $DEST; - exit; - fi - echo "error: yacc not found - cannot generate $SRC => $DEST" >&2 - exit 1; -fi -# if $DEST is more recent than $SRC, we can just touch -if [ -r $DEST ]; then - if [ x`find $SRC -newer $DEST -print` != x$SRC ]; then - touch $DEST; - exit; - fi -fi -TOP=`pwd` -if cd $dir && $YACC -d $file; then - if [ -r y.tab.h -a -r y.tab.c ];then - #echo "info: move files" - sed -e "/^#/!b" -e "s|y\.tab\.h|$SRC|" -e "s|\"$base.y|\"$SRC|" y.tab.h > $base.h - sed -e "s|y\.tab\.c|$SRC|" -e "s|\"$base.y|\"$SRC|" y.tab.c > $base.c - rm -f y.tab.c y.tab.h - elif [ ! -r $base.h -a ! -r $base.c]; then - echo "$base.h nor $base.c generated." - exit 1 - fi -fi -cd $TOP diff --git a/source4/scripting/python/config.mk b/source4/scripting/python/config.mk index 09c77813ca..22e9a2ff7b 100644 --- a/source4/scripting/python/config.mk +++ b/source4/scripting/python/config.mk @@ -15,24 +15,9 @@ OBJ_FILES = uuidmodule.o PRIVATE_DEPENDENCIES = LIBNDR LIBLDB SAMDB CREDENTIALS SWIG_FILE = misc.i -# Swig extensions -swig:: pythonmods - -.SUFFIXES: _wrap.c .i - -.i_wrap.c: - [ "$(SWIG)" = "no" ] || $(SWIG) -O -Wall -I$(srcdir)/scripting/swig -python -keyword $< - -realdistclean:: - @echo "Removing SWIG output files" - # FIXME: Remove _wrap.c files - -pythonmods:: $(PYTHON_DSOS) $(PYTHON_PYS) - PYDOCTOR_MODULES=bin/python/ldb.py bin/python/auth.py bin/python/credentials.py bin/python/registry.py bin/python/tdb.py bin/python/security.py bin/python/events.py bin/python/net.py -pydoctor:: pythonmods - LD_LIBRARY_PATH=bin/shared PYTHONPATH=bin/python pydoctor --project-name=Samba --make-html --docformat=restructuredtext --add-package scripting/python/samba/ $(addprefix --add-module , $(PYDOCTOR_MODULES)) +pythonmods:: $(PYTHON_PYS) $(PYTHON_MODS) bin/python/%.py: mkdir -p $(@D) -- cgit From 0fa62eb2751805bb60d4cfc55b539770aa3471a4 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 14 Apr 2008 16:01:15 +0200 Subject: Include the smbconf parameter to the provision Otherwise this fails, if the targetdir is not specified Andrew Bartlett (This used to be commit cd2d3d1c7a0aad7beb167459276c012c7a6d2e88) --- source4/param/provision.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source4/param/provision.c b/source4/param/provision.c index 70ef618b6e..0e54acf9e4 100644 --- a/source4/param/provision.c +++ b/source4/param/provision.c @@ -76,6 +76,9 @@ NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, settings->targetdir)); parameters = PyDict_New(); + PyDict_SetItemString(parameters, "smbconf", + PyString_FromString(lp_configfile(lp_ctx))); + PyDict_SetItemString(parameters, "rootdn", PyString_FromString(settings->root_dn_str)); if (settings->targetdir != NULL) @@ -129,7 +132,6 @@ NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, result->domaindn = talloc_strdup(mem_ctx, PyString_AsString(PyObject_GetAttrString(py_result, "domaindn"))); /* FIXME paths */ - /* FIXME samdb */ result->lp_ctx = lp_from_py_object(PyObject_GetAttrString(py_result, "lp")); result->samdb = ldb_context_from_py_object(PyObject_GetAttrString(py_result, "samdb")); -- cgit From 76a7ea3dc438d7259fb569410b0faff112e54d4a Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 14 Apr 2008 16:41:46 +0200 Subject: Makefile: fix variable name automatic_deps -> automatic_dependencies metze (This used to be commit 7ffc44b7c126dc08d928e63af30111b2c556146f) --- source4/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source4/Makefile b/source4/Makefile index 8c74b4899d..98c45a34ad 100644 --- a/source4/Makefile +++ b/source4/Makefile @@ -24,7 +24,7 @@ $(srcdir)/version.h: $(srcdir)/VERSION .DEFAULT_GOAL := all -ifneq ($(automatic_deps),yes) +ifneq ($(automatic_dependencies),yes) ALL_PREDEP = proto .NOTPARALLEL: endif -- 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(+) 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/auth/config.mk | 49 +- source4/auth/credentials/config.mk | 9 +- source4/auth/gensec/config.mk | 23 +- source4/auth/kerberos/config.mk | 15 +- source4/auth/ntlmssp/config.mk | 9 +- source4/build/m4/public.m4 | 10 +- source4/build/smb_build/config_mk.pm | 12 +- source4/build/smb_build/input.pm | 9 +- source4/cldap_server/config.mk | 10 +- source4/client/config.mk | 8 +- source4/cluster/config.mk | 5 +- source4/cluster/ctdb/config.mk | 14 +- source4/dsdb/config.mk | 38 +- source4/dsdb/samdb/ldb_modules/config.mk | 120 ++--- source4/dynconfig.mk | 3 +- source4/heimdal_build/asn1_deps.pl | 7 +- source4/heimdal_build/config.mk | 794 ++++++++++++++++--------------- source4/kdc/config.mk | 13 +- source4/ldap_server/config.mk | 12 +- 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 +- source4/smbd/config.mk | 24 +- 35 files changed, 692 insertions(+), 676 deletions(-) diff --git a/source4/auth/config.mk b/source4/auth/config.mk index 63aec09847..de8926d2af 100644 --- a/source4/auth/config.mk +++ b/source4/auth/config.mk @@ -5,27 +5,31 @@ mkinclude ntlmssp/config.mk mkinclude credentials/config.mk [SUBSYSTEM::auth_session] -OBJ_FILES = session.o PRIVATE_PROTO_HEADER = session_proto.h PUBLIC_DEPENDENCIES = CREDENTIALS # PUBLIC_HEADERS += auth/session.h +auth_session_OBJ_FILES = $(addprefix auth/, session.o) + [SUBSYSTEM::auth_system_session] -OBJ_FILES = system_session.o PRIVATE_PROTO_HEADER = system_session_proto.h PUBLIC_DEPENDENCIES = CREDENTIALS PRIVATE_DEPENDENCIES = auth_session LIBSAMBA-UTIL LIBSECURITY +auth_system_session_OBJ_FILES = $(addprefix auth/, system_session.o) + [SUBSYSTEM::auth_sam] PRIVATE_PROTO_HEADER = auth_sam.h -OBJ_FILES = sam.o ntlm_check.o PUBLIC_DEPENDENCIES = SAMDB UTIL_LDB LIBSECURITY PRIVATE_DEPENDENCIES = LDAP_ENCODE +auth_sam_OBJ_FILES = $(addprefix auth/, sam.o ntlm_check.o) + [SUBSYSTEM::auth_sam_reply] PRIVATE_PROTO_HEADER = auth_sam_reply.h -OBJ_FILES = auth_sam_reply.o + +auth_sam_reply_OBJ_FILES = $(addprefix auth/, auth_sam_reply.o) ####################### # Start MODULE auth_sam @@ -33,64 +37,65 @@ OBJ_FILES = auth_sam_reply.o # gensec_krb5 and gensec_gssapi depend on it INIT_FUNCTION = auth_sam_init SUBSYSTEM = auth -OBJ_FILES = auth_sam.o PRIVATE_DEPENDENCIES = \ SAMDB auth_sam # End MODULE auth_sam ####################### +auth_sam_module_OBJ_FILES = $(addprefix auth/, auth_sam.o) + ####################### # Start MODULE auth_anonymous [MODULE::auth_anonymous] INIT_FUNCTION = auth_anonymous_init SUBSYSTEM = auth -OBJ_FILES = auth_anonymous.o # End MODULE auth_anonymous ####################### +auth_anonymous_OBJ_FILES = $(addprefix auth/, auth_anonymous.o) + ####################### # Start MODULE auth_winbind [MODULE::auth_winbind] INIT_FUNCTION = auth_winbind_init SUBSYSTEM = auth -OBJ_FILES = auth_winbind.o PRIVATE_DEPENDENCIES = NDR_WINBIND MESSAGING LIBWINBIND-CLIENT # End MODULE auth_winbind ####################### +auth_winbind_OBJ_FILES = $(addprefix auth/, auth_winbind.o) + ####################### # Start MODULE auth_developer [MODULE::auth_developer] INIT_FUNCTION = auth_developer_init SUBSYSTEM = auth -OBJ_FILES = auth_developer.o # End MODULE auth_developer ####################### +auth_developer_OBJ_FILES = $(addprefix auth/, auth_developer.o) + [MODULE::auth_unix] INIT_FUNCTION = auth_unix_init SUBSYSTEM = auth -OBJ_FILES = auth_unix.o PRIVATE_DEPENDENCIES = CRYPT PAM PAM_ERRORS NSS_WRAPPER +auth_unix_OBJ_FILES = $(addprefix auth/, auth_unix.o) + [SUBSYSTEM::PAM_ERRORS] PRIVATE_PROTO_HEADER = pam_errors.h -OBJ_FILES = pam_errors.o -####################### -# Start SUBSYSTEM auth -[SUBSYSTEM::auth] #VERSION = 0.0.1 #SO_VERSION = 0 +PAM_ERRORS_OBJ_FILES = $(addprefix auth/, pam_errors.o) + +[MODULE::service_auth] +INIT_FUNCTION = server_service_auth_init +SUBSYSTEM = smbd PRIVATE_PROTO_HEADER = auth_proto.h -OBJ_FILES = \ - auth.o \ - auth_util.o \ - auth_simple.o -PUBLIC_DEPENDENCIES = LIBSECURITY SAMDB CREDENTIALS -PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL -# End SUBSYSTEM auth -####################### +PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL LIBSECURITY SAMDB CREDENTIALS + +service_auth_OBJ_FILES = $(addprefix auth/, auth.o auth_util.o auth_simple.o) # PUBLIC_HEADERS += auth/auth.h @@ -98,3 +103,5 @@ PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL PUBLIC_DEPENDENCIES = auth_system_session PRIVATE_DEPENDENCIES = SAMDB SWIG_FILE = auth.i + +swig_auth_OBJ_FILES = auth/auth_wrap.o diff --git a/source4/auth/credentials/config.mk b/source4/auth/credentials/config.mk index 83f2f0db93..6f3ec3997c 100644 --- a/source4/auth/credentials/config.mk +++ b/source4/auth/credentials/config.mk @@ -2,18 +2,17 @@ # Start SUBSYSTEM CREDENTIALS [SUBSYSTEM::CREDENTIALS] PRIVATE_PROTO_HEADER = credentials_proto.h -OBJ_FILES = credentials.o \ - credentials_files.o \ - credentials_ntlm.o \ - credentials_krb5.o \ - ../kerberos/kerberos_util.o PUBLIC_DEPENDENCIES = \ LIBCLI_AUTH SECRETS LIBCRYPTO KERBEROS UTIL_LDB HEIMDAL_GSSAPI PRIVATE_DEPENDENCIES = \ SECRETS +CREDENTIALS_OBJ_FILES = $(addprefix auth/credentials/, credentials.o credentials_files.o credentials_ntlm.o credentials_krb5.o ../kerberos/kerberos_util.o) + PUBLIC_HEADERS += auth/credentials/credentials.h [PYTHON::swig_credentials] PUBLIC_DEPENDENCIES = CREDENTIALS LIBCMDLINE_CREDENTIALS SWIG_FILE = credentials.i + +swig_credentials_OBJ_FILES = auth/credentials/credentials_wrap.o diff --git a/source4/auth/gensec/config.mk b/source4/auth/gensec/config.mk index 14864f7e4c..e5fb2ef201 100644 --- a/source4/auth/gensec/config.mk +++ b/source4/auth/gensec/config.mk @@ -5,12 +5,13 @@ PC_FILE = gensec.pc VERSION = 0.0.1 SO_VERSION = 0 PRIVATE_PROTO_HEADER = gensec_proto.h -OBJ_FILES = gensec.o socket.o PUBLIC_DEPENDENCIES = \ CREDENTIALS LIBSAMBA-UTIL LIBCRYPTO ASN1_UTIL samba-socket LIBPACKET # End SUBSYSTEM gensec ################################# +gnesec_OBJ_FILES = $(addprefix auth/gensec/, gensec.o socket.o) + PUBLIC_HEADERS += auth/gensec/gensec.h ################################################ @@ -18,31 +19,34 @@ PUBLIC_HEADERS += auth/gensec/gensec.h [MODULE::gensec_krb5] SUBSYSTEM = gensec INIT_FUNCTION = gensec_krb5_init -OBJ_FILES = gensec_krb5.o PRIVATE_DEPENDENCIES = CREDENTIALS KERBEROS auth auth_sam # End MODULE gensec_krb5 ################################################ +gensec_krb5_OBJ_FILES = gensec_krb5.o + ################################################ # Start MODULE gensec_gssapi [MODULE::gensec_gssapi] SUBSYSTEM = gensec INIT_FUNCTION = gensec_gssapi_init -OBJ_FILES = gensec_gssapi.o PRIVATE_DEPENDENCIES = HEIMDAL_GSSAPI CREDENTIALS KERBEROS # End MODULE gensec_gssapi ################################################ +gensec_gssapi_OBJ_FILES = gensec_gssapi.o + ################################################ # Start MODULE cyrus_sasl [MODULE::cyrus_sasl] SUBSYSTEM = gensec INIT_FUNCTION = gensec_sasl_init -OBJ_FILES = cyrus_sasl.o PRIVATE_DEPENDENCIES = CREDENTIALS SASL # End MODULE cyrus_sasl ################################################ +cyrus_sasl_OBJ_FILES = auth/gensec/cyrus_sasl.o + ################################################ # Start MODULE gensec_spnego [MODULE::gensec_spnego] @@ -50,31 +54,32 @@ SUBSYSTEM = gensec INIT_FUNCTION = gensec_spnego_init PRIVATE_PROTO_HEADER = spnego_proto.h PRIVATE_DEPENDENCIES = ASN1_UTIL CREDENTIALS -OBJ_FILES = spnego.o spnego_parse.o # End MODULE gensec_spnego ################################################ +gensec_spnego_OBJ_FILES = $(addprefix auth/gensec/, spnego.o spnego_parse.o) + ################################################ # Start MODULE gensec_schannel [MODULE::gensec_schannel] SUBSYSTEM = gensec PRIVATE_PROTO_HEADER = schannel_proto.h INIT_FUNCTION = gensec_schannel_init -OBJ_FILES = schannel.o \ - schannel_sign.o PRIVATE_DEPENDENCIES = SCHANNELDB NDR_SCHANNEL CREDENTIALS LIBNDR OUTPUT_TYPE = MERGED_OBJ # End MODULE gensec_schannel ################################################ +gensec_schannel_OBJ_FILES = $(addprefix auth/gensec/, schannel.o schannel_sign.o) + ################################################ # Start SUBSYSTEM SCHANNELDB [SUBSYSTEM::SCHANNELDB] PRIVATE_PROTO_HEADER = schannel_state.h -OBJ_FILES = \ - schannel_state.o PRIVATE_DEPENDENCIES = LDB_WRAP SAMDB # # End SUBSYSTEM SCHANNELDB ################################################ +SCHANNELDB_OBJ_FILES = auth/gensec/schannel_state.o + diff --git a/source4/auth/kerberos/config.mk b/source4/auth/kerberos/config.mk index 7493a6d06d..762d6f8c49 100644 --- a/source4/auth/kerberos/config.mk +++ b/source4/auth/kerberos/config.mk @@ -2,13 +2,16 @@ # Start SUBSYSTEM KERBEROS [SUBSYSTEM::KERBEROS] PRIVATE_PROTO_HEADER = proto.h -OBJ_FILES = kerberos.o \ - clikrb5.o \ - kerberos_heimdal.o \ - kerberos_pac.o \ - gssapi_parse.o \ - krb5_init_context.o PUBLIC_DEPENDENCIES = HEIMDAL_KRB5 NDR_KRB5PAC samba-socket LIBCLI_RESOLVE PRIVATE_DEPENDENCIES = ASN1_UTIL auth_sam_reply LIBPACKET LIBNDR # End SUBSYSTEM KERBEROS ################################# + +KERBEROS_OBJ_FILES = $(addprefix auth/kerberos/, \ + kerberos.o \ + clikrb5.o \ + kerberos_heimdal.o \ + kerberos_pac.o \ + gssapi_parse.o \ + krb5_init_context.o) + diff --git a/source4/auth/ntlmssp/config.mk b/source4/auth/ntlmssp/config.mk index 9033384b1f..f8e711feda 100644 --- a/source4/auth/ntlmssp/config.mk +++ b/source4/auth/ntlmssp/config.mk @@ -1,6 +1,7 @@ [SUBSYSTEM::MSRPC_PARSE] PRIVATE_PROTO_HEADER = msrpc_parse.h -OBJ_FILES = ntlmssp_parse.o + +MSRPC_PARSE_OBJ_FILES = $(addprefix auth/ntlmssp/, ntlmssp_parse.o) ################################################ # Start MODULE gensec_ntlmssp @@ -8,11 +9,9 @@ OBJ_FILES = ntlmssp_parse.o SUBSYSTEM = gensec INIT_FUNCTION = gensec_ntlmssp_init PRIVATE_PROTO_HEADER = proto.h -OBJ_FILES = ntlmssp.o \ - ntlmssp_sign.o \ - ntlmssp_client.o \ - ntlmssp_server.o PRIVATE_DEPENDENCIES = MSRPC_PARSE CREDENTIALS OUTPUT_TYPE = MERGED_OBJ # End MODULE gensec_ntlmssp ################################################ + +gensec_ntlmssp_OBJ_FILES = $(addprefix auth/ntlmssp/, ntlmssp.o ntlmssp_sign.o ntlmssp_client.o ntlmssp_server.o) diff --git a/source4/build/m4/public.m4 b/source4/build/m4/public.m4 index eb673446c7..76a11f0a38 100644 --- a/source4/build/m4/public.m4 +++ b/source4/build/m4/public.m4 @@ -4,7 +4,7 @@ dnl Copyright (C) 2004 Stefan Metzmacher dnl Copyright (C) 2004-2005 Jelmer Vernooij dnl Published under the GPL dnl -dnl SMB_SUBSYSTEM(name,obj_files,required_subsystems) +dnl SMB_SUBSYSTEM(name,required_subsystems) dnl dnl SMB_EXT_LIB_FROM_PKGCONFIG(name,pkg-config name,[ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND]) dnl @@ -18,11 +18,10 @@ dnl ####################################################### dnl ### And now the implementation ### dnl ####################################################### -dnl SMB_SUBSYSTEM(name,obj_files,required_subsystems,cflags) +dnl SMB_SUBSYSTEM(name,required_subsystems,cflags) AC_DEFUN([SMB_SUBSYSTEM], [ MAKE_SETTINGS="$MAKE_SETTINGS -$1_OBJ_FILES = $2 $1_CFLAGS = $4 $1_ENABLE = YES " @@ -31,7 +30,6 @@ SMB_INFO_SUBSYSTEMS="$SMB_INFO_SUBSYSTEMS ################################### # Start Subsystem $1 @<:@SUBSYSTEM::$1@:>@ -OBJ_FILES = \$($1_OBJ_FILES) PRIVATE_DEPENDENCIES = $3 CFLAGS = \$($1_CFLAGS) ENABLE = YES @@ -40,11 +38,10 @@ ENABLE = YES " ]) -dnl SMB_LIBRARY(name,obj_files,required_subsystems,version,so_version,cflags,ldflags) +dnl SMB_LIBRARY(name,required_subsystems,version,so_version,cflags,ldflags) AC_DEFUN([SMB_LIBRARY], [ MAKE_SETTINGS="$MAKE_SETTINGS -$1_OBJ_FILES = $2 $1_CFLAGS = $6 $1_LDFLAGS = $7 $1_ENABLE = YES @@ -54,7 +51,6 @@ SMB_INFO_LIBRARIES="$SMB_INFO_LIBRARIES ################################### # Start Library $1 @<:@LIBRARY::$1@:>@ -OBJ_FILES = \$($1_OBJ_FILES) PRIVATE_DEPENDENCIES = $3 VERSION = $4 SO_VERSION = $5 diff --git a/source4/build/smb_build/config_mk.pm b/source4/build/smb_build/config_mk.pm index d8ec646910..de786ddbe5 100644 --- a/source4/build/smb_build/config_mk.pm +++ b/source4/build/smb_build/config_mk.pm @@ -23,14 +23,11 @@ my $section_types = { SWIG_FILE => "string", "PRIVATE_DEPENDENCIES" => "list", "PUBLIC_DEPENDENCIES" => "list", - "OBJ_FILES" => "list", "ENABLE" => "bool", "LDFLAGS" => "list", "CFLAGS" => "list", }, "SUBSYSTEM" => { - "OBJ_FILES" => "list", - "PRIVATE_DEPENDENCIES" => "list", "PUBLIC_DEPENDENCIES" => "list", @@ -47,7 +44,6 @@ my $section_types = { "SUBSYSTEM" => "string", "INIT_FUNCTION" => "string", - "OBJ_FILES" => "list", "PRIVATE_DEPENDENCIES" => "list", @@ -62,7 +58,6 @@ my $section_types = { "CFLAGS" => "list" }, "BINARY" => { - "OBJ_FILES" => "list", "PRIVATE_DEPENDENCIES" => "list", @@ -88,8 +83,6 @@ my $section_types = { "INIT_FUNCTION_SENTINEL" => "string", "OUTPUT_TYPE" => "list", - "OBJ_FILES" => "list", - "PRIVATE_DEPENDENCIES" => "list", "PUBLIC_DEPENDENCIES" => "list", @@ -223,6 +216,9 @@ sub run_config_mk($$$$) { $section = $1; $infragment = 0; + + $result->{$section}{EXISTS}{KEY} = "EXISTS"; + $result->{$section}{EXISTS}{VAL} = 1; next; } @@ -233,6 +229,7 @@ sub run_config_mk($$$$) $subdir =~ s/^\.$//g; $subdir =~ s/^\.\///g; $subdir .= "/" if ($subdir ne ""); + $makefile .= "basedir := $subdir\n"; $makefile .= run_config_mk($input, $srcdir, $builddir, $subdir.$subfile); next; } @@ -280,6 +277,7 @@ sub run_config_mk($$$$) $input->{$name}{BASEDIR} = $basedir; foreach my $key (values %{$result->{$section}}) { + next if ($key->{KEY} eq "EXISTS"); $key->{VAL} = smb_build::input::strtrim($key->{VAL}); my $vartype = $sectype->{$key->{KEY}}; if (not defined($vartype)) { diff --git a/source4/build/smb_build/input.pm b/source4/build/smb_build/input.pm index 948f2657b4..9949836675 100644 --- a/source4/build/smb_build/input.pm +++ b/source4/build/smb_build/input.pm @@ -91,6 +91,9 @@ sub check_module($$$) } if (not defined($mod->{OUTPUT_TYPE})) { + if (not defined($INPUT->{$mod->{SUBSYSTEM}}->{TYPE})) { + die("Invalid type for subsystem $mod->{SUBSYSTEM}"); + } if ($INPUT->{$mod->{SUBSYSTEM}}->{TYPE} eq "EXT_LIB") { $mod->{OUTPUT_TYPE} = undef; } else { @@ -107,7 +110,7 @@ sub check_module($$$) } if (grep(/MERGED_OBJ/, @{$mod->{OUTPUT_TYPE}})) { push (@{$INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTIONS}}, $mod->{INIT_FUNCTION}) if defined($mod->{INIT_FUNCTION}); - unshift (@{$INPUT->{$mod->{SUBSYSTEM}}{PRIVATE_DEPENDENCIES}}, $mod->{NAME}); + push (@{$INPUT->{$mod->{SUBSYSTEM}}{PRIVATE_DEPENDENCIES}}, $mod->{NAME}); } } @@ -151,7 +154,6 @@ sub check_python($$$) $dirname .= "/" unless $dirname =~ /\/$/; $dirname = "" if $dirname eq "./"; - $python->{OBJ_FILES} = ["$dirname$basename\_wrap.o"]; $python->{LIBRARY_REALNAME} = "_$basename.\$(SHLIBEXT)"; $python->{PYTHON_FILES} = ["$dirname$basename.py"]; push (@{$python->{CFLAGS}}, "\$(CFLAG_NO_UNUSED_MACROS)"); @@ -189,7 +191,6 @@ sub add_implicit($$) $INPUT->{$n} = { TYPE => "MAKE_RULE", NAME => $n, - TARGET => "", OUTPUT_TYPE => undef, LIBS => ["\$(".uc($n)."_LIBS)"], LDFLAGS => ["\$(".uc($n)."_LDFLAGS)"], @@ -249,7 +250,7 @@ sub check($$$$$) foreach my $part (values %$INPUT) { $part->{LINK_FLAGS} = []; - $part->{FULL_OBJ_LIST} = ["\$($part->{NAME}_OBJ_LIST)"]; + $part->{FULL_OBJ_LIST} = ["\$($part->{NAME}_OBJ_FILES)"]; if ($part->{TYPE} eq "SUBSYSTEM") { check_subsystem($INPUT, $part, $subsys_ot); diff --git a/source4/cldap_server/config.mk b/source4/cldap_server/config.mk index 9dd3758e7a..c10cf57b5b 100644 --- a/source4/cldap_server/config.mk +++ b/source4/cldap_server/config.mk @@ -6,11 +6,13 @@ INIT_FUNCTION = server_service_cldapd_init SUBSYSTEM = service PRIVATE_PROTO_HEADER = proto.h -OBJ_FILES = \ - cldap_server.o \ - netlogon.o \ - rootdse.o PRIVATE_DEPENDENCIES = \ LIBCLI_CLDAP LIBNETIF process_model # End SUBSYSTEM CLDAPD ####################### + +CLDAPD_OBJ_FILES = $(addprefix cldap_server/, \ + cldap_server.o \ + netlogon.o \ + rootdse.o) + diff --git a/source4/client/config.mk b/source4/client/config.mk index 2085faf61e..5cfa542fba 100644 --- a/source4/client/config.mk +++ b/source4/client/config.mk @@ -4,8 +4,6 @@ # Start BINARY smbclient [BINARY::smbclient] INSTALLDIR = BINDIR -OBJ_FILES = \ - client.o PRIVATE_DEPENDENCIES = \ LIBSAMBA-HOSTCONFIG \ SMBREADLINE \ @@ -20,13 +18,12 @@ PRIVATE_DEPENDENCIES = \ # End BINARY smbclient ################################# +smbclient_OBJ_FILES = client/client.o + ################################# # Start BINARY cifsdd [BINARY::cifsdd] INSTALLDIR = BINDIR -OBJ_FILES = \ - cifsdd.o \ - cifsddio.o PRIVATE_DEPENDENCIES = \ LIBSAMBA-HOSTCONFIG \ LIBCLI_SMB \ @@ -36,3 +33,4 @@ PRIVATE_DEPENDENCIES = \ # End BINARY sdd ################################# +cifsdd_OBJ_FILES = client/cifsdd.o client/cifsddio.o diff --git a/source4/cluster/config.mk b/source4/cluster/config.mk index 8b225202fb..00ac597f94 100644 --- a/source4/cluster/config.mk +++ b/source4/cluster/config.mk @@ -1,7 +1,6 @@ mkinclude ctdb/config.mk -#################### [SUBSYSTEM::CLUSTER] -OBJ_FILES = cluster.o \ - local.o PRIVATE_DEPENDENCIES = ctdb + +CLUSTER_OBJ_FILES = cluster/cluster.o cluster/local.o diff --git a/source4/cluster/ctdb/config.mk b/source4/cluster/ctdb/config.mk index b8199cafe4..01c639d142 100644 --- a/source4/cluster/ctdb/config.mk +++ b/source4/cluster/ctdb/config.mk @@ -1,20 +1,24 @@ ################## [SUBSYSTEM::brlock_ctdb] -OBJ_FILES = brlock_ctdb.o PUBLIC_DEPENDENCIES = ctdb +brlock_ctdb_OBJ_FILES = cluster/ctdb/brlock_ctdb.o + ################## [SUBSYSTEM::opendb_ctdb] -OBJ_FILES = opendb_ctdb.o PUBLIC_DEPENDENCIES = ctdb +opendb_ctdb_OBJ_FILES = cluster/ctdb/opendb_ctdb.o + ################## [SUBSYSTEM::ctdb] -OBJ_FILES = \ +PUBLIC_DEPENDENCIES = TDB_WRAP LIBTALLOC + +ctdb_OBJ_FILES = $(addprefix cluster/ctdb/, \ ctdb_cluster.o \ client/ctdb_client.o \ common/ctdb_io.o \ common/ctdb_ltdb.o \ common/ctdb_message.o \ - common/ctdb_util.o -PUBLIC_DEPENDENCIES = TDB_WRAP LIBTALLOC + common/ctdb_util.o) + diff --git a/source4/dsdb/config.mk b/source4/dsdb/config.mk index 1a20add91c..e334e4c6e3 100644 --- a/source4/dsdb/config.mk +++ b/source4/dsdb/config.mk @@ -10,31 +10,33 @@ PUBLIC_DEPENDENCIES = HEIMDAL_KRB5 PRIVATE_DEPENDENCIES = LIBNDR NDR_MISC NDR_DRSUAPI NDR_DRSBLOBS NSS_WRAPPER \ auth_system_session LDAP_ENCODE LIBCLI_AUTH LIBNDR \ SAMDB_SCHEMA LDB_WRAP SAMDB_COMMON -OBJ_FILES = \ + + +SAMDB_OBJ_FILES = $(addprefix dsdb/, \ samdb/samdb.o \ samdb/samdb_privilege.o \ samdb/cracknames.o \ - repl/replicated_objects.o - + repl/replicated_objects.o) # PUBLIC_HEADERS += dsdb/samdb/samdb.h [SUBSYSTEM::SAMDB_COMMON] PRIVATE_PROTO_HEADER = common/proto.h PRIVATE_DEPENDENCIES = LIBLDB -OBJ_FILES = \ - common/sidmap.o \ - common/flag_mapping.o \ - common/util.o + +SAMDB_COMMON_OBJ_FILES = $(addprefix dsdb/common/, \ + sidmap.o \ + flag_mapping.o \ + util.o) [SUBSYSTEM::SAMDB_SCHEMA] PRIVATE_PROTO_HEADER = schema/proto.h PRIVATE_DEPENDENCIES = SAMDB_COMMON NDR_DRSUAPI NDR_DRSBLOBS -OBJ_FILES = \ - schema/schema_init.o \ - schema/schema_syntax.o \ - schema/schema_constructed.o \ +SAMDB_SCHEMA_OBJ_FILES = $(addprefix dsdb/schema/, \ + schema_init.o \ + schema_syntax.o \ + schema_constructed.o) # PUBLIC_HEADERS += dsdb/schema/schema.h @@ -43,15 +45,17 @@ OBJ_FILES = \ [MODULE::DREPL_SRV] INIT_FUNCTION = server_service_drepl_init SUBSYSTEM = service -OBJ_FILES = \ - repl/drepl_service.o \ - repl/drepl_periodic.o \ - repl/drepl_partitions.o \ - repl/drepl_out_pull.o \ - repl/drepl_out_helpers.o PRIVATE_PROTO_HEADER = repl/drepl_service_proto.h PRIVATE_DEPENDENCIES = \ SAMDB \ process_model # End SUBSYSTEM DREPL_SRV ####################### + +DREPL_SRV_OBJ_FILES = $(addprefix dsdb/repl/, \ + drepl_service.o \ + drepl_periodic.o \ + drepl_partitions.o \ + drepl_out_pull.o \ + drepl_out_helpers.o) + diff --git a/source4/dsdb/samdb/ldb_modules/config.mk b/source4/dsdb/samdb/ldb_modules/config.mk index de93b5638d..dd1c8b10db 100644 --- a/source4/dsdb/samdb/ldb_modules/config.mk +++ b/source4/dsdb/samdb/ldb_modules/config.mk @@ -5,11 +5,11 @@ SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = LIBTALLOC LIBNDR NDR_MISC INIT_FUNCTION = objectguid_module_module_ops -OBJ_FILES = \ - objectguid.o # End MODULE ldb_objectguid ################################################ +ldb_objectguid_OBJ_FILES = dsdb/samdb/ldb_modules/objectguid.o + ################################################ # Start MODULE ldb_repl_meta_data [MODULE::ldb_repl_meta_data] @@ -18,11 +18,12 @@ OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = SAMDB LIBTALLOC LIBNDR NDR_MISC NDR_DRSUAPI \ NDR_DRSBLOBS LIBNDR INIT_FUNCTION = repl_meta_data_module_module_ops -OBJ_FILES = \ - repl_meta_data.o # End MODULE ldb_repl_meta_data ################################################ +ldb_repl_meta_data_OBJ_FILES = \ + repl_meta_data.o + ################################################ # Start MODULE ldb_dsdb_cache [MODULE::ldb_dsdb_cache] @@ -30,11 +31,12 @@ SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = SAMDB LIBTALLOC INIT_FUNCTION = dsdb_cache_module_module_ops -OBJ_FILES = \ - dsdb_cache.o # End MODULE ldb_dsdb_cache ################################################ +ldb_dsdb_cache_OBJ_FILES = \ + dsdb_cache.o + ################################################ # Start MODULE ldb_schema_fsmo [MODULE::ldb_schema_fsmo] @@ -42,11 +44,12 @@ SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = SAMDB LIBTALLOC INIT_FUNCTION = schema_fsmo_module_module_ops -OBJ_FILES = \ - schema_fsmo.o # End MODULE ldb_schema_fsmo ################################################ +ldb_schema_fsmo_OBJ_FILES = \ + schema_fsmo.o + ################################################ # Start MODULE ldb_naming_fsmo [MODULE::ldb_naming_fsmo] @@ -54,11 +57,12 @@ SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = SAMDB LIBTALLOC INIT_FUNCTION = naming_fsmo_module_module_ops -OBJ_FILES = \ - naming_fsmo.o # End MODULE ldb_naming_fsmo ################################################ +ldb_naming_fsmo_OBJ_FILES = \ + naming_fsmo.o + ################################################ # Start MODULE ldb_pdc_fsmo [MODULE::ldb_pdc_fsmo] @@ -66,11 +70,12 @@ SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = SAMDB LIBTALLOC INIT_FUNCTION = pdc_fsmo_module_module_ops -OBJ_FILES = \ - pdc_fsmo.o # End MODULE ldb_pdc_fsmo ################################################ +ldb_pdc_fsmo_OBJ_FILES = \ + pdc_fsmo.o + ################################################ # Start MODULE ldb_samldb [MODULE::ldb_samldb] @@ -78,12 +83,13 @@ SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = LIBTALLOC LDAP_ENCODE NDR_MISC SAMDB INIT_FUNCTION = samldb_module_module_ops -OBJ_FILES = \ - samldb.o # # End MODULE ldb_samldb ################################################ +ldb_samldb_OBJ_FILES = \ + samldb.o + ################################################ # Start MODULE ldb_samba3sam [MODULE::ldb_samba3sam] @@ -92,12 +98,13 @@ OUTPUT_TYPE = SHARED_LIBRARY INIT_FUNCTION = &ldb_samba3sam_module_module_ops PRIVATE_DEPENDENCIES = LIBTALLOC ldb_map SMBPASSWD NSS_WRAPPER LIBSECURITY \ NDR_SECURITY -OBJ_FILES = \ - samba3sam.o # # End MODULE ldb_samldb ################################################ +ldb_samba3sam_OBJ_FILES = \ + samba3sam.o + ################################################ # Start MODULE ldb_simple_ldap_map [MODULE::ldb_simple_ldap_map] @@ -107,12 +114,13 @@ INIT_FUNCTION = &ldb_simple_ldap_map_module_module_ops PRIVATE_DEPENDENCIES = LIBTALLOC ldb_map LIBNDR NDR_MISC ENABLE = YES ALIASES = entryuuid nsuniqueid -OBJ_FILES = \ - simple_ldap_map.o # # End MODULE ldb_entryuuid ################################################ +ldb_simple_ldap_map_OBJ_FILES = \ + simple_ldap_map.o + # ################################################ # # Start MODULE ldb_proxy # [MODULE::ldb_proxy] @@ -132,25 +140,24 @@ SUBSYSTEM = LIBLDB PRIVATE_DEPENDENCIES = LIBTALLOC SAMDB OUTPUT_TYPE = SHARED_LIBRARY INIT_FUNCTION = rootdse_module_module_ops -OBJ_FILES = \ - rootdse.o -# # End MODULE ldb_rootdse ################################################ +ldb_rootdse_OBJ_FILES = dsdb/samdb/ldb_modules/rootdse.o + ################################################ # Start MODULE ldb_password_hash [MODULE::ldb_password_hash] SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY INIT_FUNCTION = password_hash_module_module_ops -OBJ_FILES = password_hash.o PRIVATE_DEPENDENCIES = HEIMDAL_HDB_KEYS LIBTALLOC HEIMDAL_KRB5 LDAP_ENCODE \ LIBCLI_AUTH NDR_DRSBLOBS KERBEROS SAMDB -# # End MODULE ldb_password_hash ################################################ +ldb_password_hash_OBJ_FILES = dsdb/samdb/ldb_modules/password_hash.o + ################################################ # Start MODULE ldb_local_password [MODULE::ldb_local_password] @@ -158,11 +165,11 @@ PRIVATE_DEPENDENCIES = LIBTALLOC LIBNDR SAMDB OUTPUT_TYPE = SHARED_LIBRARY SUBSYSTEM = LIBLDB INIT_FUNCTION = local_password_module_module_ops -OBJ_FILES = local_password.o -# # End MODULE ldb_local_password ################################################ +ldb_local_password_OBJ_FILES = dsdb/samdb/ldb_modules/local_password.o + ################################################ # Start MODULE ldb_kludge_acl [MODULE::ldb_kludge_acl] @@ -170,12 +177,12 @@ PRIVATE_DEPENDENCIES = LIBTALLOC LIBSECURITY SAMDB OUTPUT_TYPE = SHARED_LIBRARY SUBSYSTEM = LIBLDB INIT_FUNCTION = &ldb_kludge_acl_module_ops -OBJ_FILES = \ - kludge_acl.o -# + # End MODULE ldb_kludge_acl ################################################ +ldb_kludge_acl_OBJ_FILES = dsdb/samdb/ldb_modules/kludge_acl.o + ################################################ # Start MODULE ldb_extended_dn [MODULE::ldb_extended_dn] @@ -183,12 +190,11 @@ SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = LIBTALLOC LIBNDR LIBSECURITY SAMDB INIT_FUNCTION = &ldb_extended_dn_module_ops -OBJ_FILES = \ - extended_dn.o -# # End MODULE ldb_extended_dn ################################################ +ldb_extended_dn_OBJ_FILES = dsdb/samdb/ldb_modules/extended_dn.o + ################################################ # Start MODULE ldb_show_deleted [MODULE::ldb_show_deleted] @@ -196,12 +202,11 @@ SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = LIBTALLOC INIT_FUNCTION = &ldb_show_deleted_module_ops -OBJ_FILES = \ - show_deleted.o -# # End MODULE ldb_show_deleted ################################################ +ldb_show_deleted_OBJ_FILES = dsdb/samdb/ldb_modules/show_deleted.o + ################################################ # Start MODULE ldb_partition [MODULE::ldb_partition] @@ -209,12 +214,11 @@ SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = LIBTALLOC SAMDB INIT_FUNCTION = &ldb_partition_module_ops -OBJ_FILES = \ - partition.o -# # End MODULE ldb_partition ################################################ +ldb_partition_OBJ_FILES = dsdb/samdb/ldb_modules/partition.o + ################################################ # Start MODULE ldb_schema [MODULE::ldb_schema] @@ -222,12 +226,11 @@ SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = LIBTALLOC LIBLDB INIT_FUNCTION = &ldb_schema_module_ops -OBJ_FILES = \ - schema.o schema_syntax.o -# # End MODULE ldb_schema ################################################ +ldb_schema_OBJ_FILES = $(addprefix dsdb/samdb/ldb_modules/, schema.o schema_syntax.o) + ################################################ # Start MODULE ldb_update_kt [MODULE::ldb_update_keytab] @@ -236,12 +239,11 @@ OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = LIBTALLOC CREDENTIALS #Also depends on credentials, but that would loop INIT_FUNCTION = &ldb_update_kt_module_ops -OBJ_FILES = \ - update_keytab.o -# # End MODULE ldb_update_kt ################################################ +ldb_update_keytab_OBJ_FILES = dsdb/samdb/ldb_modules/update_keytab.o + ################################################ # Start MODULE ldb_objectclass [MODULE::ldb_objectclass] @@ -250,11 +252,11 @@ OUTPUT_TYPE = SHARED_LIBRARY CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC LIBSECURITY NDR_SECURITY SAMDB SUBSYSTEM = LIBLDB -OBJ_FILES = \ - objectclass.o # End MODULE ldb_objectclass ################################################ +ldb_objectclass_OBJ_FILES = dsdb/samdb/ldb_modules/objectclass.o + ################################################ # Start MODULE ldb_subtree_rename [MODULE::ldb_subtree_rename] @@ -262,11 +264,11 @@ INIT_FUNCTION = &ldb_subtree_rename_module_ops CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC SUBSYSTEM = LIBLDB -OBJ_FILES = \ - subtree_rename.o # End MODULE ldb_subtree_rename ################################################ +ldb_subtree_rename_OBJ_FILES = dsdb/samdb/ldb_modules/subtree_rename.o + ################################################ # Start MODULE ldb_subtree_rename [MODULE::ldb_subtree_delete] @@ -274,11 +276,11 @@ INIT_FUNCTION = &ldb_subtree_delete_module_ops CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC SUBSYSTEM = LIBLDB -OBJ_FILES = \ - subtree_delete.o # End MODULE ldb_subtree_rename ################################################ +ldb_subtree_delete_OBJ_FILES = dsdb/samdb/ldb_modules/subtree_delete.o + ################################################ # Start MODULE ldb_linked_attributes [MODULE::ldb_linked_attributes] @@ -287,11 +289,11 @@ CFLAGS = -Ilib/ldb/include OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = LIBTALLOC SAMDB SUBSYSTEM = LIBLDB -OBJ_FILES = \ - linked_attributes.o # End MODULE ldb_linked_attributes ################################################ +ldb_linked_attributes_OBJ_FILES = dsdb/samdb/ldb_modules/linked_attributes.o + ################################################ # Start MODULE ldb_ranged_results [MODULE::ldb_ranged_results] @@ -299,11 +301,11 @@ INIT_FUNCTION = &ldb_ranged_results_module_ops CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC SUBSYSTEM = LIBLDB -OBJ_FILES = \ - ranged_results.o # End MODULE ldb_ranged_results ################################################ +ldb_ranged_results_OBJ_FILES = dsdb/samdb/ldb_modules/ranged_results.o + ################################################ # Start MODULE ldb_anr [MODULE::ldb_anr] @@ -312,11 +314,11 @@ CFLAGS = -Ilib/ldb/include OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = LIBTALLOC LIBSAMBA-UTIL SAMDB SUBSYSTEM = LIBLDB -OBJ_FILES = \ - anr.o # End MODULE ldb_anr ################################################ +ldb_anr_OBJ_FILES = dsdb/samdb/ldb_modules/anr.o + ################################################ # Start MODULE ldb_normalise [MODULE::ldb_normalise] @@ -325,11 +327,11 @@ CFLAGS = -Ilib/ldb/include OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = LIBTALLOC LIBSAMBA-UTIL SAMDB SUBSYSTEM = LIBLDB -OBJ_FILES = \ - normalise.o # End MODULE ldb_normalise ################################################ +ldb_normalise_OBJ_FILES = dsdb/samdb/ldb_modules/normalise.o + ################################################ # Start MODULE ldb_instancetype [MODULE::ldb_instancetype] @@ -338,8 +340,8 @@ CFLAGS = -Ilib/ldb/include OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = LIBTALLOC SUBSYSTEM = LIBLDB -OBJ_FILES = \ - instancetype.o # End MODULE ldb_instancetype ################################################ +ldb_instancetype_OBJ_FILES = dsdb/samdb/ldb_modules/instancetype.o + diff --git a/source4/dynconfig.mk b/source4/dynconfig.mk index ba9c5467ba..487d924036 100644 --- a/source4/dynconfig.mk +++ b/source4/dynconfig.mk @@ -1,5 +1,6 @@ [SUBSYSTEM::DYNCONFIG] -OBJ_FILES = dynconfig.o + +DYNCONFIG_OBJ_FILES = dynconfig.o # set these to where to find various files # These can be overridden by command line switches (see smbd(8)) diff --git a/source4/heimdal_build/asn1_deps.pl b/source4/heimdal_build/asn1_deps.pl index b80e00d444..a2fbb5e3d0 100755 --- a/source4/heimdal_build/asn1_deps.pl +++ b/source4/heimdal_build/asn1_deps.pl @@ -87,11 +87,14 @@ my $depstr = join(' ', @deps); print '[SUBSYSTEM::HEIMDAL_'.uc($prefix).']'."\n"; print "CFLAGS = -Iheimdal_build -Iheimdal/lib/roken -I$dirname\n"; -print "OBJ_FILES = "; +print "PUBLIC_DEPENDENCIES = $depstr\n\n"; + +print "HEIMDAL_".uc($prefix)."_OBJ_FILES = "; foreach $o_file (@o_files) { print "\\\n\t$o_file"; } -print "\nPUBLIC_DEPENDENCIES = $depstr\n\n"; + +print "\n\n"; print "clean:: \n"; print "\t\@echo \"Deleting ASN1 output files generated from $file\"\n"; diff --git a/source4/heimdal_build/config.mk b/source4/heimdal_build/config.mk index 24d50acb05..33d2edb67b 100644 --- a/source4/heimdal_build/config.mk +++ b/source4/heimdal_build/config.mk @@ -2,334 +2,343 @@ # Start SUBSYSTEM HEIMDAL_KDC [SUBSYSTEM::HEIMDAL_KDC] CFLAGS = -Iheimdal_build -Iheimdal/kdc -OBJ_FILES = \ - ../heimdal/kdc/default_config.o \ - ../heimdal/kdc/kerberos5.o \ - ../heimdal/kdc/krb5tgs.o \ - ../heimdal/kdc/pkinit.o \ - ../heimdal/kdc/log.o \ - ../heimdal/kdc/misc.o \ - ../heimdal/kdc/524.o \ - ../heimdal/kdc/kerberos4.o \ - ../heimdal/kdc/kaserver.o \ - ../heimdal/kdc/digest.o \ - ../heimdal/kdc/process.o \ - ../heimdal/kdc/windc.o \ - ../heimdal/kdc/kx509.o PRIVATE_DEPENDENCIES = HEIMDAL_ROKEN HEIMDAL_KRB5 HEIMDAL_HDB HEIMDAL_HEIM_ASN1 HEIMDAL_DIGEST_ASN1 HEIMDAL_KX509_ASN1 PUBLIC_DEPENDENCIES = HEIMDAL_NTLM HEIMDAL_HCRYPTO # End SUBSYSTEM HEIMDAL_KDC ####################### +HEIMDAL_KDC_OBJ_FILES = \ + ./heimdal/kdc/default_config.o \ + ./heimdal/kdc/kerberos5.o \ + ./heimdal/kdc/krb5tgs.o \ + ./heimdal/kdc/pkinit.o \ + ./heimdal/kdc/log.o \ + ./heimdal/kdc/misc.o \ + ./heimdal/kdc/524.o \ + ./heimdal/kdc/kerberos4.o \ + ./heimdal/kdc/kaserver.o \ + ./heimdal/kdc/digest.o \ + ./heimdal/kdc/process.o \ + ./heimdal/kdc/windc.o \ + ./heimdal/kdc/kx509.o + [SUBSYSTEM::HEIMDAL_NTLM] CFLAGS = -Iheimdal_build -Iheimdal/lib/ntlm -OBJ_FILES = \ - ../heimdal/lib/ntlm/ntlm.o PRIVATE_DEPENDENCIES = HEIMDAL_ROKEN HEIMDAL_HCRYPTO HEIMDAL_KRB5 +HEIMDAL_NTLM_OBJ_FILES = \ + ./heimdal/lib/ntlm/ntlm.o + [SUBSYSTEM::HEIMDAL_HDB_KEYS] CFLAGS = -Iheimdal_build -Iheimdal/lib/hdb -OBJ_FILES = \ - ../heimdal/lib/hdb/keys.o PRIVATE_DEPENDENCIES = HEIMDAL_ROKEN HEIMDAL_HCRYPTO HEIMDAL_KRB5 \ HEIMDAL_HDB_ASN1 +HEIMDAL_HDB_KEYS_OBJ_FILES = ./heimdal/lib/hdb/keys.o + ####################### # Start SUBSYSTEM HEIMDAL_HDB [SUBSYSTEM::HEIMDAL_HDB] CFLAGS = -Iheimdal_build -Iheimdal/lib/hdb -OBJ_FILES = \ - ../heimdal/lib/hdb/db.o \ - ../heimdal/lib/hdb/dbinfo.o \ - ../heimdal/lib/hdb/hdb.o \ - ../heimdal/lib/hdb/ext.o \ - ../heimdal/lib/hdb/keytab.o \ - ../heimdal/lib/hdb/mkey.o \ - ../heimdal/lib/hdb/ndbm.o \ - ../heimdal/lib/hdb/hdb_err.o PRIVATE_DEPENDENCIES = HDB_LDB HEIMDAL_KRB5 HEIMDAL_HDB_KEYS HEIMDAL_ROKEN HEIMDAL_HCRYPTO HEIMDAL_COM_ERR HEIMDAL_HDB_ASN1 # End SUBSYSTEM HEIMDAL_HDB ####################### +HEIMDAL_HDB_OBJ_FILES = \ + ./heimdal/lib/hdb/db.o \ + ./heimdal/lib/hdb/dbinfo.o \ + ./heimdal/lib/hdb/hdb.o \ + ./heimdal/lib/hdb/ext.o \ + ./heimdal/lib/hdb/keytab.o \ + ./heimdal/lib/hdb/mkey.o \ + ./heimdal/lib/hdb/ndbm.o \ + ./heimdal/lib/hdb/hdb_err.o + ####################### # Start SUBSYSTEM HEIMDAL_GSSAPI [SUBSYSTEM::HEIMDAL_GSSAPI] CFLAGS = -Iheimdal_build -Iheimdal/lib/gssapi -Iheimdal/lib/gssapi/gssapi -Iheimdal/lib/gssapi/spnego -Iheimdal/lib/gssapi/krb5 -Iheimdal/lib/gssapi/mech -OBJ_FILES = \ - ../heimdal/lib/gssapi/mech/context.o \ - ../heimdal/lib/gssapi/mech/gss_krb5.o \ - ../heimdal/lib/gssapi/mech/gss_mech_switch.o \ - ../heimdal/lib/gssapi/mech/gss_process_context_token.o \ - ../heimdal/lib/gssapi/mech/gss_buffer_set.o \ - ../heimdal/lib/gssapi/mech/gss_add_cred.o \ - ../heimdal/lib/gssapi/mech/gss_add_oid_set_member.o \ - ../heimdal/lib/gssapi/mech/gss_compare_name.o \ - ../heimdal/lib/gssapi/mech/gss_release_oid_set.o \ - ../heimdal/lib/gssapi/mech/gss_create_empty_oid_set.o \ - ../heimdal/lib/gssapi/mech/gss_decapsulate_token.o \ - ../heimdal/lib/gssapi/mech/gss_inquire_cred_by_oid.o \ - ../heimdal/lib/gssapi/mech/gss_canonicalize_name.o \ - ../heimdal/lib/gssapi/mech/gss_inquire_sec_context_by_oid.o \ - ../heimdal/lib/gssapi/mech/gss_inquire_names_for_mech.o \ - ../heimdal/lib/gssapi/mech/gss_inquire_mechs_for_name.o \ - ../heimdal/lib/gssapi/mech/gss_wrap_size_limit.o \ - ../heimdal/lib/gssapi/mech/gss_names.o \ - ../heimdal/lib/gssapi/mech/gss_verify.o \ - ../heimdal/lib/gssapi/mech/gss_display_name.o \ - ../heimdal/lib/gssapi/mech/gss_duplicate_oid.o \ - ../heimdal/lib/gssapi/mech/gss_display_status.o \ - ../heimdal/lib/gssapi/mech/gss_release_buffer.o \ - ../heimdal/lib/gssapi/mech/gss_release_oid.o \ - ../heimdal/lib/gssapi/mech/gss_test_oid_set_member.o \ - ../heimdal/lib/gssapi/mech/gss_release_cred.o \ - ../heimdal/lib/gssapi/mech/gss_set_sec_context_option.o \ - ../heimdal/lib/gssapi/mech/gss_export_name.o \ - ../heimdal/lib/gssapi/mech/gss_seal.o \ - ../heimdal/lib/gssapi/mech/gss_acquire_cred.o \ - ../heimdal/lib/gssapi/mech/gss_unseal.o \ - ../heimdal/lib/gssapi/mech/gss_verify_mic.o \ - ../heimdal/lib/gssapi/mech/gss_accept_sec_context.o \ - ../heimdal/lib/gssapi/mech/gss_inquire_cred_by_mech.o \ - ../heimdal/lib/gssapi/mech/gss_indicate_mechs.o \ - ../heimdal/lib/gssapi/mech/gss_delete_sec_context.o \ - ../heimdal/lib/gssapi/mech/gss_sign.o \ - ../heimdal/lib/gssapi/mech/gss_utils.o \ - ../heimdal/lib/gssapi/mech/gss_init_sec_context.o \ - ../heimdal/lib/gssapi/mech/gss_oid_equal.o \ - ../heimdal/lib/gssapi/mech/gss_oid_to_str.o \ - ../heimdal/lib/gssapi/mech/gss_context_time.o \ - ../heimdal/lib/gssapi/mech/gss_encapsulate_token.o \ - ../heimdal/lib/gssapi/mech/gss_get_mic.o \ - ../heimdal/lib/gssapi/mech/gss_import_sec_context.o \ - ../heimdal/lib/gssapi/mech/gss_inquire_cred.o \ - ../heimdal/lib/gssapi/mech/gss_wrap.o \ - ../heimdal/lib/gssapi/mech/gss_import_name.o \ - ../heimdal/lib/gssapi/mech/gss_duplicate_name.o \ - ../heimdal/lib/gssapi/mech/gss_unwrap.o \ - ../heimdal/lib/gssapi/mech/gss_export_sec_context.o \ - ../heimdal/lib/gssapi/mech/gss_inquire_context.o \ - ../heimdal/lib/gssapi/mech/gss_release_name.o \ - ../heimdal/lib/gssapi/mech/gss_set_cred_option.o \ - ../heimdal/lib/gssapi/asn1_GSSAPIContextToken.o \ - ../heimdal/lib/gssapi/spnego/init_sec_context.o \ - ../heimdal/lib/gssapi/spnego/external.o \ - ../heimdal/lib/gssapi/spnego/compat.o \ - ../heimdal/lib/gssapi/spnego/context_stubs.o \ - ../heimdal/lib/gssapi/spnego/cred_stubs.o \ - ../heimdal/lib/gssapi/spnego/accept_sec_context.o \ - ../heimdal/lib/gssapi/krb5/copy_ccache.o \ - ../heimdal/lib/gssapi/krb5/delete_sec_context.o \ - ../heimdal/lib/gssapi/krb5/init_sec_context.o \ - ../heimdal/lib/gssapi/krb5/context_time.o \ - ../heimdal/lib/gssapi/krb5/init.o \ - ../heimdal/lib/gssapi/krb5/address_to_krb5addr.o \ - ../heimdal/lib/gssapi/krb5/get_mic.o \ - ../heimdal/lib/gssapi/krb5/inquire_context.o \ - ../heimdal/lib/gssapi/krb5/add_cred.o \ - ../heimdal/lib/gssapi/krb5/inquire_cred.o \ - ../heimdal/lib/gssapi/krb5/inquire_cred_by_oid.o \ - ../heimdal/lib/gssapi/krb5/inquire_cred_by_mech.o \ - ../heimdal/lib/gssapi/krb5/inquire_mechs_for_name.o \ - ../heimdal/lib/gssapi/krb5/inquire_names_for_mech.o \ - ../heimdal/lib/gssapi/krb5/indicate_mechs.o \ - ../heimdal/lib/gssapi/krb5/inquire_sec_context_by_oid.o \ - ../heimdal/lib/gssapi/krb5/export_sec_context.o \ - ../heimdal/lib/gssapi/krb5/import_sec_context.o \ - ../heimdal/lib/gssapi/krb5/duplicate_name.o \ - ../heimdal/lib/gssapi/krb5/import_name.o \ - ../heimdal/lib/gssapi/krb5/compare_name.o \ - ../heimdal/lib/gssapi/krb5/export_name.o \ - ../heimdal/lib/gssapi/krb5/canonicalize_name.o \ - ../heimdal/lib/gssapi/krb5/unwrap.o \ - ../heimdal/lib/gssapi/krb5/wrap.o \ - ../heimdal/lib/gssapi/krb5/release_name.o \ - ../heimdal/lib/gssapi/krb5/cfx.o \ - ../heimdal/lib/gssapi/krb5/8003.o \ - ../heimdal/lib/gssapi/krb5/arcfour.o \ - ../heimdal/lib/gssapi/krb5/encapsulate.o \ - ../heimdal/lib/gssapi/krb5/display_name.o \ - ../heimdal/lib/gssapi/krb5/sequence.o \ - ../heimdal/lib/gssapi/krb5/display_status.o \ - ../heimdal/lib/gssapi/krb5/release_buffer.o \ - ../heimdal/lib/gssapi/krb5/external.o \ - ../heimdal/lib/gssapi/krb5/compat.o \ - ../heimdal/lib/gssapi/krb5/acquire_cred.o \ - ../heimdal/lib/gssapi/krb5/release_cred.o \ - ../heimdal/lib/gssapi/krb5/set_cred_option.o \ - ../heimdal/lib/gssapi/krb5/decapsulate.o \ - ../heimdal/lib/gssapi/krb5/verify_mic.o \ - ../heimdal/lib/gssapi/krb5/accept_sec_context.o \ - ../heimdal/lib/gssapi/krb5/set_sec_context_option.o \ - ../heimdal/lib/gssapi/krb5/process_context_token.o \ - ../heimdal/lib/gssapi/krb5/prf.o PRIVATE_DEPENDENCIES = HEIMDAL_HCRYPTO HEIMDAL_HEIM_ASN1 HEIMDAL_SPNEGO_ASN1 PUBLIC_DEPENDENCIES = HEIMDAL_ROKEN HEIMDAL_KRB5 # End SUBSYSTEM HEIMDAL_GSSAPI ####################### +HEIMDAL_GSSAPI_OBJ_FILES = \ + ./heimdal/lib/gssapi/mech/context.o \ + ./heimdal/lib/gssapi/mech/gss_krb5.o \ + ./heimdal/lib/gssapi/mech/gss_mech_switch.o \ + ./heimdal/lib/gssapi/mech/gss_process_context_token.o \ + ./heimdal/lib/gssapi/mech/gss_buffer_set.o \ + ./heimdal/lib/gssapi/mech/gss_add_cred.o \ + ./heimdal/lib/gssapi/mech/gss_add_oid_set_member.o \ + ./heimdal/lib/gssapi/mech/gss_compare_name.o \ + ./heimdal/lib/gssapi/mech/gss_release_oid_set.o \ + ./heimdal/lib/gssapi/mech/gss_create_empty_oid_set.o \ + ./heimdal/lib/gssapi/mech/gss_decapsulate_token.o \ + ./heimdal/lib/gssapi/mech/gss_inquire_cred_by_oid.o \ + ./heimdal/lib/gssapi/mech/gss_canonicalize_name.o \ + ./heimdal/lib/gssapi/mech/gss_inquire_sec_context_by_oid.o \ + ./heimdal/lib/gssapi/mech/gss_inquire_names_for_mech.o \ + ./heimdal/lib/gssapi/mech/gss_inquire_mechs_for_name.o \ + ./heimdal/lib/gssapi/mech/gss_wrap_size_limit.o \ + ./heimdal/lib/gssapi/mech/gss_names.o \ + ./heimdal/lib/gssapi/mech/gss_verify.o \ + ./heimdal/lib/gssapi/mech/gss_display_name.o \ + ./heimdal/lib/gssapi/mech/gss_duplicate_oid.o \ + ./heimdal/lib/gssapi/mech/gss_display_status.o \ + ./heimdal/lib/gssapi/mech/gss_release_buffer.o \ + ./heimdal/lib/gssapi/mech/gss_release_oid.o \ + ./heimdal/lib/gssapi/mech/gss_test_oid_set_member.o \ + ./heimdal/lib/gssapi/mech/gss_release_cred.o \ + ./heimdal/lib/gssapi/mech/gss_set_sec_context_option.o \ + ./heimdal/lib/gssapi/mech/gss_export_name.o \ + ./heimdal/lib/gssapi/mech/gss_seal.o \ + ./heimdal/lib/gssapi/mech/gss_acquire_cred.o \ + ./heimdal/lib/gssapi/mech/gss_unseal.o \ + ./heimdal/lib/gssapi/mech/gss_verify_mic.o \ + ./heimdal/lib/gssapi/mech/gss_accept_sec_context.o \ + ./heimdal/lib/gssapi/mech/gss_inquire_cred_by_mech.o \ + ./heimdal/lib/gssapi/mech/gss_indicate_mechs.o \ + ./heimdal/lib/gssapi/mech/gss_delete_sec_context.o \ + ./heimdal/lib/gssapi/mech/gss_sign.o \ + ./heimdal/lib/gssapi/mech/gss_utils.o \ + ./heimdal/lib/gssapi/mech/gss_init_sec_context.o \ + ./heimdal/lib/gssapi/mech/gss_oid_equal.o \ + ./heimdal/lib/gssapi/mech/gss_oid_to_str.o \ + ./heimdal/lib/gssapi/mech/gss_context_time.o \ + ./heimdal/lib/gssapi/mech/gss_encapsulate_token.o \ + ./heimdal/lib/gssapi/mech/gss_get_mic.o \ + ./heimdal/lib/gssapi/mech/gss_import_sec_context.o \ + ./heimdal/lib/gssapi/mech/gss_inquire_cred.o \ + ./heimdal/lib/gssapi/mech/gss_wrap.o \ + ./heimdal/lib/gssapi/mech/gss_import_name.o \ + ./heimdal/lib/gssapi/mech/gss_duplicate_name.o \ + ./heimdal/lib/gssapi/mech/gss_unwrap.o \ + ./heimdal/lib/gssapi/mech/gss_export_sec_context.o \ + ./heimdal/lib/gssapi/mech/gss_inquire_context.o \ + ./heimdal/lib/gssapi/mech/gss_release_name.o \ + ./heimdal/lib/gssapi/mech/gss_set_cred_option.o \ + ./heimdal/lib/gssapi/asn1_GSSAPIContextToken.o \ + ./heimdal/lib/gssapi/spnego/init_sec_context.o \ + ./heimdal/lib/gssapi/spnego/external.o \ + ./heimdal/lib/gssapi/spnego/compat.o \ + ./heimdal/lib/gssapi/spnego/context_stubs.o \ + ./heimdal/lib/gssapi/spnego/cred_stubs.o \ + ./heimdal/lib/gssapi/spnego/accept_sec_context.o \ + ./heimdal/lib/gssapi/krb5/copy_ccache.o \ + ./heimdal/lib/gssapi/krb5/delete_sec_context.o \ + ./heimdal/lib/gssapi/krb5/init_sec_context.o \ + ./heimdal/lib/gssapi/krb5/context_time.o \ + ./heimdal/lib/gssapi/krb5/init.o \ + ./heimdal/lib/gssapi/krb5/address_to_krb5addr.o \ + ./heimdal/lib/gssapi/krb5/get_mic.o \ + ./heimdal/lib/gssapi/krb5/inquire_context.o \ + ./heimdal/lib/gssapi/krb5/add_cred.o \ + ./heimdal/lib/gssapi/krb5/inquire_cred.o \ + ./heimdal/lib/gssapi/krb5/inquire_cred_by_oid.o \ + ./heimdal/lib/gssapi/krb5/inquire_cred_by_mech.o \ + ./heimdal/lib/gssapi/krb5/inquire_mechs_for_name.o \ + ./heimdal/lib/gssapi/krb5/inquire_names_for_mech.o \ + ./heimdal/lib/gssapi/krb5/indicate_mechs.o \ + ./heimdal/lib/gssapi/krb5/inquire_sec_context_by_oid.o \ + ./heimdal/lib/gssapi/krb5/export_sec_context.o \ + ./heimdal/lib/gssapi/krb5/import_sec_context.o \ + ./heimdal/lib/gssapi/krb5/duplicate_name.o \ + ./heimdal/lib/gssapi/krb5/import_name.o \ + ./heimdal/lib/gssapi/krb5/compare_name.o \ + ./heimdal/lib/gssapi/krb5/export_name.o \ + ./heimdal/lib/gssapi/krb5/canonicalize_name.o \ + ./heimdal/lib/gssapi/krb5/unwrap.o \ + ./heimdal/lib/gssapi/krb5/wrap.o \ + ./heimdal/lib/gssapi/krb5/release_name.o \ + ./heimdal/lib/gssapi/krb5/cfx.o \ + ./heimdal/lib/gssapi/krb5/8003.o \ + ./heimdal/lib/gssapi/krb5/arcfour.o \ + ./heimdal/lib/gssapi/krb5/encapsulate.o \ + ./heimdal/lib/gssapi/krb5/display_name.o \ + ./heimdal/lib/gssapi/krb5/sequence.o \ + ./heimdal/lib/gssapi/krb5/display_status.o \ + ./heimdal/lib/gssapi/krb5/release_buffer.o \ + ./heimdal/lib/gssapi/krb5/external.o \ + ./heimdal/lib/gssapi/krb5/compat.o \ + ./heimdal/lib/gssapi/krb5/acquire_cred.o \ + ./heimdal/lib/gssapi/krb5/release_cred.o \ + ./heimdal/lib/gssapi/krb5/set_cred_option.o \ + ./heimdal/lib/gssapi/krb5/decapsulate.o \ + ./heimdal/lib/gssapi/krb5/verify_mic.o \ + ./heimdal/lib/gssapi/krb5/accept_sec_context.o \ + ./heimdal/lib/gssapi/krb5/set_sec_context_option.o \ + ./heimdal/lib/gssapi/krb5/process_context_token.o \ + ./heimdal/lib/gssapi/krb5/prf.o + + ####################### # Start SUBSYSTEM HEIMDAL_KRB5 [SUBSYSTEM::HEIMDAL_KRB5] CFLAGS = -Iheimdal_build -Iheimdal/lib/krb5 PRIVATE_DEPENDENCIES = HEIMDAL_ROKEN HEIMDAL_PKINIT_ASN1 HEIMDAL_WIND PUBLIC_DEPENDENCIES = HEIMDAL_KRB5_ASN1 HEIMDAL_GLUE HEIMDAL_HX509 HEIMDAL_HCRYPTO -OBJ_FILES = \ - ../heimdal/lib/krb5/acache.o \ - ../heimdal/lib/krb5/add_et_list.o \ - ../heimdal/lib/krb5/addr_families.o \ - ../heimdal/lib/krb5/appdefault.o \ - ../heimdal/lib/krb5/asn1_glue.o \ - ../heimdal/lib/krb5/auth_context.o \ - ../heimdal/lib/krb5/build_ap_req.o \ - ../heimdal/lib/krb5/build_auth.o \ - ../heimdal/lib/krb5/cache.o \ - ../heimdal/lib/krb5/changepw.o \ - ../heimdal/lib/krb5/codec.o \ - ../heimdal/lib/krb5/config_file.o \ - ../heimdal/lib/krb5/config_file_netinfo.o \ - ../heimdal/lib/krb5/constants.o \ - ../heimdal/lib/krb5/context.o \ - ../heimdal/lib/krb5/convert_creds.o \ - ../heimdal/lib/krb5/copy_host_realm.o \ - ../heimdal/lib/krb5/crc.o \ - ../heimdal/lib/krb5/creds.o \ - ../heimdal/lib/krb5/crypto.o \ - ../heimdal/lib/krb5/data.o \ - ../heimdal/lib/krb5/eai_to_heim_errno.o \ - ../heimdal/lib/krb5/error_string.o \ - ../heimdal/lib/krb5/expand_hostname.o \ - ../heimdal/lib/krb5/fcache.o \ - ../heimdal/lib/krb5/free.o \ - ../heimdal/lib/krb5/free_host_realm.o \ - ../heimdal/lib/krb5/generate_seq_number.o \ - ../heimdal/lib/krb5/generate_subkey.o \ - ../heimdal/lib/krb5/get_cred.o \ - ../heimdal/lib/krb5/get_default_principal.o \ - ../heimdal/lib/krb5/get_default_realm.o \ - ../heimdal/lib/krb5/get_for_creds.o \ - ../heimdal/lib/krb5/get_host_realm.o \ - ../heimdal/lib/krb5/get_in_tkt.o \ - ../heimdal/lib/krb5/get_in_tkt_with_keytab.o \ - ../heimdal/lib/krb5/get_port.o \ - ../heimdal/lib/krb5/init_creds.o \ - ../heimdal/lib/krb5/init_creds_pw.o \ - ../heimdal/lib/krb5/kcm.o \ - ../heimdal/lib/krb5/keyblock.o \ - ../heimdal/lib/krb5/keytab.o \ - ../heimdal/lib/krb5/keytab_any.o \ - ../heimdal/lib/krb5/keytab_file.o \ - ../heimdal/lib/krb5/keytab_memory.o \ - ../heimdal/lib/krb5/keytab_keyfile.o \ - ../heimdal/lib/krb5/keytab_krb4.o \ - ../heimdal/lib/krb5/krbhst.o \ - ../heimdal/lib/krb5/log.o \ - ../heimdal/lib/krb5/mcache.o \ - ../heimdal/lib/krb5/misc.o \ - ../heimdal/lib/krb5/mk_error.o \ - ../heimdal/lib/krb5/mk_priv.o \ - ../heimdal/lib/krb5/mk_rep.o \ - ../heimdal/lib/krb5/mk_req.o \ - ../heimdal/lib/krb5/mk_req_ext.o \ - ../heimdal/lib/krb5/mit_glue.o \ - ../heimdal/lib/krb5/n-fold.o \ - ../heimdal/lib/krb5/padata.o \ - ../heimdal/lib/krb5/pkinit.o \ - ../heimdal/lib/krb5/plugin.o \ - ../heimdal/lib/krb5/principal.o \ - ../heimdal/lib/krb5/pac.o \ - ../heimdal/lib/krb5/prompter_posix.o \ - ../heimdal/lib/krb5/rd_cred.o \ - ../heimdal/lib/krb5/rd_error.o \ - ../heimdal/lib/krb5/rd_priv.o \ - ../heimdal/lib/krb5/rd_rep.o \ - ../heimdal/lib/krb5/rd_req.o \ - ../heimdal/lib/krb5/replay.o \ - ../heimdal/lib/krb5/send_to_kdc.o \ - ../heimdal/lib/krb5/set_default_realm.o \ - ../heimdal/lib/krb5/store.o \ - ../heimdal/lib/krb5/store_emem.o \ - ../heimdal/lib/krb5/store_fd.o \ - ../heimdal/lib/krb5/store_mem.o \ - ../heimdal/lib/krb5/ticket.o \ - ../heimdal/lib/krb5/time.o \ - ../heimdal/lib/krb5/transited.o \ - ../heimdal/lib/krb5/v4_glue.o \ - ../heimdal/lib/krb5/version.o \ - ../heimdal/lib/krb5/warn.o \ - ../heimdal/lib/krb5/krb5_err.o \ - ../heimdal/lib/krb5/heim_err.o \ - ../heimdal/lib/krb5/k524_err.o \ - ../heimdal/lib/krb5/krb_err.o # End SUBSYSTEM HEIMDAL_KRB5 ####################### +HEIMDAL_KRB5_OBJ_FILES = \ + ./heimdal/lib/krb5/acache.o \ + ./heimdal/lib/krb5/add_et_list.o \ + ./heimdal/lib/krb5/addr_families.o \ + ./heimdal/lib/krb5/appdefault.o \ + ./heimdal/lib/krb5/asn1_glue.o \ + ./heimdal/lib/krb5/auth_context.o \ + ./heimdal/lib/krb5/build_ap_req.o \ + ./heimdal/lib/krb5/build_auth.o \ + ./heimdal/lib/krb5/cache.o \ + ./heimdal/lib/krb5/changepw.o \ + ./heimdal/lib/krb5/codec.o \ + ./heimdal/lib/krb5/config_file.o \ + ./heimdal/lib/krb5/config_file_netinfo.o \ + ./heimdal/lib/krb5/constants.o \ + ./heimdal/lib/krb5/context.o \ + ./heimdal/lib/krb5/convert_creds.o \ + ./heimdal/lib/krb5/copy_host_realm.o \ + ./heimdal/lib/krb5/crc.o \ + ./heimdal/lib/krb5/creds.o \ + ./heimdal/lib/krb5/crypto.o \ + ./heimdal/lib/krb5/data.o \ + ./heimdal/lib/krb5/eai_to_heim_errno.o \ + ./heimdal/lib/krb5/error_string.o \ + ./heimdal/lib/krb5/expand_hostname.o \ + ./heimdal/lib/krb5/fcache.o \ + ./heimdal/lib/krb5/free.o \ + ./heimdal/lib/krb5/free_host_realm.o \ + ./heimdal/lib/krb5/generate_seq_number.o \ + ./heimdal/lib/krb5/generate_subkey.o \ + ./heimdal/lib/krb5/get_cred.o \ + ./heimdal/lib/krb5/get_default_principal.o \ + ./heimdal/lib/krb5/get_default_realm.o \ + ./heimdal/lib/krb5/get_for_creds.o \ + ./heimdal/lib/krb5/get_host_realm.o \ + ./heimdal/lib/krb5/get_in_tkt.o \ + ./heimdal/lib/krb5/get_in_tkt_with_keytab.o \ + ./heimdal/lib/krb5/get_port.o \ + ./heimdal/lib/krb5/init_creds.o \ + ./heimdal/lib/krb5/init_creds_pw.o \ + ./heimdal/lib/krb5/kcm.o \ + ./heimdal/lib/krb5/keyblock.o \ + ./heimdal/lib/krb5/keytab.o \ + ./heimdal/lib/krb5/keytab_any.o \ + ./heimdal/lib/krb5/keytab_file.o \ + ./heimdal/lib/krb5/keytab_memory.o \ + ./heimdal/lib/krb5/keytab_keyfile.o \ + ./heimdal/lib/krb5/keytab_krb4.o \ + ./heimdal/lib/krb5/krbhst.o \ + ./heimdal/lib/krb5/log.o \ + ./heimdal/lib/krb5/mcache.o \ + ./heimdal/lib/krb5/misc.o \ + ./heimdal/lib/krb5/mk_error.o \ + ./heimdal/lib/krb5/mk_priv.o \ + ./heimdal/lib/krb5/mk_rep.o \ + ./heimdal/lib/krb5/mk_req.o \ + ./heimdal/lib/krb5/mk_req_ext.o \ + ./heimdal/lib/krb5/mit_glue.o \ + ./heimdal/lib/krb5/n-fold.o \ + ./heimdal/lib/krb5/padata.o \ + ./heimdal/lib/krb5/pkinit.o \ + ./heimdal/lib/krb5/plugin.o \ + ./heimdal/lib/krb5/principal.o \ + ./heimdal/lib/krb5/pac.o \ + ./heimdal/lib/krb5/prompter_posix.o \ + ./heimdal/lib/krb5/rd_cred.o \ + ./heimdal/lib/krb5/rd_error.o \ + ./heimdal/lib/krb5/rd_priv.o \ + ./heimdal/lib/krb5/rd_rep.o \ + ./heimdal/lib/krb5/rd_req.o \ + ./heimdal/lib/krb5/replay.o \ + ./heimdal/lib/krb5/send_to_kdc.o \ + ./heimdal/lib/krb5/set_default_realm.o \ + ./heimdal/lib/krb5/store.o \ + ./heimdal/lib/krb5/store_emem.o \ + ./heimdal/lib/krb5/store_fd.o \ + ./heimdal/lib/krb5/store_mem.o \ + ./heimdal/lib/krb5/ticket.o \ + ./heimdal/lib/krb5/time.o \ + ./heimdal/lib/krb5/transited.o \ + ./heimdal/lib/krb5/v4_glue.o \ + ./heimdal/lib/krb5/version.o \ + ./heimdal/lib/krb5/warn.o \ + ./heimdal/lib/krb5/krb5_err.o \ + ./heimdal/lib/krb5/heim_err.o \ + ./heimdal/lib/krb5/k524_err.o \ + ./heimdal/lib/krb5/krb_err.o + ####################### # Start SUBSYSTEM HEIMDAL_HEIM_ASN1 [SUBSYSTEM::HEIMDAL_HEIM_ASN1] CFLAGS = -Iheimdal_build -Iheimdal/lib/asn1 -OBJ_FILES = \ - ../heimdal/lib/asn1/der_get.o \ - ../heimdal/lib/asn1/der_put.o \ - ../heimdal/lib/asn1/der_free.o \ - ../heimdal/lib/asn1/der_format.o \ - ../heimdal/lib/asn1/der_length.o \ - ../heimdal/lib/asn1/der_copy.o \ - ../heimdal/lib/asn1/der_cmp.o \ - ../heimdal/lib/asn1/extra.o \ - ../heimdal/lib/asn1/timegm.o \ - ../heimdal/lib/asn1/asn1_err.o PRIVATE_DEPENDENCIES = HEIMDAL_ROKEN HEIMDAL_COM_ERR # End SUBSYSTEM HEIMDAL_KRB5 ####################### +HEIMDAL_HEIM_ASN1_OBJ_FILES = \ + ./heimdal/lib/asn1/der_get.o \ + ./heimdal/lib/asn1/der_put.o \ + ./heimdal/lib/asn1/der_free.o \ + ./heimdal/lib/asn1/der_format.o \ + ./heimdal/lib/asn1/der_length.o \ + ./heimdal/lib/asn1/der_copy.o \ + ./heimdal/lib/asn1/der_cmp.o \ + ./heimdal/lib/asn1/extra.o \ + ./heimdal/lib/asn1/timegm.o \ + ./heimdal/lib/asn1/asn1_err.o + ####################### # Start SUBSYSTEM HEIMDAL_HCRYPTO_IMATH [SUBSYSTEM::HEIMDAL_HCRYPTO_IMATH] CFLAGS = -Iheimdal_build -Iheimdal/lib/hcrypto/imath PRIVATE_DEPENDENCIES = HEIMDAL_ROKEN -OBJ_FILES = \ - ../heimdal/lib/hcrypto/imath/imath.o \ - ../heimdal/lib/hcrypto/imath/iprime.o # End SUBSYSTEM HEIMDAL_HCRYPTO_IMATH ####################### +HEIMDAL_HCRYPTO_IMATH_OBJ_FILES = \ + ./heimdal/lib/hcrypto/imath/imath.o \ + ./heimdal/lib/hcrypto/imath/iprime.o + [SUBSYSTEM::HEIMDAL_HCRYPTO] CFLAGS = -Iheimdal_build -Iheimdal/lib/hcrypto -Iheimdal/lib PRIVATE_DEPENDENCIES = HEIMDAL_ROKEN HEIMDAL_HEIM_ASN1 HEIMDAL_HCRYPTO_IMATH HEIMDAL_RFC2459_ASN1 -OBJ_FILES = \ - ../heimdal/lib/hcrypto/aes.o \ - ../heimdal/lib/hcrypto/bn.o \ - ../heimdal/lib/hcrypto/dh.o \ - ../heimdal/lib/hcrypto/dh-imath.o \ - ../heimdal/lib/hcrypto/des.o \ - ../heimdal/lib/hcrypto/dsa.o \ - ../heimdal/lib/hcrypto/engine.o \ - ../heimdal/lib/hcrypto/md2.o \ - ../heimdal/lib/hcrypto/md4.o \ - ../heimdal/lib/hcrypto/md5.o \ - ../heimdal/lib/hcrypto/rsa.o \ - ../heimdal/lib/hcrypto/rsa-imath.o \ - ../heimdal/lib/hcrypto/rc2.o \ - ../heimdal/lib/hcrypto/rc4.o \ - ../heimdal/lib/hcrypto/rijndael-alg-fst.o \ - ../heimdal/lib/hcrypto/rnd_keys.o \ - ../heimdal/lib/hcrypto/sha.o \ - ../heimdal/lib/hcrypto/sha256.o \ - ../heimdal/lib/hcrypto/ui.o \ - ../heimdal/lib/hcrypto/evp.o \ - ../heimdal/lib/hcrypto/pkcs5.o \ - ../heimdal/lib/hcrypto/pkcs12.o \ - ../heimdal/lib/hcrypto/rand.o \ - ../heimdal/lib/hcrypto/rand-egd.o \ - ../heimdal/lib/hcrypto/rand-unix.o \ - ../heimdal/lib/hcrypto/rand-fortuna.o \ - ../heimdal/lib/hcrypto/rand-timer.o \ - ../heimdal/lib/hcrypto/hmac.o \ - ../heimdal/lib/hcrypto/camellia.o \ - ../heimdal/lib/hcrypto/camellia-ntt.o # End SUBSYSTEM HEIMDAL_HCRYPTO ####################### +HEIMDAL_HCRYPTO_OBJ_FILES = \ + ./heimdal/lib/hcrypto/aes.o \ + ./heimdal/lib/hcrypto/bn.o \ + ./heimdal/lib/hcrypto/dh.o \ + ./heimdal/lib/hcrypto/dh-imath.o \ + ./heimdal/lib/hcrypto/des.o \ + ./heimdal/lib/hcrypto/dsa.o \ + ./heimdal/lib/hcrypto/engine.o \ + ./heimdal/lib/hcrypto/md2.o \ + ./heimdal/lib/hcrypto/md4.o \ + ./heimdal/lib/hcrypto/md5.o \ + ./heimdal/lib/hcrypto/rsa.o \ + ./heimdal/lib/hcrypto/rsa-imath.o \ + ./heimdal/lib/hcrypto/rc2.o \ + ./heimdal/lib/hcrypto/rc4.o \ + ./heimdal/lib/hcrypto/rijndael-alg-fst.o \ + ./heimdal/lib/hcrypto/rnd_keys.o \ + ./heimdal/lib/hcrypto/sha.o \ + ./heimdal/lib/hcrypto/sha256.o \ + ./heimdal/lib/hcrypto/ui.o \ + ./heimdal/lib/hcrypto/evp.o \ + ./heimdal/lib/hcrypto/pkcs5.o \ + ./heimdal/lib/hcrypto/pkcs12.o \ + ./heimdal/lib/hcrypto/rand.o \ + ./heimdal/lib/hcrypto/rand-egd.o \ + ./heimdal/lib/hcrypto/rand-unix.o \ + ./heimdal/lib/hcrypto/rand-fortuna.o \ + ./heimdal/lib/hcrypto/rand-timer.o \ + ./heimdal/lib/hcrypto/hmac.o \ + ./heimdal/lib/hcrypto/camellia.o \ + ./heimdal/lib/hcrypto/camellia-ntt.o + ####################### # Start SUBSYSTEM HEIMDAL_HX509 [SUBSYSTEM::HEIMDAL_HX509] @@ -342,103 +351,78 @@ PRIVATE_DEPENDENCIES = \ HEIMDAL_PKCS9_ASN1 HEIMDAL_PKCS12_ASN1 \ HEIMDAL_PKINIT_ASN1 HEIMDAL_PKCS10_ASN1 \ HEIMDAL_WIND -OBJ_FILES = \ - ../heimdal/lib/hx509/ca.o \ - ../heimdal/lib/hx509/cert.o \ - ../heimdal/lib/hx509/cms.o \ - ../heimdal/lib/hx509/collector.o \ - ../heimdal/lib/hx509/crypto.o \ - ../heimdal/lib/hx509/error.o \ - ../heimdal/lib/hx509/env.o \ - ../heimdal/lib/hx509/file.o \ - ../heimdal/lib/hx509/keyset.o \ - ../heimdal/lib/hx509/ks_dir.o \ - ../heimdal/lib/hx509/ks_file.o \ - ../heimdal/lib/hx509/ks_keychain.o \ - ../heimdal/lib/hx509/ks_mem.o \ - ../heimdal/lib/hx509/ks_null.o \ - ../heimdal/lib/hx509/ks_p11.o \ - ../heimdal/lib/hx509/ks_p12.o \ - ../heimdal/lib/hx509/lock.o \ - ../heimdal/lib/hx509/name.o \ - ../heimdal/lib/hx509/peer.o \ - ../heimdal/lib/hx509/print.o \ - ../heimdal/lib/hx509/req.o \ - ../heimdal/lib/hx509/revoke.o \ - ../heimdal/lib/hx509/hx509_err.o # End SUBSYSTEM HEIMDAL_HX509 ####################### +HEIMDAL_HX509_OBJ_FILES = \ + ./heimdal/lib/hx509/ca.o \ + ./heimdal/lib/hx509/cert.o \ + ./heimdal/lib/hx509/cms.o \ + ./heimdal/lib/hx509/collector.o \ + ./heimdal/lib/hx509/crypto.o \ + ./heimdal/lib/hx509/error.o \ + ./heimdal/lib/hx509/env.o \ + ./heimdal/lib/hx509/file.o \ + ./heimdal/lib/hx509/keyset.o \ + ./heimdal/lib/hx509/ks_dir.o \ + ./heimdal/lib/hx509/ks_file.o \ + ./heimdal/lib/hx509/ks_keychain.o \ + ./heimdal/lib/hx509/ks_mem.o \ + ./heimdal/lib/hx509/ks_null.o \ + ./heimdal/lib/hx509/ks_p11.o \ + ./heimdal/lib/hx509/ks_p12.o \ + ./heimdal/lib/hx509/lock.o \ + ./heimdal/lib/hx509/name.o \ + ./heimdal/lib/hx509/peer.o \ + ./heimdal/lib/hx509/print.o \ + ./heimdal/lib/hx509/req.o \ + ./heimdal/lib/hx509/revoke.o \ + ./heimdal/lib/hx509/hx509_err.o + ####################### # Start SUBSYSTEM HEIMDAL_WIND [SUBSYSTEM::HEIMDAL_WIND] CFLAGS = -Iheimdal_build -Iheimdal/lib/wind PRIVATE_DEPENDENCIES = \ HEIMDAL_ROKEN HEIMDAL_COM_ERR -OBJ_FILES = \ - ../heimdal/lib/wind/wind_err.o \ - ../heimdal/lib/wind/stringprep.o \ - ../heimdal/lib/wind/errorlist.o \ - ../heimdal/lib/wind/errorlist_table.o \ - ../heimdal/lib/wind/normalize.o \ - ../heimdal/lib/wind/normalize_table.o \ - ../heimdal/lib/wind/combining.o \ - ../heimdal/lib/wind/combining_table.o \ - ../heimdal/lib/wind/utf8.o \ - ../heimdal/lib/wind/bidi.o \ - ../heimdal/lib/wind/bidi_table.o \ - ../heimdal/lib/wind/ldap.o \ - ../heimdal/lib/wind/map.o \ - ../heimdal/lib/wind/map_table.o + +HEIMDAL_WIND_OBJ_FILES = \ + ./heimdal/lib/wind/wind_err.o \ + ./heimdal/lib/wind/stringprep.o \ + ./heimdal/lib/wind/errorlist.o \ + ./heimdal/lib/wind/errorlist_table.o \ + ./heimdal/lib/wind/normalize.o \ + ./heimdal/lib/wind/normalize_table.o \ + ./heimdal/lib/wind/combining.o \ + ./heimdal/lib/wind/combining_table.o \ + ./heimdal/lib/wind/utf8.o \ + ./heimdal/lib/wind/bidi.o \ + ./heimdal/lib/wind/bidi_table.o \ + ./heimdal/lib/wind/ldap.o \ + ./heimdal/lib/wind/map.o \ + ./heimdal/lib/wind/map_table.o # End SUBSYSTEM HEIMDAL_WIND ####################### [SUBSYSTEM::HEIMDAL_ROKEN_GETPROGNAME] CFLAGS = -Iheimdal_build -Iheimdal/lib/roken -Ilib/socket_wrapper -OBJ_FILES = ../heimdal/lib/roken/getprogname.o + +HEIMDAL_ROKEN_GETPROGNAME_OBJ_FILES = ./heimdal/lib/roken/getprogname.o [SUBSYSTEM::HEIMDAL_ROKEN_CLOSEFROM] CFLAGS = -Iheimdal_build -Iheimdal/lib/roken -Ilib/socket_wrapper -OBJ_FILES = ../heimdal/lib/roken/closefrom.o + +HEIMDAL_ROKEN_CLOSEFROM_OBJ_FILES = ./heimdal/lib/roken/closefrom.o [SUBSYSTEM::HEIMDAL_ROKEN_GETPROGNAME_H] CFLAGS = -Iheimdal_build -Iheimdal/lib/roken -Ilib/socket_wrapper -OBJ_FILES = ../heimdal/lib/roken/getprogname.ho + +HEIMDAL_ROKEN_GETPROGNAME_H_OBJ_FILES = ./heimdal/lib/roken/getprogname.ho ####################### # Start SUBSYSTEM HEIMDAL_ROKEN [SUBSYSTEM::HEIMDAL_ROKEN] CFLAGS = -Iheimdal_build -Iheimdal/lib/roken -Ilib/socket_wrapper -OBJ_FILES = \ - ../heimdal/lib/roken/base64.o \ - ../heimdal/lib/roken/hex.o \ - ../heimdal/lib/roken/bswap.o \ - ../heimdal/lib/roken/dumpdata.o \ - ../heimdal/lib/roken/emalloc.o \ - ../heimdal/lib/roken/ecalloc.o \ - ../heimdal/lib/roken/get_window_size.o \ - ../heimdal/lib/roken/h_errno.o \ - ../heimdal/lib/roken/issuid.o \ - ../heimdal/lib/roken/net_read.o \ - ../heimdal/lib/roken/net_write.o \ - ../heimdal/lib/roken/socket.o \ - ../heimdal/lib/roken/parse_time.o \ - ../heimdal/lib/roken/parse_units.o \ - ../heimdal/lib/roken/resolve.o \ - ../heimdal/lib/roken/roken_gethostby.o \ - ../heimdal/lib/roken/signal.o \ - ../heimdal/lib/roken/vis.o \ - ../heimdal/lib/roken/strlwr.o \ - ../heimdal/lib/roken/strsep_copy.o \ - ../heimdal/lib/roken/strsep.o \ - ../heimdal/lib/roken/strupr.o \ - ../heimdal/lib/roken/strpool.o \ - ../heimdal/lib/roken/estrdup.o \ - ../heimdal/lib/roken/erealloc.o \ - ../heimdal/lib/roken/simple_exec.o \ - ../heimdal/lib/roken/strcollect.o \ - ../heimdal/lib/roken/rtbl.o \ - replace.o PUBLIC_DEPENDENCIES = \ HEIMDAL_ROKEN_GETPROGNAME \ HEIMDAL_ROKEN_CLOSEFROM \ @@ -447,64 +431,99 @@ PUBLIC_DEPENDENCIES = \ # End SUBSYSTEM HEIMDAL_ROKEN ####################### +HEIMDAL_ROKEN_OBJ_FILES = \ + ./heimdal/lib/roken/base64.o \ + ./heimdal/lib/roken/hex.o \ + ./heimdal/lib/roken/bswap.o \ + ./heimdal/lib/roken/dumpdata.o \ + ./heimdal/lib/roken/emalloc.o \ + ./heimdal/lib/roken/ecalloc.o \ + ./heimdal/lib/roken/get_window_size.o \ + ./heimdal/lib/roken/h_errno.o \ + ./heimdal/lib/roken/issuid.o \ + ./heimdal/lib/roken/net_read.o \ + ./heimdal/lib/roken/net_write.o \ + ./heimdal/lib/roken/socket.o \ + ./heimdal/lib/roken/parse_time.o \ + ./heimdal/lib/roken/parse_units.o \ + ./heimdal/lib/roken/resolve.o \ + ./heimdal/lib/roken/roken_gethostby.o \ + ./heimdal/lib/roken/signal.o \ + ./heimdal/lib/roken/vis.o \ + ./heimdal/lib/roken/strlwr.o \ + ./heimdal/lib/roken/strsep_copy.o \ + ./heimdal/lib/roken/strsep.o \ + ./heimdal/lib/roken/strupr.o \ + ./heimdal/lib/roken/strpool.o \ + ./heimdal/lib/roken/estrdup.o \ + ./heimdal/lib/roken/erealloc.o \ + ./heimdal/lib/roken/simple_exec.o \ + ./heimdal/lib/roken/strcollect.o \ + ./heimdal/lib/roken/rtbl.o \ + ./heimdal_build/replace.o + ####################### # Start SUBSYSTEM HEIMDAL_GLUE [SUBSYSTEM::HEIMDAL_GLUE] CFLAGS = -Iheimdal_build -Iheimdal/lib/krb5 -Iheimdal/lib/asn1 -Iheimdal/lib/com_err -OBJ_FILES = glue.o PUBLIC_DEPENDENCIES = LIBNETIF LIBSAMBA-HOSTCONFIG # End SUBSYSTEM HEIMDAL_GLUE ####################### +HEIMDAL_GLUE_OBJ_FILES = heimdal_build/glue.o + ####################### # Start SUBSYSTEM HEIMDAL_COM_ERR [SUBSYSTEM::HEIMDAL_COM_ERR] CFLAGS = -Iheimdal_build -Iheimdal/lib/com_err -OBJ_FILES = \ - ../heimdal/lib/com_err/com_err.o \ - ../heimdal/lib/com_err/error.o PRIVATE_DEPENDENCIES = HEIMDAL_ROKEN # End SUBSYSTEM HEIMDAL_COM_ERR ####################### +HEIMDAL_COM_ERR_OBJ_FILES = \ + ./heimdal/lib/com_err/com_err.o \ + ./heimdal/lib/com_err/error.o + ####################### # Start SUBSYSTEM HEIMDAL_ASN1_COMPILE_LEX [SUBSYSTEM::HEIMDAL_ASN1_COMPILE_LEX] CFLAGS = -Iheimdal_build -Iheimdal/lib/asn1 -Iheimdal/lib/roken -Ilib/socket_wrapper -OBJ_FILES = ../heimdal/lib/asn1/lex.ho # End SUBSYSTEM HEIMDAL_ASN1_COMPILE_LEX ####################### +HEIMDAL_ASN1_COMPILE_LEX_OBJ_FILES = ./heimdal/lib/asn1/lex.ho + ####################### # Start BINARY asn1_compile [BINARY::asn1_compile] CFLAGS = -Iheimdal_build -Iheimdal/lib/roken USE_HOSTCC = YES -OBJ_FILES = \ - ../heimdal/lib/asn1/main.ho \ - ../heimdal/lib/asn1/gen.ho \ - ../heimdal/lib/asn1/gen_copy.ho \ - ../heimdal/lib/asn1/gen_decode.ho \ - ../heimdal/lib/asn1/gen_encode.ho \ - ../heimdal/lib/asn1/gen_free.ho \ - ../heimdal/lib/asn1/gen_glue.ho \ - ../heimdal/lib/asn1/gen_length.ho \ - ../heimdal/lib/asn1/gen_seq.ho \ - ../heimdal/lib/asn1/hash.ho \ - ../heimdal/lib/asn1/parse.ho \ - ../heimdal/lib/roken/emalloc.ho \ - ../heimdal/lib/roken/getarg.ho \ - ../heimdal/lib/roken/setprogname.ho \ - ../heimdal/lib/roken/strupr.ho \ - ../heimdal/lib/roken/get_window_size.ho \ - ../heimdal/lib/roken/estrdup.ho \ - ../heimdal/lib/roken/ecalloc.ho \ - ../heimdal/lib/asn1/symbol.ho \ - ../heimdal/lib/vers/print_version.ho \ - ../lib/socket_wrapper/socket_wrapper.ho \ - replace.ho PRIVATE_DEPENDENCIES = HEIMDAL_ASN1_COMPILE_LEX HEIMDAL_ROKEN_GETPROGNAME_H LIBREPLACE_NETWORK +asn1_compile_OBJ_FILES = \ + ./heimdal/lib/asn1/main.ho \ + ./heimdal/lib/asn1/gen.ho \ + ./heimdal/lib/asn1/gen_copy.ho \ + ./heimdal/lib/asn1/gen_decode.ho \ + ./heimdal/lib/asn1/gen_encode.ho \ + ./heimdal/lib/asn1/gen_free.ho \ + ./heimdal/lib/asn1/gen_glue.ho \ + ./heimdal/lib/asn1/gen_length.ho \ + ./heimdal/lib/asn1/gen_seq.ho \ + ./heimdal/lib/asn1/hash.ho \ + ./heimdal/lib/asn1/parse.ho \ + ./heimdal/lib/roken/emalloc.ho \ + ./heimdal/lib/roken/getarg.ho \ + ./heimdal/lib/roken/setprogname.ho \ + ./heimdal/lib/roken/strupr.ho \ + ./heimdal/lib/roken/get_window_size.ho \ + ./heimdal/lib/roken/estrdup.ho \ + ./heimdal/lib/roken/ecalloc.ho \ + ./heimdal/lib/asn1/symbol.ho \ + ./heimdal/lib/vers/print_version.ho \ + ./lib/socket_wrapper/socket_wrapper.ho \ + ./heimdal_build/replace.ho + # End BINARY asn1_compile ####################### @@ -512,28 +531,31 @@ PRIVATE_DEPENDENCIES = HEIMDAL_ASN1_COMPILE_LEX HEIMDAL_ROKEN_GETPROGNAME_H LIBR # Start SUBSYSTEM HEIMDAL_COM_ERR_COMPILE_LEX [SUBSYSTEM::HEIMDAL_COM_ERR_COMPILE_LEX] CFLAGS = -Iheimdal_build -Iheimdal/lib/com_err -Iheimdal/lib/roken -Ilib/socket_wrapper -OBJ_FILES = ../heimdal/lib/com_err/lex.ho # End SUBSYSTEM HEIMDAL_COM_ERR_COMPILE_LEX ####################### +HEIMDAL_COM_ERR_COMPILE_LEX_OBJ_FILES = ./heimdal/lib/com_err/lex.ho + ####################### # Start BINARY compile_et [BINARY::compile_et] CFLAGS = -Iheimdal_build -Iheimdal/lib/roken USE_HOSTCC = YES -OBJ_FILES = ../heimdal/lib/vers/print_version.ho \ - ../heimdal/lib/com_err/parse.ho \ - ../heimdal/lib/com_err/compile_et.ho \ - ../heimdal/lib/roken/getarg.ho \ - ../heimdal/lib/roken/get_window_size.ho \ - ../heimdal/lib/roken/strupr.ho \ - ../heimdal/lib/roken/setprogname.ho \ - ../lib/socket_wrapper/socket_wrapper.ho \ - replace.ho PRIVATE_DEPENDENCIES = HEIMDAL_COM_ERR_COMPILE_LEX HEIMDAL_ROKEN_GETPROGNAME_H LIBREPLACE_NETWORK # End BINARY compile_et ####################### +compile_et_OBJ_FILES = ./heimdal/lib/vers/print_version.ho \ + ./heimdal/lib/com_err/parse.ho \ + ./heimdal/lib/com_err/compile_et.ho \ + ./heimdal/lib/roken/getarg.ho \ + ./heimdal/lib/roken/get_window_size.ho \ + ./heimdal/lib/roken/strupr.ho \ + ./heimdal/lib/roken/setprogname.ho \ + ./lib/socket_wrapper/socket_wrapper.ho \ + ./heimdal_build/replace.ho + + mkinclude perl_path_wrapper.sh asn1_deps.pl heimdal/lib/hdb/hdb.asn1 hdb_asn1 heimdal/lib/hdb | mkinclude perl_path_wrapper.sh asn1_deps.pl heimdal/lib/gssapi/spnego/spnego.asn1 spnego_asn1 heimdal/lib/gssapi --sequence=MechTypeList | mkinclude perl_path_wrapper.sh asn1_deps.pl heimdal/lib/gssapi/mech/gssapi.asn1 gssapi_asn1 heimdal/lib/gssapi| @@ -550,7 +572,7 @@ mkinclude perl_path_wrapper.sh asn1_deps.pl heimdal/lib/asn1/kx509.asn1 kx509_as mkinclude perl_path_wrapper.sh asn1_deps.pl heimdal/lib/hx509/pkcs10.asn1 pkcs10_asn1 heimdal/lib/hx509 --preserve-binary=CertificationRequestInfo| # -# Ensure to update ../static_deps.mk when you add a new entry here! +# Ensure to update ./static_deps.mk when you add a new entry here! # mkinclude perl_path_wrapper.sh et_deps.pl heimdal/lib/asn1/asn1_err.et heimdal/lib/asn1| mkinclude perl_path_wrapper.sh et_deps.pl heimdal/lib/hdb/hdb_err.et heimdal/lib/hdb| @@ -569,31 +591,25 @@ clean:: # Start SUBSYSTEM HEIMDAL [SUBSYSTEM::HEIMDAL] CFLAGS = -Iheimdal_build -OBJ_FILES = ../heimdal/lib/vers/print_version.o PUBLIC_DEPENDENCIES = \ HEIMDAL_GSSAPI HEIMDAL_KRB5 # End SUBSYSTEM HEIMDAL ####################### -####################### -# Start SUBSYSTEM KERBEROS_LIB -[SUBSYSTEM::KERBEROS_LIB] -#PUBLIC_DEPENDENCIES = EXT_KRB5 -PUBLIC_DEPENDENCIES = HEIMDAL -# End SUBSYSTEM KERBEROS_LIB -####################### +HEIMDAL_OBJ_FILES = ./heimdal/lib/vers/print_version.o ####################### # Start BINARY compile_et [BINARY::samba4kinit] CFLAGS = -Iheimdal_build -Iheimdal/lib/roken -OBJ_FILES = ../heimdal/kuser/kinit.o \ - ../heimdal/lib/vers/print_version.o \ - ../heimdal/lib/roken/setprogname.o \ - ../heimdal/lib/roken/getarg.o PRIVATE_DEPENDENCIES = HEIMDAL_KRB5 HEIMDAL_NTLM # End BINARY compile_et ####################### +samba4kinit_OBJ_FILES = ./heimdal/kuser/kinit.o \ + ./heimdal/lib/vers/print_version.o \ + ./heimdal/lib/roken/setprogname.o \ + ./heimdal/lib/roken/getarg.o + dist:: heimdal/lib/asn1/lex.c heimdal/lib/com_err/lex.c \ heimdal/lib/asn1/parse.c heimdal/lib/com_err/parse.c diff --git a/source4/kdc/config.mk b/source4/kdc/config.mk index 479cb36296..94ba933e57 100644 --- a/source4/kdc/config.mk +++ b/source4/kdc/config.mk @@ -5,25 +5,22 @@ [MODULE::KDC] INIT_FUNCTION = server_service_kdc_init SUBSYSTEM = service -OBJ_FILES = \ - kdc.o \ - kpasswdd.o PRIVATE_DEPENDENCIES = \ - LIBLDB KERBEROS_LIB HEIMDAL_KDC HEIMDAL_HDB SAMDB + LIBLDB HEIMDAL HEIMDAL_KDC HEIMDAL_HDB SAMDB # End SUBSYSTEM KDC ####################### +KDC_OBJ_FILES = $(addprefix kdc/, kdc.o kpasswdd.o) + ####################### # Start SUBSYSTEM KDC [SUBSYSTEM::HDB_LDB] CFLAGS = -Iheimdal/kdc -Iheimdal/lib/hdb PRIVATE_PROTO_HEADER = pac_glue.h -OBJ_FILES = \ - hdb-ldb.o \ - pac-glue.o PRIVATE_DEPENDENCIES = \ - LIBLDB auth_sam auth_sam_reply KERBEROS CREDENTIALS \ + LIBLDB auth_sam auth_sam_reply HEIMDAL CREDENTIALS \ HEIMDAL_HDB_ASN1 # End SUBSYSTEM KDC ####################### +HDB_LDB_OBJ_FILES = $(addprefix kdc/, hdb-ldb.o pac-glue.o) diff --git a/source4/ldap_server/config.mk b/source4/ldap_server/config.mk index 5f8c530db9..03cc41d69d 100644 --- a/source4/ldap_server/config.mk +++ b/source4/ldap_server/config.mk @@ -6,11 +6,6 @@ INIT_FUNCTION = server_service_ldap_init SUBSYSTEM = service PRIVATE_PROTO_HEADER = proto.h -OBJ_FILES = \ - ldap_server.o \ - ldap_backend.o \ - ldap_bind.o \ - ldap_extended.o PRIVATE_DEPENDENCIES = CREDENTIALS \ LIBCLI_LDAP SAMDB \ process_model \ @@ -18,3 +13,10 @@ PRIVATE_DEPENDENCIES = CREDENTIALS \ LIBSAMBA-HOSTCONFIG # End SUBSYSTEM SMB ####################### + +LDAP_OBJ_FILES = $(addprefix ldap_server/, \ + ldap_server.o \ + ldap_backend.o \ + ldap_bind.o \ + ldap_extended.o) + 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 diff --git a/source4/smbd/config.mk b/source4/smbd/config.mk index 6cbfa16045..9eb3cfa653 100644 --- a/source4/smbd/config.mk +++ b/source4/smbd/config.mk @@ -1,34 +1,24 @@ # server subsystem -################################################ -# Start MODULE service_auth -[MODULE::service_auth] -INIT_FUNCTION = server_service_auth_init -SUBSYSTEM = service -PRIVATE_DEPENDENCIES = \ - auth -# End MODULE server_auth -################################################ - [SUBSYSTEM::service] PRIVATE_PROTO_HEADER = service_proto.h -OBJ_FILES = \ - service.o \ - service_stream.o \ - service_task.o PRIVATE_DEPENDENCIES = \ MESSAGING samba-socket +service_OBJ_FILES = $(addprefix smbd/, \ + service.o \ + service_stream.o \ + service_task.o) + [SUBSYSTEM::PIDFILE] -OBJ_FILES = pidfile.o PRIVATE_PROTO_HEADER = pidfile.h +PIDFILE_OBJ_FILES = smbd/pidfile.o + ################################# # Start BINARY smbd [BINARY::smbd] INSTALLDIR = SBINDIR -OBJ_FILES = \ - server.o PRIVATE_DEPENDENCIES = \ process_model \ service \ -- 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/auth/config.mk | 4 +- source4/auth/gensec/config.mk | 13 +- 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 +-- source4/libcli/auth/config.mk | 9 +- source4/libcli/config.mk | 128 +++++----- source4/libcli/ldap/config.mk | 14 +- source4/libcli/security/config.mk | 13 +- source4/libcli/smb2/config.mk | 29 +-- source4/libcli/wbclient/config.mk | 3 +- source4/libnet/config.mk | 44 +--- source4/librpc/config.mk | 439 +++++++++++++++++++++------------ source4/nbt_server/config.mk | 45 ++-- source4/nsswitch/config.m4 | 3 +- source4/nsswitch/config.mk | 12 +- source4/ntptr/config.mk | 11 +- source4/ntvfs/common/config.mk | 15 +- source4/ntvfs/config.mk | 34 +-- source4/ntvfs/posix/config.mk | 26 +- source4/ntvfs/sysdep/config.mk | 26 +- source4/ntvfs/unixuid/config.mk | 4 +- source4/param/config.mk | 27 +- source4/rpc_server/config.mk | 76 +++--- source4/scripting/ejs/config.mk | 59 +++-- source4/scripting/ejs/ejsnet/config.mk | 14 +- source4/scripting/python/config.mk | 9 +- source4/smb_server/config.mk | 16 +- source4/smb_server/smb/config.mk | 14 +- source4/smb_server/smb2/config.mk | 14 +- source4/smbd/config.mk | 2 + source4/smbd/process_model.mk | 20 +- source4/torture/config.mk | 261 ++++++++------------ source4/torture/local/config.mk | 60 ++--- source4/torture/smb2/config.mk | 14 +- source4/torture/winbind/config.mk | 6 +- source4/utils/config.mk | 24 +- source4/utils/net/config.mk | 16 +- source4/web_server/config.mk | 5 +- source4/winbind/config.mk | 36 +-- source4/wrepl_server/config.mk | 16 +- 50 files changed, 886 insertions(+), 868 deletions(-) diff --git a/source4/auth/config.mk b/source4/auth/config.mk index de8926d2af..780c098b68 100644 --- a/source4/auth/config.mk +++ b/source4/auth/config.mk @@ -89,13 +89,13 @@ PRIVATE_PROTO_HEADER = pam_errors.h #SO_VERSION = 0 PAM_ERRORS_OBJ_FILES = $(addprefix auth/, pam_errors.o) -[MODULE::service_auth] +[MODULE::auth] INIT_FUNCTION = server_service_auth_init SUBSYSTEM = smbd PRIVATE_PROTO_HEADER = auth_proto.h PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL LIBSECURITY SAMDB CREDENTIALS -service_auth_OBJ_FILES = $(addprefix auth/, auth.o auth_util.o auth_simple.o) +auth_OBJ_FILES = $(addprefix auth/, auth.o auth_util.o auth_simple.o) # PUBLIC_HEADERS += auth/auth.h diff --git a/source4/auth/gensec/config.mk b/source4/auth/gensec/config.mk index e5fb2ef201..8f1aa9f84d 100644 --- a/source4/auth/gensec/config.mk +++ b/source4/auth/gensec/config.mk @@ -10,7 +10,7 @@ PUBLIC_DEPENDENCIES = \ # End SUBSYSTEM gensec ################################# -gnesec_OBJ_FILES = $(addprefix auth/gensec/, gensec.o socket.o) +gensec_OBJ_FILES = $(addprefix auth/gensec/, gensec.o socket.o) PUBLIC_HEADERS += auth/gensec/gensec.h @@ -19,11 +19,11 @@ PUBLIC_HEADERS += auth/gensec/gensec.h [MODULE::gensec_krb5] SUBSYSTEM = gensec INIT_FUNCTION = gensec_krb5_init -PRIVATE_DEPENDENCIES = CREDENTIALS KERBEROS auth auth_sam +PRIVATE_DEPENDENCIES = CREDENTIALS KERBEROS service_auth auth_sam # End MODULE gensec_krb5 ################################################ -gensec_krb5_OBJ_FILES = gensec_krb5.o +gensec_krb5_OBJ_FILES = $(addprefix auth/gensec/, gensec_krb5.o) ################################################ # Start MODULE gensec_gssapi @@ -34,7 +34,7 @@ PRIVATE_DEPENDENCIES = HEIMDAL_GSSAPI CREDENTIALS KERBEROS # End MODULE gensec_gssapi ################################################ -gensec_gssapi_OBJ_FILES = gensec_gssapi.o +gensec_gssapi_OBJ_FILES = $(addprefix auth/gensec/, gensec_gssapi.o) ################################################ # Start MODULE cyrus_sasl @@ -45,7 +45,7 @@ PRIVATE_DEPENDENCIES = CREDENTIALS SASL # End MODULE cyrus_sasl ################################################ -cyrus_sasl_OBJ_FILES = auth/gensec/cyrus_sasl.o +cyrus_sasl_OBJ_FILES = $(addprefix auth/gensec/, cyrus_sasl.o) ################################################ # Start MODULE gensec_spnego @@ -77,9 +77,8 @@ gensec_schannel_OBJ_FILES = $(addprefix auth/gensec/, schannel.o schannel_sign.o [SUBSYSTEM::SCHANNELDB] PRIVATE_PROTO_HEADER = schannel_state.h PRIVATE_DEPENDENCIES = LDB_WRAP SAMDB -# # End SUBSYSTEM SCHANNELDB ################################################ -SCHANNELDB_OBJ_FILES = auth/gensec/schannel_state.o +SCHANNELDB_OBJ_FILES = $(addprefix auth/gensec/, schannel_state.o) 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 diff --git a/source4/libcli/auth/config.mk b/source4/libcli/auth/config.mk index f786c71469..85fc4ab527 100644 --- a/source4/libcli/auth/config.mk +++ b/source4/libcli/auth/config.mk @@ -2,15 +2,16 @@ # Start SUBSYSTEM LIBCLI_AUTH [SUBSYSTEM::LIBCLI_AUTH] PRIVATE_PROTO_HEADER = proto.h -OBJ_FILES = credentials.o \ - session.o \ - smbencrypt.o \ - smbdes.o PUBLIC_DEPENDENCIES = \ MSRPC_PARSE \ LIBSAMBA-HOSTCONFIG # End SUBSYSTEM LIBCLI_AUTH ################################# +LIBCLI_AUTH_OBJ_FILES = $(addprefix libcli/auth/, \ + credentials.o \ + session.o \ + smbencrypt.o \ + smbdes.o) PUBLIC_HEADERS += libcli/auth/credentials.h diff --git a/source4/libcli/config.mk b/source4/libcli/config.mk index 0c00fa2740..1ed52ca9d3 100644 --- a/source4/libcli/config.mk +++ b/source4/libcli/config.mk @@ -4,120 +4,127 @@ mkinclude security/config.mk mkinclude wbclient/config.mk [SUBSYSTEM::LIBSAMBA-ERRORS] -OBJ_FILES = util/doserr.o \ - util/errormap.o \ - util/nterr.o \ +LIBSAMBA-ERRORS_OBJ_FILES = $(addprefix libcli/util/, doserr.o errormap.o nterr.o) PUBLIC_HEADERS += $(addprefix libcli/, util/error.h util/ntstatus.h util/doserr.h util/werror.h) [SUBSYSTEM::LIBCLI_LSA] PRIVATE_PROTO_HEADER = util/clilsa.h -OBJ_FILES = util/clilsa.o PUBLIC_DEPENDENCIES = RPC_NDR_LSA PRIVATE_DEPENDENCIES = LIBSECURITY +LIBCLI_LSA_OBJ_FILES = libcli/util/clilsa.o + [SUBSYSTEM::LIBCLI_COMPOSITE] PRIVATE_PROTO_HEADER = composite/proto.h -OBJ_FILES = \ - composite/composite.o PUBLIC_DEPENDENCIES = LIBEVENTS +LIBCLI_COMPOSITE_OBJ_FILES = libcli/composite/composite.o + [SUBSYSTEM::LIBCLI_SMB_COMPOSITE] PRIVATE_PROTO_HEADER = smb_composite/proto.h -OBJ_FILES = \ - smb_composite/loadfile.o \ - smb_composite/savefile.o \ - smb_composite/connect.o \ - smb_composite/sesssetup.o \ - smb_composite/fetchfile.o \ - smb_composite/appendacl.o \ - smb_composite/fsinfo.o PUBLIC_DEPENDENCIES = LIBCLI_COMPOSITE CREDENTIALS gensec LIBCLI_RESOLVE +LIBCLI_SMB_COMPOSITE_OBJ_FILES = $(addprefix libcli/smb_composite/, \ + loadfile.o \ + savefile.o \ + connect.o \ + sesssetup.o \ + fetchfile.o \ + appendacl.o \ + fsinfo.o) + + [SUBSYSTEM::NDR_NBT_BUF] PRIVATE_PROTO_HEADER = nbt/nbtname.h -OBJ_FILES = nbt/nbtname.o + +NDR_NBT_BUF_OBJ_FILES = libcli/nbt/nbtname.o [SUBSYSTEM::LIBCLI_NBT] #VERSION = 0.0.1 #SO_VERSION = 0 PRIVATE_PROTO_HEADER = nbt/nbt_proto.h -OBJ_FILES = \ - nbt/nbtsocket.o \ - nbt/namequery.o \ - nbt/nameregister.o \ - nbt/namerefresh.o \ - nbt/namerelease.o PUBLIC_DEPENDENCIES = LIBNDR NDR_NBT LIBCLI_COMPOSITE LIBEVENTS \ NDR_SECURITY samba-socket LIBSAMBA-UTIL +LIBCLI_NBT_OBJ_FILES = $(addprefix libcli/nbt/, \ + nbtsocket.o \ + namequery.o \ + nameregister.o \ + namerefresh.o \ + namerelease.o) + [PYTHON::python_libcli_nbt] SWIG_FILE = swig/libcli_nbt.i PUBLIC_DEPENDENCIES = LIBCLI_NBT DYNCONFIG LIBSAMBA-HOSTCONFIG +python_libcli_nbt_OBJ_FILES = libcli/swig/libcli_nbt_wrap.o + [PYTHON::python_libcli_smb] SWIG_FILE = swig/libcli_smb.i PUBLIC_DEPENDENCIES = LIBCLI_SMB DYNCONFIG LIBSAMBA-HOSTCONFIG +python_libcli_smb_OBJ_FILES = libcli/swig/libcli_smb_wrap.o + [SUBSYSTEM::LIBCLI_DGRAM] -OBJ_FILES = \ - dgram/dgramsocket.o \ - dgram/mailslot.o \ - dgram/netlogon.o \ - dgram/ntlogon.o \ - dgram/browse.o PUBLIC_DEPENDENCIES = LIBCLI_NBT LIBNDR LIBCLI_RESOLVE +LIBCLI_DGRAM_OBJ_FILES = $(addprefix libcli/dgram/, \ + dgramsocket.o \ + mailslot.o \ + netlogon.o \ + ntlogon.o \ + browse.o) + [SUBSYSTEM::LIBCLI_CLDAP] -OBJ_FILES = cldap/cldap.o PUBLIC_DEPENDENCIES = LIBCLI_LDAP PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL LIBLDB +LIBCLI_CLDAP_OBJ_FILES = libcli/cldap/cldap.o # PUBLIC_HEADERS += libcli/cldap/cldap.h [SUBSYSTEM::LIBCLI_WREPL] PRIVATE_PROTO_HEADER = wrepl/winsrepl_proto.h -OBJ_FILES = \ - wrepl/winsrepl.o PUBLIC_DEPENDENCIES = NDR_WINSREPL samba-socket LIBCLI_RESOLVE LIBEVENTS \ LIBPACKET LIBNDR +LIBCLI_WREPL_OBJ_FILES = libcli/wrepl/winsrepl.o + [SUBSYSTEM::LIBCLI_RESOLVE] PRIVATE_PROTO_HEADER = resolve/proto.h -OBJ_FILES = \ - resolve/resolve.o PUBLIC_DEPENDENCIES = NDR_NBT +LIBCLI_RESOLVE_OBJ_FILES = libcli/resolve/resolve.o + [SUBSYSTEM::LP_RESOLVE] PRIVATE_PROTO_HEADER = resolve/lp_proto.h -OBJ_FILES = \ - resolve/bcast.o \ - resolve/nbtlist.o \ - resolve/wins.o \ - resolve/host.o \ - resolve/resolve_lp.o PRIVATE_DEPENDENCIES = LIBCLI_NBT LIBSAMBA-HOSTCONFIG LIBNETIF +LP_RESOLVE_OBJ_FILES = $(addprefix libcli/resolve/, \ + bcast.o nbtlist.o wins.o \ + host.o resolve_lp.o) + [SUBSYSTEM::LIBCLI_FINDDCS] PRIVATE_PROTO_HEADER = finddcs.h -OBJ_FILES = \ - finddcs.o PUBLIC_DEPENDENCIES = LIBCLI_NBT MESSAGING +LIBCLI_FINDDCS_OBJ_FILES = libcli/finddcs.o + [SUBSYSTEM::LIBCLI_SMB] PRIVATE_PROTO_HEADER = libcli_proto.h -OBJ_FILES = clireadwrite.o \ +PUBLIC_DEPENDENCIES = LIBCLI_RAW LIBSAMBA-ERRORS LIBCLI_AUTH \ + LIBCLI_SMB_COMPOSITE LIBCLI_NBT LIBSECURITY LIBCLI_RESOLVE \ + LIBCLI_DGRAM LIBCLI_SMB2 LIBCLI_FINDDCS samba-socket + +LIBCLI_SMB_OBJ_FILES = $(addprefix libcli/, \ + clireadwrite.o \ cliconnect.o \ clifile.o \ clilist.o \ clitrans2.o \ climessage.o \ - clideltree.o -PUBLIC_DEPENDENCIES = LIBCLI_RAW LIBSAMBA-ERRORS LIBCLI_AUTH \ - LIBCLI_SMB_COMPOSITE LIBCLI_NBT LIBSECURITY LIBCLI_RESOLVE \ - LIBCLI_DGRAM LIBCLI_SMB2 LIBCLI_FINDDCS samba-socket - + clideltree.o) # PUBLIC_HEADERS += libcli/libcli.h @@ -126,28 +133,11 @@ PRIVATE_PROTO_HEADER = raw/raw_proto.h PRIVATE_DEPENDENCIES = LIBCLI_COMPOSITE LP_RESOLVE gensec LIBCLI_RESOLVE LIBSECURITY LIBNDR #LDFLAGS = $(LIBCLI_SMB_COMPOSITE_OUTPUT) PUBLIC_DEPENDENCIES = samba-socket LIBPACKET gensec LIBCRYPTO CREDENTIALS -OBJ_FILES = raw/rawfile.o \ - raw/smb_signing.o \ - raw/clisocket.o \ - raw/clitransport.o \ - raw/clisession.o \ - raw/clitree.o \ - raw/clierror.o \ - raw/rawrequest.o \ - raw/rawreadwrite.o \ - raw/rawsearch.o \ - raw/rawsetfileinfo.o \ - raw/raweas.o \ - raw/rawtrans.o \ - raw/clioplock.o \ - raw/rawnegotiate.o \ - raw/rawfsinfo.o \ - raw/rawfileinfo.o \ - raw/rawnotify.o \ - raw/rawioctl.o \ - raw/rawacl.o \ - raw/rawdate.o \ - raw/rawlpq.o \ - raw/rawshadow.o + +LIBCLI_RAW_OBJ_FILES = $(addprefix libcli/raw/, rawfile.o smb_signing.o clisocket.o \ + clitransport.o clisession.o clitree.o clierror.o rawrequest.o \ + rawreadwrite.o rawsearch.o rawsetfileinfo.o raweas.o rawtrans.o \ + clioplock.o rawnegotiate.o rawfsinfo.o rawfileinfo.o rawnotify.o \ + rawioctl.o rawacl.o rawdate.o rawlpq.o rawshadow.o) mkinclude smb2/config.mk diff --git a/source4/libcli/ldap/config.mk b/source4/libcli/ldap/config.mk index 0c5236c138..33e32c7417 100644 --- a/source4/libcli/ldap/config.mk +++ b/source4/libcli/ldap/config.mk @@ -1,17 +1,17 @@ [SUBSYSTEM::LIBCLI_LDAP] PRIVATE_PROTO_HEADER = ldap_proto.h -OBJ_FILES = ldap.o \ - ldap_client.o \ - ldap_bind.o \ - ldap_msg.o \ - ldap_ildap.o \ - ldap_controls.o PUBLIC_DEPENDENCIES = LIBSAMBA-ERRORS LIBEVENTS LIBPACKET PRIVATE_DEPENDENCIES = LIBCLI_COMPOSITE samba-socket NDR_SAMR LIBTLS ASN1_UTIL \ LDAP_ENCODE LIBNDR LP_RESOLVE gensec +LIBCLI_LDAP_OBJ_FILES = $(addprefix libcli/ldap/, \ + ldap.o ldap_client.o ldap_bind.o \ + ldap_msg.o ldap_ildap.o ldap_controls.o) + + PUBLIC_HEADERS += libcli/ldap/ldap.h libcli/ldap/ldap_ndr.h [SUBSYSTEM::LDAP_ENCODE] -OBJ_FILES = ldap_ndr.o # FIXME PRIVATE_DEPENDENCIES = LIBLDB + +LDAP_ENCODE_OBJ_FILES = libcli/ldap/ldap_ndr.o diff --git a/source4/libcli/security/config.mk b/source4/libcli/security/config.mk index 8c66df0325..fde065aa34 100644 --- a/source4/libcli/security/config.mk +++ b/source4/libcli/security/config.mk @@ -1,13 +1,14 @@ [SUBSYSTEM::LIBSECURITY] PRIVATE_PROTO_HEADER = proto.h -OBJ_FILES = security_token.o \ - security_descriptor.o \ - dom_sid.o \ - access_check.o \ - privilege.o \ - sddl.o PUBLIC_DEPENDENCIES = NDR_MISC LIBNDR +LIBSECURITY_OBJ_FILES = $(addprefix libcli/security/, \ + security_token.o security_descriptor.o \ + dom_sid.o access_check.o privilege.o sddl.o) + + [PYTHON::swig_security] SWIG_FILE = security.i PRIVATE_DEPENDENCIES = LIBSECURITY + +swig_security_OBJ_FILES = libcli/security/security_wrap.o diff --git a/source4/libcli/smb2/config.mk b/source4/libcli/smb2/config.mk index ab079fefde..e95997db54 100644 --- a/source4/libcli/smb2/config.mk +++ b/source4/libcli/smb2/config.mk @@ -1,25 +1,10 @@ [SUBSYSTEM::LIBCLI_SMB2] PRIVATE_PROTO_HEADER = smb2_proto.h -OBJ_FILES = \ - transport.o \ - request.o \ - negprot.o \ - session.o \ - tcon.o \ - create.o \ - close.o \ - connect.o \ - getinfo.o \ - write.o \ - read.o \ - setinfo.o \ - find.o \ - ioctl.o \ - logoff.o \ - tdis.o \ - flush.o \ - lock.o \ - notify.o \ - cancel.o \ - keepalive.o PUBLIC_DEPENDENCIES = LIBCLI_RAW LIBPACKET gensec + +LIBCLI_SMB2_OBJ_FILES = $(addprefix libcli/smb2/, \ + transport.o request.o negprot.o session.o tcon.o \ + create.o close.o connect.o getinfo.o write.o read.o \ + setinfo.o find.o ioctl.o logoff.o tdis.o flush.o \ + lock.o notify.o cancel.o keepalive.o) + diff --git a/source4/libcli/wbclient/config.mk b/source4/libcli/wbclient/config.mk index 9384a172ff..94e30d44f1 100644 --- a/source4/libcli/wbclient/config.mk +++ b/source4/libcli/wbclient/config.mk @@ -1,4 +1,5 @@ [SUBSYSTEM::LIBWBCLIENT] -OBJ_FILES = wbclient.o PUBLIC_DEPENDENCIES = LIBSAMBA-ERRORS LIBEVENTS PRIVATE_DEPENDENCIES = NDR_WINBIND MESSAGING + +LIBWBCLIENT_OBJ_FILES = libcli/wbclient/wbclient.o diff --git a/source4/libnet/config.mk b/source4/libnet/config.mk index 231d67cf35..243fc1813a 100644 --- a/source4/libnet/config.mk +++ b/source4/libnet/config.mk @@ -1,38 +1,16 @@ [SUBSYSTEM::LIBSAMBA-NET] PRIVATE_PROTO_HEADER = libnet_proto.h -PRIVATE_DEPENDENCIES = PROVISION -OBJ_FILES = \ - libnet.o \ - libnet_passwd.o \ - libnet_time.o \ - libnet_rpc.o \ - libnet_join.o \ - libnet_site.o \ - libnet_become_dc.o \ - libnet_unbecome_dc.o \ - libnet_vampire.o \ - libnet_samsync.o \ - libnet_samdump.o \ - libnet_samdump_keytab.o \ - libnet_samsync_ldb.o \ - libnet_user.o \ - libnet_group.o \ - libnet_share.o \ - libnet_lookup.o \ - libnet_domain.o \ - userinfo.o \ - groupinfo.o \ - userman.o \ - groupman.o \ - prereq_domain.o -PUBLIC_DEPENDENCIES = CREDENTIALS dcerpc dcerpc_samr RPC_NDR_LSA RPC_NDR_SRVSVC RPC_NDR_DRSUAPI LIBCLI_COMPOSITE LIBCLI_RESOLVE LIBCLI_FINDDCS LIBCLI_CLDAP LIBCLI_FINDDCS gensec_schannel LIBCLI_AUTH LIBNDR SMBPASSWD - -#PUBLIC_HEADERS += $(addprefix libnet/, libnet.h libnet_join.h libnet_lookup.h libnet_passwd.h \ -# libnet_rpc.h libnet_share.h libnet_time.h \ -# libnet_user.h libnet_site.h libnet_vampire.h \ -# userinfo.h userman.h) +PUBLIC_DEPENDENCIES = CREDENTIALS dcerpc dcerpc_samr RPC_NDR_LSA RPC_NDR_SRVSVC RPC_NDR_DRSUAPI LIBCLI_COMPOSITE LIBCLI_RESOLVE LIBCLI_FINDDCS LIBCLI_CLDAP LIBCLI_FINDDCS gensec_schannel LIBCLI_AUTH LIBNDR SMBPASSWD PROVISION +LIBSAMBA-NET_OBJ_FILES = $(addprefix libnet/, \ + libnet.o libnet_passwd.o libnet_time.o libnet_rpc.o \ + libnet_join.o libnet_site.o libnet_become_dc.o libnet_unbecome_dc.o \ + libnet_vampire.o libnet_samdump.o libnet_samdump_keytab.o \ + libnet_samsync_ldb.o libnet_user.o libnet_group.o libnet_share.o \ + libnet_lookup.o libnet_domain.o userinfo.o groupinfo.o userman.o \ + groupman.o prereq_domain.o libnet_samsync.o) [PYTHON::python_net] -PRIVATE_DEPENDENCIES = LIBSAMBA-NET LIBPYTHON -OBJ_FILES = py_net.o +PRIVATE_DEPENDENCIES = LIBSAMBA-NET + +python_net_OBJ_FILES = libnet/py_net.o diff --git a/source4/librpc/config.mk b/source4/librpc/config.mk index 0a265c7004..abf7a434d0 100644 --- a/source4/librpc/config.mk +++ b/source4/librpc/config.mk @@ -5,24 +5,23 @@ VERSION = 0.0.1 SO_VERSION = 0 PC_FILE = ndr.pc PRIVATE_PROTO_HEADER = ndr/libndr_proto.h -OBJ_FILES = \ - ndr/ndr.o \ - ndr/ndr_basic.o \ - ndr/ndr_string.o \ - ndr/uuid.o PUBLIC_DEPENDENCIES = LIBSAMBA-ERRORS LIBTALLOC LIBSAMBA-UTIL CHARSET \ LIBSAMBA-HOSTCONFIG # End SUBSYSTEM LIBNDR ################################################ +LIBNDR_OBJ_FILES = \ + librpc/ndr/ndr.o \ + librpc/ndr/ndr_basic.o \ + librpc/ndr/ndr_string.o \ + librpc/ndr/uuid.o + PUBLIC_HEADERS += librpc/ndr/libndr.h ################################# # Start BINARY ndrdump [BINARY::ndrdump] INSTALLDIR = BINDIR -OBJ_FILES = \ - tools/ndrdump.o PRIVATE_DEPENDENCIES = \ LIBSAMBA-HOSTCONFIG \ LIBSAMBA-UTIL \ @@ -34,258 +33,317 @@ PRIVATE_DEPENDENCIES = \ # End BINARY ndrdump ################################# +ndrdump_OBJ_FILES = librpc/tools/ndrdump.o + MANPAGES += librpc/tools/ndrdump.1 ################################################ # Start SUBSYSTEM NDR_COMPRESSION [SUBSYSTEM::NDR_COMPRESSION] PRIVATE_PROTO_HEADER = ndr/ndr_compression.h -OBJ_FILES = \ - ndr/ndr_compression.o PUBLIC_DEPENDENCIES = LIBCOMPRESSION LIBSAMBA-ERRORS LIBNDR # End SUBSYSTEM NDR_COMPRESSION ################################################ +NDR_COMPRESSION_OBJ_FILES = librpc/ndr/ndr_compression.o + [SUBSYSTEM::NDR_SECURITY] -OBJ_FILES = gen_ndr/ndr_security.o ndr/ndr_sec_helper.o PUBLIC_DEPENDENCIES = NDR_MISC LIBSECURITY +NDR_SECURITY_OBJ_FILES = librpc/gen_ndr/ndr_security.o librpc/ndr/ndr_sec_helper.o + PUBLIC_HEADERS += librpc/gen_ndr/security.h [SUBSYSTEM::NDR_AUDIOSRV] -OBJ_FILES = gen_ndr/ndr_audiosrv.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_AUDIOSRV_OBJ_FILES = librpc/gen_ndr/ndr_audiosrv.o + [SUBSYSTEM::NDR_DNSSERVER] -OBJ_FILES = gen_ndr/ndr_dnsserver.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_DNSSERVER_OBJ_FILES = librpc/gen_ndr/ndr_dnsserver.o + [SUBSYSTEM::NDR_WINSTATION] -OBJ_FILES = gen_ndr/ndr_winstation.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_WINSTATION_OBJ_FILES = librpc/gen_ndr/ndr_winstation.o + [SUBSYSTEM::NDR_ECHO] -OBJ_FILES = gen_ndr/ndr_echo.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_ECHO_OBJ_FILES = librpc/gen_ndr/ndr_echo.o + [SUBSYSTEM::NDR_IRPC] -OBJ_FILES = gen_ndr/ndr_irpc.o PUBLIC_DEPENDENCIES = LIBNDR NDR_SECURITY NDR_NBT +NDR_IRPC_OBJ_FILES = librpc/gen_ndr/ndr_irpc.o + [SUBSYSTEM::NDR_DSBACKUP] -OBJ_FILES = gen_ndr/ndr_dsbackup.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_DSBACKUP_OBJ_FILES = librpc/gen_ndr/ndr_dsbackup.o + [SUBSYSTEM::NDR_EFS] -OBJ_FILES = gen_ndr/ndr_efs.o PUBLIC_DEPENDENCIES = LIBNDR NDR_SECURITY +NDR_EFS_OBJ_FILES = librpc/gen_ndr/ndr_efs.o + [SUBSYSTEM::NDR_MISC] -OBJ_FILES = gen_ndr/ndr_misc.o ndr/ndr_misc.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_MISC_OBJ_FILES = librpc/gen_ndr/ndr_misc.o librpc/ndr/ndr_misc.o + PUBLIC_HEADERS += librpc/gen_ndr/misc.h librpc/gen_ndr/ndr_misc.h [SUBSYSTEM::NDR_ROT] -OBJ_FILES = gen_ndr/ndr_rot.o PUBLIC_DEPENDENCIES = LIBNDR NDR_ORPC +NDR_ROT_OBJ_FILES = librpc/gen_ndr/ndr_rot.o + [SUBSYSTEM::NDR_LSA] -OBJ_FILES = gen_ndr/ndr_lsa.o PUBLIC_DEPENDENCIES = LIBNDR NDR_SECURITY +NDR_LSA_OBJ_FILES = librpc/gen_ndr/ndr_lsa.o + PUBLIC_HEADERS += librpc/gen_ndr/lsa.h [SUBSYSTEM::NDR_DFS] -OBJ_FILES = gen_ndr/ndr_dfs.o PUBLIC_DEPENDENCIES = LIBNDR NDR_MISC +NDR_DFS_OBJ_FILES = librpc/gen_ndr/ndr_dfs.o + [SUBSYSTEM::NDR_FRSRPC] -OBJ_FILES = gen_ndr/ndr_frsrpc.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_FRSRPC_OBJ_FILES = librpc/gen_ndr/ndr_frsrpc.o + [SUBSYSTEM::NDR_FRSAPI] -OBJ_FILES = gen_ndr/ndr_frsapi.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_FRSAPI_OBJ_FILES = librpc/gen_ndr/ndr_frsapi.o + [SUBSYSTEM::NDR_DRSUAPI] -OBJ_FILES = gen_ndr/ndr_drsuapi.o ndr/ndr_drsuapi.o PUBLIC_DEPENDENCIES = LIBNDR NDR_COMPRESSION NDR_SECURITY NDR_SAMR ASN1_UTIL +NDR_DRSUAPI_OBJ_FILES = librpc/gen_ndr/ndr_drsuapi.o librpc/ndr/ndr_drsuapi.o + [SUBSYSTEM::NDR_DRSBLOBS] -OBJ_FILES = gen_ndr/ndr_drsblobs.o PUBLIC_DEPENDENCIES = LIBNDR NDR_MISC NDR_DRSUAPI +NDR_DRSBLOBS_OBJ_FILES = librpc/gen_ndr/ndr_drsblobs.o + [SUBSYSTEM::NDR_SASL_HELPERS] -OBJ_FILES = gen_ndr/ndr_sasl_helpers.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_SASL_HELPERS_OBJ_FILES = librpc/gen_ndr/ndr_sasl_helpers.o + [SUBSYSTEM::NDR_POLICYAGENT] -OBJ_FILES = gen_ndr/ndr_policyagent.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_POLICYAGENT_OBJ_FILES = librpc/gen_ndr/ndr_policyagent.o + [SUBSYSTEM::NDR_UNIXINFO] -OBJ_FILES = gen_ndr/ndr_unixinfo.o PUBLIC_DEPENDENCIES = LIBNDR NDR_SECURITY +NDR_UNIXINFO_OBJ_FILES = librpc/gen_ndr/ndr_unixinfo.o + [SUBSYSTEM::NDR_SAMR] -OBJ_FILES = gen_ndr/ndr_samr.o PUBLIC_DEPENDENCIES = LIBNDR NDR_MISC NDR_LSA NDR_SECURITY +NDR_SAMR_OBJ_FILES = librpc/gen_ndr/ndr_samr.o + PUBLIC_HEADERS += $(addprefix librpc/, gen_ndr/samr.h gen_ndr/ndr_samr.h gen_ndr/ndr_samr_c.h) [SUBSYSTEM::NDR_NFS4ACL] -OBJ_FILES = gen_ndr/ndr_nfs4acl.o PUBLIC_DEPENDENCIES = LIBNDR NDR_MISC NDR_SECURITY +NDR_NFS4ACL_OBJ_FILES = librpc/gen_ndr/ndr_nfs4acl.o + [SUBSYSTEM::NDR_SPOOLSS] -OBJ_FILES = gen_ndr/ndr_spoolss.o PUBLIC_DEPENDENCIES = LIBNDR NDR_SPOOLSS_BUF NDR_SECURITY +NDR_SPOOLSS_OBJ_FILES = librpc/gen_ndr/ndr_spoolss.o + [SUBSYSTEM::NDR_SPOOLSS_BUF] PRIVATE_PROTO_HEADER = ndr/ndr_spoolss_buf.h -OBJ_FILES = ndr/ndr_spoolss_buf.o + +NDR_SPOOLSS_BUF_OBJ_FILES = librpc/ndr/ndr_spoolss_buf.o [SUBSYSTEM::NDR_WKSSVC] -OBJ_FILES = gen_ndr/ndr_wkssvc.o PUBLIC_DEPENDENCIES = LIBNDR NDR_SRVSVC NDR_MISC NDR_SECURITY +NDR_WKSSVC_OBJ_FILES = librpc/gen_ndr/ndr_wkssvc.o + [SUBSYSTEM::NDR_SRVSVC] -OBJ_FILES = gen_ndr/ndr_srvsvc.o PUBLIC_DEPENDENCIES = LIBNDR NDR_SVCCTL NDR_SECURITY +NDR_SRVSVC_OBJ_FILES = librpc/gen_ndr/ndr_srvsvc.o + [SUBSYSTEM::NDR_SVCCTL] -OBJ_FILES = gen_ndr/ndr_svcctl.o PUBLIC_DEPENDENCIES = LIBNDR NDR_MISC +NDR_SVCCTL_OBJ_FILES = librpc/gen_ndr/ndr_svcctl.o + PUBLIC_HEADERS += $(addprefix librpc/, gen_ndr/ndr_svcctl.h gen_ndr/svcctl.h) [SUBSYSTEM::NDR_ATSVC] -OBJ_FILES = gen_ndr/ndr_atsvc.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_ATSVC_OBJ_FILES = librpc/gen_ndr/ndr_atsvc.o + PUBLIC_HEADERS += $(addprefix librpc/, gen_ndr/atsvc.h gen_ndr/ndr_atsvc.h) [SUBSYSTEM::NDR_EVENTLOG] -OBJ_FILES = gen_ndr/ndr_eventlog.o PUBLIC_DEPENDENCIES = LIBNDR NDR_LSA +NDR_EVENTLOG_OBJ_FILES = librpc/gen_ndr/ndr_eventlog.o + [SUBSYSTEM::NDR_EPMAPPER] -OBJ_FILES = gen_ndr/ndr_epmapper.o PUBLIC_DEPENDENCIES = LIBNDR NDR_MISC +NDR_EPMAPPER_OBJ_FILES = librpc/gen_ndr/ndr_epmapper.o + [SUBSYSTEM::NDR_DBGIDL] -OBJ_FILES = gen_ndr/ndr_dbgidl.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_DBGIDL_OBJ_FILES = librpc/gen_ndr/ndr_dbgidl.o + [SUBSYSTEM::NDR_DSSETUP] -OBJ_FILES = gen_ndr/ndr_dssetup.o PUBLIC_DEPENDENCIES = LIBNDR NDR_MISC +NDR_DSSETUP_OBJ_FILES = librpc/gen_ndr/ndr_dssetup.o + [SUBSYSTEM::NDR_MSGSVC] -OBJ_FILES = gen_ndr/ndr_msgsvc.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_MSGSVC_OBJ_FILES = librpc/gen_ndr/ndr_msgsvc.o + [SUBSYSTEM::NDR_WINS] -OBJ_FILES = gen_ndr/ndr_wins.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_WINS_OBJ_FILES = librpc/gen_ndr/ndr_wins.o + [SUBSYSTEM::NDR_WINREG] -OBJ_FILES = gen_ndr/ndr_winreg.o PUBLIC_DEPENDENCIES = LIBNDR NDR_INITSHUTDOWN NDR_SECURITY NDR_MISC +NDR_WINREG_OBJ_FILES = librpc/gen_ndr/ndr_winreg.o + [SUBSYSTEM::NDR_INITSHUTDOWN] -OBJ_FILES = gen_ndr/ndr_initshutdown.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_INITSHUTDOWN_OBJ_FILES = librpc/gen_ndr/ndr_initshutdown.o + [SUBSYSTEM::NDR_MGMT] -OBJ_FILES = gen_ndr/ndr_mgmt.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_MGMT_OBJ_FILES = librpc/gen_ndr/ndr_mgmt.o + [SUBSYSTEM::NDR_PROTECTED_STORAGE] -OBJ_FILES = gen_ndr/ndr_protected_storage.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_PROTECTED_STORAGE_OBJ_FILES = librpc/gen_ndr/ndr_protected_storage.o + [SUBSYSTEM::NDR_ORPC] -OBJ_FILES = gen_ndr/ndr_orpc.o ndr/ndr_orpc.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_ORPC_OBJ_FILES = librpc/gen_ndr/ndr_orpc.o librpc/ndr/ndr_orpc.o + [SUBSYSTEM::NDR_OXIDRESOLVER] -OBJ_FILES = gen_ndr/ndr_oxidresolver.o PUBLIC_DEPENDENCIES = LIBNDR NDR_ORPC NDR_MISC +NDR_OXIDRESOLVER_OBJ_FILES = librpc/gen_ndr/ndr_oxidresolver.o + [SUBSYSTEM::NDR_REMACT] -OBJ_FILES = gen_ndr/ndr_remact.o PUBLIC_DEPENDENCIES = LIBNDR NDR_ORPC NDR_MISC +NDR_REMACT_OBJ_FILES = librpc/gen_ndr/ndr_remact.o + [SUBSYSTEM::NDR_WZCSVC] -OBJ_FILES = gen_ndr/ndr_wzcsvc.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_WZCSVC_OBJ_FILES = librpc/gen_ndr/ndr_wzcsvc.o + [SUBSYSTEM::NDR_BROWSER] -OBJ_FILES = gen_ndr/ndr_browser.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_BROWSER_OBJ_FILES = librpc/gen_ndr/ndr_browser.o + [SUBSYSTEM::NDR_W32TIME] -OBJ_FILES = gen_ndr/ndr_w32time.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_W32TIME_OBJ_FILES = librpc/gen_ndr/ndr_w32time.o + [SUBSYSTEM::NDR_SCERPC] -OBJ_FILES = gen_ndr/ndr_scerpc.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_SCERPC_OBJ_FILES = librpc/gen_ndr/ndr_scerpc.o + [SUBSYSTEM::NDR_NTSVCS] -OBJ_FILES = gen_ndr/ndr_ntsvcs.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_NTSVCS_OBJ_FILES = librpc/gen_ndr/ndr_ntsvcs.o + [SUBSYSTEM::NDR_NETLOGON] -OBJ_FILES = gen_ndr/ndr_netlogon.o PUBLIC_DEPENDENCIES = LIBNDR NDR_SAMR NDR_LSA NDR_SECURITY +NDR_NETLOGON_OBJ_FILES = librpc/gen_ndr/ndr_netlogon.o + PUBLIC_HEADERS += $(addprefix librpc/, gen_ndr/netlogon.h) [SUBSYSTEM::NDR_TRKWKS] -OBJ_FILES = gen_ndr/ndr_trkwks.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_TRKWKS_OBJ_FILES = librpc/gen_ndr/ndr_trkwks.o + [SUBSYSTEM::NDR_KEYSVC] -OBJ_FILES = gen_ndr/ndr_keysvc.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_KEYSVC_OBJ_FILES = librpc/gen_ndr/ndr_keysvc.o + [SUBSYSTEM::NDR_KRB5PAC] -OBJ_FILES = gen_ndr/ndr_krb5pac.o ndr/ndr_krb5pac.o PUBLIC_DEPENDENCIES = LIBNDR NDR_NETLOGON NDR_SECURITY +NDR_KRB5PAC_OBJ_FILES = librpc/gen_ndr/ndr_krb5pac.o librpc/ndr/ndr_krb5pac.o + [SUBSYSTEM::NDR_XATTR] -OBJ_FILES = gen_ndr/ndr_xattr.o PUBLIC_DEPENDENCIES = LIBNDR NDR_SECURITY +NDR_XATTR_OBJ_FILES = librpc/gen_ndr/ndr_xattr.o + [SUBSYSTEM::NDR_OPENDB] -OBJ_FILES = gen_ndr/ndr_opendb.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_OPENDB_OBJ_FILES = librpc/gen_ndr/ndr_opendb.o + [SUBSYSTEM::NDR_NOTIFY] -OBJ_FILES = gen_ndr/ndr_notify.o PUBLIC_DEPENDENCIES = LIBNDR +NDR_NOTIFY_OBJ_FILES = librpc/gen_ndr/ndr_notify.o + [SUBSYSTEM::NDR_SCHANNEL] -OBJ_FILES = gen_ndr/ndr_schannel.o PUBLIC_DEPENDENCIES = LIBNDR NDR_NBT +NDR_SCHANNEL_OBJ_FILES = librpc/gen_ndr/ndr_schannel.o + [SUBSYSTEM::NDR_NBT] -OBJ_FILES = gen_ndr/ndr_nbt.o PUBLIC_DEPENDENCIES = LIBNDR NDR_MISC NDR_NBT_BUF NDR_SVCCTL NDR_SECURITY +NDR_NBT_OBJ_FILES = librpc/gen_ndr/ndr_nbt.o + PUBLIC_HEADERS += librpc/gen_ndr/nbt.h [SUBSYSTEM::NDR_WINSREPL] -OBJ_FILES = gen_ndr/ndr_winsrepl.o PUBLIC_DEPENDENCIES = LIBNDR NDR_NBT +NDR_WINSREPL_OBJ_FILES = librpc/gen_ndr/ndr_winsrepl.o + [SUBSYSTEM::NDR_WINBIND] -OBJ_FILES = gen_ndr/ndr_winbind.o PUBLIC_DEPENDENCIES = LIBNDR NDR_NETLOGON +NDR_WINBIND_OBJ_FILES = librpc/gen_ndr/ndr_winbind.o +PUBLIC_HEADERS += librpc/gen_ndr/winbind.h + librpc/idl-deps: ./librpc/idl-deps.pl librpc/idl/*.idl >$@ @@ -300,7 +358,6 @@ librpc/gen_ndr/tables.c: $(IDL_NDR_PARSE_H_FILES) @mv librpc/gen_ndr/tables.x $@ [SUBSYSTEM::NDR_TABLE] -OBJ_FILES = ndr/ndr_table.o gen_ndr/tables.o PRIVATE_PROTO_HEADER = ndr/ndr_table.h PUBLIC_DEPENDENCIES = \ NDR_AUDIOSRV NDR_ECHO NDR_DCERPC \ @@ -314,164 +371,203 @@ PUBLIC_DEPENDENCIES = \ NDR_INITSHUTDOWN NDR_DNSSERVER NDR_WINSTATION NDR_IRPC NDR_OPENDB \ NDR_SASL_HELPERS NDR_NOTIFY NDR_WINBIND NDR_FRSRPC NDR_FRSAPI NDR_NFS4ACL +NDR_TABLE_OBJ_FILES = librpc/ndr/ndr_table.o librpc/gen_ndr/tables.o + [SUBSYSTEM::RPC_NDR_ROT] -OBJ_FILES = gen_ndr/ndr_rot_c.o PUBLIC_DEPENDENCIES = NDR_ROT dcerpc +RPC_NDR_ROT_OBJ_FILES = librpc/gen_ndr/ndr_rot_c.o + [SUBSYSTEM::RPC_NDR_AUDIOSRV] -OBJ_FILES = gen_ndr/ndr_audiosrv_c.o PUBLIC_DEPENDENCIES = NDR_AUDIOSRV dcerpc +RPC_NDR_AUDIOSRV_OBJ_FILES = librpc/gen_ndr/ndr_audiosrv_c.o + [SUBSYSTEM::RPC_NDR_ECHO] -OBJ_FILES = gen_ndr/ndr_echo_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_ECHO +RPC_NDR_ECHO_OBJ_FILES = librpc/gen_ndr/ndr_echo_c.o + [SUBSYSTEM::RPC_NDR_DSBACKUP] -OBJ_FILES = gen_ndr/ndr_dsbackup_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_DSBACKUP +RPC_NDR_DSBACKUP_OBJ_FILES = librpc/gen_ndr/ndr_dsbackup_c.o + [SUBSYSTEM::RPC_NDR_EFS] -OBJ_FILES = gen_ndr/ndr_efs_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_EFS +RPC_NDR_EFS_OBJ_FILES = librpc/gen_ndr/ndr_efs_c.o + [SUBSYSTEM::RPC_NDR_LSA] -OBJ_FILES = gen_ndr/ndr_lsa_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_LSA +RPC_NDR_LSA_OBJ_FILES = librpc/gen_ndr/ndr_lsa_c.o + [SUBSYSTEM::RPC_NDR_DFS] -OBJ_FILES = gen_ndr/ndr_dfs_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_DFS +RPC_NDR_DFS_OBJ_FILES = librpc/gen_ndr/ndr_dfs_c.o + [SUBSYSTEM::RPC_NDR_FRSAPI] -OBJ_FILES = gen_ndr/ndr_frsapi_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_FRSAPI +RPC_NDR_FRSAPI_OBJ_FILES = librpc/gen_ndr/ndr_frsapi_c.o + [SUBSYSTEM::RPC_NDR_DRSUAPI] -OBJ_FILES = gen_ndr/ndr_drsuapi_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_DRSUAPI +RPC_NDR_DRSUAPI_OBJ_FILES = librpc/gen_ndr/ndr_drsuapi_c.o + [SUBSYSTEM::RPC_NDR_POLICYAGENT] -OBJ_FILES = gen_ndr/ndr_policyagent_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_POLICYAGENT +RPC_NDR_POLICYAGENT_OBJ_FILES = librpc/gen_ndr/ndr_policyagent_c.o + [SUBSYSTEM::RPC_NDR_UNIXINFO] -OBJ_FILES = gen_ndr/ndr_unixinfo_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_UNIXINFO +RPC_NDR_UNIXINFO_OBJ_FILES = librpc/gen_ndr/ndr_unixinfo_c.o + [LIBRARY::dcerpc_samr] -OBJ_FILES = gen_ndr/ndr_samr_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_SAMR PC_FILE = dcerpc_samr.pc VERSION = 0.0.1 SO_VERSION = 0 +dcerpc_samr_OBJ_FILES = librpc/gen_ndr/ndr_samr_c.o + [SUBSYSTEM::RPC_NDR_SPOOLSS] -OBJ_FILES = gen_ndr/ndr_spoolss_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_SPOOLSS +RPC_NDR_SPOOLSS_OBJ_FILES = librpc/gen_ndr/ndr_spoolss_c.o + [SUBSYSTEM::RPC_NDR_WKSSVC] -OBJ_FILES = gen_ndr/ndr_wkssvc_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_WKSSVC +RPC_NDR_WKSSVC_OBJ_FILES = librpc/gen_ndr/ndr_wkssvc_c.o + [SUBSYSTEM::RPC_NDR_SRVSVC] -OBJ_FILES = gen_ndr/ndr_srvsvc_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_SRVSVC +RPC_NDR_SRVSVC_OBJ_FILES = librpc/gen_ndr/ndr_srvsvc_c.o + [SUBSYSTEM::RPC_NDR_SVCCTL] -OBJ_FILES = gen_ndr/ndr_svcctl_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_SVCCTL +RPC_NDR_SVCCTL_OBJ_FILES = librpc/gen_ndr/ndr_svcctl_c.o + PUBLIC_HEADERS += librpc/gen_ndr/ndr_svcctl_c.h [LIBRARY::dcerpc_atsvc] -OBJ_FILES = gen_ndr/ndr_atsvc_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_ATSVC PC_FILE = dcerpc_atsvc.pc VERSION = 0.0.1 SO_VERSION = 0 +dcerpc_atsvc_OBJ_FILES = librpc/gen_ndr/ndr_atsvc_c.o + PUBLIC_HEADERS += librpc/gen_ndr/ndr_atsvc_c.h [SUBSYSTEM::RPC_NDR_EVENTLOG] -OBJ_FILES = gen_ndr/ndr_eventlog_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_EVENTLOG +RPC_NDR_EVENTLOG_OBJ_FILES = librpc/gen_ndr/ndr_eventlog_c.o + [SUBSYSTEM::RPC_NDR_EPMAPPER] -OBJ_FILES = gen_ndr/ndr_epmapper_c.o PUBLIC_DEPENDENCIES = NDR_EPMAPPER +RPC_NDR_EPMAPPER_OBJ_FILES = librpc/gen_ndr/ndr_epmapper_c.o + [SUBSYSTEM::RPC_NDR_DBGIDL] -OBJ_FILES = gen_ndr/ndr_dbgidl_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_DBGIDL +RPC_NDR_DBGIDL_OBJ_FILES = librpc/gen_ndr/ndr_dbgidl_c.o + [SUBSYSTEM::RPC_NDR_DSSETUP] -OBJ_FILES = gen_ndr/ndr_dssetup_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_DSSETUP +RPC_NDR_DSSETUP_OBJ_FILES = librpc/gen_ndr/ndr_dssetup_c.o + [SUBSYSTEM::RPC_NDR_MSGSVC] -OBJ_FILES = gen_ndr/ndr_msgsvc_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_MSGSVC +RPC_NDR_MSGSVC_OBJ_FILES = librpc/gen_ndr/ndr_msgsvc_c.o + [SUBSYSTEM::RPC_NDR_WINS] -OBJ_FILES = gen_ndr/ndr_wins_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_WINS +RPC_NDR_WINS_OBJ_FILES = librpc/gen_ndr/ndr_wins_c.o + [SUBSYSTEM::RPC_NDR_WINREG] -OBJ_FILES = gen_ndr/ndr_winreg_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_WINREG +RPC_NDR_WINREG_OBJ_FILES = librpc/gen_ndr/ndr_winreg_c.o + [SUBSYSTEM::RPC_NDR_INITSHUTDOWN] -OBJ_FILES = gen_ndr/ndr_initshutdown_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_INITSHUTDOWN +RPC_NDR_INITSHUTDOWN_OBJ_FILES = librpc/gen_ndr/ndr_initshutdown_c.o + [SUBSYSTEM::RPC_NDR_MGMT] -OBJ_FILES = gen_ndr/ndr_mgmt_c.o PRIVATE_DEPENDENCIES = NDR_MGMT +RPC_NDR_MGMT_OBJ_FILES = librpc/gen_ndr/ndr_mgmt_c.o + [SUBSYSTEM::RPC_NDR_PROTECTED_STORAGE] -OBJ_FILES = gen_ndr/ndr_protected_storage_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_PROTECTED_STORAGE +RPC_NDR_PROTECTED_STORAGE_OBJ_FILES = librpc/gen_ndr/ndr_protected_storage_c.o + [SUBSYSTEM::RPC_NDR_OXIDRESOLVER] -OBJ_FILES = gen_ndr/ndr_oxidresolver_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_OXIDRESOLVER +RPC_NDR_OXIDRESOLVER_OBJ_FILES = librpc/gen_ndr/ndr_oxidresolver_c.o + [SUBSYSTEM::RPC_NDR_REMACT] -OBJ_FILES = gen_ndr/ndr_remact_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_REMACT +RPC_NDR_REMACT_OBJ_FILES = librpc/gen_ndr/ndr_remact_c.o + [SUBSYSTEM::RPC_NDR_WZCSVC] -OBJ_FILES = gen_ndr/ndr_wzcsvc_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_WZCSVC +RPC_NDR_WZCSVC_OBJ_FILES = librpc/gen_ndr/ndr_wzcsvc_c.o + [SUBSYSTEM::RPC_NDR_W32TIME] -OBJ_FILES = gen_ndr/ndr_w32time_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_W32TIME +RPC_NDR_W32TIME_OBJ_FILES = librpc/gen_ndr/ndr_w32time_c.o + [SUBSYSTEM::RPC_NDR_SCERPC] -OBJ_FILES = gen_ndr/ndr_scerpc_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_SCERPC +RPC_NDR_SCERPC_OBJ_FILES = librpc/gen_ndr/ndr_scerpc_c.o + [SUBSYSTEM::RPC_NDR_NTSVCS] -OBJ_FILES = gen_ndr/ndr_ntsvcs_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_NTSVCS +RPC_NDR_NTSVCS_OBJ_FILES = librpc/gen_ndr/ndr_ntsvcs_c.o + [SUBSYSTEM::RPC_NDR_NETLOGON] -OBJ_FILES = gen_ndr/ndr_netlogon_c.o PUBLIC_DEPENDENCIES = NDR_NETLOGON +RPC_NDR_NETLOGON_OBJ_FILES = librpc/gen_ndr/ndr_netlogon_c.o + [SUBSYSTEM::RPC_NDR_TRKWKS] -OBJ_FILES = gen_ndr/ndr_trkwks_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_TRKWKS +RPC_NDR_TRKWKS_OBJ_FILES = librpc/gen_ndr/ndr_trkwks_c.o + [SUBSYSTEM::RPC_NDR_KEYSVC] -OBJ_FILES = gen_ndr/ndr_keysvc_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_KEYSVC +RPC_NDR_KEYSVC_OBJ_FILES = librpc/gen_ndr/ndr_keysvc_c.o + [SUBSYSTEM::NDR_DCERPC] -OBJ_FILES = gen_ndr/ndr_dcerpc.o PUBLIC_DEPENDENCIES = LIBNDR NDR_MISC +NDR_DCERPC_OBJ_FILES = librpc/gen_ndr/ndr_dcerpc.o + PUBLIC_HEADERS += $(addprefix librpc/, gen_ndr/dcerpc.h gen_ndr/ndr_dcerpc.h) ################################################ @@ -481,17 +577,6 @@ VERSION = 0.0.1 SO_VERSION = 0 PC_FILE = dcerpc.pc PRIVATE_PROTO_HEADER = rpc/dcerpc_proto.h -OBJ_FILES = \ - rpc/dcerpc.o \ - rpc/dcerpc_auth.o \ - rpc/dcerpc_schannel.o \ - rpc/dcerpc_util.o \ - rpc/dcerpc_error.o \ - rpc/dcerpc_smb.o \ - rpc/dcerpc_smb2.o \ - rpc/dcerpc_sock.o \ - rpc/dcerpc_connect.o \ - rpc/dcerpc_secondary.o PRIVATE_DEPENDENCIES = \ samba-socket LIBCLI_RESOLVE LIBCLI_SMB LIBCLI_SMB2 \ LIBNDR NDR_DCERPC RPC_NDR_EPMAPPER \ @@ -503,6 +588,10 @@ PUBLIC_DEPENDENCIES = CREDENTIALS # End SUBSYSTEM dcerpc ################################################ +dcerpc_OBJ_FILES = $(addprefix librpc/rpc/, dcerpc.o dcerpc_auth.o dcerpc_schannel.o dcerpc_util.o \ + dcerpc_error.o dcerpc_smb.o dcerpc_smb2.o dcerpc_sock.o dcerpc_connect.o dcerpc_secondary.o) + + PUBLIC_HEADERS += $(addprefix librpc/, rpc/dcerpc.h \ gen_ndr/mgmt.h gen_ndr/ndr_mgmt.h gen_ndr/ndr_mgmt_c.h \ gen_ndr/epmapper.h gen_ndr/ndr_epmapper.h gen_ndr/ndr_epmapper_c.h) @@ -510,159 +599,195 @@ PUBLIC_HEADERS += $(addprefix librpc/, rpc/dcerpc.h \ [MODULE::RPC_EJS_ECHO] INIT_FUNCTION = ejs_init_rpcecho -OBJ_FILES = gen_ndr/ndr_echo_ejs.o SUBSYSTEM = smbcalls PRIVATE_DEPENDENCIES = dcerpc NDR_ECHO EJSRPC +RPC_EJS_ECHO_OBJ_FILES = librpc/gen_ndr/ndr_echo_ejs.o + [MODULE::RPC_EJS_MISC] INIT_FUNCTION = ejs_init_misc -OBJ_FILES = gen_ndr/ndr_misc_ejs.o SUBSYSTEM = smbcalls PRIVATE_DEPENDENCIES = dcerpc NDR_MISC EJSRPC +RPC_EJS_MISC_OBJ_FILES = librpc/gen_ndr/ndr_misc_ejs.o + [MODULE::RPC_EJS_SAMR] INIT_FUNCTION = ejs_init_samr -OBJ_FILES = gen_ndr/ndr_samr_ejs.o SUBSYSTEM = smbcalls PRIVATE_DEPENDENCIES = dcerpc NDR_SAMR EJSRPC RPC_EJS_LSA RPC_EJS_SECURITY RPC_EJS_MISC +RPC_EJS_SAMR_OBJ_FILES = librpc/gen_ndr/ndr_samr_ejs.o + [MODULE::RPC_EJS_SECURITY] INIT_FUNCTION = ejs_init_security -OBJ_FILES = gen_ndr/ndr_security_ejs.o SUBSYSTEM = smbcalls PRIVATE_DEPENDENCIES = dcerpc NDR_SECURITY EJSRPC +RPC_EJS_SECURITY_OBJ_FILES = librpc/gen_ndr/ndr_security_ejs.o + [MODULE::RPC_EJS_LSA] INIT_FUNCTION = ejs_init_lsarpc -OBJ_FILES = gen_ndr/ndr_lsa_ejs.o SUBSYSTEM = smbcalls PRIVATE_DEPENDENCIES = dcerpc NDR_LSA EJSRPC RPC_EJS_SECURITY RPC_EJS_MISC +RPC_EJS_LSA_OBJ_FILES = librpc/gen_ndr/ndr_lsa_ejs.o + [MODULE::RPC_EJS_DFS] INIT_FUNCTION = ejs_init_netdfs -OBJ_FILES = gen_ndr/ndr_dfs_ejs.o SUBSYSTEM = smbcalls PRIVATE_DEPENDENCIES = dcerpc NDR_DFS EJSRPC +RPC_EJS_DFS_OBJ_FILES = librpc/gen_ndr/ndr_dfs_ejs.o + [MODULE::RPC_EJS_DRSUAPI] INIT_FUNCTION = ejs_init_drsuapi -OBJ_FILES = gen_ndr/ndr_drsuapi_ejs.o SUBSYSTEM = smbcalls PRIVATE_DEPENDENCIES = dcerpc NDR_DRSUAPI EJSRPC RPC_EJS_MISC RPC_EJS_SAMR +RPC_EJS_DRSUAPI_OBJ_FILES = librpc/gen_ndr/ndr_drsuapi_ejs.o + [MODULE::RPC_EJS_SPOOLSS] INIT_FUNCTION = ejs_init_spoolss -OBJ_FILES = gen_ndr/ndr_spoolss_ejs.o SUBSYSTEM = smbcalls ENABLE = NO PRIVATE_DEPENDENCIES = dcerpc NDR_SPOOLSS EJSRPC +RPC_EJS_SPOOLSS_OBJ_FILES = librpc/gen_ndr/ndr_spoolss_ejs.o + [MODULE::RPC_EJS_WKSSVC] INIT_FUNCTION = ejs_init_wkssvc -OBJ_FILES = gen_ndr/ndr_wkssvc_ejs.o SUBSYSTEM = smbcalls PRIVATE_DEPENDENCIES = dcerpc NDR_WKSSVC EJSRPC RPC_EJS_SRVSVC RPC_EJS_MISC +RPC_EJS_WKSSVC_OBJ_FILES = librpc/gen_ndr/ndr_wkssvc_ejs.o + [MODULE::RPC_EJS_SRVSVC] INIT_FUNCTION = ejs_init_srvsvc -OBJ_FILES = gen_ndr/ndr_srvsvc_ejs.o SUBSYSTEM = smbcalls PRIVATE_DEPENDENCIES = dcerpc NDR_SRVSVC EJSRPC RPC_EJS_MISC RPC_EJS_SVCCTL RPC_EJS_SECURITY +RPC_EJS_SRVSVC_OBJ_FILES = librpc/gen_ndr/ndr_srvsvc_ejs.o + [MODULE::RPC_EJS_EVENTLOG] INIT_FUNCTION = ejs_init_eventlog -OBJ_FILES = gen_ndr/ndr_eventlog_ejs.o SUBSYSTEM = smbcalls PRIVATE_DEPENDENCIES = dcerpc NDR_EVENTLOG EJSRPC RPC_EJS_MISC +RPC_EJS_EVENTLOG_OBJ_FILES = librpc/gen_ndr/ndr_eventlog_ejs.o + [MODULE::RPC_EJS_WINREG] INIT_FUNCTION = ejs_init_winreg -OBJ_FILES = gen_ndr/ndr_winreg_ejs.o SUBSYSTEM = smbcalls PRIVATE_DEPENDENCIES = dcerpc NDR_WINREG EJSRPC RPC_EJS_INITSHUTDOWN \ RPC_EJS_MISC RPC_EJS_SECURITY +RPC_EJS_WINREG_OBJ_FILES = librpc/gen_ndr/ndr_winreg_ejs.o + [MODULE::RPC_EJS_INITSHUTDOWN] INIT_FUNCTION = ejs_init_initshutdown -OBJ_FILES = gen_ndr/ndr_initshutdown_ejs.o SUBSYSTEM = smbcalls PRIVATE_DEPENDENCIES = dcerpc NDR_INITSHUTDOWN EJSRPC +RPC_EJS_INITSHUTDOWN_OBJ_FILES = librpc/gen_ndr/ndr_initshutdown_ejs.o + [MODULE::RPC_EJS_NETLOGON] INIT_FUNCTION = ejs_init_netlogon -OBJ_FILES = gen_ndr/ndr_netlogon_ejs.o SUBSYSTEM = smbcalls PRIVATE_DEPENDENCIES = dcerpc NDR_NETLOGON EJSRPC RPC_EJS_SAMR RPC_EJS_SECURITY RPC_EJS_MISC +RPC_EJS_NETLOGON_OBJ_FILES = librpc/gen_ndr/ndr_netlogon_ejs.o + [MODULE::RPC_EJS_SVCCTL] INIT_FUNCTION = ejs_init_svcctl -OBJ_FILES = gen_ndr/ndr_svcctl_ejs.o SUBSYSTEM = smbcalls PRIVATE_DEPENDENCIES = dcerpc NDR_SVCCTL EJSRPC RPC_EJS_MISC +RPC_EJS_SVCCTL_OBJ_FILES = librpc/gen_ndr/ndr_svcctl_ejs.o + [MODULE::RPC_EJS_IRPC] INIT_FUNCTION = ejs_init_irpc -OBJ_FILES = gen_ndr/ndr_irpc_ejs.o SUBSYSTEM = smbcalls PRIVATE_DEPENDENCIES = dcerpc NDR_IRPC EJSRPC +RPC_EJS_IRPC_OBJ_FILES = librpc/gen_ndr/ndr_irpc_ejs.o + [PYTHON::swig_dcerpc] SWIG_FILE = rpc/dcerpc.i PUBLIC_DEPENDENCIES = LIBCLI_SMB NDR_MISC LIBSAMBA-UTIL LIBSAMBA-HOSTCONFIG dcerpc_samr RPC_NDR_LSA DYNCONFIG +swig_dcerpc_OBJ_FILES = librpc/rpc/dcerpc_wrap.o + [PYTHON::python_echo] -OBJ_FILES = gen_ndr/py_echo.o -PRIVATE_DEPENDENCIES = RPC_NDR_ECHO +PRIVATE_DEPENDENCIES = RPC_NDR_ECHO PYTALLOC + +python_echo_OBJ_FILES = librpc/gen_ndr/py_echo.o [PYTHON::python_winreg] -OBJ_FILES = gen_ndr/py_winreg.o -PRIVATE_DEPENDENCIES = RPC_NDR_WINREG python_misc +PRIVATE_DEPENDENCIES = RPC_NDR_WINREG python_misc PYTALLOC + +python_winreg_OBJ_FILES = librpc/gen_ndr/py_winreg.o [PYTHON::python_dcerpc_misc] -OBJ_FILES = gen_ndr/py_misc.o +PRIVATE_DEPENDENCIES = PYTALLOC + +python_dcerpc_misc_OBJ_FILES = librpc/gen_ndr/py_misc.o [PYTHON::python_initshutdown] -OBJ_FILES = gen_ndr/py_initshutdown.o -PRIVATE_DEPENDENCIES = RPC_NDR_INITSHUTDOWN +PRIVATE_DEPENDENCIES = RPC_NDR_INITSHUTDOWN PYTALLOC + +python_initshutdown_OBJ_FILES = librpc/gen_ndr/py_initshutdown.o [PYTHON::python_epmapper] -OBJ_FILES = gen_ndr/py_epmapper.o +PRIVATE_DEPENDENCIES = PYTALLOC + +python_epmapper_OBJ_FILES = librpc/gen_ndr/py_epmapper.o [PYTHON::python_mgmt] -OBJ_FILES = gen_ndr/py_mgmt.o -PRIVATE_DEPENDENCIES = dcerpc_mgmt +PRIVATE_DEPENDENCIES = dcerpc_mgmt PYTALLOC + +python_mgmt_OBJ_FILES = librpc/gen_ndr/py_mgmt.o [PYTHON::python_atsvc] -OBJ_FILES = gen_ndr/py_atsvc.o -PRIVATE_DEPENDENCIES = dcerpc_atsvc +PRIVATE_DEPENDENCIES = dcerpc_atsvc PYTALLOC + +python_atsvc_OBJ_FILES = librpc/gen_ndr/py_atsvc.o [PYTHON::python_samr] -OBJ_FILES = gen_ndr/py_samr.o -PRIVATE_DEPENDENCIES = dcerpc_samr +PRIVATE_DEPENDENCIES = dcerpc_samr PYTALLOC + +python_samr_OBJ_FILES = librpc/gen_ndr/py_samr.o [PYTHON::python_svcctl] -OBJ_FILES = gen_ndr/py_svcctl.o -PRIVATE_DEPENDENCIES = RPC_NDR_SVCCTL +PRIVATE_DEPENDENCIES = RPC_NDR_SVCCTL PYTALLOC + +python_svcctl_OBJ_FILES = librpc/gen_ndr/py_svcctl.o [PYTHON::python_lsa] -OBJ_FILES = gen_ndr/py_lsa.o -PRIVATE_DEPENDENCIES = RPC_NDR_LSA +PRIVATE_DEPENDENCIES = RPC_NDR_LSA PYTALLOC + +python_lsa_OBJ_FILES = librpc/gen_ndr/py_lsa.o [PYTHON::python_wkssvc] -OBJ_FILES = gen_ndr/py_wkssvc.o -PRIVATE_DEPENDENCIES = RPC_NDR_WKSSVC +PRIVATE_DEPENDENCIES = RPC_NDR_WKSSVC PYTALLOC + +python_wkssvc_OBJ_FILES = librpc/gen_ndr/py_wkssvc.o [PYTHON::python_dfs] -OBJ_FILES = gen_ndr/py_dfs.o -PRIVATE_DEPENDENCIES = RPC_NDR_DFS +PRIVATE_DEPENDENCIES = RPC_NDR_DFS PYTALLOC + +python_dfs_OBJ_FILES = librpc/gen_ndr/py_dfs.o [PYTHON::python_unixinfo] -OBJ_FILES = gen_ndr/py_unixinfo.o -PRIVATE_DEPENDENCIES = RPC_NDR_UNIXINFO +PRIVATE_DEPENDENCIES = RPC_NDR_UNIXINFO PYTALLOC + +python_unixinfo_OBJ_FILES = librpc/gen_ndr/py_unixinfo.o [PYTHON::python_drsuapi] -OBJ_FILES = gen_ndr/py_drsuapi.o -PRIVATE_DEPENDENCIES = RPC_NDR_DRSUAPI +PRIVATE_DEPENDENCIES = RPC_NDR_DRSUAPI PYTALLOC + +python_drsuapi_OBJ_FILES = librpc/gen_ndr/py_drsuapi.o [PYTHON::python_dcerpc_security] -OBJ_FILES = gen_ndr/py_security.o +PRIVATE_DEPENDENCIES = PYTALLOC + +python_dcerpc_security_OBJ_FILES = librpc/gen_ndr/py_security.o diff --git a/source4/nbt_server/config.mk b/source4/nbt_server/config.mk index b510a6e2d6..cb2b47d15e 100644 --- a/source4/nbt_server/config.mk +++ b/source4/nbt_server/config.mk @@ -3,76 +3,71 @@ ####################### # Start SUBSYSTEM WINSDB [SUBSYSTEM::WINSDB] -OBJ_FILES = \ - wins/winsdb.o \ - wins/wins_hook.o PRIVATE_PROTO_HEADER = wins/winsdb_proto.h PUBLIC_DEPENDENCIES = \ LIBLDB # End SUBSYSTEM WINSDB ####################### +WINSDB_OBJ_FILES = $(addprefix nbt_server/wins/, winsdb.o wins_hook.o) + ####################### # Start MODULE ldb_wins_ldb [MODULE::ldb_wins_ldb] SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY -INIT_FUNCTION = &ldb_wins_ldb_module_ops -OBJ_FILES = \ - wins/wins_ldb.o +INIT_FUNCTION = LDB_MODULE(wins_ldb) PRIVATE_DEPENDENCIES = \ LIBNETIF LIBSAMBA-HOSTCONFIG LIBSAMBA-UTIL # End MODULE ldb_wins_ldb ####################### +ldb_wins_ldb_OBJ_FILES = nbt_server/wins/wins_ldb.o + ####################### # Start SUBSYSTEM NBTD_WINS [SUBSYSTEM::NBTD_WINS] -OBJ_FILES = \ - wins/winsserver.o \ - wins/winsclient.o \ - wins/winswack.o \ - wins/wins_dns_proxy.o PRIVATE_PROTO_HEADER = wins/winsserver_proto.h PRIVATE_DEPENDENCIES = \ LIBCLI_NBT WINSDB # End SUBSYSTEM NBTD_WINS ####################### +NBTD_WINS_OBJ_FILES = $(addprefix nbt_server/wins/, winsserver.o winsclient.o winswack.o wins_dns_proxy.o) + ####################### # Start SUBSYSTEM NBTD_DGRAM [SUBSYSTEM::NBTD_DGRAM] PRIVATE_PROTO_HEADER = dgram/proto.h -OBJ_FILES = \ - dgram/request.o \ - dgram/netlogon.o \ - dgram/ntlogon.o \ - dgram/browse.o PRIVATE_DEPENDENCIES = \ LIBCLI_DGRAM # End SUBSYSTEM NBTD_DGRAM ####################### +NBTD_DGRAM_OBJ_FILES = $(addprefix nbt_server/dgram/, request.o netlogon.o ntlogon.o browse.o) + ####################### # Start SUBSYSTEM NBTD [SUBSYSTEM::NBT_SERVER] -OBJ_FILES = \ +PRIVATE_PROTO_HEADER = nbt_server_proto.h +PRIVATE_DEPENDENCIES = \ + LIBCLI_NBT NBTD_WINS NBTD_DGRAM +# End SUBSYSTEM NBTD +####################### + +NBT_SERVER_OBJ_FILES = $(addprefix nbt_server/, \ interfaces.o \ register.o \ query.o \ nodestatus.o \ defense.o \ packet.o \ - irpc.o -PRIVATE_PROTO_HEADER = nbt_server_proto.h -PRIVATE_DEPENDENCIES = \ - LIBCLI_NBT NBTD_WINS NBTD_DGRAM -# End SUBSYSTEM NBTD -####################### + irpc.o) [MODULE::service_nbtd] INIT_FUNCTION = server_service_nbtd_init SUBSYSTEM = service -OBJ_FILES = \ - nbt_server.o PRIVATE_DEPENDENCIES = NBT_SERVER process_model + +service_nbtd_OBJ_FILES = \ + nbt_server/nbt_server.o diff --git a/source4/nsswitch/config.m4 b/source4/nsswitch/config.m4 index a3b7412841..207b7fa53f 100644 --- a/source4/nsswitch/config.m4 +++ b/source4/nsswitch/config.m4 @@ -4,8 +4,7 @@ case "$host_os" in *linux*) SMB_LIBRARY(nss_winbind, [nsswitch/winbind_nss_linux.o], - [LIBWINBIND-CLIENT], - [2],[2]) + [LIBWINBIND-CLIENT]) ;; *) ;; diff --git a/source4/nsswitch/config.mk b/source4/nsswitch/config.mk index c7c70c141e..a0ceff0033 100644 --- a/source4/nsswitch/config.mk +++ b/source4/nsswitch/config.mk @@ -1,13 +1,12 @@ [SUBSYSTEM::LIBWINBIND-CLIENT] -OBJ_FILES = wb_common.o PRIVATE_DEPENDENCIES = SOCKET_WRAPPER +LIBWINBIND-CLIENT_OBJ_FILES = nsswitch/wb_common.o + ################################# # Start BINARY nsstest [BINARY::nsstest] INSTALLDIR = BINDIR -OBJ_FILES = \ - nsstest.o PRIVATE_DEPENDENCIES = \ LIBSAMBA-UTIL \ LIBREPLACE_EXT \ @@ -15,12 +14,12 @@ PRIVATE_DEPENDENCIES = \ # End BINARY nsstest ################################# +nsstest_OBJ_FILES = nsswitch/nsstest.o + ################################# # Start BINARY wbinfo [BINARY::wbinfo] INSTALLDIR = BINDIR -OBJ_FILES = \ - wbinfo.o PRIVATE_DEPENDENCIES = \ LIBSAMBA-UTIL \ LIBREPLACE_EXT \ @@ -30,3 +29,6 @@ PRIVATE_DEPENDENCIES = \ LIBWINBIND-CLIENT # End BINARY nsstest ################################# + +wbinfo_OBJ_FILES = \ + nsswitch/wbinfo.o diff --git a/source4/ntptr/config.mk b/source4/ntptr/config.mk index 4c1f46ff17..dda4c29444 100644 --- a/source4/ntptr/config.mk +++ b/source4/ntptr/config.mk @@ -5,21 +5,22 @@ [MODULE::ntptr_simple_ldb] INIT_FUNCTION = ntptr_simple_ldb_init SUBSYSTEM = ntptr -OBJ_FILES = \ - simple_ldb/ntptr_simple_ldb.o PRIVATE_DEPENDENCIES = \ LIBLDB NDR_SPOOLSS DCERPC_COMMON # End MODULE ntptr_simple_ldb ################################################ +ntptr_simple_ldb_OBJ_FILES = ntptr/simple_ldb/ntptr_simple_ldb.o + ################################################ # Start SUBSYSTEM ntptr [SUBSYSTEM::ntptr] PRIVATE_PROTO_HEADER = ntptr_proto.h -OBJ_FILES = \ - ntptr_base.o \ - ntptr_interface.o PUBLIC_DEPENDENCIES = DCERPC_COMMON # # End SUBSYSTEM ntptr ################################################ + +ntptr_OBJ_FILES = \ + ntptr/ntptr_base.o \ + ntptr/ntptr_interface.o diff --git a/source4/ntvfs/common/config.mk b/source4/ntvfs/common/config.mk index 3963ebcdee..c66257b73f 100644 --- a/source4/ntvfs/common/config.mk +++ b/source4/ntvfs/common/config.mk @@ -2,17 +2,10 @@ # Start LIBRARY ntvfs_common [SUBSYSTEM::ntvfs_common] PRIVATE_PROTO_HEADER = proto.h -OBJ_FILES = \ - init.o \ - brlock.o \ - brlock_tdb.o \ - opendb.o \ - opendb_tdb.o \ - notify.o -PUBLIC_DEPENDENCIES = \ - NDR_OPENDB NDR_NOTIFY \ - sys_notify sys_lease \ - share LIBDBWRAP +PUBLIC_DEPENDENCIES = NDR_OPENDB NDR_NOTIFY sys_notify sys_lease share LIBDBWRAP PRIVATE_DEPENDENCIES = brlock_ctdb opendb_ctdb # End LIBRARY ntvfs_common ################################################ + +ntvfs_common_OBJ_FILES = $(addprefix ntvfs/common/, init.o brlock.o brlock_tdb.o opendb.o opendb_tdb.o notify.o) + diff --git a/source4/ntvfs/config.mk b/source4/ntvfs/config.mk index 2f57c787ef..93cbf64d8f 100644 --- a/source4/ntvfs/config.mk +++ b/source4/ntvfs/config.mk @@ -9,25 +9,24 @@ mkinclude sysdep/config.mk [MODULE::ntvfs_cifs] INIT_FUNCTION = ntvfs_cifs_init SUBSYSTEM = ntvfs -OBJ_FILES = \ - cifs/vfs_cifs.o PRIVATE_DEPENDENCIES = \ LIBCLI_SMB LIBCLI_RAW # End MODULE ntvfs_cifs ################################################ +ntvfs_cifs_OBJ_FILES = ntvfs/cifs/vfs_cifs.o + ################################################ # Start MODULE ntvfs_simple [MODULE::ntvfs_simple] INIT_FUNCTION = ntvfs_simple_init SUBSYSTEM = ntvfs PRIVATE_PROTO_HEADER = simple/proto.h -OBJ_FILES = \ - simple/vfs_simple.o \ - simple/svfs_util.o # End MODULE ntvfs_simple ################################################ +ntvfs_simple_OBJ_FILES = $(addprefix ntvfs/simple/, vfs_simple.o svfs_util.o) + ################################################ # Start MODULE ntvfs_cifsposix [MODULE::ntvfs_cifsposix] @@ -35,57 +34,50 @@ OBJ_FILES = \ INIT_FUNCTION = ntvfs_cifs_posix_init SUBSYSTEM = ntvfs PRIVATE_PROTO_HEADER = cifs_posix_cli/proto.h -OBJ_FILES = \ - cifs_posix_cli/vfs_cifs_posix.o \ - cifs_posix_cli/svfs_util.o # End MODULE ntvfs_cifsposix ################################################ +ntvfs_cifsposix_OBJ_FILES = \ + $(addprefix ntvfs/cifs_posix_cli/, vfs_cifs_posix.o svfs_util.o) + ################################################ # Start MODULE ntvfs_print [MODULE::ntvfs_print] INIT_FUNCTION = ntvfs_print_init SUBSYSTEM = ntvfs -OBJ_FILES = \ - print/vfs_print.o # End MODULE ntvfs_print ################################################ +ntvfs_print_OBJ_FILES = ntvfs/print/vfs_print.o + ################################################ # Start MODULE ntvfs_ipc [MODULE::ntvfs_ipc] SUBSYSTEM = ntvfs INIT_FUNCTION = ntvfs_ipc_init PRIVATE_PROTO_HEADER = ipc/proto.h -OBJ_FILES = \ - ipc/vfs_ipc.o \ - ipc/ipc_rap.o \ - ipc/rap_server.o PRIVATE_DEPENDENCIES = dcerpc_server DCERPC_COMMON # End MODULE ntvfs_ipc ################################################ +ntvfs_ipc_OBJ_FILES = $(addprefix ntvfs/ipc/, vfs_ipc.o ipc_rap.o rap_server.o) ################################################ # Start MODULE ntvfs_nbench [MODULE::ntvfs_nbench] SUBSYSTEM = ntvfs INIT_FUNCTION = ntvfs_nbench_init -OBJ_FILES = \ - nbench/vfs_nbench.o # End MODULE ntvfs_nbench ################################################ +ntvfs_nbench_OBJ_FILES = ntvfs/nbench/vfs_nbench.o ################################################ # Start SUBSYSTEM NTVFS [SUBSYSTEM::ntvfs] PRIVATE_PROTO_HEADER = ntvfs_proto.h -OBJ_FILES = \ - ntvfs_base.o \ - ntvfs_generic.o \ - ntvfs_interface.o \ - ntvfs_util.o + +ntvfs_OBJ_FILES = $(addprefix ntvfs/, ntvfs_base.o ntvfs_generic.o ntvfs_interface.o ntvfs_util.o) # PUBLIC_HEADERS += ntvfs/ntvfs.h # diff --git a/source4/ntvfs/posix/config.mk b/source4/ntvfs/posix/config.mk index 88048c2af7..865a0ffd4a 100644 --- a/source4/ntvfs/posix/config.mk +++ b/source4/ntvfs/posix/config.mk @@ -3,30 +3,31 @@ [MODULE::pvfs_acl_xattr] INIT_FUNCTION = pvfs_acl_xattr_init SUBSYSTEM = ntvfs -OBJ_FILES = \ - pvfs_acl_xattr.o PRIVATE_DEPENDENCIES = NDR_XATTR ntvfs_posix # End MODULE pvfs_acl_xattr ################################################ +pvfs_acl_xattr_OBJ_FILES = ntvfs/posix/pvfs_acl_xattr.o + ################################################ # Start MODULE pvfs_acl_nfs4 [MODULE::pvfs_acl_nfs4] INIT_FUNCTION = pvfs_acl_nfs4_init SUBSYSTEM = ntvfs -OBJ_FILES = \ - pvfs_acl_nfs4.o PRIVATE_DEPENDENCIES = NDR_NFS4ACL SAMDB ntvfs_posix # End MODULE pvfs_acl_nfs4 ################################################ +pvfs_acl_nfs4_OBJ_FILES = ntvfs/posix/pvfs_acl_nfs4.o + ################################################ [MODULE::pvfs_aio] SUBSYSTEM = ntvfs -OBJ_FILES = pvfs_aio.o PRIVATE_DEPENDENCIES = LIBAIO_LINUX ################################################ +pvfs_aio_OBJ_FILES = ntvfs/posix/pvfs_aio.o + ################################################ # Start MODULE ntvfs_posix [MODULE::ntvfs_posix] @@ -34,7 +35,13 @@ SUBSYSTEM = ntvfs OUTPUT_TYPE = MERGED_OBJ INIT_FUNCTION = ntvfs_posix_init PRIVATE_PROTO_HEADER = vfs_posix_proto.h -OBJ_FILES = \ +#PRIVATE_DEPENDENCIES = pvfs_acl_xattr pvfs_acl_nfs4 +PRIVATE_DEPENDENCIES = NDR_XATTR WRAP_XATTR BLKID ntvfs_common MESSAGING pvfs_aio \ + LIBWBCLIENT +# End MODULE ntvfs_posix +################################################ + +ntvfs_posix_OBJ_FILES = $(addprefix ntvfs/posix/, \ vfs_posix.o \ pvfs_util.o \ pvfs_search.o \ @@ -62,8 +69,5 @@ OBJ_FILES = \ pvfs_acl.o \ pvfs_notify.o \ xattr_system.o \ - xattr_tdb.o -#PRIVATE_DEPENDENCIES = pvfs_acl_xattr pvfs_acl_nfs4 -PRIVATE_DEPENDENCIES = NDR_XATTR WRAP_XATTR BLKID ntvfs_common MESSAGING pvfs_aio -# End MODULE ntvfs_posix -################################################ + xattr_tdb.o) + diff --git a/source4/ntvfs/sysdep/config.mk b/source4/ntvfs/sysdep/config.mk index 048226efad..de445bff7b 100644 --- a/source4/ntvfs/sysdep/config.mk +++ b/source4/ntvfs/sysdep/config.mk @@ -3,34 +3,24 @@ [MODULE::sys_notify_inotify] SUBSYSTEM = sys_notify INIT_FUNCTION = sys_notify_inotify_init -OBJ_FILES = \ - inotify.o # End MODULE sys_notify_inotify ################################################ +sys_notify_inotify_OBJ_FILES = ntvfs/sysdep/inotify.o + ################################################ # Start SUBSYSTEM sys_notify [SUBSYSTEM::sys_notify] -OBJ_FILES = \ - sys_notify.o -PUBLIC_DEPENDENCIES = # End SUBSYSTEM sys_notify ################################################ -################################################ -# Start MODULE sys_lease_linux +sys_notify_OBJ_FILES = ntvfs/sysdep/sys_notify.o + [MODULE::sys_lease_linux] SUBSYSTEM = sys_lease -INIT_FUNCTION = sys_lease_linux_init -OBJ_FILES = \ - sys_lease_linux.o -# End MODULE sys_lease_linux -################################################ -################################################ -# Start SUBSYSTEM sys_lease +sys_lease_linux_OBJ_FILES = ntvfs/sysdep/sys_lease_linux.o + [SUBSYSTEM::sys_lease] -OBJ_FILES = \ - sys_lease.o -# End SUBSYSTEM sys_lease -################################################ + +sys_lease_OBJ_FILES = ntvfs/sysdep/sys_lease.o diff --git a/source4/ntvfs/unixuid/config.mk b/source4/ntvfs/unixuid/config.mk index 91976c6811..968e56bde4 100644 --- a/source4/ntvfs/unixuid/config.mk +++ b/source4/ntvfs/unixuid/config.mk @@ -3,8 +3,8 @@ [MODULE::ntvfs_unixuid] INIT_FUNCTION = ntvfs_unixuid_init SUBSYSTEM = ntvfs -OBJ_FILES = \ - vfs_unixuid.o PRIVATE_DEPENDENCIES = SAMDB NSS_WRAPPER # End MODULE ntvfs_unixuid ################################################ + +ntvfs_unixuid_OBJ_FILES = ntvfs/unixuid/vfs_unixuid.o diff --git a/source4/param/config.mk b/source4/param/config.mk index b4182480a9..fcec88fc27 100644 --- a/source4/param/config.mk +++ b/source4/param/config.mk @@ -1,30 +1,32 @@ [LIBRARY::LIBSAMBA-HOSTCONFIG] VERSION = 0.0.1 SO_VERSION = 0 -OBJ_FILES = loadparm.o \ - generic.o \ - util.o \ - ../lib/version.o PC_FILE = samba-hostconfig.pc PUBLIC_DEPENDENCIES = LIBSAMBA-UTIL PRIVATE_DEPENDENCIES = DYNCONFIG LIBREPLACE_EXT CHARSET -PRIVATE_PROTO_HEADER = proto.h + +LIBSAMBA-HOSTCONFIG_OBJ_FILES = param/loadparm.o \ + param/generic.o \ + param/util.o \ + lib/version.o PUBLIC_HEADERS += param/param.h [SUBSYSTEM::PROVISION] -OBJ_FILES = provision.o PRIVATE_DEPENDENCIES = LIBPYTHON +PROVISION_OBJ_FILES = param/provision.o + ################################# # Start SUBSYSTEM share [SUBSYSTEM::share] PRIVATE_PROTO_HEADER = share_proto.h -OBJ_FILES = share.o PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL # End SUBSYSTEM share ################################# +share_OBJ_FILES = param/share.o + PUBLIC_HEADERS += param/share.h ################################################ @@ -32,25 +34,30 @@ PUBLIC_HEADERS += param/share.h [MODULE::share_classic] SUBSYSTEM = share INIT_FUNCTION = share_classic_init -OBJ_FILES = share_classic.o PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL # End MODULE share_classic ################################################ +share_classic_OBJ_FILES = param/share_classic.o + ################################################ # Start MODULE share_ldb [MODULE::share_ldb] SUBSYSTEM = share INIT_FUNCTION = share_ldb_init -OBJ_FILES = share_ldb.o PRIVATE_DEPENDENCIES = LIBLDB LDB_WRAP # End MODULE share_ldb ################################################ +share_ldb_OBJ_FILES = param/share_ldb.o + [SUBSYSTEM::SECRETS] -OBJ_FILES = secrets.o PRIVATE_DEPENDENCIES = LIBLDB TDB_WRAP UTIL_TDB NDR_SECURITY +SECRETS_OBJ_FILES = param/secrets.o + [PYTHON::param] SWIG_FILE = param.i PRIVATE_DEPENDENCIES = LIBSAMBA-HOSTCONFIG + +param_OBJ_FILES = param/param_wrap.o diff --git a/source4/rpc_server/config.mk b/source4/rpc_server/config.mk index d6d77dd0d9..807853fa16 100644 --- a/source4/rpc_server/config.mk +++ b/source4/rpc_server/config.mk @@ -4,80 +4,78 @@ # Start SUBSYSTEM DCERPC_COMMON [SUBSYSTEM::DCERPC_COMMON] PRIVATE_PROTO_HEADER = common/proto.h -OBJ_FILES = \ - common/server_info.o \ - common/share_info.o # # End SUBSYSTEM DCERPC_COMMON ################################################ +DCERPC_COMMON_OBJ_FILES = $(addprefix rpc_server/common/, server_info.o share_info.o) + +PUBLIC_HEADERS += rpc_server/common/common.h + ################################################ # Start MODULE dcerpc_rpcecho [MODULE::dcerpc_rpcecho] INIT_FUNCTION = dcerpc_server_rpcecho_init SUBSYSTEM = dcerpc_server -OBJ_FILES = \ - echo/rpc_echo.o PRIVATE_DEPENDENCIES = NDR_ECHO # End MODULE dcerpc_rpcecho ################################################ +dcerpc_rpcecho_OBJ_FILES = rpc_server/echo/rpc_echo.o + ################################################ # Start MODULE dcerpc_epmapper [MODULE::dcerpc_epmapper] INIT_FUNCTION = dcerpc_server_epmapper_init SUBSYSTEM = dcerpc_server -OBJ_FILES = \ - epmapper/rpc_epmapper.o PRIVATE_DEPENDENCIES = NDR_EPMAPPER # End MODULE dcerpc_epmapper ################################################ +dcerpc_epmapper_OBJ_FILES = rpc_server/epmapper/rpc_epmapper.o + ################################################ # Start MODULE dcerpc_remote [MODULE::dcerpc_remote] INIT_FUNCTION = dcerpc_server_remote_init SUBSYSTEM = dcerpc_server -OBJ_FILES = \ - remote/dcesrv_remote.o PRIVATE_DEPENDENCIES = \ LIBCLI_SMB NDR_TABLE # End MODULE dcerpc_remote ################################################ +dcerpc_remote_OBJ_FILES = rpc_server/remote/dcesrv_remote.o + ################################################ # Start MODULE dcerpc_srvsvc [MODULE::dcerpc_srvsvc] INIT_FUNCTION = dcerpc_server_srvsvc_init PRIVATE_PROTO_HEADER = srvsvc/proto.h SUBSYSTEM = dcerpc_server -OBJ_FILES = \ - srvsvc/dcesrv_srvsvc.o \ - srvsvc/srvsvc_ntvfs.o PRIVATE_DEPENDENCIES = \ DCERPC_COMMON NDR_SRVSVC share # End MODULE dcerpc_srvsvc ################################################ +dcerpc_srvsvc_OBJ_FILES = $(addprefix rpc_server/srvsvc/, dcesrv_srvsvc.o srvsvc_ntvfs.o) + ################################################ # Start MODULE dcerpc_wkssvc [MODULE::dcerpc_wkssvc] INIT_FUNCTION = dcerpc_server_wkssvc_init SUBSYSTEM = dcerpc_server -OBJ_FILES = \ - wkssvc/dcesrv_wkssvc.o PRIVATE_DEPENDENCIES = \ DCERPC_COMMON NDR_WKSSVC # End MODULE dcerpc_wkssvc ################################################ +dcerpc_wkssvc_OBJ_FILES = rpc_server/wkssvc/dcesrv_wkssvc.o + ################################################ # Start MODULE dcerpc_unixinfo [MODULE::dcerpc_unixinfo] INIT_FUNCTION = dcerpc_server_unixinfo_init SUBSYSTEM = dcerpc_server -OBJ_FILES = \ - unixinfo/dcesrv_unixinfo.o PRIVATE_DEPENDENCIES = \ DCERPC_COMMON \ SAMDB \ @@ -87,15 +85,14 @@ PRIVATE_DEPENDENCIES = \ # End MODULE dcerpc_unixinfo ################################################ +dcerpc_unixinfo_OBJ_FILES = rpc_server/unixinfo/dcesrv_unixinfo.o + ################################################ # Start MODULE dcesrv_samr [MODULE::dcesrv_samr] INIT_FUNCTION = dcerpc_server_samr_init PRIVATE_PROTO_HEADER = samr/proto.h SUBSYSTEM = dcerpc_server -OBJ_FILES = \ - samr/dcesrv_samr.o \ - samr/samr_password.o PRIVATE_DEPENDENCIES = \ SAMDB \ DCERPC_COMMON \ @@ -103,26 +100,26 @@ PRIVATE_DEPENDENCIES = \ # End MODULE dcesrv_samr ################################################ +dcesrv_samr_OBJ_FILES = $(addprefix rpc_server/samr/, dcesrv_samr.o samr_password.o) + ################################################ # Start MODULE dcerpc_winreg [MODULE::dcerpc_winreg] INIT_FUNCTION = dcerpc_server_winreg_init SUBSYSTEM = dcerpc_server OUTPUT_TYPE = MERGED_OBJ -OBJ_FILES = \ - winreg/rpc_winreg.o PRIVATE_DEPENDENCIES = \ registry NDR_WINREG # End MODULE dcerpc_winreg ################################################ +dcerpc_winreg_OBJ_FILES = rpc_server/winreg/rpc_winreg.o + ################################################ # Start MODULE dcerpc_netlogon [MODULE::dcerpc_netlogon] INIT_FUNCTION = dcerpc_server_netlogon_init SUBSYSTEM = dcerpc_server -OBJ_FILES = \ - netlogon/dcerpc_netlogon.o PRIVATE_DEPENDENCIES = \ DCERPC_COMMON \ SCHANNELDB \ @@ -131,16 +128,14 @@ PRIVATE_DEPENDENCIES = \ # End MODULE dcerpc_netlogon ################################################ +dcerpc_netlogon_OBJ_FILES = rpc_server/netlogon/dcerpc_netlogon.o + ################################################ # Start MODULE dcerpc_lsa [MODULE::dcerpc_lsarpc] INIT_FUNCTION = dcerpc_server_lsa_init SUBSYSTEM = dcerpc_server PRIVATE_PROTO_HEADER= lsa/proto.h -OBJ_FILES = \ - lsa/dcesrv_lsa.o \ - lsa/lsa_init.o \ - lsa/lsa_lookup.o PRIVATE_DEPENDENCIES = \ SAMDB \ DCERPC_COMMON \ @@ -150,14 +145,15 @@ PRIVATE_DEPENDENCIES = \ # End MODULE dcerpc_lsa ################################################ +dcerpc_lsarpc_OBJ_FILES = $(addprefix rpc_server/lsa/, dcesrv_lsa.o lsa_init.o lsa_lookup.o) + + ################################################ # Start MODULE dcerpc_spoolss [MODULE::dcerpc_spoolss] INIT_FUNCTION = dcerpc_server_spoolss_init SUBSYSTEM = dcerpc_server OUTPUT_TYPE = MERGED_OBJ -OBJ_FILES = \ - spoolss/dcesrv_spoolss.o PRIVATE_DEPENDENCIES = \ DCERPC_COMMON \ NDR_SPOOLSS \ @@ -166,13 +162,13 @@ PRIVATE_DEPENDENCIES = \ # End MODULE dcerpc_spoolss ################################################ +dcerpc_spoolss_OBJ_FILES = rpc_server/spoolss/dcesrv_spoolss.o + ################################################ # Start MODULE dcerpc_drsuapi [MODULE::dcerpc_drsuapi] INIT_FUNCTION = dcerpc_server_drsuapi_init SUBSYSTEM = dcerpc_server -OBJ_FILES = \ - drsuapi/dcesrv_drsuapi.o PRIVATE_DEPENDENCIES = \ SAMDB \ DCERPC_COMMON \ @@ -180,20 +176,23 @@ PRIVATE_DEPENDENCIES = \ # End MODULE dcerpc_drsuapi ################################################ +dcerpc_drsuapi_OBJ_FILES = rpc_server/drsuapi/dcesrv_drsuapi.o + ################################################ # Start SUBSYSTEM dcerpc_server [SUBSYSTEM::dcerpc_server] PRIVATE_PROTO_HEADER = dcerpc_server_proto.h -OBJ_FILES = \ - dcerpc_server.o \ - dcesrv_auth.o \ - dcesrv_mgmt.o \ - handles.o PRIVATE_DEPENDENCIES = \ LIBCLI_AUTH \ LIBNDR \ dcerpc -# + +dcerpc_server_OBJ_FILES = $(addprefix rpc_server/, \ + dcerpc_server.o \ + dcesrv_auth.o \ + dcesrv_mgmt.o \ + handles.o) + # End SUBSYSTEM DCERPC ################################################ @@ -201,6 +200,7 @@ PUBLIC_HEADERS += rpc_server/dcerpc_server.h [MODULE::DCESRV] INIT_FUNCTION = server_service_rpc_init -OBJ_FILES = service_rpc.o SUBSYSTEM = service PRIVATE_DEPENDENCIES = dcerpc_server + +DCESRV_OBJ_FILES = rpc_server/service_rpc.o diff --git a/source4/scripting/ejs/config.mk b/source4/scripting/ejs/config.mk index ea64d24eea..a3ed5239bf 100644 --- a/source4/scripting/ejs/config.mk +++ b/source4/scripting/ejs/config.mk @@ -1,84 +1,85 @@ [SUBSYSTEM::EJSRPC] -OBJ_FILES = \ - ejsrpc.o + +EJSRPC_OBJ_FILES = scripting/ejs/ejsrpc.o [MODULE::smbcalls_config] -OBJ_FILES = smbcalls_config.o OUTPUT_TYPE = MERGED_OBJ SUBSYSTEM = smbcalls INIT_FUNCTION = smb_setup_ejs_config +smbcalls_config_OBJ_FILES = scripting/ejs/smbcalls_config.o + [MODULE::smbcalls_ldb] -OBJ_FILES = smbcalls_ldb.o OUTPUT_TYPE = MERGED_OBJ SUBSYSTEM = smbcalls INIT_FUNCTION = smb_setup_ejs_ldb PRIVATE_DEPENDENCIES = LIBLDB SAMDB LIBNDR +smbcalls_ldb_OBJ_FILES = scripting/ejs/smbcalls_ldb.o + [MODULE::smbcalls_reg] -OBJ_FILES = smbcalls_reg.o SUBSYSTEM = smbcalls OUTPUT_TYPE = MERGED_OBJ INIT_FUNCTION = smb_setup_ejs_reg PRIVATE_DEPENDENCIES = registry SAMDB LIBNDR +smbcalls_reg_OBJ_FILES = scripting/ejs/smbcalls_reg.o + [MODULE::smbcalls_nbt] -OBJ_FILES = smbcalls_nbt.o SUBSYSTEM = smbcalls OUTPUT_TYPE = MERGED_OBJ INIT_FUNCTION = smb_setup_ejs_nbt +smbcalls_nbt_OBJ_FILES = scripting/ejs/smbcalls_nbt.o + [MODULE::smbcalls_rand] -OBJ_FILES = smbcalls_rand.o SUBSYSTEM = smbcalls OUTPUT_TYPE = MERGED_OBJ INIT_FUNCTION = smb_setup_ejs_random +smbcalls_rand_OBJ_FILES = scripting/ejs/smbcalls_rand.o + [MODULE::smbcalls_nss] -OBJ_FILES = smbcalls_nss.o SUBSYSTEM = smbcalls OUTPUT_TYPE = MERGED_OBJ INIT_FUNCTION = smb_setup_ejs_nss PRIVATE_DEPENDENCIES = NSS_WRAPPER +smbcalls_nss_OBJ_FILES = scripting/ejs/smbcalls_nss.o + [MODULE::smbcalls_data] -OBJ_FILES = smbcalls_data.o SUBSYSTEM = smbcalls OUTPUT_TYPE = MERGED_OBJ INIT_FUNCTION = smb_setup_ejs_datablob +smbcalls_data_OBJ_FILES = scripting/ejs/smbcalls_data.o + [MODULE::smbcalls_auth] -OBJ_FILES = smbcalls_auth.o OUTPUT_TYPE = MERGED_OBJ SUBSYSTEM = smbcalls INIT_FUNCTION = smb_setup_ejs_auth -PRIVATE_DEPENDENCIES = auth +PRIVATE_DEPENDENCIES = service_auth + +smbcalls_auth_OBJ_FILES = scripting/ejs/smbcalls_auth.o [MODULE::smbcalls_string] -OBJ_FILES = smbcalls_string.o SUBSYSTEM = smbcalls OUTPUT_TYPE = MERGED_OBJ INIT_FUNCTION = smb_setup_ejs_string +smbcalls_string_OBJ_FILES = scripting/ejs/smbcalls_string.o + [MODULE::smbcalls_sys] -OBJ_FILES = smbcalls_sys.o SUBSYSTEM = smbcalls OUTPUT_TYPE = MERGED_OBJ INIT_FUNCTION = smb_setup_ejs_system +smbcalls_sys_OBJ_FILES = scripting/ejs/smbcalls_sys.o + mkinclude ejsnet/config.mk [SUBSYSTEM::smbcalls] PRIVATE_PROTO_HEADER = proto.h -OBJ_FILES = \ - smbcalls.o \ - smbcalls_cli.o \ - smbcalls_rpc.o \ - smbcalls_options.o \ - smbcalls_creds.o \ - smbcalls_param.o \ - mprutil.o \ - literal.o PRIVATE_DEPENDENCIES = \ EJS LIBSAMBA-UTIL \ EJSRPC MESSAGING \ @@ -87,11 +88,21 @@ PRIVATE_DEPENDENCIES = \ dcerpc \ NDR_TABLE +smbcalls_OBJ_FILES = $(addprefix scripting/ejs/, \ + smbcalls.o \ + smbcalls_cli.o \ + smbcalls_rpc.o \ + smbcalls_options.o \ + smbcalls_creds.o \ + smbcalls_param.o \ + mprutil.o \ + literal.o) + ####################### # Start BINARY SMBSCRIPT [BINARY::smbscript] -OBJ_FILES = \ - smbscript.o PRIVATE_DEPENDENCIES = EJS LIBSAMBA-UTIL smbcalls LIBSAMBA-HOSTCONFIG # End BINARY SMBSCRIPT ####################### + +smbscript_OBJ_FILES = scripting/ejs/smbscript.o diff --git a/source4/scripting/ejs/ejsnet/config.mk b/source4/scripting/ejs/ejsnet/config.mk index 249a33121d..85a5b2bf09 100644 --- a/source4/scripting/ejs/ejsnet/config.mk +++ b/source4/scripting/ejs/ejsnet/config.mk @@ -1,11 +1,13 @@ [MODULE::smbcalls_net] -OBJ_FILES = \ - net_ctx.o \ - net_user.o \ - mpr_user.o \ - net_host.o \ - mpr_host.o SUBSYSTEM = smbcalls INIT_FUNCTION = smb_setup_ejs_net PRIVATE_PROTO_HEADER = proto.h PRIVATE_DEPENDENCIES = LIBSAMBA-NET LIBCLI_SMB CREDENTIALS + +smbcalls_net_OBJ_FILES = $(addprefix scripting/ejs/ejsnet/, \ + net_ctx.o \ + net_user.o \ + mpr_user.o \ + net_host.o \ + mpr_host.o) + diff --git a/source4/scripting/python/config.mk b/source4/scripting/python/config.mk index 22e9a2ff7b..cb03bfaeea 100644 --- a/source4/scripting/python/config.mk +++ b/source4/scripting/python/config.mk @@ -1,15 +1,18 @@ [BINARY::smbpython] PRIVATE_DEPENDENCIES = LIBPYTHON -OBJ_FILES = smbpython.o + +smbpython_OBJ_FILES = smbpython.o [SUBSYSTEM::LIBPYTHON] PUBLIC_DEPENDENCIES = EXT_LIB_PYTHON INIT_FUNCTION_SENTINEL = { NULL, NULL } -OBJ_FILES = modules.o pytalloc.o + +LIBPYTHON_OBJ_FILES = modules.o pytalloc.o [PYTHON::python_uuid] PRIVATE_DEPENDENCIES = LIBNDR -OBJ_FILES = uuidmodule.o + +python_uuid_OBJ_FILES = uuidmodule.o [PYTHON::python_misc] PRIVATE_DEPENDENCIES = LIBNDR LIBLDB SAMDB CREDENTIALS diff --git a/source4/smb_server/config.mk b/source4/smb_server/config.mk index 85c969df59..8b6ae308f9 100644 --- a/source4/smb_server/config.mk +++ b/source4/smb_server/config.mk @@ -3,19 +3,14 @@ [MODULE::SERVICE_SMB] INIT_FUNCTION = server_service_smb_init SUBSYSTEM = service -OBJ_FILES = smb_server.o PRIVATE_PROTO_HEADER = service_smb_proto.h PRIVATE_DEPENDENCIES = SMB_SERVER +SERVICE_SMB_OBJ_FILES = smb_server/smb_server.o + ####################### # Start SUBSYSTEM SMB [SUBSYSTEM::SMB_SERVER] -OBJ_FILES = \ - handle.o \ - tcon.o \ - session.o \ - blob.o \ - management.o PRIVATE_PROTO_HEADER = smb_server_proto.h PUBLIC_DEPENDENCIES = \ share \ @@ -25,5 +20,12 @@ PUBLIC_DEPENDENCIES = \ # End SUBSYSTEM SMB ####################### +SMB_SERVER_OBJ_FILES = $(addprefix smb_server/, \ + handle.o \ + tcon.o \ + session.o \ + blob.o \ + management.o) + mkinclude smb/config.mk mkinclude smb2/config.mk diff --git a/source4/smb_server/smb/config.mk b/source4/smb_server/smb/config.mk index 7927f295b9..3d4aa8ba38 100644 --- a/source4/smb_server/smb/config.mk +++ b/source4/smb_server/smb/config.mk @@ -2,7 +2,12 @@ # Start SUBSYSTEM SMB_PROTOCOL [SUBSYSTEM::SMB_PROTOCOL] PRIVATE_PROTO_HEADER = smb_proto.h -OBJ_FILES = \ +PUBLIC_DEPENDENCIES = \ + ntvfs LIBPACKET CREDENTIALS +# End SUBSYSTEM SMB_PROTOCOL +####################### + +SMB_PROTOCOL_OBJ_FILES = $(addprefix smb_server/smb/, \ receive.o \ negprot.o \ nttrans.o \ @@ -13,8 +18,5 @@ OBJ_FILES = \ sesssetup.o \ srvtime.o \ trans2.o \ - signing.o -PUBLIC_DEPENDENCIES = \ - ntvfs LIBPACKET CREDENTIALS -# End SUBSYSTEM SMB_PROTOCOL -####################### + signing.o) + diff --git a/source4/smb_server/smb2/config.mk b/source4/smb_server/smb2/config.mk index d5ba43b3a8..c9ba3269fa 100644 --- a/source4/smb_server/smb2/config.mk +++ b/source4/smb_server/smb2/config.mk @@ -2,7 +2,12 @@ # Start SUBSYSTEM SMB2_PROTOCOL [SUBSYSTEM::SMB2_PROTOCOL] PRIVATE_PROTO_HEADER = smb2_proto.h -OBJ_FILES = \ +PUBLIC_DEPENDENCIES = \ + ntvfs LIBPACKET LIBCLI_SMB2 +# End SUBSYSTEM SMB2_PROTOCOL +####################### + +SMB2_PROTOCOL_OBJ_FILES = $(addprefix smb_server/smb2/, \ receive.o \ negprot.o \ sesssetup.o \ @@ -10,8 +15,5 @@ OBJ_FILES = \ fileio.o \ fileinfo.o \ find.o \ - keepalive.o -PUBLIC_DEPENDENCIES = \ - ntvfs LIBPACKET LIBCLI_SMB2 -# End SUBSYSTEM SMB2_PROTOCOL -####################### + keepalive.o) + diff --git a/source4/smbd/config.mk b/source4/smbd/config.mk index 9eb3cfa653..006135f818 100644 --- a/source4/smbd/config.mk +++ b/source4/smbd/config.mk @@ -34,6 +34,8 @@ PRIVATE_DEPENDENCIES = \ share \ CLUSTER +smbd_OBJ_FILES = smbd/server.o + MANPAGES += smbd/smbd.8 # End BINARY smbd ################################# diff --git a/source4/smbd/process_model.mk b/source4/smbd/process_model.mk index d559ce1577..48899078f7 100644 --- a/source4/smbd/process_model.mk +++ b/source4/smbd/process_model.mk @@ -5,45 +5,45 @@ [MODULE::process_model_single] INIT_FUNCTION = process_model_single_init SUBSYSTEM = process_model -OBJ_FILES = \ - process_single.o # End MODULE process_model_single ################################################ +process_model_single_OBJ_FILES = smbd/process_single.o + ################################################ # Start MODULE process_model_standard [MODULE::process_model_standard] INIT_FUNCTION = process_model_standard_init SUBSYSTEM = process_model -OBJ_FILES = \ - process_standard.o PRIVATE_DEPENDENCIES = SETPROCTITLE # End MODULE process_model_standard ################################################ +process_model_standard_OBJ_FILES = smbd/process_standard.o + ################################################ # Start MODULE process_model_thread [MODULE::process_model_thread] INIT_FUNCTION = process_model_thread_init SUBSYSTEM = process_model -OBJ_FILES = \ - process_thread.o PRIVATE_DEPENDENCIES = PTHREAD # End MODULE process_model_thread ################################################ +process_model_thread_OBJ_FILES = smbd/process_thread.o + ################################################ # Start MODULE process_model_prefork [MODULE::process_model_prefork] INIT_FUNCTION = process_model_prefork_init SUBSYSTEM = process_model -OBJ_FILES = \ - process_prefork.o # End MODULE process_model_thread ################################################ +process_model_prefork_OBJ_FILES = smbd/process_prefork.o + [SUBSYSTEM::process_model] PRIVATE_PROTO_HEADER = process_model_proto.h -OBJ_FILES = \ - process_model.o PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL LIBSAMBA-HOSTCONFIG + +process_model_OBJ_FILES = smbd/process_model.o diff --git a/source4/torture/config.mk b/source4/torture/config.mk index 7acb1e0792..e15d20d9cd 100644 --- a/source4/torture/config.mk +++ b/source4/torture/config.mk @@ -4,22 +4,25 @@ SO_VERSION = 0 VERSION = 0.0.1 PC_FILE = torture.pc PRIVATE_PROTO_HEADER = proto.h -OBJ_FILES = \ - torture.o \ - ui.o PUBLIC_DEPENDENCIES = \ LIBSAMBA-HOSTCONFIG \ LIBSAMBA-UTIL \ LIBTALLOC \ LIBPOPT + +torture_OBJ_FILES = \ + torture.o \ + ui.o + PUBLIC_HEADERS += torture/torture.h torture/ui.h [SUBSYSTEM::TORTURE_UTIL] -OBJ_FILES = util_smb.o PRIVATE_DEPENDENCIES = LIBCLI_RAW LIBPYTHON smbcalls PROVISION PUBLIC_DEPENDENCIES = POPT_CREDENTIALS +TORTURE_UTIL_OBJ_FILES = util_smb.o + ################################# # Start SUBSYSTEM TORTURE_BASIC [MODULE::TORTURE_BASIC] @@ -27,25 +30,6 @@ SUBSYSTEM = torture INIT_FUNCTION = torture_base_init PRIVATE_PROTO_HEADER = \ basic/proto.h -OBJ_FILES = \ - basic/base.o \ - basic/misc.o \ - basic/scanner.o \ - basic/utable.o \ - basic/charset.o \ - basic/mangle_test.o \ - basic/denytest.o \ - basic/aliases.o \ - basic/locking.o \ - basic/secleak.o \ - basic/rename.o \ - basic/dir.o \ - basic/delete.o \ - basic/unlink.o \ - basic/disconnect.o \ - basic/delaywrite.o \ - basic/attr.o \ - basic/properties.o PRIVATE_DEPENDENCIES = \ LIBCLI_SMB POPT_CREDENTIALS \ TORTURE_UTIL LIBCLI_RAW \ @@ -53,6 +37,27 @@ PRIVATE_DEPENDENCIES = \ # End SUBSYSTEM TORTURE_BASIC ################################# +TORTURE_BASIC_OBJ_FILES = $(addprefix torture/basic/, \ + base.o \ + misc.o \ + scanner.o \ + utable.o \ + charset.o \ + mangle_test.o \ + denytest.o \ + aliases.o \ + locking.o \ + secleak.o \ + rename.o \ + dir.o \ + delete.o \ + unlink.o \ + disconnect.o \ + delaywrite.o \ + attr.o \ + properties.o) + + ################################# # Start SUBSYSTEM TORTURE_RAW [MODULE::TORTURE_RAW] @@ -60,58 +65,52 @@ SUBSYSTEM = torture INIT_FUNCTION = torture_raw_init PRIVATE_PROTO_HEADER = \ raw/proto.h -OBJ_FILES = \ - raw/qfsinfo.o \ - raw/qfileinfo.o \ - raw/setfileinfo.o \ - raw/search.o \ - raw/close.o \ - raw/open.o \ - raw/mkdir.o \ - raw/oplock.o \ - raw/notify.o \ - raw/mux.o \ - raw/ioctl.o \ - raw/chkpath.o \ - raw/unlink.o \ - raw/read.o \ - raw/context.o \ - raw/write.o \ - raw/lock.o \ - raw/pingpong.o \ - raw/lockbench.o \ - raw/openbench.o \ - raw/rename.o \ - raw/eas.o \ - raw/streams.o \ - raw/acls.o \ - raw/seek.o \ - raw/samba3hide.o \ - raw/samba3misc.o \ - raw/composite.o \ - raw/raw.o \ - raw/offline.o PRIVATE_DEPENDENCIES = \ LIBCLI_SMB LIBCLI_LSA LIBCLI_SMB_COMPOSITE \ POPT_CREDENTIALS TORTURE_UTIL # End SUBSYSTEM TORTURE_RAW ################################# +TORTURE_RAW_OBJ_FILES = $(addprefix torture/raw/, \ + qfsinfo.o \ + qfileinfo.o \ + setfileinfo.o \ + search.o \ + close.o \ + open.o \ + mkdir.o \ + oplock.o \ + notify.o \ + mux.o \ + ioctl.o \ + chkpath.o \ + unlink.o \ + read.o \ + context.o \ + write.o \ + lock.o \ + pingpong.o \ + lockbench.o \ + openbench.o \ + rename.o \ + eas.o \ + streams.o \ + acls.o \ + seek.o \ + samba3hide.o \ + samba3misc.o \ + composite.o \ + raw.o \ + offline.o) + + mkinclude smb2/config.mk mkinclude winbind/config.mk [SUBSYSTEM::TORTURE_NDR] PRIVATE_PROTO_HEADER = ndr/proto.h -OBJ_FILES = ndr/ndr.o \ - ndr/winreg.o \ - ndr/atsvc.o \ - ndr/lsa.o \ - ndr/epmap.o \ - ndr/dfs.o \ - ndr/netlogon.o \ - ndr/drsuapi.o \ - ndr/spoolss.o \ - ndr/samr.o + +TORTURE_NDR_OBJ_FILES = $(addprefix torture/ndr/, ndr.o winreg.o atsvc.o lsa.o epmap.o dfs.o netlogon.o drsuapi.o spoolss.o samr.o) [MODULE::torture_rpc] # TORTURE_NET and TORTURE_NBT use functions from torture_rpc... @@ -120,50 +119,6 @@ SUBSYSTEM = torture INIT_FUNCTION = torture_rpc_init PRIVATE_PROTO_HEADER = \ rpc/proto.h -OBJ_FILES = \ - rpc/join.o \ - rpc/lsa.o \ - rpc/lsa_lookup.o \ - rpc/session_key.o \ - rpc/echo.o \ - rpc/dfs.o \ - rpc/drsuapi.o \ - rpc/drsuapi_cracknames.o \ - rpc/dssync.o \ - rpc/spoolss.o \ - rpc/spoolss_notify.o \ - rpc/spoolss_win.o \ - rpc/unixinfo.o \ - rpc/samr.o \ - rpc/samr_accessmask.o \ - rpc/wkssvc.o \ - rpc/srvsvc.o \ - rpc/svcctl.o \ - rpc/atsvc.o \ - rpc/eventlog.o \ - rpc/epmapper.o \ - rpc/winreg.o \ - rpc/initshutdown.o \ - rpc/oxidresolve.o \ - rpc/remact.o \ - rpc/mgmt.o \ - rpc/scanner.o \ - rpc/autoidl.o \ - rpc/countcalls.o \ - rpc/testjoin.o \ - rpc/schannel.o \ - rpc/netlogon.o \ - rpc/samlogon.o \ - rpc/samsync.o \ - rpc/bind.o \ - rpc/dssetup.o \ - rpc/alter_context.o \ - rpc/bench.o \ - rpc/samba3rpc.o \ - rpc/rpc.o \ - rpc/async_bind.o \ - rpc/handles.o \ - rpc/frsapi.o PRIVATE_DEPENDENCIES = \ NDR_TABLE RPC_NDR_UNIXINFO dcerpc_samr RPC_NDR_WINREG RPC_NDR_INITSHUTDOWN \ RPC_NDR_OXIDRESOLVER RPC_NDR_EVENTLOG RPC_NDR_ECHO RPC_NDR_SVCCTL \ @@ -172,7 +127,16 @@ PRIVATE_DEPENDENCIES = \ RPC_NDR_SRVSVC RPC_NDR_WKSSVC RPC_NDR_ROT RPC_NDR_DSSETUP \ RPC_NDR_REMACT RPC_NDR_OXIDRESOLVER WB_HELPER LIBSAMBA-NET \ LIBCLI_AUTH POPT_CREDENTIALS TORTURE_LDAP TORTURE_UTIL TORTURE_RAP \ - dcerpc_server service process_model + dcerpc_server service process_model ntvfs SERVICE_SMB + +torture_rpc_OBJ_FILES = $(addprefix torture/rpc/, \ + join.o lsa.o lsa_lookup.o session_key.o echo.o dfs.o drsuapi.o \ + drsuapi_cracknames.o dssync.o spoolss.o spoolss_notify.o spoolss_win.o \ + unixinfo.o samr.o samr_accessmask.o wkssvc.o srvsvc.o svcctl.o atsvc.o \ + eventlog.o epmapper.o winreg.o initshutdown.o oxidresolve.o remact.o mgmt.o \ + scanner.o autoidl.o countcalls.o testjoin.o schannel.o netlogon.o samlogon.o \ + samsync.o bind.o dssetup.o alter_context.o bench.o samba3rpc.o rpc.o async_bind.o \ + handles.o frsapi.o) ################################# # Start SUBSYSTEM TORTURE_RAP @@ -181,27 +145,26 @@ SUBSYSTEM = torture INIT_FUNCTION = torture_rap_init PRIVATE_PROTO_HEADER = \ rap/proto.h -OBJ_FILES = \ - rap/rap.o PRIVATE_DEPENDENCIES = TORTURE_UTIL LIBCLI_SMB # End SUBSYSTEM TORTURE_RAP ################################# +TORTURE_RAP_OBJ_FILES = torture/rap/rap.o + ################################# # Start SUBSYSTEM TORTURE_AUTH [MODULE::TORTURE_AUTH] SUBSYSTEM = torture PRIVATE_PROTO_HEADER = \ auth/proto.h -OBJ_FILES = \ - auth/ntlmssp.o \ - auth/pac.o PRIVATE_DEPENDENCIES = \ LIBCLI_SMB gensec auth KERBEROS \ POPT_CREDENTIALS SMBPASSWD # End SUBSYSTEM TORTURE_AUTH ################################# +TORTURE_AUTH_OBJ_FILES = $(addprefix torture/auth/, ntlmssp.o pac.o) + mkinclude local/config.mk ################################# @@ -212,12 +175,11 @@ INIT_FUNCTION = torture_nbench_init PRIVATE_DEPENDENCIES = TORTURE_UTIL PRIVATE_PROTO_HEADER = \ nbench/proto.h -OBJ_FILES = \ - nbench/nbio.o \ - nbench/nbench.o # End MODULE TORTURE_NBENCH ################################# +TORTURE_NBENCH_OBJ_FILES = $(addprefix torture/nbench/, nbio.o nbench.o) + ################################# # Start MODULE TORTURE_UNIX [MODULE::TORTURE_UNIX] @@ -226,13 +188,11 @@ INIT_FUNCTION = torture_unix_init PRIVATE_DEPENDENCIES = TORTURE_UTIL PRIVATE_PROTO_HEADER = \ unix/proto.h -OBJ_FILES = \ - unix/unix.o \ - unix/whoami.o \ - unix/unix_info2.o # End MODULE TORTURE_UNIX ################################# +TORTURE_UNIX_OBJ_FILES = $(addprefix torture/unix/, unix.o whoami.o unix_info2.o) + ################################# # Start SUBSYSTEM TORTURE_LDAP [MODULE::TORTURE_LDAP] @@ -240,18 +200,14 @@ SUBSYSTEM = torture INIT_FUNCTION = torture_ldap_init PRIVATE_PROTO_HEADER = \ ldap/proto.h -OBJ_FILES = \ - ldap/common.o \ - ldap/basic.o \ - ldap/schema.o \ - ldap/uptodatevector.o \ - ldap/cldap.o \ - ldap/cldapbench.o PRIVATE_DEPENDENCIES = \ LIBCLI_LDAP LIBCLI_CLDAP SAMDB POPT_CREDENTIALS # End SUBSYSTEM TORTURE_LDAP ################################# +TORTURE_LDAP_OBJ_FILES = $(addprefix torture/ldap/, common.o basic.o schema.o uptodatevector.o cldap.o cldapbench.o) + + ################################# # Start SUBSYSTEM TORTURE_NBT [MODULE::TORTURE_NBT] @@ -259,19 +215,15 @@ SUBSYSTEM = torture INIT_FUNCTION = torture_nbt_init PRIVATE_PROTO_HEADER = \ nbt/proto.h -OBJ_FILES = \ - nbt/query.o \ - nbt/register.o \ - nbt/wins.o \ - nbt/winsbench.o \ - nbt/winsreplication.o \ - nbt/dgram.o \ - nbt/nbt.o PRIVATE_DEPENDENCIES = \ LIBCLI_SMB LIBCLI_NBT LIBCLI_DGRAM LIBCLI_WREPL torture_rpc # End SUBSYSTEM TORTURE_NBT ################################# +TORTURE_NBT_OBJ_FILES = $(addprefix torture/nbt/, query.o register.o \ + wins.o winsbench.o winsreplication.o dgram.o nbt.o) + + ################################# # Start SUBSYSTEM TORTURE_NET [MODULE::TORTURE_NET] @@ -279,21 +231,6 @@ SUBSYSTEM = torture INIT_FUNCTION = torture_net_init PRIVATE_PROTO_HEADER = \ libnet/proto.h -OBJ_FILES = \ - libnet/libnet.o \ - libnet/utils.o \ - libnet/userinfo.o \ - libnet/userman.o \ - libnet/groupinfo.o \ - libnet/groupman.o \ - libnet/domain.o \ - libnet/libnet_lookup.o \ - libnet/libnet_user.o \ - libnet/libnet_group.o \ - libnet/libnet_share.o \ - libnet/libnet_rpc.o \ - libnet/libnet_domain.o \ - libnet/libnet_BecomeDC.o PRIVATE_DEPENDENCIES = \ LIBSAMBA-NET \ POPT_CREDENTIALS \ @@ -301,12 +238,16 @@ PRIVATE_DEPENDENCIES = \ # End SUBSYSTEM TORTURE_NET ################################# +TORTURE_NET_OBJ_FILES = $(addprefix torture/libnet/, libnet.o \ + utils.o userinfo.o userman.o groupinfo.o groupman.o \ + domain.o libnet_lookup.o libnet_user.o libnet_group.o \ + libnet_share.o libnet_rpc.o libnet_domain.o libnet_BecomeDC.o) + + ################################# # Start BINARY smbtorture [BINARY::smbtorture] INSTALLDIR = BINDIR -OBJ_FILES = \ - smbtorture.o PRIVATE_DEPENDENCIES = \ torture \ LIBPOPT \ @@ -318,14 +259,14 @@ PRIVATE_DEPENDENCIES = \ # End BINARY smbtorture ################################# +smbtorture_OBJ_FILES = torture/smbtorture.o + MANPAGES += torture/man/smbtorture.1 ################################# # Start BINARY gentest [BINARY::gentest] INSTALLDIR = BINDIR -OBJ_FILES = \ - gentest.o PRIVATE_DEPENDENCIES = \ LIBSAMBA-HOSTCONFIG \ LIBSAMBA-UTIL \ @@ -337,14 +278,14 @@ PRIVATE_DEPENDENCIES = \ # End BINARY gentest ################################# +gentest_OBJ_FILES = torture/gentest.o + MANPAGES += torture/man/gentest.1 ################################# # Start BINARY masktest [BINARY::masktest] INSTALLDIR = BINDIR -OBJ_FILES = \ - masktest.o PRIVATE_DEPENDENCIES = \ LIBSAMBA-HOSTCONFIG \ LIBSAMBA-UTIL \ @@ -355,14 +296,14 @@ PRIVATE_DEPENDENCIES = \ # End BINARY masktest ################################# +masktest_OBJ_FILES = torture/masktest.o + MANPAGES += torture/man/masktest.1 ################################# # Start BINARY locktest [BINARY::locktest] INSTALLDIR = BINDIR -OBJ_FILES = \ - locktest.o PRIVATE_DEPENDENCIES = \ LIBPOPT \ POPT_SAMBA \ @@ -373,6 +314,8 @@ PRIVATE_DEPENDENCIES = \ # End BINARY locktest ################################# +locktest_OBJ_FILES = torture/locktest.o + MANPAGES += torture/man/locktest.1 COV_TARGET = test diff --git a/source4/torture/local/config.mk b/source4/torture/local/config.mk index 4143d415cf..efdea7f66a 100644 --- a/source4/torture/local/config.mk +++ b/source4/torture/local/config.mk @@ -5,35 +5,6 @@ SUBSYSTEM = torture INIT_FUNCTION = torture_local_init PRIVATE_PROTO_HEADER = \ proto.h -OBJ_FILES = \ - ../../lib/charset/tests/iconv.o \ - ../../lib/talloc/testsuite.o \ - ../../lib/replace/test/getifaddrs.o \ - ../../lib/replace/test/os2_delete.o \ - ../../lib/replace/test/strptime.o \ - ../../lib/replace/test/testsuite.o \ - ../../lib/messaging/tests/messaging.o \ - ../../lib/messaging/tests/irpc.o \ - ../../librpc/tests/binding_string.o \ - ../../lib/util/tests/idtree.o \ - ../../lib/socket/testsuite.o \ - ../../lib/socket_wrapper/testsuite.o \ - ../../libcli/resolve/testsuite.o \ - ../../lib/util/tests/strlist.o \ - ../../lib/util/tests/str.o \ - ../../lib/util/tests/file.o \ - ../../lib/util/tests/genrand.o \ - ../../lib/compression/testsuite.o \ - ../../lib/charset/tests/charset.o \ - ../../libcli/security/tests/sddl.o \ - ../../lib/tdr/testsuite.o \ - ../../lib/events/testsuite.o \ - ../../param/tests/share.o \ - ../../param/tests/loadparm.o \ - ../../auth/credentials/tests/simple.o \ - local.o \ - dbspeed.o \ - torture.o PRIVATE_DEPENDENCIES = \ RPC_NDR_ECHO \ TDR \ @@ -48,3 +19,34 @@ PRIVATE_DEPENDENCIES = \ torture_registry # End SUBSYSTEM TORTURE_LOCAL ################################# + +TORTURE_LOCAL_OBJ_FILES = \ + lib/charset/tests/iconv.o \ + lib/talloc/testsuite.o \ + lib/replace/test/getifaddrs.o \ + lib/replace/test/os2_delete.o \ + lib/replace/test/strptime.o \ + lib/replace/test/testsuite.o \ + lib/messaging/tests/messaging.o \ + lib/messaging/tests/irpc.o \ + librpc/tests/binding_string.o \ + lib/util/tests/idtree.o \ + lib/socket/testsuite.o \ + lib/socket_wrapper/testsuite.o \ + libcli/resolve/testsuite.o \ + lib/util/tests/strlist.o \ + lib/util/tests/str.o \ + lib/util/tests/file.o \ + lib/util/tests/genrand.o \ + lib/compression/testsuite.o \ + lib/charset/tests/charset.o \ + libcli/security/tests/sddl.o \ + lib/tdr/testsuite.o \ + lib/events/testsuite.o \ + param/tests/share.o \ + param/tests/loadparm.o \ + auth/credentials/tests/simple.o \ + torture/local/local.o \ + torture/local/dbspeed.o \ + torture/local/torture.o + diff --git a/source4/torture/smb2/config.mk b/source4/torture/smb2/config.mk index 7463a31318..379632f0e7 100644 --- a/source4/torture/smb2/config.mk +++ b/source4/torture/smb2/config.mk @@ -6,7 +6,12 @@ SUBSYSTEM = torture INIT_FUNCTION = torture_smb2_init PRIVATE_PROTO_HEADER = \ proto.h -OBJ_FILES = \ +PRIVATE_DEPENDENCIES = \ + LIBCLI_SMB2 POPT_CREDENTIALS +# End SUBSYSTEM TORTURE_SMB2 +################################# + +TORTURE_SMB2_OBJ_FILES = $(addprefix torture/smb2/, \ connect.o \ scan.o \ util.o \ @@ -15,8 +20,5 @@ OBJ_FILES = \ find.o \ lock.o \ notify.o \ - smb2.o -PRIVATE_DEPENDENCIES = \ - LIBCLI_SMB2 POPT_CREDENTIALS -# End SUBSYSTEM TORTURE_SMB2 -################################# + smb2.o) + diff --git a/source4/torture/winbind/config.mk b/source4/torture/winbind/config.mk index b64b0647fc..155766a677 100644 --- a/source4/torture/winbind/config.mk +++ b/source4/torture/winbind/config.mk @@ -6,10 +6,10 @@ SUBSYSTEM = torture INIT_FUNCTION = torture_winbind_init PRIVATE_PROTO_HEADER = \ proto.h -OBJ_FILES = \ - winbind.o \ - struct_based.o PRIVATE_DEPENDENCIES = \ LIBWINBIND-CLIENT # End SUBSYSTEM TORTURE_WINBIND ################################# + +TORTURE_WINBIND_OBJ_FILES = $(addprefix torture/winbind/, winbind.o struct_based.o) + diff --git a/source4/utils/config.mk b/source4/utils/config.mk index 9dea2c5af3..a7d82684e4 100644 --- a/source4/utils/config.mk +++ b/source4/utils/config.mk @@ -4,8 +4,6 @@ # Start BINARY ntlm_auth [BINARY::ntlm_auth] INSTALLDIR = BINDIR -OBJ_FILES = \ - ntlm_auth.o PRIVATE_DEPENDENCIES = \ LIBSAMBA-HOSTCONFIG \ LIBSAMBA-UTIL \ @@ -20,14 +18,14 @@ PRIVATE_DEPENDENCIES = \ # End BINARY ntlm_auth ################################# +ntlm_auth_OBJ_FILES = utils/ntlm_auth.o + MANPAGES += utils/man/ntlm_auth.1 ################################# # Start BINARY getntacl [BINARY::getntacl] INSTALLDIR = BINDIR -OBJ_FILES = \ - getntacl.o PRIVATE_DEPENDENCIES = \ LIBSAMBA-HOSTCONFIG \ LIBSAMBA-UTIL \ @@ -35,6 +33,8 @@ PRIVATE_DEPENDENCIES = \ WRAP_XATTR \ LIBSAMBA-ERRORS +getntacl_OBJ_FILES = utils/getntacl.o + # End BINARY getntacl ################################# @@ -45,27 +45,25 @@ MANPAGES += utils/man/getntacl.1 [BINARY::setntacl] # disabled until rewritten #INSTALLDIR = BINDIR -OBJ_FILES = \ - setntacl.o # End BINARY setntacl ################################# +setntacl_OBJ_FILES = utils/setntacl.o + ################################# # Start BINARY setnttoken [BINARY::setnttoken] INSTALLDIR = BINDIR -OBJ_FILES = \ - setnttoken.o PRIVATE_DEPENDENCIES = # End BINARY setnttoken ################################# +setnttoken_OBJ_FILES = utils/setnttoken.o + ################################# # Start BINARY nmblookup [BINARY::nmblookup] INSTALLDIR = BINDIR -OBJ_FILES = \ - nmblookup.o PRIVATE_DEPENDENCIES = \ LIBSAMBA-HOSTCONFIG \ LIBSAMBA-UTIL \ @@ -77,12 +75,12 @@ PRIVATE_DEPENDENCIES = \ # End BINARY nmblookup ################################# +nmblookup_OBJ_FILES = utils/nmblookup.o + ################################# # Start BINARY testparm [BINARY::testparm] INSTALLDIR = BINDIR -OBJ_FILES = \ - testparm.o PRIVATE_DEPENDENCIES = \ LIBSAMBA-HOSTCONFIG \ LIBSAMBA-UTIL \ @@ -93,3 +91,5 @@ PRIVATE_DEPENDENCIES = \ CHARSET # End BINARY testparm ################################# + +testparm_OBJ_FILES = utils/testparm.o diff --git a/source4/utils/net/config.mk b/source4/utils/net/config.mk index ced0710ae0..4423c44c15 100644 --- a/source4/utils/net/config.mk +++ b/source4/utils/net/config.mk @@ -5,13 +5,6 @@ [BINARY::net] INSTALLDIR = BINDIR PRIVATE_PROTO_HEADER = net_proto.h -OBJ_FILES = \ - net.o \ - net_password.o \ - net_time.o \ - net_join.o \ - net_vampire.o \ - net_user.o PRIVATE_DEPENDENCIES = \ LIBSAMBA-HOSTCONFIG \ LIBSAMBA-UTIL \ @@ -21,3 +14,12 @@ PRIVATE_DEPENDENCIES = \ POPT_CREDENTIALS # End BINARY net ################################# + +net_OBJ_FILES = $(addprefix utils/net/, \ + net.o \ + net_password.o \ + net_time.o \ + net_join.o \ + net_vampire.o \ + net_user.o) + diff --git a/source4/web_server/config.mk b/source4/web_server/config.mk index 7f38b085f2..e218aa8ddc 100644 --- a/source4/web_server/config.mk +++ b/source4/web_server/config.mk @@ -6,9 +6,8 @@ INIT_FUNCTION = server_service_web_init SUBSYSTEM = service PRIVATE_PROTO_HEADER = proto.h -OBJ_FILES = \ - web_server.o \ - http.o PRIVATE_DEPENDENCIES = ESP LIBTLS smbcalls process_model # End SUBSYSTEM WEB ####################### + +WEB_OBJ_FILES = $(addprefix web_server/, web_server.o http.o) diff --git a/source4/winbind/config.mk b/source4/winbind/config.mk index 8c9b3f1225..3165fc2d21 100644 --- a/source4/winbind/config.mk +++ b/source4/winbind/config.mk @@ -6,7 +6,19 @@ INIT_FUNCTION = server_service_winbind_init SUBSYSTEM = service PRIVATE_PROTO_HEADER = wb_proto.h -OBJ_FILES = \ +PRIVATE_DEPENDENCIES = \ + WB_HELPER \ + IDMAP \ + NDR_WINBIND \ + process_model \ + RPC_NDR_LSA \ + dcerpc_samr \ + PAM_ERRORS \ + LIBCLI_LDAP +# End SUBSYSTEM WINBIND +####################### + +WINBIND_OBJ_FILES = $(addprefix winbind/, \ wb_server.o \ wb_irpc.o \ wb_samba3_protocol.o \ @@ -36,36 +48,24 @@ OBJ_FILES = \ wb_cmd_setpwent.o \ wb_cmd_getpwent.o \ wb_pam_auth.o \ - wb_sam_logon.o -PRIVATE_DEPENDENCIES = \ - WB_HELPER \ - IDMAP \ - NDR_WINBIND \ - process_model \ - RPC_NDR_LSA \ - dcerpc_samr \ - PAM_ERRORS \ - LIBCLI_LDAP -# End SUBSYSTEM WINBIND -####################### + wb_sam_logon.o) ################################################ # Start SUBYSTEM WB_HELPER [SUBSYSTEM::WB_HELPER] PRIVATE_PROTO_HEADER = wb_helper.h -OBJ_FILES = \ - wb_async_helpers.o \ - wb_utils.o PUBLIC_DEPENDENCIES = RPC_NDR_LSA dcerpc_samr # End SUBSYSTEM WB_HELPER ################################################ +WB_HELPER_OBJ_FILES = $(addprefix winbind/, wb_async_helpers.o wb_utils.o) + ################################################ # Start SUBYSTEM IDMAP [SUBSYSTEM::IDMAP] PRIVATE_PROTO_HEADER = idmap_proto.h -OBJ_FILES = \ - idmap.o PUBLIC_DEPENDENCIES = SAMDB_COMMON # End SUBSYSTEM IDMAP ################################################ + +IDMAP_OBJ_FILES = winbind/idmap.o diff --git a/source4/wrepl_server/config.mk b/source4/wrepl_server/config.mk index a2a6a72fe3..e339d223aa 100644 --- a/source4/wrepl_server/config.mk +++ b/source4/wrepl_server/config.mk @@ -5,7 +5,13 @@ [MODULE::WREPL_SRV] INIT_FUNCTION = server_service_wrepl_init SUBSYSTEM = service -OBJ_FILES = \ +PRIVATE_PROTO_HEADER = wrepl_server_proto.h +PRIVATE_DEPENDENCIES = \ + LIBCLI_WREPL WINSDB process_model +# End SUBSYSTEM WREPL_SRV +####################### + +WREPL_SRV_OBJ_FILES = $(addprefix wrepl_server/, \ wrepl_server.o \ wrepl_in_connection.o \ wrepl_in_call.o \ @@ -14,9 +20,5 @@ OBJ_FILES = \ wrepl_scavenging.o \ wrepl_out_pull.o \ wrepl_out_push.o \ - wrepl_out_helpers.o -PRIVATE_PROTO_HEADER = wrepl_server_proto.h -PRIVATE_DEPENDENCIES = \ - LIBCLI_WREPL WINSDB process_model -# End SUBSYSTEM WREPL_SRV -####################### + wrepl_out_helpers.o) + -- cgit From 0fa663cc5dcbcf6a35f6d245881a5edff1a87108 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 14 Apr 2008 17:54:19 +0200 Subject: Fix order of variables in the makefile. (This used to be commit f64c1d53ba50bb50d32f819adf8727513468ccd7) --- source4/build/smb_build/main.pl | 11 +++++-- source4/build/smb_build/makefile.pm | 20 +++++++----- source4/build/smb_build/output.pm | 61 ++++++------------------------------- 3 files changed, 30 insertions(+), 62 deletions(-) diff --git a/source4/build/smb_build/main.pl b/source4/build/smb_build/main.pl index c3dc46461b..0e42155537 100644 --- a/source4/build/smb_build/main.pl +++ b/source4/build/smb_build/main.pl @@ -52,7 +52,7 @@ foreach my $key (values %$OUTPUT) { next unless defined $key->{OUTPUT_TYPE}; $mkenv->MergedObj($key) if grep(/MERGED_OBJ/, @{$key->{OUTPUT_TYPE}}); - $mkenv->StaticLibrary($key) if grep(/STATIC_LIBRARY/, @{$key->{OUTPUT_TYPE}}); + $mkenv->StaticLibraryPrimitives($key) if grep(/STATIC_LIBRARY/, @{$key->{OUTPUT_TYPE}}); if (defined($key->{PC_FILE})) { $mkenv->output("PC_FILES += $key->{BASEDIR}/$key->{PC_FILE}\n"); } @@ -66,19 +66,26 @@ foreach my $key (values %$OUTPUT) { $key->{TYPE} eq "PYTHON") and grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}}); $mkenv->PythonFiles($key) if defined($key->{PYTHON_FILES}); - $mkenv->ProtoHeader($key) if defined($key->{PRIVATE_PROTO_HEADER}); $mkenv->CFlags($key); } foreach my $key (values %$OUTPUT) { next unless defined $key->{OUTPUT_TYPE}; + $mkenv->Integrated($key) if grep(/INTEGRATED/, @{$key->{OUTPUT_TYPE}}); +} + +foreach my $key (values %$OUTPUT) { + next unless defined $key->{OUTPUT_TYPE}; + $mkenv->StaticLibrary($key) if grep(/STATIC_LIBRARY/, @{$key->{OUTPUT_TYPE}}); + $mkenv->SharedLibrary($key) if ($key->{TYPE} eq "LIBRARY") and grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}}); $mkenv->SharedModule($key) if ($key->{TYPE} eq "MODULE" or $key->{TYPE} eq "PYTHON") and grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}}); $mkenv->Binary($key) if grep(/BINARY/, @{$key->{OUTPUT_TYPE}}); + $mkenv->ProtoHeader($key) if defined($key->{PRIVATE_PROTO_HEADER}); } $mkenv->write("data.mk"); diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm index 2470fa1459..7728bc4f8d 100644 --- a/source4/build/smb_build/makefile.pm +++ b/source4/build/smb_build/makefile.pm @@ -23,12 +23,11 @@ sub new($$$) $self->{output} = ""; - $self->{mkfile} = $mkfile; - $self->output("################################################\n"); $self->output("# Autogenerated by build/smb_build/makefile.pm #\n"); $self->output("################################################\n"); $self->output("\n"); + $self->output($mkfile); return $self; } @@ -203,6 +202,14 @@ __EOD__ $self->output("\n"); } +sub StaticLibraryPrimitives($$) +{ + my ($self,$ctx) = @_; + + $self->output("$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n"); + $self->_prepare_list($ctx, "FULL_OBJ_LIST"); +} + sub SharedLibraryPrimitives($$) { my ($self,$ctx) = @_; @@ -273,9 +280,6 @@ sub StaticLibrary($$) $self->output("STATIC_LIBS += $ctx->{TARGET_STATIC_LIBRARY}\n") if ($ctx->{TYPE} eq "LIBRARY"); - $self->output("$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n"); - $self->_prepare_list($ctx, "FULL_OBJ_LIST"); - $self->output("$ctx->{RESULT_STATIC_LIBRARY}: \$($ctx->{NAME}_FULL_OBJ_LIST)\n"); } @@ -324,9 +328,9 @@ sub PythonFiles($$) foreach (@{$ctx->{PYTHON_FILES}}) { my $target = "bin/python/".basename($_); - my $source = output::add_dir_str($ctx->{BASEDIR}, $_); + my $source = "\$(addprefix $ctx->{BASEDIR}/, $target)"; $self->output("$target: $source\n\n"); - $self->output("PYTHON_PYS += $target\n"); + $self->output("PYTHON_PYS += $source\n"); } } @@ -334,7 +338,7 @@ sub ProtoHeader($$) { my ($self,$ctx) = @_; - my $priv = output::add_dir_str($ctx->{BASEDIR}, $ctx->{PRIVATE_PROTO_HEADER}); + my $priv = "\$(addprefix $ctx->{BASEDIR}/, $ctx->{PRIVATE_PROTO_HEADER})"; $self->output("PROTO_HEADERS += $priv\n"); $self->output("$priv: $ctx->{MK_FILE} \$($ctx->{NAME}_OBJ_LIST:.o=.c) \$(srcdir)/script/mkproto.pl\n"); diff --git a/source4/build/smb_build/output.pm b/source4/build/smb_build/output.pm index 4ae4a62cf4..aeff7d48ce 100644 --- a/source4/build/smb_build/output.pm +++ b/source4/build/smb_build/output.pm @@ -7,39 +7,6 @@ package output; use strict; -use smb_build::config; - -sub add_dir_str($$) -{ - my ($dir,$file) = @_; - my $dirsep = "/"; - - $dir =~ s/^\.$//g; - $dir =~ s/^\.\///g; - - $dirsep = "" if ($dir eq ""); - - my $ret = $file; - if (substr($ret, 0, 1) ne "\$") { - $ret = "$dir$dirsep$file"; - $ret =~ s/([^\/\.]+)\/\.\.\///g; - $ret =~ s/([^\/\.]+)\/\.\.\///g; - } - - return $ret; -} - -sub add_dir_array($$) -{ - my ($dir,$files) = @_; - my @ret = (); - - foreach (@{$files}) { - push (@ret, add_dir_str($dir, $_)); - } - - return @ret; -} sub generate_shared_library($) { @@ -80,10 +47,8 @@ sub generate_shared_library($) $lib->{LIBRARY_DEBUGNAME} = $lib->{LIBRARY_REALNAME}; - if (defined($lib->{VERSION}) and $config::config{SONAMEFLAG} ne "#") { - $lib->{LIBRARY_SONAME} = "$lib->{LIBRARY_REALNAME}.\$($lib->{NAME}_SOVERSION)"; - $lib->{LIBRARY_REALNAME} = "$lib->{LIBRARY_REALNAME}.\$($lib->{NAME}_VERSION)"; - } + $lib->{LIBRARY_SONAME} = "\$(if \$($lib->{NAME}_SOVERSION),$lib->{LIBRARY_REALNAME}.\$($lib->{NAME}_SOVERSION),$lib->{LIBRARY_REALNAME})"; + $lib->{LIBRARY_REALNAME} = "\$(if \$($lib->{NAME}_VERSION),$lib->{LIBRARY_REALNAME}.\$($lib->{NAME}_VERSION),$lib->{LIBRARY_REALNAME})"; $lib->{RESULT_SHARED_LIBRARY} = "$lib->{SHAREDDIR}/$lib->{LIBRARY_REALNAME}"; $lib->{OUTPUT_SHARED_LIBRARY} = "-l$link_name"; @@ -97,11 +62,9 @@ sub generate_merged_obj($) my $link_name = $lib->{NAME}; $link_name =~ s/^LIB//; - if (defined($lib->{OBJ_FILES})) { - $lib->{MERGED_OBJNAME} = lc($link_name).".o"; - $lib->{RESULT_MERGED_OBJ} = $lib->{OUTPUT_MERGED_OBJ} = "bin/mergedobj/$lib->{MERGED_OBJNAME}"; - $lib->{TARGET_MERGED_OBJ} = $lib->{RESULT_MERGED_OBJ}; - } + $lib->{MERGED_OBJNAME} = lc($link_name).".o"; + $lib->{RESULT_MERGED_OBJ} = $lib->{OUTPUT_MERGED_OBJ} = "bin/mergedobj/$lib->{MERGED_OBJNAME}"; + $lib->{TARGET_MERGED_OBJ} = $lib->{RESULT_MERGED_OBJ}; } sub generate_static_library($) @@ -116,12 +79,10 @@ sub generate_static_library($) $lib->{LIBRARY_NAME} = "lib".lc($link_name).".a"; - if (defined($lib->{OBJ_FILES})) { - $lib->{RESULT_STATIC_LIBRARY} = "bin/static/$lib->{LIBRARY_NAME}"; - $lib->{TARGET_STATIC_LIBRARY} = $lib->{RESULT_STATIC_LIBRARY}; - $lib->{STATICDIR} = 'bin/static'; - $lib->{OUTPUT_STATIC_LIBRARY} = "-l".lc($link_name); - } + $lib->{RESULT_STATIC_LIBRARY} = "bin/static/$lib->{LIBRARY_NAME}"; + $lib->{TARGET_STATIC_LIBRARY} = $lib->{RESULT_STATIC_LIBRARY}; + $lib->{STATICDIR} = 'bin/static'; + $lib->{OUTPUT_STATIC_LIBRARY} = "-l".lc($link_name); } sub generate_binary($) @@ -160,10 +121,6 @@ sub create_output($$) foreach $part (values %{$depend}) { next unless(defined($part->{OUTPUT_TYPE})); - # Combine object lists - my @list = add_dir_array($part->{BASEDIR}, $part->{OBJ_FILES}); - push(@{$part->{OBJ_LIST}}, @list) if defined($part->{OBJ_FILES}); - generate_binary($part) if grep(/BINARY/, @{$part->{OUTPUT_TYPE}}); generate_shared_library($part) if grep(/SHARED_LIBRARY/, @{$part->{OUTPUT_TYPE}}); generate_static_library($part) if grep(/STATIC_LIBRARY/, @{$part->{OUTPUT_TYPE}}); -- cgit From b54e6a815514ef1e5a0a5d11ca43f85e0366b8dc Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 14 Apr 2008 17:58:09 +0200 Subject: Ensure we initialise s->lp_ctx for the way into the provision. Andrew Bartlett (This used to be commit b191a1953c24545e9dc1869fc33cb29343d4e3f2) --- source4/libnet/libnet_vampire.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source4/libnet/libnet_vampire.c b/source4/libnet/libnet_vampire.c index 9d32088fe6..1cc63a3fb0 100644 --- a/source4/libnet/libnet_vampire.c +++ b/source4/libnet/libnet_vampire.c @@ -586,6 +586,8 @@ NTSTATUS libnet_Vampire(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, return NT_STATUS_NO_MEMORY; } + s->lp_ctx = ctx->lp_ctx; + join = talloc_zero(s, struct libnet_JoinDomain); if (!join) { return NT_STATUS_NO_MEMORY; -- cgit From 02f3695897dddb013fc1268a4f1a852cd4a3465e Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 14 Apr 2008 18:30:07 +0200 Subject: Add convenience TestCase class for testing RPC interfaces. (This used to be commit 2f19f981449bf6f4d29f231259817c8b66104a9b) --- source4/scripting/python/samba/tests/__init__.py | 7 +++++++ source4/scripting/python/samba/tests/dcerpc/registry.py | 9 ++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/source4/scripting/python/samba/tests/__init__.py b/source4/scripting/python/samba/tests/__init__.py index c8673d3fae..ceb7dd23f3 100644 --- a/source4/scripting/python/samba/tests/__init__.py +++ b/source4/scripting/python/samba/tests/__init__.py @@ -90,3 +90,10 @@ def get_loadparm(): lp = param.LoadParm() lp.load(os.getenv("SMB_CONF_PATH")) return lp + +class RpcInterfaceTestCase(unittest.TestCase): + def get_loadparm(self): + return get_loadparm() + + def get_credentials(self): + return None diff --git a/source4/scripting/python/samba/tests/dcerpc/registry.py b/source4/scripting/python/samba/tests/dcerpc/registry.py index 147acc5098..1afdc582a7 100644 --- a/source4/scripting/python/samba/tests/dcerpc/registry.py +++ b/source4/scripting/python/samba/tests/dcerpc/registry.py @@ -18,14 +18,13 @@ # import winreg -from param import LoadParm import unittest -from samba.tests import get_loadparm +from samba.tests import RpcInterfaceTestCase -class WinregTests(unittest.TestCase): +class WinregTests(RpcInterfaceTestCase): def setUp(self): - lp_ctx = get_loadparm() - self.conn = winreg.winreg("ncalrpc:", lp_ctx) + self.conn = winreg.winreg("ncalrpc:", self.get_loadparm(), + self.get_credentials()) def get_hklm(self): return self.conn.OpenHKLM(None, -- cgit From 292ed5d04f9b7442bf878c36be24a46fc0373d9c Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 14 Apr 2008 18:44:43 +0200 Subject: fixed an unitialised write warning in valgrind the 'reserved' field was not being initialised before being pushed to the wire (This used to be commit dfe4b5009885c4eeca24569f35b9fc85bfe6346b) --- source4/ntvfs/ntvfs_generic.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source4/ntvfs/ntvfs_generic.c b/source4/ntvfs/ntvfs_generic.c index fee3269eaf..01c3a16433 100644 --- a/source4/ntvfs/ntvfs_generic.c +++ b/source4/ntvfs/ntvfs_generic.c @@ -209,6 +209,7 @@ static NTSTATUS ntvfs_map_open_finish(struct ntvfs_module_context *ntvfs, case RAW_OPEN_SMB2: io->smb2.out.file.ntvfs = io2->generic.out.file.ntvfs; io->smb2.out.oplock_level = 0; + io->smb2.out.reserved = 0; io->smb2.out.create_action = io2->generic.out.create_action; io->smb2.out.create_time = io2->generic.out.create_time; io->smb2.out.access_time = io2->generic.out.access_time; -- cgit From 4f51b0246db3242ee02ee16905cba13a5dc5633a Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 14 Apr 2008 12:43:37 -0400 Subject: Fix problems with event context not being the parent. (This used to be commit 957c4d893acf9e6db06a3fc3a4687ab6bb238635) --- source4/libnet/libnet.c | 13 +++++-------- source4/libnet/py_net.c | 13 +++++++++---- source4/torture/libnet/libnet_domain.c | 11 +++++------ source4/torture/libnet/libnet_group.c | 6 +++--- source4/torture/libnet/libnet_lookup.c | 8 ++++---- source4/torture/libnet/libnet_rpc.c | 2 +- source4/torture/libnet/libnet_share.c | 4 ++-- source4/torture/libnet/libnet_user.c | 10 +++++----- source4/torture/rpc/dfs.c | 4 ++-- source4/torture/rpc/testjoin.c | 4 ++-- source4/torture/smbtorture.c | 4 +++- source4/torture/ui.c | 6 +++--- source4/torture/ui.h | 2 +- source4/torture/util_smb.c | 3 +-- source4/utils/net/net.c | 18 ++++++++++++------ source4/utils/net/net.h | 1 - source4/utils/net/net_join.c | 11 ++++++----- source4/utils/net/net_password.c | 19 ++++++++++--------- source4/utils/net/net_time.c | 5 +++-- source4/utils/net/net_user.c | 13 +++++++------ source4/utils/net/net_vampire.c | 11 ++++++----- 21 files changed, 90 insertions(+), 78 deletions(-) diff --git a/source4/libnet/libnet.c b/source4/libnet/libnet.c index d1605bc17d..c966898cee 100644 --- a/source4/libnet/libnet.c +++ b/source4/libnet/libnet.c @@ -28,20 +28,17 @@ struct libnet_context *libnet_context_init(struct event_context *ev, { struct libnet_context *ctx; + /* We require an event context here */ + if (!ev) { + return NULL; + } + /* create brand new libnet context */ ctx = talloc(ev, struct libnet_context); if (!ctx) { return NULL; } - /* events */ - if (ev == NULL) { - ev = event_context_find(ctx); - if (ev == NULL) { - talloc_free(ctx); - return NULL; - } - } ctx->event_ctx = ev; ctx->lp_ctx = lp_ctx; diff --git a/source4/libnet/py_net.c b/source4/libnet/py_net.c index 2fcbc5d156..cf81d8070d 100644 --- a/source4/libnet/py_net.c +++ b/source4/libnet/py_net.c @@ -22,11 +22,12 @@ #include "libnet.h" #include "param/param.h" #include "libcli/security/security.h" +#include "lib/events/events.h" -struct libnet_context *py_net_ctx(PyObject *obj) +struct libnet_context *py_net_ctx(PyObject *obj, struct event_context *ev) { /* FIXME: Use obj */ - return libnet_context_init(NULL, global_loadparm); + return libnet_context_init(ev, global_loadparm); } static PyObject *py_net_join(PyObject *cls, PyObject *args, PyObject *kwargs) @@ -35,6 +36,7 @@ static PyObject *py_net_join(PyObject *cls, PyObject *args, PyObject *kwargs) NTSTATUS status; PyObject *result; TALLOC_CTX *mem_ctx; + struct event_context *ev; struct libnet_context *libnet_ctx; const char *kwnames[] = { "domain_name", "netbios_name", "join_type", "level", NULL }; @@ -43,9 +45,12 @@ static PyObject *py_net_join(PyObject *cls, PyObject *args, PyObject *kwargs) &r.in.join_type, &r.in.level)) return NULL; - mem_ctx = talloc_new(NULL); + /* FIXME: we really need to get a context from the caller or we may end + * up with 2 event contexts */ + ev = event_context_init(NULL); + mem_ctx = talloc_new(ev); - libnet_ctx = py_net_ctx(cls); + libnet_ctx = py_net_ctx(cls, ev); status = libnet_Join(libnet_ctx, mem_ctx, &r); if (NT_STATUS_IS_ERR(status)) { diff --git a/source4/torture/libnet/libnet_domain.c b/source4/torture/libnet/libnet_domain.c index 3c8d574f0e..eb6abc45d5 100644 --- a/source4/torture/libnet/libnet_domain.c +++ b/source4/torture/libnet/libnet_domain.c @@ -136,7 +136,7 @@ bool torture_domain_open_lsa(struct torture_context *torture) of specific server name. */ domain_name = lp_workgroup(torture->lp_ctx); - ctx = libnet_context_init(NULL, torture->lp_ctx); + ctx = libnet_context_init(torture->ev, torture->lp_ctx); if (ctx == NULL) { d_printf("failed to create libnet context\n"); return false; @@ -190,7 +190,7 @@ bool torture_domain_close_lsa(struct torture_context *torture) return false; } - ctx = libnet_context_init(NULL, torture->lp_ctx); + ctx = libnet_context_init(torture->ev, torture->lp_ctx); if (ctx == NULL) { d_printf("failed to create libnet context\n"); ret = false; @@ -245,7 +245,6 @@ bool torture_domain_open_samr(struct torture_context *torture) { NTSTATUS status; struct libnet_context *ctx; - struct event_context *evt_ctx=NULL; TALLOC_CTX *mem_ctx; struct policy_handle domain_handle, handle; struct libnet_DomainOpen io; @@ -255,7 +254,7 @@ bool torture_domain_open_samr(struct torture_context *torture) mem_ctx = talloc_init("test_domainopen_lsa"); - ctx = libnet_context_init(evt_ctx, torture->lp_ctx); + ctx = libnet_context_init(torture->ev, torture->lp_ctx); ctx->cred = cmdline_credentials; /* we're accessing domain controller so the domain name should be @@ -320,7 +319,7 @@ bool torture_domain_close_samr(struct torture_context *torture) return false; } - ctx = libnet_context_init(NULL, torture->lp_ctx); + ctx = libnet_context_init(torture->ev, torture->lp_ctx); if (ctx == NULL) { d_printf("failed to create libnet context\n"); ret = false; @@ -388,7 +387,7 @@ bool torture_domain_list(struct torture_context *torture) return false; } - ctx = libnet_context_init(NULL, torture->lp_ctx); + ctx = libnet_context_init(torture->ev, torture->lp_ctx); if (ctx == NULL) { d_printf("failed to create libnet context\n"); ret = false; diff --git a/source4/torture/libnet/libnet_group.c b/source4/torture/libnet/libnet_group.c index cabccdbe66..12b8167a86 100644 --- a/source4/torture/libnet/libnet_group.c +++ b/source4/torture/libnet/libnet_group.c @@ -235,7 +235,7 @@ bool torture_groupinfo_api(struct torture_context *torture) prep_mem_ctx = talloc_init("prepare torture group info"); - ctx = libnet_context_init(NULL, torture->lp_ctx); + ctx = libnet_context_init(torture->ev, torture->lp_ctx); ctx->cred = cmdline_credentials; status = torture_rpc_connection(torture, @@ -300,7 +300,7 @@ bool torture_grouplist(struct torture_context *torture) struct libnet_GroupList req; int i; - ctx = libnet_context_init(NULL, torture->lp_ctx); + ctx = libnet_context_init(torture->ev, torture->lp_ctx); ctx->cred = cmdline_credentials; domain_name.string = lp_workgroup(torture->lp_ctx); @@ -361,7 +361,7 @@ bool torture_creategroup(struct torture_context *torture) mem_ctx = talloc_init("test_creategroup"); - ctx = libnet_context_init(NULL, torture->lp_ctx); + ctx = libnet_context_init(torture->ev, torture->lp_ctx); ctx->cred = cmdline_credentials; req.in.group_name = TEST_GROUPNAME; diff --git a/source4/torture/libnet/libnet_lookup.c b/source4/torture/libnet/libnet_lookup.c index 9167d1de3e..b25b51b7d9 100644 --- a/source4/torture/libnet/libnet_lookup.c +++ b/source4/torture/libnet/libnet_lookup.c @@ -40,7 +40,7 @@ bool torture_lookup(struct torture_context *torture) mem_ctx = talloc_init("test_lookup"); - ctx = libnet_context_init(NULL, torture->lp_ctx); + ctx = libnet_context_init(torture->ev, torture->lp_ctx); ctx->cred = cmdline_credentials; lookup.in.hostname = torture_setting_string(torture, "host", NULL); @@ -84,7 +84,7 @@ bool torture_lookup_host(struct torture_context *torture) mem_ctx = talloc_init("test_lookup_host"); - ctx = libnet_context_init(NULL, torture->lp_ctx); + ctx = libnet_context_init(torture->ev, torture->lp_ctx); ctx->cred = cmdline_credentials; lookup.in.hostname = torture_setting_string(torture, "host", NULL); @@ -127,7 +127,7 @@ bool torture_lookup_pdc(struct torture_context *torture) mem_ctx = talloc_init("test_lookup_pdc"); - ctx = libnet_context_init(NULL, torture->lp_ctx); + ctx = libnet_context_init(torture->ev, torture->lp_ctx); ctx->cred = cmdline_credentials; talloc_steal(ctx, mem_ctx); @@ -171,7 +171,7 @@ bool torture_lookup_sam_name(struct torture_context *torture) struct libnet_context *ctx; struct libnet_LookupName r; - ctx = libnet_context_init(NULL, torture->lp_ctx); + ctx = libnet_context_init(torture->ev, torture->lp_ctx); ctx->cred = cmdline_credentials; mem_ctx = talloc_init("torture lookup sam name"); diff --git a/source4/torture/libnet/libnet_rpc.c b/source4/torture/libnet/libnet_rpc.c index 282837d3fe..f25c1ecc48 100644 --- a/source4/torture/libnet/libnet_rpc.c +++ b/source4/torture/libnet/libnet_rpc.c @@ -89,7 +89,7 @@ static bool torture_rpc_connect(struct torture_context *torture, { struct libnet_context *ctx; - ctx = libnet_context_init(NULL, torture->lp_ctx); + ctx = libnet_context_init(torture->ev, torture->lp_ctx); ctx->cred = cmdline_credentials; d_printf("Testing connection to LSA interface\n"); diff --git a/source4/torture/libnet/libnet_share.c b/source4/torture/libnet/libnet_share.c index eb1edff18d..6bc5be40a6 100644 --- a/source4/torture/libnet/libnet_share.c +++ b/source4/torture/libnet/libnet_share.c @@ -131,7 +131,7 @@ bool torture_listshares(struct torture_context *torture) goto done; } - libnetctx = libnet_context_init(NULL, torture->lp_ctx); + libnetctx = libnet_context_init(torture->ev, torture->lp_ctx); if (!libnetctx) { printf("Couldn't allocate libnet context\n"); ret = false; @@ -210,7 +210,7 @@ bool torture_delshare(struct torture_context *torture) status = torture_rpc_binding(torture, &binding); torture_assert_ntstatus_ok(torture, status, "Failed to get binding"); - libnetctx = libnet_context_init(NULL, torture->lp_ctx); + libnetctx = libnet_context_init(torture->ev, torture->lp_ctx); libnetctx->cred = cmdline_credentials; status = torture_rpc_connection(torture, diff --git a/source4/torture/libnet/libnet_user.c b/source4/torture/libnet/libnet_user.c index 5446087034..15e3f03506 100644 --- a/source4/torture/libnet/libnet_user.c +++ b/source4/torture/libnet/libnet_user.c @@ -241,7 +241,7 @@ bool torture_createuser(struct torture_context *torture) mem_ctx = talloc_init("test_createuser"); - ctx = libnet_context_init(NULL, torture->lp_ctx); + ctx = libnet_context_init(torture->ev, torture->lp_ctx); ctx->cred = cmdline_credentials; req.in.user_name = TEST_USERNAME; @@ -287,7 +287,7 @@ bool torture_deleteuser(struct torture_context *torture) prep_mem_ctx = talloc_init("prepare test_deleteuser"); - ctx = libnet_context_init(NULL, torture->lp_ctx); + ctx = libnet_context_init(torture->ev, torture->lp_ctx); ctx->cred = cmdline_credentials; req.in.user_name = TEST_USERNAME; @@ -482,7 +482,7 @@ bool torture_modifyuser(struct torture_context *torture) prep_mem_ctx = talloc_init("prepare test_deleteuser"); - ctx = libnet_context_init(NULL, torture->lp_ctx); + ctx = libnet_context_init(torture->ev, torture->lp_ctx); ctx->cred = cmdline_credentials; status = torture_rpc_connection(torture, @@ -616,7 +616,7 @@ bool torture_userinfo_api(struct torture_context *torture) prep_mem_ctx = talloc_init("prepare torture user info"); - ctx = libnet_context_init(NULL, torture->lp_ctx); + ctx = libnet_context_init(torture->ev, torture->lp_ctx); ctx->cred = cmdline_credentials; status = torture_rpc_connection(torture, @@ -681,7 +681,7 @@ bool torture_userlist(struct torture_context *torture) struct libnet_UserList req; int i; - ctx = libnet_context_init(NULL, torture->lp_ctx); + ctx = libnet_context_init(torture->ev, torture->lp_ctx); ctx->cred = cmdline_credentials; domain_name.string = lp_workgroup(torture->lp_ctx); diff --git a/source4/torture/rpc/dfs.c b/source4/torture/rpc/dfs.c index 9cfdd80578..5656476922 100644 --- a/source4/torture/rpc/dfs.c +++ b/source4/torture/rpc/dfs.c @@ -56,7 +56,7 @@ static bool test_NetShareAdd(TALLOC_CTX *mem_ctx, printf("Creating share %s\n", sharename); - if (!(libnetctx = libnet_context_init(NULL, tctx->lp_ctx))) { + if (!(libnetctx = libnet_context_init(tctx->ev, tctx->lp_ctx))) { return false; } @@ -96,7 +96,7 @@ static bool test_NetShareDel(TALLOC_CTX *mem_ctx, printf("Deleting share %s\n", sharename); - if (!(libnetctx = libnet_context_init(NULL, tctx->lp_ctx))) { + if (!(libnetctx = libnet_context_init(tctx->ev, tctx->lp_ctx))) { return false; } diff --git a/source4/torture/rpc/testjoin.c b/source4/torture/rpc/testjoin.c index 892886c08c..100e7cead2 100644 --- a/source4/torture/rpc/testjoin.c +++ b/source4/torture/rpc/testjoin.c @@ -311,7 +311,7 @@ _PUBLIC_ struct test_join *torture_join_domain(struct torture_context *tctx, struct samr_SetUserInfo s; union samr_UserInfo u; - tj = talloc(NULL, struct test_join); + tj = talloc(tctx, struct test_join); if (!tj) return NULL; libnet_r = talloc(tj, struct libnet_JoinDomain); @@ -320,7 +320,7 @@ _PUBLIC_ struct test_join *torture_join_domain(struct torture_context *tctx, return NULL; } - libnet_ctx = libnet_context_init(NULL, tctx->lp_ctx); + libnet_ctx = libnet_context_init(tctx->ev, tctx->lp_ctx); if (!libnet_ctx) { talloc_free(tj); return NULL; diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c index 4eeea73003..faae784e4b 100644 --- a/source4/torture/smbtorture.c +++ b/source4/torture/smbtorture.c @@ -36,6 +36,8 @@ #include "librpc/rpc/dcerpc.h" #include "param/param.h" +#include "auth/credentials/credentials.h" + static bool run_matching(struct torture_context *torture, const char *prefix, const char *expr, @@ -673,7 +675,7 @@ int main(int argc,char *argv[]) exit(1); } - torture = torture_context_init(talloc_autofree_context(), ui_ops); + torture = torture_context_init(cli_credentials_get_event_context(cmdline_credentials), ui_ops); if (basedir != NULL) { if (basedir[0] != '/') { fprintf(stderr, "Please specify an absolute path to --basedir\n"); diff --git a/source4/torture/ui.c b/source4/torture/ui.c index a7025aac95..efa584ebea 100644 --- a/source4/torture/ui.c +++ b/source4/torture/ui.c @@ -27,14 +27,14 @@ #include "auth/credentials/credentials.h" #include "lib/cmdline/popt_common.h" -struct torture_context *torture_context_init(TALLOC_CTX *mem_ctx, +struct torture_context *torture_context_init(struct event_context *event_ctx, const struct torture_ui_ops *ui_ops) { - struct torture_context *torture = talloc_zero(mem_ctx, + struct torture_context *torture = talloc_zero(event_ctx, struct torture_context); torture->ui_ops = ui_ops; torture->returncode = true; - torture->ev = cli_credentials_get_event_context(cmdline_credentials); + torture->ev = event_ctx; if (ui_ops->init) ui_ops->init(torture); diff --git a/source4/torture/ui.h b/source4/torture/ui.h index ec4a658d74..15b04c2397 100644 --- a/source4/torture/ui.h +++ b/source4/torture/ui.h @@ -390,7 +390,7 @@ bool torture_suite_init_tcase(struct torture_suite *suite, struct torture_tcase *tcase, const char *name); -struct torture_context *torture_context_init(TALLOC_CTX *mem_ctx, +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/torture/util_smb.c b/source4/torture/util_smb.c index 513070500e..c1a20094f3 100644 --- a/source4/torture/util_smb.c +++ b/source4/torture/util_smb.c @@ -553,8 +553,7 @@ _PUBLIC_ bool torture_open_connection_ev(struct smbcli_state **c, _PUBLIC_ bool torture_open_connection(struct smbcli_state **c, struct torture_context *tctx, int conn_index) { - return torture_open_connection_ev(c, conn_index, tctx, - cli_credentials_get_event_context(cmdline_credentials)); + return torture_open_connection_ev(c, conn_index, tctx, tctx->ev); } diff --git a/source4/utils/net/net.c b/source4/utils/net/net.c index c908ea6279..6086a4ce32 100644 --- a/source4/utils/net/net.c +++ b/source4/utils/net/net.c @@ -46,6 +46,8 @@ #include "lib/ldb/include/ldb.h" #include "librpc/rpc/dcerpc.h" #include "param/param.h" +#include "lib/events/events.h" +#include "auth/credentials/credentials.h" /* run a function from a function table. If not found then @@ -140,7 +142,7 @@ static int binary_net(int argc, const char **argv) int rc; int argc_new; const char **argv_new; - TALLOC_CTX *mem_ctx; + struct event_context *ev; struct net_context *ctx = NULL; poptContext pc; struct poptOption long_options[] = { @@ -183,17 +185,21 @@ static int binary_net(int argc, const char **argv) dcerpc_init(); - mem_ctx = talloc_init("net_context"); - ctx = talloc(mem_ctx, struct net_context); + ev = event_context_init(NULL); + if (!ev) { + d_printf("Failed to create an event context\n"); + exit(1); + } + ctx = talloc(ev, struct net_context); if (!ctx) { - d_printf("talloc_init(net_context) failed\n"); + d_printf("Failed to talloc a net_context\n"); exit(1); } ZERO_STRUCTP(ctx); - ctx->mem_ctx = mem_ctx; ctx->lp_ctx = cmdline_lp_ctx; ctx->credentials = cmdline_credentials; + cli_credentials_set_event_context(ctx->credentials, ev); rc = net_run_function(ctx, argc_new-1, argv_new+1, net_functable, net_usage); @@ -201,7 +207,7 @@ static int binary_net(int argc, const char **argv) DEBUG(0,("return code = %d\n", rc)); } - talloc_free(mem_ctx); + talloc_free(ev); return rc; } diff --git a/source4/utils/net/net.h b/source4/utils/net/net.h index 8c4fbd7fdd..17388079dd 100644 --- a/source4/utils/net/net.h +++ b/source4/utils/net/net.h @@ -22,7 +22,6 @@ #define _UTIL_NET_H struct net_context { - TALLOC_CTX *mem_ctx; struct cli_credentials *credentials; struct loadparm_context *lp_ctx; }; diff --git a/source4/utils/net/net_join.c b/source4/utils/net/net_join.c index abdcbf6027..2102257c6c 100644 --- a/source4/utils/net/net_join.c +++ b/source4/utils/net/net_join.c @@ -24,6 +24,7 @@ #include "libnet/libnet.h" #include "libcli/security/security.h" #include "param/param.h" +#include "lib/events/events.h" int net_join(struct net_context *ctx, int argc, const char **argv) { @@ -38,10 +39,10 @@ int net_join(struct net_context *ctx, int argc, const char **argv) case 0: /* no args -> fail */ return net_join_usage(ctx, argc, argv); case 1: /* only DOMAIN */ - tmp = talloc_strdup(ctx->mem_ctx, argv[0]); + tmp = talloc_strdup(ctx, argv[0]); break; case 2: /* DOMAIN and role */ - tmp = talloc_strdup(ctx->mem_ctx, argv[0]); + tmp = talloc_strdup(ctx, argv[0]); if (strcasecmp(argv[1], "BDC") == 0) { secure_channel_type = SEC_CHAN_BDC; } else if (strcasecmp(argv[1], "MEMBER") == 0) { @@ -57,12 +58,12 @@ int net_join(struct net_context *ctx, int argc, const char **argv) domain_name = tmp; - libnetctx = libnet_context_init(NULL, ctx->lp_ctx); + libnetctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx); if (!libnetctx) { return -1; } libnetctx->cred = ctx->credentials; - r = talloc(ctx->mem_ctx, struct libnet_Join); + r = talloc(ctx, struct libnet_Join); if (!r) { return -1; } @@ -83,7 +84,7 @@ int net_join(struct net_context *ctx, int argc, const char **argv) talloc_free(libnetctx); return -1; } - d_printf("Joined domain %s (%s)\n", r->out.domain_name, dom_sid_string(ctx->mem_ctx, r->out.domain_sid)); + d_printf("Joined domain %s (%s)\n", r->out.domain_name, dom_sid_string(ctx, r->out.domain_sid)); talloc_free(libnetctx); return 0; diff --git a/source4/utils/net/net_password.c b/source4/utils/net/net_password.c index 1fcb772e4c..97bb467fac 100644 --- a/source4/utils/net/net_password.c +++ b/source4/utils/net/net_password.c @@ -22,6 +22,7 @@ #include "utils/net/net.h" #include "libnet/libnet.h" #include "system/filesys.h" +#include "lib/events/events.h" #include "auth/credentials/credentials.h" /* @@ -46,13 +47,13 @@ static int net_password_change(struct net_context *ctx, int argc, const char **a if (argc > 0 && argv[0]) { new_password = argv[0]; } else { - password_prompt = talloc_asprintf(ctx->mem_ctx, "Enter new password for account [%s\\%s]:", + password_prompt = talloc_asprintf(ctx, "Enter new password for account [%s\\%s]:", cli_credentials_get_domain(ctx->credentials), cli_credentials_get_username(ctx->credentials)); new_password = getpass(password_prompt); } - libnetctx = libnet_context_init(NULL, ctx->lp_ctx); + libnetctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx); if (!libnetctx) { return -1; } @@ -66,7 +67,7 @@ static int net_password_change(struct net_context *ctx, int argc, const char **a r.generic.in.newpassword = new_password; /* do password change */ - status = libnet_ChangePassword(libnetctx, ctx->mem_ctx, &r); + status = libnet_ChangePassword(libnetctx, ctx, &r); if (!NT_STATUS_IS_OK(status)) { DEBUG(0,("net_password_change: %s\n",r.generic.out.error_string)); return -1; @@ -101,10 +102,10 @@ static int net_password_set(struct net_context *ctx, int argc, const char **argv case 0: /* no args -> fail */ return net_password_set_usage(ctx, argc, argv); case 1: /* only DOM\\user; prompt for password */ - tmp = talloc_strdup(ctx->mem_ctx, argv[0]); + tmp = talloc_strdup(ctx, argv[0]); break; case 2: /* DOM\\USER and password */ - tmp = talloc_strdup(ctx->mem_ctx, argv[0]); + tmp = talloc_strdup(ctx, argv[0]); new_password = argv[1]; break; default: /* too mayn args -> fail */ @@ -115,19 +116,19 @@ static int net_password_set(struct net_context *ctx, int argc, const char **argv if ((p = strchr_m(tmp,'\\'))) { *p = 0; domain_name = tmp; - account_name = talloc_strdup(ctx->mem_ctx, p+1); + account_name = talloc_strdup(ctx, p+1); } else { account_name = tmp; domain_name = cli_credentials_get_domain(ctx->credentials); } if (!new_password) { - password_prompt = talloc_asprintf(ctx->mem_ctx, "Enter new password for account [%s\\%s]:", + password_prompt = talloc_asprintf(ctx, "Enter new password for account [%s\\%s]:", domain_name, account_name); new_password = getpass(password_prompt); } - libnetctx = libnet_context_init(NULL, ctx->lp_ctx); + libnetctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx); if (!libnetctx) { return -1; } @@ -140,7 +141,7 @@ static int net_password_set(struct net_context *ctx, int argc, const char **argv r.generic.in.newpassword = new_password; /* do password change */ - status = libnet_SetPassword(libnetctx, ctx->mem_ctx, &r); + status = libnet_SetPassword(libnetctx, ctx, &r); if (!NT_STATUS_IS_OK(status)) { DEBUG(0,("net_password_set: %s\n",r.generic.out.error_string)); return -1; diff --git a/source4/utils/net/net_time.c b/source4/utils/net/net_time.c index 1f4bb3ed71..12a8132cea 100644 --- a/source4/utils/net/net_time.c +++ b/source4/utils/net/net_time.c @@ -22,6 +22,7 @@ #include "libnet/libnet.h" #include "utils/net/net.h" #include "system/time.h" +#include "lib/events/events.h" /* * Code for getting the remote time @@ -42,7 +43,7 @@ int net_time(struct net_context *ctx, int argc, const char **argv) return net_time_usage(ctx, argc, argv); } - libnetctx = libnet_context_init(NULL, ctx->lp_ctx); + libnetctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx); if (!libnetctx) { return -1; } @@ -53,7 +54,7 @@ int net_time(struct net_context *ctx, int argc, const char **argv) r.generic.in.server_name = server_name; /* get the time */ - status = libnet_RemoteTOD(libnetctx, ctx->mem_ctx, &r); + status = libnet_RemoteTOD(libnetctx, ctx, &r); if (!NT_STATUS_IS_OK(status)) { DEBUG(0,("net_time: %s\n",r.generic.out.error_string)); return -1; diff --git a/source4/utils/net/net_user.c b/source4/utils/net/net_user.c index 39d50e7d8b..57cef6b383 100644 --- a/source4/utils/net/net_user.c +++ b/source4/utils/net/net_user.c @@ -21,6 +21,7 @@ #include "includes.h" #include "utils/net/net.h" #include "libnet/libnet.h" +#include "lib/events/events.h" #include "auth/credentials/credentials.h" static int net_user_add(struct net_context *ctx, int argc, const char **argv) @@ -36,14 +37,14 @@ static int net_user_add(struct net_context *ctx, int argc, const char **argv) return net_user_usage(ctx, argc, argv); break; case 1: - user_name = talloc_strdup(ctx->mem_ctx, argv[0]); + user_name = talloc_strdup(ctx, argv[0]); break; default: return net_user_usage(ctx, argc, argv); } /* libnet context init and its params */ - lnet_ctx = libnet_context_init(NULL, ctx->lp_ctx); + lnet_ctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx); if (!lnet_ctx) return -1; lnet_ctx->cred = ctx->credentials; @@ -52,7 +53,7 @@ static int net_user_add(struct net_context *ctx, int argc, const char **argv) r.in.user_name = user_name; r.in.domain_name = cli_credentials_get_domain(lnet_ctx->cred); - status = libnet_CreateUser(lnet_ctx, ctx->mem_ctx, &r); + status = libnet_CreateUser(lnet_ctx, ctx, &r); if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("Failed to add user account: %s\n", r.out.error_string)); @@ -76,14 +77,14 @@ static int net_user_delete(struct net_context *ctx, int argc, const char **argv) return net_user_usage(ctx, argc, argv); break; case 1: - user_name = talloc_strdup(ctx->mem_ctx, argv[0]); + user_name = talloc_strdup(ctx, argv[0]); break; default: return net_user_usage(ctx, argc, argv); } /* libnet context init and its params */ - lnet_ctx = libnet_context_init(NULL, ctx->lp_ctx); + lnet_ctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx); if (!lnet_ctx) return -1; lnet_ctx->cred = ctx->credentials; @@ -92,7 +93,7 @@ static int net_user_delete(struct net_context *ctx, int argc, const char **argv) r.in.user_name = user_name; r.in.domain_name = cli_credentials_get_domain(lnet_ctx->cred); - status = libnet_DeleteUser(lnet_ctx, ctx->mem_ctx, &r); + status = libnet_DeleteUser(lnet_ctx, ctx, &r); if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("Failed to delete user account: %s\n", r.out.error_string)); diff --git a/source4/utils/net/net_vampire.c b/source4/utils/net/net_vampire.c index 4f6371d617..38f05353ed 100644 --- a/source4/utils/net/net_vampire.c +++ b/source4/utils/net/net_vampire.c @@ -25,6 +25,7 @@ #include "librpc/gen_ndr/samr.h" #include "auth/auth.h" #include "param/param.h" +#include "lib/events/events.h" static int net_samdump_keytab_usage(struct net_context *ctx, int argc, const char **argv) { @@ -53,7 +54,7 @@ static int net_samdump_keytab(struct net_context *ctx, int argc, const char **ar break; } - libnetctx = libnet_context_init(NULL, ctx->lp_ctx); + libnetctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx); if (!libnetctx) { return -1; } @@ -63,7 +64,7 @@ static int net_samdump_keytab(struct net_context *ctx, int argc, const char **ar r.in.machine_account = NULL; r.in.binding_string = NULL; - status = libnet_SamDump_keytab(libnetctx, ctx->mem_ctx, &r); + status = libnet_SamDump_keytab(libnetctx, ctx, &r); if (!NT_STATUS_IS_OK(status)) { DEBUG(0,("libnet_SamDump returned %s: %s\n", nt_errstr(status), @@ -99,7 +100,7 @@ int net_samdump(struct net_context *ctx, int argc, const char **argv) return rc; } - libnetctx = libnet_context_init(NULL, ctx->lp_ctx); + libnetctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx); if (!libnetctx) { return -1; } @@ -109,7 +110,7 @@ int net_samdump(struct net_context *ctx, int argc, const char **argv) r.in.machine_account = NULL; r.in.binding_string = NULL; - status = libnet_SamDump(libnetctx, ctx->mem_ctx, &r); + status = libnet_SamDump(libnetctx, ctx, &r); if (!NT_STATUS_IS_OK(status)) { DEBUG(0,("libnet_SamDump returned %s: %s\n", nt_errstr(status), @@ -141,7 +142,7 @@ int net_samsync_ldb(struct net_context *ctx, int argc, const char **argv) struct libnet_context *libnetctx; struct libnet_samsync_ldb r; - libnetctx = libnet_context_init(NULL, ctx->lp_ctx); + libnetctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx); if (!libnetctx) { return -1; } -- cgit From 79af7ff2f7f6fabe8a2a48386088228096e218b4 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 14 Apr 2008 18:59:40 +0200 Subject: fixed a valgrind error in id mapping the status field is sent on both call and reply, but was only being initialised on reply (This used to be commit 2ebd7b80998775168959d511fbc987f8b5b7bd34) --- source4/ntvfs/posix/pvfs_acl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source4/ntvfs/posix/pvfs_acl.c b/source4/ntvfs/posix/pvfs_acl.c index 2393a2e7a3..f1e469f790 100644 --- a/source4/ntvfs/posix/pvfs_acl.c +++ b/source4/ntvfs/posix/pvfs_acl.c @@ -135,7 +135,7 @@ static NTSTATUS pvfs_default_acl(struct pvfs_state *pvfs, } sd = *psd; - ids = talloc_array(sd, struct id_mapping, 2); + ids = talloc_zero_array(sd, struct id_mapping, 2); NT_STATUS_HAVE_NO_MEMORY(ids); ids[0].unixid = talloc(ids, struct unixid); -- cgit From c1d9167fbcc5df9da4f603084ad732915c68c0c0 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 14 Apr 2008 19:01:32 +0200 Subject: Also look in the environment for smb.conf path. (This used to be commit 8be7d93735a357a3b73a1c4413d6fd9ec09b7555) --- source4/scripting/python/samba/getopt.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source4/scripting/python/samba/getopt.py b/source4/scripting/python/samba/getopt.py index 82cb004b62..7ec684a9d6 100644 --- a/source4/scripting/python/samba/getopt.py +++ b/source4/scripting/python/samba/getopt.py @@ -35,12 +35,14 @@ class SambaOptions(optparse.OptionGroup): self._configfile = arg def get_loadparm(self): - import param + import os, param lp = param.LoadParm() - if self._configfile is None: - lp.load_default() - else: + if self._configfile is not None: lp.load(self._configfile) + elif os.getenv("SMB_CONF_PATH") is not None: + lp.load(os.getenv("SMB_CONF_PATH")) + else: + lp.load_default() return lp class VersionOptions(optparse.OptionGroup): -- cgit From 9cd04363f56ba5ee4f8b1ffaf662fe81cc995e99 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 14 Apr 2008 19:09:57 +0200 Subject: make the SMB2 negotiated read and write size settable in smb.conf parametic options: smb2:max read size = NNN smb2:max write size = NNN The defaults are 65536, which is what Vista sets, and what we previously set (This used to be commit 9e60164cae42b5dd95720e48301a2ac57e95482a) --- source4/setup/provision | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source4/setup/provision b/source4/setup/provision index 259bd814a4..b748dab339 100755 --- a/source4/setup/provision +++ b/source4/setup/provision @@ -35,6 +35,8 @@ from samba.provision import (provision, FILL_FULL, FILL_NT4SYNC, FILL_DRS) +# how do we make this case insensitive?? + parser = optparse.OptionParser("provision [options]") sambaopts = options.SambaOptions(parser) parser.add_option_group(sambaopts) -- cgit From 1bcbc4afcf2f9984081652c1fbe50d329c86b3b5 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 14 Apr 2008 19:13:41 +0200 Subject: Allow command line options in the subunitrun script. (This used to be commit 524ec0796efebd48e7b5b2eb5fcc92ecc13c0071) --- source4/scripting/bin/subunitrun | 22 +++++++++++++++++++++- source4/scripting/python/samba/tests/__init__.py | 12 +++++------- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/source4/scripting/bin/subunitrun b/source4/scripting/bin/subunitrun index 11ac426589..3730a15e1b 100755 --- a/source4/scripting/bin/subunitrun +++ b/source4/scripting/bin/subunitrun @@ -20,6 +20,26 @@ from subunit import SubunitTestRunner import sys from unittest import TestProgram +import optparse +import os +import param +import samba.getopt as options +import samba.tests + +parser = optparse.OptionParser("subunitrun [options] ") +credopts = options.CredentialsOptions(parser) +parser.add_option_group(credopts) +sambaopts = options.SambaOptions(parser) +parser.add_option_group(sambaopts) +parser.add_option_group(options.VersionOptions(parser)) + +args = parser.parse_args()[1] + +samba.tests.cmdline_loadparm = sambaopts.get_loadparm() +samba.tests.cmdline_credentials = credopts.get_credentials(samba.tests.cmdline_loadparm) + +import pdb +pdb.set_trace() runner = SubunitTestRunner() -TestProgram(module=None, argv=sys.argv, testRunner=runner) +program = TestProgram(module=None, argv=[sys.argv[0]] + args, testRunner=runner) diff --git a/source4/scripting/python/samba/tests/__init__.py b/source4/scripting/python/samba/tests/__init__.py index ceb7dd23f3..e29b4a87d5 100644 --- a/source4/scripting/python/samba/tests/__init__.py +++ b/source4/scripting/python/samba/tests/__init__.py @@ -85,15 +85,13 @@ class LdbExtensionTests(TestCaseInTempDir): os.unlink(path) -def get_loadparm(): - import param - lp = param.LoadParm() - lp.load(os.getenv("SMB_CONF_PATH")) - return lp +cmdline_loadparm = None +cmdline_credentials = None class RpcInterfaceTestCase(unittest.TestCase): def get_loadparm(self): - return get_loadparm() + assert cmdline_loadparm is not None + return cmdline_loadparm def get_credentials(self): - return None + return cmdline_credentials -- cgit From 2cdfaedee203a726bddfb46fb10d9604de32a05f Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 14 Apr 2008 19:20:43 +0200 Subject: Make sure credentials are specified when running the Python winreg RPC tests. (This used to be commit 280339e3d126f5c72dc271051b72839fde0c5c9f) --- source4/scripting/bin/subunitrun | 3 +-- source4/scripting/python/samba/tests/dcerpc/registry.py | 4 ++-- source4/selftest/samba4_tests.sh | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/source4/scripting/bin/subunitrun b/source4/scripting/bin/subunitrun index 3730a15e1b..fbbffde42c 100755 --- a/source4/scripting/bin/subunitrun +++ b/source4/scripting/bin/subunitrun @@ -38,8 +38,7 @@ args = parser.parse_args()[1] samba.tests.cmdline_loadparm = sambaopts.get_loadparm() samba.tests.cmdline_credentials = credopts.get_credentials(samba.tests.cmdline_loadparm) -import pdb -pdb.set_trace() +param.cvar.default_config = samba.tests.cmdline_loadparm runner = SubunitTestRunner() program = TestProgram(module=None, argv=[sys.argv[0]] + args, testRunner=runner) diff --git a/source4/scripting/python/samba/tests/dcerpc/registry.py b/source4/scripting/python/samba/tests/dcerpc/registry.py index 1afdc582a7..05ac7c66ee 100644 --- a/source4/scripting/python/samba/tests/dcerpc/registry.py +++ b/source4/scripting/python/samba/tests/dcerpc/registry.py @@ -23,8 +23,8 @@ from samba.tests import RpcInterfaceTestCase class WinregTests(RpcInterfaceTestCase): def setUp(self): - self.conn = winreg.winreg("ncalrpc:", self.get_loadparm(), - self.get_credentials()) + lp = self.get_loadparm() + self.conn = winreg.winreg("ncalrpc:", lp, self.get_credentials()) def get_hklm(self): return self.conn.OpenHKLM(None, diff --git a/source4/selftest/samba4_tests.sh b/source4/selftest/samba4_tests.sh index 7e545664d1..d52c240b93 100755 --- a/source4/selftest/samba4_tests.sh +++ b/source4/selftest/samba4_tests.sh @@ -342,7 +342,7 @@ plantest "unixinfo.python" dc $SUBUNITRUN samba.tests.dcerpc.unix plantest "events.python" none PYTHONPATH="$PYTHONPATH:lib/events" $SUBUNITRUN tests plantest "samba3sam.python" none PYTHONPATH="$PYTHONPATH:dsdb/samdb/ldb_modules/tests" $SUBUNITRUN samba3sam plantest "rpcecho.python" dc $SUBUNITRUN samba.tests.dcerpc.rpcecho -plantest "winreg.python" dc $SUBUNITRUN samba.tests.dcerpc.registry +plantest "winreg.python" dc $SUBUNITRUN -U\$USERNAME%\$PASSWORD samba.tests.dcerpc.registry plantest "ldap.python" dc $PYTHON $samba4srcdir/lib/ldb/tests/python/ldap.py $CONFIGURATION \$SERVER -U\$USERNAME%\$PASSWORD -W \$DOMAIN plantest "blackbox.samba3dump" none $PYTHON scripting/bin/samba3dump $samba4srcdir/../testdata/samba3 rm -rf $PREFIX/upgrade -- cgit From 43896320dd0a1fed1b1bedb46c99a7eb6498e816 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 14 Apr 2008 19:41:13 +0200 Subject: Explicitly specify the paths when installing pidl. (This used to be commit 1695e0e1ab3f2151490232462b0e3650eba96237) --- source4/pidl/config.mk | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source4/pidl/config.mk b/source4/pidl/config.mk index cdc3843d28..38542f5b7f 100644 --- a/source4/pidl/config.mk +++ b/source4/pidl/config.mk @@ -5,7 +5,12 @@ pidl-testcov: pidl/Makefile cd pidl && cover -test installpidl:: pidl/Makefile - $(MAKE) -C pidl install_vendor VENDORPREFIX=$(prefix) + $(MAKE) -C pidl install_vendor VENDORPREFIX=$(prefix) \ + INSTALLVENDORLIB=$(libdir) \ + INSTALLVENDORBIN=$(bindir) \ + INSTALLVENDORSCRIPT=$(bindir) \ + INSTALLVENDORMAN1DIR=$(mandir)/man1 \ + INSTALLVENDORMAN3DIR=$(mandir)/man3 ifeq ($(HAVE_PERL_EXTUTILS_MAKEMAKER),1) install:: installpidl -- cgit From a15b6f1606e1c761c2c4037b734137e97f00489f Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 14 Apr 2008 20:00:04 +0200 Subject: Fix unresolved symbols. (This used to be commit 8573e828d1b68c47b3c1754e9be230b2e78d9d52) --- source4/auth/gensec/config.mk | 2 +- source4/build/m4/public.m4 | 8 ++++---- source4/build/smb_build/makefile.pm | 25 +++++++++++-------------- source4/dsdb/samdb/ldb_modules/config.mk | 16 ++++++++-------- source4/scripting/ejs/config.mk | 2 +- source4/scripting/python/config.mk | 8 +++++--- source4/torture/config.mk | 6 ++---- 7 files changed, 32 insertions(+), 35 deletions(-) diff --git a/source4/auth/gensec/config.mk b/source4/auth/gensec/config.mk index 8f1aa9f84d..7cb673c9d2 100644 --- a/source4/auth/gensec/config.mk +++ b/source4/auth/gensec/config.mk @@ -19,7 +19,7 @@ PUBLIC_HEADERS += auth/gensec/gensec.h [MODULE::gensec_krb5] SUBSYSTEM = gensec INIT_FUNCTION = gensec_krb5_init -PRIVATE_DEPENDENCIES = CREDENTIALS KERBEROS service_auth auth_sam +PRIVATE_DEPENDENCIES = CREDENTIALS KERBEROS auth auth_sam # End MODULE gensec_krb5 ################################################ diff --git a/source4/build/m4/public.m4 b/source4/build/m4/public.m4 index 76a11f0a38..01bf565774 100644 --- a/source4/build/m4/public.m4 +++ b/source4/build/m4/public.m4 @@ -4,8 +4,6 @@ dnl Copyright (C) 2004 Stefan Metzmacher dnl Copyright (C) 2004-2005 Jelmer Vernooij dnl Published under the GPL dnl -dnl SMB_SUBSYSTEM(name,required_subsystems) -dnl dnl SMB_EXT_LIB_FROM_PKGCONFIG(name,pkg-config name,[ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND]) dnl dnl SMB_EXT_LIB(name,libs,cflags,cppflags,ldflags) @@ -18,12 +16,13 @@ dnl ####################################################### dnl ### And now the implementation ### dnl ####################################################### -dnl SMB_SUBSYSTEM(name,required_subsystems,cflags) +dnl SMB_SUBSYSTEM(name,obj_files,required_subsystems,cflags) AC_DEFUN([SMB_SUBSYSTEM], [ MAKE_SETTINGS="$MAKE_SETTINGS $1_CFLAGS = $4 $1_ENABLE = YES +$1_OBJ_FILES = $2 " SMB_INFO_SUBSYSTEMS="$SMB_INFO_SUBSYSTEMS @@ -38,13 +37,14 @@ ENABLE = YES " ]) -dnl SMB_LIBRARY(name,required_subsystems,version,so_version,cflags,ldflags) +dnl SMB_LIBRARY(name,obj_files,required_subsystems,version,so_version,cflags,ldflags) AC_DEFUN([SMB_LIBRARY], [ MAKE_SETTINGS="$MAKE_SETTINGS $1_CFLAGS = $6 $1_LDFLAGS = $7 $1_ENABLE = YES +$1_OBJ_FILES = $2 " SMB_INFO_LIBRARIES="$SMB_INFO_LIBRARIES diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm index 7728bc4f8d..9ce04ca8d4 100644 --- a/source4/build/smb_build/makefile.pm +++ b/source4/build/smb_build/makefile.pm @@ -263,10 +263,10 @@ sub MergedObj($$) $self->output("$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n"); $self->output(<< "__EOD__" # -$ctx->{RESULT_MERGED_OBJ}: \$($ctx->{NAME}_OBJ_LIST) +$ctx->{RESULT_MERGED_OBJ}: \$($ctx->{NAME}_OBJ_FILES) \@echo Partially linking \$@ \@mkdir -p \$(\@D) - \$(PARTLINK) -o \$@ \$($ctx->{NAME}_OBJ_LIST) + \$(PARTLINK) -o \$@ \$($ctx->{NAME}_OBJ_FILES) __EOD__ ); @@ -276,8 +276,6 @@ sub StaticLibrary($$) { my ($self,$ctx) = @_; - return unless (defined($ctx->{OBJ_FILES})); - $self->output("STATIC_LIBS += $ctx->{TARGET_STATIC_LIBRARY}\n") if ($ctx->{TYPE} eq "LIBRARY"); $self->output("$ctx->{RESULT_STATIC_LIBRARY}: \$($ctx->{NAME}_FULL_OBJ_LIST)\n"); @@ -338,13 +336,13 @@ sub ProtoHeader($$) { my ($self,$ctx) = @_; - my $priv = "\$(addprefix $ctx->{BASEDIR}/, $ctx->{PRIVATE_PROTO_HEADER})"; + my $priv = "$ctx->{BASEDIR}/$ctx->{PRIVATE_PROTO_HEADER}"; $self->output("PROTO_HEADERS += $priv\n"); - $self->output("$priv: $ctx->{MK_FILE} \$($ctx->{NAME}_OBJ_LIST:.o=.c) \$(srcdir)/script/mkproto.pl\n"); + $self->output("$priv: $ctx->{MK_FILE} \$($ctx->{NAME}_OBJ_FILES:.o=.c) \$(srcdir)/script/mkproto.pl\n"); $self->output("\t\@echo \"Creating \$@\"\n"); $self->output("\t\@mkdir -p \$(\@D)\n"); - $self->output("\t\@\$(PERL) \$(srcdir)/script/mkproto.pl --srcdir=\$(srcdir) --builddir=\$(builddir) --public=/dev/null --private=\$@ \$($ctx->{NAME}_OBJ_LIST)\n\n"); + $self->output("\t\@\$(PERL) \$(srcdir)/script/mkproto.pl --srcdir=\$(srcdir) --builddir=\$(builddir) --public=/dev/null --private=\$@ \$($ctx->{NAME}_OBJ_FILES)\n\n"); } sub write($$) @@ -382,7 +380,6 @@ sub CFlags($$) my $src_ne_build = ($srcdir ne $builddir) ? 1 : 0; - return unless defined ($key->{OBJ_LIST}); return unless defined ($key->{FINAL_CFLAGS}); return unless (@{$key->{FINAL_CFLAGS}} > 0); @@ -396,19 +393,19 @@ sub CFlags($$) my @cflags = (); foreach my $flag (@sorted_cflags) { if($src_ne_build) { - if($flag =~ m#^-I([^/].*$)#) { - my $dir = $1; - $dir =~ s#^\$\((?:src|build)dir\)/?##; + if($flag =~ m#^-I([^/].*$)#) { + my $dir = $1; + $dir =~ s#^\$\((?:src|build)dir\)/?##; push(@cflags, "-I$builddir/$dir", "-I$srcdir/$dir"); - next; - } + next; + } } push(@cflags, $flag); } my $cflags = join(' ', @cflags); - $self->output("\$(patsubst %.ho,%.d,\$($key->{NAME}_OBJ_LIST:.o=.d)) \$($key->{NAME}_OBJ_LIST): CFLAGS+= $cflags\n"); + $self->output("\$(patsubst %.ho,%.d,\$($key->{NAME}_OBJ_FILES:.o=.d)) \$($key->{NAME}_OBJ_FILES): CFLAGS+= $cflags\n"); } 1; diff --git a/source4/dsdb/samdb/ldb_modules/config.mk b/source4/dsdb/samdb/ldb_modules/config.mk index dd1c8b10db..414b449ba8 100644 --- a/source4/dsdb/samdb/ldb_modules/config.mk +++ b/source4/dsdb/samdb/ldb_modules/config.mk @@ -22,7 +22,7 @@ INIT_FUNCTION = repl_meta_data_module_module_ops ################################################ ldb_repl_meta_data_OBJ_FILES = \ - repl_meta_data.o + dsdb/samdb/ldb_modules/repl_meta_data.o ################################################ # Start MODULE ldb_dsdb_cache @@ -35,7 +35,7 @@ INIT_FUNCTION = dsdb_cache_module_module_ops ################################################ ldb_dsdb_cache_OBJ_FILES = \ - dsdb_cache.o + dsdb/samdb/ldb_modules/dsdb_cache.o ################################################ # Start MODULE ldb_schema_fsmo @@ -48,7 +48,7 @@ INIT_FUNCTION = schema_fsmo_module_module_ops ################################################ ldb_schema_fsmo_OBJ_FILES = \ - schema_fsmo.o + dsdb/samdb/ldb_modules/schema_fsmo.o ################################################ # Start MODULE ldb_naming_fsmo @@ -61,7 +61,7 @@ INIT_FUNCTION = naming_fsmo_module_module_ops ################################################ ldb_naming_fsmo_OBJ_FILES = \ - naming_fsmo.o + dsdb/samdb/ldb_modules/naming_fsmo.o ################################################ # Start MODULE ldb_pdc_fsmo @@ -74,7 +74,7 @@ INIT_FUNCTION = pdc_fsmo_module_module_ops ################################################ ldb_pdc_fsmo_OBJ_FILES = \ - pdc_fsmo.o + dsdb/samdb/ldb_modules/pdc_fsmo.o ################################################ # Start MODULE ldb_samldb @@ -88,7 +88,7 @@ INIT_FUNCTION = samldb_module_module_ops ################################################ ldb_samldb_OBJ_FILES = \ - samldb.o + dsdb/samdb/ldb_modules/samldb.o ################################################ # Start MODULE ldb_samba3sam @@ -103,7 +103,7 @@ PRIVATE_DEPENDENCIES = LIBTALLOC ldb_map SMBPASSWD NSS_WRAPPER LIBSECURITY \ ################################################ ldb_samba3sam_OBJ_FILES = \ - samba3sam.o + dsdb/samdb/ldb_modules/samba3sam.o ################################################ # Start MODULE ldb_simple_ldap_map @@ -119,7 +119,7 @@ ALIASES = entryuuid nsuniqueid ################################################ ldb_simple_ldap_map_OBJ_FILES = \ - simple_ldap_map.o + dsdb/samdb/ldb_modules/simple_ldap_map.o # ################################################ # # Start MODULE ldb_proxy diff --git a/source4/scripting/ejs/config.mk b/source4/scripting/ejs/config.mk index a3ed5239bf..cadd71673c 100644 --- a/source4/scripting/ejs/config.mk +++ b/source4/scripting/ejs/config.mk @@ -58,7 +58,7 @@ smbcalls_data_OBJ_FILES = scripting/ejs/smbcalls_data.o OUTPUT_TYPE = MERGED_OBJ SUBSYSTEM = smbcalls INIT_FUNCTION = smb_setup_ejs_auth -PRIVATE_DEPENDENCIES = service_auth +PRIVATE_DEPENDENCIES = auth smbcalls_auth_OBJ_FILES = scripting/ejs/smbcalls_auth.o diff --git a/source4/scripting/python/config.mk b/source4/scripting/python/config.mk index cb03bfaeea..2f010644b1 100644 --- a/source4/scripting/python/config.mk +++ b/source4/scripting/python/config.mk @@ -1,23 +1,25 @@ [BINARY::smbpython] PRIVATE_DEPENDENCIES = LIBPYTHON -smbpython_OBJ_FILES = smbpython.o +smbpython_OBJ_FILES = scripting/python/smbpython.o [SUBSYSTEM::LIBPYTHON] PUBLIC_DEPENDENCIES = EXT_LIB_PYTHON INIT_FUNCTION_SENTINEL = { NULL, NULL } -LIBPYTHON_OBJ_FILES = modules.o pytalloc.o +LIBPYTHON_OBJ_FILES = $(addprefix scripting/python/, modules.o pytalloc.o) [PYTHON::python_uuid] PRIVATE_DEPENDENCIES = LIBNDR -python_uuid_OBJ_FILES = uuidmodule.o +python_uuid_OBJ_FILES = scripting/python/uuidmodule.o [PYTHON::python_misc] PRIVATE_DEPENDENCIES = LIBNDR LIBLDB SAMDB CREDENTIALS SWIG_FILE = misc.i +python_misc_OBJ_FILES = scripting/python/misc_wrap.o + PYDOCTOR_MODULES=bin/python/ldb.py bin/python/auth.py bin/python/credentials.py bin/python/registry.py bin/python/tdb.py bin/python/security.py bin/python/events.py bin/python/net.py pythonmods:: $(PYTHON_PYS) $(PYTHON_MODS) diff --git a/source4/torture/config.mk b/source4/torture/config.mk index e15d20d9cd..dc2b1c5c5e 100644 --- a/source4/torture/config.mk +++ b/source4/torture/config.mk @@ -11,9 +11,7 @@ PUBLIC_DEPENDENCIES = \ LIBPOPT -torture_OBJ_FILES = \ - torture.o \ - ui.o +torture_OBJ_FILES = $(addprefix torture/, torture.o ui.o) PUBLIC_HEADERS += torture/torture.h torture/ui.h @@ -21,7 +19,7 @@ PUBLIC_HEADERS += torture/torture.h torture/ui.h PRIVATE_DEPENDENCIES = LIBCLI_RAW LIBPYTHON smbcalls PROVISION PUBLIC_DEPENDENCIES = POPT_CREDENTIALS -TORTURE_UTIL_OBJ_FILES = util_smb.o +TORTURE_UTIL_OBJ_FILES = torture/util_smb.o ################################# # Start SUBSYSTEM TORTURE_BASIC -- cgit From 2bc26db97fea4562415956269d05ea65e5710045 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 14 Apr 2008 20:39:12 +0200 Subject: Fix the build. (This used to be commit a70cbd63d9c398ddcbbaa595ee29343335e89aa7) --- source4/utils/net/net_join.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source4/utils/net/net_join.c b/source4/utils/net/net_join.c index 2102257c6c..37b3c21fcf 100644 --- a/source4/utils/net/net_join.c +++ b/source4/utils/net/net_join.c @@ -114,11 +114,11 @@ int net_vampire(struct net_context *ctx, int argc, const char **argv) case 0: /* no args -> fail */ return net_vampire_usage(ctx, argc, argv); case 1: /* only DOMAIN */ - tmp = talloc_strdup(ctx->mem_ctx, argv[0]); + tmp = talloc_strdup(ctx, argv[0]); break; case 2: /* domain and target dir */ - tmp = talloc_strdup(ctx->mem_ctx, argv[0]); - targetdir = talloc_strdup(ctx->mem_ctx, argv[1]); + tmp = talloc_strdup(ctx, argv[0]); + targetdir = talloc_strdup(ctx, argv[1]); break; default: /* too many args -> fail */ return net_vampire_usage(ctx, argc, argv); @@ -131,7 +131,7 @@ int net_vampire(struct net_context *ctx, int argc, const char **argv) return -1; } libnetctx->cred = ctx->credentials; - r = talloc(ctx->mem_ctx, struct libnet_Vampire); + r = talloc(ctx, struct libnet_Vampire); if (!r) { return -1; } @@ -151,7 +151,7 @@ int net_vampire(struct net_context *ctx, int argc, const char **argv) talloc_free(libnetctx); return -1; } - d_printf("Vampired domain %s (%s)\n", r->out.domain_name, dom_sid_string(ctx->mem_ctx, r->out.domain_sid)); + d_printf("Vampired domain %s (%s)\n", r->out.domain_name, dom_sid_string(ctx, r->out.domain_sid)); talloc_free(libnetctx); return 0; -- cgit From 9b503470769e1f808c4bdafafba0b93e2ede3bd6 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 14 Apr 2008 19:41:13 +0200 Subject: Explicitly specify the paths when installing pidl. (This used to be commit 5e988a34ded288660c6e543e59b566ec12d2fba7) --- source4/pidl/config.mk | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source4/pidl/config.mk b/source4/pidl/config.mk index cdc3843d28..38542f5b7f 100644 --- a/source4/pidl/config.mk +++ b/source4/pidl/config.mk @@ -5,7 +5,12 @@ pidl-testcov: pidl/Makefile cd pidl && cover -test installpidl:: pidl/Makefile - $(MAKE) -C pidl install_vendor VENDORPREFIX=$(prefix) + $(MAKE) -C pidl install_vendor VENDORPREFIX=$(prefix) \ + INSTALLVENDORLIB=$(libdir) \ + INSTALLVENDORBIN=$(bindir) \ + INSTALLVENDORSCRIPT=$(bindir) \ + INSTALLVENDORMAN1DIR=$(mandir)/man1 \ + INSTALLVENDORMAN3DIR=$(mandir)/man3 ifeq ($(HAVE_PERL_EXTUTILS_MAKEMAKER),1) install:: installpidl -- cgit From 1b5f32128d1867829647a4e1f20b6e8363444f66 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 14 Apr 2008 23:28:14 +0200 Subject: Use RpcInterfaceTestCase everywhere. (This used to be commit 799095b4e567f4495adf7d1d7bcb81dda6782959) --- source4/scripting/python/samba/tests/dcerpc/registry.py | 4 ++-- source4/scripting/python/samba/tests/dcerpc/rpcecho.py | 7 +++---- source4/scripting/python/samba/tests/dcerpc/sam.py | 7 +++---- source4/scripting/python/samba/tests/dcerpc/unix.py | 7 +++---- source4/scripting/python/samba/tests/provision.py | 2 +- source4/scripting/python/samba/tests/samdb.py | 4 ++-- 6 files changed, 14 insertions(+), 17 deletions(-) diff --git a/source4/scripting/python/samba/tests/dcerpc/registry.py b/source4/scripting/python/samba/tests/dcerpc/registry.py index 05ac7c66ee..1afdc582a7 100644 --- a/source4/scripting/python/samba/tests/dcerpc/registry.py +++ b/source4/scripting/python/samba/tests/dcerpc/registry.py @@ -23,8 +23,8 @@ from samba.tests import RpcInterfaceTestCase class WinregTests(RpcInterfaceTestCase): def setUp(self): - lp = self.get_loadparm() - self.conn = winreg.winreg("ncalrpc:", lp, self.get_credentials()) + self.conn = winreg.winreg("ncalrpc:", self.get_loadparm(), + self.get_credentials()) def get_hklm(self): return self.conn.OpenHKLM(None, diff --git a/source4/scripting/python/samba/tests/dcerpc/rpcecho.py b/source4/scripting/python/samba/tests/dcerpc/rpcecho.py index 484af9490c..6c43632d97 100644 --- a/source4/scripting/python/samba/tests/dcerpc/rpcecho.py +++ b/source4/scripting/python/samba/tests/dcerpc/rpcecho.py @@ -19,12 +19,11 @@ import echo import unittest -from samba.tests import get_loadparm +from samba.tests import RpcInterfaceTestCase -class RpcEchoTests(unittest.TestCase): +class RpcEchoTests(RpcInterfaceTestCase): def setUp(self): - lp_ctx = get_loadparm() - self.conn = echo.rpcecho("ncalrpc:", lp_ctx) + self.conn = echo.rpcecho("ncalrpc:", self.get_loadparm()) def test_addone(self): self.assertEquals(2, self.conn.AddOne(1)) diff --git a/source4/scripting/python/samba/tests/dcerpc/sam.py b/source4/scripting/python/samba/tests/dcerpc/sam.py index 96348f2f69..8ef12dad86 100644 --- a/source4/scripting/python/samba/tests/dcerpc/sam.py +++ b/source4/scripting/python/samba/tests/dcerpc/sam.py @@ -18,12 +18,11 @@ # import samr -import unittest -from samba.tests import get_loadparm +from samba.tests import RpcInterfaceTestCase -class SamrTests(unittest.TestCase): +class SamrTests(RpcInterfaceTestCase): def setUp(self): - self.conn = samr.samr("ncalrpc:", get_loadparm()) + self.conn = samr.samr("ncalrpc:", self.get_loadparm()) def test_connect5(self): (level, info, handle) = self.conn.Connect5(None, 0, 1, samr.ConnectInfo1()) diff --git a/source4/scripting/python/samba/tests/dcerpc/unix.py b/source4/scripting/python/samba/tests/dcerpc/unix.py index b2577ec898..bfddfdc7ec 100644 --- a/source4/scripting/python/samba/tests/dcerpc/unix.py +++ b/source4/scripting/python/samba/tests/dcerpc/unix.py @@ -18,12 +18,11 @@ # import unixinfo -import unittest -from samba.tests import get_loadparm +from samba.tests import RpcInterfaceTestCase -class UnixinfoTests(unittest.TestCase): +class UnixinfoTests(RpcInterfaceTestCase): def setUp(self): - self.conn = unixinfo.unixinfo("ncalrpc:", get_loadparm()) + self.conn = unixinfo.unixinfo("ncalrpc:", self.get_loadparm()) def test_getpwuid(self): infos = self.conn.GetPWUid(range(512)) diff --git a/source4/scripting/python/samba/tests/provision.py b/source4/scripting/python/samba/tests/provision.py index 514582cbe4..b9e0e16d3c 100644 --- a/source4/scripting/python/samba/tests/provision.py +++ b/source4/scripting/python/samba/tests/provision.py @@ -24,7 +24,7 @@ from ldb import Dn import param import unittest -lp = samba.tests.get_loadparm() +lp = samba.tests.cmdline_loadparm setup_dir = "setup" def setup_path(file): diff --git a/source4/scripting/python/samba/tests/samdb.py b/source4/scripting/python/samba/tests/samdb.py index 3745dba6fc..0e175bf936 100644 --- a/source4/scripting/python/samba/tests/samdb.py +++ b/source4/scripting/python/samba/tests/samdb.py @@ -21,7 +21,7 @@ from credentials import Credentials import os from samba.provision import setup_samdb from samba.samdb import SamDB -from samba.tests import get_loadparm, TestCaseInTempDir +from samba.tests import cmdline_loadparm, TestCaseInTempDir import security from unittest import TestCase import uuid @@ -43,7 +43,7 @@ class SamDBTestCase(TestCaseInTempDir): hostguid = uuid.random() path = os.path.join(self.tempdir, "samdb.ldb") self.samdb = setup_samdb(path, setup_path, system_session(), creds, - get_loadparm(), schemadn, configdn, + cmdline_loadparm, schemadn, configdn, self.domaindn, "example.com", "EXAMPLE.COM", "FOO", lambda x: None, "foo", domaindn, False, domainsid, "# no aci", domainguid, -- cgit From d04926914ad0d9ecd7dee3e156198d6baf788598 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 15 Apr 2008 01:40:32 +0200 Subject: Fix the build. (This used to be commit ecaa5bb83b5cf319718d15aff96152d70fa19f7f) --- source4/Makefile | 2 ++ source4/auth/config.mk | 2 +- source4/build/make/python.mk | 4 ++++ source4/build/smb_build/makefile.pm | 4 ++-- source4/scripting/python/config.mk | 10 ---------- source4/static_deps.mk | 1 - 6 files changed, 9 insertions(+), 14 deletions(-) diff --git a/source4/Makefile b/source4/Makefile index 98c45a34ad..f2567e6ac4 100644 --- a/source4/Makefile +++ b/source4/Makefile @@ -51,6 +51,8 @@ include data.mk BINARIES += $(BIN_PROGS) $(SBIN_PROGS) +pythonmods:: $(PYTHON_PYS) $(PYTHON_SO) + DEP_FILES = $(patsubst %.ho,%.hd,$(patsubst %.o,%.d,$(ALL_OBJS))) \ include/includes.d diff --git a/source4/auth/config.mk b/source4/auth/config.mk index 780c098b68..7d4678b7ac 100644 --- a/source4/auth/config.mk +++ b/source4/auth/config.mk @@ -91,7 +91,7 @@ PAM_ERRORS_OBJ_FILES = $(addprefix auth/, pam_errors.o) [MODULE::auth] INIT_FUNCTION = server_service_auth_init -SUBSYSTEM = smbd +SUBSYSTEM = service PRIVATE_PROTO_HEADER = auth_proto.h PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL LIBSECURITY SAMDB CREDENTIALS diff --git a/source4/build/make/python.mk b/source4/build/make/python.mk index 57bf0169fe..6c1798212e 100644 --- a/source4/build/make/python.mk +++ b/source4/build/make/python.mk @@ -56,3 +56,7 @@ clean:: pydoctor:: pythonmods LD_LIBRARY_PATH=bin/shared PYTHONPATH=$(pythonbuilddir) pydoctor --project-name=Samba --project-url=http://www.samba.org --make-html --docformat=restructuredtext --add-package $(pythonbuilddir)/samba + +bin/python/%.py: + mkdir -p $(@D) + cp $< $@ diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm index 9ce04ca8d4..9518c2eabe 100644 --- a/source4/build/smb_build/makefile.pm +++ b/source4/build/smb_build/makefile.pm @@ -326,9 +326,9 @@ sub PythonFiles($$) foreach (@{$ctx->{PYTHON_FILES}}) { my $target = "bin/python/".basename($_); - my $source = "\$(addprefix $ctx->{BASEDIR}/, $target)"; + my $source = "\$(addprefix $ctx->{BASEDIR}/, $_)"; $self->output("$target: $source\n\n"); - $self->output("PYTHON_PYS += $source\n"); + $self->output("PYTHON_PYS += $target\n"); } } diff --git a/source4/scripting/python/config.mk b/source4/scripting/python/config.mk index 2f010644b1..59f628fe18 100644 --- a/source4/scripting/python/config.mk +++ b/source4/scripting/python/config.mk @@ -22,18 +22,8 @@ python_misc_OBJ_FILES = scripting/python/misc_wrap.o PYDOCTOR_MODULES=bin/python/ldb.py bin/python/auth.py bin/python/credentials.py bin/python/registry.py bin/python/tdb.py bin/python/security.py bin/python/events.py bin/python/net.py -pythonmods:: $(PYTHON_PYS) $(PYTHON_MODS) - -bin/python/%.py: - mkdir -p $(@D) - cp $< $@ - installpython:: pythonmods @$(SHELL) $(srcdir)/script/installpython.sh \ $(INSTALLPERMS) \ $(DESTDIR)$(PYTHONDIR) \ scripting/python bin/python - -clean:: - @echo "Removing python modules" - @rm -rf bin/python/* diff --git a/source4/static_deps.mk b/source4/static_deps.mk index ade41614c2..a442b01025 100644 --- a/source4/static_deps.mk +++ b/source4/static_deps.mk @@ -11,7 +11,6 @@ lib/charset/charset.h: lib/charset/charset_proto.h include/includes.h: \ include/config.h \ lib/charset/charset.h \ - param/proto.h \ librpc/gen_ndr/misc.h heimdal_basics: \ -- cgit From b62d7aa8eb2da784186b8cd903775dd12c3f34f7 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 15 Apr 2008 01:52:55 +0200 Subject: Make sure init function sentinels are set for modules. (This used to be commit fac3463dd505404998b6b00526f1dad6ae47ba84) --- source4/build/smb_build/header.pm | 1 + source4/build/smb_build/input.pm | 3 +++ 2 files changed, 4 insertions(+) diff --git a/source4/build/smb_build/header.pm b/source4/build/smb_build/header.pm index ffac5e2601..dfb7c62e54 100644 --- a/source4/build/smb_build/header.pm +++ b/source4/build/smb_build/header.pm @@ -44,6 +44,7 @@ sub _prepare_build_h($) $DEFINE->{VAL} .= "\t$_, \\\n"; } + die("Invalid sentinel") unless ($key->{INIT_FUNCTION_SENTINEL}); $DEFINE->{VAL} .= "\t$key->{INIT_FUNCTION_SENTINEL} \n"; push(@defines,$DEFINE); diff --git a/source4/build/smb_build/input.pm b/source4/build/smb_build/input.pm index 9949836675..bb6a120c34 100644 --- a/source4/build/smb_build/input.pm +++ b/source4/build/smb_build/input.pm @@ -84,12 +84,15 @@ sub check_module($$$) return if ($mod->{ENABLE} ne "YES"); + if (exists($INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTION_TYPE})) { $mod->{INIT_FUNCTION_TYPE} = $INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTION_TYPE}; } else { $mod->{INIT_FUNCTION_TYPE} = "NTSTATUS (*) (void)"; } + unless (defined($mod->{INIT_FUNCTION_SENTINEL})) { $mod->{INIT_FUNCTION_SENTINEL} = "NULL"; } + if (not defined($mod->{OUTPUT_TYPE})) { if (not defined($INPUT->{$mod->{SUBSYSTEM}}->{TYPE})) { die("Invalid type for subsystem $mod->{SUBSYSTEM}"); -- 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/auth/gensec/config.mk | 7 ++++--- source4/build/m4/public.m4 | 2 -- source4/build/smb_build/config_mk.pm | 4 ---- source4/build/smb_build/input.pm | 10 ---------- source4/build/smb_build/makefile.pm | 5 +---- source4/lib/ldb/config.mk | 8 +++++--- source4/lib/registry/config.mk | 8 +++++--- source4/lib/util/config.mk | 2 -- source4/libcli/config.mk | 2 -- source4/librpc/config.mk | 37 ++++++++++++++++++------------------ source4/param/config.mk | 8 +++++--- source4/torture/config.mk | 7 ++----- 12 files changed, 41 insertions(+), 59 deletions(-) diff --git a/source4/auth/gensec/config.mk b/source4/auth/gensec/config.mk index 7cb673c9d2..cfb3493484 100644 --- a/source4/auth/gensec/config.mk +++ b/source4/auth/gensec/config.mk @@ -1,15 +1,16 @@ ################################# # Start SUBSYSTEM gensec [LIBRARY::gensec] -PC_FILE = gensec.pc -VERSION = 0.0.1 -SO_VERSION = 0 PRIVATE_PROTO_HEADER = gensec_proto.h PUBLIC_DEPENDENCIES = \ CREDENTIALS LIBSAMBA-UTIL LIBCRYPTO ASN1_UTIL samba-socket LIBPACKET # End SUBSYSTEM gensec ################################# +PC_FILES += auth/gensec/gensec.pc + +gensec_VERSION = 0.0.1 +gensec_SOVERSION = 0 gensec_OBJ_FILES = $(addprefix auth/gensec/, gensec.o socket.o) PUBLIC_HEADERS += auth/gensec/gensec.h diff --git a/source4/build/m4/public.m4 b/source4/build/m4/public.m4 index 01bf565774..1eae998ca4 100644 --- a/source4/build/m4/public.m4 +++ b/source4/build/m4/public.m4 @@ -52,8 +52,6 @@ SMB_INFO_LIBRARIES="$SMB_INFO_LIBRARIES # Start Library $1 @<:@LIBRARY::$1@:>@ PRIVATE_DEPENDENCIES = $3 -VERSION = $4 -SO_VERSION = $5 CFLAGS = \$($1_CFLAGS) LDFLAGS = \$($1_LDFLAGS) ENABLE = YES diff --git a/source4/build/smb_build/config_mk.pm b/source4/build/smb_build/config_mk.pm index de786ddbe5..307c391e07 100644 --- a/source4/build/smb_build/config_mk.pm +++ b/source4/build/smb_build/config_mk.pm @@ -73,12 +73,8 @@ my $section_types = { "USE_HOSTCC" => "bool" }, "LIBRARY" => { - "VERSION" => "string", - "SO_VERSION" => "string", "LIBRARY_REALNAME" => "string", - "PC_FILE" => "string", - "INIT_FUNCTION_TYPE" => "string", "INIT_FUNCTION_SENTINEL" => "string", "OUTPUT_TYPE" => "list", diff --git a/source4/build/smb_build/input.pm b/source4/build/smb_build/input.pm index bb6a120c34..3ca2f22f0c 100644 --- a/source4/build/smb_build/input.pm +++ b/source4/build/smb_build/input.pm @@ -125,16 +125,6 @@ sub check_library($$$) unless (defined($lib->{OUTPUT_TYPE})) { $lib->{OUTPUT_TYPE} = $default_ot; } - if (defined($lib->{VERSION}) and not defined($lib->{SO_VERSION})) { - print "$lib->{NAME}: Please specify SO_VERSION when specifying VERSION\n"; - return; - } - - if (defined($lib->{SO_VERSION}) and not defined($lib->{VERSION})) { - print "$lib->{NAME}: Please specify VERSION when specifying SO_VERSION\n"; - return; - } - unless (defined($lib->{INIT_FUNCTION_TYPE})) { $lib->{INIT_FUNCTION_TYPE} = "NTSTATUS (*) (void)"; } unless (defined($lib->{INIT_FUNCTION_SENTINEL})) { $lib->{INIT_FUNCTION_SENTINEL} = "NULL"; } unless (defined($lib->{INSTALLDIR})) { $lib->{INSTALLDIR} = "LIBDIR"; } diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm index 9518c2eabe..81aac2fc46 100644 --- a/source4/build/smb_build/makefile.pm +++ b/source4/build/smb_build/makefile.pm @@ -214,9 +214,6 @@ sub SharedLibraryPrimitives($$) { my ($self,$ctx) = @_; - $self->output("$ctx->{NAME}_SOVERSION = $ctx->{SO_VERSION}\n") if (defined($ctx->{SO_VERSION})); - $self->output("$ctx->{NAME}_VERSION = $ctx->{VERSION}\n") if (defined($ctx->{VERSION})); - if (not grep(/STATIC_LIBRARY/, @{$ctx->{OUTPUT_TYPE}})) { $self->output("$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n"); $self->_prepare_list($ctx, "FULL_OBJ_LIST"); @@ -231,7 +228,7 @@ sub SharedLibrary($$) $ctx->{LIBRARY_SONAME} = ""; } - $self->output("SHARED_LIBS += $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}\n") if (defined($ctx->{SO_VERSION})); + $self->output("SHARED_LIBS += $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}\n"); $self->_prepare_list($ctx, "DEPEND_LIST"); $self->_prepare_list($ctx, "LINK_FLAGS"); 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 \ diff --git a/source4/libcli/config.mk b/source4/libcli/config.mk index 1ed52ca9d3..95b45003be 100644 --- a/source4/libcli/config.mk +++ b/source4/libcli/config.mk @@ -42,8 +42,6 @@ PRIVATE_PROTO_HEADER = nbt/nbtname.h NDR_NBT_BUF_OBJ_FILES = libcli/nbt/nbtname.o [SUBSYSTEM::LIBCLI_NBT] -#VERSION = 0.0.1 -#SO_VERSION = 0 PRIVATE_PROTO_HEADER = nbt/nbt_proto.h PUBLIC_DEPENDENCIES = LIBNDR NDR_NBT LIBCLI_COMPOSITE LIBEVENTS \ NDR_SECURITY samba-socket LIBSAMBA-UTIL diff --git a/source4/librpc/config.mk b/source4/librpc/config.mk index abf7a434d0..92409da20e 100644 --- a/source4/librpc/config.mk +++ b/source4/librpc/config.mk @@ -1,21 +1,19 @@ ################################################ # Start SUBSYSTEM LIBNDR [LIBRARY::LIBNDR] -VERSION = 0.0.1 -SO_VERSION = 0 -PC_FILE = ndr.pc PRIVATE_PROTO_HEADER = ndr/libndr_proto.h PUBLIC_DEPENDENCIES = LIBSAMBA-ERRORS LIBTALLOC LIBSAMBA-UTIL CHARSET \ LIBSAMBA-HOSTCONFIG + +LIBNDR_OBJ_FILES = $(addprefix librpc/ndr/, ndr.o ndr_basic.o ndr_string.o uuid.o) + +PC_FILES += librpc/ndr.pc +LIBNDR_VERSION = 0.0.1 +LIBNDR_SOVERSION = 0 + # End SUBSYSTEM LIBNDR ################################################ -LIBNDR_OBJ_FILES = \ - librpc/ndr/ndr.o \ - librpc/ndr/ndr_basic.o \ - librpc/ndr/ndr_string.o \ - librpc/ndr/uuid.o - PUBLIC_HEADERS += librpc/ndr/libndr.h ################################# @@ -430,10 +428,11 @@ RPC_NDR_UNIXINFO_OBJ_FILES = librpc/gen_ndr/ndr_unixinfo_c.o [LIBRARY::dcerpc_samr] PUBLIC_DEPENDENCIES = dcerpc NDR_SAMR -PC_FILE = dcerpc_samr.pc -VERSION = 0.0.1 -SO_VERSION = 0 +PC_FILES += librpc/dcerpc_samr.pc + +dcerpc_samr_VERSION = 0.0.1 +dcerpc_samr_SOVERSION = 0 dcerpc_samr_OBJ_FILES = librpc/gen_ndr/ndr_samr_c.o [SUBSYSTEM::RPC_NDR_SPOOLSS] @@ -460,11 +459,12 @@ PUBLIC_HEADERS += librpc/gen_ndr/ndr_svcctl_c.h [LIBRARY::dcerpc_atsvc] PUBLIC_DEPENDENCIES = dcerpc NDR_ATSVC -PC_FILE = dcerpc_atsvc.pc -VERSION = 0.0.1 -SO_VERSION = 0 + +dcerpc_atsvc_VERSION = 0.0.1 +dcerpc_atsvc_SOVERSION = 0 dcerpc_atsvc_OBJ_FILES = librpc/gen_ndr/ndr_atsvc_c.o +PC_FILES += librpc/dcerpc_atsvc.pc PUBLIC_HEADERS += librpc/gen_ndr/ndr_atsvc_c.h @@ -573,9 +573,6 @@ PUBLIC_HEADERS += $(addprefix librpc/, gen_ndr/dcerpc.h gen_ndr/ndr_dcerpc.h) ################################################ # Start SUBSYSTEM dcerpc [LIBRARY::dcerpc] -VERSION = 0.0.1 -SO_VERSION = 0 -PC_FILE = dcerpc.pc PRIVATE_PROTO_HEADER = rpc/dcerpc_proto.h PRIVATE_DEPENDENCIES = \ samba-socket LIBCLI_RESOLVE LIBCLI_SMB LIBCLI_SMB2 \ @@ -588,6 +585,10 @@ PUBLIC_DEPENDENCIES = CREDENTIALS # End SUBSYSTEM dcerpc ################################################ +PC_FILES += librpc/dcerpc.pc +dcerpc_VERSION = 0.0.1 +dcerpc_SOVERSION = 0 + dcerpc_OBJ_FILES = $(addprefix librpc/rpc/, dcerpc.o dcerpc_auth.o dcerpc_schannel.o dcerpc_util.o \ dcerpc_error.o dcerpc_smb.o dcerpc_smb2.o dcerpc_sock.o dcerpc_connect.o dcerpc_secondary.o) diff --git a/source4/param/config.mk b/source4/param/config.mk index fcec88fc27..42cb6f3c1c 100644 --- a/source4/param/config.mk +++ b/source4/param/config.mk @@ -1,10 +1,10 @@ [LIBRARY::LIBSAMBA-HOSTCONFIG] -VERSION = 0.0.1 -SO_VERSION = 0 -PC_FILE = samba-hostconfig.pc PUBLIC_DEPENDENCIES = LIBSAMBA-UTIL PRIVATE_DEPENDENCIES = DYNCONFIG LIBREPLACE_EXT CHARSET +LIBSAMBA-HOSTCONFIG_VERSION = 0.0.1 +LIBSAMBA-HOSTCONFIG-SOVERSION = 0 + LIBSAMBA-HOSTCONFIG_OBJ_FILES = param/loadparm.o \ param/generic.o \ param/util.o \ @@ -12,6 +12,8 @@ LIBSAMBA-HOSTCONFIG_OBJ_FILES = param/loadparm.o \ PUBLIC_HEADERS += param/param.h +PC_FILES += param/samba-hostconfig.pc + [SUBSYSTEM::PROVISION] PRIVATE_DEPENDENCIES = LIBPYTHON diff --git a/source4/torture/config.mk b/source4/torture/config.mk index dc2b1c5c5e..e6c54022c2 100644 --- a/source4/torture/config.mk +++ b/source4/torture/config.mk @@ -1,8 +1,5 @@ # TORTURE subsystem [LIBRARY::torture] -SO_VERSION = 0 -VERSION = 0.0.1 -PC_FILE = torture.pc PRIVATE_PROTO_HEADER = proto.h PUBLIC_DEPENDENCIES = \ LIBSAMBA-HOSTCONFIG \ @@ -10,7 +7,7 @@ PUBLIC_DEPENDENCIES = \ LIBTALLOC \ LIBPOPT - +PC_FILES += torture/torture.pc torture_OBJ_FILES = $(addprefix torture/, torture.o ui.o) PUBLIC_HEADERS += torture/torture.h torture/ui.h @@ -19,7 +16,7 @@ PUBLIC_HEADERS += torture/torture.h torture/ui.h PRIVATE_DEPENDENCIES = LIBCLI_RAW LIBPYTHON smbcalls PROVISION PUBLIC_DEPENDENCIES = POPT_CREDENTIALS -TORTURE_UTIL_OBJ_FILES = torture/util_smb.o +TORTURE_UTIL_OBJ_FILES = $(addprefix torture/, util_smb.o) ################################# # Start SUBSYSTEM TORTURE_BASIC -- cgit From 98a4dd9b5eda6f0eb94bffe6b97f5fbccef41208 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 15 Apr 2008 03:59:56 +0200 Subject: Fix ALL_OBJS value. (This used to be commit 8710087728cc44761ae85f66c541ab1650e1b952) --- source4/build/smb_build/main.pl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source4/build/smb_build/main.pl b/source4/build/smb_build/main.pl index 0e42155537..14897840a6 100644 --- a/source4/build/smb_build/main.pl +++ b/source4/build/smb_build/main.pl @@ -44,8 +44,7 @@ my $mkenv = new smb_build::makefile(\%config::config, $mkfile); my $shared_libs_used = 0; foreach my $key (values %$OUTPUT) { - $mkenv->_prepare_list($key, "OBJ_LIST"); - push(@{$mkenv->{all_objs}}, "\$($key->{NAME}_OBJ_LIST)"); + push(@{$mkenv->{all_objs}}, "\$($key->{NAME}_OBJ_FILES)"); } foreach my $key (values %$OUTPUT) { -- cgit From 223df634c888092cd2528aca6fcdf78a4de0246f Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 15 Apr 2008 04:08:28 +0200 Subject: Work around 'test' quirks - use make's string comparison instead. (This used to be commit 434b61623ecfd846f043ee92c833e92cf905e7b4) --- source4/build/smb_build/makefile.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm index 81aac2fc46..8f3f1701b7 100644 --- a/source4/build/smb_build/makefile.pm +++ b/source4/build/smb_build/makefile.pm @@ -244,7 +244,9 @@ $ctx->{RESULT_SHARED_LIBRARY}: \$($ctx->{NAME}_DEPEND_LIST) \$($ctx->{NAME}_FULL __EOD__ ); if ($ctx->{LIBRARY_REALNAME} ne $ctx->{LIBRARY_SONAME}) { - $self->output("\t\@test \$($ctx->{NAME}_VERSION) = \$($ctx->{NAME}_SOVERSION) || ln -fs $ctx->{LIBRARY_REALNAME} $ctx->{SHAREDDIR}/$ctx->{LIBRARY_SONAME}\n"); + $self->output("ifneq (\$($ctx->{NAME}_VERSION),\$($ctx->{NAME}_SOVERSION))\n"); + $self->output("\t\@ln -fs $ctx->{LIBRARY_REALNAME} $ctx->{SHAREDDIR}/$ctx->{LIBRARY_SONAME}\n"); + $self->output("endif\n"); } $self->output("ifdef $ctx->{NAME}_SOVERSION\n"); $self->output("\t\@ln -fs $ctx->{LIBRARY_REALNAME} $ctx->{SHAREDDIR}/$ctx->{LIBRARY_DEBUGNAME}\n"); -- cgit From afaba23131dc079be3cd92e87495ec8b2ebdc4ae Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 15 Apr 2008 09:13:32 +0200 Subject: Add blackbox test for ndrdump, to ensure it at least does not segfault. Andrew Bartlett (This used to be commit d2fe61a13a8368ceae30c6e7320c8d3d62fbc485) --- source4/selftest/samba4_tests.sh | 1 + testprogs/blackbox/ndrdump/samr-CreateUser-in.dat | Bin 0 -> 60 bytes testprogs/blackbox/ndrdump/samr-CreateUser-out.dat | Bin 0 -> 32 bytes testprogs/blackbox/test_ndrdump.sh | 33 +++++++++++++++++++++ 4 files changed, 34 insertions(+) create mode 100644 testprogs/blackbox/ndrdump/samr-CreateUser-in.dat create mode 100644 testprogs/blackbox/ndrdump/samr-CreateUser-out.dat create mode 100644 testprogs/blackbox/test_ndrdump.sh diff --git a/source4/selftest/samba4_tests.sh b/source4/selftest/samba4_tests.sh index d52c240b93..ed5e46cf03 100755 --- a/source4/selftest/samba4_tests.sh +++ b/source4/selftest/samba4_tests.sh @@ -265,6 +265,7 @@ fi bbdir=$incdir/../../testprogs/blackbox +plantest "blackbox.ndrdump" dc $bbdir/test_ndrdump.sh plantest "blackbox.smbclient" dc $bbdir/test_smbclient.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$PREFIX" plantest "blackbox.kinit" dc $bbdir/test_kinit.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$REALM" "\$DOMAIN" "$PREFIX" $CONFIGURATION plantest "blackbox.cifsdd" dc $bbdir/test_cifsdd.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" diff --git a/testprogs/blackbox/ndrdump/samr-CreateUser-in.dat b/testprogs/blackbox/ndrdump/samr-CreateUser-in.dat new file mode 100644 index 0000000000..a5840e1f7f Binary files /dev/null and b/testprogs/blackbox/ndrdump/samr-CreateUser-in.dat differ diff --git a/testprogs/blackbox/ndrdump/samr-CreateUser-out.dat b/testprogs/blackbox/ndrdump/samr-CreateUser-out.dat new file mode 100644 index 0000000000..cf9131dba9 Binary files /dev/null and b/testprogs/blackbox/ndrdump/samr-CreateUser-out.dat differ diff --git a/testprogs/blackbox/test_ndrdump.sh b/testprogs/blackbox/test_ndrdump.sh new file mode 100644 index 0000000000..38c33ad3c1 --- /dev/null +++ b/testprogs/blackbox/test_ndrdump.sh @@ -0,0 +1,33 @@ +#!/bin/sh +# Blackbox tests for masktest +# Copyright (C) 2008 Andrew Tridgell +# Copyright (C) 2008 Andrew Bartlett +# based on test_smbclient.sh + +failed=0 + +samba4bindir=`dirname $0`/../../source/bin +ndrdump=$samba4bindir/ndrdump +files=`dirname $0`/ndrdump + +testit() { + name="$1" + shift + cmdline="$*" + echo "test: $name" + $cmdline + status=$? + if [ x$status = x0 ]; then + echo "success: $name" + else + echo "failure: $name" + fi + return $status +} + +testit "ndrdump with in" $VALGRIND $ndrdump samr samr_CreateUser in $files/samr-CreateUser-in.dat $@ || failed=`expr $failed + 1` +testit "ndrdump with out" $VALGRIND $ndrdump samr samr_CreateUser out $files/samr-CreateUser-out.dat $@ || failed=`expr $failed + 1` +testit "ndrdump with --context-file" $VALGRIND $ndrdump --context-file $files/samr-CreateUser-in.dat samr samr_CreateUser out $files/samr-CreateUser-out.dat $@ || failed=`expr $failed + 1` +testit "ndrdump with validate" $VALGRIND $ndrdump --validate samr samr_CreateUser in $files/samr-CreateUser-in.dat $@ || failed=`expr $failed + 1` + +exit $failed -- cgit From 5a18f0d82b0c9518d5f1a5792cbbb7a49b60a88b Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 15 Apr 2008 10:05:29 +0200 Subject: Test a few more bits of smbclient (This used to be commit 24a2409d725953ed5f62c652acc929ee7ddf9a19) --- testprogs/blackbox/test_smbclient.sh | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/testprogs/blackbox/test_smbclient.sh b/testprogs/blackbox/test_smbclient.sh index a803d83363..4df64cac94 100755 --- a/testprogs/blackbox/test_smbclient.sh +++ b/testprogs/blackbox/test_smbclient.sh @@ -86,11 +86,29 @@ testit "Comparing files" diff tmpfile-old tmpfile || failed=`expr $failed + 1` runcmd "Creating directory, Changing directory, Going back" 'mkdir bla; cd bla; cd ..; rmdir bla' || failed=`expr $failed + 1` # enable recurse, create nested directory runcmd "Creating nested directory" 'mkdir bla/bloe' || failed=`expr $failed + 1` -# remove parent directory -runcmd "Removing directory" 'rmdir bla/bloe' || failed=`expr $failed + 1` # remove child directory +runcmd "Removing directory" 'rmdir bla/bloe' || failed=`expr $failed + 1` +# remove parent directory runcmd "Removing directory" 'rmdir bla'|| failed=`expr $failed + 1` +# enable recurse, create nested directory +runcmd "Creating nested directory" 'mkdir bla' || failed=`expr $failed + 1` +# rename bla to bla2 +runcmd "rename of nested directory" 'rename bla bla2' || failed=`expr $failed + 1` +# deltree +runcmd "deltree of nested directory" 'deltree bla2' || failed=`expr $failed + 1` # run fsinfo +runcmd "Getting file system info" 'fsinfo allocation'|| failed=`expr $failed + 1` +runcmd "Getting file system info" 'fsinfo volume'|| failed=`expr $failed + 1` +runcmd "Getting file system info" 'fsinfo volumeinfo'|| failed=`expr $failed + 1` +runcmd "Getting file system info" 'fsinfo sizeinfo'|| failed=`expr $failed + 1` +runcmd "Getting file system info" 'fsinfo deviceinfo'|| failed=`expr $failed + 1` +runcmd "Getting file system info" 'fsinfo attributeinfo'|| failed=`expr $failed + 1` +runcmd "Getting file system info" 'fsinfo volume-information'|| failed=`expr $failed + 1` +runcmd "Getting file system info" 'fsinfo size-information'|| failed=`expr $failed + 1` +runcmd "Getting file system info" 'fsinfo device-information'|| failed=`expr $failed + 1` +runcmd "Getting file system info" 'fsinfo attribute-information'|| failed=`expr $failed + 1` +runcmd "Getting file system info" 'fsinfo quota-information'|| failed=`expr $failed + 1` +runcmd "Getting file system info" 'fsinfo fullsize-information'|| failed=`expr $failed + 1` runcmd "Getting file system info" 'fsinfo objectid'|| failed=`expr $failed + 1` # put that file @@ -98,6 +116,7 @@ runcmd "Putting file" 'put tmpfile'|| failed=`expr $failed + 1` # get that file mv tmpfile tmpfile-old runcmd "Getting file" 'get tmpfile'|| failed=`expr $failed + 1` +runcmd "Getting file EA info" 'eainfo tmpfile'|| failed=`expr $failed + 1` # remove that file runcmd "Removing file" 'rm tmpfile' || failed=`expr $failed + 1` # compare locally @@ -111,6 +130,11 @@ testit "Comparing files" diff tmpfilex tmpfile || failed=`expr $failed + 1` # remove that file runcmd "Removing file" 'rm tmpfilex'|| failed=`expr $failed + 1` +runcmd "Lookup name" "lookup $DOMAIN\\$USERNAME" || failed=`expr $failed + 1` + +#Fails unless there are privilages +#runcmd "Lookup privs of name" "privileges $DOMAIN\\$USERNAME" || failed=`expr $failed + 1` + # do some simple operations using old protocol versions runcmd "List directory with LANMAN1" 'ls' -m LANMAN1 || failed=`expr $failed + 1` runcmd "List directory with LANMAN2" 'ls' -m LANMAN2 || failed=`expr $failed + 1` -- cgit From c7d95967643e3acac0b2f03b107f90d44a99ed66 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 15 Apr 2008 10:40:06 +0200 Subject: Test password change with 'net password change'. Andrew Bartlett (This used to be commit 695cee0349f561625e4bbfa3a142a5e35f7eb4bf) --- testprogs/blackbox/test_kinit.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/testprogs/blackbox/test_kinit.sh b/testprogs/blackbox/test_kinit.sh index dbcdcf1112..29582055ee 100755 --- a/testprogs/blackbox/test_kinit.sh +++ b/testprogs/blackbox/test_kinit.sh @@ -86,6 +86,14 @@ testit "kinit with user password" $samba4bindir/samba4kinit --password-file=./tm test_smbclient "Test login with user kerberos ccache" 'ls' -k yes || failed=`expr $failed + 1` +NEWUSERPASS=testPaSS@34% +testit "change user password" $VALGRIND $net password change -W$DOMAIN -U$DOMAIN\\nettestuser%$USERPASS $CONFIGURATION -k no $NEWUSERPASS $@ || failed=`expr $failed + 1` + +echo $NEWUSERPASS > ./tmpuserpassfile +testit "kinit with user password" $samba4bindir/samba4kinit --password-file=./tmpuserpassfile --request-pac nettestuser@$REALM || failed=`expr $failed + 1` + +test_smbclient "Test login with user kerberos ccache" 'ls' -k yes || failed=`expr $failed + 1` + KRB5CCNAME="$PREFIX/tmpccache" export KRB5CCNAME -- cgit From c937efc1a6f7c117119bc43b91c8554825b5a9f9 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 15 Apr 2008 10:55:32 +0200 Subject: Attempt to fix the pidl installation on fedora. (This used to be commit 4dd29284bdffc96df1d6eb71b25e305f107d1e12) --- source4/pidl/config.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source4/pidl/config.mk b/source4/pidl/config.mk index 38542f5b7f..25cea495a7 100644 --- a/source4/pidl/config.mk +++ b/source4/pidl/config.mk @@ -1,5 +1,5 @@ pidl/Makefile: pidl/Makefile.PL - cd pidl && $(PERL) Makefile.PL + cd pidl && $(PERL) Makefile.PL PREFIX=$(prefix) pidl-testcov: pidl/Makefile cd pidl && cover -test -- cgit From 1a8bfba5452f7b72d9f0b2a178f7e8a66557c463 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 15 Apr 2008 12:15:43 +0200 Subject: Fix warnings. (This used to be commit 88013ca9775a6ff5e5a393f9d8238dbcd197f26f) --- source4/libcli/ldap/ldap_ndr.h | 2 ++ source4/scripting/python/uuidmodule.c | 4 ++-- source4/torture/ndr/netlogon.c | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/source4/libcli/ldap/ldap_ndr.h b/source4/libcli/ldap/ldap_ndr.h index dfbb723c36..ee1f702c78 100644 --- a/source4/libcli/ldap/ldap_ndr.h +++ b/source4/libcli/ldap/ldap_ndr.h @@ -1,6 +1,8 @@ #ifndef __LIBCLI_LDAP_LDAP_NDR_H__ #define __LIBCLI_LDAP_LDAP_NDR_H__ +#include "librpc/gen_ndr/ndr_misc.h" + char *ldap_encode_ndr_uint32(TALLOC_CTX *mem_ctx, uint32_t value); char *ldap_encode_ndr_dom_sid(TALLOC_CTX *mem_ctx, const struct dom_sid *sid); char *ldap_encode_ndr_GUID(TALLOC_CTX *mem_ctx, struct GUID *guid); diff --git a/source4/scripting/python/uuidmodule.c b/source4/scripting/python/uuidmodule.c index cd9a1cb4d5..18cfb6ce32 100644 --- a/source4/scripting/python/uuidmodule.c +++ b/source4/scripting/python/uuidmodule.c @@ -27,7 +27,7 @@ static PyObject *uuid_random(PyObject *self, PyObject *args) PyObject *pyobj; char *str; - if (!PyArg_ParseTuple(args, (char *)"")) + if (!PyArg_ParseTuple(args, "")) return NULL; guid = GUID_random(); @@ -52,7 +52,7 @@ static PyMethodDef methods[] = { void inituuid(void) { - PyObject *mod = Py_InitModule3((char *)"uuid", methods, "UUID helper routines"); + PyObject *mod = Py_InitModule3("uuid", methods, "UUID helper routines"); if (mod == NULL) return; } diff --git a/source4/torture/ndr/netlogon.c b/source4/torture/ndr/netlogon.c index f498335bda..a5221f71e9 100644 --- a/source4/torture/ndr/netlogon.c +++ b/source4/torture/ndr/netlogon.c @@ -80,7 +80,7 @@ static const uint8_t netrserverreqchallenge_in_data[] = { }; static bool netrserverreqchallenge_in_check(struct torture_context *tctx, - struct netr_ServerReqChallenge *r) + struct netr_ServerReqChallenge *r) { uint8_t cred_expected[8] = { 0xa3, 0x2c, 0xa2, 0x95, 0x40, 0xcc, 0xb7, 0xbb }; torture_assert_str_equal(tctx, r->in.server_name, "\\\\NATIVE-DC.NATIVE.BASE", "server name"); @@ -95,7 +95,7 @@ static const uint8_t netrserverreqchallenge_out_data[] = { }; static bool netrserverreqchallenge_out_check(struct torture_context *tctx, - struct netr_ServerReqChallenge *r) + struct netr_ServerReqChallenge *r) { uint8_t cred_expected[8] = { 0x22, 0xfc, 0xc1, 0x17, 0xc0, 0xae, 0x27, 0x8e }; torture_assert_mem_equal(tctx, cred_expected, r->out.credentials->data, 8, "credentials"); -- cgit From 983b66b8f16ba4e06a8b239e5c4191e3f0245481 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 15 Apr 2008 12:51:31 +0200 Subject: Saner names for Python objects. (This used to be commit f4de8d2c1c956bc85b91dc7aab20e5e7671f51bc) --- source4/scripting/python/pytalloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source4/scripting/python/pytalloc.c b/source4/scripting/python/pytalloc.c index d8d3efe69c..aa0ae9bf90 100644 --- a/source4/scripting/python/pytalloc.c +++ b/source4/scripting/python/pytalloc.c @@ -39,7 +39,7 @@ PyObject *py_talloc_import_ex(PyTypeObject *py_type, TALLOC_CTX *mem_ctx, PyObject *py_talloc_default_repr(PyObject *py_obj) { py_talloc_Object *obj = (py_talloc_Object *)py_obj; + PyTypeObject *type = (PyTypeObject*)PyObject_Type((PyObject *)obj); - return PyString_FromFormat("", - talloc_get_name(obj->talloc_ctx)); + return PyString_FromFormat("<%s>", type->tp_name); } -- cgit From fd52fe86169ddc0adda2d1cd97215c58d06f93c4 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 15 Apr 2008 14:32:13 +0200 Subject: Fix pointers when pushing strings to python during pidl generation. (This used to be commit ca72187b3e71a037780d42a57e46b60e75f724f6) --- source4/pidl/lib/Parse/Pidl/Samba4/Python.pm | 11 +++++------ source4/scripting/python/samba/tests/dcerpc/unix.py | 2 ++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm index acaea99f6d..2d12da358c 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm @@ -952,16 +952,15 @@ sub ConvertObjectToPythonLevel($$$$$) $self->pidl("}"); } } elsif ($l->{TYPE} eq "ARRAY") { - if (is_charset_array($e, $l)) { + my $pl = GetPrevLevel($e, $l); + if ($pl && $pl->{TYPE} eq "POINTER") { $var_name = get_pointer_to($var_name); + } + + if (is_charset_array($e, $l)) { # FIXME: Use Unix charset setting rather than utf-8 $self->pidl("$py_var = PyUnicode_Decode($var_name, strlen($var_name), \"utf-8\", \"ignore\");"); } else { - my $pl = GetPrevLevel($e, $l); - if ($pl && $pl->{TYPE} eq "POINTER") { - $var_name = get_pointer_to($var_name); - } - die("No SIZE_IS for array $var_name") unless (defined($l->{SIZE_IS})); my $length = $l->{SIZE_IS}; if (defined($l->{LENGTH_IS})) { diff --git a/source4/scripting/python/samba/tests/dcerpc/unix.py b/source4/scripting/python/samba/tests/dcerpc/unix.py index bfddfdc7ec..43978ac9dc 100644 --- a/source4/scripting/python/samba/tests/dcerpc/unix.py +++ b/source4/scripting/python/samba/tests/dcerpc/unix.py @@ -27,6 +27,8 @@ class UnixinfoTests(RpcInterfaceTestCase): def test_getpwuid(self): infos = self.conn.GetPWUid(range(512)) self.assertEquals(512, len(infos)) + self.assertEquals("", infos[0].shell) + self.assertEquals("", infos[0].homedir) def test_gidtosid(self): self.conn.GidToSid(1000) -- cgit From f8f4856ab7330db865d1a35abff3ccaf2ac277ba Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 15 Apr 2008 15:52:52 +0200 Subject: Fix provision-backend script Andrew Bartlett (This used to be commit ee6e4f8da229ddeca856a6db94236367aae06f63) --- source4/scripting/python/samba/provision.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py index a8d188e7a3..45965a2429 100644 --- a/source4/scripting/python/samba/provision.py +++ b/source4/scripting/python/samba/provision.py @@ -1166,6 +1166,7 @@ def provision_backend(setup_dir=None, message=None, "NETBIOSNAME": names.netbiosname, "DEFAULTSITE": DEFAULTSITE, "CONFIGDN": names.configdn, + "SERVERDN": names.serverdn }) setup_add_ldif(schemadb, setup_path("schema_samba4.ldif"), @@ -1241,9 +1242,9 @@ refint_attributes""" + refint_attributes + "\n"; setup_file(setup_path("modules.conf"), paths.modulesconf, {"REALM": names.realm}) - setup_db_config(setup_path, file, os.path.join(paths.ldapdir, "user")) - setup_db_config(setup_path, file, os.path.join(paths.ldapdir, "config")) - setup_db_config(setup_path, file, os.path.join(paths.ldapdir, "schema")) + setup_db_config(setup_path, os.path.join(paths.ldapdir, "user")) + setup_db_config(setup_path, os.path.join(paths.ldapdir, "config")) + setup_db_config(setup_path, os.path.join(paths.ldapdir, "schema")) mapping = "schema-map-openldap-2.3" backend_schema = "backend-schema.schema" -- cgit From 7bb2ebb884c35676a6cf03efe6ecc15b3e232a43 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 15 Apr 2008 16:00:07 +0200 Subject: Fix size to memcpy call in generated Samba 3 client code. Reported-By: vl (This used to be commit a28807569d0cf32968bacdc0bd88197b19fbae49) --- source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm | 65 ++++++++++++++----------- source4/pidl/tests/samba3-cli.pl | 13 ++++- 2 files changed, 47 insertions(+), 31 deletions(-) diff --git a/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm b/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm index 7a2575b897..87ed29b54e 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm @@ -9,7 +9,7 @@ package Parse::Pidl::Samba3::ClientNDR; use Exporter; @ISA = qw(Exporter); -@EXPORT_OK = qw(ParseFunction $res $res_hdr); +@EXPORT_OK = qw(ParseFunction $res $res_hdr ParseOutputArgument); use strict; use Parse::Pidl qw(fatal warning); @@ -73,6 +73,40 @@ sub HeaderProperties($$) } } +sub ParseOutputArgument($$$) +{ + my ($self, $fn, $e) = @_; + my $level = 0; + + fatal($e->{ORIGINAL}, "[out] argument is not a pointer or array") if ($e->{LEVELS}[0]->{TYPE} ne "POINTER" and $e->{LEVELS}[0]->{TYPE} ne "ARRAY"); + + if ($e->{LEVELS}[0]->{TYPE} eq "POINTER") { + $level = 1; + if ($e->{LEVELS}[0]->{POINTER_TYPE} ne "ref") { + $self->pidl("if ($e->{NAME} && r.out.$e->{NAME}) {"); + $self->indent; + } + } + + if ($e->{LEVELS}[$level]->{TYPE} eq "ARRAY") { + # This is a call to GenerateFunctionInEnv intentionally. + # Since the data is being copied into a user-provided data + # structure, the user should be able to know the size beforehand + # to allocate a structure of the right size. + my $env = GenerateFunctionInEnv($fn, "r."); + my $size_is = ParseExpr($e->{LEVELS}[$level]->{SIZE_IS}, $env, $e->{ORIGINAL}); + $self->pidl("memcpy($e->{NAME}, r.out.$e->{NAME}, $size_is * sizeof(*$e->{NAME}));"); + } else { + $self->pidl("*$e->{NAME} = *r.out.$e->{NAME};"); + } + + if ($e->{LEVELS}[0]->{TYPE} eq "POINTER") { + if ($e->{LEVELS}[0]->{POINTER_TYPE} ne "ref") { + $self->deindent; + $self->pidl("}"); + } + } +} sub ParseFunction($$$) { @@ -147,36 +181,9 @@ sub ParseFunction($$$) $self->pidl("/* Return variables */"); foreach my $e (@{$fn->{ELEMENTS}}) { next unless (grep(/out/, @{$e->{DIRECTION}})); - my $level = 0; - fatal($e->{ORIGINAL}, "[out] argument is not a pointer or array") if ($e->{LEVELS}[0]->{TYPE} ne "POINTER" and $e->{LEVELS}[0]->{TYPE} ne "ARRAY"); - - if ($e->{LEVELS}[0]->{TYPE} eq "POINTER") { - $level = 1; - if ($e->{LEVELS}[0]->{POINTER_TYPE} ne "ref") { - $self->pidl("if ($e->{NAME} && r.out.$e->{NAME}) {"); - $self->indent; - } - } + $self->ParseOutputArgument($fn, $e); - if ($e->{LEVELS}[$level]->{TYPE} eq "ARRAY") { - # This is a call to GenerateFunctionInEnv intentionally. - # Since the data is being copied into a user-provided data - # structure, the user should be able to know the size beforehand - # to allocate a structure of the right size. - my $env = GenerateFunctionInEnv($fn, "r."); - my $size_is = ParseExpr($e->{LEVELS}[$level]->{SIZE_IS}, $env, $e->{ORIGINAL}); - $self->pidl("memcpy($e->{NAME}, r.out.$e->{NAME}, $size_is);"); - } else { - $self->pidl("*$e->{NAME} = *r.out.$e->{NAME};"); - } - - if ($e->{LEVELS}[0]->{TYPE} eq "POINTER") { - if ($e->{LEVELS}[0]->{POINTER_TYPE} ne "ref") { - $self->deindent; - $self->pidl("}"); - } - } } $self->pidl(""); diff --git a/source4/pidl/tests/samba3-cli.pl b/source4/pidl/tests/samba3-cli.pl index f5b51b7d34..80725d28cf 100755 --- a/source4/pidl/tests/samba3-cli.pl +++ b/source4/pidl/tests/samba3-cli.pl @@ -4,12 +4,12 @@ use strict; use warnings; -use Test::More tests => 8; +use Test::More tests => 9; use FindBin qw($RealBin); use lib "$RealBin"; use Util; use Parse::Pidl::Util qw(MyDumper); -use Parse::Pidl::Samba3::ClientNDR qw(ParseFunction); +use Parse::Pidl::Samba3::ClientNDR qw(ParseFunction ParseOutputArgument); use Parse::Pidl::Samba4::Header qw(GenerateFunctionInEnv GenerateFunctionOutEnv); # Make sure GenerateFunctionInEnv and GenerateFunctionOutEnv work @@ -117,3 +117,12 @@ is($x->{res}, } "); + +$x = new Parse::Pidl::Samba3::ClientNDR(); + +$fn = { NAME => "bar", ELEMENTS => [ ], RETURN_TYPE => "WERROR" }; +my $e = { NAME => "foo", ORIGINAL => { FILE => "f", LINE => -1 }, + LEVELS => [ { TYPE => "ARRAY", SIZE_IS => "mysize" }, { TYPE => "DATA", DATA_TYPE => "int" } ]}; + +$x->ParseOutputArgument($fn, $e); +is($x->{res}, "memcpy(foo, r.out.foo, mysize * sizeof(*foo));\n"); -- cgit From e0eba5232d3f2cd366b1cbe64fbd3547889c7635 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 15 Apr 2008 16:29:13 +0200 Subject: Fix winbind to check machine account. This enables 'wbinfo -t', by checking the machine account with a SamLogon call. Andrew Bartlett (This used to be commit abefa12029a17e9007f4884f3651d835a10ee9e3) --- source4/winbind/wb_async_helpers.c | 67 ------------------------------ source4/winbind/wb_pam_auth.c | 19 ++------- source4/winbind/wb_samba3_cmd.c | 80 +++++++++++++++++++++++++++--------- source4/winbind/wb_samba3_protocol.c | 3 -- 4 files changed, 63 insertions(+), 106 deletions(-) diff --git a/source4/winbind/wb_async_helpers.c b/source4/winbind/wb_async_helpers.c index 662dd111dd..25d52a16b5 100644 --- a/source4/winbind/wb_async_helpers.c +++ b/source4/winbind/wb_async_helpers.c @@ -305,73 +305,6 @@ NTSTATUS wb_lsa_lookupnames_recv(struct composite_context *c, talloc_free(c); return status; } - - -#if 0 - -struct cmd_checkmachacc_state { - struct composite_context *ctx; - struct wbsrv_call *call; - struct wbsrv_domain *domain; -}; - -static void cmd_checkmachacc_recv_init(struct composite_context *ctx); - - struct composite_context *wb_cmd_checkmachacc_send(struct wbsrv_call *call) -{ - struct composite_context *result, *ctx; - struct cmd_checkmachacc_state *state; - struct wbsrv_service *service = call->wbconn->listen_socket->service; - - result = composite_create(mem_ctx, call->event_ctx; - if (result == NULL) goto failed; - - state = talloc(result, struct cmd_checkmachacc_state); - if (state == NULL) goto failed; - state->ctx = result; - result->private_data = state; - state->call = call; - - state->domain = service->domains; - - ctx = wb_init_domain_send(service, state->domain); - if (ctx == NULL) goto failed; - ctx->async.fn = cmd_checkmachacc_recv_init; - ctx->async.private_data = state; - - return result; - - failed: - talloc_free(result); - return NULL; -} - -static void cmd_checkmachacc_recv_init(struct composite_context *ctx) -{ - struct cmd_checkmachacc_state *state = - talloc_get_type(ctx->async.private_data, - struct cmd_checkmachacc_state); - - state->ctx->status = wb_init_domain_recv(ctx); - if (!composite_is_ok(state->ctx)) return; - - composite_done(state->ctx); -} - - NTSTATUS wb_cmd_checkmachacc_recv(struct composite_context *c) -{ - NTSTATUS status = composite_wait(c); - talloc_free(c); - return status; -} - - NTSTATUS wb_cmd_checkmachacc(struct wbsrv_call *call) -{ - struct composite_context *c = wb_cmd_checkmachacc_send(call); - return wb_cmd_checkmachacc_recv(c); -} -#endif - struct samr_getuserdomgroups_state { struct composite_context *ctx; struct dcerpc_pipe *samr_pipe; diff --git a/source4/winbind/wb_pam_auth.c b/source4/winbind/wb_pam_auth.c index 62744297c6..ee54bcd58f 100644 --- a/source4/winbind/wb_pam_auth.c +++ b/source4/winbind/wb_pam_auth.c @@ -214,14 +214,11 @@ NTSTATUS wb_cmd_pam_auth_crap_recv(struct composite_context *c, struct composite_context *wb_cmd_pam_auth_send(TALLOC_CTX *mem_ctx, struct wbsrv_service *service, - const char *domain, - const char *user, - const char *password) + struct cli_credentials *credentials) { - struct cli_credentials *credentials; const char *workstation; NTSTATUS status; - + const char *user, *domain; DATA_BLOB chal, nt_resp, lm_resp, names_blob; int flags = CLI_CRED_NTLM_AUTH; if (lp_client_lanman_auth(service->task->lp_ctx)) { @@ -234,16 +231,6 @@ struct composite_context *wb_cmd_pam_auth_send(TALLOC_CTX *mem_ctx, DEBUG(5, ("wbsrv_samba3_pam_auth called\n")); - credentials = cli_credentials_init(mem_ctx); - if (!credentials) { - return NULL; - } - cli_credentials_set_conf(credentials, service->task->lp_ctx); - cli_credentials_set_domain(credentials, domain, CRED_SPECIFIED); - cli_credentials_set_username(credentials, user, CRED_SPECIFIED); - - cli_credentials_set_password(credentials, password, CRED_SPECIFIED); - chal = data_blob_talloc(mem_ctx, NULL, 8); if (!chal.data) { return NULL; @@ -269,7 +256,7 @@ struct composite_context *wb_cmd_pam_auth_send(TALLOC_CTX *mem_ctx, return NULL; } return wb_cmd_pam_auth_crap_send(mem_ctx, service, - 0 /* logon parameters */, + MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT|MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT /* logon parameters */, domain, user, workstation, chal, nt_resp, lm_resp); } diff --git a/source4/winbind/wb_samba3_cmd.c b/source4/winbind/wb_samba3_cmd.c index 24074700fc..8ae330df35 100644 --- a/source4/winbind/wb_samba3_cmd.c +++ b/source4/winbind/wb_samba3_cmd.c @@ -30,6 +30,8 @@ #include "librpc/gen_ndr/netlogon.h" #include "libcli/security/security.h" #include "auth/pam_errors.h" +#include "auth/credentials/credentials.h" +#include "smbd/service_task.h" /* Send off the reply to an async Samba3 query, handling filling in the PAM, NTSTATUS and string errors. @@ -110,10 +112,12 @@ NTSTATUS wbsrv_samba3_netbios_name(struct wbsrv_samba3_call *s3call) NTSTATUS wbsrv_samba3_priv_pipe_dir(struct wbsrv_samba3_call *s3call) { - s3call->response.result = WINBINDD_OK; - s3call->response.extra_data.data = - smbd_tmp_path(s3call, s3call->wbconn->lp_ctx, WINBINDD_SAMBA3_PRIVILEGED_SOCKET); - NT_STATUS_HAVE_NO_MEMORY(s3call->response.extra_data.data); + char *path = smbd_tmp_path(s3call, s3call->wbconn->lp_ctx, WINBINDD_SAMBA3_PRIVILEGED_SOCKET); + NT_STATUS_HAVE_NO_MEMORY(path); + s3call->response.result = WINBINDD_OK; + s3call->response.extra_data.data = path; + + s3call->response.length += strlen(path) + 1; return NT_STATUS_OK; } @@ -123,41 +127,67 @@ NTSTATUS wbsrv_samba3_ping(struct wbsrv_samba3_call *s3call) return NT_STATUS_OK; } -#if 0 -/* - Validate that we have a working pipe to the domain controller. - Return any NT error found in the process +/* Plaintext authentication + + This interface is used by ntlm_auth in it's 'basic' authentication + mode, as well as by pam_winbind to authenticate users where we are + given a plaintext password. */ -static void checkmachacc_recv_creds(struct composite_context *ctx); +static void check_machacc_recv(struct composite_context *ctx); NTSTATUS wbsrv_samba3_check_machacc(struct wbsrv_samba3_call *s3call) { + NTSTATUS status; + struct cli_credentials *creds; struct composite_context *ctx; + struct wbsrv_service *service = + s3call->wbconn->listen_socket->service; + + /* Create a credentials structure */ + creds = cli_credentials_init(s3call); + if (creds == NULL) { + return NT_STATUS_NO_MEMORY; + } - DEBUG(5, ("wbsrv_samba3_check_machacc called\n")); + cli_credentials_set_event_context(creds, service->task->event_ctx); - ctx = wb_cmd_checkmachacc_send(s3call->call); - NT_STATUS_HAVE_NO_MEMORY(ctx); + cli_credentials_set_conf(creds, service->task->lp_ctx); + + /* Connect the machine account to the credentials */ + status = cli_credentials_set_machine_account(creds, service->task->lp_ctx); + if (!NT_STATUS_IS_OK(status)) { + talloc_free(creds); + return status; + } + + ctx = wb_cmd_pam_auth_send(s3call, service, creds); + + if (!ctx) { + talloc_free(creds); + return NT_STATUS_NO_MEMORY; + } - ctx->async.fn = checkmachacc_recv_creds; + ctx->async.fn = check_machacc_recv; ctx->async.private_data = s3call; - s3call->call->flags |= WBSRV_CALL_FLAGS_REPLY_ASYNC; + s3call->flags |= WBSRV_CALL_FLAGS_REPLY_ASYNC; return NT_STATUS_OK; } - -static void checkmachacc_recv_creds(struct composite_context *ctx) + +static void check_machacc_recv(struct composite_context *ctx) { struct wbsrv_samba3_call *s3call = talloc_get_type(ctx->async.private_data, struct wbsrv_samba3_call); NTSTATUS status; - status = wb_cmd_checkmachacc_recv(ctx); + status = wb_cmd_pam_auth_recv(ctx); + + if (!NT_STATUS_IS_OK(status)) goto done; + done: wbsrv_samba3_async_auth_epilogue(status, s3call); } -#endif /* Find the name of a suitable domain controller, by query on the @@ -543,6 +573,7 @@ NTSTATUS wbsrv_samba3_pam_auth(struct wbsrv_samba3_call *s3call) struct composite_context *ctx; struct wbsrv_service *service = s3call->wbconn->listen_socket->service; + struct cli_credentials *credentials; char *user, *domain; if (!wb_samba3_split_username(s3call, s3call->wbconn->lp_ctx, @@ -551,8 +582,17 @@ NTSTATUS wbsrv_samba3_pam_auth(struct wbsrv_samba3_call *s3call) return NT_STATUS_NO_SUCH_USER; } - ctx = wb_cmd_pam_auth_send(s3call, service, domain, user, - s3call->request.data.auth.pass); + credentials = cli_credentials_init(s3call); + if (!credentials) { + return NT_STATUS_NO_MEMORY; + } + cli_credentials_set_conf(credentials, service->task->lp_ctx); + cli_credentials_set_domain(credentials, domain, CRED_SPECIFIED); + cli_credentials_set_username(credentials, user, CRED_SPECIFIED); + + cli_credentials_set_password(credentials, s3call->request.data.auth.pass, CRED_SPECIFIED); + + ctx = wb_cmd_pam_auth_send(s3call, service, credentials); NT_STATUS_HAVE_NO_MEMORY(ctx); ctx->async.fn = pam_auth_recv; diff --git a/source4/winbind/wb_samba3_protocol.c b/source4/winbind/wb_samba3_protocol.c index b252273cb6..3b97dff276 100644 --- a/source4/winbind/wb_samba3_protocol.c +++ b/source4/winbind/wb_samba3_protocol.c @@ -78,10 +78,8 @@ NTSTATUS wbsrv_samba3_handle_call(struct wbsrv_samba3_call *s3call) case WINBINDD_INTERFACE_VERSION: return wbsrv_samba3_interface_version(s3call); -#if 0 case WINBINDD_CHECK_MACHACC: return wbsrv_samba3_check_machacc(s3call); -#endif case WINBINDD_PING: return wbsrv_samba3_ping(s3call); @@ -187,7 +185,6 @@ NTSTATUS wbsrv_samba3_handle_call(struct wbsrv_samba3_call *s3call) case WINBINDD_SET_MAPPING: case WINBINDD_SET_HWM: case WINBINDD_DUMP_MAPS: - case WINBINDD_CHECK_MACHACC: case WINBINDD_DOMAIN_INFO: case WINBINDD_SHOW_SEQUENCE: case WINBINDD_WINS_BYIP: -- cgit From cb5873f36d5f67b51afd9327df114ff7c1b529d0 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 15 Apr 2008 16:31:08 +0200 Subject: Fix some of the winbind tests. Some of the test expectations were incorrect. Andrew Bartlett (This used to be commit bc0e94360edb99e967dac01a3ecff42de0c1c222) --- source4/selftest/samba4_tests.sh | 2 +- source4/selftest/target/Samba4.pm | 2 +- source4/torture/winbind/struct_based.c | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/source4/selftest/samba4_tests.sh b/source4/selftest/samba4_tests.sh index ed5e46cf03..3a3e1f91b1 100755 --- a/source4/selftest/samba4_tests.sh +++ b/source4/selftest/samba4_tests.sh @@ -302,7 +302,7 @@ done WB_OPTS="--option=\"torture:strict mode=yes\"" WB_OPTS="${WB_OPTS} --option=\"torture:timelimit=1\"" -WB_OPTS="${WB_OPTS} --option=\"torture:winbindd separator=\\\\\"" +WB_OPTS="${WB_OPTS} --option=\"torture:winbindd separator=/\"" WB_OPTS="${WB_OPTS} --option=\"torture:winbindd private pipe dir=\$WINBINDD_PRIV_PIPE_DIR\"" WB_OPTS="${WB_OPTS} --option=\"torture:winbindd netbios name=\$SERVER\"" WB_OPTS="${WB_OPTS} --option=\"torture:winbindd netbios domain=\$DOMAIN\"" diff --git a/source4/selftest/target/Samba4.pm b/source4/selftest/target/Samba4.pm index 552f6535af..069aff73cf 100644 --- a/source4/selftest/target/Samba4.pm +++ b/source4/selftest/target/Samba4.pm @@ -521,7 +521,7 @@ sub provision($$$$$$) my $ncalrpcdir = "$prefix_abs/ncalrpc"; my $lockdir = "$prefix_abs/lockdir"; my $winbindd_socket_dir = "$prefix_abs/winbind_socket"; - my $winbindd_priv_pipe_dir = "$piddir/smbd.tmp/winbind_pipe"; + my $winbindd_priv_pipe_dir = "$privatedir/smbd.tmp/winbind_pipe"; my $nsswrap_passwd = "$etcdir/passwd"; my $nsswrap_group = "$etcdir/group"; diff --git a/source4/torture/winbind/struct_based.c b/source4/torture/winbind/struct_based.c index 0fe2148b75..51ac0e622a 100644 --- a/source4/torture/winbind/struct_based.c +++ b/source4/torture/winbind/struct_based.c @@ -181,7 +181,8 @@ static bool torture_winbind_struct_netbios_name(struct torture_context *torture) expected = torture_setting_string(torture, "winbindd netbios name", lp_netbios_name(torture->lp_ctx)); - + expected = strupper_talloc(torture, expected); + torture_assert_str_equal(torture, rep.data.netbios_name, expected, "winbindd's netbios name doesn't match"); -- cgit From 2ddd23a8754258b7322f37a0e0b97587b23f338b Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 15 Apr 2008 17:10:47 +0200 Subject: Re-add 'db' subdirectory for LDAP backend provision Andrew Bartlett (This used to be commit 19890c0d15adf4f099365f276a4bfdd3f4de52b6) --- source4/scripting/python/samba/provision.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py index 45965a2429..0e8840646c 100644 --- a/source4/scripting/python/samba/provision.py +++ b/source4/scripting/python/samba/provision.py @@ -1242,9 +1242,9 @@ refint_attributes""" + refint_attributes + "\n"; setup_file(setup_path("modules.conf"), paths.modulesconf, {"REALM": names.realm}) - setup_db_config(setup_path, os.path.join(paths.ldapdir, "user")) - setup_db_config(setup_path, os.path.join(paths.ldapdir, "config")) - setup_db_config(setup_path, os.path.join(paths.ldapdir, "schema")) + setup_db_config(setup_path, os.path.join(paths.ldapdir, os.path.join("db", "user"))) + setup_db_config(setup_path, os.path.join(paths.ldapdir, os.path.join("db", "config"))) + setup_db_config(setup_path, os.path.join(paths.ldapdir, os.path.join("db", "schema"))) mapping = "schema-map-openldap-2.3" backend_schema = "backend-schema.schema" -- cgit From b708a3d1e7f8d98bc6cedad8d405b1434d32a22e Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 15 Apr 2008 18:03:09 +0200 Subject: Split binding structure handling out into a separate file. For easier synchronisation with Samba 3. (This used to be commit b9cac469f3c869a26f415a6c551cf6e8fbb06ed6) --- source4/librpc/config.mk | 1 + source4/librpc/rpc/binding.c | 724 +++++++++++++++++++++++++++++++++++++++ source4/librpc/rpc/dcerpc_util.c | 695 ------------------------------------- 3 files changed, 725 insertions(+), 695 deletions(-) create mode 100644 source4/librpc/rpc/binding.c diff --git a/source4/librpc/config.mk b/source4/librpc/config.mk index 92409da20e..11a320a583 100644 --- a/source4/librpc/config.mk +++ b/source4/librpc/config.mk @@ -590,6 +590,7 @@ dcerpc_VERSION = 0.0.1 dcerpc_SOVERSION = 0 dcerpc_OBJ_FILES = $(addprefix librpc/rpc/, dcerpc.o dcerpc_auth.o dcerpc_schannel.o dcerpc_util.o \ + binding.o \ dcerpc_error.o dcerpc_smb.o dcerpc_smb2.o dcerpc_sock.o dcerpc_connect.o dcerpc_secondary.o) diff --git a/source4/librpc/rpc/binding.c b/source4/librpc/rpc/binding.c new file mode 100644 index 0000000000..ae88dce1be --- /dev/null +++ b/source4/librpc/rpc/binding.c @@ -0,0 +1,724 @@ +/* + Unix SMB/CIFS implementation. + + dcerpc utility functions + + Copyright (C) Andrew Tridgell 2003 + Copyright (C) Jelmer Vernooij 2004 + Copyright (C) Andrew Bartlett 2005 + Copyright (C) Rafal Szczesniak 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 "lib/events/events.h" +#include "librpc/gen_ndr/ndr_epmapper_c.h" +#include "librpc/gen_ndr/ndr_dcerpc.h" +#include "librpc/gen_ndr/ndr_misc.h" + +#define MAX_PROTSEQ 10 + +static const struct { + const char *name; + enum dcerpc_transport_t transport; + int num_protocols; + enum epm_protocol protseq[MAX_PROTSEQ]; +} transports[] = { + { "ncacn_np", NCACN_NP, 3, + { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_SMB, EPM_PROTOCOL_NETBIOS }}, + { "ncacn_ip_tcp", NCACN_IP_TCP, 3, + { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_TCP, EPM_PROTOCOL_IP } }, + { "ncacn_http", NCACN_HTTP, 3, + { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_HTTP, EPM_PROTOCOL_IP } }, + { "ncadg_ip_udp", NCACN_IP_UDP, 3, + { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_UDP, EPM_PROTOCOL_IP } }, + { "ncalrpc", NCALRPC, 2, + { EPM_PROTOCOL_NCALRPC, EPM_PROTOCOL_PIPE } }, + { "ncacn_unix_stream", NCACN_UNIX_STREAM, 2, + { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_UNIX_DS } }, + { "ncadg_unix_dgram", NCADG_UNIX_DGRAM, 2, + { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_UNIX_DS } }, + { "ncacn_at_dsp", NCACN_AT_DSP, 3, + { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_APPLETALK, EPM_PROTOCOL_DSP } }, + { "ncadg_at_ddp", NCADG_AT_DDP, 3, + { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_APPLETALK, EPM_PROTOCOL_DDP } }, + { "ncacn_vns_ssp", NCACN_VNS_SPP, 3, + { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_STREETTALK, EPM_PROTOCOL_VINES_SPP } }, + { "ncacn_vns_ipc", NCACN_VNS_IPC, 3, + { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_STREETTALK, EPM_PROTOCOL_VINES_IPC }, }, + { "ncadg_ipx", NCADG_IPX, 2, + { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_IPX }, + }, + { "ncacn_spx", NCACN_SPX, 3, + /* I guess some MS programmer confused the identifier for + * EPM_PROTOCOL_UUID (0x0D or 13) with the one for + * EPM_PROTOCOL_SPX (0x13) here. -- jelmer*/ + { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_NCALRPC, EPM_PROTOCOL_UUID }, + }, +}; + +static const struct { + const char *name; + uint32_t flag; +} ncacn_options[] = { + {"sign", DCERPC_SIGN}, + {"seal", DCERPC_SEAL}, + {"connect", DCERPC_CONNECT}, + {"spnego", DCERPC_AUTH_SPNEGO}, + {"ntlm", DCERPC_AUTH_NTLM}, + {"krb5", DCERPC_AUTH_KRB5}, + {"validate", DCERPC_DEBUG_VALIDATE_BOTH}, + {"print", DCERPC_DEBUG_PRINT_BOTH}, + {"padcheck", DCERPC_DEBUG_PAD_CHECK}, + {"bigendian", DCERPC_PUSH_BIGENDIAN}, + {"smb2", DCERPC_SMB2} +}; + +const char *epm_floor_string(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor) +{ + struct ndr_syntax_id syntax; + NTSTATUS status; + + switch(epm_floor->lhs.protocol) { + case EPM_PROTOCOL_UUID: + status = dcerpc_floor_get_lhs_data(epm_floor, &syntax); + if (NT_STATUS_IS_OK(status)) { + /* lhs is used: UUID */ + char *uuidstr; + + if (GUID_equal(&syntax.uuid, &ndr_transfer_syntax.uuid)) { + return "NDR"; + } + + if (GUID_equal(&syntax.uuid, &ndr64_transfer_syntax.uuid)) { + return "NDR64"; + } + + uuidstr = GUID_string(mem_ctx, &syntax.uuid); + + return talloc_asprintf(mem_ctx, " uuid %s/0x%02x", uuidstr, syntax.if_version); + } else { /* IPX */ + return talloc_asprintf(mem_ctx, "IPX:%s", + data_blob_hex_string(mem_ctx, &epm_floor->rhs.uuid.unknown)); + } + + case EPM_PROTOCOL_NCACN: + return "RPC-C"; + + case EPM_PROTOCOL_NCADG: + return "RPC"; + + case EPM_PROTOCOL_NCALRPC: + return "NCALRPC"; + + case EPM_PROTOCOL_DNET_NSP: + return "DNET/NSP"; + + case EPM_PROTOCOL_IP: + return talloc_asprintf(mem_ctx, "IP:%s", epm_floor->rhs.ip.ipaddr); + + case EPM_PROTOCOL_PIPE: + return talloc_asprintf(mem_ctx, "PIPE:%s", epm_floor->rhs.pipe.path); + + case EPM_PROTOCOL_SMB: + return talloc_asprintf(mem_ctx, "SMB:%s", epm_floor->rhs.smb.unc); + + case EPM_PROTOCOL_UNIX_DS: + return talloc_asprintf(mem_ctx, "Unix:%s", epm_floor->rhs.unix_ds.path); + + case EPM_PROTOCOL_NETBIOS: + return talloc_asprintf(mem_ctx, "NetBIOS:%s", epm_floor->rhs.netbios.name); + + case EPM_PROTOCOL_NETBEUI: + return "NETBeui"; + + case EPM_PROTOCOL_SPX: + return "SPX"; + + case EPM_PROTOCOL_NB_IPX: + return "NB_IPX"; + + case EPM_PROTOCOL_HTTP: + return talloc_asprintf(mem_ctx, "HTTP:%d", epm_floor->rhs.http.port); + + case EPM_PROTOCOL_TCP: + return talloc_asprintf(mem_ctx, "TCP:%d", epm_floor->rhs.tcp.port); + + case EPM_PROTOCOL_UDP: + return talloc_asprintf(mem_ctx, "UDP:%d", epm_floor->rhs.udp.port); + + default: + return talloc_asprintf(mem_ctx, "UNK(%02x):", epm_floor->lhs.protocol); + } +} + + +/* + form a binding string from a binding structure +*/ +_PUBLIC_ char *dcerpc_binding_string(TALLOC_CTX *mem_ctx, const struct dcerpc_binding *b) +{ + char *s = talloc_strdup(mem_ctx, ""); + int i; + const char *t_name = NULL; + + if (b->transport != NCA_UNKNOWN) { + for (i=0;itransport) { + t_name = transports[i].name; + } + } + if (!t_name) { + return NULL; + } + } + + if (!GUID_all_zero(&b->object.uuid)) { + s = talloc_asprintf(s, "%s@", + GUID_string(mem_ctx, &b->object.uuid)); + } + + if (t_name != NULL) { + s = talloc_asprintf_append_buffer(s, "%s:", t_name); + if (s == NULL) { + return NULL; + } + } + + if (b->host) { + s = talloc_asprintf_append_buffer(s, "%s", b->host); + } + + if (!b->endpoint && !b->options && !b->flags) { + return s; + } + + s = talloc_asprintf_append_buffer(s, "["); + + if (b->endpoint) { + s = talloc_asprintf_append_buffer(s, "%s", b->endpoint); + } + + /* this is a *really* inefficent way of dealing with strings, + but this is rarely called and the strings are always short, + so I don't care */ + for (i=0;b->options && b->options[i];i++) { + s = talloc_asprintf_append_buffer(s, ",%s", b->options[i]); + if (!s) return NULL; + } + + for (i=0;iflags & ncacn_options[i].flag) { + s = talloc_asprintf_append_buffer(s, ",%s", ncacn_options[i].name); + if (!s) return NULL; + } + } + + s = talloc_asprintf_append_buffer(s, "]"); + + return s; +} + +/* + parse a binding string into a dcerpc_binding structure +*/ +_PUBLIC_ NTSTATUS dcerpc_parse_binding(TALLOC_CTX *mem_ctx, const char *s, struct dcerpc_binding **b_out) +{ + struct dcerpc_binding *b; + char *options; + char *p; + int i, j, comma_count; + + b = talloc(mem_ctx, struct dcerpc_binding); + if (!b) { + return NT_STATUS_NO_MEMORY; + } + + p = strchr(s, '@'); + + if (p && PTR_DIFF(p, s) == 36) { /* 36 is the length of a UUID */ + NTSTATUS status; + + status = GUID_from_string(s, &b->object.uuid); + + if (NT_STATUS_IS_ERR(status)) { + DEBUG(0, ("Failed parsing UUID\n")); + return status; + } + + s = p + 1; + } else { + ZERO_STRUCT(b->object); + } + + b->object.if_version = 0; + + p = strchr(s, ':'); + + if (p == NULL) { + b->transport = NCA_UNKNOWN; + } else { + char *type = talloc_strndup(mem_ctx, s, PTR_DIFF(p, s)); + if (!type) { + return NT_STATUS_NO_MEMORY; + } + + for (i=0;itransport = transports[i].transport; + break; + } + } + + if (i==ARRAY_SIZE(transports)) { + DEBUG(0,("Unknown dcerpc transport '%s'\n", type)); + return NT_STATUS_INVALID_PARAMETER; + } + + talloc_free(type); + + s = p+1; + } + + p = strchr(s, '['); + if (p) { + b->host = talloc_strndup(b, s, PTR_DIFF(p, s)); + options = talloc_strdup(mem_ctx, p+1); + if (options[strlen(options)-1] != ']') { + return NT_STATUS_INVALID_PARAMETER; + } + options[strlen(options)-1] = 0; + } else { + b->host = talloc_strdup(b, s); + options = NULL; + } + if (!b->host) { + return NT_STATUS_NO_MEMORY; + } + + b->target_hostname = b->host; + + b->options = NULL; + b->flags = 0; + b->assoc_group_id = 0; + b->endpoint = NULL; + + if (!options) { + *b_out = b; + return NT_STATUS_OK; + } + + comma_count = count_chars(options, ','); + + b->options = talloc_array(b, const char *, comma_count+2); + if (!b->options) { + return NT_STATUS_NO_MEMORY; + } + + for (i=0; (p = strchr(options, ',')); i++) { + b->options[i] = talloc_strndup(b, options, PTR_DIFF(p, options)); + if (!b->options[i]) { + return NT_STATUS_NO_MEMORY; + } + options = p+1; + } + b->options[i] = options; + b->options[i+1] = NULL; + + /* some options are pre-parsed for convenience */ + for (i=0;b->options[i];i++) { + for (j=0;joptions[i]) == 0) { + int k; + b->flags |= ncacn_options[j].flag; + for (k=i;b->options[k];k++) { + b->options[k] = b->options[k+1]; + } + i--; + break; + } + } + } + + if (b->options[0]) { + /* Endpoint is first option */ + b->endpoint = b->options[0]; + if (strlen(b->endpoint) == 0) b->endpoint = NULL; + + for (i=0;b->options[i];i++) { + b->options[i] = b->options[i+1]; + } + } + + if (b->options[0] == NULL) + b->options = NULL; + + *b_out = b; + return NT_STATUS_OK; +} + +_PUBLIC_ NTSTATUS dcerpc_floor_get_lhs_data(struct epm_floor *epm_floor, struct ndr_syntax_id *syntax) +{ + TALLOC_CTX *mem_ctx = talloc_init("floor_get_lhs_data"); + struct ndr_pull *ndr = ndr_pull_init_blob(&epm_floor->lhs.lhs_data, mem_ctx, NULL); + enum ndr_err_code ndr_err; + uint16_t if_version=0; + + ndr->flags |= LIBNDR_FLAG_NOALIGN; + + ndr_err = ndr_pull_GUID(ndr, NDR_SCALARS | NDR_BUFFERS, &syntax->uuid); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(mem_ctx); + return ndr_map_error2ntstatus(ndr_err); + } + + ndr_err = ndr_pull_uint16(ndr, NDR_SCALARS, &if_version); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(mem_ctx); + return ndr_map_error2ntstatus(ndr_err); + } + + syntax->if_version = if_version; + + talloc_free(mem_ctx); + + return NT_STATUS_OK; +} + +static DATA_BLOB dcerpc_floor_pack_lhs_data(TALLOC_CTX *mem_ctx, const struct ndr_syntax_id *syntax) +{ + struct ndr_push *ndr = ndr_push_init_ctx(mem_ctx, NULL); + + ndr->flags |= LIBNDR_FLAG_NOALIGN; + + ndr_push_GUID(ndr, NDR_SCALARS | NDR_BUFFERS, &syntax->uuid); + ndr_push_uint16(ndr, NDR_SCALARS, syntax->if_version); + + return ndr_push_blob(ndr); +} + +const char *dcerpc_floor_get_rhs_data(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor) +{ + switch (epm_floor->lhs.protocol) { + case EPM_PROTOCOL_TCP: + if (epm_floor->rhs.tcp.port == 0) return NULL; + return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.tcp.port); + + case EPM_PROTOCOL_UDP: + if (epm_floor->rhs.udp.port == 0) return NULL; + return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.udp.port); + + case EPM_PROTOCOL_HTTP: + if (epm_floor->rhs.http.port == 0) return NULL; + return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.http.port); + + case EPM_PROTOCOL_IP: + return talloc_strdup(mem_ctx, epm_floor->rhs.ip.ipaddr); + + case EPM_PROTOCOL_NCACN: + return NULL; + + case EPM_PROTOCOL_NCADG: + return NULL; + + case EPM_PROTOCOL_SMB: + if (strlen(epm_floor->rhs.smb.unc) == 0) return NULL; + return talloc_strdup(mem_ctx, epm_floor->rhs.smb.unc); + + case EPM_PROTOCOL_PIPE: + if (strlen(epm_floor->rhs.pipe.path) == 0) return NULL; + return talloc_strdup(mem_ctx, epm_floor->rhs.pipe.path); + + case EPM_PROTOCOL_NETBIOS: + if (strlen(epm_floor->rhs.netbios.name) == 0) return NULL; + return talloc_strdup(mem_ctx, epm_floor->rhs.netbios.name); + + case EPM_PROTOCOL_NCALRPC: + return NULL; + + case EPM_PROTOCOL_VINES_SPP: + return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.vines_spp.port); + + case EPM_PROTOCOL_VINES_IPC: + return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.vines_ipc.port); + + case EPM_PROTOCOL_STREETTALK: + return talloc_strdup(mem_ctx, epm_floor->rhs.streettalk.streettalk); + + case EPM_PROTOCOL_UNIX_DS: + if (strlen(epm_floor->rhs.unix_ds.path) == 0) return NULL; + return talloc_strdup(mem_ctx, epm_floor->rhs.unix_ds.path); + + case EPM_PROTOCOL_NULL: + return NULL; + + default: + DEBUG(0,("Unsupported lhs protocol %d\n", epm_floor->lhs.protocol)); + break; + } + + return NULL; +} + +static NTSTATUS dcerpc_floor_set_rhs_data(TALLOC_CTX *mem_ctx, + struct epm_floor *epm_floor, + const char *data) +{ + switch (epm_floor->lhs.protocol) { + case EPM_PROTOCOL_TCP: + epm_floor->rhs.tcp.port = atoi(data); + return NT_STATUS_OK; + + case EPM_PROTOCOL_UDP: + epm_floor->rhs.udp.port = atoi(data); + return NT_STATUS_OK; + + case EPM_PROTOCOL_HTTP: + epm_floor->rhs.http.port = atoi(data); + return NT_STATUS_OK; + + case EPM_PROTOCOL_IP: + epm_floor->rhs.ip.ipaddr = talloc_strdup(mem_ctx, data); + NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.ip.ipaddr); + return NT_STATUS_OK; + + case EPM_PROTOCOL_NCACN: + epm_floor->rhs.ncacn.minor_version = 0; + return NT_STATUS_OK; + + case EPM_PROTOCOL_NCADG: + epm_floor->rhs.ncadg.minor_version = 0; + return NT_STATUS_OK; + + case EPM_PROTOCOL_SMB: + epm_floor->rhs.smb.unc = talloc_strdup(mem_ctx, data); + NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.smb.unc); + return NT_STATUS_OK; + + case EPM_PROTOCOL_PIPE: + epm_floor->rhs.pipe.path = talloc_strdup(mem_ctx, data); + NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.pipe.path); + return NT_STATUS_OK; + + case EPM_PROTOCOL_NETBIOS: + epm_floor->rhs.netbios.name = talloc_strdup(mem_ctx, data); + NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.netbios.name); + return NT_STATUS_OK; + + case EPM_PROTOCOL_NCALRPC: + return NT_STATUS_OK; + + case EPM_PROTOCOL_VINES_SPP: + epm_floor->rhs.vines_spp.port = atoi(data); + return NT_STATUS_OK; + + case EPM_PROTOCOL_VINES_IPC: + epm_floor->rhs.vines_ipc.port = atoi(data); + return NT_STATUS_OK; + + case EPM_PROTOCOL_STREETTALK: + epm_floor->rhs.streettalk.streettalk = talloc_strdup(mem_ctx, data); + NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.streettalk.streettalk); + return NT_STATUS_OK; + + case EPM_PROTOCOL_UNIX_DS: + epm_floor->rhs.unix_ds.path = talloc_strdup(mem_ctx, data); + NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.unix_ds.path); + return NT_STATUS_OK; + + case EPM_PROTOCOL_NULL: + return NT_STATUS_OK; + + default: + DEBUG(0,("Unsupported lhs protocol %d\n", epm_floor->lhs.protocol)); + break; + } + + return NT_STATUS_NOT_SUPPORTED; +} + +enum dcerpc_transport_t dcerpc_transport_by_endpoint_protocol(int prot) +{ + int i; + + /* Find a transport that has 'prot' as 4th protocol */ + for (i=0;i= 2 && + transports[i].protseq[1] == prot) { + return transports[i].transport; + } + } + + /* Unknown transport */ + return (unsigned int)-1; +} + +_PUBLIC_ enum dcerpc_transport_t dcerpc_transport_by_tower(struct epm_tower *tower) +{ + int i; + + /* Find a transport that matches this tower */ + for (i=0;inum_floors - 2) { + continue; + } + + for (j = 0; j < transports[i].num_protocols; j++) { + if (transports[i].protseq[j] != tower->floors[j+2].lhs.protocol) { + break; + } + } + + if (j == transports[i].num_protocols) { + return transports[i].transport; + } + } + + /* Unknown transport */ + return (unsigned int)-1; +} + +_PUBLIC_ NTSTATUS dcerpc_binding_from_tower(TALLOC_CTX *mem_ctx, + struct epm_tower *tower, + struct dcerpc_binding **b_out) +{ + NTSTATUS status; + struct dcerpc_binding *binding; + + binding = talloc(mem_ctx, struct dcerpc_binding); + NT_STATUS_HAVE_NO_MEMORY(binding); + + ZERO_STRUCT(binding->object); + binding->options = NULL; + binding->host = NULL; + binding->target_hostname = NULL; + binding->flags = 0; + binding->assoc_group_id = 0; + + binding->transport = dcerpc_transport_by_tower(tower); + + if (binding->transport == (unsigned int)-1) { + return NT_STATUS_NOT_SUPPORTED; + } + + if (tower->num_floors < 1) { + return NT_STATUS_OK; + } + + /* Set object uuid */ + status = dcerpc_floor_get_lhs_data(&tower->floors[0], &binding->object); + + if (!NT_STATUS_IS_OK(status)) { + DEBUG(1, ("Error pulling object uuid and version: %s", nt_errstr(status))); + return status; + } + + /* Ignore floor 1, it contains the NDR version info */ + + binding->options = NULL; + + /* Set endpoint */ + if (tower->num_floors >= 4) { + binding->endpoint = dcerpc_floor_get_rhs_data(mem_ctx, &tower->floors[3]); + } else { + binding->endpoint = NULL; + } + + /* Set network address */ + if (tower->num_floors >= 5) { + binding->host = dcerpc_floor_get_rhs_data(mem_ctx, &tower->floors[4]); + NT_STATUS_HAVE_NO_MEMORY(binding->host); + binding->target_hostname = binding->host; + } + *b_out = binding; + return NT_STATUS_OK; +} + +_PUBLIC_ NTSTATUS dcerpc_binding_build_tower(TALLOC_CTX *mem_ctx, struct dcerpc_binding *binding, struct epm_tower *tower) +{ + const enum epm_protocol *protseq = NULL; + int num_protocols = -1, i; + NTSTATUS status; + + /* Find transport */ + for (i=0;itransport) { + protseq = transports[i].protseq; + num_protocols = transports[i].num_protocols; + break; + } + } + + if (num_protocols == -1) { + DEBUG(0, ("Unable to find transport with id '%d'\n", binding->transport)); + return NT_STATUS_UNSUCCESSFUL; + } + + tower->num_floors = 2 + num_protocols; + tower->floors = talloc_array(mem_ctx, struct epm_floor, tower->num_floors); + + /* Floor 0 */ + tower->floors[0].lhs.protocol = EPM_PROTOCOL_UUID; + + tower->floors[0].lhs.lhs_data = dcerpc_floor_pack_lhs_data(mem_ctx, &binding->object); + + tower->floors[0].rhs.uuid.unknown = data_blob_talloc_zero(mem_ctx, 2); + + /* Floor 1 */ + tower->floors[1].lhs.protocol = EPM_PROTOCOL_UUID; + + tower->floors[1].lhs.lhs_data = dcerpc_floor_pack_lhs_data(mem_ctx, + &ndr_transfer_syntax); + + tower->floors[1].rhs.uuid.unknown = data_blob_talloc_zero(mem_ctx, 2); + + /* Floor 2 to num_protocols */ + for (i = 0; i < num_protocols; i++) { + tower->floors[2 + i].lhs.protocol = protseq[i]; + tower->floors[2 + i].lhs.lhs_data = data_blob_talloc(mem_ctx, NULL, 0); + ZERO_STRUCT(tower->floors[2 + i].rhs); + dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[2 + i], ""); + } + + /* The 4th floor contains the endpoint */ + if (num_protocols >= 2 && binding->endpoint) { + status = dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[3], binding->endpoint); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + } + + /* The 5th contains the network address */ + if (num_protocols >= 3 && binding->host) { + if (is_ipaddress(binding->host)) { + status = dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[4], + binding->host); + } else { + /* note that we don't attempt to resolve the + name here - when we get a hostname here we + are in the client code, and want to put in + a wildcard all-zeros IP for the server to + fill in */ + status = dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[4], + "0.0.0.0"); + } + if (NT_STATUS_IS_ERR(status)) { + return status; + } + } + + return NT_STATUS_OK; +} diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c index 3b8768ccc2..469c83788c 100644 --- a/source4/librpc/rpc/dcerpc_util.c +++ b/source4/librpc/rpc/dcerpc_util.c @@ -97,701 +97,6 @@ NTSTATUS ncacn_push_auth(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, return NT_STATUS_OK; } -#define MAX_PROTSEQ 10 - -static const struct { - const char *name; - enum dcerpc_transport_t transport; - int num_protocols; - enum epm_protocol protseq[MAX_PROTSEQ]; -} transports[] = { - { "ncacn_np", NCACN_NP, 3, - { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_SMB, EPM_PROTOCOL_NETBIOS }}, - { "ncacn_ip_tcp", NCACN_IP_TCP, 3, - { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_TCP, EPM_PROTOCOL_IP } }, - { "ncacn_http", NCACN_HTTP, 3, - { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_HTTP, EPM_PROTOCOL_IP } }, - { "ncadg_ip_udp", NCACN_IP_UDP, 3, - { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_UDP, EPM_PROTOCOL_IP } }, - { "ncalrpc", NCALRPC, 2, - { EPM_PROTOCOL_NCALRPC, EPM_PROTOCOL_PIPE } }, - { "ncacn_unix_stream", NCACN_UNIX_STREAM, 2, - { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_UNIX_DS } }, - { "ncadg_unix_dgram", NCADG_UNIX_DGRAM, 2, - { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_UNIX_DS } }, - { "ncacn_at_dsp", NCACN_AT_DSP, 3, - { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_APPLETALK, EPM_PROTOCOL_DSP } }, - { "ncadg_at_ddp", NCADG_AT_DDP, 3, - { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_APPLETALK, EPM_PROTOCOL_DDP } }, - { "ncacn_vns_ssp", NCACN_VNS_SPP, 3, - { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_STREETTALK, EPM_PROTOCOL_VINES_SPP } }, - { "ncacn_vns_ipc", NCACN_VNS_IPC, 3, - { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_STREETTALK, EPM_PROTOCOL_VINES_IPC }, }, - { "ncadg_ipx", NCADG_IPX, 2, - { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_IPX }, - }, - { "ncacn_spx", NCACN_SPX, 3, - /* I guess some MS programmer confused the identifier for - * EPM_PROTOCOL_UUID (0x0D or 13) with the one for - * EPM_PROTOCOL_SPX (0x13) here. -- jelmer*/ - { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_NCALRPC, EPM_PROTOCOL_UUID }, - }, -}; - -static const struct { - const char *name; - uint32_t flag; -} ncacn_options[] = { - {"sign", DCERPC_SIGN}, - {"seal", DCERPC_SEAL}, - {"connect", DCERPC_CONNECT}, - {"spnego", DCERPC_AUTH_SPNEGO}, - {"ntlm", DCERPC_AUTH_NTLM}, - {"krb5", DCERPC_AUTH_KRB5}, - {"validate", DCERPC_DEBUG_VALIDATE_BOTH}, - {"print", DCERPC_DEBUG_PRINT_BOTH}, - {"padcheck", DCERPC_DEBUG_PAD_CHECK}, - {"bigendian", DCERPC_PUSH_BIGENDIAN}, - {"smb2", DCERPC_SMB2} -}; - -const char *epm_floor_string(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor) -{ - struct ndr_syntax_id syntax; - NTSTATUS status; - - switch(epm_floor->lhs.protocol) { - case EPM_PROTOCOL_UUID: - status = dcerpc_floor_get_lhs_data(epm_floor, &syntax); - if (NT_STATUS_IS_OK(status)) { - /* lhs is used: UUID */ - char *uuidstr; - - if (GUID_equal(&syntax.uuid, &ndr_transfer_syntax.uuid)) { - return "NDR"; - } - - if (GUID_equal(&syntax.uuid, &ndr64_transfer_syntax.uuid)) { - return "NDR64"; - } - - uuidstr = GUID_string(mem_ctx, &syntax.uuid); - - return talloc_asprintf(mem_ctx, " uuid %s/0x%02x", uuidstr, syntax.if_version); - } else { /* IPX */ - return talloc_asprintf(mem_ctx, "IPX:%s", - data_blob_hex_string(mem_ctx, &epm_floor->rhs.uuid.unknown)); - } - - case EPM_PROTOCOL_NCACN: - return "RPC-C"; - - case EPM_PROTOCOL_NCADG: - return "RPC"; - - case EPM_PROTOCOL_NCALRPC: - return "NCALRPC"; - - case EPM_PROTOCOL_DNET_NSP: - return "DNET/NSP"; - - case EPM_PROTOCOL_IP: - return talloc_asprintf(mem_ctx, "IP:%s", epm_floor->rhs.ip.ipaddr); - - case EPM_PROTOCOL_PIPE: - return talloc_asprintf(mem_ctx, "PIPE:%s", epm_floor->rhs.pipe.path); - - case EPM_PROTOCOL_SMB: - return talloc_asprintf(mem_ctx, "SMB:%s", epm_floor->rhs.smb.unc); - - case EPM_PROTOCOL_UNIX_DS: - return talloc_asprintf(mem_ctx, "Unix:%s", epm_floor->rhs.unix_ds.path); - - case EPM_PROTOCOL_NETBIOS: - return talloc_asprintf(mem_ctx, "NetBIOS:%s", epm_floor->rhs.netbios.name); - - case EPM_PROTOCOL_NETBEUI: - return "NETBeui"; - - case EPM_PROTOCOL_SPX: - return "SPX"; - - case EPM_PROTOCOL_NB_IPX: - return "NB_IPX"; - - case EPM_PROTOCOL_HTTP: - return talloc_asprintf(mem_ctx, "HTTP:%d", epm_floor->rhs.http.port); - - case EPM_PROTOCOL_TCP: - return talloc_asprintf(mem_ctx, "TCP:%d", epm_floor->rhs.tcp.port); - - case EPM_PROTOCOL_UDP: - return talloc_asprintf(mem_ctx, "UDP:%d", epm_floor->rhs.udp.port); - - default: - return talloc_asprintf(mem_ctx, "UNK(%02x):", epm_floor->lhs.protocol); - } -} - - -/* - form a binding string from a binding structure -*/ -_PUBLIC_ char *dcerpc_binding_string(TALLOC_CTX *mem_ctx, const struct dcerpc_binding *b) -{ - char *s = talloc_strdup(mem_ctx, ""); - int i; - const char *t_name = NULL; - - if (b->transport != NCA_UNKNOWN) { - for (i=0;itransport) { - t_name = transports[i].name; - } - } - if (!t_name) { - return NULL; - } - } - - if (!GUID_all_zero(&b->object.uuid)) { - s = talloc_asprintf(s, "%s@", - GUID_string(mem_ctx, &b->object.uuid)); - } - - if (t_name != NULL) { - s = talloc_asprintf_append_buffer(s, "%s:", t_name); - if (s == NULL) { - return NULL; - } - } - - if (b->host) { - s = talloc_asprintf_append_buffer(s, "%s", b->host); - } - - if (!b->endpoint && !b->options && !b->flags) { - return s; - } - - s = talloc_asprintf_append_buffer(s, "["); - - if (b->endpoint) { - s = talloc_asprintf_append_buffer(s, "%s", b->endpoint); - } - - /* this is a *really* inefficent way of dealing with strings, - but this is rarely called and the strings are always short, - so I don't care */ - for (i=0;b->options && b->options[i];i++) { - s = talloc_asprintf_append_buffer(s, ",%s", b->options[i]); - if (!s) return NULL; - } - - for (i=0;iflags & ncacn_options[i].flag) { - s = talloc_asprintf_append_buffer(s, ",%s", ncacn_options[i].name); - if (!s) return NULL; - } - } - - s = talloc_asprintf_append_buffer(s, "]"); - - return s; -} - -/* - parse a binding string into a dcerpc_binding structure -*/ -_PUBLIC_ NTSTATUS dcerpc_parse_binding(TALLOC_CTX *mem_ctx, const char *s, struct dcerpc_binding **b_out) -{ - struct dcerpc_binding *b; - char *options; - char *p; - int i, j, comma_count; - - b = talloc(mem_ctx, struct dcerpc_binding); - if (!b) { - return NT_STATUS_NO_MEMORY; - } - - p = strchr(s, '@'); - - if (p && PTR_DIFF(p, s) == 36) { /* 36 is the length of a UUID */ - NTSTATUS status; - - status = GUID_from_string(s, &b->object.uuid); - - if (NT_STATUS_IS_ERR(status)) { - DEBUG(0, ("Failed parsing UUID\n")); - return status; - } - - s = p + 1; - } else { - ZERO_STRUCT(b->object); - } - - b->object.if_version = 0; - - p = strchr(s, ':'); - - if (p == NULL) { - b->transport = NCA_UNKNOWN; - } else { - char *type = talloc_strndup(mem_ctx, s, PTR_DIFF(p, s)); - if (!type) { - return NT_STATUS_NO_MEMORY; - } - - for (i=0;itransport = transports[i].transport; - break; - } - } - - if (i==ARRAY_SIZE(transports)) { - DEBUG(0,("Unknown dcerpc transport '%s'\n", type)); - return NT_STATUS_INVALID_PARAMETER; - } - - talloc_free(type); - - s = p+1; - } - - p = strchr(s, '['); - if (p) { - b->host = talloc_strndup(b, s, PTR_DIFF(p, s)); - options = talloc_strdup(mem_ctx, p+1); - if (options[strlen(options)-1] != ']') { - return NT_STATUS_INVALID_PARAMETER; - } - options[strlen(options)-1] = 0; - } else { - b->host = talloc_strdup(b, s); - options = NULL; - } - if (!b->host) { - return NT_STATUS_NO_MEMORY; - } - - b->target_hostname = b->host; - - b->options = NULL; - b->flags = 0; - b->assoc_group_id = 0; - b->endpoint = NULL; - - if (!options) { - *b_out = b; - return NT_STATUS_OK; - } - - comma_count = count_chars(options, ','); - - b->options = talloc_array(b, const char *, comma_count+2); - if (!b->options) { - return NT_STATUS_NO_MEMORY; - } - - for (i=0; (p = strchr(options, ',')); i++) { - b->options[i] = talloc_strndup(b, options, PTR_DIFF(p, options)); - if (!b->options[i]) { - return NT_STATUS_NO_MEMORY; - } - options = p+1; - } - b->options[i] = options; - b->options[i+1] = NULL; - - /* some options are pre-parsed for convenience */ - for (i=0;b->options[i];i++) { - for (j=0;joptions[i]) == 0) { - int k; - b->flags |= ncacn_options[j].flag; - for (k=i;b->options[k];k++) { - b->options[k] = b->options[k+1]; - } - i--; - break; - } - } - } - - if (b->options[0]) { - /* Endpoint is first option */ - b->endpoint = b->options[0]; - if (strlen(b->endpoint) == 0) b->endpoint = NULL; - - for (i=0;b->options[i];i++) { - b->options[i] = b->options[i+1]; - } - } - - if (b->options[0] == NULL) - b->options = NULL; - - *b_out = b; - return NT_STATUS_OK; -} - -_PUBLIC_ NTSTATUS dcerpc_floor_get_lhs_data(struct epm_floor *epm_floor, struct ndr_syntax_id *syntax) -{ - TALLOC_CTX *mem_ctx = talloc_init("floor_get_lhs_data"); - struct ndr_pull *ndr = ndr_pull_init_blob(&epm_floor->lhs.lhs_data, mem_ctx, NULL); - enum ndr_err_code ndr_err; - uint16_t if_version=0; - - ndr->flags |= LIBNDR_FLAG_NOALIGN; - - ndr_err = ndr_pull_GUID(ndr, NDR_SCALARS | NDR_BUFFERS, &syntax->uuid); - if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { - talloc_free(mem_ctx); - return ndr_map_error2ntstatus(ndr_err); - } - - ndr_err = ndr_pull_uint16(ndr, NDR_SCALARS, &if_version); - if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { - talloc_free(mem_ctx); - return ndr_map_error2ntstatus(ndr_err); - } - - syntax->if_version = if_version; - - talloc_free(mem_ctx); - - return NT_STATUS_OK; -} - -static DATA_BLOB dcerpc_floor_pack_lhs_data(TALLOC_CTX *mem_ctx, const struct ndr_syntax_id *syntax) -{ - struct ndr_push *ndr = ndr_push_init_ctx(mem_ctx, NULL); - - ndr->flags |= LIBNDR_FLAG_NOALIGN; - - ndr_push_GUID(ndr, NDR_SCALARS | NDR_BUFFERS, &syntax->uuid); - ndr_push_uint16(ndr, NDR_SCALARS, syntax->if_version); - - return ndr_push_blob(ndr); -} - -const char *dcerpc_floor_get_rhs_data(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor) -{ - switch (epm_floor->lhs.protocol) { - case EPM_PROTOCOL_TCP: - if (epm_floor->rhs.tcp.port == 0) return NULL; - return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.tcp.port); - - case EPM_PROTOCOL_UDP: - if (epm_floor->rhs.udp.port == 0) return NULL; - return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.udp.port); - - case EPM_PROTOCOL_HTTP: - if (epm_floor->rhs.http.port == 0) return NULL; - return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.http.port); - - case EPM_PROTOCOL_IP: - return talloc_strdup(mem_ctx, epm_floor->rhs.ip.ipaddr); - - case EPM_PROTOCOL_NCACN: - return NULL; - - case EPM_PROTOCOL_NCADG: - return NULL; - - case EPM_PROTOCOL_SMB: - if (strlen(epm_floor->rhs.smb.unc) == 0) return NULL; - return talloc_strdup(mem_ctx, epm_floor->rhs.smb.unc); - - case EPM_PROTOCOL_PIPE: - if (strlen(epm_floor->rhs.pipe.path) == 0) return NULL; - return talloc_strdup(mem_ctx, epm_floor->rhs.pipe.path); - - case EPM_PROTOCOL_NETBIOS: - if (strlen(epm_floor->rhs.netbios.name) == 0) return NULL; - return talloc_strdup(mem_ctx, epm_floor->rhs.netbios.name); - - case EPM_PROTOCOL_NCALRPC: - return NULL; - - case EPM_PROTOCOL_VINES_SPP: - return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.vines_spp.port); - - case EPM_PROTOCOL_VINES_IPC: - return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.vines_ipc.port); - - case EPM_PROTOCOL_STREETTALK: - return talloc_strdup(mem_ctx, epm_floor->rhs.streettalk.streettalk); - - case EPM_PROTOCOL_UNIX_DS: - if (strlen(epm_floor->rhs.unix_ds.path) == 0) return NULL; - return talloc_strdup(mem_ctx, epm_floor->rhs.unix_ds.path); - - case EPM_PROTOCOL_NULL: - return NULL; - - default: - DEBUG(0,("Unsupported lhs protocol %d\n", epm_floor->lhs.protocol)); - break; - } - - return NULL; -} - -static NTSTATUS dcerpc_floor_set_rhs_data(TALLOC_CTX *mem_ctx, - struct epm_floor *epm_floor, - const char *data) -{ - switch (epm_floor->lhs.protocol) { - case EPM_PROTOCOL_TCP: - epm_floor->rhs.tcp.port = atoi(data); - return NT_STATUS_OK; - - case EPM_PROTOCOL_UDP: - epm_floor->rhs.udp.port = atoi(data); - return NT_STATUS_OK; - - case EPM_PROTOCOL_HTTP: - epm_floor->rhs.http.port = atoi(data); - return NT_STATUS_OK; - - case EPM_PROTOCOL_IP: - epm_floor->rhs.ip.ipaddr = talloc_strdup(mem_ctx, data); - NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.ip.ipaddr); - return NT_STATUS_OK; - - case EPM_PROTOCOL_NCACN: - epm_floor->rhs.ncacn.minor_version = 0; - return NT_STATUS_OK; - - case EPM_PROTOCOL_NCADG: - epm_floor->rhs.ncadg.minor_version = 0; - return NT_STATUS_OK; - - case EPM_PROTOCOL_SMB: - epm_floor->rhs.smb.unc = talloc_strdup(mem_ctx, data); - NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.smb.unc); - return NT_STATUS_OK; - - case EPM_PROTOCOL_PIPE: - epm_floor->rhs.pipe.path = talloc_strdup(mem_ctx, data); - NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.pipe.path); - return NT_STATUS_OK; - - case EPM_PROTOCOL_NETBIOS: - epm_floor->rhs.netbios.name = talloc_strdup(mem_ctx, data); - NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.netbios.name); - return NT_STATUS_OK; - - case EPM_PROTOCOL_NCALRPC: - return NT_STATUS_OK; - - case EPM_PROTOCOL_VINES_SPP: - epm_floor->rhs.vines_spp.port = atoi(data); - return NT_STATUS_OK; - - case EPM_PROTOCOL_VINES_IPC: - epm_floor->rhs.vines_ipc.port = atoi(data); - return NT_STATUS_OK; - - case EPM_PROTOCOL_STREETTALK: - epm_floor->rhs.streettalk.streettalk = talloc_strdup(mem_ctx, data); - NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.streettalk.streettalk); - return NT_STATUS_OK; - - case EPM_PROTOCOL_UNIX_DS: - epm_floor->rhs.unix_ds.path = talloc_strdup(mem_ctx, data); - NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.unix_ds.path); - return NT_STATUS_OK; - - case EPM_PROTOCOL_NULL: - return NT_STATUS_OK; - - default: - DEBUG(0,("Unsupported lhs protocol %d\n", epm_floor->lhs.protocol)); - break; - } - - return NT_STATUS_NOT_SUPPORTED; -} - -enum dcerpc_transport_t dcerpc_transport_by_endpoint_protocol(int prot) -{ - int i; - - /* Find a transport that has 'prot' as 4th protocol */ - for (i=0;i= 2 && - transports[i].protseq[1] == prot) { - return transports[i].transport; - } - } - - /* Unknown transport */ - return (unsigned int)-1; -} - -_PUBLIC_ enum dcerpc_transport_t dcerpc_transport_by_tower(struct epm_tower *tower) -{ - int i; - - /* Find a transport that matches this tower */ - for (i=0;inum_floors - 2) { - continue; - } - - for (j = 0; j < transports[i].num_protocols; j++) { - if (transports[i].protseq[j] != tower->floors[j+2].lhs.protocol) { - break; - } - } - - if (j == transports[i].num_protocols) { - return transports[i].transport; - } - } - - /* Unknown transport */ - return (unsigned int)-1; -} - -_PUBLIC_ NTSTATUS dcerpc_binding_from_tower(TALLOC_CTX *mem_ctx, - struct epm_tower *tower, - struct dcerpc_binding **b_out) -{ - NTSTATUS status; - struct dcerpc_binding *binding; - - binding = talloc(mem_ctx, struct dcerpc_binding); - NT_STATUS_HAVE_NO_MEMORY(binding); - - ZERO_STRUCT(binding->object); - binding->options = NULL; - binding->host = NULL; - binding->target_hostname = NULL; - binding->flags = 0; - binding->assoc_group_id = 0; - - binding->transport = dcerpc_transport_by_tower(tower); - - if (binding->transport == (unsigned int)-1) { - return NT_STATUS_NOT_SUPPORTED; - } - - if (tower->num_floors < 1) { - return NT_STATUS_OK; - } - - /* Set object uuid */ - status = dcerpc_floor_get_lhs_data(&tower->floors[0], &binding->object); - - if (!NT_STATUS_IS_OK(status)) { - DEBUG(1, ("Error pulling object uuid and version: %s", nt_errstr(status))); - return status; - } - - /* Ignore floor 1, it contains the NDR version info */ - - binding->options = NULL; - - /* Set endpoint */ - if (tower->num_floors >= 4) { - binding->endpoint = dcerpc_floor_get_rhs_data(mem_ctx, &tower->floors[3]); - } else { - binding->endpoint = NULL; - } - - /* Set network address */ - if (tower->num_floors >= 5) { - binding->host = dcerpc_floor_get_rhs_data(mem_ctx, &tower->floors[4]); - NT_STATUS_HAVE_NO_MEMORY(binding->host); - binding->target_hostname = binding->host; - } - *b_out = binding; - return NT_STATUS_OK; -} - -_PUBLIC_ NTSTATUS dcerpc_binding_build_tower(TALLOC_CTX *mem_ctx, struct dcerpc_binding *binding, struct epm_tower *tower) -{ - const enum epm_protocol *protseq = NULL; - int num_protocols = -1, i; - NTSTATUS status; - - /* Find transport */ - for (i=0;itransport) { - protseq = transports[i].protseq; - num_protocols = transports[i].num_protocols; - break; - } - } - - if (num_protocols == -1) { - DEBUG(0, ("Unable to find transport with id '%d'\n", binding->transport)); - return NT_STATUS_UNSUCCESSFUL; - } - - tower->num_floors = 2 + num_protocols; - tower->floors = talloc_array(mem_ctx, struct epm_floor, tower->num_floors); - - /* Floor 0 */ - tower->floors[0].lhs.protocol = EPM_PROTOCOL_UUID; - - tower->floors[0].lhs.lhs_data = dcerpc_floor_pack_lhs_data(mem_ctx, &binding->object); - - tower->floors[0].rhs.uuid.unknown = data_blob_talloc_zero(mem_ctx, 2); - - /* Floor 1 */ - tower->floors[1].lhs.protocol = EPM_PROTOCOL_UUID; - - tower->floors[1].lhs.lhs_data = dcerpc_floor_pack_lhs_data(mem_ctx, - &ndr_transfer_syntax); - - tower->floors[1].rhs.uuid.unknown = data_blob_talloc_zero(mem_ctx, 2); - - /* Floor 2 to num_protocols */ - for (i = 0; i < num_protocols; i++) { - tower->floors[2 + i].lhs.protocol = protseq[i]; - tower->floors[2 + i].lhs.lhs_data = data_blob_talloc(mem_ctx, NULL, 0); - ZERO_STRUCT(tower->floors[2 + i].rhs); - dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[2 + i], ""); - } - - /* The 4th floor contains the endpoint */ - if (num_protocols >= 2 && binding->endpoint) { - status = dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[3], binding->endpoint); - if (NT_STATUS_IS_ERR(status)) { - return status; - } - } - - /* The 5th contains the network address */ - if (num_protocols >= 3 && binding->host) { - if (is_ipaddress(binding->host)) { - status = dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[4], - binding->host); - } else { - /* note that we don't attempt to resolve the - name here - when we get a hostname here we - are in the client code, and want to put in - a wildcard all-zeros IP for the server to - fill in */ - status = dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[4], - "0.0.0.0"); - } - if (NT_STATUS_IS_ERR(status)) { - return status; - } - } - - return NT_STATUS_OK; -} - struct epm_map_binding_state { struct dcerpc_binding *binding; -- cgit From 9062214d0931b1bf6eae2fd4d382d7c5a00b307e Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 15 Apr 2008 22:42:52 +0200 Subject: Add some documentation on test behaviour in selftest. (This used to be commit e8e9f2cc7b0503e30b211094f452829395a73eec) --- source4/selftest/README | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/source4/selftest/README b/source4/selftest/README index e8e87c8b3f..fdf04f8278 100644 --- a/source4/selftest/README +++ b/source4/selftest/README @@ -3,15 +3,32 @@ This directory contains test scripts that are useful for running a bunch of tests all at once. -=============== -Available tests -=============== -The available tests are obtained from a script, usually -selftest/samba{3,4}_tests.sh. This script should for each test output +Available testsuites +==================== +The available testsuites are obtained from a script, usually +selftest/samba{3,4}_tests.sh. This script should for each testsuite output the name of the test, the command to run and the environment that should be -provided. +provided. Use the included "plantest" function to generate the required output. + +Testsuite behaviour +================================ + +Exit code +------------ +The testsuites should exit with a non-zero exit code if at least one +test failed. + +Output format +------------- + +test: +success: +failure: +error: +skip: + +failure: [ EXTENDED DESCRIPTION ] -============ Environments ============ Tests often need to run against a server with particular things set up, @@ -41,22 +58,22 @@ The following environments are currently available: * SERVER: Name of the member server -============= Running tests ============= -To run all the tests use: +To run all the tests use:: make test -To run a quick subset (aiming for about 1 minute of testing) run: +To run a quick subset (aiming for about 1 minute of testing) run:: make quicktest -To run a specific test, use this syntax +To run a specific test, use this syntax:: make test TESTS=testname -for example +for example:: make test TESTS=samba4.BASE-DELETE + -- cgit From 8170956b6875cc4826087d06c2573f42bed60a98 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 15 Apr 2008 23:21:43 +0200 Subject: Add some documentation about the expected testsuite output. (This used to be commit a24651d649d24589a6c65e7bc4be9c49fdc80b2a) --- source4/selftest/README | 46 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/source4/selftest/README b/source4/selftest/README index fdf04f8278..f8be20a569 100644 --- a/source4/selftest/README +++ b/source4/selftest/README @@ -16,18 +16,56 @@ Testsuite behaviour Exit code ------------ The testsuites should exit with a non-zero exit code if at least one -test failed. +test failed. Skipped tests should not influence the exit code. Output format ------------- +Testsuites can simply use the exit code to indicate whether all of their +tests have succeeded or one or more have failed. It is also possible to +provide more granular information using the Subunit protocol. +This protocol works by writing simple messages to standard output. Any +messages that can not be interpreted by this protocol are considered comments +for the last announced test. + +Accepted commands are: + +test +~~~~~~~~~~~~ test: + +Announce that a new test with the specified name is starting + +success +~~~~~~~~~~~~~~~ success: + +Announce that the test with the specified name is done and ran successfully. + +failure +~~~~~~~~~~~~~~~ failure: -error: +failure: [ REASON ] + +Announce that the test with the specified name failed. Optionally, it is +possible to specify a reason it failed. + +skip +~~~~~~~~~~~~ skip: +skip: [ REASON ] + +Announce that the test with the specified name was skipped. Optionally a +reason can be specified. -failure: [ EXTENDED DESCRIPTION ] +knownfail +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +knownfail: +knownfail: [ REASON ] + +Announce that the test with the specified name was run and failed as expected. +Alternatively it is also possible to simply return "failure:" here but +specify in the samba4-knownfailures file that it is failing. Environments ============ @@ -40,6 +78,7 @@ The following environments are currently available: - none: No server set up, no variables set. - dc: Domain controller set up. The following environment variables will be set: + * USERNAME: Administrator user name * PASSWORD: Administrator password * DOMAIN: Domain name @@ -51,6 +90,7 @@ The following environments are currently available: - member: Domain controller and member server that is joined to it set up. The following environment variables will be set: + * USERNAME: Domain administrator user name * PASSWORD: Domain administrator password * DOMAIN: Domain name -- cgit From 3413cfefb836c6a24fa740c13817a65fe264f2da Mon Sep 17 00:00:00 2001 From: Kai Blin Date: Tue, 15 Apr 2008 17:04:36 +0200 Subject: blackbox: Add many more tests for wbinfo (This used to be commit 0a2942f6e948177fcc671eae705e6e61644de81c) --- source4/selftest/samba4_tests.sh | 3 +- testprogs/blackbox/test_wbinfo.sh | 199 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 201 insertions(+), 1 deletion(-) create mode 100755 testprogs/blackbox/test_wbinfo.sh diff --git a/source4/selftest/samba4_tests.sh b/source4/selftest/samba4_tests.sh index 3a3e1f91b1..a021fff892 100755 --- a/source4/selftest/samba4_tests.sh +++ b/source4/selftest/samba4_tests.sh @@ -274,6 +274,8 @@ plantest "blackbox.nmblookup" member $samba4srcdir/utils/tests/test_nmblookup.sh plantest "blackbox.locktest" dc $bbdir/test_locktest.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$PREFIX" plantest "blackbox.masktest" dc $bbdir/test_masktest.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$PREFIX" plantest "blackbox.gentest" dc $bbdir/test_gentest.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$PREFIX" +plantest "blackbox.wbinfo" dc $bbdir/test_wbinfo.sh "\$DOMAIN" "\$USERNAME" "\$PASSWORD" "dc" +plantest "blackbox.wbinfo" member $bbdir/test_wbinfo.sh "\$DOMAIN" "\$DC_USERNAME" "\$DC_PASSWORD" "member" # Tests using the "Simple" NTVFS backend @@ -292,7 +294,6 @@ plantest "rpc.echo against member server with domain creds" member $VALGRIND $sm plantest "rpc.samr against member server with local creds" member $VALGRIND $smb4torture ncacn_np:"\$NETBIOSNAME" -U"\$NETBIOSNAME/\$USERNAME"%"\$PASSWORD" "RPC-SAMR" "$*" plantest "rpc.samr.users against member server with local creds" member $VALGRIND $smb4torture ncacn_np:"\$NETBIOSNAME" -U"\$NETBIOSNAME/\$USERNAME"%"\$PASSWORD" "RPC-SAMR-USERS" "$*" plantest "rpc.samr.passwords against member server with local creds" member $VALGRIND $smb4torture ncacn_np:"\$NETBIOSNAME" -U"\$NETBIOSNAME/\$USERNAME"%"\$PASSWORD" "RPC-SAMR-PASSWORDS" "$*" -plantest "wbinfo -a against member server with domain creds" member $VALGRIND $samba4bindir/wbinfo -a "\$DOMAIN/\$DC_USERNAME"%"\$DC_PASSWORD" NBT_TESTS=`$smb4torture --list | grep "^NBT-" | xargs` diff --git a/testprogs/blackbox/test_wbinfo.sh b/testprogs/blackbox/test_wbinfo.sh new file mode 100755 index 0000000000..2ca4f23a2a --- /dev/null +++ b/testprogs/blackbox/test_wbinfo.sh @@ -0,0 +1,199 @@ +#!/bin/sh +# Blackbox test for wbinfo +if [ $# -lt 4 ]; then +cat < Date: Tue, 15 Apr 2008 23:52:06 +0200 Subject: Deal with commands not even starting. (This used to be commit 0f789e6779eca38d93b968a0ffbbb8559ce483f1) --- source4/selftest/selftest.pl | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/source4/selftest/selftest.pl b/source4/selftest/selftest.pl index 39a1b5a450..53bfcb12f2 100755 --- a/source4/selftest/selftest.pl +++ b/source4/selftest/selftest.pl @@ -238,7 +238,13 @@ sub run_testsuite($$$$$$) $msg_ops->start_test([], $name); - open(RESULT, "$cmd 2>&1|"); + unless (open(RESULT, "$cmd 2>&1|")) { + $msg_ops->end_test([], $name, "error", 1, "Unable to run $cmd: $!"); + $statistics->{SUITES_FAIL}++; + $statistics->{TESTS_ERROR}++; + return 0; + } + my $expected_ret = parse_results( $msg_ops, $statistics, *RESULT, \&expecting_failure, [$name]); @@ -251,16 +257,14 @@ sub run_testsuite($$$$$$) $ret = 0 unless $ret == 1; if ($ret == 1) { - $msg_ops->end_test([], $name, "success", $expected_ret != $ret, undef); + $msg_ops->end_test([], $name, "success", $expected_ret != $ret, undef); } else { - $msg_ops->end_test([], $name, "failure", $expected_ret != $ret, - "Returned $ret"); + $msg_ops->end_test([], $name, "failure", $expected_ret != $ret, "Returned $ret"); } cleanup_pcap($pcap_file, $expected_ret, $ret); - if (not $opt_socket_wrapper_keep_pcap and - defined($pcap_file)) { + if (not $opt_socket_wrapper_keep_pcap and defined($pcap_file)) { $msg_ops->output_msg("PCAP FILE: $pcap_file\n"); } -- cgit From d3729a8efa1c7e848d263ef320d3114144477be3 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 16 Apr 2008 00:03:00 +0200 Subject: Support knownfail Subunit command. (This used to be commit ad58a508542bd93115be0ad826fb93aa3d349658) --- source4/selftest/Subunit.pm | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/source4/selftest/Subunit.pm b/source4/selftest/Subunit.pm index e5c61ca9ba..05e51da541 100644 --- a/source4/selftest/Subunit.pm +++ b/source4/selftest/Subunit.pm @@ -20,15 +20,22 @@ sub parse_results($$$$$) $msg_ops->control_msg($_); $msg_ops->start_test($open_tests, $1); push (@$open_tests, $1); - } elsif (/^(success|successful|failure|skip|error): (.*?)( \[)?([ \t]*)\n/) { + } elsif (/^(success|successful|failure|skip|knownfail|error): (.*?)( \[)?([ \t]*)\n/) { $msg_ops->control_msg($_); my $reason = undef; if ($3) { $reason = ""; # reason may be specified in next lines + my $terminated = 0; while(<$fh>) { $msg_ops->control_msg($_); - if ($_ eq "]\n") { last; } else { $reason .= $_; } + if ($_ eq "]\n") { $terminated = 1; last; } else { $reason .= $_; } + } + + unless ($terminated) { + $statistics->{TESTS_ERROR}++; + $msg_ops->end_test($open_tests, $2, $1, 1, "reason interrupted"); + return 1; } } my $result = $1; @@ -53,6 +60,10 @@ sub parse_results($$$$$) $msg_ops->end_test($open_tests, $2, $1, 1, $reason); $unexpected_fail++; } + } elsif ($1 eq "knownfail") { + pop(@$open_tests); #FIXME: Check that popped value == $2 + $statistics->{TESTS_EXPECTED_FAIL}++; + $msg_ops->end_test($open_tests, $2, $1, 0, $reason); } elsif ($1 eq "skip") { $statistics->{TESTS_SKIP}++; pop(@$open_tests); #FIXME: Check that popped value == $2 -- cgit From 8eb6d59a466cf7d9c79b1a271737873c8744ed16 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 16 Apr 2008 00:03:45 +0200 Subject: Properly warn about exit codes that indicate success while tests claim failure. (This used to be commit 92873264d707bed88beac54a73a29d66c011f80c) --- source4/selftest/output/plain.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source4/selftest/output/plain.pm b/source4/selftest/output/plain.pm index 25ff74792e..f14e26b38d 100644 --- a/source4/selftest/output/plain.pm +++ b/source4/selftest/output/plain.pm @@ -81,6 +81,9 @@ sub end_testsuite($$$$$) my $out = ""; if ($unexpected) { + if ($result eq "success" and not defined($reason)) { + $reason = "Expected negative exit code, got positive exit code"; + } $self->output_msg("ERROR: $reason\n"); push (@{$self->{suitesfailed}}, $name); } else { -- cgit From 4b4a56fb1e64b5d7734cdd784f48e07bd46e8452 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 16 Apr 2008 00:04:11 +0200 Subject: Provide the right error count to formatters. (This used to be commit f22602797fe841859c67558bb78e04c98b9e27e0) --- source4/selftest/selftest.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source4/selftest/selftest.pl b/source4/selftest/selftest.pl index 53bfcb12f2..d6cf8d3a00 100755 --- a/source4/selftest/selftest.pl +++ b/source4/selftest/selftest.pl @@ -239,9 +239,9 @@ sub run_testsuite($$$$$$) $msg_ops->start_test([], $name); unless (open(RESULT, "$cmd 2>&1|")) { + $statistics->{TESTS_ERROR}++; $msg_ops->end_test([], $name, "error", 1, "Unable to run $cmd: $!"); $statistics->{SUITES_FAIL}++; - $statistics->{TESTS_ERROR}++; return 0; } -- cgit From edc9b35f1e50f73684dcb5c971ad38453239e5a2 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 16 Apr 2008 00:05:12 +0200 Subject: Fix executable bit on blackbox ndrdump tests. (This used to be commit a3f0e4151bd87399a8bab9b71bad36bdc53c365c) --- testprogs/blackbox/test_ndrdump.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 testprogs/blackbox/test_ndrdump.sh diff --git a/testprogs/blackbox/test_ndrdump.sh b/testprogs/blackbox/test_ndrdump.sh old mode 100644 new mode 100755 -- cgit From c60a914052676aebb4ecdb94039c866862c56498 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 16 Apr 2008 00:17:03 +0200 Subject: Mention the actual exit code when a suite failed. (This used to be commit 46ad68ad0b9c604a6519de68c9bce8f5154b5c14) --- source4/selftest/selftest.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source4/selftest/selftest.pl b/source4/selftest/selftest.pl index d6cf8d3a00..385d31bbfd 100755 --- a/source4/selftest/selftest.pl +++ b/source4/selftest/selftest.pl @@ -256,10 +256,12 @@ sub run_testsuite($$$$$$) my $ret = close(RESULT); $ret = 0 unless $ret == 1; + my $exitcode = $? >> 8; + if ($ret == 1) { $msg_ops->end_test([], $name, "success", $expected_ret != $ret, undef); } else { - $msg_ops->end_test([], $name, "failure", $expected_ret != $ret, "Returned $ret"); + $msg_ops->end_test([], $name, "failure", $expected_ret != $ret, "Exit code was $exitcode"); } cleanup_pcap($pcap_file, $expected_ret, $ret); -- cgit From 83c8d6cc89feeec797b9185fb967b24c9c088950 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 16 Apr 2008 01:10:20 +0200 Subject: Fix -r test, knownfailure return code. (This used to be commit 4f0954905a902381e66eec74fd30ff7adde232b8) --- testprogs/blackbox/test_wbinfo.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/testprogs/blackbox/test_wbinfo.sh b/testprogs/blackbox/test_wbinfo.sh index 2ca4f23a2a..b309b302dd 100755 --- a/testprogs/blackbox/test_wbinfo.sh +++ b/testprogs/blackbox/test_wbinfo.sh @@ -56,8 +56,10 @@ knownfail() { status=$? if [ x$status = x0 ]; then echo "failure: $name [unexpected success]" + status=1 else echo "knownfail: $name" + status=0 fi return $status } @@ -178,7 +180,7 @@ testit "wbinfo -i against $TARGET" $wbinfo -i "$DOMAIN/$USERNAME" || failed=`exp # this does not work knownfail "wbinfo --uid-info against $TARGET" $wbinfo --uid-info $admin_sid knownfail "wbinfo --group-info against $TARGET" $wbinfo --group-info "S-1-22-2-0" -knownfail "wbinfo -r against $TARGET" $wbinfo "$DOMAIN/$USERNAME" +knownfail "wbinfo -r against $TARGET" $wbinfo -r "$DOMAIN/$USERNAME" testit "wbinfo --user-domgroups against $TARGET" $wbinfo --user-domgroups $admin_sid || failed=`expr $failed + 1` -- 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(-) 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(-) 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 7c4a45de26010996192912694e5a0a5a3d990fdc Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 16 Apr 2008 11:43:37 +0200 Subject: make sure header can be included more than once. (This used to be commit 38ed501ac8993e84ea7f02d4633bc83b490dfe61) --- source4/scripting/python/pyrpc.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source4/scripting/python/pyrpc.h b/source4/scripting/python/pyrpc.h index f4d0f37c39..93d583c10a 100644 --- a/source4/scripting/python/pyrpc.h +++ b/source4/scripting/python/pyrpc.h @@ -17,6 +17,9 @@ along with this program. If not, see . */ +#ifndef _PYRPC_H_ +#define _PYRPC_H_ + #define PY_CHECK_TYPE(type, var, fail) \ if (!type ## _Check(var)) {\ PyErr_Format(PyExc_TypeError, "Expected type %s", type ## _Type.tp_name); \ @@ -32,3 +35,5 @@ #ifndef PyAPI_DATA # define PyAPI_DATA(RTYPE) extern RTYPE #endif + +#endif /* _PYRPC_H_ */ -- cgit From f540669c48f96a65cd25edeb0c1e63bcc801dfed Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 16 Apr 2008 12:34:53 +0200 Subject: Use library for subunit test functions. (This used to be commit 690924dc7f43b69b9c4cfc1dd0c9c6e83d333518) --- testprogs/blackbox/subunit.sh | 67 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100755 testprogs/blackbox/subunit.sh diff --git a/testprogs/blackbox/subunit.sh b/testprogs/blackbox/subunit.sh new file mode 100755 index 0000000000..7a6b21e540 --- /dev/null +++ b/testprogs/blackbox/subunit.sh @@ -0,0 +1,67 @@ +# +# subunit.sh: shell functions to report test status via the subunit protocol. +# Copyright (C) 2006 Robert Collins +# Copyright (C) 2008 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 2 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +subunit_start_test () { + # emit the current protocol start-marker for test $1 + echo "test: $1" +} + + +subunit_pass_test () { + # emit the current protocol test passed marker for test $1 + echo "success: $1" +} + + +subunit_fail_test () { + # emit the current protocol fail-marker for test $1, and emit stdin as + # the error text. + # we use stdin because the failure message can be arbitrarily long, and this + # makes it convenient to write in scripts (using < 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 --- source4/torture/config.mk | 2 - 10 files changed, 4344 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 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); -} - - - diff --git a/source4/torture/config.mk b/source4/torture/config.mk index e6c54022c2..6e1bacf199 100644 --- a/source4/torture/config.mk +++ b/source4/torture/config.mk @@ -332,12 +332,10 @@ lcov-split: @$(MAKE) $(COV_TARGET) $(COV_VARS) \ TEST_OPTIONS="--analyse-cmd=\"lcov --base-directory `pwd` --directory . --capture --output-file samba.info -t\"" -rm heimdal/lib/*/{lex,parse}.{gcda,gcno} - -rm lib/policy/*/{lex,parse}.{gcda,gcno} genhtml -o coverage samba.info lcov: test_cov -rm heimdal/lib/*/{lex,parse}.{gcda,gcno} - -rm lib/policy/*/{lex,parse}.{gcda,gcno} lcov --base-directory `pwd` --directory . --capture --output-file samba.info genhtml -o coverage samba.info -- cgit From 228f342b1f12accbf3c07e1d2a1c9a5459ed966b Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 16 Apr 2008 14:52:29 +0200 Subject: Use the subunit shell library. (This used to be commit 49367e044e3ab94639ab3209bfd06c6286b44b59) --- testprogs/blackbox/test_cifsdd.sh | 24 ++++-------------------- testprogs/blackbox/test_gentest.sh | 15 +-------------- testprogs/blackbox/test_kinit.sh | 16 +--------------- testprogs/blackbox/test_ldb.sh | 2 ++ testprogs/blackbox/test_locktest.sh | 15 +-------------- testprogs/blackbox/test_masktest.sh | 15 +-------------- testprogs/blackbox/test_ndrdump.sh | 17 ++--------------- testprogs/blackbox/test_smbclient.sh | 15 +-------------- testprogs/blackbox/test_wbinfo.sh | 15 +-------------- 9 files changed, 14 insertions(+), 120 deletions(-) diff --git a/testprogs/blackbox/test_cifsdd.sh b/testprogs/blackbox/test_cifsdd.sh index 23df04c84c..43564a0c77 100755 --- a/testprogs/blackbox/test_cifsdd.sh +++ b/testprogs/blackbox/test_cifsdd.sh @@ -14,40 +14,24 @@ USERNAME=$2 PASSWORD=$3 DOMAIN=$4 +. `dirname $0`/subunit.sh + samba4bindir=`dirname $0`/../../source/bin DD=$samba4bindir/cifsdd SHARE=tmp DEBUGLEVEL=1 -failed=0 - -testit() { - name="$1" - shift - cmdline="$*" - echo "test: $name" - $cmdline - status=$? - if [ x$status = x0 ]; then - echo "success: $name" - else - echo "failure: $name" - failed=`expr $failed + 1` - fi - return $status -} - runcopy() { message="$1" shift testit "$message" $VALGRIND $DD $CONFIGURATION --debuglevel=$DEBUGLEVEL -W "$DOMAIN" -U "$USERNAME"%"$PASSWORD" \ - "$@" + "$@" || failed=`expr $failed + 1` } compare() { - testit "$1" cmp "$2" "$3" + testit "$1" cmp "$2" "$3" || failed=`expr $failed + 1` } sourcepath=tempfile.src.$$ diff --git a/testprogs/blackbox/test_gentest.sh b/testprogs/blackbox/test_gentest.sh index 89cc8c2795..ec6f0e422b 100755 --- a/testprogs/blackbox/test_gentest.sh +++ b/testprogs/blackbox/test_gentest.sh @@ -20,20 +20,7 @@ failed=0 samba4bindir=`dirname $0`/../../source/bin gentest=$samba4bindir/gentest -testit() { - name="$1" - shift - cmdline="$*" - echo "test: $name" - $cmdline - status=$? - if [ x$status = x0 ]; then - echo "success: $name" - else - echo "failure: $name" - fi - return $status -} +. `dirname $0`/subunit.sh cat < st/gentest.ignore all_info.out.fname diff --git a/testprogs/blackbox/test_kinit.sh b/testprogs/blackbox/test_kinit.sh index 29582055ee..db4b65f327 100755 --- a/testprogs/blackbox/test_kinit.sh +++ b/testprogs/blackbox/test_kinit.sh @@ -25,21 +25,7 @@ samba4kinit=$samba4bindir/samba4kinit net=$samba4bindir/net enableaccount="$samba4bindir/smbpython `dirname $0`/../../source/setup/enableaccount" -testit() { - name="$1" - shift - cmdline="$*" - echo "test: $name" - $cmdline - status=$? - if [ x$status = x0 ]; then - echo "success: $name" - else - echo "failure: $name" - fi - return $status -} - +. `dirname $0`/subunit.sh test_smbclient() { name="$1" diff --git a/testprogs/blackbox/test_ldb.sh b/testprogs/blackbox/test_ldb.sh index 4067a7fc43..8e1af99719 100755 --- a/testprogs/blackbox/test_ldb.sh +++ b/testprogs/blackbox/test_ldb.sh @@ -14,6 +14,8 @@ PREFIX=$3 shift 2 options="$*" +. `dirname $0`/subunit.sh + check() { name="$1" shift diff --git a/testprogs/blackbox/test_locktest.sh b/testprogs/blackbox/test_locktest.sh index c08b408107..88fa0ef892 100755 --- a/testprogs/blackbox/test_locktest.sh +++ b/testprogs/blackbox/test_locktest.sh @@ -21,20 +21,7 @@ failed=0 samba4bindir=`dirname $0`/../../source/bin locktest=$samba4bindir/locktest -testit() { - name="$1" - shift - cmdline="$*" - echo "test: $name" - $cmdline - status=$? - if [ x$status = x0 ]; then - echo "success: $name" - else - echo "failure: $name" - fi - return $status -} +. `dirname $0`/subunit.sh testit "locktest" $VALGRIND $locktest //$SERVER/test1 //$SERVER/test2 --num-ops=100 -W "$DOMAIN" -U"$USERNAME%$PASSWORD" $@ || failed=`expr $failed + 1` diff --git a/testprogs/blackbox/test_masktest.sh b/testprogs/blackbox/test_masktest.sh index ef429a1fb0..c1f765c1dd 100755 --- a/testprogs/blackbox/test_masktest.sh +++ b/testprogs/blackbox/test_masktest.sh @@ -21,20 +21,7 @@ failed=0 samba4bindir=`dirname $0`/../../source/bin masktest=$samba4bindir/masktest -testit() { - name="$1" - shift - cmdline="$*" - echo "test: $name" - $cmdline - status=$? - if [ x$status = x0 ]; then - echo "success: $name" - else - echo "failure: $name" - fi - return $status -} +. `dirname $0`/subunit.sh testit "masktest" $VALGRIND $masktest //$SERVER/tmp --num-ops=200 --dieonerror -W "$DOMAIN" -U"$USERNAME%$PASSWORD" $@ || failed=`expr $failed + 1` diff --git a/testprogs/blackbox/test_ndrdump.sh b/testprogs/blackbox/test_ndrdump.sh index 38c33ad3c1..089a7c3a2b 100755 --- a/testprogs/blackbox/test_ndrdump.sh +++ b/testprogs/blackbox/test_ndrdump.sh @@ -4,27 +4,14 @@ # Copyright (C) 2008 Andrew Bartlett # based on test_smbclient.sh +. `dirname $0`/subunit.sh + failed=0 samba4bindir=`dirname $0`/../../source/bin ndrdump=$samba4bindir/ndrdump files=`dirname $0`/ndrdump -testit() { - name="$1" - shift - cmdline="$*" - echo "test: $name" - $cmdline - status=$? - if [ x$status = x0 ]; then - echo "success: $name" - else - echo "failure: $name" - fi - return $status -} - testit "ndrdump with in" $VALGRIND $ndrdump samr samr_CreateUser in $files/samr-CreateUser-in.dat $@ || failed=`expr $failed + 1` testit "ndrdump with out" $VALGRIND $ndrdump samr samr_CreateUser out $files/samr-CreateUser-out.dat $@ || failed=`expr $failed + 1` testit "ndrdump with --context-file" $VALGRIND $ndrdump --context-file $files/samr-CreateUser-in.dat samr samr_CreateUser out $files/samr-CreateUser-out.dat $@ || failed=`expr $failed + 1` diff --git a/testprogs/blackbox/test_smbclient.sh b/testprogs/blackbox/test_smbclient.sh index 4df64cac94..d2c5c675e2 100755 --- a/testprogs/blackbox/test_smbclient.sh +++ b/testprogs/blackbox/test_smbclient.sh @@ -21,20 +21,7 @@ failed=0 samba4bindir=`dirname $0`/../../source/bin smbclient=$samba4bindir/smbclient -testit() { - name="$1" - shift - cmdline="$*" - echo "test: $name" - $cmdline - status=$? - if [ x$status = x0 ]; then - echo "success: $name" - else - echo "failure: $name" - fi - return $status -} +. `dirname $0`/subunit.sh runcmd() { name="$1" diff --git a/testprogs/blackbox/test_wbinfo.sh b/testprogs/blackbox/test_wbinfo.sh index b309b302dd..d993ed2ca7 100755 --- a/testprogs/blackbox/test_wbinfo.sh +++ b/testprogs/blackbox/test_wbinfo.sh @@ -17,20 +17,7 @@ failed=0 samba4bindir=`dirname $0`/../../source/bin wbinfo=$samba4bindir/wbinfo -testit() { - name="$1" - shift - cmdline="$*" - echo "test: $name" - $cmdline - status=$? - if [ x$status = x0 ]; then - echo "success: $name" - else - echo "failure: $name" - fi - return $status -} +. `dirname $0`/subunit.sh testfail() { name="$1" -- cgit From 008c8adfe3c72b4820d22421ba3df8dc80053831 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 16 Apr 2008 16:10:16 +0200 Subject: Fix wbinfo --trusted-domains. The problems here were that we did not bind to the LSA pipe, and we did not consider it possible to have 0 trusted domains. Andrew Bartlett (This used to be commit 86694d429d62940882ac9b7af83b3e7d00e67c5a) --- source4/winbind/wb_cmd_list_trustdom.c | 3 ++- source4/winbind/wb_connect_lsa.c | 11 +++++++---- testprogs/blackbox/test_wbinfo.sh | 5 ++--- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/source4/winbind/wb_cmd_list_trustdom.c b/source4/winbind/wb_cmd_list_trustdom.c index 83bd517a02..8d0c1bd947 100644 --- a/source4/winbind/wb_cmd_list_trustdom.c +++ b/source4/winbind/wb_cmd_list_trustdom.c @@ -143,7 +143,8 @@ static void cmd_list_trustdoms_recv_doms(struct rpc_request *req) state->domains = talloc_realloc(state, state->domains, struct wb_dom_info *, state->num_domains); - if (composite_nomem(state->domains, state->ctx)) return; + if (state->num_domains && + composite_nomem(state->domains, state->ctx)) return; for (i=0; ir.out.domains->count; i++) { int j = i+old_num_domains; diff --git a/source4/winbind/wb_connect_lsa.c b/source4/winbind/wb_connect_lsa.c index 61b123a502..a728f8abe4 100644 --- a/source4/winbind/wb_connect_lsa.c +++ b/source4/winbind/wb_connect_lsa.c @@ -62,8 +62,11 @@ struct composite_context *wb_init_lsa_send(TALLOC_CTX *mem_ctx, /* this will make the secondary connection on the same IPC$ share, secured with SPNEGO or NTLMSSP */ - ctx = dcerpc_secondary_connection_send(domain->netlogon_pipe, - domain->lsa_binding); + ctx = dcerpc_secondary_auth_connection_send(domain->netlogon_pipe, + domain->lsa_binding, + &ndr_table_lsarpc, + domain->libnet_ctx->cred, + domain->libnet_ctx->lp_ctx); composite_continue(state->ctx, ctx, init_lsa_recv_pipe, state); return result; @@ -79,8 +82,8 @@ static void init_lsa_recv_pipe(struct composite_context *ctx) talloc_get_type(ctx->async.private_data, struct init_lsa_state); - state->ctx->status = dcerpc_secondary_connection_recv(ctx, - &state->lsa_pipe); + state->ctx->status = dcerpc_secondary_auth_connection_recv(ctx, state, + &state->lsa_pipe); if (!composite_is_ok(state->ctx)) return; state->handle = talloc(state, struct policy_handle); diff --git a/testprogs/blackbox/test_wbinfo.sh b/testprogs/blackbox/test_wbinfo.sh index b309b302dd..1ece5a60f2 100755 --- a/testprogs/blackbox/test_wbinfo.sh +++ b/testprogs/blackbox/test_wbinfo.sh @@ -157,9 +157,8 @@ testfail "wbinfo -Y against $TARGET using invalid SID" $wbinfo -Y "S-1-22-1-3000 testit "wbinfo -t against $TARGET" $wbinfo -t || failed=`expr $failed + 1` -# this does not work -knownfail "wbinfo -m against $TARGET" $wbinfo -m || failed=`expr $failed + 1` -knownfail "wbinfo --all-domains against $TARGET" $wbinfo --all-domains || failed=`expr $failed + 1` +testit "wbinfo --trusted-domains against $TARGET" $wbinfo --trusted-domains || failed=`expr $failed + 1` +testit "wbinfo --all-domains against $TARGET" $wbinfo --all-domains || failed=`expr $failed + 1` testit "wbinfo --own-domain against $TARGET" $wbinfo --own-domain || failed=`expr $failed + 1` echo "test: wbinfo --own-domain against $TARGET check output" -- cgit From a58df2f54c5847a6a3dddad51465c319f1c387f5 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 16 Apr 2008 16:11:17 +0200 Subject: Fix struct_based winbind test for 'check machine account'. The problem here was that we did not fill in the error strings in the success case, and the testsuite checked against the incorrect 'freindly' error string. Andrew Bartlett (This used to be commit df05f118831245bdb19573711545bdb1b01a0c50) --- source4/torture/winbind/struct_based.c | 2 +- source4/winbind/wb_samba3_cmd.c | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/source4/torture/winbind/struct_based.c b/source4/torture/winbind/struct_based.c index 51ac0e622a..f9e4e148c3 100644 --- a/source4/torture/winbind/struct_based.c +++ b/source4/torture/winbind/struct_based.c @@ -262,7 +262,7 @@ static bool torture_winbind_struct_check_machacc(struct torture_context *torture torture_assert_str_equal(torture, rep.data.auth.error_string, - nt_errstr(NT_STATUS_OK), + get_friendly_nt_error_msg(NT_STATUS_OK), "WINBINDD_CHECK_MACHACC ok: error_string"); torture_assert_int_equal(torture, diff --git a/source4/winbind/wb_samba3_cmd.c b/source4/winbind/wb_samba3_cmd.c index 8ae330df35..7f1520a3b3 100644 --- a/source4/winbind/wb_samba3_cmd.c +++ b/source4/winbind/wb_samba3_cmd.c @@ -43,13 +43,14 @@ static void wbsrv_samba3_async_auth_epilogue(NTSTATUS status, struct winbindd_response *resp = &s3call->response; if (!NT_STATUS_IS_OK(status)) { resp->result = WINBINDD_ERROR; - WBSRV_SAMBA3_SET_STRING(resp->data.auth.nt_status_string, - nt_errstr(status)); - WBSRV_SAMBA3_SET_STRING(resp->data.auth.error_string, - get_friendly_nt_error_msg(status)); } else { resp->result = WINBINDD_OK; } + + WBSRV_SAMBA3_SET_STRING(resp->data.auth.nt_status_string, + nt_errstr(status)); + WBSRV_SAMBA3_SET_STRING(resp->data.auth.error_string, + get_friendly_nt_error_msg(status)); resp->data.auth.pam_error = nt_status_to_pam(status); resp->data.auth.nt_status = NT_STATUS_V(status); -- cgit From 4bbaf36f6fd85c9d07a16320ad58d7a6ad43fd6c Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 16 Apr 2008 17:11:21 +0200 Subject: fixed popt handling on 64bit boxes in gentest (This used to be commit 40c93ffbe9eb09a5b3dc02ba56d28bf50df8ed82) --- source4/torture/gentest.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c index d5fc855f17..6d872c687b 100644 --- a/source4/torture/gentest.c +++ b/source4/torture/gentest.c @@ -36,18 +36,18 @@ /* global options */ static struct gentest_options { - bool showall; - bool analyze; - bool analyze_always; - bool analyze_continuous; + int showall; + int analyze; + int analyze_always; + int analyze_continuous; uint_t max_open_handles; uint_t seed; uint_t numops; - bool use_oplocks; + int use_oplocks; char **ignore_patterns; const char *seeds_file; - bool use_preset_seeds; - bool fast_reconnect; + int use_preset_seeds; + int fast_reconnect; } options; /* mapping between open handles on the server and local handles */ -- cgit From d49f94621bd1d18437d5846d61b84054f35d39e4 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 16 Apr 2008 17:21:48 +0200 Subject: Provide stubs when the [todo] attribute is set. (This used to be commit 356a5d24747bb5e1ef9774c690a5ec386a4a165e) --- source4/librpc/idl/policyagent.idl | 2 +- source4/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm | 54 ++++++++++++++++++------ 2 files changed, 42 insertions(+), 14 deletions(-) diff --git a/source4/librpc/idl/policyagent.idl b/source4/librpc/idl/policyagent.idl index 295b70a2a1..ab137faf27 100644 --- a/source4/librpc/idl/policyagent.idl +++ b/source4/librpc/idl/policyagent.idl @@ -9,5 +9,5 @@ { /*****************/ /* Function 0x00 */ - WERROR policyagent_Dummy(); + [todo] WERROR policyagent_Dummy(); } diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm index e9c158e933..f8209be654 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm @@ -7,6 +7,7 @@ package Parse::Pidl::Samba4::NDR::Client; use Parse::Pidl::Samba4 qw(choose_header is_intree); +use Parse::Pidl::Util qw(has_property); use vars qw($VERSION); $VERSION = '0.01'; @@ -15,30 +16,45 @@ use strict; my($res,$res_hdr); -##################################################################### -# parse a function -sub ParseFunction($$) +sub ParseFunctionSend($$$) { - my ($interface, $fn) = @_; - my $name = $fn->{NAME}; + my ($interface, $fn, $name) = @_; my $uname = uc $name; - $res_hdr .= "\nstruct rpc_request *dcerpc_$name\_send(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name *r); -NTSTATUS dcerpc_$name(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name *r); -"; + my $proto = "struct rpc_request *dcerpc_$name\_send(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name *r)"; - $res .= " -struct rpc_request *dcerpc_$name\_send(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name *r) -{ + $res_hdr .= "\n$proto;\n"; + + $res .= "$proto\n{\n"; + + if (has_property($fn, "todo")) { + $res .= "\treturn NULL;\n"; + } else { + $res .= " if (p->conn->flags & DCERPC_DEBUG_PRINT_IN) { NDR_PRINT_IN_DEBUG($name, r); } return dcerpc_ndr_request_send(p, NULL, &ndr_table_$interface->{NAME}, NDR_$uname, mem_ctx, r); +"; + } + + $res .= "}\n\n"; } -NTSTATUS dcerpc_$name(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name *r) +sub ParseFunctionSync($$$) { + my ($interface, $fn, $name) = @_; + + my $proto = "NTSTATUS dcerpc_$name(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name *r)"; + + $res_hdr .= "\n$proto;\n"; + $res .= "$proto\n{\n"; + + if (has_property($fn, "todo")) { + $res .= "\treturn NT_STATUS_NOT_IMPLEMENTED;\n"; + } else { + $res .= " struct rpc_request *req; NTSTATUS status; @@ -58,8 +74,20 @@ NTSTATUS dcerpc_$name(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name * $res .= " return status; -} "; + } + + $res .= "}\n\n"; +} + +##################################################################### +# parse a function +sub ParseFunction($$) +{ + my ($interface, $fn) = @_; + + ParseFunctionSend($interface, $fn, $fn->{NAME}); + ParseFunctionSync($interface, $fn, $fn->{NAME}); } my %done; -- cgit From 80ad7025cfb3cd7ec13da461125515fdb10fa94f Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 16 Apr 2008 17:33:58 +0200 Subject: Adjust the expectations of the struct based winbind test. These expectations (such as what happens when we have no trusted domains) were incorrect, compared with Samba3 (which is the reference for this protocol). Andrew Bartlett (This used to be commit 29d5de9e8fb69346e29a95c6fcaefabd018c9447) --- source4/selftest/samba4_tests.sh | 2 +- source4/torture/winbind/struct_based.c | 21 ++++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/source4/selftest/samba4_tests.sh b/source4/selftest/samba4_tests.sh index a021fff892..730846dae3 100755 --- a/source4/selftest/samba4_tests.sh +++ b/source4/selftest/samba4_tests.sh @@ -301,7 +301,7 @@ for t in $NBT_TESTS; do plansmbtorturetest "$t" dc //\$SERVER/_none_ -U\$USERNAME%\$PASSWORD done -WB_OPTS="--option=\"torture:strict mode=yes\"" +WB_OPTS="--option=\"torture:strict mode=no\"" WB_OPTS="${WB_OPTS} --option=\"torture:timelimit=1\"" WB_OPTS="${WB_OPTS} --option=\"torture:winbindd separator=/\"" WB_OPTS="${WB_OPTS} --option=\"torture:winbindd private pipe dir=\$WINBINDD_PRIV_PIPE_DIR\"" diff --git a/source4/torture/winbind/struct_based.c b/source4/torture/winbind/struct_based.c index f9e4e148c3..87378aadb8 100644 --- a/source4/torture/winbind/struct_based.c +++ b/source4/torture/winbind/struct_based.c @@ -295,6 +295,10 @@ static bool get_trusted_domains(struct torture_context *torture, DO_STRUCT_REQ_REP(WINBINDD_LIST_TRUSTDOM, &req, &rep); extra_data = (char *)rep.extra_data.data; + if (!extra_data) { + return true; + } + torture_assert(torture, extra_data, "NULL trust list"); while (next_token(&extra_data, line, "\n", sizeof(fstring))) { @@ -356,7 +360,6 @@ static bool torture_winbind_struct_list_trustdom(struct torture_context *torture DO_STRUCT_REQ_REP(WINBINDD_LIST_TRUSTDOM, &req, &rep); list1 = (char *)rep.extra_data.data; - torture_assert(torture, list1, "NULL trust list"); torture_comment(torture, "%s\n", list1); @@ -368,7 +371,6 @@ static bool torture_winbind_struct_list_trustdom(struct torture_context *torture DO_STRUCT_REQ_REP(WINBINDD_LIST_TRUSTDOM, &req, &rep); list2 = (char *)rep.extra_data.data; - torture_assert(torture, list2, "NULL trust list"); /* * The list_all_domains parameter should be ignored @@ -381,7 +383,7 @@ static bool torture_winbind_struct_list_trustdom(struct torture_context *torture ok = get_trusted_domains(torture, &listd); torture_assert(torture, ok, "failed to get trust list"); - for (i=0; listd[i].netbios_name; i++) { + for (i=0; listd && listd[i].netbios_name; i++) { if (i == 0) { struct dom_sid *builtin_sid; @@ -424,7 +426,7 @@ static bool torture_winbind_struct_domain_info(struct torture_context *torture) ok = get_trusted_domains(torture, &listd); torture_assert(torture, ok, "failed to get trust list"); - for (i=0; listd[i].netbios_name; i++) { + for (i=0; listd && listd[i].netbios_name; i++) { struct winbindd_request req; struct winbindd_response rep; struct dom_sid *sid; @@ -485,14 +487,14 @@ static bool torture_winbind_struct_getdcname(struct torture_context *torture) bool ok; bool strict = torture_setting_bool(torture, "strict mode", false); struct torture_trust_domain *listd = NULL; - uint32_t i; + uint32_t i, count = 0; torture_comment(torture, "Running WINBINDD_GETDCNAME (struct based)\n"); ok = get_trusted_domains(torture, &listd); torture_assert(torture, ok, "failed to get trust list"); - for (i=0; listd[i].netbios_name; i++) { + for (i=0; listd && listd[i].netbios_name; i++) { struct winbindd_request req; struct winbindd_response rep; @@ -512,8 +514,13 @@ static bool torture_winbind_struct_getdcname(struct torture_context *torture) /* TODO: check rep.data.dc_name; */ torture_comment(torture, "DOMAIN '%s' => DCNAME '%s'\n", req.domain_name, rep.data.dc_name); + count++; } + if (strict) { + torture_assert(torture, count > 0, + "WiNBINDD_GETDCNAME was not tested"); + } return true; } @@ -530,7 +537,7 @@ static bool torture_winbind_struct_dsgetdcname(struct torture_context *torture) ok = get_trusted_domains(torture, &listd); torture_assert(torture, ok, "failed to get trust list"); - for (i=0; listd[i].netbios_name; i++) { + for (i=0; listd && listd[i].netbios_name; i++) { struct winbindd_request req; struct winbindd_response rep; -- cgit From c47286e57a80b731a4e7d938572f3b6f0a0a6c57 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 16 Apr 2008 18:11:37 +0200 Subject: Fix todo element on actually implemented function. (This used to be commit dedbeea4d28ae10a15766e38e59593a2799183f3) --- source4/librpc/idl/drsuapi.idl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source4/librpc/idl/drsuapi.idl b/source4/librpc/idl/drsuapi.idl index 9652571668..2f48287233 100644 --- a/source4/librpc/idl/drsuapi.idl +++ b/source4/librpc/idl/drsuapi.idl @@ -849,7 +849,7 @@ interface drsuapi [case(1)] drsuapi_DsNameCtr1 *ctr1; } drsuapi_DsNameCtr; - [todo] WERROR drsuapi_DsCrackNames( + WERROR drsuapi_DsCrackNames( [in] policy_handle *bind_handle, [in, out] int32 level, [in,switch_is(level)] drsuapi_DsNameRequest req, -- cgit From a5d52174bd993b32d01d26a795a56df4a92eba45 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 16 Apr 2008 22:30:15 +0200 Subject: Avoid event_find_context() when the event context is already available in the net utility. (This used to be commit d40804777edf41889bd461f63f7a07cc1cc60e27) --- source4/utils/net/net.c | 1 + source4/utils/net/net.h | 1 + source4/utils/net/net_join.c | 2 +- source4/utils/net/net_password.c | 4 ++-- source4/utils/net/net_time.c | 2 +- source4/utils/net/net_user.c | 4 ++-- source4/utils/net/net_vampire.c | 6 +++--- 7 files changed, 11 insertions(+), 9 deletions(-) diff --git a/source4/utils/net/net.c b/source4/utils/net/net.c index 6086a4ce32..ab81f07225 100644 --- a/source4/utils/net/net.c +++ b/source4/utils/net/net.c @@ -199,6 +199,7 @@ static int binary_net(int argc, const char **argv) ZERO_STRUCTP(ctx); ctx->lp_ctx = cmdline_lp_ctx; ctx->credentials = cmdline_credentials; + ctx->event_ctx = ev; cli_credentials_set_event_context(ctx->credentials, ev); rc = net_run_function(ctx, argc_new-1, argv_new+1, net_functable, net_usage); diff --git a/source4/utils/net/net.h b/source4/utils/net/net.h index 17388079dd..309bee277c 100644 --- a/source4/utils/net/net.h +++ b/source4/utils/net/net.h @@ -24,6 +24,7 @@ struct net_context { struct cli_credentials *credentials; struct loadparm_context *lp_ctx; + struct event_context *event_ctx; }; struct net_functable { diff --git a/source4/utils/net/net_join.c b/source4/utils/net/net_join.c index 37b3c21fcf..ad63340089 100644 --- a/source4/utils/net/net_join.c +++ b/source4/utils/net/net_join.c @@ -58,7 +58,7 @@ int net_join(struct net_context *ctx, int argc, const char **argv) domain_name = tmp; - libnetctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx); + libnetctx = libnet_context_init(ctx->event_ctx, ctx->lp_ctx); if (!libnetctx) { return -1; } diff --git a/source4/utils/net/net_password.c b/source4/utils/net/net_password.c index 97bb467fac..55f7c3c31d 100644 --- a/source4/utils/net/net_password.c +++ b/source4/utils/net/net_password.c @@ -53,7 +53,7 @@ static int net_password_change(struct net_context *ctx, int argc, const char **a new_password = getpass(password_prompt); } - libnetctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx); + libnetctx = libnet_context_init(ctx->event_ctx, ctx->lp_ctx); if (!libnetctx) { return -1; } @@ -128,7 +128,7 @@ static int net_password_set(struct net_context *ctx, int argc, const char **argv new_password = getpass(password_prompt); } - libnetctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx); + libnetctx = libnet_context_init(ctx->event_ctx, ctx->lp_ctx); if (!libnetctx) { return -1; } diff --git a/source4/utils/net/net_time.c b/source4/utils/net/net_time.c index 12a8132cea..92e6e77481 100644 --- a/source4/utils/net/net_time.c +++ b/source4/utils/net/net_time.c @@ -43,7 +43,7 @@ int net_time(struct net_context *ctx, int argc, const char **argv) return net_time_usage(ctx, argc, argv); } - libnetctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx); + libnetctx = libnet_context_init(ctx->event_ctx, ctx->lp_ctx); if (!libnetctx) { return -1; } diff --git a/source4/utils/net/net_user.c b/source4/utils/net/net_user.c index 57cef6b383..c4b8ecb0c2 100644 --- a/source4/utils/net/net_user.c +++ b/source4/utils/net/net_user.c @@ -44,7 +44,7 @@ static int net_user_add(struct net_context *ctx, int argc, const char **argv) } /* libnet context init and its params */ - lnet_ctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx); + lnet_ctx = libnet_context_init(ctx->event_ctx, ctx->lp_ctx); if (!lnet_ctx) return -1; lnet_ctx->cred = ctx->credentials; @@ -84,7 +84,7 @@ static int net_user_delete(struct net_context *ctx, int argc, const char **argv) } /* libnet context init and its params */ - lnet_ctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx); + lnet_ctx = libnet_context_init(ctx->event_ctx, ctx->lp_ctx); if (!lnet_ctx) return -1; lnet_ctx->cred = ctx->credentials; diff --git a/source4/utils/net/net_vampire.c b/source4/utils/net/net_vampire.c index 38f05353ed..14f6a07e4b 100644 --- a/source4/utils/net/net_vampire.c +++ b/source4/utils/net/net_vampire.c @@ -54,7 +54,7 @@ static int net_samdump_keytab(struct net_context *ctx, int argc, const char **ar break; } - libnetctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx); + libnetctx = libnet_context_init(ctx->event_ctx, ctx->lp_ctx); if (!libnetctx) { return -1; } @@ -100,7 +100,7 @@ int net_samdump(struct net_context *ctx, int argc, const char **argv) return rc; } - libnetctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx); + libnetctx = libnet_context_init(ctx->event_ctx, ctx->lp_ctx); if (!libnetctx) { return -1; } @@ -142,7 +142,7 @@ int net_samsync_ldb(struct net_context *ctx, int argc, const char **argv) struct libnet_context *libnetctx; struct libnet_samsync_ldb r; - libnetctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx); + libnetctx = libnet_context_init(ctx->event_ctx, ctx->lp_ctx); if (!libnetctx) { return -1; } -- cgit From a195cd9d8f3d0c0185fbf82388bd1efaa63e7bd5 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 16 Apr 2008 22:52:07 +0200 Subject: Use readily available event context. (This used to be commit 2823fca23a4cacc996c808f22cba50b4482b5921) --- source4/ntvfs/posix/vfs_posix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source4/ntvfs/posix/vfs_posix.c b/source4/ntvfs/posix/vfs_posix.c index ebc2d88e70..14b5210fd0 100644 --- a/source4/ntvfs/posix/vfs_posix.c +++ b/source4/ntvfs/posix/vfs_posix.c @@ -219,7 +219,7 @@ static NTSTATUS pvfs_connect(struct ntvfs_module_context *ntvfs, pvfs->ntvfs->ctx->server_id, pvfs->ntvfs->ctx->msg_ctx, pvfs->ntvfs->ctx->lp_ctx, - event_context_find(pvfs), + pvfs->ntvfs->ctx->event_ctx, pvfs->ntvfs->ctx->config); pvfs->wbc_ctx = wbc_init(pvfs, -- cgit From 4b9c7df9b7465a360e7a528a116ed3740447b7be Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 16 Apr 2008 23:06:27 +0200 Subject: Avoid event_find_context when a event context is already available. (This used to be commit 4ca264679ecfd938c538a93f4efff1bfa23c3744) --- source4/torture/raw/oplock.c | 3 +-- source4/torture/smb2/scan.c | 4 ++-- source4/torture/smb2/util.c | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/source4/torture/raw/oplock.c b/source4/torture/raw/oplock.c index 1927a0f027..fd8d292980 100644 --- a/source4/torture/raw/oplock.c +++ b/source4/torture/raw/oplock.c @@ -2841,13 +2841,12 @@ bool torture_bench_oplock(struct torture_context *torture) int timelimit = torture_setting_int(torture, "timelimit", 10); union smb_open io; struct timeval tv; - struct event_context *ev = event_context_find(mem_ctx); cli = talloc_array(mem_ctx, struct smbcli_state *, torture_nprocs); torture_comment(torture, "Opening %d connections\n", torture_nprocs); for (i=0;iev)) { return false; } talloc_steal(mem_ctx, cli[i]); diff --git a/source4/torture/smb2/scan.c b/source4/torture/smb2/scan.c index 0f4c9fefdf..889d343a49 100644 --- a/source4/torture/smb2/scan.c +++ b/source4/torture/smb2/scan.c @@ -207,7 +207,7 @@ bool torture_smb2_scan(struct torture_context *torture) status = smb2_connect(mem_ctx, host, share, lp_resolve_context(torture->lp_ctx), credentials, &tree, - event_context_find(mem_ctx)); + torture->ev); if (!NT_STATUS_IS_OK(status)) { printf("Connection failed - %s\n", nt_errstr(status)); return false; @@ -224,7 +224,7 @@ bool torture_smb2_scan(struct torture_context *torture) status = smb2_connect(mem_ctx, host, share, lp_resolve_context(torture->lp_ctx), credentials, &tree, - event_context_find(mem_ctx)); + torture->ev); if (!NT_STATUS_IS_OK(status)) { printf("Connection failed - %s\n", nt_errstr(status)); return false; diff --git a/source4/torture/smb2/util.c b/source4/torture/smb2/util.c index f85b1c42ff..6ac3926c98 100644 --- a/source4/torture/smb2/util.c +++ b/source4/torture/smb2/util.c @@ -314,7 +314,7 @@ bool torture_smb2_connection(struct torture_context *tctx, struct smb2_tree **tr status = smb2_connect(tctx, host, share, lp_resolve_context(tctx->lp_ctx), credentials, tree, - event_context_find(tctx)); + tctx->ev); if (!NT_STATUS_IS_OK(status)) { printf("Failed to connect to SMB2 share \\\\%s\\%s - %s\n", host, share, nt_errstr(status)); -- cgit From 1efbd5fbf6b0f606ed29a763e2adfa6f99c6beac Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 17 Apr 2008 01:03:18 +0200 Subject: Remove event context tracking from the credentials struct. (This used to be commit 4d7fc946b2ec50e774689c9036423b6feef99b8e) --- source4/auth/credentials/credentials.c | 22 +--------------- source4/auth/credentials/credentials.h | 16 ++++++++---- source4/auth/credentials/credentials_files.c | 14 +++++++---- source4/auth/credentials/credentials_krb5.c | 35 ++++++++++++++++---------- source4/auth/credentials/credentials_krb5.h | 1 + source4/auth/gensec/gensec_gssapi.c | 10 +++++--- source4/auth/gensec/gensec_krb5.c | 12 ++++++--- source4/client/client.c | 3 ++- source4/dsdb/samdb/ldb_modules/update_keytab.c | 4 +-- source4/kdc/kpasswdd.c | 2 +- source4/libnet/libnet_samdump_keytab.c | 7 ++++-- source4/librpc/rpc/dcerpc_util.c | 1 - source4/ntvfs/cifs/vfs_cifs.c | 2 -- source4/torture/raw/open.c | 10 +++----- source4/torture/rpc/async_bind.c | 7 +----- source4/torture/smbtorture.c | 2 +- source4/utils/net/net.c | 1 - source4/winbind/wb_init_domain.c | 2 -- source4/winbind/wb_samba3_cmd.c | 2 -- 19 files changed, 76 insertions(+), 77 deletions(-) diff --git a/source4/auth/credentials/credentials.c b/source4/auth/credentials/credentials.c index 89dddc9e05..bfed451689 100644 --- a/source4/auth/credentials/credentials.c +++ b/source4/auth/credentials/credentials.c @@ -65,7 +65,6 @@ _PUBLIC_ struct cli_credentials *cli_credentials_init(TALLOC_CTX *mem_ctx) cred->tries = 3; cred->callback_running = false; - cred->ev = NULL; cli_credentials_set_kerberos_state(cred, CRED_AUTO_USE_KERBEROS); cli_credentials_set_gensec_features(cred, 0); @@ -675,7 +674,7 @@ _PUBLIC_ void cli_credentials_guess(struct cli_credentials *cred, } if (cli_credentials_get_kerberos_state(cred) != CRED_DONT_USE_KERBEROS) { - cli_credentials_set_ccache(cred, lp_ctx, NULL, CRED_GUESS_FILE); + cli_credentials_set_ccache(cred, event_context_find(cred), lp_ctx, NULL, CRED_GUESS_FILE); } } @@ -775,22 +774,3 @@ _PUBLIC_ bool cli_credentials_wrong_password(struct cli_credentials *cred) return (cred->tries > 0); } - -/* - set the common event context for this set of credentials - */ -_PUBLIC_ void cli_credentials_set_event_context(struct cli_credentials *cred, struct event_context *ev) -{ - cred->ev = ev; -} - -/* - set the common event context for this set of credentials - */ -_PUBLIC_ struct event_context *cli_credentials_get_event_context(struct cli_credentials *cred) -{ - if (cred->ev == NULL) { - cred->ev = event_context_find(cred); - } - return cred->ev; -} diff --git a/source4/auth/credentials/credentials.h b/source4/auth/credentials/credentials.h index afcb300638..2514b5b1ce 100644 --- a/source4/auth/credentials/credentials.h +++ b/source4/auth/credentials/credentials.h @@ -26,6 +26,7 @@ #include "librpc/gen_ndr/misc.h" struct ccache_container; +struct event_context; /* In order of priority */ enum credentials_obtained { @@ -121,9 +122,6 @@ struct cli_credentials { /* Whether any callback is currently running */ bool callback_running; - - /* an event context for anyone wanting to use the credentials */ - struct event_context *ev; }; struct ldb_context; @@ -152,12 +150,15 @@ NTSTATUS cli_credentials_get_ntlm_response(struct cli_credentials *cred, TALLOC_ const char *cli_credentials_get_realm(struct cli_credentials *cred); const char *cli_credentials_get_username(struct cli_credentials *cred); int cli_credentials_get_krb5_context(struct cli_credentials *cred, + struct event_context *event_ctx, struct loadparm_context *lp_ctx, struct smb_krb5_context **smb_krb5_context); int cli_credentials_get_ccache(struct cli_credentials *cred, + struct event_context *event_ctx, struct loadparm_context *lp_ctx, struct ccache_container **ccc); int cli_credentials_get_keytab(struct cli_credentials *cred, + struct event_context *event_ctx, struct loadparm_context *lp_ctx, struct keytab_container **_ktc); const char *cli_credentials_get_domain(struct cli_credentials *cred); @@ -168,15 +169,15 @@ void cli_credentials_set_conf(struct cli_credentials *cred, struct loadparm_context *lp_ctx); const char *cli_credentials_get_principal(struct cli_credentials *cred, TALLOC_CTX *mem_ctx); int cli_credentials_get_server_gss_creds(struct cli_credentials *cred, + struct event_context *event_ctx, struct loadparm_context *lp_ctx, struct gssapi_creds_container **_gcc); int cli_credentials_get_client_gss_creds(struct cli_credentials *cred, + struct event_context *event_ctx, struct loadparm_context *lp_ctx, struct gssapi_creds_container **_gcc); -void cli_credentials_set_event_context(struct cli_credentials *cred, struct event_context *ev); void cli_credentials_set_kerberos_state(struct cli_credentials *creds, enum credentials_use_kerberos use_kerberos); -struct event_context *cli_credentials_get_event_context(struct cli_credentials *cred); bool cli_credentials_set_domain(struct cli_credentials *cred, const char *val, enum credentials_obtained obtained); @@ -199,6 +200,7 @@ void cli_credentials_set_netlogon_creds(struct cli_credentials *cred, NTSTATUS cli_credentials_set_krb5_context(struct cli_credentials *cred, struct smb_krb5_context *smb_krb5_context); NTSTATUS cli_credentials_set_stored_principal(struct cli_credentials *cred, + struct event_context *event_ctx, struct loadparm_context *lp_ctx, const char *serviceprincipal); NTSTATUS cli_credentials_set_machine_account(struct cli_credentials *cred, @@ -220,14 +222,17 @@ bool cli_credentials_set_nt_hash(struct cli_credentials *cred, const struct samr_Password *nt_hash, enum credentials_obtained obtained); int cli_credentials_set_keytab_name(struct cli_credentials *cred, + struct event_context *event_ctx, struct loadparm_context *lp_ctx, const char *keytab_name, enum credentials_obtained obtained); int cli_credentials_update_keytab(struct cli_credentials *cred, + struct event_context *event_ctx, struct loadparm_context *lp_ctx); void cli_credentials_set_gensec_features(struct cli_credentials *creds, uint32_t gensec_features); uint32_t cli_credentials_get_gensec_features(struct cli_credentials *creds); int cli_credentials_set_ccache(struct cli_credentials *cred, + struct event_context *event_ctx, struct loadparm_context *lp_ctx, const char *name, enum credentials_obtained obtained); @@ -239,6 +244,7 @@ void cli_credentials_invalidate_ccache(struct cli_credentials *cred, void cli_credentials_set_salt_principal(struct cli_credentials *cred, const char *principal); enum credentials_use_kerberos cli_credentials_get_kerberos_state(struct cli_credentials *creds); NTSTATUS cli_credentials_set_secrets(struct cli_credentials *cred, + struct event_context *event_ctx, struct loadparm_context *lp_ctx, struct ldb_context *ldb, const char *base, diff --git a/source4/auth/credentials/credentials_files.c b/source4/auth/credentials/credentials_files.c index 1bbdf8a5ad..ab76ea2cde 100644 --- a/source4/auth/credentials/credentials_files.c +++ b/source4/auth/credentials/credentials_files.c @@ -30,6 +30,7 @@ #include "auth/credentials/credentials.h" #include "auth/credentials/credentials_krb5.h" #include "param/param.h" +#include "lib/events/events.h" /** * Read a file descriptor, and parse it for a password (eg from a file or stdin) @@ -169,6 +170,7 @@ _PUBLIC_ bool cli_credentials_parse_file(struct cli_credentials *cred, const cha * @retval NTSTATUS error detailing any failure */ _PUBLIC_ NTSTATUS cli_credentials_set_secrets(struct cli_credentials *cred, + struct event_context *event_ctx, struct loadparm_context *lp_ctx, struct ldb_context *ldb, const char *base, @@ -305,13 +307,13 @@ _PUBLIC_ NTSTATUS cli_credentials_set_secrets(struct cli_credentials *cred, * (chewing CPU time) from the password */ keytab = ldb_msg_find_attr_as_string(msgs[0], "krb5Keytab", NULL); if (keytab) { - cli_credentials_set_keytab_name(cred, lp_ctx, keytab, CRED_SPECIFIED); + cli_credentials_set_keytab_name(cred, event_ctx, lp_ctx, keytab, CRED_SPECIFIED); } else { keytab = ldb_msg_find_attr_as_string(msgs[0], "privateKeytab", NULL); if (keytab) { keytab = talloc_asprintf(mem_ctx, "FILE:%s", private_path(mem_ctx, lp_ctx, keytab)); if (keytab) { - cli_credentials_set_keytab_name(cred, lp_ctx, keytab, CRED_SPECIFIED); + cli_credentials_set_keytab_name(cred, event_ctx, lp_ctx, keytab, CRED_SPECIFIED); } } } @@ -336,7 +338,7 @@ _PUBLIC_ NTSTATUS cli_credentials_set_machine_account(struct cli_credentials *cr cred->machine_account_pending = false; filter = talloc_asprintf(cred, SECRETS_PRIMARY_DOMAIN_FILTER, cli_credentials_get_domain(cred)); - return cli_credentials_set_secrets(cred, lp_ctx, NULL, + return cli_credentials_set_secrets(cred, event_context_find(cred), lp_ctx, NULL, SECRETS_PRIMARY_DOMAIN_DN, filter); } @@ -348,6 +350,7 @@ _PUBLIC_ NTSTATUS cli_credentials_set_machine_account(struct cli_credentials *cr * @retval NTSTATUS error detailing any failure */ NTSTATUS cli_credentials_set_krbtgt(struct cli_credentials *cred, + struct event_context *event_ctx, struct loadparm_context *lp_ctx) { char *filter; @@ -358,7 +361,7 @@ NTSTATUS cli_credentials_set_krbtgt(struct cli_credentials *cred, filter = talloc_asprintf(cred, SECRETS_KRBTGT_SEARCH, cli_credentials_get_realm(cred), cli_credentials_get_domain(cred)); - return cli_credentials_set_secrets(cred, lp_ctx, NULL, + return cli_credentials_set_secrets(cred, event_ctx, lp_ctx, NULL, SECRETS_PRINCIPALS_DN, filter); } @@ -370,6 +373,7 @@ NTSTATUS cli_credentials_set_krbtgt(struct cli_credentials *cred, * @retval NTSTATUS error detailing any failure */ _PUBLIC_ NTSTATUS cli_credentials_set_stored_principal(struct cli_credentials *cred, + struct event_context *event_ctx, struct loadparm_context *lp_ctx, const char *serviceprincipal) { @@ -382,7 +386,7 @@ _PUBLIC_ NTSTATUS cli_credentials_set_stored_principal(struct cli_credentials *c cli_credentials_get_realm(cred), cli_credentials_get_domain(cred), serviceprincipal); - return cli_credentials_set_secrets(cred, lp_ctx, NULL, + return cli_credentials_set_secrets(cred, event_ctx, lp_ctx, NULL, SECRETS_PRINCIPALS_DN, filter); } diff --git a/source4/auth/credentials/credentials_krb5.c b/source4/auth/credentials/credentials_krb5.c index cd9285b09d..3bc1764448 100644 --- a/source4/auth/credentials/credentials_krb5.c +++ b/source4/auth/credentials/credentials_krb5.c @@ -30,6 +30,7 @@ #include "param/param.h" _PUBLIC_ int cli_credentials_get_krb5_context(struct cli_credentials *cred, + struct event_context *event_ctx, struct loadparm_context *lp_ctx, struct smb_krb5_context **smb_krb5_context) { @@ -39,8 +40,7 @@ _PUBLIC_ int cli_credentials_get_krb5_context(struct cli_credentials *cred, return 0; } - ret = smb_krb5_init_context(cred, cli_credentials_get_event_context(cred), - lp_ctx, &cred->smb_krb5_context); + ret = smb_krb5_init_context(cred, event_ctx, lp_ctx, &cred->smb_krb5_context); if (ret) { cred->smb_krb5_context = NULL; return ret; @@ -128,6 +128,7 @@ static int free_dccache(struct ccache_container *ccc) { } _PUBLIC_ int cli_credentials_set_ccache(struct cli_credentials *cred, + struct event_context *event_ctx, struct loadparm_context *lp_ctx, const char *name, enum credentials_obtained obtained) @@ -144,7 +145,7 @@ _PUBLIC_ int cli_credentials_set_ccache(struct cli_credentials *cred, return ENOMEM; } - ret = cli_credentials_get_krb5_context(cred, lp_ctx, + ret = cli_credentials_get_krb5_context(cred, event_ctx, lp_ctx, &ccc->smb_krb5_context); if (ret) { talloc_free(ccc); @@ -203,6 +204,7 @@ _PUBLIC_ int cli_credentials_set_ccache(struct cli_credentials *cred, static int cli_credentials_new_ccache(struct cli_credentials *cred, + struct event_context *event_ctx, struct loadparm_context *lp_ctx, struct ccache_container **_ccc) { @@ -221,7 +223,7 @@ static int cli_credentials_new_ccache(struct cli_credentials *cred, return ENOMEM; } - ret = cli_credentials_get_krb5_context(cred, lp_ctx, + ret = cli_credentials_get_krb5_context(cred, event_ctx, lp_ctx, &ccc->smb_krb5_context); if (ret) { talloc_free(ccc); @@ -253,6 +255,7 @@ static int cli_credentials_new_ccache(struct cli_credentials *cred, } _PUBLIC_ int cli_credentials_get_ccache(struct cli_credentials *cred, + struct event_context *event_ctx, struct loadparm_context *lp_ctx, struct ccache_container **ccc) { @@ -271,7 +274,7 @@ _PUBLIC_ int cli_credentials_get_ccache(struct cli_credentials *cred, return EINVAL; } - ret = cli_credentials_new_ccache(cred, lp_ctx, ccc); + ret = cli_credentials_new_ccache(cred, event_ctx, lp_ctx, ccc); if (ret) { return ret; } @@ -348,6 +351,7 @@ static int free_gssapi_creds(struct gssapi_creds_container *gcc) } _PUBLIC_ int cli_credentials_get_client_gss_creds(struct cli_credentials *cred, + struct event_context *event_ctx, struct loadparm_context *lp_ctx, struct gssapi_creds_container **_gcc) { @@ -360,7 +364,7 @@ _PUBLIC_ int cli_credentials_get_client_gss_creds(struct cli_credentials *cred, *_gcc = cred->client_gss_creds; return 0; } - ret = cli_credentials_get_ccache(cred, lp_ctx, + ret = cli_credentials_get_ccache(cred, event_ctx, lp_ctx, &ccache); if (ret) { DEBUG(1, ("Failed to get CCACHE for GSSAPI client: %s\n", error_message(ret))); @@ -402,6 +406,7 @@ _PUBLIC_ int cli_credentials_get_client_gss_creds(struct cli_credentials *cred, */ int cli_credentials_set_client_gss_creds(struct cli_credentials *cred, + struct event_context *event_ctx, struct loadparm_context *lp_ctx, gss_cred_id_t gssapi_cred, enum credentials_obtained obtained) @@ -419,7 +424,7 @@ _PUBLIC_ int cli_credentials_get_client_gss_creds(struct cli_credentials *cred, return ENOMEM; } - ret = cli_credentials_new_ccache(cred, lp_ctx, &ccc); + ret = cli_credentials_new_ccache(cred, event_ctx, lp_ctx, &ccc); if (ret != 0) { return ret; } @@ -456,6 +461,7 @@ _PUBLIC_ int cli_credentials_get_client_gss_creds(struct cli_credentials *cred, * it will be generated from the password. */ _PUBLIC_ int cli_credentials_get_keytab(struct cli_credentials *cred, + struct event_context *event_ctx, struct loadparm_context *lp_ctx, struct keytab_container **_ktc) { @@ -475,7 +481,7 @@ _PUBLIC_ int cli_credentials_get_keytab(struct cli_credentials *cred, return EINVAL; } - ret = cli_credentials_get_krb5_context(cred, lp_ctx, + ret = cli_credentials_get_krb5_context(cred, event_ctx, lp_ctx, &smb_krb5_context); if (ret) { return ret; @@ -510,6 +516,7 @@ _PUBLIC_ int cli_credentials_get_keytab(struct cli_credentials *cred, * FILE:/etc/krb5.keytab), open it and attach it */ _PUBLIC_ int cli_credentials_set_keytab_name(struct cli_credentials *cred, + struct event_context *event_ctx, struct loadparm_context *lp_ctx, const char *keytab_name, enum credentials_obtained obtained) @@ -523,7 +530,7 @@ _PUBLIC_ int cli_credentials_set_keytab_name(struct cli_credentials *cred, return 0; } - ret = cli_credentials_get_krb5_context(cred, lp_ctx, &smb_krb5_context); + ret = cli_credentials_get_krb5_context(cred, event_ctx, lp_ctx, &smb_krb5_context); if (ret) { return ret; } @@ -549,6 +556,7 @@ _PUBLIC_ int cli_credentials_set_keytab_name(struct cli_credentials *cred, } _PUBLIC_ int cli_credentials_update_keytab(struct cli_credentials *cred, + struct event_context *event_ctx, struct loadparm_context *lp_ctx) { krb5_error_code ret; @@ -562,7 +570,7 @@ _PUBLIC_ int cli_credentials_update_keytab(struct cli_credentials *cred, return ENOMEM; } - ret = cli_credentials_get_krb5_context(cred, lp_ctx, &smb_krb5_context); + ret = cli_credentials_get_krb5_context(cred, event_ctx, lp_ctx, &smb_krb5_context); if (ret) { talloc_free(mem_ctx); return ret; @@ -570,7 +578,7 @@ _PUBLIC_ int cli_credentials_update_keytab(struct cli_credentials *cred, enctype_strings = cli_credentials_get_enctype_strings(cred); - ret = cli_credentials_get_keytab(cred, lp_ctx, &ktc); + ret = cli_credentials_get_keytab(cred, event_ctx, lp_ctx, &ktc); if (ret != 0) { talloc_free(mem_ctx); return ret; @@ -585,6 +593,7 @@ _PUBLIC_ int cli_credentials_update_keytab(struct cli_credentials *cred, /* Get server gss credentials (in gsskrb5, this means the keytab) */ _PUBLIC_ int cli_credentials_get_server_gss_creds(struct cli_credentials *cred, + struct event_context *event_ctx, struct loadparm_context *lp_ctx, struct gssapi_creds_container **_gcc) { @@ -603,12 +612,12 @@ _PUBLIC_ int cli_credentials_get_server_gss_creds(struct cli_credentials *cred, return 0; } - ret = cli_credentials_get_krb5_context(cred, lp_ctx, &smb_krb5_context); + ret = cli_credentials_get_krb5_context(cred, event_ctx, lp_ctx, &smb_krb5_context); if (ret) { return ret; } - ret = cli_credentials_get_keytab(cred, lp_ctx, &ktc); + ret = cli_credentials_get_keytab(cred, event_ctx, lp_ctx, &ktc); if (ret) { DEBUG(1, ("Failed to get keytab for GSSAPI server: %s\n", error_message(ret))); return ret; diff --git a/source4/auth/credentials/credentials_krb5.h b/source4/auth/credentials/credentials_krb5.h index aaa7d7f0da..f672b0ad9a 100644 --- a/source4/auth/credentials/credentials_krb5.h +++ b/source4/auth/credentials/credentials_krb5.h @@ -32,6 +32,7 @@ struct gssapi_creds_container { /* Manually prototyped here to avoid needing gss headers in most callers */ int cli_credentials_set_client_gss_creds(struct cli_credentials *cred, + struct event_context *event_ctx, struct loadparm_context *lp_ctx, gss_cred_id_t gssapi_cred, enum credentials_obtained obtained); diff --git a/source4/auth/gensec/gensec_gssapi.c b/source4/auth/gensec/gensec_gssapi.c index e7dcb4ea68..cbee557d5a 100644 --- a/source4/auth/gensec/gensec_gssapi.c +++ b/source4/auth/gensec/gensec_gssapi.c @@ -273,7 +273,9 @@ static NTSTATUS gensec_gssapi_server_start(struct gensec_security *gensec_securi DEBUG(3, ("No machine account credentials specified\n")); return NT_STATUS_CANT_ACCESS_DOMAIN_INFO; } else { - ret = cli_credentials_get_server_gss_creds(machine_account, gensec_security->lp_ctx, &gcc); + ret = cli_credentials_get_server_gss_creds(machine_account, + gensec_security->event_ctx, + gensec_security->lp_ctx, &gcc); if (ret) { DEBUG(1, ("Aquiring acceptor credentials failed: %s\n", error_message(ret))); @@ -359,7 +361,9 @@ static NTSTATUS gensec_gssapi_client_start(struct gensec_security *gensec_securi return NT_STATUS_INVALID_PARAMETER; } - ret = cli_credentials_get_client_gss_creds(creds, gensec_security->lp_ctx, &gcc); + ret = cli_credentials_get_client_gss_creds(creds, + gensec_security->event_ctx, + gensec_security->lp_ctx, &gcc); switch (ret) { case 0: break; @@ -1361,12 +1365,12 @@ static NTSTATUS gensec_gssapi_session_info(struct gensec_security *gensec_securi return NT_STATUS_NO_MEMORY; } - cli_credentials_set_event_context(session_info->credentials, gensec_security->event_ctx); cli_credentials_set_conf(session_info->credentials, gensec_security->lp_ctx); /* Just so we don't segfault trying to get at a username */ cli_credentials_set_anonymous(session_info->credentials); ret = cli_credentials_set_client_gss_creds(session_info->credentials, + gensec_security->event_ctx, gensec_security->lp_ctx, gensec_gssapi_state->delegated_cred_handle, CRED_SPECIFIED); diff --git a/source4/auth/gensec/gensec_krb5.c b/source4/auth/gensec/gensec_krb5.c index ae601b19c2..8abc0f8583 100644 --- a/source4/auth/gensec/gensec_krb5.c +++ b/source4/auth/gensec/gensec_krb5.c @@ -118,7 +118,9 @@ static NTSTATUS gensec_krb5_start(struct gensec_security *gensec_security) talloc_set_destructor(gensec_krb5_state, gensec_krb5_destroy); - if (cli_credentials_get_krb5_context(creds, gensec_security->lp_ctx, &gensec_krb5_state->smb_krb5_context)) { + if (cli_credentials_get_krb5_context(creds, + gensec_security->event_ctx, + gensec_security->lp_ctx, &gensec_krb5_state->smb_krb5_context)) { talloc_free(gensec_krb5_state); return NT_STATUS_INTERNAL_ERROR; } @@ -248,7 +250,9 @@ static NTSTATUS gensec_krb5_client_start(struct gensec_security *gensec_security principal = gensec_get_target_principal(gensec_security); - ret = cli_credentials_get_ccache(gensec_get_credentials(gensec_security), gensec_security->lp_ctx, &ccache_container); + ret = cli_credentials_get_ccache(gensec_get_credentials(gensec_security), + gensec_security->event_ctx, + gensec_security->lp_ctx, &ccache_container); switch (ret) { case 0: break; @@ -446,7 +450,9 @@ static NTSTATUS gensec_krb5_update(struct gensec_security *gensec_security, } /* Grab the keytab, however generated */ - ret = cli_credentials_get_keytab(gensec_get_credentials(gensec_security), gensec_security->lp_ctx, &keytab); + ret = cli_credentials_get_keytab(gensec_get_credentials(gensec_security), + gensec_security->event_ctx, + gensec_security->lp_ctx, &keytab); if (ret) { return NT_STATUS_CANT_ACCESS_DOMAIN_INFO; } diff --git a/source4/client/client.c b/source4/client/client.c index 775aa69d37..ef88913c4d 100644 --- a/source4/client/client.c +++ b/source4/client/client.c @@ -32,6 +32,7 @@ #include "includes.h" #include "version.h" #include "libcli/libcli.h" +#include "lib/events/events.h" #include "lib/cmdline/popt_common.h" #include "librpc/gen_ndr/ndr_srvsvc_c.h" #include "librpc/gen_ndr/ndr_lsa.h" @@ -3044,7 +3045,7 @@ static bool do_connect(struct smbclient_context *ctx, status = smbcli_full_connection(ctx, &ctx->cli, server, ports, share, NULL, cred, resolve_ctx, - cli_credentials_get_event_context(cred), + event_context_init(NULL), options); if (!NT_STATUS_IS_OK(status)) { d_printf("Connection to \\\\%s\\%s failed - %s\n", diff --git a/source4/dsdb/samdb/ldb_modules/update_keytab.c b/source4/dsdb/samdb/ldb_modules/update_keytab.c index 54362dcfd4..3096ce8dd9 100644 --- a/source4/dsdb/samdb/ldb_modules/update_keytab.c +++ b/source4/dsdb/samdb/ldb_modules/update_keytab.c @@ -90,7 +90,7 @@ static int add_modified(struct ldb_module *module, struct ldb_dn *dn, bool delet } cli_credentials_set_conf(item->creds, ldb_get_opaque(module->ldb, "loadparm")); - status = cli_credentials_set_secrets(item->creds, ldb_get_opaque(module->ldb, "loadparm"), module->ldb, NULL, filter); + status = cli_credentials_set_secrets(item->creds, ldb_get_opaque(module->ldb, "event_ctx"), ldb_get_opaque(module->ldb, "loadparm"), module->ldb, NULL, filter); talloc_free(filter); if (NT_STATUS_IS_OK(status)) { if (delete) { @@ -158,7 +158,7 @@ static int update_kt_end_trans(struct ldb_module *module) struct dn_list *p; for (p=data->changed_dns; p; p = p->next) { int kret; - kret = cli_credentials_update_keytab(p->creds, ldb_get_opaque(module->ldb, "loadparm")); + kret = cli_credentials_update_keytab(p->creds, ldb_get_opaque(module->ldb, "event_ctx"), ldb_get_opaque(module->ldb, "loadparm")); if (kret != 0) { talloc_free(data->changed_dns); data->changed_dns = NULL; diff --git a/source4/kdc/kpasswdd.c b/source4/kdc/kpasswdd.c index f468fea6c4..3635676d17 100644 --- a/source4/kdc/kpasswdd.c +++ b/source4/kdc/kpasswdd.c @@ -474,7 +474,7 @@ bool kpasswdd_process(struct kdc_server *kdc, * we already have, rather than a new context */ cli_credentials_set_krb5_context(server_credentials, kdc->smb_krb5_context); cli_credentials_set_conf(server_credentials, kdc->task->lp_ctx); - nt_status = cli_credentials_set_stored_principal(server_credentials, kdc->task->lp_ctx, "kadmin/changepw"); + nt_status = cli_credentials_set_stored_principal(server_credentials, kdc->task->event_ctx, kdc->task->lp_ctx, "kadmin/changepw"); if (!NT_STATUS_IS_OK(nt_status)) { ret = kpasswdd_make_unauth_error_reply(kdc, mem_ctx, KRB5_KPASSWD_HARDERROR, diff --git a/source4/libnet/libnet_samdump_keytab.c b/source4/libnet/libnet_samdump_keytab.c index c25cb4d9c5..0c4d3e5c59 100644 --- a/source4/libnet/libnet_samdump_keytab.c +++ b/source4/libnet/libnet_samdump_keytab.c @@ -26,8 +26,10 @@ #include "auth/credentials/credentials.h" #include "auth/credentials/credentials_krb5.h" #include "param/param.h" +#include "lib/events/events.h" static NTSTATUS samdump_keytab_handle_user(TALLOC_CTX *mem_ctx, + struct event_context *event_ctx, struct loadparm_context *lp_ctx, const char *keytab_name, struct netr_DELTA_ENUM *delta) @@ -53,12 +55,12 @@ static NTSTATUS samdump_keytab_handle_user(TALLOC_CTX *mem_ctx, * pass a value in here */ cli_credentials_set_kvno(credentials, 0); cli_credentials_set_nt_hash(credentials, &user->ntpassword, CRED_SPECIFIED); - ret = cli_credentials_set_keytab_name(credentials, lp_ctx, keytab_name, CRED_SPECIFIED); + ret = cli_credentials_set_keytab_name(credentials, event_ctx, lp_ctx, keytab_name, CRED_SPECIFIED); if (ret) { return NT_STATUS_UNSUCCESSFUL; } - ret = cli_credentials_update_keytab(credentials, lp_ctx); + ret = cli_credentials_update_keytab(credentials, event_ctx, lp_ctx); if (ret) { return NT_STATUS_UNSUCCESSFUL; } @@ -82,6 +84,7 @@ static NTSTATUS libnet_samdump_keytab_fn(TALLOC_CTX *mem_ctx, /* not interested in builtin users */ if (database == SAM_DATABASE_DOMAIN) { nt_status = samdump_keytab_handle_user(mem_ctx, + event_context_find(mem_ctx), global_loadparm, keytab_name, delta); diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c index 469c83788c..6f1ee03313 100644 --- a/source4/librpc/rpc/dcerpc_util.c +++ b/source4/librpc/rpc/dcerpc_util.c @@ -245,7 +245,6 @@ struct composite_context *dcerpc_epm_map_binding_send(TALLOC_CTX *mem_ctx, /* anonymous credentials for rpc connection used to get endpoint mapping */ anon_creds = cli_credentials_init(mem_ctx); - cli_credentials_set_event_context(anon_creds, ev); cli_credentials_set_anonymous(anon_creds); /* diff --git a/source4/ntvfs/cifs/vfs_cifs.c b/source4/ntvfs/cifs/vfs_cifs.c index 2feb1a0efe..2b61268733 100644 --- a/source4/ntvfs/cifs/vfs_cifs.c +++ b/source4/ntvfs/cifs/vfs_cifs.c @@ -171,7 +171,6 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs, if (!credentials) { return NT_STATUS_NO_MEMORY; } - cli_credentials_set_event_context(credentials, ntvfs->ctx->event_ctx); cli_credentials_set_conf(credentials, ntvfs->ctx->lp_ctx); cli_credentials_set_username(credentials, user, CRED_SPECIFIED); if (domain) { @@ -181,7 +180,6 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs, } else if (machine_account) { DEBUG(5, ("CIFS backend: Using machine account\n")); credentials = cli_credentials_init(private); - cli_credentials_set_event_context(credentials, ntvfs->ctx->event_ctx); cli_credentials_set_conf(credentials, ntvfs->ctx->lp_ctx); if (domain) { cli_credentials_set_domain(credentials, domain, CRED_SPECIFIED); diff --git a/source4/torture/raw/open.c b/source4/torture/raw/open.c index d28a8bd14e..c6ba0d2571 100644 --- a/source4/torture/raw/open.c +++ b/source4/torture/raw/open.c @@ -1350,21 +1350,19 @@ static bool test_raw_open_multi(struct torture_context *tctx) const char *host = torture_setting_string(tctx, "host", NULL); const char *share = torture_setting_string(tctx, "share", NULL); int i, num_files = 3; - struct event_context *ev; int num_ok = 0; int num_collision = 0; - ev = cli_credentials_get_event_context(cmdline_credentials); clients = talloc_array(mem_ctx, struct smbcli_state *, num_files); requests = talloc_array(mem_ctx, struct smbcli_request *, num_files); ios = talloc_array(mem_ctx, union smb_open, num_files); - if ((ev == NULL) || (clients == NULL) || (requests == NULL) || + if ((tctx->ev == NULL) || (clients == NULL) || (requests == NULL) || (ios == NULL)) { DEBUG(0, ("talloc failed\n")); return false; } - if (!torture_open_connection_share(mem_ctx, &cli, tctx, host, share, ev)) { + if (!torture_open_connection_share(mem_ctx, &cli, tctx, host, share, tctx->ev)) { return false; } @@ -1372,7 +1370,7 @@ static bool test_raw_open_multi(struct torture_context *tctx) for (i=0; iev)) { DEBUG(0, ("Could not open %d'th connection\n", i)); return false; } @@ -1441,7 +1439,7 @@ static bool test_raw_open_multi(struct torture_context *tctx) break; } - if (event_loop_once(ev) != 0) { + if (event_loop_once(tctx->ev) != 0) { DEBUG(0, ("event_loop_once failed\n")); return false; } diff --git a/source4/torture/rpc/async_bind.c b/source4/torture/rpc/async_bind.c index 1ca3c62df0..0ebbef1ce6 100644 --- a/source4/torture/rpc/async_bind.c +++ b/source4/torture/rpc/async_bind.c @@ -39,7 +39,6 @@ bool torture_async_bind(struct torture_context *torture) { NTSTATUS status; TALLOC_CTX *mem_ctx; - struct event_context *evt_ctx; int i; const char *binding_string; struct cli_credentials *creds; @@ -70,15 +69,11 @@ bool torture_async_bind(struct torture_context *torture) /* credentials */ creds = cmdline_credentials; - /* event context */ - evt_ctx = cli_credentials_get_event_context(creds); - if (evt_ctx == NULL) return false; - /* send bind requests */ for (i = 0; i < torture_numasync; i++) { table[i] = &ndr_table_lsarpc; bind_req[i] = dcerpc_pipe_connect_send(mem_ctx, binding_string, - table[i], creds, evt_ctx, torture->lp_ctx); + table[i], creds, torture->ev, torture->lp_ctx); } /* recv bind requests */ diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c index faae784e4b..01a55a67f6 100644 --- a/source4/torture/smbtorture.c +++ b/source4/torture/smbtorture.c @@ -675,7 +675,7 @@ int main(int argc,char *argv[]) exit(1); } - torture = torture_context_init(cli_credentials_get_event_context(cmdline_credentials), ui_ops); + torture = torture_context_init(event_context_init(NULL), ui_ops); if (basedir != NULL) { if (basedir[0] != '/') { fprintf(stderr, "Please specify an absolute path to --basedir\n"); diff --git a/source4/utils/net/net.c b/source4/utils/net/net.c index ab81f07225..a87b266568 100644 --- a/source4/utils/net/net.c +++ b/source4/utils/net/net.c @@ -200,7 +200,6 @@ static int binary_net(int argc, const char **argv) ctx->lp_ctx = cmdline_lp_ctx; ctx->credentials = cmdline_credentials; ctx->event_ctx = ev; - cli_credentials_set_event_context(ctx->credentials, ev); rc = net_run_function(ctx, argc_new-1, argv_new+1, net_functable, net_usage); diff --git a/source4/winbind/wb_init_domain.c b/source4/winbind/wb_init_domain.c index fc35f11db6..c1325bfe09 100644 --- a/source4/winbind/wb_init_domain.c +++ b/source4/winbind/wb_init_domain.c @@ -151,8 +151,6 @@ struct composite_context *wb_init_domain_send(TALLOC_CTX *mem_ctx, state->domain->libnet_ctx->cred = cli_credentials_init(state->domain); if (state->domain->libnet_ctx->cred == NULL) goto failed; - cli_credentials_set_event_context(state->domain->libnet_ctx->cred, service->task->event_ctx); - cli_credentials_set_conf(state->domain->libnet_ctx->cred, service->task->lp_ctx); /* Connect the machine account to the credentials */ diff --git a/source4/winbind/wb_samba3_cmd.c b/source4/winbind/wb_samba3_cmd.c index 7f1520a3b3..f43947e79a 100644 --- a/source4/winbind/wb_samba3_cmd.c +++ b/source4/winbind/wb_samba3_cmd.c @@ -151,8 +151,6 @@ NTSTATUS wbsrv_samba3_check_machacc(struct wbsrv_samba3_call *s3call) return NT_STATUS_NO_MEMORY; } - cli_credentials_set_event_context(creds, service->task->event_ctx); - cli_credentials_set_conf(creds, service->task->lp_ctx); /* Connect the machine account to the credentials */ -- cgit From f875669314ce1398367b85f962941dacef6fc828 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 17 Apr 2008 01:09:33 +0200 Subject: Require passing in an event context to endpoint mapper utility function. (This used to be commit 906b9fe158841c41789952601b36016af6621565) --- source4/librpc/rpc/dcerpc_util.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c index 6f1ee03313..71c6d5f2cc 100644 --- a/source4/librpc/rpc/dcerpc_util.c +++ b/source4/librpc/rpc/dcerpc_util.c @@ -209,32 +209,20 @@ struct composite_context *dcerpc_epm_map_binding_send(TALLOC_CTX *mem_ctx, struct epm_map_binding_state *s; struct composite_context *pipe_connect_req; struct cli_credentials *anon_creds; - struct event_context *new_ev = NULL; NTSTATUS status; struct dcerpc_binding *epmapper_binding; int i; - /* Try to find event context in memory context in case passed - * event_context (argument) was NULL. If there's none, just - * create a new one. - */ if (ev == NULL) { - ev = event_context_find(mem_ctx); - if (ev == NULL) { - new_ev = event_context_init(mem_ctx); - if (new_ev == NULL) return NULL; - ev = new_ev; - } + return NULL; } /* composite context allocation and setup */ c = composite_create(mem_ctx, ev); if (c == NULL) { - talloc_free(new_ev); return NULL; } - talloc_steal(c, new_ev); s = talloc_zero(c, struct epm_map_binding_state); if (composite_nomem(s, c)) return c; -- cgit From 06d06c6c9415140167708d09307125067c1f5b87 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 17 Apr 2008 01:19:20 +0200 Subject: Use provided event context rather than looking for it. (This used to be commit fd0bb96acea3d7949cf0574bb6f3568a90f67f4e) --- source4/torture/ldap/cldapbench.c | 2 +- source4/torture/nbt/dgram.c | 4 ++-- source4/torture/raw/lockbench.c | 7 +++---- source4/torture/raw/offline.c | 11 +++++------ source4/torture/raw/openbench.c | 5 ++--- 5 files changed, 13 insertions(+), 16 deletions(-) diff --git a/source4/torture/ldap/cldapbench.c b/source4/torture/ldap/cldapbench.c index 83e505e164..51586ac733 100644 --- a/source4/torture/ldap/cldapbench.c +++ b/source4/torture/ldap/cldapbench.c @@ -116,7 +116,7 @@ bool torture_bench_cldap(struct torture_context *torture) make_nbt_name_server(&name, torture_setting_string(torture, "host", NULL)); /* do an initial name resolution to find its IP */ - status = resolve_name(lp_resolve_context(torture->lp_ctx), &name, torture, &address, event_context_find(torture)); + status = resolve_name(lp_resolve_context(torture->lp_ctx), &name, torture, &address, torture->ev); if (!NT_STATUS_IS_OK(status)) { printf("Failed to resolve %s - %s\n", name.name, nt_errstr(status)); diff --git a/source4/torture/nbt/dgram.c b/source4/torture/nbt/dgram.c index e1680877e8..18950e9dcb 100644 --- a/source4/torture/nbt/dgram.c +++ b/source4/torture/nbt/dgram.c @@ -87,7 +87,7 @@ static bool nbt_test_netlogon(struct torture_context *tctx) /* do an initial name resolution to find its IP */ torture_assert_ntstatus_ok(tctx, - resolve_name(lp_resolve_context(tctx->lp_ctx), &name, tctx, &address, event_context_find(tctx)), + resolve_name(lp_resolve_context(tctx->lp_ctx), &name, tctx, &address, tctx->ev), talloc_asprintf(tctx, "Failed to resolve %s", name.name)); load_interfaces(tctx, lp_interfaces(tctx->lp_ctx), &ifaces); @@ -170,7 +170,7 @@ static bool nbt_test_netlogon2(struct torture_context *tctx) /* do an initial name resolution to find its IP */ torture_assert_ntstatus_ok(tctx, - resolve_name(lp_resolve_context(tctx->lp_ctx), &name, tctx, &address, event_context_find(tctx)), + resolve_name(lp_resolve_context(tctx->lp_ctx), &name, tctx, &address, tctx->ev), talloc_asprintf(tctx, "Failed to resolve %s", name.name)); load_interfaces(tctx, lp_interfaces(tctx->lp_ctx), &ifaces); diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index 86030c538a..d7738be833 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -316,7 +316,6 @@ bool torture_bench_lock(struct torture_context *torture) int i; int timelimit = torture_setting_int(torture, "timelimit", 10); struct timeval tv; - struct event_context *ev = event_context_find(mem_ctx); struct benchlock_state *state; int total = 0, minops=0; struct smbcli_state *cli; @@ -333,8 +332,8 @@ bool torture_bench_lock(struct torture_context *torture) state[i].tctx = torture; state[i].mem_ctx = talloc_new(state); state[i].client_num = i; - state[i].ev = ev; - if (!torture_open_connection_ev(&cli, i, torture, ev)) { + state[i].ev = torture->ev; + if (!torture_open_connection_ev(&cli, i, torture, torture->ev)) { return false; } talloc_steal(mem_ctx, state); @@ -380,7 +379,7 @@ bool torture_bench_lock(struct torture_context *torture) printf("Running for %d seconds\n", timelimit); while (timeval_elapsed(&tv) < timelimit) { - event_loop_once(ev); + event_loop_once(torture->ev); if (lock_failed) { DEBUG(0,("locking failed\n")); diff --git a/source4/torture/raw/offline.c b/source4/torture/raw/offline.c index 1340692faa..852cddb996 100644 --- a/source4/torture/raw/offline.c +++ b/source4/torture/raw/offline.c @@ -389,7 +389,6 @@ bool torture_test_offline(struct torture_context *torture) int i; int timelimit = torture_setting_int(torture, "timelimit", 10); struct timeval tv; - struct event_context *ev = event_context_find(mem_ctx); struct offline_state *state; struct smbcli_state *cli; bool progress; @@ -404,8 +403,8 @@ bool torture_test_offline(struct torture_context *torture) for (i=0;iev; + if (!torture_open_connection_ev(&cli, i, torture, torture->ev)) { return false; } state[i].tree = cli->tree; @@ -418,7 +417,7 @@ bool torture_test_offline(struct torture_context *torture) for (i=nconnections;iev; state[i].tree = state[i % nconnections].tree; state[i].client = i; } @@ -473,7 +472,7 @@ bool torture_test_offline(struct torture_context *torture) printf("Running for %d seconds\n", timelimit); while (timeval_elapsed(&tv) < timelimit) { - event_loop_once(ev); + event_loop_once(torture->ev); if (test_failed) { DEBUG(0,("test failed\n")); @@ -487,7 +486,7 @@ bool torture_test_offline(struct torture_context *torture) while (state[i].loadfile || state[i].savefile || state[i].req) { - event_loop_once(ev); + event_loop_once(torture->ev); } } diff --git a/source4/torture/raw/openbench.c b/source4/torture/raw/openbench.c index a5b1434a47..c28312f8a6 100644 --- a/source4/torture/raw/openbench.c +++ b/source4/torture/raw/openbench.c @@ -369,7 +369,6 @@ bool torture_bench_open(struct torture_context *torture) int i; int timelimit = torture_setting_int(torture, "timelimit", 10); struct timeval tv; - struct event_context *ev = event_context_find(mem_ctx); struct benchopen_state *state; int total = 0; int total_retries = 0; @@ -387,8 +386,8 @@ bool torture_bench_open(struct torture_context *torture) state[i].tctx = torture; state[i].mem_ctx = talloc_new(state); state[i].client_num = i; - state[i].ev = ev; - if (!torture_open_connection_ev(&state[i].cli, i, torture, ev)) { + state[i].ev = torture->ev; + if (!torture_open_connection_ev(&state[i].cli, i, torture, torture->ev)) { return false; } talloc_steal(mem_ctx, state); -- cgit From c15ffa27cb3a1cadbbf06d564146c1ab8dec952b Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 17 Apr 2008 01:19:53 +0200 Subject: Explicitly require event context to be specified. (This used to be commit a95a71fe45ef6a578569931a7c38061783d07db3) --- source4/ntvfs/common/notify.c | 4 ++++ source4/ntvfs/sysdep/sys_notify.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/source4/ntvfs/common/notify.c b/source4/ntvfs/common/notify.c index 23aa3fb668..9055d6ece3 100644 --- a/source4/ntvfs/common/notify.c +++ b/source4/ntvfs/common/notify.c @@ -93,6 +93,10 @@ struct notify_context *notify_init(TALLOC_CTX *mem_ctx, struct server_id server, return NULL; } + if (ev == NULL) { + return NULL; + } + notify = talloc(mem_ctx, struct notify_context); if (notify == NULL) { return NULL; diff --git a/source4/ntvfs/sysdep/sys_notify.c b/source4/ntvfs/sysdep/sys_notify.c index eb5cc3793f..22b72c4d63 100644 --- a/source4/ntvfs/sysdep/sys_notify.c +++ b/source4/ntvfs/sysdep/sys_notify.c @@ -52,7 +52,7 @@ _PUBLIC_ struct sys_notify_context *sys_notify_context_create(struct share_confi } if (ev == NULL) { - ev = event_context_find(mem_ctx); + return NULL; } ctx = talloc_zero(mem_ctx, struct sys_notify_context); -- cgit From 14023e502b7a1043afe0dde7f1c60a4b29a76646 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 17 Apr 2008 01:22:39 +0200 Subject: Require explicit event context rather than looking if it is not specified. (This used to be commit 1da0063bd5fd18ad3ac7a07c985ec6be380486e2) --- source4/ntvfs/sysdep/sys_lease.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source4/ntvfs/sysdep/sys_lease.c b/source4/ntvfs/sysdep/sys_lease.c index b8a165aa51..e6b11c450a 100644 --- a/source4/ntvfs/sysdep/sys_lease.c +++ b/source4/ntvfs/sysdep/sys_lease.c @@ -55,7 +55,7 @@ _PUBLIC_ struct sys_lease_context *sys_lease_context_create(struct share_config } if (ev == NULL) { - ev = event_context_find(mem_ctx); + return NULL; } ctx = talloc_zero(mem_ctx, struct sys_lease_context); -- cgit From 9de0594175f9ccd9c130a332126f9247758c43ad Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 17 Apr 2008 01:30:21 +0200 Subject: Fix the build. (This used to be commit 40b7b0e503cff31ea4e3d4822f2263fbeb76c57a) --- source4/torture/raw/lockbench.c | 2 +- source4/torture/raw/offline.c | 2 +- source4/torture/raw/openbench.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index d7738be833..21541d003b 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -374,7 +374,7 @@ bool torture_bench_lock(struct torture_context *torture) tv = timeval_current(); if (progress) { - event_add_timed(ev, state, timeval_current_ofs(1, 0), report_rate, state); + event_add_timed(torture->ev, state, timeval_current_ofs(1, 0), report_rate, state); } printf("Running for %d seconds\n", timelimit); diff --git a/source4/torture/raw/offline.c b/source4/torture/raw/offline.c index 852cddb996..9c66c3be9c 100644 --- a/source4/torture/raw/offline.c +++ b/source4/torture/raw/offline.c @@ -467,7 +467,7 @@ bool torture_test_offline(struct torture_context *torture) tv = timeval_current(); if (progress) { - event_add_timed(ev, state, timeval_current_ofs(1, 0), report_rate, state); + event_add_timed(torture->ev, state, timeval_current_ofs(1, 0), report_rate, state); } printf("Running for %d seconds\n", timelimit); diff --git a/source4/torture/raw/openbench.c b/source4/torture/raw/openbench.c index c28312f8a6..26b862c33f 100644 --- a/source4/torture/raw/openbench.c +++ b/source4/torture/raw/openbench.c @@ -427,13 +427,13 @@ bool torture_bench_open(struct torture_context *torture) tv = timeval_current(); if (progress) { - report_te = event_add_timed(ev, state, timeval_current_ofs(1, 0), + report_te = event_add_timed(torture->ev, state, timeval_current_ofs(1, 0), report_rate, state); } printf("Running for %d seconds\n", timelimit); while (timeval_elapsed(&tv) < timelimit) { - event_loop_once(ev); + event_loop_once(torture->ev); if (open_failed) { DEBUG(0,("open failed\n")); -- cgit From a145d21de63a5cb2d347c1281ed437cab6a95569 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 17 Apr 2008 01:37:02 +0200 Subject: Avoid using event_context_find where possible. (This used to be commit 04420b4689bc223202d5bba871e3eea16301e8e9) --- source4/torture/libnet/domain.c | 4 +--- source4/torture/nbt/dgram.c | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/source4/torture/libnet/domain.c b/source4/torture/libnet/domain.c index ff1fbcab78..ab7846e5e1 100644 --- a/source4/torture/libnet/domain.c +++ b/source4/torture/libnet/domain.c @@ -74,7 +74,6 @@ bool torture_domainopen(struct torture_context *torture) { NTSTATUS status; struct libnet_context *net_ctx; - struct event_context *evt_ctx; TALLOC_CTX *mem_ctx; bool ret = true; struct policy_handle h; @@ -82,8 +81,7 @@ bool torture_domainopen(struct torture_context *torture) mem_ctx = talloc_init("test_domain_open"); - evt_ctx = event_context_find(torture); - net_ctx = libnet_context_init(evt_ctx, torture->lp_ctx); + net_ctx = libnet_context_init(torture->ev, torture->lp_ctx); status = torture_rpc_connection(torture, &net_ctx->samr.pipe, diff --git a/source4/torture/nbt/dgram.c b/source4/torture/nbt/dgram.c index 18950e9dcb..a4c8be888c 100644 --- a/source4/torture/nbt/dgram.c +++ b/source4/torture/nbt/dgram.c @@ -283,7 +283,7 @@ static bool nbt_test_ntlogon(struct torture_context *tctx) /* do an initial name resolution to find its IP */ torture_assert_ntstatus_ok(tctx, - resolve_name(lp_resolve_context(tctx->lp_ctx), &name, tctx, &address, event_context_find(tctx)), + resolve_name(lp_resolve_context(tctx->lp_ctx), &name, tctx, &address, tctx->ev), talloc_asprintf(tctx, "Failed to resolve %s", name.name)); load_interfaces(tctx, lp_interfaces(tctx->lp_ctx), &ifaces); -- 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 ++ source4/scripting/ejs/ejsnet/net_ctx.c | 2 +- source4/scripting/ejs/smbcalls_auth.c | 2 +- source4/scripting/ejs/smbcalls_nbt.c | 2 +- source4/scripting/ejs/smbcalls_rpc.c | 4 ++-- 6 files changed, 13 insertions(+), 5 deletions(-) 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); diff --git a/source4/scripting/ejs/ejsnet/net_ctx.c b/source4/scripting/ejs/ejsnet/net_ctx.c index 99be1c4ef8..cbe163552e 100644 --- a/source4/scripting/ejs/ejsnet/net_ctx.c +++ b/source4/scripting/ejs/ejsnet/net_ctx.c @@ -50,7 +50,7 @@ static int ejs_net_context(MprVarHandle eid, int argc, struct MprVar **argv) ejsSetErrorMsg(eid, "talloc_new() failed"); return -1; } - ev = event_context_find(event_mem_ctx); + ev = mprEventCtx(); ctx = libnet_context_init(ev, mprLpCtx()); /* IF we generated a new event context, it will be under here, diff --git a/source4/scripting/ejs/smbcalls_auth.c b/source4/scripting/ejs/smbcalls_auth.c index 908a009159..8e464a5021 100644 --- a/source4/scripting/ejs/smbcalls_auth.c +++ b/source4/scripting/ejs/smbcalls_auth.c @@ -55,7 +55,7 @@ static int ejs_doauth(MprVarHandle eid, msg = c->msg_ctx; } else { /* Hope we can find the event context somewhere up there... */ - ev = event_context_find(tmp_ctx); + ev = mprEventCtx(); msg = messaging_client_init(tmp_ctx, lp_messaging_path(tmp_ctx, mprLpCtx()), lp_iconv_convenience(mprLpCtx()), ev); } diff --git a/source4/scripting/ejs/smbcalls_nbt.c b/source4/scripting/ejs/smbcalls_nbt.c index 67a85414ca..8c555bf821 100644 --- a/source4/scripting/ejs/smbcalls_nbt.c +++ b/source4/scripting/ejs/smbcalls_nbt.c @@ -70,7 +70,7 @@ static int ejs_resolve_name(MprVarHandle eid, int argc, struct MprVar **argv) result = 0; - nt_status = resolve_name(lp_resolve_context(mprLpCtx()), &name, tmp_ctx, &reply_addr, event_context_find(tmp_ctx)); + nt_status = resolve_name(lp_resolve_context(mprLpCtx()), &name, tmp_ctx, &reply_addr, mprEventCtx()); if (NT_STATUS_IS_OK(nt_status)) { mprSetPropertyValue(argv[0], "value", mprString(reply_addr)); diff --git a/source4/scripting/ejs/smbcalls_rpc.c b/source4/scripting/ejs/smbcalls_rpc.c index d1e49b4348..94774d708b 100644 --- a/source4/scripting/ejs/smbcalls_rpc.c +++ b/source4/scripting/ejs/smbcalls_rpc.c @@ -73,7 +73,7 @@ static int ejs_irpc_connect(MprVarHandle eid, int argc, char **argv) p->server_name = argv[0]; - ev = event_context_find(p); + ev = mprEventCtx(); /* create a messaging context, looping as we have no way to allocate temporary server ids automatically */ @@ -158,7 +158,7 @@ static int ejs_rpc_connect(MprVarHandle eid, int argc, char **argv) cli_credentials_set_anonymous(creds); } - ev = event_context_find(mprMemCtx()); + ev = mprEventCtx(); status = dcerpc_pipe_connect(this, &p, binding, iface, creds, ev, mprLpCtx()); -- cgit From b0f34bc8ca072c06b89934fbef516a2f3da0e269 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 16 Apr 2008 10:05:53 +0200 Subject: libcli/smb2: also offer the SMB2 dialect that what used in longhorn beta3 With this smbtorture works against longhorn beta3 again, hopefully it still works with new versions... metze (This used to be commit 874924a85a862e38b7d1a6199276e998cf3697d8) --- source4/libcli/smb2/connect.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source4/libcli/smb2/connect.c b/source4/libcli/smb2/connect.c index d68b85ad54..59d4e6ea2d 100644 --- a/source4/libcli/smb2/connect.c +++ b/source4/libcli/smb2/connect.c @@ -121,7 +121,7 @@ static void continue_socket(struct composite_context *creq) struct smbcli_socket *sock; struct smb2_transport *transport; struct smb2_request *req; - uint16_t dialects[1]; + uint16_t dialects[2]; c->status = smbcli_sock_connect_recv(creq, state, &sock); if (!composite_is_ok(c)) return; @@ -130,11 +130,12 @@ static void continue_socket(struct composite_context *creq) if (composite_nomem(transport, c)) return; ZERO_STRUCT(state->negprot); - state->negprot.in.dialect_count = 1; + state->negprot.in.dialect_count = 2; state->negprot.in.security_mode = 0; state->negprot.in.capabilities = 0; unix_to_nt_time(&state->negprot.in.start_time, time(NULL)); - dialects[0] = SMB2_DIALECT_REVISION; + dialects[0] = 0; + dialects[1] = SMB2_DIALECT_REVISION; state->negprot.in.dialects = dialects; req = smb2_negprot_send(transport, &state->negprot); -- cgit From 578539216fcb275e5ec013b3ed1c81e4baced80e Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 16 Apr 2008 10:03:08 +0200 Subject: libcli/smb2: make it possible to pass additional extra blobs in smb2_create() This also fixes the alignment from 8 to 4 byte bounderies. metze (This used to be commit e0a0d8e36acd735b587cd7870625af52c5dc3431) --- source4/libcli/raw/interfaces.h | 8 ++++ source4/libcli/smb2/create.c | 94 +++++++++++++++++++++++++++++++---------- 2 files changed, 79 insertions(+), 23 deletions(-) diff --git a/source4/libcli/raw/interfaces.h b/source4/libcli/raw/interfaces.h index 61441b2cdc..cf5a3aa25e 100644 --- a/source4/libcli/raw/interfaces.h +++ b/source4/libcli/raw/interfaces.h @@ -1587,6 +1587,14 @@ union smb_open { /* optional list of extended attributes */ struct smb_ea_list eas; + + struct smb2_create_blobs { + uint32_t num_blobs; + struct smb2_create_blob { + const char *tag; + DATA_BLOB data; + } *blobs; + } blobs; } in; struct { union smb_handle file; diff --git a/source4/libcli/smb2/create.c b/source4/libcli/smb2/create.c index 999c10ab08..6ac32a494f 100644 --- a/source4/libcli/smb2/create.c +++ b/source4/libcli/smb2/create.c @@ -28,30 +28,59 @@ /* add a blob to a smb2_create attribute blob */ -NTSTATUS smb2_create_blob_add(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, - const char *tag, - DATA_BLOB add, bool last) +static NTSTATUS smb2_create_blob_push_one(TALLOC_CTX *mem_ctx, DATA_BLOB *buffer, + const struct smb2_create_blob *blob, + bool last) { - uint32_t ofs = blob->length; - size_t tag_length = strlen(tag); - uint8_t pad = smb2_padding_size(add.length+tag_length, 8); - if (!data_blob_realloc(mem_ctx, blob, - blob->length + 0x14 + tag_length + add.length + pad)) + uint32_t ofs = buffer->length; + size_t tag_length = strlen(blob->tag); + uint8_t pad = smb2_padding_size(blob->data.length+tag_length, 4); + + if (!data_blob_realloc(mem_ctx, buffer, + buffer->length + 0x14 + tag_length + blob->data.length + pad)) return NT_STATUS_NO_MEMORY; - + if (last) { - SIVAL(blob->data, ofs+0x00, 0); + SIVAL(buffer->data, ofs+0x00, 0); } else { - SIVAL(blob->data, ofs+0x00, 0x14 + tag_length + add.length + pad); + SIVAL(buffer->data, ofs+0x00, 0x14 + tag_length + blob->data.length + pad); } - SSVAL(blob->data, ofs+0x04, 0x10); /* offset of tag */ - SIVAL(blob->data, ofs+0x06, tag_length); /* tag length */ - SSVAL(blob->data, ofs+0x0A, 0x14 + tag_length); /* offset of data */ - SIVAL(blob->data, ofs+0x0C, add.length); - memcpy(blob->data+ofs+0x10, tag, tag_length); - SIVAL(blob->data, ofs+0x10+tag_length, 0); /* pad? */ - memcpy(blob->data+ofs+0x14+tag_length, add.data, add.length); - memset(blob->data+ofs+0x14+tag_length+add.length, 0, pad); + SSVAL(buffer->data, ofs+0x04, 0x10); /* offset of tag */ + SIVAL(buffer->data, ofs+0x06, tag_length); /* tag length */ + SSVAL(buffer->data, ofs+0x0A, 0x14 + tag_length); /* offset of data */ + SIVAL(buffer->data, ofs+0x0C, blob->data.length); + memcpy(buffer->data+ofs+0x10, blob->tag, tag_length); + SIVAL(buffer->data, ofs+0x10+tag_length, 0); /* pad? */ + memcpy(buffer->data+ofs+0x14+tag_length, blob->data.data, blob->data.length); + memset(buffer->data+ofs+0x14+tag_length+blob->data.length, 0, pad); + + return NT_STATUS_OK; +} + +NTSTATUS smb2_create_blob_add(TALLOC_CTX *mem_ctx, struct smb2_create_blobs *b, + const char *tag, DATA_BLOB data) +{ + struct smb2_create_blob *array; + + array = talloc_realloc(mem_ctx, b->blobs, + struct smb2_create_blob, + b->num_blobs + 1); + NT_STATUS_HAVE_NO_MEMORY(array); + b->blobs = array; + + b->blobs[b->num_blobs].tag = talloc_strdup(b->blobs, tag); + NT_STATUS_HAVE_NO_MEMORY(b->blobs[b->num_blobs].tag); + + if (data.data) { + b->blobs[b->num_blobs].data = data_blob_talloc(b->blobs, + data.data, + data.length); + NT_STATUS_HAVE_NO_MEMORY(b->blobs[b->num_blobs].data.data); + } else { + b->blobs[b->num_blobs].data = data_blob(NULL, 0); + } + + b->num_blobs += 1; return NT_STATUS_OK; } @@ -64,6 +93,7 @@ struct smb2_request *smb2_create_send(struct smb2_tree *tree, struct smb2_create struct smb2_request *req; NTSTATUS status; DATA_BLOB blob = data_blob(NULL, 0); + uint32_t i; req = smb2_request_init_tree(tree, SMB2_OP_CREATE, 0x38, true, 0); if (req == NULL) return NULL; @@ -89,7 +119,8 @@ struct smb2_request *smb2_create_send(struct smb2_tree *tree, struct smb2_create DATA_BLOB b = data_blob_talloc(req, NULL, ea_list_size_chained(io->in.eas.num_eas, io->in.eas.eas)); ea_put_list_chained(b.data, io->in.eas.num_eas, io->in.eas.eas); - status = smb2_create_blob_add(req, &blob, SMB2_CREATE_TAG_EXTA, b, false); + status = smb2_create_blob_add(req, &io->in.blobs, + SMB2_CREATE_TAG_EXTA, b); if (!NT_STATUS_IS_OK(status)) { talloc_free(req); return NULL; @@ -99,13 +130,30 @@ struct smb2_request *smb2_create_send(struct smb2_tree *tree, struct smb2_create /* an empty MxAc tag seems to be used to ask the server to return the maximum access mask allowed on the file */ - status = smb2_create_blob_add(req, &blob, SMB2_CREATE_TAG_MXAC, - data_blob(NULL, 0), true); - + status = smb2_create_blob_add(req, &io->in.blobs, + SMB2_CREATE_TAG_MXAC, data_blob(NULL, 0)); if (!NT_STATUS_IS_OK(status)) { talloc_free(req); return NULL; } + + for (i=0; i < io->in.blobs.num_blobs; i++) { + bool last = false; + const struct smb2_create_blob *c; + + if ((i + 1) == io->in.blobs.num_blobs) { + last = true; + } + + c = &io->in.blobs.blobs[i]; + status = smb2_create_blob_push_one(req, &blob, + c, last); + if (!NT_STATUS_IS_OK(status)) { + talloc_free(req); + return NULL; + } + } + status = smb2_push_o32s32_blob(&req->out, 0x30, blob); if (!NT_STATUS_IS_OK(status)) { talloc_free(req); -- cgit From ab07a60d6ed1d9704590747ac69bbaa22bef2df3 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 17 Apr 2008 02:06:07 +0200 Subject: Avoid recursive make for code coverage. (This used to be commit 2d1ca8cb7a1c39894e5f232f7e84936e6e1830ee) --- source4/torture/config.mk | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/source4/torture/config.mk b/source4/torture/config.mk index 6e1bacf199..c2ec7c573a 100644 --- a/source4/torture/config.mk +++ b/source4/torture/config.mk @@ -313,28 +313,31 @@ locktest_OBJ_FILES = torture/locktest.o MANPAGES += torture/man/locktest.1 -COV_TARGET = test +ifeq ($(MAKECMDGOALS),gcov) +GCOV?=1 +endif + +ifeq ($(MAKECMDGOALS),lcov) +GCOV?=1 +endif -COV_VARS = \ - CFLAGS="$(CFLAGS) --coverage" \ - LDFLAGS="$(LDFLAGS) --coverage" +ifeq ($(MAKECMDGOALS),testcov-html) +GCOV?=1 +endif -test_cov: - -$(MAKE) $(COV_TARGET) $(COV_VARS) +ifdef GCOV +CFLAGS += --coverage +LDFLAGS += --coverage +endif + +COV_TARGET = test -gcov: test_cov +gcov: test for I in $(sort $(dir $(ALL_OBJS))); \ do $(GCOV) -p -o $$I $$I/*.c; \ done -lcov-split: - rm -f samba.info - @$(MAKE) $(COV_TARGET) $(COV_VARS) \ - TEST_OPTIONS="--analyse-cmd=\"lcov --base-directory `pwd` --directory . --capture --output-file samba.info -t\"" - -rm heimdal/lib/*/{lex,parse}.{gcda,gcno} - genhtml -o coverage samba.info - -lcov: test_cov +lcov: test -rm heimdal/lib/*/{lex,parse}.{gcda,gcno} lcov --base-directory `pwd` --directory . --capture --output-file samba.info genhtml -o coverage samba.info -- cgit From 79b2980cf5de19c682d30025f29a421a4b656cf6 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 16 Apr 2008 19:26:52 +0200 Subject: smb_server/smb2: initialize new create.in.blobs element untill it'll be supported metze (This used to be commit fbfbd74e65b1f3e185f08a538bdd50ba7c6ce9bf) --- source4/smb_server/smb2/fileio.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source4/smb_server/smb2/fileio.c b/source4/smb_server/smb2/fileio.c index 8f8b4e771c..af1a413009 100644 --- a/source4/smb_server/smb2/fileio.c +++ b/source4/smb_server/smb2/fileio.c @@ -79,6 +79,7 @@ void smb2srv_create_recv(struct smb2srv_request *req) SMB2SRV_CHECK(smb2_pull_o32s32_blob(&req->in, io, req->in.body+0x30, &blob)); /* TODO: parse the blob */ ZERO_STRUCT(io->smb2.in.eas); + ZERO_STRUCT(io->smb2.in.blobs); /* the VFS backend does not yet handle NULL filenames */ if (io->smb2.in.fname == NULL) { -- cgit From 1fe057f2e8ea89c636fb48cd6f68f7d3d6d3c8e5 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 16 Apr 2008 15:15:57 +0200 Subject: torture/smb2: fix whitespaces metze (This used to be commit 66c0f331a231ea8897bd8f83658c86b1d2c85d62) --- source4/torture/smb2/smb2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source4/torture/smb2/smb2.c b/source4/torture/smb2/smb2.c index d07611264b..2d5b709d12 100644 --- a/source4/torture/smb2/smb2.c +++ b/source4/torture/smb2/smb2.c @@ -47,9 +47,9 @@ static bool wrap_simple_1smb2_test(struct torture_context *torture_ctx, } struct torture_test *torture_suite_add_1smb2_test(struct torture_suite *suite, - const char *name, - bool (*run) (struct torture_context *, - struct smb2_tree *)) + const char *name, + bool (*run)(struct torture_context *, + struct smb2_tree *)) { struct torture_test *test; struct torture_tcase *tcase; -- cgit From 17e41720d9167ad12f807d61049a2246ee5041cc Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 16 Apr 2008 15:16:56 +0200 Subject: torture/smb2: add torture_suite_add_2smb2_test() helper function metze (This used to be commit d70afbb0673184ed067e5f1c7608536025a3cca7) --- source4/torture/smb2/smb2.c | 55 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/source4/torture/smb2/smb2.c b/source4/torture/smb2/smb2.c index 2d5b709d12..b5befce1b2 100644 --- a/source4/torture/smb2/smb2.c +++ b/source4/torture/smb2/smb2.c @@ -69,6 +69,61 @@ struct torture_test *torture_suite_add_1smb2_test(struct torture_suite *suite, return test; } + +static bool wrap_simple_2smb2_test(struct torture_context *torture_ctx, + struct torture_tcase *tcase, + struct torture_test *test) +{ + bool (*fn) (struct torture_context *, struct smb2_tree *, struct smb2_tree *); + bool ret; + + struct smb2_tree *tree1; + struct smb2_tree *tree2; + TALLOC_CTX *mem_ctx = talloc_new(torture_ctx); + + if (!torture_smb2_connection(torture_ctx, &tree1) || + !torture_smb2_connection(torture_ctx, &tree2)) { + return false; + } + + talloc_steal(mem_ctx, tree1); + talloc_steal(mem_ctx, tree2); + + fn = test->fn; + + ret = fn(torture_ctx, tree1, tree2); + + /* the test may already closed some of the connections */ + talloc_free(mem_ctx); + + return ret; +} + + +_PUBLIC_ struct torture_test *torture_suite_add_2smb2_test(struct torture_suite *suite, + const char *name, + bool (*run)(struct torture_context *, + struct smb2_tree *, + struct smb2_tree *)) +{ + 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_2smb2_test; + test->fn = run; + test->dangerous = false; + + DLIST_ADD_END(tcase->tests, test, struct torture_test *); + + return test; +} + NTSTATUS torture_smb2_init(void) { struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "SMB2"); -- cgit From 9064aad727797646dfc73f947aedde26e638ba10 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 17 Apr 2008 02:38:13 +0200 Subject: selftest: ignore failures in the SMB2-PERSISTENT-HANDLES1 test metze (This used to be commit 02bfe20fd3ef2981945b3eb38f0bf012ef0cb91e) --- source4/samba4-knownfail | 1 + 1 file changed, 1 insertion(+) diff --git a/source4/samba4-knownfail b/source4/samba4-knownfail index 496af316ec..e7d29804d3 100644 --- a/source4/samba4-knownfail +++ b/source4/samba4-knownfail @@ -33,3 +33,4 @@ rpc.netlogon.*.GetTrustPasswords base.charset.*.Testing partial surrogate .*net.api.delshare.* # DelShare isn't implemented yet rap.*netservergetinfo +smb2.persistent.handles1 -- cgit From 4dc59022e81b05e181183d81ae1fa8895c2afbec Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 16 Apr 2008 10:11:44 +0200 Subject: torture/smb2: add SMB2-PERSISTENT-HANDLES1 test This demonstrates that the file seek position is still available on reconnected persistent handles. metze (This used to be commit 30e04ae3a02596de03d06874ff5dfc0ddc3bf902) --- source4/torture/smb2/config.mk | 3 +- source4/torture/smb2/persistent_handles.c | 162 ++++++++++++++++++++++++++++++ source4/torture/smb2/smb2.c | 1 + 3 files changed, 165 insertions(+), 1 deletion(-) create mode 100644 source4/torture/smb2/persistent_handles.c diff --git a/source4/torture/smb2/config.mk b/source4/torture/smb2/config.mk index 379632f0e7..12d5edbeb2 100644 --- a/source4/torture/smb2/config.mk +++ b/source4/torture/smb2/config.mk @@ -20,5 +20,6 @@ TORTURE_SMB2_OBJ_FILES = $(addprefix torture/smb2/, \ find.o \ lock.o \ notify.o \ - smb2.o) + smb2.o \ + persistent_handles.o) diff --git a/source4/torture/smb2/persistent_handles.c b/source4/torture/smb2/persistent_handles.c new file mode 100644 index 0000000000..d08714d510 --- /dev/null +++ b/source4/torture/smb2/persistent_handles.c @@ -0,0 +1,162 @@ +/* + Unix SMB/CIFS implementation. + + test suite for SMB2 persistent file handles + + Copyright (C) Stefan Metzmacher 2008 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "includes.h" +#include "librpc/gen_ndr/security.h" +#include "libcli/smb2/smb2.h" +#include "libcli/smb2/smb2_calls.h" +#include "torture/torture.h" +#include "torture/smb2/proto.h" +#include "param/param.h" + +#define CHECK_VAL(v, correct) do { \ + if ((v) != (correct)) { \ + torture_result(tctx, TORTURE_FAIL, "(%s): wrong value for %s got 0x%x - should be 0x%x\n", \ + __location__, #v, (int)v, (int)correct); \ + ret = false; \ + }} while (0) + +#define CHECK_STATUS(status, correct) do { \ + if (!NT_STATUS_EQUAL(status, correct)) { \ + torture_result(tctx, TORTURE_FAIL, __location__": Incorrect status %s - should be %s", \ + nt_errstr(status), nt_errstr(correct)); \ + ret = false; \ + goto done; \ + }} while (0) + +/* + basic testing of SMB2 persistent file handles + regarding the position information on the handle +*/ +bool torture_smb2_persistent_handles1(struct torture_context *tctx, + struct smb2_tree *tree1, + struct smb2_tree *tree2) +{ + TALLOC_CTX *mem_ctx = talloc_new(tctx); + struct smb2_handle h1, h2; + struct smb2_create io; + NTSTATUS status; + const char *fname = "persistent_handles.dat"; + DATA_BLOB b; + union smb_fileinfo qfinfo; + union smb_setfileinfo sfinfo; + bool ret = true; + + ZERO_STRUCT(io); + io.in.security_flags = 0x00; + io.in.oplock_level = SMB2_OPLOCK_LEVEL_BATCH; + io.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION; + io.in.create_flags = 0x00000000; + io.in.reserved = 0x00000000; + io.in.desired_access = SEC_RIGHTS_FILE_READ; + io.in.file_attributes = 0x00000000; + io.in.share_access = NTCREATEX_SHARE_ACCESS_READ | + NTCREATEX_SHARE_ACCESS_DELETE; + io.in.create_disposition = NTCREATEX_DISP_OPEN_IF; + io.in.create_options = NTCREATEX_OPTIONS_SEQUENTIAL_ONLY | + NTCREATEX_OPTIONS_ASYNC_ALERT | + NTCREATEX_OPTIONS_NON_DIRECTORY_FILE | + 0x00200000; + io.in.fname = fname; + + b = data_blob_talloc(mem_ctx, NULL, 16); + SBVAL(b.data, 0, 0); + SBVAL(b.data, 8, 0); + + status = smb2_create_blob_add(tree1, &io.in.blobs, + SMB2_CREATE_TAG_DHNQ, + b); + CHECK_STATUS(status, NT_STATUS_OK); + + status = smb2_create(tree1, mem_ctx, &io); + CHECK_STATUS(status, NT_STATUS_OK); + + h1 = io.out.file.handle; + + ZERO_STRUCT(qfinfo); + qfinfo.generic.level = RAW_FILEINFO_POSITION_INFORMATION; + qfinfo.generic.in.file.handle = h1; + status = smb2_getinfo_file(tree1, mem_ctx, &qfinfo); + CHECK_STATUS(status, NT_STATUS_OK); + CHECK_VAL(qfinfo.position_information.out.position, 0); + printf("position: %llu\n", + (unsigned long long)qfinfo.position_information.out.position); + + ZERO_STRUCT(sfinfo); + sfinfo.generic.level = RAW_SFILEINFO_POSITION_INFORMATION; + sfinfo.generic.in.file.handle = h1; + sfinfo.position_information.in.position = 0x1000; + status = smb2_setinfo_file(tree1, &sfinfo); + CHECK_STATUS(status, NT_STATUS_OK); + + ZERO_STRUCT(qfinfo); + qfinfo.generic.level = RAW_FILEINFO_POSITION_INFORMATION; + qfinfo.generic.in.file.handle = h1; + status = smb2_getinfo_file(tree1, mem_ctx, &qfinfo); + CHECK_STATUS(status, NT_STATUS_OK); + CHECK_VAL(qfinfo.position_information.out.position, 0x1000); + printf("position: %llu\n", + (unsigned long long)qfinfo.position_information.out.position); + + talloc_free(tree1); + tree1 = NULL; + + ZERO_STRUCT(qfinfo); + qfinfo.generic.level = RAW_FILEINFO_POSITION_INFORMATION; + qfinfo.generic.in.file.handle = h1; + status = smb2_getinfo_file(tree2, mem_ctx, &qfinfo); + CHECK_STATUS(status, NT_STATUS_FILE_CLOSED); + + ZERO_STRUCT(io); + io.in.fname = fname; + + b = data_blob_talloc(tctx, NULL, 16); + SBVAL(b.data, 0, h1.data[0]); + SBVAL(b.data, 8, h1.data[1]); + + status = smb2_create_blob_add(tree2, &io.in.blobs, + SMB2_CREATE_TAG_DHNC, + b); + CHECK_STATUS(status, NT_STATUS_OK); + if (!NT_STATUS_IS_OK(status)) { + printf("create1 failed - %s\n", nt_errstr(status)); + return false; + } + + status = smb2_create(tree2, mem_ctx, &io); + CHECK_STATUS(status, NT_STATUS_OK); + + h2 = io.out.file.handle; + + ZERO_STRUCT(qfinfo); + qfinfo.generic.level = RAW_FILEINFO_POSITION_INFORMATION; + qfinfo.generic.in.file.handle = h2; + status = smb2_getinfo_file(tree2, mem_ctx, &qfinfo); + CHECK_STATUS(status, NT_STATUS_OK); + CHECK_VAL(qfinfo.position_information.out.position, 0x1000); + printf("position: %llu\n", + (unsigned long long)qfinfo.position_information.out.position); + + talloc_free(mem_ctx); + +done: + return ret; +} diff --git a/source4/torture/smb2/smb2.c b/source4/torture/smb2/smb2.c index b5befce1b2..80b2d25597 100644 --- a/source4/torture/smb2/smb2.c +++ b/source4/torture/smb2/smb2.c @@ -137,6 +137,7 @@ NTSTATUS torture_smb2_init(void) torture_suite_add_simple_test(suite, "FIND", torture_smb2_find); torture_suite_add_suite(suite, torture_smb2_lock_init()); torture_suite_add_simple_test(suite, "NOTIFY", torture_smb2_notify); + torture_suite_add_2smb2_test(suite, "PERSISTENT-HANDLES1", torture_smb2_persistent_handles1); suite->description = talloc_strdup(suite, "SMB2-specific tests"); -- cgit From 8d6af0a8ad691db62c9540961db1b6d5f68c1616 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 17 Apr 2008 03:52:45 +0200 Subject: SMB2-PERSISTENT-HANDLES1: verify some more fields metze (This used to be commit ae0a7d0918cc15309a6d1166885f23531365007c) --- source4/torture/smb2/persistent_handles.c | 84 +++++++++++++++++++------------ 1 file changed, 52 insertions(+), 32 deletions(-) diff --git a/source4/torture/smb2/persistent_handles.c b/source4/torture/smb2/persistent_handles.c index d08714d510..ace57d8817 100644 --- a/source4/torture/smb2/persistent_handles.c +++ b/source4/torture/smb2/persistent_handles.c @@ -52,44 +52,57 @@ bool torture_smb2_persistent_handles1(struct torture_context *tctx, { TALLOC_CTX *mem_ctx = talloc_new(tctx); struct smb2_handle h1, h2; - struct smb2_create io; + struct smb2_create io1, io2; NTSTATUS status; const char *fname = "persistent_handles.dat"; DATA_BLOB b; union smb_fileinfo qfinfo; union smb_setfileinfo sfinfo; bool ret = true; - - ZERO_STRUCT(io); - io.in.security_flags = 0x00; - io.in.oplock_level = SMB2_OPLOCK_LEVEL_BATCH; - io.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION; - io.in.create_flags = 0x00000000; - io.in.reserved = 0x00000000; - io.in.desired_access = SEC_RIGHTS_FILE_READ; - io.in.file_attributes = 0x00000000; - io.in.share_access = NTCREATEX_SHARE_ACCESS_READ | + uint64_t pos; + + smb2_util_unlink(tree1, fname); + + ZERO_STRUCT(io1); + io1.in.security_flags = 0x00; + io1.in.oplock_level = SMB2_OPLOCK_LEVEL_BATCH; + io1.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION; + io1.in.create_flags = 0x00000000; + io1.in.reserved = 0x00000000; + io1.in.desired_access = SEC_RIGHTS_FILE_ALL; + io1.in.file_attributes = FILE_ATTRIBUTE_NORMAL; + io1.in.share_access = NTCREATEX_SHARE_ACCESS_READ | + NTCREATEX_SHARE_ACCESS_WRITE | NTCREATEX_SHARE_ACCESS_DELETE; - io.in.create_disposition = NTCREATEX_DISP_OPEN_IF; - io.in.create_options = NTCREATEX_OPTIONS_SEQUENTIAL_ONLY | + io1.in.create_disposition = NTCREATEX_DISP_OPEN_IF; + io1.in.create_options = NTCREATEX_OPTIONS_SEQUENTIAL_ONLY | NTCREATEX_OPTIONS_ASYNC_ALERT | NTCREATEX_OPTIONS_NON_DIRECTORY_FILE | 0x00200000; - io.in.fname = fname; + io1.in.fname = fname; b = data_blob_talloc(mem_ctx, NULL, 16); SBVAL(b.data, 0, 0); SBVAL(b.data, 8, 0); - status = smb2_create_blob_add(tree1, &io.in.blobs, + status = smb2_create_blob_add(tree1, &io1.in.blobs, SMB2_CREATE_TAG_DHNQ, b); CHECK_STATUS(status, NT_STATUS_OK); - status = smb2_create(tree1, mem_ctx, &io); + status = smb2_create(tree1, mem_ctx, &io1); CHECK_STATUS(status, NT_STATUS_OK); + CHECK_VAL(io1.out.oplock_level, SMB2_OPLOCK_LEVEL_BATCH); + /*CHECK_VAL(io1.out.reserved, 0);*/ + CHECK_VAL(io1.out.create_action, NTCREATEX_ACTION_CREATED); + CHECK_VAL(io1.out.alloc_size, 0); + CHECK_VAL(io1.out.size, 0); + CHECK_VAL(io1.out.file_attr, FILE_ATTRIBUTE_ARCHIVE); + CHECK_VAL(io1.out.reserved2, 0); + + /* TODO: check extra blob content */ - h1 = io.out.file.handle; + h1 = io1.out.file.handle; ZERO_STRUCT(qfinfo); qfinfo.generic.level = RAW_FILEINFO_POSITION_INFORMATION; @@ -97,8 +110,9 @@ bool torture_smb2_persistent_handles1(struct torture_context *tctx, status = smb2_getinfo_file(tree1, mem_ctx, &qfinfo); CHECK_STATUS(status, NT_STATUS_OK); CHECK_VAL(qfinfo.position_information.out.position, 0); - printf("position: %llu\n", - (unsigned long long)qfinfo.position_information.out.position); + pos = qfinfo.position_information.out.position; + torture_comment(tctx, "position: %llu\n", + (unsigned long long)pos); ZERO_STRUCT(sfinfo); sfinfo.generic.level = RAW_SFILEINFO_POSITION_INFORMATION; @@ -113,8 +127,9 @@ bool torture_smb2_persistent_handles1(struct torture_context *tctx, status = smb2_getinfo_file(tree1, mem_ctx, &qfinfo); CHECK_STATUS(status, NT_STATUS_OK); CHECK_VAL(qfinfo.position_information.out.position, 0x1000); - printf("position: %llu\n", - (unsigned long long)qfinfo.position_information.out.position); + pos = qfinfo.position_information.out.position; + torture_comment(tctx, "position: %llu\n", + (unsigned long long)pos); talloc_free(tree1); tree1 = NULL; @@ -125,26 +140,29 @@ bool torture_smb2_persistent_handles1(struct torture_context *tctx, status = smb2_getinfo_file(tree2, mem_ctx, &qfinfo); CHECK_STATUS(status, NT_STATUS_FILE_CLOSED); - ZERO_STRUCT(io); - io.in.fname = fname; + ZERO_STRUCT(io2); + io2.in.fname = fname; b = data_blob_talloc(tctx, NULL, 16); SBVAL(b.data, 0, h1.data[0]); SBVAL(b.data, 8, h1.data[1]); - status = smb2_create_blob_add(tree2, &io.in.blobs, + status = smb2_create_blob_add(tree2, &io2.in.blobs, SMB2_CREATE_TAG_DHNC, b); CHECK_STATUS(status, NT_STATUS_OK); - if (!NT_STATUS_IS_OK(status)) { - printf("create1 failed - %s\n", nt_errstr(status)); - return false; - } - status = smb2_create(tree2, mem_ctx, &io); + status = smb2_create(tree2, mem_ctx, &io2); CHECK_STATUS(status, NT_STATUS_OK); + CHECK_VAL(io2.out.oplock_level, SMB2_OPLOCK_LEVEL_BATCH); + CHECK_VAL(io2.out.reserved, 0x00); + CHECK_VAL(io2.out.create_action, NTCREATEX_ACTION_EXISTED); + CHECK_VAL(io2.out.alloc_size, 0); + CHECK_VAL(io2.out.size, 0); + CHECK_VAL(io2.out.file_attr, FILE_ATTRIBUTE_ARCHIVE); + CHECK_VAL(io2.out.reserved2, 0); - h2 = io.out.file.handle; + h2 = io2.out.file.handle; ZERO_STRUCT(qfinfo); qfinfo.generic.level = RAW_FILEINFO_POSITION_INFORMATION; @@ -152,11 +170,13 @@ bool torture_smb2_persistent_handles1(struct torture_context *tctx, status = smb2_getinfo_file(tree2, mem_ctx, &qfinfo); CHECK_STATUS(status, NT_STATUS_OK); CHECK_VAL(qfinfo.position_information.out.position, 0x1000); - printf("position: %llu\n", - (unsigned long long)qfinfo.position_information.out.position); + pos = qfinfo.position_information.out.position; + torture_comment(tctx, "position: %llu\n", + (unsigned long long)pos); talloc_free(mem_ctx); + smb2_util_unlink(tree2, fname); done: return ret; } -- cgit From baad7a7e56e2b0f24885e01672cd9bdc6667a6a8 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 17 Apr 2008 03:54:26 +0200 Subject: ntvfs_generic: map SMB2 oplock levels to the generic ones metze (This used to be commit 9013748273378f88bfc66d3583814f0fee67c40f) --- source4/ntvfs/ntvfs_generic.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/source4/ntvfs/ntvfs_generic.c b/source4/ntvfs/ntvfs_generic.c index fee3269eaf..5d4bbf388c 100644 --- a/source4/ntvfs/ntvfs_generic.c +++ b/source4/ntvfs/ntvfs_generic.c @@ -208,7 +208,21 @@ static NTSTATUS ntvfs_map_open_finish(struct ntvfs_module_context *ntvfs, case RAW_OPEN_SMB2: io->smb2.out.file.ntvfs = io2->generic.out.file.ntvfs; - io->smb2.out.oplock_level = 0; + switch (io2->generic.out.oplock_level) { + case OPLOCK_BATCH: + io->smb2.out.oplock_level = SMB2_OPLOCK_LEVEL_BATCH; + break; + case OPLOCK_EXCLUSIVE: + io->smb2.out.oplock_level = SMB2_OPLOCK_LEVEL_EXCLUSIVE; + break; + case OPLOCK_LEVEL_II: + io->smb2.out.oplock_level = SMB2_OPLOCK_LEVEL_II; + break; + default: + io->smb2.out.oplock_level = SMB2_OPLOCK_LEVEL_NONE; + break; + } + io->smb2.out.reserved = 0; io->smb2.out.create_action = io2->generic.out.create_action; io->smb2.out.create_time = io2->generic.out.create_time; io->smb2.out.access_time = io2->generic.out.access_time; @@ -484,7 +498,18 @@ NTSTATUS ntvfs_map_open(struct ntvfs_module_context *ntvfs, status = ntvfs->ops->open(ntvfs, req, io2); break; case RAW_OPEN_SMB2: - io2->generic.in.flags = 0; + switch (io->smb2.in.oplock_level) { + case SMB2_OPLOCK_LEVEL_BATCH: + io2->generic.in.flags = NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK | + NTCREATEX_FLAGS_REQUEST_OPLOCK; + break; + case SMB2_OPLOCK_LEVEL_EXCLUSIVE: + io2->generic.in.flags = NTCREATEX_FLAGS_REQUEST_OPLOCK; + break; + default: + io2->generic.in.flags = 0; + break; + } io2->generic.in.root_fid = 0; io2->generic.in.access_mask = io->smb2.in.desired_access; io2->generic.in.alloc_size = 0; -- cgit From 769ebe91711330d5b75f9632c2b1d1847dd32a15 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 17 Apr 2008 09:37:29 +0200 Subject: make smb2 read and write size configurable (This used to be commit 2090e75e0c28f8d2aada305059bdb455f42ed0d5) --- source4/smb_server/smb2/negprot.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/source4/smb_server/smb2/negprot.c b/source4/smb_server/smb2/negprot.c index e7352f7c42..4479ae2da1 100644 --- a/source4/smb_server/smb2/negprot.c +++ b/source4/smb_server/smb2/negprot.c @@ -114,9 +114,12 @@ static NTSTATUS smb2srv_negprot_backend(struct smb2srv_request *req, struct smb2 io->out.security_mode = 0; /* no signing yet */ io->out.dialect_revision = SMB2_DIALECT_REVISION; io->out.capabilities = 0; - io->out.max_transact_size = 0x10000; - io->out.max_read_size = 0x10000; - io->out.max_write_size = 0x10000; + io->out.max_transact_size = lp_parm_ulong(req->smb_conn->lp_ctx, NULL, + "smb2", "max transaction size", 0x10000); + io->out.max_read_size = lp_parm_ulong(req->smb_conn->lp_ctx, NULL, + "smb2", "max read size", 0x10000); + io->out.max_write_size = lp_parm_ulong(req->smb_conn->lp_ctx, NULL, + "smb2", "max write size", 0x10000); io->out.system_time = timeval_to_nttime(¤t_time); io->out.server_start_time = timeval_to_nttime(&boot_time); io->out.reserved2 = 0; -- cgit From e1b3c0fa8994612cfd34801c5ba0e5b0032137d2 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 17 Apr 2008 10:40:16 +0200 Subject: Use the struct based winbind tests, but mark as known fail. Andrew Bartlett (This used to be commit 85c9b21a457ccbf9014ae8f0554a8a5938256a11) --- source4/samba4-knownfail | 7 +++++++ source4/samba4-skip | 1 - 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/source4/samba4-knownfail b/source4/samba4-knownfail index e7d29804d3..1d8651c80b 100644 --- a/source4/samba4-knownfail +++ b/source4/samba4-knownfail @@ -34,3 +34,10 @@ base.charset.*.Testing partial surrogate .*net.api.delshare.* # DelShare isn't implemented yet rap.*netservergetinfo smb2.persistent.handles1 +samba4.winbind.struct.*.LIST_GROUPS # Not yet working in winbind +samba4.winbind.struct.*.SHOW_SEQUENCE # Not yet working in winbind +samba4.winbind.struct.*.GETPWENT # Not yet working in winbind +samba4.winbind.struct.*.SETPWENT # Not yet working in winbind +samba4.winbind.struct.*.LOOKUP_NAME_SID # Not yet working in winbind + + diff --git a/source4/samba4-skip b/source4/samba4-skip index 19ff924794..caeb1e044d 100644 --- a/source4/samba4-skip +++ b/source4/samba4-skip @@ -41,7 +41,6 @@ rpc.frsapi # Not provided by Samba 4 .*samba3.* # Samba3-specific test ^samba4.net.domopen.*$ # Hangs for some reason ^samba4.net.api.become.dc.*$ # Fails -winbind # FIXME: This should not be skipped nss.test # Fails samba4.samba3sam.python # Conversion from EJS not yet finished samba4.samdb.python # Not finished yet -- 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(-) 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 eb8a4e28830a01bcb990874e69f5b52907a278c6 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 17 Apr 2008 11:25:19 +0200 Subject: Run more tests that were previously skipped. Andrew Bartlett (This used to be commit 4e06b1d684d6893d79dd6cbd32c2f868dcc559da) --- source4/samba4-skip | 6 +++--- source4/selftest/samba4_tests.sh | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/source4/samba4-skip b/source4/samba4-skip index caeb1e044d..f4330b9c03 100644 --- a/source4/samba4-skip +++ b/source4/samba4-skip @@ -5,11 +5,11 @@ base.casetable base.nttrans .*base.bench.holdcon.* # Very slow base.scan.maxfid -raw.hold.oplock -raw.ping.pong +raw.hold.oplock # Not a test, but a way to block other clients for a test +raw.ping.pong # Needs second server to test rpc.samr_accessmask raw.scan.eamax -raw.qfileinfo.ipc +samba4.ntvfs.cifs.raw.qfileinfo.ipc base.utable base.smb smb2.notify diff --git a/source4/selftest/samba4_tests.sh b/source4/selftest/samba4_tests.sh index 730846dae3..3b61a97459 100755 --- a/source4/selftest/samba4_tests.sh +++ b/source4/selftest/samba4_tests.sh @@ -219,13 +219,16 @@ plantest "rpc.echo on ncacn_np over smb2" dc $smb4torture ncacn_np:"\$SERVER[smb # Tests against the NTVFS POSIX backend NTVFSARGS="--option=torture:sharedelay=100000 --option=torture:oplocktimeout=3" smb2=`$smb4torture --list | grep "^SMB2-" | xargs` -raw=`$smb4torture --list | grep "^RAW-" | xargs` +#The QFILEINFO-IPC test needs to be on ipc$ +raw=`$smb4torture --list | grep "^RAW-" | grep -v "RAW-QFILEINFO-IPC"| xargs` base=`$smb4torture --list | grep "^BASE-" | xargs` for t in $base $raw $smb2; do plansmbtorturetest "$t" dc $ADDARGS //\$SERVER/tmp -U"\$USERNAME"%"\$PASSWORD" $NTVFSARGS done +plansmbtorturetest "RAW-QFILEINFO-IPC" dc $ADDARGS //\$SERVER/ipc$ -U"\$USERNAME"%"\$PASSWORD" + rap=`$smb4torture --list | grep "^RAP-" | xargs` for t in $rap; do plansmbtorturetest "$t" dc $ADDARGS //\$SERVER/IPC\\\$ -U"\$USERNAME"%"\$PASSWORD" -- cgit From 4d8f3f190215edcdbeb1725cccdc962dc68cc1a0 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 17 Apr 2008 12:03:49 +0200 Subject: Fix the expectations on the unixinfo test. Andrew Bartlett (This used to be commit 0df2b3e0b56007850cf83cfdcdb45ca29e162d34) --- source4/scripting/python/samba/tests/dcerpc/unix.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source4/scripting/python/samba/tests/dcerpc/unix.py b/source4/scripting/python/samba/tests/dcerpc/unix.py index 43978ac9dc..78a987cedd 100644 --- a/source4/scripting/python/samba/tests/dcerpc/unix.py +++ b/source4/scripting/python/samba/tests/dcerpc/unix.py @@ -27,8 +27,8 @@ class UnixinfoTests(RpcInterfaceTestCase): def test_getpwuid(self): infos = self.conn.GetPWUid(range(512)) self.assertEquals(512, len(infos)) - self.assertEquals("", infos[0].shell) - self.assertEquals("", infos[0].homedir) + self.assertEquals("/bin/false", infos[0].shell) + self.assertTrue(isinstance(infos[0].homedir, unicode)) def test_gidtosid(self): self.conn.GidToSid(1000) -- 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/auth/auth_sam.c | 2 +- source4/auth/auth_simple.c | 2 +- source4/auth/gensec/gensec_gssapi.c | 4 +- source4/auth/gensec/gensec_krb5.c | 4 +- source4/auth/gensec/schannel.c | 5 +- source4/auth/gensec/schannel_state.c | 11 +- source4/auth/ntlmssp/ntlmssp_server.c | 2 +- source4/auth/sam.c | 3 +- source4/auth/session.c | 8 +- source4/auth/session.h | 3 + source4/cldap_server/cldap_server.c | 2 +- source4/dsdb/common/sidmap.c | 5 +- source4/dsdb/repl/drepl_service.c | 2 +- source4/dsdb/samdb/cracknames.c | 6 +- source4/dsdb/samdb/ldb_modules/samldb.c | 3 +- source4/dsdb/samdb/ldb_modules/update_keytab.c | 4 +- source4/dsdb/samdb/samdb.c | 13 +- source4/dsdb/samdb/samdb.h | 1 + source4/dsdb/samdb/samdb_privilege.c | 5 +- source4/kdc/hdb-ldb.c | 6 +- source4/kdc/kdc.c | 2 +- source4/kdc/kpasswdd.c | 4 +- source4/ldap_server/ldap_backend.c | 2 + source4/ldap_server/ldap_bind.c | 2 +- source4/ldap_server/ldap_server.c | 5 +- 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 +- source4/libnet/libnet_become_dc.c | 2 +- source4/libnet/libnet_join.c | 2 +- source4/libnet/libnet_samsync_ldb.c | 2 + source4/libnet/libnet_unbecome_dc.c | 2 +- source4/libnet/libnet_vampire.c | 7 +- source4/nbt_server/dgram/netlogon.c | 4 +- source4/nbt_server/nbt_server.c | 2 +- source4/nbt_server/wins/winsdb.c | 13 +- source4/nbt_server/wins/winsserver.c | 3 +- source4/ntptr/ntptr.h | 1 + source4/ntptr/ntptr_base.c | 4 +- source4/ntptr/simple_ldb/ntptr_simple_ldb.c | 6 +- source4/ntvfs/ipc/ipc_rap.c | 11 +- source4/ntvfs/ipc/rap_server.c | 3 +- source4/ntvfs/ipc/vfs_ipc.c | 2 +- source4/param/share.c | 3 +- source4/param/share.h | 5 +- source4/param/share_classic.c | 1 + source4/param/share_ldb.c | 6 +- source4/param/tests/share.c | 4 +- source4/rpc_server/common/server_info.c | 4 +- source4/rpc_server/drsuapi/dcesrv_drsuapi.c | 2 +- source4/rpc_server/lsa/lsa_init.c | 2 +- source4/rpc_server/lsa/lsa_lookup.c | 15 ++- source4/rpc_server/netlogon/dcerpc_netlogon.c | 29 +++-- source4/rpc_server/samr/dcesrv_samr.c | 4 +- source4/rpc_server/samr/samr_password.c | 6 +- source4/rpc_server/service_rpc.c | 2 +- source4/rpc_server/spoolss/dcesrv_spoolss.c | 2 +- source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 20 +-- source4/rpc_server/srvsvc/srvsvc_ntvfs.c | 2 +- source4/rpc_server/winreg/rpc_winreg.c | 2 +- source4/scripting/ejs/smbcalls_auth.c | 2 +- source4/scripting/ejs/smbcalls_ldb.c | 2 +- source4/scripting/ejs/smbcalls_reg.c | 2 +- source4/smb_server/smb/sesssetup.c | 5 +- source4/smb_server/smb_server.c | 3 +- source4/torture/ldap/schema.c | 2 +- source4/torture/ldap/uptodatevector.c | 2 +- source4/torture/libnet/libnet_BecomeDC.c | 4 +- source4/torture/local/dbspeed.c | 2 +- source4/torture/ui.c | 3 - source4/winbind/idmap.c | 3 +- source4/winbind/idmap.h | 2 + source4/winbind/wb_server.c | 2 +- source4/wrepl_server/wrepl_server.c | 7 +- 87 files changed, 352 insertions(+), 222 deletions(-) diff --git a/source4/auth/auth_sam.c b/source4/auth/auth_sam.c index 4b467cee75..731e489ba0 100644 --- a/source4/auth/auth_sam.c +++ b/source4/auth/auth_sam.c @@ -289,7 +289,7 @@ static NTSTATUS authsam_check_password_internals(struct auth_method_context *ctx return NT_STATUS_NO_MEMORY; } - sam_ctx = samdb_connect(tmp_ctx, ctx->auth_ctx->lp_ctx, system_session(mem_ctx, ctx->auth_ctx->lp_ctx)); + sam_ctx = samdb_connect(tmp_ctx, ctx->auth_ctx->event_ctx, ctx->auth_ctx->lp_ctx, system_session(mem_ctx, ctx->auth_ctx->lp_ctx)); if (sam_ctx == NULL) { talloc_free(tmp_ctx); return NT_STATUS_INVALID_SYSTEM_SERVICE; diff --git a/source4/auth/auth_simple.c b/source4/auth/auth_simple.c index 50be02a353..e7039c3657 100644 --- a/source4/auth/auth_simple.c +++ b/source4/auth/auth_simple.c @@ -90,7 +90,7 @@ _PUBLIC_ NTSTATUS authenticate_username_pw(TALLOC_CTX *mem_ctx, } if (session_info) { - nt_status = auth_generate_session_info(tmp_ctx, lp_ctx, server_info, session_info); + nt_status = auth_generate_session_info(tmp_ctx, ev, lp_ctx, server_info, session_info); if (NT_STATUS_IS_OK(nt_status)) { talloc_steal(mem_ctx, *session_info); diff --git a/source4/auth/gensec/gensec_gssapi.c b/source4/auth/gensec/gensec_gssapi.c index cbee557d5a..cc0d40469e 100644 --- a/source4/auth/gensec/gensec_gssapi.c +++ b/source4/auth/gensec/gensec_gssapi.c @@ -1327,7 +1327,7 @@ static NTSTATUS gensec_gssapi_session_info(struct gensec_security *gensec_securi } else if (!lp_parm_bool(gensec_security->lp_ctx, NULL, "gensec", "require_pac", false)) { DEBUG(1, ("Unable to find PAC, resorting to local user lookup: %s\n", gssapi_error_string(mem_ctx, maj_stat, min_stat, gensec_gssapi_state->gss_oid))); - nt_status = sam_get_server_info_principal(mem_ctx, gensec_security->lp_ctx, principal_string, + nt_status = sam_get_server_info_principal(mem_ctx, gensec_security->event_ctx, gensec_security->lp_ctx, principal_string, &server_info); if (!NT_STATUS_IS_OK(nt_status)) { @@ -1342,7 +1342,7 @@ static NTSTATUS gensec_gssapi_session_info(struct gensec_security *gensec_securi } /* references the server_info into the session_info */ - nt_status = auth_generate_session_info(mem_ctx, gensec_security->lp_ctx, server_info, &session_info); + nt_status = auth_generate_session_info(mem_ctx, gensec_security->event_ctx, gensec_security->lp_ctx, server_info, &session_info); if (!NT_STATUS_IS_OK(nt_status)) { talloc_free(mem_ctx); return nt_status; diff --git a/source4/auth/gensec/gensec_krb5.c b/source4/auth/gensec/gensec_krb5.c index 8abc0f8583..47df2ccfcc 100644 --- a/source4/auth/gensec/gensec_krb5.c +++ b/source4/auth/gensec/gensec_krb5.c @@ -603,7 +603,7 @@ static NTSTATUS gensec_krb5_session_info(struct gensec_security *gensec_security DEBUG(5, ("krb5_ticket_get_authorization_data_type failed to find PAC: %s\n", smb_get_krb5_error_message(context, ret, mem_ctx))); - nt_status = sam_get_server_info_principal(mem_ctx, gensec_security->lp_ctx, principal_string, + nt_status = sam_get_server_info_principal(mem_ctx, gensec_security->event_ctx, gensec_security->lp_ctx, principal_string, &server_info); krb5_free_principal(context, client_principal); free(principal_string); @@ -651,7 +651,7 @@ static NTSTATUS gensec_krb5_session_info(struct gensec_security *gensec_security } /* references the server_info into the session_info */ - nt_status = auth_generate_session_info(mem_ctx, gensec_security->lp_ctx, server_info, &session_info); + nt_status = auth_generate_session_info(mem_ctx, gensec_security->event_ctx, gensec_security->lp_ctx, server_info, &session_info); if (!NT_STATUS_IS_OK(nt_status)) { talloc_free(mem_ctx); diff --git a/source4/auth/gensec/schannel.c b/source4/auth/gensec/schannel.c index b3117ee9b2..f21202b86f 100644 --- a/source4/auth/gensec/schannel.c +++ b/source4/auth/gensec/schannel.c @@ -125,7 +125,8 @@ static NTSTATUS schannel_update(struct gensec_security *gensec_security, TALLOC_ } /* pull the session key for this client */ - status = schannel_fetch_session_key(out_mem_ctx, gensec_security->lp_ctx, workstation, + status = schannel_fetch_session_key(out_mem_ctx, gensec_security->event_ctx, + gensec_security->lp_ctx, workstation, domain, &creds); if (!NT_STATUS_IS_OK(status)) { DEBUG(3, ("Could not find session key for attempted schannel connection from %s: %s\n", @@ -189,7 +190,7 @@ static NTSTATUS schannel_session_info(struct gensec_security *gensec_security, struct auth_session_info **_session_info) { struct schannel_state *state = talloc_get_type(gensec_security->private_data, struct schannel_state); - return auth_anonymous_session_info(state, gensec_security->lp_ctx, _session_info); + return auth_anonymous_session_info(state, gensec_security->event_ctx, gensec_security->lp_ctx, _session_info); } static NTSTATUS schannel_start(struct gensec_security *gensec_security) diff --git a/source4/auth/gensec/schannel_state.c b/source4/auth/gensec/schannel_state.c index 0c7c509954..0f7c4ca11d 100644 --- a/source4/auth/gensec/schannel_state.c +++ b/source4/auth/gensec/schannel_state.c @@ -32,7 +32,8 @@ /** connect to the schannel ldb */ -struct ldb_context *schannel_db_connect(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx) +struct ldb_context *schannel_db_connect(TALLOC_CTX *mem_ctx, struct event_context *ev_ctx, + struct loadparm_context *lp_ctx) { char *path; struct ldb_context *ldb; @@ -49,7 +50,7 @@ struct ldb_context *schannel_db_connect(TALLOC_CTX *mem_ctx, struct loadparm_con existed = file_exist(path); - ldb = ldb_wrap_connect(mem_ctx, lp_ctx, path, + ldb = ldb_wrap_connect(mem_ctx, ev_ctx, lp_ctx, path, system_session(mem_ctx, lp_ctx), NULL, LDB_FLG_NOSYNC, NULL); talloc_free(path); @@ -137,6 +138,7 @@ NTSTATUS schannel_store_session_key_ldb(TALLOC_CTX *mem_ctx, } NTSTATUS schannel_store_session_key(TALLOC_CTX *mem_ctx, + struct event_context *ev_ctx, struct loadparm_context *lp_ctx, struct creds_CredentialState *creds) { @@ -144,7 +146,7 @@ NTSTATUS schannel_store_session_key(TALLOC_CTX *mem_ctx, NTSTATUS nt_status; int ret; - ldb = schannel_db_connect(mem_ctx, lp_ctx); + ldb = schannel_db_connect(mem_ctx, ev_ctx, lp_ctx); if (!ldb) { return NT_STATUS_ACCESS_DENIED; } @@ -268,6 +270,7 @@ NTSTATUS schannel_fetch_session_key_ldb(TALLOC_CTX *mem_ctx, } NTSTATUS schannel_fetch_session_key(TALLOC_CTX *mem_ctx, + struct event_context *ev_ctx, struct loadparm_context *lp_ctx, const char *computer_name, const char *domain, @@ -276,7 +279,7 @@ NTSTATUS schannel_fetch_session_key(TALLOC_CTX *mem_ctx, NTSTATUS nt_status; struct ldb_context *ldb; - ldb = schannel_db_connect(mem_ctx, lp_ctx); + ldb = schannel_db_connect(mem_ctx, ev_ctx, lp_ctx); if (!ldb) { return NT_STATUS_ACCESS_DENIED; } diff --git a/source4/auth/ntlmssp/ntlmssp_server.c b/source4/auth/ntlmssp/ntlmssp_server.c index 12802b7e79..d8ef2a20b8 100644 --- a/source4/auth/ntlmssp/ntlmssp_server.c +++ b/source4/auth/ntlmssp/ntlmssp_server.c @@ -725,7 +725,7 @@ NTSTATUS gensec_ntlmssp_session_info(struct gensec_security *gensec_security, NTSTATUS nt_status; struct gensec_ntlmssp_state *gensec_ntlmssp_state = (struct gensec_ntlmssp_state *)gensec_security->private_data; - nt_status = auth_generate_session_info(gensec_ntlmssp_state, gensec_security->lp_ctx, gensec_ntlmssp_state->server_info, session_info); + nt_status = auth_generate_session_info(gensec_ntlmssp_state, gensec_security->event_ctx, gensec_security->lp_ctx, gensec_ntlmssp_state->server_info, session_info); NT_STATUS_NOT_OK_RETURN(nt_status); (*session_info)->session_key = data_blob_talloc(*session_info, diff --git a/source4/auth/sam.c b/source4/auth/sam.c index ed44754993..a2090afcdc 100644 --- a/source4/auth/sam.c +++ b/source4/auth/sam.c @@ -428,6 +428,7 @@ NTSTATUS sam_get_results_principal(struct ldb_context *sam_ctx, /* Used in the gensec_gssapi and gensec_krb5 server-side code, where the PAC isn't available */ NTSTATUS sam_get_server_info_principal(TALLOC_CTX *mem_ctx, + struct event_context *event_ctx, struct loadparm_context *lp_ctx, const char *principal, struct auth_serversupplied_info **server_info) @@ -445,7 +446,7 @@ NTSTATUS sam_get_server_info_principal(TALLOC_CTX *mem_ctx, return NT_STATUS_NO_MEMORY; } - sam_ctx = samdb_connect(tmp_ctx, lp_ctx, system_session(tmp_ctx, lp_ctx)); + sam_ctx = samdb_connect(tmp_ctx, event_ctx, lp_ctx, system_session(tmp_ctx, lp_ctx)); if (sam_ctx == NULL) { talloc_free(tmp_ctx); return NT_STATUS_INVALID_SYSTEM_SERVICE; diff --git a/source4/auth/session.c b/source4/auth/session.c index 112eac95d8..8f5e8d6c56 100644 --- a/source4/auth/session.c +++ b/source4/auth/session.c @@ -31,11 +31,12 @@ #include "auth/session_proto.h" _PUBLIC_ struct auth_session_info *anonymous_session(TALLOC_CTX *mem_ctx, + struct event_context *event_ctx, struct loadparm_context *lp_ctx) { NTSTATUS nt_status; struct auth_session_info *session_info = NULL; - nt_status = auth_anonymous_session_info(mem_ctx, lp_ctx, &session_info); + nt_status = auth_anonymous_session_info(mem_ctx, event_ctx, lp_ctx, &session_info); if (!NT_STATUS_IS_OK(nt_status)) { return NULL; } @@ -43,6 +44,7 @@ _PUBLIC_ struct auth_session_info *anonymous_session(TALLOC_CTX *mem_ctx, } _PUBLIC_ NTSTATUS auth_anonymous_session_info(TALLOC_CTX *parent_ctx, + struct event_context *event_ctx, struct loadparm_context *lp_ctx, struct auth_session_info **_session_info) { @@ -60,7 +62,7 @@ _PUBLIC_ NTSTATUS auth_anonymous_session_info(TALLOC_CTX *parent_ctx, } /* references the server_info into the session_info */ - nt_status = auth_generate_session_info(parent_ctx, lp_ctx, server_info, &session_info); + nt_status = auth_generate_session_info(parent_ctx, event_ctx, lp_ctx, server_info, &session_info); talloc_free(mem_ctx); NT_STATUS_NOT_OK_RETURN(nt_status); @@ -151,6 +153,7 @@ _PUBLIC_ NTSTATUS auth_anonymous_server_info(TALLOC_CTX *mem_ctx, } _PUBLIC_ NTSTATUS auth_generate_session_info(TALLOC_CTX *mem_ctx, + struct event_context *event_ctx, struct loadparm_context *lp_ctx, struct auth_serversupplied_info *server_info, struct auth_session_info **_session_info) @@ -168,6 +171,7 @@ _PUBLIC_ NTSTATUS auth_generate_session_info(TALLOC_CTX *mem_ctx, session_info->session_key = server_info->user_session_key; nt_status = security_token_create(session_info, + event_ctx, lp_ctx, server_info->account_sid, server_info->primary_group_sid, diff --git a/source4/auth/session.h b/source4/auth/session.h index 87fc47791a..9b5fba7f39 100644 --- a/source4/auth/session.h +++ b/source4/auth/session.h @@ -36,6 +36,7 @@ NTSTATUS auth_anonymous_server_info(TALLOC_CTX *mem_ctx, const char *netbios_name, struct auth_serversupplied_info **_server_info) ; NTSTATUS auth_generate_session_info(TALLOC_CTX *mem_ctx, + struct event_context *event_ctx, struct loadparm_context *lp_ctx, struct auth_serversupplied_info *server_info, struct auth_session_info **_session_info) ; @@ -46,10 +47,12 @@ NTSTATUS make_server_info_netlogon_validation(TALLOC_CTX *mem_ctx, union netr_Validation *validation, struct auth_serversupplied_info **_server_info); NTSTATUS auth_anonymous_session_info(TALLOC_CTX *parent_ctx, + struct event_context *ev_ctx, struct loadparm_context *lp_ctx, struct auth_session_info **_session_info); struct auth_session_info *anonymous_session(TALLOC_CTX *mem_ctx, + struct event_context *event_ctx, struct loadparm_context *lp_ctx); diff --git a/source4/cldap_server/cldap_server.c b/source4/cldap_server/cldap_server.c index 783e31d1ae..58e9e2d89b 100644 --- a/source4/cldap_server/cldap_server.c +++ b/source4/cldap_server/cldap_server.c @@ -187,7 +187,7 @@ static void cldapd_task_init(struct task_server *task) } cldapd->task = task; - cldapd->samctx = samdb_connect(cldapd, task->lp_ctx, anonymous_session(cldapd, task->lp_ctx)); + cldapd->samctx = samdb_connect(cldapd, task->event_ctx, task->lp_ctx, anonymous_session(cldapd, task->event_ctx, task->lp_ctx)); if (cldapd->samctx == NULL) { task_server_terminate(task, "cldapd failed to open samdb"); return; diff --git a/source4/dsdb/common/sidmap.c b/source4/dsdb/common/sidmap.c index 2144d61dfc..20bba7a0d9 100644 --- a/source4/dsdb/common/sidmap.c +++ b/source4/dsdb/common/sidmap.c @@ -49,14 +49,15 @@ struct sidmap_context { /* open a sidmap context - use talloc_free to close */ -struct sidmap_context *sidmap_open(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx) +struct sidmap_context *sidmap_open(TALLOC_CTX *mem_ctx, struct event_context *ev_ctx, + struct loadparm_context *lp_ctx) { struct sidmap_context *sidmap; sidmap = talloc(mem_ctx, struct sidmap_context); if (sidmap == NULL) { return NULL; } - sidmap->samctx = samdb_connect(sidmap, lp_ctx, system_session(sidmap, lp_ctx)); + sidmap->samctx = samdb_connect(sidmap, ev_ctx, lp_ctx, system_session(sidmap, lp_ctx)); if (sidmap->samctx == NULL) { talloc_free(sidmap); return NULL; diff --git a/source4/dsdb/repl/drepl_service.c b/source4/dsdb/repl/drepl_service.c index 3375059e99..e485c50a47 100644 --- a/source4/dsdb/repl/drepl_service.c +++ b/source4/dsdb/repl/drepl_service.c @@ -51,7 +51,7 @@ static WERROR dreplsrv_connect_samdb(struct dreplsrv_service *service, struct lo const struct GUID *ntds_guid; struct drsuapi_DsBindInfo28 *bind_info28; - service->samdb = samdb_connect(service, lp_ctx, service->system_session_info); + service->samdb = samdb_connect(service, service->task->event_ctx, lp_ctx, service->system_session_info); if (!service->samdb) { return WERR_DS_SERVICE_UNAVAILABLE; } diff --git a/source4/dsdb/samdb/cracknames.c b/source4/dsdb/samdb/cracknames.c index b9333e451b..da10cbb057 100644 --- a/source4/dsdb/samdb/cracknames.c +++ b/source4/dsdb/samdb/cracknames.c @@ -1197,6 +1197,7 @@ NTSTATUS crack_service_principal_name(struct ldb_context *sam_ctx, } NTSTATUS crack_name_to_nt4_name(TALLOC_CTX *mem_ctx, + struct event_context *ev_ctx, struct loadparm_context *lp_ctx, uint32_t format_offered, const char *name, @@ -1214,7 +1215,7 @@ NTSTATUS crack_name_to_nt4_name(TALLOC_CTX *mem_ctx, return NT_STATUS_OK; } - ldb = samdb_connect(mem_ctx, lp_ctx, system_session(mem_ctx, lp_ctx)); + ldb = samdb_connect(mem_ctx, ev_ctx, lp_ctx, system_session(mem_ctx, lp_ctx)); if (ldb == NULL) { return NT_STATUS_INTERNAL_DB_CORRUPTION; } @@ -1259,6 +1260,7 @@ NTSTATUS crack_name_to_nt4_name(TALLOC_CTX *mem_ctx, } NTSTATUS crack_auto_name_to_nt4_name(TALLOC_CTX *mem_ctx, + struct event_context *ev_ctx, struct loadparm_context *lp_ctx, const char *name, const char **nt4_domain, @@ -1283,5 +1285,5 @@ NTSTATUS crack_auto_name_to_nt4_name(TALLOC_CTX *mem_ctx, format_offered = DRSUAPI_DS_NAME_FORMAT_CANONICAL; } - return crack_name_to_nt4_name(mem_ctx, lp_ctx, format_offered, name, nt4_domain, nt4_account); + return crack_name_to_nt4_name(mem_ctx, ev_ctx, lp_ctx, format_offered, name, nt4_domain, nt4_account); } diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c index 3b67ca19d3..88590f306b 100644 --- a/source4/dsdb/samdb/ldb_modules/samldb.c +++ b/source4/dsdb/samdb/ldb_modules/samldb.c @@ -484,8 +484,7 @@ static int samldb_fill_group_object(struct ldb_module *module, const struct ldb_ return ret; } -static int samldb_fill_user_or_computer_object(struct ldb_module *module, const struct ldb_message *msg, - struct ldb_message **ret_msg) +static int samldb_fill_user_or_computer_object(struct ldb_module *module, const struct ldb_message *msg, struct ldb_message **ret_msg) { int ret; char *name; diff --git a/source4/dsdb/samdb/ldb_modules/update_keytab.c b/source4/dsdb/samdb/ldb_modules/update_keytab.c index 3096ce8dd9..b36c2c9b71 100644 --- a/source4/dsdb/samdb/ldb_modules/update_keytab.c +++ b/source4/dsdb/samdb/ldb_modules/update_keytab.c @@ -90,7 +90,7 @@ static int add_modified(struct ldb_module *module, struct ldb_dn *dn, bool delet } cli_credentials_set_conf(item->creds, ldb_get_opaque(module->ldb, "loadparm")); - status = cli_credentials_set_secrets(item->creds, ldb_get_opaque(module->ldb, "event_ctx"), ldb_get_opaque(module->ldb, "loadparm"), module->ldb, NULL, filter); + status = cli_credentials_set_secrets(item->creds, ldb_get_opaque(module->ldb, "EventContext"), ldb_get_opaque(module->ldb, "loadparm"), module->ldb, NULL, filter); talloc_free(filter); if (NT_STATUS_IS_OK(status)) { if (delete) { @@ -158,7 +158,7 @@ static int update_kt_end_trans(struct ldb_module *module) struct dn_list *p; for (p=data->changed_dns; p; p = p->next) { int kret; - kret = cli_credentials_update_keytab(p->creds, ldb_get_opaque(module->ldb, "event_ctx"), ldb_get_opaque(module->ldb, "loadparm")); + kret = cli_credentials_update_keytab(p->creds, ldb_get_opaque(module->ldb, "EventContext"), ldb_get_opaque(module->ldb, "loadparm")); if (kret != 0) { talloc_free(data->changed_dns); data->changed_dns = NULL; diff --git a/source4/dsdb/samdb/samdb.c b/source4/dsdb/samdb/samdb.c index a01e442587..4af7fb7963 100644 --- a/source4/dsdb/samdb/samdb.c +++ b/source4/dsdb/samdb/samdb.c @@ -71,11 +71,12 @@ char *samdb_relative_path(struct ldb_context *ldb, return an opaque context pointer on success, or NULL on failure */ struct ldb_context *samdb_connect(TALLOC_CTX *mem_ctx, + struct event_context *ev_ctx, struct loadparm_context *lp_ctx, struct auth_session_info *session_info) { struct ldb_context *ldb; - ldb = ldb_wrap_connect(mem_ctx, lp_ctx, + ldb = ldb_wrap_connect(mem_ctx, ev_ctx, lp_ctx, lp_sam_url(lp_ctx), session_info, NULL, 0, NULL); if (!ldb) { @@ -98,6 +99,8 @@ int samdb_copy_template(struct ldb_context *ldb, struct ldb_context *templates_ldb; char *templates_ldb_path; struct ldb_dn *basedn; + struct event_context *event_ctx; + struct loadparm_context *lp_ctx; templates_ldb = talloc_get_type(ldb_get_opaque(ldb, "templates_ldb"), struct ldb_context); @@ -109,8 +112,11 @@ int samdb_copy_template(struct ldb_context *ldb, *errstring = talloc_asprintf(msg, "samdb_copy_template: ERROR: Failed to contruct path for template db"); return LDB_ERR_OPERATIONS_ERROR; } + + event_ctx = (struct event_context *)ldb_get_opaque(ldb, "EventContext"); + lp_ctx = (struct loadparm_context *)ldb_get_opaque(ldb, "loadparm"); - templates_ldb = ldb_wrap_connect(ldb, (struct loadparm_context *)ldb_get_opaque(ldb, "loadparm"), + templates_ldb = ldb_wrap_connect(ldb, event_ctx, lp_ctx, templates_ldb_path, NULL, NULL, 0, NULL); talloc_free(templates_ldb_path); @@ -184,6 +190,7 @@ int samdb_copy_template(struct ldb_context *ldb, Create the SID list for this user. ****************************************************************************/ NTSTATUS security_token_create(TALLOC_CTX *mem_ctx, + struct event_context *ev_ctx, struct loadparm_context *lp_ctx, struct dom_sid *user_sid, struct dom_sid *group_sid, @@ -242,7 +249,7 @@ NTSTATUS security_token_create(TALLOC_CTX *mem_ctx, } /* setup the privilege mask for this token */ - status = samdb_privilege_setup(lp_ctx, ptoken); + status = samdb_privilege_setup(ev_ctx, lp_ctx, ptoken); if (!NT_STATUS_IS_OK(status)) { talloc_free(ptoken); return status; diff --git a/source4/dsdb/samdb/samdb.h b/source4/dsdb/samdb/samdb.h index 5d8694d2d4..9e02ef76c6 100644 --- a/source4/dsdb/samdb/samdb.h +++ b/source4/dsdb/samdb/samdb.h @@ -27,6 +27,7 @@ struct dsdb_control_current_partition; struct dsdb_extended_replicated_object; struct dsdb_extended_replicated_objects; struct loadparm_context; +struct event_context; #include "librpc/gen_ndr/security.h" #include "lib/ldb/include/ldb.h" diff --git a/source4/dsdb/samdb/samdb_privilege.c b/source4/dsdb/samdb/samdb_privilege.c index 5c2de81816..688d1ef9de 100644 --- a/source4/dsdb/samdb/samdb_privilege.c +++ b/source4/dsdb/samdb/samdb_privilege.c @@ -73,7 +73,8 @@ static NTSTATUS samdb_privilege_setup_sid(void *samctx, TALLOC_CTX *mem_ctx, setup the privilege mask for this security token based on our local SAM */ -NTSTATUS samdb_privilege_setup(struct loadparm_context *lp_ctx, struct security_token *token) +NTSTATUS samdb_privilege_setup(struct event_context *ev_ctx, + struct loadparm_context *lp_ctx, struct security_token *token) { void *samctx; TALLOC_CTX *mem_ctx; @@ -97,7 +98,7 @@ NTSTATUS samdb_privilege_setup(struct loadparm_context *lp_ctx, struct security_ } mem_ctx = talloc_new(token); - samctx = samdb_connect(mem_ctx, lp_ctx, system_session(mem_ctx, lp_ctx)); + samctx = samdb_connect(mem_ctx, ev_ctx, lp_ctx, system_session(mem_ctx, lp_ctx)); if (samctx == NULL) { talloc_free(mem_ctx); return NT_STATUS_INTERNAL_DB_CORRUPTION; diff --git a/source4/kdc/hdb-ldb.c b/source4/kdc/hdb-ldb.c index d983b77b40..9c7b1f6457 100644 --- a/source4/kdc/hdb-ldb.c +++ b/source4/kdc/hdb-ldb.c @@ -50,6 +50,7 @@ #include "librpc/gen_ndr/ndr_drsblobs.h" #include "libcli/auth/libcli_auth.h" #include "param/param.h" +#include "events/events.h" enum hdb_ldb_ent_type { HDB_LDB_ENT_TYPE_CLIENT, HDB_LDB_ENT_TYPE_SERVER, @@ -1106,6 +1107,7 @@ static krb5_error_code LDB_destroy(krb5_context context, HDB *db) * code */ NTSTATUS kdc_hdb_ldb_create(TALLOC_CTX *mem_ctx, + struct event_context *ev_ctx, struct loadparm_context *lp_ctx, krb5_context context, struct HDB **db, const char *arg) { @@ -1137,7 +1139,7 @@ NTSTATUS kdc_hdb_ldb_create(TALLOC_CTX *mem_ctx, CRED_DONT_USE_KERBEROS); /* Setup the link to LDB */ - (*db)->hdb_db = samdb_connect(*db, lp_ctx, session_info); + (*db)->hdb_db = samdb_connect(*db, ev_ctx, lp_ctx, session_info); if ((*db)->hdb_db == NULL) { DEBUG(1, ("hdb_ldb_create: Cannot open samdb for KDC backend!")); return NT_STATUS_CANT_ACCESS_DOMAIN_INFO; @@ -1168,7 +1170,7 @@ krb5_error_code hdb_ldb_create(krb5_context context, struct HDB **db, const char { NTSTATUS nt_status; /* The global kdc_mem_ctx and kdc_lp_ctx, Disgusting, ugly hack, but it means one less private hook */ - nt_status = kdc_hdb_ldb_create(kdc_mem_ctx, kdc_lp_ctx, + nt_status = kdc_hdb_ldb_create(kdc_mem_ctx, event_context_find(kdc_mem_ctx), kdc_lp_ctx, context, db, arg); if (NT_STATUS_IS_OK(nt_status)) { diff --git a/source4/kdc/kdc.c b/source4/kdc/kdc.c index 72b5bb14a9..84d9d45f57 100644 --- a/source4/kdc/kdc.c +++ b/source4/kdc/kdc.c @@ -624,7 +624,7 @@ static void kdc_task_init(struct task_server *task) } kdc->config->num_db = 1; - status = kdc_hdb_ldb_create(kdc, task->lp_ctx, + status = kdc_hdb_ldb_create(kdc, task->event_ctx, task->lp_ctx, kdc->smb_krb5_context->krb5_context, &kdc->config->db[0], NULL); if (!NT_STATUS_IS_OK(status)) { diff --git a/source4/kdc/kpasswdd.c b/source4/kdc/kpasswdd.c index 3635676d17..1d49a8a4bd 100644 --- a/source4/kdc/kpasswdd.c +++ b/source4/kdc/kpasswdd.c @@ -180,7 +180,7 @@ static bool kpasswdd_change_password(struct kdc_server *kdc, struct samr_DomInfo1 *dominfo; struct ldb_context *samdb; - samdb = samdb_connect(mem_ctx, kdc->task->lp_ctx, system_session(mem_ctx, kdc->task->lp_ctx)); + samdb = samdb_connect(mem_ctx, kdc->task->event_ctx, kdc->task->lp_ctx, system_session(mem_ctx, kdc->task->lp_ctx)); if (!samdb) { return kpasswdd_make_error_reply(kdc, mem_ctx, KRB5_KPASSWD_HARDERROR, @@ -310,7 +310,7 @@ static bool kpasswd_process_request(struct kdc_server *kdc, krb5_free_principal(context, principal); - samdb = samdb_connect(mem_ctx, kdc->task->lp_ctx, session_info); + samdb = samdb_connect(mem_ctx, kdc->task->event_ctx, kdc->task->lp_ctx, session_info); if (!samdb) { return kpasswdd_make_error_reply(kdc, mem_ctx, KRB5_KPASSWD_HARDERROR, diff --git a/source4/ldap_server/ldap_backend.c b/source4/ldap_server/ldap_backend.c index 9b43d7bd74..9047773529 100644 --- a/source4/ldap_server/ldap_backend.c +++ b/source4/ldap_server/ldap_backend.c @@ -27,6 +27,7 @@ #include "auth/credentials/credentials.h" #include "auth/gensec/gensec.h" #include "param/param.h" +#include "smbd/service_stream.h" #define VALID_DN_SYNTAX(dn,i) do {\ if (!(dn)) {\ @@ -56,6 +57,7 @@ static int map_ldb_error(struct ldb_context *ldb, int err, const char **errstrin NTSTATUS ldapsrv_backend_Init(struct ldapsrv_connection *conn) { conn->ldb = ldb_wrap_connect(conn, + conn->connection->event.ctx, conn->lp_ctx, lp_sam_url(conn->lp_ctx), conn->session_info, diff --git a/source4/ldap_server/ldap_bind.c b/source4/ldap_server/ldap_bind.c index f2c974ae3f..f37ef31c0a 100644 --- a/source4/ldap_server/ldap_bind.c +++ b/source4/ldap_server/ldap_bind.c @@ -44,7 +44,7 @@ static NTSTATUS ldapsrv_BindSimple(struct ldapsrv_call *call) DEBUG(10, ("BindSimple dn: %s\n",req->dn)); - status = crack_auto_name_to_nt4_name(call, call->conn->lp_ctx, req->dn, &nt4_domain, &nt4_account); + status = crack_auto_name_to_nt4_name(call, call->conn->connection->event.ctx, call->conn->lp_ctx, req->dn, &nt4_domain, &nt4_account); if (NT_STATUS_IS_OK(status)) { status = authenticate_username_pw(call, call->conn->connection->event.ctx, diff --git a/source4/ldap_server/ldap_server.c b/source4/ldap_server/ldap_server.c index 11cb63e07b..197f84692c 100644 --- a/source4/ldap_server/ldap_server.c +++ b/source4/ldap_server/ldap_server.c @@ -409,7 +409,7 @@ static void ldapsrv_accept(struct stream_connection *c) conn->server_credentials = server_credentials; /* Connections start out anonymous */ - if (!NT_STATUS_IS_OK(auth_anonymous_session_info(conn, conn->lp_ctx, &conn->session_info))) { + if (!NT_STATUS_IS_OK(auth_anonymous_session_info(conn, c->event.ctx, conn->lp_ctx, &conn->session_info))) { ldapsrv_terminate_connection(conn, "failed to setup anonymous session info"); return; } @@ -478,7 +478,8 @@ static NTSTATUS add_socket(struct event_context *event_context, } /* Load LDAP database */ - ldb = samdb_connect(ldap_service, lp_ctx, system_session(ldap_service, lp_ctx)); + ldb = samdb_connect(ldap_service, ldap_service->task->event_ctx, + lp_ctx, system_session(ldap_service, lp_ctx)); if (!ldb) { return NT_STATUS_INTERNAL_DB_CORRUPTION; } 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) diff --git a/source4/libnet/libnet_become_dc.c b/source4/libnet/libnet_become_dc.c index c4f9cabb11..e8a5329985 100644 --- a/source4/libnet/libnet_become_dc.c +++ b/source4/libnet/libnet_become_dc.c @@ -793,7 +793,7 @@ static NTSTATUS becomeDC_ldap_connect(struct libnet_BecomeDC_state *s, url = talloc_asprintf(s, "ldap://%s/", s->source_dsa.dns_name); NT_STATUS_HAVE_NO_MEMORY(url); - ldap->ldb = ldb_wrap_connect(s, s->libnet->lp_ctx, url, + ldap->ldb = ldb_wrap_connect(s, s->libnet->event_ctx, s->libnet->lp_ctx, url, NULL, s->libnet->cred, 0, NULL); diff --git a/source4/libnet/libnet_join.c b/source4/libnet/libnet_join.c index 4549cd6e93..b5b28df81d 100644 --- a/source4/libnet/libnet_join.c +++ b/source4/libnet/libnet_join.c @@ -230,7 +230,7 @@ static NTSTATUS libnet_JoinADSDomain(struct libnet_context *ctx, struct libnet_J return NT_STATUS_NO_MEMORY; } - remote_ldb = ldb_wrap_connect(tmp_ctx, ctx->lp_ctx, + remote_ldb = ldb_wrap_connect(tmp_ctx, ctx->event_ctx, ctx->lp_ctx, remote_ldb_url, NULL, ctx->cred, 0, NULL); if (!remote_ldb) { diff --git a/source4/libnet/libnet_samsync_ldb.c b/source4/libnet/libnet_samsync_ldb.c index a60b05189b..85e5dea2d7 100644 --- a/source4/libnet/libnet_samsync_ldb.c +++ b/source4/libnet/libnet_samsync_ldb.c @@ -1194,6 +1194,7 @@ static NTSTATUS libnet_samsync_ldb_init(TALLOC_CTX *mem_ctx, ldap_url = talloc_asprintf(state, "ldap://%s", server); state->remote_ldb = ldb_wrap_connect(mem_ctx, + state->samsync_state->machine_net_ctx->event_ctx, state->samsync_state->machine_net_ctx->lp_ctx, ldap_url, NULL, state->samsync_state->machine_net_ctx->cred, @@ -1222,6 +1223,7 @@ NTSTATUS libnet_samsync_ldb(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, str state->trusted_domains = NULL; state->sam_ldb = ldb_wrap_connect(mem_ctx, + ctx->event_ctx, ctx->lp_ctx, lp_sam_url(ctx->lp_ctx), r->in.session_info, diff --git a/source4/libnet/libnet_unbecome_dc.c b/source4/libnet/libnet_unbecome_dc.c index 5d346ac166..6f06585880 100644 --- a/source4/libnet/libnet_unbecome_dc.c +++ b/source4/libnet/libnet_unbecome_dc.c @@ -310,7 +310,7 @@ static NTSTATUS unbecomeDC_ldap_connect(struct libnet_UnbecomeDC_state *s) url = talloc_asprintf(s, "ldap://%s/", s->source_dsa.dns_name); NT_STATUS_HAVE_NO_MEMORY(url); - s->ldap.ldb = ldb_wrap_connect(s, s->libnet->lp_ctx, url, + s->ldap.ldb = ldb_wrap_connect(s, s->libnet->event_ctx, s->libnet->lp_ctx, url, NULL, s->libnet->cred, 0, NULL); diff --git a/source4/libnet/libnet_vampire.c b/source4/libnet/libnet_vampire.c index 1cc63a3fb0..56a8ebe034 100644 --- a/source4/libnet/libnet_vampire.c +++ b/source4/libnet/libnet_vampire.c @@ -70,6 +70,7 @@ struct vampire_state { const char *targetdir; struct loadparm_context *lp_ctx; + struct event_context *event_ctx; }; static NTSTATUS vampire_prepare_db(void *private_data, @@ -335,7 +336,7 @@ static NTSTATUS vampire_apply_schema(struct vampire_state *s, s->schema = NULL; DEBUG(0,("Reopen the SAM LDB with system credentials and a already stored schema\n")); - s->ldb = samdb_connect(s, s->lp_ctx, + s->ldb = samdb_connect(s, s->event_ctx, s->lp_ctx, system_session(s, s->lp_ctx)); if (!s->ldb) { DEBUG(0,("Failed to reopen sam.ldb\n")); @@ -569,7 +570,6 @@ NTSTATUS libnet_Vampire(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, struct libnet_JoinDomain *join; struct libnet_set_join_secrets *set_secrets; struct libnet_BecomeDC b; - struct libnet_UnbecomeDC u; struct vampire_state *s; struct ldb_message *msg; int ldb_ret; @@ -581,12 +581,13 @@ NTSTATUS libnet_Vampire(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, r->out.error_string = NULL; - s = talloc_zero(mem_ctx , struct vampire_state); + s = talloc_zero(mem_ctx, struct vampire_state); if (!s) { return NT_STATUS_NO_MEMORY; } s->lp_ctx = ctx->lp_ctx; + s->event_ctx = ctx->event_ctx; join = talloc_zero(s, struct libnet_JoinDomain); if (!join) { diff --git a/source4/nbt_server/dgram/netlogon.c b/source4/nbt_server/dgram/netlogon.c index 46bfaa9381..7fae6bc1f6 100644 --- a/source4/nbt_server/dgram/netlogon.c +++ b/source4/nbt_server/dgram/netlogon.c @@ -54,7 +54,7 @@ static void nbtd_netlogon_getdc(struct dgram_mailslot_handler *dgmslot, return; } - samctx = samdb_connect(packet, iface->nbtsrv->task->lp_ctx, anonymous_session(packet, iface->nbtsrv->task->lp_ctx)); + samctx = samdb_connect(packet, iface->nbtsrv->task->event_ctx, iface->nbtsrv->task->lp_ctx, anonymous_session(packet, iface->nbtsrv->task->event_ctx, iface->nbtsrv->task->lp_ctx)); if (samctx == NULL) { DEBUG(2,("Unable to open sam in getdc reply\n")); return; @@ -125,7 +125,7 @@ static void nbtd_netlogon_getdc2(struct dgram_mailslot_handler *dgmslot, return; } - samctx = samdb_connect(packet, iface->nbtsrv->task->lp_ctx, anonymous_session(packet, iface->nbtsrv->task->lp_ctx)); + samctx = samdb_connect(packet, iface->nbtsrv->task->event_ctx, iface->nbtsrv->task->lp_ctx, anonymous_session(packet, iface->nbtsrv->task->event_ctx, iface->nbtsrv->task->lp_ctx)); if (samctx == NULL) { DEBUG(2,("Unable to open sam in getdc reply\n")); return; diff --git a/source4/nbt_server/nbt_server.c b/source4/nbt_server/nbt_server.c index 2ac1fb4ef3..832bbe0103 100644 --- a/source4/nbt_server/nbt_server.c +++ b/source4/nbt_server/nbt_server.c @@ -66,7 +66,7 @@ static void nbtd_task_init(struct task_server *task) return; } - nbtsrv->sam_ctx = samdb_connect(nbtsrv, task->lp_ctx, anonymous_session(nbtsrv, task->lp_ctx)); + nbtsrv->sam_ctx = samdb_connect(nbtsrv, task->event_ctx, task->lp_ctx, anonymous_session(nbtsrv, task->event_ctx, task->lp_ctx)); if (nbtsrv->sam_ctx == NULL) { task_server_terminate(task, "nbtd failed to open samdb"); return; diff --git a/source4/nbt_server/wins/winsdb.c b/source4/nbt_server/wins/winsdb.c index 7de5bba468..c84b01f2b2 100644 --- a/source4/nbt_server/wins/winsdb.c +++ b/source4/nbt_server/wins/winsdb.c @@ -945,7 +945,8 @@ failed: return NBT_RCODE_SVR; } -static bool winsdb_check_or_add_module_list(struct loadparm_context *lp_ctx, struct winsdb_handle *h) +static bool winsdb_check_or_add_module_list(struct event_context *ev_ctx, + struct loadparm_context *lp_ctx, struct winsdb_handle *h) { int trans; int ret; @@ -992,7 +993,7 @@ static bool winsdb_check_or_add_module_list(struct loadparm_context *lp_ctx, str flags |= LDB_FLG_NOSYNC; } - h->ldb = ldb_wrap_connect(h, lp_ctx, lock_path(h, lp_ctx, lp_wins_url(lp_ctx)), + h->ldb = ldb_wrap_connect(h, ev_ctx, lp_ctx, lock_path(h, lp_ctx, lp_wins_url(lp_ctx)), NULL, NULL, flags, NULL); if (!h->ldb) goto failed; @@ -1010,7 +1011,9 @@ failed: return false; } -struct winsdb_handle *winsdb_connect(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, +struct winsdb_handle *winsdb_connect(TALLOC_CTX *mem_ctx, + struct event_context *ev_ctx, + struct loadparm_context *lp_ctx, const char *owner, enum winsdb_handle_caller caller) { @@ -1026,7 +1029,7 @@ struct winsdb_handle *winsdb_connect(TALLOC_CTX *mem_ctx, struct loadparm_contex flags |= LDB_FLG_NOSYNC; } - h->ldb = ldb_wrap_connect(h, lp_ctx, lock_path(h, lp_ctx, lp_wins_url(lp_ctx)), + h->ldb = ldb_wrap_connect(h, ev_ctx, lp_ctx, lock_path(h, lp_ctx, lp_wins_url(lp_ctx)), NULL, NULL, flags, NULL); if (!h->ldb) goto failed; @@ -1037,7 +1040,7 @@ struct winsdb_handle *winsdb_connect(TALLOC_CTX *mem_ctx, struct loadparm_contex if (!h->local_owner) goto failed; /* make sure the module list is available and used */ - ret = winsdb_check_or_add_module_list(lp_ctx, h); + ret = winsdb_check_or_add_module_list(ev_ctx, lp_ctx, h); if (!ret) goto failed; ldb_err = ldb_set_opaque(h->ldb, "winsdb_handle", h); diff --git a/source4/nbt_server/wins/winsserver.c b/source4/nbt_server/wins/winsserver.c index f116c45898..f8901ce09d 100644 --- a/source4/nbt_server/wins/winsserver.c +++ b/source4/nbt_server/wins/winsserver.c @@ -985,7 +985,8 @@ NTSTATUS nbtd_winsserver_init(struct nbtd_server *nbtsrv) owner = iface_n_ip(ifaces, 0); } - nbtsrv->winssrv->wins_db = winsdb_connect(nbtsrv->winssrv, nbtsrv->task->lp_ctx, + nbtsrv->winssrv->wins_db = winsdb_connect(nbtsrv->winssrv, nbtsrv->task->event_ctx, + nbtsrv->task->lp_ctx, owner, WINSDB_HANDLE_CALLER_NBTD); if (!nbtsrv->winssrv->wins_db) { return NT_STATUS_INTERNAL_DB_ERROR; diff --git a/source4/ntptr/ntptr.h b/source4/ntptr/ntptr.h index 3e95c3c5e1..7138a2fdfb 100644 --- a/source4/ntptr/ntptr.h +++ b/source4/ntptr/ntptr.h @@ -220,6 +220,7 @@ struct ntptr_ops { struct ntptr_context { const struct ntptr_ops *ops; void *private_data; + struct event_context *ev_ctx; struct loadparm_context *lp_ctx; }; diff --git a/source4/ntptr/ntptr_base.c b/source4/ntptr/ntptr_base.c index 0000337cb0..1165631b18 100644 --- a/source4/ntptr/ntptr_base.c +++ b/source4/ntptr/ntptr_base.c @@ -120,7 +120,8 @@ const struct ntptr_critical_sizes *ntptr_interface_version(void) /* create a ntptr_context with a specified NTPTR backend */ -NTSTATUS ntptr_init_context(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, +NTSTATUS ntptr_init_context(TALLOC_CTX *mem_ctx, struct event_context *ev_ctx, + struct loadparm_context *lp_ctx, const char *providor, struct ntptr_context **_ntptr) { NTSTATUS status; @@ -134,6 +135,7 @@ NTSTATUS ntptr_init_context(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx NT_STATUS_HAVE_NO_MEMORY(ntptr); ntptr->private_data = NULL; ntptr->ops = ntptr_backend_byname(providor); + ntptr->ev_ctx = ev_ctx; ntptr->lp_ctx = lp_ctx; if (!ntptr->ops) { diff --git a/source4/ntptr/simple_ldb/ntptr_simple_ldb.c b/source4/ntptr/simple_ldb/ntptr_simple_ldb.c index 47f3c0ddf0..3573fac3ea 100644 --- a/source4/ntptr/simple_ldb/ntptr_simple_ldb.c +++ b/source4/ntptr/simple_ldb/ntptr_simple_ldb.c @@ -42,9 +42,9 @@ connect to the SPOOLSS database return a ldb_context pointer on success, or NULL on failure */ -static struct ldb_context *sptr_db_connect(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx) +static struct ldb_context *sptr_db_connect(TALLOC_CTX *mem_ctx, struct event_context *ev_ctx, struct loadparm_context *lp_ctx) { - return ldb_wrap_connect(mem_ctx, lp_ctx, lp_spoolss_url(lp_ctx), system_session(mem_ctx, lp_ctx), + return ldb_wrap_connect(mem_ctx, ev_ctx, lp_ctx, lp_spoolss_url(lp_ctx), system_session(mem_ctx, lp_ctx), NULL, 0, NULL); } @@ -87,7 +87,7 @@ static int sptr_db_search(struct ldb_context *ldb, static NTSTATUS sptr_init_context(struct ntptr_context *ntptr) { - struct ldb_context *sptr_db = sptr_db_connect(ntptr, ntptr->lp_ctx); + struct ldb_context *sptr_db = sptr_db_connect(ntptr, ntptr->ev_ctx, ntptr->lp_ctx); NT_STATUS_HAVE_NO_MEMORY(sptr_db); ntptr->private_data = sptr_db; diff --git a/source4/ntvfs/ipc/ipc_rap.c b/source4/ntvfs/ipc/ipc_rap.c index faf48705c4..4969f1a791 100644 --- a/source4/ntvfs/ipc/ipc_rap.c +++ b/source4/ntvfs/ipc/ipc_rap.c @@ -21,6 +21,7 @@ #include "includes.h" #include "libcli/raw/interfaces.h" #include "libcli/rap/rap.h" +#include "events/events.h" #include "ntvfs/ipc/proto.h" #include "librpc/ndr/libndr.h" #include "param/param.h" @@ -100,11 +101,14 @@ struct rap_call { struct ndr_pull *ndr_pull_param; struct ndr_pull *ndr_pull_data; + + struct event_context *event_ctx; }; #define RAPNDR_FLAGS (LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM); static struct rap_call *new_rap_srv_call(TALLOC_CTX *mem_ctx, + struct event_context *ev_ctx, struct loadparm_context *lp_ctx, struct smb_trans2 *trans) { @@ -118,6 +122,7 @@ static struct rap_call *new_rap_srv_call(TALLOC_CTX *mem_ctx, ZERO_STRUCTP(call); call->lp_ctx = talloc_reference(call, lp_ctx); + call->event_ctx = ev_ctx; call->mem_ctx = mem_ctx; @@ -271,7 +276,7 @@ static NTSTATUS _rap_netshareenum(struct rap_call *call) break; } - result = rap_netshareenum(call, call->lp_ctx, &r); + result = rap_netshareenum(call, call->event_ctx, call->lp_ctx, &r); if (!NT_STATUS_IS_OK(result)) return result; @@ -430,7 +435,7 @@ static const struct {NULL, -1, api_Unsupported} }; -NTSTATUS ipc_rap_call(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, +NTSTATUS ipc_rap_call(TALLOC_CTX *mem_ctx, struct event_context *event_ctx, struct loadparm_context *lp_ctx, struct smb_trans2 *trans) { int i; @@ -440,7 +445,7 @@ NTSTATUS ipc_rap_call(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, struct ndr_push *final_param; struct ndr_push *final_data; - call = new_rap_srv_call(mem_ctx, lp_ctx, trans); + call = new_rap_srv_call(mem_ctx, event_ctx, lp_ctx, trans); if (call == NULL) return NT_STATUS_NO_MEMORY; diff --git a/source4/ntvfs/ipc/rap_server.c b/source4/ntvfs/ipc/rap_server.c index 633f0bf36e..d9fb7e21b2 100644 --- a/source4/ntvfs/ipc/rap_server.c +++ b/source4/ntvfs/ipc/rap_server.c @@ -29,6 +29,7 @@ * idea. */ NTSTATUS rap_netshareenum(TALLOC_CTX *mem_ctx, + struct event_context *event_ctx, struct loadparm_context *lp_ctx, struct rap_NetShareEnum *r) { @@ -42,7 +43,7 @@ NTSTATUS rap_netshareenum(TALLOC_CTX *mem_ctx, r->out.available = 0; r->out.info = NULL; - nterr = share_get_context_by_name(mem_ctx, lp_share_backend(lp_ctx), lp_ctx, &sctx); + nterr = share_get_context_by_name(mem_ctx, lp_share_backend(lp_ctx), event_ctx, lp_ctx, &sctx); if (!NT_STATUS_IS_OK(nterr)) { return nterr; } diff --git a/source4/ntvfs/ipc/vfs_ipc.c b/source4/ntvfs/ipc/vfs_ipc.c index 92f0eadae1..ea7b54ae6a 100644 --- a/source4/ntvfs/ipc/vfs_ipc.c +++ b/source4/ntvfs/ipc/vfs_ipc.c @@ -805,7 +805,7 @@ static NTSTATUS ipc_trans(struct ntvfs_module_context *ntvfs, NTSTATUS status; if (strequal(trans->in.trans_name, "\\PIPE\\LANMAN")) - return ipc_rap_call(req, ntvfs->ctx->lp_ctx, trans); + return ipc_rap_call(req, ntvfs->ctx->event_ctx, ntvfs->ctx->lp_ctx, trans); if (trans->in.setup_count != 2) { return NT_STATUS_INVALID_PARAMETER; diff --git a/source4/param/share.c b/source4/param/share.c index 51134d8970..f8ee468054 100644 --- a/source4/param/share.c +++ b/source4/param/share.c @@ -127,6 +127,7 @@ NTSTATUS share_register(const struct share_ops *ops) } NTSTATUS share_get_context_by_name(TALLOC_CTX *mem_ctx, const char *backend_name, + struct event_context *event_ctx, struct loadparm_context *lp_ctx, struct share_context **ctx) { @@ -138,7 +139,7 @@ NTSTATUS share_get_context_by_name(TALLOC_CTX *mem_ctx, const char *backend_name return NT_STATUS_INTERNAL_ERROR; } - return ops->init(mem_ctx, ops, lp_ctx, ctx); + return ops->init(mem_ctx, ops, event_ctx, lp_ctx, ctx); } /* diff --git a/source4/param/share.h b/source4/param/share.h index 9f9cbdce5b..2a85fd4fbb 100644 --- a/source4/param/share.h +++ b/source4/param/share.h @@ -47,9 +47,12 @@ struct share_info { void *value; }; +struct event_context; + struct share_ops { const char *name; - NTSTATUS (*init)(TALLOC_CTX *, const struct share_ops*, struct loadparm_context *lp_ctx, + NTSTATUS (*init)(TALLOC_CTX *, const struct share_ops*, struct event_context *ev_ctx, + struct loadparm_context *lp_ctx, struct share_context **); const char *(*string_option)(struct share_config *, const char *, const char *); int (*int_option)(struct share_config *, const char *, int); diff --git a/source4/param/share_classic.c b/source4/param/share_classic.c index c3adc4473c..bac1aac2d7 100644 --- a/source4/param/share_classic.c +++ b/source4/param/share_classic.c @@ -25,6 +25,7 @@ static NTSTATUS sclassic_init(TALLOC_CTX *mem_ctx, const struct share_ops *ops, + struct event_context *event_ctx, struct loadparm_context *lp_ctx, struct share_context **ctx) { diff --git a/source4/param/share_ldb.c b/source4/param/share_ldb.c index fb40f1e9bf..eba1665cc9 100644 --- a/source4/param/share_ldb.c +++ b/source4/param/share_ldb.c @@ -27,7 +27,9 @@ #include "param/share.h" #include "param/param.h" -static NTSTATUS sldb_init(TALLOC_CTX *mem_ctx, const struct share_ops *ops, struct loadparm_context *lp_ctx, +static NTSTATUS sldb_init(TALLOC_CTX *mem_ctx, const struct share_ops *ops, + struct event_context *ev_ctx, + struct loadparm_context *lp_ctx, struct share_context **ctx) { struct ldb_context *sdb; @@ -38,7 +40,7 @@ static NTSTATUS sldb_init(TALLOC_CTX *mem_ctx, const struct share_ops *ops, stru return NT_STATUS_NO_MEMORY; } - sdb = ldb_wrap_connect(*ctx, lp_ctx, + sdb = ldb_wrap_connect(*ctx, ev_ctx, lp_ctx, private_path(*ctx, lp_ctx, "share.ldb"), system_session(*ctx, lp_ctx), NULL, 0, NULL); diff --git a/source4/param/tests/share.c b/source4/param/tests/share.c index 6d03b4e049..c64b5c607a 100644 --- a/source4/param/tests/share.c +++ b/source4/param/tests/share.c @@ -182,12 +182,12 @@ static void tcase_add_share_tests(struct torture_tcase *tcase) static bool setup_ldb(struct torture_context *tctx, void **data) { - return NT_STATUS_IS_OK(share_get_context_by_name(tctx, "ldb", tctx->lp_ctx, (struct share_context **)data)); + return NT_STATUS_IS_OK(share_get_context_by_name(tctx, "ldb", tctx->ev, tctx->lp_ctx, (struct share_context **)data)); } static bool setup_classic(struct torture_context *tctx, void **data) { - return NT_STATUS_IS_OK(share_get_context_by_name(tctx, "classic", tctx->lp_ctx, (struct share_context **)data)); + return NT_STATUS_IS_OK(share_get_context_by_name(tctx, "classic", tctx->ev, tctx->lp_ctx, (struct share_context **)data)); } static bool teardown(struct torture_context *tctx, void *data) diff --git a/source4/rpc_server/common/server_info.c b/source4/rpc_server/common/server_info.c index 646879ad0d..da034e85ea 100644 --- a/source4/rpc_server/common/server_info.c +++ b/source4/rpc_server/common/server_info.c @@ -82,7 +82,7 @@ uint32_t dcesrv_common_get_version_build(TALLOC_CTX *mem_ctx, struct loadparm_co } /* This hardcoded value should go into a ldb database! */ -uint32_t dcesrv_common_get_server_type(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx) +uint32_t dcesrv_common_get_server_type(TALLOC_CTX *mem_ctx, struct event_context *event_ctx, struct dcesrv_context *dce_ctx) { int default_server_announce = 0; default_server_announce |= SV_TYPE_WORKSTATION; @@ -118,7 +118,7 @@ uint32_t dcesrv_common_get_server_type(TALLOC_CTX *mem_ctx, struct dcesrv_contex break; } /* open main ldb */ - samctx = samdb_connect(tmp_ctx, dce_ctx->lp_ctx, anonymous_session(tmp_ctx, dce_ctx->lp_ctx)); + samctx = samdb_connect(tmp_ctx, event_ctx, dce_ctx->lp_ctx, anonymous_session(tmp_ctx, event_ctx, dce_ctx->lp_ctx)); if (samctx == NULL) { DEBUG(2,("Unable to open samdb in determining server announce flags\n")); } else { diff --git a/source4/rpc_server/drsuapi/dcesrv_drsuapi.c b/source4/rpc_server/drsuapi/dcesrv_drsuapi.c index a97b93a051..e0a222e767 100644 --- a/source4/rpc_server/drsuapi/dcesrv_drsuapi.c +++ b/source4/rpc_server/drsuapi/dcesrv_drsuapi.c @@ -58,7 +58,7 @@ static WERROR dcesrv_drsuapi_DsBind(struct dcesrv_call_state *dce_call, TALLOC_C /* * connect to the samdb */ - b_state->sam_ctx = samdb_connect(b_state, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info); + b_state->sam_ctx = samdb_connect(b_state, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info); if (!b_state->sam_ctx) { return WERR_FOOBAR; } diff --git a/source4/rpc_server/lsa/lsa_init.c b/source4/rpc_server/lsa/lsa_init.c index 4dcd606435..0dc21fd9c5 100644 --- a/source4/rpc_server/lsa/lsa_init.c +++ b/source4/rpc_server/lsa/lsa_init.c @@ -50,7 +50,7 @@ NTSTATUS dcesrv_lsa_get_policy_state(struct dcesrv_call_state *dce_call, TALLOC_ } /* make sure the sam database is accessible */ - state->sam_ldb = samdb_connect(state, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info); + state->sam_ldb = samdb_connect(state, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info); if (state->sam_ldb == NULL) { return NT_STATUS_INVALID_SYSTEM_SERVICE; } diff --git a/source4/rpc_server/lsa/lsa_lookup.c b/source4/rpc_server/lsa/lsa_lookup.c index c6b9e3bd40..30bceb8139 100644 --- a/source4/rpc_server/lsa/lsa_lookup.c +++ b/source4/rpc_server/lsa/lsa_lookup.c @@ -195,7 +195,8 @@ static NTSTATUS lookup_well_known_sids(TALLOC_CTX *mem_ctx, /* lookup a SID for 1 name */ -static NTSTATUS dcesrv_lsa_lookup_name(struct loadparm_context *lp_ctx, +static NTSTATUS dcesrv_lsa_lookup_name(struct event_context *ev_ctx, + struct loadparm_context *lp_ctx, struct lsa_policy_state *state, TALLOC_CTX *mem_ctx, const char *name, const char **authority_name, struct dom_sid **sid, enum lsa_SidType *rtype) @@ -218,7 +219,7 @@ static NTSTATUS dcesrv_lsa_lookup_name(struct loadparm_context *lp_ctx, } username = p + 1; } else if (strchr_m(name, '@')) { - status = crack_name_to_nt4_name(mem_ctx, lp_ctx, DRSUAPI_DS_NAME_FORMAT_USER_PRINCIPAL, name, &domain, &username); + status = crack_name_to_nt4_name(mem_ctx, ev_ctx, lp_ctx, DRSUAPI_DS_NAME_FORMAT_USER_PRINCIPAL, name, &domain, &username); if (!NT_STATUS_IS_OK(status)) { DEBUG(3, ("Failed to crack name %s into an NT4 name: %s\n", name, nt_errstr(status))); return status; @@ -265,7 +266,7 @@ static NTSTATUS dcesrv_lsa_lookup_name(struct loadparm_context *lp_ctx, if (!name) { return NT_STATUS_NO_MEMORY; } - status = dcesrv_lsa_lookup_name(lp_ctx, state, mem_ctx, name, authority_name, sid, rtype); + status = dcesrv_lsa_lookup_name(ev_ctx, lp_ctx, state, mem_ctx, name, authority_name, sid, rtype); if (NT_STATUS_IS_OK(status)) { return status; } @@ -275,7 +276,7 @@ static NTSTATUS dcesrv_lsa_lookup_name(struct loadparm_context *lp_ctx, if (!name) { return NT_STATUS_NO_MEMORY; } - status = dcesrv_lsa_lookup_name(lp_ctx, state, mem_ctx, name, authority_name, sid, rtype); + status = dcesrv_lsa_lookup_name(ev_ctx, lp_ctx, state, mem_ctx, name, authority_name, sid, rtype); if (NT_STATUS_IS_OK(status)) { return status; } @@ -285,7 +286,7 @@ static NTSTATUS dcesrv_lsa_lookup_name(struct loadparm_context *lp_ctx, if (!name) { return NT_STATUS_NO_MEMORY; } - status = dcesrv_lsa_lookup_name(lp_ctx, state, mem_ctx, name, authority_name, sid, rtype); + status = dcesrv_lsa_lookup_name(ev_ctx, lp_ctx, state, mem_ctx, name, authority_name, sid, rtype); if (NT_STATUS_IS_OK(status)) { return status; } @@ -721,7 +722,7 @@ NTSTATUS dcesrv_lsa_LookupNames3(struct dcesrv_call_state *dce_call, r->out.sids->sids[i].sid_index = 0xFFFFFFFF; r->out.sids->sids[i].unknown = 0; - status2 = dcesrv_lsa_lookup_name(lp_ctx, policy_state, mem_ctx, name, &authority_name, &sid, &rtype); + status2 = dcesrv_lsa_lookup_name(dce_call->event_ctx, lp_ctx, policy_state, mem_ctx, name, &authority_name, &sid, &rtype); if (!NT_STATUS_IS_OK(status2) || sid->num_auths == 0) { continue; } @@ -854,7 +855,7 @@ NTSTATUS dcesrv_lsa_LookupNames2(struct dcesrv_call_state *dce_call, r->out.sids->sids[i].sid_index = 0xFFFFFFFF; r->out.sids->sids[i].unknown = 0; - status2 = dcesrv_lsa_lookup_name(lp_ctx, state, mem_ctx, name, + status2 = dcesrv_lsa_lookup_name(dce_call->event_ctx, lp_ctx, state, mem_ctx, name, &authority_name, &sid, &rtype); if (!NT_STATUS_IS_OK(status2)) { continue; diff --git a/source4/rpc_server/netlogon/dcerpc_netlogon.c b/source4/rpc_server/netlogon/dcerpc_netlogon.c index 37e6351864..d9ae92c0fa 100644 --- a/source4/rpc_server/netlogon/dcerpc_netlogon.c +++ b/source4/rpc_server/netlogon/dcerpc_netlogon.c @@ -93,7 +93,7 @@ static NTSTATUS dcesrv_netr_ServerAuthenticate3(struct dcesrv_call_state *dce_ca return NT_STATUS_ACCESS_DENIED; } - sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, + sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(mem_ctx, dce_call->conn->dce_ctx->lp_ctx)); if (sam_ctx == NULL) { return NT_STATUS_INVALID_SYSTEM_SERVICE; @@ -176,7 +176,7 @@ static NTSTATUS dcesrv_netr_ServerAuthenticate3(struct dcesrv_call_state *dce_ca /* remember this session key state */ - nt_status = schannel_store_session_key(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, creds); + nt_status = schannel_store_session_key(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, creds); return nt_status; } @@ -236,7 +236,8 @@ static NTSTATUS dcesrv_netr_ServerAuthenticate2(struct dcesrv_call_state *dce_ca the caller needs some of that information. */ -static NTSTATUS dcesrv_netr_creds_server_step_check(struct loadparm_context *lp_ctx, +static NTSTATUS dcesrv_netr_creds_server_step_check(struct event_context *event_ctx, + struct loadparm_context *lp_ctx, const char *computer_name, TALLOC_CTX *mem_ctx, struct netr_Authenticator *received_authenticator, @@ -248,7 +249,7 @@ static NTSTATUS dcesrv_netr_creds_server_step_check(struct loadparm_context *lp_ struct ldb_context *ldb; int ret; - ldb = schannel_db_connect(mem_ctx, lp_ctx); + ldb = schannel_db_connect(mem_ctx, event_ctx, lp_ctx); if (!ldb) { return NT_STATUS_ACCESS_DENIED; } @@ -300,13 +301,13 @@ static NTSTATUS dcesrv_netr_ServerPasswordSet(struct dcesrv_call_state *dce_call struct ldb_context *sam_ctx; NTSTATUS nt_status; - nt_status = dcesrv_netr_creds_server_step_check(dce_call->conn->dce_ctx->lp_ctx, + nt_status = dcesrv_netr_creds_server_step_check(dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, r->in.computer_name, mem_ctx, &r->in.credential, &r->out.return_authenticator, &creds); NT_STATUS_NOT_OK_RETURN(nt_status); - sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(mem_ctx, dce_call->conn->dce_ctx->lp_ctx)); + sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(mem_ctx, dce_call->conn->dce_ctx->lp_ctx)); if (sam_ctx == NULL) { return NT_STATUS_INVALID_SYSTEM_SERVICE; } @@ -339,13 +340,13 @@ static NTSTATUS dcesrv_netr_ServerPasswordSet2(struct dcesrv_call_state *dce_cal struct samr_CryptPassword password_buf; - nt_status = dcesrv_netr_creds_server_step_check(dce_call->conn->dce_ctx->lp_ctx, + nt_status = dcesrv_netr_creds_server_step_check(dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, r->in.computer_name, mem_ctx, &r->in.credential, &r->out.return_authenticator, &creds); NT_STATUS_NOT_OK_RETURN(nt_status); - sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(mem_ctx, dce_call->conn->dce_ctx->lp_ctx)); + sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(mem_ctx, dce_call->conn->dce_ctx->lp_ctx)); if (sam_ctx == NULL) { return NT_STATUS_INVALID_SYSTEM_SERVICE; } @@ -561,7 +562,7 @@ static NTSTATUS dcesrv_netr_LogonSamLogonEx(struct dcesrv_call_state *dce_call, { NTSTATUS nt_status; struct creds_CredentialState *creds; - nt_status = schannel_fetch_session_key(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, r->in.computer_name, lp_workgroup(dce_call->conn->dce_ctx->lp_ctx), &creds); + nt_status = schannel_fetch_session_key(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, r->in.computer_name, lp_workgroup(dce_call->conn->dce_ctx->lp_ctx), &creds); if (!NT_STATUS_IS_OK(nt_status)) { return nt_status; } @@ -589,7 +590,7 @@ static NTSTATUS dcesrv_netr_LogonSamLogonWithFlags(struct dcesrv_call_state *dce return_authenticator = talloc(mem_ctx, struct netr_Authenticator); NT_STATUS_HAVE_NO_MEMORY(return_authenticator); - nt_status = dcesrv_netr_creds_server_step_check(dce_call->conn->dce_ctx->lp_ctx, + nt_status = dcesrv_netr_creds_server_step_check(dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, r->in.computer_name, mem_ctx, r->in.credential, return_authenticator, &creds); @@ -891,14 +892,14 @@ static NTSTATUS dcesrv_netr_LogonGetDomainInfo(struct dcesrv_call_state *dce_cal const char *local_domain; - status = dcesrv_netr_creds_server_step_check(dce_call->conn->dce_ctx->lp_ctx, + status = dcesrv_netr_creds_server_step_check(dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, r->in.computer_name, mem_ctx, r->in.credential, r->out.return_authenticator, NULL); NT_STATUS_NOT_OK_RETURN(status); - sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info); + sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info); if (sam_ctx == NULL) { return NT_STATUS_INVALID_SYSTEM_SERVICE; } @@ -1003,7 +1004,7 @@ static WERROR dcesrv_netr_DsRGetDCNameEx2(struct dcesrv_call_state *dce_call, TA ZERO_STRUCT(r->out); - sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info); + sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info); if (sam_ctx == NULL) { return WERR_DS_SERVICE_UNAVAILABLE; } @@ -1165,7 +1166,7 @@ static WERROR dcesrv_netr_DsrEnumerateDomainTrusts(struct dcesrv_call_state *dce ZERO_STRUCT(r->out); - sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info); + sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info); if (sam_ctx == NULL) { return WERR_GENERAL_FAILURE; } diff --git a/source4/rpc_server/samr/dcesrv_samr.c b/source4/rpc_server/samr/dcesrv_samr.c index 0aa4d65d8c..8ee77a6a30 100644 --- a/source4/rpc_server/samr/dcesrv_samr.c +++ b/source4/rpc_server/samr/dcesrv_samr.c @@ -156,7 +156,7 @@ static NTSTATUS dcesrv_samr_Connect(struct dcesrv_call_state *dce_call, TALLOC_C } /* make sure the sam database is accessible */ - c_state->sam_ctx = samdb_connect(c_state, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info); + c_state->sam_ctx = samdb_connect(c_state, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info); if (c_state->sam_ctx == NULL) { talloc_free(c_state); return NT_STATUS_INVALID_SYSTEM_SERVICE; @@ -4135,7 +4135,7 @@ static NTSTATUS dcesrv_samr_GetDomPwInfo(struct dcesrv_call_state *dce_call, TAL ZERO_STRUCT(r->out.info); - sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info); + sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info); if (sam_ctx == NULL) { return NT_STATUS_INVALID_SYSTEM_SERVICE; } diff --git a/source4/rpc_server/samr/samr_password.c b/source4/rpc_server/samr/samr_password.c index ec91b8eada..b78a9ceaa7 100644 --- a/source4/rpc_server/samr/samr_password.c +++ b/source4/rpc_server/samr/samr_password.c @@ -66,7 +66,7 @@ NTSTATUS dcesrv_samr_ChangePasswordUser(struct dcesrv_call_state *dce_call, } /* To change a password we need to open as system */ - sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(mem_ctx, dce_call->conn->dce_ctx->lp_ctx)); + sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(mem_ctx, dce_call->conn->dce_ctx->lp_ctx)); if (sam_ctx == NULL) { return NT_STATUS_INVALID_SYSTEM_SERVICE; } @@ -205,7 +205,7 @@ NTSTATUS dcesrv_samr_OemChangePasswordUser2(struct dcesrv_call_state *dce_call, } /* To change a password we need to open as system */ - sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(mem_ctx, dce_call->conn->dce_ctx->lp_ctx)); + sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(mem_ctx, dce_call->conn->dce_ctx->lp_ctx)); if (sam_ctx == NULL) { return NT_STATUS_INVALID_SYSTEM_SERVICE; } @@ -343,7 +343,7 @@ NTSTATUS dcesrv_samr_ChangePasswordUser3(struct dcesrv_call_state *dce_call, } /* To change a password we need to open as system */ - sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(mem_ctx, dce_call->conn->dce_ctx->lp_ctx)); + sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(mem_ctx, dce_call->conn->dce_ctx->lp_ctx)); if (sam_ctx == NULL) { return NT_STATUS_INVALID_SYSTEM_SERVICE; } diff --git a/source4/rpc_server/service_rpc.c b/source4/rpc_server/service_rpc.c index e81b8cd0aa..27f3fe41c2 100644 --- a/source4/rpc_server/service_rpc.c +++ b/source4/rpc_server/service_rpc.c @@ -107,7 +107,7 @@ static void dcesrv_sock_accept(struct stream_connection *srv_conn) struct dcesrv_connection *dcesrv_conn = NULL; struct auth_session_info *session_info = NULL; - status = auth_anonymous_session_info(srv_conn, dcesrv_sock->dcesrv_ctx->lp_ctx, &session_info); + status = auth_anonymous_session_info(srv_conn, srv_conn->event.ctx, dcesrv_sock->dcesrv_ctx->lp_ctx, &session_info); if (!NT_STATUS_IS_OK(status)) { DEBUG(0,("dcesrv_sock_accept: auth_anonymous_session_info failed: %s\n", nt_errstr(status))); diff --git a/source4/rpc_server/spoolss/dcesrv_spoolss.c b/source4/rpc_server/spoolss/dcesrv_spoolss.c index 7c701ec50a..46270727a4 100644 --- a/source4/rpc_server/spoolss/dcesrv_spoolss.c +++ b/source4/rpc_server/spoolss/dcesrv_spoolss.c @@ -216,7 +216,7 @@ static NTSTATUS dcerpc_spoolss_bind(struct dcesrv_call_state *dce_call, const st NTSTATUS status; struct ntptr_context *ntptr; - status = ntptr_init_context(dce_call->context, dce_call->conn->dce_ctx->lp_ctx, + status = ntptr_init_context(dce_call->context, dce_call->conn->event_ctx, dce_call->conn->dce_ctx->lp_ctx, lp_ntptr_providor(dce_call->conn->dce_ctx->lp_ctx), &ntptr); NT_STATUS_NOT_OK_RETURN(status); diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index 23e40d9976..8dc42bf43b 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -445,7 +445,7 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL int count = 8; int i; - nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx); + nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, &sctx); if (!NT_STATUS_IS_OK(nterr)) { return ntstatus_to_werror(nterr); } @@ -543,7 +543,7 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL int count = 10; int i; - nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx); + nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, &sctx); if (!NT_STATUS_IS_OK(nterr)) { return ntstatus_to_werror(nterr); } @@ -735,7 +735,7 @@ static WERROR dcesrv_srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call, /* TODO: - paging of results */ - nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx); + nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, &sctx); if (!NT_STATUS_IS_OK(nterr)) { return ntstatus_to_werror(nterr); } @@ -984,7 +984,7 @@ static WERROR dcesrv_srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call, return WERR_INVALID_PARAM; } - nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx); + nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, &sctx); if (!NT_STATUS_IS_OK(nterr)) { return ntstatus_to_werror(nterr); } @@ -1238,7 +1238,7 @@ static WERROR dcesrv_srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call, return WERR_INVALID_PARAM; } - nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx); + nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, &sctx); if (!NT_STATUS_IS_OK(nterr)) { return ntstatus_to_werror(nterr); } @@ -1415,7 +1415,7 @@ static WERROR dcesrv_srvsvc_NetShareCheck(struct dcesrv_call_state *dce_call, TA } all_string_sub(device, "\\", "/", 0); - nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx); + nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, &sctx); if (!NT_STATUS_IS_OK(nterr)) { return ntstatus_to_werror(nterr); } @@ -1499,7 +1499,7 @@ static WERROR dcesrv_srvsvc_NetSrvGetInfo(struct dcesrv_call_state *dce_call, TA info101->version_major = dcesrv_common_get_version_major(mem_ctx, dce_ctx->lp_ctx); info101->version_minor = dcesrv_common_get_version_minor(mem_ctx, dce_ctx->lp_ctx); - info101->server_type = dcesrv_common_get_server_type(mem_ctx, dce_ctx); + info101->server_type = dcesrv_common_get_server_type(mem_ctx, dce_call->event_ctx, dce_ctx); info101->comment = talloc_strdup(mem_ctx, lp_serverstring(dce_ctx->lp_ctx)); W_ERROR_HAVE_NO_MEMORY(info101->comment); @@ -1519,7 +1519,7 @@ static WERROR dcesrv_srvsvc_NetSrvGetInfo(struct dcesrv_call_state *dce_call, TA info102->version_major = dcesrv_common_get_version_major(mem_ctx, dce_ctx->lp_ctx); info102->version_minor = dcesrv_common_get_version_minor(mem_ctx, dce_ctx->lp_ctx); - info102->server_type = dcesrv_common_get_server_type(mem_ctx, dce_ctx); + info102->server_type = dcesrv_common_get_server_type(mem_ctx, dce_call->event_ctx, dce_ctx); info102->comment = talloc_strdup(mem_ctx, lp_serverstring(dce_ctx->lp_ctx)); W_ERROR_HAVE_NO_MEMORY(info102->comment); @@ -1829,7 +1829,7 @@ static WERROR dcesrv_srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TAL /* TODO: - paging of results */ - nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx); + nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, &sctx); if (!NT_STATUS_IS_OK(nterr)) { return ntstatus_to_werror(nterr); } @@ -2292,7 +2292,7 @@ static WERROR dcesrv_srvsvc_NetShareDel(struct dcesrv_call_state *dce_call, TALL NTSTATUS nterr; struct share_context *sctx; - nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx); + nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, &sctx); if (!NT_STATUS_IS_OK(nterr)) { return ntstatus_to_werror(nterr); } diff --git a/source4/rpc_server/srvsvc/srvsvc_ntvfs.c b/source4/rpc_server/srvsvc/srvsvc_ntvfs.c index 43fb24c0c3..f1cb35bdd8 100644 --- a/source4/rpc_server/srvsvc/srvsvc_ntvfs.c +++ b/source4/rpc_server/srvsvc/srvsvc_ntvfs.c @@ -62,7 +62,7 @@ NTSTATUS srvsvc_create_ntvfs_context(struct dcesrv_call_state *dce_call, struct share_config *scfg; const char *sharetype; - status = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx); + status = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, &sctx); if (!NT_STATUS_IS_OK(status)) { return status; } diff --git a/source4/rpc_server/winreg/rpc_winreg.c b/source4/rpc_server/winreg/rpc_winreg.c index 9993dc14c1..22c60c354c 100644 --- a/source4/rpc_server/winreg/rpc_winreg.c +++ b/source4/rpc_server/winreg/rpc_winreg.c @@ -37,7 +37,7 @@ static NTSTATUS dcerpc_winreg_bind(struct dcesrv_call_state *dce_call, WERROR err; err = reg_open_samba(dce_call->context, - &ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info, + &ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info, NULL); if (!W_ERROR_IS_OK(err)) { diff --git a/source4/scripting/ejs/smbcalls_auth.c b/source4/scripting/ejs/smbcalls_auth.c index 8e464a5021..b67bb7ed5b 100644 --- a/source4/scripting/ejs/smbcalls_auth.c +++ b/source4/scripting/ejs/smbcalls_auth.c @@ -109,7 +109,7 @@ static int ejs_doauth(MprVarHandle eid, goto done; } - nt_status = auth_generate_session_info(tmp_ctx, mprLpCtx(), server_info, &session_info); + nt_status = auth_generate_session_info(tmp_ctx, mprEventCtx(), mprLpCtx(), server_info, &session_info); if (!NT_STATUS_IS_OK(nt_status)) { mprSetPropertyValue(auth, "report", mprString("Session Info generation failed")); mprSetPropertyValue(auth, "result", mprCreateBoolVar(false)); diff --git a/source4/scripting/ejs/smbcalls_ldb.c b/source4/scripting/ejs/smbcalls_ldb.c index f47920b9bb..4a157945af 100644 --- a/source4/scripting/ejs/smbcalls_ldb.c +++ b/source4/scripting/ejs/smbcalls_ldb.c @@ -453,7 +453,7 @@ static int ejs_ldbConnect(MprVarHandle eid, int argc, char **argv) dbfile = argv[0]; - ldb = ldb_wrap_connect(mprMemCtx(), mprLpCtx(), dbfile, + ldb = ldb_wrap_connect(mprMemCtx(), mprEventCtx(), mprLpCtx(), dbfile, session_info, creds, 0, (const char **)(argv+1)); if (ldb == NULL) { diff --git a/source4/scripting/ejs/smbcalls_reg.c b/source4/scripting/ejs/smbcalls_reg.c index e20d91ad2e..ed8653d3a7 100644 --- a/source4/scripting/ejs/smbcalls_reg.c +++ b/source4/scripting/ejs/smbcalls_reg.c @@ -70,7 +70,7 @@ static int ejs_reg_open(MprVarHandle eid, int argc, struct MprVar **argv) struct registry_context *rctx; WERROR error; - error = reg_open_samba(mprMemCtx(), &rctx, mprLpCtx(), NULL, NULL); + error = reg_open_samba(mprMemCtx(), &rctx, mprEventCtx(), mprLpCtx(), NULL, NULL); SMB_ASSERT(W_ERROR_IS_OK(error)); mprSetPtrChild(reg, "registry", rctx); diff --git a/source4/smb_server/smb/sesssetup.c b/source4/smb_server/smb/sesssetup.c index de2141b808..2c4068bda5 100644 --- a/source4/smb_server/smb/sesssetup.c +++ b/source4/smb_server/smb/sesssetup.c @@ -70,7 +70,7 @@ static void sesssetup_old_send(struct auth_check_password_request *areq, if (!NT_STATUS_IS_OK(status)) goto failed; /* This references server_info into session_info */ - status = auth_generate_session_info(req, req->smb_conn->lp_ctx, + status = auth_generate_session_info(req, req->smb_conn->connection->event.ctx, req->smb_conn->lp_ctx, server_info, &session_info); if (!NT_STATUS_IS_OK(status)) goto failed; @@ -166,7 +166,8 @@ static void sesssetup_nt1_send(struct auth_check_password_request *areq, if (!NT_STATUS_IS_OK(status)) goto failed; /* This references server_info into session_info */ - status = auth_generate_session_info(req, req->smb_conn->lp_ctx, + status = auth_generate_session_info(req, req->smb_conn->connection->event.ctx, + req->smb_conn->lp_ctx, server_info, &session_info); if (!NT_STATUS_IS_OK(status)) goto failed; diff --git a/source4/smb_server/smb_server.c b/source4/smb_server/smb_server.c index 4f8e628f74..367557dbb7 100644 --- a/source4/smb_server/smb_server.c +++ b/source4/smb_server/smb_server.c @@ -157,6 +157,7 @@ static void smbsrv_accept(struct stream_connection *conn) smbsrv_management_init(smb_conn); if (!NT_STATUS_IS_OK(share_get_context_by_name(smb_conn, lp_share_backend(smb_conn->lp_ctx), + smb_conn->connection->event.ctx, smb_conn->lp_ctx, &(smb_conn->share_context)))) { smbsrv_terminate_connection(smb_conn, "share_init failed!"); return; @@ -206,7 +207,7 @@ static void smbsrv_preopen_ldb(struct task_server *task) /* yes, this looks strange. It is a hack to preload the schema. I'd like to share most of the ldb context with the child too. That will come later */ - talloc_free(samdb_connect(task, task->lp_ctx, NULL)); + talloc_free(samdb_connect(task, task->event_ctx, task->lp_ctx, NULL)); } /* diff --git a/source4/torture/ldap/schema.c b/source4/torture/ldap/schema.c index 4cfce11eb5..8437e7f79d 100644 --- a/source4/torture/ldap/schema.c +++ b/source4/torture/ldap/schema.c @@ -376,7 +376,7 @@ bool torture_ldap_schema(struct torture_context *torture) url = talloc_asprintf(torture, "ldap://%s/", host); - ldb = ldb_wrap_connect(torture, torture->lp_ctx, url, + ldb = ldb_wrap_connect(torture, torture->ev, torture->lp_ctx, url, NULL, cmdline_credentials, 0, NULL); diff --git a/source4/torture/ldap/uptodatevector.c b/source4/torture/ldap/uptodatevector.c index cec330b2f6..87b7e09e13 100644 --- a/source4/torture/ldap/uptodatevector.c +++ b/source4/torture/ldap/uptodatevector.c @@ -162,7 +162,7 @@ bool torture_ldap_uptodatevector(struct torture_context *torture) url = talloc_asprintf(torture, "ldap://%s/", host); if (!url) goto failed; - ldb = ldb_wrap_connect(torture, torture->lp_ctx, url, + ldb = ldb_wrap_connect(torture, torture->ev, torture->lp_ctx, url, NULL, cmdline_credentials, 0, NULL); diff --git a/source4/torture/libnet/libnet_BecomeDC.c b/source4/torture/libnet/libnet_BecomeDC.c index 4d57a84582..bc92b4ebc2 100644 --- a/source4/torture/libnet/libnet_BecomeDC.c +++ b/source4/torture/libnet/libnet_BecomeDC.c @@ -322,7 +322,7 @@ static NTSTATUS test_apply_schema(struct test_become_dc_state *s, sam_ldb_path = talloc_asprintf(s, "%s/%s", s->targetdir, "private/sam.ldb"); DEBUG(0,("Reopen the SAM LDB with system credentials and a already stored schema: %s\n", sam_ldb_path)); - s->ldb = ldb_wrap_connect(s, s->tctx->lp_ctx, sam_ldb_path, + s->ldb = ldb_wrap_connect(s, s->tctx->ev, s->tctx->lp_ctx, sam_ldb_path, system_session(s, s->tctx->lp_ctx), NULL, 0, NULL); if (!s->ldb) { @@ -654,7 +654,7 @@ bool torture_net_become_dc(struct torture_context *torture) sam_ldb_path = talloc_asprintf(s, "%s/%s", s->targetdir, "private/sam.ldb"); DEBUG(0,("Reopen the SAM LDB with system credentials and all replicated data: %s\n", sam_ldb_path)); - s->ldb = ldb_wrap_connect(s, s->lp_ctx, sam_ldb_path, + s->ldb = ldb_wrap_connect(s, s->tctx->ev, s->lp_ctx, sam_ldb_path, system_session(s, s->lp_ctx), NULL, 0, NULL); if (!s->ldb) { diff --git a/source4/torture/local/dbspeed.c b/source4/torture/local/dbspeed.c index 34083cd204..bf88c00e35 100644 --- a/source4/torture/local/dbspeed.c +++ b/source4/torture/local/dbspeed.c @@ -176,7 +176,7 @@ static bool test_ldb_speed(struct torture_context *torture, const void *_data) torture_comment(torture, "Testing ldb speed for sidmap\n"); - ldb = ldb_wrap_connect(tmp_ctx, torture->lp_ctx, "tdb://test.ldb", + ldb = ldb_wrap_connect(tmp_ctx, torture->ev, torture->lp_ctx, "tdb://test.ldb", NULL, NULL, LDB_FLG_NOSYNC, NULL); if (!ldb) { unlink("./test.ldb"); diff --git a/source4/torture/ui.c b/source4/torture/ui.c index efa584ebea..abbd814747 100644 --- a/source4/torture/ui.c +++ b/source4/torture/ui.c @@ -578,6 +578,3 @@ struct torture_test *torture_tcase_add_simple_test(struct torture_tcase *tcase, return test; } - - - diff --git a/source4/winbind/idmap.c b/source4/winbind/idmap.c index 0c729825db..333a86445a 100644 --- a/source4/winbind/idmap.c +++ b/source4/winbind/idmap.c @@ -158,6 +158,7 @@ static struct dom_sid *idmap_msg_get_dom_sid(TALLOC_CTX *mem_ctx, * \return allocated idmap_context on success, NULL on error */ struct idmap_context *idmap_init(TALLOC_CTX *mem_ctx, + struct event_context *ev_ctx, struct loadparm_context *lp_ctx) { struct idmap_context *idmap_ctx; @@ -169,7 +170,7 @@ struct idmap_context *idmap_init(TALLOC_CTX *mem_ctx, idmap_ctx->lp_ctx = lp_ctx; - idmap_ctx->ldb_ctx = ldb_wrap_connect(mem_ctx, lp_ctx, + idmap_ctx->ldb_ctx = ldb_wrap_connect(mem_ctx, ev_ctx, lp_ctx, lp_idmap_url(lp_ctx), system_session(mem_ctx, lp_ctx), NULL, 0, NULL); diff --git a/source4/winbind/idmap.h b/source4/winbind/idmap.h index 6eae92cc68..13dbe0b921 100644 --- a/source4/winbind/idmap.h +++ b/source4/winbind/idmap.h @@ -31,6 +31,8 @@ struct idmap_context { struct dom_sid *unix_users_sid; }; +struct event_context; + #include "winbind/idmap_proto.h" #endif diff --git a/source4/winbind/wb_server.c b/source4/winbind/wb_server.c index 99191f3c6c..f84dece11c 100644 --- a/source4/winbind/wb_server.c +++ b/source4/winbind/wb_server.c @@ -149,7 +149,7 @@ static void winbind_task_init(struct task_server *task) return; } - service->idmap_ctx = idmap_init(service, task->lp_ctx); + service->idmap_ctx = idmap_init(service, task->event_ctx, task->lp_ctx); if (service->idmap_ctx == NULL) { task_server_terminate(task, "Failed to load idmap database"); return; diff --git a/source4/wrepl_server/wrepl_server.c b/source4/wrepl_server/wrepl_server.c index e750d9355a..b703066986 100644 --- a/source4/wrepl_server/wrepl_server.c +++ b/source4/wrepl_server/wrepl_server.c @@ -35,9 +35,10 @@ #include "lib/socket/netif.h" static struct ldb_context *wins_config_db_connect(TALLOC_CTX *mem_ctx, + struct event_context *ev_ctx, struct loadparm_context *lp_ctx) { - return ldb_wrap_connect(mem_ctx, lp_ctx, private_path(mem_ctx, + return ldb_wrap_connect(mem_ctx, ev_ctx, lp_ctx, private_path(mem_ctx, lp_ctx, lp_wins_config_url(lp_ctx)), system_session(mem_ctx, lp_ctx), NULL, 0, NULL); } @@ -83,12 +84,12 @@ static NTSTATUS wreplsrv_open_winsdb(struct wreplsrv_service *service, owner = iface_n_ip(ifaces, 0); } - service->wins_db = winsdb_connect(service, lp_ctx, owner, WINSDB_HANDLE_CALLER_WREPL); + service->wins_db = winsdb_connect(service, service->task->event_ctx, lp_ctx, owner, WINSDB_HANDLE_CALLER_WREPL); if (!service->wins_db) { return NT_STATUS_INTERNAL_DB_ERROR; } - service->config.ldb = wins_config_db_connect(service, lp_ctx); + service->config.ldb = wins_config_db_connect(service, service->task->event_ctx, lp_ctx); if (!service->config.ldb) { return NT_STATUS_INTERNAL_DB_ERROR; } -- cgit From 0197b8e0ff8dc26eeb71dccf61d8937c63bacff5 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 17 Apr 2008 13:04:04 +0200 Subject: Fix the build. (This used to be commit 5632fe8c61cfd7d69ebdc263dcb5740e72f25b95) --- source4/torture/rpc/schannel.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source4/torture/rpc/schannel.c b/source4/torture/rpc/schannel.c index 19b871f9c0..46605e53e6 100644 --- a/source4/torture/rpc/schannel.c +++ b/source4/torture/rpc/schannel.c @@ -270,7 +270,7 @@ static bool test_schannel(struct torture_context *tctx, * the second */ /* Swap the binding details from SAMR to NETLOGON */ - status = dcerpc_epm_map_binding(tctx, b, &ndr_table_netlogon, NULL, tctx->lp_ctx); + status = dcerpc_epm_map_binding(tctx, b, &ndr_table_netlogon, tctx->ev, tctx->lp_ctx); torture_assert_ntstatus_ok(tctx, status, "epm map"); status = dcerpc_secondary_connection(p, &p_netlogon, @@ -296,7 +296,7 @@ static bool test_schannel(struct torture_context *tctx, "Failed to process schannel secured NETLOGON EX ops"); /* Swap the binding details from SAMR to LSARPC */ - status = dcerpc_epm_map_binding(tctx, b, &ndr_table_lsarpc, NULL, tctx->lp_ctx); + status = dcerpc_epm_map_binding(tctx, b, &ndr_table_lsarpc, tctx->ev, tctx->lp_ctx); torture_assert_ntstatus_ok(tctx, status, "epm map"); status = dcerpc_secondary_connection(p, &p_lsa, @@ -337,7 +337,7 @@ static bool test_schannel(struct torture_context *tctx, "Failed to process schannel secured SAMR ops (on fresh connection)"); /* Swap the binding details from SAMR to NETLOGON */ - status = dcerpc_epm_map_binding(tctx, b, &ndr_table_netlogon, NULL, tctx->lp_ctx); + status = dcerpc_epm_map_binding(tctx, b, &ndr_table_netlogon, tctx->ev, tctx->lp_ctx); torture_assert_ntstatus_ok(tctx, status, "epm"); status = dcerpc_secondary_connection(p_samr2, &p_netlogon2, -- cgit From d7034765b765e6ac522aed6ab5d0f52b5a2ed033 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Thu, 17 Apr 2008 08:04:57 -0400 Subject: Add useful provisioning debugging options (This used to be commit 3f46eb95e47828ba1db236d584933c997cb0c170) --- source4/selftest/target/Samba4.pm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source4/selftest/target/Samba4.pm b/source4/selftest/target/Samba4.pm index 069aff73cf..9488ae3e04 100644 --- a/source4/selftest/target/Samba4.pm +++ b/source4/selftest/target/Samba4.pm @@ -695,6 +695,12 @@ nogroup:x:65534:nobody my @provision_options = (); push (@provision_options, "NSS_WRAPPER_PASSWD=\"$nsswrap_passwd\""); push (@provision_options, "NSS_WRAPPER_GROUP=\"$nsswrap_group\""); + if (defined($ENV{GDB_PROVISION})) { + push (@provision_options, "gdb --args"); + } + if (defined($ENV{VALGRIND_PROVISION})) { + push (@provision_options, "valgrind"); + } if (defined($ENV{PROVISION_EJS})) { push (@provision_options, "$self->{bindir}/smbscript"); push (@provision_options, "$self->{setupdir}/provision.js"); -- cgit From 0b4c401f06a69cafb663ba07ce6b2c7946c2c0fa Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 17 Apr 2008 14:20:46 +0200 Subject: Fix build not to always use code coverage. Somehow, the way this was structured before always did a gcov build. Andrew Bartlett (This used to be commit 052edb786418f161272a41025f8b6eee93bb433d) --- source4/torture/config.mk | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source4/torture/config.mk b/source4/torture/config.mk index c2ec7c573a..2f3fa38863 100644 --- a/source4/torture/config.mk +++ b/source4/torture/config.mk @@ -313,19 +313,21 @@ locktest_OBJ_FILES = torture/locktest.o MANPAGES += torture/man/locktest.1 +GCOV=0 + ifeq ($(MAKECMDGOALS),gcov) -GCOV?=1 +GCOV=1 endif ifeq ($(MAKECMDGOALS),lcov) -GCOV?=1 +GCOV=1 endif ifeq ($(MAKECMDGOALS),testcov-html) -GCOV?=1 +GCOV=1 endif -ifdef GCOV +ifeq ($(GCOV),1) CFLAGS += --coverage LDFLAGS += --coverage endif -- cgit From ca2e4a0e14a005843d19514d924e5adc924c5c5d Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 17 Apr 2008 14:23:50 +0200 Subject: Run samba3sam.js with bin/smbscript explicitly. Andrew Bartlett (This used to be commit 12fa30765361ed9b2e80951baa739ae4aba3fffe) --- source4/selftest/samba4_tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source4/selftest/samba4_tests.sh b/source4/selftest/samba4_tests.sh index 3b61a97459..725fde2c7d 100755 --- a/source4/selftest/samba4_tests.sh +++ b/source4/selftest/samba4_tests.sh @@ -288,7 +288,7 @@ done DATADIR=$samba4srcdir/../testdata -plantest "js.samba3sam" none $SCRIPTDIR/samba3sam.js $CONFIGURATION `pwd` $DATADIR/samba3/ +plantest "js.samba3sam" none $samba4bindir/smbscript $SCRIPTDIR/samba3sam.js $CONFIGURATION `pwd` $DATADIR/samba3/ # Domain Member Tests -- 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/cluster/ctdb/include/includes.h | 2 +- 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 +- source4/librpc/ndr/ndr_basic.c | 4 ++-- 7 files changed, 10 insertions(+), 9 deletions(-) diff --git a/source4/cluster/ctdb/include/includes.h b/source4/cluster/ctdb/include/includes.h index 48c3c2ea4c..0ed44cbad0 100644 --- a/source4/cluster/ctdb/include/includes.h +++ b/source4/cluster/ctdb/include/includes.h @@ -21,7 +21,7 @@ extern int LogLevel; #define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x)) #ifndef discard_const -#define discard_const(ptr) ((void *)((intptr_t)(ptr))) +#define discard_const(ptr) ((void *)((uintptr_t)(ptr))) #endif struct timeval timeval_zero(void); 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 */ diff --git a/source4/librpc/ndr/ndr_basic.c b/source4/librpc/ndr/ndr_basic.c index 93a177f94e..1d2b47c850 100644 --- a/source4/librpc/ndr/ndr_basic.c +++ b/source4/librpc/ndr/ndr_basic.c @@ -196,7 +196,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_hyper(struct ndr_pull *ndr, int ndr_flags, u */ _PUBLIC_ enum ndr_err_code ndr_pull_pointer(struct ndr_pull *ndr, int ndr_flags, void* *v) { - intptr_t h; + uintptr_t h; NDR_PULL_ALIGN(ndr, sizeof(h)); NDR_PULL_NEED_BYTES(ndr, sizeof(h)); memcpy(&h, ndr->data+ndr->offset, sizeof(h)); @@ -393,7 +393,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_hyper(struct ndr_push *ndr, int ndr_flags, u */ _PUBLIC_ enum ndr_err_code ndr_push_pointer(struct ndr_push *ndr, int ndr_flags, void* v) { - intptr_t h = (intptr_t)v; + uintptr_t h = (intptr_t)v; NDR_PUSH_ALIGN(ndr, sizeof(h)); NDR_PUSH_NEED_BYTES(ndr, sizeof(h)); memcpy(ndr->data+ndr->offset, &h, sizeof(h)); -- cgit From 2a02f4dcabdabbf7ef6b5b9b77fc69cd39baa79c Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 17 Apr 2008 14:51:30 +0200 Subject: Fix samba3sam test. sAMAccountType is blocked by the samldb module. Andrew Bartlett (This used to be commit d15ca7e38ba6cc39ab16aa52cdd071be922c9903) --- testdata/samba3/provision_samba3sam_templates.ldif | 5 ----- 1 file changed, 5 deletions(-) diff --git a/testdata/samba3/provision_samba3sam_templates.ldif b/testdata/samba3/provision_samba3sam_templates.ldif index 368c78d727..4fe6571eef 100644 --- a/testdata/samba3/provision_samba3sam_templates.ldif +++ b/testdata/samba3/provision_samba3sam_templates.ldif @@ -33,7 +33,6 @@ pwdLastSet: 0 primaryGroupID: 513 accountExpires: -1 logonCount: 0 -sAMAccountType: 805306368 objectCategory: CN=Person,CN=Schema,CN=Configuration,${BASEDN} dn: CN=TemplateComputer,CN=Templates @@ -55,7 +54,6 @@ pwdLastSet: 0 primaryGroupID: 513 accountExpires: -1 logonCount: 0 -sAMAccountType: 805306369 objectCategory: CN=Computer,CN=Schema,CN=Configuration,${BASEDN} dn: CN=TemplateTrustingDomain,CN=Templates @@ -74,7 +72,6 @@ lastLogon: 0 primaryGroupID: 513 accountExpires: -1 logonCount: 0 -sAMAccountType: 805306370 dn: CN=TemplateGroup,CN=Templates objectClass: top @@ -83,7 +80,6 @@ objectClass: groupTemplate cn: TemplateGroup instanceType: 4 groupType: -2147483646 -sAMAccountType: 268435456 objectCategory: CN=Group,CN=Schema,CN=Configuration,${BASEDN} # Currently this isn't used, we don't have a way to detect it different from an incoming alias @@ -95,7 +91,6 @@ objectCategory: CN=Group,CN=Schema,CN=Configuration,${BASEDN} # cn: TemplateAlias # instanceType: 4 # groupType: -2147483644 -# sAMAccountType: 268435456 dn: CN=TemplateForeignSecurityPrincipal,CN=Templates objectClass: top -- cgit From ef457187b4372f039f84fbb4f6e4f0fcffd67b5b Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 17 Apr 2008 14:59:16 +0200 Subject: Don't exclude all tests mentioning 'samba3', but only those actually specific. Andrew Bartlett (This used to be commit a38f413c557f3c85a5524607c69e9085a8289f47) --- source4/samba4-skip | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source4/samba4-skip b/source4/samba4-skip index f4330b9c03..8d86cdb98c 100644 --- a/source4/samba4-skip +++ b/source4/samba4-skip @@ -38,7 +38,12 @@ rpc.initshutdown # Not provided by Samba 4 rpc.svcctl # Not provided by Samba 4 rpc.atsvc # Not provided by Samba 4 rpc.frsapi # Not provided by Samba 4 -.*samba3.* # Samba3-specific test +^samba4.base.samba3.* # Samba3-specific test +^samba4.ntvfs.cifs.base.samba3.* # Samba3-specific test +^samba4.raw.samba3.* # Samba3-specific test +^samba4.ntvfs.cifs.raw.samba3.* # Samba3-specific test +samba4.ntvfs.cifs.raw. +^samba4.rpc..*samba3.* # Samba3-specific test ^samba4.net.domopen.*$ # Hangs for some reason ^samba4.net.api.become.dc.*$ # Fails nss.test # Fails -- cgit From 11703b298685c9984a6a3c3a64eddb8a1a516b90 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 17 Apr 2008 15:20:39 +0200 Subject: fix the overflow/wrap checks in Samba4 for new gcc optimisation behavior The approach I have used is as set out in https://www.securecoding.cert.org/confluence/display/seccode/ARR38-C.+Do+not+add+or+subtract+an+integer+to+a+pointer+if+the+resulting+value+does+not+refer+to+an+element+within+the+array (This used to be commit 92d5fb531db39be655f0cbd2d75b5f675a0a4cfa) --- source4/libcli/raw/rawrequest.c | 6 +++--- source4/libcli/raw/rawtrans.c | 6 +++--- source4/libcli/smb2/request.c | 8 ++++---- source4/smb_server/smb/request.c | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/source4/libcli/raw/rawrequest.c b/source4/libcli/raw/rawrequest.c index a42c710547..ef856c6ea1 100644 --- a/source4/libcli/raw/rawrequest.c +++ b/source4/libcli/raw/rawrequest.c @@ -700,10 +700,10 @@ DATA_BLOB smbcli_req_pull_blob(struct request_bufinfo *bufinfo, TALLOC_CTX *mem_ static bool smbcli_req_data_oob(struct request_bufinfo *bufinfo, const uint8_t *ptr, uint32_t count) { /* be careful with wraparound! */ - if (ptr < bufinfo->data || - ptr >= bufinfo->data + bufinfo->data_size || + if ((uintptr_t)ptr < (uintptr_t)bufinfo->data || + (uintptr_t)ptr >= (uintptr_t)bufinfo->data + bufinfo->data_size || count > bufinfo->data_size || - ptr + count > bufinfo->data + bufinfo->data_size) { + (uintptr_t)ptr + count > (uintptr_t)bufinfo->data + bufinfo->data_size) { return true; } return false; diff --git a/source4/libcli/raw/rawtrans.c b/source4/libcli/raw/rawtrans.c index 29881afd2b..0f15b2151b 100644 --- a/source4/libcli/raw/rawtrans.c +++ b/source4/libcli/raw/rawtrans.c @@ -40,10 +40,10 @@ static bool raw_trans_oob(struct smbcli_request *req, ptr = req->in.hdr + offset; /* be careful with wraparound! */ - if (ptr < req->in.data || - ptr >= req->in.data + req->in.data_size || + if ((uintptr_t)ptr < (uintptr_t)req->in.data || + (uintptr_t)ptr >= (uintptr_t)req->in.data + req->in.data_size || count > req->in.data_size || - ptr + count > req->in.data + req->in.data_size) { + (uintptr_t)ptr + count > (uintptr_t)req->in.data + req->in.data_size) { return true; } return false; diff --git a/source4/libcli/smb2/request.c b/source4/libcli/smb2/request.c index 2471fcaa4d..f52b0ceef2 100644 --- a/source4/libcli/smb2/request.c +++ b/source4/libcli/smb2/request.c @@ -211,10 +211,10 @@ bool smb2_oob(struct smb2_request_buffer *buf, const uint8_t *ptr, size_t size) return false; } /* be careful with wraparound! */ - if (ptr < buf->body || - ptr >= buf->body + buf->body_size || + if ((uintptr_t)ptr < (uintptr_t)buf->body || + (uintptr_t)ptr >= (uintptr_t)buf->body + buf->body_size || size > buf->body_size || - ptr + size > buf->body + buf->body_size) { + (uintptr_t)ptr + size > (uintptr_t)buf->body + buf->body_size) { return true; } return false; @@ -669,7 +669,7 @@ NTSTATUS smb2_push_o16s16_string(struct smb2_request_buffer *buf, } if (*str == 0) { - blob.data = str; + blob.data = discard_const(str); blob.length = 0; return smb2_push_o16s16_blob(buf, ofs, blob); } diff --git a/source4/smb_server/smb/request.c b/source4/smb_server/smb/request.c index 87073517dd..c7fa2d7d8a 100644 --- a/source4/smb_server/smb/request.c +++ b/source4/smb_server/smb/request.c @@ -651,10 +651,10 @@ bool req_data_oob(struct request_bufinfo *bufinfo, const uint8_t *ptr, uint32_t } /* be careful with wraparound! */ - if (ptr < bufinfo->data || - ptr >= bufinfo->data + bufinfo->data_size || + if ((uintptr_t)ptr < (uintptr_t)bufinfo->data || + (uintptr_t)ptr >= (uintptr_t)bufinfo->data + bufinfo->data_size || count > bufinfo->data_size || - ptr + count > bufinfo->data + bufinfo->data_size) { + (uintptr_t)ptr + count > (uintptr_t)bufinfo->data + bufinfo->data_size) { return true; } return false; -- 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(-) 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 aa51981e9916bf8d145001e4ad592efd53527dfe Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 17 Apr 2008 15:01:45 +0200 Subject: libndr: add dom_sid0 type that can later be used for CLDAP and MAILSLOT ntlogon packets metze (This used to be commit 690c12cd2afd0fba626576fbae3f28ffdae63be2) --- source4/librpc/idl/security.idl | 3 +++ source4/librpc/ndr/libndr.h | 4 +++ source4/librpc/ndr/ndr_sec_helper.c | 51 +++++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+) diff --git a/source4/librpc/idl/security.idl b/source4/librpc/idl/security.idl index 753fad85cf..314846c53f 100644 --- a/source4/librpc/idl/security.idl +++ b/source4/librpc/idl/security.idl @@ -22,6 +22,9 @@ cpp_quote("#define dom_sid2 dom_sid") /* same struct as dom_sid but inside a 28 bytes fixed buffer in NDR */ cpp_quote("#define dom_sid28 dom_sid") +/* same struct as dom_sid but in a variable byte buffer, which is maybe empty in NDR */ +cpp_quote("#define dom_sid0 dom_sid") + [ pointer_default(unique) ] diff --git a/source4/librpc/ndr/libndr.h b/source4/librpc/ndr/libndr.h index 2439c386db..b719be2bab 100644 --- a/source4/librpc/ndr/libndr.h +++ b/source4/librpc/ndr/libndr.h @@ -336,6 +336,10 @@ enum ndr_err_code ndr_push_dom_sid28(struct ndr_push *ndr, int ndr_flags, const enum ndr_err_code ndr_pull_dom_sid28(struct ndr_pull *ndr, int ndr_flags, struct dom_sid *sid); void ndr_print_dom_sid28(struct ndr_print *ndr, const char *name, const struct dom_sid *sid); size_t ndr_size_dom_sid28(const struct dom_sid *sid, int flags); +enum ndr_err_code ndr_push_dom_sid0(struct ndr_push *ndr, int ndr_flags, const struct dom_sid *sid); +enum ndr_err_code ndr_pull_dom_sid0(struct ndr_pull *ndr, int ndr_flags, struct dom_sid *sid); +void ndr_print_dom_sid0(struct ndr_print *ndr, const char *name, const struct dom_sid *sid); +size_t ndr_size_dom_sid0(const struct dom_sid *sid, int flags); void ndr_print_ipv4_addr(struct ndr_print *ndr, const char *name, const struct in_addr *_ip); void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID *guid); enum ndr_err_code ndr_push_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, const void *p, ndr_push_flags_fn_t fn); diff --git a/source4/librpc/ndr/ndr_sec_helper.c b/source4/librpc/ndr/ndr_sec_helper.c index 5a0178bd25..1256d7dd2d 100644 --- a/source4/librpc/ndr/ndr_sec_helper.c +++ b/source4/librpc/ndr/ndr_sec_helper.c @@ -48,6 +48,11 @@ size_t ndr_size_dom_sid28(const struct dom_sid *sid, int flags) return 8 + 4*sid->num_auths; } +size_t ndr_size_dom_sid0(const struct dom_sid *sid, int flags) +{ + return ndr_size_dom_sid28(sid, flags); +} + /* return the wire size of a security_ace */ @@ -128,6 +133,11 @@ void ndr_print_dom_sid28(struct ndr_print *ndr, const char *name, const struct d ndr_print_dom_sid(ndr, name, sid); } +void ndr_print_dom_sid0(struct ndr_print *ndr, const char *name, const struct dom_sid *sid) +{ + ndr_print_dom_sid(ndr, name, sid); +} + /* parse a dom_sid2 - this is a dom_sid but with an extra copy of the num_auths field @@ -225,3 +235,44 @@ enum ndr_err_code ndr_push_dom_sid28(struct ndr_push *ndr, int ndr_flags, const return NDR_ERR_SUCCESS; } +/* + parse a dom_sid0 - this is a dom_sid in a variable byte buffer, which is maybe empty +*/ +enum ndr_err_code ndr_pull_dom_sid0(struct ndr_pull *ndr, int ndr_flags, struct dom_sid *sid) +{ + if (!(ndr_flags & NDR_SCALARS)) { + return NDR_ERR_SUCCESS; + } + + if (ndr->data_size == ndr->offset) { + ZERO_STRUCTP(sid); + return NDR_ERR_SUCCESS; + } + + return ndr_pull_dom_sid(ndr, ndr_flags, sid); +} + +/* + push a dom_sid0 - this is a dom_sid in a variable byte buffer, which is maybe empty +*/ +enum ndr_err_code ndr_push_dom_sid0(struct ndr_push *ndr, int ndr_flags, const struct dom_sid *sid) +{ + struct dom_sid zero_sid; + + if (!(ndr_flags & NDR_SCALARS)) { + return NDR_ERR_SUCCESS; + } + + if (!sid) { + return NDR_ERR_SUCCESS; + } + + ZERO_STRUCT(zero_sid); + + if (memcmp(&zero_sid, sid, sizeof(zero_sid)) == 0) { + return NDR_ERR_SUCCESS; + } + + return ndr_push_dom_sid(ndr, ndr_flags, sid); +} + -- cgit From e0fe8613a3621e7a1e0488f6698db56ef6c67dd9 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 17 Apr 2008 16:26:59 +0200 Subject: nbt.idl: fix parsing und pushing of dom_sids by using dom_sid0 metze (This used to be commit 0e2f6d481b3e35ed392b2b3340b244c77593819c) --- source4/librpc/idl/nbt.idl | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/source4/librpc/idl/nbt.idl b/source4/librpc/idl/nbt.idl index aa88360882..dddfa4e1ce 100644 --- a/source4/librpc/idl/nbt.idl +++ b/source4/librpc/idl/nbt.idl @@ -440,9 +440,8 @@ interface nbt nstring unicode_domain; uint32 db_count; nbt_db_change dbchange[db_count]; - [value(ndr_size_dom_sid(&sid, ndr->flags))] uint32 sid_size; - [flag(NDR_ALIGN4)] DATA_BLOB _pad2; - dom_sid sid; + [value(ndr_size_dom_sid0(&sid, ndr->flags))] uint32 sid_size; + [subcontext(0),subcontext_size(sid_size)] dom_sid0 sid; uint32 nt_version; uint16 lmnt_token; uint16 lm20_token; @@ -560,9 +559,8 @@ interface nbt nstring user_name; astring mailslot_name; uint32 acct_control; - [value(ndr_size_dom_sid(&sid, ndr->flags))] uint32 sid_size; - [flag(NDR_ALIGN4)] DATA_BLOB _pad; - dom_sid sid; + [value(ndr_size_dom_sid0(&sid, ndr->flags))] uint32 sid_size; + [subcontext(0),subcontext_size(sid_size)] dom_sid0 sid; uint32 nt_version; uint16 lmnt_token; uint16 lm20_token; -- 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(-) 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(-) 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(-) 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 bfbcfc41f55c7a428ee89f67d739bb3d1028507d Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 18 Apr 2008 11:37:43 +0200 Subject: Fix samba3 protocol to correctly include the NULL terminator Andrew Bartlett (This used to be commit fa459913039673e55aa9300962f01e5079dd20d8) --- source4/winbind/wb_samba3_cmd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source4/winbind/wb_samba3_cmd.c b/source4/winbind/wb_samba3_cmd.c index f43947e79a..f0aaaa7778 100644 --- a/source4/winbind/wb_samba3_cmd.c +++ b/source4/winbind/wb_samba3_cmd.c @@ -720,6 +720,9 @@ static void list_users_recv(struct composite_context *ctx) if (NT_STATUS_IS_OK(status)) { s3call->response.extra_data.data = extra_data; s3call->response.length += extra_data_len; + if (extra_data) { + s3call->response.length += 1; + } } wbsrv_samba3_async_epilogue(status, s3call); -- cgit From 6a40411fcc7af4c93443b6c55360e22d18bcb236 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 18 Apr 2008 15:41:54 +0200 Subject: change the default idmap range to 3M -> 4M This gives us a lot more headroom, and means that we have a lower chance of running into real local users (This used to be commit b2dac6645c3bce45ab2178b9f5b4e017486b5b8e) --- source4/setup/idmap_init.ldif | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source4/setup/idmap_init.ldif b/source4/setup/idmap_init.ldif index a397cfd0d2..43e5b65562 100644 --- a/source4/setup/idmap_init.ldif +++ b/source4/setup/idmap_init.ldif @@ -1,5 +1,4 @@ dn: CN=CONFIG cn: CONFIG -lowerBound: 10000 -upperBound: 20000 - +lowerBound: 3000000 +upperBound: 4000000 -- cgit From 93c9de03afd907015108bbb53bd8453da3cc8115 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 18 Apr 2008 16:23:48 +0200 Subject: fixed a double free in winbind state->domain->netlogon_binding is a child of ctx, and ctx is freed by the composite_is_ok failure callback (This used to be commit 3c217518ba9a7b64fe6c842187499f1ee5189567) --- source4/winbind/wb_init_domain.c | 1 - 1 file changed, 1 deletion(-) diff --git a/source4/winbind/wb_init_domain.c b/source4/winbind/wb_init_domain.c index c1325bfe09..8b82ab711e 100644 --- a/source4/winbind/wb_init_domain.c +++ b/source4/winbind/wb_init_domain.c @@ -209,7 +209,6 @@ static void init_domain_recv_netlogonpipe(struct composite_context *ctx) &state->domain->netlogon_pipe); if (!composite_is_ok(state->ctx)) { - talloc_free(state->domain->netlogon_binding); return; } talloc_steal(state->domain->netlogon_pipe, state->domain->netlogon_binding); -- cgit From 908d8daa213ecc9b3207d0573e9688ef0939b8f6 Mon Sep 17 00:00:00 2001 From: Amin Azez Date: Mon, 10 Mar 2008 10:03:38 +0000 Subject: Re-order smbsrv_recv_smb_request and smb_messages No functional change, just re-ordering so that smbsrv_recv_smb_request can refer to smb_messages in a future patch (This used to be commit d06eafea1a3e7fa61c94492cf504e6fd81da861d) --- source4/smb_server/smb/receive.c | 198 +++++++++++++++++++-------------------- 1 file changed, 99 insertions(+), 99 deletions(-) diff --git a/source4/smb_server/smb/receive.c b/source4/smb_server/smb/receive.c index e3d247cbc0..b11682d158 100644 --- a/source4/smb_server/smb/receive.c +++ b/source4/smb_server/smb/receive.c @@ -65,105 +65,6 @@ NTSTATUS smbsrv_send_oplock_break(void *p, struct ntvfs_handle *ntvfs, uint8_t l static void switch_message(int type, struct smbsrv_request *req); -/**************************************************************************** -receive a SMB request header from the wire, forming a request_context -from the result -****************************************************************************/ -NTSTATUS smbsrv_recv_smb_request(void *private, DATA_BLOB blob) -{ - struct smbsrv_connection *smb_conn = talloc_get_type(private, struct smbsrv_connection); - struct smbsrv_request *req; - struct timeval cur_time = timeval_current(); - uint8_t command; - - smb_conn->statistics.last_request_time = cur_time; - - /* see if its a special NBT packet */ - if (CVAL(blob.data, 0) != 0) { - req = smbsrv_init_request(smb_conn); - NT_STATUS_HAVE_NO_MEMORY(req); - - ZERO_STRUCT(req->in); - - req->in.buffer = talloc_steal(req, blob.data); - req->in.size = blob.length; - req->request_time = cur_time; - - smbsrv_reply_special(req); - return NT_STATUS_OK; - } - - if ((NBT_HDR_SIZE + MIN_SMB_SIZE) > blob.length) { - DEBUG(2,("Invalid SMB packet: length %ld\n", (long)blob.length)); - smbsrv_terminate_connection(smb_conn, "Invalid SMB packet"); - return NT_STATUS_OK; - } - - /* Make sure this is an SMB packet */ - if (IVAL(blob.data, NBT_HDR_SIZE) != SMB_MAGIC) { - DEBUG(2,("Non-SMB packet of length %ld. Terminating connection\n", - (long)blob.length)); - smbsrv_terminate_connection(smb_conn, "Non-SMB packet"); - return NT_STATUS_OK; - } - - req = smbsrv_init_request(smb_conn); - NT_STATUS_HAVE_NO_MEMORY(req); - - req->in.buffer = talloc_steal(req, blob.data); - req->in.size = blob.length; - req->request_time = cur_time; - req->chained_fnum = -1; - req->in.allocated = req->in.size; - req->in.hdr = req->in.buffer + NBT_HDR_SIZE; - req->in.vwv = req->in.hdr + HDR_VWV; - req->in.wct = CVAL(req->in.hdr, HDR_WCT); - if (req->in.vwv + VWV(req->in.wct) <= req->in.buffer + req->in.size) { - req->in.data = req->in.vwv + VWV(req->in.wct) + 2; - req->in.data_size = SVAL(req->in.vwv, VWV(req->in.wct)); - - /* the bcc length is only 16 bits, but some packets - (such as SMBwriteX) can be much larger than 64k. We - detect this by looking for a large non-chained NBT - packet (at least 64k bigger than what is - specified). If it is detected then the NBT size is - used instead of the bcc size */ - if (req->in.data_size + 0x10000 <= - req->in.size - PTR_DIFF(req->in.data, req->in.buffer) && - (req->in.wct < 1 || SVAL(req->in.vwv, VWV(0)) == SMB_CHAIN_NONE)) { - /* its an oversized packet! fun for all the family */ - req->in.data_size = req->in.size - PTR_DIFF(req->in.data,req->in.buffer); - } - } - - if (NBT_HDR_SIZE + MIN_SMB_SIZE + 2*req->in.wct > req->in.size) { - DEBUG(2,("Invalid SMB word count %d\n", req->in.wct)); - smbsrv_terminate_connection(req->smb_conn, "Invalid SMB packet"); - return NT_STATUS_OK; - } - - if (NBT_HDR_SIZE + MIN_SMB_SIZE + 2*req->in.wct + req->in.data_size > req->in.size) { - DEBUG(2,("Invalid SMB buffer length count %d\n", - (int)req->in.data_size)); - smbsrv_terminate_connection(req->smb_conn, "Invalid SMB packet"); - return NT_STATUS_OK; - } - - req->flags2 = SVAL(req->in.hdr, HDR_FLG2); - - /* fix the bufinfo */ - smbsrv_setup_bufinfo(req); - - if (!smbsrv_signing_check_incoming(req)) { - smbsrv_send_error(req, NT_STATUS_ACCESS_DENIED); - return NT_STATUS_OK; - } - - command = CVAL(req->in.hdr, HDR_COM); - switch_message(command, req); - return NT_STATUS_OK; -} - /* These flags determine some of the permissions required to do an operation */ @@ -441,6 +342,105 @@ static const struct smb_message_struct /* 0xff */ { NULL, NULL, 0 } }; +/**************************************************************************** +receive a SMB request header from the wire, forming a request_context +from the result +****************************************************************************/ +NTSTATUS smbsrv_recv_smb_request(void *private, DATA_BLOB blob) +{ + struct smbsrv_connection *smb_conn = talloc_get_type(private, struct smbsrv_connection); + struct smbsrv_request *req; + struct timeval cur_time = timeval_current(); + uint8_t command; + + smb_conn->statistics.last_request_time = cur_time; + + /* see if its a special NBT packet */ + if (CVAL(blob.data, 0) != 0) { + req = smbsrv_init_request(smb_conn); + NT_STATUS_HAVE_NO_MEMORY(req); + + ZERO_STRUCT(req->in); + + req->in.buffer = talloc_steal(req, blob.data); + req->in.size = blob.length; + req->request_time = cur_time; + + smbsrv_reply_special(req); + return NT_STATUS_OK; + } + + if ((NBT_HDR_SIZE + MIN_SMB_SIZE) > blob.length) { + DEBUG(2,("Invalid SMB packet: length %ld\n", (long)blob.length)); + smbsrv_terminate_connection(smb_conn, "Invalid SMB packet"); + return NT_STATUS_OK; + } + + /* Make sure this is an SMB packet */ + if (IVAL(blob.data, NBT_HDR_SIZE) != SMB_MAGIC) { + DEBUG(2,("Non-SMB packet of length %ld. Terminating connection\n", + (long)blob.length)); + smbsrv_terminate_connection(smb_conn, "Non-SMB packet"); + return NT_STATUS_OK; + } + + req = smbsrv_init_request(smb_conn); + NT_STATUS_HAVE_NO_MEMORY(req); + + req->in.buffer = talloc_steal(req, blob.data); + req->in.size = blob.length; + req->request_time = cur_time; + req->chained_fnum = -1; + req->in.allocated = req->in.size; + req->in.hdr = req->in.buffer + NBT_HDR_SIZE; + req->in.vwv = req->in.hdr + HDR_VWV; + req->in.wct = CVAL(req->in.hdr, HDR_WCT); + if (req->in.vwv + VWV(req->in.wct) <= req->in.buffer + req->in.size) { + req->in.data = req->in.vwv + VWV(req->in.wct) + 2; + req->in.data_size = SVAL(req->in.vwv, VWV(req->in.wct)); + + /* the bcc length is only 16 bits, but some packets + (such as SMBwriteX) can be much larger than 64k. We + detect this by looking for a large non-chained NBT + packet (at least 64k bigger than what is + specified). If it is detected then the NBT size is + used instead of the bcc size */ + if (req->in.data_size + 0x10000 <= + req->in.size - PTR_DIFF(req->in.data, req->in.buffer) && + (req->in.wct < 1 || SVAL(req->in.vwv, VWV(0)) == SMB_CHAIN_NONE)) { + /* its an oversized packet! fun for all the family */ + req->in.data_size = req->in.size - PTR_DIFF(req->in.data,req->in.buffer); + } + } + + if (NBT_HDR_SIZE + MIN_SMB_SIZE + 2*req->in.wct > req->in.size) { + DEBUG(2,("Invalid SMB word count %d\n", req->in.wct)); + smbsrv_terminate_connection(req->smb_conn, "Invalid SMB packet"); + return NT_STATUS_OK; + } + + if (NBT_HDR_SIZE + MIN_SMB_SIZE + 2*req->in.wct + req->in.data_size > req->in.size) { + DEBUG(2,("Invalid SMB buffer length count %d\n", + (int)req->in.data_size)); + smbsrv_terminate_connection(req->smb_conn, "Invalid SMB packet"); + return NT_STATUS_OK; + } + + req->flags2 = SVAL(req->in.hdr, HDR_FLG2); + + /* fix the bufinfo */ + smbsrv_setup_bufinfo(req); + + if (!smbsrv_signing_check_incoming(req)) { + smbsrv_send_error(req, NT_STATUS_ACCESS_DENIED); + return NT_STATUS_OK; + } + + command = CVAL(req->in.hdr, HDR_COM); + switch_message(command, req); + return NT_STATUS_OK; +} + /**************************************************************************** return a string containing the function name of a SMB command ****************************************************************************/ -- cgit From b3f974076424415014ea9bd52edcd32618e4bfb2 Mon Sep 17 00:00:00 2001 From: Amin Azez Date: Mon, 10 Mar 2008 10:06:12 +0000 Subject: Flag smb messages array with AND_X and LARGE_REQUEST If smb_messages flags show for which opcodes VWV(0) signifies chaining modes, and also which opcodes can have requests >64K then the bcc / req->in.data_size fixup in smbsrv_recv_smb_request can be more safely applied. This fix permits nttrans requests >64K to be handled. It is not yet clear if THAT is a good thing, but this fix does the current thing more nicely. (This used to be commit 8e4f16e975e192709f398c98650cbe9fe2a76261) --- source4/smb_server/smb/receive.c | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/source4/smb_server/smb/receive.c b/source4/smb_server/smb/receive.c index b11682d158..6cf33cf7c3 100644 --- a/source4/smb_server/smb/receive.c +++ b/source4/smb_server/smb/receive.c @@ -71,6 +71,10 @@ static void switch_message(int type, struct smbsrv_request *req); #define NEED_SESS (1<<0) #define NEED_TCON (1<<1) #define SIGNING_NO_REPLY (1<<2) +/* does VWV(0) of the request hold chaining information */ +#define AND_X (1<<3) +/* The 64Kb question: are requests > 64K valid? */ +#define LARGE_REQUEST (1<<4) /* define a list of possible SMB messages and their corresponding @@ -81,6 +85,7 @@ static const struct smb_message_struct { const char *name; void (*fn)(struct smbsrv_request *); +#define message_flags(type) smb_messages[(type) & 0xff].flags int flags; } smb_messages[256] = { @@ -120,7 +125,7 @@ static const struct smb_message_struct /* 0x21 */ { NULL, NULL, 0 }, /* 0x22 */ { "SMBsetattrE", smbsrv_reply_setattrE, NEED_SESS|NEED_TCON }, /* 0x23 */ { "SMBgetattrE", smbsrv_reply_getattrE, NEED_SESS|NEED_TCON }, -/* 0x24 */ { "SMBlockingX", smbsrv_reply_lockingX, NEED_SESS|NEED_TCON }, +/* 0x24 */ { "SMBlockingX", smbsrv_reply_lockingX, NEED_SESS|NEED_TCON|AND_X }, /* 0x25 */ { "SMBtrans", smbsrv_reply_trans, NEED_SESS|NEED_TCON }, /* 0x26 */ { "SMBtranss", smbsrv_reply_transs, NEED_SESS|NEED_TCON }, /* 0x27 */ { "SMBioctl", smbsrv_reply_ioctl, NEED_SESS|NEED_TCON }, @@ -129,9 +134,9 @@ static const struct smb_message_struct /* 0x2a */ { "SMBmove", NULL, NEED_SESS|NEED_TCON }, /* 0x2b */ { "SMBecho", smbsrv_reply_echo, 0 }, /* 0x2c */ { "SMBwriteclose", smbsrv_reply_writeclose, NEED_SESS|NEED_TCON }, -/* 0x2d */ { "SMBopenX", smbsrv_reply_open_and_X, NEED_SESS|NEED_TCON }, -/* 0x2e */ { "SMBreadX", smbsrv_reply_read_and_X, NEED_SESS|NEED_TCON }, -/* 0x2f */ { "SMBwriteX", smbsrv_reply_write_and_X, NEED_SESS|NEED_TCON}, +/* 0x2d */ { "SMBopenX", smbsrv_reply_open_and_X, NEED_SESS|NEED_TCON|AND_X }, +/* 0x2e */ { "SMBreadX", smbsrv_reply_read_and_X, NEED_SESS|NEED_TCON|AND_X }, +/* 0x2f */ { "SMBwriteX", smbsrv_reply_write_and_X, NEED_SESS|NEED_TCON|AND_X|LARGE_REQUEST}, /* 0x30 */ { NULL, NULL, 0 }, /* 0x31 */ { NULL, NULL, 0 }, /* 0x32 */ { "SMBtrans2", smbsrv_reply_trans2, NEED_SESS|NEED_TCON }, @@ -199,9 +204,9 @@ static const struct smb_message_struct /* 0x70 */ { "SMBtcon", smbsrv_reply_tcon, NEED_SESS }, /* 0x71 */ { "SMBtdis", smbsrv_reply_tdis, NEED_TCON }, /* 0x72 */ { "SMBnegprot", smbsrv_reply_negprot, 0 }, -/* 0x73 */ { "SMBsesssetupX", smbsrv_reply_sesssetup, 0 }, -/* 0x74 */ { "SMBulogoffX", smbsrv_reply_ulogoffX, NEED_SESS }, /* ulogoff doesn't give a valid TID */ -/* 0x75 */ { "SMBtconX", smbsrv_reply_tcon_and_X, NEED_SESS }, +/* 0x73 */ { "SMBsesssetupX", smbsrv_reply_sesssetup, AND_X }, +/* 0x74 */ { "SMBulogoffX", smbsrv_reply_ulogoffX, NEED_SESS|AND_X }, /* ulogoff doesn't give a valid TID */ +/* 0x75 */ { "SMBtconX", smbsrv_reply_tcon_and_X, NEED_SESS|AND_X }, /* 0x76 */ { NULL, NULL, 0 }, /* 0x77 */ { NULL, NULL, 0 }, /* 0x78 */ { NULL, NULL, 0 }, @@ -244,9 +249,9 @@ static const struct smb_message_struct /* 0x9d */ { NULL, NULL, 0 }, /* 0x9e */ { NULL, NULL, 0 }, /* 0x9f */ { NULL, NULL, 0 }, -/* 0xa0 */ { "SMBnttrans", smbsrv_reply_nttrans, NEED_SESS|NEED_TCON }, +/* 0xa0 */ { "SMBnttrans", smbsrv_reply_nttrans, NEED_SESS|NEED_TCON|LARGE_REQUEST }, /* 0xa1 */ { "SMBnttranss", smbsrv_reply_nttranss, NEED_SESS|NEED_TCON }, -/* 0xa2 */ { "SMBntcreateX", smbsrv_reply_ntcreate_and_X, NEED_SESS|NEED_TCON }, +/* 0xa2 */ { "SMBntcreateX", smbsrv_reply_ntcreate_and_X, NEED_SESS|NEED_TCON|AND_X }, /* 0xa3 */ { NULL, NULL, 0 }, /* 0xa4 */ { "SMBntcancel", smbsrv_reply_ntcancel, NEED_SESS|NEED_TCON|SIGNING_NO_REPLY }, /* 0xa5 */ { "SMBntrename", smbsrv_reply_ntrename, NEED_SESS|NEED_TCON }, @@ -395,6 +400,9 @@ NTSTATUS smbsrv_recv_smb_request(void *private, DATA_BLOB blob) req->in.hdr = req->in.buffer + NBT_HDR_SIZE; req->in.vwv = req->in.hdr + HDR_VWV; req->in.wct = CVAL(req->in.hdr, HDR_WCT); + + command = CVAL(req->in.hdr, HDR_COM); + if (req->in.vwv + VWV(req->in.wct) <= req->in.buffer + req->in.size) { req->in.data = req->in.vwv + VWV(req->in.wct) + 2; req->in.data_size = SVAL(req->in.vwv, VWV(req->in.wct)); @@ -407,7 +415,10 @@ NTSTATUS smbsrv_recv_smb_request(void *private, DATA_BLOB blob) used instead of the bcc size */ if (req->in.data_size + 0x10000 <= req->in.size - PTR_DIFF(req->in.data, req->in.buffer) && - (req->in.wct < 1 || SVAL(req->in.vwv, VWV(0)) == SMB_CHAIN_NONE)) { + ( message_flags(command) & LARGE_REQUEST) && + ( !(message_flags(command) & AND_X) || + (req->in.wct < 1 || SVAL(req->in.vwv, VWV(0)) == SMB_CHAIN_NONE) ) + ) { /* its an oversized packet! fun for all the family */ req->in.data_size = req->in.size - PTR_DIFF(req->in.data,req->in.buffer); } -- cgit From 08f83c59df7a0e490da55a536b6e04a32508d2b0 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 18 Apr 2008 22:20:49 +0200 Subject: build: fix the build rule for .o files metze (This used to be commit c7f34f41c3f9f0c3f75a618dfaf566706014a6b4) --- source4/build/make/rules.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source4/build/make/rules.mk b/source4/build/make/rules.mk index faefb4e323..541fa018db 100644 --- a/source4/build/make/rules.mk +++ b/source4/build/make/rules.mk @@ -211,7 +211,9 @@ include/includes.d: include/includes.h @echo "Compiling $<" @-mkdir -p `dirname $@` @$(COMPILE) && exit 0 ; \ - $(COMPILE) + echo "The following command failed:" 1>&2;\ + echo "$(COMPILE)" 1>&2;\ + $(COMPILE) >/dev/null 2>&1 -- cgit From b2f2c1486e9c6bd6fdba3dc321f9df0d29d7def2 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sat, 19 Apr 2008 00:14:52 +0200 Subject: ntvfs_generic: fix mapping the granted oplocks for SMB2 metze (This used to be commit 60c4a4fc1afe88716ac63d3ea430e07fea7b9991) --- source4/ntvfs/ntvfs_generic.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source4/ntvfs/ntvfs_generic.c b/source4/ntvfs/ntvfs_generic.c index 5d4bbf388c..debcfc3f8a 100644 --- a/source4/ntvfs/ntvfs_generic.c +++ b/source4/ntvfs/ntvfs_generic.c @@ -209,13 +209,13 @@ static NTSTATUS ntvfs_map_open_finish(struct ntvfs_module_context *ntvfs, case RAW_OPEN_SMB2: io->smb2.out.file.ntvfs = io2->generic.out.file.ntvfs; switch (io2->generic.out.oplock_level) { - case OPLOCK_BATCH: + case BATCH_OPLOCK_RETURN: io->smb2.out.oplock_level = SMB2_OPLOCK_LEVEL_BATCH; break; - case OPLOCK_EXCLUSIVE: + case EXCLUSIVE_OPLOCK_RETURN: io->smb2.out.oplock_level = SMB2_OPLOCK_LEVEL_EXCLUSIVE; break; - case OPLOCK_LEVEL_II: + case LEVEL_II_OPLOCK_RETURN: io->smb2.out.oplock_level = SMB2_OPLOCK_LEVEL_II; break; default: -- cgit From 670b7dcae3d50e62902fce45d6bb1eeef8530f7c Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 18 Apr 2008 22:19:08 +0200 Subject: libcli: define structure for SMB2 Break metze (This used to be commit 5ffea702c3a1c92a797afab1a3cadf2f2a18729f) --- source4/libcli/raw/interfaces.h | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/source4/libcli/raw/interfaces.h b/source4/libcli/raw/interfaces.h index cf5a3aa25e..bad3743721 100644 --- a/source4/libcli/raw/interfaces.h +++ b/source4/libcli/raw/interfaces.h @@ -1862,7 +1862,8 @@ enum smb_lock_level { RAW_LOCK_LOCK, RAW_LOCK_UNLOCK, RAW_LOCK_LOCKX, - RAW_LOCK_SMB2 + RAW_LOCK_SMB2, + RAW_LOCK_SMB2_BREAK }; /* the generic interface is defined to be equal to the lockingX interface */ @@ -1925,6 +1926,20 @@ union smb_lock { uint16_t unknown1; } out; } smb2; + + /* SMB2 Break */ + struct smb2_break { + enum smb_lock_level level; + struct { + union smb_handle file; + + /* static body buffer 24 (0x18) bytes */ + uint8_t oplock_level; + uint8_t reserved; + uint32_t reserved2; + /* struct smb2_handle handle; */ + } in, out; + } smb2_break; }; -- cgit From 0f4a60ff24b2bdb7e2bd73e787613264ec73265c Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 18 Apr 2008 22:24:21 +0200 Subject: libcli/smb2: add smb2_break() calls metze (This used to be commit 7f545dbbf0186fe552e4c49a3f618862cb4771e7) --- source4/libcli/smb2/break.c | 74 +++++++++++++++++++++++++++++++++++++++++++ source4/libcli/smb2/config.mk | 2 +- 2 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 source4/libcli/smb2/break.c diff --git a/source4/libcli/smb2/break.c b/source4/libcli/smb2/break.c new file mode 100644 index 0000000000..fe0cceb829 --- /dev/null +++ b/source4/libcli/smb2/break.c @@ -0,0 +1,74 @@ +/* + Unix SMB/CIFS implementation. + + SMB2 client oplock break handling + + Copyright (C) Stefan Metzmacher 2008 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "includes.h" +#include "libcli/smb2/smb2.h" +#include "libcli/smb2/smb2_calls.h" + +/* + send a break request +*/ +struct smb2_request *smb2_break_send(struct smb2_tree *tree, struct smb2_break *io) +{ + struct smb2_request *req; + + req = smb2_request_init_tree(tree, SMB2_OP_BREAK, 0x18, false, 0); + if (req == NULL) return NULL; + + SCVAL(req->out.body, 0x02, io->in.oplock_level); + SCVAL(req->out.body, 0x03, io->in.reserved); + SIVAL(req->out.body, 0x04, io->in.reserved2); + smb2_push_handle(req->out.body+0x08, &io->in.file.handle); + + smb2_transport_send(req); + + return req; +} + + +/* + recv a break reply +*/ +NTSTATUS smb2_break_recv(struct smb2_request *req, struct smb2_break *io) +{ + if (!smb2_request_receive(req) || + !smb2_request_is_ok(req)) { + return smb2_request_destroy(req); + } + + SMB2_CHECK_PACKET_RECV(req, 0x18, false); + + io->out.oplock_level = CVAL(req->in.body, 0x02); + io->out.reserved = CVAL(req->in.body, 0x03); + io->out.reserved2 = IVAL(req->in.body, 0x04); + smb2_pull_handle(req->in.body+0x08, &io->out.file.handle); + + return smb2_request_destroy(req); +} + +/* + sync flush request +*/ +NTSTATUS smb2_break(struct smb2_tree *tree, struct smb2_break *io) +{ + struct smb2_request *req = smb2_break_send(tree, io); + return smb2_break_recv(req, io); +} diff --git a/source4/libcli/smb2/config.mk b/source4/libcli/smb2/config.mk index e95997db54..18f6245a3e 100644 --- a/source4/libcli/smb2/config.mk +++ b/source4/libcli/smb2/config.mk @@ -6,5 +6,5 @@ LIBCLI_SMB2_OBJ_FILES = $(addprefix libcli/smb2/, \ transport.o request.o negprot.o session.o tcon.o \ create.o close.o connect.o getinfo.o write.o read.o \ setinfo.o find.o ioctl.o logoff.o tdis.o flush.o \ - lock.o notify.o cancel.o keepalive.o) + lock.o notify.o cancel.o keepalive.o break.o) -- cgit From 132852f44ac24824d2247d3d873f217c5b8207a9 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 18 Apr 2008 22:27:24 +0200 Subject: libcli/smb2: make it possible to handle incoming oplock requests metze (This used to be commit 58189b87eade62b717c2c17c679e482786bf2098) --- source4/libcli/smb2/smb2.h | 11 +++++++++++ source4/libcli/smb2/transport.c | 43 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/source4/libcli/smb2/smb2.h b/source4/libcli/smb2/smb2.h index 726df64090..ae66a6e0d3 100644 --- a/source4/libcli/smb2/smb2.h +++ b/source4/libcli/smb2/smb2.h @@ -21,6 +21,8 @@ #include "libcli/raw/request.h" +struct smb2_handle; + struct smb2_options { uint32_t timeout; }; @@ -58,6 +60,15 @@ struct smb2_transport { void *private; uint_t period; } idle; + + struct { + /* a oplock break request handler */ + bool (*handler)(struct smb2_transport *transport, + const struct smb2_handle *handle, + uint8_t level, void *private_data); + /* private data passed to the oplock handler */ + void *private_data; + } oplock; }; diff --git a/source4/libcli/smb2/transport.c b/source4/libcli/smb2/transport.c index af19fcb0a9..8eb60a06f1 100644 --- a/source4/libcli/smb2/transport.c +++ b/source4/libcli/smb2/transport.c @@ -140,6 +140,44 @@ void smb2_transport_dead(struct smb2_transport *transport, NTSTATUS status) } } +static bool smb2_handle_oplock_break(struct smb2_transport *transport, + const DATA_BLOB *blob) +{ + uint8_t *hdr; + uint16_t opcode; + uint64_t seqnum; + + hdr = blob->data+NBT_HDR_SIZE; + + if (blob->length < (SMB2_MIN_SIZE+0x18)) { + DEBUG(1,("Discarding smb2 oplock reply of size %u\n", + blob->length)); + return false; + } + + opcode = SVAL(hdr, SMB2_HDR_OPCODE); + seqnum = BVAL(hdr, SMB2_HDR_MESSAGE_ID); + + if ((opcode != SMB2_OP_BREAK) || + (seqnum != UINT64_MAX)) { + return false; + } + + if (transport->oplock.handler) { + uint8_t *body = hdr+SMB2_HDR_BODY; + struct smb2_handle h; + uint8_t level; + + level = CVAL(body, 0x02); + smb2_pull_handle(body+0x08, &h); + + transport->oplock.handler(transport, &h, level, + transport->oplock.private_data); + } + + return true; +} + /* we have a full request in our receive buffer - match it to a pending request and process @@ -167,6 +205,11 @@ static NTSTATUS smb2_transport_finish_recv(void *private, DATA_BLOB blob) goto error; } + if (smb2_handle_oplock_break(transport, &blob)) { + talloc_free(buffer); + return NT_STATUS_OK; + } + flags = IVAL(hdr, SMB2_HDR_FLAGS); seqnum = BVAL(hdr, SMB2_HDR_MESSAGE_ID); -- cgit From 8b5f03a225b7e3ab478f5de22e7a84e78c909741 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 18 Apr 2008 22:30:12 +0200 Subject: smb_server/smb2: handle incoming oplock releases metze (This used to be commit 2306394dcc22ff2be8581256a5cf91eef4993078) --- source4/smb_server/smb2/fileio.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/source4/smb_server/smb2/fileio.c b/source4/smb_server/smb2/fileio.c index af1a413009..b6b35d3d89 100644 --- a/source4/smb_server/smb2/fileio.c +++ b/source4/smb_server/smb2/fileio.c @@ -410,7 +410,36 @@ void smb2srv_notify_recv(struct smb2srv_request *req) SMB2SRV_CALL_NTVFS_BACKEND(ntvfs_notify(req->ntvfs, io)); } +static void smb2srv_break_send(struct ntvfs_request *ntvfs) +{ + struct smb2srv_request *req; + union smb_lock *io; + + SMB2SRV_CHECK_ASYNC_STATUS_ERR(io, union smb_lock); + SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x18, false, 0)); + + SCVAL(req->out.body, 0x02, io->smb2_break.out.oplock_level); + SCVAL(req->out.body, 0x03, io->smb2_break.out.reserved); + SIVAL(req->out.body, 0x04, io->smb2_break.out.reserved2); + smb2srv_push_handle(req->out.body, 0x08,io->smb2_break.out.file.ntvfs); + + smb2srv_send_reply(req); +} + void smb2srv_break_recv(struct smb2srv_request *req) { - smb2srv_send_error(req, NT_STATUS_NOT_IMPLEMENTED); + union smb_lock *io; + + SMB2SRV_CHECK_BODY_SIZE(req, 0x18, false); + SMB2SRV_TALLOC_IO_PTR(io, union smb_lock); + SMB2SRV_SETUP_NTVFS_REQUEST(smb2srv_break_send, NTVFS_ASYNC_STATE_MAY_ASYNC); + + io->smb2_break.level = RAW_LOCK_SMB2_BREAK; + io->smb2_break.in.oplock_level = CVAL(req->in.body, 0x02); + io->smb2_break.in.reserved = CVAL(req->in.body, 0x03); + io->smb2_break.in.reserved2 = IVAL(req->in.body, 0x04); + io->smb2_break.in.file.ntvfs = smb2srv_pull_handle(req, req->in.body, 0x08); + + SMB2SRV_CHECK_FILE_HANDLE(io->smb2_break.in.file.ntvfs); + SMB2SRV_CALL_NTVFS_BACKEND(ntvfs_lock(req->ntvfs, io)); } -- cgit From 39d23027218c02dc3055d8a0cc28dcc169e8b064 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 18 Apr 2008 22:32:25 +0200 Subject: ntvfs_generic: map RAW_LOCK_SMB2_BREAK to RAW_LOCK_GENERIC metze (This used to be commit b781bb733c9a563457f87c94abe8c91b426c07ee) --- source4/ntvfs/ntvfs_generic.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/source4/ntvfs/ntvfs_generic.c b/source4/ntvfs/ntvfs_generic.c index debcfc3f8a..3653ad82c1 100644 --- a/source4/ntvfs/ntvfs_generic.c +++ b/source4/ntvfs/ntvfs_generic.c @@ -1043,6 +1043,23 @@ NTSTATUS ntvfs_map_lock(struct ntvfs_module_context *ntvfs, /* initialize output value */ lck->smb2.out.unknown1 = 0; break; + + case RAW_LOCK_SMB2_BREAK: + lck2->generic.level = RAW_LOCK_GENERIC; + lck2->generic.in.file.ntvfs = lck->smb2_break.in.file.ntvfs; + lck2->generic.in.mode = LOCKING_ANDX_OPLOCK_RELEASE | + ((lck->smb2_break.in.oplock_level << 8) & 0xFF00); + lck2->generic.in.timeout = 0; + lck2->generic.in.ulock_cnt = 0; + lck2->generic.in.lock_cnt = 0; + lck2->generic.in.locks = NULL; + + /* initialize output value */ + lck->smb2_break.out.oplock_level= lck->smb2_break.in.oplock_level; + lck->smb2_break.out.reserved = lck->smb2_break.in.reserved; + lck->smb2_break.out.reserved2 = lck->smb2_break.in.reserved2; + lck->smb2_break.out.file = lck->smb2_break.in.file; + break; } /* -- cgit From 95d111b7e44e2dc468021c435dcb2225e806faeb Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sat, 19 Apr 2008 00:13:42 +0200 Subject: torture/smb2: add a simple SMB2-OPLOCK-BATCH1 test metze (This used to be commit 914f0ac83bc396be0ca34c43e2ea01ecc1c3b826) --- source4/torture/smb2/config.mk | 3 +- source4/torture/smb2/oplocks.c | 178 +++++++++++++++++++++++++++++++++++++++++ source4/torture/smb2/smb2.c | 1 + 3 files changed, 181 insertions(+), 1 deletion(-) create mode 100644 source4/torture/smb2/oplocks.c diff --git a/source4/torture/smb2/config.mk b/source4/torture/smb2/config.mk index 12d5edbeb2..f3318bb736 100644 --- a/source4/torture/smb2/config.mk +++ b/source4/torture/smb2/config.mk @@ -21,5 +21,6 @@ TORTURE_SMB2_OBJ_FILES = $(addprefix torture/smb2/, \ lock.o \ notify.o \ smb2.o \ - persistent_handles.o) + persistent_handles.o \ + oplocks.o) diff --git a/source4/torture/smb2/oplocks.c b/source4/torture/smb2/oplocks.c new file mode 100644 index 0000000000..b0a1b31d1f --- /dev/null +++ b/source4/torture/smb2/oplocks.c @@ -0,0 +1,178 @@ +/* + Unix SMB/CIFS implementation. + + test suite for SMB2 oplocks + + Copyright (C) Stefan Metzmacher 2008 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "includes.h" +#include "librpc/gen_ndr/security.h" +#include "libcli/smb2/smb2.h" +#include "libcli/smb2/smb2_calls.h" +#include "torture/torture.h" +#include "torture/smb2/proto.h" +#include "param/param.h" + +#define CHECK_VAL(v, correct) do { \ + if ((v) != (correct)) { \ + torture_result(tctx, TORTURE_FAIL, "(%s): wrong value for %s got 0x%x - should be 0x%x\n", \ + __location__, #v, (int)v, (int)correct); \ + ret = false; \ + }} while (0) + +#define CHECK_STATUS(status, correct) do { \ + if (!NT_STATUS_EQUAL(status, correct)) { \ + torture_result(tctx, TORTURE_FAIL, __location__": Incorrect status %s - should be %s", \ + nt_errstr(status), nt_errstr(correct)); \ + ret = false; \ + goto done; \ + }} while (0) + +static struct { + struct smb2_handle handle; + uint8_t level; + struct smb2_break br; + int count; + int failures; +} break_info; + +static void torture_oplock_break_callback(struct smb2_request *req) +{ + NTSTATUS status; + struct smb2_break br; + + ZERO_STRUCT(br); + status = smb2_break_recv(req, &break_info.br); + if (!NT_STATUS_IS_OK(status)) { + break_info.failures++; + } + + return; +} + +/* a oplock break request handler */ +static bool torture_oplock_handler(struct smb2_transport *transport, + const struct smb2_handle *handle, + uint8_t level, void *private_data) +{ + struct smb2_tree *tree = private_data; + const char *name; + struct smb2_request *req; + + break_info.handle = *handle; + break_info.level = level; + break_info.count++; + + switch (level) { + case SMB2_OPLOCK_LEVEL_II: + name = "level II"; + break; + case SMB2_OPLOCK_LEVEL_NONE: + name = "none"; + break; + default: + name = "unknown"; + break_info.failures++; + } + printf("Acking to %s [0x%02X] in oplock handler\n", + name, level); + + ZERO_STRUCT(break_info.br); + break_info.br.in.file.handle = *handle; + break_info.br.in.oplock_level = level; + break_info.br.in.reserved = 0; + break_info.br.in.reserved2 = 0; + + req = smb2_break_send(tree, &break_info.br); + req->async.fn = torture_oplock_break_callback; + req->async.private = NULL; + + return true; +} + +bool torture_smb2_oplock_batch1(struct torture_context *tctx, + struct smb2_tree *tree) +{ + TALLOC_CTX *mem_ctx = talloc_new(tctx); + struct smb2_handle h1, h2; + struct smb2_create io; + NTSTATUS status; + const char *fname = "oplock.dat"; + bool ret = true; + + tree->session->transport->oplock.handler = torture_oplock_handler; + tree->session->transport->oplock.private_data = tree; + + smb2_util_unlink(tree, fname); + + ZERO_STRUCT(break_info); + + ZERO_STRUCT(io); + io.in.security_flags = 0x00; + io.in.oplock_level = SMB2_OPLOCK_LEVEL_BATCH; + io.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION; + io.in.create_flags = 0x00000000; + io.in.reserved = 0x00000000; + io.in.desired_access = SEC_RIGHTS_FILE_ALL; + io.in.file_attributes = FILE_ATTRIBUTE_NORMAL; + io.in.share_access = NTCREATEX_SHARE_ACCESS_READ | + NTCREATEX_SHARE_ACCESS_WRITE | + NTCREATEX_SHARE_ACCESS_DELETE; + io.in.create_disposition = NTCREATEX_DISP_OPEN_IF; + io.in.create_options = NTCREATEX_OPTIONS_SEQUENTIAL_ONLY | + NTCREATEX_OPTIONS_ASYNC_ALERT | + NTCREATEX_OPTIONS_NON_DIRECTORY_FILE | + 0x00200000; + io.in.fname = fname; + + status = smb2_create(tree, mem_ctx, &io); + CHECK_STATUS(status, NT_STATUS_OK); + CHECK_VAL(io.out.oplock_level, SMB2_OPLOCK_LEVEL_BATCH); + /*CHECK_VAL(io.out.reserved, 0);*/ + CHECK_VAL(io.out.create_action, NTCREATEX_ACTION_CREATED); + CHECK_VAL(io.out.alloc_size, 0); + CHECK_VAL(io.out.size, 0); + CHECK_VAL(io.out.file_attr, FILE_ATTRIBUTE_ARCHIVE); + CHECK_VAL(io.out.reserved2, 0); + CHECK_VAL(break_info.count, 0); + + h1 = io.out.file.handle; + + ZERO_STRUCT(io.in.blobs); + status = smb2_create(tree, mem_ctx, &io); + CHECK_VAL(break_info.count, 1); + CHECK_VAL(break_info.failures, 0); + CHECK_VAL(break_info.level, SMB2_OPLOCK_LEVEL_II); + CHECK_STATUS(status, NT_STATUS_OK); + CHECK_VAL(io.out.oplock_level, SMB2_OPLOCK_LEVEL_II); + /*CHECK_VAL(io.out.reserved, 0);*/ + CHECK_VAL(io.out.create_action, NTCREATEX_ACTION_EXISTED); + CHECK_VAL(io.out.alloc_size, 0); + CHECK_VAL(io.out.size, 0); + CHECK_VAL(io.out.file_attr, FILE_ATTRIBUTE_ARCHIVE); + CHECK_VAL(io.out.reserved2, 0); + + h2 = io.out.file.handle; + +done: + talloc_free(mem_ctx); + + smb2_util_close(tree, h1); + smb2_util_close(tree, h2); + smb2_util_unlink(tree, fname); + return ret; +} diff --git a/source4/torture/smb2/smb2.c b/source4/torture/smb2/smb2.c index 80b2d25597..f406b7d6e8 100644 --- a/source4/torture/smb2/smb2.c +++ b/source4/torture/smb2/smb2.c @@ -138,6 +138,7 @@ NTSTATUS torture_smb2_init(void) torture_suite_add_suite(suite, torture_smb2_lock_init()); torture_suite_add_simple_test(suite, "NOTIFY", torture_smb2_notify); torture_suite_add_2smb2_test(suite, "PERSISTENT-HANDLES1", torture_smb2_persistent_handles1); + torture_suite_add_1smb2_test(suite, "OPLOCK-BATCH1", torture_smb2_oplock_batch1); suite->description = talloc_strdup(suite, "SMB2-specific tests"); -- cgit From f0eb488d221d2d12d750babac0252aac671d92f4 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sat, 19 Apr 2008 02:06:44 +0200 Subject: SMB2-PERSISTENT-HANDLES1: close the handle before deleting it This means we no longer have a oplock break timing out for the "delete". metze (This used to be commit 50f6a72b674f58a24c1a6c42e4dd56dc4e9f5a1e) --- source4/torture/smb2/persistent_handles.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source4/torture/smb2/persistent_handles.c b/source4/torture/smb2/persistent_handles.c index ace57d8817..249ddd1733 100644 --- a/source4/torture/smb2/persistent_handles.c +++ b/source4/torture/smb2/persistent_handles.c @@ -174,6 +174,8 @@ bool torture_smb2_persistent_handles1(struct torture_context *tctx, torture_comment(tctx, "position: %llu\n", (unsigned long long)pos); + smb2_util_close(tree2, h2); + talloc_free(mem_ctx); smb2_util_unlink(tree2, fname); -- cgit From db30ff4bea11f6612bd68c934ba31387ad99cefc Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 21 Apr 2008 17:59:08 +0200 Subject: Load default smb.conf file if none was specified explicitly. (This used to be commit 8fa23fac516dbf4c8245c1d009e81f02a6341775) --- source4/param/param.i | 9 ++++ source4/param/param.py | 6 +-- source4/param/param_wrap.c | 76 ++++++++++++++++++++-------- source4/pidl/lib/Parse/Pidl/Samba4/Python.pm | 8 +-- 4 files changed, 70 insertions(+), 29 deletions(-) diff --git a/source4/param/param.i b/source4/param/param.i index 77d781d6ff..2f62cb2f16 100644 --- a/source4/param/param.i +++ b/source4/param/param.i @@ -307,6 +307,15 @@ struct loadparm_context *lp_from_py_object(PyObject *py_obj) return lp_ctx; } + if (py_obj == Py_None) { + lp_ctx = loadparm_init(NULL); + if (!lp_load_default(lp_ctx)) { + talloc_free(lp_ctx); + return NULL; + } + return lp_ctx; + } + if (SWIG_ConvertPtr(py_obj, (void *)&lp_ctx, SWIGTYPE_p_loadparm_context, 0 | 0 ) < 0) return NULL; return lp_ctx; diff --git a/source4/param/param.py b/source4/param/param.py index 025acc6be1..0419c75bfa 100644 --- a/source4/param/param.py +++ b/source4/param/param.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. @@ -79,7 +79,7 @@ LoadParm_swigregister(LoadParm) class loadparm_service(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 loadparm_service.volume_label = new_instancemethod(_param.loadparm_service_volume_label,None,loadparm_service) loadparm_service.printername = new_instancemethod(_param.loadparm_service_printername,None,loadparm_service) @@ -137,7 +137,7 @@ ParamFile_swigregister(ParamFile) class param_opt(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 key = _swig_property(_param.param_opt_key_get) value = _swig_property(_param.param_opt_value_get) diff --git a/source4/param/param_wrap.c b/source4/param/param_wrap.c index e74f902645..d07be04a66 100644 --- a/source4/param/param_wrap.c +++ b/source4/param/param_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; } @@ -2504,7 +2522,7 @@ static swig_module_info swig_module = {swig_types, 15, 0, 0, 0, 0}; #define SWIG_name "_param" -#define SWIGVERSION 0x010333 +#define SWIGVERSION 0x010335 #define SWIG_VERSION SWIGVERSION @@ -2776,6 +2794,15 @@ struct loadparm_context *lp_from_py_object(PyObject *py_obj) return lp_ctx; } + if (py_obj == Py_None) { + lp_ctx = loadparm_init(NULL); + if (!lp_load_default(lp_ctx)) { + talloc_free(lp_ctx); + return NULL; + } + return lp_ctx; + } + if (SWIG_ConvertPtr(py_obj, (void *)&lp_ctx, SWIGTYPE_p_loadparm_context, 0 | 0 ) < 0) return NULL; return lp_ctx; @@ -4073,7 +4100,7 @@ SWIGINTERN PyObject *_wrap_new_param_section(PyObject *SWIGUNUSEDPARM(self), PyO param_section *result = 0 ; if (!SWIG_Python_UnpackTuple(args,"new_param_section",0,0,0)) SWIG_fail; - result = (param_section *)(param_section *) calloc(1, sizeof(param_section)); + result = (param_section *)calloc(1, sizeof(param_section)); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_param_section, SWIG_POINTER_NEW | 0 ); return resultobj; fail: @@ -4325,7 +4352,7 @@ SWIGRUNTIME void SWIG_InitializeModule(void *clientdata) { size_t i; swig_module_info *module_head, *iter; - int found; + int found, init; clientdata = clientdata; @@ -4335,6 +4362,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 */ @@ -4363,6 +4393,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/pidl/lib/Parse/Pidl/Samba4/Python.pm b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm index 2d12da358c..e344589f8e 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm @@ -597,7 +597,7 @@ sub Interface($$$) $self->pidl("const char *binding_string;"); $self->pidl("struct cli_credentials *credentials;"); $self->pidl("struct loadparm_context *lp_ctx = NULL;"); - $self->pidl("PyObject *py_lp_ctx = NULL, *py_credentials = Py_None;"); + $self->pidl("PyObject *py_lp_ctx = Py_None, *py_credentials = Py_None;"); $self->pidl("TALLOC_CTX *mem_ctx = NULL;"); $self->pidl("NTSTATUS status;"); $self->pidl(""); @@ -609,14 +609,12 @@ sub Interface($$$) $self->pidl("extern struct loadparm_context *lp_from_py_object(PyObject *py_obj);"); $self->pidl("extern struct cli_credentials *cli_credentials_from_py_object(PyObject *py_obj);"); $self->pidl(""); - $self->pidl("if (!PyArg_ParseTupleAndKeywords(args, kwargs, \"sO|O:$interface->{NAME}\", discard_const_p(char *, kwnames), &binding_string, &py_lp_ctx, &py_credentials)) {"); + $self->pidl("if (!PyArg_ParseTupleAndKeywords(args, kwargs, \"s|OO:$interface->{NAME}\", discard_const_p(char *, kwnames), &binding_string, &py_lp_ctx, &py_credentials)) {"); $self->indent; $self->pidl("return NULL;"); $self->deindent; $self->pidl("}"); $self->pidl(""); - $self->pidl("if (py_lp_ctx != NULL) {"); - $self->indent; $self->pidl("lp_ctx = lp_from_py_object(py_lp_ctx);"); $self->pidl("if (lp_ctx == NULL) {"); $self->indent; @@ -624,8 +622,6 @@ sub Interface($$$) $self->pidl("return NULL;"); $self->deindent; $self->pidl("}"); - $self->deindent; - $self->pidl("}"); $self->pidl(""); $self->pidl("credentials = cli_credentials_from_py_object(py_credentials);"); -- cgit From 8a3e3391fb82c2ee8ef67dbded753d6fad564827 Mon Sep 17 00:00:00 2001 From: James Peach Date: Mon, 21 Apr 2008 15:09:43 -0700 Subject: smbtorture: Add RAW-BENCH-LOOKUP micro-benchmark. This test samples the lookup rate for a non-existant filename in a directory, while varying the number of files in the directory. The lookup rate should continue to approximate the lookup rate for the empty directory case. (This used to be commit ca7e4d9166a7cb10495cf3ecd9c4e72103fbec30) --- source4/torture/config.mk | 1 + source4/torture/raw/lookuprate.c | 319 +++++++++++++++++++++++++++++++++++++++ source4/torture/raw/raw.c | 2 + 3 files changed, 322 insertions(+) create mode 100644 source4/torture/raw/lookuprate.c diff --git a/source4/torture/config.mk b/source4/torture/config.mk index 2f3fa38863..1565797609 100644 --- a/source4/torture/config.mk +++ b/source4/torture/config.mk @@ -86,6 +86,7 @@ TORTURE_RAW_OBJ_FILES = $(addprefix torture/raw/, \ lock.o \ pingpong.o \ lockbench.o \ + lookuprate.o \ openbench.o \ rename.o \ eas.o \ diff --git a/source4/torture/raw/lookuprate.c b/source4/torture/raw/lookuprate.c new file mode 100644 index 0000000000..4b505dc4b8 --- /dev/null +++ b/source4/torture/raw/lookuprate.c @@ -0,0 +1,319 @@ +/* + File lookup rate test. + + Copyright (C) James Peach 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 "param/param.h" +#include "system/filesys.h" +#include "torture/torture.h" +#include "torture/basic/proto.h" +#include "libcli/libcli.h" +#include "lib/cmdline/popt_common.h" +#include "auth/credentials/credentials.h" + +#define BASEDIR "\\lookuprate" +#define MISSINGNAME BASEDIR "\\foo" + +#define FUZZ_PERCENT 10 + +#define usec_to_sec(s) ((s) / 1000000) +#define sec_to_usec(s) ((s) * 1000000) + +struct rate_record +{ + unsigned dirent_count; + unsigned querypath_persec; + unsigned findfirst_persec; +}; + +static struct rate_record records[] = +{ + { 0, 0, 0 }, /* Base (optimal) lookup rate. */ + { 100, 0, 0}, + { 1000, 0, 0}, + { 10000, 0, 0}, + { 100000, 0, 0} +}; + +typedef NTSTATUS lookup_function(struct smbcli_tree *tree, const char * path); + +/* Test whether rhs is within fuzz% of lhs. */ +static bool fuzzily_equal(unsigned lhs, unsigned rhs, int percent) +{ + double fuzz = (double)lhs * (double)percent/100.0; + + if (((double)rhs >= ((double)lhs - fuzz)) && + ((double)rhs <= ((double)lhs + fuzz))) { + return true; + } + + return false; + +} + +static NTSTATUS fill_directory(struct smbcli_tree *tree, + const char * path, unsigned count) +{ + NTSTATUS status; + char *fname = NULL; + unsigned i; + unsigned current; + + struct timeval start; + struct timeval now; + + status = smbcli_mkdir(tree, path); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + printf("filling directory %s with %u files... ", path, count); + fflush(stdout); + + current = random(); + start = timeval_current(); + + for (i = 0; i < count; ++i) { + int fnum; + + ++current; + fname = talloc_asprintf(NULL, "%s\\fill%u", + path, current); + + fnum = smbcli_open(tree, fname, O_RDONLY|O_CREAT, + OPENX_MODE_DENY_NONE); + if (fnum < 0) { + talloc_free(fname); + return smbcli_nt_error(tree); + } + + smbcli_close(tree, fnum); + talloc_free(fname); + } + + if (count) { + double rate; + now = timeval_current(); + rate = (double)count / usec_to_sec((double)usec_time_diff(&now, &start)); + printf("%u/sec\n", (unsigned)rate); + } else { + printf("done\n"); + } + + return NT_STATUS_OK; +} + +static NTSTATUS squash_lookup_error(NTSTATUS status) +{ + if (NT_STATUS_IS_OK(status)) { + return NT_STATUS_OK; + } + + /* We don't care if the file isn't there. */ + if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_PATH_NOT_FOUND)) { + return NT_STATUS_OK; + } + + if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) { + return NT_STATUS_OK; + } + + if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_FILE)) { + return NT_STATUS_OK; + } + + return status; +} + +/* Look up a pathname using TRANS2_QUERY_PATH_INFORMATION. */ +static NTSTATUS querypath_lookup(struct smbcli_tree *tree, const char * path) +{ + NTSTATUS status; + time_t ftimes[3]; + size_t fsize; + uint16_t fmode; + + status = smbcli_qpathinfo(tree, path, &ftimes[0], &ftimes[1], &ftimes[2], + &fsize, &fmode); + + return squash_lookup_error(status); +} + +/* Look up a pathname using TRANS2_FIND_FIRST2. */ +static NTSTATUS findfirst_lookup(struct smbcli_tree *tree, const char * path) +{ + NTSTATUS status = NT_STATUS_OK; + + if (smbcli_list(tree, path, 0, NULL, NULL) < 0) { + status = smbcli_nt_error(tree); + } + + return squash_lookup_error(status); +} + +static NTSTATUS lookup_rate_convert(struct smbcli_tree *tree, + lookup_function lookup, const char * path, unsigned * rate) +{ + NTSTATUS status; + + struct timeval start; + struct timeval now; + unsigned count = 0; + int64_t elapsed = 0; + +#define LOOKUP_PERIOD_SEC (2) + + start = timeval_current(); + while (elapsed < sec_to_usec(LOOKUP_PERIOD_SEC)) { + + status = lookup(tree, path); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + ++count; + now = timeval_current(); + elapsed = usec_time_diff(&now, &start); + } + +#undef LOOKUP_PERIOD_SEC + + *rate = (unsigned)((double)count / (double)usec_to_sec(elapsed)); + return NT_STATUS_OK; +} + +static bool remove_working_directory(struct smbcli_tree *tree, + const char * path) +{ + int tries; + + /* Using smbcli_deltree to delete a very large number of files + * doesn't work against all servers. Work around this by + * retrying. + */ + for (tries = 0; tries < 5; ) { + int ret; + + ret = smbcli_deltree(tree, BASEDIR); + if (ret == -1) { + tries++; + printf("(%s) failed to deltree %s: %s\n", + __location__, BASEDIR, + smbcli_errstr(tree)); + continue; + } + + return true; + } + + return false; + +} + +/* Verify that looking up a file name takes constant time. + * + * This test samples the lookup rate for a non-existant filename in a + * directory, while varying the number of files in the directory. The + * lookup rate should continue to approximate the lookup rate for the + * empty directory case. + */ +bool torture_bench_lookup(struct torture_context *torture) +{ + NTSTATUS status; + bool result = false; + + int i, tries; + struct smbcli_state *cli = NULL; + + if (!torture_open_connection(&cli, torture, 0)) { + goto done; + } + + remove_working_directory(cli->tree, BASEDIR); + + for (i = 0; i < ARRAY_SIZE(records); ++i) { + printf("testing lookup rate with %u directory entries\n", + records[i].dirent_count); + + status = fill_directory(cli->tree, BASEDIR, + records[i].dirent_count); + if (!NT_STATUS_IS_OK(status)) { + printf("failed to fill directory: %s\n", nt_errstr(status)); + goto done; + } + + status = lookup_rate_convert(cli->tree, querypath_lookup, + MISSINGNAME, &records[i].querypath_persec); + if (!NT_STATUS_IS_OK(status)) { + printf("querypathinfo of %s failed: %s\n", + MISSINGNAME, nt_errstr(status)); + goto done; + } + + status = lookup_rate_convert(cli->tree, findfirst_lookup, + MISSINGNAME, &records[i].findfirst_persec); + if (!NT_STATUS_IS_OK(status)) { + printf("findfirst of %s failed: %s\n", + MISSINGNAME, nt_errstr(status)); + goto done; + } + + printf("entries = %u, querypath = %u/sec, findfirst = %u/sec\n", + records[i].dirent_count, + records[i].querypath_persec, + records[i].findfirst_persec); + + if (!remove_working_directory(cli->tree, BASEDIR)) { + goto done; + } + } + + /* Ok. We have run all our tests. Walk through the records we + * accumulated and figure out whether the lookups took constant + * time of not. + */ + for (i = 0; i < ARRAY_SIZE(records); ++i) { + if (!fuzzily_equal(records[0].querypath_persec, + records[i].querypath_persec, + FUZZ_PERCENT)) { + printf("querypath rate for %d entries differed by " + "more than %d%% from base rate\n", + records[i].dirent_count, FUZZ_PERCENT); + result = false; + } + + if (!fuzzily_equal(records[0].findfirst_persec, + records[i].findfirst_persec, + FUZZ_PERCENT)) { + printf("findfirst rate for %d entries differed by " + "more than %d%% from base rate\n", + records[i].dirent_count, FUZZ_PERCENT); + result = false; + } + } + +done: + if (cli) { + remove_working_directory(cli->tree, BASEDIR); + talloc_free(cli); + } + + return result; +} + +/* vim: set sts=8 sw=8 : */ diff --git a/source4/torture/raw/raw.c b/source4/torture/raw/raw.c index bb3dde728f..262ed1384b 100644 --- a/source4/torture/raw/raw.c +++ b/source4/torture/raw/raw.c @@ -33,6 +33,8 @@ NTSTATUS torture_raw_init(void) torture_suite_add_simple_test(suite, "PING-PONG", torture_ping_pong); torture_suite_add_simple_test(suite, "BENCH-LOCK", torture_bench_lock); torture_suite_add_simple_test(suite, "BENCH-OPEN", torture_bench_open); + torture_suite_add_simple_test(suite, "BENCH-LOOKUP", + torture_bench_lookup); torture_suite_add_simple_test(suite, "OFFLINE", torture_test_offline); torture_suite_add_1smb_test(suite, "QFSINFO", torture_raw_qfsinfo); torture_suite_add_1smb_test(suite, "QFILEINFO", torture_raw_qfileinfo); -- 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/auth/gensec/gensec.c | 22 ++++---------- source4/client/cifsdd.c | 17 +++++++---- source4/client/cifsdd.h | 2 ++ source4/client/cifsddio.c | 12 +++++--- source4/client/client.c | 46 ++++++++++++++++++++++------- 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 +- source4/libcli/cldap/cldap.c | 6 +--- source4/libcli/cliconnect.c | 5 ++-- source4/libcli/composite/composite.c | 6 +++- source4/libcli/dgram/dgramsocket.c | 6 +--- source4/libcli/ldap/ldap_bind.c | 5 ++-- source4/libcli/ldap/ldap_client.c | 12 +++----- source4/libcli/nbt/nbtsocket.c | 6 +--- source4/libcli/raw/clisocket.c | 22 ++++---------- source4/libcli/resolve/host.c | 1 - source4/libcli/resolve/nbtlist.c | 3 +- source4/libcli/resolve/resolve.c | 13 +++----- source4/libcli/smb_composite/connect.c | 8 ++--- source4/libcli/smb_composite/fetchfile.c | 2 -- source4/libcli/smb_composite/fsinfo.c | 2 -- source4/libcli/wrepl/winsrepl.c | 6 +--- source4/libnet/libnet_site.c | 8 ++--- source4/librpc/rpc/dcerpc.c | 15 +++------- source4/librpc/rpc/dcerpc_connect.c | 15 ---------- source4/rpc_server/spoolss/dcesrv_spoolss.c | 3 +- source4/torture/auth/ntlmssp.c | 6 ++-- source4/torture/basic/base.c | 3 +- source4/torture/gentest.c | 33 +++++++++++++-------- source4/torture/ldap/cldap.c | 8 +++-- source4/torture/ldap/cldapbench.c | 4 ++- source4/torture/ldap/common.c | 2 +- source4/torture/libnet/libnet_domain.c | 4 +-- source4/torture/locktest.c | 26 ++++++++++------ source4/torture/locktest2.c | 26 +++++++++++----- source4/torture/masktest.c | 9 ++++-- source4/torture/nbt/browse.c | 2 +- source4/torture/nbt/dgram.c | 6 ++-- source4/torture/nbt/nbt.c | 2 +- source4/torture/nbt/query.c | 2 +- source4/torture/nbt/register.c | 4 +-- source4/torture/nbt/wins.c | 2 +- source4/torture/nbt/winsbench.c | 2 +- source4/torture/nbt/winsreplication.c | 18 +++++------ source4/torture/raw/composite.c | 4 +-- source4/torture/rpc/dssync.c | 10 +++---- source4/torture/rpc/join.c | 4 +-- source4/torture/rpc/rpc.c | 8 ++--- source4/torture/rpc/samba3rpc.c | 12 ++++---- source4/torture/rpc/samlogon.c | 2 +- source4/torture/rpc/samsync.c | 4 +-- source4/torture/rpc/schannel.c | 10 +++---- source4/torture/rpc/session_key.c | 6 +++- source4/torture/unix/unix_info2.c | 4 +-- source4/torture/unix/whoami.c | 2 +- source4/utils/nmblookup.c | 14 ++++++--- source4/utils/ntlm_auth.c | 10 +++---- 60 files changed, 275 insertions(+), 247 deletions(-) diff --git a/source4/auth/gensec/gensec.c b/source4/auth/gensec/gensec.c index 59ad15740e..c82b719dfd 100644 --- a/source4/auth/gensec/gensec.c +++ b/source4/auth/gensec/gensec.c @@ -482,6 +482,11 @@ static NTSTATUS gensec_start(TALLOC_CTX *mem_ctx, struct messaging_context *msg, struct gensec_security **gensec_security) { + if (ev == NULL) { + DEBUG(0, ("No event context available!\n")); + return NT_STATUS_INTERNAL_ERROR; + } + (*gensec_security) = talloc(mem_ctx, struct gensec_security); NT_STATUS_HAVE_NO_MEMORY(*gensec_security); @@ -493,14 +498,6 @@ static NTSTATUS gensec_start(TALLOC_CTX *mem_ctx, (*gensec_security)->subcontext = false; (*gensec_security)->want_features = 0; - - if (ev == NULL) { - ev = event_context_init(*gensec_security); - if (ev == NULL) { - talloc_free(*gensec_security); - return NT_STATUS_NO_MEMORY; - } - } (*gensec_security)->event_ctx = ev; (*gensec_security)->msg_ctx = msg; @@ -548,20 +545,11 @@ _PUBLIC_ NTSTATUS gensec_client_start(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx) { NTSTATUS status; - struct event_context *new_ev = NULL; - - if (ev == NULL) { - new_ev = event_context_init(mem_ctx); - NT_STATUS_HAVE_NO_MEMORY(new_ev); - ev = new_ev; - } status = gensec_start(mem_ctx, ev, lp_ctx, NULL, gensec_security); if (!NT_STATUS_IS_OK(status)) { - talloc_free(new_ev); return status; } - talloc_steal((*gensec_security), new_ev); (*gensec_security)->gensec_role = GENSEC_CLIENT; return status; diff --git a/source4/client/cifsdd.c b/source4/client/cifsdd.c index 8e25dab927..ce48c7bad1 100644 --- a/source4/client/cifsdd.c +++ b/source4/client/cifsdd.c @@ -24,6 +24,7 @@ #include "lib/cmdline/popt_common.h" #include "libcli/resolve/resolve.h" #include "libcli/raw/libcliraw.h" +#include "lib/events/events.h" #include "cifsdd.h" #include "param/param.h" @@ -354,6 +355,7 @@ static void print_transfer_stats(void) } static struct dd_iohandle * open_file(struct resolve_context *resolve_ctx, + struct event_context *ev, const char * which, const char **ports, struct smbcli_options *smb_options) { @@ -375,13 +377,13 @@ static struct dd_iohandle * open_file(struct resolve_context *resolve_ctx, if (strcmp(which, "if") == 0) { path = check_arg_pathname("if"); - handle = dd_open_path(resolve_ctx, path, ports, + handle = dd_open_path(resolve_ctx, ev, path, ports, check_arg_numeric("ibs"), options, smb_options); } else if (strcmp(which, "of") == 0) { options |= DD_WRITE; path = check_arg_pathname("of"); - handle = dd_open_path(resolve_ctx, path, ports, + handle = dd_open_path(resolve_ctx, ev, path, ports, check_arg_numeric("obs"), options, smb_options); } else { @@ -396,7 +398,7 @@ static struct dd_iohandle * open_file(struct resolve_context *resolve_ctx, return(handle); } -static int copy_files(struct loadparm_context *lp_ctx) +static int copy_files(struct event_context *ev, struct loadparm_context *lp_ctx) { uint8_t * iobuf; /* IO buffer. */ uint64_t iomax; /* Size of the IO buffer. */ @@ -433,12 +435,12 @@ static int copy_files(struct loadparm_context *lp_ctx) DEBUG(4, ("IO buffer size is %llu, max xmit is %d\n", (unsigned long long)iomax, options.max_xmit)); - if (!(ifile = open_file(lp_resolve_context(lp_ctx), "if", + if (!(ifile = open_file(lp_resolve_context(lp_ctx), ev, "if", lp_smb_ports(lp_ctx), &options))) { return(FILESYS_EXIT_CODE); } - if (!(ofile = open_file(lp_resolve_context(lp_ctx), "of", + if (!(ofile = open_file(lp_resolve_context(lp_ctx), ev, "of", lp_smb_ports(lp_ctx), &options))) { return(FILESYS_EXIT_CODE); } @@ -528,6 +530,7 @@ int main(int argc, const char ** argv) { int i; const char ** dd_args; + struct event_context *ev; poptContext pctx; struct poptOption poptions[] = { @@ -578,6 +581,8 @@ int main(int argc, const char ** argv) } } + ev = event_context_init(talloc_autofree_context()); + gensec_init(cmdline_lp_ctx); dump_args(); @@ -599,7 +604,7 @@ int main(int argc, const char ** argv) CatchSignal(SIGINT, dd_handle_signal); CatchSignal(SIGUSR1, dd_handle_signal); - return(copy_files(cmdline_lp_ctx)); + return(copy_files(ev, cmdline_lp_ctx)); } /* vim: set sw=8 sts=8 ts=8 tw=79 : */ diff --git a/source4/client/cifsdd.h b/source4/client/cifsdd.h index 810c882ea9..21a4ad4882 100644 --- a/source4/client/cifsdd.h +++ b/source4/client/cifsdd.h @@ -89,8 +89,10 @@ struct dd_iohandle #define DD_OPLOCK 0x00000008 struct smbcli_options; +struct event_context; struct dd_iohandle * dd_open_path(struct resolve_context *resolve_ctx, + struct event_context *ev, const char * path, const char **ports, uint64_t io_size, int options, diff --git a/source4/client/cifsddio.c b/source4/client/cifsddio.c index 7028e85078..4297c30012 100644 --- a/source4/client/cifsddio.c +++ b/source4/client/cifsddio.c @@ -221,6 +221,7 @@ static bool smb_write_func(void * handle, uint8_t * buf, uint64_t wanted, } static struct smbcli_state * init_smb_session(struct resolve_context *resolve_ctx, + struct event_context *ev, const char * host, const char **ports, const char * share, @@ -233,8 +234,9 @@ static struct smbcli_state * init_smb_session(struct resolve_context *resolve_ct * each connection, but for now, we just use the same one for both. */ ret = smbcli_full_connection(NULL, &cli, host, ports, share, - NULL /* devtype */, cmdline_credentials, resolve_ctx, - NULL /* events */, options); + NULL /* devtype */, + cmdline_credentials, resolve_ctx, + ev, options); if (!NT_STATUS_IS_OK(ret)) { fprintf(stderr, "%s: connecting to //%s/%s: %s\n", @@ -293,6 +295,7 @@ static int open_smb_file(struct smbcli_state * cli, } static struct dd_iohandle * open_cifs_handle(struct resolve_context *resolve_ctx, + struct event_context *ev, const char * host, const char **ports, const char * share, @@ -319,7 +322,7 @@ static struct dd_iohandle * open_cifs_handle(struct resolve_context *resolve_ctx smbh->h.io_write = smb_write_func; smbh->h.io_seek = smb_seek_func; - if ((smbh->cli = init_smb_session(resolve_ctx, host, ports, share, + if ((smbh->cli = init_smb_session(resolve_ctx, ev, host, ports, share, smb_options)) == NULL) { return(NULL); } @@ -336,6 +339,7 @@ static struct dd_iohandle * open_cifs_handle(struct resolve_context *resolve_ctx /* ------------------------------------------------------------------------- */ struct dd_iohandle * dd_open_path(struct resolve_context *resolve_ctx, + struct event_context *ev, const char * path, const char **ports, uint64_t io_size, @@ -355,7 +359,7 @@ struct dd_iohandle * dd_open_path(struct resolve_context *resolve_ctx, /* Skip over leading directory separators. */ while (*remain == '/' || *remain == '\\') { remain++; } - return(open_cifs_handle(resolve_ctx, host, ports, + return(open_cifs_handle(resolve_ctx, ev, host, ports, share, remain, io_size, options, smb_options)); } diff --git a/source4/client/client.c b/source4/client/client.c index ef88913c4d..79cc1b5382 100644 --- a/source4/client/client.c +++ b/source4/client/client.c @@ -2546,7 +2546,9 @@ static void display_share_result(struct srvsvc_NetShareCtr1 *ctr1) /**************************************************************************** try and browse available shares on a host ****************************************************************************/ -static bool browse_host(struct loadparm_context *lp_ctx, const char *query_host) +static bool browse_host(struct loadparm_context *lp_ctx, + struct event_context *ev_ctx, + const char *query_host) { struct dcerpc_pipe *p; char *binding; @@ -2560,7 +2562,7 @@ static bool browse_host(struct loadparm_context *lp_ctx, const char *query_host) status = dcerpc_pipe_connect(mem_ctx, &p, binding, &ndr_table_srvsvc, - cmdline_credentials, NULL, + cmdline_credentials, ev_ctx, lp_ctx); if (!NT_STATUS_IS_OK(status)) { d_printf("Failed to connect to %s - %s\n", @@ -3022,6 +3024,7 @@ static int process_stdin(struct smbclient_context *ctx) return a connection to a server *******************************************************/ static bool do_connect(struct smbclient_context *ctx, + struct event_context *ev_ctx, struct resolve_context *resolve_ctx, const char *specified_server, const char **ports, const char *specified_share, @@ -3045,8 +3048,7 @@ static bool do_connect(struct smbclient_context *ctx, status = smbcli_full_connection(ctx, &ctx->cli, server, ports, share, NULL, cred, resolve_ctx, - event_context_init(NULL), - options); + ev_ctx, options); if (!NT_STATUS_IS_OK(status)) { d_printf("Connection to \\\\%s\\%s failed - %s\n", server, share, nt_errstr(status)); @@ -3060,9 +3062,12 @@ static bool do_connect(struct smbclient_context *ctx, /**************************************************************************** handle a -L query ****************************************************************************/ -static int do_host_query(struct loadparm_context *lp_ctx, const char *query_host, const char *workgroup) +static int do_host_query(struct loadparm_context *lp_ctx, + struct event_context *ev_ctx, + const char *query_host, + const char *workgroup) { - browse_host(lp_ctx, query_host); + browse_host(lp_ctx, ev_ctx, query_host); list_servers(workgroup); return(0); } @@ -3071,7 +3076,12 @@ static int do_host_query(struct loadparm_context *lp_ctx, const char *query_host /**************************************************************************** handle a message operation ****************************************************************************/ -static int do_message_op(const char *netbios_name, const char *desthost, const char **destports, const char *destip, int name_type, struct resolve_context *resolve_ctx, struct smbcli_options *options) +static int do_message_op(const char *netbios_name, const char *desthost, + const char **destports, const char *destip, + int name_type, + struct event_context *ev_ctx, + struct resolve_context *resolve_ctx, + struct smbcli_options *options) { struct nbt_name called, calling; const char *server_name; @@ -3083,7 +3093,9 @@ static int do_message_op(const char *netbios_name, const char *desthost, const c server_name = destip ? destip : desthost; - if (!(cli=smbcli_state_init(NULL)) || !smbcli_socket_connect(cli, server_name, destports, resolve_ctx, options)) { + if (!(cli = smbcli_state_init(NULL)) || + !smbcli_socket_connect(cli, server_name, destports, + ev_ctx, resolve_ctx, options)) { d_printf("Connection to %s failed\n", server_name); return 1; } @@ -3124,6 +3136,7 @@ static int do_message_op(const char *netbios_name, const char *desthost, const c int rc = 0; int name_type = 0x20; TALLOC_CTX *mem_ctx; + struct event_context *ev_ctx; struct smbclient_context *ctx; const char *cmdstr = NULL; struct smbcli_options smb_options; @@ -3221,6 +3234,8 @@ static int do_message_op(const char *netbios_name, const char *desthost, const c lp_smbcli_options(cmdline_lp_ctx, &smb_options); + ev_ctx = event_context_init(talloc_autofree_context()); + DEBUG( 3, ( "Client started (version %s).\n", SAMBA_VERSION_STRING ) ); if (query_host && (p=strchr_m(query_host,'#'))) { @@ -3230,14 +3245,23 @@ static int do_message_op(const char *netbios_name, const char *desthost, const c } if (query_host) { - return do_host_query(cmdline_lp_ctx, query_host, lp_workgroup(cmdline_lp_ctx)); + rc = do_host_query(cmdline_lp_ctx, ev_ctx, query_host, + lp_workgroup(cmdline_lp_ctx)); + return rc; } if (message) { - return do_message_op(lp_netbios_name(cmdline_lp_ctx), desthost, lp_smb_ports(cmdline_lp_ctx), dest_ip, name_type, lp_resolve_context(cmdline_lp_ctx), &smb_options); + rc = do_message_op(lp_netbios_name(cmdline_lp_ctx), desthost, + lp_smb_ports(cmdline_lp_ctx), dest_ip, + name_type, ev_ctx, + lp_resolve_context(cmdline_lp_ctx), + &smb_options); + return rc; } - if (!do_connect(ctx, lp_resolve_context(cmdline_lp_ctx), desthost, lp_smb_ports(cmdline_lp_ctx), service, cmdline_credentials, &smb_options)) + if (!do_connect(ctx, ev_ctx, lp_resolve_context(cmdline_lp_ctx), + desthost, lp_smb_ports(cmdline_lp_ctx), service, + cmdline_credentials, &smb_options)) return 1; if (base_directory) 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); diff --git a/source4/libcli/cldap/cldap.c b/source4/libcli/cldap/cldap.c index d9910285d9..614bd51d2a 100644 --- a/source4/libcli/cldap/cldap.c +++ b/source4/libcli/cldap/cldap.c @@ -250,11 +250,7 @@ struct cldap_socket *cldap_socket_init(TALLOC_CTX *mem_ctx, cldap = talloc(mem_ctx, struct cldap_socket); if (cldap == NULL) goto failed; - if (event_ctx == NULL) { - cldap->event_ctx = event_context_init(cldap); - } else { - cldap->event_ctx = talloc_reference(cldap, event_ctx); - } + cldap->event_ctx = talloc_reference(cldap, event_ctx); if (cldap->event_ctx == NULL) goto failed; cldap->idr = idr_init(cldap); diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 4858a96110..c20a7fd935 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -33,13 +33,14 @@ */ bool smbcli_socket_connect(struct smbcli_state *cli, const char *server, const char **ports, + struct event_context *ev_ctx, struct resolve_context *resolve_ctx, struct smbcli_options *options) { struct smbcli_socket *sock; - sock = smbcli_sock_connect_byname(server, ports, NULL, resolve_ctx, - NULL); + sock = smbcli_sock_connect_byname(server, ports, NULL, + resolve_ctx, ev_ctx); if (sock == NULL) return false; diff --git a/source4/libcli/composite/composite.c b/source4/libcli/composite/composite.c index 26169e7838..966f56cba8 100644 --- a/source4/libcli/composite/composite.c +++ b/source4/libcli/composite/composite.c @@ -42,7 +42,11 @@ _PUBLIC_ struct composite_context *composite_create(TALLOC_CTX *mem_ctx, c = talloc_zero(mem_ctx, struct composite_context); if (!c) return NULL; c->state = COMPOSITE_STATE_IN_PROGRESS; - c->event_ctx = ev; + c->event_ctx = talloc_reference(c, ev); + if (!c->event_ctx) { + talloc_free(c); + return NULL; + } return c; } diff --git a/source4/libcli/dgram/dgramsocket.c b/source4/libcli/dgram/dgramsocket.c index 130d8ae870..06b7bd5771 100644 --- a/source4/libcli/dgram/dgramsocket.c +++ b/source4/libcli/dgram/dgramsocket.c @@ -167,11 +167,7 @@ struct nbt_dgram_socket *nbt_dgram_socket_init(TALLOC_CTX *mem_ctx, dgmsock = talloc(mem_ctx, struct nbt_dgram_socket); if (dgmsock == NULL) goto failed; - if (event_ctx == NULL) { - dgmsock->event_ctx = event_context_init(dgmsock); - } else { - dgmsock->event_ctx = talloc_reference(dgmsock, event_ctx); - } + dgmsock->event_ctx = talloc_reference(dgmsock, event_ctx); if (dgmsock->event_ctx == NULL) goto failed; status = socket_create("ip", SOCKET_TYPE_DGRAM, &dgmsock->sock, 0); diff --git a/source4/libcli/ldap/ldap_bind.c b/source4/libcli/ldap/ldap_bind.c index 2c04edf950..e1569e7296 100644 --- a/source4/libcli/ldap/ldap_bind.c +++ b/source4/libcli/ldap/ldap_bind.c @@ -200,7 +200,7 @@ static struct ldap_message *new_ldap_sasl_bind_msg(struct ldap_connection *conn, /* perform a sasl bind using the given credentials */ -_PUBLIC_ NTSTATUS ldap_bind_sasl(struct ldap_connection *conn, +_PUBLIC_ NTSTATUS ldap_bind_sasl(struct ldap_connection *conn, struct cli_credentials *creds, struct loadparm_context *lp_ctx) { @@ -223,7 +223,8 @@ _PUBLIC_ NTSTATUS ldap_bind_sasl(struct ldap_connection *conn, gensec_init(lp_ctx); - status = gensec_client_start(conn, &conn->gensec, NULL, lp_ctx); + status = gensec_client_start(conn, &conn->gensec, + conn->event.event_ctx, lp_ctx); if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("Failed to start GENSEC engine (%s)\n", nt_errstr(status))); goto failed; diff --git a/source4/libcli/ldap/ldap_client.c b/source4/libcli/ldap/ldap_client.c index 296a7b11f2..bca867b033 100644 --- a/source4/libcli/ldap/ldap_client.c +++ b/source4/libcli/ldap/ldap_client.c @@ -48,17 +48,13 @@ _PUBLIC_ struct ldap_connection *ldap4_new_connection(TALLOC_CTX *mem_ctx, { struct ldap_connection *conn; - conn = talloc_zero(mem_ctx, struct ldap_connection); - if (conn == NULL) { + if (ev == NULL) { return NULL; } - if (ev == NULL) { - ev = event_context_init(conn); - if (ev == NULL) { - talloc_free(conn); - return NULL; - } + conn = talloc_zero(mem_ctx, struct ldap_connection); + if (conn == NULL) { + return NULL; } conn->next_messageid = 1; diff --git a/source4/libcli/nbt/nbtsocket.c b/source4/libcli/nbt/nbtsocket.c index 747127980a..5d4611e2d9 100644 --- a/source4/libcli/nbt/nbtsocket.c +++ b/source4/libcli/nbt/nbtsocket.c @@ -318,11 +318,7 @@ _PUBLIC_ struct nbt_name_socket *nbt_name_socket_init(TALLOC_CTX *mem_ctx, nbtsock = talloc(mem_ctx, struct nbt_name_socket); if (nbtsock == NULL) goto failed; - if (event_ctx == NULL) { - nbtsock->event_ctx = event_context_init(nbtsock); - } else { - nbtsock->event_ctx = talloc_reference(nbtsock, event_ctx); - } + nbtsock->event_ctx = talloc_reference(nbtsock, event_ctx); if (nbtsock->event_ctx == NULL) goto failed; status = socket_create("ip", SOCKET_TYPE_DGRAM, &nbtsock->sock, 0); diff --git a/source4/libcli/raw/clisocket.c b/source4/libcli/raw/clisocket.c index 1dcf2d1c53..49838e8a1c 100644 --- a/source4/libcli/raw/clisocket.c +++ b/source4/libcli/raw/clisocket.c @@ -59,12 +59,7 @@ struct composite_context *smbcli_sock_connect_send(TALLOC_CTX *mem_ctx, if (result == NULL) goto failed; result->state = COMPOSITE_STATE_IN_PROGRESS; - if (event_ctx != NULL) { - result->event_ctx = talloc_reference(result, event_ctx); - } else { - result->event_ctx = event_context_init(result); - } - + result->event_ctx = talloc_reference(result, event_ctx); if (result->event_ctx == NULL) goto failed; state = talloc(result, struct sock_connect_state); @@ -202,6 +197,11 @@ _PUBLIC_ struct smbcli_socket *smbcli_sock_connect_byname(const char *host, cons TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx); struct smbcli_socket *result; + if (event_ctx == NULL) { + DEBUG(0, ("Invalid NULL event context passed in as parameter\n")); + return NULL; + } + if (tmp_ctx == NULL) { DEBUG(0, ("talloc_new failed\n")); return NULL; @@ -214,16 +214,6 @@ _PUBLIC_ struct smbcli_socket *smbcli_sock_connect_byname(const char *host, cons return NULL; } - if (event_ctx == NULL) { - event_ctx = event_context_init(mem_ctx); - } - - if (event_ctx == NULL) { - DEBUG(0, ("event_context_init failed\n")); - talloc_free(tmp_ctx); - return NULL; - } - /* allow hostnames of the form NAME#xx and do a netbios lookup */ if ((p = strchr(name, '#'))) { name_type = strtol(p+1, NULL, 16); diff --git a/source4/libcli/resolve/host.c b/source4/libcli/resolve/host.c index 4b8f3f9553..1a695432ee 100644 --- a/source4/libcli/resolve/host.c +++ b/source4/libcli/resolve/host.c @@ -135,7 +135,6 @@ struct composite_context *resolve_name_host_send(TALLOC_CTX *mem_ctx, c = composite_create(mem_ctx, event_ctx); if (c == NULL) return NULL; - c->event_ctx = talloc_reference(c, event_ctx); if (composite_nomem(c->event_ctx, c)) return c; state = talloc(c, struct host_state); diff --git a/source4/libcli/resolve/nbtlist.c b/source4/libcli/resolve/nbtlist.c index 887bdd7ecf..8f085c5404 100644 --- a/source4/libcli/resolve/nbtlist.c +++ b/source4/libcli/resolve/nbtlist.c @@ -110,10 +110,9 @@ struct composite_context *resolve_name_nbtlist_send(TALLOC_CTX *mem_ctx, struct nbtlist_state *state; int i; - c = composite_create(event_ctx, event_ctx); + c = composite_create(mem_ctx, event_ctx); if (c == NULL) return NULL; - c->event_ctx = talloc_reference(c, event_ctx); if (composite_nomem(c->event_ctx, c)) return c; state = talloc(c, struct nbtlist_state); diff --git a/source4/libcli/resolve/resolve.c b/source4/libcli/resolve/resolve.c index 33ace09443..aaf9ff1f8d 100644 --- a/source4/libcli/resolve/resolve.c +++ b/source4/libcli/resolve/resolve.c @@ -136,19 +136,14 @@ struct composite_context *resolve_name_send(struct resolve_context *ctx, struct composite_context *c; struct resolve_state *state; - c = composite_create(event_ctx, event_ctx); - if (c == NULL) return NULL; - - if (ctx == NULL) { + if (ctx == NULL || event_ctx == NULL) { composite_error(c, NT_STATUS_INVALID_PARAMETER); return c; } - if (event_ctx == NULL) { - c->event_ctx = event_context_init(c); - } else { - c->event_ctx = talloc_reference(c, event_ctx); - } + c = composite_create(ctx, event_ctx); + if (c == NULL) return NULL; + if (composite_nomem(c->event_ctx, c)) return c; state = talloc(c, struct resolve_state); diff --git a/source4/libcli/smb_composite/connect.c b/source4/libcli/smb_composite/connect.c index c44c62f868..c4abfa5e37 100644 --- a/source4/libcli/smb_composite/connect.c +++ b/source4/libcli/smb_composite/connect.c @@ -451,17 +451,15 @@ struct composite_context *smb_composite_connect_send(struct smb_composite_connec c = talloc_zero(mem_ctx, struct composite_context); if (c == NULL) goto failed; + c->event_ctx = talloc_reference(c, event_ctx); + if (c->event_ctx == NULL) goto failed; + state = talloc_zero(c, struct connect_state); if (state == NULL) goto failed; - if (event_ctx == NULL) { - event_ctx = event_context_init(mem_ctx); - } - state->io = io; c->state = COMPOSITE_STATE_IN_PROGRESS; - c->event_ctx = talloc_reference(c, event_ctx); c->private_data = state; state->stage = CONNECT_RESOLVE; diff --git a/source4/libcli/smb_composite/fetchfile.c b/source4/libcli/smb_composite/fetchfile.c index d8d7481270..9cd02a51f4 100644 --- a/source4/libcli/smb_composite/fetchfile.c +++ b/source4/libcli/smb_composite/fetchfile.c @@ -62,7 +62,6 @@ static NTSTATUS fetchfile_connect(struct composite_context *c, state->creq->async.fn = fetchfile_composite_handler; state->stage = FETCHFILE_READ; - c->event_ctx = talloc_reference(c, state->creq->event_ctx); return NT_STATUS_OK; } @@ -158,7 +157,6 @@ struct composite_context *smb_composite_fetchfile_send(struct smb_composite_fetc c->state = COMPOSITE_STATE_IN_PROGRESS; state->stage = FETCHFILE_CONNECT; - c->event_ctx = talloc_reference(c, state->creq->event_ctx); c->private_data = state; return c; diff --git a/source4/libcli/smb_composite/fsinfo.c b/source4/libcli/smb_composite/fsinfo.c index 2ec13df9b6..270d71f518 100644 --- a/source4/libcli/smb_composite/fsinfo.c +++ b/source4/libcli/smb_composite/fsinfo.c @@ -52,7 +52,6 @@ static NTSTATUS fsinfo_connect(struct composite_context *c, state->req->async.fn = fsinfo_raw_handler; state->stage = FSINFO_QUERY; - c->event_ctx = talloc_reference(c, state->req->session->transport->socket->event.ctx); return NT_STATUS_OK; } @@ -158,7 +157,6 @@ struct composite_context *smb_composite_fsinfo_send(struct smbcli_tree *tree, c->state = COMPOSITE_STATE_IN_PROGRESS; state->stage = FSINFO_CONNECT; - c->event_ctx = talloc_reference(c, tree->session->transport->socket->event.ctx); c->private_data = state; state->creq = smb_composite_connect_send(state->connect, state, diff --git a/source4/libcli/wrepl/winsrepl.c b/source4/libcli/wrepl/winsrepl.c index 3e7793c0c7..0a4e52bd7b 100644 --- a/source4/libcli/wrepl/winsrepl.c +++ b/source4/libcli/wrepl/winsrepl.c @@ -172,11 +172,7 @@ struct wrepl_socket *wrepl_socket_init(TALLOC_CTX *mem_ctx, wrepl_socket = talloc_zero(mem_ctx, struct wrepl_socket); if (!wrepl_socket) return NULL; - if (event_ctx == NULL) { - wrepl_socket->event.ctx = event_context_init(wrepl_socket); - } else { - wrepl_socket->event.ctx = talloc_reference(wrepl_socket, event_ctx); - } + wrepl_socket->event.ctx = talloc_reference(wrepl_socket, event_ctx); if (!wrepl_socket->event.ctx) goto failed; wrepl_socket->iconv_convenience = iconv_convenience; diff --git a/source4/libnet/libnet_site.c b/source4/libnet/libnet_site.c index dabd23a5be..f39d9e039c 100644 --- a/source4/libnet/libnet_site.c +++ b/source4/libnet/libnet_site.c @@ -30,7 +30,7 @@ * 1. Setup a CLDAP socket. * 2. Lookup the default Site-Name. */ -NTSTATUS libnet_FindSite(TALLOC_CTX *ctx, struct libnet_JoinSite *r) +NTSTATUS libnet_FindSite(TALLOC_CTX *ctx, struct libnet_context *lctx, struct libnet_JoinSite *r) { NTSTATUS status; TALLOC_CTX *tmp_ctx; @@ -55,7 +55,7 @@ NTSTATUS libnet_FindSite(TALLOC_CTX *ctx, struct libnet_JoinSite *r) search.in.acct_control = -1; search.in.version = 6; - cldap = cldap_socket_init(tmp_ctx, NULL, lp_iconv_convenience(global_loadparm)); + cldap = cldap_socket_init(tmp_ctx, lctx->event_ctx, lp_iconv_convenience(global_loadparm)); status = cldap_netlogon(cldap, tmp_ctx, &search); if (!NT_STATUS_IS_OK(status)) { /* @@ -148,7 +148,7 @@ NTSTATUS libnet_JoinSite(struct libnet_context *ctx, } make_nbt_name_client(&name, libnet_r->out.samr_binding->host); - status = resolve_name(lp_resolve_context(ctx->lp_ctx), &name, r, &dest_addr, NULL); + status = resolve_name(lp_resolve_context(ctx->lp_ctx), &name, r, &dest_addr, ctx->event_ctx); if (!NT_STATUS_IS_OK(status)) { libnet_r->out.error_string = NULL; talloc_free(tmp_ctx); @@ -161,7 +161,7 @@ NTSTATUS libnet_JoinSite(struct libnet_context *ctx, r->in.domain_dn_str = libnet_r->out.domain_dn_str; r->in.cldap_port = lp_cldap_port(ctx->lp_ctx); - status = libnet_FindSite(tmp_ctx, r); + status = libnet_FindSite(tmp_ctx, ctx, r); if (!NT_STATUS_IS_OK(status)) { libnet_r->out.error_string = talloc_steal(libnet_r, r->out.error_string); diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c index 5e32f6f5bf..4758189d3b 100644 --- a/source4/librpc/rpc/dcerpc.c +++ b/source4/librpc/rpc/dcerpc.c @@ -67,22 +67,15 @@ static struct dcerpc_connection *dcerpc_connection_init(TALLOC_CTX *mem_ctx, return NULL; } - if (ev == NULL) { - ev = event_context_init(c); - if (ev == NULL) { - talloc_free(c); - return NULL; - } - } - c->iconv_convenience = talloc_reference(c, ic); - c->event_ctx = ev; - - if (!talloc_reference(c, ev)) { + c->event_ctx = talloc_reference(c, ev); + + if (c->event_ctx == NULL) { talloc_free(c); return NULL; } + c->call_id = 1; c->security_state.auth_info = NULL; c->security_state.session_key = dcerpc_generic_session_key; diff --git a/source4/librpc/rpc/dcerpc_connect.c b/source4/librpc/rpc/dcerpc_connect.c index cc7f2ddbaa..a22cad9a4a 100644 --- a/source4/librpc/rpc/dcerpc_connect.c +++ b/source4/librpc/rpc/dcerpc_connect.c @@ -717,12 +717,6 @@ _PUBLIC_ struct composite_context* dcerpc_pipe_connect_b_send(TALLOC_CTX *parent struct pipe_connect_state *s; struct event_context *new_ev = NULL; - if (ev == NULL) { - new_ev = event_context_init(parent_ctx); - if (new_ev == NULL) return NULL; - ev = new_ev; - } - /* composite context allocation and setup */ c = composite_create(parent_ctx, ev); if (c == NULL) { @@ -844,21 +838,12 @@ _PUBLIC_ struct composite_context* dcerpc_pipe_connect_send(TALLOC_CTX *parent_c struct pipe_conn_state *s; struct dcerpc_binding *b; struct composite_context *pipe_conn_req; - struct event_context *new_ev = NULL; - - if (ev == NULL) { - new_ev = event_context_init(parent_ctx); - if (new_ev == NULL) return NULL; - ev = new_ev; - } /* composite context allocation and setup */ c = composite_create(parent_ctx, ev); if (c == NULL) { - talloc_free(new_ev); return NULL; } - talloc_steal(c, new_ev); s = talloc_zero(c, struct pipe_conn_state); if (composite_nomem(s, c)) return c; diff --git a/source4/rpc_server/spoolss/dcesrv_spoolss.c b/source4/rpc_server/spoolss/dcesrv_spoolss.c index 46270727a4..28e30002e2 100644 --- a/source4/rpc_server/spoolss/dcesrv_spoolss.c +++ b/source4/rpc_server/spoolss/dcesrv_spoolss.c @@ -1156,7 +1156,8 @@ static WERROR dcesrv_spoolss_RemoteFindFirstPrinterChangeNotifyEx(struct dcesrv_ creds = cli_credentials_init_anon(mem_ctx); /* FIXME: Use machine credentials instead ? */ status = dcerpc_pipe_connect_b(mem_ctx, &p, binding, &ndr_table_spoolss, - creds, NULL, dce_call->conn->dce_ctx->lp_ctx); + creds, dce_call->event_ctx, + dce_call->conn->dce_ctx->lp_ctx); if (NT_STATUS_IS_ERR(status)) { DEBUG(0, ("unable to call back to %s\n", r->in.str)); diff --git a/source4/torture/auth/ntlmssp.c b/source4/torture/auth/ntlmssp.c index 917a24ad59..739a048d29 100644 --- a/source4/torture/auth/ntlmssp.c +++ b/source4/torture/auth/ntlmssp.c @@ -33,7 +33,8 @@ static bool torture_ntlmssp_self_check(struct torture_context *tctx) TALLOC_CTX *mem_ctx = tctx; torture_assert_ntstatus_ok(tctx, - gensec_client_start(mem_ctx, &gensec_security, NULL, tctx->lp_ctx), + gensec_client_start(mem_ctx, &gensec_security, + tctx->ev, tctx->lp_ctx), "gensec client start"); gensec_set_credentials(gensec_security, cmdline_credentials); @@ -87,7 +88,8 @@ static bool torture_ntlmssp_self_check(struct torture_context *tctx) talloc_free(gensec_security); torture_assert_ntstatus_ok(tctx, - gensec_client_start(mem_ctx, &gensec_security, NULL, tctx->lp_ctx), + gensec_client_start(mem_ctx, &gensec_security, + tctx->ev, tctx->lp_ctx), "Failed to start GENSEC for NTLMSSP"); gensec_set_credentials(gensec_security, cmdline_credentials); diff --git a/source4/torture/basic/base.c b/source4/torture/basic/base.c index 3a3a7c2fd5..966d436935 100644 --- a/source4/torture/basic/base.c +++ b/source4/torture/basic/base.c @@ -55,7 +55,8 @@ static struct smbcli_state *open_nbt_connection(struct torture_context *tctx) lp_smbcli_options(tctx->lp_ctx, &options); - if (!smbcli_socket_connect(cli, host, lp_smb_ports(tctx->lp_ctx), lp_resolve_context(tctx->lp_ctx), &options)) { + if (!smbcli_socket_connect(cli, host, lp_smb_ports(tctx->lp_ctx), tctx->ev, + lp_resolve_context(tctx->lp_ctx), &options)) { torture_comment(tctx, "Failed to connect with %s\n", host); goto failed; } diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c index 6d872c687b..ae18fe809c 100644 --- a/source4/torture/gentest.c +++ b/source4/torture/gentest.c @@ -19,6 +19,7 @@ #include "includes.h" #include "lib/cmdline/popt_common.h" +#include "lib/events/events.h" #include "system/time.h" #include "system/filesys.h" #include "libcli/raw/request.h" @@ -154,7 +155,8 @@ static bool connect_servers_fast(void) /***************************************************** connect to the servers *******************************************************/ -static bool connect_servers(struct loadparm_context *lp_ctx) +static bool connect_servers(struct event_context *ev, + struct loadparm_context *lp_ctx) { int i, j; @@ -193,7 +195,7 @@ static bool connect_servers(struct loadparm_context *lp_ctx) servers[i].share_name, NULL, servers[i].credentials, lp_resolve_context(lp_ctx), - NULL, &smb_options); + ev, &smb_options); if (!NT_STATUS_IS_OK(status)) { printf("Failed to connect to \\\\%s\\%s - %s\n", servers[i].server_name, servers[i].share_name, @@ -1937,11 +1939,11 @@ static struct { run the test with the current set of op_parms parameters return the number of operations that completed successfully */ -static int run_test(struct loadparm_context *lp_ctx) +static int run_test(struct event_context *ev, struct loadparm_context *lp_ctx) { int op, i; - if (!connect_servers(lp_ctx)) { + if (!connect_servers(ev, lp_ctx)) { printf("Failed to connect to servers\n"); exit(1); } @@ -2018,7 +2020,8 @@ static int run_test(struct loadparm_context *lp_ctx) perform a backtracking analysis of the minimal set of operations to generate an error */ -static void backtrack_analyze(struct loadparm_context *lp_ctx) +static void backtrack_analyze(struct event_context *ev, + struct loadparm_context *lp_ctx) { int chunk, ret; @@ -2039,7 +2042,7 @@ static void backtrack_analyze(struct loadparm_context *lp_ctx) } printf("Testing %d ops with %d-%d disabled\n", options.numops, base, max-1); - ret = run_test(lp_ctx); + ret = run_test(ev, lp_ctx); printf("Completed %d of %d ops\n", ret, options.numops); for (i=base;i 0); printf("Reduced to %d ops\n", options.numops); - ret = run_test(lp_ctx); + ret = run_test(ev, lp_ctx); if (ret != options.numops - 1) { printf("Inconsistent result? ret=%d numops=%d\n", ret, options.numops); } @@ -2080,7 +2083,8 @@ static void backtrack_analyze(struct loadparm_context *lp_ctx) /* start the main gentest process */ -static bool start_gentest(struct loadparm_context *lp_ctx) +static bool start_gentest(struct event_context *ev, + struct loadparm_context *lp_ctx) { int op; int ret; @@ -2116,15 +2120,15 @@ static bool start_gentest(struct loadparm_context *lp_ctx) } } - ret = run_test(lp_ctx); + ret = run_test(ev, lp_ctx); if (ret != options.numops && options.analyze) { options.numops = ret+1; - backtrack_analyze(lp_ctx); + backtrack_analyze(ev, lp_ctx); } else if (options.analyze_always) { - backtrack_analyze(lp_ctx); + backtrack_analyze(ev, lp_ctx); } else if (options.analyze_continuous) { - while (run_test(lp_ctx) == options.numops) ; + while (run_test(ev, lp_ctx) == options.numops) ; } return ret == options.numops; @@ -2171,6 +2175,7 @@ static bool split_unc_name(const char *unc, char **server, char **share) int i, username_count=0; bool ret; char *ignore_file=NULL; + struct event_context *ev; struct loadparm_context *lp_ctx; poptContext pc; int argc_new; @@ -2278,9 +2283,11 @@ static bool split_unc_name(const char *unc, char **server, char **share) printf("seed=%u\n", options.seed); + ev = event_context_init(talloc_autofree_context()); + gensec_init(lp_ctx); - ret = start_gentest(lp_ctx); + ret = start_gentest(ev, lp_ctx); if (ret) { printf("gentest completed - no errors\n"); diff --git a/source4/torture/ldap/cldap.c b/source4/torture/ldap/cldap.c index dbe9d2f9a4..ca4d9b7705 100644 --- a/source4/torture/ldap/cldap.c +++ b/source4/torture/ldap/cldap.c @@ -38,13 +38,15 @@ */ static bool test_cldap_netlogon(struct torture_context *tctx, const char *dest) { - struct cldap_socket *cldap = cldap_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx)); + struct cldap_socket *cldap; NTSTATUS status; struct cldap_netlogon search, empty_search; union nbt_cldap_netlogon n1; struct GUID guid; int i; + cldap = cldap_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); + ZERO_STRUCT(search); search.in.dest_address = dest; search.in.dest_port = lp_cldap_port(tctx->lp_ctx); @@ -244,13 +246,15 @@ static void cldap_dump_results(struct cldap_search *search) */ static bool test_cldap_generic(struct torture_context *tctx, const char *dest) { - struct cldap_socket *cldap = cldap_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx)); + struct cldap_socket *cldap; NTSTATUS status; struct cldap_search search; const char *attrs1[] = { "currentTime", "highestCommittedUSN", NULL }; const char *attrs2[] = { "currentTime", "highestCommittedUSN", "netlogon", NULL }; const char *attrs3[] = { "netlogon", NULL }; + cldap = cldap_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); + ZERO_STRUCT(search); search.in.dest_address = dest; search.in.dest_port = lp_cldap_port(tctx->lp_ctx); diff --git a/source4/torture/ldap/cldapbench.c b/source4/torture/ldap/cldapbench.c index 51586ac733..df2a5b0551 100644 --- a/source4/torture/ldap/cldapbench.c +++ b/source4/torture/ldap/cldapbench.c @@ -51,7 +51,7 @@ static void request_handler(struct cldap_request *req) */ static bool bench_cldap(struct torture_context *tctx, const char *address) { - struct cldap_socket *cldap = cldap_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx)); + struct cldap_socket *cldap; int num_sent=0; struct timeval tv = timeval_current(); bool ret = true; @@ -59,6 +59,8 @@ static bool bench_cldap(struct torture_context *tctx, const char *address) struct cldap_netlogon search; struct bench_state *state; + cldap = cldap_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); + state = talloc_zero(tctx, struct bench_state); ZERO_STRUCT(search); diff --git a/source4/torture/ldap/common.c b/source4/torture/ldap/common.c index 65b02ed5e8..5913163822 100644 --- a/source4/torture/ldap/common.c +++ b/source4/torture/ldap/common.c @@ -65,7 +65,7 @@ NTSTATUS torture_ldap_connection(struct torture_context *tctx, return NT_STATUS_INVALID_PARAMETER; } - *conn = ldap4_new_connection(tctx, tctx->lp_ctx, NULL); + *conn = ldap4_new_connection(tctx, tctx->lp_ctx, tctx->ev); status = ldap_connect(*conn, url); if (!NT_STATUS_IS_OK(status)) { diff --git a/source4/torture/libnet/libnet_domain.c b/source4/torture/libnet/libnet_domain.c index eb6abc45d5..7d5be368c2 100644 --- a/source4/torture/libnet/libnet_domain.c +++ b/source4/torture/libnet/libnet_domain.c @@ -201,7 +201,7 @@ bool torture_domain_close_lsa(struct torture_context *torture) mem_ctx = talloc_init("torture_domain_close_lsa"); status = dcerpc_pipe_connect_b(mem_ctx, &p, binding, &ndr_table_lsarpc, - cmdline_credentials, NULL, torture->lp_ctx); + cmdline_credentials, torture->ev, torture->lp_ctx); if (!NT_STATUS_IS_OK(status)) { d_printf("failed to connect to server: %s\n", nt_errstr(status)); ret = false; @@ -330,7 +330,7 @@ bool torture_domain_close_samr(struct torture_context *torture) mem_ctx = talloc_init("torture_domain_close_samr"); status = dcerpc_pipe_connect_b(mem_ctx, &p, binding, &ndr_table_samr, - ctx->cred, NULL, torture->lp_ctx); + ctx->cred, torture->ev, torture->lp_ctx); if (!NT_STATUS_IS_OK(status)) { d_printf("failed to connect to server: %s\n", nt_errstr(status)); ret = false; diff --git a/source4/torture/locktest.c b/source4/torture/locktest.c index 618568acf9..8959232edb 100644 --- a/source4/torture/locktest.c +++ b/source4/torture/locktest.c @@ -19,6 +19,7 @@ #include "includes.h" #include "lib/cmdline/popt_common.h" +#include "lib/events/events.h" #include "system/filesys.h" #include "system/time.h" #include "pstring.h" @@ -107,7 +108,8 @@ static struct record *recorded; /***************************************************** return a connection to a server *******************************************************/ -static struct smbcli_state *connect_one(struct loadparm_context *lp_ctx, +static struct smbcli_state *connect_one(struct event_context *ev, + struct loadparm_context *lp_ctx, char *share, int snum, int conn) { struct smbcli_state *c; @@ -162,7 +164,7 @@ static struct smbcli_state *connect_one(struct loadparm_context *lp_ctx, share, NULL, servers[snum], lp_resolve_context(lp_ctx), - NULL, &options); + ev, &options); if (!NT_STATUS_IS_OK(status)) { sleep(2); } @@ -176,7 +178,8 @@ static struct smbcli_state *connect_one(struct loadparm_context *lp_ctx, } -static void reconnect(struct loadparm_context *lp_ctx, +static void reconnect(struct event_context *ev, + struct loadparm_context *lp_ctx, struct smbcli_state *cli[NSERVERS][NCONNECTIONS], int fnum[NSERVERS][NCONNECTIONS][NFILES], char *share[NSERVERS]) { @@ -193,7 +196,7 @@ static void reconnect(struct loadparm_context *lp_ctx, } talloc_free(cli[server][conn]); } - cli[server][conn] = connect_one(lp_ctx, share[server], + cli[server][conn] = connect_one(ev, lp_ctx, share[server], server, conn); if (!cli[server][conn]) { DEBUG(0,("Failed to connect to %s\n", share[server])); @@ -396,7 +399,9 @@ static int retest(struct smbcli_state *cli[NSERVERS][NCONNECTIONS], we then do random locking ops in tamdem on the 4 fnums from each server and ensure that the results match */ -static int test_locks(struct loadparm_context *lp_ctx, char *share[NSERVERS]) +static int test_locks(struct event_context *ev, + struct loadparm_context *lp_ctx, + char *share[NSERVERS]) { struct smbcli_state *cli[NSERVERS][NCONNECTIONS]; int fnum[NSERVERS][NCONNECTIONS][NFILES]; @@ -447,7 +452,7 @@ static int test_locks(struct loadparm_context *lp_ctx, char *share[NSERVERS]) #endif } - reconnect(lp_ctx, cli, fnum, share); + reconnect(ev, lp_ctx, cli, fnum, share); open_files(cli, fnum); n = retest(cli, fnum, numops); @@ -465,7 +470,7 @@ static int test_locks(struct loadparm_context *lp_ctx, char *share[NSERVERS]) n1 = n; close_files(cli, fnum); - reconnect(lp_ctx, cli, fnum, share); + reconnect(ev, lp_ctx, cli, fnum, share); open_files(cli, fnum); for (i=0;iev); if (!NT_STATUS_IS_OK(status)) { printf("Failed to resolve %s - %s\n", name.name, nt_errstr(status)); diff --git a/source4/torture/nbt/dgram.c b/source4/torture/nbt/dgram.c index a4c8be888c..a3585896eb 100644 --- a/source4/torture/nbt/dgram.c +++ b/source4/torture/nbt/dgram.c @@ -64,7 +64,7 @@ static void netlogon_handler(struct dgram_mailslot_handler *dgmslot, static bool nbt_test_netlogon(struct torture_context *tctx) { struct dgram_mailslot_handler *dgmslot; - struct nbt_dgram_socket *dgmsock = nbt_dgram_socket_init(tctx, NULL, + struct nbt_dgram_socket *dgmsock = nbt_dgram_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); struct socket_address *dest; const char *myaddress; @@ -147,7 +147,7 @@ static bool nbt_test_netlogon(struct torture_context *tctx) static bool nbt_test_netlogon2(struct torture_context *tctx) { struct dgram_mailslot_handler *dgmslot; - struct nbt_dgram_socket *dgmsock = nbt_dgram_socket_init(tctx, NULL, + struct nbt_dgram_socket *dgmsock = nbt_dgram_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); struct socket_address *dest; const char *myaddress; @@ -257,7 +257,7 @@ static void ntlogon_handler(struct dgram_mailslot_handler *dgmslot, static bool nbt_test_ntlogon(struct torture_context *tctx) { struct dgram_mailslot_handler *dgmslot; - struct nbt_dgram_socket *dgmsock = nbt_dgram_socket_init(tctx, NULL, + struct nbt_dgram_socket *dgmsock = nbt_dgram_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); struct socket_address *dest; struct test_join *join_ctx; diff --git a/source4/torture/nbt/nbt.c b/source4/torture/nbt/nbt.c index 6cb9507398..d27a26eb30 100644 --- a/source4/torture/nbt/nbt.c +++ b/source4/torture/nbt/nbt.c @@ -34,7 +34,7 @@ bool torture_nbt_get_name(struct torture_context *tctx, /* do an initial name resolution to find its IP */ torture_assert_ntstatus_ok(tctx, - resolve_name(lp_resolve_context(tctx->lp_ctx), name, tctx, address, NULL), + resolve_name(lp_resolve_context(tctx->lp_ctx), name, tctx, address, tctx->ev), talloc_asprintf(tctx, "Failed to resolve %s", name->name)); diff --git a/source4/torture/nbt/query.c b/source4/torture/nbt/query.c index 1ba6172e5c..3f3a15cca5 100644 --- a/source4/torture/nbt/query.c +++ b/source4/torture/nbt/query.c @@ -47,7 +47,7 @@ static void increment_handler(struct nbt_name_request *req) */ static bool bench_namequery(struct torture_context *tctx) { - struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, NULL, + struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); int num_sent=0; struct result_struct *result; diff --git a/source4/torture/nbt/register.c b/source4/torture/nbt/register.c index b9f06c479d..a8681f828f 100644 --- a/source4/torture/nbt/register.c +++ b/source4/torture/nbt/register.c @@ -44,7 +44,7 @@ static bool nbt_register_own(struct torture_context *tctx) { struct nbt_name_register io; NTSTATUS status; - struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, NULL, + struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); struct socket_address *socket_address; struct nbt_name name; @@ -114,7 +114,7 @@ static bool nbt_refresh_own(struct torture_context *tctx) { struct nbt_name_refresh io; NTSTATUS status; - struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, NULL, + struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); const char *myaddress; struct socket_address *socket_address; diff --git a/source4/torture/nbt/wins.c b/source4/torture/nbt/wins.c index 059b2dc919..ae20de6e2f 100644 --- a/source4/torture/nbt/wins.c +++ b/source4/torture/nbt/wins.c @@ -53,7 +53,7 @@ static bool nbt_test_wins_name(struct torture_context *tctx, const char *address struct nbt_name_refresh_wins refresh; struct nbt_name_release release; NTSTATUS status; - struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx)); + struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); const char *myaddress; struct socket_address *socket_address; struct interface *ifaces; diff --git a/source4/torture/nbt/winsbench.c b/source4/torture/nbt/winsbench.c index ea4abaf21b..a0d90fb653 100644 --- a/source4/torture/nbt/winsbench.c +++ b/source4/torture/nbt/winsbench.c @@ -225,7 +225,7 @@ static void generate_request(struct nbt_name_socket *nbtsock, struct wins_state */ static bool bench_wins(struct torture_context *tctx) { - struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx)); + struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); int num_sent=0; struct timeval tv = timeval_current(); bool ret = true; diff --git a/source4/torture/nbt/winsreplication.c b/source4/torture/nbt/winsreplication.c index 470eee8310..ee7a1510d5 100644 --- a/source4/torture/nbt/winsreplication.c +++ b/source4/torture/nbt/winsreplication.c @@ -103,8 +103,8 @@ static bool test_assoc_ctx1(struct torture_context *tctx) torture_comment(tctx, "Test if assoc_ctx is only valid on the conection it was created on\n"); - wrepl_socket1 = wrepl_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx)); - wrepl_socket2 = wrepl_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx)); + wrepl_socket1 = wrepl_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); + wrepl_socket2 = wrepl_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); torture_comment(tctx, "Setup 2 wrepl connections\n"); status = wrepl_connect(wrepl_socket1, lp_resolve_context(tctx->lp_ctx), wrepl_best_ip(tctx->lp_ctx, address), address); @@ -186,7 +186,7 @@ static bool test_assoc_ctx2(struct torture_context *tctx) torture_comment(tctx, "Test if we always get back the same assoc_ctx\n"); - wrepl_socket = wrepl_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx)); + wrepl_socket = wrepl_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); torture_comment(tctx, "Setup wrepl connections\n"); status = wrepl_connect(wrepl_socket, lp_resolve_context(tctx->lp_ctx), wrepl_best_ip(tctx->lp_ctx, address), address); @@ -255,7 +255,7 @@ static bool test_wins_replication(struct torture_context *tctx) torture_comment(tctx, "Test one pull replication cycle\n"); - wrepl_socket = wrepl_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx)); + wrepl_socket = wrepl_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); torture_comment(tctx, "Setup wrepl connections\n"); status = wrepl_connect(wrepl_socket, lp_resolve_context(tctx->lp_ctx), wrepl_best_ip(tctx->lp_ctx, address), address); @@ -553,7 +553,7 @@ static struct test_wrepl_conflict_conn *test_create_conflict_ctx( if (!ctx) return NULL; ctx->address = address; - ctx->pull = wrepl_socket_init(ctx, NULL, lp_iconv_convenience(tctx->lp_ctx)); + ctx->pull = wrepl_socket_init(ctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); if (!ctx->pull) return NULL; torture_comment(tctx, "Setup wrepl conflict pull connection\n"); @@ -610,7 +610,7 @@ static struct test_wrepl_conflict_conn *test_create_conflict_ctx( talloc_free(pull_table.out.partners); - ctx->nbtsock = nbt_name_socket_init(ctx, NULL, lp_iconv_convenience(tctx->lp_ctx)); + ctx->nbtsock = nbt_name_socket_init(ctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); if (!ctx->nbtsock) return NULL; load_interfaces(tctx, lp_interfaces(tctx->lp_ctx), &ifaces); @@ -628,7 +628,7 @@ static struct test_wrepl_conflict_conn *test_create_conflict_ctx( status = socket_listen(ctx->nbtsock->sock, ctx->myaddr, 0, 0); if (!NT_STATUS_IS_OK(status)) return NULL; - ctx->nbtsock_srv = nbt_name_socket_init(ctx, NULL, lp_iconv_convenience(tctx->lp_ctx)); + ctx->nbtsock_srv = nbt_name_socket_init(ctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); if (!ctx->nbtsock_srv) return NULL; /* Make a port 137 version of ctx->myaddr */ @@ -645,7 +645,7 @@ static struct test_wrepl_conflict_conn *test_create_conflict_ctx( } if (ctx->myaddr2 && ctx->nbtsock_srv) { - ctx->nbtsock2 = nbt_name_socket_init(ctx, NULL, lp_iconv_convenience(tctx->lp_ctx)); + ctx->nbtsock2 = nbt_name_socket_init(ctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); if (!ctx->nbtsock2) return NULL; status = socket_listen(ctx->nbtsock2->sock, ctx->myaddr2, 0, 0); @@ -722,7 +722,7 @@ static bool test_wrepl_update_one(struct torture_context *tctx, uint32_t assoc_ctx; NTSTATUS status; - wrepl_socket = wrepl_socket_init(ctx, NULL, lp_iconv_convenience(tctx->lp_ctx)); + wrepl_socket = wrepl_socket_init(ctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); status = wrepl_connect(wrepl_socket, lp_resolve_context(tctx->lp_ctx), wrepl_best_ip(tctx->lp_ctx, ctx->address), ctx->address); CHECK_STATUS(tctx, status, NT_STATUS_OK); diff --git a/source4/torture/raw/composite.c b/source4/torture/raw/composite.c index 1f31fbc515..d73ac1327e 100644 --- a/source4/torture/raw/composite.c +++ b/source4/torture/raw/composite.c @@ -296,7 +296,7 @@ static bool test_appendacl(struct smbcli_state *cli, struct torture_context *tct c[i]->async.private_data = count; } - event_ctx = talloc_reference(tctx, cli->tree->session->transport->socket->event.ctx); + event_ctx = tctx->ev; printf("waiting for completion\n"); while (*count != num_ops) { event_loop_once(event_ctx); @@ -354,7 +354,7 @@ static bool test_fsinfo(struct smbcli_state *cli, struct torture_context *tctx) printf("testing parallel queryfsinfo [Object ID] with %d ops\n", torture_numops); - event_ctx = talloc_reference(tctx, cli->tree->session->transport->socket->event.ctx); + event_ctx = tctx->ev; c = talloc_array(tctx, struct composite_context *, torture_numops); for (i=0; ipipe, ctx->drsuapi_binding, &ndr_table_drsuapi, - credentials, event, tctx->lp_ctx); + credentials, tctx->ev, tctx->lp_ctx); if (!NT_STATUS_IS_OK(status)) { printf("Failed to connect to server as a BDC: %s\n", nt_errstr(status)); @@ -254,10 +253,11 @@ static bool test_GetInfo(struct torture_context *tctx, struct DsSyncTest *ctx) struct drsuapi_DsCrackNames r; struct drsuapi_DsNameString names[1]; bool ret = true; - - struct cldap_socket *cldap = cldap_socket_init(ctx, NULL, lp_iconv_convenience(tctx->lp_ctx)); + struct cldap_socket *cldap; struct cldap_netlogon search; - + + cldap = cldap_socket_init(ctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx)); + r.in.bind_handle = &ctx->admin.drsuapi.bind_handle; r.in.level = 1; r.in.req.req1.codepage = 1252; /* western european */ diff --git a/source4/torture/rpc/join.c b/source4/torture/rpc/join.c index 849b9fd1e9..cd5eb32fa8 100644 --- a/source4/torture/rpc/join.c +++ b/source4/torture/rpc/join.c @@ -39,7 +39,7 @@ bool torture_rpc_join(struct torture_context *torture) "IPC$", NULL, machine_account, lp_resolve_context(torture->lp_ctx), - NULL, &options); + torture->ev, &options); if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("%s failed to connect to IPC$ with workstation credentials\n", TORTURE_NETBIOS_NAME)); @@ -65,7 +65,7 @@ bool torture_rpc_join(struct torture_context *torture) "IPC$", NULL, machine_account, lp_resolve_context(torture->lp_ctx), - NULL, &options); + torture->ev, &options); if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("%s failed to connect to IPC$ with workstation credentials\n", TORTURE_NETBIOS_NAME)); diff --git a/source4/torture/rpc/rpc.c b/source4/torture/rpc/rpc.c index 6e38d0465a..7c8e78b160 100644 --- a/source4/torture/rpc/rpc.c +++ b/source4/torture/rpc/rpc.c @@ -83,7 +83,7 @@ _PUBLIC_ NTSTATUS torture_rpc_connection(struct torture_context *tctx, status = dcerpc_pipe_connect_b(tctx, p, binding, table, - cmdline_credentials, NULL, tctx->lp_ctx); + cmdline_credentials, tctx->ev, tctx->lp_ctx); if (NT_STATUS_IS_ERR(status)) { printf("Failed to connect to remote server: %s %s\n", @@ -113,7 +113,7 @@ NTSTATUS torture_rpc_connection_transport(struct torture_context *tctx, binding->assoc_group_id = assoc_group_id; status = dcerpc_pipe_connect_b(tctx, p, binding, table, - cmdline_credentials, NULL, tctx->lp_ctx); + cmdline_credentials, tctx->ev, tctx->lp_ctx); if (NT_STATUS_IS_ERR(status)) { *p = NULL; @@ -147,7 +147,7 @@ static bool torture_rpc_setup_machine(struct torture_context *tctx, &(tcase_data->pipe), binding, tcase->table, - tcase_data->credentials, NULL, tctx->lp_ctx); + tcase_data->credentials, tctx->ev, tctx->lp_ctx); torture_assert_ntstatus_ok(tctx, status, "Error connecting to server"); @@ -205,7 +205,7 @@ static bool torture_rpc_setup_anonymous(struct torture_context *tctx, &(tcase_data->pipe), binding, tcase->table, - tcase_data->credentials, NULL, tctx->lp_ctx); + tcase_data->credentials, tctx->ev, tctx->lp_ctx); torture_assert_ntstatus_ok(tctx, status, "Error connecting to server"); diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c index 8eb1f54b4f..40a7c156f4 100644 --- a/source4/torture/rpc/samba3rpc.c +++ b/source4/torture/rpc/samba3rpc.c @@ -89,7 +89,7 @@ bool torture_bind_authcontext(struct torture_context *torture) lp_smb_ports(torture->lp_ctx), "IPC$", NULL, cmdline_credentials, lp_resolve_context(torture->lp_ctx), - NULL, &options); + torture->ev, &options); if (!NT_STATUS_IS_OK(status)) { d_printf("smbcli_full_connection failed: %s\n", nt_errstr(status)); @@ -303,7 +303,7 @@ bool torture_bind_samba3(struct torture_context *torture) lp_smb_ports(torture->lp_ctx), "IPC$", NULL, cmdline_credentials, lp_resolve_context(torture->lp_ctx), - NULL, &options); + torture->ev, &options); if (!NT_STATUS_IS_OK(status)) { d_printf("smbcli_full_connection failed: %s\n", nt_errstr(status)); @@ -1220,7 +1220,7 @@ bool torture_netlogon_samba3(struct torture_context *torture) lp_smb_ports(torture->lp_ctx), "IPC$", NULL, anon_creds, lp_resolve_context(torture->lp_ctx), - NULL, &options); + torture->ev, &options); if (!NT_STATUS_IS_OK(status)) { d_printf("smbcli_full_connection failed: %s\n", nt_errstr(status)); @@ -1307,7 +1307,7 @@ static bool test_join3(struct torture_context *tctx, lp_smb_ports(tctx->lp_ctx), "IPC$", NULL, smb_creds, lp_resolve_context(tctx->lp_ctx), - NULL, &options); + tctx->ev, &options); if (!NT_STATUS_IS_OK(status)) { d_printf("smbcli_full_connection failed: %s\n", nt_errstr(status)); @@ -1682,7 +1682,7 @@ bool torture_samba3_rpc_getusername(struct torture_context *torture) lp_smb_ports(torture->lp_ctx), "IPC$", NULL, cmdline_credentials, lp_resolve_context(torture->lp_ctx), - NULL, &options); + torture->ev, &options); if (!NT_STATUS_IS_OK(status)) { d_printf("(%s) smbcli_full_connection failed: %s\n", __location__, nt_errstr(status)); @@ -1709,7 +1709,7 @@ bool torture_samba3_rpc_getusername(struct torture_context *torture) lp_smb_ports(torture->lp_ctx), "IPC$", NULL, anon_creds, lp_resolve_context(torture->lp_ctx), - NULL, &options); + torture->ev, &options); if (!NT_STATUS_IS_OK(status)) { d_printf("(%s) anon smbcli_full_connection failed: %s\n", __location__, nt_errstr(status)); diff --git a/source4/torture/rpc/samlogon.c b/source4/torture/rpc/samlogon.c index 24b2511bc7..ab3283a952 100644 --- a/source4/torture/rpc/samlogon.c +++ b/source4/torture/rpc/samlogon.c @@ -1602,7 +1602,7 @@ bool torture_rpc_samlogon(struct torture_context *torture) status = dcerpc_pipe_connect_b(mem_ctx, &p, b, &ndr_table_netlogon, - machine_credentials, NULL, torture->lp_ctx); + machine_credentials, torture->ev, torture->lp_ctx); if (!NT_STATUS_IS_OK(status)) { d_printf("RPC pipe connect as domain member failed: %s\n", nt_errstr(status)); diff --git a/source4/torture/rpc/samsync.c b/source4/torture/rpc/samsync.c index 3b152d92aa..9705f7b0de 100644 --- a/source4/torture/rpc/samsync.c +++ b/source4/torture/rpc/samsync.c @@ -1560,7 +1560,7 @@ bool torture_rpc_samsync(struct torture_context *torture) status = dcerpc_pipe_connect_b(samsync_state, &samsync_state->p, b, &ndr_table_netlogon, - credentials, NULL, torture->lp_ctx); + credentials, torture->ev, torture->lp_ctx); if (!NT_STATUS_IS_OK(status)) { printf("Failed to connect to server as a BDC: %s\n", nt_errstr(status)); @@ -1598,7 +1598,7 @@ bool torture_rpc_samsync(struct torture_context *torture) &samsync_state->p_netlogon_wksta, b_netlogon_wksta, &ndr_table_netlogon, - credentials_wksta, NULL, torture->lp_ctx); + credentials_wksta, torture->ev, torture->lp_ctx); if (!NT_STATUS_IS_OK(status)) { printf("Failed to connect to server as a Workstation: %s\n", nt_errstr(status)); diff --git a/source4/torture/rpc/schannel.c b/source4/torture/rpc/schannel.c index 46605e53e6..c89b71baaf 100644 --- a/source4/torture/rpc/schannel.c +++ b/source4/torture/rpc/schannel.c @@ -258,7 +258,7 @@ static bool test_schannel(struct torture_context *tctx, b->flags |= dcerpc_flags; status = dcerpc_pipe_connect_b(tctx, &p, b, &ndr_table_samr, - credentials, NULL, tctx->lp_ctx); + credentials, tctx->ev, tctx->lp_ctx); torture_assert_ntstatus_ok(tctx, status, "Failed to connect with schannel"); @@ -328,7 +328,7 @@ static bool test_schannel(struct torture_context *tctx, b->flags |= dcerpc_flags; status = dcerpc_pipe_connect_b(tctx, &p_samr2, b, &ndr_table_samr, - credentials, NULL, tctx->lp_ctx); + credentials, tctx->ev, tctx->lp_ctx); torture_assert_ntstatus_ok(tctx, status, "Failed to connect with schannel"); @@ -370,7 +370,7 @@ static bool test_schannel(struct torture_context *tctx, b->flags &= ~DCERPC_AUTH_OPTIONS; status = dcerpc_pipe_connect_b(tctx, &p_netlogon3, b, &ndr_table_netlogon, - credentials, NULL, tctx->lp_ctx); + credentials, tctx->ev, tctx->lp_ctx); torture_assert_ntstatus_ok(tctx, status, "Failed to connect without schannel"); torture_assert(tctx, !test_netlogon_ex_ops(p_netlogon3, tctx, credentials, creds), @@ -453,12 +453,12 @@ bool torture_rpc_schannel2(struct torture_context *torture) printf("Opening first connection\n"); status = dcerpc_pipe_connect_b(torture, &p1, b, &ndr_table_netlogon, - credentials1, NULL, torture->lp_ctx); + credentials1, torture->ev, torture->lp_ctx); torture_assert_ntstatus_ok(torture, status, "Failed to connect with schannel"); torture_comment(torture, "Opening second connection\n"); status = dcerpc_pipe_connect_b(torture, &p2, b, &ndr_table_netlogon, - credentials2, NULL, torture->lp_ctx); + credentials2, torture->ev, torture->lp_ctx); torture_assert_ntstatus_ok(torture, status, "Failed to connect with schannel"); credentials1->netlogon_creds = NULL; diff --git a/source4/torture/rpc/session_key.c b/source4/torture/rpc/session_key.c index fcb828ddb2..0df7e576ee 100644 --- a/source4/torture/rpc/session_key.c +++ b/source4/torture/rpc/session_key.c @@ -158,7 +158,11 @@ static bool test_secrets(struct torture_context *torture, const void *_data) binding->flags |= settings->bindoptions; torture_assert_ntstatus_ok(torture, - dcerpc_pipe_connect_b(torture, &p, binding, &ndr_table_lsarpc, cmdline_credentials, NULL, torture->lp_ctx), + dcerpc_pipe_connect_b(torture, &p, binding, + &ndr_table_lsarpc, + cmdline_credentials, + torture->ev, + torture->lp_ctx), "connect"); if (!test_lsa_OpenPolicy2(p, torture, &handle)) { diff --git a/source4/torture/unix/unix_info2.c b/source4/torture/unix/unix_info2.c index c14be9e2d0..d7482ddcf1 100644 --- a/source4/torture/unix/unix_info2.c +++ b/source4/torture/unix/unix_info2.c @@ -63,8 +63,8 @@ static struct smbcli_state *connect_to_server(struct torture_context *tctx) lp_smb_ports(tctx->lp_ctx), share, NULL, cmdline_credentials, - lp_resolve_context(tctx->lp_ctx), NULL, - &options); + lp_resolve_context(tctx->lp_ctx), + tctx->ev, &options); if (!NT_STATUS_IS_OK(status)) { printf("failed to connect to //%s/%s: %s\n", diff --git a/source4/torture/unix/whoami.c b/source4/torture/unix/whoami.c index a1333ac5bd..d4f19bb57a 100644 --- a/source4/torture/unix/whoami.c +++ b/source4/torture/unix/whoami.c @@ -84,7 +84,7 @@ static struct smbcli_state *connect_to_server(struct torture_context *tctx, lp_smb_ports(tctx->lp_ctx), share, NULL, creds, lp_resolve_context(tctx->lp_ctx), - NULL, &options); + tctx->ev, &options); if (!NT_STATUS_IS_OK(status)) { printf("failed to connect to //%s/%s: %s\n", diff --git a/source4/utils/nmblookup.c b/source4/utils/nmblookup.c index fe03e0dbbe..980e06602d 100644 --- a/source4/utils/nmblookup.c +++ b/source4/utils/nmblookup.c @@ -24,6 +24,7 @@ #include "includes.h" #include "lib/cmdline/popt_common.h" #include "lib/socket/socket.h" +#include "lib/events/events.h" #include "system/network.h" #include "system/locale.h" #include "lib/socket/netif.h" @@ -180,7 +181,7 @@ static NTSTATUS do_node_query(struct nbt_name_socket *nbtsock, } -static bool process_one(struct loadparm_context *lp_ctx, +static bool process_one(struct loadparm_context *lp_ctx, struct event_context *ev, struct interface *ifaces, const char *name, int nbt_port) { TALLOC_CTX *tmp_ctx = talloc_new(NULL); @@ -211,7 +212,7 @@ static bool process_one(struct loadparm_context *lp_ctx, node_name = talloc_strdup(tmp_ctx, name); } - nbtsock = nbt_name_socket_init(tmp_ctx, NULL, lp_iconv_convenience(lp_ctx)); + nbtsock = nbt_name_socket_init(tmp_ctx, ev, lp_iconv_convenience(lp_ctx)); if (options.root_port) { all_zero_addr = socket_address_from_strings(tmp_ctx, nbtsock->sock->backend_name, @@ -271,6 +272,7 @@ int main(int argc, const char *argv[]) { bool ret = true; struct interface *ifaces; + struct event_context *ev; poptContext pc; int opt; enum { @@ -356,13 +358,17 @@ int main(int argc, const char *argv[]) } load_interfaces(NULL, lp_interfaces(cmdline_lp_ctx), &ifaces); - + + ev = event_context_init(talloc_autofree_context()); + while (poptPeekArg(pc)) { const char *name = poptGetArg(pc); - ret &= process_one(cmdline_lp_ctx, ifaces, name, lp_nbt_port(cmdline_lp_ctx)); + ret &= process_one(cmdline_lp_ctx, ev, ifaces, name, lp_nbt_port(cmdline_lp_ctx)); } + talloc_free(ev); + talloc_free(ifaces); poptFreeContext(pc); diff --git a/source4/utils/ntlm_auth.c b/source4/utils/ntlm_auth.c index 0c9a41fd70..07c0e4f31e 100644 --- a/source4/utils/ntlm_auth.c +++ b/source4/utils/ntlm_auth.c @@ -461,6 +461,10 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode, return; } + ev = event_context_init(state); + if (!ev) { + exit(1); + } /* setup gensec */ if (!(state->gensec_state)) { switch (stdio_helper_mode) { @@ -468,7 +472,7 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode, case NTLMSSP_CLIENT_1: /* setup the client side */ - nt_status = gensec_client_start(NULL, &state->gensec_state, NULL, lp_ctx); + nt_status = gensec_client_start(NULL, &state->gensec_state, ev, lp_ctx); if (!NT_STATUS_IS_OK(nt_status)) { exit(1); } @@ -476,10 +480,6 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode, break; case GSS_SPNEGO_SERVER: case SQUID_2_5_NTLMSSP: - ev = event_context_init(state); - if (!ev) { - exit(1); - } msg = messaging_client_init(state, lp_messaging_path(state, lp_ctx), lp_iconv_convenience(lp_ctx), ev); if (!msg) { -- cgit From 54efc107e58ed1eed7109ea08fdf808e3a15327b Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 22 Apr 2008 01:34:11 +0200 Subject: Add port number for ncacn_http epmapper. (This used to be commit 1304362b3754960f68fb56e0915c3d80cace6e60) --- source4/librpc/idl/epmapper.idl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source4/librpc/idl/epmapper.idl b/source4/librpc/idl/epmapper.idl index ea04878094..89cea57ea5 100644 --- a/source4/librpc/idl/epmapper.idl +++ b/source4/librpc/idl/epmapper.idl @@ -15,7 +15,7 @@ import "misc.idl"; uuid("e1af8308-5d1f-11c9-91a4-08002b14a0fa"), version(3.0), endpoint("ncacn_np:[\\pipe\\epmapper]", "ncacn_ip_tcp:[135]", - "ncalrpc:[EPMAPPER]"), + "ncalrpc:[EPMAPPER]", "ncacn_http:[593]"), helpstring("EndPoint Mapper"), pointer_default(ptr) ] -- cgit From c8eb82816f3ce5eea3855dbfa878a1c383e5d16f Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 21 Apr 2008 19:53:15 -0400 Subject: Fix build (This used to be commit c16d1d430a0f1e3643c1e769b10e9d88b4719d17) --- source4/torture/raw/lookuprate.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source4/torture/raw/lookuprate.c b/source4/torture/raw/lookuprate.c index 4b505dc4b8..0e8f002efb 100644 --- a/source4/torture/raw/lookuprate.c +++ b/source4/torture/raw/lookuprate.c @@ -23,6 +23,7 @@ #include "torture/torture.h" #include "torture/basic/proto.h" #include "libcli/libcli.h" +#include "torture/util.h" #include "lib/cmdline/popt_common.h" #include "auth/credentials/credentials.h" -- cgit From 7dddab3f6cdb36a537ca3ed9c9f3461993d1c11c Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 21 Apr 2008 19:53:29 -0400 Subject: Make sure we have an event context available (This used to be commit b7c96e0cc270bd3b1c9bd117a22df3f657b6acd5) --- source4/dsdb/samdb/samdb.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source4/dsdb/samdb/samdb.c b/source4/dsdb/samdb/samdb.c index 4af7fb7963..9154f5382b 100644 --- a/source4/dsdb/samdb/samdb.c +++ b/source4/dsdb/samdb/samdb.c @@ -37,6 +37,7 @@ #include "dsdb/samdb/samdb.h" #include "dsdb/common/flags.h" #include "param/param.h" +#include "lib/events/events.h" char *samdb_relative_path(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, @@ -116,6 +117,12 @@ int samdb_copy_template(struct ldb_context *ldb, event_ctx = (struct event_context *)ldb_get_opaque(ldb, "EventContext"); lp_ctx = (struct loadparm_context *)ldb_get_opaque(ldb, "loadparm"); + /* FIXME: need to remove this wehn we finally pass the event + * context around in ldb */ + if (event_ctx == NULL) { + event_ctx = event_context_init(templates_ldb); + } + templates_ldb = ldb_wrap_connect(ldb, event_ctx, lp_ctx, templates_ldb_path, NULL, NULL, 0, NULL); -- cgit From 996d1bc09063fc42c2ac4907d5d9cdf106aec38c Mon Sep 17 00:00:00 2001 From: Björn Jacke Date: Fri, 18 Apr 2008 17:09:09 +0200 Subject: fix an extrasemi compile warning (This used to be commit 47e8ef4f6aa91ed0b069a1890cb1f853b4e9b879) --- source4/libcli/nbt/libnbt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source4/libcli/nbt/libnbt.h b/source4/libcli/nbt/libnbt.h index 14cec3a024..0b01365510 100644 --- a/source4/libcli/nbt/libnbt.h +++ b/source4/libcli/nbt/libnbt.h @@ -330,7 +330,7 @@ NTSTATUS nbt_name_reply_send(struct nbt_name_socket *nbtsock, NDR_SCALAR_PROTO(wrepl_nbt_name, const struct nbt_name *) -NDR_SCALAR_PROTO(nbt_string, const char *); +NDR_SCALAR_PROTO(nbt_string, const char *) NDR_BUFFER_PROTO(nbt_name, struct nbt_name) NTSTATUS nbt_rcode_to_ntstatus(uint8_t rcode); -- cgit From f1b76952c035ca6341e67d0ef1a14b655c4652a2 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 22 Apr 2008 22:33:34 +0200 Subject: Fix event context initialization for Python bindings. (This used to be commit 132efc779ede27898765320a13bdde0b5256102b) --- source4/pidl/lib/Parse/Pidl/Samba4/Python.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm index e344589f8e..884ee1d822 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm @@ -599,6 +599,7 @@ sub Interface($$$) $self->pidl("struct loadparm_context *lp_ctx = NULL;"); $self->pidl("PyObject *py_lp_ctx = Py_None, *py_credentials = Py_None;"); $self->pidl("TALLOC_CTX *mem_ctx = NULL;"); + $self->pidl("struct event_context *event_ctx;"); $self->pidl("NTSTATUS status;"); $self->pidl(""); $self->pidl("const char *kwnames[] = {"); @@ -634,9 +635,11 @@ sub Interface($$$) $self->pidl("ret = PyObject_New($interface->{NAME}_InterfaceObject, &$interface->{NAME}_InterfaceType);"); $self->pidl(""); + $self->pidl("event_ctx = event_context_init(mem_ctx);"); + $self->pidl(""); $self->pidl("status = dcerpc_pipe_connect(NULL, &ret->pipe, binding_string, "); - $self->pidl(" &ndr_table_$interface->{NAME}, credentials, NULL, lp_ctx);"); + $self->pidl(" &ndr_table_$interface->{NAME}, credentials, event_ctx, lp_ctx);"); $self->handle_ntstatus("status", "NULL", "mem_ctx"); $self->pidl("ret->pipe->conn->flags |= DCERPC_NDR_REF_ALLOC;"); @@ -1020,6 +1023,7 @@ sub Parse($$$$$) #include \"librpc/rpc/dcerpc.h\" #include \"scripting/python/pytalloc.h\" #include \"scripting/python/pyrpc.h\" +#include \"lib/events/events.h\" #include \"$hdr\" #include \"$ndr_hdr\" #include \"$py_hdr\" -- 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(-) 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 7f464f062899c96ebae04c899665500b998ce658 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Tue, 22 Apr 2008 16:37:54 -0400 Subject: Fix more failing tests to pass the event context. (This used to be commit d6c5d8baf0c48a6078a47bba33993a841ff526d9) --- source4/torture/raw/samba3hide.c | 2 +- source4/torture/raw/samba3misc.c | 2 +- source4/torture/rpc/dfs.c | 4 ++-- source4/torture/rpc/samba3rpc.c | 12 ++++++------ 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/source4/torture/raw/samba3hide.c b/source4/torture/raw/samba3hide.c index 814b5f57f4..1f1501045c 100644 --- a/source4/torture/raw/samba3hide.c +++ b/source4/torture/raw/samba3hide.c @@ -136,7 +136,7 @@ bool torture_samba3_hide(struct torture_context *torture) if (!torture_open_connection_share( torture, &cli, torture, torture_setting_string(torture, "host", NULL), - torture_setting_string(torture, "share", NULL), NULL)) { + torture_setting_string(torture, "share", NULL), torture->ev)) { d_printf("torture_open_connection_share failed\n"); return false; } diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c index 15a7f6c4a3..27b4d42dd8 100644 --- a/source4/torture/raw/samba3misc.c +++ b/source4/torture/raw/samba3misc.c @@ -56,7 +56,7 @@ bool torture_samba3_checkfsp(struct torture_context *torture) if (!torture_open_connection_share( torture, &cli, torture, torture_setting_string(torture, "host", NULL), - torture_setting_string(torture, "share", NULL), NULL)) { + torture_setting_string(torture, "share", NULL), torture->ev)) { d_printf("torture_open_connection_share failed\n"); ret = false; goto done; diff --git a/source4/torture/rpc/dfs.c b/source4/torture/rpc/dfs.c index 5656476922..1c81766ebe 100644 --- a/source4/torture/rpc/dfs.c +++ b/source4/torture/rpc/dfs.c @@ -124,7 +124,7 @@ static bool test_CreateDir(TALLOC_CTX *mem_ctx, { printf("Creating directory %s\n", dir); - if (!torture_open_connection_share(mem_ctx, cli, tctx, host, share, NULL)) { + if (!torture_open_connection_share(mem_ctx, cli, tctx, host, share, tctx->ev)) { return false; } @@ -494,7 +494,7 @@ static void test_cleanup_stdroot(struct dcerpc_pipe *p, test_RemoveStdRoot(p, mem_ctx, host, sharename); test_NetShareDel(mem_ctx, tctx, host, sharename); - torture_open_connection_share(mem_ctx, &cli, tctx, host, "C$", NULL); + torture_open_connection_share(mem_ctx, &cli, tctx, host, "C$", tctx->ev); test_DeleteDir(cli, dir); torture_close_connection(cli); } diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c index 40a7c156f4..1103acaefa 100644 --- a/source4/torture/rpc/samba3rpc.c +++ b/source4/torture/rpc/samba3rpc.c @@ -1924,7 +1924,7 @@ bool torture_samba3_rpc_srvsvc(struct torture_context *torture) if (!(torture_open_connection_share( mem_ctx, &cli, torture, torture_setting_string(torture, "host", NULL), - "IPC$", NULL))) { + "IPC$", torture->ev))) { talloc_free(mem_ctx); return false; } @@ -1986,7 +1986,7 @@ bool torture_samba3_rpc_randomauth2(struct torture_context *torture) if (!(torture_open_connection_share( mem_ctx, &cli, torture, torture_setting_string(torture, "host", NULL), - "IPC$", NULL))) { + "IPC$", torture->ev))) { d_printf("IPC$ connection failed\n"); goto done; } @@ -2281,7 +2281,7 @@ bool torture_samba3_rpc_sharesec(struct torture_context *torture) if (!(torture_open_connection_share( mem_ctx, &cli, torture, torture_setting_string(torture, "host", NULL), - "IPC$", NULL))) { + "IPC$", torture->ev))) { d_printf("IPC$ connection failed\n"); talloc_free(mem_ctx); return false; @@ -2329,7 +2329,7 @@ bool torture_samba3_rpc_lsa(struct torture_context *torture) if (!(torture_open_connection_share( mem_ctx, &cli, torture, torture_setting_string(torture, "host", NULL), - "IPC$", NULL))) { + "IPC$", torture->ev))) { d_printf("IPC$ connection failed\n"); talloc_free(mem_ctx); return false; @@ -2611,7 +2611,7 @@ bool torture_samba3_rpc_spoolss(struct torture_context *torture) if (!(torture_open_connection_share( mem_ctx, &cli, torture, torture_setting_string(torture, "host", NULL), - "IPC$", NULL))) { + "IPC$", torture->ev))) { d_printf("IPC$ connection failed\n"); talloc_free(mem_ctx); return false; @@ -2797,7 +2797,7 @@ bool torture_samba3_rpc_wkssvc(struct torture_context *torture) if (!(torture_open_connection_share( mem_ctx, &cli, torture, torture_setting_string(torture, "host", NULL), - "IPC$", NULL))) { + "IPC$", torture->ev))) { d_printf("IPC$ connection failed\n"); talloc_free(mem_ctx); return false; -- cgit From c33c614eb2a2bef51216e75dfdc96583bf4d4f84 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Wed, 23 Apr 2008 08:54:57 -0400 Subject: Revert "Add port number for ncacn_http epmapper." This reverts commit 1304362b3754960f68fb56e0915c3d80cace6e60. This was causing way too many tests to fail. The dcesrv server was failing to start as the NCACN_HTTP transport is considered invalid. Jelmer please check how to properly fix dcesrv server before re-committing your change. (This used to be commit 0c59b39ad8edcaf9f06a2d1393e11e06e4b2f18f) --- source4/librpc/idl/epmapper.idl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source4/librpc/idl/epmapper.idl b/source4/librpc/idl/epmapper.idl index 89cea57ea5..ea04878094 100644 --- a/source4/librpc/idl/epmapper.idl +++ b/source4/librpc/idl/epmapper.idl @@ -15,7 +15,7 @@ import "misc.idl"; uuid("e1af8308-5d1f-11c9-91a4-08002b14a0fa"), version(3.0), endpoint("ncacn_np:[\\pipe\\epmapper]", "ncacn_ip_tcp:[135]", - "ncalrpc:[EPMAPPER]", "ncacn_http:[593]"), + "ncalrpc:[EPMAPPER]"), helpstring("EndPoint Mapper"), pointer_default(ptr) ] -- cgit From b8209978d708d69dbd4cb1ecd817274566de23ec Mon Sep 17 00:00:00 2001 From: James Peach Date: Wed, 23 Apr 2008 11:26:38 -0700 Subject: testsuite: skip RAW-BENCH-LOOKUP by default. (This used to be commit 8a8449c95336d8019e9105fba6ef09473aae813b) --- source4/samba4-skip | 1 + 1 file changed, 1 insertion(+) diff --git a/source4/samba4-skip b/source4/samba4-skip index 8d86cdb98c..4ac35a3c78 100644 --- a/source4/samba4-skip +++ b/source4/samba4-skip @@ -4,6 +4,7 @@ base.iometer base.casetable base.nttrans .*base.bench.holdcon.* # Very slow +raw.bench.lookup # Very slow base.scan.maxfid raw.hold.oplock # Not a test, but a way to block other clients for a test raw.ping.pong # Needs second server to test -- cgit From 240d959005f5fd80a38b3734b39dd5d6e425a566 Mon Sep 17 00:00:00 2001 From: Kai Blin Date: Sat, 19 Apr 2008 14:09:18 +0200 Subject: libnet: Make UserInfo accept a SID as input as well, fix wb_cmd_getpwuid (This used to be commit 5f3a70f285ad8a412105c0e498e486f93fc279bc) --- source4/libnet/libnet_user.c | 97 +++++++++++++++++++++++++-------- source4/libnet/libnet_user.h | 11 +++- source4/scripting/ejs/ejsnet/net_user.c | 5 +- source4/torture/libnet/libnet_user.c | 6 +- source4/winbind/wb_cmd_getpwnam.c | 3 +- source4/winbind/wb_cmd_getpwuid.c | 9 +-- 6 files changed, 98 insertions(+), 33 deletions(-) diff --git a/source4/libnet/libnet_user.c b/source4/libnet/libnet_user.c index 678c7a226e..dce7320c73 100644 --- a/source4/libnet/libnet_user.c +++ b/source4/libnet/libnet_user.c @@ -597,7 +597,9 @@ NTSTATUS libnet_ModifyUser(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, struct user_info_state { struct libnet_context *ctx; const char *domain_name; + enum libnet_UserInfo_level level; const char *user_name; + const char *sid_string; struct libnet_LookupName lookup; struct libnet_DomainOpen domopen; struct libnet_rpc_userinfo userinfo; @@ -628,7 +630,7 @@ struct composite_context* libnet_UserInfo_send(struct libnet_context *ctx, { struct composite_context *c; struct user_info_state *s; - struct composite_context *lookup_req; + struct composite_context *lookup_req, *info_req; bool prereq_met = false; /* composite context allocation and setup */ @@ -644,23 +646,54 @@ struct composite_context* libnet_UserInfo_send(struct libnet_context *ctx, s->monitor_fn = monitor; s->ctx = ctx; s->domain_name = talloc_strdup(c, r->in.domain_name); - s->user_name = talloc_strdup(c, r->in.user_name); + s->level = r->in.level; + switch (s->level) { + case USER_INFO_BY_NAME: + s->user_name = talloc_strdup(c, r->in.data.user_name); + s->sid_string = NULL; + break; + case USER_INFO_BY_SID: + s->user_name = NULL; + s->sid_string = dom_sid_string(c, r->in.data.user_sid); + break; + } /* prerequisite: make sure the domain is opened */ prereq_met = samr_domain_opened(ctx, s->domain_name, &c, &s->domopen, continue_domain_open_info, monitor); if (!prereq_met) return c; - /* prepare arguments for LookupName call */ - s->lookup.in.domain_name = s->domain_name; - s->lookup.in.name = s->user_name; - - /* send the request */ - lookup_req = libnet_LookupName_send(ctx, c, &s->lookup, s->monitor_fn); - if (composite_nomem(lookup_req, c)) return c; + switch (s->level) { + case USER_INFO_BY_NAME: + /* prepare arguments for LookupName call */ + s->lookup.in.domain_name = s->domain_name; + s->lookup.in.name = s->user_name; + + /* send the request */ + lookup_req = libnet_LookupName_send(ctx, c, &s->lookup, + s->monitor_fn); + if (composite_nomem(lookup_req, c)) return c; + + /* set the next stage */ + composite_continue(c, lookup_req, continue_name_found, c); + break; + case USER_INFO_BY_SID: + /* prepare arguments for UserInfo call */ + s->userinfo.in.domain_handle = s->ctx->samr.handle; + s->userinfo.in.sid = s->sid_string; + s->userinfo.in.level = 21; + + /* send the request */ + info_req = libnet_rpc_userinfo_send(s->ctx->samr.pipe, + &s->userinfo, + s->monitor_fn); + if (composite_nomem(info_req, c)) return c; + + /* set the next stage */ + composite_continue(c, info_req, continue_info_received, c); + break; + } - /* set the next stage */ - composite_continue(c, lookup_req, continue_name_found, c); return c; } @@ -673,7 +706,7 @@ static void continue_domain_open_info(struct composite_context *ctx) { struct composite_context *c; struct user_info_state *s; - struct composite_context *lookup_req; + struct composite_context *lookup_req, *info_req; struct monitor_msg msg; c = talloc_get_type(ctx->async.private_data, struct composite_context); @@ -686,16 +719,36 @@ static void continue_domain_open_info(struct composite_context *ctx) /* send monitor message */ if (s->monitor_fn) s->monitor_fn(&msg); - /* prepare arguments for LookupName call */ - s->lookup.in.domain_name = s->domain_name; - s->lookup.in.name = s->user_name; - - /* send the request */ - lookup_req = libnet_LookupName_send(s->ctx, c, &s->lookup, s->monitor_fn); - if (composite_nomem(lookup_req, c)) return; - - /* set the next stage */ - composite_continue(c, lookup_req, continue_name_found, c); + switch (s->level) { + case USER_INFO_BY_NAME: + /* prepare arguments for LookupName call */ + s->lookup.in.domain_name = s->domain_name; + s->lookup.in.name = s->user_name; + + /* send the request */ + lookup_req = libnet_LookupName_send(s->ctx, c, &s->lookup, s->monitor_fn); + if (composite_nomem(lookup_req, c)) return; + + /* set the next stage */ + composite_continue(c, lookup_req, continue_name_found, c); + break; + + case USER_INFO_BY_SID: + /* prepare arguments for UserInfo call */ + s->userinfo.in.domain_handle = s->ctx->samr.handle; + s->userinfo.in.sid = s->sid_string; + s->userinfo.in.level = 21; + + /* send the request */ + info_req = libnet_rpc_userinfo_send(s->ctx->samr.pipe, + &s->userinfo, + s->monitor_fn); + if (composite_nomem(info_req, c)) return; + + /* set the next stage */ + composite_continue(c, info_req, continue_info_received, c); + break; + } } diff --git a/source4/libnet/libnet_user.h b/source4/libnet/libnet_user.h index 94aa38464f..7095160004 100644 --- a/source4/libnet/libnet_user.h +++ b/source4/libnet/libnet_user.h @@ -99,11 +99,19 @@ struct libnet_ModifyUser { } \ } +enum libnet_UserInfo_level { + USER_INFO_BY_NAME=0, + USER_INFO_BY_SID +}; struct libnet_UserInfo { struct { - const char *user_name; const char *domain_name; + enum libnet_UserInfo_level level; + union { + const char *user_name; + const struct dom_sid *user_sid; + } data; } in; struct { struct dom_sid *user_sid; @@ -123,7 +131,6 @@ struct libnet_UserInfo { struct timeval *last_logoff; struct timeval *last_password_change; uint32_t acct_flags; - const char *error_string; } out; }; diff --git a/source4/scripting/ejs/ejsnet/net_user.c b/source4/scripting/ejs/ejsnet/net_user.c index 57e538d3b4..0c32035c6c 100644 --- a/source4/scripting/ejs/ejsnet/net_user.c +++ b/source4/scripting/ejs/ejsnet/net_user.c @@ -268,8 +268,9 @@ static int ejs_net_userinfo(MprVarHandle eid, int argc, char **argv) /* call the libnet function */ req.in.domain_name = userman_domain; - req.in.user_name = username; - + req.in.data.user_name = username; + req.in.level = USER_INFO_BY_NAME; + status = libnet_UserInfo(ctx, mem_ctx, &req); if (!NT_STATUS_IS_OK(status)) { ejsSetErrorMsg(eid, "%s", req.out.error_string); diff --git a/source4/torture/libnet/libnet_user.c b/source4/torture/libnet/libnet_user.c index 15e3f03506..6d3e682976 100644 --- a/source4/torture/libnet/libnet_user.c +++ b/source4/torture/libnet/libnet_user.c @@ -530,7 +530,8 @@ bool torture_modifyuser(struct torture_context *torture) ZERO_STRUCT(user_req); user_req.in.domain_name = lp_workgroup(torture->lp_ctx); - user_req.in.user_name = name; + user_req.in.data.user_name = name; + user_req.in.level = USER_INFO_BY_NAME; status = libnet_UserInfo(ctx, torture, &user_req); if (!NT_STATUS_IS_OK(status)) { @@ -642,7 +643,8 @@ bool torture_userinfo_api(struct torture_context *torture) ZERO_STRUCT(req); req.in.domain_name = domain_name.string; - req.in.user_name = name; + req.in.data.user_name = name; + req.in.level = USER_INFO_BY_NAME; status = libnet_UserInfo(ctx, mem_ctx, &req); if (!NT_STATUS_IS_OK(status)) { diff --git a/source4/winbind/wb_cmd_getpwnam.c b/source4/winbind/wb_cmd_getpwnam.c index fb2dc197c9..7d821537f0 100644 --- a/source4/winbind/wb_cmd_getpwnam.c +++ b/source4/winbind/wb_cmd_getpwnam.c @@ -92,7 +92,8 @@ static void cmd_getpwnam_recv_domain(struct composite_context *ctx) return; } - user_info->in.user_name = user_name; + user_info->in.level = USER_INFO_BY_NAME; + user_info->in.data.user_name = user_name; user_info->in.domain_name = domain->libnet_ctx->samr.name; state->workgroup_name = talloc_strdup(state, domain->libnet_ctx->samr.name); diff --git a/source4/winbind/wb_cmd_getpwuid.c b/source4/winbind/wb_cmd_getpwuid.c index c250af1b56..15cc592cf6 100644 --- a/source4/winbind/wb_cmd_getpwuid.c +++ b/source4/winbind/wb_cmd_getpwuid.c @@ -34,6 +34,7 @@ struct cmd_getpwuid_state { struct composite_context *ctx; struct wbsrv_service *service; uid_t uid; + struct dom_sid *sid; char *workgroup; struct wbsrv_domain *domain; @@ -81,14 +82,13 @@ static void cmd_getpwuid_recv_sid(struct composite_context *ctx) struct cmd_getpwuid_state *state = talloc_get_type(ctx->async.private_data, struct cmd_getpwuid_state); - struct dom_sid *sid; DEBUG(5, ("cmd_getpwuid_recv_sid called %p\n", ctx->private_data)); - state->ctx->status = wb_uid2sid_recv(ctx, state, &sid); + state->ctx->status = wb_uid2sid_recv(ctx, state, &state->sid); if (!composite_is_ok(state->ctx)) return; - ctx = wb_sid2domain_send(state, state->service, sid); + ctx = wb_sid2domain_send(state, state->service, state->sid); composite_continue(state->ctx, ctx, cmd_getpwuid_recv_domain, state); } @@ -110,7 +110,8 @@ static void cmd_getpwuid_recv_domain(struct composite_context *ctx) user_info = talloc(state, struct libnet_UserInfo); if (composite_nomem(user_info, state->ctx)) return; - user_info->in.user_name = state->domain->libnet_ctx->cred->username; + user_info->in.level = USER_INFO_BY_SID; + user_info->in.data.user_sid = state->sid; user_info->in.domain_name = state->domain->libnet_ctx->samr.name; /* We need the workgroup later, so copy it */ -- cgit