summaryrefslogtreecommitdiff
path: root/usr/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/lib')
-rw-r--r--usr/src/lib/Makefile6
-rw-r--r--usr/src/lib/libreparse/Makefile60
-rw-r--r--usr/src/lib/libreparse/Makefile.com57
-rw-r--r--usr/src/lib/libreparse/amd64/Makefile29
-rw-r--r--usr/src/lib/libreparse/common/fs_reparse_lib.c437
-rw-r--r--usr/src/lib/libreparse/common/llib-lreparse46
-rw-r--r--usr/src/lib/libreparse/common/mapfile-vers54
-rw-r--r--usr/src/lib/libreparse/common/rp_plugin.h75
-rw-r--r--usr/src/lib/libreparse/i386/Makefile28
-rw-r--r--usr/src/lib/libreparse/sparc/Makefile28
-rw-r--r--usr/src/lib/libreparse/sparcv9/Makefile29
-rw-r--r--usr/src/lib/libsecdb/auth_attr.txt1
-rw-r--r--usr/src/lib/libsecdb/help/auths/Makefile1
-rw-r--r--usr/src/lib/libsecdb/help/auths/SmfReparseStates.html37
-rw-r--r--usr/src/lib/libsecdb/help/profiles/Makefile1
-rw-r--r--usr/src/lib/libsecdb/help/profiles/RtReparseMngmnt.html37
-rw-r--r--usr/src/lib/libsecdb/prof_attr.txt1
-rw-r--r--usr/src/lib/libzpool/common/sys/zfs_context.h3
18 files changed, 929 insertions, 1 deletions
diff --git a/usr/src/lib/Makefile b/usr/src/lib/Makefile
index 9c364883a7..b535355b13 100644
--- a/usr/src/lib/Makefile
+++ b/usr/src/lib/Makefile
@@ -261,6 +261,7 @@ SUBDIRS += \
libsun_ima \
mpapi \
librstp \
+ libreparse \
$($(MACH)_SUBDIRS)
i386_SUBDIRS= \
@@ -359,7 +360,8 @@ MSGSUBDIRS= \
mpss \
pam_modules \
pyzfs \
- rpcsec_gss
+ rpcsec_gss \
+ libreparse
MSGSUBDIRS += \
$($(MACH)_MSGSUBDIRS)
@@ -491,6 +493,7 @@ HDRSUBDIRS= \
libsun_ima \
mpapi \
mms \
+ libreparse \
$($(MACH)_HDRSUBDIRS)
$(CLOSED_BUILD)HDRSUBDIRS += \
@@ -637,6 +640,7 @@ scsi: libnvpair
mpapi: libpthread libdevinfo libsysevent libnvpair
libgrubmgmt: libdevinfo libzfs libfstyp
pyzfs: libnvpair libsec libidmap libzfs
+libreparse: libnvpair
#
# The reason this rule checks for the existence of the
diff --git a/usr/src/lib/libreparse/Makefile b/usr/src/lib/libreparse/Makefile
new file mode 100644
index 0000000000..1f0e0b4647
--- /dev/null
+++ b/usr/src/lib/libreparse/Makefile
@@ -0,0 +1,60 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+
+include ../Makefile.lib
+
+HDRS= rp_plugin.h
+HDRDIR= common
+
+SUBDIRS= $(MACH)
+$(BUILD64)SUBDIRS += $(MACH64)
+POFILE= libreparse.po
+MSGFILES= common/fs_reparse_lib.c
+
+all := TARGET = all
+clean := TARGET = clean
+clobber := TARGET = clobber
+install := TARGET = install
+lint := TARGET = lint
+
+.KEEP_STATE:
+
+all clean clobber install lint: $(SUBDIRS)
+
+install_h: $(ROOTHDRS)
+
+check: $(CHECKHDRS)
+
+$(POFILE): pofile_MSGFILES
+
+_msg: $(MSGDOMAINPOFILE)
+
+$(SUBDIRS): FRC
+ @cd $@; pwd; $(MAKE) $(TARGET)
+
+FRC:
+
+include $(SRC)/lib/Makefile.targ
+include $(SRC)/Makefile.msg.targ
diff --git a/usr/src/lib/libreparse/Makefile.com b/usr/src/lib/libreparse/Makefile.com
new file mode 100644
index 0000000000..ca913755fe
--- /dev/null
+++ b/usr/src/lib/libreparse/Makefile.com
@@ -0,0 +1,57 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+
+LIBRARY= libreparse.a
+VERS= .1
+
+LOCOBJS = fs_reparse_lib.o
+COMOBJS = fs_reparse.o
+OBJECTS = $(LOCOBJS) $(COMOBJS)
+COMDIR = $(SRC)/common/fsreparse
+
+include ../../Makefile.lib
+
+SRCDIR = ../common
+SRCS = $(LOCOBJS:%.o=$(SRCDIR)/%.c) $(COMOBJS:%.o=$(COMDIR)/%.c)
+
+LIBS = $(DYNLIB) $(LINTLIB)
+LDLIBS += -lc -lnvpair
+
+CFLAGS += $(CCVERBOSE)
+CPPFLAGS += -I$(COMDIR) -D_FILE_OFFSET_BITS=64
+
+$(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC)
+
+.KEEP_STATE:
+
+all: $(LIBS)
+
+lint: lintcheck
+
+include ../../Makefile.targ
+
+pics/%.o: $(COMDIR)/%.c
+ $(COMPILE.c) -o $@ $<
+ $(POST_PROCESS_O)
diff --git a/usr/src/lib/libreparse/amd64/Makefile b/usr/src/lib/libreparse/amd64/Makefile
new file mode 100644
index 0000000000..036c13779e
--- /dev/null
+++ b/usr/src/lib/libreparse/amd64/Makefile
@@ -0,0 +1,29 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+
+include ../Makefile.com
+include ../../Makefile.lib.64
+
+install: all $(ROOTLIBS64) $(ROOTLINKS64) $(ROOTLINT64)
diff --git a/usr/src/lib/libreparse/common/fs_reparse_lib.c b/usr/src/lib/libreparse/common/fs_reparse_lib.c
new file mode 100644
index 0000000000..b1ac809e63
--- /dev/null
+++ b/usr/src/lib/libreparse/common/fs_reparse_lib.c
@@ -0,0 +1,437 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <strings.h>
+#include <string.h>
+#include <dirent.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/param.h>
+#include <sys/errno.h>
+#include <limits.h>
+#include <libnvpair.h>
+#include <dlfcn.h>
+#include <libintl.h>
+#include <sys/systeminfo.h>
+#include <sys/fs_reparse.h>
+#include "rp_plugin.h"
+
+#define MAXISALEN 257 /* based on sysinfo(2) man page */
+
+static rp_proto_handle_t rp_proto_handle;
+static rp_proto_plugin_t *rp_proto_list;
+
+int rp_plugin_init(void);
+static void proto_plugin_fini(void);
+static rp_plugin_ops_t *rp_find_protocol(const char *svctype);
+
+extern int errno;
+static int rp_plugin_inited = 0;
+
+/*
+ * reparse_create()
+ *
+ * Create a symlink at the specified 'path' as a reparse point.
+ * This function will fail if path refers to an existing file system
+ * object or an object named string already exists at the given path.
+ *
+ * return 0 if ok else return error code.
+ */
+int
+reparse_create(const char *path, const char *string)
+{
+ int err;
+ struct stat sbuf;
+
+ if (path == NULL || string == NULL)
+ return (EINVAL);
+
+ if ((err = reparse_validate(string)) != 0)
+ return (err);
+
+ /* check if object exists */
+ if (lstat(path, &sbuf) == 0)
+ return (EEXIST);
+
+ return (symlink(string, path) ? errno : 0);
+}
+
+/*
+ * reparse_unparse()
+ *
+ * Convert an nvlist back to a string format suitable to write
+ * to the reparse point symlink body. The string returned is in
+ * allocated memory and must be freed by the caller.
+ *
+ * return 0 if ok else return error code.
+ */
+int
+reparse_unparse(nvlist_t *nvl, char **stringp)
+{
+ int err, buflen;
+ char *buf, *stype, *val;
+ nvpair_t *curr;
+
+ if (nvl == NULL || stringp == NULL ||
+ ((curr = nvlist_next_nvpair(nvl, NULL)) == NULL))
+ return (EINVAL);
+
+ buflen = SYMLINK_MAX;
+ if ((buf = malloc(buflen)) == NULL)
+ return (ENOMEM);
+
+ err = 0;
+ (void) snprintf(buf, buflen, "%s", FS_REPARSE_TAG_STR);
+ while (curr != NULL) {
+ if (!(stype = nvpair_name(curr))) {
+ err = EINVAL;
+ break;
+ }
+ if ((strlcat(buf, FS_TOKEN_START_STR, buflen) >= buflen) ||
+ (strlcat(buf, stype, buflen) >= buflen) ||
+ (strlcat(buf, ":", buflen) >= buflen) ||
+ (nvpair_value_string(curr, &val) != 0) ||
+ (strlcat(buf, val, buflen) >= buflen) ||
+ (strlcat(buf, FS_TOKEN_END_STR, buflen) >= buflen)) {
+ err = E2BIG;
+ break;
+ }
+ curr = nvlist_next_nvpair(nvl, curr);
+ }
+ if (err != 0) {
+ free(buf);
+ return (err);
+ }
+ if (strlcat(buf, FS_REPARSE_TAG_END_STR, buflen) >= buflen) {
+ free(buf);
+ return (E2BIG);
+ }
+
+ *stringp = buf;
+ return (0);
+}
+
+/*
+ * reparse_deref()
+ *
+ * Accepts the service-specific item from the reparse point and returns
+ * the service-specific data requested. The caller specifies the size
+ * of the buffer provided via *bufsz.
+ *
+ * if ok return 0 and *bufsz is updated to contain the actual length of
+ * the returned results, else return error code. If the error code is
+ * EOVERFLOW; results do not fit in the buffer, *bufsz will be updated
+ * to contain the number of bytes needed to hold the results.
+ */
+int
+reparse_deref(const char *svc_type, const char *svc_data, char *buf,
+ size_t *bufsz)
+{
+ rp_plugin_ops_t *ops;
+
+ if ((svc_type == NULL) || (svc_data == NULL) || (buf == NULL) ||
+ (bufsz == NULL))
+ return (EINVAL);
+
+ ops = rp_find_protocol(svc_type);
+ if ((ops != NULL) && (ops->rpo_deref != NULL))
+ return (ops->rpo_deref(svc_type, svc_data, buf, bufsz));
+
+ /* no plugin, return error */
+ return (ENOTSUP);
+}
+
+/*
+ * reparse_delete()
+ *
+ * Delete a reparse point at a given pathname. It will fail if
+ * a reparse point does not exist at the given path or the pathname
+ * is not a symlink.
+ *
+ * return 0 if ok else return error code.
+ */
+int
+reparse_delete(const char *path)
+{
+ struct stat sbuf;
+
+ if (path == NULL)
+ return (EINVAL);
+
+ /* check if object exists */
+ if (lstat(path, &sbuf) != 0)
+ return (errno);
+
+ if ((sbuf.st_mode & S_IFLNK) != S_IFLNK)
+ return (EINVAL);
+
+ return (unlink(path) ? errno : 0);
+}
+
+/*
+ * reparse_add()
+ *
+ * Add a service type entry to a nvlist with a copy of svc_data,
+ * replacing one of the same type if already present.
+ *
+ * return 0 if ok else return error code.
+ */
+int
+reparse_add(nvlist_t *nvl, const char *svc_type, const char *svc_data)
+{
+ int err;
+ char *buf;
+ size_t bufsz;
+ rp_plugin_ops_t *ops;
+
+ if ((nvl == NULL) || (svc_type == NULL) || (svc_data == NULL))
+ return (EINVAL);
+
+ bufsz = SYMLINK_MAX; /* no need to mess around */
+ if ((buf = malloc(bufsz)) == NULL)
+ return (ENOMEM);
+
+ ops = rp_find_protocol(svc_type);
+ if ((ops != NULL) && (ops->rpo_form != NULL))
+ err = ops->rpo_form(svc_type, svc_data, buf, &bufsz);
+ else
+ err = ENOTSUP; /* no plugin */
+
+ if (err != 0) {
+ free(buf);
+ return (err);
+ }
+
+ err = nvlist_add_string(nvl, svc_type, buf);
+ free(buf);
+ return (err);
+}
+
+/*
+ * reparse_remove()
+ *
+ * Remove a service type entry from the nvlist, if present.
+ *
+ * return 0 if ok else return error code.
+ */
+int
+reparse_remove(nvlist_t *nvl, const char *svc_type)
+{
+ if ((nvl == NULL) || (svc_type == NULL))
+ return (EINVAL);
+
+ return (nvlist_remove_all(nvl, svc_type));
+}
+
+/*
+ * Returns true if name is "." or "..", otherwise returns false.
+ */
+static boolean_t
+rp_is_dot_or_dotdot(const char *name)
+{
+ if (*name != '.')
+ return (B_FALSE);
+
+ if (name[1] == '\0' || (name[1] == '.' && name[2] == '\0'))
+ return (B_TRUE);
+
+ return (B_FALSE);
+}
+
+static void
+proto_plugin_fini()
+{
+ rp_proto_plugin_t *p;
+
+ /*
+ * Protocols may call this framework during _fini
+ */
+ for (p = rp_proto_list; p != NULL; p = p->plugin_next) {
+ if (p->plugin_ops->rpo_fini)
+ p->plugin_ops->rpo_fini();
+ }
+ while ((p = rp_proto_list) != NULL) {
+ rp_proto_list = p->plugin_next;
+ if (p->plugin_handle != NULL)
+ (void) dlclose(p->plugin_handle);
+ free(p);
+ }
+
+ if (rp_proto_handle.rp_ops != NULL) {
+ free(rp_proto_handle.rp_ops);
+ rp_proto_handle.rp_ops = NULL;
+ }
+ rp_proto_handle.rp_num_proto = 0;
+}
+
+/*
+ * rp_plugin_init()
+ *
+ * Initialize the service type specific plugin modules.
+ * For each reparse service type, there should be a plugin library for it.
+ * This function walks /usr/lib/reparse directory for plugin libraries.
+ * For each plugin library found, initialize it and add it to the internal
+ * list of service type plugin. These are used for service type specific
+ * operations.
+ */
+int
+rp_plugin_init()
+{
+ int err, ret = RP_OK;
+ char isa[MAXISALEN], dirpath[MAXPATHLEN], path[MAXPATHLEN];
+ int num_protos = 0;
+ rp_proto_handle_t *rp_hdl;
+ rp_proto_plugin_t *proto, *tmp;
+ rp_plugin_ops_t *plugin_ops;
+ struct stat st;
+ void *dlhandle;
+ DIR *dir;
+ struct dirent *dent;
+
+#if defined(_LP64)
+ if (sysinfo(SI_ARCHITECTURE_64, isa, MAXISALEN) == -1)
+ isa[0] = '\0';
+#else
+ isa[0] = '\0';
+#endif
+
+ (void) snprintf(dirpath, MAXPATHLEN,
+ "%s/%s", RP_LIB_DIR, isa);
+
+ if ((dir = opendir(dirpath)) == NULL)
+ return (RP_NO_PLUGIN_DIR);
+
+ while ((dent = readdir(dir)) != NULL) {
+ if (rp_is_dot_or_dotdot(dent->d_name))
+ continue;
+
+ (void) snprintf(path, MAXPATHLEN,
+ "%s/%s", dirpath, dent->d_name);
+
+ /*
+ * If file doesn't exist, don't try to map it
+ */
+ if (stat(path, &st) < 0)
+ continue;
+ if ((dlhandle = dlopen(path, RTLD_FIRST|RTLD_LAZY)) == NULL)
+ continue;
+
+ plugin_ops = (rp_plugin_ops_t *)
+ dlsym(dlhandle, "rp_plugin_ops");
+ if (plugin_ops == NULL) {
+ (void) fprintf(stderr, dgettext(TEXT_DOMAIN,
+ "Error in plugin ops for service type %s\n%s\n"),
+ dent->d_name, dlerror());
+ (void) dlclose(dlhandle);
+ continue;
+ }
+ proto = (rp_proto_plugin_t *)
+ calloc(1, sizeof (rp_proto_plugin_t));
+ if (proto == NULL) {
+ (void) dlclose(dlhandle);
+ (void) fprintf(stderr,
+ dgettext(TEXT_DOMAIN, "No memory for plugin %s\n"),
+ dent->d_name);
+ ret = RP_NO_MEMORY;
+ break;
+ }
+
+ proto->plugin_ops = plugin_ops;
+ proto->plugin_handle = dlhandle;
+ num_protos++;
+ proto->plugin_next = rp_proto_list;
+ rp_proto_list = proto;
+ }
+
+ (void) closedir(dir);
+
+ if ((num_protos == 0) && (ret == 0))
+ ret = RP_NO_PLUGIN;
+ /*
+ * There was an error, so cleanup prior to return of failure.
+ */
+ if (ret != RP_OK) {
+ proto_plugin_fini();
+ return (ret);
+ }
+
+ rp_proto_handle.rp_ops = (rp_plugin_ops_t **)calloc(num_protos,
+ sizeof (rp_plugin_ops_t *));
+ if (!rp_proto_handle.rp_ops) {
+ proto_plugin_fini();
+ return (RP_NO_MEMORY);
+ }
+
+ rp_hdl = &rp_proto_handle;
+ rp_hdl->rp_num_proto = 0;
+ for (tmp = rp_proto_list; rp_hdl->rp_num_proto < num_protos &&
+ tmp != NULL; tmp = tmp->plugin_next) {
+
+ err = RP_OK;
+ if (tmp->plugin_ops->rpo_init != NULL)
+ err = tmp->plugin_ops->rpo_init();
+ if (err != RP_OK)
+ continue;
+ rp_hdl->rp_ops[rp_hdl->rp_num_proto++] = tmp->plugin_ops;
+ }
+
+ return (rp_hdl->rp_num_proto > 0 ? RP_OK : RP_NO_PLUGIN);
+}
+
+
+/*
+ * find_protocol()
+ *
+ * Search the plugin list for the specified protocol and return the
+ * ops vector. return NULL if protocol is not defined.
+ */
+static rp_plugin_ops_t *
+rp_find_protocol(const char *svc_type)
+{
+ int i;
+ rp_plugin_ops_t *ops = NULL;
+
+ if (svc_type == NULL)
+ return (NULL);
+
+ if (rp_plugin_inited == 0) {
+ if (rp_plugin_init() == RP_OK)
+ rp_plugin_inited = 1;
+ else
+ return (NULL);
+ }
+
+ for (i = 0; i < rp_proto_handle.rp_num_proto; i++) {
+ ops = rp_proto_handle.rp_ops[i];
+ if (ops->rpo_supports_svc(svc_type))
+ return (ops);
+
+ }
+ return (NULL);
+}
diff --git a/usr/src/lib/libreparse/common/llib-lreparse b/usr/src/lib/libreparse/common/llib-lreparse
new file mode 100644
index 0000000000..082aa4032d
--- /dev/null
+++ b/usr/src/lib/libreparse/common/llib-lreparse
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/* LINTLIBRARY */
+/* PROTOLIB1 */
+
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#include <sys/fs_reparse.h>
+#include "rp_plugin.h"
+
+/*
+ * usr/src/lib/libreparse
+ */
+int reparse_add(nvlist_t *, const char *, const char *);
+int reparse_create(const char *, const char *);
+int reparse_delete(const char *);
+int reparse_deref(const char *, const char *, char *, size_t *);
+void reparse_free(nvlist_t *);
+nvlist_t *reparse_init(void);
+int reparse_parse(const char *, nvlist_t *);
+int reparse_remove(nvlist_t *, const char *);
+int reparse_remove(nvlist_t *, const char *);
+int reparse_unparse(nvlist_t *, char **);
+int reparse_validate(const char *);
+int rp_plugin_init();
diff --git a/usr/src/lib/libreparse/common/mapfile-vers b/usr/src/lib/libreparse/common/mapfile-vers
new file mode 100644
index 0000000000..94bfba08ec
--- /dev/null
+++ b/usr/src/lib/libreparse/common/mapfile-vers
@@ -0,0 +1,54 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+
+#
+# MAPFILE HEADER START
+#
+# WARNING: STOP NOW. DO NOT MODIFY THIS FILE.
+# Object versioning must comply with the rules detailed in
+#
+# usr/src/lib/README.mapfiles
+#
+# You should not be making modifications here until you've read the most current
+# copy of that file. If you need help, contact a gatekeeper for guidance.
+#
+# MAPFILE HEADER END
+#
+
+SUNWprivate {
+ global:
+ reparse_add;
+ reparse_create;
+ reparse_delete;
+ reparse_deref;
+ reparse_free;
+ reparse_init;
+ reparse_parse;
+ reparse_remove;
+ reparse_unparse;
+ reparse_validate;
+ rp_plugin_init;
+ local:
+ *;
+};
diff --git a/usr/src/lib/libreparse/common/rp_plugin.h b/usr/src/lib/libreparse/common/rp_plugin.h
new file mode 100644
index 0000000000..a12b45776c
--- /dev/null
+++ b/usr/src/lib/libreparse/common/rp_plugin.h
@@ -0,0 +1,75 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _RP_PLUGIN_H
+#define _RP_PLUGIN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/types.h>
+
+#define RP_LIB_DIR "/usr/lib/reparse"
+#define RP_PLUGIN_V1 1
+
+/*
+ * some error codes
+ */
+#define RP_OK 0
+#define RP_NO_PLUGIN ENOENT
+#define RP_NO_MEMORY ENOMEM
+#define RP_NO_PLUGIN_DIR ENOTDIR
+#define RP_INVALID_PROTOCOL EINVAL
+
+extern int rp_plugin_init();
+
+typedef struct rp_plugin_ops {
+ int rpo_version;
+ int (*rpo_init)(void);
+ int (*rpo_fini)(void);
+ char *(*rpo_svc_types)(void);
+ boolean_t (*rpo_supports_svc)(const char *);
+ int (*rpo_form)(const char *, const char *, char *, size_t *);
+ int (*rpo_deref)(const char *, const char *, char *, size_t *);
+} rp_plugin_ops_t;
+
+typedef struct rp_proto_plugin {
+ struct rp_proto_plugin *plugin_next;
+ rp_plugin_ops_t *plugin_ops;
+ void *plugin_handle;
+} rp_proto_plugin_t;
+
+typedef struct rp_proto_handle {
+ int rp_num_proto;
+ rp_plugin_ops_t **rp_ops;
+} rp_proto_handle_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RP_PLUGIN_H */
diff --git a/usr/src/lib/libreparse/i386/Makefile b/usr/src/lib/libreparse/i386/Makefile
new file mode 100644
index 0000000000..c86be4377c
--- /dev/null
+++ b/usr/src/lib/libreparse/i386/Makefile
@@ -0,0 +1,28 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+
+include ../Makefile.com
+
+install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT)
diff --git a/usr/src/lib/libreparse/sparc/Makefile b/usr/src/lib/libreparse/sparc/Makefile
new file mode 100644
index 0000000000..c86be4377c
--- /dev/null
+++ b/usr/src/lib/libreparse/sparc/Makefile
@@ -0,0 +1,28 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+
+include ../Makefile.com
+
+install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT)
diff --git a/usr/src/lib/libreparse/sparcv9/Makefile b/usr/src/lib/libreparse/sparcv9/Makefile
new file mode 100644
index 0000000000..036c13779e
--- /dev/null
+++ b/usr/src/lib/libreparse/sparcv9/Makefile
@@ -0,0 +1,29 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+
+include ../Makefile.com
+include ../../Makefile.lib.64
+
+install: all $(ROOTLIBS64) $(ROOTLINKS64) $(ROOTLINT64)
diff --git a/usr/src/lib/libsecdb/auth_attr.txt b/usr/src/lib/libsecdb/auth_attr.txt
index f3df01c4f7..b09d1f7a1e 100644
--- a/usr/src/lib/libsecdb/auth_attr.txt
+++ b/usr/src/lib/libsecdb/auth_attr.txt
@@ -139,6 +139,7 @@ solaris.smf.manage.nwam:::Manage Network Auto-Magic Service States::help=SmfNWAM
solaris.smf.manage.power:::Manage Power Management Service States::help=SmfPowerStates.html
solaris.smf.manage.smb:::Manage SMB Service States::help=SmfSMBStates.html
solaris.smf.manage.smbfs:::Manage SMB Client States::help=SmfSMBFSStates.html
+solaris.smf.manage.reparse:::Manage Reparse Service States::help=SmfReparseStates.html
solaris.smf.manage.rmvolmgr:::Manage Rmvolmgr Service States::help=SmfRmvolmgrStates.html
solaris.smf.manage.routing:::Manage Routing Service States::help=SmfRoutingStates.html
solaris.smf.manage.rpc.bind:::Manage RPC Program number mapper::help=SmfRPCBind.html
diff --git a/usr/src/lib/libsecdb/help/auths/Makefile b/usr/src/lib/libsecdb/help/auths/Makefile
index b18c017f5c..e5611950f5 100644
--- a/usr/src/lib/libsecdb/help/auths/Makefile
+++ b/usr/src/lib/libsecdb/help/auths/Makefile
@@ -86,6 +86,7 @@ HTMLENTS = \
SmfNDMPStates.html \
SmfNWAMStates.html \
SmfPowerStates.html \
+ SmfReparseStates.html \
SmfRoutingStates.html \
SmfSendmailStates.html \
SmfSshStates.html \
diff --git a/usr/src/lib/libsecdb/help/auths/SmfReparseStates.html b/usr/src/lib/libsecdb/help/auths/SmfReparseStates.html
new file mode 100644
index 0000000000..c4c0d406e5
--- /dev/null
+++ b/usr/src/lib/libsecdb/help/auths/SmfReparseStates.html
@@ -0,0 +1,37 @@
+<HTML>
+<!--
+ CDDL HEADER START
+
+ The contents of this file are subject to the terms of the
+ Common Development and Distribution License (the "License").
+ You may not use this file except in compliance with the License.
+
+ You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ or http://www.opensolaris.org/os/licensing.
+ See the License for the specific language governing permissions
+ and limitations under the License.
+
+ When distributing Covered Code, include this CDDL HEADER in each
+ file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ If applicable, add the following below this CDDL HEADER, with the
+ fields enclosed by brackets "[]" replaced with your own identifying
+ information: Portions Copyright [yyyy] [name of copyright owner]
+
+ CDDL HEADER END
+
+Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+Use is subject to license terms.
+-->
+<!--
+ <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+-->
+<BODY>
+When Manage Reparse Service States is in the Authorizations Include
+column, it grants the authorization to enable, disable, or restart
+the Reparse service.
+<p>
+If Manage Reparse Service States is grayed, then you are not entitled
+to Add or Remove this authorization.
+<BR>&nbsp;
+</BODY>
+</HTML>
diff --git a/usr/src/lib/libsecdb/help/profiles/Makefile b/usr/src/lib/libsecdb/help/profiles/Makefile
index 153d1eae39..cb36914f91 100644
--- a/usr/src/lib/libsecdb/help/profiles/Makefile
+++ b/usr/src/lib/libsecdb/help/profiles/Makefile
@@ -69,6 +69,7 @@ HTMLENTS = \
RtObAccessMngmnt.html \
RtPrntAdmin.html \
RtProcManagement.html \
+ RtReparseMngmnt.html \
RtRightsDelegate.html \
RtSMBMngmnt.html \
RtSMBFSMngmnt.html \
diff --git a/usr/src/lib/libsecdb/help/profiles/RtReparseMngmnt.html b/usr/src/lib/libsecdb/help/profiles/RtReparseMngmnt.html
new file mode 100644
index 0000000000..c4c0d406e5
--- /dev/null
+++ b/usr/src/lib/libsecdb/help/profiles/RtReparseMngmnt.html
@@ -0,0 +1,37 @@
+<HTML>
+<!--
+ CDDL HEADER START
+
+ The contents of this file are subject to the terms of the
+ Common Development and Distribution License (the "License").
+ You may not use this file except in compliance with the License.
+
+ You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ or http://www.opensolaris.org/os/licensing.
+ See the License for the specific language governing permissions
+ and limitations under the License.
+
+ When distributing Covered Code, include this CDDL HEADER in each
+ file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ If applicable, add the following below this CDDL HEADER, with the
+ fields enclosed by brackets "[]" replaced with your own identifying
+ information: Portions Copyright [yyyy] [name of copyright owner]
+
+ CDDL HEADER END
+
+Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+Use is subject to license terms.
+-->
+<!--
+ <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+-->
+<BODY>
+When Manage Reparse Service States is in the Authorizations Include
+column, it grants the authorization to enable, disable, or restart
+the Reparse service.
+<p>
+If Manage Reparse Service States is grayed, then you are not entitled
+to Add or Remove this authorization.
+<BR>&nbsp;
+</BODY>
+</HTML>
diff --git a/usr/src/lib/libsecdb/prof_attr.txt b/usr/src/lib/libsecdb/prof_attr.txt
index 1bb782d6d3..96bfbfc5c9 100644
--- a/usr/src/lib/libsecdb/prof_attr.txt
+++ b/usr/src/lib/libsecdb/prof_attr.txt
@@ -72,6 +72,7 @@ Name Service Management:::Non-security name service scripts/commands:help=RtName
Name Service Security:::Security related name service scripts/commands:help=RtNameServiceSecure.html
Object Access Management:::Change ownership and permission on files:help=RtObAccessMngmnt.html
Process Management:::Manage current processes and processors:auths=solaris.smf.manage.cron,solaris.smf.manage.power;help=RtProcManagement.html
+Reparse Management:::Manage the reparse service:auths=solaris.smf.manage.reparse:help=RtReparseMngmnt.html
Rights Delegation:::Delegate ability to assign rights to users and roles:auths=solaris.role.delegate,solaris.profmgr.delegate,solaris.grant;help=RtRightsDelegate.html
Rmvolmgr Management:::Manage Removable Volume Manager SMF service:auths=solaris.smf.manage.rmvolmgr;help=RtRmvolmgrMngmnt.html
Service Management:::Manage services:auths=solaris.smf.manage,solaris.smf.modify
diff --git a/usr/src/lib/libzpool/common/sys/zfs_context.h b/usr/src/lib/libzpool/common/sys/zfs_context.h
index 2c02170556..b4707ce9ee 100644
--- a/usr/src/lib/libzpool/common/sys/zfs_context.h
+++ b/usr/src/lib/libzpool/common/sys/zfs_context.h
@@ -346,6 +346,7 @@ typedef struct vnode {
char *v_path;
} vnode_t;
+#define AV_SCANSTAMP_SZ 32 /* length of anti-virus scanstamp */
typedef struct xoptattr {
timestruc_t xoa_createtime; /* Create time of file */
@@ -361,6 +362,8 @@ typedef struct xoptattr {
uint8_t xoa_opaque;
uint8_t xoa_av_quarantined;
uint8_t xoa_av_modified;
+ uint8_t xoa_av_scanstamp[AV_SCANSTAMP_SZ];
+ uint8_t xoa_reparse;
} xoptattr_t;
typedef struct vattr {