From ac3e3d43d4bfa5d6b9dcc48360ec6bf36b03ed82 Mon Sep 17 00:00:00 2001 From: obrien Date: Sun, 2 Sep 2001 17:19:13 +0000 Subject: Virgin import of AMD (am-utils) v6.0.7 --- contrib/amd/hlfsd/hlfsd.8 | 4 +-- contrib/amd/hlfsd/hlfsd.c | 12 ++++----- contrib/amd/hlfsd/hlfsd.h | 21 ++++++--------- contrib/amd/hlfsd/homedir.c | 4 +-- contrib/amd/hlfsd/nfs_prot_svc.c | 34 ++++++++++++------------ contrib/amd/hlfsd/stubs.c | 57 +++++++++++----------------------------- 6 files changed, 51 insertions(+), 81 deletions(-) (limited to 'contrib/amd/hlfsd') diff --git a/contrib/amd/hlfsd/hlfsd.8 b/contrib/amd/hlfsd/hlfsd.8 index 956f30c..0c1f2c3 100644 --- a/contrib/amd/hlfsd/hlfsd.8 +++ b/contrib/amd/hlfsd/hlfsd.8 @@ -1,5 +1,5 @@ .\" -.\" Copyright (c) 1997-1999 Erez Zadok +.\" Copyright (c) 1997-2001 Erez Zadok .\" Copyright (c) 1989 Jan-Simon Pendry .\" Copyright (c) 1989 Imperial College of Science, Technology & Medicine .\" Copyright (c) 1989 The Regents of the University of California. @@ -36,7 +36,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: hlfsd.8,v 1.2 1999/01/10 21:54:32 ezk Exp $ +.\" $Id: hlfsd.8,v 1.3.2.1 2001/01/10 03:23:35 ezk Exp $ .\" .\" HLFSD was written at Columbia University Computer Science Department, by .\" Erez Zadok and Alexander Dupuy diff --git a/contrib/amd/hlfsd/hlfsd.c b/contrib/amd/hlfsd/hlfsd.c index 6b0f78f..8e5e83f 100644 --- a/contrib/amd/hlfsd/hlfsd.c +++ b/contrib/amd/hlfsd/hlfsd.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997-1999 Erez Zadok + * Copyright (c) 1997-2001 Erez Zadok * Copyright (c) 1989 Jan-Simon Pendry * Copyright (c) 1989 Imperial College of Science, Technology & Medicine * Copyright (c) 1989 The Regents of the University of California. @@ -38,7 +38,7 @@ * * %W% (Berkeley) %G% * - * $Id: hlfsd.c,v 1.5 1999/09/08 23:36:51 ezk Exp $ + * $Id: hlfsd.c,v 1.7.2.2 2001/01/10 03:23:35 ezk Exp $ * * HLFSD was written at Columbia University Computer Science Department, by * Erez Zadok and Alexander Dupuy @@ -95,11 +95,11 @@ nfstime startup; u_short nfs_port; /* symbol must be available always */ -#ifdef MOUNT_TABLE_ON_FILE +#ifdef MNTTAB_FILE_NAME char *mnttab_file_name = MNTTAB_FILE_NAME; -#else /* not MOUNT_TABLE_ON_FILE */ +#else /* not MNTTAB_FILE_NAME */ char *mnttab_file_name = NULL; -#endif /* not MOUNT_TABLE_ON_FILE */ +#endif /* not MNTTAB_FILE_NAME */ /* forward declarations */ void hlfsd_going_down(int rc); @@ -947,7 +947,7 @@ fatal(char *mess) am_get_progname(), lessmess, errno); } } - plog(XLOG_FATAL, mess); + plog(XLOG_FATAL, "%s", mess); hlfsd_going_down(1); } diff --git a/contrib/amd/hlfsd/hlfsd.h b/contrib/amd/hlfsd/hlfsd.h index e306ea3..c0e9fa9 100644 --- a/contrib/amd/hlfsd/hlfsd.h +++ b/contrib/amd/hlfsd/hlfsd.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997-1999 Erez Zadok + * Copyright (c) 1997-2001 Erez Zadok * Copyright (c) 1989 Jan-Simon Pendry * Copyright (c) 1989 Imperial College of Science, Technology & Medicine * Copyright (c) 1989 The Regents of the University of California. @@ -38,7 +38,7 @@ * * %W% (Berkeley) %G% * - * $Id: hlfsd.h,v 1.2 1999/01/10 21:54:32 ezk Exp $ + * $Id: hlfsd.h,v 1.4.2.2 2001/01/12 22:47:21 ro Exp $ * * HLFSD was written at Columbia University Computer Science Department, by * Erez Zadok and Alexander Dupuy @@ -52,7 +52,7 @@ * MACROS AND CONSTANTS: */ -#define HLFSD_VERSION "hlfsd 1.1 (March 4, 1997-1999)" +#define HLFSD_VERSION "hlfsd 1.1 (1993-2001)" #define PERS_SPOOLMODE 0755 #define OPEN_SPOOLMODE 01777 #define DOTSTRING "." @@ -70,21 +70,16 @@ * which define uid_t to be unsigned short, so I used the lowest common * size which is unsigned short. */ -#ifdef EXPERIMENTAL_UID_SIZE -#define UID_SHIFT 30 -# define ROOTID ((1 << UID_SHIFT) - 1) -# define SLINKID ((1 << UID_SHIFT) - 2) -# define INVALIDID ((1 << UID_SHIFT) - 3) -#else /* not EXPERIMENTAL_UID_SIZE */ /* * XXX: this will cause problems to systems with UIDs greater than * MAX_UNSIGNED_SHORT-3. */ -# define ROOTID (((unsigned short) ~0) - 1) -# define SLINKID (((unsigned short) ~0) - 2) +#define ROOTID (((unsigned short) ~0) - 1) +#define SLINKID (((unsigned short) ~0) - 2) +#ifndef INVALIDID +/* this is also defined in include/am_utils.h */ # define INVALIDID (((unsigned short) ~0) - 3) -#endif /* not EXPERIMENTAL_UID_SIZE */ - +#endif /* not INVALIDID */ #define DOTCOOKIE 1 #define DOTDOTCOOKIE 2 diff --git a/contrib/amd/hlfsd/homedir.c b/contrib/amd/hlfsd/homedir.c index b2897bf..e17418e 100644 --- a/contrib/amd/hlfsd/homedir.c +++ b/contrib/amd/hlfsd/homedir.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997-1999 Erez Zadok + * Copyright (c) 1997-2001 Erez Zadok * Copyright (c) 1989 Jan-Simon Pendry * Copyright (c) 1989 Imperial College of Science, Technology & Medicine * Copyright (c) 1989 The Regents of the University of California. @@ -38,7 +38,7 @@ * * %W% (Berkeley) %G% * - * $Id: homedir.c,v 1.4 1999/01/13 23:31:19 ezk Exp $ + * $Id: homedir.c,v 1.5.2.1 2001/01/10 03:23:36 ezk Exp $ * * HLFSD was written at Columbia University Computer Science Department, by * Erez Zadok and Alexander Dupuy diff --git a/contrib/amd/hlfsd/nfs_prot_svc.c b/contrib/amd/hlfsd/nfs_prot_svc.c index 3fdd196..26cead4 100644 --- a/contrib/amd/hlfsd/nfs_prot_svc.c +++ b/contrib/amd/hlfsd/nfs_prot_svc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997-1999 Erez Zadok + * Copyright (c) 1997-2001 Erez Zadok * Copyright (c) 1989 Jan-Simon Pendry * Copyright (c) 1989 Imperial College of Science, Technology & Medicine * Copyright (c) 1989 The Regents of the University of California. @@ -38,7 +38,7 @@ * * %W% (Berkeley) %G% * - * $Id: nfs_prot_svc.c,v 1.3 1999/01/13 23:31:19 ezk Exp $ + * $Id: nfs_prot_svc.c,v 1.4.2.2 2001/01/12 23:29:01 ro Exp $ * */ @@ -50,23 +50,23 @@ /* EXTERNAL FUNCTIONS */ extern voidp nfsproc_null_2_svc(voidp, struct svc_req *); -extern nfsattrstat * nfsproc_getattr_2_svc(am_nfs_fh *, struct svc_req *); -extern nfsattrstat * nfsproc_setattr_2_svc(nfssattrargs *, struct svc_req *); +extern nfsattrstat *nfsproc_getattr_2_svc(am_nfs_fh *, struct svc_req *); +extern nfsattrstat *nfsproc_setattr_2_svc(nfssattrargs *, struct svc_req *); extern voidp nfsproc_root_2_svc(voidp, struct svc_req *); -extern nfsdiropres * nfsproc_lookup_2_svc(nfsdiropargs *, struct svc_req *); -extern nfsreadlinkres * nfsproc_readlink_2_svc(am_nfs_fh *, struct svc_req *); -extern nfsreadres * nfsproc_read_2_svc(nfsreadargs *, struct svc_req *); +extern nfsdiropres *nfsproc_lookup_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsreadlinkres *nfsproc_readlink_2_svc(am_nfs_fh *, struct svc_req *); +extern nfsreadres *nfsproc_read_2_svc(nfsreadargs *, struct svc_req *); extern voidp nfsproc_writecache_2_svc(voidp, struct svc_req *); -extern nfsattrstat * nfsproc_write_2_svc(nfswriteargs *, struct svc_req *); -extern nfsdiropres * nfsproc_create_2_svc(nfscreateargs *, struct svc_req *); -extern nfsstat * nfsproc_remove_2_svc(nfsdiropargs *, struct svc_req *); -extern nfsstat * nfsproc_rename_2_svc(nfsrenameargs *, struct svc_req *); -extern nfsstat * nfsproc_link_2_svc(nfslinkargs *, struct svc_req *); -extern nfsstat * nfsproc_symlink_2_svc(nfssymlinkargs *, struct svc_req *); -extern nfsdiropres * nfsproc_mkdir_2_svc(nfscreateargs *, struct svc_req *); -extern nfsstat * nfsproc_rmdir_2_svc(nfsdiropargs *, struct svc_req *); -extern nfsreaddirres * nfsproc_readdir_2_svc(nfsreaddirargs *, struct svc_req *); -extern nfsstatfsres * nfsproc_statfs_2_svc(am_nfs_fh *, struct svc_req *); +extern nfsattrstat *nfsproc_write_2_svc(nfswriteargs *, struct svc_req *); +extern nfsdiropres *nfsproc_create_2_svc(nfscreateargs *, struct svc_req *); +extern nfsstat *nfsproc_remove_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsstat *nfsproc_rename_2_svc(nfsrenameargs *, struct svc_req *); +extern nfsstat *nfsproc_link_2_svc(nfslinkargs *, struct svc_req *); +extern nfsstat *nfsproc_symlink_2_svc(nfssymlinkargs *, struct svc_req *); +extern nfsdiropres *nfsproc_mkdir_2_svc(nfscreateargs *, struct svc_req *); +extern nfsstat *nfsproc_rmdir_2_svc(nfsdiropargs *, struct svc_req *); +extern nfsreaddirres *nfsproc_readdir_2_svc(nfsreaddirargs *, struct svc_req *); +extern nfsstatfsres *nfsproc_statfs_2_svc(am_nfs_fh *, struct svc_req *); /* GLOBALS */ SVCXPRT *nfs_program_2_transp; diff --git a/contrib/amd/hlfsd/stubs.c b/contrib/amd/hlfsd/stubs.c index 490166a..2d9b341 100644 --- a/contrib/amd/hlfsd/stubs.c +++ b/contrib/amd/hlfsd/stubs.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997-1999 Erez Zadok + * Copyright (c) 1997-2001 Erez Zadok * Copyright (c) 1989 Jan-Simon Pendry * Copyright (c) 1989 Imperial College of Science, Technology & Medicine * Copyright (c) 1989 The Regents of the University of California. @@ -38,7 +38,7 @@ * * %W% (Berkeley) %G% * - * $Id: stubs.c,v 1.3 1999/01/13 23:31:19 ezk Exp $ + * $Id: stubs.c,v 1.5.2.2 2001/01/10 03:23:36 ezk Exp $ * * HLFSD was written at Columbia University Computer Science Department, by * Erez Zadok and Alexander Dupuy @@ -61,7 +61,6 @@ static nfsfattr slinkfattr = {NFLNK, 0120777, 1, 0, 0, NFS_MAXPATHLEN, 512, 0, /* user name file attributes */ static nfsfattr un_fattr = {NFLNK, 0120777, 1, 0, 0, NFS_MAXPATHLEN, 512, 0, (NFS_MAXPATHLEN + 1) / 512, 0, INVALIDID}; -static int getcreds(struct svc_req *, uid_t *, gid_t *); static int started; static am_nfs_fh slink; static am_nfs_fh un_fhandle; @@ -144,7 +143,7 @@ nfsproc_getattr_2_svc(am_nfs_fh *argp, struct svc_req *rqstp) res.ns_u.ns_attr_u = slinkfattr; } else { - if (getcreds(rqstp, &uid, &gid) < 0) { + if (getcreds(rqstp, &uid, &gid, nfsxprt) < 0) { res.ns_status = NFSERR_STALE; return &res; } @@ -223,13 +222,23 @@ nfsproc_lookup_2_svc(nfsdiropargs *argp, struct svc_req *rqstp) } if (STREQ(argp->da_name, slinkname)) { +#ifndef MNT2_NFS_OPT_SYMTTL + /* + * This code is needed to defeat Solaris 2.4's (and newer) symlink + * values cache. It forces the last-modified time of the symlink to be + * current. It is not needed if the O/S has an nfs flag to turn off the + * symlink-cache at mount time (such as Irix 5.x and 6.x). -Erez. + */ + if (++slinkfattr.na_mtime.nt_useconds == 0) + ++slinkfattr.na_mtime.nt_seconds; +#endif /* not MNT2_NFS_OPT_SYMTTL */ res.dr_u.dr_drok_u.drok_fhandle = slink; res.dr_u.dr_drok_u.drok_attributes = slinkfattr; res.dr_status = NFS_OK; return &res; } - if (getcreds(rqstp, &uid, &gid) < 0 || gid != hlfs_gid) { + if (getcreds(rqstp, &uid, &gid, nfsxprt) < 0 || gid != hlfs_gid) { res.dr_status = NFSERR_NOENT; return &res; } @@ -260,40 +269,6 @@ nfsproc_lookup_2_svc(nfsdiropargs *argp, struct svc_req *rqstp) return &res; } -static int -getcreds(struct svc_req *rp, uid_t *u, gid_t *g) -{ - struct authunix_parms *aup = (struct authunix_parms *) NULL; -#ifdef HAVE_RPC_AUTH_DES_H - struct authdes_cred *adp; -#endif /* HAVE_RPC_AUTH_DES_H */ - - switch (rp->rq_cred.oa_flavor) { - - case AUTH_UNIX: - aup = (struct authunix_parms *) rp->rq_clntcred; - *u = aup->aup_uid; - *g = aup->aup_gid; - break; - -#ifdef HAVE_RPC_AUTH_DES_H - case AUTH_DES: - adp = (struct authdes_cred *) rp->rq_clntcred; - *g = INVALIDID; /* some unknown group id */ - if (sscanf(adp->adc_fullname.name, "unix.%lu@", (u_long *) u) == 1) - break; - /* fall through */ -#endif /* HAVE_RPC_AUTH_DES_H */ - - default: - *u = *g = INVALIDID; /* just in case */ - svcerr_weakauth(nfsxprt); - return -1; - } - - return 0; /* everything is ok */ -} - nfsreadlinkres * nfsproc_readlink_2_svc(am_nfs_fh *argp, struct svc_req *rqstp) @@ -309,7 +284,7 @@ nfsproc_readlink_2_svc(am_nfs_fh *argp, struct svc_req *rqstp) if (eq_fh(argp, &root)) { res.rlr_status = NFSERR_ISDIR; } else if (eq_fh(argp, &slink)) { - if (getcreds(rqstp, &userid, &groupid) < 0) + if (getcreds(rqstp, &userid, &groupid, nfsxprt) < 0) return (nfsreadlinkres *) NULL; gettimeofday((struct timeval *) &slinkfattr.na_atime, (struct timezone *) 0); @@ -328,7 +303,7 @@ nfsproc_readlink_2_svc(am_nfs_fh *argp, struct svc_req *rqstp) } else { /* check if asked for user mailbox */ - if (getcreds(rqstp, &userid, &groupid) < 0) { + if (getcreds(rqstp, &userid, &groupid, nfsxprt) < 0) { return (nfsreadlinkres *) NULL; } -- cgit v1.1