r21114: Fix 'net usershare': Adding "guest_ok=y" required a correct acl. Set the
authorVolker Lendecke <vlendec@samba.org>
Thu, 1 Feb 2007 16:22:07 +0000 (16:22 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:17:39 +0000 (12:17 -0500)
default if "" is set. And fix the calculation for too man shares.

Thanks to Karolin Seeger <ks@sernet.de>

Volker
(This used to be commit 5b12eb873f8f603a6143342c282014af76ec7752)

source3/utils/net_usershare.c

index a41f9ec5623e9fe45afb7f86b7959e4854d8fef8..e867f4c9409a3532ca5a28d61d1f13f82a5eedb5 100644 (file)
@@ -568,6 +568,9 @@ static int net_usershare_add(int argc, const char **argv)
                        us_path = argv[1];
                        us_comment = argv[2];
                        arg_acl = argv[3];
+                       if (strlen(arg_acl) == 0) {
+                               arg_acl = "S-1-1-0:R";
+                       }
                        if (!strnequal(argv[4], "guest_ok=", 9)) {
                                return net_usershare_add_usage(argc, argv);
                        }
@@ -588,10 +591,9 @@ static int net_usershare_add(int argc, const char **argv)
 
        /* Ensure we're under the "usershare max shares" number. Advisory only. */
        num_usershares = count_num_usershares();
-       if (num_usershares > lp_usershare_max_shares()) {
-               d_fprintf(stderr, "net usershare add: too many usershares already defined (%d), "
-                       "maximum number allowed is %d.\n",
-                       num_usershares, lp_usershare_max_shares() );
+       if (num_usershares >= lp_usershare_max_shares()) {
+               d_fprintf(stderr, "net usershare add: maximum number of allowed usershares (%d) reached\n",
+                       lp_usershare_max_shares() );
                SAFE_FREE(sharename);
                return -1;
        }