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

413 Commits

Author SHA1 Message Date
Andrew Bartlett
d1eac79690 s4-dsdb: Do not use a possibly-old loadparm context in schema reload
The loadparm context on the schema DB might have gone away already.
Pre-cache the schema refresh interval at load time to avoid worrying
about this.

Andrew Bartlett
2012-08-23 15:02:25 +02:00
Matthias Dieter Wallnöfer
5f8006cb64 s4:dsdb_sort_objectClass_attr - simplify memory context handling
Do only require the out memory context and build the temporary one in
the body of the function. This greatly simplifies the callers.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2012-08-22 01:31:55 +02:00
Matthias Dieter Wallnöfer
166a7d37f7 s4:dsdb_sort_objectClass_attr - use "data_blob_string_const" for setting values
As shown in commit c8e6d8b487 this looks easier and in any case we can
treat schema context data like global data.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2012-08-22 01:31:55 +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
0f2a87b547 s4-dsdb: Improve memory handling in dsdb_schema_from_ldb_results() by adding a tmp_ctx 2012-08-14 08:27:19 +02:00
Andrew Bartlett
2d21a9bf5e s4-dsdb: Use only the replication USN for schema reload.
This way we do not track both the partition seq number and the
replication USN for schema reload purposes.

We only need one indication of actual data change, and the replication
per-partition sequence number is no more expensive to obtain than the
ldb per-partition sequence number.

Andrew Bartlett
2012-08-11 12:53:42 +10:00
Andrew Bartlett
fdd07e87c6 s4-dsdb: Explain better what records are written during schema set
This is controlled by setting write_indices_and_attributes.

Andrew Bartlett
2012-08-10 10:18:28 +10:00
Matthieu Patou
2f3adc001e s4-schema: improve the documentation of the dsdb_schema structure 2012-06-22 23:42:08 -07:00
Matthieu Patou
718ed842ba s4-dsdb: Check for key SCHEMA_SEQ_NUM in metadata.tdb updates
If the value has changed then reload the schema, this means that now the
schema is only reloaded on a periodical basis or if we have been asked
explicitly to do it and not necesserly if the schema partition has
changed.
2012-06-22 23:42:08 -07:00
Matthieu Patou
9374ee1ba1 s4-schema: keep track of the timestamp of the most recently changed/created object 2012-06-22 23:22:03 -07:00
Matthieu Patou
2d20a918db s4-schema: generalized time use its own syntax now 2012-06-22 23:22:03 -07:00
Matthieu Patou
1521bb95a7 dsdb-schema: do not reload more often than schema_reload_interval
Samba 4 use to try to reload the schema every time dsdb_get_schema was
called (which could be 20+ time per ldb request). Now we only reload at
most every xx seconds (xx being the value of dsdb:"schema_reload_interval"
 or 120). The timestamp of the last reloaded schema is kept in the
 dsdb_schema object. There is also a timestamp in the ldb_context, that
 is used by the LDAP server to know if it has to reload the schema after
 handling the request. This is used to allow that the schema will be
 immediately reload after a schemaUpdateNow request has been issued, the
 reload can't occur in the handling of the LDAP request itself because
 we have a transaction autostarted.
2012-06-22 23:16:04 -07:00
Matthieu Patou
b019248fe8 Add some debug for FOOBAR return case as they are hard to diagnose
Autobuild-User: Matthieu Patou <mat@samba.org>
Autobuild-Date: Sun Apr 29 09:08:15 CEST 2012 on sn-devel-104
2012-04-29 09:08:15 +02:00
Matthieu Patou
167c6eb61e s4-schema: rename dsdb_attribute_from_ldb to dsdb_set_attribute_from_ldb and dsdb_class_from_ldb to dsdb_set_class_from_ldb 2012-04-18 00:06:59 +02:00
Matthias Dieter Wallnöfer
4eb0d42291 s4:dsdb - move "objectclass_sort()" out from the objectclass LDB module into the schema code
This allows it to be useful for the dbchecker utility in respect to
object class problems.
Fix up the API to only work with standardised LDB "ldb_message_element"
structures which do allow much easier interoperations. As a consequence this
leads to some changes in the objectclass module as well.
2012-04-11 12:50:16 +10:00
Matthias Dieter Wallnöfer
3d886e3e15 s4:schema/schema_query.c - fix a comment 2012-04-11 12:50:16 +10:00
Matthias Dieter Wallnöfer
35dfd79dca s4:schema/schema_init.c - better use "ldb_attr_cmp" instead of "strcasecmp"
LDB convention
2012-04-11 12:50:16 +10:00
Stefan Metzmacher
e7e9f1e2dd s4:dsdb/schema: add "dsdb:schema update allowed" option to enable schema updates
By default schema updates are not allowed anymore, as we don't have
complete validation code to prevent database corruption.

metze
2011-11-15 09:46:30 +01:00
Stefan Metzmacher
28d573168c s4:param/provision: pass schema_dn to provision_get_schema()
metze
2011-11-15 09:46:27 +01:00
Stefan Metzmacher
75ae19422b s4:dsdb/schema: pass and remember the schema_dn in dsdb_set_schema_from_ldif()
metze
2011-11-15 09:46:27 +01:00
Gregor Beck
85b145d745 s3:utils change data_blob_dup_talloc() to take a DATA_BLOB by value
Signed-off-by: Michael Adam <obnox@samba.org>
2011-10-12 22:45:53 +02:00
Andrew Tridgell
a729dbb269 s4-dsdb: fixed one_way_link calculation
we need to check for the other end of the link, not the current linkID

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-10-07 13:20:44 +11:00
Andrew Bartlett
1afeb4e391 s4-schema consolidate schema handling
It also creates a single routine dsdb_load_ldb_results_into_schema()
to handle cases where the schema is in the form of an ldb_result.

Andrew Bartlett
2011-09-05 11:19:25 +02:00
Andrew Tridgell
27656e9123 s4-dsdb: fixed calls to ldb_val_string_cmp()
wrong order of arguments
2011-08-25 07:39:38 +10:00
Andrew Bartlett
b206a365ea move schema_fill_constructed() call to dsdb_setup_sorted_accessors() 2011-08-09 11:56:23 +02:00
Andrew Bartlett
dee678a7be s4-dsdb Remove unused schema function 2011-08-09 11:56:23 +02:00
Andrew Tridgell
0e9cf380ea s4-dsdb: added SAMDB_INDEXING_VERSION to @INDEXLIST
this can be used to force re-indexing of samdb when we change
something that affects index comparison, in this case the
canonicalisation of booleans

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-08-09 11:56:23 +02:00
Andrew Tridgell
6853b3a805 s4-dsdb: fixed booling conversion to check value length
this ensures we don't look past the end of the data

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-08-09 11:56:23 +02:00
Andrew Tridgell
4ede333f46 s4-dsdb: add auto-normalisation of attributes
this auto-normalises some attributes when they are added/modified. The
list that we auto-normalise is currently:

Boolean
INT32
INTEGER
UTC_TIME

This fixes a problem with groupType being stored in an unnormalised
form

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-08-09 11:56:23 +02:00
Andrew Tridgell
55b25e1e23 s4-dsdb: ensure we setup the dn_format field in schema attributes
this ensures we setup dn_format when we do runtime schema changes

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-08-09 11:56:23 +02:00
Andrew Tridgell
d4a1f6a42b s4-dsdb: added dn_format attribute of a dsdb_attribute
this is faster than string comparisons during searches at runtime

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-With: Amitay Isaacs <amitay@gmail.com>
2011-08-04 16:17:25 +10:00
Andrew Tridgell
a74f4673ed s4-dsdb: setup a one_way_link attribute on schema attributes
this allows us to quickly determine if a DN is a one way link

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-With: Amitay Isaacs <amitay@gmail.com>
2011-08-04 16:17:24 +10:00
Matthieu Patou
930fa1ee46 update/add my copyright 2011-07-21 11:44:33 +10:00
Matthieu Patou
b1ffe82fac s4-schema: add systemFlags to dsdb classes objects 2011-07-21 11:44:33 +10:00
Andrew Tridgell
014fca1069 dsdb: fixed special case of zero NTTIME
we can't convert 0 NTTIME via a unix time_t

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-07-13 12:51:05 +02:00
Matthieu Patou
4d51ddbb5c s4-schema: avoid segfaulting if id3.guid is NULL 2011-06-22 20:13:08 +02:00
Andrew Tridgell
c46f80824b s4-dsdb: don't add zero GUID to BINARY_DN
When converting from DRS to ldb format for a BINARY_DN, don't add the
GUID extended DN element if the GUID is all zeros.

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-06-22 14:47:07 +10:00
Andrew Tridgell
4905725599 s4-dsdb: if we don't have a remote schema, then use the local one
this allows the use of drsuapi_to_ldb() on all attributes for the
local database
2011-06-17 12:32:55 +10:00
Matthias Dieter Wallnöfer
26c7223e72 s4:schema_convert_to_ol.c - fix memory contexts
- Add more "mem_ctx" free functions on error cases
- Steal the "out" string directly onto the LDB context to be able to free
  the local "mem_ctx"

Reviewed-by: Tridge
2011-06-09 10:53:36 +02:00
Matthias Dieter Wallnöfer
87a38d77ac s4:dsdb/schema_convert_to_ol.c - quiet enum warning
Introduce a error message when choosing wrong targets.

Reviewed-by: Tridge
2011-06-09 09:35:35 +02:00
Matthias Dieter Wallnöfer
ddb41f2af4 dsdb:schema/schema_syntax.c - correctly check error code of "ldb_string_utc_to_time"
This one doesn't set ERRNO. An error happens if the result is "0".

Reviewed-by: abartlet
2011-04-07 15:53:20 +02:00
Matthias Dieter Wallnöfer
6cef940b40 dsdb:schema/schema_syntax.c - add some empty value checks on validate functions
They are needed since the check in "ldb_msg_sanity_check" will be removed.

Reviewed-by: abartlet
2011-04-07 15:53:20 +02:00
Jeremy Allison
0c5214e2eb Ensure convert_string_XXX is always called with a valid converted_size pointer.
Preparation for cleaning up this API.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Tue Mar 29 21:01:49 CEST 2011 on sn-devel-104
2011-03-29 21:01:49 +02:00
Andrew Tridgell
15e84a9a09 charcnv: removed the allow_badcharcnv and allow_bad_conv options to convert_string*()
we shouldn't accept bad multi-byte strings, it just hides problems

Autobuild-User: Andrew Tridgell <tridge@samba.org>
Autobuild-Date: Thu Mar 24 01:47:26 CET 2011 on sn-devel-104
2011-03-24 01:47:26 +01:00
Andrew Tridgell
8dc92c8f71 ldb: use #include <ldb.h> for ldb
thi ensures we are using the header corresponding to the version of
ldb we're linking against. Otherwise we could use the system ldb for
link and the in-tree one for include

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-02-10 06:51:07 +01:00
Matthias Dieter Wallnöfer
912faf1b08 s4:dsdb/schema/schema_* - adaptions needed for removed "const" on OIDs 2010-12-21 15:10:37 +11:00
Kamen Mazdrashki
5bc0848fc7 s4-dsdb_schema: Copy info needed for Schema refresh in dsdb_schema_copy_shallow
Just 'refresh_fn' and 'loaded_from_module' are copied.
I left 'reload_seq_number' set to 0 intentionally, so that
this Schema cache will looks like a very old one to ,refresh_fn'.
This way, if this shallow copy is attached to LDB, it will be
refreshed as soon as possible by 'refresh_fn'.
2010-12-18 05:32:15 +02:00
Kamen Mazdrashki
dda73b85e6 s4-dsdb_schema: Handle remote ATTIDs based on msDs-IntId value
If we get such an msDs-IntId value, then we should just use it,
there is no mapping available for such values
2010-12-15 00:51:19 +01:00
Kamen Mazdrashki
52f7e38d6a s4-schema_syntax: Log error message when _dsdb_syntax_OID_oid_drsuapi_to_ldb() fails
I haven't found a way to test this function during replication so far,
but when I do, it will be useful to notice this error in the log file
2010-12-15 00:51:19 +01:00
Kamen Mazdrashki
2b74838c14 s4-dsdb_schema: We need base_dn in Schema's shallow copy too 2010-12-15 00:51:19 +01:00