summaryrefslogtreecommitdiff
path: root/source4/dsdb/schema/schema_query.c
AgeCommit message (Collapse)AuthorFilesLines
2024-06-24s4:dsdb: Avoid possible underflows with new_lenAndreas Schneider1-1/+1
Found by Covscan. "Error: INTEGER_OVERFLOW (CWE-190): samba-4.20.0rc2/source4/dsdb/schema/schema_query.c:403: tainted_data_argument: The check ""i < new_len"" contains the tainted expression ""i"" which causes ""new_len"" to be considered tainted. samba-4.20.0rc2/source4/dsdb/schema/schema_query.c:407: overflow: The expression ""new_len - i"" is deemed underflowed because at least one of its arguments has underflowed. samba-4.20.0rc2/source4/dsdb/schema/schema_query.c:407: overflow: The expression ""(new_len - i) * 8UL"" is deemed underflowed because at least one of its arguments has underflowed. samba-4.20.0rc2/source4/dsdb/schema/schema_query.c:407: overflow_sink: ""(new_len - i) * 8UL"", which might have underflowed, is passed to ""memmove(val1, val2, (new_len - i) * 8UL)"". [Note: The source code implementation of the function has been overridden by a builtin model.] 405| const char **val2 = &attr_list[i]; 406| if (ldb_attr_cmp(*val1, *val2) == 0) { 407|-> memmove(val1, val2, (new_len - i) * sizeof( *attr_list)); 408| attr_list[new_len-1] = NULL; 409| new_len--;" Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
2024-06-24s4:dsdb: Remove trailing spaces in schema_query.cAndreas Schneider1-36/+36
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
2024-05-22s4:dsdb:strcasecmp_with_ldb_val() avoids overflowDouglas Bagnall1-1/+3
In the unlikely event that strlen(str) > INT_MAX, the result could have overflowed. This is not a sort transitivity issue, as this is not a symmetric sort comparison, but it would affect binary search reliability. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-08-03s4:dsdb:schema: Fix code spellingAndreas Schneider1-2/+2
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2023-03-31s4:dsdb/schema: Add dsdb_attribute_by_cn_ldb_val()Joseph Sutton1-0/+10
This looks up a schema attribute by its CN, similar to dsdb_class_by_cn_ldb_val(). Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-08-28lib/util: remove extra safe_string.h fileMatthew DeVore1-0/+3
lib/util/safe_string.h is similar to source3/include/safe_string.h, but the former has fewer checks. It is missing bcopy, strcasecmp, and strncasecmp. Add the missing elements to lib/util/safe_string.h remove the other safe_string.h which is in the source3-specific path. To accomodate existing uses of str(n?)casecmp, add #undef lines to source files where they are used. Signed-off-by: Matthew DeVore <matvore@google.com> Reviewed-by: David Mulder <dmulder@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Fri Aug 28 02:18:40 UTC 2020 on sn-devel-184
2020-08-17Fix a comment typo copied aroundVolker Lendecke1-1/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-08s4/dsdb/schema: clang: Fix Array access results in null pointer derefNoel Power1-1/+3
Fixes: source4/dsdb/schema/schema_query.c:223:15: warning: Array access (from variable 'attr_list') results in a null pointer dereference <--[clang] attr_list[i] = NULL; ~~~~~~~~~ ^ 1 warning generated. Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2019-05-22dsdb: Remove unsued dsdb_class_by_cn()Andrew Bartlett1-10/+0
The callers moved to dsdb_class_by_cn_ldb_val() with 43aa546ecc3f05845793b1a7354685d50a77c170 in 2009. Found by callcatcher Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2016-09-28werror: replace WERR_NOMEM with WERR_NOT_ENOUGH_MEMORY in source4/dsdb/Günther Deschner1-1/+1
Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2016-05-10dsdb schema_query: reduce calls to str_list_lengthDouglas Bagnall1-6/+7
We were calling str_list_length(new_attrs) three times when one is enough. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2016-02-06dlist: remove unneeded type argument from DLIST_ADD_END()Michael Adam1-4/+4
Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2012-08-22s4:dsdb_sort_objectClass_attr - simplify memory context handlingMatthias Dieter Wallnöfer1-9/+19
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-22s4:dsdb_sort_objectClass_attr - use "data_blob_string_const" for setting valuesMatthias Dieter Wallnöfer1-6/+1
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-04-11s4:dsdb - move "objectclass_sort()" out from the objectclass LDB module into ↵Matthias Dieter Wallnöfer1-0/+164
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-11s4:schema/schema_query.c - fix a commentMatthias Dieter Wallnöfer1-1/+1
2010-11-08s4-attid: Uppercase ATTID type constantsKamen Mazdrashki1-1/+1
Thanks Metze for noting this! Autobuild-User: Kamen Mazdrashki <kamenim@samba.org> Autobuild-Date: Mon Nov 8 23:06:41 UTC 2010 on sn-devel-104
2010-06-21s4/dsdb-schema: Index attributes on msDS-IntId valueKamen Mazdrashki1-5/+3
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-03-07s4:schema - Change also here counters to "unsigned" where neededMatthias Dieter Wallnöfer1-6/+6
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-02-13s4-dsdb: use TYPESAFE_QSORT() in dsdb codeAndrew Tridgell1-7/+3
2010-01-08s4-schema: added dsdb_attribute_by_lDAPDisplayName_ldb_valAndrew Tridgell1-0/+12
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2010-01-08s4-schema: make ldb_val to string comparison safer with nul terminationAndrew Tridgell1-1/+8
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2010-01-08s4/dsdb_schema: use msDS-IntId value for attribute look-upKamen Mazdrashki1-0/+9
2009-12-21s4-schema: a unsigned comparison bug in the schema codeAndrew Tridgell1-1/+2
2009-12-15Fixed a problem with duplicate values of allowedAttributesEffective.Nadezhda Ivanova1-1/+10
2009-12-10s4-schema: use binsearch.hAndrew Tridgell1-48/+21
2009-11-05Version 1.0 of the directory service acls module.Nadezhda Ivanova1-2/+12
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-09-21Initial Implementation of the DS objects access checks.Nadezhda Ivanova1-0/+12
Currently disabled. The search will be greatly modified, also the object tree stuff will be simplified.
2009-08-24s4:dsdb Add constAndrew Bartlett1-2/+2
2009-08-05s4:dsdb Don't cast an ldb_val into a const char * for schema lookupsAndrew Bartlett1-28/+115
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-04-02major upgrade to the ldb attribute handlingAndrew Tridgell1-79/+66
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-02-02s4:dsdb/schema: s/class/sclassStefan Metzmacher1-18/+18
metze
2008-12-23Fix more compiler warnings in various places.Jelmer Vernooij1-19/+19
2008-08-20Split schema_init.c into smaller bits.Andrew Bartlett1-0/+344
This should make schema manipulation a little easier to follow. Andrew Bartlett (This used to be commit 300ed83526e75d834bd23ddd1c1c26ebe2555e0f)