summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/fs/nwfs/nwfs.h79
-rw-r--r--sys/fs/nwfs/nwfs_io.c599
-rw-r--r--sys/fs/nwfs/nwfs_ioctl.c89
-rw-r--r--sys/fs/nwfs/nwfs_mount.h68
-rw-r--r--sys/fs/nwfs/nwfs_node.c379
-rw-r--r--sys/fs/nwfs/nwfs_node.h96
-rw-r--r--sys/fs/nwfs/nwfs_subr.c553
-rw-r--r--sys/fs/nwfs/nwfs_subr.h90
-rw-r--r--sys/fs/nwfs/nwfs_vfsops.c439
-rw-r--r--sys/fs/nwfs/nwfs_vnops.c967
-rw-r--r--sys/modules/ncp/Makefile15
-rw-r--r--sys/modules/nwfs/Makefile15
-rw-r--r--sys/netncp/ncp.h392
-rw-r--r--sys/netncp/ncp_cfg.h9
-rw-r--r--sys/netncp/ncp_conn.c662
-rw-r--r--sys/netncp/ncp_conn.h229
-rw-r--r--sys/netncp/ncp_crypt.c271
-rw-r--r--sys/netncp/ncp_file.h76
-rw-r--r--sys/netncp/ncp_lib.h246
-rw-r--r--sys/netncp/ncp_login.c43
-rw-r--r--sys/netncp/ncp_mod.c529
-rw-r--r--sys/netncp/ncp_ncp.c503
-rw-r--r--sys/netncp/ncp_ncp.h127
-rw-r--r--sys/netncp/ncp_nls.c304
-rw-r--r--sys/netncp/ncp_nls.h88
-rw-r--r--sys/netncp/ncp_rcfile.h62
-rw-r--r--sys/netncp/ncp_rq.c480
-rw-r--r--sys/netncp/ncp_rq.h136
-rw-r--r--sys/netncp/ncp_sock.c381
-rw-r--r--sys/netncp/ncp_sock.h49
-rw-r--r--sys/netncp/ncp_subr.c137
-rw-r--r--sys/netncp/ncp_subr.h116
-rw-r--r--sys/netncp/ncp_user.h91
-rw-r--r--sys/netncp/ncpio.h62
-rw-r--r--sys/netncp/nwerror.h634
35 files changed, 0 insertions, 9016 deletions
diff --git a/sys/fs/nwfs/nwfs.h b/sys/fs/nwfs/nwfs.h
deleted file mode 100644
index af71724..0000000
--- a/sys/fs/nwfs/nwfs.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*-
- * Copyright (c) 1999 Boris Popov
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#ifndef _NWFS_H_
-#define _NWFS_H_
-
-#include <netncp/ncp.h>
-#include <fs/nwfs/nwfs_mount.h>
-
-#define NR_OPEN 0
-#define NW_NSB_DOS (1 << NW_NS_DOS)
-#define NW_NSB_MAC (1 << NW_NS_MAC)
-#define NW_NSB_NFS (1 << NW_NS_NFS)
-#define NW_NSB_FTAM (1 << NW_NS_FTAM)
-#define NW_NSB_OS2 (1 << NW_NS_OS2)
-
-#define NWFSIOC_GETCONN _IOR('n',1,int)
-#define NWFSIOC_GETEINFO _IOR('n',2,struct nw_entry_info)
-#define NWFSIOC_GETNS _IOR('n',3,int)
-
-#ifdef _KERNEL
-
-#include <sys/vnode.h>
-#include <sys/mount.h>
-
-struct nwfsnode;
-
-struct nwmount {
- struct nwfs_args m;
- struct mount *mp;
- struct ncp_handle *connh;
- int name_space;
- struct nwnode *n_root;
- u_int32_t n_volume;
- ncpfid n_rootent;
- int n_id;
-};
-
-#define VFSTONWFS(mntp) ((struct nwmount *)((mntp)->mnt_data))
-#define NWFSTOVFS(mnp) ((struct mount *)((mnp)->mount))
-#define VTOVFS(vp) ((vp)->v_mount)
-#define VTONWFS(vp) (VFSTONWFS(VTOVFS(vp)))
-#define NWFSTOCONN(nmp) ((nmp)->connh->nh_conn)
-
-int ncp_conn_logged_in(struct nwmount *);
-int nwfs_ioctl(struct vop_ioctl_args *ap);
-int nwfs_doio(struct vnode *vp, struct buf *bp, struct ucred *cr, struct thread *td);
-int nwfs_vinvalbuf(struct vnode *vp, struct thread *td);
-
-extern struct vop_vector nwfs_vnodeops;
-
-#endif /* _KERNEL */
-
-#endif /* _NWFS_H_ */
diff --git a/sys/fs/nwfs/nwfs_io.c b/sys/fs/nwfs/nwfs_io.c
deleted file mode 100644
index cd3c989..0000000
--- a/sys/fs/nwfs/nwfs_io.c
+++ /dev/null
@@ -1,599 +0,0 @@
-/*-
- * Copyright (c) 1999 Boris Popov
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- *
- */
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/bio.h>
-#include <sys/buf.h>
-#include <sys/mount.h>
-#include <sys/namei.h>
-#include <sys/vnode.h>
-#include <sys/dirent.h>
-#include <sys/sysctl.h>
-
-#include <vm/vm.h>
-#include <vm/vm_param.h>
-#include <vm/vm_page.h>
-#include <vm/vm_extern.h>
-#include <vm/vm_object.h>
-#include <vm/vm_pager.h>
-#include <vm/vnode_pager.h>
-
-#include <netncp/ncp.h>
-#include <netncp/ncp_conn.h>
-#include <netncp/ncp_subr.h>
-#include <netncp/ncp_ncp.h>
-
-#include <fs/nwfs/nwfs.h>
-#include <fs/nwfs/nwfs_node.h>
-#include <fs/nwfs/nwfs_subr.h>
-
-static int nwfs_fastlookup = 1;
-
-SYSCTL_DECL(_vfs_nwfs);
-SYSCTL_INT(_vfs_nwfs, OID_AUTO, fastlookup, CTLFLAG_RW, &nwfs_fastlookup, 0, "");
-
-
-extern int nwfs_pbuf_freecnt;
-
-#define DE_SIZE (sizeof(struct dirent))
-#define NWFS_RWCACHE
-
-static int
-nwfs_readvdir(struct vnode *vp, struct uio *uio, struct ucred *cred) {
- struct nwmount *nmp = VTONWFS(vp);
- int error, count, i;
- struct dirent dp;
- struct nwnode *np = VTONW(vp);
- struct nw_entry_info fattr;
- struct vnode *newvp;
- struct componentname cn;
- ncpfid fid;
-
- np = VTONW(vp);
- NCPVNDEBUG("dirname='%s'\n",np->n_name);
- if (uio->uio_resid < DE_SIZE || (uio->uio_offset < 0))
- return (EINVAL);
- error = 0;
- count = 0;
- i = uio->uio_offset / DE_SIZE; /* offset in directory */
- if (i == 0) {
- error = ncp_initsearch(vp, uio->uio_td, cred);
- if (error) {
- NCPVNDEBUG("cannot initialize search, error=%d",error);
- return( error );
- }
- }
-
- for (; uio->uio_resid >= DE_SIZE; i++) {
- bzero((char *) &dp, DE_SIZE);
- dp.d_reclen = DE_SIZE;
- switch (i) {
- case 0: /* `.' */
- case 1: /* `..' */
- dp.d_fileno = (i == 0) ? np->n_fid.f_id : np->n_parent.f_id;
- if (!dp.d_fileno) dp.d_fileno = NWFS_ROOT_INO;
- dp.d_namlen = i + 1;
- dp.d_name[0] = '.';
- dp.d_name[1] = '.';
- dp.d_name[i + 1] = '\0';
- dp.d_type = DT_DIR;
- break;
- default:
- error = ncp_search_for_file_or_subdir(nmp, &np->n_seq, &fattr, uio->uio_td, cred);
- if (error && error < 0x80) break;
- dp.d_fileno = fattr.dirEntNum;
- dp.d_type = (fattr.attributes & aDIR) ? DT_DIR : DT_REG;
- dp.d_namlen = fattr.nameLen;
- bcopy(fattr.entryName, dp.d_name, dp.d_namlen);
- dp.d_name[dp.d_namlen] = '\0';
-#if 0
- if (error && eofflag) {
- /* *eofflag = 1;*/
- break;
- }
-#endif
- break;
- }
- if (nwfs_fastlookup && !error && i > 1) {
- fid.f_id = fattr.dirEntNum;
- fid.f_parent = np->n_fid.f_id;
- error = nwfs_nget(vp->v_mount, fid, &fattr, vp, &newvp);
- if (!error) {
- VTONW(newvp)->n_ctime = VTONW(newvp)->n_vattr.va_ctime.tv_sec;
- cn.cn_nameptr = dp.d_name;
- cn.cn_namelen = dp.d_namlen;
- cache_enter(vp, newvp, &cn);
- vput(newvp);
- } else
- error = 0;
- }
- if (error >= 0x80) {
- error = 0;
- break;
- }
- if ((error = uiomove(&dp, DE_SIZE, uio)))
- break;
- }
-
- uio->uio_offset = i * DE_SIZE;
- return (error);
-}
-
-int
-nwfs_readvnode(struct vnode *vp, struct uio *uiop, struct ucred *cred) {
- struct nwmount *nmp = VFSTONWFS(vp->v_mount);
- struct nwnode *np = VTONW(vp);
- struct thread *td;
- struct vattr vattr;
- int error, biosize;
-
- if (vp->v_type != VREG && vp->v_type != VDIR) {
- printf("%s: vn types other than VREG or VDIR are unsupported !\n",__func__);
- return EIO;
- }
- if (uiop->uio_resid == 0) return 0;
- if (uiop->uio_offset < 0) return EINVAL;
-/* if (uiop->uio_offset + uiop->uio_resid > nmp->nm_maxfilesize)
- return (EFBIG);*/
- td = uiop->uio_td;
- if (vp->v_type == VDIR) {
- error = nwfs_readvdir(vp, uiop, cred);
- return error;
- }
- biosize = NWFSTOCONN(nmp)->buffer_size;
- if (np->n_flag & NMODIFIED) {
- nwfs_attr_cacheremove(vp);
- error = VOP_GETATTR(vp, &vattr, cred);
- if (error) return (error);
- np->n_mtime = vattr.va_mtime.tv_sec;
- } else {
- error = VOP_GETATTR(vp, &vattr, cred);
- if (error) return (error);
- if (np->n_mtime != vattr.va_mtime.tv_sec) {
- error = nwfs_vinvalbuf(vp, td);
- if (error) return (error);
- np->n_mtime = vattr.va_mtime.tv_sec;
- }
- }
- error = ncp_read(NWFSTOCONN(nmp), &np->n_fh, uiop, cred);
- return (error);
-}
-
-int
-nwfs_writevnode(vp, uiop, cred, ioflag)
- struct vnode *vp;
- struct uio *uiop;
- struct ucred *cred;
- int ioflag;
-{
- struct nwmount *nmp = VTONWFS(vp);
- struct nwnode *np = VTONW(vp);
- struct thread *td;
-/* struct vattr vattr;*/
- int error = 0;
-
- if (vp->v_type != VREG) {
- printf("%s: vn types other than VREG unsupported !\n",__func__);
- return EIO;
- }
- NCPVNDEBUG("ofs=%d,resid=%d\n",(int)uiop->uio_offset, uiop->uio_resid);
- if (uiop->uio_offset < 0) return EINVAL;
-/* if (uiop->uio_offset + uiop->uio_resid > nmp->nm_maxfilesize)
- return (EFBIG);*/
- td = uiop->uio_td;
- if (ioflag & (IO_APPEND | IO_SYNC)) {
- if (np->n_flag & NMODIFIED) {
- nwfs_attr_cacheremove(vp);
- error = nwfs_vinvalbuf(vp, td);
- if (error) return (error);
- }
- if (ioflag & IO_APPEND) {
- /* We can relay only on local information about file size,
- * because until file is closed NetWare will not return
- * the correct size. */
-#ifdef notyet
- nwfs_attr_cacheremove(vp);
- error = VOP_GETATTR(vp, &vattr, cred);
- if (error) return (error);
-#endif
- uiop->uio_offset = np->n_size;
- }
- }
- if (uiop->uio_resid == 0) return 0;
-
- if (vn_rlimit_fsize(vp, uiop, td))
- return (EFBIG);
-
- error = ncp_write(NWFSTOCONN(nmp), &np->n_fh, uiop, cred);
- NCPVNDEBUG("after: ofs=%d,resid=%d\n",(int)uiop->uio_offset, uiop->uio_resid);
- if (!error) {
- if (uiop->uio_offset > np->n_size) {
- np->n_vattr.va_size = np->n_size = uiop->uio_offset;
- vnode_pager_setsize(vp, np->n_size);
- }
- }
- return (error);
-}
-
-/*
- * Do an I/O operation to/from a cache block.
- */
-int
-nwfs_doio(vp, bp, cr, td)
- struct vnode *vp;
- struct buf *bp;
- struct ucred *cr;
- struct thread *td;
-{
- struct uio *uiop;
- struct nwnode *np;
- struct nwmount *nmp;
- int error = 0;
- struct uio uio;
- struct iovec io;
-
- np = VTONW(vp);
- nmp = VFSTONWFS(vp->v_mount);
- uiop = &uio;
- uiop->uio_iov = &io;
- uiop->uio_iovcnt = 1;
- uiop->uio_segflg = UIO_SYSSPACE;
- uiop->uio_td = td;
- if (bp->b_iocmd == BIO_READ) {
- io.iov_len = uiop->uio_resid = bp->b_bcount;
- io.iov_base = bp->b_data;
- uiop->uio_rw = UIO_READ;
- switch (vp->v_type) {
- case VREG:
- uiop->uio_offset = ((off_t)bp->b_blkno) * DEV_BSIZE;
- error = ncp_read(NWFSTOCONN(nmp), &np->n_fh, uiop, cr);
- if (error)
- break;
- if (uiop->uio_resid) {
- int left = uiop->uio_resid;
- int nread = bp->b_bcount - left;
- if (left > 0)
- bzero((char *)bp->b_data + nread, left);
- }
- break;
-/* case VDIR:
- nfsstats.readdir_bios++;
- uiop->uio_offset = ((u_quad_t)bp->b_lblkno) * NFS_DIRBLKSIZ;
- if (nmp->nm_flag & NFSMNT_RDIRPLUS) {
- error = nfs_readdirplusrpc(vp, uiop, cr);
- if (error == NFSERR_NOTSUPP)
- nmp->nm_flag &= ~NFSMNT_RDIRPLUS;
- }
- if ((nmp->nm_flag & NFSMNT_RDIRPLUS) == 0)
- error = nfs_readdirrpc(vp, uiop, cr);
- if (error == 0 && uiop->uio_resid == bp->b_bcount)
- bp->b_flags |= B_INVAL;
- break;
-*/
- default:
- printf("nwfs_doio: type %x unexpected\n",vp->v_type);
- break;
- };
- if (error) {
- bp->b_ioflags |= BIO_ERROR;
- bp->b_error = error;
- }
- } else { /* write */
- if (((bp->b_blkno * DEV_BSIZE) + bp->b_dirtyend) > np->n_size)
- bp->b_dirtyend = np->n_size - (bp->b_blkno * DEV_BSIZE);
-
- if (bp->b_dirtyend > bp->b_dirtyoff) {
- io.iov_len = uiop->uio_resid = bp->b_dirtyend - bp->b_dirtyoff;
- uiop->uio_offset = ((off_t)bp->b_blkno) * DEV_BSIZE + bp->b_dirtyoff;
- io.iov_base = (char *)bp->b_data + bp->b_dirtyoff;
- uiop->uio_rw = UIO_WRITE;
- error = ncp_write(NWFSTOCONN(nmp), &np->n_fh, uiop, cr);
-
- /*
- * For an interrupted write, the buffer is still valid
- * and the write hasn't been pushed to the server yet,
- * so we can't set BIO_ERROR and report the interruption
- * by setting B_EINTR. For the B_ASYNC case, B_EINTR
- * is not relevant, so the rpc attempt is essentially
- * a noop. For the case of a V3 write rpc not being
- * committed to stable storage, the block is still
- * dirty and requires either a commit rpc or another
- * write rpc with iomode == NFSV3WRITE_FILESYNC before
- * the block is reused. This is indicated by setting
- * the B_DELWRI and B_NEEDCOMMIT flags.
- */
- if (error == EINTR
- || (!error && (bp->b_flags & B_NEEDCOMMIT))) {
- int s;
-
- s = splbio();
- bp->b_flags &= ~(B_INVAL|B_NOCACHE);
- if ((bp->b_flags & B_ASYNC) == 0)
- bp->b_flags |= B_EINTR;
- if ((bp->b_flags & B_PAGING) == 0) {
- bdirty(bp);
- bp->b_flags &= ~B_DONE;
- }
- if ((bp->b_flags & B_ASYNC) == 0)
- bp->b_flags |= B_EINTR;
- splx(s);
- } else {
- if (error) {
- bp->b_ioflags |= BIO_ERROR;
- bp->b_error /*= np->n_error */= error;
-/* np->n_flag |= NWRITEERR;*/
- }
- bp->b_dirtyoff = bp->b_dirtyend = 0;
- }
- } else {
- bp->b_resid = 0;
- bufdone(bp);
- return (0);
- }
- }
- bp->b_resid = uiop->uio_resid;
- bufdone(bp);
- return (error);
-}
-
-/*
- * Vnode op for VM getpages.
- * Wish wish .... get rid from multiple IO routines
- */
-int
-nwfs_getpages(ap)
- struct vop_getpages_args /* {
- struct vnode *a_vp;
- vm_page_t *a_m;
- int a_count;
- int a_reqpage;
- vm_ooffset_t a_offset;
- } */ *ap;
-{
-#ifndef NWFS_RWCACHE
- return vop_stdgetpages(ap);(ap->a_vp, ap->a_m, ap->a_count,
-#else
- int i, error, nextoff, size, toff, npages, count;
- struct uio uio;
- struct iovec iov;
- vm_offset_t kva;
- struct buf *bp;
- struct vnode *vp;
- struct thread *td;
- struct ucred *cred;
- struct nwmount *nmp;
- struct nwnode *np;
- vm_object_t object;
- vm_page_t *pages;
-
- vp = ap->a_vp;
- td = curthread; /* XXX */
- cred = td->td_ucred; /* XXX */
- np = VTONW(vp);
- nmp = VFSTONWFS(vp->v_mount);
- pages = ap->a_m;
- count = ap->a_count;
-
- if ((object = vp->v_object) == NULL) {
- printf("nwfs_getpages: called with non-merged cache vnode??\n");
- return VM_PAGER_ERROR;
- }
-
- bp = getpbuf(&nwfs_pbuf_freecnt);
- npages = btoc(count);
- kva = (vm_offset_t) bp->b_data;
- pmap_qenter(kva, pages, npages);
-
- iov.iov_base = (caddr_t) kva;
- iov.iov_len = count;
- uio.uio_iov = &iov;
- uio.uio_iovcnt = 1;
- uio.uio_offset = IDX_TO_OFF(pages[0]->pindex);
- uio.uio_resid = count;
- uio.uio_segflg = UIO_SYSSPACE;
- uio.uio_rw = UIO_READ;
- uio.uio_td = td;
-
- error = ncp_read(NWFSTOCONN(nmp), &np->n_fh, &uio,cred);
- pmap_qremove(kva, npages);
-
- relpbuf(bp, &nwfs_pbuf_freecnt);
-
- VM_OBJECT_LOCK(object);
- if (error && (uio.uio_resid == count)) {
- printf("nwfs_getpages: error %d\n",error);
- for (i = 0; i < npages; i++) {
- if (ap->a_reqpage != i) {
- vm_page_lock(pages[i]);
- vm_page_free(pages[i]);
- vm_page_unlock(pages[i]);
- }
- }
- VM_OBJECT_UNLOCK(object);
- return VM_PAGER_ERROR;
- }
-
- size = count - uio.uio_resid;
-
- for (i = 0, toff = 0; i < npages; i++, toff = nextoff) {
- vm_page_t m;
- nextoff = toff + PAGE_SIZE;
- m = pages[i];
-
- if (nextoff <= size) {
- m->valid = VM_PAGE_BITS_ALL;
- KASSERT(m->dirty == 0,
- ("nwfs_getpages: page %p is dirty", m));
- } else {
- int nvalid = ((size + DEV_BSIZE - 1) - toff) & ~(DEV_BSIZE - 1);
- vm_page_set_valid_range(m, 0, nvalid);
- KASSERT((m->dirty & vm_page_bits(0, nvalid)) == 0,
- ("nwfs_getpages: page %p is dirty", m));
- }
-
- if (i != ap->a_reqpage)
- vm_page_readahead_finish(m);
- }
- VM_OBJECT_UNLOCK(object);
- return 0;
-#endif /* NWFS_RWCACHE */
-}
-
-/*
- * Vnode op for VM putpages.
- * possible bug: all IO done in sync mode
- * Note that vop_close always invalidate pages before close, so it's
- * not necessary to open vnode.
- */
-int
-nwfs_putpages(ap)
- struct vop_putpages_args /* {
- struct vnode *a_vp;
- vm_page_t *a_m;
- int a_count;
- int a_sync;
- int *a_rtvals;
- vm_ooffset_t a_offset;
- } */ *ap;
-{
- int error;
- struct vnode *vp = ap->a_vp;
- struct thread *td;
- struct ucred *cred;
-
-#ifndef NWFS_RWCACHE
- td = curthread; /* XXX */
- cred = td->td_ucred; /* XXX */
- VOP_OPEN(vp, FWRITE, cred, td, NULL);
- error = vop_stdputpages(ap);
- VOP_CLOSE(vp, FWRITE, cred, td);
- return error;
-#else
- struct uio uio;
- struct iovec iov;
- vm_offset_t kva;
- struct buf *bp;
- int i, npages, count;
- int *rtvals;
- struct nwmount *nmp;
- struct nwnode *np;
- vm_page_t *pages;
-
- td = curthread; /* XXX */
- cred = td->td_ucred; /* XXX */
-/* VOP_OPEN(vp, FWRITE, cred, td, NULL);*/
- np = VTONW(vp);
- nmp = VFSTONWFS(vp->v_mount);
- pages = ap->a_m;
- count = ap->a_count;
- rtvals = ap->a_rtvals;
- npages = btoc(count);
-
- for (i = 0; i < npages; i++) {
- rtvals[i] = VM_PAGER_ERROR;
- }
-
- bp = getpbuf(&nwfs_pbuf_freecnt);
- kva = (vm_offset_t) bp->b_data;
- pmap_qenter(kva, pages, npages);
-
- iov.iov_base = (caddr_t) kva;
- iov.iov_len = count;
- uio.uio_iov = &iov;
- uio.uio_iovcnt = 1;
- uio.uio_offset = IDX_TO_OFF(pages[0]->pindex);
- uio.uio_resid = count;
- uio.uio_segflg = UIO_SYSSPACE;
- uio.uio_rw = UIO_WRITE;
- uio.uio_td = td;
- NCPVNDEBUG("ofs=%d,resid=%d\n",(int)uio.uio_offset, uio.uio_resid);
-
- error = ncp_write(NWFSTOCONN(nmp), &np->n_fh, &uio, cred);
-/* VOP_CLOSE(vp, FWRITE, cred, td);*/
- NCPVNDEBUG("paged write done: %d\n", error);
-
- pmap_qremove(kva, npages);
- relpbuf(bp, &nwfs_pbuf_freecnt);
-
- if (!error)
- vnode_pager_undirty_pages(pages, rtvals, count - uio.uio_resid);
- return rtvals[0];
-#endif /* NWFS_RWCACHE */
-}
-/*
- * Flush and invalidate all dirty buffers. If another process is already
- * doing the flush, just wait for completion.
- */
-int
-nwfs_vinvalbuf(vp, td)
- struct vnode *vp;
- struct thread *td;
-{
- struct nwnode *np = VTONW(vp);
-/* struct nwmount *nmp = VTONWFS(vp);*/
- int error = 0;
-
- if (vp->v_iflag & VI_DOOMED)
- return (0);
-
- while (np->n_flag & NFLUSHINPROG) {
- np->n_flag |= NFLUSHWANT;
- error = tsleep(&np->n_flag, PRIBIO + 2, "nwfsvinv", 2 * hz);
- error = ncp_chkintr(NWFSTOCONN(VTONWFS(vp)), td);
- if (error == EINTR)
- return EINTR;
- }
- np->n_flag |= NFLUSHINPROG;
-
- if (vp->v_bufobj.bo_object != NULL) {
- VM_OBJECT_LOCK(vp->v_bufobj.bo_object);
- vm_object_page_clean(vp->v_bufobj.bo_object, 0, 0, OBJPC_SYNC);
- VM_OBJECT_UNLOCK(vp->v_bufobj.bo_object);
- }
-
- error = vinvalbuf(vp, V_SAVE, PCATCH, 0);
- while (error) {
- if (error == ERESTART || error == EINTR) {
- np->n_flag &= ~NFLUSHINPROG;
- if (np->n_flag & NFLUSHWANT) {
- np->n_flag &= ~NFLUSHWANT;
- wakeup(&np->n_flag);
- }
- return EINTR;
- }
- error = vinvalbuf(vp, V_SAVE, PCATCH, 0);
- }
- np->n_flag &= ~(NMODIFIED | NFLUSHINPROG);
- if (np->n_flag & NFLUSHWANT) {
- np->n_flag &= ~NFLUSHWANT;
- wakeup(&np->n_flag);
- }
- return (error);
-}
diff --git a/sys/fs/nwfs/nwfs_ioctl.c b/sys/fs/nwfs/nwfs_ioctl.c
deleted file mode 100644
index 35fe93e..0000000
--- a/sys/fs/nwfs/nwfs_ioctl.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/*-
- * Copyright (c) 1999 Boris Popov
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/mount.h>
-#include <sys/vnode.h>
-#include <sys/ioccom.h>
-
-#include <netncp/ncp.h>
-#include <netncp/ncp_conn.h>
-#include <netncp/ncp_subr.h>
-
-#include <fs/nwfs/nwfs.h>
-#include <fs/nwfs/nwfs_node.h>
-#include <fs/nwfs/nwfs_subr.h>
-
-int
-nwfs_ioctl(ap)
- struct vop_ioctl_args /* {
- struct vnode *a_vp;
- u_long a_command;
- caddr_t a_data;
- int fflag;
- struct ucred *cred;
- struct thread *td;
- } */ *ap;
-{
- int error;
- struct thread *td = ap->a_td;
- struct ucred *cred = ap->a_cred;
- struct vnode *vp = ap->a_vp;
- struct nwnode *np = VTONW(vp);
- struct nwmount *nmp = VTONWFS(vp);
- struct ncp_conn *conn = NWFSTOCONN(nmp);
- struct ncp_handle *hp;
- struct nw_entry_info *fap;
- void *data = ap->a_data;
-
- switch (ap->a_command) {
- case NWFSIOC_GETCONN:
- error = ncp_conn_lock(conn, td, cred, NCPM_READ);
- if (error) break;
- error = ncp_conn_gethandle(conn, td, &hp);
- ncp_conn_unlock(conn, td);
- if (error) break;
- *(int*)data = hp->nh_id;
- break;
- case NWFSIOC_GETEINFO:
- if ((error = VOP_ACCESS(vp, VEXEC, cred, td))) break;
- fap = data;
- error = ncp_obtain_info(nmp, np->n_fid.f_id, 0, NULL, fap,
- ap->a_td,ap->a_cred);
- strcpy(fap->entryName, np->n_name);
- fap->nameLen = np->n_nmlen;
- break;
- case NWFSIOC_GETNS:
- if ((error = VOP_ACCESS(vp, VEXEC, cred, td))) break;
- *(int*)data = nmp->name_space;
- break;
- default:
- error = ENOTTY;
- }
- return (error);
-}
diff --git a/sys/fs/nwfs/nwfs_mount.h b/sys/fs/nwfs/nwfs_mount.h
deleted file mode 100644
index 92c11af..0000000
--- a/sys/fs/nwfs/nwfs_mount.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*-
- * Copyright (c) 1999 Boris Popov
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-#ifndef _NWFS_MOUNT_H_
-#define _NWFS_MOUNT_H_
-
-#ifndef _NCP_NCP_NLS_H_
-#include <netncp/ncp_nls.h>
-#endif
-
-#define NWFS_VERMAJ 1
-#define NWFS_VERMIN 3400
-#define NWFS_VERSION (NWFS_VERMAJ*100000 + NWFS_VERMIN)
-
-/* Values for flags */
-#define NWFS_MOUNT_SOFT 0x0001
-#define WNFS_MOUNT_INTR 0x0002
-#define NWFS_MOUNT_STRONG 0x0004
-#define NWFS_MOUNT_NO_OS2 0x0008
-#define NWFS_MOUNT_NO_NFS 0x0010
-#define NWFS_MOUNT_NO_LONG 0x0020
-#define NWFS_MOUNT_GET_SYSENT 0x0040 /* special case, look to vfsops :) */
-#define NWFS_MOUNT_HAVE_NLS 0x0080
-
-#define NWFS_VOLNAME_LEN 48
-
-
-/* Layout of the mount control block for a netware filesystem. */
-struct nwfs_args {
- int connRef; /* connection reference */
- char mount_point[MAXPATHLEN];
- u_int flags;
- u_char mounted_vol[NWFS_VOLNAME_LEN + 1];
- u_char root_path[512+1];
- int version;
- uid_t uid;
- gid_t gid;
- mode_t file_mode;
- mode_t dir_mode;
- struct ncp_nlstables nls;
- int tz;
-};
-
-#endif /* !_NWFS_MOUNT_H_ */
diff --git a/sys/fs/nwfs/nwfs_node.c b/sys/fs/nwfs/nwfs_node.c
deleted file mode 100644
index cf6f6d9..0000000
--- a/sys/fs/nwfs/nwfs_node.c
+++ /dev/null
@@ -1,379 +0,0 @@
-/*-
- * Copyright (c) 1999, 2000 Boris Popov
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/lock.h>
-#include <sys/malloc.h>
-#include <sys/mount.h>
-#include <sys/mutex.h>
-#include <sys/proc.h>
-#include <sys/queue.h>
-#include <sys/sx.h>
-#include <sys/sysctl.h>
-#include <sys/time.h>
-#include <sys/vnode.h>
-
-#include <vm/vm.h>
-#include <vm/vm_extern.h>
-#include <vm/vm_page.h>
-#include <vm/vm_object.h>
-
-#include <netncp/ncp.h>
-#include <netncp/ncp_conn.h>
-#include <netncp/ncp_subr.h>
-
-#include <fs/nwfs/nwfs.h>
-#include <fs/nwfs/nwfs_mount.h>
-#include <fs/nwfs/nwfs_node.h>
-#include <fs/nwfs/nwfs_subr.h>
-
-#define NWNOHASH(fhsum) (&nwhashtbl[(fhsum.f_id) & nwnodehash])
-
-static LIST_HEAD(nwnode_hash_head,nwnode) *nwhashtbl;
-static u_long nwnodehash;
-static struct sx nwhashlock;
-
-static MALLOC_DEFINE(M_NWNODE, "nwfs_node", "NWFS vnode private part");
-static MALLOC_DEFINE(M_NWFSHASH, "nwfs_hash", "NWFS has table");
-
-static int nwfs_sysctl_vnprint(SYSCTL_HANDLER_ARGS);
-
-SYSCTL_DECL(_vfs_nwfs);
-
-SYSCTL_PROC(_vfs_nwfs, OID_AUTO, vnprint, CTLFLAG_WR|CTLTYPE_OPAQUE,
- NULL, 0, nwfs_sysctl_vnprint, "S,vnlist", "vnode hash");
-
-void
-nwfs_hash_init(void) {
- nwhashtbl = hashinit(desiredvnodes, M_NWFSHASH, &nwnodehash);
- sx_init(&nwhashlock, "nwfshl");
-}
-
-void
-nwfs_hash_free(void) {
- sx_destroy(&nwhashlock);
- free(nwhashtbl, M_NWFSHASH);
-}
-
-int
-nwfs_sysctl_vnprint(SYSCTL_HANDLER_ARGS) {
- struct nwnode *np;
- struct nwnode_hash_head *nhpp;
- struct vnode *vp;
- int i;
-
- if (nwfs_debuglevel == 0)
- return 0;
- printf("Name:uc:hc:fid:pfid\n");
- for(i = 0; i <= nwnodehash; i++) {
- nhpp = &nwhashtbl[i];
- LIST_FOREACH(np, nhpp, n_hash) {
- vp = NWTOV(np);
- vprint("", vp);
- printf("%s:%d:%d:%d:%d\n",np->n_name,vrefcnt(vp),
- vp->v_holdcnt,np->n_fid.f_id, np->n_fid.f_parent);
- }
- }
- return 0;
-}
-
-/*
- * Search nwnode with given fid.
- * Hash list should be locked by caller.
- */
-static int
-nwfs_hashlookup(struct nwmount *nmp, ncpfid fid, struct nwnode **npp)
-{
- struct nwnode *np;
- struct nwnode_hash_head *nhpp;
-
- sx_assert(&nwhashlock, SA_XLOCKED);
-
- nhpp = NWNOHASH(fid);
- LIST_FOREACH(np, nhpp, n_hash) {
- if (nmp != np->n_mount || !NWCMPF(&fid, &np->n_fid))
- continue;
- if (npp)
- *npp = np;
- return 0;
- }
- return ENOENT;
-}
-
-/*
- * Allocate new nwfsnode/vnode from given nwnode.
- * Vnode referenced and not locked.
- */
-static int
-nwfs_allocvp(struct mount *mp, ncpfid fid, struct nw_entry_info *fap,
- struct vnode *dvp, struct vnode **vpp)
-{
- struct nwnode *np;
- struct nwnode_hash_head *nhpp;
- struct nwmount *nmp = VFSTONWFS(mp);
- struct vnode *vp;
- int error;
-
-loop:
- sx_xlock(&nwhashlock);
-rescan:
- if (nwfs_hashlookup(nmp, fid, &np) == 0) {
- vp = NWTOV(np);
- VI_LOCK(vp);
- sx_xunlock(&nwhashlock);
- if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, curthread))
- goto loop;
- if (fap)
- np->n_attr = fap->attributes;
- *vpp = vp;
- return(0);
- }
- sx_xunlock(&nwhashlock);
-
- if (fap == NULL || ((fap->attributes & aDIR) == 0 && dvp == NULL))
- panic("nwfs_allocvp: fap = %p, dvp = %p\n", fap, dvp);
- /*
- * Do the MALLOC before the getnewvnode since doing so afterward
- * might cause a bogus v_data pointer to get dereferenced
- * elsewhere if MALLOC should block.
- */
- np = malloc(sizeof *np, M_NWNODE, M_WAITOK | M_ZERO);
- error = getnewvnode("nwfs", mp, &nwfs_vnodeops, &vp);
- if (error) {
- *vpp = NULL;
- free(np, M_NWNODE);
- return (error);
- }
- error = insmntque(vp, mp); /* XXX: Too early for mpsafe fs */
- if (error != 0) {
- free(np, M_NWNODE);
- *vpp = NULL;
- return (error);
- }
- vp->v_data = np;
- np->n_vnode = vp;
- np->n_mount = nmp;
- np->n_attr = fap->attributes;
- vp->v_type = np->n_attr & aDIR ? VDIR : VREG;
- np->n_fid = fid;
- if (dvp) {
- np->n_parent = VTONW(dvp)->n_fid;
- }
- sx_xlock(&nwhashlock);
- /*
- * Another process can create vnode while we blocked in malloc() or
- * getnewvnode(). Rescan list again.
- */
- if (nwfs_hashlookup(nmp, fid, NULL) == 0) {
- vp->v_data = NULL;
- np->n_vnode = NULL;
- vrele(vp);
- free(np, M_NWNODE);
- goto rescan;
- }
- *vpp = vp;
- nhpp = NWNOHASH(fid);
- LIST_INSERT_HEAD(nhpp, np, n_hash);
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
- VN_LOCK_AREC(vp);
- sx_xunlock(&nwhashlock);
-
- ASSERT_VOP_LOCKED(dvp, "nwfs_allocvp");
- if (vp->v_type == VDIR && dvp && (dvp->v_vflag & VV_ROOT) == 0) {
- np->n_flag |= NREFPARENT;
- vref(dvp);
- }
- return 0;
-}
-
-int
-nwfs_nget(struct mount *mp, ncpfid fid, struct nw_entry_info *fap,
- struct vnode *dvp, struct vnode **vpp)
-{
- struct vnode *vp;
- int error;
-
- *vpp = NULL;
- error = nwfs_allocvp(mp, fid, fap, dvp, &vp);
- if (error)
- return error;
- if (fap)
- nwfs_attr_cacheenter(vp, fap);
- *vpp = vp;
- return 0;
-}
-
-int
-nwfs_lookupnp(struct nwmount *nmp, ncpfid fid, struct thread *td,
- struct nwnode **npp)
-{
- int error;
-
- sx_xlock(&nwhashlock);
- error = nwfs_hashlookup(nmp, fid, npp);
- sx_xunlock(&nwhashlock);
- return error;
-}
-
-/*
- * Free nwnode, and give vnode back to system
- */
-int
-nwfs_reclaim(ap)
- struct vop_reclaim_args /* {
- struct vnode *a_vp;
- struct thread *a_td;
- } */ *ap;
-{
- struct vnode *dvp = NULL, *vp = ap->a_vp;
- struct nwnode *dnp, *np = VTONW(vp);
- struct nwmount *nmp = VTONWFS(vp);
- struct thread *td = ap->a_td;
-
- NCPVNDEBUG("%s,%d\n", np->n_name, vrefcnt(vp));
- /*
- * Destroy the vm object and flush associated pages.
- */
- vnode_destroy_vobject(vp);
-
- if (np->n_flag & NREFPARENT) {
- np->n_flag &= ~NREFPARENT;
- if (nwfs_lookupnp(nmp, np->n_parent, td, &dnp) == 0) {
- dvp = dnp->n_vnode;
- } else {
- NCPVNDEBUG("%s: has no parent ?\n",np->n_name);
- }
- }
- sx_xlock(&nwhashlock);
- LIST_REMOVE(np, n_hash);
- sx_xunlock(&nwhashlock);
- if (nmp->n_root == np) {
- nmp->n_root = NULL;
- }
- vp->v_data = NULL;
- free(np, M_NWNODE);
- if (dvp) {
- vrele(dvp);
- }
- return (0);
-}
-
-int
-nwfs_inactive(ap)
- struct vop_inactive_args /* {
- struct vnode *a_vp;
- struct thread *a_td;
- } */ *ap;
-{
- struct thread *td = ap->a_td;
- struct ucred *cred = td->td_ucred;
- struct vnode *vp = ap->a_vp;
- struct nwnode *np = VTONW(vp);
- int error;
-
- NCPVNDEBUG("%s: %d\n", VTONW(vp)->n_name, vrefcnt(vp));
- if (np->opened) {
- error = nwfs_vinvalbuf(vp, td);
- error = ncp_close_file(NWFSTOCONN(VTONWFS(vp)), &np->n_fh, td, cred);
- np->opened = 0;
- }
- if (np->n_flag & NSHOULDFREE) {
- cache_purge(vp);
- vgone(vp);
- }
- return (0);
-}
-/*
- * routines to maintain vnode attributes cache
- * nwfs_attr_cacheenter: unpack np.i to va structure
- */
-void
-nwfs_attr_cacheenter(struct vnode *vp, struct nw_entry_info *fi)
-{
- struct nwnode *np = VTONW(vp);
- struct nwmount *nmp = VTONWFS(vp);
- struct vattr *va = &np->n_vattr;
-
- va->va_type = vp->v_type; /* vnode type (for create) */
- np->n_nmlen = fi->nameLen;
- bcopy(fi->entryName, np->n_name, np->n_nmlen);
- np->n_name[fi->nameLen] = 0;
- if (vp->v_type == VREG) {
- if (va->va_size != fi->dataStreamSize) {
- va->va_size = fi->dataStreamSize;
- vnode_pager_setsize(vp, va->va_size);
- }
- va->va_mode = nmp->m.file_mode; /* files access mode and type */
- } else if (vp->v_type == VDIR) {
- va->va_size = 16384; /* should be a better way ... */
- va->va_mode = nmp->m.dir_mode; /* files access mode and type */
- } else
- return;
- np->n_size = va->va_size;
- va->va_nlink = 1; /* number of references to file */
- va->va_uid = nmp->m.uid; /* owner user id */
- va->va_gid = nmp->m.gid; /* owner group id */
- va->va_fsid = vp->v_mount->mnt_stat.f_fsid.val[0];
- va->va_fileid = np->n_fid.f_id; /* file id */
- if (va->va_fileid == 0)
- va->va_fileid = NWFS_ROOT_INO;
- va->va_blocksize=nmp->connh->nh_conn->buffer_size;/* blocksize preferred for i/o */
- /* time of last modification */
- ncp_dos2unixtime(fi->modifyDate, fi->modifyTime, 0, nmp->m.tz, &va->va_mtime);
- /* time of last access */
- ncp_dos2unixtime(fi->lastAccessDate, 0, 0, nmp->m.tz, &va->va_atime);
- va->va_ctime = va->va_mtime; /* time file changed */
- va->va_gen = VNOVAL; /* generation number of file */
- va->va_flags = 0; /* flags defined for file */
- va->va_rdev = VNOVAL; /* device the special file represents */
- va->va_bytes = va->va_size; /* bytes of disk space held by file */
- va->va_filerev = 0; /* file modification number */
- va->va_vaflags = 0; /* operations flags */
- np->n_vattr = *va;
- if (np->n_mtime == 0) {
- np->n_mtime = va->va_mtime.tv_sec;
- }
- np->n_atime = time_second;
- np->n_dosfid = fi->DosDirNum;
- return;
-}
-
-int
-nwfs_attr_cachelookup(struct vnode *vp, struct vattr *va)
-{
- struct nwnode *np = VTONW(vp);
- int diff;
-
- diff = time_second - np->n_atime;
- if (diff > 2) { /* XXX should be configurable */
- return ENOENT;
- }
- *va = np->n_vattr;
- return 0;
-}
diff --git a/sys/fs/nwfs/nwfs_node.h b/sys/fs/nwfs/nwfs_node.h
deleted file mode 100644
index 89545eb..0000000
--- a/sys/fs/nwfs/nwfs_node.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*-
- * Copyright (c) 1999, 2000, 2001 Boris Popov
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-#ifndef _NWFS_NODE_H_
-#define _NWFS_NODE_H_
-
-#define NWFS_ROOT_INO 0x7ffffffd
-
-/* Bits for nwnode.n_flag */
-#define NFLUSHINPROG 0x0001
-#define NFLUSHWANT 0x0002 /* they should gone ... */
-#define NMODIFIED 0x0004 /* bogus, until async IO implemented */
-#define NREFPARENT 0x0008 /* vnode holds reference to a parent vnode */
-#define NVOLUME 0x0010 /* vnode references a volume */
-#define NSHOULDFREE 0x0020 /* vnode should be removed from hash */
-
-struct nwnode {
- LIST_ENTRY(nwnode) n_hash;
- struct vnode *n_vnode;
- struct vattr n_vattr;
- struct nwmount *n_mount;
- time_t n_atime; /* attributes cache time*/
- time_t n_ctime;
- time_t n_mtime;
- int n_flag;
- ncpfid n_parent;
- ncpfid n_fid;
- u_long n_attr; /* LH */
- u_long n_size;
- u_long n_dosfid;
- int opened;
-/* int access;*/
- u_long n_origfh;
- ncp_fh n_fh;
- struct nw_search_seq n_seq;
- u_char n_nmlen;
- u_char n_name[256];
-};
-
-#define VTONW(vp) ((struct nwnode *)(vp)->v_data)
-#define NWTOV(np) ((struct vnode *)(np)->n_vnode)
-#define NWCMPF(f1,f2) ((f1)->f_parent == (f2)->f_parent && \
- (f1)->f_id == (f2)->f_id)
-#define NWCMPN(np1,np2) NWCMPF(&(np1)->n_fid, &(np2)->n_fid)
-#define NWCMPV(vp1,vp2) NWCMPN(VTONW(vp1),VTONW(vp2))
-
-struct vop_getpages_args;
-struct vop_inactive_args;
-struct vop_putpages_args;
-struct vop_reclaim_args;
-struct ucred;
-struct uio;
-
-void nwfs_hash_init(void);
-void nwfs_hash_free(void);
-int nwfs_lookupnp(struct nwmount *nmp, ncpfid fid, struct thread *td,
- struct nwnode **npp);
-int nwfs_inactive(struct vop_inactive_args *);
-int nwfs_reclaim(struct vop_reclaim_args *);
-int nwfs_nget(struct mount *mp, ncpfid fid, struct nw_entry_info *fap,
- struct vnode *dvp, struct vnode **vpp);
-
-int nwfs_getpages(struct vop_getpages_args *);
-int nwfs_putpages(struct vop_putpages_args *);
-int nwfs_readvnode(struct vnode *vp, struct uio *uiop, struct ucred *cred);
-int nwfs_writevnode(struct vnode *vp, struct uio *uiop, struct ucred *cred, int ioflag);
-void nwfs_attr_cacheenter(struct vnode *vp, struct nw_entry_info *fi);
-int nwfs_attr_cachelookup(struct vnode *vp,struct vattr *va);
-
-#define nwfs_attr_cacheremove(vp) VTONW(vp)->n_atime = 0
-
-#endif /* _NWFS_NODE_H_ */
diff --git a/sys/fs/nwfs/nwfs_subr.c b/sys/fs/nwfs/nwfs_subr.c
deleted file mode 100644
index cb85450..0000000
--- a/sys/fs/nwfs/nwfs_subr.c
+++ /dev/null
@@ -1,553 +0,0 @@
-/*-
- * Copyright (c) 1999, 2001 Boris Popov
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/lock.h>
-#include <sys/lockmgr.h>
-#include <sys/malloc.h>
-#include <sys/clock.h>
-#include <sys/time.h>
-
-#include <netncp/ncp.h>
-#include <netncp/ncp_conn.h>
-#include <netncp/ncp_ncp.h>
-#include <netncp/ncp_subr.h>
-#include <netncp/ncp_rq.h>
-#include <netncp/nwerror.h>
-
-#include <fs/nwfs/nwfs.h>
-#include <fs/nwfs/nwfs_node.h>
-#include <fs/nwfs/nwfs_subr.h>
-
-#define NCP_INFOSZ (sizeof(struct nw_entry_info) - 257)
-
-MALLOC_DEFINE(M_NWFSDATA, "nwfs_data", "NWFS private data");
-
-static int
-ncp_extract_file_info(struct nwmount *nmp, struct ncp_rq *rqp,
- struct nw_entry_info *target, int withname)
-{
- u_int8_t name_len;
-
- md_get_mem(&rqp->rp, (caddr_t)target, NCP_INFOSZ, MB_MSYSTEM);
- if (!withname)
- return 0;
- md_get_uint8(&rqp->rp, &name_len);
- target->nameLen = name_len;
- md_get_mem(&rqp->rp, (caddr_t)target->entryName, name_len, MB_MSYSTEM);
- target->entryName[name_len] = '\0';
- ncp_path2unix(target->entryName, target->entryName, name_len, &nmp->m.nls);
- return 0;
-}
-
-int
-ncp_initsearch(struct vnode *dvp, struct thread *td, struct ucred *cred)
-{
- struct nwmount *nmp = VTONWFS(dvp);
- struct ncp_conn *conn = NWFSTOCONN(nmp);
- struct nwnode *np = VTONW(dvp);
- struct ncp_rq *rqp;
- u_int8_t volnum = nmp->n_volume;
- u_int32_t dirent = np->n_fid.f_id;
- int error;
-
- NCPNDEBUG("vol=%d,dir=%d\n", volnum, dirent);
- error = ncp_rq_alloc(87, conn, td, cred, &rqp);
- if (error)
- return error;
- mb_put_uint8(&rqp->rq, 2); /* subfunction */
- mb_put_uint8(&rqp->rq, nmp->name_space);
- mb_put_uint8(&rqp->rq, 0); /* reserved */
- ncp_rq_dbase_path(rqp, volnum, dirent, 0, NULL, NULL);
- rqp->nr_minrplen = sizeof(np->n_seq);
- error = ncp_request(rqp);
- if (error)
- return error;
- md_get_mem(&rqp->rp, (caddr_t)&np->n_seq, sizeof(np->n_seq), MB_MSYSTEM);
- ncp_rq_done(rqp);
- return 0;
-}
-
-int
-ncp_search_for_file_or_subdir(struct nwmount *nmp,
- struct nw_search_seq *seq,
- struct nw_entry_info *target,
- struct thread *td,struct ucred *cred)
-{
- struct ncp_conn *conn = NWFSTOCONN(nmp);
- struct ncp_rq *rqp;
- int error;
-
- error = ncp_rq_alloc(87, conn, td, cred, &rqp);
- if (error)
- return error;
- mb_put_uint8(&rqp->rq, 3); /* subfunction */
- mb_put_uint8(&rqp->rq, nmp->name_space);
- mb_put_uint8(&rqp->rq, 0); /* data stream */
- mb_put_uint16le(&rqp->rq, 0xffff); /* Search attribs */
- mb_put_uint32le(&rqp->rq, IM_ALL); /* return info mask */
- mb_put_mem(&rqp->rq, (caddr_t)seq, 9, MB_MSYSTEM);
- mb_put_uint8(&rqp->rq, 2); /* 2 byte pattern */
- mb_put_uint8(&rqp->rq, 0xff); /* following is a wildcard */
- mb_put_uint8(&rqp->rq, '*');
- rqp->nr_minrplen = sizeof(*seq) + 1 + NCP_INFOSZ + 1;
- error = ncp_request(rqp);
- if (error)
- return error;
- md_get_mem(&rqp->rp, (caddr_t)seq, sizeof(*seq), MB_MSYSTEM);
- md_get_uint8(&rqp->rp, NULL); /* skip */
- error = ncp_extract_file_info(nmp, rqp, target, 1);
- ncp_rq_done(rqp);
- return error;
-}
-
-/*
- * Returns information for a (one-component) name relative to the specified
- * directory.
- */
-int
-ncp_obtain_info(struct nwmount *nmp, u_int32_t dirent,
- int namelen, char *path, struct nw_entry_info *target,
- struct thread *td,struct ucred *cred)
-{
- struct ncp_conn *conn=NWFSTOCONN(nmp);
- struct ncp_rq *rqp;
- int error;
- u_char volnum = nmp->n_volume, ns;
-
- if (target == NULL) {
- NCPFATAL("target == NULL\n");
- return EINVAL;
- }
- ns = (path == NULL || path[0] == 0) ? NW_NS_DOS : nmp->name_space;
- error = ncp_rq_alloc(87, conn, td, cred, &rqp);
- if (error)
- return error;
- mb_put_uint8(&rqp->rq, 6); /* subfunction */
- mb_put_uint8(&rqp->rq, ns);
- mb_put_uint8(&rqp->rq, ns); /* DestNameSpace */
- mb_put_uint16le(&rqp->rq, 0xff); /* get all */
- mb_put_uint32le(&rqp->rq, IM_ALL);
- ncp_rq_dbase_path(rqp, volnum, dirent, namelen, path, &nmp->m.nls);
- error = ncp_request(rqp);
- if (error)
- return error;
- error = ncp_extract_file_info(nmp, rqp, target, path != NULL);
- ncp_rq_done(rqp);
- return error;
-}
-/*
- * lookup name pointed by cnp in directory dvp and return file info in np.
- * May be I should create a little cache, but another way is to minimize
- * number of calls, on other hand, in multiprocess environment ...
- */
-int
-ncp_lookup(struct vnode *dvp, int len, char *name, struct nw_entry_info *fap,
- struct thread *td,struct ucred *cred)
-{
- struct nwmount *nmp;
- struct nwnode *dnp;
- int error;
-
- if (!dvp || dvp->v_type != VDIR) {
- nwfs_printf("dvp is NULL or not a directory.\n");
- return (ENOENT);
- }
- dnp = VTONW(dvp);
- nmp = VTONWFS(dvp);
-
- if (len == 1 && name[0] == '.') {
- if (dnp->n_flag & NVOLUME) {
- error = ncp_obtain_info(nmp, dnp->n_fid.f_id, 0, NULL,
- fap, td, cred);
- } else {
- error = ncp_obtain_info(nmp, dnp->n_fid.f_parent,
- dnp->n_nmlen, dnp->n_name, fap, td, cred);
- }
- return error;
- } else if (len == 2 && name[0] == '.' && name[1] == '.') {
- printf("%s: knows NOTHING about '..'\n", __func__);
- return EIO;
- } else {
- error = ncp_obtain_info(nmp, dnp->n_fid.f_id,
- len, name, fap, td, cred);
- }
- return error;
-}
-
-static void ConvertToNWfromDWORD(u_int32_t sfd, ncp_fh *fh);
-static void
-ConvertToNWfromDWORD(u_int32_t sfd, ncp_fh *fh) {
- fh->val1 = (fh->val.val32 = sfd);
- return;
-}
-
-/*
- * If both dir and name are NULL, then in target there's already a looked-up
- * entry that wants to be opened.
- */
-int
-ncp_open_create_file_or_subdir(struct nwmount *nmp,struct vnode *dvp,int namelen,
- char *name, int open_create_mode, u_int32_t create_attributes,
- int desired_acc_rights, struct ncp_open_info *nop,
- struct thread *td,struct ucred *cred)
-{
-
- struct ncp_conn *conn=NWFSTOCONN(nmp);
- struct ncp_rq *rqp;
- u_int16_t search_attribs = SA_ALL & (~SA_SUBDIR_FILES);
- u_int8_t volnum;
- u_int32_t dirent;
- int error;
-
- error = ncp_rq_alloc(87, conn, td, cred, &rqp);
- if (error)
- return error;
- volnum = nmp->n_volume;
- dirent = VTONW(dvp)->n_fid.f_id;
- if ((create_attributes & aDIR) != 0) {
- search_attribs |= SA_SUBDIR_FILES;
- }
- mb_put_uint8(&rqp->rq, 1);/* subfunction */
- mb_put_uint8(&rqp->rq, nmp->name_space);
- mb_put_uint8(&rqp->rq, open_create_mode);
- mb_put_uint16le(&rqp->rq, search_attribs);
- mb_put_uint32le(&rqp->rq, IM_ALL);
- mb_put_uint32le(&rqp->rq, create_attributes);
- /*
- * The desired acc rights seem to be the inherited rights mask for
- * directories
- */
- mb_put_uint16le(&rqp->rq, desired_acc_rights);
- ncp_rq_dbase_path(rqp, volnum, dirent, namelen, name, &nmp->m.nls);
- error = ncp_request(rqp);
- if (error) {
- if (error == NWE_FILE_NO_CREATE_PRIV)
- error = EACCES;
- return error;
- }
- md_get_uint32le(&rqp->rp, &nop->origfh);
- md_get_uint8(&rqp->rp, &nop->action);
- md_get_uint8(&rqp->rp, NULL); /* skip */
- error = ncp_extract_file_info(nmp, rqp, &nop->fattr, 1);
- ncp_rq_done(rqp);
- ConvertToNWfromDWORD(nop->origfh, &nop->fh);
- return error;
-}
-
-int
-ncp_close_file(struct ncp_conn *conn, ncp_fh *fh,struct thread *td,struct ucred *cred)
-{
- struct ncp_rq *rqp;
- int error;
-
- error = ncp_rq_alloc(66, conn, td, cred, &rqp);
- if (error)
- return error;
- mb_put_uint8(&rqp->rq, 0);
- mb_put_mem(&rqp->rq, (caddr_t)fh, 6, MB_MSYSTEM);
- error = ncp_request(rqp);
- if (error)
- return error;
- ncp_rq_done(rqp);
- return error;
-}
-
-int
-ncp_DeleteNSEntry(struct nwmount *nmp, u_int32_t dirent,
- int namelen,char *name,struct thread *td,struct ucred *cred)
-{
- struct ncp_rq *rqp;
- int error;
- struct ncp_conn *conn=NWFSTOCONN(nmp);
-
- error = ncp_rq_alloc(87, conn, td, cred, &rqp);
- if (error)
- return error;
- mb_put_uint8(&rqp->rq, 8); /* subfunction */
- mb_put_uint8(&rqp->rq, nmp->name_space);
- mb_put_uint8(&rqp->rq, 0); /* reserved */
- mb_put_uint16le(&rqp->rq, SA_ALL); /* search attribs: all */
- ncp_rq_dbase_path(rqp, nmp->n_volume, dirent, namelen, name, &nmp->m.nls);
- error = ncp_request(rqp);
- if (!error)
- ncp_rq_done(rqp);
- return error;
-}
-
-int
-ncp_nsrename(struct ncp_conn *conn, int volume, int ns, int oldtype,
- struct ncp_nlstables *nt,
- nwdirent fdir, char *old_name, int oldlen,
- nwdirent tdir, char *new_name, int newlen,
- struct thread *td, struct ucred *cred)
-{
- struct ncp_rq *rqp;
- int error;
-
- error = ncp_rq_alloc(87, conn, td, cred, &rqp);
- if (error)
- return error;
- mb_put_uint8(&rqp->rq, 4);
- mb_put_uint8(&rqp->rq, ns);
- mb_put_uint8(&rqp->rq, 1); /* RRenameToMySelf */
- mb_put_uint16le(&rqp->rq, oldtype);
- /* source Handle Path */
- mb_put_uint8(&rqp->rq, volume);
- mb_put_mem(&rqp->rq, (c_caddr_t)&fdir, sizeof(fdir), MB_MSYSTEM);
- mb_put_uint8(&rqp->rq, 1);
- mb_put_uint8(&rqp->rq, 1); /* 1 source component */
- /* dest Handle Path */
- mb_put_uint8(&rqp->rq, volume);
- mb_put_mem(&rqp->rq, (c_caddr_t)&tdir, sizeof(tdir), MB_MSYSTEM);
- mb_put_uint8(&rqp->rq, 1);
- mb_put_uint8(&rqp->rq, 1); /* 1 destination component */
- ncp_rq_pathstring(rqp, oldlen, old_name, nt);
- ncp_rq_pathstring(rqp, newlen, new_name, nt);
- error = ncp_request(rqp);
- if (!error)
- ncp_rq_done(rqp);
- return error;
-}
-
-int
-ncp_modify_file_or_subdir_dos_info(struct nwmount *nmp, struct vnode *vp,
- u_int32_t info_mask,
- struct nw_modify_dos_info *info,
- struct thread *td,struct ucred *cred)
-{
- struct nwnode *np=VTONW(vp);
- struct ncp_rq *rqp;
- u_int8_t volnum = nmp->n_volume;
- u_int32_t dirent = np->n_fid.f_id;
- struct ncp_conn *conn=NWFSTOCONN(nmp);
- int error;
-
- error = ncp_rq_alloc(87, conn, td, cred, &rqp);
- if (error)
- return error;
- mb_put_uint8(&rqp->rq, 7); /* subfunction */
- mb_put_uint8(&rqp->rq, nmp->name_space);
- mb_put_uint8(&rqp->rq, 0); /* reserved */
- mb_put_uint16le(&rqp->rq, SA_ALL); /* search attribs: all */
- mb_put_uint32le(&rqp->rq, info_mask);
- mb_put_mem(&rqp->rq, (caddr_t)info, sizeof(*info), MB_MSYSTEM);
- ncp_rq_dbase_path(rqp, volnum, dirent, 0, NULL, NULL);
- error = ncp_request(rqp);
- if (!error)
- ncp_rq_done(rqp);
- return error;
-}
-
-int
-ncp_setattr(vp, vap, cred, td)
- struct vnode *vp;
- struct vattr *vap;
- struct ucred *cred;
- struct thread *td;
-{
- struct nwmount *nmp=VTONWFS(vp);
- struct nwnode *np=VTONW(vp);
- struct ncp_open_info nwn;
- struct ncp_conn *conn=NWFSTOCONN(nmp);
- struct nw_modify_dos_info info;
- struct ncp_rq *rqp;
- int error = 0, info_mask;
-
- if (vap->va_size != VNOVAL) {
- error = ncp_open_create_file_or_subdir(nmp, vp, 0, NULL, OC_MODE_OPEN, 0,
- AR_WRITE | AR_READ, &nwn,td,cred);
- if (error)
- return error;
- error = ncp_rq_alloc(73, conn, td, cred, &rqp);
- if (error) {
- ncp_close_file(conn, &nwn.fh, td, cred);
- return error;
- }
- mb_put_uint8(&rqp->rq, 0);
- mb_put_mem(&rqp->rq, (caddr_t)&nwn.fh, 6, MB_MSYSTEM);
- mb_put_uint32be(&rqp->rq, vap->va_size);
- mb_put_uint16be(&rqp->rq, 0);
- error = ncp_request(rqp);
- np->n_vattr.va_size = np->n_size = vap->va_size;
- if (!error)
- ncp_rq_done(rqp);
- ncp_close_file(conn, &nwn.fh, td, cred);
- if (error)
- return error;
- }
- info_mask = 0;
- bzero(&info, sizeof(info));
-
- if (vap->va_mtime.tv_sec != VNOVAL) {
- info_mask |= (DM_MODIFY_TIME | DM_MODIFY_DATE);
- ncp_unix2dostime(&vap->va_mtime, nmp->m.tz, &info.modifyDate, &info.modifyTime, NULL);
- }
- if (vap->va_atime.tv_sec != VNOVAL) {
- info_mask |= (DM_LAST_ACCESS_DATE);
- ncp_unix2dostime(&vap->va_atime, nmp->m.tz, &info.lastAccessDate, NULL, NULL);
- }
- if (info_mask) {
- error = ncp_modify_file_or_subdir_dos_info(nmp, vp, info_mask, &info,td,cred);
- }
- return (error);
-}
-
-int
-ncp_get_volume_info_with_number(struct ncp_conn *conn,
- int n, struct ncp_volume_info *target,
- struct thread *td,struct ucred *cred)
-{
- struct ncp_rq *rqp;
- u_int32_t tmp32;
- u_int8_t len;
- int error;
-
- error = ncp_rq_alloc_subfn(22, 44, conn, td, cred, &rqp);
- if (error)
- return error;
- mb_put_uint8(&rqp->rq,n);
- error = ncp_request(rqp);
- if (error)
- return error;
- md_get_uint32le(&rqp->rp, &target->total_blocks);
- md_get_uint32le(&rqp->rp, &target->free_blocks);
- md_get_uint32le(&rqp->rp, &target->purgeable_blocks);
- md_get_uint32le(&rqp->rp, &target->not_yet_purgeable_blocks);
- md_get_uint32le(&rqp->rp, &target->total_dir_entries);
- md_get_uint32le(&rqp->rp, &target->available_dir_entries);
- md_get_uint32le(&rqp->rp, &tmp32);
- md_get_uint8(&rqp->rp, &target->sectors_per_block);
- bzero(&target->volume_name, sizeof(target->volume_name));
- md_get_uint8(&rqp->rp, &len);
- if (len > NCP_VOLNAME_LEN) {
- error = ENAMETOOLONG;
- } else {
- md_get_mem(&rqp->rp, (caddr_t)&target->volume_name, len, MB_MSYSTEM);
- }
- ncp_rq_done(rqp);
- return error;
-}
-
-int
-ncp_get_namespaces(struct ncp_conn *conn, u_int32_t volume, int *nsf,
- struct thread *td,struct ucred *cred)
-{
- struct ncp_rq *rqp;
- int error;
- u_int8_t ns;
- u_int16_t nscnt;
-
- error = ncp_rq_alloc(87, conn, td, cred, &rqp);
- if (error)
- return error;
- mb_put_uint8(&rqp->rq, 24); /* Subfunction: Get Loaded Name Spaces */
- mb_put_uint16le(&rqp->rq, 0); /* reserved */
- mb_put_uint8(&rqp->rq, volume);
- error = ncp_request(rqp);
- if (error)
- return error;
- md_get_uint16le(&rqp->rp, &nscnt);
- *nsf = 0;
- while (nscnt-- > 0) {
- md_get_uint8(&rqp->rp, &ns);
- *nsf |= 1 << ns;
- }
- ncp_rq_done(rqp);
- return error;
-}
-
-int
-ncp_lookup_volume(struct ncp_conn *conn, char *volname,
- u_char *volNum, u_int32_t *dirEnt,
- struct thread *td,struct ucred *cred)
-{
- struct ncp_rq *rqp;
- u_int32_t tmp32;
- int error;
-
- NCPNDEBUG("looking up vol %s\n", volname);
- error = ncp_rq_alloc(87, conn, td, cred, &rqp);
- if (error)
- return error;
- mb_put_uint8(&rqp->rq, 22); /* Subfunction: Generate dir handle */
- mb_put_uint8(&rqp->rq, 0); /* src name space */
- mb_put_uint8(&rqp->rq, 0); /* dst name space, always zero */
- mb_put_uint16le(&rqp->rq, 0); /* dstNSIndicator (Jn) */
-
- mb_put_uint8(&rqp->rq, 0); /* faked volume number */
- mb_put_uint32be(&rqp->rq, 0); /* faked dir_base */
- mb_put_uint8(&rqp->rq, 0xff); /* Don't have a dir_base */
- mb_put_uint8(&rqp->rq, 1); /* 1 path component */
- ncp_rq_pstring(rqp, volname);
- error = ncp_request(rqp);
- if (error)
- return error;
- md_get_uint32le(&rqp->rp, &tmp32);
- md_get_uint32le(&rqp->rp, dirEnt);
- md_get_uint8(&rqp->rp, volNum);
- ncp_rq_done(rqp);
- return error;
-}
-
-/*
- * XXX: I think the timezone in struct nwfs_args is truly bogus, especially
- * XXX: considering that nwfs_mount(8) picks this up from the kernel in
- * XXX: the first place. Since I can't test this, I won't attempt to fix it.
- * XXX: /phk
- */
-
-void
-ncp_unix2dostime(tsp, tzoff, ddp, dtp, dhp)
- struct timespec *tsp;
- int tzoff;
- u_int16_t *ddp;
- u_int16_t *dtp;
- u_int8_t *dhp;
-{
- struct timespec t;
-
- t = *tsp;
-
- t.tv_sec = - tzoff * 60 - utc_offset();
- timespec2fattime(&t, 1, ddp, dtp, dhp);
-}
-
-void
-ncp_dos2unixtime(dd, dt, dh, tzoff, tsp)
- u_int dd;
- u_int dt;
- u_int dh;
- int tzoff;
- struct timespec *tsp;
-{
-
- fattime2timespec(dd, dt, dh, 1, tsp);
- tsp->tv_sec += tzoff * 60 + utc_offset();
-}
diff --git a/sys/fs/nwfs/nwfs_subr.h b/sys/fs/nwfs/nwfs_subr.h
deleted file mode 100644
index e571349..0000000
--- a/sys/fs/nwfs/nwfs_subr.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*-
- * Copyright (c) 1999 Boris Popov
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-#ifndef _NWFS_SUBR_H_
-#define _NWFS_SUBR_H_
-
-extern int nwfs_debuglevel;
-
-#ifdef MALLOC_DECLARE
-MALLOC_DECLARE(M_NWFSDATA);
-#endif
-
-struct ncp_conn;
-struct ncp_nlstables;
-struct ncp_open_info;
-struct nw_entry_info;
-struct nw_search_info;
-struct nwmount;
-struct thread;
-struct timespec;
-struct ucred;
-struct vattr;
-struct vnode;
-
-int ncp_initsearch(struct vnode *dvp,struct thread *td, struct ucred *cred);
-int ncp_search_for_file_or_subdir(struct nwmount *nmp,struct nw_search_seq *seq,
- struct nw_entry_info *target,
- struct thread *td, struct ucred *cred);
-int ncp_lookup(struct vnode *dvp, int len, char *name, struct nw_entry_info *fap,
- struct thread *td, struct ucred *cred);
-int ncp_lookup_volume(struct ncp_conn *conn, char *volname,
- u_char *volNum, u_int32_t *dirEnt,
- struct thread *td, struct ucred *cred);
-int ncp_close_file(struct ncp_conn *conn, ncp_fh *fh,
- struct thread *td, struct ucred *cred);
-int ncp_open_create_file_or_subdir(struct nwmount *nmp,struct vnode *dvp, int namelen,char *name,
- int open_create_mode, u_int32_t create_attributes,
- int desired_acc_rights, struct ncp_open_info *nop,
- struct thread *td, struct ucred *cred);
-int ncp_DeleteNSEntry(struct nwmount *nmp,
- u_int32_t dirent, int namelen, char *name,
- struct thread *td, struct ucred *cred);
-int ncp_nsrename(struct ncp_conn *conn, int volume, int ns, int oldtype,
- struct ncp_nlstables *nt,
- nwdirent fdir, char *old_name, int oldlen,
- nwdirent tdir, char *new_name, int newlen,
- struct thread *td, struct ucred *cred);
-int ncp_obtain_info(struct nwmount *nmp, u_int32_t dirent,
- int namelen, char *path, struct nw_entry_info *target,
- struct thread *td, struct ucred *cred);
-int ncp_modify_file_or_subdir_dos_info(struct nwmount *nmp, struct vnode *vp,
- u_int32_t info_mask,
- struct nw_modify_dos_info *info,
- struct thread *td, struct ucred *cred);
-int ncp_setattr(struct vnode *,struct vattr *,struct ucred *,struct thread *td);
-int ncp_get_namespaces(struct ncp_conn *conn, u_int32_t volume, int *nsf,
- struct thread *td, struct ucred *cred);
-int ncp_get_volume_info_with_number(struct ncp_conn *conn,
- int n, struct ncp_volume_info *target,
- struct thread *td, struct ucred *cred);
-
-void ncp_unix2dostime (struct timespec *tsp, int tz, u_int16_t *ddp,
- u_int16_t *dtp, u_int8_t *dhp);
-void ncp_dos2unixtime (u_int dd, u_int dt, u_int dh, int tz, struct timespec *tsp);
-
-#endif /* !_NWFS_SUBR_H_ */
diff --git a/sys/fs/nwfs/nwfs_vfsops.c b/sys/fs/nwfs/nwfs_vfsops.c
deleted file mode 100644
index f319fb5..0000000
--- a/sys/fs/nwfs/nwfs_vfsops.c
+++ /dev/null
@@ -1,439 +0,0 @@
-/*-
- * Copyright (c) 1999, 2000 Boris Popov
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/kernel.h>
-#include <sys/sysctl.h>
-#include <sys/vnode.h>
-#include <sys/mount.h>
-#include <sys/stat.h>
-#include <sys/malloc.h>
-#include <sys/bio.h>
-#include <sys/buf.h>
-
-#include <netncp/ncp.h>
-#include <netncp/ncp_conn.h>
-#include <netncp/ncp_subr.h>
-#include <netncp/ncp_ncp.h>
-#include <netncp/ncp_nls.h>
-
-#include <fs/nwfs/nwfs.h>
-#include <fs/nwfs/nwfs_node.h>
-#include <fs/nwfs/nwfs_subr.h>
-
-int nwfs_debuglevel = 0;
-
-static int nwfs_version = NWFS_VERSION;
-
-SYSCTL_DECL(_vfs_nwfs);
-SYSCTL_NODE(_vfs, OID_AUTO, nwfs, CTLFLAG_RW, 0, "Netware filesystem");
-SYSCTL_INT(_vfs_nwfs, OID_AUTO, version, CTLFLAG_RD, &nwfs_version, 0, "");
-SYSCTL_INT(_vfs_nwfs, OID_AUTO, debuglevel, CTLFLAG_RW, &nwfs_debuglevel, 0, "");
-
-MODULE_DEPEND(nwfs, ncp, 1, 1, 1);
-MODULE_DEPEND(nwfs, libmchain, 1, 1, 1);
-
-static vfs_cmount_t nwfs_cmount;
-static vfs_mount_t nwfs_mount;
-static vfs_quotactl_t nwfs_quotactl;
-static vfs_root_t nwfs_root;
-static vfs_statfs_t nwfs_statfs;
-static vfs_unmount_t nwfs_unmount;
-static vfs_init_t nwfs_init;
-static vfs_uninit_t nwfs_uninit;
-
-static struct vfsops nwfs_vfsops = {
- .vfs_init = nwfs_init,
- .vfs_mount = nwfs_mount,
- .vfs_cmount = nwfs_cmount,
- .vfs_quotactl = nwfs_quotactl,
- .vfs_root = nwfs_root,
- .vfs_statfs = nwfs_statfs,
- .vfs_sync = vfs_stdsync,
- .vfs_uninit = nwfs_uninit,
- .vfs_unmount = nwfs_unmount,
-};
-
-
-VFS_SET(nwfs_vfsops, nwfs, VFCF_NETWORK);
-
-int nwfs_pbuf_freecnt = -1; /* start out unlimited */
-static int nwfsid = 1;
-
-static int
-nwfs_initnls(struct nwmount *nmp) {
- char *pc, *pe;
- int error = 0;
-#define COPY_TABLE(t,d) { \
- if (t) { \
- error = copyin((t), pc, 256); \
- if (error) break; \
- } else \
- bcopy(d, pc, 256); \
- (t) = pc; pc += 256; \
- }
-
- nmp->m.nls.opt |= NWHP_NLS | NWHP_DOS;
- if ((nmp->m.flags & NWFS_MOUNT_HAVE_NLS) == 0) {
- nmp->m.nls.to_lower = ncp_defnls.to_lower;
- nmp->m.nls.to_upper = ncp_defnls.to_upper;
- nmp->m.nls.n2u = ncp_defnls.n2u;
- nmp->m.nls.u2n = ncp_defnls.u2n;
- return 0;
- }
- pe = malloc(256 * 4, M_NWFSDATA, M_WAITOK);
- pc = pe;
- do {
- COPY_TABLE(nmp->m.nls.to_lower, ncp_defnls.to_lower);
- COPY_TABLE(nmp->m.nls.to_upper, ncp_defnls.to_upper);
- COPY_TABLE(nmp->m.nls.n2u, ncp_defnls.n2u);
- COPY_TABLE(nmp->m.nls.u2n, ncp_defnls.u2n);
- } while(0);
- if (error) {
- free(pe, M_NWFSDATA);
- return error;
- }
- return 0;
-}
-
-static int nwfs_cmount(struct mntarg *ma, void *data, uint64_t flags)
-{
- struct nwfs_args args; /* will hold data from mount request */
- int error;
-
- error = copyin(data, &args, sizeof(struct nwfs_args));
- if (error)
- return (error);
-
- /*
- * XXX: cheap cop-out here, args contains a structure I don't
- * XXX: know how we should handle, and I don't see any immediate
- * XXX: prospect of avoiding a mount_nwfs(8) binary anyway.
- */
- ma = mount_arg(ma, "nwfs_args", &args, sizeof args);
-
- error = kernel_mount(ma, flags);
-
- return (error);
-}
-
-/*
- * mp - path - addr in user space of mount point (ie /usr or whatever)
- * data - addr in user space of mount params
- */
-static int nwfs_mount(struct mount *mp)
-{
- struct nwfs_args args; /* will hold data from mount request */
- int error;
- struct nwmount *nmp = NULL;
- struct ncp_conn *conn = NULL;
- struct ncp_handle *handle = NULL;
- struct vnode *vp;
- struct thread *td;
- char *pc,*pe;
-
- td = curthread;
- if (mp->mnt_flag & MNT_ROOTFS)
- return (EOPNOTSUPP);
- if (mp->mnt_flag & MNT_UPDATE) {
- nwfs_printf("MNT_UPDATE not implemented");
- return (EOPNOTSUPP);
- }
- error = vfs_copyopt(mp->mnt_optnew, "nwfs_args", &args, sizeof args);
- if (error)
- return (error);
- if (args.version != NWFS_VERSION) {
- nwfs_printf("mount version mismatch: kernel=%d, mount=%d\n",NWFS_VERSION,args.version);
- return (1);
- }
- error = ncp_conn_getbyref(args.connRef, td , td->td_ucred,NCPM_EXECUTE,&conn);
- if (error) {
- nwfs_printf("invalid connection refernce %d\n",args.connRef);
- return (error);
- }
- error = ncp_conn_gethandle(conn, NULL, &handle);
- if (error) {
- nwfs_printf("can't get connection handle\n");
- return (error);
- }
- ncp_conn_unlock(conn, td); /* we keep the ref */
- mp->mnt_stat.f_iosize = conn->buffer_size;
- /* We must malloc our own mount info */
- nmp = malloc(sizeof(struct nwmount), M_NWFSDATA, M_WAITOK | M_ZERO);
- if (nmp == NULL) {
- nwfs_printf("could not alloc nwmount\n");
- error = ENOMEM;
- goto bad;
- }
- mp->mnt_data = nmp;
- nmp->connh = handle;
- nmp->n_root = NULL;
- nmp->n_id = nwfsid++;
- nmp->m = args;
- nmp->m.file_mode = (nmp->m.file_mode &
- (S_IRWXU|S_IRWXG|S_IRWXO)) | S_IFREG;
- nmp->m.dir_mode = (nmp->m.dir_mode &
- (S_IRWXU|S_IRWXG|S_IRWXO)) | S_IFDIR;
- if ((error = nwfs_initnls(nmp)) != 0) goto bad;
- pc = mp->mnt_stat.f_mntfromname;
- pe = pc+sizeof(mp->mnt_stat.f_mntfromname);
- bzero(pc, MNAMELEN);
- *(pc++) = '/';
- pc = strchr(strncpy(pc, conn->li.server, pe - pc - 2), 0);
- if (pc < pe-1) {
- *(pc++) = ':';
- pc = strchr(strncpy(pc, conn->li.user, pe - pc - 2), 0);
- if (pc < pe-1) {
- *(pc++) = '/';
- strncpy(pc, nmp->m.mounted_vol, pe-pc-2);
- }
- }
- /* protect against invalid mount points */
- nmp->m.mount_point[sizeof(nmp->m.mount_point)-1] = '\0';
- vfs_getnewfsid(mp);
- error = nwfs_root(mp, LK_EXCLUSIVE, &vp);
- if (error)
- goto bad;
- /*
- * Lose the lock but keep the ref.
- */
- VOP_UNLOCK(vp, 0);
- NCPVODEBUG("rootvp.vrefcnt=%d\n",vrefcnt(vp));
- return error;
-bad:
- if (nmp)
- free(nmp, M_NWFSDATA);
- if (handle)
- ncp_conn_puthandle(handle, NULL, 0);
- return error;
-}
-
-/* Unmount the filesystem described by mp. */
-static int
-nwfs_unmount(struct mount *mp, int mntflags)
-{
- struct thread *td;
- struct nwmount *nmp = VFSTONWFS(mp);
- struct ncp_conn *conn;
- int error, flags;
-
- NCPVODEBUG("nwfs_unmount: flags=%04x\n",mntflags);
- td = curthread;
- flags = 0;
- if (mntflags & MNT_FORCE)
- flags |= FORCECLOSE;
- /* There is 1 extra root vnode reference from nwfs_mount(). */
- error = vflush(mp, 1, flags, td);
- if (error)
- return (error);
- conn = NWFSTOCONN(nmp);
- ncp_conn_puthandle(nmp->connh,NULL,0);
- if (ncp_conn_lock(conn, td, td->td_ucred,NCPM_WRITE | NCPM_EXECUTE) == 0) {
- if(ncp_conn_free(conn))
- ncp_conn_unlock(conn, td);
- }
- mp->mnt_data = NULL;
- if (nmp->m.flags & NWFS_MOUNT_HAVE_NLS)
- free(nmp->m.nls.to_lower, M_NWFSDATA);
- free(nmp, M_NWFSDATA);
- MNT_ILOCK(mp);
- mp->mnt_flag &= ~MNT_LOCAL;
- MNT_IUNLOCK(mp);
- return (error);
-}
-
-/* Return locked vnode to root of a filesystem */
-static int
-nwfs_root(struct mount *mp, int flags, struct vnode **vpp) {
- struct vnode *vp;
- struct nwmount *nmp;
- struct nwnode *np;
- struct ncp_conn *conn;
- struct nw_entry_info fattr;
- struct thread *td;
- struct ucred *cred;
- int error, nsf, opt;
- u_char vol;
-
- td = curthread;
- cred = td->td_ucred;
-
- nmp = VFSTONWFS(mp);
- conn = NWFSTOCONN(nmp);
- if (nmp->n_root) {
- *vpp = NWTOV(nmp->n_root);
- while (vget(*vpp, LK_EXCLUSIVE, curthread) != 0)
- ;
- return 0;
- }
- error = ncp_lookup_volume(conn, nmp->m.mounted_vol, &vol,
- &nmp->n_rootent.f_id, td, cred);
- if (error)
- return ENOENT;
- nmp->n_volume = vol;
- error = ncp_get_namespaces(conn, vol, &nsf, td, cred);
- if (error)
- return ENOENT;
- if (nsf & NW_NSB_OS2) {
- NCPVODEBUG("volume %s has os2 namespace\n",nmp->m.mounted_vol);
- if ((nmp->m.flags & NWFS_MOUNT_NO_OS2) == 0) {
- nmp->name_space = NW_NS_OS2;
- nmp->m.nls.opt &= ~NWHP_DOS;
- }
- }
- opt = nmp->m.nls.opt;
- nsf = opt & (NWHP_UPPER | NWHP_LOWER);
- if (opt & NWHP_DOS) {
- if (nsf == (NWHP_UPPER | NWHP_LOWER)) {
- nmp->m.nls.opt &= ~(NWHP_LOWER | NWHP_UPPER);
- } else if (nsf == 0) {
- nmp->m.nls.opt |= NWHP_LOWER;
- }
- } else {
- if (nsf == (NWHP_UPPER | NWHP_LOWER)) {
- nmp->m.nls.opt &= ~(NWHP_LOWER | NWHP_UPPER);
- }
- }
- if (nmp->m.root_path[0]) {
- nmp->m.root_path[0]--;
- error = ncp_obtain_info(nmp, nmp->n_rootent.f_id,
- -nmp->m.root_path[0], nmp->m.root_path, &fattr, td, cred);
- if (error) {
- NCPFATAL("Invalid root path specified\n");
- return ENOENT;
- }
- nmp->n_rootent.f_parent = fattr.dirEntNum;
- nmp->m.root_path[0]++;
- error = ncp_obtain_info(nmp, nmp->n_rootent.f_id,
- -nmp->m.root_path[0], nmp->m.root_path, &fattr, td, cred);
- if (error) {
- NCPFATAL("Invalid root path specified\n");
- return ENOENT;
- }
- nmp->n_rootent.f_id = fattr.dirEntNum;
- } else {
- error = ncp_obtain_info(nmp, nmp->n_rootent.f_id,
- 0, NULL, &fattr, td, cred);
- if (error) {
- NCPFATAL("Can't obtain volume info\n");
- return ENOENT;
- }
- fattr.nameLen = strlen(strcpy(fattr.entryName, "#.ROOT"));
- nmp->n_rootent.f_parent = nmp->n_rootent.f_id;
- }
- error = nwfs_nget(mp, nmp->n_rootent, &fattr, NULL, &vp);
- if (error)
- return (error);
- vp->v_vflag |= VV_ROOT;
- np = VTONW(vp);
- if (nmp->m.root_path[0] == 0)
- np->n_flag |= NVOLUME;
- nmp->n_root = np;
-/* error = VOP_GETATTR(vp, &vattr, cred, td);
- if (error) {
- vput(vp);
- NCPFATAL("Can't get root directory entry\n");
- return error;
- }*/
- *vpp = vp;
- return (0);
-}
-
-/*
- * Do operations associated with quotas, not supported
- */
-/* ARGSUSED */
-static int
-nwfs_quotactl(mp, cmd, uid, arg)
- struct mount *mp;
- int cmd;
- uid_t uid;
- void *arg;
-{
- NCPVODEBUG("return EOPNOTSUPP\n");
- return (EOPNOTSUPP);
-}
-
-/*ARGSUSED*/
-int
-nwfs_init(struct vfsconf *vfsp)
-{
- nwfs_hash_init();
- nwfs_pbuf_freecnt = nswbuf / 2 + 1;
- NCPVODEBUG("always happy to load!\n");
- return (0);
-}
-
-/*ARGSUSED*/
-int
-nwfs_uninit(struct vfsconf *vfsp)
-{
-
- nwfs_hash_free();
- NCPVODEBUG("unloaded\n");
- return (0);
-}
-
-/*
- * nwfs_statfs call
- */
-int
-nwfs_statfs(mp, sbp)
- struct mount *mp;
- struct statfs *sbp;
-{
- struct nwmount *nmp = VFSTONWFS(mp);
- struct thread *td = curthread;
- int error = 0, secsize;
- struct nwnode *np = nmp->n_root;
- struct ncp_volume_info vi;
-
- if (np == NULL) return EINVAL;
- error = ncp_get_volume_info_with_number(NWFSTOCONN(nmp),
- nmp->n_volume, &vi, td, td->td_ucred);
- if (error) return error;
- secsize = 512; /* XXX how to get real value ??? */
- /* fundamental filesystem block size */
- sbp->f_bsize = vi.sectors_per_block*secsize;
- /* optimal transfer block size */
- sbp->f_iosize = NWFSTOCONN(nmp)->buffer_size;
- /* total data blocks in filesystem */
- sbp->f_blocks= vi.total_blocks;
- /* free blocks in fs */
- sbp->f_bfree = vi.free_blocks + vi.purgeable_blocks;
- /* free blocks avail to non-superuser */
- sbp->f_bavail= vi.free_blocks+vi.purgeable_blocks;
- /* total file nodes in filesystem */
- sbp->f_files = vi.total_dir_entries;
- /* free file nodes in fs */
- sbp->f_ffree = vi.available_dir_entries;
- sbp->f_flags = 0; /* copy of mount exported flags */
- return 0;
-}
diff --git a/sys/fs/nwfs/nwfs_vnops.c b/sys/fs/nwfs/nwfs_vnops.c
deleted file mode 100644
index b3f26e8..0000000
--- a/sys/fs/nwfs/nwfs_vnops.c
+++ /dev/null
@@ -1,967 +0,0 @@
-/*-
- * Copyright (c) 1999, 2000, 2001 Boris Popov
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/namei.h>
-#include <sys/kernel.h>
-#include <sys/bio.h>
-#include <sys/buf.h>
-#include <sys/fcntl.h>
-#include <sys/mount.h>
-#include <sys/unistd.h>
-#include <sys/vnode.h>
-
-#include <vm/vm.h>
-#include <vm/vm_extern.h>
-
-#include <netncp/ncp.h>
-#include <netncp/ncp_conn.h>
-#include <netncp/ncp_subr.h>
-#include <netncp/nwerror.h>
-#include <netncp/ncp_nls.h>
-
-#include <fs/nwfs/nwfs.h>
-#include <fs/nwfs/nwfs_node.h>
-#include <fs/nwfs/nwfs_subr.h>
-
-/*
- * Prototypes for NWFS vnode operations
- */
-static vop_create_t nwfs_create;
-static vop_mknod_t nwfs_mknod;
-static vop_open_t nwfs_open;
-static vop_close_t nwfs_close;
-static vop_access_t nwfs_access;
-static vop_getattr_t nwfs_getattr;
-static vop_setattr_t nwfs_setattr;
-static vop_read_t nwfs_read;
-static vop_write_t nwfs_write;
-static vop_fsync_t nwfs_fsync;
-static vop_remove_t nwfs_remove;
-static vop_link_t nwfs_link;
-static vop_lookup_t nwfs_lookup;
-static vop_rename_t nwfs_rename;
-static vop_mkdir_t nwfs_mkdir;
-static vop_rmdir_t nwfs_rmdir;
-static vop_symlink_t nwfs_symlink;
-static vop_readdir_t nwfs_readdir;
-static vop_strategy_t nwfs_strategy;
-static vop_print_t nwfs_print;
-static vop_pathconf_t nwfs_pathconf;
-
-/* Global vfs data structures for nwfs */
-struct vop_vector nwfs_vnodeops = {
- .vop_default = &default_vnodeops,
-
- .vop_access = nwfs_access,
- .vop_close = nwfs_close,
- .vop_create = nwfs_create,
- .vop_fsync = nwfs_fsync,
- .vop_getattr = nwfs_getattr,
- .vop_getpages = nwfs_getpages,
- .vop_inactive = nwfs_inactive,
- .vop_ioctl = nwfs_ioctl,
- .vop_link = nwfs_link,
- .vop_lookup = nwfs_lookup,
- .vop_mkdir = nwfs_mkdir,
- .vop_mknod = nwfs_mknod,
- .vop_open = nwfs_open,
- .vop_pathconf = nwfs_pathconf,
- .vop_print = nwfs_print,
- .vop_putpages = nwfs_putpages,
- .vop_read = nwfs_read,
- .vop_readdir = nwfs_readdir,
- .vop_reclaim = nwfs_reclaim,
- .vop_remove = nwfs_remove,
- .vop_rename = nwfs_rename,
- .vop_rmdir = nwfs_rmdir,
- .vop_setattr = nwfs_setattr,
- .vop_strategy = nwfs_strategy,
- .vop_symlink = nwfs_symlink,
- .vop_write = nwfs_write,
-};
-
-/*
- * nwfs_access vnode op
- */
-static int
-nwfs_access(ap)
- struct vop_access_args /* {
- struct vnode *a_vp;
- accmode_t a_accmode;
- struct ucred *a_cred;
- struct thread *td;
- } */ *ap;
-{
- struct vnode *vp = ap->a_vp;
- mode_t mpmode;
- struct nwmount *nmp = VTONWFS(vp);
-
- NCPVNDEBUG("\n");
- if ((ap->a_accmode & VWRITE) && (vp->v_mount->mnt_flag & MNT_RDONLY)) {
- switch (vp->v_type) {
- case VREG: case VDIR: case VLNK:
- return (EROFS);
- default:
- break;
- }
- }
- mpmode = vp->v_type == VREG ? nmp->m.file_mode :
- nmp->m.dir_mode;
- return (vaccess(vp->v_type, mpmode, nmp->m.uid,
- nmp->m.gid, ap->a_accmode, ap->a_cred, NULL));
-}
-/*
- * nwfs_open vnode op
- */
-/* ARGSUSED */
-static int
-nwfs_open(ap)
- struct vop_open_args /* {
- struct vnode *a_vp;
- int a_mode;
- struct ucred *a_cred;
- struct thread *td;
- } */ *ap;
-{
- struct vnode *vp = ap->a_vp;
- int mode = ap->a_mode;
- struct nwnode *np = VTONW(vp);
- struct ncp_open_info no;
- struct nwmount *nmp = VTONWFS(vp);
- struct vattr vattr;
- int error, nwm;
-
- NCPVNDEBUG("%s,%d\n", np->n_name, np->opened);
- if (vp->v_type != VREG && vp->v_type != VDIR) {
- NCPFATAL("open vtype = %d\n", vp->v_type);
- return (EACCES);
- }
- if (vp->v_type == VDIR) return 0; /* nothing to do now */
- if (np->n_flag & NMODIFIED) {
- if ((error = nwfs_vinvalbuf(vp, ap->a_td)) == EINTR)
- return (error);
- np->n_atime = 0;
- error = VOP_GETATTR(vp, &vattr, ap->a_cred);
- if (error) return (error);
- np->n_mtime = vattr.va_mtime.tv_sec;
- } else {
- error = VOP_GETATTR(vp, &vattr, ap->a_cred);
- if (error) return (error);
- if (np->n_mtime != vattr.va_mtime.tv_sec) {
- if ((error = nwfs_vinvalbuf(vp, ap->a_td)) == EINTR)
- return (error);
- np->n_mtime = vattr.va_mtime.tv_sec;
- }
- }
- if (np->opened) {
- np->opened++;
- return 0;
- }
- nwm = AR_READ;
- if ((vp->v_mount->mnt_flag & MNT_RDONLY) == 0)
- nwm |= AR_WRITE;
- error = ncp_open_create_file_or_subdir(nmp, vp, 0, NULL, OC_MODE_OPEN,
- 0, nwm, &no, ap->a_td, ap->a_cred);
- if (error) {
- if (mode & FWRITE)
- return EACCES;
- nwm = AR_READ;
- error = ncp_open_create_file_or_subdir(nmp, vp, 0, NULL, OC_MODE_OPEN, 0,
- nwm, &no, ap->a_td, ap->a_cred);
- }
- if (!error) {
- np->opened++;
- np->n_fh = no.fh;
- np->n_origfh = no.origfh;
- }
- np->n_atime = 0;
- return (error);
-}
-
-static int
-nwfs_close(ap)
- struct vop_close_args /* {
- struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
- int a_fflag;
- struct ucred *a_cred;
- struct thread *td;
- } */ *ap;
-{
- struct vnode *vp = ap->a_vp;
- struct nwnode *np = VTONW(vp);
- int error;
-
- NCPVNDEBUG("name=%s,pid=%d,c=%d\n", np->n_name, ap->a_td->td_proc->p_pid,
- np->opened);
-
- if (vp->v_type == VDIR) return 0; /* nothing to do now */
- error = 0;
- VI_LOCK(vp);
- if (np->opened == 0) {
- VI_UNLOCK(vp);
- return 0;
- }
- VI_UNLOCK(vp);
- error = nwfs_vinvalbuf(vp, ap->a_td);
- VI_LOCK(vp);
- if (np->opened == 0) {
- VI_UNLOCK(vp);
- return 0;
- }
- if (--np->opened == 0) {
- VI_UNLOCK(vp);
- error = ncp_close_file(NWFSTOCONN(VTONWFS(vp)), &np->n_fh,
- ap->a_td, ap->a_cred);
- } else
- VI_UNLOCK(vp);
- np->n_atime = 0;
- return (error);
-}
-
-/*
- * nwfs_getattr call from vfs.
- */
-static int
-nwfs_getattr(ap)
- struct vop_getattr_args /* {
- struct vnode *a_vp;
- struct vattr *a_vap;
- struct ucred *a_cred;
- } */ *ap;
-{
- struct vnode *vp = ap->a_vp;
- struct nwnode *np = VTONW(vp);
- struct vattr *va=ap->a_vap;
- struct nwmount *nmp = VTONWFS(vp);
- struct thread *td = curthread;
- struct nw_entry_info fattr;
- int error;
- u_int32_t oldsize;
-
- NCPVNDEBUG("%lx:%d: '%s' %d\n", (long)vp, nmp->n_volume, np->n_name, (vp->v_vflag & VV_ROOT) != 0);
- error = nwfs_attr_cachelookup(vp, va);
- if (!error) return 0;
- NCPVNDEBUG("not in cache\n");
- oldsize = np->n_size;
- if (np->n_flag & NVOLUME) {
- error = ncp_obtain_info(nmp, np->n_fid.f_id, 0, NULL, &fattr,
- td, ap->a_cred);
- } else {
- error = ncp_obtain_info(nmp, np->n_fid.f_parent, np->n_nmlen,
- np->n_name, &fattr, td, ap->a_cred);
- }
- if (error) {
- NCPVNDEBUG("error %d\n", error);
- return error;
- }
- nwfs_attr_cacheenter(vp, &fattr);
- *va = np->n_vattr;
- if (np->opened)
- np->n_size = oldsize;
- return (0);
-}
-/*
- * nwfs_setattr call from vfs.
- */
-static int
-nwfs_setattr(ap)
- struct vop_setattr_args /* {
- struct vnode *a_vp;
- struct vattr *a_vap;
- struct ucred *a_cred;
- } */ *ap;
-{
- struct vnode *vp = ap->a_vp;
- struct nwnode *np = VTONW(vp);
- struct vattr *vap = ap->a_vap;
- u_quad_t tsize=0;
- int error = 0;
-
- NCPVNDEBUG("\n");
- if (vap->va_flags != VNOVAL)
- return (EOPNOTSUPP);
- /*
- * Disallow write attempts if the filesystem is mounted read-only.
- */
- if ((vap->va_uid != (uid_t)VNOVAL || vap->va_gid != (gid_t)VNOVAL ||
- vap->va_atime.tv_sec != VNOVAL || vap->va_mtime.tv_sec != VNOVAL ||
- vap->va_mode != (mode_t)VNOVAL) &&(vp->v_mount->mnt_flag & MNT_RDONLY))
- return (EROFS);
- if (vap->va_size != VNOVAL) {
- switch (vp->v_type) {
- case VDIR:
- return (EISDIR);
- case VREG:
- /*
- * Disallow write attempts if the filesystem is
- * mounted read-only.
- */
- if (vp->v_mount->mnt_flag & MNT_RDONLY)
- return (EROFS);
- vnode_pager_setsize(vp, (u_long)vap->va_size);
- tsize = np->n_size;
- np->n_size = vap->va_size;
- break;
- default:
- return EINVAL;
- };
- }
- error = ncp_setattr(vp, vap, ap->a_cred, curthread);
- if (error && vap->va_size != VNOVAL) {
- np->n_size = tsize;
- vnode_pager_setsize(vp, (u_long)tsize);
- }
- np->n_atime = 0; /* invalidate cache */
- VOP_GETATTR(vp, vap, ap->a_cred);
- np->n_mtime = vap->va_mtime.tv_sec;
- return (0);
-}
-/*
- * nwfs_read call.
- */
-static int
-nwfs_read(ap)
- struct vop_read_args /* {
- struct vnode *a_vp;
- struct uio *a_uio;
- int a_ioflag;
- struct ucred *a_cred;
- } */ *ap;
-{
- struct vnode *vp = ap->a_vp;
- struct uio *uio=ap->a_uio;
- int error;
- NCPVNDEBUG("nwfs_read:\n");
-
- if (vp->v_type != VREG && vp->v_type != VDIR)
- return (EPERM);
- error = nwfs_readvnode(vp, uio, ap->a_cred);
- return error;
-}
-
-static int
-nwfs_write(ap)
- struct vop_write_args /* {
- struct vnode *a_vp;
- struct uio *a_uio;
- int a_ioflag;
- struct ucred *a_cred;
- } */ *ap;
-{
- struct vnode *vp = ap->a_vp;
- struct uio *uio = ap->a_uio;
- int error;
-
- NCPVNDEBUG("%d,ofs=%d,sz=%d\n", vp->v_type, (int)uio->uio_offset, uio->uio_resid);
-
- if (vp->v_type != VREG)
- return (EPERM);
- error = nwfs_writevnode(vp, uio, ap->a_cred, ap->a_ioflag);
- return(error);
-}
-/*
- * nwfs_create call
- * Create a regular file. On entry the directory to contain the file being
- * created is locked. We must release before we return. We must also free
- * the pathname buffer pointed at by cnp->cn_pnbuf, always on error, or
- * only if the SAVESTART bit in cn_flags is clear on success.
- */
-static int
-nwfs_create(ap)
- struct vop_create_args /* {
- struct vnode *a_dvp;
- struct vnode **a_vpp;
- struct componentname *a_cnp;
- struct vattr *a_vap;
- } */ *ap;
-{
- struct vnode *dvp = ap->a_dvp;
- struct vattr *vap = ap->a_vap;
- struct vnode **vpp=ap->a_vpp;
- struct componentname *cnp = ap->a_cnp;
- struct vnode *vp = (struct vnode *)0;
- int error = 0, fmode;
- struct vattr vattr;
- struct nwnode *np;
- struct ncp_open_info no;
- struct nwmount *nmp=VTONWFS(dvp);
- ncpfid fid;
-
-
- NCPVNDEBUG("\n");
- *vpp = NULL;
- if (vap->va_type == VSOCK)
- return (EOPNOTSUPP);
- if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred)))
- return (error);
- fmode = AR_READ | AR_WRITE;
-/* if (vap->va_vaflags & VA_EXCLUSIVE)
- fmode |= AR_DENY_READ | AR_DENY_WRITE;*/
-
- error = ncp_open_create_file_or_subdir(nmp, dvp, cnp->cn_namelen, cnp->cn_nameptr,
- OC_MODE_CREATE | OC_MODE_OPEN | OC_MODE_REPLACE,
- 0, fmode, &no, cnp->cn_thread, cnp->cn_cred);
- if (!error) {
- error = ncp_close_file(NWFSTOCONN(nmp), &no.fh, cnp->cn_thread, cnp->cn_cred);
- fid.f_parent = VTONW(dvp)->n_fid.f_id;
- fid.f_id = no.fattr.dirEntNum;
- error = nwfs_nget(VTOVFS(dvp), fid, &no.fattr, dvp, &vp);
- if (!error) {
- np = VTONW(vp);
- np->opened = 0;
- *vpp = vp;
- }
- if (cnp->cn_flags & MAKEENTRY)
- cache_enter(dvp, vp, cnp);
- }
- return (error);
-}
-
-/*
- * nwfs_remove call. It isn't possible to emulate UFS behaivour because
- * NetWare doesn't allow delete/rename operations on an opened file.
- */
-static int
-nwfs_remove(ap)
- struct vop_remove_args /* {
- struct vnodeop_desc *a_desc;
- struct vnode * a_dvp;
- struct vnode * a_vp;
- struct componentname * a_cnp;
- } */ *ap;
-{
- struct vnode *vp = ap->a_vp;
- struct vnode *dvp = ap->a_dvp;
- struct componentname *cnp = ap->a_cnp;
- struct nwnode *np = VTONW(vp);
- struct nwmount *nmp = VTONWFS(vp);
- int error;
-
- if (vp->v_type == VDIR || np->opened || vrefcnt(vp) != 1)
- return EPERM;
- cache_purge(vp);
- error = ncp_DeleteNSEntry(nmp, VTONW(dvp)->n_fid.f_id,
- cnp->cn_namelen, cnp->cn_nameptr, cnp->cn_thread, cnp->cn_cred);
- if (error == 0)
- np->n_flag |= NSHOULDFREE;
- else if (error == 0x899c)
- error = EACCES;
- return (error);
-}
-
-/*
- * nwfs_file rename call
- */
-static int
-nwfs_rename(ap)
- struct vop_rename_args /* {
- struct vnode *a_fdvp;
- struct vnode *a_fvp;
- struct componentname *a_fcnp;
- struct vnode *a_tdvp;
- struct vnode *a_tvp;
- struct componentname *a_tcnp;
- } */ *ap;
-{
- struct vnode *fvp = ap->a_fvp;
- struct vnode *tvp = ap->a_tvp;
- struct vnode *fdvp = ap->a_fdvp;
- struct vnode *tdvp = ap->a_tdvp;
- struct componentname *tcnp = ap->a_tcnp;
- struct componentname *fcnp = ap->a_fcnp;
- struct nwmount *nmp=VTONWFS(fvp);
- u_int16_t oldtype = 6;
- int error=0;
-
- /* Check for cross-device rename */
- if ((fvp->v_mount != tdvp->v_mount) ||
- (tvp && (fvp->v_mount != tvp->v_mount))) {
- error = EXDEV;
- goto out;
- }
-
- if (tvp && vrefcnt(tvp) > 1) {
- error = EBUSY;
- goto out;
- }
- if (fvp->v_type == VDIR) {
- oldtype |= NW_TYPE_SUBDIR;
- } else if (fvp->v_type == VREG) {
- oldtype |= NW_TYPE_FILE;
- } else {
- error = EINVAL;
- goto out;
- }
- if (tvp && tvp != fvp) {
- error = ncp_DeleteNSEntry(nmp, VTONW(tdvp)->n_fid.f_id,
- tcnp->cn_namelen, tcnp->cn_nameptr,
- tcnp->cn_thread, tcnp->cn_cred);
- if (error == 0x899c) error = EACCES;
- if (error)
- goto out_cacherem;
- }
- error = ncp_nsrename(NWFSTOCONN(nmp), nmp->n_volume, nmp->name_space,
- oldtype, &nmp->m.nls,
- VTONW(fdvp)->n_fid.f_id, fcnp->cn_nameptr, fcnp->cn_namelen,
- VTONW(tdvp)->n_fid.f_id, tcnp->cn_nameptr, tcnp->cn_namelen,
- tcnp->cn_thread, tcnp->cn_cred);
-
- if (error == 0x8992)
- error = EEXIST;
- if (fvp->v_type == VDIR) {
- if (tvp != NULL && tvp->v_type == VDIR)
- cache_purge(tdvp);
- cache_purge(fdvp);
- }
-out_cacherem:
- nwfs_attr_cacheremove(fdvp);
- nwfs_attr_cacheremove(tdvp);
- nwfs_attr_cacheremove(fvp);
-out:
- if (tdvp == tvp)
- vrele(tdvp);
- else
- vput(tdvp);
- if (tvp)
- vput(tvp);
- vrele(fdvp);
- vrele(fvp);
- if (tvp)
- nwfs_attr_cacheremove(tvp);
- /*
- * Kludge: Map ENOENT => 0 assuming that it is a reply to a retry.
- */
- if (error == ENOENT)
- error = 0;
- return (error);
-}
-
-/*
- * nwfs hard link create call
- * Netware filesystems don't know what links are.
- */
-static int
-nwfs_link(ap)
- struct vop_link_args /* {
- struct vnode *a_tdvp;
- struct vnode *a_vp;
- struct componentname *a_cnp;
- } */ *ap;
-{
- return EOPNOTSUPP;
-}
-
-/*
- * nwfs_symlink link create call
- * Netware filesystems don't know what symlinks are.
- */
-static int
-nwfs_symlink(ap)
- struct vop_symlink_args /* {
- struct vnode *a_dvp;
- struct vnode **a_vpp;
- struct componentname *a_cnp;
- struct vattr *a_vap;
- char *a_target;
- } */ *ap;
-{
- return (EOPNOTSUPP);
-}
-
-static int nwfs_mknod(ap)
- struct vop_mknod_args /* {
- } */ *ap;
-{
- return (EOPNOTSUPP);
-}
-
-/*
- * nwfs_mkdir call
- */
-static int
-nwfs_mkdir(ap)
- struct vop_mkdir_args /* {
- struct vnode *a_dvp;
- struct vnode **a_vpp;
- struct componentname *a_cnp;
- struct vattr *a_vap;
- } */ *ap;
-{
- struct vnode *dvp = ap->a_dvp;
-/* struct vattr *vap = ap->a_vap;*/
- struct componentname *cnp = ap->a_cnp;
- int len=cnp->cn_namelen;
- struct ncp_open_info no;
- struct vnode *newvp = (struct vnode *)0;
- ncpfid fid;
- int error = 0;
- struct vattr vattr;
- char *name=cnp->cn_nameptr;
-
- if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred)))
- return (error);
- if ((name[0] == '.') && ((len == 1) || ((len == 2) && (name[1] == '.')))) {
- return EEXIST;
- }
- if (ncp_open_create_file_or_subdir(VTONWFS(dvp), dvp, cnp->cn_namelen,
- cnp->cn_nameptr, OC_MODE_CREATE, aDIR, 0xffff,
- &no, cnp->cn_thread, cnp->cn_cred) != 0) {
- error = EACCES;
- } else {
- error = 0;
- }
- if (!error) {
- fid.f_parent = VTONW(dvp)->n_fid.f_id;
- fid.f_id = no.fattr.dirEntNum;
- error = nwfs_nget(VTOVFS(dvp), fid, &no.fattr, dvp, &newvp);
- if (!error) {
- newvp->v_type = VDIR;
- *ap->a_vpp = newvp;
- }
- }
- return (error);
-}
-
-/*
- * nwfs_remove directory call
- */
-static int
-nwfs_rmdir(ap)
- struct vop_rmdir_args /* {
- struct vnode *a_dvp;
- struct vnode *a_vp;
- struct componentname *a_cnp;
- } */ *ap;
-{
- struct vnode *vp = ap->a_vp;
- struct vnode *dvp = ap->a_dvp;
- struct componentname *cnp = ap->a_cnp;
- struct nwnode *np = VTONW(vp);
- struct nwmount *nmp = VTONWFS(vp);
- struct nwnode *dnp = VTONW(dvp);
- int error = EIO;
-
- if (dvp == vp)
- return EINVAL;
-
- error = ncp_DeleteNSEntry(nmp, dnp->n_fid.f_id,
- cnp->cn_namelen, cnp->cn_nameptr, cnp->cn_thread, cnp->cn_cred);
- if (error == 0)
- np->n_flag |= NSHOULDFREE;
- else if (error == NWE_DIR_NOT_EMPTY)
- error = ENOTEMPTY;
- dnp->n_flag |= NMODIFIED;
- nwfs_attr_cacheremove(dvp);
- cache_purge(dvp);
- cache_purge(vp);
- return (error);
-}
-
-/*
- * nwfs_readdir call
- */
-static int
-nwfs_readdir(ap)
- struct vop_readdir_args /* {
- struct vnode *a_vp;
- struct uio *a_uio;
- struct ucred *a_cred;
- int *a_eofflag;
- u_long *a_cookies;
- int a_ncookies;
- } */ *ap;
-{
- struct vnode *vp = ap->a_vp;
- struct uio *uio = ap->a_uio;
- int error;
-
- if (vp->v_type != VDIR)
- return (EPERM);
- if (ap->a_ncookies) {
- printf("nwfs_readdir: no support for cookies now...");
- return (EOPNOTSUPP);
- }
-
- error = nwfs_readvnode(vp, uio, ap->a_cred);
- return error;
-}
-/* ARGSUSED */
-static int
-nwfs_fsync(ap)
- struct vop_fsync_args /* {
- struct vnodeop_desc *a_desc;
- struct vnode * a_vp;
- struct ucred * a_cred;
- int a_waitfor;
- struct thread *a_td;
- } */ *ap;
-{
-/* return (nfs_flush(ap->a_vp, ap->a_cred, ap->a_waitfor, ap->a_td, 1));*/
- return (0);
-}
-
-/* ARGSUSED */
-static
-int nwfs_print (ap)
- struct vop_print_args /* {
- struct vnode *a_vp;
- } */ *ap;
-{
- struct vnode *vp = ap->a_vp;
- struct nwnode *np = VTONW(vp);
-
- printf("\tnwfs node: name = '%s', fid = %d, pfid = %d\n",
- np->n_name, np->n_fid.f_id, np->n_fid.f_parent);
- return (0);
-}
-
-static int nwfs_pathconf (ap)
- struct vop_pathconf_args /* {
- struct vnode *vp;
- int name;
- register_t *retval;
- } */ *ap;
-{
- int name=ap->a_name, error=0;
- register_t *retval=ap->a_retval;
-
- switch(name){
- case _PC_LINK_MAX:
- *retval=0;
- break;
- case _PC_NAME_MAX:
- *retval=NCP_MAX_FILENAME; /* XXX from nwfsnode */
- break;
- case _PC_PATH_MAX:
- *retval=NCP_MAXPATHLEN; /* XXX from nwfsnode */
- break;
- default:
- error=EINVAL;
- }
- return(error);
-}
-
-static int nwfs_strategy (ap)
- struct vop_strategy_args /* {
- struct buf *a_bp
- } */ *ap;
-{
- struct buf *bp=ap->a_bp;
- struct ucred *cr;
- struct thread *td;
-
- NCPVNDEBUG("\n");
- if (bp->b_flags & B_ASYNC)
- td = (struct thread *)0;
- else
- td = curthread; /* XXX */
- if (bp->b_iocmd == BIO_READ)
- cr = bp->b_rcred;
- else
- cr = bp->b_wcred;
- /*
- * If the op is asynchronous and an i/o daemon is waiting
- * queue the request, wake it up and wait for completion
- * otherwise just do it ourselves.
- */
- if ((bp->b_flags & B_ASYNC) == 0 )
- (void)nwfs_doio(ap->a_vp, bp, cr, td);
- return (0);
-}
-
-
-/*
- * How to keep the brain busy ...
- * Currently lookup routine can make two lookup for vnode. This can be
- * avoided by reorg the code.
- */
-int
-nwfs_lookup(ap)
- struct vop_lookup_args /* {
- struct vnodeop_desc *a_desc;
- struct vnode *a_dvp;
- struct vnode **a_vpp;
- struct componentname *a_cnp;
- } */ *ap;
-{
- struct componentname *cnp = ap->a_cnp;
- struct vnode *dvp = ap->a_dvp;
- struct vnode **vpp = ap->a_vpp;
- int flags = cnp->cn_flags;
- struct vnode *vp;
- struct nwmount *nmp;
- struct mount *mp = dvp->v_mount;
- struct nwnode *dnp, *npp;
- struct nw_entry_info fattr, *fap;
- ncpfid fid;
- int nameiop=cnp->cn_nameiop, islastcn;
- int error = 0, notfound;
- struct thread *td = cnp->cn_thread;
- char _name[cnp->cn_namelen+1];
- bcopy(cnp->cn_nameptr, _name, cnp->cn_namelen);
- _name[cnp->cn_namelen]=0;
-
- if (dvp->v_type != VDIR)
- return (ENOTDIR);
- if ((flags & ISDOTDOT) && (dvp->v_vflag & VV_ROOT)) {
- printf("nwfs_lookup: invalid '..'\n");
- return EIO;
- }
-
- NCPVNDEBUG("%d '%s' in '%s' id=d\n", nameiop, _name,
- VTONW(dvp)->n_name/*, VTONW(dvp)->n_name*/);
-
- islastcn = flags & ISLASTCN;
- if (islastcn && (mp->mnt_flag & MNT_RDONLY) && (nameiop != LOOKUP))
- return (EROFS);
- if ((error = VOP_ACCESS(dvp, VEXEC, cnp->cn_cred, td)))
- return (error);
- nmp = VFSTONWFS(mp);
- dnp = VTONW(dvp);
-/*
-printf("dvp %d:%d:%d\n", (int)mp, (int)dvp->v_vflag & VV_ROOT, (int)flags & ISDOTDOT);
-*/
- error = ncp_pathcheck(cnp->cn_nameptr, cnp->cn_namelen, &nmp->m.nls,
- (nameiop == CREATE || nameiop == RENAME) && (nmp->m.nls.opt & NWHP_NOSTRICT) == 0);
- if (error)
- return ENOENT;
-
- error = cache_lookup(dvp, vpp, cnp, NULL, NULL);
- NCPVNDEBUG("cache_lookup returned %d\n", error);
- if (error > 0)
- return error;
- if (error) { /* name was found */
- struct vattr vattr;
-
- vp = *vpp;
- if (!VOP_GETATTR(vp, &vattr, cnp->cn_cred) &&
- vattr.va_ctime.tv_sec == VTONW(vp)->n_ctime) {
- if (nameiop != LOOKUP && islastcn)
- cnp->cn_flags |= SAVENAME;
- NCPVNDEBUG("use cached vnode");
- return (0);
- }
- cache_purge(vp);
- if (vp != dvp)
- vput(vp);
- else
- vrele(vp);
- *vpp = NULLVP;
- }
- /* not in cache, so ... */
- error = 0;
- *vpp = NULLVP;
- fap = NULL;
- if (flags & ISDOTDOT) {
- if (NWCMPF(&dnp->n_parent, &nmp->n_rootent)) {
- fid = nmp->n_rootent;
- fap = NULL;
- notfound = 0;
- } else {
- error = nwfs_lookupnp(nmp, dnp->n_parent, td, &npp);
- if (error) {
- return error;
- }
- fid = dnp->n_parent;
- fap = &fattr;
- /*np = *npp;*/
- notfound = ncp_obtain_info(nmp, npp->n_dosfid,
- 0, NULL, fap, td, cnp->cn_cred);
- }
- } else {
- fap = &fattr;
- notfound = ncp_lookup(dvp, cnp->cn_namelen, cnp->cn_nameptr,
- fap, td, cnp->cn_cred);
- fid.f_id = fap->dirEntNum;
- if (cnp->cn_namelen == 1 && cnp->cn_nameptr[0] == '.') {
- fid.f_parent = dnp->n_fid.f_parent;
- } else
- fid.f_parent = dnp->n_fid.f_id;
- NCPVNDEBUG("call to ncp_lookup returned=%d\n", notfound);
- }
- if (notfound && notfound < 0x80 )
- return (notfound); /* hard error */
- if (notfound) { /* entry not found */
- /* Handle RENAME or CREATE case... */
- if ((nameiop == CREATE || nameiop == RENAME) && islastcn) {
- cnp->cn_flags |= SAVENAME;
- return (EJUSTRETURN);
- }
- return ENOENT;
- }/* else {
- NCPVNDEBUG("Found entry %s with id=%d\n", fap->entryName, fap->dirEntNum);
- }*/
- /* handle DELETE case ... */
- if (nameiop == DELETE && islastcn) { /* delete last component */
- error = VOP_ACCESS(dvp, VWRITE, cnp->cn_cred, cnp->cn_thread);
- if (error) return (error);
- if (NWCMPF(&dnp->n_fid, &fid)) { /* we found ourselfs */
- VREF(dvp);
- *vpp = dvp;
- return 0;
- }
- error = nwfs_nget(mp, fid, fap, dvp, &vp);
- if (error) return (error);
- *vpp = vp;
- cnp->cn_flags |= SAVENAME; /* I free it later */
- return (0);
- }
- if (nameiop == RENAME && islastcn) {
- error = VOP_ACCESS(dvp, VWRITE, cnp->cn_cred, cnp->cn_thread);
- if (error) return (error);
- if (NWCMPF(&dnp->n_fid, &fid)) return EISDIR;
- error = nwfs_nget(mp, fid, fap, dvp, &vp);
- if (error) return (error);
- *vpp = vp;
- cnp->cn_flags |= SAVENAME;
- return (0);
- }
- if (flags & ISDOTDOT) {
- VOP_UNLOCK(dvp, 0); /* race to get the inode */
- error = nwfs_nget(mp, fid, NULL, NULL, &vp);
- vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY);
- if (error)
- return (error);
- *vpp = vp;
- } else if (NWCMPF(&dnp->n_fid, &fid)) {
- vref(dvp);
- *vpp = dvp;
- } else {
- error = nwfs_nget(mp, fid, fap, dvp, &vp);
- if (error) return (error);
- *vpp = vp;
- NCPVNDEBUG("lookup: getnewvp!\n");
- }
- if ((cnp->cn_flags & MAKEENTRY)/* && !islastcn*/) {
- VTONW(*vpp)->n_ctime = VTONW(*vpp)->n_vattr.va_ctime.tv_sec;
- cache_enter(dvp, *vpp, cnp);
- }
- return (0);
-}
diff --git a/sys/modules/ncp/Makefile b/sys/modules/ncp/Makefile
deleted file mode 100644
index fb9d993..0000000
--- a/sys/modules/ncp/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
-# $FreeBSD$
-
-.PATH: ${.CURDIR}/../../netncp
-
-KMOD= ncp
-
-SRCS= ncp_conn.c ncp_sock.c ncp_ncp.c ncp_subr.c ncp_crypt.c ncp_mod.c \
- ncp_rq.c ncp_login.c ncp_nls.c opt_ncp.h
-
-.if defined(NCPBURST)
-SRCS+= ncp_burst.c
-CFLAGS+= -DNCPBURST
-.endif
-
-.include <bsd.kmod.mk>
diff --git a/sys/modules/nwfs/Makefile b/sys/modules/nwfs/Makefile
deleted file mode 100644
index 9739611..0000000
--- a/sys/modules/nwfs/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
-# $FreeBSD$
-
-.PATH: ${.CURDIR}/../../fs/nwfs
-
-KMOD= nwfs
-
-SRCS= vnode_if.h \
- nwfs_node.c nwfs_ioctl.c nwfs_io.c nwfs_vfsops.c nwfs_vnops.c \
- nwfs_subr.c
-
-.if defined(VNPRINT)
-CFLAGS+= -DVNPRINT
-.endif
-
-.include <bsd.kmod.mk>
diff --git a/sys/netncp/ncp.h b/sys/netncp/ncp.h
deleted file mode 100644
index 5b10d9a..0000000
--- a/sys/netncp/ncp.h
+++ /dev/null
@@ -1,392 +0,0 @@
-/*
- * ncp.h
- */
-/*-
- * Copyright (C) 1995 by Volker Lendecke
- * New version derived from original ncp.h, 1998 Boris Popov
- *
- * $FreeBSD$
- */
-
-#ifndef _NETNCP_NCP_H_
-#define _NETNCP_NCP_H_
-
-#define NCP_VERMAJ 1
-#define NCP_VERMIN 3500
-#define NCP_VERSION (NCP_VERMAJ*100000 + NCP_VERMIN)
-
-typedef u_int32_t nwdirent;
-
-typedef char nstr8;
-typedef nstr8* pnstr8;
-typedef u_int8_t nuint8;
-typedef u_int8_t* pnuint8;
-typedef u_int16_t nuint16;
-typedef nuint16* pnuint16;
-typedef u_int32_t nuint32;
-typedef nuint32* pnuint32;
-
-
-#define NCP_DEFAULT_BUFSIZE 1024
-#define NCP_MAX_BUFSIZE 1024
-#define NCP_MAX_PACKET_SIZE 4070
-#define NCP_MAXUSERNAMELEN 255
-#define NCP_MAXPASSWORDLEN 255
-#define NCP_MAXPATHLEN 255
-#define NCP_MAX_FILENAME 14
-#define NCP_FILE_ID_LEN 6
-
-#define NCP_BINDERY_USER 0x0001
-#define NCP_BINDERY_UGROUP 0x0002
-#define NCP_BINDERY_PQUEUE 0x0003
-#define NCP_BINDERY_FSERVER 0x0004
-#define NCP_BINDERY_PSERVER 0x0007
-#define NCP_BINDERY_NAME_LEN 48
-
-/* Handle Flags */
-#define NCP_HF_DIRSHORT 0 /* short directory handle */
-#define NCP_HF_DIRBASE 1 /* directory base */
-#define NCP_HF_NONE 0xff /* no handle or dirbase */
-
-/* Options to negotiate */
-#define NCP_IPX_CHECKSUM 1
-#define NCP_SECURITY_LEVEL_SIGN_HEADERS 2
-
-#ifndef NWCONN_HANDLE
-#define NWCONN_HANDLE unsigned int
-#define pNWCONN_HANDLE (unsigned int*)
-#define NWCONN_NUM u_int16_t
-#define NWCCODE unsigned int
-#define NWDIR_HANDLE u_int8_t
-#define NWFILE_HANDLE int
-#endif
-
-struct ncp_fh_s {
- u_int16_t val1;
- union {
- u_int32_t val32;
- u_int16_t val16;
- } val;
-} __packed;
-
-typedef struct ncp_fh_s ncp_fh;
-
-typedef struct ncpfid_s {
- nwdirent f_parent;
- nwdirent f_id;
-} ncpfid;
-
-/* -- Bindery properties -- */
-struct ncp_bindery_object {
- u_int32_t object_id;
- u_int16_t object_type;
- u_int8_t object_name[NCP_BINDERY_NAME_LEN];
- u_int8_t object_flags;
- u_int8_t object_security;
- u_int8_t object_has_prop;
-};
-
-struct nw_property {
- u_int8_t value[128];
- u_int8_t more_flag;
- u_int8_t property_flag;
-};
-
-struct ncp_filesearch_info {
- u_int8_t volume_number;
- u_int16_t directory_id;
- u_int16_t sequence_no;
- u_int8_t access_rights;
-};
-
-
-struct ncp_file_info {
- u_int8_t file_id[NCP_FILE_ID_LEN];
- char file_name[NCP_MAX_FILENAME + 1];
- u_int8_t file_attributes;
- u_int8_t file_mode;
- u_int32_t file_length;
- u_int16_t creation_date;
- u_int16_t access_date;
- u_int16_t update_date;
- u_int16_t update_time;
-};
-
-struct nw_queue_job_entry {
- u_int16_t InUse;
- u_int32_t prev;
- u_int32_t next;
- u_int32_t ClientStation;
- u_int32_t ClientTask;
- u_int32_t ClientObjectID;
- u_int32_t TargetServerID;
- u_int8_t TargetExecTime[6];
- u_int8_t JobEntryTime[6];
- u_int32_t JobNumber;
- u_int16_t JobType;
- u_int16_t JobPosition;
- u_int16_t JobControlFlags;
- u_int8_t FileNameLen;
- char JobFileName[13];
- u_int32_t JobFileHandle;
- u_int32_t ServerStation;
- u_int32_t ServerTaskNumber;
- u_int32_t ServerObjectID;
- char JobTextDescription[50];
- char ClientRecordArea[152];
-} __packed;
-
-struct queue_job {
- struct nw_queue_job_entry j;
- ncp_fh file_handle;
-};
-
-#define QJE_OPER_HOLD 0x80
-#define QJE_USER_HOLD 0x40
-#define QJE_ENTRYOPEN 0x20
-#define QJE_SERV_RESTART 0x10
-#define QJE_SERV_AUTO 0x08
-
-/* ClientRecordArea for print jobs */
-
-#define KEEP_ON 0x0400
-#define NO_FORM_FEED 0x0800
-#define NOTIFICATION 0x1000
-#define DELETE_FILE 0x2000
-#define EXPAND_TABS 0x4000
-#define PRINT_BANNER 0x8000
-
-struct print_job_record {
- u_int8_t Version;
- u_int8_t TabSize;
- u_int16_t Copies;
- u_int16_t CtrlFlags;
- u_int16_t Lines;
- u_int16_t Rows;
- char FormName[16];
- u_int8_t Reserved[6];
- char BannerName[13];
- char FnameBanner[13];
- char FnameHeader[14];
- char Path[80];
-} __packed;
-
-struct ncp_station_addr {
- u_int32_t NetWork;
- u_int8_t Node[6];
- u_int16_t Socket;
-} __packed;
-
-struct ncp_prop_login_control {
- u_int8_t AccountExpireDate[3];
- u_int8_t Disabled;
- u_int8_t PasswordExpireDate[3];
- u_int8_t GraceLogins;
- u_int16_t PasswordExpireInterval;
- u_int8_t MaxGraceLogins;
- u_int8_t MinPasswordLength;
- u_int16_t MaxConnections;
- u_int8_t ConnectionTimeMask[42];
- u_int8_t LastLogin[6];
- u_int8_t RestrictionMask;
- u_int8_t reserved;
- u_int32_t MaxDiskUsage;
- u_int16_t BadLoginCount;
- u_int32_t BadLoginCountDown;
- struct ncp_station_addr LastIntruder;
-} __packed;
-
-#define NCP_VOLNAME_LEN (16)
-#define NCP_NUMBER_OF_VOLUMES (64)
-struct ncp_volume_info {
- u_int32_t total_blocks;
- u_int32_t free_blocks;
- u_int32_t purgeable_blocks;
- u_int32_t not_yet_purgeable_blocks;
- u_int32_t total_dir_entries;
- u_int32_t available_dir_entries;
- u_int8_t sectors_per_block;
- char volume_name[NCP_VOLNAME_LEN + 1];
-};
-/*
- * Name space constants, taken from NDK
- */
-#define aRONLY (ntohl(0x01000000))
-#define aHIDDEN (ntohl(0x02000000))
-#define aSYSTEM (ntohl(0x04000000))
-#define aEXECUTE (ntohl(0x08000000))
-#define aDIR (ntohl(0x10000000))
-#define aARCH (ntohl(0x20000000))
-
-/* Defines for Name Spaces */
-#define NW_NS_DOS 0
-#define NW_NS_MAC 1
-#define NW_NS_NFS 2
-#define NW_NS_FTAM 3
-#define NW_NS_OS2 4
-
-/* for _ScanNSEntryInfo */
-#define IM_NAME 0x00000001
-#define IM_SPACE_ALLOCATED 0x00000002
-#define IM_ATTRIBUTES 0x00000004
-#define IM_SIZE 0x00000008
-#define IM_TOTAL_SIZE 0x00000010
-#define IM_EA 0x00000020
-#define IM_ARCHIVE 0x00000040
-#define IM_MODIFY 0x00000080
-#define IM_CREATION 0x00000100
-#define IM_OWNING_NAMESPACE 0x00000200
-#define IM_DIRECTORY 0x00000400
-#define IM_RIGHTS 0x00000800
-#define IM_ALMOST_ALL 0x00000FED
-#define IM_ALL 0x00000FFF
-#define IM_REFERENCE_ID 0x00001000
-#define IM_NS_ATTRIBUTES 0x00002000
-#define IM_COMPRESSED_INFO 0x80000000UL
-
-/* open/create modes */
-#define OC_MODE_OPEN 0x01
-#define OC_MODE_TRUNCATE 0x02
-#define OC_MODE_REPLACE 0x02
-#define OC_MODE_CREATE 0x08
-
-/* open/create results */
-#define OC_ACTION_NONE 0x00
-#define OC_ACTION_OPEN 0x01
-#define OC_ACTION_CREATE 0x02
-#define OC_ACTION_TRUNCATE 0x04
-#define OC_ACTION_REPLACE 0x04
-
-/* renameFlag in NSRename */
-#define NW_TYPE_FILE 0x8000
-#define NW_TYPE_SUBDIR 0x0010
-
-#define NW_NAME_CONVERT 0x0003 /* don't report error and set comp mode */
-#define NW_NO_NAME_CONVERT 0x0004 /* only in specified name space */
-
-/* search attributes */
-#ifndef SA_HIDDEN
-#define SA_NORMAL 0x0000
-#define SA_HIDDEN 0x0002
-#define SA_SYSTEM 0x0004
-#define SA_SUBDIR_ONLY 0x0010
-#define SA_SUBDIR_FILES 0x8000
-#define SA_ALL 0x8006
-#endif
-
-/* access rights attributes */
-#ifndef AR_READ
-#define AR_READ 0x0001
-#define AR_WRITE 0x0002
-#define AR_READ_ONLY 0x0001
-#define AR_WRITE_ONLY 0x0002
-#define AR_DENY_READ 0x0004
-#define AR_DENY_WRITE 0x0008
-#define AR_COMPATIBILITY 0x0010
-#define AR_WRITE_THROUGH 0x0040
-#define AR_OPEN_COMPRESSED 0x0100
-#endif
-
-struct nw_entry_info {
- u_int32_t spaceAlloc;
- u_int32_t attributes; /* LH */
- u_int16_t flags; /* internal */
- u_int32_t dataStreamSize;
- u_int32_t totalStreamSize;
- u_int16_t numberOfStreams;
- u_int16_t creationTime; /* LH */
- u_int16_t creationDate; /* LH */
- u_int32_t creatorID; /* HL */
- u_int16_t modifyTime; /* LH */
- u_int16_t modifyDate; /* LH */
- u_int32_t modifierID; /* HL */
- u_int16_t lastAccessDate; /* LH */
- u_int16_t archiveTime; /* LH */
- u_int16_t archiveDate; /* LH */
- u_int32_t archiverID; /* HL */
- u_int16_t inheritedRightsMask; /* LH */
- u_int32_t dirEntNum;
- u_int32_t DosDirNum;
- u_int32_t volNumber;
- u_int32_t EADataSize;
- u_int32_t EAKeyCount;
- u_int32_t EAKeySize;
- u_int32_t NSCreator;
- u_int8_t nameLen;
- u_int8_t entryName[256];
-} __packed;
-
-typedef struct nw_entry_info NW_ENTRY_INFO;
-
-/* modify mask - use with MODIFY_DOS_INFO structure */
-#define DM_ATTRIBUTES 0x0002L
-#define DM_CREATE_DATE 0x0004L
-#define DM_CREATE_TIME 0x0008L
-#define DM_CREATOR_ID 0x0010L
-#define DM_ARCHIVE_DATE 0x0020L
-#define DM_ARCHIVE_TIME 0x0040L
-#define DM_ARCHIVER_ID 0x0080L
-#define DM_MODIFY_DATE 0x0100L
-#define DM_MODIFY_TIME 0x0200L
-#define DM_MODIFIER_ID 0x0400L
-#define DM_LAST_ACCESS_DATE 0x0800L
-#define DM_INHERITED_RIGHTS_MASK 0x1000L
-#define DM_MAXIMUM_SPACE 0x2000L
-
-struct nw_modify_dos_info {
- u_int32_t attributes;
- u_int16_t creationDate;
- u_int16_t creationTime;
- u_int32_t creatorID;
- u_int16_t modifyDate;
- u_int16_t modifyTime;
- u_int32_t modifierID;
- u_int16_t archiveDate;
- u_int16_t archiveTime;
- u_int32_t archiverID;
- u_int16_t lastAccessDate;
- u_int16_t inheritanceGrantMask;
- u_int16_t inheritanceRevokeMask;
- u_int32_t maximumSpace;
-} __packed;
-
-struct nw_search_seq {
- u_int8_t volNumber;
- u_int32_t dirNumber;
- u_int32_t searchDirNumber;
-} __packed;
-
-typedef struct nw_search_seq SEARCH_SEQUENCE;
-
-struct ncp_file_server_info {
- u_int8_t ServerName[48];
- u_int8_t FileServiceVersion;
- u_int8_t FileServiceSubVersion;
- u_int16_t MaximumServiceConnections;
- u_int16_t ConnectionsInUse;
- u_int16_t NumberMountedVolumes;
- u_int8_t Revision;
- u_int8_t SFTLevel;
- u_int8_t TTSLevel;
- u_int16_t MaxConnectionsEverUsed;
- u_int8_t AccountVersion;
- u_int8_t VAPVersion;
- u_int8_t QueueVersion;
- u_int8_t PrintVersion;
- u_int8_t VirtualConsoleVersion;
- u_int8_t RestrictionLevel;
- u_int8_t InternetBridge;
- u_int8_t Reserved[60];
-} __packed;
-
-struct nw_time_buffer {
- u_int8_t year;
- u_int8_t month;
- u_int8_t day;
- u_int8_t hour;
- u_int8_t minute;
- u_int8_t second;
- u_int8_t wday;
-} __packed;
-
-#endif /*_NCP_H_ */
diff --git a/sys/netncp/ncp_cfg.h b/sys/netncp/ncp_cfg.h
deleted file mode 100644
index 82a30d7..0000000
--- a/sys/netncp/ncp_cfg.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/*
- * static configuration for libncp
- *
- * $FreeBSD$
- */
-
-#define NCP_NLS_KOI2CP866
-#define NCP_NLS_DEFAULT NCP_NLS_KOI_866
-#define NCP_PREFIX ""
diff --git a/sys/netncp/ncp_conn.c b/sys/netncp/ncp_conn.c
deleted file mode 100644
index 03ef5e3..0000000
--- a/sys/netncp/ncp_conn.c
+++ /dev/null
@@ -1,662 +0,0 @@
-/*-
- * Copyright (c) 1999 Boris Popov
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Connection tables
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/malloc.h>
-#include <sys/priv.h>
-#include <sys/proc.h>
-#include <sys/lock.h>
-#include <sys/sysctl.h>
-
-#include <netncp/ncp.h>
-#include <netncp/nwerror.h>
-#include <netncp/ncp_subr.h>
-#include <netncp/ncp_conn.h>
-#include <netncp/ncp_sock.h>
-#include <netncp/ncp_ncp.h>
-
-SLIST_HEAD(ncp_handle_head,ncp_handle);
-
-int ncp_burst_enabled = 1;
-
-struct ncp_conn_head conn_list={NULL};
-static int ncp_conn_cnt = 0;
-static int ncp_next_ref = 1;
-static struct lock listlock;
-
-struct ncp_handle_head lhlist={NULL};
-static int ncp_next_handle = 1;
-static struct lock lhlock;
-
-static int ncp_sysctl_connstat(SYSCTL_HANDLER_ARGS);
-static int ncp_conn_lock_any(struct ncp_conn *conn, struct thread *td,
- struct ucred *cred);
-
-SYSCTL_DECL(_net_ncp);
-SYSCTL_INT (_net_ncp, OID_AUTO, burst_enabled, CTLFLAG_RD, &ncp_burst_enabled, 0, "");
-SYSCTL_INT (_net_ncp, OID_AUTO, conn_cnt, CTLFLAG_RD, &ncp_conn_cnt, 0, "");
-SYSCTL_PROC(_net_ncp, OID_AUTO, conn_stat, CTLFLAG_RD|CTLTYPE_OPAQUE,
- NULL, 0, ncp_sysctl_connstat, "S,connstat", "Connections list");
-
-MALLOC_DEFINE(M_NCPDATA, "ncp_data", "NCP private data");
-
-int
-ncp_conn_init(void)
-{
- lockinit(&listlock, PSOCK, "ncpll", 0, 0);
- lockinit(&lhlock, PSOCK, "ncplh", 0, 0);
- return 0;
-}
-
-int
-ncp_conn_destroy(void)
-{
- if (ncp_conn_cnt) {
- NCPERROR("There are %d connections active\n", ncp_conn_cnt);
- return EBUSY;
- }
- lockdestroy(&listlock);
- lockdestroy(&lhlock);
- return 0;
-}
-
-int
-ncp_conn_locklist(int flags, struct thread *td)
-{
- return lockmgr(&listlock, flags | LK_CANRECURSE, 0);
-}
-
-void
-ncp_conn_unlocklist(struct thread *td)
-{
- lockmgr(&listlock, LK_RELEASE, 0);
-}
-
-int
-ncp_conn_access(struct ncp_conn *conn, struct ucred *cred, mode_t mode)
-{
- int error;
-
- if (cred == NOCRED || ncp_suser(cred) == 0 ||
- cred->cr_uid == conn->nc_owner->cr_uid)
- return 0;
- mode >>= 3;
- if (!groupmember(conn->nc_group, cred))
- mode >>= 3;
- error = (conn->li.access_mode & mode) == mode ? 0 : EACCES;
- return error;
-}
-
-int
-ncp_conn_lock_any(struct ncp_conn *conn, struct thread *td, struct ucred *cred)
-{
- int error;
-
- if (conn->nc_id == 0) return EACCES;
- error = lockmgr(&conn->nc_lock, LK_EXCLUSIVE | LK_CANRECURSE, 0);
- if (error == ERESTART)
- return EINTR;
- error = ncp_chkintr(conn, td);
- if (error) {
- lockmgr(&conn->nc_lock, LK_RELEASE, 0);
- return error;
- }
-
- if (conn->nc_id == 0) {
- lockmgr(&conn->nc_lock, LK_RELEASE, 0);
- return EACCES;
- }
- conn->td = td; /* who currently operates */
- conn->ucred = cred;
- return 0;
-}
-
-int
-ncp_conn_lock(struct ncp_conn *conn, struct thread *td, struct ucred *cred, int mode)
-{
- int error;
-
- error = ncp_conn_access(conn, cred, mode);
- if (error) return error;
- return ncp_conn_lock_any(conn, td, cred);
-}
-
-/*
- * Lock conn but unlock connlist
- */
-static int
-ncp_conn_lock2(struct ncp_conn *conn, struct thread *td, struct ucred *cred, int mode)
-{
- int error;
-
- error = ncp_conn_access(conn, cred, mode);
- if (error) {
- ncp_conn_unlocklist(td);
- return error;
- }
- conn->nc_lwant++;
- ncp_conn_unlocklist(td);
- error = ncp_conn_lock_any(conn, td, cred);
- conn->nc_lwant--;
- if (conn->nc_lwant == 0) {
- wakeup(&conn->nc_lwant);
- }
- return error;
-}
-
-void
-ncp_conn_unlock(struct ncp_conn *conn, struct thread *td)
-{
- /*
- * note, that LK_RELASE will do wakeup() instead of wakeup_one().
- * this will do a little overhead
- */
- lockmgr(&conn->nc_lock, LK_RELEASE, 0);
-}
-
-int
-ncp_conn_assert_locked(struct ncp_conn *conn, const char *checker, struct thread *td)
-{
- if (lockstatus(&conn->nc_lock) == LK_EXCLUSIVE) return 0;
- printf("%s: connection isn't locked!\n", checker);
- return EIO;
-}
-
-void
-ncp_conn_invalidate(struct ncp_conn *ncp)
-{
- ncp->flags &= ~(NCPFL_ATTACHED | NCPFL_LOGGED | NCPFL_INVALID);
-}
-
-int
-ncp_conn_invalid(struct ncp_conn *ncp)
-{
- return ncp->flags & NCPFL_INVALID;
-}
-
-/*
- * create, fill with defaults and return in locked state
- */
-int
-ncp_conn_alloc(struct ncp_conn_args *cap, struct thread *td, struct ucred *cred,
- struct ncp_conn **conn)
-{
- struct ncp_conn *ncp;
- struct ucred *owner;
- int error, isroot;
-
- if (cap->saddr.sa_family != AF_INET && cap->saddr.sa_family != AF_IPX)
- return EPROTONOSUPPORT;
- /*
- * Only root can change ownership.
- */
- isroot = ncp_suser(cred) == 0;
- if (cap->owner != NCP_DEFAULT_OWNER && !isroot)
- return EPERM;
- if (cap->group != NCP_DEFAULT_GROUP &&
- !groupmember(cap->group, cred) && !isroot)
- return EPERM;
- if (cap->owner != NCP_DEFAULT_OWNER) {
- owner = crget();
- crcopy(owner, cred);
- owner->cr_uid = cap->owner;
- } else
- owner = crhold(cred);
- ncp = malloc(sizeof(struct ncp_conn),
- M_NCPDATA, M_WAITOK | M_ZERO);
- error = 0;
- lockinit(&ncp->nc_lock, PZERO, "ncplck", 0, 0);
- ncp_conn_cnt++;
- ncp->nc_id = ncp_next_ref++;
- ncp->nc_owner = owner;
- ncp->seq = 0;
- ncp->connid = 0xFFFF;
- ncp->li = *cap;
- ncp->nc_group = (cap->group != NCP_DEFAULT_GROUP) ?
- cap->group : cred->cr_groups[0];
-
- if (cap->retry_count == 0)
- ncp->li.retry_count = NCP_RETRY_COUNT;
- if (cap->timeout == 0)
- ncp->li.timeout = NCP_RETRY_TIMEOUT;
- ncp_conn_lock_any(ncp, td, ncp->nc_owner);
- *conn = ncp;
- ncp_conn_locklist(LK_EXCLUSIVE, td);
- SLIST_INSERT_HEAD(&conn_list,ncp,nc_next);
- ncp_conn_unlocklist(td);
- return (error);
-}
-
-/*
- * Remove the connection, on entry it must be locked
- */
-int
-ncp_conn_free(struct ncp_conn *ncp)
-{
- struct thread *td;
- int error;
-
- if (ncp == NULL) {
- NCPFATAL("ncp == NULL\n");
- return 0;
- }
- if (ncp->nc_id == 0) {
- NCPERROR("nc_id == 0\n");
- return EACCES;
- }
- td = ncp->td;
- error = ncp_conn_assert_locked(ncp, __func__, td);
- if (error)
- return error;
- if (ncp->ref_cnt != 0 || (ncp->flags & NCPFL_PERMANENT))
- return EBUSY;
- if (ncp_conn_access(ncp, ncp->ucred, NCPM_WRITE))
- return EACCES;
-
- if (ncp->flags & NCPFL_ATTACHED)
- ncp_ncp_disconnect(ncp);
- ncp_sock_disconnect(ncp);
-
- /*
- * Mark conn as dead and wait for other process
- */
- ncp->nc_id = 0;
- ncp_conn_unlock(ncp, td);
- /*
- * if signal is raised - how I do react ?
- */
- lockmgr(&ncp->nc_lock, LK_DRAIN, 0);
- lockmgr(&ncp->nc_lock, LK_RELEASE, 0);
- lockdestroy(&ncp->nc_lock);
- while (ncp->nc_lwant) {
- printf("lwant = %d\n", ncp->nc_lwant);
- tsleep(&ncp->nc_lwant, PZERO,"ncpdr",2*hz);
- }
- ncp_conn_locklist(LK_EXCLUSIVE, td);
- SLIST_REMOVE(&conn_list, ncp, ncp_conn, nc_next);
- ncp_conn_cnt--;
- ncp_conn_unlocklist(td);
- if (ncp->li.user)
- free(ncp->li.user, M_NCPDATA);
- if (ncp->li.password)
- free(ncp->li.password, M_NCPDATA);
- crfree(ncp->nc_owner);
- free(ncp, M_NCPDATA);
- return (0);
-}
-
-int
-ncp_conn_reconnect(struct ncp_conn *ncp)
-{
- int error;
-
- /*
- * Close opened sockets if any
- */
- ncp_sock_disconnect(ncp);
- error = ncp_sock_connect(ncp);
- if (error)
- return error;
- error = ncp_ncp_connect(ncp);
- if (error)
- return error;
- error = ncp_renegotiate_connparam(ncp, NCP_DEFAULT_BUFSIZE, 0);
- if (error == NWE_SIGNATURE_LEVEL_CONFLICT) {
- printf("Unable to negotiate requested security level\n");
- error = EOPNOTSUPP;
- }
- if (error) {
- ncp_ncp_disconnect(ncp);
- return error;
- }
-#ifdef NCPBURST
- error = ncp_burst_connect(ncp);
- if (error) {
- ncp_ncp_disconnect(ncp);
- return error;
- }
-#endif
- return 0;
-}
-
-int
-ncp_conn_login(struct ncp_conn *conn, struct thread *td, struct ucred *cred)
-{
- struct ncp_bindery_object user;
- u_char ncp_key[8];
- int error;
-
- error = ncp_get_encryption_key(conn, ncp_key);
- if (error) {
- printf("%s: Warning: use unencrypted login\n", __func__);
- error = ncp_login_unencrypted(conn, conn->li.objtype,
- conn->li.user, conn->li.password, td, cred);
- } else {
- error = ncp_get_bindery_object_id(conn, conn->li.objtype,
- conn->li.user, &user, td, cred);
- if (error)
- return error;
- error = ncp_login_encrypted(conn, &user, ncp_key,
- conn->li.password, td, cred);
- }
- if (!error)
- conn->flags |= NCPFL_LOGGED | NCPFL_WASLOGGED;
- return error;
-}
-
-/*
- * Lookup connection by handle, return a locked conn descriptor
- */
-int
-ncp_conn_getbyref(int ref, struct thread *td, struct ucred *cred, int mode,
- struct ncp_conn **connpp)
-{
- struct ncp_conn *ncp;
- int error = 0;
-
- ncp_conn_locklist(LK_SHARED, td);
- SLIST_FOREACH(ncp, &conn_list, nc_next)
- if (ncp->nc_id == ref) break;
- if (ncp == NULL) {
- ncp_conn_unlocklist(td);
- return(EBADF);
- }
- error = ncp_conn_lock2(ncp, td, cred, mode);
- if (!error)
- *connpp = ncp;
- return (error);
-}
-/*
- * find attached, but not logged in connection to specified server
- */
-int
-ncp_conn_getattached(struct ncp_conn_args *li, struct thread *td,
- struct ucred *cred, int mode, struct ncp_conn **connpp)
-{
- struct ncp_conn *ncp, *ncp2 = NULL;
- int error = 0;
-
- ncp_conn_locklist(LK_SHARED, td);
- SLIST_FOREACH(ncp, &conn_list, nc_next) {
- if ((ncp->flags & NCPFL_LOGGED) != 0 ||
- strcmp(ncp->li.server,li->server) != 0 ||
- ncp->li.saddr.sa_len != li->saddr.sa_len ||
- bcmp(&ncp->li.saddr,&ncp->li.saddr,li->saddr.sa_len) != 0)
- continue;
- if (ncp_suser(cred) == 0 ||
- cred->cr_uid == ncp->nc_owner->cr_uid)
- break;
- error = ncp_conn_access(ncp,cred,mode);
- if (!error && ncp2 == NULL)
- ncp2 = ncp;
- }
- if (ncp == NULL) ncp = ncp2;
- if (ncp == NULL) {
- ncp_conn_unlocklist(td);
- return(EBADF);
- }
- error = ncp_conn_lock2(ncp, td, cred, mode);
- if (!error)
- *connpp=ncp;
- return (error);
-}
-
-/*
- * Lookup connection by server/user pair, return a locked conn descriptor.
- * if li is NULL or server/user pair incomplete, try to select best connection
- * based on owner.
- * Connection selected in next order:
- * 1. Try to search conn with ucred owner, if li is NULL also find a primary
- * 2. If 1. fails try to get first suitable shared connection
- * 3. If 2. fails then nothing can help to poor ucred owner
- */
-
-int
-ncp_conn_getbyli(struct ncp_conn_args *li, struct thread *td,
- struct ucred *cred, int mode, struct ncp_conn **connpp)
-{
- struct ncp_conn *ncp, *ncp2 = NULL;
- int error = 0, partial, haveserv;
-
- partial = (li == NULL || li->server[0] == 0 || li->user == NULL);
- haveserv = (li && li->server[0]);
- ncp_conn_locklist(LK_SHARED, td);
- SLIST_FOREACH(ncp, &conn_list, nc_next) {
- if (partial) {
- if (cred->cr_uid == ncp->nc_owner->cr_uid) {
- if (haveserv) {
- if (strcmp(ncp->li.server,li->server) == 0)
- break;
- } else {
- if (ncp->flags & NCPFL_PRIMARY)
- break;
- ncp2 = ncp;
- }
- continue;
- }
- } else {
- if (strcmp(ncp->li.server,li->server) != 0 ||
- ncp->li.user == NULL ||
- strcmp(ncp->li.user,li->user) != 0)
- continue;
- if (cred->cr_uid == ncp->nc_owner->cr_uid)
- break;
- if (ncp_suser(cred) == 0)
- ncp2 = ncp;
- }
- error = ncp_conn_access(ncp,cred,mode);
- if (!error && ncp2 == NULL)
- ncp2 = ncp;
- }
- if (ncp == NULL) ncp = ncp2;
- if (ncp == NULL) {
- ncp_conn_unlocklist(td);
- return(EBADF);
- }
- error = ncp_conn_lock2(ncp, td, cred,mode);
- if (!error)
- *connpp=ncp;
- return (error);
-}
-
-/*
- * Set primary connection flag, since it have sence only for an owner,
- * only owner can modify this flag.
- * connection expected to be locked.
- */
-int
-ncp_conn_setprimary(struct ncp_conn *conn, int on)
-{
- struct ncp_conn *ncp=NULL;
-
- if (conn->ucred->cr_uid != conn->nc_owner->cr_uid)
- return EACCES;
- ncp_conn_locklist(LK_SHARED, conn->td);
- SLIST_FOREACH(ncp, &conn_list, nc_next) {
- if (conn->ucred->cr_uid == ncp->nc_owner->cr_uid)
- ncp->flags &= ~NCPFL_PRIMARY;
- }
- ncp_conn_unlocklist(conn->td);
- if (on)
- conn->flags |= NCPFL_PRIMARY;
- return 0;
-}
-/*
- * Lease conn to given proc, returning unique handle
- * problem: how locks should be applied ?
- */
-int
-ncp_conn_gethandle(struct ncp_conn *conn, struct thread *td, struct ncp_handle **handle)
-{
- struct ncp_handle *refp;
-
- lockmgr(&lhlock, LK_EXCLUSIVE, 0);
- SLIST_FOREACH(refp, &lhlist, nh_next)
- if (refp->nh_conn == conn && td == refp->nh_td) break;
- if (refp) {
- conn->ref_cnt++;
- refp->nh_ref++;
- *handle = refp;
- lockmgr(&lhlock, LK_RELEASE, 0);
- return 0;
- }
- refp = malloc(sizeof(struct ncp_handle),M_NCPDATA,
- M_WAITOK | M_ZERO);
- SLIST_INSERT_HEAD(&lhlist,refp,nh_next);
- refp->nh_ref++;
- refp->nh_td = td;
- refp->nh_conn = conn;
- refp->nh_id = ncp_next_handle++;
- *handle = refp;
- conn->ref_cnt++;
- lockmgr(&lhlock, LK_RELEASE, 0);
- return 0;
-}
-/*
- * release reference, if force - ignore refcount
- */
-int
-ncp_conn_puthandle(struct ncp_handle *handle, struct thread *td, int force)
-{
- struct ncp_handle *refp = handle;
-
- lockmgr(&lhlock, LK_EXCLUSIVE, 0);
- refp->nh_ref--;
- refp->nh_conn->ref_cnt--;
- if (force) {
- refp->nh_conn->ref_cnt -= refp->nh_ref;
- refp->nh_ref = 0;
- }
- if (refp->nh_ref == 0) {
- SLIST_REMOVE(&lhlist, refp, ncp_handle, nh_next);
- free(refp, M_NCPDATA);
- }
- lockmgr(&lhlock, LK_RELEASE, 0);
- return 0;
-}
-/*
- * find a connHandle
- */
-int
-ncp_conn_findhandle(int connHandle, struct thread *td, struct ncp_handle **handle) {
- struct ncp_handle *refp;
-
- lockmgr(&lhlock, LK_SHARED, 0);
- SLIST_FOREACH(refp, &lhlist, nh_next)
- if (refp->nh_td == td && refp->nh_id == connHandle) break;
- lockmgr(&lhlock, LK_RELEASE, 0);
- if (refp == NULL) {
- return EBADF;
- }
- *handle = refp;
- return 0;
-}
-/*
- * Clear handles associated with specified process
- */
-int
-ncp_conn_putprochandles(struct thread *td)
-{
- struct ncp_handle *hp, *nhp;
- int haveone = 0;
-
- lockmgr(&lhlock, LK_EXCLUSIVE, 0);
- for (hp = SLIST_FIRST(&lhlist); hp; hp = nhp) {
- nhp = SLIST_NEXT(hp, nh_next);
- if (hp->nh_td != td) continue;
- haveone = 1;
- hp->nh_conn->ref_cnt -= hp->nh_ref;
- SLIST_REMOVE(&lhlist, hp, ncp_handle, nh_next);
- free(hp, M_NCPDATA);
- }
- lockmgr(&lhlock, LK_RELEASE, 0);
- return haveone;
-}
-/*
- * remove references in all possible connections,
- * XXX - possible problem is a locked list.
- */
-/*void
-ncp_conn_list_rm_ref(pid_t pid) {
- struct ncp_conn *ncp;
-
- ncp_conn_locklist(LK_SHARED, NULL);
- SLIST_FOREACH(ncp, &conn_list, nc_next) {
- ncp_conn_rm_ref(ncp,pid,1);
- }
- ncp_conn_unlocklist(NULL);
- return;
-}
-*/
-int
-ncp_conn_getinfo(struct ncp_conn *ncp, struct ncp_conn_stat *ncs) {
- bzero(ncs,sizeof(*ncs));
- ncs->li = ncp->li;
- ncs->li.user = ncs->user;
- if (ncp->li.user)
- strcpy(ncs->user, ncp->li.user);
- ncs->li.password = NULL;
- ncs->connRef = ncp->nc_id;
- ncs->ref_cnt = ncp->ref_cnt;
- ncs->connid = ncp->connid;
- ncs->owner = ncp->nc_owner->cr_uid;
- ncs->group = ncp->nc_group;
- ncs->flags = ncp->flags;
- ncs->buffer_size = ncp->buffer_size;
- return 0;
-}
-
-static int
-ncp_sysctl_connstat(SYSCTL_HANDLER_ARGS)
-{
- int error;
- struct ncp_conn_stat ncs;
- struct ncp_conn *ncp;
-/* struct ucred *cred = req->td->td_ucred;*/
-
- error = sysctl_wire_old_buffer(req, 0);
- if (error != 0)
- return (error);
- ncp_conn_locklist(LK_SHARED, req->td);
- error = SYSCTL_OUT(req, &ncp_conn_cnt, sizeof(ncp_conn_cnt));
- SLIST_FOREACH(ncp, &conn_list, nc_next) {
- if (error) break;
- /* I can't do conn_lock while list is locked */
- ncp->nc_lwant++;
- ncp_conn_getinfo(ncp, &ncs);
- ncp->nc_lwant--;
- error = SYSCTL_OUT(req, &ncs, sizeof(ncs));
- }
- ncp_conn_unlocklist(req->td);
- return(error);
-}
diff --git a/sys/netncp/ncp_conn.h b/sys/netncp/ncp_conn.h
deleted file mode 100644
index 0a87051..0000000
--- a/sys/netncp/ncp_conn.h
+++ /dev/null
@@ -1,229 +0,0 @@
-/*-
- * Copyright (c) 1999 Boris Popov
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-#ifndef _NETNCP_NCP_CONN_H_
-#define _NETNCP_NCP_CONN_H_
-
-#ifndef _NETINET_IN_H_
-#include <netinet/in.h>
-#endif
-
-#ifndef _NETIPX_IPX_H_
-#include <netipx/ipx.h>
-#endif
-
-#ifndef _SYS_SOCKET_H_
-#include <sys/socket.h>
-#endif
-
-/* type of transport we use */
-/*#define NCP_ON_IPX 0
-#define NCP_ON_TCP 1*/
-
-/* flags field in conn structure */
-#define NCPFL_SOCONN 0x0001 /* socket layer is up */
-#define NCPFL_ATTACHED 0x0002 /* ncp layer is up */
-#define NCPFL_LOGGED 0x0004 /* logged in to server */
-#define NCPFL_INVALID 0x0008 /* last request was not completed */
-#define NCPFL_INTR 0x0010 /* interrupted call */
-#define NCPFL_RESTORING 0x0020 /* trying to reconnect */
-#define NCPFL_PERMANENT 0x0040 /* no way to kill conn, when this set */
-#define NCPFL_PRIMARY 0x0080 /* have meaning only for owner */
-#define NCPFL_WASATTACHED 0x0100 /* there was at least one successfull connect */
-#define NCPFL_WASLOGGED 0x0200 /* there was at least one successfull login */
-#define NCPFL_SIGNACTIVE 0x1000 /* packet signing active */
-#define NCPFL_SIGNWANTED 0x2000 /* signing should start */
-
-/* access mode for connection */
-#define NCPM_READ 0400 /* able to fetch conn params */
-#define NCPM_WRITE 0200 /* modify/close */
-#define NCPM_EXECUTE 0100 /* run requests */
-
-#define NCP_DEFAULT_OWNER ((uid_t)-1)
-#define NCP_DEFAULT_GROUP ((uid_t)-1)
-
-
-/* args used to create connection */
-#define ncp_conn_loginfo ncp_conn_args
-struct ncp_conn_args {
- int opt;
-#define NCP_OPT_WDOG 1 /* need watch dog socket */
-#define NCP_OPT_MSG 2 /* need message socket */
-#define NCP_OPT_SIGN 4 /* signatures wanted */
-#define NCP_OPT_BIND 8 /* force bindery login */
-#define NCP_OPT_PERMANENT 0x10 /* only for refernce, completly ignored */
-#define NCP_OPT_NOUPCASEPASS 0x20 /* leave password as is */
- int sig_level; /* wanted signature level */
- char server[NCP_BINDERY_NAME_LEN+1];
- char *user;
- char *password;
- u_int32_t objtype;
- union {
- struct sockaddr addr;
- struct sockaddr_ipx ipxaddr;
- struct sockaddr_in inaddr;
- } addr;
- int timeout; /* ncp rq timeout */
- int retry_count; /* counts to give an error */
- uid_t owner; /* proposed owner of connection */
- gid_t group; /* proposed group of connection */
- mode_t access_mode; /* R/W - can do rq's, X - can see the conn */
-};
-
-#define ipxaddr addr.ipxaddr
-#define inaddr addr.inaddr
-#define saddr addr.addr
-
-/* user side structure to issue ncp calls */
-struct ncp_buf {
- int rqsize; /* request size without ncp header */
- int rpsize; /* reply size minus ncp header */
- int cc; /* completion code */
- int cs; /* connection state */
- char packet[NCP_MAX_PACKET_SIZE];/* Here we prepare requests and receive replies */
-};
-
-/*
- * Connection status, returned via sysctl(vfs.nwfs.connstat)
- */
-struct ncp_conn_stat {
- struct ncp_conn_args li;
- int connRef;
- int ref_cnt;
- int connid;
- int buffer_size;
- int flags;
- int sign_active;
- uid_t owner;
- gid_t group;
- char user[NCP_MAXUSERNAMELEN+1];
-};
-
-#ifdef _KERNEL
-
-#ifndef LK_SHARED
-#include <sys/lock.h>
-#include <sys/lockmgr.h>
-#endif
-
-struct socket;
-struct u_cred;
-
-SLIST_HEAD(ncp_conn_head,ncp_conn);
-
-struct ncp_rq;
-struct ncp_conn;
-
-/*
- * External and internal processes can reference connection only by handle.
- * This gives us a freedom in maintance of underlying connections.
- */
-struct ncp_handle {
- SLIST_ENTRY(ncp_handle) nh_next;
- int nh_id; /* handle id */
- struct ncp_conn*nh_conn; /* which conn we are refernce */
- struct thread * nh_td; /* who owns the handle */
- int nh_ref; /* one process can asquire many handles, but we return the one */
-};
-
-/*
- * Describes any connection to server
- */
-struct ncp_conn {
- SLIST_ENTRY(ncp_conn) nc_next;
- struct ncp_conn_args li;
- struct ucred *nc_owner;
- gid_t nc_group;
- int flags;
- int nc_id;
- struct socket *ncp_so;
- struct socket *wdg_so;
- struct socket *msg_so;
- struct socket *bc_so;
- int ref_cnt; /* how many handles leased */
- SLIST_HEAD(ncp_ref_hd,ncp_ref) ref_list;/* list of handles */
- struct lock nc_lock; /* excl locks */
- int nc_lwant; /* number of wanted locks */
- struct thread *td; /* pid currently operates */
- struct ucred *ucred; /* usr currently operates */
- /* Fields used to process ncp requests */
- int connid; /* assigned by server */
- u_int8_t seq;
- int buffer_size; /* Negotiated bufsize */
- /* Fields used to make packet signatures */
- u_int32_t sign_root[2];
- u_int32_t sign_state[4]; /* md4 state */
-#ifdef NCPBURST
- /* Fields used for packet bursting */
- u_long bc_pktseq; /* raw packet sequence */
- u_short bc_seq; /* burst sequence */
- u_long bc_locid; /* local connection id */
- u_long bc_remid; /* remote connection id */
- u_long bc_pktsize; /* negotiated burst packet size */
-#endif
-};
-
-int ncp_conn_init(void);
-int ncp_conn_destroy(void);
-int ncp_conn_alloc(struct ncp_conn_args *cap,
- struct thread *td, struct ucred *cred, struct ncp_conn **connid);
-int ncp_conn_free(struct ncp_conn *conn);
-int ncp_conn_access(struct ncp_conn *conn,struct ucred *cred,mode_t mode);
-int ncp_conn_lock(struct ncp_conn *conn,struct thread *td, struct ucred *cred,int mode);
-void ncp_conn_unlock(struct ncp_conn *conn,struct thread *td);
-int ncp_conn_assert_locked(struct ncp_conn *conn,const char *checker,struct thread *td);
-void ncp_conn_invalidate(struct ncp_conn *ncp);
-int ncp_conn_invalid(struct ncp_conn *ncp);
-/*int ncp_conn_ref(struct ncp_conn *conn, pid_t pid);
-int ncp_conn_rm_ref(struct ncp_conn *conn, pid_t pid, int force);
-void ncp_conn_list_rm_ref(pid_t pid);*/
-int ncp_conn_getbyref(int connRef,struct thread *td, struct ucred *cred, int mode,
- struct ncp_conn **connpp);
-int ncp_conn_getbyli(struct ncp_conn_loginfo *li,struct thread *td, struct ucred *cred,
- int mode, struct ncp_conn **connpp);
-int ncp_conn_setprimary(struct ncp_conn *conn, int on);
-int ncp_conn_locklist(int flags, struct thread *td);
-void ncp_conn_unlocklist(struct thread *td);
-int ncp_conn_gethandle(struct ncp_conn *conn, struct thread *td, struct ncp_handle **handle);
-int ncp_conn_puthandle(struct ncp_handle *handle, struct thread *td, int force);
-int ncp_conn_findhandle(int connHandle, struct thread *td, struct ncp_handle **handle);
-int ncp_conn_getattached(struct ncp_conn_args *li,struct thread *td, struct ucred *cred,int mode, struct ncp_conn **connpp);
-int ncp_conn_putprochandles(struct thread *td);
-int ncp_conn_getinfo(struct ncp_conn *ncp, struct ncp_conn_stat *ncs);
-
-int ncp_conn_reconnect(struct ncp_conn *ncp);
-int ncp_conn_login(struct ncp_conn *conn, struct thread *td, struct ucred *cred);
-
-extern struct ncp_conn_head conn_list;
-extern int ncp_burst_enabled;
-
-#ifdef MALLOC_DECLARE
-MALLOC_DECLARE(M_NCPDATA);
-#endif
-
-#endif /* _KERNEL */
-#endif /* _NCP_CONN_H_ */
diff --git a/sys/netncp/ncp_crypt.c b/sys/netncp/ncp_crypt.c
deleted file mode 100644
index 9899ef6..0000000
--- a/sys/netncp/ncp_crypt.c
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
- * Routines in this file based on work of Volker Lendecke
- */
-/*$*********************************************************
- $*
- $* This code has been taken from DDJ 11/93, from an
- $* article by Pawel Szczerbina.
- $*
- $* Password encryption routines follow.
- $* Converted to C from Barry Nance's Pascal
- $* prog published in the March -93 issue of Byte.
- $*
- $* Adapted to be useable for ncpfs by
- $* Volker Lendecke <lendecke@namu01.gwdg.de> in
- $* October 1995.
- $*
- $********************************************************* */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <netncp/ncp.h>
-#include <netncp/ncp_subr.h>
-
-typedef unsigned char buf32[32];
-
-static unsigned char encrypttable[256] = {
-0x7, 0x8, 0x0, 0x8, 0x6, 0x4, 0xE, 0x4, 0x5, 0xC, 0x1, 0x7, 0xB, 0xF, 0xA, 0x8,
-0xF, 0x8, 0xC, 0xC, 0x9, 0x4, 0x1, 0xE, 0x4, 0x6, 0x2, 0x4, 0x0, 0xA, 0xB, 0x9,
-0x2, 0xF, 0xB, 0x1, 0xD, 0x2, 0x1, 0x9, 0x5, 0xE, 0x7, 0x0, 0x0, 0x2, 0x6, 0x6,
-0x0, 0x7, 0x3, 0x8, 0x2, 0x9, 0x3, 0xF, 0x7, 0xF, 0xC, 0xF, 0x6, 0x4, 0xA, 0x0,
-0x2, 0x3, 0xA, 0xB, 0xD, 0x8, 0x3, 0xA, 0x1, 0x7, 0xC, 0xF, 0x1, 0x8, 0x9, 0xD,
-0x9, 0x1, 0x9, 0x4, 0xE, 0x4, 0xC, 0x5, 0x5, 0xC, 0x8, 0xB, 0x2, 0x3, 0x9, 0xE,
-0x7, 0x7, 0x6, 0x9, 0xE, 0xF, 0xC, 0x8, 0xD, 0x1, 0xA, 0x6, 0xE, 0xD, 0x0, 0x7,
-0x7, 0xA, 0x0, 0x1, 0xF, 0x5, 0x4, 0xB, 0x7, 0xB, 0xE, 0xC, 0x9, 0x5, 0xD, 0x1,
-0xB, 0xD, 0x1, 0x3, 0x5, 0xD, 0xE, 0x6, 0x3, 0x0, 0xB, 0xB, 0xF, 0x3, 0x6, 0x4,
-0x9, 0xD, 0xA, 0x3, 0x1, 0x4, 0x9, 0x4, 0x8, 0x3, 0xB, 0xE, 0x5, 0x0, 0x5, 0x2,
-0xC, 0xB, 0xD, 0x5, 0xD, 0x5, 0xD, 0x2, 0xD, 0x9, 0xA, 0xC, 0xA, 0x0, 0xB, 0x3,
-0x5, 0x3, 0x6, 0x9, 0x5, 0x1, 0xE, 0xE, 0x0, 0xE, 0x8, 0x2, 0xD, 0x2, 0x2, 0x0,
-0x4, 0xF, 0x8, 0x5, 0x9, 0x6, 0x8, 0x6, 0xB, 0xA, 0xB, 0xF, 0x0, 0x7, 0x2, 0x8,
-0xC, 0x7, 0x3, 0xA, 0x1, 0x4, 0x2, 0x5, 0xF, 0x7, 0xA, 0xC, 0xE, 0x5, 0x9, 0x3,
-0xE, 0x7, 0x1, 0x2, 0xE, 0x1, 0xF, 0x4, 0xA, 0x6, 0xC, 0x6, 0xF, 0x4, 0x3, 0x0,
-0xC, 0x0, 0x3, 0x6, 0xF, 0x8, 0x7, 0xB, 0x2, 0xD, 0xC, 0x6, 0xA, 0xA, 0x8, 0xD
-};
-
-static buf32 encryptkeys = {
- 0x48, 0x93, 0x46, 0x67, 0x98, 0x3D, 0xE6, 0x8D,
- 0xB7, 0x10, 0x7A, 0x26, 0x5A, 0xB9, 0xB1, 0x35,
- 0x6B, 0x0F, 0xD5, 0x70, 0xAE, 0xFB, 0xAD, 0x11,
- 0xF4, 0x47, 0xDC, 0xA7, 0xEC, 0xCF, 0x50, 0xC0
-};
-
-/*
- * Create table-based 16-bytes hash from a 32-bytes array
- */
-static void
-nw_hash(buf32 temp, unsigned char *target) {
- short sum;
- unsigned char b3;
- int s, b2, i;
-
- sum = 0;
-
- for (b2 = 0; b2 <= 1; ++b2) {
- for (s = 0; s <= 31; ++s) {
- b3 = (temp[s] + sum) ^ (temp[(s + sum) & 31] - encryptkeys[s]);
- sum += b3;
- temp[s] = b3;
- }
- }
-
- for (i = 0; i <= 15; ++i) {
- target[i] = encrypttable[temp[2 * i]]
- | (encrypttable[temp[2 * i + 1]] << 4);
- }
-}
-
-
-/*
- * Create a 16-bytes pattern from given buffer based on a four bytes key
- */
-void
-nw_keyhash(const u_char *key, const u_char *buf, int buflen, u_char *target) {
- int b2, d, s;
- buf32 temp;
-
- while (buflen > 0 && buf[buflen - 1] == 0)
- buflen--;
-
- bzero(temp, sizeof(temp));
-
- d = 0;
- while (buflen >= 32) {
- for (s = 0; s <= 31; ++s)
- temp[s] ^= buf[d++];
- buflen -= 32;
- }
- b2 = d;
- if (buflen > 0) {
- for (s = 0; s <= 31; ++s) {
- if (d + buflen == b2) {
- temp[s] ^= encryptkeys[s];
- b2 = d;
- } else
- temp[s] ^= buf[b2++];
- }
- }
- for (s = 0; s <= 31; ++s)
- temp[s] ^= key[s & 3];
-
- nw_hash(temp, target);
-}
-
-/*
- * Create an 8-bytes pattern from an 8-bytes key and 16-bytes of data
- */
-void
-nw_encrypt(const u_char *fra, const u_char *buf, u_char *target) {
- buf32 k;
- int s;
-
- nw_keyhash(fra, buf, 16, k);
- nw_keyhash(fra + 4, buf, 16, k + 16);
-
- for (s = 0; s < 16; s++)
- k[s] ^= k[31 - s];
-
- for (s = 0; s < 8; s++)
- *target++ = k[s] ^ k[15 - s];
-}
-
-#ifdef _KERNEL
-/*
- * MD4 routine taken from libmd sources
- */
-typedef u_int32_t UINT4;
-typedef unsigned char *POINTER;
-
-#define PROTO_LIST(list) list
-
-static void Decode PROTO_LIST
- ((UINT4 *, const unsigned char *, unsigned int));
-
-/* Constants for MD4Transform routine.
- */
-#define S11 3
-#define S12 7
-#define S13 11
-#define S14 19
-#define S21 3
-#define S22 5
-#define S23 9
-#define S24 13
-#define S31 3
-#define S32 9
-#define S33 11
-#define S34 15
-
-/* F, G and H are basic MD4 functions.
- */
-#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
-#define G(x, y, z) (((x) & (y)) | ((x) & (z)) | ((y) & (z)))
-#define H(x, y, z) ((x) ^ (y) ^ (z))
-
-/* ROTATE_LEFT rotates x left n bits.
- */
-#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
-
-/* FF, GG and HH are transformations for rounds 1, 2 and 3 */
-/* Rotation is separate from addition to prevent recomputation */
-#define FF(a, b, c, d, x, s) { \
- (a) += F ((b), (c), (d)) + (x); \
- (a) = ROTATE_LEFT ((a), (s)); \
- }
-#define GG(a, b, c, d, x, s) { \
- (a) += G ((b), (c), (d)) + (x) + (UINT4)0x5a827999; \
- (a) = ROTATE_LEFT ((a), (s)); \
- }
-#define HH(a, b, c, d, x, s) { \
- (a) += H ((b), (c), (d)) + (x) + (UINT4)0x6ed9eba1; \
- (a) = ROTATE_LEFT ((a), (s)); \
- }
-
-void
-ncp_sign(const u_int32_t *state, const char *block, u_int32_t *ostate) {
- UINT4 a, b, c, d, x[16];
-
- Decode (x, block, 64);
- a = state[0];
- b = state[1];
- c = state[2];
- d = state[3];
- /* Round 1 */
- FF (a, b, c, d, x[ 0], S11); /* 1 */
- FF (d, a, b, c, x[ 1], S12); /* 2 */
- FF (c, d, a, b, x[ 2], S13); /* 3 */
- FF (b, c, d, a, x[ 3], S14); /* 4 */
- FF (a, b, c, d, x[ 4], S11); /* 5 */
- FF (d, a, b, c, x[ 5], S12); /* 6 */
- FF (c, d, a, b, x[ 6], S13); /* 7 */
- FF (b, c, d, a, x[ 7], S14); /* 8 */
- FF (a, b, c, d, x[ 8], S11); /* 9 */
- FF (d, a, b, c, x[ 9], S12); /* 10 */
- FF (c, d, a, b, x[10], S13); /* 11 */
- FF (b, c, d, a, x[11], S14); /* 12 */
- FF (a, b, c, d, x[12], S11); /* 13 */
- FF (d, a, b, c, x[13], S12); /* 14 */
- FF (c, d, a, b, x[14], S13); /* 15 */
- FF (b, c, d, a, x[15], S14); /* 16 */
-
- /* Round 2 */
- GG (a, b, c, d, x[ 0], S21); /* 17 */
- GG (d, a, b, c, x[ 4], S22); /* 18 */
- GG (c, d, a, b, x[ 8], S23); /* 19 */
- GG (b, c, d, a, x[12], S24); /* 20 */
- GG (a, b, c, d, x[ 1], S21); /* 21 */
- GG (d, a, b, c, x[ 5], S22); /* 22 */
- GG (c, d, a, b, x[ 9], S23); /* 23 */
- GG (b, c, d, a, x[13], S24); /* 24 */
- GG (a, b, c, d, x[ 2], S21); /* 25 */
- GG (d, a, b, c, x[ 6], S22); /* 26 */
- GG (c, d, a, b, x[10], S23); /* 27 */
- GG (b, c, d, a, x[14], S24); /* 28 */
- GG (a, b, c, d, x[ 3], S21); /* 29 */
- GG (d, a, b, c, x[ 7], S22); /* 30 */
- GG (c, d, a, b, x[11], S23); /* 31 */
- GG (b, c, d, a, x[15], S24); /* 32 */
-
- /* Round 3 */
- HH (a, b, c, d, x[ 0], S31); /* 33 */
- HH (d, a, b, c, x[ 8], S32); /* 34 */
- HH (c, d, a, b, x[ 4], S33); /* 35 */
- HH (b, c, d, a, x[12], S34); /* 36 */
- HH (a, b, c, d, x[ 2], S31); /* 37 */
- HH (d, a, b, c, x[10], S32); /* 38 */
- HH (c, d, a, b, x[ 6], S33); /* 39 */
- HH (b, c, d, a, x[14], S34); /* 40 */
- HH (a, b, c, d, x[ 1], S31); /* 41 */
- HH (d, a, b, c, x[ 9], S32); /* 42 */
- HH (c, d, a, b, x[ 5], S33); /* 43 */
- HH (b, c, d, a, x[13], S34); /* 44 */
- HH (a, b, c, d, x[ 3], S31); /* 45 */
- HH (d, a, b, c, x[11], S32); /* 46 */
- HH (c, d, a, b, x[ 7], S33); /* 47 */
- HH (b, c, d, a, x[15], S34); /* 48 */
-
- ostate[0] = state[0] + a;
- ostate[1] = state[1] + b;
- ostate[2] = state[2] + c;
- ostate[3] = state[3] + d;
-}
-
-/* Decodes input (unsigned char) into output (UINT4). Assumes len is
- a multiple of 4.
- */
-static void Decode (output, input, len)
-
-UINT4 *output;
-const unsigned char *input;
-unsigned int len;
-{
- unsigned int i, j;
-
- for (i = 0, j = 0; j < len; i++, j += 4)
- output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) |
- (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24);
-}
-
-#endif /* _KERNEL */
diff --git a/sys/netncp/ncp_file.h b/sys/netncp/ncp_file.h
deleted file mode 100644
index 207a158..0000000
--- a/sys/netncp/ncp_file.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*-
- * Copyright (c) 1999 Boris Popov
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#ifndef _NETNCP_NCP_FILE_H_
-#define _NETNCP_NCP_FILE_H_
-
-typedef struct {
- nuint32 sequence;
- nuint32 parent;
- nuint32 attributes;
- nuint8 uniqueID;
- nuint8 flags;
- nuint8 nameSpace;
- nuint8 nameLength;
- nuint8 name [256];
- nuint32 creationDateAndTime;
- nuint32 ownerID;
- nuint32 lastArchiveDateAndTime;
- nuint32 lastArchiverID;
- nuint32 updateDateAndTime;
- nuint32 updatorID;
- nuint32 fileSize;
- nuint8 reserved[44];
- nuint16 inheritedRightsMask;
- nuint16 lastAccessDate;
- nuint32 deletedTime;
- nuint32 deletedDateAndTime;
- nuint32 deletorID;
- nuint8 reserved3 [16];
-} __packed NWDELETED_INFO;
-
-__BEGIN_DECLS
-
-int ncp_AllocTempDirHandle(char *, NWDIR_HANDLE *);
-int ncp_DeallocateDirHandle(NWDIR_HANDLE);
-int ncp_GetNSEntryInfo(NWDIR_HANDLE, struct nw_entry_info *, int *);
-
-NWCCODE ncp_ScanNSEntryInfo(NWCONN_HANDLE, nuint8, nuint16,
- SEARCH_SEQUENCE *, pnstr8, nuint32, NW_ENTRY_INFO *);
-
-NWCCODE ncp_PurgeDeletedFile(NWCONN_HANDLE, nuint32, nuint32, nuint32, nuint8);
-
-NWCCODE NWRecoverDeletedFile(NWCONN_HANDLE, NWDIR_HANDLE,
- nuint32, nuint32, nuint32, pnstr8, pnstr8);
-
-NWCCODE ncp_ScanForDeletedFiles(NWCONN_HANDLE, pnuint32, pnuint32, pnuint32,
- nuint8, NWDELETED_INFO *);
-
-__END_DECLS
-
-#endif /* _NCP_NCP_FILE_ */
diff --git a/sys/netncp/ncp_lib.h b/sys/netncp/ncp_lib.h
deleted file mode 100644
index 275b53b..0000000
--- a/sys/netncp/ncp_lib.h
+++ /dev/null
@@ -1,246 +0,0 @@
-/*-
- * Copyright (c) 1999, 2000, 2001 Boris Popov
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#ifndef _NETNCP_NCP_LIB_H_
-#define _NETNCP_NCP_LIB_H_
-
-#define IPX
-#define INET
-
-#include <netncp/ncp.h>
-#include <netncp/ncp_conn.h>
-#include <netncp/ncp_user.h>
-#include <netncp/ncp_rq.h>
-
-#define ncp_printf printf
-
-#define sipx_cnetwork sipx_addr.x_net.c_net
-#define sipx_node sipx_addr.x_host.c_host
-#define ipx_netlong(iaddr) (((union ipx_net_u *)(&((iaddr).x_net)))->long_e)
-
-#define STDPARAM_ARGS 'A':case 'B':case 'C':case 'I':case 'M': \
- case 'N':case 'U':case 'R':case 'S':case 'T': \
- case 'W':case 'O':case 'P'
-
-#define STDPARAM_OPT "A:BCI:M:NO:P:U:R:S:T:W:"
-
-#ifndef min
-#define min(a,b) (((a)<(b)) ? (a) : (b))
-#endif
-
-
-/*
- * An attempt to do a unified options parser
- */
-enum ncp_argtype {NCA_STR,NCA_INT,NCA_BOOL};
-
-struct ncp_args;
-
-typedef int ncp_setopt_t (struct ncp_args*);
-
-#define NAFL_NONE 0x0000
-#define NAFL_HAVEMIN 0x0001
-#define NAFL_HAVEMAX 0x0002
-#define NAFL_MINMAX NAFL_HAVEMIN | NAFL_HAVEMAX
-
-struct ncp_args {
- enum ncp_argtype at;
- int opt; /* command line option */
- char *name; /* rc file equiv */
- int flag; /* NAFL_* */
- int ival; /* int/bool values, or max len for str value */
- char *str; /* string value */
- int min; /* min for ival */
- int max; /* max for ival */
- ncp_setopt_t *fn;/* call back to validate */
-};
-
-typedef struct {
- nuint8 day;
- nuint8 month;
- nuint16 year;
-} NW_DATE;
-
-/* hours is a nuint16 so that this structure will be the same length as a dword */
-typedef struct {
- nuint8 seconds;
- nuint8 minutes;
- nuint16 hours;
-} NW_TIME;
-
-struct ncp_bitname {
- u_int bn_bit;
- const char *bn_name;
-};
-
-__BEGIN_DECLS
-
-int ncp_args_parserc(struct ncp_args *, char *, ncp_setopt_t *);
-int ncp_args_parseopt(struct ncp_args *, int, char *, ncp_setopt_t *);
-
-
-struct sockaddr_ipx;
-struct ipx_addr;
-struct sockaddr;
-struct ncp_buf;
-struct rcfile;
-
-int ncp_initlib(void);
-int ncp_connect(struct ncp_conn_args *, int *);
-int ncp_connect_addr(struct sockaddr *, NWCONN_HANDLE *);
-int ncp_disconnect(int);
-int ncp_request(int, int, struct ncp_buf *);
-int ncp_conn_request(int, struct ncp_buf *);
-int ncp_login(int, const char *, int, const char *);
-int ncp_conn_scan(struct ncp_conn_loginfo *, int *);
-int ncp_conn_cnt(void);
-void *ncp_conn_list(void);
-int ncp_conn_getinfo(int, struct ncp_conn_stat *);
-int ncp_conn_getuser(int, char **);
-int ncp_conn2ref(int, int *);
-int ncp_conn_dup(NWCONN_HANDLE, NWCONN_HANDLE *);
-int ncp_path2conn(char *, int *);
-int ncp_li_init(struct ncp_conn_loginfo *, int, char *[]);
-void ncp_li_done(struct ncp_conn_loginfo *);
-int ncp_li_login(struct ncp_conn_loginfo *, int *);
-int ncp_li_readrc(struct ncp_conn_loginfo *);
-int ncp_li_check(struct ncp_conn_loginfo *);
-int ncp_li_arg(struct ncp_conn_loginfo *, int, char *);
-int ncp_li_setserver(struct ncp_conn_loginfo *, const char *);
-int ncp_li_setuser(struct ncp_conn_loginfo *, char *);
-int ncp_li_setpassword(struct ncp_conn_loginfo *, const char *);
-int ncp_conn_setflags(int, u_int16_t, u_int16_t);
-int ncp_conn_find(char *, char *);
-NWCCODE NWRequest(NWCONN_HANDLE, nuint16, nuint16, NW_FRAGMENT *,
- nuint16, NW_FRAGMENT *);
-
-#define ncp_setpermanent(connHandle,on) ncp_conn_setflags(connHandle, NCPFL_PERMANENT, (on) ? NCPFL_PERMANENT : 0)
-#define ncp_setprimary(connHandle,on) ncp_conn_setflags(connHandle, NCPFL_PRIMARY, (on) ? NCPFL_PRIMARY : 0)
-
-int ncp_find_fileserver(struct ncp_conn_loginfo *, int, char *);
-int ncp_find_server(struct ncp_conn_loginfo *, int, int, char *);
-
-/* misc rotines */
-char* ncp_str_upper(char *);
-int ncp_open_rcfile(void);
-int ncp_getopt(int, char * const *, const char *);
-void NWUnpackDateTime(nuint32, NW_DATE *, NW_TIME *);
-void NWUnpackDate(nuint16, NW_DATE *);
-void NWUnpackTime(nuint16, NW_TIME *);
-time_t ncp_UnpackDateTime(nuint32);
-int ncp_GetFileServerDateAndTime(NWCONN_HANDLE, time_t *);
-int ncp_SetFileServerDateAndTime(NWCONN_HANDLE, time_t *);
-NWCCODE NWDownFileServer(NWCONN_HANDLE, int);
-NWCCODE NWCloseBindery(NWCONN_HANDLE);
-NWCCODE NWOpenBindery(NWCONN_HANDLE);
-NWCCODE NWDisableTTS(NWCONN_HANDLE);
-NWCCODE NWEnableTTS(NWCONN_HANDLE);
-NWCCODE NWDisableFileServerLogin(NWCONN_HANDLE);
-NWCCODE NWEnableFileServerLogin(NWCONN_HANDLE);
-void ncp_error(const char *, int, ...) __printf0like(1, 3);
-char *ncp_printb(char *, int, const struct ncp_bitname *);
-void nw_keyhash(const u_char *, const u_char *, int, u_char *);
-void nw_encrypt(const u_char *, const u_char *, u_char *);
-void ipx_print_addr(struct ipx_addr *);
-
-/* bindery calls */
-int ncp_get_bindery_object_id(NWCONN_HANDLE, u_int16_t, const char *,
- struct ncp_bindery_object *);
-int ncp_get_bindery_object_name(NWCONN_HANDLE, u_int32_t,
- struct ncp_bindery_object *);
-int ncp_scan_bindery_object(NWCONN_HANDLE, u_int32_t, u_int16_t,
- const char *, struct ncp_bindery_object *);
-int ncp_read_property_value(NWCONN_HANDLE, int object_type, const char *,
- int, const char *, struct nw_property *);
-int ncp_get_encryption_key(NWCONN_HANDLE, char *);
-int ncp_change_obj_passwd(NWCONN_HANDLE,
- const struct ncp_bindery_object *, const u_char *,
- const u_char *, const u_char *);
-int ncp_keyed_verify_password(NWCONN_HANDLE, char *, char *,
- struct ncp_bindery_object *);
-
-/* queue calls */
-int ncp_create_queue_job_and_file(NWCONN_HANDLE, u_int32_t, struct queue_job *);
-int ncp_close_file_and_start_job(NWCONN_HANDLE, u_int32_t, struct queue_job *);
-int ncp_attach_to_queue(NWCONN_HANDLE, u_int32_t);
-int ncp_detach_from_queue(NWCONN_HANDLE, u_int32_t);
-int ncp_service_queue_job(NWCONN_HANDLE, u_int32_t, u_int16_t,
- struct queue_job *);
-int ncp_finish_servicing_job(NWCONN_HANDLE, u_int32_t, u_int32_t, u_int32_t);
-int ncp_abort_servicing_job(NWCONN_HANDLE, u_int32_t, u_int32_t);
-int ncp_get_queue_length(NWCONN_HANDLE, u_int32_t, u_int32_t *);
-int ncp_get_queue_job_ids(NWCONN_HANDLE, u_int32_t, u_int32_t,
- u_int32_t *, u_int32_t *, u_int32_t []);
-int ncp_get_queue_job_info(NWCONN_HANDLE, u_int32_t, u_int32_t,
- struct nw_queue_job_entry *);
-/*
- * filesystem and volume calls
- */
-int ncp_read(NWCONN_HANDLE, ncp_fh *, off_t, size_t, char *);
-int ncp_write(NWCONN_HANDLE, ncp_fh *, off_t, size_t, char *);
-int ncp_geteinfo(char *, struct nw_entry_info *);
-int ncp_NSEntryInfo(NWCONN_HANDLE, nuint8, nuint8, nuint32, NW_ENTRY_INFO *);
-
-NWCCODE NWGetVolumeName(NWCONN_HANDLE, u_char, char *);
-
-/* misc ncp calls */
-int ncp_get_file_server_information(NWCONN_HANDLE, struct ncp_file_server_info *);
-int ncp_get_stations_logged_info(NWCONN_HANDLE, u_int32_t,
- struct ncp_bindery_object *, time_t *);
-int ncp_get_internet_address(NWCONN_HANDLE, u_int32_t, struct ipx_addr *,
- u_int8_t *);
-NWCCODE NWGetObjectConnectionNumbers(NWCONN_HANDLE, pnstr8, nuint16,
- pnuint16, pnuint16, nuint16);
-/*
- * Message broadcast
- */
-NWCCODE NWDisableBroadcasts(NWCONN_HANDLE);
-NWCCODE NWEnableBroadcasts(NWCONN_HANDLE);
-NWCCODE NWBroadcastToConsole(NWCONN_HANDLE, pnstr8);
-NWCCODE NWSendBroadcastMessage(NWCONN_HANDLE, pnstr8, nuint16, pnuint16, pnuint8);
-NWCCODE NWGetBroadcastMessage(NWCONN_HANDLE, pnstr8);
-
-/*
- * RPC calls
- */
-NWCCODE NWSMExecuteNCFFile(NWCONN_HANDLE, pnstr8);
-NWCCODE NWSMLoadNLM(NWCONN_HANDLE, pnstr8);
-NWCCODE NWSMUnloadNLM(NWCONN_HANDLE, pnstr8);
-NWCCODE NWSMMountVolume(NWCONN_HANDLE, pnstr8, nuint32 *);
-NWCCODE NWSMDismountVolumeByName(NWCONN_HANDLE, pnstr8);
-NWCCODE NWSMSetDynamicCmdIntValue(NWCONN_HANDLE, pnstr8, nuint32);
-NWCCODE NWSMSetDynamicCmdStrValue(NWCONN_HANDLE, pnstr8, pnstr8);
-
-__END_DECLS
-
-extern int ncp_opterr, ncp_optind, ncp_optopt, ncp_optreset;
-extern char *ncp_optarg;
-
-extern struct rcfile *ncp_rc;
-extern int sysentoffset;
-#endif /* _NETNCP_NCP_LIB_H_ */
diff --git a/sys/netncp/ncp_login.c b/sys/netncp/ncp_login.c
deleted file mode 100644
index bce8e68..0000000
--- a/sys/netncp/ncp_login.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*-
- * Copyright (c) 1999, 2000, 2001 Boris Popov
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/errno.h>
-#include <sys/malloc.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/socket.h>
-
-#include <netncp/ncp.h>
-#include <netncp/ncp_conn.h>
-#include <netncp/ncp_subr.h>
-#include <netncp/ncp_ncp.h>
-#include <netncp/ncp_rq.h>
-#include <netncp/ncp_nls.h>
-#include <netncp/nwerror.h>
diff --git a/sys/netncp/ncp_mod.c b/sys/netncp/ncp_mod.c
deleted file mode 100644
index 955fa31..0000000
--- a/sys/netncp/ncp_mod.c
+++ /dev/null
@@ -1,529 +0,0 @@
-/*-
- * Copyright (c) 2003 Tim J. Robbins.
- * Copyright (c) 1999, 2000, 2001 Boris Popov
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Boris Popov.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/priv.h>
-#include <sys/proc.h>
-#include <sys/kernel.h>
-#include <sys/module.h>
-#include <sys/sysctl.h>
-#include <sys/malloc.h>
-#include <sys/uio.h>
-#include <sys/ioccom.h>
-
-#include <netncp/ncp.h>
-#include <netncp/ncp_conn.h>
-#include <netncp/ncp_subr.h>
-#include <netncp/ncp_ncp.h>
-#include <netncp/ncp_user.h>
-#include <netncp/ncp_rq.h>
-#include <netncp/ncp_nls.h>
-#include <netncp/ncpio.h>
-
-int ncp_version = NCP_VERSION;
-
-SYSCTL_NODE(_net, OID_AUTO, ncp, CTLFLAG_RW, NULL, "NetWare requester");
-SYSCTL_INT(_net_ncp, OID_AUTO, version, CTLFLAG_RD, &ncp_version, 0, "");
-
-MODULE_VERSION(ncp, 1);
-MODULE_DEPEND(ncp, libmchain, 1, 1, 1);
-
-static struct cdev *ncp_dev;
-
-static d_ioctl_t ncp_ioctl;
-
-static struct cdevsw ncp_cdevsw = {
- .d_version = D_VERSION,
- .d_flags = D_NEEDGIANT,
- .d_ioctl = ncp_ioctl,
- .d_name = "ncp",
-};
-
-static int ncp_conn_frag_rq(struct ncp_conn *, struct thread *,
- struct ncp_conn_frag *);
-static int ncp_conn_handler(struct thread *, struct ncpioc_request *,
- struct ncp_conn *, struct ncp_handle *);
-static int sncp_conn_scan(struct thread *, struct ncpioc_connscan *);
-static int sncp_connect(struct thread *, struct ncpioc_connect *);
-static int sncp_request(struct thread *, struct ncpioc_request *);
-
-static int
-ncp_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td)
-{
-
- switch (cmd) {
- case NCPIOC_CONNECT:
- return (sncp_connect(td, (struct ncpioc_connect *)data));
- case NCPIOC_CONNSCAN:
- return (sncp_conn_scan(td, (struct ncpioc_connscan *)data));
- case NCPIOC_REQUEST:
- return (sncp_request(td, (struct ncpioc_request *)data));
- }
- return (EINVAL);
-}
-
-/*
- * Attach to NCP server
- */
-
-static int
-sncp_connect(struct thread *td, struct ncpioc_connect *args)
-{
- int connHandle = 0, error;
- struct ncp_conn *conn;
- struct ncp_handle *handle;
- struct ncp_conn_args li;
-
- checkbad(copyin(args->ioc_li,&li,sizeof(li)));
- /* XXX Should be useracc() */
- checkbad(copyout(&connHandle,args->ioc_connhandle,
- sizeof(connHandle)));
- li.password = li.user = NULL;
- error = ncp_conn_getattached(&li, td, td->td_ucred, NCPM_WRITE | NCPM_EXECUTE, &conn);
- if (error) {
- error = ncp_conn_alloc(&li, td, td->td_ucred, &conn);
- if (error)
- goto bad;
- error = ncp_conn_reconnect(conn);
- if (error)
- ncp_conn_free(conn);
- }
- if (!error) {
- error = ncp_conn_gethandle(conn, td, &handle);
- copyout(&handle->nh_id, args->ioc_connhandle,
- sizeof(args->ioc_connhandle));
- ncp_conn_unlock(conn,td);
- }
-bad:
- return error;
-}
-
-static int
-sncp_request(struct thread *td, struct ncpioc_request *args)
-{
- struct ncp_rq *rqp;
- struct ncp_conn *conn;
- struct ncp_handle *handle;
- int error = 0, rqsize;
-
- error = ncp_conn_findhandle(args->ioc_connhandle, td, &handle);
- if (error)
- return error;
- conn = handle->nh_conn;
- if (args->ioc_fn == NCP_CONN)
- return ncp_conn_handler(td, args, conn, handle);
- error = copyin(&args->ioc_ncpbuf->rqsize, &rqsize, sizeof(int));
- if (error)
- return(error);
- error = ncp_rq_alloc(args->ioc_fn, conn, td, td->td_ucred, &rqp);
- if (error)
- return error;
- if (rqsize) {
- error = mb_put_mem(&rqp->rq, (caddr_t)args->ioc_ncpbuf->packet,
- rqsize, MB_MUSER);
- if (error)
- goto bad;
- }
- rqp->nr_flags |= NCPR_DONTFREEONERR;
- error = ncp_request(rqp);
- if (error == 0 && rqp->nr_rpsize)
- error = md_get_mem(&rqp->rp, (caddr_t)args->ioc_ncpbuf->packet,
- rqp->nr_rpsize, MB_MUSER);
- copyout(&rqp->nr_cs, &args->ioc_ncpbuf->cs, sizeof(rqp->nr_cs));
- copyout(&rqp->nr_cc, &args->ioc_ncpbuf->cc, sizeof(rqp->nr_cc));
- copyout(&rqp->nr_rpsize, &args->ioc_ncpbuf->rpsize, sizeof(rqp->nr_rpsize));
-bad:
- ncp_rq_done(rqp);
- return error;
-}
-
-static int
-ncp_mod_login(struct ncp_conn *conn, char *user, int objtype, char *password,
- struct thread *td, struct ucred *cred)
-{
- int error;
-
- if (ncp_suser(cred) != 0 && cred->cr_uid != conn->nc_owner->cr_uid)
- return EACCES;
- conn->li.user = ncp_str_dup(user);
- if (conn->li.user == NULL)
- return ENOMEM;
- conn->li.password = ncp_str_dup(password);
- if (conn->li.password == NULL) {
- error = ENOMEM;
- goto bad;
- }
- ncp_str_upper(conn->li.user);
- if ((conn->li.opt & NCP_OPT_NOUPCASEPASS) == 0)
- ncp_str_upper(conn->li.password);
- conn->li.objtype = objtype;
- error = ncp_conn_login(conn, td, cred);
- return error;
-bad:
- if (conn->li.user) {
- free(conn->li.user, M_NCPDATA);
- conn->li.user = NULL;
- }
- if (conn->li.password) {
- free(conn->li.password, M_NCPDATA);
- conn->li.password = NULL;
- }
- return error;
-}
-
-static int
-ncp_conn_handler(struct thread *td, struct ncpioc_request *args,
- struct ncp_conn *conn, struct ncp_handle *hp)
-{
- int error = 0, rqsize, subfn;
- struct ucred *cred;
-
- char *pdata;
-
- cred = td->td_ucred;
- error = copyin(&args->ioc_ncpbuf->rqsize, &rqsize, sizeof(int));
- if (error)
- return(error);
- error = 0;
- pdata = args->ioc_ncpbuf->packet;
- subfn = *(pdata++) & 0xff;
- rqsize--;
- switch (subfn) {
- case NCP_CONN_READ: case NCP_CONN_WRITE: {
- struct ncp_rw rwrq;
- struct uio auio;
- struct iovec iov;
-
- if (rqsize != sizeof(rwrq))
- return (EBADRPC);
- error = copyin(pdata,&rwrq,rqsize);
- if (error)
- return (error);
- iov.iov_base = rwrq.nrw_base;
- iov.iov_len = rwrq.nrw_cnt;
- auio.uio_iov = &iov;
- auio.uio_iovcnt = 1;
- auio.uio_offset = rwrq.nrw_offset;
- auio.uio_resid = rwrq.nrw_cnt;
- auio.uio_segflg = UIO_USERSPACE;
- auio.uio_rw = (subfn == NCP_CONN_READ) ? UIO_READ : UIO_WRITE;
- auio.uio_td = td;
- if (subfn == NCP_CONN_READ)
- error = ncp_read(conn, &rwrq.nrw_fh, &auio, cred);
- else
- error = ncp_write(conn, &rwrq.nrw_fh, &auio, cred);
- rwrq.nrw_cnt -= auio.uio_resid;
- /*td->td_retval[0] = rwrq.nrw_cnt;*/
- break;
- } /* case int_read/write */
- case NCP_CONN_SETFLAGS: {
- u_int16_t mask, flags;
-
- error = copyin(pdata,&mask, sizeof(mask));
- if (error)
- return error;
- pdata += sizeof(mask);
- error = copyin(pdata,&flags,sizeof(flags));
- if (error)
- return error;
- error = ncp_conn_lock(conn, td, cred, NCPM_WRITE);
- if (error)
- return error;
- if (mask & NCPFL_PERMANENT) {
- conn->flags &= ~NCPFL_PERMANENT;
- conn->flags |= (flags & NCPFL_PERMANENT);
- }
- if (mask & NCPFL_PRIMARY) {
- error = ncp_conn_setprimary(conn, flags & NCPFL_PRIMARY);
- if (error) {
- ncp_conn_unlock(conn, td);
- break;
- }
- }
- ncp_conn_unlock(conn, td);
- break;
- }
- case NCP_CONN_LOGIN: {
- struct ncp_conn_login la;
-
- if (rqsize != sizeof(la))
- return EBADRPC;
- if (conn->flags & NCPFL_LOGGED)
- return EALREADY;
- if ((error = copyin(pdata,&la,rqsize)) != 0)
- break;
- error = ncp_conn_lock(conn, td, cred, NCPM_EXECUTE | NCPM_WRITE);
- if (error)
- return error;
- error = ncp_mod_login(conn, la.username, la.objtype,
- la.password, td, td->td_ucred);
- ncp_conn_unlock(conn, td);
- break;
- }
- case NCP_CONN_GETINFO: {
- struct ncp_conn_stat ncs;
- int len = sizeof(ncs);
-
- error = ncp_conn_lock(conn, td, td->td_ucred, NCPM_READ);
- if (error)
- return error;
- ncp_conn_getinfo(conn, &ncs);
- copyout(&len, &args->ioc_ncpbuf->rpsize, sizeof(int));
- error = copyout(&ncs, &args->ioc_ncpbuf->packet, len);
- ncp_conn_unlock(conn, td);
- break;
- }
- case NCP_CONN_GETUSER: {
- int len;
-
- error = ncp_conn_lock(conn, td, td->td_ucred, NCPM_READ);
- if (error)
- return error;
- len = (conn->li.user) ? strlen(conn->li.user) + 1 : 0;
- copyout(&len, &args->ioc_ncpbuf->rpsize, sizeof(int));
- if (len) {
- error = copyout(conn->li.user,
- &args->ioc_ncpbuf->packet, len);
- }
- ncp_conn_unlock(conn, td);
- break;
- }
- case NCP_CONN_CONN2REF: {
- int len = sizeof(int);
-
- error = ncp_conn_lock(conn, td, td->td_ucred, NCPM_READ);
- if (error)
- return error;
- copyout(&len, &args->ioc_ncpbuf->rpsize, sizeof(int));
- if (len) {
- error = copyout(&conn->nc_id,
- &args->ioc_ncpbuf->packet, len);
- }
- ncp_conn_unlock(conn, td);
- break;
- }
- case NCP_CONN_FRAG: {
- struct ncp_conn_frag nf;
-
- if (rqsize != sizeof(nf))
- return (EBADRPC);
- if ((error = copyin(pdata, &nf, rqsize)) != 0) break;
- error = ncp_conn_lock(conn, td, cred, NCPM_EXECUTE);
- if (error)
- return error;
- error = ncp_conn_frag_rq(conn, td, &nf);
- ncp_conn_unlock(conn, td);
- copyout(&nf, &pdata, sizeof(nf));
- td->td_retval[0] = error;
- break;
- }
- case NCP_CONN_DUP: {
- struct ncp_handle *newhp;
- int len = sizeof(NWCONN_HANDLE);
-
- error = ncp_conn_lock(conn, td, cred, NCPM_READ);
- if (error) break;
- copyout(&len, &args->ioc_ncpbuf->rpsize, len);
- error = ncp_conn_gethandle(conn, td, &newhp);
- if (!error)
- error = copyout(&newhp->nh_id,
- args->ioc_ncpbuf->packet, len);
- ncp_conn_unlock(conn, td);
- break;
- }
- case NCP_CONN_CONNCLOSE: {
- error = ncp_conn_lock(conn, td, cred, NCPM_EXECUTE);
- if (error) break;
- ncp_conn_puthandle(hp, td, 0);
- error = ncp_conn_free(conn);
- if (error)
- ncp_conn_unlock(conn, td);
- break;
- }
- default:
- error = EOPNOTSUPP;
- }
- return error;
-}
-
-static int
-sncp_conn_scan(struct thread *td, struct ncpioc_connscan *args)
-{
- int connHandle = 0, error;
- struct ncp_conn_args li, *lip;
- struct ncp_conn *conn;
- struct ncp_handle *hp;
- char *user = NULL, *password = NULL;
-
- if (args->ioc_li) {
- if (copyin(args->ioc_li, &li, sizeof(li)))
- return EFAULT;
- lip = &li;
- } else {
- lip = NULL;
- }
-
- if (lip != NULL) {
- lip->server[sizeof(lip->server)-1]=0; /* just to make sure */
- ncp_str_upper(lip->server);
- if (lip->user) {
- user = ncp_str_dup(lip->user);
- if (user == NULL)
- return EINVAL;
- ncp_str_upper(user);
- }
- if (lip->password) {
- password = ncp_str_dup(lip->password);
- if (password == NULL) {
- if (user)
- free(user, M_NCPDATA);
- return EINVAL;
- }
- ncp_str_upper(password);
- }
- lip->user = user;
- lip->password = password;
- }
- error = ncp_conn_getbyli(lip, td, td->td_ucred, NCPM_EXECUTE, &conn);
- if (!error) { /* already have this login */
- ncp_conn_gethandle(conn, td, &hp);
- connHandle = hp->nh_id;
- ncp_conn_unlock(conn, td);
- copyout(&connHandle, args->ioc_connhandle, sizeof(connHandle));
- }
- if (user)
- free(user, M_NCPDATA);
- if (password)
- free(password, M_NCPDATA);
- return error;
-
-}
-
-int
-ncp_conn_frag_rq(struct ncp_conn *conn, struct thread *td,
- struct ncp_conn_frag *nfp)
-{
- NW_FRAGMENT *fp;
- struct ncp_rq *rqp;
- u_int32_t fsize;
- int error, i, rpsize;
-
- error = ncp_rq_alloc(nfp->fn, conn, td, td->td_ucred, &rqp);
- if (error)
- return error;
- for(fp = nfp->rqf, i = 0; i < nfp->rqfcnt; i++, fp++) {
- error = mb_put_mem(&rqp->rq, (caddr_t)fp->fragAddress, fp->fragSize, MB_MUSER);
- if (error)
- goto bad;
- }
- rqp->nr_flags |= NCPR_DONTFREEONERR;
- error = ncp_request(rqp);
- if (error)
- goto bad;
- rpsize = rqp->nr_rpsize;
- if (rpsize && nfp->rpfcnt) {
- for(fp = nfp->rpf, i = 0; i < nfp->rpfcnt; i++, fp++) {
- error = copyin(&fp->fragSize, &fsize, sizeof (fsize));
- if (error)
- break;
- fsize = min(fsize, rpsize);
- error = md_get_mem(&rqp->rp, (caddr_t)fp->fragAddress, fsize, MB_MUSER);
- if (error)
- break;
- rpsize -= fsize;
- error = copyout(&fsize, &fp->fragSize, sizeof (fsize));
- if (error)
- break;
- }
- }
- nfp->cs = rqp->nr_cs;
- nfp->cc = rqp->nr_cc;
-bad:
- ncp_rq_done(rqp);
- return error;
-}
-
-static int
-ncp_load(void)
-{
- int error;
-
- if ((error = ncp_init()) != 0)
- return (error);
- ncp_dev = make_dev(&ncp_cdevsw, 0, 0, 0, 0666, "ncp");
- printf("ncp_load: loaded\n");
- return (0);
-}
-
-static int
-ncp_unload(void)
-{
- int error;
-
- error = ncp_done();
- if (error)
- return (error);
- destroy_dev(ncp_dev);
- printf("ncp_unload: unloaded\n");
- return (0);
-}
-
-static int
-ncp_mod_handler(module_t mod, int type, void *data)
-{
- int error;
-
- switch (type) {
- case MOD_LOAD:
- error = ncp_load();
- break;
- case MOD_UNLOAD:
- error = ncp_unload();
- break;
- default:
- error = EINVAL;
- }
- return error;
-}
-
-static moduledata_t ncp_mod = {
- "ncp",
- ncp_mod_handler,
- NULL
-};
-DECLARE_MODULE(ncp, ncp_mod, SI_SUB_PROTO_DOMAIN, SI_ORDER_ANY);
diff --git a/sys/netncp/ncp_ncp.c b/sys/netncp/ncp_ncp.c
deleted file mode 100644
index 943639e..0000000
--- a/sys/netncp/ncp_ncp.c
+++ /dev/null
@@ -1,503 +0,0 @@
-/*-
- * Copyright (c) 1999, 2000, 2001 Boris Popov
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Core of NCP protocol
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/errno.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/signalvar.h>
-#include <sys/sysctl.h>
-#include <sys/mbuf.h>
-#include <sys/lock.h>
-#include <sys/mutex.h>
-#include <sys/uio.h>
-
-#include <netipx/ipx.h>
-#include <netipx/ipx_var.h>
-
-#include <netncp/ncp.h>
-#include <netncp/ncp_conn.h>
-#include <netncp/ncp_sock.h>
-#include <netncp/ncp_subr.h>
-#include <netncp/ncp_ncp.h>
-#include <netncp/ncp_rq.h>
-#include <netncp/nwerror.h>
-
-#ifdef NCP_DATA_DEBUG
-static
-void m_dumpm(struct mbuf *m) {
- char *p;
- int len;
- printf("d=");
- while(m) {
- p=mtod(m,char *);
- len=m->m_len;
- printf("(%d)",len);
- while(len--){
- printf("%02x ",((int)*(p++)) & 0xff);
- }
- m=m->m_next;
- };
- printf("\n");
-}
-#endif /* NCP_DATA_DEBUG */
-
-int
-ncp_chkintr(struct ncp_conn *conn, struct thread *td)
-{
- struct proc *p;
- sigset_t tmpset;
-
- if (td == NULL)
- return 0;
- p = td->td_proc;
- PROC_LOCK(p);
- tmpset = p->p_siglist;
- SIGSETOR(tmpset, td->td_siglist);
- SIGSETNAND(tmpset, td->td_sigmask);
- mtx_lock(&p->p_sigacts->ps_mtx);
- SIGSETNAND(tmpset, p->p_sigacts->ps_sigignore);
- mtx_unlock(&p->p_sigacts->ps_mtx);
- if (SIGNOTEMPTY(td->td_siglist) && NCP_SIGMASK(tmpset)) {
- PROC_UNLOCK(p);
- return EINTR;
- }
- PROC_UNLOCK(p);
- return 0;
-}
-
-/*
- * Process initial NCP handshake (attach)
- * NOTE: Since all functions below may change conn attributes, they
- * should be called with LOCKED connection, also they use procp & ucred
- */
-int
-ncp_ncp_connect(struct ncp_conn *conn)
-{
- struct ncp_rq *rqp;
- struct ncp_rphdr *rp;
- int error;
-
- error = ncp_rq_alloc_any(NCP_ALLOC_SLOT, 0, conn, conn->td, conn->ucred, &rqp);
- if (error)
- return error;
-
- conn->flags &= ~(NCPFL_SIGNACTIVE | NCPFL_SIGNWANTED |
- NCPFL_ATTACHED | NCPFL_LOGGED | NCPFL_INVALID);
- conn->seq = 0;
- error = ncp_request_int(rqp);
- if (!error) {
- rp = mtod(rqp->rp.md_top, struct ncp_rphdr*);
- conn->connid = rp->conn_low + (rp->conn_high << 8);
- }
- ncp_rq_done(rqp);
- if (error)
- return error;
- conn->flags |= NCPFL_ATTACHED | NCPFL_WASATTACHED;
- return 0;
-}
-
-int
-ncp_ncp_disconnect(struct ncp_conn *conn)
-{
- struct ncp_rq *rqp;
- int error;
-
- NCPSDEBUG("for connid=%d\n",conn->nc_id);
-#ifdef NCPBURST
- ncp_burst_disconnect(conn);
-#endif
- if (conn->flags & NCPFL_ATTACHED) {
- error = ncp_rq_alloc_any(NCP_FREE_SLOT, 0, conn, conn->td, conn->ucred, &rqp);
- if (!error) {
- ncp_request_int(rqp);
- ncp_rq_done(rqp);
- }
- }
- ncp_conn_invalidate(conn);
- ncp_sock_disconnect(conn);
- return 0;
-}
-
-/*
- * All negotiation functions expect a locked connection
- */
-
-int
-ncp_negotiate_buffersize(struct ncp_conn *conn, int size, int *target)
-{
- struct ncp_rq *rqp;
- u_int16_t bsize;
- int error;
-
- error = ncp_rq_alloc(0x21, conn, conn->td, conn->ucred, &rqp);
- if (error)
- return error;
- mb_put_uint16be(&rqp->rq, size);
- error = ncp_request(rqp);
- if (error)
- return error;
- md_get_uint16be(&rqp->rp, &bsize);
- *target = min(bsize, size);
- ncp_rq_done(rqp);
- return error;
-}
-
-static int
-ncp_negotiate_size_and_options(struct ncp_conn *conn, int size, int options,
- int *ret_size, u_int8_t *ret_options)
-{
- struct ncp_rq *rqp;
- u_int16_t rs;
- int error;
-
- error = ncp_rq_alloc(0x61, conn, conn->td, conn->ucred, &rqp);
- if (error)
- return error;
- mb_put_uint16be(&rqp->rq, size);
- mb_put_uint8(&rqp->rq, options);
- rqp->nr_minrplen = 2 + 2 + 1;
- error = ncp_request(rqp);
- if (error)
- return error;
- md_get_uint16be(&rqp->rp, &rs);
- *ret_size = (rs == 0) ? size : min(rs, size);
- md_get_uint16be(&rqp->rp, &rs); /* skip echo socket */
- md_get_uint8(&rqp->rp, ret_options);
- ncp_rq_done(rqp);
- return error;
-}
-
-int
-ncp_renegotiate_connparam(struct ncp_conn *conn, int buffsize, u_int8_t in_options)
-{
- u_int8_t options;
- int neg_buffsize, error, sl, ckslevel;
- size_t ilen;
-
- sl = conn->li.sig_level;
- if (sl >= 2)
- in_options |= NCP_SECURITY_LEVEL_SIGN_HEADERS;
- if (conn->li.saddr.sa_family == AF_IPX) {
- ilen = sizeof(ckslevel);
- error = kernel_sysctlbyname(curthread, "net.ipx.ipx.checksum",
- &ckslevel, &ilen, NULL, 0, NULL, 0);
- if (error)
- return error;
- if (ckslevel == 2)
- in_options |= NCP_IPX_CHECKSUM;
- }
- error = ncp_negotiate_size_and_options(conn, buffsize, in_options,
- &neg_buffsize, &options);
- if (!error) {
- if (conn->li.saddr.sa_family == AF_IPX &&
- ((options ^ in_options) & NCP_IPX_CHECKSUM)) {
- if (ckslevel == 2) {
- printf("Server refuses to support IPX checksums\n");
- return NWE_REQUESTER_FAILURE;
- }
- in_options |= NCP_IPX_CHECKSUM;
- error = 1;
- }
- if ((options ^ in_options) & 2) {
- if (sl == 0 || sl == 3)
- return NWE_SIGNATURE_LEVEL_CONFLICT;
- if (sl == 1) {
- in_options |= NCP_SECURITY_LEVEL_SIGN_HEADERS;
- error = 1;
- }
- }
- if (error) {
- error = ncp_negotiate_size_and_options(conn,
- buffsize, in_options, &neg_buffsize, &options);
- if ((options ^ in_options) & 3) {
- return NWE_SIGNATURE_LEVEL_CONFLICT;
- }
- }
- } else {
- in_options &= ~NCP_SECURITY_LEVEL_SIGN_HEADERS;
- error = ncp_negotiate_buffersize(conn, NCP_DEFAULT_BUFSIZE,
- &neg_buffsize);
- }
- if (error) return error;
- if ((neg_buffsize < 512) || (neg_buffsize > NCP_MAX_BUFSIZE))
- return EINVAL;
- conn->buffer_size = neg_buffsize;
- if (in_options & NCP_SECURITY_LEVEL_SIGN_HEADERS)
- conn->flags |= NCPFL_SIGNWANTED;
- if (conn->li.saddr.sa_family == AF_IPX)
- ncp_sock_checksum(conn, in_options & NCP_IPX_CHECKSUM);
- return 0;
-}
-
-void
-ncp_check_rq(struct ncp_conn *conn)
-{
- return;
- if (conn->flags & NCPFL_INTR)
- return;
- /* first, check for signals */
- if (ncp_chkintr(conn, conn->td))
- conn->flags |= NCPFL_INTR;
- return;
-}
-
-int
-ncp_get_bindery_object_id(struct ncp_conn *conn,
- u_int16_t object_type, char *object_name,
- struct ncp_bindery_object *target,
- struct thread *td, struct ucred *cred)
-{
- struct ncp_rq *rqp;
- int error;
-
- error = ncp_rq_alloc_subfn(23, 53, conn, conn->td, conn->ucred, &rqp);
- mb_put_uint16be(&rqp->rq, object_type);
- ncp_rq_pstring(rqp, object_name);
- rqp->nr_minrplen = 54;
- error = ncp_request(rqp);
- if (error)
- return error;
- md_get_uint32be(&rqp->rp, &target->object_id);
- md_get_uint16be(&rqp->rp, &target->object_type);
- md_get_mem(&rqp->rp, (caddr_t)target->object_name, 48, MB_MSYSTEM);
- ncp_rq_done(rqp);
- return 0;
-}
-
-/*
- * target is a 8-byte buffer
- */
-int
-ncp_get_encryption_key(struct ncp_conn *conn, char *target)
-{
- struct ncp_rq *rqp;
- int error;
-
- error = ncp_rq_alloc_subfn(23, 23, conn, conn->td, conn->ucred, &rqp);
- if (error)
- return error;
- rqp->nr_minrplen = 8;
- error = ncp_request(rqp);
- if (error)
- return error;
- md_get_mem(&rqp->rp, target, 8, MB_MSYSTEM);
- ncp_rq_done(rqp);
- return error;
-}
-
-/*
- * Initialize packet signatures. They a slightly modified MD4.
- * The first 16 bytes of logindata are the shuffled password,
- * the last 8 bytes the encryption key as received from the server.
- */
-static int
-ncp_sign_start(struct ncp_conn *conn, char *logindata)
-{
- char msg[64];
- u_int32_t state[4];
-
- memcpy(msg, logindata, 24);
- memcpy(msg + 24, "Authorized NetWare Client", 25);
- bzero(msg + 24 + 25, sizeof(msg) - 24 - 25);
-
- conn->sign_state[0] = 0x67452301;
- conn->sign_state[1] = 0xefcdab89;
- conn->sign_state[2] = 0x98badcfe;
- conn->sign_state[3] = 0x10325476;
- ncp_sign(conn->sign_state, msg, state);
- conn->sign_root[0] = state[0];
- conn->sign_root[1] = state[1];
- conn->flags |= NCPFL_SIGNACTIVE;
- return 0;
-}
-
-
-int
-ncp_login_encrypted(struct ncp_conn *conn, struct ncp_bindery_object *object,
- const u_char *key, const u_char *passwd,
- struct thread *td, struct ucred *cred)
-{
- struct ncp_rq *rqp;
- struct mbchain *mbp;
- u_int32_t tmpID = htonl(object->object_id);
- u_char buf[16 + 8];
- u_char encrypted[8];
- int error;
-
- nw_keyhash((u_char*)&tmpID, passwd, strlen(passwd), buf);
- nw_encrypt(key, buf, encrypted);
-
- error = ncp_rq_alloc_subfn(23, 24, conn, td, cred, &rqp);
- if (error)
- return error;
- mbp = &rqp->rq;
- mb_put_mem(mbp, encrypted, 8, MB_MSYSTEM);
- mb_put_uint16be(mbp, object->object_type);
- ncp_rq_pstring(rqp, object->object_name);
- error = ncp_request(rqp);
- if (!error)
- ncp_rq_done(rqp);
- if ((conn->flags & NCPFL_SIGNWANTED) &&
- (error == 0 || error == NWE_PASSWORD_EXPIRED)) {
- bcopy(key, buf + 16, 8);
- error = ncp_sign_start(conn, buf);
- }
- return error;
-}
-
-int
-ncp_login_unencrypted(struct ncp_conn *conn, u_int16_t object_type,
- const char *object_name, const u_char *passwd,
- struct thread *td, struct ucred *cred)
-{
- struct ncp_rq *rqp;
- int error;
-
- error = ncp_rq_alloc_subfn(23, 20, conn, td, cred, &rqp);
- if (error)
- return error;
- mb_put_uint16be(&rqp->rq, object_type);
- ncp_rq_pstring(rqp, object_name);
- ncp_rq_pstring(rqp, passwd);
- error = ncp_request(rqp);
- if (!error)
- ncp_rq_done(rqp);
- return error;
-}
-
-int
-ncp_read(struct ncp_conn *conn, ncp_fh *file, struct uio *uiop, struct ucred *cred)
-{
- struct ncp_rq *rqp;
- struct mbchain *mbp;
- u_int16_t retlen = 0 ;
- int error = 0, len = 0, tsiz, burstio;
-
- tsiz = uiop->uio_resid;
-#ifdef NCPBURST
- burstio = (ncp_burst_enabled && tsiz > conn->buffer_size);
-#else
- burstio = 0;
-#endif
-
- while (tsiz > 0) {
- if (!burstio) {
- len = min(4096 - (uiop->uio_offset % 4096), tsiz);
- len = min(len, conn->buffer_size);
- error = ncp_rq_alloc(72, conn, uiop->uio_td, cred, &rqp);
- if (error)
- break;
- mbp = &rqp->rq;
- mb_put_uint8(mbp, 0);
- mb_put_mem(mbp, (caddr_t)file, 6, MB_MSYSTEM);
- mb_put_uint32be(mbp, uiop->uio_offset);
- mb_put_uint16be(mbp, len);
- rqp->nr_minrplen = 2;
- error = ncp_request(rqp);
- if (error)
- break;
- md_get_uint16be(&rqp->rp, &retlen);
- if (uiop->uio_offset & 1)
- md_get_mem(&rqp->rp, NULL, 1, MB_MSYSTEM);
- error = md_get_uio(&rqp->rp, uiop, retlen);
- ncp_rq_done(rqp);
- } else {
-#ifdef NCPBURST
- error = ncp_burst_read(conn, file, tsiz, &len, &retlen, uiop, cred);
-#endif
- }
- if (error)
- break;
- tsiz -= retlen;
- if (retlen < len)
- break;
- }
- return (error);
-}
-
-int
-ncp_write(struct ncp_conn *conn, ncp_fh *file, struct uio *uiop, struct ucred *cred)
-{
- struct ncp_rq *rqp;
- struct mbchain *mbp;
- int error = 0, len, tsiz, backup;
-
- if (uiop->uio_iovcnt != 1) {
- printf("%s: can't handle iovcnt>1 !!!\n", __func__);
- return EIO;
- }
- tsiz = uiop->uio_resid;
- while (tsiz > 0) {
- len = min(4096 - (uiop->uio_offset % 4096), tsiz);
- len = min(len, conn->buffer_size);
- if (len == 0) {
- printf("gotcha!\n");
- }
- /* rq head */
- error = ncp_rq_alloc(73, conn, uiop->uio_td, cred, &rqp);
- if (error)
- break;
- mbp = &rqp->rq;
- mb_put_uint8(mbp, 0);
- mb_put_mem(mbp, (caddr_t)file, 6, MB_MSYSTEM);
- mb_put_uint32be(mbp, uiop->uio_offset);
- mb_put_uint16be(mbp, len);
- error = mb_put_uio(mbp, uiop, len);
- if (error) {
- ncp_rq_done(rqp);
- break;
- }
- error = ncp_request(rqp);
- if (!error)
- ncp_rq_done(rqp);
- if (len == 0)
- break;
- if (error) {
- backup = len;
- uiop->uio_iov->iov_base =
- (char *)uiop->uio_iov->iov_base - backup;
- uiop->uio_iov->iov_len += backup;
- uiop->uio_offset -= backup;
- uiop->uio_resid += backup;
- break;
- }
- tsiz -= len;
- }
- if (error)
- uiop->uio_resid = tsiz;
- switch (error) {
- case NWE_INSUFFICIENT_SPACE:
- error = ENOSPC;
- break;
- }
- return (error);
-}
diff --git a/sys/netncp/ncp_ncp.h b/sys/netncp/ncp_ncp.h
deleted file mode 100644
index e62eda2..0000000
--- a/sys/netncp/ncp_ncp.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*-
- * Copyright (c) 1999 Boris Popov
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-#ifndef _NETNCP_NCP_NCP_H_
-#define _NETNCP_NCP_NCP_H_
-
-#define NCP_ALLOC_SLOT 0x1111
-#define NCP_REQUEST 0x2222
-#define NCP_REPLY 0x3333
-#define NCP_FREE_SLOT 0x5555
-#define NCP_PACKET_BURST 0x7777
-#define NCP_POSITIVE_ACK 0x9999
-
-/*
- * Bits for connection state field in ncp_rphdr
- */
-#define NCP_CS_BAD_CONN 0x01 /* no such connection */
-#define NCP_CS_NO_SLOTS 0x04 /* no connection slots available */
-#define NCP_CS_SERVER_DOWN 0x10 /* server in down state */
-#define NCP_CS_HAVE_BROADCAST 0x40 /* server holds broadcast for us */
-
-#define NCP_RETRY_COUNT 5
-#define NCP_RETRY_TIMEOUT 10
-#define NCP_RESTORE_COUNT 2 /* how many times try to restore per
- * single request, should be an _even_ */
-
-struct ncp_rqhdr {
- u_int16_t type;
- u_int8_t seq;
- u_int8_t conn_low;
- u_int8_t task;
- u_int8_t conn_high;
- u_int8_t fn;
- u_int8_t data[0];
-} __packed;
-
-
-struct ncp_rphdr {
- u_int16_t type;
- u_int8_t seq;
- u_int8_t conn_low;
- u_int8_t task;
- u_int8_t conn_high;
- u_int8_t completion_code;
- u_int8_t connection_state;
- u_int8_t data[0];
-}__packed;
-
-#define BFL_ABT 0x04
-#define BFL_EOB 0x10
-#define BFL_SYS 0x80
-
-#define BOP_READ 1L
-#define BOP_WRITE 2L
-
-#define BERR_NONE 0
-#define BERR_INIT 1
-#define BERR_IO 2
-#define BERR_NODATA 3
-#define BERR_WRITE 4
-
-struct ncp_bursthdr {
- u_short bh_type;
- u_char bh_flags;
- u_char bh_streamtype;
- u_long bh_srcid;
- u_long bh_dstid;
- u_long bh_seq; /* HL */
- u_long bh_send_delay; /* HL */
- u_short bh_bseq; /* HL */
- u_short bh_aseq; /* HL */
- u_long bh_blen; /* HL */
- u_long bh_dofs; /* HL */
- u_short bh_dlen; /* HL */
- u_short bh_misfrags; /* HL */
-} __packed;
-
-struct ncp_conn;
-struct ncp_conn_args;
-struct ncp_rq;
-struct ucred;
-
-int ncp_ncp_connect(struct ncp_conn *conn);
-int ncp_ncp_disconnect(struct ncp_conn *conn);
-int ncp_negotiate_buffersize(struct ncp_conn *conn, int size, int *target);
-int ncp_renegotiate_connparam(struct ncp_conn *conn, int buffsize,
- u_int8_t in_options);
-int ncp_get_bindery_object_id(struct ncp_conn *conn,
- u_int16_t object_type, char *object_name,
- struct ncp_bindery_object *target,
- struct thread *td,struct ucred *cred);
-int ncp_get_encryption_key(struct ncp_conn *conn, char *target);
-int ncp_login_encrypted(struct ncp_conn *conn,
- struct ncp_bindery_object *object,
- const u_char *key, const u_char *passwd,
- struct thread *td, struct ucred *cred);
-int ncp_login_unencrypted(struct ncp_conn *conn, u_int16_t object_type,
- const char *object_name, const u_char *passwd,
- struct thread *td, struct ucred *cred);
-int ncp_read(struct ncp_conn *conn, ncp_fh *file, struct uio *uiop, struct ucred *cred);
-int ncp_write(struct ncp_conn *conn, ncp_fh *file, struct uio *uiop, struct ucred *cred);
-
-#endif /* _NCP_NCP_H_ */
diff --git a/sys/netncp/ncp_nls.c b/sys/netncp/ncp_nls.c
deleted file mode 100644
index b582626..0000000
--- a/sys/netncp/ncp_nls.c
+++ /dev/null
@@ -1,304 +0,0 @@
-/*-
- * Copyright (c) 1999 Boris Popov
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Character conversion routines
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/errno.h>
-#include <sys/systm.h>
-
-#include <netncp/ncp.h>
-#include <netncp/ncp_nls.h>
-
-/*
- * 0 - character disallowed in NetWare file name.
- */
-static u_char ncp_u2n[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10 */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x20, 0x21, 0x00, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 */
- 0x28, 0x29, 0x00, 0x00, 0x00, 0x2d, 0x2e, 0x00,
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30 */
- 0x38, 0x39, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00,
- 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x40 */
- 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
- 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50 */
- 0x58, 0x59, 0x5a, 0x00, 0x00, 0x00, 0x5e, 0x5f,
- 0x00, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60 */
- 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
- 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70 */
- 0x78, 0x79, 0x7a, 0x7b, 0x00, 0x7d, 0x7e, 0x00,
- 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80 */
- 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
- 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90 */
- 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
- 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0 */
- 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
- 0xb0, 0xbf, 0xbf, 0xbf, 0xbf, 0xb1, 0xb2, 0xb7, /* 0xb0 */
- 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
- 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0 */
- 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
- 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0 */
- 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
- 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0 */
- 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
- 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0 */
- 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
-};
-
-static u_char ncp_n2u[256] = {
- 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, /* 0x00 */
- 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f,
- 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, /* 0x10 */
- 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f,
- 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 */
- 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30 */
- 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x5f,
- 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x40 */
- 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
- 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50 */
- 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
- 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60 */
- 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
- 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70 */
- 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
- 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80 */
- 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
- 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90 */
- 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
- 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0 */
- 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
- 0xb0, 0xbf, 0xbf, 0xbf, 0xbf, 0xb1, 0xb2, 0xb7, /* 0xb0 */
- 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
- 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0 */
- 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
- 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0 */
- 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
- 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0 */
- 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
- 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0 */
- 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
-};
-
-static u_char ncp_u2l[256] = {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00 */
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10 */
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
- 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 */
- 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30 */
- 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
- 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40 */
- 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
- 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50 */
- 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
- 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60 */
- 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
- 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70 */
- 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
- 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80 */
- 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
- 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90 */
- 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
- 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0 */
- 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
- 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0 */
- 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
- 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0 */
- 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
- 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0 */
- 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
- 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0 */
- 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
- 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0 */
- 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
-};
-
-static u_char ncp_l2u[256] = {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00 */
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 10-17 */
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
- 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 20-27 */
- 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 30-37 */
- 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
- 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 40-47 */
- 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
- 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 50-57 */
- 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
- 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 60-67 */
- 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
- 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 70-77 */
- 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
- 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80 */
- 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
- 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90 */
- 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
- 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0 */
- 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
- 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0 */
- 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
- 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0 */
- 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
- 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0 */
- 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
- 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0 */
- 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
- 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0 */
- 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
-};
-
-struct ncp_nlstables ncp_defnls = {
- ncp_u2l, ncp_l2u, ncp_n2u, ncp_u2n, 0
-};
-
-void ncp_str_upper(char *name) {
- while (*name) {
- *name = ncp_defnls.to_upper[(u_char)*name];
- name++;
- }
-}
-
-void ncp_str_lower(char *name) {
- while (*name) {
- *name = ncp_defnls.to_lower[(u_char)*name];
- name++;
- }
-}
-
-/*
- * Check if pathname is valid under given conditions.
- */
-int
-ncp_pathcheck(char *s, int len, struct ncp_nlstables *nt, int strict) {
- u_char *tbl = NULL, sc;
- int opt = nt->opt;
-
- if (opt & (NWHP_UPPER | NWHP_LOWER))
- tbl = (opt & NWHP_UPPER) ? nt->to_upper : nt->to_lower;
- if ((opt & NWHP_DOS) == 0) {
- while (len--) {
- sc = (u_char)*(s++);
- if (nt->u2n[sc] == 0) /* illegal char */
- return EINVAL;
- if (tbl && strict && tbl[sc] != sc)
- return EINVAL;
- }
- return 0;
- }
- while (len--) {
- sc = (u_char)*(s++);
- if (nt->u2n[sc] == 0) /* illegal char */
- return EINVAL;
- if (sc == ' ') return EINVAL;
- if (tbl && strict && tbl[sc] != sc) {
- return EINVAL;
- }
- }
- return 0;
-}
-/*
- * Convert name from Unix to NetWare representation.
- * XXX: it should be complementary with path2unix, but for now
- * leave it as is.
- */
-void
-ncp_pathcopy(const char *src, char *dst, int len, struct ncp_nlstables *nt)
-{
- int donls;
- u_char c;
-/* char *d = dst, *s = src;*/
-
- if (nt == NULL) {
- ovbcopy(src, dst, len);
- return;
- }
- donls = (nt->opt & NWHP_NLS);
- if ((nt->opt & (NWHP_UPPER | NWHP_LOWER)) == 0) {
- while (len--) {
- *dst = donls ? nt->u2n[(u_char)*src] : *src;
- dst++;
- src++;
- }
- } else if (nt->opt & NWHP_DOS) {
- while (len--) {
- c = nt->to_upper[(u_char)*src];
- *dst = donls ? nt->u2n[c] : c;
- dst++;
- src++;
- }
- return;
- } else { /* probably incorrect... */
- while (len--) {
- *dst = donls ? nt->u2n[(u_char)*src] : *src;
- dst++;
- src++;
- }
- }
-/* printf("fromux: %s:%s\n", s, d);*/
-}
-
-/*
- * Convert NetWare filename to Unix with optional conversions
- */
-void
-ncp_path2unix(char *src, char *dst, int len, struct ncp_nlstables *nt) {
- int donls;
- u_char c, *tbl;
-/* char *d = dst, *s = src;*/
-
-/* printf("toux(%02x): %s:",nt->opt, s);*/
- if (nt == NULL) {
- ovbcopy(src, dst, len);
- return;
- }
- donls = (nt->opt & NWHP_NLS);
- if ((nt->opt & (NWHP_UPPER | NWHP_LOWER)) == 0) {
- while (len--) {
- c = *src;
- *dst = donls ? nt->n2u[c] : c;
- dst++;
- src++;
- }
- return;
- }
- tbl = (nt->opt & NWHP_LOWER) ? nt->to_lower : nt->to_upper;
- while (len--) {
- c = *src;
- *dst = tbl[donls ? nt->n2u[c] : c];
- dst++;
- src++;
- }
-/* printf("%s\n", d);*/
-}
diff --git a/sys/netncp/ncp_nls.h b/sys/netncp/ncp_nls.h
deleted file mode 100644
index 628190d..0000000
--- a/sys/netncp/ncp_nls.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*-
- * Copyright (c) 1999 Boris Popov
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-#ifndef _NETNCP_NCP_NLS_H_
-#define _NETNCP_NCP_NLS_H_
-
-/* options for handle path & caseopt in mount struct */
-#define NWHP_HDB 0x01 /* have dir base */
-#define NWHP_UPPER 0x02 /* local names has upper case */
-#define NWHP_LOWER 0x04 /* --"-- lower case */
-#define NWHP_DOS 0x08 /* using dos name space */
-#define NWHP_NLS 0x10 /* do name translation via tables, any nmspc */
-#define NWHP_NOSTRICT 0x20 /* pretend to be a case insensitive */
-
-struct ncp_nlstables {
- u_char *to_lower; /* local charset to lower case */
- u_char *to_upper; /* local charset to upper case */
- u_char *n2u; /* NetWare to Unix */
- u_char *u2n;
- int opt; /* may depend on context */
-};
-
-#ifndef _KERNEL
-/*
- * NLS, supported character conversion schemes.
- * NCP_NLS_UNIXCHARSET_NETWARECHARSET
- */
-#define NCP_NLS_AS_IS 1
-#define NCP_NLS_AS_IS_NAME "asis"
-#define NCP_NLS_KOI_866 2
-#define NCP_NLS_KOI_866_NAME "koi2cp866"
-#define NCP_NLS_SE 3
-#define NCP_NLS_SE_NAME "se"
-#define NCP_NLS_DE 4
-#define NCP_NLS_DE_NAME "de"
-
-extern struct ncp_nlstables ncp_nls; /* active nls */
-
-__BEGIN_DECLS
-
-int ncp_nls_setrecode(int scheme);
-int ncp_nls_setrecodebyname(char *name);
-int ncp_nls_setlocale(char *name);
-char* ncp_nls_str_n2u(char *dst, const char *src);
-char* ncp_nls_str_u2n(char *dst, const char *src);
-char* ncp_nls_mem_n2u(char *dst, const char *src, int size);
-char* ncp_nls_mem_u2n(char *dst, const char *src, int size);
-
-__END_DECLS
-
-#else /* !_KERNEL */
-
-
-extern struct ncp_nlstables ncp_defnls;
-
-void ncp_str_upper(char *name);
-void ncp_str_lower(char *name);
-void ncp_pathcopy(const char *src, char *dst, int len, struct ncp_nlstables *nt);
-int ncp_pathcheck(char *s, int len, struct ncp_nlstables *nt, int strict);
-void ncp_path2unix(char *src, char *dst, int len, struct ncp_nlstables *nt);
-
-#endif /* !_KERNEL */
-
-#endif /* _NCP_NCP_NLS_H_ */
diff --git a/sys/netncp/ncp_rcfile.h b/sys/netncp/ncp_rcfile.h
deleted file mode 100644
index 926af4e..0000000
--- a/sys/netncp/ncp_rcfile.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*-
- * Copyright (c) 1999 Boris Popov
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-#ifndef _NETNCP_NCP_RCFILE_H_
-#define _NETNCP_NCP_RCFILE_H_
-#include <sys/queue.h>
-
-struct rckey {
- SLIST_ENTRY(rckey) rk_next;
- char *rk_name;
- char *rk_value;
-};
-
-struct rcsection {
- SLIST_ENTRY(rcsection) rs_next;
- SLIST_HEAD(rckey_head,rckey) rs_keys;
- char *rs_name;
-};
-
-struct rcfile {
- SLIST_ENTRY(rcfile) rf_next;
- SLIST_HEAD(rcsec_head, rcsection) rf_sect;
- char *rf_name;
- FILE *rf_f;
-};
-
-__BEGIN_DECLS
-
-int rc_open(char *, char *,struct rcfile **);
-int rc_close(struct rcfile *);
-int rc_getstringptr(struct rcfile *, char *, char *, char **);
-int rc_getstring(struct rcfile *, char *, char *, int, char *);
-int rc_getint(struct rcfile *, char *, char *, int *);
-int rc_getbool(struct rcfile *, char *, char *, int *);
-
-__END_DECLS
-
-#endif /* _NETNCP_NCP_RCFILE_H_ */
diff --git a/sys/netncp/ncp_rq.c b/sys/netncp/ncp_rq.c
deleted file mode 100644
index e011c10..0000000
--- a/sys/netncp/ncp_rq.c
+++ /dev/null
@@ -1,480 +0,0 @@
-/*-
- * Copyright (c) 1999-2001 Boris Popov
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Routines to prepare request and fetch reply
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/errno.h>
-#include <sys/kernel.h>
-#include <sys/malloc.h>
-#include <sys/mbuf.h>
-#include <sys/poll.h>
-#include <sys/proc.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-#include <sys/uio.h>
-
-#include <netncp/ncp.h>
-#include <netncp/ncp_conn.h>
-#include <netncp/ncp_rq.h>
-#include <netncp/ncp_subr.h>
-#include <netncp/ncp_ncp.h>
-#include <netncp/ncp_sock.h>
-#include <netncp/ncp_nls.h>
-
-static MALLOC_DEFINE(M_NCPRQ, "NCPRQ", "NCP request");
-
-static int ncp_sign_packet(struct ncp_conn *conn, struct ncp_rq *rqp, int *size);
-
-int
-ncp_rq_alloc_any(u_int32_t ptype, u_int8_t fn, struct ncp_conn *ncp,
- struct thread *td, struct ucred *cred,
- struct ncp_rq **rqpp)
-{
- struct ncp_rq *rqp;
- int error;
-
- rqp = malloc(sizeof(*rqp), M_NCPRQ, M_WAITOK);
- error = ncp_rq_init_any(rqp, ptype, fn, ncp, td, cred);
- rqp->nr_flags |= NCPR_ALLOCED;
- if (error) {
- ncp_rq_done(rqp);
- return error;
- }
- *rqpp = rqp;
- return 0;
-}
-
-int
-ncp_rq_alloc(u_int8_t fn, struct ncp_conn *ncp,
- struct thread *td, struct ucred *cred, struct ncp_rq **rqpp)
-{
- return ncp_rq_alloc_any(NCP_REQUEST, fn, ncp, td, cred, rqpp);
-}
-
-int
-ncp_rq_alloc_subfn(u_int8_t fn, u_int8_t subfn, struct ncp_conn *ncp,
- struct thread *td, struct ucred *cred, struct ncp_rq **rqpp)
-{
- struct ncp_rq *rqp;
- int error;
-
- error = ncp_rq_alloc_any(NCP_REQUEST, fn, ncp, td, cred, &rqp);
- if (error)
- return error;
- mb_reserve(&rqp->rq, 2);
- mb_put_uint8(&rqp->rq, subfn);
- *rqpp = rqp;
- return 0;
-}
-
-int
-ncp_rq_init_any(struct ncp_rq *rqp, u_int32_t ptype, u_int8_t fn,
- struct ncp_conn *ncp,
- struct thread *td, struct ucred *cred)
-{
- struct ncp_rqhdr *rq;
- struct ncp_bursthdr *brq;
- struct mbchain *mbp;
- int error;
-
- bzero(rqp, sizeof(*rqp));
- error = ncp_conn_access(ncp, cred, NCPM_EXECUTE);
- if (error)
- return error;
- rqp->nr_td = td;
- rqp->nr_cred = cred;
- rqp->nr_conn = ncp;
- mbp = &rqp->rq;
- if (mb_init(mbp) != 0)
- return ENOBUFS;
- switch(ptype) {
- case NCP_PACKET_BURST:
- brq = (struct ncp_bursthdr*)mb_reserve(mbp, sizeof(*brq));
- brq->bh_type = ptype;
- brq->bh_streamtype = 0x2;
- break;
- default:
- rq = (struct ncp_rqhdr*)mb_reserve(mbp, sizeof(*rq));
- rq->type = ptype;
- rq->seq = 0; /* filled later */
- rq->fn = fn;
- break;
- }
- rqp->nr_minrplen = -1;
- return 0;
-}
-
-void
-ncp_rq_done(struct ncp_rq *rqp)
-{
- mb_done(&rqp->rq);
- md_done(&rqp->rp);
- if (rqp->nr_flags & NCPR_ALLOCED)
- free(rqp, M_NCPRQ);
- return;
-}
-
-/*
- * Routines to fill the request
- */
-
-static int
-ncp_rq_pathstrhelp(struct mbchain *mbp, c_caddr_t src, caddr_t dst,
- size_t *srclen, size_t *dstlen)
-{
- int len;
-
- if (*srclen < *dstlen) {
- *dstlen = *srclen;
- len = (int)*srclen;
- } else {
- *srclen = *dstlen;
- len = (int)*dstlen;
- }
- ncp_pathcopy(src, dst, len, mbp->mb_udata);
- return 0;
-}
-
-int
-ncp_rq_pathstring(struct ncp_rq *rqp, int size, const char *name,
- struct ncp_nlstables *nt)
-{
- struct mbchain *mbp = &rqp->rq;
-
- mb_put_uint8(mbp, size);
- mbp->mb_copy = ncp_rq_pathstrhelp;
- mbp->mb_udata = nt;
- return mb_put_mem(mbp, (c_caddr_t)name, size, MB_MCUSTOM);
-}
-
-int
-ncp_rq_pstring(struct ncp_rq *rqp, const char *s)
-{
- u_int len = strlen(s);
- int error;
-
- if (len > 255)
- return EINVAL;
- error = mb_put_uint8(&rqp->rq, len);
- if (error)
- return error;
- return mb_put_mem(&rqp->rq, s, len, MB_MSYSTEM);
-}
-
-int
-ncp_rq_dbase_path(struct ncp_rq *rqp, u_int8_t vol_num, u_int32_t dir_base,
- int namelen, u_char *path, struct ncp_nlstables *nt)
-{
- struct mbchain *mbp = &rqp->rq;
- int complen;
-
- mb_put_uint8(mbp, vol_num);
- mb_put_mem(mbp, (c_caddr_t)&dir_base, sizeof(dir_base), MB_MSYSTEM);
- mb_put_uint8(mbp, 1); /* with dirbase */
- if (path != NULL && path[0]) {
- if (namelen < 0) {
- namelen = *path++;
- mb_put_uint8(mbp, namelen);
- for(; namelen; namelen--) {
- complen = *path++;
- mb_put_uint8(mbp, complen);
- mb_put_mem(mbp, path, complen, MB_MSYSTEM);
- path += complen;
- }
- } else {
- mb_put_uint8(mbp, 1); /* 1 component */
- ncp_rq_pathstring(rqp, namelen, path, nt);
- }
- } else {
- mb_put_uint8(mbp, 0);
- mb_put_uint8(mbp, 0);
- }
- return 0;
-}
-
-/*
- * Make a signature for the current packet and add it at the end of the
- * packet.
- */
-static int
-ncp_sign_packet(struct ncp_conn *conn, struct ncp_rq *rqp, int *size)
-{
- u_char data[64];
- int error;
-
- bzero(data, sizeof(data));
- bcopy(conn->sign_root, data, 8);
- setdle(data, 8, *size);
- m_copydata(rqp->rq.mb_top, sizeof(struct ncp_rqhdr) - 1,
- min((*size) - sizeof(struct ncp_rqhdr)+1, 52), data + 12);
- ncp_sign(conn->sign_state, data, conn->sign_state);
- error = mb_put_mem(&rqp->rq, (caddr_t)conn->sign_state, 8, MB_MSYSTEM);
- if (error)
- return error;
- (*size) += 8;
- return 0;
-}
-
-/*
- * Low level send rpc, here we do not attempt to restore any connection,
- * Connection expected to be locked
- */
-int
-ncp_request_int(struct ncp_rq *rqp)
-{
- struct ncp_conn *conn = rqp->nr_conn;
- struct thread *td = conn->td;
- struct socket *so = conn->ncp_so;
- struct ncp_rqhdr *rq;
- struct ncp_rphdr *rp=NULL;
- struct timeval tv;
- struct mbuf *m, *mreply = NULL;
- struct mbchain *mbp;
- int error, len, dosend, plen = 0, gotpacket;
-
- if (so == NULL) {
- printf("%s: ncp_so is NULL !\n",__func__);
- ncp_conn_invalidate(conn);
- return ENOTCONN;
- }
- if (td == NULL)
- td = curthread; /* XXX maybe procpage ? */
- /*
- * Flush out replies on previous reqs
- */
- tv.tv_sec = 0;
- tv.tv_usec = 0;
- while (selsocket(so, POLLIN, &tv, td) == 0) {
- if (ncp_sock_recv(so, &m, &len) != 0)
- break;
- m_freem(m);
- }
- mbp = &rqp->rq;
- len = mb_fixhdr(mbp);
- rq = mtod(mbp->mb_top, struct ncp_rqhdr *);
- rq->seq = conn->seq;
- m = rqp->rq.mb_top;
-
- switch (rq->fn) {
- case 0x15: case 0x16: case 0x17: case 0x23:
- *(u_int16_t*)(rq + 1) = htons(len - 2 - sizeof(*rq));
- break;
- }
- if (conn->flags & NCPFL_SIGNACTIVE) {
- error = ncp_sign_packet(conn, rqp, &len);
- if (error)
- return error;
- mbp->mb_top->m_pkthdr.len = len;
- }
- rq->conn_low = conn->connid & 0xff;
- /* rq->task = p->p_pgrp->pg_id & 0xff; */ /*p->p_pid*/
- /* XXX: this is temporary fix till I find a better solution */
- rq->task = rq->conn_low;
- rq->conn_high = conn->connid >> 8;
- rqp->rexmit = conn->li.retry_count;
- error = 0;
- for(dosend = 1;;) {
- if (rqp->rexmit-- == 0) {
- error = ETIMEDOUT;
- break;
- }
- error = 0;
- if (dosend) {
- NCPSDEBUG("send:%04x f=%02x c=%d l=%d s=%d t=%d\n",rq->type, rq->fn, (rq->conn_high << 8) + rq->conn_low,
- mbp->mb_top->m_pkthdr.len, rq->seq, rq->task
- );
- error = ncp_sock_send(so, mbp->mb_top, rqp);
- if (error)
- break;
- }
- tv.tv_sec = conn->li.timeout;
- tv.tv_usec = 0;
- error = selsocket(so, POLLIN, &tv, td);
- if (error == EWOULDBLOCK ) /* timeout expired */
- continue;
- error = ncp_chkintr(conn, td);
- if (error)
- break;
- /*
- * At this point it is possible to get more than one
- * reply from server. In general, last reply should be for
- * current request, but not always. So, we loop through
- * all replies to find the right answer and flush others.
- */
- gotpacket = 0; /* nothing good found */
- dosend = 1; /* resend rq if error */
- for (;;) {
- error = 0;
- tv.tv_sec = 0;
- tv.tv_usec = 0;
- if (selsocket(so, POLLIN, &tv, td) != 0)
- break;
-/* if (so->so_rcv.sb_cc == 0) {
- break;
- }*/
- error = ncp_sock_recv(so, &m, &len);
- if (error)
- break; /* must be more checks !!! */
- if (m->m_len < sizeof(*rp)) {
- m = m_pullup(m, sizeof(*rp));
- if (m == NULL) {
- printf("%s: reply too short\n",__func__);
- continue;
- }
- }
- rp = mtod(m, struct ncp_rphdr*);
- if (len == sizeof(*rp) && rp->type == NCP_POSITIVE_ACK) {
- NCPSDEBUG("got positive acknowledge\n");
- m_freem(m);
- rqp->rexmit = conn->li.retry_count;
- dosend = 0; /* server just busy and will reply ASAP */
- continue;
- }
- NCPSDEBUG("recv:%04x c=%d l=%d s=%d t=%d cc=%02x cs=%02x\n",rp->type,
- (rp->conn_high << 8) + rp->conn_low, len, rp->seq, rp->task,
- rp->completion_code, rp->connection_state);
- NCPDDEBUG(m);
- if ( (rp->type == NCP_REPLY) &&
- ((rq->type == NCP_ALLOC_SLOT) ||
- ((rp->conn_low == rq->conn_low) &&
- (rp->conn_high == rq->conn_high)
- ))) {
- if (rq->seq > rp->seq || (rq->seq == 0 && rp->seq == 0xff)) {
- dosend = 1;
- }
- if (rp->seq == rq->seq) {
- if (gotpacket) {
- m_freem(m);
- } else {
- gotpacket = 1;
- mreply = m;
- plen = len;
- }
- continue; /* look up other for other packets */
- }
- }
- m_freem(m);
- NCPSDEBUG("reply mismatch\n");
- } /* for receive */
- if (error || gotpacket)
- break;
- /* try to resend, or just wait */
- }
- conn->seq++;
- if (error) {
- NCPSDEBUG("error=%d\n", error);
- /*
- * Any error except interruped call means that we have
- * to reconnect. So, eliminate future timeouts by invalidating
- * connection now.
- */
- if (error != EINTR)
- ncp_conn_invalidate(conn);
- return (error);
- }
- if (conn->flags & NCPFL_SIGNACTIVE) {
- /* XXX: check reply signature */
- m_adj(mreply, -8);
- plen -= 8;
- }
- rp = mtod(mreply, struct ncp_rphdr*);
- md_initm(&rqp->rp, mreply);
- rqp->nr_rpsize = plen - sizeof(*rp);
- rqp->nr_cc = error = rp->completion_code;
- if (error)
- error |= 0x8900; /* server error */
- rqp->nr_cs = rp->connection_state;
- if (rqp->nr_cs & (NCP_CS_BAD_CONN | NCP_CS_SERVER_DOWN)) {
- NCPSDEBUG("server drop us\n");
- ncp_conn_invalidate(conn);
- error = ECONNRESET;
- }
- md_get_mem(&rqp->rp, NULL, sizeof(*rp), MB_MSYSTEM);
- return error;
-}
-
-/*
- * Here we will try to restore any loggedin & dropped connection,
- * connection should be locked on entry
- */
-static __inline int
-ncp_restore_login(struct ncp_conn *conn)
-{
- int error;
-
- printf("ncprq: Restoring connection, flags = %x\n", conn->flags);
- conn->flags |= NCPFL_RESTORING;
- error = ncp_conn_reconnect(conn);
- if (!error && (conn->flags & NCPFL_WASLOGGED))
- error = ncp_conn_login(conn, conn->td, conn->ucred);
- if (error)
- ncp_ncp_disconnect(conn);
- conn->flags &= ~NCPFL_RESTORING;
- return error;
-}
-
-int
-ncp_request(struct ncp_rq *rqp)
-{
- struct ncp_conn *ncp = rqp->nr_conn;
- int error, rcnt;
-
- error = ncp_conn_lock(ncp, rqp->nr_td, rqp->nr_cred, NCPM_EXECUTE);
- if (error)
- goto out;
- rcnt = NCP_RESTORE_COUNT;
- for(;;) {
- if (ncp->flags & NCPFL_ATTACHED) {
- error = ncp_request_int(rqp);
- if (ncp->flags & NCPFL_ATTACHED)
- break;
- }
- if (rcnt-- == 0) {
- error = ECONNRESET;
- break;
- }
- /*
- * Do not attempt to restore connection recursively
- */
- if (ncp->flags & NCPFL_RESTORING) {
- error = ENOTCONN;
- break;
- }
- error = ncp_restore_login(ncp);
- if (error)
- continue;
- }
- ncp_conn_unlock(ncp, rqp->nr_td);
-out:
- if (error && (rqp->nr_flags & NCPR_DONTFREEONERR) == 0)
- ncp_rq_done(rqp);
- return error;
-}
diff --git a/sys/netncp/ncp_rq.h b/sys/netncp/ncp_rq.h
deleted file mode 100644
index 8d20d3f..0000000
--- a/sys/netncp/ncp_rq.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/*-
- * Copyright (c) 1999, 2000, 2001 Boris Popov
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-#ifndef _NETNCP_NCP_RQ_H_
-#define _NETNCP_NCP_RQ_H_
-
-#include <sys/endian.h>
-
-#define getb(buf,ofs) (((const u_int8_t *)(buf))[ofs])
-#define setb(buf,ofs,val) (((u_int8_t*)(buf))[ofs])=val
-#define getbw(buf,ofs) ((u_int16_t)(getb(buf,ofs)))
-
-#define getwle(buf,ofs) (le16toh(*((u_int16_t*)(&((u_int8_t*)(buf))[ofs]))))
-#define getdle(buf,ofs) (le32toh(*((u_int32_t*)(&((u_int8_t*)(buf))[ofs]))))
-#define getwbe(buf,ofs) (be16toh(*((u_int16_t*)(&((u_int8_t*)(buf))[ofs]))))
-#define getdbe(buf,ofs) (be32toh(*((u_int32_t*)(&((u_int8_t*)(buf))[ofs]))))
-
-#define setwle(buf,ofs,val) \
- (*((u_int16_t*)(&((u_int8_t*)(buf))[ofs])))=htole16(val)
-#define setdle(buf,ofs,val) \
- (*((u_int32_t*)(&((u_int8_t*)(buf))[ofs])))=htole32(val)
-#define setwbe(buf,ofs,val) \
- (*((u_int16_t*)(&((u_int8_t*)(buf))[ofs])))=htobe16(val)
-#define setdbe(buf,ofs,val) \
- (*((u_int32_t*)(&((u_int8_t*)(buf))[ofs])))=htobe32(val)
-
-#ifdef _KERNEL
-
-#include <sys/mchain.h>
-
-#define NCPR_ALLOCED 0x0001 /* request structure was allocated */
-#define NCPR_DONTFREEONERR 0x0002 /* do not free structure on error */
-
-/*
- * Structure to prepare ncp request and receive reply
- */
-struct ncp_rq {
- int nr_flags;
- struct mbchain rq;
- struct mdchain rp;
- int nr_minrplen; /* minimal rp size (-1 if not known) */
- int nr_rpsize; /* reply size minus ncp header */
- int nr_cc; /* completion code */
- int nr_cs; /* connection state */
- struct thread * nr_td; /* thread that did rq */
- struct ucred * nr_cred; /* user that did rq */
- int rexmit;
- struct ncp_conn*nr_conn; /* back link */
-};
-
-int ncp_rq_alloc(u_int8_t fn, struct ncp_conn *ncp, struct thread *td,
- struct ucred *cred, struct ncp_rq **rqpp);
-int ncp_rq_alloc_any(u_int32_t ptype, u_int8_t fn, struct ncp_conn *ncp,
- struct thread *td, struct ucred *cred, struct ncp_rq **rqpp);
-int ncp_rq_alloc_subfn(u_int8_t fn, u_int8_t subfn, struct ncp_conn *ncp,
- struct thread *td, struct ucred *cred, struct ncp_rq **rqpp);
-int ncp_rq_init_any(struct ncp_rq *rqp, u_int32_t ptype, u_int8_t fn,
- struct ncp_conn *ncp,
- struct thread *td, struct ucred *cred);
-void ncp_rq_done(struct ncp_rq *rqp);
-int ncp_request(struct ncp_rq *rqp);
-int ncp_request_int(struct ncp_rq *rqp);
-
-struct ncp_nlstables;
-
-int ncp_rq_pathstring(struct ncp_rq *rqp, int size, const char *name, struct ncp_nlstables*);
-int ncp_rq_dbase_path(struct ncp_rq *, u_int8_t vol_num,
- u_int32_t dir_base, int namelen, u_char *name, struct ncp_nlstables *nt);
-int ncp_rq_pstring(struct ncp_rq *rqp, const char *s);
-
-void ncp_sign_init(const char *logindata, char *sign_root);
-
-#else /* ifdef _KERNEL */
-
-#define DECLARE_RQ struct ncp_buf conn1, *conn=&conn1
-
-#define ncp_add_byte(conn,x) (conn)->packet[(conn)->rqsize++]=x
-
-struct ncp_buf;
-
-__BEGIN_DECLS
-
-void ncp_init_request(struct ncp_buf *);
-void ncp_init_request_s(struct ncp_buf *, int);
-void ncp_add_word_lh(struct ncp_buf *, u_int16_t);
-void ncp_add_dword_lh(struct ncp_buf *, u_int32_t);
-void ncp_add_word_hl(struct ncp_buf *, u_int16_t);
-void ncp_add_dword_hl(struct ncp_buf *, u_int32_t);
-void ncp_add_mem(struct ncp_buf *, const void *, int);
-void ncp_add_mem_nls(struct ncp_buf *, const void *, int);
-void ncp_add_pstring(struct ncp_buf *, const char *);
-void ncp_add_handle_path(struct ncp_buf *, nuint32, nuint32, int, const char *);
-
-#define ncp_reply_data(conn,offset) ((conn)->packet+offset)
-#define ncp_reply_byte(conn,offset) (*(u_int8_t*)(ncp_reply_data(conn, offset)))
-
-u_int16_t ncp_reply_word_hl(struct ncp_buf *, int);
-u_int16_t ncp_reply_word_lh(struct ncp_buf *, int);
-u_int32_t ncp_reply_dword_hl(struct ncp_buf *, int);
-u_int32_t ncp_reply_dword_lh(struct ncp_buf *, int);
-
-static __inline void
-ConvertToNWfromDWORD(u_int32_t sfd, ncp_fh *fh) {
- fh->val1 = (fh->val.val32 = sfd);
- return;
-}
-
-__END_DECLS
-
-#endif /* ifdef _KERNEL */
-
-#endif /* !_NETNCP_NCP_RQ_H_ */
diff --git a/sys/netncp/ncp_sock.c b/sys/netncp/ncp_sock.c
deleted file mode 100644
index 24557be..0000000
--- a/sys/netncp/ncp_sock.c
+++ /dev/null
@@ -1,381 +0,0 @@
-/*-
- * Copyright (c) 1999, 2001 Boris Popov
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Low level socket routines
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/errno.h>
-#include <sys/lock.h>
-#include <sys/malloc.h>
-#include <sys/mutex.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-#include <sys/protosw.h>
-#include <sys/kernel.h>
-#include <sys/uio.h>
-#include <sys/syslog.h>
-#include <sys/mbuf.h>
-#include <sys/condvar.h>
-#include <net/route.h>
-
-#include <netipx/ipx.h>
-#include <netipx/ipx_pcb.h>
-
-#include <netncp/ncp.h>
-#include <netncp/ncp_conn.h>
-#include <netncp/ncp_sock.h>
-#include <netncp/ncp_subr.h>
-#include <netncp/ncp_rq.h>
-
-#define ipx_setnullnet(x) ((x).x_net.s_net[0]=0); ((x).x_net.s_net[1]=0);
-#define ipx_setnullhost(x) ((x).x_host.s_host[0] = 0); \
- ((x).x_host.s_host[1] = 0); ((x).x_host.s_host[2] = 0);
-
-/*static int ncp_getsockname(struct socket *so, caddr_t asa, int *alen);*/
-static int ncp_soconnect(struct socket *so, struct sockaddr *target,
- struct thread *td);
-
-
-/* This will need only if native IP used, or (unlikely) NCP will be
- * implemented on the socket level
- */
-static int
-ncp_soconnect(struct socket *so, struct sockaddr *target, struct thread *td)
-{
- int error, s;
-
- error = soconnect(so, (struct sockaddr*)target, td);
- if (error)
- return error;
- /*
- * Wait for the connection to complete. Cribbed from the
- * connect system call but with the wait timing out so
- * that interruptible mounts don't hang here for a long time.
- */
- error = EIO;
- s = splnet();
- while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) {
- (void) tsleep((caddr_t)&so->so_timeo, PSOCK, "ncpcon", 2 * hz);
- if ((so->so_state & SS_ISCONNECTING) &&
- so->so_error == 0 /*&& rep &&*/) {
- so->so_state &= ~SS_ISCONNECTING;
- splx(s);
- goto bad;
- }
- }
- if (so->so_error) {
- error = so->so_error;
- so->so_error = 0;
- splx(s);
- goto bad;
- }
- splx(s);
- error=0;
-bad:
- return error;
-}
-#ifdef notyet
-static int
-ncp_getsockname(struct socket *so, caddr_t asa, int *alen) {
- struct sockaddr *sa;
- int len=0, error;
-
- sa = 0;
- error = (*so->so_proto->pr_usrreqs->pru_sockaddr)(so, &sa);
- if (error==0) {
- if (sa) {
- len = min(len, sa->sa_len);
- bcopy(sa, (caddr_t)asa, (u_int)len);
- }
- *alen=len;
- }
- if (sa)
- free(sa, M_SONAME);
- return (error);
-}
-#endif
-int ncp_sock_recv(struct socket *so, struct mbuf **mp, int *rlen)
-{
- struct uio auio;
- struct thread *td = curthread; /* XXX */
- int error,flags,len;
-
- auio.uio_resid = len = 1000000;
- auio.uio_td = td;
- flags = MSG_DONTWAIT;
-
-/* error = soreceive(so, 0, &auio, (struct mbuf **)0, (struct mbuf **)0,
- &flags);*/
- error = soreceive(so, 0, &auio, mp, (struct mbuf **)0, &flags);
- *rlen = len - auio.uio_resid;
-/* if (!error) {
- *rlen=iov.iov_len;
- } else
- *rlen=0;*/
-#ifdef NCP_SOCKET_DEBUG
- if (error)
- printf("ncp_recv: err=%d\n", error);
-#endif
- return (error);
-}
-
-int
-ncp_sock_send(struct socket *so, struct mbuf *top, struct ncp_rq *rqp)
-{
- struct thread *td = curthread; /* XXX */
- struct sockaddr *to = 0;
- struct ncp_conn *conn = rqp->nr_conn;
- struct mbuf *m;
- int error, flags=0;
-
- for (;;) {
- m = m_copym(top, 0, M_COPYALL, M_WAITOK);
-/* NCPDDEBUG(m);*/
- error = sosend(so, to, 0, m, 0, flags, td);
- if (error == 0 || error == EINTR || error == ENETDOWN)
- break;
- if (rqp->rexmit == 0) break;
- rqp->rexmit--;
- pause("ncprsn", conn->li.timeout * hz);
- error = ncp_chkintr(conn, td);
- if (error == EINTR) break;
- }
- if (error) {
- log(LOG_INFO, "ncp_send: error %d for server %s", error, conn->li.server);
- }
- return error;
-}
-
-/*
- * Connect to specified server via IPX
- */
-static int
-ncp_sock_connect_ipx(struct ncp_conn *conn)
-{
- struct sockaddr_ipx sipx;
- struct ipxpcb *npcb;
- struct thread *td = conn->td;
- int addrlen, error, count;
-
- sipx.sipx_port = htons(0);
-
- for (count = 0;;count++) {
- if (count > (IPXPORT_WELLKNOWN-IPXPORT_RESERVED)*2) {
- error = EADDRINUSE;
- goto bad;
- }
- conn->ncp_so = conn->wdg_so = NULL;
- checkbad(socreate(AF_IPX, &conn->ncp_so, SOCK_DGRAM, 0, td->td_ucred, td));
- if (conn->li.opt & NCP_OPT_WDOG)
- checkbad(socreate(AF_IPX, &conn->wdg_so, SOCK_DGRAM, 0, td->td_ucred, td));
- addrlen = sizeof(sipx);
- sipx.sipx_family = AF_IPX;
- ipx_setnullnet(sipx.sipx_addr);
- ipx_setnullhost(sipx.sipx_addr);
- sipx.sipx_len = addrlen;
- error = sobind(conn->ncp_so, (struct sockaddr *)&sipx, td);
- if (error == 0) {
- if ((conn->li.opt & NCP_OPT_WDOG) == 0)
- break;
- sipx.sipx_addr = sotoipxpcb(conn->ncp_so)->ipxp_laddr;
- sipx.sipx_port = htons(ntohs(sipx.sipx_port) + 1);
- ipx_setnullnet(sipx.sipx_addr);
- ipx_setnullhost(sipx.sipx_addr);
- error = sobind(conn->wdg_so, (struct sockaddr *)&sipx, td);
- }
- if (!error) break;
- if (error != EADDRINUSE) goto bad;
- sipx.sipx_port = htons((ntohs(sipx.sipx_port)+4) & 0xfff8);
- soclose(conn->ncp_so);
- if (conn->wdg_so)
- soclose(conn->wdg_so);
- }
- npcb = sotoipxpcb(conn->ncp_so);
- npcb->ipxp_dpt = IPXPROTO_NCP;
- /* IPXrouted must be running, i.e. route must be presented */
- conn->li.ipxaddr.sipx_len = sizeof(struct sockaddr_ipx);
- checkbad(ncp_soconnect(conn->ncp_so, &conn->li.saddr, td));
- if (conn->wdg_so) {
- sotoipxpcb(conn->wdg_so)->ipxp_laddr.x_net = npcb->ipxp_laddr.x_net;
- sotoipxpcb(conn->wdg_so)->ipxp_laddr.x_host= npcb->ipxp_laddr.x_host;
- }
- if (!error) {
- conn->flags |= NCPFL_SOCONN;
- }
-#ifdef NCPBURST
- if (ncp_burst_enabled) {
- checkbad(socreate(AF_IPX, &conn->bc_so, SOCK_DGRAM, 0, td));
- bzero(&sipx, sizeof(sipx));
- sipx.sipx_len = sizeof(sipx);
- checkbad(sobind(conn->bc_so, (struct sockaddr *)&sipx, td));
- checkbad(ncp_soconnect(conn->bc_so, &conn->li.saddr, td));
- }
-#endif
- if (!error) {
- conn->flags |= NCPFL_SOCONN;
- ncp_sock_checksum(conn, 0);
- }
- return error;
-bad:
- ncp_sock_disconnect(conn);
- return (error);
-}
-
-int
-ncp_sock_checksum(struct ncp_conn *conn, int enable)
-{
-
- if (enable) {
- sotoipxpcb(conn->ncp_so)->ipxp_flags |= IPXP_CHECKSUM;
- } else {
- sotoipxpcb(conn->ncp_so)->ipxp_flags &= ~IPXP_CHECKSUM;
- }
- return 0;
-}
-
-/*
- * Connect to specified server via IP
- */
-static int
-ncp_sock_connect_in(struct ncp_conn *conn)
-{
- struct sockaddr_in sin;
- struct thread *td = conn->td;
- int addrlen = sizeof(sin), error;
-
- conn->flags = 0;
- bzero(&sin,addrlen);
- conn->ncp_so = conn->wdg_so = NULL;
- checkbad(socreate(AF_INET, &conn->ncp_so, SOCK_DGRAM, IPPROTO_UDP, td->td_ucred, td));
- sin.sin_family = AF_INET;
- sin.sin_len = addrlen;
- checkbad(sobind(conn->ncp_so, (struct sockaddr *)&sin, td));
- checkbad(ncp_soconnect(conn->ncp_so,(struct sockaddr*)&conn->li.addr, td));
- if (!error)
- conn->flags |= NCPFL_SOCONN;
- return error;
-bad:
- ncp_sock_disconnect(conn);
- return (error);
-}
-
-int
-ncp_sock_connect(struct ncp_conn *ncp)
-{
- int error;
-
- switch (ncp->li.saddr.sa_family) {
- case AF_IPX:
- error = ncp_sock_connect_ipx(ncp);
- break;
- case AF_INET:
- error = ncp_sock_connect_in(ncp);
- break;
- default:
- return EPROTONOSUPPORT;
- }
- return error;
-}
-
-/*
- * Connection expected to be locked
- */
-int
-ncp_sock_disconnect(struct ncp_conn *conn) {
- register struct socket *so;
- conn->flags &= ~(NCPFL_SOCONN | NCPFL_ATTACHED | NCPFL_LOGGED);
- if (conn->ncp_so) {
- so = conn->ncp_so;
- conn->ncp_so = (struct socket *)0;
- soshutdown(so, 2);
- soclose(so);
- }
- if (conn->wdg_so) {
- so = conn->wdg_so;
- conn->wdg_so = (struct socket *)0;
- soshutdown(so, 2);
- soclose(so);
- }
-#ifdef NCPBURST
- if (conn->bc_so) {
- so = conn->bc_so;
- conn->bc_so = (struct socket *)NULL;
- soshutdown(so, 2);
- soclose(so);
- }
-#endif
- return 0;
-}
-
-static void
-ncp_watchdog(struct ncp_conn *conn) {
- char *buf;
- struct mbuf *m;
- int error, len, flags;
- struct socket *so;
- struct sockaddr *sa;
- struct uio auio;
-
- sa = NULL;
- while (conn->wdg_so) { /* not a loop */
- so = conn->wdg_so;
- auio.uio_resid = len = 1000000;
- auio.uio_td = curthread;
- flags = MSG_DONTWAIT;
- error = soreceive(so, (struct sockaddr**)&sa, &auio, &m,
- (struct mbuf**)0, &flags);
- if (error) break;
- len -= auio.uio_resid;
- NCPSDEBUG("got watch dog %d\n",len);
- if (len != 2) break;
- buf = mtod(m, char*);
- if (buf[1] != '?') break;
- buf[1] = 'Y';
- error = sosend(so, (struct sockaddr*)sa, 0, m, 0, 0, curthread);
- NCPSDEBUG("send watch dog %d\n",error);
- break;
- }
- if (sa) free(sa, M_SONAME);
- return;
-}
-
-void
-ncp_check_conn(struct ncp_conn *conn) {
- int s;
-
- if (conn == NULL || !(conn->flags & NCPFL_ATTACHED))
- return;
- s = splnet();
- ncp_check_rq(conn);
- splx(s);
- if (conn->li.saddr.sa_family == AF_IPX)
- ncp_watchdog(conn);
-}
diff --git a/sys/netncp/ncp_sock.h b/sys/netncp/ncp_sock.h
deleted file mode 100644
index f8feac5..0000000
--- a/sys/netncp/ncp_sock.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*-
- * Copyright (c) 1999 Boris Popov
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-#ifndef _NETNCP_NCP_SOCK_H_
-#define _NETNCP_NCP_SOCK_H_
-
-struct ncp_conn;
-struct mbuf;
-struct ncp_rq;
-struct proc;
-struct socket;
-struct timeval;
-
-int ncp_sock_connect(struct ncp_conn *ncp);
-int ncp_sock_recv(struct socket *so, struct mbuf **mp, int *rlen);
-int ncp_sock_send(struct socket *so, struct mbuf *data, struct ncp_rq *rqp);
-int ncp_sock_disconnect(struct ncp_conn *conn);
-int ncp_sock_checksum(struct ncp_conn *conn, int enable);
-
-void ncp_check_rq(struct ncp_conn *conn);
-void ncp_check_conn(struct ncp_conn *conn);
-
-void ncp_check_wd(struct ncp_conn *conn);
-
-#endif /* _NCP_SOCK_H_ */
diff --git a/sys/netncp/ncp_subr.c b/sys/netncp/ncp_subr.c
deleted file mode 100644
index 6664dbd..0000000
--- a/sys/netncp/ncp_subr.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/*-
- * Copyright (c) 1999, 2000, 2001 Boris Popov
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/errno.h>
-#include <sys/eventhandler.h>
-#include <sys/kernel.h>
-#include <sys/lock.h>
-#include <sys/malloc.h>
-#include <sys/proc.h>
-#include <sys/sysctl.h>
-#include <sys/time.h>
-
-#include <netncp/ncp.h>
-#include <netncp/ncp_conn.h>
-#include <netncp/ncp_sock.h>
-#include <netncp/ncp_subr.h>
-#include <netncp/ncp_rq.h>
-#include <netncp/ncp_ncp.h>
-#include <netncp/nwerror.h>
-
-int ncp_debuglevel = 0;
-
-struct callout_handle ncp_timer_handle;
-static eventhandler_tag ncp_exit_tag;
-
-static void ncp_at_exit(void *arg, struct proc *p);
-static void ncp_timer(void *arg);
-
-/*
- * duplicate string from user space. It should be very-very slow.
- */
-char *
-ncp_str_dup(char *s) {
- char *p, bt;
- int len = 0;
-
- for (p = s;;p++) {
- if (copyin(p, &bt, 1)) return NULL;
- len++;
- if (bt == 0) break;
- }
- p = malloc(len, M_NCPDATA, M_WAITOK);
- copyin(s, p, len);
- return p;
-}
-
-
-void
-ncp_at_exit(void *arg, struct proc *p)
-{
- struct ncp_conn *ncp, *nncp;
- struct thread *td;
-
- mtx_lock(&Giant);
- FOREACH_THREAD_IN_PROC(p, td) {
- if (ncp_conn_putprochandles(td) == 0)
- continue;
-
- ncp_conn_locklist(LK_EXCLUSIVE, td);
- for (ncp = SLIST_FIRST(&conn_list); ncp; ncp = nncp) {
- nncp = SLIST_NEXT(ncp, nc_next);
- if (ncp_conn_lock(ncp, td, td->td_ucred,
- NCPM_READ | NCPM_EXECUTE | NCPM_WRITE))
- continue;
- if (ncp_conn_free(ncp) != 0)
- ncp_conn_unlock(ncp, td);
- }
- ncp_conn_unlocklist(td);
- }
- mtx_unlock(&Giant);
-}
-
-int
-ncp_init(void)
-{
- ncp_conn_init();
- ncp_exit_tag = EVENTHANDLER_REGISTER(process_exit, ncp_at_exit, NULL,
- EVENTHANDLER_PRI_ANY);
- ncp_timer_handle = timeout(ncp_timer, NULL, NCP_TIMER_TICK);
- return 0;
-}
-
-int
-ncp_done(void)
-{
- int error;
-
- error = ncp_conn_destroy();
- if (error)
- return error;
- untimeout(ncp_timer, NULL, ncp_timer_handle);
- EVENTHANDLER_DEREGISTER(process_exit, ncp_exit_tag);
- return 0;
-}
-
-
-/* tick every second and check for watch dog packets and lost connections */
-static void
-ncp_timer(void *arg)
-{
- struct ncp_conn *conn;
-
- if(ncp_conn_locklist(LK_SHARED | LK_NOWAIT, NULL) == 0) {
- SLIST_FOREACH(conn, &conn_list, nc_next)
- ncp_check_conn(conn);
- ncp_conn_unlocklist(NULL);
- }
- ncp_timer_handle = timeout(ncp_timer, NULL, NCP_TIMER_TICK);
-}
diff --git a/sys/netncp/ncp_subr.h b/sys/netncp/ncp_subr.h
deleted file mode 100644
index a0d3ce9..0000000
--- a/sys/netncp/ncp_subr.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/*-
- * Copyright (c) 1999 Boris Popov
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-#ifndef _NETNCP_NCP_SUBR_H_
-#define _NETNCP_NCP_SUBR_H_
-
-#define NCP_TIMER_TICK 2*hz /* 1sec */
-#define NCP_SIGMASK(set) \
- (SIGISMEMBER(set, SIGINT) || SIGISMEMBER(set, SIGTERM) || \
- SIGISMEMBER(set, SIGHUP) || SIGISMEMBER(set, SIGKILL) || \
- SIGISMEMBER(set, SIGQUIT))
-
-
-#define NCP_PRINT(format, args...) printf("FATAL: %s: "format, __func__ ,## args)
-#define nwfs_printf NCP_PRINT
-/* Maybe this should panic, but I dont like that */
-#define NCPFATAL NCP_PRINT
-#define NCPERROR NCP_PRINT
-
-/* socket debugging */
-#ifdef NCP_SOCKET_DEBUG
-#define NCPSDEBUG(format, args...) printf("%s: "format, __func__ ,## args)
-#else
-#define NCPSDEBUG(format, args...)
-#endif
-
-/* NCP calls debug */
-#ifdef NCP_NCP_DEBUG
-#define NCPNDEBUG(format, args...) printf("%s: "format, __func__ ,## args)
-#else
-#define NCPNDEBUG(format, args...)
-#endif
-
-/* NCP data dump */
-#ifdef NCP_DATA_DEBUG
-#define NCPDDEBUG(m) m_dumpm(m)
-#else
-#define NCPDDEBUG(m)
-#endif
-
-/* FS VOPS debug */
-#ifdef NWFS_VOPS_DEBUG
-#define NCPVODEBUG(format, args...) printf("%s: "format, __func__ ,## args)
-#else
-#define NCPVODEBUG(format, args...)
-#endif
-
-/* FS VNOPS debug */
-#ifdef NWFS_VNOPS_DEBUG
-#define NCPVNDEBUG(format, args...) printf("%s: "format, __func__ ,## args)
-#else
-#define NCPVNDEBUG(format, args...)
-#endif
-
-#define checkbad(fn) {error=(fn);if(error) goto bad;}
-
-#define ncp_suser(cred) priv_check_cred(cred, PRIV_NETNCP, 0)
-
-#define ncp_isowner(conn,cred) ((cred)->cr_uid == (conn)->nc_owner->cr_uid)
-
-struct ncp_conn;
-
-struct nwmount;
-struct vnode;
-struct nwnode;
-struct vattr;
-struct uio;
-struct ncp_nlstables;
-
-struct ncp_open_info {
- u_int32_t origfh;
- ncp_fh fh;
- u_int8_t action;
- struct nw_entry_info fattr;
-};
-
-extern int ncp_debuglevel;
-
-struct proc;
-struct ucred;
-
-int ncp_init(void);
-int ncp_done(void);
-int ncp_chkintr(struct ncp_conn *conn, struct thread *td);
-char*ncp_str_dup(char *s);
-
-/* ncp_crypt.c */
-void nw_keyhash(const u_char *key, const u_char *buf, int buflen, u_char *target);
-void nw_encrypt(const u_char *fra, const u_char *buf, u_char *target);
-void ncp_sign(const u_int32_t *state, const char *x, u_int32_t *ostate);
-
-#endif /* _NCP_SUBR_H_ */
diff --git a/sys/netncp/ncp_user.h b/sys/netncp/ncp_user.h
deleted file mode 100644
index 832715e..0000000
--- a/sys/netncp/ncp_user.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*-
- * Copyright (c) 1999 Boris Popov
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-#ifndef _NETNCP_NCP_USER_H_
-#define _NETNCP_NCP_USER_H_
-
-/*
- * "ncp" interface to kernel, this can be done via syscalls but may eat
- * a lot of them, so we select internal code, define req's and replays
- * as necessary. Structure for call is simple:
- * byte=NCP_CONN
- * byte=NCP_CONN_SUBFN
- * ....=data
- */
-#define NCP_CONN 0xF5 /* change if that will occupied */
-#define NCP_CONN_READ 0x01 /* read from file handle */
-#define NCP_CONN_WRITE 0x02 /* write to file handle */
-#define NCP_CONN_SETFLAGS 0x03 /* word mask, word flags */
-#define NCP_CONN_LOGIN 0x04 /* bind login on handle */
-#define NCP_CONN_GETINFO 0x05 /* get information about connection */
-#define NCP_CONN_GETUSER 0x06 /* get user name for connection */
-#define NCP_CONN_CONN2REF 0x07 /* convert handle to reference */
-#define NCP_CONN_CONNCLOSE 0x08 /* release connection handle */
-#define NCP_CONN_FRAG 0x09 /* ncp fragmented request */
-#define NCP_CONN_DUP 0x0A /* get an additional handle */
-#define NCP_CONN_GETDATA 0x0B /* retrieve NCP_CD_* vals */
-#define NCP_CONN_SETDATA 0x0C /* store NCP_CD_* vals */
-
-/*
- * Internal connection data can be set by owner or superuser and retrieved
- * only by superuser
- */
-#define NCP_CD_NDSLOGINKEY 0x01
-#define NCP_CD_NDSPRIVATEKEY 0x02
-#define NCP_CD_NDSUFLAGS 0x03
-
-/* user side structures to issue fragmented ncp calls */
-typedef struct {
- char *fragAddress;
- u_int32_t fragSize;
-} NW_FRAGMENT;
-
-
-struct ncp_rw {
- ncp_fh nrw_fh;
- char *nrw_base;
- off_t nrw_offset;
- int nrw_cnt;
-};
-
-struct ncp_conn_login {
- char *username;
- int objtype;
- char *password;
-};
-
-struct ncp_conn_frag {
- int cc; /* completion code */
- int cs; /* connection state */
- int fn;
- int rqfcnt;
- NW_FRAGMENT *rqf;
- int rpfcnt;
- NW_FRAGMENT *rpf;
-};
-
-#endif
diff --git a/sys/netncp/ncpio.h b/sys/netncp/ncpio.h
deleted file mode 100644
index 53c90ea..0000000
--- a/sys/netncp/ncpio.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*-
- * Copyright (c) 2003 Tim J. Robbins.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#ifndef _NETNCP_NCPIO_H_
-#define _NETNCP_NCPIO_H_
-
-#ifndef _KERNEL
-#include <sys/types.h>
-#endif
-#include <sys/ioccom.h>
-
-#define NCP_NAME "ncp"
-
-struct ncp_conn_args;
-struct ncp_buf;
-
-struct ncpioc_connect {
- struct ncp_conn_args *ioc_li;
- int *ioc_connhandle;
-};
-
-struct ncpioc_request {
- int ioc_connhandle;
- int ioc_fn;
- struct ncp_buf *ioc_ncpbuf;
-};
-
-struct ncpioc_connscan {
- struct ncp_conn_args *ioc_li;
- int *ioc_connhandle;
-};
-
-#define NCPIOC_CONNECT _IOW('N', 100, struct ncpioc_connect)
-#define NCPIOC_REQUEST _IOW('N', 101, struct ncpioc_request)
-#define NCPIOC_CONNSCAN _IOW('N', 102, struct ncpioc_connscan)
-
-#endif /* _NETNCP_NCPIO_H_ */
diff --git a/sys/netncp/nwerror.h b/sys/netncp/nwerror.h
deleted file mode 100644
index 8dc7a93..0000000
--- a/sys/netncp/nwerror.h
+++ /dev/null
@@ -1,634 +0,0 @@
-/*
- * NetWare requestor error codes, they taken from NDK
- *
- * $FreeBSD$
- */
-#ifndef _NETNCP_NWERROR_H_
-#define _NETNCP_NWERROR_H_
-
-#ifndef SUCCESS
-#define SUCCESS 0
-#endif
-
-#define SHELL_ERROR 0x8800
-#define VLM_ERROR 0x8800
-#define ALREADY_ATTACHED 0x8800 /* 0 - Attach attempted to server with valid, existing connection */
-#define INVALID_CONNECTION 0x8801 /* 1 - Request attempted with invalid or non-attached connection handle */
-#define DRIVE_IN_USE 0x8802 /* 2 - OS/2 only (NOT USED) */
-#define CANT_ADD_CDS 0x8803 /* 3 - Map drive attempted but unable to add new current directory structure */
-#define DRIVE_CANNOT_MAP 0x8803
-#define BAD_DRIVE_BASE 0x8804 /* 4 - Map drive attempted with invalid path specification */
-#define NET_READ_ERROR 0x8805 /* 5 - Attempt to receive from the selected transport failed */
-#define NET_RECV_ERROR 0x8805 /* 5 */
-#define UNKNOWN_NET_ERROR 0x8806 /* 6 - Network send attempted with an un-specific network error */
-#define SERVER_INVALID_SLOT 0x8807 /* 7 - Server request attempted with invalid server connection slot */
-#define BAD_SERVER_SLOT 0x8807 /* 7 */
-#define NO_SERVER_SLOTS 0x8808 /* 8 - Attach attempted to server with no connection slots available */
-#define NET_WRITE_ERROR 0x8809 /* 9 - Attempt to send on the selected transport failed */
-#define CONNECTION_IN_ERROR_STATE 0x8809 /* Client-32 */
-#define NET_SEND_ERROR 0x8809 /* 9 */
-#define SERVER_NO_ROUTE 0x880A /* 10 - Attempted to find route to server where no route exists */
-#define BAD_LOCAL_TARGET 0x880B /* 11 - OS/2 only */
-#define TOO_MANY_REQ_FRAGS 0x880C /* 12 - Attempted request with too many request fragments specified */
-#define CONNECT_LIST_OVERFLOW 0x880D /* 13 */
-#define BUFFER_OVERFLOW 0x880E /* 14 - Attempt to receive more data than the reply buffer had room for */
-#define MORE_DATA_ERROR 0x880E /* Client-32 */
-#define NO_CONN_TO_SERVER 0x880F /* 15 */
-#define NO_CONNECTION_TO_SERVER 0x880F /* 15 - Attempt to get connection for a server not connected */
-#define NO_ROUTER_FOUND 0x8810 /* 16 - OS/2 only */
-#define BAD_FUNC_ERROR 0x8811 /* 17 */
-#define INVALID_SHELL_CALL 0x8811 /* 17 - Attempted function call to non- existent or illegal function */
-#define SCAN_COMPLETE 0x8812
-#define LIP_RESIZE_ERROR 0x8812 /* Client-32 */
-#define UNSUPPORTED_NAME_FORMAT_TYPE 0x8813
-#define INVALID_DIR_HANDLE 0x8813 /* Client-32 */
-#define HANDLE_ALREADY_LICENSED 0x8814
-#define OUT_OF_CLIENT_MEMORY 0x8814 /* Client-32 */
-#define HANDLE_ALREADY_UNLICENSED 0x8815
-#define PATH_NOT_OURS 0x8815 /* Client-32 */
-#define INVALID_NCP_PACKET_LENGTH 0x8816
-#define PATH_IS_PRINT_DEVICE 0x8816 /* Client-32 */
-#define SETTING_UP_TIMEOUT 0x8817
-#define PATH_IS_EXCLUDED_DEVICE 0x8817 /* Client-32 */
-#define SETTING_SIGNALS 0x8818
-#define PATH_IS_INVALID 0x8818 /* Client-32 */
-#define SERVER_CONNECTION_LOST 0x8819
-#define NOT_SAME_DEVICE 0x8819 /* Client-32 */
-#define OUT_OF_HEAP_SPACE 0x881A
-#define INVALID_SERVICE_REQUEST 0x881B
-#define INVALID_SEARCH_HANDLE 0x881B /* Client-32 */
-#define INVALID_TASK_NUMBER 0x881C
-#define INVALID_DEVICE_HANDLE 0x881C /* Client-32 */
-#define INVALID_MESSAGE_LENGTH 0x881D
-#define INVALID_SEM_HANDLE 0x881D /* Client-32 */
-#define EA_SCAN_DONE 0x881E
-#define INVALID_CFG_HANDLE 0x881E /* Client-32 */
-#define BAD_CONNECTION_NUMBER 0x881F
-#define INVALID_MOD_HANDLE 0x881F /* Client-32 */
-#define ASYN_FIRST_PASS 0x8820
-#define INVALID_DEVICE_INDEX 0x8821
-#define INVALID_CONN_HANDLE 0x8822
-#define INVALID_QUEUE_ID 0x8823
-#define INVALID_PDEVICE_HANDLE 0x8824
-#define INVALID_JOB_HANDLE 0x8825
-#define INVALID_ELEMENT_ID 0x8826
-#define ALIAS_NOT_FOUND 0x8827
-#define RESOURCE_SUSPENDED 0x8828
-#define INVALID_QUEUE_SPECIFIED 0x8829
-#define DEVICE_ALREADY_OPEN 0x882A
-#define JOB_ALREADY_OPEN 0x882B
-#define QUEUE_NAME_ID_MISMATCH 0x882C
-#define JOB_ALREADY_STARTED 0x882D
-#define SPECT_DAA_TYPE_NOT_SUPPORTED 0x882E
-#define INVALID_ENVIR_HANDLE 0x882F
-#define NOT_SAME_CONNECTION 0x8830 /* 48 - Internal server request attempted accross different server connections */
-#define PRIMARY_CONNECTION_NOT_SET 0x8831 /* 49 - Attempt to retrieve default connection with no primary connection set */
-#define NO_PRIMARY_SET 0x8831 /* 49 */
-#define KEYWORD_NOT_FOUND 0x8832 /* Client-32 */
-#define PRINT_CAPTURE_NOT_IN_PROGRESS 0x8832 /* Client-32 */
-#define NO_CAPTURE_SET 0x8832 /* 50 */
-#define NO_CAPTURE_IN_PROGRESS 0x8832 /* 50 - Capture information requested on port with no capture in progress */
-#define BAD_BUFFER_LENGTH 0x8833 /* 51 */
-#define INVALID_BUFFER_LENGTH 0x8833 /* 51 - Used to indicate length which caller requested on a GetDNC or SetDNC was too large */
-#define NO_USER_NAME 0x8834 /* 52 */
-#define NO_NETWARE_PRINT_SPOOLER 0x8835 /* 53 - Capture requested without having the local print spooler installed */
-#define INVALID_PARAMETER 0x8836 /* 54 - Attempted function with an invalid function parameter specified */
-#define CONFIG_FILE_OPEN_FAILED 0x8837 /* 55 - OS/2 only */
-#define NO_CONFIG_FILE 0x8838 /* 56 - OS/2 only */
-#define CONFIG_FILE_READ_FAILED 0x8839 /* 57 - OS/2 only */
-#define CONFIG_LINE_TOO_LONG 0x883A /* 58 - OS/2 only */
-#define CONFIG_LINES_IGNORED 0x883B /* 59 - OS/2 only */
-#define NOT_MY_RESOURCE 0x883C /* 60 - Attempted request made with a parameter using foriegn resource */
-#define DAEMON_INSTALLED 0x883D /* 61 - OS/2 only */
-#define SPOOLER_INSTALLED 0x883E /* 62 - Attempted load of print spooler with print spooler already installed */
-#define CONN_TABLE_FULL 0x883F /* 63 */
-#define CONNECTION_TABLE_FULL 0x883F /* 63 - Attempted to allocate a connection handle with no more local connection table entries */
-#define CONFIG_SECTION_NOT_FOUND 0x8840 /* 64 - OS/2 only */
-#define BAD_TRAN_TYPE 0x8841 /* 65 */
-#define INVALID_TRANSPORT_TYPE 0x8841 /* 65 - Attempted function on a connection with an invalid transport selected */
-#define TDS_TAG_IN_USE 0x8842 /* 66 - OS/2 only */
-#define TDS_OUT_OF_MEMORY 0x8843 /* 67 - OS/2 only */
-#define TDS_INVALID_TAG 0x8844 /* 68 - Attempted TDS function with invalid tag */
-#define TDS_WRITE_TRUNCATED 0x8845 /* 69 - Attempted TDS write with buffer that exceeded buffer */
-#define NO_CONNECTION_TO_DS 0x8846 /* Client-32 */
-#define NO_DIRECTORY_SERVICE_CONNECTION 0x8846 /* 70 */
-#define SERVICE_BUSY 0x8846 /* 70 - Attempted request made to partially asynchronous function in busy state */
-#define NO_SERVER_ERROR 0x8847 /* 71 - Attempted connect failed to find any servers responding */
-#define BAD_VLM_ERROR 0x8848 /* 72 - Attempted function call to non-existant or not-loaded overlay */
-#define NETWORK_DRIVE_IN_USE 0x8849 /* 73 - Attempted map to network drive that was already mapped */
-#define LOCAL_DRIVE_IN_USE 0x884A /* 74 - Attempted map to local drive that was in use */
-#define NO_DRIVES_AVAILABLE 0x884B /* 75 - Attempted map to next available drive when none were available */
-#define DEVICE_NOT_REDIRECTED 0x884C /* 76 - The device is not redirected */
-#define NO_MORE_SFT_ENTRIES 0x884D /* 77 - Maximum number of files was reached */
-#define UNLOAD_ERROR 0x884E /* 78 - Attempted unload failed */
-#define IN_USE_ERROR 0x884F /* 79 - Attempted re-use of already in use connection entry */
-#define TOO_MANY_REP_FRAGS 0x8850 /* 80 - Attempted request with too many reply fragments specified */
-#define TABLE_FULL 0x8851 /* 81 - Attempted to add a name into the name table after it was full */
-#ifndef SOCKET_NOT_OPEN
-#define SOCKET_NOT_OPEN 0x8852 /* 82 - Listen was posted on unopened socket */
-#endif
-#define MEM_MGR_ERROR 0x8853 /* 83 - Attempted enhanced memory operation failed */
-#define SFT3_ERROR 0x8854 /* 84 - An SFT3 switch occured mid-transfer */
-#define PREFERRED_NOT_FOUND 0x8855 /* 85 - the preferred directory server was not established but another directory server was returned */
-#define DEVICE_NOT_RECOGNIZED 0x8856 /* 86 - used to determine if the device is not used by VISE so pass it on to the next redirector, if any. */
-#define BAD_NET_TYPE 0x8857 /* 87 - the network type (Bind/NDS) does not match the server version */
-#define ERROR_OPENING_FILE 0x8858 /* 88 - generic open failure error, invalid path, access denied, etc.. */
-#define NO_PREFERRED_SPECIFIED 0x8859 /* 89 - no preferred name specified */
-#define ERROR_OPENING_SOCKET 0x885A /* 90 - error opening a socket */
-#define REQUESTER_FAILURE 0x885A /* Client-32 */
-#define RESOURCE_ACCESS_DENIED 0x885B /* Client-32 */
-#define SIGNATURE_LEVEL_CONFLICT 0x8861
-#define NO_LOCK_FOUND 0x8862 /* OS/2 - process lock on conn handle failed, process ID not recognized */
-#define LOCK_TABLE_FULL 0x8863 /* OS/2 - process lock on conn handle failed, process lock table full */
-#define INVALID_MATCH_DATA 0x8864
-#define MATCH_FAILED 0x8865
-#define NO_MORE_ENTRIES 0x8866
-#define INSUFFICIENT_RESOURCES 0x8867
-#define STRING_TRANSLATION 0x8868
-#define STRING_TRANSLATION_NEEDED 0x8868 /* Client-32 */
-#define ACCESS_VIOLATION 0x8869
-#define NOT_AUTHENTICATED 0x886A
-#define INVALID_LEVEL 0x886B
-#define RESOURCE_LOCK_ERROR 0x886C
-#define INVALID_NAME_FORMAT 0x886D
-#define OBJECT_EXISTS 0x886E
-#define OBJECT_NOT_FOUND 0x886F
-#define UNSUPPORTED_TRAN_TYPE 0x8870
-#define INVALID_STRING_TYPE 0x8871
-#define INVALID_OWNER 0x8872
-#define UNSUPPORTED_AUTHENTICATOR 0x8873
-#define IO_PENDING 0x8874
-#define INVALID_DRIVE_NUM 0x8875
-#define SHELL_FAILURE 0x88FF
-#define VLM_FAILURE 0x88FF
-
-#define SVC_ALREADY_REGISTERED 0x8880 /* Client-32 */
-#define SVC_REGISTRY_FULL 0x8881 /* Client-32 */
-#define SVC_NOT_REGISTERED 0x8882 /* Client-32 */
-#define OUT_OF_RESOURCES 0x8883 /* Client-32 */
-#define RESOLVE_SVC_FAILED 0x8884 /* Client-32 */
-#define CONNECT_FAILED 0x8885 /* Client-32 */
-#define PROTOCOL_NOT_BOUND 0x8886 /* Client-32 */
-#define AUTHENTICATION_FAILED 0x8887 /* Client-32 */
-#define INVALID_AUTHEN_HANDLE 0x8888 /* Client-32 */
-#define AUTHEN_HANDLE_ALREADY_EXISTS 0x8889 /* Client-32 */
-
-#define DIFF_OBJECT_ALREADY_AUTHEN 0x8890 /* Client-32 */
-#define REQUEST_NOT_SERVICEABLE 0x8891 /* Client-32 */
-#define AUTO_RECONNECT_SO_REBUILD 0x8892 /* Client-32 */
-#define AUTO_RECONNECT_RETRY_REQUEST 0x8893 /* Client-32 */
-#define ASYNC_REQUEST_IN_USE 0x8894 /* Client-32 */
-#define ASYNC_REQUEST_CANCELED 0x8895 /* Client-32 */
-#define SESS_SVC_ALREADY_REGISTERED 0x8896 /* Client-32 */
-#define SESS_SVC_NOT_REGISTERED 0x8897 /* Client-32 */
-#define PREVIOUSLY_AUTHENTICATED 0x8899 /* Client-32 */
-#define RESOLVE_SVC_PARTIAL 0x889A /* Client-32 */
-#define NO_DEFAULT_SPECIFIED 0x889B /* Client-32 */
-#define HOOK_REQUEST_NOT_HANDLED 0x889C /* Client-32 */
-#define HOOK_REQUEST_BUSY 0x889D /* Client-32 */
-#define HOOK_REQUEST_QUEUED 0x889D /* Client-32 */
-#define AUTO_RECONNECT_SO_IGNORE 0x889E /* Client-32 */
-#define ASYNC_REQUEST_NOT_IN_USE 0x889F /* Client-32 */
-#define AUTO_RECONNECT_FAILURE 0x88A0 /* Client-32 */
-#define NET_ERROR_ABORT_APPLICATION 0x88A1 /* Client-32 */
-#define NET_ERROR_SUSPEND_APPLICATION 0x88A2 /* Client-32 */
-#define NET_ERROR_ABORTED_PROCESS_GROUP 0x88A3 /* Client-32 */
-#define NET_ERROR_PASSWORD_HAS_EXPIRED 0x88A5 /* Client-32 */
-#define NET_ERROR_NETWORK_INACTIVE 0x88A6 /* Client-32 */
-#define REPLY_TRUNCATED 0x88e6 /* 230 NLM */
-
-
-/* Server Errors */
-
-#define ERR_INSUFFICIENT_SPACE 0x8901 /* 001 */
-#define ERR_NO_MORE_ENTRY 0x8914 /* 020 */
-#define NLM_INVALID_CONNECTION 0x890a /* 010 */
-#define ERR_BUFFER_TOO_SMALL 0x8977 /* 119 */
-#define ERR_VOLUME_FLAG_NOT_SET 0x8978 /* 120 the service requested, not avail. on the selected vol. */
-#define ERR_NO_ITEMS_FOUND 0x8979 /* 121 */
-#define ERR_CONN_ALREADY_TEMP 0x897a /* 122 */
-#define ERR_CONN_ALREADY_LOGGED_IN 0x897b /* 123 */
-#define ERR_CONN_NOT_AUTHENTICATED 0x897c /* 124 */
-#define ERR_CONN_NOT_LOGGED_IN 0x897d /* 125 */
-#define NCP_BOUNDARY_CHECK_FAILED 0x897e /* 126 */
-#define ERR_LOCK_WAITING 0x897f /* 127 */
-#define ERR_LOCK_FAIL 0x8980 /* 128 */
-#define FILE_IN_USE_ERROR 0x8980 /* 128 */
-#define NO_MORE_FILE_HANDLES 0x8981 /* 129 */
-#define NO_OPEN_PRIVILEGES 0x8982 /* 130 */
-#define IO_ERROR_NETWORK_DISK 0x8983 /* 131 */
-#define ERR_AUDITING_HARD_IO_ERROR 0x8983 /* 131 */
-#define NO_CREATE_PRIVILEGES 0x8984 /* 132 */
-#define ERR_AUDITING_NOT_SUPV 0x8984 /* 132 */
-#define NO_CREATE_DELETE_PRIVILEGES 0x8985 /* 133 */
-#define CREATE_FILE_EXISTS_READ_ONLY 0x8986 /* 134 */
-#define WILD_CARDS_IN_CREATE_FILE_NAME 0x8987 /* 135 */
-#define CREATE_FILENAME_ERROR 0x8987 /* 135 */
-#define INVALID_FILE_HANDLE 0x8988 /* 136 */
-#define NO_SEARCH_PRIVILEGES 0x8989 /* 137 */
-#define NO_DELETE_PRIVILEGES 0x898A /* 138 */
-#define NO_RENAME_PRIVILEGES 0x898B /* 139 */
-#define NO_MODIFY_PRIVILEGES 0x898C /* 140 */
-#define SOME_FILES_AFFECTED_IN_USE 0x898D /* 141 */
-#define NO_FILES_AFFECTED_IN_USE 0x898E /* 142 */
-#define SOME_FILES_AFFECTED_READ_ONLY 0x898F /* 143 */
-#define NO_FILES_AFFECTED_READ_ONLY 0x8990 /* 144 */
-#define SOME_FILES_RENAMED_NAME_EXISTS 0x8991 /* 145 */
-#define NO_FILES_RENAMED_NAME_EXISTS 0x8992 /* 146 */
-#define NO_READ_PRIVILEGES 0x8993 /* 147 */
-#define NO_WRITE_PRIVILEGES_OR_READONLY 0x8994 /* 148 */
-#define FILE_DETACHED 0x8995 /* 149 */
-#define SERVER_OUT_OF_MEMORY 0x8996 /* 150 */
-#define ERR_TARGET_NOT_A_SUBDIRECTORY 0x8996 /* 150 can be changed later (note written by server people). */
-#define NO_DISK_SPACE_FOR_SPOOL_FILE 0x8997 /* 151 */
-#define ERR_AUDITING_NOT_ENABLED 0x8997 /* 151 */
-#define VOLUME_DOES_NOT_EXIST 0x8998 /* 152 */
-#define DIRECTORY_FULL 0x8999 /* 153 */
-#define RENAMING_ACROSS_VOLUMES 0x899A /* 154 */
-#define BAD_DIRECTORY_HANDLE 0x899B /* 155 */
-#define INVALID_PATH 0x899C /* 156 */
-#define NO_MORE_TRUSTEES 0x899C /* 156 */
-#define NO_MORE_DIRECTORY_HANDLES 0x899D /* 157 */
-#define INVALID_FILENAME 0x899E /* 158 */
-#define DIRECTORY_ACTIVE 0x899F /* 159 */
-#define DIRECTORY_NOT_EMPTY 0x89A0 /* 160 */
-#define DIRECTORY_IO_ERROR 0x89A1 /* 161 */
-#define READ_FILE_WITH_RECORD_LOCKED 0x89A2 /* 162 */
-#define ERR_TRANSACTION_RESTARTED 0x89A3 /* 163 */
-#define ERR_RENAME_DIR_INVALID 0x89A4 /* 164 */
-#define ERR_INVALID_OPENCREATE_MODE 0x89A5 /* 165 */
-#define ERR_ALREADY_IN_USE 0x89A6 /* 166 */
-#define ERR_AUDITING_ACTIVE 0x89A6 /* 166 */
-#define ERR_INVALID_RESOURCE_TAG 0x89A7 /* 167 */
-#define ERR_ACCESS_DENIED 0x89A8 /* 168 */
-#define ERR_AUDITING_NO_RIGHTS 0x89A8 /* 168 */
-#define INVALID_DATA_STREAM 0x89BE /* 190 */
-#define INVALID_NAME_SPACE 0x89BF /* 191 */
-#define NO_ACCOUNTING_PRIVILEGES 0x89C0 /* 192 */
-#define LOGIN_DENIED_NO_ACCOUNT_BALANCE 0x89C1 /* 193 */
-#define LOGIN_DENIED_NO_CREDIT 0x89C2 /* 194 */
-#define ERR_AUDITING_RECORD_SIZE 0x89C2 /* 194 */
-#define ERR_TOO_MANY_HOLDS 0x89C3 /* 195 */
-#define ACCOUNTING_DISABLED 0x89C4 /* 196 */
-#define INTRUDER_DETECTION_LOCK 0x89C5 /* 197 */
-#define NO_CONSOLE_OPERATOR 0x89C6 /* 198 */
-#define NO_CONSOLE_PRIVILEGES 0x89C6 /* 198 */
-#define ERR_Q_IO_FAILURE 0x89D0 /* 208 */
-#define ERR_NO_QUEUE 0x89D1 /* 209 */
-#define ERR_NO_Q_SERVER 0x89D2 /* 210 */
-#define ERR_NO_Q_RIGHTS 0x89D3 /* 211 */
-#define ERR_Q_FULL 0x89D4 /* 212 */
-#define ERR_NO_Q_JOB 0x89D5 /* 213 */
-#define ERR_NO_Q_JOB_RIGHTS 0x89D6 /* 214 */
-#define ERR_Q_IN_SERVICE 0x89D7 /* 215 */
-#define PASSWORD_NOT_UNIQUE 0x89D7 /* 215 */
-#define ERR_Q_NOT_ACTIVE 0x89D8 /* 216 */
-#define PASSWORD_TOO_SHORT 0x89D8 /* 216 */
-#define ERR_Q_STN_NOT_SERVER 0x89D9 /* 217 */
-#define LOGIN_DENIED_NO_CONNECTION 0x89D9 /* 217 */
-#define ERR_MAXIMUM_LOGINS_EXCEEDED 0x89D9 /* 217 */
-#define ERR_Q_HALTED 0x89DA /* 218 */
-#define UNAUTHORIZED_LOGIN_TIME 0x89DA /* 218 */
-#define UNAUTHORIZED_LOGIN_STATION 0x89DB /* 219 */
-#define ERR_Q_MAX_SERVERS 0x89DB /* 219 */
-#define ACCOUNT_DISABLED 0x89DC /* 220 */
-#define PASSWORD_HAS_EXPIRED_NO_GRACE 0x89DE /* 222 */
-#define PASSWORD_HAS_EXPIRED 0x89DF /* 223 */
-#define E_NO_MORE_USERS 0x89E7 /* 231 */
-#define NOT_ITEM_PROPERTY 0x89E8 /* 232 */
-#define WRITE_PROPERTY_TO_GROUP 0x89E8 /* 232 */
-#define MEMBER_ALREADY_EXISTS 0x89E9 /* 233 */
-#define NO_SUCH_MEMBER 0x89EA /* 234 */
-#define NOT_GROUP_PROPERTY 0x89EB /* 235 */
-#define NO_SUCH_SEGMENT 0x89EC /* 236 */
-#define PROPERTY_ALREADY_EXISTS 0x89ED /* 237 */
-#define OBJECT_ALREADY_EXISTS 0x89EE /* 238 */
-#define INVALID_NAME 0x89EF /* 239 */
-#define WILD_CARD_NOT_ALLOWED 0x89F0 /* 240 */
-#define INVALID_BINDERY_SECURITY 0x89F1 /* 241 */
-#define NO_OBJECT_READ_PRIVILEGE 0x89F2 /* 242 */
-#define NO_OBJECT_RENAME_PRIVILEGE 0x89F3 /* 243 */
-#define NO_OBJECT_DELETE_PRIVILEGE 0x89F4 /* 244 */
-#define NO_OBJECT_CREATE_PRIVILEGE 0x89F5 /* 245 */
-#define NO_PROPERTY_DELETE_PRIVILEGE 0x89F6 /* 246 */
-#define NO_PROPERTY_CREATE_PRIVILEGE 0x89F7 /* 247 */
-#define NO_PROPERTY_WRITE_PRIVILEGE 0x89F8 /* 248 */
-#define NO_FREE_CONNECTION_SLOTS 0x89F9 /* 249 */
-#define NO_PROPERTY_READ_PRIVILEGE 0x89F9 /* 249 */
-#define NO_MORE_SERVER_SLOTS 0x89FA /* 250 */
-#define TEMP_REMAP_ERROR 0x89FA /* 250 */
-#define INVALID_PARAMETERS 0x89FB /* 251 */
-#define NO_SUCH_PROPERTY 0x89FB /* 251 */
-#define ERR_NCP_NOT_SUPPORTED 0x89FB /* 251 */
-#define INTERNET_PACKET_REQT_CANCELED 0x89FC /* 252 */
-#define UNKNOWN_FILE_SERVER 0x89FC /* 252 */
-#define MESSAGE_QUEUE_FULL 0x89FC /* 252 */
-#define NO_SUCH_OBJECT 0x89FC /* 252 */
-#define LOCK_COLLISION 0x89FD /* 253 */
-#define BAD_STATION_NUMBER 0x89FD /* 253 */
-#define INVALID_PACKET_LENGTH 0x89FD /* 253 */
-#define UNKNOWN_REQUEST 0x89FD /* 253 */
-#define BINDERY_LOCKED 0x89FE /* 254 */
-#define TRUSTEE_NOT_FOUND 0x89FE /* 254 */
-#define DIRECTORY_LOCKED 0x89FE /* 254 */
-#define INVALID_SEMAPHORE_NAME_LENGTH 0x89FE /* 254 */
-#define PACKET_NOT_DELIVERABLE 0x89FE /* 254 */
-#define SERVER_BINDERY_LOCKED 0x89FE /* 254 */
-#define SOCKET_TABLE_FULL 0x89FE /* 254 */
-#define SPOOL_DIRECTORY_ERROR 0x89FE /* 254 */
-#define SUPERVISOR_HAS_DISABLED_LOGIN 0x89FE /* 254 */
-#define TIMEOUT_FAILURE 0x89FE /* 254 */
-#define BAD_PRINTER_ERROR 0x89FF /* 255 */
-#define BAD_RECORD_OFFSET 0x89FF /* 255 */
-#define CLOSE_FCB_ERROR 0x89FF /* 255 */
-#define FILE_EXTENSION_ERROR 0x89FF /* 255 */
-#define FILE_NAME_ERROR 0x89FF /* 255 */
-#define HARDWARE_FAILURE 0x89FF /* 255 */
-#define INVALID_DRIVE_NUMBER 0x89FF /* 255 */
-#define DOS_INVALID_DRIVE 0x000F /* 255 */
-#define INVALID_INITIAL_SEMAPHORE_VALUE 0x89FF /* 255 */
-#define INVALID_SEMAPHORE_HANDLE 0x89FF /* 255 */
-#define IO_BOUND_ERROR 0x89FF /* 255 */
-#define NO_FILES_FOUND_ERROR 0x89FF /* 255 */
-#define NO_RESPONSE_FROM_SERVER 0x89FF /* 255 */
-#define NO_SUCH_OBJECT_OR_BAD_PASSWORD 0x89FF /* 255 */
-#define PATH_NOT_LOCATABLE 0x89FF /* 255 */
-#define QUEUE_FULL_ERROR 0x89FF /* 255 */
-#define REQUEST_NOT_OUTSTANDING 0x89FF /* 255 */
-#ifndef SOCKET_ALREADY_OPEN
-#define SOCKET_ALREADY_OPEN 0x89FF /* 255 */
-#endif
-#define LOCK_ERROR 0x89FF /* 255 */
-#ifndef FAILURE
-#define FAILURE 0x89FF /* 255 Generic Failure */
-#endif
-
-/* #define NOT_SAME_LOCAL_DRIVE 0x89F6 */
-/* #define TARGET_DRIVE_NOT_LOCAL 0x89F7 */
-/* #define ALREADY_ATTACHED_TO_SERVER 0x89F8 */ /* 248 */
-/* #define NOT_ATTACHED_TO_SERVER 0x89F8 */
-
-/**** Network errors ****/
-/* Decimal values at end of line are 32768 lower than actual */
-
-#define NWE_ALREADY_ATTACHED 0x8800 /* 0 - Attach attempted to server with valid, existing connection */
-#define NWE_CONN_INVALID 0x8801 /* 1 - Request attempted with invalid or non-attached connection handle */
-#define NWE_DRIVE_IN_USE 0x8802 /* 2 - OS/2 only (NOT USED) */
-#define NWE_DRIVE_CANNOT_MAP 0x8803 /* 3 - Map drive attempted but unable to add new current directory structure */
-#define NWE_DRIVE_BAD_PATH 0x8804 /* 4 - Map drive attempted with invalid path specification */
-#define NWE_NET_RECEIVE 0x8805 /* 5 - Attempt to receive from the selected transport failed */
-#define NWE_NET_UNKNOWN 0x8806 /* 6 - Network send attempted with an un-specific network error */
-#define NWE_SERVER_BAD_SLOT 0x8807 /* 7 - Server request attempted with invalid server connection slot */
-#define NWE_SERVER_NO_SLOTS 0x8808 /* 8 - Attach attempted to server with no connection slots available */
-#define NWE_NET_SEND 0x8809 /* 9 - Attempt to send on the selected transport failed */
-#define NWE_SERVER_NO_ROUTE 0x880A /* 10 - Attempted to find route to server where no route exists */
-#define NWE_BAD_LOCAL_TARGET 0x880B /* 11 - OS/2 only */
-#define NWE_REQ_TOO_MANY_REQ_FRAGS 0x880C /* 12 - Attempted request with too many request fragments specified */
-#define NWE_CONN_LIST_OVERFLOW 0x880D /* 13 */
-#define NWE_BUFFER_OVERFLOW 0x880E /* 14 - Attempt to receive more data than the reply buffer had room for */
-#define NWE_SERVER_NO_CONN 0x880F /* 15 - Attempt to get connection for a server not connected */
-#define NWE_NO_ROUTER_FOUND 0x8810 /* 16 - OS/2 only */
-#define NWE_FUNCTION_INVALID 0x8811 /* 17 - Attempted function call to non- existent or illegal function */
-#define NWE_SCAN_COMPLETE 0x8812
-#define NWE_UNSUPPORTED_NAME_FORMAT_TYP 0x8813
-#define NWE_HANDLE_ALREADY_LICENSED 0x8814
-#define NWE_HANDLE_ALREADY_UNLICENSED 0x8815
-#define NWE_INVALID_NCP_PACKET_LENGTH 0x8816
-#define NWE_SETTING_UP_TIMEOUT 0x8817
-#define NWE_SETTING_SIGNALS 0x8818
-#define NWE_SERVER_CONNECTION_LOST 0x8819
-#define NWE_OUT_OF_HEAP_SPACE 0x881A
-#define NWE_INVALID_SERVICE_REQUEST 0x881B
-#define NWE_INVALID_TASK_NUMBER 0x881C
-#define NWE_INVALID_MESSAGE_LENGTH 0x881D
-#define NWE_EA_SCAN_DONE 0x881E
-#define NWE_BAD_CONNECTION_NUMBER 0x881F
-#define NWE_MULT_TREES_NOT_SUPPORTED 0x8820 /* 32 - Attempt to open a connection to a DS tree other than the default tree */
-#define NWE_CONN_NOT_SAME 0x8830 /* 48 - Internal server request attempted across different server connections */
-#define NWE_CONN_PRIMARY_NOT_SET 0x8831 /* 49 - Attempt to retrieve default connection with no primary connection set */
-#define NWE_PRN_CAPTURE_NOT_IN_PROGRESS 0x8832 /* 50 - Capture information requested on port with no capture in progress */
-#define NWE_BUFFER_INVALID_LEN 0x8833 /* 51 - Used to indicate length which caller requested on a GetDNC or SetDNC was too large */
-#define NWE_USER_NO_NAME 0x8834 /* 52 */
-#define NWE_PRN_NO_LOCAL_SPOOLER 0x8835 /* 53 - Capture requested without having the local print spooler installed */
-#define NWE_PARAM_INVALID 0x8836 /* 54 - Attempted function with an invalid function parameter specified */
-#define NWE_CFG_OPEN_FAILED 0x8837 /* 55 - OS/2 only */
-#define NWE_CFG_NO_FILE 0x8838 /* 56 - OS/2 only */
-#define NWE_CFG_READ_FAILED 0x8839 /* 57 - OS/2 only */
-#define NWE_CFG_LINE_TOO_LONG 0x883A /* 58 - OS/2 only */
-#define NWE_CFG_LINES_IGNORED 0x883B /* 59 - OS/2 only */
-#define NWE_RESOURCE_NOT_OWNED 0x883C /* 60 - Attempted request made with a parameter using foriegn resource */
-#define NWE_DAEMON_INSTALLED 0x883D /* 61 - OS/2 only */
-#define NWE_PRN_SPOOLER_INSTALLED 0x883E /* 62 - Attempted load of print spooler with print spooler already installed */
-#define NWE_CONN_TABLE_FULL 0x883F /* 63 - Attempted to allocate a connection handle with no more local connection table entries */
-#define NWE_CFG_SECTION_NOT_FOUND 0x8840 /* 64 - OS/2 only */
-#define NWE_TRAN_INVALID_TYPE 0x8841 /* 65 - Attempted function on a connection with an invalid transport selected */
-#define NWE_TDS_TAG_IN_USE 0x8842 /* 66 - OS/2 only */
-#define NWE_TDS_OUT_OF_MEMORY 0x8843 /* 67 - OS/2 only */
-#define NWE_TDS_INVALID_TAG 0x8844 /* 68 - Attempted TDS function with invalid tag */
-#define NWE_TDS_WRITE_TRUNCATED 0x8845 /* 69 - Attempted TDS write with buffer that exceeded buffer */
-#define NWE_DS_NO_CONN 0x8846 /* 70 */
-#define NWE_SERVICE_BUSY 0x8846 /* 70 - Attempted request made to partially asynchronous function in busy state */
-#define NWE_SERVER_NOT_FOUND 0x8847 /* 71 - Attempted connect failed to find any servers responding */
-#define NWE_VLM_INVALID 0x8848 /* 72 - Attempted function call to non-existant or not-loaded overlay */
-#define NWE_DRIVE_ALREADY_MAPPED 0x8849 /* 73 - Attempted map to network drive that was already mapped */
-#define NWE_DRIVE_LOCAL_IN_USE 0x884A /* 74 - Attempted map to local drive that was in use */
-#define NWE_DRIVE_NONE_AVAILABLE 0x884B /* 75 - Attempted map to next available drive when none were available */
-#define NWE_DEVICE_NOT_REDIRECTED 0x884C /* 76 - The device is not redirected */
-#define NWE_FILE_MAX_REACHED 0x884D /* 77 - Maximum number of files was reached */
-#define NWE_UNLOAD_FAILED 0x884E /* 78 - Attempted unload failed */
-#define NWE_CONN_IN_USE 0x884F /* 79 - Attempted re-use of already in use connection entry */
-#define NWE_REQ_TOO_MANY_REP_FRAGS 0x8850 /* 80 - Attempted request with too many reply fragments specified */
-#define NWE_NAME_TABLE_FULL 0x8851 /* 81 - Attempted to add a name into the name table after it was full */
-#define NWE_SOCKET_NOT_OPEN 0x8852 /* 82 - Listen was posted on unopened socket */
-#define NWE_MEMORY_MGR_ERROR 0x8853 /* 83 - Attempted enhanced memory operation failed */
-#define NWE_SFT3_ERROR 0x8854 /* 84 - An SFT3 switch occured mid-transfer */
-#define NWE_DS_PREFERRED_NOT_FOUND 0x8855 /* 85 - the preferred directory server was not established but another directory server was returned */
-#define NWE_DEVICE_NOT_RECOGNIZED 0x8856 /* 86 - used to determine if the device is not used by VISE so pass it on to the next redirector, if any. */
-#define NWE_NET_INVALID_TYPE 0x8857 /* 87 - the network type (Bind/NDS) does not match the server version */
-#define NWE_FILE_OPEN_FAILED 0x8858 /* 88 - generic open failure error, invalid path, access denied, etc.. */
-#define NWE_DS_PREFERRED_NOT_SPECIFIED 0x8859 /* 89 - no preferred name specified */
-#define NWE_SOCKET_OPEN_FAILED 0x885A /* 90 - error opening a socket */
-#define NWE_SIGNATURE_LEVEL_CONFLICT 0x8861
-#define NWE_NO_LOCK_FOUND 0x8862 /* OS/2 - process lock on conn handle failed, process ID not recognized */
-#define NWE_LOCK_TABLE_FULL 0x8863 /* OS/2 - process lock on conn handle failed, process lock table full */
-#define NWE_INVALID_MATCH_DATA 0x8864
-#define NWE_MATCH_FAILED 0x8865
-#define NWE_NO_MORE_ENTRIES 0x8866
-#define NWE_INSUFFICIENT_RESOURCES 0x8867
-#define NWE_STRING_TRANSLATION 0x8868
-#define NWE_ACCESS_VIOLATION 0x8869
-#define NWE_NOT_AUTHENTICATED 0x886A
-#define NWE_INVALID_LEVEL 0x886B
-#define NWE_RESOURCE_LOCK 0x886C
-#define NWE_INVALID_NAME_FORMAT 0x886D
-#define NWE_OBJECT_EXISTS 0x886E
-#define NWE_OBJECT_NOT_FOUND 0x886F
-#define NWE_UNSUPPORTED_TRAN_TYPE 0x8870
-#define NWE_INVALID_STRING_TYPE 0x8871
-#define NWE_INVALID_OWNER 0x8872
-#define NWE_UNSUPPORTED_AUTHENTICATOR 0x8873
-#define NWE_IO_PENDING 0x8874
-#define NWE_INVALID_DRIVE_NUMBER 0x8875
-#define NWE_REPLY_TRUNCATED 0x88e6 /* 230 NLM */
-#define NWE_REQUESTER_FAILURE 0x88FF
-
-/* Server Errors */
-
-#define NWE_INSUFFICIENT_SPACE 0x8901 /* 001 */
-#define NWE_BUFFER_TOO_SMALL 0x8977 /* 119 */
-#define NWE_VOL_FLAG_NOT_SET 0x8978 /* 120 the service requested, not avail. on the selected vol. */
-#define NWE_NO_ITEMS_FOUND 0x8979 /* 121 */
-#define NWE_CONN_ALREADY_TEMP 0x897a /* 122 */
-#define NWE_CONN_ALREADY_LOGGED_IN 0x897b /* 123 */
-#define NWE_CONN_NOT_AUTHENTICATED 0x897c /* 124 */
-#define NWE_CONN_NOT_LOGGED_IN 0x897d /* 125 */
-#define NWE_NCP_BOUNDARY_CHECK_FAILED 0x897e /* 126 */
-#define NWE_LOCK_WAITING 0x897f /* 127 */
-#define NWE_LOCK_FAIL 0x8980 /* 128 */
-#define NWE_FILE_IN_USE 0x8980 /* 128 */
-#define NWE_FILE_NO_HANDLES 0x8981 /* 129 */
-#define NWE_FILE_NO_OPEN_PRIV 0x8982 /* 130 */
-#define NWE_DISK_IO_ERROR 0x8983 /* 131 */
-#define NWE_AUDITING_HARD_IO_ERROR 0x8983 /* 131 */
-#define NWE_FILE_NO_CREATE_PRIV 0x8984 /* 132 */
-#define NWE_AUDITING_NOT_SUPV 0x8984 /* 132 */
-#define NWE_FILE_NO_CREATE_DEL_PRIV 0x8985 /* 133 */
-#define NWE_FILE_EXISTS_READ_ONLY 0x8986 /* 134 */
-#define NWE_FILE_WILD_CARDS_IN_NAME 0x8987 /* 135 */
-#define NWE_FILE_INVALID_HANDLE 0x8988 /* 136 */
-#define NWE_FILE_NO_SRCH_PRIV 0x8989 /* 137 */
-#define NWE_FILE_NO_DEL_PRIV 0x898A /* 138 */
-#define NWE_FILE_NO_RENAME_PRIV 0x898B /* 139 */
-#define NWE_FILE_NO_MOD_PRIV 0x898C /* 140 */
-#define NWE_FILE_SOME_IN_USE 0x898D /* 141 */
-#define NWE_FILE_NONE_IN_USE 0x898E /* 142 */
-#define NWE_FILE_SOME_READ_ONLY 0x898F /* 143 */
-#define NWE_FILE_NONE_READ_ONLY 0x8990 /* 144 */
-#define NWE_FILE_SOME_RENAMED_EXIST 0x8991 /* 145 */
-#define NWE_FILE_NONE_RENAMED_EXIST 0x8992 /* 146 */
-#define NWE_FILE_NO_READ_PRIV 0x8993 /* 147 */
-#define NWE_FILE_NO_WRITE_PRIV 0x8994 /* 148 */
-#define NWE_FILE_READ_ONLY 0x8994 /* 148 */
-#define NWE_FILE_DETACHED 0x8995 /* 149 */
-#define NWE_SERVER_OUT_OF_MEMORY 0x8996 /* 150 */
-#define NWE_DIR_TARGET_INVALID 0x8996 /* 150 */
-#define NWE_DISK_NO_SPOOL_SPACE 0x8997 /* 151 */
-#define NWE_AUDITING_NOT_ENABLED 0x8997 /* 151 */
-#define NWE_VOL_INVALID 0x8998 /* 152 */
-#define NWE_DIR_FULL 0x8999 /* 153 */
-#define NWE_VOL_RENAMING_ACROSS 0x899A /* 154 */
-#define NWE_DIRHANDLE_INVALID 0x899B /* 155 */
-#define NWE_PATH_INVALID 0x899C /* 156 */
-#define NWE_TRUSTEES_NO_MORE 0x899C /* 156 */
-#define NWE_DIRHANDLE_NO_MORE 0x899D /* 157 */
-#define NWE_FILE_NAME_INVALID 0x899E /* 158 */
-#define NWE_DIR_ACTIVE 0x899F /* 159 */
-#define NWE_DIR_NOT_EMPTY 0x89A0 /* 160 */
-#define NWE_DIR_IO_ERROR 0x89A1 /* 161 */
-#define NWE_FILE_IO_LOCKED 0x89A2 /* 162 */
-#define NWE_TTS_RANSACTION_RESTARTED 0x89A3 /* 163 */
-#define NWE_TTS_TRANSACTION_RESTARTED 0x89A3 /* 163 */
-#define NWE_DIR_RENAME_INVALID 0x89A4 /* 164 */
-#define NWE_FILE_OPENCREAT_MODE_INVALID 0x89A5 /* 165 */
-#define NWE_ALREADY_IN_USE 0x89A6 /* 166 */
-#define NWE_AUDITING_ACTIVE 0x89A6 /* 166 */
-#define NWE_RESOURCE_TAG_INVALID 0x89A7 /* 167 */
-#define NWE_ACCESS_DENIED 0x89A8 /* 168 */
-#define NWE_AUDITING_NO_RIGHTS 0x89A8 /* 168 */
-#define NWE_DATA_STREAM_INVALID 0x89BE /* 190 */
-#define NWE_NAME_SPACE_INVALID 0x89BF /* 191 */
-#define NWE_ACCTING_NO_PRIV 0x89C0 /* 192 */
-#define NWE_ACCTING_NO_BALANCE 0x89C1 /* 193 */
-#define NWE_ACCTING_NO_CREDIT 0x89C2 /* 194 */
-#define NWE_AUDITING_RECORD_SIZE 0x89C2 /* 194 */
-#define NWE_ACCTING_TOO_MANY_HOLDS 0x89C3 /* 195 */
-#define NWE_ACCTING_DISABLED 0x89C4 /* 196 */
-#define NWE_LOGIN_LOCKOUT 0x89C5 /* 197 */
-#define NWE_CONSOLE_NO_PRIV 0x89C6 /* 198 */
-#define NWE_Q_IO_FAILURE 0x89D0 /* 208 */
-#define NWE_Q_NONE 0x89D1 /* 209 */
-#define NWE_Q_NO_SERVER 0x89D2 /* 210 */
-#define NWE_Q_NO_RIGHTS 0x89D3 /* 211 */
-#define NWE_Q_FULL 0x89D4 /* 212 */
-#define NWE_Q_NO_JOB 0x89D5 /* 213 */
-#define NWE_Q_NO_JOB_RIGHTS 0x89D6 /* 214 */
-#define NWE_PASSWORD_UNENCRYPTED 0x89D6 /* 214 */
-#define NWE_Q_IN_SERVICE 0x89D7 /* 215 */
-#define NWE_PASSWORD_NOT_UNIQUE 0x89D7 /* 215 */
-#define NWE_Q_NOT_ACTIVE 0x89D8 /* 216 */
-#define NWE_PASSWORD_TOO_SHORT 0x89D8 /* 216 */
-#define NWE_Q_STN_NOT_SERVER 0x89D9 /* 217 */
-#define NWE_LOGIN_NO_CONN 0x89D9 /* 217 */
-#define NWE_LOGIN_MAX_EXCEEDED 0x89D9 /* 217 */
-#define NWE_Q_HALTED 0x89DA /* 218 */
-#define NWE_LOGIN_UNAUTHORIZED_TIME 0x89DA /* 218 */
-#define NWE_LOGIN_UNAUTHORIZED_STATION 0x89DB /* 219 */
-#define NWE_Q_MAX_SERVERS 0x89DB /* 219 */
-#define NWE_ACCT_DISABLED 0x89DC /* 220 */
-#define NWE_PASSWORD_INVALID 0x89DE /* 222 */
-#define NWE_PASSWORD_EXPIRED 0x89DF /* 223 */
-#define NWE_LOGIN_NO_CONN_AVAIL 0x89E0 /* 224 */
-#define NWE_E_NO_MORE_USERS 0x89E7 /* 231 */
-#define NWE_BIND_NOT_ITEM_PROP 0x89E8 /* 232 */
-#define NWE_BIND_WRITE_TO_GROUP_PROP 0x89E8 /* 232 */
-#define NWE_BIND_MEMBER_ALREADY_EXISTS 0x89E9 /* 233 */
-#define NWE_BIND_NO_SUCH_MEMBER 0x89EA /* 234 */
-#define NWE_BIND_NOT_GROUP_PROP 0x89EB /* 235 */
-#define NWE_BIND_NO_SUCH_SEGMENT 0x89EC /* 236 */
-#define NWE_BIND_PROP_ALREADY_EXISTS 0x89ED /* 237 */
-#define NWE_BIND_OBJ_ALREADY_EXISTS 0x89EE /* 238 */
-#define NWE_BIND_NAME_INVALID 0x89EF /* 239 */
-#define NWE_BIND_WILDCARD_INVALID 0x89F0 /* 240 */
-#define NWE_BIND_SECURITY_INVALID 0x89F1 /* 241 */
-#define NWE_BIND_OBJ_NO_READ_PRIV 0x89F2 /* 242 */
-#define NWE_BIND_OBJ_NO_RENAME_PRIV 0x89F3 /* 243 */
-#define NWE_BIND_OBJ_NO_DELETE_PRIV 0x89F4 /* 244 */
-#define NWE_BIND_OBJ_NO_CREATE_PRIV 0x89F5 /* 245 */
-#define NWE_BIND_PROP_NO_DELETE_PRIV 0x89F6 /* 246 */
-#define NWE_BIND_PROP_NO_CREATE_PRIV 0x89F7 /* 247 */
-#define NWE_BIND_PROP_NO_WRITE_PRIV 0x89F8 /* 248 */
-#define NWE_BIND_PROP_NO_READ_PRIV 0x89F9 /* 249 */
-#define NWE_NO_FREE_CONN_SLOTS 0x89F9 /* 249 */
-#define NWE_NO_MORE_SERVER_SLOTS 0x89FA /* 250 */
-#define NWE_TEMP_REMAP_ERROR 0x89FA /* 250 */
-#define NWE_PARAMETERS_INVALID 0x89FB /* 251 */
-#define NWE_BIND_NO_SUCH_PROP 0x89FB /* 251 */
-#define NWE_NCP_NOT_SUPPORTED 0x89FB /* 251 */
-#define NWE_INET_PACKET_REQ_CANCELED 0x89FC /* 252 */
-#define NWE_SERVER_UNKNOWN 0x89FC /* 252 */
-#define NWE_MSG_Q_FULL 0x89FC /* 252 */
-#define NWE_BIND_NO_SUCH_OBJ 0x89FC /* 252 */
-#define NWE_LOCK_COLLISION 0x89FD /* 253 */
-#define NWE_CONN_NUM_INVALID 0x89FD /* 253 */
-#define NWE_PACKET_LEN_INVALID 0x89FD /* 253 */
-#define NWE_UNKNOWN_REQ 0x89FD /* 253 */
-#define NWE_BIND_LOCKED 0x89FE /* 254 */
-#define NWE_TRUSTEE_NOT_FOUND 0x89FE /* 254 */
-#define NWE_DIR_LOCKED 0x89FE /* 254 */
-#define NWE_SEM_INVALID_NAME_LEN 0x89FE /* 254 */
-#define NWE_PACKET_NOT_DELIVERABLE 0x89FE /* 254 */
-#define NWE_SOCKET_TABLE_FULL 0x89FE /* 254 */
-#define NWE_SPOOL_DIR_ERROR 0x89FE /* 254 */
-#define NWE_LOGIN_DISABLED_BY_SUPER 0x89FE /* 254 */
-#define NWE_TIMEOUT_FAILURE 0x89FE /* 254 */
-#define NWE_FILE_EXT 0x89FF /* 255 */
-#define NWE_FILE_NAME 0x89FF /* 255 */
-#define NWE_HARD_FAILURE 0x89FF /* 255 */
-#define NWE_FCB_CLOSE 0x89FF /* 255 */
-#define NWE_IO_BOUND 0x89FF /* 255 */
-#define NWE_BAD_SPOOL_PRINTER 0x89FF /* 255 */
-#define NWE_BAD_RECORD_OFFSET 0x89FF /* 255 */
-#define NWE_DRIVE_INVALID_NUM 0x89FF /* 255 */
-#define NWE_SEM_INVALID_INIT_VAL 0x89FF /* 255 */
-#define NWE_SEM_INVALID_HANDLE 0x89FF /* 255 */
-#define NWE_NO_FILES_FOUND_ERROR 0x89FF /* 255 */
-#define NWE_NO_RESPONSE_FROM_SERVER 0x89FF /* 255 */
-#define NWE_NO_OBJ_OR_BAD_PASSWORD 0x89FF /* 255 */
-#define NWE_PATH_NOT_LOCATABLE 0x89FF /* 255 */
-#define NWE_Q_FULL_ERROR 0x89FF /* 255 */
-#define NWE_REQ_NOT_OUTSTANDING 0x89FF /* 255 */
-#define NWE_SOCKET_ALREADY_OPEN 0x89FF /* 255 */
-#define NWE_LOCK_ERROR 0x89FF /* 255 */
-#define NWE_FAILURE 0x89FF /* 255 Generic Failure */
-
-#endif /* !_NWERROR_H_ */
OpenPOWER on IntegriCloud