Deleted Added
full compact
mountd.c (194773) mountd.c (194880)
1/*
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Herb Hasler and Rick Macklem at The University of Guelph.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 29 unchanged lines hidden (view full) ---

38
39#if 0
40#ifndef lint
41static char sccsid[] = "@(#)mountd.c 8.15 (Berkeley) 5/1/95";
42#endif /*not lint*/
43#endif
44
45#include <sys/cdefs.h>
1/*
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Herb Hasler and Rick Macklem at The University of Guelph.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 29 unchanged lines hidden (view full) ---

38
39#if 0
40#ifndef lint
41static char sccsid[] = "@(#)mountd.c 8.15 (Berkeley) 5/1/95";
42#endif /*not lint*/
43#endif
44
45#include <sys/cdefs.h>
46__FBSDID("$FreeBSD: head/usr.sbin/mountd/mountd.c 194773 2009-06-23 21:48:04Z rmacklem $");
46__FBSDID("$FreeBSD: head/usr.sbin/mountd/mountd.c 194880 2009-06-24 18:42:21Z dfr $");
47
48#include <sys/param.h>
49#include <sys/fcntl.h>
50#include <sys/linker.h>
51#include <sys/module.h>
52#include <sys/mount.h>
53#include <sys/stat.h>
54#include <sys/sysctl.h>
55#include <sys/syslog.h>
56
57#include <rpc/rpc.h>
58#include <rpc/rpc_com.h>
59#include <rpc/pmap_clnt.h>
60#include <rpc/pmap_prot.h>
61#include <rpcsvc/mount.h>
47
48#include <sys/param.h>
49#include <sys/fcntl.h>
50#include <sys/linker.h>
51#include <sys/module.h>
52#include <sys/mount.h>
53#include <sys/stat.h>
54#include <sys/sysctl.h>
55#include <sys/syslog.h>
56
57#include <rpc/rpc.h>
58#include <rpc/rpc_com.h>
59#include <rpc/pmap_clnt.h>
60#include <rpc/pmap_prot.h>
61#include <rpcsvc/mount.h>
62#include <nfs/rpcv2.h>
63#include <nfs/nfsproto.h>
64#include <nfs/nfssvc.h>
65#include <nfsserver/nfs.h>
66
67#include <fs/nfs/nfsport.h>
68
69#include <arpa/inet.h>
70

--- 17 unchanged lines hidden (view full) ---

88#include <stdarg.h>
89#endif
90
91/*
92 * Structures for keeping the mount list and export list
93 */
94struct mountlist {
95 struct mountlist *ml_next;
62#include <nfs/nfsproto.h>
63#include <nfs/nfssvc.h>
64#include <nfsserver/nfs.h>
65
66#include <fs/nfs/nfsport.h>
67
68#include <arpa/inet.h>
69

--- 17 unchanged lines hidden (view full) ---

87#include <stdarg.h>
88#endif
89
90/*
91 * Structures for keeping the mount list and export list
92 */
93struct mountlist {
94 struct mountlist *ml_next;
96 char ml_host[RPCMNT_NAMELEN+1];
97 char ml_dirp[RPCMNT_PATHLEN+1];
95 char ml_host[MNTNAMLEN+1];
96 char ml_dirp[MNTPATHLEN+1];
98};
99
100struct dirlist {
101 struct dirlist *dp_left;
102 struct dirlist *dp_right;
103 int dp_flag;
104 struct hostlist *dp_hosts; /* List of hosts this dir exported to */
105 char dp_dirp[1]; /* Actually malloc'd to size of dir */

--- 287 unchanged lines hidden (view full) ---

393 signal(SIGQUIT, SIG_IGN);
394 }
395 signal(SIGHUP, huphandler);
396 signal(SIGTERM, terminate);
397 signal(SIGPIPE, SIG_IGN);
398
399 pidfile_write(pfh);
400
97};
98
99struct dirlist {
100 struct dirlist *dp_left;
101 struct dirlist *dp_right;
102 int dp_flag;
103 struct hostlist *dp_hosts; /* List of hosts this dir exported to */
104 char dp_dirp[1]; /* Actually malloc'd to size of dir */

--- 287 unchanged lines hidden (view full) ---

392 signal(SIGQUIT, SIG_IGN);
393 }
394 signal(SIGHUP, huphandler);
395 signal(SIGTERM, terminate);
396 signal(SIGPIPE, SIG_IGN);
397
398 pidfile_write(pfh);
399
401 rpcb_unset(RPCPROG_MNT, RPCMNT_VER1, NULL);
402 rpcb_unset(RPCPROG_MNT, RPCMNT_VER3, NULL);
400 rpcb_unset(MOUNTPROG, MOUNTVERS, NULL);
401 rpcb_unset(MOUNTPROG, MOUNTVERS3, NULL);
403 rpc_control(RPC_SVC_CONNMAXREC_SET, &maxrec);
404
405 if (!resvport_only) {
406 if (sysctlbyname("vfs.nfsrv.nfs_privport", NULL, NULL,
407 &resvport_only, sizeof(resvport_only)) != 0 &&
408 errno != ENOENT) {
409 syslog(LOG_ERR, "sysctl: %m");
410 exit(1);

--- 257 unchanged lines hidden (view full) ---

668
669 if (nconf->nc_semantics == NC_TPI_CLTS )
670 transp = svc_dg_create(fd, 0, 0);
671 else
672 transp = svc_vc_create(fd, RPC_MAXDATASIZE,
673 RPC_MAXDATASIZE);
674
675 if (transp != (SVCXPRT *) NULL) {
402 rpc_control(RPC_SVC_CONNMAXREC_SET, &maxrec);
403
404 if (!resvport_only) {
405 if (sysctlbyname("vfs.nfsrv.nfs_privport", NULL, NULL,
406 &resvport_only, sizeof(resvport_only)) != 0 &&
407 errno != ENOENT) {
408 syslog(LOG_ERR, "sysctl: %m");
409 exit(1);

--- 257 unchanged lines hidden (view full) ---

667
668 if (nconf->nc_semantics == NC_TPI_CLTS )
669 transp = svc_dg_create(fd, 0, 0);
670 else
671 transp = svc_vc_create(fd, RPC_MAXDATASIZE,
672 RPC_MAXDATASIZE);
673
674 if (transp != (SVCXPRT *) NULL) {
676 if (!svc_reg(transp, RPCPROG_MNT, RPCMNT_VER1, mntsrv,
675 if (!svc_reg(transp, MOUNTPROG, MOUNTVERS, mntsrv,
677 NULL))
678 syslog(LOG_ERR,
676 NULL))
677 syslog(LOG_ERR,
679 "can't register %s RPCMNT_VER1 service",
678 "can't register %s MOUNTVERS service",
680 nconf->nc_netid);
681 if (!force_v2) {
679 nconf->nc_netid);
680 if (!force_v2) {
682 if (!svc_reg(transp, RPCPROG_MNT, RPCMNT_VER3,
681 if (!svc_reg(transp, MOUNTPROG, MOUNTVERS3,
683 mntsrv, NULL))
684 syslog(LOG_ERR,
682 mntsrv, NULL))
683 syslog(LOG_ERR,
685 "can't register %s RPCMNT_VER3 service",
684 "can't register %s MOUNTVERS3 service",
686 nconf->nc_netid);
687 }
688 } else
689 syslog(LOG_WARNING, "can't create %s services",
690 nconf->nc_netid);
691
692 if (registered == 0) {
693 registered = 1;

--- 21 unchanged lines hidden (view full) ---

715 gai_strerror(aicode));
716 exit(1);
717 }
718
719 servaddr.buf = malloc(res->ai_addrlen);
720 memcpy(servaddr.buf, res->ai_addr, res->ai_addrlen);
721 servaddr.len = res->ai_addrlen;
722
685 nconf->nc_netid);
686 }
687 } else
688 syslog(LOG_WARNING, "can't create %s services",
689 nconf->nc_netid);
690
691 if (registered == 0) {
692 registered = 1;

--- 21 unchanged lines hidden (view full) ---

714 gai_strerror(aicode));
715 exit(1);
716 }
717
718 servaddr.buf = malloc(res->ai_addrlen);
719 memcpy(servaddr.buf, res->ai_addr, res->ai_addrlen);
720 servaddr.len = res->ai_addrlen;
721
723 rpcb_set(RPCPROG_MNT, RPCMNT_VER1, nconf, &servaddr);
724 rpcb_set(RPCPROG_MNT, RPCMNT_VER3, nconf, &servaddr);
722 rpcb_set(MOUNTPROG, MOUNTVERS, nconf, &servaddr);
723 rpcb_set(MOUNTPROG, MOUNTVERS3, nconf, &servaddr);
725
726 xcreated++;
727 freeaddrinfo(res);
728 }
729 } /* end while */
730}
731
732static void

--- 17 unchanged lines hidden (view full) ---

750 struct dirlist *dp;
751 struct fhreturn fhr;
752 struct stat stb;
753 struct statfs fsb;
754 char host[NI_MAXHOST], numerichost[NI_MAXHOST];
755 int lookup_failed = 1;
756 struct sockaddr *saddr;
757 u_short sport;
724
725 xcreated++;
726 freeaddrinfo(res);
727 }
728 } /* end while */
729}
730
731static void

--- 17 unchanged lines hidden (view full) ---

749 struct dirlist *dp;
750 struct fhreturn fhr;
751 struct stat stb;
752 struct statfs fsb;
753 char host[NI_MAXHOST], numerichost[NI_MAXHOST];
754 int lookup_failed = 1;
755 struct sockaddr *saddr;
756 u_short sport;
758 char rpcpath[RPCMNT_PATHLEN + 1], dirpath[MAXPATHLEN];
757 char rpcpath[MNTPATHLEN + 1], dirpath[MAXPATHLEN];
759 int bad = 0, defset, hostset;
760 sigset_t sighup_mask;
761
762 sigemptyset(&sighup_mask);
763 sigaddset(&sighup_mask, SIGHUP);
764 saddr = svc_getrpccaller(transp)->buf;
765 switch (saddr->sa_family) {
766 case AF_INET6:

--- 10 unchanged lines hidden (view full) ---

777 NULL, 0, 0);
778 getnameinfo(saddr, saddr->sa_len, numerichost,
779 sizeof numerichost, NULL, 0, NI_NUMERICHOST);
780 switch (rqstp->rq_proc) {
781 case NULLPROC:
782 if (!svc_sendreply(transp, (xdrproc_t)xdr_void, NULL))
783 syslog(LOG_ERR, "can't send reply");
784 return;
758 int bad = 0, defset, hostset;
759 sigset_t sighup_mask;
760
761 sigemptyset(&sighup_mask);
762 sigaddset(&sighup_mask, SIGHUP);
763 saddr = svc_getrpccaller(transp)->buf;
764 switch (saddr->sa_family) {
765 case AF_INET6:

--- 10 unchanged lines hidden (view full) ---

776 NULL, 0, 0);
777 getnameinfo(saddr, saddr->sa_len, numerichost,
778 sizeof numerichost, NULL, 0, NI_NUMERICHOST);
779 switch (rqstp->rq_proc) {
780 case NULLPROC:
781 if (!svc_sendreply(transp, (xdrproc_t)xdr_void, NULL))
782 syslog(LOG_ERR, "can't send reply");
783 return;
785 case RPCMNT_MOUNT:
784 case MOUNTPROC_MNT:
786 if (sport >= IPPORT_RESERVED && resvport_only) {
787 syslog(LOG_NOTICE,
788 "mount request from %s from unprivileged port",
789 numerichost);
790 svcerr_weakauth(transp);
791 return;
792 }
793 if (!svc_getargs(transp, (xdrproc_t)xdr_dir, rpcpath)) {

--- 76 unchanged lines hidden (view full) ---

870 numerichost, dirpath);
871 }
872
873 if (bad && !svc_sendreply(transp, (xdrproc_t)xdr_long,
874 (caddr_t)&bad))
875 syslog(LOG_ERR, "can't send reply");
876 sigprocmask(SIG_UNBLOCK, &sighup_mask, NULL);
877 return;
785 if (sport >= IPPORT_RESERVED && resvport_only) {
786 syslog(LOG_NOTICE,
787 "mount request from %s from unprivileged port",
788 numerichost);
789 svcerr_weakauth(transp);
790 return;
791 }
792 if (!svc_getargs(transp, (xdrproc_t)xdr_dir, rpcpath)) {

--- 76 unchanged lines hidden (view full) ---

869 numerichost, dirpath);
870 }
871
872 if (bad && !svc_sendreply(transp, (xdrproc_t)xdr_long,
873 (caddr_t)&bad))
874 syslog(LOG_ERR, "can't send reply");
875 sigprocmask(SIG_UNBLOCK, &sighup_mask, NULL);
876 return;
878 case RPCMNT_DUMP:
877 case MOUNTPROC_DUMP:
879 if (!svc_sendreply(transp, (xdrproc_t)xdr_mlist, (caddr_t)NULL))
880 syslog(LOG_ERR, "can't send reply");
881 else if (dolog)
882 syslog(LOG_NOTICE,
883 "dump request succeeded from %s",
884 numerichost);
885 return;
878 if (!svc_sendreply(transp, (xdrproc_t)xdr_mlist, (caddr_t)NULL))
879 syslog(LOG_ERR, "can't send reply");
880 else if (dolog)
881 syslog(LOG_NOTICE,
882 "dump request succeeded from %s",
883 numerichost);
884 return;
886 case RPCMNT_UMOUNT:
885 case MOUNTPROC_UMNT:
887 if (sport >= IPPORT_RESERVED && resvport_only) {
888 syslog(LOG_NOTICE,
889 "umount request from %s from unprivileged port",
890 numerichost);
891 svcerr_weakauth(transp);
892 return;
893 }
894 if (!svc_getargs(transp, (xdrproc_t)xdr_dir, rpcpath)) {

--- 12 unchanged lines hidden (view full) ---

907 if (!lookup_failed)
908 del_mlist(host, dirpath);
909 del_mlist(numerichost, dirpath);
910 if (dolog)
911 syslog(LOG_NOTICE,
912 "umount request succeeded from %s for %s",
913 numerichost, dirpath);
914 return;
886 if (sport >= IPPORT_RESERVED && resvport_only) {
887 syslog(LOG_NOTICE,
888 "umount request from %s from unprivileged port",
889 numerichost);
890 svcerr_weakauth(transp);
891 return;
892 }
893 if (!svc_getargs(transp, (xdrproc_t)xdr_dir, rpcpath)) {

--- 12 unchanged lines hidden (view full) ---

906 if (!lookup_failed)
907 del_mlist(host, dirpath);
908 del_mlist(numerichost, dirpath);
909 if (dolog)
910 syslog(LOG_NOTICE,
911 "umount request succeeded from %s for %s",
912 numerichost, dirpath);
913 return;
915 case RPCMNT_UMNTALL:
914 case MOUNTPROC_UMNTALL:
916 if (sport >= IPPORT_RESERVED && resvport_only) {
917 syslog(LOG_NOTICE,
918 "umountall request from %s from unprivileged port",
919 numerichost);
920 svcerr_weakauth(transp);
921 return;
922 }
923 if (!svc_sendreply(transp, (xdrproc_t)xdr_void, (caddr_t)NULL))
924 syslog(LOG_ERR, "can't send reply");
925 if (!lookup_failed)
926 del_mlist(host, NULL);
927 del_mlist(numerichost, NULL);
928 if (dolog)
929 syslog(LOG_NOTICE,
930 "umountall request succeeded from %s",
931 numerichost);
932 return;
915 if (sport >= IPPORT_RESERVED && resvport_only) {
916 syslog(LOG_NOTICE,
917 "umountall request from %s from unprivileged port",
918 numerichost);
919 svcerr_weakauth(transp);
920 return;
921 }
922 if (!svc_sendreply(transp, (xdrproc_t)xdr_void, (caddr_t)NULL))
923 syslog(LOG_ERR, "can't send reply");
924 if (!lookup_failed)
925 del_mlist(host, NULL);
926 del_mlist(numerichost, NULL);
927 if (dolog)
928 syslog(LOG_NOTICE,
929 "umountall request succeeded from %s",
930 numerichost);
931 return;
933 case RPCMNT_EXPORT:
932 case MOUNTPROC_EXPORT:
934 if (!svc_sendreply(transp, (xdrproc_t)xdr_explist, (caddr_t)NULL))
935 if (!svc_sendreply(transp, (xdrproc_t)xdr_explist_brief,
936 (caddr_t)NULL))
937 syslog(LOG_ERR, "can't send reply");
938 if (dolog)
939 syslog(LOG_NOTICE,
940 "export request succeeded from %s",
941 numerichost);

--- 7 unchanged lines hidden (view full) ---

949/*
950 * Xdr conversion for a dirpath string
951 */
952int
953xdr_dir(xdrsp, dirp)
954 XDR *xdrsp;
955 char *dirp;
956{
933 if (!svc_sendreply(transp, (xdrproc_t)xdr_explist, (caddr_t)NULL))
934 if (!svc_sendreply(transp, (xdrproc_t)xdr_explist_brief,
935 (caddr_t)NULL))
936 syslog(LOG_ERR, "can't send reply");
937 if (dolog)
938 syslog(LOG_NOTICE,
939 "export request succeeded from %s",
940 numerichost);

--- 7 unchanged lines hidden (view full) ---

948/*
949 * Xdr conversion for a dirpath string
950 */
951int
952xdr_dir(xdrsp, dirp)
953 XDR *xdrsp;
954 char *dirp;
955{
957 return (xdr_string(xdrsp, &dirp, RPCMNT_PATHLEN));
956 return (xdr_string(xdrsp, &dirp, MNTPATHLEN));
958}
959
960/*
961 * Xdr routine to generate file handle reply
962 */
963int
964xdr_fhs(xdrsp, cp)
965 XDR *xdrsp;

--- 42 unchanged lines hidden (view full) ---

1008 int false = 0;
1009 char *strp;
1010
1011 mlp = mlhead;
1012 while (mlp) {
1013 if (!xdr_bool(xdrsp, &true))
1014 return (0);
1015 strp = &mlp->ml_host[0];
957}
958
959/*
960 * Xdr routine to generate file handle reply
961 */
962int
963xdr_fhs(xdrsp, cp)
964 XDR *xdrsp;

--- 42 unchanged lines hidden (view full) ---

1007 int false = 0;
1008 char *strp;
1009
1010 mlp = mlhead;
1011 while (mlp) {
1012 if (!xdr_bool(xdrsp, &true))
1013 return (0);
1014 strp = &mlp->ml_host[0];
1016 if (!xdr_string(xdrsp, &strp, RPCMNT_NAMELEN))
1015 if (!xdr_string(xdrsp, &strp, MNTNAMLEN))
1017 return (0);
1018 strp = &mlp->ml_dirp[0];
1016 return (0);
1017 strp = &mlp->ml_dirp[0];
1019 if (!xdr_string(xdrsp, &strp, RPCMNT_PATHLEN))
1018 if (!xdr_string(xdrsp, &strp, MNTPATHLEN))
1020 return (0);
1021 mlp = mlp->ml_next;
1022 }
1023 if (!xdr_bool(xdrsp, &false))
1024 return (0);
1025 return (1);
1026}
1027

--- 55 unchanged lines hidden (view full) ---

1083 char *strp;
1084
1085 if (dp) {
1086 if (put_exlist(dp->dp_left, xdrsp, adp, putdefp, brief))
1087 return (1);
1088 if (!xdr_bool(xdrsp, &true))
1089 return (1);
1090 strp = dp->dp_dirp;
1019 return (0);
1020 mlp = mlp->ml_next;
1021 }
1022 if (!xdr_bool(xdrsp, &false))
1023 return (0);
1024 return (1);
1025}
1026

--- 55 unchanged lines hidden (view full) ---

1082 char *strp;
1083
1084 if (dp) {
1085 if (put_exlist(dp->dp_left, xdrsp, adp, putdefp, brief))
1086 return (1);
1087 if (!xdr_bool(xdrsp, &true))
1088 return (1);
1089 strp = dp->dp_dirp;
1091 if (!xdr_string(xdrsp, &strp, RPCMNT_PATHLEN))
1090 if (!xdr_string(xdrsp, &strp, MNTPATHLEN))
1092 return (1);
1093 if (adp && !strcmp(dp->dp_dirp, adp->dp_dirp)) {
1094 gotalldir = 1;
1095 *putdefp = 1;
1096 }
1097 if (brief) {
1098 if (!xdr_bool(xdrsp, &true))
1099 return (1);
1100 strp = "(...)";
1091 return (1);
1092 if (adp && !strcmp(dp->dp_dirp, adp->dp_dirp)) {
1093 gotalldir = 1;
1094 *putdefp = 1;
1095 }
1096 if (brief) {
1097 if (!xdr_bool(xdrsp, &true))
1098 return (1);
1099 strp = "(...)";
1101 if (!xdr_string(xdrsp, &strp, RPCMNT_PATHLEN))
1100 if (!xdr_string(xdrsp, &strp, MNTPATHLEN))
1102 return (1);
1103 } else if ((dp->dp_flag & DP_DEFSET) == 0 &&
1104 (gotalldir == 0 || (adp->dp_flag & DP_DEFSET) == 0)) {
1105 hp = dp->dp_hosts;
1106 while (hp) {
1107 grp = hp->ht_grp;
1108 if (grp->gr_type == GT_HOST) {
1109 if (!xdr_bool(xdrsp, &true))
1110 return (1);
1111 strp = grp->gr_ptr.gt_addrinfo->ai_canonname;
1112 if (!xdr_string(xdrsp, &strp,
1101 return (1);
1102 } else if ((dp->dp_flag & DP_DEFSET) == 0 &&
1103 (gotalldir == 0 || (adp->dp_flag & DP_DEFSET) == 0)) {
1104 hp = dp->dp_hosts;
1105 while (hp) {
1106 grp = hp->ht_grp;
1107 if (grp->gr_type == GT_HOST) {
1108 if (!xdr_bool(xdrsp, &true))
1109 return (1);
1110 strp = grp->gr_ptr.gt_addrinfo->ai_canonname;
1111 if (!xdr_string(xdrsp, &strp,
1113 RPCMNT_NAMELEN))
1112 MNTNAMLEN))
1114 return (1);
1115 } else if (grp->gr_type == GT_NET) {
1116 if (!xdr_bool(xdrsp, &true))
1117 return (1);
1118 strp = grp->gr_ptr.gt_net.nt_name;
1119 if (!xdr_string(xdrsp, &strp,
1113 return (1);
1114 } else if (grp->gr_type == GT_NET) {
1115 if (!xdr_bool(xdrsp, &true))
1116 return (1);
1117 strp = grp->gr_ptr.gt_net.nt_name;
1118 if (!xdr_string(xdrsp, &strp,
1120 RPCMNT_NAMELEN))
1119 MNTNAMLEN))
1121 return (1);
1122 }
1123 hp = hp->ht_next;
1124 if (gotalldir && hp == (struct hostlist *)NULL) {
1125 hp = adp->dp_hosts;
1126 gotalldir = 0;
1127 }
1128 }

--- 82 unchanged lines hidden (view full) ---

1211 }
1212
1213 /*
1214 * Create new exports list entry
1215 */
1216 len = endcp-cp;
1217 tgrp = grp = get_grp();
1218 while (len > 0) {
1120 return (1);
1121 }
1122 hp = hp->ht_next;
1123 if (gotalldir && hp == (struct hostlist *)NULL) {
1124 hp = adp->dp_hosts;
1125 gotalldir = 0;
1126 }
1127 }

--- 82 unchanged lines hidden (view full) ---

1210 }
1211
1212 /*
1213 * Create new exports list entry
1214 */
1215 len = endcp-cp;
1216 tgrp = grp = get_grp();
1217 while (len > 0) {
1219 if (len > RPCMNT_NAMELEN) {
1218 if (len > MNTNAMLEN) {
1220 getexp_err(ep, tgrp);
1221 goto nextline;
1222 }
1223 if (*cp == '-') {
1224 if (ep == (struct exportlist *)NULL) {
1225 getexp_err(ep, tgrp);
1226 goto nextline;
1227 }

--- 1485 unchanged lines hidden (view full) ---

2713 }
2714 cr->cr_groups[cr->cr_ngroups++] = gr->gr_gid;
2715 }
2716 }
2717 if (names != NULL && *names != '\0' && cr->cr_ngroups == XU_NGROUPS)
2718 syslog(LOG_ERR, "too many groups");
2719}
2720
1219 getexp_err(ep, tgrp);
1220 goto nextline;
1221 }
1222 if (*cp == '-') {
1223 if (ep == (struct exportlist *)NULL) {
1224 getexp_err(ep, tgrp);
1225 goto nextline;
1226 }

--- 1485 unchanged lines hidden (view full) ---

2712 }
2713 cr->cr_groups[cr->cr_ngroups++] = gr->gr_gid;
2714 }
2715 }
2716 if (names != NULL && *names != '\0' && cr->cr_ngroups == XU_NGROUPS)
2717 syslog(LOG_ERR, "too many groups");
2718}
2719
2721#define STRSIZ (RPCMNT_NAMELEN+RPCMNT_PATHLEN+50)
2720#define STRSIZ (MNTNAMLEN+MNTPATHLEN+50)
2722/*
2723 * Routines that maintain the remote mounttab
2724 */
2725void
2726get_mountlist()
2727{
2728 struct mountlist *mlp, **mlpp;
2729 char *host, *dirp, *cp;

--- 13 unchanged lines hidden (view full) ---

2743 cp = str;
2744 host = strsep(&cp, " \t\n");
2745 dirp = strsep(&cp, " \t\n");
2746 if (host == NULL || dirp == NULL)
2747 continue;
2748 mlp = (struct mountlist *)malloc(sizeof (*mlp));
2749 if (mlp == (struct mountlist *)NULL)
2750 out_of_mem();
2721/*
2722 * Routines that maintain the remote mounttab
2723 */
2724void
2725get_mountlist()
2726{
2727 struct mountlist *mlp, **mlpp;
2728 char *host, *dirp, *cp;

--- 13 unchanged lines hidden (view full) ---

2742 cp = str;
2743 host = strsep(&cp, " \t\n");
2744 dirp = strsep(&cp, " \t\n");
2745 if (host == NULL || dirp == NULL)
2746 continue;
2747 mlp = (struct mountlist *)malloc(sizeof (*mlp));
2748 if (mlp == (struct mountlist *)NULL)
2749 out_of_mem();
2751 strncpy(mlp->ml_host, host, RPCMNT_NAMELEN);
2752 mlp->ml_host[RPCMNT_NAMELEN] = '\0';
2753 strncpy(mlp->ml_dirp, dirp, RPCMNT_PATHLEN);
2754 mlp->ml_dirp[RPCMNT_PATHLEN] = '\0';
2750 strncpy(mlp->ml_host, host, MNTNAMLEN);
2751 mlp->ml_host[MNTNAMLEN] = '\0';
2752 strncpy(mlp->ml_dirp, dirp, MNTPATHLEN);
2753 mlp->ml_dirp[MNTPATHLEN] = '\0';
2755 mlp->ml_next = (struct mountlist *)NULL;
2756 *mlpp = mlp;
2757 mlpp = &mlp->ml_next;
2758 }
2759 fclose(mlfile);
2760}
2761
2762void

--- 45 unchanged lines hidden (view full) ---

2808 if (!strcmp(mlp->ml_host, hostp) && !strcmp(mlp->ml_dirp, dirp))
2809 return;
2810 mlpp = &mlp->ml_next;
2811 mlp = mlp->ml_next;
2812 }
2813 mlp = (struct mountlist *)malloc(sizeof (*mlp));
2814 if (mlp == (struct mountlist *)NULL)
2815 out_of_mem();
2754 mlp->ml_next = (struct mountlist *)NULL;
2755 *mlpp = mlp;
2756 mlpp = &mlp->ml_next;
2757 }
2758 fclose(mlfile);
2759}
2760
2761void

--- 45 unchanged lines hidden (view full) ---

2807 if (!strcmp(mlp->ml_host, hostp) && !strcmp(mlp->ml_dirp, dirp))
2808 return;
2809 mlpp = &mlp->ml_next;
2810 mlp = mlp->ml_next;
2811 }
2812 mlp = (struct mountlist *)malloc(sizeof (*mlp));
2813 if (mlp == (struct mountlist *)NULL)
2814 out_of_mem();
2816 strncpy(mlp->ml_host, hostp, RPCMNT_NAMELEN);
2817 mlp->ml_host[RPCMNT_NAMELEN] = '\0';
2818 strncpy(mlp->ml_dirp, dirp, RPCMNT_PATHLEN);
2819 mlp->ml_dirp[RPCMNT_PATHLEN] = '\0';
2815 strncpy(mlp->ml_host, hostp, MNTNAMLEN);
2816 mlp->ml_host[MNTNAMLEN] = '\0';
2817 strncpy(mlp->ml_dirp, dirp, MNTPATHLEN);
2818 mlp->ml_dirp[MNTPATHLEN] = '\0';
2820 mlp->ml_next = (struct mountlist *)NULL;
2821 *mlpp = mlp;
2822 if ((mlfile = fopen(_PATH_RMOUNTLIST, "a")) == NULL) {
2823 syslog(LOG_ERR, "can't update %s", _PATH_RMOUNTLIST);
2824 return;
2825 }
2826 fprintf(mlfile, "%s %s\n", mlp->ml_host, mlp->ml_dirp);
2827 fclose(mlfile);

--- 216 unchanged lines hidden (view full) ---

3044{
3045 got_sighup = 1;
3046}
3047
3048void terminate(sig)
3049int sig;
3050{
3051 pidfile_remove(pfh);
2819 mlp->ml_next = (struct mountlist *)NULL;
2820 *mlpp = mlp;
2821 if ((mlfile = fopen(_PATH_RMOUNTLIST, "a")) == NULL) {
2822 syslog(LOG_ERR, "can't update %s", _PATH_RMOUNTLIST);
2823 return;
2824 }
2825 fprintf(mlfile, "%s %s\n", mlp->ml_host, mlp->ml_dirp);
2826 fclose(mlfile);

--- 216 unchanged lines hidden (view full) ---

3043{
3044 got_sighup = 1;
3045}
3046
3047void terminate(sig)
3048int sig;
3049{
3050 pidfile_remove(pfh);
3052 rpcb_unset(RPCPROG_MNT, RPCMNT_VER1, NULL);
3053 rpcb_unset(RPCPROG_MNT, RPCMNT_VER3, NULL);
3051 rpcb_unset(MOUNTPROG, MOUNTVERS, NULL);
3052 rpcb_unset(MOUNTPROG, MOUNTVERS3, NULL);
3054 exit (0);
3055}
3056
3053 exit (0);
3054}
3055