1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00
Commit Graph

165 Commits

Author SHA1 Message Date
Andrew Tridgell
ff8ad222cd 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 18:45:42 -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