case EZFS_SHARENFSFAILED:
(void) fprintf(stderr, gettext("property may be set "
"but unable to reshare filesystem\n"));
- ret = 1;
break;
}
}
static int
nfs_validate_shareopts(const char *shareopts)
{
- (void) shareopts;
+ if (strlen(shareopts) == 0)
+ return (SA_SYNTAX_ERR);
return (SA_OK);
}
"wdelay" };
char **plinux_opts = (char **)cookie;
+ char *host, *val_dup, *literal, *next;
- /* host-specific options, these are taken care of elsewhere */
- if (strcmp(key, "ro") == 0 || strcmp(key, "rw") == 0 ||
- strcmp(key, "sec") == 0)
+ if (strcmp(key, "sec") == 0)
return (SA_OK);
+ if (strcmp(key, "ro") == 0 || strcmp(key, "rw") == 0) {
+ if (value == NULL || strlen(value) == 0)
+ return (SA_OK);
+ val_dup = strdup(value);
+ host = val_dup;
+ if (host == NULL)
+ return (SA_NO_MEMORY);
+ do {
+ if (*host == '[') {
+ host++;
+ literal = strchr(host, ']');
+ if (literal == NULL) {
+ free(val_dup);
+ return (SA_SYNTAX_ERR);
+ }
+ if (literal[1] == '\0')
+ next = NULL;
+ else if (literal[1] == '/') {
+ next = strchr(literal + 2, ':');
+ if (next != NULL)
+ ++next;
+ } else if (literal[1] == ':')
+ next = literal + 2;
+ else {
+ free(val_dup);
+ return (SA_SYNTAX_ERR);
+ }
+ } else {
+ next = strchr(host, ':');
+ if (next != NULL)
+ ++next;
+ }
+ host = next;
+ } while (host != NULL);
+ free(val_dup);
+ return (SA_OK);
+ }
+
if (strcmp(key, "anon") == 0)
key = "anonuid";
nfs_validate_shareopts(const char *shareopts)
{
char *linux_opts = NULL;
+
+ if (strlen(shareopts) == 0)
+ return (SA_SYNTAX_ERR);
+
int error = get_linux_shareopts(shareopts, &linux_opts);
if (error != SA_OK)
return (error);
prop_changenode_t *cn;
uu_avl_walk_t *walk;
char shareopts[ZFS_MAXPROPLEN];
- int errors = 0;
boolean_t commit_smb_shares = B_FALSE;
boolean_t commit_nfs_shares = B_FALSE;
const enum sa_protocol nfs[] =
{SA_PROTOCOL_NFS, SA_NO_PROTOCOL};
if (sharenfs && mounted) {
- errors += zfs_share(cn->cn_handle, nfs);
+ zfs_share(cn->cn_handle, nfs);
commit_nfs_shares = B_TRUE;
} else if (cn->cn_shared || clp->cl_waslegacy) {
- errors += zfs_unshare(cn->cn_handle, NULL, nfs);
+ zfs_unshare(cn->cn_handle, NULL, nfs);
commit_nfs_shares = B_TRUE;
}
const enum sa_protocol smb[] =
{SA_PROTOCOL_SMB, SA_NO_PROTOCOL};
if (sharesmb && mounted) {
- errors += zfs_share(cn->cn_handle, smb);
+ zfs_share(cn->cn_handle, smb);
commit_smb_shares = B_TRUE;
} else if (cn->cn_shared || clp->cl_waslegacy) {
- errors += zfs_unshare(cn->cn_handle, NULL, smb);
+ zfs_unshare(cn->cn_handle, NULL, smb);
commit_smb_shares = B_TRUE;
}
}
zfs_commit_shares(proto);
uu_avl_walk_end(walk);
- return (errors ? -1 : 0);
+ return (0);
}
/*