[389-commits] Branch '389-ds-base-1.3.3' - ldap/servers

Noriko Hosoi nhosoi at fedoraproject.org
Mon Feb 9 18:18:55 UTC 2015


 ldap/servers/plugins/posix-winsync/posix-winsync.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 411a8e7a2a0c2317d20c32ccbf7b801d3a11b80c
Author: Noriko Hosoi <nhosoi at redhat.com>
Date:   Mon Feb 9 09:50:15 2015 -0800

    Ticket #48001 - ns-activate.pl fails to activate account if it was disabled on AD
    
    Description: commit 345d2c0870d7e8b1005a13cc9cf93865ff0cb53d
    introduced a coverity defect - 12989 Dereference after null check.
    
    (cherry picked from commit 9300e96ae0409ea5b6d24b9af0a218ac00c03ecc)

diff --git a/ldap/servers/plugins/posix-winsync/posix-winsync.c b/ldap/servers/plugins/posix-winsync/posix-winsync.c
index 9a70244..5e36792 100644
--- a/ldap/servers/plugins/posix-winsync/posix-winsync.c
+++ b/ldap/servers/plugins/posix-winsync/posix-winsync.c
@@ -140,7 +140,6 @@ enum
  * Mostly copied from check_account_lock in the server code.
  * Returns: 0 - account is disabled (lock == "true")
  *          1 - account is enabled (lock == "false" or empty)
- *         -1 - some sort of error
  */
 static int
 _check_account_lock(Slapi_Entry *ds_entry, int *isvirt)
@@ -158,7 +157,9 @@ _check_account_lock(Slapi_Entry *ds_entry, int *isvirt)
     /* first, see if the attribute is a "real" attribute */
     strval = slapi_entry_attr_get_charptr(ds_entry, "nsAccountLock");
     if (strval) { /* value is real */
-        *isvirt = 0; /* value is real */
+        if (isvirt) {
+            *isvirt = 0; /* value is real */
+        }
         rc = 1; /* default to enabled */
         if (PL_strncasecmp(strval, "true", 4) == 0) {
             rc = 0; /* account is disabled */
@@ -179,7 +180,9 @@ _check_account_lock(Slapi_Entry *ds_entry, int *isvirt)
         const struct berval *bvp = NULL;
 
         rc = 1; /* default is enabled */
-        *isvirt = 1; /* value is virtual */
+        if (isvirt) {
+            *isvirt = 1; /* value is virtual */
+        }
         if ((slapi_valueset_first_value(values, &v) != -1) &&
             ((bvp = slapi_value_get_berval(v)) != NULL)) {
             if ((bvp != NULL) && (PL_strncasecmp(bvp->bv_val, "true", 4) == 0)) {




More information about the 389-commits mailing list