1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-07 17:18:11 +03:00
Commit Graph

506 Commits

Author SHA1 Message Date
Matthias Dieter Wallnöfer
02eab66026 s4:schema_set.c - Fix a comment 2010-07-03 14:53:03 +02:00
Matthias Dieter Wallnöfer
d1ee7ab16e s4:dsdb_schema_set_attributes - remove unneeded filter criterias
We already choose the right entry by specifying the right basedn with scope
"LDB_SCOPE_BASE".
2010-07-03 14:53:02 +02:00
Matthias Dieter Wallnöfer
4df9757b48 s4:schema_set.c - fix typo 2010-07-03 12:36:34 +02:00
Anatoliy Atanasov
62341537d7 s4/schema: remove unnecessary deletion of dsdb_schema cached pointer
This is needed so we can find and free old schemas based using
the cached pointer
2010-07-02 11:55:33 +03:00
Andrew Bartlett
c48279896d s4:dsdb Ensure we free old schema copies
It was reported by aatanasov that we kept around one whole schema per
modification made.  This does not fix that, but I hope moves us closer
to a fix

The most important part of the fix is that:

-		if (schema_out != schema_in) {
-			talloc_unlink(schema_in, ldb);
-		}

was the wrong way around.  This is now handled in the schema_set calls.

Andrew Bartlett
2010-07-02 10:08:16 +10:00
Anatoliy Atanasov
6abfe8904a s4:schema/schema_set.c - free LDB message diffs
Especially the "free"s after "ldb_msg_diff" are very important since the diff
message is allocated on the long-living LDB context.

Signed-off-by: Matthias Dieter Wallnöfer <mdw@samba.org>
2010-06-30 09:17:44 +02:00
Andrew Bartlett
32b8b401d6 s4:dsdb Fix possible schema segfaults for DRS-replication based schema
The problem here is that if the schema has been modified on the source
domain, there may be attributes that appear over DRS with 0 values (to
indicate that any existing values on the target should be deleted).
This would confuse the previous version of this macro.

Andrew Bartlett
2010-06-30 10:22:59 +10:00
Kamen Mazdrashki
3aa8853f58 s4/dsdb: msg_idx->dn should be allocated in msg_idx mem context 2010-06-21 02:57:56 +03:00
Kamen Mazdrashki
cc7e2c10f2 s4/dsdb: Move schema accessors cleanup in separate function
This way dsdb_setup_sorted_accessors() will
free memory allocated for accessor arrays correctly
in case of failure,
2010-06-21 02:57:56 +03:00
Kamen Mazdrashki
267645ca55 s4/dsdb-schema: Index attributes on msDS-IntId value
O(n) search for dsdb_attribute by msDS-IntId value was
replaced by binary-search in ordered index.

I've choosen the approach of separate index on msDS-IntId values
as I think it is more clear what we are searching for.
And it should little bit faster as we can clearly determine
in which index to perform the search based on ATTID value -
ATTIDs based on prefixMap and ATTIDs based on msDS-IntId
are in separate ranges.

Other way to implement this index was to merge msDS-IntId values
in attributeID_id index.
This led me to a shorted but not so obvious implementation.
2010-06-21 02:57:55 +03:00
Andrew Bartlett
7c60ac97bf s4:provision Allow a specific prefix map to be loaded into a new schema provision
This allows the prefixMap from a DRS server to be used when loading
the schema from the local files.  This helps us then import other
schema with this map in place.

Andrew Bartlett

Signed-off-by: Kamen Mazdrashki <kamenim@samba.org>
2010-06-15 10:51:34 +10:00
Andrew Bartlett
5323485eb3 s4:dsdb Allow the setting an override on the schema
The change here is to try and convert a per the previous rules, but if
we don't know a particular OID as a attributeID, then store it as an
OID (for example).  This allows known values to be converted as
before, but still copes with unknown values.

Andrew Bartlett

Signed-off-by: Kamen Mazdrashki <kamenim@samba.org>
2010-06-15 10:51:34 +10:00
Andrew Bartlett
6a2f7fe04c s4:dsdb Use the schema from our local provision to decode the schema
This works on the assumption that the schema partition can only
contain schema objects.

We may need to pass down some kind of 'relax' to the DRS -> LDB
conversion code, so that it allows incomplete conversions, so that we
don't fail if a new attribute is present, and we can't decode it.
This would then be resolved the second time we do the conversion.

Andrew Bartlett

Signed-off-by: Kamen Mazdrashki <kamenim@samba.org>
2010-06-15 10:51:34 +10:00
Andrew Bartlett
088d5b76ca s4:dsdb Simplfy match of objectclass in dsdb_schema_set_el_from_ldb_msg
There is no need to do a full ldb_match_msg() for a simple case
insensitive string.

Andrew Bartlett
2010-06-12 11:18:41 +10:00
Andrew Bartlett
d6f5c1ace2 s4:dsdb Provide a function to convert from DRS prefix maps to the LDB prefixmap
This allows us to push a prefixmap directly into the schema we
generate in the provision code.

Andrew Bartlett
2010-06-12 11:17:22 +10:00
Andrew Bartlett
e82836467c s4:dsdb Add more debugs to help track down failures to parse the prefixmap 2010-06-12 11:17:14 +10:00
Andrew Bartlett
c6bf8e4cad s4:dsdb Put back the reference and set_attributes in dsdb_reference_schema
I'm not sure why I removed these in fe3e1af901

Andrew Bartlett
2010-06-12 11:16:49 +10:00
Matthias Dieter Wallnöfer
bd910952ba s4:remove the "validate_update" LDB module - the task is now handled by the far more complete "objectclass_attrs" LDB module 2010-06-07 14:47:23 +02:00
Jelmer Vernooij
b8268cf7b0 s3: Remove use of iconv_convenience. 2010-05-18 11:45:31 +02:00
Jelmer Vernooij
f9ca9e46ad Finish removal of iconv_convenience in public API's. 2010-05-18 11:45:30 +02:00
Nadezhda Ivanova
e2e39117bc Replaced DS_FLAG_ATTR_IS_CRITICAL with SCHEMA_FLAG_ATTR_IS_CRITICAL. 2010-05-03 16:47:56 +02:00
Nadezhda Ivanova
15b42d6515 Added a function to check if an attribute can belong to a filtered replica. 2010-05-03 14:50:10 +02:00
Kamen Mazdrashki
59830d0a6e s4/dsdb: schemaInfo revision may be 0
In case schemaInfo value is still not set, WinAD supplies
schemaInfo blob with revision = 0 and GUID_ZERO
2010-04-29 04:54:07 +03:00
Kamen Mazdrashki
a8438015ca s4/dsdb: remove unused dsdb_schema_info_create() function 2010-04-29 04:54:07 +03:00
Kamen Mazdrashki
2264d917ae s4/dsdb: Update Schema cache with updated schemaInfo value
Error checking is simplified and my leave leeks.
I did it this way to make code more readable, and if we
get error in those lines, it will be WERR_NOMEM in which
case we are in a much deeper troubles than delayed freeing
of few bytes.
2010-04-29 04:54:07 +03:00
Kamen Mazdrashki
e41eac96af s4/samldb: Create initial schemaInfo value if it doesn't exists yet 2010-04-29 04:54:06 +03:00
Kamen Mazdrashki
546a727bd3 s4/dsdb: Use default schemaInfo value when no such value is given
Having no value for schemaInfo is totally OK as it turns out.
In such cases, we should use a default value with
all fields set to 0.
2010-04-29 04:54:06 +03:00
Kamen Mazdrashki
5bf12e101a Revert "s4/dsdb: Set schemaInfo attribute value during provisioning"
This reverts commit 8149094edd.

Windows implementation does not set schemaInfo attribute value
until first Schema update request.
This way, newly provisioned forest returns no schemaInfo value.

I think it won't be bad for us to have this value preset, but
I want to mimic Win AD behavior as close as possible.
2010-04-29 04:54:05 +03: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
Andrew Tridgell
2dcc84432e s4-schema: allow revision numbers of zero
w2k8r2 sends a revision of zero in the initial schema replication
during a net vampire

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2010-04-21 13:35:56 +10:00
Matthias Dieter Wallnöfer
ad9e407357 Revert "s4:prefer "samdb_*_dn" basedn calls over the "ldb_get_*_dn" functions"
We should use the "ldb_get_*_basedn" calls since they are available in the LDB
library.
2010-04-13 08:55:15 +02:00
Andrew Bartlett
77267733ed s4:dsdb Don't use the permissive modify control on schemaInfo updates
The use of 'replace' is enough to wipe out the old value, whatever it
is, we don't need to set 'permissive modify' too.

Additionally, this seems to be causing trouble for the OpenLDAP backend

Andrew Bartlett
2010-04-10 21:41:57 +10:00
Kamen Mazdrashki
8149094edd s4/dsdb: Set schemaInfo attribute value during provisioning
After provisioning new Forest, schemaInfo should be set
to a value with revision=1 and current invocation_id
2010-04-09 12:21:34 +03:00
Kamen Mazdrashki
4ba2ac073d s4/dsdb: split writing of schemaInfo blob in two parts
ldb_msg preparation is moved into separate function
so that it can be used for implementing schemaInfo
updates both on module stack (dsdb_module_... functions)
and directly on ldb_context
2010-04-09 12:21:33 +03:00
Kamen Mazdrashki
fbef33fb73 s4/dsdb: Let caller to control if valid invocationId is critical or zero-guid is acceptable 2010-04-09 12:21:33 +03:00
Kamen Mazdrashki
5363b6e68b s4/dsdb: Use dsdb_schema_info object to create default schemaInfo values 2010-04-09 12:21:32 +03:00
Kamen Mazdrashki
c3d7798991 s4/dsdb: Use dsdb_schema_info object to verify schema_info blobs 2010-04-09 12:21:31 +03:00
Kamen Mazdrashki
9d1f8bcca9 s4/dsdb: dsdb_schema_info object implementation 2010-04-09 12:21:26 +03:00
Kamen Mazdrashki
37a6b66344 s4/dsdb: Define dsdb representation for schemaInfo attribute 2010-04-09 12:21:25 +03:00
Andrew Bartlett
f8019ff793 s4:dsdb Add a shortcut sequence number for schema reloads
This uses the ldb sequence number, in a hope to detect an unchanged
schema quicker.

Andrew Bartlett
2010-03-22 20:24:41 +11:00
Andrew Bartlett
fe3e1af901 s4:dsdb Rework schema loading and add schema reloading
This commit reworks Samba4's schema loading code to detect when it
needs to reload the schema.  This is done by watching the @REPLCHANGED
special DN.

The reload happens by means of a callback, which is only set when the
schema is loaded from the ldb - not when loaded from an LDIF file or
DRS.

We also rework the global schema handling - instead of storing the
pointer to the global schema in each ldb, we store a flag indicating
that the global schema should be returned at run time.  This makes it
much easier to switch to a new global schema.

Andrew Bartlett
2010-03-22 20:24:41 +11:00
Andrew Bartlett
639728a298 s4:schema Expand the schema structure
We now store the location of the schema in the schema, and provide
hooks for a future schema reloading mechanism.

Andrew Bartlett
2010-03-22 20:24:41 +11:00
Andrew Bartlett
2de07761e0 s4:dsdb Change dsdb_get_schema() callers to use new talloc argument
This choses an appropriate talloc context to attach the schema too,
long enough lived to ensure it does not go away before the operation
compleates.

Andrew Bartlett
2010-03-16 19:26:03 +11:00
Andrew Bartlett
1e6fee4185 s4:dsdb Add a memory context for dsdb_get_schema()
When specified, we talloc_reference onto this context to ensure that
pointers found in it are valid for the life of the objects they are
placed into.  (Such as the string form of LDAP attributes).

Andrew Bartlett
2010-03-16 19:25:14 +11:00
Matthias Dieter Wallnöfer
5a54b204c3 s4:schema - Change also here counters to "unsigned" where needed
Counters which are used in the way  "for (i = 0; array[i] != NULL; i++)" I
modified to "unsigned" since for sure we don't want to have negative array
indexes there.
2010-03-07 19:01:15 +01:00
Matthias Dieter Wallnöfer
bd5f08f3d1 s4:schema_syntax.c - Change also here counters to "unsigned" where needed
Counters which are used in the way  "for (i = 0; array[i] != NULL; i++)" I
modified to "unsigned" since for sure we don't want to have negative array
indexes there.

There were many counter variables typed "uint32_t". This isn't fully correct
since those count LDB objects. The amount is saved in a "num_*" variable which
is "unsigned" without a bitlength specification. Therefore change also these
counters to be plain "unsigned".
2010-03-07 19:00:32 +01:00
Stefan Metzmacher
4bad696f9e s4:dsdb/schema: fix validation of DNs
ldb_dn_extended_filter() removes all but the listed components,
I didn't noticed that when writting the code.
Doing a ldb_dn_remove_extended_components(dn2) is wrong.

This was hidden by some bugs in the ldb_dn code.

metze
2010-02-26 23:26:32 +01:00
Andrew Tridgell
90203f87e7 s4-dsdb: change samdb_replace() to dsdb_replace() and allow for dsdb_flags
This allows for controls to be added easily where they are needed.
2010-02-16 21:10:50 +11:00
Andrew Tridgell
5549190b37 s4-dsdb: use TYPESAFE_QSORT() in dsdb code 2010-02-13 22:36:12 +11:00
Stefan Metzmacher
1f2efef214 s4:dsdb/schema: add dsdb_syntax_OID_validate_ldb()
This is a very heavy weight way of checking this syntax,
but it's very complex and using the existing function
should be ok for now. We can optimize it later.

metze
2010-01-13 16:06:41 +01:00
Stefan Metzmacher
f0fed6cadd s4:dsdb/schema: add dsdb_syntax_DN_STRING_validate_ldb()
metze
2010-01-13 16:06:40 +01:00
Stefan Metzmacher
83baa44c67 s4:dsdb/schema: add dsdb_syntax_DN_BINARY_validate_ldb()
metze
2010-01-13 16:06:40 +01:00
Stefan Metzmacher
39dda462cd s4:dsdb/schema: add dsdb_syntax_DN_validate_ldb()
metze
2010-01-13 16:06:39 +01:00
Stefan Metzmacher
4fa2bf8184 s4:dsdb/schema: add dsdb_syntax_PRESENTATION_ADDRESS_validate_ldb()
metze
2010-01-13 16:06:39 +01:00
Stefan Metzmacher
ba8a930d0e s4:dsdb/schema: add dsdb_syntax_UNICODE_validate_ldb()
metze
2010-01-13 16:06:39 +01:00
Stefan Metzmacher
674e8350b6 s4:dsdb/schema: add dsdb_syntax_DATA_BLOB_validate_ldb()
metze
2010-01-13 16:06:38 +01:00
Stefan Metzmacher
e2b9454d36 s4:dsdb/schema: add dsdb_syntax_NTTIME_validate_ldb()
metze
2010-01-13 16:06:38 +01:00
Stefan Metzmacher
eb261a9fda s4:dsdb/schema: add dsdb_syntax_NTTIME_UTC_validate_ldb()
metze
2010-01-13 16:06:37 +01:00
Stefan Metzmacher
5f13a16295 s4:dsdb/schema: add dsdb_syntax_INT64_validate_ldb()
metze
2010-01-13 16:03:55 +01:00
Stefan Metzmacher
ece3defd15 s4:dsdb/schema: add dsdb_syntax_INT32_validate_ldb()
metze
2010-01-13 16:03:54 +01:00
Stefan Metzmacher
a0f2a49b8a s4:dsdb/schema: add dsdb_syntax_BOOL_validate_ldb()
metze
2010-01-13 16:03:54 +01:00
Stefan Metzmacher
b20707c11a s4:dsdb/schema: add inftrastructure for dsdb_validate_ldb()
metze
2010-01-13 16:03:54 +01:00
Stefan Metzmacher
61589085c4 s4:dsdb/schema: add dsdb_syntax_DN_STRING_* wrappers
metze
2010-01-13 16:03:53 +01:00
Andrew Tridgell
c93a182a0d s4-schema: added some debug for bad attributes 2010-01-08 18:24:53 +11:00
Andrew Tridgell
f6cf895951 s4-schema: added generic attributeID conversion functions
When we get one we haven't seen before, we can work out the right type
automatically in most cases.

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2010-01-08 13:03:04 +11:00
Andrew Tridgell
f7517e6256 s4-schema: added dsdb_attribute_by_lDAPDisplayName_ldb_val
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2010-01-08 13:03:04 +11:00
Andrew Tridgell
cd65ce8a18 s4-schema: make ldb_val to string comparison safer with nul termination
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2010-01-08 13:03:04 +11:00
Kamen Mazdrashki
3352e5d7ba s4/dsdb_schema: Load msDS-IntId value separately when loading from LDB
This way we have consistent behavior when loading from DRSUAPI
and from LDB.
2010-01-08 13:03:04 +11:00
Kamen Mazdrashki
25238110df Revert "s4-schema: Set ATTID in schema cache from "msDS-IntId""
This reverts commit 4e8ad284f5.
2010-01-08 13:03:04 +11:00
Kamen Mazdrashki
9871f52bd3 s4/dsdb_schema: use msDS-IntId value for attribute look-up 2010-01-08 13:03:03 +11:00
Kamen Mazdrashki
a44ae10c77 s4/dsdb_schema: fetch msDS-IntId value during SCHEMA replication 2010-01-08 13:03:03 +11:00
Kamen Mazdrashki
a7b3891fb5 s4/dsdb_schema: GET_UINT32_DS() macro to use supplied default value instead of 0 2010-01-08 13:03:03 +11:00
Andrew Tridgell
c3061794ef s4-dsdb: use ldb_val_to_time() instead of ldb_string_to_time() 2010-01-02 08:16:55 +11:00
Andrew Tridgell
9f02898080 s4-schema: don't fill in the extended DN with a zero GUID
sometimes windows sends us a zero GUID in a DRS DN.

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2010-01-02 08:16:52 +11:00
Andrew Tridgell
d4853fed00 sd-schema: order DRS classes on the wire in reverse order
windows sends objectclasses in DRS in the opposite order to what LDAP
uses
2010-01-02 08:16:52 +11:00
Andrew Tridgell
b1db66a501 s4-dsdb: allow the component name to be specified in dsdb_get_extended_dn_guid()
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2010-01-02 08:16:50 +11:00
Andrew Tridgell
0c362597c0 s4-schema: fixed the sorting of schema attributes
another case of unsigned int subtracting breaking sorts. This one
surfaced now as attributeID_id now can be larger than 2^31
2009-12-21 23:45:23 +11:00
Kamen Mazdrashki
ad35153ef4 s4-drs: Implement constraints on ATTID values in prefixMap
Ref: MS-ADTS, 3.1.1.2.6 ATTRTYP

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2009-12-21 23:45:18 +11:00
Kamen Mazdrashki
9f6c81874f s4-drs: Save prefix map using LDB_CONTROL_AS_SYSTEM control
Signed-off-by: Andrew Tridgell <tridge@samba.org>
2009-12-21 23:45:00 +11:00
Kamen Mazdrashki
4e8ad284f5 s4-schema: Set ATTID in schema cache from "msDS-IntId"
According to http://msdn.microsoft.com/en-us/library/cc223224%28PROT.13%29.aspx
some Attributes OIDs may not use prefixMap.
Setting ATTID in Schema Cache here should work, although
this code snippet should be moved in separate function.

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2009-12-21 23:44:29 +11:00
Andrew Tridgell
ec74ffa8f0 s4-schema: a unsigned comparison bug in the schema code 2009-12-21 23:41:08 +11:00
Nadezhda Ivanova
4deaa84ce4 Fixed a problem with duplicate values of allowedAttributesEffective. 2009-12-15 12:02:20 +02:00
Andrew Tridgell
c7c97b61ae s4-schema: use GUID_to_ndr_blob() 2009-12-10 17:51:29 +11:00
Andrew Tridgell
d35b7d0aa4 s4-schema: use binsearch.h 2009-12-10 17:51:29 +11:00
Andrew Tridgell
81bc561330 s4-dsdb: simplify schema code using new GUID functions 2009-12-10 17:51:27 +11:00
Matthias Dieter Wallnöfer
7be99d3735 s4:schema - Make some more (result) variables const and fix up warnings with "discard_const_p" 2009-12-01 16:48:02 +11:00
Kamen Mazdrashki
83b41aa959 s4/schema(tort): Refactor DSDB-SYNTAX test for better performance
Test was implemented as a test fixture so that setup/teardown
occurs only once.
This should impact test performace as long as provision_get_schema()
is a slow function (especially when debugging)
2009-11-23 14:15:06 +01:00
Kamen Mazdrashki
1bf31f343c s4/schema: Object(OR-Name) syntax handling for DRS calls
OR-Name syntax through DRS calls looks like DN-Binary syntax
2009-11-23 14:15:05 +01:00
Kamen Mazdrashki
bef4e25b1f s4/schema(tort): Inject authOrig attribute into schema loaded for tests 2009-11-23 14:15:05 +01:00
Kamen Mazdrashki
d03d15d0cb s4/schema(tort): Add test for Object(OR-Name) syntax 2009-11-23 14:15:05 +01:00
Kamen Mazdrashki
aa238ff6ea s4/schema(tort): Test LDB_SYNTAX_DN with extended_dn in [GUID;SID;DN] form 2009-11-23 14:15:05 +01:00
Stefan Metzmacher
4532f683a7 s4:dsdb/schema: let schema_supclasses() return the correct pointer
str_list_unique() changes the pointer via talloc_realloc().

metze
2009-11-17 09:00:50 +01:00
Andrew Bartlett
e9f4dbce64 s4:schema Add the GUID to each defaultObjectCategory when loading from LDIF
This makes these full extended DNs, so we set the right values into
the database, even before we actually set the schema objects
themselves.

Andrew Bartlett
2009-11-17 10:38:03 +11:00
Andrew Bartlett
39b8f31d66 s4:dsdb Load objectGUID and extended DN defaultObjectCategory into the schema
The load of defaultObjectCategory as an extended DN means we need to
use the common parsing functions I just split out, rather than the
GET_DS_DN macro.

The objectGUIDs are loaded so that we can create the extended DN when
we load from LDIF (and are loaded for the other cases for
consistency).

Also adapt callers to API changes needed for common parsing code

Andrew Bartlett
2009-11-17 10:38:02 +11:00
Andrew Bartlett
58ded23b86 s4:dsdb Break up 'parse a DN from DRSUAPI' into a subfunction
This should make it easier to call this function from the DRS schema
load code, rather than duplicate it.

(we may do the same with other functions in future).

Andrew Bartlett
2009-11-17 10:38:01 +11:00
Andrew Bartlett
a9f6a56227 s4:dsdb/schema Add more unit tests for DN+Binary syntaxes 2009-11-12 16:34:43 +11:00
Andrew Bartlett
081d57345f s4:dsdb/schema Allow a schema set when bound against a remote LDAP server 2009-11-12 16:34:15 +11:00
Andrew Bartlett
2a601719f2 s4:dsdb Add expected value tests for most DRS syntax conversions
I've left out those for which I could not find an expected value in my
default Windows 2003 server's database, and the values that rely on
the current prefix map at the time.

Andrew Bartlett
2009-11-12 16:34:12 +11:00
Andrew Bartlett
9ba1870fb9 s4:Fix regression in dsdb_dn code - all parses of the DN would be rejected
This is most likely the cause of the DRS replication failures I
observed with my changes.

Andrew Bartlett
2009-11-12 16:34:11 +11:00
Andrew Bartlett
d6563801d1 s4:dsdb/schema Simplify schema loading from ldb messages
It turns out that we always add the class/attribute to the schema.
2009-11-12 16:34:09 +11:00
Andrew Bartlett
f0d43e9e56 s4:dsdb Use new dsdb_dn code in LDB modules and Samba4 schema
This converts the code from using the binary DN code in ldb_dn to
using a special Samba-specfic wrapper around ldb_dn.

We also use the dsdb_dn code for DN+Binary and DN+String comparisons
(changed from treating them as Binary blobs)

Andrew Bartlett
2009-11-12 16:34:04 +11:00
Kamen Mazdrashki
0f531e3a2a s4/drs: Refactor to be more SAMBA.Coding style compliant
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2009-11-06 14:05:50 +01:00
Kamen Mazdrashki
c236bb537f s4/drs: Remove unused structures and functions
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2009-11-06 14:05:50 +01:00
Kamen Mazdrashki
db82023af2 s4/drs: remove unused num_prefixes and prefixes from dsdb_schema
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2009-11-06 14:05:49 +01:00
Kamen Mazdrashki
b9dd44ee39 s4/drs: dsdb_create_prefix_mapping() refactored
TODO: this function may be refactored further.
Actually we don't need to look up for the OID supplied,
but just call sdb_schema_pfm_make_attid() - it will
search for the OID anyway and add it if necessary

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2009-11-06 14:05:48 +01:00
Kamen Mazdrashki
9405377a70 s4/drs: prefixMap lookup by full_OID implementation
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2009-11-06 14:05:48 +01:00
Kamen Mazdrashki
1aae751a68 s4/drs: dsdb_write_prefixes_from_schema_to_ldb() refactored
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2009-11-06 14:05:47 +01:00
Kamen Mazdrashki
82539b7d66 s4/drs: dsdb_read_prefixes_from_ldb() refactored
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2009-11-06 14:05:46 +01:00
Kamen Mazdrashki
9da33436e4 s4/drs: refactor dsdb_load_oid_mappings_ldb() to use _dsdb_prefixmap_from_ldb_val()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2009-11-06 14:05:45 +01:00
Kamen Mazdrashki
5381d8d157 s4/drs: Load prefixMap from ldb_val moved in separate function
It is to be used later in several places when we need such conversion.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2009-11-06 14:05:45 +01:00
Kamen Mazdrashki
fc05386c0d s4/drs: dsdb_schema_pfm_from_drsuapi_pfm() to accept partial drsuapi_prefixMap
"partial drsuapi_prefixMap" is a prefix map without last entry
being special - i.e. map that does not contains schema_info entry.

Test for dsdb_schema_pfm_from_drsuapi_pfm() were also extended to
cover both 'full' and 'partial' map conversion.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2009-11-06 14:05:44 +01:00
Kamen Mazdrashki
ba4d87f817 s4/drs: dsdb_map_int2oid() replaced by dsdb_schema_pfm_oid_from_attid()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2009-11-06 14:05:43 +01:00
Kamen Mazdrashki
01302b8202 s4/drs: dsdb_map_oid2int() replaced by dsdb_schema_pfm_make_attid()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2009-11-06 14:05:43 +01:00
Kamen Mazdrashki
ddab9d1fe7 s4/drs: dsdb_verify_oid_mappings_drsuapi() replaced by dsdb_schema_pfm_contains_drsuapi_pfm()
dsdb_schema_pfm_contains_drsuapi_pfm() is part of reimplemented
prefixMap interface.

This name was choosen to clearly show, that this a week verification
in case we want to determine if remote schema is changed.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2009-11-06 14:05:42 +01:00
Kamen Mazdrashki
28b6eb9494 s4/drs: dsdb_get_oid_mappings_drsuapi() to use new prefixMap interface
dsdb_get_oid_mappings_drsuapi() just need to call
dsdb_drsuapi_pfm_from_schema_pfm() to get filled-in DRSUAPI
prefixMap.

Perhaps it won't be bad to rename this function to have
more expressive name in the future

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2009-11-06 14:05:42 +01:00
Kamen Mazdrashki
a83385303b s4/drs: dsdb_load_oid_mappings_drsuapi() -> dsdb_load_prefixmap_from_drsuapi()
Also, dsdb_load_oid_mappings_drsuapi() was reimplemented to use
dsdb_schema_pfm_from_drsuapi_pfm() function to load
drsuapi_prefixMap into schema->prefixmap

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2009-11-06 14:05:41 +01:00
Kamen Mazdrashki
3729272f0a s4/drs: dsdb_schema uses dsdb_schema_prefixmap definition
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2009-11-06 14:05:41 +01:00
Kamen Mazdrashki
b54ec122b2 s4/drs: Move schema_prefixMap allocation in separate function
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2009-11-06 14:05:40 +01:00
Kamen Mazdrashki
6210237b5a s4/drs: schema_prefixMap to/from drsuapi_prefixMap conversion implementation
Along with this, dsdb_schema_pfm_contains_drsuapi_pfm()
function is implemented to replace previous implementation
for dsdb_verify_oid_mappings_drsuapi().
Name of the function clearly implies how week this verification is,
as currently it is used to indicate "Schema modified on remote"
condition.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2009-11-06 14:05:39 +01:00
Kamen Mazdrashki
3fe4310df7 s4/drs: Implement binary-oid-lookup into prefixMap
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2009-11-06 14:05:38 +01:00
Kamen Mazdrashki
f4475368f0 s4/drs: Move making of partial-binary-oid to a separate function
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2009-11-06 14:05:37 +01:00
Kamen Mazdrashki
39ab7b8ebd s4/drs: Fix memory leek in prefixMap
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2009-11-06 14:05:37 +01:00
Nadezhda Ivanova
1fc47e1228 Version 1.0 of the directory service acls module.
At this point, support for checks on LDAP add, delete, rename and modify.
Old kludge_acl is still there to handle the searches.
This module is synchronous as the async version was impossible to debug,
will be converted to async after some user testing.
2009-11-05 17:34:12 +02:00
Endi S. Dewata
8097280b46 s4 - Mapped AD schema to existing FDS schema. 2009-11-02 16:36:53 +11:00
Kamen Mazdrashki
9393d94ad4 s4/drs: prefixMap main interface implementation
Currenly implemented functions are:
dsdb_schema_pfm_new(), dsdb_schema_pfm_make_attid()
and dsdb_schema_pfm_oid_from_attid()
2009-10-21 11:49:51 +03:00
Kamen Mazdrashki
4dc90c0851 s4/drs(tort): Unit test for prefixMap implementation.
Currenly those tests cover only the main part of the interface,
i.e. dsdb_schema_pfm_new(), dsdb_schema_pfm_make_attid()
and dsdb_schema_pfm_oid_from_attid()
2009-10-21 11:49:50 +03:00
Kamen Mazdrashki
784e0c199e s4/drs: prefixMap module initial definition 2009-10-16 12:54:14 +03:00
Kamen Mazdrashki
40a8a22684 s4/drs: Propagate redefinition of drsuapi_DsReplicaOID into code base
The biggest change is that 'oid' field is transmited in binary format.
Also the field name is changed to 'binary_oid' so that
field format to be clear for callers.

After those changes, Samba4 should work the way it works before -
i.e. no added value here but we should not fail when
partial-oid is part of prefixMap transmited from Win server.

Also, thre is a bug in this patch - partial-binary-OIDs are
not handled correctly. Partial-binary-OIDs received during
replication will be encoded, but not handled correctly.
2009-10-16 12:54:14 +03:00
Andrew Bartlett
d511d889a0 s4:schema Add some error checking to the schema load 2009-10-12 16:51:03 +11:00
Andrew Bartlett
aee3c19015 s4:dsdb Make dsdb_read_prefixes_from_ldb static 2009-10-12 16:51:03 +11:00
Andrew Bartlett
c9f70fc3c7 s4:dsdb Search for the schema with dsdb_module_search(), in schema_fsmo
This avoids using an ldb_search(), which would run from the top of the
module stack.  This will help us load the schema before the partitions
are initialised.

Andrew Bartlett
2009-10-12 16:51:02 +11:00
Matthias Dieter Wallnöfer
cb143eafef s4:schema_inferiors - Fix wrong check 2009-10-03 15:49:40 +02:00
Andrew Bartlett
0e028fcb7d s4:dsdb add systemPossibleInferiors to schema code
This allows us to figure out what the system can add, which will not
be in possibleInferiors due to the systemOnly flag.

Andrew Bartlett
2009-10-03 12:37:55 +02:00
Andrew Tridgell
fd22e03047 s4-ldb: Add support for binary blobs in DNs
AD has the concept of a DN prefixed with B:NN:XXXXXX: that contains a
binary blob. We need to support those in order to give correctly
formatted binary blobs for things like wellKnownObjects

This implementation is not ideal, as it allows for binary blobs on all
DNs, whereas it should only allow them on those with a syntax of
2.5.5.7. We should clean this up in the future, but meanwhile this
implementation at least gets us a working DC join of w2k8 to s4.

This patch also uses a static function for marking DNs as invalid,
which is very useful when debugging this code, as you can break on it
in gdb.
2009-10-02 12:03:05 +10:00
Andrew Tridgell
075f9e2c29 s4-dsdb: cope with windows sending extra pad bytes 2009-09-23 14:01:30 -07:00
Andrew Tridgell
bb3bdb3a62 s4-ldb: added a bunch more debug for DC join
These additional debug messages were added to help us track down
w2k8->s4 domain join
2009-09-22 17:10:06 -07:00
Andrew Bartlett
399c7160d5 s4:ldb Add 'single-value' support to LDB.
This is currently only triggered via Samba4's schema code.
2009-09-21 20:50:26 -07:00
Nadezhda Ivanova
9e85192e64 Merge branch 'master' of git://git.samba.org/samba 2009-09-21 17:29:28 -07:00
Nadezhda Ivanova
10c6f3f71a Initial Implementation of the DS objects access checks.
Currently disabled. The search will be greatly modified,
also the object tree stuff will be simplified.
2009-09-21 17:27:50 -07:00
Andrew Tridgell
ac56fed2f4 s4-schema: don't trace the schema load (too verbose) 2009-09-21 15:27:05 -07:00
Anatoliy Atanasov
663fe5530f Handle dsdb_class_by_lDAPDisplayName returned values in schema_inferiors.c 2009-09-19 15:42:44 -07:00
Andrew Tridgell
f1ce4f9945 s4-dsdb: use DLIST_ADD() not DLIST_ADD_END()
Using DLIST_ADD_END() to construct a long list is very inefficient (it
is O(n^2). These lists are not ordered, so using DLIST_ADD() is much
better.
2009-09-15 11:48:12 -07:00
Andrew Bartlett
9a209ac252 s4:schema Add code to provide an index into the subClass tree
In time, this should avoid the astounding (order) complexity of the
objectclass sorting in objectclass.c eventually.

Andrew Bartlett
2009-09-15 10:38:52 -07:00
Andrew Tridgell
0807251154 s4/schema: teach the schema_syntax code how to encode/decode more attributes
We were trying to encode strings like 'top' as integers, without first
looking them up in our schema. We need special handling for all the
attributes that contain attributeID_id or governsID_id fields that
should be translated first before encoding.
2009-09-10 12:12:49 +10:00
Andrew Tridgell
3671c9e991 s4/schema: don't crash if we don't have subClassOf 2009-09-10 12:12:49 +10:00
Stefan Metzmacher
0d07ce1949 s4:dsdb: correctly implement _dsdb_syntax_OID_oid_ldb_to_drsuapi()
Here we just need to map the oid string in the ldb value to
the ATTRTYP id.

metze
2009-09-07 15:04:22 +02:00
Anatoliy Atanasov
957a9285c2 Fix the dsdb_syntax_OID_ldb_to_drsuapi function
This replace the dsdb_syntax_FOOBAR_ldb_to_drsuapi function,
which was left as a TODO code. Implementation in both added functions
is completely identical and probably should differ in the future.
2009-09-03 19:10:42 +10:00
Andrew Bartlett
74218726e8 s4:schema Rework dsdb_write_prefixes_from_schema_to_ldb() to use talloc
This changes dsdb_write_prefixes_from_schema_to_ldb() to use an
internal talloc hirarchy, so we can safely give it a NULL context from
the python.

It also fixes manual construction of the ldb_message - we now use the
right helper functions.

Andrew Bartlett
2009-08-26 13:49:10 +10:00
Andrew Bartlett
a52e7a2c65 s4:scheam quiet a 'const' warning 2009-08-26 12:32:47 +10:00
Andrew Bartlett
7e54b5e568 s4:dsdb Rework dsdb_write_prefixes_to_ldb() to take a schema
The aim is to create a function that is more easily wrapped for
python, so that we can write the updated prefixMap in an upgrade
script.

Andrew Bartlett
2009-08-26 12:29:45 +10:00
Andrew Bartlett
b4e8d927cd s4:dsdb Add const 2009-08-24 20:24:18 +10:00
Andrew Bartlett
cc330f9362 s4:dsdb use talloc_strndup() in GET_STRING_LDB() rather than walk off the end
The problem is that samdb_result_string() and
ldb_msg_find_attr_as_string() both simply cast the string, rather than
ensuring the return value is NULL terminated.  This may be best
regarded as a flaw in LDB, but fixing it there is going to be more
difficult.

Andrew Bartlett
2009-08-24 20:24:18 +10:00
Matthias Dieter Wallnöfer
61d4f8be60 s4: int32 handling: previous fix was not fully correct 2009-08-17 20:42:39 +02:00
Matthias Dieter Wallnöfer
2cf897b10a s4: Make the int32 problem more clear - and fix another error 2009-08-17 20:29:11 +02:00
Andrew Tridgell
f890dba084 make sure we update the current schema->prefixes when we add a new prefix
This triggered a failure in the updateNow schema test, as the current
global schema was not being updated when a new schema element was
added
2009-08-17 11:14:12 +10:00
Andrew Bartlett
51d2d3df6d s4:schema Allow a schema load on an unconnected database
This helps ensure we don't load the schema too often in the provision
(allowing a reference in of the schema before the modules load).

Andrew Bartlett
2009-08-17 09:50:56 +10:00
Andrew Bartlett
346aa6e093 s4:schema Provide a way to reference a loaded schema between ldbs
This allows us to load the schema against one ldb context, but apply
it to another.  This will be useful in the provision script, as we
need the schema before we start the LDAP server backend.

Adnrew Bartlett
2009-08-17 09:50:56 +10:00
Andrew Tridgell
2c12c985e7 use talloc with the global schema consistently
Before this change, the first opener of the sam ldb context would
become the owner of the global schema, then the autofree context got a
reference to the schema. Any subsequent opens of the sam ldb also got
a reference. This meant that the talloc hierarchy was inconsistent
between the first sam ldb open and subsequent opens. With this change
the autofree context becomes the owner of the global schema, and all
ldb contexts get a reference.
2009-08-07 17:24:48 +10:00
Andrew Bartlett
43aa546ecc s4:dsdb Don't cast an ldb_val into a const char * for schema lookups
This removes a number of cases where we did a cast into a const char *
of an ldb_val.  While convention is to alway have an extra \0 at
data[length] in the ldb_val, this is not required, and does not occour
at least on build farm host 'svart'.

Andrew Bartlett
2009-08-05 08:56:06 +10:00
Anatoliy Atanasov
6b05a9079c Fix for schemaUpdateNow command 2009-07-08 14:40:20 +10:00
Andrew Tridgell
d47bb0a96c we can't use the unique index code for samAccountName
Using ldb unique indexes for samAccountName doesn't work with DRS as
the other DC may send us a deleted record (tombstone record), which
has the same samAccountName as an existing record. That would then
create two records in the same partition with the same samAccountName.

So we needed to put back the logic in samldb.c which explicitly
checked whether a samAccountName already exists on add
2009-07-02 15:57:30 +10:00
Andrew Tridgell
ae8515d31b fixed the pull of drs schema elements
The previous code incorrectly assumed that attributes such as 
subClassOf come over the wire as strings. In fact they come over as 32
bit integers which refer to goversIDs. We have to post-process these
as it sometimes happens that a governsID comes over the wire before
the record that defines what it means.
2009-07-02 14:55:38 +10:00
Andrew Tridgell
45ba09457e fixed the reference to the global_schema 2009-07-01 15:15:36 +10:00
Matthias Dieter Wallnöfer
2627c6c0c2 Fixed some uninitialised variables
I tried hard to not change the program logic. Should fix bug #6439.
2009-06-19 11:32:01 +10:00
Matthias Dieter Wallnöfer
0376d056e5 Correct handling of 32-bit integer attributes in SAMBA 4
- LDB handles now all 32-bit integer attributes correctly (also with overflows)
  according to the schema
- LDAP backends handle the attributes "groupType", "userAccountControl" and
  "sAMAccountType" correctly. This handling doesn't yet use the schema but
  the conversion file "simple_ldap.map.c" which contains them hardcoded.
  Did also a refactoring of the conversion function there.
- Bug #6136 should be gone
2009-06-19 11:32:01 +10:00
Jelmer Vernooij
4657f52c06 Fix build with system LDB. 2009-06-18 01:21:35 +02:00
Andrew Tridgell
ce1045983f mark samAccountName, objectGUID and objectSID as unique indexed 2009-06-01 16:36:56 +10:00
Andrew Tridgell
52cfffb8cb enable one-level indexing in sam.ldb 2009-05-28 16:08:49 +10:00
Andrew Bartlett
6df4aece1d dsdb:schema Use str_list_make_empty() to create an empty list 2009-05-14 05:56:59 +10:00
Andrew Tridgell
87506b4a19 make the memory usage of possibleInferiors much more efficient 2009-04-09 14:29:36 +10:00
Andrew Tridgell
37254b7a76 fixed the possibleInferiors calculation so it now passes the test
We are probably still using more memory here than we need to. That
needs to be looked at.
2009-04-09 13:46:18 +10:00
Andrew Bartlett
db29383797 Make the schema_inferiors generation code to compile
Sadly it still segfaults at this stage

Andrew Bartlett
2009-04-08 23:18:49 +10:00
Andrew Tridgell
217628f881 first cut at a C version of the possible inferiors code 2009-04-07 16:34:36 +10:00
Andrew Bartlett
6e6094d780 s4:schema Don't free mem_ctx before it is initilised 2009-04-03 10:33:12 +11:00
Andrew Tridgell
9539e2b508 major upgrade to the ldb attribute handling
This is all working towards supporting the full WSPP schema without a
major performance penalty.

We now use binary searches when looking up classes and attributes. We
also avoid the loop loading the attributes into ldb, by adding a hook
to override the ldb attribute search function in a module. The
attributes can thus be loaded once, and then saved as part of the
global schema. 

Also added support for a few more key attribute syntaxes, as needed
for the full schema.
2009-04-02 16:42:21 +11:00
Andrew Tridgell
2fe17ae61e possibleInferiors is a generated attribute - we can't pull it over DRS
or from ldb
2009-03-31 16:31:16 +11:00
Andrew Bartlett
1f25b71d19 s4:schema Don't rely on objectCategory 'magic' when loading the schema
The short-to-long name canonicalisation rules use the schema, so
clearly they won't work when loading it.

Andrew Bartlett
2009-03-11 16:36:40 +11:00
Andrew Bartlett
bb6a2c8076 Load the schema with a more efficient single search
This search uses the index, and is not recursive, so should avoid the
major performance problem with the current sorted schema load.

The ad2oLschema code (recently moved to provision-backend) no longer
needs the schema to be sorted.

Andrew Bartlett
2009-03-06 12:18:21 +11:00
Andrew Bartlett
8374d6f0dc Sort output of schema for OpenLDAP during conversion
This avoids the need to assume that the schema is sorted on load,
which happens more often and is a major performace issue in the
Samba4's use of ldb.

Andrew Bartlett
2009-03-06 12:12:24 +11:00
Andrew Bartlett
17aac8cad2 Remove ad2oLschema, insted call it directly from provision-backend
This removes a level of indirection via external binaries in the
provision-backend code, and also makes better use of our internal code
for loading schema from an LDIF file.

Remaining to do: Sort the output again, as the load from LDIF is
unsorted (also needed because the normal LDB load from sorted input is too slow
anyway, and is only needed here).

Andrew Bartlett
2009-03-05 16:52:11 +11:00
Andrew Bartlett
52542e1aff 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
2009-03-04 14:06:11 +11:00
Jelmer Vernooij
94069bd274 s4: Use same function signature for convert_* as s3. 2009-03-01 19:55:46 +01:00
Jelmer Vernooij
9ffb6d2d9e Add allow_badcharcnv argument to all conversion function, for
consistency with Samba 3.
2009-03-01 06:33:40 +01:00
Simo Sorce
1cd7fe7194 Fix headers, ldb_includes.h is a private header,
do not reference it from ldb.h
2009-02-23 17:38:11 -05:00
Stefan Metzmacher
2dc838341d s4:dsdb/schema: s/class/sclass
metze
2009-02-02 13:08:40 +01:00
Simo Sorce
d4aeed879b Fix all other modules to use ldb_module.h instead of ldb_private.h
The only 2 modules escaping the rule so far are rootdse and partitions
2009-01-30 17:07:25 -05:00
Jelmer Vernooij
bd64688c6a Fix more compiler warnings in various places. 2008-12-23 22:57:11 +01:00
Andrew Bartlett
012a6524f7 Treat DN+STring as a binary string for now
This matches the way we work with DN+Binary.  We need this for the
OpenLDAP backend.

Andrew Bartlett
2008-12-20 15:11:40 +11:00
Andrew Bartlett
6488afaafe Now store the GUID and SID from a DN over DRSUAPI into ldb.
Until the extended DN work was compleated, there was no way to store
the additional metadata.

Andrew Bartlett
2008-12-20 14:44:39 +11:00
Andrew Bartlett
6c298c06f3 Don't treat the DN+binary syntax as a DN.
This should fix the OpenLDAP backend
2008-12-02 14:22:24 +11:00
Stefan Metzmacher
a1f76f7afe s4:dsdb/schema: add a function to generate the "extendedClassInfo" values
metze
2008-11-16 16:37:28 +01:00
Stefan Metzmacher
3c0f03ade2 s4:dsdb/schema: add a function to generate the "extendedAttributeInfo" values
metze
2008-11-16 16:37:27 +01:00
Stefan Metzmacher
203544e690 s4:dsdb/schema: use pointers for rangeLower and rangeUpper.
This makes clear there's an value stored in the schema,
as they can be '0'.

metze
2008-11-16 16:37:27 +01:00
Stefan Metzmacher
6770fd12cc s4:dsdb/schema: we don't need to use find_syntax_map_by_ad_oid() as the syntax is already known
metze
2008-11-16 16:37:27 +01:00
Stefan Metzmacher
f0b3f98b4f s4: dsdb/schema: fix the equality and comment of DN+String syntax
metze
2008-11-08 08:02:28 +01:00
Jelmer Vernooij
23302413b3 Remove unused include param/param.h. 2008-10-24 16:37:56 +02:00
Jelmer Vernooij
37d885c51a Remove iconv_convenience argument from convert_string{,talloc}() but
make them wrappers around convert_string{,talloc}_convenience().
2008-10-24 14:26:46 +02:00
Jelmer Vernooij
09a63accb8 Move charset library to top level. 2008-10-24 00:06:35 +02:00
Jelmer Vernooij
6a89b59ca6 Add TALLOC_CTX pointer to strhex_to_data_blob for consistency with Samba
3.
2008-10-18 18:09:04 +02:00
Jelmer Vernooij
9565999755 Fix include paths to new location of libutil. 2008-10-11 21:31:42 +02:00
Andrew Bartlett
7d9f18609b Remove DESCRIPTION from generated schema lines.
This is not permitted in the AD aggregate schema, and more trouble
than it is worth in the OpenLDAP schema due to escaping issues.

Andrew Bartlett
2008-10-06 14:16:30 -07:00
Andrew Bartlett
c412a930ad Fix Domain Trust creation with Windows 2008 (and many other tools)
A dITConentRules attribute (unlike objectClasses) must not contain a
'SUP'.

The ADSI layer in Windows would download the whole schema, and
validate it.  Thanks to the team at Microsoft for very long debugging
session to find this.

Andrew Bartlett
2008-10-06 14:16:29 -07:00
Simo Sorce
508527890a Merge ldb_search() and ldb_search_exp_fmt() into a simgle function.
The previous ldb_search() interface made it way too easy to leak results,
and being able to use a printf-like expression turns to be really useful.
2008-09-23 18:17:46 -04:00
Andrew Bartlett
acf11ddd5f Fix failure to load the schema on read-only DB.
This also tries to simplify the logic in the schema -> @ATTRIBUTES and
@INDEXES code.

Andrew Bartlett
(This used to be commit a383b8bf88)
2008-09-12 07:45:28 +10:00
Andrew Bartlett
ab555eb199 Remove the complexity of transactions from the attributes-setting code.
I think it is just too complex and error prone to init and cancel
transactions during the module init code.  Instead, this isn't prone
to races as it will always achieve a steady state (eventually), and
most cases will never do the write.

Andrew Bartlett
(This used to be commit d60977cc7f)
2008-09-11 20:51:26 +10:00
Andrew Bartlett
d30caa011c Make cn=aggregate output less pretty, by more like Win2008.
I'm not sure if this fixes bug #5713, as this is not consistantly
reproducably on my equipment.

Andrew Bartlett
(This used to be commit 02d6645efc)
2008-09-11 12:36:58 +10:00
Andrew Bartlett
ffc9f85bfb Fix reversed test trying to fix bug #5713
(It instead ensured that only 'top' had a SUP keyword)

This clearly shows that 937b466266 was
not a full or correct fix, but despite this I can no longer reproduce
the issue.  Further investigation is required.

Andrew Bartlett
(This used to be commit 95a9e9b6b8)
2008-09-09 18:02:05 +10:00
Andrew Bartlett
e7cc705efb Fix bug #5713 by correcting the generated schema.
This bug is entitled 'Schema patch breaks interoperability with
Microsoft MMC consoles.', and it does so very spectacularly.

The issue is that we would include an entry:
objectClasses: ( 2.5.6.0 NAME 'top' SUP top ABSTRACT..

The MMC Active Directory Users and Computers snap in presumably
objected to the 'loop' this would present. The fixed entry is:

objectClasses: ( 2.5.6.0 NAME 'top' ABSTRACT

Thanks to Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de> for his
persistance in getting me to look at this.

Andrew Bartlett
(This used to be commit 937b466266)
2008-09-09 16:21:22 +10:00
Andrew Bartlett
3d3fc7bdaa Stop every ldb startup doing a write to the database.
Something in the search stack adds a distinguisedName record, which
isn't in the message we generate.  So we compare, fail and rewrite the
record - every time ldb starts up...

Andrew Bartlett
(This used to be commit 44775d1ed4)
2008-08-21 16:42:03 +10:00
Andrew Bartlett
fa3f3bee83 Set both attributes and indexes into the database on schema load.
This ensures that a rudementary schema is always present (for
bootstrapping), and that the indexes are maintained equal to the
schema (rather than hard-coded).

Andrew Bartlett
(This used to be commit 747d683b0d)
2008-08-21 12:58:00 +10:00
Andrew Bartlett
6e5f2454ac Apply attributes (and their syntax) from the schema into ldb
This changes the @ATTRIBUTES record to be for bootstrapping only,
before we find the schema.

Andrew Bartlett
(This used to be commit 358477fcc0)
2008-08-20 15:46:46 +10:00
Andrew Bartlett
18e86ccf86 Split schema_init.c into smaller bits.
This should make schema manipulation a little easier to follow.

Andrew Bartlett
(This used to be commit 300ed83526)
2008-08-20 13:22:16 +10:00
Andrew Bartlett
bb80a19714 Note the ldb syntax for attribute syntaxes in the table.
This includes additional Samba-specific syntaxes made available from
the ldif_handlers code.

This commit also changes some table to use #defines, to ensure
consistancy in other parts of the code.

Andrew Bartlett
(This used to be commit e26a5efd9a)
2008-08-18 20:30:27 +10:00
Andrew Bartlett
dbde9cbea0 Fix segfaults when loading the schema fails.
(This used to be commit 9643db1a01)
2008-08-18 20:20:24 +10:00
Andrew Bartlett
46c94dd8b2 Merge the two attribute syntax tables.
This merges the table once found in the oLschema2ldif tool (and moved
many times) with the table used for DRSUAPI.

The OpenLDAP schema map has been updated, to ensure that despite a
number of attributes being declared as OIDs, they are actually used as
strings (as they are actually LDAP class/attribute names).

Andrew Bartlett
(This used to be commit 61f2958c84)
2008-08-18 10:16:45 +10:00
Andrew Bartlett
16112762e7 Generate the subSchema in cn=Aggregate
This reads the schema from the in-memory structure, when the magic
attributes are requested.  The code is a modified version of that used
in the ad2oLschema tool (now shared).

The schema_fsmo module handles the insertion of the generated result.

As such, this commit also removes these entries from the setup/schema.ldif

Metze's previous stub of this functionality is also removed.

Andrew Bartlett
(This used to be commit c7c32ec7b4)
2008-08-15 20:40:57 +10:00
Andrew Bartlett
5971fd6b9c Fix warnings in new prefixMap code
(This used to be commit b8770a4fd8)
2008-07-28 08:02:18 +10:00
Stefan Metzmacher
2385e33095 dsdb/schema: make more clear where we create the value for the new prefix mapping
metze
(This used to be commit c92eb8b776)
2008-07-26 21:45:22 +02:00
Stefan Metzmacher
118ecc54ba dsdb/schema: dsdb_write_prefixes_to_ldb() should do the reverse of dsdb_read_prefixes_to_ldb()
metze
(This used to be commit 34ea9d4a0b)
2008-07-26 21:45:15 +02:00
Andrew Bartlett
1f285560bc Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into 4-0-local
(This used to be commit b12dd8ee54)
2008-07-25 11:58:51 +10:00
Andrew Bartlett
404846d887 Try to avoid a memory leak if we re-set the global schema
However, try also not to pull a schema out from under a running ldb
session.

Andrew Bartlett
(This used to be commit 7cf9b9dd0b)
2008-07-25 11:58:24 +10:00
Anatoliy Atanasov
05583308fe dsdb_create_prefix_mapping() implementation checks for existing prefix maping in ldb.
if one not found it creates a mapping for it and updates the prefixMap schema attribute in ldb.
(This used to be commit bbe895db71)
2008-07-24 11:54:38 +10:00
Andrew Bartlett
b4691ad560 Use common code to fill in allowedAttributes in kludge_acl.
This code is now in common with ad2oLschema.

Andrew Bartlett
(This used to be commit 0a797388ca)
2008-07-11 15:11:32 +10:00
Andrew Bartlett
83d90d6cd6 Make ad2oLschema even simpler, by moving the heavy work into dsdb.
This will allow the kludge_acl and schema code to leverage the same
work.  (We might even get schema validation soon! :-)

Andrew Bartlett
(This used to be commit cecd04ce1f)
2008-07-10 15:52:44 +10:00
Andrew Bartlett
7e851ada55 Move ad2oLschema and oLschema2ldif into Samba4, out of LDB
LDB does not know about nor process the AD schema, so it makes no
sense to have this tool there.  I've been changing it anyway, to use a
common schema manipulation library, and will enhance these links in
the future.

Andrew Bartlett
(This used to be commit c7704805b9)
2008-07-02 21:30:08 +10:00
Andrew Bartlett
fe174cc141 Fill in the auxiliary classes into the dsdb_schema.
Andrew Bartlett
(This used to be commit 615564b3da)
2008-07-02 15:19:49 +10:00
Stefan Metzmacher
2a918a353f schema_fsmo: prepare auto allocation of schema oid prefixes
This implements the logic in the schema_fsmo_add() function,
but it only calls a dummy dsdb_create_prefix_mapping() yet.

metze
(This used to be commit 9018b85e83)
2008-07-01 17:58:47 +02:00
Stefan Metzmacher
db0a105aae schema_fsmo: move fsmo info into struct dsdb_schema
metze
(This used to be commit 8538d305c8)
2008-07-01 16:55:43 +02:00
Andrew Bartlett
7e0ef3fd0e Make Samba4 pass the NET-API-BECOMEDC test against Win2k3 (again).
To make Samba4, using the python provision system, pass this test
required some major rework.  Untested code is broken code, and some of
the refactoring for a seperate provision test (which also now passes)
broke things.

Similarly, the iconv work has compiled, but these codepaths have never
been run (NULL pointer de-reference).

In working to use a local, rather than global, loadparm context, and
to support using a target directory, a few things needed to be
reworked, particularly around path handling.

Andrew Bartlett
(This used to be commit 1169e8d7be)
2008-03-06 21:55:26 +11:00
Jelmer Vernooij
b617f58cc3 Fix accidently introduced bug - thanks metze.
(This used to be commit d0dfdab85a)
2008-02-19 14:25:20 +01:00
Jelmer Vernooij
7d5987c2e0 Remove uses of global_loadparm.
(This used to be commit 138aaef078)
2008-02-19 13:39:27 +01:00
Andrew Bartlett
8bceed449d Fix segfaults in codepaths only tested by the NET-API-BECOME-DC test.
(I presume this has resulted from the global variable elimination)

Perhaps the iconv handle argument to ndr_push_struct needs to be
marked as 'not NULL' or similar?

Andrew Bartlett
(This used to be commit e8081333b8)
2008-01-23 15:34:44 +11:00
Andrew Bartlett
4d58fc88cb r26697: Leak less memory into the ldb context.
(Trying to chase down memory leaks in provision)

Andrew Bartlett
(This used to be commit a0cf47c335)
2008-01-08 23:42:02 -06:00
Jelmer Vernooij
dcc282590b r26654: libcli/smb_composite: Rather than specifying each of the gazillion options for SMB individually, just specify the smbcli_options struct.
(This used to be commit 8a97886e24)
2008-01-03 12:33:36 -06:00
Jelmer Vernooij
7d5f0e0893 r26639: librpc: Pass iconv convenience on from RPC connection to NDR library, so it can be overridden by OpenChange.
(This used to be commit 2f29f80e07)
2008-01-01 16:12:15 -06:00
Jelmer Vernooij
86dc05e99f r26638: libndr: Require explicitly specifying iconv_convenience for ndr_struct_push_blob().
(This used to be commit 61ad78ac98)
2008-01-01 16:12:11 -06:00
Jelmer Vernooij
0500b87092 r26540: Revert my previous commit after concerns raised by Andrew.
(This used to be commit 6ac86f8be7)
2007-12-21 05:52:06 +01:00
Jelmer Vernooij
3e75f222bc r26539: Remove unnecessary statics.
(This used to be commit e53e79eebe)
2007-12-21 05:52:05 +01:00
Kai Blin
1cd5cc6e65 r26528: dsdb: Fix a warning.
(This used to be commit 41a1f59850)
2007-12-21 05:51:51 +01:00
Jelmer Vernooij
71e2cafe96 r26483: Merge ldb module dependency fixes, fix auth python module.
(This used to be commit 85eeecf997)
2007-12-21 05:50:41 +01:00
Jelmer Vernooij
d891c0c74a r26429: Avoid use of global_smb_iconv_convenience.
(This used to be commit d37136b7ab)
2007-12-21 05:49:56 +01:00
Andrew Bartlett
a7f008a939 r26412: Add comments and refactor to reuse common code.
Andrew Bartlett
(This used to be commit a8b0f5af9a)
2007-12-21 05:49:43 +01:00
Jelmer Vernooij
39ee38d9c1 r26316: Use contexts for conversion functions.
(This used to be commit f6420d933b)
2007-12-21 05:48:30 +01:00
Stefan Metzmacher
529763a9aa r25920: ndr: change NTSTAUS into enum ndr_err_code (samba4 callers)
lib/messaging/
lib/registry/
lib/ldb-samba/
librpc/rpc/
auth/auth_winbind.c
auth/gensec/
auth/kerberos/
dsdb/repl/
dsdb/samdb/
dsdb/schema/
torture/
cluster/ctdb/
kdc/
ntvfs/ipc/
torture/rap/
ntvfs/
utils/getntacl.c
ntptr/
smb_server/
libcli/wrepl/
wrepl_server/
libcli/cldap/
libcli/dgram/
libcli/ldap/
libcli/raw/
libcli/nbt/
libnet/
winbind/
rpc_server/

metze
(This used to be commit 6223c7fddc)
2007-12-21 05:45:02 +01:00
Andrew Bartlett
605032d997 r25786: Add function required by linked_attributes module (We need a list of
all linked attributes in the schema, so we can try and find them).

Andrew Bartlett
(This used to be commit 9cc706e060)
2007-12-21 05:43:58 +01:00
Andrew Bartlett
bb96624d68 r25749: Add function required by linked_attributes module.
Andrew Bartlett
(This used to be commit cd64094787)
2007-12-21 05:43:42 +01:00
Jelmer Vernooij
05e7c48146 r25553: Convert to standard bool type.
(This used to be commit b7371f1a19)
2007-10-10 15:07:54 -05:00
Jelmer Vernooij
cd962355ab r25000: Fix some more C++ compatibility warnings.
(This used to be commit 08bb1ef643)
2007-10-10 15:05:27 -05:00
Jelmer Vernooij
61ffa08f4c r24712: No longer expose the 'BOOL' data type in any interfaces.
(This used to be commit 1ce32673d9)
2007-10-10 15:02:54 -05:00
Andrew Bartlett
dfa4e5f784 r24631: Fix up format warnings, found on my Fedora 7 x86_64 workstation.
Andrew Bartlett
(This used to be commit 3d74d178bf)
2007-10-10 15:02:27 -05:00