diff options
author | Matthieu Patou <mat@matws.net> | 2010-08-15 18:31:28 +0400 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2010-10-03 01:15:04 +0000 |
commit | ab6e3fce040f9ad27cbce44e9038a24f15b601c8 (patch) | |
tree | ab99a431c9610927b5d0d26335d2712b509fd6dc /source4/heimdal/lib/wind | |
parent | 197a1514d62494cc8b862d169c841a26e04b8925 (diff) | |
download | samba-ab6e3fce040f9ad27cbce44e9038a24f15b601c8.tar.gz samba-ab6e3fce040f9ad27cbce44e9038a24f15b601c8.tar.bz2 samba-ab6e3fce040f9ad27cbce44e9038a24f15b601c8.zip |
s4:heimdal: import lorikeet-heimdal-201009250123 (commit 42cabfb5b683dbcb97d583c397b897507689e382)
I based this on Matthieu's import of lorikeet-heimdal, and then
updated it to this commit.
Andrew Bartlett
Diffstat (limited to 'source4/heimdal/lib/wind')
-rw-r--r-- | source4/heimdal/lib/wind/errorlist.c | 2 | ||||
-rw-r--r-- | source4/heimdal/lib/wind/normalize.c | 31 | ||||
-rw-r--r-- | source4/heimdal/lib/wind/stringprep.py | 4 | ||||
-rw-r--r-- | source4/heimdal/lib/wind/wind.h | 1 |
4 files changed, 30 insertions, 8 deletions
diff --git a/source4/heimdal/lib/wind/errorlist.c b/source4/heimdal/lib/wind/errorlist.c index b2e2210493..c2907832a2 100644 --- a/source4/heimdal/lib/wind/errorlist.c +++ b/source4/heimdal/lib/wind/errorlist.c @@ -49,7 +49,7 @@ error_entry_cmp(const void *a, const void *b) } int -_wind_stringprep_error(uint32_t cp, wind_profile_flags flags) +_wind_stringprep_error(const uint32_t cp, wind_profile_flags flags) { struct error_entry ee = {cp}; const struct error_entry *s; diff --git a/source4/heimdal/lib/wind/normalize.c b/source4/heimdal/lib/wind/normalize.c index 102c577e66..3c68ea8660 100644 --- a/source4/heimdal/lib/wind/normalize.c +++ b/source4/heimdal/lib/wind/normalize.c @@ -164,13 +164,32 @@ compat_decomp(const uint32_t *in, size_t in_len, return 0; } -static int -cc_cmp(const void *a, const void *b) +static void +swap_char(uint32_t * a, uint32_t * b) +{ + uint32_t t; + t = *a; + *a = *b; + *b = t; +} + +/* Unicode 5.2.0 D109 Canonical Ordering for a sequence of code points + * that all have Canonical_Combining_Class > 0 */ +static void +canonical_reorder_sequence(uint32_t * a, size_t len) { - const uint32_t *ua = (const uint32_t *)a; - const uint32_t *ub = (const uint32_t *)b; + size_t i, j; - return _wind_combining_class(*ua) - _wind_combining_class(*ub); + if (len <= 1) + return; + + for (i = 1; i < len; i++) { + for (j = i; + j > 0 && + _wind_combining_class(a[j]) < _wind_combining_class(a[j-1]); + j--) + swap_char(&a[j], &a[j-1]); + } } static void @@ -186,7 +205,7 @@ canonical_reorder(uint32_t *tmp, size_t tmp_len) j < tmp_len && _wind_combining_class(tmp[j]); ++j) ; - qsort(&tmp[i], j - i, sizeof(tmp[0]), cc_cmp); + canonical_reorder_sequence(&tmp[i], j - i); i = j; } } diff --git a/source4/heimdal/lib/wind/stringprep.py b/source4/heimdal/lib/wind/stringprep.py index d64686a252..249b1dc2a1 100644 --- a/source4/heimdal/lib/wind/stringprep.py +++ b/source4/heimdal/lib/wind/stringprep.py @@ -46,7 +46,8 @@ ldap_error = ['A.1', 'C.3', 'C.4', 'C.5', 'C.8', 'rfc4518-error' ] sasl_error = ['C.1.2', 'C.2.1', 'C.2.2', 'C.3', 'C.4', 'C.5', 'C.6', 'C.7', 'C.8', 'C.9'] name_map = ['B.1', 'B.2'] -ldap_map = ['rfc4518-map', 'B.2'] +ldap_map = ['rfc4518-map'] +ldap_case_map = ['rfc4518-map', 'B.2'] sasl_map = ['C.1.2', 'B.1'] def symbols(tabledict, tables): @@ -69,6 +70,7 @@ def get_maplist(): d = dict() _merge_table(d, dict(map(lambda x: [x, ['name']], name_map))) _merge_table(d, dict(map(lambda x: [x, ['ldap']], ldap_map))) + _merge_table(d, dict(map(lambda x: [x, ['ldap_case']], ldap_case_map))) _merge_table(d, dict(map(lambda x: [x, ['sasl']], sasl_map))) return d diff --git a/source4/heimdal/lib/wind/wind.h b/source4/heimdal/lib/wind/wind.h index e890bebeee..dd55ea35db 100644 --- a/source4/heimdal/lib/wind/wind.h +++ b/source4/heimdal/lib/wind/wind.h @@ -46,6 +46,7 @@ typedef unsigned int wind_profile_flags; #define WIND_PROFILE_NAME 0x00000001 #define WIND_PROFILE_SASL 0x00000002 #define WIND_PROFILE_LDAP 0x00000004 +#define WIND_PROFILE_LDAP_CASE 0x00000008 #define WIND_PROFILE_LDAP_CASE_EXACT_ATTRIBUTE 0x00010000 #define WIND_PROFILE_LDAP_CASE_EXACT_ASSERTION 0x00020000 |