diff options
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/cmd/fs.d/nfs/lib/nfs_sec.c | 11 | ||||
-rw-r--r-- | usr/src/cmd/fs.d/nfs/lib/sharetab.c | 10 | ||||
-rw-r--r-- | usr/src/cmd/fs.d/nfs/lib/smfcfg.c | 4 | ||||
-rw-r--r-- | usr/src/cmd/fs.d/nfs/mountd/Makefile | 9 | ||||
-rw-r--r-- | usr/src/cmd/fs.d/nfs/mountd/mountd.c | 31 | ||||
-rw-r--r-- | usr/src/cmd/fs.d/nfs/mountd/mountd.h | 11 | ||||
-rw-r--r-- | usr/src/cmd/fs.d/nfs/mountd/netgroup.c | 15 | ||||
-rw-r--r-- | usr/src/cmd/fs.d/nfs/mountd/nfs_cmd.c | 13 | ||||
-rw-r--r-- | usr/src/cmd/fs.d/nfs/mountd/rmtab.c | 14 |
9 files changed, 53 insertions, 65 deletions
diff --git a/usr/src/cmd/fs.d/nfs/lib/nfs_sec.c b/usr/src/cmd/fs.d/nfs/lib/nfs_sec.c index db163a9d93..06dc44a12c 100644 --- a/usr/src/cmd/fs.d/nfs/lib/nfs_sec.c +++ b/usr/src/cmd/fs.d/nfs/lib/nfs_sec.c @@ -21,11 +21,12 @@ /* LINTLIBRARY */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright 2015 Nexenta Systems, Inc. All rights reserved. */ + /* - * Copyright 2013 Nexenta Systems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ /* @@ -178,12 +179,14 @@ int skip; retp = p; while (*p) { - if (isspace(*p)) + if (isspace(*p)) { if (skip == TRUE) { shift1left(p); continue; } else break; + } + /* * Only process the escape of the space separator; * since the token may contain other separators, diff --git a/usr/src/cmd/fs.d/nfs/lib/sharetab.c b/usr/src/cmd/fs.d/nfs/lib/sharetab.c index 12c6aa62d9..0d5baa0bf7 100644 --- a/usr/src/cmd/fs.d/nfs/lib/sharetab.c +++ b/usr/src/cmd/fs.d/nfs/lib/sharetab.c @@ -20,6 +20,10 @@ */ /* + * Copyright 2015 Nexenta Systems, Inc. All rights reserved. + */ + +/* * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -32,8 +36,6 @@ * under license from the Regents of the University of California. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -175,9 +177,9 @@ getshareopt(char *optlist, char *opt) if (b == NULL) return (NULL); - while (p = (char *)strtok_r(b, ",", &lasts)) { + while ((p = strtok_r(b, ",", &lasts)) != NULL) { b = NULL; - if (pe = strchr(p, '=')) { + if ((pe = strchr(p, '=')) != NULL) { *pe = '\0'; if (strcmp(opt, p) == 0) { val = strdup(pe + 1); diff --git a/usr/src/cmd/fs.d/nfs/lib/smfcfg.c b/usr/src/cmd/fs.d/nfs/lib/smfcfg.c index ba2420362a..892f0cd052 100644 --- a/usr/src/cmd/fs.d/nfs/lib/smfcfg.c +++ b/usr/src/cmd/fs.d/nfs/lib/smfcfg.c @@ -20,9 +20,10 @@ */ /* + * Copyright 2015 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright 2011 Nexenta Systems, Inc. All rights reserved. */ + #include <stdio.h> #include <stdlib.h> #include <syslog.h> @@ -115,7 +116,6 @@ fs_smf_set_prop(smf_fstype_t fstype, char *prop_name, char *valbuf, scf_instance_t *inst; scf_value_t *val; int valint; - int index = 0; int ret = 0; char *p = NULL; char *svcname, srv[MAXPATHLEN]; diff --git a/usr/src/cmd/fs.d/nfs/mountd/Makefile b/usr/src/cmd/fs.d/nfs/mountd/Makefile index 50b6d21ae0..eca0a82911 100644 --- a/usr/src/cmd/fs.d/nfs/mountd/Makefile +++ b/usr/src/cmd/fs.d/nfs/mountd/Makefile @@ -18,9 +18,10 @@ # # CDDL HEADER END # + # +# Copyright 2015 Nexenta Systems, Inc. All rights reserved. # Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved. -# Copyright 2014 Nexenta Systems, Inc. All rights reserved. # FSTYPE = nfs @@ -40,14 +41,8 @@ DOBJ = $(DSRC:%.d=%.o) LDLIBS += -lrpcsvc -lnsl -lbsm -lsocket -ltsnet -ltsol -lnvpair -lscf -lumem CPPFLAGS += -D_REENTRANT -I../lib -CERRWARN += -_gcc=-Wno-implicit-function-declaration -CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-unused-variable -CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-address -CERRWARN += -_gcc=-Wno-unused-function $(TYPEPROG): $(OBJS) $(COMPILE.d) -s $(DSRC) -o $(DOBJ) $(OBJS) diff --git a/usr/src/cmd/fs.d/nfs/mountd/mountd.c b/usr/src/cmd/fs.d/nfs/mountd/mountd.c index 0d9ac76d30..50180d3815 100644 --- a/usr/src/cmd/fs.d/nfs/mountd/mountd.c +++ b/usr/src/cmd/fs.d/nfs/mountd/mountd.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2014 Nexenta Systems, Inc. All rights reserved. + * Copyright 2015 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. */ @@ -89,7 +89,9 @@ #include <alloca.h> extern int daemonize_init(void); -extern void daemonize_fini(int fd); +extern void daemonize_fini(int); + +extern int _nfssys(int, void *); struct sh_list *share_list; @@ -120,7 +122,6 @@ static int mount(struct svc_req *r); static void sh_free(struct sh_list *); static void umount(struct svc_req *); static void umountall(struct svc_req *); -static void sigexit(int); static int newopts(char *); static tsol_tpent_t *get_client_template(struct sockaddr *); @@ -129,10 +130,6 @@ static int rejecting; static int mount_vers_min = MOUNTVERS; static int mount_vers_max = MOUNTVERS3; -/* Needs to be accessed by nfscmd.c */ -int in_access_list(SVCXPRT *, struct netbuf **, - struct nd_hostservlist **, char *); - extern void nfscmd_func(void *, char *, size_t, door_desc_t *, uint_t); thread_t nfsauth_thread; @@ -911,7 +908,7 @@ log_cant_reply(SVCXPRT *transp) { int saverrno; struct nd_hostservlist *clnames = NULL; - register char *host; + char *host; struct netbuf *nb; saverrno = errno; /* save error code */ @@ -1495,7 +1492,6 @@ reply: if (path != NULL) svc_freeargs(transp, xdr_dirpath, (caddr_t)&path); -done: if (sh) sharefree(sh); netdir_free(clnames, ND_HOSTSERVLIST); @@ -1569,7 +1565,7 @@ findentry(char *path) { share_t *sh = NULL; struct sh_list *shp; - register char *p1, *p2; + char *p1, *p2; check_sharetab(); @@ -2410,7 +2406,7 @@ check_client_old(share_t *sh, SVCXPRT *transp, struct netbuf **nb, case OPT_NONE: /* - * Check if the client should have no access + * Check if the client should have no access * to this share at all. This option behaves * more like "root" than either "rw" or "ro". */ @@ -2782,7 +2778,7 @@ check_client_new(share_t *sh, SVCXPRT *transp, struct netbuf **nb, case OPT_NONE: /* - * Check if the client should have no access + * Check if the client should have no access * to this share at all. This option behaves * more like "root" than either "rw" or "ro". */ @@ -3122,7 +3118,7 @@ alloc_failed: static void sh_free(struct sh_list *shp) { - register struct sh_list *next; + struct sh_list *next; while (shp) { sharefree(shp->shl_sh); @@ -3236,15 +3232,6 @@ exmalloc(size_t size) return (ret); } -static void -sigexit(int signum) -{ - - if (signum == SIGHUP) - _exit(0); - _exit(1); -} - static tsol_tpent_t * get_client_template(struct sockaddr *sock) { diff --git a/usr/src/cmd/fs.d/nfs/mountd/mountd.h b/usr/src/cmd/fs.d/nfs/mountd/mountd.h index 54d352af79..1bc7b088a7 100644 --- a/usr/src/cmd/fs.d/nfs/mountd/mountd.h +++ b/usr/src/cmd/fs.d/nfs/mountd/mountd.h @@ -20,7 +20,7 @@ */ /* - * Copyright 2014 Nexenta Systems, Inc. All rights reserved. + * Copyright 2015 Nexenta Systems, Inc. All rights reserved. */ /* @@ -48,6 +48,7 @@ extern void mntlist_delete(char *host, char *path); extern void mntlist_delete_all(char *host); extern void netgroup_init(void); extern int netgroup_check(struct nd_hostservlist *, char *, int); +extern void netgrp_cache_flush(void); extern void export(struct svc_req *); extern void nfsauth_func(void *, char *, size_t, door_desc_t *, uint_t); extern char *inet_ntoa_r(struct in_addr, char *); @@ -69,6 +70,9 @@ extern int check_client(struct share *, struct netbuf *, gid_t *, uint_t *, gid_t **); extern struct nd_hostservlist *anon_client(char *host); +extern int in_access_list(SVCXPRT *, struct netbuf **, + struct nd_hostservlist **, char *); + /* * These functions are defined here due to the fact * that we can not find the proper header file to @@ -84,11 +88,6 @@ extern void audit_mountd_mount(char *, char *, int); extern void audit_mountd_umount(char *, char *); /* - * This is a hidden function in the rpc libraries (libnsl). - */ -extern int __rpc_negotiate_uid(int); - -/* * This appears to be a hidden function in libc. * Private interface to nss_search(). * Accepts N strings rather than 1. diff --git a/usr/src/cmd/fs.d/nfs/mountd/netgroup.c b/usr/src/cmd/fs.d/nfs/mountd/netgroup.c index 3563dbc77d..b5d4b7be79 100644 --- a/usr/src/cmd/fs.d/nfs/mountd/netgroup.c +++ b/usr/src/cmd/fs.d/nfs/mountd/netgroup.c @@ -20,12 +20,14 @@ */ /* + * Copyright 2015 Nexenta Systems, Inc. All rights reserved. + */ + +/* * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdio.h> #include <stdlib.h> #include <sys/types.h> @@ -142,7 +144,8 @@ netgroup_check(struct nd_hostservlist *clnames, char *glist, int grc) * can be grouped together for a single check. */ for (n = 0; i < grc; i++, n++, gr += strlen(gr) + 1) { - if (response && *gr == '-' || !response && *gr != '-') + if ((response && *gr == '-') || + (!response && *gr != '-')) break; grl[n] = response ? gr : gr + 1; @@ -160,9 +163,9 @@ netgroup_check(struct nd_hostservlist *clnames, char *glist, int grc) host = clnames->h_hostservs[j].h_host; if (__multi_innetgr(n, grl, - 1, &host, - 0, NULL, - 1, &domain)) + 1, &host, + 0, NULL, + 1, &domain)) belong = 1; } diff --git a/usr/src/cmd/fs.d/nfs/mountd/nfs_cmd.c b/usr/src/cmd/fs.d/nfs/mountd/nfs_cmd.c index 8d80e6af0b..fba58fa821 100644 --- a/usr/src/cmd/fs.d/nfs/mountd/nfs_cmd.c +++ b/usr/src/cmd/fs.d/nfs/mountd/nfs_cmd.c @@ -20,6 +20,7 @@ */ /* + * Copyright 2015 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. */ @@ -39,8 +40,10 @@ #include <locale.h> #include <strings.h> #include <sharefs/share.h> +#include <stdlib.h> +#include "../lib/sharetab.h" +#include "mountd.h" -extern struct share *findentry(char *); /* * The following codesets must match what is in libshare_nfs.c until we can * request them from the kernel. @@ -98,17 +101,10 @@ charmap_search(struct netbuf *nbuf, char *opts) char *next; char *name; char *result = NULL; - char *netid; struct netconfig *nconf; struct nd_hostservlist *hl = NULL; struct sockaddr *sa; - /* eventually charopts should be dynamically setup */ - if (charopts == NULL) { - free(copts); - return (NULL); - } - sa = (struct sockaddr *)nbuf->buf; switch (sa->sa_family) { @@ -186,7 +182,6 @@ nfscmd_charmap_lookup(door_desc_t *dp, nfscmd_arg_t *args) struct netbuf nb; struct sockaddr sa; struct share *sh = NULL; - char *opts; char *name; memset(&res, '\0', sizeof (res)); diff --git a/usr/src/cmd/fs.d/nfs/mountd/rmtab.c b/usr/src/cmd/fs.d/nfs/mountd/rmtab.c index 5ed514080e..8d44cd3932 100644 --- a/usr/src/cmd/fs.d/nfs/mountd/rmtab.c +++ b/usr/src/cmd/fs.d/nfs/mountd/rmtab.c @@ -20,6 +20,10 @@ */ /* + * Copyright 2015 Nexenta Systems, Inc. All rights reserved. + */ + +/* * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -155,7 +159,7 @@ mntlist_delete(char *host, char *path) (void) rw_wrlock(&rmtab_lock); - if (m = (struct mntentry *)h_get(mntlist, &mm)) { + if ((m = (struct mntentry *)h_get(mntlist, &mm)) != NULL) { rmtab_delete(m->m_pos); (void) h_delete(mntlist, m); @@ -184,7 +188,7 @@ mntlist_delete_all(char *host) iterator = h_iterator(mntlist); - while (m = (struct mntentry *)h_next(iterator)) { + while ((m = (struct mntentry *)h_next(iterator)) != NULL) { if (strcasecmp(m->m_host, host)) continue; @@ -321,7 +325,7 @@ rmtab_rewrite() (void) fclose(rmtabf); /* Rewrite the file. */ - if (rmtabf = fopen(RMTAB, "w+")) { + if ((rmtabf = fopen(RMTAB, "w+")) != NULL) { HASHSET_ITERATOR iterator; struct mntentry *m; @@ -331,7 +335,7 @@ rmtab_rewrite() iterator = h_iterator(mntlist); - while (m = (struct mntentry *)h_next(iterator)) + while ((m = (struct mntentry *)h_next(iterator)) != NULL) m->m_pos = rmtab_insert(m->m_host, m->m_path); if (iterator != NULL) free(iterator); @@ -432,7 +436,7 @@ rmtab_load() */ mntlist = h_create(mntentry_hash, mntentry_equal, 101, 0.75); - if (fp = fopen(RMTAB, "r")) { + if ((fp = fopen(RMTAB, "r")) != NULL) { char buf[RMTAB_LOADLEN+1]; size_t len; |