Print this page
11083 support NFS server in zone
Portions contributed by: Dan Kruchinin <dan.kruchinin@nexenta.com>
Portions contributed by: Stepan Zastupov <stepan.zastupov@gmail.com>
Portions contributed by: Joyce McIntosh <joyce.mcintosh@nexenta.com>
Portions contributed by: Mike Zeller <mike@mikezeller.net>
Portions contributed by: Dan McDonald <danmcd@joyent.com>
Portions contributed by: Gordon Ross <gordon.w.ross@gmail.com>
Portions contributed by: Vitaliy Gusev <gusev.vitaliy@gmail.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
Reviewed by: Rob Gittins <rob.gittins@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Jason King <jbk@joyent.com>
Reviewed by: C Fraire <cfraire@me.com>
Change-Id: I22f289d357503f9b48a0bc2482cc4328a6d43d16

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libshare/smb/libshare_smb.c
          +++ new/usr/src/lib/libshare/smb/libshare_smb.c
↓ open down ↓ 383 lines elided ↑ open up ↑
 384  384   * calls. It is assumed that all error checking of paths, etc. were
 385  385   * done earlier.
 386  386   */
 387  387  static int
 388  388  smb_enable_share(sa_share_t share)
 389  389  {
 390  390          char *path;
 391  391          smb_share_t si;
 392  392          sa_resource_t resource;
 393  393          boolean_t iszfs;
 394      -        boolean_t privileged;
 395  394          int err = SA_OK;
 396      -        priv_set_t *priv_effective;
 397  395          boolean_t online;
 398  396  
 399  397          /*
 400  398           * Don't support Trusted Extensions.
 401  399           */
 402  400          if (is_system_labeled()) {
 403  401                  (void) printf(dgettext(TEXT_DOMAIN,
 404  402                      "SMB: service not supported with Trusted Extensions\n"));
 405  403                  return (SA_NOT_SUPPORTED);
 406  404          }
 407  405  
 408      -        priv_effective = priv_allocset();
 409      -        (void) getppriv(PRIV_EFFECTIVE, priv_effective);
 410      -        privileged = (priv_isfullset(priv_effective) == B_TRUE);
 411      -        priv_freeset(priv_effective);
 412      -
 413  406          /* get the path since it is important in several places */
 414  407          path = sa_get_share_attr(share, "path");
 415  408          if (path == NULL)
 416  409                  return (SA_NO_SUCH_PATH);
 417  410  
 418  411          /*
 419  412           * If administratively disabled, don't try to start anything.
 420  413           */
 421  414          online = smb_isonline();
 422  415          if (!online && !smb_isautoenable() && smb_isdisabled())
 423  416                  goto done;
 424  417  
 425  418          iszfs = sa_path_is_zfs(path);
 426  419  
 427      -        if (iszfs) {
 428      -
 429      -                if (privileged == B_FALSE && !online) {
 430      -
 431      -                        if (!online) {
 432      -                                (void) printf(dgettext(TEXT_DOMAIN,
 433      -                                    "SMB: Cannot share remove "
 434      -                                    "file system: %s\n"), path);
 435      -                                (void) printf(dgettext(TEXT_DOMAIN,
 436      -                                    "SMB: Service needs to be enabled "
 437      -                                    "by a privileged user\n"));
 438      -                                err = SA_NO_PERMISSION;
 439      -                                errno = EPERM;
 440      -                        }
 441      -                        if (err) {
 442      -                                sa_free_attr_string(path);
 443      -                                return (err);
 444      -                        }
 445      -
 446      -                }
 447      -        }
 448      -
 449      -        if (privileged == B_TRUE && !online) {
      420 +        if (!online) {
 450  421                  err = smb_enable_service();
 451  422                  if (err != SA_OK) {
 452  423                          (void) printf(dgettext(TEXT_DOMAIN,
 453  424                              "SMB: Unable to enable service\n"));
 454  425                  } else {
 455  426                          online = B_TRUE;
 456  427                  }
 457  428          }
 458  429  
 459  430          /*
↓ open down ↓ 2056 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX