summaryrefslogtreecommitdiff
path: root/usr/src/lib/libshare/common/plugin.c
diff options
context:
space:
mode:
authorjose borrego <Jose.Borrego@Sun.COM>2008-12-10 22:16:19 -0700
committerjose borrego <Jose.Borrego@Sun.COM>2008-12-10 22:16:19 -0700
commit8d7e41661dc4633488e93b13363137523ce59977 (patch)
treef99aaf6e18e0f90100fa87a97e13137f5800b089 /usr/src/lib/libshare/common/plugin.c
parentf85c7842adab30da40b7225f83b02f9df9fbb1f0 (diff)
downloadillumos-joyent-8d7e41661dc4633488e93b13363137523ce59977.tar.gz
6762162 $DATA appended to streams when stream type != $DATA
6736548 After switching the security mode, sometimes smb/server enters maintenance state 6764225 First domain join attempt after smb/server restarts could fail 6764343 Unable to map a share in a new domain 6673517 Appliance\Share becomes unbrowseable for ~10 mins after CIFS client leaves/rejoins the workgroup 6765259 multiple refreshes may not pick up most recent configuration 6764275 need to check with sharemgr when there's a cache miss 6765313 System panic occurred in smb_node_fini+0x16a() 6769943 Purge mlrpc from from types, functions and definitions 6765390 Deprecate smb_wins.c 6771815 ndr_server.c should not include libmlsvc.h 6732763 smbadm takes invalid workgroup name 6749515 Unable to grant domain users/groups access to files 6765156 Active Directory setup has problems if the NETBIOS domain name does not match AD FQDN 6735548 Domain users cannot connect to CIFS shares from MacOS 10.5 6631366 Able to join W2K3 domain with wrong domain name after joined with correct domain name. 6768067 The "smbadm list" should display FQDN 6768061 SMB daemon turned into maintenance mode while updating ddns 6773309 smbd can miss SIGTERM and fail to exit since some threads allow SIGTERM 6775912 smbd: idmap handle access is not thread safe 6775155 core.smbd dump at smb_shr_sa_loadall+0x1f 6776818 Use of freed memory in smbrdr_logon_user() 6766126 Per-share support to configure/disable client-side caching (offline files) 6778831 smbadm definition of domain is too strict, should allow leading digit 6780207 libumem.so.1`process_free+0x55 crash while running smbtorture base tests. --HG-- rename : usr/src/uts/common/smbsrv/lsalib.h => usr/src/lib/smbsrv/libmlsvc/common/lsalib.h rename : usr/src/uts/common/smbsrv/samlib.h => usr/src/lib/smbsrv/libmlsvc/common/samlib.h
Diffstat (limited to 'usr/src/lib/libshare/common/plugin.c')
-rw-r--r--usr/src/lib/libshare/common/plugin.c132
1 files changed, 77 insertions, 55 deletions
diff --git a/usr/src/lib/libshare/common/plugin.c b/usr/src/lib/libshare/common/plugin.c
index 032793cd79..1dba19ff74 100644
--- a/usr/src/lib/libshare/common/plugin.c
+++ b/usr/src/lib/libshare/common/plugin.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -58,15 +56,30 @@ static struct sa_proto_handle sa_proto_handle;
void proto_plugin_fini();
/*
+ * Returns true if name is "." or "..", otherwise returns false.
+ */
+static boolean_t
+proto_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);
+}
+
+/*
* proto_plugin_init()
*
* Initialize the protocol specific plugin modules.
*
- * Walk /usr/lib/fs/\* for libshare_*.so modules. That is,
- * /usr/lib/fs/nfs/libshare_nfs.so. The protocol specific directory
- * would have a modules with name libshare_<proto>.so. If one is
- * found, initialize it and add to the internal list of
- * protocols. These are used for protocol specific operations.
+ * Walk /usr/lib/fs/\* for libshare_*.so modules, for example,
+ * /usr/lib/fs/nfs/libshare_nfs.so. A protocol specific directory
+ * would have modules with names of the form libshare_<proto>.so.
+ * For each protocol found, initialize it and add it to the internal
+ * list of protocols. These are used for protocol specific operations.
*/
int
@@ -80,60 +93,69 @@ proto_plugin_init()
struct dirent *dent;
int ret = SA_OK;
struct stat st;
-
- /*
- * Should walk "/usr/lib/fs/" for files of the form:
- * libshare_*.so
- */
- dir = opendir(SA_LIB_DIR);
- if (dir != NULL) {
- while (ret == SA_OK && (dent = readdir(dir)) != NULL) {
- char path[MAXPATHLEN];
- char isa[MAXISALEN];
+ char isa[MAXISALEN];
#if defined(_LP64)
- if (sysinfo(SI_ARCHITECTURE_64, isa, MAXISALEN) == -1)
- isa[0] = '\0';
+ if (sysinfo(SI_ARCHITECTURE_64, isa, MAXISALEN) == -1)
+ isa[0] = '\0';
#else
- isa[0] = '\0';
+ isa[0] = '\0';
#endif
- (void) snprintf(path, MAXPATHLEN,
- "%s/%s/%s/libshare_%s.so.1", SA_LIB_DIR,
- dent->d_name, isa, dent->d_name);
- /*
- * If file doesn't exist, don't try to map it
- */
- if (stat(path, &st) < 0)
- continue;
-
- dlhandle = dlopen(path, RTLD_FIRST|RTLD_LAZY);
- if (dlhandle != NULL) {
- plugin_ops = (struct sa_plugin_ops *)
- dlsym(dlhandle, "sa_plugin_ops");
- proto = (struct sa_proto_plugin *)
- calloc(1, sizeof (struct sa_proto_plugin));
- if (proto != NULL) {
- proto->plugin_ops = plugin_ops;
- proto->plugin_handle = dlhandle;
- num_protos++;
- proto->plugin_next = sap_proto_list;
- sap_proto_list = proto;
- } else {
- ret = SA_NO_MEMORY;
- /* Don't leak a dlhandle */
- (void) dlclose(dlhandle);
- break;
- }
- } else {
- (void) fprintf(stderr,
- dgettext(TEXT_DOMAIN,
- "Error in plugin for protocol %s: %s\n"),
- dent->d_name, dlerror());
- }
+
+ if ((dir = opendir(SA_LIB_DIR)) == NULL)
+ return (SA_OK);
+
+ while ((dent = readdir(dir)) != NULL) {
+ char path[MAXPATHLEN];
+
+ if (proto_is_dot_or_dotdot(dent->d_name))
+ continue;
+
+ (void) snprintf(path, MAXPATHLEN,
+ "%s/%s/%s/libshare_%s.so.1", SA_LIB_DIR,
+ dent->d_name, isa, 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) {
+ (void) fprintf(stderr, dgettext(TEXT_DOMAIN,
+ "Error in plugin for protocol %s: %s\n"),
+ dent->d_name, dlerror());
+ continue;
+ }
+
+ plugin_ops = (struct sa_plugin_ops *)
+ dlsym(dlhandle, "sa_plugin_ops");
+ if (plugin_ops == NULL) {
+ (void) fprintf(stderr, dgettext(TEXT_DOMAIN,
+ "Error in plugin ops for protocol %s: %s\n"),
+ dent->d_name, dlerror());
+ (void) dlclose(dlhandle);
+ continue;
}
- (void) closedir(dir);
+
+ proto = (struct sa_proto_plugin *)
+ calloc(1, sizeof (struct sa_proto_plugin));
+ if (proto == NULL) {
+ (void) dlclose(dlhandle);
+ ret = SA_NO_MEMORY;
+ continue;
+ }
+
+ proto->plugin_ops = plugin_ops;
+ proto->plugin_handle = dlhandle;
+ num_protos++;
+ proto->plugin_next = sap_proto_list;
+ sap_proto_list = proto;
}
- if (ret == SA_OK) {
+
+ (void) closedir(dir);
+
+ if (num_protos != 0) {
sa_proto_handle.sa_proto =
(char **)calloc(num_protos, sizeof (char *));
sa_proto_handle.sa_ops =