s3-popt: Only include popt-common.h when needed.
[nivanova/samba-autobuild/.git] / source3 / utils / smbcacls.c
index 0c7a72263a139c655d46109d2b2625a5b25b480b..65fec1041b54e9661cc9210b126eaefef3caa305 100644 (file)
@@ -22,6 +22,7 @@
 */
 
 #include "includes.h"
+#include "popt_common.h"
 #include "../librpc/gen_ndr/ndr_lsa.h"
 #include "rpc_client/cli_lsarpc.h"
 
@@ -1026,6 +1027,9 @@ static int inherit(struct cli_state *cli, const char *filename,
                        parent = get_secdesc(cli,parentname);
                        for (i=0;i<parent->dacl->num_aces;i++) {
                                struct security_ace *ace=&parent->dacl->aces[i];
+                               /* Add inherited flag to all aces */
+                               ace->flags=ace->flags|
+                                          SEC_ACE_FLAG_INHERITED_ACE;
                                if ((oldattr & aDIR) == aDIR) {
                                        if ((ace->flags & SEC_ACE_FLAG_CONTAINER_INHERIT) ==
                                            SEC_ACE_FLAG_CONTAINER_INHERIT) {
@@ -1034,6 +1038,8 @@ static int inherit(struct cli_state *cli, const char *filename,
                                } else {
                                        if ((ace->flags & SEC_ACE_FLAG_OBJECT_INHERIT) ==
                                            SEC_ACE_FLAG_OBJECT_INHERIT) {
+                                               /* clear flags for files */
+                                               ace->flags=0;
                                                add_ace(&old->dacl, ace);
                                        }
                                }