summaryrefslogtreecommitdiff
path: root/usr/src/lib/libshare/nfs/libshare_nfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/lib/libshare/nfs/libshare_nfs.c')
-rw-r--r--usr/src/lib/libshare/nfs/libshare_nfs.c78
1 files changed, 11 insertions, 67 deletions
diff --git a/usr/src/lib/libshare/nfs/libshare_nfs.c b/usr/src/lib/libshare/nfs/libshare_nfs.c
index 484244e6ba..9f6acce19f 100644
--- a/usr/src/lib/libshare/nfs/libshare_nfs.c
+++ b/usr/src/lib/libshare/nfs/libshare_nfs.c
@@ -21,19 +21,19 @@
/*
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2016 Nexenta Systems, Inc.
* Copyright (c) 2014, 2016 by Delphix. All rights reserved.
+ * Copyright 2018 Nexenta Systems, Inc.
*/
/*
* NFS specific functions
*/
+
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>
-#include <zone.h>
#include <errno.h>
#include <locale.h>
#include <signal.h>
@@ -1905,12 +1905,7 @@ nfs_enable_share(sa_share_t share)
sa_free_attr_string(sectype);
}
}
- /*
- * when we get here, we can do the exportfs system call and
- * initiate things. We probably want to enable the
- * svc:/network/nfs/server service first if it isn't running.
- */
- /* check svc:/network/nfs/server status and start if needed */
+
/* now add the share to the internal tables */
printarg(path, &export);
/*
@@ -1920,52 +1915,17 @@ nfs_enable_share(sa_share_t share)
if (iszfs) {
struct exportfs_args ea;
share_t sh;
- char *str;
- priv_set_t *priv_effective;
- int privileged;
-
- /*
- * If we aren't a privileged user
- * and NFS server service isn't running
- * then print out an error message
- * and return EPERM
- */
- priv_effective = priv_allocset();
- (void) getppriv(PRIV_EFFECTIVE, priv_effective);
-
- privileged = (priv_isfullset(priv_effective) == B_TRUE);
- priv_freeset(priv_effective);
-
- if (!privileged &&
- (str = smf_get_state(NFS_SERVER_SVC)) != NULL) {
- err = 0;
- if (strcmp(str, SCF_STATE_STRING_ONLINE) != 0) {
- (void) printf(dgettext(TEXT_DOMAIN,
- "NFS: Cannot share remote "
- "filesystem: %s\n"), path);
- (void) printf(dgettext(TEXT_DOMAIN,
- "NFS: Service needs to be enabled "
- "by a privileged user\n"));
- err = SA_SYSTEM_ERR;
- errno = EPERM;
- }
- free(str);
- }
-
- if (err == 0) {
- ea.dname = path;
- ea.uex = &export;
+ ea.dname = path;
+ ea.uex = &export;
- (void) sa_sharetab_fill_zfs(share, &sh, "nfs");
- err = sa_share_zfs(share, NULL, path, &sh,
- &ea, ZFS_SHARE_NFS);
- if (err != SA_OK) {
- errno = err;
- err = -1;
- }
- sa_emptyshare(&sh);
+ (void) sa_sharetab_fill_zfs(share, &sh, "nfs");
+ err = sa_share_zfs(share, NULL, path, &sh, &ea, ZFS_SHARE_NFS);
+ if (err != SA_OK) {
+ errno = err;
+ err = -1;
}
+ sa_emptyshare(&sh);
} else {
err = exportfs(path, &export);
}
@@ -1973,20 +1933,7 @@ nfs_enable_share(sa_share_t share)
if (err < 0) {
err = SA_SYSTEM_ERR;
switch (errno) {
- case EREMOTE:
- (void) printf(dgettext(TEXT_DOMAIN,
- "NFS: Cannot share filesystems "
- "in non-global zones: %s\n"), path);
- err = SA_NOT_SUPPORTED;
- break;
case EPERM:
- if (getzoneid() != GLOBAL_ZONEID) {
- (void) printf(dgettext(TEXT_DOMAIN,
- "NFS: Cannot share file systems "
- "in non-global zones: %s\n"), path);
- err = SA_NOT_SUPPORTED;
- break;
- }
err = SA_NO_PERMISSION;
break;
case EEXIST:
@@ -2098,9 +2045,6 @@ nfs_disable_share(sa_share_t share, char *path)
case EPERM:
case EACCES:
ret = SA_NO_PERMISSION;
- if (getzoneid() != GLOBAL_ZONEID) {
- ret = SA_NOT_SUPPORTED;
- }
break;
case EINVAL:
case ENOENT: