1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
Commit Graph

378 Commits

Author SHA1 Message Date
Kamen Mazdrashki
8e10c10bd6 s4-dsdb-util: Mark attributes with ADD flag in samdb_find_or_add_attribute()
At the moment no flags are set and it works fine, since this function
is solely used in samldb during ADD requests handling.
Pre-setting a flag make it usefull for other modules and request
handlers too

Change-Id: I7e43dcbe2a8f34e3b0ec16ae2db80ef436df8bfe
Signed-off-by: Kamen Mazdrashki <kamenim@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2015-02-03 05:02:11 +01:00
Andrew Bartlett
9d62b6764e CVE-2014-8143:dsdb: Allow use of dsdb_autotransaction_request outside util.c
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10993

Change-Id: If6bc90305a1e9a5a92562a01ba7e44330de91cc1
Pair-programmed-with: Garming Sam <garming@catalyst.net.nz>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2015-01-15 12:33:08 +01:00
Andrew Bartlett
bf0db7ecc9 dsdb: Do not attempt to return beyond the end of the password history array
Found by AddressSanitizer

Change-Id: I82e35aea60726053c79510ba8ed3eedfaf553eb7
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Matthieu Patou <mat@matws.net>

Autobuild-User(master): Matthieu Patou <mat@samba.org>
Autobuild-Date(master): Mon Oct 13 08:28:15 CEST 2014 on sn-devel-104
2014-10-13 08:28:14 +02:00
Andrew Bartlett
b6ade7d04b dsdb: Make log message more clear
Change-Id: Ibf3c55748e755d2f6dae57293bfde11cdf7ba3ae
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-By: Jelmer Vernooij <jelmer@samba.org>
2014-09-01 00:36:42 +02:00
Andrew Bartlett
d7b4d10aba dsdb: Always store and return the userParameters as a array of LE 16-bit values
This is not allowed to be odd length, as otherwise we can not send it over the SAMR transport correctly.

Allocating one byte less memory than required causes malloc() heap corruption
and then a crash or lockup of the SAMR server.

Andrew Bartlett

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10130
Change-Id: I5c0c531c1d660141e07f884a4789ebe11c1716f6
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2014-07-09 08:42:08 +02:00
Andrew Bartlett
05c2f83f26 dsdb: Allow SAMR server to return the computed, not actual badPwdCount
This matters after the lockout observation period has expired.

Note: that QueryUserInfo level 3 returns the raw badPwdCount value.

Andrew Bartlett

Change-Id: I7b304a50984072bc6cb1daf3315b4427443632a9
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-04-02 17:12:47 +02:00
Andrew Bartlett
afdd5fbd51 dsdb: check type with talloc_get_type_abort in samdb_set_password
Change-Id: Ie5b534c70dd87ecf58d6a830e38750ecf16eb855
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-04-02 17:12:47 +02:00
Andrew Bartlett
8a89f7f4bc dsdb: Move dsdb_update_bad_pwd_count to dsdb/common/util.c
This allows the password_hash code to call the same update routine.

Andrew Bartlett

Change-Id: I3d954469defa3f5d26ffc5ae0583ec7e1957ea11
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-04-02 17:12:47 +02:00
Andrew Bartlett
2dd71de11a dsdb: Add samdb_result_passwords_from_history helper function
Change-Id: I949c6c64551f68c4381b41b30120874ead82949e
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-04-02 17:12:47 +02:00
Andrew Bartlett
526f98308a dsdb: give a better error message and return code on failed password change
Change-Id: I064a7e192caccbb5acc17ba385f1625425c176d1
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-04-02 17:12:46 +02:00
Andrew Bartlett
a0de929009 dsdb: Put password lockout support in samdb_result_passwords()
This seems to be the best choke point to check for locked out
accounts, as aside from the KDC, all the password authentication and
change callers use it.

Andrew Bartlett

Change-Id: I0f21a79697cb8b08ef639445bd05a896a2c9ee1b
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-04-02 17:12:46 +02:00
Andrew Bartlett
6f8fb163e0 dsdb: Rework samdb_result_acct_flags to use either userAccountControl or msDS-User-Account-Control-Computed
This allows us to avoid the domain lookup in the constructed attribute
when not required.

By using msDS-User-Account-Control-Computed the lockout and password
expiry checks are now handled in the operational ldb module.

Andrew Bartlett

Change-Id: I6eb94933e4602e2e50c2126062e9dfa83a46191b
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-04-02 17:12:46 +02:00
Andrew Bartlett
4022d8632c dsdb: Refuse to return an all-zero invocationID
This could cause an all-zero GUID to be entered into the
replPropertyMetaData, which will then fail to be replicated to other
DCs.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-09-19 12:27:50 -07:00
Andrew Bartlett
a623359fb8 python/drs: Ensure to pass in the local invocationID during the domain join
This ensures (and asserts) that we never write an all-zero GUID as an invocationID
to the database in replPropertyMetaData.

Andrew Bartlett

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-09-19 12:25:41 -07:00
Andrew Bartlett
e461ff5300 dsdb: Allow dsdb_find_dn_by_guid to show deleted DNs
This helps us in the KCC as we need to return the deleted DN for the GUID
in DsReplicaGetInfo calls (tested for deleted servers against Windows 2008R2).

Andrew Bartlett

Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-06-12 10:02:07 +02:00
Stefan Metzmacher
e5ca813ffb dsdb/util: rework samdb_check_password() to support utf8
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2013-02-04 17:14:22 +01:00
Stefan Metzmacher
e7a26d0241 s4:dsdb/common: use 01.01.1970 as last_sync_success for our entry in the uptodatevector
This matches a Windows 2008R2 and 2012 server.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-01-01 19:28:06 +01:00
Stefan Metzmacher
81fa179b15 s4:dsdb/common: use LDB_SEQ_HIGHEST_SEQ for our entry in the uptodatevector
We should use the global highestCommittedUSN, not the per partition value.

This matches a Windows 2008R2 and 2012 server.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-01-01 19:28:06 +01:00
Stefan Metzmacher
7c6b10fbb0 s4:dsdb/common: only pass the DSDB_CONTROL_PASSWORD_HASH_VALUES_OID if required
This should give the password_hash module a chance to detect if the called
was the cleartext password or not.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2012-12-11 13:59:59 +01:00
Jelmer Vernooij
ed6330094b dsdb: Rename _res argument to _result.
Newer versions of heimdal include a macro that is unfortunately named
'_res'. This change prevents the clash.

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2012-11-06 13:33:09 +11:00
Andrew Bartlett
4d7dad1315 s4-dsdb: Remove unused variables
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Sat Sep  1 05:10:47 CEST 2012 on sn-devel-104
2012-09-01 05:10:47 +02:00
Andrew Bartlett
01ade93c7c s4-dsdb: Remove unused tmp_ctx leaked onto long-term ldb_context
This was found based on a log provided by Ricky Nance
<ricky.nance@weaubleau.k12.mo.us>.  Thanks Ricky!

Andrew Bartlett
2012-09-01 03:33:20 +02:00
Andrew Bartlett
108c8b758a s4-dsdb: Use samdb_dn_is_our_ntdsa()
This uses a GUID based comparison, and avoids re-fetching the
samdb_ntds_settings_dn each time.

Andrew Bartlett
2012-08-14 15:37:22 +02:00
Andrew Bartlett
d582e1bef6 s4-dsdb: Add samdb_dn_is_our_ntdsa()
This is like samdb_reference_dn_is_our_ntdsa but without the attribute de-reference.

Andrew Bartlett
2012-08-14 15:37:22 +02:00
Andrew Bartlett
773d0367a6 s4-dsdb: Use samdb_reference_dn_is_our_ntdsa() 2012-08-14 15:37:22 +02:00
Andrew Bartlett
1e127b270c s4-dsdb: Add helper function samdb_reference_dn_is_our_ntdsa()
We often want to know if we own an FSMO role (for example).  This tries to be more
efficient by comparing the GUID, rather than the string DN, as this does not need
to be re-fetched each time.

Andrew Bartlett
2012-08-14 15:37:22 +02:00
Andrew Bartlett
3c8d8f206b s4-dsdb: Use ldb_dn_copy() rather than talloc_reference()
As the normal case (outside provision) uses a copy, this avoids a case
where a caller might modify a global variable accidentily.

As suggested by metze.

Andrew Bartlett
2012-08-14 15:37:22 +02:00
Andrew Bartlett
fd0394d85d s4-libnet: Improve debugging of libnet_BecomeDC LDAP errors 2012-08-14 15:37:22 +02:00
Andrew Bartlett
9566786853 s4-dsdb: Add mem_ctx argument to samdb_ntds_settings_dn
As this value is calculated new each time, we need to give it a context to live on.

If the value is the forced value during provision, a reference is taken.

This was responsible for the memory leak in the replication process.  In the
example I was given, this DN appeared in memory 13596 times!

Andrew Bartlett

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Tue Aug 14 10:05:14 CEST 2012 on sn-devel-104
2012-08-14 10:05:14 +02:00
Andrew Bartlett
f74e7b5606 s4-dsdb: Add const 2012-08-14 08:27:19 +02:00
Andrew Bartlett
6f71878263 s4-dsdb when setting DSDB_CONTROL_PASSWORD_BYPASS_LAST_SET_OID make it non-critical 2012-06-27 11:29:17 +02:00
Matthias Dieter Wallnöfer
cd5d282a46 s4:dsdb/common/util.c - samdb_is_pdc() - fail if the "fSMORoleOwner" attribute has not been set 2012-04-29 19:06:52 +02:00
Jelmer Vernooij
d875327b10 Move NS_GUID_string and NS_GUID_from_string to dsdb-common. 2012-03-20 13:54:07 +01:00
Ricky Nance
2f7e715302 s4-lib: Remove unused samdb_msg_set_value()
Found by callcatcher.

Ricky Nance
2012-02-25 03:51:37 +01:00
Ricky Nance
8a22ccadd5 s4-lib: Remove unused samdb_msg_set_string()
Found by callcatcher.

Ricky Nance
2012-02-25 03:51:37 +01:00
Ricky Nance
b136687d1f s4-lib: Remove unused samdb_msg_set_int()
Found by callcatcher

Ricky Nance
2012-02-25 03:51:37 +01:00
Andrew Bartlett
1a9ee7cbd5 dsdb: Allow DSDB_CONTROL_PASSWORD_BYPASS_LAST_SET_OID to be specified as a flag 2012-01-24 18:36:49 +11:00
Matthias Dieter Wallnöfer
1b741b2bcc s4:dsdb/common/util.c - test LDB result against LDB_SUCCESS as we are always doing
Autobuild-User: Matthias Dieter Wallnöfer <mdw@samba.org>
Autobuild-Date: Fri Dec  9 12:00:03 CET 2011 on sn-devel-104
2011-12-09 12:00:03 +01:00
Amitay Isaacs
9318e00a1f dsdb: Fix the password expiry calculation
As per Section 3.1.1.4.5.26 [MS-ADTS.pdf], password is expired if

  pwdLastSet = null, or
  pwdLastSet = 0, or
  (maxPwdAge != 0x8000000000000000 and (ST - pwdLastSet) > maxPwdAge)
2011-11-18 14:38:28 +11:00
Andrew Tridgell
8905344bad s4-dsdb: fixed re-join of subdomain
if we repeat the join of a subdomain then we try to re-create the NC
for the subdomain during a DsAddEntry(). This allows that re-creation
to succeed if the NC already exists
2011-10-04 15:08:58 +11:00
Andrew Tridgell
278e44cf9f s4-dsdb: simplify samdb_is_gc()
we already have a function for returning the NTDS options
2011-10-04 15:08:57 +11:00
Andrew Tridgell
60cbc98051 s4-dsdb: added new control DSDB_MODIFY_PARTIAL_REPLICA
this control tells the partition module that the DN being created is a
partial replica, so it should modify the @PARTITION object to add the
partialReplica attribute

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-10-04 15:08:57 +11:00
Andrew Tridgell
00ef18f19c s4-dsdb: added NO_GLOBAL_CATALOG control
this control is used to ask samdb to not return searches with a basedn
in partial repica partitions, which is needed to support the
difference between a search on the 3268 GC ldap port and the non-GC
389 port
2011-09-22 10:00:48 +10:00
Andrew Tridgell
677600fb7f s4-dsdb: failing to find the object is not an error in dsdb_loadreps()
we may not have replicated the partition yet, so this should be
considered the same as having no repsFrom/repsTo
2011-09-22 10:00:48 +10:00
Andrew Tridgell
1e9573fe4d s4-dsdb: fixed compiler warning
sid can be const

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-09-08 03:35:27 +02:00
Andrew Tridgell
9784fbc378 s4-dsdb: added samdb_ntds_msdcs_dns_name()
this gets the DNS name for a NTDS GUID, based on the forest DNS name

Pair-Programmed-With: Amitay Isaacs <amitay@gmail.com>
2011-08-25 07:39:38 +10:00
Andrew Tridgell
9f404b3dea s4-dsdb: added samdb_dn_to_dns_domain()
this converts a DC into the equivalent DNS domain. It is used when
forming t_msdcs NTDS DNS names

Pair-Programmed-With: Amitay Isaacs <amitay@gmail.com>
2011-08-25 07:39:38 +10:00
Andrew Tridgell
bcbb35b088 s4-dsdb: assert that base DNs are used correctly
this will catch future programmer errors with incorrect base DNs

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-08-25 07:39:38 +10:00
Andrew Bartlett
c5e41a21dd s4-dsdb Add flag to set DSDB_BYPASS_PASSWORD_HASH control 2011-08-13 12:30:48 +10:00
Andrew Tridgell
fb490d88c1 s4-dsdb: don't cache the NTDS settings DN
this DN can change due to a server rename, so we cannot cache it. It
is set by provision, but not anywhere else.

This seems to not have a large performance impact

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-08-12 04:00:07 +02:00
Andrew Tridgell
fc40769b64 s4-dsdb: fixed a warning on dsdb_delete()
struct ldb_dn is never const

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-With: Amitay Isaacs <amitay@gmail.com>
2011-08-04 16:17:24 +10:00
Andrew Tridgell
d10553a51c s4-dsdb: make requests for STORAGE_FORMAT control non-critical
this allows us to use dsdb_module_dn_by_guid() from levels below the
extended_dn_out module

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-With: Amitay Isaacs <amitay@gmail.com>
2011-08-04 16:17:24 +10:00
Andrew Tridgell
114377a91f s4-dsdb: added dsdb_delete() function
this gives us a delete function that takes the standard set of dsdb
flags

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-07-21 11:44:36 +10:00
Dave Craft
0d1c54ecaf Standalone samdb_ntds_site_settings_options() helper
A helper function for retrieving the ntds site settings
via standalone function call.  Used within KCC

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-14 07:05:09 +10:00
Andrew Tridgell
3e4c08096d s4-drs: cope with missing RMD_ADDTIME in linked attributes
upgraded links can be missing the RMD_ADDTIME field
2011-06-10 10:14:56 +10:00
Andrew Tridgell
b96389d3e1 s4-socket: rename allow_access() to socket_allow_access()
this prevents a symbol collision with s3

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-05-03 07:37:07 +02:00
Andrew Tridgell
81f2dda626 s4-dsdb: added a ldb err -> NTSTATUS mapping
this is not perfect, but its better than always giving
NT_STATUS_UNSUCCESSFUL in our RPC servers

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-04-04 10:30:30 +10:00
Matthias Dieter Wallnöfer
ea12adf544 s4/ldb - remove now superflous "ldb_dn_validate" checks
If we immediately afterwards perform an LDB base operation then we don't
need an explicit "ldb_dn_validate" check anymore (only OOM makes sense).

Reviewed by: Tridge
2011-03-04 22:07:24 +01:00
Matthias Dieter Wallnöfer
0e68867b26 s4:dsdb - always handle the attribute "options" as 32bit unsigned integer
It is defined as LDAP syntax 2.5.5.9 so no need at all to treat it as
64-bit integer.

Reviewed by: Kamenim and Metze

Autobuild-User: Matthias Dieter Wallnöfer <mdw@samba.org>
Autobuild-Date: Tue Mar  1 12:46:15 CET 2011 on sn-devel-104
2011-03-01 12:46:15 +01:00
Matthias Dieter Wallnöfer
47369370a1 s4:dsdb/common/util.c - remove "samdb_find_or_add_value"
This isn't used anymore.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2011-03-01 06:29:03 +01:00
Matthias Dieter Wallnöfer
c807911bf7 s4:dsdb/common/util.c - fully remove "samdb_msg_add_string"
This isn't needed anymore and will be substituted by
"ldb_msg_add_string".

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2011-03-01 06:29:03 +01:00
Matthias Dieter Wallnöfer
c66780332b s4:remove many invocations of "samdb_msg_add_string"
This call can be substituted by "ldb_msg_add_string". We only need to be
careful on local objects or talloc'ed ones which live shorter than the message.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2011-03-01 06:29:03 +01:00
Jelmer Vernooij
59a077d8f5 Fix some types
Autobuild-User: Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date: Mon Feb 28 23:30:06 CET 2011 on sn-devel-104
2011-02-28 23:30:06 +01:00
Kamen Mazdrashki
561205b016 s4/dsdb-util: Use DS_NTDSDSA_OPT_IS_GC flag definition
Autobuild-User: Kamen Mazdrashki <kamenim@samba.org>
Autobuild-Date: Sun Feb 27 00:10:45 CET 2011 on sn-devel-104
2011-02-27 00:10:44 +01:00
Andrew Tridgell
94c04b10db build: moved libds/common/flag_mapping.c into a common subsystem
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-02-24 11:57:48 +11:00
Matthias Dieter Wallnöfer
93d96414be s4:dsdb_find_nc_root - fix it up to let the provisioning work correctly
Use the temporary list unless we have at least the three main
"namingContexts" from the rootDSE available (Default, Configuration, Schema -
these are mandatory on all AD deployments!).

This bug has been discovered by Nadya in relation with her SD work.

Autobuild-User: Matthias Dieter Wallnöfer <mdw@samba.org>
Autobuild-Date: Sat Jan 15 19:01:11 CET 2011 on sn-devel-104
2011-01-15 19:01:11 +01:00
Nadezhda Ivanova
9aaacee6cd s4-dsdb: Added a helper function to get the default dns domain as string. 2010-12-22 12:29:14 +02:00
Matthias Dieter Wallnöfer
32bae10512 s4:dsdb/common/util.c - remove unused variable "ndr_err" 2010-12-21 15:10:37 +11:00
Andrew Bartlett
eda1972b68 s4-dsdb Use sid_blob_parse() 2010-12-16 15:54:36 +11:00
Matthias Dieter Wallnöfer
8742faf19f s4:dsdb/common/util.c - "samdb_msg_add_add/delval" - introduce also here the better memory context
"msg->elements" fits better than "msg".
2010-12-01 16:30:08 +01:00
Matthias Dieter Wallnöfer
7cc2f98038 s4:"dsdb_find_nc_root" - let it work also when the "namingContexts" attribute isn't available yet
This is needed on provisioning when the modules aren't set up yet.
2010-11-16 15:25:13 +01:00
Matthias Dieter Wallnöfer
feb00fe7cc s4:dsdb - proof against empty RDN values where expected
This should prevent crashes as pointed out on the mailing list.
2010-11-11 10:03:40 +01:00
Matthias Dieter Wallnöfer
d6c78fbd3a s4:password_hash LDB module - move "samdb_msg_find_old_and_new_ldb_val" into the password_hash LDB module
It's only used there and so I think it doesn't really belong in
"dsdb/common/util.c" (I first thought that it could be useful for ACL checking
but obviously it wasn't).
2010-11-11 10:03:39 +01:00
Stefan Metzmacher
0e3a13f8cc s4:dsdb/common: create a DSDB_SECRET_ATTRIBUTES define with all secret attributes
We should have them just in one place, so that we don't forget some of them.

metze
2010-11-09 22:25:51 +01:00
Matthias Dieter Wallnöfer
9154d4dcfc s4:samdb_msg_find_old_and_new_ldb_val - rework
- don't crash when no values where specified
- return ERR_CONSTRAINT_VIOLATION on malformed messages
- only check for flags when we are involved in a LDB modify operation
2010-11-08 11:27:03 +00:00
Stefan Metzmacher
a94fbb9ed5 s4:dsdb/common: fix memory leak in samdb_ntds_settings_dn()
fetch and set should use the same name!

metze
2010-11-04 17:13:01 +01:00
Matthias Dieter Wallnöfer
45cd2e445d s4:samr RPC server - remove wrong implementation of ReplicaSourceNodeName
This should represent a replication partner - never the DC iself
2010-10-29 09:55:18 +00:00
Matthias Dieter Wallnöfer
6fb64b9c7a s4:"samdb_search_count" - introduce a "mem_ctx" parameter
All other "samdb_search_*" calls do have one - why "samdb_search_count" doesn't?

Autobuild-User: Matthias Dieter Wallnöfer <mdw@samba.org>
Autobuild-Date: Mon Oct 25 17:42:33 UTC 2010 on sn-devel-104
2010-10-25 17:42:33 +00:00
Matthias Dieter Wallnöfer
fd7943bc80 ldb:gendb_* calls: support a "NULL" resultset parameter
This is useful for "samdb_search_count" where only the amount of entries
matters.
2010-10-25 18:58:20 +02:00
Matthias Dieter Wallnöfer
f9a6ff482c s4/ldb:introduce the LDB_CONTROL_PROVISION_OID control
This control is exactly thought for the actions which previously were performed
using the RELAX one.

We agreed that the RELAX control will only remain for interactions with OpenLDAP.
2010-10-23 16:37:29 +02:00
Andrew Bartlett
5650e8558e s4-dsdb Allow LDB_ERR_INVALID_DN_SYNTAX in dsdb_load_partition_usn
This will happen on an OpenLDAP backend, because @ records are invalid in LDAP.

We don't have these sequence numbers in this case.

Andrew Bartlett
2010-10-19 22:34:58 +11:00
Matthias Dieter Wallnöfer
a3f61dea40 Revert "s4:remove "util_ldb" submodule and integrate the three gendb_* calls in "dsdb/common/util.c""
This reverts commit 8a2ce5c47c.

Jelmer pointed out that these are also in use by other LDB databases - not only
SAMDB ones.

Autobuild-User: Matthias Dieter Wallnöfer <mdw@samba.org>
Autobuild-Date: Sun Oct 17 13:37:16 UTC 2010 on sn-devel-104
2010-10-17 13:37:16 +00:00
Matthias Dieter Wallnöfer
8a2ce5c47c s4:remove "util_ldb" submodule and integrate the three gendb_* calls in "dsdb/common/util.c"
They're only in use by SAMDB code.

Autobuild-User: Matthias Dieter Wallnöfer <mdw@samba.org>
Autobuild-Date: Sun Oct 17 09:40:13 UTC 2010 on sn-devel-104
2010-10-17 09:40:13 +00:00
Matthias Dieter Wallnöfer
a72ffb0d01 s4:dsdb/common/util.c - describe the behaviour of the functions "samdb_msg_add_uint", "samdb_msg_add_uint64" and "samdb_msg_set_uint" a bit more
Unsigned int data in AD is a bit problematic to handle. Problem described by
abartlet.
2010-10-16 10:42:21 +02:00
Matthias Dieter Wallnöfer
10e1de3e06 s4:samdb_msg_add_int* - use "ldb_msg_add_string" rather than "samdb_msg_add_string"
"ldb_msg_add_string" is safe here since the integer has already been converted
to a string which is "talloc"ed on "mem_ctx".

Autobuild-User: Matthias Dieter Wallnöfer <mdw@samba.org>
Autobuild-Date: Fri Oct 15 09:11:49 UTC 2010 on sn-devel-104
2010-10-15 09:11:49 +00:00
Matthias Dieter Wallnöfer
9310da1e2b s4:samdb_create_foreign_security_principal - proof error code of "samdb_msg_add_string" 2010-10-15 08:45:14 +02:00
Matthias Dieter Wallnöfer
9e69b22e70 s4:dsdb/common/util.c - samdb_msg_add_* calls - proof for more OOM conditions 2010-10-15 08:45:14 +02:00
Matthias Dieter Wallnöfer
06ec5d0177 s4:dsdb/common/util.c - samdb_msg_add_string - the attribute name doesn't need to be duplicated
This is done internally by the LDB library - look at "ldb_msg_add_empty".
2010-10-15 08:45:01 +02:00
Matthias Dieter Wallnöfer
9bc57e19e6 s4:dsdb - remove "samdb_msg_add_value"
This can be substituted by "ldb_msg_add_value".

Signed-off-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Fri Oct 15 00:21:53 UTC 2010 on sn-devel-104
2010-10-15 00:21:53 +00:00
Matthias Dieter Wallnöfer
a0e9814c0d s4:dsdb - remove "samdb_result_uint", "samdb_result_int64", "samdb_result_uint64" and "samdb_result_string"
We have ldb_msg_find_attr_as_* calls which do exactly the same. Therefore this
reduces only code redundancies.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2010-10-15 08:36:01 +11:00
Jelmer Vernooij
33c4b85058 dsdb: Move attr_in_list to SAMDB_COMMON to avoid circular dependency between SAMDB_COMMON and DSDB_MODULE_HELPERS. 2010-10-10 23:39:47 +02:00
Matthias Dieter Wallnöfer
c9da3122c8 s4:dsdb/common/util.c - provide message set functions for integer types
They will be used by the samldb LDB module
2010-10-07 08:59:28 +02:00
Matthias Dieter Wallnöfer
6320cface9 s4:dsdb/common/util.c - change the usage of the RECYCLED control
Use it only in conjunction with the DELETE one to allow the functions to work
also against Windows < 2008R2. This is really important for the vampire
operation.

Also mark the RECYCLED control as non-critical (so that it's simply ignored by
older Windows'es).

Autobuild-User: Matthias Dieter Wallnöfer <mdw@samba.org>
Autobuild-Date: Mon Oct  4 16:10:11 UTC 2010 on sn-devel-104
2010-10-04 16:10:11 +00:00
Matthias Dieter Wallnöfer
e3081b92c1 s4:dsdb - substitute the "show_deleted" with the "show_recycled" control
We intend to see always all objects with the "show_deleted" control specified.
To see also recycled objects (beginning with 2008_R2 function level) we need to
use the new "show_recycled" control.

As far as I see this is only internal code and therefore we don't run into
problems if we do substitute it.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2010-10-03 15:23:18 +00:00
Matthias Dieter Wallnöfer
46282da011 s4:dsdb/common/util.c - introduce "DSDB_SEARCH_SHOW_RECYCLED" flag
This is needed since starting with 2008_R2 function level we get another type
of hidden objects which aren't seen by the "show_deleted" control: recycled
objects.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2010-10-03 15:23:18 +00:00
Matthias Dieter Wallnöfer
64be07bc70 s4:dsdb_dn_val_rmd_flags - memmem - scan the whole string for occourences
Do this as in "dsdb_dn_is_upgraded_link_val". There is really no reason to
truncate before search.

Autobuild-User: Matthias Dieter Wallnöfer <mdw@samba.org>
Autobuild-Date: Sun Oct  3 10:45:39 UTC 2010 on sn-devel-104
2010-10-03 10:45:39 +00:00
Andrew Tridgell
ee15dc9692 s4-dsdb: added dsdb_search_by_dn_guid()
this is more efficient than first searching for the DN, then doing a
search. We should look at using this in lots of existing code

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2010-10-01 21:09:51 -07:00
Andrew Tridgell
57f67701a6 s4-dsdb: silence the domainFunctionality not setup warning 2010-09-30 14:36:11 -07:00
Andrew Bartlett
88abf441d0 s4-dsdb Add ldb_reset_err_string() when we set error codes.
If we don't we could show an old, incrorrect error
2010-09-29 04:23:07 +10:00
Andrew Bartlett
063b61289d s4-dsdb Make samdb_reference_dn() use dsdb_search() and DSDB_SEARCH_ONE_ONLY
This simplifies the function.  While doing so, also change the error
string setting to set a really clear error string for the failure to find
and failure to parse cases.

Andrew Bartlett
2010-09-29 04:23:07 +10:00
Andrew Tridgell
e313667983 s4-dsdb: added samdb_find_site_for_computer() and samdb_find_ntdsguid_for_computer()
these will be used by the new RODC dns update code

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2010-09-27 22:55:04 -07:00
Nadezhda Ivanova
4d3f528411 s4-dsdb: A helper to determine if an attribute is part of the search filter 2010-09-26 15:36:09 -07:00
Anatoliy Atanasov
b4eba4268d s4/dcdiag: Handle ListRoles command for dcdiag:KnowsOfRoleHolders test 2010-09-20 09:46:10 -07:00
Anatoliy Atanasov
7250cb3e73 s4/fsmo: Create separate function for retrieving fsmo role dn and owner dn.
This functionality is needed for DsCrackNames ListRoles command also.
2010-09-20 09:44:19 -07:00
Matthias Dieter Wallnöfer
6e720ecd25 s4:SID handling - always encode the SID using "ldap_encode_ndr_dom_sid" for LDAP filters
This makes also lookups through special backends as "samba3sam" work.
2010-09-13 22:41:06 +02:00
Matthias Dieter Wallnöfer
a4b7fac86d s4:cosmetic - the SID attribute is called objectSid - not objectSID 2010-09-13 22:39:50 +02:00
Matthieu Patou
42dfa71ef5 dsdb: make the ATTRIBUTE NOT FOUND more clear 2010-09-05 12:29:20 +04:00
Andrew Tridgell
6eb34e6907 s4-dsdb: fixed dsdb_get_extended_dn_sid()
it should honor the component_name

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2010-08-20 20:34:11 +10:00
Andrew Tridgell
c122939919 s4-drs: implement RODC attribute filtering override
When a RODC uses extended getncchanges operation
DRSUAPI_EXOP_REPL_SECRET it gets an override on the ability to
replicate the secret attributes.

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2010-08-20 20:34:11 +10:00
Matthias Dieter Wallnöfer
eb345ebedf s4:samdb_set_password/samdb_set_password_sid - make more arguments "const" 2010-08-17 18:45:33 +02:00
Matthias Dieter Wallnöfer
d72d7f9c5f s4:samdb_set_password/samdb_set_password_sid - make the adaptions to support the password change control
And introduce parameters to pass the old password hashes.
2010-08-17 18:45:33 +02:00
Matthias Dieter Wallnöfer
bbb9dc806e s4:DSDB - rename the "DSDB_CONTROL_PASSWORD_CHANGE_OLD_PW_CHECKED_OID"
Rename it to "DSDB_CONTROL_PASSWORD_CHANGE_OID". This control will afterwards
contain a record with the specified old password as NT and/or LM hash.
2010-08-17 18:45:32 +02:00
Andrew Tridgell
6baa834ebe s4-ldb: use LDB_FLAG_MOD_TYPE() to extract element type from messages
The flags field of message elements is part of a set of flags. We had
LDB_FLAG_MOD_MASK for extracting the type, but it was only rarely
being used (only 1 call used it correctly). This adds
LDB_FLAG_MOD_MASK() to make it more obvious what is going on.

This will allow us to use some of the other flags bits for internal
markers on elements

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2010-08-17 21:21:50 +10:00
Matthias Dieter Wallnöfer
dadcc84009 s4:samdb_set_password_sid - fix comment
Add more possible result NTSTATUS codes
2010-08-16 18:45:26 +02:00
Matthias Dieter Wallnöfer
1fc3676974 s4:samdb_set_password - fix formatting
(Sorry, I've overseen this)
2010-08-15 19:45:29 +02:00
Matthias Dieter Wallnöfer
3fcd76237d s4:samdb_set_password - implement the extended LDAP error code detection 2010-08-15 19:42:40 +02:00
Matthias Dieter Wallnöfer
07af3f289e s4:samdb_set_password - return "NT_STATUS_WRONG_PASSWORD" when a user account doesn't exist
This is for the (SAMR) account detection protection mechanism.
2010-08-14 18:48:20 +02:00
Matthias Dieter Wallnöfer
303089f5b8 s4:dsdb/common/util.c - provide a call which returns the forest function level
Sooner or later we'll need this too since not all operations depend only on the
current's domain function level (see the MS-ADTS docs).
2010-08-10 19:08:56 +02:00
Matthias Dieter Wallnöfer
e53fc1228f s4:dsdb/common/util.c - use LDB constants whenever possible 2010-08-10 19:08:56 +02:00
Matthias Dieter Wallnöfer
25e973d5db s4:dsdb/common/util.c - add a function "dsdb_add" 2010-08-07 14:22:41 +02:00
Andrew Tridgell
6b266b85cf s4-loadparm: 2nd half of lp_ to lpcfg_ conversion
this converts all callers that use the Samba4 loadparm lp_ calling
convention to use the lpcfg_ prefix.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2010-07-16 18:24:27 +10:00
Andrew Tridgell
87df785a68 s4-dsdb: use ldb_operr() in the dsdb code
this replaces "return LDB_ERR_OPERATIONS_ERROR" with "return ldb_operr(ldb)"
in places in the dsdb code where we don't already explicitly set an
error string. This should make is much easier to track down dsdb
module bugs that result in an operations error.
2010-07-07 20:14:55 +10:00
Matthias Dieter Wallnöfer
9c8135785a s4:dsdb - samdb_result_force_password_change - also when "pwdLastSet" is "-1" we shouldn't force a password change
This value is set by the ADUC console.
2010-07-06 21:54:20 +02:00
Nadezhda Ivanova
5a18fc2b2a Implementation of self membership validated right.
When this right is granted, the user can add or remove themselves from a group even
if they dont have write property right.
2010-06-28 10:43:50 +03:00
Matthias Dieter Wallnöfer
c38f94ed9b s4:dsdb_load_partition_usn - free the right memory context (tmp_ctx) 2010-06-21 11:10:02 +02:00
Matthias Dieter Wallnöfer
87d0f63632 s4:dsdb - add a new dsdb delete function which understands the tree delete control 2010-06-20 18:52:29 +02:00
Andrew Bartlett
8ea4118472 s4:dsdb Add const to dsdb_dn functions that operate on an ldb_val.
Andrew Bartlett
2010-06-15 10:53:50 +10:00
Matthias Dieter Wallnöfer
cadf774f8b s4:dsdb/common/util.c - provide a better implementation of the "samdb_msg_add_(add/del)val" calls
This supports now also coexisting add and delete message elements with the
same attribute name.
2010-06-06 20:47:10 +02:00
Matthias Dieter Wallnöfer
0fce829de4 s4:dsdb_load_udv_v1 - "uint32_t" counter type fits better than "unsigned int" 2010-05-31 22:43:28 +02:00
Matthias Dieter Wallnöfer
f927881028 s4:dsdb/common/util.c - fix a counter variable 2010-05-30 20:52:10 +02:00
Andrew Bartlett
e0d141bd46 s4:dsdb Allow a NULL search expression in dsdb_search()
The NULL search expression expands to (objectClass=*), but %s expands
NULL to (NULL) which doesn't parse...

Andrew Bartlett
2010-05-24 23:08:11 +10:00
Jelmer Vernooij
f9ca9e46ad Finish removal of iconv_convenience in public API's. 2010-05-18 11:45:30 +02:00
Anatoliy Atanasov
26d41c23f6 s4-rodc: Cache am_rodc flag 2010-05-17 13:30:27 +03:00
Stefan Metzmacher
11730520a7 s4:dsdb: fix samdb_result_logon_hours() and don't hardcode units_per_week
metze
2010-05-13 19:12:42 +02:00
Stefan Metzmacher
7e49fd92ca s4:dsdb: cached results of samdb_rodc()
metze
2010-05-11 18:11:06 +02:00
Matthias Dieter Wallnöfer
029351571a s4:samdb_set_password - adapt it for the user password change handling
Make use of the new "change old password checked" control.
2010-05-10 19:12:26 +02:00
Matthias Dieter Wallnöfer
6e8098b261 s4:samdb_set_password/samdb_set_password_sid - Rework
Adapt the two functions for the restructured "password_hash" module. This
means that basically all checks are now performed in the mentioned module.

An exception consists in the SAMR password change calls since they need very
precise NTSTATUS return codes on wrong constraints ("samr_password.c") file
2010-05-10 19:07:46 +02:00
Matthias Dieter Wallnöfer
946993238f s4:dsdb/util.c - Add a new function for retrieving password change attributes
This is needed since we have not only reset operations on password fields
(attributes marked with REPLACE flag) but also change operations which can be
performed by users itself. They have one attribute with the old value marked
with the REMOVE flag and one with the new one marked with the ADD flag.
This function helps to retrieve them (argument "new" is used for the new
password on both reset and change).
2010-05-10 12:20:27 +02:00
Andrew Bartlett
6dfa851ce9 s4:dsdb Provide an intelegent fallback if not CN=Subnets is found
We may as well fall back rather than return NULL (which callers don't
do useful things with).

Andrew Bartlett
2010-05-09 21:18:52 +10:00
Anatoliy Atanasov
f84aeea739 s4/rodc: Support read-only database
Check on modify if we are RODC and return referral.
On the ldap backend side now we pass context and ldb_modify_default_callback
to propagate the referral error to the client.
2010-05-04 18:32:18 +02:00
Anatoliy Atanasov
d3081741c9 s4/rodc: Implement msDS-isRODC constructed attr 2010-05-03 18:28:00 +02:00
Anatoliy Atanasov
dbbbc7d1f8 s4/rodc: RODC FAS initial implementation 2010-04-29 10:18:06 +03:00
Kamen Mazdrashki
bf49ac99c9 s4/dsdb: dsdb_validate_invocation_id() should validate by objectGUID
This function is used in DRSUpdateRefs() implementation where we
get DSA's objectGUID rather than invocationId
2010-04-28 12:11:03 +03:00
Stefan Metzmacher
4d191b6fa7 s4:dsdb/common: if we don't have the ip of the client return the server site as client site
metze
2010-04-27 13:00:24 +02:00
Matthias Dieter Wallnöfer
093d35661d s4:util - add a function which finds the matching client site using the client address
The lookup of the client site is done using the subnets in the configuration
partition. If no one matches we use the Windows Server fallback mechansim.
This means: if only one site is available just use it. If they're more set the
output variable to "".

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2010-04-27 15:24:41 +10:00
Andrew Tridgell
1f92df90fd s4-drs: removed dsdb_validate_client_flags()
This test is in the wrong place. We end up validating our own flags.

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2010-04-22 19:36:16 +10:00
Andrew Tridgell
a06b537cc3 s4-dsdb: added dsdb_validate_invocation_id()
this validates that a invocationID matches an account sid

This will be used to ensure that we don't allow DRS replication
from someone a non-DC or administrator

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2010-04-22 19:36:16 +10:00
Andrew Tridgell
1ecefd74a2 s4-dsdb: added dsdb_get_extended_dn_sid()
This will be used by the RODC code

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2010-04-22 19:36:15 +10:00
Fernando J V da Silva
73513fb7e7 s4-drs: Use new samdb_rodc() function in s4 code
This patch fits the calling to the new samdb_rodc() function and
fix a little bug in this function.

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2010-04-22 19:36:15 +10:00
Fernando J V da Silva
fbdbd67c76 s4-drs: dsdb_validate_client_flags() function
This function is intended to check if some client is not lying about
his flags. At this moment, it only checks for RODC flags.

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2010-04-22 19:36:15 +10:00