ldapd: one negation is enough

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

ldapd: one negation is enough

Florian Obser-2
this made my head hurt, pointed out by clang.

"logical not is only applied to the left hand side of this comparison
[-Wlogical-not-parentheses]"

OK?

diff --git ldapd/modify.c ldapd/modify.c
index f5d9007faaa..485d0fcfba9 100644
--- ldapd/modify.c
+++ ldapd/modify.c
@@ -132,7 +132,7 @@ ldap_add(struct request *req)
  return ldap_refer(req, dn, NULL, refs);
  }
 
- if (!authorized(req->conn, ns, ACI_WRITE, dn, LDAP_SCOPE_BASE) != 0)
+ if (!authorized(req->conn, ns, ACI_WRITE, dn, LDAP_SCOPE_BASE))
  return ldap_respond(req, LDAP_INSUFFICIENT_ACCESS);
 
  /* Check that we're not adding immutable attributes.
@@ -242,7 +242,7 @@ ldap_modify(struct request *req)
  return ldap_refer(req, dn, NULL, refs);
  }
 
- if (!authorized(req->conn, ns, ACI_WRITE, dn, LDAP_SCOPE_BASE) != 0)
+ if (!authorized(req->conn, ns, ACI_WRITE, dn, LDAP_SCOPE_BASE))
  return ldap_respond(req, LDAP_INSUFFICIENT_ACCESS);
 
  if (namespace_begin(ns) == -1) {


--
I'm not entirely sure you are real.

Reply | Threaded
Open this post in threaded view
|

Re: ldapd: one negation is enough

Gleydson Soares-3

Florian Obser <[hidden email]> writes:
> this made my head hurt, pointed out by clang.
>
> "logical not is only applied to the left hand side of this comparison
> [-Wlogical-not-parentheses]"
>
> OK?

oh I realized I had forgotten something,
I've this change in my tree for months and ok'ed by millert@.
please commit it, OK gsoares

>
> diff --git ldapd/modify.c ldapd/modify.c
> index f5d9007faaa..485d0fcfba9 100644
> --- ldapd/modify.c
> +++ ldapd/modify.c
> @@ -132,7 +132,7 @@ ldap_add(struct request *req)
>   return ldap_refer(req, dn, NULL, refs);
>   }
>  
> - if (!authorized(req->conn, ns, ACI_WRITE, dn, LDAP_SCOPE_BASE) != 0)
> + if (!authorized(req->conn, ns, ACI_WRITE, dn, LDAP_SCOPE_BASE))
>   return ldap_respond(req, LDAP_INSUFFICIENT_ACCESS);
>  
>   /* Check that we're not adding immutable attributes.
> @@ -242,7 +242,7 @@ ldap_modify(struct request *req)
>   return ldap_refer(req, dn, NULL, refs);
>   }
>  
> - if (!authorized(req->conn, ns, ACI_WRITE, dn, LDAP_SCOPE_BASE) != 0)
> + if (!authorized(req->conn, ns, ACI_WRITE, dn, LDAP_SCOPE_BASE))
>   return ldap_respond(req, LDAP_INSUFFICIENT_ACCESS);
>  
>   if (namespace_begin(ns) == -1) {
>
>
> --
> I'm not entirely sure you are real.