nfs_nfsiod.c (24101) | nfs_nfsiod.c (24330) |
---|---|
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_syscalls.c 8.5 (Berkeley) 3/30/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_syscalls.c 8.5 (Berkeley) 3/30/95 |
37 * $Id: nfs_syscalls.c,v 1.18 1997/02/22 09:42:42 peter Exp $ | 37 * $Id: nfs_syscalls.c,v 1.19 1997/03/22 06:53:11 bde Exp $ |
38 */ 39 40#include <sys/param.h> 41#include <sys/systm.h> 42#include <sys/sysproto.h> 43#include <sys/kernel.h> 44#include <sys/sysctl.h> 45#include <sys/file.h> --- 56 unchanged lines hidden (view full) --- 102static struct nfsdrt nfsdrt; 103static int nfs_numnfsd = 0; 104static int notstarted = 1; 105static int modify_flag = 0; 106static void nfsd_rt __P((int sotype, struct nfsrv_descript *nd, 107 int cacherep)); 108static int nfssvc_addsock __P((struct file *,struct mbuf *)); 109static int nfssvc_nfsd __P((struct nfsd_srvargs *,caddr_t,struct proc *)); | 38 */ 39 40#include <sys/param.h> 41#include <sys/systm.h> 42#include <sys/sysproto.h> 43#include <sys/kernel.h> 44#include <sys/sysctl.h> 45#include <sys/file.h> --- 56 unchanged lines hidden (view full) --- 102static struct nfsdrt nfsdrt; 103static int nfs_numnfsd = 0; 104static int notstarted = 1; 105static int modify_flag = 0; 106static void nfsd_rt __P((int sotype, struct nfsrv_descript *nd, 107 int cacherep)); 108static int nfssvc_addsock __P((struct file *,struct mbuf *)); 109static int nfssvc_nfsd __P((struct nfsd_srvargs *,caddr_t,struct proc *)); |
110 111static int nfs_privport = 0; 112SYSCTL_INT(_vfs_nfs, NFS_NFSPRIVPORT, nfs_privport, CTLFLAG_RW, &nfs_privport, 0, ""); 113 |
|
110/* 111 * NFS server system calls 112 * getfh() lives here too, but maybe should move to kern/vfs_syscalls.c 113 */ 114 115/* 116 * Get file handle system call 117 */ --- 469 unchanged lines hidden (view full) --- 587 cacherep = RC_DOIT; 588 } else 589 modify_flag = 1; 590 } else if (nfsd->nfsd_flag & NFSD_AUTHFAIL) { 591 nfsd->nfsd_flag &= ~NFSD_AUTHFAIL; 592 nd->nd_procnum = NFSPROC_NOOP; 593 nd->nd_repstat = (NFSERR_AUTHERR | AUTH_TOOWEAK); 594 cacherep = RC_DOIT; | 114/* 115 * NFS server system calls 116 * getfh() lives here too, but maybe should move to kern/vfs_syscalls.c 117 */ 118 119/* 120 * Get file handle system call 121 */ --- 469 unchanged lines hidden (view full) --- 591 cacherep = RC_DOIT; 592 } else 593 modify_flag = 1; 594 } else if (nfsd->nfsd_flag & NFSD_AUTHFAIL) { 595 nfsd->nfsd_flag &= ~NFSD_AUTHFAIL; 596 nd->nd_procnum = NFSPROC_NOOP; 597 nd->nd_repstat = (NFSERR_AUTHERR | AUTH_TOOWEAK); 598 cacherep = RC_DOIT; |
599 } else if (nfs_privport) { 600 /* Check if source port is privileged */ 601 u_short port; 602 u_long addr; 603 struct mbuf *nam = nd->nd_nam; 604 struct sockaddr_in *sin; 605 606 sin = mtod(nam, struct sockaddr_in *); 607 port = ntohs(sin->sin_port); 608 if (port >= IPPORT_RESERVED) { 609 nd->nd_procnum = NFSPROC_NOOP; 610 nd->nd_repstat = (NFSERR_AUTHERR | AUTH_TOOWEAK); 611 cacherep = RC_DOIT; 612 printf("NFS request from unprivileged port (%s:%d)\n", 613 inet_ntoa(sin->sin_addr), port); 614 } |
|
595 } | 615 } |
616 |
|
596 } 597 598 /* 599 * Loop to get all the write rpc relies that have been 600 * gathered together. 601 */ 602 do { 603 switch (cacherep) { --- 547 unchanged lines hidden --- | 617 } 618 619 /* 620 * Loop to get all the write rpc relies that have been 621 * gathered together. 622 */ 623 do { 624 switch (cacherep) { --- 547 unchanged lines hidden --- |