summaryrefslogtreecommitdiff
path: root/source4/lib/ldb
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/ldb')
-rw-r--r--source4/lib/ldb/common/attrib_handlers.c3
-rw-r--r--source4/lib/ldb/common/ldb_dn.c2
-rw-r--r--source4/lib/ldb/common/ldb_parse.c12
-rw-r--r--source4/lib/ldb/common/ldb_utf8.c5
4 files changed, 12 insertions, 10 deletions
diff --git a/source4/lib/ldb/common/attrib_handlers.c b/source4/lib/ldb/common/attrib_handlers.c
index 7f71d3574a..da2d945419 100644
--- a/source4/lib/ldb/common/attrib_handlers.c
+++ b/source4/lib/ldb/common/attrib_handlers.c
@@ -128,7 +128,8 @@ static int ldb_comparison_fold(struct ldb_context *ldb, void *mem_ctx,
while (*s2 == ' ') s2++;
/* TODO: make utf8 safe, possibly with helper function from application */
while (*s1 && *s2) {
- if (toupper(*s1) != toupper(*s2)) break;
+ if (toupper((unsigned char)*s1) != toupper((unsigned char)*s2))
+ break;
if (*s1 == ' ') {
while (s1[0] == s1[1]) s1++;
while (s2[0] == s2[1]) s2++;
diff --git a/source4/lib/ldb/common/ldb_dn.c b/source4/lib/ldb/common/ldb_dn.c
index b421a7fe75..32b575dd36 100644
--- a/source4/lib/ldb/common/ldb_dn.c
+++ b/source4/lib/ldb/common/ldb_dn.c
@@ -47,7 +47,7 @@ static int ldb_dn_is_valid_attribute_name(const char *name)
if (! isascii(*name)) {
return 0;
}
- if (! (isalnum(*name) || *name == '-')) {
+ if (! (isalnum((unsigned char)*name) || *name == '-')) {
return 0;
}
name++;
diff --git a/source4/lib/ldb/common/ldb_parse.c b/source4/lib/ldb/common/ldb_parse.c
index b519489b48..ad3cbd883d 100644
--- a/source4/lib/ldb/common/ldb_parse.c
+++ b/source4/lib/ldb/common/ldb_parse.c
@@ -68,7 +68,7 @@ static char *ldb_parse_lex(void *ctx, const char **s, const char *sep)
const char *p = *s;
char *ret;
- while (isspace(*p)) {
+ while (isspace((unsigned char)*p)) {
p++;
}
*s = p;
@@ -86,7 +86,7 @@ static char *ldb_parse_lex(void *ctx, const char **s, const char *sep)
return ret;
}
- while (*p && (isalnum(*p) || !strchr(sep, *p))) {
+ while (*p && (isalnum((unsigned char)*p) || !strchr(sep, *p))) {
p++;
}
@@ -423,7 +423,7 @@ static struct ldb_parse_tree *ldb_parse_filterlist(void *mem_ctx,
return NULL;
}
- while (isspace(*s)) s++;
+ while (isspace((unsigned char)*s)) s++;
while (*s && (next = ldb_parse_filter(ret->u.list.elements, &s))) {
struct ldb_parse_tree **e;
@@ -438,7 +438,7 @@ static struct ldb_parse_tree *ldb_parse_filterlist(void *mem_ctx,
ret->u.list.elements = e;
ret->u.list.elements[ret->u.list.num_elements] = next;
ret->u.list.num_elements++;
- while (isspace(*s)) s++;
+ while (isspace((unsigned char)*s)) s++;
}
return ret;
@@ -474,7 +474,7 @@ static struct ldb_parse_tree *ldb_parse_not(void *mem_ctx, const char *s)
*/
static struct ldb_parse_tree *ldb_parse_filtercomp(void *mem_ctx, const char *s)
{
- while (isspace(*s)) s++;
+ while (isspace((unsigned char)*s)) s++;
switch (*s) {
case '&':
@@ -543,7 +543,7 @@ static struct ldb_parse_tree *ldb_parse_filter(void *mem_ctx, const char **s)
*/
struct ldb_parse_tree *ldb_parse_tree(void *mem_ctx, const char *s)
{
- while (isspace(*s)) s++;
+ while (isspace((unsigned char)*s)) s++;
if (*s == '(') {
return ldb_parse_filter(mem_ctx, &s);
diff --git a/source4/lib/ldb/common/ldb_utf8.c b/source4/lib/ldb/common/ldb_utf8.c
index 38c117d7e0..5df5a6bba7 100644
--- a/source4/lib/ldb/common/ldb_utf8.c
+++ b/source4/lib/ldb/common/ldb_utf8.c
@@ -50,7 +50,7 @@ char *ldb_casefold(void *mem_ctx, const char *s)
return NULL;
}
for (i=0;ret[i];i++) {
- ret[i] = toupper(ret[i]);
+ ret[i] = toupper((unsigned char)ret[i]);
}
return ret;
}
@@ -63,7 +63,8 @@ int ldb_caseless_cmp(const char *s1, const char *s2)
{
int i;
for (i=0;s1[i] != 0;i++) {
- int c1 = toupper(s1[i]), c2 = toupper(s2[i]);
+ int c1 = toupper((unsigned char)s1[i]),
+ c2 = toupper((unsigned char)s2[i]);
if (c1 != c2) {
return c1 - c2;
}