r14418: Try and fix Coverity #39 and #40 by making the
authorJeremy Allison <jra@samba.org>
Wed, 15 Mar 2006 03:27:03 +0000 (03:27 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:15:29 +0000 (11:15 -0500)
implicit function contract explicit.
Jeremy.

source/libsmb/libsmbclient.c

index 4c013c4ed2de88c2c19e529bbbe0d75996b0e5f3..b8070283dac84512a600fa7a65a1ff9035b55d8b 100644 (file)
@@ -4826,11 +4826,19 @@ cacl_set(TALLOC_CTX *ctx,
                                     CONST_DISCARD(char *, the_acl));
 
                 if (!sd) {
-                        errno = EINVAL;
-                        return -1;
+                       errno = EINVAL;
+                       return -1;
                 }
         }
 
+       /* SMBC_XATTR_MODE_REMOVE_ALL is the only caller
+          that doesn't deref sd */
+
+       if (!sd && (mode != SMBC_XATTR_MODE_REMOVE_ALL)) {
+               errno = EINVAL;
+               return -1;
+       }
+
        /* The desired access below is the only one I could find that works
           with NT4, W2KP and Samba */