The branch, master has been updated
       via  011dc52 sharesec: Document --view-all
       via  4da8984 sharesec: Document -v/--view
       via  780e2b0 sharesec: Implement --view-all
      from  4ee73fd s3:smbd/close remove filesystem lock before removing 
sharemode

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 011dc52df3a3319e33ae88617b9269dfe406d42c
Author: Volker Lendecke <v...@samba.org>
Date:   Wed Jun 26 15:35:37 2013 +0000

    sharesec: Document --view-all
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Michael Adam <ob...@samba.org>
    
    Autobuild-User(master): Volker Lendecke <v...@samba.org>
    Autobuild-Date(master): Wed Jun 26 18:43:45 CEST 2013 on sn-devel-104

commit 4da8984c1b7ae8f8f372a56daa5f8c9c33f28313
Author: Volker Lendecke <v...@samba.org>
Date:   Wed Jun 26 15:34:37 2013 +0000

    sharesec: Document -v/--view
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Michael Adam <ob...@samba.org>

commit 780e2b092d7ba12aa03fb89f7c06c3d51ebf6e5f
Author: Volker Lendecke <v...@samba.org>
Date:   Wed Jun 26 15:21:39 2013 +0200

    sharesec: Implement --view-all
    
    Listing individual shares can be quite slow when you have a lot of shares. 
This
    implements a --view-all option that prints something like
    
    [share1]
    REVISION:1
    OWNER:(NULL SID)
    GROUP:(NULL SID)
    ACL:S-1-1-0:ALLOWED/0/FULL
    
    [share2]
    REVISION:1
    OWNER:(NULL SID)
    GROUP:(NULL SID)
    ACL:S-1-1-0:ALLOWED/0/FULL
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Michael Adam <ob...@samba.org>

-----------------------------------------------------------------------

Summary of changes:
 docs-xml/manpages/sharesec.1.xml |   15 +++++++++++++++
 source3/utils/sharesec.c         |   35 ++++++++++++++++++++++++++++++++++-
 2 files changed, 49 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/docs-xml/manpages/sharesec.1.xml b/docs-xml/manpages/sharesec.1.xml
index 5cd4a48..b983408 100644
--- a/docs-xml/manpages/sharesec.1.xml
+++ b/docs-xml/manpages/sharesec.1.xml
@@ -26,6 +26,7 @@
                <arg choice="opt">-R, --replace=ACLs</arg>
                <arg choice="opt">-D, --delete</arg>
                <arg choice="opt">-v, --view</arg>
+               <arg choice="opt">--view-all</arg>
                <arg choice="opt">-M, --machine-sid</arg>
                <arg choice="opt">-F, --force</arg>
                <arg choice="opt">-d, --debuglevel=DEBUGLEVEL</arg>
@@ -98,6 +99,20 @@
                </para></listitem>
                </varlistentry>
 
+               <varlistentry>
+               <term>-v|--view</term>
+               <listitem><para>
+               List a share acl
+               </para></listitem>
+               </varlistentry>
+
+               <varlistentry>
+               <term>--view-all</term>
+               <listitem><para>
+               List all share acls
+               </para></listitem>
+               </varlistentry>
+
                &stdarg.help;
                &stdarg.server.debug;
                &popt.common.samba;
diff --git a/source3/utils/sharesec.c b/source3/utils/sharesec.c
index 641a2ce..38c11e0 100644
--- a/source3/utils/sharesec.c
+++ b/source3/utils/sharesec.c
@@ -36,7 +36,8 @@ enum acl_mode { SMB_ACL_DELETE,
                SMB_SD_DELETE,
                SMB_SD_SETSDDL,
                SMB_SD_VIEWSDDL,
-               SMB_ACL_VIEW };
+               SMB_ACL_VIEW,
+               SMB_ACL_VIEW_ALL };
 
 struct perm_value {
        const char *perm;
@@ -432,6 +433,9 @@ static int change_share_sec(TALLOC_CTX *mem_ctx, const char 
*sharename, char *th
        }
 
        switch (mode) {
+       case SMB_ACL_VIEW_ALL:
+               /* should not happen */
+               return 0;
        case SMB_ACL_VIEW:
                sec_desc_print( stdout, old);
                return 0;
@@ -565,6 +569,10 @@ static int view_sharesec_sddl(const char *sharename)
   main program
 ********************************************************************/
 
+enum {
+       OPT_VIEW_ALL = 1000,
+};
+
 int main(int argc, const char *argv[])
 {
        int opt;
@@ -588,6 +596,8 @@ int main(int argc, const char *argv[])
                { "viewsddl", 'V', POPT_ARG_NONE, the_acl, 'V',
                  "View the SD in sddl format" },
                { "view", 'v', POPT_ARG_NONE, NULL, 'v', "View current share 
permissions" },
+               { "view-all", 0, POPT_ARG_NONE, NULL, OPT_VIEW_ALL,
+                 "View all current share permissions" },
                { "machine-sid", 'M', POPT_ARG_NONE, NULL, 'M', "Initialize the 
machine SID" },
                { "force", 'F', POPT_ARG_NONE, NULL, 'F', "Force storing the 
ACL", "ACLS" },
                POPT_COMMON_SAMBA
@@ -656,6 +666,9 @@ int main(int argc, const char *argv[])
                case 'M':
                        initialize_sid = True;
                        break;
+               case OPT_VIEW_ALL:
+                       mode = SMB_ACL_VIEW_ALL;
+                       break;
                }
        }
 
@@ -683,6 +696,25 @@ int main(int argc, const char *argv[])
                return -1;
        }
 
+       if (mode == SMB_ACL_VIEW_ALL) {
+               int i;
+
+               for (i=0; i<lp_numservices(); i++) {
+                       TALLOC_CTX *frame = talloc_stackframe();
+                       const char *service = lp_servicename(frame, i);
+
+                       if (service == NULL) {
+                               continue;
+                       }
+
+                       printf("[%s]\n", service);
+                       change_share_sec(frame, service, NULL, SMB_ACL_VIEW);
+                       printf("\n");
+                       TALLOC_FREE(frame);
+               }
+               goto done;
+       }
+
        /* get the sharename */
 
        if(!poptPeekArg(pc)) {
@@ -711,6 +743,7 @@ int main(int argc, const char *argv[])
                break;
        }
 
+done:
        talloc_destroy(ctx);
 
        return retval;


-- 
Samba Shared Repository

Reply via email to