Deleted Added
full compact
nfs_srvsubs.c (99797) nfs_srvsubs.c (100134)
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 * Rick Macklem at The University of Guelph.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * @(#)nfs_subs.c 8.8 (Berkeley) 5/22/95
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 * Rick Macklem at The University of Guelph.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * @(#)nfs_subs.c 8.8 (Berkeley) 5/22/95
37 * $FreeBSD: head/sys/nfsserver/nfs_srvsubs.c 99797 2002-07-11 17:54:58Z dillon $
37 * $FreeBSD: head/sys/nfsserver/nfs_srvsubs.c 100134 2002-07-15 19:40:23Z alfred $
38 */
39
40#include <sys/cdefs.h>
38 */
39
40#include <sys/cdefs.h>
41__FBSDID("$FreeBSD: head/sys/nfsserver/nfs_srvsubs.c 99797 2002-07-11 17:54:58Z dillon $");
41__FBSDID("$FreeBSD: head/sys/nfsserver/nfs_srvsubs.c 100134 2002-07-15 19:40:23Z alfred $");
42
43/*
44 * These functions support the macros and help fiddle mbuf chains for
45 * the nfs op functions. They do things like create the rpc header and
46 * copy data between mbuf chains and uio lists.
47 */
48
42
43/*
44 * These functions support the macros and help fiddle mbuf chains for
45 * the nfs op functions. They do things like create the rpc header and
46 * copy data between mbuf chains and uio lists.
47 */
48
49#include "opt_inet6.h"
50
49#include <sys/param.h>
50#include <sys/systm.h>
51#include <sys/kernel.h>
52#include <sys/bio.h>
53#include <sys/buf.h>
54#include <sys/proc.h>
55#include <sys/mount.h>
56#include <sys/vnode.h>

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

1046 if (error)
1047 return (error);
1048 error = VFS_FHTOVP(mp, &fhp->fh_fid, vpp);
1049 if (error)
1050 return (error);
1051#ifdef MNT_EXNORESPORT
1052 if (!(exflags & (MNT_EXNORESPORT|MNT_EXPUBLIC))) {
1053 saddr = (struct sockaddr_in *)nam;
51#include <sys/param.h>
52#include <sys/systm.h>
53#include <sys/kernel.h>
54#include <sys/bio.h>
55#include <sys/buf.h>
56#include <sys/proc.h>
57#include <sys/mount.h>
58#include <sys/vnode.h>

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

1048 if (error)
1049 return (error);
1050 error = VFS_FHTOVP(mp, &fhp->fh_fid, vpp);
1051 if (error)
1052 return (error);
1053#ifdef MNT_EXNORESPORT
1054 if (!(exflags & (MNT_EXNORESPORT|MNT_EXPUBLIC))) {
1055 saddr = (struct sockaddr_in *)nam;
1054 if (saddr->sin_family == AF_INET &&
1056 if ((saddr->sin_family == AF_INET ||
1057 saddr->sin_family == AF_INET6) &&
1058 /* same code for INET and INET6: sin*_port at same offet */
1055 ntohs(saddr->sin_port) >= IPPORT_RESERVED) {
1056 vput(*vpp);
1057 *vpp = NULL;
1058 return (NFSERR_AUTHERR | AUTH_TOOWEAK);
1059 }
1060 }
1061#endif
1062 /*

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

1112
1113 switch (family) {
1114 case AF_INET:
1115 inetaddr = (struct sockaddr_in *)nam;
1116 if (inetaddr->sin_family == AF_INET &&
1117 inetaddr->sin_addr.s_addr == haddr->had_inetaddr)
1118 return (1);
1119 break;
1059 ntohs(saddr->sin_port) >= IPPORT_RESERVED) {
1060 vput(*vpp);
1061 *vpp = NULL;
1062 return (NFSERR_AUTHERR | AUTH_TOOWEAK);
1063 }
1064 }
1065#endif
1066 /*

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

1116
1117 switch (family) {
1118 case AF_INET:
1119 inetaddr = (struct sockaddr_in *)nam;
1120 if (inetaddr->sin_family == AF_INET &&
1121 inetaddr->sin_addr.s_addr == haddr->had_inetaddr)
1122 return (1);
1123 break;
1124#ifdef INET6
1125 case AF_INET6:
1126 {
1127 register struct sockaddr_in6 *inet6addr1, *inet6addr2;
1128
1129 inet6addr1 = (struct sockaddr_in6 *)nam;
1130 inet6addr2 = (struct sockaddr_in6 *)haddr->had_nam;
1131 /* XXX - should test sin6_scope_id ? */
1132 if (inet6addr1->sin6_family == AF_INET6 &&
1133 IN6_ARE_ADDR_EQUAL(&inet6addr1->sin6_addr,
1134 &inet6addr2->sin6_addr))
1135 return (1);
1136 break;
1137 }
1138#endif
1120 default:
1121 break;
1122 };
1123 return (0);
1124}
1125
1126/*
1127 * Map errnos to NFS error numbers. For Version 3 also filter out error

--- 251 unchanged lines hidden ---
1139 default:
1140 break;
1141 };
1142 return (0);
1143}
1144
1145/*
1146 * Map errnos to NFS error numbers. For Version 3 also filter out error

--- 251 unchanged lines hidden ---