summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2019-08-22 11:09:55 +1200
committerKarolin Seeger <kseeger@samba.org>2019-09-04 08:31:25 +0000
commit9b0c30517834da57a436ac6a0bad1fa2c6173849 (patch)
tree4b9f5c8b93ed8a6eb0b40ef37c3f548c82d9f996 /lib
parent1bc9476be79b994a3a9b0618f23f176e399c5aaa (diff)
downloadsamba-9b0c30517834da57a436ac6a0bad1fa2c6173849.tar.gz
ldb: Add test with == true or false to boolean if statements in ldb_dn_explode()
This is beyond the normal level of clarity we expect in Samba, and is of course rudundent, but this is a complex routine that has confusing tests, some of pointers and some of boolean state values. This tries to make the code as clear as possible pending a more comprehensive rewrite. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14049 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz> (cherry picked from commit 52bd2dde5ae809ecc115f7087e367327f4771e73)
Diffstat (limited to 'lib')
-rw-r--r--lib/ldb/common/ldb_dn.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/lib/ldb/common/ldb_dn.c b/lib/ldb/common/ldb_dn.c
index 377dd74d9f3..b9a414dc566 100644
--- a/lib/ldb/common/ldb_dn.c
+++ b/lib/ldb/common/ldb_dn.c
@@ -298,7 +298,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
char *parse_dn;
bool is_index;
- if (dn == NULL || dn->invalid) {
+ if (dn == NULL || dn->invalid == true) {
return false;
}
@@ -324,7 +324,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
}
/* Special DNs case */
- if (dn->special) {
+ if (dn->special == true) {
return true;
}
@@ -350,7 +350,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
d = dt = data;
while (*p) {
- if (in_extended) {
+ if (in_extended == true) {
if (!in_ex_name && !in_ex_value) {
@@ -437,8 +437,8 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
*d++ = *p++;
continue;
}
- if (in_attr) {
- if (trim) {
+ if (in_attr == true) {
+ if (trim == true) {
if (*p == ' ') {
p++;
continue;
@@ -505,7 +505,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
goto failed;
}
- if (is_oid && ( ! (isdigit(*p) || (*p == '.')))) {
+ if (is_oid == true && ( ! (isdigit(*p) || (*p == '.')))) {
/* not a digit nor a dot,
* invalid attribute oid */
ldb_dn_mark_invalid(dn);
@@ -521,8 +521,8 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
continue;
}
- if (in_value) {
- if (in_quote) {
+ if (in_value == true) {
+ if (in_quote == true) {
if (*p == '\"') {
if (p[-1] != '\\') {
p++;
@@ -535,7 +535,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
continue;
}
- if (trim) {
+ if (trim == true) {
if (*p == ' ') {
p++;
continue;
@@ -558,7 +558,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
*/
case ',':
- if (escape) {
+ if (escape == true) {
*d++ = *p++;
l++;
escape = false;
@@ -619,7 +619,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
accept the base64 encoded binary index
values, which contain a '+' or '='
which should normally be escaped */
- if (is_index) {
+ if (is_index == true) {
if (t != NULL) {
t = NULL;
}
@@ -634,7 +634,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
case '>':
case ';':
/* a string with not escaped specials is invalid (tested) */
- if ( ! escape) {
+ if (escape == false) {
ldb_dn_mark_invalid(dn);
goto failed;
}
@@ -649,7 +649,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
break;
case '\\':
- if ( ! escape) {
+ if (escape == false) {
escape = true;
p++;
continue;
@@ -665,7 +665,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
break;
default:
- if (escape) {
+ if (escape == true) {
if (isxdigit(p[0]) && isxdigit(p[1])) {
if (sscanf(p, "%02x", &x) != 1) {
/* invalid escaping sequence */
@@ -705,13 +705,13 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
}
}
- if (in_attr || in_quote) {
+ if (in_attr == true || in_quote == true) {
/* invalid dn */
ldb_dn_mark_invalid(dn);
goto failed;
}
- if (in_value) {
+ if (in_value == true) {
/* save last element */
if (t != NULL) {
/* trim back */