1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-21 18:04:06 +03:00

95 Commits

Author SHA1 Message Date
Andrew Tridgell
282cc79454 s4-ldb: use TYPESAFE_QSORT() in the rest of the ldb code 2010-02-14 18:44:20 +11:00
Andrew Tridgell
39a4e2a38d s4-ldb: validate the type of the ldb argument to ldb_dn_new()
It has been a common bug to get the first two arguments the wrong way
around
2010-01-09 10:15:12 +11:00
Andrew Tridgell
82bf0d8bc6 s4-dsdb: added ldb_dn_update_components()
This is used to udpate just the DN components of a ldb_dn, leaving the
other extended fields alone. It is needed to prevent linked attribute
updates from removing other extended components.

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2009-12-18 21:03:39 +11:00
Andrew Tridgell
0d76df9953 s4-ldb: added a function to filter extended components of a ldb_dn
We need to be able to filter out components that should not be exposed
to users
2009-12-14 22:29:57 +11:00
Andrew Tridgell
56b90acbf6 s4-ldb: sort the linearized extended DN by component name
This will make life easier when handling deleted linked attributes
2009-12-14 22:29:57 +11:00
Andrew Tridgell
c59372b0b8 s4-ldb: fixed 2 bugs in ldb_dn_set_extended_component()
The first bug was that setting a component twice could cause it to
appear twice in the DN.

The second bug was that using an existing ldb_val from a previous call
of ldb_dn_get_extended_component() as an argument to
ldb_dn_set_extended_component() would cause a valgrind error (as the
array the val pointed into will change).
2009-12-10 17:51:30 +11:00
Andrew Tridgell
215cc5a9ed s4-ldb: use GUID_to_ndr_blob() 2009-12-10 17:51:29 +11:00
Andrew Tridgell
dbae29de1c s4-ldb: make DN escaping/unescaping consistent
The DN escape function was using the form \c where c is any
character. The unescape function was using \XX where XX is a 2 digit
hex number. The asymmetry led to quite a few problems when we start to
deal with DNs containing escape chars, such as CN=foo\0ADEL:XXX. The
result was a DN that was not accessible.

This patch changes the escaping to follow RFC2253 much more
closely. We accept either type of escape, and produce the two types of
escape, depending on the character being escaped
2009-11-13 19:32:46 +11:00
Andrew Bartlett
5940ca60e2 s4:ldb Don't segfault if we somehow get an unknown extended dn element 2009-11-12 16:34:14 +11:00
Andrew Bartlett
f5890ddd83 s4:ldb Remove DN+Binary code from the core ldb_dn
This is now in dsdb_dn.  Removing this to a specific wrapper avoids a
number of bugs where Binary DNs were being handled incorrectly.

This reverts much of tridge's commit
fd22e0304782e20b9bbb29464b6c745d409ff4c6

Andrew Bartlett
2009-11-12 16:34:05 +11:00
Andrew Tridgell
6afac82e4b s4-ldb: '+' can also happen in base64 encoded index DNs 2009-10-27 11:44:05 +11:00
Andrew Tridgell
12c9af7817 s4-ldb: allow for unescaped '=' in a index DN
The ldb_dn_explode code normally enforces all special characters,
including a '=', must be escaped. Unfortunately this conflicts with
the ltdb index DNs, which for binary attributes may be base64
encoded. This allows a unescaped '=' as a special case for index DNs.
2009-10-25 22:02:31 +11:00
Andrew Tridgell
1467e5eaab s4-ldb: allow for non-null terminated ldb_val in ldb_dn_from_ldb_val
The strlen() could go past the end of a non-null terminated value
2009-10-21 22:43:58 +11:00
Andrew Tridgell
4185e376f5 s4-ldb: removed bugus RDN length check
This isn't the rDN !
2009-10-15 10:01:10 +11: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
Anatoliy Atanasov
68f33428c7 Move the check above the talloc 2009-09-22 14:46:18 -07:00
Anatoliy Atanasov
b850d7fb08 Add support in the ldb_dn.c code for MS-ADTS:3.1.1.5.1.2 Naming Constraints 2009-09-21 17:18:10 -07:00
Simo Sorce
185d06e122 ldb: cosmetic changes in ldb_dn
- remove trailing spaces and tabs
- shorten some variable names for readability
- try to break superlong lines for readability
2009-08-30 17:49:37 -04:00
Andrew Tridgell
7f16c29f10 when comp_num is zero, the case folded DN is always ""
This fixes a bug where we would look at an uninitialised
dn->linearized
2009-06-01 12:58:48 +10:00
Simo Sorce
380874ef86 Fix the mess with ldb includes.
Separate again the public from the private headers.

Add a new header specific for modules.
Also add service function for modules as now ldb_context and ldb_module are
opaque structures for them.
2009-01-30 01:02:03 -05:00
Matthias Dieter Wallnöfer
dde0964d72 Small cosmetic LDB patch regarding return values.
It changes some "return 0" in "return LDB_SUCCESS"
2008-12-19 09:54:20 -05:00
Andrew Bartlett
aa3eab70d5 s4:ldb: add infrastructure for extended dn handlers
This introduces a new set of pluggable syntax, for use on the
extended DN, and uses them when parsing the DN.

If the DN appears to be in the extended form, we no longer return the
full DN 'as is', but only return the normal part from
ldb_dn_get_linearized().

When validating/parsing the DN we validate not only the format of the
DN, but also the contents of the GUID or SID (to ensure they are
plausable).

We also have functions to set and get the extended components on the DN.

For now, extended_dn_get_linearized() returns a newly constructed and
allocated string each time.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2008-12-17 12:29:23 +11:00
Simo Sorce
9da4c3f830 Revert "Length comparison of the linearized version is not correct."
This reverts commit 753af36a3e194f645ec0b68a033199035e71c909.
2008-10-30 08:28:07 -04:00
Simo Sorce
753af36a3e Length comparison of the linearized version is not correct.
The linearized version is not casefolded so length might not match
and yet the strings be equivalent. This can happen if one component
is case-insensitive and a letter that have an uppercase version of
a multibyte character that differ in legth from the corresponding
lowercase one.
2008-10-29 18:07:29 -04:00
Stefan Metzmacher
5fc7fb48a0 s4:lib/ldb: fix stupid <SID=...> dn parsing bugs
metze
2008-10-02 11:41:10 +02:00
Andrew Bartlett
4ad97a1d05 Don't walk past the end of ldb values.
This is a partial fix towards bugs due to us walking past the end of
what we think are strings in ldb.  There is much more work to do in
this area.

Andrew Bartlett
(This used to be commit 5805a9a8f35fd90fa4f718f73534817fa3bbdfd2)
2008-08-21 19:24:58 +10:00
Jelmer Vernooij
957af15e4b r25630: Allow "NULL" as memory context, for consistency with the rest of the code,
which also does.
(This used to be commit 083b606496308741958bb9fc6b3e50a582857677)
2007-12-21 05:43:02 +01:00
Stefan Metzmacher
c364bbbfa3 r25215: replace talloc_append_string() with talloc_strdup_append_buffer()
metze
(This used to be commit 8f2db3c130ce85d38f805836a7df039822ede066)
2007-10-10 15:06:55 -05:00
Andrew Tridgell
6c973f4e8c r23798: updated old Temple Place FSF addresses to new URL
(This used to be commit 40c0919aaa9c1b14bbaebb95ecce53eb0380fdbb)
2007-10-10 14:59:15 -05:00
Andrew Tridgell
b8d69a7ea2 r23795: more v2->v3 conversion
(This used to be commit 84b468b2f8f2dffda89593f816e8bc6a8b6d42ac)
2007-10-10 14:59:14 -05:00
Simo Sorce
31d28c5b8c r22696: Make sure this is an ascii char
spotted by Volker
(This used to be commit e24812016f60f506f0df2cb5ba8c2c6987f7da40)
2007-10-10 14:52:02 -05:00
Volker Lendecke
d6121458b0 r22694: It seems that AIX 5.3 with XLC has difficulties with <ctype.h>. This is
an attempt to work around this: Maybe it helps if we include other stuff
first.

This raises a question however: Do we want the DN handling to be locale
dependent? isalpha() can return different things depending on the
current locale.
(This used to be commit 75ba82dee052fa5f4141e66e1cb748101aa95d71)
2007-10-10 14:52:02 -05:00
Jelmer Vernooij
52fb06edc2 r22681: Fix standalone ldb build when parent directory name != ldb.
(This used to be commit 1093875d59f1ea9b8bd82277d4f9d8366e584952)
2007-10-10 14:52:00 -05:00
Stefan Metzmacher
784f11bd85 r20952: when a component is changed we need to rebuild the linearized string
metze
(This used to be commit beb816fb78ec4a7816680611af6619740e159424)
2007-10-10 14:43:59 -05:00
Andrew Bartlett
c8fd1a6f2e r20373: When adding a base to a "" DN, don't precede it with a comma (,)
Andrew Bartlett
(This used to be commit ef1ca30180b1b225579a8200b65a4853a135602f)
2007-10-10 14:30:18 -05:00
Stefan Metzmacher
c69717755a r20184: change ldb_attrib_handler into ldb_schema_attribute, which has a pointer
to a ldb_schema_syntax struct.

the default attribute handler is now registered dynamicly as "*"
attribute, instead of having its own code path.

ldb_schema_attribute's can be added to the ldb_schema given a
ldb_schema_syntax struct or the syntax name

we may also need to introduce a ldb_schema_matching_rule,
and add a pointer to a default ldb_schema_matching_rule
in the ldb_schema_syntax.

metze
(This used to be commit b97b8f5dcbce006f005e53ca79df3330e62f117b)
2007-10-10 14:29:19 -05:00
Stefan Metzmacher
2f1fa42fe8 r20023: handle <SID=...> <WKGUID=...> dn's also in ldb_dn_new_fmt()
metze
(This used to be commit 01e3a5080a38c93c4bbf249b03135314b7e0b3f1)
2007-10-10 14:28:48 -05:00
Stefan Metzmacher
8534186530 r19954: allow more special dn's:
this works now against w2k3:

bin/ldbedit -U administrator%test -H ldap://w2k3-101/ -b "<GUID=44087590-dd95-435c-adc1-ec20a50807be>" -s base
bin/ldbedit -U administrator%test -H ldap://w2k3-101/ -b "<SID=S-1-5-21-769185814-1958994947-1641909093-513>" -s base
bin/ldbedit -U administrator%test -H ldap://w2k3-101/ -b "<WKGUID=AB8153B7768811D1ADED00C04FD8D5CD,DC=w2k3,dc=vmnet1,dc=vm,dc=base>" -s base

and we should try to implement this in the server too...

metze
(This used to be commit 3c087c89707398d88799367240fe4e6f8b192bb4)
2007-10-10 14:28:40 -05:00
Simo Sorce
921a596cd4 r19910: Make better use of our set of talloc utility functions
(This used to be commit b1197dbeebff062b8ea1e8466d436be82b0b61e0)
2007-10-10 14:28:35 -05:00
Volker Lendecke
eee64196a3 r19901: Fix a potential NULL dereference
(This used to be commit 75e6fb9654f10a076ed49b0582b40368e149d30a)
2007-10-10 14:28:33 -05:00
Simo Sorce
5b258c3b9d r19887: return "" string only if the dn is a valid one
(This used to be commit 056f90798f6d2cea1debc50f31fea3d740c4a837)
2007-10-10 14:28:32 -05:00
Stefan Metzmacher
6d074bcd4b r19885: special dn's were not casefolded before rev 19831,
act like this again...

also when we already have a casefoled value we should not call ldb_dn_casefold_internal()

metze
(This used to be commit cbf4eb16725992bfdfa5a334e0e5547e6df568e6)
2007-10-10 14:28:32 -05:00
Simo Sorce
f4e6be00ac r19871: simplify more
(This used to be commit e9ddb18c83518703f987bf141807639956612dbf)
2007-10-10 14:28:29 -05:00
Simo Sorce
5ab439893b r19870: Simplify code
(This used to be commit c1737f9a52d9e4d118f969a0953a458188143d0d)
2007-10-10 14:28:28 -05:00
Simo Sorce
353b968025 r19869: fix memleaks
(This used to be commit 3a662a2d985bf801284c5dc1123dec6705e6d092)
2007-10-10 14:28:28 -05:00
Simo Sorce
a9e31b33b5 r19832: better prototypes for the linearization functions:
- ldb_dn_get_linearized
  returns a const string

- ldb_dn_alloc_linearized
  allocs astring with the linearized dn
(This used to be commit 3929c086d5d0b3f08b1c4f2f3f9602c3f4a9a4bd)
2007-10-10 14:28:22 -05:00
Simo Sorce
4889eb9f7a r19831: Big ldb_dn optimization and interfaces enhancement patch
This patch changes a lot of the code in ldb_dn.c, and also
removes and add a number of manipulation functions around.

The aim is to avoid validating a dn if not necessary as the
validation code is necessarily slow. This is mainly to speed up
internal operations where input is not user generated and so we
can assume the DNs need no validation. The code is designed to
keep the data as a string if possible.

The code is not yet 100% perfect, but pass all the tests so far.
A memleak is certainly present, I'll work on that next.

Simo.
(This used to be commit a580c871d3784602a9cce32d33419e63c8236e63)
2007-10-10 14:28:22 -05:00
Stefan Metzmacher
a39db63030 r19719: don't use 'new' as var name samba3 doesn't like it...
metze
(This used to be commit 7a4f46c1c9ec8119db46ffc57d77fcf13ca0c5a8)
2007-10-10 14:28:13 -05:00
Simo Sorce
b7774527fa r19531: Make struct ldb_dn opaque and local to ldb_dn.c
(This used to be commit 889fb983ba1cf8a11424a8b3dc3a5ef76e780082)
2007-10-10 14:24:44 -05:00
Andrew Tridgell
5535b43efd r19361: added a comment
(This used to be commit 1581babfb5a5bbbfc2706dbec9b37b03fe9a5af6)
2007-10-10 14:21:16 -05:00