metze/samba/wip.git
5 years agopython:samdb: add set_schema_update_in_progress() helper function
Stefan Metzmacher [Fri, 22 Feb 2019 13:53:47 +0000 (14:53 +0100)]
python:samdb: add set_schema_update_in_progress() helper function

5 years agodsdb:objectclass: implement schemaUpgradeInProgress handling for systemFlags on add
Stefan Metzmacher [Fri, 22 Feb 2019 13:33:51 +0000 (14:33 +0100)]
dsdb:objectclass: implement schemaUpgradeInProgress handling for systemFlags on add

Signed-off-by: Stefan Metzmacher <metze@samba.org>
5 years agoLATER: dsdb:rootdse: make use of acl_user_token() for tokenGroups
Stefan Metzmacher [Fri, 22 Feb 2019 13:32:56 +0000 (14:32 +0100)]
LATER: dsdb:rootdse: make use of acl_user_token() for tokenGroups

Signed-off-by: Stefan Metzmacher <metze@samba.org>
5 years agodsdb:rootdse: implement schemaUpgradeInProgress handling
Stefan Metzmacher [Fri, 22 Feb 2019 13:28:02 +0000 (14:28 +0100)]
dsdb:rootdse: implement schemaUpgradeInProgress handling

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13799

Signed-off-by: Stefan Metzmacher <metze@samba.org>
5 years agodsdb:ldb_modules: add dsdb_[set_]schema_upgrade_in_progress() helper functions
Stefan Metzmacher [Fri, 22 Feb 2019 13:26:47 +0000 (14:26 +0100)]
dsdb:ldb_modules: add dsdb_[set_]schema_upgrade_in_progress() helper functions

Signed-off-by: Stefan Metzmacher <metze@samba.org>
5 years agodsdb:objectclass: use a systemFlags_allowed helper variable
Stefan Metzmacher [Fri, 22 Feb 2019 13:25:47 +0000 (14:25 +0100)]
dsdb:objectclass: use a systemFlags_allowed helper variable

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13799

Signed-off-by: Stefan Metzmacher <metze@samba.org>
5 years agodsdb:objectclass: handle systemFlags as unsigned
Stefan Metzmacher [Thu, 21 Feb 2019 10:11:30 +0000 (11:11 +0100)]
dsdb:objectclass: handle systemFlags as unsigned

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13799

Signed-off-by: Stefan Metzmacher <metze@samba.org>
5 years agoRevert "DEBUG schema reload"
Stefan Metzmacher [Wed, 20 Feb 2019 00:58:48 +0000 (01:58 +0100)]
Revert "DEBUG schema reload"

This reverts commit b80da89480f9ff09ecde0cccdf8d00d3a7359627.

5 years agoDEBUG schema reload
Stefan Metzmacher [Wed, 20 Feb 2019 00:58:32 +0000 (01:58 +0100)]
DEBUG schema reload

5 years agoTODO: samba-tool: allow 'domain schemaupgrade' only on a local database
Stefan Metzmacher [Tue, 19 Feb 2019 16:34:24 +0000 (17:34 +0100)]
TODO: samba-tool: allow 'domain schemaupgrade' only on a local database

It's important that we only operate on a local database as SYSTEM,
which means we can use the 'relax' control. This is important
as otherwise we're not able to set FLAG_SCHEMA_BASE_OBJECT
in systemFlags, which is required in order to avoid the generation
of msDS-IntId values.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13799

Check how Windows adprep works

5 years agoTODO: check Windows! We need to update the schemaInfo on schema changes!!!
Stefan Metzmacher [Wed, 20 Feb 2019 14:08:16 +0000 (15:08 +0100)]
TODO: check Windows! We need to update the schemaInfo on schema changes!!!

5 years agoldapcmp: ignore 'schemaInfo' if two domains are compared
Stefan Metzmacher [Thu, 21 Feb 2019 08:20:48 +0000 (09:20 +0100)]
ldapcmp: ignore 'schemaInfo' if two domains are compared

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13799

Signed-off-by: Stefan Metzmacher <metze@samba.org>
5 years agodsdb/repl: we need to replicate the whole schema before we can apply it
Stefan Metzmacher [Fri, 8 Feb 2019 14:49:55 +0000 (14:49 +0000)]
dsdb/repl: we need to replicate the whole schema before we can apply it

Otherwise we may not be able to construct a working schema that's
required to apply the changes.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12204

Signed-off-by: Stefan Metzmacher <metze@samba.org>
5 years agoTODO: drs_local_replicate schema
Stefan Metzmacher [Tue, 12 Feb 2019 10:33:44 +0000 (11:33 +0100)]
TODO: drs_local_replicate schema

5 years agos4:libnet_vampire: don't ignore linked attributes in the schema cycle
Stefan Metzmacher [Wed, 20 Feb 2019 09:30:56 +0000 (10:30 +0100)]
s4:libnet_vampire: don't ignore linked attributes in the schema cycle

5 years agodsdb_repl_resolve_working_schema() only operates on one schema
Stefan Metzmacher [Wed, 20 Feb 2019 08:17:29 +0000 (09:17 +0100)]
dsdb_repl_resolve_working_schema() only operates on one schema

5 years agoonly pass one schema pointer to dsdb_repl_resolve_working_schema()
Stefan Metzmacher [Wed, 20 Feb 2019 08:14:40 +0000 (09:14 +0100)]
only pass one schema pointer to dsdb_repl_resolve_working_schema()

5 years agomake dsdb_repl_resolve_working_schema() static
Stefan Metzmacher [Wed, 20 Feb 2019 08:13:14 +0000 (09:13 +0100)]
make dsdb_repl_resolve_working_schema() static

5 years agos4:libnet_vampire: simplify schema handling
Stefan Metzmacher [Wed, 20 Feb 2019 07:35:59 +0000 (08:35 +0100)]
s4:libnet_vampire: simplify schema handling

This should work in the same way the online schema cycle works:
- dsdb_repl_make_working_schema() creates a temporary working_schema
  using the initial schema and the replicated objects.
- dsdb_replicated_objects_convert() uses the working_schema to
  convert everything.
- dsdb_replicated_objects_commit() also takes the working_schema
  and makes sure we store the objects, store the new prefixMap,
  make sure the metadata_usn for the schema is updated and
  reload the schema from the changed database.

5 years agoremove DSDB_EXTENDED_SCHEMA_LOAD from schema_load.c
Stefan Metzmacher [Wed, 20 Feb 2019 01:50:39 +0000 (02:50 +0100)]
remove DSDB_EXTENDED_SCHEMA_LOAD from schema_load.c

5 years agoschema_load_extended remove indentation level
Stefan Metzmacher [Wed, 20 Feb 2019 07:42:52 +0000 (08:42 +0100)]
schema_load_extended remove indentation level

5 years agodsdb_replicated_objects_commit DSDB_EXTENDED_SCHEMA_UPDATE_NOW_OID source4/dsdb/repl...
Stefan Metzmacher [Wed, 20 Feb 2019 00:55:59 +0000 (01:55 +0100)]
dsdb_replicated_objects_commit DSDB_EXTENDED_SCHEMA_UPDATE_NOW_OID source4/dsdb/repl/replicated_objects.c

5 years agoworking_schema->metadata_usn = UINT64_MAX;
Stefan Metzmacher [Wed, 20 Feb 2019 01:48:11 +0000 (02:48 +0100)]
working_schema->metadata_usn = UINT64_MAX;

5 years agoschema_load() already call dsdb_set_schema_refresh_function
Stefan Metzmacher [Wed, 20 Feb 2019 08:05:31 +0000 (09:05 +0100)]
schema_load() already call dsdb_set_schema_refresh_function

5 years agoRevert "replmd_notify_store DSDB_EXTENDED_SCHEMA_UPDATE_NOW_OID DSDB_FLAG_TOP_MODULE...
Stefan Metzmacher [Wed, 20 Feb 2019 01:47:04 +0000 (02:47 +0100)]
Revert "replmd_notify_store DSDB_EXTENDED_SCHEMA_UPDATE_NOW_OID DSDB_FLAG_TOP_MODULE ???"

This reverts commit 71b2b9455d8a498260094c9e758623ed91765cad.

5 years agoreplmd_notify_store DSDB_EXTENDED_SCHEMA_UPDATE_NOW_OID DSDB_FLAG_TOP_MODULE ???
Stefan Metzmacher [Wed, 20 Feb 2019 01:46:47 +0000 (02:46 +0100)]
replmd_notify_store DSDB_EXTENDED_SCHEMA_UPDATE_NOW_OID DSDB_FLAG_TOP_MODULE ???

5 years agomove dsdb_schema_refresh_expected just into schema_load.c
Stefan Metzmacher [Wed, 20 Feb 2019 01:45:12 +0000 (02:45 +0100)]
move dsdb_schema_refresh_expected just into schema_load.c

5 years agosamldb_schema_add_handle_linkid == "0" => fail
Stefan Metzmacher [Wed, 6 Mar 2019 15:33:12 +0000 (16:33 +0100)]
samldb_schema_add_handle_linkid == "0" => fail

5 years agosamldb_schema_add_handle_linkid == "1"
Stefan Metzmacher [Wed, 6 Mar 2019 15:32:42 +0000 (16:32 +0100)]
samldb_schema_add_handle_linkid == "1"

5 years agosamldb_schema_add_handle_linkid attr->linkID == 0
Stefan Metzmacher [Wed, 6 Mar 2019 15:07:55 +0000 (16:07 +0100)]
samldb_schema_add_handle_linkid attr->linkID == 0

5 years agodsdb:schema_data: make attributeSchema, classSchema, subSchema and dMD immutable.
Stefan Metzmacher [Tue, 12 Mar 2019 16:33:48 +0000 (17:33 +0100)]
dsdb:schema_data: make attributeSchema, classSchema, subSchema and dMD immutable.

[MS-ADTS] 3.1.1.2.5.1.2 Safety Checks says:

 ...

 * A Modify does not change the classSchema objects attributeSchema,
   classSchema, subSchema and dMD.

This implies that we'll never see any linked attributes within
the Schema NC!

Signed-off-by: Stefan Metzmacher <metze@samba.org>
5 years agodsdb:schema_data: protect us from lDAPDisplayName changes
Stefan Metzmacher [Tue, 12 Mar 2019 14:05:51 +0000 (15:05 +0100)]
dsdb:schema_data: protect us from lDAPDisplayName changes

We just can't handle changes of lDAPDisplayName yet,
the comment in the code has more details for the reason.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
5 years agodsdb:schema_data: don't allow replicated deletes
Stefan Metzmacher [Tue, 12 Mar 2019 13:45:04 +0000 (14:45 +0100)]
dsdb:schema_data: don't allow replicated deletes

We should protect ourself from a broken schema injected via replication.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
5 years agosq TODO simple verification test: dsdb:schema_data: only allow attributeSchema and...
Stefan Metzmacher [Wed, 13 Mar 2019 10:25:16 +0000 (11:25 +0100)]
sq TODO simple verification test: dsdb:schema_data: only allow attributeSchema and classSchema objects

5 years agoTODO simple verification test: dsdb:schema_data: only allow attributeSchema and class...
Stefan Metzmacher [Wed, 6 Mar 2019 19:12:44 +0000 (20:12 +0100)]
TODO simple verification test: dsdb:schema_data: only allow attributeSchema and classSchema objects

It's only allowed to create attributeSchema and classSchema objects in
the Schema NC, even if a custom objectClass would allow objects to
be created under the 'dMD' object, I tested this:

  schema_objects-bla.ldif
  dn: CN=schemaOUclass,CN=Schema,CN=Configuration,DC=bla,DC=base
  changetype: add
  objectClass: classSchema
  governsId: 1.3.6.1.4.1.7165.4.6.2.8.999.1
  lDAPDisplayName: schemaOUClass
  objectClassCategory: 1
  subClassOf: organizationalUnit
  systemFlags: 16
  systemPossSuperiors: dMD
  systemPossSuperiors: organizationalUnit
  -

  dn:
  changetype: modify
  add: schemaUpdateNow
  schemaUpdateNow: 1
  -

  dn: CN=schemaOU1,CN=Schema,CN=Configuration,DC=bla,DC=base
  changetype: add
  objectClass: schemaOUClass
  managedBy: <SID=S-1-5-32-544>

TODO: add a simple test with this ldif

5 years agodsdb:schema_data: reload schema->fsmo.we_are_master for each request
Stefan Metzmacher [Thu, 7 Mar 2019 12:10:12 +0000 (13:10 +0100)]
dsdb:schema_data: reload schema->fsmo.we_are_master for each request

We need to be sure that we're really the current schema master
before we can allow schema changes!

Signed-off-by: Stefan Metzmacher <metze@samba.org>
5 years agodsdb:schema_data: let all AS_SYSTEM modifies pass through
Stefan Metzmacher [Fri, 8 Mar 2019 10:47:21 +0000 (11:47 +0100)]
dsdb:schema_data: let all AS_SYSTEM modifies pass through

These are like replicated updates and should always go through,
even when we're not schema master.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
5 years agodsdb:samldb: pass down AS_SYSTEM control when fixing the defaultObjectCategory attribute
Stefan Metzmacher [Fri, 8 Mar 2019 10:39:51 +0000 (11:39 +0100)]
dsdb:samldb: pass down AS_SYSTEM control when fixing the defaultObjectCategory attribute

The real change already happened and here we just fill in the
missing extended dn information.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
5 years agoRevert "DEBUG debug replicated renames"
Stefan Metzmacher [Tue, 12 Mar 2019 13:28:31 +0000 (14:28 +0100)]
Revert "DEBUG debug replicated renames"

This reverts commit f750b2556e1ed3a262136198ea102379f2487abb.

5 years agoDEBUG debug replicated renames
Stefan Metzmacher [Tue, 12 Mar 2019 13:28:08 +0000 (14:28 +0100)]
DEBUG debug replicated renames

5 years agosq schema_data rename HERE!!!
Stefan Metzmacher [Tue, 12 Mar 2019 13:29:44 +0000 (14:29 +0100)]
sq schema_data rename HERE!!!

5 years agodsdb:schema_data: only allow originating renames on the schema master
Stefan Metzmacher [Wed, 6 Mar 2019 19:28:09 +0000 (20:28 +0100)]
dsdb:schema_data: only allow originating renames on the schema master

Signed-off-by: Stefan Metzmacher <metze@samba.org>
5 years agodsdb:repl_meta_data: the rename on delete should be marked AS_SYSTEM
Stefan Metzmacher [Tue, 12 Mar 2019 13:06:26 +0000 (14:06 +0100)]
dsdb:repl_meta_data: the rename on delete should be marked AS_SYSTEM

When an object is deleted it is typically moved under the
Deleted Objects Container, this move/rename is not
an originating rename, so we better mark it as system.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
5 years agodsdb:repl_meta_data: mark incoming renames as replicated updates
Stefan Metzmacher [Tue, 12 Mar 2019 13:06:26 +0000 (14:06 +0100)]
dsdb:repl_meta_data: mark incoming renames as replicated updates

This will allow the schema_data module to allow them, even
if we're not the schema master.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
5 years agodsdb:subtree_rename: pass down REPLICATED_UPDATE and AS_SYSTEM controls
Stefan Metzmacher [Tue, 12 Mar 2019 12:38:21 +0000 (13:38 +0100)]
dsdb:subtree_rename: pass down REPLICATED_UPDATE and AS_SYSTEM controls

We need to pass these through from the caller module
and we use AS_SYSTEM for the recursiv renames.

This will allow the schema_data module to decide if
the rename is an originating one or not.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
5 years agodsdb:samldb: check DOMAIN_DISALLOW_RENAME in the schema NC
Stefan Metzmacher [Fri, 8 Mar 2019 16:06:23 +0000 (17:06 +0100)]
dsdb:samldb: check DOMAIN_DISALLOW_RENAME in the schema NC

Signed-off-by: Stefan Metzmacher <metze@samba.org>
5 years agodsdb:schema_data: split out schema_data_check_master() helper function
Stefan Metzmacher [Wed, 6 Mar 2019 19:20:19 +0000 (20:20 +0100)]
dsdb:schema_data: split out schema_data_check_master() helper function

It's easier to have just one function where we reject originating
schema updates except on the schema master.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
5 years agodsdb:schema_data: allow the schema aggregate object on provision
Stefan Metzmacher [Fri, 8 Mar 2019 11:07:17 +0000 (12:07 +0100)]
dsdb:schema_data: allow the schema aggregate object on provision

Signed-off-by: Stefan Metzmacher <metze@samba.org>
5 years agodsdb:schema_data: use the provision control instead of relax control
Stefan Metzmacher [Fri, 8 Mar 2019 11:06:25 +0000 (12:06 +0100)]
dsdb:schema_data: use the provision control instead of relax control

Signed-off-by: Stefan Metzmacher <metze@samba.org>
5 years agopython/provision: use provision and relax controls for schema provision
Stefan Metzmacher [Fri, 8 Mar 2019 10:28:42 +0000 (11:28 +0100)]
python/provision: use provision and relax controls for schema provision

Signed-off-by: Stefan Metzmacher <metze@samba.org>
5 years agos4:provision: split out provision_self_join_modify_schema.ldif
Stefan Metzmacher [Fri, 8 Mar 2019 10:27:14 +0000 (11:27 +0100)]
s4:provision: split out provision_self_join_modify_schema.ldif

Signed-off-by: Stefan Metzmacher <metze@samba.org>
5 years agodsdb:rootdse: inline return ldb_operr(ldb) in rootdse_add_dynamic()
Stefan Metzmacher [Wed, 6 Mar 2019 16:06:15 +0000 (17:06 +0100)]
dsdb:rootdse: inline return ldb_operr(ldb) in rootdse_add_dynamic()

This generates more useful error messages.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
5 years agosource4/dsdb/samdb/ldb_modules/rootdse.c fix dsdb_module_we_are_master
Stefan Metzmacher [Wed, 6 Mar 2019 16:03:48 +0000 (17:03 +0100)]
source4/dsdb/samdb/ldb_modules/rootdse.c fix dsdb_module_we_are_master

5 years agodsdb:schema: remove unused dsdb_schema->refresh_in_progress
Stefan Metzmacher [Wed, 20 Feb 2019 01:43:03 +0000 (02:43 +0100)]
dsdb:schema: remove unused dsdb_schema->refresh_in_progress

Signed-off-by: Stefan Metzmacher <metze@samba.org>
5 years agodsdb:repl: remove unused gensec_skey from dsdb_repl_make_working_schema()
Stefan Metzmacher [Tue, 19 Feb 2019 14:33:13 +0000 (15:33 +0100)]
dsdb:repl: remove unused gensec_skey from dsdb_repl_make_working_schema()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
5 years agodrsuapi.idl: add DRSUAPI_ATTID_schemaInfo
Stefan Metzmacher [Fri, 22 Feb 2019 23:14:31 +0000 (00:14 +0100)]
drsuapi.idl: add DRSUAPI_ATTID_schemaInfo

Signed-off-by: Stefan Metzmacher <metze@samba.org>
5 years agoRevert "DEBUG dbcheck problem with rdn attribute being local to each dc"
Stefan Metzmacher [Fri, 29 Mar 2019 14:42:51 +0000 (15:42 +0100)]
Revert "DEBUG dbcheck problem with rdn attribute being local to each dc"

This reverts commit fedaaa6f136cf954219281fa91af9d9b0895fde6.

5 years agoDEBUG dbcheck problem with rdn attribute being local to each dc
Stefan Metzmacher [Fri, 1 Mar 2019 07:01:25 +0000 (08:01 +0100)]
DEBUG dbcheck problem with rdn attribute being local to each dc

5 years agoRevert "DEBUG undelete acl tests"
Stefan Metzmacher [Fri, 1 Mar 2019 10:13:22 +0000 (11:13 +0100)]
Revert "DEBUG undelete acl tests"

This reverts commit 0b40b4562330a27bf97f8404ec3289137589fb2a.

5 years agoDEBUG undelete acl tests
Stefan Metzmacher [Fri, 1 Mar 2019 10:13:06 +0000 (11:13 +0100)]
DEBUG undelete acl tests

5 years agoHACK testprogs/blackbox/dbcheck-links.sh no cleanup
Stefan Metzmacher [Mon, 11 Mar 2019 17:11:20 +0000 (18:11 +0100)]
HACK testprogs/blackbox/dbcheck-links.sh no cleanup

5 years agoTODO: script/autobuild removes this... do we want to use --nocleanup??? .gitlab-ci...
Stefan Metzmacher [Mon, 11 Feb 2019 12:19:54 +0000 (13:19 +0100)]
TODO: script/autobuild removes this... do we want to use --nocleanup??? .gitlab-ci.yml: fix path to config.log

Signed-off-by: Stefan Metzmacher <metze@samba.org>
5 years ago.gitlab-ci.yml: disable all swapping with swapoff -va
Stefan Metzmacher [Wed, 27 Feb 2019 14:14:15 +0000 (15:14 +0100)]
.gitlab-ci.yml: disable all swapping with swapoff -va

Signed-off-by: Stefan Metzmacher <metze@samba.org>
5 years ago.gitlab-ci.yml: show the system state also as after_script
Stefan Metzmacher [Wed, 27 Feb 2019 13:23:48 +0000 (14:23 +0100)]
.gitlab-ci.yml: show the system state also as after_script

Signed-off-by: Stefan Metzmacher <metze@samba.org>
5 years ago.gitlab-ci.yml: print out /proc/swaps
Stefan Metzmacher [Wed, 27 Feb 2019 13:29:22 +0000 (14:29 +0100)]
.gitlab-ci.yml: print out /proc/swaps

Signed-off-by: Stefan Metzmacher <metze@samba.org>
5 years ago.gitlab-ci.yml: remove before_script section of .private_template
Stefan Metzmacher [Wed, 27 Feb 2019 13:22:52 +0000 (14:22 +0100)]
.gitlab-ci.yml: remove before_script section of .private_template

It's already inherited from .shared_template.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
5 years agos3:smbd: fix max_buffer handling of initial notify requests
Stefan Metzmacher [Wed, 16 Jan 2019 20:29:51 +0000 (21:29 +0100)]
s3:smbd: fix max_buffer handling of initial notify requests

The max_buffer value is only evaluated on the first notify
request on a directory handle.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13864

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Mar 29 00:35:39 UTC 2019 on sn-devel-144

5 years agos4:torture/smb2: replace torture:cn_max_buffer_size option with the negotiated max...
Stefan Metzmacher [Tue, 8 Jan 2019 15:22:25 +0000 (16:22 +0100)]
s4:torture/smb2: replace torture:cn_max_buffer_size option with the negotiated max trans size

Both:

 smbtorture //w2012r2-188/torture -Ua%b smb2.notify.valid-req --smb-ports=139

and:

 smbtorture //w2012r2-188/torture -Ua%b smb2.notify.valid-req --smb-ports=445

work against Windows 2008R2, 2012R2 and 2016 now and it reflects what
we have implemented in Samba.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13864

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:torture/smb2/notify: make use of torture_setup_simple_file() in test_valid_request()
Stefan Metzmacher [Fri, 15 Feb 2019 14:30:29 +0000 (15:30 +0100)]
s4:torture/smb2/notify: make use of torture_setup_simple_file() in test_valid_request()

There's no reason to use torture_setup_complex_file(), when we want to
test notify code. The test pass fine against Samba this way and don't
fail because of unrelated timestamp behavior.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13864

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:torture/smb2: add smb2_create_simple_file() and torture_setup_simple_file()
Stefan Metzmacher [Tue, 12 Feb 2019 15:51:20 +0000 (16:51 +0100)]
s4:torture/smb2: add smb2_create_simple_file() and torture_setup_simple_file()

Instead of the *_complex_file() versions these don't use EA's nor
complex timestamps.

A lot of tests currently using *_complex_file() only fail because
smbd doesn't implement the correct 'change_time' update behavior.
That should not be the reason why all smb2 related tests fail.

Timestamps should be tested in dedicated tests.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13864

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:libcli/smb2: calculate the correct credit charge in smb2_notify_send()
Stefan Metzmacher [Tue, 8 Jan 2019 09:10:49 +0000 (10:10 +0100)]
s4:libcli/smb2: calculate the correct credit charge in smb2_notify_send()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13863

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:libcli/smb2: calculate the correct credit charge in smb2_ioctl_send()
Stefan Metzmacher [Tue, 8 Jan 2019 15:13:41 +0000 (16:13 +0100)]
s4:libcli/smb2: calculate the correct credit charge in smb2_ioctl_send()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13863

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:libcli/smb2: align struct smb_ioctl.smb2 to [MS-SMB2] names
Stefan Metzmacher [Tue, 8 Jan 2019 14:52:35 +0000 (15:52 +0100)]
s4:libcli/smb2: align struct smb_ioctl.smb2 to [MS-SMB2] names

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13863

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:libcli/smb2: calculate the correct credit charge in smb2_getinfo_send()
Stefan Metzmacher [Tue, 8 Jan 2019 15:11:15 +0000 (16:11 +0100)]
s4:libcli/smb2: calculate the correct credit charge in smb2_getinfo_send()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13863

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:libcli/smb2: fix smb2_getinfo_send() marshalling
Stefan Metzmacher [Tue, 8 Jan 2019 15:09:46 +0000 (16:09 +0100)]
s4:libcli/smb2: fix smb2_getinfo_send() marshalling

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13863

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agosmb2_server: grant all 8192 credits to clients
Stefan Metzmacher [Wed, 16 Jan 2019 11:24:04 +0000 (12:24 +0100)]
smb2_server: grant all 8192 credits to clients

This seems to match Windows Server 2016.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13863

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agovfs_default: fix vfswrap_offload_write_send() NT_STATUS_INVALID_VIEW_SIZE check
Stefan Metzmacher [Tue, 31 Jul 2018 10:29:29 +0000 (12:29 +0200)]
vfs_default: fix vfswrap_offload_write_send() NT_STATUS_INVALID_VIEW_SIZE check

This fixes a regression introduced in commit
60e45a2d25401eaf9a15a86d19114670ccfde259, where the 'num' variable
was renamed to 'to_copy', but a new 'num' variable was introduced.

Note that off_t is signed!
In future we need to watch out for filesystems supporting
FMODE_UNSIGNED_OFFSET on Linux. Which means they use it unsigned.

This is more or less a theoretical problem, The
NT_STATUS_INVALID_PARAMETER cases are catched before by
SMB_VFS_PREAD_SEND/RECV.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13862

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agovfs_default: fix DEBUG messages in vfswrap_offload_write_*_done()
Stefan Metzmacher [Wed, 27 Mar 2019 11:43:32 +0000 (12:43 +0100)]
vfs_default: fix DEBUG messages in vfswrap_offload_write_*_done()

SMB_VFS_{PREAD,PWRITE}_RECV() don't set errno, so we need to
use strerror(aio_state.error) in the debug messages.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13862

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agosmb2_tcon: avoid STATUS_PENDING completely on tdis
Stefan Metzmacher [Tue, 12 Feb 2019 07:27:43 +0000 (08:27 +0100)]
smb2_tcon: avoid STATUS_PENDING completely on tdis

BUG: https://bugzilla.samba.org/show_bug.cgi?id=10344
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13698

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agosmb2_sesssetup: avoid STATUS_PENDING completely on session logoff
Stefan Metzmacher [Tue, 12 Feb 2019 07:27:43 +0000 (08:27 +0100)]
smb2_sesssetup: avoid STATUS_PENDING completely on session logoff

BUG: https://bugzilla.samba.org/show_bug.cgi?id=10344
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13698

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agosmb2_tcon: avoid STATUS_PENDING responses for tree connect
Stefan Metzmacher [Thu, 24 Jan 2019 08:10:11 +0000 (09:10 +0100)]
smb2_tcon: avoid STATUS_PENDING responses for tree connect

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12844
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13698

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agosmb2_sesssetup: avoid STATUS_PENDING responses for session setup
Stefan Metzmacher [Thu, 24 Jan 2019 08:10:11 +0000 (09:10 +0100)]
smb2_sesssetup: avoid STATUS_PENDING responses for session setup

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12845
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13698
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13796

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agosmb2_server: allow smbd_smb2_request_pending_queue(0) to avoid STATUS_PENDING
Stefan Metzmacher [Tue, 12 Feb 2019 07:08:38 +0000 (08:08 +0100)]
smb2_server: allow smbd_smb2_request_pending_queue(0) to avoid STATUS_PENDING

This has the same meaning as smb2_request_set_async_internal(),
but this will simplifies callers.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13698
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13796

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agosmb2_ioctl_network_fs: remove unused fsctl_srv_copychunk_state->aapl_copyfile
Stefan Metzmacher [Tue, 31 Jul 2018 10:29:29 +0000 (12:29 +0200)]
smb2_ioctl_network_fs: remove unused fsctl_srv_copychunk_state->aapl_copyfile

This is not used since commit 74e018f476608429caa1c3594102485ccc17afce.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos3:smbd: handle IO_REPARSE_TAG_DFS in SMB_FIND_FILE_FULL_DIRECTORY_INFO
Stefan Metzmacher [Mon, 9 Oct 2017 10:06:29 +0000 (12:06 +0200)]
s3:smbd: handle IO_REPARSE_TAG_DFS in SMB_FIND_FILE_FULL_DIRECTORY_INFO

This completes commit 74829fecd7a4e806ee441cd75141bede2eefef1a,
which missed SMB_FIND_FILE_FULL_DIRECTORY_INFO

BUG: https://bugzilla.samba.org/show_bug.cgi?id=10097

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos3:smbd: fix SAFE_FREE() vs. TALLOC_FREE() in list_sessions()
Stefan Metzmacher [Tue, 28 Nov 2017 07:16:03 +0000 (08:16 +0100)]
s3:smbd: fix SAFE_FREE() vs. TALLOC_FREE() in list_sessions()

It's very unlikely that sessionid_traverse_read() fails,
but we should not segfault.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos3:smb2_write: add missing initialization of state->in_offset
Stefan Metzmacher [Thu, 5 Oct 2017 13:59:23 +0000 (15:59 +0200)]
s3:smb2_write: add missing initialization of state->in_offset

This is just used in DEBUG messages, but still confusing.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 years agos4:torture/smb2: test_notify_tcp_dis trigger idle event every 0.25s
Stefan Metzmacher [Sun, 17 Feb 2013 21:45:32 +0000 (22:45 +0100)]
s4:torture/smb2: test_notify_tcp_dis trigger idle event every 0.25s

This is 1000 times longer than before and is less likely to
change the timing behavior when running under valgrind.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 years agos4:torture/raw: test_notify_tcp_dis trigger idle event every 0.25s
Stefan Metzmacher [Sun, 17 Feb 2013 21:43:49 +0000 (22:43 +0100)]
s4:torture/raw: test_notify_tcp_dis trigger idle event every 0.25s

This is 1000 times longer than before and is less likely to
change the timing behavior when running under valgrind.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:libcli/smb2: don't schedule idle handlers on a dead connection
Stefan Metzmacher [Sun, 17 Feb 2013 21:41:00 +0000 (22:41 +0100)]
s4:libcli/smb2: don't schedule idle handlers on a dead connection

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:libcli/raw: don't schedule idle handlers on a dead connection
Stefan Metzmacher [Sun, 17 Feb 2013 21:39:40 +0000 (22:39 +0100)]
s4:libcli/raw: don't schedule idle handlers on a dead connection

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agovfs_snapper: drop unneeded fstat handler
David Disseldorp [Mon, 25 Mar 2019 17:06:15 +0000 (18:06 +0100)]
vfs_snapper: drop unneeded fstat handler

fstat is handle based, and unlike vfs_shadow_copy2, we don't need to
make any changes to the returned sbuf, so remove the existing handler
which does nothing.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13858

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Mar 27 18:21:38 UTC 2019 on sn-devel-144

5 years agos3:tests: Add test for smbstatus and smbstatus --resolve_uids
Andreas Schneider [Wed, 13 Mar 2019 11:00:27 +0000 (12:00 +0100)]
s3:tests: Add test for smbstatus and smbstatus --resolve_uids

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13793

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Mar 27 14:33:35 UTC 2019 on sn-devel-144

5 years agoselftest: Add smbstatus to testhelper
Andreas Schneider [Wed, 13 Mar 2019 11:00:11 +0000 (12:00 +0100)]
selftest: Add smbstatus to testhelper

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13793

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agos3:utils: Add 'smbstatus -L --resolve-uids' to show usernames
Andreas Schneider [Mon, 18 Feb 2019 13:11:32 +0000 (14:11 +0100)]
s3:utils: Add 'smbstatus -L --resolve-uids' to show usernames

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13793

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agos4/torture: Update winsreplication to only use IPv4 addresses
Tim Beale [Tue, 26 Mar 2019 05:06:16 +0000 (18:06 +1300)]
s4/torture: Update winsreplication to only use IPv4 addresses

This test was failing now that the client had an IPv6 address, however,
the test was marked as flapping so this failure wasn't obvious.

Use iface_list_n_is_v4() to filter out only the IPv4 addresses, as
that's all the test cares about.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agoselftest: Restore IPs 12-16 for selftest client
Tim Beale [Mon, 18 Mar 2019 04:55:39 +0000 (17:55 +1300)]
selftest: Restore IPs 12-16 for selftest client

The assumption that tests only used the .11 IP was wrong. The
winsreplication test tries to use multiple different IPs - CI doesn't
fail when we remove the additional IPs, but it starts to skip test
cases.

+ Update get_interfaces_config() and get_ipv4_addr() so we can add
multiple different IPs for the same host.
+ Update selftest.pl so the client gets 6 IP addresses.
+ Update comments to better reflect this dependency.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agolibsmb: Change cli_posix_readlink to return talloc'ed target
Volker Lendecke [Tue, 26 Mar 2019 08:48:16 +0000 (09:48 +0100)]
libsmb: Change cli_posix_readlink to return talloc'ed target

This is a deviation from the Posix readlink function that from my
point of view makes this function easier to use. In Posix, probably
the assumption is that readlink is cheap, so someone under memory
constraints could just start with a small buffer and incrementally
increase the buffer size. For us, it's a network round-trip, and we
have the luxury of [mt]alloc, which the syscall kernel interface does
not have.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Mar 27 12:31:37 UTC 2019 on sn-devel-144

5 years agolibsmb: Don't pass "cli" to cli_posix_readlink_recv
Volker Lendecke [Mon, 25 Mar 2019 11:32:07 +0000 (12:32 +0100)]
libsmb: Don't pass "cli" to cli_posix_readlink_recv

From my point of view the option to change "cli" between
cli_posix_readlink_send and _recv is not necessary.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agolibsmb: Rename "readlink_state" to "cli_posix_readlink_state"
Volker Lendecke [Mon, 25 Mar 2019 11:26:37 +0000 (12:26 +0100)]
libsmb: Rename "readlink_state" to "cli_posix_readlink_state"

This is more in line with most other users of tevent_req: The state is
called fully after the routines it acts as a state repository for.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>