From 10c047c6f4c0f6b9fdebbdf133a3bd72aa8776de Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 24 Feb 2009 00:58:29 +0100 Subject: Fix finding of setup data. --- source4/scripting/python/samba/provision.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4') diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py index a5b3e8322f..aca852c762 100644 --- a/source4/scripting/python/samba/provision.py +++ b/source4/scripting/python/samba/provision.py @@ -50,7 +50,7 @@ def find_setup_dir(): """Find the setup directory used by provision.""" dirname = os.path.dirname(__file__) if "/site-packages/" in dirname: - prefix = dirname[:dirname.index("/site-packages/")] + prefix = "/".join(dirname[:dirname.index("/site-packages/")].split("/")[:-2]) for suffix in ["share/setup", "share/samba/setup", "setup"]: ret = os.path.join(prefix, suffix) if os.path.isdir(ret): -- cgit From dcb2e7d57718ebd3db75999819ec8ef507f9dd7b Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 24 Feb 2009 01:00:09 +0100 Subject: expand tabs in python file, consistent with the rest of the file. --- source4/scripting/python/samba/provision.py | 78 ++++++++++++++--------------- 1 file changed, 39 insertions(+), 39 deletions(-) (limited to 'source4') diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py index aca852c762..5bcb23a5d4 100644 --- a/source4/scripting/python/samba/provision.py +++ b/source4/scripting/python/samba/provision.py @@ -93,9 +93,9 @@ class ProvisionPaths(object): self.memberofconf = None self.fedoradsinf = None self.fedoradspartitions = None - self.olmmron = None - self.olmmrserveridsconf = None - self.olmmrsyncreplconf = None + self.olmmron = None + self.olmmrserveridsconf = None + self.olmmrsyncreplconf = None class ProvisionNames(object): @@ -1178,7 +1178,7 @@ def provision_backend(setup_dir=None, message=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_port=None, - ol_mmr_urls=None): + ol_mmr_urls=None): def setup_path(file): return os.path.join(setup_dir, file) @@ -1300,50 +1300,50 @@ def provision_backend(setup_dir=None, message=None, { "LINK_ATTRS" : refint_attributes}) # generate serverids, ldap-urls and syncrepl-blocks for mmr hosts - mmr_on_config = "" - mmr_replicator_acl = "" - mmr_serverids_config = "" + mmr_on_config = "" + mmr_replicator_acl = "" + mmr_serverids_config = "" mmr_syncrepl_schema_config = "" - mmr_syncrepl_config_config = "" - mmr_syncrepl_user_config = "" - - if ol_mmr_urls is not None: + mmr_syncrepl_config_config = "" + mmr_syncrepl_user_config = "" + + if ol_mmr_urls is not None: # For now, make these equal mmr_pass = adminpass - url_list=filter(None,ol_mmr_urls.split(' ')) + url_list=filter(None,ol_mmr_urls.split(' ')) if (len(url_list) == 1): url_list=filter(None,ol_mmr_urls.split(',')) - mmr_on_config = "MirrorMode On" - mmr_replicator_acl = " by dn=cn=replicator,cn=samba read" - serverid=0 - for url in url_list: - serverid=serverid+1 - mmr_serverids_config += read_and_sub_file(setup_path("mmr_serverids.conf"), - { "SERVERID" : str(serverid), - "LDAPSERVER" : url }) + mmr_on_config = "MirrorMode On" + mmr_replicator_acl = " by dn=cn=replicator,cn=samba read" + serverid=0 + for url in url_list: + serverid=serverid+1 + mmr_serverids_config += read_and_sub_file(setup_path("mmr_serverids.conf"), + { "SERVERID" : str(serverid), + "LDAPSERVER" : url }) rid=serverid*10 - rid=rid+1 - mmr_syncrepl_schema_config += read_and_sub_file(setup_path("mmr_syncrepl.conf"), - { "RID" : str(rid), - "MMRDN": names.schemadn, - "LDAPSERVER" : url, + rid=rid+1 + mmr_syncrepl_schema_config += read_and_sub_file(setup_path("mmr_syncrepl.conf"), + { "RID" : str(rid), + "MMRDN": names.schemadn, + "LDAPSERVER" : url, "MMR_PASSWORD": mmr_pass}) - rid=rid+1 - mmr_syncrepl_config_config += read_and_sub_file(setup_path("mmr_syncrepl.conf"), - { "RID" : str(rid), - "MMRDN": names.configdn, - "LDAPSERVER" : url, + rid=rid+1 + mmr_syncrepl_config_config += read_and_sub_file(setup_path("mmr_syncrepl.conf"), + { "RID" : str(rid), + "MMRDN": names.configdn, + "LDAPSERVER" : url, "MMR_PASSWORD": mmr_pass}) - rid=rid+1 - mmr_syncrepl_user_config += read_and_sub_file(setup_path("mmr_syncrepl.conf"), - { "RID" : str(rid), - "MMRDN": names.domaindn, - "LDAPSERVER" : url, + rid=rid+1 + mmr_syncrepl_user_config += read_and_sub_file(setup_path("mmr_syncrepl.conf"), + { "RID" : str(rid), + "MMRDN": names.domaindn, + "LDAPSERVER" : url, "MMR_PASSWORD": mmr_pass }) @@ -1361,7 +1361,7 @@ def provision_backend(setup_dir=None, message=None, "MMR_SYNCREPL_CONFIG_CONFIG": mmr_syncrepl_config_config, "MMR_SYNCREPL_USER_CONFIG": mmr_syncrepl_user_config, "REFINT_CONFIG": refint_config}) - setup_file(setup_path("modules.conf"), paths.modulesconf, + setup_file(setup_path("modules.conf"), paths.modulesconf, {"REALM": names.realm}) setup_db_config(setup_path, os.path.join(paths.ldapdir, "db", "user")) @@ -1380,9 +1380,9 @@ def provision_backend(setup_dir=None, message=None, {"LDAPADMINPASS_B64": b64encode(adminpass), "UUID": str(uuid.uuid4()), "LDAPTIME": timestring(int(time.time()))} ) - - if ol_mmr_urls is not None: - setup_file(setup_path("cn=replicator.ldif"), + + if ol_mmr_urls is not None: + setup_file(setup_path("cn=replicator.ldif"), os.path.join(paths.ldapdir, "db", "samba", "cn=samba", "cn=replicator.ldif"), {"MMR_PASSWORD_B64": b64encode(mmr_pass), "UUID": str(uuid.uuid4()), -- cgit From b9cf189404d5ef6b0a2440dc5f9670f0f6d0c131 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 24 Feb 2009 01:02:26 +0100 Subject: expand tabs in python file, consistent with the rest of the file. --- source4/scripting/python/samba/__init__.py | 2 +- source4/scripting/python/samba/samdb.py | 10 +++++----- source4/scripting/python/samba/tests/__init__.py | 4 ++-- source4/scripting/python/samba/tests/provision.py | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) (limited to 'source4') diff --git a/source4/scripting/python/samba/__init__.py b/source4/scripting/python/samba/__init__.py index e9fc26af20..a49e6e1ead 100644 --- a/source4/scripting/python/samba/__init__.py +++ b/source4/scripting/python/samba/__init__.py @@ -223,7 +223,7 @@ def check_all_substituted(text): :param text: The text to search for substitution variables """ if not "${" in text: - return + return var_start = text.find("${") var_end = text.find("}", var_start) diff --git a/source4/scripting/python/samba/samdb.py b/source4/scripting/python/samba/samdb.py index 9cc55e5629..614970d3ec 100644 --- a/source4/scripting/python/samba/samdb.py +++ b/source4/scripting/python/samba/samdb.py @@ -201,11 +201,11 @@ userAccountControl: %u glue.dsdb_attach_schema_from_ldif_file(self, pf, df) def set_invocation_id(self, invocation_id): - """Set the invocation id for this SamDB handle. - - :param invocation_id: GUID of the invocation id. - """ - glue.dsdb_set_ntds_invocation_id(self, invocation_id) + """Set the invocation id for this SamDB handle. + + :param invocation_id: GUID of the invocation id. + """ + glue.dsdb_set_ntds_invocation_id(self, invocation_id) def setexpiry(self, user, expiry_seconds, noexpiry): """Set the password expiry for a user diff --git a/source4/scripting/python/samba/tests/__init__.py b/source4/scripting/python/samba/tests/__init__.py index d827bfa004..b342b93c49 100644 --- a/source4/scripting/python/samba/tests/__init__.py +++ b/source4/scripting/python/samba/tests/__init__.py @@ -70,8 +70,8 @@ class SubstituteVarTestCase(unittest.TestCase): samba.substitute_var("foo ${bla} gsff", {"bar": "bla"})) def test_check_all_substituted(self): - samba.check_all_substituted("nothing to see here") - self.assertRaises(Exception, samba.check_all_substituted, "Not subsituted: ${FOOBAR}") + samba.check_all_substituted("nothing to see here") + self.assertRaises(Exception, samba.check_all_substituted, "Not subsituted: ${FOOBAR}") class LdbExtensionTests(TestCaseInTempDir): diff --git a/source4/scripting/python/samba/tests/provision.py b/source4/scripting/python/samba/tests/provision.py index 352357f694..fdac9d4ea2 100644 --- a/source4/scripting/python/samba/tests/provision.py +++ b/source4/scripting/python/samba/tests/provision.py @@ -56,7 +56,7 @@ class ProvisionTestCase(samba.tests.TestCaseInTempDir): machinepass="machinepass", dnsdomain="example.com") self.assertEquals(1, len(secrets_ldb.search("samAccountName=krbtgt,flatname=EXAMPLE,CN=Principals"))) - self.assertEquals("keytab.path", + self.assertEquals("keytab.path", secrets_ldb.searchone(basedn="flatname=EXAMPLE,CN=primary domains", expression="(privateKeytab=*)", attribute="privateKeytab")) -- cgit From cde5724780c0e52705e0f6e7cd41e0c884afbb40 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 24 Feb 2009 17:32:22 -0800 Subject: Added torture test from a usage case from the Apple OS/X client. Setting an attribute on a stream fnum must change the attribute on the base file. Jeremy. --- source4/torture/raw/streams.c | 119 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) (limited to 'source4') diff --git a/source4/torture/raw/streams.c b/source4/torture/raw/streams.c index 0622e0809d..bf87bd224f 100644 --- a/source4/torture/raw/streams.c +++ b/source4/torture/raw/streams.c @@ -1535,6 +1535,121 @@ static bool test_stream_large_streaminfo(struct torture_context *tctx, return ret; } +/* Test the effect of setting attributes on a stream. */ +static bool test_stream_attributes(struct torture_context *tctx, + struct smbcli_state *cli, + TALLOC_CTX *mem_ctx) +{ + bool ret = true; + NTSTATUS status; + union smb_open io; + const char *fname = BASEDIR "\\stream_attr.txt"; + const char *stream = "Stream One:$DATA"; + const char *fname_stream; + int fnum = -1; + union smb_fileinfo finfo; + union smb_setfileinfo sfinfo; + time_t basetime = (time(NULL) - 86400) & ~1; + + printf ("(%s) testing attribute setting on stream\n", __location__); + + fname_stream = talloc_asprintf(mem_ctx, "%s:%s", fname, stream); + + /* Create a file with a stream with attribute FILE_ATTRIBUTE_ARCHIVE. */ + ret = create_file_with_stream(tctx, cli, mem_ctx, fname, + fname_stream); + if (!ret) { + goto done; + } + + ZERO_STRUCT(finfo); + finfo.generic.level = RAW_FILEINFO_BASIC_INFO; + finfo.generic.in.file.path = fname; + status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo); + CHECK_STATUS(status, NT_STATUS_OK); + + if (finfo.basic_info.out.attrib != FILE_ATTRIBUTE_ARCHIVE) { + printf("(%s) Incorrect attrib %x - should be %x\n", \ + __location__, (unsigned int)finfo.basic_info.out.attrib, + (unsigned int)FILE_ATTRIBUTE_ARCHIVE); + ret = false; + goto done; + } + + /* Now open the stream name. */ + + io.generic.level = RAW_OPEN_NTCREATEX; + io.ntcreatex.in.root_fid = 0; + io.ntcreatex.in.flags = 0; + io.ntcreatex.in.access_mask = (SEC_FILE_READ_DATA|SEC_FILE_WRITE_DATA| + SEC_FILE_APPEND_DATA|SEC_STD_READ_CONTROL|SEC_FILE_WRITE_ATTRIBUTE); + io.ntcreatex.in.create_options = 0; + io.ntcreatex.in.file_attr = 0; + io.ntcreatex.in.share_access = 0; + io.ntcreatex.in.alloc_size = 0; + io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN_IF; + io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS; + io.ntcreatex.in.security_flags = 0; + io.ntcreatex.in.fname = fname_stream; + + status = smb_raw_open(cli->tree, mem_ctx, &io); + CHECK_STATUS(status, NT_STATUS_OK); + + fnum = io.ntcreatex.out.file.fnum; + + /* Change the attributes + time on the stream fnum. */ + ZERO_STRUCT(sfinfo); + sfinfo.basic_info.in.attrib = FILE_ATTRIBUTE_READONLY; + unix_to_nt_time(&sfinfo.basic_info.in.write_time, basetime); + + sfinfo.generic.level = RAW_SFILEINFO_BASIC_INFORMATION; + sfinfo.generic.in.file.fnum = fnum; + status = smb_raw_setfileinfo(cli->tree, &sfinfo); + if (!NT_STATUS_EQUAL(status, NT_STATUS_OK)) { + printf("(%s) %s - %s (should be %s)\n", __location__, "SETATTR", + nt_errstr(status), nt_errstr(NT_STATUS_OK)); + ret = false; + goto done; + } + + smbcli_close(cli->tree, fnum); + fnum = -1; + + ZERO_STRUCT(finfo); + finfo.generic.level = RAW_FILEINFO_ALL_INFO; + finfo.generic.in.file.path = fname; + status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo); + if (!NT_STATUS_IS_OK(status)) { + printf("(%s) %s pathinfo - %s\n", __location__, "SETATTRE", nt_errstr(status)); + ret = false; + goto done; + } + + if (finfo.all_info.out.attrib != FILE_ATTRIBUTE_READONLY) { + printf("(%s) attrib incorrect. Was 0x%x, should be 0x%x\n", + __location__, + (unsigned int)finfo.all_info.out.attrib, + (unsigned int)FILE_ATTRIBUTE_READONLY); + ret = false; + goto done; + } + + if (nt_time_to_unix(finfo.all_info.out.write_time) != basetime) { + printf("(%s) time incorrect.\n", + __location__); + ret = false; + goto done; + } + + done: + + if (fnum != -1) { + smbcli_close(cli->tree, fnum); + } + smbcli_unlink(cli->tree, fname); + return ret; +} + /* basic testing of streams calls */ @@ -1566,6 +1681,10 @@ bool torture_raw_streams(struct torture_context *torture, smb_raw_exit(cli->session); ret &= test_stream_create_disposition(torture, cli, torture); smb_raw_exit(cli->session); + + ret &= test_stream_attributes(torture, cli, torture); + smb_raw_exit(cli->session); + /* ret &= test_stream_large_streaminfo(torture, cli, torture); */ /* smb_raw_exit(cli->session); */ -- cgit From dc0e46afb7018a1da666729c6d61e8ea85dcf07d Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 25 Feb 2009 08:42:33 +0100 Subject: s4:build: add some comments to the SMB_EXT_LIB() definition metze --- source4/build/m4/public.m4 | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source4') diff --git a/source4/build/m4/public.m4 b/source4/build/m4/public.m4 index 1927e9977f..ffdf92f784 100644 --- a/source4/build/m4/public.m4 +++ b/source4/build/m4/public.m4 @@ -157,6 +157,13 @@ mkinclude $1 " ]) +dnl +dnl SMB_EXT_LIB() just specifies the details of the library. +dnl Note: the library isn't enabled by default. +dnl You need to enable it with SMB_ENABLE(name) if configure +dnl find it should be used. E.g. it should not be enabled +dnl if the library is present, but the header file is missing. +dnl dnl SMB_EXT_LIB(name,libs,cflags,cppflags,ldflags) AC_DEFUN([SMB_EXT_LIB], [ -- cgit From eb5efd1978acd38cf6cc97e067b5105743ca5469 Mon Sep 17 00:00:00 2001 From: Tim Prouty Date: Tue, 24 Feb 2009 23:38:42 -0800 Subject: s4 heimdal: Link libintl correctly --- source4/heimdal_build/internal.m4 | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source4') diff --git a/source4/heimdal_build/internal.m4 b/source4/heimdal_build/internal.m4 index 50a3c8adda..a48777fab1 100644 --- a/source4/heimdal_build/internal.m4 +++ b/source4/heimdal_build/internal.m4 @@ -170,6 +170,12 @@ SMB_ENABLE(OPENPTY,YES) SMB_EXT_LIB(OPENPTY,[${OPENPTY_LIBS}],[${OPENPTY_CFLAGS}],[${OPENPTY_CPPFLAGS}],[${OPENPTY_LDFLAGS}]) +AC_CHECK_LIB_EXT(intl, INTL_LIBS, gettext) + +SMB_ENABLE(INTL,YES) + +SMB_EXT_LIB(INTL, $INTL_LIBS) + smb_save_LIBS=$LIBS RESOLV_LIBS="" LIBS="" -- cgit From 2bd8cacf0e5ed6965f5791c4a86320d4978d9b15 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 25 Feb 2009 15:05:24 +0100 Subject: s4:lib/events: map TEVENT_DEBUG_TRACE to debug level 10 metze --- source4/lib/events/tevent_s4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4') diff --git a/source4/lib/events/tevent_s4.c b/source4/lib/events/tevent_s4.c index a05ac0796f..89ca7bbe5c 100644 --- a/source4/lib/events/tevent_s4.c +++ b/source4/lib/events/tevent_s4.c @@ -41,7 +41,7 @@ static void ev_wrap_debug(void *context, enum tevent_debug_level level, samba_level = 2; break; case TEVENT_DEBUG_TRACE: - samba_level = 5; + samba_level = 10; break; }; -- cgit From fd3f3e68f2e6be0196473f641f8edb41e40ca761 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Wed, 25 Feb 2009 10:02:41 -0500 Subject: Use stdbool.h instead of manually defining bool --- source4/lib/ldb/include/ldb.h | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'source4') diff --git a/source4/lib/ldb/include/ldb.h b/source4/lib/ldb/include/ldb.h index eb8e0ed11e..be41151409 100644 --- a/source4/lib/ldb/include/ldb.h +++ b/source4/lib/ldb/include/ldb.h @@ -46,16 +46,7 @@ #define _LDB_H_ 1 /*! \endcond */ -#ifndef bool -typedef int bool; -#endif -#ifndef true -#define true 1 -#endif -#ifndef false -#define false 0 -#endif - +#include #include "talloc.h" #include "tevent.h" #include "ldb_errors.h" -- cgit From f90250b54923588d756a02e76876fc66a6c68074 Mon Sep 17 00:00:00 2001 From: Tim Prouty Date: Wed, 25 Feb 2009 11:27:37 -0800 Subject: s4: make libintl a build dependency of heimdal_krb5 so all dependent binaries are linked properly --- source4/heimdal_build/internal.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4') diff --git a/source4/heimdal_build/internal.mk b/source4/heimdal_build/internal.mk index 9e32898a07..77dbf0fb98 100644 --- a/source4/heimdal_build/internal.mk +++ b/source4/heimdal_build/internal.mk @@ -255,7 +255,7 @@ HEIMDAL_GSSAPI_OBJ_FILES = \ CFLAGS = -I$(heimdalbuildsrcdir) -I$(heimdalsrcdir)/lib/krb5 -I$(heimdalsrcdir)/lib/asn1 -I$(heimdalsrcdir)/lib/com_err PRIVATE_DEPENDENCIES = HEIMDAL_ROKEN HEIMDAL_PKINIT_ASN1 HEIMDAL_WIND \ HEIMDAL_KRB5_ASN1 HEIMDAL_HX509 HEIMDAL_HCRYPTO \ - LIBNETIF LIBSAMBA-HOSTCONFIG + LIBNETIF LIBSAMBA-HOSTCONFIG INTL PUBLIC_DEPENDENCIES = HEIMDAL_COM_ERR # End SUBSYSTEM HEIMDAL_KRB5 ####################### -- cgit From 666cc916ebea618fbf7bfed99dbfff38326189fa Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 25 Feb 2009 16:17:44 +0100 Subject: s4-smbtorture: add test_GetPrintProcessorDirectory to RPC-SPOOLSS. Guenther --- source4/torture/rpc/spoolss.c | 64 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) (limited to 'source4') diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c index de600e8fb3..f8a66e7753 100644 --- a/source4/torture/rpc/spoolss.c +++ b/source4/torture/rpc/spoolss.c @@ -168,6 +168,69 @@ static bool test_EnumPorts(struct torture_context *tctx, return true; } +static bool test_GetPrintProcessorDirectory(struct torture_context *tctx, + struct dcerpc_pipe *p, + struct test_spoolss_context *ctx) +{ + NTSTATUS status; + struct spoolss_GetPrintProcessorDirectory r; + struct { + uint16_t level; + const char *server; + } levels[] = {{ + .level = 1, + .server = NULL + },{ + .level = 1, + .server = "" + },{ + .level = 78, + .server = "" + },{ + .level = 1, + .server = talloc_asprintf(ctx, "\\\\%s", dcerpc_server_name(p)) + },{ + .level = 1024, + .server = talloc_asprintf(ctx, "\\\\%s", dcerpc_server_name(p)) + } + }; + int i; + uint32_t needed; + + for (i=0;iserver_handle, true); ret &= test_EnumPorts(torture, p, ctx); ret &= test_GetPrinterDriverDirectory(torture, p, ctx); + ret &= test_GetPrintProcessorDirectory(torture, p, ctx); ret &= test_EnumPrinterDrivers(torture, p, ctx); ret &= test_EnumMonitors(torture, p, ctx); ret &= test_EnumPrintProcessors(torture, p, ctx); -- cgit From 6cd30a351a13822a557f20de3abe04bd8b2e3112 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 25 Feb 2009 21:10:44 +0100 Subject: s4-smbtorture: expand RPC-SPOOLSS enumform and getform tests for level 2 forms. Guenther --- source4/torture/rpc/spoolss.c | 74 ++++++++++++++++++++++++------------------- 1 file changed, 42 insertions(+), 32 deletions(-) (limited to 'source4') diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c index f8a66e7753..04c9768ea8 100644 --- a/source4/torture/rpc/spoolss.c +++ b/source4/torture/rpc/spoolss.c @@ -742,7 +742,8 @@ static bool test_ClosePrinter(struct torture_context *tctx, static bool test_GetForm(struct torture_context *tctx, struct dcerpc_pipe *p, struct policy_handle *handle, - const char *form_name) + const char *form_name, + uint32_t level) { NTSTATUS status; struct spoolss_GetForm r; @@ -750,12 +751,12 @@ static bool test_GetForm(struct torture_context *tctx, r.in.handle = handle; r.in.form_name = form_name; - r.in.level = 1; + r.in.level = level; r.in.buffer = NULL; r.in.offered = 0; r.out.needed = &needed; - torture_comment(tctx, "Testing GetForm\n"); + torture_comment(tctx, "Testing GetForm level %d\n", r.in.level); status = dcerpc_spoolss_GetForm(p, tctx, &r); torture_assert_ntstatus_ok(tctx, status, "GetForm failed"); @@ -787,45 +788,54 @@ static bool test_EnumForms(struct torture_context *tctx, bool ret = true; uint32_t needed; uint32_t count; + uint32_t levels[] = { 1, 2 }; + int i; - r.in.handle = handle; - r.in.level = 1; - r.in.buffer = NULL; - r.in.offered = 0; - r.out.needed = &needed; - r.out.count = &count; + for (i=0; i Date: Wed, 25 Feb 2009 23:04:52 +0100 Subject: s4-spoolss: implement dcesrv_spoolss_GetPrintProcessorDirectory. Guenther --- source4/ntptr/ntptr.h | 3 ++ source4/ntptr/ntptr_interface.c | 9 ++++++ source4/ntptr/simple_ldb/ntptr_simple_ldb.c | 43 +++++++++++++++++++++++++++++ source4/rpc_server/spoolss/dcesrv_spoolss.c | 14 +++++++++- 4 files changed, 68 insertions(+), 1 deletion(-) (limited to 'source4') diff --git a/source4/ntptr/ntptr.h b/source4/ntptr/ntptr.h index 24c467fe65..91817a202f 100644 --- a/source4/ntptr/ntptr.h +++ b/source4/ntptr/ntptr.h @@ -74,6 +74,7 @@ struct spoolss_EnumForms; struct spoolss_EnumPorts; struct spoolss_EnumPrintProcessors; struct spoolss_XcvData; +struct spoolss_GetPrintProcessorDirectory; /* the ntptr operations structure - contains function pointers to the backend implementations of each operation */ @@ -144,6 +145,8 @@ struct ntptr_ops { /* PrintProcessor functions */ WERROR (*EnumPrintProcessors)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, struct spoolss_EnumPrintProcessors *r); + WERROR (*GetPrintProcessorDirectory)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, + struct spoolss_GetPrintProcessorDirectory *r); /* Printer functions */ WERROR (*EnumPrinters)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, diff --git a/source4/ntptr/ntptr_interface.c b/source4/ntptr/ntptr_interface.c index 109a9f560b..b65a2e32cd 100644 --- a/source4/ntptr/ntptr_interface.c +++ b/source4/ntptr/ntptr_interface.c @@ -263,6 +263,15 @@ WERROR ntptr_EnumPrintProcessors(struct ntptr_context *ntptr, TALLOC_CTX *mem_ct return ntptr->ops->EnumPrintProcessors(ntptr, mem_ctx, r); } +WERROR ntptr_GetPrintProcessorDirectory(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, + struct spoolss_GetPrintProcessorDirectory *r) +{ + if (!ntptr->ops->GetPrintProcessorDirectory) { + return WERR_NOT_SUPPORTED; + } + return ntptr->ops->GetPrintProcessorDirectory(ntptr, mem_ctx, r); +} + /* Printer functions */ WERROR ntptr_EnumPrinters(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, diff --git a/source4/ntptr/simple_ldb/ntptr_simple_ldb.c b/source4/ntptr/simple_ldb/ntptr_simple_ldb.c index c570b03a35..459babce0e 100644 --- a/source4/ntptr/simple_ldb/ntptr_simple_ldb.c +++ b/source4/ntptr/simple_ldb/ntptr_simple_ldb.c @@ -750,6 +750,47 @@ static WERROR sptr_GetPrinterForm(struct ntptr_GenericHandle *printer, TALLOC_CT return WERR_OK; } +static WERROR sptr_GetPrintProcessorDirectory(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, + struct spoolss_GetPrintProcessorDirectory *r) +{ + union spoolss_PrintProcessorDirectoryInfo *info; + const char *prefix; + const char *postfix; + + /* + * NOTE: normally r->in.level is 1, but both w2k3 and nt4 sp6a + * are ignoring the r->in.level completely, so we do :-) + */ + + /* + * TODO: check the server name is ours + * - if it's a invalid UNC then return WERR_INVALID_NAME + * - if it's the wrong host name return WERR_INVALID_PARAM + * - if it's "" then we need to return a local WINDOWS path + */ + if (!r->in.server || !r->in.server[0]) { + prefix = "C:\\PRTPROCS"; + } else { + prefix = talloc_asprintf(mem_ctx, "%s\\prnproc$", r->in.server); + W_ERROR_HAVE_NO_MEMORY(prefix); + } + + if (r->in.environment && strcmp(SPOOLSS_ARCHITECTURE_NT_X86, r->in.environment) == 0) { + postfix = "W32X86"; + } else { + return WERR_INVALID_ENVIRONMENT; + } + + info = talloc(mem_ctx, union spoolss_PrintProcessorDirectoryInfo); + W_ERROR_HAVE_NO_MEMORY(info); + + info->info1.directory_name = talloc_asprintf(mem_ctx, "%s\\%s", prefix, postfix); + W_ERROR_HAVE_NO_MEMORY(info->info1.directory_name); + + r->out.info = info; + return WERR_OK; +} + /* initialialise the simble ldb backend, registering ourselves with the ntptr subsystem @@ -793,6 +834,8 @@ static const struct ntptr_ops ntptr_simple_ldb_ops = { /* PrintProcessor functions */ /* .EnumPrintProcessors = sptr_EnumPrintProcessors, */ + .GetPrintProcessorDirectory = sptr_GetPrintProcessorDirectory, + /* Printer functions */ .EnumPrinters = sptr_EnumPrinters, .OpenPrinter = sptr_OpenPrinter, diff --git a/source4/rpc_server/spoolss/dcesrv_spoolss.c b/source4/rpc_server/spoolss/dcesrv_spoolss.c index 33c657cc1b..89b93bbaa4 100644 --- a/source4/rpc_server/spoolss/dcesrv_spoolss.c +++ b/source4/rpc_server/spoolss/dcesrv_spoolss.c @@ -454,7 +454,19 @@ static WERROR dcesrv_spoolss_EnumPrintProcessors(struct dcesrv_call_state *dce_c static WERROR dcesrv_spoolss_GetPrintProcessorDirectory(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct spoolss_GetPrintProcessorDirectory *r) { - DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); + struct ntptr_context *ntptr = talloc_get_type(dce_call->context->private_data, struct ntptr_context); + WERROR status; + struct smb_iconv_convenience *ic = lp_iconv_convenience(ntptr->lp_ctx); + + status = dcesrv_spoolss_check_server_name(dce_call, mem_ctx, r->in.server); + W_ERROR_NOT_OK_RETURN(status); + + status = ntptr_GetPrintProcessorDirectory(ntptr, mem_ctx, r); + W_ERROR_NOT_OK_RETURN(status); + + *r->out.needed = SPOOLSS_BUFFER_UNION(spoolss_PrintProcessorDirectoryInfo, ic, r->out.info, r->in.level); + r->out.info = SPOOLSS_BUFFER_OK(r->out.info, NULL); + return SPOOLSS_BUFFER_OK(WERR_OK, WERR_INSUFFICIENT_BUFFER); } -- cgit From 8bf0c256d7f06fe7d0abf031921abd83e6956c8b Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 9 Feb 2009 22:22:45 +0100 Subject: s4-smbtorture: add test_AddJob test to RPC-SPOOLSS test. Guenther --- source4/torture/rpc/spoolss.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'source4') diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c index 04c9768ea8..9d8bc4b186 100644 --- a/source4/torture/rpc/spoolss.c +++ b/source4/torture/rpc/spoolss.c @@ -1045,6 +1045,33 @@ static bool test_SetJob(struct torture_context *tctx, return true; } +static bool test_AddJob(struct torture_context *tctx, + struct dcerpc_pipe *p, + struct policy_handle *handle) +{ + NTSTATUS status; + struct spoolss_AddJob r; + uint32_t needed; + + r.in.level = 0; + r.in.handle = handle; + r.in.offered = 0; + r.out.needed = &needed; + + torture_comment(tctx, "Testing AddJob\n"); + + status = dcerpc_spoolss_AddJob(p, tctx, &r); + torture_assert_werr_equal(tctx, r.out.result, WERR_UNKNOWN_LEVEL, "AddJob failed"); + + r.in.level = 1; + + status = dcerpc_spoolss_AddJob(p, tctx, &r); + torture_assert_werr_equal(tctx, r.out.result, WERR_INVALID_PARAM, "AddJob failed"); + + return true; +} + + static bool test_EnumJobs(struct torture_context *tctx, struct dcerpc_pipe *p, struct policy_handle *handle) @@ -1084,6 +1111,7 @@ static bool test_EnumJobs(struct torture_context *tctx, info = r.out.info; for (j = 0; j < count; j++) { + test_GetJob(tctx, p, handle, info[j].info1.job_id); test_SetJob(tctx, p, handle, info[j].info1.job_id, SPOOLSS_JOB_CONTROL_PAUSE); test_SetJob(tctx, p, handle, info[j].info1.job_id, SPOOLSS_JOB_CONTROL_RESUME); @@ -1163,6 +1191,7 @@ static bool test_DoPrintTest(struct torture_context *tctx, torture_assert_ntstatus_ok(tctx, status, "dcerpc_spoolss_EndDocPrinter failed"); torture_assert_werr_ok(tctx, e.out.result, "EndDocPrinter failed"); + ret &= test_AddJob(tctx, p, handle); ret &= test_EnumJobs(tctx, p, handle); ret &= test_SetJob(tctx, p, handle, job_id, SPOOLSS_JOB_CONTROL_DELETE); -- cgit From 7e01ec5560e8193c8e8853ba49c0ee625956c1fd Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 25 Feb 2009 23:42:03 +0100 Subject: s4-spoolss: implement dcesrv_spoolss_AddJob which always is a dummy. Guenther --- source4/rpc_server/spoolss/dcesrv_spoolss.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source4') diff --git a/source4/rpc_server/spoolss/dcesrv_spoolss.c b/source4/rpc_server/spoolss/dcesrv_spoolss.c index 89b93bbaa4..f1ef2f0acb 100644 --- a/source4/rpc_server/spoolss/dcesrv_spoolss.c +++ b/source4/rpc_server/spoolss/dcesrv_spoolss.c @@ -546,7 +546,11 @@ static WERROR dcesrv_spoolss_EndDocPrinter(struct dcesrv_call_state *dce_call, T static WERROR dcesrv_spoolss_AddJob(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct spoolss_AddJob *r) { - DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); + if (r->in.level != 1) { + return WERR_UNKNOWN_LEVEL; + } + + return WERR_INVALID_PARAM; } -- cgit From 76a0050e239b1fb9e2135f2e6cea80ed780a0ee0 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 26 Feb 2009 13:12:07 +1100 Subject: A simple hack to avoid the segfault in #6138 Thanks to Andrew Kroeger for reporting this. This fix just for the release. A better fix will make it into the master branch soon. Andrew Bartlett --- source4/rpc_server/netlogon/dcerpc_netlogon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4') diff --git a/source4/rpc_server/netlogon/dcerpc_netlogon.c b/source4/rpc_server/netlogon/dcerpc_netlogon.c index f1c063ed90..2efddc74fc 100644 --- a/source4/rpc_server/netlogon/dcerpc_netlogon.c +++ b/source4/rpc_server/netlogon/dcerpc_netlogon.c @@ -1220,7 +1220,7 @@ static WERROR dcesrv_netr_DsRGetDCNameEx2(struct dcesrv_call_state *dce_call, TA /* Win7-beta will send the domain name in the form the user typed, so we have to cope with both the short and long form here */ - if (strcasecmp(r->in.domain_name, lp_workgroup(dce_call->conn->dce_ctx->lp_ctx)) == 0) { + if (r->in.domain_name == NULL || strcasecmp(r->in.domain_name, lp_workgroup(dce_call->conn->dce_ctx->lp_ctx)) == 0) { r->in.domain_name = lp_realm(dce_call->conn->dce_ctx->lp_ctx); } -- cgit From c3632e4efc506a401a9d75c4d75b14a1a220caa2 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 26 Feb 2009 13:21:08 +1100 Subject: Mark as the Samba 4.0 alpha7 release --- source4/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4') diff --git a/source4/VERSION b/source4/VERSION index e7d05f6a09..20256436eb 100644 --- a/source4/VERSION +++ b/source4/VERSION @@ -89,7 +89,7 @@ SAMBA_VERSION_RC_RELEASE= # e.g. SAMBA_VERSION_IS_SVN_SNAPSHOT=yes # # -> "3.0.0-SVN-build-199" # ######################################################## -SAMBA_VERSION_IS_GIT_SNAPSHOT=yes +SAMBA_VERSION_IS_GIT_SNAPSHOT=no ######################################################## # This is for specifying a release nickname # -- cgit From b679f6b25673969800f31cf0bd0f57799bb0598c Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 26 Feb 2009 09:10:23 +0100 Subject: s4:VERSION: mark as 4.0.0-alpha8 gitsnapshot metze --- source4/VERSION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4') diff --git a/source4/VERSION b/source4/VERSION index 20256436eb..58f8cc169d 100644 --- a/source4/VERSION +++ b/source4/VERSION @@ -57,7 +57,7 @@ SAMBA_VERSION_TP_RELEASE= # e.g. SAMBA_VERSION_ALPHA_RELEASE=1 # # -> "4.0.0alpha1" # ######################################################## -SAMBA_VERSION_ALPHA_RELEASE=7 +SAMBA_VERSION_ALPHA_RELEASE=8 ######################################################## # For 'pre' releases the version will be # @@ -89,7 +89,7 @@ SAMBA_VERSION_RC_RELEASE= # e.g. SAMBA_VERSION_IS_SVN_SNAPSHOT=yes # # -> "3.0.0-SVN-build-199" # ######################################################## -SAMBA_VERSION_IS_GIT_SNAPSHOT=no +SAMBA_VERSION_IS_GIT_SNAPSHOT=yes ######################################################## # This is for specifying a release nickname # -- cgit From 64662cb0c34425f7a0ccc66e43c21b7b69451ca9 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 26 Feb 2009 09:42:29 +0100 Subject: s4:ldb_map: include ldb_includes.h first to get replace.h as first header This should bring the build on AIX one step further. metze --- source4/lib/ldb/ldb_map/ldb_map.c | 1 + source4/lib/ldb/ldb_map/ldb_map_inbound.c | 1 + source4/lib/ldb/ldb_map/ldb_map_outbound.c | 1 + 3 files changed, 3 insertions(+) (limited to 'source4') diff --git a/source4/lib/ldb/ldb_map/ldb_map.c b/source4/lib/ldb/ldb_map/ldb_map.c index 959540374c..5b4ea7910a 100644 --- a/source4/lib/ldb/ldb_map/ldb_map.c +++ b/source4/lib/ldb/ldb_map/ldb_map.c @@ -35,6 +35,7 @@ * Author: Jelmer Vernooij, Martin Kuehl */ +#include "ldb_includes.h" #include "ldb_map.h" #include "ldb_map_private.h" diff --git a/source4/lib/ldb/ldb_map/ldb_map_inbound.c b/source4/lib/ldb/ldb_map/ldb_map_inbound.c index 822dea654e..455740ce59 100644 --- a/source4/lib/ldb/ldb_map/ldb_map_inbound.c +++ b/source4/lib/ldb/ldb_map/ldb_map_inbound.c @@ -24,6 +24,7 @@ */ +#include "ldb_includes.h" #include "ldb_map.h" #include "ldb_map_private.h" diff --git a/source4/lib/ldb/ldb_map/ldb_map_outbound.c b/source4/lib/ldb/ldb_map/ldb_map_outbound.c index eb7b4590ba..ffcefad6be 100644 --- a/source4/lib/ldb/ldb_map/ldb_map_outbound.c +++ b/source4/lib/ldb/ldb_map/ldb_map_outbound.c @@ -25,6 +25,7 @@ */ +#include "ldb_includes.h" #include "ldb_map.h" #include "ldb_map_private.h" -- cgit From b6597424dbacdbfcaa37d8860fc4343be1a4514a Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 26 Feb 2009 10:05:58 +0100 Subject: s4:heimdal_build: don't always build setprogname.o This hopefully fixes the build on Mac OS 10, where setprogname() is available via libc. asn1_compile and compile_et use only .ho files again and don't use socket_wrapper anymore. metze --- source4/heimdal_build/internal.m4 | 1 + source4/heimdal_build/internal.mk | 50 ++++++++++++++++++++++++++------------- 2 files changed, 34 insertions(+), 17 deletions(-) (limited to 'source4') diff --git a/source4/heimdal_build/internal.m4 b/source4/heimdal_build/internal.m4 index a48777fab1..3039c8a796 100644 --- a/source4/heimdal_build/internal.m4 +++ b/source4/heimdal_build/internal.m4 @@ -77,6 +77,7 @@ AC_CHECK_FUNCS([ \ atexit \ cgetent \ getprogname \ + setprogname \ inet_aton \ gethostname \ getnameinfo \ diff --git a/source4/heimdal_build/internal.mk b/source4/heimdal_build/internal.mk index 77dbf0fb98..ea8d4731db 100644 --- a/source4/heimdal_build/internal.mk +++ b/source4/heimdal_build/internal.mk @@ -568,27 +568,36 @@ $(heimdalsrcdir)/lib/wind/bidi_table.h $(heimdalsrcdir)/lib/wind/bidi_table.c: $ clean:: @rm -f $(heimdalsrcdir)/lib/wind/bidi_table.h $(heimdalsrcdir)/lib/wind/bidi_table.c -[SUBSYSTEM::HEIMDAL_ROKEN_GETPROGNAME] +[SUBSYSTEM::HEIMDAL_ROKEN_PROGNAME] -HEIMDAL_ROKEN_GETPROGNAME_OBJ_FILES = $(heimdalsrcdir)/lib/roken/getprogname.o -$(HEIMDAL_ROKEN_GETPROGNAME_OBJ_FILES): CFLAGS+=-I$(heimdalbuildsrcdir) -I$(heimdalsrcdir)/lib/roken -I$(socketwrappersrcdir) +HEIMDAL_ROKEN_PROGNAME_OBJ_FILES = \ + $(heimdalsrcdir)/lib/roken/getprogname.o \ + $(heimdalsrcdir)/lib/roken/setprogname.o +$(HEIMDAL_ROKEN_PROGNAME_OBJ_FILES): CFLAGS+=-I$(heimdalbuildsrcdir) -I$(heimdalsrcdir)/lib/roken -I$(socketwrappersrcdir) [SUBSYSTEM::HEIMDAL_ROKEN_CLOSEFROM] HEIMDAL_ROKEN_CLOSEFROM_OBJ_FILES = $(heimdalsrcdir)/lib/roken/closefrom.o $(HEIMDAL_ROKEN_CLOSEFROM_OBJ_FILES): CFLAGS+=-I$(heimdalbuildsrcdir) -I$(heimdalsrcdir)/lib/roken -I$(socketwrappersrcdir) -[SUBSYSTEM::HEIMDAL_ROKEN_GETPROGNAME_H] +[SUBSYSTEM::HEIMDAL_ROKEN_PROGNAME_H] -HEIMDAL_ROKEN_GETPROGNAME_H_OBJ_FILES = $(heimdalsrcdir)/lib/roken/getprogname.ho -$(HEIMDAL_ROKEN_GETPROGNAME_H_OBJ_FILES): CFLAGS+=-I$(heimdalbuildsrcdir) -I$(heimdalsrcdir)/lib/roken -I$(socketwrappersrcdir) +HEIMDAL_ROKEN_PROGNAME_H_OBJ_FILES = \ + $(heimdalsrcdir)/lib/roken/getprogname.ho \ + $(heimdalsrcdir)/lib/roken/setprogname.ho +$(HEIMDAL_ROKEN_PROGNAME_H_OBJ_FILES): CFLAGS+=-I$(heimdalbuildsrcdir) -I$(heimdalsrcdir)/lib/roken -DSOCKET_WRAPPER_DISABLE=1 + +[SUBSYSTEM::HEIMDAL_ROKEN_CLOSEFROM_H] + +HEIMDAL_ROKEN_CLOSEFROM_H_OBJ_FILES = $(heimdalsrcdir)/lib/roken/closefrom.ho +$(HEIMDAL_ROKEN_CLOSEFROM_H_OBJ_FILES): CFLAGS+=-I$(heimdalbuildsrcdir) -I$(heimdalsrcdir)/lib/roken -DSOCKET_WRAPPER_DISABLE=1 ####################### # Start SUBSYSTEM HEIMDAL_ROKEN [SUBSYSTEM::HEIMDAL_ROKEN] CFLAGS = -I$(heimdalbuildsrcdir) -I$(heimdalsrcdir)/lib/roken -I$(socketwrappersrcdir) PRIVATE_DEPENDENCIES = \ - HEIMDAL_ROKEN_GETPROGNAME \ + HEIMDAL_ROKEN_PROGNAME \ HEIMDAL_ROKEN_CLOSEFROM \ RESOLV \ LIBREPLACE_NETWORK @@ -615,7 +624,6 @@ HEIMDAL_ROKEN_OBJ_FILES = \ $(heimdalsrcdir)/lib/roken/roken_gethostby.o \ $(heimdalsrcdir)/lib/roken/signal.o \ $(heimdalsrcdir)/lib/roken/vis.o \ - $(heimdalsrcdir)/lib/roken/setprogname.o \ $(heimdalsrcdir)/lib/roken/strlwr.o \ $(heimdalsrcdir)/lib/roken/strsep_copy.o \ $(heimdalsrcdir)/lib/roken/strsep.o \ @@ -631,7 +639,17 @@ HEIMDAL_ROKEN_OBJ_FILES = \ $(heimdalbuildsrcdir)/replace.o $(HEIMDAL_ROKEN_OBJ_FILES) $(HEIMDAL_ROKEN_OBJ_FILES:.o=.d):: $(heimdalsrcdir)/lib/roken/roken.h -$(HEIMDAL_ROKEN_OBJ_FILES:.o=.ho) $(HEIMDAL_ROKEN_OBJ_FILES:.o=.hd):: $(heimdalsrcdir)/lib/roken/roken.h + +[SUBSYSTEM::HEIMDAL_ROKEN_H] +CFLAGS = -I$(heimdalbuildsrcdir) -I$(heimdalsrcdir)/lib/roken -DSOCKET_WRAPPER_DISABLE=1 +PRIVATE_DEPENDENCIES = \ + HEIMDAL_ROKEN_PROGNAME_H \ + HEIMDAL_ROKEN_CLOSEFROM_H \ + RESOLV \ + LIBREPLACE_NETWORK + +HEIMDAL_ROKEN_H_OBJ_FILES = $(HEIMDAL_ROKEN_OBJ_FILES:.o=.ho) +$(HEIMDAL_ROKEN_H_OBJ_FILES:.ho=.hd):: $(heimdalsrcdir)/lib/roken/roken.h $(heimdalsrcdir)/lib/roken/roken.h: @echo 'Creating $(heimdalsrcdir)/lib/roken/roken.h' @@ -656,7 +674,7 @@ HEIMDAL_COM_ERR_OBJ_FILES = \ # Start BINARY asn1_compile [BINARY::asn1_compile] USE_HOSTCC = YES -PRIVATE_DEPENDENCIES = HEIMDAL_ROKEN +PRIVATE_DEPENDENCIES = HEIMDAL_ROKEN_H ASN1C = $(builddir)/bin/asn1_compile @@ -680,10 +698,9 @@ dist:: $(heimdalsrcdir)/lib/asn1/lex.c asn1_compile_OBJ_FILES = \ $(asn1_compile_ASN1_OBJ_FILES) \ - $(heimdalsrcdir)/lib/vers/print_version.ho \ - $(socketwrappersrcdir)/socket_wrapper.ho \ + $(heimdalsrcdir)/lib/vers/print_version.ho -$(asn1_compile_OBJ_FILES): CFLAGS+=-I$(heimdalbuildsrcdir) -I$(heimdalsrcdir)/lib/asn1 -I$(heimdalsrcdir)/lib/roken -I$(socketwrappersrcdir) +$(asn1_compile_OBJ_FILES): CFLAGS+=-I$(heimdalbuildsrcdir) -I$(heimdalsrcdir)/lib/asn1 -I$(heimdalsrcdir)/lib/roken -DSOCKET_WRAPPER_DISABLE=1 $(eval $(call heimdal_proto_header_template, \ $(heimdalsrcdir)/lib/asn1/der-protos.h, \ @@ -699,7 +716,7 @@ $(eval $(call heimdal_proto_header_template, \ # Start BINARY compile_et [BINARY::compile_et] USE_HOSTCC = YES -PRIVATE_DEPENDENCIES = HEIMDAL_ROKEN +PRIVATE_DEPENDENCIES = HEIMDAL_ROKEN_H # End BINARY compile_et ####################### @@ -708,10 +725,9 @@ ET_COMPILER = $(builddir)/bin/compile_et compile_et_OBJ_FILES = $(heimdalsrcdir)/lib/vers/print_version.ho \ $(heimdalsrcdir)/lib/com_err/parse.ho \ $(heimdalsrcdir)/lib/com_err/lex.ho \ - $(heimdalsrcdir)/lib/com_err/compile_et.ho \ - $(socketwrappersrcdir)/socket_wrapper.ho \ + $(heimdalsrcdir)/lib/com_err/compile_et.ho -$(compile_et_OBJ_FILES): CFLAGS+=-I$(heimdalbuildsrcdir) -I$(heimdalsrcdir)/lib/com_err -I$(heimdalsrcdir)/lib/roken -I$(socketwrappersrcdir) +$(compile_et_OBJ_FILES): CFLAGS+=-I$(heimdalbuildsrcdir) -I$(heimdalsrcdir)/lib/com_err -I$(heimdalsrcdir)/lib/roken -DSOCKET_WRAPPER_DISABLE=1 $(heimdalsrcdir)/lib/com_err/lex.c:: $(heimdalsrcdir)/lib/com_err/parse.c dist:: $(heimdalsrcdir)/lib/com_err/lex.c -- cgit From 8e4816f0078fd94a1b83798f52a63dc679eed47e Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 26 Feb 2009 10:55:00 +0100 Subject: s4:Makefile: try to fix 'make installheaders' on *BSD systems metze --- source4/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4') diff --git a/source4/Makefile b/source4/Makefile index 508836f6da..15b1b8ba40 100644 --- a/source4/Makefile +++ b/source4/Makefile @@ -146,7 +146,7 @@ endif clean:: @find ../lib ../libcli ../librpc ../nsswitch -name '*.o' -o -name '*.ho' | xargs rm -f -PUBLIC_HEADERS += $(srcdir)/version.h +PUBLIC_HEADERS += ./version.h libraries:: $(STATIC_LIBS) $(SHARED_LIBS) modules:: $(PLUGINS) -- cgit From d3ac11c64a95c2041dc0002b8cc59d756736d3be Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 26 Feb 2009 13:12:54 +0100 Subject: s4:heimdal_build: correrctly switch closefrom() and get/setprogname() replacements on and off metze --- source4/heimdal_build/internal.m4 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'source4') diff --git a/source4/heimdal_build/internal.m4 b/source4/heimdal_build/internal.m4 index 3039c8a796..4cd7521c37 100644 --- a/source4/heimdal_build/internal.m4 +++ b/source4/heimdal_build/internal.m4 @@ -269,16 +269,18 @@ SMB_ENABLE(compile_et, YES) # only add closefrom if needed SMB_ENABLE(HEIMDAL_ROKEN_CLOSEFROM, NO) +SMB_ENABLE(HEIMDAL_ROKEN_CLOSEFROM_H, NO) if test t$ac_cv_func_closefrom != tyes; then SMB_ENABLE(HEIMDAL_ROKEN_CLOSEFROM, YES) + SMB_ENABLE(HEIMDAL_ROKEN_CLOSEFROM_H, YES) fi # only add getprogname if needed -SMB_ENABLE(HEIMDAL_ROKEN_GETPROGNAME, NO) -SMB_ENABLE(HEIMDAL_ROKEN_GETPROGNAME_H, NO) +SMB_ENABLE(HEIMDAL_ROKEN_PROGNAME, NO) +SMB_ENABLE(HEIMDAL_ROKEN_PROGNAME_H, NO) if test t$ac_cv_func_getprogname != tyes; then - SMB_ENABLE(HEIMDAL_ROKEN_GETPROGNAME, YES) - SMB_ENABLE(HEIMDAL_ROKEN_GETPROGNAME_H, YES) + SMB_ENABLE(HEIMDAL_ROKEN_PROGNAME, YES) + SMB_ENABLE(HEIMDAL_ROKEN_PROGNAME_H, YES) fi VPATH="$VPATH:\$(HEIMDAL_VPATH)" -- cgit From bcadb77c18f9ed9be22762871617f1a12294e88c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 26 Feb 2009 10:13:57 -0800 Subject: Add another torture test inspired by George @ Apple. Inside a directory, keep a file open and then renaming the directory should fail with ACCESS_DENIED. This is connected to the test case where the close was failing due to a delayed write on a file not being able to succeed when Samba allowed the containing directory to be renamed. I will fix this in the server shortly (this should be done across connections also but with will be very hard in Samba - would need a full scan of the open file db on every directory rename) - so I will fix for the local case first (scanning local file opens inside an smbd is cheap). Jeremy. --- source4/torture/raw/rename.c | 86 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) (limited to 'source4') diff --git a/source4/torture/raw/rename.c b/source4/torture/raw/rename.c index 9d629f0bbf..951d91a684 100644 --- a/source4/torture/raw/rename.c +++ b/source4/torture/raw/rename.c @@ -516,6 +516,91 @@ done: return ret; } +/* + test dir rename. +*/ +static bool test_dir_rename(struct torture_context *tctx, struct smbcli_state *cli) +{ + union smb_open io; + union smb_rename ren_io; + NTSTATUS status; + const char *dname1 = BASEDIR "\\dir_for_rename"; + const char *dname2 = BASEDIR "\\renamed_dir"; + const char *fname = BASEDIR "\\dir_for_rename\\file.txt"; + bool ret = true; + int fnum = -1; + + printf("Checking rename on a directory containing an open file.\n"); + + if (!torture_setup_dir(cli, BASEDIR)) { + return false; + } + + /* create a directory */ + smbcli_rmdir(cli->tree, dname1); + smbcli_rmdir(cli->tree, dname2); + smbcli_unlink(cli->tree, dname1); + smbcli_unlink(cli->tree, dname2); + + ZERO_STRUCT(io); + io.generic.level = RAW_OPEN_NTCREATEX; + io.ntcreatex.in.open_disposition = NTCREATEX_DISP_CREATE; + io.ntcreatex.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED; + io.ntcreatex.in.alloc_size = 0; + io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL; + io.ntcreatex.in.share_access = NTCREATEX_SHARE_ACCESS_READ | NTCREATEX_SHARE_ACCESS_WRITE; + io.ntcreatex.in.open_disposition = NTCREATEX_DISP_CREATE; + io.ntcreatex.in.create_options = NTCREATEX_OPTIONS_DIRECTORY; + io.ntcreatex.in.fname = dname1; + status = smb_raw_open(cli->tree, tctx, &io); + CHECK_STATUS(status, NT_STATUS_OK); + + fnum = io.ntcreatex.out.file.fnum; + smbcli_close(cli->tree, fnum); + + /* Now create and hold open a file. */ + ZERO_STRUCT(io); + + io.generic.level = RAW_OPEN_NTCREATEX; + io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED; + io.ntcreatex.in.root_fid = 0; + io.ntcreatex.in.alloc_size = 0; + io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL; + io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL; + io.ntcreatex.in.share_access = NTCREATEX_SHARE_ACCESS_READ | NTCREATEX_SHARE_ACCESS_WRITE | NTCREATEX_SHARE_ACCESS_DELETE; + io.ntcreatex.in.open_disposition = NTCREATEX_DISP_CREATE; + io.ntcreatex.in.create_options = 0; + io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS; + io.ntcreatex.in.security_flags = 0; + io.ntcreatex.in.fname = fname; + + /* Create the file. */ + + status = smb_raw_open(cli->tree, tctx, &io); + CHECK_STATUS(status, NT_STATUS_OK); + fnum = io.ntcreatex.out.file.fnum; + + /* Now try and rename the directory. */ + + ZERO_STRUCT(ren_io); + ren_io.generic.level = RAW_RENAME_RENAME; + ren_io.rename.in.pattern1 = dname1; + ren_io.rename.in.pattern2 = dname2; + ren_io.rename.in.attrib = 0; + + status = smb_raw_rename(cli->tree, &ren_io); + CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED); + +done: + + if (fnum != -1) { + smbcli_close(cli->tree, fnum); + } + smb_raw_exit(cli->session); + smbcli_deltree(cli->tree, BASEDIR); + return ret; +} + extern bool test_trans2rename(struct torture_context *tctx, struct smbcli_state *cli1, struct smbcli_state *cli2); extern bool test_nttransrename(struct torture_context *tctx, struct smbcli_state *cli1); @@ -533,6 +618,7 @@ struct torture_suite *torture_raw_rename(TALLOC_CTX *mem_ctx) torture_suite_add_1smb_test(suite, "nttransrename", test_nttransrename); torture_suite_add_1smb_test(suite, "ntrename", test_ntrename); torture_suite_add_1smb_test(suite, "osxrename", test_osxrename); + torture_suite_add_1smb_test(suite, "directory rename", test_dir_rename); return suite; } -- cgit From fe8cf69ec644f399d4b41c21b74703e0e500e092 Mon Sep 17 00:00:00 2001 From: Björn Jacke Date: Thu, 26 Feb 2009 16:32:57 +0100 Subject: don't hardcode python path Signed-off-by: Michael Adam --- source4/selftest/tests.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source4') diff --git a/source4/selftest/tests.sh b/source4/selftest/tests.sh index 36e3bbe364..99e530ec38 100755 --- a/source4/selftest/tests.sh +++ b/source4/selftest/tests.sh @@ -23,6 +23,11 @@ then PERL=perl fi +if [ ! -n "$PYTHON" ] +then + PYTHON=python +fi + plantest() { name=$1 env=$2 @@ -394,7 +399,6 @@ then plantest "nss.test using winbind" member $VALGRIND $nsstest4 $samba4bindir/shared/libnss_winbind.so fi -PYTHON=/usr/bin/python SUBUNITRUN="$VALGRIND $PYTHON $samba4srcdir/scripting/bin/subunitrun" plantest "ldb.python" none PYTHONPATH="$PYTHONPATH:$samba4srcdir/lib/ldb/tests/python/" $SUBUNITRUN api plantest "credentials.python" none PYTHONPATH="$PYTHONPATH:$samba4srcdir/auth/credentials/tests" $SUBUNITRUN bindings -- cgit From 9569d979de43970399f33645323e9091338084f6 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 27 Feb 2009 20:57:49 -0800 Subject: And the prize for the most pain caused in the build farm for a simple typo goes to..... Tim Prouty !!!! Sorry Tim, nice test but you made a typo in passing in the size of an array so we were reading uninitialized memory :-). That took far longer than it should have to track down... (%$&#ing build system....). The build farm should now slowly go back to normal. Jeremy. --- source4/torture/raw/streams.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4') diff --git a/source4/torture/raw/streams.c b/source4/torture/raw/streams.c index bf87bd224f..d0d21ccc06 100644 --- a/source4/torture/raw/streams.c +++ b/source4/torture/raw/streams.c @@ -1454,7 +1454,7 @@ static bool test_stream_create_disposition(struct torture_context *tctx, status = smb_raw_open(cli->tree, mem_ctx, &io); CHECK_STATUS(status, NT_STATUS_OK); smbcli_close(cli->tree, io.ntcreatex.out.file.fnum); - if (!check_stream_list(cli, fname, 2, &default_stream_name)) { + if (!check_stream_list(cli, fname, 1, &default_stream_name)) { goto done; } -- cgit From 9ffb6d2d9e78ed192b8215194b6328d03d1ddad3 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 1 Mar 2009 06:33:40 +0100 Subject: Add allow_badcharcnv argument to all conversion function, for consistency with Samba 3. --- source4/auth/ntlm/ntlm_check.c | 2 +- source4/dsdb/common/util.c | 2 +- source4/dsdb/samdb/ldb_modules/password_hash.c | 6 +++--- source4/dsdb/schema/schema_init.c | 2 +- source4/dsdb/schema/schema_syntax.c | 8 ++++---- source4/kdc/kpasswdd.c | 4 ++-- source4/lib/registry/ldb.c | 4 ++-- source4/lib/registry/tests/generic.c | 6 +++--- source4/lib/registry/util.c | 4 ++-- source4/lib/tdr/tdr.c | 4 ++-- source4/libcli/raw/rawfileinfo.c | 2 +- source4/libcli/raw/rawrequest.c | 8 ++++---- source4/libcli/smb2/request.c | 4 ++-- source4/libnet/libnet_samdump.c | 2 +- source4/librpc/ndr/ndr_string.c | 20 ++++++++++---------- source4/rpc_server/samr/samr_password.c | 6 +++--- source4/smb_server/smb/request.c | 4 ++-- source4/torture/basic/charset.c | 2 +- source4/torture/basic/utable.c | 4 ++-- source4/torture/rpc/samlogon.c | 2 +- source4/torture/rpc/spoolss_win.c | 2 +- 21 files changed, 49 insertions(+), 49 deletions(-) (limited to 'source4') diff --git a/source4/auth/ntlm/ntlm_check.c b/source4/auth/ntlm/ntlm_check.c index a3ac7f3347..5298432e61 100644 --- a/source4/auth/ntlm/ntlm_check.c +++ b/source4/auth/ntlm/ntlm_check.c @@ -323,7 +323,7 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx, if (lm_response->length && (convert_string_talloc(mem_ctx, CH_DOS, CH_UNIX, lm_response->data, lm_response->length, - (void **)&unix_pw) != -1)) { + (void **)&unix_pw, false) != -1)) { if (E_deshash(unix_pw, client_lm.hash)) { lm_ok = true; } else { diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c index b02a162293..82f5b6ed1d 100644 --- a/source4/dsdb/common/util.c +++ b/source4/dsdb/common/util.c @@ -1693,7 +1693,7 @@ NTSTATUS samdb_set_password(struct ldb_context *ctx, TALLOC_CTX *mem_ctx, if (convert_string_talloc_convenience(mem_ctx, lp_iconv_convenience(ldb_get_opaque(ctx, "loadparm")), CH_UTF16, CH_UNIX, new_password->data, new_password->length, - (void **)&new_pass) != -1) { + (void **)&new_pass, false) != -1) { /* possibly check password complexity */ diff --git a/source4/dsdb/samdb/ldb_modules/password_hash.c b/source4/dsdb/samdb/ldb_modules/password_hash.c index da4c57463b..f427e697b4 100644 --- a/source4/dsdb/samdb/ldb_modules/password_hash.c +++ b/source4/dsdb/samdb/ldb_modules/password_hash.c @@ -1339,7 +1339,7 @@ static int setup_password_fields(struct setup_password_fields_io *io) } converted_pw_len = convert_string_talloc_convenience(io->ac, lp_iconv_convenience(ldb_get_opaque(ldb, "loadparm")), CH_UTF8, CH_UTF16, io->n.cleartext_utf8->data, io->n.cleartext_utf8->length, - (void **)&cleartext_utf16_str); + (void **)&cleartext_utf16_str, false); if (converted_pw_len == -1) { ldb_asprintf_errstring(ldb, "setup_password_fields: " @@ -1357,7 +1357,7 @@ static int setup_password_fields(struct setup_password_fields_io *io) } converted_pw_len = convert_string_talloc_convenience(io->ac, lp_iconv_convenience(ldb_get_opaque(ldb, "loadparm")), CH_UTF16MUNGED, CH_UTF8, io->n.cleartext_utf16->data, io->n.cleartext_utf16->length, - (void **)&cleartext_utf8_str); + (void **)&cleartext_utf8_str, false); if (converted_pw_len == -1) { /* We can't bail out entirely, as these unconvertable passwords are frustratingly valid */ io->n.cleartext_utf8 = NULL; @@ -1383,7 +1383,7 @@ static int setup_password_fields(struct setup_password_fields_io *io) char *cleartext_unix; converted_pw_len = convert_string_talloc_convenience(io->ac, lp_iconv_convenience(ldb_get_opaque(ldb, "loadparm")), CH_UTF8, CH_UNIX, io->n.cleartext_utf8->data, io->n.cleartext_utf8->length, - (void **)&cleartext_unix); + (void **)&cleartext_unix, false); if (converted_pw_len != -1) { lm_hash = talloc(io->ac, struct samr_Password); if (!lm_hash) { diff --git a/source4/dsdb/schema/schema_init.c b/source4/dsdb/schema/schema_init.c index 763872cf2b..0e8ac5e105 100644 --- a/source4/dsdb/schema/schema_init.c +++ b/source4/dsdb/schema/schema_init.c @@ -1190,7 +1190,7 @@ static struct drsuapi_DsReplicaAttribute *dsdb_find_object_attr_name(struct dsdb _ret = convert_string_talloc_convenience(mem_ctx, s->iconv_convenience, CH_UTF16, CH_UNIX, \ _a->value_ctr.values[0].blob->data, \ _a->value_ctr.values[0].blob->length, \ - (void **)discard_const(&(p)->elem)); \ + (void **)discard_const(&(p)->elem), false); \ if (_ret == -1) { \ DEBUG(0,("%s: invalid data!\n", attr)); \ dump_data(0, \ diff --git a/source4/dsdb/schema/schema_syntax.c b/source4/dsdb/schema/schema_syntax.c index 4141026b7e..965b85a13a 100644 --- a/source4/dsdb/schema/schema_syntax.c +++ b/source4/dsdb/schema/schema_syntax.c @@ -795,7 +795,7 @@ static WERROR dsdb_syntax_UNICODE_drsuapi_to_ldb(struct ldb_context *ldb, CH_UTF16, CH_UNIX, in->value_ctr.values[i].blob->data, in->value_ctr.values[i].blob->length, - (void **)&str); + (void **)&str, false); if (ret == -1) { return WERR_FOOBAR; } @@ -838,7 +838,7 @@ static WERROR dsdb_syntax_UNICODE_ldb_to_drsuapi(struct ldb_context *ldb, ret = convert_string_talloc_convenience(blobs, schema->iconv_convenience, CH_UNIX, CH_UTF16, in->values[i].data, in->values[i].length, - (void **)&blobs[i].data); + (void **)&blobs[i].data, false); if (ret == -1) { return WERR_FOOBAR; } @@ -1165,7 +1165,7 @@ static WERROR dsdb_syntax_PRESENTATION_ADDRESS_drsuapi_to_ldb(struct ldb_context ret = convert_string_talloc_convenience(out->values, schema->iconv_convenience, CH_UTF16, CH_UNIX, in->value_ctr.values[i].blob->data+4, in->value_ctr.values[i].blob->length-4, - (void **)&str); + (void **)&str, false); if (ret == -1) { return WERR_FOOBAR; } @@ -1209,7 +1209,7 @@ static WERROR dsdb_syntax_PRESENTATION_ADDRESS_ldb_to_drsuapi(struct ldb_context ret = convert_string_talloc_convenience(blobs, schema->iconv_convenience, CH_UNIX, CH_UTF16, in->values[i].data, in->values[i].length, - (void **)&data); + (void **)&data, false); if (ret == -1) { return WERR_FOOBAR; } diff --git a/source4/kdc/kpasswdd.c b/source4/kdc/kpasswdd.c index 39817d922b..85e248dceb 100644 --- a/source4/kdc/kpasswdd.c +++ b/source4/kdc/kpasswdd.c @@ -237,7 +237,7 @@ static bool kpasswd_process_request(struct kdc_server *kdc, CH_UTF8, CH_UTF16, (const char *)input->data, input->length, - (void **)&password.data); + (void **)&password.data, false); if (pw_len == -1) { return false; @@ -285,7 +285,7 @@ static bool kpasswd_process_request(struct kdc_server *kdc, CH_UTF8, CH_UTF16, (const char *)chpw.newpasswd.data, chpw.newpasswd.length, - (void **)&password.data); + (void **)&password.data, false); if (pw_len == -1) { free_ChangePasswdDataMS(&chpw); return false; diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c index 1d238f4e23..41fbd22335 100644 --- a/source4/lib/registry/ldb.c +++ b/source4/lib/registry/ldb.c @@ -62,7 +62,7 @@ static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx, if (val != NULL) data->length = convert_string_talloc(mem_ctx, CH_UTF8, CH_UTF16, val->data, val->length, - (void **)&data->data); + (void **)&data->data, false); else { data->data = NULL; data->length = 0; @@ -108,7 +108,7 @@ static struct ldb_message *reg_ldb_pack_value(struct ldb_context *ctx, val.length = convert_string_talloc(mem_ctx, CH_UTF16, CH_UTF8, (void *)data.data, data.length, - (void **)&val.data); + (void **)&val.data, false); ldb_msg_add_value(msg, "data", &val, NULL); } else { ldb_msg_add_empty(msg, "data", LDB_FLAG_MOD_DELETE, NULL); diff --git a/source4/lib/registry/tests/generic.c b/source4/lib/registry/tests/generic.c index f1fa5ad0b2..3a3c3e7747 100644 --- a/source4/lib/registry/tests/generic.c +++ b/source4/lib/registry/tests/generic.c @@ -54,7 +54,7 @@ static bool test_reg_val_data_string_sz(struct torture_context *ctx) { DATA_BLOB db; db.length = convert_string_talloc_convenience(ctx, lp_iconv_convenience(ctx->lp_ctx), CH_UTF8, CH_UTF16, - "bla", 3, (void **)&db.data); + "bla", 3, (void **)&db.data, false); torture_assert_str_equal(ctx, "bla", reg_val_data_string(ctx, lp_iconv_convenience(ctx->lp_ctx), REG_SZ, db), "sz failed"); @@ -91,7 +91,7 @@ static bool test_reg_val_description(struct torture_context *ctx) data.length = convert_string_talloc_convenience(ctx, lp_iconv_convenience(ctx->lp_ctx), CH_UTF8, CH_UTF16, "stationary traveller", strlen("stationary traveller"), - (void **)&data.data); + (void **)&data.data, false); torture_assert_str_equal(ctx, "camel = REG_SZ : stationary traveller", reg_val_description(ctx, lp_iconv_convenience(ctx->lp_ctx), "camel", REG_SZ, data), "reg_val_description failed"); @@ -105,7 +105,7 @@ static bool test_reg_val_description_nullname(struct torture_context *ctx) data.length = convert_string_talloc_convenience(ctx, lp_iconv_convenience(ctx->lp_ctx), CH_UTF8, CH_UTF16, "west berlin", strlen("west berlin"), - (void **)&data.data); + (void **)&data.data, false); torture_assert_str_equal(ctx, " = REG_SZ : west berlin", reg_val_description(ctx, lp_iconv_convenience(ctx->lp_ctx), NULL, REG_SZ, data), "description with null name failed"); diff --git a/source4/lib/registry/util.c b/source4/lib/registry/util.c index 38f994f386..742c3dca2f 100644 --- a/source4/lib/registry/util.c +++ b/source4/lib/registry/util.c @@ -65,7 +65,7 @@ _PUBLIC_ char *reg_val_data_string(TALLOC_CTX *mem_ctx, case REG_SZ: convert_string_talloc_convenience(mem_ctx, iconv_convenience, CH_UTF16, CH_UNIX, data.data, data.length, - (void **)&ret); + (void **)&ret, false); return ret; case REG_BINARY: ret = data_blob_hex_string(mem_ctx, &data); @@ -125,7 +125,7 @@ _PUBLIC_ bool reg_string_to_val(TALLOC_CTX *mem_ctx, case REG_EXPAND_SZ: data->length = convert_string_talloc_convenience(mem_ctx, iconv_convenience, CH_UNIX, CH_UTF16, data_str, strlen(data_str), - (void **)&data->data); + (void **)&data->data, false); break; case REG_DWORD: { diff --git a/source4/lib/tdr/tdr.c b/source4/lib/tdr/tdr.c index 2d1d1ca7e1..93f1329ea9 100644 --- a/source4/lib/tdr/tdr.c +++ b/source4/lib/tdr/tdr.c @@ -153,7 +153,7 @@ NTSTATUS tdr_pull_charset(struct tdr_pull *tdr, TALLOC_CTX *ctx, const char **v, TDR_PULL_NEED_BYTES(tdr, el_size*length); - ret = convert_string_talloc_convenience(ctx, tdr->iconv_convenience, chset, CH_UNIX, tdr->data.data+tdr->offset, el_size*length, discard_const_p(void *, v)); + ret = convert_string_talloc_convenience(ctx, tdr->iconv_convenience, chset, CH_UNIX, tdr->data.data+tdr->offset, el_size*length, discard_const_p(void *, v), false); if (ret == -1) { return NT_STATUS_INVALID_PARAMETER; @@ -175,7 +175,7 @@ NTSTATUS tdr_push_charset(struct tdr_push *tdr, const char **v, uint32_t length, required = el_size * length; TDR_PUSH_NEED_BYTES(tdr, required); - ret = convert_string_convenience(tdr->iconv_convenience, CH_UNIX, chset, *v, strlen(*v), tdr->data.data+tdr->data.length, required); + ret = convert_string_convenience(tdr->iconv_convenience, CH_UNIX, chset, *v, strlen(*v), tdr->data.data+tdr->data.length, required, false); if (ret == -1) { return NT_STATUS_INVALID_PARAMETER; diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index 34fa4365ca..b8f4e5116c 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -64,7 +64,7 @@ NTSTATUS smbcli_parse_stream_info(DATA_BLOB blob, TALLOC_CTX *mem_ctx, } size = convert_string_talloc(io->streams, CH_UTF16, CH_UNIX, - blob.data+ofs+24, nlen, &vstr); + blob.data+ofs+24, nlen, &vstr, false); if (size == -1) { return NT_STATUS_ILLEGAL_CHARACTER; } diff --git a/source4/libcli/raw/rawrequest.c b/source4/libcli/raw/rawrequest.c index 029d56428d..5b461b47fd 100644 --- a/source4/libcli/raw/rawrequest.c +++ b/source4/libcli/raw/rawrequest.c @@ -585,7 +585,7 @@ static size_t smbcli_req_pull_ucs2(struct request_bufinfo *bufinfo, TALLOC_CTX * return 0; } - ret = convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX, src, src_len2, (void **)dest); + ret = convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX, src, src_len2, (void **)dest, false); if (ret == -1) { *dest = NULL; return 0; @@ -627,7 +627,7 @@ size_t smbcli_req_pull_ascii(struct request_bufinfo *bufinfo, TALLOC_CTX *mem_ct src_len2++; } - ret = convert_string_talloc(mem_ctx, CH_DOS, CH_UNIX, src, src_len2, (void **)dest); + ret = convert_string_talloc(mem_ctx, CH_DOS, CH_UNIX, src, src_len2, (void **)dest, false); if (ret == -1) { *dest = NULL; @@ -780,7 +780,7 @@ size_t smbcli_blob_pull_ucs2(TALLOC_CTX* mem_ctx, src_len2 = utf16_len_n(src, src_len); - ret = convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX, src, src_len2, (void **)&dest2); + ret = convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX, src, src_len2, (void **)&dest2, false); if (ret == -1) { *dest = NULL; return 0; @@ -826,7 +826,7 @@ static size_t smbcli_blob_pull_ascii(TALLOC_CTX *mem_ctx, src_len2++; } - ret = convert_string_talloc(mem_ctx, CH_DOS, CH_UNIX, src, src_len2, (void **)&dest2); + ret = convert_string_talloc(mem_ctx, CH_DOS, CH_UNIX, src, src_len2, (void **)&dest2, false); if (ret == -1) { *dest = NULL; diff --git a/source4/libcli/smb2/request.c b/source4/libcli/smb2/request.c index e1d6b0e7a6..19a2862d68 100644 --- a/source4/libcli/smb2/request.c +++ b/source4/libcli/smb2/request.c @@ -676,7 +676,7 @@ NTSTATUS smb2_pull_o16s16_string(struct smb2_request_buffer *buf, TALLOC_CTX *me } size = convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX, - blob.data, blob.length, &vstr); + blob.data, blob.length, &vstr, false); data_blob_free(&blob); (*str) = (char *)vstr; if (size == -1) { @@ -707,7 +707,7 @@ NTSTATUS smb2_push_o16s16_string(struct smb2_request_buffer *buf, } size = convert_string_talloc(buf->buffer, CH_UNIX, CH_UTF16, - str, strlen(str), (void **)&blob.data); + str, strlen(str), (void **)&blob.data, false); if (size == -1) { return NT_STATUS_ILLEGAL_CHARACTER; } diff --git a/source4/libnet/libnet_samdump.c b/source4/libnet/libnet_samdump.c index b35fef2c16..04a73c53ff 100644 --- a/source4/libnet/libnet_samdump.c +++ b/source4/libnet/libnet_samdump.c @@ -187,7 +187,7 @@ NTSTATUS libnet_SamDump(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, } if (convert_string_talloc_convenience(mem_ctx, lp_iconv_convenience(ctx->lp_ctx), CH_UTF16, CH_UNIX, s->secret.data, s->secret.length, - (void **)&secret_string) == -1) { + (void **)&secret_string, false) == -1) { r->out.error_string = talloc_asprintf(mem_ctx, "Could not convert secret for domain %s to a string", t->name); diff --git a/source4/librpc/ndr/ndr_string.c b/source4/librpc/ndr/ndr_string.c index 1b5da2dcc2..1ef1b0c13c 100644 --- a/source4/librpc/ndr/ndr_string.c +++ b/source4/librpc/ndr/ndr_string.c @@ -85,7 +85,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, ndr->iconv_convenience, chset, CH_UNIX, ndr->data+ndr->offset, (len2 + c_len_term)*byte_mul, - (void **)&as); + (void **)&as, false); if (ret == -1) { return ndr_pull_error(ndr, NDR_ERR_CHARCNV, "Bad character conversion"); @@ -123,7 +123,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, chset, CH_UNIX, ndr->data+ndr->offset, (len1 + c_len_term)*byte_mul, - (void **)&as); + (void **)&as, false); if (ret == -1) { return ndr_pull_error(ndr, NDR_ERR_CHARCNV, "Bad character conversion"); @@ -162,7 +162,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, chset, CH_UNIX, ndr->data+ndr->offset, (len1 + c_len_term)*byte_mul, - (void **)&as); + (void **)&as, false); if (ret == -1) { return ndr_pull_error(ndr, NDR_ERR_CHARCNV, "Bad character conversion"); @@ -197,7 +197,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, chset, CH_UNIX, ndr->data+ndr->offset, (len3 + c_len_term)*byte_mul, - (void **)&as); + (void **)&as, false); if (ret == -1) { return ndr_pull_error(ndr, NDR_ERR_CHARCNV, "Bad character conversion"); @@ -230,7 +230,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, chset, CH_UNIX, ndr->data+ndr->offset, len3, - (void **)&as); + (void **)&as, false); if (ret == -1) { return ndr_pull_error(ndr, NDR_ERR_CHARCNV, "Bad character conversion"); @@ -250,7 +250,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, ndr->iconv_convenience, chset, CH_UNIX, ndr->data+ndr->offset, len1, - (void **)&as); + (void **)&as, false); if (ret == -1) { return ndr_pull_error(ndr, NDR_ERR_CHARCNV, "Bad character conversion"); @@ -276,7 +276,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, chset, CH_UNIX, ndr->data+ndr->offset, len1, - (void **)&as); + (void **)&as, false); if (ret == -1) { return ndr_pull_error(ndr, NDR_ERR_CHARCNV, "Bad character conversion"); @@ -334,7 +334,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_string(struct ndr_push *ndr, int ndr_flags, if (!(flags & LIBNDR_FLAG_STR_NOTERM)) { s_len++; } - d_len = convert_string_talloc_convenience(ndr, ndr->iconv_convenience, CH_UNIX, chset, s, s_len, (void **)&dest); + d_len = convert_string_talloc_convenience(ndr, ndr->iconv_convenience, CH_UNIX, chset, s, s_len, (void **)&dest, false); if (d_len == -1) { return ndr_push_error(ndr, NDR_ERR_CHARCNV, "Bad character conversion"); @@ -673,7 +673,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_charset(struct ndr_pull *ndr, int ndr_flags, chset, CH_UNIX, ndr->data+ndr->offset, length*byte_mul, - discard_const_p(void *, var)); + discard_const_p(void *, var), false); if (ret == -1) { return ndr_pull_error(ndr, NDR_ERR_CHARCNV, "Bad character conversion"); @@ -696,7 +696,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_charset(struct ndr_push *ndr, int ndr_flags, NDR_PUSH_NEED_BYTES(ndr, required); ret = convert_string_convenience(ndr->iconv_convenience, CH_UNIX, chset, var, strlen(var), - ndr->data+ndr->offset, required); + ndr->data+ndr->offset, required, false); if (ret == -1) { return ndr_push_error(ndr, NDR_ERR_CHARCNV, "Bad character conversion"); diff --git a/source4/rpc_server/samr/samr_password.c b/source4/rpc_server/samr/samr_password.c index ff8215a673..33a70fd478 100644 --- a/source4/rpc_server/samr/samr_password.c +++ b/source4/rpc_server/samr/samr_password.c @@ -255,7 +255,7 @@ NTSTATUS dcesrv_samr_OemChangePasswordUser2(struct dcesrv_call_state *dce_call, CH_DOS, CH_UNIX, (const char *)new_password.data, new_password.length, - (void **)&new_pass) == -1) { + (void **)&new_pass, false) == -1) { DEBUG(3,("samr: failed to convert incoming password buffer to unix charset\n")); ldb_transaction_cancel(sam_ctx); return NT_STATUS_WRONG_PASSWORD; @@ -265,7 +265,7 @@ NTSTATUS dcesrv_samr_OemChangePasswordUser2(struct dcesrv_call_state *dce_call, CH_DOS, CH_UTF16, (const char *)new_password.data, new_password.length, - (void **)&new_unicode_password.data); + (void **)&new_unicode_password.data, false); if (unicode_pw_len == -1) { DEBUG(3,("samr: failed to convert incoming password buffer to UTF16 charset\n")); ldb_transaction_cancel(sam_ctx); @@ -433,7 +433,7 @@ NTSTATUS dcesrv_samr_ChangePasswordUser3(struct dcesrv_call_state *dce_call, CH_UTF16, CH_UNIX, (const char *)new_password.data, new_password.length, - (void **)&new_pass) != -1) { + (void **)&new_pass, false) != -1) { E_deshash(new_pass, new_lm_hash); E_old_pw_hash(new_nt_hash, lm_pwd->hash, lm_verifier.hash); if (memcmp(lm_verifier.hash, r->in.lm_verifier->hash, 16) != 0) { diff --git a/source4/smb_server/smb/request.c b/source4/smb_server/smb/request.c index 444714fa5e..377c5bf3cc 100644 --- a/source4/smb_server/smb/request.c +++ b/source4/smb_server/smb/request.c @@ -513,7 +513,7 @@ static size_t req_pull_ucs2(struct request_bufinfo *bufinfo, const char **dest, return src_len2 + alignment; } - ret = convert_string_talloc(bufinfo->mem_ctx, CH_UTF16, CH_UNIX, src, src_len2, (void **)&dest2); + ret = convert_string_talloc(bufinfo->mem_ctx, CH_UTF16, CH_UNIX, src, src_len2, (void **)&dest2, false); if (ret == -1) { *dest = NULL; @@ -562,7 +562,7 @@ static size_t req_pull_ascii(struct request_bufinfo *bufinfo, const char **dest, src_len2++; } - ret = convert_string_talloc(bufinfo->mem_ctx, CH_DOS, CH_UNIX, src, src_len2, (void **)&dest2); + ret = convert_string_talloc(bufinfo->mem_ctx, CH_DOS, CH_UNIX, src, src_len2, (void **)&dest2, false); if (ret == -1) { *dest = NULL; diff --git a/source4/torture/basic/charset.c b/source4/torture/basic/charset.c index 0ae7f6036b..33ab2c9768 100644 --- a/source4/torture/basic/charset.c +++ b/source4/torture/basic/charset.c @@ -56,7 +56,7 @@ static NTSTATUS unicode_open(struct torture_context *tctx, } SSVAL(ucs_name, i*2, 0); - i = convert_string_talloc_convenience(ucs_name, lp_iconv_convenience(tctx->lp_ctx), CH_UTF16, CH_UNIX, ucs_name, (1+u_name_len)*2, (void **)&fname); + i = convert_string_talloc_convenience(ucs_name, lp_iconv_convenience(tctx->lp_ctx), CH_UTF16, CH_UNIX, ucs_name, (1+u_name_len)*2, (void **)&fname, false); if (i == -1) { torture_comment(tctx, "Failed to convert UCS2 Name into unix - convert_string_talloc() failure\n"); talloc_free(ucs_name); diff --git a/source4/torture/basic/utable.c b/source4/torture/basic/utable.c index f0700f73a0..ef0e4d44ed 100644 --- a/source4/torture/basic/utable.c +++ b/source4/torture/basic/utable.c @@ -51,7 +51,7 @@ bool torture_utable(struct torture_context *tctx, p = fname+strlen(fname); len = convert_string_convenience(lp_iconv_convenience(tctx->lp_ctx), CH_UTF16, CH_UNIX, c2, 2, - p, sizeof(fname)-strlen(fname)); + p, sizeof(fname)-strlen(fname), false); p[len] = 0; strncat(fname,"_a_long_extension",sizeof(fname)-1); @@ -110,7 +110,7 @@ static char *form_name(struct smb_iconv_convenience *iconv_convenience, int c) len = convert_string_convenience(iconv_convenience, CH_UTF16, CH_UNIX, c2, 2, - p, sizeof(fname)-strlen(fname)); + p, sizeof(fname)-strlen(fname), false); p[len] = 0; return fname; } diff --git a/source4/torture/rpc/samlogon.c b/source4/torture/rpc/samlogon.c index db4657e835..7e1744ffab 100644 --- a/source4/torture/rpc/samlogon.c +++ b/source4/torture/rpc/samlogon.c @@ -1175,7 +1175,7 @@ static bool test_plaintext(struct samlogon_state *samlogon_state, enum ntlm_brea samlogon_state->iconv_convenience, CH_UNIX, CH_DOS, password, strlen(password)+1, - (void**)&dospw)) == -1) { + (void**)&dospw, false)) == -1) { DEBUG(0, ("convert_string_talloc failed!\n")); exit(1); } diff --git a/source4/torture/rpc/spoolss_win.c b/source4/torture/rpc/spoolss_win.c index 6ecace2ae6..b09c62479c 100644 --- a/source4/torture/rpc/spoolss_win.c +++ b/source4/torture/rpc/spoolss_win.c @@ -383,7 +383,7 @@ static bool test_EnumPrinterKey(struct torture_context *tctx, convert_string_talloc_convenience(ctx, lp_iconv_convenience(tctx->lp_ctx), CH_UTF16, CH_UNIX, epk.out.key_buffer, *epk.out.needed, - (void**)&ctx->printer_keys); + (void**)&ctx->printer_keys, false); return true; } -- cgit From 99b288156f021db7bb771f3a5bf78def61d699f2 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 1 Mar 2009 17:59:30 +0100 Subject: Move secace.c to top-level. --- source4/libcli/security/config.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source4') diff --git a/source4/libcli/security/config.mk b/source4/libcli/security/config.mk index cd5b75bb81..d99b83c2b5 100644 --- a/source4/libcli/security/config.mk +++ b/source4/libcli/security/config.mk @@ -3,6 +3,7 @@ PUBLIC_DEPENDENCIES = LIBNDR LIBSECURITY_COMMON LIBSECURITY_OBJ_FILES = $(addprefix $(libclisrcdir)/security/, \ security_token.o security_descriptor.o \ - access_check.o privilege.o sddl.o) + access_check.o privilege.o sddl.o) \ + ../libcli/security/secace.o $(eval $(call proto_header_template,$(libclisrcdir)/security/proto.h,$(LIBSECURITY_OBJ_FILES:.o=.c))) -- cgit From da6721e3231fb93b934440c2d92abab834289c82 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 1 Mar 2009 18:15:36 +0100 Subject: Move secacl to top-level. --- source4/libcli/security/config.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source4') diff --git a/source4/libcli/security/config.mk b/source4/libcli/security/config.mk index d99b83c2b5..d6d9ad5545 100644 --- a/source4/libcli/security/config.mk +++ b/source4/libcli/security/config.mk @@ -4,6 +4,7 @@ PUBLIC_DEPENDENCIES = LIBNDR LIBSECURITY_COMMON LIBSECURITY_OBJ_FILES = $(addprefix $(libclisrcdir)/security/, \ security_token.o security_descriptor.o \ access_check.o privilege.o sddl.o) \ - ../libcli/security/secace.o + ../libcli/security/secace.o \ + ../libcli/security/secacl.o $(eval $(call proto_header_template,$(libclisrcdir)/security/proto.h,$(LIBSECURITY_OBJ_FILES:.o=.c))) -- cgit From 94069bd2747a8397308c0b0b384f7bb4edd8f68b Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 1 Mar 2009 19:55:46 +0100 Subject: s4: Use same function signature for convert_* as s3. --- source4/auth/ntlm/ntlm_check.c | 2 +- source4/dsdb/common/util.c | 2 +- source4/dsdb/samdb/ldb_modules/password_hash.c | 17 ++++---- source4/dsdb/schema/schema_init.c | 7 ++-- source4/dsdb/schema/schema_syntax.c | 24 +++++------ source4/kdc/kpasswdd.c | 13 +++--- source4/lib/registry/ldb.c | 8 ++-- source4/lib/registry/tests/generic.c | 12 +++--- source4/lib/registry/util.c | 6 +-- source4/lib/tdr/tdr.c | 12 ++---- source4/libcli/raw/rawfileinfo.c | 8 ++-- source4/libcli/raw/rawrequest.c | 32 ++++++++------- source4/libcli/smb2/request.c | 18 ++++----- source4/libnet/libnet_samdump.c | 4 +- source4/librpc/ndr/ndr_string.c | 56 +++++++++++--------------- source4/rpc_server/samr/samr_password.c | 15 ++++--- source4/smb_server/smb/request.c | 12 +++--- source4/torture/basic/charset.c | 5 +-- source4/torture/basic/utable.c | 13 +++--- source4/torture/rpc/samlogon.c | 4 +- source4/torture/rpc/spoolss_win.c | 2 +- 21 files changed, 124 insertions(+), 148 deletions(-) (limited to 'source4') diff --git a/source4/auth/ntlm/ntlm_check.c b/source4/auth/ntlm/ntlm_check.c index 5298432e61..0805b1b043 100644 --- a/source4/auth/ntlm/ntlm_check.c +++ b/source4/auth/ntlm/ntlm_check.c @@ -323,7 +323,7 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx, if (lm_response->length && (convert_string_talloc(mem_ctx, CH_DOS, CH_UNIX, lm_response->data, lm_response->length, - (void **)&unix_pw, false) != -1)) { + (void **)&unix_pw, NULL, false))) { if (E_deshash(unix_pw, client_lm.hash)) { lm_ok = true; } else { diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c index 82f5b6ed1d..19eb3433a9 100644 --- a/source4/dsdb/common/util.c +++ b/source4/dsdb/common/util.c @@ -1693,7 +1693,7 @@ NTSTATUS samdb_set_password(struct ldb_context *ctx, TALLOC_CTX *mem_ctx, if (convert_string_talloc_convenience(mem_ctx, lp_iconv_convenience(ldb_get_opaque(ctx, "loadparm")), CH_UTF16, CH_UNIX, new_password->data, new_password->length, - (void **)&new_pass, false) != -1) { + (void **)&new_pass, NULL, false)) { /* possibly check password complexity */ diff --git a/source4/dsdb/samdb/ldb_modules/password_hash.c b/source4/dsdb/samdb/ldb_modules/password_hash.c index f427e697b4..56d4c4fe36 100644 --- a/source4/dsdb/samdb/ldb_modules/password_hash.c +++ b/source4/dsdb/samdb/ldb_modules/password_hash.c @@ -1307,7 +1307,7 @@ static int setup_password_fields(struct setup_password_fields_io *io) struct ldb_context *ldb; bool ok; int ret; - ssize_t converted_pw_len; + size_t converted_pw_len; ldb = ldb_module_get_ctx(io->ac->module); @@ -1337,10 +1337,9 @@ static int setup_password_fields(struct setup_password_fields_io *io) ldb_oom(ldb); return LDB_ERR_OPERATIONS_ERROR; } - converted_pw_len = convert_string_talloc_convenience(io->ac, lp_iconv_convenience(ldb_get_opaque(ldb, "loadparm")), + if (!convert_string_talloc_convenience(io->ac, lp_iconv_convenience(ldb_get_opaque(ldb, "loadparm")), CH_UTF8, CH_UTF16, io->n.cleartext_utf8->data, io->n.cleartext_utf8->length, - (void **)&cleartext_utf16_str, false); - if (converted_pw_len == -1) { + (void **)&cleartext_utf16_str, &converted_pw_len, false)) { ldb_asprintf_errstring(ldb, "setup_password_fields: " "failed to generate UTF16 password from cleartext UTF8 password"); @@ -1355,10 +1354,9 @@ static int setup_password_fields(struct setup_password_fields_io *io) ldb_oom(ldb); return LDB_ERR_OPERATIONS_ERROR; } - converted_pw_len = convert_string_talloc_convenience(io->ac, lp_iconv_convenience(ldb_get_opaque(ldb, "loadparm")), + if (!convert_string_talloc_convenience(io->ac, lp_iconv_convenience(ldb_get_opaque(ldb, "loadparm")), CH_UTF16MUNGED, CH_UTF8, io->n.cleartext_utf16->data, io->n.cleartext_utf16->length, - (void **)&cleartext_utf8_str, false); - if (converted_pw_len == -1) { + (void **)&cleartext_utf8_str, &converted_pw_len, false)) { /* We can't bail out entirely, as these unconvertable passwords are frustratingly valid */ io->n.cleartext_utf8 = NULL; talloc_free(cleartext_utf8_blob); @@ -1381,10 +1379,9 @@ static int setup_password_fields(struct setup_password_fields_io *io) if (io->n.cleartext_utf8) { struct samr_Password *lm_hash; char *cleartext_unix; - converted_pw_len = convert_string_talloc_convenience(io->ac, lp_iconv_convenience(ldb_get_opaque(ldb, "loadparm")), + if (convert_string_talloc_convenience(io->ac, lp_iconv_convenience(ldb_get_opaque(ldb, "loadparm")), CH_UTF8, CH_UNIX, io->n.cleartext_utf8->data, io->n.cleartext_utf8->length, - (void **)&cleartext_unix, false); - if (converted_pw_len != -1) { + (void **)&cleartext_unix, &converted_pw_len, false)) { lm_hash = talloc(io->ac, struct samr_Password); if (!lm_hash) { ldb_oom(ldb); diff --git a/source4/dsdb/schema/schema_init.c b/source4/dsdb/schema/schema_init.c index 0e8ac5e105..fbd8946bb5 100644 --- a/source4/dsdb/schema/schema_init.c +++ b/source4/dsdb/schema/schema_init.c @@ -1186,12 +1186,11 @@ static struct drsuapi_DsReplicaAttribute *dsdb_find_object_attr_name(struct dsdb return WERR_INVALID_PARAM; \ } \ if (_a && _a->value_ctr.num_values >= 1) { \ - ssize_t _ret; \ - _ret = convert_string_talloc_convenience(mem_ctx, s->iconv_convenience, CH_UTF16, CH_UNIX, \ + size_t _ret; \ + if (!convert_string_talloc_convenience(mem_ctx, s->iconv_convenience, CH_UTF16, CH_UNIX, \ _a->value_ctr.values[0].blob->data, \ _a->value_ctr.values[0].blob->length, \ - (void **)discard_const(&(p)->elem), false); \ - if (_ret == -1) { \ + (void **)discard_const(&(p)->elem), &_ret, false)) { \ DEBUG(0,("%s: invalid data!\n", attr)); \ dump_data(0, \ _a->value_ctr.values[0].blob->data, \ diff --git a/source4/dsdb/schema/schema_syntax.c b/source4/dsdb/schema/schema_syntax.c index 965b85a13a..27c9a6c4a4 100644 --- a/source4/dsdb/schema/schema_syntax.c +++ b/source4/dsdb/schema/schema_syntax.c @@ -779,7 +779,6 @@ static WERROR dsdb_syntax_UNICODE_drsuapi_to_ldb(struct ldb_context *ldb, W_ERROR_HAVE_NO_MEMORY(out->values); for (i=0; i < out->num_values; i++) { - ssize_t ret; char *str; if (in->value_ctr.values[i].blob == NULL) { @@ -790,13 +789,12 @@ static WERROR dsdb_syntax_UNICODE_drsuapi_to_ldb(struct ldb_context *ldb, return WERR_FOOBAR; } - ret = convert_string_talloc_convenience(out->values, + if (!convert_string_talloc_convenience(out->values, schema->iconv_convenience, CH_UTF16, CH_UNIX, in->value_ctr.values[i].blob->data, in->value_ctr.values[i].blob->length, - (void **)&str, false); - if (ret == -1) { + (void **)&str, NULL, false)) { return WERR_FOOBAR; } @@ -835,11 +833,10 @@ static WERROR dsdb_syntax_UNICODE_ldb_to_drsuapi(struct ldb_context *ldb, out->value_ctr.values[i].blob = &blobs[i]; - ret = convert_string_talloc_convenience(blobs, schema->iconv_convenience, CH_UNIX, CH_UTF16, + if (!convert_string_talloc_convenience(blobs, schema->iconv_convenience, CH_UNIX, CH_UTF16, in->values[i].data, in->values[i].length, - (void **)&blobs[i].data, false); - if (ret == -1) { + (void **)&blobs[i].data, NULL, false)) { return WERR_FOOBAR; } blobs[i].length = ret; @@ -1145,7 +1142,6 @@ static WERROR dsdb_syntax_PRESENTATION_ADDRESS_drsuapi_to_ldb(struct ldb_context for (i=0; i < out->num_values; i++) { uint32_t len; - ssize_t ret; char *str; if (in->value_ctr.values[i].blob == NULL) { @@ -1162,11 +1158,10 @@ static WERROR dsdb_syntax_PRESENTATION_ADDRESS_drsuapi_to_ldb(struct ldb_context return WERR_FOOBAR; } - ret = convert_string_talloc_convenience(out->values, schema->iconv_convenience, CH_UTF16, CH_UNIX, + if (!convert_string_talloc_convenience(out->values, schema->iconv_convenience, CH_UTF16, CH_UNIX, in->value_ctr.values[i].blob->data+4, in->value_ctr.values[i].blob->length-4, - (void **)&str, false); - if (ret == -1) { + (void **)&str, NULL, false)) { return WERR_FOOBAR; } @@ -1202,15 +1197,14 @@ static WERROR dsdb_syntax_PRESENTATION_ADDRESS_ldb_to_drsuapi(struct ldb_context for (i=0; i < in->num_values; i++) { uint8_t *data; - ssize_t ret; + size_t ret; out->value_ctr.values[i].blob = &blobs[i]; - ret = convert_string_talloc_convenience(blobs, schema->iconv_convenience, CH_UNIX, CH_UTF16, + if (!convert_string_talloc_convenience(blobs, schema->iconv_convenience, CH_UNIX, CH_UTF16, in->values[i].data, in->values[i].length, - (void **)&data, false); - if (ret == -1) { + (void **)&data, &ret, false)) { return WERR_FOOBAR; } diff --git a/source4/kdc/kpasswdd.c b/source4/kdc/kpasswdd.c index 85e248dceb..67404af2ab 100644 --- a/source4/kdc/kpasswdd.c +++ b/source4/kdc/kpasswdd.c @@ -219,7 +219,7 @@ static bool kpasswd_process_request(struct kdc_server *kdc, DATA_BLOB *reply) { struct auth_session_info *session_info; - ssize_t pw_len; + size_t pw_len; if (!NT_STATUS_IS_OK(gensec_session_info(gensec_security, &session_info))) { @@ -233,13 +233,11 @@ static bool kpasswd_process_request(struct kdc_server *kdc, case KRB5_KPASSWD_VERS_CHANGEPW: { DATA_BLOB password; - pw_len = convert_string_talloc_convenience(mem_ctx, lp_iconv_convenience(kdc->task->lp_ctx), + if (!convert_string_talloc_convenience(mem_ctx, lp_iconv_convenience(kdc->task->lp_ctx), CH_UTF8, CH_UTF16, (const char *)input->data, input->length, - (void **)&password.data, false); - - if (pw_len == -1) { + (void **)&password.data, &pw_len, false)) { return false; } password.length = pw_len; @@ -281,12 +279,11 @@ static bool kpasswd_process_request(struct kdc_server *kdc, reply); } - pw_len = convert_string_talloc_convenience(mem_ctx, lp_iconv_convenience(kdc->task->lp_ctx), + if (!convert_string_talloc_convenience(mem_ctx, lp_iconv_convenience(kdc->task->lp_ctx), CH_UTF8, CH_UTF16, (const char *)chpw.newpasswd.data, chpw.newpasswd.length, - (void **)&password.data, false); - if (pw_len == -1) { + (void **)&password.data, &pw_len, false)) { free_ChangePasswdDataMS(&chpw); return false; } diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c index 41fbd22335..c558805e04 100644 --- a/source4/lib/registry/ldb.c +++ b/source4/lib/registry/ldb.c @@ -60,9 +60,9 @@ static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx, case REG_SZ: case REG_EXPAND_SZ: if (val != NULL) - data->length = convert_string_talloc(mem_ctx, CH_UTF8, CH_UTF16, + convert_string_talloc(mem_ctx, CH_UTF8, CH_UTF16, val->data, val->length, - (void **)&data->data, false); + (void **)&data->data, &data->length, false); else { data->data = NULL; data->length = 0; @@ -105,10 +105,10 @@ static struct ldb_message *reg_ldb_pack_value(struct ldb_context *ctx, case REG_SZ: case REG_EXPAND_SZ: if (data.data[0] != '\0') { - val.length = convert_string_talloc(mem_ctx, CH_UTF16, CH_UTF8, + convert_string_talloc(mem_ctx, CH_UTF16, CH_UTF8, (void *)data.data, data.length, - (void **)&val.data, false); + (void **)&val.data, &val.length, false); ldb_msg_add_value(msg, "data", &val, NULL); } else { ldb_msg_add_empty(msg, "data", LDB_FLAG_MOD_DELETE, NULL); diff --git a/source4/lib/registry/tests/generic.c b/source4/lib/registry/tests/generic.c index 3a3c3e7747..3de7602e53 100644 --- a/source4/lib/registry/tests/generic.c +++ b/source4/lib/registry/tests/generic.c @@ -53,8 +53,8 @@ static bool test_reg_val_data_string_dword(struct torture_context *ctx) static bool test_reg_val_data_string_sz(struct torture_context *ctx) { DATA_BLOB db; - db.length = convert_string_talloc_convenience(ctx, lp_iconv_convenience(ctx->lp_ctx), CH_UTF8, CH_UTF16, - "bla", 3, (void **)&db.data, false); + convert_string_talloc_convenience(ctx, lp_iconv_convenience(ctx->lp_ctx), CH_UTF8, CH_UTF16, + "bla", 3, (void **)&db.data, &db.length, false); torture_assert_str_equal(ctx, "bla", reg_val_data_string(ctx, lp_iconv_convenience(ctx->lp_ctx), REG_SZ, db), "sz failed"); @@ -88,10 +88,10 @@ static bool test_reg_val_data_string_empty(struct torture_context *ctx) static bool test_reg_val_description(struct torture_context *ctx) { DATA_BLOB data; - data.length = convert_string_talloc_convenience(ctx, lp_iconv_convenience(ctx->lp_ctx), CH_UTF8, CH_UTF16, + convert_string_talloc_convenience(ctx, lp_iconv_convenience(ctx->lp_ctx), CH_UTF8, CH_UTF16, "stationary traveller", strlen("stationary traveller"), - (void **)&data.data, false); + (void **)&data.data, &data.length, false); torture_assert_str_equal(ctx, "camel = REG_SZ : stationary traveller", reg_val_description(ctx, lp_iconv_convenience(ctx->lp_ctx), "camel", REG_SZ, data), "reg_val_description failed"); @@ -102,10 +102,10 @@ static bool test_reg_val_description(struct torture_context *ctx) static bool test_reg_val_description_nullname(struct torture_context *ctx) { DATA_BLOB data; - data.length = convert_string_talloc_convenience(ctx, lp_iconv_convenience(ctx->lp_ctx), CH_UTF8, CH_UTF16, + convert_string_talloc_convenience(ctx, lp_iconv_convenience(ctx->lp_ctx), CH_UTF8, CH_UTF16, "west berlin", strlen("west berlin"), - (void **)&data.data, false); + (void **)&data.data, &data.length, false); torture_assert_str_equal(ctx, " = REG_SZ : west berlin", reg_val_description(ctx, lp_iconv_convenience(ctx->lp_ctx), NULL, REG_SZ, data), "description with null name failed"); diff --git a/source4/lib/registry/util.c b/source4/lib/registry/util.c index 742c3dca2f..a1897eff2e 100644 --- a/source4/lib/registry/util.c +++ b/source4/lib/registry/util.c @@ -65,7 +65,7 @@ _PUBLIC_ char *reg_val_data_string(TALLOC_CTX *mem_ctx, case REG_SZ: convert_string_talloc_convenience(mem_ctx, iconv_convenience, CH_UTF16, CH_UNIX, data.data, data.length, - (void **)&ret, false); + (void **)&ret, NULL, false); return ret; case REG_BINARY: ret = data_blob_hex_string(mem_ctx, &data); @@ -123,9 +123,9 @@ _PUBLIC_ bool reg_string_to_val(TALLOC_CTX *mem_ctx, { case REG_SZ: case REG_EXPAND_SZ: - data->length = convert_string_talloc_convenience(mem_ctx, iconv_convenience, CH_UNIX, CH_UTF16, + convert_string_talloc_convenience(mem_ctx, iconv_convenience, CH_UNIX, CH_UTF16, data_str, strlen(data_str), - (void **)&data->data, false); + (void **)&data->data, &data->length, false); break; case REG_DWORD: { diff --git a/source4/lib/tdr/tdr.c b/source4/lib/tdr/tdr.c index 93f1329ea9..8b62ea0c2b 100644 --- a/source4/lib/tdr/tdr.c +++ b/source4/lib/tdr/tdr.c @@ -130,7 +130,7 @@ NTSTATUS tdr_print_uint32(struct tdr_print *tdr, const char *name, uint32_t *v) NTSTATUS tdr_pull_charset(struct tdr_pull *tdr, TALLOC_CTX *ctx, const char **v, uint32_t length, uint32_t el_size, charset_t chset) { - int ret; + size_t ret; if (length == -1) { switch (chset) { @@ -153,9 +153,7 @@ NTSTATUS tdr_pull_charset(struct tdr_pull *tdr, TALLOC_CTX *ctx, const char **v, TDR_PULL_NEED_BYTES(tdr, el_size*length); - ret = convert_string_talloc_convenience(ctx, tdr->iconv_convenience, chset, CH_UNIX, tdr->data.data+tdr->offset, el_size*length, discard_const_p(void *, v), false); - - if (ret == -1) { + if (!convert_string_talloc_convenience(ctx, tdr->iconv_convenience, chset, CH_UNIX, tdr->data.data+tdr->offset, el_size*length, discard_const_p(void *, v), &ret, false)) { return NT_STATUS_INVALID_PARAMETER; } @@ -166,7 +164,7 @@ NTSTATUS tdr_pull_charset(struct tdr_pull *tdr, TALLOC_CTX *ctx, const char **v, NTSTATUS tdr_push_charset(struct tdr_push *tdr, const char **v, uint32_t length, uint32_t el_size, charset_t chset) { - ssize_t ret, required; + size_t ret, required; if (length == -1) { length = strlen(*v) + 1; /* Extra element for null character */ @@ -175,9 +173,7 @@ NTSTATUS tdr_push_charset(struct tdr_push *tdr, const char **v, uint32_t length, required = el_size * length; TDR_PUSH_NEED_BYTES(tdr, required); - ret = convert_string_convenience(tdr->iconv_convenience, CH_UNIX, chset, *v, strlen(*v), tdr->data.data+tdr->data.length, required, false); - - if (ret == -1) { + if (!convert_string_convenience(tdr->iconv_convenience, CH_UNIX, chset, *v, strlen(*v), tdr->data.data+tdr->data.length, required, &ret, false)) { return NT_STATUS_INVALID_PARAMETER; } diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index b8f4e5116c..09ecb40002 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -49,7 +49,7 @@ NTSTATUS smbcli_parse_stream_info(DATA_BLOB blob, TALLOC_CTX *mem_ctx, while (blob.length - ofs >= 24) { uint_t n = io->num_streams; uint32_t nlen, len; - ssize_t size; + bool ret; void *vstr; io->streams = talloc_realloc(mem_ctx, io->streams, struct stream_struct, n+1); @@ -62,10 +62,10 @@ NTSTATUS smbcli_parse_stream_info(DATA_BLOB blob, TALLOC_CTX *mem_ctx, if (nlen > blob.length - (ofs + 24)) { return NT_STATUS_INFO_LENGTH_MISMATCH; } - size = convert_string_talloc(io->streams, + ret = convert_string_talloc(io->streams, CH_UTF16, CH_UNIX, - blob.data+ofs+24, nlen, &vstr, false); - if (size == -1) { + blob.data+ofs+24, nlen, &vstr, NULL, false); + if (!ret) { return NT_STATUS_ILLEGAL_CHARACTER; } io->streams[n].stream_name.s = (const char *)vstr; diff --git a/source4/libcli/raw/rawrequest.c b/source4/libcli/raw/rawrequest.c index 5b461b47fd..0f04190a8b 100644 --- a/source4/libcli/raw/rawrequest.c +++ b/source4/libcli/raw/rawrequest.c @@ -558,7 +558,8 @@ static size_t smbcli_req_pull_ucs2(struct request_bufinfo *bufinfo, TALLOC_CTX * char **dest, const uint8_t *src, int byte_len, uint_t flags) { int src_len, src_len2, alignment=0; - ssize_t ret; + bool ret; + size_t ret_size; if (!(flags & STR_NOALIGN) && ucs2_align(bufinfo->align_base, src, flags)) { src++; @@ -585,8 +586,8 @@ static size_t smbcli_req_pull_ucs2(struct request_bufinfo *bufinfo, TALLOC_CTX * return 0; } - ret = convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX, src, src_len2, (void **)dest, false); - if (ret == -1) { + ret = convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX, src, src_len2, (void **)dest, &ret_size, false); + if (!ret) { *dest = NULL; return 0; } @@ -611,7 +612,8 @@ size_t smbcli_req_pull_ascii(struct request_bufinfo *bufinfo, TALLOC_CTX *mem_ct char **dest, const uint8_t *src, int byte_len, uint_t flags) { int src_len, src_len2; - ssize_t ret; + bool ret; + size_t ret_size; src_len = bufinfo->data_size - PTR_DIFF(src, bufinfo->data); if (src_len < 0) { @@ -627,14 +629,14 @@ size_t smbcli_req_pull_ascii(struct request_bufinfo *bufinfo, TALLOC_CTX *mem_ct src_len2++; } - ret = convert_string_talloc(mem_ctx, CH_DOS, CH_UNIX, src, src_len2, (void **)dest, false); + ret = convert_string_talloc(mem_ctx, CH_DOS, CH_UNIX, src, src_len2, (void **)dest, &ret_size, false); - if (ret == -1) { + if (!ret) { *dest = NULL; return 0; } - return ret; + return ret_size; } /** @@ -752,7 +754,8 @@ size_t smbcli_blob_pull_ucs2(TALLOC_CTX* mem_ctx, const uint8_t *src, int byte_len, uint_t flags) { int src_len, src_len2, alignment=0; - ssize_t ret; + size_t ret_size; + bool ret; char *dest2; if (src < blob->data || @@ -780,8 +783,8 @@ size_t smbcli_blob_pull_ucs2(TALLOC_CTX* mem_ctx, src_len2 = utf16_len_n(src, src_len); - ret = convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX, src, src_len2, (void **)&dest2, false); - if (ret == -1) { + ret = convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX, src, src_len2, (void **)&dest2, &ret_size, false); + if (!ret) { *dest = NULL; return 0; } @@ -808,7 +811,8 @@ static size_t smbcli_blob_pull_ascii(TALLOC_CTX *mem_ctx, const uint8_t *src, int byte_len, uint_t flags) { int src_len, src_len2; - ssize_t ret; + size_t ret_size; + bool ret; char *dest2; src_len = blob->length - PTR_DIFF(src, blob->data); @@ -826,15 +830,15 @@ static size_t smbcli_blob_pull_ascii(TALLOC_CTX *mem_ctx, src_len2++; } - ret = convert_string_talloc(mem_ctx, CH_DOS, CH_UNIX, src, src_len2, (void **)&dest2, false); + ret = convert_string_talloc(mem_ctx, CH_DOS, CH_UNIX, src, src_len2, (void **)&dest2, &ret_size, false); - if (ret == -1) { + if (!ret) { *dest = NULL; return 0; } *dest = dest2; - return ret; + return ret_size; } /** diff --git a/source4/libcli/smb2/request.c b/source4/libcli/smb2/request.c index 19a2862d68..649a1db8d5 100644 --- a/source4/libcli/smb2/request.c +++ b/source4/libcli/smb2/request.c @@ -656,8 +656,8 @@ NTSTATUS smb2_pull_o16s16_string(struct smb2_request_buffer *buf, TALLOC_CTX *me { DATA_BLOB blob; NTSTATUS status; - ssize_t size; void *vstr; + bool ret; status = smb2_pull_o16s16_blob(buf, mem_ctx, ptr, &blob); NT_STATUS_NOT_OK_RETURN(status); @@ -675,11 +675,11 @@ NTSTATUS smb2_pull_o16s16_string(struct smb2_request_buffer *buf, TALLOC_CTX *me return NT_STATUS_OK; } - size = convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX, - blob.data, blob.length, &vstr, false); + ret = convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX, + blob.data, blob.length, &vstr, NULL, false); data_blob_free(&blob); (*str) = (char *)vstr; - if (size == -1) { + if (!ret) { return NT_STATUS_ILLEGAL_CHARACTER; } return NT_STATUS_OK; @@ -694,7 +694,7 @@ NTSTATUS smb2_push_o16s16_string(struct smb2_request_buffer *buf, { DATA_BLOB blob; NTSTATUS status; - ssize_t size; + bool ret; if (str == NULL) { return smb2_push_o16s16_blob(buf, ofs, data_blob(NULL, 0)); @@ -706,12 +706,12 @@ NTSTATUS smb2_push_o16s16_string(struct smb2_request_buffer *buf, return smb2_push_o16s16_blob(buf, ofs, blob); } - size = convert_string_talloc(buf->buffer, CH_UNIX, CH_UTF16, - str, strlen(str), (void **)&blob.data, false); - if (size == -1) { + ret = convert_string_talloc(buf->buffer, CH_UNIX, CH_UTF16, + str, strlen(str), (void **)&blob.data, &blob.length, + false); + if (!ret) { return NT_STATUS_ILLEGAL_CHARACTER; } - blob.length = size; status = smb2_push_o16s16_blob(buf, ofs, blob); data_blob_free(&blob); diff --git a/source4/libnet/libnet_samdump.c b/source4/libnet/libnet_samdump.c index 04a73c53ff..10a14655f3 100644 --- a/source4/libnet/libnet_samdump.c +++ b/source4/libnet/libnet_samdump.c @@ -185,9 +185,9 @@ NTSTATUS libnet_SamDump(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, if (strcasecmp_m(s->name, secret_name) != 0) { continue; } - if (convert_string_talloc_convenience(mem_ctx, lp_iconv_convenience(ctx->lp_ctx), CH_UTF16, CH_UNIX, + if (!convert_string_talloc_convenience(mem_ctx, lp_iconv_convenience(ctx->lp_ctx), CH_UTF16, CH_UNIX, s->secret.data, s->secret.length, - (void **)&secret_string, false) == -1) { + (void **)&secret_string, NULL, false)) { r->out.error_string = talloc_asprintf(mem_ctx, "Could not convert secret for domain %s to a string", t->name); diff --git a/source4/librpc/ndr/ndr_string.c b/source4/librpc/ndr/ndr_string.c index 1ef1b0c13c..d6d996846e 100644 --- a/source4/librpc/ndr/ndr_string.c +++ b/source4/librpc/ndr/ndr_string.c @@ -30,7 +30,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, char *as=NULL; uint32_t len1, ofs, len2; uint16_t len3; - int ret; + size_t ret; charset_t chset = CH_UTF16; unsigned byte_mul = 2; unsigned flags = ndr->flags; @@ -81,12 +81,11 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, if (len2 == 0) { as = talloc_strdup(ndr->current_mem_ctx, ""); } else { - ret = convert_string_talloc_convenience(ndr->current_mem_ctx, + if (!convert_string_talloc_convenience(ndr->current_mem_ctx, ndr->iconv_convenience, chset, CH_UNIX, ndr->data+ndr->offset, (len2 + c_len_term)*byte_mul, - (void **)&as, false); - if (ret == -1) { + (void **)&as, &ret, false)) { return ndr_pull_error(ndr, NDR_ERR_CHARCNV, "Bad character conversion"); } @@ -118,13 +117,12 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, if (len1 == 0) { as = talloc_strdup(ndr->current_mem_ctx, ""); } else { - ret = convert_string_talloc_convenience(ndr->current_mem_ctx, + if (!convert_string_talloc_convenience(ndr->current_mem_ctx, ndr->iconv_convenience, chset, CH_UNIX, ndr->data+ndr->offset, (len1 + c_len_term)*byte_mul, - (void **)&as, false); - if (ret == -1) { + (void **)&as, &ret, false)) { return ndr_pull_error(ndr, NDR_ERR_CHARCNV, "Bad character conversion"); } @@ -157,13 +155,12 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, if (len1 == 0) { as = talloc_strdup(ndr->current_mem_ctx, ""); } else { - ret = convert_string_talloc_convenience(ndr->current_mem_ctx, + if (!convert_string_talloc_convenience(ndr->current_mem_ctx, ndr->iconv_convenience, chset, CH_UNIX, ndr->data+ndr->offset, (len1 + c_len_term)*byte_mul, - (void **)&as, false); - if (ret == -1) { + (void **)&as, &ret, false)) { return ndr_pull_error(ndr, NDR_ERR_CHARCNV, "Bad character conversion"); } @@ -192,13 +189,12 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, if (len3 == 0) { as = talloc_strdup(ndr->current_mem_ctx, ""); } else { - ret = convert_string_talloc_convenience(ndr->current_mem_ctx, + if (!convert_string_talloc_convenience(ndr->current_mem_ctx, ndr->iconv_convenience, chset, CH_UNIX, ndr->data+ndr->offset, (len3 + c_len_term)*byte_mul, - (void **)&as, false); - if (ret == -1) { + (void **)&as, &ret, false)) { return ndr_pull_error(ndr, NDR_ERR_CHARCNV, "Bad character conversion"); } @@ -225,13 +221,12 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, if (len3 == 0) { as = talloc_strdup(ndr->current_mem_ctx, ""); } else { - ret = convert_string_talloc_convenience(ndr->current_mem_ctx, + if (!convert_string_talloc_convenience(ndr->current_mem_ctx, ndr->iconv_convenience, chset, CH_UNIX, ndr->data+ndr->offset, len3, - (void **)&as, false); - if (ret == -1) { + (void **)&as, &ret, false)) { return ndr_pull_error(ndr, NDR_ERR_CHARCNV, "Bad character conversion"); } @@ -246,12 +241,11 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, } else { len1 = utf16_len_n(ndr->data+ndr->offset, ndr->data_size - ndr->offset); } - ret = convert_string_talloc_convenience(ndr->current_mem_ctx, + if (!convert_string_talloc_convenience(ndr->current_mem_ctx, ndr->iconv_convenience, chset, CH_UNIX, ndr->data+ndr->offset, len1, - (void **)&as, false); - if (ret == -1) { + (void **)&as, &ret, false)) { return ndr_pull_error(ndr, NDR_ERR_CHARCNV, "Bad character conversion"); } @@ -271,13 +265,12 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, if (len1 == 0) { as = talloc_strdup(ndr->current_mem_ctx, ""); } else { - ret = convert_string_talloc_convenience(ndr->current_mem_ctx, + if (!convert_string_talloc_convenience(ndr->current_mem_ctx, ndr->iconv_convenience, chset, CH_UNIX, ndr->data+ndr->offset, len1, - (void **)&as, false); - if (ret == -1) { + (void **)&as, &ret, false)) { return ndr_pull_error(ndr, NDR_ERR_CHARCNV, "Bad character conversion"); } @@ -301,7 +294,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, */ _PUBLIC_ enum ndr_err_code ndr_push_string(struct ndr_push *ndr, int ndr_flags, const char *s) { - ssize_t s_len, c_len, d_len; + size_t s_len, c_len, d_len; int chset = CH_UTF16; unsigned flags = ndr->flags; unsigned byte_mul = 2; @@ -334,8 +327,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_string(struct ndr_push *ndr, int ndr_flags, if (!(flags & LIBNDR_FLAG_STR_NOTERM)) { s_len++; } - d_len = convert_string_talloc_convenience(ndr, ndr->iconv_convenience, CH_UNIX, chset, s, s_len, (void **)&dest, false); - if (d_len == -1) { + if (!convert_string_talloc_convenience(ndr, ndr->iconv_convenience, CH_UNIX, chset, s, s_len, (void **)&dest, &d_len, false)) { return ndr_push_error(ndr, NDR_ERR_CHARCNV, "Bad character conversion"); } @@ -656,7 +648,7 @@ _PUBLIC_ enum ndr_err_code ndr_check_string_terminator(struct ndr_pull *ndr, uin _PUBLIC_ enum ndr_err_code ndr_pull_charset(struct ndr_pull *ndr, int ndr_flags, const char **var, uint32_t length, uint8_t byte_mul, charset_t chset) { - int ret; + size_t ret; if (length == 0) { *var = talloc_strdup(ndr->current_mem_ctx, ""); return NDR_ERR_SUCCESS; @@ -668,13 +660,12 @@ _PUBLIC_ enum ndr_err_code ndr_pull_charset(struct ndr_pull *ndr, int ndr_flags, NDR_PULL_NEED_BYTES(ndr, length*byte_mul); - ret = convert_string_talloc_convenience(ndr->current_mem_ctx, + if (!convert_string_talloc_convenience(ndr->current_mem_ctx, ndr->iconv_convenience, chset, CH_UNIX, ndr->data+ndr->offset, length*byte_mul, - discard_const_p(void *, var), false); - if (ret == -1) { + discard_const_p(void *, var), &ret, false)) { return ndr_pull_error(ndr, NDR_ERR_CHARCNV, "Bad character conversion"); } @@ -685,7 +676,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_charset(struct ndr_pull *ndr, int ndr_flags, _PUBLIC_ enum ndr_err_code ndr_push_charset(struct ndr_push *ndr, int ndr_flags, const char *var, uint32_t length, uint8_t byte_mul, charset_t chset) { - ssize_t ret, required; + size_t ret, required; if (NDR_BE(ndr) && chset == CH_UTF16) { chset = CH_UTF16BE; @@ -694,10 +685,9 @@ _PUBLIC_ enum ndr_err_code ndr_push_charset(struct ndr_push *ndr, int ndr_flags, required = byte_mul * length; NDR_PUSH_NEED_BYTES(ndr, required); - ret = convert_string_convenience(ndr->iconv_convenience, CH_UNIX, chset, + if (!convert_string_convenience(ndr->iconv_convenience, CH_UNIX, chset, var, strlen(var), - ndr->data+ndr->offset, required, false); - if (ret == -1) { + ndr->data+ndr->offset, required, &ret, false)) { return ndr_push_error(ndr, NDR_ERR_CHARCNV, "Bad character conversion"); } diff --git a/source4/rpc_server/samr/samr_password.c b/source4/rpc_server/samr/samr_password.c index 33a70fd478..f334eeb8f3 100644 --- a/source4/rpc_server/samr/samr_password.c +++ b/source4/rpc_server/samr/samr_password.c @@ -196,7 +196,7 @@ NTSTATUS dcesrv_samr_OemChangePasswordUser2(struct dcesrv_call_state *dce_call, DATA_BLOB lm_pwd_blob; uint8_t new_lm_hash[16]; struct samr_Password lm_verifier; - ssize_t unicode_pw_len; + size_t unicode_pw_len; if (pwbuf == NULL) { return NT_STATUS_INVALID_PARAMETER; @@ -251,22 +251,21 @@ NTSTATUS dcesrv_samr_OemChangePasswordUser2(struct dcesrv_call_state *dce_call, return NT_STATUS_WRONG_PASSWORD; } - if (convert_string_talloc_convenience(mem_ctx, lp_iconv_convenience(dce_call->conn->dce_ctx->lp_ctx), + if (!convert_string_talloc_convenience(mem_ctx, lp_iconv_convenience(dce_call->conn->dce_ctx->lp_ctx), CH_DOS, CH_UNIX, (const char *)new_password.data, new_password.length, - (void **)&new_pass, false) == -1) { + (void **)&new_pass, NULL, false)) { DEBUG(3,("samr: failed to convert incoming password buffer to unix charset\n")); ldb_transaction_cancel(sam_ctx); return NT_STATUS_WRONG_PASSWORD; } - unicode_pw_len = convert_string_talloc_convenience(mem_ctx, lp_iconv_convenience(dce_call->conn->dce_ctx->lp_ctx), + if (!convert_string_talloc_convenience(mem_ctx, lp_iconv_convenience(dce_call->conn->dce_ctx->lp_ctx), CH_DOS, CH_UTF16, (const char *)new_password.data, new_password.length, - (void **)&new_unicode_password.data, false); - if (unicode_pw_len == -1) { + (void **)&new_unicode_password.data, &unicode_pw_len, false)) { DEBUG(3,("samr: failed to convert incoming password buffer to UTF16 charset\n")); ldb_transaction_cancel(sam_ctx); return NT_STATUS_WRONG_PASSWORD; @@ -429,11 +428,11 @@ NTSTATUS dcesrv_samr_ChangePasswordUser3(struct dcesrv_call_state *dce_call, * this) */ if (lm_pwd && r->in.lm_verifier != NULL) { char *new_pass; - if (convert_string_talloc_convenience(mem_ctx, lp_iconv_convenience(dce_call->conn->dce_ctx->lp_ctx), + if (!convert_string_talloc_convenience(mem_ctx, lp_iconv_convenience(dce_call->conn->dce_ctx->lp_ctx), CH_UTF16, CH_UNIX, (const char *)new_password.data, new_password.length, - (void **)&new_pass, false) != -1) { + (void **)&new_pass, NULL, false)) { E_deshash(new_pass, new_lm_hash); E_old_pw_hash(new_nt_hash, lm_pwd->hash, lm_verifier.hash); if (memcmp(lm_verifier.hash, r->in.lm_verifier->hash, 16) != 0) { diff --git a/source4/smb_server/smb/request.c b/source4/smb_server/smb/request.c index 377c5bf3cc..6846f80594 100644 --- a/source4/smb_server/smb/request.c +++ b/source4/smb_server/smb/request.c @@ -482,7 +482,7 @@ size_t req_append_var_block(struct smbsrv_request *req, static size_t req_pull_ucs2(struct request_bufinfo *bufinfo, const char **dest, const uint8_t *src, int byte_len, uint_t flags) { int src_len, src_len2, alignment=0; - ssize_t ret; + bool ret; char *dest2; if (!(flags & STR_NOALIGN) && ucs2_align(bufinfo->align_base, src, flags)) { @@ -513,9 +513,9 @@ static size_t req_pull_ucs2(struct request_bufinfo *bufinfo, const char **dest, return src_len2 + alignment; } - ret = convert_string_talloc(bufinfo->mem_ctx, CH_UTF16, CH_UNIX, src, src_len2, (void **)&dest2, false); + ret = convert_string_talloc(bufinfo->mem_ctx, CH_UTF16, CH_UNIX, src, src_len2, (void **)&dest2, NULL, false); - if (ret == -1) { + if (!ret) { *dest = NULL; return 0; } @@ -540,7 +540,7 @@ static size_t req_pull_ucs2(struct request_bufinfo *bufinfo, const char **dest, static size_t req_pull_ascii(struct request_bufinfo *bufinfo, const char **dest, const uint8_t *src, int byte_len, uint_t flags) { int src_len, src_len2; - ssize_t ret; + bool ret; char *dest2; if (flags & STR_NO_RANGE_CHECK) { @@ -562,9 +562,9 @@ static size_t req_pull_ascii(struct request_bufinfo *bufinfo, const char **dest, src_len2++; } - ret = convert_string_talloc(bufinfo->mem_ctx, CH_DOS, CH_UNIX, src, src_len2, (void **)&dest2, false); + ret = convert_string_talloc(bufinfo->mem_ctx, CH_DOS, CH_UNIX, src, src_len2, (void **)&dest2, NULL, false); - if (ret == -1) { + if (!ret) { *dest = NULL; return 0; } diff --git a/source4/torture/basic/charset.c b/source4/torture/basic/charset.c index 33ab2c9768..5ac299dbbe 100644 --- a/source4/torture/basic/charset.c +++ b/source4/torture/basic/charset.c @@ -42,7 +42,7 @@ static NTSTATUS unicode_open(struct torture_context *tctx, { union smb_open io; char *fname, *fname2=NULL, *ucs_name; - int i; + size_t i; NTSTATUS status; ucs_name = talloc_size(mem_ctx, (1+u_name_len)*2); @@ -56,8 +56,7 @@ static NTSTATUS unicode_open(struct torture_context *tctx, } SSVAL(ucs_name, i*2, 0); - i = convert_string_talloc_convenience(ucs_name, lp_iconv_convenience(tctx->lp_ctx), CH_UTF16, CH_UNIX, ucs_name, (1+u_name_len)*2, (void **)&fname, false); - if (i == -1) { + if (!convert_string_talloc_convenience(ucs_name, lp_iconv_convenience(tctx->lp_ctx), CH_UTF16, CH_UNIX, ucs_name, (1+u_name_len)*2, (void **)&fname, &i, false)) { torture_comment(tctx, "Failed to convert UCS2 Name into unix - convert_string_talloc() failure\n"); talloc_free(ucs_name); return NT_STATUS_NO_MEMORY; diff --git a/source4/torture/basic/utable.c b/source4/torture/basic/utable.c index ef0e4d44ed..ca6c2fd576 100644 --- a/source4/torture/basic/utable.c +++ b/source4/torture/basic/utable.c @@ -32,7 +32,8 @@ bool torture_utable(struct torture_context *tctx, const char *alt_name; int fnum; uint8_t c2[4]; - int c, len, fd; + int c, fd; + size_t len; int chars_allowed=0, alt_allowed=0; uint8_t valid[0x10000]; @@ -49,9 +50,9 @@ bool torture_utable(struct torture_context *tctx, SSVAL(c2, 0, c); strncpy(fname, "\\utable\\x", sizeof(fname)-1); p = fname+strlen(fname); - len = convert_string_convenience(lp_iconv_convenience(tctx->lp_ctx), CH_UTF16, CH_UNIX, + convert_string_convenience(lp_iconv_convenience(tctx->lp_ctx), CH_UTF16, CH_UNIX, c2, 2, - p, sizeof(fname)-strlen(fname), false); + p, sizeof(fname)-strlen(fname), &len, false); p[len] = 0; strncat(fname,"_a_long_extension",sizeof(fname)-1); @@ -102,15 +103,15 @@ static char *form_name(struct smb_iconv_convenience *iconv_convenience, int c) static char fname[256]; uint8_t c2[4]; char *p; - int len; + size_t len; strncpy(fname, "\\utable\\", sizeof(fname)-1); p = fname+strlen(fname); SSVAL(c2, 0, c); - len = convert_string_convenience(iconv_convenience, CH_UTF16, CH_UNIX, + convert_string_convenience(iconv_convenience, CH_UTF16, CH_UNIX, c2, 2, - p, sizeof(fname)-strlen(fname), false); + p, sizeof(fname)-strlen(fname), &len, false); p[len] = 0; return fname; } diff --git a/source4/torture/rpc/samlogon.c b/source4/torture/rpc/samlogon.c index 7e1744ffab..0f0b8dc84d 100644 --- a/source4/torture/rpc/samlogon.c +++ b/source4/torture/rpc/samlogon.c @@ -1171,11 +1171,11 @@ static bool test_plaintext(struct samlogon_state *samlogon_state, enum ntlm_brea password = strupper_talloc(samlogon_state->mem_ctx, samlogon_state->password); - if ((convert_string_talloc_convenience(samlogon_state->mem_ctx, + if (!convert_string_talloc_convenience(samlogon_state->mem_ctx, samlogon_state->iconv_convenience, CH_UNIX, CH_DOS, password, strlen(password)+1, - (void**)&dospw, false)) == -1) { + (void**)&dospw, NULL, false)) { DEBUG(0, ("convert_string_talloc failed!\n")); exit(1); } diff --git a/source4/torture/rpc/spoolss_win.c b/source4/torture/rpc/spoolss_win.c index b09c62479c..08fadafe2c 100644 --- a/source4/torture/rpc/spoolss_win.c +++ b/source4/torture/rpc/spoolss_win.c @@ -383,7 +383,7 @@ static bool test_EnumPrinterKey(struct torture_context *tctx, convert_string_talloc_convenience(ctx, lp_iconv_convenience(tctx->lp_ctx), CH_UTF16, CH_UNIX, epk.out.key_buffer, *epk.out.needed, - (void**)&ctx->printer_keys, false); + (void**)&ctx->printer_keys, NULL, false); return true; } -- cgit From 8568b4fa9ff8f6f1a24547ec2ed5e2942b213d9e Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 1 Mar 2009 20:06:55 +0100 Subject: Add header files for secace and secacl. --- source4/libcli/security/security.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source4') diff --git a/source4/libcli/security/security.h b/source4/libcli/security/security.h index 517f3e8ebe..2608c9f7ed 100644 --- a/source4/libcli/security/security.h +++ b/source4/libcli/security/security.h @@ -30,5 +30,6 @@ struct auth_session_info; /* Moved the dom_sid functions to the top level dir with manual proto header */ #include "libcli/security/dom_sid.h" - +#include "libcli/security/secace.h" +#include "libcli/security/secacl.h" #include "libcli/security/proto.h" -- cgit From 7ab8f373c84c328b197f923287163e83371e7ccb Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 1 Mar 2009 22:24:34 +0100 Subject: Use common header file for character set handling in Samba 3 and Samba 4. --- source4/auth/ntlmssp/ntlmssp_parse.c | 36 ++++++++++++++++++++---------------- source4/kdc/kpasswdd.c | 5 ++--- source4/libcli/auth/smbencrypt.c | 32 +++++++++++++++++--------------- source4/torture/rpc/samba3rpc.c | 2 +- source4/torture/rpc/samlogon.c | 6 +++--- source4/torture/rpc/wkssvc.c | 2 +- 6 files changed, 44 insertions(+), 39 deletions(-) (limited to 'source4') diff --git a/source4/auth/ntlmssp/ntlmssp_parse.c b/source4/auth/ntlmssp/ntlmssp_parse.c index d606b8d563..969845d6c5 100644 --- a/source4/auth/ntlmssp/ntlmssp_parse.c +++ b/source4/auth/ntlmssp/ntlmssp_parse.c @@ -44,14 +44,15 @@ bool msrpc_gen(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, const char *format, ...) { - int i; - ssize_t n; + int i, j; + bool ret; va_list ap; char *s; uint8_t *b; int head_size=0, data_size=0; int head_ofs, data_ofs; int *intargs; + size_t n; DATA_BLOB *pointers; @@ -65,8 +66,9 @@ bool msrpc_gen(TALLOC_CTX *mem_ctx, case 'U': s = va_arg(ap, char *); head_size += 8; - n = push_ucs2_talloc(pointers, (void **)&pointers[i].data, s); - if (n == -1) { + ret = push_ucs2_talloc(pointers, (smb_ucs2_t **)&pointers[i].data, + s, &n); + if (!ret) { return false; } pointers[i].length = n; @@ -76,8 +78,9 @@ bool msrpc_gen(TALLOC_CTX *mem_ctx, case 'A': s = va_arg(ap, char *); head_size += 8; - n = push_ascii_talloc(pointers, (char **)&pointers[i].data, s); - if (n == -1) { + ret = push_ascii_talloc(pointers, (char **)&pointers[i].data, s, + &n); + if (!ret) { return false; } pointers[i].length = n; @@ -85,11 +88,12 @@ bool msrpc_gen(TALLOC_CTX *mem_ctx, data_size += pointers[i].length; break; case 'a': - n = va_arg(ap, int); - intargs[i] = n; + j = va_arg(ap, int); + intargs[i] = j; s = va_arg(ap, char *); - n = push_ucs2_talloc(pointers, (void **)&pointers[i].data, s); - if (n == -1) { + ret = push_ucs2_talloc(pointers, (smb_ucs2_t **)&pointers[i].data, + s, &n); + if (!ret) { return false; } pointers[i].length = n; @@ -110,8 +114,8 @@ bool msrpc_gen(TALLOC_CTX *mem_ctx, head_size += pointers[i].length; break; case 'd': - n = va_arg(ap, int); - intargs[i] = n; + j = va_arg(ap, int); + intargs[i] = j; head_size += 4; break; case 'C': @@ -145,8 +149,8 @@ bool msrpc_gen(TALLOC_CTX *mem_ctx, data_ofs += n; break; case 'a': - n = intargs[i]; - SSVAL(blob->data, data_ofs, n); data_ofs += 2; + j = intargs[i]; + SSVAL(blob->data, data_ofs, j); data_ofs += 2; n = pointers[i].length; SSVAL(blob->data, data_ofs, n); data_ofs += 2; @@ -156,8 +160,8 @@ bool msrpc_gen(TALLOC_CTX *mem_ctx, data_ofs += n; break; case 'd': - n = intargs[i]; - SIVAL(blob->data, head_ofs, n); + j = intargs[i]; + SIVAL(blob->data, head_ofs, j); head_ofs += 4; break; case 'b': diff --git a/source4/kdc/kpasswdd.c b/source4/kdc/kpasswdd.c index 67404af2ab..8f2cb68129 100644 --- a/source4/kdc/kpasswdd.c +++ b/source4/kdc/kpasswdd.c @@ -61,12 +61,11 @@ static bool kpasswdd_make_error_reply(struct kdc_server *kdc, DATA_BLOB *error_blob) { char *error_string_utf8; - ssize_t len; + size_t len; DEBUG(result_code ? 3 : 10, ("kpasswdd: %s\n", error_string)); - len = push_utf8_talloc(mem_ctx, &error_string_utf8, error_string); - if (len == -1) { + if (!push_utf8_talloc(mem_ctx, &error_string_utf8, error_string, &len)) { return false; } diff --git a/source4/libcli/auth/smbencrypt.c b/source4/libcli/auth/smbencrypt.c index bbb363e0dd..c6118c6568 100644 --- a/source4/libcli/auth/smbencrypt.c +++ b/source4/libcli/auth/smbencrypt.c @@ -63,11 +63,12 @@ bool SMBencrypt(const char *passwd, const uint8_t *c8, uint8_t p24[24]) bool E_md4hash(const char *passwd, uint8_t p16[16]) { - int len; - void *wpwd; + size_t len; + smb_ucs2_t *wpwd; + bool ret; - len = push_ucs2_talloc(NULL, &wpwd, passwd); - if (len < 2) { + ret = push_ucs2_talloc(NULL, &wpwd, passwd, &len); + if (!ret || len < 2) { /* We don't want to return fixed data, as most callers * don't check */ mdfour(p16, (const uint8_t *)passwd, strlen(passwd)); @@ -75,7 +76,7 @@ bool E_md4hash(const char *passwd, uint8_t p16[16]) } len -= 2; - mdfour(p16, wpwd, len); + mdfour(p16, (const uint8_t *)wpwd, len); talloc_free(wpwd); return true; @@ -116,10 +117,11 @@ bool ntv2_owf_gen(const uint8_t owf[16], bool upper_case_domain, /* Transform the domain into UPPER case */ uint8_t kr_buf[16]) { - void *user; - void *domain; + smb_ucs2_t *user; + smb_ucs2_t *domain; size_t user_byte_len; size_t domain_byte_len; + bool ret; HMACMD5Context ctx; TALLOC_CTX *mem_ctx = talloc_init("ntv2_owf_gen for %s\\%s", domain_in, user_in); @@ -150,15 +152,15 @@ bool ntv2_owf_gen(const uint8_t owf[16], } } - user_byte_len = push_ucs2_talloc(mem_ctx, &user, user_in); - if (user_byte_len == (ssize_t)-1) { + ret = push_ucs2_talloc(mem_ctx, &user, user_in, &user_byte_len ); + if (!ret) { DEBUG(0, ("push_uss2_talloc() for user returned -1 (probably talloc() failure)\n")); talloc_free(mem_ctx); return false; } - domain_byte_len = push_ucs2_talloc(mem_ctx, &domain, domain_in); - if (domain_byte_len == (ssize_t)-1) { + ret = push_ucs2_talloc(mem_ctx, &domain, domain_in, &domain_byte_len); + if (!ret) { DEBUG(0, ("push_ucs2_talloc() for domain returned -1 (probably talloc() failure)\n")); talloc_free(mem_ctx); return false; @@ -172,14 +174,14 @@ bool ntv2_owf_gen(const uint8_t owf[16], domain_byte_len = domain_byte_len - 2; hmac_md5_init_limK_to_64(owf, 16, &ctx); - hmac_md5_update(user, user_byte_len, &ctx); - hmac_md5_update(domain, domain_byte_len, &ctx); + hmac_md5_update((const void *)user, user_byte_len, &ctx); + hmac_md5_update((const void *)domain, domain_byte_len, &ctx); hmac_md5_final(kr_buf, &ctx); #ifdef DEBUG_PASSWORD DEBUG(100, ("ntv2_owf_gen: user, domain, owfkey, kr\n")); - dump_data(100, user, user_byte_len); - dump_data(100, domain, domain_byte_len); + dump_data(100, (const void *)user, user_byte_len); + dump_data(100, (const void *)domain, domain_byte_len); dump_data(100, owf, 16); dump_data(100, kr_buf, 16); #endif diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c index c9e65cf493..7cacba7418 100644 --- a/source4/torture/rpc/samba3rpc.c +++ b/source4/torture/rpc/samba3rpc.c @@ -2537,7 +2537,7 @@ static NTSTATUS get_servername(TALLOC_CTX *mem_ctx, struct smbcli_tree *tree, memcpy(servername, r.out.info.info0.name, 16); servername[16] = '\0'; - if (pull_ascii_talloc(mem_ctx, name, servername) < 0) { + if (!pull_ascii_talloc(mem_ctx, name, servername, NULL)) { return NT_STATUS_NO_MEMORY; } diff --git a/source4/torture/rpc/samlogon.c b/source4/torture/rpc/samlogon.c index 0f0b8dc84d..ce9bf5ea6e 100644 --- a/source4/torture/rpc/samlogon.c +++ b/source4/torture/rpc/samlogon.c @@ -1150,7 +1150,7 @@ static bool test_plaintext(struct samlogon_state *samlogon_state, enum ntlm_brea DATA_BLOB lm_response = data_blob(NULL, 0); char *password; char *dospw; - void *unicodepw; + smb_ucs2_t *unicodepw; uint8_t user_session_key[16]; uint8_t lm_key[16]; @@ -1161,8 +1161,8 @@ static bool test_plaintext(struct samlogon_state *samlogon_state, enum ntlm_brea ZERO_STRUCT(user_session_key); - if ((push_ucs2_talloc(samlogon_state->mem_ctx, - &unicodepw, samlogon_state->password)) == -1) { + if (!push_ucs2_talloc(samlogon_state->mem_ctx, + &unicodepw, samlogon_state->password, NULL)) { DEBUG(0, ("push_ucs2_allocate failed!\n")); exit(1); } diff --git a/source4/torture/rpc/wkssvc.c b/source4/torture/rpc/wkssvc.c index 0f49562d8b..3c34229dff 100644 --- a/source4/torture/rpc/wkssvc.c +++ b/source4/torture/rpc/wkssvc.c @@ -966,7 +966,7 @@ static bool test_NetrMessageBufferSend(struct torture_context *tctx, size_t size; uint8_t *msg; - size = push_ucs2_talloc(tctx, (void **)&msg, message); + push_ucs2_talloc(tctx, (void **)&msg, message, &size); r.in.server_name = dcerpc_server_name(p); r.in.message_name = dcerpc_server_name(p); -- cgit From cdbc00bb52f39472fe5f1380b15180205644c8e9 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 2 Mar 2009 05:07:30 +0100 Subject: Fix test_surrounding in samba4.rpcecho.python. --- source4/scripting/python/samba/tests/dcerpc/rpcecho.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4') diff --git a/source4/scripting/python/samba/tests/dcerpc/rpcecho.py b/source4/scripting/python/samba/tests/dcerpc/rpcecho.py index 12638e2397..62268005c2 100644 --- a/source4/scripting/python/samba/tests/dcerpc/rpcecho.py +++ b/source4/scripting/python/samba/tests/dcerpc/rpcecho.py @@ -49,7 +49,7 @@ class RpcEchoTests(RpcInterfaceTestCase): surrounding_struct.x = 4 surrounding_struct.surrounding = [1,2,3,4] y = self.conn.TestSurrounding(surrounding_struct) - self.assertEquals(8 * [0], y.surrounding) + self.assertEquals(4 * [0], y.surrounding) def test_manual_request(self): self.assertEquals("\x01\x00\x00\x00", self.conn.request(0, chr(0) * 4)) -- cgit From 88bd0f2ac6bb7ec41d72a1ea3d7ee90333f4e978 Mon Sep 17 00:00:00 2001 From: Björn Jacke Date: Sun, 1 Mar 2009 21:38:31 +0100 Subject: some shells are picky about ^ without quotes --- source4/selftest/tests.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4') diff --git a/source4/selftest/tests.sh b/source4/selftest/tests.sh index 99e530ec38..39e6cff274 100755 --- a/source4/selftest/tests.sh +++ b/source4/selftest/tests.sh @@ -126,7 +126,7 @@ all_tests="$ncalrpc_tests $ncacn_np_tests $ncacn_ip_tcp_tests $slow_ncalrpc_test # Make sure all tests get run for t in `$smb4torture --list | grep "^RPC-"` do - echo $all_tests | grep $t > /dev/null + echo $all_tests | grep "$t" > /dev/null if [ $? -ne 0 ] then auto_rpc_tests="$auto_rpc_tests $t" @@ -174,7 +174,7 @@ done # Tests for the NET API -net=`$smb4torture --list | grep ^NET-` +net=`$smb4torture --list | grep "^NET-"` for t in $net; do plansmbtorturetest "$t" dc "\$SERVER[$VALIDATE]" -U"\$USERNAME"%"\$PASSWORD" -W "\$DOMAIN" "$*" -- cgit From 212756646efa85880a6b50aa7cb404e402c2ae4a Mon Sep 17 00:00:00 2001 From: Björn Jacke Date: Sun, 1 Mar 2009 21:08:33 +0100 Subject: make man page (un)install more portable --- source4/script/installman.sh | 2 +- source4/script/uninstallman.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'source4') diff --git a/source4/script/installman.sh b/source4/script/installman.sh index ae99bceacf..a3b6ec0d93 100755 --- a/source4/script/installman.sh +++ b/source4/script/installman.sh @@ -6,7 +6,7 @@ MANPAGES=$* for I in $MANPAGES do - SECTION=`echo $I | grep -o '.$'` + SECTION=`echo -n $I | sed "s/.*\(.\)$/\1/" DIR="$MANDIR/man$SECTION" if [ ! -d "$DIR" ] then diff --git a/source4/script/uninstallman.sh b/source4/script/uninstallman.sh index 72b523ed9e..9b087c68bb 100755 --- a/source4/script/uninstallman.sh +++ b/source4/script/uninstallman.sh @@ -8,7 +8,7 @@ MANPAGES=$* for I in $MANPAGES do - SECTION=`echo $I | grep -o '.$'` + SECTION=`echo -n $I | sed "s/.*\(.\)$/\1/" FNAME=$MANDIR/man$SECTION/$I if test -f $FNAME; then echo Deleting $FNAME -- cgit From 44c94b6c66b00807d58233550cf8915566cb97d0 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 4 Mar 2009 13:58:07 +1100 Subject: Allow 'net vampire' to work without an existing smb.conf Now the provision can generate one based on the detected settings from the target domain. Andrew Bartlett --- source4/param/provision.c | 8 ++++++-- source4/param/util.c | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'source4') diff --git a/source4/param/provision.c b/source4/param/provision.c index 7a06f77d96..c8bff59deb 100644 --- a/source4/param/provision.c +++ b/source4/param/provision.c @@ -34,6 +34,7 @@ NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, struct provision_settings *settings, struct provision_result *result) { + char *configfile; PyObject *provision_mod, *provision_dict, *provision_fn, *py_result, *parameters; DEBUG(0,("Provision for Become-DC test using python\n")); @@ -76,8 +77,11 @@ 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))); + configfile = lp_configfile(lp_ctx); + if (configfile != NULL) { + PyDict_SetItemString(parameters, "smbconf", + PyString_FromString(configfile)); + } PyDict_SetItemString(parameters, "rootdn", PyString_FromString(settings->root_dn_str)); diff --git a/source4/param/util.c b/source4/param/util.c index 92728d505a..3881107cbc 100644 --- a/source4/param/util.c +++ b/source4/param/util.c @@ -107,7 +107,7 @@ char *config_path(TALLOC_CTX* mem_ctx, struct loadparm_context *lp_ctx, char *fname, *config_dir, *p; config_dir = talloc_strdup(mem_ctx, lp_configfile(lp_ctx)); if (config_dir == NULL) { - return NULL; + config_dir = talloc_strdup(mem_ctx, lp_default_path()); } p = strrchr(config_dir, '/'); if (p == NULL) { -- cgit From 952bdffaadebe8fc147c69da160ddd83e1d03245 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 4 Mar 2009 14:02:35 +1100 Subject: Don't print the admin password if we don't set one. For example, if we don't create the admin user (perhaps expecting users to be in LDAP already, or we are due an incoming replication) we should not confuse the administrator by printing a unused password. Andrew Bartlett --- source4/scripting/python/samba/provision.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source4') diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py index 0aa84ec6db..d96857661e 100644 --- a/source4/scripting/python/samba/provision.py +++ b/source4/scripting/python/samba/provision.py @@ -1136,7 +1136,8 @@ def provision(setup_dir, message, session_info, message("NetBIOS Domain: %s" % names.domain) message("DNS Domain: %s" % names.dnsdomain) message("DOMAIN SID: %s" % str(domainsid)) - message("Admin password: %s" % adminpass) + if samdb_fill == FILL_FULL: + message("Admin password: %s" % adminpass) result = ProvisionResult() result.domaindn = domaindn -- cgit From 52542e1affbaad3a29d913ced06f6c5ae0d7b4ad Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 4 Mar 2009 14:06:11 +1100 Subject: Pull in all the schema information during DRS schema fetch This includes things such as allowed attributes, which were not populated into the schema structure before. Andrew Bartlett --- source4/dsdb/schema/schema_init.c | 47 +++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 9 deletions(-) (limited to 'source4') diff --git a/source4/dsdb/schema/schema_init.c b/source4/dsdb/schema/schema_init.c index fbd8946bb5..a67aecd1e8 100644 --- a/source4/dsdb/schema/schema_init.c +++ b/source4/dsdb/schema/schema_init.c @@ -1202,6 +1202,34 @@ static struct drsuapi_DsReplicaAttribute *dsdb_find_object_attr_name(struct dsdb } \ } while (0) +#define GET_STRING_LIST_DS(s, r, attr, mem_ctx, p, elem, strict) do { \ + int get_string_list_counter; \ + struct drsuapi_DsReplicaAttribute *_a; \ + _a = dsdb_find_object_attr_name(s, r, attr, NULL); \ + if (strict && !_a) { \ + d_printf("%s: %s == NULL\n", __location__, attr); \ + return WERR_INVALID_PARAM; \ + } \ + (p)->elem = _a ? talloc_array(mem_ctx, const char *, _a->value_ctr.num_values + 1) : NULL; \ + for (get_string_list_counter=0; \ + _a && get_string_list_counter < _a->value_ctr.num_values; \ + get_string_list_counter++) { \ + size_t _ret; \ + if (!convert_string_talloc_convenience(mem_ctx, s->iconv_convenience, CH_UTF16, CH_UNIX, \ + _a->value_ctr.values[get_string_list_counter].blob->data, \ + _a->value_ctr.values[get_string_list_counter].blob->length, \ + (void **)discard_const(&(p)->elem[get_string_list_counter]), &_ret, false)) { \ + DEBUG(0,("%s: invalid data!\n", attr)); \ + dump_data(0, \ + _a->value_ctr.values[get_string_list_counter].blob->data, \ + _a->value_ctr.values[get_string_list_counter].blob->length); \ + return WERR_FOOBAR; \ + } \ + (p)->elem[get_string_list_counter+1] = NULL; \ + } \ + talloc_steal(mem_ctx, (p)->elem); \ +} while (0) + #define GET_DN_DS(s, r, attr, mem_ctx, p, elem, strict) do { \ struct drsuapi_DsReplicaAttribute *_a; \ _a = dsdb_find_object_attr_name(s, r, attr, NULL); \ @@ -1412,17 +1440,18 @@ WERROR dsdb_class_from_drsuapi(struct dsdb_schema *schema, GET_STRING_DS(schema, r, "subClassOf", mem_ctx, obj, subClassOf, true); - obj->systemAuxiliaryClass = NULL; - obj->systemPossSuperiors = NULL; - obj->systemMustContain = NULL; - obj->systemMayContain = NULL; - obj->auxiliaryClass = NULL; - obj->possSuperiors = NULL; - obj->mustContain = NULL; - obj->mayContain = NULL; + GET_STRING_LIST_DS(schema, r, "systemAuxiliaryClass", mem_ctx, obj, systemAuxiliaryClass, false); + GET_STRING_LIST_DS(schema, r, "auxiliaryClass", mem_ctx, obj, auxiliaryClass, false); + + GET_STRING_LIST_DS(schema, r, "systemMustContain", mem_ctx, obj, systemMustContain, false); + GET_STRING_LIST_DS(schema, r, "systemMayContain", mem_ctx, obj, systemMayContain, false); + GET_STRING_LIST_DS(schema, r, "mustContain", mem_ctx, obj, mustContain, false); + GET_STRING_LIST_DS(schema, r, "mayContain", mem_ctx, obj, mayContain, false); - obj->possibleInferiors = NULL; + GET_STRING_LIST_DS(schema, r, "systemPossSuperiors", mem_ctx, obj, systemPossSuperiors, false); + GET_STRING_LIST_DS(schema, r, "possSuperiors", mem_ctx, obj, possSuperiors, false); + GET_STRING_LIST_DS(schema, r, "possibleInferiors", mem_ctx, obj, possibleInferiors, false); GET_STRING_DS(schema, r, "defaultSecurityDescriptor", mem_ctx, obj, defaultSecurityDescriptor, false); -- cgit From 92bb91a6115ac035e3c37e471931c2a388dc843e Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 5 Mar 2009 10:46:46 +1100 Subject: Update talloc version so we don't fail on system talloc 1.2.0 The problem is that talloc in the Samba tree now includes talloc_get_type_abort(), which is not present on Fedora 10 or ubuntu's talloc 1.2.0. Andrew Bartlett --- source4/configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4') diff --git a/source4/configure.ac b/source4/configure.ac index 54ca9108b1..d33df08406 100644 --- a/source4/configure.ac +++ b/source4/configure.ac @@ -42,7 +42,7 @@ AC_CONFIG_FILES(param/samba-hostconfig.pc) AC_CONFIG_FILES(librpc/dcerpc_samr.pc) AC_CONFIG_FILES(librpc/dcerpc_atsvc.pc) -SMB_INCLUDED_LIB_PKGCONFIG(LIBTALLOC, talloc >= 1.2.0, [], +SMB_INCLUDED_LIB_PKGCONFIG(LIBTALLOC, talloc >= 1.2.1, [], [ m4_include(../lib/talloc/libtalloc.m4) SMB_INCLUDE_MK(../lib/talloc/config.mk) -- cgit From 5a10d804919af205b027ee519b9fa05519913ebe Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 5 Mar 2009 11:07:35 +1100 Subject: Remove parse_control from header, long after the function was removed Simo reminded me that when (long ago) I moved parse_controls away from this place, I forgot to update the manually maintained header file. Andrew Bartlett --- source4/lib/ldb/tools/cmdline.h | 1 - 1 file changed, 1 deletion(-) (limited to 'source4') diff --git a/source4/lib/ldb/tools/cmdline.h b/source4/lib/ldb/tools/cmdline.h index 3473d62a16..45619ce496 100644 --- a/source4/lib/ldb/tools/cmdline.h +++ b/source4/lib/ldb/tools/cmdline.h @@ -50,5 +50,4 @@ struct ldb_cmdline *ldb_cmdline_process(struct ldb_context *ldb, int argc, const void (*usage)(void)); -struct ldb_control **parse_controls(void *mem_ctx, char **control_strings); int handle_controls_reply(struct ldb_control **reply, struct ldb_control **request); -- cgit